From da13cfb9bee24958775f46564f007a245ac82d72 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 8 Apr 2009 05:46:20 +0000 Subject: Replace GtkTooltips code with GtkTooltip on GTK+ 2.12+. --- pidgin/gtkblist.c | 4 ++++ pidgin/gtkconv.c | 13 +++++++++++++ pidgin/gtkconv.h | 4 ++++ pidgin/gtkdocklet-x11.c | 10 ++++++++++ pidgin/gtkimhtmltoolbar.c | 16 ++++++++++++++++ pidgin/gtkimhtmltoolbar.h | 4 ++++ pidgin/gtkmenutray.c | 10 +++++++++- pidgin/gtkmenutray.h | 4 ++++ 8 files changed, 64 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 89aaa51fcf..89701fe720 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -5269,6 +5269,9 @@ static void headline_style_set (GtkWidget *widget, GtkStyle *prev_style) { +#if GTK_CHECK_VERSION(2,12,0) + /* TODO: Need to figure out how to do this in 2.12+ */ +#else GtkTooltips *tooltips; GtkStyle *style; @@ -5295,6 +5298,7 @@ headline_style_set (GtkWidget *widget, gtkblist->changing_style = FALSE; g_object_unref (tooltips); +#endif } /******************************************/ diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 9d3fd9691d..4b3a16ae2f 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5195,7 +5195,9 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) gtkconv->send_history = g_list_append(NULL, NULL); /* Setup some initial variables. */ +#if !GTK_CHECK_VERSION(2,12,0) gtkconv->tooltips = gtk_tooltips_new(); +#endif gtkconv->unseen_state = PIDGIN_UNSEEN_NONE; gtkconv->unseen_count = 0; @@ -5388,7 +5390,9 @@ pidgin_conv_destroy(PurpleConversation *conv) g_free(gtkconv->u.chat); } +#if !GTK_CHECK_VERSION(2,12,0) gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); +#endif gtkconv->send_history = g_list_first(gtkconv->send_history); g_list_foreach(gtkconv->send_history, (GFunc)g_free, NULL); @@ -6603,8 +6607,13 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) topic = purple_conv_chat_get_topic(chat); gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : ""); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(gtkchat->topic_text, + topic ? topic : ""); +#else gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, topic ? topic : "", NULL); +#endif } } @@ -9372,8 +9381,12 @@ pidgin_conv_window_add_gtkconv(PidginWindow *win, PidginConversation *gtkconv) g_signal_connect(G_OBJECT(gtkconv->close), "leave-notify-event", G_CALLBACK(close_button_left_cb), close_image); gtk_widget_show(close_image); gtk_container_add(GTK_CONTAINER(gtkconv->close), close_image); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(gtkconv->close, _("Close conversation")); +#else gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, _("Close conversation"), NULL); +#endif g_signal_connect(G_OBJECT(gtkconv->close), "button-press-event", G_CALLBACK(close_conv_cb), gtkconv); diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index f94b6efc4a..21e1f6394d 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -121,7 +121,11 @@ struct _PidginConversation gboolean make_sound; +#if GTK_CHECK_VERSION(2,12,0) + gpointer depr2; +#else GtkTooltips *tooltips; +#endif GtkWidget *tab_cont; GtkWidget *tabby; diff --git a/pidgin/gtkdocklet-x11.c b/pidgin/gtkdocklet-x11.c index 8a07edf8ca..dfe4d32ddf 100644 --- a/pidgin/gtkdocklet-x11.c +++ b/pidgin/gtkdocklet-x11.c @@ -39,7 +39,9 @@ /* globals */ static EggTrayIcon *docklet = NULL; static GtkWidget *image = NULL; +#if !GTK_CHECK_VERSION(2,12,0) static GtkTooltips *tooltips = NULL; +#endif static GdkPixbuf *blank_icon = NULL; static int embed_timeout = 0; static int docklet_height = 0; @@ -164,6 +166,13 @@ docklet_x11_blank_icon(void) static void docklet_x11_set_tooltip(gchar *tooltip) { +#if GTK_CHECK_VERSION(2,12,0) + if (tooltip) { + gtk_widget_set_tooltip_text(image->parent, tooltip); + } else { + gtk_widget_set_tooltip_text(image->parent, ""); /* NULL? */ + } +#else if (!tooltips) tooltips = gtk_tooltips_new(); @@ -175,6 +184,7 @@ docklet_x11_set_tooltip(gchar *tooltip) gtk_tooltips_set_tip(tooltips, image->parent, "", NULL); gtk_tooltips_disable(tooltips); } +#endif } #if GTK_CHECK_VERSION(2,2,0) diff --git a/pidgin/gtkimhtmltoolbar.c b/pidgin/gtkimhtmltoolbar.c index 39e0ce475c..6e3088f4dc 100644 --- a/pidgin/gtkimhtmltoolbar.c +++ b/pidgin/gtkimhtmltoolbar.c @@ -669,7 +669,11 @@ sort_smileys(struct smiley_button_list *ls, GtkIMHtmlToolbar *toolbar, g_object_set_data(G_OBJECT(button), "smiley_text", face); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(button, face); +#else gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL); +#endif /* these look really weird with borders */ gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); @@ -683,7 +687,11 @@ sort_smileys(struct smiley_button_list *ls, GtkIMHtmlToolbar *toolbar, g_snprintf(tip, sizeof(tip), _("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"), face); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(button, tip); +#else gtk_tooltips_set_tip(toolbar->tooltips, button, tip, NULL); +#endif gtk_widget_set_sensitive(button, FALSE); } else if (psmiley) { /* Remove the button if the smiley is destroyed */ @@ -1147,7 +1155,9 @@ gtk_imhtmltoolbar_finalize (GObject *object) } g_free(toolbar->sml); +#if !GTK_CHECK_VERSION(2,12,0) gtk_object_sink(GTK_OBJECT(toolbar->tooltips)); +#endif menu = g_object_get_data(object, "font_menu"); if (menu) @@ -1244,7 +1254,11 @@ static void gtk_imhtmltoolbar_create_old_buttons(GtkIMHtmlToolbar *toolbar) g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(buttons[iter].callback), toolbar); *(buttons[iter].button) = button; +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(button, buttons[iter].tooltip); +#else gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL); +#endif } else button = gtk_vseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); @@ -1334,7 +1348,9 @@ static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar) toolbar->smiley_dialog = NULL; toolbar->image_dialog = NULL; +#if !GTK_CHECK_VERSION(2,12,0) toolbar->tooltips = gtk_tooltips_new(); +#endif gtk_box_set_spacing(GTK_BOX(toolbar), 3); diff --git a/pidgin/gtkimhtmltoolbar.h b/pidgin/gtkimhtmltoolbar.h index 5f67603496..33e1db007d 100644 --- a/pidgin/gtkimhtmltoolbar.h +++ b/pidgin/gtkimhtmltoolbar.h @@ -46,7 +46,11 @@ struct _GtkIMHtmlToolbar { GtkWidget *imhtml; +#if GTK_CHECK_VERSION(2,12,0) + gpointer depr1; +#else GtkTooltips *tooltips; +#endif GtkWidget *bold; GtkWidget *italic; diff --git a/pidgin/gtkmenutray.c b/pidgin/gtkmenutray.c index d74f9ced4f..881b8f4fe9 100644 --- a/pidgin/gtkmenutray.c +++ b/pidgin/gtkmenutray.c @@ -104,9 +104,11 @@ pidgin_menu_tray_finalize(GObject *obj) gtk_widget_destroy(GTK_WIDGET(tray->tray)); #endif +#if !GTK_CHECK_VERSION(2,12,0) if (tray->tooltips) { gtk_object_sink(GTK_OBJECT(tray->tooltips)); } +#endif G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -244,13 +246,15 @@ pidgin_menu_tray_prepend(PidginMenuTray *menu_tray, GtkWidget *widget, const cha void pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const char *tooltip) { +#if !GTK_CHECK_VERSION(2,12,0) if (!menu_tray->tooltips) menu_tray->tooltips = gtk_tooltips_new(); +#endif /* Should we check whether widget is a child of menu_tray? */ /* - * If the widget does not have it's own window, then it + * If the widget does not have its own window, then it * must have automatically been added to an event box * when it was added to the menu tray. If this is the * case, we want to set the tooltip on the widget's parent, @@ -259,6 +263,10 @@ pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const if (GTK_WIDGET_NO_WINDOW(widget)) widget = widget->parent; +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(widget, tooltip); +#else gtk_tooltips_set_tip(menu_tray->tooltips, widget, tooltip, NULL); +#endif } diff --git a/pidgin/gtkmenutray.h b/pidgin/gtkmenutray.h index 3604b7192b..7d0c683ce5 100644 --- a/pidgin/gtkmenutray.h +++ b/pidgin/gtkmenutray.h @@ -40,7 +40,11 @@ typedef struct _PidginMenuTrayClass PidginMenuTrayClass; struct _PidginMenuTray { GtkMenuItem gparent; /**< The parent instance */ GtkWidget *tray; /**< The tray */ +#if GTK_CHECK_VERSION(2,12,0) + gpointer depr1; +#else GtkTooltips *tooltips; /**< Tooltips */ +#endif }; /** A PidginMenuTrayClass */ -- cgit v1.2.1 From 04850f3a972313683067f33a4095f1b4bbae6668 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 9 Apr 2009 04:11:01 +0000 Subject: Use GtkComboBox instead of GtkOptionMenu in the choice request field for GTK+ 2.4 and up. --- pidgin/gtkrequest.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index 7fc4b97a04..802e14b76c 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -202,12 +202,21 @@ field_bool_cb(GtkToggleButton *button, PurpleRequestField *field) gtk_toggle_button_get_active(button)); } +#if GTK_CHECK_VERSION(2,4,0) +static void +field_choice_menu_cb(GtkComboBox *menu, PurpleRequestField *field) +{ + purple_request_field_choice_set_value(field, + gtk_combo_box_get_active(menu)); +} +#else static void field_choice_menu_cb(GtkOptionMenu *menu, PurpleRequestField *field) { purple_request_field_choice_set_value(field, gtk_option_menu_get_history(menu)); } +#endif static void field_choice_option_cb(GtkRadioButton *button, PurpleRequestField *field) @@ -870,6 +879,21 @@ create_choice_field(PurpleRequestField *field) if (num_labels > 5) { +#if GTK_CHECK_VERSION(2,4,0) + widget = gtk_combo_box_new_text(); + + for (l = labels; l != NULL; l = l->next) + { + const char *text = l->data; + gtk_combo_box_append_text(GTK_COMBO_BOX(widget), text); + } + + gtk_combo_box_set_active(GTK_COMBO_BOX(widget), + purple_request_field_choice_get_default_value(field)); + + g_signal_connect(G_OBJECT(widget), "changed", + G_CALLBACK(field_choice_menu_cb), field); +#else GtkWidget *menu; GtkWidget *item; @@ -894,6 +918,7 @@ create_choice_field(PurpleRequestField *field) g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(field_choice_menu_cb), field); +#endif } else { -- cgit v1.2.1 From 9e7164a610c0cb894bc860fc66a92fddda159365 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 9 Apr 2009 04:13:52 +0000 Subject: Replace the GtkOptionMenu with a GtkComboBox for the privacy options list on GTK+ 2.4 and up. --- pidgin/gtkprivacy.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/pidgin/gtkprivacy.c b/pidgin/gtkprivacy.c index 518b03d508..730225b15c 100644 --- a/pidgin/gtkprivacy.c +++ b/pidgin/gtkprivacy.c @@ -220,7 +220,11 @@ select_account_cb(GtkWidget *dropdown, PurpleAccount *account, for (i = 0; i < menu_entry_count; i++) { if (menu_entries[i].num == account->perm_deny) { +#if GTK_CHECK_VERSION(2,4,0) + gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), i); +#else gtk_option_menu_set_history(GTK_OPTION_MENU(dialog->type_menu), i); +#endif break; } } @@ -233,10 +237,17 @@ select_account_cb(GtkWidget *dropdown, PurpleAccount *account, * TODO: Setting the permit/deny setting needs to go through privacy.c * Even better: the privacy API needs to not suck. */ +#if GTK_CHECK_VERSION(2,4,0) +static void +type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog) +{ + int new_type = menu_entries[gtk_combo_box_get_active(combo)].num; +#else static void type_changed_cb(GtkOptionMenu *optmenu, PidginPrivacyDialog *dialog) { int new_type = menu_entries[gtk_option_menu_get_history(optmenu)].num; +#endif dialog->account->perm_deny = new_type; serv_set_permit_deny(purple_account_get_connection(dialog->account)); @@ -343,7 +354,9 @@ privacy_dialog_new(void) GtkWidget *button; GtkWidget *dropdown; GtkWidget *label; +#if !GTK_CHECK_VERSION(2,4,0) GtkWidget *menu; +#endif int selected = 0; int i; @@ -372,6 +385,24 @@ privacy_dialog_new(void) dialog->account = pidgin_account_option_menu_get_selected(dropdown); /* Add the drop-down list with the allow/block types. */ +#if GTK_CHECK_VERSION(2,4,0) + dialog->type_menu = gtk_combo_box_new_text(); + gtk_box_pack_start(GTK_BOX(vbox), dialog->type_menu, FALSE, FALSE, 0); + gtk_widget_show(dialog->type_menu); + + for (i = 0; i < menu_entry_count; i++) { + gtk_combo_box_append_text(GTK_COMBO_BOX(dialog->type_menu), + _(menu_entries[i].text)); + + if (menu_entries[i].num == dialog->account->perm_deny) + selected = i; + } + + gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), selected); + + g_signal_connect(G_OBJECT(dialog->type_menu), "changed", + G_CALLBACK(type_changed_cb), dialog); +#else dialog->type_menu = gtk_option_menu_new(); gtk_box_pack_start(GTK_BOX(vbox), dialog->type_menu, FALSE, FALSE, 0); gtk_widget_show(dialog->type_menu); @@ -391,6 +422,7 @@ privacy_dialog_new(void) g_signal_connect(G_OBJECT(dialog->type_menu), "changed", G_CALLBACK(type_changed_cb), dialog); +#endif /* Build the treeview for the allow list. */ dialog->allow_widget = build_allow_list(dialog); @@ -421,7 +453,11 @@ privacy_dialog_new(void) button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_CLOSE, G_CALLBACK(close_cb), dialog); dialog->close_button = button; +#if GTK_CHECK_VERSION(2,4,0) + type_changed_cb(GTK_COMBO_BOX(dialog->type_menu), dialog); +#else type_changed_cb(GTK_OPTION_MENU(dialog->type_menu), dialog); +#endif #if 0 if (dialog->account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) { gtk_widget_show(dialog->allow_widget); -- cgit v1.2.1 From 6e539391f7174dca0e46dca1cbe919a8fc5bfb3d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 9 Apr 2009 04:18:50 +0000 Subject: Replace GtkOptionMenu with GtkComboBox in the saved status editor for GTK+ 2.4 and up. --- pidgin/gtksavedstatuses.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/pidgin/gtksavedstatuses.c b/pidgin/gtksavedstatuses.c index 9df26bf30b..4780ee1743 100644 --- a/pidgin/gtksavedstatuses.c +++ b/pidgin/gtksavedstatuses.c @@ -119,7 +119,11 @@ typedef struct gchar *original_title; GtkEntry *title; +#if GTK_CHECK_VERSION(2,4,0) + GtkComboBox *type; +#else GtkOptionMenu *type; +#endif GtkIMHtml *message; } StatusEditor; @@ -795,7 +799,11 @@ status_editor_ok_cb(GtkButton *button, gpointer user_data) return; } +#if GTK_CHECK_VERSION(2,4,0) + type = gtk_combo_box_get_active(dialog->type) + (PURPLE_STATUS_UNSET + 1); +#else type = gtk_option_menu_get_history(dialog->type) + (PURPLE_STATUS_UNSET + 1); +#endif message = gtk_imhtml_get_markup(dialog->message); unformatted = purple_markup_strip_html(message); @@ -889,6 +897,58 @@ editor_title_changed_cb(GtkWidget *widget, gpointer user_data) gtk_widget_set_sensitive(GTK_WIDGET(dialog->save_button), (*text != '\0')); } +#if GTK_CHECK_VERSION(2,4,0) + +static GtkWidget * +create_status_type_menu(PurpleStatusPrimitive type) +{ + int i; + GtkWidget *dropdown; + GtkListStore *store; + GtkTreeIter iter; + GtkCellRenderer *renderer; + + store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); + + for (i = PURPLE_STATUS_UNSET + 1; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) + { + if (i == PURPLE_STATUS_MOBILE || i == PURPLE_STATUS_TUNE) + /* + * Special-case these. They're intended to be independent + * status types, so don't show them in the list. + */ + continue; + + gtk_list_store_append(store, &iter); + /* TODO: how's this get the right size (since it seems to work fine)? */ + gtk_list_store_set(store, &iter, + 0, get_stock_icon_from_primitive(i), + 1, purple_primitive_get_name_from_type(i), + -1); + } + + dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); + + renderer = gtk_cell_renderer_pixbuf_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, FALSE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer, + "stock-id", 0, + NULL); + + renderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer, + "text", 1, + NULL); + + gtk_combo_box_set_active(GTK_COMBO_BOX(dropdown), + type - (PURPLE_STATUS_UNSET + 1)); + + return dropdown; +} + +#else + static GtkWidget * create_stock_item(const gchar *str, const gchar *icon) { @@ -896,7 +956,7 @@ create_stock_item(const gchar *str, const gchar *icon) GtkWidget *label = gtk_label_new_with_mnemonic(str); GtkWidget *hbox = gtk_hbox_new(FALSE, 4); GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); - GtkWidget *image = gtk_image_new_from_stock(icon, icon_size);; + GtkWidget *image = gtk_image_new_from_stock(icon, icon_size); gtk_widget_show(label); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); @@ -941,6 +1001,8 @@ create_status_type_menu(PurpleStatusPrimitive type) return dropdown; } +#endif + static void edit_substatus(StatusEditor *status_editor, PurpleAccount *account); static void @@ -1206,7 +1268,11 @@ pidgin_status_editor_show(gboolean edit, PurpleSavedStatus *saved_status) dropdown = create_status_type_menu(purple_savedstatus_get_type(saved_status)); else dropdown = create_status_type_menu(PURPLE_STATUS_AWAY); +#if GTK_CHECK_VERSION(2,4,0) + dialog->type = GTK_COMBO_BOX(dropdown); +#else dialog->type = GTK_OPTION_MENU(dropdown); +#endif pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Status:"), sg, dropdown, TRUE, NULL); /* Status message */ -- cgit v1.2.1 From e12e713d9defe2a71a4181aa4dd7d66a763e90e6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 9 Apr 2009 04:21:12 +0000 Subject: Replace GtkOptionMenu with GtkComboBox in the gestures plugin for GTK+ 2.4 and up. But that code's commented out, so this is totally untested. --- pidgin/plugins/gestures/gestures.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pidgin/plugins/gestures/gestures.c b/pidgin/plugins/gestures/gestures.c index 20c4c3d39a..3dabbc02e3 100644 --- a/pidgin/plugins/gestures/gestures.c +++ b/pidgin/plugins/gestures/gestures.c @@ -149,6 +149,15 @@ new_conv_cb(PurpleConversation *conv) } #if 0 +#if GTK_CHECK_VERSION(2,4,0) +static void +mouse_button_menu_cb(GtkComboBox *opt, gpointer data) +{ + int button = gtk_combo_box_get_active(opt); + + gstroke_set_mouse_button(button + 2); +} +#else static void mouse_button_menu_cb(GtkMenuItem *item, gpointer data) { @@ -157,6 +166,7 @@ mouse_button_menu_cb(GtkMenuItem *item, gpointer data) gstroke_set_mouse_button(button + 2); } #endif +#endif static void toggle_draw_cb(GtkToggleButton *toggle, gpointer data) @@ -224,7 +234,9 @@ get_config_frame(PurplePlugin *plugin) GtkWidget *toggle; #if 0 GtkWidget *opt; +#if GTK_CHECK_VERSION(2,4,0) GtkWidget *menu, *item; +#endif #endif /* Outside container */ @@ -235,6 +247,19 @@ get_config_frame(PurplePlugin *plugin) vbox = pidgin_make_frame(ret, _("Mouse Gestures Configuration")); #if 0 +#if GTK_CHECK_VERSION(2,4,0) + /* Mouse button drop-down menu */ + opt = gtk_combo_box_new_text(); + + gtk_combo_box_append_text(_("Middle mouse button")); + gtk_combo_box_append_text(_("Right mouse button")); + g_signal_connect(G_OBJECT(opt), "changed", + G_CALLBACK(mouse_button_menu_cb), NULL); + + gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); + gtk_combo_box_set_active(GTK_COMBO_BOX(opt), + gstroke_get_mouse_button() - 2); +#else /* Mouse button drop-down menu */ menu = gtk_menu_new(); opt = gtk_option_menu_new(); @@ -253,6 +278,7 @@ get_config_frame(PurplePlugin *plugin) gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu); gtk_option_menu_set_history(GTK_OPTION_MENU(opt), gstroke_get_mouse_button() - 2); +#endif #endif /* "Visual gesture display" checkbox */ -- cgit v1.2.1 From 116b2fee700680a9bfaab90118782f9f9a9537f3 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 10 Apr 2009 04:55:52 +0000 Subject: Replace GtkOptionMenu with a GtkComboBox in the preferences dropdowns for GTK+ 2.4 and up. --- pidgin/gtkprefs.c | 155 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 130 insertions(+), 25 deletions(-) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index d07bd7f374..7fc461b0c0 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -164,14 +164,52 @@ pidgin_prefs_labeled_password(GtkWidget *page, const gchar *title, return pidgin_add_widget_to_vbox(GTK_BOX(page), title, sg, entry, TRUE, NULL); } +/* TODO: Maybe move this up somewheres... */ +enum { + PREF_DROPDOWN_TEXT, + PREF_DROPDOWN_VALUE, + PREF_DROPDOWN_COUNT +}; static void dropdown_set(GObject *w, const char *key) { const char *str_value; int int_value; + gboolean bool_value; PurplePrefType type; +#if GTK_CHECK_VERSION(2,4,0) + GtkTreeIter iter; + GtkTreeModel *tree_model; + + tree_model = gtk_combo_box_get_model(GTK_COMBO_BOX(w)); + gtk_combo_box_get_active_iter(GTK_COMBO_BOX(w), &iter); + + type = GPOINTER_TO_INT(g_object_get_data(w, "type")); + + if (type == PURPLE_PREF_INT) { + gtk_tree_model_get(tree_model, &iter, + PREF_DROPDOWN_VALUE, &int_value, + -1); + + purple_prefs_set_int(key, int_value); + } + else if (type == PURPLE_PREF_STRING) { + gtk_tree_model_get(tree_model, &iter, + PREF_DROPDOWN_VALUE, &str_value, + -1); + + purple_prefs_set_string(key, str_value); + } + else if (type == PURPLE_PREF_BOOLEAN) { + gtk_tree_model_get(tree_model, &iter, + PREF_DROPDOWN_VALUE, &bool_value, + -1); + + purple_prefs_set_bool(key, bool_value); + } +#else type = GPOINTER_TO_INT(g_object_get_data(w, "type")); if (type == PURPLE_PREF_INT) { @@ -185,64 +223,129 @@ dropdown_set(GObject *w, const char *key) purple_prefs_set_string(key, str_value); } else if (type == PURPLE_PREF_BOOLEAN) { - purple_prefs_set_bool(key, - GPOINTER_TO_INT(g_object_get_data(w, "value"))); + bool_value = (gboolean)GPOINTER_TO_INT(g_object_get_data(w, "value")); + purple_prefs_set_bool(key, bool_value); } +#endif } GtkWidget * pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, PurplePrefType type, const char *key, GList *menuitems) { - GtkWidget *dropdown, *opt, *menu; + GtkWidget *dropdown; GtkWidget *label = NULL; gchar *text; const char *stored_str = NULL; int stored_int = 0; + gboolean stored_bool = FALSE; int int_value = 0; const char *str_value = NULL; - int o = 0; + gboolean bool_value = FALSE; +#if GTK_CHECK_VERSION(2,4,0) + GtkListStore *store; + GtkTreeIter iter; + GtkTreeIter active; + GtkCellRenderer *renderer; g_return_val_if_fail(menuitems != NULL, NULL); -#if 0 /* GTK_CHECK_VERSION(2,4,0) */ - if(type == PURPLE_PREF_INT) - model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); - else if(type == PURPLE_PREF_STRING) - model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); - dropdown = gtk_combo_box_new_with_model(model); + if (type == PURPLE_PREF_INT) { + store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_INT); + stored_int = purple_prefs_get_int(key); + } else if (type == PURPLE_PREF_STRING) { + store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_STRING); + stored_str = purple_prefs_get_string(key); + } else if (type == PURPLE_PREF_BOOLEAN) { + store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_BOOLEAN); + stored_bool = purple_prefs_get_bool(key); + } + + dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); + g_object_set_data(G_OBJECT(dropdown), "type", GINT_TO_POINTER(type)); + + while (menuitems != NULL && (text = (char *)menuitems->data) != NULL) { + menuitems = g_list_next(menuitems); + g_return_val_if_fail(menuitems != NULL, NULL); + + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, + PREF_DROPDOWN_TEXT, text, + -1); + + if (type == PURPLE_PREF_INT) { + int_value = GPOINTER_TO_INT(menuitems->data); + gtk_list_store_set(store, &iter, + PREF_DROPDOWN_VALUE, int_value, + -1); + } + else if (type == PURPLE_PREF_STRING) { + str_value = (const char *)menuitems->data; + gtk_list_store_set(store, &iter, + PREF_DROPDOWN_VALUE, str_value, + -1); + } + else if (type == PURPLE_PREF_BOOLEAN) { + bool_value = (gboolean)GPOINTER_TO_INT(menuitems->data); + gtk_list_store_set(store, &iter, + PREF_DROPDOWN_VALUE, bool_value, + -1); + } + + if ((type == PURPLE_PREF_INT && stored_int == int_value) || + (type == PURPLE_PREF_STRING && stored_str != NULL && + !strcmp(stored_str, str_value)) || + (type == PURPLE_PREF_BOOLEAN && + (stored_bool == bool_value))) { + + active = iter; + } + + menuitems = g_list_next(menuitems); + } + + renderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer, + "text", 0, + NULL); + + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(dropdown), &active); + + g_signal_connect(G_OBJECT(dropdown), "changed", + G_CALLBACK(dropdown_set), (char *)key); + #else + GtkWidget *opt, *menu; + int o = 0; + + g_return_val_if_fail(menuitems != NULL, NULL); + dropdown = gtk_option_menu_new(); menu = gtk_menu_new(); -#endif if (type == PURPLE_PREF_INT) stored_int = purple_prefs_get_int(key); else if (type == PURPLE_PREF_STRING) stored_str = purple_prefs_get_string(key); + else if (type == PURPLE_PREF_BOOLEAN) + stored_bool = purple_prefs_get_bool(key); - while (menuitems != NULL && (text = (char *) menuitems->data) != NULL) { + while (menuitems != NULL && (text = (char *)menuitems->data) != NULL) { menuitems = g_list_next(menuitems); g_return_val_if_fail(menuitems != NULL, NULL); opt = gtk_menu_item_new_with_label(text); g_object_set_data(G_OBJECT(opt), "type", GINT_TO_POINTER(type)); + g_object_set_data(G_OBJECT(opt), "value", menuitems->data); - if (type == PURPLE_PREF_INT) { + if (type == PURPLE_PREF_INT) int_value = GPOINTER_TO_INT(menuitems->data); - g_object_set_data(G_OBJECT(opt), "value", - GINT_TO_POINTER(int_value)); - } - else if (type == PURPLE_PREF_STRING) { + else if (type == PURPLE_PREF_STRING) str_value = (const char *)menuitems->data; - - g_object_set_data(G_OBJECT(opt), "value", (char *)str_value); - } - else if (type == PURPLE_PREF_BOOLEAN) { - g_object_set_data(G_OBJECT(opt), "value", - menuitems->data); - } + else if (type == PURPLE_PREF_BOOLEAN) + bool_value = (gboolean)GPOINTER_TO_INT(menuitems->data); g_signal_connect(G_OBJECT(opt), "activate", G_CALLBACK(dropdown_set), (char *)key); @@ -254,7 +357,7 @@ pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, (type == PURPLE_PREF_STRING && stored_str != NULL && !strcmp(stored_str, str_value)) || (type == PURPLE_PREF_BOOLEAN && - (purple_prefs_get_bool(key) == GPOINTER_TO_INT(menuitems->data)))) { + (stored_bool == bool_value))) { gtk_menu_set_active(GTK_MENU(menu), o); } @@ -266,6 +369,8 @@ pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); +#endif + pidgin_add_widget_to_vbox(GTK_BOX(box), title, NULL, dropdown, FALSE, &label); return label; -- cgit v1.2.1 From fd6fca1a8a584cd53bfdd1f26bb98fff51e2b447 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 10 Apr 2009 05:00:13 +0000 Subject: Add an enumeration to replace a couple hardcoded numbers in the combo box code for saved statuses. --- pidgin/gtksavedstatuses.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pidgin/gtksavedstatuses.c b/pidgin/gtksavedstatuses.c index 4780ee1743..4613f9fffe 100644 --- a/pidgin/gtksavedstatuses.c +++ b/pidgin/gtksavedstatuses.c @@ -899,6 +899,12 @@ editor_title_changed_cb(GtkWidget *widget, gpointer user_data) #if GTK_CHECK_VERSION(2,4,0) +enum { + STATUS_MENU_STOCK_ICON, + STATUS_MENU_NAME, + STATUS_MENU_COUNT +}; + static GtkWidget * create_status_type_menu(PurpleStatusPrimitive type) { @@ -908,7 +914,7 @@ create_status_type_menu(PurpleStatusPrimitive type) GtkTreeIter iter; GtkCellRenderer *renderer; - store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); + store = gtk_list_store_new(STATUS_MENU_COUNT, G_TYPE_STRING, G_TYPE_STRING); for (i = PURPLE_STATUS_UNSET + 1; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) { @@ -922,8 +928,8 @@ create_status_type_menu(PurpleStatusPrimitive type) gtk_list_store_append(store, &iter); /* TODO: how's this get the right size (since it seems to work fine)? */ gtk_list_store_set(store, &iter, - 0, get_stock_icon_from_primitive(i), - 1, purple_primitive_get_name_from_type(i), + STATUS_MENU_STOCK_ICON, get_stock_icon_from_primitive(i), + STATUS_MENU_NAME, purple_primitive_get_name_from_type(i), -1); } @@ -932,13 +938,13 @@ create_status_type_menu(PurpleStatusPrimitive type) renderer = gtk_cell_renderer_pixbuf_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, FALSE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer, - "stock-id", 0, + "stock-id", STATUS_MENU_STOCK_ICON, NULL); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer, - "text", 1, + "text", STATUS_MENU_NAME, NULL); gtk_combo_box_set_active(GTK_COMBO_BOX(dropdown), -- cgit v1.2.1 From ca815a89293168ba3d04b5cec794c76031d314b1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 19 Apr 2009 03:21:27 +0000 Subject: Update the toolbar code in the Debug Window. There remains a bug when it's set to "Icons and Text", because all I see are the icons (and the one that has no icon is blank). If I set the toolbar to "Text Only" or "Icons Only" then it works correctly. --- pidgin/gtkdebug.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index 07e8872dcd..97d38fe48d 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -43,6 +43,19 @@ #include +/* TODO: I'm too lazy to change all these until we bump required GTK+ version */ +#if GTK_CHECK_VERSION(2,4,0) +#undef GTK_TOGGLE_BUTTON +#undef gtk_toggle_button_get_active +#undef gtk_toggle_button_set_active +#undef GtkToggleButton + +#define GTK_TOGGLE_BUTTON GTK_TOGGLE_TOOL_BUTTON +#define gtk_toggle_button_get_active gtk_toggle_tool_button_get_active +#define gtk_toggle_button_set_active gtk_toggle_tool_button_set_active +#define GtkToggleButton GtkToggleToolButton +#endif + typedef struct { GtkWidget *window; @@ -677,9 +690,16 @@ debug_window_new(void) GtkWidget *vbox; GtkWidget *toolbar; GtkWidget *frame; - GtkWidget *image; gint width, height; void *handle; +#if GTK_CHECK_VERSION(2,4,0) + GtkToolItem *item; +#if !GTK_CHECK_VERSION(2,12,0) + GtkTooltips *tooltips; +#endif +#else + GtkWidget *image; +#endif win = g_new0(DebugWindow, 1); @@ -719,7 +739,12 @@ debug_window_new(void) if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) { /* Setup our top button bar thingie. */ toolbar = gtk_toolbar_new(); +#if GTK_CHECK_VERSION(2,4,0) && !GTK_CHECK_VERSION(2,12,0) + tooltips = gtk_tooltips_new(); +#endif +#if !GTK_CHECK_VERSION(2,14,0) gtk_toolbar_set_tooltips(GTK_TOOLBAR(toolbar), TRUE); +#endif #if GTK_CHECK_VERSION(2,4,0) gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), TRUE); #endif @@ -736,36 +761,101 @@ debug_window_new(void) #ifndef HAVE_REGEX_H /* Find button */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_button_new_from_stock(GTK_STOCK_FIND); +#if GTK_CHECK_VERSION(2,12,0) + gtk_tool_item_set_tooltip_text(item, _("Find")); +#else + gtk_tool_item_set_tooltip(item, tooltips, _("Find"), NULL); +#endif + g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(find_cb), win); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND, _("Find"), NULL, G_CALLBACK(find_cb), win, -1); +#endif #endif /* HAVE_REGEX_H */ /* Save */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); +#if GTK_CHECK_VERSION(2,12,0) + gtk_tool_item_set_tooltip_text(item, _("Save")); +#else + gtk_tool_item_set_tooltip(item, tooltips, _("Save"), NULL); +#endif + g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(save_cb), win); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE, _("Save"), NULL, G_CALLBACK(save_cb), win, -1); +#endif /* Clear button */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR); +#if GTK_CHECK_VERSION(2,12,0) + gtk_tool_item_set_tooltip_text(item, _("Clear")); +#else + gtk_tool_item_set_tooltip(item, tooltips, _("Clear"), NULL); +#endif + g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(clear_cb), win); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR, _("Clear"), NULL, G_CALLBACK(clear_cb), win, -1); +#endif +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_separator_tool_item_new(); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); +#endif /* Pause */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE); +#if GTK_CHECK_VERSION(2,12,0) + gtk_tool_item_set_tooltip_text(item, _("Pause")); +#else + gtk_tool_item_set_tooltip(item, tooltips, _("Pause"), NULL); +#endif + g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(pause_cb), win); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else image = gtk_image_new_from_stock(PIDGIN_STOCK_PAUSE, GTK_ICON_SIZE_MENU); gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, _("Pause"), _("Pause"), NULL, image, G_CALLBACK(pause_cb), win); +#endif #ifdef HAVE_REGEX_H /* regex stuff */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_separator_tool_item_new(); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); +#endif /* regex toggle button */ +#if GTK_CHECK_VERSION(2,4,0) + win->filter = GTK_WIDGET(gtk_toggle_tool_button_new()); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(win->filter), _("Filter")); +#if GTK_CHECK_VERSION(2,12,0) + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(win->filter), _("Filter")); +#else + gtk_tooltips_set_tip(tooltips, win->filter, _("Filter"), NULL); +#endif + g_signal_connect(G_OBJECT(win->filter), "clicked", G_CALLBACK(regex_filter_toggled_cb), win); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(win->filter)); +#else win->filter = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, @@ -773,6 +863,8 @@ debug_window_new(void) NULL, NULL, G_CALLBACK(regex_filter_toggled_cb), win); +#endif + /* we purposely disable the toggle button here in case * /purple/gtk/debug/expression has an empty string. If it does not have * an empty string, the change signal will get called and make the @@ -786,10 +878,21 @@ debug_window_new(void) /* regex entry */ win->expression = gtk_entry_new(); +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_item_new(); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(win->expression, _("Right click for more options.")); +#else + gtk_tooltips_set_tip(tooltips, win->expression, _("Right click for more options."), NULL); +#endif + gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression)); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_WIDGET, win->expression, NULL, _("Right click for more options."), NULL, NULL, NULL, NULL); +#endif /* this needs to be before the text is set from the pref if we want it * to colorize a stored expression. */ @@ -815,18 +918,39 @@ debug_window_new(void) #endif /* HAVE_REGEX_H */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_separator_tool_item_new(); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); +#endif +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_item_new(); + gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level "))); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_WIDGET, gtk_label_new(_("Level ")), NULL, _("Select the debug filter level."), NULL, NULL, NULL, NULL); - +#endif win->filterlevel = gtk_combo_box_new_text(); +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_item_new(); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level.")); +#else + gtk_tooltips_set_tip(tooltips, win->filterlevel, _("Select the debug filter level."), NULL); +#endif + gtk_container_add(GTK_CONTAINER(item), win->filterlevel); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_WIDGET, win->filterlevel, NULL, _("Select the debug filter level."), NULL, NULL, NULL, NULL); +#endif gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All")); gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc")); gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info")); -- cgit v1.2.1 From 6ae3846d47778cc0450b883322d9cc2063cccb10 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 10 May 2009 06:24:26 +0000 Subject: If gedit can do it, then so can we! References #4351. --- pidgin/gtkblist.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 2107d2e4a3..09ca3ce858 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -5276,11 +5276,28 @@ static void headline_style_set (GtkWidget *widget, GtkStyle *prev_style) { + GtkStyle *style; #if GTK_CHECK_VERSION(2,12,0) - /* TODO: Need to figure out how to do this in 2.12+ */ + GtkWidget *window; + + if (gtkblist->changing_style) + return; + + /* This is a hack needed to use the tooltip background colour */ + window = gtk_window_new(GTK_WINDOW_POPUP); + gtk_widget_set_name(window, "gtk-tooltip"); + gtk_widget_ensure_style(window); + style = gtk_widget_get_style(window); + + gtkblist->changing_style = TRUE; + gtk_widget_set_style(gtkblist->headline_hbox, style); + gtkblist->changing_style = FALSE; + + gtk_widget_destroy(window); + + gtk_widget_queue_draw(gtkblist->headline_hbox); #else GtkTooltips *tooltips; - GtkStyle *style; if (gtkblist->changing_style) return; -- cgit v1.2.1 From 869749577f14b25da2189dcecd6db0df6f0fe6c2 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Fri, 24 Jul 2009 01:18:07 +0000 Subject: Webkit Message views. This commit is a squashed commit of the series of commits from my git repository which I was using for development. (git://github.com/tdrhq/pidgin-clone.git, branch webkit) --- configure.ac | 3 + pidgin/Makefile.am | 10 +- pidgin/gtkconv.c | 543 ++++++++------------------------------------- pidgin/gtkconv.h | 2 +- pidgin/gtkdialogs.c | 26 ++- pidgin/gtklog.c | 37 +-- pidgin/gtklog.h | 2 +- pidgin/gtknotify.c | 52 ++--- pidgin/gtkthemes.c | 4 +- pidgin/gtkthemes.h | 1 + pidgin/plugins/Makefile.am | 41 +--- 11 files changed, 164 insertions(+), 557 deletions(-) diff --git a/configure.ac b/configure.ac index b69cecebd8..9b54f7bee3 100644 --- a/configure.ac +++ b/configure.ac @@ -700,6 +700,8 @@ AM_CONDITIONAL(ENABLE_GNT, test "x$enable_consoleui" = "xyes") #AC_CHECK_FUNC(wcwidth, [AC_DEFINE([HAVE_WCWIDTH], [1], [Define to 1 if you have wcwidth function.])]) +PKG_CHECK_MODULES(WEBKIT, [webkit-1.0 >= 1.1.1]); + dnl ####################################################################### dnl # Check for LibXML2 (required) dnl ####################################################################### @@ -2476,6 +2478,7 @@ AC_OUTPUT([Makefile pidgin/pixmaps/emotes/none/Makefile pidgin/pixmaps/emotes/small/16/Makefile pidgin/plugins/Makefile + pidgin/plugins/adiumthemes/Makefile pidgin/plugins/cap/Makefile pidgin/plugins/disco/Makefile pidgin/plugins/gestures/Makefile diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index 058be59c2a..eec1d627a6 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -125,9 +125,11 @@ pidgin_SOURCES = \ gtkstatusbox.c \ gtkthemes.c \ gtkutils.c \ + gtkwebview.c \ gtkwhiteboard.c \ minidialog.c \ - pidgintooltip.c + pidgintooltip.c \ + smileyparser.c pidgin_headers = \ eggtrayicon.h \ @@ -183,10 +185,12 @@ pidgin_headers = \ pidginstock.h \ gtkthemes.h \ gtkutils.h \ + gtkwebview.h \ gtkwhiteboard.h \ minidialog.h \ pidgintooltip.h \ - pidgin.h + pidgin.h \ + smileyparser.h pidginincludedir=$(includedir)/pidgin pidgininclude_HEADERS = \ @@ -206,6 +210,7 @@ pidgin_LDADD = \ $(GTKSPELL_LIBS) \ $(STARTUP_NOTIFICATION_LIBS) \ $(LIBXML_LIBS) \ + $(WEBKIT_LIBS) \ $(GTK_LIBS) \ $(top_builddir)/libpurple/libpurple.la @@ -231,5 +236,6 @@ AM_CPPFLAGS = \ $(GTKSPELL_CFLAGS) \ $(STARTUP_NOTIFICATION_CFLAGS) \ $(LIBXML_CFLAGS) \ + $(WEBKIT_CFLAGS) \ $(INTGG_CFLAGS) endif # ENABLE_GTK diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index d235759bc7..872b6e6526 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -69,6 +69,7 @@ #include "gtkprivacy.h" #include "gtkthemes.h" #include "gtkutils.h" +#include "gtkwebview.h" #include "pidginstock.h" #include "pidgintooltip.h" @@ -164,7 +165,6 @@ static const char *item_factory_translate_func (const char *path, gpointer func_ gboolean pidgin_conv_has_focus(PurpleConversation *conv); static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background); static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast); -static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, PurpleMessageFlags flag, gboolean create); static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields); static void focus_out_from_menubar(GtkWidget *wid, PidginWindow *win); static void pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv); @@ -178,7 +178,7 @@ static gboolean pidgin_conv_xy_to_right_infopane(PidginWindow *win, int x, int y static const GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) { static GdkColor col; - GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml); + GtkStyle *style = gtk_widget_get_style(gtkconv->webview); float scale; col = nick_colors[g_str_hash(name) % nbr_nick_colors]; @@ -353,7 +353,7 @@ static void clear_conversation_scrollback(PurpleConversation *conv) gtkconv = PIDGIN_CONVERSATION(conv); - gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); + webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (gtkconv->webview), "", ""); for (iter = gtkconv->convs; iter; iter = iter->next) purple_conversation_clear_message_history(iter->data); } @@ -961,32 +961,7 @@ menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) static void savelog_writefile_cb(void *user_data, const char *filename) { - PurpleConversation *conv = (PurpleConversation *)user_data; - FILE *fp; - const char *name; - char **lines; - gchar *text; - - if ((fp = g_fopen(filename, "w+")) == NULL) { - purple_notify_error(PIDGIN_CONVERSATION(conv), NULL, _("Unable to open file."), NULL); - return; - } - - name = purple_conversation_get_name(conv); - fprintf(fp, "\n\n"); - fprintf(fp, "\n"); - fprintf(fp, "%s\n\n\n", name); - fprintf(fp, _("

Conversation with %s

\n"), name); - - lines = gtk_imhtml_get_markup_lines( - GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml)); - text = g_strjoinv("
\n", lines); - fprintf(fp, "%s", text); - g_free(text); - g_strfreev(lines); - - fprintf(fp, "\n\n\n"); - fclose(fp); + /* TODO: I don't know how to support this using webkit yet. */ } /* @@ -1116,12 +1091,16 @@ static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) if (gtkconv != gtk_active_conv) { - gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml)); + webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW (gtkconv->webview)); } else { - gtk_imhtml_search_find(GTK_IMHTML(gtk_active_conv->imhtml), - gtk_entry_get_text(GTK_ENTRY(s->entry))); + webkit_web_view_mark_text_matches (WEBKIT_WEB_VIEW (gtkconv->webview), + gtk_entry_get_text (GTK_ENTRY(s->entry)), TRUE, 0); + webkit_web_view_set_highlight_text_matches (WEBKIT_WEB_VIEW (gtkconv->webview), + true); + webkit_web_view_search_text (WEBKIT_WEB_VIEW (gtkconv->webview), + gtk_entry_get_text (GTK_ENTRY(s->entry)), FALSE, TRUE, FALSE); } } break; @@ -1132,7 +1111,7 @@ static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) for (iter = pidgin_conv_window_get_gtkconvs(s->gtkwin); iter; iter=iter->next) { PidginConversation *gconv = iter->data; - gtk_imhtml_search_clear(GTK_IMHTML(gconv->imhtml)); + webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW(gconv->webview)); } gtk_widget_destroy(s->gtkwin->dialogs.search); @@ -1635,30 +1614,11 @@ menu_chat_add_remove_cb(GtkWidget *w, PidginConversation *gtkconv) gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); } -static GtkTextMark * -get_mark_for_user(PidginConversation *gtkconv, const char *who) -{ - GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); - char *tmp = g_strconcat("user:", who, NULL); - GtkTextMark *mark = gtk_text_buffer_get_mark(buf, tmp); - - g_free(tmp); - return mark; -} - static void menu_last_said_cb(GtkWidget *w, PidginConversation *gtkconv) { - GtkTextMark *mark; - const char *who; - - who = g_object_get_data(G_OBJECT(w), "user_data"); - mark = get_mark_for_user(gtkconv, who); - - if (mark != NULL) - gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); - else - g_return_if_reached(); + /* I don't know what this is! */ + return; } static GtkWidget * @@ -1773,8 +1733,6 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc button = pidgin_new_item_from_stock(menu, _("Last Said"), GTK_STOCK_INDEX, G_CALLBACK(menu_last_said_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); - if (!get_mark_for_user(PIDGIN_CONVERSATION(conv), who)) - gtk_widget_set_sensitive(button, FALSE); if (buddy != NULL) { @@ -1864,10 +1822,10 @@ right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, chat_do_im(gtkconv, who); } else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) { /* Move to user's anchor */ - GtkTextMark *mark = get_mark_for_user(gtkconv, who); + //GtkTextMark *mark = get_mark_for_user(gtkconv, who); - if(mark != NULL) - gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); + //if(mark != NULL) + // gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { GtkWidget *menu = create_chat_menu (conv, who, gc); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, @@ -1943,8 +1901,8 @@ gtkconv_cycle_focus(PidginConversation *gtkconv, GtkDirectionType dir) GtkWidget *from; GtkWidget *to; } transitions[] = { - {gtkconv->entry, gtkconv->imhtml}, - {gtkconv->imhtml, chat ? gtkconv->u.chat->list : gtkconv->entry}, + {gtkconv->entry, gtkconv->webview}, + {gtkconv->webview, chat ? gtkconv->u.chat->list : gtkconv->entry}, {chat ? gtkconv->u.chat->list : NULL, gtkconv->entry}, {NULL, NULL} }, *ptr; @@ -2200,12 +2158,12 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) break; case GDK_Page_Up: - gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); + //gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); return TRUE; break; case GDK_Page_Down: - gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); + //gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); return TRUE; break; @@ -2308,7 +2266,7 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) entry = GTK_IMHTML(gtkconv->entry); protocol_name = purple_account_get_protocol_name(conv->account); gtk_imhtml_set_protocol_name(entry, protocol_name); - gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); + //gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); if (!(conv->features & PURPLE_CONNECTION_HTML)) gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry)); @@ -3250,11 +3208,11 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { chat = purple_blist_find_chat(conv->account, conv->name); - if ((chat == NULL) && (gtkconv->imhtml != NULL)) { - chat = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_chat"); + if ((chat == NULL) && (gtkconv->webview != NULL)) { + chat = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat"); } - if ((chat == NULL) && (gtkconv->imhtml != NULL)) { + if ((chat == NULL) && (gtkconv->webview != NULL)) { GHashTable *components; PurpleAccount *account = purple_conversation_get_account(conv); PurplePlugin *prpl = purple_find_prpl(purple_account_get_protocol_id(account)); @@ -3272,7 +3230,7 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea chat = purple_chat_new(conv->account, NULL, components); purple_blist_node_set_flags((PurpleBlistNode *)chat, PURPLE_BLIST_NODE_FLAG_NO_SAVE); - g_object_set_data_full(G_OBJECT(gtkconv->imhtml), "transient_chat", + g_object_set_data_full(G_OBJECT(gtkconv->webview), "transient_chat", chat, (GDestroyNotify)purple_blist_remove_chat); } } else { @@ -3284,15 +3242,15 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea /* gotta remain bug-compatible :( libpurple < 2.0.2 didn't handle * removing "isolated" buddy nodes well */ if (purple_version_check(2, 0, 2) == NULL) { - if ((buddy == NULL) && (gtkconv->imhtml != NULL)) { - buddy = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_buddy"); + if ((buddy == NULL) && (gtkconv->webview != NULL)) { + buddy = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_buddy"); } - if ((buddy == NULL) && (gtkconv->imhtml != NULL)) { + if ((buddy == NULL) && (gtkconv->webview != NULL)) { buddy = purple_buddy_new(conv->account, conv->name, NULL); purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE); - g_object_set_data_full(G_OBJECT(gtkconv->imhtml), "transient_buddy", + g_object_set_data_full(G_OBJECT(gtkconv->webview), "transient_buddy", buddy, (GDestroyNotify)purple_buddy_destroy); } } @@ -3643,38 +3601,7 @@ typing_animation(gpointer data) { static void update_typing_message(PidginConversation *gtkconv, const char *message) { - GtkTextBuffer *buffer; - GtkTextMark *stmark, *enmark; - - if (g_object_get_data(G_OBJECT(gtkconv->imhtml), "disable-typing-notification")) - return; - - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); - stmark = gtk_text_buffer_get_mark(buffer, "typing-notification-start"); - enmark = gtk_text_buffer_get_mark(buffer, "typing-notification-end"); - if (stmark && enmark) { - GtkTextIter start, end; - gtk_text_buffer_get_iter_at_mark(buffer, &start, stmark); - gtk_text_buffer_get_iter_at_mark(buffer, &end, enmark); - gtk_text_buffer_delete_mark(buffer, stmark); - gtk_text_buffer_delete_mark(buffer, enmark); - gtk_text_buffer_delete(buffer, &start, &end); - } else if (message && *message == '\n' && message[1] == ' ' && message[2] == '\0') - message = NULL; - -#ifdef RESERVE_LINE - if (!message) - message = "\n "; /* The blank space is required to avoid a GTK+/Pango bug */ -#endif - - if (message) { - GtkTextIter iter; - gtk_text_buffer_get_end_iter(buffer, &iter); - gtk_text_buffer_create_mark(buffer, "typing-notification-start", &iter, TRUE); - gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, message, -1, "TYPING-NOTIFICATION", NULL); - gtk_text_buffer_get_end_iter(buffer, &iter); - gtk_text_buffer_create_mark(buffer, "typing-notification-end", &iter, TRUE); - } + /* this is not handled at all */ } static void @@ -3991,7 +3918,6 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c gboolean is_buddy; gchar *tmp, *alias_key, *name, *alias; int flags; - GdkColor *color = NULL; alias = cb->alias; name = cb->name; @@ -4018,20 +3944,6 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c alias_key = g_utf8_collate_key(tmp, -1); g_free(tmp); - if (is_me) { - GtkTextTag *tag = gtk_text_tag_table_lookup( - gtk_text_buffer_get_tag_table(GTK_IMHTML(gtkconv->imhtml)->text_buffer), - "send-name"); - g_object_get(tag, "foreground-gdk", &color, NULL); - } else { - GtkTextTag *tag; - if ((tag = get_buddy_tag(conv, name, 0, FALSE))) - g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_NORMAL, NULL); - if ((tag = get_buddy_tag(conv, name, PURPLE_MESSAGE_NICK, FALSE))) - g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_NORMAL, NULL); - color = (GdkColor*)get_nick_color(gtkconv, name); - } - #if GTK_CHECK_VERSION(2,6,0) gtk_list_store_insert_with_values(ls, &iter, /* @@ -4047,7 +3959,6 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c CHAT_USERS_ALIAS_KEY_COLUMN, alias_key, CHAT_USERS_NAME_COLUMN, name, CHAT_USERS_FLAGS_COLUMN, flags, - CHAT_USERS_COLOR_COLUMN, color, CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1); #else @@ -4058,13 +3969,10 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c CHAT_USERS_ALIAS_KEY_COLUMN, alias_key, CHAT_USERS_NAME_COLUMN, name, CHAT_USERS_FLAGS_COLUMN, flags, - CHAT_USERS_COLOR_COLUMN, color, CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1); #endif - if (is_me && color) - gdk_color_free(color); g_free(alias_key); } @@ -4458,7 +4366,6 @@ buddy_cb_common(PurpleBuddy *buddy, PurpleConversation *conv, gboolean is_buddy) GtkTreeModel *model; char *normalized_name; GtkTreeIter iter; - GtkTextTag *texttag; int f; g_return_if_fail(buddy != NULL); @@ -4497,10 +4404,6 @@ buddy_cb_common(PurpleBuddy *buddy, PurpleConversation *conv, gboolean is_buddy) blist_node_aliased_cb((PurpleBlistNode *)buddy, NULL, conv); - texttag = get_buddy_tag(conv, purple_buddy_get_name(buddy), 0, FALSE); /* XXX: do we want the normalized name? */ - if (texttag) { - g_object_set(texttag, "weight", is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, NULL); - } } static void @@ -4532,7 +4435,7 @@ static void send_menu_cb(GtkWidget *widget, PidginConversation *gtkconv) } static void -entry_popup_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data) +entry_popup_menu_cb(GtkIMHtml *imhtml /* this is for ->entry, fine! */, GtkMenu *menu, gpointer data) { GtkWidget *menuitem; PidginConversation *gtkconv = data; @@ -4560,7 +4463,7 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv) GdkRectangle oneline; int height, diff; int pad_top, pad_inside, pad_bottom; - int total_height = (gtkconv->imhtml->allocation.height + gtkconv->entry->allocation.height); + int total_height = (gtkconv->webview->allocation.height + gtkconv->entry->allocation.height); int max_height = total_height / 2; int min_lines = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines"); int min_height; @@ -4796,13 +4699,13 @@ pidgin_conv_create_tooltip(GtkWidget *tipwindow, gpointer userdata, int *w, int if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { node = (PurpleBlistNode*)(purple_blist_find_chat(conv->account, conv->name)); if (!node) - node = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_chat"); + node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat"); } else { node = (PurpleBlistNode*)(purple_find_buddy(conv->account, conv->name)); #if 0 /* Using the transient blist nodes to show the tooltip doesn't quite work yet. */ if (!node) - node = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_buddy"); + node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_buddy"); #endif } @@ -4814,13 +4717,13 @@ pidgin_conv_create_tooltip(GtkWidget *tipwindow, gpointer userdata, int *w, int static GtkWidget * setup_common_pane(PidginConversation *gtkconv) { - GtkWidget *vbox, *frame, *imhtml_sw, *event_box; + GtkWidget *vbox, *frame, *webview_sw, *event_box; GtkCellRenderer *rend; GtkTreePath *path; PurpleConversation *conv = gtkconv->active_conv; PurpleBuddy *buddy; gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); - GtkPolicyType imhtml_sw_hscroll; + GtkPolicyType webview_sw_hscroll; int buddyicon_size = 0; /* Setup the top part of the pane */ @@ -4916,8 +4819,15 @@ setup_common_pane(PidginConversation *gtkconv) g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL); /* Setup the gtkimhtml widget */ - frame = pidgin_create_imhtml(FALSE, >kconv->imhtml, NULL, &imhtml_sw); - gtk_widget_set_size_request(gtkconv->imhtml, -1, 0); + webview_sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(webview_sw), GTK_SHADOW_IN); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (webview_sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + gtkconv->webview = gtk_webview_new (); + gtk_container_add (GTK_CONTAINER (webview_sw), gtkconv->webview); + + gtk_widget_set_size_request(gtkconv->webview, -1, 0); + if (chat) { GtkWidget *hpaned; @@ -4928,29 +4838,28 @@ setup_common_pane(PidginConversation *gtkconv) hpaned = gtk_hpaned_new(); gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); gtk_widget_show(hpaned); - gtk_paned_pack1(GTK_PANED(hpaned), frame, TRUE, TRUE); + gtk_paned_pack1(GTK_PANED(hpaned), webview_sw, TRUE, TRUE); /* Now add the userlist */ setup_chat_userlist(gtkconv, hpaned); } else { - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), webview_sw, TRUE, TRUE, 0); } - gtk_widget_show(frame); + gtk_widget_show_all(webview_sw); - gtk_widget_set_name(gtkconv->imhtml, "pidgin_conv_imhtml"); - gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE); - g_object_set_data(G_OBJECT(gtkconv->imhtml), "gtkconv", gtkconv); + gtk_widget_set_name(gtkconv->webview, "pidgin_conv_webview"); + g_object_set_data(G_OBJECT(gtkconv->webview), "gtkconv", gtkconv); - gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(imhtml_sw), - &imhtml_sw_hscroll, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(imhtml_sw), - imhtml_sw_hscroll, GTK_POLICY_ALWAYS); + gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(webview_sw), + &webview_sw_hscroll, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(webview_sw), + webview_sw_hscroll, GTK_POLICY_ALWAYS); - g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", + g_signal_connect_after(G_OBJECT(gtkconv->webview), "button_press_event", G_CALLBACK(entry_stop_rclick_cb), NULL); - g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", + g_signal_connect(G_OBJECT(gtkconv->webview), "key_press_event", G_CALLBACK(refocus_entry_cb), gtkconv); - g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", + g_signal_connect(G_OBJECT(gtkconv->webview), "key_release_event", G_CALLBACK(refocus_entry_cb), gtkconv); gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -5189,36 +5098,6 @@ ignore_middle_click(GtkWidget *widget, GdkEventButton *e, gpointer null) static void set_typing_font(GtkWidget *widget, GtkStyle *style, PidginConversation *gtkconv) { - static PangoFontDescription *font_desc = NULL; - static GdkColor *color = NULL; - static gboolean enable = TRUE; - - if (font_desc == NULL) { - char *string = NULL; - gtk_widget_style_get(widget, - "typing-notification-font", &string, - "typing-notification-color", &color, - "typing-notification-enable", &enable, - NULL); - font_desc = pango_font_description_from_string(string); - g_free(string); - if (color == NULL) { - GdkColor def = {0, 0x8888, 0x8888, 0x8888}; - color = gdk_color_copy(&def); - } - } - - gtk_text_buffer_create_tag(GTK_IMHTML(widget)->text_buffer, "TYPING-NOTIFICATION", - "foreground-gdk", color, - "font-desc", font_desc, - NULL); - - if (!enable) { - g_object_set_data(G_OBJECT(widget), "disable-typing-notification", GINT_TO_POINTER(TRUE)); - /* or may be 'gtkconv->disable_typing = TRUE;' instead? */ - } - - g_signal_handlers_disconnect_by_func(G_OBJECT(widget), set_typing_font, gtkconv); } /************************************************************************** @@ -5260,9 +5139,6 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) } pane = setup_common_pane(gtkconv); - gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->imhtml), - gtk_imhtml_get_format_functions(GTK_IMHTML(gtkconv->imhtml)) | GTK_IMHTML_IMAGE); - if (pane == NULL) { if (conv_type == PURPLE_CONV_TYPE_CHAT) g_free(gtkconv->u.chat); @@ -5285,7 +5161,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) GTK_DEST_DEFAULT_DROP, te, sizeof(te) / sizeof(GtkTargetEntry), GDK_ACTION_COPY); - gtk_drag_dest_set(gtkconv->imhtml, 0, + gtk_drag_dest_set(gtkconv->webview, 0, te, sizeof(te) / sizeof(GtkTargetEntry), GDK_ACTION_COPY); @@ -5297,12 +5173,12 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) G_CALLBACK(ignore_middle_click), NULL); g_signal_connect(G_OBJECT(pane), "drag_data_received", G_CALLBACK(conv_dnd_recv), gtkconv); - g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", + g_signal_connect(G_OBJECT(gtkconv->webview), "drag_data_received", G_CALLBACK(conv_dnd_recv), gtkconv); g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", G_CALLBACK(conv_dnd_recv), gtkconv); - g_signal_connect(gtkconv->imhtml, "style-set", G_CALLBACK(set_typing_font), gtkconv); + g_signal_connect(gtkconv->webview, "style-set", G_CALLBACK(set_typing_font), gtkconv); /* Setup the container for the tab. */ gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -5332,10 +5208,6 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) else gtk_widget_hide(gtkconv->infopane_hbox); - gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); - gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), - purple_account_get_protocol_name(conv->account)); g_signal_connect_swapped(G_OBJECT(pane), "focus", G_CALLBACK(gtk_widget_grab_focus), @@ -5348,7 +5220,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) if (nick_colors == NULL) { nbr_nick_colors = NUM_NICK_COLORS; - nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->imhtml)->base[GTK_STATE_NORMAL]); + nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->webview)->base[GTK_STATE_NORMAL]); } if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) @@ -5547,43 +5419,6 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, return FALSE; } -static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, PurpleMessageFlags flag, - gboolean create) -{ - PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - GtkTextTag *buddytag; - gchar *str; - gboolean highlight = (flag & PURPLE_MESSAGE_NICK); - GtkTextBuffer *buffer = GTK_IMHTML(gtkconv->imhtml)->text_buffer; - - str = g_strdup_printf(highlight ? "HILIT %s" : "BUDDY %s", who); - - buddytag = gtk_text_tag_table_lookup( - gtk_text_buffer_get_tag_table(buffer), str); - - if (buddytag == NULL && create) { - if (highlight) - buddytag = gtk_text_buffer_create_tag(buffer, str, - "foreground", get_text_tag_color(gtk_text_tag_table_lookup( - gtk_text_buffer_get_tag_table(buffer), "highlight-name")), - "weight", PANGO_WEIGHT_BOLD, - NULL); - else - buddytag = gtk_text_buffer_create_tag( - buffer, str, - "foreground-gdk", get_nick_color(gtkconv, who), - "weight", purple_find_buddy(purple_conversation_get_account(conv), who) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, - NULL); - - g_signal_connect(G_OBJECT(buddytag), "event", - G_CALLBACK(buddytag_event), conv); - } - - g_free(str); - - return buddytag; -} - static void pidgin_conv_calculate_newday(PidginConversation *gtkconv, time_t mtime) { struct tm *tm = localtime(&mtime); @@ -5640,10 +5475,6 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a PurpleConnection *gc; PurpleAccount *account; PurplePluginProtocolInfo *prpl_info; - int gtk_font_options = 0; - int gtk_font_options_all = 0; - int max_scrollback_lines; - int line_count; char buf2[BUF_LONG]; gboolean show_date; char *mdate; @@ -5654,8 +5485,6 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a PurpleConversationType type; char *displaying; gboolean plugin_return; - char *bracket; - int tag_count = 0; gboolean is_rtl_message = FALSE; g_return_if_fail(conv != NULL); @@ -5713,59 +5542,13 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a } length = strlen(displaying) + 1; - /* Awful hack to work around GtkIMHtml's inefficient rendering of messages with lots of formatting changes. - * If a message has over 100 '<' characters, strip formatting before appending it. Hopefully nobody actually - * needs that much formatting, anyway. - */ - for (bracket = strchr(displaying, '<'); bracket && *(bracket + 1); bracket = strchr(bracket + 1, '<')) - tag_count++; - - if (tag_count > 100) { - char *tmp = displaying; - displaying = purple_markup_strip_html(tmp); - g_free(tmp); - } win = gtkconv->win; prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; - line_count = gtk_text_buffer_get_line_count( - gtk_text_view_get_buffer(GTK_TEXT_VIEW( - gtkconv->imhtml))); - - max_scrollback_lines = purple_prefs_get_int( - PIDGIN_PREFS_ROOT "/conversations/scrollback_lines"); - /* If we're sitting at more than 100 lines more than the - max scrollback, trim down to max scrollback */ - if (max_scrollback_lines > 0 - && line_count > (max_scrollback_lines + 100)) { - GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( - GTK_TEXT_VIEW(gtkconv->imhtml)); - GtkTextIter start, end; - - gtk_text_buffer_get_start_iter(text_buffer, &start); - gtk_text_buffer_get_iter_at_line(text_buffer, &end, - (line_count - max_scrollback_lines)); - gtk_imhtml_delete(GTK_IMHTML(gtkconv->imhtml), &start, &end); - } - - if (type == PURPLE_CONV_TYPE_CHAT) - { - /* Create anchor for user */ - GtkTextIter iter; - char *tmp = g_strconcat("user:", name, NULL); - - gtk_text_buffer_get_end_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)), &iter); - gtk_text_buffer_create_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)), - tmp, &iter, TRUE); - g_free(tmp); - } - - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling")) - gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING; - - if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "
", gtk_font_options_all | GTK_IMHTML_NO_SCROLL); + /* if the buffer is not empty add a
*/ + if (!gtk_webview_is_empty (GTK_WEBVIEW(gtkconv->webview))) + gtk_webview_append_html (GTK_WEBVIEW(gtkconv->webview), "
"); /* First message in a conversation. */ if (gtkconv->newday == 0) @@ -5801,47 +5584,29 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a sml_attrib = g_strdup_printf("sml=\"%s\"", purple_account_get_protocol_name(account)); - gtk_font_options |= GTK_IMHTML_NO_COMMENTS; - - if ((flags & PURPLE_MESSAGE_RECV) && - !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting")) - gtk_font_options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES | GTK_IMHTML_NO_FORMATTING; - - /* this is gonna crash one day, I can feel it. */ - if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(conv->account)))->options & - OPT_PROTO_USE_POINTSIZE) { - gtk_font_options |= GTK_IMHTML_USE_POINTSIZE; - } - - if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) - { - /* We want to see our own smileys. Need to revert it after send*/ - pidgin_themes_smiley_themeize_custom(gtkconv->imhtml); - } - /* TODO: These colors should not be hardcoded so log.c can use them */ if (flags & PURPLE_MESSAGE_RAW) { - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, gtk_font_options_all); + gtk_webview_append_html (GTK_WEBVIEW(gtkconv->webview), message); } else if (flags & PURPLE_MESSAGE_SYSTEM) { g_snprintf(buf2, sizeof(buf2), - "%s", + "%s%s", sml_attrib ? sml_attrib : "", mdate, displaying); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), buf2); } else if (flags & PURPLE_MESSAGE_ERROR) { g_snprintf(buf2, sizeof(buf2), - "%s", + "%s %s", sml_attrib ? sml_attrib : "", mdate, displaying); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), buf2); } else if (flags & PURPLE_MESSAGE_NO_LOG) { g_snprintf(buf2, BUF_LONG, - "%s", + "%s", sml_attrib ? sml_attrib : "", displaying); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), buf2); } else { char *new_message = g_memdup(displaying, length); char *alias_escaped = (alias ? g_markup_escape_text(alias, strlen(alias)) : g_strdup("")); @@ -5851,11 +5616,6 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a int tag_end_offset = 0; const char *tagname = NULL; - GtkTextIter start, end; - GtkTextMark *mark; - GtkTextTag *tag; - GtkTextBuffer *buffer = GTK_IMHTML(gtkconv->imhtml)->text_buffer; - /* Enforce direction on alias */ if (is_rtl_message) str_embed_direction_chars(&alias_escaped); @@ -5916,55 +5676,27 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a g_free(alias_escaped); - if (tagname) - tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), tagname); - else - tag = get_buddy_tag(conv, name, flags, TRUE); - - if (GTK_IMHTML(gtkconv->imhtml)->show_comments) { - /* The color for the timestamp has to be set in the font-tags, unfortunately. - * Applying the nick-tag to timestamps would work, but that can make it - * bold. I thought applying the "comment" tag again, which has "weight" set - * to PANGO_WEIGHT_NORMAL, would remove the boldness. But it doesn't. So - * this will have to do. I don't terribly like it. -- sadrul */ - const char *color = get_text_tag_color(tag); - g_snprintf(buf2, BUF_LONG, "", - color ? "COLOR=\"" : "", color ? color : "", color ? "\"" : "", mdate); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL); - } - - gtk_text_buffer_get_end_iter(buffer, &end); - mark = gtk_text_buffer_create_mark(buffer, NULL, &end, TRUE); - - g_snprintf(buf2, BUF_LONG, "%s ", sml_attrib ? sml_attrib : "", str); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL); + /* timestamp */ + { + g_snprintf (buf2, BUF_LONG, "%s ", mdate); - gtk_text_buffer_get_end_iter(buffer, &end); - gtk_text_buffer_get_iter_at_mark(buffer, &start, mark); - gtk_text_buffer_apply_tag(buffer, tag, &start, &end); - gtk_text_buffer_delete_mark(buffer, mark); + gtk_webview_append_html (GTK_WEBVIEW(gtkconv->webview), buf2); + } + g_snprintf(buf2, BUF_LONG, "%s ", sml_attrib ? sml_attrib : "", str); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), buf2); g_free(str); if(gc){ char *pre = g_strdup_printf("", sml_attrib ? sml_attrib : ""); char *post = ""; - int pre_len = strlen(pre); - int post_len = strlen(post); - - with_font_tag = g_malloc(length + pre_len + post_len + 1); - - strcpy(with_font_tag, pre); - memcpy(with_font_tag + pre_len, new_message, length); - strcpy(with_font_tag + pre_len + length, post); - - length += pre_len + post_len; + with_font_tag = g_strdup_printf ("%s%s%s", pre, new_message, post); g_free(pre); } else with_font_tag = g_memdup(new_message, length); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), - with_font_tag, gtk_font_options | gtk_font_options_all); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), + with_font_tag); g_free(with_font_tag); g_free(new_message); @@ -5991,12 +5723,6 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a gtkconv_set_unseen(gtkconv, unseen); } - if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) - { - /* Restore the smiley-data */ - pidgin_themes_smiley_themeize(gtkconv->imhtml); - } - purple_signal_emit(pidgin_conversations_get_handle(), (type == PURPLE_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"), account, name, displaying, conv, flags); @@ -6088,10 +5814,6 @@ pidgin_conv_chat_rename_user(PurpleConversation *conv, const char *old_name, g_free(val); } - if ((tag = get_buddy_tag(conv, old_name, 0, FALSE))) - g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL); - if ((tag = get_buddy_tag(conv, old_name, PURPLE_MESSAGE_NICK, FALSE))) - g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL); if (!purple_conv_chat_find_user(chat, old_name)) return; @@ -6149,10 +5871,7 @@ pidgin_conv_chat_remove_users(PurpleConversation *conv, GList *users) g_free(val); } while (f); - if ((tag = get_buddy_tag(conv, l->data, 0, FALSE))) - g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL); - if ((tag = get_buddy_tag(conv, l->data, PURPLE_MESSAGE_NICK, FALSE))) - g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL); + } g_snprintf(tmp, sizeof(tmp), @@ -6256,99 +5975,17 @@ add_custom_smiley_for_imhtml(GtkIMHtml *imhtml, const char *sml, const char *smi return TRUE; } -static gboolean -pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gboolean remote) -{ - PidginConversation *gtkconv; - struct smiley_list *list; - const char *sml = NULL, *conv_sml; - - if (!conv || !smile || !*smile) { - return FALSE; - } - - /* If smileys are off, return false */ - if (pidgin_themes_smileys_disabled()) - return FALSE; - - /* If possible add this smiley to the current theme. - * The addition is only temporary: custom smilies aren't saved to disk. */ - conv_sml = purple_account_get_protocol_name(conv->account); - gtkconv = PIDGIN_CONVERSATION(conv); - - for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) { - if (!strcmp(list->sml, conv_sml)) { - sml = list->sml; - break; - } - } - - if (!add_custom_smiley_for_imhtml(GTK_IMHTML(gtkconv->imhtml), sml, smile)) - return FALSE; - - if (!remote) /* If it's a local custom smiley, then add it for the entry */ - if (!add_custom_smiley_for_imhtml(GTK_IMHTML(gtkconv->entry), sml, smile)) - return FALSE; - - return TRUE; -} - static void pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, const guchar *data, gsize size) { - PidginConversation *gtkconv; - GtkIMHtmlSmiley *smiley; - GdkPixbufLoader *loader; - const char *sml; - - sml = purple_account_get_protocol_name(conv->account); - gtkconv = PIDGIN_CONVERSATION(conv); - smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); - - if (!smiley) - return; - - smiley->data = g_realloc(smiley->data, smiley->datasize + size); - g_memmove((guchar *)smiley->data + smiley->datasize, data, size); - smiley->datasize += size; - - loader = smiley->loader; - if (!loader) - return; - - gdk_pixbuf_loader_write(loader, data, size, NULL); + return; } static void pidgin_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) { - PidginConversation *gtkconv; - GtkIMHtmlSmiley *smiley; - GdkPixbufLoader *loader; - const char *sml; - - g_return_if_fail(conv != NULL); - g_return_if_fail(smile != NULL); - - sml = purple_account_get_protocol_name(conv->account); - gtkconv = PIDGIN_CONVERSATION(conv); - smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); - - if (!smiley) - return; - - loader = smiley->loader; - - if (!loader) - return; - - - - purple_debug_info("gtkconv", "About to close the smiley pixbuf\n"); - - gdk_pixbuf_loader_close(loader, NULL); - + return; } static void @@ -6646,8 +6283,6 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) } } - if (fields & PIDGIN_CONV_SMILEY_THEME) - pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml); if ((fields & PIDGIN_CONV_COLORIZE_TITLE) || (fields & PIDGIN_CONV_SET_TITLE) || @@ -6872,7 +6507,7 @@ static PurpleConversationUiOps conversation_ui_ops = pidgin_conv_chat_update_user, /* chat_update_user */ pidgin_conv_present_conversation, /* present */ pidgin_conv_has_focus, /* has_focus */ - pidgin_conv_custom_smiley_add, /* custom_smiley_add */ + NULL, /* custom_smiley_add */ pidgin_conv_custom_smiley_write, /* custom_smiley_write */ pidgin_conv_custom_smiley_close, /* custom_smiley_close */ pidgin_conv_send_confirm, /* send_confirm */ @@ -7278,8 +6913,6 @@ show_timestamps_pref_cb(const char *name, PurplePrefType type, GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), (gboolean)GPOINTER_TO_INT(value)); - gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), - (gboolean)GPOINTER_TO_INT(value)); } } @@ -7674,7 +7307,7 @@ add_message_history_to_gtkconv(gpointer data) while (gtkconv->attach.current && count < 100) { /* XXX: 100 is a random value here */ PurpleConvMessage *msg = gtkconv->attach.current->data; if (!im && when && when < msg->when) { - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "

", 0); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "

"); g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL); } pidgin_conv_write_conv(msg->conv, msg->who, msg->alias, msg->what, msg->flags, msg->when); @@ -7709,7 +7342,7 @@ add_message_history_to_gtkconv(gpointer data) PurpleConvMessage *msg = msgs->data; pidgin_conv_write_conv(msg->conv, msg->who, msg->alias, msg->what, msg->flags, msg->when); } - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "

", 0); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "

"); g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL); } diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index afe2a21651..c5821e2304 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -128,7 +128,7 @@ struct _PidginConversation GtkWidget *tabby; GtkWidget *menu_tabby; - GtkWidget *imhtml; + GtkWidget *webview; GtkTextBuffer *entry_buffer; GtkWidget *entry; gboolean auto_resize; /* this is set to TRUE if the conversation diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 429c9fc6bb..16b1058b25 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -37,12 +37,13 @@ #include "gtkblist.h" #include "gtkdialogs.h" -#include "gtkimhtml.h" -#include "gtkimhtmltoolbar.h" #include "gtklog.h" #include "gtkutils.h" +#include "gtkwebview.h" #include "pidginstock.h" + + static GList *dialogwindows = NULL; static GtkWidget *about = NULL; @@ -398,10 +399,10 @@ void pidgin_dialogs_about() { GtkWidget *vbox; GtkWidget *logo; - GtkWidget *frame; - GtkWidget *text; + GtkWidget *scrolled_window; GtkWidget *button; - GtkTextIter iter; + GtkWidget *web_view; + GString *str; AtkObject *obj; char* filename, *tmp; @@ -439,9 +440,14 @@ void pidgin_dialogs_about() g_free(tmp); gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); - frame = pidgin_create_imhtml(FALSE, &text, NULL, NULL); - gtk_imhtml_set_format_functions(GTK_IMHTML(text), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY); - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); + scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + web_view = gtk_webview_new (); + gtk_container_add (GTK_CONTAINER (scrolled_window), web_view); + + gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0); str = g_string_sized_new(4096); @@ -682,11 +688,9 @@ if (purple_plugins_find_with_id("core-tcl") != NULL) { /* End of not to be translated section */ - gtk_imhtml_append_text(GTK_IMHTML(text), str->str, GTK_IMHTML_NO_SCROLL); + webkit_web_view_load_html_string (WEBKIT_WEB_VIEW(web_view), str->str, ""); g_string_free(str, TRUE); - gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); - gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter); /* Close Button */ button = pidgin_dialog_add_button(GTK_DIALOG(about), GTK_STOCK_CLOSE, diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c index aed4f054e0..55c1467226 100644 --- a/pidgin/gtklog.c +++ b/pidgin/gtklog.c @@ -35,9 +35,9 @@ #include "pidginstock.h" #include "gtkblist.h" -#include "gtkimhtml.h" #include "gtklog.h" #include "gtkutils.h" +#include "gtkwebview.h" static GHashTable *log_viewers = NULL; static void populate_log_tree(PidginLogViewer *lv); @@ -130,7 +130,7 @@ static void search_cb(GtkWidget *button, PidginLogViewer *lv) populate_log_tree(lv); g_free(lv->search); lv->search = NULL; - gtk_imhtml_search_clear(GTK_IMHTML(lv->imhtml)); + webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(lv->web_view)); select_first_log(lv); return; } @@ -138,7 +138,7 @@ static void search_cb(GtkWidget *button, PidginLogViewer *lv) if (lv->search != NULL && !strcmp(lv->search, search_term)) { /* Searching for the same term acts as "Find Next" */ - gtk_imhtml_search_find(GTK_IMHTML(lv->imhtml), lv->search); + webkit_web_view_search_text (WEBKIT_WEB_VIEW(lv->web_view), lv->search, FALSE, TRUE, TRUE); return; } @@ -148,7 +148,7 @@ static void search_cb(GtkWidget *button, PidginLogViewer *lv) lv->search = g_strdup(search_term); gtk_tree_store_clear(lv->treestore); - gtk_imhtml_clear(GTK_IMHTML(lv->imhtml)); + webkit_web_view_open (WEBKIT_WEB_VIEW (lv->web_view), "about:blank"); /* clear the view */ for (logs = lv->logs; logs != NULL; logs = logs->next) { char *read = purple_log_read((PurpleLog*)logs->data, NULL); @@ -422,7 +422,9 @@ static gboolean log_popup_menu_cb(GtkWidget *treeview, PidginLogViewer *lv) static gboolean search_find_cb(gpointer data) { PidginLogViewer *viewer = data; - gtk_imhtml_search_find(GTK_IMHTML(viewer->imhtml), viewer->search); + webkit_web_view_mark_text_matches (WEBKIT_WEB_VIEW (viewer->web_view), viewer->search, FALSE, 0); + webkit_web_view_set_highlight_text_matches (WEBKIT_WEB_VIEW (viewer->web_view), TRUE); + webkit_web_view_search_text (WEBKIT_WEB_VIEW (viewer->web_view), viewer->search, FALSE, TRUE, TRUE); return FALSE; } @@ -463,19 +465,15 @@ static void log_select_cb(GtkTreeSelection *sel, PidginLogViewer *viewer) { read = purple_log_read(log, &flags); viewer->flags = flags; - gtk_imhtml_clear(GTK_IMHTML(viewer->imhtml)); - gtk_imhtml_set_protocol_name(GTK_IMHTML(viewer->imhtml), - purple_account_get_protocol_name(log->account)); + webkit_web_view_open (WEBKIT_WEB_VIEW(viewer->web_view), "about:blank"); purple_signal_emit(pidgin_log_get_handle(), "log-displaying", viewer, log); - gtk_imhtml_append_text(GTK_IMHTML(viewer->imhtml), read, - GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL | - ((flags & PURPLE_LOG_READ_NO_NEWLINE) ? GTK_IMHTML_NO_NEWLINE : 0)); + webkit_web_view_load_html_string (WEBKIT_WEB_VIEW(viewer->web_view), read, ""); g_free(read); if (viewer->search != NULL) { - gtk_imhtml_search_clear(GTK_IMHTML(viewer->imhtml)); + webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(viewer->web_view)); g_idle_add(search_find_cb, viewer); } @@ -658,11 +656,16 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_paned_add2(GTK_PANED(pane), vbox); /* Viewer ************/ - frame = pidgin_create_imhtml(FALSE, &lv->imhtml, NULL, NULL); - gtk_widget_set_name(lv->imhtml, "pidgin_log_imhtml"); - gtk_widget_set_size_request(lv->imhtml, 320, 200); - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); - gtk_widget_show(frame); + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + + lv->web_view = gtk_webview_new (); + gtk_container_add (GTK_CONTAINER (sw), lv->web_view); + gtk_widget_set_name(lv->web_view, "pidgin_log_web_view"); + gtk_widget_set_size_request(lv->web_view, 320, 200); + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); + gtk_widget_show(sw); /* Search box **********/ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); diff --git a/pidgin/gtklog.h b/pidgin/gtklog.h index 77917a8a15..3fd56484b0 100644 --- a/pidgin/gtklog.h +++ b/pidgin/gtklog.h @@ -43,7 +43,7 @@ struct _PidginLogViewer { GtkWidget *window; /**< The viewer's window */ GtkTreeStore *treestore; /**< The treestore containing said logs */ GtkWidget *treeview; /**< The treeview representing said treestore */ - GtkWidget *imhtml; /**< The imhtml to display said logs */ + GtkWidget *web_view; /**< The webkit web view to display said logs */ GtkWidget *entry; /**< The search entry, in which search terms * are entered */ PurpleLogReadFlags flags; /**< The most recently used log flags */ diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index b12669316b..93c8bf2f2a 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -36,10 +36,10 @@ #include "util.h" #include "gtkblist.h" -#include "gtkimhtml.h" #include "gtknotify.h" #include "gtkpounce.h" #include "gtkutils.h" +#include "gtkwebview.h" typedef struct { @@ -738,21 +738,6 @@ formatted_input_cb(GtkWidget *win, GdkEventKey *event, gpointer data) return FALSE; } -static GtkIMHtmlOptions -notify_imhtml_options(void) -{ - GtkIMHtmlOptions options = 0; - - if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting")) - options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES; - - options |= GTK_IMHTML_NO_COMMENTS; - options |= GTK_IMHTML_NO_TITLE; - options |= GTK_IMHTML_NO_NEWLINE; - options |= GTK_IMHTML_NO_SCROLL; - return options; -} - static void * pidgin_notify_formatted(const char *title, const char *primary, const char *secondary, const char *text) @@ -761,8 +746,8 @@ pidgin_notify_formatted(const char *title, const char *primary, GtkWidget *vbox; GtkWidget *label; GtkWidget *button; - GtkWidget *imhtml; - GtkWidget *frame; + GtkWidget *web_view; + GtkWidget *scrolled_window; char label_text[2048]; char *linked_text, *primary_esc, *secondary_esc; @@ -797,14 +782,18 @@ pidgin_notify_formatted(const char *title, const char *primary, gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_widget_show(label); - /* Add the imhtml */ - frame = pidgin_create_imhtml(FALSE, &imhtml, NULL, NULL); - gtk_widget_set_name(imhtml, "pidgin_notify_imhtml"); - gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), - gtk_imhtml_get_format_functions(GTK_IMHTML(imhtml)) | GTK_IMHTML_IMAGE); - gtk_widget_set_size_request(imhtml, 300, 250); - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); - gtk_widget_show(frame); + /* Add the webview */ + scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + web_view = gtk_webview_new (); + gtk_container_add (GTK_CONTAINER (scrolled_window), web_view); + + gtk_widget_set_name(web_view, "pidgin_notify_webview"); + gtk_widget_set_size_request(web_view, 300, 250); + gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0); + gtk_widget_show_all(scrolled_window); /* Add the Close button. */ button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); @@ -817,10 +806,10 @@ pidgin_notify_formatted(const char *title, const char *primary, /* Make sure URLs are clickable */ linked_text = purple_markup_linkify(text); - gtk_imhtml_append_text(GTK_IMHTML(imhtml), linked_text, notify_imhtml_options()); + webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (web_view), linked_text, ""); g_free(linked_text); - g_object_set_data(G_OBJECT(window), "info-widget", imhtml); + g_object_set_data(G_OBJECT(window), "webview-widget", web_view); /* Show the window */ pidgin_auto_parent_window(window); @@ -1079,10 +1068,11 @@ pidgin_notify_userinfo(PurpleConnection *gc, const char *who, info = purple_notify_user_info_get_text_with_newline(user_info, "
"); pinfo = g_hash_table_lookup(userinfo, key); if (pinfo != NULL) { - GtkIMHtml *imhtml = g_object_get_data(G_OBJECT(pinfo->window), "info-widget"); + GtkWidget *webview = g_object_get_data(G_OBJECT(pinfo->window), "webview-widget"); char *linked_text = purple_markup_linkify(info); - gtk_imhtml_clear(imhtml); - gtk_imhtml_append_text(imhtml, linked_text, notify_imhtml_options()); + g_assert (webview); + printf ("%s\n", linked_text); + gtk_webview_load_html_string_with_imgstore (GTK_WEBVIEW (webview), linked_text); g_free(linked_text); g_free(key); ui_handle = pinfo->window; diff --git a/pidgin/gtkthemes.c b/pidgin/gtkthemes.c index c194a70ecc..901ef8398d 100644 --- a/pidgin/gtkthemes.c +++ b/pidgin/gtkthemes.c @@ -270,6 +270,8 @@ void pidgin_themes_load_smiley_theme(const char *file, gboolean load) if (*i == '[' && strchr(i, ']') && load) { struct smiley_list *child = g_new0(struct smiley_list, 1); child->sml = g_strndup(i+1, strchr(i, ']') - i - 1); + child->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + if (theme->list) list->next = child; else @@ -320,6 +322,7 @@ void pidgin_themes_load_smiley_theme(const char *file, gboolean load) } else { GtkIMHtmlSmiley *smiley = gtk_imhtml_smiley_create(sfile, l, hidden, 0); list->smileys = g_slist_prepend(list->smileys, smiley); + g_hash_table_insert (list->files, g_strdup(l), g_strdup(sfile)); } while (isspace(*i)) i++; @@ -361,7 +364,6 @@ void pidgin_themes_load_smiley_theme(const char *file, gboolean load) if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { /* We want to see our custom smileys on our entry if we write the shortcut */ - pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml); pidgin_themes_smiley_themeize_custom(PIDGIN_CONVERSATION(conv)->entry); } } diff --git a/pidgin/gtkthemes.h b/pidgin/gtkthemes.h index 138edbbeb0..8cf4b1dff7 100644 --- a/pidgin/gtkthemes.h +++ b/pidgin/gtkthemes.h @@ -29,6 +29,7 @@ struct smiley_list { char *sml; GSList *smileys; + GHashTable *files; /**< map from smiley shortcut to filename */ struct smiley_list *next; }; diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index eec8ea2c61..681ee2d2bc 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -1,4 +1,4 @@ -DIST_SUBDIRS = cap disco gestures gevolution musicmessaging perl ticker +DIST_SUBDIRS = adiumthemes cap disco gestures gevolution musicmessaging perl ticker if BUILD_GEVOLUTION GEVOLUTION_DIR = gevolution @@ -16,9 +16,6 @@ if USE_PERL PERL_DIR = perl endif -if ENABLE_GESTURES -GESTURE_DIR = gestures -endif SUBDIRS = \ $(CAP_DIR) \ @@ -27,7 +24,8 @@ SUBDIRS = \ $(MUSICMESSAGING_DIR) \ $(PERL_DIR) \ disco \ - ticker + ticker \ + adiumthemes plugindir = $(libdir)/pidgin @@ -36,17 +34,12 @@ contact_priority_la_LDFLAGS = -module -avoid-version extplacement_la_LDFLAGS = -module -avoid-version gtk_signals_test_la_LDFLAGS = -module -avoid-version gtkbuddynote_la_LDFLAGS = -module -avoid-version -history_la_LDFLAGS = -module -avoid-version iconaway_la_LDFLAGS = -module -avoid-version -markerline_la_LDFLAGS = -module -avoid-version -notify_la_LDFLAGS = -module -avoid-version pidginrc_la_LDFLAGS = -module -avoid-version relnot_la_LDFLAGS = -module -avoid-version sendbutton_la_LDFLAGS = -module -avoid-version spellchk_la_LDFLAGS = -module -avoid-version themeedit_la_LDFLAGS = -module -avoid-version -timestamp_la_LDFLAGS = -module -avoid-version -timestamp_format_la_LDFLAGS = -module -avoid-version xmppconsole_la_LDFLAGS = -module -avoid-version if PLUGINS @@ -55,17 +48,12 @@ plugin_LTLIBRARIES = \ convcolors.la \ extplacement.la \ gtkbuddynote.la \ - history.la \ iconaway.la \ - markerline.la \ - notify.la \ pidginrc.la \ relnot.la \ sendbutton.la \ spellchk.la \ themeedit.la \ - timestamp.la \ - timestamp_format.la \ xmppconsole.la noinst_LTLIBRARIES = \ @@ -77,35 +65,12 @@ contact_priority_la_SOURCES = contact_priority.c extplacement_la_SOURCES = extplacement.c gtk_signals_test_la_SOURCES = gtk-signals-test.c gtkbuddynote_la_SOURCES = gtkbuddynote.c -history_la_SOURCES = history.c iconaway_la_SOURCES = iconaway.c -markerline_la_SOURCES = markerline.c -notify_la_SOURCES = notify.c pidginrc_la_SOURCES = pidginrc.c relnot_la_SOURCES = relnot.c sendbutton_la_SOURCES = sendbutton.c spellchk_la_SOURCES = spellchk.c themeedit_la_SOURCES = themeedit.c themeedit-icon.c themeedit-icon.h -timestamp_la_SOURCES = timestamp.c -timestamp_format_la_SOURCES = timestamp_format.c -xmppconsole_la_SOURCES = xmppconsole.c - -convcolors_la_LIBADD = $(GTK_LIBS) -contact_priority_la_LIBADD = $(GTK_LIBS) -extplacement_la_LIBADD = $(GTK_LIBS) -gtk_signals_test_la_LIBADD = $(GTK_LIBS) -gtkbuddynote_la_LIBADD = $(GTK_LIBS) -history_la_LIBADD = $(GTK_LIBS) -iconaway_la_LIBADD = $(GTK_LIBS) -markerline_la_LIBADD = $(GTK_LIBS) -notify_la_LIBADD = $(GTK_LIBS) -pidginrc_la_LIBADD = $(GTK_LIBS) -relnot_la_LIBADD = $(GLIB_LIBS) -sendbutton_la_LIBADD = $(GTK_LIBS) -spellchk_la_LIBADD = $(GTK_LIBS) -themeedit_la_LIBADD = $(GTK_LIBS) -timestamp_la_LIBADD = $(GTK_LIBS) -timestamp_format_la_LIBADD = $(GTK_LIBS) xmppconsole_la_LIBADD = $(GTK_LIBS) endif # PLUGINS -- cgit v1.2.1 From 3003edd93c1f8cf18dbd920db946b65541367926 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Jul 2009 06:10:10 +0000 Subject: Start converting Buddy List to new UI Manager code. Some auto-generated sections are not done yet. --- pidgin/gtkblist.c | 338 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- pidgin/gtkblist.h | 8 ++ 2 files changed, 339 insertions(+), 7 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 6aa541e4c8..a6a143604b 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -2057,6 +2057,67 @@ pidgin_blist_popup_menu_cb(GtkWidget *tv, void *user_data) return handled; } +#if GTK_CHECK_VERSION(2,4,0) + +static void gtk_blist_show_xfer_dialog_cb(GtkAction *item, gpointer data) +{ + pidgin_xfer_dialog_show(NULL); +} + +static void pidgin_blist_buddy_details_cb(GtkToggleAction *item, gpointer data) +{ + pidgin_set_cursor(gtkblist->window, GDK_WATCH); + + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons", + gtk_toggle_action_get_active(item)); + + pidgin_clear_cursor(gtkblist->window); +} + +static void pidgin_blist_show_idle_time_cb(GtkToggleAction *item, gpointer data) +{ + pidgin_set_cursor(gtkblist->window, GDK_WATCH); + + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time", + gtk_toggle_action_get_active(item)); + + pidgin_clear_cursor(gtkblist->window); +} + +static void pidgin_blist_show_protocol_icons_cb(GtkToggleAction *item, gpointer data) +{ + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons", + gtk_toggle_action_get_active(item)); +} + +static void pidgin_blist_show_empty_groups_cb(GtkToggleAction *item, gpointer data) +{ + pidgin_set_cursor(gtkblist->window, GDK_WATCH); + + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups", + gtk_toggle_action_get_active(item)); + + pidgin_clear_cursor(gtkblist->window); +} + +static void pidgin_blist_edit_mode_cb(GtkToggleAction *checkitem, gpointer data) +{ + pidgin_set_cursor(gtkblist->window, GDK_WATCH); + + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", + gtk_toggle_action_get_active(checkitem)); + + pidgin_clear_cursor(gtkblist->window); +} + +static void pidgin_blist_mute_sounds_cb(GtkToggleAction *item, gpointer data) +{ + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", + gtk_toggle_action_get_active(item)); +} + +#else /* GTK_CHECK_VERSION(2,4,0) */ + static void pidgin_blist_buddy_details_cb(gpointer data, guint action, GtkWidget *item) { pidgin_set_cursor(gtkblist->window, GDK_WATCH); @@ -2106,15 +2167,23 @@ static void pidgin_blist_edit_mode_cb(gpointer callback_data, guint callback_act static void pidgin_blist_mute_sounds_cb(gpointer data, guint action, GtkWidget *item) { - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", GTK_CHECK_MENU_ITEM(item)->active); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", + gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); } +#endif /* GTK_CHECK_VERSION(2,4,0) */ + static void pidgin_blist_mute_pref_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data) { +#if GTK_CHECK_VERSION(2,4,0) + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, + "/BList/ToolsMenu/MuteSounds")), (gboolean)GPOINTER_TO_INT(value)); +#else gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(gtkblist->ift, N_("/Tools/Mute Sounds"))), (gboolean)GPOINTER_TO_INT(value)); +#endif } static void @@ -2126,7 +2195,11 @@ pidgin_blist_sound_method_pref_cb(const char *name, PurplePrefType type, if(!strcmp(value, "none")) sensitive = FALSE; +#if GTK_CHECK_VERSION(2,4,0) + gtk_action_set_sensitive(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds"), sensitive); +#else gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), sensitive); +#endif } static void @@ -3424,6 +3497,110 @@ toggle_debug(void) /*************************************************** * Crap * ***************************************************/ +#if GTK_CHECK_VERSION(2,4,0) +/* TODO: fill out tooltips... */ +static const GtkActionEntry blist_menu_entries[] = { + /* Buddies menu */ + { "BuddiesMenu", NULL, N_("_Buddies"), NULL, NULL, NULL }, + { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "M", NULL, pidgin_dialogs_im }, + { "JoinAChat", PIDGIN_STOCK_CHAT, N_("Join a _Chat..."), "C", NULL, pidgin_blist_joinchat_show }, + { "GetUserInfo", PIDGIN_STOCK_TOOLBAR_USER_INFO, N_("Get User _Info..."), "I", NULL, pidgin_dialogs_info }, + { "ViewUserLog", NULL, N_("View User _Log..."), "L", NULL, pidgin_dialogs_log }, + { "ShowMenu", NULL, N_("Sh_ow"), NULL, NULL, NULL }, + { "SortMenu", NULL, N_("_Sort Buddies"), NULL, NULL, NULL }, + { "AddBuddy", GTK_STOCK_ADD, N_("_Add Buddy..."), "B", NULL, pidgin_blist_add_buddy_cb }, + { "AddChat", GTK_STOCK_ADD, N_("Add C_hat..."), NULL, NULL, pidgin_blist_add_chat_cb }, + { "AddGroup", GTK_STOCK_ADD, N_("Add _Group..."), NULL, NULL, purple_blist_request_add_group }, + { "Quit", GTK_STOCK_QUIT, N_("_Quit"), "Q", NULL, purple_core_quit }, + + /* Accounts menu */ + { "AccountsMenu", NULL, N_("_Accounts"), NULL, NULL, NULL }, + { "ManageAccounts", NULL, N_("Manage Accounts"), "A", NULL, pidgin_accounts_window_show }, + + /* Tools */ + { "ToolsMenu", NULL, N_("_Tools"), NULL, NULL, NULL }, + { "BuddyPounces", NULL, N_("Buddy _Pounces"), NULL, NULL, pidgin_pounces_manager_show }, + { "Certificates", NULL, N_("_Certificates"), NULL, NULL, pidgin_certmgr_show }, + { "CustomSmileys", PIDGIN_STOCK_TOOLBAR_SMILEY, N_("Custom Smile_ys"), "Y", NULL, pidgin_smiley_manager_show }, + { "Plugins", PIDGIN_STOCK_TOOLBAR_PLUGINS, N_("Plu_gins"), "U", NULL, pidgin_plugin_dialog_show }, + { "Preferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), "P", NULL, pidgin_prefs_show }, + { "Privacy", NULL, N_("Pr_ivacy"), NULL, NULL, pidgin_privacy_dialog_show }, + { "FileTransfers", PIDGIN_STOCK_TOOLBAR_TRANSFER, N_("_File Transfers"), "T", NULL, gtk_blist_show_xfer_dialog_cb }, + { "RoomList", NULL, N_("R_oom List"), NULL, NULL, pidgin_roomlist_dialog_show }, + { "SystemLog", NULL, N_("System _Log"), NULL, NULL, gtk_blist_show_systemlog_cb }, + + /* Help */ + { "HelpMenu", NULL, N_("_Help"), NULL, NULL, NULL }, + { "OnlineHelp", GTK_STOCK_HELP, N_("Online _Help"), "F1", NULL, gtk_blist_show_onlinehelp_cb }, + { "DebugWindow", NULL, N_("_Debug Window"), NULL, NULL, toggle_debug }, + { "About", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, pidgin_dialogs_about }, +}; + +/* Toggle items */ +static const GtkToggleActionEntry blist_menu_toggle_entries[] = { + /* Buddies->Show menu */ + { "ShowOffline", NULL, N_("_Offline Buddies"), NULL, NULL, pidgin_blist_edit_mode_cb, FALSE }, + { "ShowEmptyGroups", NULL, N_("_Empty Groups"), NULL, NULL, pidgin_blist_show_empty_groups_cb, FALSE }, + { "ShowBuddyDetails", NULL, N_("Buddy _Details"), NULL, NULL, pidgin_blist_buddy_details_cb, FALSE }, + { "ShowIdleTimes", NULL, N_("Idle _Times"), NULL, NULL, pidgin_blist_show_idle_time_cb, FALSE }, + { "ShowProtocolIcons", NULL, N_("_Protocol Icons"), NULL, NULL, pidgin_blist_show_protocol_icons_cb, FALSE }, + + /* Tools menu */ + { "MuteSounds", NULL, N_("Mute _Sounds"), NULL, NULL, pidgin_blist_mute_sounds_cb, FALSE }, +}; + +static const char *blist_menu = +"" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" +""; + +#else static GtkItemFactoryEntry blist_menu[] = { /* Buddies menu */ @@ -3469,12 +3646,9 @@ static GtkItemFactoryEntry blist_menu[] = { N_("/_Help"), NULL, NULL, 0, "", NULL }, { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "", GTK_STOCK_HELP }, { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "", NULL }, -#if GTK_CHECK_VERSION(2,6,0) - { N_("/Help/_About"), NULL, pidgin_dialogs_about, 4, "", GTK_STOCK_ABOUT }, -#else { N_("/Help/_About"), NULL, pidgin_dialogs_about, 4, "", NULL }, -#endif }; +#endif /********************************************************* * Private Utility functions * @@ -4299,12 +4473,21 @@ static void pidgin_blist_hide_node(PurpleBuddyList *list, PurpleBlistNode *node, static const char *require_connection[] = { +#if GTK_CHECK_VERSION(2,4,0) + "/BList/BuddiesMenu/NewInstantMessage", + "/BList/BuddiesMenu/JoinAChat", + "/BList/BuddiesMenu/GetUserInfo", + "/BList/BuddiesMenu/AddBuddy", + "/BList/BuddiesMenu/AddChat", + "/BList/BuddiesMenu/AddGroup", +#else N_("/Buddies/New Instant Message..."), N_("/Buddies/Join a Chat..."), N_("/Buddies/Get User Info..."), N_("/Buddies/Add Buddy..."), N_("/Buddies/Add Chat..."), N_("/Buddies/Add Group..."), +#endif }; static const int require_connection_size = sizeof(require_connection) @@ -4317,7 +4500,11 @@ static const int require_connection_size = sizeof(require_connection) static void update_menu_bar(PidginBuddyList *gtkblist) { +#if GTK_CHECK_VERSION(2,4,0) + GtkAction *action; +#else GtkWidget *widget; +#endif gboolean sensitive; int i; @@ -4327,6 +4514,25 @@ update_menu_bar(PidginBuddyList *gtkblist) sensitive = (purple_connections_get_all() != NULL); +#if GTK_CHECK_VERSION(2,4,0) + for (i = 0; i < require_connection_size; i++) + { + action = gtk_ui_manager_get_action(gtkblist->ui, require_connection[i]); + gtk_action_set_sensitive(action, sensitive); + } + + action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/JoinAChat"); + gtk_action_set_sensitive(action, pidgin_blist_joinchat_is_showable()); + + action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/AddChat"); + gtk_action_set_sensitive(action, pidgin_blist_joinchat_is_showable()); + + action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/Privacy"); + gtk_action_set_sensitive(action, sensitive); + + action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/RoomList"); + gtk_action_set_sensitive(action, pidgin_roomlist_is_showable()); +#else for (i = 0; i < require_connection_size; i++) { widget = gtk_item_factory_get_widget(gtkblist->ift, require_connection[i]); @@ -4344,6 +4550,7 @@ update_menu_bar(PidginBuddyList *gtkblist) widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List")); gtk_widget_set_sensitive(widget, pidgin_roomlist_is_showable()); +#endif } static void @@ -4634,11 +4841,13 @@ enum { NUM_TARGETS }; +#if !GTK_CHECK_VERSION(2,4,0) static const char * item_factory_translate_func (const char *path, gpointer func_data) { return _((char *)path); } +#endif void pidgin_blist_setup_sort_methods() { @@ -5623,6 +5832,10 @@ static void pidgin_blist_show(PurpleBuddyList *list) GtkWidget *label; char *pretty, *tmp; const char *theme_name; +#if GTK_CHECK_VERSION(2,4,0) + GtkActionGroup *action_group; + GError *error; +#endif GtkAccelGroup *accel_group; GtkTreeSelection *selection; GtkTargetEntry dte[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW}, @@ -5672,6 +5885,44 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK); /******************************* Menu bar *************************************/ +#if GTK_CHECK_VERSION(2,4,0) + action_group = gtk_action_group_new("BListActions"); + gtk_action_group_add_actions(action_group, + blist_menu_entries, + G_N_ELEMENTS(blist_menu_entries), + GTK_WINDOW(gtkblist->window)); + gtk_action_group_add_toggle_actions(action_group, + blist_menu_toggle_entries, + G_N_ELEMENTS(blist_menu_toggle_entries), + GTK_WINDOW(gtkblist->window)); +#ifdef ENABLE_NLS + gtk_action_group_set_translation_domain(action_group, + PACKAGE); +#endif + + gtkblist->ui = gtk_ui_manager_new(); + gtk_ui_manager_insert_action_group(gtkblist->ui, action_group, 0); + + accel_group = gtk_ui_manager_get_accel_group(gtkblist->ui); + gtk_window_add_accel_group(GTK_WINDOW(gtkblist->window), accel_group); + + error = NULL; + if (!gtk_ui_manager_add_ui_from_string(gtkblist->ui, blist_menu, -1, &error)) + { + g_message("building menus failed: %s", error->message); + g_error_free(error); + exit(EXIT_FAILURE); + } + + menu = gtk_ui_manager_get_widget(gtkblist->ui, "/BList"); + gtkblist->menutray = pidgin_menu_tray_new(); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtkblist->menutray); + gtk_widget_show(gtkblist->menutray); + gtk_widget_show(menu); + gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), menu, FALSE, FALSE, 0); + + accountmenu = gtk_ui_manager_get_widget(gtkblist->ui, "/BList/AccountsMenu"); +#else accel_group = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group); g_object_unref(accel_group); @@ -5679,7 +5930,7 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtk_item_factory_set_translate_func(gtkblist->ift, (GtkTranslateFunc)item_factory_translate_func, NULL, NULL); - gtk_item_factory_create_items(gtkblist->ift, sizeof(blist_menu) / sizeof(*blist_menu), + gtk_item_factory_create_items(gtkblist->ift, G_N_ENTRIES(blist_menu), blist_menu, NULL); pidgin_load_accels(); g_signal_connect(G_OBJECT(accel_group), "accel-changed", G_CALLBACK(pidgin_save_accels_cb), NULL); @@ -5692,7 +5943,7 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), menu, FALSE, FALSE, 0); accountmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Accounts")); - +#endif /****************************** Notebook *************************************/ gtkblist->notebook = gtk_notebook_new(); @@ -5881,6 +6132,30 @@ static void pidgin_blist_show(PurpleBuddyList *list) /* set the Show Offline Buddies option. must be done * after the treeview or faceprint gets mad. -Robot101 */ +#if GTK_CHECK_VERSION(2,4,0) + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowOffline")), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies")); + + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowEmptyGroups")), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups")); + + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds")), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute")); + + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowBuddyDetails")), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons")); + + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowIdleTimes")), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time")); + + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowProtocolIcons")), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")); + + if(!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none")) + gtk_action_set_sensitive(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds"), FALSE); + +#else + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Offline Buddies"))), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies")); @@ -5901,6 +6176,7 @@ static void pidgin_blist_show(PurpleBuddyList *list) if(!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none")) gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), FALSE); +#endif /* Update some dynamic things */ update_menu_bar(gtkblist); @@ -6777,7 +7053,11 @@ static void pidgin_blist_destroy(PurpleBuddyList *list) gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL; g_object_unref(G_OBJECT(gtkblist->treemodel)); gtkblist->treemodel = NULL; +#if GTK_CHECK_VERSION(2,4,0) + g_object_unref(G_OBJECT(gtkblist->ui)); +#else g_object_unref(G_OBJECT(gtkblist->ift)); +#endif g_object_unref(G_OBJECT(gtkblist->empty_avatar)); gdk_cursor_unref(gtkblist->hand_cursor); @@ -7868,6 +8148,9 @@ pidgin_blist_update_accounts_menu(void) if (accountmenu == NULL) return; +#if GTK_CHECK_VERSION(2,4,0) +/* TODO: Update Accounts... */ +#else /* Clear the old Accounts menu */ for (l = gtk_container_get_children(GTK_CONTAINER(accountmenu)); l; l = g_list_delete_link(l, l)) { menuitem = l->data; @@ -7990,6 +8273,7 @@ pidgin_blist_update_accounts_menu(void) gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); } gtk_widget_show_all(accountmenu); +#endif } static GList *plugin_submenus = NULL; @@ -8002,6 +8286,9 @@ pidgin_blist_update_plugin_actions(void) GList *l; GtkAccelGroup *accel_group; +#if GTK_CHECK_VERSION(2,4,0) +/* TODO: Update Plugin */ +#else GtkWidget *pluginmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools")); g_return_if_fail(pluginmenu != NULL); @@ -8042,6 +8329,7 @@ pidgin_blist_update_plugin_actions(void) build_plugin_actions(submenu, plugin, NULL); } gtk_widget_show_all(pluginmenu); +#endif } static void @@ -8068,6 +8356,41 @@ pidgin_blist_update_sort_methods(void) GtkWidget *sortmenu; const char *m = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/sort_type"); +#if GTK_CHECK_VERSION(2,4,0) + GtkActionGroup *sort_group; + GtkAction *activeaction = NULL; + GtkAction *action; + GString *ui_string; + + if ((gtkblist == NULL) || (gtkblist->ui == NULL)) + return; + + /* Clear the old menu */ + gtk_ui_manager_remove_ui(gtkblist->ui, gtkblist->sort_methods_merge_id); + + sort_group = gtk_action_group_new("SortMethods"); + ui_string = g_string_new(""); + for (l = pidgin_blist_sort_methods; l; l = l->next) { + method = (PidginBlistSortMethod *)l->data; + action = gtk_radio_action_new(method->id, + _(method->name), + NULL, + NULL, + 0); + gtk_action_group_add_action_with_accel(sort_group, action, NULL); + if (!strcmp(m, method->id)) + activeaction = action; + g_signal_connect(G_OBJECT(action), "activate", + G_CALLBACK(sortmethod_act), method->id); + g_string_append_printf(ui_string, "", method->id); + } + g_string_append(ui_string, ""); + purple_debug_info("BList", "BList sort is %s\n", ui_string->str); + gtkblist->sort_methods_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string->str, -1, NULL); + gtk_ui_manager_insert_action_group(gtkblist->ui, sort_group, 1); + if (activeaction) + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(activeaction), TRUE); +#else if ((gtkblist == NULL) || (gtkblist->ift == NULL)) return; @@ -8097,4 +8420,5 @@ pidgin_blist_update_sort_methods(void) } if (activeitem) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(activeitem), TRUE); +#endif } diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index bda0ef77d8..4c65deec21 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -82,7 +82,15 @@ struct _PidginBuddyList { GtkCellRenderer *text_rend; +#if GTK_CHECK_VERSION(2,4,0) + GtkUIManager *ui; + /* Hmm, can I put these here? */ + guint plugins_merge_id; + guint accounts_merge_id; + guint sort_methods_merge_id; +#else GtkItemFactory *ift; +#endif GtkWidget *menutray; /**< The menu tray widget. */ GtkWidget *menutrayicon; /**< The menu tray icon. */ -- cgit v1.2.1 From 36b4ce68ed9c82975f698022032500e6c8477020 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 00:50:25 +0000 Subject: Move some UI manager stuff out of the blist structure and into the source as static variables. At the structure keeps the same size this way. --- pidgin/gtkblist.c | 19 ++++++++++++++++--- pidgin/gtkblist.h | 4 ---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index a6a143604b..8d018f5716 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -126,6 +126,10 @@ typedef struct #define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \ ((PidginBuddyListPrivate *)((list)->priv)) +#if GTK_CHECK_VERSION(2,4,0) +static guint accounts_merge_id; +static GtkActionGroup *accounts_action_group = NULL; +#endif static GtkWidget *accountmenu = NULL; static guint visibility_manager_count = 0; @@ -136,7 +140,6 @@ static gboolean editing_blist = FALSE; static GList *pidgin_blist_sort_methods = NULL; static struct pidgin_blist_sort_method *current_sort_method = NULL; static void sort_method_none(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter); - /* The functions we use for sorting aren't available in gtk 2.0.x, and * segfault in 2.2.0. 2.2.1 is known to work, so I'll require that */ #if GTK_CHECK_VERSION(2,2,1) @@ -144,6 +147,11 @@ static void sort_method_alphabetical(PurpleBlistNode *node, PurpleBuddyList *bli static void sort_method_status(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter); static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter); #endif +#if GTK_CHECK_VERSION(2,4,0) +static guint sort_merge_id; +static GtkActionGroup *sort_action_group = NULL; +#endif + static PidginBuddyList *gtkblist = NULL; static GList *groups_tree(void); @@ -8276,7 +8284,12 @@ pidgin_blist_update_accounts_menu(void) #endif } +#if GTK_CHECK_VERSION(2,4,0) +static guint plugins_merge_id; +static GtkActionGroup *plugins_action_group = NULL; +#else static GList *plugin_submenus = NULL; +#endif void pidgin_blist_update_plugin_actions(void) @@ -8366,7 +8379,7 @@ pidgin_blist_update_sort_methods(void) return; /* Clear the old menu */ - gtk_ui_manager_remove_ui(gtkblist->ui, gtkblist->sort_methods_merge_id); + gtk_ui_manager_remove_ui(gtkblist->ui, sort_merge_id); sort_group = gtk_action_group_new("SortMethods"); ui_string = g_string_new(""); @@ -8386,7 +8399,7 @@ pidgin_blist_update_sort_methods(void) } g_string_append(ui_string, ""); purple_debug_info("BList", "BList sort is %s\n", ui_string->str); - gtkblist->sort_methods_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string->str, -1, NULL); + sort_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string->str, -1, NULL); gtk_ui_manager_insert_action_group(gtkblist->ui, sort_group, 1); if (activeaction) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(activeaction), TRUE); diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index 4c65deec21..0c5b0ad723 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -84,10 +84,6 @@ struct _PidginBuddyList { #if GTK_CHECK_VERSION(2,4,0) GtkUIManager *ui; - /* Hmm, can I put these here? */ - guint plugins_merge_id; - guint accounts_merge_id; - guint sort_methods_merge_id; #else GtkItemFactory *ift; #endif -- cgit v1.2.1 From df7da708b0afc1cd3dc54f36ce653500b4d1dc05 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 00:53:15 +0000 Subject: Get BList sort methods actually working, and clean up the warnings that were caused by those code changes. --- pidgin/gtkblist.c | 67 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 8d018f5716..f5d4d1a80f 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3573,7 +3573,7 @@ static const char *blist_menu = "" "" "" - "" + "" "" "" "" @@ -8345,6 +8345,21 @@ pidgin_blist_update_plugin_actions(void) #endif } +#if GTK_CHECK_VERSION(2,4,0) +static void +sortmethod_act(GtkRadioAction *action, GtkRadioAction *current, char *id) +{ + if (action == current) + { + pidgin_set_cursor(gtkblist->window, GDK_WATCH); + /* This is redundant. I think. */ + /* pidgin_blist_sort_method_set(id); */ + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/sort_type", id); + + pidgin_clear_cursor(gtkblist->window); + } +} +#else static void sortmethod_act(GtkCheckMenuItem *checkmenuitem, char *id) { @@ -8358,21 +8373,18 @@ sortmethod_act(GtkCheckMenuItem *checkmenuitem, char *id) pidgin_clear_cursor(gtkblist->window); } } +#endif void pidgin_blist_update_sort_methods(void) { - GtkWidget *menuitem = NULL, *activeitem = NULL; PidginBlistSortMethod *method = NULL; GList *l; GSList *sl = NULL; - GtkWidget *sortmenu; const char *m = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/sort_type"); #if GTK_CHECK_VERSION(2,4,0) - GtkActionGroup *sort_group; - GtkAction *activeaction = NULL; - GtkAction *action; + GtkRadioAction *action; GString *ui_string; if ((gtkblist == NULL) || (gtkblist->ui == NULL)) @@ -8380,30 +8392,47 @@ pidgin_blist_update_sort_methods(void) /* Clear the old menu */ gtk_ui_manager_remove_ui(gtkblist->ui, sort_merge_id); + gtk_ui_manager_remove_action_group(gtkblist->ui, sort_action_group); + + sort_action_group = gtk_action_group_new("SortMethods"); +#ifdef ENABLE_NLS + gtk_action_group_set_translation_domain(sort_action_group, PACKAGE); +#endif + ui_string = g_string_new("" + ""); - sort_group = gtk_action_group_new("SortMethods"); - ui_string = g_string_new(""); for (l = pidgin_blist_sort_methods; l; l = l->next) { method = (PidginBlistSortMethod *)l->data; + + g_string_append_printf(ui_string, "", method->id); action = gtk_radio_action_new(method->id, - _(method->name), + method->name, NULL, NULL, 0); - gtk_action_group_add_action_with_accel(sort_group, action, NULL); + gtk_action_group_add_action_with_accel(sort_action_group, GTK_ACTION(action), NULL); + + gtk_radio_action_set_group(action, sl); + sl = gtk_radio_action_get_group(action); + if (!strcmp(m, method->id)) - activeaction = action; - g_signal_connect(G_OBJECT(action), "activate", - G_CALLBACK(sortmethod_act), method->id); - g_string_append_printf(ui_string, "", method->id); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE); + else + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), FALSE); + + g_signal_connect(G_OBJECT(action), "changed", + G_CALLBACK(sortmethod_act), method->id); } - g_string_append(ui_string, ""); - purple_debug_info("BList", "BList sort is %s\n", ui_string->str); + + g_string_append(ui_string, ""); + gtk_ui_manager_insert_action_group(gtkblist->ui, sort_action_group, 1); sort_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string->str, -1, NULL); - gtk_ui_manager_insert_action_group(gtkblist->ui, sort_group, 1); - if (activeaction) - gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(activeaction), TRUE); + + g_string_free(ui_string, TRUE); #else + GtkWidget *menuitem = NULL, *activeitem = NULL; + GtkWidget *sortmenu; + if ((gtkblist == NULL) || (gtkblist->ift == NULL)) return; -- cgit v1.2.1 From f35cc8e04f71c17e6d773333d00ecd0844110434 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 01:33:55 +0000 Subject: Sort of get the accounts menu working again. Except UI manager insists on adding mnemonics, and merging seems to unwind the order of the menus. --- pidgin/gtkblist.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 149 insertions(+), 7 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index f5d4d1a80f..df0bfbba40 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -129,8 +129,9 @@ typedef struct #if GTK_CHECK_VERSION(2,4,0) static guint accounts_merge_id; static GtkActionGroup *accounts_action_group = NULL; -#endif +#else static GtkWidget *accountmenu = NULL; +#endif static guint visibility_manager_count = 0; static GdkVisibilityState gtk_blist_visibility = GDK_VISIBILITY_UNOBSCURED; @@ -3524,6 +3525,7 @@ static const GtkActionEntry blist_menu_entries[] = { /* Accounts menu */ { "AccountsMenu", NULL, N_("_Accounts"), NULL, NULL, NULL }, { "ManageAccounts", NULL, N_("Manage Accounts"), "A", NULL, pidgin_accounts_window_show }, + { "EnableAccountMenu", NULL, N_("Enable Account"), NULL, NULL, NULL }, /* Tools */ { "ToolsMenu", NULL, N_("_Tools"), NULL, NULL, NULL }, @@ -3583,6 +3585,8 @@ static const char *blist_menu = "" "" "" + "" + "" "" "" "" @@ -5928,8 +5932,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtk_widget_show(gtkblist->menutray); gtk_widget_show(menu); gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), menu, FALSE, FALSE, 0); - - accountmenu = gtk_ui_manager_get_widget(gtkblist->ui, "/BList/AccountsMenu"); #else accel_group = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group); @@ -7079,7 +7081,9 @@ static void pidgin_blist_destroy(PurpleBuddyList *list) g_free(priv); g_free(gtkblist); +#if !GTK_CHECK_VERSION(2,4,0) accountmenu = NULL; +#endif gtkblist = NULL; purple_prefs_disconnect_by_handle(pidgin_blist_get_handle()); } @@ -8083,6 +8087,45 @@ plugin_act(GtkObject *obj, PurplePluginAction *pam) pam->callback(pam); } +#if GTK_CHECK_VERSION(2,4,0) +static void +build_plugin_actions(GtkActionGroup *action_group, GString *ui, int parent, + PurplePlugin *plugin, gpointer context) +{ + GtkAction *menuaction; + PurplePluginAction *action = NULL; + GList *actions, *l; + char *name; + int count = 0; + + actions = PURPLE_PLUGIN_ACTIONS(plugin, context); + + for (l = actions; l != NULL; l = l->next) { + if (l->data) { + action = (PurplePluginAction *)l->data; + action->plugin = plugin; + action->context = context; + + name = g_strdup_printf("plugin-%d-action-%d", parent, count++); + menuaction = gtk_action_new(name, action->label, NULL, NULL); + gtk_action_group_add_action(action_group, menuaction); + g_string_append_printf(ui, "", name); + + g_signal_connect(G_OBJECT(menuaction), "activate", + G_CALLBACK(plugin_act), action); + g_object_set_data_full(G_OBJECT(menuaction), "plugin_action", + action, + (GDestroyNotify)purple_plugin_action_free); + g_free(name); + } + else + g_string_append(ui, ""); + } + + g_list_free(actions); +} + +#else static void build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin, gpointer context) @@ -8117,6 +8160,7 @@ build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin, g_list_free(actions); } +#endif static void modify_account_cb(GtkWidget *widget, gpointer data) @@ -8147,18 +8191,116 @@ disable_account_cb(GtkCheckMenuItem *widget, gpointer data) void pidgin_blist_update_accounts_menu(void) { + GList *accounts = NULL; + +#if GTK_CHECK_VERSION(2,4,0) + GtkAction *action; + GString *accounts_ui; + GString *enable_ui; + gchar *ui_string; + int count = 0; + + if ((gtkblist == NULL) || (gtkblist->ui == NULL)) + return; + + /* Clear the old menu */ + gtk_ui_manager_remove_ui(gtkblist->ui, accounts_merge_id); + gtk_ui_manager_remove_action_group(gtkblist->ui, accounts_action_group); + g_object_unref(G_OBJECT(accounts_action_group)); + + accounts_action_group = gtk_action_group_new("Accounts"); +#ifdef ENABLE_NLS + gtk_action_group_set_translation_domain(accounts_action_group, PACKAGE); +#endif + accounts_ui = g_string_new(NULL); + enable_ui = g_string_new(NULL); + + action = gtk_action_new("none-available", N_("No actions available"), NULL, NULL); + gtk_action_group_add_action(accounts_action_group, action); + gtk_action_set_sensitive(action, FALSE); + + for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) { + char *label; + char *name; + PurpleAccount *account = NULL; + + account = accounts->data; + + name = g_strdup_printf("account%d", count); + label = g_strconcat(purple_account_get_username(account), " (", + purple_account_get_protocol_name(account), ")", NULL); + action = gtk_action_new(name, label, NULL, NULL); + g_free(label); + gtk_action_group_add_action(accounts_action_group, action); + + if (!purple_account_get_enabled(account, PIDGIN_UI)) { + g_string_append_printf(enable_ui, "", name); + g_signal_connect(G_OBJECT(action), "activate", + G_CALLBACK(enable_account_cb), account); + g_free(name); + + } else { + PurpleConnection *gc = NULL; + PurplePlugin *plugin = NULL; + + g_string_append_printf(accounts_ui, "", name); + g_free(name); + + name = g_strdup_printf("account%d-edit", count); + action = gtk_action_new(name, N_("_Edit Account"), NULL, NULL); + gtk_action_group_add_action(accounts_action_group, action); + g_signal_connect(G_OBJECT(action), "activate", + G_CALLBACK(modify_account_cb), account); + g_string_append_printf(accounts_ui, "", name); + g_free(name); + + g_string_append(accounts_ui, ""); + + gc = purple_account_get_connection(account); + plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; + if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { + build_plugin_actions(accounts_action_group, accounts_ui, count, plugin, gc); + } else { + g_string_append(accounts_ui, ""); + } + + g_string_append(accounts_ui, ""); + + name = g_strdup_printf("account%d-disable", count); + action = gtk_action_new(name, N_("_Disable"), NULL, NULL); + gtk_action_group_add_action(accounts_action_group, action); + g_signal_connect(G_OBJECT(action), "activate", + G_CALLBACK(disable_account_cb), account); + g_string_append_printf(accounts_ui, "", name); + g_free(name); + + g_string_append(accounts_ui, ""); + } + count++; + } + + ui_string = g_strconcat("", + enable_ui->str, + "", + accounts_ui->str, + "", + NULL); + gtk_ui_manager_insert_action_group(gtkblist->ui, accounts_action_group, 1); + accounts_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string, -1, NULL); +purple_debug_info("blist", "The account menu is {%s}\n", ui_string); + g_string_free(enable_ui, TRUE); + g_string_free(accounts_ui, TRUE); + g_free(ui_string); +#else GtkWidget *menuitem = NULL, *submenu = NULL; + GList *l = NULL; GtkAccelGroup *accel_group = NULL; - GList *l = NULL, *accounts = NULL; gboolean disabled_accounts = FALSE; gboolean enabled_accounts = FALSE; if (accountmenu == NULL) return; -#if GTK_CHECK_VERSION(2,4,0) -/* TODO: Update Accounts... */ -#else /* Clear the old Accounts menu */ for (l = gtk_container_get_children(GTK_CONTAINER(accountmenu)); l; l = g_list_delete_link(l, l)) { menuitem = l->data; -- cgit v1.2.1 From 37f3eaa2794649bfb53a4ebb445425f5e69b7dfd Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 01:50:42 +0000 Subject: Re-enable the plugin sub-menus. Even though it's similar to the accounts code, it seems to work correctly, so there must be some other bug there. --- pidgin/gtkblist.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index df0bfbba40..ae863a6a88 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -8436,14 +8436,66 @@ static GList *plugin_submenus = NULL; void pidgin_blist_update_plugin_actions(void) { - GtkWidget *menuitem, *submenu; PurplePlugin *plugin = NULL; GList *l; - GtkAccelGroup *accel_group; #if GTK_CHECK_VERSION(2,4,0) -/* TODO: Update Plugin */ + GtkAction *action; + GString *plugins_ui; + gchar *ui_string; + int count = 0; + + if ((gtkblist == NULL) || (gtkblist->ui == NULL)) + return; + + /* Clear the old menu */ + gtk_ui_manager_remove_ui(gtkblist->ui, plugins_merge_id); + gtk_ui_manager_remove_action_group(gtkblist->ui, plugins_action_group); + g_object_unref(G_OBJECT(plugins_action_group)); + + plugins_action_group = gtk_action_group_new("Accounts"); +#ifdef ENABLE_NLS + gtk_action_group_set_translation_domain(plugins_action_group, PACKAGE); +#endif + plugins_ui = g_string_new(NULL); + + /* Add a submenu for each plugin with custom actions */ + for (l = purple_plugins_get_loaded(); l; l = l->next) { + char *name; + + plugin = (PurplePlugin *)l->data; + + if (PURPLE_IS_PROTOCOL_PLUGIN(plugin)) + continue; + + if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin)) + continue; + + name = g_strdup_printf("plugin%d", count); + action = gtk_action_new(name, plugin->info->name, NULL, NULL); + gtk_action_group_add_action(plugins_action_group, action); + g_string_append_printf(plugins_ui, "", name); + g_free(name); + + build_plugin_actions(plugins_action_group, plugins_ui, count, plugin, NULL); + + g_string_append(plugins_ui, ""); + count++; + } + + ui_string = g_strconcat("", + plugins_ui->str, + "", + NULL); + gtk_ui_manager_insert_action_group(gtkblist->ui, plugins_action_group, 1); + plugins_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string, -1, NULL); +purple_debug_info("blist", "The plugins menu is {%s}\n", ui_string); + + g_string_free(plugins_ui, TRUE); + g_free(ui_string); #else + GtkWidget *menuitem, *submenu; + GtkAccelGroup *accel_group; GtkWidget *pluginmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools")); g_return_if_fail(pluginmenu != NULL); -- cgit v1.2.1 From 62bcadff8691ab7e92001b12d243b059ad82eb33 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 01:52:46 +0000 Subject: Cleanup things in a slightly less (non-fatal) error-producing way. --- pidgin/gtkblist.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index ae863a6a88..baa3264fe4 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -8204,9 +8204,11 @@ pidgin_blist_update_accounts_menu(void) return; /* Clear the old menu */ - gtk_ui_manager_remove_ui(gtkblist->ui, accounts_merge_id); - gtk_ui_manager_remove_action_group(gtkblist->ui, accounts_action_group); - g_object_unref(G_OBJECT(accounts_action_group)); + if (accounts_action_group) { + gtk_ui_manager_remove_ui(gtkblist->ui, accounts_merge_id); + gtk_ui_manager_remove_action_group(gtkblist->ui, accounts_action_group); + g_object_unref(G_OBJECT(accounts_action_group)); + } accounts_action_group = gtk_action_group_new("Accounts"); #ifdef ENABLE_NLS @@ -8449,9 +8451,11 @@ pidgin_blist_update_plugin_actions(void) return; /* Clear the old menu */ - gtk_ui_manager_remove_ui(gtkblist->ui, plugins_merge_id); - gtk_ui_manager_remove_action_group(gtkblist->ui, plugins_action_group); - g_object_unref(G_OBJECT(plugins_action_group)); + if (plugins_action_group) { + gtk_ui_manager_remove_ui(gtkblist->ui, plugins_merge_id); + gtk_ui_manager_remove_action_group(gtkblist->ui, plugins_action_group); + g_object_unref(G_OBJECT(plugins_action_group)); + } plugins_action_group = gtk_action_group_new("Accounts"); #ifdef ENABLE_NLS @@ -8585,8 +8589,11 @@ pidgin_blist_update_sort_methods(void) return; /* Clear the old menu */ - gtk_ui_manager_remove_ui(gtkblist->ui, sort_merge_id); - gtk_ui_manager_remove_action_group(gtkblist->ui, sort_action_group); + if (sort_action_group) { + gtk_ui_manager_remove_ui(gtkblist->ui, sort_merge_id); + gtk_ui_manager_remove_action_group(gtkblist->ui, sort_action_group); + g_object_unref(G_OBJECT(sort_action_group)); + } sort_action_group = gtk_action_group_new("SortMethods"); #ifdef ENABLE_NLS -- cgit v1.2.1 From 7c5832614a31d05401a90c509624c1052f282a9b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 02:41:18 +0000 Subject: Get rid of the remaining warnings in gtkblist.c. --- pidgin/gtkblist.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index baa3264fe4..0606251aaf 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -163,7 +163,9 @@ static void pidgin_blist_update(PurpleBuddyList *list, PurpleBlistNode *node); static void pidgin_blist_update_group(PurpleBuddyList *list, PurpleBlistNode *node); static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode *node); static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full); +#if !GTK_CHECK_VERSION(2,4,0) static const char *item_factory_translate_func (const char *path, gpointer func_data); +#endif static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter); static gboolean buddy_is_displayable(PurpleBuddy *buddy); static void redo_buddy_list(PurpleBuddyList *list, gboolean remove, gboolean rerender); @@ -3535,7 +3537,7 @@ static const GtkActionEntry blist_menu_entries[] = { { "Plugins", PIDGIN_STOCK_TOOLBAR_PLUGINS, N_("Plu_gins"), "U", NULL, pidgin_plugin_dialog_show }, { "Preferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), "P", NULL, pidgin_prefs_show }, { "Privacy", NULL, N_("Pr_ivacy"), NULL, NULL, pidgin_privacy_dialog_show }, - { "FileTransfers", PIDGIN_STOCK_TOOLBAR_TRANSFER, N_("_File Transfers"), "T", NULL, gtk_blist_show_xfer_dialog_cb }, + { "FileTransfers", PIDGIN_STOCK_TOOLBAR_TRANSFER, N_("_File Transfers"), "T", NULL, G_CALLBACK(gtk_blist_show_xfer_dialog_cb) }, { "RoomList", NULL, N_("R_oom List"), NULL, NULL, pidgin_roomlist_dialog_show }, { "SystemLog", NULL, N_("System _Log"), NULL, NULL, gtk_blist_show_systemlog_cb }, @@ -3549,14 +3551,14 @@ static const GtkActionEntry blist_menu_entries[] = { /* Toggle items */ static const GtkToggleActionEntry blist_menu_toggle_entries[] = { /* Buddies->Show menu */ - { "ShowOffline", NULL, N_("_Offline Buddies"), NULL, NULL, pidgin_blist_edit_mode_cb, FALSE }, - { "ShowEmptyGroups", NULL, N_("_Empty Groups"), NULL, NULL, pidgin_blist_show_empty_groups_cb, FALSE }, - { "ShowBuddyDetails", NULL, N_("Buddy _Details"), NULL, NULL, pidgin_blist_buddy_details_cb, FALSE }, - { "ShowIdleTimes", NULL, N_("Idle _Times"), NULL, NULL, pidgin_blist_show_idle_time_cb, FALSE }, - { "ShowProtocolIcons", NULL, N_("_Protocol Icons"), NULL, NULL, pidgin_blist_show_protocol_icons_cb, FALSE }, + { "ShowOffline", NULL, N_("_Offline Buddies"), NULL, NULL, G_CALLBACK(pidgin_blist_edit_mode_cb), FALSE }, + { "ShowEmptyGroups", NULL, N_("_Empty Groups"), NULL, NULL, G_CALLBACK(pidgin_blist_show_empty_groups_cb), FALSE }, + { "ShowBuddyDetails", NULL, N_("Buddy _Details"), NULL, NULL, G_CALLBACK(pidgin_blist_buddy_details_cb), FALSE }, + { "ShowIdleTimes", NULL, N_("Idle _Times"), NULL, NULL, G_CALLBACK(pidgin_blist_show_idle_time_cb), FALSE }, + { "ShowProtocolIcons", NULL, N_("_Protocol Icons"), NULL, NULL, G_CALLBACK(pidgin_blist_show_protocol_icons_cb), FALSE }, /* Tools menu */ - { "MuteSounds", NULL, N_("Mute _Sounds"), NULL, NULL, pidgin_blist_mute_sounds_cb, FALSE }, + { "MuteSounds", NULL, N_("Mute _Sounds"), NULL, NULL, G_CALLBACK(pidgin_blist_mute_sounds_cb), FALSE }, }; static const char *blist_menu = -- cgit v1.2.1 From 8a0f7e2bce2208060a5feff7ba048542c5866799 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 02:48:40 +0000 Subject: Don't get account and plugin actions confused by using the same action name for both of them. --- pidgin/gtkblist.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 0606251aaf..a08e84db33 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -8091,7 +8091,7 @@ plugin_act(GtkObject *obj, PurplePluginAction *pam) #if GTK_CHECK_VERSION(2,4,0) static void -build_plugin_actions(GtkActionGroup *action_group, GString *ui, int parent, +build_plugin_actions(GtkActionGroup *action_group, GString *ui, char *parent, PurplePlugin *plugin, gpointer context) { GtkAction *menuaction; @@ -8108,7 +8108,7 @@ build_plugin_actions(GtkActionGroup *action_group, GString *ui, int parent, action->plugin = plugin; action->context = context; - name = g_strdup_printf("plugin-%d-action-%d", parent, count++); + name = g_strdup_printf("%s-action-%d", parent, count++); menuaction = gtk_action_new(name, action->label, NULL, NULL); gtk_action_group_add_action(action_group, menuaction); g_string_append_printf(ui, "", name); @@ -8263,7 +8263,9 @@ pidgin_blist_update_accounts_menu(void) gc = purple_account_get_connection(account); plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { - build_plugin_actions(accounts_action_group, accounts_ui, count, plugin, gc); + name = g_strdup_printf("account%d", count); + build_plugin_actions(accounts_action_group, accounts_ui, name, plugin, gc); + g_free(name); } else { g_string_append(accounts_ui, ""); } @@ -8481,12 +8483,13 @@ pidgin_blist_update_plugin_actions(void) action = gtk_action_new(name, plugin->info->name, NULL, NULL); gtk_action_group_add_action(plugins_action_group, action); g_string_append_printf(plugins_ui, "", name); - g_free(name); - build_plugin_actions(plugins_action_group, plugins_ui, count, plugin, NULL); + build_plugin_actions(plugins_action_group, plugins_ui, name, plugin, NULL); g_string_append(plugins_ui, ""); count++; + + g_free(name); } ui_string = g_strconcat("", -- cgit v1.2.1 From 3ee3f0beadcc0ff3ac0f3afd0086d0ae4c894e7f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 03:02:29 +0000 Subject: Try to reduce the printf'ing a little in the account menu creation. --- pidgin/gtkblist.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index a08e84db33..2ca1cc4eb6 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -8225,12 +8225,13 @@ pidgin_blist_update_accounts_menu(void) for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) { char *label; + char *base; char *name; PurpleAccount *account = NULL; account = accounts->data; - name = g_strdup_printf("account%d", count); + base = name = g_strdup_printf("account%d", count); label = g_strconcat(purple_account_get_username(account), " (", purple_account_get_protocol_name(account), ")", NULL); action = gtk_action_new(name, label, NULL, NULL); @@ -8241,16 +8242,14 @@ pidgin_blist_update_accounts_menu(void) g_string_append_printf(enable_ui, "", name); g_signal_connect(G_OBJECT(action), "activate", G_CALLBACK(enable_account_cb), account); - g_free(name); } else { PurpleConnection *gc = NULL; PurplePlugin *plugin = NULL; g_string_append_printf(accounts_ui, "", name); - g_free(name); - name = g_strdup_printf("account%d-edit", count); + name = g_strconcat(base, "-edit", NULL); action = gtk_action_new(name, N_("_Edit Account"), NULL, NULL); gtk_action_group_add_action(accounts_action_group, action); g_signal_connect(G_OBJECT(action), "activate", @@ -8263,16 +8262,14 @@ pidgin_blist_update_accounts_menu(void) gc = purple_account_get_connection(account); plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { - name = g_strdup_printf("account%d", count); - build_plugin_actions(accounts_action_group, accounts_ui, name, plugin, gc); - g_free(name); + build_plugin_actions(accounts_action_group, accounts_ui, base, plugin, gc); } else { g_string_append(accounts_ui, ""); } g_string_append(accounts_ui, ""); - name = g_strdup_printf("account%d-disable", count); + name = g_strconcat(base, "-disable", NULL); action = gtk_action_new(name, N_("_Disable"), NULL, NULL); gtk_action_group_add_action(accounts_action_group, action); g_signal_connect(G_OBJECT(action), "activate", @@ -8282,6 +8279,8 @@ pidgin_blist_update_accounts_menu(void) g_string_append(accounts_ui, ""); } + + g_free(base); count++; } @@ -8294,6 +8293,7 @@ pidgin_blist_update_accounts_menu(void) gtk_ui_manager_insert_action_group(gtkblist->ui, accounts_action_group, 1); accounts_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string, -1, NULL); purple_debug_info("blist", "The account menu is {%s}\n", ui_string); + g_string_free(enable_ui, TRUE); g_string_free(accounts_ui, TRUE); g_free(ui_string); -- cgit v1.2.1 From 1932b3cd933825c91df0fe419b26447455bbd528 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 03:43:45 +0000 Subject: Fix the Pause button in the debug window. --- pidgin/gtkdebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index 97d38fe48d..d851eff65d 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -818,7 +818,7 @@ debug_window_new(void) /* Pause */ #if GTK_CHECK_VERSION(2,4,0) - item = gtk_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE); + item = gtk_toggle_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE); #if GTK_CHECK_VERSION(2,12,0) gtk_tool_item_set_tooltip_text(item, _("Pause")); #else -- cgit v1.2.1 From d0d65a2276cc7f88003dfef276ec7cdb58ac7984 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 04:30:58 +0000 Subject: Start converting the conversation window to UI manager. The auto-generated parts are not done yet. --- pidgin/gtkconv.c | 350 +++++++++++++++++++++++++++++++++++++++++++++++++++- pidgin/gtkconvwin.h | 4 + 2 files changed, 353 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 22fcd3bd01..a9b17e7025 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -160,7 +160,9 @@ static void conv_set_unseen(PurpleConversation *gtkconv, PidginUnseenState state static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state); static void update_typing_icon(PidginConversation *gtkconv); static void update_typing_message(PidginConversation *gtkconv, const char *message); +#if !GTK_CHECK_VERSION(2,4,0) static const char *item_factory_translate_func (const char *path, gpointer func_data); +#endif gboolean pidgin_conv_has_focus(PurpleConversation *conv); static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background); static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast); @@ -953,7 +955,11 @@ invite_cb(GtkWidget *widget, PidginConversation *gtkconv) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_new_conv_cb(GtkAction *action, gpointer data) +#else menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) +#endif { pidgin_dialogs_im(); } @@ -994,7 +1000,11 @@ savelog_writefile_cb(void *user_data, const char *filename) * plaintext v. HTML file. */ static void +#if GTK_CHECK_VERSION(2,4,0) +menu_save_as_cb(GtkAction *action, gpointer data) +#else menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); @@ -1024,7 +1034,11 @@ menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_view_log_cb(GtkAction *action, gpointer data) +#else menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1052,7 +1066,7 @@ menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) gdk_window_set_cursor(win->window->window, cursor); gdk_cursor_unref(cursor); #if GTK_CHECK_VERSION(2,4,0) - gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); +//FIXME: gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); #else gdk_flush(); #endif @@ -1082,7 +1096,11 @@ menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_clear_cb(GtkAction *action, gpointer data) +#else menu_clear_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1143,7 +1161,11 @@ static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_find_cb(GtkAction *action, gpointer data) +#else menu_find_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *gtkwin = data; GtkWidget *hbox; @@ -1203,12 +1225,17 @@ menu_find_cb(gpointer data, guint action, GtkWidget *widget) #ifdef USE_VV static void +#if GTK_CHECK_VERSION(2,4,0) +menu_initiate_media_call_cb(GtkAction *action, gpointer data) +#else menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = (PidginWindow *)data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); PurpleAccount *account = purple_conversation_get_account(conv); + /* FIXME: action is not an int... */ purple_prpl_initiate_media(account, purple_conversation_get_name(conv), action == 0 ? PURPLE_MEDIA_AUDIO : @@ -1219,7 +1246,11 @@ menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget) #endif static void +#if GTK_CHECK_VERSION(2,4,0) +menu_send_file_cb(GtkAction *action, gpointer data) +#else menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); @@ -1231,7 +1262,11 @@ menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_add_pounce_cb(GtkAction *action, gpointer data) +#else menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1243,7 +1278,11 @@ menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_insert_link_cb(GtkAction *action, gpointer data) +#else menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PidginConversation *gtkconv; @@ -1257,7 +1296,11 @@ menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_insert_image_cb(GtkAction *action, gpointer data) +#else menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1274,7 +1317,11 @@ menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) static void +#if GTK_CHECK_VERSION(2,4,0) +menu_alias_cb(GtkAction *action, gpointer data) +#else menu_alias_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1301,7 +1348,11 @@ menu_alias_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_get_info_cb(GtkAction *action, gpointer data) +#else menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1312,7 +1363,11 @@ menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_invite_cb(GtkAction *action, gpointer data) +#else menu_invite_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1323,7 +1378,11 @@ menu_invite_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_block_cb(GtkAction *action, gpointer data) +#else menu_block_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1334,7 +1393,11 @@ menu_block_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_unblock_cb(GtkAction *action, gpointer data) +#else menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1345,7 +1408,11 @@ menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_add_remove_cb(GtkAction *action, gpointer data) +#else menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1390,7 +1457,11 @@ hide_conv(PidginConversation *gtkconv, gboolean closetimer) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_close_conv_cb(GtkAction *action, gpointer data) +#else menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; @@ -1398,7 +1469,11 @@ menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_logging_cb(GtkAction *action, gpointer data) +#else menu_logging_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1410,7 +1485,11 @@ menu_logging_cb(gpointer data, guint action, GtkWidget *widget) if (conv == NULL) return; +#if GTK_CHECK_VERSION(2,4,0) + logging = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); +#else logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); +#endif if (logging == purple_conversation_is_logging(conv)) return; @@ -1463,14 +1542,26 @@ menu_logging_cb(gpointer data, guint action, GtkWidget *widget) } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_toolbar_cb(GtkAction *action, gpointer data) +{ + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", + gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); +} +#else menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) { purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); } +#endif static void +#if GTK_CHECK_VERSION(2,4,0) +menu_sounds_cb(GtkAction *action, gpointer data) +#else menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) +#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1485,18 +1576,30 @@ menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) gtkconv = PIDGIN_CONVERSATION(conv); gtkconv->make_sound = +#if GTK_CHECK_VERSION(2,4,0) + gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); +#else gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); +#endif node = get_conversation_blist_node(conv); if (node) purple_blist_node_set_bool(node, "gtk-mute-sound", !gtkconv->make_sound); } static void +#if GTK_CHECK_VERSION(2,4,0) +menu_timestamps_cb(GtkAction *action, gpointer data) +{ + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", + gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); +} +#else menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) { purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); } +#endif static void chat_do_im(PidginConversation *gtkconv, const char *who) @@ -3126,6 +3229,99 @@ pidgin_conv_get_window(PidginConversation *gtkconv) return gtkconv->win; } +#if GTK_CHECK_VERSION(2,4,0) + +static GtkActionEntry menu_entries[] = +/* TODO: fill out tooltips... */ +{ + /* Conversation menu */ + { "ConversationMenu", NULL, N_("_Conversation"), NULL, NULL, NULL }, + { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "M", NULL, menu_new_conv_cb }, + { "Find", GTK_STOCK_FIND, N_("_Find..."), NULL, NULL, menu_find_cb }, + { "ViewLog", NULL, N_("View _Log"), NULL, NULL, menu_view_log_cb }, + { "SaveAs", GTK_STOCK_SAVE_AS, N_("_Save As..."), NULL, NULL, menu_save_as_cb }, + { "ClearScrollback", GTK_STOCK_CLEAR, N_("Clea_r Scrollback"), "L", NULL, menu_clear_cb }, + +#ifdef USE_VV + { "MediaMenu", NULL, N_("M_edia"), NULL, NULL, NULL }, + { "AudioCall", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, N_("_Audio Call"), NULL, NULL, menu_initiate_media_call_cb }, + { "VideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("_Video Call"), NULL, NULL, menu_initiate_media_call_cb }, + { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio\\/Video _Call"), NULL, NULL, menu_initiate_media_call_cb }, +#endif + + { "SendFile", PIDGIN_STOCK_TOOLBAR_SEND_FILE, N_("Se_nd File..."), NULL, NULL, menu_send_file_cb }, + { "AddBuddyPounce", NULL, N_("Add Buddy _Pounce..."), NULL, NULL, menu_add_pounce_cb }, + { "GetInfo", PIDGIN_STOCK_TOOLBAR_USER_INFO, N_("_Get Info"), "O", NULL, menu_get_info_cb }, + { "Invite", NULL, N_("In_vite..."), NULL, NULL, menu_invite_cb }, + { "MoreMenu", NULL, N_("M_ore"), NULL, NULL, NULL }, + { "Alias", NULL, N_("Al_ias..."), NULL, NULL, menu_alias_cb }, + { "Block", PIDGIN_STOCK_TOOLBAR_BLOCK, N_("_Block..."), NULL, NULL, menu_block_cb }, + { "Unblock", PIDGIN_STOCK_TOOLBAR_UNBLOCK, N_("_Unblock..."), NULL, NULL, menu_unblock_cb }, + { "Add", GTK_STOCK_ADD, N_("_Add..."), NULL, NULL, menu_add_remove_cb }, + { "Remove", GTK_STOCK_REMOVE, N_("_Remove..."), NULL, NULL, menu_add_remove_cb }, + { "InsertLink", PIDGIN_STOCK_TOOLBAR_INSERT_LINK, N_("Insert Lin_k..."), NULL, NULL, menu_insert_link_cb }, + { "InsertImage", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, N_("Insert Imag_e..."), NULL, NULL, menu_insert_image_cb }, + { "Close", GTK_STOCK_CLOSE, N_("_Close"), NULL, NULL, menu_close_conv_cb }, + + /* Options */ + { "OptionsMenu", NULL, N_("_Options"), NULL, NULL, NULL }, +}; + +/* Toggle items */ +static const GtkToggleActionEntry menu_toggle_entries[] = { + { "EnableLogging", NULL, N_("Enable _Logging"), NULL, NULL, menu_logging_cb, FALSE }, + { "EnableSounds", NULL, N_("Enable _Sounds"), NULL, NULL, menu_sounds_cb, FALSE }, + { "ShowFormattingToolbars", NULL, N_("Show Formatting _Toolbars"), NULL, NULL, menu_toolbar_cb, FALSE }, + { "ShowTimestamps", NULL, N_("Show Ti_mestamps"), NULL, NULL, menu_timestamps_cb, FALSE }, +}; + +static const char *conversation_menu = +"" + "" + "" + "" + "" + "" + "" + "" + "" + "" +#ifdef USE_VV + "" + "" + "" + "" + "" +#endif + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" +""; + +#else + static GtkItemFactoryEntry menu_items[] = { /* Conversation menu */ @@ -3209,6 +3405,8 @@ item_factory_translate_func (const char *path, gpointer func_data) return _(path); } +#endif + static void sound_method_pref_changed_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data) @@ -3328,6 +3526,8 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea static void regenerate_options_items(PidginWindow *win) { +#if GTK_CHECK_VERSION(2,4,0) +#else GtkWidget *menu; PidginConversation *gtkconv; GList *list; @@ -3351,6 +3551,7 @@ regenerate_options_items(PidginWindow *win) } gtk_widget_show_all(menu); +#endif } static void @@ -3364,6 +3565,8 @@ remove_from_list(GtkWidget *widget, PidginWindow *win) static void regenerate_plugins_items(PidginWindow *win) { +#if GTK_CHECK_VERSION(2,4,0) +#else GList *action_items; GtkWidget *menu; GList *list; @@ -3405,8 +3608,10 @@ regenerate_plugins_items(PidginWindow *win) g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(remove_from_list), win); } g_object_set_data(G_OBJECT(win->window), "plugin-actions", action_items); +#endif } +#if !GTK_CHECK_VERSION(2,4,0) static void menubar_activated(GtkWidget *item, gpointer data) { PidginWindow *win = data; @@ -3429,12 +3634,146 @@ focus_out_from_menubar(GtkWidget *wid, PidginWindow *win) g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar), G_CALLBACK(focus_out_from_menubar), win); } +#endif static GtkWidget * setup_menubar(PidginWindow *win) { GtkAccelGroup *accel_group; const char *method; + +#if GTK_CHECK_VERSION(2,4,0) + GtkActionGroup *action_group; + GError *error; + + action_group = gtk_action_group_new("ConversationActions"); + gtk_action_group_add_actions(action_group, + menu_entries, + G_N_ELEMENTS(menu_entries), + win); + gtk_action_group_add_toggle_actions(action_group, + menu_toggle_entries, + G_N_ELEMENTS(menu_toggle_entries), + win); +#ifdef ENABLE_NLS + gtk_action_group_set_translation_domain(action_group, + PACKAGE); +#endif + + win->menu.ui = gtk_ui_manager_new(); + gtk_ui_manager_insert_action_group(win->menu.ui, action_group, 0); + + accel_group = gtk_ui_manager_get_accel_group(win->menu.ui); + gtk_window_add_accel_group(GTK_WINDOW(win->window), accel_group); + g_signal_connect(G_OBJECT(accel_group), "accel-changed", + G_CALLBACK(pidgin_save_accels_cb), NULL); + + error = NULL; + if (!gtk_ui_manager_add_ui_from_string(win->menu.ui, conversation_menu, -1, &error)) + { + g_message("building menus failed: %s", error->message); + g_error_free(error); + exit(EXIT_FAILURE); + } + + win->menu.menubar = + gtk_ui_manager_get_widget(win->menu.ui, "/Conversation"); + + win->menu.view_log = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/ViewLog"); + +#ifdef USE_VV + win->audio_call = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/MediaMenu/AudioCall"); + win->video_call = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/MediaMenu/VideoCall"); + win->audio_video_call = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/MediaMenu/AudioVideoCall"); +#endif + + /* --- */ + + win->menu.send_file = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/SendFile"); + + win->menu.add_pounce = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/AddBuddyPounce"); + + /* --- */ + + win->menu.get_info = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/GetInfo"); + + win->menu.invite = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/Invite"); + + /* --- */ + + win->menu.alias = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/Alias"); + + win->menu.block = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/Block"); + + win->menu.unblock = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/Unblock"); + + win->menu.add = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/Add"); + + win->menu.remove = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/Remove"); + + /* --- */ + + win->menu.insert_link = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/InsertLink"); + + win->menu.insert_image = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/InsertImage"); + + /* --- */ + + win->menu.logging = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/OptionsMenu/EnableLogging"); + win->menu.sounds = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/OptionsMenu/EnableSounds"); + method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); + if (method != NULL && !strcmp(method, "none")) + { + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), + FALSE); + gtk_widget_set_sensitive(win->menu.sounds, FALSE); + } + purple_prefs_connect_callback(win, PIDGIN_PREFS_ROOT "/sound/method", + sound_method_pref_changed_cb, win); + + win->menu.show_formatting_toolbar = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/OptionsMenu/ShowFormattingToolbars"); + win->menu.show_timestamps = + gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/OptionsMenu/ShowTimestamps"); + win->menu.show_icon = NULL; + +#else GtkWidget *menuitem; accel_group = gtk_accel_group_new (); @@ -3556,6 +3895,8 @@ setup_menubar(PidginWindow *win) N_("/Options/Show Timestamps")); win->menu.show_icon = NULL; +#endif + win->menu.tray = pidgin_menu_tray_new(); gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), win->menu.tray); @@ -3869,6 +4210,8 @@ compare_buddy_presence(PurplePresence *p1, PurplePresence *p2) static void generate_send_to_items(PidginWindow *win) { +#if GTK_CHECK_VERSION(2,4,0) +#else GtkWidget *menu; GSList *group = NULL; GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -3953,6 +4296,7 @@ generate_send_to_items(PidginWindow *win) if (!group) gtk_widget_set_sensitive(win->menu.send_to, FALSE); update_send_to_selection(win); +#endif } static const char * @@ -9337,7 +9681,11 @@ pidgin_conv_window_destroy(PidginWindow *win) } gtk_widget_destroy(win->window); +#if GTK_CHECK_VERSION(2,4,0) + g_object_unref(G_OBJECT(win->menu.ui)); +#else g_object_unref(G_OBJECT(win->menu.item_factory)); +#endif purple_notify_close_with_handle(win); purple_signals_disconnect_by_handle(win); diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index 986b1ca28f..35e7776c16 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -76,7 +76,11 @@ struct _PidginWindow GtkWidget *typing_icon; +#if GTK_CHECK_VERSION(2,4,0) + GtkUIManager *ui; +#else GtkItemFactory *item_factory; +#endif } menu; -- cgit v1.2.1 From 83c7ac1d0b82a29aa4171ffb3774b02692f821c9 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 05:28:46 +0000 Subject: Use GtkActions instead of GtkWidgets for the shortcuts to items in the menu on the conversation window for GTK+ 2.6+. I don't think it works properly for 2.4active_conv = conv; +#if GTK_CHECK_VERSION(2,6,0) + purple_conversation_set_logging(conv, + gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(gtkconv->win->menu.logging))); +#else purple_conversation_set_logging(conv, gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging))); +#endif entry = GTK_IMHTML(gtkconv->entry); protocol_name = purple_account_get_protocol_name(conv->account); @@ -3416,19 +3421,31 @@ sound_method_pref_changed_cb(const char *name, PurplePrefType type, if (!strcmp(method, "none")) { +#if GTK_CHECK_VERSION(2,6,0) + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), + FALSE); + gtk_action_set_sensitive(win->menu.sounds, FALSE); +#else gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), FALSE); gtk_widget_set_sensitive(win->menu.sounds, FALSE); +#endif } else { PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win); +#if GTK_CHECK_VERSION(2,6,0) + if (gtkconv != NULL) + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), + gtkconv->make_sound); + gtk_action_set_sensitive(win->menu.sounds, TRUE); +#else if (gtkconv != NULL) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), gtkconv->make_sound); gtk_widget_set_sensitive(win->menu.sounds, TRUE); - +#endif } } @@ -3680,96 +3697,96 @@ setup_menubar(PidginWindow *win) gtk_ui_manager_get_widget(win->menu.ui, "/Conversation"); win->menu.view_log = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/ViewLog"); #ifdef USE_VV win->audio_call = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/MediaMenu/AudioCall"); win->video_call = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/MediaMenu/VideoCall"); win->audio_video_call = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/MediaMenu/AudioVideoCall"); #endif /* --- */ win->menu.send_file = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/SendFile"); win->menu.add_pounce = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/AddBuddyPounce"); /* --- */ win->menu.get_info = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/GetInfo"); win->menu.invite = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/Invite"); /* --- */ win->menu.alias = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/Alias"); win->menu.block = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/Block"); win->menu.unblock = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/Unblock"); win->menu.add = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/Add"); win->menu.remove = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/Remove"); /* --- */ win->menu.insert_link = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/InsertLink"); win->menu.insert_image = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/InsertImage"); /* --- */ win->menu.logging = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/OptionsMenu/EnableLogging"); win->menu.sounds = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/OptionsMenu/EnableSounds"); method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); if (method != NULL && !strcmp(method, "none")) { gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), FALSE); - gtk_widget_set_sensitive(win->menu.sounds, FALSE); + gtk_action_set_sensitive(win->menu.sounds, FALSE); } purple_prefs_connect_callback(win, PIDGIN_PREFS_ROOT "/sound/method", sound_method_pref_changed_cb, win); win->menu.show_formatting_toolbar = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/OptionsMenu/ShowFormattingToolbars"); win->menu.show_timestamps = - gtk_ui_manager_get_widget(win->menu.ui, + gtk_ui_manager_get_action(win->menu.ui, "/Conversation/OptionsMenu/ShowTimestamps"); win->menu.show_icon = NULL; @@ -4078,7 +4095,8 @@ update_send_to_selection(PidginWindow *win) if (!(b = purple_find_buddy(account, conv->name))) return FALSE; - +#if GTK_CHECK_VERSION(2,4,0) +#else gtk_widget_show(win->menu.send_to); menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(win->menu.send_to)); @@ -4100,6 +4118,7 @@ update_send_to_selection(PidginWindow *win) break; } } +#endif return FALSE; } @@ -6707,6 +6726,16 @@ pidgin_conv_send_confirm(PurpleConversation *conv, const char *message) gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), message, 0); } +/* Mask functions with ones from newer GTK+ */ +#if GTK_CHECK_VERSION(2,6,0) +#define gtk_widget_set_sensitive_ gtk_widget_set_sensitive +#define gtk_widget_show_ gtk_widget_show +#define gtk_widget_hide_ gtk_widget_hide +#define gtk_widget_set_sensitive gtk_action_set_sensitive +#define gtk_widget_show(x) gtk_action_set_visible((x), TRUE) +#define gtk_widget_hide(x) gtk_action_set_visible((x), FALSE) +#endif + /* * Makes sure all the menu items and all the buttons are hidden/shown and * sensitive/insensitive. This is called after changing tabs and when an @@ -6941,6 +6970,17 @@ gray_stuff_out(PidginConversation *gtkconv) } } +/* Restore the functions */ +#if GTK_CHECK_VERSION(2,6,0) +#undef gtk_widget_set_sensitive +#undef gtk_widget_show +#undef gtk_widget_hide + +#define gtk_widget_set_sensitive gtk_widget_set_sensitive_ +#define gtk_widget_show gtk_widget_show_ +#define gtk_widget_hide gtk_widget_hide_ +#endif + static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) { @@ -7627,9 +7667,15 @@ show_timestamps_pref_cb(const char *name, PurplePrefType type, gtkconv = PIDGIN_CONVERSATION(conv); win = gtkconv->win; +#if GTK_CHECK_VERSION(2,6,0) + gtk_toggle_action_set_active( + GTK_TOGGLE_ACTION(win->menu.show_timestamps), + (gboolean)GPOINTER_TO_INT(value)); +#else gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), (gboolean)GPOINTER_TO_INT(value)); +#endif gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); @@ -7655,9 +7701,15 @@ show_formatting_toolbar_pref_cb(const char *name, PurplePrefType type, gtkconv = PIDGIN_CONVERSATION(conv); win = gtkconv->win; +#if GTK_CHECK_VERSION(2,6,0) + gtk_toggle_action_set_active( + GTK_TOGGLE_ACTION(win->menu.show_formatting_toolbar), + (gboolean)GPOINTER_TO_INT(value)); +#else gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), (gboolean)GPOINTER_TO_INT(value)); +#endif if ((gboolean)GPOINTER_TO_INT(value)) gtk_widget_show(gtkconv->toolbar); @@ -8886,6 +8938,8 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc /* Right click was pressed. Popup the context menu. */ GtkWidget *menu = gtk_menu_new(), *sub; gboolean populated = populate_menu_with_options(menu, gtkconv, TRUE); +#if GTK_CHECK_VERSION(2,4,0) +#else sub = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to)); if (sub && GTK_WIDGET_IS_SENSITIVE(gtkconv->win->menu.send_to)) { @@ -8900,7 +8954,7 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc gtk_widget_destroy(menu); return FALSE; } - +#endif gtk_widget_show_all(menu); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); return TRUE; @@ -9410,8 +9464,13 @@ switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, /* Update the menubar */ +#if GTK_CHECK_VERSION(2,6,0) + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtkconv->win->menu.logging), + purple_conversation_is_logging(conv)); +#else gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging), purple_conversation_is_logging(conv)); +#endif generate_send_to_items(win); regenerate_options_items(win); @@ -9420,6 +9479,17 @@ switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, pidgin_conv_switch_active_conversation(conv); sound_method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); +#if GTK_CHECK_VERSION(2,6,0) + if (strcmp(sound_method, "none") != 0) + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), + gtkconv->make_sound); + + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.show_formatting_toolbar), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar")); + + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.show_timestamps), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); +#else if (strcmp(sound_method, "none") != 0) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), gtkconv->make_sound); @@ -9429,6 +9499,7 @@ switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); +#endif /* * We pause icons when they are not visible. If this icon should diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index 35e7776c16..e440502302 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -46,8 +46,31 @@ struct _PidginWindow struct { +/* Some necessary functions were only added in 2.6.0 */ GtkWidget *menubar; +#if GTK_CHECK_VERSION(2,6,0) + GtkAction *view_log; + + GtkAction *send_file; + GtkAction *add_pounce; + GtkAction *get_info; + GtkAction *invite; + + GtkAction *alias; + GtkAction *block; + GtkAction *unblock; + GtkAction *add; + GtkAction *remove; + + GtkAction *insert_link; + GtkAction *insert_image; + + GtkAction *logging; + GtkAction *sounds; + GtkAction *show_formatting_toolbar; + GtkAction *show_timestamps; +#else GtkWidget *view_log; GtkWidget *send_file; @@ -68,6 +91,7 @@ struct _PidginWindow GtkWidget *sounds; GtkWidget *show_formatting_toolbar; GtkWidget *show_timestamps; +#endif GtkWidget *show_icon; GtkWidget *send_to; @@ -102,9 +126,15 @@ struct _PidginWindow gint drag_leave_signal; /* Media menu options. */ +#if GTK_CHECK_VERSION(2,4,0) + GtkAction *audio_call; + GtkAction *video_call; + GtkAction *audio_video_call; +#else GtkWidget *audio_call; GtkWidget *video_call; GtkWidget *audio_video_call; +#endif }; /*@}*/ -- cgit v1.2.1 From 018da9b995e2f8cbf28fababc71805ca89829763 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 05:33:03 +0000 Subject: Fix up some simple warnings for the conversation UI. --- pidgin/gtkconv.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index e6b852183d..6eb4a016f7 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3241,32 +3241,32 @@ static GtkActionEntry menu_entries[] = { /* Conversation menu */ { "ConversationMenu", NULL, N_("_Conversation"), NULL, NULL, NULL }, - { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "M", NULL, menu_new_conv_cb }, - { "Find", GTK_STOCK_FIND, N_("_Find..."), NULL, NULL, menu_find_cb }, - { "ViewLog", NULL, N_("View _Log"), NULL, NULL, menu_view_log_cb }, - { "SaveAs", GTK_STOCK_SAVE_AS, N_("_Save As..."), NULL, NULL, menu_save_as_cb }, - { "ClearScrollback", GTK_STOCK_CLEAR, N_("Clea_r Scrollback"), "L", NULL, menu_clear_cb }, + { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "M", NULL, G_CALLBACK(menu_new_conv_cb) }, + { "Find", GTK_STOCK_FIND, N_("_Find..."), NULL, NULL, G_CALLBACK(menu_find_cb) }, + { "ViewLog", NULL, N_("View _Log"), NULL, NULL, G_CALLBACK(menu_view_log_cb) }, + { "SaveAs", GTK_STOCK_SAVE_AS, N_("_Save As..."), NULL, NULL, G_CALLBACK(menu_save_as_cb) }, + { "ClearScrollback", GTK_STOCK_CLEAR, N_("Clea_r Scrollback"), "L", NULL, G_CALLBACK(menu_clear_cb) }, #ifdef USE_VV { "MediaMenu", NULL, N_("M_edia"), NULL, NULL, NULL }, - { "AudioCall", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, N_("_Audio Call"), NULL, NULL, menu_initiate_media_call_cb }, - { "VideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("_Video Call"), NULL, NULL, menu_initiate_media_call_cb }, - { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio\\/Video _Call"), NULL, NULL, menu_initiate_media_call_cb }, + { "AudioCall", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, N_("_Audio Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, + { "VideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("_Video Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, + { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio\\/Video _Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, #endif - { "SendFile", PIDGIN_STOCK_TOOLBAR_SEND_FILE, N_("Se_nd File..."), NULL, NULL, menu_send_file_cb }, - { "AddBuddyPounce", NULL, N_("Add Buddy _Pounce..."), NULL, NULL, menu_add_pounce_cb }, - { "GetInfo", PIDGIN_STOCK_TOOLBAR_USER_INFO, N_("_Get Info"), "O", NULL, menu_get_info_cb }, - { "Invite", NULL, N_("In_vite..."), NULL, NULL, menu_invite_cb }, + { "SendFile", PIDGIN_STOCK_TOOLBAR_SEND_FILE, N_("Se_nd File..."), NULL, NULL, G_CALLBACK(menu_send_file_cb) }, + { "AddBuddyPounce", NULL, N_("Add Buddy _Pounce..."), NULL, NULL, G_CALLBACK(menu_add_pounce_cb) }, + { "GetInfo", PIDGIN_STOCK_TOOLBAR_USER_INFO, N_("_Get Info"), "O", NULL, G_CALLBACK(menu_get_info_cb) }, + { "Invite", NULL, N_("In_vite..."), NULL, NULL, G_CALLBACK(menu_invite_cb) }, { "MoreMenu", NULL, N_("M_ore"), NULL, NULL, NULL }, - { "Alias", NULL, N_("Al_ias..."), NULL, NULL, menu_alias_cb }, - { "Block", PIDGIN_STOCK_TOOLBAR_BLOCK, N_("_Block..."), NULL, NULL, menu_block_cb }, - { "Unblock", PIDGIN_STOCK_TOOLBAR_UNBLOCK, N_("_Unblock..."), NULL, NULL, menu_unblock_cb }, - { "Add", GTK_STOCK_ADD, N_("_Add..."), NULL, NULL, menu_add_remove_cb }, - { "Remove", GTK_STOCK_REMOVE, N_("_Remove..."), NULL, NULL, menu_add_remove_cb }, - { "InsertLink", PIDGIN_STOCK_TOOLBAR_INSERT_LINK, N_("Insert Lin_k..."), NULL, NULL, menu_insert_link_cb }, - { "InsertImage", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, N_("Insert Imag_e..."), NULL, NULL, menu_insert_image_cb }, - { "Close", GTK_STOCK_CLOSE, N_("_Close"), NULL, NULL, menu_close_conv_cb }, + { "Alias", NULL, N_("Al_ias..."), NULL, NULL, G_CALLBACK(menu_alias_cb) }, + { "Block", PIDGIN_STOCK_TOOLBAR_BLOCK, N_("_Block..."), NULL, NULL, G_CALLBACK(menu_block_cb) }, + { "Unblock", PIDGIN_STOCK_TOOLBAR_UNBLOCK, N_("_Unblock..."), NULL, NULL, G_CALLBACK(menu_unblock_cb) }, + { "Add", GTK_STOCK_ADD, N_("_Add..."), NULL, NULL, G_CALLBACK(menu_add_remove_cb) }, + { "Remove", GTK_STOCK_REMOVE, N_("_Remove..."), NULL, NULL, G_CALLBACK(menu_add_remove_cb) }, + { "InsertLink", PIDGIN_STOCK_TOOLBAR_INSERT_LINK, N_("Insert Lin_k..."), NULL, NULL, G_CALLBACK(menu_insert_link_cb) }, + { "InsertImage", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, N_("Insert Imag_e..."), NULL, NULL, G_CALLBACK(menu_insert_image_cb) }, + { "Close", GTK_STOCK_CLOSE, N_("_Close"), NULL, NULL, G_CALLBACK(menu_close_conv_cb) }, /* Options */ { "OptionsMenu", NULL, N_("_Options"), NULL, NULL, NULL }, @@ -3274,10 +3274,10 @@ static GtkActionEntry menu_entries[] = /* Toggle items */ static const GtkToggleActionEntry menu_toggle_entries[] = { - { "EnableLogging", NULL, N_("Enable _Logging"), NULL, NULL, menu_logging_cb, FALSE }, - { "EnableSounds", NULL, N_("Enable _Sounds"), NULL, NULL, menu_sounds_cb, FALSE }, - { "ShowFormattingToolbars", NULL, N_("Show Formatting _Toolbars"), NULL, NULL, menu_toolbar_cb, FALSE }, - { "ShowTimestamps", NULL, N_("Show Ti_mestamps"), NULL, NULL, menu_timestamps_cb, FALSE }, + { "EnableLogging", NULL, N_("Enable _Logging"), NULL, NULL, G_CALLBACK(menu_logging_cb), FALSE }, + { "EnableSounds", NULL, N_("Enable _Sounds"), NULL, NULL, G_CALLBACK(menu_sounds_cb), FALSE }, + { "ShowFormattingToolbars", NULL, N_("Show Formatting _Toolbars"), NULL, NULL, G_CALLBACK(menu_toolbar_cb), FALSE }, + { "ShowTimestamps", NULL, N_("Show Ti_mestamps"), NULL, NULL, G_CALLBACK(menu_timestamps_cb), FALSE }, }; static const char *conversation_menu = -- cgit v1.2.1 From 36ffbe5d2d534c2e4863420795e13ba95d81d5c6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 05:38:26 +0000 Subject: Make the conversation UI manager stuff depend on GTK+ 2.6 instead of 2.4, since there would be inconsistencies otherwise. --- pidgin/gtkconv.c | 70 ++++++++++++++++++++++++++--------------------------- pidgin/gtkconvwin.h | 4 +-- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 6eb4a016f7..e1ed241be9 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -160,7 +160,7 @@ static void conv_set_unseen(PurpleConversation *gtkconv, PidginUnseenState state static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state); static void update_typing_icon(PidginConversation *gtkconv); static void update_typing_message(PidginConversation *gtkconv, const char *message); -#if !GTK_CHECK_VERSION(2,4,0) +#if !GTK_CHECK_VERSION(2,6,0) static const char *item_factory_translate_func (const char *path, gpointer func_data); #endif gboolean pidgin_conv_has_focus(PurpleConversation *conv); @@ -955,7 +955,7 @@ invite_cb(GtkWidget *widget, PidginConversation *gtkconv) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_new_conv_cb(GtkAction *action, gpointer data) #else menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) @@ -1000,7 +1000,7 @@ savelog_writefile_cb(void *user_data, const char *filename) * plaintext v. HTML file. */ static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_save_as_cb(GtkAction *action, gpointer data) #else menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) @@ -1034,7 +1034,7 @@ menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_view_log_cb(GtkAction *action, gpointer data) #else menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) @@ -1065,8 +1065,8 @@ menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) gdk_window_set_cursor(gtkblist->window->window, cursor); gdk_window_set_cursor(win->window->window, cursor); gdk_cursor_unref(cursor); -#if GTK_CHECK_VERSION(2,4,0) -//FIXME: gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); +#if GTK_CHECK_VERSION(2,4,0) && !GTK_CHECK_VERSION(2,6,0) //FIXME: What? + gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); #else gdk_flush(); #endif @@ -1096,7 +1096,7 @@ menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_clear_cb(GtkAction *action, gpointer data) #else menu_clear_cb(gpointer data, guint action, GtkWidget *widget) @@ -1161,7 +1161,7 @@ static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_find_cb(GtkAction *action, gpointer data) #else menu_find_cb(gpointer data, guint action, GtkWidget *widget) @@ -1225,7 +1225,7 @@ menu_find_cb(gpointer data, guint action, GtkWidget *widget) #ifdef USE_VV static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_initiate_media_call_cb(GtkAction *action, gpointer data) #else menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget) @@ -1246,7 +1246,7 @@ menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget) #endif static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_send_file_cb(GtkAction *action, gpointer data) #else menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) @@ -1262,7 +1262,7 @@ menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_add_pounce_cb(GtkAction *action, gpointer data) #else menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) @@ -1278,7 +1278,7 @@ menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_insert_link_cb(GtkAction *action, gpointer data) #else menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) @@ -1296,7 +1296,7 @@ menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_insert_image_cb(GtkAction *action, gpointer data) #else menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) @@ -1317,7 +1317,7 @@ menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_alias_cb(GtkAction *action, gpointer data) #else menu_alias_cb(gpointer data, guint action, GtkWidget *widget) @@ -1348,7 +1348,7 @@ menu_alias_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_get_info_cb(GtkAction *action, gpointer data) #else menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) @@ -1363,7 +1363,7 @@ menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_invite_cb(GtkAction *action, gpointer data) #else menu_invite_cb(gpointer data, guint action, GtkWidget *widget) @@ -1378,7 +1378,7 @@ menu_invite_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_block_cb(GtkAction *action, gpointer data) #else menu_block_cb(gpointer data, guint action, GtkWidget *widget) @@ -1393,7 +1393,7 @@ menu_block_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_unblock_cb(GtkAction *action, gpointer data) #else menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) @@ -1408,7 +1408,7 @@ menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_add_remove_cb(GtkAction *action, gpointer data) #else menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) @@ -1457,7 +1457,7 @@ hide_conv(PidginConversation *gtkconv, gboolean closetimer) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_close_conv_cb(GtkAction *action, gpointer data) #else menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) @@ -1469,7 +1469,7 @@ menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_logging_cb(GtkAction *action, gpointer data) #else menu_logging_cb(gpointer data, guint action, GtkWidget *widget) @@ -1485,7 +1485,7 @@ menu_logging_cb(gpointer data, guint action, GtkWidget *widget) if (conv == NULL) return; -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) logging = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); #else logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); @@ -1542,7 +1542,7 @@ menu_logging_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_toolbar_cb(GtkAction *action, gpointer data) { purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", @@ -1557,7 +1557,7 @@ menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) #endif static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_sounds_cb(GtkAction *action, gpointer data) #else menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) @@ -1576,7 +1576,7 @@ menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) gtkconv = PIDGIN_CONVERSATION(conv); gtkconv->make_sound = -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); #else gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); @@ -1587,7 +1587,7 @@ menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) menu_timestamps_cb(GtkAction *action, gpointer data) { purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", @@ -3234,7 +3234,7 @@ pidgin_conv_get_window(PidginConversation *gtkconv) return gtkconv->win; } -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) static GtkActionEntry menu_entries[] = /* TODO: fill out tooltips... */ @@ -3543,7 +3543,7 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea static void regenerate_options_items(PidginWindow *win) { -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) #else GtkWidget *menu; PidginConversation *gtkconv; @@ -3582,7 +3582,7 @@ remove_from_list(GtkWidget *widget, PidginWindow *win) static void regenerate_plugins_items(PidginWindow *win) { -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) #else GList *action_items; GtkWidget *menu; @@ -3628,7 +3628,7 @@ regenerate_plugins_items(PidginWindow *win) #endif } -#if !GTK_CHECK_VERSION(2,4,0) +#if !GTK_CHECK_VERSION(2,6,0) static void menubar_activated(GtkWidget *item, gpointer data) { PidginWindow *win = data; @@ -3659,7 +3659,7 @@ setup_menubar(PidginWindow *win) GtkAccelGroup *accel_group; const char *method; -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) GtkActionGroup *action_group; GError *error; @@ -4095,7 +4095,7 @@ update_send_to_selection(PidginWindow *win) if (!(b = purple_find_buddy(account, conv->name))) return FALSE; -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) #else gtk_widget_show(win->menu.send_to); @@ -4229,7 +4229,7 @@ compare_buddy_presence(PurplePresence *p1, PurplePresence *p2) static void generate_send_to_items(PidginWindow *win) { -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) #else GtkWidget *menu; GSList *group = NULL; @@ -8938,7 +8938,7 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc /* Right click was pressed. Popup the context menu. */ GtkWidget *menu = gtk_menu_new(), *sub; gboolean populated = populate_menu_with_options(menu, gtkconv, TRUE); -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) #else sub = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to)); @@ -9752,7 +9752,7 @@ pidgin_conv_window_destroy(PidginWindow *win) } gtk_widget_destroy(win->window); -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) g_object_unref(G_OBJECT(win->menu.ui)); #else g_object_unref(G_OBJECT(win->menu.item_factory)); diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index e440502302..5dc0718949 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -100,7 +100,7 @@ struct _PidginWindow GtkWidget *typing_icon; -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) GtkUIManager *ui; #else GtkItemFactory *item_factory; @@ -126,7 +126,7 @@ struct _PidginWindow gint drag_leave_signal; /* Media menu options. */ -#if GTK_CHECK_VERSION(2,4,0) +#if GTK_CHECK_VERSION(2,6,0) GtkAction *audio_call; GtkAction *video_call; GtkAction *audio_video_call; -- cgit v1.2.1 From ae7365b6aabecca49894b628e34462606be4379a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jul 2009 05:47:09 +0000 Subject: Fix media call initiation for UI manager. --- pidgin/gtkconv.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index e1ed241be9..7a871e9342 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1227,15 +1227,25 @@ menu_find_cb(gpointer data, guint action, GtkWidget *widget) static void #if GTK_CHECK_VERSION(2,6,0) menu_initiate_media_call_cb(GtkAction *action, gpointer data) +{ + PidginWindow *win = (PidginWindow *)data; + PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); + PurpleAccount *account = purple_conversation_get_account(conv); + + purple_prpl_initiate_media(account, + purple_conversation_get_name(conv), + action == win->audio_call ? PURPLE_MEDIA_AUDIO : + action == win->video_call ? PURPLE_MEDIA_VIDEO : + action == win->audio_video_call ? PURPLE_MEDIA_AUDIO | + PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE); +} #else menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = (PidginWindow *)data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); PurpleAccount *account = purple_conversation_get_account(conv); - /* FIXME: action is not an int... */ purple_prpl_initiate_media(account, purple_conversation_get_name(conv), action == 0 ? PURPLE_MEDIA_AUDIO : @@ -1244,6 +1254,7 @@ menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget) PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE); } #endif +#endif static void #if GTK_CHECK_VERSION(2,6,0) -- cgit v1.2.1 From 5389acce1d689b91e13de3cd27efda11fe81b309 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 29 Jul 2009 04:17:40 +0000 Subject: Fix copy+paste typo. Doesn't seem to make a real difference though. --- pidgin/gtkblist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 2ca1cc4eb6..7469baa226 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -8461,7 +8461,7 @@ pidgin_blist_update_plugin_actions(void) g_object_unref(G_OBJECT(plugins_action_group)); } - plugins_action_group = gtk_action_group_new("Accounts"); + plugins_action_group = gtk_action_group_new("PluginActions"); #ifdef ENABLE_NLS gtk_action_group_set_translation_domain(plugins_action_group, PACKAGE); #endif -- cgit v1.2.1 From 7738f802db646f3df75ba2195d393ef8cccab3c5 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Fri, 7 Aug 2009 18:27:41 +0000 Subject: Apparently I missed these in my previous commit. Also changed the gtkwebview.h to be javadoc'ed. --- pidgin/gtkwebview.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++ pidgin/gtkwebview.h | 146 +++++++++++++++++++++++++++++ 2 files changed, 410 insertions(+) create mode 100644 pidgin/gtkwebview.c create mode 100644 pidgin/gtkwebview.h diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c new file mode 100644 index 0000000000..1c3dc1057e --- /dev/null +++ b/pidgin/gtkwebview.c @@ -0,0 +1,264 @@ + +#include +#include +#include +#include +#include + +#include "util.h" +#include "gtkwebview.h" + +static WebKitWebViewClass *parent_class = NULL; + +GtkWidget* gtk_webview_new () +{ + return GTK_WIDGET(g_object_new(gtk_webview_get_type(), NULL)); +} + +static char* +get_img_filename_by_id (GtkWebView* view, int id) +{ + char *filename = NULL; + FILE *file; + PurpleStoredImage* img; + + if (!view->images) + view->images = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); + + filename = (char*) g_hash_table_lookup (view->images, GINT_TO_POINTER (id)); + if (filename) return filename; + + /* else get from img store */ + file = purple_mkstemp (&filename, TRUE); + + img = purple_imgstore_find_by_id (id); + + fwrite (purple_imgstore_get_data (img), purple_imgstore_get_size (img), 1, file); + g_hash_table_insert (view->images, GINT_TO_POINTER (id), filename); + fclose (file); + return filename; +} + +static void +clear_single_image (gpointer key, gpointer value, gpointer userdata) +{ + g_unlink ((char*) value); +} + +static void +clear_images (GtkWebView* view) +{ + if (!view->images) return; + g_hash_table_foreach (view->images, clear_single_image, NULL); + g_hash_table_unref (view->images); +} + +/* + * Replace all tags with . I hoped to never + * write any HTML parsing code, but I'm forced to do this, until + * purple changes the way it works. + */ +static char* +replace_img_id_with_src (GtkWebView *view, const char* html) +{ + GString *buffer = g_string_sized_new (strlen (html)); + const char* cur = html; + char *id; + int nid; + + while (*cur) { + const char* img = strstr (cur, ""); + if (!cur) + cur = strstr (img, ">"); + + if (!cur) { /*oops, invalid html */ + g_string_printf (buffer, "%s", html); + break; + } + + if (strstr (img, "src=") || !strstr (img, "id=")) { + g_string_printf (buffer, "%s", html); + break; + } + + /* now I _kinda_ know that it has an id=, and does not have a src= */ + /* todo: take care of src= and id= appearing in strings? */ + id = strstr (img, "id=") + 3; + + /* *id can't be \0, since a ">" appears after this */ + if (isdigit (*id)) + nid = atoi (id); + else + nid = atoi (id+1); + + /* let's dump this, tag and then dump the src information */ + g_string_append_len (buffer, img, cur - img); + + g_string_append_printf (buffer, " src='file://%s' ", get_img_filename_by_id (view, nid)); + } + return g_string_free (buffer, FALSE); +} + +static void +gtk_webview_finalize (GObject *view) +{ + clear_images (GTK_WEBVIEW (view)); + G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT(view)); +} + +static void +gtk_webview_class_init (GtkWebViewClass *klass, gpointer userdata) +{ + parent_class = g_type_class_ref (webkit_web_view_get_type ()); + G_OBJECT_CLASS (klass)->finalize = gtk_webview_finalize; +} + +static gboolean +webview_link_clicked (WebKitWebView *view, + WebKitWebFrame *frame, + WebKitNetworkRequest *request, + WebKitWebNavigationAction *navigation_action, + WebKitWebPolicyDecision *policy_decision) +{ + const gchar *uri; + + uri = webkit_network_request_get_uri (request); + + /* the gtk imhtml way was to create an idle cb, not sure + * why, so right now just using purple_notify_uri directly */ + purple_notify_uri (NULL, uri); + return TRUE; +} + +char* +gtk_webview_execute_script (GtkWebView *view, const char *script) +{ + JSStringRef js_script = JSStringCreateWithUTF8CString (script); + JSContextRef ctxt = webkit_web_frame_get_global_context ( + webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view)) + ); + JSValueRef ret = JSEvaluateScript (ctxt, js_script, NULL, NULL, 0, NULL); + JSStringRef ret_as_str = JSValueToStringCopy (ctxt, ret, NULL); + + size_t cstr_len = JSStringGetMaximumUTF8CStringSize (ret_as_str); + char *cstr = g_new0(char, cstr_len + 1); + + JSStringGetUTF8CString (ret_as_str, cstr, cstr_len); + + /* TODO: I'm not sure what, if at all, I need to free here! */ + return cstr; +} + +static void +gtk_webview_init (GtkWebView *view, gpointer userdata) +{ + g_signal_connect (view, "navigation-policy-decision-requested", + G_CALLBACK (webview_link_clicked), + view); + view->empty = TRUE; +} + + +void +gtk_webview_load_html_string_with_imgstore (GtkWebView* view, const char* html) +{ + char* html_imged; + + clear_images (view); + html_imged = replace_img_id_with_src (view, html); + printf ("%s\n", html_imged); + webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (view), html_imged, "file:///"); + g_free (html_imged); +} + +/* taken from sean's webkit plugin */ +char *gtk_webview_quote_js_string(const char *text) +{ + GString *str = g_string_new("\""); + const char *cur = text; + + while (cur && *cur) { + switch (*cur) { + case '\\': + g_string_append(str, "\\\\"); + break; + case '\"': + g_string_append(str, "\\\""); + break; + case '\r': + g_string_append(str, "
"); + break; + case '\n': + break; + default: + g_string_append_c(str, *cur); + } + cur ++; + } + g_string_append_c (str, '"'); + return g_string_free (str, FALSE); +} + + +/* this is a "hack", my plan is to eventually handle this + * correctly using a signals and a plugin: the plugin will have + * the information as to what javascript function to call. It seems + * wrong to hardcode that here. + */ +void +gtk_webview_append_html (GtkWebView* view, const char* html) +{ + char* escaped = gtk_webview_quote_js_string (html); + char* script = g_strdup_printf ("document.write(%s)", escaped); + printf ("script: %s\n", script); + webkit_web_view_execute_script (WEBKIT_WEB_VIEW (view), script); + view->empty = FALSE; + g_free (script); + g_free (escaped); +} + +char* +gtk_webview_get_markup (GtkWebView *view) +{ + return gtk_webview_execute_script (view, "document.body.innerHTML"); +} + +char* +gtk_webview_get_text (GtkWebView *view) +{ + return gtk_webview_execute_script (view, "document.body.textContent"); +} + +gboolean gtk_webview_is_empty (GtkWebView *view) +{ + return view->empty; +} + +GType gtk_webview_get_type () +{ + static GType mview_type = 0; + if (!mview_type) { + static const GTypeInfo mview_info = { + sizeof (GtkWebViewClass), + NULL, + NULL, + (GClassInitFunc) gtk_webview_class_init, + NULL, + NULL, + sizeof (GtkWebView), + 0, + (GInstanceInitFunc) gtk_webview_init, + NULL + }; + mview_type = g_type_register_static(webkit_web_view_get_type (), + "GtkWebView", &mview_info, 0); + } + return mview_type; +} diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h new file mode 100644 index 0000000000..bd0df4c770 --- /dev/null +++ b/pidgin/gtkwebview.h @@ -0,0 +1,146 @@ +/** + * @file gtkwebview.h Wrapper over the Gtk WebKitWebView component + * @ingroup pidgin + */ + +/* Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#ifndef _PIDGIN_WEBVIEW_H_ +#define _PIDGIN_WEBVIEW_H_ + +#include +#include +#include + +#include "notify.h" + +#define GTK_TYPE_WEBVIEW (gtk_webview_get_type()) +#define GTK_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_WEBVIEW, GtkWebView)) +#define GTK_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_WEBVIEW, GtkWebViewClass)) +#define GTK_IS_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_WEBVIEW)) +#define GTK_IS_IMHTML_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEW)) + + +struct _GtkWebView +{ + WebKitWebView webkit_web_view; + + /*< private >*/ + GHashTable *images; /**< a map from id to temporary file for the image */ + gboolean empty; /**< whether anything has been appended **/ + char *script_return; /**< the last value returned from a script **/ +}; + +typedef struct _GtkWebView GtkWebView; + +struct _GtkWebViewClass +{ + WebKitWebViewClass parent; +}; + +typedef struct _GtkWebViewClass GtkWebViewClass; + + +/** + * Returns the GType for a GtkWebView widget + * + * @return the GType for GtkWebView widget + */ +GType gtk_webview_get_type (); + +/** + * Create a new GtkWebView object + * + * @return a GtkWidget corresponding to the GtkWebView object + */ +GtkWidget* gtk_webview_new (); + +/** + * A very basic routine to append html, which can be considered + * equivalent to a "document.write" using JavaScript. + * + * @param webview The GtkWebView object + * @param markup The html markup to append + */ +void gtk_webview_append_html (GtkWebView *webview, const char* markup); + +/** + * Rather than use webkit_webview_load_string, this routine + * parses and displays the tags that make use of the + * Pidgin imgstore. + * + * @param webview The GtkWebView object + * @param html The HTML content to load + */ +void gtk_webview_load_html_string_with_imgstore (GtkWebView* webview, const char* html); + +/** + * (To be changed, right now it just tests whether an append has been + * called since the last clear or since the Widget was created. So it + * does not test for load_string's called in between. + * + * @param webview The GtkWebView object + * + * @return gboolean indicating whether the webview is empty. + */ +gboolean gtk_webview_is_empty (GtkWebView *webview); + +/** + * Executes javascript and returns the answer of the script + * formatted as string. The return value needs to be freed using + * g_free. If the return values is not required you may instead + * use webkit_web_view_execute_script. + * + * @param webview The GtkWebView object + * @param script The JavaScript to execute + * + * @return the return value of the script. + */ +char* gtk_webview_execute_script (GtkWebView *webview, const char *script); + +/** + * Get the current contents of the GtkWebView object. + * + * @param webview The GtkWebView object + * + * @return a string with the contents. Needs to be g_free'd after use. + */ +char* gtk_webview_get_markup (GtkWebView *webview); + +/** + * Returns the contents of the GtkWebView object, stripped of markups + * + * @param webview The GtkWebView object + * + * @return a string with the contents. Needs to be g_free'd after use. + */ +char* gtk_webview_get_text (GtkWebView *view); + +/** + * A convenience routine to quote a string for use as a JavaScript + * string. For instance, "hello 'world'" becomes "'hello \\'world\\''" + * + * @param str The string to escape and quote + * + * @return the quoted string. + */ +char* gtk_webview_quote_js_string (const char* str); + +#endif /* _PIDGIN_WEBVIEW_H_ */ -- cgit v1.2.1 From dbb2b0b514522a53b4c4868f871694a6a6537b90 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Fri, 7 Aug 2009 18:29:52 +0000 Subject: other files that missed my main major commit. --- pidgin/plugins/adiumthemes/Makefile.am | 28 ++ pidgin/plugins/adiumthemes/Template.html | 164 +++++++ pidgin/plugins/adiumthemes/webkit.c | 738 +++++++++++++++++++++++++++++++ 3 files changed, 930 insertions(+) create mode 100644 pidgin/plugins/adiumthemes/Makefile.am create mode 100644 pidgin/plugins/adiumthemes/Template.html create mode 100644 pidgin/plugins/adiumthemes/webkit.c diff --git a/pidgin/plugins/adiumthemes/Makefile.am b/pidgin/plugins/adiumthemes/Makefile.am new file mode 100644 index 0000000000..e9d0b8a5d6 --- /dev/null +++ b/pidgin/plugins/adiumthemes/Makefile.am @@ -0,0 +1,28 @@ + +webkittemplatedir = $(datadir)/pidgin/webkit +webkittemplate_DATA = Template.html + +webkitdir = $(libdir)/pidgin + +webkit_la_LDFLAGS = -module -avoid-version + +EXTRA_DIST = $(webkittemplate_DATA) + +if PLUGINS + +webkit_LTLIBRARIES = webkit.la + +webkit_la_SOURCES = webkit.c + +endif + +webkit_la_LIBADD = $(GTK_LIBS) $(WEBKIT_LIBS) + +AM_CPPFLAGS = \ + -DDATADIR=\"$(datadir)\" \ + -I$(top_srcdir)/libpurple \ + -I$(top_builddir)/libpurple \ + -I$(top_srcdir)/pidgin \ + $(DEBUG_CFLAGS) \ + $(GTK_CFLAGS) \ + $(WEBKIT_CFLAGS) diff --git a/pidgin/plugins/adiumthemes/Template.html b/pidgin/plugins/adiumthemes/Template.html new file mode 100644 index 0000000000..0a7f9d6662 --- /dev/null +++ b/pidgin/plugins/adiumthemes/Template.html @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + +%@ +
+
+%@ + + diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c new file mode 100644 index 0000000000..7a6b96b2a6 --- /dev/null +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -0,0 +1,738 @@ +/* + * Adium Webkit views + * Copyright (C) 2007 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +/* This plugins is basically Sadrul's x-chat plugin, but with Webkit + * instead of xtext. + */ + +#define PLUGIN_ID "gtk-webview-adium-ims" +#define PLUGIN_NAME "webview-adium-ims" +#define PLUGIN_AUTHOR "Sean Egan " +#define PURPLE_PLUGINS "Hell yeah" + +/* System headers */ +#include +#include +#include + +#include + +/* Purple headers */ +#include +#include +#include +#include + +/* Pidgin headers */ +#include +#include +#include + +static PurpleConversationUiOps *uiops = NULL; + +static void (*default_write_conv)(PurpleConversation *conv, const char *name, const char *alias, + const char *message, PurpleMessageFlags flags, time_t mtime); +static void (*default_create_conversation)(PurpleConversation *conv); + +static void (*default_destroy_conversation)(PurpleConversation *conv); + +/* Cache the contents of the HTML files */ +char *template_html = NULL; /* This is the skeleton: some basic javascript mostly */ +char *header_html = NULL; /* This is the first thing to be appended to any conversation */ +char *footer_html = NULL; /* This is the last thing appended to the conversation */ +char *incoming_content_html = NULL; /* This is a received message */ +char *outgoing_content_html = NULL; /* And a sent one */ +char *incoming_next_content_html = NULL; /* The same things, but used when someone sends multiple subsequent */ +char *outgoing_next_content_html = NULL; /* messages in a row */ +char *status_html = NULL; /* Non-IM status messages */ +char *basestyle_css = NULL; /* Shared CSS attributes */ + +/* Cache their lenghts too, to pass into g_string_new_len, avoiding crazy allocation */ +gsize template_html_len = 0; +gsize header_html_len = 0; +gsize footer_html_len = 0; +gsize incoming_content_html_len = 0; +gsize outgoing_content_html_len = 0; +gsize incoming_next_content_html_len = 0; +gsize outgoing_next_content_html_len = 0; +gsize status_html_len = 0; +gsize basestyle_css_len = 0; + +/* And their paths */ +char *style_dir = NULL; +char *template_path = NULL; +char *css_path = NULL; + +static char * +replace_message_tokens(char *text, gsize len, PurpleConversation *conv, const char *name, const char *alias, + const char *message, PurpleMessageFlags flags, time_t mtime) +{ + GString *str = g_string_new_len(NULL, len); + char *cur = text; + char *prev = cur; + + while ((cur = strchr(cur, '%'))) { + const char *replace = NULL; + char *fin = NULL; + + if (!strncmp(cur, "%message%", strlen("%message%"))) { + replace = message; + } else if (!strncmp(cur, "%messageClasses%", strlen("%messageClasses%"))) { + replace = flags & PURPLE_MESSAGE_SEND ? "outgoing" : + flags & PURPLE_MESSAGE_RECV ? "incoming" : "event"; + } else if (!strncmp(cur, "%time", strlen("%time"))) { + char *format = NULL; + if (*(cur + strlen("%time")) == '{') { + char *start = cur + strlen("%time") + 1; + char *end = strstr(start, "}%"); + if (!end) /* Invalid string */ + continue; + format = g_strndup(start, end - start); + fin = end + 1; + } + replace = purple_utf8_strftime(format ? format : "%X", NULL); + g_free(format); + } else if (!strncmp(cur, "%userIconPath%", strlen("%userIconPath%"))) { + if (flags & PURPLE_MESSAGE_SEND) { + if (purple_account_get_bool(conv->account, "use-global-buddyicon", TRUE)) { + replace = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon"); + } else { + PurpleStoredImage *img = purple_buddy_icons_find_account_icon(conv->account); + replace = purple_imgstore_get_filename(img); + } + if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { + replace = g_build_filename("Outgoing", "buddy_icon.png", NULL); + } + } else if (flags & PURPLE_MESSAGE_RECV) { + PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); + replace = purple_buddy_icon_get_full_path(icon); + if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { + replace = g_build_filename("Incoming", "buddy_icon.png", NULL); + } + } + + } else if (!strncmp(cur, "%senderScreenName%", strlen("%senderScreenName%"))) { + replace = name; + } else if (!strncmp(cur, "%sender%", strlen("%sender%"))) { + replace = alias; + } else if (!strncmp(cur, "%service%", strlen("%service%"))) { + replace = purple_account_get_protocol_name(conv->account); + } else { + cur++; + continue; + } + + /* Here we have a replacement to make */ + g_string_append_len(str, prev, cur - prev); + g_string_append(str, replace); + + /* And update the pointers */ + if (fin) { + prev = cur = fin + 1; + } else { + prev = cur = strchr(cur + 1, '%') + 1; + } + + } + + /* And wrap it up */ + g_string_append(str, prev); + return g_string_free(str, FALSE); +} + +static char * +replace_header_tokens(char *text, gsize len, PurpleConversation *conv) +{ + GString *str = g_string_new_len(NULL, len); + char *cur = text; + char *prev = cur; + + if (text == NULL) + return NULL; + + while ((cur = strchr(cur, '%'))) { + const char *replace = NULL; + char *fin = NULL; + + if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { + replace = conv->name; + } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { + replace = purple_account_get_alias(conv->account); + if (replace == NULL) + replace = purple_account_get_username(conv->account); + } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { + PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + if (buddy) { + replace = purple_buddy_get_alias(buddy); + } else { + replace = conv->name; + } + } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { + PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); + replace = purple_buddy_icon_get_full_path(icon); + } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { + } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { + char *format = NULL; + if (*(cur + strlen("%timeOpened")) == '{') { + char *start = cur + strlen("%timeOpened") + 1; + char *end = strstr(start, "}%"); + if (!end) /* Invalid string */ + continue; + format = g_strndup(start, end - start); + fin = end + 1; + } + replace = purple_utf8_strftime(format ? format : "%X", NULL); + g_free(format); + } else { + // cur++; + continue; + } + + /* Here we have a replacement to make */ + g_string_append_len(str, prev, cur - prev); + g_string_append(str, replace); + + /* And update the pointers */ + if (fin) { + prev = cur = fin + 1; + } else { + prev = cur = strchr(cur + 1, '%') + 1; + } + } + + /* And wrap it up */ + g_string_append(str, prev); + return g_string_free(str, FALSE); +} + +static char * +replace_template_tokens(char *text, int len, char *header, char *footer) { + GString *str = g_string_new_len(NULL, len); + + char **ms = g_strsplit(text, "%@", 6); + char *base = NULL; + + if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { + g_strfreev(ms); + g_string_free(str, TRUE); + return NULL; + } + + g_string_append(str, ms[0]); + g_string_append(str, "file://"); + base = g_build_filename (style_dir, "Contents", "Resources", "Template.html", NULL); + g_string_append(str, base); + g_free (base); + + g_string_append(str, ms[1]); + if (basestyle_css) + g_string_append(str, basestyle_css); + g_string_append(str, ms[2]); + if (css_path) { + g_string_append(str, "file://"); + g_string_append(str, css_path); + } + + g_string_append(str, ms[3]); + if (header) + g_string_append(str, header); + g_string_append(str, ms[4]); + if (footer) + g_string_append(str, footer); + g_string_append(str, ms[5]); + + g_strfreev(ms); + return g_string_free (str, FALSE); +} + +static GtkWidget * +get_webkit(PurpleConversation *conv) +{ + PidginConversation *gtkconv; + gtkconv = PIDGIN_CONVERSATION(conv); + if (!gtkconv) + return NULL; + else + return gtkconv->webview; +} +static void +init_theme_for_webkit (PurpleConversation *conv) +{ + GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; + char *header, *footer; + char *template; + + char* basedir = g_build_filename (style_dir, "Contents", "Resources", "Template.html", NULL); + char* baseuri = g_strdup_printf ("file://%s", basedir); + + header = replace_header_tokens(header_html, header_html_len, conv); + footer = replace_header_tokens(footer_html, footer_html_len, conv); + template = replace_template_tokens(template_html, template_html_len + header_html_len, header, footer); + + if (!g_object_get_data (G_OBJECT(webkit), "adium-themed")) + webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); + + g_object_set_data (G_OBJECT(webkit), "adium-themed", GINT_TO_POINTER(1)); + g_free (basedir); + g_free (baseuri); + g_free (header); + g_free (footer); + g_free (template); +} + + +/* restore the non theme version of the conversation window */ +static void +finalize_theme_for_webkit (PurpleConversation *conv) +{ + GtkWidget *webview = PIDGIN_CONVERSATION(conv)->webview; + webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), "", "text/html", "UTF-8", ""); + g_object_set_data (G_OBJECT(webview), "adium-themed", NULL); +} + +static char * +escape_message(char *text) +{ + GString *str = g_string_new(NULL); + char *cur = text; + + while (cur && *cur) { + switch (*cur) { + case '\\': + g_string_append(str, "\\\\"); + break; + case '\"': + g_string_append(str, "\\\""); + break; + case '\r': + g_string_append(str, "
"); + break; + case '\n': + break; + default: + g_string_append_c(str, *cur); + } + cur++; + } + return g_string_free(str, FALSE); +} + +struct webkit_script { + GtkWidget *webkit; + char *script; +}; + +static gboolean purple_webkit_execute_script(gpointer _script) +{ + struct webkit_script *script = (struct webkit_script*) _script; + printf ("%s\n", script->script); + webkit_web_view_execute_script(WEBKIT_WEB_VIEW(script->webkit), script->script); + g_free(script->script); + g_free(script); + return FALSE; +} + +static void purple_webkit_write_conv(PurpleConversation *conv, const char *name, const char *alias, + const char *message, PurpleMessageFlags flags, time_t mtime) +{ + PurpleConversationType type; + GtkWidget *webkit; + char *stripped; + char *message_html; + char *msg; + char *escape; + char *script; + char *func = "appendMessage"; + char *smileyed; + struct webkit_script *wk_script; + PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); + + /* Don't call the usual stuff first. */ + //default_write_conv(conv, name, alias, message, flags, mtime); + type = purple_conversation_get_type(conv); + if (type != PURPLE_CONV_TYPE_IM) + { + /* If it's chat, we have nothing to do. */ + return; + } + /* So it's an IM. Let's play. */ + + webkit = get_webkit(conv); + stripped = g_strdup(message); //purple_markup_strip_html(message); + + if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) { + message_html = outgoing_next_content_html; + func = "appendNextMessage"; + } else if (flags & PURPLE_MESSAGE_SEND) { + message_html = outgoing_content_html; + } else if (flags & PURPLE_MESSAGE_RECV && old_flags & PURPLE_MESSAGE_RECV) { + message_html = incoming_next_content_html; + func = "appendNextMessage"; + } else if (flags & PURPLE_MESSAGE_RECV) { + message_html = incoming_content_html; + } else { + message_html = status_html; + } + purple_conversation_set_data(conv, "webkit-lastflags", GINT_TO_POINTER(flags)); + + smileyed = smiley_parse_markup(stripped, conv->account->protocol_id); + msg = replace_message_tokens(message_html, 0, conv, name, alias, smileyed, flags, mtime); + escape = escape_message(msg); + script = g_strdup_printf("%s(\"%s\")", func, escape); + + wk_script = g_new0(struct webkit_script, 1); + wk_script->script = script; + wk_script->webkit = webkit; + + g_idle_add(purple_webkit_execute_script, wk_script); + + g_free(smileyed); + g_free(msg); + g_free(stripped); + g_free(escape); +} + + +static void +purple_webkit_create_conv(PurpleConversation *conv) +{ + default_create_conversation(conv); + init_theme_for_webkit(conv); +} + +static void +purple_webkit_destroy_conv(PurpleConversation *conv) +{ + default_destroy_conversation(conv); +} + +static GList* +get_theme_files() +{ + GList *ret = NULL; + GDir *variants; + char *globe = g_build_filename(DATADIR, "pidgin", "webkit", "styles", NULL); + const char *css_file; + char *css; + + if (style_dir != NULL) { + char *variant_dir = g_build_filename(style_dir, "Contents", "Resources", "Variants", NULL); + variants = g_dir_open(variant_dir, 0, NULL); + while ((css_file = g_dir_read_name(variants)) != NULL) { + if (!strstr(css_file, ".css")) { + continue; + } + css = g_build_filename(variant_dir, css_file, NULL); + ret = g_list_append(ret,css); + } + g_dir_close(variants); + g_free(variant_dir); + } + g_free(globe); + + ret = g_list_sort (ret, (GCompareFunc)g_strcmp0); + return ret; +} + +static void +variant_set_default () +{ + + GList* all; + GList* copy; + css_path = g_strdup (purple_prefs_get_string ("/plugins/gtk/adiumthemes/csspath")); + + if (g_file_test (css_path, G_FILE_TEST_EXISTS)) + return; + else { + g_free (css_path); + css_path = NULL; + } + + all = get_theme_files (); + copy = all; + if (css_path) { + g_free (css_path); + css_path = NULL; + } + if (all) { + css_path = g_strdup (all->data); + purple_prefs_set_string ("/plugins/gtk/adiumthemes/csspath", css_path); + } + + while (all) { + g_free (all->data); + all = g_list_next(all); + } + g_list_free (copy); +} + +static gboolean +plugin_load(PurplePlugin *plugin) +{ + char *file; + + if (g_path_is_absolute (purple_user_dir())) + style_dir = g_build_filename(purple_user_dir(), "style", NULL); + else { + char* cur = g_get_current_dir (); + style_dir = g_build_filename (cur, purple_user_dir(), "style", NULL); + g_free (cur); + } + + variant_set_default (); + if (!css_path) + return FALSE; + + + template_path = g_build_filename(style_dir, "Contents", "Resources", "Template.html", NULL); + if (!g_file_test(template_path, G_FILE_TEST_EXISTS)) { + g_free(template_path); + template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); + } + if (!g_file_get_contents(template_path, &template_html, &template_html_len, NULL)) + return FALSE; + + file = g_build_filename(style_dir, "Contents", "Resources", "Header.html", NULL); + g_file_get_contents(file, &header_html, &header_html_len, NULL); + + file = g_build_filename(style_dir, "Contents", "Resources", "Footer.html", NULL); + g_file_get_contents(file, &footer_html, &footer_html_len, NULL); + + file = g_build_filename(style_dir, "Contents", "Resources", "Incoming", "Content.html", NULL); + if (!g_file_get_contents(file, &incoming_content_html, &incoming_content_html_len, NULL)) + return FALSE; + + file = g_build_filename(style_dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); + if (!g_file_get_contents(file, &incoming_next_content_html, &incoming_next_content_html_len, NULL)) { + incoming_next_content_html = incoming_content_html; + incoming_next_content_html_len = incoming_content_html_len; + } + + file = g_build_filename(style_dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); + if (!g_file_get_contents(file, &outgoing_content_html, &outgoing_content_html_len, NULL)) { + outgoing_content_html = incoming_content_html; + outgoing_content_html_len = incoming_content_html_len; + } + + file = g_build_filename(style_dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); + if (!g_file_get_contents(file, &outgoing_next_content_html, &outgoing_next_content_html_len, NULL)) { + outgoing_next_content_html = outgoing_content_html; + outgoing_next_content_html_len = outgoing_content_html_len; + } + + + file = g_build_filename(style_dir, "Contents", "Resources", "Status.html", NULL); + if (!g_file_get_contents(file, &status_html, &status_html_len, NULL)) + return FALSE; + + file = g_build_filename(style_dir, "Contents", "Resources", "main.css", NULL); + g_file_get_contents(file, &basestyle_css, &basestyle_css_len, NULL); + + uiops = pidgin_conversations_get_conv_ui_ops(); + + if (uiops == NULL) + return FALSE; + + /* Use the oh-so-useful uiops. Signals? bleh. */ + default_write_conv = uiops->write_conv; + uiops->write_conv = purple_webkit_write_conv; + + default_create_conversation = uiops->create_conversation; + uiops->create_conversation = purple_webkit_create_conv; + + default_destroy_conversation = uiops->destroy_conversation; + uiops->destroy_conversation = purple_webkit_destroy_conv; + + /* finally update each of the existing conversation windows */ + { + GList* list = purple_get_conversations (); + for (;list; list = g_list_next(list)) + purple_webkit_create_conv (list->data); + + } + return TRUE; +} + +static gboolean +plugin_unload(PurplePlugin *plugin) +{ + GList *list; + /* Restore the default ui-ops */ + uiops->write_conv = default_write_conv; + uiops->create_conversation = default_create_conversation; + uiops->destroy_conversation = default_destroy_conversation; + + list = purple_get_conversations (); + while (list) { + finalize_theme_for_webkit(list->data); + list = g_list_next(list); + } + return TRUE; +} + + +static void +variant_update_conversation (PurpleConversation *conv) +{ + PidginConversation *gtkconv = PIDGIN_CONVERSATION (conv); + WebKitWebView *webview = WEBKIT_WEB_VIEW (gtkconv->webview); + char* script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", css_path); + printf ("css_path: %s\n", css_path); + webkit_web_view_execute_script (webview, script); + g_free (script); +} + +static void +variant_changed (GtkWidget* combobox, gpointer null) +{ + char *name, *name_with_ext; + GList *list; + + g_free (css_path); + name = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combobox)); + name_with_ext = g_strdup_printf ("%s.css", name); + g_free (name); + + css_path = g_build_filename (style_dir, "Contents", "Resources", "Variants", name_with_ext, NULL); + purple_prefs_set_string ("/plugins/gtk/adiumthemes/csspath", css_path); + g_free (name_with_ext); + + /* update each conversation */ + list = purple_get_conversations (); + while (list) { + variant_update_conversation (list->data); + list = g_list_next(list); + } +} + +static GtkWidget * +get_config_frame(PurplePlugin *plugin) { + GList *themes = get_theme_files(); + GList *theme = themes; + char *curdir = NULL; + GtkWidget *combobox = gtk_combo_box_new_text(); + int def = -1, index = 0; + + while (theme) { + char *basename = g_path_get_basename(theme->data); + char *dirname = g_path_get_dirname(theme->data); + if (!curdir || strcmp(curdir, dirname)) { + char *plist, *plist_xml; + gsize plist_len; + xmlnode *node; + g_free(curdir); + curdir = strdup(dirname); + plist = g_build_filename(curdir, "..", "..", "Info.plist", NULL); + if (!g_file_get_contents(plist, &plist_xml, &plist_len, NULL)) { + continue; + } + node = xmlnode_from_str(plist_xml, plist_len); + if (!node) continue; + node = xmlnode_get_child(node, "dict"); + if (!node) continue; + node = xmlnode_get_child(node, "key"); + while (node && strcmp(xmlnode_get_data(node), "CFBundleName")) { + node = xmlnode_get_next_twin(node); + } + if (!node) continue; + node = node->next; + while (node && node->type != XMLNODE_TYPE_TAG) { + node = node->next; + } + + } + + { + char *temp = g_strndup (basename, strlen(basename)-4); + gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), temp); + g_free (temp); + } + if (g_str_has_suffix (css_path, basename)) + def = index; + index ++; + theme = theme->next; + } + + gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), def); + g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL); + + return combobox; +} + +PidginPluginUiInfo ui_info = +{ + get_config_frame, + 0, /* page_num (Reserved) */ + + /* padding */ + NULL, + NULL, + NULL, + NULL +}; + + +static PurplePluginInfo info = +{ + PURPLE_PLUGIN_MAGIC, /* Magic */ + PURPLE_MAJOR_VERSION, /* Purple Major Version */ + PURPLE_MINOR_VERSION, /* Purple Minor Version */ + PURPLE_PLUGIN_STANDARD, /* plugin type */ +PIDGIN_PLUGIN_TYPE, /* ui requirement */ + 0, /* flags */ + NULL, /* dependencies */ + PURPLE_PRIORITY_DEFAULT, /* priority */ + + PLUGIN_ID, /* plugin id */ + NULL, /* name */ + "0.1", /* version */ + NULL, /* summary */ + NULL, /* description */ + PLUGIN_AUTHOR, /* author */ + "http://pidgin.im", /* website */ + + plugin_load, /* load */ + plugin_unload, /* unload */ + NULL, /* destroy */ + + &ui_info, /* ui_info */ + NULL, /* extra_info */ + NULL, /* prefs_info */ + NULL, /* actions */ + NULL, /* reserved 1 */ + NULL, /* reserved 2 */ + NULL, /* reserved 3 */ + NULL /* reserved 4 */ +}; + +static void +init_plugin(PurplePlugin *plugin) { + info.name = "Adium IMs"; + info.summary = "Adium-like IMs with Pidgin"; + info.description = "You can chat in Pidgin using Adium's WebKit view."; + + purple_prefs_add_none ("/plugins"); + purple_prefs_add_none ("/plugins/gtk"); + purple_prefs_add_none ("/plugins/gtk/adiumthemes"); + purple_prefs_add_string ("/plugins/gtk/adiumthemes/csspath", ""); +} + +PURPLE_INIT_PLUGIN(webkit, init_plugin, info) -- cgit v1.2.1 From 6b0c32d719c969f09d8d8047c2e1fbd39c971514 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Fri, 7 Aug 2009 18:38:31 +0000 Subject: cleaning up code. --- pidgin/gtkwebview.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 1c3dc1057e..91b62cc5ab 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -1,3 +1,33 @@ +/* + * @file gtkwebview.c GTK+ WebKitWebView wrapper class. + * @ingroup pidgin + */ + +/* pidgin + * + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif #include #include @@ -7,6 +37,7 @@ #include "util.h" #include "gtkwebview.h" +#include "imgstore.h" static WebKitWebViewClass *parent_class = NULL; @@ -16,7 +47,7 @@ GtkWidget* gtk_webview_new () } static char* -get_img_filename_by_id (GtkWebView* view, int id) +get_image_filename_from_id (GtkWebView* view, int id) { char *filename = NULL; FILE *file; @@ -101,7 +132,7 @@ replace_img_id_with_src (GtkWebView *view, const char* html) /* let's dump this, tag and then dump the src information */ g_string_append_len (buffer, img, cur - img); - g_string_append_printf (buffer, " src='file://%s' ", get_img_filename_by_id (view, nid)); + g_string_append_printf (buffer, " src='file://%s' ", get_image_filename_from_id (view, nid)); } return g_string_free (buffer, FALSE); } -- cgit v1.2.1 From fdd771ff9062d8ebbfc18f70da222f4efce78a84 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Fri, 7 Aug 2009 18:44:27 +0000 Subject: more cleanup. --- pidgin/gtkwebview.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 91b62cc5ab..0f78523ff7 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -109,7 +109,7 @@ replace_img_id_with_src (GtkWebView *view, const char* html) if (!cur) cur = strstr (img, ">"); - if (!cur) { /*oops, invalid html */ + if (!cur) { /* invalid html? */ g_string_printf (buffer, "%s", html); break; } @@ -119,8 +119,12 @@ replace_img_id_with_src (GtkWebView *view, const char* html) break; } - /* now I _kinda_ know that it has an id=, and does not have a src= */ - /* todo: take care of src= and id= appearing in strings? */ + /* + * if this is valid HTML, then I can be sure that it + * has an id= and does not have an src=, since + * '=' cannot appear in parameters. + */ + id = strstr (img, "id=") + 3; /* *id can't be \0, since a ">" appears after this */ @@ -134,6 +138,7 @@ replace_img_id_with_src (GtkWebView *view, const char* html) g_string_append_printf (buffer, " src='file://%s' ", get_image_filename_from_id (view, nid)); } + return g_string_free (buffer, FALSE); } @@ -153,9 +158,9 @@ gtk_webview_class_init (GtkWebViewClass *klass, gpointer userdata) static gboolean webview_link_clicked (WebKitWebView *view, - WebKitWebFrame *frame, - WebKitNetworkRequest *request, - WebKitWebNavigationAction *navigation_action, + WebKitWebFrame *frame, + WebKitNetworkRequest *request, + WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision) { const gchar *uri; @@ -209,7 +214,6 @@ gtk_webview_load_html_string_with_imgstore (GtkWebView* view, const char* html) g_free (html_imged); } -/* taken from sean's webkit plugin */ char *gtk_webview_quote_js_string(const char *text) { GString *str = g_string_new("\""); @@ -275,7 +279,7 @@ gboolean gtk_webview_is_empty (GtkWebView *view) GType gtk_webview_get_type () { static GType mview_type = 0; - if (!mview_type) { + if (G_UNLIKELY (mview_type == 0)) { static const GTypeInfo mview_info = { sizeof (GtkWebViewClass), NULL, -- cgit v1.2.1 From ecdeff9e4a5cde09e19d0be212ac1818edb2d93f Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sun, 9 Aug 2009 17:16:20 +0000 Subject: added smileyparser code. --- pidgin/smileyparser.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++ pidgin/smileyparser.h | 3 ++ 2 files changed, 147 insertions(+) create mode 100644 pidgin/smileyparser.c create mode 100644 pidgin/smileyparser.h diff --git a/pidgin/smileyparser.c b/pidgin/smileyparser.c new file mode 100644 index 0000000000..134de3d306 --- /dev/null +++ b/pidgin/smileyparser.c @@ -0,0 +1,144 @@ + +#include +#include "smileyparser.h" +#include +#include +#include "gtkthemes.h" + +static char* get_fullpath (const char* filename) +{ + if (g_path_is_absolute (filename)) return g_strdup (filename); + else return g_build_path (g_get_current_dir (), filename, NULL); +} + +static void +parse_for_shortcut_plaintext (const char* text, const char* shortcut, const char* file, GString* ret) +{ + const char *tmp = text; + + for(;*tmp;) { + const char *end = strstr (tmp, shortcut); + char *path; + char *escaped_path; + + if (end == NULL) { + g_string_append (ret, tmp); + break; + } + path = get_fullpath (file); + escaped_path = g_markup_escape_text (path, -1); + + g_string_append_len (ret, tmp, end-tmp); + g_string_append_printf (ret,"%s", + shortcut, escaped_path); + g_free (path); + g_free (escaped_path); + g_assert (strlen (tmp) >= strlen (shortcut)); + tmp = end + strlen (shortcut); + } +} + +static char* +parse_for_shortcut (const char* markup, const char* shortcut, const char* file) +{ + GString* ret = g_string_new (""); + char *local_markup = g_strdup (markup); + char *escaped_shortcut = g_markup_escape_text (shortcut, -1); + + char *temp = local_markup; + + for (;*temp;) { + char *end = strchr (temp, '<'); + char *end_of_tag; + + if (!end) { + parse_for_shortcut_plaintext (temp, escaped_shortcut, file, ret); + break; + } + + *end = 0; + parse_for_shortcut_plaintext (temp, escaped_shortcut, file, ret); + *end = '<'; + + /* if this is well-formed, then there should be no '>' within + * the tag. TODO: handle a comment tag better :( */ + end_of_tag = strchr (end, '>'); + if (!end_of_tag) { + g_string_append (ret, end); + break; + } + + g_string_append_len (ret, end, end_of_tag-end+1); + + temp = end_of_tag + 1; + } + g_free (local_markup); + g_free (escaped_shortcut); + return g_string_free (ret, FALSE); +} + +static char* +parse_for_purple_smiley (const char* markup, PurpleSmiley *smiley) +{ + char *file = purple_smiley_get_full_path (smiley); + char *ret = parse_for_shortcut (markup, purple_smiley_get_shortcut (smiley), file); + g_free (file); + return ret; +} + +static char* +parse_for_smiley_list (const char* markup, GHashTable* smileys) +{ + GHashTableIter iter; + char *key, *value; + char *ret = g_strdup (markup); + + g_hash_table_iter_init (&iter, smileys); + while (g_hash_table_iter_next (&iter, (gpointer*)&key, (gpointer*)&value)) + { + char* temp = parse_for_shortcut (ret, key, value); + g_free (ret); + ret = temp; + } + return ret; +} + +char* +smiley_parse_markup (const char* markup, const char *proto_id) +{ + GList *smileys = purple_smileys_get_all (); + char *temp = g_strdup (markup), *temp2; + struct smiley_list *list; + const char *proto_name = "default"; + + if (proto_id != NULL) { + PurplePlugin *proto; + proto = purple_find_prpl (proto_id); + proto_name = proto->info->name; + } + + /* unnecessarily slow, but lets manage for now. */ + for (; smileys; smileys = g_list_next (smileys)) { + temp2 = parse_for_purple_smiley (temp, PURPLE_SMILEY (smileys->data)); + g_free (temp); + temp = temp2; + } + + /* now for each theme smiley, observe that this does look nasty */ + + if (!current_smiley_theme || !(current_smiley_theme->list)) { + printf ("theme does not exist\n"); + return temp; + } + + for (list = current_smiley_theme->list; list; list = list->next) { + if (g_str_equal (list->sml, proto_name)) { + temp2 = parse_for_smiley_list (temp, list->files); + g_free (temp); + temp = temp2; + } + } + + return temp; +} + diff --git a/pidgin/smileyparser.h b/pidgin/smileyparser.h new file mode 100644 index 0000000000..9676ab64bb --- /dev/null +++ b/pidgin/smileyparser.h @@ -0,0 +1,3 @@ + +char* +smiley_parse_markup (const char* markup, const char* sml); -- cgit v1.2.1 From 7f18ef168a60c9c4d79a0d429eb369ff9dcd61d6 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sun, 9 Aug 2009 19:00:51 +0000 Subject: use displaying-im-msg instead of write_conv uiops. --- pidgin/plugins/adiumthemes/webkit.c | 55 +++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 7a6b96b2a6..a0bca3779a 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -80,6 +80,19 @@ char *style_dir = NULL; char *template_path = NULL; char *css_path = NULL; +static void *handle = NULL; +static void* webkit_plugin_get_handle () +{ + if (handle) return handle; + else return (handle = g_malloc (1)); +} + +static void webkit_plugin_free_handle () +{ + purple_signals_disconnect_by_handle (handle); + g_free (handle); +} + static char * replace_message_tokens(char *text, gsize len, PurpleConversation *conv, const char *name, const char *alias, const char *message, PurpleMessageFlags flags, time_t mtime) @@ -349,11 +362,16 @@ static gboolean purple_webkit_execute_script(gpointer _script) return FALSE; } -static void purple_webkit_write_conv(PurpleConversation *conv, const char *name, const char *alias, - const char *message, PurpleMessageFlags flags, time_t mtime) +static gboolean purple_webkit_displaying_im_msg (PurpleAccount *account, + const char* name, + char **pmessage, + PurpleConversation *conv, + PurpleMessageFlags flags, + gpointer data) { - PurpleConversationType type; GtkWidget *webkit; + char *message = *pmessage; + const char *alias = name; /* FIXME: signal doesn't give me alias */ char *stripped; char *message_html; char *msg; @@ -361,21 +379,13 @@ static void purple_webkit_write_conv(PurpleConversation *conv, const char *name, char *script; char *func = "appendMessage"; char *smileyed; + time_t mtime = time (NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */ + struct webkit_script *wk_script; PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); - /* Don't call the usual stuff first. */ - //default_write_conv(conv, name, alias, message, flags, mtime); - type = purple_conversation_get_type(conv); - if (type != PURPLE_CONV_TYPE_IM) - { - /* If it's chat, we have nothing to do. */ - return; - } - /* So it's an IM. Let's play. */ - webkit = get_webkit(conv); - stripped = g_strdup(message); //purple_markup_strip_html(message); + stripped = g_strdup(message); if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) { message_html = outgoing_next_content_html; @@ -407,6 +417,8 @@ static void purple_webkit_write_conv(PurpleConversation *conv, const char *name, g_free(msg); g_free(stripped); g_free(escape); + + return TRUE; /* GtkConv should not handle this guy */ } @@ -551,10 +563,13 @@ plugin_load(PurplePlugin *plugin) if (uiops == NULL) return FALSE; - /* Use the oh-so-useful uiops. Signals? bleh. */ - default_write_conv = uiops->write_conv; - uiops->write_conv = purple_webkit_write_conv; - + purple_signal_connect (pidgin_conversations_get_handle (), + "displaying-im-msg", + webkit_plugin_get_handle (), + PURPLE_CALLBACK(purple_webkit_displaying_im_msg), + NULL); + + default_create_conversation = uiops->create_conversation; uiops->create_conversation = purple_webkit_create_conv; @@ -575,16 +590,20 @@ static gboolean plugin_unload(PurplePlugin *plugin) { GList *list; + /* Restore the default ui-ops */ uiops->write_conv = default_write_conv; uiops->create_conversation = default_create_conversation; uiops->destroy_conversation = default_destroy_conversation; + webkit_plugin_free_handle (); + list = purple_get_conversations (); while (list) { finalize_theme_for_webkit(list->data); list = g_list_next(list); } + return TRUE; } -- cgit v1.2.1 From da14fa1d3e6a0ba459c1fa29572905b5d827c648 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sun, 9 Aug 2009 19:03:38 +0000 Subject: don't restore write-conv uiops. --- pidgin/plugins/adiumthemes/webkit.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index a0bca3779a..1a4c31a8c3 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -47,8 +47,6 @@ static PurpleConversationUiOps *uiops = NULL; -static void (*default_write_conv)(PurpleConversation *conv, const char *name, const char *alias, - const char *message, PurpleMessageFlags flags, time_t mtime); static void (*default_create_conversation)(PurpleConversation *conv); static void (*default_destroy_conversation)(PurpleConversation *conv); @@ -592,7 +590,6 @@ plugin_unload(PurplePlugin *plugin) GList *list; /* Restore the default ui-ops */ - uiops->write_conv = default_write_conv; uiops->create_conversation = default_create_conversation; uiops->destroy_conversation = default_destroy_conversation; -- cgit v1.2.1 From ad10366b2b9b9a9a0cf4d11730fb05d16c0a7519 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sun, 9 Aug 2009 19:32:54 +0000 Subject: create conversation with signals. --- pidgin/plugins/adiumthemes/webkit.c | 40 +++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 1a4c31a8c3..8b40ab95c7 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -47,8 +47,6 @@ static PurpleConversationUiOps *uiops = NULL; -static void (*default_create_conversation)(PurpleConversation *conv); - static void (*default_destroy_conversation)(PurpleConversation *conv); /* Cache the contents of the HTML files */ @@ -283,6 +281,15 @@ get_webkit(PurpleConversation *conv) else return gtkconv->webview; } + +/** + * Called when either a new PurpleConversation is created + * or when a PidginConversation changes its active PurpleConversation + * + * FIXME: it's not at all clear to me as to how + * Adium themes handle the case when the PurpleConversation + * changes. + */ static void init_theme_for_webkit (PurpleConversation *conv) { @@ -301,6 +308,7 @@ init_theme_for_webkit (PurpleConversation *conv) webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); g_object_set_data (G_OBJECT(webkit), "adium-themed", GINT_TO_POINTER(1)); + g_free (basedir); g_free (baseuri); g_free (header); @@ -421,10 +429,15 @@ static gboolean purple_webkit_displaying_im_msg (PurpleAccount *account, static void -purple_webkit_create_conv(PurpleConversation *conv) +webkit_on_converstation_displayed (PidginConversation *gtkconv, gpointer data) +{ + init_theme_for_webkit (gtkconv->active_conv); +} + +static void +webkit_on_conversation_switched (PurpleConversation *conv, gpointer data) { - default_create_conversation(conv); - init_theme_for_webkit(conv); + init_theme_for_webkit (conv); } static void @@ -567,9 +580,17 @@ plugin_load(PurplePlugin *plugin) PURPLE_CALLBACK(purple_webkit_displaying_im_msg), NULL); - - default_create_conversation = uiops->create_conversation; - uiops->create_conversation = purple_webkit_create_conv; + purple_signal_connect (pidgin_conversations_get_handle (), + "conversation-displayed", + webkit_plugin_get_handle (), + PURPLE_CALLBACK(webkit_on_converstation_displayed), + NULL); + + purple_signal_connect (pidgin_conversations_get_handle (), + "conversation-switched", + webkit_plugin_get_handle (), + PURPLE_CALLBACK(webkit_on_conversation_switched), + NULL); default_destroy_conversation = uiops->destroy_conversation; uiops->destroy_conversation = purple_webkit_destroy_conv; @@ -578,7 +599,7 @@ plugin_load(PurplePlugin *plugin) { GList* list = purple_get_conversations (); for (;list; list = g_list_next(list)) - purple_webkit_create_conv (list->data); + init_theme_for_webkit (list->data); } return TRUE; @@ -590,7 +611,6 @@ plugin_unload(PurplePlugin *plugin) GList *list; /* Restore the default ui-ops */ - uiops->create_conversation = default_create_conversation; uiops->destroy_conversation = default_destroy_conversation; webkit_plugin_free_handle (); -- cgit v1.2.1 From b786ef54cb8688edb41c3a9c08dc1ae5b5f2428b Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sun, 9 Aug 2009 20:13:32 +0000 Subject: * removed delete_conversation uiops and instead used signals. * removed escape_string function and use gtk_webview_quote_js_string instead. --- pidgin/plugins/adiumthemes/webkit.c | 51 ++++++++++--------------------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 8b40ab95c7..f73bf71259 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -43,11 +43,11 @@ /* Pidgin headers */ #include #include +#include #include static PurpleConversationUiOps *uiops = NULL; -static void (*default_destroy_conversation)(PurpleConversation *conv); /* Cache the contents of the HTML files */ char *template_html = NULL; /* This is the skeleton: some basic javascript mostly */ @@ -326,33 +326,6 @@ finalize_theme_for_webkit (PurpleConversation *conv) g_object_set_data (G_OBJECT(webview), "adium-themed", NULL); } -static char * -escape_message(char *text) -{ - GString *str = g_string_new(NULL); - char *cur = text; - - while (cur && *cur) { - switch (*cur) { - case '\\': - g_string_append(str, "\\\\"); - break; - case '\"': - g_string_append(str, "\\\""); - break; - case '\r': - g_string_append(str, "
"); - break; - case '\n': - break; - default: - g_string_append_c(str, *cur); - } - cur++; - } - return g_string_free(str, FALSE); -} - struct webkit_script { GtkWidget *webkit; char *script; @@ -390,6 +363,7 @@ static gboolean purple_webkit_displaying_im_msg (PurpleAccount *account, struct webkit_script *wk_script; PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); + fprintf (stderr, "hmm.. here %s %s\n", name, message); webkit = get_webkit(conv); stripped = g_strdup(message); @@ -410,8 +384,8 @@ static gboolean purple_webkit_displaying_im_msg (PurpleAccount *account, smileyed = smiley_parse_markup(stripped, conv->account->protocol_id); msg = replace_message_tokens(message_html, 0, conv, name, alias, smileyed, flags, mtime); - escape = escape_message(msg); - script = g_strdup_printf("%s(\"%s\")", func, escape); + escape = gtk_webview_quote_js_string (msg); + script = g_strdup_printf("%s(%s)", func, escape); wk_script = g_new0(struct webkit_script, 1); wk_script->script = script; @@ -441,9 +415,12 @@ webkit_on_conversation_switched (PurpleConversation *conv, gpointer data) } static void -purple_webkit_destroy_conv(PurpleConversation *conv) +webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data) { - default_destroy_conversation(conv); + /* + * I'm not sure if I need to do anything here, but let's keep + * this anyway + */ } static GList* @@ -592,8 +569,11 @@ plugin_load(PurplePlugin *plugin) PURPLE_CALLBACK(webkit_on_conversation_switched), NULL); - default_destroy_conversation = uiops->destroy_conversation; - uiops->destroy_conversation = purple_webkit_destroy_conv; + purple_signal_connect (pidgin_conversations_get_handle (), + "conversation-hiding", + webkit_plugin_get_handle (), + PURPLE_CALLBACK(webkit_on_conversation_hiding), + NULL); /* finally update each of the existing conversation windows */ { @@ -610,9 +590,6 @@ plugin_unload(PurplePlugin *plugin) { GList *list; - /* Restore the default ui-ops */ - uiops->destroy_conversation = default_destroy_conversation; - webkit_plugin_free_handle (); list = purple_get_conversations (); -- cgit v1.2.1 From a8e6d1b0db21ff18bdf513663d9fb0ce62803667 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 01:21:57 +0000 Subject: Well, chat is sorta kinda working. --- pidgin/plugins/adiumthemes/webkit.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index f73bf71259..2b6e925c62 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -341,7 +341,8 @@ static gboolean purple_webkit_execute_script(gpointer _script) return FALSE; } -static gboolean purple_webkit_displaying_im_msg (PurpleAccount *account, + +static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, const char* name, char **pmessage, PurpleConversation *conv, @@ -401,6 +402,16 @@ static gboolean purple_webkit_displaying_im_msg (PurpleAccount *account, return TRUE; /* GtkConv should not handle this guy */ } +static gboolean webkit_on_displaying_chat_msg (PurpleAccount *account, + const char *who, + char **message, + PurpleConversation *conv, + PurpleMessageFlags flags, + gpointer userdata) +{ + /* handle exactly like an IM message */ + return webkit_on_displaying_im_msg (account, who, message, conv, flags, NULL); +} static void webkit_on_converstation_displayed (PidginConversation *gtkconv, gpointer data) @@ -554,9 +565,15 @@ plugin_load(PurplePlugin *plugin) purple_signal_connect (pidgin_conversations_get_handle (), "displaying-im-msg", webkit_plugin_get_handle (), - PURPLE_CALLBACK(purple_webkit_displaying_im_msg), + PURPLE_CALLBACK(webkit_on_displaying_im_msg), NULL); + purple_signal_connect (pidgin_conversations_get_handle (), + "displaying-chat-msg", + webkit_plugin_get_handle (), + PURPLE_CALLBACK(webkit_on_displaying_chat_msg), + NULL); + purple_signal_connect (pidgin_conversations_get_handle (), "conversation-displayed", webkit_plugin_get_handle (), -- cgit v1.2.1 From af7ef23fc3a3be57fe2c4416eee425c9799feddc Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 01:34:48 +0000 Subject: Changed the Author added copyright, etc. --- pidgin/plugins/adiumthemes/webkit.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 2b6e925c62..014a07247c 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -1,5 +1,6 @@ /* - * Adium Webkit views + * Adium Message Styles + * Copyright (C) 2009 Arnold Noronha * Copyright (C) 2007 * * This program is free software; you can redistribute it and/or @@ -18,13 +19,14 @@ * 02111-1307, USA. */ -/* This plugins is basically Sadrul's x-chat plugin, but with Webkit - * instead of xtext. - */ - #define PLUGIN_ID "gtk-webview-adium-ims" #define PLUGIN_NAME "webview-adium-ims" -#define PLUGIN_AUTHOR "Sean Egan " + +/* + * A lot of this was originally written by Sean Egan, but I think I've + * rewrote enough to replace the author for now. + */ +#define PLUGIN_AUTHOR "Arnold Noronha " #define PURPLE_PLUGINS "Hell yeah" /* System headers */ @@ -46,8 +48,6 @@ #include #include -static PurpleConversationUiOps *uiops = NULL; - /* Cache the contents of the HTML files */ char *template_html = NULL; /* This is the skeleton: some basic javascript mostly */ -- cgit v1.2.1 From d880923511959767c7be5fdbfeaaa2f83c74c0bf Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 02:11:21 +0000 Subject: temporary commit. --- pidgin/plugins/adiumthemes/webkit.c | 171 +++++++++++++++++++++++------------- 1 file changed, 111 insertions(+), 60 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 014a07247c..8ac9ff2d98 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -48,35 +48,80 @@ #include #include +/* + * I'm going to allow a different style for each PidginConversation. + * This way I can do two things: 1) change the theme on the fly and not + * change existing themes, and 2) Use a different theme for IMs and + * chats. + */ +typedef struct _PidginMessageStyle { + int ref_counter; + + /* paths */ + char *style_dir; + char *template_path; + char *css_path; + + /* caches */ + char *template_html; + char *style_name; + char *incoming_content_html; + char *outgoing_content_html; + char *incoming_next_content_html; + char *outgoing_next_content_html; + char *status_html; + char *basestyle_css; +} PidginMessageStyle; + +static GList *style_list; +static void *handle = NULL; + +static PidginMessageStyle* pidgin_message_style_new () +{ + PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1); + ret->ref_counter ++; + + style_list = g_list_append (style_list, ret); + return ret; +} + +static void pidgin_message_style_unref (PidginMessageStyle *style) +{ + style->ref_counter--; + if (style->ref_counter) return; + + g_free (style->style_dir); + g_free (style->template_path); + g_free (style->css_path); + + g_free (style->template_html); + g_free (style->incoming_content_html); + g_free (style->outgoing_content_html); + g_free (style->outgoing_next_content_html); + g_free (style->status_html); + g_free (style->basestyle_css); + + g_list_remove (style_list, style); + g_free (style); +} + +static PidginMessageStyle* +pidgin_message_style_load (const char* styledir) +{ + /* is this style already loaded? */ + GList* cur = style_list; + PidginMessageStyle *ret = NULL; + for (; cur; cur = g_list_next (cur)) { + if (g_str_equal (styldir, ((PidginMessageStyle*) cur->data)->styledir)) + return (PidginMessageStyle*) cur->data; + } + + /* else we need to load it */ + ret = pidgin_message_style_new (); + +} -/* Cache the contents of the HTML files */ -char *template_html = NULL; /* This is the skeleton: some basic javascript mostly */ -char *header_html = NULL; /* This is the first thing to be appended to any conversation */ -char *footer_html = NULL; /* This is the last thing appended to the conversation */ -char *incoming_content_html = NULL; /* This is a received message */ -char *outgoing_content_html = NULL; /* And a sent one */ -char *incoming_next_content_html = NULL; /* The same things, but used when someone sends multiple subsequent */ -char *outgoing_next_content_html = NULL; /* messages in a row */ -char *status_html = NULL; /* Non-IM status messages */ -char *basestyle_css = NULL; /* Shared CSS attributes */ - -/* Cache their lenghts too, to pass into g_string_new_len, avoiding crazy allocation */ -gsize template_html_len = 0; -gsize header_html_len = 0; -gsize footer_html_len = 0; -gsize incoming_content_html_len = 0; -gsize outgoing_content_html_len = 0; -gsize incoming_next_content_html_len = 0; -gsize outgoing_next_content_html_len = 0; -gsize status_html_len = 0; -gsize basestyle_css_len = 0; - -/* And their paths */ -char *style_dir = NULL; -char *template_path = NULL; -char *css_path = NULL; -static void *handle = NULL; static void* webkit_plugin_get_handle () { if (handle) return handle; @@ -434,65 +479,71 @@ webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data) */ } +/** + * Get each of the files corresponding to each variant. + */ static GList* -get_theme_files() +get_theme_files(PidginMessageStyle *style) { GList *ret = NULL; GDir *variants; - char *globe = g_build_filename(DATADIR, "pidgin", "webkit", "styles", NULL); const char *css_file; char *css; + char *variant_dir; - if (style_dir != NULL) { - char *variant_dir = g_build_filename(style_dir, "Contents", "Resources", "Variants", NULL); - variants = g_dir_open(variant_dir, 0, NULL); - while ((css_file = g_dir_read_name(variants)) != NULL) { - if (!strstr(css_file, ".css")) { - continue; - } - css = g_build_filename(variant_dir, css_file, NULL); - ret = g_list_append(ret,css); - } - g_dir_close(variants); - g_free(variant_dir); + g_assert (style->style_dir); + variant_dir = g_build_filename(style_dir, "Contents", "Resources", "Variants", NULL); + + variants = g_dir_open(variant_dir, 0, NULL); + if (!variants) return NULL; + + while ((css_file = g_dir_read_name(variants)) != NULL) { + if (!g_str_has_suffix (css_file, ".css")) + continue; + + css = g_build_filename(variant_dir, css_file, NULL); + ret = g_list_append(ret, css); } - g_free(globe); + + g_dir_close(variants); + g_free(variant_dir); ret = g_list_sort (ret, (GCompareFunc)g_strcmp0); return ret; } static void -variant_set_default () +variant_set_default (PidginMessageStyle* style) { + GList *all, *iter; + char *css_path = purple_prefs_get_string ("/plugins/gtk/adiumthemes/csspath"); - GList* all; - GList* copy; - css_path = g_strdup (purple_prefs_get_string ("/plugins/gtk/adiumthemes/csspath")); - - if (g_file_test (css_path, G_FILE_TEST_EXISTS)) + g_free (style->css_path); + if (g_str_has_prefix (css_path, style->style_dir) && + g_file_test (css_path, G_FILE_TEST_EXISTS)) { + style->css_path = g_strdup (css_path); return; + } else { + /* something about the theme has changed */ g_free (css_path); css_path = NULL; } - all = get_theme_files (); - copy = all; - if (css_path) { - g_free (css_path); - css_path = NULL; - } + all = get_theme_files (PidginMessageStyle* style); + if (all) { - css_path = g_strdup (all->data); + style->css_path = g_strdup (all->data); purple_prefs_set_string ("/plugins/gtk/adiumthemes/csspath", css_path); } - while (all) { - g_free (all->data); - all = g_list_next(all); - } - g_list_free (copy); + for (iter = all; iter; iter = g_list_next (iter)) + g_free (iter->data); + + g_list_free (all); + + g_free (style->css_path); + style->css_path = css_path; } static gboolean -- cgit v1.2.1 From ab0b0aec391ed8daa3a2e0a1c1d2c428498a39c2 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 02:38:12 +0000 Subject: Another temporary commit that will not compile. Separated the code to load the message style. --- pidgin/plugins/adiumthemes/webkit.c | 133 ++++++++++++++++++++++-------------- 1 file changed, 81 insertions(+), 52 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 8ac9ff2d98..7ba7ee49b8 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -74,6 +74,7 @@ typedef struct _PidginMessageStyle { } PidginMessageStyle; static GList *style_list; +static PidginMessageStyle *cur_style = NULL; static void *handle = NULL; static PidginMessageStyle* pidgin_message_style_new () @@ -105,12 +106,15 @@ static void pidgin_message_style_unref (PidginMessageStyle *style) g_free (style); } +static void variant_set_default (PidginMessageStyle* style); static PidginMessageStyle* pidgin_message_style_load (const char* styledir) { /* is this style already loaded? */ - GList* cur = style_list; + GList *cur = style_list; + char *file; /* temporary variable */ PidginMessageStyle *ret = NULL; + for (; cur; cur = g_list_next (cur)) { if (g_str_equal (styldir, ((PidginMessageStyle*) cur->data)->styledir)) return (PidginMessageStyle*) cur->data; @@ -118,7 +122,80 @@ pidgin_message_style_load (const char* styledir) /* else we need to load it */ ret = pidgin_message_style_new (); + ret->style_dir = g_strdup (style); + + /* find some variant file (or load from user's settings) */ + variant_set_default (style); + + /* load all other files */ + + /* The template path can either come from the theme, or can + * be stock Template.html that comes with the plugin */ + style->template_path = g_build_filename(styledir, "Contents", "Resources", "Template.html", NULL); + + if (!g_file_test(style->template_path, G_FILE_TEST_EXISTS)) { + g_free (style->template_path); + style->template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); + } + + if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) { + pidgin_message_style_free (style); + return NULL; + } + + file = g_build_filename(style_dir, "Contents", "Resources", "Status.html", NULL); + if (!g_file_get_contents(file, &style->status_html, NULL, NULL)) { + pidgin_message_style_free (style); + g_free (file); + return NULL; + } + g_free (file); + + file = g_build_filename(style_dir, "Contents", "Resources", "main.css", NULL); + if (!g_file_get_contents(file, &basestyle_css, NULL, NULL)) { + pidgin_message_style_free (style); + g_free (file); + return NULL; + } + g_free (file); + file = g_build_filename(style_dir, "Contents", "Resources", "Header.html", NULL); + g_file_get_contents(file, &style->header_html, NULL, NULL); + g_free (file); + + file = g_build_filename(style_dir, "Contents", "Resources", "Footer.html", NULL); + g_file_get_contents(file, &style->footer_html, NULL, NULL); + g_free (file); + + + + file = g_build_filename(style_dir, "Contents", "Resources", "Incoming", "Content.html", NULL); + if (!g_file_get_contents(file, &style->incoming_content_html, &NULL, NULL)) { + pidgin_message_style_free (style); + g_free (file); + return NULL; + } + g_free (file); + + + /* according to the spec, the following are not necessary files */ + file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); + if (!g_file_get_contents(file, &style->incoming_next_content_html, NULL, NULL)) { + style->incoming_next_content_html = g_strdup (style->incoming_content_html); + } + g_free (file); + + file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "Content.html", NULL); + if (!g_file_get_contents(file, &style->outgoing_content_html, NULL, NULL)) { + style->outgoing_content_html = g_strdup(style->incoming_content_html); + } + g_free (file); + + file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); + if (!g_file_get_contents(file, &style->outgoing_next_content_html, NULL, NULL)) { + outgoing_next_content_html = g_strdup (outgoing_content_html); + } + } @@ -541,15 +618,12 @@ variant_set_default (PidginMessageStyle* style) g_free (iter->data); g_list_free (all); - - g_free (style->css_path); - style->css_path = css_path; } static gboolean plugin_load(PurplePlugin *plugin) { - char *file; + char *cur_style; if (g_path_is_absolute (purple_user_dir())) style_dir = g_build_filename(purple_user_dir(), "style", NULL); @@ -559,54 +633,9 @@ plugin_load(PurplePlugin *plugin) g_free (cur); } - variant_set_default (); - if (!css_path) - return FALSE; - - - template_path = g_build_filename(style_dir, "Contents", "Resources", "Template.html", NULL); - if (!g_file_test(template_path, G_FILE_TEST_EXISTS)) { - g_free(template_path); - template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); - } - if (!g_file_get_contents(template_path, &template_html, &template_html_len, NULL)) - return FALSE; + cur_style = pidgin_message_style_load (style_dir); - file = g_build_filename(style_dir, "Contents", "Resources", "Header.html", NULL); - g_file_get_contents(file, &header_html, &header_html_len, NULL); - - file = g_build_filename(style_dir, "Contents", "Resources", "Footer.html", NULL); - g_file_get_contents(file, &footer_html, &footer_html_len, NULL); - - file = g_build_filename(style_dir, "Contents", "Resources", "Incoming", "Content.html", NULL); - if (!g_file_get_contents(file, &incoming_content_html, &incoming_content_html_len, NULL)) - return FALSE; - - file = g_build_filename(style_dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); - if (!g_file_get_contents(file, &incoming_next_content_html, &incoming_next_content_html_len, NULL)) { - incoming_next_content_html = incoming_content_html; - incoming_next_content_html_len = incoming_content_html_len; - } - - file = g_build_filename(style_dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); - if (!g_file_get_contents(file, &outgoing_content_html, &outgoing_content_html_len, NULL)) { - outgoing_content_html = incoming_content_html; - outgoing_content_html_len = incoming_content_html_len; - } - - file = g_build_filename(style_dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); - if (!g_file_get_contents(file, &outgoing_next_content_html, &outgoing_next_content_html_len, NULL)) { - outgoing_next_content_html = outgoing_content_html; - outgoing_next_content_html_len = outgoing_content_html_len; - } - - - file = g_build_filename(style_dir, "Contents", "Resources", "Status.html", NULL); - if (!g_file_get_contents(file, &status_html, &status_html_len, NULL)) - return FALSE; - - file = g_build_filename(style_dir, "Contents", "Resources", "main.css", NULL); - g_file_get_contents(file, &basestyle_css, &basestyle_css_len, NULL); + if (!cur_style) return; uiops = pidgin_conversations_get_conv_ui_ops(); -- cgit v1.2.1 From 98cfdd3cff9c4c12837c941314bd3463bc7c8be2 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 03:25:35 +0000 Subject: Ok, good part of this work of moving global variables to defined styles is done. Now, I still get a crash while changing the variant. --- pidgin/plugins/adiumthemes/webkit.c | 176 ++++++++++++++++++++++-------------- 1 file changed, 108 insertions(+), 68 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 7ba7ee49b8..78c6b1228c 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -64,7 +64,8 @@ typedef struct _PidginMessageStyle { /* caches */ char *template_html; - char *style_name; + char *header_html; + char *footer_html; char *incoming_content_html; char *outgoing_content_html; char *incoming_next_content_html; @@ -73,9 +74,9 @@ typedef struct _PidginMessageStyle { char *basestyle_css; } PidginMessageStyle; -static GList *style_list; -static PidginMessageStyle *cur_style = NULL; -static void *handle = NULL; +static GList *style_list; /**< List of PidginMessageStyles */ +static char *cur_style_dir = NULL; +static void *handle = NULL; static PidginMessageStyle* pidgin_message_style_new () { @@ -102,7 +103,7 @@ static void pidgin_message_style_unref (PidginMessageStyle *style) g_free (style->status_html); g_free (style->basestyle_css); - g_list_remove (style_list, style); + style_list = g_list_remove (style_list, style); g_free (style); } @@ -113,16 +114,18 @@ pidgin_message_style_load (const char* styledir) /* is this style already loaded? */ GList *cur = style_list; char *file; /* temporary variable */ - PidginMessageStyle *ret = NULL; + PidginMessageStyle *style = NULL; + + g_assert (styledir); for (; cur; cur = g_list_next (cur)) { - if (g_str_equal (styldir, ((PidginMessageStyle*) cur->data)->styledir)) + if (g_str_equal (styledir, ((PidginMessageStyle*) cur->data)->style_dir)) return (PidginMessageStyle*) cur->data; } /* else we need to load it */ - ret = pidgin_message_style_new (); - ret->style_dir = g_strdup (style); + style = pidgin_message_style_new (); + style->style_dir = g_strdup (styledir); /* find some variant file (or load from user's settings) */ variant_set_default (style); @@ -139,39 +142,35 @@ pidgin_message_style_load (const char* styledir) } if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) { - pidgin_message_style_free (style); + pidgin_message_style_unref (style); return NULL; } - file = g_build_filename(style_dir, "Contents", "Resources", "Status.html", NULL); + file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL); if (!g_file_get_contents(file, &style->status_html, NULL, NULL)) { - pidgin_message_style_free (style); + pidgin_message_style_unref (style); g_free (file); return NULL; } g_free (file); - file = g_build_filename(style_dir, "Contents", "Resources", "main.css", NULL); - if (!g_file_get_contents(file, &basestyle_css, NULL, NULL)) { - pidgin_message_style_free (style); - g_free (file); - return NULL; - } + file = g_build_filename(styledir, "Contents", "Resources", "main.css", NULL); + g_file_get_contents(file, &style->basestyle_css, NULL, NULL); g_free (file); - file = g_build_filename(style_dir, "Contents", "Resources", "Header.html", NULL); + file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL); g_file_get_contents(file, &style->header_html, NULL, NULL); g_free (file); - file = g_build_filename(style_dir, "Contents", "Resources", "Footer.html", NULL); + file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL); g_file_get_contents(file, &style->footer_html, NULL, NULL); g_free (file); - file = g_build_filename(style_dir, "Contents", "Resources", "Incoming", "Content.html", NULL); - if (!g_file_get_contents(file, &style->incoming_content_html, &NULL, NULL)) { - pidgin_message_style_free (style); + file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); + if (!g_file_get_contents(file, &style->incoming_content_html, NULL, NULL)) { + pidgin_message_style_unref (style); g_free (file); return NULL; } @@ -193,9 +192,10 @@ pidgin_message_style_load (const char* styledir) file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); if (!g_file_get_contents(file, &style->outgoing_next_content_html, NULL, NULL)) { - outgoing_next_content_html = g_strdup (outgoing_content_html); + style->outgoing_next_content_html = g_strdup (style->outgoing_content_html); } + return style; } @@ -212,8 +212,15 @@ static void webkit_plugin_free_handle () } static char * -replace_message_tokens(char *text, gsize len, PurpleConversation *conv, const char *name, const char *alias, - const char *message, PurpleMessageFlags flags, time_t mtime) +replace_message_tokens( + char *text, + gsize len, + PurpleConversation *conv, + const char *name, + const char *alias, + const char *message, + PurpleMessageFlags flags, + time_t mtime) { GString *str = g_string_new_len(NULL, len); char *cur = text; @@ -332,7 +339,6 @@ replace_header_tokens(char *text, gsize len, PurpleConversation *conv) replace = purple_utf8_strftime(format ? format : "%X", NULL); g_free(format); } else { - // cur++; continue; } @@ -354,7 +360,7 @@ replace_header_tokens(char *text, gsize len, PurpleConversation *conv) } static char * -replace_template_tokens(char *text, int len, char *header, char *footer) { +replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *header, char *footer) { GString *str = g_string_new_len(NULL, len); char **ms = g_strsplit(text, "%@", 6); @@ -368,17 +374,17 @@ replace_template_tokens(char *text, int len, char *header, char *footer) { g_string_append(str, ms[0]); g_string_append(str, "file://"); - base = g_build_filename (style_dir, "Contents", "Resources", "Template.html", NULL); + base = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL); g_string_append(str, base); g_free (base); g_string_append(str, ms[1]); - if (basestyle_css) - g_string_append(str, basestyle_css); + if (style->basestyle_css) + g_string_append(str, style->basestyle_css); g_string_append(str, ms[2]); - if (css_path) { + if (style->css_path) { g_string_append(str, "file://"); - g_string_append(str, css_path); + g_string_append(str, style->css_path); } g_string_append(str, ms[3]); @@ -413,23 +419,28 @@ get_webkit(PurpleConversation *conv) * changes. */ static void -init_theme_for_webkit (PurpleConversation *conv) +init_theme_for_webkit (PurpleConversation *conv, char *style_dir) { GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; char *header, *footer; char *template; - char* basedir = g_build_filename (style_dir, "Contents", "Resources", "Template.html", NULL); - char* baseuri = g_strdup_printf ("file://%s", basedir); + char* basedir; + char* baseuri; + PidginMessageStyle *style; + style = pidgin_message_style_load (style_dir); + g_assert (style); - header = replace_header_tokens(header_html, header_html_len, conv); - footer = replace_header_tokens(footer_html, footer_html_len, conv); - template = replace_template_tokens(template_html, template_html_len + header_html_len, header, footer); + basedir = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL); + baseuri = g_strdup_printf ("file://%s", basedir); + header = replace_header_tokens(style->header_html, strlen(style->header_html), conv); + footer = replace_header_tokens(style->footer_html, strlen(style->footer_html), conv); + template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); if (!g_object_get_data (G_OBJECT(webkit), "adium-themed")) webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); - g_object_set_data (G_OBJECT(webkit), "adium-themed", GINT_TO_POINTER(1)); + g_object_set_data (G_OBJECT(webkit), "adium-themed", style); g_free (basedir); g_free (baseuri); @@ -444,8 +455,11 @@ static void finalize_theme_for_webkit (PurpleConversation *conv) { GtkWidget *webview = PIDGIN_CONVERSATION(conv)->webview; + PidginMessageStyle *style = g_object_get_data (G_OBJECT(webview), "adium-themed"); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), "", "text/html", "UTF-8", ""); g_object_set_data (G_OBJECT(webview), "adium-themed", NULL); + pidgin_message_style_unref (style); } struct webkit_script { @@ -485,23 +499,26 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, struct webkit_script *wk_script; PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); + PidginMessageStyle *style; fprintf (stderr, "hmm.. here %s %s\n", name, message); webkit = get_webkit(conv); stripped = g_strdup(message); + style = g_object_get_data (G_OBJECT (webkit), "adium-themed"); + if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) { - message_html = outgoing_next_content_html; + message_html = style->outgoing_next_content_html; func = "appendNextMessage"; } else if (flags & PURPLE_MESSAGE_SEND) { - message_html = outgoing_content_html; + message_html = style->outgoing_content_html; } else if (flags & PURPLE_MESSAGE_RECV && old_flags & PURPLE_MESSAGE_RECV) { - message_html = incoming_next_content_html; + message_html = style->incoming_next_content_html; func = "appendNextMessage"; } else if (flags & PURPLE_MESSAGE_RECV) { - message_html = incoming_content_html; + message_html = style->incoming_content_html; } else { - message_html = status_html; + message_html = style->status_html; } purple_conversation_set_data(conv, "webkit-lastflags", GINT_TO_POINTER(flags)); @@ -538,13 +555,13 @@ static gboolean webkit_on_displaying_chat_msg (PurpleAccount *account, static void webkit_on_converstation_displayed (PidginConversation *gtkconv, gpointer data) { - init_theme_for_webkit (gtkconv->active_conv); + init_theme_for_webkit (gtkconv->active_conv, cur_style_dir); } static void webkit_on_conversation_switched (PurpleConversation *conv, gpointer data) { - init_theme_for_webkit (conv); + init_theme_for_webkit (conv, cur_style_dir); } static void @@ -569,7 +586,7 @@ get_theme_files(PidginMessageStyle *style) char *variant_dir; g_assert (style->style_dir); - variant_dir = g_build_filename(style_dir, "Contents", "Resources", "Variants", NULL); + variant_dir = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", NULL); variants = g_dir_open(variant_dir, 0, NULL); if (!variants) return NULL; @@ -593,7 +610,7 @@ static void variant_set_default (PidginMessageStyle* style) { GList *all, *iter; - char *css_path = purple_prefs_get_string ("/plugins/gtk/adiumthemes/csspath"); + const char *css_path = purple_prefs_get_string ("/plugins/gtk/adiumthemes/csspath"); g_free (style->css_path); if (g_str_has_prefix (css_path, style->style_dir) && @@ -603,11 +620,10 @@ variant_set_default (PidginMessageStyle* style) } else { /* something about the theme has changed */ - g_free (css_path); css_path = NULL; } - all = get_theme_files (PidginMessageStyle* style); + all = get_theme_files (style); if (all) { style->css_path = g_strdup (all->data); @@ -623,24 +639,25 @@ variant_set_default (PidginMessageStyle* style) static gboolean plugin_load(PurplePlugin *plugin) { - char *cur_style; + PidginMessageStyle *_style; /* temp */ if (g_path_is_absolute (purple_user_dir())) - style_dir = g_build_filename(purple_user_dir(), "style", NULL); + cur_style_dir = g_build_filename(purple_user_dir(), "style", NULL); else { char* cur = g_get_current_dir (); - style_dir = g_build_filename (cur, purple_user_dir(), "style", NULL); + cur_style_dir = g_build_filename (cur, purple_user_dir(), "style", NULL); g_free (cur); } - - cur_style = pidgin_message_style_load (style_dir); - if (!cur_style) return; - - uiops = pidgin_conversations_get_conv_ui_ops(); - if (uiops == NULL) + _style = pidgin_message_style_load (cur_style_dir); + if (!_style) { + g_free (cur_style_dir); + cur_style_dir = NULL; return FALSE; + } + + pidgin_message_style_unref (_style); purple_signal_connect (pidgin_conversations_get_handle (), "displaying-im-msg", @@ -676,7 +693,7 @@ plugin_load(PurplePlugin *plugin) { GList* list = purple_get_conversations (); for (;list; list = g_list_next(list)) - init_theme_for_webkit (list->data); + init_theme_for_webkit (list->data, cur_style_dir); } return TRUE; @@ -704,8 +721,9 @@ variant_update_conversation (PurpleConversation *conv) { PidginConversation *gtkconv = PIDGIN_CONVERSATION (conv); WebKitWebView *webview = WEBKIT_WEB_VIEW (gtkconv->webview); - char* script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", css_path); - printf ("css_path: %s\n", css_path); + PidginMessageStyle *style = (PidginMessageStyle*) g_object_get_data (G_OBJECT(webview), "adium-themed"); + + char* script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", style->css_path); webkit_web_view_execute_script (webview, script); g_free (script); } @@ -714,16 +732,28 @@ static void variant_changed (GtkWidget* combobox, gpointer null) { char *name, *name_with_ext; + char *css_path; GList *list; + PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); + + g_assert (style); + + /* it is possible that the theme changed by this point, so we check + * that first */ - g_free (css_path); name = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combobox)); name_with_ext = g_strdup_printf ("%s.css", name); g_free (name); - css_path = g_build_filename (style_dir, "Contents", "Resources", "Variants", name_with_ext, NULL); + css_path = g_build_filename (style->style_dir, "Contents", "Resources", "Variants", name_with_ext, NULL); + + if (!g_file_test (css_path, G_FILE_TEST_EXISTS)) { + goto cleanup; + } + + g_free (style->css_path); + style->css_path = g_strdup (css_path); purple_prefs_set_string ("/plugins/gtk/adiumthemes/csspath", css_path); - g_free (name_with_ext); /* update each conversation */ list = purple_get_conversations (); @@ -731,15 +761,25 @@ variant_changed (GtkWidget* combobox, gpointer null) variant_update_conversation (list->data); list = g_list_next(list); } + +cleanup: + g_free (css_path); + g_free (name_with_ext); + pidgin_message_style_unref (style); } static GtkWidget * -get_config_frame(PurplePlugin *plugin) { - GList *themes = get_theme_files(); +get_config_frame(PurplePlugin *plugin) +{ + PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); + GList *themes = get_theme_files(style); GList *theme = themes; char *curdir = NULL; GtkWidget *combobox = gtk_combo_box_new_text(); int def = -1, index = 0; + char* css_path = style->css_path; + + pidgin_message_style_unref (style); while (theme) { char *basename = g_path_get_basename(theme->data); -- cgit v1.2.1 From 4f4d882005045636919e6076674346d6fbcb08da Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 05:03:49 +0000 Subject: more changes, but I still can't find the stupid bug. Valgrind gives me some information about the uninialized bytes, but it doesn't make sense. :(x --- pidgin/plugins/adiumthemes/webkit.c | 66 ++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 78c6b1228c..8f308aa15f 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -48,6 +48,10 @@ #include #include + +/* GObject data keys */ +#define MESSAGE_STYLE_KEY "message-style" + /* * I'm going to allow a different style for each PidginConversation. * This way I can do two things: 1) change the theme on the fly and not @@ -78,10 +82,17 @@ static GList *style_list; /**< List of PidginMessageStyles */ static char *cur_style_dir = NULL; static void *handle = NULL; -static PidginMessageStyle* pidgin_message_style_new () +static PidginMessageStyle* pidgin_message_style_new (const char* styledir) { PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1); + GList *iter; + + /* sanity check */ + for (iter = style_list; iter; iter = g_list_next (iter)) + g_assert (!g_str_equal (((PidginMessageStyle*)iter->data)->style_dir, styledir)); + ret->ref_counter ++; + ret->style_dir = g_strdup (styledir); style_list = g_list_append (style_list, ret); return ret; @@ -89,6 +100,8 @@ static PidginMessageStyle* pidgin_message_style_new () static void pidgin_message_style_unref (PidginMessageStyle *style) { + if (!style) return; + style->ref_counter--; if (style->ref_counter) return; @@ -124,8 +137,7 @@ pidgin_message_style_load (const char* styledir) } /* else we need to load it */ - style = pidgin_message_style_new (); - style->style_dir = g_strdup (styledir); + style = pidgin_message_style_new (styledir); /* find some variant file (or load from user's settings) */ variant_set_default (style); @@ -166,8 +178,6 @@ pidgin_message_style_load (const char* styledir) g_file_get_contents(file, &style->footer_html, NULL, NULL); g_free (file); - - file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); if (!g_file_get_contents(file, &style->incoming_content_html, NULL, NULL)) { pidgin_message_style_unref (style); @@ -427,7 +437,10 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) char* basedir; char* baseuri; - PidginMessageStyle *style; + PidginMessageStyle *style, *oldStyle; + oldStyle = g_object_get_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY); + if (oldStyle) return; + style = pidgin_message_style_load (style_dir); g_assert (style); @@ -437,10 +450,10 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) footer = replace_header_tokens(style->footer_html, strlen(style->footer_html), conv); template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); - if (!g_object_get_data (G_OBJECT(webkit), "adium-themed")) - webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); - - g_object_set_data (G_OBJECT(webkit), "adium-themed", style); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); + pidgin_message_style_unref (oldStyle); + g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style); + g_free (basedir); g_free (baseuri); @@ -455,10 +468,11 @@ static void finalize_theme_for_webkit (PurpleConversation *conv) { GtkWidget *webview = PIDGIN_CONVERSATION(conv)->webview; - PidginMessageStyle *style = g_object_get_data (G_OBJECT(webview), "adium-themed"); + PidginMessageStyle *style = g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY); webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), "", "text/html", "UTF-8", ""); - g_object_set_data (G_OBJECT(webview), "adium-themed", NULL); + + g_object_set_data (G_OBJECT(webview), MESSAGE_STYLE_KEY, NULL); pidgin_message_style_unref (style); } @@ -505,7 +519,7 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, webkit = get_webkit(conv); stripped = g_strdup(message); - style = g_object_get_data (G_OBJECT (webkit), "adium-themed"); + style = g_object_get_data (G_OBJECT (webkit), MESSAGE_STYLE_KEY); if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) { message_html = style->outgoing_next_content_html; @@ -721,9 +735,12 @@ variant_update_conversation (PurpleConversation *conv) { PidginConversation *gtkconv = PIDGIN_CONVERSATION (conv); WebKitWebView *webview = WEBKIT_WEB_VIEW (gtkconv->webview); - PidginMessageStyle *style = (PidginMessageStyle*) g_object_get_data (G_OBJECT(webview), "adium-themed"); + PidginMessageStyle *style = (PidginMessageStyle*) g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY); + char *script; + + g_assert (style && style->css_path); - char* script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", style->css_path); + script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", style->css_path); webkit_web_view_execute_script (webview, script); g_free (script); } @@ -772,19 +789,19 @@ static GtkWidget * get_config_frame(PurplePlugin *plugin) { PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); - GList *themes = get_theme_files(style); - GList *theme = themes; + GList *variants = get_theme_files(style); + GList *iter = variants; char *curdir = NULL; GtkWidget *combobox = gtk_combo_box_new_text(); int def = -1, index = 0; - char* css_path = style->css_path; + char* css_path = g_strdup (style->css_path); pidgin_message_style_unref (style); - while (theme) { - char *basename = g_path_get_basename(theme->data); - char *dirname = g_path_get_dirname(theme->data); - if (!curdir || strcmp(curdir, dirname)) { + for (; iter; iter = g_list_next (iter)) { + char *basename = g_path_get_basename(iter->data); + char *dirname = g_path_get_dirname(iter->data); + if (!curdir || !g_str_equal (curdir, dirname)) { char *plist, *plist_xml; gsize plist_len; xmlnode *node; @@ -818,12 +835,15 @@ get_config_frame(PurplePlugin *plugin) if (g_str_has_suffix (css_path, basename)) def = index; index ++; - theme = theme->next; + + g_free (basename); + g_free (dirname); } gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), def); g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL); + g_free (css_path); return combobox; } -- cgit v1.2.1 From a46e00074ed8eee7c7d027d370cd7089996547c5 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 05:36:10 +0000 Subject: woo, fixed the bug. Now things are looking wonderfully stable. --- pidgin/plugins/adiumthemes/webkit.c | 44 +++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 8f308aa15f..c26c59ac61 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -89,9 +89,9 @@ static PidginMessageStyle* pidgin_message_style_new (const char* styledir) /* sanity check */ for (iter = style_list; iter; iter = g_list_next (iter)) - g_assert (!g_str_equal (((PidginMessageStyle*)iter->data)->style_dir, styledir)); + g_assert (!g_str_equal (((PidginMessageStyle*)iter->data)->style_dir, styledir)); - ret->ref_counter ++; + ret->ref_counter = 1; ret->style_dir = g_strdup (styledir); style_list = g_list_append (style_list, ret); @@ -101,6 +101,7 @@ static PidginMessageStyle* pidgin_message_style_new (const char* styledir) static void pidgin_message_style_unref (PidginMessageStyle *style) { if (!style) return; + g_assert (style->ref_counter > 0); style->ref_counter--; if (style->ref_counter) return; @@ -121,6 +122,7 @@ static void pidgin_message_style_unref (PidginMessageStyle *style) } static void variant_set_default (PidginMessageStyle* style); + static PidginMessageStyle* pidgin_message_style_load (const char* styledir) { @@ -130,18 +132,17 @@ pidgin_message_style_load (const char* styledir) PidginMessageStyle *style = NULL; g_assert (styledir); - - for (; cur; cur = g_list_next (cur)) { - if (g_str_equal (styledir, ((PidginMessageStyle*) cur->data)->style_dir)) - return (PidginMessageStyle*) cur->data; + for (cur = style_list; cur; cur = g_list_next (cur)) { + style = (PidginMessageStyle*) cur->data; + if (g_str_equal (styledir, style->style_dir)) { + style->ref_counter++; + return style; + } } /* else we need to load it */ style = pidgin_message_style_new (styledir); - /* find some variant file (or load from user's settings) */ - variant_set_default (style); - /* load all other files */ /* The template path can either come from the theme, or can @@ -187,7 +188,7 @@ pidgin_message_style_load (const char* styledir) g_free (file); - /* according to the spec, the following are not necessary files */ + /* according to the spec, the following are optional files */ file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); if (!g_file_get_contents(file, &style->incoming_next_content_html, NULL, NULL)) { style->incoming_next_content_html = g_strdup (style->incoming_content_html); @@ -205,6 +206,9 @@ pidgin_message_style_load (const char* styledir) style->outgoing_next_content_html = g_strdup (style->outgoing_content_html); } + /* find some variant file (or load from user's settings) */ + variant_set_default (style); + return style; } @@ -423,6 +427,9 @@ get_webkit(PurpleConversation *conv) /** * Called when either a new PurpleConversation is created * or when a PidginConversation changes its active PurpleConversation + * This will not change the theme if the theme is already set. + * (This is to prevent accidental theme changes if a new + * PurpleConversation gets added. * * FIXME: it's not at all clear to me as to how * Adium themes handle the case when the PurpleConversation @@ -439,6 +446,7 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) char* baseuri; PidginMessageStyle *style, *oldStyle; oldStyle = g_object_get_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY); + if (oldStyle) return; style = pidgin_message_style_load (style_dir); @@ -451,7 +459,7 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); - pidgin_message_style_unref (oldStyle); + g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style); @@ -520,6 +528,7 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, stripped = g_strdup(message); style = g_object_get_data (G_OBJECT (webkit), MESSAGE_STYLE_KEY); + g_assert (style); if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) { message_html = style->outgoing_next_content_html; @@ -545,14 +554,14 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, wk_script->script = script; wk_script->webkit = webkit; - g_idle_add(purple_webkit_execute_script, wk_script); + purple_webkit_execute_script (wk_script); g_free(smileyed); g_free(msg); g_free(stripped); g_free(escape); - return TRUE; /* GtkConv should not handle this guy */ + return TRUE; /* GtkConv should not handle this IM */ } static gboolean webkit_on_displaying_chat_msg (PurpleAccount *account, @@ -562,12 +571,12 @@ static gboolean webkit_on_displaying_chat_msg (PurpleAccount *account, PurpleMessageFlags flags, gpointer userdata) { - /* handle exactly like an IM message */ + /* handle exactly like an IM message for now */ return webkit_on_displaying_im_msg (account, who, message, conv, flags, NULL); } static void -webkit_on_converstation_displayed (PidginConversation *gtkconv, gpointer data) +webkit_on_conversation_displayed (PidginConversation *gtkconv, gpointer data) { init_theme_for_webkit (gtkconv->active_conv, cur_style_dir); } @@ -583,7 +592,8 @@ webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data) { /* * I'm not sure if I need to do anything here, but let's keep - * this anyway + * this anyway. (FIXME: have to catch a signal on the WebView + * when the WebView closes.) */ } @@ -688,7 +698,7 @@ plugin_load(PurplePlugin *plugin) purple_signal_connect (pidgin_conversations_get_handle (), "conversation-displayed", webkit_plugin_get_handle (), - PURPLE_CALLBACK(webkit_on_converstation_displayed), + PURPLE_CALLBACK(webkit_on_conversation_displayed), NULL); purple_signal_connect (pidgin_conversations_get_handle (), -- cgit v1.2.1 From d38cbbc17fa4d1d973420cc91c70f85ec42ed8f4 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 05:56:08 +0000 Subject: Cleanly handle webkit destroy events. --- pidgin/plugins/adiumthemes/webkit.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index c26c59ac61..e093a37160 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -122,6 +122,7 @@ static void pidgin_message_style_unref (PidginMessageStyle *style) } static void variant_set_default (PidginMessageStyle* style); +static void webkit_on_webview_destroy (GtkObject* obj, gpointer data); static PidginMessageStyle* pidgin_message_style_load (const char* styledir) @@ -462,6 +463,8 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style); + /* I need to unref this style when the webkit object destroys */ + g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), style); g_free (basedir); g_free (baseuri); @@ -484,6 +487,13 @@ finalize_theme_for_webkit (PurpleConversation *conv) pidgin_message_style_unref (style); } +static void +webkit_on_webview_destroy (GtkObject *object, gpointer data) +{ + pidgin_message_style_unref ((PidginMessageStyle*) data); + g_object_set_data (G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); +} + struct webkit_script { GtkWidget *webkit; char *script; -- cgit v1.2.1 From c3737c4263ec0f9aef9e38066f63e274efaf24f5 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 07:33:21 +0000 Subject: safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit. --- pidgin/gtkwebview.c | 83 ++++++++++++++++++++++++++++++++----- pidgin/gtkwebview.h | 23 +++++++--- pidgin/plugins/adiumthemes/webkit.c | 2 +- 3 files changed, 91 insertions(+), 17 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 0f78523ff7..b791312278 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -41,9 +41,19 @@ static WebKitWebViewClass *parent_class = NULL; +struct GtkWebViewPriv { + GHashTable *images; /**< a map from id to temporary file for the image */ + gboolean empty; /**< whether anything has been appended **/ + + /* JS execute queue */ + GQueue *js_queue; + gboolean is_loading; +}; + GtkWidget* gtk_webview_new () { - return GTK_WIDGET(g_object_new(gtk_webview_get_type(), NULL)); + GtkWebView* ret = GTK_WEBVIEW (g_object_new(gtk_webview_get_type(), NULL)); + return GTK_WIDGET (ret); } static char* @@ -53,10 +63,10 @@ get_image_filename_from_id (GtkWebView* view, int id) FILE *file; PurpleStoredImage* img; - if (!view->images) - view->images = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); + if (!view->priv->images) + view->priv->images = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); - filename = (char*) g_hash_table_lookup (view->images, GINT_TO_POINTER (id)); + filename = (char*) g_hash_table_lookup (view->priv->images, GINT_TO_POINTER (id)); if (filename) return filename; /* else get from img store */ @@ -65,7 +75,7 @@ get_image_filename_from_id (GtkWebView* view, int id) img = purple_imgstore_find_by_id (id); fwrite (purple_imgstore_get_data (img), purple_imgstore_get_size (img), 1, file); - g_hash_table_insert (view->images, GINT_TO_POINTER (id), filename); + g_hash_table_insert (view->priv->images, GINT_TO_POINTER (id), filename); fclose (file); return filename; } @@ -79,9 +89,9 @@ clear_single_image (gpointer key, gpointer value, gpointer userdata) static void clear_images (GtkWebView* view) { - if (!view->images) return; - g_hash_table_foreach (view->images, clear_single_image, NULL); - g_hash_table_unref (view->images); + if (!view->priv->images) return; + g_hash_table_foreach (view->priv->images, clear_single_image, NULL); + g_hash_table_unref (view->priv->images); } /* @@ -146,6 +156,7 @@ static void gtk_webview_finalize (GObject *view) { clear_images (GTK_WEBVIEW (view)); + g_free (GTK_WEBVIEW(view)->priv); G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT(view)); } @@ -173,6 +184,39 @@ webview_link_clicked (WebKitWebView *view, return TRUE; } +static gboolean +process_js_script_queue (GtkWebView *view) +{ + char *script; + if (view->priv->is_loading) return FALSE; /* we will be called when loaded */ + if (!view->priv->js_queue || g_queue_is_empty (view->priv->js_queue)) + return FALSE; /* nothing to do! */ + + script = g_queue_pop_head (view->priv->js_queue); + webkit_web_view_execute_script (WEBKIT_WEB_VIEW(view), script); + g_free (script); + + return TRUE; /* there may be more for now */ +} + +static void +webview_load_started (WebKitWebView *view, + WebKitWebFrame *frame, + gpointer userdata) +{ + /* is there a better way to test for is_loading? */ + GTK_WEBVIEW(view)->priv->is_loading = true; +} + +static void +webview_load_finished (WebKitWebView *view, + WebKitWebFrame *frame, + gpointer userdata) +{ + GTK_WEBVIEW(view)->priv->is_loading = false; + g_idle_add ((GSourceFunc) process_js_script_queue, view); +} + char* gtk_webview_execute_script (GtkWebView *view, const char *script) { @@ -192,13 +236,30 @@ gtk_webview_execute_script (GtkWebView *view, const char *script) return cstr; } +void +gtk_webview_safe_execute_script (GtkWebView *view, const char* script) +{ + g_queue_push_tail (view->priv->js_queue, g_strdup (script)); + g_idle_add ((GSourceFunc)process_js_script_queue, view); +} + static void gtk_webview_init (GtkWebView *view, gpointer userdata) { + view->priv = g_new0 (struct GtkWebViewPriv, 1); g_signal_connect (view, "navigation-policy-decision-requested", G_CALLBACK (webview_link_clicked), view); - view->empty = TRUE; + + g_signal_connect (view, "load-started", + G_CALLBACK (webview_load_started), + view); + + g_signal_connect (view, "load-finished", + G_CALLBACK (webview_load_finished), + view); + + view->priv->empty = TRUE; } @@ -254,7 +315,7 @@ gtk_webview_append_html (GtkWebView* view, const char* html) char* script = g_strdup_printf ("document.write(%s)", escaped); printf ("script: %s\n", script); webkit_web_view_execute_script (WEBKIT_WEB_VIEW (view), script); - view->empty = FALSE; + view->priv->empty = FALSE; g_free (script); g_free (escaped); } @@ -273,7 +334,7 @@ gtk_webview_get_text (GtkWebView *view) gboolean gtk_webview_is_empty (GtkWebView *view) { - return view->empty; + return view->priv->empty; } GType gtk_webview_get_type () diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index bd0df4c770..df83b8ad6b 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -35,17 +35,17 @@ #define GTK_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_WEBVIEW, GtkWebView)) #define GTK_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_WEBVIEW, GtkWebViewClass)) #define GTK_IS_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_WEBVIEW)) -#define GTK_IS_IMHTML_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEW)) +#define GTK_IS_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEW)) +struct GtkWebViewPriv; + struct _GtkWebView { WebKitWebView webkit_web_view; /*< private >*/ - GHashTable *images; /**< a map from id to temporary file for the image */ - gboolean empty; /**< whether anything has been appended **/ - char *script_return; /**< the last value returned from a script **/ + struct GtkWebViewPriv* priv; }; typedef struct _GtkWebView GtkWebView; @@ -106,7 +106,8 @@ gboolean gtk_webview_is_empty (GtkWebView *webview); * Executes javascript and returns the answer of the script * formatted as string. The return value needs to be freed using * g_free. If the return values is not required you may instead - * use webkit_web_view_execute_script. + * use webkit_web_view_execute_script, or even better + * gtk_webview_safe_execute_script. * * @param webview The GtkWebView object * @param script The JavaScript to execute @@ -115,6 +116,18 @@ gboolean gtk_webview_is_empty (GtkWebView *webview); */ char* gtk_webview_execute_script (GtkWebView *webview, const char *script); +/** + * Execute the JavaScript only after the webkit_webview_load_string + * loads completely. We also guarantee that the scripts are executed + * in the order they are called here.This is useful to avoid race + * conditions when calls JS functions immediately after opening the + * page. + * + * @param webview the GtkWebView object + * @param script the script to execute + */ +void gtk_webview_safe_execute_script (GtkWebView *webview, const char* script); + /** * Get the current contents of the GtkWebView object. * diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index e093a37160..d276a9a49c 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -564,7 +564,7 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, wk_script->script = script; wk_script->webkit = webkit; - purple_webkit_execute_script (wk_script); + g_idle_add (purple_webkit_execute_script, wk_script); g_free(smileyed); g_free(msg); -- cgit v1.2.1 From f335e30bc23d9dea4f917f6c9760473d22111804 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 07:42:54 +0000 Subject: Yep, tested, and changed some code from previous commit. This is a hard to test code, so I just hope it works flawlessly. :) --- pidgin/gtkwebview.c | 7 +++++++ pidgin/plugins/adiumthemes/webkit.c | 26 +++----------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index b791312278..b372072e06 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -155,6 +155,12 @@ replace_img_id_with_src (GtkWebView *view, const char* html) static void gtk_webview_finalize (GObject *view) { + gpointer temp; + + while ((temp = g_queue_pop_head (GTK_WEBVIEW(view)->priv->js_queue))) + g_free (temp); + g_queue_free (GTK_WEBVIEW(view)->priv->js_queue); + clear_images (GTK_WEBVIEW (view)); g_free (GTK_WEBVIEW(view)->priv); G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT(view)); @@ -260,6 +266,7 @@ gtk_webview_init (GtkWebView *view, gpointer userdata) view); view->priv->empty = TRUE; + view->priv->js_queue = g_queue_new (); } diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index d276a9a49c..fb1868d8d5 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -494,22 +494,6 @@ webkit_on_webview_destroy (GtkObject *object, gpointer data) g_object_set_data (G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); } -struct webkit_script { - GtkWidget *webkit; - char *script; -}; - -static gboolean purple_webkit_execute_script(gpointer _script) -{ - struct webkit_script *script = (struct webkit_script*) _script; - printf ("%s\n", script->script); - webkit_web_view_execute_script(WEBKIT_WEB_VIEW(script->webkit), script->script); - g_free(script->script); - g_free(script); - return FALSE; -} - - static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, const char* name, char **pmessage, @@ -529,7 +513,6 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, char *smileyed; time_t mtime = time (NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */ - struct webkit_script *wk_script; PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); PidginMessageStyle *style; @@ -560,12 +543,9 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, escape = gtk_webview_quote_js_string (msg); script = g_strdup_printf("%s(%s)", func, escape); - wk_script = g_new0(struct webkit_script, 1); - wk_script->script = script; - wk_script->webkit = webkit; - - g_idle_add (purple_webkit_execute_script, wk_script); + gtk_webview_safe_execute_script (GTK_WEBVIEW (webkit), script); + g_free(script); g_free(smileyed); g_free(msg); g_free(stripped); @@ -761,7 +741,7 @@ variant_update_conversation (PurpleConversation *conv) g_assert (style && style->css_path); script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", style->css_path); - webkit_web_view_execute_script (webview, script); + gtk_webview_safe_execute_script (GTK_WEBVIEW(webview), script); g_free (script); } -- cgit v1.2.1 From 4df8e5ca79c85a721f3fcf2c4e30618abace2bc2 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 07:47:37 +0000 Subject: removed some ugly pointless pieces of code. --- pidgin/gtkwebview.c | 31 ------------------------------- pidgin/gtkwebview.h | 32 -------------------------------- 2 files changed, 63 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index b372072e06..dbdea56428 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -223,25 +223,6 @@ webview_load_finished (WebKitWebView *view, g_idle_add ((GSourceFunc) process_js_script_queue, view); } -char* -gtk_webview_execute_script (GtkWebView *view, const char *script) -{ - JSStringRef js_script = JSStringCreateWithUTF8CString (script); - JSContextRef ctxt = webkit_web_frame_get_global_context ( - webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view)) - ); - JSValueRef ret = JSEvaluateScript (ctxt, js_script, NULL, NULL, 0, NULL); - JSStringRef ret_as_str = JSValueToStringCopy (ctxt, ret, NULL); - - size_t cstr_len = JSStringGetMaximumUTF8CStringSize (ret_as_str); - char *cstr = g_new0(char, cstr_len + 1); - - JSStringGetUTF8CString (ret_as_str, cstr, cstr_len); - - /* TODO: I'm not sure what, if at all, I need to free here! */ - return cstr; -} - void gtk_webview_safe_execute_script (GtkWebView *view, const char* script) { @@ -327,18 +308,6 @@ gtk_webview_append_html (GtkWebView* view, const char* html) g_free (escaped); } -char* -gtk_webview_get_markup (GtkWebView *view) -{ - return gtk_webview_execute_script (view, "document.body.innerHTML"); -} - -char* -gtk_webview_get_text (GtkWebView *view) -{ - return gtk_webview_execute_script (view, "document.body.textContent"); -} - gboolean gtk_webview_is_empty (GtkWebView *view) { return view->priv->empty; diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index df83b8ad6b..25fee3b9a4 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -102,20 +102,6 @@ void gtk_webview_load_html_string_with_imgstore (GtkWebView* webview, const char */ gboolean gtk_webview_is_empty (GtkWebView *webview); -/** - * Executes javascript and returns the answer of the script - * formatted as string. The return value needs to be freed using - * g_free. If the return values is not required you may instead - * use webkit_web_view_execute_script, or even better - * gtk_webview_safe_execute_script. - * - * @param webview The GtkWebView object - * @param script The JavaScript to execute - * - * @return the return value of the script. - */ -char* gtk_webview_execute_script (GtkWebView *webview, const char *script); - /** * Execute the JavaScript only after the webkit_webview_load_string * loads completely. We also guarantee that the scripts are executed @@ -128,24 +114,6 @@ char* gtk_webview_execute_script (GtkWebView *webview, const char *script); */ void gtk_webview_safe_execute_script (GtkWebView *webview, const char* script); -/** - * Get the current contents of the GtkWebView object. - * - * @param webview The GtkWebView object - * - * @return a string with the contents. Needs to be g_free'd after use. - */ -char* gtk_webview_get_markup (GtkWebView *webview); - -/** - * Returns the contents of the GtkWebView object, stripped of markups - * - * @param webview The GtkWebView object - * - * @return a string with the contents. Needs to be g_free'd after use. - */ -char* gtk_webview_get_text (GtkWebView *view); - /** * A convenience routine to quote a string for use as a JavaScript * string. For instance, "hello 'world'" becomes "'hello \\'world\\''" -- cgit v1.2.1 From 5199370ec56b3132986e1ba521b32aabe2a6d9c9 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 07:49:37 +0000 Subject: get_theme_files --> get_variant_files. --- pidgin/plugins/adiumthemes/webkit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index fb1868d8d5..86f8e978f2 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -591,7 +591,7 @@ webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data) * Get each of the files corresponding to each variant. */ static GList* -get_theme_files(PidginMessageStyle *style) +get_variant_files(PidginMessageStyle *style) { GList *ret = NULL; GDir *variants; @@ -637,7 +637,7 @@ variant_set_default (PidginMessageStyle* style) css_path = NULL; } - all = get_theme_files (style); + all = get_variant_files (style); if (all) { style->css_path = g_strdup (all->data); @@ -789,7 +789,7 @@ static GtkWidget * get_config_frame(PurplePlugin *plugin) { PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); - GList *variants = get_theme_files(style); + GList *variants = get_variant_files(style); GList *iter = variants; char *curdir = NULL; GtkWidget *combobox = gtk_combo_box_new_text(); -- cgit v1.2.1 From 232be787e07b46b84d79e7e5e16eb43a3b73e2dc Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 08:17:12 +0000 Subject: partial work towards theme selection. --- pidgin/plugins/adiumthemes/webkit.c | 63 ++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 86f8e978f2..84833f58d1 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -587,6 +587,55 @@ webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data) */ } +static GList* +get_dir_dir_list (const char* dirname) +{ + GList *ret = NULL; + GDir *dir = g_dir_open (dirname, 0, NULL); + const char* subdir; + + if (!dir) return NULL; + while ((subdir = g_dir_read_name (dir))) { + ret = g_list_append (ret, g_build_filename (dirname, subdir, NULL)); + } + + g_dir_close (dir); + return ret; +} + +/** + * Get me a list of all the available themes specified by their + * directories. I don't guarrantee that these are valid themes, just + * that they are in the directories for themes. + */ +static GList* +get_theme_directory_list () +{ + char *user_dir, *user_style_dir, *global_style_dir; + GList *list1, *list2; + + user_dir = g_strdup (purple_user_dir ()); + if (!g_path_is_absolute (user_dir)) { + char* cur = g_get_current_dir (); + g_free (user_dir); + user_dir = g_build_filename (cur, purple_user_dir(), NULL); + g_free (cur); + } + + user_style_dir = g_build_filename (user_dir, "styles", NULL); + global_style_dir = g_build_filename (DATADIR, "pidgin", "styles", NULL); + + list1 = get_dir_dir_list (user_style_dir); + list2 = get_dir_dir_list (global_style_dir); + + g_free (global_style_dir); + g_free (user_style_dir); + g_free (user_dir); + + return g_list_concat (list1, list2); +} + + /** * Get each of the files corresponding to each variant. */ @@ -658,6 +707,9 @@ plugin_load(PurplePlugin *plugin) if (g_path_is_absolute (purple_user_dir())) cur_style_dir = g_build_filename(purple_user_dir(), "style", NULL); else { + + + char* cur = g_get_current_dir (); cur_style_dir = g_build_filename (cur, purple_user_dir(), "style", NULL); g_free (cur); @@ -786,7 +838,7 @@ cleanup: } static GtkWidget * -get_config_frame(PurplePlugin *plugin) +get_variant_config_frame() { PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); GList *variants = get_variant_files(style); @@ -847,6 +899,15 @@ get_config_frame(PurplePlugin *plugin) return combobox; } +static GtkWidget* +get_config_frame(PurplePlugin* plugin) +{ + GtkWidget *vbox = gtk_vbox_new (TRUE, 0); + + gtk_box_pack_end (GTK_BOX(vbox), get_variant_config_frame (), TRUE, TRUE, 0); + return vbox; +} + PidginPluginUiInfo ui_info = { get_config_frame, -- cgit v1.2.1 From db7d354927afd5b0b28e32e75564caa790b1cbf4 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 08:20:05 +0000 Subject: removed the fixme. --- pidgin/plugins/adiumthemes/webkit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 84833f58d1..6b1728bbf1 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -582,8 +582,7 @@ webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data) { /* * I'm not sure if I need to do anything here, but let's keep - * this anyway. (FIXME: have to catch a signal on the WebView - * when the WebView closes.) + * this anyway. */ } -- cgit v1.2.1 From b26b45ae455937f13ec278d8557f43f8f77018fa Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 08:40:12 +0000 Subject: theme detection. --- pidgin/plugins/adiumthemes/webkit.c | 57 ++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 6b1728bbf1..c3f5a35ac9 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -38,6 +38,7 @@ /* Purple headers */ #include +#include #include #include #include @@ -608,7 +609,7 @@ get_dir_dir_list (const char* dirname) * that they are in the directories for themes. */ static GList* -get_theme_directory_list () +get_style_directory_list () { char *user_dir, *user_style_dir, *global_style_dir; GList *list1, *list2; @@ -634,6 +635,36 @@ get_theme_directory_list () return g_list_concat (list1, list2); } +/** + * use heuristics or previous user options to figure out what + * theme to use as default in this Pidgin instance. + */ +static void +style_set_default () +{ + GList* styles = get_style_directory_list (), *iter; + const char *stylepath = purple_prefs_get_string ("/plugins/gtk/adiumthemes/stylepath"); + g_assert (cur_style_dir == NULL); + + if (stylepath) + styles = g_list_prepend (styles, g_strdup (stylepath)); + + /* pick any one that works. Note that we have first preference + * for the one in the userdir */ + for (iter = styles; iter; iter = g_list_next (iter)) { + PidginMessageStyle *style = pidgin_message_style_load (iter->data); + if (style) { + cur_style_dir = (char*) g_strdup (iter->data); + pidgin_message_style_unref (style); + break; + } + purple_debug_info ("webkit", "Style %s is invalid\n", (char*) iter->data); + } + + for (iter = styles; iter; iter = g_list_next (iter)) + g_free (iter->data); + g_list_free (styles); +} /** * Get each of the files corresponding to each variant. @@ -701,28 +732,8 @@ variant_set_default (PidginMessageStyle* style) static gboolean plugin_load(PurplePlugin *plugin) { - PidginMessageStyle *_style; /* temp */ - - if (g_path_is_absolute (purple_user_dir())) - cur_style_dir = g_build_filename(purple_user_dir(), "style", NULL); - else { - - - - char* cur = g_get_current_dir (); - cur_style_dir = g_build_filename (cur, purple_user_dir(), "style", NULL); - g_free (cur); - } - - - _style = pidgin_message_style_load (cur_style_dir); - if (!_style) { - g_free (cur_style_dir); - cur_style_dir = NULL; - return FALSE; - } - - pidgin_message_style_unref (_style); + style_set_default (); + if (!cur_style_dir) return FALSE; /* couldn't find a style */ purple_signal_connect (pidgin_conversations_get_handle (), "displaying-im-msg", -- cgit v1.2.1 From 27ee6e1f7c15602243a42cbb70b296552e56a19b Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 08:59:09 +0000 Subject: some code to get a list of styles and blah blah. --- pidgin/plugins/adiumthemes/webkit.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index c3f5a35ac9..81cffde7f1 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -792,6 +792,27 @@ plugin_unload(PurplePlugin *plugin) } +static GtkWidget* +get_style_config_frame () +{ + GtkWidget *combobox = gtk_combo_box_new_text (); + GList *styles = get_style_directory_list (), *iter; + int index = 0, selected = 0; + + for (iter = styles; iter; iter = g_list_next (iter), index++) { + PidginMessageStyle *style = pidgin_message_style_load (iter->data); + + if (style) { + gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), iter->data); + if (g_str_equal (iter->data, cur_style_dir)) + selected = index; + pidgin_message_style_unref (style); + } + } + gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), selected); + return combobox; +} + static void variant_update_conversation (PurpleConversation *conv) { @@ -914,6 +935,7 @@ get_config_frame(PurplePlugin* plugin) { GtkWidget *vbox = gtk_vbox_new (TRUE, 0); + gtk_box_pack_start (GTK_BOX(vbox), get_style_config_frame (), TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX(vbox), get_variant_config_frame (), TRUE, TRUE, 0); return vbox; } -- cgit v1.2.1 From aa8f5672d7ad36734f22c2dda4ebad1e3dadd27d Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 10:03:47 +0000 Subject: some code for style_changed and also default any empty file to "" rather than NULL. --- pidgin/plugins/adiumthemes/webkit.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 81cffde7f1..95949490fb 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -170,15 +170,18 @@ pidgin_message_style_load (const char* styledir) g_free (file); file = g_build_filename(styledir, "Contents", "Resources", "main.css", NULL); - g_file_get_contents(file, &style->basestyle_css, NULL, NULL); + if (!g_file_get_contents(file, &style->basestyle_css, NULL, NULL)) + style->basestyle_css = g_strdup (""); g_free (file); file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL); - g_file_get_contents(file, &style->header_html, NULL, NULL); + if (!g_file_get_contents(file, &style->header_html, NULL, NULL)) + style->header_html = g_strdup (""); g_free (file); file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL); - g_file_get_contents(file, &style->footer_html, NULL, NULL); + if (!g_file_get_contents(file, &style->footer_html, NULL, NULL)) + style->footer_html = g_strdup (""); g_free (file); file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); @@ -451,12 +454,14 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) if (oldStyle) return; + purple_debug_info ("webkit", "loading %s", style_dir); style = pidgin_message_style_load (style_dir); g_assert (style); basedir = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL); baseuri = g_strdup_printf ("file://%s", basedir); header = replace_header_tokens(style->header_html, strlen(style->header_html), conv); + g_assert (style); footer = replace_header_tokens(style->footer_html, strlen(style->footer_html), conv); template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); @@ -706,7 +711,7 @@ variant_set_default (PidginMessageStyle* style) const char *css_path = purple_prefs_get_string ("/plugins/gtk/adiumthemes/csspath"); g_free (style->css_path); - if (g_str_has_prefix (css_path, style->style_dir) && + if (css_path && g_str_has_prefix (css_path, style->style_dir) && g_file_test (css_path, G_FILE_TEST_EXISTS)) { style->css_path = g_strdup (css_path); return; @@ -791,6 +796,14 @@ plugin_unload(PurplePlugin *plugin) return TRUE; } +static void +style_changed (GtkWidget* combobox, gpointer null) +{ + char *name = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combobox)); + + g_free (cur_style_dir); + cur_style_dir = name; +} static GtkWidget* get_style_config_frame () @@ -810,6 +823,7 @@ get_style_config_frame () } } gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), selected); + g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(style_changed), NULL); return combobox; } -- cgit v1.2.1 From c9f82b5e459db7b88c482c2575305cf37ca8701a Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 10:08:02 +0000 Subject: unset cur_style_dir when unloading. --- pidgin/plugins/adiumthemes/webkit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 95949490fb..024f45da4b 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -786,7 +786,7 @@ plugin_unload(PurplePlugin *plugin) GList *list; webkit_plugin_free_handle (); - + cur_style_dir = NULL; list = purple_get_conversations (); while (list) { finalize_theme_for_webkit(list->data); -- cgit v1.2.1 From 13ff090a651bf936f770280896a8ecf19c01b98d Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 10:26:02 +0000 Subject: Debugging info to find bad themes. --- pidgin/plugins/adiumthemes/webkit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 024f45da4b..54507599f7 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -132,7 +132,7 @@ pidgin_message_style_load (const char* styledir) GList *cur = style_list; char *file; /* temporary variable */ PidginMessageStyle *style = NULL; - + g_assert (styledir); for (cur = style_list; cur; cur = g_list_next (cur)) { style = (PidginMessageStyle*) cur->data; @@ -158,11 +158,13 @@ pidgin_message_style_load (const char* styledir) if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) { pidgin_message_style_unref (style); + purple_debug_error ("webkit", "Could not locate a Template.html\n"); return NULL; } file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL); if (!g_file_get_contents(file, &style->status_html, NULL, NULL)) { + purple_debug_info ("webkit", "%s could not find Resources/Status.html", styledir); pidgin_message_style_unref (style); g_free (file); return NULL; @@ -186,6 +188,7 @@ pidgin_message_style_load (const char* styledir) file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); if (!g_file_get_contents(file, &style->incoming_content_html, NULL, NULL)) { + purple_debug_info ("webkit", "%s did not have a Incoming/Content.html\n", styledir); pidgin_message_style_unref (style); g_free (file); return NULL; @@ -454,7 +457,7 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) if (oldStyle) return; - purple_debug_info ("webkit", "loading %s", style_dir); + purple_debug_info ("webkit", "loading %s\n", style_dir); style = pidgin_message_style_load (style_dir); g_assert (style); -- cgit v1.2.1 From 1cf31b9a078574dbb8d402cd6074f5a2a5ee4682 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 10:30:31 +0000 Subject: small assertion code. --- pidgin/plugins/adiumthemes/webkit.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 54507599f7..b390c042e2 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -468,6 +468,7 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) footer = replace_header_tokens(style->footer_html, strlen(style->footer_html), conv); template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); + g_assert(template); webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style); -- cgit v1.2.1 From daebe05a8c9bacc5060d0eed8b2e93740e8479dc Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 10:34:52 +0000 Subject: make a get_absolute_path function. --- pidgin/plugins/adiumthemes/webkit.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index b390c042e2..477060b76c 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -83,6 +83,17 @@ static GList *style_list; /**< List of PidginMessageStyles */ static char *cur_style_dir = NULL; static void *handle = NULL; +static inline char* get_absolute_path (const char *path) +{ + if (g_path_is_absolute (path)) return g_strdup (path); + else { + char* cwd = g_get_current_dir (), *ret; + ret = g_build_filename (cwd, path, NULL); + g_free (cwd); + return ret; + } +} + static PidginMessageStyle* pidgin_message_style_new (const char* styledir) { PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1); @@ -623,13 +634,7 @@ get_style_directory_list () char *user_dir, *user_style_dir, *global_style_dir; GList *list1, *list2; - user_dir = g_strdup (purple_user_dir ()); - if (!g_path_is_absolute (user_dir)) { - char* cur = g_get_current_dir (); - g_free (user_dir); - user_dir = g_build_filename (cur, purple_user_dir(), NULL); - g_free (cur); - } + user_dir = get_absolute_path (purple_user_dir ()); user_style_dir = g_build_filename (user_dir, "styles", NULL); global_style_dir = g_build_filename (DATADIR, "pidgin", "styles", NULL); -- cgit v1.2.1 From 0252526b61a5bdee75c314d891e1833ee3196e93 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 17:45:16 +0000 Subject: Inform the user about how the theme change takes effect. --- pidgin/plugins/adiumthemes/webkit.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 477060b76c..2860846a1f 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -809,9 +809,16 @@ static void style_changed (GtkWidget* combobox, gpointer null) { char *name = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combobox)); + GtkWidget *dialog; g_free (cur_style_dir); cur_style_dir = name; + + /* inform the user that existing conversations haven't changed */ + dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "The style for existing conversations have not been changed. Please close and re-open the conversation for the changes to take effect."); + g_assert (dialog); + gtk_widget_show (dialog); + g_signal_connect_swapped (dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog); } static GtkWidget* @@ -821,13 +828,14 @@ get_style_config_frame () GList *styles = get_style_directory_list (), *iter; int index = 0, selected = 0; - for (iter = styles; iter; iter = g_list_next (iter), index++) { + for (iter = styles; iter; iter = g_list_next (iter)) { PidginMessageStyle *style = pidgin_message_style_load (iter->data); if (style) { gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), iter->data); if (g_str_equal (iter->data, cur_style_dir)) selected = index; + index++; pidgin_message_style_unref (style); } } -- cgit v1.2.1 From b78444a494ef208099bb4e4d71d64c45de66800a Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 20:16:39 +0000 Subject: use a table to display the options neatly. --- pidgin/plugins/adiumthemes/webkit.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 2860846a1f..7603937789 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -964,11 +964,13 @@ get_variant_config_frame() static GtkWidget* get_config_frame(PurplePlugin* plugin) { - GtkWidget *vbox = gtk_vbox_new (TRUE, 0); - - gtk_box_pack_start (GTK_BOX(vbox), get_style_config_frame (), TRUE, TRUE, 0); - gtk_box_pack_end (GTK_BOX(vbox), get_variant_config_frame (), TRUE, TRUE, 0); - return vbox; + GtkWidget *table = gtk_table_new (2, 2, FALSE); + + gtk_table_attach_defaults (GTK_TABLE(table), gtk_label_new ("Message Style"), 0, 1, 0, 1); + gtk_table_attach_defaults (GTK_TABLE(table), get_style_config_frame (), 1, 2, 0, 1); + gtk_table_attach_defaults (GTK_TABLE(table), gtk_label_new ("Style Variant"), 0, 1, 1, 2); + gtk_table_attach_defaults (GTK_TABLE(table), get_variant_config_frame (), 1, 2, 1, 2); + return table; } PidginPluginUiInfo ui_info = -- cgit v1.2.1 From 606e97c61cbd62bddae7a9ae8f3f86f3f3728814 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 23:44:22 +0000 Subject: Reset the list of variants when the MessageStyle is changed. --- pidgin/plugins/adiumthemes/webkit.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 7603937789..b499c9db8c 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -840,7 +840,7 @@ get_style_config_frame () } } gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), selected); - g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(style_changed), NULL); + g_signal_connect_after (G_OBJECT(combobox), "changed", G_CALLBACK(style_changed), NULL); return combobox; } @@ -961,15 +961,36 @@ get_variant_config_frame() return combobox; } +static void +style_changed_reset_variants (GtkWidget* combobox, gpointer table) +{ + /* I hate to do this, I swear. But I don't know how to cleanly clean an existing combobox */ + GtkWidget* variants = g_object_get_data (G_OBJECT(table), "variants-cbox"); + gtk_widget_destroy (variants); + variants = get_variant_config_frame (); + gtk_table_attach_defaults (GTK_TABLE (table), variants, 1, 2, 1, 2); + gtk_widget_show_all (GTK_WIDGET(table)); + + g_object_set_data (G_OBJECT(table), "variants-cbox", variants); +} + static GtkWidget* get_config_frame(PurplePlugin* plugin) { GtkWidget *table = gtk_table_new (2, 2, FALSE); - + GtkWidget *style_config = get_style_config_frame (); + GtkWidget *variant_config = get_variant_config_frame (); + gtk_table_attach_defaults (GTK_TABLE(table), gtk_label_new ("Message Style"), 0, 1, 0, 1); - gtk_table_attach_defaults (GTK_TABLE(table), get_style_config_frame (), 1, 2, 0, 1); + gtk_table_attach_defaults (GTK_TABLE(table), style_config, 1, 2, 0, 1); gtk_table_attach_defaults (GTK_TABLE(table), gtk_label_new ("Style Variant"), 0, 1, 1, 2); - gtk_table_attach_defaults (GTK_TABLE(table), get_variant_config_frame (), 1, 2, 1, 2); + gtk_table_attach_defaults (GTK_TABLE(table), variant_config, 1, 2, 1, 2); + + + g_object_set_data (G_OBJECT(table), "variants-cbox", variant_config); + /* to clarify, this is a second signal connected on style config */ + g_signal_connect_after (G_OBJECT(style_config), "changed", G_CALLBACK(style_changed_reset_variants), table); + return table; } -- cgit v1.2.1 From 3f79c0cacea569a7247787a8bcf622b1c2914111 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Mon, 10 Aug 2009 23:51:12 +0000 Subject: Show only the MessageStyle name and not the entire path. --- pidgin/plugins/adiumthemes/webkit.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index b499c9db8c..0058214401 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -810,9 +810,22 @@ style_changed (GtkWidget* combobox, gpointer null) { char *name = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combobox)); GtkWidget *dialog; + GList *styles = get_style_directory_list (), *iter; + + /* find the full path for this name, I wish I could store this info in the combobox itself. :( */ + for (iter = styles; iter; iter = g_list_next(iter)) { + char* basename = g_path_get_basename (iter->data); + if (g_str_equal (basename, name)) { + g_free (basename); + break; + } + g_free (basename); + } + g_assert (iter); + g_free (name); g_free (cur_style_dir); - cur_style_dir = name; + cur_style_dir = g_strdup (iter->data);; /* inform the user that existing conversations haven't changed */ dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "The style for existing conversations have not been changed. Please close and re-open the conversation for the changes to take effect."); @@ -832,7 +845,10 @@ get_style_config_frame () PidginMessageStyle *style = pidgin_message_style_load (iter->data); if (style) { - gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), iter->data); + char *text = g_path_get_basename (iter->data); + gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), text); + g_free (text); + if (g_str_equal (iter->data, cur_style_dir)) selected = index; index++; -- cgit v1.2.1 From 893ea74345fe4997259b806dbffb293c418db4bd Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Tue, 11 Aug 2009 00:09:01 +0000 Subject: Removed some unused code. --- pidgin/plugins/adiumthemes/webkit.c | 39 +++++-------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 0058214401..6a3f64c7b8 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -919,49 +919,20 @@ static GtkWidget * get_variant_config_frame() { PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); - GList *variants = get_variant_files(style); - GList *iter = variants; - char *curdir = NULL; + GList *variants = get_variant_files(style), *iter; GtkWidget *combobox = gtk_combo_box_new_text(); int def = -1, index = 0; char* css_path = g_strdup (style->css_path); pidgin_message_style_unref (style); - for (; iter; iter = g_list_next (iter)) { + for (iter = variants; iter; iter = g_list_next (iter)) { char *basename = g_path_get_basename(iter->data); char *dirname = g_path_get_dirname(iter->data); - if (!curdir || !g_str_equal (curdir, dirname)) { - char *plist, *plist_xml; - gsize plist_len; - xmlnode *node; - g_free(curdir); - curdir = strdup(dirname); - plist = g_build_filename(curdir, "..", "..", "Info.plist", NULL); - if (!g_file_get_contents(plist, &plist_xml, &plist_len, NULL)) { - continue; - } - node = xmlnode_from_str(plist_xml, plist_len); - if (!node) continue; - node = xmlnode_get_child(node, "dict"); - if (!node) continue; - node = xmlnode_get_child(node, "key"); - while (node && strcmp(xmlnode_get_data(node), "CFBundleName")) { - node = xmlnode_get_next_twin(node); - } - if (!node) continue; - node = node->next; - while (node && node->type != XMLNODE_TYPE_TAG) { - node = node->next; - } + char *temp = g_strndup (basename, strlen(basename)-4); + gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), temp); + g_free (temp); - } - - { - char *temp = g_strndup (basename, strlen(basename)-4); - gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), temp); - g_free (temp); - } if (g_str_has_suffix (css_path, basename)) def = index; index ++; -- cgit v1.2.1 From 20ff66cb8f41b1dbf7042fa5853a698485a32c56 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Tue, 11 Aug 2009 23:25:16 +0000 Subject: Parses Info.plist now! --- pidgin/plugins/adiumthemes/webkit.c | 146 +++++++++++++++++++++++++++++++++++- 1 file changed, 145 insertions(+), 1 deletion(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 6a3f64c7b8..56cd0586df 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -49,7 +49,7 @@ #include #include - +#include /* GObject data keys */ #define MESSAGE_STYLE_KEY "message-style" @@ -62,6 +62,24 @@ typedef struct _PidginMessageStyle { int ref_counter; + /* current config options */ + char *variant; + + /* Info.plist keys */ + int message_view_version; + char *cf_bundle_name; + char *cf_bundle_identifier; + char *cf_bundle_get_info_string; + char *default_font_family; + int default_font_size; + gboolean shows_user_icons; + gboolean disable_combine_consecutive; + gboolean default_background_is_transparent; + gboolean disable_custom_background; + char *default_background_color; + gboolean allow_text_colors; + char *image_mask; + /* paths */ char *style_dir; char *template_path; @@ -110,6 +128,41 @@ static PidginMessageStyle* pidgin_message_style_new (const char* styledir) return ret; } +/** + * deallocate any memory used for info.plist options + */ +static void +pidgin_message_style_unset_info_plist (PidginMessageStyle *style) +{ + style->message_view_version = 0; + g_free (style->cf_bundle_name); + style->cf_bundle_name = NULL; + + g_free (style->cf_bundle_identifier); + style->cf_bundle_identifier = NULL; + + g_free (style->cf_bundle_get_info_string); + style->cf_bundle_get_info_string = NULL; + + g_free (style->default_font_family); + style->default_font_family = NULL; + + style->default_font_size = 0; + style->shows_user_icons = TRUE; + style->disable_combine_consecutive = FALSE; + style->default_background_is_transparent = FALSE; + style->disable_custom_background = FALSE; + + g_free (style->default_background_color); + style->default_background_color = NULL; + + style->allow_text_colors = TRUE; + + g_free (style->image_mask); + style->image_mask = NULL; +} + + static void pidgin_message_style_unref (PidginMessageStyle *style) { if (!style) return; @@ -131,11 +184,98 @@ static void pidgin_message_style_unref (PidginMessageStyle *style) style_list = g_list_remove (style_list, style); g_free (style); + + pidgin_message_style_unset_info_plist (style); } static void variant_set_default (PidginMessageStyle* style); static void webkit_on_webview_destroy (GtkObject* obj, gpointer data); +static gboolean +parse_info_plist_key_value (xmlnode* key, gpointer destination, const char* expected) +{ + xmlnode *val = key->next; + + for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next); + if (!val) return FALSE; + + if (expected == NULL || g_str_equal (expected, "string")) { + char** dest = (char**) destination; + if (!g_str_equal (val->name, BAD_CAST "string")) return FALSE; + if (*dest) g_free (*dest); + *dest = xmlnode_get_data_unescaped (val); + } else if (g_str_equal (expected, "integer")) { + int* dest = (int*) destination; + char* value = xmlnode_get_data_unescaped (val); + + if (!g_str_equal (val->name, "integer")) return FALSE; + *dest = atoi (value); + g_free (value); + } else if (g_str_equal (expected, "boolean")) { + gboolean *dest = (gboolean*) destination; + if (g_str_equal (val->name, BAD_CAST "true")) *dest = TRUE; + else if (g_str_equal (val->name, BAD_CAST "false")) *dest = FALSE; + else return FALSE; + } else return FALSE; + + return TRUE; +} + +static +gboolean str_for_key (const char *key, const char *found, const char *variant){ + if (g_str_equal (key, found)) return TRUE; + if (!variant) return FALSE; + return (g_str_has_prefix (found, key) + && g_str_has_suffix (found, variant) + && strlen (found) == strlen (key) + strlen (variant) + 1); +} +static void +pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant) +{ + /* note that if a variant is used the option:VARIANTNAME takes precedence */ + char *contents = g_build_filename (style->style_dir, "Contents", NULL); + xmlnode *plist = xmlnode_from_file (contents, "Info.plist", "Info.plist", "webkit"), *iter; + xmlnode *dict = xmlnode_get_child (plist, "dict"); + + g_assert (dict); + for (iter = xmlnode_get_child (dict, "key"); iter; iter = xmlnode_get_next_twin (iter)) { + char* key = xmlnode_get_data_unescaped (iter); + gboolean pr = TRUE; + + if (g_str_equal ("MessageViewVersion", key)) + pr = parse_info_plist_key_value (iter, &style->message_view_version, "integer"); + else if (g_str_equal ("CFBundleName", key)) + pr = parse_info_plist_key_value (iter, &style->cf_bundle_name, "string"); + else if (g_str_equal ("CFBundleIdentifier", key)) + pr = parse_info_plist_key_value (iter, &style->cf_bundle_identifier, "string"); + else if (g_str_equal ("CFBundleGetInfoString", key)) + pr = parse_info_plist_key_value (iter, &style->cf_bundle_get_info_string, "string"); + else if (str_for_key ("DefaultFontFamily", key, variant)) + pr = parse_info_plist_key_value (iter, &style->default_font_family, "string"); + else if (str_for_key ("DefaultFontSize", key, variant)) + pr = parse_info_plist_key_value (iter, &style->default_font_size, "integer"); + else if (str_for_key ("ShowsUserIcons", key, variant)) + pr = parse_info_plist_key_value (iter, &style->shows_user_icons, "boolean"); + else if (str_for_key ("DisableCombineConsecutive", key, variant)) + pr = parse_info_plist_key_value (iter, &style->disable_combine_consecutive, "boolean"); + else if (str_for_key ("DefaultBackgroundIsTransparent", key, variant)) + pr = parse_info_plist_key_value (iter, &style->default_background_is_transparent, "boolean"); + else if (str_for_key ("DisableCustomBackground", key, variant)) + pr = parse_info_plist_key_value (iter, &style->disable_custom_background, "boolean"); + else if (str_for_key ("DefaultBackgroundColor", key, variant)) + pr = parse_info_plist_key_value (iter, &style->default_background_color, "string"); + else if (str_for_key ("AllowTextColors", key, variant)) + pr = parse_info_plist_key_value (iter, &style->allow_text_colors, "string"); + else if (str_for_key ("ImageMask", key, variant)) + pr = parse_info_plist_key_value (iter, &style->image_mask, "string"); + + g_free (key); + if (!pr) break; /* does not make sense */ + } + + xmlnode_free (plist); +} + static PidginMessageStyle* pidgin_message_style_load (const char* styledir) { @@ -228,6 +368,10 @@ pidgin_message_style_load (const char* styledir) /* find some variant file (or load from user's settings) */ variant_set_default (style); + pidgin_message_style_read_info_plist (style, NULL); + + /* let's see if we did this well */ + printf ("bundle name: %s\n", style->cf_bundle_name); return style; } -- cgit v1.2.1 From 8551ef5ec96076d6103dff1868d4a34b7299d580 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Tue, 11 Aug 2009 23:54:39 +0000 Subject: some work... temporary towards the bigger picture. --- pidgin/plugins/adiumthemes/webkit.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 56cd0586df..b8275bb5b1 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -64,11 +64,12 @@ typedef struct _PidginMessageStyle { /* current config options */ char *variant; + char *bg_color; /* Info.plist keys */ int message_view_version; char *cf_bundle_name; - char *cf_bundle_identifier; + char *cf_bundle_identifier; /* we're not using this */ char *cf_bundle_get_info_string; char *default_font_family; int default_font_size; @@ -198,7 +199,7 @@ parse_info_plist_key_value (xmlnode* key, gpointer destination, const char* expe for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next); if (!val) return FALSE; - + if (expected == NULL || g_str_equal (expected, "string")) { char** dest = (char**) destination; if (!g_str_equal (val->name, BAD_CAST "string")) return FALSE; @@ -229,6 +230,11 @@ gboolean str_for_key (const char *key, const char *found, const char *variant){ && g_str_has_suffix (found, variant) && strlen (found) == strlen (key) + strlen (variant) + 1); } + +/** + * Info.plist should be re-read every time the variant changes, this is because + * the keys that take precedence depend on the value of the current variant. + */ static void pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant) { @@ -370,11 +376,24 @@ pidgin_message_style_load (const char* styledir) pidgin_message_style_read_info_plist (style, NULL); - /* let's see if we did this well */ - printf ("bundle name: %s\n", style->cf_bundle_name); + /* non variant dependent Info.plist checks */ + if (style->message_view_version < 3) { + pidgin_message_style_unref (style); + return NULL; + } + return style; } +static void +pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant) +{ + /* I'm not going to test whether this variant is valid! */ + g_free (style->variant); + style->variant = g_strdup (variant); + + pidgin_message_style_read_info_plist (style, variant); +} static void* webkit_plugin_get_handle () { -- cgit v1.2.1 From 1792022484738536aa3ca8723c49427c5cf71fcb Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Wed, 12 Aug 2009 01:12:15 +0000 Subject: new changes seemingly working. --- pidgin/plugins/adiumthemes/webkit.c | 270 +++++++++++++++++++++--------------- 1 file changed, 155 insertions(+), 115 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index b8275bb5b1..e2d4ef82a9 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -63,13 +63,13 @@ typedef struct _PidginMessageStyle { int ref_counter; /* current config options */ - char *variant; + char *variant; /* allowed to be NULL if there are no variants */ char *bg_color; /* Info.plist keys */ int message_view_version; char *cf_bundle_name; - char *cf_bundle_identifier; /* we're not using this */ + char *cf_bundle_identifier; char *cf_bundle_get_info_string; char *default_font_family; int default_font_size; @@ -84,7 +84,6 @@ typedef struct _PidginMessageStyle { /* paths */ char *style_dir; char *template_path; - char *css_path; /* caches */ char *template_html; @@ -102,6 +101,23 @@ static GList *style_list; /**< List of PidginMessageStyles */ static char *cur_style_dir = NULL; static void *handle = NULL; +static PidginMessageStyle* pidgin_message_style_new (const char* styledir); +static PidginMessageStyle* pidgin_message_style_load (const char* styledir); +static void pidgin_message_style_unref (PidginMessageStyle *style); +static void pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant); +static char* pidgin_message_style_get_variant (PidginMessageStyle *style); +static GList* pidgin_message_style_get_variants (PidginMessageStyle *style); +static void pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant); + +static void +glist_free_all_string (GList *list) +{ + GList *first = list; + for (; list; list = g_list_next (list)) + g_free (list->data); + g_list_free (first); +} + static inline char* get_absolute_path (const char *path) { if (g_path_is_absolute (path)) return g_strdup (path); @@ -174,7 +190,6 @@ static void pidgin_message_style_unref (PidginMessageStyle *style) g_free (style->style_dir); g_free (style->template_path); - g_free (style->css_path); g_free (style->template_html); g_free (style->incoming_content_html); @@ -189,7 +204,38 @@ static void pidgin_message_style_unref (PidginMessageStyle *style) pidgin_message_style_unset_info_plist (style); } -static void variant_set_default (PidginMessageStyle* style); +static void +pidgin_message_style_save_state (PidginMessageStyle *style) +{ + char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); + char *variant = g_strdup_printf ("%s/%s", prefname, style->variant); + + purple_prefs_add_none (prefname); + purple_prefs_add_string (variant, ""); + purple_prefs_set_string (variant, style->variant); + + g_free (prefname); + g_free (variant); +} + +static void +pidgin_message_style_load_state (PidginMessageStyle *style) +{ + char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); + char *variant = g_strdup_printf ("%s/%s", prefname, style->variant); + + const char* value = purple_prefs_get_string (variant); + gboolean changed = !style->variant || !g_str_equal (style->variant, value); + + g_free (style->variant); + style->variant = g_strdup (value); + + if (changed) pidgin_message_style_read_info_plist (style, style->variant); + + g_free (prefname); + g_free(variant); +} + static void webkit_on_webview_destroy (GtkObject* obj, gpointer data); static gboolean @@ -285,6 +331,19 @@ pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* var static PidginMessageStyle* pidgin_message_style_load (const char* styledir) { + /* + * the loading process described: + * + * First we load all the style .html files, etc. + * The we load any config options that have been stored for + * this variant. + * Then we load the Info.plist, for the currently decided variant. + * At this point, if we find that variants exist, yet + * we don't have a variant selected, we choose DefaultVariant + * and if that does not exist, we choose the first one in the + * directory. + */ + /* is this style already loaded? */ GList *cur = style_list; char *file; /* temporary variable */ @@ -371,10 +430,8 @@ pidgin_message_style_load (const char* styledir) style->outgoing_next_content_html = g_strdup (style->outgoing_content_html); } - /* find some variant file (or load from user's settings) */ - variant_set_default (style); - - pidgin_message_style_read_info_plist (style, NULL); + pidgin_message_style_load_state (style); + pidgin_message_style_read_info_plist (style, style->variant); /* non variant dependent Info.plist checks */ if (style->message_view_version < 3) { @@ -382,6 +439,17 @@ pidgin_message_style_load (const char* styledir) return NULL; } + if (!style->variant) + { + GList *variants = pidgin_message_style_get_variants (style); + + if (variants) + pidgin_message_style_set_variant (style, variants->data); + + glist_free_all_string (variants); + pidgin_message_style_save_state (style); + } + return style; } @@ -393,6 +461,59 @@ pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant style->variant = g_strdup (variant); pidgin_message_style_read_info_plist (style, variant); + pidgin_message_style_save_state (style); + + /* todo, the style has "changed". Ideally, I would like to use signals at this point. */ +} + +char* pidgin_message_style_get_variant (PidginMessageStyle *style) +{ + return g_strdup (style->variant); +} + +/** + * Get a list of variants supported by the style. + */ +static GList* +pidgin_message_style_get_variants (PidginMessageStyle *style) +{ + GList *ret = NULL; + GDir *variants; + const char *css_file; + char *css; + char *variant_dir; + + g_assert (style->style_dir); + variant_dir = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", NULL); + + variants = g_dir_open(variant_dir, 0, NULL); + if (!variants) return NULL; + + while ((css_file = g_dir_read_name(variants)) != NULL) { + if (!g_str_has_suffix (css_file, ".css")) + continue; + + css = g_strndup (css_file, strlen (css_file) - 4); + ret = g_list_append(ret, css); + } + + g_dir_close(variants); + g_free(variant_dir); + + ret = g_list_sort (ret, (GCompareFunc)g_strcmp0); + return ret; +} + +static char* pidgin_message_style_get_css (PidginMessageStyle *style) +{ + if (!style->variant) { + return g_build_filename (style->style_dir, "Contents", "Resources", "main.css", NULL); + } else { + char *file = g_strdup_printf ("%s.css", style->variant); + char *ret = g_build_filename (style->style_dir, "Contents", "Resources", "Variants", file, NULL); + g_free (file); + return ret; + } } static void* webkit_plugin_get_handle () @@ -561,7 +682,7 @@ replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *he char **ms = g_strsplit(text, "%@", 6); char *base = NULL; - + char *csspath = pidgin_message_style_get_css (style); if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { g_strfreev(ms); g_string_free(str, TRUE); @@ -575,13 +696,15 @@ replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *he g_free (base); g_string_append(str, ms[1]); - if (style->basestyle_css) - g_string_append(str, style->basestyle_css); + + /* I'm just going to skip main.css at this point */ + g_string_append(str, ms[2]); - if (style->css_path) { - g_string_append(str, "file://"); - g_string_append(str, style->css_path); - } + + g_string_append(str, "file://"); + g_string_append(str, csspath); + + g_string_append(str, ms[3]); if (header) @@ -592,6 +715,7 @@ replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *he g_string_append(str, ms[5]); g_strfreev(ms); + g_free (csspath); return g_string_free (str, FALSE); } @@ -843,69 +967,6 @@ style_set_default () g_list_free (styles); } -/** - * Get each of the files corresponding to each variant. - */ -static GList* -get_variant_files(PidginMessageStyle *style) -{ - GList *ret = NULL; - GDir *variants; - const char *css_file; - char *css; - char *variant_dir; - - g_assert (style->style_dir); - variant_dir = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", NULL); - - variants = g_dir_open(variant_dir, 0, NULL); - if (!variants) return NULL; - - while ((css_file = g_dir_read_name(variants)) != NULL) { - if (!g_str_has_suffix (css_file, ".css")) - continue; - - css = g_build_filename(variant_dir, css_file, NULL); - ret = g_list_append(ret, css); - } - - g_dir_close(variants); - g_free(variant_dir); - - ret = g_list_sort (ret, (GCompareFunc)g_strcmp0); - return ret; -} - -static void -variant_set_default (PidginMessageStyle* style) -{ - GList *all, *iter; - const char *css_path = purple_prefs_get_string ("/plugins/gtk/adiumthemes/csspath"); - - g_free (style->css_path); - if (css_path && g_str_has_prefix (css_path, style->style_dir) && - g_file_test (css_path, G_FILE_TEST_EXISTS)) { - style->css_path = g_strdup (css_path); - return; - } - else { - /* something about the theme has changed */ - css_path = NULL; - } - - all = get_variant_files (style); - - if (all) { - style->css_path = g_strdup (all->data); - purple_prefs_set_string ("/plugins/gtk/adiumthemes/csspath", css_path); - } - - for (iter = all; iter; iter = g_list_next (iter)) - g_free (iter->data); - - g_list_free (all); -} - static gboolean plugin_load(PurplePlugin *plugin) { @@ -968,6 +1029,10 @@ plugin_unload(PurplePlugin *plugin) return TRUE; } +/* + * UI config code + */ + static void style_changed (GtkWidget* combobox, gpointer null) { @@ -1031,9 +1096,9 @@ variant_update_conversation (PurpleConversation *conv) PidginMessageStyle *style = (PidginMessageStyle*) g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY); char *script; - g_assert (style && style->css_path); + g_assert (style); - script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", style->css_path); + script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css (style)); gtk_webview_safe_execute_script (GTK_WEBVIEW(webview), script); g_free (script); } @@ -1041,40 +1106,22 @@ variant_update_conversation (PurpleConversation *conv) static void variant_changed (GtkWidget* combobox, gpointer null) { - char *name, *name_with_ext; - char *css_path; + char *name; GList *list; PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); g_assert (style); + name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combobox)); + pidgin_message_style_set_variant (style, name); - /* it is possible that the theme changed by this point, so we check - * that first */ - - name = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combobox)); - name_with_ext = g_strdup_printf ("%s.css", name); - g_free (name); - - css_path = g_build_filename (style->style_dir, "Contents", "Resources", "Variants", name_with_ext, NULL); - - if (!g_file_test (css_path, G_FILE_TEST_EXISTS)) { - goto cleanup; - } - - g_free (style->css_path); - style->css_path = g_strdup (css_path); - purple_prefs_set_string ("/plugins/gtk/adiumthemes/csspath", css_path); - - /* update each conversation */ + /* update conversations */ list = purple_get_conversations (); while (list) { variant_update_conversation (list->data); list = g_list_next(list); } -cleanup: - g_free (css_path); - g_free (name_with_ext); + g_free (name); pidgin_message_style_unref (style); } @@ -1082,32 +1129,25 @@ static GtkWidget * get_variant_config_frame() { PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); - GList *variants = get_variant_files(style), *iter; + GList *variants = pidgin_message_style_get_variants (style), *iter; + char *cur_variant = pidgin_message_style_get_variant (style); GtkWidget *combobox = gtk_combo_box_new_text(); int def = -1, index = 0; - char* css_path = g_strdup (style->css_path); pidgin_message_style_unref (style); for (iter = variants; iter; iter = g_list_next (iter)) { - char *basename = g_path_get_basename(iter->data); - char *dirname = g_path_get_dirname(iter->data); - char *temp = g_strndup (basename, strlen(basename)-4); - gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), temp); - g_free (temp); + gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), iter->data); - if (g_str_has_suffix (css_path, basename)) + if (g_str_equal (cur_variant, iter->data)) def = index; index ++; - g_free (basename); - g_free (dirname); } gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), def); g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL); - g_free (css_path); return combobox; } -- cgit v1.2.1 From 378143165060a20f1794f163a992e49e8936de82 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Wed, 12 Aug 2009 02:01:35 +0000 Subject: just some debugging info. --- pidgin/plugins/adiumthemes/webkit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index e2d4ef82a9..b9683f002f 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -767,6 +767,8 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); g_assert(template); + + purple_debug_info ("webkit", "template: %s\n", template); webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style); @@ -851,6 +853,7 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, escape = gtk_webview_quote_js_string (msg); script = g_strdup_printf("%s(%s)", func, escape); + purple_debug_info ("webkit", "JS: %s\n", script); gtk_webview_safe_execute_script (GTK_WEBVIEW (webkit), script); g_free(script); -- cgit v1.2.1 From c262ecaf0a0060b997c1592f719d53d539164673 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Wed, 12 Aug 2009 02:24:41 +0000 Subject: hmm, fonts and font sizes from Info.plist. --- pidgin/plugins/adiumthemes/webkit.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index b9683f002f..11ec5fc7c2 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -730,6 +730,19 @@ get_webkit(PurpleConversation *conv) return gtkconv->webview; } +static void set_theme_font_settings (WebKitWebView *webview, PidginMessageStyle *style) +{ + WebKitWebSettings *settings; + + g_object_get (G_OBJECT(webview), "settings", &settings, NULL); + if (style->default_font_family) + g_object_set (G_OBJECT (settings), "default-font-family", style->default_font_family, NULL); + + if (style->default_font_size) + g_object_set (G_OBJECT (settings), "default-font-size", GINT_TO_POINTER (style->default_font_size), NULL); +} + + /** * Called when either a new PurpleConversation is created * or when a PidginConversation changes its active PurpleConversation @@ -769,6 +782,8 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) g_assert(template); purple_debug_info ("webkit", "template: %s\n", template); + + set_theme_font_settings (WEBKIT_WEB_VIEW(webkit), style); webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style); @@ -1103,6 +1118,8 @@ variant_update_conversation (PurpleConversation *conv) script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css (style)); gtk_webview_safe_execute_script (GTK_WEBVIEW(webview), script); + + set_theme_font_settings (WEBKIT_WEB_VIEW (gtkconv->webview), style); g_free (script); } -- cgit v1.2.1 From ae61770ab0adab293b414b69471fb3d01ff6a509 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Thu, 13 Aug 2009 19:58:17 +0000 Subject: apparent code for webkit transparency that might not be working. --- pidgin/plugins/adiumthemes/webkit.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 11ec5fc7c2..2ea99263cd 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -730,7 +730,7 @@ get_webkit(PurpleConversation *conv) return gtkconv->webview; } -static void set_theme_font_settings (WebKitWebView *webview, PidginMessageStyle *style) +static void set_theme_webkit_settings (WebKitWebView *webview, PidginMessageStyle *style) { WebKitWebSettings *settings; @@ -740,6 +740,9 @@ static void set_theme_font_settings (WebKitWebView *webview, PidginMessageStyle if (style->default_font_size) g_object_set (G_OBJECT (settings), "default-font-size", GINT_TO_POINTER (style->default_font_size), NULL); + + /* this does not work :( */ + webkit_web_view_set_transparent (webview, style->default_background_is_transparent); } @@ -783,7 +786,7 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) purple_debug_info ("webkit", "template: %s\n", template); - set_theme_font_settings (WEBKIT_WEB_VIEW(webkit), style); + set_theme_webkit_settings (WEBKIT_WEB_VIEW(webkit), style); webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style); @@ -1119,7 +1122,7 @@ variant_update_conversation (PurpleConversation *conv) script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css (style)); gtk_webview_safe_execute_script (GTK_WEBVIEW(webview), script); - set_theme_font_settings (WEBKIT_WEB_VIEW (gtkconv->webview), style); + set_theme_webkit_settings (WEBKIT_WEB_VIEW (gtkconv->webview), style); g_free (script); } -- cgit v1.2.1 From 54fff0eed52c0026727efbfbd278c5e78d6d1b56 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Fri, 14 Aug 2009 02:51:41 +0000 Subject: Separated the MessageStyle loading code from the actual rendering code. --- pidgin/plugins/adiumthemes/Makefile.am | 4 +- pidgin/plugins/adiumthemes/message-style.c | 429 +++++++++++++++++++++++++++ pidgin/plugins/adiumthemes/message-style.h | 56 ++++ pidgin/plugins/adiumthemes/webkit.c | 450 +---------------------------- 4 files changed, 495 insertions(+), 444 deletions(-) create mode 100644 pidgin/plugins/adiumthemes/message-style.c create mode 100644 pidgin/plugins/adiumthemes/message-style.h diff --git a/pidgin/plugins/adiumthemes/Makefile.am b/pidgin/plugins/adiumthemes/Makefile.am index e9d0b8a5d6..dba8959310 100644 --- a/pidgin/plugins/adiumthemes/Makefile.am +++ b/pidgin/plugins/adiumthemes/Makefile.am @@ -12,7 +12,9 @@ if PLUGINS webkit_LTLIBRARIES = webkit.la -webkit_la_SOURCES = webkit.c +webkit_la_SOURCES = webkit.c \ + message-style.h \ + message-style.c endif diff --git a/pidgin/plugins/adiumthemes/message-style.c b/pidgin/plugins/adiumthemes/message-style.c new file mode 100644 index 0000000000..fa6dc67658 --- /dev/null +++ b/pidgin/plugins/adiumthemes/message-style.c @@ -0,0 +1,429 @@ +/* + * Adium Message Styles + * Copyright (C) 2009 Arnold Noronha + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include "message-style.h" + +#include + +#include + +#include +#include + +static GList *style_list; /**< List of PidginMessageStyles */ + +static void +glist_free_all_string (GList *list) +{ + GList *first = list; + for (; list; list = g_list_next (list)) + g_free (list->data); + g_list_free (first); +} + +static +PidginMessageStyle* pidgin_message_style_new (const char* styledir) +{ + PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1); + GList *iter; + + /* sanity check */ + for (iter = style_list; iter; iter = g_list_next (iter)) + g_assert (!g_str_equal (((PidginMessageStyle*)iter->data)->style_dir, styledir)); + + ret->ref_counter = 1; + ret->style_dir = g_strdup (styledir); + + style_list = g_list_append (style_list, ret); + return ret; +} + +/** + * deallocate any memory used for info.plist options + */ +static void +pidgin_message_style_unset_info_plist (PidginMessageStyle *style) +{ + style->message_view_version = 0; + g_free (style->cf_bundle_name); + style->cf_bundle_name = NULL; + + g_free (style->cf_bundle_identifier); + style->cf_bundle_identifier = NULL; + + g_free (style->cf_bundle_get_info_string); + style->cf_bundle_get_info_string = NULL; + + g_free (style->default_font_family); + style->default_font_family = NULL; + + style->default_font_size = 0; + style->shows_user_icons = TRUE; + style->disable_combine_consecutive = FALSE; + style->default_background_is_transparent = FALSE; + style->disable_custom_background = FALSE; + + g_free (style->default_background_color); + style->default_background_color = NULL; + + style->allow_text_colors = TRUE; + + g_free (style->image_mask); + style->image_mask = NULL; +} + + +void pidgin_message_style_unref (PidginMessageStyle *style) +{ + if (!style) return; + g_assert (style->ref_counter > 0); + + style->ref_counter--; + if (style->ref_counter) return; + + g_free (style->style_dir); + g_free (style->template_path); + + g_free (style->template_html); + g_free (style->incoming_content_html); + g_free (style->outgoing_content_html); + g_free (style->outgoing_next_content_html); + g_free (style->status_html); + g_free (style->basestyle_css); + + style_list = g_list_remove (style_list, style); + g_free (style); + + pidgin_message_style_unset_info_plist (style); +} + +void +pidgin_message_style_save_state (PidginMessageStyle *style) +{ + char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); + char *variant = g_strdup_printf ("%s/%s", prefname, style->variant); + + purple_prefs_add_none (prefname); + purple_prefs_add_string (variant, ""); + purple_prefs_set_string (variant, style->variant); + + g_free (prefname); + g_free (variant); +} + +void +pidgin_message_style_load_state (PidginMessageStyle *style) +{ + char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); + char *variant = g_strdup_printf ("%s/%s", prefname, style->variant); + + const char* value = purple_prefs_get_string (variant); + gboolean changed = !style->variant || !g_str_equal (style->variant, value); + + g_free (style->variant); + style->variant = g_strdup (value); + + if (changed) pidgin_message_style_read_info_plist (style, style->variant); + + g_free (prefname); + g_free(variant); +} + + +static gboolean +parse_info_plist_key_value (xmlnode* key, gpointer destination, const char* expected) +{ + xmlnode *val = key->next; + + for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next); + if (!val) return FALSE; + + if (expected == NULL || g_str_equal (expected, "string")) { + char** dest = (char**) destination; + if (!g_str_equal (val->name, "string")) return FALSE; + if (*dest) g_free (*dest); + *dest = xmlnode_get_data_unescaped (val); + } else if (g_str_equal (expected, "integer")) { + int* dest = (int*) destination; + char* value = xmlnode_get_data_unescaped (val); + + if (!g_str_equal (val->name, "integer")) return FALSE; + *dest = atoi (value); + g_free (value); + } else if (g_str_equal (expected, "boolean")) { + gboolean *dest = (gboolean*) destination; + if (g_str_equal (val->name, "true")) *dest = TRUE; + else if (g_str_equal (val->name, "false")) *dest = FALSE; + else return FALSE; + } else return FALSE; + + return TRUE; +} + +static +gboolean str_for_key (const char *key, const char *found, const char *variant){ + if (g_str_equal (key, found)) return TRUE; + if (!variant) return FALSE; + return (g_str_has_prefix (found, key) + && g_str_has_suffix (found, variant) + && strlen (found) == strlen (key) + strlen (variant) + 1); +} + +/** + * Info.plist should be re-read every time the variant changes, this is because + * the keys that take precedence depend on the value of the current variant. + */ +void +pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant) +{ + /* note that if a variant is used the option:VARIANTNAME takes precedence */ + char *contents = g_build_filename (style->style_dir, "Contents", NULL); + xmlnode *plist = xmlnode_from_file (contents, "Info.plist", "Info.plist", "webkit"), *iter; + xmlnode *dict = xmlnode_get_child (plist, "dict"); + + g_assert (dict); + for (iter = xmlnode_get_child (dict, "key"); iter; iter = xmlnode_get_next_twin (iter)) { + char* key = xmlnode_get_data_unescaped (iter); + gboolean pr = TRUE; + + if (g_str_equal ("MessageViewVersion", key)) + pr = parse_info_plist_key_value (iter, &style->message_view_version, "integer"); + else if (g_str_equal ("CFBundleName", key)) + pr = parse_info_plist_key_value (iter, &style->cf_bundle_name, "string"); + else if (g_str_equal ("CFBundleIdentifier", key)) + pr = parse_info_plist_key_value (iter, &style->cf_bundle_identifier, "string"); + else if (g_str_equal ("CFBundleGetInfoString", key)) + pr = parse_info_plist_key_value (iter, &style->cf_bundle_get_info_string, "string"); + else if (str_for_key ("DefaultFontFamily", key, variant)) + pr = parse_info_plist_key_value (iter, &style->default_font_family, "string"); + else if (str_for_key ("DefaultFontSize", key, variant)) + pr = parse_info_plist_key_value (iter, &style->default_font_size, "integer"); + else if (str_for_key ("ShowsUserIcons", key, variant)) + pr = parse_info_plist_key_value (iter, &style->shows_user_icons, "boolean"); + else if (str_for_key ("DisableCombineConsecutive", key, variant)) + pr = parse_info_plist_key_value (iter, &style->disable_combine_consecutive, "boolean"); + else if (str_for_key ("DefaultBackgroundIsTransparent", key, variant)) + pr = parse_info_plist_key_value (iter, &style->default_background_is_transparent, "boolean"); + else if (str_for_key ("DisableCustomBackground", key, variant)) + pr = parse_info_plist_key_value (iter, &style->disable_custom_background, "boolean"); + else if (str_for_key ("DefaultBackgroundColor", key, variant)) + pr = parse_info_plist_key_value (iter, &style->default_background_color, "string"); + else if (str_for_key ("AllowTextColors", key, variant)) + pr = parse_info_plist_key_value (iter, &style->allow_text_colors, "string"); + else if (str_for_key ("ImageMask", key, variant)) + pr = parse_info_plist_key_value (iter, &style->image_mask, "string"); + + g_free (key); + if (!pr) break; /* does not make sense */ + } + + xmlnode_free (plist); +} + +PidginMessageStyle* +pidgin_message_style_load (const char* styledir) +{ + /* + * the loading process described: + * + * First we load all the style .html files, etc. + * The we load any config options that have been stored for + * this variant. + * Then we load the Info.plist, for the currently decided variant. + * At this point, if we find that variants exist, yet + * we don't have a variant selected, we choose DefaultVariant + * and if that does not exist, we choose the first one in the + * directory. + */ + + /* is this style already loaded? */ + GList *cur = style_list; + char *file; /* temporary variable */ + PidginMessageStyle *style = NULL; + + g_assert (styledir); + for (cur = style_list; cur; cur = g_list_next (cur)) { + style = (PidginMessageStyle*) cur->data; + if (g_str_equal (styledir, style->style_dir)) { + style->ref_counter++; + return style; + } + } + + /* else we need to load it */ + style = pidgin_message_style_new (styledir); + + /* load all other files */ + + /* The template path can either come from the theme, or can + * be stock Template.html that comes with the plugin */ + style->template_path = g_build_filename(styledir, "Contents", "Resources", "Template.html", NULL); + + if (!g_file_test(style->template_path, G_FILE_TEST_EXISTS)) { + g_free (style->template_path); + style->template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); + } + + if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) { + pidgin_message_style_unref (style); + purple_debug_error ("webkit", "Could not locate a Template.html\n"); + return NULL; + } + + file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL); + if (!g_file_get_contents(file, &style->status_html, NULL, NULL)) { + purple_debug_info ("webkit", "%s could not find Resources/Status.html", styledir); + pidgin_message_style_unref (style); + g_free (file); + return NULL; + } + g_free (file); + + file = g_build_filename(styledir, "Contents", "Resources", "main.css", NULL); + if (!g_file_get_contents(file, &style->basestyle_css, NULL, NULL)) + style->basestyle_css = g_strdup (""); + g_free (file); + + file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL); + if (!g_file_get_contents(file, &style->header_html, NULL, NULL)) + style->header_html = g_strdup (""); + g_free (file); + + file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL); + if (!g_file_get_contents(file, &style->footer_html, NULL, NULL)) + style->footer_html = g_strdup (""); + g_free (file); + + file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); + if (!g_file_get_contents(file, &style->incoming_content_html, NULL, NULL)) { + purple_debug_info ("webkit", "%s did not have a Incoming/Content.html\n", styledir); + pidgin_message_style_unref (style); + g_free (file); + return NULL; + } + g_free (file); + + + /* according to the spec, the following are optional files */ + file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); + if (!g_file_get_contents(file, &style->incoming_next_content_html, NULL, NULL)) { + style->incoming_next_content_html = g_strdup (style->incoming_content_html); + } + g_free (file); + + file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "Content.html", NULL); + if (!g_file_get_contents(file, &style->outgoing_content_html, NULL, NULL)) { + style->outgoing_content_html = g_strdup(style->incoming_content_html); + } + g_free (file); + + file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); + if (!g_file_get_contents(file, &style->outgoing_next_content_html, NULL, NULL)) { + style->outgoing_next_content_html = g_strdup (style->outgoing_content_html); + } + + pidgin_message_style_load_state (style); + pidgin_message_style_read_info_plist (style, style->variant); + + /* non variant dependent Info.plist checks */ + if (style->message_view_version < 3) { + pidgin_message_style_unref (style); + return NULL; + } + + if (!style->variant) + { + GList *variants = pidgin_message_style_get_variants (style); + + if (variants) + pidgin_message_style_set_variant (style, variants->data); + + glist_free_all_string (variants); + pidgin_message_style_save_state (style); + } + + return style; +} + +void +pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant) +{ + /* I'm not going to test whether this variant is valid! */ + g_free (style->variant); + style->variant = g_strdup (variant); + + pidgin_message_style_read_info_plist (style, variant); + pidgin_message_style_save_state (style); + + /* todo, the style has "changed". Ideally, I would like to use signals at this point. */ +} + +char* pidgin_message_style_get_variant (PidginMessageStyle *style) +{ + return g_strdup (style->variant); +} + +/** + * Get a list of variants supported by the style. + */ +GList* +pidgin_message_style_get_variants (PidginMessageStyle *style) +{ + GList *ret = NULL; + GDir *variants; + const char *css_file; + char *css; + char *variant_dir; + + g_assert (style->style_dir); + variant_dir = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", NULL); + + variants = g_dir_open(variant_dir, 0, NULL); + if (!variants) return NULL; + + while ((css_file = g_dir_read_name(variants)) != NULL) { + if (!g_str_has_suffix (css_file, ".css")) + continue; + + css = g_strndup (css_file, strlen (css_file) - 4); + ret = g_list_append(ret, css); + } + + g_dir_close(variants); + g_free(variant_dir); + + ret = g_list_sort (ret, (GCompareFunc)g_strcmp0); + return ret; +} + + +char* pidgin_message_style_get_css (PidginMessageStyle *style) +{ + if (!style->variant) { + return g_build_filename (style->style_dir, "Contents", "Resources", "main.css", NULL); + } else { + char *file = g_strdup_printf ("%s.css", style->variant); + char *ret = g_build_filename (style->style_dir, "Contents", "Resources", "Variants", file, NULL); + g_free (file); + return ret; + } +} + + diff --git a/pidgin/plugins/adiumthemes/message-style.h b/pidgin/plugins/adiumthemes/message-style.h new file mode 100644 index 0000000000..b98f79fbc5 --- /dev/null +++ b/pidgin/plugins/adiumthemes/message-style.h @@ -0,0 +1,56 @@ + +#include + +/* + * I'm going to allow a different style for each PidginConversation. + * This way I can do two things: 1) change the theme on the fly and not + * change existing themes, and 2) Use a different theme for IMs and + * chats. + */ +typedef struct _PidginMessageStyle { + int ref_counter; + + /* current config options */ + char *variant; /* allowed to be NULL if there are no variants */ + gboolean show_user_icons; + + + /* Info.plist keys */ + int message_view_version; + char *cf_bundle_name; + char *cf_bundle_identifier; + char *cf_bundle_get_info_string; + char *default_font_family; + int default_font_size; + gboolean shows_user_icons; + gboolean disable_combine_consecutive; + gboolean default_background_is_transparent; + gboolean disable_custom_background; + char *default_background_color; + gboolean allow_text_colors; + char *image_mask; + + /* paths */ + char *style_dir; + char *template_path; + + /* caches */ + char *template_html; + char *header_html; + char *footer_html; + char *incoming_content_html; + char *outgoing_content_html; + char *incoming_next_content_html; + char *outgoing_next_content_html; + char *status_html; + char *basestyle_css; +} PidginMessageStyle; + +PidginMessageStyle* pidgin_message_style_load (const char* styledir); +void pidgin_message_style_unref (PidginMessageStyle *style); +void pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant); +char* pidgin_message_style_get_variant (PidginMessageStyle *style); +GList* pidgin_message_style_get_variants (PidginMessageStyle *style); +void pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant); + +char* pidgin_message_style_get_css (PidginMessageStyle *style); diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 2ea99263cd..fca14334fb 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -50,74 +50,14 @@ #include #include + +#include "message-style.h" /* GObject data keys */ #define MESSAGE_STYLE_KEY "message-style" -/* - * I'm going to allow a different style for each PidginConversation. - * This way I can do two things: 1) change the theme on the fly and not - * change existing themes, and 2) Use a different theme for IMs and - * chats. - */ -typedef struct _PidginMessageStyle { - int ref_counter; - - /* current config options */ - char *variant; /* allowed to be NULL if there are no variants */ - char *bg_color; - - /* Info.plist keys */ - int message_view_version; - char *cf_bundle_name; - char *cf_bundle_identifier; - char *cf_bundle_get_info_string; - char *default_font_family; - int default_font_size; - gboolean shows_user_icons; - gboolean disable_combine_consecutive; - gboolean default_background_is_transparent; - gboolean disable_custom_background; - char *default_background_color; - gboolean allow_text_colors; - char *image_mask; - - /* paths */ - char *style_dir; - char *template_path; - - /* caches */ - char *template_html; - char *header_html; - char *footer_html; - char *incoming_content_html; - char *outgoing_content_html; - char *incoming_next_content_html; - char *outgoing_next_content_html; - char *status_html; - char *basestyle_css; -} PidginMessageStyle; - -static GList *style_list; /**< List of PidginMessageStyles */ static char *cur_style_dir = NULL; static void *handle = NULL; -static PidginMessageStyle* pidgin_message_style_new (const char* styledir); -static PidginMessageStyle* pidgin_message_style_load (const char* styledir); -static void pidgin_message_style_unref (PidginMessageStyle *style); -static void pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant); -static char* pidgin_message_style_get_variant (PidginMessageStyle *style); -static GList* pidgin_message_style_get_variants (PidginMessageStyle *style); -static void pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant); - -static void -glist_free_all_string (GList *list) -{ - GList *first = list; - for (; list; list = g_list_next (list)) - g_free (list->data); - g_list_free (first); -} - static inline char* get_absolute_path (const char *path) { if (g_path_is_absolute (path)) return g_strdup (path); @@ -129,393 +69,17 @@ static inline char* get_absolute_path (const char *path) } } -static PidginMessageStyle* pidgin_message_style_new (const char* styledir) -{ - PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1); - GList *iter; - - /* sanity check */ - for (iter = style_list; iter; iter = g_list_next (iter)) - g_assert (!g_str_equal (((PidginMessageStyle*)iter->data)->style_dir, styledir)); - - ret->ref_counter = 1; - ret->style_dir = g_strdup (styledir); - - style_list = g_list_append (style_list, ret); - return ret; -} - -/** - * deallocate any memory used for info.plist options - */ static void -pidgin_message_style_unset_info_plist (PidginMessageStyle *style) -{ - style->message_view_version = 0; - g_free (style->cf_bundle_name); - style->cf_bundle_name = NULL; - - g_free (style->cf_bundle_identifier); - style->cf_bundle_identifier = NULL; - - g_free (style->cf_bundle_get_info_string); - style->cf_bundle_get_info_string = NULL; - - g_free (style->default_font_family); - style->default_font_family = NULL; - - style->default_font_size = 0; - style->shows_user_icons = TRUE; - style->disable_combine_consecutive = FALSE; - style->default_background_is_transparent = FALSE; - style->disable_custom_background = FALSE; - - g_free (style->default_background_color); - style->default_background_color = NULL; - - style->allow_text_colors = TRUE; - - g_free (style->image_mask); - style->image_mask = NULL; -} - - -static void pidgin_message_style_unref (PidginMessageStyle *style) -{ - if (!style) return; - g_assert (style->ref_counter > 0); - - style->ref_counter--; - if (style->ref_counter) return; - - g_free (style->style_dir); - g_free (style->template_path); - - g_free (style->template_html); - g_free (style->incoming_content_html); - g_free (style->outgoing_content_html); - g_free (style->outgoing_next_content_html); - g_free (style->status_html); - g_free (style->basestyle_css); - - style_list = g_list_remove (style_list, style); - g_free (style); - - pidgin_message_style_unset_info_plist (style); -} - -static void -pidgin_message_style_save_state (PidginMessageStyle *style) -{ - char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); - char *variant = g_strdup_printf ("%s/%s", prefname, style->variant); - - purple_prefs_add_none (prefname); - purple_prefs_add_string (variant, ""); - purple_prefs_set_string (variant, style->variant); - - g_free (prefname); - g_free (variant); -} - -static void -pidgin_message_style_load_state (PidginMessageStyle *style) +glist_free_all_string (GList *list) { - char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); - char *variant = g_strdup_printf ("%s/%s", prefname, style->variant); - - const char* value = purple_prefs_get_string (variant); - gboolean changed = !style->variant || !g_str_equal (style->variant, value); - - g_free (style->variant); - style->variant = g_strdup (value); - - if (changed) pidgin_message_style_read_info_plist (style, style->variant); - - g_free (prefname); - g_free(variant); + GList *first = list; + for (; list; list = g_list_next (list)) + g_free (list->data); + g_list_free (first); } static void webkit_on_webview_destroy (GtkObject* obj, gpointer data); -static gboolean -parse_info_plist_key_value (xmlnode* key, gpointer destination, const char* expected) -{ - xmlnode *val = key->next; - - for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next); - if (!val) return FALSE; - - if (expected == NULL || g_str_equal (expected, "string")) { - char** dest = (char**) destination; - if (!g_str_equal (val->name, BAD_CAST "string")) return FALSE; - if (*dest) g_free (*dest); - *dest = xmlnode_get_data_unescaped (val); - } else if (g_str_equal (expected, "integer")) { - int* dest = (int*) destination; - char* value = xmlnode_get_data_unescaped (val); - - if (!g_str_equal (val->name, "integer")) return FALSE; - *dest = atoi (value); - g_free (value); - } else if (g_str_equal (expected, "boolean")) { - gboolean *dest = (gboolean*) destination; - if (g_str_equal (val->name, BAD_CAST "true")) *dest = TRUE; - else if (g_str_equal (val->name, BAD_CAST "false")) *dest = FALSE; - else return FALSE; - } else return FALSE; - - return TRUE; -} - -static -gboolean str_for_key (const char *key, const char *found, const char *variant){ - if (g_str_equal (key, found)) return TRUE; - if (!variant) return FALSE; - return (g_str_has_prefix (found, key) - && g_str_has_suffix (found, variant) - && strlen (found) == strlen (key) + strlen (variant) + 1); -} - -/** - * Info.plist should be re-read every time the variant changes, this is because - * the keys that take precedence depend on the value of the current variant. - */ -static void -pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant) -{ - /* note that if a variant is used the option:VARIANTNAME takes precedence */ - char *contents = g_build_filename (style->style_dir, "Contents", NULL); - xmlnode *plist = xmlnode_from_file (contents, "Info.plist", "Info.plist", "webkit"), *iter; - xmlnode *dict = xmlnode_get_child (plist, "dict"); - - g_assert (dict); - for (iter = xmlnode_get_child (dict, "key"); iter; iter = xmlnode_get_next_twin (iter)) { - char* key = xmlnode_get_data_unescaped (iter); - gboolean pr = TRUE; - - if (g_str_equal ("MessageViewVersion", key)) - pr = parse_info_plist_key_value (iter, &style->message_view_version, "integer"); - else if (g_str_equal ("CFBundleName", key)) - pr = parse_info_plist_key_value (iter, &style->cf_bundle_name, "string"); - else if (g_str_equal ("CFBundleIdentifier", key)) - pr = parse_info_plist_key_value (iter, &style->cf_bundle_identifier, "string"); - else if (g_str_equal ("CFBundleGetInfoString", key)) - pr = parse_info_plist_key_value (iter, &style->cf_bundle_get_info_string, "string"); - else if (str_for_key ("DefaultFontFamily", key, variant)) - pr = parse_info_plist_key_value (iter, &style->default_font_family, "string"); - else if (str_for_key ("DefaultFontSize", key, variant)) - pr = parse_info_plist_key_value (iter, &style->default_font_size, "integer"); - else if (str_for_key ("ShowsUserIcons", key, variant)) - pr = parse_info_plist_key_value (iter, &style->shows_user_icons, "boolean"); - else if (str_for_key ("DisableCombineConsecutive", key, variant)) - pr = parse_info_plist_key_value (iter, &style->disable_combine_consecutive, "boolean"); - else if (str_for_key ("DefaultBackgroundIsTransparent", key, variant)) - pr = parse_info_plist_key_value (iter, &style->default_background_is_transparent, "boolean"); - else if (str_for_key ("DisableCustomBackground", key, variant)) - pr = parse_info_plist_key_value (iter, &style->disable_custom_background, "boolean"); - else if (str_for_key ("DefaultBackgroundColor", key, variant)) - pr = parse_info_plist_key_value (iter, &style->default_background_color, "string"); - else if (str_for_key ("AllowTextColors", key, variant)) - pr = parse_info_plist_key_value (iter, &style->allow_text_colors, "string"); - else if (str_for_key ("ImageMask", key, variant)) - pr = parse_info_plist_key_value (iter, &style->image_mask, "string"); - - g_free (key); - if (!pr) break; /* does not make sense */ - } - - xmlnode_free (plist); -} - -static PidginMessageStyle* -pidgin_message_style_load (const char* styledir) -{ - /* - * the loading process described: - * - * First we load all the style .html files, etc. - * The we load any config options that have been stored for - * this variant. - * Then we load the Info.plist, for the currently decided variant. - * At this point, if we find that variants exist, yet - * we don't have a variant selected, we choose DefaultVariant - * and if that does not exist, we choose the first one in the - * directory. - */ - - /* is this style already loaded? */ - GList *cur = style_list; - char *file; /* temporary variable */ - PidginMessageStyle *style = NULL; - - g_assert (styledir); - for (cur = style_list; cur; cur = g_list_next (cur)) { - style = (PidginMessageStyle*) cur->data; - if (g_str_equal (styledir, style->style_dir)) { - style->ref_counter++; - return style; - } - } - - /* else we need to load it */ - style = pidgin_message_style_new (styledir); - - /* load all other files */ - - /* The template path can either come from the theme, or can - * be stock Template.html that comes with the plugin */ - style->template_path = g_build_filename(styledir, "Contents", "Resources", "Template.html", NULL); - - if (!g_file_test(style->template_path, G_FILE_TEST_EXISTS)) { - g_free (style->template_path); - style->template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); - } - - if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) { - pidgin_message_style_unref (style); - purple_debug_error ("webkit", "Could not locate a Template.html\n"); - return NULL; - } - - file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL); - if (!g_file_get_contents(file, &style->status_html, NULL, NULL)) { - purple_debug_info ("webkit", "%s could not find Resources/Status.html", styledir); - pidgin_message_style_unref (style); - g_free (file); - return NULL; - } - g_free (file); - - file = g_build_filename(styledir, "Contents", "Resources", "main.css", NULL); - if (!g_file_get_contents(file, &style->basestyle_css, NULL, NULL)) - style->basestyle_css = g_strdup (""); - g_free (file); - - file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL); - if (!g_file_get_contents(file, &style->header_html, NULL, NULL)) - style->header_html = g_strdup (""); - g_free (file); - - file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL); - if (!g_file_get_contents(file, &style->footer_html, NULL, NULL)) - style->footer_html = g_strdup (""); - g_free (file); - - file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); - if (!g_file_get_contents(file, &style->incoming_content_html, NULL, NULL)) { - purple_debug_info ("webkit", "%s did not have a Incoming/Content.html\n", styledir); - pidgin_message_style_unref (style); - g_free (file); - return NULL; - } - g_free (file); - - - /* according to the spec, the following are optional files */ - file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); - if (!g_file_get_contents(file, &style->incoming_next_content_html, NULL, NULL)) { - style->incoming_next_content_html = g_strdup (style->incoming_content_html); - } - g_free (file); - - file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "Content.html", NULL); - if (!g_file_get_contents(file, &style->outgoing_content_html, NULL, NULL)) { - style->outgoing_content_html = g_strdup(style->incoming_content_html); - } - g_free (file); - - file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); - if (!g_file_get_contents(file, &style->outgoing_next_content_html, NULL, NULL)) { - style->outgoing_next_content_html = g_strdup (style->outgoing_content_html); - } - - pidgin_message_style_load_state (style); - pidgin_message_style_read_info_plist (style, style->variant); - - /* non variant dependent Info.plist checks */ - if (style->message_view_version < 3) { - pidgin_message_style_unref (style); - return NULL; - } - - if (!style->variant) - { - GList *variants = pidgin_message_style_get_variants (style); - - if (variants) - pidgin_message_style_set_variant (style, variants->data); - - glist_free_all_string (variants); - pidgin_message_style_save_state (style); - } - - return style; -} - -static void -pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant) -{ - /* I'm not going to test whether this variant is valid! */ - g_free (style->variant); - style->variant = g_strdup (variant); - - pidgin_message_style_read_info_plist (style, variant); - pidgin_message_style_save_state (style); - - /* todo, the style has "changed". Ideally, I would like to use signals at this point. */ -} - -char* pidgin_message_style_get_variant (PidginMessageStyle *style) -{ - return g_strdup (style->variant); -} - -/** - * Get a list of variants supported by the style. - */ -static GList* -pidgin_message_style_get_variants (PidginMessageStyle *style) -{ - GList *ret = NULL; - GDir *variants; - const char *css_file; - char *css; - char *variant_dir; - - g_assert (style->style_dir); - variant_dir = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", NULL); - - variants = g_dir_open(variant_dir, 0, NULL); - if (!variants) return NULL; - - while ((css_file = g_dir_read_name(variants)) != NULL) { - if (!g_str_has_suffix (css_file, ".css")) - continue; - - css = g_strndup (css_file, strlen (css_file) - 4); - ret = g_list_append(ret, css); - } - - g_dir_close(variants); - g_free(variant_dir); - - ret = g_list_sort (ret, (GCompareFunc)g_strcmp0); - return ret; -} - -static char* pidgin_message_style_get_css (PidginMessageStyle *style) -{ - if (!style->variant) { - return g_build_filename (style->style_dir, "Contents", "Resources", "main.css", NULL); - } else { - char *file = g_strdup_printf ("%s.css", style->variant); - char *ret = g_build_filename (style->style_dir, "Contents", "Resources", "Variants", file, NULL); - g_free (file); - return ret; - } -} - static void* webkit_plugin_get_handle () { if (handle) return handle; -- cgit v1.2.1 From 5e44c77ef58b67db5cbd26bf9a76c2f6a7a3c8cc Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Fri, 14 Aug 2009 04:47:16 +0000 Subject: load the default variant. Bring back basestyle.css. --- pidgin/plugins/adiumthemes/message-style.c | 2 ++ pidgin/plugins/adiumthemes/message-style.h | 3 ++- pidgin/plugins/adiumthemes/webkit.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pidgin/plugins/adiumthemes/message-style.c b/pidgin/plugins/adiumthemes/message-style.c index fa6dc67658..a59598a8a7 100644 --- a/pidgin/plugins/adiumthemes/message-style.c +++ b/pidgin/plugins/adiumthemes/message-style.c @@ -87,6 +87,8 @@ pidgin_message_style_unset_info_plist (PidginMessageStyle *style) g_free (style->image_mask); style->image_mask = NULL; + g_free (style->default_variant); + style->default_variant = NULL; } diff --git a/pidgin/plugins/adiumthemes/message-style.h b/pidgin/plugins/adiumthemes/message-style.h index b98f79fbc5..ac7919dd63 100644 --- a/pidgin/plugins/adiumthemes/message-style.h +++ b/pidgin/plugins/adiumthemes/message-style.h @@ -29,7 +29,8 @@ typedef struct _PidginMessageStyle { char *default_background_color; gboolean allow_text_colors; char *image_mask; - + char *default_variant; + /* paths */ char *style_dir; char *template_path; diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index fca14334fb..8797629b79 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -261,7 +261,7 @@ replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *he g_string_append(str, ms[1]); - /* I'm just going to skip main.css at this point */ + g_string_append(str, style->basestyle_css); g_string_append(str, ms[2]); -- cgit v1.2.1 From 12521cd0d3da38bca361b146f17e6d6267984547 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sun, 16 Aug 2009 07:01:11 +0000 Subject: Instead of using references, use copy's. Sigh, I know this is a memory inefficient design, but it's the most robust. --- pidgin/plugins/adiumthemes/message-style.c | 56 +++++++++++++++++++----------- pidgin/plugins/adiumthemes/message-style.h | 5 +-- pidgin/plugins/adiumthemes/webkit.c | 17 +++++---- 3 files changed, 49 insertions(+), 29 deletions(-) diff --git a/pidgin/plugins/adiumthemes/message-style.c b/pidgin/plugins/adiumthemes/message-style.c index a59598a8a7..b0d360c2d0 100644 --- a/pidgin/plugins/adiumthemes/message-style.c +++ b/pidgin/plugins/adiumthemes/message-style.c @@ -27,8 +27,6 @@ #include #include -static GList *style_list; /**< List of PidginMessageStyles */ - static void glist_free_all_string (GList *list) { @@ -42,16 +40,10 @@ static PidginMessageStyle* pidgin_message_style_new (const char* styledir) { PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1); - GList *iter; - - /* sanity check */ - for (iter = style_list; iter; iter = g_list_next (iter)) - g_assert (!g_str_equal (((PidginMessageStyle*)iter->data)->style_dir, styledir)); ret->ref_counter = 1; ret->style_dir = g_strdup (styledir); - style_list = g_list_append (style_list, ret); return ret; } @@ -110,7 +102,6 @@ void pidgin_message_style_unref (PidginMessageStyle *style) g_free (style->status_html); g_free (style->basestyle_css); - style_list = g_list_remove (style_list, style); g_free (style); pidgin_message_style_unset_info_plist (style); @@ -256,19 +247,9 @@ pidgin_message_style_load (const char* styledir) */ /* is this style already loaded? */ - GList *cur = style_list; char *file; /* temporary variable */ PidginMessageStyle *style = NULL; - g_assert (styledir); - for (cur = style_list; cur; cur = g_list_next (cur)) { - style = (PidginMessageStyle*) cur->data; - if (g_str_equal (styledir, style->style_dir)) { - style->ref_counter++; - return style; - } - } - /* else we need to load it */ style = pidgin_message_style_new (styledir); @@ -284,8 +265,8 @@ pidgin_message_style_load (const char* styledir) } if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) { + purple_debug_error ("webkit", "Could not locate a Template.html (%s)\n", style->template_path); pidgin_message_style_unref (style); - purple_debug_error ("webkit", "Could not locate a Template.html\n"); return NULL; } @@ -364,6 +345,41 @@ pidgin_message_style_load (const char* styledir) return style; } +PidginMessageStyle* +pidgin_message_style_copy (const PidginMessageStyle *style) +{ + /* it's at times like this that I miss C++ */ + PidginMessageStyle *ret = pidgin_message_style_new (style->style_dir); + + ret->variant = g_strdup (style->variant); + ret->message_view_version = style->message_view_version; + ret->cf_bundle_name = g_strdup (style->cf_bundle_name); + ret->cf_bundle_identifier = g_strdup (style->cf_bundle_identifier); + ret->cf_bundle_get_info_string = g_strdup (style->cf_bundle_get_info_string); + ret->default_font_family = g_strdup (style->default_font_family); + ret->default_font_size = style->default_font_size; + ret->shows_user_icons = style->shows_user_icons; + ret->disable_combine_consecutive = style->disable_combine_consecutive; + ret->default_background_is_transparent = style->default_background_is_transparent; + ret->disable_custom_background = style->disable_custom_background; + ret->default_background_color = g_strdup (style->default_background_color); + ret->allow_text_colors = style->allow_text_colors; + ret->image_mask = g_strdup (style->image_mask); + ret->default_variant = g_strdup (style->default_variant); + + ret->template_path = g_strdup (style->template_path); + ret->template_html = g_strdup (style->template_html); + ret->header_html = g_strdup (style->header_html); + ret->footer_html = g_strdup (style->footer_html); + ret->incoming_content_html = g_strdup (style->incoming_content_html); + ret->outgoing_content_html = g_strdup (style->outgoing_content_html); + ret->incoming_next_content_html = g_strdup (style->incoming_next_content_html); + ret->outgoing_next_content_html = g_strdup (style->outgoing_next_content_html); + ret->status_html = g_strdup (style->status_html); + ret->basestyle_css = g_strdup (style->basestyle_css); + return ret; +} + void pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant) { diff --git a/pidgin/plugins/adiumthemes/message-style.h b/pidgin/plugins/adiumthemes/message-style.h index ac7919dd63..7c21805edc 100644 --- a/pidgin/plugins/adiumthemes/message-style.h +++ b/pidgin/plugins/adiumthemes/message-style.h @@ -12,10 +12,10 @@ typedef struct _PidginMessageStyle { /* current config options */ char *variant; /* allowed to be NULL if there are no variants */ - gboolean show_user_icons; + /* Info.plist keys that change with Variant */ - /* Info.plist keys */ + /* Static Info.plist keys */ int message_view_version; char *cf_bundle_name; char *cf_bundle_identifier; @@ -48,6 +48,7 @@ typedef struct _PidginMessageStyle { } PidginMessageStyle; PidginMessageStyle* pidgin_message_style_load (const char* styledir); +PidginMessageStyle* pidgin_message_style_copy (const PidginMessageStyle *style); void pidgin_message_style_unref (PidginMessageStyle *style); void pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant); char* pidgin_message_style_get_variant (PidginMessageStyle *style); diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 8797629b79..2723a1617d 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -94,7 +94,7 @@ static void webkit_plugin_free_handle () static char * replace_message_tokens( - char *text, + const char *text, gsize len, PurpleConversation *conv, const char *name, @@ -104,8 +104,8 @@ replace_message_tokens( time_t mtime) { GString *str = g_string_new_len(NULL, len); - char *cur = text; - char *prev = cur; + const char *cur = text; + const char *prev = cur; while ((cur = strchr(cur, '%'))) { const char *replace = NULL; @@ -119,7 +119,7 @@ replace_message_tokens( } else if (!strncmp(cur, "%time", strlen("%time"))) { char *format = NULL; if (*(cur + strlen("%time")) == '{') { - char *start = cur + strlen("%time") + 1; + const char *start = cur + strlen("%time") + 1; char *end = strstr(start, "}%"); if (!end) /* Invalid string */ continue; @@ -333,11 +333,12 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) PidginMessageStyle *style, *oldStyle; oldStyle = g_object_get_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY); - if (oldStyle) return; + g_return_if_fail (!oldStyle); purple_debug_info ("webkit", "loading %s\n", style_dir); style = pidgin_message_style_load (style_dir); g_assert (style); + g_assert (style->template_html); /* debugging test? */ basedir = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL); baseuri = g_strdup_printf ("file://%s", basedir); @@ -353,10 +354,12 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) set_theme_webkit_settings (WEBKIT_WEB_VIEW(webkit), style); webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); - g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style); + PidginMessageStyle *copy = pidgin_message_style_copy (style); + g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy); + pidgin_message_style_unref (style); /* I need to unref this style when the webkit object destroys */ - g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), style); + g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); g_free (basedir); g_free (baseuri); -- cgit v1.2.1 From 89ee49ea75ee5c7e18e90af4707a05abce71e552 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sun, 16 Aug 2009 19:28:23 +0000 Subject: Fixing back variants. --- pidgin/plugins/adiumthemes/message-style.c | 11 +++++------ pidgin/plugins/adiumthemes/message-style.h | 1 + pidgin/plugins/adiumthemes/webkit.c | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pidgin/plugins/adiumthemes/message-style.c b/pidgin/plugins/adiumthemes/message-style.c index b0d360c2d0..6f7e4449c3 100644 --- a/pidgin/plugins/adiumthemes/message-style.c +++ b/pidgin/plugins/adiumthemes/message-style.c @@ -108,11 +108,12 @@ void pidgin_message_style_unref (PidginMessageStyle *style) } void -pidgin_message_style_save_state (PidginMessageStyle *style) +pidgin_message_style_save_state (const PidginMessageStyle *style) { char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); - char *variant = g_strdup_printf ("%s/%s", prefname, style->variant); + char *variant = g_strdup_printf ("%s/variant", prefname); + purple_debug_info ("webkit", "saving state with variant %s\n", style->variant); purple_prefs_add_none (prefname); purple_prefs_add_string (variant, ""); purple_prefs_set_string (variant, style->variant); @@ -125,7 +126,7 @@ void pidgin_message_style_load_state (PidginMessageStyle *style) { char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); - char *variant = g_strdup_printf ("%s/%s", prefname, style->variant); + char *variant = g_strdup_printf ("%s/variant", prefname); const char* value = purple_prefs_get_string (variant); gboolean changed = !style->variant || !g_str_equal (style->variant, value); @@ -322,8 +323,8 @@ pidgin_message_style_load (const char* styledir) style->outgoing_next_content_html = g_strdup (style->outgoing_content_html); } + pidgin_message_style_read_info_plist (style, NULL); pidgin_message_style_load_state (style); - pidgin_message_style_read_info_plist (style, style->variant); /* non variant dependent Info.plist checks */ if (style->message_view_version < 3) { @@ -339,7 +340,6 @@ pidgin_message_style_load (const char* styledir) pidgin_message_style_set_variant (style, variants->data); glist_free_all_string (variants); - pidgin_message_style_save_state (style); } return style; @@ -388,7 +388,6 @@ pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant style->variant = g_strdup (variant); pidgin_message_style_read_info_plist (style, variant); - pidgin_message_style_save_state (style); /* todo, the style has "changed". Ideally, I would like to use signals at this point. */ } diff --git a/pidgin/plugins/adiumthemes/message-style.h b/pidgin/plugins/adiumthemes/message-style.h index 7c21805edc..c8f9cdbe9d 100644 --- a/pidgin/plugins/adiumthemes/message-style.h +++ b/pidgin/plugins/adiumthemes/message-style.h @@ -49,6 +49,7 @@ typedef struct _PidginMessageStyle { PidginMessageStyle* pidgin_message_style_load (const char* styledir); PidginMessageStyle* pidgin_message_style_copy (const PidginMessageStyle *style); +void pidgin_message_style_save_state (const PidginMessageStyle *style); void pidgin_message_style_unref (PidginMessageStyle *style); void pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant); char* pidgin_message_style_get_variant (PidginMessageStyle *style); diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 2723a1617d..573b187cbd 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -333,7 +333,7 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) PidginMessageStyle *style, *oldStyle; oldStyle = g_object_get_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY); - g_return_if_fail (!oldStyle); + if (oldStyle) return; purple_debug_info ("webkit", "loading %s\n", style_dir); style = pidgin_message_style_load (style_dir); @@ -703,7 +703,8 @@ variant_changed (GtkWidget* combobox, gpointer null) g_assert (style); name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combobox)); pidgin_message_style_set_variant (style, name); - + pidgin_message_style_save_state (style); + /* update conversations */ list = purple_get_conversations (); while (list) { -- cgit v1.2.1 From f5e9e0891d55ea3761f75f364ab2a838f7c69ca6 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Wed, 19 Aug 2009 02:43:17 +0000 Subject: Use (void) in prototypes. (thanks Elliott) --- pidgin/gtkwebview.c | 4 ++-- pidgin/gtkwebview.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index dbdea56428..f88fb5a51a 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -50,7 +50,7 @@ struct GtkWebViewPriv { gboolean is_loading; }; -GtkWidget* gtk_webview_new () +GtkWidget* gtk_webview_new (void) { GtkWebView* ret = GTK_WEBVIEW (g_object_new(gtk_webview_get_type(), NULL)); return GTK_WIDGET (ret); @@ -313,7 +313,7 @@ gboolean gtk_webview_is_empty (GtkWebView *view) return view->priv->empty; } -GType gtk_webview_get_type () +GType gtk_webview_get_type (void) { static GType mview_type = 0; if (G_UNLIKELY (mview_type == 0)) { diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 25fee3b9a4..574c4ae262 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -63,14 +63,14 @@ typedef struct _GtkWebViewClass GtkWebViewClass; * * @return the GType for GtkWebView widget */ -GType gtk_webview_get_type (); +GType gtk_webview_get_type (void); /** * Create a new GtkWebView object * * @return a GtkWidget corresponding to the GtkWebView object */ -GtkWidget* gtk_webview_new (); +GtkWidget* gtk_webview_new (void); /** * A very basic routine to append html, which can be considered -- cgit v1.2.1 From 3c6dd75fd2956edb05f9e510207e57e9413f39c5 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Wed, 19 Aug 2009 05:04:01 +0000 Subject: Adds the 'groupchat' classname to #Chat when using groupchat. This should be the only requirement for Adium 1.3.x. --- pidgin/plugins/adiumthemes/webkit.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 573b187cbd..5d033762a3 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -309,6 +309,20 @@ static void set_theme_webkit_settings (WebKitWebView *webview, PidginMessageStyl webkit_web_view_set_transparent (webview, style->default_background_is_transparent); } +/* + * The style specification says that if the conversation is a group + * chat then the
element will be given a class + * 'groupchat'. I can't add another '%@' in Template.html because + * that breaks style-specific Template.html's. I have to either use libxml + * or conveniently play with WebKit's javascript engine. The javascript + * engine should work, but it's not an identical behavior. + */ +static void +webkit_set_groupchat (GtkWebView *webview) +{ + gtk_webview_safe_execute_script (webview, "document.getElementById('Chat').className = 'groupchat'"); +} + /** * Called when either a new PurpleConversation is created @@ -361,6 +375,8 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) /* I need to unref this style when the webkit object destroys */ g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); + if (purple_conversation_get_type (conv) == PURPLE_CONV_TYPE_CHAT) + webkit_set_groupchat (GTK_WEBVIEW (webkit)); g_free (basedir); g_free (baseuri); g_free (header); -- cgit v1.2.1 From 624bc9c8b2d3885eb3c30a9ac29c7bd8a5173121 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Tue, 25 Aug 2009 15:40:06 +0000 Subject: Read AllowTextColors key properly. --- pidgin/plugins/adiumthemes/message-style.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pidgin/plugins/adiumthemes/message-style.c b/pidgin/plugins/adiumthemes/message-style.c index 6f7e4449c3..3365d1411f 100644 --- a/pidgin/plugins/adiumthemes/message-style.c +++ b/pidgin/plugins/adiumthemes/message-style.c @@ -122,7 +122,7 @@ pidgin_message_style_save_state (const PidginMessageStyle *style) g_free (variant); } -void +static void pidgin_message_style_load_state (PidginMessageStyle *style) { char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); @@ -220,12 +220,13 @@ pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* var else if (str_for_key ("DefaultBackgroundColor", key, variant)) pr = parse_info_plist_key_value (iter, &style->default_background_color, "string"); else if (str_for_key ("AllowTextColors", key, variant)) - pr = parse_info_plist_key_value (iter, &style->allow_text_colors, "string"); + pr = parse_info_plist_key_value (iter, &style->allow_text_colors, "integer"); else if (str_for_key ("ImageMask", key, variant)) pr = parse_info_plist_key_value (iter, &style->image_mask, "string"); + if (!pr) + purple_debug_warning ("webkit", "Failed to parse key %s\n", key); g_free (key); - if (!pr) break; /* does not make sense */ } xmlnode_free (plist); @@ -328,6 +329,7 @@ pidgin_message_style_load (const char* styledir) /* non variant dependent Info.plist checks */ if (style->message_view_version < 3) { + purple_debug_info ("webkit", "%s is a legacy style (version %d) and will not be loaded\n", style->cf_bundle_name, style->message_view_version); pidgin_message_style_unref (style); return NULL; } -- cgit v1.2.1 From 3fb1b8e2803c6684e6f994dfd362ed1e14fecde6 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Wed, 26 Aug 2009 03:19:30 +0000 Subject: fixed conflicts in previous merge. --- pidgin/plugins/Makefile.am | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index 3c732ca995..593118692a 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -76,10 +76,6 @@ relnot_la_SOURCES = relnot.c sendbutton_la_SOURCES = sendbutton.c spellchk_la_SOURCES = spellchk.c themeedit_la_SOURCES = themeedit.c themeedit-icon.c themeedit-icon.h -<<<<<<< variant A -timestamp_la_SOURCES = timestamp.c -timestamp_format_la_SOURCES = timestamp_format.c -vvconfig_SOURCES = vvconfig.c xmppconsole_la_SOURCES = xmppconsole.c convcolors_la_LIBADD = $(GTK_LIBS) @@ -87,41 +83,12 @@ contact_priority_la_LIBADD = $(GTK_LIBS) extplacement_la_LIBADD = $(GTK_LIBS) gtk_signals_test_la_LIBADD = $(GTK_LIBS) gtkbuddynote_la_LIBADD = $(GTK_LIBS) -history_la_LIBADD = $(GTK_LIBS) iconaway_la_LIBADD = $(GTK_LIBS) -markerline_la_LIBADD = $(GTK_LIBS) -notify_la_LIBADD = $(GTK_LIBS) pidginrc_la_LIBADD = $(GTK_LIBS) relnot_la_LIBADD = $(GLIB_LIBS) sendbutton_la_LIBADD = $(GTK_LIBS) spellchk_la_LIBADD = $(GTK_LIBS) themeedit_la_LIBADD = $(GTK_LIBS) -timestamp_la_LIBADD = $(GTK_LIBS) -timestamp_format_la_LIBADD = $(GTK_LIBS) -vvconfig_la_LIBADD = $(GTK_LIBS) $(GSTREAMER_LIBS) ->>>>>>> variant B -####### Ancestor -timestamp_la_SOURCES = timestamp.c -timestamp_format_la_SOURCES = timestamp_format.c -xmppconsole_la_SOURCES = xmppconsole.c - -convcolors_la_LIBADD = $(GTK_LIBS) -contact_priority_la_LIBADD = $(GTK_LIBS) -extplacement_la_LIBADD = $(GTK_LIBS) -gtk_signals_test_la_LIBADD = $(GTK_LIBS) -gtkbuddynote_la_LIBADD = $(GTK_LIBS) -history_la_LIBADD = $(GTK_LIBS) -iconaway_la_LIBADD = $(GTK_LIBS) -markerline_la_LIBADD = $(GTK_LIBS) -notify_la_LIBADD = $(GTK_LIBS) -pidginrc_la_LIBADD = $(GTK_LIBS) -relnot_la_LIBADD = $(GLIB_LIBS) -sendbutton_la_LIBADD = $(GTK_LIBS) -spellchk_la_LIBADD = $(GTK_LIBS) -themeedit_la_LIBADD = $(GTK_LIBS) -timestamp_la_LIBADD = $(GTK_LIBS) -timestamp_format_la_LIBADD = $(GTK_LIBS) -======= end xmppconsole_la_LIBADD = $(GTK_LIBS) endif # PLUGINS -- cgit v1.2.1 From 7341097c624984bcaff9d29db6d1bee3175f6e16 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Wed, 14 Oct 2009 02:52:43 +0000 Subject: save the style path across sessions. --- pidgin/plugins/adiumthemes/webkit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 5d033762a3..74ed4ea9b6 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -658,6 +658,7 @@ style_changed (GtkWidget* combobox, gpointer null) g_free (name); g_free (cur_style_dir); cur_style_dir = g_strdup (iter->data);; + purple_prefs_set_string ("/plugins/gtk/adiumthemes/stylepath", cur_style_dir); /* inform the user that existing conversations haven't changed */ dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "The style for existing conversations have not been changed. Please close and re-open the conversation for the changes to take effect."); @@ -846,7 +847,7 @@ init_plugin(PurplePlugin *plugin) { purple_prefs_add_none ("/plugins"); purple_prefs_add_none ("/plugins/gtk"); purple_prefs_add_none ("/plugins/gtk/adiumthemes"); - purple_prefs_add_string ("/plugins/gtk/adiumthemes/csspath", ""); + purple_prefs_add_string ("/plugins/gtk/adiumthemes/stylepath", ""); } PURPLE_INIT_PLUGIN(webkit, init_plugin, info) -- cgit v1.2.1 From 50d18703639013582deb9656fa5a5faa3e528d0b Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Sat, 6 Feb 2010 22:08:41 +0000 Subject: Don't crash if we don't have any theme installed. --- pidgin/plugins/adiumthemes/webkit.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 74ed4ea9b6..e6fcd18cdb 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -39,6 +39,7 @@ /* Purple headers */ #include #include +#include #include #include #include @@ -551,8 +552,15 @@ style_set_default () const char *stylepath = purple_prefs_get_string ("/plugins/gtk/adiumthemes/stylepath"); g_assert (cur_style_dir == NULL); - if (stylepath) + if (stylepath && *stylepath) styles = g_list_prepend (styles, g_strdup (stylepath)); + else { + purple_notify_error(handle, _("Webkit themes"), + _("Can't find installed styles"), + _("Please install some theme and verify the installation path")); + + return; + } /* pick any one that works. Note that we have first preference * for the one in the userdir */ -- cgit v1.2.1 From 3ac4bddc8a03bf9a05e19816e10c99f9ad6df17a Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Sat, 6 Feb 2010 22:18:05 +0000 Subject: webkit: Scroll to end when appending html. Most of the code was taken from imhtml. --- pidgin/gtkconv.c | 2 ++ pidgin/gtkwebview.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ pidgin/gtkwebview.h | 16 +++++++++++++ 3 files changed, 85 insertions(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 1a7e59770a..42546046be 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -4915,6 +4915,8 @@ setup_common_pane(PidginConversation *gtkconv) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (webview_sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtkconv->webview = gtk_webview_new (); + gtk_webview_set_vadjustment(GTK_WEBVIEW(gtkconv->webview), + gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(webview_sw))); gtk_container_add (GTK_CONTAINER (webview_sw), gtkconv->webview); gtk_widget_set_size_request(gtkconv->webview, -1, 0); diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index f88fb5a51a..bd90579bb7 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -48,6 +48,9 @@ struct GtkWebViewPriv { /* JS execute queue */ GQueue *js_queue; gboolean is_loading; + GtkAdjustment *vadj; + guint scroll_src; + GTimer *scroll_time; }; GtkWidget* gtk_webview_new (void) @@ -290,6 +293,10 @@ char *gtk_webview_quote_js_string(const char *text) return g_string_free (str, FALSE); } +void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) +{ + webview->priv->vadj = vadj; +} /* this is a "hack", my plan is to eventually handle this * correctly using a signals and a plugin: the plugin will have @@ -304,6 +311,7 @@ gtk_webview_append_html (GtkWebView* view, const char* html) printf ("script: %s\n", script); webkit_web_view_execute_script (WEBKIT_WEB_VIEW (view), script); view->priv->empty = FALSE; + gtk_webview_scroll_to_end(view, TRUE); g_free (script); g_free (escaped); } @@ -313,6 +321,65 @@ gboolean gtk_webview_is_empty (GtkWebView *view) return view->priv->empty; } +#define MAX_SCROLL_TIME 0.4 /* seconds */ +#define SCROLL_DELAY 33 /* milliseconds */ + +/* + * Smoothly scroll a WebView. + * + * @return TRUE if the window needs to be scrolled further, FALSE if we're at the bottom. + */ +static gboolean smooth_scroll_cb(gpointer data) +{ + struct GtkWebViewPriv *priv = data; + GtkAdjustment *adj = priv->vadj; + gdouble max_val = adj->upper - adj->page_size; + gdouble scroll_val = gtk_adjustment_get_value(adj) + ((max_val - gtk_adjustment_get_value(adj)) / 3); + + g_return_val_if_fail(priv->scroll_time != NULL, FALSE); + + if (g_timer_elapsed(priv->scroll_time, NULL) > MAX_SCROLL_TIME || scroll_val >= max_val) { + /* time's up. jump to the end and kill the timer */ + gtk_adjustment_set_value(adj, max_val); + g_timer_destroy(priv->scroll_time); + priv->scroll_time = NULL; + g_source_remove(priv->scroll_src); + priv->scroll_src = 0; + return FALSE; + } + + /* scroll by 1/3rd the remaining distance */ + gtk_adjustment_set_value(adj, scroll_val); + return TRUE; +} + +static gboolean scroll_idle_cb(gpointer data) +{ + struct GtkWebViewPriv *priv = data; + GtkAdjustment *adj = priv->vadj; + if(adj) { + gtk_adjustment_set_value(adj, adj->upper - adj->page_size); + } + priv->scroll_src = 0; + return FALSE; +} + +void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) +{ + struct GtkWebViewPriv *priv = webview->priv; + if (priv->scroll_time) + g_timer_destroy(priv->scroll_time); + if (priv->scroll_src) + g_source_remove(priv->scroll_src); + if(smooth) { + priv->scroll_time = g_timer_new(); + priv->scroll_src = g_timeout_add_full(G_PRIORITY_LOW, SCROLL_DELAY, smooth_scroll_cb, priv, NULL); + } else { + priv->scroll_time = NULL; + priv->scroll_src = g_idle_add_full(G_PRIORITY_LOW, scroll_idle_cb, priv, NULL); + } +} + GType gtk_webview_get_type (void) { static GType mview_type = 0; diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 574c4ae262..ff5a59dfdc 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -72,6 +72,14 @@ GType gtk_webview_get_type (void); */ GtkWidget* gtk_webview_new (void); +/** + * Set the vertical adjustment for the GtkWebView. + * + * @param webview The GtkWebView. + * @param vadj The GtkAdjustment that control the webview. + */ +void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj); + /** * A very basic routine to append html, which can be considered * equivalent to a "document.write" using JavaScript. @@ -124,4 +132,12 @@ void gtk_webview_safe_execute_script (GtkWebView *webview, const char* script); */ char* gtk_webview_quote_js_string (const char* str); +/** + * Scrolls the Webview to the end of its contents. + * + * @param webview The GtkWebView. + * @param smoth A boolean indicating if smooth scrolling should be used. + */ +void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth); + #endif /* _PIDGIN_WEBVIEW_H_ */ -- cgit v1.2.1 From 6e4f412d7a684f21ad94f572d5226e4f42bb2a41 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 16 Feb 2010 06:54:06 +0000 Subject: Fix some more GTK+3 stuff in gtkconv.c. --- pidgin/gtkconv.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 502d9be088..5d70f7b8f4 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3610,6 +3610,17 @@ regenerate_media_items(PidginWindow *win) purple_prpl_get_media_caps(account, purple_conversation_get_name(conv)); +#if GTK_CHECK_VERSION(2,6,0) + gtk_action_set_sensitive(win->audio_call, + caps & PURPLE_MEDIA_CAPS_AUDIO + ? TRUE : FALSE); + gtk_action_set_sensitive(win->video_call, + caps & PURPLE_MEDIA_CAPS_VIDEO + ? TRUE : FALSE); + gtk_action_set_sensitive(win->audio_video_call, + caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO + ? TRUE : FALSE); +#else gtk_widget_set_sensitive(win->audio_call, caps & PURPLE_MEDIA_CAPS_AUDIO ? TRUE : FALSE); @@ -3619,16 +3630,29 @@ regenerate_media_items(PidginWindow *win) gtk_widget_set_sensitive(win->audio_video_call, caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO ? TRUE : FALSE); +#endif } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { /* for now, don't care about chats... */ +#if GTK_CHECK_VERSION(2,6,0) + gtk_action_set_sensitive(win->audio_call, FALSE); + gtk_action_set_sensitive(win->video_call, FALSE); + gtk_action_set_sensitive(win->audio_video_call, FALSE); +#else gtk_widget_set_sensitive(win->audio_call, FALSE); gtk_widget_set_sensitive(win->video_call, FALSE); gtk_widget_set_sensitive(win->audio_video_call, FALSE); +#endif } else { +#if GTK_CHECK_VERSION(2,6,0) + gtk_action_set_sensitive(win->audio_call, FALSE); + gtk_action_set_sensitive(win->video_call, FALSE); + gtk_action_set_sensitive(win->audio_video_call, FALSE); +#else gtk_widget_set_sensitive(win->audio_call, FALSE); gtk_widget_set_sensitive(win->video_call, FALSE); gtk_widget_set_sensitive(win->audio_video_call, FALSE); +#endif } #endif } @@ -10208,8 +10232,12 @@ pidgin_conv_window_remove_gtkconv(PidginWindow *win, PidginConversation *gtkconv conv_type = purple_conversation_get_type(gtkconv->active_conv); index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont); +#if GTK_CHECK_VERSION(2,10,0) + g_object_ref_sink(G_OBJECT(gtkconv->tab_cont)); +#else g_object_ref(gtkconv->tab_cont); gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); +#endif gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index); -- cgit v1.2.1 From acc563d90dfdf3d3fb19e2d9dae1bf8127d0ff8f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 16 Feb 2010 07:40:57 +0000 Subject: Fix some new uses of GtkTooltips for GTK+ > 2.12. --- pidgin/gtkrequest.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index 59217cabec..36bb868a37 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -85,7 +85,9 @@ pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account) { GtkWidget *image; GdkPixbuf *pixbuf; +#if !GTK_CHECK_VERSION(2,12,0) GtkTooltips *tips; +#endif if (!account) return; @@ -94,8 +96,12 @@ pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account) image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(G_OBJECT(pixbuf)); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(image, purple_account_get_username(account)); +#else tips = gtk_tooltips_new(); gtk_tooltips_set_tip(tips, image, purple_account_get_username(account), NULL); +#endif if (GTK_IS_DIALOG(cont)) { gtk_box_pack_start(GTK_BOX(GTK_DIALOG(cont)->action_area), image, FALSE, TRUE, 0); -- cgit v1.2.1 From 06ddb54c84eaf839c1264cd63ff4f566d27e043a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 16 Feb 2010 08:21:11 +0000 Subject: Update GtkMedia window to use GtkUIManager. --- pidgin/gtkmedia.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c index bae6ad3901..8328622f5e 100644 --- a/pidgin/gtkmedia.c +++ b/pidgin/gtkmedia.c @@ -84,7 +84,11 @@ struct _PidginMediaPrivate gchar *screenname; gulong level_handler_id; +#if GTK_CHECK_VERSION(2,4,0) + GtkUIManager *ui; +#else GtkItemFactory *item_factory; +#endif GtkWidget *menubar; GtkWidget *statusbar; @@ -260,13 +264,33 @@ pidgin_x_error_handler(Display *display, XErrorEvent *event) #endif static void +#if GTK_CHECK_VERSION(2,4,0) +menu_hangup(GtkAction *action, gpointer data) +#else menu_hangup(gpointer data, guint action, GtkWidget *item) +#endif { PidginMedia *gtkmedia = PIDGIN_MEDIA(data); purple_media_stream_info(gtkmedia->priv->media, PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); } +#if GTK_CHECK_VERSION(2,4,0) +static const GtkActionEntry menu_entries[] = { + { "MediaMenu", NULL, N_("_Media"), NULL, NULL, NULL }, + { "Hangup", NULL, N_("_Hangup"), NULL, NULL, G_CALLBACK(menu_hangup) }, +}; + +static const char *media_menu = +"" + "" + "" + "" + "" + "" +""; + +#else static GtkItemFactoryEntry menu_items[] = { { N_("/_Media"), NULL, NULL, 0, "", NULL }, { N_("/Media/_Hangup"), NULL, menu_hangup, 0, "", NULL }, @@ -279,13 +303,45 @@ item_factory_translate_func (const char *path, gpointer func_data) { return _(path); } +#endif static GtkWidget * setup_menubar(PidginMedia *window) { +#if GTK_CHECK_VERSION(2,4,0) + GtkActionGroup *action_group; + GError *error; +#endif GtkAccelGroup *accel_group; GtkWidget *menu; +#if GTK_CHECK_VERSION(2,4,0) + action_group = gtk_action_group_new("MediaActions"); + gtk_action_group_add_actions(action_group, + menu_entries, + G_N_ELEMENTS(menu_entries), + GTK_WINDOW(window)); +#ifdef ENABLE_NLS + gtk_action_group_set_translation_domain(action_group, + PACKAGE); +#endif + + window->priv->ui = gtk_ui_manager_new(); + gtk_ui_manager_insert_action_group(window->priv->ui, action_group, 0); + + accel_group = gtk_ui_manager_get_accel_group(window->priv->ui); + gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); + + error = NULL; + if (!gtk_ui_manager_add_ui_from_string(window->priv->ui, media_menu, -1, &error)) + { + g_message("building menus failed: %s", error->message); + g_error_free(error); + exit(EXIT_FAILURE); + } + + menu = gtk_ui_manager_get_widget(window->priv->ui, "/Media"); +#else accel_group = gtk_accel_group_new (); gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); g_object_unref(accel_group); @@ -304,6 +360,7 @@ setup_menubar(PidginMedia *window) menu = gtk_item_factory_get_widget( window->priv->item_factory, "
"); +#endif gtk_widget_show(menu); return menu; @@ -384,10 +441,17 @@ pidgin_media_dispose(GObject *media) gtkmedia->priv->media = NULL; } +#if GTK_CHECK_VERSION(2,4,0) + if (gtkmedia->priv->ui) { + g_object_unref(gtkmedia->priv->ui); + gtkmedia->priv->ui = NULL; + } +#else if (gtkmedia->priv->item_factory) { g_object_unref(gtkmedia->priv->item_factory); gtkmedia->priv->item_factory = NULL; } +#endif G_OBJECT_CLASS(parent_class)->dispose(media); } -- cgit v1.2.1 From 08b827ec2fb12aed25b947bec77bc0d5ce3c5b34 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 16 Feb 2010 08:29:28 +0000 Subject: Remove some deprecated functions. --- pidgin/gtkutils.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 4491117eb0..99debee34b 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -406,13 +406,13 @@ pidgin_pixbuf_button_from_stock(const char *text, const char *icon, gtk_container_add(GTK_CONTAINER(button), bbox); if (icon) { - gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox); + gtk_box_pack_start(GTK_BOX(bbox), ibox, TRUE, TRUE, 0); image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON); gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, TRUE, 0); } if (text) { - gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox); + gtk_box_pack_start(GTK_BOX(bbox), lbox, TRUE, TRUE, 0); label = gtk_label_new(NULL); gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); @@ -892,7 +892,11 @@ pidgin_account_option_menu_new(PurpleAccount *default_account, } gboolean +#if GTK_CHECK_VERSION(2,4,0) +pidgin_check_if_dir(const char *path, gpointer filesel) +#else pidgin_check_if_dir(const char *path, GtkFileSelection *filesel) +#endif { char *dirname = NULL; @@ -901,7 +905,9 @@ pidgin_check_if_dir(const char *path, GtkFileSelection *filesel) if (path[strlen(path) - 1] != G_DIR_SEPARATOR) { dirname = g_strconcat(path, G_DIR_SEPARATOR_S, NULL); } +#if !GTK_CHECK_VERSION(2,4,0) gtk_file_selection_set_filename(filesel, (dirname != NULL) ? dirname : path); +#endif g_free(dirname); return TRUE; } -- cgit v1.2.1 From 6ac77ef48341bc07105a786c2ca96d64b87776b5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 19 Feb 2010 07:21:14 +0000 Subject: disapproval of revision '1762d0df9a12b1d11b971176664e1d69634f08e5' --- pidgin/gtkutils.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 99debee34b..4491117eb0 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -406,13 +406,13 @@ pidgin_pixbuf_button_from_stock(const char *text, const char *icon, gtk_container_add(GTK_CONTAINER(button), bbox); if (icon) { - gtk_box_pack_start(GTK_BOX(bbox), ibox, TRUE, TRUE, 0); + gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox); image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON); gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, TRUE, 0); } if (text) { - gtk_box_pack_start(GTK_BOX(bbox), lbox, TRUE, TRUE, 0); + gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox); label = gtk_label_new(NULL); gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); @@ -892,11 +892,7 @@ pidgin_account_option_menu_new(PurpleAccount *default_account, } gboolean -#if GTK_CHECK_VERSION(2,4,0) -pidgin_check_if_dir(const char *path, gpointer filesel) -#else pidgin_check_if_dir(const char *path, GtkFileSelection *filesel) -#endif { char *dirname = NULL; @@ -905,9 +901,7 @@ pidgin_check_if_dir(const char *path, GtkFileSelection *filesel) if (path[strlen(path) - 1] != G_DIR_SEPARATOR) { dirname = g_strconcat(path, G_DIR_SEPARATOR_S, NULL); } -#if !GTK_CHECK_VERSION(2,4,0) gtk_file_selection_set_filename(filesel, (dirname != NULL) ? dirname : path); -#endif g_free(dirname); return TRUE; } -- cgit v1.2.1 From 990b11a636fd63e951c18ec20e94eda679736dc4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 19 Feb 2010 07:23:38 +0000 Subject: Remove some deprecated functions, without extra changes this time. --- pidgin/gtkutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 4491117eb0..df9b2f62de 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -406,13 +406,13 @@ pidgin_pixbuf_button_from_stock(const char *text, const char *icon, gtk_container_add(GTK_CONTAINER(button), bbox); if (icon) { - gtk_box_pack_start_defaults(GTK_BOX(bbox), ibox); + gtk_box_pack_start(GTK_BOX(bbox), ibox, TRUE, TRUE, 0); image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON); gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, TRUE, 0); } if (text) { - gtk_box_pack_start_defaults(GTK_BOX(bbox), lbox); + gtk_box_pack_start(GTK_BOX(bbox), lbox, TRUE, TRUE, 0); label = gtk_label_new(NULL); gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); -- cgit v1.2.1 From ef370aeea4bd29016a334ff00529c224a295f501 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 5 Jun 2010 22:30:51 +0000 Subject: With 2.7.0, we don't need these GTK_CHECK_VERSION's any more. --- pidgin/gtkprefs.c | 80 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 78 deletions(-) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 0bb8b54839..91fece25a1 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -196,13 +196,12 @@ dropdown_set(GObject *w, const char *key) int int_value; gboolean bool_value; PurplePrefType type; - -#if GTK_CHECK_VERSION(2,4,0) GtkTreeIter iter; GtkTreeModel *tree_model; tree_model = gtk_combo_box_get_model(GTK_COMBO_BOX(w)); - gtk_combo_box_get_active_iter(GTK_COMBO_BOX(w), &iter); + if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(w), &iter)) + return; type = GPOINTER_TO_INT(g_object_get_data(w, "type")); @@ -227,24 +226,6 @@ dropdown_set(GObject *w, const char *key) purple_prefs_set_bool(key, bool_value); } -#else - type = GPOINTER_TO_INT(g_object_get_data(w, "type")); - - if (type == PURPLE_PREF_INT) { - int_value = GPOINTER_TO_INT(g_object_get_data(w, "value")); - - purple_prefs_set_int(key, int_value); - } - else if (type == PURPLE_PREF_STRING) { - str_value = (const char *)g_object_get_data(w, "value"); - - purple_prefs_set_string(key, str_value); - } - else if (type == PURPLE_PREF_BOOLEAN) { - bool_value = (gboolean)GPOINTER_TO_INT(g_object_get_data(w, "value")); - purple_prefs_set_bool(key, bool_value); - } -#endif } GtkWidget * @@ -260,7 +241,6 @@ pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, int int_value = 0; const char *str_value = NULL; gboolean bool_value = FALSE; -#if GTK_CHECK_VERSION(2,4,0) GtkListStore *store; GtkTreeIter iter; GtkTreeIter active; @@ -333,62 +313,6 @@ pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, g_signal_connect(G_OBJECT(dropdown), "changed", G_CALLBACK(dropdown_set), (char *)key); -#else - GtkWidget *opt, *menu; - int o = 0; - - g_return_val_if_fail(menuitems != NULL, NULL); - - dropdown = gtk_option_menu_new(); - menu = gtk_menu_new(); - - if (type == PURPLE_PREF_INT) - stored_int = purple_prefs_get_int(key); - else if (type == PURPLE_PREF_STRING) - stored_str = purple_prefs_get_string(key); - else if (type == PURPLE_PREF_BOOLEAN) - stored_bool = purple_prefs_get_bool(key); - - while (menuitems != NULL && (text = (char *)menuitems->data) != NULL) { - menuitems = g_list_next(menuitems); - g_return_val_if_fail(menuitems != NULL, NULL); - - opt = gtk_menu_item_new_with_label(text); - - g_object_set_data(G_OBJECT(opt), "type", GINT_TO_POINTER(type)); - g_object_set_data(G_OBJECT(opt), "value", menuitems->data); - - if (type == PURPLE_PREF_INT) - int_value = GPOINTER_TO_INT(menuitems->data); - else if (type == PURPLE_PREF_STRING) - str_value = (const char *)menuitems->data; - else if (type == PURPLE_PREF_BOOLEAN) - bool_value = (gboolean)GPOINTER_TO_INT(menuitems->data); - - g_signal_connect(G_OBJECT(opt), "activate", - G_CALLBACK(dropdown_set), (char *)key); - - gtk_widget_show(opt); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); - - if ((type == PURPLE_PREF_INT && stored_int == int_value) || - (type == PURPLE_PREF_STRING && stored_str != NULL && - !strcmp(stored_str, str_value)) || - (type == PURPLE_PREF_BOOLEAN && - (stored_bool == bool_value))) { - - gtk_menu_set_active(GTK_MENU(menu), o); - } - - menuitems = g_list_next(menuitems); - - o++; - } - - gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); - -#endif - pidgin_add_widget_to_vbox(GTK_BOX(box), title, NULL, dropdown, FALSE, &label); return label; -- cgit v1.2.1 From 055fe069a7cedcbd7e2394c51f5b165865729ce0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 25 Jul 2010 22:37:17 +0000 Subject: gtk_widget_[gs]et_{mapped,realized} were added in GTK+ 2.20. --- pidgin/plugins/ticker/gtkticker.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/pidgin/plugins/ticker/gtkticker.c b/pidgin/plugins/ticker/gtkticker.c index 38ce49ed6e..d4c11a8105 100644 --- a/pidgin/plugins/ticker/gtkticker.c +++ b/pidgin/plugins/ticker/gtkticker.c @@ -21,28 +21,24 @@ * GtkTicker Copyright 2000 Syd Logan */ -/* FIXME: GTK+ deprecated GTK_WIDGET_MAPPED/REALIZED, but don't provide - accessor functions yet. */ -#undef GSEAL_ENABLE - #include "gtkticker.h" #include -/* These don't seem to be in a release yet. See BZ #69872 */ -#define gtk_widget_is_mapped(x) GTK_WIDGET_MAPPED(x) -#define gtk_widget_is_realized(x) GTK_WIDGET_REALIZED(x) -#define gtk_widget_set_realized(x,y) do {\ - if (y) \ - GTK_WIDGET_SET_FLAGS(x, GTK_REALIZED); \ - else \ - GTK_WIDGET_UNSET_FLAGS(x, GTK_REALIZED); \ -} while(0) +#if !GTK_CHECK_VERSION(2,20,0) +#define gtk_widget_get_mapped(x) GTK_WIDGET_MAPPED(x) #define gtk_widget_set_mapped(x,y) do {\ if (y) \ GTK_WIDGET_SET_FLAGS(x, GTK_MAPPED); \ else \ GTK_WIDGET_UNSET_FLAGS(x, GTK_MAPPED); \ } while(0) +#define gtk_widget_get_realized(x) GTK_WIDGET_REALIZED(x) +#define gtk_widget_set_realized(x,y) do {\ + if (y) \ + GTK_WIDGET_SET_FLAGS(x, GTK_REALIZED); \ + else \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_REALIZED); \ +} while(0) #if !GTK_CHECK_VERSION(2,18,0) #define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) @@ -51,6 +47,7 @@ #define gtk_widget_get_window(x) x->window #endif #endif +#endif static void gtk_ticker_compute_offsets (GtkTicker *ticker); static void gtk_ticker_class_init (GtkTickerClass *klass); @@ -181,13 +178,13 @@ static void gtk_ticker_put (GtkTicker *ticker, GtkWidget *widget) ticker->children = g_list_append (ticker->children, child_info); - if (gtk_widget_is_realized (ticker)) + if (gtk_widget_get_realized (ticker)) gtk_widget_realize (widget); if (gtk_widget_get_visible (GTK_WIDGET (ticker)) && gtk_widget_get_visible (widget)) { - if (gtk_widget_is_mapped (GTK_WIDGET (ticker))) + if (gtk_widget_get_mapped (GTK_WIDGET (ticker))) gtk_widget_map (widget); gtk_widget_queue_resize (GTK_WIDGET (ticker)); @@ -298,7 +295,7 @@ static void gtk_ticker_map (GtkWidget *widget) children = children->next; if (gtk_widget_get_visible (child->widget) && - !gtk_widget_is_mapped (child->widget)) + !gtk_widget_get_mapped (child->widget)) gtk_widget_map (child->widget); } @@ -474,7 +471,7 @@ static void gtk_ticker_size_allocate (GtkWidget *widget, #else widget->allocation = *allocation; #endif - if (gtk_widget_is_realized (widget)) + if (gtk_widget_get_realized (widget)) gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y, -- cgit v1.2.1 From 564d4a1ba6bb3b6ab09710f9c0cf19605aa6b0dd Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 25 Jul 2010 23:38:18 +0000 Subject: Fix some additional tooltip calls. --- pidgin/gtkconv.c | 4 ++++ pidgin/gtkimhtmltoolbar.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 80ecfaff14..44edcb85b0 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5287,8 +5287,12 @@ pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) close = pidgin_create_small_button(gtk_label_new("×")); gtk_box_pack_start(GTK_BOX(widget), close, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(close, _("Close Find bar")); +#else gtk_tooltips_set_tip(gtkconv->tooltips, close, _("Close Find bar"), NULL); +#endif label = gtk_label_new(_("Find:")); gtk_box_pack_start(GTK_BOX(widget), label, FALSE, FALSE, 10); diff --git a/pidgin/gtkimhtmltoolbar.c b/pidgin/gtkimhtmltoolbar.c index 87f3b461bd..4e22d45b23 100644 --- a/pidgin/gtkimhtmltoolbar.c +++ b/pidgin/gtkimhtmltoolbar.c @@ -1282,7 +1282,11 @@ static void gtk_imhtmltoolbar_create_old_buttons(GtkIMHtmlToolbar *toolbar) g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(send_attention_cb), toolbar); g_object_set_data(G_OBJECT(toolbar), "attention", button); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(button, _("Send Attention")); +#else gtk_tooltips_set_tip(toolbar->tooltips, button, _("Send Attention"), NULL); +#endif gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); -- cgit v1.2.1 From 4f7401ca30a93c42f4a68a20bff3a0bd7bd5f925 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 25 Jul 2010 23:39:10 +0000 Subject: Fix blist menu and small compile error. --- pidgin/gtkblist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index bbf7d462e3..bf10f3d417 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3766,6 +3766,7 @@ static const GtkActionEntry blist_menu_entries[] = { { "Plugins", PIDGIN_STOCK_TOOLBAR_PLUGINS, N_("Plu_gins"), "U", NULL, pidgin_plugin_dialog_show }, { "Preferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), "P", NULL, pidgin_prefs_show }, { "Privacy", NULL, N_("Pr_ivacy"), NULL, NULL, pidgin_privacy_dialog_show }, + { "SetMood", NULL, N_("Set _Mood"), "O", NULL, set_mood_show }, { "FileTransfers", PIDGIN_STOCK_TOOLBAR_TRANSFER, N_("_File Transfers"), "T", NULL, G_CALLBACK(gtk_blist_show_xfer_dialog_cb) }, { "RoomList", NULL, N_("R_oom List"), NULL, NULL, pidgin_roomlist_dialog_show }, { "SystemLog", NULL, N_("System _Log"), NULL, NULL, gtk_blist_show_systemlog_cb }, @@ -3826,10 +3827,11 @@ static const char *blist_menu = "" "" "" + "" "" "" "" - "" + "" "" "" "" @@ -7261,7 +7263,7 @@ static void pidgin_blist_destroy(PurpleBuddyList *list) purple_signals_disconnect_by_handle(gtkblist); if (gtkblist->headline_close) - gdk_pixbuf_unref(gtkblist->headline_close); + g_object_unref(G_OBJECT(gtkblist->headline_close)); gtk_widget_destroy(gtkblist->window); -- cgit v1.2.1 From 10d6ed80e2b32d34f934f4ea538d46c927b8bcdc Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 25 Jul 2010 23:40:05 +0000 Subject: Let GtkFileSelection stuff compile for now. --- pidgin/gtkutils.c | 7 +++++++ pidgin/gtkutils.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 5a5e689946..6ea81f183d 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -913,6 +913,12 @@ pidgin_account_option_menu_new(PurpleAccount *default_account, } gboolean +#if GTK_CHECK_VERSION(2,4,0) +pidgin_check_if_dir(const char *path, gpointer filesel) +{ + return FALSE; +} +#else pidgin_check_if_dir(const char *path, GtkFileSelection *filesel) { char *dirname = NULL; @@ -929,6 +935,7 @@ pidgin_check_if_dir(const char *path, GtkFileSelection *filesel) return FALSE; } +#endif void pidgin_setup_gtkspell(GtkTextView *textview) diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h index 53b05a9c1a..3783d9714e 100644 --- a/pidgin/gtkutils.h +++ b/pidgin/gtkutils.h @@ -411,7 +411,11 @@ void pidgin_setup_screenname_autocomplete(GtkWidget *entry, GtkWidget *optmenu, * * @return TRUE if given path is a directory, FALSE otherwise. */ +#if GTK_CHECK_VERSION(2,4,0) +gboolean pidgin_check_if_dir(const char *path, gpointer filesel); +#else gboolean pidgin_check_if_dir(const char *path, GtkFileSelection *filesel); +#endif /** * Sets up GtkSpell for the given GtkTextView, reporting errors -- cgit v1.2.1 From aa501096a308e2b1915dd04b8f56d2a669cf049e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 26 Jul 2010 04:14:44 +0000 Subject: Remove all the old GTK_CHECK_VERSION stuff. Of course, this makes this branch strictly 3.0.0 only. --- pidgin/gtkblist.c | 457 +------------------------------------------------ pidgin/gtkblist.h | 4 - pidgin/gtkconv.c | 481 +++++++--------------------------------------------- pidgin/gtkconvwin.h | 35 +--- pidgin/gtkdocklet.c | 2 +- pidgin/gtkmedia.c | 54 ------ pidgin/gtkutils.c | 25 --- pidgin/gtkutils.h | 16 -- 8 files changed, 66 insertions(+), 1008 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index bf10f3d417..967c10bd56 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -123,12 +123,8 @@ typedef struct #define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \ ((PidginBuddyListPrivate *)((list)->priv)) -#if GTK_CHECK_VERSION(2,4,0) static guint accounts_merge_id; static GtkActionGroup *accounts_action_group = NULL; -#else -static GtkWidget *accountmenu = NULL; -#endif static guint visibility_manager_count = 0; static GdkVisibilityState gtk_blist_visibility = GDK_VISIBILITY_UNOBSCURED; @@ -142,10 +138,8 @@ static void sort_method_none(PurpleBlistNode *node, PurpleBuddyList *blist, GtkT static void sort_method_alphabetical(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter); static void sort_method_status(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter); static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter); -#if GTK_CHECK_VERSION(2,4,0) static guint sort_merge_id; static GtkActionGroup *sort_action_group = NULL; -#endif static PidginBuddyList *gtkblist = NULL; @@ -157,9 +151,6 @@ static void pidgin_blist_update(PurpleBuddyList *list, PurpleBlistNode *node); static void pidgin_blist_update_group(PurpleBuddyList *list, PurpleBlistNode *node); static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode *node); static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full); -#if !GTK_CHECK_VERSION(2,4,0) -static const char *item_factory_translate_func (const char *path, gpointer func_data); -#endif static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter); static gboolean buddy_is_displayable(PurpleBuddy *buddy); static void redo_buddy_list(PurpleBuddyList *list, gboolean remove, gboolean rerender); @@ -2053,8 +2044,6 @@ pidgin_blist_popup_menu_cb(GtkWidget *tv, void *user_data) return handled; } -#if GTK_CHECK_VERSION(2,4,0) - static void gtk_blist_show_xfer_dialog_cb(GtkAction *item, gpointer data) { pidgin_xfer_dialog_show(NULL); @@ -2112,74 +2101,13 @@ static void pidgin_blist_mute_sounds_cb(GtkToggleAction *item, gpointer data) gtk_toggle_action_get_active(item)); } -#else /* GTK_CHECK_VERSION(2,4,0) */ - -static void pidgin_blist_buddy_details_cb(gpointer data, guint action, GtkWidget *item) -{ - pidgin_set_cursor(gtkblist->window, GDK_WATCH); - - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); - - pidgin_clear_cursor(gtkblist->window); -} - -static void pidgin_blist_show_idle_time_cb(gpointer data, guint action, GtkWidget *item) -{ - pidgin_set_cursor(gtkblist->window, GDK_WATCH); - - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); - - pidgin_clear_cursor(gtkblist->window); -} - -static void pidgin_blist_show_protocol_icons_cb(gpointer data, guint action, GtkWidget *item) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); -} - -static void pidgin_blist_show_empty_groups_cb(gpointer data, guint action, GtkWidget *item) -{ - pidgin_set_cursor(gtkblist->window, GDK_WATCH); - - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); - - pidgin_clear_cursor(gtkblist->window); -} - -static void pidgin_blist_edit_mode_cb(gpointer callback_data, guint callback_action, - GtkWidget *checkitem) -{ - pidgin_set_cursor(gtkblist->window, GDK_WATCH); - - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem))); - - pidgin_clear_cursor(gtkblist->window); -} - -static void pidgin_blist_mute_sounds_cb(gpointer data, guint action, GtkWidget *item) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); -} - -#endif /* GTK_CHECK_VERSION(2,4,0) */ static void pidgin_blist_mute_pref_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data) { -#if GTK_CHECK_VERSION(2,4,0) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds")), (gboolean)GPOINTER_TO_INT(value)); -#else - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(gtkblist->ift, - N_("/Tools/Mute Sounds"))), (gboolean)GPOINTER_TO_INT(value)); -#endif } static void @@ -2191,11 +2119,7 @@ pidgin_blist_sound_method_pref_cb(const char *name, PurplePrefType type, if(!strcmp(value, "none")) sensitive = FALSE; -#if GTK_CHECK_VERSION(2,4,0) gtk_action_set_sensitive(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds"), sensitive); -#else - gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), sensitive); -#endif } static void @@ -3737,7 +3661,7 @@ set_mood_show(void) /*************************************************** * Crap * ***************************************************/ -#if GTK_CHECK_VERSION(2,4,0) +#if 1 /* TODO: fill out tooltips... */ static const GtkActionEntry blist_menu_entries[] = { /* Buddies menu */ @@ -4738,7 +4662,7 @@ static void pidgin_blist_hide_node(PurpleBuddyList *list, PurpleBlistNode *node, static const char *require_connection[] = { -#if GTK_CHECK_VERSION(2,4,0) +#if 1 "/BList/BuddiesMenu/NewInstantMessage", "/BList/BuddiesMenu/JoinAChat", "/BList/BuddiesMenu/GetUserInfo", @@ -4765,11 +4689,7 @@ static const int require_connection_size = sizeof(require_connection) static void update_menu_bar(PidginBuddyList *gtkblist) { -#if GTK_CHECK_VERSION(2,4,0) GtkAction *action; -#else - GtkWidget *widget; -#endif gboolean sensitive; int i; @@ -4779,7 +4699,6 @@ update_menu_bar(PidginBuddyList *gtkblist) sensitive = (purple_connections_get_all() != NULL); -#if GTK_CHECK_VERSION(2,4,0) for (i = 0; i < require_connection_size; i++) { action = gtk_ui_manager_get_action(gtkblist->ui, require_connection[i]); @@ -4797,25 +4716,6 @@ update_menu_bar(PidginBuddyList *gtkblist) action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/RoomList"); gtk_action_set_sensitive(action, pidgin_roomlist_is_showable()); -#else - for (i = 0; i < require_connection_size; i++) - { - widget = gtk_item_factory_get_widget(gtkblist->ift, require_connection[i]); - gtk_widget_set_sensitive(widget, sensitive); - } - - widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Join a Chat...")); - gtk_widget_set_sensitive(widget, pidgin_blist_joinchat_is_showable()); - - widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Add Chat...")); - gtk_widget_set_sensitive(widget, pidgin_blist_joinchat_is_showable()); - - widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy")); - gtk_widget_set_sensitive(widget, sensitive); - - widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List")); - gtk_widget_set_sensitive(widget, pidgin_roomlist_is_showable()); -#endif } static void @@ -5106,14 +5006,6 @@ enum { NUM_TARGETS }; -#if !GTK_CHECK_VERSION(2,4,0) -static const char * -item_factory_translate_func (const char *path, gpointer func_data) -{ - return _((char *)path); -} -#endif - void pidgin_blist_setup_sort_methods() { const char *id; @@ -6061,10 +5953,8 @@ static void pidgin_blist_show(PurpleBuddyList *list) GtkWidget *close; char *pretty, *tmp; const char *theme_name; -#if GTK_CHECK_VERSION(2,4,0) GtkActionGroup *action_group; GError *error; -#endif GtkAccelGroup *accel_group; GtkTreeSelection *selection; GtkTargetEntry dte[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW}, @@ -6114,7 +6004,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK); /******************************* Menu bar *************************************/ -#if GTK_CHECK_VERSION(2,4,0) action_group = gtk_action_group_new("BListActions"); gtk_action_group_add_actions(action_group, blist_menu_entries, @@ -6149,28 +6038,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtk_widget_show(gtkblist->menutray); gtk_widget_show(menu); gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), menu, FALSE, FALSE, 0); -#else - accel_group = gtk_accel_group_new(); - gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group); - g_object_unref(accel_group); - gtkblist->ift = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "", accel_group); - gtk_item_factory_set_translate_func(gtkblist->ift, - (GtkTranslateFunc)item_factory_translate_func, - NULL, NULL); - gtk_item_factory_create_items(gtkblist->ift, G_N_ENTRIES(blist_menu), - blist_menu, NULL); - pidgin_load_accels(); - g_signal_connect(G_OBJECT(accel_group), "accel-changed", G_CALLBACK(pidgin_save_accels_cb), NULL); - - menu = gtk_item_factory_get_widget(gtkblist->ift, ""); - gtkblist->menutray = pidgin_menu_tray_new(); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtkblist->menutray); - gtk_widget_show(gtkblist->menutray); - gtk_widget_show(menu); - gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), menu, FALSE, FALSE, 0); - - accountmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Accounts")); -#endif /****************************** Notebook *************************************/ gtkblist->notebook = gtk_notebook_new(); @@ -6362,7 +6229,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) /* set the Show Offline Buddies option. must be done * after the treeview or faceprint gets mad. -Robot101 */ -#if GTK_CHECK_VERSION(2,4,0) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowOffline")), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies")); @@ -6384,30 +6250,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) if(!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none")) gtk_action_set_sensitive(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds"), FALSE); -#else - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Offline Buddies"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Empty Groups"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Tools/Mute Sounds"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Buddy Details"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Idle Times"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Protocol Icons"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")); - - if(!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none")) - gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), FALSE); -#endif - /* Update some dynamic things */ update_menu_bar(gtkblist); pidgin_blist_update_plugin_actions(); @@ -7283,11 +7125,7 @@ static void pidgin_blist_destroy(PurpleBuddyList *list) gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL; g_object_unref(G_OBJECT(gtkblist->treemodel)); gtkblist->treemodel = NULL; -#if GTK_CHECK_VERSION(2,4,0) g_object_unref(G_OBJECT(gtkblist->ui)); -#else - g_object_unref(G_OBJECT(gtkblist->ift)); -#endif g_object_unref(G_OBJECT(gtkblist->empty_avatar)); gdk_cursor_unref(gtkblist->hand_cursor); @@ -7301,9 +7139,6 @@ static void pidgin_blist_destroy(PurpleBuddyList *list) g_free(priv); g_free(gtkblist); -#if !GTK_CHECK_VERSION(2,4,0) - accountmenu = NULL; -#endif gtkblist = NULL; purple_prefs_disconnect_by_handle(pidgin_blist_get_handle()); } @@ -8313,7 +8148,6 @@ plugin_act(GtkObject *obj, PurplePluginAction *pam) pam->callback(pam); } -#if GTK_CHECK_VERSION(2,4,0) static void build_plugin_actions(GtkActionGroup *action_group, GString *ui, char *parent, PurplePlugin *plugin, gpointer context) @@ -8351,42 +8185,6 @@ build_plugin_actions(GtkActionGroup *action_group, GString *ui, char *parent, g_list_free(actions); } -#else -static void -build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin, - gpointer context) -{ - GtkWidget *menuitem; - PurplePluginAction *action = NULL; - GList *actions, *l; - - actions = PURPLE_PLUGIN_ACTIONS(plugin, context); - - for (l = actions; l != NULL; l = l->next) - { - if (l->data) - { - action = (PurplePluginAction *) l->data; - action->plugin = plugin; - action->context = context; - - menuitem = gtk_menu_item_new_with_label(action->label); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(plugin_act), action); - g_object_set_data_full(G_OBJECT(menuitem), "plugin_action", - action, - (GDestroyNotify)purple_plugin_action_free); - gtk_widget_show(menuitem); - } - else - pidgin_separator(menu); - } - - g_list_free(actions); -} -#endif static void modify_account_cb(GtkWidget *widget, gpointer data) @@ -8421,7 +8219,6 @@ pidgin_blist_update_accounts_menu(void) { GList *accounts = NULL; -#if GTK_CHECK_VERSION(2,4,0) GtkAction *action; GString *accounts_ui; GString *enable_ui; @@ -8523,164 +8320,10 @@ purple_debug_info("blist", "The account menu is {%s}\n", ui_string); g_string_free(enable_ui, TRUE); g_string_free(accounts_ui, TRUE); g_free(ui_string); -#else - GtkWidget *menuitem = NULL, *submenu = NULL; - GList *l = NULL; - GtkAccelGroup *accel_group = NULL; - gboolean disabled_accounts = FALSE; - gboolean enabled_accounts = FALSE; - - if (accountmenu == NULL) - return; - - /* Clear the old Accounts menu */ - for (l = gtk_container_get_children(GTK_CONTAINER(accountmenu)); l; l = g_list_delete_link(l, l)) { - menuitem = l->data; - - if (menuitem != gtk_item_factory_get_widget(gtkblist->ift, N_("/Accounts/Manage Accounts"))) - gtk_widget_destroy(menuitem); - } - - for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) { - char *buf = NULL; - GtkWidget *image = NULL; - PurpleAccount *account = NULL; - GdkPixbuf *pixbuf = NULL; - - account = accounts->data; - - if(!purple_account_get_enabled(account, PIDGIN_UI)) { - if (!disabled_accounts) { - menuitem = gtk_menu_item_new_with_label(_("Enable Account")); - gtk_menu_shell_append(GTK_MENU_SHELL(accountmenu), menuitem); - - submenu = gtk_menu_new(); - gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); - gtk_menu_set_accel_path(GTK_MENU(submenu), N_("/Accounts/Enable Account")); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); - - disabled_accounts = TRUE; - } - - buf = g_strconcat(purple_account_get_username(account), " (", - purple_account_get_protocol_name(account), ")", NULL); - menuitem = gtk_image_menu_item_new_with_label(buf); - g_free(buf); - pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); - if (pixbuf != NULL) - { - if (!purple_account_is_connected(account)) - gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); - image = gtk_image_new_from_pixbuf(pixbuf); - g_object_unref(G_OBJECT(pixbuf)); - gtk_widget_show(image); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); - } - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(enable_account_cb), account); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - } else { - enabled_accounts = TRUE; - } - } - - if (!enabled_accounts) { - gtk_widget_show_all(accountmenu); - return; - } - - pidgin_separator(accountmenu); - accel_group = gtk_menu_get_accel_group(GTK_MENU(accountmenu)); - - for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) { - char *buf = NULL; - char *accel_path_buf = NULL; - GtkWidget *image = NULL; - PurpleConnection *gc = NULL; - PurpleAccount *account = NULL; - GdkPixbuf *pixbuf = NULL; - PurplePlugin *plugin = NULL; - PurplePluginProtocolInfo *prpl_info; - - account = accounts->data; - - if (!purple_account_get_enabled(account, PIDGIN_UI)) - continue; - - buf = g_strconcat(purple_account_get_username(account), " (", - purple_account_get_protocol_name(account), ")", NULL); - menuitem = gtk_image_menu_item_new_with_label(buf); - accel_path_buf = g_strconcat(N_("/Accounts/"), buf, NULL); - g_free(buf); - pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); - if (pixbuf != NULL) { - if (!purple_account_is_connected(account)) - gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, - 0.0, FALSE); - image = gtk_image_new_from_pixbuf(pixbuf); - g_object_unref(G_OBJECT(pixbuf)); - gtk_widget_show(image); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); - } - gtk_menu_shell_append(GTK_MENU_SHELL(accountmenu), menuitem); - - submenu = gtk_menu_new(); - gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); - gtk_menu_set_accel_path(GTK_MENU(submenu), accel_path_buf); - g_free(accel_path_buf); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); - - - menuitem = gtk_menu_item_new_with_mnemonic(_("_Edit Account")); - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(modify_account_cb), account); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - - pidgin_separator(submenu); - - gc = purple_account_get_connection(account); - plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; - prpl_info = plugin ? PURPLE_PLUGIN_PROTOCOL_INFO(plugin) : NULL; - - if (prpl_info && - (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) || - PURPLE_PLUGIN_HAS_ACTIONS(plugin))) { - if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) && - gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) { - - if (purple_account_get_status(account, "mood")) { - menuitem = gtk_menu_item_new_with_mnemonic(_("Set _Mood...")); - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(set_mood_cb), account); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - } - } - if (PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { - build_plugin_actions(submenu, plugin, gc); - } - } else { - menuitem = gtk_menu_item_new_with_label(_("No actions available")); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - gtk_widget_set_sensitive(menuitem, FALSE); - } - - pidgin_separator(submenu); - - menuitem = gtk_menu_item_new_with_mnemonic(_("_Disable")); - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(disable_account_cb), account); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - } - gtk_widget_show_all(accountmenu); -#endif } -#if GTK_CHECK_VERSION(2,4,0) static guint plugins_merge_id; static GtkActionGroup *plugins_action_group = NULL; -#else -static GList *plugin_submenus = NULL; -#endif void pidgin_blist_update_plugin_actions(void) @@ -8688,7 +8331,6 @@ pidgin_blist_update_plugin_actions(void) PurplePlugin *plugin = NULL; GList *l; -#if GTK_CHECK_VERSION(2,4,0) GtkAction *action; GString *plugins_ui; gchar *ui_string; @@ -8745,53 +8387,8 @@ purple_debug_info("blist", "The plugins menu is {%s}\n", ui_string); g_string_free(plugins_ui, TRUE); g_free(ui_string); -#else - GtkWidget *menuitem, *submenu; - GtkAccelGroup *accel_group; - GtkWidget *pluginmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools")); - - g_return_if_fail(pluginmenu != NULL); - - /* Remove old plugin action submenus from the Tools menu */ - for (l = plugin_submenus; l; l = l->next) - gtk_widget_destroy(GTK_WIDGET(l->data)); - g_list_free(plugin_submenus); - plugin_submenus = NULL; - - accel_group = gtk_menu_get_accel_group(GTK_MENU(pluginmenu)); - - /* Add a submenu for each plugin with custom actions */ - for (l = purple_plugins_get_loaded(); l; l = l->next) { - char *path; - - plugin = (PurplePlugin *) l->data; - - if (PURPLE_IS_PROTOCOL_PLUGIN(plugin)) - continue; - - if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin)) - continue; - - menuitem = gtk_image_menu_item_new_with_label(_(plugin->info->name)); - gtk_menu_shell_append(GTK_MENU_SHELL(pluginmenu), menuitem); - - plugin_submenus = g_list_append(plugin_submenus, menuitem); - - submenu = gtk_menu_new(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); - - gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); - path = g_strdup_printf("%s/Tools/%s", gtkblist->ift->path, plugin->info->name); - gtk_menu_set_accel_path(GTK_MENU(submenu), path); - g_free(path); - - build_plugin_actions(submenu, plugin, NULL); - } - gtk_widget_show_all(pluginmenu); -#endif } -#if GTK_CHECK_VERSION(2,4,0) static void sortmethod_act(GtkRadioAction *action, GtkRadioAction *current, char *id) { @@ -8805,21 +8402,6 @@ sortmethod_act(GtkRadioAction *action, GtkRadioAction *current, char *id) pidgin_clear_cursor(gtkblist->window); } } -#else -static void -sortmethod_act(GtkCheckMenuItem *checkmenuitem, char *id) -{ - if (gtk_check_menu_item_get_active(checkmenuitem)) - { - pidgin_set_cursor(gtkblist->window, GDK_WATCH); - /* This is redundant. I think. */ - /* pidgin_blist_sort_method_set(id); */ - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/sort_type", id); - - pidgin_clear_cursor(gtkblist->window); - } -} -#endif void pidgin_blist_update_sort_methods(void) @@ -8829,7 +8411,6 @@ pidgin_blist_update_sort_methods(void) GSList *sl = NULL; const char *m = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/sort_type"); -#if GTK_CHECK_VERSION(2,4,0) GtkRadioAction *action; GString *ui_string; @@ -8878,38 +8459,4 @@ pidgin_blist_update_sort_methods(void) sort_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string->str, -1, NULL); g_string_free(ui_string, TRUE); -#else - GtkWidget *menuitem = NULL, *activeitem = NULL; - GtkWidget *sortmenu; - - if ((gtkblist == NULL) || (gtkblist->ift == NULL)) - return; - - g_return_if_fail(m != NULL); - - sortmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Sort Buddies")); - - if (sortmenu == NULL) - return; - - /* Clear the old menu */ - for (l = gtk_container_get_children(GTK_CONTAINER(sortmenu)); l; l = g_list_delete_link(l, l)) { - menuitem = l->data; - gtk_widget_destroy(GTK_WIDGET(menuitem)); - } - - for (l = pidgin_blist_sort_methods; l; l = l->next) { - method = (PidginBlistSortMethod *) l->data; - menuitem = gtk_radio_menu_item_new_with_label(sl, _(method->name)); - if (g_str_equal(m, method->id)) - activeitem = menuitem; - sl = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); - gtk_menu_shell_append(GTK_MENU_SHELL(sortmenu), menuitem); - g_signal_connect(G_OBJECT(menuitem), "toggled", - G_CALLBACK(sortmethod_act), method->id); - gtk_widget_show(menuitem); - } - if (activeitem) - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(activeitem), TRUE); -#endif } diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index 6858ff0757..2bfbd135ed 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -82,11 +82,7 @@ struct _PidginBuddyList { GtkCellRenderer *text_rend; -#if GTK_CHECK_VERSION(2,4,0) GtkUIManager *ui; -#else - GtkItemFactory *ift; -#endif GtkWidget *menutray; /**< The menu tray widget. */ GtkWidget *menutrayicon; /**< The menu tray icon. */ diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 44edcb85b0..8f4cbd304c 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -160,9 +160,6 @@ static void conv_set_unseen(PurpleConversation *gtkconv, PidginUnseenState state static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state); static void update_typing_icon(PidginConversation *gtkconv); static void update_typing_message(PidginConversation *gtkconv, const char *message); -#if !GTK_CHECK_VERSION(2,6,0) -static const char *item_factory_translate_func (const char *path, gpointer func_data); -#endif gboolean pidgin_conv_has_focus(PurpleConversation *conv); static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background); static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast); @@ -982,11 +979,7 @@ invite_cb(GtkWidget *widget, PidginConversation *gtkconv) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_new_conv_cb(GtkAction *action, gpointer data) -#else -menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) -#endif { pidgin_dialogs_im(); } @@ -1033,11 +1026,7 @@ savelog_writefile_cb(void *user_data, const char *filename) * plaintext v. HTML file. */ static void -#if GTK_CHECK_VERSION(2,6,0) menu_save_as_cb(GtkAction *action, gpointer data) -#else -menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); @@ -1067,11 +1056,7 @@ menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_view_log_cb(GtkAction *action, gpointer data) -#else -menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1127,11 +1112,7 @@ menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_clear_cb(GtkAction *action, gpointer data) -#else -menu_clear_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1141,11 +1122,7 @@ menu_clear_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_find_cb(GtkAction *action, gpointer data) -#else -menu_find_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *gtkwin = data; PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(gtkwin); @@ -1155,7 +1132,6 @@ menu_find_cb(gpointer data, guint action, GtkWidget *widget) #ifdef USE_VV static void -#if GTK_CHECK_VERSION(2,6,0) menu_initiate_media_call_cb(GtkAction *action, gpointer data) { PidginWindow *win = (PidginWindow *)data; @@ -1169,29 +1145,10 @@ menu_initiate_media_call_cb(GtkAction *action, gpointer data) action == win->audio_video_call ? PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE); } -#else -menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget) -{ - PidginWindow *win = (PidginWindow *)data; - PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); - PurpleAccount *account = purple_conversation_get_account(conv); - - purple_prpl_initiate_media(account, - purple_conversation_get_name(conv), - action == 0 ? PURPLE_MEDIA_AUDIO : - action == 1 ? PURPLE_MEDIA_VIDEO : - action == 2 ? PURPLE_MEDIA_AUDIO | - PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE); -} -#endif #endif static void -#if GTK_CHECK_VERSION(2,6,0) menu_send_file_cb(GtkAction *action, gpointer data) -#else -menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); @@ -1203,11 +1160,7 @@ menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_get_attention_cb(GtkAction *ation, gpointer data) -#else -menu_get_attention_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); @@ -1219,11 +1172,7 @@ menu_get_attention_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_add_pounce_cb(GtkAction *action, gpointer data) -#else -menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1235,11 +1184,7 @@ menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_insert_link_cb(GtkAction *action, gpointer data) -#else -menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PidginConversation *gtkconv; @@ -1253,11 +1198,7 @@ menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_insert_image_cb(GtkAction *action, gpointer data) -#else -menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1274,11 +1215,7 @@ menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) static void -#if GTK_CHECK_VERSION(2,6,0) menu_alias_cb(GtkAction *action, gpointer data) -#else -menu_alias_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1305,11 +1242,7 @@ menu_alias_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_get_info_cb(GtkAction *action, gpointer data) -#else -menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1320,11 +1253,7 @@ menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_invite_cb(GtkAction *action, gpointer data) -#else -menu_invite_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1335,11 +1264,7 @@ menu_invite_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_block_cb(GtkAction *action, gpointer data) -#else -menu_block_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1350,11 +1275,7 @@ menu_block_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_unblock_cb(GtkAction *action, gpointer data) -#else -menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1365,11 +1286,7 @@ menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_add_remove_cb(GtkAction *action, gpointer data) -#else -menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1414,11 +1331,7 @@ hide_conv(PidginConversation *gtkconv, gboolean closetimer) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_close_conv_cb(GtkAction *action, gpointer data) -#else -menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; @@ -1426,11 +1339,7 @@ menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_logging_cb(GtkAction *action, gpointer data) -#else -menu_logging_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1442,11 +1351,7 @@ menu_logging_cb(gpointer data, guint action, GtkWidget *widget) if (conv == NULL) return; -#if GTK_CHECK_VERSION(2,6,0) logging = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); -#else - logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); -#endif if (logging == purple_conversation_is_logging(conv)) return; @@ -1499,26 +1404,14 @@ menu_logging_cb(gpointer data, guint action, GtkWidget *widget) } static void -#if GTK_CHECK_VERSION(2,6,0) menu_toolbar_cb(GtkAction *action, gpointer data) { purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); } -#else -menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); -} -#endif static void -#if GTK_CHECK_VERSION(2,6,0) menu_sounds_cb(GtkAction *action, gpointer data) -#else -menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1533,30 +1426,18 @@ menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) gtkconv = PIDGIN_CONVERSATION(conv); gtkconv->make_sound = -#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); -#else - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); -#endif node = get_conversation_blist_node(conv); if (node) purple_blist_node_set_bool(node, "gtk-mute-sound", !gtkconv->make_sound); } static void -#if GTK_CHECK_VERSION(2,6,0) menu_timestamps_cb(GtkAction *action, gpointer data) { purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); } -#else -menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); -} -#endif static void chat_do_im(PidginConversation *gtkconv, const char *who) @@ -2363,13 +2244,8 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) purple_conversation_close_logs(old_conv); gtkconv->active_conv = conv; -#if GTK_CHECK_VERSION(2,6,0) purple_conversation_set_logging(conv, gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(gtkconv->win->menu.logging))); -#else - purple_conversation_set_logging(conv, - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging))); -#endif entry = GTK_IMHTML(gtkconv->entry); protocol_name = purple_account_get_protocol_name(conv->account); @@ -3192,7 +3068,7 @@ pidgin_conv_get_window(PidginConversation *gtkconv) return gtkconv->win; } -#if GTK_CHECK_VERSION(2,6,0) +#if 1 static GtkActionEntry menu_entries[] = /* TODO: fill out tooltips... */ @@ -3363,16 +3239,6 @@ static GtkItemFactoryEntry menu_items[] = { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "", NULL }, { N_("/Options/Show Ti_mestamps"), NULL, menu_timestamps_cb, 0, "", NULL }, }; - -static const int menu_item_count = -sizeof(menu_items) / sizeof(*menu_items); - -static const char * -item_factory_translate_func (const char *path, gpointer func_data) -{ - return _(path); -} - #endif static void @@ -3384,31 +3250,18 @@ sound_method_pref_changed_cb(const char *name, PurplePrefType type, if (!strcmp(method, "none")) { -#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), FALSE); gtk_action_set_sensitive(win->menu.sounds, FALSE); -#else - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), - FALSE); - gtk_widget_set_sensitive(win->menu.sounds, FALSE); -#endif } else { PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win); -#if GTK_CHECK_VERSION(2,6,0) if (gtkconv != NULL) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), gtkconv->make_sound); gtk_action_set_sensitive(win->menu.sounds, TRUE); -#else - if (gtkconv != NULL) - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), - gtkconv->make_sound); - gtk_widget_set_sensitive(win->menu.sounds, TRUE); -#endif } } @@ -3536,7 +3389,6 @@ regenerate_media_items(PidginWindow *win) purple_prpl_get_media_caps(account, purple_conversation_get_name(conv)); -#if GTK_CHECK_VERSION(2,6,0) gtk_action_set_sensitive(win->audio_call, caps & PURPLE_MEDIA_CAPS_AUDIO ? TRUE : FALSE); @@ -3546,39 +3398,16 @@ regenerate_media_items(PidginWindow *win) gtk_action_set_sensitive(win->audio_video_call, caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO ? TRUE : FALSE); -#else - gtk_widget_set_sensitive(win->audio_call, - caps & PURPLE_MEDIA_CAPS_AUDIO - ? TRUE : FALSE); - gtk_widget_set_sensitive(win->video_call, - caps & PURPLE_MEDIA_CAPS_VIDEO - ? TRUE : FALSE); - gtk_widget_set_sensitive(win->audio_video_call, - caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO - ? TRUE : FALSE); -#endif } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { /* for now, don't care about chats... */ -#if GTK_CHECK_VERSION(2,6,0) gtk_action_set_sensitive(win->audio_call, FALSE); gtk_action_set_sensitive(win->video_call, FALSE); gtk_action_set_sensitive(win->audio_video_call, FALSE); -#else - gtk_widget_set_sensitive(win->audio_call, FALSE); - gtk_widget_set_sensitive(win->video_call, FALSE); - gtk_widget_set_sensitive(win->audio_video_call, FALSE); -#endif } else { -#if GTK_CHECK_VERSION(2,6,0) gtk_action_set_sensitive(win->audio_call, FALSE); gtk_action_set_sensitive(win->video_call, FALSE); gtk_action_set_sensitive(win->audio_video_call, FALSE); -#else - gtk_widget_set_sensitive(win->audio_call, FALSE); - gtk_widget_set_sensitive(win->video_call, FALSE); - gtk_widget_set_sensitive(win->audio_video_call, FALSE); -#endif } #endif } @@ -3671,7 +3500,7 @@ regenerate_plugins_items(PidginWindow *win) #endif } -#if !GTK_CHECK_VERSION(2,6,0) +#if 0 static void menubar_activated(GtkWidget *item, gpointer data) { PidginWindow *win = data; @@ -3702,8 +3531,6 @@ setup_menubar(PidginWindow *win) { GtkAccelGroup *accel_group; const char *method; - -#if GTK_CHECK_VERSION(2,6,0) GtkActionGroup *action_group; GError *error; @@ -3834,133 +3661,6 @@ setup_menubar(PidginWindow *win) "/Conversation/OptionsMenu/ShowTimestamps"); win->menu.show_icon = NULL; -#else - GtkWidget *menuitem; - - accel_group = gtk_accel_group_new (); - gtk_window_add_accel_group(GTK_WINDOW(win->window), accel_group); - g_object_unref(accel_group); - - win->menu.item_factory = - gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", accel_group); - - gtk_item_factory_set_translate_func(win->menu.item_factory, - (GtkTranslateFunc)item_factory_translate_func, - NULL, NULL); - - gtk_item_factory_create_items(win->menu.item_factory, menu_item_count, - menu_items, win); - g_signal_connect(G_OBJECT(accel_group), "accel-changed", - G_CALLBACK(pidgin_save_accels_cb), NULL); - - /* Make sure the 'Conversation -> More' menuitems are regenerated whenever - * the 'Conversation' menu pops up because the entries can change after the - * conversation is created. */ - menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation")); - g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menubar_activated), win); - - win->menu.menubar = - gtk_item_factory_get_widget(win->menu.item_factory, "
"); - - win->menu.view_log = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/View Log")); - -#ifdef USE_VV - win->audio_call = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Media/Audio Call")); - win->video_call = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Media/Video Call")); - win->audio_video_call = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Media/Audio\\/Video Call")); -#endif - - /* --- */ - - win->menu.send_file = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Send File...")); - - g_object_set_data(G_OBJECT(win->window), "get_attention", - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Get Attention"))); - win->menu.add_pounce = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Add Buddy Pounce...")); - - /* --- */ - - win->menu.get_info = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Get Info")); - - win->menu.invite = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Invite...")); - - /* --- */ - - win->menu.alias = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Alias...")); - - win->menu.block = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Block...")); - - win->menu.unblock = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Unblock...")); - - win->menu.add = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Add...")); - - win->menu.remove = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Remove...")); - - /* --- */ - - win->menu.insert_link = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Insert Link...")); - - win->menu.insert_image = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Insert Image...")); - - /* --- */ - - win->menu.logging = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Options/Enable Logging")); - win->menu.sounds = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Options/Enable Sounds")); - method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); - if (method != NULL && !strcmp(method, "none")) - { - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), - FALSE); - gtk_widget_set_sensitive(win->menu.sounds, FALSE); - } - purple_prefs_connect_callback(win, PIDGIN_PREFS_ROOT "/sound/method", - sound_method_pref_changed_cb, win); - - win->menu.show_formatting_toolbar = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Options/Show Formatting Toolbars")); - win->menu.show_timestamps = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Options/Show Timestamps")); - win->menu.show_icon = NULL; - -#endif - win->menu.tray = pidgin_menu_tray_new(); gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), win->menu.tray); @@ -4142,8 +3842,7 @@ update_send_to_selection(PidginWindow *win) if (!(b = purple_find_buddy(account, conv->name))) return FALSE; -#if GTK_CHECK_VERSION(2,6,0) -#else +#if 0 /* TODO */ gtk_widget_show(win->menu.send_to); menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(win->menu.send_to)); @@ -4275,8 +3974,7 @@ compare_buddy_presence(PurplePresence *p1, PurplePresence *p2) static void generate_send_to_items(PidginWindow *win) { -#if GTK_CHECK_VERSION(2,6,0) -#else +#if 0 /* TODO */ GtkWidget *menu; GSList *group = NULL; GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -6870,16 +6568,6 @@ pidgin_conv_send_confirm(PurpleConversation *conv, const char *message) gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), message, 0); } -/* Mask functions with ones from newer GTK+ */ -#if GTK_CHECK_VERSION(2,6,0) -#define gtk_widget_set_sensitive_ gtk_widget_set_sensitive -#define gtk_widget_show_ gtk_widget_show -#define gtk_widget_hide_ gtk_widget_hide -#define gtk_widget_set_sensitive gtk_action_set_sensitive -#define gtk_widget_show(x) gtk_action_set_visible((x), TRUE) -#define gtk_widget_hide(x) gtk_action_set_visible((x), FALSE) -#endif - /* * Makes sure all the menu items and all the buttons are hidden/shown and * sensitive/insensitive. This is called after changing tabs and when an @@ -6918,57 +6606,57 @@ gray_stuff_out(PidginConversation *gtkconv) /* Show stuff that applies to IMs, hide stuff that applies to chats */ /* Deal with menu items */ - gtk_widget_show(win->menu.view_log); - gtk_widget_show(win->menu.send_file); - gtk_widget_show(g_object_get_data(G_OBJECT(win->window), "get_attention")); - gtk_widget_show(win->menu.add_pounce); - gtk_widget_show(win->menu.get_info); - gtk_widget_hide(win->menu.invite); - gtk_widget_show(win->menu.alias); + gtk_action_set_visible(win->menu.view_log, TRUE); + gtk_action_set_visible(win->menu.send_file, TRUE); + gtk_action_set_visible(g_object_get_data(G_OBJECT(win->window), "get_attention"), TRUE); + gtk_action_set_visible(win->menu.add_pounce, TRUE); + gtk_action_set_visible(win->menu.get_info, TRUE); + gtk_action_set_visible(win->menu.invite, FALSE); + gtk_action_set_visible(win->menu.alias, TRUE); if (purple_privacy_check(account, purple_conversation_get_name(conv))) { - gtk_widget_hide(win->menu.unblock); - gtk_widget_show(win->menu.block); + gtk_action_set_visible(win->menu.unblock, FALSE); + gtk_action_set_visible(win->menu.block, TRUE); } else { - gtk_widget_hide(win->menu.block); - gtk_widget_show(win->menu.unblock); + gtk_action_set_visible(win->menu.block, FALSE); + gtk_action_set_visible(win->menu.unblock, TRUE); } if ((account == NULL) || purple_find_buddy(account, purple_conversation_get_name(conv)) == NULL) { - gtk_widget_show(win->menu.add); - gtk_widget_hide(win->menu.remove); + gtk_action_set_visible(win->menu.add, TRUE); + gtk_action_set_visible(win->menu.remove, FALSE); } else { - gtk_widget_show(win->menu.remove); - gtk_widget_hide(win->menu.add); + gtk_action_set_visible(win->menu.remove, TRUE); + gtk_action_set_visible(win->menu.add, FALSE); } - gtk_widget_show(win->menu.insert_link); - gtk_widget_show(win->menu.insert_image); + gtk_action_set_visible(win->menu.insert_link, TRUE); + gtk_action_set_visible(win->menu.insert_image, TRUE); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { /* Show stuff that applies to Chats, hide stuff that applies to IMs */ /* Deal with menu items */ - gtk_widget_show(win->menu.view_log); - gtk_widget_hide(win->menu.send_file); - gtk_widget_hide(g_object_get_data(G_OBJECT(win->window), "get_attention")); - gtk_widget_hide(win->menu.add_pounce); - gtk_widget_hide(win->menu.get_info); - gtk_widget_show(win->menu.invite); - gtk_widget_show(win->menu.alias); - gtk_widget_hide(win->menu.block); - gtk_widget_hide(win->menu.unblock); + gtk_action_set_visible(win->menu.view_log, TRUE); + gtk_action_set_visible(win->menu.send_file, FALSE); + gtk_action_set_visible(g_object_get_data(G_OBJECT(win->window), "get_attention"), FALSE); + gtk_action_set_visible(win->menu.add_pounce, FALSE); + gtk_action_set_visible(win->menu.get_info, FALSE); + gtk_action_set_visible(win->menu.invite, TRUE); + gtk_action_set_visible(win->menu.alias, TRUE); + gtk_action_set_visible(win->menu.block, FALSE); + gtk_action_set_visible(win->menu.unblock, FALSE); if ((account == NULL) || purple_blist_find_chat(account, purple_conversation_get_name(conv)) == NULL) { /* If the chat is NOT in the buddy list */ - gtk_widget_show(win->menu.add); - gtk_widget_hide(win->menu.remove); + gtk_action_set_visible(win->menu.add, TRUE); + gtk_action_set_visible(win->menu.remove, FALSE); } else { /* If the chat IS in the buddy list */ - gtk_widget_hide(win->menu.add); - gtk_widget_show(win->menu.remove); + gtk_action_set_visible(win->menu.add, FALSE); + gtk_action_set_visible(win->menu.remove, TRUE); } - gtk_widget_show(win->menu.insert_link); - gtk_widget_show(win->menu.insert_image); + gtk_action_set_visible(win->menu.insert_link, TRUE); + gtk_action_set_visible(win->menu.insert_image, TRUE); } /* @@ -7013,30 +6701,30 @@ gray_stuff_out(PidginConversation *gtkconv) gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); /* Deal with menu items */ - gtk_widget_set_sensitive(win->menu.view_log, TRUE); - gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); - gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); - gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); - gtk_widget_set_sensitive(win->menu.insert_link, (conv->features & PURPLE_CONNECTION_HTML)); - gtk_widget_set_sensitive(win->menu.insert_image, !(conv->features & PURPLE_CONNECTION_NO_IMAGES)); + gtk_action_set_sensitive(win->menu.view_log, TRUE); + gtk_action_set_sensitive(win->menu.add_pounce, TRUE); + gtk_action_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); + gtk_action_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); + gtk_action_set_sensitive(win->menu.insert_link, (conv->features & PURPLE_CONNECTION_HTML)); + gtk_action_set_sensitive(win->menu.insert_image, !(conv->features & PURPLE_CONNECTION_NO_IMAGES)); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - gtk_widget_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); - gtk_widget_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); - gtk_widget_set_sensitive(win->menu.send_file, + gtk_action_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); + gtk_action_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); + gtk_action_set_sensitive(win->menu.send_file, (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, purple_conversation_get_name(conv))))); - gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL)); - gtk_widget_set_sensitive(win->menu.alias, + gtk_action_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL)); + gtk_action_set_sensitive(win->menu.alias, (account != NULL) && (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - gtk_widget_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL)); - gtk_widget_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL)); - gtk_widget_set_sensitive(win->menu.alias, + gtk_action_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL)); + gtk_action_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL)); + gtk_action_set_sensitive(win->menu.alias, (account != NULL) && (purple_blist_find_chat(account, purple_conversation_get_name(conv)) != NULL)); } @@ -7046,18 +6734,18 @@ gray_stuff_out(PidginConversation *gtkconv) /* Or it's a chat that we've left. */ /* Then deal with menu items */ - gtk_widget_set_sensitive(win->menu.view_log, TRUE); - gtk_widget_set_sensitive(win->menu.send_file, FALSE); - gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window), + gtk_action_set_sensitive(win->menu.view_log, TRUE); + gtk_action_set_sensitive(win->menu.send_file, FALSE); + gtk_action_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), FALSE); - gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); - gtk_widget_set_sensitive(win->menu.get_info, FALSE); - gtk_widget_set_sensitive(win->menu.invite, FALSE); - gtk_widget_set_sensitive(win->menu.alias, FALSE); - gtk_widget_set_sensitive(win->menu.add, FALSE); - gtk_widget_set_sensitive(win->menu.remove, FALSE); - gtk_widget_set_sensitive(win->menu.insert_link, TRUE); - gtk_widget_set_sensitive(win->menu.insert_image, FALSE); + gtk_action_set_sensitive(win->menu.add_pounce, TRUE); + gtk_action_set_sensitive(win->menu.get_info, FALSE); + gtk_action_set_sensitive(win->menu.invite, FALSE); + gtk_action_set_sensitive(win->menu.alias, FALSE); + gtk_action_set_sensitive(win->menu.add, FALSE); + gtk_action_set_sensitive(win->menu.remove, FALSE); + gtk_action_set_sensitive(win->menu.insert_link, TRUE); + gtk_action_set_sensitive(win->menu.insert_image, FALSE); } /* @@ -7089,17 +6777,6 @@ gray_stuff_out(PidginConversation *gtkconv) } } -/* Restore the functions */ -#if GTK_CHECK_VERSION(2,6,0) -#undef gtk_widget_set_sensitive -#undef gtk_widget_show -#undef gtk_widget_hide - -#define gtk_widget_set_sensitive gtk_widget_set_sensitive_ -#define gtk_widget_show gtk_widget_show_ -#define gtk_widget_hide gtk_widget_hide_ -#endif - static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) { @@ -7756,15 +7433,9 @@ show_timestamps_pref_cb(const char *name, PurplePrefType type, gtkconv = PIDGIN_CONVERSATION(conv); win = gtkconv->win; -#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(win->menu.show_timestamps), (gboolean)GPOINTER_TO_INT(value)); -#else - gtk_check_menu_item_set_active( - GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), - (gboolean)GPOINTER_TO_INT(value)); -#endif gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); @@ -7790,15 +7461,9 @@ show_formatting_toolbar_pref_cb(const char *name, PurplePrefType type, gtkconv = PIDGIN_CONVERSATION(conv); win = gtkconv->win; -#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(win->menu.show_formatting_toolbar), (gboolean)GPOINTER_TO_INT(value)); -#else - gtk_check_menu_item_set_active( - GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), - (gboolean)GPOINTER_TO_INT(value)); -#endif if ((gboolean)GPOINTER_TO_INT(value)) gtk_widget_show(gtkconv->toolbar); @@ -9054,8 +8719,7 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc /* Right click was pressed. Popup the context menu. */ GtkWidget *menu = gtk_menu_new(), *sub; gboolean populated = populate_menu_with_options(menu, gtkconv, TRUE); -#if GTK_CHECK_VERSION(2,6,0) -#else +#if 0 /* TODO */ sub = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to)); if (sub && GTK_WIDGET_IS_SENSITIVE(gtkconv->win->menu.send_to)) { @@ -9578,13 +9242,8 @@ switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, /* Update the menubar */ -#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtkconv->win->menu.logging), purple_conversation_is_logging(conv)); -#else - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging), - purple_conversation_is_logging(conv)); -#endif generate_send_to_items(win); regenerate_options_items(win); @@ -9593,7 +9252,6 @@ switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, pidgin_conv_switch_active_conversation(conv); sound_method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); -#if GTK_CHECK_VERSION(2,6,0) if (strcmp(sound_method, "none") != 0) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), gtkconv->make_sound); @@ -9603,17 +9261,6 @@ switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.show_timestamps), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); -#else - if (strcmp(sound_method, "none") != 0) - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), - gtkconv->make_sound); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); -#endif /* * We pause icons when they are not visible. If this icon should @@ -9863,11 +9510,7 @@ pidgin_conv_window_destroy(PidginWindow *win) } gtk_widget_destroy(win->window); -#if GTK_CHECK_VERSION(2,6,0) g_object_unref(G_OBJECT(win->menu.ui)); -#else - g_object_unref(G_OBJECT(win->menu.item_factory)); -#endif purple_notify_close_with_handle(win); purple_signals_disconnect_by_handle(win); diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index 5dc0718949..ee42f17e61 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -46,10 +46,8 @@ struct _PidginWindow struct { -/* Some necessary functions were only added in 2.6.0 */ GtkWidget *menubar; -#if GTK_CHECK_VERSION(2,6,0) GtkAction *view_log; GtkAction *send_file; @@ -70,28 +68,7 @@ struct _PidginWindow GtkAction *sounds; GtkAction *show_formatting_toolbar; GtkAction *show_timestamps; -#else - GtkWidget *view_log; - - GtkWidget *send_file; - GtkWidget *add_pounce; - GtkWidget *get_info; - GtkWidget *invite; - - GtkWidget *alias; - GtkWidget *block; - GtkWidget *unblock; - GtkWidget *add; - GtkWidget *remove; - - GtkWidget *insert_link; - GtkWidget *insert_image; - - GtkWidget *logging; - GtkWidget *sounds; - GtkWidget *show_formatting_toolbar; - GtkWidget *show_timestamps; -#endif + GtkWidget *show_icon; GtkWidget *send_to; @@ -100,11 +77,7 @@ struct _PidginWindow GtkWidget *typing_icon; -#if GTK_CHECK_VERSION(2,6,0) GtkUIManager *ui; -#else - GtkItemFactory *item_factory; -#endif } menu; @@ -126,15 +99,9 @@ struct _PidginWindow gint drag_leave_signal; /* Media menu options. */ -#if GTK_CHECK_VERSION(2,6,0) GtkAction *audio_call; GtkAction *video_call; GtkAction *audio_video_call; -#else - GtkWidget *audio_call; - GtkWidget *video_call; - GtkWidget *audio_video_call; -#endif }; /*@}*/ diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index 571222e017..3ab5801a75 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -523,7 +523,7 @@ add_account_statuses(GtkWidget *menu, PurpleAccount *account) new_menu_item_with_status_icon(menu, purple_status_type_get_name(status_type), prim, G_CALLBACK(activate_status_account_cb), - status_type, 0, 0, NULL); + GINT_TO_POINTER(status_type), 0, 0, NULL); } } diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c index 982fcb2d6a..23287a0cec 100644 --- a/pidgin/gtkmedia.c +++ b/pidgin/gtkmedia.c @@ -84,11 +84,7 @@ struct _PidginMediaPrivate gchar *screenname; gulong level_handler_id; -#if GTK_CHECK_VERSION(2,4,0) GtkUIManager *ui; -#else - GtkItemFactory *item_factory; -#endif GtkWidget *menubar; GtkWidget *statusbar; @@ -264,18 +260,13 @@ pidgin_x_error_handler(Display *display, XErrorEvent *event) #endif static void -#if GTK_CHECK_VERSION(2,4,0) menu_hangup(GtkAction *action, gpointer data) -#else -menu_hangup(gpointer data, guint action, GtkWidget *item) -#endif { PidginMedia *gtkmedia = PIDGIN_MEDIA(data); purple_media_stream_info(gtkmedia->priv->media, PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); } -#if GTK_CHECK_VERSION(2,4,0) static const GtkActionEntry menu_entries[] = { { "MediaMenu", NULL, N_("_Media"), NULL, NULL, NULL }, { "Hangup", NULL, N_("_Hangup"), NULL, NULL, G_CALLBACK(menu_hangup) }, @@ -290,32 +281,14 @@ static const char *media_menu = "" ""; -#else -static GtkItemFactoryEntry menu_items[] = { - { N_("/_Media"), NULL, NULL, 0, "", NULL }, - { N_("/Media/_Hangup"), NULL, menu_hangup, 0, "", NULL }, -}; - -static gint menu_item_count = sizeof(menu_items) / sizeof(menu_items[0]); - -static const char * -item_factory_translate_func (const char *path, gpointer func_data) -{ - return _(path); -} -#endif - static GtkWidget * setup_menubar(PidginMedia *window) { -#if GTK_CHECK_VERSION(2,4,0) GtkActionGroup *action_group; GError *error; -#endif GtkAccelGroup *accel_group; GtkWidget *menu; -#if GTK_CHECK_VERSION(2,4,0) action_group = gtk_action_group_new("MediaActions"); gtk_action_group_add_actions(action_group, menu_entries, @@ -341,26 +314,6 @@ setup_menubar(PidginMedia *window) } menu = gtk_ui_manager_get_widget(window->priv->ui, "/Media"); -#else - accel_group = gtk_accel_group_new (); - gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); - g_object_unref(accel_group); - - window->priv->item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, - "
", accel_group); - - gtk_item_factory_set_translate_func(window->priv->item_factory, - (GtkTranslateFunc)item_factory_translate_func, - NULL, NULL); - - gtk_item_factory_create_items(window->priv->item_factory, - menu_item_count, menu_items, window); - g_signal_connect(G_OBJECT(accel_group), "accel-changed", - G_CALLBACK(pidgin_save_accels_cb), NULL); - - menu = gtk_item_factory_get_widget( - window->priv->item_factory, "
"); -#endif gtk_widget_show(menu); return menu; @@ -441,17 +394,10 @@ pidgin_media_dispose(GObject *media) gtkmedia->priv->media = NULL; } -#if GTK_CHECK_VERSION(2,4,0) if (gtkmedia->priv->ui) { g_object_unref(gtkmedia->priv->ui); gtkmedia->priv->ui = NULL; } -#else - if (gtkmedia->priv->item_factory) { - g_object_unref(gtkmedia->priv->item_factory); - gtkmedia->priv->item_factory = NULL; - } -#endif G_OBJECT_CLASS(parent_class)->dispose(media); } diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 6ea81f183d..7ebfd05471 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -912,31 +912,6 @@ pidgin_account_option_menu_new(PurpleAccount *default_account, return optmenu; } -gboolean -#if GTK_CHECK_VERSION(2,4,0) -pidgin_check_if_dir(const char *path, gpointer filesel) -{ - return FALSE; -} -#else -pidgin_check_if_dir(const char *path, GtkFileSelection *filesel) -{ - char *dirname = NULL; - - if (g_file_test(path, G_FILE_TEST_IS_DIR)) { - /* append a / if needed */ - if (path[strlen(path) - 1] != G_DIR_SEPARATOR) { - dirname = g_strconcat(path, G_DIR_SEPARATOR_S, NULL); - } - gtk_file_selection_set_filename(filesel, (dirname != NULL) ? dirname : path); - g_free(dirname); - return TRUE; - } - - return FALSE; -} -#endif - void pidgin_setup_gtkspell(GtkTextView *textview) { diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h index 3783d9714e..750860841f 100644 --- a/pidgin/gtkutils.h +++ b/pidgin/gtkutils.h @@ -401,22 +401,6 @@ gboolean pidgin_screenname_autocomplete_default_filter(const PidginBuddyCompleti */ void pidgin_setup_screenname_autocomplete(GtkWidget *entry, GtkWidget *optmenu, gboolean all); -/** - * Check if the given path is a directory or not. If it is, then modify - * the given GtkFileSelection dialog so that it displays the given path. - * If the given path is not a directory, then do nothing. - * - * @param path The path entered in the file selection window by the user. - * @param filesel The file selection window. - * - * @return TRUE if given path is a directory, FALSE otherwise. - */ -#if GTK_CHECK_VERSION(2,4,0) -gboolean pidgin_check_if_dir(const char *path, gpointer filesel); -#else -gboolean pidgin_check_if_dir(const char *path, GtkFileSelection *filesel); -#endif - /** * Sets up GtkSpell for the given GtkTextView, reporting errors * if encountered. -- cgit v1.2.1 From 9dd114428f2d4a8548aa9670815a74d694e52197 Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Mon, 26 Jul 2010 05:35:10 +0000 Subject: Apply final changes from nix_nix's patch. Closes #1332. committer: Elliott Sales de Andrade --- pidgin/gtkaccount.c | 42 ++++++++-- pidgin/gtkutils.c | 171 ++++++++++++++------------------------ pidgin/plugins/contact_priority.c | 7 +- 3 files changed, 97 insertions(+), 123 deletions(-) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 03f05a49a8..c1a8fc5ab3 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -160,6 +160,37 @@ static void add_user_options(AccountPrefsDialog *dialog, GtkWidget *parent); static void add_protocol_options(AccountPrefsDialog *dialog); static void add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent); +static const char * +google_talk_default_domain_hackery(GtkWidget *protocol_combo, const char *value_if_gtalk) +{ + GtkTreeModel *model; + GtkTreeIter iter; + const char *value = NULL; + + model = gtk_combo_box_get_model(GTK_COMBO_BOX(protocol_combo)); + if (model != NULL && gtk_combo_box_get_active_iter(GTK_COMBO_BOX(protocol_combo), &iter)) { + char *protocol = NULL; + + /* protocol is not stored as G_TYPE_STRING in the model so no g_free necessary */ + gtk_tree_model_get(model, &iter, 2, &protocol, -1); + if (protocol && !strcmp("prpl-jabber", protocol)) { + char *item_name = NULL; + + gtk_tree_model_get(model, &iter, 1, &item_name, -1); + if (item_name) { + if (!strcmp(item_name, _("Google Talk"))) + value = value_if_gtalk; + g_free(item_name); + } + /* If it's not GTalk, but still Jabber then the value is not NULL, it's empty */ + if (NULL == value) + value = ""; + } + } + + return value; +} + static GtkWidget * add_pref_box(AccountPrefsDialog *dialog, GtkWidget *parent, const char *text, GtkWidget *widget) @@ -417,8 +448,6 @@ add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) GtkWidget *hbox; GtkWidget *vbox; GtkWidget *entry; - GtkWidget *menu; - GtkWidget *item; GList *user_splits; GList *l, *l2; char *username = NULL; @@ -557,11 +586,8 @@ add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) value = purple_account_user_split_get_default_value(split); /* Google Talk default domain hackery! */ - menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->protocol_menu)); - item = gtk_menu_get_active(GTK_MENU(menu)); - if (value == NULL && g_object_get_data(G_OBJECT(item), "fake") && - !strcmp(purple_account_user_split_get_text(split), _("Domain"))) - value = "gmail.com"; + if (!strcmp(_("Domain"), purple_account_user_split_get_text(split)) && !value) + value = google_talk_default_domain_hackery(dialog->protocol_menu, "gmail.com"); if (value != NULL) gtk_entry_set_text(GTK_ENTRY(entry), value); @@ -2607,5 +2633,3 @@ pidgin_account_uninit(void) purple_signals_disconnect_by_handle(pidgin_account_get_handle()); purple_signals_unregister_by_instance(pidgin_account_get_handle()); } - - diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 7ebfd05471..535bda7ff5 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -70,7 +70,7 @@ #include "pidgin/minidialog.h" typedef struct { - GtkWidget *menu; + GtkTreeModel *model; gint default_item; } AopMenu; @@ -527,68 +527,35 @@ pidgin_make_frame(GtkWidget *parent, const char *title) } static gpointer -aop_option_menu_get_selected(GtkWidget *optmenu, GtkWidget **p_item) +aop_option_menu_get_selected(GtkWidget *optmenu) { - GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu)); - GtkWidget *item = gtk_menu_get_active(GTK_MENU(menu)); - if (p_item) - (*p_item) = item; - return item ? g_object_get_data(G_OBJECT(item), "aop_per_item_data") : NULL; + gpointer data = NULL; + GtkTreeIter iter; + + g_return_val_if_fail(optmenu != NULL, NULL); + + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(optmenu), &iter)) + gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu)), &iter, 2, &data, -1); + + return data; } static void aop_menu_cb(GtkWidget *optmenu, GCallback cb) { - GtkWidget *item; - gpointer per_item_data; - - per_item_data = aop_option_menu_get_selected(optmenu, &item); - if (cb != NULL) { - ((void (*)(GtkWidget *, gpointer, gpointer))cb)(item, per_item_data, g_object_get_data(G_OBJECT(optmenu), "user_data")); + ((void (*)(GtkWidget *, gpointer, gpointer))cb)(NULL, + aop_option_menu_get_selected(optmenu), + g_object_get_data(G_OBJECT(optmenu), "user_data")); } } -static GtkWidget * -aop_menu_item_new(GtkSizeGroup *sg, GdkPixbuf *pixbuf, const char *lbl, gpointer per_item_data, const char *data) +static void +aop_option_menu_replace_menu(GtkWidget *optmenu, AopMenu *new_aop_menu) { - GtkWidget *item; - GtkWidget *hbox; - GtkWidget *image; - GtkWidget *label; - - item = gtk_menu_item_new(); - gtk_widget_show(item); - - hbox = gtk_hbox_new(FALSE, 4); - gtk_widget_show(hbox); - - /* Create the image */ - if (pixbuf == NULL) - image = gtk_image_new(); - else - image = gtk_image_new_from_pixbuf(pixbuf); - gtk_widget_show(image); - - if (sg) - gtk_size_group_add_widget(sg, image); - - /* Create the label */ - label = gtk_label_new (lbl); - gtk_widget_show (label); - gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - - gtk_container_add(GTK_CONTAINER(item), hbox); - gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); - - g_object_set_data(G_OBJECT (item), data, per_item_data); - g_object_set_data(G_OBJECT (item), "aop_per_item_data", per_item_data); - - pidgin_set_accessible_label(item, label); - - return item; + gtk_combo_box_set_model(GTK_COMBO_BOX(optmenu), new_aop_menu->model); + gtk_combo_box_set_active(GTK_COMBO_BOX(optmenu), new_aop_menu->default_item); + g_object_set_data_full(G_OBJECT(optmenu), "aop_menu", new_aop_menu, (GDestroyNotify)g_free); } static GdkPixbuf * @@ -629,16 +596,19 @@ pidgin_create_prpl_icon_from_prpl(PurplePlugin *prpl, PidginPrplIconSize size, P static GtkWidget * aop_option_menu_new(AopMenu *aop_menu, GCallback cb, gpointer user_data) { - GtkWidget *optmenu; + GtkWidget *optmenu = NULL; + GtkCellRenderer *cr = NULL; - optmenu = gtk_option_menu_new(); + optmenu = gtk_combo_box_new(); gtk_widget_show(optmenu); - gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), aop_menu->menu); - - if (aop_menu->default_item != -1) - gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), aop_menu->default_item); - - g_object_set_data_full(G_OBJECT(optmenu), "aop_menu", aop_menu, (GDestroyNotify)g_free); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(optmenu), cr = gtk_cell_renderer_pixbuf_new(), FALSE); + gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "pixbuf", 0); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(optmenu), cr = gtk_cell_renderer_text_new(), TRUE); + gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "text", 1); + + aop_option_menu_replace_menu(optmenu, aop_menu); + if (aop_menu->default_item == -1) + gtk_combo_box_set_active(GTK_COMBO_BOX(optmenu), 0); g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); g_signal_connect(G_OBJECT(optmenu), "changed", G_CALLBACK(aop_menu_cb), cb); @@ -646,33 +616,21 @@ aop_option_menu_new(AopMenu *aop_menu, GCallback cb, gpointer user_data) return optmenu; } -static void -aop_option_menu_replace_menu(GtkWidget *optmenu, AopMenu *new_aop_menu) -{ - if (gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu))) - gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu)); - - gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), new_aop_menu->menu); - - if (new_aop_menu->default_item != -1) - gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), new_aop_menu->default_item); - - g_object_set_data_full(G_OBJECT(optmenu), "aop_menu", new_aop_menu, (GDestroyNotify)g_free); -} - static void aop_option_menu_select_by_data(GtkWidget *optmenu, gpointer data) { - guint idx; - GList *llItr = NULL; - - for (idx = 0, llItr = GTK_MENU_SHELL(gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu)))->children; - llItr != NULL; - llItr = llItr->next, idx++) { - if (data == g_object_get_data(G_OBJECT(llItr->data), "aop_per_item_data")) { - gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), idx); - break; - } + GtkTreeModel *model; + GtkTreeIter iter; + gpointer iter_data; + model = gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu)); + if (gtk_tree_model_get_iter_first(model, &iter)) { + do { + gtk_tree_model_get(model, &iter, 2, &iter_data, -1); + if (iter_data == data) { + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(optmenu), &iter); + return; + } + } while (gtk_tree_model_iter_next(model, &iter)); } } @@ -683,16 +641,17 @@ create_protocols_menu(const char *default_proto_id) PurplePluginProtocolInfo *prpl_info; PurplePlugin *plugin; GdkPixbuf *pixbuf = NULL; - GtkSizeGroup *sg; + GtkTreeIter iter; + GtkListStore *ls; GList *p; const char *gtalk_name = NULL; int i; + ls = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); + aop_menu = g_malloc0(sizeof(AopMenu)); aop_menu->default_item = -1; - aop_menu->menu = gtk_menu_new(); - gtk_widget_show(aop_menu->menu); - sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); + aop_menu->model = GTK_TREE_MODEL(ls); if (purple_find_prpl("prpl-jabber")) gtalk_name = _("Google Talk"); @@ -707,14 +666,11 @@ create_protocols_menu(const char *default_proto_id) if (gtalk_name && strcmp(gtalk_name, plugin->info->name) < 0) { char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "16", "google-talk.png", NULL); - GtkWidget *item; - pixbuf = gdk_pixbuf_new_from_file(filename, NULL); g_free(filename); - gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu), - item = aop_menu_item_new(sg, pixbuf, gtalk_name, "prpl-jabber", "protocol")); - g_object_set_data(G_OBJECT(item), "fake", GINT_TO_POINTER(1)); + gtk_list_store_append(ls, &iter); + gtk_list_store_set(ls, &iter, 0, pixbuf, 1, gtalk_name, 2, "prpl-jabber", -1); if (pixbuf) g_object_unref(pixbuf); @@ -725,8 +681,8 @@ create_protocols_menu(const char *default_proto_id) pixbuf = pidgin_create_prpl_icon_from_prpl(plugin, PIDGIN_PRPL_ICON_SMALL, NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu), - aop_menu_item_new(sg, pixbuf, plugin->info->name, plugin->info->id, "protocol")); + gtk_list_store_append(ls, &iter); + gtk_list_store_set(ls, &iter, 0, pixbuf, 1, plugin->info->name, 2, plugin->info->id, -1); if (pixbuf) g_object_unref(pixbuf); @@ -734,9 +690,6 @@ create_protocols_menu(const char *default_proto_id) if (default_proto_id != NULL && !strcmp(plugin->info->id, default_proto_id)) aop_menu->default_item = i; } - - g_object_unref(sg); - return aop_menu; } @@ -750,13 +703,13 @@ pidgin_protocol_option_menu_new(const char *id, GCallback cb, const char * pidgin_protocol_option_menu_get_selected(GtkWidget *optmenu) { - return (const char *)aop_option_menu_get_selected(optmenu, NULL); + return (const char *)aop_option_menu_get_selected(optmenu); } PurpleAccount * pidgin_account_option_menu_get_selected(GtkWidget *optmenu) { - return (PurpleAccount *)aop_option_menu_get_selected(optmenu, NULL); + return (PurpleAccount *)aop_option_menu_get_selected(optmenu); } static AopMenu * @@ -768,7 +721,8 @@ create_account_menu(PurpleAccount *default_account, GdkPixbuf *pixbuf = NULL; GList *list; GList *p; - GtkSizeGroup *sg; + GtkListStore *ls; + GtkTreeIter iter; int i; char buf[256]; @@ -777,11 +731,11 @@ create_account_menu(PurpleAccount *default_account, else list = purple_connections_get_all(); + ls = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); + aop_menu = g_malloc0(sizeof(AopMenu)); aop_menu->default_item = -1; - aop_menu->menu = gtk_menu_new(); - gtk_widget_show(aop_menu->menu); - sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); + aop_menu->model = GTK_TREE_MODEL(ls); for (p = list, i = 0; p != NULL; p = p->next, i++) { PurplePlugin *plugin; @@ -820,8 +774,8 @@ create_account_menu(PurpleAccount *default_account, purple_account_get_protocol_name(account)); } - gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu), - aop_menu_item_new(sg, pixbuf, buf, account, "account")); + gtk_list_store_append(ls, &iter); + gtk_list_store_set(ls, &iter, 0, pixbuf, 1, buf, 2, account, -1); if (pixbuf) g_object_unref(pixbuf); @@ -829,9 +783,6 @@ create_account_menu(PurpleAccount *default_account, if (default_account && account == default_account) aop_menu->default_item = i; } - - g_object_unref(sg); - return aop_menu; } @@ -842,7 +793,7 @@ regenerate_account_menu(GtkWidget *optmenu) PurpleAccount *account; PurpleFilterAccountFunc filter_func; - account = (PurpleAccount *)aop_option_menu_get_selected(optmenu, NULL); + account = (PurpleAccount *)aop_option_menu_get_selected(optmenu); show_all = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(optmenu), "show_all")); filter_func = g_object_get_data(G_OBJECT(optmenu), "filter_func"); diff --git a/pidgin/plugins/contact_priority.c b/pidgin/plugins/contact_priority.c index e59566b481..5ec79d973d 100644 --- a/pidgin/plugins/contact_priority.c +++ b/pidgin/plugins/contact_priority.c @@ -35,11 +35,11 @@ select_account(GtkWidget *widget, PurpleAccount *account, gpointer data) } static void -account_update(GtkWidget *widget, GtkOptionMenu *optmenu) +account_update(GtkWidget *widget, GtkWidget *optmenu) { PurpleAccount *account = NULL; - account = g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(optmenu)))), "account"); + account = pidgin_account_option_menu_get_selected(optmenu); purple_account_set_int(account, "score", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget))); } @@ -147,8 +147,7 @@ get_config_frame(PurplePlugin *plugin) gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 0); /* this is where we set up the spin button we made above */ - account = g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu))))), - "account"); + account = pidgin_account_option_menu_get_selected(optmenu); gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), (gdouble)purple_account_get_int(account, "score", 0)); gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(spin), GTK_ADJUSTMENT(adj)); -- cgit v1.2.1 From f6c23f659469fd76f8fa6d7729bafdd71ae2f1b6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 26 Jul 2010 05:38:41 +0000 Subject: Supply something for the widget. --- pidgin/gtkutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 535bda7ff5..befe79571a 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -544,7 +544,7 @@ static void aop_menu_cb(GtkWidget *optmenu, GCallback cb) { if (cb != NULL) { - ((void (*)(GtkWidget *, gpointer, gpointer))cb)(NULL, + ((void (*)(GtkWidget *, gpointer, gpointer))cb)(optmenu, aop_option_menu_get_selected(optmenu), g_object_get_data(G_OBJECT(optmenu), "user_data")); } -- cgit v1.2.1 From 19b008e32b744d1b125ecbc8d2109bfc27da1da1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 26 Jul 2010 05:40:49 +0000 Subject: Remove an extra "fake" check. --- pidgin/gtkaccount.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index c1a8fc5ab3..697fad65be 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -245,7 +245,7 @@ set_dialog_icon(AccountPrefsDialog *dialog, gpointer data, size_t len, gchar *ne } static void -set_account_protocol_cb(GtkWidget *item, const char *id, +set_account_protocol_cb(GtkWidget *widget, const char *id, AccountPrefsDialog *dialog) { PurplePlugin *new_plugin; @@ -271,8 +271,7 @@ set_account_protocol_cb(GtkWidget *item, const char *id, gtk_widget_grab_focus(dialog->protocol_menu); - if (!dialog->prpl_info || !dialog->prpl_info->register_user || - g_object_get_data(G_OBJECT(item), "fake")) { + if (!dialog->prpl_info || !dialog->prpl_info->register_user) { gtk_widget_hide(dialog->register_button); } else { if (dialog->prpl_info != NULL && -- cgit v1.2.1 From 5fb41b5e0dce8cca1900b535f5310b72cd4cde19 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Sat, 20 Nov 2010 22:34:25 +0000 Subject: use the actual gtk+-3.0 package as the GTK+ dependency, for now require the current preview version (2.91.5). Warning, it not yet compile successfully --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6c52b2ab37..35a720dc4a 100644 --- a/configure.ac +++ b/configure.ac @@ -416,11 +416,11 @@ else fi if test "x$enable_gtkui" = "xyes" ; then - PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.10.0], , [ + PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 2.91.5], , [ AC_MSG_RESULT(no) AC_MSG_ERROR([ -You must have GTK+ 2.10.0 or newer development headers installed to compile +You must have GTK+ 2.91.5 or newer development headers installed to compile Pidgin. If you want to build only Finch then specify --disable-gtkui when running configure. ])]) -- cgit v1.2.1 From 2dabd7753e18b4e41d5da4f99e7a5c0f6dbf3290 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Thu, 25 Nov 2010 22:30:18 +0000 Subject: compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes... --- pidgin/gtkaccount.c | 26 ++-- pidgin/gtkblist-theme-loader.c | 3 +- pidgin/gtkblist.c | 185 ++++++++++++++---------- pidgin/gtkcellrendererexpander.c | 90 +++++++----- pidgin/gtkconv.c | 288 ++++++++++++++++++++++---------------- pidgin/gtkdebug.c | 20 +-- pidgin/gtkdialogs.c | 13 +- pidgin/gtkdialogs.h | 2 +- pidgin/gtkdnd-hints.c | 48 ++++--- pidgin/gtkdocklet-gtk.c | 13 +- pidgin/gtkdocklet.c | 10 +- pidgin/gtkidle.c | 6 +- pidgin/gtkimhtml.c | 253 +++++++++++++++++++++------------ pidgin/gtkimhtmltoolbar.c | 84 ++++++----- pidgin/gtklog.c | 17 ++- pidgin/gtkmain.c | 2 +- pidgin/gtkmedia.c | 4 +- pidgin/gtkmenutray.c | 16 +-- pidgin/gtknotify.c | 32 +++-- pidgin/gtkplugin.c | 23 +-- pidgin/gtkpounce.c | 20 +-- pidgin/gtkprefs.c | 25 ++-- pidgin/gtkprivacy.c | 8 +- pidgin/gtkrequest.c | 57 +++++--- pidgin/gtkroomlist.c | 24 ++-- pidgin/gtksavedstatuses.c | 2 +- pidgin/gtkscrollbook.c | 6 +- pidgin/gtksmiley.c | 15 +- pidgin/gtksourceundomanager.c | 3 +- pidgin/gtkstatusbox.c | 89 ++++++------ pidgin/gtkutils.c | 60 ++++---- pidgin/gtkwhiteboard.c | 106 ++++++++------ pidgin/gtkwhiteboard.h | 2 +- pidgin/minidialog.c | 2 +- pidgin/pidgintooltip.c | 7 +- pidgin/plugins/contact_priority.c | 2 +- pidgin/plugins/convcolors.c | 4 +- pidgin/plugins/disco/gtkdisco.c | 9 +- pidgin/plugins/markerline.c | 2 + pidgin/plugins/themeedit.c | 1 - pidgin/plugins/ticker/gtkticker.c | 8 +- pidgin/plugins/timestamp.c | 2 +- pidgin/plugins/timestamp_format.c | 3 +- pidgin/plugins/vvconfig.c | 4 +- pidgin/plugins/xmppconsole.c | 86 ++++++------ 45 files changed, 1005 insertions(+), 677 deletions(-) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 4954c56b93..9a57ba387f 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -378,9 +378,11 @@ static void account_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *sd, guint info, guint t, AccountPrefsDialog *dialog) { - gchar *name = (gchar *)sd->data; - - if ((sd->length >= 0) && (sd->format == 8)) { + const gchar *name = (gchar *) gtk_selection_data_get_data(sd); + gint length = gtk_selection_data_get_length(sd); + gint format = gtk_selection_data_get_format(sd); + + if (length >= 0 && format == 8) { /* Well, it looks like the drag event was cool. * Let's do something with it */ if (!g_ascii_strncasecmp(name, "file://", 7)) { @@ -1050,7 +1052,7 @@ proxy_type_changed_cb(GtkWidget *menu, AccountPrefsDialog *dialog) dialog->new_proxy_type == PURPLE_PROXY_NONE || dialog->new_proxy_type == PURPLE_PROXY_USE_ENVVAR) { - gtk_widget_hide_all(dialog->proxy_vbox); + gtk_widget_hide(dialog->proxy_vbox); } else gtk_widget_show_all(dialog->proxy_vbox); @@ -1145,7 +1147,7 @@ add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent) if (type == PURPLE_PROXY_USE_GLOBAL || type == PURPLE_PROXY_NONE || type == PURPLE_PROXY_USE_ENVVAR) - gtk_widget_hide_all(vbox2); + gtk_widget_hide(vbox2); if ((value = purple_proxy_info_get_host(proxy_info)) != NULL) @@ -1169,7 +1171,7 @@ add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent) dialog->new_proxy_type = PURPLE_PROXY_USE_GLOBAL; gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->proxy_dropdown), dialog->new_proxy_type + 1); - gtk_widget_hide_all(vbox2); + gtk_widget_hide(vbox2); } /* Connect signals. */ @@ -1709,7 +1711,10 @@ drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx, GtkSelectionData *data, guint info, guint time, AccountsWindow *dialog) { - if (data->target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE)) { + + GdkAtom target = gtk_selection_data_get_target(data); + + if (target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE)) { GtkTreeRowReference *ref; GtkTreePath *source_row; GtkTreeIter iter; @@ -1780,13 +1785,16 @@ drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx, guint x, guint y, GtkSelectionData *sd, guint info, guint t, AccountsWindow *dialog) { - if (sd->target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE) && sd->data) { + GdkAtom target = gtk_selection_data_get_target(sd); + const guchar *data = gtk_selection_data_get_data(sd); + + if (target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE) && data) { gint dest_index; PurpleAccount *a = NULL; GtkTreePath *path = NULL; GtkTreeViewDropPosition position; - memcpy(&a, sd->data, sizeof(a)); + memcpy(&a, data, sizeof(a)); if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) { diff --git a/pidgin/gtkblist-theme-loader.c b/pidgin/gtkblist-theme-loader.c index 4cb6bb87c5..eeb1817590 100644 --- a/pidgin/gtkblist-theme-loader.c +++ b/pidgin/gtkblist-theme-loader.c @@ -65,7 +65,8 @@ parse_color(xmlnode *node, const char *tag) GdkColor color; if (temp && gdk_color_parse(temp, &color)) { - gdk_colormap_alloc_color(gdk_colormap_get_system(), &color, FALSE, TRUE); + /* TODO: fix this for gtk+ 3.0 */ + /*gdk_colormap_alloc_color(gdk_colormap_get_system(), &color, FALSE, TRUE);*/ return gdk_color_copy(&color); } else { return NULL; diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index bc454c973c..0bc841f154 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -244,7 +244,7 @@ static gboolean gtk_blist_configure_cb(GtkWidget *w, GdkEventConfigure *event, g /* check for visibility because when we aren't visible, this will * * give us bogus (0,0) coordinates. - xOr */ - if (GTK_WIDGET_VISIBLE(w)) + if (gtk_widget_get_visible(w)) gtk_window_get_position(GTK_WINDOW(w), &x, &y); else return FALSE; /* carry on normally */ @@ -990,20 +990,23 @@ make_blist_request_dialog(PidginBlistRequestData *data, PurpleAccount *account, gtkblist = PIDGIN_BLIST(purple_get_blist()); blist_window = gtkblist ? GTK_WINDOW(gtkblist->window) : NULL; + /* TODO: set no separator in gtk+ 3... */ data->window = gtk_dialog_new_with_buttons(title, - blist_window, GTK_DIALOG_NO_SEPARATOR, - NULL); + blist_window, 0, NULL); gtk_window_set_transient_for(GTK_WINDOW(data->window), blist_window); gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK); gtk_container_set_border_width(GTK_CONTAINER(data->window), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE); - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), PIDGIN_HIG_BORDER); - gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), PIDGIN_HIG_BOX_SPACE); + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), + PIDGIN_HIG_BORDER); + gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), + PIDGIN_HIG_BOX_SPACE); gtk_window_set_role(GTK_WINDOW(data->window), window_role); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), + hbox); gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); gtk_misc_set_alignment(GTK_MISC(img), 0, 0); @@ -1066,7 +1069,7 @@ rebuild_chat_entries(PidginChatData *data, const char *default_chat_name) if (pce->is_int) { - GtkObject *adjust; + GtkAdjustment *adjust; adjust = gtk_adjustment_new(pce->min, pce->min, pce->max, 1, 10, 10); input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); @@ -1627,11 +1630,11 @@ gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) pidgin_retrieve_user_info(buddy->account->gc, buddy->name); } else { switch (event->keyval) { - case GDK_F2: + case GDK_KEY_F2: gtk_blist_menu_alias_cb(tv, node); break; - case GDK_Left: + case GDK_KEY_Left: path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) { /* Collapse the Group */ @@ -1653,7 +1656,7 @@ gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) gtk_tree_path_free(path); break; - case GDK_Right: + case GDK_KEY_Right: path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) { /* Expand the Group */ @@ -2276,9 +2279,9 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, guint time, gpointer null) { - - if (data->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) - { + GdkAtom target = gtk_selection_data_get_target(data); + + if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row"); GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref); GtkTreeIter iter; @@ -2297,9 +2300,7 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, sizeof (node)); gtk_tree_path_free(sourcerow); - } - else if (data->target == gdk_atom_intern("application/x-im-contact", FALSE)) - { + } else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) { GtkTreeRowReference *ref; GtkTreePath *sourcerow; GtkTreeIter iter; @@ -2382,16 +2383,19 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, guint info, guint t) { + GdkAtom target = gtk_selection_data_get_target(sd); + const guchar *data = gtk_selection_data_get_data(sd); + if (gtkblist->drag_timeout) { g_source_remove(gtkblist->drag_timeout); gtkblist->drag_timeout = 0; } - if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE) && sd->data) { + if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE) && data) { PurpleBlistNode *n = NULL; GtkTreePath *path = NULL; GtkTreeViewDropPosition position; - memcpy(&n, sd->data, sizeof(n)); + memcpy(&n, data, sizeof(n)); if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) { /* if we're here, I think it means the drop is ok */ GtkTreeIter iter; @@ -2530,12 +2534,10 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, } gtk_tree_path_free(path); - gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); } - } - else if (sd->target == gdk_atom_intern("application/x-im-contact", - FALSE) && sd->data) - { + } else if (target == gdk_atom_intern("application/x-im-contact", + FALSE) && data) { PurpleGroup *group = NULL; GtkTreePath *path = NULL; GtkTreeViewDropPosition position; @@ -2573,7 +2575,7 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, } } - if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, + if (pidgin_parse_x_im_contact((const char *) data, FALSE, &account, &protocol, &username, &alias)) { if (account == NULL) @@ -2597,9 +2599,10 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, if (path != NULL) gtk_tree_path_free(path); - gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, + (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); } - else if (sd->target == gdk_atom_intern("text/x-vcard", FALSE) && sd->data) + else if (target == gdk_atom_intern("text/x-vcard", FALSE) && data) { gboolean result; PurpleGroup *group = NULL; @@ -2635,10 +2638,11 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, } } - result = parse_vcard((const gchar *)sd->data, group); + result = parse_vcard((const gchar *) data, group); - gtk_drag_finish(dc, result, (dc->action == GDK_ACTION_MOVE), t); - } else if (sd->target == gdk_atom_intern("text/uri-list", FALSE) && sd->data) { + gtk_drag_finish(dc, result, + (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); + } else if (target == gdk_atom_intern("text/uri-list", FALSE) && data) { GtkTreePath *path = NULL; GtkTreeViewDropPosition position; @@ -2659,7 +2663,8 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) { PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node)); pidgin_dnd_file_manage(sd, b->account, b->name); - gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, + (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); } else { gtk_drag_finish(dc, FALSE, FALSE, t); } @@ -2997,7 +3002,7 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) if(gtkblist->tooltipdata == NULL) return FALSE; - style = gtkblist->tipwindow->style; + style = gtk_widget_get_style(gtkblist->tipwindow); max_text_width = 0; max_avatar_width = 0; @@ -3023,73 +3028,102 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) for(l = gtkblist->tooltipdata; l; l = l->next) { struct tooltip_data *td = l->data; - + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtkblist->tipwindow)); + if (td->avatar && pidgin_gdk_pixbuf_is_opaque(td->avatar)) { if (dir == GTK_TEXT_DIR_RTL) - gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, gtkblist->tipwindow, "tooltip", - TOOLTIP_BORDER -1, current_height -1, td->avatar_width +2, td->avatar_height + 2); + gtk_paint_flat_box(style, cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + gtkblist->tipwindow, "tooltip", + TOOLTIP_BORDER -1, current_height -1, td->avatar_width +2, + td->avatar_height + 2); else - gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, gtkblist->tipwindow, "tooltip", + gtk_paint_flat_box(style, cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + gtkblist->tipwindow, "tooltip", max_width - (td->avatar_width+ TOOLTIP_BORDER)-1, current_height-1,td->avatar_width+2, td->avatar_height+2); } if (td->status_icon) { - if (dir == GTK_TEXT_DIR_RTL) + if (dir == GTK_TEXT_DIR_RTL) { + gdk_cairo_set_source_pixbuf(cr, td->status_icon, + max_width - TOOLTIP_BORDER - status_size, current_height); + cairo_paint(cr); + /* gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon, 0, 0, max_width - TOOLTIP_BORDER - status_size, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); - else + */ + } else { + gdk_cairo_set_source_pixbuf(cr, td->status_icon, TOOLTIP_BORDER, current_height); + cairo_paint(cr); + /* gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon, 0, 0, TOOLTIP_BORDER, current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); - } + */ + } + } if(td->avatar) { - if (dir == GTK_TEXT_DIR_RTL) + if (dir == GTK_TEXT_DIR_RTL) { + gdk_cairo_set_source_pixbuf(cr, td->avatar, TOOLTIP_BORDER, current_height); + cairo_paint(cr); + /* gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->avatar, 0, 0, TOOLTIP_BORDER, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); - else + */ + } else { + gdk_cairo_set_source_pixbuf(cr, td->avatar, + max_width - (td->avatar_width + TOOLTIP_BORDER), current_height); + cairo_paint(cr); + /* gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->avatar, 0, 0, max_width - (td->avatar_width + TOOLTIP_BORDER), current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); + */ + } } - if (!td->avatar_is_prpl_icon && td->prpl_icon) + if (!td->avatar_is_prpl_icon && td->prpl_icon) { + gdk_cairo_set_source_pixbuf(cr, td->prpl_icon, prpl_col, + current_height + ((td->name_height / 2) - (PRPL_SIZE / 2))); + cairo_paint(cr); + /* gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->prpl_icon, 0, 0, prpl_col, current_height + ((td->name_height / 2) - (PRPL_SIZE / 2)), -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); + */ + } if (td->name_layout) { if (dir == GTK_TEXT_DIR_RTL) { - gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, gtkblist->tipwindow, "tooltip", + gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, + gtkblist->tipwindow, "tooltip", max_width -(TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), current_height, td->name_layout); } else { - gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, gtkblist->tipwindow, "tooltip", + gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, + gtkblist->tipwindow, "tooltip", TOOLTIP_BORDER + status_size + SMALL_SPACE, current_height, td->name_layout); } } if (td->layout) { if (dir != GTK_TEXT_DIR_RTL) { - gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, gtkblist->tipwindow, "tooltip", + gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, + gtkblist->tipwindow, "tooltip", TOOLTIP_BORDER + status_size + SMALL_SPACE, current_height + td->name_height, td->layout); } else { - gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, gtkblist->tipwindow, "tooltip", + gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, + gtkblist->tipwindow, "tooltip", max_width - (TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), current_height + td->name_height, td->layout); } } + cairo_destroy(cr); current_height += MAX(td->name_height + td->height, td->avatar_height) + td->padding; } return FALSE; @@ -3243,7 +3277,8 @@ static gboolean pidgin_blist_expand_timeout(GtkWidget *tv) pidgin_blist_expand_contact_cb(NULL, node); gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, >kblist->contact_rect); - gdk_drawable_get_size(GDK_DRAWABLE(tv->window), &(gtkblist->contact_rect.width), NULL); + gtkblist->contact_rect.width = + gdk_window_get_width(GDK_DRAWABLE(gtk_widget_get_window(tv))); gtkblist->mouseover_contact = node; gtk_tree_path_down (path); while (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &i, path)) { @@ -4575,7 +4610,7 @@ static void pidgin_blist_restore_position(void) /* if the window exists, is hidden, we're saving positions, and the * position is sane... */ if (gtkblist && gtkblist->window && - !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) { + !gtk_widget_get_visible(gtkblist->window) && blist_width != 0) { blist_x = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/x"); blist_y = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/y"); @@ -4605,7 +4640,7 @@ static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list) PurpleBlistNode *gnode, *cnode; if (gtk_blist_visibility == GDK_VISIBILITY_FULLY_OBSCURED - || !GTK_WIDGET_VISIBLE(gtkblist->window)) + || !gtk_widget_get_visible(gtkblist->window)) return TRUE; for(gnode = list->root; gnode; gnode = gnode->next) { @@ -5117,7 +5152,7 @@ gtk_blist_window_key_press_cb(GtkWidget *w, GdkEventKey *event, PidginBuddyList widget = gtk_window_get_focus(GTK_WINDOW(gtkblist->window)); if (GTK_IS_IMHTML(widget) || GTK_IS_ENTRY(widget)) { - if (gtk_bindings_activate(GTK_OBJECT(widget), event->keyval, event->state)) + if (gtk_bindings_activate(G_OBJECT(widget), event->keyval, event->state)) return TRUE; } return FALSE; @@ -5126,14 +5161,14 @@ gtk_blist_window_key_press_cb(GtkWidget *w, GdkEventKey *event, PidginBuddyList static gboolean headline_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginBuddyList *gtkblist) { - gdk_window_set_cursor(widget->window, gtkblist->hand_cursor); + gdk_window_set_cursor(gtk_widget_get_window(widget), gtkblist->hand_cursor); return FALSE; } static gboolean headline_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginBuddyList *gtkblist) { - gdk_window_set_cursor(widget->window, gtkblist->arrow_cursor); + gdk_window_set_cursor(gtk_widget_get_window(widget), gtkblist->arrow_cursor); return FALSE; } @@ -5267,7 +5302,7 @@ generic_error_enable_cb(PurpleAccount *account) } static void -generic_error_destroy_cb(GtkObject *dialog, +generic_error_destroy_cb(GtkWidget *dialog, PurpleAccount *account) { g_hash_table_remove(gtkblist->connection_errors, account); @@ -5629,17 +5664,22 @@ paint_headline_hbox (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { - gtk_paint_flat_box (widget->style, - widget->window, + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(widget)); + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + gtk_paint_flat_box (gtk_widget_get_style(widget), + cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, widget, "tooltip", - widget->allocation.x + 1, - widget->allocation.y + 1, - widget->allocation.width - 2, - widget->allocation.height - 2); + allocation.x + 1, + allocation.y + 1, + allocation.width - 2, + allocation.height - 2); + cairo_destroy(cr); + return FALSE; } @@ -5979,7 +6019,9 @@ static void pidgin_blist_show(PurpleBuddyList *list) G_CALLBACK(blist_focus_cb), gtkblist); g_signal_connect(G_OBJECT(gtkblist->window), "focus-out-event", G_CALLBACK(blist_focus_cb), gtkblist); - GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE; + + /* TODO: how is this done in gtk+ 3.0? */ + /*GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE;*/ gtkblist->main_vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(gtkblist->main_vbox); @@ -7138,7 +7180,8 @@ static void pidgin_blist_set_visible(PurpleBuddyList *list, gboolean show) return; if (show) { - if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && !GTK_WIDGET_VISIBLE(gtkblist->window)) + if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && + !gtk_widget_get_visible(gtkblist->window)) purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-unhiding", gtkblist); pidgin_blist_restore_position(); gtk_window_present(GTK_WINDOW(gtkblist->window)); @@ -7147,7 +7190,7 @@ static void pidgin_blist_set_visible(PurpleBuddyList *list, gboolean show) purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-hiding", gtkblist); gtk_widget_hide(gtkblist->window); } else { - if (!GTK_WIDGET_VISIBLE(gtkblist->window)) + if (!gtk_widget_get_visible(gtkblist->window)) gtk_widget_show(gtkblist->window); gtk_window_iconify(GTK_WINDOW(gtkblist->window)); } @@ -7523,7 +7566,7 @@ void pidgin_blist_toggle_visibility() { if (gtkblist && gtkblist->window) { - if (GTK_WIDGET_VISIBLE(gtkblist->window)) { + if (gtk_widget_get_visible(gtkblist->window)) { /* make the buddy list visible if it is iconified or if it is * obscured and not currently focused (the focus part ensures * that we do something reasonable if the buddy list is obscured @@ -7588,7 +7631,7 @@ pidgin_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback callbac static void set_urgent(void) { - if (gtkblist->window && !GTK_WIDGET_HAS_FOCUS(gtkblist->window)) + if (gtkblist->window && !gtk_widget_is_focus(gtkblist->window)) pidgin_set_urgent(GTK_WINDOW(gtkblist->window), TRUE); } @@ -8131,7 +8174,7 @@ static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *bli } static void -plugin_act(GtkObject *obj, PurplePluginAction *pam) +plugin_act(GtkWidget *obj, PurplePluginAction *pam) { if (pam && pam->callback) pam->callback(pam); diff --git a/pidgin/gtkcellrendererexpander.c b/pidgin/gtkcellrendererexpander.c index a5bb6c8a98..9a46ab87cc 100644 --- a/pidgin/gtkcellrendererexpander.c +++ b/pidgin/gtkcellrendererexpander.c @@ -44,24 +44,23 @@ static void pidgin_cell_renderer_expander_init (PidginCellRendererExpander static void pidgin_cell_renderer_expander_class_init (PidginCellRendererExpanderClass *class); static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell, GtkWidget *widget, - GdkRectangle *cell_area, + const GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height); static void pidgin_cell_renderer_expander_render (GtkCellRenderer *cell, - GdkWindow *window, + cairo_t *cr, GtkWidget *widget, - GdkRectangle *background_area, - GdkRectangle *cell_area, - GdkRectangle *expose_area, - guint flags); + const GdkRectangle *background_area, + const GdkRectangle *cell_area, + GtkCellRendererState flags); static gboolean pidgin_cell_renderer_expander_activate (GtkCellRenderer *r, GdkEvent *event, GtkWidget *widget, const gchar *p, - GdkRectangle *bg, - GdkRectangle *cell, + const GdkRectangle *bg, + const GdkRectangle *cell, GtkCellRendererState flags); static void pidgin_cell_renderer_expander_finalize (GObject *gobject); @@ -108,9 +107,10 @@ GType pidgin_cell_renderer_expander_get_type (void) static void pidgin_cell_renderer_expander_init (PidginCellRendererExpander *cellexpander) { - GTK_CELL_RENDERER(cellexpander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE; - GTK_CELL_RENDERER(cellexpander)->xpad = 0; - GTK_CELL_RENDERER(cellexpander)->ypad = 2; + g_object_set(G_OBJECT(cellexpander), "mode", + GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL); + /*GTK_CELL_RENDERER(cellexpander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;*/ + gtk_cell_renderer_set_padding(GTK_CELL_RENDERER(cellexpander), 0, 2); } static void pidgin_cell_renderer_expander_class_init (PidginCellRendererExpanderClass *class) @@ -190,7 +190,7 @@ GtkCellRenderer *pidgin_cell_renderer_expander_new(void) static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell, GtkWidget *widget, - GdkRectangle *cell_area, + const GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, @@ -199,11 +199,17 @@ static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell, gint calc_width; gint calc_height; gint expander_size; - + gint xpad; + gint ypad; + gfloat xalign; + gfloat yalign; + gtk_widget_style_get(widget, "expander-size", &expander_size, NULL); - calc_width = (gint) cell->xpad * 2 + expander_size; - calc_height = (gint) cell->ypad * 2 + expander_size; + gtk_cell_renderer_get_padding(cell, &xpad, &ypad); + gtk_cell_renderer_get_alignment(cell, &xalign, &yalign); + calc_width = (gint) xpad * 2 + expander_size; + calc_height = (gint) ypad * 2 + expander_size; if (width) *width = calc_width; @@ -215,12 +221,12 @@ static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell, { if (x_offset) { - *x_offset = cell->xalign * (cell_area->width - calc_width); + *x_offset = xalign * (cell_area->width - calc_width); *x_offset = MAX (*x_offset, 0); } if (y_offset) { - *y_offset = cell->yalign * (cell_area->height - calc_height); + *y_offset = yalign * (cell_area->height - calc_height); *y_offset = MAX (*y_offset, 0); } } @@ -228,56 +234,64 @@ static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell, static void pidgin_cell_renderer_expander_render(GtkCellRenderer *cell, - GdkWindow *window, + cairo_t *cr, GtkWidget *widget, - GdkRectangle *background_area, - GdkRectangle *cell_area, - GdkRectangle *expose_area, - guint flags) + const GdkRectangle *background_area, + const GdkRectangle *cell_area, + GtkCellRendererState flags) { PidginCellRendererExpander *cellexpander = (PidginCellRendererExpander *) cell; gboolean set; gint width, height; GtkStateType state; - + gint xpad; + gint ypad; + gboolean is_expanded; + GtkAllocation allocation; + + gtk_cell_renderer_get_padding(cell, &xpad, &ypad); + g_object_get(G_OBJECT(cell), "expanded", &is_expanded, NULL); + if (!cellexpander->is_expander) return; width = cell_area->width; height = cell_area->height; - if (!cell->sensitive) + if (!gtk_widget_get_sensitive(GTK_WIDGET(cell))) state = GTK_STATE_INSENSITIVE; else if (flags & GTK_CELL_RENDERER_PRELIT) state = GTK_STATE_PRELIGHT; - else if (GTK_WIDGET_HAS_FOCUS (widget) && flags & GTK_CELL_RENDERER_SELECTED) + else if (gtk_widget_has_focus(widget) && flags & GTK_CELL_RENDERER_SELECTED) state = GTK_STATE_ACTIVE; else state = GTK_STATE_NORMAL; - width -= cell->xpad*2; - height -= cell->ypad*2; + width -= xpad*2; + height -= ypad*2; - gtk_paint_expander (widget->style, - window, state, - NULL, widget, "treeview", - cell_area->x + cell->xpad + (width / 2), - cell_area->y + cell->ypad + (height / 2), - cell->is_expanded ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED); + gtk_paint_expander (gtk_widget_get_style(widget), + cr, state, + widget, "treeview", + cell_area->x + xpad + (width / 2), + cell_area->y + ypad + (height / 2), + is_expanded ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED); /* only draw the line if the color isn't set - this prevents a bug where the hline appears only under the expander */ g_object_get(cellexpander, "cell-background-set", &set, NULL); - if (cell->is_expanded && !set) - gtk_paint_hline (widget->style, window, state, NULL, widget, NULL, 0, - widget->allocation.width, cell_area->y + cell_area->height); + gtk_widget_get_allocation(widget, &allocation); + + if (is_expanded && !set) + gtk_paint_hline (gtk_widget_get_style(widget), cr, state, widget, NULL, 0, + allocation.width, cell_area->y + cell_area->height); } static gboolean pidgin_cell_renderer_expander_activate(GtkCellRenderer *r, GdkEvent *event, GtkWidget *widget, const gchar *p, - GdkRectangle *bg, - GdkRectangle *cell, + const GdkRectangle *bg, + const GdkRectangle *cell, GtkCellRendererState flags) { GtkTreePath *path = gtk_tree_path_new_from_string(p); diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 18d824e092..f574159d81 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -778,15 +778,17 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, InviteBuddyInfo *info = (InviteBuddyInfo *)data; const char *convprotocol; gboolean success = TRUE; - + GdkAtom target = gtk_selection_data_get_target(sd); + convprotocol = purple_account_get_protocol_id(purple_conversation_get_account(info->conv)); - if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) + if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { PurpleBlistNode *node = NULL; PurpleBuddy *buddy; - - memcpy(&node, sd->data, sizeof(node)); + const guchar *data = gtk_selection_data_get_data(sd); + + memcpy(&node, data, sizeof(node)); if (PURPLE_BLIST_NODE_IS_CONTACT(node)) buddy = purple_contact_get_priority_buddy((PurpleContact *)node); @@ -805,15 +807,16 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, else gtk_entry_set_text(GTK_ENTRY(info->entry), purple_buddy_get_name(buddy)); - gtk_drag_finish(dc, success, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, success, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } - else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) + else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) { char *protocol = NULL; char *username = NULL; PurpleAccount *account; - if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, + if (pidgin_parse_x_im_contact((const char *) data, FALSE, &account, &protocol, &username, NULL)) { if (account == NULL) @@ -838,7 +841,8 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, g_free(username); g_free(protocol); - gtk_drag_finish(dc, success, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, success, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } } @@ -880,12 +884,15 @@ invite_cb(GtkWidget *widget, PidginConversation *gtkconv) GTK_RESPONSE_OK); gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); + /* TODO: set no separator using GTK+ 3.0 */ + /* gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); - + */ + info->window = GTK_WIDGET(invite_dialog); /* Setup the outside spacing. */ - vbox = GTK_DIALOG(invite_dialog)->vbox; + vbox = gtk_dialog_get_content_area(GTK_DIALOG(invite_dialog)); gtk_box_set_spacing(GTK_BOX(vbox), PIDGIN_HIG_BORDER); gtk_container_set_border_width(GTK_CONTAINER(vbox), PIDGIN_HIG_BOX_SPACE); @@ -1078,8 +1085,8 @@ menu_view_log_cb(GtkAction *action, gpointer data) gtkblist = pidgin_blist_get_default_gtk_blist(); cursor = gdk_cursor_new(GDK_WATCH); - gdk_window_set_cursor(gtkblist->window->window, cursor); - gdk_window_set_cursor(win->window->window, cursor); + gdk_window_set_cursor(gtk_widget_get_window(gtkblist->window), cursor); + gdk_window_set_cursor(gtk_widget_get_window(win->window), cursor); gdk_cursor_unref(cursor); #if GTK_CHECK_VERSION(2,4,0) && !GTK_CHECK_VERSION(2,6,0) //FIXME: What? gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); @@ -1096,8 +1103,8 @@ menu_view_log_cb(GtkAction *action, gpointer data) { pidgin_log_show_contact((PurpleContact *)node->parent); g_slist_free(buddies); - gdk_window_set_cursor(gtkblist->window->window, NULL); - gdk_window_set_cursor(win->window->window, NULL); + gdk_window_set_cursor(gtk_widget_get_window(gtkblist->window), NULL); + gdk_window_set_cursor(gtk_widget_get_window(win->window), NULL); return; } } @@ -1105,8 +1112,8 @@ menu_view_log_cb(GtkAction *action, gpointer data) pidgin_log_show(type, name, account); - gdk_window_set_cursor(gtkblist->window->window, NULL); - gdk_window_set_cursor(win->window->window, NULL); + gdk_window_set_cursor(gtk_widget_get_window(gtkblist->window), NULL); + gdk_window_set_cursor(gtk_widget_get_window(win->window), NULL); } static void @@ -1919,7 +1926,7 @@ conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) /* If CTRL was held down... */ if (event->state & GDK_CONTROL_MASK) { switch (event->keyval) { - case GDK_Page_Down: + case GDK_KEY_Page_Down: case ']': if (!pidgin_conv_window_get_gtkconv_at_index(win, curconv + 1)) gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); @@ -1928,7 +1935,7 @@ conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) return TRUE; break; - case GDK_Page_Up: + case GDK_KEY_Page_Up: case '[': if (!pidgin_conv_window_get_gtkconv_at_index(win, curconv - 1)) gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), -1); @@ -1937,9 +1944,9 @@ conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) return TRUE; break; - case GDK_Tab: - case GDK_KP_Tab: - case GDK_ISO_Left_Tab: + case GDK_KEY_Tab: + case GDK_KEY_KP_Tab: + case GDK_KEY_ISO_Left_Tab: if (event->state & GDK_SHIFT_MASK) { move_to_next_unread_tab(gtkconv, FALSE); } else { @@ -1949,20 +1956,20 @@ conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) return TRUE; break; - case GDK_comma: + case GDK_KEY_comma: gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv), curconv - 1); return TRUE; break; - case GDK_period: + case GDK_KEY_period: gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv), (curconv + 1) % gtk_notebook_get_n_pages(GTK_NOTEBOOK(win->notebook))); return TRUE; break; - case GDK_F6: + case GDK_KEY_F6: if (gtkconv_cycle_focus(gtkconv, event->state & GDK_SHIFT_MASK ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD)) return TRUE; break; @@ -1986,13 +1993,13 @@ conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) else { switch (event->keyval) { - case GDK_F2: + case GDK_KEY_F2: if (gtk_widget_is_focus(GTK_WIDGET(win->notebook))) { infopane_entry_activate(gtkconv); return TRUE; } break; - case GDK_F6: + case GDK_KEY_F6: if (gtkconv_cycle_focus(gtkconv, event->state & GDK_SHIFT_MASK ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD)) return TRUE; break; @@ -2016,7 +2023,7 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) /* If CTRL was held down... */ if (event->state & GDK_CONTROL_MASK) { switch (event->keyval) { - case GDK_Up: + case GDK_KEY_Up: if (!gtkconv->send_history) break; @@ -2067,7 +2074,7 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) return TRUE; break; - case GDK_Down: + case GDK_KEY_Down: if (!gtkconv->send_history) break; @@ -2120,20 +2127,20 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) /* If neither CTRL nor ALT were held down... */ else { switch (event->keyval) { - case GDK_Tab: - case GDK_KP_Tab: - case GDK_ISO_Left_Tab: + case GDK_KEY_Tab: + case GDK_KEY_KP_Tab: + case GDK_KEY_ISO_Left_Tab: if (gtkconv->entry != entry) break; return tab_complete(conv); break; - case GDK_Page_Up: + case GDK_KEY_Page_Up: gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); return TRUE; break; - case GDK_Page_Down: + case GDK_KEY_Page_Down: gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); return TRUE; break; @@ -2177,24 +2184,24 @@ refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) /* If we have a valid key for the conversation display, then exit */ if ((event->state & GDK_CONTROL_MASK) || - (event->keyval == GDK_F6) || - (event->keyval == GDK_F10) || - (event->keyval == GDK_Shift_L) || - (event->keyval == GDK_Shift_R) || - (event->keyval == GDK_Control_L) || - (event->keyval == GDK_Control_R) || - (event->keyval == GDK_Escape) || - (event->keyval == GDK_Up) || - (event->keyval == GDK_Down) || - (event->keyval == GDK_Left) || - (event->keyval == GDK_Right) || - (event->keyval == GDK_Page_Up) || - (event->keyval == GDK_Page_Down) || - (event->keyval == GDK_Home) || - (event->keyval == GDK_End) || - (event->keyval == GDK_Tab) || - (event->keyval == GDK_KP_Tab) || - (event->keyval == GDK_ISO_Left_Tab)) + (event->keyval == GDK_KEY_F6) || + (event->keyval == GDK_KEY_F10) || + (event->keyval == GDK_KEY_Shift_L) || + (event->keyval == GDK_KEY_Shift_R) || + (event->keyval == GDK_KEY_Control_L) || + (event->keyval == GDK_KEY_Control_R) || + (event->keyval == GDK_KEY_Escape) || + (event->keyval == GDK_KEY_Up) || + (event->keyval == GDK_KEY_Down) || + (event->keyval == GDK_KEY_Left) || + (event->keyval == GDK_KEY_Right) || + (event->keyval == GDK_KEY_Page_Up) || + (event->keyval == GDK_KEY_Page_Down) || + (event->keyval == GDK_KEY_Home) || + (event->keyval == GDK_KEY_End) || + (event->keyval == GDK_KEY_Tab) || + (event->keyval == GDK_KEY_KP_Tab) || + (event->keyval == GDK_KEY_ISO_Left_Tab)) { if (event->type == GDK_KEY_PRESS) return conv_keypress_common(gtkconv, event); @@ -2662,7 +2669,7 @@ redraw_icon(gpointer data) } static void -start_anim(GtkObject *obj, PidginConversation *gtkconv) +start_anim(GtkWidget *widget, PidginConversation *gtkconv) { int delay; @@ -2835,7 +2842,7 @@ icon_menu_save_cb(GtkWidget *widget, PidginConversation *gtkconv) } static void -stop_anim(GtkObject *obj, PidginConversation *gtkconv) +stop_anim(GtkWidget *widget, PidginConversation *gtkconv) { if (gtkconv->u.im->icon_timer != 0) g_source_remove(gtkconv->u.im->icon_timer); @@ -2857,7 +2864,7 @@ toggle_icon_animate_cb(GtkWidget *w, PidginConversation *gtkconv) } static gboolean -icon_menu(GtkObject *obj, GdkEventButton *e, PidginConversation *gtkconv) +icon_menu(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkconv) { static GtkWidget *menu = NULL; PurpleConversation *conv; @@ -4658,13 +4665,22 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv) GdkRectangle oneline; int height, diff; int pad_top, pad_inside, pad_bottom; - int total_height = (gtkconv->imhtml->allocation.height + gtkconv->entry->allocation.height); - int max_height = total_height / 2; + int total_height; + int max_height; int min_lines = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines"); int min_height; gboolean interior_focus; int focus_width; - + GtkAllocation imhtml_allocation; + GtkAllocation entry_allocation; + GtkAllocation lower_hbox_allocation; + + gtk_widget_get_allocation(gtkconv->imhtml, &imhtml_allocation); + gtk_widget_get_allocation(gtkconv->entry, &entry_allocation); + gtk_widget_get_allocation(gtkconv->lower_hbox, &lower_hbox_allocation); + total_height = imhtml_allocation.height + entry_allocation.height; + max_height = total_height / 2; + pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry)); @@ -4697,12 +4713,12 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv) if (!interior_focus) height += 2 * focus_width; - diff = height - gtkconv->entry->allocation.height; + diff = height - entry_allocation.height; if (ABS(diff) < oneline.height / 2) return FALSE; gtk_widget_set_size_request(gtkconv->lower_hbox, -1, - diff + gtkconv->lower_hbox->allocation.height); + diff + lower_hbox_allocation.height); return FALSE; } @@ -4749,7 +4765,7 @@ setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox) if(prpl_info->set_chat_topic == NULL) { gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); } else { - g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", + g_signal_connect(GTK_WIDGET(gtkchat->topic_text), "activate", G_CALLBACK(topic_callback), gtkconv); } @@ -4924,7 +4940,7 @@ pidgin_conv_end_quickfind(PidginConversation *gtkconv) gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL); gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml)); - gtk_widget_hide_all(gtkconv->quickfind.container); + gtk_widget_hide(gtkconv->quickfind.container); gtk_widget_grab_focus(gtkconv->entry); return TRUE; @@ -4934,8 +4950,8 @@ static gboolean quickfind_process_input(GtkWidget *entry, GdkEventKey *event, PidginConversation *gtkconv) { switch (event->keyval) { - case GDK_Return: - case GDK_KP_Enter: + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: if (gtk_imhtml_search_find(GTK_IMHTML(gtkconv->imhtml), gtk_entry_get_text(GTK_ENTRY(entry)))) { gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL); } else { @@ -4946,7 +4962,7 @@ quickfind_process_input(GtkWidget *entry, GdkEventKey *event, PidginConversation gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, &col); } break; - case GDK_Escape: + case GDK_KEY_Escape: pidgin_conv_end_quickfind(gtkconv); break; default: @@ -5189,8 +5205,10 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, PurpleAccount *convaccount = purple_conversation_get_account(conv); PurpleConnection *gc = purple_account_get_connection(convaccount); PurplePluginProtocolInfo *prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; - - if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) + GdkAtom target = gtk_selection_data_get_target(sd); + const guchar *data = gtk_selection_data_get_data(sd); + + if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { PurpleBlistNode *n = NULL; PurpleBuddy *b; @@ -5198,7 +5216,7 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, PurpleAccount *buddyaccount; const char *buddyname; - n = *(PurpleBlistNode **)sd->data; + n = *(PurpleBlistNode **) data; if (PURPLE_BLIST_NODE_IS_CONTACT(n)) b = purple_contact_get_priority_buddy((PurpleContact*)n); @@ -5246,16 +5264,17 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, pidgin_conv_window_switch_gtkconv(win, gtkconv); } - gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } - else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) + else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) { char *protocol = NULL; char *username = NULL; PurpleAccount *account; PidginConversation *gtkconv; - if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, + if (pidgin_parse_x_im_contact((const char *) data, FALSE, &account, &protocol, &username, NULL)) { if (account == NULL) @@ -5286,12 +5305,14 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, g_free(username); g_free(protocol); - gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } - else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { + else if (target == gdk_atom_intern("text/uri-list", FALSE)) { if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) pidgin_dnd_file_manage(sd, convaccount, purple_conversation_get_name(conv)); - gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } else gtk_drag_finish(dc, FALSE, FALSE, t); @@ -5697,21 +5718,28 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, GdkEventButton *btn_event = (GdkEventButton*) event; PurpleConversation *conv = data; char *buddyname; + gchar *name; + g_object_get(G_OBJECT(tag), "name", &name, NULL); + /* strlen("BUDDY " or "HILIT ") == 6 */ - g_return_val_if_fail((tag->name != NULL) - && (strlen(tag->name) > 6), FALSE); + g_return_val_if_fail((name != NULL) && (strlen(name) > 6), FALSE); - buddyname = (tag->name) + 6; + buddyname = name + 6; + if (btn_event->button == 1 && event->type == GDK_2BUTTON_PRESS) { chat_do_im(PIDGIN_CONVERSATION(conv), buddyname); + g_free(name); + return TRUE; } else if (btn_event->button == 2 && event->type == GDK_2BUTTON_PRESS) { chat_do_info(PIDGIN_CONVERSATION(conv), buddyname); + g_free(name); + return TRUE; } else if (btn_event->button == 3 && event->type == GDK_BUTTON_PRESS) { @@ -5733,10 +5761,14 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, btn_event->button, btn_event->time); + g_free(name); + /* Don't propagate the event any further */ return TRUE; } } + + g_free(name); } return FALSE; @@ -6863,7 +6895,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) if (title != markup) g_free(markup); - if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) + if (!gtk_widget_get_realized(gtkconv->tab_label)) gtk_widget_realize(gtkconv->tab_label); accessibility_obj = gtk_widget_get_accessible(gtkconv->tab_cont); @@ -7238,11 +7270,14 @@ pidgin_conv_xy_to_right_infopane(PidginWindow *win, int x, int y) { gint pane_x, pane_y, x_rel; PidginConversation *gtkconv; + GtkAllocation allocation; - gdk_window_get_origin(win->notebook->window, &pane_x, &pane_y); + gtk_widget_get_allocation(gtkconv->infopane, &allocation); + gdk_window_get_origin(gtk_widget_get_window(win->notebook), + &pane_x, &pane_y); x_rel = x - pane_x; gtkconv = pidgin_conv_window_get_active_gtkconv(win); - return (x_rel > gtkconv->infopane->allocation.x + gtkconv->infopane->allocation.width / 2); + return (x_rel > allocation.x + allocation.width / 2); } int @@ -7260,7 +7295,7 @@ pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right) notebook = GTK_NOTEBOOK(win->notebook); - gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y); + gdk_window_get_origin(gtk_widget_get_window(win->notebook), &nb_x, &nb_y); x_rel = x - nb_x; y_rel = y - nb_y; @@ -7270,30 +7305,32 @@ pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right) count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); for (i = 0; i < count; i++) { + GtkAllocation allocation; + gtk_widget_get_allocation(tab, &allocation); page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i); tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page); /* Make sure the tab is not hidden beyond an arrow */ - if (!GTK_WIDGET_DRAWABLE(tab) && gtk_notebook_get_show_tabs(notebook)) + if (!gtk_widget_is_drawable(tab) && gtk_notebook_get_show_tabs(notebook)) continue; if (horiz) { - if (x_rel >= tab->allocation.x - PIDGIN_HIG_BOX_SPACE && - x_rel <= tab->allocation.x + tab->allocation.width + PIDGIN_HIG_BOX_SPACE) { + if (x_rel >= allocation.x - PIDGIN_HIG_BOX_SPACE && + x_rel <= allocation.x + allocation.width + PIDGIN_HIG_BOX_SPACE) { page_num = i; - if (to_right && x_rel >= tab->allocation.x + tab->allocation.width/2) + if (to_right && x_rel >= allocation.x + allocation.width/2) *to_right = TRUE; break; } } else { - if (y_rel >= tab->allocation.y - PIDGIN_HIG_BOX_SPACE && - y_rel <= tab->allocation.y + tab->allocation.height + PIDGIN_HIG_BOX_SPACE) { + if (y_rel >= allocation.y - PIDGIN_HIG_BOX_SPACE && + y_rel <= allocation.y + allocation.height + PIDGIN_HIG_BOX_SPACE) { page_num = i; - if (to_right && y_rel >= tab->allocation.y + tab->allocation.height/2) + if (to_right && y_rel >= allocation.y + allocation.height/2) *to_right = TRUE; break; @@ -8383,11 +8420,15 @@ build_warn_close_dialog(PidginWindow *gtkwin) gtk_container_set_border_width(GTK_CONTAINER(warn_close_dialog), 6); gtk_window_set_resizable(GTK_WINDOW(warn_close_dialog), FALSE); - gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog), - FALSE); + /* TODO: figure out how to set no separator in GTK+ 3.0 */ + /* + gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog), + FALSE); + */ + /* Setup the outside spacing. */ - vbox = GTK_DIALOG(warn_close_dialog)->vbox; + vbox = gtk_dialog_get_content_area(GTK_DIALOG(warn_close_dialog)); gtk_box_set_spacing(GTK_BOX(vbox), 12); gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); @@ -8541,7 +8582,7 @@ notebook_init_grab(PidginWindow *gtkwin, GtkWidget *widget) always be true after a button press. */ if (!gdk_pointer_is_grabbed()) #endif - gdk_pointer_grab(gtkwin->notebook->window, FALSE, + gdk_pointer_grab(gtk_widget_get_window(gtkwin->notebook), FALSE, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, cursor, GDK_CURRENT_TIME); } @@ -8661,19 +8702,22 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc if (e->button == 1) { int nb_x, nb_y; + GtkAllocation allocation; + gtk_widget_get_allocation(gtkconv->infopane_hbox, &allocation); + if (gtkconv->win->in_drag) return TRUE; gtkconv->win->in_predrag = TRUE; gtkconv->win->drag_tab = gtk_notebook_page_num(GTK_NOTEBOOK(gtkconv->win->notebook), gtkconv->tab_cont); - gdk_window_get_origin(gtkconv->infopane_hbox->window, &nb_x, &nb_y); + gdk_window_get_origin(gtk_widget_get_window(gtkconv->infopane_hbox), &nb_x, &nb_y); - gtkconv->win->drag_min_x = gtkconv->infopane_hbox->allocation.x + nb_x; - gtkconv->win->drag_min_y = gtkconv->infopane_hbox->allocation.y + nb_y; - gtkconv->win->drag_max_x = gtkconv->infopane_hbox->allocation.width + gtkconv->win->drag_min_x; - gtkconv->win->drag_max_y = gtkconv->infopane_hbox->allocation.height + gtkconv->win->drag_min_y; + gtkconv->win->drag_min_x = allocation.x + nb_x; + gtkconv->win->drag_min_y = allocation.y + nb_y; + gtkconv->win->drag_max_x = allocation.width + gtkconv->win->drag_min_x; + gtkconv->win->drag_max_y = allocation.height + gtkconv->win->drag_min_y; gtkconv->win->drag_motion_signal = g_signal_connect(G_OBJECT(gtkconv->win->notebook), "motion_notify_event", G_CALLBACK(notebook_motion_cb), gtkconv->win); @@ -8716,6 +8760,7 @@ notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) int tab_clicked; GtkWidget *page; GtkWidget *tab; + GtkAllocation allocation; if (e->button == 2 && e->type == GDK_BUTTON_PRESS) { PidginConversation *gtkconv; @@ -8753,7 +8798,7 @@ notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) * Get the relative position of the press event, with regards to * the position of the notebook. */ - gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y); + gdk_window_get_origin(gtk_widget_get_window(win->notebook), &nb_x, &nb_y); /* Reset the min/max x/y */ win->drag_min_x = 0; @@ -8765,10 +8810,12 @@ notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), tab_clicked); tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(win->notebook), page); - win->drag_min_x = tab->allocation.x + nb_x; - win->drag_min_y = tab->allocation.y + nb_y; - win->drag_max_x = tab->allocation.width + win->drag_min_x; - win->drag_max_y = tab->allocation.height + win->drag_min_y; + gtk_widget_get_allocation(tab, &allocation); + + win->drag_min_x = allocation.x + nb_x; + win->drag_min_y = allocation.y + nb_y; + win->drag_max_x = allocation.width + win->drag_min_x; + win->drag_max_y = allocation.height + win->drag_min_y; /* Make sure the click occurred in the tab. */ if (e->x_root < win->drag_min_x || @@ -9005,12 +9052,15 @@ static void close_tab_cb(GtkWidget *w, GObject *menu) close_conv_cb(NULL, gtkconv); } +/* TODO: I don't know if this doable in GTK+ 3.0 */ +#if 0 static gboolean right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, PidginWindow *win) { - GtkWidget *item, *menu; + GtkWidget *item; PidginConversation *gtkconv; - + GtkWidget *menu = gtk_notebook_get_menu + if (event->type != GDK_BUTTON_PRESS || event->button != 3) return FALSE; @@ -9056,6 +9106,7 @@ right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, PidginWindow * return FALSE; } +#endif static void remove_edit_entry(PidginConversation *gtkconv, GtkWidget *entry) @@ -9077,7 +9128,7 @@ alias_focus_cb(GtkWidget *widget, GdkEventFocus *event, gpointer user_data) static gboolean alias_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { - if (event->keyval == GDK_Escape) { + if (event->keyval == GDK_KEY_Escape) { remove_edit_entry(user_data, widget); return TRUE; } @@ -9122,7 +9173,7 @@ infopane_entry_activate(PidginConversation *gtkconv) PurpleConversation *conv = gtkconv->active_conv; const char *text = NULL; - if (!GTK_WIDGET_VISIBLE(gtkconv->infopane)) { + if (!gtk_widget_get_visible(gtkconv->infopane)) { /* There's already an entry for alias. Let's not create another one. */ return FALSE; } @@ -9284,14 +9335,14 @@ plugin_changed_cb(PurplePlugin *p, gpointer data) static gboolean gtk_conv_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data) { int x, y; - if (GTK_WIDGET_VISIBLE(w)) + if (gtk_widget_get_visible(w)) gtk_window_get_position(GTK_WINDOW(w), &x, &y); else return FALSE; /* carry on normally */ /* Workaround for GTK+ bug # 169811 - "configure_event" is fired * when the window is being maximized */ - if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED) + if (gdk_window_get_state(gtk_widget_get_window(w)) & GDK_WINDOW_STATE_MAXIMIZED) return FALSE; /* don't save off-screen positioning */ @@ -9319,7 +9370,7 @@ pidgin_conv_set_position_size(PidginWindow *win, int conv_x, int conv_y, /* if the window exists, is hidden, we're saving positions, and the * position is sane... */ if (win && win->window && - !GTK_WIDGET_VISIBLE(win->window) && conv_width != 0) { + !gtk_widget_get_visible(win->window) && conv_width != 0) { #ifdef _WIN32 /* only override window manager placement on Windows */ /* ...check position is on screen... */ @@ -9404,9 +9455,13 @@ pidgin_conv_window_new() gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); gtk_notebook_set_show_border(GTK_NOTEBOOK(win->notebook), TRUE); + /* TODO: figure out how to add custom stuff to the right-click menu in + GtkNotebook in GTK+ 3.0 */ + /* g_signal_connect(G_OBJECT(win->notebook), "button-press-event", G_CALLBACK(right_click_menu_cb), win); - + */ + gtk_widget_show(win->notebook); g_signal_connect(G_OBJECT(win->notebook), "switch_page", @@ -9497,7 +9552,7 @@ pidgin_conv_window_hide(PidginWindow *win) void pidgin_conv_window_raise(PidginWindow *win) { - gdk_window_raise(GDK_WINDOW(win->window->window)); + gdk_window_raise(GDK_WINDOW(gtk_widget_get_window(win->window))); } void @@ -9672,7 +9727,7 @@ pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv) g_signal_connect(G_OBJECT(ebox), "enter-notify-event", G_CALLBACK(gtkconv_tab_set_tip), gtkconv); - if (gtkconv->tab_label->parent == NULL) { + if (gtk_widget_get_parent(gtkconv->tab_label) == NULL) { /* Pack if it's a new widget */ gtk_box_pack_start(GTK_BOX(gtkconv->tabby), first, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(gtkconv->tabby), gtkconv->tab_label, TRUE, TRUE, 0); @@ -9693,9 +9748,8 @@ pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv) gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox); } - gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, - !tabs_side && !angle, - TRUE, GTK_PACK_START); + g_object_set(G_OBJECT(win->notebook), "expand", !tabs_side && !angle, + "fill", TRUE, NULL); if (pidgin_conv_window_get_gtkconv_count(win) == 1) gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), @@ -9807,7 +9861,7 @@ pidgin_conv_window_get_at_xy(int x, int y) for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) { win = l->data; - if (gdkwin == win->window->window) + if (gdkwin == gtk_widget_get_window(win->window)) return win; } @@ -9929,14 +9983,14 @@ conv_placement_last_created_win_type_configured_cb(GtkWidget *w, PurpleConversationType type = purple_conversation_get_type(conv->active_conv); GList *all; - if (GTK_WIDGET_VISIBLE(w)) + if (gtk_widget_get_visible(w)) gtk_window_get_position(GTK_WINDOW(w), &x, &y); else return FALSE; /* carry on normally */ /* Workaround for GTK+ bug # 169811 - "configure_event" is fired * when the window is being maximized */ - if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED) + if (gdk_window_get_state(gtk_widget_get_window(w)) & GDK_WINDOW_STATE_MAXIMIZED) return FALSE; /* don't save off-screen positioning */ diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index 88eff55526..c22765921f 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -128,7 +128,7 @@ debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) static gboolean configure_cb(GtkWidget *w, GdkEventConfigure *event, DebugWindow *win) { - if (GTK_WIDGET_VISIBLE(w)) { + if (gtk_widget_get_visible(w)) { purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/width", event->width); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/height", event->height); } @@ -622,8 +622,8 @@ regex_changed_cb(GtkWidget *w, DebugWindow *win) { static void regex_key_release_cb(GtkWidget *w, GdkEventKey *e, DebugWindow *win) { - if(e->keyval == GDK_Return && - GTK_WIDGET_IS_SENSITIVE(win->filter) && + if(e->keyval == GDK_KEY_Return && + gtk_widget_is_sensitive(win->filter) && !gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter), TRUE); @@ -925,7 +925,7 @@ debug_window_new(void) gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level "))); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); - win->filterlevel = gtk_combo_box_new_text(); + win->filterlevel = gtk_combo_box_text_new(); item = gtk_tool_item_new(); #if GTK_CHECK_VERSION(2,12,0) gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level.")); @@ -935,12 +935,12 @@ debug_window_new(void) gtk_container_add(GTK_CONTAINER(item), win->filterlevel); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); - gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All")); - gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc")); - gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info")); - gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Warning")); - gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Error ")); - gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Fatal Error")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("All")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Misc")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Info")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Warning")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Error ")); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Fatal Error")); gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")); #ifdef USE_REGEX diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 98c32d2b1d..f98d863f8a 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -452,7 +452,7 @@ pidgin_build_help_dialog(const char *title, const char *role, GString *string) button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, G_CALLBACK(destroy_win), win); - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(button, TRUE); gtk_widget_grab_default(button); gtk_widget_show_all(win); @@ -899,12 +899,15 @@ pidgin_dialogs_ee(const char *ee) gtk_container_set_border_width (GTK_CONTAINER(window), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), PIDGIN_HIG_BORDER); - gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), PIDGIN_HIG_BOX_SPACE); + /* TODO: figure out how to set no separator in a dialog in GTK+ 3.0 */ + /*gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE);*/ + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(window))), + PIDGIN_HIG_BORDER); + gtk_container_set_border_width (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))), + PIDGIN_HIG_BOX_SPACE); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))), hbox); img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_COOL, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); diff --git a/pidgin/gtkdialogs.h b/pidgin/gtkdialogs.h index ed87bac54e..3603fb3227 100644 --- a/pidgin/gtkdialogs.h +++ b/pidgin/gtkdialogs.h @@ -66,6 +66,6 @@ void pidgin_dialogs_merge_groups(PurpleGroup *, const char *); gtk_window_set_type_hint(GTK_WINDOW(x), GDK_WINDOW_TYPE_HINT_DIALOG) #endif -#define PIDGIN_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED) +#define PIDGIN_WINDOW_ICONIFIED(x) (gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(x))) & GDK_WINDOW_STATE_ICONIFIED) #endif /* _PIDGINDIALOGS_H_ */ diff --git a/pidgin/gtkdnd-hints.c b/pidgin/gtkdnd-hints.c index faed31c511..7304ac6eda 100644 --- a/pidgin/gtkdnd-hints.c +++ b/pidgin/gtkdnd-hints.c @@ -57,28 +57,34 @@ static HintWindowInfo hint_windows[] = { static GtkWidget * dnd_hints_init_window(const gchar *fname) { + /* TODO: this is likely very broken right now, I think this needs to be + Cairo-ified */ GdkPixbuf *pixbuf; - GdkPixmap *pixmap; - GdkBitmap *bitmap; + /*GdkPixmap *pixmap;*/ + /*GdkBitmap *bitmap;*/ GtkWidget *pix; GtkWidget *win; pixbuf = gdk_pixbuf_new_from_file(fname, NULL); g_return_val_if_fail(pixbuf, NULL); + /* gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, &bitmap, 128); g_object_unref(G_OBJECT(pixbuf)); - - gtk_widget_push_colormap(gdk_rgb_get_colormap()); + */ + + /*gtk_widget_push_colormap(gdk_rgb_get_colormap());*/ win = gtk_window_new(GTK_WINDOW_POPUP); - pix = gtk_image_new_from_pixmap(pixmap, bitmap); + pix = gtk_image_new_from_pixbuf(pixbuf); gtk_container_add(GTK_CONTAINER(win), pix); - gtk_widget_shape_combine_mask(win, bitmap, 0, 0); - gtk_widget_pop_colormap(); + /*gtk_widget_shape_combine_mask(win, bitmap, 0, 0); + gtk_widget_pop_colormap();*/ + /* g_object_unref(G_OBJECT(pixmap)); g_object_unref(G_OBJECT(bitmap)); - + */ + gtk_widget_show_all(pix); return win; @@ -88,17 +94,22 @@ static void get_widget_coords(GtkWidget *w, gint *x1, gint *y1, gint *x2, gint *y2) { gint ox, oy, width, height; - - if (w->parent && w->parent->window == w->window) + GtkWidget *parent = gtk_widget_get_parent(w); + + if (parent && gtk_widget_get_window(parent) == gtk_widget_get_window(w)) { - get_widget_coords(w->parent, &ox, &oy, NULL, NULL); - height = w->allocation.height; - width = w->allocation.width; + GtkAllocation allocation; + + gtk_widget_get_allocation(w, &allocation); + get_widget_coords(parent, &ox, &oy, NULL, NULL); + height = allocation.height; + width = allocation.width; } else { - gdk_window_get_origin(w->window, &ox, &oy); - gdk_drawable_get_size(w->window, &width, &height); + gdk_window_get_origin(gtk_widget_get_window(w), &ox, &oy); + width = gdk_window_get_width(gtk_widget_get_window(w)); + height = gdk_window_get_height(gtk_widget_get_window(w)); } if (x1) *x1 = ox; @@ -171,10 +182,13 @@ dnd_hints_show_relative(DndHintWindowId id, GtkWidget *widget, { gint x1, x2, y1, y2; gint x = 0, y = 0; + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); get_widget_coords(widget, &x1, &y1, &x2, &y2); - x1 += widget->allocation.x; x2 += widget->allocation.x; - y1 += widget->allocation.y; y2 += widget->allocation.y; + x1 += allocation.x; x2 += allocation.x; + y1 += allocation.y; y2 += allocation.y; switch (horiz) { diff --git a/pidgin/gtkdocklet-gtk.c b/pidgin/gtkdocklet-gtk.c index ad3c290017..1b9ed3c8f6 100644 --- a/pidgin/gtkdocklet-gtk.c +++ b/pidgin/gtkdocklet-gtk.c @@ -51,7 +51,10 @@ static void docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) { const gchar *icon_name = NULL; + gboolean blinking; + g_object_get(G_OBJECT(docklet), "blinking", &blinking, NULL); + switch (status) { case PURPLE_STATUS_OFFLINE: icon_name = PIDGIN_STOCK_TRAY_OFFLINE; @@ -83,9 +86,9 @@ docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting } if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")) { - gtk_status_icon_set_blinking(docklet, (pending && !connecting)); - } else if (gtk_status_icon_get_blinking(docklet)) { - gtk_status_icon_set_blinking(docklet, FALSE); + g_object_set(G_OBJECT(docklet), "blinking", pending && !connecting, NULL); + } else if (blinking) { + g_object_set(G_OBJECT(docklet), "blinking", FALSE, NULL); } } @@ -93,9 +96,9 @@ static void docklet_gtk_status_set_tooltip(gchar *tooltip) { if (tooltip) { - gtk_status_icon_set_tooltip(docklet, tooltip); + gtk_status_icon_set_tooltip_text(docklet, tooltip); } else { - gtk_status_icon_set_tooltip(docklet, NULL); + gtk_status_icon_set_tooltip_text(docklet, NULL); } } diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index 3ab5801a75..f56a67cf91 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -315,19 +315,21 @@ docklet_show_pref_changed_cb(const char *name, PurplePrefType type, static void docklet_toggle_mute(GtkWidget *toggle, void *data) { - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", GTK_CHECK_MENU_ITEM(toggle)->active); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", + gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); } static void docklet_toggle_blink(GtkWidget *toggle, void *data) { - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/blink", GTK_CHECK_MENU_ITEM(toggle)->active); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/blink", + gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); } static void docklet_toggle_blist(GtkWidget *toggle, void *data) { - purple_blist_set_visible(GTK_CHECK_MENU_ITEM(toggle)->active); + purple_blist_set_visible(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); } #ifdef _WIN32 @@ -593,7 +595,7 @@ docklet_status_submenu(void) static void -plugin_act(GtkObject *obj, PurplePluginAction *pam) +plugin_act(GtkWidget *widget, PurplePluginAction *pam) { if (pam && pam->callback) pam->callback(pam); diff --git a/pidgin/gtkidle.c b/pidgin/gtkidle.c index f5cf624b97..51d821f66f 100644 --- a/pidgin/gtkidle.c +++ b/pidgin/gtkidle.c @@ -107,14 +107,16 @@ pidgin_get_time_idle(void) int event_base, error_base; if (has_extension == -1) - has_extension = XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base); + has_extension = XScreenSaverQueryExtension(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), + &event_base, &error_base); if (has_extension) { if (mit_info == NULL) mit_info = XScreenSaverAllocInfo(); - XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info); + XScreenSaverQueryInfo(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), + GDK_ROOT_WINDOW(), mit_info); return (mit_info->idle) / 1000; } else diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 73acb45007..3aac3e1685 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -410,7 +410,7 @@ static void gtk_imhtml_size_allocate(GtkWidget *widget, GtkAllocation *alloc) /* Don't scroll here if we're in the middle of a smooth scroll */ if (scroll && imhtml->scroll_time == NULL && - GTK_WIDGET_REALIZED(imhtml)) + gtk_widget_get_realized(GTK_WIDGET(imhtml))) gtk_imhtml_scroll_to_end(imhtml, FALSE); } @@ -499,18 +499,22 @@ static gint gtk_imhtml_tip_paint (GtkIMHtml *imhtml) { PangoLayout *layout; + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(imhtml->tip_window)); g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); layout = gtk_widget_create_pango_layout(imhtml->tip_window, imhtml->tip); - gtk_paint_flat_box (imhtml->tip_window->style, imhtml->tip_window->window, - GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, imhtml->tip_window, + gtk_paint_flat_box (gtk_widget_get_style(imhtml->tip_window), + cr, + GTK_STATE_NORMAL, GTK_SHADOW_OUT, imhtml->tip_window, "tooltip", 0, 0, -1, -1); - gtk_paint_layout (imhtml->tip_window->style, imhtml->tip_window->window, GTK_STATE_NORMAL, - FALSE, NULL, imhtml->tip_window, NULL, 4, 4, layout); + gtk_paint_layout (gtk_widget_get_style(imhtml->tip_window), + cr, + GTK_STATE_NORMAL, TRUE, imhtml->tip_window, NULL, 4, 4, layout); + cairo_destroy(cr); g_object_unref(layout); return FALSE; } @@ -522,12 +526,15 @@ gtk_imhtml_tip (gpointer data) PangoFontMetrics *font_metrics; PangoLayout *layout; PangoFont *font; - + GtkStyle *style = gtk_widget_get_style(imhtml->tip_window); + GtkAllocation allocation; gint gap, x, y, h, w, scr_w, baseline_skip; g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); - if (!imhtml->tip || !GTK_WIDGET_DRAWABLE (GTK_WIDGET(imhtml))) { + gtk_widget_get_allocation(GTK_WIDGET(imhtml), &allocation); + + if (!imhtml->tip || !gtk_widget_is_drawable(GTK_WIDGET(imhtml))) { imhtml->tip_timer = 0; return FALSE; } @@ -551,11 +558,10 @@ gtk_imhtml_tip (gpointer data) gtk_widget_ensure_style (imhtml->tip_window); layout = gtk_widget_create_pango_layout(imhtml->tip_window, imhtml->tip); font = pango_context_load_font(pango_layout_get_context(layout), - imhtml->tip_window->style->font_desc); + style->font_desc); if (font == NULL) { - char *tmp = pango_font_description_to_string( - imhtml->tip_window->style->font_desc); + char *tmp = pango_font_description_to_string(style->font_desc); purple_debug(PURPLE_DEBUG_ERROR, "gtk_imhtml_tip", "pango_context_load_font() couldn't load font: '%s'\n", @@ -580,8 +586,8 @@ gtk_imhtml_tip (gpointer data) h = 8 + baseline_skip; gdk_window_get_pointer (NULL, &x, &y, NULL); - if (GTK_WIDGET_NO_WINDOW (GTK_WIDGET(imhtml))) - y += GTK_WIDGET(imhtml)->allocation.y; + if ((!gtk_widget_get_has_window(GTK_WIDGET(imhtml)))) + y += allocation.y; scr_w = gdk_screen_width(); @@ -621,7 +627,7 @@ gtk_motion_event_notify(GtkWidget *imhtml, GdkEventMotion *event, gpointer data) oldprelit_tag = GTK_IMHTML(imhtml)->prelit_tag; - gdk_window_get_pointer(GTK_WIDGET(imhtml)->window, NULL, NULL, NULL); + gdk_window_get_pointer(gtk_widget_get_window(GTK_WIDGET(imhtml)), NULL, NULL, NULL); gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(imhtml), GTK_TEXT_WINDOW_WIDGET, event->x, event->y, &x, &y); gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(imhtml), &iter, x, y); @@ -749,6 +755,8 @@ gtk_leave_event_notify(GtkWidget *imhtml, GdkEventCrossing *event, gpointer data return FALSE; } +/* TODO: I think this can be removed for GTK+ 3.0... */ +#if 0 static gint gtk_imhtml_expose_event (GtkWidget *widget, GdkEventExpose *event) @@ -776,7 +784,8 @@ gtk_imhtml_expose_event (GtkWidget *widget, gdk_color_parse(GTK_IMHTML(widget)->edit.background, &gcolor); gdk_cairo_set_source_color(cr, &gcolor); } else { - gdk_cairo_set_source_color(cr, &(widget->style->base[GTK_WIDGET_STATE(widget)])); + gdk_cairo_set_source_color(cr, + &(gtk_widget_get_style(widget)->base[gtk_widget_get_state(widget)])); } cairo_rectangle(cr, @@ -882,6 +891,7 @@ gtk_imhtml_expose_event (GtkWidget *widget, return FALSE; } +#endif static void paste_unformatted_cb(GtkMenuItem *menu, GtkIMHtml *imhtml) @@ -1158,11 +1168,12 @@ static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *select { char *text; GtkIMHtml *imhtml = data; - + gint length = gtk_selection_data_get_length(selection_data); + if (!gtk_text_view_get_editable(GTK_TEXT_VIEW(imhtml))) return; - if (imhtml->wbfo || selection_data->length <= 0) { + if (imhtml->wbfo || length <= 0) { gtk_clipboard_request_text(clipboard, paste_plaintext_received_cb, imhtml); return; } else { @@ -1186,13 +1197,13 @@ static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *select } #endif - text = g_malloc(selection_data->length + 1); - memcpy(text, selection_data->data, selection_data->length); + text = g_malloc(length + 1); + memcpy(text, gtk_selection_data_get_data(selection_data), length); /* Make sure the paste data is null-terminated. Given that * we're passed length (but assume later that it is * null-terminated), this seems sensible to me. */ - text[selection_data->length] = '\0'; + text[length] = '\0'; } #ifdef _WIN32 @@ -1203,10 +1214,10 @@ static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *select } #endif - if (selection_data->length >= 2 && + if (length >= 2 && (*(guint16 *)text == 0xfeff || *(guint16 *)text == 0xfffe)) { /* This is UTF-16 */ - char *utf8 = utf16_to_utf8_with_bom_check(text, selection_data->length); + char *utf8 = utf16_to_utf8_with_bom_check(text, length); g_free(text); text = utf8; if (!text) { @@ -1567,7 +1578,8 @@ static void gtk_imhtml_class_init (GtkIMHtmlClass *klass) gobject_class->finalize = gtk_imhtml_finalize; widget_class->drag_motion = gtk_text_view_drag_motion; - widget_class->expose_event = gtk_imhtml_expose_event; + /* TODO: I _think_ this should be removed for GTK+ 3.0 */ + /*widget_class->expose_event = gtk_imhtml_expose_event;*/ parent_size_allocate = widget_class->size_allocate; widget_class->size_allocate = gtk_imhtml_size_allocate; parent_style_set = widget_class->style_set; @@ -1629,20 +1641,20 @@ static void gtk_imhtml_class_init (GtkIMHtmlClass *klass) TRUE, G_PARAM_READABLE)); binding_set = gtk_binding_set_by_class (parent_class); - gtk_binding_entry_add_signal (binding_set, GDK_b, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_BOLD); - gtk_binding_entry_add_signal (binding_set, GDK_i, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_ITALIC); - gtk_binding_entry_add_signal (binding_set, GDK_u, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_UNDERLINE); - gtk_binding_entry_add_signal (binding_set, GDK_plus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW); - gtk_binding_entry_add_signal (binding_set, GDK_equal, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW); - gtk_binding_entry_add_signal (binding_set, GDK_minus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_SHRINK); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_b, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_BOLD); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_i, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_ITALIC); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_u, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_UNDERLINE); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_plus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_equal, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_minus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_SHRINK); binding_set = gtk_binding_set_by_class(klass); - gtk_binding_entry_add_signal (binding_set, GDK_r, GDK_CONTROL_MASK, "format_function_clear", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "message_send", 0); - gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "message_send", 0); - gtk_binding_entry_add_signal (binding_set, GDK_z, GDK_CONTROL_MASK, "undo", 0); - gtk_binding_entry_add_signal (binding_set, GDK_z, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "redo", 0); - gtk_binding_entry_add_signal (binding_set, GDK_F14, 0, "undo", 0); - gtk_binding_entry_add_signal(binding_set, GDK_v, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "paste", 1, G_TYPE_STRING, "text"); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_r, GDK_CONTROL_MASK, "format_function_clear", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Enter, 0, "message_send", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Return, 0, "message_send", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_z, GDK_CONTROL_MASK, "undo", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_z, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "redo", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_F14, 0, "undo", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_v, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "paste", 1, G_TYPE_STRING, "text"); } static void gtk_imhtml_init (GtkIMHtml *imhtml) @@ -1869,13 +1881,13 @@ gtk_text_view_drag_motion (GtkWidget *widget, /* can't accept any of the offered targets */ } else { GtkWidget *source_widget; - suggested_action = context->suggested_action; + suggested_action = gdk_drag_context_get_suggested_action(context); source_widget = gtk_drag_get_source_widget (context); if (source_widget == widget) { /* Default to MOVE, unless the user has * pressed ctrl or alt to affect available actions */ - if ((context->actions & GDK_ACTION_MOVE) != 0) + if ((gdk_drag_context_get_actions(context) & GDK_ACTION_MOVE) != 0) suggested_action = GDK_ACTION_MOVE; } } @@ -1907,20 +1919,21 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guin { gchar **links; gchar *link; - char *text = (char *)sd->data; + char *text = (char *) gtk_selection_data_get_data(sd); GtkTextMark *mark = gtk_text_buffer_get_insert(imhtml->text_buffer); GtkTextIter iter; gint i = 0; + gint length = gtk_selection_data_get_length(sd); gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark); - if(gtk_imhtml_get_editable(imhtml) && sd->data){ + if(gtk_imhtml_get_editable(imhtml) && text){ switch (info) { case GTK_IMHTML_DRAG_URL: /* TODO: Is it really ok to change sd->data...? */ - purple_str_strip_char((char *)sd->data, '\r'); + purple_str_strip_char(text, '\r'); - links = g_strsplit((char *)sd->data, "\n", 0); + links = g_strsplit(text, "\n", 0); while((link = links[i]) != NULL){ if (gtk_imhtml_is_protocol(link)) { gchar *label; @@ -1959,8 +1972,8 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guin * See also the comment on text/html here: * http://mail.gnome.org/archives/gtk-devel-list/2001-September/msg00114.html */ - if (sd->length >= 2 && !g_utf8_validate(text, sd->length - 1, NULL)) { - utf8 = utf16_to_utf8_with_bom_check(text, sd->length); + if (length >= 2 && !g_utf8_validate(text, length - 1, NULL)) { + utf8 = utf16_to_utf8_with_bom_check(text, length); if (!utf8) { purple_debug_warning("gtkimhtml", "g_convert from UTF-16 failed in drag_rcv_cb\n"); @@ -1989,7 +2002,8 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guin gtk_drag_finish(dc, FALSE, FALSE, t); return; } - gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, + (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); } else { gtk_drag_finish(dc, FALSE, FALSE, t); } @@ -2520,8 +2534,8 @@ void gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, static gboolean smooth_scroll_cb(gpointer data) { GtkIMHtml *imhtml = data; - GtkAdjustment *adj = GTK_TEXT_VIEW(imhtml)->vadjustment; - gdouble max_val = adj->upper - adj->page_size; + GtkAdjustment *adj = gtk_text_view_get_vadjustment(GTK_TEXT_VIEW(imhtml)); + gdouble max_val = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj); gdouble scroll_val = gtk_adjustment_get_value(adj) + ((max_val - gtk_adjustment_get_value(adj)) / 3); g_return_val_if_fail(imhtml->scroll_time != NULL, FALSE); @@ -2544,9 +2558,10 @@ static gboolean smooth_scroll_cb(gpointer data) static gboolean scroll_idle_cb(gpointer data) { GtkIMHtml *imhtml = data; - GtkAdjustment *adj = GTK_TEXT_VIEW(imhtml)->vadjustment; + GtkAdjustment *adj = gtk_text_view_get_vadjustment(GTK_TEXT_VIEW(imhtml)); if(adj) { - gtk_adjustment_set_value(adj, adj->upper - adj->page_size); + gtk_adjustment_set_value(adj, gtk_adjustment_get_upper(adj) - + gtk_adjustment_get_page_size(adj)); } imhtml->scroll_src = 0; return FALSE; @@ -4186,9 +4201,14 @@ static void remove_tag_by_prefix(GtkIMHtml *imhtml, const GtkTextIter *i, const for (l = tags; l; l = l->next) { GtkTextTag *tag = l->data; + gchar *name; - if (tag->name && !strncmp(tag->name, prefix, len)) + g_object_get(G_OBJECT(tag), "name", &name, NULL); + + if (name && !strncmp(name, prefix, len)) gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, i, e); + + g_free(name); } g_slist_free(tags); @@ -4204,10 +4224,15 @@ static void remove_tag_by_prefix(GtkIMHtml *imhtml, const GtkTextIter *i, const for (l = tags; l; l = l->next) { GtkTextTag *tag = l->data; + gchar *name; + + g_object_get(G_OBJECT(tag), "name", &name, NULL); - if (tag->name && !strncmp(tag->name, prefix, len)) + if (name && !strncmp(name, prefix, len)) gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, &iter, e); - } + + g_free(name); + } g_slist_free(tags); } @@ -4327,11 +4352,16 @@ static void delete_cb(GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *en gtk_text_iter_begins_tag(start, tag) && /* the tag starts with the selection */ (!gtk_text_iter_has_tag(end, tag) || /* the tag ends within the selection */ gtk_text_iter_ends_tag(end, tag))) { + gchar *name; + + g_object_get(G_OBJECT(tag), "name", &name, NULL); gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, start, end); - if (tag->name && - strncmp(tag->name, "LINK ", 5) == 0 && imhtml->edit.link) { + + if (name && strncmp(name, "LINK ", 5) == 0 && imhtml->edit.link) { gtk_imhtml_toggle_link(imhtml, NULL); } + + g_free(name); } } g_slist_free(tags); @@ -4553,27 +4583,32 @@ static void mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *arg1, GtkTextMark *m for (l = tags; l != NULL; l = l->next) { GtkTextTag *tag = GTK_TEXT_TAG(l->data); + gchar *name; - if (tag->name) { - if (strcmp(tag->name, "BOLD") == 0) + g_object_get(G_OBJECT(tag), "name", &name, NULL); + + if (name) { + if (strcmp(name, "BOLD") == 0) imhtml->edit.bold = TRUE; - else if (strcmp(tag->name, "ITALICS") == 0) + else if (strcmp(name, "ITALICS") == 0) imhtml->edit.italic = TRUE; - else if (strcmp(tag->name, "UNDERLINE") == 0) + else if (strcmp(name, "UNDERLINE") == 0) imhtml->edit.underline = TRUE; - else if (strcmp(tag->name, "STRIKE") == 0) + else if (strcmp(name, "STRIKE") == 0) imhtml->edit.strike = TRUE; - else if (strncmp(tag->name, "FORECOLOR ", 10) == 0) - imhtml->edit.forecolor = g_strdup(&(tag->name)[10]); - else if (strncmp(tag->name, "BACKCOLOR ", 10) == 0) - imhtml->edit.backcolor = g_strdup(&(tag->name)[10]); - else if (strncmp(tag->name, "FONT FACE ", 10) == 0) - imhtml->edit.fontface = g_strdup(&(tag->name)[10]); - else if (strncmp(tag->name, "FONT SIZE ", 10) == 0) - imhtml->edit.fontsize = strtol(&(tag->name)[10], NULL, 10); - else if ((strncmp(tag->name, "LINK ", 5) == 0) && !gtk_text_iter_is_end(&iter)) + else if (strncmp(name, "FORECOLOR ", 10) == 0) + imhtml->edit.forecolor = g_strdup(&(name)[10]); + else if (strncmp(name, "BACKCOLOR ", 10) == 0) + imhtml->edit.backcolor = g_strdup(&(name)[10]); + else if (strncmp(name, "FONT FACE ", 10) == 0) + imhtml->edit.fontface = g_strdup(&(name)[10]); + else if (strncmp(name, "FONT SIZE ", 10) == 0) + imhtml->edit.fontsize = strtol(&(name)[10], NULL, 10); + else if ((strncmp(name, "LINK ", 5) == 0) && !gtk_text_iter_is_end(&iter)) imhtml->edit.link = tag; } + + g_free(name); } g_slist_free(tags); @@ -4864,6 +4899,8 @@ void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley) gtk_text_buffer_end_user_action(imhtml->text_buffer); } +/* TODO: I think this can be removed for GTK+ 3.0... */ +#if 0 static gboolean image_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { @@ -4871,9 +4908,10 @@ image_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) return TRUE; } +#endif /* In case the smiley gets removed from the imhtml before it gets removed from the queue */ -static void animated_smiley_destroy_cb(GtkObject *widget, GtkIMHtml *imhtml) +static void animated_smiley_destroy_cb(GtkWidget *widget, GtkIMHtml *imhtml) { GList *l = imhtml->animations->head; while (l) { @@ -4966,8 +5004,10 @@ void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char * * images, and ensures that they are handled by the image * itself, without propagating to the textview and causing * a complete refresh */ + /* TODO: I think this should be removed for GTK+ 3.0? g_signal_connect(G_OBJECT(icon), "expose-event", G_CALLBACK(image_expose), NULL); - + */ + gtk_widget_show(icon); if (ebox) gtk_container_add(GTK_CONTAINER(ebox), icon); @@ -5068,23 +5108,30 @@ void gtk_imhtml_insert_image_at_iter(GtkIMHtml *imhtml, int id, GtkTextIter *ite static const gchar *tag_to_html_start(GtkTextTag *tag) { - const gchar *name; static gchar buf[1024]; + gchar *name; - name = tag->name; + g_object_get(G_OBJECT(tag), "name", &name, NULL); g_return_val_if_fail(name != NULL, ""); if (strcmp(name, "BOLD") == 0) { + g_free(name); return ""; } else if (strcmp(name, "ITALICS") == 0) { + g_free(name); return ""; } else if (strcmp(name, "UNDERLINE") == 0) { - return ""; + g_free(name); + return ""; } else if (strcmp(name, "STRIKE") == 0) { - return ""; + g_free(name); + return ""; } else if (strncmp(name, "LINK ", 5) == 0) { char *tmp = g_object_get_data(G_OBJECT(tag), "link_url"); - if (tmp) { + + g_free(name); + + if (tmp) { g_snprintf(buf, sizeof(buf), "", tmp); buf[sizeof(buf)-1] = '\0'; return buf; @@ -5093,19 +5140,30 @@ static const gchar *tag_to_html_start(GtkTextTag *tag) } } else if (strncmp(name, "FORECOLOR ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - return buf; + + g_free(name); + + return buf; } else if (strncmp(name, "BACKCOLOR ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - return buf; + g_free(name); + + return buf; } else if (strncmp(name, "BACKGROUND ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[11]); - return buf; + g_free(name); + + return buf; } else if (strncmp(name, "FONT FACE ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - return buf; + g_free(name); + + return buf; } else if (strncmp(name, "FONT SIZE ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - return buf; + g_free(name); + + return buf; } else { char *str = buf; gboolean isset; @@ -5167,38 +5225,49 @@ static const gchar *tag_to_html_start(GtkTextTag *tag) } g_snprintf(str, sizeof(buf) - (str - buf), "'>"); - + g_free(name); + return (empty ? "" : buf); } } static const gchar *tag_to_html_end(GtkTextTag *tag) { - const gchar *name; + gchar *name; - name = tag->name; + g_object_get(G_OBJECT(tag), "name", &name, NULL); g_return_val_if_fail(name != NULL, ""); if (strcmp(name, "BOLD") == 0) { + g_free(name); return ""; } else if (strcmp(name, "ITALICS") == 0) { - return ""; + g_free(name); + return ""; } else if (strcmp(name, "UNDERLINE") == 0) { - return ""; + g_free(name); + return ""; } else if (strcmp(name, "STRIKE") == 0) { - return ""; + g_free(name); + return ""; } else if (strncmp(name, "LINK ", 5) == 0) { - return ""; + g_free(name); + return ""; } else if (strncmp(name, "FORECOLOR ", 10) == 0) { - return ""; + g_free(name); + return ""; } else if (strncmp(name, "BACKCOLOR ", 10) == 0) { - return ""; + g_free(name); + return ""; } else if (strncmp(name, "BACKGROUND ", 10) == 0) { - return ""; + g_free(name); + return ""; } else if (strncmp(name, "FONT FACE ", 10) == 0) { - return ""; + g_free(name); + return ""; } else if (strncmp(name, "FONT SIZE ", 10) == 0) { - return ""; + g_free(name); + return ""; } else { const char *props[] = {"weight-set", "foreground-set", "background-set", "size-set", "underline-set", NULL}; @@ -5210,6 +5279,8 @@ static const gchar *tag_to_html_end(GtkTextTag *tag) return ""; } + g_free(name); + return ""; } } diff --git a/pidgin/gtkimhtmltoolbar.c b/pidgin/gtkimhtmltoolbar.c index 8a2607fbdf..dedfbbfc27 100644 --- a/pidgin/gtkimhtmltoolbar.c +++ b/pidgin/gtkimhtmltoolbar.c @@ -124,11 +124,15 @@ realize_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) { GtkFontSelection *sel; - sel = GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->fontsel); - gtk_widget_hide_all(gtk_widget_get_parent(sel->size_entry)); - gtk_widget_show_all(sel->family_list); - gtk_widget_show(gtk_widget_get_parent(sel->family_list)); - gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent(sel->family_list))); + sel = GTK_FONT_SELECTION( + gtk_font_selection_dialog_get_font_selection(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))); + gtk_widget_hide(gtk_widget_get_parent( + gtk_font_selection_get_size_entry(sel))); + gtk_widget_show_all(gtk_font_selection_get_family_list(sel)); + gtk_widget_show(gtk_widget_get_parent( + gtk_font_selection_get_family_list(sel))); + gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent( + gtk_font_selection_get_family_list(sel)))); } static void @@ -191,10 +195,12 @@ toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar) g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event", G_CALLBACK(destroy_toolbar_font), toolbar); - g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->ok_button), "clicked", - G_CALLBACK(apply_font), toolbar->font_dialog); - g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->cancel_button), "clicked", - G_CALLBACK(cancel_toolbar_font), toolbar); + g_signal_connect(G_OBJECT( + gtk_font_selection_dialog_get_ok_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), + "clicked", G_CALLBACK(apply_font), toolbar->font_dialog); + g_signal_connect(G_OBJECT( + gtk_font_selection_dialog_get_cancel_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), + "clicked", G_CALLBACK(cancel_toolbar_font), toolbar); g_signal_connect_after(G_OBJECT(toolbar->font_dialog), "realize", G_CALLBACK(realize_toolbar_font), toolbar); } @@ -253,9 +259,12 @@ toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) char *color = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml)); if (!toolbar->fgcolor_dialog) { - + GtkWidget *ok_button; + GtkWidget *cancel_button; + toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); - colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel; + colorsel = + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); if (color) { gdk_color_parse(color, &fgcolor); gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor); @@ -264,12 +273,14 @@ toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); + g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "ok-button", &ok_button, NULL); + g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "cancel-button", + &cancel_button, NULL); g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event", G_CALLBACK(destroy_toolbar_fgcolor), toolbar); - g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->ok_button), "clicked", - G_CALLBACK(do_fgcolor), colorsel); - g_signal_connect(G_OBJECT (GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->cancel_button), "clicked", - G_CALLBACK(cancel_toolbar_fgcolor), toolbar); + g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(do_fgcolor), colorsel); + g_signal_connect(G_OBJECT(cancel_button), "clicked", + G_CALLBACK(cancel_toolbar_fgcolor), toolbar); } gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog)); } else { @@ -333,10 +344,14 @@ toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) char *color = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml)); if (!toolbar->bgcolor_dialog) { - + GtkWidget *ok_button; + GtkWidget *cancel_button; + toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); - colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel; - if (color) { + colorsel = + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); + + if (color) { gdk_color_parse(color, &bgcolor); gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor); g_free(color); @@ -344,11 +359,14 @@ toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); + g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "ok-button", &ok_button, NULL); + g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "cancel-button", + &cancel_button, NULL); g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event", G_CALLBACK(destroy_toolbar_bgcolor), toolbar); - g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->ok_button), "clicked", - G_CALLBACK(do_bgcolor), colorsel); - g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->cancel_button), "clicked", + g_signal_connect(G_OBJECT(ok_button), "clicked", + G_CALLBACK(do_bgcolor), colorsel); + g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(cancel_toolbar_bgcolor), toolbar); } @@ -722,7 +740,7 @@ smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) static gboolean smiley_dialog_input_cb(GtkWidget *dialog, GdkEvent *event, GtkIMHtmlToolbar *toolbar) { - if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_Escape) || + if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Escape) || (event->type == GDK_BUTTON_PRESS && event->button.button == 1)) { close_smiley_dialog(toolbar); @@ -1095,19 +1113,21 @@ menu_position_func (GtkMenu *menu, { GtkWidget *widget = GTK_WIDGET(data); GtkRequisition menu_req; - gint ythickness = widget->style->ythickness; + GtkAllocation allocation; + gint ythickness = gtk_widget_get_style(widget)->ythickness; int savy; + gtk_widget_get_allocation(widget, &allocation); gtk_widget_size_request(GTK_WIDGET (menu), &menu_req); - gdk_window_get_origin(widget->window, x, y); - *x += widget->allocation.x; - *y += widget->allocation.y + widget->allocation.height; + gdk_window_get_origin(gtk_widget_get_window(widget), x, y); + *x += allocation.x; + *y += allocation.y + allocation.height; savy = *y; pidgin_menu_position_func_helper(menu, x, y, push_in, data); if (savy > *y + ythickness + 1) - *y -= widget->allocation.height; + *y -= allocation.height; } static gboolean @@ -1199,7 +1219,7 @@ gtk_imhtmltoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, GtkIMHtml if (event->button != 3) return FALSE; - wide = GTK_WIDGET_VISIBLE(toolbar->bold); + wide = gtk_widget_get_visible(toolbar->bold); menu = gtk_menu_new(); item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items")); @@ -1294,7 +1314,7 @@ static void gtk_imhtmltoolbar_create_old_buttons(GtkIMHtmlToolbar *toolbar) static void button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) { - if (GTK_WIDGET_VISIBLE(button)) + if (gtk_widget_get_visible(button)) gtk_widget_hide(item); else gtk_widget_show(item); @@ -1303,7 +1323,7 @@ button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) static void button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) { - gtk_widget_set_sensitive(item, GTK_WIDGET_IS_SENSITIVE(button)); + gtk_widget_set_sensitive(item, gtk_widget_get_sensitive(button)); } static void @@ -1326,10 +1346,10 @@ imhtmltoolbar_view_pref_changed(const char *name, PurplePrefType type, gconstpointer value, gpointer toolbar) { if (value) { - gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); + gtk_widget_hide(g_object_get_data(G_OBJECT(toolbar), "lean-view")); gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); } else { - gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); + gtk_widget_hide(g_object_get_data(G_OBJECT(toolbar), "wide-view")); gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); } } diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c index 676d6363d5..d4e45da21d 100644 --- a/pidgin/gtklog.c +++ b/pidgin/gtklog.c @@ -582,8 +582,10 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_dialog_add_button(GTK_DIALOG(lv->window), _("_Browse logs folder"), GTK_RESPONSE_HELP); #endif gtk_container_set_border_width (GTK_CONTAINER(lv->window), PIDGIN_HIG_BOX_SPACE); - gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE); - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(lv->window)->vbox), 0); + /* TODO: is it possible to set this in GTK+ 3.0? + gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE); + */ + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), 0); g_signal_connect(G_OBJECT(lv->window), "response", G_CALLBACK(destroy_cb), ht); gtk_window_set_role(GTK_WINDOW(lv->window), "log_viewer"); @@ -592,11 +594,12 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * if (icon != NULL) { title_box = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); gtk_container_set_border_width(GTK_CONTAINER(title_box), PIDGIN_HIG_BOX_SPACE); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), title_box, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), + title_box, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(title_box), icon, FALSE, FALSE, 0); } else - title_box = GTK_DIALOG(lv->window)->vbox; + title_box = gtk_dialog_get_content_area(GTK_DIALOG(lv->window)); /* Label ************/ lv->label = gtk_label_new(NULL); @@ -611,7 +614,8 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * /* Pane *************/ pane = gtk_hpaned_new(); gtk_container_set_border_width(GTK_CONTAINER(pane), PIDGIN_HIG_BOX_SPACE); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), pane, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), + pane, TRUE, TRUE, 0); /* List *************/ sw = gtk_scrolled_window_new (NULL, NULL); @@ -649,7 +653,8 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_label_set_markup(GTK_LABEL(size_label), text); /* gtk_paned_add1(GTK_PANED(pane), size_label); */ gtk_misc_set_alignment(GTK_MISC(size_label), 0, 0); - gtk_box_pack_end(GTK_BOX(GTK_DIALOG(lv->window)->vbox), size_label, FALSE, FALSE, 0); + gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), + size_label, FALSE, FALSE, 0); g_free(sz_txt); g_free(text); } diff --git a/pidgin/gtkmain.c b/pidgin/gtkmain.c index f0deb0c81f..8a2c40d079 100644 --- a/pidgin/gtkmain.c +++ b/pidgin/gtkmain.c @@ -490,7 +490,7 @@ startup_notification_complete(void) { Display *xdisplay; - xdisplay = GDK_DISPLAY(); + xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); sn_display = sn_display_new(xdisplay, sn_error_trap_push, sn_error_trap_pop); diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c index 23287a0cec..bf4f24e32f 100644 --- a/pidgin/gtkmedia.c +++ b/pidgin/gtkmedia.c @@ -442,9 +442,9 @@ realize_cb_cb(PidginMediaRealizeData *data) window_id = GDK_WINDOW_HWND(priv->remote_video->window); #elif defined(HAVE_X11) if (data->participant == NULL) - window_id = GDK_WINDOW_XWINDOW(priv->local_video->window); + window_id = GDK_WINDOW_XWINDOW(gtk_widget_get_window(priv->local_video)); else - window_id = GDK_WINDOW_XWINDOW(priv->remote_video->window); + window_id = GDK_WINDOW_XWINDOW(gtk_widget_get_window(priv->remote_video)); #else # error "Unsupported windowing system" #endif diff --git a/pidgin/gtkmenutray.c b/pidgin/gtkmenutray.c index be3f8552f7..5da4a97821 100644 --- a/pidgin/gtkmenutray.c +++ b/pidgin/gtkmenutray.c @@ -44,7 +44,7 @@ static GObjectClass *parent_class = NULL; * Item Stuff *****************************************************************************/ static void -pidgin_menu_tray_select(GtkItem *item) { +pidgin_menu_tray_select(GtkMenuItem *widget) { /* this may look like nothing, but it's really overriding the * GtkMenuItem's select function so that it doesn't get highlighted like * a normal menu item would. @@ -52,7 +52,7 @@ pidgin_menu_tray_select(GtkItem *item) { } static void -pidgin_menu_tray_deselect(GtkItem *item) { +pidgin_menu_tray_deselect(GtkMenuItem *widget) { /* Probably not necessary, but I'd rather be safe than sorry. We're * overridding the select, so it makes sense to override deselect as well. */ @@ -116,7 +116,7 @@ pidgin_menu_tray_finalize(GObject *obj) static void pidgin_menu_tray_class_init(PidginMenuTrayClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); - GtkItemClass *item_class = GTK_ITEM_CLASS(klass); + GtkMenuItemClass *menu_item_class = GTK_MENU_ITEM_CLASS(klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); GParamSpec *pspec; @@ -125,8 +125,8 @@ pidgin_menu_tray_class_init(PidginMenuTrayClass *klass) { object_class->finalize = pidgin_menu_tray_finalize; object_class->get_property = pidgin_menu_tray_get_property; - item_class->select = pidgin_menu_tray_select; - item_class->deselect = pidgin_menu_tray_deselect; + menu_item_class->select = pidgin_menu_tray_select; + menu_item_class->deselect = pidgin_menu_tray_deselect; widget_class->map = pidgin_menu_tray_map; @@ -207,7 +207,7 @@ pidgin_menu_tray_add(PidginMenuTray *menu_tray, GtkWidget *widget, g_return_if_fail(PIDGIN_IS_MENU_TRAY(menu_tray)); g_return_if_fail(GTK_IS_WIDGET(widget)); - if (GTK_WIDGET_NO_WINDOW(widget)) + if (!gtk_widget_get_has_window(widget)) { GtkWidget *event; @@ -254,8 +254,8 @@ pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const * case, we want to set the tooltip on the widget's parent, * not on the widget itself. */ - if (GTK_WIDGET_NO_WINDOW(widget)) - widget = widget->parent; + if (!gtk_widget_get_has_window(widget)) + widget = gtk_widget_get_parent(widget); #if GTK_CHECK_VERSION(2,12,0) gtk_widget_set_tooltip_text(widget, tooltip); diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 83884fbbb1..81ffe340a1 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -534,12 +534,18 @@ pidgin_notify_message(PurpleNotifyMsgType type, const char *title, gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); + /* TODO: not sure if there is a way to do this in gtk+ 3, or + if we want to... gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); - gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BOX_SPACE); + */ + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BORDER); + gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BOX_SPACE); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + hbox); if (img != NULL) gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); @@ -775,7 +781,7 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, } } - if (!GTK_WIDGET_VISIBLE(mail_dialog->dialog)) { + if (!gtk_widget_get_visible(mail_dialog->dialog)) { GdkPixbuf *pixbuf = gtk_widget_render_icon(mail_dialog->dialog, PIDGIN_STOCK_DIALOG_MAIL, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), NULL); char *label_text = g_strdup_printf(ngettext("%d new email.", @@ -791,7 +797,7 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, g_free(label_text); if (pixbuf) g_object_unref(pixbuf); - } else if (!GTK_WIDGET_HAS_FOCUS(mail_dialog->dialog)) + } else if (!gtk_widget_has_focus(mail_dialog->dialog)) pidgin_set_urgent(GTK_WINDOW(mail_dialog->dialog), TRUE); return data; @@ -800,7 +806,7 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, static gboolean formatted_input_cb(GtkWidget *win, GdkEventKey *event, gpointer data) { - if (event->keyval == GDK_Escape) + if (event->keyval == GDK_KEY_Escape) { purple_notify_close(PURPLE_NOTIFY_FORMATTED, win); @@ -847,7 +853,7 @@ pidgin_notify_formatted(const char *title, const char *primary, G_CALLBACK(formatted_close_cb), NULL); /* Setup the main vbox */ - vbox = GTK_DIALOG(window)->vbox; + vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); /* Setup the descriptive label */ primary_esc = g_markup_escape_text(primary, -1); @@ -978,7 +984,7 @@ pidgin_notify_searchresults(PurpleConnection *gc, const char *title, G_CALLBACK(searchresults_close_cb), data); /* Setup the main vbox */ - vbox = GTK_DIALOG(window)->vbox; + vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); /* Setup the descriptive label */ primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; @@ -1516,12 +1522,16 @@ pidgin_create_notification_dialog(PidginNotifyType type) /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BOX_SPACE); - gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BOX_SPACE); + gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BOX_SPACE); + /* TODO: not sure if this is possible (or nessesary) in gtk+ 3 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); + */ + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BORDER); /* Vertical box */ - vbox = GTK_DIALOG(dialog)->vbox; + vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); /* Golden ratio it up! */ gtk_widget_set_size_request(dialog, 550, 400); diff --git a/pidgin/gtkplugin.c b/pidgin/gtkplugin.c index c47a0cd125..ff82805fcd 100644 --- a/pidgin/gtkplugin.c +++ b/pidgin/gtkplugin.c @@ -518,7 +518,7 @@ static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelecti break; dialog = gtk_dialog_new_with_buttons(PIDGIN_ALERT_TITLE, GTK_WINDOW(d), - GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); if (plugin_pref_dialogs == NULL) @@ -527,7 +527,7 @@ static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelecti g_hash_table_insert(plugin_pref_dialogs, plug, dialog); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(pref_dialog_response_cb), plug); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), box); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), box); gtk_window_set_role(GTK_WINDOW(dialog), "plugin_config"); gtk_window_set_title(GTK_WINDOW(dialog), _(purple_plugin_get_name(plug))); gtk_widget_show_all(dialog); @@ -562,10 +562,13 @@ static gboolean pidgin_plugins_paint_tooltip(GtkWidget *tipwindow, gpointer data) { PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); - gtk_paint_layout(tipwindow->style, tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, tipwindow, "tooltip", + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(tipwindow))); + gtk_paint_layout(gtk_widget_get_style(tipwindow), cr, GTK_STATE_NORMAL, FALSE, + tipwindow, "tooltip", 6, 6, layout); - return TRUE; + cairo_destroy(cr); + + return TRUE; } static gboolean @@ -720,8 +723,9 @@ void pidgin_plugin_dialog_show() plugin_dialog = gtk_dialog_new_with_buttons(_("Plugins"), NULL, - GTK_DIALOG_NO_SEPARATOR, + 0, NULL); + pref_button = gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), _("Configure Pl_ugin"), PIDGIN_RESPONSE_CONFIGURE); gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), @@ -733,7 +737,8 @@ void pidgin_plugin_dialog_show() gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), sw, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(plugin_dialog))), + sw, TRUE, TRUE, 0); ls = gtk_list_store_new(4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), @@ -793,8 +798,8 @@ void pidgin_plugin_dialog_show() gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE); gtk_widget_set_sensitive(expander, FALSE); gtk_container_add(GTK_CONTAINER(expander), create_details()); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), expander, - FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(plugin_dialog))), + expander, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (sel), "changed", G_CALLBACK (prefs_plugin_sel), NULL); diff --git a/pidgin/gtkpounce.c b/pidgin/gtkpounce.c index fb468b4f3c..d44f8c0182 100644 --- a/pidgin/gtkpounce.c +++ b/pidgin/gtkpounce.c @@ -410,13 +410,15 @@ pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *sd, guint info, guint t, gpointer data) { PidginPounceDialog *dialog; - - if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) + GdkAtom target = gtk_selection_data_get_target(sd); + const guchar *sd_data = gtk_selection_data_get_data(sd); + + if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { PurpleBlistNode *node = NULL; PurpleBuddy *buddy; - memcpy(&node, sd->data, sizeof(node)); + memcpy(&node, sd_data, sizeof(node)); if (PURPLE_BLIST_NODE_IS_CONTACT(node)) buddy = purple_contact_get_priority_buddy((PurpleContact *)node); @@ -431,15 +433,15 @@ pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, dialog->account = buddy->account; pidgin_account_option_menu_set_selected(dialog->account_menu, buddy->account); - gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); } - else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) + else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) { char *protocol = NULL; char *username = NULL; PurpleAccount *account; - if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, + if (pidgin_parse_x_im_contact((const char *) sd_data, FALSE, &account, &protocol, &username, NULL)) { if (account == NULL) @@ -461,7 +463,7 @@ pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, g_free(username); g_free(protocol); - gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); } } @@ -540,7 +542,7 @@ pidgin_pounce_editor_show(PurpleAccount *account, const char *name, G_CALLBACK(delete_win_cb), dialog); /* Create the parent vbox for everything. */ - vbox1 = GTK_DIALOG(window)->vbox; + vbox1 = gtk_dialog_get_content_area(GTK_DIALOG(window)); /* Create the vbox that will contain all the prefs stuff. */ vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -1018,7 +1020,7 @@ pidgin_pounce_editor_show(PurpleAccount *account, const char *name, static gboolean pounces_manager_configure_cb(GtkWidget *widget, GdkEventConfigure *event, PouncesManager *dialog) { - if (GTK_WIDGET_VISIBLE(widget)) { + if (gtk_widget_get_visible(widget)) { purple_prefs_set_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width", event->width); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height", event->height); } diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index a8c03f2dfa..8b582fb694 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -118,7 +118,7 @@ pidgin_prefs_labeled_spin_button(GtkWidget *box, const gchar *title, const char *key, int min, int max, GtkSizeGroup *sg) { GtkWidget *spin; - GtkObject *adjust; + GtkAdjustment *adjust; int val; val = purple_prefs_get_int(key); @@ -864,9 +864,10 @@ static void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, guint info, guint t, gpointer user_data) { - gchar *name = g_strchomp((gchar *)sd->data); + gchar *name = g_strchomp((gchar *)gtk_selection_data_get_data(sd)); - if ((sd->length >= 0) && (sd->format == 8)) { + if ((gtk_selection_data_get_length(sd) >= 0) + && (gtk_selection_data_get_format(sd) == 8)) { /* Well, it looks like the drag event was cool. * Let's do something with it */ gchar *temp; @@ -2442,7 +2443,7 @@ static GtkWidget * sound_page(void) { GtkWidget *ret; - GtkWidget *vbox, *vbox2, *sw, *button; + GtkWidget *vbox, *vbox2, *sw, *button, *parent, *parent_parent, *parent_parent_parent; GtkSizeGroup *sg; GtkTreeIter iter; GtkWidget *event_view; @@ -2539,15 +2540,19 @@ sound_page(void) sound_changed2_cb, vbox); #endif vbox = pidgin_make_frame(ret, _("Sound Events")); - + parent = gtk_widget_get_parent(vbox); + parent_parent = gtk_widget_get_parent(parent); + parent_parent_parent = gtk_widget_get_parent(parent_parent); + /* The following is an ugly hack to make the frame expand so the * sound events list is big enough to be usable */ - gtk_box_set_child_packing(GTK_BOX(vbox->parent), vbox, TRUE, TRUE, 0, + gtk_box_set_child_packing(GTK_BOX(parent), vbox, TRUE, TRUE, 0, GTK_PACK_START); - gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent), vbox->parent, TRUE, - TRUE, 0, GTK_PACK_START); - gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent->parent), - vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START); + gtk_box_set_child_packing(GTK_BOX(parent_parent), + parent, TRUE, TRUE, 0, GTK_PACK_START); + gtk_box_set_child_packing( + GTK_BOX(parent_parent_parent), + parent_parent, TRUE, TRUE, 0, GTK_PACK_START); /* SOUND SELECTION */ sw = gtk_scrolled_window_new(NULL,NULL); diff --git a/pidgin/gtkprivacy.c b/pidgin/gtkprivacy.c index 369863f0dd..d7d85a69fd 100644 --- a/pidgin/gtkprivacy.c +++ b/pidgin/gtkprivacy.c @@ -243,7 +243,7 @@ type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog) gtk_widget_hide(dialog->allow_widget); gtk_widget_hide(dialog->block_widget); - gtk_widget_hide_all(dialog->button_box); + gtk_widget_hide(dialog->button_box); if (new_type == PURPLE_PRIVACY_ALLOW_USERS) { gtk_widget_show(dialog->allow_widget); @@ -371,12 +371,12 @@ privacy_dialog_new(void) dialog->account = pidgin_account_option_menu_get_selected(dropdown); /* Add the drop-down list with the allow/block types. */ - dialog->type_menu = gtk_combo_box_new_text(); + dialog->type_menu = gtk_combo_box_text_new(); gtk_box_pack_start(GTK_BOX(vbox), dialog->type_menu, FALSE, FALSE, 0); gtk_widget_show(dialog->type_menu); for (i = 0; i < menu_entry_count; i++) { - gtk_combo_box_append_text(GTK_COMBO_BOX(dialog->type_menu), + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(dialog->type_menu), _(menu_entries[i].text)); if (menu_entries[i].num == dialog->account->perm_deny) @@ -442,7 +442,7 @@ pidgin_privacy_dialog_show(void) privacy_dialog = privacy_dialog_new(); gtk_widget_show(privacy_dialog->win); - gdk_window_raise(privacy_dialog->win->window); + gdk_window_raise(gtk_widget_get_window(privacy_dialog->win)); } void diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index 5977c49fd2..df08df382c 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -105,8 +105,10 @@ pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account) #endif if (GTK_IS_DIALOG(cont)) { - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(cont)->action_area), image, FALSE, TRUE, 0); - gtk_box_reorder_child(GTK_BOX(GTK_DIALOG(cont)->action_area), image, 0); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(cont))), + image, FALSE, TRUE, 0); + gtk_box_reorder_child(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(cont))), + image, 0); } else if (GTK_IS_HBOX(cont)) { gtk_misc_set_alignment(GTK_MISC(image), 0, 0); gtk_box_pack_end(GTK_BOX(cont), image, FALSE, TRUE, 0); @@ -263,7 +265,7 @@ multifield_ok_cb(GtkWidget *button, PidginRequestData *data) { generic_response_start(data); - if (!GTK_WIDGET_HAS_FOCUS(button)) + if (!gtk_widget_has_focus(button)) gtk_widget_grab_focus(button); if (data->cbs[0] != NULL) @@ -359,16 +361,21 @@ pidgin_request_input(const char *title, const char *primary, /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); - gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2); + gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BORDER / 2); if (!multiline) gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); + /* TODO: not sure how to do this with GTK+ 3 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); + */ gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0); - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + hbox); /* Dialog icon. */ img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, @@ -536,14 +543,19 @@ pidgin_request_choice(const char *title, const char *primary, /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); - gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2); + gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BORDER / 2); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); + /* TODO: don't know if this is possible with GTK+ 3 + gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); + */ + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + hbox); /* Dialog icon. */ img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, @@ -658,14 +670,19 @@ pidgin_request_action_with_icon(const char *title, const char *primary, /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); - gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2); + gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BORDER / 2); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); + /* TODO: this is probably not supported by GTK+ 3 + gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); + */ + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + hbox); /* Dialog icon. */ if (icon_data) { @@ -736,8 +753,8 @@ pidgin_request_action_with_icon(const char *title, const char *primary, if (default_action == PURPLE_DEFAULT_ACTION_NONE) { - GTK_WIDGET_SET_FLAGS(img, GTK_CAN_DEFAULT); - GTK_WIDGET_SET_FLAGS(img, GTK_CAN_FOCUS); + gtk_widget_set_can_default(img, TRUE); + gtk_widget_set_can_focus(img, TRUE); gtk_widget_grab_focus(img); gtk_widget_grab_default(img); } else @@ -982,12 +999,12 @@ create_choice_field(PurpleRequestField *field) if (num_labels > 5) { - widget = gtk_combo_box_new_text(); + widget = gtk_combo_box_text_new(); for (l = labels; l != NULL; l = l->next) { const char *text = l->data; - gtk_combo_box_append_text(GTK_COMBO_BOX(widget), text); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), text); } gtk_combo_box_set_active(GTK_COMBO_BOX(widget), @@ -1264,12 +1281,12 @@ pidgin_request_fields(const char *title, const char *primary, /* Cancel button */ button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(cancel_text), G_CALLBACK(multifield_cancel_cb), data); - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(button, TRUE); /* OK button */ button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(ok_text), G_CALLBACK(multifield_ok_cb), data); data->ok_button = button; - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(button, TRUE); gtk_window_set_default(GTK_WINDOW(win), button); pidgin_widget_decorate_account(hbox, account); diff --git a/pidgin/gtkroomlist.c b/pidgin/gtkroomlist.c index 4ef648c0d7..8ae843c95e 100644 --- a/pidgin/gtkroomlist.c +++ b/pidgin/gtkroomlist.c @@ -359,8 +359,10 @@ pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) int current_height, max_width; int max_text_width; GtkTextDirection dir = gtk_widget_get_direction(GTK_WIDGET(grl->tree)); - - style = grl->tipwindow->style; + cairo_t *cr = + gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(grl->tipwindow))); + + style = gtk_widget_get_style(grl->tipwindow); max_text_width = MAX(grl->tip_width, grl->tip_name_width); max_width = TOOLTIP_BORDER + SMALL_SPACE + max_text_width + TOOLTIP_BORDER; @@ -368,26 +370,28 @@ pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) current_height = 12; if (dir == GTK_TEXT_DIR_RTL) { - gtk_paint_layout(style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, grl->tipwindow, "tooltip", + gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, + grl->tipwindow, "tooltip", max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), current_height, grl->tip_name_layout); } else { - gtk_paint_layout (style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, grl->tipwindow, "tooltip", + gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, + grl->tipwindow, "tooltip", TOOLTIP_BORDER + SMALL_SPACE, current_height, grl->tip_name_layout); } if (dir != GTK_TEXT_DIR_RTL) { - gtk_paint_layout (style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, grl->tipwindow, "tooltip", + gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, + grl->tipwindow, "tooltip", TOOLTIP_BORDER + SMALL_SPACE, current_height + grl->tip_name_height, grl->tip_layout); } else { - gtk_paint_layout(style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, grl->tipwindow, "tooltip", + gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, + grl->tipwindow, "tooltip", max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), current_height + grl->tip_name_height, grl->tip_layout); } + cairo_destroy(cr); + return FALSE; } diff --git a/pidgin/gtksavedstatuses.c b/pidgin/gtksavedstatuses.c index 6601748a05..9baab620fe 100644 --- a/pidgin/gtksavedstatuses.c +++ b/pidgin/gtksavedstatuses.c @@ -535,7 +535,7 @@ create_saved_status_list(StatusWindow *dialog) static gboolean configure_cb(GtkWidget *widget, GdkEventConfigure *event, StatusWindow *dialog) { - if (GTK_WIDGET_VISIBLE(widget)) + if (gtk_widget_get_visible(widget)) { purple_prefs_set_int(PIDGIN_PREFS_ROOT "/status/dialog/width", event->width); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/status/dialog/height", event->height); diff --git a/pidgin/gtkscrollbook.c b/pidgin/gtkscrollbook.c index 4dec2ec6eb..f5bdf7b435 100644 --- a/pidgin/gtkscrollbook.c +++ b/pidgin/gtkscrollbook.c @@ -94,7 +94,7 @@ refresh_scroll_box(PidginScrollBook *scroll_book, int index, int count) gtk_widget_show_all(GTK_WIDGET(scroll_book)); if (count < 1) - gtk_widget_hide_all(scroll_book->hbox); + gtk_widget_hide(scroll_book->hbox); else { gtk_widget_show_all(scroll_book->hbox); if (count == 1) { @@ -138,7 +138,7 @@ scroll_close_cb(PidginScrollBook *scroll_book) } static void -switch_page_cb(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, PidginScrollBook *scroll_book) +switch_page_cb(GtkNotebook *notebook, GtkWidget *page, guint page_num, PidginScrollBook *scroll_book) { int count; count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook)); @@ -151,7 +151,7 @@ pidgin_scroll_book_add(GtkContainer *container, GtkWidget *widget) PidginScrollBook *scroll_book; g_return_if_fail(GTK_IS_WIDGET (widget)); - g_return_if_fail (widget->parent == NULL); + g_return_if_fail (gtk_widget_get_parent(widget) == NULL); scroll_book = PIDGIN_SCROLL_BOOK(container); scroll_book->children = g_list_append(scroll_book->children, widget); diff --git a/pidgin/gtksmiley.c b/pidgin/gtksmiley.c index e59c082fd7..5c0e5d2e55 100644 --- a/pidgin/gtksmiley.c +++ b/pidgin/gtksmiley.c @@ -399,7 +399,7 @@ pidgin_smiley_edit(GtkWidget *widget, PurpleSmiley *smiley) window = gtk_dialog_new_with_buttons(smiley ? _("Edit Smiley") : _("Add Smiley"), widget ? GTK_WINDOW(widget) : NULL, - GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL); @@ -414,7 +414,8 @@ pidgin_smiley_edit(GtkWidget *widget, PurpleSmiley *smiley) /* The vbox */ vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), vbox); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))), + vbox); gtk_widget_show(vbox); /* The hbox */ @@ -727,9 +728,10 @@ smiley_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, guint info, guint t, gpointer user_data) { SmileyManager *dialog = user_data; - gchar *name = g_strchomp((gchar *)sd->data); - - if ((sd->length >= 0) && (sd->format == 8)) { + gchar *name = g_strchomp((gchar *) gtk_selection_data_get_data(sd)); + + if ((gtk_selection_data_get_length(sd) >= 0) + && (gtk_selection_data_get_format(sd) == 8)) { /* Well, it looks like the drag event was cool. * Let's do something with it */ @@ -895,7 +897,8 @@ void pidgin_smiley_manager_show(void) /* The vbox */ vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(win)->vbox), vbox); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(win))), + vbox); gtk_widget_show(vbox); /* get the scrolled window with all stuff */ diff --git a/pidgin/gtksourceundomanager.c b/pidgin/gtksourceundomanager.c index d2980ce109..050c9ce43d 100644 --- a/pidgin/gtksourceundomanager.c +++ b/pidgin/gtksourceundomanager.c @@ -532,7 +532,8 @@ gtk_source_undo_manager_undo (GtkSourceUndoManager *um) um->priv->document, undo_action->action.insert_anchor.pos, undo_action->action.insert_anchor.pos + 1); - undo_action->action.insert_anchor.anchor->segment = NULL; /* XXX: This may be a bug in GTK+ */ + /* TODO: is this needed in GTK+ 3? */ + /*gtk_text_child_anchor_set_segment(undo_action->action.insert_anchor.anchor, NULL); XXX: This may be a bug in GTK+ */ break; default: /* Unknown action type. */ diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index c315916cb3..e1fc6d94be 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -82,9 +82,9 @@ static void pidgin_status_box_refresh(PidginStatusBox *status_box); static void status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed); static void pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed); static void pidgin_status_box_changed(PidginStatusBox *box); -static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); +/*static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition);*/ static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); +/*static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event);*/ static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box); static void pidgin_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); static void pidgin_status_box_popup(PidginStatusBox *box); @@ -282,7 +282,7 @@ update_to_reflect_account_status(PidginStatusBox *status_box, PurpleAccount *acc if (!message || !*message) { - gtk_widget_hide_all(status_box->vbox); + gtk_widget_hide(status_box->vbox); status_box->imhtml_visible = FALSE; } else @@ -343,9 +343,10 @@ static void icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *sd, guint info, guint t, PidginStatusBox *box) { - gchar *name = (gchar *)sd->data; + gchar *name = (gchar *) gtk_selection_data_get_data(sd); - if ((sd->length >= 0) && (sd->format == 8)) { + if ((gtk_selection_data_get_length(sd) >= 0) + && (gtk_selection_data_get_format(sd) == 8)) { /* Well, it looks like the drag event was cool. * Let's do something with it */ if (!g_ascii_strncasecmp(name, "file://", 7)) { @@ -419,7 +420,7 @@ statusbox_uri_handler(const char *proto, const char *cmd, GHashTable *params, vo static gboolean icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) { - gdk_window_set_cursor(widget->window, box->hand_cursor); + gdk_window_set_cursor(gtk_widget_get_window(widget), box->hand_cursor); gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover); return FALSE; } @@ -427,7 +428,7 @@ icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *b static gboolean icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) { - gdk_window_set_cursor(widget->window, box->arrow_cursor); + gdk_window_set_cursor(gtk_widget_get_window(widget), box->arrow_cursor); gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ; return FALSE; } @@ -615,9 +616,11 @@ pidgin_status_box_class_init (PidginStatusBoxClass *klass) parent_class = g_type_class_peek_parent(klass); widget_class = (GtkWidgetClass*)klass; - widget_class->size_request = pidgin_status_box_size_request; + /* this seems to be removed in GTK+ 3...*/ + /*widget_class->size_request = pidgin_status_box_size_request;*/ widget_class->size_allocate = pidgin_status_box_size_allocate; - widget_class->expose_event = pidgin_status_box_expose_event; + /* this seems to be removed in GTK+ 3...*/ + /*widget_class->expose_event = pidgin_status_box_expose_event;*/ container_class->child_type = pidgin_status_box_child_type; container_class->forall = pidgin_status_box_forall; @@ -931,7 +934,7 @@ status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed) if (!purple_savedstatus_is_transient(saved_status) || !message || !*message) { status_box->imhtml_visible = FALSE; - gtk_widget_hide_all(status_box->vbox); + gtk_widget_hide(status_box->vbox); } else { @@ -1135,7 +1138,7 @@ static gboolean imhtml_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkI static gboolean imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box) { - if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab || event->keyval == GDK_ISO_Left_Tab) + if (event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_KP_Tab || event->keyval == GDK_KEY_ISO_Left_Tab) { /* If last inserted character is a tab, then remove the focus from here */ GtkWidget *top = gtk_widget_get_toplevel(w); @@ -1148,7 +1151,7 @@ static gboolean imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStat return FALSE; /* Reset the status if Escape was pressed */ - if (event->keyval == GDK_Escape) + if (event->keyval == GDK_KEY_Escape) { purple_timeout_remove(status_box->typing); status_box->typing = 0; @@ -1299,13 +1302,15 @@ pidgin_status_box_list_position (PidginStatusBox *status_box, int *x, int *y, in GdkRectangle monitor; GtkRequisition popup_req; GtkPolicyType hpolicy, vpolicy; + GtkAllocation allocation; - gdk_window_get_origin (GTK_WIDGET(status_box)->window, x, y); + gtk_widget_get_allocation(GTK_WIDGET(status_box), &allocation); + gdk_window_get_origin (gtk_widget_get_window(GTK_WIDGET(status_box)), x, y); - *x += GTK_WIDGET(status_box)->allocation.x; - *y += GTK_WIDGET(status_box)->allocation.y; + *x += allocation.x; + *y += allocation.y; - *width = GTK_WIDGET(status_box)->allocation.width; + *width = allocation.width; hpolicy = vpolicy = GTK_POLICY_NEVER; gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window), @@ -1324,7 +1329,7 @@ pidgin_status_box_list_position (PidginStatusBox *status_box, int *x, int *y, in screen = gtk_widget_get_screen (GTK_WIDGET (status_box)); monitor_num = gdk_screen_get_monitor_at_window (screen, - GTK_WIDGET (status_box)->window); + gtk_widget_get_window(GTK_WIDGET (status_box))); gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); if (*x < monitor.x) @@ -1332,13 +1337,13 @@ pidgin_status_box_list_position (PidginStatusBox *status_box, int *x, int *y, in else if (*x + *width > monitor.x + monitor.width) *x = monitor.x + monitor.width - *width; - if (*y + GTK_WIDGET(status_box)->allocation.height + *height <= monitor.y + monitor.height) - *y += GTK_WIDGET(status_box)->allocation.height; + if (*y + allocation.height + *height <= monitor.y + monitor.height) + *y += allocation.height; else if (*y - *height >= monitor.y) *y -= *height; - else if (monitor.y + monitor.height - (*y + GTK_WIDGET(status_box)->allocation.height) > *y - monitor.y) + else if (monitor.y + monitor.height - (*y + allocation.height) > *y - monitor.y) { - *y += GTK_WIDGET(status_box)->allocation.height; + *y += allocation.height; *height = monitor.y + monitor.height - *y; } else @@ -1369,7 +1374,7 @@ popup_grab_on_window (GdkWindow *window, if (!grab_keyboard || gdk_keyboard_grab (window, TRUE, activate_time) == 0) return TRUE; else { - gdk_display_pointer_ungrab (gdk_drawable_get_display (window), activate_time); + gdk_display_pointer_ungrab (gdk_window_get_display (window), activate_time); return FALSE; } } @@ -1388,7 +1393,7 @@ pidgin_status_box_popup(PidginStatusBox *box) gtk_window_move (GTK_WINDOW (box->popup_window), x, y); gtk_widget_show(box->popup_window); gtk_widget_grab_focus (box->tree_view); - if (!popup_grab_on_window (box->popup_window->window, + if (!popup_grab_on_window (gtk_widget_get_window(box->popup_window), GDK_CURRENT_TIME, TRUE)) { gtk_widget_hide (box->popup_window); return; @@ -1419,10 +1424,10 @@ static gboolean toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box) { switch (event->keyval) { - case GDK_Return: - case GDK_KP_Enter: - case GDK_KP_Space: - case GDK_space: + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: + case GDK_KEY_KP_Space: + case GDK_KEY_space: if (!box->popup_in_progress) { pidgin_status_box_popup (box); box->popup_in_progress = TRUE; @@ -1654,7 +1659,7 @@ treeview_key_press_event(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box) { if (box->popup_in_progress) { - if (event->keyval == GDK_Escape) { + if (event->keyval == GDK_KEY_Escape) { pidgin_status_box_popdown(box); return TRUE; } else { @@ -1665,9 +1670,9 @@ treeview_key_press_event(GtkWidget *widget, if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { gboolean ret = TRUE; path = gtk_tree_model_get_path(GTK_TREE_MODEL(box->dropdown_store), &iter); - if (event->keyval == GDK_Return) { + if (event->keyval == GDK_KEY_Return) { treeview_activate_current_selection(box, path); - } else if (event->keyval == GDK_Delete) { + } else if (event->keyval == GDK_KEY_Delete) { tree_view_delete_current_selection(box, path); } else ret = FALSE; @@ -1743,7 +1748,7 @@ pidgin_status_box_init (PidginStatusBox *status_box) GtkWidget *toplevel; GtkTreeSelection *sel; - GTK_WIDGET_SET_FLAGS (status_box, GTK_NO_WINDOW); + gtk_widget_set_has_window(GTK_WIDGET(status_box), FALSE); status_box->imhtml_visible = FALSE; status_box->network_available = purple_network_is_available(); status_box->connecting = FALSE; @@ -1927,12 +1932,14 @@ pidgin_status_box_init (PidginStatusBox *status_box) } +/* TODO: is this needed in GTK+ 3? */ +#if 0 static void pidgin_status_box_size_request(GtkWidget *widget, GtkRequisition *requisition) { GtkRequisition box_req; - gint border_width = GTK_CONTAINER (widget)->border_width; + gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->toggle_button, requisition); @@ -1947,6 +1954,7 @@ pidgin_status_box_size_request(GtkWidget *widget, requisition->width = 1; } +#endif /* From gnome-panel */ static void @@ -1995,7 +2003,7 @@ pidgin_status_box_size_allocate(GtkWidget *widget, PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); GtkRequisition req = {0,0}; GtkAllocation parent_alc, box_alc, icon_alc; - gint border_width = GTK_CONTAINER (widget)->border_width; + gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); gtk_widget_size_request(status_box->toggle_button, &req); /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ @@ -2034,9 +2042,11 @@ pidgin_status_box_size_allocate(GtkWidget *widget, gtk_widget_size_allocate(status_box->icon_box, &icon_alc); } gtk_widget_size_allocate(status_box->toggle_button, &parent_alc); - widget->allocation = *allocation; + gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation); } +/* TODO: don't think this is nessesary in GTK+ 3 */ +#if 0 static gboolean pidgin_status_box_expose_event(GtkWidget *widget, GdkEventExpose *event) @@ -2051,6 +2061,7 @@ pidgin_status_box_expose_event(GtkWidget *widget, } return FALSE; } +#endif static void pidgin_status_box_forall(GtkContainer *container, @@ -2333,7 +2344,7 @@ activate_currently_selected_status(PidginStatusBox *status_box) message = pidgin_status_box_get_message(status_box); if (!message || !*message) { - gtk_widget_hide_all(status_box->vbox); + gtk_widget_hide(status_box->vbox); status_box->imhtml_visible = FALSE; if (message != NULL) { @@ -2605,7 +2616,7 @@ static void pidgin_status_box_changed(PidginStatusBox *status_box) purple_timeout_remove(status_box->typing); status_box->typing = 0; - if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) + if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) { if (type == PIDGIN_STATUS_BOX_TYPE_POPULAR || type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR) { @@ -2667,7 +2678,7 @@ static void pidgin_status_box_changed(PidginStatusBox *status_box) } g_list_free(accounts); - if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) + if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) { if (status_box->imhtml_visible) { @@ -2687,7 +2698,7 @@ static void pidgin_status_box_changed(PidginStatusBox *status_box) } else { - gtk_widget_hide_all(status_box->vbox); + gtk_widget_hide(status_box->vbox); activate_currently_selected_status(status_box); /* This is where we actually set the status */ } } @@ -2723,7 +2734,7 @@ get_statusbox_index(PidginStatusBox *box, PurpleSavedStatus *saved_status) static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) { PidginStatusBox *status_box = (PidginStatusBox*)data; - if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) + if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) { if (status_box->typing != 0) { pidgin_status_box_pulse_typing(status_box); diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index a1a2a9f599..9e303acda2 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -188,7 +188,7 @@ pidgin_create_dialog(const char *title, guint border_width, const char *role, gb GtkWidget * pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing) { - GtkBox *vbox = GTK_BOX(GTK_DIALOG(dialog)->vbox); + GtkBox *vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); gtk_box_set_homogeneous(vbox, homogeneous); gtk_box_set_spacing(vbox, spacing); return GTK_WIDGET(vbox); @@ -196,12 +196,12 @@ pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog) { - return GTK_DIALOG(dialog)->vbox; + return gtk_dialog_get_content_area(GTK_DIALOG(dialog)); } GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog) { - return GTK_DIALOG(dialog)->action_area; + return gtk_dialog_get_action_area(GTK_DIALOG(dialog)); } GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label, @@ -297,7 +297,7 @@ pidgin_toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) if (to_toggle == NULL) return; - sensitivity = GTK_WIDGET_IS_SENSITIVE(to_toggle); + sensitivity = gtk_widget_get_sensitive(to_toggle); gtk_widget_set_sensitive(to_toggle, !sensitivity); } @@ -314,7 +314,7 @@ pidgin_toggle_sensitive_array(GtkWidget *w, GPtrArray *data) if (element == NULL) continue; - sensitivity = GTK_WIDGET_IS_SENSITIVE(element); + sensitivity = gtk_widget_get_sensitive(element); gtk_widget_set_sensitive(element, !sensitivity); } @@ -326,7 +326,7 @@ pidgin_toggle_showhide(GtkWidget *widget, GtkWidget *to_toggle) if (to_toggle == NULL) return; - if (GTK_WIDGET_VISIBLE(to_toggle)) + if (gtk_widget_get_visible(to_toggle)) gtk_widget_hide(to_toggle); else gtk_widget_show(to_toggle); @@ -1211,8 +1211,8 @@ pidgin_menu_position_func_helper(GtkMenu *menu, widget = GTK_WIDGET(menu); screen = gtk_widget_get_screen(widget); - xthickness = widget->style->xthickness; - ythickness = widget->style->ythickness; + xthickness = gtk_widget_get_style(widget)->xthickness; + ythickness = gtk_widget_get_style(widget)->ythickness; rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL); /* @@ -1350,9 +1350,9 @@ pidgin_treeview_popup_menu_position_func(GtkMenu *menu, GtkTreePath *path; GtkTreeViewColumn *col; GdkRectangle rect; - gint ythickness = GTK_WIDGET(menu)->style->ythickness; + gint ythickness = gtk_widget_get_style(GTK_WIDGET(menu))->ythickness; - gdk_window_get_origin (widget->window, x, y); + gdk_window_get_origin (gtk_widget_get_window(widget), x, y); gtk_tree_view_get_cursor (tv, &path, &col); gtk_tree_view_get_cell_area (tv, path, col, &rect); @@ -1466,7 +1466,7 @@ void pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char *who) { GdkPixbuf *pb; - GList *files = purple_uri_list_extract_filenames((const gchar *)sd->data); + GList *files = purple_uri_list_extract_filenames((const gchar *) gtk_selection_data_get_data(sd)); PurpleConnection *gc = purple_account_get_connection(account); PurplePluginProtocolInfo *prpl_info = NULL; #ifndef _WIN32 @@ -1784,7 +1784,9 @@ pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, group = gtk_menu_get_accel_group(GTK_MENU(menu)); if (group) { - char *path = g_strdup_printf("%s/%s", GTK_MENU_ITEM(menuitem)->accel_path, act->label); + char *path = g_strdup_printf("%s/%s", + gtk_menu_item_get_accel_path(GTK_MENU_ITEM(menuitem)), + act->label); gtk_menu_set_accel_path(GTK_MENU(submenu), path); g_free(path); gtk_menu_set_accel_group(GTK_MENU(submenu), group); @@ -2107,23 +2109,23 @@ void pidgin_set_cursor(GtkWidget *widget, GdkCursorType cursor_type) GdkCursor *cursor; g_return_if_fail(widget != NULL); - if (widget->window == NULL) + if (gtk_widget_get_window(widget) == NULL) return; cursor = gdk_cursor_new(cursor_type); - gdk_window_set_cursor(widget->window, cursor); + gdk_window_set_cursor(gtk_widget_get_window(widget), cursor); gdk_cursor_unref(cursor); - gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); + gdk_display_flush(gdk_window_get_display(gtk_widget_get_window(widget))); } void pidgin_clear_cursor(GtkWidget *widget) { g_return_if_fail(widget != NULL); - if (widget->window == NULL) + if (gtk_widget_get_window(widget) == NULL) return; - gdk_window_set_cursor(widget->window, NULL); + gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); } struct _icon_chooser { @@ -2810,18 +2812,18 @@ const char *pidgin_get_dim_grey_string(GtkWidget *widget) { } static void -combo_box_changed_cb(GtkComboBox *combo_box, GtkEntry *entry) +combo_box_changed_cb(GtkComboBoxText *combo_box, GtkEntry *entry) { - char *text = gtk_combo_box_get_active_text(combo_box); + char *text = gtk_combo_box_text_get_active_text(combo_box); gtk_entry_set_text(entry, text ? text : ""); g_free(text); } static gboolean -entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *key, GtkComboBox *combo) +entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *key, GtkComboBoxText *combo) { - if (key->keyval == GDK_Down || key->keyval == GDK_Up) { - gtk_combo_box_popup(combo); + if (key->keyval == GDK_KEY_Down || key->keyval == GDK_KEY_Up) { + gtk_combo_box_popup(GTK_COMBO_BOX(combo)); return TRUE; } return FALSE; @@ -2830,10 +2832,10 @@ entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *key, GtkComboBox *combo) GtkWidget * pidgin_text_combo_box_entry_new(const char *default_item, GList *items) { - GtkComboBox *ret = NULL; + GtkComboBoxText *ret = NULL; GtkWidget *the_entry = NULL; - ret = GTK_COMBO_BOX(gtk_combo_box_new_text()); + ret = GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new()); the_entry = gtk_entry_new(); gtk_container_add(GTK_CONTAINER(ret), the_entry); @@ -2843,7 +2845,7 @@ pidgin_text_combo_box_entry_new(const char *default_item, GList *items) for (; items != NULL ; items = items->next) { char *text = items->data; if (text && *text) - gtk_combo_box_append_text(ret, text); + gtk_combo_box_text_append_text(ret, text); } g_signal_connect(G_OBJECT(ret), "changed", (GCallback)combo_box_changed_cb, the_entry); @@ -2854,12 +2856,12 @@ pidgin_text_combo_box_entry_new(const char *default_item, GList *items) const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget) { - return gtk_entry_get_text(GTK_ENTRY(GTK_BIN((widget))->child)); + return gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((widget))))); } void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text) { - gtk_entry_set_text(GTK_ENTRY(GTK_BIN((widget))->child), (text)); + gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((widget)))), (text)); } GtkWidget * @@ -2980,12 +2982,12 @@ gboolean pidgin_auto_parent_window(GtkWidget *widget) windows = g_list_delete_link(windows, windows); if (window == widget || - !GTK_WIDGET_VISIBLE(window)) { + !gtk_widget_get_visible(window)) { continue; } if (gtk_window_has_toplevel_focus(GTK_WINDOW(window)) || - (menu && menu == window->window)) { + (menu && menu == gtk_widget_get_window(window))) { parent = window; break; } diff --git a/pidgin/gtkwhiteboard.c b/pidgin/gtkwhiteboard.c index 8471d9e304..75fbb9daa5 100644 --- a/pidgin/gtkwhiteboard.c +++ b/pidgin/gtkwhiteboard.c @@ -280,13 +280,13 @@ static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb) /* TODO Ask if user wants to save picture before the session is closed */ /* Clear graphical memory */ - if(gtkwb->pixmap) + if(gtkwb->pixbuf) { - cairo_t *cr = g_object_get_data(G_OBJECT(gtkwb->pixmap), "cairo-context"); + cairo_t *cr = g_object_get_data(G_OBJECT(gtkwb->pixbuf), "cairo-context"); if (cr) cairo_destroy(cr); - g_object_unref(gtkwb->pixmap); - gtkwb->pixmap = NULL; + g_object_unref(gtkwb->pixbuf); + gtkwb->pixbuf = NULL; } colour_dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog"); @@ -356,28 +356,33 @@ static void pidginwhiteboard_button_start_press(GtkButton *button, gpointer data static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; - GdkPixmap *pixmap = gtkwb->pixmap; + GdkPixbuf *pixbuf = gtkwb->pixbuf; cairo_t *cr; - - if (pixmap) { - cr = g_object_get_data(G_OBJECT(pixmap), "cairo-context"); + GdkWindow *window = gtk_widget_get_window(widget); + GtkAllocation allocation; + + if (pixbuf) { + cr = g_object_get_data(G_OBJECT(pixbuf), "cairo-context"); if (cr) cairo_destroy(cr); - g_object_unref(pixmap); + g_object_unref(pixbuf); } - pixmap = gdk_pixmap_new(widget->window, - widget->allocation.width, - widget->allocation.height, - -1); - gtkwb->pixmap = pixmap; - - cr = gdk_cairo_create(GDK_DRAWABLE(pixmap)); - g_object_set_data(G_OBJECT(pixmap), "cairo-context", cr); - gdk_cairo_set_source_color(cr, &widget->style->white); + gtk_widget_get_allocation(widget, &allocation); + + pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, + FALSE, + gdk_visual_get_depth(GDK_VISUAL(window)), + allocation.width, allocation.height); + + gtkwb->pixbuf = pixbuf; + + cr = gdk_cairo_create(GDK_DRAWABLE(pixbuf)); + g_object_set_data(G_OBJECT(pixbuf), "cairo-context", cr); + gdk_cairo_set_source_color(cr, >k_widget_get_style(widget)->white); cairo_rectangle(cr, 0, 0, - widget->allocation.width, widget->allocation.height); + allocation.width, allocation.height); cairo_fill(cr); return TRUE; @@ -386,11 +391,11 @@ static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventCon static gboolean pidgin_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); - GdkPixmap *pixmap = gtkwb->pixmap; + GdkPixbuf *pixbuf = gtkwb->pixbuf; cairo_t *cr; - cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); - gdk_cairo_set_source_pixmap(cr, pixmap, 0, 0); + cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget))); + gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); cairo_rectangle(cr, event->area.x, event->area.y, event->area.width, event->area.height); @@ -403,7 +408,7 @@ static gboolean pidgin_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton *event, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; - GdkPixmap *pixmap = gtkwb->pixmap; + GdkPixbuf *pixbuf = gtkwb->pixbuf; PurpleWhiteboard *wb = gtkwb->wb; GList *draw_list = wb->draw_list; @@ -418,7 +423,7 @@ static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton * BrushState = BRUSH_STATE_DOWN; - if(event->button == 1 && pixmap != NULL) + if(event->button == 1 && pixbuf != NULL) { /* Check if draw_list has contents; if so, clear it */ if(draw_list) @@ -456,7 +461,7 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion GdkModifierType state; PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; - GdkPixmap *pixmap = gtkwb->pixmap; + GdkPixbuf *pixbuf = gtkwb->pixbuf; PurpleWhiteboard *wb = gtkwb->wb; GList *draw_list = wb->draw_list; @@ -470,7 +475,7 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion state = event->state; } - if(state & GDK_BUTTON1_MASK && pixmap != NULL) + if(state & GDK_BUTTON1_MASK && pixbuf != NULL) { if((BrushState != BRUSH_STATE_DOWN) && (BrushState != BRUSH_STATE_MOTION)) { @@ -536,7 +541,7 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *event, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; - GdkPixmap *pixmap = gtkwb->pixmap; + GdkPixbuf *pixbuf = gtkwb->pixbuf; PurpleWhiteboard *wb = gtkwb->wb; GList *draw_list = wb->draw_list; @@ -551,7 +556,7 @@ static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *ev } BrushState = BRUSH_STATE_UP; - if(event->button == 1 && pixmap != NULL) + if(event->button == 1 && pixbuf != NULL) { /* If the brush was never moved, express two sets of two deltas That's a * 'point,' but not for Yahoo! @@ -593,9 +598,9 @@ static void pidgin_whiteboard_draw_brush_point(PurpleWhiteboard *wb, int x, int { PidginWhiteboard *gtkwb = wb->ui_data; GtkWidget *widget = gtkwb->drawing_area; - GdkPixmap *pixmap = gtkwb->pixmap; + GdkPixbuf *pixbuf = gtkwb->pixbuf; - cairo_t *gfx_con = g_object_get_data(G_OBJECT(pixmap), "cairo-context"); + cairo_t *gfx_con = g_object_get_data(G_OBJECT(pixbuf), "cairo-context"); GdkColor col; /* Interpret and convert color */ @@ -701,21 +706,24 @@ static void pidgin_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int colo static void pidgin_whiteboard_clear(PurpleWhiteboard *wb) { PidginWhiteboard *gtkwb = wb->ui_data; - GdkPixmap *pixmap = gtkwb->pixmap; + GdkPixbuf *pixbuf = gtkwb->pixbuf; GtkWidget *drawing_area = gtkwb->drawing_area; - cairo_t *cr = g_object_get_data(G_OBJECT(pixmap), "cairo-context"); + cairo_t *cr = g_object_get_data(G_OBJECT(pixbuf), "cairo-context"); + GtkAllocation allocation; - gdk_cairo_set_source_color(cr, &drawing_area->style->white); + gtk_widget_get_allocation(drawing_area, &allocation); + + gdk_cairo_set_source_color(cr, >k_widget_get_style(drawing_area)->white); cairo_rectangle(cr, 0, 0, - drawing_area->allocation.width, - drawing_area->allocation.height); + allocation.width, + allocation.height); cairo_fill(cr); gtk_widget_queue_draw_area(drawing_area, 0, 0, - drawing_area->allocation.width, - drawing_area->allocation.height); + allocation.width, + allocation.height); } static void pidgin_whiteboard_button_clear_press(GtkWidget *widget, gpointer data) @@ -781,12 +789,15 @@ static void pidgin_whiteboard_button_save_press(GtkWidget *widget, gpointer data gtk_widget_destroy(dialog); /* Makes an icon from the whiteboard's canvas 'image' */ + pixbuf = gtkwb->pixbuf; + /* pixbuf = gdk_pixbuf_get_from_drawable(NULL, (GdkDrawable*)(gtkwb->pixmap), gdk_drawable_get_colormap(gtkwb->pixmap), 0, 0, 0, 0, gtkwb->width, gtkwb->height); + */ if(gdk_pixbuf_save(pixbuf, filename, "jpeg", NULL, "quality", "100", NULL)) purple_debug_info("gtkwhiteboard", "File Saved...\n"); @@ -807,12 +818,15 @@ static void pidgin_whiteboard_set_canvas_as_icon(PidginWhiteboard *gtkwb) GdkPixbuf *pixbuf; /* Makes an icon from the whiteboard's canvas 'image' */ + pixbuf = gtkwb->pixbuf; + /* pixbuf = gdk_pixbuf_get_from_drawable(NULL, (GdkDrawable*)(gtkwb->pixmap), gdk_drawable_get_colormap(gtkwb->pixmap), 0, 0, 0, 0, gtkwb->width, gtkwb->height); + */ gtk_window_set_icon((GtkWindow*)(gtkwb->window), pixbuf); } @@ -853,23 +867,29 @@ static void color_select_dialog(GtkWidget *widget, PidginWhiteboard *gtkwb) { GdkColor color; GtkColorSelectionDialog *dialog; - + GtkWidget *ok_button; + dialog = (GtkColorSelectionDialog *)gtk_color_selection_dialog_new(_("Select color")); g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", dialog); - g_signal_connect(G_OBJECT(dialog->colorsel), "color-changed", + g_signal_connect(G_OBJECT(gtk_color_selection_dialog_get_color_selection(dialog)), + "color-changed", G_CALLBACK(change_color_cb), gtkwb); + /* gtk_widget_destroy(dialog->cancel_button); gtk_widget_destroy(dialog->help_button); - - g_signal_connect(G_OBJECT(dialog->ok_button), "clicked", + */ + g_object_get(G_OBJECT(dialog), "ok-button", &ok_button, NULL); + + g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(color_selection_dialog_destroy), gtkwb); - gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION(dialog->colorsel), TRUE); + gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(dialog)), TRUE); pidgin_whiteboard_rgb24_to_rgb48(gtkwb->brush_color, &color); - gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(dialog->colorsel), &color); + gtk_color_selection_set_current_color( + GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(dialog)), &color); gtk_widget_show_all(GTK_WIDGET(dialog)); } diff --git a/pidgin/gtkwhiteboard.h b/pidgin/gtkwhiteboard.h index d5bad34a36..06c9c56d67 100644 --- a/pidgin/gtkwhiteboard.h +++ b/pidgin/gtkwhiteboard.h @@ -51,7 +51,7 @@ typedef struct _PidginWhiteboard GtkWidget *window; /**< Window for the Doodle session */ GtkWidget *drawing_area; /**< Drawing area */ - GdkPixmap *pixmap; /**< Memory for drawing area */ + GdkPixbuf *pixbuf; /**< Memory for drawing area */ int width; /**< Canvas width */ int height; /**< Canvas height */ diff --git a/pidgin/minidialog.c b/pidgin/minidialog.c index 3de67cbddc..50d3a82231 100644 --- a/pidgin/minidialog.c +++ b/pidgin/minidialog.c @@ -160,7 +160,7 @@ struct _mini_dialog_button_clicked_cb_data guint pidgin_mini_dialog_get_num_children(PidginMiniDialog *mini_dialog) { - return g_list_length(mini_dialog->contents->children); + return g_list_length(gtk_container_get_children(GTK_CONTAINER(mini_dialog->contents))); } static gboolean diff --git a/pidgin/pidgintooltip.c b/pidgin/pidgintooltip.c index d97e1945c3..fbd3232788 100644 --- a/pidgin/pidgintooltip.c +++ b/pidgin/pidgintooltip.c @@ -104,9 +104,12 @@ static gboolean pidgin_tooltip_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) { if (pidgin_tooltip.paint_tooltip) { - gtk_paint_flat_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, widget, "tooltip", 0, 0, -1, -1); + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget))); + gtk_paint_flat_box(gtk_widget_get_style(widget), cr, + GTK_STATE_NORMAL, GTK_SHADOW_OUT, + widget, "tooltip", 0, 0, -1, -1); pidgin_tooltip.paint_tooltip(widget, data); + cairo_destroy(cr); } return FALSE; } diff --git a/pidgin/plugins/contact_priority.c b/pidgin/plugins/contact_priority.c index 5ec79d973d..5e03cd60d9 100644 --- a/pidgin/plugins/contact_priority.c +++ b/pidgin/plugins/contact_priority.c @@ -75,7 +75,7 @@ get_config_frame(PurplePlugin *plugin) GtkWidget *ret = NULL, *hbox = NULL, *frame = NULL, *vbox = NULL; GtkWidget *label = NULL, *spin = NULL, *check = NULL; GtkWidget *optmenu = NULL; - GtkObject *adj = NULL; + GtkAdjustment *adj = NULL; GtkSizeGroup *sg = NULL; PurpleAccount *account = NULL; int i; diff --git a/pidgin/plugins/convcolors.c b/pidgin/plugins/convcolors.c index d23eec420b..da0bd906fe 100644 --- a/pidgin/plugins/convcolors.c +++ b/pidgin/plugins/convcolors.c @@ -302,7 +302,7 @@ enable_toggled(const char *name, PurplePrefType type, gconstpointer val, gpointe } static void -disconnect_prefs_callbacks(GtkObject *object, gpointer data) +disconnect_prefs_callbacks(GtkWidget *widget, gpointer data) { PurplePlugin *plugin = (PurplePlugin *)data; @@ -383,7 +383,7 @@ get_config_frame(PurplePlugin *plugin) purple_prefs_connect_callback(plugin, tmp2, enable_toggled, button); } - g_signal_connect(GTK_OBJECT(ret), "destroy", G_CALLBACK(disconnect_prefs_callbacks), plugin); + g_signal_connect(ret, "destroy", G_CALLBACK(disconnect_prefs_callbacks), plugin); frame = pidgin_make_frame(ret, _("General")); pidgin_prefs_checkbox(_("Ignore incoming format"), PREF_IGNORE, frame); pidgin_prefs_checkbox(_("Apply in Chats"), PREF_CHATS, frame); diff --git a/pidgin/plugins/disco/gtkdisco.c b/pidgin/plugins/disco/gtkdisco.c index aebc2ec0c5..73bc9d98b4 100644 --- a/pidgin/plugins/disco/gtkdisco.c +++ b/pidgin/plugins/disco/gtkdisco.c @@ -429,15 +429,12 @@ static gboolean account_filter_func(PurpleAccount *account) static gboolean disco_paint_tooltip(GtkWidget *tipwindow, gpointer data) { + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(tipwindow)); PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); -#if GTK_CHECK_VERSION(2,14,0) gtk_paint_layout(gtk_widget_get_style(tipwindow), - gtk_widget_get_window(tipwindow), + cr, GTK_STATE_NORMAL, FALSE, -#else - gtk_paint_layout(tipwindow->style, tipwindow->window, GTK_STATE_NORMAL, FALSE, -#endif - NULL, tipwindow, "tooltip", + tipwindow, "tooltip", 6, 6, layout); return TRUE; } diff --git a/pidgin/plugins/markerline.c b/pidgin/plugins/markerline.c index caa41cf63f..c6b2bc045d 100644 --- a/pidgin/plugins/markerline.c +++ b/pidgin/plugins/markerline.c @@ -76,6 +76,7 @@ imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *g gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, 0, last_y, 0, &y); + /* TODO: port this to using Cairo if (y >= event->area.y) { GdkColor red = {0, 0xffff, 0, 0}; @@ -88,6 +89,7 @@ imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *g cairo_stroke(cr); cairo_destroy(cr); } + */ return FALSE; } diff --git a/pidgin/plugins/themeedit.c b/pidgin/plugins/themeedit.c index 0290d36075..9ff95f3b7b 100644 --- a/pidgin/plugins/themeedit.c +++ b/pidgin/plugins/themeedit.c @@ -306,7 +306,6 @@ pidgin_blist_theme_edit(PurplePluginAction *unused) } } - gtk_dialog_set_has_separator(GTK_DIALOG(dialog), TRUE); #ifdef NOT_SADRUL pidgin_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_SAVE, G_CALLBACK(save_blist_theme), dialog); #endif diff --git a/pidgin/plugins/ticker/gtkticker.c b/pidgin/plugins/ticker/gtkticker.c index d4c11a8105..7423806a25 100644 --- a/pidgin/plugins/ticker/gtkticker.c +++ b/pidgin/plugins/ticker/gtkticker.c @@ -128,7 +128,7 @@ static void gtk_ticker_class_init (GtkTickerClass *class) widget_class->map = gtk_ticker_map; widget_class->realize = gtk_ticker_realize; - widget_class->size_request = gtk_ticker_size_request; + /*widget_class->size_request = gtk_ticker_size_request;*/ widget_class->size_allocate = gtk_ticker_size_allocate; container_class->add = gtk_ticker_add_real; @@ -178,7 +178,7 @@ static void gtk_ticker_put (GtkTicker *ticker, GtkWidget *widget) ticker->children = g_list_append (ticker->children, child_info); - if (gtk_widget_get_realized (ticker)) + if (gtk_widget_get_realized (GTK_WIDGET(ticker))) gtk_widget_realize (widget); if (gtk_widget_get_visible (GTK_WIDGET (ticker)) && @@ -332,11 +332,11 @@ static void gtk_ticker_realize (GtkWidget *widget) #endif attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); + /*attributes.colormap = gtk_widget_get_colormap (widget);*/ attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK; - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL /*| GDK_WA_COLORMAP*/; window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); diff --git a/pidgin/plugins/timestamp.c b/pidgin/plugins/timestamp.c index 0f46f47221..8540ea73be 100644 --- a/pidgin/plugins/timestamp.c +++ b/pidgin/plugins/timestamp.c @@ -134,7 +134,7 @@ get_config_frame(PurplePlugin *plugin) GtkWidget *ret; GtkWidget *frame, *label; GtkWidget *vbox, *hbox; - GtkObject *adj; + GtkAdjustment *adj; GtkWidget *spinner; ret = gtk_vbox_new(FALSE, 18); diff --git a/pidgin/plugins/timestamp_format.c b/pidgin/plugins/timestamp_format.c index 03cf2f8728..49fa7432bb 100644 --- a/pidgin/plugins/timestamp_format.c +++ b/pidgin/plugins/timestamp_format.c @@ -155,8 +155,9 @@ menu_cb(GtkWidget *item, gpointer data) if (!frame) return; + /* GTK_DIALOG_NO_SEPARATOR seems to be gone in gtk+ 3.0... */ dialog = gtk_dialog_new_with_buttons(PIDGIN_ALERT_TITLE, NULL, - GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); g_signal_connect_after(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), dialog); diff --git a/pidgin/plugins/vvconfig.c b/pidgin/plugins/vvconfig.c index d125703c7c..44bfd28f0e 100644 --- a/pidgin/plugins/vvconfig.c +++ b/pidgin/plugins/vvconfig.c @@ -506,14 +506,14 @@ plugin_load(PurplePlugin *plugin) } static void -config_destroy(GtkObject *w, gpointer nul) +config_destroy(GtkWidget *w, gpointer nul) { purple_debug_info("vvconfig", "closing vv configuration window\n"); window = NULL; } static void -config_close(GtkObject *w, gpointer nul) +config_close(GtkWidget *w, gpointer nul) { gtk_widget_destroy(GTK_WIDGET(window)); } diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index 38c2eb1451..b22327162b 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -274,7 +274,7 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); + /* TODO: how to set no separator for GtkDialog in gtk+ 3.0... */ gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); #if GTK_CHECK_VERSION(2,14,0) @@ -302,11 +302,11 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) gtk_size_group_add_widget(sg, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - type_combo = gtk_combo_box_new_text(); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "get"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "set"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "result"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); + type_combo = gtk_combo_box_text_new(); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "get"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "set"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "result"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); @@ -325,7 +325,7 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) to && *to ? to : "", to && *to ? "'" : "", g_random_int(), - gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo))); + gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo))); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); gtk_text_buffer_set_text(buffer, stanza, -1); @@ -362,7 +362,9 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); + + /* TODO: find a way to specify no separator for a dialog in gtk+ 3 */ + /*gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);*/ gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); #if GTK_CHECK_VERSION(2,14,0) @@ -389,15 +391,15 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - type_combo = gtk_combo_box_new_text(); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "default"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unavailable"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "subscribe"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unsubscribe"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "subscribed"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unsubscribed"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "probe"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); + type_combo = gtk_combo_box_text_new(); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "default"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unavailable"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "subscribe"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unsubscribe"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "subscribed"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unsubscribed"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "probe"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); @@ -407,12 +409,12 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - show_combo = gtk_combo_box_new_text(); - gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "default"); - gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "away"); - gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "dnd"); - gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "xa"); - gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "chat"); + show_combo = gtk_combo_box_text_new(); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "default"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "away"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "dnd"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "xa"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "chat"); gtk_combo_box_set_active(GTK_COMBO_BOX(show_combo), 0); gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); @@ -450,10 +452,10 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) } to = gtk_entry_get_text(GTK_ENTRY(to_entry)); - type = gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo)); + type = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo)); if (!strcmp(type, "default")) type = ""; - show = gtk_combo_box_get_active_text(GTK_COMBO_BOX(show_combo)); + show = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(show_combo)); if (!strcmp(show, "default")) show = ""; status = gtk_entry_get_text(GTK_ENTRY(status_entry)); @@ -520,7 +522,8 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); + /* TODO: find a way to create a dialog without separtor in gtk+ 3 */ + /*gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);*/ gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); #if GTK_CHECK_VERSION(2,14,0) @@ -547,12 +550,12 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - type_combo = gtk_combo_box_new_text(); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "chat"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "headline"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "groupchat"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "normal"); - gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); + type_combo = gtk_combo_box_text_new(); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "chat"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "headline"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "groupchat"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "normal"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); @@ -613,7 +616,8 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) *to ? to : "", *to ? "'" : "", g_random_int(), - gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo)), + gtk_combo_box_text_get_active_text( + GTK_COMBO_BOX_TEXT(type_combo)), *body ? "" : "", *body ? body : "", @@ -643,7 +647,8 @@ signing_on_cb(PurpleConnection *gc) if (!console) return; - gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), purple_account_get_username(gc->account)); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), + purple_account_get_username(gc->account)); console->accounts = g_list_append(console->accounts, gc); console->count++; @@ -674,7 +679,7 @@ signed_off_cb(PurpleConnection *gc) if (l == NULL) return; - gtk_combo_box_remove_text(GTK_COMBO_BOX(console->dropdown), i); + gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(console->dropdown), i); console->accounts = g_list_remove(console->accounts, gc); console->count--; @@ -716,7 +721,7 @@ plugin_unload(PurplePlugin *plugin) } static void -console_destroy(GtkObject *window, gpointer nul) +console_destroy(GtkWidget *window, gpointer nul) { g_list_free(console->accounts); g_free(console); @@ -731,8 +736,9 @@ dropdown_changed_cb(GtkComboBox *widget, gpointer nul) if (!console) return; - account = purple_accounts_find(gtk_combo_box_get_active_text(GTK_COMBO_BOX(console->dropdown)), - "prpl-jabber"); + account = + purple_accounts_find(gtk_combo_box_text_get_active_text( + GTK_COMBO_BOX_TEXT(console->dropdown)), "prpl-jabber"); if (!account || !account->gc) return; @@ -768,13 +774,13 @@ create_console(PurplePluginAction *action) label = gtk_label_new(_("Account: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_box_pack_start(GTK_BOX(console->hbox), label, FALSE, FALSE, 0); - console->dropdown = gtk_combo_box_new_text(); + console->dropdown = gtk_combo_box_text_new(); for (connections = purple_connections_get_all(); connections; connections = connections->next) { PurpleConnection *gc = connections->data; if (!strcmp(purple_account_get_protocol_id(purple_connection_get_account(gc)), "prpl-jabber")) { console->count++; console->accounts = g_list_append(console->accounts, gc); - gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), purple_account_get_username(purple_connection_get_account(gc))); if (!console->gc) console->gc = gc; -- cgit v1.2.1 From 00486005894ae3beea7506405682ee631627fce0 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Sun, 28 Nov 2010 20:36:20 +0000 Subject: GtkDocklet doesn't have a blinking property anymore, so remove this option... --- pidgin/gtkdocklet-gtk.c | 9 --------- pidgin/gtkdocklet.c | 18 ------------------ 2 files changed, 27 deletions(-) diff --git a/pidgin/gtkdocklet-gtk.c b/pidgin/gtkdocklet-gtk.c index 1b9ed3c8f6..5885763db7 100644 --- a/pidgin/gtkdocklet-gtk.c +++ b/pidgin/gtkdocklet-gtk.c @@ -51,9 +51,6 @@ static void docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) { const gchar *icon_name = NULL; - gboolean blinking; - - g_object_get(G_OBJECT(docklet), "blinking", &blinking, NULL); switch (status) { case PURPLE_STATUS_OFFLINE: @@ -84,12 +81,6 @@ docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting if (icon_name) { gtk_status_icon_set_from_icon_name(docklet, icon_name); } - - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")) { - g_object_set(G_OBJECT(docklet), "blinking", pending && !connecting, NULL); - } else if (blinking) { - g_object_set(G_OBJECT(docklet), "blinking", FALSE, NULL); - } } static void diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index f56a67cf91..48f6c02242 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -210,12 +210,6 @@ docklet_update_status(void) connecting = newconnecting; pidgin_docklet_update_icon(); - - /* and schedule the blinker function if messages are pending */ - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink") - && pending && !connecting && docklet_blinking_timer == 0) { - docklet_blinking_timer = g_timeout_add(500, docklet_blink_icon, NULL); - } } return FALSE; /* for when we're called by the glib idle handler */ @@ -319,13 +313,6 @@ docklet_toggle_mute(GtkWidget *toggle, void *data) gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); } -static void -docklet_toggle_blink(GtkWidget *toggle, void *data) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/blink", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); -} - static void docklet_toggle_blist(GtkWidget *toggle, void *data) { @@ -736,11 +723,6 @@ docklet_menu(void) g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - menuitem = gtk_check_menu_item_new_with_mnemonic(_("_Blink on New Message")); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")); - g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blink), NULL); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - pidgin_separator(menu); /* add plugin actions */ -- cgit v1.2.1 From a4539a6582d6a0c25b8774a67897fb6181e105e6 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Sun, 28 Nov 2010 20:48:38 +0000 Subject: replace 'expose_event' with 'draw' --- pidgin/gtkblist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 0bc841f154..968e323491 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -6120,7 +6120,7 @@ static void pidgin_blist_show(PurpleBuddyList *list) G_CALLBACK(headline_style_set), NULL); g_signal_connect (gtkblist->headline_hbox, - "expose_event", + "draw", G_CALLBACK (paint_headline_hbox), NULL); gtk_widget_set_name(gtkblist->headline_hbox, "gtk-tooltips"); -- cgit v1.2.1 From c4a88e1d3b74908f7ec40d011b0543685c65fb92 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Sun, 28 Nov 2010 20:54:02 +0000 Subject: change property expanded to is-expanded --- pidgin/gtkcellrendererexpander.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkcellrendererexpander.c b/pidgin/gtkcellrendererexpander.c index 9a46ab87cc..55336f2fa5 100644 --- a/pidgin/gtkcellrendererexpander.c +++ b/pidgin/gtkcellrendererexpander.c @@ -250,7 +250,7 @@ static void pidgin_cell_renderer_expander_render(GtkCellRenderer *cell, GtkAllocation allocation; gtk_cell_renderer_get_padding(cell, &xpad, &ypad); - g_object_get(G_OBJECT(cell), "expanded", &is_expanded, NULL); + g_object_get(G_OBJECT(cell), "is-expanded", &is_expanded, NULL); if (!cellexpander->is_expander) return; -- cgit v1.2.1 From 3e468ab9a81117d258448636205c785d7a2ac6a6 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Sun, 28 Nov 2010 21:00:42 +0000 Subject: avoid illegal gobject cast here --- pidgin/gtkcellrendererexpander.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkcellrendererexpander.c b/pidgin/gtkcellrendererexpander.c index 55336f2fa5..4d96a0ac65 100644 --- a/pidgin/gtkcellrendererexpander.c +++ b/pidgin/gtkcellrendererexpander.c @@ -258,7 +258,7 @@ static void pidgin_cell_renderer_expander_render(GtkCellRenderer *cell, width = cell_area->width; height = cell_area->height; - if (!gtk_widget_get_sensitive(GTK_WIDGET(cell))) + if (!gtk_widget_get_sensitive(widget)) state = GTK_STATE_INSENSITIVE; else if (flags & GTK_CELL_RENDERER_PRELIT) state = GTK_STATE_PRELIGHT; -- cgit v1.2.1 From b6dccdf9f11cc5a32fb1dde06580e3402f630daf Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Sun, 28 Nov 2010 21:48:26 +0000 Subject: make the buddy list tooltips work again --- pidgin/gtkblist.c | 2 +- pidgin/pidgintooltip.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 968e323491..df79a4f788 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3028,7 +3028,7 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) for(l = gtkblist->tooltipdata; l; l = l->next) { struct tooltip_data *td = l->data; - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtkblist->tipwindow)); + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(gtkblist->tipwindow))); if (td->avatar && pidgin_gdk_pixbuf_is_opaque(td->avatar)) { diff --git a/pidgin/pidgintooltip.c b/pidgin/pidgintooltip.c index fbd3232788..107d23e659 100644 --- a/pidgin/pidgintooltip.c +++ b/pidgin/pidgintooltip.c @@ -101,15 +101,17 @@ void pidgin_tooltip_destroy() } static gboolean -pidgin_tooltip_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) +pidgin_tooltip_draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data) { + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + if (pidgin_tooltip.paint_tooltip) { - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget))); gtk_paint_flat_box(gtk_widget_get_style(widget), cr, - GTK_STATE_NORMAL, GTK_SHADOW_OUT, - widget, "tooltip", 0, 0, -1, -1); + GTK_STATE_NORMAL, GTK_SHADOW_OUT, + widget, "tooltip", 0, 0, allocation.width, allocation.height); pidgin_tooltip.paint_tooltip(widget, data); - cairo_destroy(cr); } return FALSE; } @@ -182,8 +184,8 @@ setup_tooltip_window_position(gpointer data, int w, int h) gtk_window_move(GTK_WINDOW(tipwindow), x, y); gtk_widget_show(tipwindow); - g_signal_connect(G_OBJECT(tipwindow), "expose_event", - G_CALLBACK(pidgin_tooltip_expose_event), data); + g_signal_connect(G_OBJECT(tipwindow), "draw", + G_CALLBACK(pidgin_tooltip_draw_cb), data); /* Hide the tooltip when the widget is destroyed */ sig = g_signal_connect(G_OBJECT(pidgin_tooltip.widget), "destroy", G_CALLBACK(pidgin_tooltip_destroy), NULL); -- cgit v1.2.1 From 7f9daaefdf0b479862c7d8d9d428c4ecc9c56daf Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Sun, 28 Nov 2010 22:52:10 +0000 Subject: it's now possible to start conversations without glib fatal warnings... --- pidgin/gtkconv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index f574159d81..21516e71be 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3579,6 +3579,10 @@ setup_menubar(PidginWindow *win) gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/SendFile"); + g_object_set_data(G_OBJECT(win->window), "get_attention", + gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/GetAttention")); + win->menu.add_pounce = gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/AddBuddyPounce"); @@ -6612,7 +6616,7 @@ gray_stuff_out(PidginConversation *gtkconv) /* Deal with menu items */ gtk_action_set_visible(win->menu.view_log, TRUE); gtk_action_set_visible(win->menu.send_file, TRUE); - gtk_action_set_visible(g_object_get_data(G_OBJECT(win->window), "get_attention"), TRUE); + gtk_action_set_visible(GTK_ACTION(g_object_get_data(G_OBJECT(win->window), "get_attention")), TRUE); gtk_action_set_visible(win->menu.add_pounce, TRUE); gtk_action_set_visible(win->menu.get_info, TRUE); gtk_action_set_visible(win->menu.invite, FALSE); @@ -9748,8 +9752,7 @@ pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv) gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox); } - g_object_set(G_OBJECT(win->notebook), "expand", !tabs_side && !angle, - "fill", TRUE, NULL); + g_object_set(G_OBJECT(win->notebook), "expand", !tabs_side && !angle, NULL); if (pidgin_conv_window_get_gtkconv_count(win) == 1) gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), -- cgit v1.2.1 From fc7369d7c816c82b190dad23f3284e616537d47d Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Mon, 29 Nov 2010 07:30:49 +0000 Subject: GtkDialog doesn't have a 'has-separator' property anymore --- pidgin/gtkutils.c | 1 - 1 file changed, 1 deletion(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 9e303acda2..0349e32b1c 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -180,7 +180,6 @@ pidgin_create_dialog(const char *title, guint border_width, const char *role, gb wnd = GTK_WINDOW(gtk_dialog_new()); pidgin_window_init(wnd, title, border_width, role, resizable); - g_object_set(G_OBJECT(wnd), "has-separator", FALSE, NULL); return GTK_WIDGET(wnd); } -- cgit v1.2.1 From fff6996ea015726d6a00a338362cf57144ff1cc1 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Mon, 29 Nov 2010 08:05:42 +0000 Subject: don't crash when switching tabs --- pidgin/gtkconv.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 21516e71be..1fc0fbfbaa 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -4675,15 +4675,15 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv) int min_height; gboolean interior_focus; int focus_width; - GtkAllocation imhtml_allocation; - GtkAllocation entry_allocation; - GtkAllocation lower_hbox_allocation; + GtkAllocation imhtml_allocation; + GtkAllocation entry_allocation; + GtkAllocation lower_hbox_allocation; - gtk_widget_get_allocation(gtkconv->imhtml, &imhtml_allocation); - gtk_widget_get_allocation(gtkconv->entry, &entry_allocation); - gtk_widget_get_allocation(gtkconv->lower_hbox, &lower_hbox_allocation); - total_height = imhtml_allocation.height + entry_allocation.height; - max_height = total_height / 2; + gtk_widget_get_allocation(gtkconv->imhtml, &imhtml_allocation); + gtk_widget_get_allocation(gtkconv->entry, &entry_allocation); + gtk_widget_get_allocation(gtkconv->lower_hbox, &lower_hbox_allocation); + total_height = imhtml_allocation.height + entry_allocation.height; + max_height = total_height / 2; pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); @@ -4721,6 +4721,9 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv) if (ABS(diff) < oneline.height / 2) return FALSE; + purple_debug_info("pidgin", "resizing to %d, %d lines\n", + lower_hbox_allocation.height, min_lines); + gtk_widget_set_size_request(gtkconv->lower_hbox, -1, diff + lower_hbox_allocation.height); @@ -7309,11 +7312,11 @@ pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right) count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); for (i = 0; i < count; i++) { - GtkAllocation allocation; + GtkAllocation allocation; - gtk_widget_get_allocation(tab, &allocation); page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i); tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page); + gtk_widget_get_allocation(tab, &allocation); /* Make sure the tab is not hidden beyond an arrow */ if (!gtk_widget_is_drawable(tab) && gtk_notebook_get_show_tabs(notebook)) -- cgit v1.2.1 From 03761e765515decc4439b8bcd1f0fe2fc0d34dde Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Mon, 29 Nov 2010 09:23:05 +0000 Subject: I think draw should replace expose_event here, but the status selector is still not seen... --- pidgin/gtkconv.c | 4 ++-- pidgin/gtkstatusbox.c | 25 ++++++++++++------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 1fc0fbfbaa..e1c88be52d 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -4721,8 +4721,8 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv) if (ABS(diff) < oneline.height / 2) return FALSE; - purple_debug_info("pidgin", "resizing to %d, %d lines\n", - lower_hbox_allocation.height, min_lines); + purple_debug_info("pidgin", "resizing to %d, %d lines, diff %d\n", + diff + lower_hbox_allocation.height, min_lines, diff); gtk_widget_set_size_request(gtkconv->lower_hbox, -1, diff + lower_hbox_allocation.height); diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index e1fc6d94be..b919886fa5 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -84,7 +84,7 @@ static void pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean s static void pidgin_status_box_changed(PidginStatusBox *box); /*static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition);*/ static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -/*static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event);*/ +static gboolean pidgin_status_box_draw (GtkWidget *widget, cairo_t *cr); static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box); static void pidgin_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); static void pidgin_status_box_popup(PidginStatusBox *box); @@ -619,8 +619,7 @@ pidgin_status_box_class_init (PidginStatusBoxClass *klass) /* this seems to be removed in GTK+ 3...*/ /*widget_class->size_request = pidgin_status_box_size_request;*/ widget_class->size_allocate = pidgin_status_box_size_allocate; - /* this seems to be removed in GTK+ 3...*/ - /*widget_class->expose_event = pidgin_status_box_expose_event;*/ + widget_class->draw = pidgin_status_box_draw; container_class->child_type = pidgin_status_box_child_type; container_class->forall = pidgin_status_box_forall; @@ -1748,7 +1747,7 @@ pidgin_status_box_init (PidginStatusBox *status_box) GtkWidget *toplevel; GtkTreeSelection *sel; - gtk_widget_set_has_window(GTK_WIDGET(status_box), FALSE); + gtk_widget_set_has_window(GTK_WIDGET(status_box), FALSE); status_box->imhtml_visible = FALSE; status_box->network_available = purple_network_is_available(); status_box->connecting = FALSE; @@ -2045,23 +2044,23 @@ pidgin_status_box_size_allocate(GtkWidget *widget, gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation); } -/* TODO: don't think this is nessesary in GTK+ 3 */ -#if 0 static gboolean -pidgin_status_box_expose_event(GtkWidget *widget, - GdkEventExpose *event) +pidgin_status_box_draw(GtkWidget *widget, cairo_t *cr) { PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); - gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->vbox, event); - gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->toggle_button, event); + gtk_widget_draw(status_box->vbox, cr); + gtk_widget_draw(status_box->toggle_button, cr); + if (status_box->icon_box && status_box->icon_opaque) { - gtk_paint_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, - status_box->icon_box, "button", status_box->icon_box->allocation.x-1, status_box->icon_box->allocation.y-1, + GtkAllocation allocation; + + gtk_widget_get_allocation(status_box->icon_box, &allocation); + gtk_paint_box(gtk_widget_get_style(widget), cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + status_box->icon_box, "button", allocation.x-1, allocation.y-1, 34, 34); } return FALSE; } -#endif static void pidgin_status_box_forall(GtkContainer *container, -- cgit v1.2.1 From 44027f3e9accfba0d4a0457f51af06e6eac95798 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Mon, 29 Nov 2010 13:09:01 +0000 Subject: the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right... --- pidgin/gtkstatusbox.c | 68 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index b919886fa5..3217b6963a 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -82,7 +82,8 @@ static void pidgin_status_box_refresh(PidginStatusBox *status_box); static void status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed); static void pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed); static void pidgin_status_box_changed(PidginStatusBox *box); -/*static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition);*/ +static void pidgin_status_box_get_preferred_height (GtkWidget *widget, + gint *minimum_height, gint *natural_height); static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gboolean pidgin_status_box_draw (GtkWidget *widget, cairo_t *cr); static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box); @@ -616,8 +617,7 @@ pidgin_status_box_class_init (PidginStatusBoxClass *klass) parent_class = g_type_class_peek_parent(klass); widget_class = (GtkWidgetClass*)klass; - /* this seems to be removed in GTK+ 3...*/ - /*widget_class->size_request = pidgin_status_box_size_request;*/ + widget_class->get_preferred_height = pidgin_status_box_get_preferred_height; widget_class->size_allocate = pidgin_status_box_size_allocate; widget_class->draw = pidgin_status_box_draw; @@ -1931,30 +1931,62 @@ pidgin_status_box_init (PidginStatusBox *status_box) } -/* TODO: is this needed in GTK+ 3? */ #if 0 static void -pidgin_status_box_size_request(GtkWidget *widget, - GtkRequisition *requisition) +pidgin_status_box_get_preferred_size(GtkWidget *widget, + GtkRequisition *minimum_size, GtkRequisition *natural_size) { - GtkRequisition box_req; + GtkRequisition box_min_req; + GtkRequisition box_nat_req; gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); - gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->toggle_button, requisition); + gtk_widget_get_preferred_size(PIDGIN_STATUS_BOX(widget)->toggle_button, + minimum_size, natural_size); /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ - requisition->height = MAX(requisition->height, 34); - requisition->height += border_width * 2; - + minimum_size->height = MAX(minimum_size->height, 34); + minimum_size->height += border_width * 2; + natural_size->height = MAX(minium_size->height, 34); + natural_size->height += border_width * 2; + /* If the gtkimhtml is visible, then add some additional padding */ - gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->vbox, &box_req); - if (box_req.height > 1) - requisition->height += box_req.height + border_width * 2; + gtk_widget_get_preferred_size(PIDGIN_STATUS_BOX(widget)->vbox, &box_min_req, &box_nat_req); + + if (box_min_req.height > 1) + minimum_size->height += box_min_req.height + border_width * 2; - requisition->width = 1; + if (box_nat_req.height > 1) + natural_size->height += box_nat_req.height + border_width * 2; + + minimum_size->width = 1; + natural_size->width = 1; } #endif +static void +pidgin_status_box_get_preferred_height(GtkWidget *widget, gint *minimum_height, + gint *natural_height) +{ + gint box_min_height, box_nat_height; + gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); + + gtk_widget_get_preferred_height(PIDGIN_STATUS_BOX(widget)->toggle_button, + minimum_height, natural_height); + + *minimum_height = MAX(*minimum_height, 34) + border_width * 2; + *natural_height = MAX(*natural_height, 34) + border_width * 2; + + /* If the gtkimhtml is visible, then add some additional padding */ + gtk_widget_get_preferred_height(PIDGIN_STATUS_BOX(widget)->vbox, + &box_min_height, &box_nat_height); + + if (box_min_height > 1) + *minimum_height += box_min_height + border_width * 2; + + if (box_nat_height > 1) + *natural_height += box_nat_height + border_width * 2; +} + /* From gnome-panel */ static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift) @@ -2000,7 +2032,7 @@ pidgin_status_box_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); - GtkRequisition req = {0,0}; + GtkRequisition req = {0,40}; GtkAllocation parent_alc, box_alc, icon_alc; gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); @@ -2041,7 +2073,9 @@ pidgin_status_box_size_allocate(GtkWidget *widget, gtk_widget_size_allocate(status_box->icon_box, &icon_alc); } gtk_widget_size_allocate(status_box->toggle_button, &parent_alc); - gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation); + gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation); + purple_debug_info("pidgin", "statusbox allocation: width = %d, height = %d\n", + allocation->width, allocation->height); } static gboolean -- cgit v1.2.1 From f4244e58048ab180d0b4674b0cb453c0d3225f12 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Mon, 29 Nov 2010 15:48:29 +0000 Subject: remove unused code --- pidgin/gtkstatusbox.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index 3217b6963a..cca5374e5d 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -1931,38 +1931,6 @@ pidgin_status_box_init (PidginStatusBox *status_box) } -#if 0 -static void -pidgin_status_box_get_preferred_size(GtkWidget *widget, - GtkRequisition *minimum_size, GtkRequisition *natural_size) -{ - GtkRequisition box_min_req; - GtkRequisition box_nat_req; - gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); - - gtk_widget_get_preferred_size(PIDGIN_STATUS_BOX(widget)->toggle_button, - minimum_size, natural_size); - - /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ - minimum_size->height = MAX(minimum_size->height, 34); - minimum_size->height += border_width * 2; - natural_size->height = MAX(minium_size->height, 34); - natural_size->height += border_width * 2; - - /* If the gtkimhtml is visible, then add some additional padding */ - gtk_widget_get_preferred_size(PIDGIN_STATUS_BOX(widget)->vbox, &box_min_req, &box_nat_req); - - if (box_min_req.height > 1) - minimum_size->height += box_min_req.height + border_width * 2; - - if (box_nat_req.height > 1) - natural_size->height += box_nat_req.height + border_width * 2; - - minimum_size->width = 1; - natural_size->width = 1; -} -#endif - static void pidgin_status_box_get_preferred_height(GtkWidget *widget, gint *minimum_height, gint *natural_height) -- cgit v1.2.1 From fce7473fdb3ed86572828870af4bab737d409256 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Mon, 29 Nov 2010 22:14:00 +0000 Subject: fix indentation and remove some unused code --- pidgin/gtkblist.c | 73 +++++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 48 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index df79a4f788..119ac20dd8 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3028,7 +3028,7 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) for(l = gtkblist->tooltipdata; l; l = l->next) { struct tooltip_data *td = l->data; - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(gtkblist->tipwindow))); + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(gtkblist->tipwindow))); if (td->avatar && pidgin_gdk_pixbuf_is_opaque(td->avatar)) { @@ -3036,7 +3036,7 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) gtk_paint_flat_box(style, cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkblist->tipwindow, "tooltip", TOOLTIP_BORDER -1, current_height -1, td->avatar_width +2, - td->avatar_height + 2); + td->avatar_height + 2); else gtk_paint_flat_box(style, cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkblist->tipwindow, "tooltip", @@ -3046,55 +3046,32 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) if (td->status_icon) { if (dir == GTK_TEXT_DIR_RTL) { - gdk_cairo_set_source_pixbuf(cr, td->status_icon, - max_width - TOOLTIP_BORDER - status_size, current_height); - cairo_paint(cr); - /* - gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon, - 0, 0, max_width - TOOLTIP_BORDER - status_size, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); - */ - } else { - gdk_cairo_set_source_pixbuf(cr, td->status_icon, TOOLTIP_BORDER, current_height); - cairo_paint(cr); - /* - gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon, - 0, 0, TOOLTIP_BORDER, current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); - */ - } - } - - if(td->avatar) { + gdk_cairo_set_source_pixbuf(cr, td->status_icon, + max_width - TOOLTIP_BORDER - status_size, current_height); + cairo_paint(cr); + } else { + gdk_cairo_set_source_pixbuf(cr, td->status_icon, TOOLTIP_BORDER, current_height); + cairo_paint(cr); + } + } + + if (td->avatar) { if (dir == GTK_TEXT_DIR_RTL) { - gdk_cairo_set_source_pixbuf(cr, td->avatar, TOOLTIP_BORDER, current_height); - cairo_paint(cr); - /* - gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, - td->avatar, 0, 0, TOOLTIP_BORDER, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); - */ - } else { - gdk_cairo_set_source_pixbuf(cr, td->avatar, - max_width - (td->avatar_width + TOOLTIP_BORDER), current_height); - cairo_paint(cr); - /* - gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, - td->avatar, 0, 0, max_width - (td->avatar_width + TOOLTIP_BORDER), - current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); - */ - } + gdk_cairo_set_source_pixbuf(cr, td->avatar, TOOLTIP_BORDER, + current_height); + cairo_paint(cr); + } else { + gdk_cairo_set_source_pixbuf(cr, td->avatar, + max_width - (td->avatar_width + TOOLTIP_BORDER), current_height); + cairo_paint(cr); + } } if (!td->avatar_is_prpl_icon && td->prpl_icon) { - gdk_cairo_set_source_pixbuf(cr, td->prpl_icon, prpl_col, - current_height + ((td->name_height / 2) - (PRPL_SIZE / 2))); - cairo_paint(cr); - /* - gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->prpl_icon, - 0, 0, - prpl_col, - current_height + ((td->name_height / 2) - (PRPL_SIZE / 2)), - -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); - */ - } + gdk_cairo_set_source_pixbuf(cr, td->prpl_icon, prpl_col, + current_height + ((td->name_height / 2) - (PRPL_SIZE / 2))); + cairo_paint(cr); + } if (td->name_layout) { if (dir == GTK_TEXT_DIR_RTL) { @@ -3123,7 +3100,7 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) } } - cairo_destroy(cr); + cairo_destroy(cr); current_height += MAX(td->name_height + td->height, td->avatar_height) + td->padding; } return FALSE; -- cgit v1.2.1 From 1205ec6cdb2a127279ca9f0f8d3dcaf622afb66e Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Tue, 30 Nov 2010 09:03:34 +0000 Subject: fixed some indentation --- pidgin/gtkimhtml.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 3aac3e1685..8ed982282f 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -499,22 +499,20 @@ static gint gtk_imhtml_tip_paint (GtkIMHtml *imhtml) { PangoLayout *layout; - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(imhtml->tip_window)); + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(imhtml->tip_window)); g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); layout = gtk_widget_create_pango_layout(imhtml->tip_window, imhtml->tip); - gtk_paint_flat_box (gtk_widget_get_style(imhtml->tip_window), - cr, - GTK_STATE_NORMAL, GTK_SHADOW_OUT, imhtml->tip_window, - "tooltip", 0, 0, -1, -1); + gtk_paint_flat_box (gtk_widget_get_style(imhtml->tip_window), cr, + GTK_STATE_NORMAL, GTK_SHADOW_OUT, imhtml->tip_window, "tooltip", + 0, 0, -1, -1); - gtk_paint_layout (gtk_widget_get_style(imhtml->tip_window), - cr, - GTK_STATE_NORMAL, TRUE, imhtml->tip_window, NULL, 4, 4, layout); + gtk_paint_layout (gtk_widget_get_style(imhtml->tip_window), cr, + GTK_STATE_NORMAL, TRUE, imhtml->tip_window, NULL, 4, 4, layout); - cairo_destroy(cr); + cairo_destroy(cr); g_object_unref(layout); return FALSE; } @@ -526,13 +524,13 @@ gtk_imhtml_tip (gpointer data) PangoFontMetrics *font_metrics; PangoLayout *layout; PangoFont *font; - GtkStyle *style = gtk_widget_get_style(imhtml->tip_window); - GtkAllocation allocation; + GtkStyle *style = gtk_widget_get_style(imhtml->tip_window); + GtkAllocation allocation; gint gap, x, y, h, w, scr_w, baseline_skip; g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); - gtk_widget_get_allocation(GTK_WIDGET(imhtml), &allocation); + gtk_widget_get_allocation(GTK_WIDGET(imhtml), &allocation); if (!imhtml->tip || !gtk_widget_is_drawable(GTK_WIDGET(imhtml))) { imhtml->tip_timer = 0; -- cgit v1.2.1 From 931fb8b5cca7d23a9925e0c2b13a2adbd9790d64 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Wed, 1 Dec 2010 09:41:56 +0000 Subject: don't restrain the size of the 'welcome to pidgin' widget, as this makes the blist un-resizable to a smaller width, as far as I can tell stuff works as it should still... --- pidgin/gtkblist.c | 1 - pidgin/gtkstatusbox.c | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 119ac20dd8..dfa7b3c084 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -6067,7 +6067,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) pretty = pidgin_make_pretty_arrows(tmp); g_free(tmp); label = gtk_label_new(NULL); - gtk_widget_set_size_request(label, purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width") - 12, -1); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.2); gtk_label_set_markup(GTK_LABEL(label), pretty); diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index cca5374e5d..9e8c229853 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -1883,7 +1883,7 @@ pidgin_status_box_init (PidginStatusBox *status_box) gtk_widget_set_parent(status_box->toggle_button, GTK_WIDGET(status_box)); gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0); - + g_signal_connect(G_OBJECT(status_box), "scroll_event", G_CALLBACK(combo_box_scroll_event_cb), NULL); g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event", G_CALLBACK(imhtml_scroll_event_cb), status_box->imhtml); @@ -2570,7 +2570,11 @@ static void update_size(PidginStatusBox *status_box) if (!interior_focus) height += 2 * focus_width; - gtk_widget_set_size_request(status_box->vbox, -1, height + PIDGIN_HIG_BOX_SPACE); + int mh, nh; + gtk_widget_get_preferred_height(status_box->vbox, &mh, &nh); + purple_debug_info("pidgin", "statusbox, set_size_request: %d %d\n", mh, nh); + + gtk_widget_set_size_request(status_box->imhtml, -1, height + PIDGIN_HIG_BOX_SPACE); } static void remove_typing_cb(PidginStatusBox *status_box) -- cgit v1.2.1 From 1e0e120307d1b2ddd56a84f3a9adda56fd558ca5 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Wed, 1 Dec 2010 10:44:54 +0000 Subject: this wasn't really mean to be commited... --- pidgin/gtkstatusbox.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index 9e8c229853..cca5374e5d 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -1883,7 +1883,7 @@ pidgin_status_box_init (PidginStatusBox *status_box) gtk_widget_set_parent(status_box->toggle_button, GTK_WIDGET(status_box)); gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0); - + g_signal_connect(G_OBJECT(status_box), "scroll_event", G_CALLBACK(combo_box_scroll_event_cb), NULL); g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event", G_CALLBACK(imhtml_scroll_event_cb), status_box->imhtml); @@ -2570,11 +2570,7 @@ static void update_size(PidginStatusBox *status_box) if (!interior_focus) height += 2 * focus_width; - int mh, nh; - gtk_widget_get_preferred_height(status_box->vbox, &mh, &nh); - purple_debug_info("pidgin", "statusbox, set_size_request: %d %d\n", mh, nh); - - gtk_widget_set_size_request(status_box->imhtml, -1, height + PIDGIN_HIG_BOX_SPACE); + gtk_widget_set_size_request(status_box->vbox, -1, height + PIDGIN_HIG_BOX_SPACE); } static void remove_typing_cb(PidginStatusBox *status_box) -- cgit v1.2.1 From 2be1718207c66ddb4cf64270dab15c9d7ecd4f4a Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Thu, 2 Dec 2010 12:11:26 +0000 Subject: don't use GDK_DRAWABLE --- pidgin/gtkblist.c | 34 +++++++++++++++++----------------- pidgin/gtkimhtml.c | 2 +- pidgin/gtkplugin.c | 2 +- pidgin/gtkroomlist.c | 2 +- pidgin/gtkwhiteboard.c | 17 ++++++++--------- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index dfa7b3c084..9fde16299c 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3028,7 +3028,7 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) for(l = gtkblist->tooltipdata; l; l = l->next) { struct tooltip_data *td = l->data; - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(gtkblist->tipwindow))); + cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(gtkblist->tipwindow)); if (td->avatar && pidgin_gdk_pixbuf_is_opaque(td->avatar)) { @@ -3254,8 +3254,8 @@ static gboolean pidgin_blist_expand_timeout(GtkWidget *tv) pidgin_blist_expand_contact_cb(NULL, node); gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, >kblist->contact_rect); - gtkblist->contact_rect.width = - gdk_window_get_width(GDK_DRAWABLE(gtk_widget_get_window(tv))); + gtkblist->contact_rect.width = + gdk_window_get_width(gtk_widget_get_window(tv)); gtkblist->mouseover_contact = node; gtk_tree_path_down (path); while (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &i, path)) { @@ -5641,22 +5641,22 @@ paint_headline_hbox (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(widget)); - GtkAllocation allocation; + cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget)); + GtkAllocation allocation; - gtk_widget_get_allocation(widget, &allocation); + gtk_widget_get_allocation(widget, &allocation); gtk_paint_flat_box (gtk_widget_get_style(widget), - cr, - GTK_STATE_NORMAL, - GTK_SHADOW_OUT, - widget, - "tooltip", - allocation.x + 1, - allocation.y + 1, - allocation.width - 2, - allocation.height - 2); - cairo_destroy(cr); - + cr, + GTK_STATE_NORMAL, + GTK_SHADOW_OUT, + widget, + "tooltip", + allocation.x + 1, + allocation.y + 1, + allocation.width - 2, + allocation.height - 2); + cairo_destroy(cr); + return FALSE; } diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 8ed982282f..0e040106ec 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -499,7 +499,7 @@ static gint gtk_imhtml_tip_paint (GtkIMHtml *imhtml) { PangoLayout *layout; - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(imhtml->tip_window)); + cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(imhtml->tip_window)); g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); diff --git a/pidgin/gtkplugin.c b/pidgin/gtkplugin.c index ff82805fcd..0da7bdec55 100644 --- a/pidgin/gtkplugin.c +++ b/pidgin/gtkplugin.c @@ -562,7 +562,7 @@ static gboolean pidgin_plugins_paint_tooltip(GtkWidget *tipwindow, gpointer data) { PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(tipwindow))); + cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(tipwindow)); gtk_paint_layout(gtk_widget_get_style(tipwindow), cr, GTK_STATE_NORMAL, FALSE, tipwindow, "tooltip", 6, 6, layout); diff --git a/pidgin/gtkroomlist.c b/pidgin/gtkroomlist.c index 8ae843c95e..18d6d4a495 100644 --- a/pidgin/gtkroomlist.c +++ b/pidgin/gtkroomlist.c @@ -360,7 +360,7 @@ pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) int max_text_width; GtkTextDirection dir = gtk_widget_get_direction(GTK_WIDGET(grl->tree)); cairo_t *cr = - gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(grl->tipwindow))); + gdk_cairo_create(gtk_widget_get_window(grl->tipwindow)); style = gtk_widget_get_style(grl->tipwindow); diff --git a/pidgin/gtkwhiteboard.c b/pidgin/gtkwhiteboard.c index 75fbb9daa5..16185625d0 100644 --- a/pidgin/gtkwhiteboard.c +++ b/pidgin/gtkwhiteboard.c @@ -358,8 +358,8 @@ static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventCon PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; GdkPixbuf *pixbuf = gtkwb->pixbuf; cairo_t *cr; - GdkWindow *window = gtk_widget_get_window(widget); - GtkAllocation allocation; + GdkWindow *window = gtk_widget_get_window(widget); + GtkAllocation allocation; if (pixbuf) { cr = g_object_get_data(G_OBJECT(pixbuf), "cairo-context"); @@ -368,16 +368,15 @@ static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventCon g_object_unref(pixbuf); } - gtk_widget_get_allocation(widget, &allocation); + gtk_widget_get_allocation(widget, &allocation); - pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, - FALSE, - gdk_visual_get_depth(GDK_VISUAL(window)), - allocation.width, allocation.height); + pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, + FALSE, gdk_visual_get_depth(GDK_VISUAL(window)), + allocation.width, allocation.height); gtkwb->pixbuf = pixbuf; - cr = gdk_cairo_create(GDK_DRAWABLE(pixbuf)); + cr = gdk_cairo_create(gtk_widget_get_window(widget)); g_object_set_data(G_OBJECT(pixbuf), "cairo-context", cr); gdk_cairo_set_source_color(cr, >k_widget_get_style(widget)->white); cairo_rectangle(cr, @@ -394,7 +393,7 @@ static gboolean pidgin_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose GdkPixbuf *pixbuf = gtkwb->pixbuf; cairo_t *cr; - cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget))); + cr = gdk_cairo_create(gtk_widget_get_window(widget)); gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); cairo_rectangle(cr, event->area.x, event->area.y, -- cgit v1.2.1 From 58deee9ef0dee2249e31ed1d23b757cc25a7876a Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Fri, 3 Dec 2010 23:03:58 +0000 Subject: updates to work with the latest GTK+ --- configure.ac | 2 +- pidgin/gtkblist.c | 2 +- pidgin/gtkmedia.c | 4 ++-- pidgin/plugins/disco/gtkdisco.c | 2 +- pidgin/plugins/gestures/stroke-draw.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 35a720dc4a..1610bb40cf 100644 --- a/configure.ac +++ b/configure.ac @@ -416,7 +416,7 @@ else fi if test "x$enable_gtkui" = "xyes" ; then - PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 2.91.5], , [ + PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 2.91.6], , [ AC_MSG_RESULT(no) AC_MSG_ERROR([ diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 9fde16299c..b729476eae 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -6149,7 +6149,7 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtk_widget_show(gtkblist->treeview); gtk_widget_set_name(gtkblist->treeview, "pidgin_blist_treeview"); - + g_signal_connect(gtkblist->treeview, "style-set", G_CALLBACK(treeview_style_set), list); diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c index bf4f24e32f..7d2f4e224c 100644 --- a/pidgin/gtkmedia.c +++ b/pidgin/gtkmedia.c @@ -442,9 +442,9 @@ realize_cb_cb(PidginMediaRealizeData *data) window_id = GDK_WINDOW_HWND(priv->remote_video->window); #elif defined(HAVE_X11) if (data->participant == NULL) - window_id = GDK_WINDOW_XWINDOW(gtk_widget_get_window(priv->local_video)); + window_id = gdk_x11_window_get_xid(gtk_widget_get_window(priv->local_video)); else - window_id = GDK_WINDOW_XWINDOW(gtk_widget_get_window(priv->remote_video)); + window_id = gdk_x11_window_get_xid(gtk_widget_get_window(priv->remote_video)); #else # error "Unsupported windowing system" #endif diff --git a/pidgin/plugins/disco/gtkdisco.c b/pidgin/plugins/disco/gtkdisco.c index 73bc9d98b4..572230040d 100644 --- a/pidgin/plugins/disco/gtkdisco.c +++ b/pidgin/plugins/disco/gtkdisco.c @@ -429,7 +429,7 @@ static gboolean account_filter_func(PurpleAccount *account) static gboolean disco_paint_tooltip(GtkWidget *tipwindow, gpointer data) { - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(tipwindow)); + cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(tipwindow)); PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); gtk_paint_layout(gtk_widget_get_style(tipwindow), cr, diff --git a/pidgin/plugins/gestures/stroke-draw.c b/pidgin/plugins/gestures/stroke-draw.c index c9de72acf7..ff729264f6 100644 --- a/pidgin/plugins/gestures/stroke-draw.c +++ b/pidgin/plugins/gestures/stroke-draw.c @@ -339,7 +339,7 @@ gstroke_invisible_window_init (GtkWidget *widget) unsigned int border_width; XSizeHints hints; Display *disp = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget)); - Window wind = GDK_WINDOW_XWINDOW (gtk_widget_get_window(widget)); + Window wind = gdk_x11_window_get_xid(gtk_widget_get_window(widget)); int screen = DefaultScreen (disp); if (!gstroke_draw_strokes()) -- cgit v1.2.1 From f400d303c2dc52fc9e675af2cef40b8969fb1595 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 5 Dec 2010 08:14:52 +0000 Subject: Fix some indenting. --- pidgin/gtkimhtml.c | 162 ++++++++++++++++++++++++++--------------------------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index ff11ff52eb..a0e0381d32 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -510,7 +510,7 @@ gtk_imhtml_tip_paint (GtkIMHtml *imhtml) 0, 0, -1, -1); gtk_paint_layout (gtk_widget_get_style(imhtml->tip_window), cr, - GTK_STATE_NORMAL, TRUE, imhtml->tip_window, NULL, 4, 4, layout); + GTK_STATE_NORMAL, TRUE, imhtml->tip_window, NULL, 4, 4, layout); cairo_destroy(cr); g_object_unref(layout); @@ -524,14 +524,14 @@ gtk_imhtml_tip (gpointer data) PangoFontMetrics *font_metrics; PangoLayout *layout; PangoFont *font; - GtkStyle *style = gtk_widget_get_style(imhtml->tip_window); - GtkAllocation allocation; + GtkStyle *style = gtk_widget_get_style(imhtml->tip_window); + GtkAllocation allocation; gint gap, x, y, h, w, scr_w, baseline_skip; g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); - gtk_widget_get_allocation(GTK_WIDGET(imhtml), &allocation); - + gtk_widget_get_allocation(GTK_WIDGET(imhtml), &allocation); + if (!imhtml->tip || !gtk_widget_is_drawable(GTK_WIDGET(imhtml))) { imhtml->tip_timer = 0; return FALSE; @@ -556,7 +556,7 @@ gtk_imhtml_tip (gpointer data) gtk_widget_ensure_style (imhtml->tip_window); layout = gtk_widget_create_pango_layout(imhtml->tip_window, imhtml->tip); font = pango_context_load_font(pango_layout_get_context(layout), - style->font_desc); + style->font_desc); if (font == NULL) { char *tmp = pango_font_description_to_string(style->font_desc); @@ -753,7 +753,7 @@ gtk_leave_event_notify(GtkWidget *imhtml, GdkEventCrossing *event, gpointer data return FALSE; } -/* TODO: I think this can be removed for GTK+ 3.0... */ +/* TODO: I think this can be removed for GTK+ 3.0... */ #if 0 static gint gtk_imhtml_expose_event (GtkWidget *widget, @@ -783,7 +783,7 @@ gtk_imhtml_expose_event (GtkWidget *widget, gdk_cairo_set_source_color(cr, &gcolor); } else { gdk_cairo_set_source_color(cr, - &(gtk_widget_get_style(widget)->base[gtk_widget_get_state(widget)])); + &(gtk_widget_get_style(widget)->base[gtk_widget_get_state(widget)])); } cairo_rectangle(cr, @@ -1166,8 +1166,8 @@ static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *select { char *text; GtkIMHtml *imhtml = data; - gint length = gtk_selection_data_get_length(selection_data); - + gint length = gtk_selection_data_get_length(selection_data); + if (!gtk_text_view_get_editable(GTK_TEXT_VIEW(imhtml))) return; @@ -1576,7 +1576,7 @@ static void gtk_imhtml_class_init (GtkIMHtmlClass *klass) gobject_class->finalize = gtk_imhtml_finalize; widget_class->drag_motion = gtk_text_view_drag_motion; - /* TODO: I _think_ this should be removed for GTK+ 3.0 */ + /* TODO: I _think_ this should be removed for GTK+ 3.0 */ /*widget_class->expose_event = gtk_imhtml_expose_event;*/ parent_size_allocate = widget_class->size_allocate; widget_class->size_allocate = gtk_imhtml_size_allocate; @@ -1921,18 +1921,18 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guin GtkTextMark *mark = gtk_text_buffer_get_insert(imhtml->text_buffer); GtkTextIter iter; gint i = 0; - gint length = gtk_selection_data_get_length(sd); + gint length = gtk_selection_data_get_length(sd); gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark); - if(gtk_imhtml_get_editable(imhtml) && text){ + if (gtk_imhtml_get_editable(imhtml) && text) { switch (info) { case GTK_IMHTML_DRAG_URL: /* TODO: Is it really ok to change sd->data...? */ purple_str_strip_char(text, '\r'); links = g_strsplit(text, "\n", 0); - while((link = links[i]) != NULL){ + while ((link = links[i]) != NULL) { if (gtk_imhtml_is_protocol(link)) { gchar *label; @@ -2001,7 +2001,7 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guin return; } gtk_drag_finish(dc, TRUE, - (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } else { gtk_drag_finish(dc, FALSE, FALSE, t); } @@ -2557,9 +2557,9 @@ static gboolean scroll_idle_cb(gpointer data) { GtkIMHtml *imhtml = data; GtkAdjustment *adj = gtk_text_view_get_vadjustment(GTK_TEXT_VIEW(imhtml)); - if(adj) { + if (adj) { gtk_adjustment_set_value(adj, gtk_adjustment_get_upper(adj) - - gtk_adjustment_get_page_size(adj)); + gtk_adjustment_get_page_size(adj)); } imhtml->scroll_src = 0; return FALSE; @@ -3842,7 +3842,7 @@ static void gtk_imhtml_custom_smiley_save(GtkWidget *w, GtkIMHtmlImageSave *save) { GtkIMHtmlImage *image = (GtkIMHtmlImage *)save->image; - + /* Create an add dialog */ PidginSmiley *editor = pidgin_smiley_edit(NULL, NULL); pidgin_smiley_editor_set_shortcut(editor, image->filename); @@ -4199,14 +4199,14 @@ static void remove_tag_by_prefix(GtkIMHtml *imhtml, const GtkTextIter *i, const for (l = tags; l; l = l->next) { GtkTextTag *tag = l->data; - gchar *name; + gchar *name = NULL; + + g_object_get(G_OBJECT(tag), "name", &name, NULL); - g_object_get(G_OBJECT(tag), "name", &name, NULL); - if (name && !strncmp(name, prefix, len)) gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, i, e); - g_free(name); + g_free(name); } g_slist_free(tags); @@ -4222,14 +4222,14 @@ static void remove_tag_by_prefix(GtkIMHtml *imhtml, const GtkTextIter *i, const for (l = tags; l; l = l->next) { GtkTextTag *tag = l->data; - gchar *name; + gchar *name = NULL; - g_object_get(G_OBJECT(tag), "name", &name, NULL); + g_object_get(G_OBJECT(tag), "name", &name, NULL); if (name && !strncmp(name, prefix, len)) gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, &iter, e); - g_free(name); + g_free(name); } g_slist_free(tags); @@ -4350,16 +4350,16 @@ static void delete_cb(GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *en gtk_text_iter_begins_tag(start, tag) && /* the tag starts with the selection */ (!gtk_text_iter_has_tag(end, tag) || /* the tag ends within the selection */ gtk_text_iter_ends_tag(end, tag))) { - gchar *name; + gchar *name = NULL; - g_object_get(G_OBJECT(tag), "name", &name, NULL); + g_object_get(G_OBJECT(tag), "name", &name, NULL); gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, start, end); - if (name && strncmp(name, "LINK ", 5) == 0 && imhtml->edit.link) { + if (name && strncmp(name, "LINK ", 5) == 0 && imhtml->edit.link) { gtk_imhtml_toggle_link(imhtml, NULL); } - g_free(name); + g_free(name); } } g_slist_free(tags); @@ -4581,10 +4581,10 @@ static void mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *arg1, GtkTextMark *m for (l = tags; l != NULL; l = l->next) { GtkTextTag *tag = GTK_TEXT_TAG(l->data); - gchar *name; + gchar *name = NULL; + + g_object_get(G_OBJECT(tag), "name", &name, NULL); - g_object_get(G_OBJECT(tag), "name", &name, NULL); - if (name) { if (strcmp(name, "BOLD") == 0) imhtml->edit.bold = TRUE; @@ -4606,7 +4606,7 @@ static void mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *arg1, GtkTextMark *m imhtml->edit.link = tag; } - g_free(name); + g_free(name); } g_slist_free(tags); @@ -5004,10 +5004,10 @@ void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char * * images, and ensures that they are handled by the image * itself, without propagating to the textview and causing * a complete refresh */ - /* TODO: I think this should be removed for GTK+ 3.0? + /* TODO: I think this should be removed for GTK+ 3.0? g_signal_connect(G_OBJECT(icon), "expose-event", G_CALLBACK(image_expose), NULL); - */ - + */ + gtk_widget_show(icon); if (ebox) gtk_container_add(GTK_CONTAINER(ebox), icon); @@ -5109,29 +5109,29 @@ void gtk_imhtml_insert_image_at_iter(GtkIMHtml *imhtml, int id, GtkTextIter *ite static const gchar *tag_to_html_start(GtkTextTag *tag) { static gchar buf[1024]; - gchar *name; + gchar *name = NULL; - g_object_get(G_OBJECT(tag), "name", &name, NULL); g_return_val_if_fail(name != NULL, ""); + g_object_get(G_OBJECT(tag), "name", &name, NULL); if (strcmp(name, "BOLD") == 0) { - g_free(name); + g_free(name); return ""; } else if (strcmp(name, "ITALICS") == 0) { - g_free(name); + g_free(name); return ""; } else if (strcmp(name, "UNDERLINE") == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else if (strcmp(name, "STRIKE") == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else if (strncmp(name, "LINK ", 5) == 0) { char *tmp = g_object_get_data(G_OBJECT(tag), "link_url"); - g_free(name); - - if (tmp) { + g_free(name); + + if (tmp) { g_snprintf(buf, sizeof(buf), "", tmp); buf[sizeof(buf)-1] = '\0'; return buf; @@ -5141,29 +5141,29 @@ static const gchar *tag_to_html_start(GtkTextTag *tag) } else if (strncmp(name, "FORECOLOR ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - g_free(name); + g_free(name); - return buf; + return buf; } else if (strncmp(name, "BACKCOLOR ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - g_free(name); - - return buf; + g_free(name); + + return buf; } else if (strncmp(name, "BACKGROUND ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[11]); - g_free(name); + g_free(name); - return buf; + return buf; } else if (strncmp(name, "FONT FACE ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - g_free(name); + g_free(name); - return buf; + return buf; } else if (strncmp(name, "FONT SIZE ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - g_free(name); + g_free(name); - return buf; + return buf; } else { char *str = buf; gboolean isset; @@ -5225,8 +5225,8 @@ static const gchar *tag_to_html_start(GtkTextTag *tag) } g_snprintf(str, sizeof(buf) - (str - buf), "'>"); - g_free(name); - + g_free(name); + return (empty ? "" : buf); } } @@ -5235,39 +5235,39 @@ static const gchar *tag_to_html_end(GtkTextTag *tag) { gchar *name; - g_object_get(G_OBJECT(tag), "name", &name, NULL); g_return_val_if_fail(name != NULL, ""); + g_object_get(G_OBJECT(tag), "name", &name, NULL); if (strcmp(name, "BOLD") == 0) { - g_free(name); + g_free(name); return ""; } else if (strcmp(name, "ITALICS") == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else if (strcmp(name, "UNDERLINE") == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else if (strcmp(name, "STRIKE") == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else if (strncmp(name, "LINK ", 5) == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else if (strncmp(name, "FORECOLOR ", 10) == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else if (strncmp(name, "BACKCOLOR ", 10) == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else if (strncmp(name, "BACKGROUND ", 10) == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else if (strncmp(name, "FONT FACE ", 10) == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else if (strncmp(name, "FONT SIZE ", 10) == 0) { - g_free(name); - return ""; + g_free(name); + return ""; } else { const char *props[] = {"weight-set", "foreground-set", "background-set", "size-set", "underline-set", NULL}; @@ -5279,7 +5279,7 @@ static const gchar *tag_to_html_end(GtkTextTag *tag) return ""; } - g_free(name); + g_free(name); return ""; } -- cgit v1.2.1 From dfc0f82753d03d83aa9cde4cd995e489743fe968 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 13 Feb 2011 01:04:13 +0000 Subject: Up GTK+ requirements now that 3.0.0 has been officially released. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7fadabad4c..3aa526ab19 100644 --- a/configure.ac +++ b/configure.ac @@ -416,7 +416,7 @@ else fi if test "x$enable_gtkui" = "xyes" ; then - PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 2.91.6], , [ + PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0], , [ AC_MSG_RESULT(no) AC_MSG_ERROR([ -- cgit v1.2.1 From 90e8e9387c8c19a841351659654f47e350a8d3e4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 13 Feb 2011 01:36:19 +0000 Subject: SM appears to be X11-specific now. --- pidgin/gtksession.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtksession.c b/pidgin/gtksession.c index a972865c76..adaacd0b73 100644 --- a/pidgin/gtksession.c +++ b/pidgin/gtksession.c @@ -349,7 +349,7 @@ pidgin_session_init(gchar *argv0, gchar *previous_id, gchar *config_dir) free(tmp); session_managed = TRUE; - gdk_set_sm_client_id(client_id); + gdk_x11_set_sm_client_id(client_id); tmp = g_get_current_dir(); session_set_string(session, SmCurrentDirectory, tmp); -- cgit v1.2.1 From 2e33e2486e6c2ac09656a9653f4d1d1291b489ab Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 13 Feb 2011 01:36:45 +0000 Subject: Hide some Facebook settings hacks for now. --- pidgin/gtkaccount.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 4406652082..3304ef9a57 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -829,8 +829,11 @@ add_protocol_options(AccountPrefsDialog *dialog) gtk_label_new_with_mnemonic(_("Ad_vanced")), 1); gtk_widget_show(vbox); +/* FIXME: Facebook forced-options hack */ +#if 0 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->protocol_menu)); item = gtk_menu_get_active(GTK_MENU(menu)); +#endif for (l = dialog->prpl_info->protocol_options; l != NULL; l = l->next) { @@ -946,9 +949,12 @@ add_protocol_options(AccountPrefsDialog *dialog) model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); opt_entry->widget = combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model)); +/* FIXME: Facebook forced-options hack */ +#if 0 if (g_object_get_data(G_OBJECT(item), "fakefacebook") && !strcmp(opt_entry->setting, "connection_security")) str_value = "opportunistic_tls"; +#endif /* Loop through list of PurpleKeyValuePair items */ for (node = list; node != NULL; node = node->next) { -- cgit v1.2.1 From 213fce5b2582649d9d0f5380b8ff7af2e971642e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 13 Feb 2011 02:10:49 +0000 Subject: We don't need this extra slash. --- pidgin/gtkconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 2ab7fd29fb..cdd880686a 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3081,7 +3081,7 @@ static GtkActionEntry menu_entries[] = { "MediaMenu", NULL, N_("M_edia"), NULL, NULL, NULL }, { "AudioCall", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, N_("_Audio Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, { "VideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("_Video Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, - { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio\\/Video _Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, + { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio/Video _Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, #endif { "SendFile", PIDGIN_STOCK_TOOLBAR_SEND_FILE, N_("Se_nd File..."), NULL, NULL, G_CALLBACK(menu_send_file_cb) }, -- cgit v1.2.1 From d38df056418216cd53793c9dc3ba113adcf928a1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 13 Feb 2011 06:30:30 +0000 Subject: Add back the More and plugin action menu entries. --- pidgin/gtkconv.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index cdd880686a..499867766f 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3411,14 +3411,21 @@ regenerate_media_items(PidginWindow *win) static void regenerate_options_items(PidginWindow *win) { -#if GTK_CHECK_VERSION(2,6,0) -#else GtkWidget *menu; PidginConversation *gtkconv; GList *list; +#if GTK_CHECK_VERSION(2,6,0) + GtkWidget *more_menu; + gtkconv = pidgin_conv_window_get_active_gtkconv(win); + more_menu = gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/MoreMenu"); + gtk_widget_show(more_menu); + menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(more_menu)); +#else gtkconv = pidgin_conv_window_get_active_gtkconv(win); menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More")); +#endif /* Remove the previous entries */ for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; ) @@ -3436,7 +3443,6 @@ regenerate_options_items(PidginWindow *win) } gtk_widget_show_all(menu); -#endif } static void @@ -3450,8 +3456,6 @@ remove_from_list(GtkWidget *widget, PidginWindow *win) static void regenerate_plugins_items(PidginWindow *win) { -#if GTK_CHECK_VERSION(2,6,0) -#else GList *action_items; GtkWidget *menu; GList *list; @@ -3477,7 +3481,12 @@ regenerate_plugins_items(PidginWindow *win) action_items = g_list_delete_link(action_items, action_items); } +#if GTK_CHECK_VERSION(2,6,0) + item = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/OptionsMenu"); + menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(item)); +#else menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Options")); +#endif list = purple_conversation_get_extended_menu(conv); if (list) { @@ -3493,7 +3502,6 @@ regenerate_plugins_items(PidginWindow *win) g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(remove_from_list), win); } g_object_set_data(G_OBJECT(win->window), "plugin-actions", action_items); -#endif } #if 0 -- cgit v1.2.1 From 9b8bb03a368f835755e32b45f5769d741b9b090b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 13 Feb 2011 06:40:09 +0000 Subject: Fix warning. You should really try to read these next time. --- pidgin/gtkconv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 499867766f..b455be0c21 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -7291,13 +7291,13 @@ pidgin_conv_xy_to_right_infopane(PidginWindow *win, int x, int y) { gint pane_x, pane_y, x_rel; PidginConversation *gtkconv; - GtkAllocation allocation; + GtkAllocation allocation; - gtk_widget_get_allocation(gtkconv->infopane, &allocation); gdk_window_get_origin(gtk_widget_get_window(win->notebook), - &pane_x, &pane_y); + &pane_x, &pane_y); x_rel = x - pane_x; gtkconv = pidgin_conv_window_get_active_gtkconv(win); + gtk_widget_get_allocation(gtkconv->infopane, &allocation); return (x_rel > allocation.x + allocation.width / 2); } -- cgit v1.2.1 From b3f3b6a6e43cedb9944993088e39bd5d6d659a47 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 13 Feb 2011 07:38:19 +0000 Subject: Whitespace fixes. Try and check your editor settings before writing tons of code. --- pidgin/gtkblist.c | 99 +++++++++++++-------------- pidgin/gtkconv.c | 167 +++++++++++++++++++++++----------------------- pidgin/gtkdialogs.c | 12 ++-- pidgin/gtkimhtml.c | 18 ++--- pidgin/gtkimhtmltoolbar.c | 63 +++++++++-------- pidgin/gtklog.c | 15 +++-- pidgin/gtknotify.c | 24 ++++--- pidgin/gtkplugin.c | 12 ++-- pidgin/gtkpounce.c | 6 +- pidgin/gtkprefs.c | 15 ++--- pidgin/gtkrequest.c | 49 +++++++------- pidgin/gtkroomlist.c | 7 +- pidgin/gtkutils.c | 8 +-- pidgin/gtkwhiteboard.c | 45 ++++++------- pidgin/pidginstock.c | 2 +- 15 files changed, 271 insertions(+), 271 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 292d0b61bc..ce3a80c595 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -461,9 +461,9 @@ gtk_blist_do_personize(GList *merges) GList *tmp; /* First, we find the contact to merge the rest of the buddies into. - * This will be the contact with the most buddies in it; ties are broken - * by which contact is higher in the list - */ + * This will be the contact with the most buddies in it; ties are broken + * by which contact is higher in the list + */ for (tmp = merges; tmp; tmp = tmp->next) { PurpleBlistNode *node = tmp->data; PurpleBlistNode *b; @@ -984,7 +984,7 @@ make_blist_request_dialog(PidginBlistRequestData *data, PurpleAccount *account, gtkblist = PIDGIN_BLIST(purple_get_blist()); blist_window = gtkblist ? GTK_WINDOW(gtkblist->window) : NULL; - /* TODO: set no separator in gtk+ 3... */ + /* TODO: set no separator in gtk+ 3... */ data->window = gtk_dialog_new_with_buttons(title, blist_window, 0, NULL); @@ -993,14 +993,14 @@ make_blist_request_dialog(PidginBlistRequestData *data, PurpleAccount *account, gtk_container_set_border_width(GTK_CONTAINER(data->window), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE); gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), - PIDGIN_HIG_BORDER); + PIDGIN_HIG_BORDER); gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), - PIDGIN_HIG_BOX_SPACE); + PIDGIN_HIG_BOX_SPACE); gtk_window_set_role(GTK_WINDOW(data->window), window_role); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), - hbox); + hbox); gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); gtk_misc_set_alignment(GTK_MISC(img), 0, 0); @@ -1559,7 +1559,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) pidgin_append_blist_node_move_to_menu(menu, (PurpleBlistNode *)contact); if (node->parent && node->parent->child->next && - !sub && !contact_expanded) { + !sub && !contact_expanded) { pidgin_separator(menu); pidgin_append_blist_node_privacy_menu(menu, node); pidgin_new_item_from_stock(menu, _("_Alias..."), PIDGIN_STOCK_ALIAS, @@ -2250,7 +2250,7 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, guint time, gpointer null) { - GdkAtom target = gtk_selection_data_get_target(data); + GdkAtom target = gtk_selection_data_get_target(data); if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row"); @@ -2346,8 +2346,8 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, guint info, guint t) { - GdkAtom target = gtk_selection_data_get_target(sd); - const guchar *data = gtk_selection_data_get_data(sd); + GdkAtom target = gtk_selection_data_get_target(sd); + const guchar *data = gtk_selection_data_get_data(sd); if (gtkblist->drag_timeout) { g_source_remove(gtkblist->drag_timeout); @@ -2557,7 +2557,7 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, gtk_tree_path_free(path); gtk_drag_finish(dc, TRUE, - (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } else if (target == gdk_atom_intern("text/x-vcard", FALSE) && data) { @@ -2595,7 +2595,7 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, result = parse_vcard((const gchar *) data, group); gtk_drag_finish(dc, result, - (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } else if (target == gdk_atom_intern("text/uri-list", FALSE) && data) { GtkTreePath *path = NULL; GtkTreeViewDropPosition position; @@ -2615,7 +2615,7 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node)); pidgin_dnd_file_manage(sd, b->account, b->name); gtk_drag_finish(dc, TRUE, - (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } else { gtk_drag_finish(dc, FALSE, FALSE, t); } @@ -2979,56 +2979,57 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) for(l = gtkblist->tooltipdata; l; l = l->next) { struct tooltip_data *td = l->data; - cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(gtkblist->tipwindow)); + cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(gtkblist->tipwindow)); if (td->avatar && pidgin_gdk_pixbuf_is_opaque(td->avatar)) { if (dir == GTK_TEXT_DIR_RTL) gtk_paint_flat_box(style, cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkblist->tipwindow, "tooltip", - TOOLTIP_BORDER -1, current_height -1, td->avatar_width +2, - td->avatar_height + 2); + TOOLTIP_BORDER - 1, current_height - 1, + td->avatar_width + 2, td->avatar_height + 2); else gtk_paint_flat_box(style, cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkblist->tipwindow, "tooltip", - max_width - (td->avatar_width+ TOOLTIP_BORDER)-1, - current_height-1,td->avatar_width+2, td->avatar_height+2); + max_width - (td->avatar_width + TOOLTIP_BORDER) - 1, + current_height - 1, + td->avatar_width + 2, td->avatar_height + 2); } if (td->status_icon) { if (dir == GTK_TEXT_DIR_RTL) { - gdk_cairo_set_source_pixbuf(cr, td->status_icon, - max_width - TOOLTIP_BORDER - status_size, current_height); - cairo_paint(cr); - } else { - gdk_cairo_set_source_pixbuf(cr, td->status_icon, TOOLTIP_BORDER, current_height); - cairo_paint(cr); - } - } + gdk_cairo_set_source_pixbuf(cr, td->status_icon, + max_width - TOOLTIP_BORDER - status_size, current_height); + cairo_paint(cr); + } else { + gdk_cairo_set_source_pixbuf(cr, td->status_icon, TOOLTIP_BORDER, current_height); + cairo_paint(cr); + } + } if (td->avatar) { if (dir == GTK_TEXT_DIR_RTL) { - gdk_cairo_set_source_pixbuf(cr, td->avatar, TOOLTIP_BORDER, - current_height); - cairo_paint(cr); - } else { - gdk_cairo_set_source_pixbuf(cr, td->avatar, - max_width - (td->avatar_width + TOOLTIP_BORDER), current_height); - cairo_paint(cr); - } + gdk_cairo_set_source_pixbuf(cr, td->avatar, TOOLTIP_BORDER, + current_height); + cairo_paint(cr); + } else { + gdk_cairo_set_source_pixbuf(cr, td->avatar, + max_width - (td->avatar_width + TOOLTIP_BORDER), current_height); + cairo_paint(cr); + } } if (!td->avatar_is_prpl_icon && td->prpl_icon) { - gdk_cairo_set_source_pixbuf(cr, td->prpl_icon, prpl_col, - current_height + ((td->name_height / 2) - (PRPL_SIZE / 2))); - cairo_paint(cr); - } + gdk_cairo_set_source_pixbuf(cr, td->prpl_icon, prpl_col, + current_height + ((td->name_height / 2) - (PRPL_SIZE / 2))); + cairo_paint(cr); + } if (td->name_layout) { if (dir == GTK_TEXT_DIR_RTL) { gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, gtkblist->tipwindow, "tooltip", - max_width -(TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), + max_width - (TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), current_height, td->name_layout); } else { gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, @@ -3051,7 +3052,7 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) } } - cairo_destroy(cr); + cairo_destroy(cr); current_height += MAX(td->name_height + td->height, td->avatar_height) + td->padding; } return FALSE; @@ -3600,11 +3601,11 @@ set_mood_cb(GtkWidget *widget, PurpleAccount *account) } purple_request_fields(gc, _("Edit User Mood"), _("Edit User Mood"), - NULL, fields, - _("OK"), G_CALLBACK(edit_mood_cb), - _("Cancel"), NULL, - gc ? purple_connection_get_account(gc) : NULL, - NULL, NULL, gc); + NULL, fields, + _("OK"), G_CALLBACK(edit_mood_cb), + _("Cancel"), NULL, + gc ? purple_connection_get_account(gc) : NULL, + NULL, NULL, gc); g_free(global_moods); } @@ -5943,7 +5944,7 @@ static void pidgin_blist_show(PurpleBuddyList *list) g_signal_connect(G_OBJECT(gtkblist->window), "focus-out-event", G_CALLBACK(blist_focus_cb), gtkblist); - /* TODO: how is this done in gtk+ 3.0? */ + /* TODO: how is this done in gtk+ 3.0? */ /*GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE;*/ gtkblist->main_vbox = gtk_vbox_new(FALSE, 0); @@ -7103,7 +7104,7 @@ static void pidgin_blist_set_visible(PurpleBuddyList *list, gboolean show) if (show) { if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && - !gtk_widget_get_visible(gtkblist->window)) + !gtk_widget_get_visible(gtkblist->window)) purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-unhiding", gtkblist); pidgin_blist_restore_position(); gtk_window_present(GTK_WINDOW(gtkblist->window)); @@ -8047,7 +8048,7 @@ static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *bli if(PURPLE_BLIST_NODE_IS_CONTACT(n)) { for (n2 = n->child; n2; n2 = n2->next) { - buddy = (PurpleBuddy*)n2; + buddy = (PurpleBuddy*)n2; this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account); } this_buddy_name = purple_contact_get_alias((PurpleContact*)n); diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index b455be0c21..717568d379 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -778,16 +778,16 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, InviteBuddyInfo *info = (InviteBuddyInfo *)data; const char *convprotocol; gboolean success = TRUE; - GdkAtom target = gtk_selection_data_get_target(sd); - + GdkAtom target = gtk_selection_data_get_target(sd); + convprotocol = purple_account_get_protocol_id(purple_conversation_get_account(info->conv)); if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { PurpleBlistNode *node = NULL; PurpleBuddy *buddy; - const guchar *data = gtk_selection_data_get_data(sd); - + const guchar *data = gtk_selection_data_get_data(sd); + memcpy(&node, data, sizeof(node)); if (PURPLE_BLIST_NODE_IS_CONTACT(node)) @@ -808,7 +808,7 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, gtk_entry_set_text(GTK_ENTRY(info->entry), purple_buddy_get_name(buddy)); gtk_drag_finish(dc, success, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) { @@ -842,7 +842,7 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, g_free(protocol); gtk_drag_finish(dc, success, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } } @@ -884,11 +884,11 @@ invite_cb(GtkWidget *widget, PidginConversation *gtkconv) GTK_RESPONSE_OK); gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); - /* TODO: set no separator using GTK+ 3.0 */ - /* + /* TODO: set no separator using GTK+ 3.0 */ +#if 0 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); - */ - +#endif + info->window = GTK_WIDGET(invite_dialog); /* Setup the outside spacing. */ @@ -2200,7 +2200,7 @@ refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) (event->keyval == GDK_KEY_Left) || (event->keyval == GDK_KEY_Right) || (event->keyval == GDK_KEY_Page_Up) || - (event->keyval == GDK_KEY_KP_Page_Up) || + (event->keyval == GDK_KEY_KP_Page_Up) || (event->keyval == GDK_KEY_Page_Down) || (event->keyval == GDK_KEY_KP_Page_Down) || (event->keyval == GDK_KEY_Home) || @@ -2438,8 +2438,7 @@ pidgin_conv_get_tab_icons(PurpleConversation *conv) if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { PurpleBuddy *b = purple_find_buddy(account, name); if (b != NULL) { - PurplePresence *p; - p = purple_buddy_get_presence(b); + PurplePresence *p = purple_buddy_get_presence(b); if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY)) return away_list; if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE)) @@ -3741,10 +3740,10 @@ typing_animation(gpointer data) { break; } if (gtkwin->menu.typing_icon == NULL) { - gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU); - pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray), - gtkwin->menu.typing_icon, - _("User is typing...")); + gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU); + pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray), + gtkwin->menu.typing_icon, + _("User is typing...")); } else { gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU); } @@ -4692,13 +4691,13 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv) GtkAllocation imhtml_allocation; GtkAllocation entry_allocation; GtkAllocation lower_hbox_allocation; - + gtk_widget_get_allocation(gtkconv->imhtml, &imhtml_allocation); gtk_widget_get_allocation(gtkconv->entry, &entry_allocation); gtk_widget_get_allocation(gtkconv->lower_hbox, &lower_hbox_allocation); total_height = imhtml_allocation.height + entry_allocation.height; max_height = total_height / 2; - + pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(gtkconv->entry)); @@ -5226,9 +5225,9 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, PurpleAccount *convaccount = purple_conversation_get_account(conv); PurpleConnection *gc = purple_account_get_connection(convaccount); PurplePluginProtocolInfo *prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; - GdkAtom target = gtk_selection_data_get_target(sd); - const guchar *data = gtk_selection_data_get_data(sd); - + GdkAtom target = gtk_selection_data_get_target(sd); + const guchar *data = gtk_selection_data_get_data(sd); + if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { PurpleBlistNode *n = NULL; @@ -5286,7 +5285,7 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, } gtk_drag_finish(dc, TRUE, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) { @@ -5327,13 +5326,13 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, g_free(protocol); gtk_drag_finish(dc, TRUE, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } else if (target == gdk_atom_intern("text/uri-list", FALSE)) { if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) pidgin_dnd_file_manage(sd, convaccount, purple_conversation_get_name(conv)); gtk_drag_finish(dc, TRUE, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); } else gtk_drag_finish(dc, FALSE, FALSE, t); @@ -5739,31 +5738,26 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, GdkEventButton *btn_event = (GdkEventButton*) event; PurpleConversation *conv = data; char *buddyname; - gchar *name; + gchar *name; + + g_object_get(G_OBJECT(tag), "name", &name, NULL); - g_object_get(G_OBJECT(tag), "name", &name, NULL); - /* strlen("BUDDY " or "HILIT ") == 6 */ g_return_val_if_fail((name != NULL) && (strlen(name) > 6), FALSE); buddyname = name + 6; - - if (btn_event->button == 1 && - event->type == GDK_2BUTTON_PRESS) { + if (btn_event->button == 1 && event->type == GDK_2BUTTON_PRESS) { chat_do_im(PIDGIN_CONVERSATION(conv), buddyname); - g_free(name); + g_free(name); return TRUE; - } else if (btn_event->button == 2 - && event->type == GDK_2BUTTON_PRESS) { + } else if (btn_event->button == 2 && event->type == GDK_2BUTTON_PRESS) { chat_do_info(PIDGIN_CONVERSATION(conv), buddyname); + g_free(name); - g_free(name); - return TRUE; - } else if (btn_event->button == 3 - && event->type == GDK_BUTTON_PRESS) { + } else if (btn_event->button == 3 && event->type == GDK_BUTTON_PRESS) { GtkTextIter start, end; /* we shouldn't display the popup @@ -5782,14 +5776,14 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, btn_event->button, btn_event->time); - g_free(name); - + g_free(name); + /* Don't propagate the event any further */ return TRUE; } } - g_free(name); + g_free(name); } return FALSE; @@ -6286,7 +6280,7 @@ pidgin_conv_chat_add_users(PurpleConversation *conv, GList *cbuddies, gboolean n /* Currently GTK+ maintains our sorted list after it's in the tree. * This may change if it turns out we can manage it faster ourselves. - */ + */ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN, GTK_SORT_ASCENDING); } @@ -6638,13 +6632,13 @@ gray_stuff_out(PidginConversation *gtkconv) gtk_action_set_visible(win->menu.get_info, TRUE); gtk_action_set_visible(win->menu.invite, FALSE); gtk_action_set_visible(win->menu.alias, TRUE); - if (purple_privacy_check(account, purple_conversation_get_name(conv))) { - gtk_action_set_visible(win->menu.unblock, FALSE); - gtk_action_set_visible(win->menu.block, TRUE); - } else { - gtk_action_set_visible(win->menu.block, FALSE); - gtk_action_set_visible(win->menu.unblock, TRUE); - } + if (purple_privacy_check(account, purple_conversation_get_name(conv))) { + gtk_action_set_visible(win->menu.unblock, FALSE); + gtk_action_set_visible(win->menu.block, TRUE); + } else { + gtk_action_set_visible(win->menu.block, FALSE); + gtk_action_set_visible(win->menu.unblock, TRUE); + } if ((account == NULL) || purple_find_buddy(account, purple_conversation_get_name(conv)) == NULL) { gtk_action_set_visible(win->menu.add, TRUE); @@ -6865,7 +6859,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) if ((fields & PIDGIN_CONV_COLORIZE_TITLE) || (fields & PIDGIN_CONV_SET_TITLE) || - (fields & PIDGIN_CONV_TOPIC)) + (fields & PIDGIN_CONV_TOPIC)) { char *title; PurpleConvIm *im = NULL; @@ -7249,7 +7243,7 @@ pidgin_conv_update_buddy_icon(PurpleConversation *conv) gtk_container_add(GTK_CONTAINER(gtkconv->u.im->icon_container), event); gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), FALSE); gtk_widget_add_events(event, - GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); + GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); g_signal_connect(G_OBJECT(event), "button-press-event", G_CALLBACK(icon_menu), gtkconv); @@ -7326,7 +7320,7 @@ pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right) count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); for (i = 0; i < count; i++) { - GtkAllocation allocation; + GtkAllocation allocation; page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i); tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page); @@ -8120,7 +8114,7 @@ pidgin_conversations_init(void) purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_protocol_icons", show_protocol_icons_pref_cb, NULL); purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/hide_new", - hide_new_pref_cb, NULL); + hide_new_pref_cb, NULL); @@ -8257,7 +8251,7 @@ pidgin_conversations_init(void) window_list = g_list_remove(window_list, hidden_convwin); purple_signal_connect(purple_accounts_get_handle(), "account-status-changed", - handle, PURPLE_CALLBACK(account_status_changed_cb), NULL); + handle, PURPLE_CALLBACK(account_status_changed_cb), NULL); /* Callbacks to update a conversation */ purple_signal_connect(blist_handle, "blist-node-added", handle, @@ -8442,12 +8436,12 @@ build_warn_close_dialog(PidginWindow *gtkwin) 6); gtk_window_set_resizable(GTK_WINDOW(warn_close_dialog), FALSE); - /* TODO: figure out how to set no separator in GTK+ 3.0 */ - /* - gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog), + /* TODO: figure out how to set no separator in GTK+ 3.0 */ +#if 0 + gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog), FALSE); - */ - +#endif + /* Setup the outside spacing. */ vbox = gtk_dialog_get_content_area(GTK_DIALOG(warn_close_dialog)); @@ -8723,10 +8717,10 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc if (e->button == 1) { int nb_x, nb_y; - GtkAllocation allocation; + GtkAllocation allocation; + + gtk_widget_get_allocation(gtkconv->infopane_hbox, &allocation); - gtk_widget_get_allocation(gtkconv->infopane_hbox, &allocation); - if (gtkconv->win->in_drag) return TRUE; @@ -8781,7 +8775,7 @@ notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) int tab_clicked; GtkWidget *page; GtkWidget *tab; - GtkAllocation allocation; + GtkAllocation allocation; if (e->button == 2 && e->type == GDK_BUTTON_PRESS) { PidginConversation *gtkconv; @@ -8831,7 +8825,7 @@ notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), tab_clicked); tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(win->notebook), page); - gtk_widget_get_allocation(tab, &allocation); + gtk_widget_get_allocation(tab, &allocation); win->drag_min_x = allocation.x + nb_x; win->drag_min_y = allocation.y + nb_y; @@ -8844,8 +8838,8 @@ notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) e->y_root < win->drag_min_y || e->y_root >= win->drag_max_y) { - return FALSE; - } + return FALSE; + } win->in_predrag = TRUE; win->drag_tab = tab_clicked; @@ -9080,8 +9074,8 @@ right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, PidginWindow * { GtkWidget *item; PidginConversation *gtkconv; - GtkWidget *menu = gtk_notebook_get_menu - + GtkWidget *menu = gtk_notebook_get_menu + if (event->type != GDK_BUTTON_PRESS || event->button != 3) return FALSE; @@ -9176,8 +9170,7 @@ alias_cb(GtkEntry *entry, gpointer user_data) PurpleBuddy *buddy; buddy = purple_find_buddy(account, name); if (buddy != NULL) { - purple_blist_alias_buddy(buddy, - gtk_entry_get_text(entry)); + purple_blist_alias_buddy(buddy, gtk_entry_get_text(entry)); } serv_alias_buddy(buddy); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { @@ -9323,14 +9316,18 @@ static GList* make_status_icon_list(const char *stock, GtkWidget *w) { GList *l = NULL; - l = g_list_append(l, gtk_widget_render_icon (w, stock, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), "GtkWindow")); - l = g_list_append(l, gtk_widget_render_icon (w, stock, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow")); - l = g_list_append(l, gtk_widget_render_icon (w, stock, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MEDIUM), "GtkWindow")); - l = g_list_append(l, gtk_widget_render_icon (w, stock, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), "GtkWindow")); + l = g_list_append(l, + gtk_widget_render_icon(w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), "GtkWindow")); + l = g_list_append(l, + gtk_widget_render_icon(w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow")); + l = g_list_append(l, + gtk_widget_render_icon(w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MEDIUM), "GtkWindow")); + l = g_list_append(l, + gtk_widget_render_icon(w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), "GtkWindow")); return l; } @@ -9388,8 +9385,8 @@ static void pidgin_conv_set_position_size(PidginWindow *win, int conv_x, int conv_y, int conv_width, int conv_height) { - /* if the window exists, is hidden, we're saving positions, and the - * position is sane... */ + /* if the window exists, is hidden, we're saving positions, and the + * position is sane... */ if (win && win->window && !gtk_widget_get_visible(win->window) && conv_width != 0) { @@ -9476,13 +9473,13 @@ pidgin_conv_window_new() gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); gtk_notebook_set_show_border(GTK_NOTEBOOK(win->notebook), TRUE); - /* TODO: figure out how to add custom stuff to the right-click menu in - GtkNotebook in GTK+ 3.0 */ - /* + /* TODO: figure out how to add custom stuff to the right-click menu in + GtkNotebook in GTK+ 3.0 */ +#if 0 g_signal_connect(G_OBJECT(win->notebook), "button-press-event", G_CALLBACK(right_click_menu_cb), win); - */ - +#endif + gtk_widget_show(win->notebook); g_signal_connect(G_OBJECT(win->notebook), "switch_page", diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 4709314198..5c7ae75e23 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -454,7 +454,7 @@ pidgin_build_help_dialog(const char *title, const char *role, GString *string) button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, G_CALLBACK(destroy_win), win); - gtk_widget_set_can_default(button, TRUE); + gtk_widget_set_can_default(button, TRUE); gtk_widget_grab_default(button); gtk_widget_show_all(win); @@ -901,12 +901,12 @@ pidgin_dialogs_ee(const char *ee) gtk_container_set_border_width (GTK_CONTAINER(window), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - /* TODO: figure out how to set no separator in a dialog in GTK+ 3.0 */ - /*gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE);*/ + /* TODO: figure out how to set no separator in a dialog in GTK+ 3.0 */ + /*gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE);*/ gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(window))), - PIDGIN_HIG_BORDER); - gtk_container_set_border_width (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))), - PIDGIN_HIG_BOX_SPACE); + PIDGIN_HIG_BORDER); + gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))), + PIDGIN_HIG_BOX_SPACE); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))), hbox); diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 2b1af29cd6..782f06af74 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -1073,7 +1073,7 @@ static void gtk_imhtml_clipboard_get(GtkClipboard *clipboard, GtkSelectionData * } if (primary) /* This was allocated here */ g_free(text); - } +} static void gtk_imhtml_primary_clipboard_clear(GtkClipboard *clipboard, GtkIMHtml *imhtml) { @@ -1342,7 +1342,7 @@ static gboolean gtk_imhtml_button_press_event(GtkIMHtml *imhtml, GdkEventButton paste_received_cb, imhtml); return TRUE; - } + } return FALSE; } @@ -1904,10 +1904,10 @@ gtk_text_view_drag_motion (GtkWidget *widget, gdk_drag_status (context, suggested_action, time); - /* TRUE return means don't propagate the drag motion to parent - * widgets that may also be drop sites. - */ - return TRUE; + /* TRUE return means don't propagate the drag motion to parent + * widgets that may also be drop sites. + */ + return TRUE; } static void @@ -1966,7 +1966,7 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guin i++; } - g_strfreev(links); + g_strfreev(links); break; case GTK_IMHTML_DRAG_HTML: { @@ -4260,7 +4260,7 @@ static void remove_tag_by_prefix(GtkIMHtml *imhtml, const GtkTextIter *i, const gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, &iter, e); g_free(name); - } + } g_slist_free(tags); } @@ -5010,7 +5010,7 @@ void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char * } } } else { - imhtml->num_animations++; + imhtml->num_animations++; } g_signal_connect(G_OBJECT(icon), "destroy", G_CALLBACK(animated_smiley_destroy_cb), imhtml); g_queue_push_tail(imhtml->animations, icon); diff --git a/pidgin/gtkimhtmltoolbar.c b/pidgin/gtkimhtmltoolbar.c index 96c656b7d8..73363334ed 100644 --- a/pidgin/gtkimhtmltoolbar.c +++ b/pidgin/gtkimhtmltoolbar.c @@ -125,14 +125,14 @@ realize_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) GtkFontSelection *sel; sel = GTK_FONT_SELECTION( - gtk_font_selection_dialog_get_font_selection(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))); + gtk_font_selection_dialog_get_font_selection(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))); gtk_widget_hide(gtk_widget_get_parent( - gtk_font_selection_get_size_entry(sel))); + gtk_font_selection_get_size_entry(sel))); gtk_widget_show_all(gtk_font_selection_get_family_list(sel)); gtk_widget_show(gtk_widget_get_parent( - gtk_font_selection_get_family_list(sel))); + gtk_font_selection_get_family_list(sel))); gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent( - gtk_font_selection_get_family_list(sel)))); + gtk_font_selection_get_family_list(sel)))); } static void @@ -196,11 +196,11 @@ toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar) g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event", G_CALLBACK(destroy_toolbar_font), toolbar); g_signal_connect(G_OBJECT( - gtk_font_selection_dialog_get_ok_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), - "clicked", G_CALLBACK(apply_font), toolbar->font_dialog); + gtk_font_selection_dialog_get_ok_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), + "clicked", G_CALLBACK(apply_font), toolbar->font_dialog); g_signal_connect(G_OBJECT( - gtk_font_selection_dialog_get_cancel_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), - "clicked", G_CALLBACK(cancel_toolbar_font), toolbar); + gtk_font_selection_dialog_get_cancel_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), + "clicked", G_CALLBACK(cancel_toolbar_font), toolbar); g_signal_connect_after(G_OBJECT(toolbar->font_dialog), "realize", G_CALLBACK(realize_toolbar_font), toolbar); } @@ -259,12 +259,12 @@ toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) char *color = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml)); if (!toolbar->fgcolor_dialog) { - GtkWidget *ok_button; - GtkWidget *cancel_button; - + GtkWidget *ok_button; + GtkWidget *cancel_button; + toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); colorsel = - gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); if (color) { gdk_color_parse(color, &fgcolor); gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor); @@ -273,14 +273,13 @@ toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); - g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "ok-button", &ok_button, NULL); - g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "cancel-button", - &cancel_button, NULL); + g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "ok-button", &ok_button, NULL); + g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "cancel-button", &cancel_button, NULL); g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event", G_CALLBACK(destroy_toolbar_fgcolor), toolbar); g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(do_fgcolor), colorsel); g_signal_connect(G_OBJECT(cancel_button), "clicked", - G_CALLBACK(cancel_toolbar_fgcolor), toolbar); + G_CALLBACK(cancel_toolbar_fgcolor), toolbar); } gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog)); } else { @@ -344,14 +343,14 @@ toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) char *color = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml)); if (!toolbar->bgcolor_dialog) { - GtkWidget *ok_button; - GtkWidget *cancel_button; - + GtkWidget *ok_button; + GtkWidget *cancel_button; + toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); colorsel = - gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); - if (color) { + if (color) { gdk_color_parse(color, &bgcolor); gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor); g_free(color); @@ -359,13 +358,13 @@ toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); - g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "ok-button", &ok_button, NULL); - g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "cancel-button", - &cancel_button, NULL); + g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "ok-button", &ok_button, NULL); + g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "cancel-button", + &cancel_button, NULL); g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event", G_CALLBACK(destroy_toolbar_bgcolor), toolbar); g_signal_connect(G_OBJECT(ok_button), "clicked", - G_CALLBACK(do_bgcolor), colorsel); + G_CALLBACK(do_bgcolor), colorsel); g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(cancel_toolbar_bgcolor), toolbar); @@ -479,12 +478,12 @@ insert_link_cb(GtkWidget *w, GtkIMHtmlToolbar *toolbar) static void insert_hr_cb(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) { - GtkTextIter iter; - GtkTextMark *ins; + GtkTextIter iter; + GtkTextMark *ins; GtkIMHtmlScalable *hr; - ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml))); - gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), &iter, ins); + ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml))); + gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), &iter, ins); hr = gtk_imhtml_hr_new(); gtk_imhtml_hr_add_to(hr, GTK_IMHTML(toolbar->imhtml), &iter); } @@ -1113,11 +1112,11 @@ menu_position_func (GtkMenu *menu, { GtkWidget *widget = GTK_WIDGET(data); GtkRequisition menu_req; - GtkAllocation allocation; - gint ythickness = gtk_widget_get_style(widget)->ythickness; + GtkAllocation allocation; + gint ythickness = gtk_widget_get_style(widget)->ythickness; int savy; - gtk_widget_get_allocation(widget, &allocation); + gtk_widget_get_allocation(widget, &allocation); gtk_widget_size_request(GTK_WIDGET (menu), &menu_req); gdk_window_get_origin(gtk_widget_get_window(widget), x, y); *x += allocation.x; diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c index d4e45da21d..f00ab38b52 100644 --- a/pidgin/gtklog.c +++ b/pidgin/gtklog.c @@ -582,10 +582,11 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_dialog_add_button(GTK_DIALOG(lv->window), _("_Browse logs folder"), GTK_RESPONSE_HELP); #endif gtk_container_set_border_width (GTK_CONTAINER(lv->window), PIDGIN_HIG_BOX_SPACE); - /* TODO: is it possible to set this in GTK+ 3.0? - gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE); - */ - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), 0); + /* TODO: is it possible to set this in GTK+ 3.0? */ +#if 0 + gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE); +#endif + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), 0); g_signal_connect(G_OBJECT(lv->window), "response", G_CALLBACK(destroy_cb), ht); gtk_window_set_role(GTK_WINDOW(lv->window), "log_viewer"); @@ -595,7 +596,7 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * title_box = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); gtk_container_set_border_width(GTK_CONTAINER(title_box), PIDGIN_HIG_BOX_SPACE); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), - title_box, FALSE, FALSE, 0); + title_box, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(title_box), icon, FALSE, FALSE, 0); } else @@ -615,7 +616,7 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * pane = gtk_hpaned_new(); gtk_container_set_border_width(GTK_CONTAINER(pane), PIDGIN_HIG_BOX_SPACE); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), - pane, TRUE, TRUE, 0); + pane, TRUE, TRUE, 0); /* List *************/ sw = gtk_scrolled_window_new (NULL, NULL); @@ -654,7 +655,7 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * /* gtk_paned_add1(GTK_PANED(pane), size_label); */ gtk_misc_set_alignment(GTK_MISC(size_label), 0, 0); gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), - size_label, FALSE, FALSE, 0); + size_label, FALSE, FALSE, 0); g_free(sz_txt); g_free(text); } diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 81ffe340a1..9675eb9ea0 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -534,18 +534,19 @@ pidgin_notify_message(PurpleNotifyMsgType type, const char *title, gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - /* TODO: not sure if there is a way to do this in gtk+ 3, or - if we want to... + /* TODO: not sure if there is a way to do this in gtk+ 3, or + if we want to... */ +#if 0 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); - */ - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER); +#endif + gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + PIDGIN_HIG_BORDER); gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BOX_SPACE); + PIDGIN_HIG_BOX_SPACE); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - hbox); + hbox); if (img != NULL) gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); @@ -1523,12 +1524,13 @@ pidgin_create_notification_dialog(PidginNotifyType type) /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BOX_SPACE); gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BOX_SPACE); - /* TODO: not sure if this is possible (or nessesary) in gtk+ 3 + PIDGIN_HIG_BOX_SPACE); + /* TODO: not sure if this is possible (or necessary) in gtk+ 3 */ +#if 0 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); - */ +#endif gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER); + PIDGIN_HIG_BORDER); /* Vertical box */ vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); diff --git a/pidgin/gtkplugin.c b/pidgin/gtkplugin.c index 0da7bdec55..64da7b907c 100644 --- a/pidgin/gtkplugin.c +++ b/pidgin/gtkplugin.c @@ -562,13 +562,13 @@ static gboolean pidgin_plugins_paint_tooltip(GtkWidget *tipwindow, gpointer data) { PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); - cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(tipwindow)); - gtk_paint_layout(gtk_widget_get_style(tipwindow), cr, GTK_STATE_NORMAL, FALSE, + cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(tipwindow)); + gtk_paint_layout(gtk_widget_get_style(tipwindow), cr, GTK_STATE_NORMAL, FALSE, tipwindow, "tooltip", 6, 6, layout); - cairo_destroy(cr); + cairo_destroy(cr); - return TRUE; + return TRUE; } static gboolean @@ -738,7 +738,7 @@ void pidgin_plugin_dialog_show() gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(plugin_dialog))), - sw, TRUE, TRUE, 0); + sw, TRUE, TRUE, 0); ls = gtk_list_store_new(4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), @@ -799,7 +799,7 @@ void pidgin_plugin_dialog_show() gtk_widget_set_sensitive(expander, FALSE); gtk_container_add(GTK_CONTAINER(expander), create_details()); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(plugin_dialog))), - expander, FALSE, FALSE, 0); + expander, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (sel), "changed", G_CALLBACK (prefs_plugin_sel), NULL); diff --git a/pidgin/gtkpounce.c b/pidgin/gtkpounce.c index d44f8c0182..cf359681e4 100644 --- a/pidgin/gtkpounce.c +++ b/pidgin/gtkpounce.c @@ -410,9 +410,9 @@ pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *sd, guint info, guint t, gpointer data) { PidginPounceDialog *dialog; - GdkAtom target = gtk_selection_data_get_target(sd); - const guchar *sd_data = gtk_selection_data_get_data(sd); - + GdkAtom target = gtk_selection_data_get_target(sd); + const guchar *sd_data = gtk_selection_data_get_data(sd); + if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { PurpleBlistNode *node = NULL; diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 6cbd97977f..763aa9b946 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -867,7 +867,7 @@ theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, gchar *name = g_strchomp((gchar *)gtk_selection_data_get_data(sd)); if ((gtk_selection_data_get_length(sd) >= 0) - && (gtk_selection_data_get_format(sd) == 8)) { + && (gtk_selection_data_get_format(sd) == 8)) { /* Well, it looks like the drag event was cool. * Let's do something with it */ gchar *temp; @@ -2540,18 +2540,17 @@ sound_page(void) sound_changed2_cb, vbox); #endif vbox = pidgin_make_frame(ret, _("Sound Events")); - parent = gtk_widget_get_parent(vbox); - parent_parent = gtk_widget_get_parent(parent); - parent_parent_parent = gtk_widget_get_parent(parent_parent); - + parent = gtk_widget_get_parent(vbox); + parent_parent = gtk_widget_get_parent(parent); + parent_parent_parent = gtk_widget_get_parent(parent_parent); + /* The following is an ugly hack to make the frame expand so the * sound events list is big enough to be usable */ gtk_box_set_child_packing(GTK_BOX(parent), vbox, TRUE, TRUE, 0, GTK_PACK_START); gtk_box_set_child_packing(GTK_BOX(parent_parent), - parent, TRUE, TRUE, 0, GTK_PACK_START); - gtk_box_set_child_packing( - GTK_BOX(parent_parent_parent), + parent, TRUE, TRUE, 0, GTK_PACK_START); + gtk_box_set_child_packing(GTK_BOX(parent_parent_parent), parent_parent, TRUE, TRUE, 0, GTK_PACK_START); /* SOUND SELECTION */ diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index b70f08f71f..daf32bef0a 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -106,9 +106,9 @@ pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account) if (GTK_IS_DIALOG(cont)) { gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(cont))), - image, FALSE, TRUE, 0); + image, FALSE, TRUE, 0); gtk_box_reorder_child(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(cont))), - image, 0); + image, 0); } else if (GTK_IS_HBOX(cont)) { gtk_misc_set_alignment(GTK_MISC(image), 0, 0); gtk_box_pack_end(GTK_BOX(cont), image, FALSE, TRUE, 0); @@ -362,20 +362,21 @@ pidgin_request_input(const char *title, const char *primary, /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER / 2); + PIDGIN_HIG_BORDER / 2); if (!multiline) gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - /* TODO: not sure how to do this with GTK+ 3 + /* TODO: not sure how to do this with GTK+ 3 */ +#if 0 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); - */ +#endif gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0); gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER); + PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - hbox); + hbox); /* Dialog icon. */ img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, @@ -544,18 +545,19 @@ pidgin_request_choice(const char *title, const char *primary, /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER / 2); + PIDGIN_HIG_BORDER / 2); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - /* TODO: don't know if this is possible with GTK+ 3 - gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); - */ + /* TODO: don't know if this is possible with GTK+ 3 */ +#if 0 + gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER); + PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - hbox); + hbox); /* Dialog icon. */ img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, @@ -671,18 +673,19 @@ pidgin_request_action_with_icon(const char *title, const char *primary, /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER / 2); + PIDGIN_HIG_BORDER / 2); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - /* TODO: this is probably not supported by GTK+ 3 - gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); - */ + /* TODO: this is probably not supported by GTK+ 3 */ +#if 0 + gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER); + PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - hbox); + hbox); /* Dialog icon. */ if (icon_data) { @@ -753,8 +756,8 @@ pidgin_request_action_with_icon(const char *title, const char *primary, if (default_action == PURPLE_DEFAULT_ACTION_NONE) { - gtk_widget_set_can_default(img, TRUE); - gtk_widget_set_can_focus(img, TRUE); + gtk_widget_set_can_default(img, TRUE); + gtk_widget_set_can_focus(img, TRUE); gtk_widget_grab_focus(img); gtk_widget_grab_default(img); } else @@ -1281,12 +1284,12 @@ pidgin_request_fields(const char *title, const char *primary, /* Cancel button */ button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(cancel_text), G_CALLBACK(multifield_cancel_cb), data); - gtk_widget_set_can_default(button, TRUE); + gtk_widget_set_can_default(button, TRUE); /* OK button */ button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(ok_text), G_CALLBACK(multifield_ok_cb), data); data->ok_button = button; - gtk_widget_set_can_default(button, TRUE); + gtk_widget_set_can_default(button, TRUE); gtk_window_set_default(GTK_WINDOW(win), button); pidgin_widget_decorate_account(hbox, account); diff --git a/pidgin/gtkroomlist.c b/pidgin/gtkroomlist.c index 18d6d4a495..9b69588d1a 100644 --- a/pidgin/gtkroomlist.c +++ b/pidgin/gtkroomlist.c @@ -359,9 +359,8 @@ pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) int current_height, max_width; int max_text_width; GtkTextDirection dir = gtk_widget_get_direction(GTK_WIDGET(grl->tree)); - cairo_t *cr = - gdk_cairo_create(gtk_widget_get_window(grl->tipwindow)); - + cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(grl->tipwindow)); + style = gtk_widget_get_style(grl->tipwindow); max_text_width = MAX(grl->tip_width, grl->tip_name_width); @@ -390,7 +389,7 @@ pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) current_height + grl->tip_name_height, grl->tip_layout); } - cairo_destroy(cr); + cairo_destroy(cr); return FALSE; } diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 2a8cfced15..4cb8820c1e 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -1807,8 +1807,8 @@ pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, group = gtk_menu_get_accel_group(GTK_MENU(menu)); if (group) { char *path = g_strdup_printf("%s/%s", - gtk_menu_item_get_accel_path(GTK_MENU_ITEM(menuitem)), - act->label); + gtk_menu_item_get_accel_path(GTK_MENU_ITEM(menuitem)), + act->label); gtk_menu_set_accel_path(GTK_MENU(submenu), path); g_free(path); gtk_menu_set_accel_group(GTK_MENU(submenu), group); @@ -2188,7 +2188,7 @@ icon_filesel_choose_cb(GtkWidget *widget, gint response, struct _icon_chooser *d gtk_widget_destroy(dialog->icon_filesel); g_free(filename); g_free(dialog); - } +} static void @@ -2822,7 +2822,7 @@ const char *pidgin_get_dim_grey_string(GtkWidget *widget) { if (!widget) return "dim grey"; - style = gtk_widget_get_style(widget); + style = gtk_widget_get_style(widget); if (!style) return "dim grey"; diff --git a/pidgin/gtkwhiteboard.c b/pidgin/gtkwhiteboard.c index 16185625d0..5f7d51404d 100644 --- a/pidgin/gtkwhiteboard.c +++ b/pidgin/gtkwhiteboard.c @@ -360,7 +360,7 @@ static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventCon cairo_t *cr; GdkWindow *window = gtk_widget_get_window(widget); GtkAllocation allocation; - + if (pixbuf) { cr = g_object_get_data(G_OBJECT(pixbuf), "cairo-context"); if (cr) @@ -369,11 +369,11 @@ static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventCon } gtk_widget_get_allocation(widget, &allocation); - + pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, - FALSE, gdk_visual_get_depth(GDK_VISUAL(window)), - allocation.width, allocation.height); - + FALSE, gdk_visual_get_depth(GDK_VISUAL(window)), + allocation.width, allocation.height); + gtkwb->pixbuf = pixbuf; cr = gdk_cairo_create(gtk_widget_get_window(widget)); @@ -708,10 +708,10 @@ static void pidgin_whiteboard_clear(PurpleWhiteboard *wb) GdkPixbuf *pixbuf = gtkwb->pixbuf; GtkWidget *drawing_area = gtkwb->drawing_area; cairo_t *cr = g_object_get_data(G_OBJECT(pixbuf), "cairo-context"); - GtkAllocation allocation; + GtkAllocation allocation; + + gtk_widget_get_allocation(drawing_area, &allocation); - gtk_widget_get_allocation(drawing_area, &allocation); - gdk_cairo_set_source_color(cr, >k_widget_get_style(drawing_area)->white); cairo_rectangle(cr, 0, 0, @@ -788,15 +788,15 @@ static void pidgin_whiteboard_button_save_press(GtkWidget *widget, gpointer data gtk_widget_destroy(dialog); /* Makes an icon from the whiteboard's canvas 'image' */ - pixbuf = gtkwb->pixbuf; - /* + pixbuf = gtkwb->pixbuf; +/* pixbuf = gdk_pixbuf_get_from_drawable(NULL, (GdkDrawable*)(gtkwb->pixmap), gdk_drawable_get_colormap(gtkwb->pixmap), 0, 0, 0, 0, gtkwb->width, gtkwb->height); - */ +*/ if(gdk_pixbuf_save(pixbuf, filename, "jpeg", NULL, "quality", "100", NULL)) purple_debug_info("gtkwhiteboard", "File Saved...\n"); @@ -817,15 +817,15 @@ static void pidgin_whiteboard_set_canvas_as_icon(PidginWhiteboard *gtkwb) GdkPixbuf *pixbuf; /* Makes an icon from the whiteboard's canvas 'image' */ - pixbuf = gtkwb->pixbuf; - /* + pixbuf = gtkwb->pixbuf; +/* pixbuf = gdk_pixbuf_get_from_drawable(NULL, (GdkDrawable*)(gtkwb->pixmap), gdk_drawable_get_colormap(gtkwb->pixmap), 0, 0, 0, 0, gtkwb->width, gtkwb->height); - */ +*/ gtk_window_set_icon((GtkWindow*)(gtkwb->window), pixbuf); } @@ -866,21 +866,20 @@ static void color_select_dialog(GtkWidget *widget, PidginWhiteboard *gtkwb) { GdkColor color; GtkColorSelectionDialog *dialog; - GtkWidget *ok_button; - + GtkWidget *ok_button; + dialog = (GtkColorSelectionDialog *)gtk_color_selection_dialog_new(_("Select color")); g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", dialog); g_signal_connect(G_OBJECT(gtk_color_selection_dialog_get_color_selection(dialog)), - "color-changed", - G_CALLBACK(change_color_cb), gtkwb); + "color-changed", G_CALLBACK(change_color_cb), gtkwb); - /* +/* gtk_widget_destroy(dialog->cancel_button); gtk_widget_destroy(dialog->help_button); - */ - g_object_get(G_OBJECT(dialog), "ok-button", &ok_button, NULL); - +*/ + g_object_get(G_OBJECT(dialog), "ok-button", &ok_button, NULL); + g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(color_selection_dialog_destroy), gtkwb); @@ -888,7 +887,7 @@ static void color_select_dialog(GtkWidget *widget, PidginWhiteboard *gtkwb) pidgin_whiteboard_rgb24_to_rgb48(gtkwb->brush_color, &color); gtk_color_selection_set_current_color( - GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(dialog)), &color); + GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(dialog)), &color); gtk_widget_show_all(GTK_WIDGET(dialog)); } diff --git a/pidgin/pidginstock.c b/pidgin/pidginstock.c index 38d402fc15..8e3f0be019 100644 --- a/pidgin/pidginstock.c +++ b/pidgin/pidginstock.c @@ -95,7 +95,7 @@ static const GtkStockItem stock_items[] = typedef struct { const char *name; - const char *dir; + const char *dir; const char *filename; gboolean microscopic; gboolean extra_small; -- cgit v1.2.1 From ba47a65f206be687af841a001f52c84416ec2eaf Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 13 Feb 2011 07:39:13 +0000 Subject: Remove unused variable. --- pidgin/gtkutils.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 4cb8820c1e..ad0d00a2f9 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -681,8 +681,6 @@ create_protocols_menu(const char *default_proto_id) if (facebook_name && strcmp(facebook_name, plugin->info->name) < 0) { char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "16", "facebook.png", NULL); - GtkWidget *item; - pixbuf = gdk_pixbuf_new_from_file(filename, NULL); g_free(filename); -- cgit v1.2.1 From 002d02bb2480887a1d329bcb984f74c315c25231 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 14 Mar 2011 06:41:44 +0000 Subject: Fix some changes for the scrollable stuff. --- pidgin/gtkplugin.c | 2 +- pidgin/gtkutils.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkplugin.c b/pidgin/gtkplugin.c index 84b3f687cd..35ed0a325a 100644 --- a/pidgin/gtkplugin.c +++ b/pidgin/gtkplugin.c @@ -776,7 +776,7 @@ void pidgin_plugin_dialog_show() gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); gtk_tree_view_column_set_sort_column_id(col, 1); g_object_unref(G_OBJECT(ls)); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(plugin_dialog))), pidgin_make_scrollable(event_view, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1), TRUE, TRUE, 0); gtk_tree_view_set_search_column(GTK_TREE_VIEW(event_view), 1); diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index d64f2cd301..107367bcba 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -3433,7 +3433,7 @@ pidgin_make_scrollable(GtkWidget *child, GtkPolicyType hscrollbar_policy, GtkPol if (width != -1 || height != -1) gtk_widget_set_size_request(sw, width, height); if (child) { - if (GTK_WIDGET_GET_CLASS(child)->set_scroll_adjustments_signal) + if (GTK_IS_SCROLLABLE(child)) gtk_container_add(GTK_CONTAINER(sw), child); else gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), child); -- cgit v1.2.1 From af60ff376e7f29f29a3d6f36d6e557fcf4523d05 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 14 Mar 2011 06:45:05 +0000 Subject: Enable the menu-refreshing logic in the conversation menu, now that the signal (un)blocking affects the correct widget. --- pidgin/gtkconv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index a061169aa9..00e62b3e2d 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3501,7 +3501,6 @@ regenerate_plugins_items(PidginWindow *win) g_object_set_data(G_OBJECT(win->window), "plugin-actions", action_items); } -#if 0 static void menubar_activated(GtkWidget *item, gpointer data) { PidginWindow *win = data; @@ -3520,12 +3519,11 @@ focus_out_from_menubar(GtkWidget *wid, PidginWindow *win) { /* The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time * the 'Conversation' menu pops up. */ - GtkWidget *menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation")); + GtkWidget *menuitem = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/ConversationMenu"); g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win); g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar), G_CALLBACK(focus_out_from_menubar), win); } -#endif static GtkWidget * setup_menubar(PidginWindow *win) @@ -3534,6 +3532,7 @@ setup_menubar(PidginWindow *win) const char *method; GtkActionGroup *action_group; GError *error; + GtkWidget *menuitem; action_group = gtk_action_group_new("ConversationActions"); gtk_action_group_add_actions(action_group, @@ -3568,6 +3567,9 @@ setup_menubar(PidginWindow *win) win->menu.menubar = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation"); + menuitem = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/ConversationMenu"); + g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menubar_activated), win); + win->menu.view_log = gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/ViewLog"); -- cgit v1.2.1 From 256f17bc430c24a4c65b7e5ad4609901f39a994e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 15 Mar 2011 04:15:58 +0000 Subject: Port the markerline to cairo and the new draw signal. --- pidgin/plugins/markerline.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/pidgin/plugins/markerline.c b/pidgin/plugins/markerline.c index b4d3bea30e..23104a4aed 100644 --- a/pidgin/plugins/markerline.c +++ b/pidgin/plugins/markerline.c @@ -42,7 +42,7 @@ #define PREF_CHATS PREF_PREFIX "/chats" static int -imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *gtkconv) +imhtml_expose_cb(GtkWidget *widget, cairo_t *cr, PidginConversation *gtkconv) { int y, last_y, offset; GdkRectangle visible_rect; @@ -51,6 +51,7 @@ imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *g int pad; PurpleConversation *conv = gtkconv->active_conv; PurpleConversationType type = purple_conversation_get_type(conv); + GdkColor red = {0, 0xffff, 0, 0}; if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS))) @@ -76,20 +77,12 @@ imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *g gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, 0, last_y, 0, &y); - /* TODO: port this to using Cairo - if (y >= event->area.y) - { - GdkColor red = {0, 0xffff, 0, 0}; - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(event->window)); - - gdk_cairo_set_source_color(cr, &red); - cairo_move_to(cr, 0.0, y + 0.5); - cairo_rel_line_to(cr, visible_rect.width, 0.0); - cairo_set_line_width(cr, 1.0); - cairo_stroke(cr); - cairo_destroy(cr); - } - */ + gdk_cairo_set_source_color(cr, &red); + cairo_move_to(cr, 0.0, y + 0.5); + cairo_rel_line_to(cr, visible_rect.width, 0.0); + cairo_set_line_width(cr, 1.0); + cairo_stroke(cr); + return FALSE; } @@ -175,7 +168,7 @@ static void attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) { detach_from_gtkconv(gtkconv, NULL); - g_signal_connect(G_OBJECT(gtkconv->imhtml), "expose_event", + g_signal_connect(G_OBJECT(gtkconv->imhtml), "draw", G_CALLBACK(imhtml_expose_cb), gtkconv); } -- cgit v1.2.1 From a38959401ce1e77cd3021b8d7161a44ed13da4a5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 15 Mar 2011 04:33:51 +0000 Subject: The default widget name for gtkconv->tab_label should be "tab-label", not NULL, as that's what's set when it's created. See line ~9429. --- pidgin/gtkconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 00e62b3e2d..31cbd4b33f 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6927,7 +6927,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) atk_object_set_description(accessibility_obj, _("New Event")); style = "tab-label-event"; } else { - style = NULL; + style = "tab-label"; } gtk_widget_set_name(gtkconv->tab_label, style); -- cgit v1.2.1 From 19110f49468fdd4c40adebc809831b5fef3f4aea Mon Sep 17 00:00:00 2001 From: John Bailey Date: Tue, 15 Mar 2011 22:37:34 +0000 Subject: 3.0.0devel. Let the mergefest begin. --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 4c79c86224..83d6b0d8d8 100644 --- a/configure.ac +++ b/configure.ac @@ -43,9 +43,9 @@ AC_PREREQ([2.50]) # # Make sure to update finch/libgnt/configure.ac with libgnt version changes. # -m4_define([purple_lt_current], [8]) -m4_define([purple_major_version], [2]) -m4_define([purple_minor_version], [8]) +m4_define([purple_lt_current], [9]) +m4_define([purple_major_version], [3]) +m4_define([purple_minor_version], [0]) m4_define([purple_micro_version], [0]) m4_define([purple_version_suffix], [devel]) m4_define([purple_version], -- cgit v1.2.1 From 774ff3715825415724331a2d3f2f91de3e488f00 Mon Sep 17 00:00:00 2001 From: John Bailey Date: Tue, 15 Mar 2011 23:12:35 +0000 Subject: We want libpurple.so.1, not libpurple.so.9. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 83d6b0d8d8..4c0dfd942d 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,7 @@ AC_PREREQ([2.50]) # # Make sure to update finch/libgnt/configure.ac with libgnt version changes. # -m4_define([purple_lt_current], [9]) +m4_define([purple_lt_current], [1]) m4_define([purple_major_version], [3]) m4_define([purple_minor_version], [0]) m4_define([purple_micro_version], [0]) -- cgit v1.2.1 From a2d9ccba828dba466fb969fb14eee41b73626430 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 16 Mar 2011 19:45:26 +0000 Subject: Update the pkg-config versions. Also, drop the unversioned pc files, to be less confusing. --- configure.ac | 12 ++++-------- libpurple/Makefile.am | 6 +++--- libpurple/purple-2-uninstalled.pc.in | 22 ---------------------- libpurple/purple-2.pc.in | 16 ---------------- libpurple/purple-3-uninstalled.pc.in | 22 ++++++++++++++++++++++ libpurple/purple-3.pc.in | 16 ++++++++++++++++ libpurple/purple-uninstalled.pc.in | 19 ------------------- libpurple/purple.pc.in | 16 ---------------- pidgin/Makefile.am | 6 +++--- pidgin/pidgin-2-uninstalled.pc.in | 21 --------------------- pidgin/pidgin-2.pc.in | 15 --------------- pidgin/pidgin-3-uninstalled.pc.in | 21 +++++++++++++++++++++ pidgin/pidgin-3.pc.in | 15 +++++++++++++++ pidgin/pidgin-uninstalled.pc.in | 18 ------------------ pidgin/pidgin.pc.in | 16 ---------------- 15 files changed, 84 insertions(+), 157 deletions(-) delete mode 100644 libpurple/purple-2-uninstalled.pc.in delete mode 100644 libpurple/purple-2.pc.in create mode 100644 libpurple/purple-3-uninstalled.pc.in create mode 100644 libpurple/purple-3.pc.in delete mode 100644 libpurple/purple-uninstalled.pc.in delete mode 100644 libpurple/purple.pc.in delete mode 100644 pidgin/pidgin-2-uninstalled.pc.in delete mode 100644 pidgin/pidgin-2.pc.in create mode 100644 pidgin/pidgin-3-uninstalled.pc.in create mode 100644 pidgin/pidgin-3.pc.in delete mode 100644 pidgin/pidgin-uninstalled.pc.in delete mode 100644 pidgin/pidgin.pc.in diff --git a/configure.ac b/configure.ac index 83d6b0d8d8..40f6e10854 100644 --- a/configure.ac +++ b/configure.ac @@ -2536,10 +2536,8 @@ AC_CONFIG_FILES([Makefile m4macros/Makefile pidgin.apspec pidgin/Makefile - pidgin/pidgin.pc - pidgin/pidgin-uninstalled.pc - pidgin/pidgin-2.pc - pidgin/pidgin-2-uninstalled.pc + pidgin/pidgin-3.pc + pidgin/pidgin-3-uninstalled.pc pidgin/pixmaps/Makefile pidgin/pixmaps/emotes/default/24/Makefile pidgin/pixmaps/emotes/none/Makefile @@ -2556,10 +2554,8 @@ AC_CONFIG_FILES([Makefile libpurple/ciphers/Makefile libpurple/example/Makefile libpurple/gconf/Makefile - libpurple/purple.pc - libpurple/purple-uninstalled.pc - libpurple/purple-2.pc - libpurple/purple-2-uninstalled.pc + libpurple/purple-3.pc + libpurple/purple-3-uninstalled.pc libpurple/plugins/Makefile libpurple/plugins/mono/Makefile libpurple/plugins/mono/api/Makefile diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am index fc0541469c..b46cb8fae9 100644 --- a/libpurple/Makefile.am +++ b/libpurple/Makefile.am @@ -9,8 +9,8 @@ EXTRA_DIST = \ purple-send-async \ purple-url-handler \ purple.h.in \ - purple.pc.in \ - purple-uninstalled.pc.in \ + purple-3.pc.in \ + purple-3-uninstalled.pc.in \ version.h.in \ Makefile.mingw \ win32/global.mak \ @@ -30,7 +30,7 @@ GCONF_DIR=gconf endif pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = purple.pc +pkgconfig_DATA = purple-3.pc SUBDIRS = $(GCONF_DIR) plugins protocols ciphers . tests example diff --git a/libpurple/purple-2-uninstalled.pc.in b/libpurple/purple-2-uninstalled.pc.in deleted file mode 100644 index 90e0275cee..0000000000 --- a/libpurple/purple-2-uninstalled.pc.in +++ /dev/null @@ -1,22 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -abs_srcdir=@abs_srcdir@ -abs_builddir=@abs_builddir@ - -abs_top_srcdir=@abs_top_srcdir@ -abs_top_builddir=@abs_top_builddir@ - -plugindir=${libdir}/purple-@PURPLE_MAJOR_VERSION@ - -Name: libpurple -Description: libpurple is a GLib-based instant messenger library. -Version: @VERSION@ -Requires: glib-2.0 -Cflags: -I${abs_top_srcdir} -I${abs_top_builddir} -Libs: ${abs_builddir}/libpurple.la diff --git a/libpurple/purple-2.pc.in b/libpurple/purple-2.pc.in deleted file mode 100644 index 9506b6f5be..0000000000 --- a/libpurple/purple-2.pc.in +++ /dev/null @@ -1,16 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -plugindir=${libdir}/purple-@PURPLE_MAJOR_VERSION@ - -Name: libpurple -Description: libpurple is a GLib-based instant messenger library. -Version: @VERSION@ -Requires: glib-2.0 -Cflags: -I${includedir} -Libs: -L${libdir} -lpurple diff --git a/libpurple/purple-3-uninstalled.pc.in b/libpurple/purple-3-uninstalled.pc.in new file mode 100644 index 0000000000..90e0275cee --- /dev/null +++ b/libpurple/purple-3-uninstalled.pc.in @@ -0,0 +1,22 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datarootdir=@datarootdir@ +datadir=@datadir@ +sysconfdir=@sysconfdir@ + +abs_srcdir=@abs_srcdir@ +abs_builddir=@abs_builddir@ + +abs_top_srcdir=@abs_top_srcdir@ +abs_top_builddir=@abs_top_builddir@ + +plugindir=${libdir}/purple-@PURPLE_MAJOR_VERSION@ + +Name: libpurple +Description: libpurple is a GLib-based instant messenger library. +Version: @VERSION@ +Requires: glib-2.0 +Cflags: -I${abs_top_srcdir} -I${abs_top_builddir} +Libs: ${abs_builddir}/libpurple.la diff --git a/libpurple/purple-3.pc.in b/libpurple/purple-3.pc.in new file mode 100644 index 0000000000..9506b6f5be --- /dev/null +++ b/libpurple/purple-3.pc.in @@ -0,0 +1,16 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datarootdir=@datarootdir@ +datadir=@datadir@ +sysconfdir=@sysconfdir@ + +plugindir=${libdir}/purple-@PURPLE_MAJOR_VERSION@ + +Name: libpurple +Description: libpurple is a GLib-based instant messenger library. +Version: @VERSION@ +Requires: glib-2.0 +Cflags: -I${includedir} +Libs: -L${libdir} -lpurple diff --git a/libpurple/purple-uninstalled.pc.in b/libpurple/purple-uninstalled.pc.in deleted file mode 100644 index 11d4da8a0c..0000000000 --- a/libpurple/purple-uninstalled.pc.in +++ /dev/null @@ -1,19 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -abs_srcdir=@abs_srcdir@ -abs_builddir=@abs_builddir@ - -plugindir=${libdir}/purple-@PURPLE_MAJOR_VERSION@ - -Name: libpurple -Description: libpurple is a GLib-based instant messenger library. -Version: @VERSION@ -Requires: glib-2.0 -Cflags: -I${abs_srcdir} -I${abs_builddir} -Libs: ${abs_builddir}/libpurple.la diff --git a/libpurple/purple.pc.in b/libpurple/purple.pc.in deleted file mode 100644 index c776f6f26f..0000000000 --- a/libpurple/purple.pc.in +++ /dev/null @@ -1,16 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -plugindir=${libdir}/purple-@PURPLE_MAJOR_VERSION@ - -Name: libpurple -Description: libpurple is a GLib-based instant messenger library. -Version: @VERSION@ -Requires: glib-2.0 -Cflags: -I${includedir}/libpurple -Libs: -L${libdir} -lpurple diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index b6a5bd4642..12b7fc3e46 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -3,8 +3,8 @@ EXTRA_DIST = \ getopt.h \ getopt1.c \ Makefile.mingw \ - pidgin.pc.in \ - pidgin-uninstalled.pc.in \ + pidgin-3.pc.in \ + pidgin-3-uninstalled.pc.in \ win32/MinimizeToTray.h \ win32/MinimizeToTray.c \ win32/pidgin_dll_rc.rc.in \ @@ -32,7 +32,7 @@ EXTRA_DIST = \ if ENABLE_GTK pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = pidgin.pc +pkgconfig_DATA = pidgin-3.pc SUBDIRS = pixmaps plugins diff --git a/pidgin/pidgin-2-uninstalled.pc.in b/pidgin/pidgin-2-uninstalled.pc.in deleted file mode 100644 index a2e4fd9da3..0000000000 --- a/pidgin/pidgin-2-uninstalled.pc.in +++ /dev/null @@ -1,21 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -abs_srcdir=@abs_srcdir@ -abs_builddir=@abs_builddir@ - -abs_top_srcdir=@abs_top_srcdir@ -abs_top_builddir=@abs_top_builddir@ - -plugindir=${libdir}/pidgin - -Name: Pidgin -Description: Pidgin is a GTK2-based instant messenger application. -Version: @VERSION@ -Requires: gtk+-2.0 purple -Cflags: -I${abs_top_srcdir} diff --git a/pidgin/pidgin-2.pc.in b/pidgin/pidgin-2.pc.in deleted file mode 100644 index 30c930ae22..0000000000 --- a/pidgin/pidgin-2.pc.in +++ /dev/null @@ -1,15 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -plugindir=${libdir}/pidgin - -Name: Pidgin -Description: Pidgin is a GTK2-based instant messenger application. -Version: @VERSION@ -Requires: gtk+-2.0 purple -Cflags: -I${includedir} diff --git a/pidgin/pidgin-3-uninstalled.pc.in b/pidgin/pidgin-3-uninstalled.pc.in new file mode 100644 index 0000000000..558ad54703 --- /dev/null +++ b/pidgin/pidgin-3-uninstalled.pc.in @@ -0,0 +1,21 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datarootdir=@datarootdir@ +datadir=@datadir@ +sysconfdir=@sysconfdir@ + +abs_srcdir=@abs_srcdir@ +abs_builddir=@abs_builddir@ + +abs_top_srcdir=@abs_top_srcdir@ +abs_top_builddir=@abs_top_builddir@ + +plugindir=${libdir}/pidgin + +Name: Pidgin +Description: Pidgin is a GTK2-based instant messenger application. +Version: @VERSION@ +Requires: gtk+-2.0 purple-3 +Cflags: -I${abs_top_srcdir} diff --git a/pidgin/pidgin-3.pc.in b/pidgin/pidgin-3.pc.in new file mode 100644 index 0000000000..6b60b53544 --- /dev/null +++ b/pidgin/pidgin-3.pc.in @@ -0,0 +1,15 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datarootdir=@datarootdir@ +datadir=@datadir@ +sysconfdir=@sysconfdir@ + +plugindir=${libdir}/pidgin + +Name: Pidgin +Description: Pidgin is a GTK2-based instant messenger application. +Version: @VERSION@ +Requires: gtk+-2.0 purple-3 +Cflags: -I${includedir} diff --git a/pidgin/pidgin-uninstalled.pc.in b/pidgin/pidgin-uninstalled.pc.in deleted file mode 100644 index ba2205ad3f..0000000000 --- a/pidgin/pidgin-uninstalled.pc.in +++ /dev/null @@ -1,18 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -abs_srcdir=@abs_srcdir@ -abs_builddir=@abs_builddir@ - -plugindir=${libdir}/pidgin - -Name: Pidgin -Description: Pidgin is a GTK2-based instant messenger application. -Version: @VERSION@ -Requires: gtk+-2.0 purple -Cflags: -I${abs_srcdir} diff --git a/pidgin/pidgin.pc.in b/pidgin/pidgin.pc.in deleted file mode 100644 index 53e1b88702..0000000000 --- a/pidgin/pidgin.pc.in +++ /dev/null @@ -1,16 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -plugindir=${libdir}/pidgin - -Name: Pidgin -Description: Pidgin is a GTK2-based instant messenger application. -Version: @VERSION@ -Requires: gtk+-2.0 purple -Cflags: -I${includedir}/pidgin - -- cgit v1.2.1 From 6d58849562c01ed5ee78f725dbd83f9c331cbca8 Mon Sep 17 00:00:00 2001 From: John Bailey Date: Thu, 17 Mar 2011 01:42:14 +0000 Subject: Per discussion with rlaager both on the mailing list and in the XMPP MUC, bump purple_lt_current to 20 to pad for continued development on 2.x and correct my previous stupidity with respect to libtool versioning. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 17ec1210ae..f30e85721d 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,7 @@ AC_PREREQ([2.50]) # # Make sure to update finch/libgnt/configure.ac with libgnt version changes. # -m4_define([purple_lt_current], [1]) +m4_define([purple_lt_current], [20]) m4_define([purple_major_version], [3]) m4_define([purple_minor_version], [0]) m4_define([purple_micro_version], [0]) -- cgit v1.2.1 From 5705e8a739c31a221d511f4b23407ea6351570e2 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Thu, 17 Mar 2011 07:39:33 +0000 Subject: Remove the _purple_oscar_convert(). It existed to migrate data from prpl-oscar to prpl-aim and prpl-icq. Fixes #2923 --- libpurple/account.c | 2 +- libpurple/blist.c | 2 -- libpurple/pounce.c | 4 ---- libpurple/savedstatuses.c | 1 - libpurple/util.c | 12 ------------ libpurple/util.h | 10 ---------- 6 files changed, 1 insertion(+), 30 deletions(-) diff --git a/libpurple/account.c b/libpurple/account.c index 338f7d5607..d34559f26a 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -871,7 +871,7 @@ parse_account(xmlnode *node) return NULL; } - ret = purple_account_new(name, _purple_oscar_convert(name, protocol_id)); /* XXX: */ + ret = purple_account_new(name, protocol_id); g_free(name); g_free(protocol_id); diff --git a/libpurple/blist.c b/libpurple/blist.c index bc949031b8..26d27f17c5 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -465,9 +465,7 @@ parse_buddy(PurpleGroup *group, PurpleContact *contact, xmlnode *bnode) acct_name = xmlnode_get_attrib(bnode, "account"); protocol = xmlnode_get_attrib(bnode, "protocol"); - protocol = _purple_oscar_convert(acct_name, protocol); /* XXX: Remove */ proto = xmlnode_get_attrib(bnode, "proto"); - proto = _purple_oscar_convert(acct_name, proto); /* XXX: Remove */ if (!acct_name || (!proto && !protocol)) return; diff --git a/libpurple/pounce.c b/libpurple/pounce.c index 7f9bdedc3e..3219310e7c 100644 --- a/libpurple/pounce.c +++ b/libpurple/pounce.c @@ -405,12 +405,8 @@ end_element_handler(GMarkupParseContext *context, const gchar *element_name, } if (purple_strequal(element_name, "account")) { - char *tmp; g_free(data->account_name); data->account_name = g_strdup(buffer); - tmp = data->protocol_id; - data->protocol_id = g_strdup(_purple_oscar_convert(buffer, tmp)); - g_free(tmp); } else if (purple_strequal(element_name, "pouncee")) { g_free(data->pouncee); diff --git a/libpurple/savedstatuses.c b/libpurple/savedstatuses.c index 70f4190b2a..40377f7b1a 100644 --- a/libpurple/savedstatuses.c +++ b/libpurple/savedstatuses.c @@ -387,7 +387,6 @@ parse_substatus(xmlnode *substatus) const char *protocol; acct_name = xmlnode_get_data(node); protocol = xmlnode_get_attrib(node, "protocol"); - protocol = _purple_oscar_convert(acct_name, protocol); /* XXX: Remove */ if ((acct_name != NULL) && (protocol != NULL)) ret->account = purple_accounts_find(acct_name, protocol); g_free(acct_name); diff --git a/libpurple/util.c b/libpurple/util.c index be03bf2ea5..ee87d49110 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -4941,18 +4941,6 @@ purple_escape_filename(const char *str) return buf; } -const char *_purple_oscar_convert(const char *act, const char *protocol) -{ - if (act && purple_strequal(protocol, "prpl-oscar")) { - int i; - for (i = 0; act[i] != '\0'; i++) - if (!isdigit(act[i])) - return "prpl-aim"; - return "prpl-icq"; - } - return protocol; -} - void purple_restore_default_signal_handlers(void) { #ifndef _WIN32 diff --git a/libpurple/util.h b/libpurple/util.h index 282c4bbfcd..a6d01bd5eb 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -1449,16 +1449,6 @@ const char *purple_unescape_filename(const char *str); */ const char *purple_escape_filename(const char *str); -/** - * This is added temporarily to assist the split of oscar into aim and icq. - * This should not be used by plugins. - * - * @deprecated This function should not be used in new code and should be - * removed in 3.0.0. The aim/icq prpl split happened a long - * time ago, and we don't need to keep migrating old data. - */ -const char *_purple_oscar_convert(const char *act, const char *protocol); - /** * Restore default signal handlers for signals which might reasonably have * handlers. This should be called by a fork()'d child process, since child processes -- cgit v1.2.1 From 8fe6217263787703ca394bee7d5aff42d9421735 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Thu, 17 Mar 2011 07:46:54 +0000 Subject: Remove gaim-compat.h and gtkgaim-compat.h. IT FEELS SO GOOD! You guys have got to try this. Who wants to delete our ~/.gaim/ migration code? --- libpurple/Makefile.am | 1 - libpurple/gaim-compat.h | 2317 ----------------------------------------------- pidgin/Makefile.am | 1 - pidgin/gtkgaim-compat.h | 412 --------- 4 files changed, 2731 deletions(-) delete mode 100644 libpurple/gaim-compat.h delete mode 100644 pidgin/gtkgaim-compat.h diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am index b46cb8fae9..e86fce515f 100644 --- a/libpurple/Makefile.am +++ b/libpurple/Makefile.am @@ -117,7 +117,6 @@ purple_coreheaders = \ desktopitem.h \ eventloop.h \ ft.h \ - gaim-compat.h \ idle.h \ imgstore.h \ log.h \ diff --git a/libpurple/gaim-compat.h b/libpurple/gaim-compat.h deleted file mode 100644 index 0bd8cea0b9..0000000000 --- a/libpurple/gaim-compat.h +++ /dev/null @@ -1,2317 +0,0 @@ -/** - * @file gaim-compat.h Gaim Compat macros - * @ingroup core - */ - -/* pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _GAIM_COMPAT_H_ -#define _GAIM_COMPAT_H_ - -#include - -/* from account.h */ -#define GaimAccountUiOps PurpleAccountUiOps -#define GaimAccount PurpleAccount - -#define GaimFilterAccountFunc PurpleFilterAccountFunc -#define GaimAccountRequestAuthorizationCb PurpleAccountRequestAuthorizationCb - -#define gaim_account_new purple_account_new -#define gaim_account_destroy purple_account_destroy -#define gaim_account_connect purple_account_connect -#define gaim_account_register purple_account_register -#define gaim_account_disconnect purple_account_disconnect -#define gaim_account_notify_added purple_account_notify_added -#define gaim_account_request_add purple_account_request_add -#define gaim_account_request_close purple_account_request_close - -#define gaim_account_request_authorization purple_account_request_authorization -#define gaim_account_request_change_password purple_account_request_change_password -#define gaim_account_request_change_user_info purple_account_request_change_user_info - -#define gaim_account_set_username purple_account_set_username -#define gaim_account_set_password purple_account_set_password -#define gaim_account_set_alias purple_account_set_alias -#define gaim_account_set_user_info purple_account_set_user_info -#define gaim_account_set_buddy_icon_path purple_account_set_buddy_icon_path -#define gaim_account_set_protocol_id purple_account_set_protocol_id -#define gaim_account_set_connection purple_account_set_connection -#define gaim_account_set_remember_password purple_account_set_remember_password -#define gaim_account_set_check_mail purple_account_set_check_mail -#define gaim_account_set_enabled purple_account_set_enabled -#define gaim_account_set_proxy_info purple_account_set_proxy_info -#define gaim_account_set_status_types purple_account_set_status_types -#define gaim_account_set_status purple_account_set_status -#define gaim_account_set_status_list purple_account_set_status_list - -#define gaim_account_clear_settings purple_account_clear_settings - -#define gaim_account_set_int purple_account_set_int -#define gaim_account_set_string purple_account_set_string -#define gaim_account_set_bool purple_account_set_bool - -#define gaim_account_set_ui_int purple_account_set_ui_int -#define gaim_account_set_ui_string purple_account_set_ui_string -#define gaim_account_set_ui_bool purple_account_set_ui_bool - -#define gaim_account_is_connected purple_account_is_connected -#define gaim_account_is_connecting purple_account_is_connecting -#define gaim_account_is_disconnected purple_account_is_disconnected - -#define gaim_account_get_username purple_account_get_username -#define gaim_account_get_password purple_account_get_password -#define gaim_account_get_alias purple_account_get_alias -#define gaim_account_get_user_info purple_account_get_user_info -#define gaim_account_get_buddy_icon_path purple_account_get_buddy_icon_path -#define gaim_account_get_protocol_id purple_account_get_protocol_id -#define gaim_account_get_protocol_name purple_account_get_protocol_name -#define gaim_account_get_connection purple_account_get_connection -#define gaim_account_get_remember_password purple_account_get_remember_password -#define gaim_account_get_check_mail purple_account_get_check_mail -#define gaim_account_get_enabled purple_account_get_enabled -#define gaim_account_get_proxy_info purple_account_get_proxy_info -#define gaim_account_get_active_status purple_account_get_active_status -#define gaim_account_get_status purple_account_get_status -#define gaim_account_get_status_type purple_account_get_status_type -#define gaim_account_get_status_type_with_primitive \ - purple_account_get_status_type_with_primitive - -#define gaim_account_get_presence purple_account_get_presence -#define gaim_account_is_status_active purple_account_is_status_active -#define gaim_account_get_status_types purple_account_get_status_types - -#define gaim_account_get_int purple_account_get_int -#define gaim_account_get_string purple_account_get_string -#define gaim_account_get_bool purple_account_get_bool - -#define gaim_account_get_ui_int purple_account_get_ui_int -#define gaim_account_get_ui_string purple_account_get_ui_string -#define gaim_account_get_ui_bool purple_account_get_ui_bool - - -#define gaim_account_get_log purple_account_get_log -#define gaim_account_destroy_log purple_account_destroy_log - -#define gaim_account_add_buddy purple_account_add_buddy -#define gaim_account_add_buddies purple_account_add_buddies -#define gaim_account_remove_buddy purple_account_remove_buddy -#define gaim_account_remove_buddies purple_account_remove_buddies - -#define gaim_account_remove_group purple_account_remove_group - -#define gaim_account_change_password purple_account_change_password - -#define gaim_account_supports_offline_message purple_account_supports_offline_message - -#define gaim_accounts_add purple_accounts_add -#define gaim_accounts_remove purple_accounts_remove -#define gaim_accounts_delete purple_accounts_delete -#define gaim_accounts_reorder purple_accounts_reorder - -#define gaim_accounts_get_all purple_accounts_get_all -#define gaim_accounts_get_all_active purple_accounts_get_all_active - -#define gaim_accounts_find purple_accounts_find - -#define gaim_accounts_restore_current_statuses purple_accounts_restore_current_statuses - -#define gaim_accounts_set_ui_ops purple_accounts_set_ui_ops -#define gaim_accounts_get_ui_ops purple_accounts_get_ui_ops - -#define gaim_accounts_get_handle purple_accounts_get_handle - -#define gaim_accounts_init purple_accounts_init -#define gaim_accounts_uninit purple_accounts_uninit - -/* from accountopt.h */ - -#define GaimAccountOption PurpleAccountOption -#define GaimAccountUserSplit PurpleAccountUserSplit - -#define gaim_account_option_new purple_account_option_new -#define gaim_account_option_bool_new purple_account_option_bool_new -#define gaim_account_option_int_new purple_account_option_int_new -#define gaim_account_option_string_new purple_account_option_string_new -#define gaim_account_option_list_new purple_account_option_list_new - -#define gaim_account_option_destroy purple_account_option_destroy - -#define gaim_account_option_set_default_bool purple_account_option_set_default_bool -#define gaim_account_option_set_default_int purple_account_option_set_default_int -#define gaim_account_option_set_default_string purple_account_option_set_default_string - -#define gaim_account_option_set_masked purple_account_option_set_masked - -#define gaim_account_option_set_list purple_account_option_set_list - -#define gaim_account_option_add_list_item purple_account_option_add_list_item - -#define gaim_account_option_get_type purple_account_option_get_type -#define gaim_account_option_get_text purple_account_option_get_text -#define gaim_account_option_get_setting purple_account_option_get_setting - -#define gaim_account_option_get_default_bool purple_account_option_get_default_bool -#define gaim_account_option_get_default_int purple_account_option_get_default_int -#define gaim_account_option_get_default_string purple_account_option_get_default_string -#define gaim_account_option_get_default_list_value purple_account_option_get_default_list_value - -#define gaim_account_option_get_masked purple_account_option_get_masked -#define gaim_account_option_get_list purple_account_option_get_list - -#define gaim_account_user_split_new purple_account_user_split_new -#define gaim_account_user_split_destroy purple_account_user_split_destroy - -#define gaim_account_user_split_get_text purple_account_user_split_get_text -#define gaim_account_user_split_get_default_value purple_account_user_split_get_default_value -#define gaim_account_user_split_get_separator purple_account_user_split_get_separator - -/* from blist.h */ - -#define GaimBuddyList PurpleBuddyList -#define GaimBlistUiOps PurpleBlistUiOps -#define GaimBlistNode PurpleBlistNode - -#define GaimChat PurpleChat -#define GaimGroup PurpleGroup -#define GaimContact PurpleContact -#define GaimBuddy PurpleBuddy - -#define GAIM_BLIST_GROUP_NODE PURPLE_BLIST_GROUP_NODE -#define GAIM_BLIST_CONTACT_NODE PURPLE_BLIST_CONTACT_NODE -#define GAIM_BLIST_BUDDY_NODE PURPLE_BLIST_BUDDY_NODE -#define GAIM_BLIST_CHAT_NODE PURPLE_BLIST_CHAT_NODE -#define GAIM_BLIST_OTHER_NODE PURPLE_BLIST_OTHER_NODE -#define GaimBlistNodeType PurpleBlistNodeType - -#define GAIM_BLIST_NODE_IS_CHAT PURPLE_BLIST_NODE_IS_CHAT -#define GAIM_BLIST_NODE_IS_BUDDY PURPLE_BLIST_NODE_IS_BUDDY -#define GAIM_BLIST_NODE_IS_CONTACT PURPLE_BLIST_NODE_IS_CONTACT -#define GAIM_BLIST_NODE_IS_GROUP PURPLE_BLIST_NODE_IS_GROUP - -#define GAIM_BUDDY_IS_ONLINE PURPLE_BUDDY_IS_ONLINE - -#define GAIM_BLIST_NODE_FLAG_NO_SAVE PURPLE_BLIST_NODE_FLAG_NO_SAVE -#define GaimBlistNodeFlags PurpleBlistNodeFlags - -#define GAIM_BLIST_NODE_HAS_FLAG PURPLE_BLIST_NODE_HAS_FLAG -#define GAIM_BLIST_NODE_SHOULD_SAVE PURPLE_BLIST_NODE_SHOULD_SAVE - -#define GAIM_BLIST_NODE_NAME PURPLE_BLIST_NODE_NAME - - -#define gaim_blist_new purple_blist_new -#define gaim_set_blist purple_set_blist -#define gaim_get_blist purple_get_blist - -#define gaim_blist_get_root purple_blist_get_root -#define gaim_blist_node_next purple_blist_node_next - -#define gaim_blist_show purple_blist_show - -#define gaim_blist_destroy purple_blist_destroy - -#define gaim_blist_set_visible purple_blist_set_visible - -#define gaim_blist_update_buddy_status purple_blist_update_buddy_status -#define gaim_blist_update_buddy_icon purple_blist_update_buddy_icon - - -#define gaim_blist_alias_contact purple_blist_alias_contact -#define gaim_blist_alias_buddy purple_blist_alias_buddy -#define gaim_blist_server_alias_buddy purple_blist_server_alias_buddy -#define gaim_blist_alias_chat purple_blist_alias_chat - -#define gaim_blist_rename_buddy purple_blist_rename_buddy -#define gaim_blist_rename_group purple_blist_rename_group - -#define gaim_chat_new purple_chat_new -#define gaim_blist_add_chat purple_blist_add_chat - -#define gaim_buddy_new purple_buddy_new -#define gaim_buddy_set_icon purple_buddy_set_icon -#define gaim_buddy_get_account purple_buddy_get_account -#define gaim_buddy_get_name purple_buddy_get_name -#define gaim_buddy_get_icon purple_buddy_get_icon -#define gaim_buddy_get_contact purple_buddy_get_contact -#define gaim_buddy_get_presence purple_buddy_get_presence - -#define gaim_blist_add_buddy purple_blist_add_buddy - -#define gaim_group_new purple_group_new - -#define gaim_blist_add_group purple_blist_add_group - -#define gaim_contact_new purple_contact_new - -#define gaim_blist_add_contact purple_blist_add_contact -#define gaim_blist_merge_contact purple_blist_merge_contact - -#define gaim_contact_get_priority_buddy purple_contact_get_priority_buddy -#define gaim_contact_set_alias purple_contact_set_alias -#define gaim_contact_get_alias purple_contact_get_alias -#define gaim_contact_on_account purple_contact_on_account - -#define gaim_contact_invalidate_priority_buddy purple_contact_invalidate_priority_buddy - -#define gaim_blist_remove_buddy purple_blist_remove_buddy -#define gaim_blist_remove_contact purple_blist_remove_contact -#define gaim_blist_remove_chat purple_blist_remove_chat -#define gaim_blist_remove_group purple_blist_remove_group - -#define gaim_buddy_get_alias_only purple_buddy_get_alias_only -#define gaim_buddy_get_server_alias purple_buddy_get_server_alias -#define gaim_buddy_get_contact_alias purple_buddy_get_contact_alias -#define gaim_buddy_get_local_alias purple_buddy_get_local_alias -#define gaim_buddy_get_alias purple_buddy_get_alias - -#define gaim_chat_get_name purple_chat_get_name - -#define gaim_find_buddy purple_find_buddy -#define gaim_find_buddy_in_group purple_find_buddy_in_group -#define gaim_find_buddies purple_find_buddies - -#define gaim_find_group purple_find_group - -#define gaim_blist_find_chat purple_blist_find_chat - -#define gaim_chat_get_group purple_chat_get_group -#define gaim_buddy_get_group purple_buddy_get_group - -#define gaim_group_get_accounts purple_group_get_accounts -#define gaim_group_on_account purple_group_on_account - -#define gaim_blist_add_account purple_blist_add_account -#define gaim_blist_remove_account purple_blist_remove_account - -#define gaim_blist_get_group_size purple_blist_get_group_size -#define gaim_blist_get_group_online_count purple_blist_get_group_online_count - -#define gaim_blist_load purple_blist_load -#define gaim_blist_schedule_save purple_blist_schedule_save - -#define gaim_blist_request_add_buddy purple_blist_request_add_buddy -#define gaim_blist_request_add_chat purple_blist_request_add_chat -#define gaim_blist_request_add_group purple_blist_request_add_group - -#define gaim_blist_node_set_bool purple_blist_node_set_bool -#define gaim_blist_node_get_bool purple_blist_node_get_bool -#define gaim_blist_node_set_int purple_blist_node_set_int -#define gaim_blist_node_get_int purple_blist_node_get_int -#define gaim_blist_node_set_string purple_blist_node_set_string -#define gaim_blist_node_get_string purple_blist_node_get_string - -#define gaim_blist_node_remove_setting purple_blist_node_remove_setting - -#define gaim_blist_node_set_flags purple_blist_node_set_flags -#define gaim_blist_node_get_flags purple_blist_node_get_flags - -#define gaim_blist_node_get_extended_menu purple_blist_node_get_extended_menu - -#define gaim_blist_set_ui_ops purple_blist_set_ui_ops -#define gaim_blist_get_ui_ops purple_blist_get_ui_ops - -#define gaim_blist_get_handle purple_blist_get_handle - -#define gaim_blist_init purple_blist_init -#define gaim_blist_uninit purple_blist_uninit - - -#define GaimBuddyIcon PurpleBuddyIcon - -#define gaim_buddy_icon_new(account, username, icon_data, icon_len)\ - purple_buddy_icon_new(account, username, g_memdup(icon_data, icon_len), icon_len) -#define gaim_buddy_icon_ref purple_buddy_icon_ref -#define gaim_buddy_icon_unref purple_buddy_icon_unref -#define gaim_buddy_icon_update purple_buddy_icon_update - -#define gaim_buddy_icon_set_data(icon, data, len) \ - purple_buddy_icon_set_data(icon, g_memdup(data, len), len, NULL); - -#define gaim_buddy_icon_get_account purple_buddy_icon_get_account -#define gaim_buddy_icon_get_username purple_buddy_icon_get_username -#define gaim_buddy_icon_get_data purple_buddy_icon_get_data -#define gaim_buddy_icon_get_type purple_buddy_icon_get_extension - -#define gaim_buddy_icons_set_for_user(icon, data, len) \ - purple_buddy_icons_set_for_user(icon, g_memdup(data, len), len, NULL) -#define gaim_buddy_icons_set_caching purple_buddy_icons_set_caching -#define gaim_buddy_icons_is_caching purple_buddy_icons_is_caching -#define gaim_buddy_icons_set_cache_dir purple_buddy_icons_set_cache_dir -#define gaim_buddy_icons_get_cache_dir purple_buddy_icons_get_cache_dir -#define gaim_buddy_icons_get_handle purple_buddy_icons_get_handle - -#define gaim_buddy_icons_init purple_buddy_icons_init -#define gaim_buddy_icons_uninit purple_buddy_icons_uninit - -#define gaim_buddy_icon_get_scale_size purple_buddy_icon_get_scale_size - -/* from cipher.h */ - -#define GAIM_CIPHER PURPLE_CIPHER -#define GAIM_CIPHER_OPS PURPLE_CIPHER_OPS -#define GAIM_CIPHER_CONTEXT PURPLE_CIPHER_CONTEXT - -#define GaimCipher PurpleCipher -#define GaimCipherOps PurpleCipherOps -#define GaimCipherContext PurpleCipherContext - -#define GAIM_CIPHER_CAPS_SET_OPT PURPLE_CIPHER_CAPS_SET_OPT -#define GAIM_CIPHER_CAPS_GET_OPT PURPLE_CIPHER_CAPS_GET_OPT -#define GAIM_CIPHER_CAPS_INIT PURPLE_CIPHER_CAPS_INIT -#define GAIM_CIPHER_CAPS_RESET PURPLE_CIPHER_CAPS_RESET -#define GAIM_CIPHER_CAPS_UNINIT PURPLE_CIPHER_CAPS_UNINIT -#define GAIM_CIPHER_CAPS_SET_IV PURPLE_CIPHER_CAPS_SET_IV -#define GAIM_CIPHER_CAPS_APPEND PURPLE_CIPHER_CAPS_APPEND -#define GAIM_CIPHER_CAPS_DIGEST PURPLE_CIPHER_CAPS_DIGEST -#define GAIM_CIPHER_CAPS_ENCRYPT PURPLE_CIPHER_CAPS_ENCRYPT -#define GAIM_CIPHER_CAPS_DECRYPT PURPLE_CIPHER_CAPS_DECRYPT -#define GAIM_CIPHER_CAPS_SET_SALT PURPLE_CIPHER_CAPS_SET_SALT -#define GAIM_CIPHER_CAPS_GET_SALT_SIZE PURPLE_CIPHER_CAPS_GET_SALT_SIZE -#define GAIM_CIPHER_CAPS_SET_KEY PURPLE_CIPHER_CAPS_SET_KEY -#define GAIM_CIPHER_CAPS_GET_KEY_SIZE PURPLE_CIPHER_CAPS_GET_KEY_SIZE -#define GAIM_CIPHER_CAPS_UNKNOWN PURPLE_CIPHER_CAPS_UNKNOWN - -#define gaim_cipher_get_name purple_cipher_get_name -#define gaim_cipher_get_capabilities purple_cipher_get_capabilities -#define gaim_cipher_digest_region purple_cipher_digest_region - -#define gaim_ciphers_find_cipher purple_ciphers_find_cipher -#define gaim_ciphers_register_cipher purple_ciphers_register_cipher -#define gaim_ciphers_unregister_cipher purple_ciphers_unregister_cipher -#define gaim_ciphers_get_ciphers purple_ciphers_get_ciphers - -#define gaim_ciphers_get_handle purple_ciphers_get_handle -#define gaim_ciphers_init purple_ciphers_init -#define gaim_ciphers_uninit purple_ciphers_uninit - -#define gaim_cipher_context_set_option purple_cipher_context_set_option -#define gaim_cipher_context_get_option purple_cipher_context_get_option - -#define gaim_cipher_context_new purple_cipher_context_new -#define gaim_cipher_context_new_by_name purple_cipher_context_new_by_name -#define gaim_cipher_context_reset purple_cipher_context_reset -#define gaim_cipher_context_destroy purple_cipher_context_destroy -#define gaim_cipher_context_set_iv purple_cipher_context_set_iv -#define gaim_cipher_context_append purple_cipher_context_append -#define gaim_cipher_context_digest purple_cipher_context_digest -#define gaim_cipher_context_digest_to_str purple_cipher_context_digest_to_str -#define gaim_cipher_context_encrypt purple_cipher_context_encrypt -#define gaim_cipher_context_decrypt purple_cipher_context_decrypt -#define gaim_cipher_context_set_salt purple_cipher_context_set_salt -#define gaim_cipher_context_get_salt_size purple_cipher_context_get_salt_size -#define gaim_cipher_context_set_key purple_cipher_context_set_key -#define gaim_cipher_context_get_key_size purple_cipher_context_get_key_size -#define gaim_cipher_context_set_data purple_cipher_context_set_data -#define gaim_cipher_context_get_data purple_cipher_context_get_data - -#define gaim_cipher_http_digest_calculate_session_key \ - purple_cipher_http_digest_calculate_session_key - -#define gaim_cipher_http_digest_calculate_response \ - purple_cipher_http_digest_calculate_response - -/* from circbuffer.h */ - -#define GaimCircBuffer PurpleCircBuffer - -#define gaim_circ_buffer_new purple_circ_buffer_new -#define gaim_circ_buffer_destroy purple_circ_buffer_destroy -#define gaim_circ_buffer_append purple_circ_buffer_append -#define gaim_circ_buffer_get_max_read purple_circ_buffer_get_max_read -#define gaim_circ_buffer_mark_read purple_circ_buffer_mark_read - -/* from cmds.h */ - -#define GaimCmdPriority PurpleCmdPriority -#define GaimCmdFlag PurpleCmdFlag -#define GaimCmdStatus PurpleCmdStatus -#define GaimCmdRet PurpleCmdRet - -#define GAIM_CMD_STATUS_OK PURPLE_CMD_STATUS_OK -#define GAIM_CMD_STATUS_FAILED PURPLE_CMD_STATUS_FAILED -#define GAIM_CMD_STATUS_NOT_FOUND PURPLE_CMD_STATUS_NOT_FOUND -#define GAIM_CMD_STATUS_WRONG_ARGS PURPLE_CMD_STATUS_WRONG_ARGS -#define GAIM_CMD_STATUS_WRONG_PRPL PURPLE_CMD_STATUS_WRONG_PRPL -#define GAIM_CMD_STATUS_WRONG_TYPE PURPLE_CMD_STATUS_WRONG_TYPE - -#define GAIM_CMD_FUNC PURPLE_CMD_FUNC - -#define GAIM_CMD_RET_OK PURPLE_CMD_RET_OK -#define GAIM_CMD_RET_FAILED PURPLE_CMD_RET_FAILED -#define GAIM_CMD_RET_CONTINUE PURPLE_CMD_RET_CONTINUE - -#define GAIM_CMD_P_VERY_LOW PURPLE_CMD_P_VERY_LOW -#define GAIM_CMD_P_LOW PURPLE_CMD_P_LOW -#define GAIM_CMD_P_DEFAULT PURPLE_CMD_P_DEFAULT -#define GAIM_CMD_P_PRPL PURPLE_CMD_P_PRPL -#define GAIM_CMD_P_PLUGIN PURPLE_CMD_P_PLUGIN -#define GAIM_CMD_P_ALIAS PURPLE_CMD_P_ALIAS -#define GAIM_CMD_P_HIGH PURPLE_CMD_P_HIGH -#define GAIM_CMD_P_VERY_HIGH PURPLE_CMD_P_VERY_HIGH - -#define GAIM_CMD_FLAG_IM PURPLE_CMD_FLAG_IM -#define GAIM_CMD_FLAG_CHAT PURPLE_CMD_FLAG_CHAT -#define GAIM_CMD_FLAG_PRPL_ONLY PURPLE_CMD_FLAG_PRPL_ONLY -#define GAIM_CMD_FLAG_ALLOW_WRONG_ARGS PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS - - -#define GaimCmdFunc PurpleCmdFunc - -#define GaimCmdId PurpleCmdId - -#define gaim_cmd_register purple_cmd_register -#define gaim_cmd_unregister purple_cmd_unregister -#define gaim_cmd_do_command purple_cmd_do_command -#define gaim_cmd_list purple_cmd_list -#define gaim_cmd_help purple_cmd_help - -/* from connection.h */ - -#define GaimConnection PurpleConnection - -#define GAIM_CONNECTION_HTML PURPLE_CONNECTION_HTML -#define GAIM_CONNECTION_NO_BGCOLOR PURPLE_CONNECTION_NO_BGCOLOR -#define GAIM_CONNECTION_AUTO_RESP PURPLE_CONNECTION_AUTO_RESP -#define GAIM_CONNECTION_FORMATTING_WBFO PURPLE_CONNECTION_FORMATTING_WBFO -#define GAIM_CONNECTION_NO_NEWLINES PURPLE_CONNECTION_NO_NEWLINES -#define GAIM_CONNECTION_NO_FONTSIZE PURPLE_CONNECTION_NO_FONTSIZE -#define GAIM_CONNECTION_NO_URLDESC PURPLE_CONNECTION_NO_URLDESC -#define GAIM_CONNECTION_NO_IMAGES PURPLE_CONNECTION_NO_IMAGES - -#define GaimConnectionFlags PurpleConnectionFlags - -#define GAIM_DISCONNECTED PURPLE_DISCONNECTED -#define GAIM_CONNECTED PURPLE_CONNECTED -#define GAIM_CONNECTING PURPLE_CONNECTING - -#define GaimConnectionState PurpleConnectionState - -#define GaimConnectionUiOps PurpleConnectionUiOps - -#define gaim_connection_new purple_connection_new -#define gaim_connection_destroy purple_connection_destroy - -#define gaim_connection_set_state purple_connection_set_state -#define gaim_connection_set_account purple_connection_set_account -#define gaim_connection_set_display_name purple_connection_set_display_name -#define gaim_connection_get_state purple_connection_get_state - -#define GAIM_CONNECTION_IS_CONNECTED PURPLE_CONNECTION_IS_CONNECTED - -#define gaim_connection_get_account purple_connection_get_account -#define gaim_connection_get_password purple_connection_get_password -#define gaim_connection_get_display_name purple_connection_get_display_name - -#define gaim_connection_update_progress purple_connection_update_progress - -#define gaim_connection_notice purple_connection_notice -#define gaim_connection_error purple_connection_error - -#define gaim_connections_disconnect_all purple_connections_disconnect_all - -#define gaim_connections_get_all purple_connections_get_all -#define gaim_connections_get_connecting purple_connections_get_connecting - -#define GAIM_CONNECTION_IS_VALID PURPLE_CONNECTION_IS_VALID - -#define gaim_connections_set_ui_ops purple_connections_set_ui_ops -#define gaim_connections_get_ui_ops purple_connections_get_ui_ops - -#define gaim_connections_init purple_connections_init -#define gaim_connections_uninit purple_connections_uninit -#define gaim_connections_get_handle purple_connections_get_handle - - -/* from conversation.h */ - -#define GaimConversationUiOps PurpleConversationUiOps -#define GaimConversation PurpleConversation -#define GaimConvIm PurpleConvIm -#define GaimConvChat PurpleConvChat -#define GaimConvChatBuddy PurpleConvChatBuddy - -#define GAIM_CONV_TYPE_UNKNOWN PURPLE_CONV_TYPE_UNKNOWN -#define GAIM_CONV_TYPE_IM PURPLE_CONV_TYPE_IM -#define GAIM_CONV_TYPE_CHAT PURPLE_CONV_TYPE_CHAT -#define GAIM_CONV_TYPE_MISC PURPLE_CONV_TYPE_MISC -#define GAIM_CONV_TYPE_ANY PURPLE_CONV_TYPE_ANY - -#define GaimConversationType PurpleConversationType - -#define GAIM_CONV_UPDATE_ADD PURPLE_CONV_UPDATE_ADD -#define GAIM_CONV_UPDATE_REMOVE PURPLE_CONV_UPDATE_REMOVE -#define GAIM_CONV_UPDATE_ACCOUNT PURPLE_CONV_UPDATE_ACCOUNT -#define GAIM_CONV_UPDATE_TYPING PURPLE_CONV_UPDATE_TYPING -#define GAIM_CONV_UPDATE_UNSEEN PURPLE_CONV_UPDATE_UNSEEN -#define GAIM_CONV_UPDATE_LOGGING PURPLE_CONV_UPDATE_LOGGING -#define GAIM_CONV_UPDATE_TOPIC PURPLE_CONV_UPDATE_TOPIC -#define GAIM_CONV_ACCOUNT_ONLINE PURPLE_CONV_ACCOUNT_ONLINE -#define GAIM_CONV_ACCOUNT_OFFLINE PURPLE_CONV_ACCOUNT_OFFLINE -#define GAIM_CONV_UPDATE_AWAY PURPLE_CONV_UPDATE_AWAY -#define GAIM_CONV_UPDATE_ICON PURPLE_CONV_UPDATE_ICON -#define GAIM_CONV_UPDATE_TITLE PURPLE_CONV_UPDATE_TITLE -#define GAIM_CONV_UPDATE_CHATLEFT PURPLE_CONV_UPDATE_CHATLEFT -#define GAIM_CONV_UPDATE_FEATURES PURPLE_CONV_UPDATE_FEATURES - -#define GaimConvUpdateType PurpleConvUpdateType - -#define GAIM_NOT_TYPING PURPLE_NOT_TYPING -#define GAIM_TYPING PURPLE_TYPING -#define GAIM_TYPED PURPLE_TYPED - -#define GaimTypingState PurpleTypingState - -#define GAIM_MESSAGE_SEND PURPLE_MESSAGE_SEND -#define GAIM_MESSAGE_RECV PURPLE_MESSAGE_RECV -#define GAIM_MESSAGE_SYSTEM PURPLE_MESSAGE_SYSTEM -#define GAIM_MESSAGE_AUTO_RESP PURPLE_MESSAGE_AUTO_RESP -#define GAIM_MESSAGE_ACTIVE_ONLY PURPLE_MESSAGE_ACTIVE_ONLY -#define GAIM_MESSAGE_NICK PURPLE_MESSAGE_NICK -#define GAIM_MESSAGE_NO_LOG PURPLE_MESSAGE_NO_LOG -#define GAIM_MESSAGE_WHISPER PURPLE_MESSAGE_WHISPER -#define GAIM_MESSAGE_ERROR PURPLE_MESSAGE_ERROR -#define GAIM_MESSAGE_DELAYED PURPLE_MESSAGE_DELAYED -#define GAIM_MESSAGE_RAW PURPLE_MESSAGE_RAW -#define GAIM_MESSAGE_IMAGES PURPLE_MESSAGE_IMAGES - -#define GaimMessageFlags PurpleMessageFlags - -#define GAIM_CBFLAGS_NONE PURPLE_CBFLAGS_NONE -#define GAIM_CBFLAGS_VOICE PURPLE_CBFLAGS_VOICE -#define GAIM_CBFLAGS_HALFOP PURPLE_CBFLAGS_HALFOP -#define GAIM_CBFLAGS_OP PURPLE_CBFLAGS_OP -#define GAIM_CBFLAGS_FOUNDER PURPLE_CBFLAGS_FOUNDER -#define GAIM_CBFLAGS_TYPING PURPLE_CBFLAGS_TYPING - -#define GaimConvChatBuddyFlags PurpleConvChatBuddyFlags - -#define gaim_conversations_set_ui_ops purple_conversations_set_ui_ops - -#define gaim_conversation_new purple_conversation_new -#define gaim_conversation_destroy purple_conversation_destroy -#define gaim_conversation_present purple_conversation_present -#define gaim_conversation_get_type purple_conversation_get_type -#define gaim_conversation_set_ui_ops purple_conversation_set_ui_ops -#define gaim_conversation_get_ui_ops purple_conversation_get_ui_ops -#define gaim_conversation_set_account purple_conversation_set_account -#define gaim_conversation_get_account purple_conversation_get_account -#define gaim_conversation_get_gc purple_conversation_get_gc -#define gaim_conversation_set_title purple_conversation_set_title -#define gaim_conversation_get_title purple_conversation_get_title -#define gaim_conversation_autoset_title purple_conversation_autoset_title -#define gaim_conversation_set_name purple_conversation_set_name -#define gaim_conversation_get_name purple_conversation_get_name -#define gaim_conversation_set_logging purple_conversation_set_logging -#define gaim_conversation_is_logging purple_conversation_is_logging -#define gaim_conversation_close_logs purple_conversation_close_logs -#define gaim_conversation_get_im_data purple_conversation_get_im_data - -#define GAIM_CONV_IM PURPLE_CONV_IM - -#define gaim_conversation_get_chat_data purple_conversation_get_chat_data - -#define GAIM_CONV_CHAT PURPLE_CONV_CHAT - -#define gaim_conversation_set_data purple_conversation_set_data -#define gaim_conversation_get_data purple_conversation_get_data - -#define gaim_get_conversations purple_get_conversations -#define gaim_get_ims purple_get_ims -#define gaim_get_chats purple_get_chats - -#define gaim_find_conversation_with_account \ - purple_find_conversation_with_account - -#define gaim_conversation_write purple_conversation_write -#define gaim_conversation_set_features purple_conversation_set_features -#define gaim_conversation_get_features purple_conversation_get_features -#define gaim_conversation_has_focus purple_conversation_has_focus -#define gaim_conversation_update purple_conversation_update -#define gaim_conversation_foreach purple_conversation_foreach - -#define gaim_conv_im_get_conversation purple_conv_im_get_conversation -#define gaim_conv_im_set_icon purple_conv_im_set_icon -#define gaim_conv_im_get_icon purple_conv_im_get_icon -#define gaim_conv_im_set_typing_state purple_conv_im_set_typing_state -#define gaim_conv_im_get_typing_state purple_conv_im_get_typing_state - -#define gaim_conv_im_start_typing_timeout purple_conv_im_start_typing_timeout -#define gaim_conv_im_stop_typing_timeout purple_conv_im_stop_typing_timeout -#define gaim_conv_im_get_typing_timeout purple_conv_im_get_typing_timeout -#define gaim_conv_im_set_type_again purple_conv_im_set_type_again -#define gaim_conv_im_get_type_again purple_conv_im_get_type_again - -#define gaim_conv_im_start_send_typed_timeout \ - purple_conv_im_start_send_typed_timeout - -#define gaim_conv_im_stop_send_typed_timeout \ - purple_conv_im_stop_send_typed_timeout - -#define gaim_conv_im_get_send_typed_timeout \ - purple_conv_im_get_send_typed_timeout - -#define gaim_conv_present_error purple_conv_present_error -#define gaim_conv_send_confirm purple_conv_send_confirm - -#define gaim_conv_im_update_typing purple_conv_im_update_typing -#define gaim_conv_im_write purple_conv_im_write -#define gaim_conv_im_send purple_conv_im_send -#define gaim_conv_im_send_with_flags purple_conv_im_send_with_flags - -#define gaim_conv_custom_smiley_add purple_conv_custom_smiley_add -#define gaim_conv_custom_smiley_write purple_conv_custom_smiley_write -#define gaim_conv_custom_smiley_close purple_conv_custom_smiley_close - -#define gaim_conv_chat_get_conversation purple_conv_chat_get_conversation -#define gaim_conv_chat_set_users purple_conv_chat_set_users -#define gaim_conv_chat_get_users purple_conv_chat_get_users -#define gaim_conv_chat_ignore purple_conv_chat_ignore -#define gaim_conv_chat_unignore purple_conv_chat_unignore -#define gaim_conv_chat_set_ignored purple_conv_chat_set_ignored -#define gaim_conv_chat_get_ignored purple_conv_chat_get_ignored -#define gaim_conv_chat_get_ignored_user purple_conv_chat_get_ignored_user -#define gaim_conv_chat_is_user_ignored purple_conv_chat_is_user_ignored -#define gaim_conv_chat_set_topic purple_conv_chat_set_topic -#define gaim_conv_chat_get_topic purple_conv_chat_get_topic -#define gaim_conv_chat_set_id purple_conv_chat_set_id -#define gaim_conv_chat_get_id purple_conv_chat_get_id -#define gaim_conv_chat_write purple_conv_chat_write -#define gaim_conv_chat_send purple_conv_chat_send -#define gaim_conv_chat_send_with_flags purple_conv_chat_send_with_flags -#define gaim_conv_chat_add_user purple_conv_chat_add_user -#define gaim_conv_chat_add_users purple_conv_chat_add_users -#define gaim_conv_chat_rename_user purple_conv_chat_rename_user -#define gaim_conv_chat_remove_user purple_conv_chat_remove_user -#define gaim_conv_chat_remove_users purple_conv_chat_remove_users -#define gaim_conv_chat_find_user purple_conv_chat_find_user -#define gaim_conv_chat_user_set_flags purple_conv_chat_user_set_flags -#define gaim_conv_chat_user_get_flags purple_conv_chat_user_get_flags -#define gaim_conv_chat_clear_users purple_conv_chat_clear_users -#define gaim_conv_chat_set_nick purple_conv_chat_set_nick -#define gaim_conv_chat_get_nick purple_conv_chat_get_nick -#define gaim_conv_chat_left purple_conv_chat_left -#define gaim_conv_chat_has_left purple_conv_chat_has_left - -#define gaim_find_chat purple_find_chat - -#define gaim_conv_chat_cb_new purple_conv_chat_cb_new -#define gaim_conv_chat_cb_find purple_conv_chat_cb_find -#define gaim_conv_chat_cb_get_name purple_conv_chat_cb_get_name -#define gaim_conv_chat_cb_destroy purple_conv_chat_cb_destroy - -#define gaim_conversations_get_handle purple_conversations_get_handle -#define gaim_conversations_init purple_conversations_init -#define gaim_conversations_uninit purple_conversations_uninit - -/* from core.h */ - -#define GaimCore PurpleCore - -#define GaimCoreUiOps PurpleCoreUiOps - -#define gaim_core_init purple_core_init -#define gaim_core_quit purple_core_quit - -#define gaim_core_quit_cb purple_core_quit_cb -#define gaim_core_get_version purple_core_get_version -#define gaim_core_get_ui purple_core_get_ui -#define gaim_get_core purple_get_core -#define gaim_core_set_ui_ops purple_core_set_ui_ops -#define gaim_core_get_ui_ops purple_core_get_ui_ops - -/* from debug.h */ - -#define GAIM_DEBUG_ALL PURPLE_DEBUG_ALL -#define GAIM_DEBUG_MISC PURPLE_DEBUG_MISC -#define GAIM_DEBUG_INFO PURPLE_DEBUG_INFO -#define GAIM_DEBUG_WARNING PURPLE_DEBUG_WARNING -#define GAIM_DEBUG_ERROR PURPLE_DEBUG_ERROR -#define GAIM_DEBUG_FATAL PURPLE_DEBUG_FATAL - -#define GaimDebugLevel PurpleDebugLevel - -#define GaimDebugUiOps PurpleDebugUiOps - - -#define gaim_debug purple_debug -#define gaim_debug_misc purple_debug_misc -#define gaim_debug_info purple_debug_info -#define gaim_debug_warning purple_debug_warning -#define gaim_debug_error purple_debug_error -#define gaim_debug_fatal purple_debug_fatal - -#define gaim_debug_set_enabled purple_debug_set_enabled -#define gaim_debug_is_enabled purple_debug_is_enabled - -#define gaim_debug_set_ui_ops purple_debug_set_ui_ops -#define gaim_debug_get_ui_ops purple_debug_get_ui_ops - -#define gaim_debug_init purple_debug_init - -/* from desktopitem.h */ - -#define GAIM_DESKTOP_ITEM_TYPE_NULL PURPLE_DESKTOP_ITEM_TYPE_NULL -#define GAIM_DESKTOP_ITEM_TYPE_OTHER PURPLE_DESKTOP_ITEM_TYPE_OTHER -#define GAIM_DESKTOP_ITEM_TYPE_APPLICATION PURPLE_DESKTOP_ITEM_TYPE_APPLICATION -#define GAIM_DESKTOP_ITEM_TYPE_LINK PURPLE_DESKTOP_ITEM_TYPE_LINK -#define GAIM_DESKTOP_ITEM_TYPE_FSDEVICE PURPLE_DESKTOP_ITEM_TYPE_FSDEVICE -#define GAIM_DESKTOP_ITEM_TYPE_MIME_TYPE PURPLE_DESKTOP_ITEM_TYPE_MIME_TYPE -#define GAIM_DESKTOP_ITEM_TYPE_DIRECTORY PURPLE_DESKTOP_ITEM_TYPE_DIRECTORY -#define GAIM_DESKTOP_ITEM_TYPE_SERVICE PURPLE_DESKTOP_ITEM_TYPE_SERVICE -#define GAIM_DESKTOP_ITEM_TYPE_SERVICE_TYPE PURPLE_DESKTOP_ITEM_TYPE_SERVICE_TYPE - -#define GaimDesktopItemType PurpleDesktopItemType - -#define GaimDesktopItem PurpleDesktopItem - -#define GAIM_TYPE_DESKTOP_ITEM PURPLE_TYPE_DESKTOP_ITEM -#define gaim_desktop_item_get_type purple_desktop_item_get_type - -/* standard */ -/* ugh, i'm just copying these as strings, rather than pidginifying them */ -#define GAIM_DESKTOP_ITEM_ENCODING "Encoding" /* string */ -#define GAIM_DESKTOP_ITEM_VERSION "Version" /* numeric */ -#define GAIM_DESKTOP_ITEM_NAME "Name" /* localestring */ -#define GAIM_DESKTOP_ITEM_GENERIC_NAME "GenericName" /* localestring */ -#define GAIM_DESKTOP_ITEM_TYPE "Type" /* string */ -#define GAIM_DESKTOP_ITEM_FILE_PATTERN "FilePattern" /* regexp(s) */ -#define GAIM_DESKTOP_ITEM_TRY_EXEC "TryExec" /* string */ -#define GAIM_DESKTOP_ITEM_NO_DISPLAY "NoDisplay" /* boolean */ -#define GAIM_DESKTOP_ITEM_COMMENT "Comment" /* localestring */ -#define GAIM_DESKTOP_ITEM_EXEC "Exec" /* string */ -#define GAIM_DESKTOP_ITEM_ACTIONS "Actions" /* strings */ -#define GAIM_DESKTOP_ITEM_ICON "Icon" /* string */ -#define GAIM_DESKTOP_ITEM_MINI_ICON "MiniIcon" /* string */ -#define GAIM_DESKTOP_ITEM_HIDDEN "Hidden" /* boolean */ -#define GAIM_DESKTOP_ITEM_PATH "Path" /* string */ -#define GAIM_DESKTOP_ITEM_TERMINAL "Terminal" /* boolean */ -#define GAIM_DESKTOP_ITEM_TERMINAL_OPTIONS "TerminalOptions" /* string */ -#define GAIM_DESKTOP_ITEM_SWALLOW_TITLE "SwallowTitle" /* string */ -#define GAIM_DESKTOP_ITEM_SWALLOW_EXEC "SwallowExec" /* string */ -#define GAIM_DESKTOP_ITEM_MIME_TYPE "MimeType" /* regexp(s) */ -#define GAIM_DESKTOP_ITEM_PATTERNS "Patterns" /* regexp(s) */ -#define GAIM_DESKTOP_ITEM_DEFAULT_APP "DefaultApp" /* string */ -#define GAIM_DESKTOP_ITEM_DEV "Dev" /* string */ -#define GAIM_DESKTOP_ITEM_FS_TYPE "FSType" /* string */ -#define GAIM_DESKTOP_ITEM_MOUNT_POINT "MountPoint" /* string */ -#define GAIM_DESKTOP_ITEM_READ_ONLY "ReadOnly" /* boolean */ -#define GAIM_DESKTOP_ITEM_UNMOUNT_ICON "UnmountIcon" /* string */ -#define GAIM_DESKTOP_ITEM_SORT_ORDER "SortOrder" /* strings */ -#define GAIM_DESKTOP_ITEM_URL "URL" /* string */ -#define GAIM_DESKTOP_ITEM_DOC_PATH "X-GNOME-DocPath" /* string */ - -#define gaim_desktop_item_new_from_file purple_desktop_item_new_from_file -#define gaim_desktop_item_get_entry_type purple_desktop_item_get_entry_type -#define gaim_desktop_item_get_string purple_desktop_item_get_string -#define gaim_desktop_item_copy purple_desktop_item_copy -#define gaim_desktop_item_unref purple_desktop_item_unref - -/* from dnsquery.h */ - -#define GaimDnsQueryData PurpleDnsQueryData -#define GaimDnsQueryConnectFunction PurpleDnsQueryConnectFunction - -#define gaim_dnsquery_a purple_dnsquery_a -#define gaim_dnsquery_destroy purple_dnsquery_destroy -#define gaim_dnsquery_init purple_dnsquery_init -#define gaim_dnsquery_uninit purple_dnsquery_uninit -#define gaim_dnsquery_set_ui_ops purple_dnsquery_set_ui_ops -#define gaim_dnsquery_get_host purple_dnsquery_get_host -#define gaim_dnsquery_get_port purple_dnsquery_get_port - -/* from dnssrv.h */ - -#define GaimSrvResponse PurpleSrvResponse -#define GaimSrvQueryData PurpleSrvQueryData -#define GaimSrvCallback PurpleSrvCallback - -#define gaim_srv_resolve purple_srv_resolve -#define gaim_srv_cancel purple_srv_cancel - -/* from eventloop.h */ - -#define GAIM_INPUT_READ PURPLE_INPUT_READ -#define GAIM_INPUT_WRITE PURPLE_INPUT_WRITE - -#define GaimInputCondition PurpleInputCondition -#define GaimInputFunction PurpleInputFunction -#define GaimEventLoopUiOps PurpleEventLoopUiOps - -#define gaim_timeout_add purple_timeout_add -#define gaim_timeout_remove purple_timeout_remove -#define gaim_input_add purple_input_add -#define gaim_input_remove purple_input_remove - -#define gaim_eventloop_set_ui_ops purple_eventloop_set_ui_ops -#define gaim_eventloop_get_ui_ops purple_eventloop_get_ui_ops - -/* from ft.h */ - -#define GaimXfer PurpleXfer - -#define GAIM_XFER_UNKNOWN PURPLE_XFER_UNKNOWN -#define GAIM_XFER_SEND PURPLE_XFER_SEND -#define GAIM_XFER_RECEIVE PURPLE_XFER_RECEIVE - -#define GaimXferType PurpleXferType - -#define GAIM_XFER_STATUS_UNKNOWN PURPLE_XFER_STATUS_UNKNOWN -#define GAIM_XFER_STATUS_NOT_STARTED PURPLE_XFER_STATUS_NOT_STARTED -#define GAIM_XFER_STATUS_ACCEPTED PURPLE_XFER_STATUS_ACCEPTED -#define GAIM_XFER_STATUS_STARTED PURPLE_XFER_STATUS_STARTED -#define GAIM_XFER_STATUS_DONE PURPLE_XFER_STATUS_DONE -#define GAIM_XFER_STATUS_CANCEL_LOCAL PURPLE_XFER_STATUS_CANCEL_LOCAL -#define GAIM_XFER_STATUS_CANCEL_REMOTE PURPLE_XFER_STATUS_CANCEL_REMOTE - -#define GaimXferStatusType PurpleXferStatusType - -#define GaimXferUiOps PurpleXferUiOps - -#define gaim_xfer_new purple_xfer_new -#define gaim_xfer_ref purple_xfer_ref -#define gaim_xfer_unref purple_xfer_unref -#define gaim_xfer_request purple_xfer_request -#define gaim_xfer_request_accepted purple_xfer_request_accepted -#define gaim_xfer_request_denied purple_xfer_request_denied -#define gaim_xfer_get_type purple_xfer_get_type -#define gaim_xfer_get_account purple_xfer_get_account -#define gaim_xfer_get_status purple_xfer_get_status -#define gaim_xfer_is_canceled purple_xfer_is_canceled -#define gaim_xfer_is_completed purple_xfer_is_completed -#define gaim_xfer_get_filename purple_xfer_get_filename -#define gaim_xfer_get_local_filename purple_xfer_get_local_filename -#define gaim_xfer_get_bytes_sent purple_xfer_get_bytes_sent -#define gaim_xfer_get_bytes_remaining purple_xfer_get_bytes_remaining -#define gaim_xfer_get_size purple_xfer_get_size -#define gaim_xfer_get_progress purple_xfer_get_progress -#define gaim_xfer_get_local_port purple_xfer_get_local_port -#define gaim_xfer_get_remote_ip purple_xfer_get_remote_ip -#define gaim_xfer_get_remote_port purple_xfer_get_remote_port -#define gaim_xfer_set_completed purple_xfer_set_completed -#define gaim_xfer_set_message purple_xfer_set_message -#define gaim_xfer_set_filename purple_xfer_set_filename -#define gaim_xfer_set_local_filename purple_xfer_set_local_filename -#define gaim_xfer_set_size purple_xfer_set_size -#define gaim_xfer_set_bytes_sent purple_xfer_set_bytes_sent -#define gaim_xfer_get_ui_ops purple_xfer_get_ui_ops -#define gaim_xfer_set_read_fnc purple_xfer_set_read_fnc -#define gaim_xfer_set_write_fnc purple_xfer_set_write_fnc -#define gaim_xfer_set_ack_fnc purple_xfer_set_ack_fnc -#define gaim_xfer_set_request_denied_fnc purple_xfer_set_request_denied_fnc -#define gaim_xfer_set_init_fnc purple_xfer_set_init_fnc -#define gaim_xfer_set_start_fnc purple_xfer_set_start_fnc -#define gaim_xfer_set_end_fnc purple_xfer_set_end_fnc -#define gaim_xfer_set_cancel_send_fnc purple_xfer_set_cancel_send_fnc -#define gaim_xfer_set_cancel_recv_fnc purple_xfer_set_cancel_recv_fnc - -#define gaim_xfer_read purple_xfer_read -#define gaim_xfer_write purple_xfer_write -#define gaim_xfer_start purple_xfer_start -#define gaim_xfer_end purple_xfer_end -#define gaim_xfer_add purple_xfer_add -#define gaim_xfer_cancel_local purple_xfer_cancel_local -#define gaim_xfer_cancel_remote purple_xfer_cancel_remote -#define gaim_xfer_error purple_xfer_error -#define gaim_xfer_update_progress purple_xfer_update_progress -#define gaim_xfer_conversation_write purple_xfer_conversation_write - -#define gaim_xfers_get_handle purple_xfers_get_handle -#define gaim_xfers_init purple_xfers_init -#define gaim_xfers_uninit purple_xfers_uninit -#define gaim_xfers_set_ui_ops purple_xfers_set_ui_ops -#define gaim_xfers_get_ui_ops purple_xfers_get_ui_ops - -/* from gaim-client.h */ - -#define gaim_init purple_init - -/* from idle.h */ - -#define GaimIdleUiOps PurpleIdleUiOps - -#define gaim_idle_touch purple_idle_touch -#define gaim_idle_set purple_idle_set -#define gaim_idle_set_ui_ops purple_idle_set_ui_ops -#define gaim_idle_get_ui_ops purple_idle_get_ui_ops -#define gaim_idle_init purple_idle_init -#define gaim_idle_uninit purple_idle_uninit - -/* from imgstore.h */ - -#define GaimStoredImage PurpleStoredImage - -#define gaim_imgstore_add(data, size, filename) \ - purple_imgstore_add_with_id(g_memdup(data, size), size, filename) -#define gaim_imgstore_get purple_imgstore_find_by_id -#define gaim_imgstore_get_data purple_imgstore_get_data -#define gaim_imgstore_get_size purple_imgstore_get_size -#define gaim_imgstore_get_filename purple_imgstore_get_filename -#define gaim_imgstore_ref purple_imgstore_ref_by_id -#define gaim_imgstore_unref purple_imgstore_unref_by_id - - -/* from log.h */ - -#define GaimLog PurpleLog -#define GaimLogLogger PurpleLogLogger -#define GaimLogCommonLoggerData PurpleLogCommonLoggerData -#define GaimLogSet PurpleLogSet - -#define GAIM_LOG_IM PURPLE_LOG_IM -#define GAIM_LOG_CHAT PURPLE_LOG_CHAT -#define GAIM_LOG_SYSTEM PURPLE_LOG_SYSTEM - -#define GaimLogType PurpleLogType - -#define GAIM_LOG_READ_NO_NEWLINE PURPLE_LOG_READ_NO_NEWLINE - -#define GaimLogReadFlags PurpleLogReadFlags - -#define GaimLogSetCallback PurpleLogSetCallback - -#define gaim_log_new purple_log_new -#define gaim_log_free purple_log_free -#define gaim_log_write purple_log_write -#define gaim_log_read purple_log_read - -#define gaim_log_get_logs purple_log_get_logs -#define gaim_log_get_log_sets purple_log_get_log_sets -#define gaim_log_get_system_logs purple_log_get_system_logs -#define gaim_log_get_size purple_log_get_size -#define gaim_log_get_total_size purple_log_get_total_size -#define gaim_log_get_log_dir purple_log_get_log_dir -#define gaim_log_compare purple_log_compare -#define gaim_log_set_compare purple_log_set_compare -#define gaim_log_set_free purple_log_set_free - -#define gaim_log_common_writer purple_log_common_writer -#define gaim_log_common_lister purple_log_common_lister -#define gaim_log_common_total_sizer purple_log_common_total_sizer -#define gaim_log_common_sizer purple_log_common_sizer - -#define gaim_log_logger_new purple_log_logger_new -#define gaim_log_logger_free purple_log_logger_free -#define gaim_log_logger_add purple_log_logger_add -#define gaim_log_logger_remove purple_log_logger_remove -#define gaim_log_logger_set purple_log_logger_set -#define gaim_log_logger_get purple_log_logger_get - -#define gaim_log_logger_get_options purple_log_logger_get_options - -#define gaim_log_init purple_log_init -#define gaim_log_get_handle purple_log_get_handle -#define gaim_log_uninit purple_log_uninit - -/* from mime.h */ - -#define GaimMimeDocument PurpleMimeDocument -#define GaimMimePart PurpleMimePart - -#define gaim_mime_document_new purple_mime_document_new -#define gaim_mime_document_free purple_mime_document_free -#define gaim_mime_document_parse purple_mime_document_parse -#define gaim_mime_document_parsen purple_mime_document_parsen -#define gaim_mime_document_write purple_mime_document_write -#define gaim_mime_document_get_fields purple_mime_document_get_fields -#define gaim_mime_document_get_field purple_mime_document_get_field -#define gaim_mime_document_set_field purple_mime_document_set_field -#define gaim_mime_document_get_parts purple_mime_document_get_parts - -#define gaim_mime_part_new purple_mime_part_new -#define gaim_mime_part_get_fields purple_mime_part_get_fields -#define gaim_mime_part_get_field purple_mime_part_get_field -#define gaim_mime_part_get_field_decoded purple_mime_part_get_field_decoded -#define gaim_mime_part_set_field purple_mime_part_set_field -#define gaim_mime_part_get_data purple_mime_part_get_data -#define gaim_mime_part_get_data_decoded purple_mime_part_get_data_decoded -#define gaim_mime_part_get_length purple_mime_part_get_length -#define gaim_mime_part_set_data purple_mime_part_set_data - - -/* from network.h */ - -#define GaimNetworkListenData PurpleNetworkListenData - -#define GaimNetworkListenCallback PurpleNetworkListenCallback - -#define gaim_network_ip_atoi purple_network_ip_atoi -#define gaim_network_set_public_ip purple_network_set_public_ip -#define gaim_network_get_public_ip purple_network_get_public_ip -#define gaim_network_get_local_system_ip purple_network_get_local_system_ip -#define gaim_network_get_my_ip purple_network_get_my_ip - -#define gaim_network_listen purple_network_listen -#define gaim_network_listen_range purple_network_listen_range -#define gaim_network_listen_cancel purple_network_listen_cancel -#define gaim_network_get_port_from_fd purple_network_get_port_from_fd - -#define gaim_network_is_available purple_network_is_available - -#define gaim_network_init purple_network_init -#define gaim_network_uninit purple_network_uninit - -/* from notify.h */ - - -#define GaimNotifyUserInfoEntry PurpleNotifyUserInfoEntry -#define GaimNotifyUserInfo PurpleNotifyUserInfo - -#define GaimNotifyCloseCallback PurpleNotifyCloseCallback - -#define GAIM_NOTIFY_MESSAGE PURPLE_NOTIFY_MESSAGE -#define GAIM_NOTIFY_EMAIL PURPLE_NOTIFY_EMAIL -#define GAIM_NOTIFY_EMAILS PURPLE_NOTIFY_EMAILS -#define GAIM_NOTIFY_FORMATTED PURPLE_NOTIFY_FORMATTED -#define GAIM_NOTIFY_SEARCHRESULTS PURPLE_NOTIFY_SEARCHRESULTS -#define GAIM_NOTIFY_USERINFO PURPLE_NOTIFY_USERINFO -#define GAIM_NOTIFY_URI PURPLE_NOTIFY_URI - -#define GaimNotifyType PurpleNotifyType - -#define GAIM_NOTIFY_MSG_ERROR PURPLE_NOTIFY_MSG_ERROR -#define GAIM_NOTIFY_MSG_WARNING PURPLE_NOTIFY_MSG_WARNING -#define GAIM_NOTIFY_MSG_INFO PURPLE_NOTIFY_MSG_INFO - -#define GaimNotifyMsgType PurpleNotifyMsgType - -#define GAIM_NOTIFY_BUTTON_LABELED PURPLE_NOTIFY_BUTTON_LABELED -#define GAIM_NOTIFY_BUTTON_CONTINUE PURPLE_NOTIFY_BUTTON_CONTINUE -#define GAIM_NOTIFY_BUTTON_ADD PURPLE_NOTIFY_BUTTON_ADD -#define GAIM_NOTIFY_BUTTON_INFO PURPLE_NOTIFY_BUTTON_INFO -#define GAIM_NOTIFY_BUTTON_IM PURPLE_NOTIFY_BUTTON_IM -#define GAIM_NOTIFY_BUTTON_JOIN PURPLE_NOTIFY_BUTTON_JOIN -#define GAIM_NOTIFY_BUTTON_INVITE PURPLE_NOTIFY_BUTTON_INVITE - -#define GaimNotifySearchButtonType PurpleNotifySearchButtonType - -#define GaimNotifySearchResults PurpleNotifySearchResults - -#define GAIM_NOTIFY_USER_INFO_ENTRY_PAIR PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR -#define GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK -#define GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER - -#define GaimNotifyUserInfoEntryType PurpleNotifyUserInfoEntryType - -#define GaimNotifySearchColumn PurpleNotifySearchColumn -#define GaimNotifySearchResultsCallback PurpleNotifySearchResultsCallback -#define GaimNotifySearchButton PurpleNotifySearchButton - -#define GaimNotifyUiOps PurpleNotifyUiOps - -#define gaim_notify_searchresults purple_notify_searchresults -#define gaim_notify_searchresults_free purple_notify_searchresults_free -#define gaim_notify_searchresults_new_rows purple_notify_searchresults_new_rows -#define gaim_notify_searchresults_button_add purple_notify_searchresults_button_add -#define gaim_notify_searchresults_button_add_labeled purple_notify_searchresults_button_add_labeled -#define gaim_notify_searchresults_new purple_notify_searchresults_new -#define gaim_notify_searchresults_column_new purple_notify_searchresults_column_new -#define gaim_notify_searchresults_column_add purple_notify_searchresults_column_add -#define gaim_notify_searchresults_row_add purple_notify_searchresults_row_add -#define gaim_notify_searchresults_get_rows_count purple_notify_searchresults_get_rows_count -#define gaim_notify_searchresults_get_columns_count purple_notify_searchresults_get_columns_count -#define gaim_notify_searchresults_row_get purple_notify_searchresults_row_get -#define gaim_notify_searchresults_column_get_title purple_notify_searchresults_column_get_title - -#define gaim_notify_message purple_notify_message -#define gaim_notify_email purple_notify_email -#define gaim_notify_emails purple_notify_emails -#define gaim_notify_formatted purple_notify_formatted -#define gaim_notify_userinfo purple_notify_userinfo - -#define gaim_notify_user_info_new purple_notify_user_info_new -#define gaim_notify_user_info_destroy purple_notify_user_info_destroy -#define gaim_notify_user_info_get_entries purple_notify_user_info_get_entries -#define gaim_notify_user_info_get_text_with_newline purple_notify_user_info_get_text_with_newline -#define gaim_notify_user_info_add_pair purple_notify_user_info_add_pair -#define gaim_notify_user_info_prepend_pair purple_notify_user_info_prepend_pair -#define gaim_notify_user_info_remove_entry purple_notify_user_info_remove_entry -#define gaim_notify_user_info_entry_new purple_notify_user_info_entry_new -#define gaim_notify_user_info_add_section_break purple_notify_user_info_add_section_break -#define gaim_notify_user_info_add_section_header purple_notify_user_info_add_section_header -#define gaim_notify_user_info_remove_last_item purple_notify_user_info_remove_last_item -#define gaim_notify_user_info_entry_get_label purple_notify_user_info_entry_get_label -#define gaim_notify_user_info_entry_set_label purple_notify_user_info_entry_set_label -#define gaim_notify_user_info_entry_get_value purple_notify_user_info_entry_get_value -#define gaim_notify_user_info_entry_set_value purple_notify_user_info_entry_set_value -#define gaim_notify_user_info_entry_get_type purple_notify_user_info_entry_get_type -#define gaim_notify_user_info_entry_set_type purple_notify_user_info_entry_set_type - -#define gaim_notify_uri purple_notify_uri -#define gaim_notify_close purple_notify_close -#define gaim_notify_close_with_handle purple_notify_close_with_handle - -#define gaim_notify_info purple_notify_info -#define gaim_notify_warning purple_notify_warning -#define gaim_notify_error purple_notify_error - -#define gaim_notify_set_ui_ops purple_notify_set_ui_ops -#define gaim_notify_get_ui_ops purple_notify_get_ui_ops - -#define gaim_notify_get_handle purple_notify_get_handle - -#define gaim_notify_init purple_notify_init -#define gaim_notify_uninit purple_notify_uninit - -/* from ntlm.h */ - -#define gaim_ntlm_gen_type1 purple_ntlm_gen_type1 -#define gaim_ntlm_parse_type2 purple_ntlm_parse_type2 -#define gaim_ntlm_gen_type3 purple_ntlm_gen_type3 - -/* from plugin.h */ - -#ifdef GAIM_PLUGINS -#ifndef PURPLE_PLUGINS -#define PURPLE_PLUGINS -#endif -#endif - -#define GaimPlugin PurplePlugin -#define GaimPluginInfo PurplePluginInfo -#define GaimPluginUiInfo PurplePluginUiInfo -#define GaimPluginLoaderInfo PurplePluginLoaderInfo -#define GaimPluginAction PurplePluginAction -#define GaimPluginPriority PurplePluginPriority - -#define GAIM_PLUGIN_UNKNOWN PURPLE_PLUGIN_UNKNOWN -#define GAIM_PLUGIN_STANDARD PURPLE_PLUGIN_STANDARD -#define GAIM_PLUGIN_LOADER PURPLE_PLUGIN_LOADER -#define GAIM_PLUGIN_PROTOCOL PURPLE_PLUGIN_PROTOCOL - -#define GaimPluginType PurplePluginType - -#define GAIM_PRIORITY_DEFAULT PURPLE_PRIORITY_DEFAULT -#define GAIM_PRIORITY_HIGHEST PURPLE_PRIORITY_HIGHEST -#define GAIM_PRIORITY_LOWEST PURPLE_PRIORITY_LOWEST - -#define GAIM_PLUGIN_FLAG_INVISIBLE PURPLE_PLUGIN_FLAG_INVISIBLE - -#define GAIM_PLUGIN_MAGIC PURPLE_PLUGIN_MAGIC - -#define GAIM_PLUGIN_LOADER_INFO PURPLE_PLUGIN_LOADER_INFO -#define GAIM_PLUGIN_HAS_PREF_FRAME PURPLE_PLUGIN_HAS_PREF_FRAME -#define GAIM_PLUGIN_UI_INFO PURPLE_PLUGIN_UI_INFO - -#define GAIM_PLUGIN_HAS_ACTIONS PURPLE_PLUGIN_HAS_ACTIONS -#define GAIM_PLUGIN_ACTIONS PURPLE_PLUGIN_ACTIONS - -#define GAIM_INIT_PLUGIN PURPLE_INIT_PLUGIN - -#define gaim_plugin_new purple_plugin_new -#define gaim_plugin_probe purple_plugin_probe -#define gaim_plugin_register purple_plugin_register -#define gaim_plugin_load purple_plugin_load -#define gaim_plugin_unload purple_plugin_unload -#define gaim_plugin_reload purple_plugin_reload -#define gaim_plugin_destroy purple_plugin_destroy -#define gaim_plugin_is_loaded purple_plugin_is_loaded -#define gaim_plugin_is_unloadable purple_plugin_is_unloadable -#define gaim_plugin_get_id purple_plugin_get_id -#define gaim_plugin_get_name purple_plugin_get_name -#define gaim_plugin_get_version purple_plugin_get_version -#define gaim_plugin_get_summary purple_plugin_get_summary -#define gaim_plugin_get_description purple_plugin_get_description -#define gaim_plugin_get_author purple_plugin_get_author -#define gaim_plugin_get_homepage purple_plugin_get_homepage - -#define gaim_plugin_ipc_register purple_plugin_ipc_register -#define gaim_plugin_ipc_unregister purple_plugin_ipc_unregister -#define gaim_plugin_ipc_unregister_all purple_plugin_ipc_unregister_all -#define gaim_plugin_ipc_get_params purple_plugin_ipc_get_params -#define gaim_plugin_ipc_call purple_plugin_ipc_call - -#define gaim_plugins_add_search_path purple_plugins_add_search_path -#define gaim_plugins_unload_all purple_plugins_unload_all -#define gaim_plugins_destroy_all purple_plugins_destroy_all -#define gaim_plugins_save_loaded purple_plugins_save_loaded -#define gaim_plugins_load_saved purple_plugins_load_saved -#define gaim_plugins_probe purple_plugins_probe -#define gaim_plugins_enabled purple_plugins_enabled - -#define gaim_plugins_register_probe_notify_cb purple_plugins_register_probe_notify_cb -#define gaim_plugins_unregister_probe_notify_cb purple_plugins_unregister_probe_notify_cb -#define gaim_plugins_register_load_notify_cb purple_plugins_register_load_notify_cb -#define gaim_plugins_unregister_load_notify_cb purple_plugins_unregister_load_notify_cb -#define gaim_plugins_register_unload_notify_cb purple_plugins_register_unload_notify_cb -#define gaim_plugins_unregister_unload_notify_cb purple_plugins_unregister_unload_notify_cb - -#define gaim_plugins_find_with_name purple_plugins_find_with_name -#define gaim_plugins_find_with_filename purple_plugins_find_with_filename -#define gaim_plugins_find_with_basename purple_plugins_find_with_basename -#define gaim_plugins_find_with_id purple_plugins_find_with_id - -#define gaim_plugins_get_loaded purple_plugins_get_loaded -#define gaim_plugins_get_protocols purple_plugins_get_protocols -#define gaim_plugins_get_all purple_plugins_get_all - -#define gaim_plugins_get_handle purple_plugins_get_handle -#define gaim_plugins_init purple_plugins_init -#define gaim_plugins_uninit purple_plugins_uninit - -#define gaim_plugin_action_new purple_plugin_action_new -#define gaim_plugin_action_free purple_plugin_action_free - -/* pluginpref.h */ - -#define GaimPluginPrefFrame PurplePluginPrefFrame -#define GaimPluginPref PurplePluginPref - -#define GAIM_STRING_FORMAT_TYPE_NONE PURPLE_STRING_FORMAT_TYPE_NONE -#define GAIM_STRING_FORMAT_TYPE_MULTILINE PURPLE_STRING_FORMAT_TYPE_MULTILINE -#define GAIM_STRING_FORMAT_TYPE_HTML PURPLE_STRING_FORMAT_TYPE_HTML - -#define GaimStringFormatType PurpleStringFormatType - -#define GAIM_PLUGIN_PREF_NONE PURPLE_PLUGIN_PREF_NONE -#define GAIM_PLUGIN_PREF_CHOICE PURPLE_PLUGIN_PREF_CHOICE -#define GAIM_PLUGIN_PREF_INFO PURPLE_PLUGIN_PREF_INFO -#define GAIM_PLUGIN_PREF_STRING_FORMAT PURPLE_PLUGIN_PREF_STRING_FORMAT - -#define GaimPluginPrefType PurplePluginPrefType - -#define gaim_plugin_pref_frame_new purple_plugin_pref_frame_new -#define gaim_plugin_pref_frame_destroy purple_plugin_pref_frame_destroy -#define gaim_plugin_pref_frame_add purple_plugin_pref_frame_add -#define gaim_plugin_pref_frame_get_prefs purple_plugin_pref_frame_get_prefs - -#define gaim_plugin_pref_new purple_plugin_pref_new -#define gaim_plugin_pref_new_with_name purple_plugin_pref_new_with_name -#define gaim_plugin_pref_new_with_label purple_plugin_pref_new_with_label -#define gaim_plugin_pref_new_with_name_and_label purple_plugin_pref_new_with_name_and_label -#define gaim_plugin_pref_destroy purple_plugin_pref_destroy -#define gaim_plugin_pref_set_name purple_plugin_pref_set_name -#define gaim_plugin_pref_get_name purple_plugin_pref_get_name -#define gaim_plugin_pref_set_label purple_plugin_pref_set_label -#define gaim_plugin_pref_get_label purple_plugin_pref_get_label -#define gaim_plugin_pref_set_bounds purple_plugin_pref_set_bounds -#define gaim_plugin_pref_get_bounds purple_plugin_pref_get_bounds -#define gaim_plugin_pref_set_type purple_plugin_pref_set_type -#define gaim_plugin_pref_get_type purple_plugin_pref_get_type -#define gaim_plugin_pref_add_choice purple_plugin_pref_add_choice -#define gaim_plugin_pref_get_choices purple_plugin_pref_get_choices -#define gaim_plugin_pref_set_max_length purple_plugin_pref_set_max_length -#define gaim_plugin_pref_get_max_length purple_plugin_pref_get_max_length -#define gaim_plugin_pref_set_masked purple_plugin_pref_set_masked -#define gaim_plugin_pref_get_masked purple_plugin_pref_get_masked -#define gaim_plugin_pref_set_format_type purple_plugin_pref_set_format_type -#define gaim_plugin_pref_get_format_type purple_plugin_pref_get_format_type - -/* from pounce.h */ - -#define GaimPounce PurplePounce - -#define GAIM_POUNCE_NONE PURPLE_POUNCE_NONE -#define GAIM_POUNCE_SIGNON PURPLE_POUNCE_SIGNON -#define GAIM_POUNCE_SIGNOFF PURPLE_POUNCE_SIGNOFF -#define GAIM_POUNCE_AWAY PURPLE_POUNCE_AWAY -#define GAIM_POUNCE_AWAY_RETURN PURPLE_POUNCE_AWAY_RETURN -#define GAIM_POUNCE_IDLE PURPLE_POUNCE_IDLE -#define GAIM_POUNCE_IDLE_RETURN PURPLE_POUNCE_IDLE_RETURN -#define GAIM_POUNCE_TYPING PURPLE_POUNCE_TYPING -#define GAIM_POUNCE_TYPED PURPLE_POUNCE_TYPED -#define GAIM_POUNCE_TYPING_STOPPED PURPLE_POUNCE_TYPING_STOPPED -#define GAIM_POUNCE_MESSAGE_RECEIVED PURPLE_POUNCE_MESSAGE_RECEIVED -#define GaimPounceEvent PurplePounceEvent - -#define GAIM_POUNCE_OPTION_NONE PURPLE_POUNCE_OPTION_NONE -#define GAIM_POUNCE_OPTION_AWAY PURPLE_POUNCE_OPTION_AWAY -#define GaimPounceOption PurplePounceOption - -#define GaimPounceCb PurplePounceCb - -#define gaim_pounce_new purple_pounce_new -#define gaim_pounce_destroy purple_pounce_destroy -#define gaim_pounce_destroy_all_by_account purple_pounce_destroy_all_by_account -#define gaim_pounce_set_events purple_pounce_set_events -#define gaim_pounce_set_options purple_pounce_set_options -#define gaim_pounce_set_pouncer purple_pounce_set_pouncer -#define gaim_pounce_set_pouncee purple_pounce_set_pouncee -#define gaim_pounce_set_save purple_pounce_set_save -#define gaim_pounce_action_register purple_pounce_action_register -#define gaim_pounce_action_set_enabled purple_pounce_action_set_enabled -#define gaim_pounce_action_set_attribute purple_pounce_action_set_attribute -#define gaim_pounce_set_data purple_pounce_set_data -#define gaim_pounce_get_events purple_pounce_get_events -#define gaim_pounce_get_options purple_pounce_get_options -#define gaim_pounce_get_pouncer purple_pounce_get_pouncer -#define gaim_pounce_get_pouncee purple_pounce_get_pouncee -#define gaim_pounce_get_save purple_pounce_get_save -#define gaim_pounce_action_is_enabled purple_pounce_action_is_enabled -#define gaim_pounce_action_get_attribute purple_pounce_action_get_attribute -#define gaim_pounce_get_data purple_pounce_get_data -#define gaim_pounce_execute purple_pounce_execute - -#define gaim_find_pounce purple_find_pounce -#define gaim_pounces_load purple_pounces_load -#define gaim_pounces_register_handler purple_pounces_register_handler -#define gaim_pounces_unregister_handler purple_pounces_unregister_handler -#define gaim_pounces_get_all purple_pounces_get_all -#define gaim_pounces_get_handle purple_pounces_get_handle -#define gaim_pounces_init purple_pounces_init -#define gaim_pounces_uninit purple_pounces_uninit - -/* from prefs.h */ - - -#define GAIM_PREF_NONE PURPLE_PREF_NONE -#define GAIM_PREF_BOOLEAN PURPLE_PREF_BOOLEAN -#define GAIM_PREF_INT PURPLE_PREF_INT -#define GAIM_PREF_STRING PURPLE_PREF_STRING -#define GAIM_PREF_STRING_LIST PURPLE_PREF_STRING_LIST -#define GAIM_PREF_PATH PURPLE_PREF_PATH -#define GAIM_PREF_PATH_LIST PURPLE_PREF_PATH_LIST -#define GaimPrefType PurplePrefType - -#define GaimPrefCallback PurplePrefCallback - -#define gaim_prefs_get_handle purple_prefs_get_handle -#define gaim_prefs_init purple_prefs_init -#define gaim_prefs_uninit purple_prefs_uninit -#define gaim_prefs_add_none purple_prefs_add_none -#define gaim_prefs_add_bool purple_prefs_add_bool -#define gaim_prefs_add_int purple_prefs_add_int -#define gaim_prefs_add_string purple_prefs_add_string -#define gaim_prefs_add_string_list purple_prefs_add_string_list -#define gaim_prefs_add_path purple_prefs_add_path -#define gaim_prefs_add_path_list purple_prefs_add_path_list -#define gaim_prefs_remove purple_prefs_remove -#define gaim_prefs_rename purple_prefs_rename -#define gaim_prefs_rename_boolean_toggle purple_prefs_rename_boolean_toggle -#define gaim_prefs_destroy purple_prefs_destroy -#define gaim_prefs_set_generic purple_prefs_set_generic -#define gaim_prefs_set_bool purple_prefs_set_bool -#define gaim_prefs_set_int purple_prefs_set_int -#define gaim_prefs_set_string purple_prefs_set_string -#define gaim_prefs_set_string_list purple_prefs_set_string_list -#define gaim_prefs_set_path purple_prefs_set_path -#define gaim_prefs_set_path_list purple_prefs_set_path_list -#define gaim_prefs_exists purple_prefs_exists -#define gaim_prefs_get_type purple_prefs_get_type -#define gaim_prefs_get_bool purple_prefs_get_bool -#define gaim_prefs_get_int purple_prefs_get_int -#define gaim_prefs_get_string purple_prefs_get_string -#define gaim_prefs_get_string_list purple_prefs_get_string_list -#define gaim_prefs_get_path purple_prefs_get_path -#define gaim_prefs_get_path_list purple_prefs_get_path_list -#define gaim_prefs_connect_callback purple_prefs_connect_callback -#define gaim_prefs_disconnect_callback purple_prefs_disconnect_callback -#define gaim_prefs_disconnect_by_handle purple_prefs_disconnect_by_handle -#define gaim_prefs_trigger_callback purple_prefs_trigger_callback -#define gaim_prefs_load purple_prefs_load -#define gaim_prefs_update_old purple_prefs_update_old - -/* from privacy.h */ - -#define GAIM_PRIVACY_ALLOW_ALL PURPLE_PRIVACY_ALLOW_ALL -#define GAIM_PRIVACY_DENY_ALL PURPLE_PRIVACY_DENY_ALL -#define GAIM_PRIVACY_ALLOW_USERS PURPLE_PRIVACY_ALLOW_USERS -#define GAIM_PRIVACY_DENY_USERS PURPLE_PRIVACY_DENY_USERS -#define GAIM_PRIVACY_ALLOW_BUDDYLIST PURPLE_PRIVACY_ALLOW_BUDDYLIST -#define GaimPrivacyType PurplePrivacyType - -#define GaimPrivacyUiOps PurplePrivacyUiOps - -#define gaim_privacy_permit_add purple_privacy_permit_add -#define gaim_privacy_permit_remove purple_privacy_permit_remove -#define gaim_privacy_deny_add purple_privacy_deny_add -#define gaim_privacy_deny_remove purple_privacy_deny_remove -#define gaim_privacy_allow purple_privacy_allow -#define gaim_privacy_deny purple_privacy_deny -#define gaim_privacy_check purple_privacy_check -#define gaim_privacy_set_ui_ops purple_privacy_set_ui_ops -#define gaim_privacy_get_ui_ops purple_privacy_get_ui_ops -#define gaim_privacy_init purple_privacy_init - -/* from proxy.h */ - -#define GAIM_PROXY_USE_GLOBAL PURPLE_PROXY_USE_GLOBAL -#define GAIM_PROXY_NONE PURPLE_PROXY_NONE -#define GAIM_PROXY_HTTP PURPLE_PROXY_HTTP -#define GAIM_PROXY_SOCKS4 PURPLE_PROXY_SOCKS4 -#define GAIM_PROXY_SOCKS5 PURPLE_PROXY_SOCKS5 -#define GAIM_PROXY_USE_ENVVAR PURPLE_PROXY_USE_ENVVAR -#define GaimProxyType PurpleProxyType - -#define GaimProxyInfo PurpleProxyInfo - -#define GaimProxyConnectData PurpleProxyConnectData -#define GaimProxyConnectFunction PurpleProxyConnectFunction - -#define gaim_proxy_info_new purple_proxy_info_new -#define gaim_proxy_info_destroy purple_proxy_info_destroy -#define gaim_proxy_info_set_type purple_proxy_info_set_type -#define gaim_proxy_info_set_host purple_proxy_info_set_host -#define gaim_proxy_info_set_port purple_proxy_info_set_port -#define gaim_proxy_info_set_username purple_proxy_info_set_username -#define gaim_proxy_info_set_password purple_proxy_info_set_password -#define gaim_proxy_info_get_type purple_proxy_info_get_type -#define gaim_proxy_info_get_host purple_proxy_info_get_host -#define gaim_proxy_info_get_port purple_proxy_info_get_port -#define gaim_proxy_info_get_username purple_proxy_info_get_username -#define gaim_proxy_info_get_password purple_proxy_info_get_password - -#define gaim_global_proxy_get_info purple_global_proxy_get_info -#define gaim_proxy_get_handle purple_proxy_get_handle -#define gaim_proxy_init purple_proxy_init -#define gaim_proxy_uninit purple_proxy_uninit -#define gaim_proxy_get_setup purple_proxy_get_setup - -#define gaim_proxy_connect purple_proxy_connect -#define gaim_proxy_connect_socks5 purple_proxy_connect_socks5 -#define gaim_proxy_connect_cancel purple_proxy_connect_cancel -#define gaim_proxy_connect_cancel_with_handle purple_proxy_connect_cancel_with_handle - -/* from prpl.h */ - -#define GaimPluginProtocolInfo PurplePluginProtocolInfo - -#define GAIM_ICON_SCALE_DISPLAY PURPLE_ICON_SCALE_DISPLAY -#define GAIM_ICON_SCALE_SEND PURPLE_ICON_SCALE_SEND -#define GaimIconScaleRules PurpleIconScaleRules - -#define GaimBuddyIconSpec PurpleBuddyIconSpec - -#define GaimProtocolOptions PurpleProtocolOptions - -#define GAIM_IS_PROTOCOL_PLUGIN PURPLE_IS_PROTOCOL_PLUGIN - -#define GAIM_PLUGIN_PROTOCOL_INFO PURPLE_PLUGIN_PROTOCOL_INFO - -#define gaim_prpl_got_account_idle purple_prpl_got_account_idle -#define gaim_prpl_got_account_login_time purple_prpl_got_account_login_time -#define gaim_prpl_got_account_status purple_prpl_got_account_status -#define gaim_prpl_got_user_idle purple_prpl_got_user_idle -#define gaim_prpl_got_user_login_time purple_prpl_got_user_login_time -#define gaim_prpl_got_user_status purple_prpl_got_user_status -#define gaim_prpl_change_account_status purple_prpl_change_account_status -#define gaim_prpl_get_statuses purple_prpl_get_statuses - -#define gaim_find_prpl purple_find_prpl - -/* from request.h */ - -#define GAIM_DEFAULT_ACTION_NONE PURPLE_DEFAULT_ACTION_NONE - -#define GAIM_REQUEST_INPUT PURPLE_REQUEST_INPUT -#define GAIM_REQUEST_CHOICE PURPLE_REQUEST_CHOICE -#define GAIM_REQUEST_ACTION PURPLE_REQUEST_ACTION -#define GAIM_REQUEST_FIELDS PURPLE_REQUEST_FIELDS -#define GAIM_REQUEST_FILE PURPLE_REQUEST_FILE -#define GAIM_REQUEST_FOLDER PURPLE_REQUEST_FOLDER -#define GaimRequestType PurpleRequestType - -#define GAIM_REQUEST_FIELD_NONE PURPLE_REQUEST_FIELD_NONE -#define GAIM_REQUEST_FIELD_STRING PURPLE_REQUEST_FIELD_STRING -#define GAIM_REQUEST_FIELD_INTEGER PURPLE_REQUEST_FIELD_INTEGER -#define GAIM_REQUEST_FIELD_BOOLEAN PURPLE_REQUEST_FIELD_BOOLEAN -#define GAIM_REQUEST_FIELD_CHOICE PURPLE_REQUEST_FIELD_CHOICE -#define GAIM_REQUEST_FIELD_LIST PURPLE_REQUEST_FIELD_LIST -#define GAIM_REQUEST_FIELD_LABEL PURPLE_REQUEST_FIELD_LABEL -#define GAIM_REQUEST_FIELD_IMAGE PURPLE_REQUEST_FIELD_IMAGE -#define GAIM_REQUEST_FIELD_ACCOUNT PURPLE_REQUEST_FIELD_ACCOUNT -#define GaimRequestFieldType PurpleRequestFieldType - -#define GaimRequestFields PurpleRequestFields - -#define GaimRequestFieldGroup PurpleRequestFieldGroup - -#define GaimRequestField PurpleRequestField - -#define GaimRequestUiOps PurpleRequestUiOps - -#define GaimRequestInputCb PurpleRequestInputCb -#define GaimRequestActionCb PurpleRequestActionCb -#define GaimRequestChoiceCb PurpleRequestChoiceCb -#define GaimRequestFieldsCb PurpleRequestFieldsCb -#define GaimRequestFileCb PurpleRequestFileCb - -#define gaim_request_fields_new purple_request_fields_new -#define gaim_request_fields_destroy purple_request_fields_destroy -#define gaim_request_fields_add_group purple_request_fields_add_group -#define gaim_request_fields_get_groups purple_request_fields_get_groups -#define gaim_request_fields_exists purple_request_fields_exists -#define gaim_request_fields_get_required purple_request_fields_get_required -#define gaim_request_fields_is_field_required purple_request_fields_is_field_required -#define gaim_request_fields_all_required_filled purple_request_fields_all_required_filled -#define gaim_request_fields_get_field purple_request_fields_get_field -#define gaim_request_fields_get_string purple_request_fields_get_string -#define gaim_request_fields_get_integer purple_request_fields_get_integer -#define gaim_request_fields_get_bool purple_request_fields_get_bool -#define gaim_request_fields_get_choice purple_request_fields_get_choice -#define gaim_request_fields_get_account purple_request_fields_get_account - -#define gaim_request_field_group_new purple_request_field_group_new -#define gaim_request_field_group_destroy purple_request_field_group_destroy -#define gaim_request_field_group_add_field purple_request_field_group_add_field -#define gaim_request_field_group_get_title purple_request_field_group_get_title -#define gaim_request_field_group_get_fields purple_request_field_group_get_fields - -#define gaim_request_field_new purple_request_field_new -#define gaim_request_field_destroy purple_request_field_destroy -#define gaim_request_field_set_label purple_request_field_set_label -#define gaim_request_field_set_visible purple_request_field_set_visible -#define gaim_request_field_set_type_hint purple_request_field_set_type_hint -#define gaim_request_field_set_required purple_request_field_set_required -#define gaim_request_field_get_type purple_request_field_get_type -#define gaim_request_field_get_id purple_request_field_get_id -#define gaim_request_field_get_label purple_request_field_get_label -#define gaim_request_field_is_visible purple_request_field_is_visible -#define gaim_request_field_get_type_hint purple_request_field_get_type_hint -#define gaim_request_field_is_required purple_request_field_is_required - -#define gaim_request_field_string_new purple_request_field_string_new -#define gaim_request_field_string_set_default_value \ - purple_request_field_string_set_default_value -#define gaim_request_field_string_set_value purple_request_field_string_set_value -#define gaim_request_field_string_set_masked purple_request_field_string_set_masked -#define gaim_request_field_string_set_editable purple_request_field_string_set_editable -#define gaim_request_field_string_get_default_value \ - purple_request_field_string_get_default_value -#define gaim_request_field_string_get_value purple_request_field_string_get_value -#define gaim_request_field_string_is_multiline purple_request_field_string_is_multiline -#define gaim_request_field_string_is_masked purple_request_field_string_is_masked -#define gaim_request_field_string_is_editable purple_request_field_string_is_editable - -#define gaim_request_field_int_new purple_request_field_int_new -#define gaim_request_field_int_set_default_value \ - purple_request_field_int_set_default_value -#define gaim_request_field_int_set_value purple_request_field_int_set_value -#define gaim_request_field_int_get_default_value \ - purple_request_field_int_get_default_value -#define gaim_request_field_int_get_value purple_request_field_int_get_value - -#define gaim_request_field_bool_new purple_request_field_bool_new -#define gaim_request_field_bool_set_default_value \ - purple_request_field_book_set_default_value -#define gaim_request_field_bool_set_value purple_request_field_bool_set_value -#define gaim_request_field_bool_get_default_value \ - purple_request_field_bool_get_default_value -#define gaim_request_field_bool_get_value purple_request_field_bool_get_value - -#define gaim_request_field_choice_new purple_request_field_choice_new -#define gaim_request_field_choice_add purple_request_field_choice_add -#define gaim_request_field_choice_set_default_value \ - purple_request_field_choice_set_default_value -#define gaim_request_field_choice_set_value purple_request_field_choice_set_value -#define gaim_request_field_choice_get_default_value \ - purple_request_field_choice_get_default_value -#define gaim_request_field_choice_get_value purple_request_field_choice_get_value -#define gaim_request_field_choice_get_labels purple_request_field_choice_get_labels - -#define gaim_request_field_list_new purple_request_field_list_new -#define gaim_request_field_list_set_multi_select purple_request_field_list_set_multi_select -#define gaim_request_field_list_get_multi_select purple_request_field_list_get_multi_select -#define gaim_request_field_list_get_data purple_request_field_list_get_data -#define gaim_request_field_list_add purple_request_field_list_add -#define gaim_request_field_list_add_selected purple_request_field_list_add_selected -#define gaim_request_field_list_clear_selected purple_request_field_list_clear_selected -#define gaim_request_field_list_set_selected purple_request_field_list_set_selected -#define gaim_request_field_list_is_selected purple_request_field_list_is_selected -#define gaim_request_field_list_get_selected purple_request_field_list_get_selected -#define gaim_request_field_list_get_items purple_request_field_list_get_items - -#define gaim_request_field_label_new purple_request_field_label_new - -#define gaim_request_field_image_new purple_request_field_image_new -#define gaim_request_field_image_set_scale purple_request_field_image_set_scale -#define gaim_request_field_image_get_buffer purple_request_field_image_get_buffer -#define gaim_request_field_image_get_size purple_request_field_image_get_size -#define gaim_request_field_image_get_scale_x purple_request_field_image_get_scale_x -#define gaim_request_field_image_get_scale_y purple_request_field_image_get_scale_y - -#define gaim_request_field_account_new purple_request_field_account_new -#define gaim_request_field_account_set_default_value purple_request_field_account_set_default_value -#define gaim_request_field_account_set_value purple_request_field_account_set_value -#define gaim_request_field_account_set_show_all purple_request_field_account_set_show_all -#define gaim_request_field_account_set_filter purple_request_field_account_set_filter -#define gaim_request_field_account_get_default_value purple_request_field_account_get_default_value -#define gaim_request_field_account_get_value purple_request_field_account_get_value -#define gaim_request_field_account_get_show_all purple_request_field_account_get_show_all -#define gaim_request_field_account_get_filter purple_request_field_account_get_filter - -#define gaim_request_input purple_request_input -#define gaim_request_choice purple_request_choice -#define gaim_request_choice_varg purple_request_choice_varg -#define gaim_request_action purple_request_action -#define gaim_request_action_varg purple_request_action_varg -#define gaim_request_fields(handle, title, primary, secondary, fields, ok_text, ok_cb, cancel_text, cancel_cb, user_data) purple_request_fields(handle, title, primary, secondary, fields, ok_text, ok_cb, cancel_text, cancel_cb, NULL, NULL, NULL, user_data) -#define gaim_request_close purple_request_close -#define gaim_request_close_with_handle purple_request_close_with_handle - -#define gaim_request_yes_no purple_request_yes_no -#define gaim_request_ok_cancel purple_request_ok_cancel -#define gaim_request_accept_cancel purple_request_accept_cancel - -#define gaim_request_file purple_request_file -#define gaim_request_folder purple_request_folder - -#define gaim_request_set_ui_ops purple_request_set_ui_ops -#define gaim_request_get_ui_ops purple_request_get_ui_ops - -/* from roomlist.h */ - -#define GaimRoomlist PurpleRoomlist -#define GaimRoomlistRoom PurpleRoomlistRoom -#define GaimRoomlistField PurpleRoomlistField -#define GaimRoomlistUiOps PurpleRoomlistUiOps - -#define GAIM_ROOMLIST_ROOMTYPE_CATEGORY PURPLE_ROOMLIST_ROOMTYPE_CATEGORY -#define GAIM_ROOMLIST_ROOMTYPE_ROOM PURPLE_ROOMLIST_ROOMTYPE_ROOM -#define GaimRoomlistRoomType PurpleRoomlistRoomType - -#define GAIM_ROOMLIST_FIELD_BOOL PURPLE_ROOMLIST_BOOL -#define GAIM_ROOMLIST_FIELD_INT PURPLE_ROOMLIST_INT -#define GAIM_ROOMLIST_FIELD_STRING PURPLE_ROOMLIST_STRING -#define GaimRoomlistFieldType PurpleRoomlistFieldType - -#define gaim_roomlist_show_with_account purple_roomlist_show_with_account -#define gaim_roomlist_new purple_roomlist_new -#define gaim_roomlist_ref purple_roomlist_ref -#define gaim_roomlist_unref purple_roomlist_unref -#define gaim_roomlist_set_fields purple_roomlist_set_fields -#define gaim_roomlist_set_in_progress purple_roomlist_set_in_progress -#define gaim_roomlist_get_in_progress purple_roomlist_get_in_progress -#define gaim_roomlist_room_add purple_roomlist_room_add - -#define gaim_roomlist_get_list purple_roomlist_get_list -#define gaim_roomlist_cancel_get_list purple_roomlist_cancel_get_list -#define gaim_roomlist_expand_category purple_roomlist_expand_category - -#define gaim_roomlist_room_new purple_roomlist_room_new -#define gaim_roomlist_room_add_field purple_roomlist_room_add_field -#define gaim_roomlist_room_join purple_roomlist_room_join -#define gaim_roomlist_field_new purple_roomlist_field_new - -#define gaim_roomlist_set_ui_ops purple_roomlist_set_ui_ops -#define gaim_roomlist_get_ui_ops purple_roomlist_get_ui_ops - -/* from savedstatuses.h */ - -#define GaimSavedStatus PurpleSavedStatus -#define GaimSavedStatusSub PurpleSavedStatusSub - -#define gaim_savedstatus_new purple_savedstatus_new -#define gaim_savedstatus_set_title purple_savedstatus_set_title -#define gaim_savedstatus_set_type purple_savedstatus_set_type -#define gaim_savedstatus_set_message purple_savedstatus_set_message -#define gaim_savedstatus_set_substatus purple_savedstatus_set_substatus -#define gaim_savedstatus_unset_substatus purple_savedstatus_unset_substatus -#define gaim_savedstatus_delete purple_savedstatus_delete - -#define gaim_savedstatuses_get_all purple_savedstatuses_get_all -#define gaim_savedstatuses_get_popular purple_savedstatuses_get_popular -#define gaim_savedstatus_get_current purple_savedstatus_get_current -#define gaim_savedstatus_get_default purple_savedstatus_get_default -#define gaim_savedstatus_get_idleaway purple_savedstatus_get_idleaway -#define gaim_savedstatus_is_idleaway purple_savedstatus_is_idleaway -#define gaim_savedstatus_set_idleaway purple_savedstatus_set_idleaway -#define gaim_savedstatus_get_startup purple_savedstatus_get_startup -#define gaim_savedstatus_find purple_savedstatus_find -#define gaim_savedstatus_find_by_creation_time purple_savedstatus_find_by_creation_time -#define gaim_savedstatus_find_transient_by_type_and_message \ - purple_savedstatus_find_transient_by_type_and_message - -#define gaim_savedstatus_is_transient purple_savedstatus_is_transient -#define gaim_savedstatus_get_title purple_savedstatus_get_title -#define gaim_savedstatus_get_type purple_savedstatus_get_type -#define gaim_savedstatus_get_message purple_savedstatus_get_message -#define gaim_savedstatus_get_creation_time purple_savedstatus_get_creation_time -#define gaim_savedstatus_has_substatuses purple_savedstatus_has_substatuses -#define gaim_savedstatus_get_substatus purple_savedstatus_get_substatus -#define gaim_savedstatus_substatus_get_type purple_savedstatus_substatus_get_type -#define gaim_savedstatus_substatus_get_message purple_savedstatus_substatus_get_message -#define gaim_savedstatus_activate purple_savedstatus_activate -#define gaim_savedstatus_activate_for_account purple_savedstatus_activate_for_account - -#define gaim_savedstatuses_get_handle purple_savedstatuses_get_handle -#define gaim_savedstatuses_init purple_savedstatuses_init -#define gaim_savedstatuses_uninit purple_savedstatuses_uninit - -/* from signals.h */ - -#define GAIM_CALLBACK PURPLE_CALLBACK - -#define GaimCallback PurpleCallback -#define GaimSignalMarshalFunc PurpleSignalMarshalFunc - -#define GAIM_SIGNAL_PRIORITY_DEFAULT PURPLE_SIGNAL_PRIORITY_DEFAULT -#define GAIM_SIGNAL_PRIORITY_HIGHEST PURPLE_SIGNAL_PRIORITY_HIGHEST -#define GAIM_SIGNAL_PRIORITY_LOWEST PURPLE_SIGNAL_PRIORITY_LOWEST - -#define gaim_signal_register purple_signal_register -#define gaim_signal_unregister purple_signal_unregister - -#define gaim_signals_unregister_by_instance purple_signals_unregister_by_instance - -#define gaim_signal_get_values purple_signal_get_values -#define gaim_signal_connect_priority purple_signal_connect_priority -#define gaim_signal_connect purple_signal_connect -#define gaim_signal_connect_priority_vargs purple_signal_connect_priority_vargs -#define gaim_signal_connect_vargs purple_signal_connect_vargs -#define gaim_signal_disconnect purple_signal_disconnect - -#define gaim_signals_disconnect_by_handle purple_signals_disconnect_by_handle - -#define gaim_signal_emit purple_signal_emit -#define gaim_signal_emit_vargs purple_signal_emit_vargs -#define gaim_signal_emit_return_1 purple_signal_emit_vargs -#define gaim_signal_emit_vargs_return_1 purple_signal_emit_vargs_return_1 - -#define gaim_signals_init purple_signals_init -#define gaim_signals_uninit purple_signals_uninit - -#define gaim_marshal_VOID \ - purple_marshal_VOID -#define gaim_marshal_VOID__INT \ - purple_marshal_VOID__INT -#define gaim_marshal_VOID__INT_INT \ - purple_marshal_VOID_INT_INT -#define gaim_marshal_VOID__POINTER \ - purple_marshal_VOID__POINTER -#define gaim_marshal_VOID__POINTER_UINT \ - purple_marshal_VOID__POINTER_UINT -#define gaim_marshal_VOID__POINTER_INT_INT \ - purple_marshal_VOID__POINTER_INT_INT -#define gaim_marshal_VOID__POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_UINT \ - purple_marshal_VOID__POINTER_POINTER_UINT -#define gaim_marshal_VOID__POINTER_POINTER_UINT_UINT \ - purple_marshal_VOID__POINTER_POINTER_UINT_UINT -#define gaim_marshal_VOID__POINTER_POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT \ - purple_marshal_VOID__POINTER_POINTER_POINTER_UINT -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT \ - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT \ - purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT - -#define gaim_marshal_INT__INT \ - purple_marshal_INT__INT -#define gaim_marshal_INT__INT_INT \ - purple_marshal_INT__INT_INT -#define gaim_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER \ - purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER - -#define gaim_marshal_BOOLEAN__POINTER \ - purple_marshal_BOOLEAN__POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER_UINT \ - purple_marshal_BOOLEAN__POINTER_POINTER_UINT -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER - -#define gaim_marshal_BOOLEAN__INT_POINTER \ - purple_marshal_BOOLEAN__INT_POINTER - -#define gaim_marshal_POINTER__POINTER_INT \ - purple_marshal_POINTER__POINTER_INT -#define gaim_marshal_POINTER__POINTER_INT64 \ - purple_marshal_POINTER__POINTER_INT64 -#define gaim_marshal_POINTER__POINTER_INT_BOOLEAN \ - purple_marshal_POINTER__POINTER_INT_BOOLEAN -#define gaim_marshal_POINTER__POINTER_INT64_BOOLEAN \ - purple_marshal_POINTER__POINTER_INT64_BOOLEAN -#define gaim_marshal_POINTER__POINTER_POINTER \ - purple_marshal_POINTER__POINTER_POINTER - -/* from sound.h */ - -#define GAIM_SOUND_BUDDY_ARRIVE PURPLE_SOUND_BUDDY_ARRIVE -#define GAIM_SOUND_BUDDY_LEAVE PURPLE_SOUND_BUDDY_LEAVE -#define GAIM_SOUND_RECEIVE PURPLE_SOUND_RECEIVE -#define GAIM_SOUND_FIRST_RECEIVE PURPLE_SOUND_FIRST_RECEIVE -#define GAIM_SOUND_SEND PURPLE_SOUND_SEND -#define GAIM_SOUND_CHAT_JOIN PURPLE_SOUND_CHAT_JOIN -#define GAIM_SOUND_CHAT_LEAVE PURPLE_SOUND_CHAT_LEAVE -#define GAIM_SOUND_CHAT_YOU_SAY PURPLE_SOUND_CHAT_YOU_SAY -#define GAIM_SOUND_CHAT_SAY PURPLE_SOUND_CHAT_SAY -#define GAIM_SOUND_POUNCE_DEFAULT PURPLE_SOUND_POUNCE_DEFAULT -#define GAIM_SOUND_CHAT_NICK PURPLE_SOUND_CHAT_NICK -#define GAIM_NUM_SOUNDS PURPLE_NUM_SOUNDS -#define GaimSoundEventID PurpleSoundEventID - -#define GaimSoundUiOps PurpleSoundUiOps - -#define gaim_sound_play_file purple_sound_play_file -#define gaim_sound_play_event purple_sound_play_event -#define gaim_sound_set_ui_ops purple_sound_set_ui_ops -#define gaim_sound_get_ui_ops purple_sound_get_ui_ops -#define gaim_sound_init purple_sound_init -#define gaim_sound_uninit purple_sound_uninit - -#define gaim_sounds_get_handle purple_sounds_get_handle - -/* from sslconn.h */ - -#define GAIM_SSL_DEFAULT_PORT PURPLE_SSL_DEFAULT_PORT - -#define GAIM_SSL_HANDSHAKE_FAILED PURPLE_SSL_HANDSHAKE_FAILED -#define GAIM_SSL_CONNECT_FAILED PURPLE_SSL_CONNECT_FAILED -#define GaimSslErrorType PurpleSslErrorType - -#define GaimSslConnection PurpleSslConnection - -#define GaimSslInputFunction PurpleSslInputFunction -#define GaimSslErrorFunction PurpleSslErrorFunction - -#define GaimSslOps PurpleSslOps - -#define gaim_ssl_is_supported purple_ssl_is_supported -#define gaim_ssl_connect purple_ssl_connect -#define gaim_ssl_connect_fd purple_ssl_connect_fd -#define gaim_ssl_input_add purple_ssl_input_add -#define gaim_ssl_close purple_ssl_close -#define gaim_ssl_read purple_ssl_read -#define gaim_ssl_write purple_ssl_write - -#define gaim_ssl_set_ops purple_ssl_set_ops -#define gaim_ssl_get_ops purple_ssl_get_ops -#define gaim_ssl_init purple_ssl_init -#define gaim_ssl_uninit purple_ssl_uninit - -/* from status.h */ - -#define GaimStatusType PurpleStatusType -#define GaimStatusAttr PurpleStatusAttr -#define GaimPresence PurplePresence -#define GaimStatus PurpleStatus - -#define GAIM_PRESENCE_CONTEXT_UNSET PURPLE_PRESENCE_CONTEXT_UNSET -#define GAIM_PRESENCE_CONTEXT_ACCOUNT PURPLE_PRESENCE_CONTEXT_ACCOUNT -#define GAIM_PRESENCE_CONTEXT_CONV PURPLE_PRESENCE_CONTEXT_CONV -#define GAIM_PRESENCE_CONTEXT_BUDDY PURPLE_PRESENCE_CONTEXT_BUDDY -#define GaimPresenceContext PurplePresenceContext - -#define GAIM_STATUS_UNSET PURPLE_STATUS_UNSET -#define GAIM_STATUS_OFFLINE PURPLE_STATUS_OFFLINE -#define GAIM_STATUS_AVAILABLE PURPLE_STATUS_AVAILABLE -#define GAIM_STATUS_UNAVAILABLE PURPLE_STATUS_UNAVAILABLE -#define GAIM_STATUS_INVISIBLE PURPLE_STATUS_INVISIBLE -#define GAIM_STATUS_AWAY PURPLE_STATUS_AWAY -#define GAIM_STATUS_EXTENDED_AWAY PURPLE_STATUS_EXTENDED_AWAY -#define GAIM_STATUS_MOBILE PURPLE_STATUS_MOBILE -#define GAIM_STATUS_NUM_PRIMITIVES PURPLE_STATUS_NUM_PRIMITIVES -#define GaimStatusPrimitive PurpleStatusPrimitive - -#define gaim_primitive_get_id_from_type purple_primitive_get_id_from_type -#define gaim_primitive_get_name_from_type purple_primitive_get_name_from_type -#define gaim_primitive_get_type_from_id purple_primitive_get_type_from_id - -#define gaim_status_type_new_full purple_status_type_new_full -#define gaim_status_type_new purple_status_type_new -#define gaim_status_type_new_with_attrs purple_status_type_new_with_attrs -#define gaim_status_type_destroy purple_status_type_destroy -#define gaim_status_type_set_primary_attr purple_status_type_set_primary_attr -#define gaim_status_type_add_attr purple_status_type_add_attr -#define gaim_status_type_add_attrs purple_status_type_add_attrs -#define gaim_status_type_add_attrs_vargs purple_status_type_add_attrs_vargs -#define gaim_status_type_get_primitive purple_status_type_get_primitive -#define gaim_status_type_get_id purple_status_type_get_id -#define gaim_status_type_get_name purple_status_type_get_name -#define gaim_status_type_is_saveable purple_status_type_is_saveable -#define gaim_status_type_is_user_settable purple_status_type_is_user_settable -#define gaim_status_type_is_independent purple_status_type_is_independent -#define gaim_status_type_is_exclusive purple_status_type_is_exclusive -#define gaim_status_type_is_available purple_status_type_is_available -#define gaim_status_type_get_primary_attr purple_status_type_get_primary_attr -#define gaim_status_type_get_attr purple_status_type_get_attr -#define gaim_status_type_get_attrs purple_status_type_get_attrs -#define gaim_status_type_find_with_id purple_status_type_find_with_id - -#define gaim_status_attr_new purple_status_attr_new -#define gaim_status_attr_destroy purple_status_attr_destroy -#define gaim_status_attr_get_id purple_status_attr_get_id -#define gaim_status_attr_get_name purple_status_attr_get_name -#define gaim_status_attr_get_value purple_status_attr_get_value - -#define gaim_status_new purple_status_new -#define gaim_status_destroy purple_status_destroy -#define gaim_status_set_active purple_status_set_active -#define gaim_status_set_active_with_attrs purple_status_set_active_with_attrs -#define gaim_status_set_active_with_attrs_list purple_status_set_active_with_attrs_list -#define gaim_status_set_attr_boolean purple_status_set_attr_boolean -#define gaim_status_set_attr_int purple_status_set_attr_int -#define gaim_status_set_attr_string purple_status_set_attr_string -#define gaim_status_get_type purple_status_get_type -#define gaim_status_get_presence purple_status_get_presence -#define gaim_status_get_id purple_status_get_id -#define gaim_status_get_name purple_status_get_name -#define gaim_status_is_independent purple_status_is_independent -#define gaim_status_is_exclusive purple_status_is_exclusive -#define gaim_status_is_available purple_status_is_available -#define gaim_status_is_active purple_status_is_active -#define gaim_status_is_online purple_status_is_online -#define gaim_status_get_attr_value purple_status_get_attr_value -#define gaim_status_get_attr_boolean purple_status_get_attr_boolean -#define gaim_status_get_attr_int purple_status_get_attr_int -#define gaim_status_get_attr_string purple_status_get_attr_string -#define gaim_status_compare purple_status_compare - -#define gaim_presence_new purple_presence_new -#define gaim_presence_new_for_account purple_presence_new_for_account -#define gaim_presence_new_for_conv purple_presence_new_for_conv -#define gaim_presence_new_for_buddy purple_presence_new_for_buddy -#define gaim_presence_destroy purple_presence_destroy -#define gaim_presence_add_status purple_presence_add_status -#define gaim_presence_add_list purple_presence_add_list -#define gaim_presence_set_status_active purple_presence_set_status_active -#define gaim_presence_switch_status purple_presence_switch_status -#define gaim_presence_set_idle purple_presence_set_idle -#define gaim_presence_set_login_time purple_presence_set_login_time -#define gaim_presence_get_context purple_presence_get_context -#define gaim_presence_get_account purple_presence_get_account -#define gaim_presence_get_conversation purple_presence_get_conversation -#define gaim_presence_get_chat_user purple_presence_get_chat_user -#define gaim_presence_get_statuses purple_presence_get_statuses -#define gaim_presence_get_status purple_presence_get_status -#define gaim_presence_get_active_status purple_presence_get_active_status -#define gaim_presence_is_available purple_presence_is_available -#define gaim_presence_is_online purple_presence_is_online -#define gaim_presence_is_status_active purple_presence_is_status_active -#define gaim_presence_is_status_primitive_active \ - purple_presence_is_status_primitive_active -#define gaim_presence_is_idle purple_presence_is_idle -#define gaim_presence_get_idle_time purple_presence_get_idle_time -#define gaim_presence_get_login_time purple_presence_get_login_time -#define gaim_presence_compare purple_presence_compare - -#define gaim_status_get_handle purple_status_get_handle -#define gaim_status_init purple_status_init -#define gaim_status_uninit purple_status_uninit - -/* from stringref.h */ - -#define GaimStringref PurpleStringref - -#define gaim_stringref_new purple_stringref_new -#define gaim_stringref_new_noref purple_stringref_new_noref -#define gaim_stringref_printf purple_stringref_printf -#define gaim_stringref_ref purple_stringref_ref -#define gaim_stringref_unref purple_stringref_unref -#define gaim_stringref_value purple_stringref_value -#define gaim_stringref_cmp purple_stringref_cmp -#define gaim_stringref_len purple_stringref_len - -/* from stun.h */ - -#define GaimStunNatDiscovery PurpleStunNatDiscovery - -#define GAIM_STUN_STATUS_UNDISCOVERED PURPLE_STUN_STATUS_UNDISCOVERED -#define GAIM_STUN_STATUS_UNKNOWN PURPLE_STUN_STATUS_UNKNOWN -#define GAIM_STUN_STATUS_DISCOVERING PURPLE_STUN_STATUS_DISCOVERING -#define GAIM_STUN_STATUS_DISCOVERED PURPLE_STUN_STATUS_DISCOVERED -#define GaimStunStatus PurpleStunStatus - -#define GAIM_STUN_NAT_TYPE_PUBLIC_IP PURPLE_STUN_NAT_TYPE_PUBLIC_IP -#define GAIM_STUN_NAT_TYPE_UNKNOWN_NAT PURPLE_STUN_NAT_TYPE_UNKNOWN_NAT -#define GAIM_STUN_NAT_TYPE_FULL_CONE PURPLE_STUN_NAT_TYPE_FULL_CONE -#define GAIM_STUN_NAT_TYPE_RESTRICTED_CONE PURPLE_STUN_NAT_TYPE_RESTRICTED_CONE -#define GAIM_STUN_NAT_TYPE_PORT_RESTRICTED_CONE PURPLE_STUN_NAT_TYPE_PORT_RESTRICTED_CONE -#define GAIM_STUN_NAT_TYPE_SYMMETRIC PURPLE_STUN_NAT_TYPE_SYMMETRIC -#define GaimStunNatType PurpleStunNatType - -/* why didn't this have a Gaim prefix before? */ -#define StunCallback PurpleStunCallback - -#define gaim_stun_discover purple_stun_discover -#define gaim_stun_init purple_stun_init - -/* from upnp.h */ - -/* suggested rename: PurpleUPnpMappingHandle */ -#define UPnPMappingAddRemove PurpleUPnPMappingAddRemove - -#define GaimUPnPCallback PurpleUPnPCallback - -#define gaim_upnp_discover purple_upnp_discover -#define gaim_upnp_get_public_ip purple_upnp_get_public_ip -#define gaim_upnp_cancel_port_mapping purple_upnp_cancel_port_mapping -#define gaim_upnp_set_port_mapping purple_upnp_set_port_mapping - -#define gaim_upnp_remove_port_mapping purple_upnp_remove_port_mapping - -/* from util.h */ - -#define GaimUtilFetchUrlData PurpleUtilFetchUrlData -#define GaimMenuAction PurpleMenuAction - -#define GaimInfoFieldFormatCallback PurpleIntoFieldFormatCallback - -#define GaimKeyValuePair PurpleKeyValuePair - -#define gaim_menu_action_new purple_menu_action_new -#define gaim_menu_action_free purple_menu_action_free - -#define gaim_base16_encode purple_base16_encode -#define gaim_base16_decode purple_base16_decode -#define gaim_base64_encode purple_base64_encode -#define gaim_base64_decode purple_base64_decode -#define gaim_quotedp_decode purple_quotedp_decode - -#define gaim_mime_decode_field purple_mime_deco_field - -#define gaim_utf8_strftime purple_utf8_strftime -#define gaim_date_format_short purple_date_format_short -#define gaim_date_format_long purple_date_format_long -#define gaim_date_format_full purple_date_format_full -#define gaim_time_format purple_time_format -#define gaim_time_build purple_time_build - -#define GAIM_NO_TZ_OFF PURPLE_NO_TZ_OFF - -#define gaim_str_to_time purple_str_to_time - -#define gaim_markup_find_tag purple_markup_find_tag -#define gaim_markup_extract_info_field purple_markup_extract_info_field -#define gaim_markup_html_to_xhtml purple_markup_html_to_xhtml -#define gaim_markup_strip_html purple_markup_strip_html -#define gaim_markup_linkify purple_markup_linkify -#define gaim_markup_slice purple_markup_slice -#define gaim_markup_get_tag_name purple_markup_get_tag_name -#define gaim_unescape_html purple_unescape_html - -#define gaim_home_dir purple_home_dir -#define gaim_user_dir purple_user_dir - -#define gaim_util_set_user_dir purple_util_set_user_dir - -#define gaim_build_dir purple_build_dir - -#define gaim_util_write_data_to_file purple_util_write_data_to_file - -#define gaim_util_read_xml_from_file purple_util_read_xml_from_file - -#define gaim_mkstemp purple_mkstemp - -#define gaim_program_is_valid purple_program_is_valid - -#define gaim_running_gnome purple_running_gnome -#define gaim_running_kde purple_running_kde -#define gaim_running_osx purple_running_osx - -#define gaim_fd_get_ip purple_fd_get_ip - -#define gaim_normalize purple_normalize -#define gaim_normalize_nocase purple_normalize_nocase - -#define gaim_strdup_withhtml purple_strdup_withhtml - -#define gaim_str_has_prefix purple_str_has_prefix -#define gaim_str_has_suffix purple_str_has_suffix -#define gaim_str_add_cr purple_str_add_cr -#define gaim_str_strip_char purple_str_strip_char - -#define gaim_util_chrreplace purple_util_chrreplace - -#define gaim_strreplace purple_strreplace - -#define gaim_utf8_ncr_encode purple_utf8_ncr_encode -#define gaim_utf8_ncr_decode purple_utf8_ncr_decode - -#define gaim_strcasereplace purple_strcasereplace -#define gaim_strcasestr purple_strcasestr - -#define gaim_str_size_to_units purple_str_size_to_units -#define gaim_str_seconds_to_string purple_str_seconds_to_string -#define gaim_str_binary_to_ascii purple_str_binary_to_ascii - - -#define gaim_got_protocol_handler_uri purple_got_protocol_handler_uri - -#define gaim_url_parse purple_url_parse - -#define GaimUtilFetchUrlCallback PurpleUtilFetchUrlCallback -#define gaim_util_fetch_url purple_util_fetch_url -#define gaim_util_fetch_url_request purple_util_fetch_url_request -#define gaim_util_fetch_url_cancel purple_util_fetch_url_cancel - -#define gaim_url_decode purple_url_decode -#define gaim_url_encode purple_url_encode - -#define gaim_email_is_valid purple_email_is_valid - -#define gaim_uri_list_extract_uris purple_uri_list_extract_uris -#define gaim_uri_list_extract_filenames purple_uri_list_extract_filenames - -#define gaim_utf8_try_convert purple_utf8_try_convert -#define gaim_utf8_salvage purple_utf8_salvage -#define gaim_utf8_strcasecmp purple_utf8_strcasecmp -#define gaim_utf8_has_word purple_utf8_has_word - -#define gaim_print_utf8_to_console purple_print_utf8_to_console - -#define gaim_message_meify purple_message_meify - -#define gaim_text_strip_mnemonic purple_text_strip_mnemonic - -#define gaim_unescape_filename purple_unescape_filename -#define gaim_escape_filename purple_escape_filename - -/* from value.h */ - -#define GAIM_TYPE_UNKNOWN PURPLE_TYPE_UNKNOWN -#define GAIM_TYPE_SUBTYPE PURPLE_TYPE_SUBTYPE -#define GAIM_TYPE_CHAR PURPLE_TYPE_CHAR -#define GAIM_TYPE_UCHAR PURPLE_TYPE_UCHAR -#define GAIM_TYPE_BOOLEAN PURPLE_TYPE_BOOLEAN -#define GAIM_TYPE_SHORT PURPLE_TYPE_SHORT -#define GAIM_TYPE_USHORT PURPLE_TYPE_USHORT -#define GAIM_TYPE_INT PURPLE_TYPE_INT -#define GAIM_TYPE_UINT PURPLE_TYPE_UINT -#define GAIM_TYPE_LONG PURPLE_TYPE_LONG -#define GAIM_TYPE_ULONG PURPLE_TYPE_ULONG -#define GAIM_TYPE_INT64 PURPLE_TYPE_INT64 -#define GAIM_TYPE_UINT64 PURPLE_TYPE_UINT64 -#define GAIM_TYPE_STRING PURPLE_TYPE_STRING -#define GAIM_TYPE_OBJECT PURPLE_TYPE_OBJECT -#define GAIM_TYPE_POINTER PURPLE_TYPE_POINTER -#define GAIM_TYPE_ENUM PURPLE_TYPE_ENUM -#define GAIM_TYPE_BOXED PURPLE_TYPE_BOXED -#define GaimType PurpleType - - -#define GAIM_SUBTYPE_UNKNOWN PURPLE_SUBTYPE_UNKNOWN -#define GAIM_SUBTYPE_ACCOUNT PURPLE_SUBTYPE_ACCOUNT -#define GAIM_SUBTYPE_BLIST PURPLE_SUBTYPE_BLIST -#define GAIM_SUBTYPE_BLIST_BUDDY PURPLE_SUBTYPE_BLIST_BUDDY -#define GAIM_SUBTYPE_BLIST_GROUP PURPLE_SUBTYPE_BLIST_GROUP -#define GAIM_SUBTYPE_BLIST_CHAT PURPLE_SUBTYPE_BLIST_CHAT -#define GAIM_SUBTYPE_BUDDY_ICON PURPLE_SUBTYPE_BUDDY_ICON -#define GAIM_SUBTYPE_CONNECTION PURPLE_SUBTYPE_CONNECTION -#define GAIM_SUBTYPE_CONVERSATION PURPLE_SUBTYPE_CONVERSATION -#define GAIM_SUBTYPE_PLUGIN PURPLE_SUBTYPE_PLUGIN -#define GAIM_SUBTYPE_BLIST_NODE PURPLE_SUBTYPE_BLIST_NODE -#define GAIM_SUBTYPE_CIPHER PURPLE_SUBTYPE_CIPHER -#define GAIM_SUBTYPE_STATUS PURPLE_SUBTYPE_STATUS -#define GAIM_SUBTYPE_LOG PURPLE_SUBTYPE_LOG -#define GAIM_SUBTYPE_XFER PURPLE_SUBTYPE_XFER -#define GAIM_SUBTYPE_SAVEDSTATUS PURPLE_SUBTYPE_SAVEDSTATUS -#define GAIM_SUBTYPE_XMLNODE PURPLE_SUBTYPE_XMLNODE -#define GAIM_SUBTYPE_USERINFO PURPLE_SUBTYPE_USERINFO -#define GaimSubType PurpleSubType - -#define GaimValue PurpleValue - -#define gaim_value_new purple_value_new -#define gaim_value_new_outgoing purple_value_new_outgoing -#define gaim_value_destroy purple_value_destroy -#define gaim_value_dup purple_value_dup -#define gaim_value_purple_buddy_icon_get_extensionget_type purple_value_get_type -#define gaim_value_get_subtype purple_value_get_subtype -#define gaim_value_get_specific_type purple_value_get_specific_type -#define gaim_value_is_outgoing purple_value_is_outgoing -#define gaim_value_set_char purple_value_set_char -#define gaim_value_set_uchar purple_value_set_uchar -#define gaim_value_set_boolean purple_value_set_boolean -#define gaim_value_set_short purple_value_set_short -#define gaim_value_set_ushort purple_value_set_ushort -#define gaim_value_set_int purple_value_set_int -#define gaim_value_set_uint purple_value_set_uint -#define gaim_value_set_long purple_value_set_long -#define gaim_value_set_ulong purple_value_set_ulong -#define gaim_value_set_int64 purple_value_set_int64 -#define gaim_value_set_uint64 purple_value_set_uint64 -#define gaim_value_set_string purple_value_set_string -#define gaim_value_set_object purple_value_set_object -#define gaim_value_set_pointer purple_value_set_pointer -#define gaim_value_set_enum purple_value_set_enum -#define gaim_value_set_boxed purple_value_set_boxed -#define gaim_value_get_char purple_value_get_char -#define gaim_value_get_uchar purple_value_get_uchar -#define gaim_value_get_boolean purple_value_get_boolean -#define gaim_value_get_short purple_value_get_short -#define gaim_value_get_ushort purple_value_get_ushort -#define gaim_value_get_int purple_value_get_int -#define gaim_value_get_uint purple_value_get_uint -#define gaim_value_get_long purple_value_get_long -#define gaim_value_get_ulong purple_value_get_ulong -#define gaim_value_get_int64 purple_value_get_int64 -#define gaim_value_get_uint64 purple_value_get_uint64 -#define gaim_value_get_string purple_value_get_string -#define gaim_value_get_object purple_value_get_object -#define gaim_value_get_pointer purple_value_get_pointer -#define gaim_value_get_enum purple_value_get_enum -#define gaim_value_get_boxed purple_value_get_boxed - -/* from version.h */ - -#define GAIM_MAJOR_VERSION PURPLE_MAJOR_VERSION -#define GAIM_MINOR_VERSION PURPLE_MINOR_VERSION -#define GAIM_MICRO_VERSION PURPLE_MICRO_VERSION - -#define GAIM_VERSION_CHECK PURPLE_VERSION_CHECK - -/* from whiteboard.h */ - -#define GaimWhiteboardPrplOps PurpleWhiteboardPrplOps -#define GaimWhiteboard PurpleWhiteboard -#define GaimWhiteboardUiOps PurpleWhiteboardUiOps - -#define gaim_whiteboard_set_ui_ops purple_whiteboard_set_ui_ops -#define gaim_whiteboard_set_prpl_ops purple_whiteboard_set_prpl_ops - -#define gaim_whiteboard_create purple_whiteboard_create -#define gaim_whiteboard_destroy purple_whiteboard_destroy -#define gaim_whiteboard_start purple_whiteboard_start -#define gaim_whiteboard_get_session purple_whiteboard_get_session -#define gaim_whiteboard_draw_list_destroy purple_whiteboard_draw_list_destroy -#define gaim_whiteboard_get_dimensions purple_whiteboard_get_dimensions -#define gaim_whiteboard_set_dimensions purple_whiteboard_set_dimensions -#define gaim_whiteboard_draw_point purple_whiteboard_draw_point -#define gaim_whiteboard_send_draw_list purple_whiteboard_send_draw_list -#define gaim_whiteboard_draw_line purple_whiteboard_draw_line -#define gaim_whiteboard_clear purple_whiteboard_clear -#define gaim_whiteboard_send_clear purple_whiteboard_send_clear -#define gaim_whiteboard_send_brush purple_whiteboard_send_brush -#define gaim_whiteboard_get_brush purple_whiteboard_get_brush -#define gaim_whiteboard_set_brush purple_whiteboard_set_brush - -/* for static plugins */ -#define gaim_init_ssl_plugin purple_init_ssl_plugin -#define gaim_init_ssl_openssl_plugin purple_init_ssl_openssl_plugin -#define gaim_init_ssl_gnutls_plugin purple_init_ssl_gnutls_plugin -#define gaim_init_gg_plugin purple_init_gg_plugin -#define gaim_init_jabber_plugin purple_init_jabber_plugin -#define gaim_init_sametime_plugin purple_init_sametime_plugin -#define gaim_init_msn_plugin purple_init_msn_plugin -#define gaim_init_novell_plugin purple_init_novell_plugin -#define gaim_init_qq_plugin purple_init_qq_plugin -#define gaim_init_simple_plugin purple_init_simple_plugin -#define gaim_init_yahoo_plugin purple_init_yahoo_plugin -#define gaim_init_zephyr_plugin purple_init_zephyr_plugin -#define gaim_init_aim_plugin purple_init_aim_plugin -#define gaim_init_icq_plugin purple_init_icq_plugin - -#endif /* _GAIM_COMPAT_H_ */ diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index 12b7fc3e46..23890e775e 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -107,7 +107,6 @@ pidgin_headers = \ gtkicon-theme.h \ gtkicon-theme-loader.h \ gtkidle.h \ - gtkgaim-compat.h \ gtkimhtml.h \ gtkimhtmltoolbar.h \ gtklog.h \ diff --git a/pidgin/gtkgaim-compat.h b/pidgin/gtkgaim-compat.h deleted file mode 100644 index 778ad303bf..0000000000 --- a/pidgin/gtkgaim-compat.h +++ /dev/null @@ -1,412 +0,0 @@ -/** - * @file gtkgaim-compat.h Gtk Gaim Compat macros - */ - -/* pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#ifndef _GTKGAIM_COMPAT_H_ -#define _GTKGAIM_COMPAT_H_ - -#include - -#define GAIM_ALERT_TITLE PIDGIN_ALERT_TITLE -#define GAIM_BROWSER_CURRENT PIDGIN_BROWSER_CURRENT -#define GAIM_BROWSER_DEFAULT PIDGIN_BROWSER_DEFAULT -#define GAIM_BROWSER_NEW_TAB PIDGIN_BROWSER_NEW_TAB -#define GAIM_BROWSER_NEW_WINDOW PIDGIN_BROWSER_NEW_WINDOW -#define GaimBrowserPlace PidginBrowserPlace -#define GAIM_BUTTON_HORIZONTAL PIDGIN_BUTTON_HORIZONTAL -#define GAIM_BUTTON_IMAGE PIDGIN_BUTTON_IMAGE -#define GAIM_BUTTON_NONE PIDGIN_BUTTON_NONE -#define GaimButtonOrientation PidginButtonOrientation -#define GaimButtonStyle PidginButtonStyle -#define GAIM_BUTTON_TEXT_IMAGE PIDGIN_BUTTON_TEXT_IMAGE -#define GAIM_BUTTON_TEXT PIDGIN_BUTTON_TEXT -#define GAIM_BUTTON_VERTICAL PIDGIN_BUTTON_VERTICAL -#define GaimConvPlacementFunc PidginConvPlacementFunc -#define GAIM_DIALOG PIDGIN_DIALOG -#define gaim_dnd_file_manage pidgin_dnd_file_manage -#define gaim_get_gtkxfer_dialog pidgin_get_xfer_dialog -#define gaim_gtk_account_dialog_show pidgin_account_dialog_show -#define GaimGtkAccountDialogType PidginAccountDialogType -#define gaim_gtk_account_get_handle pidgin_account_get_handle -#define gaim_gtk_account_init pidgin_account_init -#define gaim_gtk_account_option_menu_get_selected pidgin_account_option_menu_get_selected -#define gaim_gtk_account_option_menu_new pidgin_account_option_menu_new -#define gaim_gtk_account_option_menu_set_selected pidgin_account_option_menu_set_selected -#define gaim_gtk_accounts_get_ui_ops pidgin_accounts_get_ui_ops -#define gaim_gtk_accounts_window_hide pidgin_accounts_window_hide -#define gaim_gtk_accounts_window_show pidgin_accounts_window_show -#define gaim_gtk_account_uninit pidgin_account_uninit -#define GAIM_GTK_ADD_ACCOUNT_DIALOG PIDGIN_ADD_ACCOUNT_DIALOG -#define gaim_gtk_append_blist_node_extended_menu pidgin_append_blist_node_extended_menu -#define gaim_gtk_append_blist_node_privacy_menu pidgin_append_blist_node_privacy_menu -#define gaim_gtk_append_blist_node_proto_menu pidgin_append_blist_node_proto_menu -#define gaim_gtk_append_menu_action pidgin_append_menu_action -#define gaim_gtk_blist_add_alert pidgin_blist_add_alert -#define gaim_gtk_blist_get_default_gtk_blist pidgin_blist_get_default_gtk_blist -#define gaim_gtk_blist_get_handle pidgin_blist_get_handle -#define gaim_gtk_blist_get_sort_methods pidgin_blist_get_sort_methods -#define gaim_gtk_blist_get_status_icon pidgin_blist_get_status_icon -#define gaim_gtk_blist_get_ui_ops pidgin_blist_get_ui_ops -#define gaim_gtk_blist_init pidgin_blist_init -#define gaim_gtk_blist_joinchat_is_showable pidgin_blist_joinchat_is_showable -#define gaim_gtk_blist_joinchat_show pidgin_blist_joinchat_show -#define gaim_gtk_blist_make_buddy_menu pidgin_blist_make_buddy_menu -#define gaim_gtk_blist_node_is_contact_expanded pidgin_blist_node_is_contact_expanded -#define GAIM_GTK_BLIST PIDGIN_BLIST -#define gaim_gtk_blist_refresh pidgin_blist_refresh -#define gaim_gtk_blist_set_headline pidgin_blist_set_headline -#define gaim_gtk_blist_setup_sort_methods pidgin_blist_setup_sort_methods -#define gaim_gtk_blist_sort_function pidgin_blist_sort_function -#define gaim_gtk_blist_sort_method pidgin_blist_sort_method -#define GaimGtkBlistSortMethod PidginBlistSortMethod -#define gaim_gtk_blist_sort_method_reg pidgin_blist_sort_method_reg -#define gaim_gtk_blist_sort_method_set pidgin_blist_sort_method_set -#define gaim_gtk_blist_sort_method_unreg pidgin_blist_sort_method_unreg -#define gaim_gtk_blist_toggle_visibility pidgin_blist_toggle_visibility -#define gaim_gtk_blist_uninit pidgin_blist_uninit -#define gaim_gtk_blist_update_account_error_state pidgin_blist_update_account_error_state -#define gaim_gtk_blist_update_accounts_menu pidgin_blist_update_accounts_menu -#define gaim_gtk_blist_update_columns pidgin_blist_update_columns -#define gaim_gtk_blist_update_plugin_actions pidgin_blist_update_plugin_actions -#define gaim_gtk_blist_update_refresh_timeout pidgin_blist_update_refresh_timeout -#define gaim_gtk_blist_update_sort_methods pidgin_blist_update_sort_methods -#define gaim_gtk_blist_visibility_manager_add pidgin_blist_visibility_manager_add -#define gaim_gtk_blist_visibility_manager_remove pidgin_blist_visibility_manager_remove -#define gaim_gtk_buddy_icon_chooser_new pidgin_buddy_icon_chooser_new -#define gaim_gtk_buddy_icon_get_scale_size pidgin_buddy_icon_get_scale_size -#define GaimGtkBuddyList PidginBuddyList -#define GaimGtkCellRendererExpanderClass PidginCellRendererExpanderClass -#define gaim_gtk_cell_renderer_expander_get_type pidgin_cell_renderer_expander_get_type -#define gaim_gtk_cell_renderer_expander_new pidgin_cell_renderer_expander_new -#define GaimGtkCellRendererExpander PidginCellRendererExpander -#define GaimGtkCellRendererProgressClass PidginCellRendererProgressClass -#define gaim_gtk_cell_renderer_progress_get_type pidgin_cell_renderer_progress_get_type -#define gaim_gtk_cell_renderer_progress_new pidgin_cell_renderer_progress_new -#define GaimGtkCellRendererProgress PidginCellRendererProgress -#define GaimGtkChatPane PidginChatPane -#define gaim_gtk_check_if_dir pidgin_check_if_dir -#define gaim_gtk_clear_cursor pidgin_clear_cursor -#define gaim_gtk_connection_get_handle pidgin_connection_get_handle -#define gaim_gtk_connection_init pidgin_connection_init -#define gaim_gtk_connections_get_ui_ops pidgin_connections_get_ui_ops -#define gaim_gtk_connection_uninit pidgin_connection_uninit -#define GaimGtkConversation PidginConversation -#define GAIM_GTK_CONVERSATION PIDGIN_CONVERSATION -#define gaim_gtk_conversations_fill_menu pidgin_conversations_fill_menu -#define gaim_gtk_conversations_find_unseen_list pidgin_conversations_find_unseen_list -#define gaim_gtk_conversations_get_conv_ui_ops pidgin_conversations_get_conv_ui_ops -#define gaim_gtk_conversations_get_handle pidgin_conversations_get_handle -#define gaim_gtk_conversations_init pidgin_conversations_init -#define gaim_gtk_conversations_uninit pidgin_conversations_uninit -#define gaim_gtk_convert_buddy_icon pidgin_convert_buddy_icon -#define gaim_gtkconv_get_tab_at_xy pidgin_conv_get_tab_at_xy -#define gaim_gtkconv_get_tab_icon pidgin_conv_get_tab_icon -#define gaim_gtkconv_get_window pidgin_conv_get_window -#define gaim_gtkconv_is_hidden pidgin_conv_is_hidden -#define gaim_gtkconv_new pidgin_conv_new -#define gaim_gtkconv_placement_add_fnc pidgin_conv_placement_add_fnc -#define gaim_gtkconv_placement_get_current_func pidgin_conv_placement_get_current_func -#define gaim_gtkconv_placement_get_fnc pidgin_conv_placement_get_fnc -#define gaim_gtkconv_placement_get_name pidgin_conv_placement_get_name -#define gaim_gtkconv_placement_get_options pidgin_conv_placement_get_options -#define gaim_gtkconv_placement_place pidgin_conv_placement_place -#define gaim_gtkconv_placement_remove_fnc pidgin_conv_placement_remove_fnc -#define gaim_gtkconv_placement_set_current_func pidgin_conv_placement_set_current_func -#define gaim_gtkconv_present_conversation pidgin_conv_present_conversation -#define gaim_gtkconv_switch_active_conversation pidgin_conv_switch_active_conversation -#define gaim_gtkconv_update_buddy_icon pidgin_conv_update_buddy_icon -#define gaim_gtkconv_update_buttons_by_protocol pidgin_conv_update_buttons_by_protocol -#define gaim_gtk_conv_window_add_gtkconv pidgin_conv_window_add_gtkconv -#define gaim_gtk_conv_window_destroy pidgin_conv_window_destroy -#define gaim_gtk_conv_window_first_with_type pidgin_conv_window_first_with_type -#define gaim_gtk_conv_window_get_active_conversation pidgin_conv_window_get_active_conversation -#define gaim_gtk_conv_window_get_active_gtkconv pidgin_conv_window_get_active_gtkconv -#define gaim_gtk_conv_window_get_at_xy pidgin_conv_window_get_at_xy -#define gaim_gtk_conv_window_get_gtkconv_at_index pidgin_conv_window_get_gtkconv_at_index -#define gaim_gtk_conv_window_get_gtkconv_count pidgin_conv_window_get_gtkconv_count -#define gaim_gtk_conv_window_get_gtkconvs pidgin_conv_window_get_gtkconvs -#define gaim_gtk_conv_window_has_focus pidgin_conv_window_has_focus -#define gaim_gtk_conv_window_hide pidgin_conv_window_hide -#define gaim_gtk_conv_window_is_active_conversation pidgin_conv_window_is_active_conversation -#define gaim_gtk_conv_window_last_with_type pidgin_conv_window_last_with_type -#define gaim_gtk_conv_window_new pidgin_conv_window_new -#define gaim_gtk_conv_window_raise pidgin_conv_window_raise -#define gaim_gtk_conv_window_remove_gtkconv pidgin_conv_window_remove_gtkconv -#define gaim_gtk_conv_windows_get_list pidgin_conv_windows_get_list -#define gaim_gtk_conv_window_show pidgin_conv_window_show -#define gaim_gtk_conv_window_switch_gtkconv pidgin_conv_window_switch_gtkconv -#define gaim_gtk_create_imhtml pidgin_create_imhtml -#define gaim_gtk_debug_get_handle pidgin_debug_get_handle -#define gaim_gtk_debug_get_ui_ops pidgin_debug_get_ui_ops -#define gaim_gtk_debug_init pidgin_debug_init -#define gaim_gtk_debug_uninit pidgin_debug_uninit -#define gaim_gtk_debug_window_hide pidgin_debug_window_hide -#define gaim_gtk_debug_window_show pidgin_debug_window_show -#define gaim_gtkdialogs_about pidgin_dialogs_about -#define gaim_gtkdialogs_alias_buddy pidgin_dialogs_alias_buddy -#define gaim_gtkdialogs_alias_chat pidgin_dialogs_alias_chat -#define gaim_gtkdialogs_alias_contact pidgin_dialogs_alias_contact -#define gaim_gtkdialogs_destroy_all pidgin_dialogs_destroy_all -#define gaim_gtkdialogs_im pidgin_dialogs_im -#define gaim_gtkdialogs_im_with_user pidgin_dialogs_im_with_user -#define gaim_gtkdialogs_info pidgin_dialogs_info -#define gaim_gtkdialogs_log pidgin_dialogs_log -#define gaim_gtkdialogs_merge_groups pidgin_dialogs_merge_groups -#define gaim_gtkdialogs_remove_buddy pidgin_dialogs_remove_buddy -#define gaim_gtkdialogs_remove_chat pidgin_dialogs_remove_chat -#define gaim_gtkdialogs_remove_contact pidgin_dialogs_remove_contact -#define gaim_gtkdialogs_remove_group pidgin_dialogs_remove_group -#define gaim_gtk_docklet_clicked pidgin_docklet_clicked -#define gaim_gtk_docklet_embedded pidgin_docklet_embedded -#define gaim_gtk_docklet_get_handle pidgin_docklet_get_handle -#define gaim_gtk_docklet_init pidgin_docklet_init -#define gaim_gtk_docklet_remove pidgin_docklet_remove -#define gaim_gtk_docklet_set_ui_ops pidgin_docklet_set_ui_ops -#define gaim_gtk_docklet_uninit pidgin_docklet_uninit -#define gaim_gtk_docklet_unload pidgin_docklet_unload -#define gaim_gtk_eventloop_get_ui_ops pidgin_eventloop_get_ui_ops -#define gaim_gtk_idle_get_ui_ops pidgin_idle_get_ui_ops -#define GaimGtkImPane PidginImPane -#define gaim_gtk_load_accels pidgin_load_accels -#define gaim_gtk_log_get_handle pidgin_log_get_handle -#define gaim_gtk_log_init pidgin_log_init -#define gaim_gtk_log_show_contact pidgin_log_show_contact -#define gaim_gtk_log_show pidgin_log_show -#define gaim_gtk_log_uninit pidgin_log_uninit -#define GaimGtkLogViewer PidginLogViewer -#define gaim_gtk_make_frame pidgin_make_frame -#define gaim_gtk_make_mini_dialog pidgin_make_mini_dialog -#define gaim_gtk_make_pretty_arrows pidgin_make_pretty_arrows -#define gaim_gtk_menu_tray_append pidgin_menu_tray_append -#define GaimGtkMenuTrayClass PidginMenuTrayClass -#define gaim_gtk_menu_tray_get_box pidgin_menu_tray_get_box -#define gaim_gtk_menu_tray_get_gtype pidgin_menu_tray_get_gtype -#define gaim_gtk_menu_tray_new pidgin_menu_tray_new -#define GaimGtkMenuTray PidginMenuTray -#define GAIM_GTK_MENU_TRAY PIDGIN_MENU_TRAY -#define gaim_gtk_menu_tray_prepend pidgin_menu_tray_prepend -#define gaim_gtk_menu_tray_set_tooltip pidgin_menu_tray_set_tooltip -#define GAIM_GTK_MODIFY_ACCOUNT_DIALOG PIDGIN_MODIFY_ACCOUNT_DIALOG -#define gaim_gtk_notify_get_ui_ops pidgin_notify_get_ui_ops -#define gaim_gtk_parse_x_im_contact pidgin_parse_x_im_contact -#define gaim_gtk_plugin_dialog_show pidgin_plugin_dialog_show -#define gaim_gtk_plugin_get_config_frame pidgin_plugin_get_config_frame -#define GAIM_GTK_PLUGIN PIDGIN_PLUGIN -#define gaim_gtk_plugin_pref_create_frame pidgin_plugin_pref_create_frame -#define gaim_gtk_plugins_save pidgin_plugins_save -#define GAIM_GTK_PLUGIN_TYPE PIDGIN_PLUGIN_TYPE -#define GaimGtkPluginUiInfo PidginPluginUiInfo -#define GAIM_GTK_PLUGIN_UI_INFO PIDGIN_PLUGIN_UI_INFO -#define gaim_gtk_pounce_editor_show pidgin_pounce_editor_show -#define gaim_gtk_pounces_get_handle pidgin_pounces_get_handle -#define gaim_gtk_pounces_init pidgin_pounces_init -#define gaim_gtk_pounces_manager_hide pidgin_pounces_manager_hide -#define gaim_gtk_pounces_manager_show pidgin_pounces_manager_show -#define gaim_gtk_prefs_checkbox pidgin_prefs_checkbox -#define gaim_gtk_prefs_dropdown_from_list pidgin_prefs_dropdown_from_list -#define gaim_gtk_prefs_dropdown pidgin_prefs_dropdown -#define gaim_gtk_prefs_init pidgin_prefs_init -#define gaim_gtk_prefs_labeled_entry pidgin_prefs_labeled_entry -#define gaim_gtk_prefs_labeled_spin_button pidgin_prefs_labeled_spin_button -#define gaim_gtk_prefs_show pidgin_prefs_show -#define gaim_gtk_prefs_update_old pidgin_prefs_update_old -#define gaim_gtk_privacy_dialog_hide pidgin_privacy_dialog_hide -#define gaim_gtk_privacy_dialog_show pidgin_privacy_dialog_show -#define gaim_gtk_privacy_get_ui_ops pidgin_privacy_get_ui_ops -#define gaim_gtk_privacy_init pidgin_privacy_init -#define gaim_gtk_protocol_option_menu_new pidgin_protocol_option_menu_new -#define gaim_gtk_request_add_block pidgin_request_add_block -#define gaim_gtk_request_add_permit pidgin_request_add_permit -#define gaim_gtk_request_get_ui_ops pidgin_request_get_ui_ops -#define gaim_gtk_roomlist_dialog_show pidgin_roomlist_dialog_show -#define gaim_gtk_roomlist_dialog_show_with_account pidgin_roomlist_dialog_show_with_account -#define gaim_gtk_roomlist_init pidgin_roomlist_init -#define gaim_gtk_roomlist_is_showable pidgin_roomlist_is_showable -#define gaim_gtk_save_accels_cb pidgin_save_accels_cb -#define gaim_gtk_save_accels pidgin_save_accels -#define gaim_gtk_session_end pidgin_session_end -#define gaim_gtk_session_init pidgin_session_init -#define gaim_gtk_set_cursor pidgin_set_cursor -#define gaim_gtk_set_custom_buddy_icon pidgin_set_custom_buddy_icon -#define gaim_gtk_set_sensitive_if_input pidgin_set_sensitive_if_input -#define gaim_gtk_setup_gtkspell pidgin_setup_gtkspell -#define gaim_gtk_setup_screenname_autocomplete pidgin_setup_screenname_autocomplete -#define gaim_gtk_set_urgent pidgin_set_urgent -#define gaim_gtk_sound_get_event_label pidgin_sound_get_event_label -#define gaim_gtk_sound_get_event_option pidgin_sound_get_event_option -#define gaim_gtk_sound_get_handle pidgin_sound_get_handle -#define gaim_gtk_sound_get_ui_ops pidgin_sound_get_ui_ops -#define gaim_gtk_status_editor_show pidgin_status_editor_show -#define gaim_gtk_status_get_handle pidgin_status_get_handle -#define gaim_gtk_status_init pidgin_status_init -#define gaim_gtk_status_menu pidgin_status_menu -#define gaim_gtk_status_uninit pidgin_status_uninit -#define gaim_gtk_status_window_hide pidgin_status_window_hide -#define gaim_gtk_status_window_show pidgin_status_window_show -#define gaim_gtk_stock_init pidgin_stock_init -#define gaim_gtk_syslog_show pidgin_syslog_show -#define gaim_gtkthemes_get_proto_smileys pidgin_themes_get_proto_smileys -#define gaim_gtkthemes_init pidgin_themes_init -#define gaim_gtkthemes_load_smiley_theme pidgin_themes_load_smiley_theme -#define gaim_gtkthemes_smileys_disabled pidgin_themes_smileys_disabled -#define gaim_gtkthemes_smiley_themeize pidgin_themes_smiley_themeize -#define gaim_gtkthemes_smiley_theme_probe pidgin_themes_smiley_theme_probe -#define gaim_gtk_toggle_sensitive_array pidgin_toggle_sensitive_array -#define gaim_gtk_toggle_sensitive pidgin_toggle_sensitive -#define gaim_gtk_toggle_showhide pidgin_toggle_showhide -#define gaim_gtk_treeview_popup_menu_position_func pidgin_treeview_popup_menu_position_func -#define gaim_gtk_tree_view_search_equal_func pidgin_tree_view_search_equal_func -#define GAIM_GTK_TYPE_MENU_TRAY PIDGIN_TYPE_MENU_TRAY -#define GAIM_GTK_UI PIDGIN_UI -#define gaim_gtk_whiteboard_get_ui_ops pidgin_whiteboard_get_ui_ops -#define GaimGtkWhiteboard PidginWhiteboard -#define GaimGtkWindow PidginWindow -#define gaim_gtkxfer_dialog_add_xfer pidgin_xfer_dialog_add_xfer -#define gaim_gtkxfer_dialog_cancel_xfer pidgin_xfer_dialog_cancel_xfer -#define gaim_gtkxfer_dialog_destroy pidgin_xfer_dialog_destroy -#define gaim_gtkxfer_dialog_hide pidgin_xfer_dialog_hide -#define gaim_gtkxfer_dialog_new pidgin_xfer_dialog_new -#define GaimGtkXferDialog PidginXferDialog -#define gaim_gtkxfer_dialog_remove_xfer pidgin_xfer_dialog_remove_xfer -#define gaim_gtkxfer_dialog_show pidgin_xfer_dialog_show -#define gaim_gtkxfer_dialog_update_xfer pidgin_xfer_dialog_update_xfer -#define gaim_gtk_xfers_get_ui_ops pidgin_xfers_get_ui_ops -#define gaim_gtk_xfers_init pidgin_xfers_init -#define gaim_gtk_xfers_uninit pidgin_xfers_uninit -#define GAIM_HIG_BORDER PIDGIN_HIG_BORDER -#define GAIM_HIG_BOX_SPACE PIDGIN_HIG_BOX_SPACE -#define GAIM_HIG_CAT_SPACE PIDGIN_HIG_CAT_SPACE -#if !GTK_CHECK_VERSION(2,16,0) -#define GAIM_INVISIBLE_CHAR PIDGIN_INVISIBLE_CHAR -#endif /* Less than GTK+ 2.16 */ -#define GAIM_IS_GTK_CONVERSATION PIDGIN_IS_PIDGIN_CONVERSATION -#define GAIM_IS_GTK_PLUGIN PIDGIN_IS_PIDGIN_PLUGIN -#define gaim_new_check_item pidgin_new_check_item -#define gaim_new_item_from_stock pidgin_new_item_from_stock -#define gaim_new_item pidgin_new_item -#define gaim_pixbuf_button_from_stock pidgin_pixbuf_button_from_stock -#define gaim_pixbuf_toolbar_button_from_stock pidgin_pixbuf_toolbar_button_from_stock -#define GaimScrollBookClass PidginScrollBookClass -#define gaim_scroll_book_get_type pidgin_scroll_book_get_type -#define gaim_scroll_book_new pidgin_scroll_book_new -#define GaimScrollBook PidginScrollBook -#define gaim_separator pidgin_separator -#define gaim_set_accessible_label pidgin_set_accessible_label -#define gaim_set_gtkxfer_dialog pidgin_set_xfer_dialog -#define gaim_setup_imhtml pidgin_setup_imhtml -#define gaim_status_box_add pidgin_status_box_add -#define gaim_status_box_add_separator pidgin_status_box_add_separator -#define GaimStatusBoxClass PidginStatusBoxClass -#define gaim_status_box_get_buddy_icon pidgin_status_box_get_buddy_icon -#define gaim_status_box_get_message pidgin_status_box_get_message -#define gaim_status_box_get_type pidgin_status_box_get_type -#define GaimStatusBoxItemType PidginStatusBoxItemType -#define gaim_status_box_new pidgin_status_box_new -#define gaim_status_box_new_with_account pidgin_status_box_new_with_account -#define GaimStatusBox PidginStatusBox -#define gaim_status_box_pulse_connecting pidgin_status_box_pulse_connecting -#define gaim_status_box_set_buddy_icon pidgin_status_box_set_buddy_icon -#define gaim_status_box_set_connecting pidgin_status_box_set_connecting -#define gaim_status_box_set_network_available pidgin_status_box_set_network_available -#define GAIM_STATUS_ICON_LARGE PIDGIN_STATUS_ICON_LARGE -#define GaimStatusIconSize PidginStatusIconSize -#define GAIM_STATUS_ICON_SMALL PIDGIN_STATUS_ICON_SMALL -#define GAIM_STOCK_ABOUT PIDGIN_STOCK_ABOUT -#define GAIM_STOCK_ACTION PIDGIN_STOCK_ACTION -#define GAIM_STOCK_ALIAS PIDGIN_STOCK_ALIAS -#define GAIM_STOCK_AWAY PIDGIN_STOCK_AWAY -#define GAIM_STOCK_CHAT PIDGIN_STOCK_CHAT -#define GAIM_STOCK_CLEAR PIDGIN_STOCK_CLEAR -#define GAIM_STOCK_CLOSE_TABS PIDGIN_STOCK_CLOSE_TABS -#define GAIM_STOCK_DEBUG PIDGIN_STOCK_DEBUG -#define GAIM_STOCK_DIALOG_AUTH PIDGIN_STOCK_DIALOG_AUTH -#define GAIM_STOCK_DIALOG_COOL PIDGIN_STOCK_DIALOG_COOL -#define GAIM_STOCK_DIALOG_ERROR PIDGIN_STOCK_DIALOG_ERROR -#define GAIM_STOCK_DIALOG_INFO PIDGIN_STOCK_DIALOG_INFO -#define GAIM_STOCK_DIALOG_QUESTION PIDGIN_STOCK_DIALOG_QUESTION -#define GAIM_STOCK_DIALOG_WARNING PIDGIN_STOCK_DIALOG_WARNING -#define GAIM_STOCK_DISCONNECT PIDGIN_STOCK_DISCONNECT -#define GAIM_STOCK_DOWNLOAD PIDGIN_STOCK_DOWNLOAD -#define GAIM_STOCK_EDIT PIDGIN_STOCK_EDIT -#define GAIM_STOCK_FGCOLOR PIDGIN_STOCK_FGCOLOR -#define GAIM_STOCK_FILE_CANCELED PIDGIN_STOCK_FILE_CANCELED -#define GAIM_STOCK_FILE_DONE PIDGIN_STOCK_FILE_DONE -#define GAIM_STOCK_FILE_TRANSFER PIDGIN_STOCK_FILE_TRANSFER -#define GAIM_STOCK_IGNORE PIDGIN_STOCK_IGNORE -#define GAIM_STOCK_IM "gaim-im" /* foo... */ -#define GAIM_STOCK_INVITE PIDGIN_STOCK_INVITE -#define GAIM_STOCK_MODIFY PIDGIN_STOCK_MODIFY -#define GAIM_STOCK_OPEN_MAIL PIDGIN_STOCK_OPEN_MAIL -#define GAIM_STOCK_PAUSE PIDGIN_STOCK_PAUSE -#define GAIM_STOCK_POUNCE PIDGIN_STOCK_POUNCE -#define GAIM_STOCK_SIGN_OFF PIDGIN_STOCK_SIGN_OFF -#define GAIM_STOCK_SIGN_ON PIDGIN_STOCK_SIGN_ON -#define GAIM_STOCK_STATUS_OFFLINE PIDGIN_STOCK_STATUS_OFFLINE -#define GAIM_STOCK_TEXT_NORMAL PIDGIN_STOCK_TEXT_NORMAL -#define GAIM_STOCK_TYPED PIDGIN_STOCK_TYPED -#define GAIM_STOCK_UPLOAD PIDGIN_STOCK_UPLOAD -#define GAIM_TYPE_GTK_CELL_RENDERER_EXPANDER PIDGIN_TYPE_GTK_CELL_RENDERER_EXPANDER -#define GAIM_TYPE_GTK_CELL_RENDERER_PROGRESS PIDGIN_TYPE_GTK_CELL_RENDERER_PROGRESS -#define GAIM_UNSEEN_EVENT PIDGIN_UNSEEN_EVENT -#define GAIM_UNSEEN_NICK PIDGIN_UNSEEN_NICK -#define GAIM_UNSEEN_NO_LOG PIDGIN_UNSEEN_NO_LOG -#define GAIM_UNSEEN_NONE PIDGIN_UNSEEN_NONE -#define GaimUnseenState PidginUnseenState -#define GAIM_UNSEEN_TEXT PIDGIN_UNSEEN_TEXT -#define GAIM_WINDOW_ICONIFIED PIDGIN_WINDOW_ICONIFIED -#define GTK_GAIM_IS_SCROLL_BOOK_CLASS PIDGIN_IS_SCROLL_BOOK_CLASS -#define GTK_GAIM_IS_SCROLL_BOOK PIDGIN_IS_SCROLL_BOOK -#define GTK_GAIM_IS_STATUS_BOX_CLASS PIDGIN_IS_STATUS_BOX_CLASS -#define GTK_GAIM_IS_STATUS_BOX PIDGIN_IS_STATUS_BOX -#define GTK_GAIM_SCROLL_BOOK_CLASS PIDGIN_SCROLL_BOOK_CLASS -#define GTK_GAIM_SCROLL_BOOK_GET_CLASS PIDGIN_SCROLL_BOOK_GET_CLASS -#define gtk_gaim_scroll_book_get_type pidgin_scroll_book_get_type -#define gtk_gaim_scroll_book_new pidgin_scroll_book_new -#define GTK_GAIM_SCROLL_BOOK PIDGIN_SCROLL_BOOK -#define gtk_gaim_status_box_add pidgin_status_box_add -#define gtk_gaim_status_box_add_separator pidgin_status_box_add_separator -#define GTK_GAIM_STATUS_BOX_CLASS PIDGIN_STATUS_BOX_CLASS -#define gtk_gaim_status_box_get_buddy_icon pidgin_status_box_get_buddy_icon -#define GTK_GAIM_STATUS_BOX_GET_CLASS PIDGIN_STATUS_BOX_GET_CLASS -#define gtk_gaim_status_box_get_message pidgin_status_box_get_message -#define gtk_gaim_status_box_get_type pidgin_status_box_get_type -#define GtkGaimStatusBoxItemType PidginStatusBoxItemType -#define gtk_gaim_status_box_new pidgin_status_box_new -#define gtk_gaim_status_box_new_with_account pidgin_status_box_new_with_account -#define GTK_GAIM_STATUS_BOX_NUM_TYPES PIDGIN_STATUS_BOX_NUM_TYPES -#define GtkGaimStatusBox PidginStatusBox -#define GTK_GAIM_STATUS_BOX PIDGIN_STATUS_BOX -#define gtk_gaim_status_box_pulse_connecting pidgin_status_box_pulse_connecting -#define gtk_gaim_status_box_set_buddy_icon pidgin_status_box_set_buddy_icon -#define gtk_gaim_status_box_set_connecting pidgin_status_box_set_connecting -#define gtk_gaim_status_box_set_network_available pidgin_status_box_set_network_available -#define GTK_GAIM_STATUS_BOX_TYPE_CUSTOM PIDGIN_STATUS_BOX_TYPE_CUSTOM -#define GTK_GAIM_STATUS_BOX_TYPE_POPULAR PIDGIN_STATUS_BOX_TYPE_POPULAR -#define GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE PIDGIN_STATUS_BOX_TYPE_PRIMITIVE -#define GTK_GAIM_STATUS_BOX_TYPE_SAVED PIDGIN_STATUS_BOX_TYPE_SAVED -#define GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR PIDGIN_STATUS_BOX_TYPE_SEPARATOR -#define GTK_GAIM_TYPE_SCROLL_BOOK PIDGIN_TYPE_SCROLL_BOOK -#define GTK_GAIM_TYPE_STATUS_BOX PIDGIN_TYPE_STATUS_BOX - -#endif /* _GTKGAIM_COMPAT_H */ -- cgit v1.2.1 From de4c5a57c5c914eeda29f6e9785edf787efe1a06 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Thu, 17 Mar 2011 08:00:18 +0000 Subject: Don't bother reading in the "protocol" attribute in blist.xml. As near as I can tell we've been using "proto" in blist.xml since revision 2b49a7d5ac9759838ab77b91501aed75b5854c5a in October 2003. --- libpurple/blist.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/libpurple/blist.c b/libpurple/blist.c index 26d27f17c5..4b01cce420 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -460,17 +460,16 @@ parse_buddy(PurpleGroup *group, PurpleContact *contact, xmlnode *bnode) PurpleAccount *account; PurpleBuddy *buddy; char *name = NULL, *alias = NULL; - const char *acct_name, *proto, *protocol; + const char *acct_name, *proto; xmlnode *x; acct_name = xmlnode_get_attrib(bnode, "account"); - protocol = xmlnode_get_attrib(bnode, "protocol"); proto = xmlnode_get_attrib(bnode, "proto"); - if (!acct_name || (!proto && !protocol)) + if (!acct_name || !proto) return; - account = purple_accounts_find(acct_name, proto ? proto : protocol); + account = purple_accounts_find(acct_name, proto); if (!account) return; @@ -529,19 +528,18 @@ parse_chat(PurpleGroup *group, xmlnode *cnode) { PurpleChat *chat; PurpleAccount *account; - const char *acct_name, *proto, *protocol; + const char *acct_name, *proto; xmlnode *x; char *alias = NULL; GHashTable *components; acct_name = xmlnode_get_attrib(cnode, "account"); - protocol = xmlnode_get_attrib(cnode, "protocol"); proto = xmlnode_get_attrib(cnode, "proto"); - if (!acct_name || (!proto && !protocol)) + if (!acct_name || !proto) return; - account = purple_accounts_find(acct_name, proto ? proto : protocol); + account = purple_accounts_find(acct_name, proto); if (!account) return; @@ -627,17 +625,16 @@ purple_blist_load() xmlnode *x; PurpleAccount *account; int imode; - const char *acct_name, *proto, *mode, *protocol; + const char *acct_name, *proto, *mode; acct_name = xmlnode_get_attrib(anode, "name"); - protocol = xmlnode_get_attrib(anode, "protocol"); proto = xmlnode_get_attrib(anode, "proto"); mode = xmlnode_get_attrib(anode, "mode"); - if (!acct_name || (!proto && !protocol) || !mode) + if (!acct_name || !proto || !mode) continue; - account = purple_accounts_find(acct_name, proto ? proto : protocol); + account = purple_accounts_find(acct_name, proto); if (!account) continue; -- cgit v1.2.1 From ed9b82b95411856fcea6b3c40704f05fc62f768d Mon Sep 17 00:00:00 2001 From: Richard Laager Date: Thu, 17 Mar 2011 12:53:18 +0000 Subject: Drop gaim compatibility files --- Makefile.am | 2 - gaim-uninstalled.pc.in | 14 - gaim.pc.in | 14 - libpurple/Makefile.am | 1 - libpurple/gaim-compat.h | 2317 ----------------------------------------------- pidgin/Makefile.am | 1 - pidgin/gtkgaim-compat.h | 412 --------- 7 files changed, 2761 deletions(-) delete mode 100644 gaim-uninstalled.pc.in delete mode 100644 gaim.pc.in delete mode 100644 libpurple/gaim-compat.h delete mode 100644 pidgin/gtkgaim-compat.h diff --git a/Makefile.am b/Makefile.am index 1d3aafbbd7..daa68d638c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,8 +11,6 @@ EXTRA_DIST = \ config.h.mingw \ doxy2devhelp.xsl \ fix-casts.sh \ - gaim.pc.in \ - gaim-uninstalled.pc.in \ intltool-extract.in \ intltool-merge.in \ intltool-update.in \ diff --git a/gaim-uninstalled.pc.in b/gaim-uninstalled.pc.in deleted file mode 100644 index b9d7d0e193..0000000000 --- a/gaim-uninstalled.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -Name: Pidgin (Gaim compatibility) -Description: Pidgin is a GTK2-based instant messenger application. -Version: @VERSION@ -Requires: glib-2.0 -Cflags: -I${pc_top_builddir}/${pcfiledir}/libpurple -I${pc_top_builddir}/${pcfiledir}/pidgin -Libs: ${pc_top_builddir}/${pcfiledir}/libpurple/libpurple.la diff --git a/gaim.pc.in b/gaim.pc.in deleted file mode 100644 index bc8f5da073..0000000000 --- a/gaim.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -Name: Pidgin (Gaim compatibility) -Description: Pidgin is a GTK2-based instant messenger application. -Version: @VERSION@ -Requires: glib-2.0 -Cflags: -I${includedir}/libpurple -Libs: -L${libdir} -lpurple diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am index fc0541469c..d7b6c5161e 100644 --- a/libpurple/Makefile.am +++ b/libpurple/Makefile.am @@ -117,7 +117,6 @@ purple_coreheaders = \ desktopitem.h \ eventloop.h \ ft.h \ - gaim-compat.h \ idle.h \ imgstore.h \ log.h \ diff --git a/libpurple/gaim-compat.h b/libpurple/gaim-compat.h deleted file mode 100644 index 0bd8cea0b9..0000000000 --- a/libpurple/gaim-compat.h +++ /dev/null @@ -1,2317 +0,0 @@ -/** - * @file gaim-compat.h Gaim Compat macros - * @ingroup core - */ - -/* pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _GAIM_COMPAT_H_ -#define _GAIM_COMPAT_H_ - -#include - -/* from account.h */ -#define GaimAccountUiOps PurpleAccountUiOps -#define GaimAccount PurpleAccount - -#define GaimFilterAccountFunc PurpleFilterAccountFunc -#define GaimAccountRequestAuthorizationCb PurpleAccountRequestAuthorizationCb - -#define gaim_account_new purple_account_new -#define gaim_account_destroy purple_account_destroy -#define gaim_account_connect purple_account_connect -#define gaim_account_register purple_account_register -#define gaim_account_disconnect purple_account_disconnect -#define gaim_account_notify_added purple_account_notify_added -#define gaim_account_request_add purple_account_request_add -#define gaim_account_request_close purple_account_request_close - -#define gaim_account_request_authorization purple_account_request_authorization -#define gaim_account_request_change_password purple_account_request_change_password -#define gaim_account_request_change_user_info purple_account_request_change_user_info - -#define gaim_account_set_username purple_account_set_username -#define gaim_account_set_password purple_account_set_password -#define gaim_account_set_alias purple_account_set_alias -#define gaim_account_set_user_info purple_account_set_user_info -#define gaim_account_set_buddy_icon_path purple_account_set_buddy_icon_path -#define gaim_account_set_protocol_id purple_account_set_protocol_id -#define gaim_account_set_connection purple_account_set_connection -#define gaim_account_set_remember_password purple_account_set_remember_password -#define gaim_account_set_check_mail purple_account_set_check_mail -#define gaim_account_set_enabled purple_account_set_enabled -#define gaim_account_set_proxy_info purple_account_set_proxy_info -#define gaim_account_set_status_types purple_account_set_status_types -#define gaim_account_set_status purple_account_set_status -#define gaim_account_set_status_list purple_account_set_status_list - -#define gaim_account_clear_settings purple_account_clear_settings - -#define gaim_account_set_int purple_account_set_int -#define gaim_account_set_string purple_account_set_string -#define gaim_account_set_bool purple_account_set_bool - -#define gaim_account_set_ui_int purple_account_set_ui_int -#define gaim_account_set_ui_string purple_account_set_ui_string -#define gaim_account_set_ui_bool purple_account_set_ui_bool - -#define gaim_account_is_connected purple_account_is_connected -#define gaim_account_is_connecting purple_account_is_connecting -#define gaim_account_is_disconnected purple_account_is_disconnected - -#define gaim_account_get_username purple_account_get_username -#define gaim_account_get_password purple_account_get_password -#define gaim_account_get_alias purple_account_get_alias -#define gaim_account_get_user_info purple_account_get_user_info -#define gaim_account_get_buddy_icon_path purple_account_get_buddy_icon_path -#define gaim_account_get_protocol_id purple_account_get_protocol_id -#define gaim_account_get_protocol_name purple_account_get_protocol_name -#define gaim_account_get_connection purple_account_get_connection -#define gaim_account_get_remember_password purple_account_get_remember_password -#define gaim_account_get_check_mail purple_account_get_check_mail -#define gaim_account_get_enabled purple_account_get_enabled -#define gaim_account_get_proxy_info purple_account_get_proxy_info -#define gaim_account_get_active_status purple_account_get_active_status -#define gaim_account_get_status purple_account_get_status -#define gaim_account_get_status_type purple_account_get_status_type -#define gaim_account_get_status_type_with_primitive \ - purple_account_get_status_type_with_primitive - -#define gaim_account_get_presence purple_account_get_presence -#define gaim_account_is_status_active purple_account_is_status_active -#define gaim_account_get_status_types purple_account_get_status_types - -#define gaim_account_get_int purple_account_get_int -#define gaim_account_get_string purple_account_get_string -#define gaim_account_get_bool purple_account_get_bool - -#define gaim_account_get_ui_int purple_account_get_ui_int -#define gaim_account_get_ui_string purple_account_get_ui_string -#define gaim_account_get_ui_bool purple_account_get_ui_bool - - -#define gaim_account_get_log purple_account_get_log -#define gaim_account_destroy_log purple_account_destroy_log - -#define gaim_account_add_buddy purple_account_add_buddy -#define gaim_account_add_buddies purple_account_add_buddies -#define gaim_account_remove_buddy purple_account_remove_buddy -#define gaim_account_remove_buddies purple_account_remove_buddies - -#define gaim_account_remove_group purple_account_remove_group - -#define gaim_account_change_password purple_account_change_password - -#define gaim_account_supports_offline_message purple_account_supports_offline_message - -#define gaim_accounts_add purple_accounts_add -#define gaim_accounts_remove purple_accounts_remove -#define gaim_accounts_delete purple_accounts_delete -#define gaim_accounts_reorder purple_accounts_reorder - -#define gaim_accounts_get_all purple_accounts_get_all -#define gaim_accounts_get_all_active purple_accounts_get_all_active - -#define gaim_accounts_find purple_accounts_find - -#define gaim_accounts_restore_current_statuses purple_accounts_restore_current_statuses - -#define gaim_accounts_set_ui_ops purple_accounts_set_ui_ops -#define gaim_accounts_get_ui_ops purple_accounts_get_ui_ops - -#define gaim_accounts_get_handle purple_accounts_get_handle - -#define gaim_accounts_init purple_accounts_init -#define gaim_accounts_uninit purple_accounts_uninit - -/* from accountopt.h */ - -#define GaimAccountOption PurpleAccountOption -#define GaimAccountUserSplit PurpleAccountUserSplit - -#define gaim_account_option_new purple_account_option_new -#define gaim_account_option_bool_new purple_account_option_bool_new -#define gaim_account_option_int_new purple_account_option_int_new -#define gaim_account_option_string_new purple_account_option_string_new -#define gaim_account_option_list_new purple_account_option_list_new - -#define gaim_account_option_destroy purple_account_option_destroy - -#define gaim_account_option_set_default_bool purple_account_option_set_default_bool -#define gaim_account_option_set_default_int purple_account_option_set_default_int -#define gaim_account_option_set_default_string purple_account_option_set_default_string - -#define gaim_account_option_set_masked purple_account_option_set_masked - -#define gaim_account_option_set_list purple_account_option_set_list - -#define gaim_account_option_add_list_item purple_account_option_add_list_item - -#define gaim_account_option_get_type purple_account_option_get_type -#define gaim_account_option_get_text purple_account_option_get_text -#define gaim_account_option_get_setting purple_account_option_get_setting - -#define gaim_account_option_get_default_bool purple_account_option_get_default_bool -#define gaim_account_option_get_default_int purple_account_option_get_default_int -#define gaim_account_option_get_default_string purple_account_option_get_default_string -#define gaim_account_option_get_default_list_value purple_account_option_get_default_list_value - -#define gaim_account_option_get_masked purple_account_option_get_masked -#define gaim_account_option_get_list purple_account_option_get_list - -#define gaim_account_user_split_new purple_account_user_split_new -#define gaim_account_user_split_destroy purple_account_user_split_destroy - -#define gaim_account_user_split_get_text purple_account_user_split_get_text -#define gaim_account_user_split_get_default_value purple_account_user_split_get_default_value -#define gaim_account_user_split_get_separator purple_account_user_split_get_separator - -/* from blist.h */ - -#define GaimBuddyList PurpleBuddyList -#define GaimBlistUiOps PurpleBlistUiOps -#define GaimBlistNode PurpleBlistNode - -#define GaimChat PurpleChat -#define GaimGroup PurpleGroup -#define GaimContact PurpleContact -#define GaimBuddy PurpleBuddy - -#define GAIM_BLIST_GROUP_NODE PURPLE_BLIST_GROUP_NODE -#define GAIM_BLIST_CONTACT_NODE PURPLE_BLIST_CONTACT_NODE -#define GAIM_BLIST_BUDDY_NODE PURPLE_BLIST_BUDDY_NODE -#define GAIM_BLIST_CHAT_NODE PURPLE_BLIST_CHAT_NODE -#define GAIM_BLIST_OTHER_NODE PURPLE_BLIST_OTHER_NODE -#define GaimBlistNodeType PurpleBlistNodeType - -#define GAIM_BLIST_NODE_IS_CHAT PURPLE_BLIST_NODE_IS_CHAT -#define GAIM_BLIST_NODE_IS_BUDDY PURPLE_BLIST_NODE_IS_BUDDY -#define GAIM_BLIST_NODE_IS_CONTACT PURPLE_BLIST_NODE_IS_CONTACT -#define GAIM_BLIST_NODE_IS_GROUP PURPLE_BLIST_NODE_IS_GROUP - -#define GAIM_BUDDY_IS_ONLINE PURPLE_BUDDY_IS_ONLINE - -#define GAIM_BLIST_NODE_FLAG_NO_SAVE PURPLE_BLIST_NODE_FLAG_NO_SAVE -#define GaimBlistNodeFlags PurpleBlistNodeFlags - -#define GAIM_BLIST_NODE_HAS_FLAG PURPLE_BLIST_NODE_HAS_FLAG -#define GAIM_BLIST_NODE_SHOULD_SAVE PURPLE_BLIST_NODE_SHOULD_SAVE - -#define GAIM_BLIST_NODE_NAME PURPLE_BLIST_NODE_NAME - - -#define gaim_blist_new purple_blist_new -#define gaim_set_blist purple_set_blist -#define gaim_get_blist purple_get_blist - -#define gaim_blist_get_root purple_blist_get_root -#define gaim_blist_node_next purple_blist_node_next - -#define gaim_blist_show purple_blist_show - -#define gaim_blist_destroy purple_blist_destroy - -#define gaim_blist_set_visible purple_blist_set_visible - -#define gaim_blist_update_buddy_status purple_blist_update_buddy_status -#define gaim_blist_update_buddy_icon purple_blist_update_buddy_icon - - -#define gaim_blist_alias_contact purple_blist_alias_contact -#define gaim_blist_alias_buddy purple_blist_alias_buddy -#define gaim_blist_server_alias_buddy purple_blist_server_alias_buddy -#define gaim_blist_alias_chat purple_blist_alias_chat - -#define gaim_blist_rename_buddy purple_blist_rename_buddy -#define gaim_blist_rename_group purple_blist_rename_group - -#define gaim_chat_new purple_chat_new -#define gaim_blist_add_chat purple_blist_add_chat - -#define gaim_buddy_new purple_buddy_new -#define gaim_buddy_set_icon purple_buddy_set_icon -#define gaim_buddy_get_account purple_buddy_get_account -#define gaim_buddy_get_name purple_buddy_get_name -#define gaim_buddy_get_icon purple_buddy_get_icon -#define gaim_buddy_get_contact purple_buddy_get_contact -#define gaim_buddy_get_presence purple_buddy_get_presence - -#define gaim_blist_add_buddy purple_blist_add_buddy - -#define gaim_group_new purple_group_new - -#define gaim_blist_add_group purple_blist_add_group - -#define gaim_contact_new purple_contact_new - -#define gaim_blist_add_contact purple_blist_add_contact -#define gaim_blist_merge_contact purple_blist_merge_contact - -#define gaim_contact_get_priority_buddy purple_contact_get_priority_buddy -#define gaim_contact_set_alias purple_contact_set_alias -#define gaim_contact_get_alias purple_contact_get_alias -#define gaim_contact_on_account purple_contact_on_account - -#define gaim_contact_invalidate_priority_buddy purple_contact_invalidate_priority_buddy - -#define gaim_blist_remove_buddy purple_blist_remove_buddy -#define gaim_blist_remove_contact purple_blist_remove_contact -#define gaim_blist_remove_chat purple_blist_remove_chat -#define gaim_blist_remove_group purple_blist_remove_group - -#define gaim_buddy_get_alias_only purple_buddy_get_alias_only -#define gaim_buddy_get_server_alias purple_buddy_get_server_alias -#define gaim_buddy_get_contact_alias purple_buddy_get_contact_alias -#define gaim_buddy_get_local_alias purple_buddy_get_local_alias -#define gaim_buddy_get_alias purple_buddy_get_alias - -#define gaim_chat_get_name purple_chat_get_name - -#define gaim_find_buddy purple_find_buddy -#define gaim_find_buddy_in_group purple_find_buddy_in_group -#define gaim_find_buddies purple_find_buddies - -#define gaim_find_group purple_find_group - -#define gaim_blist_find_chat purple_blist_find_chat - -#define gaim_chat_get_group purple_chat_get_group -#define gaim_buddy_get_group purple_buddy_get_group - -#define gaim_group_get_accounts purple_group_get_accounts -#define gaim_group_on_account purple_group_on_account - -#define gaim_blist_add_account purple_blist_add_account -#define gaim_blist_remove_account purple_blist_remove_account - -#define gaim_blist_get_group_size purple_blist_get_group_size -#define gaim_blist_get_group_online_count purple_blist_get_group_online_count - -#define gaim_blist_load purple_blist_load -#define gaim_blist_schedule_save purple_blist_schedule_save - -#define gaim_blist_request_add_buddy purple_blist_request_add_buddy -#define gaim_blist_request_add_chat purple_blist_request_add_chat -#define gaim_blist_request_add_group purple_blist_request_add_group - -#define gaim_blist_node_set_bool purple_blist_node_set_bool -#define gaim_blist_node_get_bool purple_blist_node_get_bool -#define gaim_blist_node_set_int purple_blist_node_set_int -#define gaim_blist_node_get_int purple_blist_node_get_int -#define gaim_blist_node_set_string purple_blist_node_set_string -#define gaim_blist_node_get_string purple_blist_node_get_string - -#define gaim_blist_node_remove_setting purple_blist_node_remove_setting - -#define gaim_blist_node_set_flags purple_blist_node_set_flags -#define gaim_blist_node_get_flags purple_blist_node_get_flags - -#define gaim_blist_node_get_extended_menu purple_blist_node_get_extended_menu - -#define gaim_blist_set_ui_ops purple_blist_set_ui_ops -#define gaim_blist_get_ui_ops purple_blist_get_ui_ops - -#define gaim_blist_get_handle purple_blist_get_handle - -#define gaim_blist_init purple_blist_init -#define gaim_blist_uninit purple_blist_uninit - - -#define GaimBuddyIcon PurpleBuddyIcon - -#define gaim_buddy_icon_new(account, username, icon_data, icon_len)\ - purple_buddy_icon_new(account, username, g_memdup(icon_data, icon_len), icon_len) -#define gaim_buddy_icon_ref purple_buddy_icon_ref -#define gaim_buddy_icon_unref purple_buddy_icon_unref -#define gaim_buddy_icon_update purple_buddy_icon_update - -#define gaim_buddy_icon_set_data(icon, data, len) \ - purple_buddy_icon_set_data(icon, g_memdup(data, len), len, NULL); - -#define gaim_buddy_icon_get_account purple_buddy_icon_get_account -#define gaim_buddy_icon_get_username purple_buddy_icon_get_username -#define gaim_buddy_icon_get_data purple_buddy_icon_get_data -#define gaim_buddy_icon_get_type purple_buddy_icon_get_extension - -#define gaim_buddy_icons_set_for_user(icon, data, len) \ - purple_buddy_icons_set_for_user(icon, g_memdup(data, len), len, NULL) -#define gaim_buddy_icons_set_caching purple_buddy_icons_set_caching -#define gaim_buddy_icons_is_caching purple_buddy_icons_is_caching -#define gaim_buddy_icons_set_cache_dir purple_buddy_icons_set_cache_dir -#define gaim_buddy_icons_get_cache_dir purple_buddy_icons_get_cache_dir -#define gaim_buddy_icons_get_handle purple_buddy_icons_get_handle - -#define gaim_buddy_icons_init purple_buddy_icons_init -#define gaim_buddy_icons_uninit purple_buddy_icons_uninit - -#define gaim_buddy_icon_get_scale_size purple_buddy_icon_get_scale_size - -/* from cipher.h */ - -#define GAIM_CIPHER PURPLE_CIPHER -#define GAIM_CIPHER_OPS PURPLE_CIPHER_OPS -#define GAIM_CIPHER_CONTEXT PURPLE_CIPHER_CONTEXT - -#define GaimCipher PurpleCipher -#define GaimCipherOps PurpleCipherOps -#define GaimCipherContext PurpleCipherContext - -#define GAIM_CIPHER_CAPS_SET_OPT PURPLE_CIPHER_CAPS_SET_OPT -#define GAIM_CIPHER_CAPS_GET_OPT PURPLE_CIPHER_CAPS_GET_OPT -#define GAIM_CIPHER_CAPS_INIT PURPLE_CIPHER_CAPS_INIT -#define GAIM_CIPHER_CAPS_RESET PURPLE_CIPHER_CAPS_RESET -#define GAIM_CIPHER_CAPS_UNINIT PURPLE_CIPHER_CAPS_UNINIT -#define GAIM_CIPHER_CAPS_SET_IV PURPLE_CIPHER_CAPS_SET_IV -#define GAIM_CIPHER_CAPS_APPEND PURPLE_CIPHER_CAPS_APPEND -#define GAIM_CIPHER_CAPS_DIGEST PURPLE_CIPHER_CAPS_DIGEST -#define GAIM_CIPHER_CAPS_ENCRYPT PURPLE_CIPHER_CAPS_ENCRYPT -#define GAIM_CIPHER_CAPS_DECRYPT PURPLE_CIPHER_CAPS_DECRYPT -#define GAIM_CIPHER_CAPS_SET_SALT PURPLE_CIPHER_CAPS_SET_SALT -#define GAIM_CIPHER_CAPS_GET_SALT_SIZE PURPLE_CIPHER_CAPS_GET_SALT_SIZE -#define GAIM_CIPHER_CAPS_SET_KEY PURPLE_CIPHER_CAPS_SET_KEY -#define GAIM_CIPHER_CAPS_GET_KEY_SIZE PURPLE_CIPHER_CAPS_GET_KEY_SIZE -#define GAIM_CIPHER_CAPS_UNKNOWN PURPLE_CIPHER_CAPS_UNKNOWN - -#define gaim_cipher_get_name purple_cipher_get_name -#define gaim_cipher_get_capabilities purple_cipher_get_capabilities -#define gaim_cipher_digest_region purple_cipher_digest_region - -#define gaim_ciphers_find_cipher purple_ciphers_find_cipher -#define gaim_ciphers_register_cipher purple_ciphers_register_cipher -#define gaim_ciphers_unregister_cipher purple_ciphers_unregister_cipher -#define gaim_ciphers_get_ciphers purple_ciphers_get_ciphers - -#define gaim_ciphers_get_handle purple_ciphers_get_handle -#define gaim_ciphers_init purple_ciphers_init -#define gaim_ciphers_uninit purple_ciphers_uninit - -#define gaim_cipher_context_set_option purple_cipher_context_set_option -#define gaim_cipher_context_get_option purple_cipher_context_get_option - -#define gaim_cipher_context_new purple_cipher_context_new -#define gaim_cipher_context_new_by_name purple_cipher_context_new_by_name -#define gaim_cipher_context_reset purple_cipher_context_reset -#define gaim_cipher_context_destroy purple_cipher_context_destroy -#define gaim_cipher_context_set_iv purple_cipher_context_set_iv -#define gaim_cipher_context_append purple_cipher_context_append -#define gaim_cipher_context_digest purple_cipher_context_digest -#define gaim_cipher_context_digest_to_str purple_cipher_context_digest_to_str -#define gaim_cipher_context_encrypt purple_cipher_context_encrypt -#define gaim_cipher_context_decrypt purple_cipher_context_decrypt -#define gaim_cipher_context_set_salt purple_cipher_context_set_salt -#define gaim_cipher_context_get_salt_size purple_cipher_context_get_salt_size -#define gaim_cipher_context_set_key purple_cipher_context_set_key -#define gaim_cipher_context_get_key_size purple_cipher_context_get_key_size -#define gaim_cipher_context_set_data purple_cipher_context_set_data -#define gaim_cipher_context_get_data purple_cipher_context_get_data - -#define gaim_cipher_http_digest_calculate_session_key \ - purple_cipher_http_digest_calculate_session_key - -#define gaim_cipher_http_digest_calculate_response \ - purple_cipher_http_digest_calculate_response - -/* from circbuffer.h */ - -#define GaimCircBuffer PurpleCircBuffer - -#define gaim_circ_buffer_new purple_circ_buffer_new -#define gaim_circ_buffer_destroy purple_circ_buffer_destroy -#define gaim_circ_buffer_append purple_circ_buffer_append -#define gaim_circ_buffer_get_max_read purple_circ_buffer_get_max_read -#define gaim_circ_buffer_mark_read purple_circ_buffer_mark_read - -/* from cmds.h */ - -#define GaimCmdPriority PurpleCmdPriority -#define GaimCmdFlag PurpleCmdFlag -#define GaimCmdStatus PurpleCmdStatus -#define GaimCmdRet PurpleCmdRet - -#define GAIM_CMD_STATUS_OK PURPLE_CMD_STATUS_OK -#define GAIM_CMD_STATUS_FAILED PURPLE_CMD_STATUS_FAILED -#define GAIM_CMD_STATUS_NOT_FOUND PURPLE_CMD_STATUS_NOT_FOUND -#define GAIM_CMD_STATUS_WRONG_ARGS PURPLE_CMD_STATUS_WRONG_ARGS -#define GAIM_CMD_STATUS_WRONG_PRPL PURPLE_CMD_STATUS_WRONG_PRPL -#define GAIM_CMD_STATUS_WRONG_TYPE PURPLE_CMD_STATUS_WRONG_TYPE - -#define GAIM_CMD_FUNC PURPLE_CMD_FUNC - -#define GAIM_CMD_RET_OK PURPLE_CMD_RET_OK -#define GAIM_CMD_RET_FAILED PURPLE_CMD_RET_FAILED -#define GAIM_CMD_RET_CONTINUE PURPLE_CMD_RET_CONTINUE - -#define GAIM_CMD_P_VERY_LOW PURPLE_CMD_P_VERY_LOW -#define GAIM_CMD_P_LOW PURPLE_CMD_P_LOW -#define GAIM_CMD_P_DEFAULT PURPLE_CMD_P_DEFAULT -#define GAIM_CMD_P_PRPL PURPLE_CMD_P_PRPL -#define GAIM_CMD_P_PLUGIN PURPLE_CMD_P_PLUGIN -#define GAIM_CMD_P_ALIAS PURPLE_CMD_P_ALIAS -#define GAIM_CMD_P_HIGH PURPLE_CMD_P_HIGH -#define GAIM_CMD_P_VERY_HIGH PURPLE_CMD_P_VERY_HIGH - -#define GAIM_CMD_FLAG_IM PURPLE_CMD_FLAG_IM -#define GAIM_CMD_FLAG_CHAT PURPLE_CMD_FLAG_CHAT -#define GAIM_CMD_FLAG_PRPL_ONLY PURPLE_CMD_FLAG_PRPL_ONLY -#define GAIM_CMD_FLAG_ALLOW_WRONG_ARGS PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS - - -#define GaimCmdFunc PurpleCmdFunc - -#define GaimCmdId PurpleCmdId - -#define gaim_cmd_register purple_cmd_register -#define gaim_cmd_unregister purple_cmd_unregister -#define gaim_cmd_do_command purple_cmd_do_command -#define gaim_cmd_list purple_cmd_list -#define gaim_cmd_help purple_cmd_help - -/* from connection.h */ - -#define GaimConnection PurpleConnection - -#define GAIM_CONNECTION_HTML PURPLE_CONNECTION_HTML -#define GAIM_CONNECTION_NO_BGCOLOR PURPLE_CONNECTION_NO_BGCOLOR -#define GAIM_CONNECTION_AUTO_RESP PURPLE_CONNECTION_AUTO_RESP -#define GAIM_CONNECTION_FORMATTING_WBFO PURPLE_CONNECTION_FORMATTING_WBFO -#define GAIM_CONNECTION_NO_NEWLINES PURPLE_CONNECTION_NO_NEWLINES -#define GAIM_CONNECTION_NO_FONTSIZE PURPLE_CONNECTION_NO_FONTSIZE -#define GAIM_CONNECTION_NO_URLDESC PURPLE_CONNECTION_NO_URLDESC -#define GAIM_CONNECTION_NO_IMAGES PURPLE_CONNECTION_NO_IMAGES - -#define GaimConnectionFlags PurpleConnectionFlags - -#define GAIM_DISCONNECTED PURPLE_DISCONNECTED -#define GAIM_CONNECTED PURPLE_CONNECTED -#define GAIM_CONNECTING PURPLE_CONNECTING - -#define GaimConnectionState PurpleConnectionState - -#define GaimConnectionUiOps PurpleConnectionUiOps - -#define gaim_connection_new purple_connection_new -#define gaim_connection_destroy purple_connection_destroy - -#define gaim_connection_set_state purple_connection_set_state -#define gaim_connection_set_account purple_connection_set_account -#define gaim_connection_set_display_name purple_connection_set_display_name -#define gaim_connection_get_state purple_connection_get_state - -#define GAIM_CONNECTION_IS_CONNECTED PURPLE_CONNECTION_IS_CONNECTED - -#define gaim_connection_get_account purple_connection_get_account -#define gaim_connection_get_password purple_connection_get_password -#define gaim_connection_get_display_name purple_connection_get_display_name - -#define gaim_connection_update_progress purple_connection_update_progress - -#define gaim_connection_notice purple_connection_notice -#define gaim_connection_error purple_connection_error - -#define gaim_connections_disconnect_all purple_connections_disconnect_all - -#define gaim_connections_get_all purple_connections_get_all -#define gaim_connections_get_connecting purple_connections_get_connecting - -#define GAIM_CONNECTION_IS_VALID PURPLE_CONNECTION_IS_VALID - -#define gaim_connections_set_ui_ops purple_connections_set_ui_ops -#define gaim_connections_get_ui_ops purple_connections_get_ui_ops - -#define gaim_connections_init purple_connections_init -#define gaim_connections_uninit purple_connections_uninit -#define gaim_connections_get_handle purple_connections_get_handle - - -/* from conversation.h */ - -#define GaimConversationUiOps PurpleConversationUiOps -#define GaimConversation PurpleConversation -#define GaimConvIm PurpleConvIm -#define GaimConvChat PurpleConvChat -#define GaimConvChatBuddy PurpleConvChatBuddy - -#define GAIM_CONV_TYPE_UNKNOWN PURPLE_CONV_TYPE_UNKNOWN -#define GAIM_CONV_TYPE_IM PURPLE_CONV_TYPE_IM -#define GAIM_CONV_TYPE_CHAT PURPLE_CONV_TYPE_CHAT -#define GAIM_CONV_TYPE_MISC PURPLE_CONV_TYPE_MISC -#define GAIM_CONV_TYPE_ANY PURPLE_CONV_TYPE_ANY - -#define GaimConversationType PurpleConversationType - -#define GAIM_CONV_UPDATE_ADD PURPLE_CONV_UPDATE_ADD -#define GAIM_CONV_UPDATE_REMOVE PURPLE_CONV_UPDATE_REMOVE -#define GAIM_CONV_UPDATE_ACCOUNT PURPLE_CONV_UPDATE_ACCOUNT -#define GAIM_CONV_UPDATE_TYPING PURPLE_CONV_UPDATE_TYPING -#define GAIM_CONV_UPDATE_UNSEEN PURPLE_CONV_UPDATE_UNSEEN -#define GAIM_CONV_UPDATE_LOGGING PURPLE_CONV_UPDATE_LOGGING -#define GAIM_CONV_UPDATE_TOPIC PURPLE_CONV_UPDATE_TOPIC -#define GAIM_CONV_ACCOUNT_ONLINE PURPLE_CONV_ACCOUNT_ONLINE -#define GAIM_CONV_ACCOUNT_OFFLINE PURPLE_CONV_ACCOUNT_OFFLINE -#define GAIM_CONV_UPDATE_AWAY PURPLE_CONV_UPDATE_AWAY -#define GAIM_CONV_UPDATE_ICON PURPLE_CONV_UPDATE_ICON -#define GAIM_CONV_UPDATE_TITLE PURPLE_CONV_UPDATE_TITLE -#define GAIM_CONV_UPDATE_CHATLEFT PURPLE_CONV_UPDATE_CHATLEFT -#define GAIM_CONV_UPDATE_FEATURES PURPLE_CONV_UPDATE_FEATURES - -#define GaimConvUpdateType PurpleConvUpdateType - -#define GAIM_NOT_TYPING PURPLE_NOT_TYPING -#define GAIM_TYPING PURPLE_TYPING -#define GAIM_TYPED PURPLE_TYPED - -#define GaimTypingState PurpleTypingState - -#define GAIM_MESSAGE_SEND PURPLE_MESSAGE_SEND -#define GAIM_MESSAGE_RECV PURPLE_MESSAGE_RECV -#define GAIM_MESSAGE_SYSTEM PURPLE_MESSAGE_SYSTEM -#define GAIM_MESSAGE_AUTO_RESP PURPLE_MESSAGE_AUTO_RESP -#define GAIM_MESSAGE_ACTIVE_ONLY PURPLE_MESSAGE_ACTIVE_ONLY -#define GAIM_MESSAGE_NICK PURPLE_MESSAGE_NICK -#define GAIM_MESSAGE_NO_LOG PURPLE_MESSAGE_NO_LOG -#define GAIM_MESSAGE_WHISPER PURPLE_MESSAGE_WHISPER -#define GAIM_MESSAGE_ERROR PURPLE_MESSAGE_ERROR -#define GAIM_MESSAGE_DELAYED PURPLE_MESSAGE_DELAYED -#define GAIM_MESSAGE_RAW PURPLE_MESSAGE_RAW -#define GAIM_MESSAGE_IMAGES PURPLE_MESSAGE_IMAGES - -#define GaimMessageFlags PurpleMessageFlags - -#define GAIM_CBFLAGS_NONE PURPLE_CBFLAGS_NONE -#define GAIM_CBFLAGS_VOICE PURPLE_CBFLAGS_VOICE -#define GAIM_CBFLAGS_HALFOP PURPLE_CBFLAGS_HALFOP -#define GAIM_CBFLAGS_OP PURPLE_CBFLAGS_OP -#define GAIM_CBFLAGS_FOUNDER PURPLE_CBFLAGS_FOUNDER -#define GAIM_CBFLAGS_TYPING PURPLE_CBFLAGS_TYPING - -#define GaimConvChatBuddyFlags PurpleConvChatBuddyFlags - -#define gaim_conversations_set_ui_ops purple_conversations_set_ui_ops - -#define gaim_conversation_new purple_conversation_new -#define gaim_conversation_destroy purple_conversation_destroy -#define gaim_conversation_present purple_conversation_present -#define gaim_conversation_get_type purple_conversation_get_type -#define gaim_conversation_set_ui_ops purple_conversation_set_ui_ops -#define gaim_conversation_get_ui_ops purple_conversation_get_ui_ops -#define gaim_conversation_set_account purple_conversation_set_account -#define gaim_conversation_get_account purple_conversation_get_account -#define gaim_conversation_get_gc purple_conversation_get_gc -#define gaim_conversation_set_title purple_conversation_set_title -#define gaim_conversation_get_title purple_conversation_get_title -#define gaim_conversation_autoset_title purple_conversation_autoset_title -#define gaim_conversation_set_name purple_conversation_set_name -#define gaim_conversation_get_name purple_conversation_get_name -#define gaim_conversation_set_logging purple_conversation_set_logging -#define gaim_conversation_is_logging purple_conversation_is_logging -#define gaim_conversation_close_logs purple_conversation_close_logs -#define gaim_conversation_get_im_data purple_conversation_get_im_data - -#define GAIM_CONV_IM PURPLE_CONV_IM - -#define gaim_conversation_get_chat_data purple_conversation_get_chat_data - -#define GAIM_CONV_CHAT PURPLE_CONV_CHAT - -#define gaim_conversation_set_data purple_conversation_set_data -#define gaim_conversation_get_data purple_conversation_get_data - -#define gaim_get_conversations purple_get_conversations -#define gaim_get_ims purple_get_ims -#define gaim_get_chats purple_get_chats - -#define gaim_find_conversation_with_account \ - purple_find_conversation_with_account - -#define gaim_conversation_write purple_conversation_write -#define gaim_conversation_set_features purple_conversation_set_features -#define gaim_conversation_get_features purple_conversation_get_features -#define gaim_conversation_has_focus purple_conversation_has_focus -#define gaim_conversation_update purple_conversation_update -#define gaim_conversation_foreach purple_conversation_foreach - -#define gaim_conv_im_get_conversation purple_conv_im_get_conversation -#define gaim_conv_im_set_icon purple_conv_im_set_icon -#define gaim_conv_im_get_icon purple_conv_im_get_icon -#define gaim_conv_im_set_typing_state purple_conv_im_set_typing_state -#define gaim_conv_im_get_typing_state purple_conv_im_get_typing_state - -#define gaim_conv_im_start_typing_timeout purple_conv_im_start_typing_timeout -#define gaim_conv_im_stop_typing_timeout purple_conv_im_stop_typing_timeout -#define gaim_conv_im_get_typing_timeout purple_conv_im_get_typing_timeout -#define gaim_conv_im_set_type_again purple_conv_im_set_type_again -#define gaim_conv_im_get_type_again purple_conv_im_get_type_again - -#define gaim_conv_im_start_send_typed_timeout \ - purple_conv_im_start_send_typed_timeout - -#define gaim_conv_im_stop_send_typed_timeout \ - purple_conv_im_stop_send_typed_timeout - -#define gaim_conv_im_get_send_typed_timeout \ - purple_conv_im_get_send_typed_timeout - -#define gaim_conv_present_error purple_conv_present_error -#define gaim_conv_send_confirm purple_conv_send_confirm - -#define gaim_conv_im_update_typing purple_conv_im_update_typing -#define gaim_conv_im_write purple_conv_im_write -#define gaim_conv_im_send purple_conv_im_send -#define gaim_conv_im_send_with_flags purple_conv_im_send_with_flags - -#define gaim_conv_custom_smiley_add purple_conv_custom_smiley_add -#define gaim_conv_custom_smiley_write purple_conv_custom_smiley_write -#define gaim_conv_custom_smiley_close purple_conv_custom_smiley_close - -#define gaim_conv_chat_get_conversation purple_conv_chat_get_conversation -#define gaim_conv_chat_set_users purple_conv_chat_set_users -#define gaim_conv_chat_get_users purple_conv_chat_get_users -#define gaim_conv_chat_ignore purple_conv_chat_ignore -#define gaim_conv_chat_unignore purple_conv_chat_unignore -#define gaim_conv_chat_set_ignored purple_conv_chat_set_ignored -#define gaim_conv_chat_get_ignored purple_conv_chat_get_ignored -#define gaim_conv_chat_get_ignored_user purple_conv_chat_get_ignored_user -#define gaim_conv_chat_is_user_ignored purple_conv_chat_is_user_ignored -#define gaim_conv_chat_set_topic purple_conv_chat_set_topic -#define gaim_conv_chat_get_topic purple_conv_chat_get_topic -#define gaim_conv_chat_set_id purple_conv_chat_set_id -#define gaim_conv_chat_get_id purple_conv_chat_get_id -#define gaim_conv_chat_write purple_conv_chat_write -#define gaim_conv_chat_send purple_conv_chat_send -#define gaim_conv_chat_send_with_flags purple_conv_chat_send_with_flags -#define gaim_conv_chat_add_user purple_conv_chat_add_user -#define gaim_conv_chat_add_users purple_conv_chat_add_users -#define gaim_conv_chat_rename_user purple_conv_chat_rename_user -#define gaim_conv_chat_remove_user purple_conv_chat_remove_user -#define gaim_conv_chat_remove_users purple_conv_chat_remove_users -#define gaim_conv_chat_find_user purple_conv_chat_find_user -#define gaim_conv_chat_user_set_flags purple_conv_chat_user_set_flags -#define gaim_conv_chat_user_get_flags purple_conv_chat_user_get_flags -#define gaim_conv_chat_clear_users purple_conv_chat_clear_users -#define gaim_conv_chat_set_nick purple_conv_chat_set_nick -#define gaim_conv_chat_get_nick purple_conv_chat_get_nick -#define gaim_conv_chat_left purple_conv_chat_left -#define gaim_conv_chat_has_left purple_conv_chat_has_left - -#define gaim_find_chat purple_find_chat - -#define gaim_conv_chat_cb_new purple_conv_chat_cb_new -#define gaim_conv_chat_cb_find purple_conv_chat_cb_find -#define gaim_conv_chat_cb_get_name purple_conv_chat_cb_get_name -#define gaim_conv_chat_cb_destroy purple_conv_chat_cb_destroy - -#define gaim_conversations_get_handle purple_conversations_get_handle -#define gaim_conversations_init purple_conversations_init -#define gaim_conversations_uninit purple_conversations_uninit - -/* from core.h */ - -#define GaimCore PurpleCore - -#define GaimCoreUiOps PurpleCoreUiOps - -#define gaim_core_init purple_core_init -#define gaim_core_quit purple_core_quit - -#define gaim_core_quit_cb purple_core_quit_cb -#define gaim_core_get_version purple_core_get_version -#define gaim_core_get_ui purple_core_get_ui -#define gaim_get_core purple_get_core -#define gaim_core_set_ui_ops purple_core_set_ui_ops -#define gaim_core_get_ui_ops purple_core_get_ui_ops - -/* from debug.h */ - -#define GAIM_DEBUG_ALL PURPLE_DEBUG_ALL -#define GAIM_DEBUG_MISC PURPLE_DEBUG_MISC -#define GAIM_DEBUG_INFO PURPLE_DEBUG_INFO -#define GAIM_DEBUG_WARNING PURPLE_DEBUG_WARNING -#define GAIM_DEBUG_ERROR PURPLE_DEBUG_ERROR -#define GAIM_DEBUG_FATAL PURPLE_DEBUG_FATAL - -#define GaimDebugLevel PurpleDebugLevel - -#define GaimDebugUiOps PurpleDebugUiOps - - -#define gaim_debug purple_debug -#define gaim_debug_misc purple_debug_misc -#define gaim_debug_info purple_debug_info -#define gaim_debug_warning purple_debug_warning -#define gaim_debug_error purple_debug_error -#define gaim_debug_fatal purple_debug_fatal - -#define gaim_debug_set_enabled purple_debug_set_enabled -#define gaim_debug_is_enabled purple_debug_is_enabled - -#define gaim_debug_set_ui_ops purple_debug_set_ui_ops -#define gaim_debug_get_ui_ops purple_debug_get_ui_ops - -#define gaim_debug_init purple_debug_init - -/* from desktopitem.h */ - -#define GAIM_DESKTOP_ITEM_TYPE_NULL PURPLE_DESKTOP_ITEM_TYPE_NULL -#define GAIM_DESKTOP_ITEM_TYPE_OTHER PURPLE_DESKTOP_ITEM_TYPE_OTHER -#define GAIM_DESKTOP_ITEM_TYPE_APPLICATION PURPLE_DESKTOP_ITEM_TYPE_APPLICATION -#define GAIM_DESKTOP_ITEM_TYPE_LINK PURPLE_DESKTOP_ITEM_TYPE_LINK -#define GAIM_DESKTOP_ITEM_TYPE_FSDEVICE PURPLE_DESKTOP_ITEM_TYPE_FSDEVICE -#define GAIM_DESKTOP_ITEM_TYPE_MIME_TYPE PURPLE_DESKTOP_ITEM_TYPE_MIME_TYPE -#define GAIM_DESKTOP_ITEM_TYPE_DIRECTORY PURPLE_DESKTOP_ITEM_TYPE_DIRECTORY -#define GAIM_DESKTOP_ITEM_TYPE_SERVICE PURPLE_DESKTOP_ITEM_TYPE_SERVICE -#define GAIM_DESKTOP_ITEM_TYPE_SERVICE_TYPE PURPLE_DESKTOP_ITEM_TYPE_SERVICE_TYPE - -#define GaimDesktopItemType PurpleDesktopItemType - -#define GaimDesktopItem PurpleDesktopItem - -#define GAIM_TYPE_DESKTOP_ITEM PURPLE_TYPE_DESKTOP_ITEM -#define gaim_desktop_item_get_type purple_desktop_item_get_type - -/* standard */ -/* ugh, i'm just copying these as strings, rather than pidginifying them */ -#define GAIM_DESKTOP_ITEM_ENCODING "Encoding" /* string */ -#define GAIM_DESKTOP_ITEM_VERSION "Version" /* numeric */ -#define GAIM_DESKTOP_ITEM_NAME "Name" /* localestring */ -#define GAIM_DESKTOP_ITEM_GENERIC_NAME "GenericName" /* localestring */ -#define GAIM_DESKTOP_ITEM_TYPE "Type" /* string */ -#define GAIM_DESKTOP_ITEM_FILE_PATTERN "FilePattern" /* regexp(s) */ -#define GAIM_DESKTOP_ITEM_TRY_EXEC "TryExec" /* string */ -#define GAIM_DESKTOP_ITEM_NO_DISPLAY "NoDisplay" /* boolean */ -#define GAIM_DESKTOP_ITEM_COMMENT "Comment" /* localestring */ -#define GAIM_DESKTOP_ITEM_EXEC "Exec" /* string */ -#define GAIM_DESKTOP_ITEM_ACTIONS "Actions" /* strings */ -#define GAIM_DESKTOP_ITEM_ICON "Icon" /* string */ -#define GAIM_DESKTOP_ITEM_MINI_ICON "MiniIcon" /* string */ -#define GAIM_DESKTOP_ITEM_HIDDEN "Hidden" /* boolean */ -#define GAIM_DESKTOP_ITEM_PATH "Path" /* string */ -#define GAIM_DESKTOP_ITEM_TERMINAL "Terminal" /* boolean */ -#define GAIM_DESKTOP_ITEM_TERMINAL_OPTIONS "TerminalOptions" /* string */ -#define GAIM_DESKTOP_ITEM_SWALLOW_TITLE "SwallowTitle" /* string */ -#define GAIM_DESKTOP_ITEM_SWALLOW_EXEC "SwallowExec" /* string */ -#define GAIM_DESKTOP_ITEM_MIME_TYPE "MimeType" /* regexp(s) */ -#define GAIM_DESKTOP_ITEM_PATTERNS "Patterns" /* regexp(s) */ -#define GAIM_DESKTOP_ITEM_DEFAULT_APP "DefaultApp" /* string */ -#define GAIM_DESKTOP_ITEM_DEV "Dev" /* string */ -#define GAIM_DESKTOP_ITEM_FS_TYPE "FSType" /* string */ -#define GAIM_DESKTOP_ITEM_MOUNT_POINT "MountPoint" /* string */ -#define GAIM_DESKTOP_ITEM_READ_ONLY "ReadOnly" /* boolean */ -#define GAIM_DESKTOP_ITEM_UNMOUNT_ICON "UnmountIcon" /* string */ -#define GAIM_DESKTOP_ITEM_SORT_ORDER "SortOrder" /* strings */ -#define GAIM_DESKTOP_ITEM_URL "URL" /* string */ -#define GAIM_DESKTOP_ITEM_DOC_PATH "X-GNOME-DocPath" /* string */ - -#define gaim_desktop_item_new_from_file purple_desktop_item_new_from_file -#define gaim_desktop_item_get_entry_type purple_desktop_item_get_entry_type -#define gaim_desktop_item_get_string purple_desktop_item_get_string -#define gaim_desktop_item_copy purple_desktop_item_copy -#define gaim_desktop_item_unref purple_desktop_item_unref - -/* from dnsquery.h */ - -#define GaimDnsQueryData PurpleDnsQueryData -#define GaimDnsQueryConnectFunction PurpleDnsQueryConnectFunction - -#define gaim_dnsquery_a purple_dnsquery_a -#define gaim_dnsquery_destroy purple_dnsquery_destroy -#define gaim_dnsquery_init purple_dnsquery_init -#define gaim_dnsquery_uninit purple_dnsquery_uninit -#define gaim_dnsquery_set_ui_ops purple_dnsquery_set_ui_ops -#define gaim_dnsquery_get_host purple_dnsquery_get_host -#define gaim_dnsquery_get_port purple_dnsquery_get_port - -/* from dnssrv.h */ - -#define GaimSrvResponse PurpleSrvResponse -#define GaimSrvQueryData PurpleSrvQueryData -#define GaimSrvCallback PurpleSrvCallback - -#define gaim_srv_resolve purple_srv_resolve -#define gaim_srv_cancel purple_srv_cancel - -/* from eventloop.h */ - -#define GAIM_INPUT_READ PURPLE_INPUT_READ -#define GAIM_INPUT_WRITE PURPLE_INPUT_WRITE - -#define GaimInputCondition PurpleInputCondition -#define GaimInputFunction PurpleInputFunction -#define GaimEventLoopUiOps PurpleEventLoopUiOps - -#define gaim_timeout_add purple_timeout_add -#define gaim_timeout_remove purple_timeout_remove -#define gaim_input_add purple_input_add -#define gaim_input_remove purple_input_remove - -#define gaim_eventloop_set_ui_ops purple_eventloop_set_ui_ops -#define gaim_eventloop_get_ui_ops purple_eventloop_get_ui_ops - -/* from ft.h */ - -#define GaimXfer PurpleXfer - -#define GAIM_XFER_UNKNOWN PURPLE_XFER_UNKNOWN -#define GAIM_XFER_SEND PURPLE_XFER_SEND -#define GAIM_XFER_RECEIVE PURPLE_XFER_RECEIVE - -#define GaimXferType PurpleXferType - -#define GAIM_XFER_STATUS_UNKNOWN PURPLE_XFER_STATUS_UNKNOWN -#define GAIM_XFER_STATUS_NOT_STARTED PURPLE_XFER_STATUS_NOT_STARTED -#define GAIM_XFER_STATUS_ACCEPTED PURPLE_XFER_STATUS_ACCEPTED -#define GAIM_XFER_STATUS_STARTED PURPLE_XFER_STATUS_STARTED -#define GAIM_XFER_STATUS_DONE PURPLE_XFER_STATUS_DONE -#define GAIM_XFER_STATUS_CANCEL_LOCAL PURPLE_XFER_STATUS_CANCEL_LOCAL -#define GAIM_XFER_STATUS_CANCEL_REMOTE PURPLE_XFER_STATUS_CANCEL_REMOTE - -#define GaimXferStatusType PurpleXferStatusType - -#define GaimXferUiOps PurpleXferUiOps - -#define gaim_xfer_new purple_xfer_new -#define gaim_xfer_ref purple_xfer_ref -#define gaim_xfer_unref purple_xfer_unref -#define gaim_xfer_request purple_xfer_request -#define gaim_xfer_request_accepted purple_xfer_request_accepted -#define gaim_xfer_request_denied purple_xfer_request_denied -#define gaim_xfer_get_type purple_xfer_get_type -#define gaim_xfer_get_account purple_xfer_get_account -#define gaim_xfer_get_status purple_xfer_get_status -#define gaim_xfer_is_canceled purple_xfer_is_canceled -#define gaim_xfer_is_completed purple_xfer_is_completed -#define gaim_xfer_get_filename purple_xfer_get_filename -#define gaim_xfer_get_local_filename purple_xfer_get_local_filename -#define gaim_xfer_get_bytes_sent purple_xfer_get_bytes_sent -#define gaim_xfer_get_bytes_remaining purple_xfer_get_bytes_remaining -#define gaim_xfer_get_size purple_xfer_get_size -#define gaim_xfer_get_progress purple_xfer_get_progress -#define gaim_xfer_get_local_port purple_xfer_get_local_port -#define gaim_xfer_get_remote_ip purple_xfer_get_remote_ip -#define gaim_xfer_get_remote_port purple_xfer_get_remote_port -#define gaim_xfer_set_completed purple_xfer_set_completed -#define gaim_xfer_set_message purple_xfer_set_message -#define gaim_xfer_set_filename purple_xfer_set_filename -#define gaim_xfer_set_local_filename purple_xfer_set_local_filename -#define gaim_xfer_set_size purple_xfer_set_size -#define gaim_xfer_set_bytes_sent purple_xfer_set_bytes_sent -#define gaim_xfer_get_ui_ops purple_xfer_get_ui_ops -#define gaim_xfer_set_read_fnc purple_xfer_set_read_fnc -#define gaim_xfer_set_write_fnc purple_xfer_set_write_fnc -#define gaim_xfer_set_ack_fnc purple_xfer_set_ack_fnc -#define gaim_xfer_set_request_denied_fnc purple_xfer_set_request_denied_fnc -#define gaim_xfer_set_init_fnc purple_xfer_set_init_fnc -#define gaim_xfer_set_start_fnc purple_xfer_set_start_fnc -#define gaim_xfer_set_end_fnc purple_xfer_set_end_fnc -#define gaim_xfer_set_cancel_send_fnc purple_xfer_set_cancel_send_fnc -#define gaim_xfer_set_cancel_recv_fnc purple_xfer_set_cancel_recv_fnc - -#define gaim_xfer_read purple_xfer_read -#define gaim_xfer_write purple_xfer_write -#define gaim_xfer_start purple_xfer_start -#define gaim_xfer_end purple_xfer_end -#define gaim_xfer_add purple_xfer_add -#define gaim_xfer_cancel_local purple_xfer_cancel_local -#define gaim_xfer_cancel_remote purple_xfer_cancel_remote -#define gaim_xfer_error purple_xfer_error -#define gaim_xfer_update_progress purple_xfer_update_progress -#define gaim_xfer_conversation_write purple_xfer_conversation_write - -#define gaim_xfers_get_handle purple_xfers_get_handle -#define gaim_xfers_init purple_xfers_init -#define gaim_xfers_uninit purple_xfers_uninit -#define gaim_xfers_set_ui_ops purple_xfers_set_ui_ops -#define gaim_xfers_get_ui_ops purple_xfers_get_ui_ops - -/* from gaim-client.h */ - -#define gaim_init purple_init - -/* from idle.h */ - -#define GaimIdleUiOps PurpleIdleUiOps - -#define gaim_idle_touch purple_idle_touch -#define gaim_idle_set purple_idle_set -#define gaim_idle_set_ui_ops purple_idle_set_ui_ops -#define gaim_idle_get_ui_ops purple_idle_get_ui_ops -#define gaim_idle_init purple_idle_init -#define gaim_idle_uninit purple_idle_uninit - -/* from imgstore.h */ - -#define GaimStoredImage PurpleStoredImage - -#define gaim_imgstore_add(data, size, filename) \ - purple_imgstore_add_with_id(g_memdup(data, size), size, filename) -#define gaim_imgstore_get purple_imgstore_find_by_id -#define gaim_imgstore_get_data purple_imgstore_get_data -#define gaim_imgstore_get_size purple_imgstore_get_size -#define gaim_imgstore_get_filename purple_imgstore_get_filename -#define gaim_imgstore_ref purple_imgstore_ref_by_id -#define gaim_imgstore_unref purple_imgstore_unref_by_id - - -/* from log.h */ - -#define GaimLog PurpleLog -#define GaimLogLogger PurpleLogLogger -#define GaimLogCommonLoggerData PurpleLogCommonLoggerData -#define GaimLogSet PurpleLogSet - -#define GAIM_LOG_IM PURPLE_LOG_IM -#define GAIM_LOG_CHAT PURPLE_LOG_CHAT -#define GAIM_LOG_SYSTEM PURPLE_LOG_SYSTEM - -#define GaimLogType PurpleLogType - -#define GAIM_LOG_READ_NO_NEWLINE PURPLE_LOG_READ_NO_NEWLINE - -#define GaimLogReadFlags PurpleLogReadFlags - -#define GaimLogSetCallback PurpleLogSetCallback - -#define gaim_log_new purple_log_new -#define gaim_log_free purple_log_free -#define gaim_log_write purple_log_write -#define gaim_log_read purple_log_read - -#define gaim_log_get_logs purple_log_get_logs -#define gaim_log_get_log_sets purple_log_get_log_sets -#define gaim_log_get_system_logs purple_log_get_system_logs -#define gaim_log_get_size purple_log_get_size -#define gaim_log_get_total_size purple_log_get_total_size -#define gaim_log_get_log_dir purple_log_get_log_dir -#define gaim_log_compare purple_log_compare -#define gaim_log_set_compare purple_log_set_compare -#define gaim_log_set_free purple_log_set_free - -#define gaim_log_common_writer purple_log_common_writer -#define gaim_log_common_lister purple_log_common_lister -#define gaim_log_common_total_sizer purple_log_common_total_sizer -#define gaim_log_common_sizer purple_log_common_sizer - -#define gaim_log_logger_new purple_log_logger_new -#define gaim_log_logger_free purple_log_logger_free -#define gaim_log_logger_add purple_log_logger_add -#define gaim_log_logger_remove purple_log_logger_remove -#define gaim_log_logger_set purple_log_logger_set -#define gaim_log_logger_get purple_log_logger_get - -#define gaim_log_logger_get_options purple_log_logger_get_options - -#define gaim_log_init purple_log_init -#define gaim_log_get_handle purple_log_get_handle -#define gaim_log_uninit purple_log_uninit - -/* from mime.h */ - -#define GaimMimeDocument PurpleMimeDocument -#define GaimMimePart PurpleMimePart - -#define gaim_mime_document_new purple_mime_document_new -#define gaim_mime_document_free purple_mime_document_free -#define gaim_mime_document_parse purple_mime_document_parse -#define gaim_mime_document_parsen purple_mime_document_parsen -#define gaim_mime_document_write purple_mime_document_write -#define gaim_mime_document_get_fields purple_mime_document_get_fields -#define gaim_mime_document_get_field purple_mime_document_get_field -#define gaim_mime_document_set_field purple_mime_document_set_field -#define gaim_mime_document_get_parts purple_mime_document_get_parts - -#define gaim_mime_part_new purple_mime_part_new -#define gaim_mime_part_get_fields purple_mime_part_get_fields -#define gaim_mime_part_get_field purple_mime_part_get_field -#define gaim_mime_part_get_field_decoded purple_mime_part_get_field_decoded -#define gaim_mime_part_set_field purple_mime_part_set_field -#define gaim_mime_part_get_data purple_mime_part_get_data -#define gaim_mime_part_get_data_decoded purple_mime_part_get_data_decoded -#define gaim_mime_part_get_length purple_mime_part_get_length -#define gaim_mime_part_set_data purple_mime_part_set_data - - -/* from network.h */ - -#define GaimNetworkListenData PurpleNetworkListenData - -#define GaimNetworkListenCallback PurpleNetworkListenCallback - -#define gaim_network_ip_atoi purple_network_ip_atoi -#define gaim_network_set_public_ip purple_network_set_public_ip -#define gaim_network_get_public_ip purple_network_get_public_ip -#define gaim_network_get_local_system_ip purple_network_get_local_system_ip -#define gaim_network_get_my_ip purple_network_get_my_ip - -#define gaim_network_listen purple_network_listen -#define gaim_network_listen_range purple_network_listen_range -#define gaim_network_listen_cancel purple_network_listen_cancel -#define gaim_network_get_port_from_fd purple_network_get_port_from_fd - -#define gaim_network_is_available purple_network_is_available - -#define gaim_network_init purple_network_init -#define gaim_network_uninit purple_network_uninit - -/* from notify.h */ - - -#define GaimNotifyUserInfoEntry PurpleNotifyUserInfoEntry -#define GaimNotifyUserInfo PurpleNotifyUserInfo - -#define GaimNotifyCloseCallback PurpleNotifyCloseCallback - -#define GAIM_NOTIFY_MESSAGE PURPLE_NOTIFY_MESSAGE -#define GAIM_NOTIFY_EMAIL PURPLE_NOTIFY_EMAIL -#define GAIM_NOTIFY_EMAILS PURPLE_NOTIFY_EMAILS -#define GAIM_NOTIFY_FORMATTED PURPLE_NOTIFY_FORMATTED -#define GAIM_NOTIFY_SEARCHRESULTS PURPLE_NOTIFY_SEARCHRESULTS -#define GAIM_NOTIFY_USERINFO PURPLE_NOTIFY_USERINFO -#define GAIM_NOTIFY_URI PURPLE_NOTIFY_URI - -#define GaimNotifyType PurpleNotifyType - -#define GAIM_NOTIFY_MSG_ERROR PURPLE_NOTIFY_MSG_ERROR -#define GAIM_NOTIFY_MSG_WARNING PURPLE_NOTIFY_MSG_WARNING -#define GAIM_NOTIFY_MSG_INFO PURPLE_NOTIFY_MSG_INFO - -#define GaimNotifyMsgType PurpleNotifyMsgType - -#define GAIM_NOTIFY_BUTTON_LABELED PURPLE_NOTIFY_BUTTON_LABELED -#define GAIM_NOTIFY_BUTTON_CONTINUE PURPLE_NOTIFY_BUTTON_CONTINUE -#define GAIM_NOTIFY_BUTTON_ADD PURPLE_NOTIFY_BUTTON_ADD -#define GAIM_NOTIFY_BUTTON_INFO PURPLE_NOTIFY_BUTTON_INFO -#define GAIM_NOTIFY_BUTTON_IM PURPLE_NOTIFY_BUTTON_IM -#define GAIM_NOTIFY_BUTTON_JOIN PURPLE_NOTIFY_BUTTON_JOIN -#define GAIM_NOTIFY_BUTTON_INVITE PURPLE_NOTIFY_BUTTON_INVITE - -#define GaimNotifySearchButtonType PurpleNotifySearchButtonType - -#define GaimNotifySearchResults PurpleNotifySearchResults - -#define GAIM_NOTIFY_USER_INFO_ENTRY_PAIR PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR -#define GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK -#define GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER - -#define GaimNotifyUserInfoEntryType PurpleNotifyUserInfoEntryType - -#define GaimNotifySearchColumn PurpleNotifySearchColumn -#define GaimNotifySearchResultsCallback PurpleNotifySearchResultsCallback -#define GaimNotifySearchButton PurpleNotifySearchButton - -#define GaimNotifyUiOps PurpleNotifyUiOps - -#define gaim_notify_searchresults purple_notify_searchresults -#define gaim_notify_searchresults_free purple_notify_searchresults_free -#define gaim_notify_searchresults_new_rows purple_notify_searchresults_new_rows -#define gaim_notify_searchresults_button_add purple_notify_searchresults_button_add -#define gaim_notify_searchresults_button_add_labeled purple_notify_searchresults_button_add_labeled -#define gaim_notify_searchresults_new purple_notify_searchresults_new -#define gaim_notify_searchresults_column_new purple_notify_searchresults_column_new -#define gaim_notify_searchresults_column_add purple_notify_searchresults_column_add -#define gaim_notify_searchresults_row_add purple_notify_searchresults_row_add -#define gaim_notify_searchresults_get_rows_count purple_notify_searchresults_get_rows_count -#define gaim_notify_searchresults_get_columns_count purple_notify_searchresults_get_columns_count -#define gaim_notify_searchresults_row_get purple_notify_searchresults_row_get -#define gaim_notify_searchresults_column_get_title purple_notify_searchresults_column_get_title - -#define gaim_notify_message purple_notify_message -#define gaim_notify_email purple_notify_email -#define gaim_notify_emails purple_notify_emails -#define gaim_notify_formatted purple_notify_formatted -#define gaim_notify_userinfo purple_notify_userinfo - -#define gaim_notify_user_info_new purple_notify_user_info_new -#define gaim_notify_user_info_destroy purple_notify_user_info_destroy -#define gaim_notify_user_info_get_entries purple_notify_user_info_get_entries -#define gaim_notify_user_info_get_text_with_newline purple_notify_user_info_get_text_with_newline -#define gaim_notify_user_info_add_pair purple_notify_user_info_add_pair -#define gaim_notify_user_info_prepend_pair purple_notify_user_info_prepend_pair -#define gaim_notify_user_info_remove_entry purple_notify_user_info_remove_entry -#define gaim_notify_user_info_entry_new purple_notify_user_info_entry_new -#define gaim_notify_user_info_add_section_break purple_notify_user_info_add_section_break -#define gaim_notify_user_info_add_section_header purple_notify_user_info_add_section_header -#define gaim_notify_user_info_remove_last_item purple_notify_user_info_remove_last_item -#define gaim_notify_user_info_entry_get_label purple_notify_user_info_entry_get_label -#define gaim_notify_user_info_entry_set_label purple_notify_user_info_entry_set_label -#define gaim_notify_user_info_entry_get_value purple_notify_user_info_entry_get_value -#define gaim_notify_user_info_entry_set_value purple_notify_user_info_entry_set_value -#define gaim_notify_user_info_entry_get_type purple_notify_user_info_entry_get_type -#define gaim_notify_user_info_entry_set_type purple_notify_user_info_entry_set_type - -#define gaim_notify_uri purple_notify_uri -#define gaim_notify_close purple_notify_close -#define gaim_notify_close_with_handle purple_notify_close_with_handle - -#define gaim_notify_info purple_notify_info -#define gaim_notify_warning purple_notify_warning -#define gaim_notify_error purple_notify_error - -#define gaim_notify_set_ui_ops purple_notify_set_ui_ops -#define gaim_notify_get_ui_ops purple_notify_get_ui_ops - -#define gaim_notify_get_handle purple_notify_get_handle - -#define gaim_notify_init purple_notify_init -#define gaim_notify_uninit purple_notify_uninit - -/* from ntlm.h */ - -#define gaim_ntlm_gen_type1 purple_ntlm_gen_type1 -#define gaim_ntlm_parse_type2 purple_ntlm_parse_type2 -#define gaim_ntlm_gen_type3 purple_ntlm_gen_type3 - -/* from plugin.h */ - -#ifdef GAIM_PLUGINS -#ifndef PURPLE_PLUGINS -#define PURPLE_PLUGINS -#endif -#endif - -#define GaimPlugin PurplePlugin -#define GaimPluginInfo PurplePluginInfo -#define GaimPluginUiInfo PurplePluginUiInfo -#define GaimPluginLoaderInfo PurplePluginLoaderInfo -#define GaimPluginAction PurplePluginAction -#define GaimPluginPriority PurplePluginPriority - -#define GAIM_PLUGIN_UNKNOWN PURPLE_PLUGIN_UNKNOWN -#define GAIM_PLUGIN_STANDARD PURPLE_PLUGIN_STANDARD -#define GAIM_PLUGIN_LOADER PURPLE_PLUGIN_LOADER -#define GAIM_PLUGIN_PROTOCOL PURPLE_PLUGIN_PROTOCOL - -#define GaimPluginType PurplePluginType - -#define GAIM_PRIORITY_DEFAULT PURPLE_PRIORITY_DEFAULT -#define GAIM_PRIORITY_HIGHEST PURPLE_PRIORITY_HIGHEST -#define GAIM_PRIORITY_LOWEST PURPLE_PRIORITY_LOWEST - -#define GAIM_PLUGIN_FLAG_INVISIBLE PURPLE_PLUGIN_FLAG_INVISIBLE - -#define GAIM_PLUGIN_MAGIC PURPLE_PLUGIN_MAGIC - -#define GAIM_PLUGIN_LOADER_INFO PURPLE_PLUGIN_LOADER_INFO -#define GAIM_PLUGIN_HAS_PREF_FRAME PURPLE_PLUGIN_HAS_PREF_FRAME -#define GAIM_PLUGIN_UI_INFO PURPLE_PLUGIN_UI_INFO - -#define GAIM_PLUGIN_HAS_ACTIONS PURPLE_PLUGIN_HAS_ACTIONS -#define GAIM_PLUGIN_ACTIONS PURPLE_PLUGIN_ACTIONS - -#define GAIM_INIT_PLUGIN PURPLE_INIT_PLUGIN - -#define gaim_plugin_new purple_plugin_new -#define gaim_plugin_probe purple_plugin_probe -#define gaim_plugin_register purple_plugin_register -#define gaim_plugin_load purple_plugin_load -#define gaim_plugin_unload purple_plugin_unload -#define gaim_plugin_reload purple_plugin_reload -#define gaim_plugin_destroy purple_plugin_destroy -#define gaim_plugin_is_loaded purple_plugin_is_loaded -#define gaim_plugin_is_unloadable purple_plugin_is_unloadable -#define gaim_plugin_get_id purple_plugin_get_id -#define gaim_plugin_get_name purple_plugin_get_name -#define gaim_plugin_get_version purple_plugin_get_version -#define gaim_plugin_get_summary purple_plugin_get_summary -#define gaim_plugin_get_description purple_plugin_get_description -#define gaim_plugin_get_author purple_plugin_get_author -#define gaim_plugin_get_homepage purple_plugin_get_homepage - -#define gaim_plugin_ipc_register purple_plugin_ipc_register -#define gaim_plugin_ipc_unregister purple_plugin_ipc_unregister -#define gaim_plugin_ipc_unregister_all purple_plugin_ipc_unregister_all -#define gaim_plugin_ipc_get_params purple_plugin_ipc_get_params -#define gaim_plugin_ipc_call purple_plugin_ipc_call - -#define gaim_plugins_add_search_path purple_plugins_add_search_path -#define gaim_plugins_unload_all purple_plugins_unload_all -#define gaim_plugins_destroy_all purple_plugins_destroy_all -#define gaim_plugins_save_loaded purple_plugins_save_loaded -#define gaim_plugins_load_saved purple_plugins_load_saved -#define gaim_plugins_probe purple_plugins_probe -#define gaim_plugins_enabled purple_plugins_enabled - -#define gaim_plugins_register_probe_notify_cb purple_plugins_register_probe_notify_cb -#define gaim_plugins_unregister_probe_notify_cb purple_plugins_unregister_probe_notify_cb -#define gaim_plugins_register_load_notify_cb purple_plugins_register_load_notify_cb -#define gaim_plugins_unregister_load_notify_cb purple_plugins_unregister_load_notify_cb -#define gaim_plugins_register_unload_notify_cb purple_plugins_register_unload_notify_cb -#define gaim_plugins_unregister_unload_notify_cb purple_plugins_unregister_unload_notify_cb - -#define gaim_plugins_find_with_name purple_plugins_find_with_name -#define gaim_plugins_find_with_filename purple_plugins_find_with_filename -#define gaim_plugins_find_with_basename purple_plugins_find_with_basename -#define gaim_plugins_find_with_id purple_plugins_find_with_id - -#define gaim_plugins_get_loaded purple_plugins_get_loaded -#define gaim_plugins_get_protocols purple_plugins_get_protocols -#define gaim_plugins_get_all purple_plugins_get_all - -#define gaim_plugins_get_handle purple_plugins_get_handle -#define gaim_plugins_init purple_plugins_init -#define gaim_plugins_uninit purple_plugins_uninit - -#define gaim_plugin_action_new purple_plugin_action_new -#define gaim_plugin_action_free purple_plugin_action_free - -/* pluginpref.h */ - -#define GaimPluginPrefFrame PurplePluginPrefFrame -#define GaimPluginPref PurplePluginPref - -#define GAIM_STRING_FORMAT_TYPE_NONE PURPLE_STRING_FORMAT_TYPE_NONE -#define GAIM_STRING_FORMAT_TYPE_MULTILINE PURPLE_STRING_FORMAT_TYPE_MULTILINE -#define GAIM_STRING_FORMAT_TYPE_HTML PURPLE_STRING_FORMAT_TYPE_HTML - -#define GaimStringFormatType PurpleStringFormatType - -#define GAIM_PLUGIN_PREF_NONE PURPLE_PLUGIN_PREF_NONE -#define GAIM_PLUGIN_PREF_CHOICE PURPLE_PLUGIN_PREF_CHOICE -#define GAIM_PLUGIN_PREF_INFO PURPLE_PLUGIN_PREF_INFO -#define GAIM_PLUGIN_PREF_STRING_FORMAT PURPLE_PLUGIN_PREF_STRING_FORMAT - -#define GaimPluginPrefType PurplePluginPrefType - -#define gaim_plugin_pref_frame_new purple_plugin_pref_frame_new -#define gaim_plugin_pref_frame_destroy purple_plugin_pref_frame_destroy -#define gaim_plugin_pref_frame_add purple_plugin_pref_frame_add -#define gaim_plugin_pref_frame_get_prefs purple_plugin_pref_frame_get_prefs - -#define gaim_plugin_pref_new purple_plugin_pref_new -#define gaim_plugin_pref_new_with_name purple_plugin_pref_new_with_name -#define gaim_plugin_pref_new_with_label purple_plugin_pref_new_with_label -#define gaim_plugin_pref_new_with_name_and_label purple_plugin_pref_new_with_name_and_label -#define gaim_plugin_pref_destroy purple_plugin_pref_destroy -#define gaim_plugin_pref_set_name purple_plugin_pref_set_name -#define gaim_plugin_pref_get_name purple_plugin_pref_get_name -#define gaim_plugin_pref_set_label purple_plugin_pref_set_label -#define gaim_plugin_pref_get_label purple_plugin_pref_get_label -#define gaim_plugin_pref_set_bounds purple_plugin_pref_set_bounds -#define gaim_plugin_pref_get_bounds purple_plugin_pref_get_bounds -#define gaim_plugin_pref_set_type purple_plugin_pref_set_type -#define gaim_plugin_pref_get_type purple_plugin_pref_get_type -#define gaim_plugin_pref_add_choice purple_plugin_pref_add_choice -#define gaim_plugin_pref_get_choices purple_plugin_pref_get_choices -#define gaim_plugin_pref_set_max_length purple_plugin_pref_set_max_length -#define gaim_plugin_pref_get_max_length purple_plugin_pref_get_max_length -#define gaim_plugin_pref_set_masked purple_plugin_pref_set_masked -#define gaim_plugin_pref_get_masked purple_plugin_pref_get_masked -#define gaim_plugin_pref_set_format_type purple_plugin_pref_set_format_type -#define gaim_plugin_pref_get_format_type purple_plugin_pref_get_format_type - -/* from pounce.h */ - -#define GaimPounce PurplePounce - -#define GAIM_POUNCE_NONE PURPLE_POUNCE_NONE -#define GAIM_POUNCE_SIGNON PURPLE_POUNCE_SIGNON -#define GAIM_POUNCE_SIGNOFF PURPLE_POUNCE_SIGNOFF -#define GAIM_POUNCE_AWAY PURPLE_POUNCE_AWAY -#define GAIM_POUNCE_AWAY_RETURN PURPLE_POUNCE_AWAY_RETURN -#define GAIM_POUNCE_IDLE PURPLE_POUNCE_IDLE -#define GAIM_POUNCE_IDLE_RETURN PURPLE_POUNCE_IDLE_RETURN -#define GAIM_POUNCE_TYPING PURPLE_POUNCE_TYPING -#define GAIM_POUNCE_TYPED PURPLE_POUNCE_TYPED -#define GAIM_POUNCE_TYPING_STOPPED PURPLE_POUNCE_TYPING_STOPPED -#define GAIM_POUNCE_MESSAGE_RECEIVED PURPLE_POUNCE_MESSAGE_RECEIVED -#define GaimPounceEvent PurplePounceEvent - -#define GAIM_POUNCE_OPTION_NONE PURPLE_POUNCE_OPTION_NONE -#define GAIM_POUNCE_OPTION_AWAY PURPLE_POUNCE_OPTION_AWAY -#define GaimPounceOption PurplePounceOption - -#define GaimPounceCb PurplePounceCb - -#define gaim_pounce_new purple_pounce_new -#define gaim_pounce_destroy purple_pounce_destroy -#define gaim_pounce_destroy_all_by_account purple_pounce_destroy_all_by_account -#define gaim_pounce_set_events purple_pounce_set_events -#define gaim_pounce_set_options purple_pounce_set_options -#define gaim_pounce_set_pouncer purple_pounce_set_pouncer -#define gaim_pounce_set_pouncee purple_pounce_set_pouncee -#define gaim_pounce_set_save purple_pounce_set_save -#define gaim_pounce_action_register purple_pounce_action_register -#define gaim_pounce_action_set_enabled purple_pounce_action_set_enabled -#define gaim_pounce_action_set_attribute purple_pounce_action_set_attribute -#define gaim_pounce_set_data purple_pounce_set_data -#define gaim_pounce_get_events purple_pounce_get_events -#define gaim_pounce_get_options purple_pounce_get_options -#define gaim_pounce_get_pouncer purple_pounce_get_pouncer -#define gaim_pounce_get_pouncee purple_pounce_get_pouncee -#define gaim_pounce_get_save purple_pounce_get_save -#define gaim_pounce_action_is_enabled purple_pounce_action_is_enabled -#define gaim_pounce_action_get_attribute purple_pounce_action_get_attribute -#define gaim_pounce_get_data purple_pounce_get_data -#define gaim_pounce_execute purple_pounce_execute - -#define gaim_find_pounce purple_find_pounce -#define gaim_pounces_load purple_pounces_load -#define gaim_pounces_register_handler purple_pounces_register_handler -#define gaim_pounces_unregister_handler purple_pounces_unregister_handler -#define gaim_pounces_get_all purple_pounces_get_all -#define gaim_pounces_get_handle purple_pounces_get_handle -#define gaim_pounces_init purple_pounces_init -#define gaim_pounces_uninit purple_pounces_uninit - -/* from prefs.h */ - - -#define GAIM_PREF_NONE PURPLE_PREF_NONE -#define GAIM_PREF_BOOLEAN PURPLE_PREF_BOOLEAN -#define GAIM_PREF_INT PURPLE_PREF_INT -#define GAIM_PREF_STRING PURPLE_PREF_STRING -#define GAIM_PREF_STRING_LIST PURPLE_PREF_STRING_LIST -#define GAIM_PREF_PATH PURPLE_PREF_PATH -#define GAIM_PREF_PATH_LIST PURPLE_PREF_PATH_LIST -#define GaimPrefType PurplePrefType - -#define GaimPrefCallback PurplePrefCallback - -#define gaim_prefs_get_handle purple_prefs_get_handle -#define gaim_prefs_init purple_prefs_init -#define gaim_prefs_uninit purple_prefs_uninit -#define gaim_prefs_add_none purple_prefs_add_none -#define gaim_prefs_add_bool purple_prefs_add_bool -#define gaim_prefs_add_int purple_prefs_add_int -#define gaim_prefs_add_string purple_prefs_add_string -#define gaim_prefs_add_string_list purple_prefs_add_string_list -#define gaim_prefs_add_path purple_prefs_add_path -#define gaim_prefs_add_path_list purple_prefs_add_path_list -#define gaim_prefs_remove purple_prefs_remove -#define gaim_prefs_rename purple_prefs_rename -#define gaim_prefs_rename_boolean_toggle purple_prefs_rename_boolean_toggle -#define gaim_prefs_destroy purple_prefs_destroy -#define gaim_prefs_set_generic purple_prefs_set_generic -#define gaim_prefs_set_bool purple_prefs_set_bool -#define gaim_prefs_set_int purple_prefs_set_int -#define gaim_prefs_set_string purple_prefs_set_string -#define gaim_prefs_set_string_list purple_prefs_set_string_list -#define gaim_prefs_set_path purple_prefs_set_path -#define gaim_prefs_set_path_list purple_prefs_set_path_list -#define gaim_prefs_exists purple_prefs_exists -#define gaim_prefs_get_type purple_prefs_get_type -#define gaim_prefs_get_bool purple_prefs_get_bool -#define gaim_prefs_get_int purple_prefs_get_int -#define gaim_prefs_get_string purple_prefs_get_string -#define gaim_prefs_get_string_list purple_prefs_get_string_list -#define gaim_prefs_get_path purple_prefs_get_path -#define gaim_prefs_get_path_list purple_prefs_get_path_list -#define gaim_prefs_connect_callback purple_prefs_connect_callback -#define gaim_prefs_disconnect_callback purple_prefs_disconnect_callback -#define gaim_prefs_disconnect_by_handle purple_prefs_disconnect_by_handle -#define gaim_prefs_trigger_callback purple_prefs_trigger_callback -#define gaim_prefs_load purple_prefs_load -#define gaim_prefs_update_old purple_prefs_update_old - -/* from privacy.h */ - -#define GAIM_PRIVACY_ALLOW_ALL PURPLE_PRIVACY_ALLOW_ALL -#define GAIM_PRIVACY_DENY_ALL PURPLE_PRIVACY_DENY_ALL -#define GAIM_PRIVACY_ALLOW_USERS PURPLE_PRIVACY_ALLOW_USERS -#define GAIM_PRIVACY_DENY_USERS PURPLE_PRIVACY_DENY_USERS -#define GAIM_PRIVACY_ALLOW_BUDDYLIST PURPLE_PRIVACY_ALLOW_BUDDYLIST -#define GaimPrivacyType PurplePrivacyType - -#define GaimPrivacyUiOps PurplePrivacyUiOps - -#define gaim_privacy_permit_add purple_privacy_permit_add -#define gaim_privacy_permit_remove purple_privacy_permit_remove -#define gaim_privacy_deny_add purple_privacy_deny_add -#define gaim_privacy_deny_remove purple_privacy_deny_remove -#define gaim_privacy_allow purple_privacy_allow -#define gaim_privacy_deny purple_privacy_deny -#define gaim_privacy_check purple_privacy_check -#define gaim_privacy_set_ui_ops purple_privacy_set_ui_ops -#define gaim_privacy_get_ui_ops purple_privacy_get_ui_ops -#define gaim_privacy_init purple_privacy_init - -/* from proxy.h */ - -#define GAIM_PROXY_USE_GLOBAL PURPLE_PROXY_USE_GLOBAL -#define GAIM_PROXY_NONE PURPLE_PROXY_NONE -#define GAIM_PROXY_HTTP PURPLE_PROXY_HTTP -#define GAIM_PROXY_SOCKS4 PURPLE_PROXY_SOCKS4 -#define GAIM_PROXY_SOCKS5 PURPLE_PROXY_SOCKS5 -#define GAIM_PROXY_USE_ENVVAR PURPLE_PROXY_USE_ENVVAR -#define GaimProxyType PurpleProxyType - -#define GaimProxyInfo PurpleProxyInfo - -#define GaimProxyConnectData PurpleProxyConnectData -#define GaimProxyConnectFunction PurpleProxyConnectFunction - -#define gaim_proxy_info_new purple_proxy_info_new -#define gaim_proxy_info_destroy purple_proxy_info_destroy -#define gaim_proxy_info_set_type purple_proxy_info_set_type -#define gaim_proxy_info_set_host purple_proxy_info_set_host -#define gaim_proxy_info_set_port purple_proxy_info_set_port -#define gaim_proxy_info_set_username purple_proxy_info_set_username -#define gaim_proxy_info_set_password purple_proxy_info_set_password -#define gaim_proxy_info_get_type purple_proxy_info_get_type -#define gaim_proxy_info_get_host purple_proxy_info_get_host -#define gaim_proxy_info_get_port purple_proxy_info_get_port -#define gaim_proxy_info_get_username purple_proxy_info_get_username -#define gaim_proxy_info_get_password purple_proxy_info_get_password - -#define gaim_global_proxy_get_info purple_global_proxy_get_info -#define gaim_proxy_get_handle purple_proxy_get_handle -#define gaim_proxy_init purple_proxy_init -#define gaim_proxy_uninit purple_proxy_uninit -#define gaim_proxy_get_setup purple_proxy_get_setup - -#define gaim_proxy_connect purple_proxy_connect -#define gaim_proxy_connect_socks5 purple_proxy_connect_socks5 -#define gaim_proxy_connect_cancel purple_proxy_connect_cancel -#define gaim_proxy_connect_cancel_with_handle purple_proxy_connect_cancel_with_handle - -/* from prpl.h */ - -#define GaimPluginProtocolInfo PurplePluginProtocolInfo - -#define GAIM_ICON_SCALE_DISPLAY PURPLE_ICON_SCALE_DISPLAY -#define GAIM_ICON_SCALE_SEND PURPLE_ICON_SCALE_SEND -#define GaimIconScaleRules PurpleIconScaleRules - -#define GaimBuddyIconSpec PurpleBuddyIconSpec - -#define GaimProtocolOptions PurpleProtocolOptions - -#define GAIM_IS_PROTOCOL_PLUGIN PURPLE_IS_PROTOCOL_PLUGIN - -#define GAIM_PLUGIN_PROTOCOL_INFO PURPLE_PLUGIN_PROTOCOL_INFO - -#define gaim_prpl_got_account_idle purple_prpl_got_account_idle -#define gaim_prpl_got_account_login_time purple_prpl_got_account_login_time -#define gaim_prpl_got_account_status purple_prpl_got_account_status -#define gaim_prpl_got_user_idle purple_prpl_got_user_idle -#define gaim_prpl_got_user_login_time purple_prpl_got_user_login_time -#define gaim_prpl_got_user_status purple_prpl_got_user_status -#define gaim_prpl_change_account_status purple_prpl_change_account_status -#define gaim_prpl_get_statuses purple_prpl_get_statuses - -#define gaim_find_prpl purple_find_prpl - -/* from request.h */ - -#define GAIM_DEFAULT_ACTION_NONE PURPLE_DEFAULT_ACTION_NONE - -#define GAIM_REQUEST_INPUT PURPLE_REQUEST_INPUT -#define GAIM_REQUEST_CHOICE PURPLE_REQUEST_CHOICE -#define GAIM_REQUEST_ACTION PURPLE_REQUEST_ACTION -#define GAIM_REQUEST_FIELDS PURPLE_REQUEST_FIELDS -#define GAIM_REQUEST_FILE PURPLE_REQUEST_FILE -#define GAIM_REQUEST_FOLDER PURPLE_REQUEST_FOLDER -#define GaimRequestType PurpleRequestType - -#define GAIM_REQUEST_FIELD_NONE PURPLE_REQUEST_FIELD_NONE -#define GAIM_REQUEST_FIELD_STRING PURPLE_REQUEST_FIELD_STRING -#define GAIM_REQUEST_FIELD_INTEGER PURPLE_REQUEST_FIELD_INTEGER -#define GAIM_REQUEST_FIELD_BOOLEAN PURPLE_REQUEST_FIELD_BOOLEAN -#define GAIM_REQUEST_FIELD_CHOICE PURPLE_REQUEST_FIELD_CHOICE -#define GAIM_REQUEST_FIELD_LIST PURPLE_REQUEST_FIELD_LIST -#define GAIM_REQUEST_FIELD_LABEL PURPLE_REQUEST_FIELD_LABEL -#define GAIM_REQUEST_FIELD_IMAGE PURPLE_REQUEST_FIELD_IMAGE -#define GAIM_REQUEST_FIELD_ACCOUNT PURPLE_REQUEST_FIELD_ACCOUNT -#define GaimRequestFieldType PurpleRequestFieldType - -#define GaimRequestFields PurpleRequestFields - -#define GaimRequestFieldGroup PurpleRequestFieldGroup - -#define GaimRequestField PurpleRequestField - -#define GaimRequestUiOps PurpleRequestUiOps - -#define GaimRequestInputCb PurpleRequestInputCb -#define GaimRequestActionCb PurpleRequestActionCb -#define GaimRequestChoiceCb PurpleRequestChoiceCb -#define GaimRequestFieldsCb PurpleRequestFieldsCb -#define GaimRequestFileCb PurpleRequestFileCb - -#define gaim_request_fields_new purple_request_fields_new -#define gaim_request_fields_destroy purple_request_fields_destroy -#define gaim_request_fields_add_group purple_request_fields_add_group -#define gaim_request_fields_get_groups purple_request_fields_get_groups -#define gaim_request_fields_exists purple_request_fields_exists -#define gaim_request_fields_get_required purple_request_fields_get_required -#define gaim_request_fields_is_field_required purple_request_fields_is_field_required -#define gaim_request_fields_all_required_filled purple_request_fields_all_required_filled -#define gaim_request_fields_get_field purple_request_fields_get_field -#define gaim_request_fields_get_string purple_request_fields_get_string -#define gaim_request_fields_get_integer purple_request_fields_get_integer -#define gaim_request_fields_get_bool purple_request_fields_get_bool -#define gaim_request_fields_get_choice purple_request_fields_get_choice -#define gaim_request_fields_get_account purple_request_fields_get_account - -#define gaim_request_field_group_new purple_request_field_group_new -#define gaim_request_field_group_destroy purple_request_field_group_destroy -#define gaim_request_field_group_add_field purple_request_field_group_add_field -#define gaim_request_field_group_get_title purple_request_field_group_get_title -#define gaim_request_field_group_get_fields purple_request_field_group_get_fields - -#define gaim_request_field_new purple_request_field_new -#define gaim_request_field_destroy purple_request_field_destroy -#define gaim_request_field_set_label purple_request_field_set_label -#define gaim_request_field_set_visible purple_request_field_set_visible -#define gaim_request_field_set_type_hint purple_request_field_set_type_hint -#define gaim_request_field_set_required purple_request_field_set_required -#define gaim_request_field_get_type purple_request_field_get_type -#define gaim_request_field_get_id purple_request_field_get_id -#define gaim_request_field_get_label purple_request_field_get_label -#define gaim_request_field_is_visible purple_request_field_is_visible -#define gaim_request_field_get_type_hint purple_request_field_get_type_hint -#define gaim_request_field_is_required purple_request_field_is_required - -#define gaim_request_field_string_new purple_request_field_string_new -#define gaim_request_field_string_set_default_value \ - purple_request_field_string_set_default_value -#define gaim_request_field_string_set_value purple_request_field_string_set_value -#define gaim_request_field_string_set_masked purple_request_field_string_set_masked -#define gaim_request_field_string_set_editable purple_request_field_string_set_editable -#define gaim_request_field_string_get_default_value \ - purple_request_field_string_get_default_value -#define gaim_request_field_string_get_value purple_request_field_string_get_value -#define gaim_request_field_string_is_multiline purple_request_field_string_is_multiline -#define gaim_request_field_string_is_masked purple_request_field_string_is_masked -#define gaim_request_field_string_is_editable purple_request_field_string_is_editable - -#define gaim_request_field_int_new purple_request_field_int_new -#define gaim_request_field_int_set_default_value \ - purple_request_field_int_set_default_value -#define gaim_request_field_int_set_value purple_request_field_int_set_value -#define gaim_request_field_int_get_default_value \ - purple_request_field_int_get_default_value -#define gaim_request_field_int_get_value purple_request_field_int_get_value - -#define gaim_request_field_bool_new purple_request_field_bool_new -#define gaim_request_field_bool_set_default_value \ - purple_request_field_book_set_default_value -#define gaim_request_field_bool_set_value purple_request_field_bool_set_value -#define gaim_request_field_bool_get_default_value \ - purple_request_field_bool_get_default_value -#define gaim_request_field_bool_get_value purple_request_field_bool_get_value - -#define gaim_request_field_choice_new purple_request_field_choice_new -#define gaim_request_field_choice_add purple_request_field_choice_add -#define gaim_request_field_choice_set_default_value \ - purple_request_field_choice_set_default_value -#define gaim_request_field_choice_set_value purple_request_field_choice_set_value -#define gaim_request_field_choice_get_default_value \ - purple_request_field_choice_get_default_value -#define gaim_request_field_choice_get_value purple_request_field_choice_get_value -#define gaim_request_field_choice_get_labels purple_request_field_choice_get_labels - -#define gaim_request_field_list_new purple_request_field_list_new -#define gaim_request_field_list_set_multi_select purple_request_field_list_set_multi_select -#define gaim_request_field_list_get_multi_select purple_request_field_list_get_multi_select -#define gaim_request_field_list_get_data purple_request_field_list_get_data -#define gaim_request_field_list_add purple_request_field_list_add -#define gaim_request_field_list_add_selected purple_request_field_list_add_selected -#define gaim_request_field_list_clear_selected purple_request_field_list_clear_selected -#define gaim_request_field_list_set_selected purple_request_field_list_set_selected -#define gaim_request_field_list_is_selected purple_request_field_list_is_selected -#define gaim_request_field_list_get_selected purple_request_field_list_get_selected -#define gaim_request_field_list_get_items purple_request_field_list_get_items - -#define gaim_request_field_label_new purple_request_field_label_new - -#define gaim_request_field_image_new purple_request_field_image_new -#define gaim_request_field_image_set_scale purple_request_field_image_set_scale -#define gaim_request_field_image_get_buffer purple_request_field_image_get_buffer -#define gaim_request_field_image_get_size purple_request_field_image_get_size -#define gaim_request_field_image_get_scale_x purple_request_field_image_get_scale_x -#define gaim_request_field_image_get_scale_y purple_request_field_image_get_scale_y - -#define gaim_request_field_account_new purple_request_field_account_new -#define gaim_request_field_account_set_default_value purple_request_field_account_set_default_value -#define gaim_request_field_account_set_value purple_request_field_account_set_value -#define gaim_request_field_account_set_show_all purple_request_field_account_set_show_all -#define gaim_request_field_account_set_filter purple_request_field_account_set_filter -#define gaim_request_field_account_get_default_value purple_request_field_account_get_default_value -#define gaim_request_field_account_get_value purple_request_field_account_get_value -#define gaim_request_field_account_get_show_all purple_request_field_account_get_show_all -#define gaim_request_field_account_get_filter purple_request_field_account_get_filter - -#define gaim_request_input purple_request_input -#define gaim_request_choice purple_request_choice -#define gaim_request_choice_varg purple_request_choice_varg -#define gaim_request_action purple_request_action -#define gaim_request_action_varg purple_request_action_varg -#define gaim_request_fields(handle, title, primary, secondary, fields, ok_text, ok_cb, cancel_text, cancel_cb, user_data) purple_request_fields(handle, title, primary, secondary, fields, ok_text, ok_cb, cancel_text, cancel_cb, NULL, NULL, NULL, user_data) -#define gaim_request_close purple_request_close -#define gaim_request_close_with_handle purple_request_close_with_handle - -#define gaim_request_yes_no purple_request_yes_no -#define gaim_request_ok_cancel purple_request_ok_cancel -#define gaim_request_accept_cancel purple_request_accept_cancel - -#define gaim_request_file purple_request_file -#define gaim_request_folder purple_request_folder - -#define gaim_request_set_ui_ops purple_request_set_ui_ops -#define gaim_request_get_ui_ops purple_request_get_ui_ops - -/* from roomlist.h */ - -#define GaimRoomlist PurpleRoomlist -#define GaimRoomlistRoom PurpleRoomlistRoom -#define GaimRoomlistField PurpleRoomlistField -#define GaimRoomlistUiOps PurpleRoomlistUiOps - -#define GAIM_ROOMLIST_ROOMTYPE_CATEGORY PURPLE_ROOMLIST_ROOMTYPE_CATEGORY -#define GAIM_ROOMLIST_ROOMTYPE_ROOM PURPLE_ROOMLIST_ROOMTYPE_ROOM -#define GaimRoomlistRoomType PurpleRoomlistRoomType - -#define GAIM_ROOMLIST_FIELD_BOOL PURPLE_ROOMLIST_BOOL -#define GAIM_ROOMLIST_FIELD_INT PURPLE_ROOMLIST_INT -#define GAIM_ROOMLIST_FIELD_STRING PURPLE_ROOMLIST_STRING -#define GaimRoomlistFieldType PurpleRoomlistFieldType - -#define gaim_roomlist_show_with_account purple_roomlist_show_with_account -#define gaim_roomlist_new purple_roomlist_new -#define gaim_roomlist_ref purple_roomlist_ref -#define gaim_roomlist_unref purple_roomlist_unref -#define gaim_roomlist_set_fields purple_roomlist_set_fields -#define gaim_roomlist_set_in_progress purple_roomlist_set_in_progress -#define gaim_roomlist_get_in_progress purple_roomlist_get_in_progress -#define gaim_roomlist_room_add purple_roomlist_room_add - -#define gaim_roomlist_get_list purple_roomlist_get_list -#define gaim_roomlist_cancel_get_list purple_roomlist_cancel_get_list -#define gaim_roomlist_expand_category purple_roomlist_expand_category - -#define gaim_roomlist_room_new purple_roomlist_room_new -#define gaim_roomlist_room_add_field purple_roomlist_room_add_field -#define gaim_roomlist_room_join purple_roomlist_room_join -#define gaim_roomlist_field_new purple_roomlist_field_new - -#define gaim_roomlist_set_ui_ops purple_roomlist_set_ui_ops -#define gaim_roomlist_get_ui_ops purple_roomlist_get_ui_ops - -/* from savedstatuses.h */ - -#define GaimSavedStatus PurpleSavedStatus -#define GaimSavedStatusSub PurpleSavedStatusSub - -#define gaim_savedstatus_new purple_savedstatus_new -#define gaim_savedstatus_set_title purple_savedstatus_set_title -#define gaim_savedstatus_set_type purple_savedstatus_set_type -#define gaim_savedstatus_set_message purple_savedstatus_set_message -#define gaim_savedstatus_set_substatus purple_savedstatus_set_substatus -#define gaim_savedstatus_unset_substatus purple_savedstatus_unset_substatus -#define gaim_savedstatus_delete purple_savedstatus_delete - -#define gaim_savedstatuses_get_all purple_savedstatuses_get_all -#define gaim_savedstatuses_get_popular purple_savedstatuses_get_popular -#define gaim_savedstatus_get_current purple_savedstatus_get_current -#define gaim_savedstatus_get_default purple_savedstatus_get_default -#define gaim_savedstatus_get_idleaway purple_savedstatus_get_idleaway -#define gaim_savedstatus_is_idleaway purple_savedstatus_is_idleaway -#define gaim_savedstatus_set_idleaway purple_savedstatus_set_idleaway -#define gaim_savedstatus_get_startup purple_savedstatus_get_startup -#define gaim_savedstatus_find purple_savedstatus_find -#define gaim_savedstatus_find_by_creation_time purple_savedstatus_find_by_creation_time -#define gaim_savedstatus_find_transient_by_type_and_message \ - purple_savedstatus_find_transient_by_type_and_message - -#define gaim_savedstatus_is_transient purple_savedstatus_is_transient -#define gaim_savedstatus_get_title purple_savedstatus_get_title -#define gaim_savedstatus_get_type purple_savedstatus_get_type -#define gaim_savedstatus_get_message purple_savedstatus_get_message -#define gaim_savedstatus_get_creation_time purple_savedstatus_get_creation_time -#define gaim_savedstatus_has_substatuses purple_savedstatus_has_substatuses -#define gaim_savedstatus_get_substatus purple_savedstatus_get_substatus -#define gaim_savedstatus_substatus_get_type purple_savedstatus_substatus_get_type -#define gaim_savedstatus_substatus_get_message purple_savedstatus_substatus_get_message -#define gaim_savedstatus_activate purple_savedstatus_activate -#define gaim_savedstatus_activate_for_account purple_savedstatus_activate_for_account - -#define gaim_savedstatuses_get_handle purple_savedstatuses_get_handle -#define gaim_savedstatuses_init purple_savedstatuses_init -#define gaim_savedstatuses_uninit purple_savedstatuses_uninit - -/* from signals.h */ - -#define GAIM_CALLBACK PURPLE_CALLBACK - -#define GaimCallback PurpleCallback -#define GaimSignalMarshalFunc PurpleSignalMarshalFunc - -#define GAIM_SIGNAL_PRIORITY_DEFAULT PURPLE_SIGNAL_PRIORITY_DEFAULT -#define GAIM_SIGNAL_PRIORITY_HIGHEST PURPLE_SIGNAL_PRIORITY_HIGHEST -#define GAIM_SIGNAL_PRIORITY_LOWEST PURPLE_SIGNAL_PRIORITY_LOWEST - -#define gaim_signal_register purple_signal_register -#define gaim_signal_unregister purple_signal_unregister - -#define gaim_signals_unregister_by_instance purple_signals_unregister_by_instance - -#define gaim_signal_get_values purple_signal_get_values -#define gaim_signal_connect_priority purple_signal_connect_priority -#define gaim_signal_connect purple_signal_connect -#define gaim_signal_connect_priority_vargs purple_signal_connect_priority_vargs -#define gaim_signal_connect_vargs purple_signal_connect_vargs -#define gaim_signal_disconnect purple_signal_disconnect - -#define gaim_signals_disconnect_by_handle purple_signals_disconnect_by_handle - -#define gaim_signal_emit purple_signal_emit -#define gaim_signal_emit_vargs purple_signal_emit_vargs -#define gaim_signal_emit_return_1 purple_signal_emit_vargs -#define gaim_signal_emit_vargs_return_1 purple_signal_emit_vargs_return_1 - -#define gaim_signals_init purple_signals_init -#define gaim_signals_uninit purple_signals_uninit - -#define gaim_marshal_VOID \ - purple_marshal_VOID -#define gaim_marshal_VOID__INT \ - purple_marshal_VOID__INT -#define gaim_marshal_VOID__INT_INT \ - purple_marshal_VOID_INT_INT -#define gaim_marshal_VOID__POINTER \ - purple_marshal_VOID__POINTER -#define gaim_marshal_VOID__POINTER_UINT \ - purple_marshal_VOID__POINTER_UINT -#define gaim_marshal_VOID__POINTER_INT_INT \ - purple_marshal_VOID__POINTER_INT_INT -#define gaim_marshal_VOID__POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_UINT \ - purple_marshal_VOID__POINTER_POINTER_UINT -#define gaim_marshal_VOID__POINTER_POINTER_UINT_UINT \ - purple_marshal_VOID__POINTER_POINTER_UINT_UINT -#define gaim_marshal_VOID__POINTER_POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT \ - purple_marshal_VOID__POINTER_POINTER_POINTER_UINT -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT \ - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT \ - purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT - -#define gaim_marshal_INT__INT \ - purple_marshal_INT__INT -#define gaim_marshal_INT__INT_INT \ - purple_marshal_INT__INT_INT -#define gaim_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER \ - purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER - -#define gaim_marshal_BOOLEAN__POINTER \ - purple_marshal_BOOLEAN__POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER_UINT \ - purple_marshal_BOOLEAN__POINTER_POINTER_UINT -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER - -#define gaim_marshal_BOOLEAN__INT_POINTER \ - purple_marshal_BOOLEAN__INT_POINTER - -#define gaim_marshal_POINTER__POINTER_INT \ - purple_marshal_POINTER__POINTER_INT -#define gaim_marshal_POINTER__POINTER_INT64 \ - purple_marshal_POINTER__POINTER_INT64 -#define gaim_marshal_POINTER__POINTER_INT_BOOLEAN \ - purple_marshal_POINTER__POINTER_INT_BOOLEAN -#define gaim_marshal_POINTER__POINTER_INT64_BOOLEAN \ - purple_marshal_POINTER__POINTER_INT64_BOOLEAN -#define gaim_marshal_POINTER__POINTER_POINTER \ - purple_marshal_POINTER__POINTER_POINTER - -/* from sound.h */ - -#define GAIM_SOUND_BUDDY_ARRIVE PURPLE_SOUND_BUDDY_ARRIVE -#define GAIM_SOUND_BUDDY_LEAVE PURPLE_SOUND_BUDDY_LEAVE -#define GAIM_SOUND_RECEIVE PURPLE_SOUND_RECEIVE -#define GAIM_SOUND_FIRST_RECEIVE PURPLE_SOUND_FIRST_RECEIVE -#define GAIM_SOUND_SEND PURPLE_SOUND_SEND -#define GAIM_SOUND_CHAT_JOIN PURPLE_SOUND_CHAT_JOIN -#define GAIM_SOUND_CHAT_LEAVE PURPLE_SOUND_CHAT_LEAVE -#define GAIM_SOUND_CHAT_YOU_SAY PURPLE_SOUND_CHAT_YOU_SAY -#define GAIM_SOUND_CHAT_SAY PURPLE_SOUND_CHAT_SAY -#define GAIM_SOUND_POUNCE_DEFAULT PURPLE_SOUND_POUNCE_DEFAULT -#define GAIM_SOUND_CHAT_NICK PURPLE_SOUND_CHAT_NICK -#define GAIM_NUM_SOUNDS PURPLE_NUM_SOUNDS -#define GaimSoundEventID PurpleSoundEventID - -#define GaimSoundUiOps PurpleSoundUiOps - -#define gaim_sound_play_file purple_sound_play_file -#define gaim_sound_play_event purple_sound_play_event -#define gaim_sound_set_ui_ops purple_sound_set_ui_ops -#define gaim_sound_get_ui_ops purple_sound_get_ui_ops -#define gaim_sound_init purple_sound_init -#define gaim_sound_uninit purple_sound_uninit - -#define gaim_sounds_get_handle purple_sounds_get_handle - -/* from sslconn.h */ - -#define GAIM_SSL_DEFAULT_PORT PURPLE_SSL_DEFAULT_PORT - -#define GAIM_SSL_HANDSHAKE_FAILED PURPLE_SSL_HANDSHAKE_FAILED -#define GAIM_SSL_CONNECT_FAILED PURPLE_SSL_CONNECT_FAILED -#define GaimSslErrorType PurpleSslErrorType - -#define GaimSslConnection PurpleSslConnection - -#define GaimSslInputFunction PurpleSslInputFunction -#define GaimSslErrorFunction PurpleSslErrorFunction - -#define GaimSslOps PurpleSslOps - -#define gaim_ssl_is_supported purple_ssl_is_supported -#define gaim_ssl_connect purple_ssl_connect -#define gaim_ssl_connect_fd purple_ssl_connect_fd -#define gaim_ssl_input_add purple_ssl_input_add -#define gaim_ssl_close purple_ssl_close -#define gaim_ssl_read purple_ssl_read -#define gaim_ssl_write purple_ssl_write - -#define gaim_ssl_set_ops purple_ssl_set_ops -#define gaim_ssl_get_ops purple_ssl_get_ops -#define gaim_ssl_init purple_ssl_init -#define gaim_ssl_uninit purple_ssl_uninit - -/* from status.h */ - -#define GaimStatusType PurpleStatusType -#define GaimStatusAttr PurpleStatusAttr -#define GaimPresence PurplePresence -#define GaimStatus PurpleStatus - -#define GAIM_PRESENCE_CONTEXT_UNSET PURPLE_PRESENCE_CONTEXT_UNSET -#define GAIM_PRESENCE_CONTEXT_ACCOUNT PURPLE_PRESENCE_CONTEXT_ACCOUNT -#define GAIM_PRESENCE_CONTEXT_CONV PURPLE_PRESENCE_CONTEXT_CONV -#define GAIM_PRESENCE_CONTEXT_BUDDY PURPLE_PRESENCE_CONTEXT_BUDDY -#define GaimPresenceContext PurplePresenceContext - -#define GAIM_STATUS_UNSET PURPLE_STATUS_UNSET -#define GAIM_STATUS_OFFLINE PURPLE_STATUS_OFFLINE -#define GAIM_STATUS_AVAILABLE PURPLE_STATUS_AVAILABLE -#define GAIM_STATUS_UNAVAILABLE PURPLE_STATUS_UNAVAILABLE -#define GAIM_STATUS_INVISIBLE PURPLE_STATUS_INVISIBLE -#define GAIM_STATUS_AWAY PURPLE_STATUS_AWAY -#define GAIM_STATUS_EXTENDED_AWAY PURPLE_STATUS_EXTENDED_AWAY -#define GAIM_STATUS_MOBILE PURPLE_STATUS_MOBILE -#define GAIM_STATUS_NUM_PRIMITIVES PURPLE_STATUS_NUM_PRIMITIVES -#define GaimStatusPrimitive PurpleStatusPrimitive - -#define gaim_primitive_get_id_from_type purple_primitive_get_id_from_type -#define gaim_primitive_get_name_from_type purple_primitive_get_name_from_type -#define gaim_primitive_get_type_from_id purple_primitive_get_type_from_id - -#define gaim_status_type_new_full purple_status_type_new_full -#define gaim_status_type_new purple_status_type_new -#define gaim_status_type_new_with_attrs purple_status_type_new_with_attrs -#define gaim_status_type_destroy purple_status_type_destroy -#define gaim_status_type_set_primary_attr purple_status_type_set_primary_attr -#define gaim_status_type_add_attr purple_status_type_add_attr -#define gaim_status_type_add_attrs purple_status_type_add_attrs -#define gaim_status_type_add_attrs_vargs purple_status_type_add_attrs_vargs -#define gaim_status_type_get_primitive purple_status_type_get_primitive -#define gaim_status_type_get_id purple_status_type_get_id -#define gaim_status_type_get_name purple_status_type_get_name -#define gaim_status_type_is_saveable purple_status_type_is_saveable -#define gaim_status_type_is_user_settable purple_status_type_is_user_settable -#define gaim_status_type_is_independent purple_status_type_is_independent -#define gaim_status_type_is_exclusive purple_status_type_is_exclusive -#define gaim_status_type_is_available purple_status_type_is_available -#define gaim_status_type_get_primary_attr purple_status_type_get_primary_attr -#define gaim_status_type_get_attr purple_status_type_get_attr -#define gaim_status_type_get_attrs purple_status_type_get_attrs -#define gaim_status_type_find_with_id purple_status_type_find_with_id - -#define gaim_status_attr_new purple_status_attr_new -#define gaim_status_attr_destroy purple_status_attr_destroy -#define gaim_status_attr_get_id purple_status_attr_get_id -#define gaim_status_attr_get_name purple_status_attr_get_name -#define gaim_status_attr_get_value purple_status_attr_get_value - -#define gaim_status_new purple_status_new -#define gaim_status_destroy purple_status_destroy -#define gaim_status_set_active purple_status_set_active -#define gaim_status_set_active_with_attrs purple_status_set_active_with_attrs -#define gaim_status_set_active_with_attrs_list purple_status_set_active_with_attrs_list -#define gaim_status_set_attr_boolean purple_status_set_attr_boolean -#define gaim_status_set_attr_int purple_status_set_attr_int -#define gaim_status_set_attr_string purple_status_set_attr_string -#define gaim_status_get_type purple_status_get_type -#define gaim_status_get_presence purple_status_get_presence -#define gaim_status_get_id purple_status_get_id -#define gaim_status_get_name purple_status_get_name -#define gaim_status_is_independent purple_status_is_independent -#define gaim_status_is_exclusive purple_status_is_exclusive -#define gaim_status_is_available purple_status_is_available -#define gaim_status_is_active purple_status_is_active -#define gaim_status_is_online purple_status_is_online -#define gaim_status_get_attr_value purple_status_get_attr_value -#define gaim_status_get_attr_boolean purple_status_get_attr_boolean -#define gaim_status_get_attr_int purple_status_get_attr_int -#define gaim_status_get_attr_string purple_status_get_attr_string -#define gaim_status_compare purple_status_compare - -#define gaim_presence_new purple_presence_new -#define gaim_presence_new_for_account purple_presence_new_for_account -#define gaim_presence_new_for_conv purple_presence_new_for_conv -#define gaim_presence_new_for_buddy purple_presence_new_for_buddy -#define gaim_presence_destroy purple_presence_destroy -#define gaim_presence_add_status purple_presence_add_status -#define gaim_presence_add_list purple_presence_add_list -#define gaim_presence_set_status_active purple_presence_set_status_active -#define gaim_presence_switch_status purple_presence_switch_status -#define gaim_presence_set_idle purple_presence_set_idle -#define gaim_presence_set_login_time purple_presence_set_login_time -#define gaim_presence_get_context purple_presence_get_context -#define gaim_presence_get_account purple_presence_get_account -#define gaim_presence_get_conversation purple_presence_get_conversation -#define gaim_presence_get_chat_user purple_presence_get_chat_user -#define gaim_presence_get_statuses purple_presence_get_statuses -#define gaim_presence_get_status purple_presence_get_status -#define gaim_presence_get_active_status purple_presence_get_active_status -#define gaim_presence_is_available purple_presence_is_available -#define gaim_presence_is_online purple_presence_is_online -#define gaim_presence_is_status_active purple_presence_is_status_active -#define gaim_presence_is_status_primitive_active \ - purple_presence_is_status_primitive_active -#define gaim_presence_is_idle purple_presence_is_idle -#define gaim_presence_get_idle_time purple_presence_get_idle_time -#define gaim_presence_get_login_time purple_presence_get_login_time -#define gaim_presence_compare purple_presence_compare - -#define gaim_status_get_handle purple_status_get_handle -#define gaim_status_init purple_status_init -#define gaim_status_uninit purple_status_uninit - -/* from stringref.h */ - -#define GaimStringref PurpleStringref - -#define gaim_stringref_new purple_stringref_new -#define gaim_stringref_new_noref purple_stringref_new_noref -#define gaim_stringref_printf purple_stringref_printf -#define gaim_stringref_ref purple_stringref_ref -#define gaim_stringref_unref purple_stringref_unref -#define gaim_stringref_value purple_stringref_value -#define gaim_stringref_cmp purple_stringref_cmp -#define gaim_stringref_len purple_stringref_len - -/* from stun.h */ - -#define GaimStunNatDiscovery PurpleStunNatDiscovery - -#define GAIM_STUN_STATUS_UNDISCOVERED PURPLE_STUN_STATUS_UNDISCOVERED -#define GAIM_STUN_STATUS_UNKNOWN PURPLE_STUN_STATUS_UNKNOWN -#define GAIM_STUN_STATUS_DISCOVERING PURPLE_STUN_STATUS_DISCOVERING -#define GAIM_STUN_STATUS_DISCOVERED PURPLE_STUN_STATUS_DISCOVERED -#define GaimStunStatus PurpleStunStatus - -#define GAIM_STUN_NAT_TYPE_PUBLIC_IP PURPLE_STUN_NAT_TYPE_PUBLIC_IP -#define GAIM_STUN_NAT_TYPE_UNKNOWN_NAT PURPLE_STUN_NAT_TYPE_UNKNOWN_NAT -#define GAIM_STUN_NAT_TYPE_FULL_CONE PURPLE_STUN_NAT_TYPE_FULL_CONE -#define GAIM_STUN_NAT_TYPE_RESTRICTED_CONE PURPLE_STUN_NAT_TYPE_RESTRICTED_CONE -#define GAIM_STUN_NAT_TYPE_PORT_RESTRICTED_CONE PURPLE_STUN_NAT_TYPE_PORT_RESTRICTED_CONE -#define GAIM_STUN_NAT_TYPE_SYMMETRIC PURPLE_STUN_NAT_TYPE_SYMMETRIC -#define GaimStunNatType PurpleStunNatType - -/* why didn't this have a Gaim prefix before? */ -#define StunCallback PurpleStunCallback - -#define gaim_stun_discover purple_stun_discover -#define gaim_stun_init purple_stun_init - -/* from upnp.h */ - -/* suggested rename: PurpleUPnpMappingHandle */ -#define UPnPMappingAddRemove PurpleUPnPMappingAddRemove - -#define GaimUPnPCallback PurpleUPnPCallback - -#define gaim_upnp_discover purple_upnp_discover -#define gaim_upnp_get_public_ip purple_upnp_get_public_ip -#define gaim_upnp_cancel_port_mapping purple_upnp_cancel_port_mapping -#define gaim_upnp_set_port_mapping purple_upnp_set_port_mapping - -#define gaim_upnp_remove_port_mapping purple_upnp_remove_port_mapping - -/* from util.h */ - -#define GaimUtilFetchUrlData PurpleUtilFetchUrlData -#define GaimMenuAction PurpleMenuAction - -#define GaimInfoFieldFormatCallback PurpleIntoFieldFormatCallback - -#define GaimKeyValuePair PurpleKeyValuePair - -#define gaim_menu_action_new purple_menu_action_new -#define gaim_menu_action_free purple_menu_action_free - -#define gaim_base16_encode purple_base16_encode -#define gaim_base16_decode purple_base16_decode -#define gaim_base64_encode purple_base64_encode -#define gaim_base64_decode purple_base64_decode -#define gaim_quotedp_decode purple_quotedp_decode - -#define gaim_mime_decode_field purple_mime_deco_field - -#define gaim_utf8_strftime purple_utf8_strftime -#define gaim_date_format_short purple_date_format_short -#define gaim_date_format_long purple_date_format_long -#define gaim_date_format_full purple_date_format_full -#define gaim_time_format purple_time_format -#define gaim_time_build purple_time_build - -#define GAIM_NO_TZ_OFF PURPLE_NO_TZ_OFF - -#define gaim_str_to_time purple_str_to_time - -#define gaim_markup_find_tag purple_markup_find_tag -#define gaim_markup_extract_info_field purple_markup_extract_info_field -#define gaim_markup_html_to_xhtml purple_markup_html_to_xhtml -#define gaim_markup_strip_html purple_markup_strip_html -#define gaim_markup_linkify purple_markup_linkify -#define gaim_markup_slice purple_markup_slice -#define gaim_markup_get_tag_name purple_markup_get_tag_name -#define gaim_unescape_html purple_unescape_html - -#define gaim_home_dir purple_home_dir -#define gaim_user_dir purple_user_dir - -#define gaim_util_set_user_dir purple_util_set_user_dir - -#define gaim_build_dir purple_build_dir - -#define gaim_util_write_data_to_file purple_util_write_data_to_file - -#define gaim_util_read_xml_from_file purple_util_read_xml_from_file - -#define gaim_mkstemp purple_mkstemp - -#define gaim_program_is_valid purple_program_is_valid - -#define gaim_running_gnome purple_running_gnome -#define gaim_running_kde purple_running_kde -#define gaim_running_osx purple_running_osx - -#define gaim_fd_get_ip purple_fd_get_ip - -#define gaim_normalize purple_normalize -#define gaim_normalize_nocase purple_normalize_nocase - -#define gaim_strdup_withhtml purple_strdup_withhtml - -#define gaim_str_has_prefix purple_str_has_prefix -#define gaim_str_has_suffix purple_str_has_suffix -#define gaim_str_add_cr purple_str_add_cr -#define gaim_str_strip_char purple_str_strip_char - -#define gaim_util_chrreplace purple_util_chrreplace - -#define gaim_strreplace purple_strreplace - -#define gaim_utf8_ncr_encode purple_utf8_ncr_encode -#define gaim_utf8_ncr_decode purple_utf8_ncr_decode - -#define gaim_strcasereplace purple_strcasereplace -#define gaim_strcasestr purple_strcasestr - -#define gaim_str_size_to_units purple_str_size_to_units -#define gaim_str_seconds_to_string purple_str_seconds_to_string -#define gaim_str_binary_to_ascii purple_str_binary_to_ascii - - -#define gaim_got_protocol_handler_uri purple_got_protocol_handler_uri - -#define gaim_url_parse purple_url_parse - -#define GaimUtilFetchUrlCallback PurpleUtilFetchUrlCallback -#define gaim_util_fetch_url purple_util_fetch_url -#define gaim_util_fetch_url_request purple_util_fetch_url_request -#define gaim_util_fetch_url_cancel purple_util_fetch_url_cancel - -#define gaim_url_decode purple_url_decode -#define gaim_url_encode purple_url_encode - -#define gaim_email_is_valid purple_email_is_valid - -#define gaim_uri_list_extract_uris purple_uri_list_extract_uris -#define gaim_uri_list_extract_filenames purple_uri_list_extract_filenames - -#define gaim_utf8_try_convert purple_utf8_try_convert -#define gaim_utf8_salvage purple_utf8_salvage -#define gaim_utf8_strcasecmp purple_utf8_strcasecmp -#define gaim_utf8_has_word purple_utf8_has_word - -#define gaim_print_utf8_to_console purple_print_utf8_to_console - -#define gaim_message_meify purple_message_meify - -#define gaim_text_strip_mnemonic purple_text_strip_mnemonic - -#define gaim_unescape_filename purple_unescape_filename -#define gaim_escape_filename purple_escape_filename - -/* from value.h */ - -#define GAIM_TYPE_UNKNOWN PURPLE_TYPE_UNKNOWN -#define GAIM_TYPE_SUBTYPE PURPLE_TYPE_SUBTYPE -#define GAIM_TYPE_CHAR PURPLE_TYPE_CHAR -#define GAIM_TYPE_UCHAR PURPLE_TYPE_UCHAR -#define GAIM_TYPE_BOOLEAN PURPLE_TYPE_BOOLEAN -#define GAIM_TYPE_SHORT PURPLE_TYPE_SHORT -#define GAIM_TYPE_USHORT PURPLE_TYPE_USHORT -#define GAIM_TYPE_INT PURPLE_TYPE_INT -#define GAIM_TYPE_UINT PURPLE_TYPE_UINT -#define GAIM_TYPE_LONG PURPLE_TYPE_LONG -#define GAIM_TYPE_ULONG PURPLE_TYPE_ULONG -#define GAIM_TYPE_INT64 PURPLE_TYPE_INT64 -#define GAIM_TYPE_UINT64 PURPLE_TYPE_UINT64 -#define GAIM_TYPE_STRING PURPLE_TYPE_STRING -#define GAIM_TYPE_OBJECT PURPLE_TYPE_OBJECT -#define GAIM_TYPE_POINTER PURPLE_TYPE_POINTER -#define GAIM_TYPE_ENUM PURPLE_TYPE_ENUM -#define GAIM_TYPE_BOXED PURPLE_TYPE_BOXED -#define GaimType PurpleType - - -#define GAIM_SUBTYPE_UNKNOWN PURPLE_SUBTYPE_UNKNOWN -#define GAIM_SUBTYPE_ACCOUNT PURPLE_SUBTYPE_ACCOUNT -#define GAIM_SUBTYPE_BLIST PURPLE_SUBTYPE_BLIST -#define GAIM_SUBTYPE_BLIST_BUDDY PURPLE_SUBTYPE_BLIST_BUDDY -#define GAIM_SUBTYPE_BLIST_GROUP PURPLE_SUBTYPE_BLIST_GROUP -#define GAIM_SUBTYPE_BLIST_CHAT PURPLE_SUBTYPE_BLIST_CHAT -#define GAIM_SUBTYPE_BUDDY_ICON PURPLE_SUBTYPE_BUDDY_ICON -#define GAIM_SUBTYPE_CONNECTION PURPLE_SUBTYPE_CONNECTION -#define GAIM_SUBTYPE_CONVERSATION PURPLE_SUBTYPE_CONVERSATION -#define GAIM_SUBTYPE_PLUGIN PURPLE_SUBTYPE_PLUGIN -#define GAIM_SUBTYPE_BLIST_NODE PURPLE_SUBTYPE_BLIST_NODE -#define GAIM_SUBTYPE_CIPHER PURPLE_SUBTYPE_CIPHER -#define GAIM_SUBTYPE_STATUS PURPLE_SUBTYPE_STATUS -#define GAIM_SUBTYPE_LOG PURPLE_SUBTYPE_LOG -#define GAIM_SUBTYPE_XFER PURPLE_SUBTYPE_XFER -#define GAIM_SUBTYPE_SAVEDSTATUS PURPLE_SUBTYPE_SAVEDSTATUS -#define GAIM_SUBTYPE_XMLNODE PURPLE_SUBTYPE_XMLNODE -#define GAIM_SUBTYPE_USERINFO PURPLE_SUBTYPE_USERINFO -#define GaimSubType PurpleSubType - -#define GaimValue PurpleValue - -#define gaim_value_new purple_value_new -#define gaim_value_new_outgoing purple_value_new_outgoing -#define gaim_value_destroy purple_value_destroy -#define gaim_value_dup purple_value_dup -#define gaim_value_purple_buddy_icon_get_extensionget_type purple_value_get_type -#define gaim_value_get_subtype purple_value_get_subtype -#define gaim_value_get_specific_type purple_value_get_specific_type -#define gaim_value_is_outgoing purple_value_is_outgoing -#define gaim_value_set_char purple_value_set_char -#define gaim_value_set_uchar purple_value_set_uchar -#define gaim_value_set_boolean purple_value_set_boolean -#define gaim_value_set_short purple_value_set_short -#define gaim_value_set_ushort purple_value_set_ushort -#define gaim_value_set_int purple_value_set_int -#define gaim_value_set_uint purple_value_set_uint -#define gaim_value_set_long purple_value_set_long -#define gaim_value_set_ulong purple_value_set_ulong -#define gaim_value_set_int64 purple_value_set_int64 -#define gaim_value_set_uint64 purple_value_set_uint64 -#define gaim_value_set_string purple_value_set_string -#define gaim_value_set_object purple_value_set_object -#define gaim_value_set_pointer purple_value_set_pointer -#define gaim_value_set_enum purple_value_set_enum -#define gaim_value_set_boxed purple_value_set_boxed -#define gaim_value_get_char purple_value_get_char -#define gaim_value_get_uchar purple_value_get_uchar -#define gaim_value_get_boolean purple_value_get_boolean -#define gaim_value_get_short purple_value_get_short -#define gaim_value_get_ushort purple_value_get_ushort -#define gaim_value_get_int purple_value_get_int -#define gaim_value_get_uint purple_value_get_uint -#define gaim_value_get_long purple_value_get_long -#define gaim_value_get_ulong purple_value_get_ulong -#define gaim_value_get_int64 purple_value_get_int64 -#define gaim_value_get_uint64 purple_value_get_uint64 -#define gaim_value_get_string purple_value_get_string -#define gaim_value_get_object purple_value_get_object -#define gaim_value_get_pointer purple_value_get_pointer -#define gaim_value_get_enum purple_value_get_enum -#define gaim_value_get_boxed purple_value_get_boxed - -/* from version.h */ - -#define GAIM_MAJOR_VERSION PURPLE_MAJOR_VERSION -#define GAIM_MINOR_VERSION PURPLE_MINOR_VERSION -#define GAIM_MICRO_VERSION PURPLE_MICRO_VERSION - -#define GAIM_VERSION_CHECK PURPLE_VERSION_CHECK - -/* from whiteboard.h */ - -#define GaimWhiteboardPrplOps PurpleWhiteboardPrplOps -#define GaimWhiteboard PurpleWhiteboard -#define GaimWhiteboardUiOps PurpleWhiteboardUiOps - -#define gaim_whiteboard_set_ui_ops purple_whiteboard_set_ui_ops -#define gaim_whiteboard_set_prpl_ops purple_whiteboard_set_prpl_ops - -#define gaim_whiteboard_create purple_whiteboard_create -#define gaim_whiteboard_destroy purple_whiteboard_destroy -#define gaim_whiteboard_start purple_whiteboard_start -#define gaim_whiteboard_get_session purple_whiteboard_get_session -#define gaim_whiteboard_draw_list_destroy purple_whiteboard_draw_list_destroy -#define gaim_whiteboard_get_dimensions purple_whiteboard_get_dimensions -#define gaim_whiteboard_set_dimensions purple_whiteboard_set_dimensions -#define gaim_whiteboard_draw_point purple_whiteboard_draw_point -#define gaim_whiteboard_send_draw_list purple_whiteboard_send_draw_list -#define gaim_whiteboard_draw_line purple_whiteboard_draw_line -#define gaim_whiteboard_clear purple_whiteboard_clear -#define gaim_whiteboard_send_clear purple_whiteboard_send_clear -#define gaim_whiteboard_send_brush purple_whiteboard_send_brush -#define gaim_whiteboard_get_brush purple_whiteboard_get_brush -#define gaim_whiteboard_set_brush purple_whiteboard_set_brush - -/* for static plugins */ -#define gaim_init_ssl_plugin purple_init_ssl_plugin -#define gaim_init_ssl_openssl_plugin purple_init_ssl_openssl_plugin -#define gaim_init_ssl_gnutls_plugin purple_init_ssl_gnutls_plugin -#define gaim_init_gg_plugin purple_init_gg_plugin -#define gaim_init_jabber_plugin purple_init_jabber_plugin -#define gaim_init_sametime_plugin purple_init_sametime_plugin -#define gaim_init_msn_plugin purple_init_msn_plugin -#define gaim_init_novell_plugin purple_init_novell_plugin -#define gaim_init_qq_plugin purple_init_qq_plugin -#define gaim_init_simple_plugin purple_init_simple_plugin -#define gaim_init_yahoo_plugin purple_init_yahoo_plugin -#define gaim_init_zephyr_plugin purple_init_zephyr_plugin -#define gaim_init_aim_plugin purple_init_aim_plugin -#define gaim_init_icq_plugin purple_init_icq_plugin - -#endif /* _GAIM_COMPAT_H_ */ diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index b6a5bd4642..70b5c6b50e 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -107,7 +107,6 @@ pidgin_headers = \ gtkicon-theme.h \ gtkicon-theme-loader.h \ gtkidle.h \ - gtkgaim-compat.h \ gtkimhtml.h \ gtkimhtmltoolbar.h \ gtklog.h \ diff --git a/pidgin/gtkgaim-compat.h b/pidgin/gtkgaim-compat.h deleted file mode 100644 index 778ad303bf..0000000000 --- a/pidgin/gtkgaim-compat.h +++ /dev/null @@ -1,412 +0,0 @@ -/** - * @file gtkgaim-compat.h Gtk Gaim Compat macros - */ - -/* pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#ifndef _GTKGAIM_COMPAT_H_ -#define _GTKGAIM_COMPAT_H_ - -#include - -#define GAIM_ALERT_TITLE PIDGIN_ALERT_TITLE -#define GAIM_BROWSER_CURRENT PIDGIN_BROWSER_CURRENT -#define GAIM_BROWSER_DEFAULT PIDGIN_BROWSER_DEFAULT -#define GAIM_BROWSER_NEW_TAB PIDGIN_BROWSER_NEW_TAB -#define GAIM_BROWSER_NEW_WINDOW PIDGIN_BROWSER_NEW_WINDOW -#define GaimBrowserPlace PidginBrowserPlace -#define GAIM_BUTTON_HORIZONTAL PIDGIN_BUTTON_HORIZONTAL -#define GAIM_BUTTON_IMAGE PIDGIN_BUTTON_IMAGE -#define GAIM_BUTTON_NONE PIDGIN_BUTTON_NONE -#define GaimButtonOrientation PidginButtonOrientation -#define GaimButtonStyle PidginButtonStyle -#define GAIM_BUTTON_TEXT_IMAGE PIDGIN_BUTTON_TEXT_IMAGE -#define GAIM_BUTTON_TEXT PIDGIN_BUTTON_TEXT -#define GAIM_BUTTON_VERTICAL PIDGIN_BUTTON_VERTICAL -#define GaimConvPlacementFunc PidginConvPlacementFunc -#define GAIM_DIALOG PIDGIN_DIALOG -#define gaim_dnd_file_manage pidgin_dnd_file_manage -#define gaim_get_gtkxfer_dialog pidgin_get_xfer_dialog -#define gaim_gtk_account_dialog_show pidgin_account_dialog_show -#define GaimGtkAccountDialogType PidginAccountDialogType -#define gaim_gtk_account_get_handle pidgin_account_get_handle -#define gaim_gtk_account_init pidgin_account_init -#define gaim_gtk_account_option_menu_get_selected pidgin_account_option_menu_get_selected -#define gaim_gtk_account_option_menu_new pidgin_account_option_menu_new -#define gaim_gtk_account_option_menu_set_selected pidgin_account_option_menu_set_selected -#define gaim_gtk_accounts_get_ui_ops pidgin_accounts_get_ui_ops -#define gaim_gtk_accounts_window_hide pidgin_accounts_window_hide -#define gaim_gtk_accounts_window_show pidgin_accounts_window_show -#define gaim_gtk_account_uninit pidgin_account_uninit -#define GAIM_GTK_ADD_ACCOUNT_DIALOG PIDGIN_ADD_ACCOUNT_DIALOG -#define gaim_gtk_append_blist_node_extended_menu pidgin_append_blist_node_extended_menu -#define gaim_gtk_append_blist_node_privacy_menu pidgin_append_blist_node_privacy_menu -#define gaim_gtk_append_blist_node_proto_menu pidgin_append_blist_node_proto_menu -#define gaim_gtk_append_menu_action pidgin_append_menu_action -#define gaim_gtk_blist_add_alert pidgin_blist_add_alert -#define gaim_gtk_blist_get_default_gtk_blist pidgin_blist_get_default_gtk_blist -#define gaim_gtk_blist_get_handle pidgin_blist_get_handle -#define gaim_gtk_blist_get_sort_methods pidgin_blist_get_sort_methods -#define gaim_gtk_blist_get_status_icon pidgin_blist_get_status_icon -#define gaim_gtk_blist_get_ui_ops pidgin_blist_get_ui_ops -#define gaim_gtk_blist_init pidgin_blist_init -#define gaim_gtk_blist_joinchat_is_showable pidgin_blist_joinchat_is_showable -#define gaim_gtk_blist_joinchat_show pidgin_blist_joinchat_show -#define gaim_gtk_blist_make_buddy_menu pidgin_blist_make_buddy_menu -#define gaim_gtk_blist_node_is_contact_expanded pidgin_blist_node_is_contact_expanded -#define GAIM_GTK_BLIST PIDGIN_BLIST -#define gaim_gtk_blist_refresh pidgin_blist_refresh -#define gaim_gtk_blist_set_headline pidgin_blist_set_headline -#define gaim_gtk_blist_setup_sort_methods pidgin_blist_setup_sort_methods -#define gaim_gtk_blist_sort_function pidgin_blist_sort_function -#define gaim_gtk_blist_sort_method pidgin_blist_sort_method -#define GaimGtkBlistSortMethod PidginBlistSortMethod -#define gaim_gtk_blist_sort_method_reg pidgin_blist_sort_method_reg -#define gaim_gtk_blist_sort_method_set pidgin_blist_sort_method_set -#define gaim_gtk_blist_sort_method_unreg pidgin_blist_sort_method_unreg -#define gaim_gtk_blist_toggle_visibility pidgin_blist_toggle_visibility -#define gaim_gtk_blist_uninit pidgin_blist_uninit -#define gaim_gtk_blist_update_account_error_state pidgin_blist_update_account_error_state -#define gaim_gtk_blist_update_accounts_menu pidgin_blist_update_accounts_menu -#define gaim_gtk_blist_update_columns pidgin_blist_update_columns -#define gaim_gtk_blist_update_plugin_actions pidgin_blist_update_plugin_actions -#define gaim_gtk_blist_update_refresh_timeout pidgin_blist_update_refresh_timeout -#define gaim_gtk_blist_update_sort_methods pidgin_blist_update_sort_methods -#define gaim_gtk_blist_visibility_manager_add pidgin_blist_visibility_manager_add -#define gaim_gtk_blist_visibility_manager_remove pidgin_blist_visibility_manager_remove -#define gaim_gtk_buddy_icon_chooser_new pidgin_buddy_icon_chooser_new -#define gaim_gtk_buddy_icon_get_scale_size pidgin_buddy_icon_get_scale_size -#define GaimGtkBuddyList PidginBuddyList -#define GaimGtkCellRendererExpanderClass PidginCellRendererExpanderClass -#define gaim_gtk_cell_renderer_expander_get_type pidgin_cell_renderer_expander_get_type -#define gaim_gtk_cell_renderer_expander_new pidgin_cell_renderer_expander_new -#define GaimGtkCellRendererExpander PidginCellRendererExpander -#define GaimGtkCellRendererProgressClass PidginCellRendererProgressClass -#define gaim_gtk_cell_renderer_progress_get_type pidgin_cell_renderer_progress_get_type -#define gaim_gtk_cell_renderer_progress_new pidgin_cell_renderer_progress_new -#define GaimGtkCellRendererProgress PidginCellRendererProgress -#define GaimGtkChatPane PidginChatPane -#define gaim_gtk_check_if_dir pidgin_check_if_dir -#define gaim_gtk_clear_cursor pidgin_clear_cursor -#define gaim_gtk_connection_get_handle pidgin_connection_get_handle -#define gaim_gtk_connection_init pidgin_connection_init -#define gaim_gtk_connections_get_ui_ops pidgin_connections_get_ui_ops -#define gaim_gtk_connection_uninit pidgin_connection_uninit -#define GaimGtkConversation PidginConversation -#define GAIM_GTK_CONVERSATION PIDGIN_CONVERSATION -#define gaim_gtk_conversations_fill_menu pidgin_conversations_fill_menu -#define gaim_gtk_conversations_find_unseen_list pidgin_conversations_find_unseen_list -#define gaim_gtk_conversations_get_conv_ui_ops pidgin_conversations_get_conv_ui_ops -#define gaim_gtk_conversations_get_handle pidgin_conversations_get_handle -#define gaim_gtk_conversations_init pidgin_conversations_init -#define gaim_gtk_conversations_uninit pidgin_conversations_uninit -#define gaim_gtk_convert_buddy_icon pidgin_convert_buddy_icon -#define gaim_gtkconv_get_tab_at_xy pidgin_conv_get_tab_at_xy -#define gaim_gtkconv_get_tab_icon pidgin_conv_get_tab_icon -#define gaim_gtkconv_get_window pidgin_conv_get_window -#define gaim_gtkconv_is_hidden pidgin_conv_is_hidden -#define gaim_gtkconv_new pidgin_conv_new -#define gaim_gtkconv_placement_add_fnc pidgin_conv_placement_add_fnc -#define gaim_gtkconv_placement_get_current_func pidgin_conv_placement_get_current_func -#define gaim_gtkconv_placement_get_fnc pidgin_conv_placement_get_fnc -#define gaim_gtkconv_placement_get_name pidgin_conv_placement_get_name -#define gaim_gtkconv_placement_get_options pidgin_conv_placement_get_options -#define gaim_gtkconv_placement_place pidgin_conv_placement_place -#define gaim_gtkconv_placement_remove_fnc pidgin_conv_placement_remove_fnc -#define gaim_gtkconv_placement_set_current_func pidgin_conv_placement_set_current_func -#define gaim_gtkconv_present_conversation pidgin_conv_present_conversation -#define gaim_gtkconv_switch_active_conversation pidgin_conv_switch_active_conversation -#define gaim_gtkconv_update_buddy_icon pidgin_conv_update_buddy_icon -#define gaim_gtkconv_update_buttons_by_protocol pidgin_conv_update_buttons_by_protocol -#define gaim_gtk_conv_window_add_gtkconv pidgin_conv_window_add_gtkconv -#define gaim_gtk_conv_window_destroy pidgin_conv_window_destroy -#define gaim_gtk_conv_window_first_with_type pidgin_conv_window_first_with_type -#define gaim_gtk_conv_window_get_active_conversation pidgin_conv_window_get_active_conversation -#define gaim_gtk_conv_window_get_active_gtkconv pidgin_conv_window_get_active_gtkconv -#define gaim_gtk_conv_window_get_at_xy pidgin_conv_window_get_at_xy -#define gaim_gtk_conv_window_get_gtkconv_at_index pidgin_conv_window_get_gtkconv_at_index -#define gaim_gtk_conv_window_get_gtkconv_count pidgin_conv_window_get_gtkconv_count -#define gaim_gtk_conv_window_get_gtkconvs pidgin_conv_window_get_gtkconvs -#define gaim_gtk_conv_window_has_focus pidgin_conv_window_has_focus -#define gaim_gtk_conv_window_hide pidgin_conv_window_hide -#define gaim_gtk_conv_window_is_active_conversation pidgin_conv_window_is_active_conversation -#define gaim_gtk_conv_window_last_with_type pidgin_conv_window_last_with_type -#define gaim_gtk_conv_window_new pidgin_conv_window_new -#define gaim_gtk_conv_window_raise pidgin_conv_window_raise -#define gaim_gtk_conv_window_remove_gtkconv pidgin_conv_window_remove_gtkconv -#define gaim_gtk_conv_windows_get_list pidgin_conv_windows_get_list -#define gaim_gtk_conv_window_show pidgin_conv_window_show -#define gaim_gtk_conv_window_switch_gtkconv pidgin_conv_window_switch_gtkconv -#define gaim_gtk_create_imhtml pidgin_create_imhtml -#define gaim_gtk_debug_get_handle pidgin_debug_get_handle -#define gaim_gtk_debug_get_ui_ops pidgin_debug_get_ui_ops -#define gaim_gtk_debug_init pidgin_debug_init -#define gaim_gtk_debug_uninit pidgin_debug_uninit -#define gaim_gtk_debug_window_hide pidgin_debug_window_hide -#define gaim_gtk_debug_window_show pidgin_debug_window_show -#define gaim_gtkdialogs_about pidgin_dialogs_about -#define gaim_gtkdialogs_alias_buddy pidgin_dialogs_alias_buddy -#define gaim_gtkdialogs_alias_chat pidgin_dialogs_alias_chat -#define gaim_gtkdialogs_alias_contact pidgin_dialogs_alias_contact -#define gaim_gtkdialogs_destroy_all pidgin_dialogs_destroy_all -#define gaim_gtkdialogs_im pidgin_dialogs_im -#define gaim_gtkdialogs_im_with_user pidgin_dialogs_im_with_user -#define gaim_gtkdialogs_info pidgin_dialogs_info -#define gaim_gtkdialogs_log pidgin_dialogs_log -#define gaim_gtkdialogs_merge_groups pidgin_dialogs_merge_groups -#define gaim_gtkdialogs_remove_buddy pidgin_dialogs_remove_buddy -#define gaim_gtkdialogs_remove_chat pidgin_dialogs_remove_chat -#define gaim_gtkdialogs_remove_contact pidgin_dialogs_remove_contact -#define gaim_gtkdialogs_remove_group pidgin_dialogs_remove_group -#define gaim_gtk_docklet_clicked pidgin_docklet_clicked -#define gaim_gtk_docklet_embedded pidgin_docklet_embedded -#define gaim_gtk_docklet_get_handle pidgin_docklet_get_handle -#define gaim_gtk_docklet_init pidgin_docklet_init -#define gaim_gtk_docklet_remove pidgin_docklet_remove -#define gaim_gtk_docklet_set_ui_ops pidgin_docklet_set_ui_ops -#define gaim_gtk_docklet_uninit pidgin_docklet_uninit -#define gaim_gtk_docklet_unload pidgin_docklet_unload -#define gaim_gtk_eventloop_get_ui_ops pidgin_eventloop_get_ui_ops -#define gaim_gtk_idle_get_ui_ops pidgin_idle_get_ui_ops -#define GaimGtkImPane PidginImPane -#define gaim_gtk_load_accels pidgin_load_accels -#define gaim_gtk_log_get_handle pidgin_log_get_handle -#define gaim_gtk_log_init pidgin_log_init -#define gaim_gtk_log_show_contact pidgin_log_show_contact -#define gaim_gtk_log_show pidgin_log_show -#define gaim_gtk_log_uninit pidgin_log_uninit -#define GaimGtkLogViewer PidginLogViewer -#define gaim_gtk_make_frame pidgin_make_frame -#define gaim_gtk_make_mini_dialog pidgin_make_mini_dialog -#define gaim_gtk_make_pretty_arrows pidgin_make_pretty_arrows -#define gaim_gtk_menu_tray_append pidgin_menu_tray_append -#define GaimGtkMenuTrayClass PidginMenuTrayClass -#define gaim_gtk_menu_tray_get_box pidgin_menu_tray_get_box -#define gaim_gtk_menu_tray_get_gtype pidgin_menu_tray_get_gtype -#define gaim_gtk_menu_tray_new pidgin_menu_tray_new -#define GaimGtkMenuTray PidginMenuTray -#define GAIM_GTK_MENU_TRAY PIDGIN_MENU_TRAY -#define gaim_gtk_menu_tray_prepend pidgin_menu_tray_prepend -#define gaim_gtk_menu_tray_set_tooltip pidgin_menu_tray_set_tooltip -#define GAIM_GTK_MODIFY_ACCOUNT_DIALOG PIDGIN_MODIFY_ACCOUNT_DIALOG -#define gaim_gtk_notify_get_ui_ops pidgin_notify_get_ui_ops -#define gaim_gtk_parse_x_im_contact pidgin_parse_x_im_contact -#define gaim_gtk_plugin_dialog_show pidgin_plugin_dialog_show -#define gaim_gtk_plugin_get_config_frame pidgin_plugin_get_config_frame -#define GAIM_GTK_PLUGIN PIDGIN_PLUGIN -#define gaim_gtk_plugin_pref_create_frame pidgin_plugin_pref_create_frame -#define gaim_gtk_plugins_save pidgin_plugins_save -#define GAIM_GTK_PLUGIN_TYPE PIDGIN_PLUGIN_TYPE -#define GaimGtkPluginUiInfo PidginPluginUiInfo -#define GAIM_GTK_PLUGIN_UI_INFO PIDGIN_PLUGIN_UI_INFO -#define gaim_gtk_pounce_editor_show pidgin_pounce_editor_show -#define gaim_gtk_pounces_get_handle pidgin_pounces_get_handle -#define gaim_gtk_pounces_init pidgin_pounces_init -#define gaim_gtk_pounces_manager_hide pidgin_pounces_manager_hide -#define gaim_gtk_pounces_manager_show pidgin_pounces_manager_show -#define gaim_gtk_prefs_checkbox pidgin_prefs_checkbox -#define gaim_gtk_prefs_dropdown_from_list pidgin_prefs_dropdown_from_list -#define gaim_gtk_prefs_dropdown pidgin_prefs_dropdown -#define gaim_gtk_prefs_init pidgin_prefs_init -#define gaim_gtk_prefs_labeled_entry pidgin_prefs_labeled_entry -#define gaim_gtk_prefs_labeled_spin_button pidgin_prefs_labeled_spin_button -#define gaim_gtk_prefs_show pidgin_prefs_show -#define gaim_gtk_prefs_update_old pidgin_prefs_update_old -#define gaim_gtk_privacy_dialog_hide pidgin_privacy_dialog_hide -#define gaim_gtk_privacy_dialog_show pidgin_privacy_dialog_show -#define gaim_gtk_privacy_get_ui_ops pidgin_privacy_get_ui_ops -#define gaim_gtk_privacy_init pidgin_privacy_init -#define gaim_gtk_protocol_option_menu_new pidgin_protocol_option_menu_new -#define gaim_gtk_request_add_block pidgin_request_add_block -#define gaim_gtk_request_add_permit pidgin_request_add_permit -#define gaim_gtk_request_get_ui_ops pidgin_request_get_ui_ops -#define gaim_gtk_roomlist_dialog_show pidgin_roomlist_dialog_show -#define gaim_gtk_roomlist_dialog_show_with_account pidgin_roomlist_dialog_show_with_account -#define gaim_gtk_roomlist_init pidgin_roomlist_init -#define gaim_gtk_roomlist_is_showable pidgin_roomlist_is_showable -#define gaim_gtk_save_accels_cb pidgin_save_accels_cb -#define gaim_gtk_save_accels pidgin_save_accels -#define gaim_gtk_session_end pidgin_session_end -#define gaim_gtk_session_init pidgin_session_init -#define gaim_gtk_set_cursor pidgin_set_cursor -#define gaim_gtk_set_custom_buddy_icon pidgin_set_custom_buddy_icon -#define gaim_gtk_set_sensitive_if_input pidgin_set_sensitive_if_input -#define gaim_gtk_setup_gtkspell pidgin_setup_gtkspell -#define gaim_gtk_setup_screenname_autocomplete pidgin_setup_screenname_autocomplete -#define gaim_gtk_set_urgent pidgin_set_urgent -#define gaim_gtk_sound_get_event_label pidgin_sound_get_event_label -#define gaim_gtk_sound_get_event_option pidgin_sound_get_event_option -#define gaim_gtk_sound_get_handle pidgin_sound_get_handle -#define gaim_gtk_sound_get_ui_ops pidgin_sound_get_ui_ops -#define gaim_gtk_status_editor_show pidgin_status_editor_show -#define gaim_gtk_status_get_handle pidgin_status_get_handle -#define gaim_gtk_status_init pidgin_status_init -#define gaim_gtk_status_menu pidgin_status_menu -#define gaim_gtk_status_uninit pidgin_status_uninit -#define gaim_gtk_status_window_hide pidgin_status_window_hide -#define gaim_gtk_status_window_show pidgin_status_window_show -#define gaim_gtk_stock_init pidgin_stock_init -#define gaim_gtk_syslog_show pidgin_syslog_show -#define gaim_gtkthemes_get_proto_smileys pidgin_themes_get_proto_smileys -#define gaim_gtkthemes_init pidgin_themes_init -#define gaim_gtkthemes_load_smiley_theme pidgin_themes_load_smiley_theme -#define gaim_gtkthemes_smileys_disabled pidgin_themes_smileys_disabled -#define gaim_gtkthemes_smiley_themeize pidgin_themes_smiley_themeize -#define gaim_gtkthemes_smiley_theme_probe pidgin_themes_smiley_theme_probe -#define gaim_gtk_toggle_sensitive_array pidgin_toggle_sensitive_array -#define gaim_gtk_toggle_sensitive pidgin_toggle_sensitive -#define gaim_gtk_toggle_showhide pidgin_toggle_showhide -#define gaim_gtk_treeview_popup_menu_position_func pidgin_treeview_popup_menu_position_func -#define gaim_gtk_tree_view_search_equal_func pidgin_tree_view_search_equal_func -#define GAIM_GTK_TYPE_MENU_TRAY PIDGIN_TYPE_MENU_TRAY -#define GAIM_GTK_UI PIDGIN_UI -#define gaim_gtk_whiteboard_get_ui_ops pidgin_whiteboard_get_ui_ops -#define GaimGtkWhiteboard PidginWhiteboard -#define GaimGtkWindow PidginWindow -#define gaim_gtkxfer_dialog_add_xfer pidgin_xfer_dialog_add_xfer -#define gaim_gtkxfer_dialog_cancel_xfer pidgin_xfer_dialog_cancel_xfer -#define gaim_gtkxfer_dialog_destroy pidgin_xfer_dialog_destroy -#define gaim_gtkxfer_dialog_hide pidgin_xfer_dialog_hide -#define gaim_gtkxfer_dialog_new pidgin_xfer_dialog_new -#define GaimGtkXferDialog PidginXferDialog -#define gaim_gtkxfer_dialog_remove_xfer pidgin_xfer_dialog_remove_xfer -#define gaim_gtkxfer_dialog_show pidgin_xfer_dialog_show -#define gaim_gtkxfer_dialog_update_xfer pidgin_xfer_dialog_update_xfer -#define gaim_gtk_xfers_get_ui_ops pidgin_xfers_get_ui_ops -#define gaim_gtk_xfers_init pidgin_xfers_init -#define gaim_gtk_xfers_uninit pidgin_xfers_uninit -#define GAIM_HIG_BORDER PIDGIN_HIG_BORDER -#define GAIM_HIG_BOX_SPACE PIDGIN_HIG_BOX_SPACE -#define GAIM_HIG_CAT_SPACE PIDGIN_HIG_CAT_SPACE -#if !GTK_CHECK_VERSION(2,16,0) -#define GAIM_INVISIBLE_CHAR PIDGIN_INVISIBLE_CHAR -#endif /* Less than GTK+ 2.16 */ -#define GAIM_IS_GTK_CONVERSATION PIDGIN_IS_PIDGIN_CONVERSATION -#define GAIM_IS_GTK_PLUGIN PIDGIN_IS_PIDGIN_PLUGIN -#define gaim_new_check_item pidgin_new_check_item -#define gaim_new_item_from_stock pidgin_new_item_from_stock -#define gaim_new_item pidgin_new_item -#define gaim_pixbuf_button_from_stock pidgin_pixbuf_button_from_stock -#define gaim_pixbuf_toolbar_button_from_stock pidgin_pixbuf_toolbar_button_from_stock -#define GaimScrollBookClass PidginScrollBookClass -#define gaim_scroll_book_get_type pidgin_scroll_book_get_type -#define gaim_scroll_book_new pidgin_scroll_book_new -#define GaimScrollBook PidginScrollBook -#define gaim_separator pidgin_separator -#define gaim_set_accessible_label pidgin_set_accessible_label -#define gaim_set_gtkxfer_dialog pidgin_set_xfer_dialog -#define gaim_setup_imhtml pidgin_setup_imhtml -#define gaim_status_box_add pidgin_status_box_add -#define gaim_status_box_add_separator pidgin_status_box_add_separator -#define GaimStatusBoxClass PidginStatusBoxClass -#define gaim_status_box_get_buddy_icon pidgin_status_box_get_buddy_icon -#define gaim_status_box_get_message pidgin_status_box_get_message -#define gaim_status_box_get_type pidgin_status_box_get_type -#define GaimStatusBoxItemType PidginStatusBoxItemType -#define gaim_status_box_new pidgin_status_box_new -#define gaim_status_box_new_with_account pidgin_status_box_new_with_account -#define GaimStatusBox PidginStatusBox -#define gaim_status_box_pulse_connecting pidgin_status_box_pulse_connecting -#define gaim_status_box_set_buddy_icon pidgin_status_box_set_buddy_icon -#define gaim_status_box_set_connecting pidgin_status_box_set_connecting -#define gaim_status_box_set_network_available pidgin_status_box_set_network_available -#define GAIM_STATUS_ICON_LARGE PIDGIN_STATUS_ICON_LARGE -#define GaimStatusIconSize PidginStatusIconSize -#define GAIM_STATUS_ICON_SMALL PIDGIN_STATUS_ICON_SMALL -#define GAIM_STOCK_ABOUT PIDGIN_STOCK_ABOUT -#define GAIM_STOCK_ACTION PIDGIN_STOCK_ACTION -#define GAIM_STOCK_ALIAS PIDGIN_STOCK_ALIAS -#define GAIM_STOCK_AWAY PIDGIN_STOCK_AWAY -#define GAIM_STOCK_CHAT PIDGIN_STOCK_CHAT -#define GAIM_STOCK_CLEAR PIDGIN_STOCK_CLEAR -#define GAIM_STOCK_CLOSE_TABS PIDGIN_STOCK_CLOSE_TABS -#define GAIM_STOCK_DEBUG PIDGIN_STOCK_DEBUG -#define GAIM_STOCK_DIALOG_AUTH PIDGIN_STOCK_DIALOG_AUTH -#define GAIM_STOCK_DIALOG_COOL PIDGIN_STOCK_DIALOG_COOL -#define GAIM_STOCK_DIALOG_ERROR PIDGIN_STOCK_DIALOG_ERROR -#define GAIM_STOCK_DIALOG_INFO PIDGIN_STOCK_DIALOG_INFO -#define GAIM_STOCK_DIALOG_QUESTION PIDGIN_STOCK_DIALOG_QUESTION -#define GAIM_STOCK_DIALOG_WARNING PIDGIN_STOCK_DIALOG_WARNING -#define GAIM_STOCK_DISCONNECT PIDGIN_STOCK_DISCONNECT -#define GAIM_STOCK_DOWNLOAD PIDGIN_STOCK_DOWNLOAD -#define GAIM_STOCK_EDIT PIDGIN_STOCK_EDIT -#define GAIM_STOCK_FGCOLOR PIDGIN_STOCK_FGCOLOR -#define GAIM_STOCK_FILE_CANCELED PIDGIN_STOCK_FILE_CANCELED -#define GAIM_STOCK_FILE_DONE PIDGIN_STOCK_FILE_DONE -#define GAIM_STOCK_FILE_TRANSFER PIDGIN_STOCK_FILE_TRANSFER -#define GAIM_STOCK_IGNORE PIDGIN_STOCK_IGNORE -#define GAIM_STOCK_IM "gaim-im" /* foo... */ -#define GAIM_STOCK_INVITE PIDGIN_STOCK_INVITE -#define GAIM_STOCK_MODIFY PIDGIN_STOCK_MODIFY -#define GAIM_STOCK_OPEN_MAIL PIDGIN_STOCK_OPEN_MAIL -#define GAIM_STOCK_PAUSE PIDGIN_STOCK_PAUSE -#define GAIM_STOCK_POUNCE PIDGIN_STOCK_POUNCE -#define GAIM_STOCK_SIGN_OFF PIDGIN_STOCK_SIGN_OFF -#define GAIM_STOCK_SIGN_ON PIDGIN_STOCK_SIGN_ON -#define GAIM_STOCK_STATUS_OFFLINE PIDGIN_STOCK_STATUS_OFFLINE -#define GAIM_STOCK_TEXT_NORMAL PIDGIN_STOCK_TEXT_NORMAL -#define GAIM_STOCK_TYPED PIDGIN_STOCK_TYPED -#define GAIM_STOCK_UPLOAD PIDGIN_STOCK_UPLOAD -#define GAIM_TYPE_GTK_CELL_RENDERER_EXPANDER PIDGIN_TYPE_GTK_CELL_RENDERER_EXPANDER -#define GAIM_TYPE_GTK_CELL_RENDERER_PROGRESS PIDGIN_TYPE_GTK_CELL_RENDERER_PROGRESS -#define GAIM_UNSEEN_EVENT PIDGIN_UNSEEN_EVENT -#define GAIM_UNSEEN_NICK PIDGIN_UNSEEN_NICK -#define GAIM_UNSEEN_NO_LOG PIDGIN_UNSEEN_NO_LOG -#define GAIM_UNSEEN_NONE PIDGIN_UNSEEN_NONE -#define GaimUnseenState PidginUnseenState -#define GAIM_UNSEEN_TEXT PIDGIN_UNSEEN_TEXT -#define GAIM_WINDOW_ICONIFIED PIDGIN_WINDOW_ICONIFIED -#define GTK_GAIM_IS_SCROLL_BOOK_CLASS PIDGIN_IS_SCROLL_BOOK_CLASS -#define GTK_GAIM_IS_SCROLL_BOOK PIDGIN_IS_SCROLL_BOOK -#define GTK_GAIM_IS_STATUS_BOX_CLASS PIDGIN_IS_STATUS_BOX_CLASS -#define GTK_GAIM_IS_STATUS_BOX PIDGIN_IS_STATUS_BOX -#define GTK_GAIM_SCROLL_BOOK_CLASS PIDGIN_SCROLL_BOOK_CLASS -#define GTK_GAIM_SCROLL_BOOK_GET_CLASS PIDGIN_SCROLL_BOOK_GET_CLASS -#define gtk_gaim_scroll_book_get_type pidgin_scroll_book_get_type -#define gtk_gaim_scroll_book_new pidgin_scroll_book_new -#define GTK_GAIM_SCROLL_BOOK PIDGIN_SCROLL_BOOK -#define gtk_gaim_status_box_add pidgin_status_box_add -#define gtk_gaim_status_box_add_separator pidgin_status_box_add_separator -#define GTK_GAIM_STATUS_BOX_CLASS PIDGIN_STATUS_BOX_CLASS -#define gtk_gaim_status_box_get_buddy_icon pidgin_status_box_get_buddy_icon -#define GTK_GAIM_STATUS_BOX_GET_CLASS PIDGIN_STATUS_BOX_GET_CLASS -#define gtk_gaim_status_box_get_message pidgin_status_box_get_message -#define gtk_gaim_status_box_get_type pidgin_status_box_get_type -#define GtkGaimStatusBoxItemType PidginStatusBoxItemType -#define gtk_gaim_status_box_new pidgin_status_box_new -#define gtk_gaim_status_box_new_with_account pidgin_status_box_new_with_account -#define GTK_GAIM_STATUS_BOX_NUM_TYPES PIDGIN_STATUS_BOX_NUM_TYPES -#define GtkGaimStatusBox PidginStatusBox -#define GTK_GAIM_STATUS_BOX PIDGIN_STATUS_BOX -#define gtk_gaim_status_box_pulse_connecting pidgin_status_box_pulse_connecting -#define gtk_gaim_status_box_set_buddy_icon pidgin_status_box_set_buddy_icon -#define gtk_gaim_status_box_set_connecting pidgin_status_box_set_connecting -#define gtk_gaim_status_box_set_network_available pidgin_status_box_set_network_available -#define GTK_GAIM_STATUS_BOX_TYPE_CUSTOM PIDGIN_STATUS_BOX_TYPE_CUSTOM -#define GTK_GAIM_STATUS_BOX_TYPE_POPULAR PIDGIN_STATUS_BOX_TYPE_POPULAR -#define GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE PIDGIN_STATUS_BOX_TYPE_PRIMITIVE -#define GTK_GAIM_STATUS_BOX_TYPE_SAVED PIDGIN_STATUS_BOX_TYPE_SAVED -#define GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR PIDGIN_STATUS_BOX_TYPE_SEPARATOR -#define GTK_GAIM_TYPE_SCROLL_BOOK PIDGIN_TYPE_SCROLL_BOOK -#define GTK_GAIM_TYPE_STATUS_BOX PIDGIN_TYPE_STATUS_BOX - -#endif /* _GTKGAIM_COMPAT_H */ -- cgit v1.2.1 From 542d804ae2aaa4ae406e66954afd2ae70daffb4c Mon Sep 17 00:00:00 2001 From: Richard Laager Date: Fri, 18 Mar 2011 02:59:12 +0000 Subject: Drop the .gaim -> .purple migration code --- ChangeLog.API | 5 + finch/finch.c | 23 --- finch/gntprefs.c | 8 -- libpurple/account.c | 9 -- libpurple/buddyicon.c | 200 ++------------------------ libpurple/core.c | 380 -------------------------------------------------- libpurple/core.h | 11 -- libpurple/internal.h | 6 - pidgin/gtkmain.c | 42 ------ pidgin/gtkprefs.c | 8 -- 10 files changed, 19 insertions(+), 673 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index b584b311e0..f119772cb2 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -1,5 +1,10 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul +version 3.0.0 (??/??/????): + libpurple: + Removed: + * purple_core_migrate + version 2.8.0 (??/??/????): libpurple: Added: diff --git a/finch/finch.c b/finch/finch.c index 98f94b529b..a734e98e8f 100644 --- a/finch/finch.c +++ b/finch/finch.c @@ -334,29 +334,6 @@ init_libpurple(int argc, char **argv) /* We don't want debug-messages to show up and corrupt the display */ purple_debug_set_enabled(debug_enabled); - /* If we're using a custom configuration directory, we - * do NOT want to migrate, or weird things will happen. */ - if (opt_config_dir_arg == NULL) - { - if (!purple_core_migrate()) - { - char *old = g_strconcat(purple_home_dir(), - G_DIR_SEPARATOR_S ".gaim", NULL); - char *text = g_strdup_printf(_( - "%s encountered errors migrating your settings " - "from %s to %s. Please investigate and complete the " - "migration by hand. Please report this error at http://developer.pidgin.im"), _("Finch"), - old, purple_user_dir()); - - g_free(old); - - purple_print_utf8_to_console(stderr, text); - g_free(text); - - return 0; - } - } - purple_core_set_ui_ops(gnt_core_get_ui_ops()); purple_eventloop_set_ui_ops(gnt_eventloop_get_ui_ops()); purple_idle_set_ui_ops(finch_idle_get_ui_ops()); diff --git a/finch/gntprefs.c b/finch/gntprefs.c index 02ebf6a98e..f1870976a9 100644 --- a/finch/gntprefs.c +++ b/finch/gntprefs.c @@ -62,14 +62,6 @@ void finch_prefs_init() void finch_prefs_update_old() { - const char *str = NULL; - - purple_prefs_rename("/gaim/gnt", "/finch"); - purple_prefs_rename("/purple/gnt", "/finch"); - - if ((str = purple_prefs_get_string("/purple/away/idle_reporting")) && - strcmp(str, "gaim") == 0) - purple_prefs_set_string("/purple/away/idle_reporting", "purple"); } typedef struct diff --git a/libpurple/account.c b/libpurple/account.c index 338f7d5607..b3668feb32 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -921,15 +921,6 @@ parse_account(xmlnode *node) { purple_buddy_icons_set_account_icon(ret, (guchar *)contents, len); } - else - { - /* Try to see if the icon got left behind in the old cache. */ - g_free(filename); - filename = g_build_filename(g_get_home_dir(), ".gaim", "icons", data, NULL); - if (g_file_get_contents(filename, &contents, &len, NULL)) { - purple_buddy_icons_set_account_icon(ret, (guchar*)contents, len); - } - } g_free(filename); g_free(data); diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c index 6e50a0d403..813d810ab5 100644 --- a/libpurple/buddyicon.c +++ b/libpurple/buddyicon.c @@ -105,9 +105,6 @@ static char *cache_dir = NULL; /** "Should icons be cached to disk?" */ static gboolean icon_caching = TRUE; -/* For ~/.gaim to ~/.purple migration. */ -static char *old_icons_dir = NULL; - static void delete_buddy_icon_settings(PurpleBlistNode *node, const char *setting_name); /* @@ -977,12 +974,6 @@ purple_buddy_icons_set_custom_icon(PurpleContact *contact, guchar *icon_data, return purple_buddy_icons_node_set_custom_icon((PurpleBlistNode*)contact, icon_data, icon_len); } -void -_purple_buddy_icon_set_old_icons_dir(const char *dirname) -{ - old_icons_dir = g_strdup(dirname); -} - static void delete_buddy_icon_settings(PurpleBlistNode *node, const char *setting_name) { @@ -995,133 +986,6 @@ delete_buddy_icon_settings(PurpleBlistNode *node, const char *setting_name) } } -static void -migrate_buddy_icon(PurpleBlistNode *node, const char *setting_name, - const char *dirname, const char *filename) -{ - char *path; - - if (filename[0] != '/') - { - path = g_build_filename(dirname, filename, NULL); - if (g_file_test(path, G_FILE_TEST_EXISTS)) - { - g_free(path); - return; - } - g_free(path); - - path = g_build_filename(old_icons_dir, filename, NULL); - } - else - path = g_strdup(filename); - - if (g_file_test(path, G_FILE_TEST_EXISTS)) - { - guchar *icon_data; - size_t icon_len; - FILE *file; - char *new_filename; - - if (!read_icon_file(path, &icon_data, &icon_len)) - { - g_free(path); - delete_buddy_icon_settings(node, setting_name); - return; - } - - if (icon_data == NULL || icon_len <= 0) - { - /* This really applies to the icon_len check. - * icon_data should never be NULL if - * read_icon_file() returns TRUE. */ - purple_debug_error("buddyicon", "Empty buddy icon file: %s\n", path); - delete_buddy_icon_settings(node, setting_name); - g_free(path); - return; - } - - g_free(path); - - new_filename = purple_util_get_image_filename(icon_data, icon_len); - if (new_filename == NULL) - { - purple_debug_error("buddyicon", - "New icon filename is NULL. This should never happen! " - "The old filename was: %s\n", path); - delete_buddy_icon_settings(node, setting_name); - g_return_if_reached(); - } - - path = g_build_filename(dirname, new_filename, NULL); - if ((file = g_fopen(path, "wb")) != NULL) - { - if (!fwrite(icon_data, icon_len, 1, file)) - { - purple_debug_error("buddyicon", "Error writing %s: %s\n", - path, g_strerror(errno)); - } - else - purple_debug_info("buddyicon", "Wrote migrated cache file: %s\n", path); - - fclose(file); - } - else - { - purple_debug_error("buddyicon", "Unable to create file %s: %s\n", - path, g_strerror(errno)); - g_free(new_filename); - g_free(path); - - delete_buddy_icon_settings(node, setting_name); - return; - } - g_free(path); - - purple_blist_node_set_string(node, - setting_name, - new_filename); - ref_filename(new_filename); - - g_free(new_filename); - - if (purple_strequal(setting_name, "buddy_icon")) - { - const char *hash; - - hash = purple_blist_node_get_string(node, "avatar_hash"); - if (hash != NULL) - { - purple_blist_node_set_string(node, "icon_checksum", hash); - purple_blist_node_remove_setting(node, "avatar_hash"); - } - else - { - PurpleAccount *account = purple_buddy_get_account((PurpleBuddy *)node); - const char *prpl_id = purple_account_get_protocol_id(account); - - if (g_str_equal(prpl_id, "prpl-yahoo") || g_str_equal(prpl_id, "prpl-yahoojp")) - { - int checksum = purple_blist_node_get_int(node, "icon_checksum"); - if (checksum != 0) - { - char *checksum_str = g_strdup_printf("%i", checksum); - purple_blist_node_remove_setting(node, "icon_checksum"); - purple_blist_node_set_string(node, "icon_checksum", checksum_str); - g_free(checksum_str); - } - } - } - } - } - else - { - purple_debug_error("buddyicon", "Old icon file doesn't exist: %s\n", path); - delete_buddy_icon_settings(node, setting_name); - g_free(path); - } -} - void _purple_buddy_icons_account_loaded_cb() { @@ -1153,22 +1017,6 @@ _purple_buddy_icons_blist_loaded_cb() PurpleBlistNode *node = purple_blist_get_root(); const char *dirname = purple_buddy_icons_get_cache_dir(); - /* Doing this once here saves having to check it inside a loop. */ - if (old_icons_dir != NULL) - { - if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) - { - purple_debug_info("buddyicon", "Creating icon cache directory.\n"); - - if (g_mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) - { - purple_debug_error("buddyicon", - "Unable to create directory %s: %s\n", - dirname, g_strerror(errno)); - } - } - } - while (node != NULL) { if (PURPLE_BLIST_NODE_IS_BUDDY(node)) @@ -1178,26 +1026,17 @@ _purple_buddy_icons_blist_loaded_cb() filename = purple_blist_node_get_string(node, "buddy_icon"); if (filename != NULL) { - if (old_icons_dir != NULL) + char *path = g_build_filename(dirname, filename, NULL); + if (!g_file_test(path, G_FILE_TEST_EXISTS)) { - migrate_buddy_icon(node, - "buddy_icon", - dirname, filename); + purple_blist_node_remove_setting(node, + "buddy_icon"); + purple_blist_node_remove_setting(node, + "icon_checksum"); } else - { - char *path = g_build_filename(dirname, filename, NULL); - if (!g_file_test(path, G_FILE_TEST_EXISTS)) - { - purple_blist_node_remove_setting(node, - "buddy_icon"); - purple_blist_node_remove_setting(node, - "icon_checksum"); - } - else - ref_filename(filename); - g_free(path); - } + ref_filename(filename); + g_free(path); } } else if (PURPLE_BLIST_NODE_IS_CONTACT(node) || @@ -1209,24 +1048,15 @@ _purple_buddy_icons_blist_loaded_cb() filename = purple_blist_node_get_string(node, "custom_buddy_icon"); if (filename != NULL) { - if (old_icons_dir != NULL) + char *path = g_build_filename(dirname, filename, NULL); + if (!g_file_test(path, G_FILE_TEST_EXISTS)) { - migrate_buddy_icon(node, - "custom_buddy_icon", - dirname, filename); + purple_blist_node_remove_setting(node, + "custom_buddy_icon"); } else - { - char *path = g_build_filename(dirname, filename, NULL); - if (!g_file_test(path, G_FILE_TEST_EXISTS)) - { - purple_blist_node_remove_setting(node, - "custom_buddy_icon"); - } - else - ref_filename(filename); - g_free(path); - } + ref_filename(filename); + g_free(path); } } node = purple_blist_node_next(node, TRUE); @@ -1298,11 +1128,9 @@ purple_buddy_icons_uninit() g_hash_table_destroy(icon_data_cache); g_hash_table_destroy(icon_file_cache); g_hash_table_destroy(pointer_icon_cache); - g_free(old_icons_dir); g_free(cache_dir); cache_dir = NULL; - old_icons_dir = NULL; } void purple_buddy_icon_get_scale_size(PurpleBuddyIconSpec *spec, int *width, int *height) diff --git a/libpurple/core.c b/libpurple/core.c index c07fc35c9e..6a5783eb1e 100644 --- a/libpurple/core.c +++ b/libpurple/core.c @@ -371,386 +371,6 @@ purple_core_ensure_single_instance() return is_single_instance; } -static gboolean -move_and_symlink_dir(const char *path, const char *basename, const char *old_base, const char *new_base, const char *relative) -{ - char *new_name = g_build_filename(new_base, basename, NULL); -#ifndef _WIN32 - char *old_name; -#endif - if (g_rename(path, new_name)) - { - purple_debug_error("core", "Error renaming %s to %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - path, new_name, g_strerror(errno)); - g_free(new_name); - return FALSE; - } - g_free(new_name); - -#ifndef _WIN32 - /* NOTE: This new_name is relative. */ - new_name = g_build_filename(relative, basename, NULL); - old_name = g_build_filename(old_base, basename, NULL); - if (symlink(new_name, old_name)) - { - purple_debug_warning("core", "Error symlinking %s to %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - old_name, new_name, g_strerror(errno)); - } - g_free(old_name); - g_free(new_name); -#endif - - return TRUE; -} - -gboolean -purple_core_migrate(void) -{ - const char *user_dir = purple_user_dir(); - char *old_user_dir = g_strconcat(purple_home_dir(), - G_DIR_SEPARATOR_S ".gaim", NULL); - char *status_file; - FILE *fp; - GDir *dir; - GError *err; - const char *entry; -#ifndef _WIN32 - char *logs_dir; -#endif - char *old_icons_dir; - - if (!g_file_test(old_user_dir, G_FILE_TEST_EXISTS)) - { - /* ~/.gaim doesn't exist, so there's nothing to migrate. */ - g_free(old_user_dir); - return TRUE; - } - - status_file = g_strconcat(user_dir, G_DIR_SEPARATOR_S "migrating", NULL); - - if (g_file_test(user_dir, G_FILE_TEST_EXISTS)) - { - /* If we're here, we have both ~/.gaim and .purple. */ - - if (!g_file_test(status_file, G_FILE_TEST_EXISTS)) - { - /* There's no "migrating" status file, - * so ~/.purple is all up to date. */ - g_free(status_file); - g_free(old_user_dir); - return TRUE; - } - } - - /* If we're here, it's time to migrate from ~/.gaim to ~/.purple. */ - - /* Ensure the user directory exists */ - if (!g_file_test(user_dir, G_FILE_TEST_IS_DIR)) - { - if (g_mkdir(user_dir, S_IRUSR | S_IWUSR | S_IXUSR) == -1) - { - purple_debug_error("core", "Error creating directory %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - user_dir, g_strerror(errno)); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - } - - /* This writes ~/.purple/migrating, which allows us to detect - * incomplete migrations and properly retry. */ - if (!(fp = g_fopen(status_file, "w"))) - { - purple_debug_error("core", "Error opening file %s for writing: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - status_file, g_strerror(errno)); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - fclose(fp); - - /* Open ~/.gaim so we can loop over its contents. */ - err = NULL; - if (!(dir = g_dir_open(old_user_dir, 0, &err))) - { - purple_debug_error("core", "Error opening directory %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - status_file, - (err ? err->message : "Unknown error")); - if (err) - g_error_free(err); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - /* Loop over the contents of ~/.gaim */ - while ((entry = g_dir_read_name(dir))) - { - char *name = g_build_filename(old_user_dir, entry, NULL); - -#ifndef _WIN32 - /* Deal with symlinks... */ - if (g_file_test(name, G_FILE_TEST_IS_SYMLINK)) - { - /* We're only going to duplicate a logs symlink. */ - if (purple_strequal(entry, "logs")) - { - char *link; - err = NULL; - - if ((link = g_file_read_link(name, &err)) == NULL) - { - char *name_utf8 = g_filename_to_utf8(name, -1, NULL, NULL, NULL); - purple_debug_error("core", "Error reading symlink %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - name_utf8 ? name_utf8 : name, err->message); - g_free(name_utf8); - g_error_free(err); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - logs_dir = g_build_filename(user_dir, "logs", NULL); - - if (purple_strequal(link, "../.purple/logs") || - purple_strequal(link, logs_dir)) - { - /* If the symlink points to the new directory, we're - * likely just trying again after a failed migration, - * so there's no need to fail here. */ - g_free(link); - g_free(logs_dir); - continue; - } - - /* In case we are trying again after a failed migration, we need - * to unlink any existing symlink. If it's a directory, this - * will fail, and so will the symlink below, which is good - * because the user should sort things out. */ - g_unlink(logs_dir); - - /* Relative links will most likely still be - * valid from ~/.purple, though it's not - * guaranteed. Oh well. */ - if (symlink(link, logs_dir)) - { - purple_debug_error("core", "Error symlinking %s to %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - logs_dir, link, g_strerror(errno)); - g_free(link); - g_free(name); - g_free(logs_dir); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - g_free(link); - g_free(logs_dir); - continue; - } - - /* Ignore all other symlinks. */ - continue; - } -#endif - - /* Deal with directories... */ - if (g_file_test(name, G_FILE_TEST_IS_DIR)) - { - if (purple_strequal(entry, "icons")) - { - /* This is a special case for the Album plugin, which - * stores data in the icons folder. We're not copying - * the icons directory over because previous bugs - * meant that it filled up with junk for many users. - * This is a great time to purge it. */ - - GDir *icons_dir; - char *new_icons_dir; - const char *icons_entry; - - err = NULL; - if (!(icons_dir = g_dir_open(name, 0, &err))) - { - purple_debug_error("core", "Error opening directory %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - name, - (err ? err->message : "Unknown error")); - if (err) - g_error_free(err); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - new_icons_dir = g_build_filename(user_dir, "icons", NULL); - /* Ensure the new icon directory exists */ - if (!g_file_test(new_icons_dir, G_FILE_TEST_IS_DIR)) - { - if (g_mkdir(new_icons_dir, S_IRUSR | S_IWUSR | S_IXUSR) == -1) - { - purple_debug_error("core", "Error creating directory %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - new_icons_dir, g_strerror(errno)); - g_free(new_icons_dir); - g_dir_close(icons_dir); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - } - - while ((icons_entry = g_dir_read_name(icons_dir))) - { - char *icons_name = g_build_filename(name, icons_entry, NULL); - - if (g_file_test(icons_name, G_FILE_TEST_IS_DIR)) - { - if (!move_and_symlink_dir(icons_name, icons_entry, - name, new_icons_dir, "../../.purple/icons")) - { - g_free(icons_name); - g_free(new_icons_dir); - g_dir_close(icons_dir); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - } - g_free(icons_name); - } - - g_dir_close(icons_dir); - } - else if (purple_strequal(entry, "plugins")) - { - /* Do nothing, because we broke plugin compatibility. - * This means that the plugins directory gets left behind. */ - } - else - { - /* All other directories are moved and symlinked. */ - if (!move_and_symlink_dir(name, entry, old_user_dir, user_dir, "../.purple")) - { - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - } - } - else if (g_file_test(name, G_FILE_TEST_IS_REGULAR)) - { - /* Regular files are copied. */ - - char *new_name; - FILE *new_file; - - if (!(fp = g_fopen(name, "rb"))) - { - purple_debug_error("core", "Error opening file %s for reading: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - name, g_strerror(errno)); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - new_name = g_build_filename(user_dir, entry, NULL); - if (!(new_file = g_fopen(new_name, "wb"))) - { - purple_debug_error("core", "Error opening file %s for writing: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - new_name, g_strerror(errno)); - fclose(fp); - g_free(new_name); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - while (!feof(fp)) - { - unsigned char buf[256]; - size_t size; - - size = fread(buf, 1, sizeof(buf), fp); - if (size != sizeof(buf) && !feof(fp)) - { - purple_debug_error("core", "Error reading %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - name, g_strerror(errno)); - fclose(new_file); - fclose(fp); - g_free(new_name); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - if (!fwrite(buf, size, 1, new_file) && ferror(new_file) != 0) - { - purple_debug_error("core", "Error writing %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - new_name, g_strerror(errno)); - fclose(new_file); - fclose(fp); - g_free(new_name); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - } - - if (fclose(new_file)) - { - purple_debug_error("core", "Error writing: %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - new_name, g_strerror(errno)); - } - if (fclose(fp)) - { - purple_debug_warning("core", "Error closing %s: %s\n", - name, g_strerror(errno)); - } - g_free(new_name); - } - else - purple_debug_warning("core", "Not a regular file or directory: %s\n", name); - - g_free(name); - } - - /* The migration was successful, so delete the status file. */ - if (g_unlink(status_file)) - { - purple_debug_error("core", "Error unlinking file %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - status_file, g_strerror(errno)); - g_free(status_file); - return FALSE; - } - - old_icons_dir = g_build_filename(old_user_dir, "icons", NULL); - _purple_buddy_icon_set_old_icons_dir(old_icons_dir); - g_free(old_icons_dir); - - g_free(old_user_dir); - - g_free(status_file); - return TRUE; -} - GHashTable* purple_core_get_ui_info() { PurpleCoreUiOps *ops = purple_core_get_ui_ops(); diff --git a/libpurple/core.h b/libpurple/core.h index c55591e234..edebd94a3a 100644 --- a/libpurple/core.h +++ b/libpurple/core.h @@ -155,17 +155,6 @@ void purple_core_set_ui_ops(PurpleCoreUiOps *ops); */ PurpleCoreUiOps *purple_core_get_ui_ops(void); -/** - * Migrates from .gaim to .purple. - * - * UIs must not call this if they have been told to use a - * custom user directory. - * - * @return A boolean indicating success or migration failure. On failure, - * the application must display an error to the user and then exit. - */ -gboolean purple_core_migrate(void); - /** * Ensures that only one instance is running. If libpurple is built with D-Bus * support, this checks if another process owns the libpurple bus name and if diff --git a/libpurple/internal.h b/libpurple/internal.h index dfc1195daa..12d525c4dd 100644 --- a/libpurple/internal.h +++ b/libpurple/internal.h @@ -176,12 +176,6 @@ _purple_buddy_icons_account_loaded_cb(void); void _purple_buddy_icons_blist_loaded_cb(void); -/* This is for the purple_core_migrate() code to tell the buddy - * icon subsystem about the old icons directory so it can - * migrate any icons in use. */ -void -_purple_buddy_icon_set_old_icons_dir(const char *dirname); - /** * Creates a connection to the specified account and either connects * or attempts to register a new account. If you are logging in, diff --git a/pidgin/gtkmain.c b/pidgin/gtkmain.c index 4a9b478080..1e494547b6 100644 --- a/pidgin/gtkmain.c +++ b/pidgin/gtkmain.c @@ -496,7 +496,6 @@ int main(int argc, char *argv[]) int opt; gboolean gui_check; gboolean debug_enabled; - gboolean migration_failed = FALSE; GList *active_accounts; struct stat st; @@ -728,16 +727,6 @@ int main(int argc, char *argv[]) purple_debug_set_enabled(debug_enabled); - /* If we're using a custom configuration directory, we - * do NOT want to migrate, or weird things will happen. */ - if (opt_config_dir_arg == NULL) - { - if (!purple_core_migrate()) - { - migration_failed = TRUE; - } - } - search_path = g_build_filename(purple_user_dir(), "gtkrc-2.0", NULL); gtk_rc_add_default_file(search_path); g_free(search_path); @@ -763,37 +752,6 @@ int main(int argc, char *argv[]) winpidgin_init(hint); #endif - if (migration_failed) - { - char *old = g_strconcat(purple_home_dir(), - G_DIR_SEPARATOR_S ".gaim", NULL); - const char *text = _( - "%s encountered errors migrating your settings " - "from %s to %s. Please investigate and complete the " - "migration by hand. Please report this error at http://developer.pidgin.im"); - GtkWidget *dialog; - - dialog = gtk_message_dialog_new(NULL, - 0, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - text, PIDGIN_NAME, - old, purple_user_dir()); - g_free(old); - - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_main_quit), NULL); - - gtk_widget_show_all(dialog); - - gtk_main(); - -#ifdef HAVE_SIGNAL_H - g_free(segfault_message); -#endif - return 0; - } - purple_core_set_ui_ops(pidgin_core_get_ui_ops()); purple_eventloop_set_ui_ops(pidgin_eventloop_get_ui_ops()); diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index dec4f8da23..23bff15095 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -2857,8 +2857,6 @@ pidgin_prefs_update_old(void) { const char *str = NULL; - purple_prefs_rename("/gaim/gtk", PIDGIN_PREFS_ROOT); - /* Rename some old prefs */ purple_prefs_rename(PIDGIN_PREFS_ROOT "/logging/log_ims", "/purple/logging/log_ims"); purple_prefs_rename(PIDGIN_PREFS_ROOT "/logging/log_chats", "/purple/logging/log_chats"); @@ -2882,12 +2880,6 @@ pidgin_prefs_update_old(void) purple_prefs_remove(PIDGIN_PREFS_ROOT "/browsers/command"); } - /* this string pref moved into the core, try to be friendly */ - purple_prefs_rename(PIDGIN_PREFS_ROOT "/idle/reporting_method", "/purple/away/idle_reporting"); - if ((str = purple_prefs_get_string("/purple/away/idle_reporting")) && - strcmp(str, "gaim") == 0) - purple_prefs_set_string("/purple/away/idle_reporting", "purple"); - /* Remove some no-longer-used prefs */ purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/auto_expand_contacts"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/button_style"); -- cgit v1.2.1 From 6367976ed29a22c06c9acf91914f88f30589326a Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 20 Mar 2011 20:20:52 +0000 Subject: Add two hash tables to the oscar code that deals with your server stored buddy list. One hash table is indexed by a combination of group id and buddy id. The other hash table is indexed by a combination of item type and item name. This should reduce the number of times we iterate through a linked list by A LOT. This is a modified version of Oliver's patch from #4816. Fixes #4816. --- ChangeLog | 4 + libpurple/protocols/oscar/authorization.c | 4 +- libpurple/protocols/oscar/family_feedbag.c | 304 ++++++++++++++++------------- libpurple/protocols/oscar/oscar.c | 54 ++--- libpurple/protocols/oscar/oscar.h | 34 ++-- libpurple/protocols/oscar/oscar_data.c | 12 ++ libpurple/protocols/oscar/userinfo.c | 8 +- libpurple/protocols/oscar/visibility.c | 4 +- 8 files changed, 235 insertions(+), 189 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9712d80006..6a5ec90264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul +version 3.0.0 (??/??/????): + AIM and ICQ: + * Make buddy list management code more efficient. (Oliver) (#4816) + version 2.8.0 (??/??/????): General: * Implement simple silence suppression for voice calls, preventing wasted diff --git a/libpurple/protocols/oscar/authorization.c b/libpurple/protocols/oscar/authorization.c index e0c84e40ca..8d57a8ee89 100644 --- a/libpurple/protocols/oscar/authorization.c +++ b/libpurple/protocols/oscar/authorization.c @@ -51,7 +51,7 @@ oscar_auth_request(struct name_data *data, char *msg) purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n", bname, gname); aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); - if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) + if (!aim_ssi_itemlist_finditem(&od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) { aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE); @@ -150,4 +150,4 @@ oscar_auth_recvrequest(PurpleConnection *gc, gchar *name, gchar *nick, gchar *re purple_account_request_authorization(account, data->name, NULL, data->nick, reason, purple_find_buddy(account, data->name) != NULL, oscar_auth_grant, oscar_auth_dontgrant_msgprompt, data); -} \ No newline at end of file +} diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c index ebfa12f112..0f8977c8f1 100644 --- a/libpurple/protocols/oscar/family_feedbag.c +++ b/libpurple/protocols/oscar/family_feedbag.c @@ -21,9 +21,9 @@ /* * Family 0x0013 - Server-Side/Stored Information. * - * Relatively new facility that allows certain types of information, such as - * a user's buddy list, permit/deny list, and permit/deny preferences, to be - * stored on the server, so that they can be accessed from any client. + * Deals with storing certain types of information, such as a user's buddy + * list, permit/deny list, and permit/deny preferences, on the server, so + * that they can be accessed from any client. * * We keep 2 copies of SSI data: * 1) An exact copy of what is stored on the AIM servers. @@ -40,14 +40,41 @@ * * This is entirely too complicated. * You don't know the half of it. - * */ #include "oscar.h" +#include "oscarcommon.h" #include "debug.h" static int aim_ssi_addmoddel(OscarData *od); +static void aim_ssi_item_free(struct aim_ssi_item *item) +{ + g_free(item->name); + aim_tlvlist_free(item->data); + g_free(item); +} + +static void aim_ssi_item_set_name(struct aim_ssi_itemlist *list, struct aim_ssi_item *item, const char *name) +{ + gchar key[3000]; + + if (item->name) { + /* Remove old name from hash table */ + snprintf(key, sizeof(key), "%hx%s", item->type, oscar_normalize(NULL, item->name)); + g_hash_table_remove(list->idx_all_named_items, key); + } + + g_free(item->name); + item->name = g_strdup(name); + + if (name) { + /* Add new name to hash table */ + snprintf(key, sizeof(key), "%hx%s", item->type, oscar_normalize(NULL, item->name)); + g_hash_table_insert(list->idx_all_named_items, g_strdup(key), item); + } +} + /** * List types based on http://dev.aol.com/aim/oscar/#FEEDBAG (archive.org) * and http://iserverd.khstu.ru/oscar/ssi_item.html @@ -112,7 +139,7 @@ aim_ssi_item_debug_append(GString *str, char *prefix, struct aim_ssi_item *item) * @return Return a pointer to the modified item. */ static void -aim_ssi_itemlist_rebuildgroup(struct aim_ssi_item *list, const char *name) +aim_ssi_itemlist_rebuildgroup(struct aim_ssi_itemlist *list, const char *name) { int newlen; struct aim_ssi_item *cur, *group; @@ -124,11 +151,11 @@ aim_ssi_itemlist_rebuildgroup(struct aim_ssi_item *list, const char *name) /* Find the length for the new additional data */ newlen = 0; if (group->gid == 0x0000) { - for (cur=list; cur; cur=cur->next) + for (cur=list->data; cur; cur=cur->next) if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) newlen += 2; } else { - for (cur=list; cur; cur=cur->next) + for (cur=list->data; cur; cur=cur->next) if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) newlen += 2; } @@ -137,14 +164,14 @@ aim_ssi_itemlist_rebuildgroup(struct aim_ssi_item *list, const char *name) if (newlen > 0) { guint8 *newdata; - newdata = (guint8 *)g_malloc((newlen)*sizeof(guint8)); + newdata = g_new(guint8, newlen); newlen = 0; if (group->gid == 0x0000) { - for (cur=list; cur; cur=cur->next) + for (cur=list->data; cur; cur=cur->next) if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) newlen += aimutil_put16(newdata+newlen, cur->gid); } else { - for (cur=list; cur; cur=cur->next) + for (cur=list->data; cur; cur=cur->next) if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) newlen += aimutil_put16(newdata+newlen, cur->bid); } @@ -166,15 +193,12 @@ aim_ssi_itemlist_rebuildgroup(struct aim_ssi_item *list, const char *name) * @param data The additional data for the new item. * @return A pointer to the newly created item. */ -static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, const char *name, guint16 gid, guint16 bid, guint16 type, GSList *data) +static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_itemlist *list, const char *name, guint16 gid, guint16 bid, guint16 type, GSList *data) { gboolean exists; struct aim_ssi_item *cur, *new; - new = g_new(struct aim_ssi_item, 1); - - /* Set the name */ - new->name = g_strdup(name); + new = g_new0(struct aim_ssi_item, 1); /* Set the group ID# and buddy ID# */ new->gid = gid; @@ -184,7 +208,7 @@ static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, con do { new->gid += 0x0001; exists = FALSE; - for (cur = *list; cur != NULL; cur = cur->next) + for (cur = list->data; cur != NULL; cur = cur->next) if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid == new->gid)) { exists = TRUE; break; @@ -201,7 +225,7 @@ static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, con do { new->bid += 0x0001; exists = FALSE; - for (cur = *list; cur != NULL; cur = cur->next) + for (cur = list->data; cur != NULL; cur = cur->next) if (cur->bid == new->bid || cur->gid == new->bid) { exists = TRUE; break; @@ -213,7 +237,7 @@ static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, con do { new->bid += 0x0001; exists = FALSE; - for (cur = *list; cur != NULL; cur = cur->next) + for (cur = list->data; cur != NULL; cur = cur->next) if (cur->bid == new->bid && cur->gid == new->gid) { exists = TRUE; break; @@ -225,23 +249,29 @@ static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, con /* Set the type */ new->type = type; + /* Add it to the gid+bid hashtable */ + g_hash_table_insert(list->idx_gid_bid, GINT_TO_POINTER((new->gid << 16) + new->bid), new); + + /* Set the name - do this *AFTER* setting the type because type is used for the key */ + aim_ssi_item_set_name(list, new, name); + /* Set the TLV list */ new->data = aim_tlvlist_copy(data); /* Add the item to the list in the correct numerical position. Fancy, eh? */ - if (*list) { - if ((new->gid < (*list)->gid) || ((new->gid == (*list)->gid) && (new->bid < (*list)->bid))) { - new->next = *list; - *list = new; + if (list->data) { + if ((new->gid < list->data->gid) || ((new->gid == list->data->gid) && (new->bid < list->data->bid))) { + new->next = list->data; + list->data = new; } else { struct aim_ssi_item *prev; - for ((prev=*list, cur=(*list)->next); (cur && ((new->gid > cur->gid) || ((new->gid == cur->gid) && (new->bid > cur->bid)))); prev=cur, cur=cur->next); + for ((prev=list->data, cur=list->data->next); (cur && ((new->gid > cur->gid) || ((new->gid == cur->gid) && (new->bid > cur->bid)))); prev=cur, cur=cur->next); new->next = prev->next; prev->next = new; } } else { - new->next = *list; - *list = new; + new->next = list->data; + list->data = new; } return new; @@ -254,25 +284,31 @@ static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, con * @param del A pointer to the item you want to remove from the list. * @return Return 0 if no errors, otherwise return the error number. */ -static int aim_ssi_itemlist_del(struct aim_ssi_item **list, struct aim_ssi_item *del) +static int aim_ssi_itemlist_del(struct aim_ssi_itemlist *list, struct aim_ssi_item *del) { - if (!(*list) || !del) + gchar key[3000]; + + if (!(list->data) || !del) return -EINVAL; /* Remove the item from the list */ - if (*list == del) { - *list = (*list)->next; + if (list->data == del) { + list->data = list->data->next; } else { struct aim_ssi_item *cur; - for (cur=*list; (cur->next && (cur->next!=del)); cur=cur->next); + for (cur=list->data; (cur->next && (cur->next!=del)); cur=cur->next); if (cur->next) cur->next = del->next; } + /* Remove from the hashtables */ + g_hash_table_remove(list->idx_gid_bid, GINT_TO_POINTER((del->gid << 16) + del->bid)); + + snprintf(key, sizeof(key), "%hx%s", del->type, oscar_normalize(NULL, del->name)); + g_hash_table_remove(list->idx_all_named_items, key); + /* Free the removed item */ - g_free(del->name); - aim_tlvlist_free(del->data); - g_free(del); + aim_ssi_item_free(del); return 0; } @@ -319,10 +355,10 @@ static int aim_ssi_itemlist_cmp(struct aim_ssi_item *cur1, struct aim_ssi_item * return 0; } -static gboolean aim_ssi_itemlist_valid(struct aim_ssi_item *list, struct aim_ssi_item *item) +static gboolean aim_ssi_itemlist_valid(struct aim_ssi_itemlist *list, struct aim_ssi_item *item) { struct aim_ssi_item *cur; - for (cur=list; cur; cur=cur->next) + for (cur=list->data; cur; cur=cur->next) if (cur == item) return TRUE; return FALSE; @@ -336,13 +372,10 @@ static gboolean aim_ssi_itemlist_valid(struct aim_ssi_item *list, struct aim_ssi * @param bid The buddy ID# of the desired item. * @return Return a pointer to the item if found, else return NULL; */ -struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid) +struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_itemlist *list, guint16 gid, guint16 bid) { - struct aim_ssi_item *cur; - for (cur=list; cur; cur=cur->next) - if ((cur->gid == gid) && (cur->bid == bid)) - return cur; - return NULL; + guint32 id_key = (gid << 16) + bid; + return g_hash_table_lookup(list->idx_gid_bid, GINT_TO_POINTER(id_key)); } /** @@ -355,37 +388,30 @@ struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gi * @param type The type of the desired item. * @return Return a pointer to the item if found, else return NULL. */ -struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *bn, guint16 type) +struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_itemlist *list, const char *gn, const char *bn, guint16 type) { struct aim_ssi_item *cur; - if (!list) + gchar key[3000]; + + if (!list->data) return NULL; if (gn && bn) { /* For finding buddies in groups */ - for (cur=list; cur; cur=cur->next) + g_return_val_if_fail(type == AIM_SSI_TYPE_BUDDY, NULL); + for (cur=list->data; cur; cur=cur->next) if ((cur->type == type) && (cur->name) && !(oscar_util_name_compare(cur->name, bn))) { struct aim_ssi_item *curg; - for (curg=list; curg; curg=curg->next) + for (curg=list->data; curg; curg=curg->next) if ((curg->type == AIM_SSI_TYPE_GROUP) && (curg->gid == cur->gid) && (curg->name) && !(oscar_util_name_compare(curg->name, gn))) return cur; } - } else if (gn) { /* For finding groups */ - for (cur=list; cur; cur=cur->next) { - if ((cur->type == type) && (cur->bid == 0x0000) && (cur->name) && !(oscar_util_name_compare(cur->name, gn))) { - return cur; - } - } - - } else if (bn) { /* For finding permits, denies, and ignores */ - for (cur=list; cur; cur=cur->next) { - if ((cur->type == type) && (cur->name) && !(oscar_util_name_compare(cur->name, bn))) { - return cur; - } - } + } else if (gn || bn) { /* For finding groups, permits, denies and ignores */ + snprintf(key, sizeof(key), "%hx%s", type, oscar_normalize(NULL, gn ? gn : bn)); + return g_hash_table_lookup(list->idx_all_named_items, key); /* For stuff without names--permit deny setting, visibility mask, etc. */ - } else for (cur=list; cur; cur=cur->next) { + } else for (cur=list->data; cur; cur=cur->next) { if ((cur->type == type) && (!cur->name)) return cur; } @@ -400,7 +426,7 @@ struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const * @param bn The group name of the desired item. * @return Return a pointer to the name of the item if found, else return NULL; */ -struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *bn) +struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_itemlist *list, const char *bn) { if (!bn) return NULL; @@ -414,10 +440,10 @@ struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const ch * @param bn The buddy name of the desired item. * @return Return a pointer to the name of the item if found, else return NULL; */ -char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *bn) +char *aim_ssi_itemlist_findparentname(struct aim_ssi_itemlist *list, const char *bn) { struct aim_ssi_item *cur, *curg; - if (!list || !bn) + if (!list->data || !bn) return NULL; if (!(cur = aim_ssi_itemlist_exists(list, bn))) return NULL; @@ -432,7 +458,7 @@ char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *bn) * @param list A pointer to the current list of items. * @return Return the current SSI permit deny setting, or 0 if no setting was found. */ -int aim_ssi_getpermdeny(struct aim_ssi_item *list) +int aim_ssi_getpermdeny(struct aim_ssi_itemlist *list) { struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PDINFO); if (cur) { @@ -450,7 +476,7 @@ int aim_ssi_getpermdeny(struct aim_ssi_item *list) * @param list A pointer to the current list of items. * @return Return the current set of preferences. */ -guint32 aim_ssi_getpresence(struct aim_ssi_item *list) +guint32 aim_ssi_getpresence(struct aim_ssi_itemlist *list) { struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS); if (cur) { @@ -471,17 +497,23 @@ guint32 aim_ssi_getpresence(struct aim_ssi_item *list) * alias, or NULL if the buddy has no alias. You should free * this returned value! */ -char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *bn) +char *aim_ssi_getalias(struct aim_ssi_itemlist *list, const char *gn, const char *bn) { - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); - if (cur) { - aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x0131, 1); - if (tlv && tlv->length) - return g_strndup((const gchar *)tlv->value, tlv->length); + struct aim_ssi_item *item = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); + if (item) { + return aim_ssi_getalias_from_item(item); } return NULL; } +char *aim_ssi_getalias_from_item(struct aim_ssi_item *item) +{ + aim_tlv_t *tlv = aim_tlv_gettlv(item->data, 0x0131, 1); + if (tlv && tlv->length) + return g_strndup((const gchar *)tlv->value, tlv->length); + return NULL; +} + /** * Locally find the comment of the given buddy. * @@ -492,7 +524,7 @@ char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *bn * comment, or NULL if the buddy has no comment. You should free * this returned value! */ -char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *bn) +char *aim_ssi_getcomment(struct aim_ssi_itemlist *list, const char *gn, const char *bn) { struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); if (cur) { @@ -512,7 +544,7 @@ char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char * * @param bn The name of the buddy. * @return 1 if you are waiting for authorization; 0 if you are not */ -gboolean aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *bn) +gboolean aim_ssi_waitingforauth(struct aim_ssi_itemlist *list, const char *gn, const char *bn) { struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); if (cur) { @@ -560,8 +592,8 @@ static int aim_ssi_sync(OscarData *od) /* Deletions */ if (!od->ssi.pending) { - for (cur1=od->ssi.official; cur1 && (n < 15); cur1=cur1->next) { - if (!aim_ssi_itemlist_find(od->ssi.local, cur1->gid, cur1->bid)) { + for (cur1=od->ssi.official.data; cur1 && (n < 15); cur1=cur1->next) { + if (!aim_ssi_itemlist_find(&od->ssi.local, cur1->gid, cur1->bid)) { n++; new = g_new(struct aim_ssi_tmp, 1); new->action = SNAC_SUBTYPE_FEEDBAG_DEL; @@ -574,15 +606,15 @@ static int aim_ssi_sync(OscarData *od) cur->next = new; } else od->ssi.pending = new; - aim_ssi_item_debug_append(debugstr, "Deleting item ", cur1); + aim_ssi_item_debug_append(debugstr, "Deleting item ", cur1); } } } /* Additions */ if (!od->ssi.pending) { - for (cur1=od->ssi.local; cur1 && (n < 15); cur1=cur1->next) { - if (!aim_ssi_itemlist_find(od->ssi.official, cur1->gid, cur1->bid)) { + for (cur1=od->ssi.local.data; cur1 && (n < 15); cur1=cur1->next) { + if (!aim_ssi_itemlist_find(&od->ssi.official, cur1->gid, cur1->bid)) { n++; new = g_new(struct aim_ssi_tmp, 1); new->action = SNAC_SUBTYPE_FEEDBAG_ADD; @@ -595,15 +627,15 @@ static int aim_ssi_sync(OscarData *od) cur->next = new; } else od->ssi.pending = new; - aim_ssi_item_debug_append(debugstr, "Adding item ", cur1); + aim_ssi_item_debug_append(debugstr, "Adding item ", cur1); } } } /* Modifications */ if (!od->ssi.pending) { - for (cur1=od->ssi.local; cur1 && (n < 15); cur1=cur1->next) { - cur2 = aim_ssi_itemlist_find(od->ssi.official, cur1->gid, cur1->bid); + for (cur1=od->ssi.local.data; cur1 && (n < 15); cur1=cur1->next) { + cur2 = aim_ssi_itemlist_find(&od->ssi.official, cur1->gid, cur1->bid); if (cur2 && (aim_ssi_itemlist_cmp(cur1, cur2))) { n++; new = g_new(struct aim_ssi_tmp, 1); @@ -617,15 +649,15 @@ static int aim_ssi_sync(OscarData *od) cur->next = new; } else od->ssi.pending = new; - aim_ssi_item_debug_append(debugstr, "Modifying item ", cur1); + aim_ssi_item_debug_append(debugstr, "Modifying item ", cur1); } } } if (debugstr->len > 0) { purple_debug_info("oscar", "%s", debugstr->str); if (purple_debug_is_verbose()) { - g_string_truncate(debugstr, 0); - for (cur1 = od->ssi.local; cur1; cur1 = cur1->next) + g_string_truncate(debugstr, 0); + for (cur1 = od->ssi.local.data; cur1; cur1 = cur1->next) aim_ssi_item_debug_append(debugstr, "\t", cur1); purple_debug_misc("oscar", "Dumping item list of account %s:\n%s", purple_connection_get_account(od->gc)->username, debugstr->str); @@ -672,22 +704,18 @@ aim_ssi_freelist(OscarData *od) struct aim_ssi_item *cur, *del; struct aim_ssi_tmp *curtmp, *deltmp; - cur = od->ssi.official; + cur = od->ssi.official.data; while (cur) { del = cur; cur = cur->next; - g_free(del->name); - aim_tlvlist_free(del->data); - g_free(del); + aim_ssi_item_free(del); } - cur = od->ssi.local; + cur = od->ssi.local.data; while (cur) { del = cur; cur = cur->next; - g_free(del->name); - aim_tlvlist_free(del->data); - g_free(del); + aim_ssi_item_free(del); } curtmp = od->ssi.pending; @@ -698,8 +726,8 @@ aim_ssi_freelist(OscarData *od) } od->ssi.numitems = 0; - od->ssi.official = NULL; - od->ssi.local = NULL; + od->ssi.official.data = NULL; + od->ssi.local.data = NULL; od->ssi.pending = NULL; od->ssi.timestamp = (time_t)0; } @@ -725,7 +753,7 @@ int aim_ssi_cleanlist(OscarData *od) /* DESTROY any buddies that are directly in the master group. */ /* Do the same for buddies that are in a non-existant group. */ /* This will kind of mess up if you hit the item limit, but this function isn't too critical */ - cur = od->ssi.local; + cur = od->ssi.local.data; while (cur) { next = cur->next; if (!cur->name) { @@ -733,8 +761,8 @@ int aim_ssi_cleanlist(OscarData *od) aim_ssi_delbuddy(od, NULL, NULL); else if (cur->type == AIM_SSI_TYPE_PERMIT || cur->type == AIM_SSI_TYPE_DENY || cur->type == AIM_SSI_TYPE_ICQDENY) aim_ssi_del_from_private_list(od, NULL, cur->type); - } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(od->ssi.local, cur->gid, 0x0000)))) { - char *alias = aim_ssi_getalias(od->ssi.local, NULL, cur->name); + } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(&od->ssi.local, cur->gid, 0x0000)))) { + char *alias = aim_ssi_getalias(&od->ssi.local, NULL, cur->name); aim_ssi_addbuddy(od, cur->name, "orphans", NULL, alias, NULL, NULL, FALSE); aim_ssi_delbuddy(od, cur->name, NULL); g_free(alias); @@ -743,7 +771,7 @@ int aim_ssi_cleanlist(OscarData *od) } /* Make sure there aren't any duplicate buddies in a group, or duplicate permits or denies */ - cur = od->ssi.local; + cur = od->ssi.local.data; while (cur) { if ((cur->type == AIM_SSI_TYPE_BUDDY) || (cur->type == AIM_SSI_TYPE_PERMIT) || (cur->type == AIM_SSI_TYPE_DENY)) { @@ -784,16 +812,16 @@ int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, GSList return -EINVAL; /* Find the parent */ - if (!(parent = aim_ssi_itemlist_finditem(od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) { + if (!(parent = aim_ssi_itemlist_finditem(&od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) { /* Find the parent's parent (the master group) */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) + if (aim_ssi_itemlist_find(&od->ssi.local, 0x0000, 0x0000) == NULL) aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); /* Add the parent */ parent = aim_ssi_itemlist_add(&od->ssi.local, group, 0xFFFF, 0x0000, AIM_SSI_TYPE_GROUP, NULL); /* Modify the parent's parent (the master group) */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, NULL); + aim_ssi_itemlist_rebuildgroup(&od->ssi.local, NULL); } /* Create a TLV list for the new buddy */ @@ -811,7 +839,7 @@ int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, GSList aim_tlvlist_free(data); /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); + aim_ssi_itemlist_rebuildgroup(&od->ssi.local, group); /* Sync our local list with the server list */ return aim_ssi_sync(od); @@ -823,7 +851,7 @@ aim_ssi_add_to_private_list(OscarData *od, const char* name, guint16 list_type) if (!od || !name || !od->ssi.received_data) return -EINVAL; - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) + if (aim_ssi_itemlist_find(&od->ssi.local, 0x0000, 0x0000) == NULL) aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); aim_ssi_itemlist_add(&od->ssi.local, name, 0x0000, 0xFFFF, list_type, NULL); @@ -838,7 +866,7 @@ aim_ssi_del_from_private_list(OscarData* od, const char* name, guint16 list_type if (!od) return -EINVAL; - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, NULL, name, list_type))) + if (!(del = aim_ssi_itemlist_finditem(&od->ssi.local, NULL, name, list_type))) return -EINVAL; aim_ssi_itemlist_del(&od->ssi.local, del); @@ -861,14 +889,14 @@ int aim_ssi_delbuddy(OscarData *od, const char *name, const char *group) return -EINVAL; /* Find the buddy */ - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, group, name, AIM_SSI_TYPE_BUDDY))) + if (!(del = aim_ssi_itemlist_finditem(&od->ssi.local, group, name, AIM_SSI_TYPE_BUDDY))) return -EINVAL; /* Remove the item from the list */ aim_ssi_itemlist_del(&od->ssi.local, del); /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); + aim_ssi_itemlist_rebuildgroup(&od->ssi.local, group); /* Sync our local list with the server list */ return aim_ssi_sync(od); @@ -890,7 +918,7 @@ int aim_ssi_delgroup(OscarData *od, const char *group) return -EINVAL; /* Find the group */ - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) + if (!(del = aim_ssi_itemlist_finditem(&od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) return -EINVAL; /* Don't delete the group if it's not empty */ @@ -902,7 +930,7 @@ int aim_ssi_delgroup(OscarData *od, const char *group) aim_ssi_itemlist_del(&od->ssi.local, del); /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); + aim_ssi_itemlist_rebuildgroup(&od->ssi.local, group); /* Sync our local list with the server list */ return aim_ssi_sync(od); @@ -924,7 +952,7 @@ int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const GSList *data; /* Find the buddy */ - buddy = aim_ssi_itemlist_finditem(od->ssi.local, oldgn, bn, AIM_SSI_TYPE_BUDDY); + buddy = aim_ssi_itemlist_finditem(&od->ssi.local, oldgn, bn, AIM_SSI_TYPE_BUDDY); if (buddy == NULL) return -EINVAL; @@ -957,7 +985,7 @@ int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *bn, const char if (!od || !gn || !bn) return -EINVAL; - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, gn, bn, AIM_SSI_TYPE_BUDDY))) + if (!(tmp = aim_ssi_itemlist_finditem(&od->ssi.local, gn, bn, AIM_SSI_TYPE_BUDDY))) return -EINVAL; /* Either add or remove the 0x0131 TLV from the TLV chain */ @@ -987,7 +1015,7 @@ int aim_ssi_editcomment(OscarData *od, const char *gn, const char *bn, const cha if (!od || !gn || !bn) return -EINVAL; - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, gn, bn, AIM_SSI_TYPE_BUDDY))) + if (!(tmp = aim_ssi_itemlist_finditem(&od->ssi.local, gn, bn, AIM_SSI_TYPE_BUDDY))) return -EINVAL; /* Either add or remove the 0x0131 TLV from the TLV chain */ @@ -1015,11 +1043,10 @@ int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn) if (!od || !oldgn || !newgn) return -EINVAL; - if (!(group = aim_ssi_itemlist_finditem(od->ssi.local, oldgn, NULL, AIM_SSI_TYPE_GROUP))) + if (!(group = aim_ssi_itemlist_finditem(&od->ssi.local, oldgn, NULL, AIM_SSI_TYPE_GROUP))) return -EINVAL; - g_free(group->name); - group->name = g_strdup(newgn); + aim_ssi_item_set_name(&od->ssi.local, group, newgn); /* Sync our local list with the server list */ return aim_ssi_sync(od); @@ -1046,9 +1073,9 @@ int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny) return -EINVAL; /* Find the PDINFO item, or add it if it does not exist */ - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PDINFO))) { + if (!(tmp = aim_ssi_itemlist_finditem(&od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PDINFO))) { /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) + if (aim_ssi_itemlist_find(&od->ssi.local, 0x0000, 0x0000) == NULL) aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); tmp = aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PDINFO, NULL); @@ -1078,9 +1105,9 @@ int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint8 iconsumlen) return -EINVAL; /* Find the ICONINFO item, or add it if it does not exist */ - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) { + if (!(tmp = aim_ssi_itemlist_finditem(&od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) { /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) + if (aim_ssi_itemlist_find(&od->ssi.local, 0x0000, 0x0000) == NULL) aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0xFFFF, AIM_SSI_TYPE_ICONINFO, NULL); @@ -1138,9 +1165,9 @@ int aim_ssi_setpresence(OscarData *od, guint32 presence) { return -EINVAL; /* Find the PRESENCEPREFS item, or add it if it does not exist */ - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS))) { + if (!(tmp = aim_ssi_itemlist_finditem(&od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS))) { /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) + if (aim_ssi_itemlist_find(&od->ssi.local, 0x0000, 0x0000) == NULL) aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); tmp = aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PRESENCEPREFS, NULL); @@ -1265,7 +1292,7 @@ static int parsedata(OscarData *od, FlapConnection *conn, aim_module_t *mod, Fla if (!(snac->flags & 0x0001)) { /* Make a copy of the list */ struct aim_ssi_item *cur; - for (cur=od->ssi.official; cur; cur=cur->next) + for (cur=od->ssi.official.data; cur; cur=cur->next) aim_ssi_itemlist_add(&od->ssi.local, cur->name, cur->gid, cur->bid, cur->type, cur->data); od->ssi.received_data = TRUE; @@ -1415,18 +1442,16 @@ static int parsemod(OscarData *od, FlapConnection *conn, aim_module_t *mod, Flap data = NULL; /* Replace the 2 local items with the given one */ - if ((item = aim_ssi_itemlist_find(od->ssi.local, gid, bid))) { + if ((item = aim_ssi_itemlist_find(&od->ssi.local, gid, bid))) { item->type = type; - g_free(item->name); - item->name = g_strdup(name); + aim_ssi_item_set_name(&od->ssi.local, item, name); aim_tlvlist_free(item->data); item->data = aim_tlvlist_copy(data); } - if ((item = aim_ssi_itemlist_find(od->ssi.official, gid, bid))) { + if ((item = aim_ssi_itemlist_find(&od->ssi.official, gid, bid))) { item->type = type; - g_free(item->name); - item->name = g_strdup(name); + aim_ssi_item_set_name(&od->ssi.official, item, name); aim_tlvlist_free(item->data); item->data = aim_tlvlist_copy(data); } @@ -1460,9 +1485,9 @@ static int parsedel(OscarData *od, FlapConnection *conn, aim_module_t *mod, Flap byte_stream_get16(bs); byte_stream_advance(bs, byte_stream_get16(bs)); - if ((del = aim_ssi_itemlist_find(od->ssi.local, gid, bid))) + if ((del = aim_ssi_itemlist_find(&od->ssi.local, gid, bid))) aim_ssi_itemlist_del(&od->ssi.local, del); - if ((del = aim_ssi_itemlist_find(od->ssi.official, gid, bid))) + if ((del = aim_ssi_itemlist_find(&od->ssi.official, gid, bid))) aim_ssi_itemlist_del(&od->ssi.official, del); if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) @@ -1503,7 +1528,8 @@ static int parseack(OscarData *od, FlapConnection *conn, aim_module_t *mod, Flap if (cur->action == SNAC_SUBTYPE_FEEDBAG_ADD) { /* Remove the item from the local list */ /* Make sure cur->item is still valid memory */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { + /* TODO: "Still valid memory"? That's bad form. */ + if (aim_ssi_itemlist_valid(&od->ssi.local, cur->item)) { cur->name = g_strdup(cur->item->name); aim_ssi_itemlist_del(&od->ssi.local, cur->item); } @@ -1511,11 +1537,10 @@ static int parseack(OscarData *od, FlapConnection *conn, aim_module_t *mod, Flap } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) { /* Replace the local item with the item from the official list */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { + if (aim_ssi_itemlist_valid(&od->ssi.local, cur->item)) { struct aim_ssi_item *cur1; - if ((cur1 = aim_ssi_itemlist_find(od->ssi.official, cur->item->gid, cur->item->bid))) { - g_free(cur->item->name); - cur->item->name = g_strdup(cur1->name); + if ((cur1 = aim_ssi_itemlist_find(&od->ssi.official, cur->item->gid, cur->item->bid))) { + aim_ssi_item_set_name(&od->ssi.official, cur->item, cur1->name); aim_tlvlist_free(cur->item->data); cur->item->data = aim_tlvlist_copy(cur1->data); } @@ -1524,7 +1549,7 @@ static int parseack(OscarData *od, FlapConnection *conn, aim_module_t *mod, Flap } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_DEL) { /* Add the item back into the local list */ - if (aim_ssi_itemlist_valid(od->ssi.official, cur->item)) { + if (aim_ssi_itemlist_valid(&od->ssi.official, cur->item)) { aim_ssi_itemlist_add(&od->ssi.local, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); } else cur->item = NULL; @@ -1534,18 +1559,17 @@ static int parseack(OscarData *od, FlapConnection *conn, aim_module_t *mod, Flap /* Do the exact opposite */ if (cur->action == SNAC_SUBTYPE_FEEDBAG_ADD) { /* Add the local item to the official list */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { + if (aim_ssi_itemlist_valid(&od->ssi.local, cur->item)) { aim_ssi_itemlist_add(&od->ssi.official, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); } else cur->item = NULL; } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) { /* Replace the official item with the item from the local list */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { + if (aim_ssi_itemlist_valid(&od->ssi.local, cur->item)) { struct aim_ssi_item *cur1; - if ((cur1 = aim_ssi_itemlist_find(od->ssi.official, cur->item->gid, cur->item->bid))) { - g_free(cur1->name); - cur1->name = g_strdup(cur->item->name); + if ((cur1 = aim_ssi_itemlist_find(&od->ssi.official, cur->item->gid, cur->item->bid))) { + aim_ssi_item_set_name(&od->ssi.official, cur1, cur->item->name); aim_tlvlist_free(cur1->data); cur1->data = aim_tlvlist_copy(cur->item->data); } @@ -1554,7 +1578,7 @@ static int parseack(OscarData *od, FlapConnection *conn, aim_module_t *mod, Flap } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_DEL) { /* Remove the item from the official list */ - if (aim_ssi_itemlist_valid(od->ssi.official, cur->item)) + if (aim_ssi_itemlist_valid(&od->ssi.official, cur->item)) aim_ssi_itemlist_del(&od->ssi.official, cur->item); cur->item = NULL; } diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index ac8b5e0eca..6727a2f057 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -578,7 +578,7 @@ idle_reporting_pref_cb(const char *name, PurplePrefType type, gc = data; od = purple_connection_get_protocol_data(gc); report_idle = strcmp((const char *)value, "none") != 0; - presence = aim_ssi_getpresence(od->ssi.local); + presence = aim_ssi_getpresence(&od->ssi.local); if (report_idle) aim_ssi_setpresence(od, presence | AIM_SSI_PRESENCE_FLAG_SHOWIDLE); @@ -600,7 +600,7 @@ recent_buddies_pref_cb(const char *name, PurplePrefType type, gc = data; od = purple_connection_get_protocol_data(gc); - presence = aim_ssi_getpresence(od->ssi.local); + presence = aim_ssi_getpresence(&od->ssi.local); if (value) aim_ssi_setpresence(od, presence & ~AIM_SSI_PRESENCE_FLAG_NORECENTBUDDIES); @@ -3709,7 +3709,7 @@ oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { } if (od->ssi.received_data) { - if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) { + if (!aim_ssi_itemlist_finditem(&od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) { purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n", bname, gname); aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); @@ -3721,8 +3721,8 @@ oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { purple_prpl_got_user_status(account, bname, OSCAR_STATUS_ID_MOBILE, NULL); } - } else if (aim_ssi_waitingforauth(od->ssi.local, - aim_ssi_itemlist_findparentname(od->ssi.local, bname), + } else if (aim_ssi_waitingforauth(&od->ssi.local, + aim_ssi_itemlist_findparentname(&od->ssi.local, bname), bname)) { /* Not authorized -- Re-request authorization */ oscar_auth_sendrequest(gc, bname); @@ -3760,7 +3760,7 @@ void oscar_alias_buddy(PurpleConnection *gc, const char *name, const char *alias OscarData *od = purple_connection_get_protocol_data(gc); if (od->ssi.received_data) { - char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); + char *gname = aim_ssi_itemlist_findparentname(&od->ssi.local, name); if (gname) { purple_debug_info("oscar", "ssi: changing the alias for buddy %s to %s\n", name, alias ? alias : "(none)"); @@ -3777,7 +3777,7 @@ void oscar_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup if (od->ssi.received_data) { const char *gname = purple_group_get_name(group); - if (aim_ssi_itemlist_finditem(od->ssi.local, gname, NULL, AIM_SSI_TYPE_GROUP)) { + if (aim_ssi_itemlist_finditem(&od->ssi.local, gname, NULL, AIM_SSI_TYPE_GROUP)) { GList *cur, *groups = NULL; PurpleAccount *account = purple_connection_get_account(gc); @@ -3928,7 +3928,7 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * gname = purple_group_get_name(g); bname = purple_buddy_get_name(b); - if (aim_ssi_itemlist_exists(od->ssi.local, bname)) { + if (aim_ssi_itemlist_exists(&od->ssi.local, bname)) { /* If the buddy is an ICQ user then load his nickname */ const char *servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick"); char *alias; @@ -3937,7 +3937,7 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * serv_got_alias(gc, bname, servernick); /* Store local alias on server */ - alias = aim_ssi_getalias(od->ssi.local, gname, bname); + alias = aim_ssi_getalias(&od->ssi.local, gname, bname); balias = purple_buddy_get_local_buddy_alias(b); if (!alias && balias && *balias) aim_ssi_aliasbuddy(od, gname, bname, balias); @@ -3960,7 +3960,7 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * while (next != NULL) { cur = next; next = next->next; - if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { + if (!aim_ssi_itemlist_finditem(&od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { purple_debug_info("oscar", "ssi: removing permit %s from local list\n", (const char *)cur->data); purple_privacy_permit_remove(account, cur->data, TRUE); @@ -3973,7 +3973,7 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * while (next != NULL) { cur = next; next = next->next; - if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, deny_entry_type)) { + if (!aim_ssi_itemlist_finditem(&od->ssi.local, NULL, cur->data, deny_entry_type)) { purple_debug_info("oscar", "ssi: removing deny %s from local list\n", (const char *)cur->data); purple_privacy_deny_remove(account, cur->data, TRUE); @@ -3981,7 +3981,7 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * } /* Presence settings (idle time visibility) */ - tmp = aim_ssi_getpresence(od->ssi.local); + tmp = aim_ssi_getpresence(&od->ssi.local); if (tmp != 0xFFFFFFFF) { const char *idle_reporting_pref; gboolean report_idle; @@ -3999,7 +3999,7 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * /*** Begin code for adding from server list to local list ***/ - for (curitem=od->ssi.local; curitem; curitem=curitem->next) { + for (curitem=od->ssi.local.data; curitem; curitem=curitem->next) { if (curitem->name && !g_utf8_validate(curitem->name, -1, NULL)) { /* Got node with invalid UTF-8 in the name. Skip it. */ purple_debug_warning("oscar", "ssi: server list contains item of " @@ -4013,7 +4013,7 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * struct aim_ssi_item *groupitem; char *gname, *gname_utf8, *alias, *alias_utf8; - groupitem = aim_ssi_itemlist_find(od->ssi.local, curitem->gid, 0x0000); + groupitem = aim_ssi_itemlist_find(&od->ssi.local, curitem->gid, 0x0000); gname = groupitem ? groupitem->name : NULL; gname_utf8 = oscar_utf8_try_convert(account, od, gname); @@ -4023,7 +4023,7 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * purple_blist_add_group(g, NULL); } - alias = aim_ssi_getalias(od->ssi.local, gname, curitem->name); + alias = aim_ssi_getalias_from_item(curitem); alias_utf8 = oscar_utf8_try_convert(account, od, alias); b = purple_find_buddy_in_group(account, curitem->name, g); @@ -4091,7 +4091,7 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * * a part of your status and not really related to blocking. */ if (!od->icq && curitem->data) { - guint8 perm_deny = aim_ssi_getpermdeny(od->ssi.local); + guint8 perm_deny = aim_ssi_getpermdeny(&od->ssi.local); if (perm_deny != 0 && perm_deny != account->perm_deny) { purple_debug_info("oscar", @@ -4220,10 +4220,10 @@ purple_ssi_parseaddmod(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) if ((type != 0x0000) || (name == NULL)) return 1; - gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); + gname = aim_ssi_itemlist_findparentname(&od->ssi.local, name); gname_utf8 = gname ? oscar_utf8_try_convert(account, od, gname) : NULL; - alias = aim_ssi_getalias(od->ssi.local, gname, name); + alias = aim_ssi_getalias(&od->ssi.local, gname, name); alias_utf8 = oscar_utf8_try_convert(account, od, alias); g_free(alias); @@ -4261,7 +4261,7 @@ purple_ssi_parseaddmod(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) } - ssi_item = aim_ssi_itemlist_finditem(od->ssi.local, + ssi_item = aim_ssi_itemlist_finditem(&od->ssi.local, gname, name, AIM_SSI_TYPE_BUDDY); if (ssi_item == NULL) { @@ -4634,8 +4634,8 @@ const char *oscar_list_emblem(PurpleBuddy *b) if (purple_presence_is_online(presence) == FALSE) { char *gname; if ((name) && (od) && (od->ssi.received_data) && - (gname = aim_ssi_itemlist_findparentname(od->ssi.local, name)) && - (aim_ssi_waitingforauth(od->ssi.local, gname, name))) { + (gname = aim_ssi_itemlist_findparentname(&od->ssi.local, name)) && + (aim_ssi_waitingforauth(&od->ssi.local, gname, name))) { return "not-authorized"; } } @@ -4702,8 +4702,8 @@ char *oscar_status_text(PurpleBuddy *b) if ((od != NULL) && !purple_presence_is_online(presence)) { const char *name = purple_buddy_get_name(b); - char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); - if (aim_ssi_waitingforauth(od->ssi.local, gname, name)) + char *gname = aim_ssi_itemlist_findparentname(&od->ssi.local, name); + if (aim_ssi_waitingforauth(&od->ssi.local, gname, name)) ret = g_strdup(_("Not Authorized")); else ret = g_strdup(_("Offline")); @@ -4946,7 +4946,7 @@ static void oscar_buddycb_edit_comment(PurpleBlistNode *node, gpointer ignore) { data = g_new(struct name_data, 1); - comment = aim_ssi_getcomment(od->ssi.local, purple_group_get_name(g), name); + comment = aim_ssi_getcomment(&od->ssi.local, purple_group_get_name(g), name); comment_utf8 = comment ? oscar_utf8_try_convert(account, od, comment) : NULL; data->gc = gc; @@ -5161,8 +5161,8 @@ oscar_buddy_menu(PurpleBuddy *buddy) { * waiting for authorization. */ char *gname; - gname = aim_ssi_itemlist_findparentname(od->ssi.local, bname); - if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, bname)) + gname = aim_ssi_itemlist_findparentname(&od->ssi.local, bname); + if (gname && aim_ssi_waitingforauth(&od->ssi.local, gname, bname)) { act = purple_menu_action_new(_("Re-request Authorization"), PURPLE_CALLBACK(oscar_auth_sendrequest_menu), @@ -5313,7 +5313,7 @@ static void oscar_show_awaitingauth(PurplePluginAction *action) buddy = cur->data; bname = purple_buddy_get_name(buddy); gname = purple_group_get_name(purple_buddy_get_group(buddy)); - if (aim_ssi_waitingforauth(od->ssi.local, gname, bname)) { + if (aim_ssi_waitingforauth(&od->ssi.local, gname, bname)) { filtered_buddies = g_slist_prepend(filtered_buddies, buddy); } } diff --git a/libpurple/protocols/oscar/oscar.h b/libpurple/protocols/oscar/oscar.h index a1fd4516ab..50fbc1dd29 100644 --- a/libpurple/protocols/oscar/oscar.h +++ b/libpurple/protocols/oscar/oscar.h @@ -308,9 +308,14 @@ struct _IcbmCookie #include "peer.h" -/* - * AIM Session: The main client-data interface. - * +struct aim_ssi_itemlist { + struct aim_ssi_item *data; + GHashTable *idx_gid_bid; + GHashTable *idx_all_named_items; +}; + +/** + * The main client-data interface. */ struct _OscarData { @@ -387,8 +392,8 @@ struct _OscarData struct { gboolean received_data; guint16 numitems; - struct aim_ssi_item *official; - struct aim_ssi_item *local; + struct aim_ssi_itemlist official; + struct aim_ssi_itemlist local; struct aim_ssi_tmp *pending; time_t timestamp; gboolean waiting_for_ack; @@ -916,15 +921,16 @@ struct aim_ssi_tmp /* 0x001a */ int aim_ssi_sendauthreply(OscarData *od, char *bn, guint8 reply, const char *msg); /* Client functions for retrieving SSI data */ -struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid); -struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *bn, guint16 type); -struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *bn); -char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *bn); -int aim_ssi_getpermdeny(struct aim_ssi_item *list); -guint32 aim_ssi_getpresence(struct aim_ssi_item *list); -char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *bn); -char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *bn); -gboolean aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *bn); +struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_itemlist *list, guint16 gid, guint16 bid); +struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_itemlist *list, const char *gn, const char *bn, guint16 type); +struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_itemlist *list, const char *bn); +char *aim_ssi_itemlist_findparentname(struct aim_ssi_itemlist *list, const char *bn); +int aim_ssi_getpermdeny(struct aim_ssi_itemlist *list); +guint32 aim_ssi_getpresence(struct aim_ssi_itemlist *list); +char *aim_ssi_getalias(struct aim_ssi_itemlist *list, const char *gn, const char *bn); +char *aim_ssi_getalias_from_item(struct aim_ssi_item *item); +char *aim_ssi_getcomment(struct aim_ssi_itemlist *list, const char *gn, const char *bn); +gboolean aim_ssi_waitingforauth(struct aim_ssi_itemlist *list, const char *gn, const char *bn); /* Client functions for changing SSI data */ int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, GSList *tlvlist, const char *alias, const char *comment, const char *smsnum, gboolean needauth); diff --git a/libpurple/protocols/oscar/oscar_data.c b/libpurple/protocols/oscar/oscar_data.c index 5498bba986..6f7ac700e1 100644 --- a/libpurple/protocols/oscar/oscar_data.c +++ b/libpurple/protocols/oscar/oscar_data.c @@ -47,6 +47,12 @@ oscar_data_new(void) od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); od->handlerlist = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); + od->ssi.local.idx_gid_bid = g_hash_table_new(g_direct_hash, g_direct_equal); + od->ssi.local.idx_all_named_items = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + + od->ssi.official.idx_gid_bid = g_hash_table_new(g_direct_hash, g_direct_equal); + od->ssi.official.idx_all_named_items = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + /* * Register all the modules for this session... */ @@ -126,6 +132,12 @@ oscar_data_destroy(OscarData *od) g_hash_table_destroy(od->buddyinfo); g_hash_table_destroy(od->handlerlist); + g_hash_table_destroy(od->ssi.local.idx_gid_bid); + g_hash_table_destroy(od->ssi.local.idx_all_named_items); + + g_hash_table_destroy(od->ssi.official.idx_gid_bid); + g_hash_table_destroy(od->ssi.official.idx_all_named_items); + g_free(od); } diff --git a/libpurple/protocols/oscar/userinfo.c b/libpurple/protocols/oscar/userinfo.c index 58653e6eb9..fcec4aaa21 100644 --- a/libpurple/protocols/oscar/userinfo.c +++ b/libpurple/protocols/oscar/userinfo.c @@ -263,8 +263,8 @@ oscar_user_info_append_status(PurpleConnection *gc, PurpleNotifyUserInfo *user_i message = tmp; } - } else if (aim_ssi_waitingforauth(od->ssi.local, - aim_ssi_itemlist_findparentname(od->ssi.local, purple_buddy_get_name(b)), + } else if (aim_ssi_waitingforauth(&od->ssi.local, + aim_ssi_itemlist_findparentname(&od->ssi.local, purple_buddy_get_name(b)), purple_buddy_get_name(b))) { /* Note if an offline buddy is not authorized */ @@ -356,7 +356,7 @@ oscar_user_info_append_extra_info(PurpleConnection *gc, PurpleNotifyUserInfo *us } if ((b != NULL) && (bname != NULL) && (g != NULL) && (gname != NULL)) { - tmp = aim_ssi_getcomment(od->ssi.local, gname, bname); + tmp = aim_ssi_getcomment(&od->ssi.local, gname, bname); if (tmp != NULL) { char *tmp2 = g_markup_escape_text(tmp, strlen(tmp)); g_free(tmp); @@ -543,4 +543,4 @@ oscar_user_info_display_aim(OscarData *od, aim_userinfo_t *userinfo) purple_notify_userinfo(gc, userinfo->bn, user_info, NULL, NULL); purple_notify_user_info_destroy(user_info); -} \ No newline at end of file +} diff --git a/libpurple/protocols/oscar/visibility.c b/libpurple/protocols/oscar/visibility.c index d6aa589d8c..3c091a9781 100644 --- a/libpurple/protocols/oscar/visibility.c +++ b/libpurple/protocols/oscar/visibility.c @@ -51,7 +51,7 @@ get_buddy_list_type(OscarData *od) static gboolean is_buddy_on_list(OscarData *od, const char *bname) { - return aim_ssi_itemlist_finditem(od->ssi.local, NULL, bname, get_buddy_list_type(od)) != NULL; + return aim_ssi_itemlist_finditem(&od->ssi.local, NULL, bname, get_buddy_list_type(od)) != NULL; } static void @@ -102,7 +102,7 @@ show_private_list(PurplePluginAction *action, guint16 list_type, const gchar *ti buddy = cur->data; bname = purple_buddy_get_name(buddy); - if (aim_ssi_itemlist_finditem(od->ssi.local, NULL, bname, list_type)) { + if (aim_ssi_itemlist_finditem(&od->ssi.local, NULL, bname, list_type)) { filtered_buddies = g_slist_prepend(filtered_buddies, buddy); } } -- cgit v1.2.1 From a784b5407e5b4cb678f6563749a4f0eecb572f26 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 21 Mar 2011 03:56:15 +0000 Subject: Fix the blist headline, so it doesn't force the list to be super-wide. --- pidgin/gtkblist.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 4dfcd98457..625cb10b63 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -6029,10 +6029,8 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtk_container_set_border_width(GTK_CONTAINER(gtkblist->headline_hbox), 6); gtk_container_add(GTK_CONTAINER(ebox), gtkblist->headline_hbox); gtkblist->headline_image = gtk_image_new_from_pixbuf(NULL); - gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.0, 0); + gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.5, 0.5); gtkblist->headline_label = gtk_label_new(NULL); - gtk_widget_set_size_request(gtkblist->headline_label, - purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width")-25,-1); gtk_label_set_line_wrap(GTK_LABEL(gtkblist->headline_label), TRUE); gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_image, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_label, TRUE, TRUE, 0); -- cgit v1.2.1 From 298bf191defe36c6f7ecea4114389efa2164883e Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 13 Apr 2011 00:16:51 +0000 Subject: In purple_buddy_icons_set_account_icon, call the prpl's set_buddy_icon function if the account is in the connecting state (not just connected). I believe this is the polite thing to do. I'm seeing a little race condition in the jabber prpl where if the user changes their icon while the account is connecting, the new icon isn't set. This is one half of the fix. I don't _think_ this will cause problems. It's possible that some prpls will be unhappy if a user tries to set an icon while the account is connecting. If those problems exist, I think they should be fixed in each prpl. --- libpurple/buddyicon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c index 813d810ab5..26013701c9 100644 --- a/libpurple/buddyicon.c +++ b/libpurple/buddyicon.c @@ -756,7 +756,7 @@ purple_buddy_icons_set_account_icon(PurpleAccount *account, else g_hash_table_remove(pointer_icon_cache, account); - if (purple_account_is_connected(account)) + if (!purple_account_is_disconnected(account)) { PurpleConnection *gc; PurplePluginProtocolInfo *prpl_info; -- cgit v1.2.1 From 06d99630dbf05dc3f56944efeecceb2c92e6e197 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 13 Apr 2011 00:17:13 +0000 Subject: Typo fix --- libpurple/protocols/jabber/buddy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index ceca119b47..2145c44e96 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -465,7 +465,7 @@ void jabber_set_info(PurpleConnection *gc, const char *info) xmlnode *vc_node; const struct tag_attr *tag_attr; - /* if we have't grabbed the remote vcard yet, we can't + /* if we haven't grabbed the remote vcard yet, we can't * assume that what we have here is correct */ if(!js->vcard_fetched) return; -- cgit v1.2.1 From 552a553fe66e104a9b0fb4226cb9598690cbe36f Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 13 Apr 2011 00:22:29 +0000 Subject: Update js->initial_avatar_hash if the user tries to set the icon before we've received our self vcard. This is the other half of a fix to get rid of a race condition where the user's icon wouldn't get set correctly if they set it while connecting. --- libpurple/protocols/jabber/buddy.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 2145c44e96..efc850830b 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -467,8 +467,20 @@ void jabber_set_info(PurpleConnection *gc, const char *info) /* if we haven't grabbed the remote vcard yet, we can't * assume that what we have here is correct */ - if(!js->vcard_fetched) + if(!js->vcard_fetched) { + PurpleStoredImage *image; + g_free(js->initial_avatar_hash); + image = purple_buddy_icons_find_account_icon(purple_connection_get_account(gc)); + if (image != NULL) { + js->initial_avatar_hash = + jabber_calculate_data_hash(purple_imgstore_get_data(image), + purple_imgstore_get_size(image), "sha1"); + purple_imgstore_unref(image); + } else { + js->initial_avatar_hash = NULL; + } return; + } if (js->vcard_timer) { purple_timeout_remove(js->vcard_timer); -- cgit v1.2.1 From d341bcc980878a20fb35fdee14ba82aace881f1f Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 13 Apr 2011 01:37:56 +0000 Subject: Fix this indentation. My bad. --- libpurple/protocols/jabber/buddy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index efc850830b..b0305390ae 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -474,7 +474,7 @@ void jabber_set_info(PurpleConnection *gc, const char *info) if (image != NULL) { js->initial_avatar_hash = jabber_calculate_data_hash(purple_imgstore_get_data(image), - purple_imgstore_get_size(image), "sha1"); + purple_imgstore_get_size(image), "sha1"); purple_imgstore_unref(image); } else { js->initial_avatar_hash = NULL; -- cgit v1.2.1 From 8bf6c377a6f9dd2b4212577cf8e0e738ccaac4ce Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 18 Apr 2011 07:02:43 +0000 Subject: Remove code that doesn't want to exist in 3.0.0 --- libpurple/dnssrv.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libpurple/dnssrv.h b/libpurple/dnssrv.h index db2e0a24b7..2a81f71358 100644 --- a/libpurple/dnssrv.h +++ b/libpurple/dnssrv.h @@ -32,10 +32,6 @@ typedef struct _PurpleSrvTxtQueryData PurpleSrvTxtQueryData; typedef struct _PurpleSrvResponse PurpleSrvResponse; typedef struct _PurpleTxtResponse PurpleTxtResponse; -/* For compatibility, should be removed for 3.0.0 - */ -typedef struct _PurpleSrvTxtQueryData PurpleSrvQueryData; - #include enum PurpleDnsType { -- cgit v1.2.1 From 0fa5d48546334c7f31135d9e0cbd33b7c26fab01 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 3 May 2011 20:55:39 +0000 Subject: Add API: * purple_notify_searchresult_column_set_visible * purple_notify_searchresult_column_is_visible This allows columns to be defined in the search-results, but that are not visible to the user. These columns can, for example, be used to store values associated with the selected-row that are required in the search-result callback. --- ChangeLog.API | 4 ++++ finch/gntnotify.c | 3 +++ libpurple/notify.c | 16 ++++++++++++++++ libpurple/notify.h | 20 +++++++++++++++++++- pidgin/gtknotify.c | 4 ++++ 5 files changed, 46 insertions(+), 1 deletion(-) diff --git a/ChangeLog.API b/ChangeLog.API index 9431e4b69f..2ad06853f8 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -2,6 +2,10 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 3.0.0 (??/??/????): libpurple: + Added: + * purple_notify_searchresult_column_set_visible + * purple_notify_searchresult_column_is_visible + Removed: * purple_core_migrate diff --git a/finch/gntnotify.c b/finch/gntnotify.c index 3884bafa40..0181d373b1 100644 --- a/finch/gntnotify.c +++ b/finch/gntnotify.c @@ -426,6 +426,9 @@ finch_notify_searchresults(PurpleConnection *gc, const char *title, { PurpleNotifySearchColumn *column = iter->data; gnt_tree_set_column_title(GNT_TREE(tree), i, column->title); + + if (!purple_notify_searchresult_column_is_visible(column)) + gnt_tree_set_column_visible(GNT_TREE(tree), i, FALSE); i++; } diff --git a/libpurple/notify.c b/libpurple/notify.c index 45514bd95d..291ea63e7c 100644 --- a/libpurple/notify.c +++ b/libpurple/notify.c @@ -363,10 +363,26 @@ purple_notify_searchresults_column_new(const char *title) sc = g_new0(PurpleNotifySearchColumn, 1); sc->title = g_strdup(title); + sc->visible = TRUE; return sc; } +void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *column, gboolean visible) +{ + g_return_if_fail(column != NULL); + + column->visible = visible; +} + +gboolean +purple_notify_searchresult_column_is_visible(const PurpleNotifySearchColumn *column) +{ + g_return_val_if_fail(column != NULL, FALSE); + + return column->visible; +} + guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results) { diff --git a/libpurple/notify.h b/libpurple/notify.h index dc410b600c..e3f7a54c91 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -111,7 +111,8 @@ typedef enum */ typedef struct { - char *title; /**< Title of the column. */ + char *title; /**< Title of the column. */ + gboolean visible; } PurpleNotifySearchColumn; @@ -274,6 +275,23 @@ PurpleNotifySearchResults *purple_notify_searchresults_new(void); */ PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title); +/** + * Sets whether or not a search result column is visible. + * + * @param field The search column object. + * @param visible TRUE if visible, or FALSE if not. + */ +void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *column, gboolean visible); + +/** + * Returns whether or not a search result column is visible. + * + * @param field The search column object. + * + * @return TRUE if the search result column is visible. FALSE otherwise. + */ +gboolean purple_notify_searchresult_column_is_visible(const PurpleNotifySearchColumn *column); + /** * Adds a new column to the search result object. * diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 8d15e036fc..c4372aa9b9 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -1035,6 +1035,10 @@ pidgin_notify_searchresults(PurpleConnection *gc, const char *title, gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, column->title, renderer, "text", i, NULL); + + if (!purple_notify_searchresult_column_is_visible(column)) + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i), FALSE); + i++; } -- cgit v1.2.1 From 19f312982e3c7eb5b72e4427606543cca1f4ba85 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 3 May 2011 21:22:51 +0000 Subject: Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip This allows protocol prpl's to provide some context-sensitive help text for Requiest UI fields. --- ChangeLog.API | 2 ++ libpurple/request.c | 18 ++++++++++++++++++ libpurple/request.h | 22 ++++++++++++++++++++++ pidgin/gtkrequest.c | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/ChangeLog.API b/ChangeLog.API index 2ad06853f8..aba652721e 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -5,6 +5,8 @@ version 3.0.0 (??/??/????): Added: * purple_notify_searchresult_column_set_visible * purple_notify_searchresult_column_is_visible + * purple_request_field_set_tooltip + * purple_request_field_get_tooltip Removed: * purple_core_migrate diff --git a/libpurple/request.c b/libpurple/request.c index d61d24182e..01966dc435 100644 --- a/libpurple/request.c +++ b/libpurple/request.c @@ -365,6 +365,7 @@ purple_request_field_destroy(PurpleRequestField *field) g_free(field->id); g_free(field->label); g_free(field->type_hint); + g_free(field->tooltip); if (field->type == PURPLE_REQUEST_FIELD_STRING) { @@ -427,6 +428,15 @@ purple_request_field_set_type_hint(PurpleRequestField *field, field->type_hint = g_strdup(type_hint); } +void +purple_request_field_set_tooltip(PurpleRequestField *field, const char *tooltip) +{ + g_return_if_fail(field != NULL); + + g_free(field->tooltip); + field->tooltip = g_strdup(tooltip); +} + void purple_request_field_set_required(PurpleRequestField *field, gboolean required) { @@ -502,6 +512,14 @@ purple_request_field_get_type_hint(const PurpleRequestField *field) return field->type_hint; } +const char * +purple_request_field_get_tooltip(const PurpleRequestField *field) +{ + g_return_val_if_fail(field != NULL, NULL); + + return field->tooltip; +} + gboolean purple_request_field_is_required(const PurpleRequestField *field) { diff --git a/libpurple/request.h b/libpurple/request.h index 8035ef806b..9330894982 100644 --- a/libpurple/request.h +++ b/libpurple/request.h @@ -180,6 +180,7 @@ struct _PurpleRequestField } u; void *ui_data; + char *tooltip; }; #endif @@ -516,6 +517,18 @@ void purple_request_field_set_visible(PurpleRequestField *field, gboolean visibl void purple_request_field_set_type_hint(PurpleRequestField *field, const char *type_hint); +/** + * Sets the tooltip for the field. + * + * This is optionally used by the UIs to provide a tooltip for + * the field. + * + * @param field The field. + * @param tooltip The tooltip text. + */ +void purple_request_field_set_tooltip(PurpleRequestField *field, + const char *tooltip); + /** * Sets whether or not a field is required. * @@ -581,6 +594,15 @@ gboolean purple_request_field_is_visible(const PurpleRequestField *field); */ const char *purple_request_field_get_type_hint(const PurpleRequestField *field); +/** + * Returns the field's tooltip. + * + * @param field The field. + * + * @return The field's tooltip. + */ +const char *purple_request_field_get_tooltip(const PurpleRequestField *field); + /** * Returns whether or not a field is required. * diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index 83f12e9542..15e9179313 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -862,6 +862,10 @@ create_string_field(PurpleRequestField *field) gtk_text_buffer_set_text(buffer, value, -1); } +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(textview, purple_request_field_get_tooltip(field)); +#endif + gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), purple_request_field_string_is_editable(field)); @@ -886,6 +890,10 @@ create_string_field(PurpleRequestField *field) if (value != NULL) gtk_entry_set_text(GTK_ENTRY(widget), value); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field)); +#endif + if (purple_request_field_string_is_masked(field)) { gtk_entry_set_visibility(GTK_ENTRY(widget), FALSE); @@ -926,6 +934,10 @@ create_int_field(PurpleRequestField *field) gtk_entry_set_text(GTK_ENTRY(widget), buf); } +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field)); +#endif + g_signal_connect(G_OBJECT(widget), "focus-out-event", G_CALLBACK(field_int_focus_out_cb), field); @@ -940,6 +952,10 @@ create_bool_field(PurpleRequestField *field) widget = gtk_check_button_new_with_label( purple_request_field_get_label(field)); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field)); +#endif + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), purple_request_field_bool_get_default_value(field)); @@ -970,6 +986,10 @@ create_choice_field(PurpleRequestField *field) gtk_combo_box_set_active(GTK_COMBO_BOX(widget), purple_request_field_choice_get_default_value(field)); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field)); +#endif + g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(field_choice_menu_cb), field); } @@ -987,6 +1007,10 @@ create_choice_field(PurpleRequestField *field) widget = box; +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field)); +#endif + for (l = labels, i = 0; l != NULL; l = l->next, i++) { const char *text = l->data; @@ -1034,6 +1058,10 @@ create_image_field(PurpleRequestField *field) g_object_unref(G_OBJECT(loader)); g_object_unref(G_OBJECT(scale)); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field)); +#endif + return widget; } @@ -1049,6 +1077,10 @@ create_account_field(PurpleRequestField *field) purple_request_field_account_get_filter(field), field); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field)); +#endif + return widget; } -- cgit v1.2.1 From 3bc34060cb55fc2bb11cab4b541ebd08b25e037d Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Thu, 5 May 2011 03:40:29 +0000 Subject: Document the default explicitly --- libpurple/notify.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libpurple/notify.h b/libpurple/notify.h index e3f7a54c91..9d4dd89c93 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -112,7 +112,7 @@ typedef enum typedef struct { char *title; /**< Title of the column. */ - gboolean visible; + gboolean visible; /**< Should the column be visible to the user. Defaults to TRUE. */ } PurpleNotifySearchColumn; @@ -267,7 +267,8 @@ void purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *r PurpleNotifySearchResults *purple_notify_searchresults_new(void); /** - * Returns a newly created search result column object. + * Returns a newly created search result column object. The column defaults + * to being visible. * * @param title Title of the column. NOTE: Title will get g_strdup()ed. * -- cgit v1.2.1 From 5772fc974fac9083be49916eab55458700516446 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 9 May 2011 04:42:52 +0000 Subject: Change the heuristic we use for setting od->icq. We used to set it to true any time the username contained only digits. Now we set it to try if account->protocol_id is prpl-icq. This means we're now relying on the user to tell us whether their account is AIM or ICQ... and I think that's fine. The reason for this change is that we/AOL apparently allow the user to login to ICQ accounts by entering their email address. This means we're no longer able to look at the username to determine whether it's an AIM name or an ICQ name. This was a problem because we were trying to format the spacing/capitalization in the username if the name was an icq email address, which resulted in an annoying popup error at login. Fixes #13883. It's probably safe for this to go into im.pidgin.pidgin (maybe after the pending release), but I really don't want to keep changing the 2.x.y branch. I think we need to move on to 3.x.y. --- ChangeLog | 2 ++ libpurple/protocols/oscar/oscar.c | 26 ++++++-------------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 415426e357..84989e584f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 3.0.0 (??/??/????): AIM and ICQ: * Make buddy list management code more efficient. (Oliver) (#4816) + * Don't try to format ICQ usernames entered as email addresses. + Gets rid of an "Unable to format username" error at login. (#13883) version 2.8.0 (??/??/????): General: diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 7570618027..6220201244 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -741,7 +741,7 @@ oscar_login(PurpleAccount *account) } gc->flags |= PURPLE_CONNECTION_HTML; - if (oscar_util_valid_name_icq((purple_account_get_username(account)))) { + if (g_str_equal(purple_account_get_protocol_id(account), "prpl-icq")) { od->icq = TRUE; gc->flags |= PURPLE_CONNECTION_SUPPORT_MOODS; } else { @@ -4581,32 +4581,18 @@ PurpleMood* oscar_get_purple_moods(PurpleAccount *account) const char *oscar_list_icon_icq(PurpleAccount *a, PurpleBuddy *b) { const char *name = b ? purple_buddy_get_name(b) : NULL; - if ((b == NULL) || (name == NULL) || oscar_util_valid_name_sms(name)) - { - if (a == NULL || oscar_util_valid_name_icq(purple_account_get_username(a))) - return "icq"; - else - return "aim"; - } - - if (oscar_util_valid_name_icq(name)) + if (name && !oscar_util_valid_name_sms(name) && oscar_util_valid_name_icq(name)) return "icq"; - return "aim"; + + return "icq"; } const char *oscar_list_icon_aim(PurpleAccount *a, PurpleBuddy *b) { const char *name = b ? purple_buddy_get_name(b) : NULL; - if ((b == NULL) || (name == NULL) || oscar_util_valid_name_sms(name)) - { - if (a != NULL && oscar_util_valid_name_icq(purple_account_get_username(a))) - return "icq"; - else - return "aim"; - } - - if (oscar_util_valid_name_icq(name)) + if (name && !oscar_util_valid_name_sms(name) && oscar_util_valid_name_icq(name)) return "icq"; + return "aim"; } -- cgit v1.2.1 From d10d1f3f06cffc7be5a9c1b15f2ed176ecc63bcf Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Thu, 16 Jun 2011 04:23:48 +0000 Subject: Fix some white spaces issues. --- pidgin/plugins/adiumthemes/webkit.c | 82 ++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index e6fcd18cdb..117ca7746a 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -26,7 +26,7 @@ * A lot of this was originally written by Sean Egan, but I think I've * rewrote enough to replace the author for now. */ -#define PLUGIN_AUTHOR "Arnold Noronha " +#define PLUGIN_AUTHOR "Arnold Noronha " #define PURPLE_PLUGINS "Hell yeah" /* System headers */ @@ -74,7 +74,7 @@ static void glist_free_all_string (GList *list) { GList *first = list; - for (; list; list = g_list_next (list)) + for (; list; list = g_list_next (list)) g_free (list->data); g_list_free (first); } @@ -95,13 +95,13 @@ static void webkit_plugin_free_handle () static char * replace_message_tokens( - const char *text, - gsize len, - PurpleConversation *conv, - const char *name, - const char *alias, - const char *message, - PurpleMessageFlags flags, + const char *text, + gsize len, + PurpleConversation *conv, + const char *name, + const char *alias, + const char *message, + PurpleMessageFlags flags, time_t mtime) { GString *str = g_string_new_len(NULL, len); @@ -111,7 +111,7 @@ replace_message_tokens( while ((cur = strchr(cur, '%'))) { const char *replace = NULL; char *fin = NULL; - + if (!strncmp(cur, "%message%", strlen("%message%"))) { replace = message; } else if (!strncmp(cur, "%messageClasses%", strlen("%messageClasses%"))) { @@ -126,7 +126,7 @@ replace_message_tokens( continue; format = g_strndup(start, end - start); fin = end + 1; - } + } replace = purple_utf8_strftime(format ? format : "%X", NULL); g_free(format); } else if (!strncmp(cur, "%userIconPath%", strlen("%userIconPath%"))) { @@ -147,7 +147,7 @@ replace_message_tokens( replace = g_build_filename("Incoming", "buddy_icon.png", NULL); } } - + } else if (!strncmp(cur, "%senderScreenName%", strlen("%senderScreenName%"))) { replace = name; } else if (!strncmp(cur, "%sender%", strlen("%sender%"))) { @@ -165,13 +165,13 @@ replace_message_tokens( /* And update the pointers */ if (fin) { - prev = cur = fin + 1; + prev = cur = fin + 1; } else { prev = cur = strchr(cur + 1, '%') + 1; } } - + /* And wrap it up */ g_string_append(str, prev); return g_string_free(str, FALSE); @@ -191,24 +191,24 @@ replace_header_tokens(char *text, gsize len, PurpleConversation *conv) const char *replace = NULL; char *fin = NULL; - if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { + if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { replace = conv->name; - } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { + } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { replace = purple_account_get_alias(conv->account); if (replace == NULL) replace = purple_account_get_username(conv->account); - } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { + } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); if (buddy) { replace = purple_buddy_get_alias(buddy); } else { replace = conv->name; } - } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { + } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); replace = purple_buddy_icon_get_full_path(icon); - } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { - } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { + } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { + } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { char *format = NULL; if (*(cur + strlen("%timeOpened")) == '{') { char *start = cur + strlen("%timeOpened") + 1; @@ -217,7 +217,7 @@ replace_header_tokens(char *text, gsize len, PurpleConversation *conv) continue; format = g_strndup(start, end - start); fin = end + 1; - } + } replace = purple_utf8_strftime(format ? format : "%X", NULL); g_free(format); } else { @@ -230,12 +230,12 @@ replace_header_tokens(char *text, gsize len, PurpleConversation *conv) /* And update the pointers */ if (fin) { - prev = cur = fin + 1; + prev = cur = fin + 1; } else { prev = cur = strchr(cur + 1, '%') + 1; } } - + /* And wrap it up */ g_string_append(str, prev); return g_string_free(str, FALSE); @@ -278,7 +278,7 @@ replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *he if (footer) g_string_append(str, footer); g_string_append(str, ms[5]); - + g_strfreev(ms); g_free (csspath); return g_string_free (str, FALSE); @@ -291,7 +291,7 @@ get_webkit(PurpleConversation *conv) gtkconv = PIDGIN_CONVERSATION(conv); if (!gtkconv) return NULL; - else + else return gtkconv->webview; } @@ -302,7 +302,7 @@ static void set_theme_webkit_settings (WebKitWebView *webview, PidginMessageStyl g_object_get (G_OBJECT(webview), "settings", &settings, NULL); if (style->default_font_family) g_object_set (G_OBJECT (settings), "default-font-family", style->default_font_family, NULL); - + if (style->default_font_size) g_object_set (G_OBJECT (settings), "default-font-size", GINT_TO_POINTER (style->default_font_size), NULL); @@ -347,7 +347,7 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) char* baseuri; PidginMessageStyle *style, *oldStyle; oldStyle = g_object_get_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY); - + if (oldStyle) return; purple_debug_info ("webkit", "loading %s\n", style_dir); @@ -363,7 +363,7 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); g_assert(template); - + purple_debug_info ("webkit", "template: %s\n", template); set_theme_webkit_settings (WEBKIT_WEB_VIEW(webkit), style); @@ -371,7 +371,7 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) PidginMessageStyle *copy = pidgin_message_style_copy (style); g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy); - + pidgin_message_style_unref (style); /* I need to unref this style when the webkit object destroys */ g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); @@ -425,7 +425,7 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, char *smileyed; time_t mtime = time (NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */ - PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); + PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); PidginMessageStyle *style; fprintf (stderr, "hmm.. here %s %s\n", name, message); @@ -510,7 +510,7 @@ get_dir_dir_list (const char* dirname) while ((subdir = g_dir_read_name (dir))) { ret = g_list_append (ret, g_build_filename (dirname, subdir, NULL)); } - + g_dir_close (dir); return ret; } @@ -533,11 +533,11 @@ get_style_directory_list () list1 = get_dir_dir_list (user_style_dir); list2 = get_dir_dir_list (global_style_dir); - + g_free (global_style_dir); g_free (user_style_dir); g_free (user_dir); - + return g_list_concat (list1, list2); } @@ -557,7 +557,7 @@ style_set_default () else { purple_notify_error(handle, _("Webkit themes"), _("Can't find installed styles"), - _("Please install some theme and verify the installation path")); + _("Please install some theme and verify the installation path")); return; } @@ -590,7 +590,7 @@ plugin_load(PurplePlugin *plugin) webkit_plugin_get_handle (), PURPLE_CALLBACK(webkit_on_displaying_im_msg), NULL); - + purple_signal_connect (pidgin_conversations_get_handle (), "displaying-chat-msg", webkit_plugin_get_handle (), @@ -620,7 +620,7 @@ plugin_load(PurplePlugin *plugin) GList* list = purple_get_conversations (); for (;list; list = g_list_next(list)) init_theme_for_webkit (list->data, cur_style_dir); - + } return TRUE; } @@ -684,7 +684,7 @@ get_style_config_frame () for (iter = styles; iter; iter = g_list_next (iter)) { PidginMessageStyle *style = pidgin_message_style_load (iter->data); - + if (style) { char *text = g_path_get_basename (iter->data); gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), text); @@ -729,7 +729,7 @@ variant_changed (GtkWidget* combobox, gpointer null) name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combobox)); pidgin_message_style_set_variant (style, name); pidgin_message_style_save_state (style); - + /* update conversations */ list = purple_get_conversations (); while (list) { @@ -742,12 +742,12 @@ variant_changed (GtkWidget* combobox, gpointer null) } static GtkWidget * -get_variant_config_frame() +get_variant_config_frame() { PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); GList *variants = pidgin_message_style_get_variants (style), *iter; char *cur_variant = pidgin_message_style_get_variant (style); - GtkWidget *combobox = gtk_combo_box_new_text(); + GtkWidget *combobox = gtk_combo_box_new_text(); int def = -1, index = 0; pidgin_message_style_unref (style); @@ -758,7 +758,7 @@ get_variant_config_frame() if (g_str_equal (cur_variant, iter->data)) def = index; index ++; - + } gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), def); -- cgit v1.2.1 From fa1fa0fbeae1844906377fb5471d681c653094bf Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Thu, 16 Jun 2011 04:37:03 +0000 Subject: Fix more white spaces issues. --- pidgin/gtkwebview.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index bd90579bb7..fa4f9fd299 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -83,8 +83,8 @@ get_image_filename_from_id (GtkWebView* view, int id) return filename; } -static void -clear_single_image (gpointer key, gpointer value, gpointer userdata) +static void +clear_single_image (gpointer key, gpointer value, gpointer userdata) { g_unlink ((char*) value); } @@ -208,7 +208,7 @@ process_js_script_queue (GtkWebView *view) return TRUE; /* there may be more for now */ } -static void +static void webview_load_started (WebKitWebView *view, WebKitWebFrame *frame, gpointer userdata) @@ -241,14 +241,14 @@ gtk_webview_init (GtkWebView *view, gpointer userdata) G_CALLBACK (webview_link_clicked), view); - g_signal_connect (view, "load-started", + g_signal_connect (view, "load-started", G_CALLBACK (webview_load_started), view); g_signal_connect (view, "load-finished", G_CALLBACK (webview_load_finished), view); - + view->priv->empty = TRUE; view->priv->js_queue = g_queue_new (); } @@ -274,7 +274,7 @@ char *gtk_webview_quote_js_string(const char *text) while (cur && *cur) { switch (*cur) { case '\\': - g_string_append(str, "\\\\"); + g_string_append(str, "\\\\"); break; case '\"': g_string_append(str, "\\\""); -- cgit v1.2.1 From cc3b0cf038a3ff0885e1a165ffe976326fad0981 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 20 Jun 2011 21:25:52 +0000 Subject: Correctly process messages received from MXit that include font-change markup. --- libpurple/protocols/mxit/markup.c | 90 +++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/libpurple/protocols/mxit/markup.c b/libpurple/protocols/mxit/markup.c index eef3f19182..f1597296ed 100644 --- a/libpurple/protocols/mxit/markup.c +++ b/libpurple/protocols/mxit/markup.c @@ -735,6 +735,7 @@ void mxit_parse_markup( struct RXMsgData* mx, char* message, int len, short msgt gboolean tag_bold = FALSE; gboolean tag_under = FALSE; gboolean tag_italic = FALSE; + int font_size = 0; #ifdef MXIT_DEBUG_MARKUP purple_debug_info( MXIT_PLUGIN_ID, "Markup RX (original): '%s'\n", message ); @@ -862,59 +863,54 @@ void mxit_parse_markup( struct RXMsgData* mx, char* message, int len, short msgt } break; case '.' : - if ( !( msgflags & CP_MSG_EMOTICON ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - else if ( i + 1 >= len ) { + if ( i + 1 >= len ) { /* message too short */ g_string_append_c( mx->msg, '.' ); break; } - switch ( message[i+1] ) { - case '+' : - /* increment text size */ - g_string_append( mx->msg, "" ); - i++; - break; - case '-' : - /* decrement text size */ - g_string_append( mx->msg, "" ); - i++; - break; - case '{' : - /* custom emoticon */ - if ( i + 2 >= len ) { - /* message too short */ - g_string_append_c( mx->msg, '.' ); - break; - } - - parse_emoticon_str( &message[i+2], tmpstr1 ); - if ( tmpstr1[0] != '\0' ) { - mx->got_img = TRUE; - - if ( g_hash_table_lookup( mx->session->iimages, tmpstr1 ) ) { - /* emoticon found in the cache, so we do not have to request it from the WAPsite */ - } - else { - /* request emoticon from the WAPsite */ - mx->img_count++; - emoticon_request( mx, tmpstr1 ); - } - - g_string_append_printf( mx->msg, MXIT_II_TAG"%s>", tmpstr1 ); - i += strlen( tmpstr1 ) + 2; - } - else - g_string_append_c( mx->msg, '.' ); - - break; - default : - g_string_append_c( mx->msg, '.' ); - break; + if ( ( msgflags & CP_MSG_EMOTICON ) && ( message[i+1] == '{' ) ) { + /* custom emoticon */ + if ( i + 2 >= len ) { + /* message too short */ + g_string_append_c( mx->msg, '.' ); + break; + } + + parse_emoticon_str( &message[i+2], tmpstr1 ); + if ( tmpstr1[0] != '\0' ) { + mx->got_img = TRUE; + + if ( g_hash_table_lookup( mx->session->iimages, tmpstr1 ) ) { + /* emoticon found in the cache, so we do not have to request it from the WAPsite */ + } + else { + /* request emoticon from the WAPsite */ + mx->img_count++; + emoticon_request( mx, tmpstr1 ); + } + + g_string_append_printf( mx->msg, MXIT_II_TAG"%s>", tmpstr1 ); + i += strlen( tmpstr1 ) + 2; + } + else + g_string_append_c( mx->msg, '.' ); } + else if ( ( msgflags & CP_MSG_MARKUP ) && ( message[i+1] == '+' ) ) { + /* increment text size */ + font_size++; + g_string_append_printf( mx->msg, "", font_size ); + i++; + } + else if ( ( msgflags & CP_MSG_MARKUP ) && ( message[i+1] == '-' ) ) { + /* decrement text size */ + font_size--; + g_string_append_printf( mx->msg, "", font_size ); + i++; + } + else + g_string_append_c( mx->msg, '.' ); + break; case '\\' : if ( i + 1 >= len ) { -- cgit v1.2.1 From d7eacd4f14c05260fe578e0e0f2c64594768dd3b Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 20 Jun 2011 21:36:22 +0000 Subject: These constants don't seem right. --- libpurple/protocols/mxit/roster.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libpurple/protocols/mxit/roster.h b/libpurple/protocols/mxit/roster.h index 5185dee3dc..44af0010af 100644 --- a/libpurple/protocols/mxit/roster.h +++ b/libpurple/protocols/mxit/roster.h @@ -96,7 +96,7 @@ /* client protocol constants */ #define MXIT_CP_MAX_JID_LEN 64 #define MXIT_CP_MAX_GROUP_LEN 32 -#define MXIT_CP_MAX_ALIAS_LEN 48 +#define MXIT_CP_MAX_ALIAS_LEN 100 #define MXIT_DEFAULT_GROUP "MXit" @@ -106,8 +106,8 @@ */ struct contact { char username[MXIT_CP_MAX_JID_LEN+1]; /* unique contact name (with domain) */ - char alias[MXIT_CP_MAX_GROUP_LEN+1]; /* contact alias (what will be seen) */ - char groupname[MXIT_CP_MAX_ALIAS_LEN+1]; /* contact group name */ + char alias[MXIT_CP_MAX_ALIAS_LEN+1]; /* contact alias (what will be seen) */ + char groupname[MXIT_CP_MAX_GROUP_LEN+1]; /* contact group name */ short type; /* contact type */ short mood; /* contact current mood */ -- cgit v1.2.1 From 3db8602d4de7b34ec9c496fd21815dac800b290d Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 26 Jun 2011 21:03:22 +0000 Subject: Start implementing MXit secure messaging. * Decoding of transport-layer encrypted MXit messages. --- libpurple/protocols/mxit/cipher.c | 60 +++++++++++++++++++++++++++++++++++++ libpurple/protocols/mxit/cipher.h | 2 ++ libpurple/protocols/mxit/protocol.c | 31 ++++++++++++++----- libpurple/protocols/mxit/protocol.h | 5 +++- 4 files changed, 89 insertions(+), 9 deletions(-) diff --git a/libpurple/protocols/mxit/cipher.c b/libpurple/protocols/mxit/cipher.c index efe0cf3277..7e3841ad54 100644 --- a/libpurple/protocols/mxit/cipher.c +++ b/libpurple/protocols/mxit/cipher.c @@ -34,6 +34,7 @@ /* password encryption */ #define INITIAL_KEY "6170383452343567" #define SECRET_HEADER "" +#define ENCRYPT_HEADER "" /*------------------------------------------------------------------------ @@ -106,3 +107,62 @@ char* mxit_encrypt_password( struct MXitSession* session ) return base64; } + +/*------------------------------------------------------------------------ + * Decrypt a transport-layer encryptede message. + * + * @param session The MXit session object + * @param message The encrypted message data. + * @return The decrypted message. Must be g_free'd when no longer needed. + */ +char* mxit_decrypt_message( struct MXitSession* session, char* message ) +{ + gsize raw_len; + guchar* raw_message; + char key[64]; + int pwdlen = strlen( session->acc->password ); + char exkey[512]; + int i; + GString* decoded = NULL; + + /* remove optional header: */ + if ( strncmp( message, ENCRYPT_HEADER, strlen( ENCRYPT_HEADER ) ) == 0 ) + message += strlen( ENCRYPT_HEADER ); + + /* base64 decode the message */ + raw_message = purple_base64_decode( message, &raw_len ); + + /* build the key - Client key, appended with last 8 characters of the PIN. (no padding) */ + memset( key, 0x00, sizeof( key ) ); + memcpy( key, session->clientkey, strlen( session->clientkey ) ); + if ( pwdlen <= 8 ) + strcat( key, session->acc->password ); + else + strncat( key, session->acc->password + ( pwdlen - 8 ), 8 ); + ExpandKey( (unsigned char*) key, (unsigned char*) exkey ); + + /* decode each block */ + decoded = g_string_sized_new( raw_len ); + for ( i = 0; i < raw_len; i += 16 ) { + char block[16]; + + Decrypt( (unsigned char*) raw_message + i, (unsigned char*) exkey, (unsigned char*) block ); + g_string_append_len( decoded, block, 16 ); + } + + g_free( raw_message ); + + purple_debug_info( MXIT_PLUGIN_ID, "decrypted: '%s'\n", decoded->str ); + + /* check that the decrypted message starts with header: */ + if ( strncmp( decoded->str, SECRET_HEADER, strlen( SECRET_HEADER ) != 0 ) ) { + g_string_free( decoded, TRUE ); + return NULL; /* message could not be decoded */ + } + g_string_erase( decoded, 0, strlen( SECRET_HEADER ) ); /* remove header */ + + /* remove ISO10126 padding */ +// TODO + + return g_string_free( decoded, FALSE ); +} diff --git a/libpurple/protocols/mxit/cipher.h b/libpurple/protocols/mxit/cipher.h index 188a0609b1..87f46fac51 100644 --- a/libpurple/protocols/mxit/cipher.h +++ b/libpurple/protocols/mxit/cipher.h @@ -32,5 +32,7 @@ struct MXitSession; char* mxit_encrypt_password( struct MXitSession* session ); +char* mxit_decrypt_message( struct MXitSession* session, char* message ); + #endif /* _MXIT_CIPHER_H_ */ diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index d86ab0ac66..5b94f8038c 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -1516,6 +1516,7 @@ static void mxit_parse_cmd_message( struct MXitSession* session, struct record** { struct RXMsgData* mx = NULL; char* message = NULL; + char* sender = NULL; int msglen = 0; int msgflags = 0; int msgtype = 0; @@ -1529,10 +1530,11 @@ static void mxit_parse_cmd_message( struct MXitSession* session, struct record** msglen = strlen( message ); /* strip off dummy domain */ - mxit_strip_domain( records[0]->fields[0]->data ); + sender = records[0]->fields[0]->data; + mxit_strip_domain( sender ); #ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "Message received from '%s'\n", records[0]->fields[0]->data ); + purple_debug_info( MXIT_PLUGIN_ID, "Message received from '%s'\n", sender ); #endif /* decode message flags (if any) */ @@ -1540,33 +1542,42 @@ static void mxit_parse_cmd_message( struct MXitSession* session, struct record** msgflags = atoi( records[0]->fields[4]->data ); msgtype = atoi( records[0]->fields[2]->data ); - if ( msgflags & CP_MSG_ENCRYPTED ) { - /* this is an encrypted message. we do not currently support those so ignore it */ + if ( msgflags & CP_MSG_PWD_ENCRYPTED ) { + /* this is a password encrypted message. we do not currently support those so ignore it */ PurpleBuddy* buddy; const char* name; char msg[128]; - buddy = purple_find_buddy( session->acc, records[0]->fields[0]->data ); + buddy = purple_find_buddy( session->acc, sender ); if ( buddy ) name = purple_buddy_get_alias( buddy ); else - name = records[0]->fields[0]->data; + name = sender; g_snprintf( msg, sizeof( msg ), _( "%s sent you an encrypted message, but it is not supported on this client." ), name ); mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Message Error" ), msg ); return; } + else if ( msgflags & CP_MSG_TL_ENCRYPTED ) { + /* this is a transport-layer encrypted message. */ + message = mxit_decrypt_message( session, message ); + if ( !message ) { + /* could not be decrypted */ + serv_got_im( session->con, sender, _( "An encrypted message was received which could not be decrypted." ), PURPLE_MESSAGE_ERROR, time( NULL ) ); + return; + } + } if ( msgflags & CP_MSG_NOTIFY_DELIVERY ) { /* delivery notification is requested */ if ( records[0]->fcount >= 4 ) - mxit_send_msgevent( session, records[0]->fields[0]->data, records[0]->fields[3]->data, CP_MSGEVENT_DELIVERED ); + mxit_send_msgevent( session, sender, records[0]->fields[3]->data, CP_MSGEVENT_DELIVERED ); } /* create and initialise new markup struct */ mx = g_new0( struct RXMsgData, 1 ); mx->msg = g_string_sized_new( msglen ); mx->session = session; - mx->from = g_strdup( records[0]->fields[0]->data ); + mx->from = g_strdup( sender ); mx->timestamp = atoi( records[0]->fields[1]->data ); mx->got_img = FALSE; mx->chatid = -1; @@ -1597,6 +1608,10 @@ static void mxit_parse_cmd_message( struct MXitSession* session, struct record** * so the image received callback function will eventually display * the message. */ } + + /* cleanup */ + if ( msgflags & CP_MSG_TL_ENCRYPTED ) + g_free( message ); } diff --git a/libpurple/protocols/mxit/protocol.h b/libpurple/protocols/mxit/protocol.h index bcec555bea..ff06ae9671 100644 --- a/libpurple/protocols/mxit/protocol.h +++ b/libpurple/protocols/mxit/protocol.h @@ -155,7 +155,10 @@ /* message flags */ #define CP_MSG_NOTIFY_DELIVERY 0x0002 /* request delivery notification */ #define CP_MSG_NOTIFY_READ 0x0004 /* request read notification */ -#define CP_MSG_ENCRYPTED 0x0010 /* message is encrypted */ +#define CP_MSG_PWD_ENCRYPTED 0x0010 /* message is password encrypted */ +#define CP_MSG_TL_ENCRYPTED 0x0020 /* message is transport encrypted */ +#define CP_MSG_RPLY_PWD_ENCRYPT 0x0040 /* reply should be password encrypted */ +#define CP_MSG_RPLY_TL_ENCRYPT 0x0080 /* reply should be transport encrypted */ #define CP_MSG_MARKUP 0x0200 /* message may contain markup */ #define CP_MSG_EMOTICON 0x0400 /* message may contain custom emoticons */ -- cgit v1.2.1 From 1878a25f48b4c012f9451944a74c52b5987938d2 Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Sun, 7 Aug 2011 02:41:48 +0000 Subject: COMPILEmtn status./bin/stock/bin/pidgin -d Compile now, fix later. --- pidgin/gtkconv.c | 37 ++++++++++++++++++++++--------------- pidgin/gtkdialogs.c | 4 +++- pidgin/gtklog.c | 6 ++++-- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 76f10a3b15..debc7e8c77 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -230,7 +230,7 @@ close_this_sucker(gpointer data) } static gboolean -close_conv_cb(GtkWidget *w, GdkEventButton *dontuse, PidginConversation *gtkconv) +close_conv_cb(GtkButton *button, PidginConversation *gtkconv) { /* We are going to destroy the conversations immediately only if the 'close immediately' * preference is selected. Otherwise, close the conversation after a reasonable timeout @@ -379,6 +379,12 @@ static void clear_conversation_scrollback(PurpleConversation *conv) purple_conversation_clear_message_history(iter->data); } + +static void clear_conversation_scrollback_cb(PurpleConversation *conv, + void *data) +{ + clear_conversation_scrollback(conv); +} static PurpleCmdRet clear_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) @@ -1543,7 +1549,7 @@ menu_chat_add_remove_cb(GtkWidget *w, PidginConversation *gtkconv) static GtkTextMark * get_mark_for_user(PidginConversation *gtkconv, const char *who) { - GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); + GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->webview)); char *tmp = g_strconcat("user:", who, NULL); GtkTextMark *mark = gtk_text_buffer_get_mark(buf, tmp); @@ -3970,7 +3976,7 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c if (is_me) { GtkTextTag *tag = gtk_text_tag_table_lookup( - gtk_text_buffer_get_tag_table(GTK_IMHTML(gtkconv->imhtml)->text_buffer), + gtk_text_buffer_get_tag_table(GTK_IMHTML(gtkconv->webview)->text_buffer), "send-name"); g_object_get(tag, "foreground-gdk", &color, NULL); } else { @@ -4797,7 +4803,7 @@ pidgin_conv_end_quickfind(PidginConversation *gtkconv) { gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL); - gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml)); + gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->webview)); gtk_widget_hide_all(gtkconv->quickfind.container); gtk_widget_grab_focus(gtkconv->entry); @@ -4810,7 +4816,7 @@ quickfind_process_input(GtkWidget *entry, GdkEventKey *event, PidginConversation switch (event->keyval) { case GDK_Return: case GDK_KP_Enter: - if (gtk_imhtml_search_find(GTK_IMHTML(gtkconv->imhtml), gtk_entry_get_text(GTK_ENTRY(entry)))) { + if (gtk_imhtml_search_find(GTK_IMHTML(gtkconv->webview), gtk_entry_get_text(GTK_ENTRY(entry)))) { gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL); } else { GdkColor col; @@ -5245,7 +5251,7 @@ ignore_middle_click(GtkWidget *widget, GdkEventButton *e, gpointer null) static void set_typing_font(GtkWidget *widget, GtkStyle *style, PidginConversation *gtkconv) { -/* FIXME +/* FIXME */ #if 0 static PangoFontDescription *font_desc = NULL; static GdkColor *color = NULL; @@ -5791,7 +5797,6 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a length = strlen(displaying) + 1; - win = gtkconv->win; prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; /* if the buffer is not empty add a
*/ @@ -5847,7 +5852,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) { /* We want to see our own smileys. Need to revert it after send*/ - pidgin_themes_smiley_themeize_custom(gtkconv->imhtml); + pidgin_themes_smiley_themeize_custom(gtkconv->webview); } /* TODO: These colors should not be hardcoded so log.c can use them */ @@ -5942,24 +5947,26 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a g_free(alias_escaped); + /* FIXME: */ +#if 0 if (tagname) tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), tagname); else tag = get_buddy_tag(conv, name, flags, TRUE); - /* FIXME: - if (GTK_IMHTML(gtkconv->imhtml)->show_comments) {*/ + if (GTK_IMHTML(gtkconv->imhtml)->show_comments) { { /* The color for the timestamp has to be set in the font-tags, unfortunately. * Applying the nick-tag to timestamps would work, but that can make it * bold. I thought applying the "comment" tag again, which has "weight" set * to PANGO_WEIGHT_NORMAL, would remove the boldness. But it doesn't. So * this will have to do. I don't terribly like it. -- sadrul */ - const char *color = get_text_tag_color(tag); + /* const char *color = get_text_tag_color(tag); */ g_snprintf(buf2, BUF_LONG, "", color ? "COLOR=\"" : "", color ? color : "", color ? "\"" : "", mdate); gtk_webview_append_html (GTK_WEBVIEW(gtkconv->webview), buf2); } +#endif g_snprintf(buf2, BUF_LONG, "%s ", sml_attrib ? sml_attrib : "", str); gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), buf2); @@ -6004,7 +6011,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) { /* Restore the smiley-data */ - pidgin_themes_smiley_themeize(gtkconv->imhtml); + pidgin_themes_smiley_themeize(gtkconv->webview); } purple_signal_emit(pidgin_conversations_get_handle(), @@ -6277,7 +6284,7 @@ pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gbool } } - if (!add_custom_smiley_for_imhtml(GTK_IMHTML(gtkconv->imhtml), sml, smile)) + if (!add_custom_smiley_for_imhtml(GTK_IMHTML(gtkconv->webview), sml, smile)) return FALSE; if (!remote) /* If it's a local custom smiley, then add it for the entry */ @@ -6645,7 +6652,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) } if (fields & PIDGIN_CONV_SMILEY_THEME) - pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml); + pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->webview); if ((fields & PIDGIN_CONV_COLORIZE_TITLE) || (fields & PIDGIN_CONV_SET_TITLE) || @@ -7228,7 +7235,7 @@ show_timestamps_pref_cb(const char *name, PurplePrefType type, GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), (gboolean)GPOINTER_TO_INT(value)); - gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), + gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->webview), (gboolean)GPOINTER_TO_INT(value)); } } diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 060540c17c..358d748f84 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -450,10 +450,12 @@ pidgin_build_help_dialog(const char *title, const char *role, GString *string) gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); frame = pidgin_create_imhtml(FALSE, &imhtml, NULL, NULL); + /* FIXME: Compile now and fix it later when we have a proper replacement for this function gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY); + */ gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); - gtk_imhtml_append_text(GTK_IMHTML(imhtml), string->str, GTK_IMHTML_NO_SCROLL); + gtk_webview_append_html(GTK_WEBVIEW(imhtml), string->str); gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter); gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter); diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c index 2d0c4b6c89..fe74abd8c1 100644 --- a/pidgin/gtklog.c +++ b/pidgin/gtklog.c @@ -649,16 +649,18 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_paned_add2(GTK_PANED(pane), vbox); /* Viewer ************/ + /* sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); lv->web_view = gtk_webview_new (); gtk_container_add (GTK_CONTAINER (sw), lv->web_view); + */ + frame = pidgin_create_imhtml(FALSE, &lv->web_view, NULL, NULL); gtk_widget_set_name(lv->web_view, "pidgin_log_web_view"); gtk_widget_set_size_request(lv->web_view, 320, 200); - gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); - gtk_widget_show(sw); + gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); /* Search box **********/ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); -- cgit v1.2.1 From 881a96de967a56ab6c714feeecd202534afc8a3a Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 7 Aug 2011 03:21:39 +0000 Subject: Remove duplicate word "found" in this debug message --- libpurple/certificate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/certificate.c b/libpurple/certificate.c index 8cc66fb3cd..4453a4e059 100644 --- a/libpurple/certificate.c +++ b/libpurple/certificate.c @@ -1704,7 +1704,7 @@ x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq, flags |= PURPLE_CERTIFICATE_CA_UNKNOWN; purple_debug_warning("certificate/x509/tls_cached", - "No Certificate Authorities with either DN found " + "No Certificate Authorities with either DN " "found. I'll prompt the user, I guess.\n"); x509_tls_cached_check_subject_name(vrq, flags); -- cgit v1.2.1 From 7be15ae29b0447a91d739719943f264a9b514532 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 12 Aug 2011 22:34:34 +0000 Subject: The contact-flag indicating "hidden" is now deprecated. --- libpurple/protocols/mxit/mxit.c | 4 ---- libpurple/protocols/mxit/profile.c | 3 --- libpurple/protocols/mxit/roster.h | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index 869484c2af..1c37c46adb 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -358,10 +358,6 @@ static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboole /* rejection message */ if ( ( contact->subtype == MXIT_SUBTYPE_REJECTED ) && ( contact->msg != NULL ) ) purple_notify_user_info_add_pair( info, _( "Rejection Message" ), contact->msg ); - - /* hidden number */ - if ( contact->flags & MXIT_CFLAG_HIDDEN ) - purple_notify_user_info_add_pair( info, _( "Hidden Number" ), _( "Yes" ) ); } diff --git a/libpurple/protocols/mxit/profile.c b/libpurple/protocols/mxit/profile.c index ba222e414e..7a26880395 100644 --- a/libpurple/protocols/mxit/profile.c +++ b/libpurple/protocols/mxit/profile.c @@ -215,9 +215,6 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc /* subscription type */ purple_notify_user_info_add_pair( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); - - /* hidden number */ - purple_notify_user_info_add_pair( info, _( "Hidden Number" ), ( contact->flags & MXIT_CFLAG_HIDDEN ) ? _( "Yes" ) : _( "No" ) ); } else { /* this is an invite */ diff --git a/libpurple/protocols/mxit/roster.h b/libpurple/protocols/mxit/roster.h index 44af0010af..6ee12024b6 100644 --- a/libpurple/protocols/mxit/roster.h +++ b/libpurple/protocols/mxit/roster.h @@ -74,7 +74,7 @@ /* MXit contact flags */ -#define MXIT_CFLAG_HIDDEN 0x02 +//#define MXIT_CFLAG_HIDDEN 0x02 /* (DEPRECATED) */ #define MXIT_CFLAG_GATEWAY 0x04 #define MXIT_CFLAG_FOCUS_SEND_BLANK 0x20000 -- cgit v1.2.1 From 64b80e1a00435129187facac92de6f496e9e69d8 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 12 Aug 2011 22:44:39 +0000 Subject: Remove the "hidden" option from user profile. --- libpurple/protocols/mxit/actions.c | 7 ------- libpurple/protocols/mxit/profile.h | 1 - libpurple/protocols/mxit/protocol.c | 6 +----- libpurple/protocols/mxit/protocol.h | 2 +- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/libpurple/protocols/mxit/actions.c b/libpurple/protocols/mxit/actions.c index 214c8a791d..045e92bb94 100644 --- a/libpurple/protocols/mxit/actions.c +++ b/libpurple/protocols/mxit/actions.c @@ -84,13 +84,6 @@ out: g_string_append( attributes, attrib ); acount++; - /* force hidden if disabled */ - if ( profile->hidden == FALSE ) { - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_HIDENUMBER, CP_PROFILE_TYPE_BOOL, "1" ); - g_string_append( attributes, attrib ); - acount++; - } - /* update birthday */ g_strlcpy( profile->birthday, bday, sizeof( profile->birthday ) ); g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_BIRTHDATE, CP_PROFILE_TYPE_UTF8, profile->birthday ); diff --git a/libpurple/protocols/mxit/profile.h b/libpurple/protocols/mxit/profile.h index 77c2d30745..4748652b7b 100644 --- a/libpurple/protocols/mxit/profile.h +++ b/libpurple/protocols/mxit/profile.h @@ -50,7 +50,6 @@ struct MXitProfile { int flags; /* user's profile flags */ gint64 lastonline; /* user's last-online timestamp */ - gboolean hidden; /* set if the user's mxitid should remain hidden */ }; struct MXitSession; diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index 5b94f8038c..e45c2b617e 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -1448,7 +1448,7 @@ static void mxit_parse_cmd_login( struct MXitSession* session, struct record** r PurpleStatus* status; int presence; const char* statusmsg; - const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_HIDENUMBER, CP_PROFILE_FULLNAME, + const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_TITLE, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_EMAIL, CP_PROFILE_MOBILENR, CP_PROFILE_WHEREAMI, CP_PROFILE_ABOUTME, CP_PROFILE_FLAGS }; @@ -1825,10 +1825,6 @@ static void mxit_parse_cmd_extprofile( struct MXitSession* session, struct recor /* gender */ profile->male = ( fvalue[0] == '1' ); } - else if ( strcmp( CP_PROFILE_HIDENUMBER, fname ) == 0 ) { - /* hide number */ - profile->hidden = ( fvalue[0] == '1' ); - } else if ( strcmp( CP_PROFILE_FULLNAME, fname ) == 0 ) { /* nickname */ g_strlcpy( profile->nickname, fvalue, sizeof( profile->nickname ) ); diff --git a/libpurple/protocols/mxit/protocol.h b/libpurple/protocols/mxit/protocol.h index ff06ae9671..af93f952df 100644 --- a/libpurple/protocols/mxit/protocol.h +++ b/libpurple/protocols/mxit/protocol.h @@ -182,7 +182,7 @@ /* extended profile attribute fields */ #define CP_PROFILE_BIRTHDATE "birthdate" /* Birthdate (String - ISO 8601 format) */ #define CP_PROFILE_GENDER "gender" /* Gender (Boolean - 0=female, 1=male) */ -#define CP_PROFILE_HIDENUMBER "hidenumber" /* Hide Number (Boolean - 0=false, 1=true) */ +// #define CP_PROFILE_HIDENUMBER "hidenumber" /* Hide Number (Boolean - 0=false, 1=true) (DEPRECATED) */ #define CP_PROFILE_FULLNAME "fullname" /* Fullname (UTF8 String) */ #define CP_PROFILE_STATUS "statusmsg" /* Status Message (UTF8 String) */ #define CP_PROFILE_PREVSTATUS "prevstatusmsgs" /* Previous Status Messages (UTF8 String) */ -- cgit v1.2.1 From 6f5c1f315ee45c944972f7ef4793e684644801bd Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 13 Aug 2011 13:13:19 +0000 Subject: Returning wrong value here. --- libpurple/protocols/mxit/voicevideo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/mxit/voicevideo.c b/libpurple/protocols/mxit/voicevideo.c index c8f5b34708..230801105f 100644 --- a/libpurple/protocols/mxit/voicevideo.c +++ b/libpurple/protocols/mxit/voicevideo.c @@ -95,7 +95,7 @@ PurpleMediaCaps mxit_media_caps(PurpleAccount *account, const char *who) /* and only when they're online */ if (contact->presence == MXIT_PRESENCE_OFFLINE) - return MXIT_PRESENCE_OFFLINE; + return PURPLE_MEDIA_CAPS_NONE; /* they support voice-only */ if (contact->capabilities & MXIT_PFLAG_VOICE) -- cgit v1.2.1 From 9f68fa5f8fc87de3e4854e847156fb8bbfe968d1 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 13 Aug 2011 15:08:30 +0000 Subject: If a contact did not have a status-message or mood set, the "status_text" callback would return an empty ("") string. This causes the buddy list (with buddy details enabled) to display the contact's alias not in line with the status icon - which looked odd. Now we return NULL if there is no status-message or mood set. --- libpurple/protocols/mxit/mxit.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index 1c37c46adb..c25a9fb946 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -309,19 +309,18 @@ static const char* mxit_list_emblem( PurpleBuddy* buddy ) */ char* mxit_status_text( PurpleBuddy* buddy ) { + char* text = NULL; struct contact* contact = purple_buddy_get_protocol_data(buddy); if ( !contact ) return NULL; - if ( contact->statusMsg ) { - /* status message */ - return g_strdup( contact-> statusMsg ); - } - else { - /* mood */ - return g_strdup( mxit_convert_mood_to_name( contact->mood ) ); - } + if ( contact->statusMsg ) /* status message */ + text = g_strdup( contact-> statusMsg ); + else if ( contact->mood != MXIT_MOOD_NONE ) /* mood */ + text = g_strdup( mxit_convert_mood_to_name( contact->mood ) ); + + return text; } -- cgit v1.2.1 From 2ebc1b1a93423e0aa9e12d13df012b969ff76757 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 13 Aug 2011 16:29:21 +0000 Subject: Structured reply messages should rather not be enclosed in the ::DATA: format. For links, also indicate if the reply message is in a structured format rather than the callback having to try and guess based on the first new bytes of the message. --- libpurple/protocols/mxit/formcmds.c | 25 +++++++++++++++---------- libpurple/protocols/mxit/markup.c | 26 ++++++++++++++++++-------- libpurple/protocols/mxit/markup.h | 2 +- libpurple/protocols/mxit/mxit.c | 8 ++++---- 4 files changed, 38 insertions(+), 23 deletions(-) diff --git a/libpurple/protocols/mxit/formcmds.c b/libpurple/protocols/mxit/formcmds.c index 6691502a49..7c8527de5a 100644 --- a/libpurple/protocols/mxit/formcmds.c +++ b/libpurple/protocols/mxit/formcmds.c @@ -253,8 +253,8 @@ static void command_clear(struct MXitSession* session, const char* from, GHashTa /*------------------------------------------------------------------------ * Process a Reply MXit command. - * [::op=cmd|type=reply|replymsg=back|selmsg=b) Back|id=12345:] - * [::op=cmd|nm=rep|type=reply|replymsg=back|selmsg=b) Back|id=12345:] + * [::op=cmd|type=reply|replymsg=back|selmsg=b) Back|displaymsg=Processing|id=12345:] + * [::op=cmd|nm=rep|type=reply|replymsg=back|selmsg=b) Back|displaymsg=Processing|id=12345:] * * @param mx The received message data object * @param hash The MXit command map @@ -265,22 +265,26 @@ static void command_reply(struct RXMsgData* mx, GHashTable* hash) char* selmsg; char* nm; - selmsg = g_hash_table_lookup(hash, "selmsg"); /* find the selection message */ - replymsg = g_hash_table_lookup(hash, "replymsg"); /* find the reply message */ + selmsg = g_hash_table_lookup(hash, "selmsg"); /* selection message */ + replymsg = g_hash_table_lookup(hash, "replymsg"); /* reply message */ nm = g_hash_table_lookup(hash, "nm"); /* name parameter */ - if ((selmsg) && (replymsg) && (nm)) { + + if ((selmsg == NULL) || (replymsg == NULL)) + return; /* these parameters are required */ + + if (nm) { /* indicates response must be a structured response */ gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1); - gchar* replycmd = g_strdup_printf("::type=reply|nm=%s|res=%s|err=0:", nm, replymsg); + gchar* replycmd = g_strdup_printf("type=reply|nm=%s|res=%s|err=0", nm, replymsg); - mxit_add_html_link( mx, replycmd, seltext ); + mxit_add_html_link( mx, replycmd, TRUE, seltext ); g_free(seltext); g_free(replycmd); } - else if ((selmsg) && (replymsg)) { + else { gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1); - mxit_add_html_link( mx, purple_url_decode(replymsg), seltext ); + mxit_add_html_link( mx, purple_url_decode(replymsg), FALSE, seltext ); g_free(seltext); } @@ -317,6 +321,7 @@ static void command_platformreq(GHashTable* hash, GString* msg) /*------------------------------------------------------------------------ * Process an inline image MXit command. + * [::op=img|dat=ASDF23408asdflkj2309flkjsadf%3d%3d|algn=1|w=120|h=12|t=100|replymsg=text:] * * @param mx The received message data object * @param hash The MXit command map @@ -372,7 +377,7 @@ static void command_image(struct RXMsgData* mx, GHashTable* hash, GString* msg) reply = g_hash_table_lookup(hash, "replymsg"); if (reply) { g_string_append_printf(msg, "\n"); - mxit_add_html_link(mx, reply, _( "click here" )); + mxit_add_html_link(mx, reply, FALSE, _( "click here" )); } } diff --git a/libpurple/protocols/mxit/markup.c b/libpurple/protocols/mxit/markup.c index f1597296ed..b319467700 100644 --- a/libpurple/protocols/mxit/markup.c +++ b/libpurple/protocols/mxit/markup.c @@ -124,10 +124,11 @@ static void hex_dump( const char* buf, int len ) * Adds a link to a message * * @param mx The Markup message object - * @param linkname This is the what will be returned when the link gets clicked - * @param displayname This is the name for the link which will be displayed in the UI + * @param replydata This is the what will be returned when the link gets clicked + * @param isStructured Indicates that the reply is a structured reply + * @param displaytext This is the text for the link which will be displayed in the UI */ -void mxit_add_html_link( struct RXMsgData* mx, const char* linkname, const char* displayname ) +void mxit_add_html_link( struct RXMsgData* mx, const char* replydata, gboolean isStructured, const char* displaytext ) { #ifdef MXIT_LINK_CLICK char retstr[256]; @@ -135,15 +136,24 @@ void mxit_add_html_link( struct RXMsgData* mx, const char* linkname, const char* char link[256]; int len; - len = g_snprintf( retstr, sizeof( retstr ), "%s|%s|%s|%s|%s", MXIT_LINK_KEY, purple_account_get_username( mx->session->acc ), - purple_account_get_protocol_id( mx->session->acc ), mx->from, linkname ); + /* + * The link content is encoded as follows: + * MXIT_LINK_KEY | ACCOUNT_USER | ACCOUNT_PROTO | REPLY_TO | REPLY_FORMAT | REPLY_DATA + */ + len = g_snprintf( retstr, sizeof( retstr ), "%s|%s|%s|%s|%i|%s", + MXIT_LINK_KEY, + purple_account_get_username( mx->session->acc ), + purple_account_get_protocol_id( mx->session->acc ), + mx->from, + isStructured ? 1 : 0, + replydata ); retstr64 = purple_base64_encode( (const unsigned char*) retstr, len ); g_snprintf( link, sizeof( link ), "%s%s", MXIT_LINK_PREFIX, retstr64 ); g_free( retstr64 ); - g_string_append_printf( mx->msg, "%s", link, displayname ); + g_string_append_printf( mx->msg, "%s", link, displaytext ); #else - g_string_append_printf( mx->msg, "%s", linkname ); + g_string_append_printf( mx->msg, "%s", replydata ); #endif } @@ -824,7 +834,7 @@ void mxit_parse_markup( struct RXMsgData* mx, char* message, int len, short msgt if ( ch ) { /* end found */ *ch = '\0'; - mxit_add_html_link( mx, &message[i + 1], &message[i + 1] ); + mxit_add_html_link( mx, &message[i + 1], FALSE, &message[i + 1] ); *ch = '$'; i += ( ch - &message[i + 1] ) + 1; } diff --git a/libpurple/protocols/mxit/markup.h b/libpurple/protocols/mxit/markup.h index bffc5b80d9..9d19d8cd35 100644 --- a/libpurple/protocols/mxit/markup.h +++ b/libpurple/protocols/mxit/markup.h @@ -31,7 +31,7 @@ void mxit_parse_markup( struct RXMsgData* mx, char* message, int len, short msgtype, int msgflags ); char* mxit_convert_markup_tx( const char* message, int* msgtype ); -void mxit_add_html_link( struct RXMsgData* mx, const char* linkname, const char* displayname ); +void mxit_add_html_link( struct RXMsgData* mx, const char* replydata, gboolean isStructured, const char* displaytext ); void mxit_show_message( struct RXMsgData* mx ); void mxit_free_emoticon_cache( struct MXitSession* session ); diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index c25a9fb946..8fdd937d94 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -75,10 +75,10 @@ static void* mxit_link_click( const char* link64 ) link = (gchar*) purple_base64_decode( link64 + strlen( MXIT_LINK_PREFIX ), &len ); purple_debug_info( MXIT_PLUGIN_ID, "Clicked Link: '%s'\n", link ); - parts = g_strsplit( link, "|", 5 ); + parts = g_strsplit( link, "|", 6 ); /* check if this is a valid mxit link */ - if ( ( !parts ) || ( !parts[0] ) || ( !parts[1] ) || ( !parts[2] ) || ( !parts[3] ) || ( !parts[4] ) ) { + if ( ( !parts ) || ( !parts[0] ) || ( !parts[1] ) || ( !parts[2] ) || ( !parts[3] ) || ( !parts[4] ) || ( !parts[5] ) ) { /* this is not for us */ goto skip; } @@ -96,10 +96,10 @@ static void* mxit_link_click( const char* link64 ) goto skip; /* determine if it's a command-response to send */ - is_command = g_str_has_prefix( parts[4], "::type=reply|" ); + is_command = ( atoi( parts[4] ) == 1 ); /* send click message back to MXit */ - mxit_send_message( con->proto_data, parts[3], parts[4], FALSE, is_command ); + mxit_send_message( con->proto_data, parts[3], parts[5], FALSE, is_command ); g_free( link ); link = NULL; -- cgit v1.2.1 From 9fd95cf527f3cfe0d260d3e5b330ed4b768d987a Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 13 Aug 2011 17:11:59 +0000 Subject: Remove ISO10126 padding when decrypting an incoming transport-encrypted message. --- libpurple/protocols/mxit/cipher.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libpurple/protocols/mxit/cipher.c b/libpurple/protocols/mxit/cipher.c index 8e9dc098de..0a64e16f63 100644 --- a/libpurple/protocols/mxit/cipher.c +++ b/libpurple/protocols/mxit/cipher.c @@ -149,7 +149,6 @@ char* mxit_decrypt_message( struct MXitSession* session, char* message ) Decrypt( (unsigned char*) raw_message + i, (unsigned char*) exkey, (unsigned char*) block ); g_string_append_len( decoded, block, 16 ); } - g_free( raw_message ); purple_debug_info( MXIT_PLUGIN_ID, "decrypted: '%s'\n", decoded->str ); @@ -159,10 +158,16 @@ char* mxit_decrypt_message( struct MXitSession* session, char* message ) g_string_free( decoded, TRUE ); return NULL; /* message could not be decoded */ } - g_string_erase( decoded, 0, strlen( SECRET_HEADER ) ); /* remove header */ /* remove ISO10126 padding */ -// TODO + { + /* last byte indicates the number of padding bytes */ + unsigned int padding = decoded->str[decoded->len - 1]; + g_string_truncate( decoded, decoded->len - padding ); + } + + /* remove encryption header */ + g_string_erase( decoded, 0, strlen( SECRET_HEADER ) ); return g_string_free( decoded, FALSE ); } -- cgit v1.2.1 From bbc836c5fdaa8567182dd1766888b2bc33e394da Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 13 Aug 2011 22:01:39 +0000 Subject: When receiving an invite to join a GroupChat, first check if a matching room entry already exists (ie, already joined, or invite popup still pending). If so, just ignore the invite. --- libpurple/protocols/mxit/multimx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libpurple/protocols/mxit/multimx.c b/libpurple/protocols/mxit/multimx.c index 8e0de5d7d4..27f6625e66 100644 --- a/libpurple/protocols/mxit/multimx.c +++ b/libpurple/protocols/mxit/multimx.c @@ -277,7 +277,11 @@ void multimx_invite(struct MXitSession* session, struct contact* contact, const GHashTable *components; struct multimx* multimx = NULL; - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s' by '%s'\n", contact->alias, creator); + purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s' (roomid='%s') by '%s'\n", contact->alias, contact->username, creator); + + /* Check if the room already exists (ie, already joined or invite pending) */ + if (find_room_by_username(session, contact->username) != NULL) + return; /* Create a new room */ multimx = room_create(session, contact->username, contact->alias, STATE_INVITED); @@ -307,7 +311,7 @@ void multimx_created(struct MXitSession* session, struct contact* contact) multimx = find_room_by_username(session, contact->username); if (multimx == NULL) { multimx = room_create(session, contact->username, contact->alias, TRUE); - } + } else if (multimx->state == STATE_INVITED) { /* After successfully accepting an invitation */ multimx->state = STATE_JOINED; -- cgit v1.2.1 From 7b207db95ea15f2396a2ed9a1b27a21633fdd63a Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 14 Aug 2011 20:45:48 +0000 Subject: Encrypt a message using transport-encryption. --- libpurple/protocols/mxit/cipher.c | 78 +++++++++++++++++++++++++++++++++++++-- libpurple/protocols/mxit/cipher.h | 2 +- 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/mxit/cipher.c b/libpurple/protocols/mxit/cipher.c index 0a64e16f63..1ce044b6d5 100644 --- a/libpurple/protocols/mxit/cipher.c +++ b/libpurple/protocols/mxit/cipher.c @@ -109,7 +109,7 @@ char* mxit_encrypt_password( struct MXitSession* session ) /*------------------------------------------------------------------------ - * Decrypt a transport-layer encryptede message. + * Decrypt a transport-layer encrypted message. * * @param session The MXit session object * @param message The encrypted message data. @@ -151,8 +151,6 @@ char* mxit_decrypt_message( struct MXitSession* session, char* message ) } g_free( raw_message ); - purple_debug_info( MXIT_PLUGIN_ID, "decrypted: '%s'\n", decoded->str ); - /* check that the decrypted message starts with header: */ if ( strncmp( decoded->str, SECRET_HEADER, strlen( SECRET_HEADER ) != 0 ) ) { g_string_free( decoded, TRUE ); @@ -171,3 +169,77 @@ char* mxit_decrypt_message( struct MXitSession* session, char* message ) return g_string_free( decoded, FALSE ); } + + +/*------------------------------------------------------------------------ + * Encrypt a message using transport-layer encryption. + * + * @param session The MXit session object + * @param message The message data. + * @return The encrypted message. Must be g_free'd when no longer needed. + */ +char* mxit_encrypt_message( struct MXitSession* session, char* message ) +{ + char key[64]; + int pwdlen = strlen( session->acc->password ); + char exkey[512]; + int i; + GString* decoded = NULL; + GString* encoded = NULL; + gchar* base64; + + purple_debug_info( MXIT_PLUGIN_ID, "encrypt message: '%s'\n", message ); + + /* build the key - Client key, appended with last 8 characters of the PIN. (no padding) */ + memset( key, 0x00, sizeof( key ) ); + memcpy( key, session->clientkey, strlen( session->clientkey ) ); + if ( pwdlen <= 8 ) + strcat( key, session->acc->password ); + else + strncat( key, session->acc->password + ( pwdlen - 8 ), 8 ); + ExpandKey( (unsigned char*) key, (unsigned char*) exkey ); + + /* append encryption header */ + decoded = g_string_sized_new( strlen( SECRET_HEADER ) + strlen( message ) ); + g_string_append( decoded, SECRET_HEADER ); + g_string_append( decoded, message ); + + /* add ISO10126 padding */ + { + int blocks = ( decoded->len / 16 ) + 1; + int padding = ( blocks * 16 ) - decoded->len; + + g_string_set_size( decoded, blocks * 16 ); + decoded->str[decoded->len - 1] = padding; + } + + /* encrypt each block */ + encoded = g_string_sized_new( decoded->len ); + for ( i = 0; i < decoded->len; i += 16 ) { + char block[16]; + + Encrypt( (unsigned char*) decoded->str + i, (unsigned char*) exkey, (unsigned char*) block ); + g_string_append_len( encoded, block, 16 ); + } + + /* now base64 encode the encrypted message */ + base64 = purple_base64_encode( (unsigned char *) encoded->str, encoded->len ); + +#if 0 + /* and add optional header */ + { + GString* tmp = g_string_sized_new( strlen( base64 ) + strlen( ENCRYPT_HEADER ) ); + g_string_append( tmp, ENCRYPT_HEADER ); + g_string_append( tmp, base64 ); + g_free(base64); + base64 = g_string_free( tmp, FALSE ); + } +#endif + + g_string_free( decoded, TRUE ); + g_string_free( encoded, TRUE ); + + purple_debug_info( MXIT_PLUGIN_ID, "encrypted message: '%s'\n", base64 ); + + return base64; +} diff --git a/libpurple/protocols/mxit/cipher.h b/libpurple/protocols/mxit/cipher.h index 87f46fac51..e2899ac741 100644 --- a/libpurple/protocols/mxit/cipher.h +++ b/libpurple/protocols/mxit/cipher.h @@ -33,6 +33,6 @@ struct MXitSession; char* mxit_encrypt_password( struct MXitSession* session ); char* mxit_decrypt_message( struct MXitSession* session, char* message ); - +char* mxit_encrypt_message( struct MXitSession* session, char* message ); #endif /* _MXIT_CIPHER_H_ */ -- cgit v1.2.1 From 872d7043d50383557efcbdcb62f518bbd3407d6d Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 15 Aug 2011 19:24:16 +0000 Subject: Refactor the transport-layer encryption and decryption. Also fix key initialization when PIN is shorter than 8 characters. --- libpurple/protocols/mxit/cipher.c | 138 ++++++++++++++++++++++---------------- 1 file changed, 80 insertions(+), 58 deletions(-) diff --git a/libpurple/protocols/mxit/cipher.c b/libpurple/protocols/mxit/cipher.c index 1ce044b6d5..33439e395b 100644 --- a/libpurple/protocols/mxit/cipher.c +++ b/libpurple/protocols/mxit/cipher.c @@ -59,6 +59,66 @@ static int pad_secret_data( char* secret ) } +/*------------------------------------------------------------------------ + * Add ISO10126 Padding to the data. + * + * @param data The data to pad. + */ +static void padding_add( GString* data ) +{ + unsigned int blocks = ( data->len / 16 ) + 1; + unsigned int padding = ( blocks * 16 ) - data->len; + + g_string_set_size( data, blocks * 16 ); + data->str[data->len - 1] = padding; +} + + +/*------------------------------------------------------------------------ + * Remove ISO10126 Padding from the data. + * + * @param data The data from which to remove padding. + */ +static void padding_remove( GString* data ) +{ + unsigned int padding; + + if ( data->len == 0 ) + return; + + padding = data->str[data->len - 1]; + g_string_truncate( data, data->len - padding ); +} + + +/*------------------------------------------------------------------------ + * Generate the Transport-Layer crypto key. + * (Note: this function is not-thread safe) + * + * @param session The MXit Session object + * @return The transport-layer crypto key. + */ +static char* transport_layer_key( struct MXitSession* session ) +{ + static char key[16 + 1]; + int pwdlen = strlen( session->acc->password ); + + /* initialize with initial key */ + g_strlcpy( key, INITIAL_KEY, sizeof( key ) ); + + /* client key (8 bytes) */ + memcpy( key, session->clientkey, strlen( session->clientkey ) ); + + /* add last 8 characters of the PIN (no padding if less characters) */ + if ( pwdlen <= 8 ) + memcpy( key + 8, session->acc->password, pwdlen ); + else + memcpy( key + 8, session->acc->password + ( pwdlen - 8 ), 8 ); + + return key; +} + + /*------------------------------------------------------------------------ * Encrypt the user's cleartext password using the AES 128-bit (ECB) * encryption algorithm. @@ -109,18 +169,16 @@ char* mxit_encrypt_password( struct MXitSession* session ) /*------------------------------------------------------------------------ - * Decrypt a transport-layer encrypted message. + * Decrypt a message using transport-layer encryption. * * @param session The MXit session object - * @param message The encrypted message data. + * @param message The encrypted message data (is base64-encoded). * @return The decrypted message. Must be g_free'd when no longer needed. */ char* mxit_decrypt_message( struct MXitSession* session, char* message ) { gsize raw_len; guchar* raw_message; - char key[64]; - int pwdlen = strlen( session->acc->password ); char exkey[512]; int i; GString* decoded = NULL; @@ -132,16 +190,10 @@ char* mxit_decrypt_message( struct MXitSession* session, char* message ) /* base64 decode the message */ raw_message = purple_base64_decode( message, &raw_len ); - /* build the key - Client key, appended with last 8 characters of the PIN. (no padding) */ - memset( key, 0x00, sizeof( key ) ); - memcpy( key, session->clientkey, strlen( session->clientkey ) ); - if ( pwdlen <= 8 ) - strcat( key, session->acc->password ); - else - strncat( key, session->acc->password + ( pwdlen - 8 ), 8 ); - ExpandKey( (unsigned char*) key, (unsigned char*) exkey ); + /* build the AES key */ + ExpandKey( (unsigned char*) transport_layer_key( session ), (unsigned char*) exkey ); - /* decode each block */ + /* AES decrypt each block */ decoded = g_string_sized_new( raw_len ); for ( i = 0; i < raw_len; i += 16 ) { char block[16]; @@ -154,15 +206,11 @@ char* mxit_decrypt_message( struct MXitSession* session, char* message ) /* check that the decrypted message starts with header: */ if ( strncmp( decoded->str, SECRET_HEADER, strlen( SECRET_HEADER ) != 0 ) ) { g_string_free( decoded, TRUE ); - return NULL; /* message could not be decoded */ + return NULL; /* message could not be decrypted */ } /* remove ISO10126 padding */ - { - /* last byte indicates the number of padding bytes */ - unsigned int padding = decoded->str[decoded->len - 1]; - g_string_truncate( decoded, decoded->len - padding ); - } + padding_remove( decoded ); /* remove encryption header */ g_string_erase( decoded, 0, strlen( SECRET_HEADER ) ); @@ -180,63 +228,37 @@ char* mxit_decrypt_message( struct MXitSession* session, char* message ) */ char* mxit_encrypt_message( struct MXitSession* session, char* message ) { - char key[64]; - int pwdlen = strlen( session->acc->password ); char exkey[512]; int i; - GString* decoded = NULL; + GString* raw_message = NULL; GString* encoded = NULL; gchar* base64; purple_debug_info( MXIT_PLUGIN_ID, "encrypt message: '%s'\n", message ); - /* build the key - Client key, appended with last 8 characters of the PIN. (no padding) */ - memset( key, 0x00, sizeof( key ) ); - memcpy( key, session->clientkey, strlen( session->clientkey ) ); - if ( pwdlen <= 8 ) - strcat( key, session->acc->password ); - else - strncat( key, session->acc->password + ( pwdlen - 8 ), 8 ); - ExpandKey( (unsigned char*) key, (unsigned char*) exkey ); + /* build the AES key */ + ExpandKey( (unsigned char*) transport_layer_key( session ), (unsigned char*) exkey ); - /* append encryption header */ - decoded = g_string_sized_new( strlen( SECRET_HEADER ) + strlen( message ) ); - g_string_append( decoded, SECRET_HEADER ); - g_string_append( decoded, message ); + /* append encryption header to message data */ + raw_message = g_string_sized_new( strlen( SECRET_HEADER ) + strlen( message ) ); + g_string_append( raw_message, SECRET_HEADER ); + g_string_append( raw_message, message ); /* add ISO10126 padding */ - { - int blocks = ( decoded->len / 16 ) + 1; - int padding = ( blocks * 16 ) - decoded->len; - - g_string_set_size( decoded, blocks * 16 ); - decoded->str[decoded->len - 1] = padding; - } + padding_add( raw_message ); /* encrypt each block */ - encoded = g_string_sized_new( decoded->len ); - for ( i = 0; i < decoded->len; i += 16 ) { + encoded = g_string_sized_new( raw_message->len ); + for ( i = 0; i < raw_message->len; i += 16 ) { char block[16]; - Encrypt( (unsigned char*) decoded->str + i, (unsigned char*) exkey, (unsigned char*) block ); + Encrypt( (unsigned char*) raw_message->str + i, (unsigned char*) exkey, (unsigned char*) block ); g_string_append_len( encoded, block, 16 ); } + g_string_free( raw_message, TRUE ); - /* now base64 encode the encrypted message */ + /* base64 encode the encrypted message */ base64 = purple_base64_encode( (unsigned char *) encoded->str, encoded->len ); - -#if 0 - /* and add optional header */ - { - GString* tmp = g_string_sized_new( strlen( base64 ) + strlen( ENCRYPT_HEADER ) ); - g_string_append( tmp, ENCRYPT_HEADER ); - g_string_append( tmp, base64 ); - g_free(base64); - base64 = g_string_free( tmp, FALSE ); - } -#endif - - g_string_free( decoded, TRUE ); g_string_free( encoded, TRUE ); purple_debug_info( MXIT_PLUGIN_ID, "encrypted message: '%s'\n", base64 ); -- cgit v1.2.1 From 64bfebc3f9eace1431a0c9bac819406fdad5494b Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 15 Aug 2011 20:10:35 +0000 Subject: Simplify the PIN encryption code. --- libpurple/protocols/mxit/cipher.c | 87 +++++++++++++-------------------------- libpurple/protocols/mxit/cipher.h | 2 +- 2 files changed, 29 insertions(+), 60 deletions(-) diff --git a/libpurple/protocols/mxit/cipher.c b/libpurple/protocols/mxit/cipher.c index 33439e395b..9dba336ece 100644 --- a/libpurple/protocols/mxit/cipher.c +++ b/libpurple/protocols/mxit/cipher.c @@ -1,7 +1,7 @@ /* * MXit Protocol libPurple Plugin * - * -- user password encryption -- + * -- encryption -- * * Pieter Loubser * @@ -31,34 +31,12 @@ #include "aes.h" -/* password encryption */ +/* encryption */ #define INITIAL_KEY "6170383452343567" #define SECRET_HEADER "" #define ENCRYPT_HEADER "" -/*------------------------------------------------------------------------ - * Pad the secret data using ISO10126 Padding. - * - * @param secret The data to pad (caller must ensure buffer has enough space for padding) - * @return The total number of 128-bit blocks used - */ -static int pad_secret_data( char* secret ) -{ - int blocks = 0; - int passlen; - int padding; - - passlen = strlen( secret ); - blocks = ( passlen / 16 ) + 1; - padding = ( blocks * 16 ) - passlen; - secret[passlen] = 0x50; - secret[(blocks * 16) - 1] = padding; - - return blocks; -} - - /*------------------------------------------------------------------------ * Add ISO10126 Padding to the data. * @@ -101,7 +79,7 @@ static void padding_remove( GString* data ) static char* transport_layer_key( struct MXitSession* session ) { static char key[16 + 1]; - int pwdlen = strlen( session->acc->password ); + int passlen = strlen( session->acc->password ); /* initialize with initial key */ g_strlcpy( key, INITIAL_KEY, sizeof( key ) ); @@ -110,10 +88,10 @@ static char* transport_layer_key( struct MXitSession* session ) memcpy( key, session->clientkey, strlen( session->clientkey ) ); /* add last 8 characters of the PIN (no padding if less characters) */ - if ( pwdlen <= 8 ) - memcpy( key + 8, session->acc->password, pwdlen ); + if ( passlen <= 8 ) + memcpy( key + 8, session->acc->password, passlen ); else - memcpy( key + 8, session->acc->password + ( pwdlen - 8 ), 8 ); + memcpy( key + 8, session->acc->password + ( passlen - 8 ), 8 ); return key; } @@ -128,41 +106,35 @@ static char* transport_layer_key( struct MXitSession* session ) */ char* mxit_encrypt_password( struct MXitSession* session ) { - char key[64]; + char key[16 + 1]; char exkey[512]; - char pass[64]; + GString* pass = NULL; char encrypted[64]; char* base64; - int blocks; - int size; int i; purple_debug_info( MXIT_PLUGIN_ID, "mxit_encrypt_password\n" ); memset( encrypted, 0x00, sizeof( encrypted ) ); - memset( exkey, 0x00, sizeof( exkey ) ); - memset( pass, 0x58, sizeof( pass ) ); - pass[sizeof( pass ) - 1] = '\0'; - /* build the custom AES encryption key */ + /* build the AES encryption key */ g_strlcpy( key, INITIAL_KEY, sizeof( key ) ); memcpy( key, session->clientkey, strlen( session->clientkey ) ); ExpandKey( (unsigned char*) key, (unsigned char*) exkey ); - /* build the custom data to be encrypted */ - g_strlcpy( pass, SECRET_HEADER, sizeof( pass ) ); - strcat( pass, session->acc->password ); + /* build the secret data to be encrypted: SECRET_HEADER + password */ + pass = g_string_new( SECRET_HEADER ); + g_string_append( pass, session->acc->password ); + padding_add( pass ); /* add ISO10126 padding */ - /* pad the secret data */ - blocks = pad_secret_data( pass ); - size = blocks * 16; - - /* now encrypt the password. we encrypt each block separately (ECB mode) */ - for ( i = 0; i < size; i += 16 ) - Encrypt( (unsigned char*) pass + i, (unsigned char*) exkey, (unsigned char*) encrypted + i ); + /* now encrypt the secret. we encrypt each block separately (ECB mode) */ + for ( i = 0; i < pass->len; i += 16 ) + Encrypt( (unsigned char*) pass->str + i, (unsigned char*) exkey, (unsigned char*) encrypted + i ); /* now base64 encode the encrypted password */ - base64 = purple_base64_encode( (unsigned char*) encrypted, size ); + base64 = purple_base64_encode( (unsigned char*) encrypted, pass->len ); + + g_string_free( pass, TRUE ); return base64; } @@ -177,11 +149,11 @@ char* mxit_encrypt_password( struct MXitSession* session ) */ char* mxit_decrypt_message( struct MXitSession* session, char* message ) { - gsize raw_len; guchar* raw_message; + gsize raw_len; char exkey[512]; - int i; GString* decoded = NULL; + int i; /* remove optional header: */ if ( strncmp( message, ENCRYPT_HEADER, strlen( ENCRYPT_HEADER ) ) == 0 ) @@ -228,26 +200,23 @@ char* mxit_decrypt_message( struct MXitSession* session, char* message ) */ char* mxit_encrypt_message( struct MXitSession* session, char* message ) { - char exkey[512]; - int i; GString* raw_message = NULL; + char exkey[512]; GString* encoded = NULL; gchar* base64; + int i; purple_debug_info( MXIT_PLUGIN_ID, "encrypt message: '%s'\n", message ); - /* build the AES key */ - ExpandKey( (unsigned char*) transport_layer_key( session ), (unsigned char*) exkey ); - /* append encryption header to message data */ - raw_message = g_string_sized_new( strlen( SECRET_HEADER ) + strlen( message ) ); - g_string_append( raw_message, SECRET_HEADER ); + raw_message = g_string_new( SECRET_HEADER ); g_string_append( raw_message, message ); + padding_add( raw_message ); /* add ISO10126 padding */ - /* add ISO10126 padding */ - padding_add( raw_message ); + /* build the AES key */ + ExpandKey( (unsigned char*) transport_layer_key( session ), (unsigned char*) exkey ); - /* encrypt each block */ + /* AES encrypt each block */ encoded = g_string_sized_new( raw_message->len ); for ( i = 0; i < raw_message->len; i += 16 ) { char block[16]; diff --git a/libpurple/protocols/mxit/cipher.h b/libpurple/protocols/mxit/cipher.h index e2899ac741..1c1c4c0070 100644 --- a/libpurple/protocols/mxit/cipher.h +++ b/libpurple/protocols/mxit/cipher.h @@ -1,7 +1,7 @@ /* * MXit Protocol libPurple Plugin * - * -- user password encryption -- + * -- encryption -- * * Pieter Loubser * -- cgit v1.2.1 From 5e24b4914751ca0fad2c50c85d0ea853f820c13c Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 15 Aug 2011 21:08:25 +0000 Subject: Need to implemnt the protocol prpl's chat 'chat_info_defaults' callback. Otherwise the following occurs in the logs: hash_table_lookup: assertion 'hash_table' != NULL when joining a group-chat. --- libpurple/protocols/mxit/mxit.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index 8fdd937d94..384ccaad04 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -654,6 +654,18 @@ static GList* mxit_blist_menu( PurpleBlistNode *node ) return m; } + +/*------------------------------------------------------------------------ + * Return Chat-room default settings. + * + * @return Chat defaults list + */ +static GHashTable *mxit_chat_info_defaults(PurpleConnection *gc, const char *chat_name) +{ + return g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); +} + + /*========================================================================================================================*/ static PurplePluginProtocolInfo proto_info = { @@ -675,7 +687,7 @@ static PurplePluginProtocolInfo proto_info = { mxit_status_types, /* status types [roster.c] */ mxit_blist_menu, /* blist_node_menu */ mxit_chat_info, /* chat_info [multimx.c] */ - NULL, /* chat_info_defaults */ + mxit_chat_info_defaults,/* chat_info_defaults */ mxit_login, /* login [login.c] */ mxit_close, /* close */ mxit_send_im, /* send_im */ -- cgit v1.2.1 From f445811691e1209f40a3a45666e30e3f0b4b503e Mon Sep 17 00:00:00 2001 From: Pieter Loubser Date: Tue, 16 Aug 2011 06:19:38 +0000 Subject: * fixed the head: mtn issue.. --- libpurple/protocols/mxit/cipher.c | 97 ++++++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 32 deletions(-) diff --git a/libpurple/protocols/mxit/cipher.c b/libpurple/protocols/mxit/cipher.c index 2182e50b81..9dba336ece 100644 --- a/libpurple/protocols/mxit/cipher.c +++ b/libpurple/protocols/mxit/cipher.c @@ -117,22 +117,19 @@ char* mxit_encrypt_password( struct MXitSession* session ) memset( encrypted, 0x00, sizeof( encrypted ) ); - /* build the custom AES encryption key */ + /* build the AES encryption key */ g_strlcpy( key, INITIAL_KEY, sizeof( key ) ); memcpy( key, session->clientkey, strlen( session->clientkey ) ); ExpandKey( (unsigned char*) key, (unsigned char*) exkey ); - /* build the custom data to be encrypted */ - g_strlcpy( pass, SECRET_HEADER, sizeof( pass ) ); - strcat( pass, session->acc->password ); + /* build the secret data to be encrypted: SECRET_HEADER + password */ + pass = g_string_new( SECRET_HEADER ); + g_string_append( pass, session->acc->password ); + padding_add( pass ); /* add ISO10126 padding */ - /* pad the secret data */ - blocks = pad_secret_data( pass ); - size = blocks * 16; - - /* now encrypt the password. we encrypt each block separately (ECB mode) */ - for ( i = 0; i < size; i += 16 ) - Encrypt( (unsigned char*) pass + i, (unsigned char*) exkey, (unsigned char*) encrypted + i ); + /* now encrypt the secret. we encrypt each block separately (ECB mode) */ + for ( i = 0; i < pass->len; i += 16 ) + Encrypt( (unsigned char*) pass->str + i, (unsigned char*) exkey, (unsigned char*) encrypted + i ); /* now base64 encode the encrypted password */ base64 = purple_base64_encode( (unsigned char*) encrypted, pass->len ); @@ -144,21 +141,19 @@ char* mxit_encrypt_password( struct MXitSession* session ) /*------------------------------------------------------------------------ - * Decrypt a transport-layer encryptede message. + * Decrypt a message using transport-layer encryption. * * @param session The MXit session object - * @param message The encrypted message data. + * @param message The encrypted message data (is base64-encoded). * @return The decrypted message. Must be g_free'd when no longer needed. */ char* mxit_decrypt_message( struct MXitSession* session, char* message ) { - gsize raw_len; guchar* raw_message; - char key[64]; - int pwdlen = strlen( session->acc->password ); + gsize raw_len; char exkey[512]; - int i; GString* decoded = NULL; + int i; /* remove optional header: */ if ( strncmp( message, ENCRYPT_HEADER, strlen( ENCRYPT_HEADER ) ) == 0 ) @@ -167,16 +162,10 @@ char* mxit_decrypt_message( struct MXitSession* session, char* message ) /* base64 decode the message */ raw_message = purple_base64_decode( message, &raw_len ); - /* build the key - Client key, appended with last 8 characters of the PIN. (no padding) */ - memset( key, 0x00, sizeof( key ) ); - memcpy( key, session->clientkey, strlen( session->clientkey ) ); - if ( pwdlen <= 8 ) - strcat( key, session->acc->password ); - else - strncat( key, session->acc->password + ( pwdlen - 8 ), 8 ); - ExpandKey( (unsigned char*) key, (unsigned char*) exkey ); + /* build the AES key */ + ExpandKey( (unsigned char*) transport_layer_key( session ), (unsigned char*) exkey ); - /* decode each block */ + /* AES decrypt each block */ decoded = g_string_sized_new( raw_len ); for ( i = 0; i < raw_len; i += 16 ) { char block[16]; @@ -184,20 +173,64 @@ char* mxit_decrypt_message( struct MXitSession* session, char* message ) Decrypt( (unsigned char*) raw_message + i, (unsigned char*) exkey, (unsigned char*) block ); g_string_append_len( decoded, block, 16 ); } - g_free( raw_message ); - purple_debug_info( MXIT_PLUGIN_ID, "decrypted: '%s'\n", decoded->str ); - /* check that the decrypted message starts with header: */ if ( strncmp( decoded->str, SECRET_HEADER, strlen( SECRET_HEADER ) != 0 ) ) { g_string_free( decoded, TRUE ); - return NULL; /* message could not be decoded */ + return NULL; /* message could not be decrypted */ } - g_string_erase( decoded, 0, strlen( SECRET_HEADER ) ); /* remove header */ /* remove ISO10126 padding */ -// TODO + padding_remove( decoded ); + + /* remove encryption header */ + g_string_erase( decoded, 0, strlen( SECRET_HEADER ) ); return g_string_free( decoded, FALSE ); } + + +/*------------------------------------------------------------------------ + * Encrypt a message using transport-layer encryption. + * + * @param session The MXit session object + * @param message The message data. + * @return The encrypted message. Must be g_free'd when no longer needed. + */ +char* mxit_encrypt_message( struct MXitSession* session, char* message ) +{ + GString* raw_message = NULL; + char exkey[512]; + GString* encoded = NULL; + gchar* base64; + int i; + + purple_debug_info( MXIT_PLUGIN_ID, "encrypt message: '%s'\n", message ); + + /* append encryption header to message data */ + raw_message = g_string_new( SECRET_HEADER ); + g_string_append( raw_message, message ); + padding_add( raw_message ); /* add ISO10126 padding */ + + /* build the AES key */ + ExpandKey( (unsigned char*) transport_layer_key( session ), (unsigned char*) exkey ); + + /* AES encrypt each block */ + encoded = g_string_sized_new( raw_message->len ); + for ( i = 0; i < raw_message->len; i += 16 ) { + char block[16]; + + Encrypt( (unsigned char*) raw_message->str + i, (unsigned char*) exkey, (unsigned char*) block ); + g_string_append_len( encoded, block, 16 ); + } + g_string_free( raw_message, TRUE ); + + /* base64 encode the encrypted message */ + base64 = purple_base64_encode( (unsigned char *) encoded->str, encoded->len ); + g_string_free( encoded, TRUE ); + + purple_debug_info( MXIT_PLUGIN_ID, "encrypted message: '%s'\n", base64 ); + + return base64; +} -- cgit v1.2.1 From 5e716d10ac49cf96b679a96d72e74e1654459daa Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 00:48:39 +0000 Subject: Add -devel suffix back to the version numbers in im.pidgin.pidgin --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 7df077ea4d..591a227f9f 100644 --- a/configure.ac +++ b/configure.ac @@ -47,7 +47,7 @@ m4_define([purple_lt_current], [20]) m4_define([purple_major_version], [3]) m4_define([purple_minor_version], [0]) m4_define([purple_micro_version], [0]) -m4_define([purple_version_suffix], []) +m4_define([purple_version_suffix], [devel]) m4_define([purple_version], [purple_major_version.purple_minor_version.purple_micro_version]) m4_define([purple_display_version], purple_version[]m4_ifdef([purple_version_suffix],[purple_version_suffix])) @@ -56,7 +56,7 @@ m4_define([gnt_lt_current], [8]) m4_define([gnt_major_version], [2]) m4_define([gnt_minor_version], [8]) m4_define([gnt_micro_version], [9]) -m4_define([gnt_version_suffix], []) +m4_define([gnt_version_suffix], [devel]) m4_define([gnt_version], [gnt_major_version.gnt_minor_version.gnt_micro_version]) m4_define([gnt_display_version], gnt_version[]m4_ifdef([gnt_version_suffix],[gnt_version_suffix])) -- cgit v1.2.1 From 2dd9fa2996dfab03d617cbff04db7f4e736d503f Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 00:50:52 +0000 Subject: I noticed this a while ago but I don't care enough to fix it --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 591a227f9f..b9d598f0f3 100644 --- a/configure.ac +++ b/configure.ac @@ -328,6 +328,9 @@ AM_CONDITIONAL(INSTALL_I18N, test "x$enable_i18n" = "xyes") dnl ####################################################################### dnl # Check for GLib 2.16 (required) dnl ####################################################################### +# TODO: gmodule-2.0 is only needed if enable_plugins is 'yes'. It +# might ben ice to change this check so that it's not required +# if enable_plugins is 'no'. PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.16.0 gobject-2.0 gmodule-2.0 gthread-2.0], , [ AC_MSG_RESULT(no) AC_MSG_ERROR([ -- cgit v1.2.1 From 5129c5fcf1c3c9ae722a85371a9248102dd6c10e Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 00:54:23 +0000 Subject: A while ago I noticed that we don't have enforce a max on the number of processes that we fork to do DNS SRV or TXT lookups. This is pretty minor and I don't care enough to fix it, but it seems like a good idea to mention it in the code. --- libpurple/dnssrv.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c index 04aff7ecff..5befb1f342 100644 --- a/libpurple/dnssrv.c +++ b/libpurple/dnssrv.c @@ -798,6 +798,12 @@ purple_srv_resolve_account(PurpleAccount *account, const char *protocol, return NULL; } + /* + * TODO: We should put a cap on the number of forked processes that we + * allow at any given time. If we get too many requests they + * should be put into a queue and handled later. (This is what + * we do for A record lookups.) + */ pid = fork(); if (pid == -1) { purple_debug_error("dnssrv", "Could not create process!\n"); @@ -929,6 +935,12 @@ PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, return NULL; } + /* + * TODO: We should put a cap on the number of forked processes that we + * allow at any given time. If we get too many requests they + * should be put into a queue and handled later. (This is what + * we do for A record lookups.) + */ pid = fork(); if (pid == -1) { purple_debug_error("dnssrv", "Could not create process!\n"); -- cgit v1.2.1 From e905b9b9ed3c08f1ec950b4b5bdd1cc64762a54a Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 01:04:31 +0000 Subject: Get rid fo purple_strlcpy and purple_strlcat. These are convenience functions that call g_strlcpy and g_strlcat. They're only mildly convenient, though. And only used in one place. The reason I don't like them is that I think it's easy to use them incorrectly. It's easy to use the functions and not realize that they use sizeof() to determine the size of the destination buffer. I think it's too easy to accidentally use these functions with a string on the heap (which wouldn't work correctly). --- ChangeLog.API | 2 ++ libpurple/internal.h | 6 ------ libpurple/util.c | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 2da96cc3c6..a956f8ea91 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -10,6 +10,8 @@ version 3.0.0 (??/??/????): Removed: * purple_core_migrate + * purple_strlcat + * purple_strlcpy version 2.10.0: libpurple: diff --git a/libpurple/internal.h b/libpurple/internal.h index 12d525c4dd..330e92bdcd 100644 --- a/libpurple/internal.h +++ b/libpurple/internal.h @@ -151,12 +151,6 @@ #include -/* Safer ways to work with static buffers. When using non-static - * buffers, either use g_strdup_* functions (preferred) or use - * g_strlcpy/g_strlcpy directly. */ -#define purple_strlcpy(dest, src) g_strlcpy(dest, src, sizeof(dest)) -#define purple_strlcat(dest, src) g_strlcat(dest, src, sizeof(dest)) - #define PURPLE_WEBSITE "http://pidgin.im/" #define PURPLE_DEVEL_WEBSITE "http://developer.pidgin.im/" diff --git a/libpurple/util.c b/libpurple/util.c index badb1e4ef1..6f220dc14b 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -612,7 +612,7 @@ purple_utf8_strftime(const char *format, const struct tm *tm) } else { - purple_strlcpy(buf, utf8); + g_strlcpy(buf, utf8, sizeof(buf)); g_free(utf8); } -- cgit v1.2.1 From a670a717ec93e01a6508bdfea323d62ce2687e5d Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 01:13:46 +0000 Subject: Remove a few deprecated functions --- ChangeLog.API | 4 +++ libpurple/notify.c | 34 --------------------- libpurple/notify.h | 86 ------------------------------------------------------ 3 files changed, 4 insertions(+), 120 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index a956f8ea91..e987048aeb 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -10,6 +10,10 @@ version 3.0.0 (??/??/????): Removed: * purple_core_migrate + * purple_notify_searchresults_column_get_title + * purple_notify_searchresults_get_columns_count + * purple_notify_searchresults_get_rows_count + * purple_notify_searchresults_row_get * purple_strlcat * purple_strlcpy diff --git a/libpurple/notify.c b/libpurple/notify.c index 291ea63e7c..d8efb0347a 100644 --- a/libpurple/notify.c +++ b/libpurple/notify.c @@ -383,40 +383,6 @@ purple_notify_searchresult_column_is_visible(const PurpleNotifySearchColumn *col return column->visible; } -guint -purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results) -{ - g_return_val_if_fail(results != NULL, 0); - - return g_list_length(results->columns); -} - -guint -purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results) -{ - g_return_val_if_fail(results != NULL, 0); - - return g_list_length(results->rows); -} - -char * -purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results, - unsigned int column_id) -{ - g_return_val_if_fail(results != NULL, NULL); - - return ((PurpleNotifySearchColumn *)g_list_nth_data(results->columns, column_id))->title; -} - -GList * -purple_notify_searchresults_row_get(PurpleNotifySearchResults *results, - unsigned int row_id) -{ - g_return_val_if_fail(results != NULL, NULL); - - return g_list_nth_data(results->rows, row_id); -} - void * purple_notify_userinfo(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb, gpointer user_data) diff --git a/libpurple/notify.h b/libpurple/notify.h index 9d4dd89c93..b8aeff204d 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -311,92 +311,6 @@ void purple_notify_searchresults_column_add(PurpleNotifySearchResults *results, void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results, GList *row); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) -/** - * Returns a number of the rows in the search results object. - * - * @deprecated This function will be removed in Pidgin 3.0.0 unless - * there is sufficient demand to keep it. Using this - * function encourages looping through the results - * inefficiently. Instead of using this function you - * should iterate through the results using a loop - * similar to this: - * for (l = results->rows; l != NULL; l = l->next) - * If you really need to get the number of rows you - * can use g_list_length(results->rows). - * - * @param results The search results object. - * - * @return Number of the result rows. - */ -guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) -/** - * Returns a number of the columns in the search results object. - * - * @deprecated This function will be removed in Pidgin 3.0.0 unless - * there is sufficient demand to keep it. Using this - * function encourages looping through the columns - * inefficiently. Instead of using this function you - * should iterate through the columns using a loop - * similar to this: - * for (l = results->columns; l != NULL; l = l->next) - * If you really need to get the number of columns you - * can use g_list_length(results->columns). - * - * @param results The search results object. - * - * @return Number of the columns. - */ -guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) -/** - * Returns a row of the results from the search results object. - * - * @deprecated This function will be removed in Pidgin 3.0.0 unless - * there is sufficient demand to keep it. Using this - * function encourages looping through the results - * inefficiently. Instead of using this function you - * should iterate through the results using a loop - * similar to this: - * for (l = results->rows; l != NULL; l = l->next) - * If you really need to get the data for a particular - * row you can use g_list_nth_data(results->rows, row_id). - * - * @param results The search results object. - * @param row_id Index of the row to be returned. - * - * @return Row of the results. - */ -GList *purple_notify_searchresults_row_get(PurpleNotifySearchResults *results, - unsigned int row_id); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) -/** - * Returns a title of the search results object's column. - * - * @deprecated This function will be removed in Pidgin 3.0.0 unless - * there is sufficient demand to keep it. Using this - * function encourages looping through the columns - * inefficiently. Instead of using this function you - * should iterate through the name of a particular - * column you can use - * g_list_nth_data(results->columns, row_id). - * - * @param results The search results object. - * @param column_id Index of the column. - * - * @return Title of the column. - */ -char *purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results, - unsigned int column_id); -#endif - /*@}*/ /**************************************************************************/ -- cgit v1.2.1 From 25cd05f8d49dff388d6cbfe6f15b38df1c3e3fbf Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 01:16:32 +0000 Subject: Mr. Ben Ice is probably wondering why he's mentioned in our codebase. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b9d598f0f3..2b4613fe38 100644 --- a/configure.ac +++ b/configure.ac @@ -329,7 +329,7 @@ dnl ####################################################################### dnl # Check for GLib 2.16 (required) dnl ####################################################################### # TODO: gmodule-2.0 is only needed if enable_plugins is 'yes'. It -# might ben ice to change this check so that it's not required +# might be nice to change this check so that it's not required # if enable_plugins is 'no'. PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.16.0 gobject-2.0 gmodule-2.0 gthread-2.0], , [ AC_MSG_RESULT(no) -- cgit v1.2.1 From 4062320f05cec85a613c64fe5ade476aad631a6b Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 01:35:54 +0000 Subject: Get rid of the wholly unused "primary attribute" thing in PurpleStatusTypes --- ChangeLog.API | 2 ++ libpurple/plugins/perl/common/Status.xs | 9 --------- libpurple/plugins/tcl/tcl_cmds.c | 16 ++-------------- libpurple/status.c | 19 ------------------- libpurple/status.h | 30 ------------------------------ 5 files changed, 4 insertions(+), 72 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index e987048aeb..94f8554bdd 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -14,6 +14,8 @@ version 3.0.0 (??/??/????): * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count * purple_notify_searchresults_row_get + * purple_status_type_get_primary_attr + * purple_status_type_set_primary_attr * purple_strlcat * purple_strlcpy diff --git a/libpurple/plugins/perl/common/Status.xs b/libpurple/plugins/perl/common/Status.xs index 7c8d615680..f77860e61d 100644 --- a/libpurple/plugins/perl/common/Status.xs +++ b/libpurple/plugins/perl/common/Status.xs @@ -397,10 +397,6 @@ const char * purple_status_type_get_name(status_type) Purple::StatusType status_type -const char * -purple_status_type_get_primary_attr(status_type) - Purple::StatusType status_type - Purple::StatusPrimitive purple_status_type_get_primitive(status_type) Purple::StatusType status_type @@ -440,8 +436,3 @@ purple_status_type_new_full(primitive, id, name, saveable, user_settable, indepe gboolean saveable gboolean user_settable gboolean independent - -void -purple_status_type_set_primary_attr(status_type, attr_id) - Purple::StatusType status_type - const char *attr_id diff --git a/libpurple/plugins/tcl/tcl_cmds.c b/libpurple/plugins/tcl/tcl_cmds.c index c7a0b3fe0e..440e9c53cc 100644 --- a/libpurple/plugins/tcl/tcl_cmds.c +++ b/libpurple/plugins/tcl/tcl_cmds.c @@ -1640,13 +1640,13 @@ int tcl_cmd_status_attr(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj int tcl_cmd_status_type(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { const char *cmds[] = { "attr", "attrs", "available", "exclusive", "id", - "independent", "name", "primary_attr", + "independent", "name", "primitive", "saveable", "user_settable", NULL }; enum { CMD_STATUS_TYPE_ATTR, CMD_STATUS_TYPE_ATTRS, CMD_STATUS_TYPE_AVAILABLE, CMD_STATUS_TYPE_EXCLUSIVE, CMD_STATUS_TYPE_ID, CMD_STATUS_TYPE_INDEPENDENT, - CMD_STATUS_TYPE_NAME, CMD_STATUS_TYPE_PRIMARY_ATTR, + CMD_STATUS_TYPE_NAME, CMD_STATUS_TYPE_PRIMITIVE, CMD_STATUS_TYPE_SAVEABLE, CMD_STATUS_TYPE_USER_SETTABLE } cmd; PurpleStatusType *status_type; @@ -1751,18 +1751,6 @@ int tcl_cmd_status_type(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj Tcl_NewStringObj(purple_primitive_get_id_from_type (purple_status_type_get_primitive(status_type)), -1)); break; - case CMD_STATUS_TYPE_PRIMARY_ATTR: -#if !(defined PURPLE_DISABLE_DEPRECATED) - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_type_get_primary_attr(status_type), -1)); -#endif - break; case CMD_STATUS_TYPE_SAVEABLE: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "statustype"); diff --git a/libpurple/status.c b/libpurple/status.c index 9f7f80f151..6d093c99be 100644 --- a/libpurple/status.c +++ b/libpurple/status.c @@ -44,7 +44,6 @@ struct _PurpleStatusType char *id; char *name; - char *primary_attr_id; gboolean saveable; gboolean user_settable; @@ -294,7 +293,6 @@ purple_status_type_destroy(PurpleStatusType *status_type) g_free(status_type->id); g_free(status_type->name); - g_free(status_type->primary_attr_id); g_list_foreach(status_type->attrs, (GFunc)purple_status_attr_destroy, NULL); g_list_free(status_type->attrs); @@ -303,15 +301,6 @@ purple_status_type_destroy(PurpleStatusType *status_type) g_free(status_type); } -void -purple_status_type_set_primary_attr(PurpleStatusType *status_type, const char *id) -{ - g_return_if_fail(status_type != NULL); - - g_free(status_type->primary_attr_id); - status_type->primary_attr_id = g_strdup(id); -} - void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, const char *name, PurpleValue *value) @@ -435,14 +424,6 @@ purple_status_type_is_available(const PurpleStatusType *status_type) return (primitive == PURPLE_STATUS_AVAILABLE); } -const char * -purple_status_type_get_primary_attr(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, NULL); - - return status_type->primary_attr_id; -} - PurpleStatusAttr * purple_status_type_get_attr(const PurpleStatusType *status_type, const char *id) { diff --git a/libpurple/status.h b/libpurple/status.h index f47ce900bb..7dcce3a26b 100644 --- a/libpurple/status.h +++ b/libpurple/status.h @@ -271,23 +271,6 @@ PurpleStatusType *purple_status_type_new_with_attrs(PurpleStatusPrimitive primit */ void purple_status_type_destroy(PurpleStatusType *status_type); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets a status type's primary attribute. - * - * The value for the primary attribute is used as the description for - * the particular status type. An example is an away message. The message - * would be the primary attribute. - * - * @param status_type The status type. - * @param attr_id The ID of the primary attribute. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -void purple_status_type_set_primary_attr(PurpleStatusType *status_type, - const char *attr_id); -#endif - #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) /** * Adds an attribute to a status type. @@ -419,19 +402,6 @@ gboolean purple_status_type_is_exclusive(const PurpleStatusType *status_type); */ gboolean purple_status_type_is_available(const PurpleStatusType *status_type); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Returns a status type's primary attribute ID. - * - * @param type The status type. - * - * @return The primary attribute's ID. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -const char *purple_status_type_get_primary_attr(const PurpleStatusType *type); -#endif - /** * Returns the attribute with the specified ID. * -- cgit v1.2.1 From 63931aebbb83d943f9657b0862ff8522f9ca2843 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 01:52:25 +0000 Subject: Remove purple_util_fetch_url_request_len() and change the few places that used it to use purple_util_fetch_url_request_len_with_account() --- libpurple/upnp.c | 4 ++-- libpurple/util.c | 11 ----------- libpurple/util.h | 25 +------------------------ pidgin/plugins/relnot.c | 2 +- 4 files changed, 4 insertions(+), 38 deletions(-) diff --git a/libpurple/upnp.c b/libpurple/upnp.c index a0ad9af7fb..fa4707494c 100644 --- a/libpurple/upnp.c +++ b/libpurple/upnp.c @@ -464,7 +464,7 @@ purple_upnp_parse_description(const gchar* descriptionURL, UPnPDiscoveryData *dd purple_timeout_remove(dd->tima); dd->tima = 0; - purple_util_fetch_url_request_len(descriptionURL, TRUE, NULL, TRUE, httpRequest, + purple_util_fetch_url_request_len_with_account(NULL, descriptionURL, TRUE, NULL, TRUE, httpRequest, TRUE, MAX_UPNP_DOWNLOAD, upnp_parse_description_cb, dd); g_free(httpRequest); @@ -730,7 +730,7 @@ purple_upnp_generate_action_message_and_send(const gchar* actionName, g_free(pathOfControl); g_free(soapMessage); - gfud = purple_util_fetch_url_request_len(control_info.control_url, FALSE, NULL, TRUE, + gfud = purple_util_fetch_url_request_len_with_account(NULL, control_info.control_url, FALSE, NULL, TRUE, totalSendMessage, TRUE, MAX_UPNP_DOWNLOAD, cb, cb_data); g_free(totalSendMessage); diff --git a/libpurple/util.c b/libpurple/util.c index 6f220dc14b..5e3f5dc88c 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -4114,17 +4114,6 @@ purple_util_fetch_url_request(const char *url, gboolean full, callback, user_data); } -PurpleUtilFetchUrlData * -purple_util_fetch_url_request_len(const char *url, gboolean full, - const char *user_agent, gboolean http11, - const char *request, gboolean include_headers, gssize max_len, - PurpleUtilFetchUrlCallback callback, void *user_data) -{ - return purple_util_fetch_url_request_len_with_account(NULL, url, full, - user_agent, http11, request, include_headers, max_len, callback, - user_data); -} - PurpleUtilFetchUrlData * purple_util_fetch_url_request_len_with_account(PurpleAccount *account, const char *url, gboolean full, const char *user_agent, gboolean http11, diff --git a/libpurple/util.h b/libpurple/util.h index a6d01bd5eb..eb7d0a9a61 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -1138,7 +1138,7 @@ typedef void (*PurpleUtilFetchUrlCallback)(PurpleUtilFetchUrlData *url_data, gpo * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url" and get rid of the old one */ #define purple_util_fetch_url_len(url, full, user_agent, http11, max_len, cb, data) \ - purple_util_fetch_url_request_len(url, full, user_agent, http11, NULL, \ + purple_util_fetch_url_request_len_with_account(NULL, url, full, user_agent, http11, NULL, \ FALSE, max_len, cb, data); /** @@ -1161,28 +1161,6 @@ PurpleUtilFetchUrlData *purple_util_fetch_url_request(const gchar *url, const gchar *request, gboolean include_headers, PurpleUtilFetchUrlCallback callback, gpointer data); -/** - * Fetches the data from a URL, and passes it to a callback function. - * - * @param url The URL. - * @param full TRUE if this is the full URL, or FALSE if it's a - * partial URL. - * @param user_agent The user agent field to use, or NULL. - * @param http11 TRUE if HTTP/1.1 should be used to download the file. - * @param request A HTTP request to send to the server instead of the - * standard GET - * @param include_headers - * If TRUE, include the HTTP headers in the response. - * @param max_len The maximum number of bytes to retrieve (-1 for unlimited) - * @param callback The callback function. - * @param data The user data to pass to the callback function. - * @deprecated In 3.0.0, this will go away. - */ -PurpleUtilFetchUrlData *purple_util_fetch_url_request_len(const gchar *url, - gboolean full, const gchar *user_agent, gboolean http11, - const gchar *request, gboolean include_headers, gssize max_len, - PurpleUtilFetchUrlCallback callback, gpointer data); - /** * Fetches the data from a URL, and passes it to a callback function. * @@ -1199,7 +1177,6 @@ PurpleUtilFetchUrlData *purple_util_fetch_url_request_len(const gchar *url, * @param max_len The maximum number of bytes to retrieve (-1 for unlimited) * @param callback The callback function. * @param data The user data to pass to the callback function. - * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url_request" and get rid of the old one */ PurpleUtilFetchUrlData *purple_util_fetch_url_request_len_with_account( PurpleAccount *account, const gchar *url, diff --git a/pidgin/plugins/relnot.c b/pidgin/plugins/relnot.c index 3e2aa85504..f6c2880ca5 100644 --- a/pidgin/plugins/relnot.c +++ b/pidgin/plugins/relnot.c @@ -152,7 +152,7 @@ do_check(void) url, host); - purple_util_fetch_url_request_len(url, TRUE, NULL, FALSE, + purple_util_fetch_url_request_len_with_account(NULL, url, TRUE, NULL, FALSE, request, TRUE, -1, version_fetch_cb, NULL); g_free(request); -- cgit v1.2.1 From f7f669818d2cb3f85e68e8274865a0db4d763b97 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 01:59:13 +0000 Subject: Rename purple_util_fetch_url_request_len_with_account to purple_util_fetch_url_request_len --- ChangeLog.API | 6 ++++++ libpurple/protocols/gg/gg.c | 4 ++-- libpurple/protocols/oscar/clientlogin.c | 4 ++-- libpurple/protocols/yahoo/libymsg.c | 10 +++++----- libpurple/protocols/yahoo/yahoo_aliases.c | 6 +++--- libpurple/upnp.c | 4 ++-- libpurple/util.c | 4 ++-- libpurple/util.h | 4 ++-- pidgin/plugins/relnot.c | 2 +- 9 files changed, 25 insertions(+), 19 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 94f8554bdd..8e85bec1bb 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -8,6 +8,10 @@ version 3.0.0 (??/??/????): * purple_request_field_set_tooltip * purple_request_field_get_tooltip + Changed: + * purple_util_fetch_url_request_len now takes a PurpleAccount as + the first parameter + Removed: * purple_core_migrate * purple_notify_searchresults_column_get_title @@ -18,6 +22,8 @@ version 3.0.0 (??/??/????): * purple_status_type_set_primary_attr * purple_strlcat * purple_strlcpy + * purple_util_fetch_url_request_len_with_account. Use + purple_util_fetch_url_request_len, insetad. version 2.10.0: libpurple: diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index b27fe2480c..96228216b9 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -1024,7 +1024,7 @@ static void gg_get_avatar_url_cb(PurpleUtilFetchUrlData *url_data, gpointer user purple_debug_info("gg", "gg_get_avatar_url_cb: " "requesting avatar for %s\n", uin); - url_data = purple_util_fetch_url_request_len_with_account(account, + url_data = purple_util_fetch_url_request_len(account, bigavatar, TRUE, "Mozilla/4.0 (compatible; MSIE 5.0)", FALSE, NULL, FALSE, -1, gg_fetch_avatar_cb, data); } @@ -1052,7 +1052,7 @@ static void ggp_update_buddy_avatar(PurpleConnection *gc, uin_t uin) avatarurl = g_strdup_printf("http://api.gadu-gadu.pl/avatars/%u/0.xml", uin); - url_data = purple_util_fetch_url_request_len_with_account( + url_data = purple_util_fetch_url_request_len( purple_connection_get_account(gc), avatarurl, TRUE, "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, NULL, FALSE, -1, gg_get_avatar_url_cb, gc); diff --git a/libpurple/protocols/oscar/clientlogin.c b/libpurple/protocols/oscar/clientlogin.c index a6e37fc2df..77fb481e04 100644 --- a/libpurple/protocols/oscar/clientlogin.c +++ b/libpurple/protocols/oscar/clientlogin.c @@ -384,7 +384,7 @@ static void send_start_oscar_session(OscarData *od, const char *token, const cha g_free(signature); /* Make the request */ - od->url_data = purple_util_fetch_url_request_len_with_account(account, + od->url_data = purple_util_fetch_url_request_len(account, url, TRUE, NULL, FALSE, NULL, FALSE, -1, start_oscar_session_cb, od); g_free(url); @@ -646,7 +646,7 @@ void send_client_login(OscarData *od, const char *username) g_string_free(body, TRUE); /* Send the POST request */ - od->url_data = purple_util_fetch_url_request_len_with_account( + od->url_data = purple_util_fetch_url_request_len( purple_connection_get_account(gc), get_client_login_url(od), TRUE, NULL, FALSE, request->str, FALSE, -1, client_login_cb, od); diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 75092f8305..d6664abd5c 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -2014,7 +2014,7 @@ static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *url_data, gpointer us gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token); - url_data = purple_util_fetch_url_request_len_with_account( + url_data = purple_util_fetch_url_request_len( proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, TRUE, -1, yahoo_auth16_stage2, auth_data); if (url_data) @@ -2055,7 +2055,7 @@ static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed) g_free(encoded_password); g_free(encoded_username); - url_data = purple_util_fetch_url_request_len_with_account( + url_data = purple_util_fetch_url_request_len( proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, yahoo_auth16_stage1_cb, auth_data); @@ -3708,7 +3708,7 @@ void yahoo_login(PurpleAccount *account) { /* Get the pager server. Actually start connecting in the callback since we * must have the contents of the HTTP response to proceed. */ - url_data = purple_util_fetch_url_request_len_with_account( + url_data = purple_util_fetch_url_request_len( proxy_ssl ? purple_connection_get_account(gc) : NULL, yd->jp ? YAHOOJP_PAGER_HOST_REQ_URL : YAHOO_PAGER_HOST_REQ_URL, use_whole_url ? TRUE : FALSE, @@ -4296,7 +4296,7 @@ static void yahoo_show_inbox(PurplePluginAction *action) use_whole_url ? base_url : "", yd->cookie_t, yd->cookie_y); - url_data = purple_util_fetch_url_request_len_with_account( + url_data = purple_util_fetch_url_request_len( purple_connection_get_account(gc), base_url, use_whole_url, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_get_inbox_token_cb, gc); @@ -4488,7 +4488,7 @@ static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) use_whole_url = TRUE; - url_data = purple_util_fetch_url_request_len_with_account( + url_data = purple_util_fetch_url_request_len( purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_get_sms_carrier_cb, data); diff --git a/libpurple/protocols/yahoo/yahoo_aliases.c b/libpurple/protocols/yahoo/yahoo_aliases.c index dcbf55254b..00a22894dc 100644 --- a/libpurple/protocols/yahoo/yahoo_aliases.c +++ b/libpurple/protocols/yahoo/yahoo_aliases.c @@ -207,7 +207,7 @@ yahoo_fetch_aliases(PurpleConnection *gc) webaddress); /* We have a URL and some header information, let's connect and get some aliases */ - url_data = purple_util_fetch_url_request_len_with_account(purple_connection_get_account(gc), + url_data = purple_util_fetch_url_request_len(purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, request, FALSE, -1, yahoo_fetch_aliases_cb, gc); if (url_data != NULL) @@ -379,7 +379,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) content); /* We have a URL and some header information, let's connect and update the alias */ - url_data = purple_util_fetch_url_request_len_with_account( + url_data = purple_util_fetch_url_request_len( purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, request, FALSE, -1, yahoo_update_alias_cb, cb); if (url_data != NULL) @@ -517,7 +517,7 @@ yahoo_set_userinfo_cb(PurpleConnection *gc, PurpleRequestFields *fields) } #endif - url_data = purple_util_fetch_url_request_len_with_account(account, webaddress, FALSE, + url_data = purple_util_fetch_url_request_len(account, webaddress, FALSE, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_fetch_aliases_cb, gc); if (url_data != NULL) diff --git a/libpurple/upnp.c b/libpurple/upnp.c index fa4707494c..28090d9e4b 100644 --- a/libpurple/upnp.c +++ b/libpurple/upnp.c @@ -464,7 +464,7 @@ purple_upnp_parse_description(const gchar* descriptionURL, UPnPDiscoveryData *dd purple_timeout_remove(dd->tima); dd->tima = 0; - purple_util_fetch_url_request_len_with_account(NULL, descriptionURL, TRUE, NULL, TRUE, httpRequest, + purple_util_fetch_url_request_len(NULL, descriptionURL, TRUE, NULL, TRUE, httpRequest, TRUE, MAX_UPNP_DOWNLOAD, upnp_parse_description_cb, dd); g_free(httpRequest); @@ -730,7 +730,7 @@ purple_upnp_generate_action_message_and_send(const gchar* actionName, g_free(pathOfControl); g_free(soapMessage); - gfud = purple_util_fetch_url_request_len_with_account(NULL, control_info.control_url, FALSE, NULL, TRUE, + gfud = purple_util_fetch_url_request_len(NULL, control_info.control_url, FALSE, NULL, TRUE, totalSendMessage, TRUE, MAX_UPNP_DOWNLOAD, cb, cb_data); g_free(totalSendMessage); diff --git a/libpurple/util.c b/libpurple/util.c index 5e3f5dc88c..5a8494fe91 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -4108,14 +4108,14 @@ purple_util_fetch_url_request(const char *url, gboolean full, const char *request, gboolean include_headers, PurpleUtilFetchUrlCallback callback, void *user_data) { - return purple_util_fetch_url_request_len_with_account(NULL, url, full, + return purple_util_fetch_url_request_len(NULL, url, full, user_agent, http11, request, include_headers, -1, callback, user_data); } PurpleUtilFetchUrlData * -purple_util_fetch_url_request_len_with_account(PurpleAccount *account, +purple_util_fetch_url_request_len(PurpleAccount *account, const char *url, gboolean full, const char *user_agent, gboolean http11, const char *request, gboolean include_headers, gssize max_len, PurpleUtilFetchUrlCallback callback, void *user_data) diff --git a/libpurple/util.h b/libpurple/util.h index eb7d0a9a61..7ccbe4fcd1 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -1138,7 +1138,7 @@ typedef void (*PurpleUtilFetchUrlCallback)(PurpleUtilFetchUrlData *url_data, gpo * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url" and get rid of the old one */ #define purple_util_fetch_url_len(url, full, user_agent, http11, max_len, cb, data) \ - purple_util_fetch_url_request_len_with_account(NULL, url, full, user_agent, http11, NULL, \ + purple_util_fetch_url_request_len(NULL, url, full, user_agent, http11, NULL, \ FALSE, max_len, cb, data); /** @@ -1178,7 +1178,7 @@ PurpleUtilFetchUrlData *purple_util_fetch_url_request(const gchar *url, * @param callback The callback function. * @param data The user data to pass to the callback function. */ -PurpleUtilFetchUrlData *purple_util_fetch_url_request_len_with_account( +PurpleUtilFetchUrlData *purple_util_fetch_url_request_len( PurpleAccount *account, const gchar *url, gboolean full, const gchar *user_agent, gboolean http11, const gchar *request, gboolean include_headers, gssize max_len, diff --git a/pidgin/plugins/relnot.c b/pidgin/plugins/relnot.c index f6c2880ca5..d3d1817741 100644 --- a/pidgin/plugins/relnot.c +++ b/pidgin/plugins/relnot.c @@ -152,7 +152,7 @@ do_check(void) url, host); - purple_util_fetch_url_request_len_with_account(NULL, url, TRUE, NULL, FALSE, + purple_util_fetch_url_request_len(NULL, url, TRUE, NULL, FALSE, request, TRUE, -1, version_fetch_cb, NULL); g_free(request); -- cgit v1.2.1 From 57eca7a77b46a47e53d36839e4eeaa995f32ded9 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 02:11:02 +0000 Subject: Remove some deprecated stuff --- ChangeLog.API | 5 +++++ pidgin/gtkblist.c | 34 ++++++++++++++++++++++------------ pidgin/gtkblist.h | 14 -------------- pidgin/gtkconv.h | 10 ++-------- pidgin/gtkdialogs.h | 10 +--------- pidgin/gtkimhtml.h | 10 ---------- 6 files changed, 30 insertions(+), 53 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 8e85bec1bb..30ba4a5c5d 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -13,6 +13,8 @@ version 3.0.0 (??/??/????): the first parameter Removed: + * pidgin_blist_update_account_error_state + * PIDGIN_DIALOG * purple_core_migrate * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count @@ -24,6 +26,9 @@ version 3.0.0 (??/??/????): * purple_strlcpy * purple_util_fetch_url_request_len_with_account. Use purple_util_fetch_url_request_len, insetad. + * The 'clipboard_text_string' and 'clipboard_html_string' members of + GtkIMHtml + * The 'sg' member of PidginConversation version 2.10.0: libpurple: diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 6bcef4c88a..075c585146 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -5343,6 +5343,28 @@ update_signed_on_elsewhere_tooltip(PurpleAccount *account, } +/** + * Was used by the connection API to tell the blist if an account has a + * connection error or no longer has a connection error, but the blist now does + * this itself with the @ref account-error-changed signal. + * + * @param account The account that either has a connection error + * or no longer has a connection error. + * @param message The connection error message, or NULL if this + * account is no longer in an error state. + */ +static void +pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text) +{ + /* connection_errors isn't actually used anywhere; it's just kept in + * sync with reality in case a plugin uses it. + */ + if (text == NULL) + g_hash_table_remove(gtkblist->connection_errors, account); + else + g_hash_table_insert(gtkblist->connection_errors, account, g_strdup(text)); +} + /* Call appropriate error notification code based on error types */ static void update_account_error_state(PurpleAccount *account, @@ -5427,18 +5449,6 @@ show_initial_account_errors(PidginBuddyList *gtkblist) } } -void -pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text) -{ - /* connection_errors isn't actually used anywhere; it's just kept in - * sync with reality in case a plugin uses it. - */ - if (text == NULL) - g_hash_table_remove(gtkblist->connection_errors, account); - else - g_hash_table_insert(gtkblist->connection_errors, account, g_strdup(text)); -} - static gboolean paint_headline_hbox (GtkWidget *widget, GdkEventExpose *event, diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index a3d5f26c4f..7da86505af 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -369,20 +369,6 @@ void pidgin_append_blist_node_proto_menu (GtkWidget *menu, PurpleConnection *gc, */ void pidgin_append_blist_node_extended_menu(GtkWidget *menu, PurpleBlistNode *node); -/** - * Was used by the connection API to tell the blist if an account has a - * connection error or no longer has a connection error, but the blist now does - * this itself with the @ref account-error-changed signal. - * - * @param account The account that either has a connection error - * or no longer has a connection error. - * @param message The connection error message, or NULL if this - * account is no longer in an error state. - * @deprecated There was no good reason for code other than gtkconn to call - * this. - */ -void pidgin_blist_update_account_error_state(PurpleAccount *account, const char *message); - /** * Sets a headline notification * diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index a952e73b81..ad4285bf62 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -132,8 +132,8 @@ struct _PidginConversation GtkTextBuffer *entry_buffer; GtkWidget *entry; gboolean auto_resize; /* this is set to TRUE if the conversation - * is being resized by a non-user-initiated - * event, such as the buddy icon appearing + * is being resized by a non-user-initiated + * event, such as the buddy icon appearing */ gboolean entry_growing; /* True if the size of the entry was set * automatically by typing too much to fit @@ -144,12 +144,6 @@ struct _PidginConversation GtkWidget *tab_label; GtkWidget *menu_icon; GtkWidget *menu_label; -#if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKCONV_C_) - /** @deprecated */ - GtkSizeGroup *sg; -#else - gpointer depr1; -#endif GtkWidget *lower_hbox; diff --git a/pidgin/gtkdialogs.h b/pidgin/gtkdialogs.h index 821ccb6a5a..67316d1298 100644 --- a/pidgin/gtkdialogs.h +++ b/pidgin/gtkdialogs.h @@ -58,15 +58,7 @@ void pidgin_dialogs_remove_chat(PurpleChat *); void pidgin_dialogs_remove_contact(PurpleContact *); void pidgin_dialogs_merge_groups(PurpleGroup *, const char *); -/* Everything after this should probably be moved elsewhere */ - -#ifndef PIDGIN_DISABLE_DEPRECATED -/* This PIDGIN_DISABLE_DEPRECATED doesn't need to be deactivated by - * _PIDGIN_GTKDIALOGS_C_, because it shouldn't be using this macro. */ -#define PIDGIN_DIALOG(x) x = gtk_window_new(GTK_WINDOW_TOPLEVEL); \ - gtk_window_set_type_hint(GTK_WINDOW(x), GDK_WINDOW_TYPE_HINT_DIALOG) -#endif - +/* This macro should probably be moved elsewhere */ #define PIDGIN_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED) #endif /* _PIDGINDIALOGS_H_ */ diff --git a/pidgin/gtkimhtml.h b/pidgin/gtkimhtml.h index d26dcc0d2d..3c04c93fc6 100644 --- a/pidgin/gtkimhtml.h +++ b/pidgin/gtkimhtml.h @@ -135,16 +135,6 @@ struct _GtkIMHtml { GtkTextTag *link; } edit; -#if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKIMHTML_C_) - /** @deprecated */ - char *clipboard_text_string; - /** @deprecated */ - char *clipboard_html_string; -#else - char *depr1; - char *depr2; -#endif - GSList *im_images; GtkIMHtmlFuncs *funcs; GtkSourceUndoManager *undo_manager; -- cgit v1.2.1 From a8b4fc1facd4ff9ac1bca44b0f7b361477436241 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 02:56:19 +0000 Subject: Remove a few deprecated functions --- pidgin/gtkutils.c | 40 ---------------------------------------- pidgin/gtkutils.h | 46 ---------------------------------------------- 2 files changed, 86 deletions(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 307a6c1481..c2999fab62 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -922,24 +922,6 @@ pidgin_account_option_menu_new(PurpleAccount *default_account, return optmenu; } -gboolean -pidgin_check_if_dir(const char *path, GtkFileSelection *filesel) -{ - char *dirname = NULL; - - if (g_file_test(path, G_FILE_TEST_IS_DIR)) { - /* append a / if needed */ - if (path[strlen(path) - 1] != G_DIR_SEPARATOR) { - dirname = g_strconcat(path, G_DIR_SEPARATOR_S, NULL); - } - gtk_file_selection_set_filename(filesel, (dirname != NULL) ? dirname : path); - g_free(dirname); - return TRUE; - } - - return FALSE; -} - void pidgin_setup_gtkspell(GtkTextView *textview) { @@ -2181,13 +2163,6 @@ pidgin_screenname_autocomplete_default_filter(const PidginBuddyCompletionEntry * } } -void -pidgin_setup_screenname_autocomplete(GtkWidget *entry, GtkWidget *accountopt, gboolean all) { - pidgin_setup_screenname_autocomplete_with_filter(entry, accountopt, pidgin_screenname_autocomplete_default_filter, GINT_TO_POINTER(all)); -} - - - void pidgin_set_cursor(GtkWidget *widget, GdkCursorType cursor_type) { GdkCursor *cursor; @@ -2533,21 +2508,6 @@ pidgin_convert_buddy_icon(PurplePlugin *plugin, const char *path, size_t *len) return NULL; } -void pidgin_set_custom_buddy_icon(PurpleAccount *account, const char *who, const char *filename) -{ - PurpleBuddy *buddy; - PurpleContact *contact; - - buddy = purple_find_buddy(account, who); - if (!buddy) { - purple_debug_info("custom-icon", "You can only set custom icon for someone in your buddylist.\n"); - return; - } - - contact = purple_buddy_get_contact(buddy); - purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, filename); -} - char *pidgin_make_pretty_arrows(const char *str) { char *ret; diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h index 716ec6de81..7ea8563151 100644 --- a/pidgin/gtkutils.h +++ b/pidgin/gtkutils.h @@ -383,39 +383,6 @@ void pidgin_setup_screenname_autocomplete_with_filter(GtkWidget *entry, GtkWidge */ gboolean pidgin_screenname_autocomplete_default_filter(const PidginBuddyCompletionEntry *completion_entry, gpointer all_accounts); -/** - * Add autocompletion of screenames to an entry. - * - * @deprecated - * For new code, use the equivalent: - * #pidgin_setup_screenname_autocomplete_with_filter(@a entry, @a optmenu, - * #pidgin_screenname_autocomplete_default_filter, GINT_TO_POINTER(@a - * all)) - * - * @param entry The GtkEntry on which to setup autocomplete. - * @param optmenu A menu for accounts, returned by - * pidgin_account_option_menu_new(). If @a optmenu is not @c - * NULL, it'll be updated when a username is chosen from the - * autocomplete list. - * @param all Whether to include usernames from disconnected accounts. - */ -void pidgin_setup_screenname_autocomplete(GtkWidget *entry, GtkWidget *optmenu, gboolean all); - -/** - * Check if the given path is a directory or not. If it is, then modify - * the given GtkFileSelection dialog so that it displays the given path. - * If the given path is not a directory, then do nothing. - * - * @param path The path entered in the file selection window by the user. - * @param filesel The file selection window. - * - * @return TRUE if given path is a directory, FALSE otherwise. - * @deprecated Pidgin no longer uses GtkFileSelection internally. It has also - * been deprecated by GTK+. Use GtkFileChooser instead and ignore - * this function. - */ -gboolean pidgin_check_if_dir(const char *path, GtkFileSelection *filesel); - /** * Sets up GtkSpell for the given GtkTextView, reporting errors * if encountered. @@ -661,19 +628,6 @@ GtkWidget *pidgin_buddy_icon_chooser_new(GtkWindow *parent, void(*callback)(cons */ gpointer pidgin_convert_buddy_icon(PurplePlugin *plugin, const char *path, size_t *len); -#if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKUTILS_C_) -/** - * Set or unset a custom buddyicon for a user. - * - * @param account The account the user belongs to. - * @param who The name of the user. - * @param filename The path of the custom icon. If this is @c NULL, then any - * previously set custom buddy icon for the user is removed. - * @deprecated See purple_buddy_icons_node_set_custom_icon_from_file() - */ -void pidgin_set_custom_buddy_icon(PurpleAccount *account, const char *who, const char *filename); -#endif - /** * Converts "->" and "<-" in strings to Unicode arrow characters, for use in referencing * menu items. -- cgit v1.2.1 From 708f8eca80448dd01a2429865c26566b666b4c9a Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 03:01:37 +0000 Subject: Remove more deprecated stuff --- pidgin/gtkdialogs.c | 20 -------------------- pidgin/gtkdialogs.h | 8 -------- pidgin/gtkimhtml.h | 14 -------------- pidgin/plugins/perl/common/GtkDialogs.xs | 4 ---- 4 files changed, 46 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 2fd413499e..1712722f58 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -1113,26 +1113,6 @@ pidgin_dialogs_log(void) NULL); } -static void -pidgin_dialogs_alias_contact_cb(PurpleContact *contact, const char *new_alias) -{ - purple_blist_alias_contact(contact, new_alias); -} - -void -pidgin_dialogs_alias_contact(PurpleContact *contact) -{ - g_return_if_fail(contact != NULL); - - purple_request_input(NULL, _("Alias Contact"), NULL, - _("Enter an alias for this contact."), - contact->alias, FALSE, FALSE, NULL, - _("Alias"), G_CALLBACK(pidgin_dialogs_alias_contact_cb), - _("Cancel"), NULL, - NULL, purple_contact_get_alias(contact), NULL, - contact); -} - static void pidgin_dialogs_alias_buddy_cb(PurpleBuddy *buddy, const char *new_alias) { diff --git a/pidgin/gtkdialogs.h b/pidgin/gtkdialogs.h index 67316d1298..adda62074a 100644 --- a/pidgin/gtkdialogs.h +++ b/pidgin/gtkdialogs.h @@ -42,14 +42,6 @@ void pidgin_dialogs_im_with_user(PurpleAccount *, const char *); void pidgin_dialogs_info(void); void pidgin_dialogs_log(void); -#if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKDIALOGS_C_) -/** - * @deprecated This function is no longer used and will be removed in - * Pidgin 3.0.0 unless there is sufficient demand to keep it. - */ -void pidgin_dialogs_alias_contact(PurpleContact *); -#endif - void pidgin_dialogs_alias_buddy(PurpleBuddy *); void pidgin_dialogs_alias_chat(PurpleChat *); void pidgin_dialogs_remove_buddy(PurpleBuddy *); diff --git a/pidgin/gtkimhtml.h b/pidgin/gtkimhtml.h index 3c04c93fc6..498c376fbe 100644 --- a/pidgin/gtkimhtml.h +++ b/pidgin/gtkimhtml.h @@ -154,20 +154,6 @@ struct _GtkIMHtmlClass { GList *protocols; /* List of GtkIMHtmlProtocol's */ }; -#if !(defined PIDGIN_DISABLE_DEPRECATED) && !(defined _PIDGIN_GTKIMHTML_C_) -/** @deprecated as of 2.7.10 */ -struct _GtkIMHtmlFontDetail { - gushort size; - gchar *face; - gchar *fore; - gchar *back; - gchar *bg; - gchar *sml; - gboolean underline; - gshort bold; -}; -#endif - struct _GtkSmileyTree { GString *values; GtkSmileyTree **children; diff --git a/pidgin/plugins/perl/common/GtkDialogs.xs b/pidgin/plugins/perl/common/GtkDialogs.xs index 01767b9cb1..0e30194f1c 100644 --- a/pidgin/plugins/perl/common/GtkDialogs.xs +++ b/pidgin/plugins/perl/common/GtkDialogs.xs @@ -23,10 +23,6 @@ pidgin_dialogs_info() void pidgin_dialogs_log() -void -pidgin_dialogs_alias_contact(contact) - Purple::BuddyList::Contact contact - void pidgin_dialogs_alias_buddy(buddy) Purple::BuddyList::Buddy buddy -- cgit v1.2.1 From 804c5c4079851f53d49a42275e5332f9ae23c859 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 04:09:13 +0000 Subject: Whoops, I forgot to commit ChangeLog.API --- ChangeLog.API | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog.API b/ChangeLog.API index 30ba4a5c5d..a4efba8073 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -14,7 +14,11 @@ version 3.0.0 (??/??/????): Removed: * pidgin_blist_update_account_error_state + * pidgin_check_if_dir * PIDGIN_DIALOG + * pidgin_dialogs_alias_contact + * pidgin_set_custom_buddy_icon + * pidgin_setup_screenname_autocomplete * purple_core_migrate * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count @@ -26,6 +30,7 @@ version 3.0.0 (??/??/????): * purple_strlcpy * purple_util_fetch_url_request_len_with_account. Use purple_util_fetch_url_request_len, insetad. + * struct _GtkIMHtmlFontDetail * The 'clipboard_text_string' and 'clipboard_html_string' members of GtkIMHtml * The 'sg' member of PidginConversation -- cgit v1.2.1 From 2c7f7bab1db2a893b422d583e2d5dbb13dbcfe89 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 07:34:02 +0000 Subject: Remove PurpleConnectionUiOps.report_disconnect --- ChangeLog.API | 7 ++++--- finch/gntconn.c | 1 - libpurple/connection.c | 9 ++------- libpurple/connection.h | 26 +++++++------------------- pidgin/gtkconn.c | 1 - 5 files changed, 13 insertions(+), 31 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index a4efba8073..680fe094e6 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -13,12 +13,15 @@ version 3.0.0 (??/??/????): the first parameter Removed: + * GtkIMHtml.clipboard_html_string + * GtkIMHtml.clipboard_text_string * pidgin_blist_update_account_error_state * pidgin_check_if_dir * PIDGIN_DIALOG * pidgin_dialogs_alias_contact * pidgin_set_custom_buddy_icon * pidgin_setup_screenname_autocomplete + * PidginConversation.sg * purple_core_migrate * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count @@ -30,10 +33,8 @@ version 3.0.0 (??/??/????): * purple_strlcpy * purple_util_fetch_url_request_len_with_account. Use purple_util_fetch_url_request_len, insetad. + * PurpleConnectionUiOps.report_disconnect * struct _GtkIMHtmlFontDetail - * The 'clipboard_text_string' and 'clipboard_html_string' members of - GtkIMHtml - * The 'sg' member of PidginConversation version 2.10.0: libpurple: diff --git a/finch/gntconn.c b/finch/gntconn.c index 2c3b8afa43..09d4bf71c1 100644 --- a/finch/gntconn.c +++ b/finch/gntconn.c @@ -165,7 +165,6 @@ static PurpleConnectionUiOps ops = NULL, /* connected */ NULL, /* disconnected */ NULL, /* notice */ - NULL, NULL, /* network_connected */ NULL, /* network_disconnected */ finch_connection_report_disconnect, diff --git a/libpurple/connection.c b/libpurple/connection.c index 9e0055fb17..28e0f4be9a 100644 --- a/libpurple/connection.c +++ b/libpurple/connection.c @@ -578,13 +578,8 @@ purple_connection_error_reason (PurpleConnection *gc, ops = purple_connections_get_ui_ops(); - if (ops != NULL) - { - if (ops->report_disconnect_reason != NULL) - ops->report_disconnect_reason (gc, reason, description); - if (ops->report_disconnect != NULL) - ops->report_disconnect (gc, description); - } + if (ops && ops->report_disconnect_reason) + ops->report_disconnect_reason(gc, reason, description); purple_signal_emit(purple_connections_get_handle(), "connection-error", gc, reason, description); diff --git a/libpurple/connection.h b/libpurple/connection.h index 1eb7c15173..dd837b7a3b 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -193,16 +193,6 @@ typedef struct */ void (*notice)(PurpleConnection *gc, const char *text); - /** - * Called when an error causes a connection to be disconnected. - * Called before #disconnected. - * @param text a localized error message. - * @see #purple_connection_error - * @deprecated in favour of - * #PurpleConnectionUiOps.report_disconnect_reason. - */ - void (*report_disconnect)(PurpleConnection *gc, const char *text); - /** * Called when libpurple discovers that the computer's network * connection is active. On Linux, this uses Network Manager if @@ -219,17 +209,15 @@ typedef struct /** * Called when an error causes a connection to be disconnected. - * Called before #disconnected. This op is intended to replace - * #report_disconnect. If both are implemented, this will be called - * first; however, there's no real reason to implement both. + * Called before #disconnected. * - * @param reason why the connection ended, if known, or - * #PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not. - * @param text a localized message describing the disconnection - * in more detail to the user. - * @see #purple_connection_error_reason + * @param reason why the connection ended, if known, or + * #PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not. + * @param text a localized message describing the disconnection + * in more detail to the user. + * @see #purple_connection_error_reason * - * @since 2.3.0 + * @since 2.3.0 */ void (*report_disconnect_reason)(PurpleConnection *gc, PurpleConnectionError reason, diff --git a/pidgin/gtkconn.c b/pidgin/gtkconn.c index 6fa8e3b085..962697f1b8 100644 --- a/pidgin/gtkconn.c +++ b/pidgin/gtkconn.c @@ -215,7 +215,6 @@ static PurpleConnectionUiOps conn_ui_ops = pidgin_connection_connected, pidgin_connection_disconnected, pidgin_connection_notice, - NULL, /* report_disconnect */ pidgin_connection_network_connected, pidgin_connection_network_disconnected, pidgin_connection_report_disconnect_reason, -- cgit v1.2.1 From 101fd26557b617b0d4e2eb9058bfe761f49a8530 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 07:37:07 +0000 Subject: Rename the report_disconnect_reason cb function to report_disconnect --- ChangeLog.API | 4 +++- libpurple/connection.c | 4 ++-- libpurple/connection.h | 6 +++--- pidgin/gtkconn.c | 8 ++++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 680fe094e6..f3439b5c44 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -11,6 +11,8 @@ version 3.0.0 (??/??/????): Changed: * purple_util_fetch_url_request_len now takes a PurpleAccount as the first parameter + * PurpleConnectionUiOps.report_disconnect now passes a + PurpleConnectionError as the second parameter Removed: * GtkIMHtml.clipboard_html_string @@ -33,7 +35,7 @@ version 3.0.0 (??/??/????): * purple_strlcpy * purple_util_fetch_url_request_len_with_account. Use purple_util_fetch_url_request_len, insetad. - * PurpleConnectionUiOps.report_disconnect + * PurpleConnectionUiOps.report_disconnect_reason * struct _GtkIMHtmlFontDetail version 2.10.0: diff --git a/libpurple/connection.c b/libpurple/connection.c index 28e0f4be9a..d738313a98 100644 --- a/libpurple/connection.c +++ b/libpurple/connection.c @@ -578,8 +578,8 @@ purple_connection_error_reason (PurpleConnection *gc, ops = purple_connections_get_ui_ops(); - if (ops && ops->report_disconnect_reason) - ops->report_disconnect_reason(gc, reason, description); + if (ops && ops->report_disconnect) + ops->report_disconnect(gc, reason, description); purple_signal_emit(purple_connections_get_handle(), "connection-error", gc, reason, description); diff --git a/libpurple/connection.h b/libpurple/connection.h index dd837b7a3b..8ce602353a 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -219,9 +219,9 @@ typedef struct * * @since 2.3.0 */ - void (*report_disconnect_reason)(PurpleConnection *gc, - PurpleConnectionError reason, - const char *text); + void (*report_disconnect)(PurpleConnection *gc, + PurpleConnectionError reason, + const char *text); void (*_purple_reserved1)(void); void (*_purple_reserved2)(void); diff --git a/pidgin/gtkconn.c b/pidgin/gtkconn.c index 962697f1b8..70a60f0268 100644 --- a/pidgin/gtkconn.c +++ b/pidgin/gtkconn.c @@ -136,9 +136,9 @@ do_signon(gpointer data) } static void -pidgin_connection_report_disconnect_reason (PurpleConnection *gc, - PurpleConnectionError reason, - const char *text) +pidgin_connection_report_disconnect(PurpleConnection *gc, + PurpleConnectionError reason, + const char *text) { PurpleAccount *account = NULL; PidginAutoRecon *info; @@ -217,7 +217,7 @@ static PurpleConnectionUiOps conn_ui_ops = pidgin_connection_notice, pidgin_connection_network_connected, pidgin_connection_network_disconnected, - pidgin_connection_report_disconnect_reason, + pidgin_connection_report_disconnect, NULL, NULL, NULL -- cgit v1.2.1 From 89ee29867dd292b7b025966fc2cd03590615b3c4 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 07:49:24 +0000 Subject: Change last remaining users of purple_connection_error to use purple_connection_error_reason. The "reason" I used in this code is probably not the most appropriate reason. My goal was to retain the same behavior before and after this change. It's not a bad idea for someone to look at each of these calls and determine if a different reason should be used... but it hasn't seemed to cause problems so far, so maybe it doesn't matter. --- libpurple/protocols/mxit/http.c | 2 +- libpurple/protocols/mxit/login.c | 24 ++++++++++++------------ libpurple/protocols/mxit/protocol.c | 24 ++++++++++++------------ libpurple/protocols/zephyr/zephyr.c | 8 ++++---- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/libpurple/protocols/mxit/http.c b/libpurple/protocols/mxit/http.c index fcfcf54071..ebe2d67865 100644 --- a/libpurple/protocols/mxit/http.c +++ b/libpurple/protocols/mxit/http.c @@ -273,7 +273,7 @@ static void mxit_cb_http_connect( gpointer user_data, gint source, const gchar* /* source is the file descriptor of the new connection */ if ( source < 0 ) { purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_http_connect failed: %s\n", error_message ); - purple_connection_error( req->session->con, _( "Unable to connect to the MXit HTTP server. Please check your server settings." ) ); + purple_connection_error_reason( req->session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit HTTP server. Please check your server settings." ) ); return; } diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index 4a6318852b..22c86218b8 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -165,7 +165,7 @@ static void mxit_cb_connect( gpointer user_data, gint source, const gchar* error /* source is the file descriptor of the new connection */ if ( source < 0 ) { purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_connect failed: %s\n", error_message ); - purple_connection_error( session->con, _( "Unable to connect to the MXit server. Please check your server settings." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit server. Please check your server settings." ) ); return; } @@ -202,7 +202,7 @@ static void mxit_login_connect( struct MXitSession* session ) /* socket connection */ data = purple_proxy_connect( session->con, session->acc, session->server, session->port, mxit_cb_connect, session ); if ( !data ) { - purple_connection_error( session->con, _( "Unable to connect to the MXit server. Please check your server settings." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit server. Please check your server settings." ) ); return; } } @@ -391,7 +391,7 @@ static void mxit_cb_clientinfo2( PurpleUtilFetchUrlData* url_data, gpointer user if ( !url_text ) { /* no reply from the WAP site */ - purple_connection_error( session->con, _( "Error contacting the MXit WAP site. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Error contacting the MXit WAP site. Please try again later." ) ); return; } @@ -400,7 +400,7 @@ static void mxit_cb_clientinfo2( PurpleUtilFetchUrlData* url_data, gpointer user if ( !parts ) { /* wapserver error */ - purple_connection_error( session->con, _( "MXit is currently unable to process the request. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "MXit is currently unable to process the request. Please try again later." ) ); return; } @@ -410,26 +410,26 @@ static void mxit_cb_clientinfo2( PurpleUtilFetchUrlData* url_data, gpointer user /* valid reply! */ break; case '1' : - purple_connection_error( session->con, _( "Wrong security code entered. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Wrong security code entered. Please try again later." ) ); return; case '2' : - purple_connection_error( session->con, _( "Your session has expired. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Your session has expired. Please try again later." ) ); return; case '5' : - purple_connection_error( session->con, _( "Invalid country selected. Please try again." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Invalid country selected. Please try again." ) ); return; case '6' : - purple_connection_error( session->con, _( "The MXit ID you entered is not registered. Please register first." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "The MXit ID you entered is not registered. Please register first." ) ); return; case '7' : - purple_connection_error( session->con, _( "The MXit ID you entered is already registered. Please choose another." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "The MXit ID you entered is already registered. Please choose another." ) ); /* this user's account already exists, so we need to change the registration login flag to be login */ purple_account_set_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); return; case '3' : case '4' : default : - purple_connection_error( session->con, _( "Internal error. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Internal error. Please try again later." ) ); return; } @@ -611,7 +611,7 @@ static void mxit_cb_clientinfo1( PurpleUtilFetchUrlData* url_data, gpointer user if ( !url_text ) { /* no reply from the WAP site */ - purple_connection_error( session->con, _( "Error contacting the MXit WAP site. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Error contacting the MXit WAP site. Please try again later." ) ); return; } @@ -620,7 +620,7 @@ static void mxit_cb_clientinfo1( PurpleUtilFetchUrlData* url_data, gpointer user if ( ( !parts ) || ( parts[0][0] != '0' ) ) { /* server could not find the user */ - purple_connection_error( session->con, _( "MXit is currently unable to process the request. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "MXit is currently unable to process the request. Please try again later." ) ); return; } diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index d86ab0ac66..b47b824d89 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -408,7 +408,7 @@ static void mxit_send_packet( struct MXitSession* session, struct tx_packet* pac res = mxit_write_sock_packet( session->fd, data, datalen ); if ( res < 0 ) { /* we must have lost the connection, so terminate it so that we can reconnect */ - purple_connection_error( session->con, _( "We have lost the connection to MXit. Please reconnect." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "We have lost the connection to MXit. Please reconnect." ) ); } } else { @@ -530,7 +530,7 @@ static void mxit_manage_queue( struct MXitSession* session ) if ( session->last_tx <= mxit_now_milli() - ( MXIT_ACK_TIMEOUT * 1000 ) ) { /* ack timeout! so we close the connection here */ purple_debug_info( MXIT_PLUGIN_ID, "mxit_manage_queue: Timeout awaiting ACK for command '%i'\n", session->outack ); - purple_connection_error( session->con, _( "Timeout while waiting for a response from the MXit server." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Timeout while waiting for a response from the MXit server." ) ); } return; } @@ -2192,7 +2192,7 @@ static void mxit_perform_redirect( struct MXitSession* session, const char* url session->port = atoi( host[2] ); } else { - purple_connection_error( session->con, _( "Cannot perform redirect using the specified protocol" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Cannot perform redirect using the specified protocol" ) ); goto redirect_fail; } @@ -2361,7 +2361,7 @@ static int process_error_response( struct MXitSession* session, struct rx_packet if ( packet->errcode == MXIT_ERRCODE_LOGGEDOUT ) { /* we are not currently logged in, so we need to reconnect */ - purple_connection_error( session->con, _( errdesc ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( errdesc ) ); } /* packet command */ @@ -2375,7 +2375,7 @@ static int process_error_response( struct MXitSession* session, struct rx_packet } else { snprintf( errmsg, sizeof( errmsg ), _( "Login error: %s (%i)" ), errdesc, packet->errcode ); - purple_connection_error( session->con, errmsg ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, errmsg ); return -1; } case CP_CMD_LOGOUT : @@ -2643,7 +2643,7 @@ int mxit_parse_packet( struct MXitSession* session ) if ( packet.rcount < 2 ) { /* bad packet */ - purple_connection_error( session->con, _( "Invalid packet received from MXit." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Invalid packet received from MXit." ) ); free_rx_packet( &packet ); continue; } @@ -2708,12 +2708,12 @@ void mxit_cb_rx( gpointer user_data, gint source, PurpleInputCondition cond ) len = read( session->fd, &ch, 1 ); if ( len < 0 ) { /* connection error */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x01)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x01)" ) ); return; } else if ( len == 0 ) { /* connection closed */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x02)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x02)" ) ); return; } else { @@ -2723,7 +2723,7 @@ void mxit_cb_rx( gpointer user_data, gint source, PurpleInputCondition cond ) session->rx_lbuf[session->rx_i] = '\0'; session->rx_res = atoi( &session->rx_lbuf[3] ); if ( session->rx_res > CP_MAX_PACKET ) { - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x03)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x03)" ) ); } session->rx_state = RX_STATE_DATA; session->rx_i = 0; @@ -2734,7 +2734,7 @@ void mxit_cb_rx( gpointer user_data, gint source, PurpleInputCondition cond ) session->rx_i++; if ( session->rx_i >= sizeof( session->rx_lbuf ) ) { /* malformed packet length record (too long) */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x04)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x04)" ) ); return; } } @@ -2745,12 +2745,12 @@ void mxit_cb_rx( gpointer user_data, gint source, PurpleInputCondition cond ) len = read( session->fd, &session->rx_dbuf[session->rx_i], session->rx_res ); if ( len < 0 ) { /* connection error */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x05)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x05)" ) ); return; } else if ( len == 0 ) { /* connection closed */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x06)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x06)" ) ); return; } else { diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 69c71137cf..2c73eb589a 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -146,7 +146,7 @@ struct _zephyr_triple { return TRUE; #define z_call_s(func, err) if (func != ZERR_NONE) {\ - purple_connection_error(gc, err);\ + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, err);\ return;\ } @@ -1585,7 +1585,7 @@ static void zephyr_login(PurpleAccount * account) /* XXX z_call_s should actually try to report the com_err determined error */ if (use_tzc(zephyr)) { pid_t pid; - /* purple_connection_error(gc,"tzc not supported yet"); */ + /* purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "tzc not supported yet"); */ if ((pipe(zephyr->totzc) != 0) || (pipe(zephyr->fromtzc) != 0)) { purple_debug_error("zephyr", "pipe creation failed. killing\n"); exit(-1); @@ -1706,7 +1706,7 @@ static void zephyr_login(PurpleAccount * account) ptr++; } if (ptr >=bufcur) { - purple_connection_error(gc,"invalid output by tzc (or bad parsing code)"); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "invalid output by tzc (or bad parsing code)"); free(buf); return; } @@ -1821,7 +1821,7 @@ static void zephyr_login(PurpleAccount * account) purple_debug_info("zephyr","realm: %s\n",zephyr->realm); } else { - purple_connection_error(gc,"Only ZEPH0.2 supported currently"); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Only ZEPH0.2 supported currently"); return; } purple_debug_info("zephyr","does it get here\n"); -- cgit v1.2.1 From 61f8c7b4bef38b425fcc069697235c7f08633a91 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 07:57:00 +0000 Subject: I have no idea how to change this to take a PurpleConnectionError and I kinda don't feel like learning. Does anyone use perl plugins? Does anyone use perl? I kinda want to get rid of the perl plugin loader. --- libpurple/plugins/perl/common/Connection.xs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libpurple/plugins/perl/common/Connection.xs b/libpurple/plugins/perl/common/Connection.xs index 74bd3ba8bd..473cd56bdb 100644 --- a/libpurple/plugins/perl/common/Connection.xs +++ b/libpurple/plugins/perl/common/Connection.xs @@ -35,11 +35,6 @@ purple_connection_notice(gc, text) Purple::Connection gc const char *text -void -purple_connection_error(gc, reason) - Purple::Connection gc - const char *reason - void purple_connection_destroy(gc) Purple::Connection gc -- cgit v1.2.1 From 1ae87740ff016690f4595a1357f5fefea548796c Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 07:57:28 +0000 Subject: Remove purple_connection_error --- ChangeLog.API | 1 + libpurple/connection.c | 15 --------------- libpurple/connection.h | 15 --------------- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index f3439b5c44..d9097fadc1 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -24,6 +24,7 @@ version 3.0.0 (??/??/????): * pidgin_set_custom_buddy_icon * pidgin_setup_screenname_autocomplete * PidginConversation.sg + * purple_connection_error * purple_core_migrate * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count diff --git a/libpurple/connection.c b/libpurple/connection.c index d738313a98..ac14dd135a 100644 --- a/libpurple/connection.c +++ b/libpurple/connection.c @@ -527,21 +527,6 @@ purple_connection_disconnect_cb(gpointer data) return FALSE; } -void -purple_connection_error(PurpleConnection *gc, const char *text) -{ - /* prpls that have not been updated to use disconnection reasons will - * be setting wants_to_die before calling this function, so choose - * PURPLE_CONNECTION_ERROR_OTHER_ERROR (which is fatal) if it's true, - * and PURPLE_CONNECTION_ERROR_NETWORK_ERROR (which isn't) if not. See - * the documentation in connection.h. - */ - PurpleConnectionError reason = gc->wants_to_die - ? PURPLE_CONNECTION_ERROR_OTHER_ERROR - : PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - purple_connection_error_reason (gc, reason, text); -} - void purple_connection_error_reason (PurpleConnection *gc, PurpleConnectionError reason, diff --git a/libpurple/connection.h b/libpurple/connection.h index 8ce602353a..af5c5e30c8 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -452,21 +452,6 @@ void purple_connection_update_progress(PurpleConnection *gc, const char *text, */ void purple_connection_notice(PurpleConnection *gc, const char *text); -/** - * Closes a connection with an error. - * - * @param gc The connection. - * @param reason The error text, which may not be @c NULL. - * @deprecated in favour of #purple_connection_error_reason. Calling - * @c purple_connection_error(gc, text) is equivalent to calling - * @c purple_connection_error_reason(gc, reason, text) where @c reason is - * #PURPLE_CONNECTION_ERROR_OTHER_ERROR if @c gc->wants_to_die is @c TRUE, and - * #PURPLE_CONNECTION_ERROR_NETWORK_ERROR if not. (This is to keep - * auto-reconnection behaviour the same when using old prpls which don't use - * reasons yet.) - */ -void purple_connection_error(PurpleConnection *gc, const char *reason); - /** * Closes a connection with an error and a human-readable description of the * error. It also sets @c gc->wants_to_die to the value of -- cgit v1.2.1 From 5d4a1e7b509a1f6d9c32a3d81fcd1e47a53c7179 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 08:00:53 +0000 Subject: Rename purple_connection_error_reason to purple_connection_error --- ChangeLog.API | 4 ++- libpurple/connection.c | 8 ++--- libpurple/connection.h | 14 ++++----- libpurple/protocols/bonjour/bonjour.c | 6 ++-- libpurple/protocols/bonjour/mdns_win32.c | 2 +- libpurple/protocols/gg/gg.c | 18 +++++------ libpurple/protocols/irc/irc.c | 20 ++++++------ libpurple/protocols/irc/msgs.c | 2 +- libpurple/protocols/irc/parse.c | 4 +-- libpurple/protocols/jabber/auth.c | 30 +++++++++--------- libpurple/protocols/jabber/auth_cyrus.c | 4 +-- libpurple/protocols/jabber/auth_plain.c | 2 +- libpurple/protocols/jabber/bosh.c | 20 ++++++------ libpurple/protocols/jabber/jabber.c | 46 +++++++++++++-------------- libpurple/protocols/jabber/parser.c | 8 ++--- libpurple/protocols/msn/msn.c | 4 +-- libpurple/protocols/msn/session.c | 2 +- libpurple/protocols/mxit/http.c | 2 +- libpurple/protocols/mxit/login.c | 24 +++++++-------- libpurple/protocols/mxit/protocol.c | 26 ++++++++-------- libpurple/protocols/myspace/myspace.c | 20 ++++++------ libpurple/protocols/myspace/user.c | 10 +++--- libpurple/protocols/novell/novell.c | 14 ++++----- libpurple/protocols/oscar/clientlogin.c | 36 +++++++++++----------- libpurple/protocols/oscar/flap_connection.c | 2 +- libpurple/protocols/oscar/oscar.c | 34 ++++++++++---------- libpurple/protocols/sametime/sametime.c | 14 ++++----- libpurple/protocols/silc/ops.c | 2 +- libpurple/protocols/silc/silc.c | 30 +++++++++--------- libpurple/protocols/silc/util.c | 4 +-- libpurple/protocols/silc10/ops.c | 12 ++++---- libpurple/protocols/silc10/silc.c | 14 ++++----- libpurple/protocols/simple/simple.c | 30 +++++++++--------- libpurple/protocols/yahoo/libymsg.c | 48 ++++++++++++++--------------- libpurple/protocols/yahoo/yahoo_packet.c | 2 +- libpurple/protocols/yahoo/ycht.c | 2 +- libpurple/protocols/zephyr/zephyr.c | 8 ++--- 37 files changed, 265 insertions(+), 263 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index d9097fadc1..b55319dfba 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -13,6 +13,8 @@ version 3.0.0 (??/??/????): the first parameter * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter + * purple_connection_error now takes a PurpleConnectionError + as the second parameter Removed: * GtkIMHtml.clipboard_html_string @@ -24,7 +26,7 @@ version 3.0.0 (??/??/????): * pidgin_set_custom_buddy_icon * pidgin_setup_screenname_autocomplete * PidginConversation.sg - * purple_connection_error + * purple_connection_error_reason * purple_core_migrate * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count diff --git a/libpurple/connection.c b/libpurple/connection.c index ac14dd135a..914e3b9de8 100644 --- a/libpurple/connection.c +++ b/libpurple/connection.c @@ -528,7 +528,7 @@ purple_connection_disconnect_cb(gpointer data) } void -purple_connection_error_reason (PurpleConnection *gc, +purple_connection_error (PurpleConnection *gc, PurpleConnectionError reason, const char *description) { @@ -542,13 +542,13 @@ purple_connection_error_reason (PurpleConnection *gc, */ if (reason > PURPLE_CONNECTION_ERROR_OTHER_ERROR) { purple_debug_error("connection", - "purple_connection_error_reason: reason %u isn't a " + "purple_connection_error: reason %u isn't a " "valid reason\n", reason); reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; } if (description == NULL) { - purple_debug_error("connection", "purple_connection_error_reason called with NULL description\n"); + purple_debug_error("connection", "purple_connection_error called with NULL description\n"); description = _("Unknown error"); } @@ -595,7 +595,7 @@ purple_connection_ssl_error (PurpleConnection *gc, reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; } - purple_connection_error_reason (gc, reason, + purple_connection_error (gc, reason, purple_ssl_strerror(ssl_error)); } diff --git a/libpurple/connection.h b/libpurple/connection.h index af5c5e30c8..3a7f95f5c5 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -128,7 +128,7 @@ typedef enum /** Some other error occurred which fits into none of the other * categories. */ - /* purple_connection_error_reason() in connection.c uses the fact that + /* purple_connection_error() in connection.c uses the fact that * this is the last member of the enum when sanity-checking; if other * reasons are added after it, the check must be updated. */ @@ -215,7 +215,7 @@ typedef struct * #PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not. * @param text a localized message describing the disconnection * in more detail to the user. - * @see #purple_connection_error_reason + * @see #purple_connection_error * * @since 2.3.0 */ @@ -252,7 +252,7 @@ struct _PurpleConnection /** Wants to Die state. This is set when the user chooses to log out, or * when the protocol is disconnected and should not be automatically * reconnected (incorrect password, etc.). prpls should rely on - * purple_connection_error_reason() to set this for them rather than + * purple_connection_error() to set this for them rather than * setting it themselves. * @see purple_connection_error_is_fatal */ @@ -465,14 +465,14 @@ void purple_connection_notice(PurpleConnection *gc, const char *text); * @since 2.3.0 */ void -purple_connection_error_reason (PurpleConnection *gc, - PurpleConnectionError reason, - const char *description); +purple_connection_error(PurpleConnection *gc, + PurpleConnectionError reason, + const char *description); /** * Closes a connection due to an SSL error; this is basically a shortcut to * turning the #PurpleSslErrorType into a #PurpleConnectionError and a - * human-readable string and then calling purple_connection_error_reason(). + * human-readable string and then calling purple_connection_error(). * * @since 2.3.0 */ diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c index ac527c07e9..14b3f628ff 100644 --- a/libpurple/protocols/bonjour/bonjour.c +++ b/libpurple/protocols/bonjour/bonjour.c @@ -94,7 +94,7 @@ bonjour_login(PurpleAccount *account) #ifdef _WIN32 if (!dns_sd_available()) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to find Apple's \"Bonjour for Windows\" toolkit, see " "http://d.pidgin.im/BonjourWindows for more information.")); @@ -114,7 +114,7 @@ bonjour_login(PurpleAccount *account) if (bonjour_jabber_start(bd->jabber_data) == -1) { /* Send a message about the connection error */ - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to listen for incoming IM connections")); return; @@ -141,7 +141,7 @@ bonjour_login(PurpleAccount *account) bd->dns_sd_data->account = account; if (!bonjour_dns_sd_start(bd->dns_sd_data)) { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to establish connection with the local mDNS server. Is it running?")); return; diff --git a/libpurple/protocols/bonjour/mdns_win32.c b/libpurple/protocols/bonjour/mdns_win32.c index 9f1798cf43..5822a9a7be 100644 --- a/libpurple/protocols/bonjour/mdns_win32.c +++ b/libpurple/protocols/bonjour/mdns_win32.c @@ -105,7 +105,7 @@ _mdns_handle_event(gpointer data, gint source, PurpleInputCondition condition) { purple_debug_error("bonjour", "Error (%d) handling mDNS response.\n", errorCode); /* This happens when the mDNSResponder goes down, I haven't seen it happen any other time (in my limited testing) */ if (errorCode == kDNSServiceErr_Unknown) { - purple_connection_error_reason(srh->account->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(srh->account->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error communicating with local mDNSResponder.")); } } diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 96228216b9..3d08581f99 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -354,14 +354,14 @@ static void ggp_callback_register_account_ok(PurpleConnection *gc, if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("You must fill in all registration fields")); goto exit_err; } if (g_utf8_collate(p1, p2) != 0) { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Passwords do not match")); goto exit_err; @@ -371,7 +371,7 @@ static void ggp_callback_register_account_ok(PurpleConnection *gc, token->id, t); h = gg_register3(email, p1, token->id, t, 0); if (h == NULL || !(s = h->data) || !s->success) { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to register new account. An unknown error occurred.")); goto exit_err; @@ -1714,7 +1714,7 @@ static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) if (!(ev = gg_watch_fd(info->session))) { purple_debug_error("gg", "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to read from socket")); return; @@ -1880,7 +1880,7 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition if (!(ev = gg_watch_fd(info->session))) { purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to read from socket")); return; @@ -1919,7 +1919,7 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition case GG_EVENT_CONN_FAILED: purple_input_remove(gc->inpa); gc->inpa = 0; - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection failed")); break; @@ -2157,7 +2157,7 @@ static void ggp_login(PurpleAccount *account) if (addr == NULL) { gchar *tmp = g_strdup_printf(_("Unable to resolve hostname '%s': %s"), address, g_strerror(errno)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, /* should this be a settings error? */ tmp); g_free(tmp); @@ -2172,7 +2172,7 @@ static void ggp_login(PurpleAccount *account) info->session = gg_login(glp); purple_connection_update_progress(gc, _("Connecting"), 0, 2); if (info->session == NULL) { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection failed")); g_free(glp); @@ -2582,7 +2582,7 @@ static void ggp_keepalive(PurpleConnection *gc) if (gg_ping(info->session) < 0) { purple_debug_info("gg", "Not connected to the server " "or gg_session is not correct\n"); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Not connected to the server")); } diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index c55802cc1b..a5ef1d38cc 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -130,7 +130,7 @@ irc_send_cb(gpointer data, gint source, PurpleInputCondition cond) PurpleConnection *gc = purple_account_get_connection(irc->account); gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; @@ -174,7 +174,7 @@ int irc_send_len(struct irc_conn *irc, const char *buf, int buflen) PurpleConnection *gc = purple_account_get_connection(irc->account); gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); } else if (ret < buflen) { @@ -359,7 +359,7 @@ static void irc_login(PurpleAccount *account) gc->flags |= PURPLE_CONNECTION_NO_NEWLINES; if (strpbrk(username, " \t\v\r\n") != NULL) { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("IRC nick and server may not contain whitespace")); return; @@ -390,7 +390,7 @@ static void irc_login(PurpleAccount *account) purple_account_get_int(account, "port", IRC_DEFAULT_SSL_PORT), irc_login_cb_ssl, irc_ssl_connect_failure, gc); } else { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); return; @@ -403,7 +403,7 @@ static void irc_login(PurpleAccount *account) purple_account_get_int(account, "port", IRC_DEFAULT_PORT), irc_login_cb, gc) == NULL) { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); return; @@ -490,7 +490,7 @@ static void irc_login_cb(gpointer data, gint source, const gchar *error_message) if (source < 0) { gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; @@ -699,12 +699,12 @@ static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, } else if (len < 0) { gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } else if (len == 0) { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server closed the connection")); return; @@ -730,12 +730,12 @@ static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond) } else if (len < 0) { gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } else if (len == 0) { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server closed the connection")); return; diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c index 47515e2675..94d6f83daa 100644 --- a/libpurple/protocols/irc/msgs.c +++ b/libpurple/protocols/irc/msgs.c @@ -1075,7 +1075,7 @@ void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, c _("Your selected nickname was rejected by the server. It probably contains invalid characters.")); } else { - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Your selected account name was rejected by the server. It probably contains invalid characters.")); } diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/parse.c index f6687cf556..3008b42cc9 100644 --- a/libpurple/protocols/irc/parse.c +++ b/libpurple/protocols/irc/parse.c @@ -670,11 +670,11 @@ void irc_parse_msg(struct irc_conn *irc, char *input) } else if (!strncmp(input, "ERROR ", 6)) { if (g_utf8_validate(input, -1, NULL)) { char *tmp = g_strdup_printf("%s\n%s", _("Disconnected."), input); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); } else - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Disconnected.")); return; diff --git a/libpurple/protocols/jabber/auth.c b/libpurple/protocols/jabber/auth.c index dfabe4fb0d..141a91605e 100644 --- a/libpurple/protocols/jabber/auth.c +++ b/libpurple/protocols/jabber/auth.c @@ -77,7 +77,7 @@ static void allow_plaintext_auth(PurpleAccount *account) static void disallow_plaintext_auth(PurpleAccount *account) { - purple_connection_error_reason(purple_account_get_connection(account), + purple_connection_error(purple_account_get_connection(account), PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("Server requires plaintext authentication over an unencrypted stream")); } @@ -145,7 +145,7 @@ jabber_auth_start(JabberStream *js, xmlnode *packet) mechs = xmlnode_get_child(packet, "mechanisms"); if(!mechs) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server")); return; @@ -186,7 +186,7 @@ jabber_auth_start(JabberStream *js, xmlnode *packet) if (js->auth_mech == NULL) { /* Found no good mechanisms... */ - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, _("Server does not use any supported authentication method")); return; @@ -194,7 +194,7 @@ jabber_auth_start(JabberStream *js, xmlnode *packet) state = js->auth_mech->start(js, mechs, &response, &msg); if (state == JABBER_SASL_STATE_FAIL) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, msg ? msg : _("Unknown Error")); } else if (response) { @@ -231,7 +231,7 @@ static void auth_old_result_cb(JabberStream *js, const char *from, purple_account_set_password(account, NULL); } - purple_connection_error_reason(js->gc, reason, msg); + purple_connection_error(js->gc, reason, msg); g_free(msg); } } @@ -247,7 +247,7 @@ static void auth_old_cb(JabberStream *js, const char *from, if (type == JABBER_IQ_ERROR) { PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = jabber_parse_error(js, packet, &reason); - purple_connection_error_reason(js->gc, reason, msg); + purple_connection_error(js->gc, reason, msg); g_free(msg); } else if (type == JABBER_IQ_RESULT) { query = xmlnode_get_child(packet, "query"); @@ -321,7 +321,7 @@ static void auth_old_cb(JabberStream *js, const char *from, } finish_plaintext_authentication(js); } else { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, _("Server does not use any supported authentication method")); return; @@ -345,7 +345,7 @@ void jabber_auth_start_old(JabberStream *js) if (!jabber_stream_is_ssl(js) && g_str_equal("require_tls", purple_account_get_string(account, "connection_security", JABBER_DEFAULT_REQUIRE_TLS))) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("You require encryption, but it is not available on this server.")); return; @@ -394,7 +394,7 @@ jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) const char *ns = xmlnode_get_namespace(packet); if (!purple_strequal(ns, NS_XMPP_SASL)) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server")); return; @@ -405,7 +405,7 @@ jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) char *msg = NULL; JabberSaslState state = js->auth_mech->handle_challenge(js, packet, &response, &msg); if (state == JABBER_SASL_STATE_FAIL) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, msg ? msg : _("Invalid challenge from server")); } else if (response) { @@ -423,7 +423,7 @@ void jabber_auth_handle_success(JabberStream *js, xmlnode *packet) const char *ns = xmlnode_get_namespace(packet); if (!purple_strequal(ns, NS_XMPP_SASL)) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server")); return; @@ -434,12 +434,12 @@ void jabber_auth_handle_success(JabberStream *js, xmlnode *packet) JabberSaslState state = js->auth_mech->handle_success(js, packet, &msg); if (state == JABBER_SASL_STATE_FAIL) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, msg ? msg : _("Invalid response from server")); return; } else if (state == JABBER_SASL_STATE_CONTINUE) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, msg ? msg : _("Server thinks authentication is complete, but client does not")); return; @@ -479,11 +479,11 @@ void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet) msg = jabber_parse_error(js, packet, &reason); if (!msg) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server")); } else { - purple_connection_error_reason(js->gc, reason, msg); + purple_connection_error(js->gc, reason, msg); g_free(msg); } } diff --git a/libpurple/protocols/jabber/auth_cyrus.c b/libpurple/protocols/jabber/auth_cyrus.c index 0f9e5cae32..26a4cfdb32 100644 --- a/libpurple/protocols/jabber/auth_cyrus.c +++ b/libpurple/protocols/jabber/auth_cyrus.c @@ -34,7 +34,7 @@ static void jabber_sasl_build_callbacks(JabberStream *); static void disallow_plaintext_auth(PurpleAccount *account) { - purple_connection_error_reason(purple_account_get_connection(account), + purple_connection_error(purple_account_get_connection(account), PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("Server may require plaintext authentication over an unencrypted stream")); } @@ -46,7 +46,7 @@ static void start_cyrus_wrapper(JabberStream *js) JabberSaslState state = jabber_auth_start_cyrus(js, &response, &error); if (state == JABBER_SASL_STATE_FAIL) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, error); g_free(error); diff --git a/libpurple/protocols/jabber/auth_plain.c b/libpurple/protocols/jabber/auth_plain.c index 402b0c285a..a609237bbf 100644 --- a/libpurple/protocols/jabber/auth_plain.c +++ b/libpurple/protocols/jabber/auth_plain.c @@ -75,7 +75,7 @@ static void allow_plaintext_auth(PurpleAccount *account) static void disallow_plaintext_auth(PurpleAccount *account) { - purple_connection_error_reason(purple_account_get_connection(account), + purple_connection_error(purple_account_get_connection(account), PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("Server requires plaintext authentication over an unencrypted stream")); } diff --git a/libpurple/protocols/jabber/bosh.c b/libpurple/protocols/jabber/bosh.c index 2e6acce664..aa568b9096 100644 --- a/libpurple/protocols/jabber/bosh.c +++ b/libpurple/protocols/jabber/bosh.c @@ -436,7 +436,7 @@ static gboolean jabber_bosh_connection_error_check(PurpleBOSHConnection *conn, x if (type != NULL && !strcmp(type, "terminate")) { conn->state = BOSH_CONN_OFFLINE; - purple_connection_error_reason(conn->js->gc, + purple_connection_error(conn->js->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("The BOSH connection manager terminated your session.")); return TRUE; @@ -539,7 +539,7 @@ static void boot_response_cb(PurpleBOSHConnection *conn, xmlnode *node) { if (sid) { conn->sid = g_strdup(sid); } else { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("No session ID given")); return; @@ -556,7 +556,7 @@ static void boot_response_cb(PurpleBOSHConnection *conn, xmlnode *node) { minor = atoi(dot + 1); if (major != 1 || minor < 6) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unsupported version of BOSH protocol")); return; @@ -733,7 +733,7 @@ static void http_connection_disconnected(PurpleHTTPConnection *conn) return; if (++conn->bosh->failed_connections == MAX_FAILED_CONNECTIONS) { - purple_connection_error_reason(conn->bosh->js->gc, + purple_connection_error(conn->bosh->js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to establish a connection with the server")); } else { @@ -939,7 +939,7 @@ connection_established_cb(gpointer data, gint source, const gchar *error) gchar *tmp; tmp = g_strdup_printf(_("Unable to establish a connection with the server: %s"), error); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } @@ -965,18 +965,18 @@ static void http_connection_connect(PurpleHTTPConnection *conn) ssl_connection_error_cb, conn); if (!conn->psc) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("Unable to establish SSL connection")); } } else { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); } } else if (purple_proxy_connect(conn, account, bosh->host, bosh->port, connection_established_cb, conn) == NULL) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } @@ -1023,7 +1023,7 @@ http_connection_send_cb(gpointer data, gint source, PurpleInputCondition cond) */ gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(conn->bosh->js->gc, + purple_connection_error(conn->bosh->js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); @@ -1079,7 +1079,7 @@ http_connection_send_request(PurpleHTTPConnection *conn, const GString *req) */ gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(conn->bosh->js->gc, + purple_connection_error(conn->bosh->js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 7c5135f1a7..2c7b229c6f 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -119,7 +119,7 @@ jabber_session_initialized_cb(JabberStream *js, const char *from, if(js->unregistration) jabber_unregister_account_cb(js); } else { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, ("Error initializing session")); } @@ -153,7 +153,7 @@ static void jabber_bind_result_cb(JabberStream *js, const char *from, js->user = jabber_id_new(full_jid); if (js->user == NULL) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server")); g_free(full_jid); @@ -170,7 +170,7 @@ static void jabber_bind_result_cb(JabberStream *js, const char *from, } else { PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = jabber_parse_error(js, packet, &reason); - purple_connection_error_reason(js->gc, reason, msg); + purple_connection_error(js->gc, reason, msg); g_free(msg); return; @@ -247,14 +247,14 @@ jabber_process_starttls(JabberStream *js, xmlnode *packet) starttls = xmlnode_get_child(packet, "starttls"); if(xmlnode_get_child(starttls, "required")) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("Server requires TLS/SSL, but no TLS/SSL support was found.")); return TRUE; } if (g_str_equal("require_tls", purple_account_get_string(account, "connection_security", JABBER_DEFAULT_REQUIRE_TLS))) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("You require encryption, but no TLS/SSL support was found.")); return TRUE; @@ -275,7 +275,7 @@ void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) return; } } else if (g_str_equal(connection_security, "require_tls") && !jabber_stream_is_ssl(js)) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("You require encryption, but it is not available on this server.")); return; @@ -320,7 +320,7 @@ static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet) PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = jabber_parse_error(js, packet, &reason); - purple_connection_error_reason(js->gc, reason, msg); + purple_connection_error(js->gc, reason, msg); g_free(msg); } @@ -407,7 +407,7 @@ static void jabber_send_cb(gpointer data, gint source, PurpleInputCondition cond else if (ret <= 0) { gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; @@ -443,7 +443,7 @@ static gboolean do_jabber_send_raw(JabberStream *js, const char *data, int len) if (!account->disconnecting) { gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); } @@ -544,7 +544,7 @@ void jabber_send_raw(JabberStream *js, const char *data, int len) purple_debug_error("jabber", "sasl_encode error %d: %s\n", rc, sasl_errdetail(js->sasl)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error); g_free(error); @@ -617,7 +617,7 @@ void jabber_send(JabberStream *js, xmlnode *packet) static gboolean jabber_keepalive_timeout(PurpleConnection *gc) { JabberStream *js = gc->proto_data; - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Ping timed out")); js->keepalive_timeout = 0; return FALSE; @@ -670,7 +670,7 @@ jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, else tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); } @@ -702,7 +702,7 @@ jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition) purple_debug_error("jabber", "sasl_decode_error %d: %s\n", rc, sasl_errdetail(js->sasl)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error); } else if (olen > 0) { @@ -728,7 +728,7 @@ jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition) else tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); } @@ -789,7 +789,7 @@ txt_resolved_cb(GList *responses, gpointer data) if (!found) { purple_debug_warning("jabber", "Unable to find alternative XMPP connection " "methods after failing to connect directly.\n"); - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); return; @@ -874,7 +874,7 @@ static gboolean jabber_login_connect(JabberStream *js, const char *domain, const if (purple_proxy_connect(js->gc, purple_connection_get_account(js->gc), host, port, jabber_login_callback, js->gc) == NULL) { if (fatal_failure) { - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } @@ -940,7 +940,7 @@ jabber_stream_new(PurpleAccount *account) js->user = jabber_id_new(user); if (!js->user) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Invalid XMPP ID")); g_free(user); @@ -949,7 +949,7 @@ jabber_stream_new(PurpleAccount *account) } if (!js->user->node || *(js->user->node) == '\0') { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Invalid XMPP ID. Username portion must be set.")); g_free(user); @@ -958,7 +958,7 @@ jabber_stream_new(PurpleAccount *account) } if (!js->user->domain || *(js->user->domain) == '\0') { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Invalid XMPP ID. Domain must be set.")); g_free(user); @@ -978,7 +978,7 @@ jabber_stream_new(PurpleAccount *account) g_free(user); if (!js->user_jb) { /* This basically *can't* fail, but for good measure... */ - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Invalid XMPP ID")); /* Destroying the connection will free the JabberStream */ @@ -1037,7 +1037,7 @@ jabber_stream_connect(JabberStream *js) if (js->bosh) jabber_bosh_connection_connect(js->bosh); else { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Malformed BOSH URL")); } @@ -1054,12 +1054,12 @@ jabber_stream_connect(JabberStream *js) purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); if (!js->gsc) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("Unable to establish SSL connection")); } } else { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); } diff --git a/libpurple/protocols/jabber/parser.c b/libpurple/protocols/jabber/parser.c index 5e3aa950ef..d407c634fc 100644 --- a/libpurple/protocols/jabber/parser.c +++ b/libpurple/protocols/jabber/parser.c @@ -52,7 +52,7 @@ jabber_parser_element_start_libxml(void *user_data, */ purple_debug_error("jabber", "Expecting stream header, got %s with " "xmlns %s\n", element_name, namespace); - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, _("XMPP stream header missing")); return; @@ -73,7 +73,7 @@ jabber_parser_element_start_libxml(void *user_data, if (js->protocol_version.major > 1) { /* TODO: Send error */ - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, _("XMPP Version Mismatch")); g_free(attrib); @@ -98,7 +98,7 @@ jabber_parser_element_start_libxml(void *user_data, /* This was underspecified in rfc3920 as only being a SHOULD, so * we cannot rely on it. See #12331 and Oracle's server. */ - purple_connection_error_reason(js->gc, + purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, _("XMPP stream missing ID")); #else @@ -300,7 +300,7 @@ void jabber_parser_process(JabberStream *js, const char *buf, int len) break; case XML_ERR_FATAL: purple_debug_error("jabber", "xmlParseChunk returned fatal %i\n", ret); - purple_connection_error_reason (js->gc, + purple_connection_error (js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("XML Parse error")); break; diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index a7aa58867d..7515889b9e 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -1333,7 +1333,7 @@ msn_login(PurpleAccount *account) if (!purple_ssl_is_supported()) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support is needed for MSN. Please install a supported " "SSL library.")); @@ -1374,7 +1374,7 @@ msn_login(PurpleAccount *account) } if (!msn_session_connect(session, host, port, http_method)) - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } diff --git a/libpurple/protocols/msn/session.c b/libpurple/protocols/msn/session.c index 5466b8f660..ff871648ec 100644 --- a/libpurple/protocols/msn/session.c +++ b/libpurple/protocols/msn/session.c @@ -420,7 +420,7 @@ msn_session_set_error(MsnSession *session, MsnErrorType error, msn_session_disconnect(session); - purple_connection_error_reason(gc, reason, msg); + purple_connection_error(gc, reason, msg); g_free(msg); } diff --git a/libpurple/protocols/mxit/http.c b/libpurple/protocols/mxit/http.c index ebe2d67865..447248d9e6 100644 --- a/libpurple/protocols/mxit/http.c +++ b/libpurple/protocols/mxit/http.c @@ -273,7 +273,7 @@ static void mxit_cb_http_connect( gpointer user_data, gint source, const gchar* /* source is the file descriptor of the new connection */ if ( source < 0 ) { purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_http_connect failed: %s\n", error_message ); - purple_connection_error_reason( req->session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit HTTP server. Please check your server settings." ) ); + purple_connection_error( req->session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit HTTP server. Please check your server settings." ) ); return; } diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index 22c86218b8..ab042052e0 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -165,7 +165,7 @@ static void mxit_cb_connect( gpointer user_data, gint source, const gchar* error /* source is the file descriptor of the new connection */ if ( source < 0 ) { purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_connect failed: %s\n", error_message ); - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit server. Please check your server settings." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit server. Please check your server settings." ) ); return; } @@ -202,7 +202,7 @@ static void mxit_login_connect( struct MXitSession* session ) /* socket connection */ data = purple_proxy_connect( session->con, session->acc, session->server, session->port, mxit_cb_connect, session ); if ( !data ) { - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit server. Please check your server settings." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit server. Please check your server settings." ) ); return; } } @@ -391,7 +391,7 @@ static void mxit_cb_clientinfo2( PurpleUtilFetchUrlData* url_data, gpointer user if ( !url_text ) { /* no reply from the WAP site */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Error contacting the MXit WAP site. Please try again later." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Error contacting the MXit WAP site. Please try again later." ) ); return; } @@ -400,7 +400,7 @@ static void mxit_cb_clientinfo2( PurpleUtilFetchUrlData* url_data, gpointer user if ( !parts ) { /* wapserver error */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "MXit is currently unable to process the request. Please try again later." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "MXit is currently unable to process the request. Please try again later." ) ); return; } @@ -410,26 +410,26 @@ static void mxit_cb_clientinfo2( PurpleUtilFetchUrlData* url_data, gpointer user /* valid reply! */ break; case '1' : - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Wrong security code entered. Please try again later." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Wrong security code entered. Please try again later." ) ); return; case '2' : - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Your session has expired. Please try again later." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Your session has expired. Please try again later." ) ); return; case '5' : - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Invalid country selected. Please try again." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Invalid country selected. Please try again." ) ); return; case '6' : - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "The MXit ID you entered is not registered. Please register first." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "The MXit ID you entered is not registered. Please register first." ) ); return; case '7' : - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "The MXit ID you entered is already registered. Please choose another." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "The MXit ID you entered is already registered. Please choose another." ) ); /* this user's account already exists, so we need to change the registration login flag to be login */ purple_account_set_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); return; case '3' : case '4' : default : - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Internal error. Please try again later." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Internal error. Please try again later." ) ); return; } @@ -611,7 +611,7 @@ static void mxit_cb_clientinfo1( PurpleUtilFetchUrlData* url_data, gpointer user if ( !url_text ) { /* no reply from the WAP site */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Error contacting the MXit WAP site. Please try again later." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Error contacting the MXit WAP site. Please try again later." ) ); return; } @@ -620,7 +620,7 @@ static void mxit_cb_clientinfo1( PurpleUtilFetchUrlData* url_data, gpointer user if ( ( !parts ) || ( parts[0][0] != '0' ) ) { /* server could not find the user */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "MXit is currently unable to process the request. Please try again later." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "MXit is currently unable to process the request. Please try again later." ) ); return; } diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index b47b824d89..638f01520f 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -408,7 +408,7 @@ static void mxit_send_packet( struct MXitSession* session, struct tx_packet* pac res = mxit_write_sock_packet( session->fd, data, datalen ); if ( res < 0 ) { /* we must have lost the connection, so terminate it so that we can reconnect */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "We have lost the connection to MXit. Please reconnect." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "We have lost the connection to MXit. Please reconnect." ) ); } } else { @@ -530,7 +530,7 @@ static void mxit_manage_queue( struct MXitSession* session ) if ( session->last_tx <= mxit_now_milli() - ( MXIT_ACK_TIMEOUT * 1000 ) ) { /* ack timeout! so we close the connection here */ purple_debug_info( MXIT_PLUGIN_ID, "mxit_manage_queue: Timeout awaiting ACK for command '%i'\n", session->outack ); - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Timeout while waiting for a response from the MXit server." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Timeout while waiting for a response from the MXit server." ) ); } return; } @@ -2192,7 +2192,7 @@ static void mxit_perform_redirect( struct MXitSession* session, const char* url session->port = atoi( host[2] ); } else { - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Cannot perform redirect using the specified protocol" ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Cannot perform redirect using the specified protocol" ) ); goto redirect_fail; } @@ -2361,7 +2361,7 @@ static int process_error_response( struct MXitSession* session, struct rx_packet if ( packet->errcode == MXIT_ERRCODE_LOGGEDOUT ) { /* we are not currently logged in, so we need to reconnect */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( errdesc ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( errdesc ) ); } /* packet command */ @@ -2375,12 +2375,12 @@ static int process_error_response( struct MXitSession* session, struct rx_packet } else { snprintf( errmsg, sizeof( errmsg ), _( "Login error: %s (%i)" ), errdesc, packet->errcode ); - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, errmsg ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, errmsg ); return -1; } case CP_CMD_LOGOUT : snprintf( errmsg, sizeof( errmsg ), _( "Logout error: %s (%i)" ), errdesc, packet->errcode ); - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _( errmsg ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _( errmsg ) ); return -1; case CP_CMD_CONTACT : mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Contact Error" ), _( errdesc ) ); @@ -2643,7 +2643,7 @@ int mxit_parse_packet( struct MXitSession* session ) if ( packet.rcount < 2 ) { /* bad packet */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Invalid packet received from MXit." ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Invalid packet received from MXit." ) ); free_rx_packet( &packet ); continue; } @@ -2708,12 +2708,12 @@ void mxit_cb_rx( gpointer user_data, gint source, PurpleInputCondition cond ) len = read( session->fd, &ch, 1 ); if ( len < 0 ) { /* connection error */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x01)" ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x01)" ) ); return; } else if ( len == 0 ) { /* connection closed */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x02)" ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x02)" ) ); return; } else { @@ -2723,7 +2723,7 @@ void mxit_cb_rx( gpointer user_data, gint source, PurpleInputCondition cond ) session->rx_lbuf[session->rx_i] = '\0'; session->rx_res = atoi( &session->rx_lbuf[3] ); if ( session->rx_res > CP_MAX_PACKET ) { - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x03)" ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x03)" ) ); } session->rx_state = RX_STATE_DATA; session->rx_i = 0; @@ -2734,7 +2734,7 @@ void mxit_cb_rx( gpointer user_data, gint source, PurpleInputCondition cond ) session->rx_i++; if ( session->rx_i >= sizeof( session->rx_lbuf ) ) { /* malformed packet length record (too long) */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x04)" ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x04)" ) ); return; } } @@ -2745,12 +2745,12 @@ void mxit_cb_rx( gpointer user_data, gint source, PurpleInputCondition cond ) len = read( session->fd, &session->rx_dbuf[session->rx_i], session->rx_res ); if ( len < 0 ) { /* connection error */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x05)" ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x05)" ) ); return; } else if ( len == 0 ) { /* connection closed */ - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x06)" ) ); + purple_connection_error( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x06)" ) ); return; } else { diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index 9cc52f5df4..57cadab49c 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -698,7 +698,7 @@ msim_login_challenge(MsimSession *session, MsimMessage *msg) if (nc_len != MSIM_AUTH_CHALLENGE_LENGTH) { purple_debug_info("msim", "bad nc length: %" G_GSIZE_MODIFIER "x != 0x%x\n", nc_len, MSIM_AUTH_CHALLENGE_LENGTH); - purple_connection_error_reason (session->gc, + purple_connection_error (session->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unexpected challenge length from server")); return FALSE; @@ -835,7 +835,7 @@ msim_check_alive(gpointer data) purple_debug_info("msim", "msim_check_alive: %zu > interval of %d, presumed dead\n", delta, MSIM_KEEPALIVE_INTERVAL); - purple_connection_error_reason(session->gc, + purple_connection_error(session->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Lost connection with server")); @@ -1866,7 +1866,7 @@ msim_error(MsimSession *session, MsimMessage *msg) purple_account_set_password(session->account, NULL); break; } - purple_connection_error_reason(session->gc, reason, full_errmsg); + purple_connection_error(session->gc, reason, full_errmsg); } else { purple_notify_error(session->account, _("MySpaceIM Error"), full_errmsg, NULL); } @@ -2027,7 +2027,7 @@ msim_input_cb(gpointer gc_uncasted, gint source, PurpleInputCondition cond) /* libpurple/eventloop.h only defines these two */ if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) { purple_debug_info("msim_input_cb", "unknown condition=%d\n", cond); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid input condition")); return; @@ -2069,12 +2069,12 @@ msim_input_cb(gpointer gc_uncasted, gint source, PurpleInputCondition cond) tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } else if (n == 0) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server closed the connection")); return; @@ -2092,7 +2092,7 @@ msim_input_cb(gpointer gc_uncasted, gint source, PurpleInputCondition cond) purple_debug_info("msim", "msim_input_cb: strlen=%d, but read %d bytes" "--null byte encountered?\n", strlen(session->rxbuf + session->rxoff), n); - /*purple_connection_error_reason (gc, + /*purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Invalid message - null byte on input"); */ return; @@ -2117,7 +2117,7 @@ msim_input_cb(gpointer gc_uncasted, gint source, PurpleInputCondition cond) msg = msim_parse(session->rxbuf); if (!msg) { purple_debug_info("msim", "msim_input_cb: couldn't parse rxbuf\n"); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to parse message")); break; @@ -2162,7 +2162,7 @@ msim_connect_cb(gpointer data, gint source, const gchar *error_message) if (source < 0) { gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; @@ -2219,7 +2219,7 @@ msim_login(PurpleAccount *acct) if (!purple_proxy_connect(gc, acct, host, port, msim_connect_cb, gc)) { /* TODO: try other ports if in auto mode, then save * working port and try that first next time. */ - purple_connection_error_reason (gc, + purple_connection_error (gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); return; diff --git a/libpurple/protocols/myspace/user.c b/libpurple/protocols/myspace/user.c index 738045043a..fa7edb4140 100644 --- a/libpurple/protocols/myspace/user.c +++ b/libpurple/protocols/myspace/user.c @@ -636,7 +636,7 @@ static void msim_username_is_set_cb(MsimSession *session, const MsimMessage *use if (!body) { purple_debug_info("msim_username_is_set_cb", "No body"); /* Error: No body! */ - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); + purple_connection_error(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); } username = msim_msg_get_string(body, "UserName"); code = msim_msg_get_integer(body,"Code"); @@ -678,13 +678,13 @@ static void msim_username_is_set_cb(MsimSession *session, const MsimMessage *use NULL)) { /* Error! */ /* Can't set... Disconnect */ - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); + purple_connection_error(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); } } else { /* Error! */ purple_debug_info("msim","username_is_set Error: Invalid cmd/dsn/lid combination"); - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); + purple_connection_error(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); } } @@ -782,7 +782,7 @@ static void msim_username_is_available_cb(MsimSession *session, const MsimMessag if (!body) { purple_debug_info("msim_username_is_available_cb", "No body for %s?!\n", username); - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("An error occurred while trying to set the username. " "Please try again, or visit http://editprofile.myspace.com/index.cfm?" "fuseaction=profile.username to set your username.")); @@ -867,7 +867,7 @@ void msim_do_not_set_username_cb(PurpleConnection *gc) purple_debug_info("msim", "Don't set username"); /* Protocol won't log in now without a username set.. Disconnect */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("No username set")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("No username set")); } /** diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index 8413e2470f..682fcb7529 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -140,7 +140,7 @@ _login_resp_cb(NMUser * user, NMERR_T ret_code, reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; } - purple_connection_error_reason(gc, reason, err); + purple_connection_error(gc, reason, err); g_free(err); } } @@ -1126,7 +1126,7 @@ _check_for_disconnect(NMUser * user, NMERR_T err) if (_is_disconnect_error(err)) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error communicating with server. Closing connection.")); return TRUE; @@ -1702,7 +1702,7 @@ novell_ssl_recv_cb(gpointer data, PurpleSslConnection * gsc, if (_is_disconnect_error(rc)) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error communicating with server. Closing connection.")); } else { @@ -1743,7 +1743,7 @@ novell_ssl_connected_cb(gpointer data, PurpleSslConnection * gsc, conn->connected = TRUE; purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc); } else { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } @@ -2028,7 +2028,7 @@ _evt_user_disconnect(NMUser * user, NMEvent * event) { if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _("You have signed on from another location")); } @@ -2184,7 +2184,7 @@ novell_login(PurpleAccount * account) */ /* ...but for now just error out with a nice message. */ - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Unable to connect to server. Please enter the " "address of the server to which you wish to connect.")); @@ -2213,7 +2213,7 @@ novell_login(PurpleAccount * account) user->conn->addr, user->conn->port, novell_ssl_connected_cb, novell_ssl_connect_error, gc); if (user->conn->ssl_conn->data == NULL) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); } diff --git a/libpurple/protocols/oscar/clientlogin.c b/libpurple/protocols/oscar/clientlogin.c index 77fb481e04..a4ea3995ff 100644 --- a/libpurple/protocols/oscar/clientlogin.c +++ b/libpurple/protocols/oscar/clientlogin.c @@ -182,7 +182,7 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g /* Note to translators: %s in this string is a URL */ msg = generate_error_message(response_node, get_start_oscar_session_url(od)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); return FALSE; @@ -204,7 +204,7 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g "missing statusCode: %s\n", response); msg = generate_error_message(response_node, get_start_oscar_session_url(od)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); xmlnode_free(response_node); @@ -232,7 +232,7 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g "was %s: %s\n", tmp, response); if ((code == 401 && status_detail != 1014) || code == 607) - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("You have been connecting and disconnecting too " "frequently. Wait ten minutes and try again. If " @@ -242,7 +242,7 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g char *msg; msg = generate_error_message(response_node, get_start_oscar_session_url(od)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, msg); g_free(msg); } @@ -261,7 +261,7 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g "something: %s\n", response); msg = generate_error_message(response_node, get_start_oscar_session_url(od)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); xmlnode_free(response_node); @@ -277,7 +277,7 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g purple_debug_warning("oscar", "We haven't received a tlsCertName to use. We will not do SSL to BOS.\n"); } else { purple_debug_error("oscar", "startOSCARSession was missing tlsCertName: %s\n", response); - purple_connection_error_reason( + purple_connection_error( gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("You required encryption in your account settings, but one of the servers doesn't support it.")); @@ -299,7 +299,7 @@ static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const g "something: %s\n", response); msg = generate_error_message(response_node, get_start_oscar_session_url(od)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); g_free(*host); @@ -337,7 +337,7 @@ static void start_oscar_session_cb(PurpleUtilFetchUrlData *url_data, gpointer us tmp = g_strdup_printf(_("Error requesting %s: %s"), get_start_oscar_session_url(od), error_message ? error_message : _("The server returned an empty response")); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; @@ -395,7 +395,7 @@ static void send_start_oscar_session(OscarData *od, const char *token, const cha * and extracts the useful information. * * @param gc The PurpleConnection. If the response data does - * not indicate then purple_connection_error_reason() + * not indicate then purple_connection_error() * will be called to close this connection. * @param response The response data from the clientLogin request. * @param response_len The length of the above response, or -1 if @@ -431,7 +431,7 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r "response as XML: %s\n", response); msg = generate_error_message(response_node, get_client_login_url(od)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); return FALSE; @@ -455,7 +455,7 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r "missing statusCode: %s\n", response); msg = generate_error_message(response_node, get_client_login_url(od)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); xmlnode_free(response_node); @@ -482,23 +482,23 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r PurpleAccount *account = purple_connection_get_account(gc); if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password")); } else if (status_code == 330 && status_detail_code == 3015) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Server requested that you fill out a CAPTCHA in order to " "sign in, but this client does not currently support CAPTCHAs.")); } else if (status_code == 401 && status_detail_code == 3019) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("AOL does not allow your screen name to authenticate here")); } else { char *msg; msg = generate_error_message(response_node, get_client_login_url(od)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, msg); g_free(msg); } @@ -517,7 +517,7 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r "something: %s\n", response); msg = generate_error_message(response_node, get_client_login_url(od)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); xmlnode_free(response_node); @@ -535,7 +535,7 @@ static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *r "something: %s\n", response); msg = generate_error_message(response_node, get_client_login_url(od)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); g_free(*token); @@ -572,7 +572,7 @@ static void client_login_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data tmp = g_strdup_printf(_("Error requesting %s: %s"), get_client_login_url(od), error_message ? error_message : _("The server returned an empty response")); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; diff --git a/libpurple/protocols/oscar/flap_connection.c b/libpurple/protocols/oscar/flap_connection.c index 3aa62973d2..c28a20f28c 100644 --- a/libpurple/protocols/oscar/flap_connection.c +++ b/libpurple/protocols/oscar/flap_connection.c @@ -487,7 +487,7 @@ flap_connection_destroy_cb(gpointer data) if (tmp != NULL) { - purple_connection_error_reason(od->gc, reason, tmp); + purple_connection_error(od->gc, reason, tmp); g_free(tmp); } } diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 104524eaf9..4fe8d64454 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -308,7 +308,7 @@ connection_common_error_cb(FlapConnection *conn, const gchar *error_message) gchar *msg; msg = g_strdup_printf(_("Unable to connect to authentication server: %s"), error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); } else if (conn->type == SNAC_FAMILY_LOCATE) @@ -316,7 +316,7 @@ connection_common_error_cb(FlapConnection *conn, const gchar *error_message) gchar *msg; msg = g_strdup_printf(_("Unable to connect to BOS server: %s"), error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); } else @@ -735,7 +735,7 @@ oscar_login(PurpleAccount *account) if (!oscar_util_valid_name(purple_account_get_username(account))) { gchar *buf; buf = g_strdup_printf(_("Unable to sign on as %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, buf); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, buf); g_free(buf); return; } @@ -756,7 +756,7 @@ oscar_login(PurpleAccount *account) encryption_type = purple_account_get_string(account, "encryption", OSCAR_DEFAULT_ENCRYPTION); if (!purple_ssl_is_supported() && strcmp(encryption_type, OSCAR_REQUIRE_ENCRYPTION) == 0) { - purple_connection_error_reason( + purple_connection_error( gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("You required encryption in your account settings, but encryption is not supported by your system.")); @@ -825,7 +825,7 @@ oscar_login(PurpleAccount *account) } if (newconn->gsc == NULL && newconn->connect_data == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); return; } @@ -1048,7 +1048,7 @@ int oscar_connect_to_bos(PurpleConnection *gc, OscarData *od, const char *host, if (conn->gsc == NULL && conn->connect_data == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); return 0; } @@ -1087,41 +1087,41 @@ purple_parse_auth_resp(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) switch (info->errorcode) { case 0x01: /* Unregistered username */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_INVALID_USERNAME, _("Username does not exist")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_USERNAME, _("Username does not exist")); break; case 0x05: /* Incorrect password */ if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password")); break; case 0x11: /* Suspended account */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Your account is currently suspended")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Your account is currently suspended")); break; case 0x02: case 0x14: /* service temporarily unavailable */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("The AOL Instant Messenger service is temporarily unavailable.")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("The AOL Instant Messenger service is temporarily unavailable.")); break; case 0x18: /* username connecting too frequently */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Your username has been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Your username has been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); break; case 0x1c: { /* client too old */ g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), oscar_get_ui_info_string("website", PURPLE_WEBSITE)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, buf); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, buf); break; } case 0x1d: /* IP address connecting too frequently */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Your IP address has been connecting and disconnecting too frequently. Wait a minute and try again. If you continue to try, you will need to wait even longer.")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Your IP address has been connecting and disconnecting too frequently. Wait a minute and try again. If you continue to try, you will need to wait even longer.")); break; default: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Unknown reason")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Unknown reason")); break; } purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode); @@ -1169,7 +1169,7 @@ purple_parse_auth_resp(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) g_free(host); if (newconn->gsc == NULL && newconn->connect_data == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); return 0; } @@ -1199,7 +1199,7 @@ purple_parse_auth_securid_request_no_cb(gpointer user_data, const char *value) PurpleConnection *gc = user_data; /* Disconnect */ - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("The SecurID key entered is invalid")); } @@ -1292,7 +1292,7 @@ purple_handle_redirect(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) purple_debug_warning("oscar", "We won't use SSL for FLAP type 0x%04hx.\n", redir->group); } else if (strcmp(encryption_type, OSCAR_REQUIRE_ENCRYPTION) == 0) { purple_debug_error("oscar", "FLAP server %s:%d of type 0x%04hx doesn't support encryption.", host, port, redir->group); - purple_connection_error_reason( + purple_connection_error( gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("You required encryption in your account settings, but one of the servers doesn't support it.")); diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 8c8685fe40..48ace57ca1 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -413,7 +413,7 @@ static int mw_session_io_write(struct mwSession *session, g_strerror(errno)); DEBUG_ERROR("write returned %" G_GSSIZE_FORMAT ", %" G_GSIZE_FORMAT " bytes left unwritten\n", ret, len); - purple_connection_error_reason(pd->gc, + purple_connection_error(pd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); @@ -1613,7 +1613,7 @@ static void mw_session_stateChange(struct mwSession *session, default: reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; } - purple_connection_error_reason(gc, reason, err); + purple_connection_error(gc, reason, err); g_free(err); } break; @@ -1762,7 +1762,7 @@ static void read_cb(gpointer data, gint source, PurpleInputCondition cond) { if(! ret) { DEBUG_INFO("connection reset\n"); - purple_connection_error_reason(pd->gc, + purple_connection_error(pd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server closed the connection")); @@ -1773,7 +1773,7 @@ static void read_cb(gpointer data, gint source, PurpleInputCondition cond) { DEBUG_INFO("error in read callback: %s\n", err_str); msg = g_strdup_printf(_("Lost connection with server: %s"), err_str); - purple_connection_error_reason(pd->gc, + purple_connection_error(pd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); @@ -1799,7 +1799,7 @@ static void connect_cb(gpointer data, gint source, const gchar *error_message) { /* this is a regular connect, error out */ gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason(pd->gc, + purple_connection_error(pd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); @@ -3691,7 +3691,7 @@ static void mw_prpl_login(PurpleAccount *acct); static void prompt_host_cancel_cb(PurpleConnection *gc) { const char *msg = _("No Sametime Community Server specified"); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, msg); } @@ -3806,7 +3806,7 @@ static void mw_prpl_login(PurpleAccount *account) { purple_connection_update_progress(gc, _("Connecting"), 1, MW_CONNECT_STEPS); if (purple_proxy_connect(gc, account, host, port, connect_cb, pd) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } } diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c index fac1fde0e5..2ff01fef1b 100644 --- a/libpurple/protocols/silc/ops.c +++ b/libpurple/protocols/silc/ops.c @@ -72,7 +72,7 @@ void silc_say(SilcClient client, SilcClientConnection conn, gc = client->application; if (gc != NULL) - purple_connection_error_reason(gc, reason, tmp); + purple_connection_error(gc, reason, tmp); else purple_notify_error(NULL, _("Error"), _("Error occurred"), tmp); } diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index ae30ee9d81..525b24dbf8 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -316,7 +316,7 @@ silcpurple_connect_cb(SilcClient client, SilcClientConnection conn, /* Close the connection */ if (!sg->detaching) - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Disconnected by server")); else @@ -325,30 +325,30 @@ silcpurple_connect_cb(SilcClient client, SilcClientConnection conn, break; case SILC_CLIENT_CONN_ERROR: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error connecting to SILC Server")); g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); break; case SILC_CLIENT_CONN_ERROR_KE: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("Key Exchange failed")); break; case SILC_CLIENT_CONN_ERROR_AUTH: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Authentication failed")); break; case SILC_CLIENT_CONN_ERROR_RESUME: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Resuming detached session failed. " "Press Reconnect to create new connection.")); g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); break; case SILC_CLIENT_CONN_ERROR_TIMEOUT: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection timed out")); break; } @@ -370,7 +370,7 @@ silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream, sg = gc->proto_data; if (status != SILC_SOCKET_OK) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection failed")); silc_pkcs_public_key_free(sg->public_key); @@ -418,7 +418,7 @@ silcpurple_login_connected(gpointer data, gint source, const gchar *error_messag sg = gc->proto_data; if (source < 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection failed")); silc_pkcs_public_key_free(sg->public_key); silc_pkcs_private_key_free(sg->private_key); @@ -447,7 +447,7 @@ static void silcpurple_continue_running(SilcPurple sg) purple_account_get_int(account, "port", 706), silcpurple_login_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); gc->proto_data = NULL; silc_free(sg); @@ -490,7 +490,7 @@ static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields (char *)purple_account_get_string(account, "private-key", prd), password, &sg->public_key, &sg->private_key)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); gc->proto_data = NULL; silc_free(sg); @@ -506,7 +506,7 @@ static void silcpurple_no_password_cb(PurpleConnection *gc, PurpleRequestFields if (!PURPLE_CONNECTION_IS_VALID(gc)) return; sg = gc->proto_data; - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); gc->proto_data = NULL; silc_free(sg); @@ -535,7 +535,7 @@ static void silcpurple_running(SilcClient client, void *context) G_CALLBACK(silcpurple_no_password_cb), gc); return; } - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); gc->proto_data = NULL; silc_free(sg); @@ -566,7 +566,7 @@ silcpurple_login(PurpleAccount *account) /* Allocate SILC client */ client = silc_client_alloc(&ops, ¶ms, gc, NULL); if (!client) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Out of memory")); return; } @@ -617,7 +617,7 @@ silcpurple_login(PurpleAccount *account) /* Init SILC client */ if (!silc_client_init(client, username, hostname, realname, silcpurple_running, sg)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to initialize SILC protocol")); gc->proto_data = NULL; silc_free(sg); @@ -630,7 +630,7 @@ silcpurple_login(PurpleAccount *account) /* Check the ~/.silc dir and create it, and new key pair if necessary. */ if (!silcpurple_check_silc_dir(gc)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Error loading SILC key pair")); gc->proto_data = NULL; silc_free(sg); diff --git a/libpurple/protocols/silc/util.c b/libpurple/protocols/silc/util.c index 68eac3275a..5436e1490b 100644 --- a/libpurple/protocols/silc/util.c +++ b/libpurple/protocols/silc/util.c @@ -213,7 +213,7 @@ gboolean silcpurple_check_silc_dir(PurpleConnection *gc) (gc->password == NULL) ? "" : gc->password, NULL, NULL, FALSE)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to create SILC key pair")); return FALSE; } @@ -256,7 +256,7 @@ gboolean silcpurple_check_silc_dir(PurpleConnection *gc) (gc->password == NULL) ? "" : gc->password, NULL, NULL, FALSE)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to create SILC key pair")); return FALSE; } diff --git a/libpurple/protocols/silc10/ops.c b/libpurple/protocols/silc10/ops.c index 6095c49b18..0317c95fbf 100644 --- a/libpurple/protocols/silc10/ops.c +++ b/libpurple/protocols/silc10/ops.c @@ -1697,31 +1697,31 @@ silc_connected(SilcClient client, SilcClientConnection conn, return; break; case SILC_CLIENT_CONN_ERROR: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error during connecting to SILC Server")); g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); break; case SILC_CLIENT_CONN_ERROR_KE: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("Key Exchange failed")); break; case SILC_CLIENT_CONN_ERROR_AUTH: - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Authentication failed")); break; case SILC_CLIENT_CONN_ERROR_RESUME: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Resuming detached session failed. " "Press Reconnect to create new connection.")); g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); break; case SILC_CLIENT_CONN_ERROR_TIMEOUT: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection timed out")); break; } @@ -1751,7 +1751,7 @@ silc_disconnected(SilcClient client, SilcClientConnection conn, /* Close the connection */ if (!sg->detaching) - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Disconnected by server")); else /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ diff --git a/libpurple/protocols/silc10/silc.c b/libpurple/protocols/silc10/silc.c index e29c22ea45..71aa6e667f 100644 --- a/libpurple/protocols/silc10/silc.c +++ b/libpurple/protocols/silc10/silc.c @@ -159,7 +159,7 @@ silcpurple_login_connected(gpointer data, gint source, const gchar *error_messag sg = gc->proto_data; if (source < 0) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection failed")); return; @@ -182,7 +182,7 @@ silcpurple_login_connected(gpointer data, gint source, const gchar *error_messag "silc.silcnet.org"), purple_account_get_int(account, "port", 706), sg); if (!conn) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to initialize SILC Client connection")); gc->proto_data = NULL; return; @@ -268,7 +268,7 @@ silcpurple_login(PurpleAccount *account) /* Allocate SILC client */ client = silc_client_alloc(&ops, ¶ms, gc, NULL); if (!client) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Out of memory")); return; } @@ -314,14 +314,14 @@ silcpurple_login(PurpleAccount *account) /* Init SILC client */ if (!silc_client_init(client)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to initialize SILC protocol")); return; } /* Check the ~/.silc dir and create it, and new key pair if necessary. */ if (!silcpurple_check_silc_dir(gc)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Error loading SILC key pair")); return; } @@ -337,7 +337,7 @@ silcpurple_login(PurpleAccount *account) (gc->password == NULL) ? "" : gc->password, &client->pkcs, &client->public_key, &client->private_key)) { g_snprintf(pkd, sizeof(pkd), _("Unable to load SILC key pair: %s"), g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, pkd); return; } @@ -358,7 +358,7 @@ silcpurple_login(PurpleAccount *account) purple_account_get_int(account, "port", 706), silcpurple_login_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to create connection")); return; } diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index b7509118e1..73b5120809 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -432,7 +432,7 @@ static void simple_canwrite_cb(gpointer data, gint source, PurpleInputCondition /*TODO: do we really want to disconnect on a failure to write?*/ gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; @@ -451,7 +451,7 @@ static void send_later_cb(gpointer data, gint source, const gchar *error_message if(source < 0) { gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; @@ -479,7 +479,7 @@ static void sendlater(PurpleConnection *gc, const char *buf) { if(!sip->connecting) { purple_debug_info("simple", "connecting to %s port %d\n", sip->realhostname ? sip->realhostname : "{NULL}", sip->realport); if (purple_proxy_connect(gc, sip->account, sip->realhostname, sip->realport, send_later_cb, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } sip->connecting = TRUE; } @@ -1122,7 +1122,7 @@ gboolean process_register_response(struct simple_account_data *sip, struct sipms if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { if (!purple_account_get_remember_password(sip->gc->account)) purple_account_set_password(sip->gc->account, NULL); - purple_connection_error_reason(sip->gc, + purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password")); return TRUE; @@ -1137,7 +1137,7 @@ gboolean process_register_response(struct simple_account_data *sip, struct sipms if (sip->registerstatus != SIMPLE_REGISTER_RETRY) { purple_debug_info("simple", "Unrecognized return code for REGISTER.\n"); if (sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { - purple_connection_error_reason(sip->gc, + purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unknown server response")); return TRUE; @@ -1739,7 +1739,7 @@ static void login_cb(gpointer data, gint source, const gchar *error_message) { if(source < 0) { gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; @@ -1775,7 +1775,7 @@ static void simple_udp_host_resolved_listen_cb(int listenfd, gpointer data) { sip->listen_data = NULL; if(listenfd == -1) { - purple_connection_error_reason(sip->gc, + purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to create listen socket")); return; @@ -1804,7 +1804,7 @@ static void simple_udp_host_resolved(GSList *hosts, gpointer data, const char *e sip->query_data = NULL; if (!hosts || !hosts->data) { - purple_connection_error_reason(sip->gc, + purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to resolve hostname")); return; @@ -1825,7 +1825,7 @@ static void simple_udp_host_resolved(GSList *hosts, gpointer data, const char *e sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_DGRAM, simple_udp_host_resolved_listen_cb, sip); if (sip->listen_data == NULL) { - purple_connection_error_reason(sip->gc, + purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to create listen socket")); return; @@ -1840,7 +1840,7 @@ simple_tcp_connect_listen_cb(int listenfd, gpointer data) { sip->listenfd = listenfd; if(sip->listenfd == -1) { - purple_connection_error_reason(sip->gc, + purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to create listen socket")); return; @@ -1855,7 +1855,7 @@ simple_tcp_connect_listen_cb(int listenfd, gpointer data) { /* open tcp connection to the server */ if (purple_proxy_connect(sip->gc, sip->account, sip->realhostname, sip->realport, login_cb, sip->gc) == NULL) { - purple_connection_error_reason(sip->gc, + purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } @@ -1895,7 +1895,7 @@ static void srvresolved(PurpleSrvResponse *resp, int results, gpointer data) { sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_STREAM, simple_tcp_connect_listen_cb, sip); if (sip->listen_data == NULL) { - purple_connection_error_reason(sip->gc, + purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to create listen socket")); return; @@ -1906,7 +1906,7 @@ static void srvresolved(PurpleSrvResponse *resp, int results, gpointer data) { sip->query_data = purple_dnsquery_a_account(sip->account, hostname, port, simple_udp_host_resolved, sip); if (sip->query_data == NULL) { - purple_connection_error_reason(sip->gc, + purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to resolve hostname")); } @@ -1924,7 +1924,7 @@ static void simple_login(PurpleAccount *account) gc = purple_account_get_connection(account); if (strpbrk(username, " \t\v\r\n") != NULL) { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("SIP usernames may not contain whitespaces or @ symbols")); return; @@ -1943,7 +1943,7 @@ static void simple_login(PurpleAccount *account) userserver = g_strsplit(username, "@", 2); if (userserver[1] == NULL || userserver[1][0] == '\0') { - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("SIP connect server not specified")); return; diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index d6664abd5c..7a6ab9400f 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -159,7 +159,7 @@ static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt) if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _("You have signed on from another location")); return; } @@ -1803,7 +1803,7 @@ static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *url_data, gpointer user_ if (error_message != NULL) { purple_debug_error("yahoo", "Login Failed, unable to retrieve stage 2 url: %s\n", error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); g_free(auth_data->seed); g_free(auth_data); return; @@ -1890,7 +1890,7 @@ static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *url_data, gpointer user_ if(error_reason) { purple_debug_error("yahoo", "Authentication error: %s. " "Code %d\n", error_reason, response_no); - purple_connection_error_reason(gc, error, error_reason); + purple_connection_error(gc, error, error_reason); g_free(error_reason); g_free(auth_data->seed); g_free(auth_data); @@ -1919,7 +1919,7 @@ static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *url_data, gpointer us if (error_message != NULL) { purple_debug_error("yahoo", "Login Failed, unable to retrieve login url: %s\n", error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); g_free(auth_data->seed); g_free(auth_data); return; @@ -2000,7 +2000,7 @@ static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *url_data, gpointer us } purple_debug_error("yahoo", "Authentication error: %s. Code %d\n", error_reason, response_no); - purple_connection_error_reason(gc, error, error_reason); + purple_connection_error(gc, error, error_reason); g_free(error_reason); g_free(auth_data->seed); g_free(auth_data); @@ -2040,7 +2040,7 @@ static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed) purple_debug_info("yahoo", "Authentication: In yahoo_auth16_stage1\n"); if(!purple_ssl_is_supported()) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); return; } @@ -2285,7 +2285,7 @@ static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pk else fullmsg = g_strdup(msg); - purple_connection_error_reason(gc, reason, fullmsg); + purple_connection_error(gc, reason, fullmsg); g_free(msg); g_free(fullmsg); } @@ -3147,11 +3147,11 @@ static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } else if (len == 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server closed the connection")); return; } @@ -3235,7 +3235,7 @@ static void yahoo_got_connected(gpointer data, gint source, const gchar *error_m if (source < 0) { gchar *tmp; tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } @@ -3261,7 +3261,7 @@ static void yahoo_got_web_connected(gpointer data, gint source, const gchar *err if (source < 0) { gchar *tmp; tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } @@ -3301,11 +3301,11 @@ static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition c tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } else if (len == 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server closed the connection")); return; } @@ -3321,7 +3321,7 @@ static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition c if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) && strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Received unexpected HTTP response from server")); purple_debug_misc("yahoo", "Unexpected HTTP response: %s\n", buf); return; @@ -3351,7 +3351,7 @@ static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition c if (purple_proxy_connect(gc, account, "wcs2.msg.dcn.yahoo.com", purple_account_get_int(account, "port", YAHOO_PAGER_PORT), yahoo_got_web_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); return; } @@ -3380,7 +3380,7 @@ static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCon gc->inpa = 0; tmp = g_strdup_printf(_("Lost connection with %s: %s"), "login.yahoo.com:80", g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } @@ -3405,7 +3405,7 @@ static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_mes gchar *tmp; tmp = g_strdup_printf(_("Unable to establish a connection with %s: %s"), "login.yahoo.com:80", error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } @@ -3489,7 +3489,7 @@ yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, if (error_message != NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); return; } @@ -3539,7 +3539,7 @@ yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, g_hash_table_destroy(hash); yd->auth = g_string_free(url, FALSE); if (purple_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); return; } @@ -3619,12 +3619,12 @@ static void yahoo_got_pager_server(PurpleUtilFetchUrlData *url_data, error_message ? error_message : "(null)"); if(yahoo_is_japan(a)) { /* We don't know fallback hosts for Yahoo Japan :( */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect: The server returned an empty response.")); } else { if(purple_proxy_connect(gc, a, YAHOO_PAGER_HOST_FALLBACK, port, yahoo_got_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } } @@ -3646,20 +3646,20 @@ static void yahoo_got_pager_server(PurpleUtilFetchUrlData *url_data, if(cs_server) { /* got an address; get on with connecting */ if(purple_proxy_connect(gc, a, cs_server, port, yahoo_got_connected, gc) == NULL) - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } else { purple_debug_error("yahoo", "No CS address retrieved! Server " "response:\n%s\n", url_text ? url_text : "(null)"); if(yahoo_is_japan(a)) { /* We don't know fallback hosts for Yahoo Japan :( */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect: The server's response did not contain " "the necessary information")); } else if(purple_proxy_connect(gc, a, YAHOO_PAGER_HOST_FALLBACK, port, yahoo_got_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } } diff --git a/libpurple/protocols/yahoo/yahoo_packet.c b/libpurple/protocols/yahoo/yahoo_packet.c index f029575782..a2a4fa0803 100644 --- a/libpurple/protocols/yahoo/yahoo_packet.c +++ b/libpurple/protocols/yahoo/yahoo_packet.c @@ -302,7 +302,7 @@ yahoo_packet_send_can_write(gpointer data, gint source, PurpleInputCondition con return; else if (ret < 0) { /* TODO: what to do here - do we really have to disconnect? */ - purple_connection_error_reason(yd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + purple_connection_error(yd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Write Error")); return; } diff --git a/libpurple/protocols/yahoo/ycht.c b/libpurple/protocols/yahoo/ycht.c index 5a05e1869d..4035397802 100644 --- a/libpurple/protocols/yahoo/ycht.c +++ b/libpurple/protocols/yahoo/ycht.c @@ -285,7 +285,7 @@ static void ycht_packet_send_write_cb(gpointer data, gint source, PurpleInputCon /* gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(purple_account_get_connection(irc->account), + purple_connection_error(purple_account_get_connection(irc->account), PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); */ diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 2c73eb589a..dc94cca80c 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -146,7 +146,7 @@ struct _zephyr_triple { return TRUE; #define z_call_s(func, err) if (func != ZERR_NONE) {\ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, err);\ + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, err);\ return;\ } @@ -1585,7 +1585,7 @@ static void zephyr_login(PurpleAccount * account) /* XXX z_call_s should actually try to report the com_err determined error */ if (use_tzc(zephyr)) { pid_t pid; - /* purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "tzc not supported yet"); */ + /* purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "tzc not supported yet"); */ if ((pipe(zephyr->totzc) != 0) || (pipe(zephyr->fromtzc) != 0)) { purple_debug_error("zephyr", "pipe creation failed. killing\n"); exit(-1); @@ -1706,7 +1706,7 @@ static void zephyr_login(PurpleAccount * account) ptr++; } if (ptr >=bufcur) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "invalid output by tzc (or bad parsing code)"); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "invalid output by tzc (or bad parsing code)"); free(buf); return; } @@ -1821,7 +1821,7 @@ static void zephyr_login(PurpleAccount * account) purple_debug_info("zephyr","realm: %s\n",zephyr->realm); } else { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Only ZEPH0.2 supported currently"); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Only ZEPH0.2 supported currently"); return; } purple_debug_info("zephyr","does it get here\n"); -- cgit v1.2.1 From 2145e405996a17f9ee13b2b2f65961ae7243e9a8 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 08:03:38 +0000 Subject: Fix compilation of perl plugin. I guess this code doesn't rebuild correctly if the headers it uses change --- pidgin/plugins/perl/common/GtkBlist.xs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pidgin/plugins/perl/common/GtkBlist.xs b/pidgin/plugins/perl/common/GtkBlist.xs index 8dd74fe3d7..453868cd86 100644 --- a/pidgin/plugins/perl/common/GtkBlist.xs +++ b/pidgin/plugins/perl/common/GtkBlist.xs @@ -69,8 +69,3 @@ pidgin_blist_joinchat_is_showable() void pidgin_blist_joinchat_show() - -void -pidgin_blist_update_account_error_state(account, message) - Purple::Account account - const char * message -- cgit v1.2.1 From da2f28d1c98afeab27e6f28593cea7d013c27b21 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 21 Aug 2011 14:39:51 +0000 Subject: Added MXit prpl changes to ChangeLog. --- ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index c855d969f2..dd50b22f7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,14 @@ version 3.0.0 (??/??/????): * Don't try to format ICQ usernames entered as email addresses. Gets rid of an "Unable to format username" error at login. (#13883) + MXit: + * Remove all reference to Hidden Number. + * Fix decoding of font-size changes in the markup of received messages. + * Ignore new invites to join a GroupChat if you're already joined, or + still have a pending invite. + * The buddy's name was not centered vertically in the buddy-list if they + did not have a status-message or mood set. + version 2.10.0 (08/18/2011): Pidgin: * Make the max size of incoming smileys a pref instead of hardcoding it. -- cgit v1.2.1 From 0e9ac8920f670a84a5eb58dd084e391170cc0db6 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 21 Aug 2011 14:50:21 +0000 Subject: Use the new API in v3.0.0 to hide the UserId column in the search-results. --- libpurple/protocols/mxit/profile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libpurple/protocols/mxit/profile.c b/libpurple/protocols/mxit/profile.c index 7a26880395..db1e1babf6 100644 --- a/libpurple/protocols/mxit/profile.c +++ b/libpurple/protocols/mxit/profile.c @@ -281,6 +281,7 @@ void mxit_show_search_results( struct MXitSession* session, int searchType, int /* define columns */ column = purple_notify_searchresults_column_new( _( "UserId" ) ); + purple_notify_searchresult_column_set_visible( column, FALSE ); purple_notify_searchresults_column_add( results, column ); column = purple_notify_searchresults_column_new( _( "Display Name" ) ); purple_notify_searchresults_column_add( results, column ); -- cgit v1.2.1 From a3b5bbd33988a71ef773036837a30bb538ef1952 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 21 Aug 2011 15:28:07 +0000 Subject: Whitespace changes for coding-style consistency. --- libpurple/protocols/mxit/actions.c | 12 ++++++------ libpurple/protocols/mxit/mxit.c | 29 ++++++++++++++--------------- libpurple/protocols/mxit/mxit.h | 2 +- libpurple/protocols/mxit/profile.c | 10 +++++----- libpurple/protocols/mxit/protocol.c | 28 ++++++++++++++-------------- libpurple/protocols/mxit/roster.c | 34 +++++++++++++++++----------------- 6 files changed, 57 insertions(+), 58 deletions(-) diff --git a/libpurple/protocols/mxit/actions.c b/libpurple/protocols/mxit/actions.c index 045e92bb94..40d1d449db 100644 --- a/libpurple/protocols/mxit/actions.c +++ b/libpurple/protocols/mxit/actions.c @@ -158,7 +158,7 @@ out: /* update where am i */ name = purple_request_fields_get_string( fields, "whereami" ); - if ( !name) + if ( !name ) profile->whereami[0] = '\0'; else g_strlcpy( profile->whereami, name, sizeof( profile->whereami ) ); @@ -368,8 +368,8 @@ static void mxit_change_pin_action( PurplePluginAction* action ) purple_debug_info( MXIT_PLUGIN_ID, "mxit_change_pin_action\n" ); fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); + group = purple_request_field_group_new( NULL ); + purple_request_fields_add_group( fields, group ); /* pin */ field = purple_request_field_string_new( "pin", _( "PIN" ), session->acc->password, FALSE ); @@ -472,10 +472,10 @@ static void mxit_user_search_action( PurplePluginAction* action ) _( "Search for a MXit contact" ), _( "Type search information" ), NULL, FALSE, FALSE, NULL, - _("_Search"), G_CALLBACK( mxit_user_search_cb ), - _("_Cancel"), NULL, + _( "_Search" ), G_CALLBACK( mxit_user_search_cb ), + _( "_Cancel" ), NULL, purple_connection_get_account( gc ), NULL, NULL, - gc); + gc ); } diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index 384ccaad04..d864e86919 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -129,7 +129,7 @@ skip: /*------------------------------------------------------------------------ * Register MXit to receive URI click notifications from the UI */ -void mxit_register_uri_handler(void) +void mxit_register_uri_handler( void ) { not_link_ref_count++; if ( not_link_ref_count == 1 ) { @@ -198,7 +198,7 @@ static void mxit_cb_chat_created( PurpleConversation* conv, struct MXitSession* if ( !buddy ) return; - contact = purple_buddy_get_protocol_data(buddy); + contact = purple_buddy_get_protocol_data( buddy ); if ( !contact ) return; @@ -214,7 +214,7 @@ static void mxit_cb_chat_created( PurpleConversation* conv, struct MXitSession* case MXIT_TYPE_INFO : tmp = g_strdup_printf("%s\n", _( "Loading menu..." )); serv_got_im( session->con, who, tmp, PURPLE_MESSAGE_NOTIFY, time( NULL ) ); - g_free(tmp); + g_free( tmp ); mxit_send_message( session, who, " ", FALSE, FALSE ); default : break; @@ -268,7 +268,7 @@ static const char* mxit_list_icon( PurpleAccount* account, PurpleBuddy* buddy ) */ static const char* mxit_list_emblem( PurpleBuddy* buddy ) { - struct contact* contact = purple_buddy_get_protocol_data(buddy); + struct contact* contact = purple_buddy_get_protocol_data( buddy ); if ( !contact ) return NULL; @@ -310,7 +310,7 @@ static const char* mxit_list_emblem( PurpleBuddy* buddy ) char* mxit_status_text( PurpleBuddy* buddy ) { char* text = NULL; - struct contact* contact = purple_buddy_get_protocol_data(buddy); + struct contact* contact = purple_buddy_get_protocol_data( buddy ); if ( !contact ) return NULL; @@ -333,7 +333,7 @@ char* mxit_status_text( PurpleBuddy* buddy ) */ static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboolean full ) { - struct contact* contact = purple_buddy_get_protocol_data(buddy); + struct contact* contact = purple_buddy_get_protocol_data( buddy ); if ( !contact ) return; @@ -424,7 +424,7 @@ static void mxit_set_status( PurpleAccount* account, PurpleStatus* status ) char* statusmsg2; /* Handle mood changes */ - if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_MOOD) { + if ( purple_status_type_get_primitive(purple_status_get_type( status ) ) == PURPLE_STATUS_MOOD ) { const char* moodid = purple_status_get_attr_string( status, PURPLE_MOOD_NAME ); int mood; @@ -487,7 +487,7 @@ static void mxit_free_buddy( PurpleBuddy* buddy ) purple_debug_info( MXIT_PLUGIN_ID, "mxit_free_buddy\n" ); - contact = purple_buddy_get_protocol_data(buddy); + contact = purple_buddy_get_protocol_data( buddy ); if ( contact ) { if ( contact->statusMsg ) g_free( contact->statusMsg ); @@ -498,7 +498,7 @@ static void mxit_free_buddy( PurpleBuddy* buddy ) g_free( contact ); } - purple_buddy_set_protocol_data(buddy, NULL); + purple_buddy_set_protocol_data( buddy, NULL ); } @@ -607,12 +607,11 @@ static GHashTable* mxit_get_text_table( PurpleAccount* acc ) */ static void mxit_reinvite( PurpleBlistNode *node, gpointer ignored ) { - PurpleBuddy* buddy; - struct contact* contact; + PurpleBuddy* buddy = (PurpleBuddy *) node; PurpleConnection* gc; struct MXitSession* session; + struct contact* contact; - buddy = (PurpleBuddy *)node; gc = purple_account_get_connection( purple_buddy_get_account( buddy ) ); session = gc->proto_data; @@ -648,7 +647,7 @@ static GList* mxit_blist_menu( PurpleBlistNode *node ) if ( ( contact->subtype == MXIT_SUBTYPE_DELETED ) || ( contact->subtype == MXIT_SUBTYPE_REJECTED ) || ( contact->subtype == MXIT_SUBTYPE_NONE ) ) { /* contact is in Deleted, Rejected or None state */ act = purple_menu_action_new( _( "Re-Invite" ), PURPLE_CALLBACK( mxit_reinvite ), NULL, NULL ); - m = g_list_append(m, act); + m = g_list_append( m, act ); } return m; @@ -660,9 +659,9 @@ static GList* mxit_blist_menu( PurpleBlistNode *node ) * * @return Chat defaults list */ -static GHashTable *mxit_chat_info_defaults(PurpleConnection *gc, const char *chat_name) +static GHashTable *mxit_chat_info_defaults( PurpleConnection *gc, const char *chat_name ) { - return g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); + return g_hash_table_new_full( g_str_hash, g_str_equal, NULL, g_free ); } diff --git a/libpurple/protocols/mxit/mxit.h b/libpurple/protocols/mxit/mxit.h index ff85d98376..0d2131fbb9 100644 --- a/libpurple/protocols/mxit/mxit.h +++ b/libpurple/protocols/mxit/mxit.h @@ -191,7 +191,7 @@ char* mxit_status_text( PurpleBuddy* buddy ); void mxit_enable_signals( struct MXitSession* session ); #ifdef MXIT_LINK_CLICK -void mxit_register_uri_handler(void); +void mxit_register_uri_handler( void ); #endif diff --git a/libpurple/protocols/mxit/profile.c b/libpurple/protocols/mxit/profile.c index db1e1babf6..176c16f082 100644 --- a/libpurple/protocols/mxit/profile.c +++ b/libpurple/protocols/mxit/profile.c @@ -119,12 +119,12 @@ static int calculateAge( const char* date ) return 0; /* current time */ - t = time(NULL); + t = time( NULL ); localtime_r( &t, &now ); /* decode hdate */ memset( &bdate, 0, sizeof( struct tm ) ); - purple_str_to_time(date, FALSE, &bdate, NULL, NULL); + purple_str_to_time( date, FALSE, &bdate, NULL, NULL ); /* calculate difference */ age = now.tm_year - bdate.tm_year; @@ -172,7 +172,7 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc if ( buddy ) { purple_notify_user_info_add_pair( info, _( "Alias" ), purple_buddy_get_alias( buddy ) ); purple_notify_user_info_add_section_break( info ); - contact = purple_buddy_get_protocol_data(buddy); + contact = purple_buddy_get_protocol_data( buddy ); } purple_notify_user_info_add_pair( info, _( "Display Name" ), profile->nickname ); @@ -296,7 +296,7 @@ void mxit_show_search_results( struct MXitSession* session, int searchType, int column = purple_notify_searchresults_column_new( _( "Where I live" ) ); purple_notify_searchresults_column_add( results, column ); - while (entries != NULL) { + while ( entries != NULL ) { struct MXitProfile* profile = ( struct MXitProfile *) entries->data; GList* row; gchar* tmp = purple_base64_encode( (unsigned char *) profile->userid, strlen( profile->userid ) ); @@ -326,5 +326,5 @@ void mxit_show_search_results( struct MXitSession* session, int searchType, int purple_notify_searchresults( session->con, NULL, text, NULL, results, NULL, NULL ); - g_free( text); + g_free( text ); } diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index 3da8811335..12f7bb9d56 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -86,7 +86,7 @@ void mxit_popup( int type, const char* heading, const char* message ) void mxit_strip_domain( char* username ) { if ( g_str_has_suffix( username, "@m" ) ) - username[ strlen(username) - 2 ] = '\0'; + username[ strlen( username ) - 2 ] = '\0'; } @@ -704,9 +704,9 @@ void mxit_send_register( struct MXitSession* session ) locale = purple_account_get_string( session->acc, MXIT_CONFIG_LOCALE, MXIT_DEFAULT_LOCALE ); /* Voice and Video supported */ - if (mxit_audio_enabled() && mxit_video_enabled()) - features |= (MXIT_CF_VOICE | MXIT_CF_VIDEO); - else if (mxit_audio_enabled()) + if ( mxit_audio_enabled() && mxit_video_enabled() ) + features |= ( MXIT_CF_VOICE | MXIT_CF_VIDEO ); + else if ( mxit_audio_enabled() ) features |= MXIT_CF_VOICE; /* generate client version string (eg, P-2.7.10-Y-PURPLE) */ @@ -748,9 +748,9 @@ void mxit_send_login( struct MXitSession* session ) locale = purple_account_get_string( session->acc, MXIT_CONFIG_LOCALE, MXIT_DEFAULT_LOCALE ); /* Voice and Video supported */ - if (mxit_audio_enabled() && mxit_video_enabled()) - features |= (MXIT_CF_VOICE | MXIT_CF_VIDEO); - else if (mxit_audio_enabled()) + if ( mxit_audio_enabled() && mxit_video_enabled() ) + features |= ( MXIT_CF_VOICE | MXIT_CF_VIDEO ); + else if ( mxit_audio_enabled() ) features |= MXIT_CF_VOICE; /* generate client version string (eg, P-2.7.10-Y-PURPLE) */ @@ -835,7 +835,7 @@ void mxit_send_extprofile_request( struct MXitSession* session, const char* user /* add attributes */ for ( i = 0; i < nr_attrib; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, attribute[i] ); + datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, attribute[i] ); /* queue packet for transmission */ mxit_queue_packet( session, data, datalen, CP_CMD_EXTPROFILE_GET ); @@ -868,7 +868,7 @@ void mxit_send_extprofile_update( struct MXitSession* session, const char* passw /* add attributes */ for ( i = 1; i < nr_attrib * 3; i+=3 ) - datalen += sprintf( data + datalen, "%c%s%c%s%c%s", /* \1name\1type\1value */ + datalen += sprintf( data + datalen, "%c%s%c%s%c%s", /* \1name\1type\1value */ CP_FLD_TERM, parts[i], CP_FLD_TERM, parts[i + 1], CP_FLD_TERM, parts[i + 2] ); /* queue packet for transmission */ @@ -900,7 +900,7 @@ void mxit_send_suggest_friends( struct MXitSession* session, int max, unsigned i /* add attributes */ for ( i = 0; i < nr_attrib; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, attribute[i] ); + datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, attribute[i] ); /* queue packet for transmission */ mxit_queue_packet( session, data, datalen, CP_CMD_SUGGESTCONTACTS ); @@ -929,7 +929,7 @@ void mxit_send_suggest_search( struct MXitSession* session, int max, const char* /* add attributes */ for ( i = 0; i < nr_attrib; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, attribute[i] ); + datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, attribute[i] ); /* queue packet for transmission */ mxit_queue_packet( session, data, datalen, CP_CMD_SUGGESTCONTACTS ); @@ -1175,7 +1175,7 @@ void mxit_send_groupchat_create( struct MXitSession* session, const char* groupn /* add usernames */ for ( i = 0; i < nr_usernames; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, usernames[i] ); + datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, usernames[i] ); /* queue packet for transmission */ mxit_queue_packet( session, data, datalen, CP_CMD_GRPCHAT_CREATE ); @@ -1204,7 +1204,7 @@ void mxit_send_groupchat_invite( struct MXitSession* session, const char* roomid /* add usernames */ for ( i = 0; i < nr_usernames; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, usernames[i] ); + datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, usernames[i] ); /* queue packet for transmission */ mxit_queue_packet( session, data, datalen, CP_CMD_GRPCHAT_INVITE ); @@ -2281,7 +2281,7 @@ static int process_success_response( struct MXitSession* session, struct rx_pack case CP_CMD_PRESENCE : /* presence update */ - mxit_parse_cmd_presence(session, &packet->records[2], packet->rcount - 3 ); + mxit_parse_cmd_presence( session, &packet->records[2], packet->rcount - 3 ); break; case CP_CMD_RX_MSG : diff --git a/libpurple/protocols/mxit/roster.c b/libpurple/protocols/mxit/roster.c index 1dbbed78a2..3922a42b5c 100644 --- a/libpurple/protocols/mxit/roster.c +++ b/libpurple/protocols/mxit/roster.c @@ -82,9 +82,9 @@ GList* mxit_status_types( PurpleAccount* account ) } /* add Mood option */ - type = purple_status_type_new_with_attrs(PURPLE_STATUS_MOOD, "mood", NULL, FALSE, TRUE, TRUE, + type = purple_status_type_new_with_attrs( PURPLE_STATUS_MOOD, "mood", NULL, FALSE, TRUE, TRUE, PURPLE_MOOD_NAME, _("Mood Name"), purple_value_new( PURPLE_TYPE_STRING ), - NULL); + NULL ); statuslist = g_list_append( statuslist, type ); return statuslist; @@ -135,21 +135,21 @@ const char* mxit_convert_presence_to_name( short no ) /* moods (reference: libpurple/status.h) */ static PurpleMood mxit_moods[] = { - {"angry", N_("Angry"), NULL}, - {"excited", N_("Excited"), NULL}, - {"grumpy", N_("Grumpy"), NULL}, - {"happy", N_("Happy"), NULL}, - {"in_love", N_("In love"), NULL}, - {"invincible", N_("Invincible"), NULL}, - {"sad", N_("Sad"), NULL}, - {"hot", N_("Hot"), NULL}, - {"sick", N_("Sick"), NULL}, - {"sleepy", N_("Sleepy"), NULL}, - {"bored", N_("Bored"), NULL}, - {"cold", N_("Cold"), NULL}, - {"confused", N_("Confused"), NULL}, - {"hungry", N_("Hungry"), NULL}, - {"stressed", N_("Stressed"), NULL}, + { "angry", N_( "Angry" ), NULL }, + { "excited", N_( "Excited" ), NULL }, + { "grumpy", N_( "Grumpy" ), NULL }, + { "happy", N_( "Happy" ), NULL }, + { "in_love", N_( "In love" ), NULL }, + { "invincible", N_( "Invincible" ), NULL }, + { "sad", N_( "Sad" ), NULL }, + { "hot", N_( "Hot" ), NULL }, + { "sick", N_( "Sick" ), NULL }, + { "sleepy", N_( "Sleepy" ), NULL }, + { "bored", N_( "Bored" ), NULL }, + { "cold", N_( "Cold" ), NULL }, + { "confused", N_( "Confused" ), NULL }, + { "hungry", N_( "Hungry" ), NULL }, + { "stressed", N_( "Stressed" ), NULL }, /* Mark the last record. */ { NULL, NULL, NULL } }; -- cgit v1.2.1 From 66443cc92750eb57f7e1bfa0c2478268a5d6716a Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 17:28:17 +0000 Subject: Add this @deprecated flag back in here so we know this still needs work --- libpurple/util.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libpurple/util.h b/libpurple/util.h index 7ccbe4fcd1..a489b30bb6 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -1177,6 +1177,7 @@ PurpleUtilFetchUrlData *purple_util_fetch_url_request(const gchar *url, * @param max_len The maximum number of bytes to retrieve (-1 for unlimited) * @param callback The callback function. * @param data The user data to pass to the callback function. + * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url_request" and get rid of the old one */ PurpleUtilFetchUrlData *purple_util_fetch_url_request_len( PurpleAccount *account, const gchar *url, -- cgit v1.2.1 From 1175230f613646d69dc5f963996207dffade86e2 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 18:00:53 +0000 Subject: The id field is unused --- libpurple/protocols/yahoo/libymsg.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 7a6ab9400f..7b8128b184 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -4038,16 +4038,15 @@ void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolea YahooPersonalDetails *ypd = &f->ypd; int i; struct { - char *id; char *text; char *value; } yfields[] = { - {"hp", N_("Home Phone Number"), ypd->phone.home}, - {"wp", N_("Work Phone Number"), ypd->phone.work}, - {"mo", N_("Mobile Phone Number"), ypd->phone.mobile}, - {NULL, NULL, NULL} + {N_("Home Phone Number"), ypd->phone.home}, + {N_("Work Phone Number"), ypd->phone.work}, + {N_("Mobile Phone Number"), ypd->phone.mobile}, + {NULL, NULL} }; - for (i = 0; yfields[i].id; i++) { + for (i = 0; yfields[i].text; i++) { if (!yfields[i].value || !*yfields[i].value) continue; purple_notify_user_info_add_pair(user_info, _(yfields[i].text), yfields[i].value); -- cgit v1.2.1 From f375da089e8886fdd78b73106c84235dcd99f23d Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 18:04:00 +0000 Subject: Simplify. This is 6 lines instead of 15. --- libpurple/protocols/yahoo/libymsg.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 7b8128b184..9b38d7cc02 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -4036,21 +4036,12 @@ void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolea if (f && full) { YahooPersonalDetails *ypd = &f->ypd; - int i; - struct { - char *text; - char *value; - } yfields[] = { - {N_("Home Phone Number"), ypd->phone.home}, - {N_("Work Phone Number"), ypd->phone.work}, - {N_("Mobile Phone Number"), ypd->phone.mobile}, - {NULL, NULL} - }; - for (i = 0; yfields[i].text; i++) { - if (!yfields[i].value || !*yfields[i].value) - continue; - purple_notify_user_info_add_pair(user_info, _(yfields[i].text), yfields[i].value); - } + if (ypd->phone.home && *ypd->phone.home) + purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), ypd->phone.home); + if (ypd->phone.work && *ypd->phone.work) + purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), ypd->phone.work); + if (ypd->phone.mobile && *ypd->phone.mobile) + purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), ypd->phone.mobile); } } -- cgit v1.2.1 From 5422397fa1a45f105da261ae5c2c75748e804674 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 21 Aug 2011 18:43:00 +0000 Subject: Use purple_notify_user_info_add_pair_plaintext in some places where we were using purple_notify_user_info_add_pair (which expects an html string for the value). Feel free to double check these if you care about one of these protocols. --- libpurple/protocols/irc/msgs.c | 24 ++++++++++-------------- libpurple/protocols/jabber/jabber.c | 2 +- libpurple/protocols/myspace/user.c | 16 ++++++++-------- libpurple/protocols/sametime/sametime.c | 6 ++---- libpurple/protocols/yahoo/libymsg.c | 6 +++--- libpurple/protocols/yahoo/yahoo_profile.c | 2 +- 6 files changed, 25 insertions(+), 31 deletions(-) diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c index 94d6f83daa..762492d833 100644 --- a/libpurple/protocols/irc/msgs.c +++ b/libpurple/protocols/irc/msgs.c @@ -357,39 +357,35 @@ void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, g_free(tmp); if (irc->whois.away) { - tmp = g_markup_escape_text(irc->whois.away, strlen(irc->whois.away)); + purple_notify_user_info_add_pair_plaintext(user_info, _("Away"), irc->whois.away); g_free(irc->whois.away); - purple_notify_user_info_add_pair(user_info, _("Away"), tmp); - g_free(tmp); } if (irc->whois.userhost) { - tmp = g_markup_escape_text(irc->whois.name, strlen(irc->whois.name)); - g_free(irc->whois.name); - purple_notify_user_info_add_pair(user_info, _("Username"), irc->whois.userhost); - purple_notify_user_info_add_pair(user_info, _("Real name"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), irc->whois.userhost); + purple_notify_user_info_add_pair_plaintext(user_info, _("Real name"), irc->whois.name); g_free(irc->whois.userhost); - g_free(tmp); + g_free(irc->whois.name); } if (irc->whois.server) { tmp = g_strdup_printf("%s (%s)", irc->whois.server, irc->whois.serverinfo); - purple_notify_user_info_add_pair(user_info, _("Server"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Server"), tmp); g_free(tmp); g_free(irc->whois.server); g_free(irc->whois.serverinfo); } if (irc->whois.channels) { - purple_notify_user_info_add_pair(user_info, _("Currently on"), irc->whois.channels->str); + purple_notify_user_info_add_pair_plaintext(user_info, _("Currently on"), irc->whois.channels->str); g_string_free(irc->whois.channels, TRUE); } if (irc->whois.idle) { gchar *timex = purple_str_seconds_to_string(irc->whois.idle); - purple_notify_user_info_add_pair(user_info, _("Idle for"), timex); + purple_notify_user_info_add_pair_plaintext(user_info, _("Idle for"), timex); g_free(timex); - purple_notify_user_info_add_pair(user_info, + purple_notify_user_info_add_pair_plaintext(user_info, _("Online since"), purple_date_format_full(localtime(&irc->whois.signon))); } - if (!strcmp(irc->whois.nick, "Paco-Paco")) { - purple_notify_user_info_add_pair(user_info, + if (!strcmp(irc->whois.nick, "elb")) { + purple_notify_user_info_add_pair_plaintext(user_info, _("Defining adjective:"), _("Glorious")); } diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 2c7b229c6f..cb612d1eab 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -2238,7 +2238,7 @@ jabber_tooltip_add_resource_text(JabberBuddyResource *jbr, gchar *idle_str = purple_str_seconds_to_string(time(NULL) - jbr->idle); label = g_strdup_printf("%s%s", _("Idle"), (res ? res : "")); - purple_notify_user_info_add_pair(user_info, label, idle_str); + purple_notify_user_info_add_pair_plaintext(user_info, label, idle_str); g_free(idle_str); g_free(label); } diff --git a/libpurple/protocols/myspace/user.c b/libpurple/protocols/myspace/user.c index fa7edb4140..bd225c306e 100644 --- a/libpurple/protocols/myspace/user.c +++ b/libpurple/protocols/myspace/user.c @@ -117,27 +117,27 @@ msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, Msi /* Useful to identify the account the tooltip refers to. * Other prpls show this. */ if (user->username) { - purple_notify_user_info_add_pair(user_info, _("User"), user->username); + purple_notify_user_info_add_pair_plaintext(user_info, _("User"), user->username); } /* a/s/l...the vitals */ if (user->age) { char age[16]; g_snprintf(age, sizeof(age), "%d", user->age); - purple_notify_user_info_add_pair(user_info, _("Age"), age); + purple_notify_user_info_add_pair_plaintext(user_info, _("Age"), age); } if (user->gender && *user->gender) { - purple_notify_user_info_add_pair(user_info, _("Gender"), user->gender); + purple_notify_user_info_add_pair_plaintext(user_info, _("Gender"), user->gender); } if (user->location && *user->location) { - purple_notify_user_info_add_pair(user_info, _("Location"), user->location); + purple_notify_user_info_add_pair_plaintext(user_info, _("Location"), user->location); } /* Other information */ if (user->headline && *user->headline) { - purple_notify_user_info_add_pair(user_info, _("Headline"), user->headline); + purple_notify_user_info_add_pair_plaintext(user_info, _("Headline"), user->headline); } if (user->buddy != NULL) { @@ -153,7 +153,7 @@ msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, Msi str = msim_format_now_playing(artist, title); if (str && *str) { - purple_notify_user_info_add_pair(user_info, _("Song"), str); + purple_notify_user_info_add_pair_plaintext(user_info, _("Song"), str); } g_free(str); } @@ -163,7 +163,7 @@ msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, Msi if (user->total_friends) { char friends[16]; g_snprintf(friends, sizeof(friends), "%d", user->total_friends); - purple_notify_user_info_add_pair(user_info, _("Total Friends"), friends); + purple_notify_user_info_add_pair_plaintext(user_info, _("Total Friends"), friends); } if (full) { @@ -181,7 +181,7 @@ msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, Msi client = g_strdup_printf("Build %d", cv); } if (client && *client) - purple_notify_user_info_add_pair(user_info, _("Client Version"), client); + purple_notify_user_info_add_pair_plaintext(user_info, _("Client Version"), client); g_free(client); } diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 48ace57ca1..49a20918e1 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -3334,9 +3334,7 @@ static void mw_prpl_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info status = status_text(b); if(message != NULL && g_utf8_validate(message, -1, NULL) && purple_utf8_strcasecmp(status, message)) { - tmp = g_markup_escape_text(message, -1); - purple_notify_user_info_add_pair(user_info, status, tmp); - g_free(tmp); + purple_notify_user_info_add_pair_plaintext(user_info, status, message); } else { purple_notify_user_info_add_pair(user_info, _("Status"), status); @@ -3350,7 +3348,7 @@ static void mw_prpl_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info } if(buddy_is_external(b)) { - purple_notify_user_info_add_pair(user_info, NULL, _("External User")); + purple_notify_user_info_add_pair_plaintext(user_info, NULL, _("External User")); } } } diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 9b38d7cc02..4709071580 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -4037,11 +4037,11 @@ void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolea if (f && full) { YahooPersonalDetails *ypd = &f->ypd; if (ypd->phone.home && *ypd->phone.home) - purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), ypd->phone.home); + purple_notify_user_info_add_pair_plaintext(user_info, _("Home Phone Number"), ypd->phone.home); if (ypd->phone.work && *ypd->phone.work) - purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), ypd->phone.work); + purple_notify_user_info_add_pair_plaintext(user_info, _("Work Phone Number"), ypd->phone.work); if (ypd->phone.mobile && *ypd->phone.mobile) - purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), ypd->phone.mobile); + purple_notify_user_info_add_pair_plaintext(user_info, _("Mobile Phone Number"), ypd->phone.mobile); } } diff --git a/libpurple/protocols/yahoo/yahoo_profile.c b/libpurple/protocols/yahoo/yahoo_profile.c index b6197e83bb..c0a0ce5b8e 100644 --- a/libpurple/protocols/yahoo/yahoo_profile.c +++ b/libpurple/protocols/yahoo/yahoo_profile.c @@ -1228,7 +1228,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, str = _("The user's profile is empty."); } - purple_notify_user_info_add_pair(user_info, NULL, str); + purple_notify_user_info_add_pair_plaintext(user_info, NULL, str); } /* put a link to the actual profile URL */ -- cgit v1.2.1 From 31fcc8dbcec8f2e19f328f7ac96d004f5775e390 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 01:53:37 +0000 Subject: I went through all our calls to purple_notify_user_info_add_pair() and checked whether they should be purple_notify_user_info_add_pair_plaintext(), instead. If it wasn't immediately obvious one way or the other then I left a comment to investigate. I suspect there are still a lot of places where we should use the _plaintext function to escape the value. --- finch/gntblist.c | 10 ++-- libpurple/protocols/bonjour/bonjour.c | 32 +++++++++--- libpurple/protocols/gg/gg.c | 33 +++++++------ libpurple/protocols/msn/msn.c | 31 ++++++++---- libpurple/protocols/mxit/mxit.c | 16 ++++-- libpurple/protocols/mxit/profile.c | 50 ++++++++++++++----- libpurple/protocols/myspace/user.c | 13 ++++- libpurple/protocols/novell/novell.c | 20 ++++++-- libpurple/protocols/null/nullprpl.c | 8 ++- libpurple/protocols/oscar/oscar.c | 18 +++++-- libpurple/protocols/oscar/userinfo.c | 75 +++++++++++++++------------- libpurple/protocols/sametime/sametime.c | 29 +++++------ libpurple/protocols/silc/buddy.c | 20 +++++++- libpurple/protocols/silc/ops.c | 87 +++++++++++++++++---------------- libpurple/protocols/zephyr/zephyr.c | 14 ++++-- pidgin/gtkblist.c | 47 ++++++++---------- pidgin/gtkutils.c | 2 +- 17 files changed, 316 insertions(+), 189 deletions(-) diff --git a/finch/gntblist.c b/finch/gntblist.c index b2c62c55d8..3a6abfc8f0 100644 --- a/finch/gntblist.c +++ b/finch/gntblist.c @@ -1268,7 +1268,7 @@ gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name) { PurpleNotifyUserInfo *info = purple_notify_user_info_new(); gpointer uihandle; - purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); + purple_notify_user_info_add_pair_plaintext(info, _("Information"), _("Retrieving...")); uihandle = purple_notify_userinfo(conn, name, info, NULL, NULL); purple_notify_user_info_destroy(info); @@ -1783,15 +1783,13 @@ tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full) presence = purple_buddy_get_presence(buddy); if (!full || g_utf8_collate(purple_buddy_get_name(buddy), alias)) { - char *esc = g_markup_escape_text(alias, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), esc); - g_free(esc); + purple_notify_user_info_add_pair_plaintext(user_info, _("Nickname"), alias); } tmp = g_strdup_printf("%s (%s)", purple_account_get_username(account), purple_account_get_protocol_name(account)); - purple_notify_user_info_add_pair(user_info, _("Account"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), tmp); g_free(tmp); prpl = purple_find_prpl(purple_account_get_protocol_id(account)); @@ -1806,7 +1804,7 @@ tooltip_for_buddy(PurpleBuddy *buddy, GString *str, gboolean full) time_t idle = purple_presence_get_idle_time(pre); if (idle > 0) { char *st = purple_str_seconds_to_string(time(NULL) - idle); - purple_notify_user_info_add_pair(user_info, _("Idle"), st); + purple_notify_user_info_add_pair_plaintext(user_info, _("Idle"), st); g_free(st); } } diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c index 14b3f628ff..5526b6d071 100644 --- a/libpurple/protocols/bonjour/bonjour.c +++ b/libpurple/protocols/bonjour/bonjour.c @@ -371,9 +371,12 @@ bonjour_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboole else status_description = purple_status_get_name(status); - purple_notify_user_info_add_pair(user_info, _("Status"), status_description); - if (message != NULL) + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), status_description); + if (message != NULL) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Message"), message); + } if (bb == NULL) { purple_debug_error("bonjour", "Got tooltip request for a buddy without protocol data.\n"); @@ -382,20 +385,35 @@ bonjour_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboole /* Only show first/last name if there is a nickname set (to avoid duplication) */ if (bb->nick != NULL && *bb->nick != '\0') { - if (bb->first != NULL && *bb->first != '\0') + if (bb->first != NULL && *bb->first != '\0') { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("First name"), bb->first); - if (bb->last != NULL && *bb->last != '\0') + } + if (bb->last != NULL && *bb->last != '\0') { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Last name"), bb->last); + } } - if (bb->email != NULL && *bb->email != '\0') + if (bb->email != NULL && *bb->email != '\0') { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Email"), bb->email); + } - if (bb->AIM != NULL && *bb->AIM != '\0') + if (bb->AIM != NULL && *bb->AIM != '\0') { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("AIM Account"), bb->AIM); + } - if (bb->jid != NULL && *bb->jid != '\0') + if (bb->jid != NULL && *bb->jid != '\0') { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("XMPP Account"), bb->jid); + } } static void diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 3d08581f99..070ff33d98 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -1194,26 +1194,36 @@ static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req, val = ggp_search_get_result(req, 0, GG_PUBDIR50_STATUS); /* XXX: Use of ggp_str_to_uin() is an ugly hack! */ - purple_notify_user_info_add_pair(user_info, _("Status"), ggp_status_by_id(ggp_str_to_uin(val))); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), ggp_status_by_id(ggp_str_to_uin(val))); g_free(val); who = ggp_search_get_result(req, 0, GG_PUBDIR50_UIN); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("UIN"), who); val = ggp_search_get_result(req, 0, GG_PUBDIR50_FIRSTNAME); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("First Name"), val); g_free(val); val = ggp_search_get_result(req, 0, GG_PUBDIR50_NICKNAME); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Nickname"), val); g_free(val); val = ggp_search_get_result(req, 0, GG_PUBDIR50_CITY); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("City"), val); g_free(val); val = ggp_search_get_result(req, 0, GG_PUBDIR50_BIRTHYEAR); if (strncmp(val, "0", 1)) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Birth Year"), val); } g_free(val); @@ -1225,15 +1235,12 @@ static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req, if (NULL != buddy) { PurpleStatus *status; const char *msg; - char *text; status = purple_presence_get_active_status(purple_buddy_get_presence(buddy)); msg = purple_status_get_attr_string(status, "message"); if (msg != NULL) { - text = g_markup_escape_text(msg, -1); - purple_notify_user_info_add_pair(user_info, _("Message"), text); - g_free(text); + purple_notify_user_info_add_pair_plaintext(user_info, _("Message"), msg); } } @@ -1975,7 +1982,7 @@ static char *ggp_status_text(PurpleBuddy *b) static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { PurpleStatus *status; - char *text, *tmp; + char *tmp; const char *msg, *name, *alias; g_return_if_fail(b != NULL); @@ -1985,21 +1992,19 @@ static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gb name = purple_status_get_name(status); alias = purple_buddy_get_alias(b); - purple_notify_user_info_add_pair (user_info, _("Alias"), alias); + purple_notify_user_info_add_pair_plaintext(user_info, _("Alias"), alias); if (msg != NULL) { - text = g_markup_escape_text(msg, -1); if (PURPLE_BUDDY_IS_ONLINE(b)) { - tmp = g_strdup_printf("%s: %s", name, text); - purple_notify_user_info_add_pair(user_info, _("Status"), tmp); + tmp = g_strdup_printf("%s: %s", name, msg); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), tmp); g_free(tmp); } else { - purple_notify_user_info_add_pair(user_info, _("Message"), text); + purple_notify_user_info_add_pair_plaintext(user_info, _("Message"), msg); } - g_free(text); /* We don't want to duplicate 'Status: Offline'. */ } else if (PURPLE_BUDDY_IS_ONLINE(b)) { - purple_notify_user_info_add_pair(user_info, _("Status"), name); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), name); } } @@ -2030,7 +2035,7 @@ static GList *ggp_status_types(PurpleAccount *account) NULL); types = g_list_append(types, type); - /* + /* * New statuses for GG 8.0 like PoGGadaj ze mna (not yet because * libpurple can't support Chatty status) and Nie przeszkadzac */ diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 7515889b9e..43b4e34eb1 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -1091,16 +1091,18 @@ msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean f } } else { if (purple_presence_is_idle(presence)) { - purple_notify_user_info_add_pair(user_info, _("Status"), - _("Idle")); + purple_notify_user_info_add_pair_plaintext(user_info, + _("Status"), _("Idle")); } else { - purple_notify_user_info_add_pair(user_info, _("Status"), - purple_status_get_name(status)); + purple_notify_user_info_add_pair_plaintext(user_info, + _("Status"), purple_status_get_name(status)); } } } if (currentmedia) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, mediatype, currentmedia); g_free(currentmedia); } @@ -1119,23 +1121,32 @@ msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean f { const char *phone; - purple_notify_user_info_add_pair(user_info, _("Has you"), + purple_notify_user_info_add_pair_plaintext(user_info, _("Has you"), ((user->list_op & (1 << MSN_LIST_RL)) ? _("Yes") : _("No"))); - purple_notify_user_info_add_pair(user_info, _("Blocked"), + purple_notify_user_info_add_pair_plaintext(user_info, _("Blocked"), ((user->list_op & (1 << MSN_LIST_BL)) ? _("Yes") : _("No"))); phone = msn_user_get_home_phone(user); - if (phone != NULL) + if (phone != NULL) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), phone); + } phone = msn_user_get_work_phone(user); - if (phone != NULL) + if (phone != NULL) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), phone); + } phone = msn_user_get_mobile_phone(user); - if (phone != NULL) + if (phone != NULL) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), phone); + } } } @@ -2705,7 +2716,7 @@ msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, (purple_connection_get_account(info_data->gc), info_data->name); purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"), NULL); - purple_notify_user_info_add_pair(user_info, NULL, + purple_notify_user_info_add_pair_plaintext(user_info, NULL, ((p && b) ? _("The user has not created a public profile.") : (p ? _("MSN reported not being able to find the user's profile. " "This either means that the user does not exist, " diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index d864e86919..48f0bbf4d8 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -340,23 +340,29 @@ static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboole /* status (reference: "libpurple/notify.h") */ if ( contact->presence != MXIT_PRESENCE_OFFLINE ) - purple_notify_user_info_add_pair( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) ); + purple_notify_user_info_add_pair_plaintext( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) ); /* status message */ - if ( contact->statusMsg ) + if ( contact->statusMsg ) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg ); + } /* mood */ if ( contact->mood != MXIT_MOOD_NONE ) - purple_notify_user_info_add_pair( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) ); + purple_notify_user_info_add_pair_plaintext( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) ); /* subscription type */ if ( contact->subtype != 0 ) - purple_notify_user_info_add_pair( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); + purple_notify_user_info_add_pair_plaintext( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); /* rejection message */ - if ( ( contact->subtype == MXIT_SUBTYPE_REJECTED ) && ( contact->msg != NULL ) ) + if ( ( contact->subtype == MXIT_SUBTYPE_REJECTED ) && ( contact->msg != NULL ) ) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Rejection Message" ), contact->msg ); + } } diff --git a/libpurple/protocols/mxit/profile.c b/libpurple/protocols/mxit/profile.c index 176c16f082..91e4d125d2 100644 --- a/libpurple/protocols/mxit/profile.c +++ b/libpurple/protocols/mxit/profile.c @@ -170,51 +170,70 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc buddy = purple_find_buddy( session->acc, username ); if ( buddy ) { - purple_notify_user_info_add_pair( info, _( "Alias" ), purple_buddy_get_alias( buddy ) ); + purple_notify_user_info_add_pair_plaintext( info, _( "Alias" ), purple_buddy_get_alias( buddy ) ); purple_notify_user_info_add_section_break( info ); contact = purple_buddy_get_protocol_data( buddy ); } + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Display Name" ), profile->nickname ); tmp = g_strdup_printf("%s (%i)", profile->birthday, calculateAge( profile->birthday ) ); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Birthday" ), tmp ); g_free( tmp ); - purple_notify_user_info_add_pair( info, _( "Gender" ), profile->male ? _( "Male" ) : _( "Female" ) ); + purple_notify_user_info_add_pair_plaintext( info, _( "Gender" ), profile->male ? _( "Male" ) : _( "Female" ) ); /* optional information */ + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "First Name" ), profile->firstname ); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Last Name" ), profile->lastname ); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Country" ), profile->regcountry ); - if ( strlen( profile->aboutme ) > 0 ) + if ( strlen( profile->aboutme ) > 0 ) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "About Me" ), profile->aboutme ); - if ( strlen( profile->whereami ) > 0 ) + } + if ( strlen( profile->whereami ) > 0 ) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Where I Live" ), profile->whereami ); + } purple_notify_user_info_add_section_break( info ); if ( contact ) { /* presence */ - purple_notify_user_info_add_pair( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) ); + purple_notify_user_info_add_pair_plaintext( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) ); /* last online */ if ( contact->presence == MXIT_PRESENCE_OFFLINE ) - purple_notify_user_info_add_pair( info, _( "Last Online" ), ( profile->lastonline == 0 ) ? _( "Unknown" ) : datetime( profile->lastonline ) ); + purple_notify_user_info_add_pair_plaintext( info, _( "Last Online" ), ( profile->lastonline == 0 ) ? _( "Unknown" ) : datetime( profile->lastonline ) ); /* mood */ if ( contact->mood != MXIT_MOOD_NONE ) - purple_notify_user_info_add_pair( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) ); + purple_notify_user_info_add_pair_plaintext( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) ); else - purple_notify_user_info_add_pair( info, _( "Mood" ), _( "None" ) ); + purple_notify_user_info_add_pair_plaintext( info, _( "Mood" ), _( "None" ) ); /* status message */ - if ( contact->statusMsg ) + if ( contact->statusMsg ) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg ); + } /* subscription type */ - purple_notify_user_info_add_pair( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); + purple_notify_user_info_add_pair_plaintext( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); } else { /* this is an invite */ @@ -222,18 +241,25 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc if ( contact ) { /* invite found */ - if ( contact->msg ) + if ( contact->msg ) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Invite Message" ), contact->msg ); + } if ( contact->imgid ) { /* this invite has a avatar */ char* img_text; img_text = g_strdup_printf( "", contact->imgid ); purple_notify_user_info_add_pair( info, _( "Photo" ), img_text ); + g_free(img_text); } - if ( contact->statusMsg ) + if ( contact->statusMsg ) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg ); + } } } diff --git a/libpurple/protocols/myspace/user.c b/libpurple/protocols/myspace/user.c index bd225c306e..3b8a0c9bf4 100644 --- a/libpurple/protocols/myspace/user.c +++ b/libpurple/protocols/myspace/user.c @@ -128,15 +128,21 @@ msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, Msi } if (user->gender && *user->gender) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair_plaintext(user_info, _("Gender"), user->gender); } if (user->location && *user->location) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair_plaintext(user_info, _("Location"), user->location); } /* Other information */ if (user->headline && *user->headline) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair_plaintext(user_info, _("Headline"), user->headline); } @@ -153,6 +159,8 @@ msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, Msi str = msim_format_now_playing(artist, title); if (str && *str) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair_plaintext(user_info, _("Song"), str); } g_free(str); @@ -180,8 +188,11 @@ msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, Msi } else if (cv) { client = g_strdup_printf("Build %d", cv); } - if (client && *client) + if (client && *client) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair_plaintext(user_info, _("Client Version"), client); + } g_free(client); } diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index 682fcb7529..9e5cebd4ba 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -1515,19 +1515,26 @@ _show_info(PurpleConnection * gc, NMUserRecord * user_record, char * name) tag = _("User ID"); value = nm_user_record_get_userid(user_record); if (value) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, tag, value); } -/* tag = _("DN"); +#if 0 + tag = _("DN"); value = nm_user_record_get_dn(user_record); if (value) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, tag, value); } -*/ +#endif /* if 0 */ tag = _("Full name"); value = nm_user_record_get_full_name(user_record); if (value) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, tag, value); } @@ -1538,6 +1545,8 @@ _show_info(PurpleConnection * gc, NMUserRecord * user_record, char * name) tag = _map_property_tag(nm_property_get_tag(property)); value = nm_property_get_value(property); if (tag && value) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, tag, value); } nm_release_property(property); @@ -2860,10 +2869,13 @@ novell_tooltip_text(PurpleBuddy * buddy, PurpleNotifyUserInfo * user_info, gbool break; } - purple_notify_user_info_add_pair(user_info, _("Status"), status_str); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), status_str); - if (text) + if (text) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Message"), text); + } } } } diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index 1fdb0e4fb1..755b701af9 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -258,6 +258,8 @@ static void nullprpl_tooltip_text(PurpleBuddy *buddy, PurplePresence *presence = purple_buddy_get_presence(buddy); PurpleStatus *status = purple_presence_get_active_status(presence); char *msg = nullprpl_status_text(buddy); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(info, purple_status_get_name(status), msg); g_free(msg); @@ -265,12 +267,14 @@ static void nullprpl_tooltip_text(PurpleBuddy *buddy, if (full) { const char *user_info = purple_account_get_user_info(gc->account); if (user_info) + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(info, _("User info"), user_info); } } else { /* they're not logged in */ - purple_notify_user_info_add_pair(info, _("User info"), _("not logged in")); + purple_notify_user_info_add_pair_plaintext(info, _("User info"), _("not logged in")); } purple_debug_info("nullprpl", "showing %s tooltip for %s\n", @@ -510,6 +514,8 @@ static void nullprpl_get_info(PurpleConnection *gc, const char *username) { body = purple_account_get_user_info(acct); else body = _("No user info."); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(info, "Info", body); /* show a buddy's user info in a nice dialog box */ diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 4fe8d64454..3e4f26fd95 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -2278,7 +2278,7 @@ purple_parse_clientauto_ch2(OscarData *od, const char *who, guint16 reason, cons return 0; } -static int purple_parse_clientauto_ch4(OscarData *od, char *who, guint16 reason, guint32 state, char *msg) { +static int purple_parse_clientauto_ch4(OscarData *od, const char *who, guint16 reason, guint32 state, char *msg) { PurpleConnection *gc = od->gc; switch(reason) { @@ -2286,13 +2286,17 @@ static int purple_parse_clientauto_ch4(OscarData *od, char *who, guint16 reason, char *statusmsg, **splitmsg; PurpleNotifyUserInfo *user_info; - /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ statusmsg = oscar_icqstatus(state); + + /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ + /* TODO: Don't we need to escape each piece? */ splitmsg = g_strsplit(msg, "\r\n", 0); user_info = purple_notify_user_info_new(); - purple_notify_user_info_add_pair(user_info, _("UIN"), who); + purple_notify_user_info_add_pair_plaintext(user_info, _("UIN"), who); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Status"), statusmsg); purple_notify_user_info_add_section_break(user_info); purple_notify_user_info_add_pair(user_info, NULL, g_strjoinv("
", splitmsg)); @@ -2309,13 +2313,17 @@ static int purple_parse_clientauto_ch4(OscarData *od, char *who, guint16 reason, char *statusmsg, **splitmsg; PurpleNotifyUserInfo *user_info; - /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ statusmsg = oscar_icqstatus(state); + + /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ + /* TODO: Don't we need to escape each piece? */ splitmsg = g_strsplit(msg, "\r\n", 0); user_info = purple_notify_user_info_new(); - purple_notify_user_info_add_pair(user_info, _("UIN"), who); + purple_notify_user_info_add_pair_plaintext(user_info, _("UIN"), who); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Status"), statusmsg); purple_notify_user_info_add_section_break(user_info); purple_notify_user_info_add_pair(user_info, NULL, g_strjoinv("
", splitmsg)); diff --git a/libpurple/protocols/oscar/userinfo.c b/libpurple/protocols/oscar/userinfo.c index 06212aec95..b17c14bc54 100644 --- a/libpurple/protocols/oscar/userinfo.c +++ b/libpurple/protocols/oscar/userinfo.c @@ -130,14 +130,6 @@ oscar_caps_to_string(guint64 caps) return g_string_free(str, FALSE); } -static void -oscar_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *name, const char *value) -{ - if (value && value[0]) { - purple_notify_user_info_add_pair(user_info, name, value); - } -} - static void oscar_user_info_convert_and_add(PurpleAccount *account, OscarData *od, PurpleNotifyUserInfo *user_info, const char *name, const char *value) @@ -145,6 +137,9 @@ oscar_user_info_convert_and_add(PurpleAccount *account, OscarData *od, PurpleNot gchar *utf8; if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, od, value))) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext. Will + need to check callers of this function. */ purple_notify_user_info_add_pair(user_info, name, utf8); g_free(utf8); } @@ -158,6 +153,9 @@ oscar_user_info_convert_and_add_hyperlink(PurpleAccount *account, OscarData *od, if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, od, value))) { gchar *tmp = g_strdup_printf("%s", url_prefix, utf8, utf8); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext. Will + need to check callers of this function. */ purple_notify_user_info_add_pair(user_info, name, tmp); g_free(utf8); g_free(tmp); @@ -340,19 +338,19 @@ oscar_user_info_append_extra_info(PurpleConnection *gc, PurpleNotifyUserInfo *us bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, userinfo->bn)); if ((bi != NULL) && (bi->ipaddr != 0)) { - tmp = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", - (bi->ipaddr & 0xff000000) >> 24, - (bi->ipaddr & 0x00ff0000) >> 16, - (bi->ipaddr & 0x0000ff00) >> 8, - (bi->ipaddr & 0x000000ff)); - oscar_user_info_add_pair(user_info, _("IP Address"), tmp); - g_free(tmp); + char tmp2[40]; + sprintf(tmp2, "%hhu.%hhu.%hhu.%hhu", + (bi->ipaddr & 0xff000000) >> 24, + (bi->ipaddr & 0x00ff0000) >> 16, + (bi->ipaddr & 0x0000ff00) >> 8, + (bi->ipaddr & 0x000000ff)); + purple_notify_user_info_add_pair_plaintext(user_info, _("IP Address"), tmp2); } if ((userinfo != NULL) && (userinfo->warnlevel != 0)) { - tmp = g_strdup_printf("%d", (int)(userinfo->warnlevel/10.0 + .5)); - oscar_user_info_add_pair(user_info, _("Warning Level"), tmp); - g_free(tmp); + char tmp2[12]; + sprintf(tmp2, "%d", (int)(userinfo->warnlevel/10.0 + .5)); + purple_notify_user_info_add_pair_plaintext(user_info, _("Warning Level"), tmp2); } if ((b != NULL) && (bname != NULL) && (g != NULL) && (gname != NULL)) { @@ -372,7 +370,7 @@ oscar_user_info_display_error(OscarData *od, guint16 error_reason, gchar *buddy) { PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); gchar *buf = g_strdup_printf(_("User information not available: %s"), oscar_get_msgerr_reason(error_reason)); - purple_notify_user_info_add_pair(user_info, NULL, buf); + purple_notify_user_info_add_pair_plaintext(user_info, NULL, buf); purple_notify_userinfo(od->gc, buddy, user_info, NULL, NULL); purple_notify_user_info_destroy(user_info); purple_conv_present_error(buddy, purple_connection_get_account(od->gc), buf); @@ -402,16 +400,16 @@ oscar_user_info_display_icq(OscarData *od, struct aim_icq_info *info) else bi = NULL; - purple_notify_user_info_add_pair(user_info, _("UIN"), who); + purple_notify_user_info_add_pair_plaintext(user_info, _("UIN"), who); oscar_user_info_convert_and_add(account, od, user_info, _("Nick"), info->nick); if ((bi != NULL) && (bi->ipaddr != 0)) { - char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", - (bi->ipaddr & 0xff000000) >> 24, - (bi->ipaddr & 0x00ff0000) >> 16, - (bi->ipaddr & 0x0000ff00) >> 8, - (bi->ipaddr & 0x000000ff)); - purple_notify_user_info_add_pair(user_info, _("IP Address"), tstr); - g_free(tstr); + char tstr[40]; + sprintf(tstr, "%hhu.%hhu.%hhu.%hhu", + (bi->ipaddr & 0xff000000) >> 24, + (bi->ipaddr & 0x00ff0000) >> 16, + (bi->ipaddr & 0x0000ff00) >> 8, + (bi->ipaddr & 0x000000ff)); + purple_notify_user_info_add_pair_plaintext(user_info, _("IP Address"), tstr); } oscar_user_info_convert_and_add(account, od, user_info, _("First Name"), info->first); oscar_user_info_convert_and_add(account, od, user_info, _("Last Name"), info->last); @@ -425,7 +423,7 @@ oscar_user_info_display_icq(OscarData *od, struct aim_icq_info *info) oscar_user_info_convert_and_add(account, od, user_info, _("Mobile Phone"), info->mobile); if (info->gender != 0) - purple_notify_user_info_add_pair(user_info, _("Gender"), (info->gender == 1 ? _("Female") : _("Male"))); + purple_notify_user_info_add_pair_plaintext(user_info, _("Gender"), (info->gender == 1 ? _("Female") : _("Male"))); if ((info->birthyear > 1900) && (info->birthmonth > 0) && (info->birthday > 0)) { /* Initialize the struct properly or strftime() will crash @@ -437,7 +435,7 @@ oscar_user_info_display_icq(OscarData *od, struct aim_icq_info *info) tm->tm_mon = (int)info->birthmonth - 1; tm->tm_year = (int)info->birthyear - 1900; - /* Ignore dst setting of today to avoid timezone shift between + /* Ignore dst setting of today to avoid timezone shift between * dates in summer and winter time. */ tm->tm_isdst = -1; @@ -451,8 +449,9 @@ oscar_user_info_display_icq(OscarData *od, struct aim_icq_info *info) if ((info->age > 0) && (info->age < 255)) { char age[5]; snprintf(age, sizeof(age), "%hhd", info->age); - purple_notify_user_info_add_pair(user_info, _("Age"), age); + purple_notify_user_info_add_pair_plaintext(user_info, _("Age"), age); } + /* TODO: Is it correct to pass info->email here...? */ oscar_user_info_convert_and_add_hyperlink(account, od, user_info, _("Personal Web Page"), info->email, ""); if (buddy != NULL) oscar_user_info_append_status(gc, user_info, buddy, /* aim_userinfo_t */ NULL, /* use_html_status */ TRUE); @@ -482,6 +481,7 @@ oscar_user_info_display_icq(OscarData *od, struct aim_icq_info *info) oscar_user_info_convert_and_add(account, od, user_info, _("Company"), info->workcompany); oscar_user_info_convert_and_add(account, od, user_info, _("Division"), info->workdivision); oscar_user_info_convert_and_add(account, od, user_info, _("Position"), info->workposition); + /* TODO: Is it correct to pass info->email here...? */ oscar_user_info_convert_and_add_hyperlink(account, od, user_info, _("Web Page"), info->email, ""); } @@ -505,7 +505,7 @@ oscar_user_info_display_aim(OscarData *od, aim_userinfo_t *userinfo) if ((userinfo->present & AIM_USERINFO_PRESENT_IDLE) && userinfo->idletime != 0) { tmp = purple_str_seconds_to_string(userinfo->idletime*60); - oscar_user_info_add_pair(user_info, _("Idle"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Idle"), tmp); g_free(tmp); } @@ -514,17 +514,18 @@ oscar_user_info_display_aim(OscarData *od, aim_userinfo_t *userinfo) if ((userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) && !oscar_util_valid_name_sms(userinfo->bn)) { /* An SMS contact is always online; its Online Since value is not useful */ time_t t = userinfo->onlinesince; - oscar_user_info_add_pair(user_info, _("Online Since"), purple_date_format_full(localtime(&t))); + purple_notify_user_info_add_pair_plaintext(user_info, _("Online Since"), purple_date_format_full(localtime(&t))); } if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { time_t t = userinfo->membersince; - oscar_user_info_add_pair(user_info, _("Member Since"), purple_date_format_full(localtime(&t))); + purple_notify_user_info_add_pair_plaintext(user_info, _("Member Since"), purple_date_format_full(localtime(&t))); } if (userinfo->capabilities != 0) { tmp = oscar_caps_to_string(userinfo->capabilities); - oscar_user_info_add_pair(user_info, _("Capabilities"), tmp); + if (tmp && *tmp) + purple_notify_user_info_add_pair_plaintext(user_info, _("Capabilities"), tmp); g_free(tmp); } @@ -533,7 +534,11 @@ oscar_user_info_display_aim(OscarData *od, aim_userinfo_t *userinfo) info_utf8 = oscar_encoding_to_utf8(userinfo->info_encoding, userinfo->info, userinfo->info_len); tmp = oscar_util_format_string(info_utf8, purple_account_get_username(account)); purple_notify_user_info_add_section_break(user_info); - oscar_user_info_add_pair(user_info, _("Profile"), tmp); + if (tmp && *tmp) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ + purple_notify_user_info_add_pair(user_info, _("Profile"), tmp); + } g_free(tmp); g_free(info_utf8); } diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 49a20918e1..50290dcdbe 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -3337,13 +3337,13 @@ static void mw_prpl_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info purple_notify_user_info_add_pair_plaintext(user_info, status, message); } else { - purple_notify_user_info_add_pair(user_info, _("Status"), status); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), status); } if(full && pd != NULL) { tmp = user_supports_text(pd->srvc_aware, purple_buddy_get_name(b)); if(tmp) { - purple_notify_user_info_add_pair(user_info, _("Supports"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Supports"), tmp); g_free(tmp); } @@ -4201,43 +4201,44 @@ static void mw_prpl_get_info(PurpleConnection *gc, const char *who) { purple_notify_user_info_add_pair(user_info, _("External User"), NULL); } - purple_notify_user_info_add_pair(user_info, _("User ID"), who); + purple_notify_user_info_add_pair_plaintext(user_info, _("User ID"), who); if(b) { guint32 type; if(purple_buddy_get_server_alias(b)) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Full Name"), purple_buddy_get_server_alias(b)); } type = purple_blist_node_get_int((PurpleBlistNode *) b, BUDDY_KEY_CLIENT); if(type) { - tmp = g_strdup(mw_client_name(type)); - if (!tmp) + tmp2 = mw_client_name(type); + if (tmp2) { + purple_notify_user_info_add_pair_plaintext(user_info, _("Last Known Client"), tmp2); + } else { tmp = g_strdup_printf(_("Unknown (0x%04x)
"), type); - - purple_notify_user_info_add_pair(user_info, _("Last Known Client"), tmp); - - g_free(tmp); + purple_notify_user_info_add_pair(user_info, _("Last Known Client"), tmp); + g_free(tmp); + } } } tmp = user_supports_text(pd->srvc_aware, who); if(tmp) { - purple_notify_user_info_add_pair(user_info, _("Supports"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Supports"), tmp); g_free(tmp); } if(b) { - purple_notify_user_info_add_pair(user_info, _("Status"), status_text(b)); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), status_text(b)); /* XXX Is this adding a status message in its own section rather than with the "Status" label? */ tmp2 = mwServiceAware_getText(pd->srvc_aware, &idb); if(tmp2 && g_utf8_validate(tmp2, -1, NULL)) { - tmp = g_markup_escape_text(tmp2, -1); purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); + purple_notify_user_info_add_pair_plaintext(user_info, NULL, tmp2); } } diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c index 224c753366..f8c8e1cd1f 100644 --- a/libpurple/protocols/silc/buddy.c +++ b/libpurple/protocols/silc/buddy.c @@ -1547,53 +1547,71 @@ void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gb return; if (client_entry->nickname) + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Nickname"), client_entry->nickname); if (client_entry->username && client_entry->hostname) { g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Username"), tmp); } if (client_entry->mode) { memset(tmp, 0, sizeof(tmp)); silcpurple_get_umode_string(client_entry->mode, tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("User Modes"), tmp); } silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); if (statusstr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Message"), statusstr); g_free(statusstr); } if (full) { if (moodstr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); g_free(moodstr); } if (contactstr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); g_free(contactstr); } if (langstr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); g_free(langstr); } if (devicestr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); g_free(devicestr); } if (tzstr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); g_free(tzstr); } if (geostr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); g_free(geostr); } diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c index 2ff01fef1b..ad23aab08c 100644 --- a/libpurple/protocols/silc/ops.c +++ b/libpurple/protocols/silc/ops.c @@ -1162,7 +1162,7 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, SilcUInt32 idle, *user_modes; SilcDList channels; SilcClientEntry client_entry; - char tmp[1024], *tmp2; + char tmp[1024]; char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; PurpleNotifyUserInfo *user_info; @@ -1184,71 +1184,80 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, user_modes = va_arg(ap, SilcUInt32 *); user_info = purple_notify_user_info_new(); - tmp2 = g_markup_escape_text(client_entry->nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp2); - g_free(tmp2); + purple_notify_user_info_add_pair_plaintext(user_info, _("Nickname"), client_entry->nickname); if (client_entry->realname) { - tmp2 = g_markup_escape_text(client_entry->realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp2); - g_free(tmp2); + purple_notify_user_info_add_pair_plaintext(user_info, _("Real Name"), client_entry->realname); } - tmp2 = g_markup_escape_text(client_entry->username, -1); if (*client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); + gchar *tmp2; + tmp2 = g_strdup_printf("%s@%s", client_entry->username, client_entry->hostname); + purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), tmp2); + g_free(tmp2); } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp2); - g_free(tmp2); + purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), client_entry->username); if (client_entry->mode) { memset(tmp, 0, sizeof(tmp)); silcpurple_get_umode_string(client_entry->mode, tmp, sizeof(tmp) - strlen(tmp)); + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); } silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); if (moodstr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); g_free(moodstr); } if (statusstr) { - tmp2 = g_markup_escape_text(statusstr, -1); - purple_notify_user_info_add_pair(user_info, _("Status Text"), tmp2); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status Text"), statusstr); g_free(statusstr); - g_free(tmp2); } if (contactstr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); g_free(contactstr); } if (langstr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); g_free(langstr); } if (devicestr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); g_free(devicestr); } if (tzstr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); g_free(tzstr); } if (geostr) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); g_free(geostr); } - if (*client_entry->server) + if (*client_entry->server) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); + } if (channels && user_modes) { SilcChannelPayload entry; @@ -1266,9 +1275,7 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, silc_strncat(tmp, sizeof(tmp) - 1, " ", 1); silc_free(m); } - tmp2 = g_markup_escape_text(tmp, -1); - purple_notify_user_info_add_pair(user_info, _("Currently on"), tmp2); - g_free(tmp2); + purple_notify_user_info_add_pair_plaintext(user_info, _("Currently on"), tmp); } if (client_entry->public_key) { @@ -1279,8 +1286,8 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, if (pk) { fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); + purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Fingerprint"), fingerprint); + purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Babbleprint"), babbleprint); silc_free(fingerprint); silc_free(babbleprint); silc_free(pk); @@ -1304,7 +1311,7 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, case SILC_COMMAND_WHOWAS: { SilcClientEntry client_entry; - char *nickname, *realname, *username, *tmp; + char *nickname, *realname, *username; PurpleNotifyUserInfo *user_info; if (status != SILC_STATUS_OK) { @@ -1322,27 +1329,23 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, break; user_info = purple_notify_user_info_new(); - tmp = g_markup_escape_text(nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); - if (realname) { - tmp = g_markup_escape_text(realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp); - g_free(tmp); - } + purple_notify_user_info_add_pair_plaintext(user_info, _("Nickname"), nickname); + if (realname) + purple_notify_user_info_add_pair_plaintext(user_info, _("Real Name"), realname); if (username) { - tmp = g_markup_escape_text(username, -1); if (client_entry && *client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); + gchar *tmp; + tmp = g_strdup_printf("%s@%s", username, client_entry->hostname); + purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), tmp); + g_free(tmp); } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - g_free(tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Username"), username); } - if (client_entry && *client_entry->server) + if (client_entry && *client_entry->server) { + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); + } if (client_entry && client_entry->public_key) { @@ -1353,8 +1356,8 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, if (pk) { fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); + purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Fingerprint"), fingerprint); + purple_notify_user_info_add_pair_plaintext(user_info, _("Public Key Babbleprint"), babbleprint); silc_free(fingerprint); silc_free(babbleprint); silc_free(pk); diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index dc94cca80c..14788ed3d9 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -791,18 +791,21 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) char *tmp; const char *balias; + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); balias = purple_buddy_get_local_buddy_alias(b); if (b && balias) - purple_notify_user_info_add_pair(user_info, _("Alias"), balias); + purple_notify_user_info_add_pair_plaintext(user_info, _("Alias"), balias); if (!nlocs) { - purple_notify_user_info_add_pair(user_info, NULL, _("Hidden or not logged-in")); + purple_notify_user_info_add_pair_plaintext(user_info, NULL, _("Hidden or not logged-in")); } for (; nlocs > 0; nlocs--) { /* XXX add real error reporting */ ZGetLocations(&locs, &one); + /* TODO: Need to escape locs.host and locs.time? */ tmp = g_strdup_printf(_("
At %s since %s"), locs.host, locs.time); purple_notify_user_info_add_pair(user_info, _("Location"), tmp); g_free(tmp); @@ -1173,15 +1176,18 @@ static gint check_notify_tzc(gpointer data) char *tmp; const char *balias; + /* TODO: Check whether it's correct to call add_pair_html, + or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); balias = b ? purple_buddy_get_local_buddy_alias(b) : NULL; if (balias) - purple_notify_user_info_add_pair(user_info, _("Alias"), balias); + purple_notify_user_info_add_pair_plaintext(user_info, _("Alias"), balias); if (!nlocs) { - purple_notify_user_info_add_pair(user_info, NULL, _("Hidden or not logged-in")); + purple_notify_user_info_add_pair_plaintext(user_info, NULL, _("Hidden or not logged-in")); } else { + /* TODO: Need to escape the two strings that make up tmp? */ tmp = g_strdup_printf(_("
At %s since %s"), tree_child(tree_child(tree_child(tree_child(locations,2),0),0),2)->contents, tree_child(tree_child(tree_child(tree_child(locations,2),0),2),2)->contents); diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 075c585146..fb386a6cfb 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3774,10 +3774,8 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) connections = purple_connections_get_all(); if (full && connections && connections->next) { - tmp = g_markup_escape_text(purple_account_get_username( - purple_buddy_get_account(b)), -1); - purple_notify_user_info_add_pair(user_info, _("Account"), tmp); - g_free(tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), + purple_account_get_username(purple_buddy_get_account(b))); } /* Alias */ @@ -3787,9 +3785,8 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) (c->alias != NULL && c->alias[0] != '\0') && strcmp(c->alias, b->alias) != 0) { - tmp = g_markup_escape_text(b->alias, -1); - purple_notify_user_info_add_pair(user_info, _("Buddy Alias"), tmp); - g_free(tmp); + purple_notify_user_info_add_pair_plaintext(user_info, + _("Buddy Alias"), b->alias); } /* Nickname/Server Alias */ @@ -3799,9 +3796,8 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) * to look at the tooltip. */ if (full && b->server_alias != NULL && b->server_alias[0] != '\0') { - tmp = g_markup_escape_text(b->server_alias, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); + purple_notify_user_info_add_pair_plaintext(user_info, + _("Nickname"), b->server_alias); } /* Logged In */ @@ -3817,7 +3813,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) tmp = g_strdup(purple_date_format_long(localtime(&signon))); } else tmp = purple_str_seconds_to_string(time(NULL) - signon); - purple_notify_user_info_add_pair(user_info, _("Logged In"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Logged In"), tmp); g_free(tmp); } @@ -3828,7 +3824,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) if (idle_secs > 0) { tmp = purple_str_seconds_to_string(time(NULL) - idle_secs); - purple_notify_user_info_add_pair(user_info, _("Idle"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Idle"), tmp); g_free(tmp); } } @@ -3863,7 +3859,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) if (lastseen > 0) { tmp = purple_str_seconds_to_string(time(NULL) - lastseen); - purple_notify_user_info_add_pair(user_info, _("Last Seen"), tmp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Last Seen"), tmp); g_free(tmp); } } @@ -3873,7 +3869,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) /* FIXME: Why is this status special-cased by the core? --rlaager * FIXME: Alternatively, why not have the core do all of them? --rlaager */ if (!PURPLE_BUDDY_IS_ONLINE(b)) { - purple_notify_user_info_add_pair(user_info, _("Status"), _("Offline")); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Offline")); } if (purple_account_is_connected(b->account) && @@ -3885,11 +3881,11 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) /* These are Easter Eggs. Patches to remove them will be rejected. */ if (!g_ascii_strcasecmp(b->name, "robflynn")) - purple_notify_user_info_add_pair(user_info, _("Description"), _("Spooky")); + purple_notify_user_info_add_pair_plaintext(user_info, _("Description"), _("Spooky")); if (!g_ascii_strcasecmp(b->name, "seanegn")) - purple_notify_user_info_add_pair(user_info, _("Status"), _("Awesome")); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Awesome")); if (!g_ascii_strcasecmp(b->name, "chipx86")) - purple_notify_user_info_add_pair(user_info, _("Status"), _("Rockin'")); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Rockin'")); tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n"); g_string_append(str, tmp); @@ -3904,24 +3900,21 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) user_info = purple_notify_user_info_new(); count = purple_blist_get_group_online_count(group); - if (count != 0) { /* Online buddies in group */ - tmp = g_strdup_printf("%d", count); - purple_notify_user_info_add_pair(user_info, - _("Online Buddies"), - tmp); - g_free(tmp); + char tmp2[12]; + sprintf(tmp2, "%d", count); + purple_notify_user_info_add_pair_plaintext(user_info, + _("Online Buddies"), tmp2); } count = purple_blist_get_group_size(group, FALSE); if (count != 0) { /* Total buddies (from online accounts) in group */ - tmp = g_strdup_printf("%d", count); + char tmp2[12]; + sprintf(tmp2, "%d", count); purple_notify_user_info_add_pair(user_info, - _("Total Buddies"), - tmp); - g_free(tmp); + _("Total Buddies"), tmp2); } tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n"); diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index c2999fab62..bff3bdf701 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -984,7 +984,7 @@ static void show_retrieveing_info(PurpleConnection *conn, const char *name) { PurpleNotifyUserInfo *info = purple_notify_user_info_new(); - purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); + purple_notify_user_info_add_pair_plaintext(info, _("Information"), _("Retrieving...")); purple_notify_userinfo(conn, name, info, NULL, NULL); purple_notify_user_info_destroy(info); } -- cgit v1.2.1 From bf452242b96a03ae10d34d51fee56cd832aaea83 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 02:07:41 +0000 Subject: Don't use strlen() when all you're trying to do is check if the string is empty --- ChangeLog.API | 6 ++++-- libpurple/protocols/mxit/profile.c | 4 ++-- libpurple/protocols/mxit/protocol.c | 8 ++++---- libpurple/protocols/null/nullprpl.c | 4 ++-- libpurple/protocols/oscar/family_feedbag.c | 4 ++-- libpurple/protocols/sametime/sametime.c | 2 +- libpurple/protocols/zephyr/zephyr.c | 4 ++-- libpurple/upnp.c | 4 ++-- libpurple/util.c | 4 ++-- pidgin/gtkimhtml.c | 6 +++--- 10 files changed, 24 insertions(+), 22 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index b55319dfba..bc471260e4 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -9,12 +9,14 @@ version 3.0.0 (??/??/????): * purple_request_field_get_tooltip Changed: + * purple_connection_error now takes a PurpleConnectionError + as the second parameter + * purple_notify_user_info_add_pair renamed to + purple_notify_user_info_add_pair_html * purple_util_fetch_url_request_len now takes a PurpleAccount as the first parameter * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter - * purple_connection_error now takes a PurpleConnectionError - as the second parameter Removed: * GtkIMHtml.clipboard_html_string diff --git a/libpurple/protocols/mxit/profile.c b/libpurple/protocols/mxit/profile.c index 91e4d125d2..d79faa94f4 100644 --- a/libpurple/protocols/mxit/profile.c +++ b/libpurple/protocols/mxit/profile.c @@ -198,12 +198,12 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Country" ), profile->regcountry ); - if ( strlen( profile->aboutme ) > 0 ) { + if ( *profile->aboutme ) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "About Me" ), profile->aboutme ); } - if ( strlen( profile->whereami ) > 0 ) { + if ( *profile->whereami ) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair( info, _( "Where I Live" ), profile->whereami ); diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index 12f7bb9d56..7bcfa1ee68 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -1648,7 +1648,7 @@ static void mxit_parse_cmd_new_sub( struct MXitSession* session, struct record** if ( rec->fcount >= 5 ) { /* there is a personal invite message attached */ - if ( ( rec->fields[4]->data ) && ( strlen( rec->fields[4]->data ) > 0 ) ) + if ( ( rec->fields[4]->data ) && ( *rec->fields[4]->data ) ) contact->msg = strdup( rec->fields[4]->data ); } @@ -1890,7 +1890,7 @@ static void mxit_parse_cmd_extprofile( struct MXitSession* session, struct recor contact = get_mxit_invite_contact( session, mxitId ); if ( contact ) { /* this is an invite, so update its profile info */ - if ( ( statusMsg ) && ( strlen( statusMsg ) > 0 ) ) { + if ( ( statusMsg ) && ( *statusMsg ) ) { /* update the status message */ if ( contact->statusMsg ) g_free( contact->statusMsg ); @@ -1901,7 +1901,7 @@ static void mxit_parse_cmd_extprofile( struct MXitSession* session, struct recor if ( contact->profile ) g_free( contact->profile ); contact->profile = profile; - if ( ( avatarId ) && ( strlen( avatarId ) > 0 ) ) { + if ( ( avatarId ) && ( *avatarId ) ) { /* avatar must be requested for this invite before we can display it */ mxit_get_avatar( session, mxitId, avatarId ); if ( contact->avatarId ) @@ -1919,7 +1919,7 @@ static void mxit_parse_cmd_extprofile( struct MXitSession* session, struct recor if ( avatarId ) mxit_update_buddy_avatar( session, mxitId, avatarId ); - if ( ( statusMsg ) && ( strlen( statusMsg ) > 0 ) ) { + if ( ( statusMsg ) && ( *statusMsg ) ) { /* update the status message */ PurpleBuddy* buddy = NULL; diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index 755b701af9..b525774cea 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -234,7 +234,7 @@ static char *nullprpl_status_text(PurpleBuddy *buddy) { const char *message = purple_status_get_attr_string(status, "message"); char *text; - if (message && strlen(message) > 0) + if (message && *message) text = g_strdup_printf("%s: %s", name, message); else text = g_strdup(name); @@ -933,7 +933,7 @@ static void set_chat_topic_fn(PurpleConvChat *from, PurpleConvChat *to, purple_conv_chat_set_topic(to, username, topic); - if (topic && strlen(topic) > 0) + if (topic && *topic) msg = g_strdup_printf(_("%s sets topic to: %s"), username, topic); else msg = g_strdup_printf(_("%s clears topic"), username); diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c index 2be0bed940..9f3cfca269 100644 --- a/libpurple/protocols/oscar/family_feedbag.c +++ b/libpurple/protocols/oscar/family_feedbag.c @@ -990,7 +990,7 @@ int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *bn, const char return -EINVAL; /* Either add or remove the 0x0131 TLV from the TLV chain */ - if ((alias != NULL) && (strlen(alias) > 0)) + if (alias && *alias) aim_tlvlist_replace_str(&tmp->data, 0x0131, alias); else aim_tlvlist_remove(&tmp->data, 0x0131); @@ -1020,7 +1020,7 @@ int aim_ssi_editcomment(OscarData *od, const char *gn, const char *bn, const cha return -EINVAL; /* Either add or remove the 0x0131 TLV from the TLV chain */ - if ((comment != NULL) && (strlen(comment) > 0)) + if (comment && *comment) aim_tlvlist_replace_str(&tmp->data, 0x013c, comment); else aim_tlvlist_remove(&tmp->data, 0x013c); diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 50290dcdbe..15a7918ce9 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -861,7 +861,7 @@ static PurpleBuddy *buddy_ensure(PurpleConnection *gc, PurpleGroup *group, enum mwSametimeUserType type = mwSametimeUser_getType(stuser); g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(strlen(id) > 0, NULL); + g_return_val_if_fail(*id, NULL); buddy = purple_find_buddy_in_group(acct, id, group); if(! buddy) { diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 14788ed3d9..c75fdef412 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -2085,7 +2085,7 @@ static char* zephyr_tzc_escape_msg(const char *message) int pos2 = 0; char *newmsg; - if (message && (strlen(message) > 0)) { + if (message && *message) { newmsg = g_new0(char,1+strlen(message)*2); while(pos < strlen(message)) { if (message[pos]=='\\') { @@ -2117,7 +2117,7 @@ char* zephyr_tzc_deescape_str(const char *message) int pos2 = 0; char *newmsg; - if (message && (strlen(message) > 0)) { + if (message && *message) { newmsg = g_new0(char,strlen(message)+1); while(pos < strlen(message)) { if (message[pos]=='\\') { diff --git a/libpurple/upnp.c b/libpurple/upnp.c index 28090d9e4b..923417fc7f 100644 --- a/libpurple/upnp.c +++ b/libpurple/upnp.c @@ -744,7 +744,7 @@ purple_upnp_get_public_ip() { if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERED && control_info.publicip - && strlen(control_info.publicip) > 0) + && *control_info.publicip) return control_info.publicip; /* Trigger another UPnP discovery if 5 minutes have elapsed since the @@ -803,7 +803,7 @@ purple_upnp_get_internal_ip(void) { if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERED && control_info.internalip - && strlen(control_info.internalip) > 0) + && *control_info.internalip) return control_info.internalip; /* Trigger another UPnP discovery if 5 minutes have elapsed since the diff --git a/libpurple/util.c b/libpurple/util.c index 5a8494fe91..f6b3be1675 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -147,7 +147,7 @@ purple_base16_decode(const char *str, gsize *ret_len) len = strlen(str); - g_return_val_if_fail(strlen(str) > 0, 0); + g_return_val_if_fail(*str, 0); g_return_val_if_fail(len % 2 == 0, 0); data = g_malloc(len / 2); @@ -2267,7 +2267,7 @@ purple_markup_linkify(const char *text) url_buf = g_string_free(gurl_buf, FALSE); /* strip off trailing periods */ - if (strlen(url_buf) > 0) { + if (*url_buf) { for (d = url_buf + strlen(url_buf) - 1; *d == '.'; d--, t--) *d = '\0'; } diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 905430fcea..5dc462d659 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -5367,9 +5367,9 @@ char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkText tag = sl->data; /** don't worry about non-printing tags ending */ if (tag_ends_here(tag, &iter, &next_iter) && - strlen(tag_to_html_end(tag)) > 0 && - strlen(tag_to_html_start(tag)) > 0) { - + *tag_to_html_end(tag) && + *tag_to_html_start(tag)) + { PidginTextTagData *tmp; GQueue *r = g_queue_new(); -- cgit v1.2.1 From 35e4a3938a3e61260259d41d3b3e8260d5f9d98e Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 02:11:36 +0000 Subject: Don't use strlen() when you're just checking whether a string is empty --- libpurple/protocols/gg/buddylist.c | 2 +- libpurple/protocols/mxit/login.c | 2 +- libpurple/protocols/mxit/profile.c | 2 +- libpurple/protocols/mxit/voicevideo.c | 2 +- libpurple/protocols/null/nullprpl.c | 4 ++-- libpurple/protocols/zephyr/zephyr.c | 2 +- pidgin/gtkconv.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libpurple/protocols/gg/buddylist.c b/libpurple/protocols/gg/buddylist.c index 5f361d2b74..7ed9439f4e 100644 --- a/libpurple/protocols/gg/buddylist.c +++ b/libpurple/protocols/gg/buddylist.c @@ -90,7 +90,7 @@ void ggp_buddylist_load(PurpleConnection *gc, char *buddylist) gchar **data_tbl; gchar *name, *show, *g; - if (strlen(users_tbl[i]) == 0) + if (!*users_tbl[i]) continue; data_tbl = g_strsplit(users_tbl[i], ";", 8); diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index ab042052e0..509d58beee 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -743,7 +743,7 @@ void mxit_login( PurpleAccount* account ) * if we don't have any info saved from a previous login, we need to get it from the MXit WAP site. * we do cache it, so this step is only done on the very first login for each account. */ - if ( ( session->distcode == NULL ) || ( strlen( session->distcode ) == 0 ) ) { + if ( ( session->distcode == NULL ) || ( !*session->distcode ) ) { /* this must be the very first login, so we need to retrieve the user information */ get_clientinfo( session ); } diff --git a/libpurple/protocols/mxit/profile.c b/libpurple/protocols/mxit/profile.c index d79faa94f4..c16916560a 100644 --- a/libpurple/protocols/mxit/profile.c +++ b/libpurple/protocols/mxit/profile.c @@ -115,7 +115,7 @@ static int calculateAge( const char* date ) struct tm now, bdate; int age; - if ( ( !date ) || ( strlen( date ) == 0 ) ) + if ( ( !date ) || ( !*date ) ) return 0; /* current time */ diff --git a/libpurple/protocols/mxit/voicevideo.c b/libpurple/protocols/mxit/voicevideo.c index 230801105f..246d14671d 100644 --- a/libpurple/protocols/mxit/voicevideo.c +++ b/libpurple/protocols/mxit/voicevideo.c @@ -71,7 +71,7 @@ PurpleMediaCaps mxit_media_caps(PurpleAccount *account, const char *who) purple_debug_info(MXIT_PLUGIN_ID, "mxit_media_caps: buddy '%s'\n", who); /* We need to have a voice/video server */ - if (strlen(session->voip_server) == 0) + if (!*session->voip_server) return PURPLE_MEDIA_CAPS_NONE; /* find the buddy information for this contact (reference: "libpurple/blist.h") */ diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index b525774cea..32b61f39c9 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -781,10 +781,10 @@ static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, to_username = args[0]; message = args[1]; - if (!to_username || strlen(to_username) == 0) { + if (!to_username || !*to_username) { *error = g_strdup(_("Whisper is missing recipient.")); return PURPLE_CMD_RET_FAILED; - } else if (!message || strlen(message) == 0) { + } else if (!message || !*message) { *error = g_strdup(_("Whisper is missing message.")); return PURPLE_CMD_RET_FAILED; } diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index c75fdef412..39f131da79 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -1164,7 +1164,7 @@ static gint check_notify_tzc(gpointer data) locations = find_node(newparsetree,"locations"); locval = tree_child(tree_child(tree_child(tree_child(locations,2),0),0),2)->contents; - if (!locval || !g_ascii_strcasecmp(locval," ") || (strlen(locval) == 0)) { + if (!locval || !g_ascii_strcasecmp(locval," ") || !*locval) { nlocs = 0; } else { nlocs = 1; diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index f76dcc4058..46d8d5998c 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -578,7 +578,7 @@ send_cb(GtkWidget *widget, PidginConversation *gtkconv) gtk_widget_grab_focus(gtkconv->entry); - if (strlen(clean) == 0) { + if (!*clean) { g_free(buf); g_free(clean); return; -- cgit v1.2.1 From 1044689d7152d972316392bc24b19dcdec4a436a Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 02:23:28 +0000 Subject: Rename purple_notify_user_info_add_pair to purple_notify_user_info_add_pair_html, to be more explicit so hopefully people don't pass this non-html in the future. --- libpurple/notify.c | 6 ++---- libpurple/notify.h | 13 ++++--------- libpurple/protocols/bonjour/bonjour.c | 12 ++++++------ libpurple/protocols/gg/gg.c | 10 +++++----- libpurple/protocols/irc/msgs.c | 2 +- libpurple/protocols/jabber/buddy.c | 6 +++--- libpurple/protocols/jabber/jabber.c | 12 ++++++------ libpurple/protocols/msn/msn.c | 20 ++++++++++---------- libpurple/protocols/mxit/mxit.c | 4 ++-- libpurple/protocols/mxit/profile.c | 22 +++++++++++----------- libpurple/protocols/myspace/user.c | 2 +- libpurple/protocols/novell/novell.c | 10 +++++----- libpurple/protocols/oscar/oscar.c | 8 ++++---- libpurple/protocols/oscar/userinfo.c | 12 ++++++------ libpurple/protocols/sametime/sametime.c | 6 +++--- libpurple/protocols/silc/buddy.c | 18 +++++++++--------- libpurple/protocols/silc/ops.c | 18 +++++++++--------- libpurple/protocols/yahoo/yahoo_profile.c | 10 +++++----- libpurple/protocols/zephyr/zephyr.c | 8 ++++---- libpurple/util.c | 2 +- pidgin/gtkblist.c | 2 +- 21 files changed, 98 insertions(+), 105 deletions(-) diff --git a/libpurple/notify.c b/libpurple/notify.c index d8efb0347a..f9132f00b3 100644 --- a/libpurple/notify.c +++ b/libpurple/notify.c @@ -575,7 +575,7 @@ purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entr } void -purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value) +purple_notify_user_info_add_pair_html(PurpleNotifyUserInfo *user_info, const char *label, const char *value) { PurpleNotifyUserInfoEntry *entry; @@ -587,12 +587,10 @@ void purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value) { gchar *escaped; - PurpleNotifyUserInfoEntry *entry; escaped = g_markup_escape_text(value, -1); - entry = purple_notify_user_info_entry_new(label, escaped); + purple_notify_user_info_add_pair_html(user_info, label, escaped); g_free(escaped); - user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); } void diff --git a/libpurple/notify.h b/libpurple/notify.h index b8aeff204d..8ac1659070 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -480,16 +480,10 @@ char *purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_i * the UI should treat label as independent and not * include a colon if it would otherwise. */ -/* - * TODO: In 3.0.0 this function should be renamed to - * purple_notify_user_info_add_pair_html(). And optionally - * purple_notify_user_info_add_pair_plaintext() could be renamed to - * purple_notify_user_info_add_pair(). - */ -void purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value); +void purple_notify_user_info_add_pair_html(PurpleNotifyUserInfo *user_info, const char *label, const char *value); /** - * Like purple_notify_user_info_add_pair, but value should be plaintext + * Like purple_notify_user_info_add_pair_html, but value should be plaintext * and will be escaped using g_markup_escape_text(). */ void purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value); @@ -530,7 +524,8 @@ void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, Purpl * * If added to a PurpleNotifyUserInfo object, this should not be free()'d, * as PurpleNotifyUserInfo will do so when destroyed. - * purple_notify_user_info_add_pair() and + * purple_notify_user_info_add_pair_html(), + * purple_notify_user_info_add_pair_plaintext() and * purple_notify_user_info_prepend_pair() are convenience methods for * creating entries and adding them to a PurpleNotifyUserInfo. * diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c index 5526b6d071..805f4d3b10 100644 --- a/libpurple/protocols/bonjour/bonjour.c +++ b/libpurple/protocols/bonjour/bonjour.c @@ -375,7 +375,7 @@ bonjour_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboole if (message != NULL) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Message"), message); + purple_notify_user_info_add_pair_html(user_info, _("Message"), message); } if (bb == NULL) { @@ -388,31 +388,31 @@ bonjour_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboole if (bb->first != NULL && *bb->first != '\0') { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("First name"), bb->first); + purple_notify_user_info_add_pair_html(user_info, _("First name"), bb->first); } if (bb->last != NULL && *bb->last != '\0') { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Last name"), bb->last); + purple_notify_user_info_add_pair_html(user_info, _("Last name"), bb->last); } } if (bb->email != NULL && *bb->email != '\0') { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Email"), bb->email); + purple_notify_user_info_add_pair_html(user_info, _("Email"), bb->email); } if (bb->AIM != NULL && *bb->AIM != '\0') { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("AIM Account"), bb->AIM); + purple_notify_user_info_add_pair_html(user_info, _("AIM Account"), bb->AIM); } if (bb->jid != NULL && *bb->jid != '\0') { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("XMPP Account"), bb->jid); + purple_notify_user_info_add_pair_html(user_info, _("XMPP Account"), bb->jid); } } diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 070ff33d98..5f859ca76a 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -1200,31 +1200,31 @@ static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req, who = ggp_search_get_result(req, 0, GG_PUBDIR50_UIN); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("UIN"), who); + purple_notify_user_info_add_pair_html(user_info, _("UIN"), who); val = ggp_search_get_result(req, 0, GG_PUBDIR50_FIRSTNAME); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("First Name"), val); + purple_notify_user_info_add_pair_html(user_info, _("First Name"), val); g_free(val); val = ggp_search_get_result(req, 0, GG_PUBDIR50_NICKNAME); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Nickname"), val); + purple_notify_user_info_add_pair_html(user_info, _("Nickname"), val); g_free(val); val = ggp_search_get_result(req, 0, GG_PUBDIR50_CITY); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("City"), val); + purple_notify_user_info_add_pair_html(user_info, _("City"), val); g_free(val); val = ggp_search_get_result(req, 0, GG_PUBDIR50_BIRTHYEAR); if (strncmp(val, "0", 1)) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Birth Year"), val); + purple_notify_user_info_add_pair_html(user_info, _("Birth Year"), val); } g_free(val); diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c index 762492d833..4ee1c19e95 100644 --- a/libpurple/protocols/irc/msgs.c +++ b/libpurple/protocols/irc/msgs.c @@ -352,7 +352,7 @@ void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, tmp = g_strdup_printf("%s%s%s", tmp2, (irc->whois.ircop ? _(" (ircop)") : ""), (irc->whois.identified ? _(" (identified)") : "")); - purple_notify_user_info_add_pair(user_info, _("Nick"), tmp); + purple_notify_user_info_add_pair_html(user_info, _("Nick"), tmp); g_free(tmp2); g_free(tmp); diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 26addca206..3e532d6258 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -1136,7 +1136,7 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, char *mailto; escaped = g_markup_escape_text(userid, -1); mailto = g_strdup_printf("%s", escaped, escaped); - purple_notify_user_info_add_pair(user_info, _("Email"), mailto); + purple_notify_user_info_add_pair_html(user_info, _("Email"), mailto); g_free(mailto); g_free(escaped); @@ -1149,7 +1149,7 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, escaped = g_markup_escape_text(userid, -1); mailto = g_strdup_printf("%s", escaped, escaped); - purple_notify_user_info_add_pair(user_info, _("Email"), mailto); + purple_notify_user_info_add_pair_html(user_info, _("Email"), mailto); g_free(mailto); g_free(escaped); @@ -1196,7 +1196,7 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, jbi->vcard_imgids = g_slist_prepend(jbi->vcard_imgids, GINT_TO_POINTER(purple_imgstore_add_with_id(g_memdup(data, size), size, "logo.png"))); img_text = g_strdup_printf("", GPOINTER_TO_INT(jbi->vcard_imgids->data)); - purple_notify_user_info_add_pair(user_info, (photo ? _("Photo") : _("Logo")), img_text); + purple_notify_user_info_add_pair_html(user_info, (photo ? _("Photo") : _("Logo")), img_text); hash = jabber_calculate_data_hash(data, size, "sha1"); purple_buddy_icons_set_for_user(account, bare_jid, data, size, hash); diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index cb612d1eab..bb185aa92f 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -2225,7 +2225,7 @@ jabber_tooltip_add_resource_text(JabberBuddyResource *jbr, label = g_strdup_printf("%s%s", _("Status"), (res ? res : "")); value = g_strdup_printf("%s%s%s", state, (text ? ": " : ""), (text ? text : "")); - purple_notify_user_info_add_pair(user_info, label, value); + purple_notify_user_info_add_pair_html(user_info, label, value); g_free(label); g_free(value); g_free(text); @@ -2310,10 +2310,10 @@ void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboole char *moodplustext = g_strdup_printf("%s (%s)", description ? _(description) : mood, moodtext); - purple_notify_user_info_add_pair(user_info, _("Mood"), moodplustext); + purple_notify_user_info_add_pair_html(user_info, _("Mood"), moodplustext); g_free(moodplustext); } else - purple_notify_user_info_add_pair(user_info, _("Mood"), + purple_notify_user_info_add_pair_html(user_info, _("Mood"), description ? _(description) : mood); } if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { @@ -2323,7 +2323,7 @@ void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboole const char *album = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); char *playing = purple_util_format_song_info(title, artist, album, NULL); if (playing) { - purple_notify_user_info_add_pair(user_info, _("Now Listening"), playing); + purple_notify_user_info_add_pair_html(user_info, _("Now Listening"), playing); g_free(playing); } } @@ -2344,12 +2344,12 @@ void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboole sub = _("None"); } - purple_notify_user_info_add_pair(user_info, _("Subscription"), sub); + purple_notify_user_info_add_pair_html(user_info, _("Subscription"), sub); } if(!PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { - purple_notify_user_info_add_pair(user_info, _("Error"), jb->error_msg); + purple_notify_user_info_add_pair_html(user_info, _("Error"), jb->error_msg); } } } diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 43b4e34eb1..0b6729a594 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -1078,7 +1078,7 @@ msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean f if (psm != NULL && *psm) { purple_notify_user_info_add_pair_plaintext(user_info, tmp2, psm); } else { - purple_notify_user_info_add_pair(user_info, _("Status"), tmp2); + purple_notify_user_info_add_pair_html(user_info, _("Status"), tmp2); } g_free(tmp2); @@ -1103,7 +1103,7 @@ msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean f if (currentmedia) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, mediatype, currentmedia); + purple_notify_user_info_add_pair_html(user_info, mediatype, currentmedia); g_free(currentmedia); } } @@ -1131,21 +1131,21 @@ msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean f if (phone != NULL) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), phone); + purple_notify_user_info_add_pair_html(user_info, _("Home Phone Number"), phone); } phone = msn_user_get_work_phone(user); if (phone != NULL) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), phone); + purple_notify_user_info_add_pair_html(user_info, _("Work Phone Number"), phone); } phone = msn_user_get_mobile_phone(user); if (phone != NULL) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), phone); + purple_notify_user_info_add_pair_html(user_info, _("Mobile Phone Number"), phone); } } } @@ -2273,7 +2273,7 @@ msn_tooltip_extract_info_text(PurpleNotifyUserInfo *user_info, MsnGetInfoData *i { char *nicktext = g_markup_escape_text(alias, -1); tmp = g_strdup_printf("%s", nicktext); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); + purple_notify_user_info_add_pair_html(user_info, _("Nickname"), tmp); g_free(tmp); g_free(nicktext); } @@ -2372,7 +2372,7 @@ msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) { - purple_notify_user_info_add_pair(user_info, + purple_notify_user_info_add_pair_html(user_info, _("Error retrieving profile"), NULL); purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); @@ -2691,7 +2691,7 @@ msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, if (user_url != NULL) { tmp = g_strdup_printf("%s", user_url, user_url); - purple_notify_user_info_add_pair(user_info, _("Homepage"), tmp); + purple_notify_user_info_add_pair_html(user_info, _("Homepage"), tmp); g_free(tmp); g_free(user_url); @@ -2714,7 +2714,7 @@ msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, char *p = strstr(url_buffer, "
gc), info_data->name); - purple_notify_user_info_add_pair(user_info, + purple_notify_user_info_add_pair_html(user_info, _("Error retrieving profile"), NULL); purple_notify_user_info_add_pair_plaintext(user_info, NULL, ((p && b) ? _("The user has not created a public profile.") : @@ -2731,7 +2731,7 @@ msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, purple_notify_user_info_add_section_break(user_info); tmp = g_strdup_printf("%s", PROFILE_URL, info_data->name, _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); + purple_notify_user_info_add_pair_html(user_info, NULL, tmp); g_free(tmp); #if PHOTO_SUPPORT diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index 48f0bbf4d8..4cdc09a093 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -346,7 +346,7 @@ static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboole if ( contact->statusMsg ) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg ); + purple_notify_user_info_add_pair_html( info, _( "Status Message" ), contact->statusMsg ); } /* mood */ @@ -361,7 +361,7 @@ static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboole if ( ( contact->subtype == MXIT_SUBTYPE_REJECTED ) && ( contact->msg != NULL ) ) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "Rejection Message" ), contact->msg ); + purple_notify_user_info_add_pair_html( info, _( "Rejection Message" ), contact->msg ); } } diff --git a/libpurple/protocols/mxit/profile.c b/libpurple/protocols/mxit/profile.c index c16916560a..53fe4f3f01 100644 --- a/libpurple/protocols/mxit/profile.c +++ b/libpurple/protocols/mxit/profile.c @@ -177,12 +177,12 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "Display Name" ), profile->nickname ); + purple_notify_user_info_add_pair_html( info, _( "Display Name" ), profile->nickname ); tmp = g_strdup_printf("%s (%i)", profile->birthday, calculateAge( profile->birthday ) ); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "Birthday" ), tmp ); + purple_notify_user_info_add_pair_html( info, _( "Birthday" ), tmp ); g_free( tmp ); purple_notify_user_info_add_pair_plaintext( info, _( "Gender" ), profile->male ? _( "Male" ) : _( "Female" ) ); @@ -190,23 +190,23 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc /* optional information */ /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "First Name" ), profile->firstname ); + purple_notify_user_info_add_pair_html( info, _( "First Name" ), profile->firstname ); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "Last Name" ), profile->lastname ); + purple_notify_user_info_add_pair_html( info, _( "Last Name" ), profile->lastname ); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "Country" ), profile->regcountry ); + purple_notify_user_info_add_pair_html( info, _( "Country" ), profile->regcountry ); if ( *profile->aboutme ) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "About Me" ), profile->aboutme ); + purple_notify_user_info_add_pair_html( info, _( "About Me" ), profile->aboutme ); } if ( *profile->whereami ) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "Where I Live" ), profile->whereami ); + purple_notify_user_info_add_pair_html( info, _( "Where I Live" ), profile->whereami ); } purple_notify_user_info_add_section_break( info ); @@ -229,7 +229,7 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc if ( contact->statusMsg ) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg ); + purple_notify_user_info_add_pair_html( info, _( "Status Message" ), contact->statusMsg ); } /* subscription type */ @@ -244,21 +244,21 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc if ( contact->msg ) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "Invite Message" ), contact->msg ); + purple_notify_user_info_add_pair_html( info, _( "Invite Message" ), contact->msg ); } if ( contact->imgid ) { /* this invite has a avatar */ char* img_text; img_text = g_strdup_printf( "", contact->imgid ); - purple_notify_user_info_add_pair( info, _( "Photo" ), img_text ); + purple_notify_user_info_add_pair_html( info, _( "Photo" ), img_text ); g_free(img_text); } if ( contact->statusMsg ) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg ); + purple_notify_user_info_add_pair_html( info, _( "Status Message" ), contact->statusMsg ); } } } diff --git a/libpurple/protocols/myspace/user.c b/libpurple/protocols/myspace/user.c index 3b8a0c9bf4..4d42cc5cdf 100644 --- a/libpurple/protocols/myspace/user.c +++ b/libpurple/protocols/myspace/user.c @@ -206,7 +206,7 @@ msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, Msi else profile = g_strdup_printf("%s", user->id, _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, profile); + purple_notify_user_info_add_pair_html(user_info, NULL, profile); g_free(profile); } } diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index 9e5cebd4ba..3037507ae2 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -1517,7 +1517,7 @@ _show_info(PurpleConnection * gc, NMUserRecord * user_record, char * name) if (value) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, tag, value); + purple_notify_user_info_add_pair_html(user_info, tag, value); } #if 0 @@ -1526,7 +1526,7 @@ _show_info(PurpleConnection * gc, NMUserRecord * user_record, char * name) if (value) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, tag, value); + purple_notify_user_info_add_pair_html(user_info, tag, value); } #endif /* if 0 */ @@ -1535,7 +1535,7 @@ _show_info(PurpleConnection * gc, NMUserRecord * user_record, char * name) if (value) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, tag, value); + purple_notify_user_info_add_pair_html(user_info, tag, value); } count = nm_user_record_get_property_count(user_record); @@ -1547,7 +1547,7 @@ _show_info(PurpleConnection * gc, NMUserRecord * user_record, char * name) if (tag && value) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, tag, value); + purple_notify_user_info_add_pair_html(user_info, tag, value); } nm_release_property(property); } @@ -2874,7 +2874,7 @@ novell_tooltip_text(PurpleBuddy * buddy, PurpleNotifyUserInfo * user_info, gbool if (text) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Message"), text); + purple_notify_user_info_add_pair_html(user_info, _("Message"), text); } } } diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 3e4f26fd95..33bded25a0 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -2297,9 +2297,9 @@ static int purple_parse_clientauto_ch4(OscarData *od, const char *who, guint16 r purple_notify_user_info_add_pair_plaintext(user_info, _("UIN"), who); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Status"), statusmsg); + purple_notify_user_info_add_pair_html(user_info, _("Status"), statusmsg); purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_pair(user_info, NULL, g_strjoinv("
", splitmsg)); + purple_notify_user_info_add_pair_html(user_info, NULL, g_strjoinv("
", splitmsg)); g_free(statusmsg); g_strfreev(splitmsg); @@ -2324,9 +2324,9 @@ static int purple_parse_clientauto_ch4(OscarData *od, const char *who, guint16 r purple_notify_user_info_add_pair_plaintext(user_info, _("UIN"), who); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Status"), statusmsg); + purple_notify_user_info_add_pair_html(user_info, _("Status"), statusmsg); purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_pair(user_info, NULL, g_strjoinv("
", splitmsg)); + purple_notify_user_info_add_pair_html(user_info, NULL, g_strjoinv("
", splitmsg)); g_free(statusmsg); g_strfreev(splitmsg); diff --git a/libpurple/protocols/oscar/userinfo.c b/libpurple/protocols/oscar/userinfo.c index b17c14bc54..73f685cf3e 100644 --- a/libpurple/protocols/oscar/userinfo.c +++ b/libpurple/protocols/oscar/userinfo.c @@ -140,7 +140,7 @@ oscar_user_info_convert_and_add(PurpleAccount *account, OscarData *od, PurpleNot /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext. Will need to check callers of this function. */ - purple_notify_user_info_add_pair(user_info, name, utf8); + purple_notify_user_info_add_pair_html(user_info, name, utf8); g_free(utf8); } } @@ -156,7 +156,7 @@ oscar_user_info_convert_and_add_hyperlink(PurpleAccount *account, OscarData *od, /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext. Will need to check callers of this function. */ - purple_notify_user_info_add_pair(user_info, name, tmp); + purple_notify_user_info_add_pair_html(user_info, name, tmp); g_free(utf8); g_free(tmp); } @@ -293,12 +293,12 @@ oscar_user_info_append_status(PurpleConnection *gc, PurpleNotifyUserInfo *user_i } else { description = g_strdup(_(mood)); } - purple_notify_user_info_add_pair(user_info, _("Mood"), description); + purple_notify_user_info_add_pair_html(user_info, _("Mood"), description); g_free(description); } } - purple_notify_user_info_add_pair(user_info, _("Status"), message); + purple_notify_user_info_add_pair_html(user_info, _("Status"), message); g_free(message); } @@ -537,7 +537,7 @@ oscar_user_info_display_aim(OscarData *od, aim_userinfo_t *userinfo) if (tmp && *tmp) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Profile"), tmp); + purple_notify_user_info_add_pair_html(user_info, _("Profile"), tmp); } g_free(tmp); g_free(info_utf8); @@ -547,7 +547,7 @@ oscar_user_info_display_aim(OscarData *od, aim_userinfo_t *userinfo) base_profile_url = oscar_util_valid_name_icq(userinfo->bn) ? "http://www.icq.com/people" : "http://profiles.aim.com"; tmp = g_strdup_printf("%s", base_profile_url, purple_normalize(account, userinfo->bn), _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); + purple_notify_user_info_add_pair_html(user_info, NULL, tmp); g_free(tmp); purple_notify_userinfo(gc, userinfo->bn, user_info, NULL, NULL); diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 15a7918ce9..c501dd0a6f 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -4198,7 +4198,7 @@ static void mw_prpl_get_info(PurpleConnection *gc, const char *who) { user_info = purple_notify_user_info_new(); if(purple_str_has_prefix(who, "@E ")) { - purple_notify_user_info_add_pair(user_info, _("External User"), NULL); + purple_notify_user_info_add_pair_html(user_info, _("External User"), NULL); } purple_notify_user_info_add_pair_plaintext(user_info, _("User ID"), who); @@ -4209,7 +4209,7 @@ static void mw_prpl_get_info(PurpleConnection *gc, const char *who) { if(purple_buddy_get_server_alias(b)) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Full Name"), purple_buddy_get_server_alias(b)); + purple_notify_user_info_add_pair_html(user_info, _("Full Name"), purple_buddy_get_server_alias(b)); } type = purple_blist_node_get_int((PurpleBlistNode *) b, BUDDY_KEY_CLIENT); @@ -4219,7 +4219,7 @@ static void mw_prpl_get_info(PurpleConnection *gc, const char *who) { purple_notify_user_info_add_pair_plaintext(user_info, _("Last Known Client"), tmp2); } else { tmp = g_strdup_printf(_("Unknown (0x%04x)
"), type); - purple_notify_user_info_add_pair(user_info, _("Last Known Client"), tmp); + purple_notify_user_info_add_pair_html(user_info, _("Last Known Client"), tmp); g_free(tmp); } } diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c index f8c8e1cd1f..0e7a29b752 100644 --- a/libpurple/protocols/silc/buddy.c +++ b/libpurple/protocols/silc/buddy.c @@ -1549,13 +1549,13 @@ void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gb if (client_entry->nickname) /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Nickname"), + purple_notify_user_info_add_pair_html(user_info, _("Nickname"), client_entry->nickname); if (client_entry->username && client_entry->hostname) { g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); + purple_notify_user_info_add_pair_html(user_info, _("Username"), tmp); } if (client_entry->mode) { memset(tmp, 0, sizeof(tmp)); @@ -1569,7 +1569,7 @@ void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gb if (statusstr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Message"), statusstr); + purple_notify_user_info_add_pair_html(user_info, _("Message"), statusstr); g_free(statusstr); } @@ -1577,42 +1577,42 @@ void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gb if (moodstr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); + purple_notify_user_info_add_pair_html(user_info, _("Mood"), moodstr); g_free(moodstr); } if (contactstr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); + purple_notify_user_info_add_pair_html(user_info, _("Preferred Contact"), contactstr); g_free(contactstr); } if (langstr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); + purple_notify_user_info_add_pair_html(user_info, _("Preferred Language"), langstr); g_free(langstr); } if (devicestr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); + purple_notify_user_info_add_pair_html(user_info, _("Device"), devicestr); g_free(devicestr); } if (tzstr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); + purple_notify_user_info_add_pair_html(user_info, _("Timezone"), tzstr); g_free(tzstr); } if (geostr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); + purple_notify_user_info_add_pair_html(user_info, _("Geolocation"), geostr); g_free(geostr); } } diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c index ad23aab08c..7a102d7fb7 100644 --- a/libpurple/protocols/silc/ops.c +++ b/libpurple/protocols/silc/ops.c @@ -1202,14 +1202,14 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, tmp, sizeof(tmp) - strlen(tmp)); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); + purple_notify_user_info_add_pair_html(user_info, _("User Modes"), tmp); } silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); if (moodstr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); + purple_notify_user_info_add_pair_html(user_info, _("Mood"), moodstr); g_free(moodstr); } @@ -1221,42 +1221,42 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, if (contactstr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); + purple_notify_user_info_add_pair_html(user_info, _("Preferred Contact"), contactstr); g_free(contactstr); } if (langstr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); + purple_notify_user_info_add_pair_html(user_info, _("Preferred Language"), langstr); g_free(langstr); } if (devicestr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); + purple_notify_user_info_add_pair_html(user_info, _("Device"), devicestr); g_free(devicestr); } if (tzstr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); + purple_notify_user_info_add_pair_html(user_info, _("Timezone"), tzstr); g_free(tzstr); } if (geostr) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); + purple_notify_user_info_add_pair_html(user_info, _("Geolocation"), geostr); g_free(geostr); } if (*client_entry->server) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); + purple_notify_user_info_add_pair_html(user_info, _("Server"), client_entry->server); } if (channels && user_modes) { @@ -1344,7 +1344,7 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, if (client_entry && *client_entry->server) { /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); + purple_notify_user_info_add_pair_html(user_info, _("Server"), client_entry->server); } diff --git a/libpurple/protocols/yahoo/yahoo_profile.c b/libpurple/protocols/yahoo/yahoo_profile.c index c0a0ce5b8e..aa752f6885 100644 --- a/libpurple/protocols/yahoo/yahoo_profile.c +++ b/libpurple/protocols/yahoo/yahoo_profile.c @@ -805,7 +805,7 @@ static void yahoo_got_info(PurpleUtilFetchUrlData *url_data, gpointer user_data, * to send back HTML, with a 200 status code. */ if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) { - purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"), NULL); + purple_notify_user_info_add_pair_html(user_info, _("Error retrieving profile"), NULL); purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); purple_notify_user_info_destroy(user_info); @@ -840,7 +840,7 @@ static void yahoo_got_info(PurpleUtilFetchUrlData *url_data, gpointer user_data, _("If you wish to view this profile, " "you will need to visit this link in your web browser:"), profile_url_text, profile_url_text); - purple_notify_user_info_add_pair(user_info, NULL, tmp); + purple_notify_user_info_add_pair_html(user_info, NULL, tmp); g_free(tmp); purple_notify_userinfo(info_data->gc, info_data->name, @@ -1048,7 +1048,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); tmp = g_strdup_printf("
", id); - purple_notify_user_info_add_pair(user_info, NULL, tmp); + purple_notify_user_info_add_pair_html(user_info, NULL, tmp); g_free(tmp); } } @@ -1195,7 +1195,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, const gchar *str; purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_pair(user_info, + purple_notify_user_info_add_pair_html(user_info, _("Error retrieving profile"), NULL); if (profile_state == PROFILE_STATE_UNKNOWN_LANGUAGE) { @@ -1235,7 +1235,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, purple_notify_user_info_add_section_break(user_info); tmp = g_strdup_printf("%s", profile_url_text, _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); + purple_notify_user_info_add_pair_html(user_info, NULL, tmp); g_free(tmp); g_free(stripped); diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 39f131da79..367dc7e74d 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -793,7 +793,7 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); + purple_notify_user_info_add_pair_html(user_info, _("User"), (b ? bname : user)); balias = purple_buddy_get_local_buddy_alias(b); if (b && balias) purple_notify_user_info_add_pair_plaintext(user_info, _("Alias"), balias); @@ -807,7 +807,7 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) ZGetLocations(&locs, &one); /* TODO: Need to escape locs.host and locs.time? */ tmp = g_strdup_printf(_("
At %s since %s"), locs.host, locs.time); - purple_notify_user_info_add_pair(user_info, _("Location"), tmp); + purple_notify_user_info_add_pair_html(user_info, _("Location"), tmp); g_free(tmp); } purple_notify_userinfo(gc, (b ? bname : user), @@ -1178,7 +1178,7 @@ static gint check_notify_tzc(gpointer data) /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); + purple_notify_user_info_add_pair_html(user_info, _("User"), (b ? bname : user)); balias = b ? purple_buddy_get_local_buddy_alias(b) : NULL; if (balias) @@ -1191,7 +1191,7 @@ static gint check_notify_tzc(gpointer data) tmp = g_strdup_printf(_("
At %s since %s"), tree_child(tree_child(tree_child(tree_child(locations,2),0),0),2)->contents, tree_child(tree_child(tree_child(tree_child(locations,2),0),2),2)->contents); - purple_notify_user_info_add_pair(user_info, _("Location"), tmp); + purple_notify_user_info_add_pair_html(user_info, _("Location"), tmp); g_free(tmp); } diff --git a/libpurple/util.c b/libpurple/util.c index f6b3be1675..26d1676e83 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -1321,7 +1321,7 @@ purple_markup_extract_info_field(const char *str, int len, PurpleNotifyUserInfo g_string_append_len(dest, p, q - p); } - purple_notify_user_info_add_pair(user_info, display_name, dest->str); + purple_notify_user_info_add_pair_html(user_info, display_name, dest->str); g_string_free(dest, TRUE); return TRUE; diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index fb386a6cfb..27be809f13 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3913,7 +3913,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) /* Total buddies (from online accounts) in group */ char tmp2[12]; sprintf(tmp2, "%d", count); - purple_notify_user_info_add_pair(user_info, + purple_notify_user_info_add_pair_html(user_info, _("Total Buddies"), tmp2); } -- cgit v1.2.1 From d7c5246537f82e52277635a57a4d556b22fd413a Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 03:40:04 +0000 Subject: Fix perl compilation. I really wish the .c files regenerated with the header files they depend on change --- libpurple/plugins/perl/common/Notify.xs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/plugins/perl/common/Notify.xs b/libpurple/plugins/perl/common/Notify.xs index 87bb928f9c..0f4b2f78ad 100644 --- a/libpurple/plugins/perl/common/Notify.xs +++ b/libpurple/plugins/perl/common/Notify.xs @@ -145,7 +145,7 @@ purple_notify_user_info_get_text_with_newline(user_info, newline) Purple::NotifyUserInfo user_info const char *newline -void purple_notify_user_info_add_pair(user_info, label, value) +void purple_notify_user_info_add_pair_html(user_info, label, value) Purple::NotifyUserInfo user_info const char *label const char *value -- cgit v1.2.1 From 37844ecf82ca10f1196cafb45669b38ecbb735a5 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 04:14:16 +0000 Subject: Change PurpleNotifyUserInfo->user_info_entries from a GList to a GQueue. This makes appending fast. --- finch/gntnotify.c | 2 +- libpurple/notify.c | 38 ++++++++++++++++----------------- libpurple/notify.h | 16 +++++++------- libpurple/plugins/perl/common/Notify.xs | 2 +- libpurple/protocols/jabber/buddy.c | 2 +- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/finch/gntnotify.c b/finch/gntnotify.c index 5d7e74474c..94ed5959e0 100644 --- a/finch/gntnotify.c +++ b/finch/gntnotify.c @@ -290,7 +290,7 @@ purple_notify_user_info_get_xhtml(PurpleNotifyUserInfo *user_info) text = g_string_new(""); - for (l = purple_notify_user_info_get_entries(user_info); l != NULL; + for (l = purple_notify_user_info_get_entries(user_info)->head; l != NULL; l = l->next) { PurpleNotifyUserInfoEntry *user_info_entry = l->data; PurpleNotifyUserInfoEntryType type = purple_notify_user_info_entry_get_type(user_info_entry); diff --git a/libpurple/notify.c b/libpurple/notify.c index f9132f00b3..90e5c21543 100644 --- a/libpurple/notify.c +++ b/libpurple/notify.c @@ -53,7 +53,7 @@ struct _PurpleNotifyUserInfoEntry struct _PurpleNotifyUserInfo { - GList *user_info_entries; + GQueue user_info_entries; }; void * @@ -454,7 +454,7 @@ purple_notify_user_info_new() user_info = g_new0(PurpleNotifyUserInfo, 1); PURPLE_DBUS_REGISTER_POINTER(user_info, PurpleNotifyUserInfo); - user_info->user_info_entries = NULL; + g_queue_init(&user_info->user_info_entries); return user_info; } @@ -464,23 +464,23 @@ purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info) { GList *l; - for (l = user_info->user_info_entries; l != NULL; l = l->next) { + for (l = user_info->user_info_entries.head; l != NULL; l = l->next) { PurpleNotifyUserInfoEntry *user_info_entry = l->data; purple_notify_user_info_entry_destroy(user_info_entry); } - g_list_free(user_info->user_info_entries); + g_queue_clear(&user_info->user_info_entries); PURPLE_DBUS_UNREGISTER_POINTER(user_info); g_free(user_info); } -GList * +GQueue * purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info) { g_return_val_if_fail(user_info != NULL, NULL); - return user_info->user_info_entries; + return &user_info->user_info_entries; } char * @@ -491,7 +491,7 @@ purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, c text = g_string_new(""); - for (l = user_info->user_info_entries; l != NULL; l = l->next) { + for (l = user_info->user_info_entries.head; l != NULL; l = l->next) { PurpleNotifyUserInfoEntry *user_info_entry = l->data; /* Add a newline before a section header */ if (user_info_entry->type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER) @@ -580,7 +580,7 @@ purple_notify_user_info_add_pair_html(PurpleNotifyUserInfo *user_info, const cha PurpleNotifyUserInfoEntry *entry; entry = purple_notify_user_info_entry_new(label, value); - user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); + g_queue_push_tail(&user_info->user_info_entries, entry); } void @@ -599,7 +599,7 @@ purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char PurpleNotifyUserInfoEntry *entry; entry = purple_notify_user_info_entry_new(label, value); - user_info->user_info_entries = g_list_prepend(user_info->user_info_entries, entry); + g_queue_push_head(&user_info->user_info_entries, entry); } void @@ -608,7 +608,7 @@ purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNoti g_return_if_fail(user_info != NULL); g_return_if_fail(entry != NULL); - user_info->user_info_entries = g_list_remove(user_info->user_info_entries, entry); + g_queue_remove(&user_info->user_info_entries, entry); } void @@ -619,7 +619,7 @@ purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, cons entry = purple_notify_user_info_entry_new(label, NULL); entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; - user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); + g_queue_push_tail(&user_info->user_info_entries, entry); } void @@ -630,7 +630,7 @@ purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, entry = purple_notify_user_info_entry_new(label, NULL); entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; - user_info->user_info_entries = g_list_prepend(user_info->user_info_entries, entry); + g_queue_push_head(&user_info->user_info_entries, entry); } void @@ -641,7 +641,7 @@ purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info) entry = purple_notify_user_info_entry_new(NULL, NULL); entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; - user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); + g_queue_push_tail(&user_info->user_info_entries, entry); } void @@ -652,17 +652,17 @@ purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info) entry = purple_notify_user_info_entry_new(NULL, NULL); entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; - user_info->user_info_entries = g_list_prepend(user_info->user_info_entries, entry); + g_queue_push_head(&user_info->user_info_entries, entry); } void purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info) { - GList *last = g_list_last(user_info->user_info_entries); - if (last) { - purple_notify_user_info_entry_destroy(last->data); - user_info->user_info_entries = g_list_delete_link(user_info->user_info_entries, last); - } + PurpleNotifyUserInfoEntry *entry; + + entry = g_queue_pop_tail(&user_info->user_info_entries); + if (entry) + purple_notify_user_info_entry_destroy(entry); } void * diff --git a/libpurple/notify.h b/libpurple/notify.h index 8ac1659070..7d0c5e7395 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -439,20 +439,20 @@ void purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info); * Retrieve the array of PurpleNotifyUserInfoEntry objects from a * PurpleNotifyUserInfo * - * This GList may be manipulated directly with normal GList functions such - * as g_list_insert(). Only PurpleNotifyUserInfoEntry are allowed in the - * list. If a PurpleNotifyUserInfoEntry item is added to the list, it - * should not be g_free()'d by the caller; PurpleNotifyUserInfo will g_free - * it when destroyed. + * This GQueue may be manipulated directly with normal GQueue functions such + * as g_queue_push_tail(). Only PurpleNotifyUserInfoEntry are allowed in the + * queue. If a PurpleNotifyUserInfoEntry item is added to the queue, it + * should not be freed by the caller; PurpleNotifyUserInfo will free it when + * destroyed. * * To remove a PurpleNotifyUserInfoEntry, use - * purple_notify_user_info_remove_entry(). Do not use the GList directly. + * purple_notify_user_info_remove_entry(). Do not use the GQueue directly. * * @param user_info The PurpleNotifyUserInfo * - * @constreturn A GList of PurpleNotifyUserInfoEntry objects + * @constreturn A GQueue of PurpleNotifyUserInfoEntry objects. */ -GList *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info); +GQueue *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info); /** * Create a textual representation of a PurpleNotifyUserInfo, separating diff --git a/libpurple/plugins/perl/common/Notify.xs b/libpurple/plugins/perl/common/Notify.xs index 0f4b2f78ad..2798952a1b 100644 --- a/libpurple/plugins/perl/common/Notify.xs +++ b/libpurple/plugins/perl/common/Notify.xs @@ -135,7 +135,7 @@ purple_notify_user_info_get_entries(user_info) PREINIT: GList *l; PPCODE: - l = purple_notify_user_info_get_entries(user_info); + l = purple_notify_user_info_get_entries(user_info)->head; for (; l != NULL; l = l->next) { XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::NotifyUserInfoEntry"))); } diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 3e532d6258..410a20f330 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -806,7 +806,7 @@ static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) resource_name = jabber_get_resource(jbi->jid); /* If we have one or more pairs from the vcard, put a section break above it */ - if (purple_notify_user_info_get_entries(user_info)) + if (g_queue_get_length(purple_notify_user_info_get_entries(user_info))) purple_notify_user_info_prepend_section_break(user_info); /* Add the information about the user's resource(s) */ -- cgit v1.2.1 From 0abd398f42bd30b9eb184c175884d1c2b18adcef Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 04:16:28 +0000 Subject: user_info->user_info_entries is redundant. Let's call it user_info->entries, instead. --- libpurple/notify.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libpurple/notify.c b/libpurple/notify.c index 90e5c21543..91fe6aca0d 100644 --- a/libpurple/notify.c +++ b/libpurple/notify.c @@ -53,7 +53,7 @@ struct _PurpleNotifyUserInfoEntry struct _PurpleNotifyUserInfo { - GQueue user_info_entries; + GQueue entries; }; void * @@ -454,7 +454,7 @@ purple_notify_user_info_new() user_info = g_new0(PurpleNotifyUserInfo, 1); PURPLE_DBUS_REGISTER_POINTER(user_info, PurpleNotifyUserInfo); - g_queue_init(&user_info->user_info_entries); + g_queue_init(&user_info->entries); return user_info; } @@ -464,13 +464,13 @@ purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info) { GList *l; - for (l = user_info->user_info_entries.head; l != NULL; l = l->next) { + for (l = user_info->entries.head; l != NULL; l = l->next) { PurpleNotifyUserInfoEntry *user_info_entry = l->data; purple_notify_user_info_entry_destroy(user_info_entry); } - g_queue_clear(&user_info->user_info_entries); + g_queue_clear(&user_info->entries); PURPLE_DBUS_UNREGISTER_POINTER(user_info); g_free(user_info); } @@ -480,7 +480,7 @@ purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info) { g_return_val_if_fail(user_info != NULL, NULL); - return &user_info->user_info_entries; + return &user_info->entries; } char * @@ -491,7 +491,7 @@ purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, c text = g_string_new(""); - for (l = user_info->user_info_entries.head; l != NULL; l = l->next) { + for (l = user_info->entries.head; l != NULL; l = l->next) { PurpleNotifyUserInfoEntry *user_info_entry = l->data; /* Add a newline before a section header */ if (user_info_entry->type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER) @@ -580,7 +580,7 @@ purple_notify_user_info_add_pair_html(PurpleNotifyUserInfo *user_info, const cha PurpleNotifyUserInfoEntry *entry; entry = purple_notify_user_info_entry_new(label, value); - g_queue_push_tail(&user_info->user_info_entries, entry); + g_queue_push_tail(&user_info->entries, entry); } void @@ -599,7 +599,7 @@ purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char PurpleNotifyUserInfoEntry *entry; entry = purple_notify_user_info_entry_new(label, value); - g_queue_push_head(&user_info->user_info_entries, entry); + g_queue_push_head(&user_info->entries, entry); } void @@ -608,7 +608,7 @@ purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNoti g_return_if_fail(user_info != NULL); g_return_if_fail(entry != NULL); - g_queue_remove(&user_info->user_info_entries, entry); + g_queue_remove(&user_info->entries, entry); } void @@ -619,7 +619,7 @@ purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, cons entry = purple_notify_user_info_entry_new(label, NULL); entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; - g_queue_push_tail(&user_info->user_info_entries, entry); + g_queue_push_tail(&user_info->entries, entry); } void @@ -630,7 +630,7 @@ purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, entry = purple_notify_user_info_entry_new(label, NULL); entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; - g_queue_push_head(&user_info->user_info_entries, entry); + g_queue_push_head(&user_info->entries, entry); } void @@ -641,7 +641,7 @@ purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info) entry = purple_notify_user_info_entry_new(NULL, NULL); entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; - g_queue_push_tail(&user_info->user_info_entries, entry); + g_queue_push_tail(&user_info->entries, entry); } void @@ -652,7 +652,7 @@ purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info) entry = purple_notify_user_info_entry_new(NULL, NULL); entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; - g_queue_push_head(&user_info->user_info_entries, entry); + g_queue_push_head(&user_info->entries, entry); } void @@ -660,7 +660,7 @@ purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info) { PurpleNotifyUserInfoEntry *entry; - entry = g_queue_pop_tail(&user_info->user_info_entries); + entry = g_queue_pop_tail(&user_info->entries); if (entry) purple_notify_user_info_entry_destroy(entry); } -- cgit v1.2.1 From ae08c37a28aa392598f0690aeac6a01fd7311cf7 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 04:24:12 +0000 Subject: Add an entry for 42173d1c13177c97e37e6a116e2ecec03b3eaa09 --- ChangeLog.API | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog.API b/ChangeLog.API index bc471260e4..242e13bb45 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -13,6 +13,8 @@ version 3.0.0 (??/??/????): as the second parameter * purple_notify_user_info_add_pair renamed to purple_notify_user_info_add_pair_html + * purple_notify_user_info_get_entries returns a GQueue instead of + a GList * purple_util_fetch_url_request_len now takes a PurpleAccount as the first parameter * PurpleConnectionUiOps.report_disconnect now passes a -- cgit v1.2.1 From adce8fa37dc02a7b1537eb4f5ed5096c8988b194 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 05:39:00 +0000 Subject: Now that there's no speed difference between purple_notify_user_info_add_pair_html and purple_notify_user_info_prepend_pair, use the former to that we don't add items in reverse order. This is hopefully a little less error prone? It also means we won't have to create separate prepend_pair_html and prepend_pair_plaintext functions --- libpurple/protocols/jabber/buddy.c | 77 +++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 410a20f330..9b47d0d7d5 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -726,16 +726,39 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, jbir = g_hash_table_lookup(jbi->resources, resource); user_info = jbi->user_info; - if (jbr && jbr->client.name) { - char *tmp = - g_strdup_printf("%s%s%s", jbr->client.name, - (jbr->client.version ? " " : ""), - (jbr->client.version ? jbr->client.version : "")); - purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp); + if (jbr) { + char *purdy = NULL; + char *tmp; + char priority[12]; + const char *status_name = jabber_buddy_state_get_name(jbr->state); + + g_snprintf(priority, sizeof(priority), "%d", jbr->priority); + purple_notify_user_info_add_pair_html(user_info, _("Priority"), priority); + + if (jbr->status) { + tmp = purple_markup_escape_text(jbr->status, -1); + purdy = purple_strdup_withhtml(tmp); + g_free(tmp); + + if (purple_strequal(status_name, purdy)) + status_name = NULL; + } + + tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), + ((status_name && purdy) ? ": " : ""), + (purdy ? purdy : "")); + purple_notify_user_info_add_pair_html(user_info, _("Status"), tmp); + g_free(tmp); + g_free(purdy); + } else { + purple_notify_user_info_add_pair_html(user_info, _("Status"), _("Unknown")); + } - if (jbr->client.os) - purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); + if (jbir && jbir->idle_seconds > 0) { + char *idle = purple_str_seconds_to_string(jbir->idle_seconds); + purple_notify_user_info_add_pair_html(user_info, _("Idle"), idle); + g_free(idle); } if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { @@ -751,43 +774,21 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, jbr->tz_off < 0 ? '-' : '+', abs(jbr->tz_off / (60*60)), abs((jbr->tz_off % (60*60)) / 60)); - purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); + purple_notify_user_info_add_pair_html(user_info, _("Local Time"), timestamp); g_free(timestamp); } - if (jbir && jbir->idle_seconds > 0) { - char *idle = purple_str_seconds_to_string(jbir->idle_seconds); - purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); - g_free(idle); - } - - if (jbr) { - char *purdy = NULL; + if (jbr && jbr->client.name) { char *tmp; - char priority[12]; - const char *status_name = jabber_buddy_state_get_name(jbr->state); - - if (jbr->status) { - tmp = purple_markup_escape_text(jbr->status, -1); - purdy = purple_strdup_withhtml(tmp); - g_free(tmp); - - if (purple_strequal(status_name, purdy)) - status_name = NULL; - } - - tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), - ((status_name && purdy) ? ": " : ""), - (purdy ? purdy : "")); - purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); - g_snprintf(priority, sizeof(priority), "%d", jbr->priority); - purple_notify_user_info_prepend_pair(user_info, _("Priority"), priority); + if (jbr->client.os) + purple_notify_user_info_add_pair_html(user_info, _("Operating System"), jbr->client.os); + tmp = g_strdup_printf("%s%s%s", jbr->client.name, + (jbr->client.version ? " " : ""), + (jbr->client.version ? jbr->client.version : "")); + purple_notify_user_info_add_pair_html(user_info, _("Client"), tmp); g_free(tmp); - g_free(purdy); - } else { - purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); } } -- cgit v1.2.1 From 7818cb78a816c8e22e7c66a3c71ba6c232b73e14 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 05:45:22 +0000 Subject: I think it's more appropriate to append these as plaintext --- libpurple/protocols/jabber/buddy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 9b47d0d7d5..755684d06d 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -733,7 +733,7 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, const char *status_name = jabber_buddy_state_get_name(jbr->state); g_snprintf(priority, sizeof(priority), "%d", jbr->priority); - purple_notify_user_info_add_pair_html(user_info, _("Priority"), priority); + purple_notify_user_info_add_pair_plaintext(user_info, _("Priority"), priority); if (jbr->status) { tmp = purple_markup_escape_text(jbr->status, -1); @@ -752,12 +752,12 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, g_free(tmp); g_free(purdy); } else { - purple_notify_user_info_add_pair_html(user_info, _("Status"), _("Unknown")); + purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Unknown")); } if (jbir && jbir->idle_seconds > 0) { char *idle = purple_str_seconds_to_string(jbir->idle_seconds); - purple_notify_user_info_add_pair_html(user_info, _("Idle"), idle); + purple_notify_user_info_add_pair_plaintext(user_info, _("Idle"), idle); g_free(idle); } @@ -774,7 +774,7 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, jbr->tz_off < 0 ? '-' : '+', abs(jbr->tz_off / (60*60)), abs((jbr->tz_off % (60*60)) / 60)); - purple_notify_user_info_add_pair_html(user_info, _("Local Time"), timestamp); + purple_notify_user_info_add_pair_plaintext(user_info, _("Local Time"), timestamp); g_free(timestamp); } -- cgit v1.2.1 From 755ff94e3874e9034763e215c780fe02bc14095c Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 06:14:57 +0000 Subject: disapproval of revision '9a50231a157355051bd155e7ab04e0df78945366' --- libpurple/protocols/jabber/buddy.c | 77 +++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 9b47d0d7d5..410a20f330 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -726,39 +726,16 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, jbir = g_hash_table_lookup(jbi->resources, resource); user_info = jbi->user_info; - if (jbr) { - char *purdy = NULL; - char *tmp; - char priority[12]; - const char *status_name = jabber_buddy_state_get_name(jbr->state); - - g_snprintf(priority, sizeof(priority), "%d", jbr->priority); - purple_notify_user_info_add_pair_html(user_info, _("Priority"), priority); - - if (jbr->status) { - tmp = purple_markup_escape_text(jbr->status, -1); - purdy = purple_strdup_withhtml(tmp); - g_free(tmp); - - if (purple_strequal(status_name, purdy)) - status_name = NULL; - } - - tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), - ((status_name && purdy) ? ": " : ""), - (purdy ? purdy : "")); - purple_notify_user_info_add_pair_html(user_info, _("Status"), tmp); - + if (jbr && jbr->client.name) { + char *tmp = + g_strdup_printf("%s%s%s", jbr->client.name, + (jbr->client.version ? " " : ""), + (jbr->client.version ? jbr->client.version : "")); + purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp); g_free(tmp); - g_free(purdy); - } else { - purple_notify_user_info_add_pair_html(user_info, _("Status"), _("Unknown")); - } - if (jbir && jbir->idle_seconds > 0) { - char *idle = purple_str_seconds_to_string(jbir->idle_seconds); - purple_notify_user_info_add_pair_html(user_info, _("Idle"), idle); - g_free(idle); + if (jbr->client.os) + purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); } if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { @@ -774,21 +751,43 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, jbr->tz_off < 0 ? '-' : '+', abs(jbr->tz_off / (60*60)), abs((jbr->tz_off % (60*60)) / 60)); - purple_notify_user_info_add_pair_html(user_info, _("Local Time"), timestamp); + purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); g_free(timestamp); } - if (jbr && jbr->client.name) { + if (jbir && jbir->idle_seconds > 0) { + char *idle = purple_str_seconds_to_string(jbir->idle_seconds); + purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); + g_free(idle); + } + + if (jbr) { + char *purdy = NULL; char *tmp; + char priority[12]; + const char *status_name = jabber_buddy_state_get_name(jbr->state); - if (jbr->client.os) - purple_notify_user_info_add_pair_html(user_info, _("Operating System"), jbr->client.os); + if (jbr->status) { + tmp = purple_markup_escape_text(jbr->status, -1); + purdy = purple_strdup_withhtml(tmp); + g_free(tmp); + + if (purple_strequal(status_name, purdy)) + status_name = NULL; + } + + tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), + ((status_name && purdy) ? ": " : ""), + (purdy ? purdy : "")); + purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); + + g_snprintf(priority, sizeof(priority), "%d", jbr->priority); + purple_notify_user_info_prepend_pair(user_info, _("Priority"), priority); - tmp = g_strdup_printf("%s%s%s", jbr->client.name, - (jbr->client.version ? " " : ""), - (jbr->client.version ? jbr->client.version : "")); - purple_notify_user_info_add_pair_html(user_info, _("Client"), tmp); g_free(tmp); + g_free(purdy); + } else { + purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); } } -- cgit v1.2.1 From 9e37e2b382c12e1927ba867d94f7250ff0b9f98a Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 06:07:08 +0000 Subject: disapproval of revision 'b0e0c8843045cbfba250883729088e5409e06403' --- libpurple/protocols/jabber/buddy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 755684d06d..9b47d0d7d5 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -733,7 +733,7 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, const char *status_name = jabber_buddy_state_get_name(jbr->state); g_snprintf(priority, sizeof(priority), "%d", jbr->priority); - purple_notify_user_info_add_pair_plaintext(user_info, _("Priority"), priority); + purple_notify_user_info_add_pair_html(user_info, _("Priority"), priority); if (jbr->status) { tmp = purple_markup_escape_text(jbr->status, -1); @@ -752,12 +752,12 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, g_free(tmp); g_free(purdy); } else { - purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Unknown")); + purple_notify_user_info_add_pair_html(user_info, _("Status"), _("Unknown")); } if (jbir && jbir->idle_seconds > 0) { char *idle = purple_str_seconds_to_string(jbir->idle_seconds); - purple_notify_user_info_add_pair_plaintext(user_info, _("Idle"), idle); + purple_notify_user_info_add_pair_html(user_info, _("Idle"), idle); g_free(idle); } @@ -774,7 +774,7 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, jbr->tz_off < 0 ? '-' : '+', abs(jbr->tz_off / (60*60)), abs((jbr->tz_off % (60*60)) / 60)); - purple_notify_user_info_add_pair_plaintext(user_info, _("Local Time"), timestamp); + purple_notify_user_info_add_pair_html(user_info, _("Local Time"), timestamp); g_free(timestamp); } -- cgit v1.2.1 From beb845634dd8632e8037349601b586e8331fd006 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 06:17:18 +0000 Subject: I tried to disapprove this, but it didn't seem to work. Maybe I messed something up with a manual merge? Anyway, I'm undoing this because I didn't realize that jabber adds stuff to the user_info list crazily out of order. My assumption that _prepend was being used for performance reasons was wrong--the actual reason is that we want the resource info at the top --- libpurple/protocols/jabber/buddy.c | 77 +++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 9b47d0d7d5..410a20f330 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -726,39 +726,16 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, jbir = g_hash_table_lookup(jbi->resources, resource); user_info = jbi->user_info; - if (jbr) { - char *purdy = NULL; - char *tmp; - char priority[12]; - const char *status_name = jabber_buddy_state_get_name(jbr->state); - - g_snprintf(priority, sizeof(priority), "%d", jbr->priority); - purple_notify_user_info_add_pair_html(user_info, _("Priority"), priority); - - if (jbr->status) { - tmp = purple_markup_escape_text(jbr->status, -1); - purdy = purple_strdup_withhtml(tmp); - g_free(tmp); - - if (purple_strequal(status_name, purdy)) - status_name = NULL; - } - - tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), - ((status_name && purdy) ? ": " : ""), - (purdy ? purdy : "")); - purple_notify_user_info_add_pair_html(user_info, _("Status"), tmp); - + if (jbr && jbr->client.name) { + char *tmp = + g_strdup_printf("%s%s%s", jbr->client.name, + (jbr->client.version ? " " : ""), + (jbr->client.version ? jbr->client.version : "")); + purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp); g_free(tmp); - g_free(purdy); - } else { - purple_notify_user_info_add_pair_html(user_info, _("Status"), _("Unknown")); - } - if (jbir && jbir->idle_seconds > 0) { - char *idle = purple_str_seconds_to_string(jbir->idle_seconds); - purple_notify_user_info_add_pair_html(user_info, _("Idle"), idle); - g_free(idle); + if (jbr->client.os) + purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); } if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { @@ -774,21 +751,43 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, jbr->tz_off < 0 ? '-' : '+', abs(jbr->tz_off / (60*60)), abs((jbr->tz_off % (60*60)) / 60)); - purple_notify_user_info_add_pair_html(user_info, _("Local Time"), timestamp); + purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); g_free(timestamp); } - if (jbr && jbr->client.name) { + if (jbir && jbir->idle_seconds > 0) { + char *idle = purple_str_seconds_to_string(jbir->idle_seconds); + purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); + g_free(idle); + } + + if (jbr) { + char *purdy = NULL; char *tmp; + char priority[12]; + const char *status_name = jabber_buddy_state_get_name(jbr->state); - if (jbr->client.os) - purple_notify_user_info_add_pair_html(user_info, _("Operating System"), jbr->client.os); + if (jbr->status) { + tmp = purple_markup_escape_text(jbr->status, -1); + purdy = purple_strdup_withhtml(tmp); + g_free(tmp); + + if (purple_strequal(status_name, purdy)) + status_name = NULL; + } + + tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), + ((status_name && purdy) ? ": " : ""), + (purdy ? purdy : "")); + purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); + + g_snprintf(priority, sizeof(priority), "%d", jbr->priority); + purple_notify_user_info_prepend_pair(user_info, _("Priority"), priority); - tmp = g_strdup_printf("%s%s%s", jbr->client.name, - (jbr->client.version ? " " : ""), - (jbr->client.version ? jbr->client.version : "")); - purple_notify_user_info_add_pair_html(user_info, _("Client"), tmp); g_free(tmp); + g_free(purdy); + } else { + purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); } } -- cgit v1.2.1 From 84636f2815af759fdfd8773f7f8ca29bf3d8a003 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 06:25:23 +0000 Subject: Add purple_notify_user_info_prepend_pair_plaintext and use it in a few places in the jabber prpl --- libpurple/protocols/jabber/buddy.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 410a20f330..01e9f0c764 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -731,11 +731,16 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, g_strdup_printf("%s%s%s", jbr->client.name, (jbr->client.version ? " " : ""), (jbr->client.version ? jbr->client.version : "")); + /* TODO: Check whether it's correct to call prepend_pair_html, + or if we should be using prepend_pair_plaintext */ purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp); g_free(tmp); - if (jbr->client.os) + if (jbr->client.os) { + /* TODO: Check whether it's correct to call prepend_pair_html, + or if we should be using prepend_pair_plaintext */ purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); + } } if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { @@ -751,13 +756,13 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, jbr->tz_off < 0 ? '-' : '+', abs(jbr->tz_off / (60*60)), abs((jbr->tz_off % (60*60)) / 60)); - purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); + purple_notify_user_info_prepend_pair_plaintext(user_info, _("Local Time"), timestamp); g_free(timestamp); } if (jbir && jbir->idle_seconds > 0) { char *idle = purple_str_seconds_to_string(jbir->idle_seconds); - purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); + purple_notify_user_info_prepend_pair_plaintext(user_info, _("Idle"), idle); g_free(idle); } @@ -782,12 +787,12 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); g_snprintf(priority, sizeof(priority), "%d", jbr->priority); - purple_notify_user_info_prepend_pair(user_info, _("Priority"), priority); + purple_notify_user_info_prepend_pair_plaintext(user_info, _("Priority"), priority); g_free(tmp); g_free(purdy); } else { - purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); + purple_notify_user_info_prepend_pair_plaintext(user_info, _("Status"), _("Unknown")); } } @@ -827,8 +832,11 @@ static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) add_jbr_info(jbi, jbr->name, jbr); - if (jbr->name) + if (jbr->name) { + /* TODO: Check whether it's correct to call prepend_pair_html, + or if we should be using prepend_pair_plaintext */ purple_notify_user_info_prepend_pair(user_info, _("Resource"), jbr->name); + } } } @@ -848,7 +856,7 @@ static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) title = _("Logged Off"); message = g_strdup_printf(_("%s ago"), last); } - purple_notify_user_info_prepend_pair(user_info, title, message); + purple_notify_user_info_prepend_pair_plaintext(user_info, title, message); g_free(last); g_free(message); } @@ -858,6 +866,8 @@ static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) g_strdup_printf("%s%s%s", _("Offline"), jbi->last_message ? ": " : "", jbi->last_message ? jbi->last_message : ""); + /* TODO: Check whether it's correct to call prepend_pair_html, + or if we should be using prepend_pair_plaintext */ purple_notify_user_info_prepend_pair(user_info, _("Status"), status); g_free(status); } -- cgit v1.2.1 From 117c259abcd7b1418ab21e1162d4852008c1ccda Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 06:32:44 +0000 Subject: Actually commit the purple_notify_user_info_prepend_pair_plaintext function. I think I left it off my previous commit? Sorry. And rename purple_notify_user_info_prepend_pair to purple_notify_user_info_prepend_pair_html_html --- ChangeLog.API | 3 +++ libpurple/notify.c | 12 +++++++++++- libpurple/notify.h | 28 +++++++++++++--------------- libpurple/plugins/perl/common/Notify.xs | 2 +- libpurple/protocols/jabber/buddy.c | 10 +++++----- libpurple/protocols/msn/msn.c | 2 +- 6 files changed, 34 insertions(+), 23 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 242e13bb45..acb657b37c 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -5,6 +5,7 @@ version 3.0.0 (??/??/????): Added: * purple_notify_searchresult_column_set_visible * purple_notify_searchresult_column_is_visible + * purple_notify_user_info_prepend_pair_plaintext * purple_request_field_set_tooltip * purple_request_field_get_tooltip @@ -15,6 +16,8 @@ version 3.0.0 (??/??/????): purple_notify_user_info_add_pair_html * purple_notify_user_info_get_entries returns a GQueue instead of a GList + * purple_notify_user_info_prepend_pair renamed to + purple_notify_user_info_prepend_pair_html_html * purple_util_fetch_url_request_len now takes a PurpleAccount as the first parameter * PurpleConnectionUiOps.report_disconnect now passes a diff --git a/libpurple/notify.c b/libpurple/notify.c index 91fe6aca0d..ede75a20e3 100644 --- a/libpurple/notify.c +++ b/libpurple/notify.c @@ -594,7 +594,7 @@ purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, cons } void -purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value) +purple_notify_user_info_prepend_pair_html(PurpleNotifyUserInfo *user_info, const char *label, const char *value) { PurpleNotifyUserInfoEntry *entry; @@ -602,6 +602,16 @@ purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char g_queue_push_head(&user_info->entries, entry); } +void +purple_notify_user_info_prepend_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value) +{ + gchar *escaped; + + escaped = g_markup_escape_text(value, -1); + purple_notify_user_info_prepend_pair_html(user_info, label, escaped); + g_free(escaped); +} + void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *entry) { diff --git a/libpurple/notify.h b/libpurple/notify.h index 7d0c5e7395..7488a779bb 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -489,19 +489,16 @@ void purple_notify_user_info_add_pair_html(PurpleNotifyUserInfo *user_info, cons void purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value); /** - * Prepend a label/value pair to a PurpleNotifyUserInfo object - * - * @param user_info The PurpleNotifyUserInfo - * @param label A label, which for example might be displayed by a - * UI with a colon after it ("Status:"). Do not include - * a colon. If NULL, value will be displayed without a - * label. - * @param value The value, which might be displayed by a UI after - * the label. If NULL, label will still be displayed; - * the UI should then treat label as independent and not - * include a colon if it would otherwise. + * Like purple_notify_user_info_add_pair_html, but the pair is inserted + * at the beginning of the list. + */ +void purple_notify_user_info_prepend_pair_html(PurpleNotifyUserInfo *user_info, const char *label, const char *value); + +/** + * Like purple_notify_user_info_prepend_pair_html, but value should be plaintext + * and will be escaped using g_markup_escape_text(). */ -void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value); +void purple_notify_user_info_prepend_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value); #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) /** @@ -525,9 +522,10 @@ void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, Purpl * If added to a PurpleNotifyUserInfo object, this should not be free()'d, * as PurpleNotifyUserInfo will do so when destroyed. * purple_notify_user_info_add_pair_html(), - * purple_notify_user_info_add_pair_plaintext() and - * purple_notify_user_info_prepend_pair() are convenience methods for - * creating entries and adding them to a PurpleNotifyUserInfo. + * purple_notify_user_info_add_pair_plaintext(), + * purple_notify_user_info_prepend_pair_html() and + * purple_notify_user_info_prepend_pair_plaintext() are convenience + * methods for creating entries and adding them to a PurpleNotifyUserInfo. * * @param label A label, which for example might be displayed by a UI * with a colon after it ("Status:"). Do not include a diff --git a/libpurple/plugins/perl/common/Notify.xs b/libpurple/plugins/perl/common/Notify.xs index 2798952a1b..1ec708e9dc 100644 --- a/libpurple/plugins/perl/common/Notify.xs +++ b/libpurple/plugins/perl/common/Notify.xs @@ -150,7 +150,7 @@ void purple_notify_user_info_add_pair_html(user_info, label, value) const char *label const char *value -void purple_notify_user_info_prepend_pair(user_info, label, value) +void purple_notify_user_info_prepend_pair_html(user_info, label, value) Purple::NotifyUserInfo user_info const char *label const char *value diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 01e9f0c764..5c4cad5cc6 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -733,13 +733,13 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, (jbr->client.version ? jbr->client.version : "")); /* TODO: Check whether it's correct to call prepend_pair_html, or if we should be using prepend_pair_plaintext */ - purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp); + purple_notify_user_info_prepend_pair_html(user_info, _("Client"), tmp); g_free(tmp); if (jbr->client.os) { /* TODO: Check whether it's correct to call prepend_pair_html, or if we should be using prepend_pair_plaintext */ - purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); + purple_notify_user_info_prepend_pair_html(user_info, _("Operating System"), jbr->client.os); } } @@ -784,7 +784,7 @@ add_jbr_info(JabberBuddyInfo *jbi, const char *resource, tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), ((status_name && purdy) ? ": " : ""), (purdy ? purdy : "")); - purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); + purple_notify_user_info_prepend_pair_html(user_info, _("Status"), tmp); g_snprintf(priority, sizeof(priority), "%d", jbr->priority); purple_notify_user_info_prepend_pair_plaintext(user_info, _("Priority"), priority); @@ -835,7 +835,7 @@ static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) if (jbr->name) { /* TODO: Check whether it's correct to call prepend_pair_html, or if we should be using prepend_pair_plaintext */ - purple_notify_user_info_prepend_pair(user_info, _("Resource"), jbr->name); + purple_notify_user_info_prepend_pair_html(user_info, _("Resource"), jbr->name); } } } @@ -868,7 +868,7 @@ static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) jbi->last_message ? jbi->last_message : ""); /* TODO: Check whether it's correct to call prepend_pair_html, or if we should be using prepend_pair_plaintext */ - purple_notify_user_info_prepend_pair(user_info, _("Status"), status); + purple_notify_user_info_prepend_pair_html(user_info, _("Status"), status); g_free(status); } } diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 0b6729a594..f05aee31ce 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -2812,7 +2812,7 @@ msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer user_data, purple_debug_info("msn", "%s is %" G_GSIZE_FORMAT " bytes\n", photo_url_text, len); id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); g_snprintf(buf, sizeof(buf), "
", id); - purple_notify_user_info_prepend_pair(user_info, NULL, buf); + purple_notify_user_info_prepend_pair_html(user_info, NULL, buf); } } -- cgit v1.2.1 From c7b4248886c79f7b7667ca6fb435a8cd7aecf5b3 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 07:01:27 +0000 Subject: Remove silc10 --- configure.ac | 59 +- libpurple/protocols/Makefile.am | 2 +- libpurple/protocols/silc10/Makefile.am | 36 - libpurple/protocols/silc10/Makefile.mingw | 93 -- libpurple/protocols/silc10/README | 31 - libpurple/protocols/silc10/TODO | 8 - libpurple/protocols/silc10/buddy.c | 1748 ------------------------ libpurple/protocols/silc10/chat.c | 1456 -------------------- libpurple/protocols/silc10/ft.c | 412 ------ libpurple/protocols/silc10/ops.c | 2063 ----------------------------- libpurple/protocols/silc10/pk.c | 274 ---- libpurple/protocols/silc10/silc.c | 1965 --------------------------- libpurple/protocols/silc10/silcpurple.h | 173 --- libpurple/protocols/silc10/util.c | 776 ----------- libpurple/protocols/silc10/wb.c | 520 -------- libpurple/protocols/silc10/wb.h | 49 - 16 files changed, 3 insertions(+), 9662 deletions(-) delete mode 100644 libpurple/protocols/silc10/Makefile.am delete mode 100644 libpurple/protocols/silc10/Makefile.mingw delete mode 100644 libpurple/protocols/silc10/README delete mode 100644 libpurple/protocols/silc10/TODO delete mode 100644 libpurple/protocols/silc10/buddy.c delete mode 100644 libpurple/protocols/silc10/chat.c delete mode 100644 libpurple/protocols/silc10/ft.c delete mode 100644 libpurple/protocols/silc10/ops.c delete mode 100644 libpurple/protocols/silc10/pk.c delete mode 100644 libpurple/protocols/silc10/silc.c delete mode 100644 libpurple/protocols/silc10/silcpurple.h delete mode 100644 libpurple/protocols/silc10/util.c delete mode 100644 libpurple/protocols/silc10/wb.c delete mode 100644 libpurple/protocols/silc10/wb.h diff --git a/configure.ac b/configure.ac index 2b4613fe38..89b66d5f41 100644 --- a/configure.ac +++ b/configure.ac @@ -941,25 +941,6 @@ if test "x$silc_manual_check" = "xno"; then ], [ have_silc="no" ]) - if test "x$have_silc" = "xno"; then - PKG_CHECK_MODULES(SILC, silcclient, [ - have_silc="yes" - silc10includes="yes" - silc10client="yes" - ], [ - have_silc="no" - ]) - dnl If silcclient.pc wasn't found, check for just silc.pc - if test "x$have_silc" = "xno"; then - PKG_CHECK_MODULES(SILC, silc, [ - have_silc="yes" - silc10includes="yes" - silc10client="yes" - ], [ - have_silc="no" - ]) - fi - fi else if test "$ac_silc_includes" != "no"; then SILC_CFLAGS="-I$ac_silc_includes" @@ -977,17 +958,6 @@ else if test "x$silcincludes" = "xyes" -a "x$silcclient" = "xyes"; then have_silc="yes" - else - CPPFLAGS_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $SILC_CFLAGS" - AC_CHECK_HEADER(silcincludes.h, [silc10includes=yes]) - CPPFLAGS="$CPPFLAGS_save" - - SILC_LIBS="$SILC_LIBS -lsilc -lsilcclient -lpthread $LIBDL" - AC_CHECK_LIB(silcclient, silc_client_init, [silc10client=yes], , $SILC_LIBS) - if test "x$silc10includes" = "xyes" -a "x$silc10client" = "xyes"; then - have_silc="yes" - fi fi fi AC_SUBST(SILC_LIBS) @@ -995,20 +965,6 @@ AC_SUBST(SILC_CFLAGS) dnl SILC Toolkit >= 1.0.1 has a new MIME API if test "x$silcclient" = "xyes"; then AC_DEFINE(HAVE_SILCMIME_H, 1, [Define if we have silcmime.h]) -elif test "x$silc10client" = "xyes"; then - CPPFLAGS_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $SILC_CFLAGS" - AC_MSG_CHECKING(for silcmime.h) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include - ]], [[]])], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SILCMIME_H, 1, [Define if we have silcmime.h]) - ], [ - AC_MSG_RESULT(no) - ]) - CPPFLAGS="$CPPFLAGS_save" fi dnl ####################################################################### @@ -1123,10 +1079,7 @@ if test "x$avahiincludes" != "xyes" -o "x$avahilibs" != "xyes"; then STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/bonjour//'` fi if test "x$silcincludes" != "xyes" -o "x$silcclient" != "xyes"; then - STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/silc/silc10/'` -fi -if test "x$silc10includes" != "xyes" -o "x$silc10client" != "xyes"; then - STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/silc10//'` + STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/silc//'` fi AC_SUBST(STATIC_PRPLS) STATIC_LINK_LIBS= @@ -1150,8 +1103,6 @@ for i in $STATIC_PRPLS ; do else if test "x$i" = "xsilc"; then STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/$i/lib${i}purple.la" - elif test "x$i" = "xsilc10"; then - STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/$i/libsilcpurple.la" else STATIC_LINK_LIBS="$STATIC_LINK_LIBS \$(top_builddir)/libpurple/protocols/$i/lib$i.la" fi @@ -1172,7 +1123,6 @@ for i in $STATIC_PRPLS ; do icq) static_oscar=yes ;; sametime) static_sametime=yes ;; silc) static_silc=yes ;; - silc10) static_silc=yes ;; simple) static_simple=yes ;; yahoo) static_yahoo=yes ;; zephyr) static_zephyr=yes ;; @@ -1208,10 +1158,7 @@ if test "x$avahiincludes" != "xyes" -o "x$avahilibs" != "xyes"; then DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/bonjour//'` fi if test "x$silcincludes" != "xyes" -o "x$silcclient" != "xyes"; then - DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/silc/silc10/'` -fi -if test "x$silc10includes" != "xyes" -o "x$silc10client" != "xyes"; then - DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/silc10//'` + DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/silc//'` fi AC_SUBST(DYNAMIC_PRPLS) for i in $DYNAMIC_PRPLS ; do @@ -1230,7 +1177,6 @@ for i in $DYNAMIC_PRPLS ; do icq) dynamic_oscar=yes ;; sametime) dynamic_sametime=yes ;; silc) dynamic_silc=yes ;; - silc10) dynamic_silc=yes ;; simple) dynamic_simple=yes ;; yahoo) dynamic_yahoo=yes ;; zephyr) dynamic_zephyr=yes ;; @@ -2575,7 +2521,6 @@ AC_CONFIG_FILES([Makefile libpurple/protocols/oscar/Makefile libpurple/protocols/sametime/Makefile libpurple/protocols/silc/Makefile - libpurple/protocols/silc10/Makefile libpurple/protocols/simple/Makefile libpurple/protocols/yahoo/Makefile libpurple/protocols/zephyr/Makefile diff --git a/libpurple/protocols/Makefile.am b/libpurple/protocols/Makefile.am index 7fea4bd5fc..b58394f693 100644 --- a/libpurple/protocols/Makefile.am +++ b/libpurple/protocols/Makefile.am @@ -1,5 +1,5 @@ EXTRA_DIST = Makefile.mingw -DIST_SUBDIRS = bonjour gg irc jabber msn myspace mxit novell null oscar sametime silc silc10 simple yahoo zephyr +DIST_SUBDIRS = bonjour gg irc jabber msn myspace mxit novell null oscar sametime silc simple yahoo zephyr SUBDIRS = $(DYNAMIC_PRPLS) $(STATIC_PRPLS) diff --git a/libpurple/protocols/silc10/Makefile.am b/libpurple/protocols/silc10/Makefile.am deleted file mode 100644 index 87db235724..0000000000 --- a/libpurple/protocols/silc10/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - README \ - TODO - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -SILCSOURCES = silc.c silcpurple.h buddy.c chat.c ft.c ops.c pk.c util.c wb.c wb.h - -AM_CFLAGS = $(st) - -libsilcpurple_la_LDFLAGS = -module -avoid-version - -if STATIC_SILC - -st = -DPURPLE_STATIC_PRPL $(SILC_CFLAGS) -noinst_LTLIBRARIES = libsilcpurple.la -libsilcpurple_la_SOURCES = $(SILCSOURCES) -libsilcpurple_la_CFLAGS = $(AM_CFLAGS) -libsilcpurple_la_LIBADD = $(SILC_LIBS) - -else - -st = $(SILC_CFLAGS) -pkg_LTLIBRARIES = libsilcpurple.la -libsilcpurple_la_SOURCES = $(SILCSOURCES) -libsilcpurple_la_LIBADD = $(GLIB_LIBS) $(SILC_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(SILC_CFLAGS) diff --git a/libpurple/protocols/silc10/Makefile.mingw b/libpurple/protocols/silc10/Makefile.mingw deleted file mode 100644 index d087b331a8..0000000000 --- a/libpurple/protocols/silc10/Makefile.mingw +++ /dev/null @@ -1,93 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libsilc protocol plugin -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -DEFINES := $(subst -DWIN32_LEAN_AND_MEAN,,$(DEFINES)) - -TARGET = libsilc -NEEDED_DLLS = $(SILC_TOOLKIT)/lib/silc.dll \ - $(SILC_TOOLKIT)/lib/silcclient.dll -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) \ - -I$(SILC_TOOLKIT)/include - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(SILC_TOOLKIT)/lib - -## -## SOURCES, OBJECTS -## -C_SRC = silc.c \ - buddy.c \ - chat.c \ - ft.c \ - ops.c \ - pk.c \ - util.c \ - wb.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -lsilc \ - -lsilcclient - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - cp $(NEEDED_DLLS) $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--image-base,0x64000000 -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff --git a/libpurple/protocols/silc10/README b/libpurple/protocols/silc10/README deleted file mode 100644 index 90cbdb5025..0000000000 --- a/libpurple/protocols/silc10/README +++ /dev/null @@ -1,31 +0,0 @@ -SILC Purple Plugin -================== - -This is the Purple protocol plugin of the protocol called Secure Internet -Live Conferencing (SILC). The implementation will use the SILC Toolkit, -freely available from the http://silcnet.org/ site, for the actual SILC -protocol implementation. - -To include SILC into Purple, one needs to first compile and install -the SILC Toolkit. It is done as follows: - - ./configure --enable-shared - make - make install - -This will compile shared libraries of the SILC Toolkit. If the --prefix -is not given to ./configure, the binaries are installed into the -/usr/local/silc directory. - -Once the Toolkit is installed one needs to tell Purple's ./configure -script where the SILC Toolkit is located. It is done as simply as: - - ./configure - -if pkg-config is installed in your system. If it is isn't it's done as: - - ./configure --with-silc-libs=/path/to/silc/lib - --with-silc-includes=/path/to/silc/include - -If the SILC Toolkit cannot be found then the SILC protocol plugin will -not be compiled. diff --git a/libpurple/protocols/silc10/TODO b/libpurple/protocols/silc10/TODO deleted file mode 100644 index 285ca58485..0000000000 --- a/libpurple/protocols/silc10/TODO +++ /dev/null @@ -1,8 +0,0 @@ -Features TODO (maybe) -===================== - -Preferences - - Add joined channels to buddy list automatically (during - session) - - Add joined channels to buddy list automatically permanently - diff --git a/libpurple/protocols/silc10/buddy.c b/libpurple/protocols/silc10/buddy.c deleted file mode 100644 index aaedee6088..0000000000 --- a/libpurple/protocols/silc10/buddy.c +++ /dev/null @@ -1,1748 +0,0 @@ -/* - - silcpurple_buddy.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/***************************** Key Agreement *********************************/ - -static void -silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data); - -static void -silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, - gboolean force_local); - -typedef struct { - char *nick; - PurpleConnection *gc; -} *SilcPurpleResolve; - -static void -silcpurple_buddy_keyagr_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurpleResolve r = context; - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), r->nick); - purple_notify_error(gc, _("Key Agreement"), - _("Cannot perform the key agreement"), tmp); - silc_free(r->nick); - silc_free(r); - return; - } - - silcpurple_buddy_keyagr_do(gc, r->nick, FALSE); - silc_free(r->nick); - silc_free(r); -} - -typedef struct { - gboolean responder; -} *SilcPurpleKeyAgr; - -static void -silcpurple_buddy_keyagr_cb(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - SilcKeyAgreementStatus status, - SilcSKEKeyMaterial *key, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleKeyAgr a = context; - - if (!sg->conn) - return; - - switch (status) { - case SILC_KEY_AGREEMENT_OK: - { - PurpleConversation *convo; - char tmp[128]; - - /* Set the private key for this client */ - silc_client_del_private_message_key(client, conn, client_entry); - silc_client_add_private_message_key_ske(client, conn, client_entry, - NULL, NULL, key, a->responder); - silc_ske_free_key_material(key); - - - /* Open IM window */ - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - client_entry->nickname, sg->account); - if (convo) { - /* we don't have windows in the core anymore...but we may want to - * provide some method for asking the UI to show the window - purple_conv_window_show(purple_conversation_get_window(convo)); - */ - } else { - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, sg->account, - client_entry->nickname); - } - g_snprintf(tmp, sizeof(tmp), "%s [private key]", client_entry->nickname); - purple_conversation_set_title(convo, tmp); - } - break; - - case SILC_KEY_AGREEMENT_ERROR: - purple_notify_error(gc, _("Key Agreement"), - _("Error occurred during key agreement"), NULL); - break; - - case SILC_KEY_AGREEMENT_FAILURE: - purple_notify_error(gc, _("Key Agreement"), _("Key Agreement failed"), NULL); - break; - - case SILC_KEY_AGREEMENT_TIMEOUT: - purple_notify_error(gc, _("Key Agreement"), - _("Timeout during key agreement"), NULL); - break; - - case SILC_KEY_AGREEMENT_ABORTED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement was aborted"), NULL); - break; - - case SILC_KEY_AGREEMENT_ALREADY_STARTED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement is already started"), NULL); - break; - - case SILC_KEY_AGREEMENT_SELF_DENIED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement cannot be started with yourself"), - NULL); - break; - - default: - break; - } - - silc_free(a); -} - -static void -silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, - gboolean force_local) -{ - SilcPurple sg = gc->proto_data; - SilcClientEntry *clients; - SilcUInt32 clients_count; - char *local_ip = NULL, *remote_ip = NULL; - gboolean local = TRUE; - char *nickname; - SilcPurpleKeyAgr a; - - if (!sg->conn || !name) - return; - - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, nickname, name, - &clients_count); - if (!clients) { - /* Resolve unknown user */ - SilcPurpleResolve r = silc_calloc(1, sizeof(*r)); - if (!r) - return; - r->nick = g_strdup(name); - r->gc = gc; - silc_client_get_clients(sg->client, sg->conn, nickname, NULL, - silcpurple_buddy_keyagr_resolved, r); - silc_free(nickname); - return; - } - - /* Resolve the local IP from the outgoing socket connection. We resolve - it to check whether we have a private range IP address or public IP - address. If we have public then we will assume that we are not behind - NAT and will provide automatically the point of connection to the - agreement. If we have private range address we assume that we are - behind NAT and we let the responder provide the point of connection. - - The algorithm also checks the remote IP address of server connection. - If it is private range address and we have private range address we - assume that we are chatting in LAN and will provide the point of - connection. - - Naturally this algorithm does not always get things right. */ - - if (silc_net_check_local_by_sock(sg->conn->sock->sock, NULL, &local_ip)) { - /* Check if the IP is private */ - if (!force_local && silcpurple_ip_is_private(local_ip)) { - local = FALSE; - - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(sg->conn->sock->sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide - the connection point. */ - local = TRUE; - } - } - - if (force_local) - local = TRUE; - - if (local && !local_ip) - local_ip = silc_net_localip(); - - a = silc_calloc(1, sizeof(*a)); - if (!a) - return; - a->responder = local; - - /* Send the key agreement request */ - silc_client_send_key_agreement(sg->client, sg->conn, clients[0], - local ? local_ip : NULL, NULL, 0, 60, - silcpurple_buddy_keyagr_cb, a); - - silc_free(local_ip); - silc_free(remote_ip); - silc_free(clients); -} - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; - char *hostname; - SilcUInt16 port; -} *SilcPurpleKeyAgrAsk; - -static void -silcpurple_buddy_keyagr_request_cb(SilcPurpleKeyAgrAsk a, gint id) -{ - SilcPurpleKeyAgr ai; - SilcClientEntry client_entry; - - if (id != 1) - goto out; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(a->client, a->conn, - &a->client_id); - if (!client_entry) { - purple_notify_error(a->client->application, _("Key Agreement"), - _("The remote user is not present in the network any more"), - NULL); - goto out; - } - - /* If the hostname was provided by the requestor perform the key agreement - now. Otherwise, we will send him a request to connect to us. */ - if (a->hostname) { - ai = silc_calloc(1, sizeof(*ai)); - if (!ai) - goto out; - ai->responder = FALSE; - silc_client_perform_key_agreement(a->client, a->conn, client_entry, - a->hostname, a->port, - silcpurple_buddy_keyagr_cb, ai); - } else { - /* Send request. Force us as the point of connection since requestor - did not provide the point of connection. */ - silcpurple_buddy_keyagr_do(a->client->application, - client_entry->nickname, TRUE); - } - - out: - silc_free(a->hostname); - silc_free(a); -} - -void silcpurple_buddy_keyagr_request(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 port) -{ - char tmp[128], tmp2[128]; - SilcPurpleKeyAgrAsk a; - PurpleConnection *gc = client->application; - - g_snprintf(tmp, sizeof(tmp), - _("Key agreement request received from %s. Would you like to " - "perform the key agreement?"), client_entry->nickname); - if (hostname) - g_snprintf(tmp2, sizeof(tmp2), - _("The remote user is waiting key agreement on:\n" - "Remote host: %s\nRemote port: %d"), hostname, port); - - a = silc_calloc(1, sizeof(*a)); - if (!a) - return; - a->client = client; - a->conn = conn; - a->client_id = *client_entry->id; - if (hostname) - a->hostname = strdup(hostname); - a->port = port; - - purple_request_action(client->application, _("Key Agreement Request"), tmp, - hostname ? tmp2 : NULL, 1, gc->account, client_entry->nickname, - NULL, a, 2, _("Yes"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb), - _("No"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb)); -} - -static void -silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - - buddy = (PurpleBuddy *)node; - silcpurple_buddy_keyagr_do(buddy->account->gc, buddy->name, FALSE); -} - - -/**************************** Static IM Key **********************************/ - -static void -silcpurple_buddy_resetkey(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - char *nickname; - SilcClientEntry *clients; - SilcUInt32 clients_count; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); - sg = gc->proto_data; - - if (!silc_parse_userfqdn(b->name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, - nickname, b->name, - &clients_count); - if (!clients) { - silc_free(nickname); - return; - } - - clients[0]->prv_resp = FALSE; - silc_client_del_private_message_key(sg->client, sg->conn, - clients[0]); - silc_free(clients); - silc_free(nickname); -} - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; -} *SilcPurplePrivkey; - -static void -silcpurple_buddy_privkey(PurpleConnection *gc, const char *name); - -static void -silcpurple_buddy_privkey_cb(SilcPurplePrivkey p, const char *passphrase) -{ - SilcClientEntry client_entry; - - if (!passphrase || !(*passphrase)) { - silc_free(p); - return; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(p->client, p->conn, - &p->client_id); - if (!client_entry) { - purple_notify_error(p->client->application, _("IM With Password"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(p); - return; - } - - /* Set the private message key */ - silc_client_del_private_message_key(p->client, p->conn, - client_entry); - silc_client_add_private_message_key(p->client, p->conn, - client_entry, NULL, NULL, - (unsigned char *)passphrase, - strlen(passphrase), FALSE, - client_entry->prv_resp); - if (!client_entry->prv_resp) - silc_client_send_private_message_key_request(p->client, - p->conn, - client_entry); - silc_free(p); -} - -static void -silcpurple_buddy_privkey_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(client->application, _("IM With Password"), - _("Cannot set IM key"), tmp); - g_free(context); - return; - } - - silcpurple_buddy_privkey(client->application, context); - silc_free(context); -} - -static void -silcpurple_buddy_privkey(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - char *nickname; - SilcPurplePrivkey p; - SilcClientEntry *clients; - SilcUInt32 clients_count; - - if (!name) - return; - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, - nickname, name, - &clients_count); - if (!clients) { - silc_client_get_clients(sg->client, sg->conn, nickname, NULL, - silcpurple_buddy_privkey_resolved, - g_strdup(name)); - silc_free(nickname); - return; - } - - p = silc_calloc(1, sizeof(*p)); - if (!p) - return; - p->client = sg->client; - p->conn = sg->conn; - p->client_id = *clients[0]->id; - purple_request_input(gc, _("IM With Password"), NULL, - _("Set IM Password"), NULL, FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(silcpurple_buddy_privkey_cb), - _("Cancel"), G_CALLBACK(silcpurple_buddy_privkey_cb), - gc->account, NULL, NULL, p); - - silc_free(clients); - silc_free(nickname); -} - -static void -silcpurple_buddy_privkey_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - silcpurple_buddy_privkey(gc, buddy->name); -} - - -/**************************** Get Public Key *********************************/ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; -} *SilcPurpleBuddyGetkey; - -static void -silcpurple_buddy_getkey(PurpleConnection *gc, const char *name); - -static void -silcpurple_buddy_getkey_cb(SilcPurpleBuddyGetkey g, - SilcClientCommandReplyContext cmd) -{ - SilcClientEntry client_entry; - unsigned char *pk; - SilcUInt32 pk_len; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(g->client, g->conn, - &g->client_id); - if (!client_entry) { - purple_notify_error(g->client->application, _("Get Public Key"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(g); - return; - } - - if (!client_entry->public_key) { - silc_free(g); - return; - } - - /* Now verify the public key */ - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - silcpurple_verify_public_key(g->client, g->conn, client_entry->nickname, - SILC_SOCKET_TYPE_CLIENT, - pk, pk_len, SILC_SKE_PK_TYPE_SILC, - NULL, NULL); - silc_free(pk); - silc_free(g); -} - -static void -silcpurple_buddy_getkey_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(client->application, _("Get Public Key"), - _("Cannot fetch the public key"), tmp); - g_free(context); - return; - } - - silcpurple_buddy_getkey(client->application, context); - silc_free(context); -} - -static void -silcpurple_buddy_getkey(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry *clients; - SilcUInt32 clients_count; - SilcPurpleBuddyGetkey g; - char *nickname; - - if (!name) - return; - - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, nickname, name, - &clients_count); - if (!clients) { - silc_client_get_clients(client, conn, nickname, NULL, - silcpurple_buddy_getkey_resolved, - g_strdup(name)); - silc_free(nickname); - return; - } - - /* Call GETKEY */ - g = silc_calloc(1, sizeof(*g)); - if (!g) - return; - g->client = client; - g->conn = conn; - g->client_id = *clients[0]->id; - silc_client_command_call(client, conn, NULL, "GETKEY", - clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_buddy_getkey_cb, g); - silc_free(clients); - silc_free(nickname); -} - -static void -silcpurple_buddy_getkey_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - silcpurple_buddy_getkey(gc, buddy->name); -} - -static void -silcpurple_buddy_showkey(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - SilcPublicKey public_key; - const char *pkfile; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); - sg = gc->proto_data; - - pkfile = purple_blist_node_get_string(node, "public-key"); - if (!silc_pkcs_load_public_key(pkfile, &public_key, SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(pkfile, &public_key, SILC_PKCS_FILE_BIN)) { - purple_notify_error(gc, - _("Show Public Key"), - _("Could not load public key"), NULL); - return; - } - - silcpurple_show_public_key(sg, b->name, public_key, NULL, NULL); - silc_pkcs_public_key_free(public_key); -} - - -/**************************** Buddy routines *********************************/ - -/* The buddies are implemented by using the WHOIS and WATCH commands that - can be used to search users by their public key. Since nicknames aren't - unique in SILC we cannot trust the buddy list using their nickname. We - associate public keys to buddies and use those to search and watch - in the network. - - The problem is that Purple does not return PurpleBuddy contexts to the - callbacks but the buddy names. Naturally, this is not going to work - with SILC. But, for now, we have to do what we can... */ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; - PurpleBuddy *b; - unsigned char *offline_pk; - SilcUInt32 offline_pk_len; - unsigned int offline : 1; - unsigned int pubkey_search : 1; - unsigned int init : 1; -} *SilcPurpleBuddyRes; - -static void -silcpurple_add_buddy_ask_pk_cb(SilcPurpleBuddyRes r, gint id); -static void -silcpurple_add_buddy_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context); - -void silcpurple_get_info(PurpleConnection *gc, const char *who) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry client_entry; - PurpleBuddy *b; - const char *filename, *nick = who; - char tmp[256]; - - if (!who) - return; - if (strlen(who) > 1 && who[0] == '@') - nick = who + 1; - if (strlen(who) > 1 && who[0] == '*') - nick = who + 1; - if (strlen(who) > 2 && who[0] == '*' && who[1] == '@') - nick = who + 2; - - b = purple_find_buddy(gc->account, nick); - if (b) { - /* See if we have this buddy's public key. If we do use that - to search the details. */ - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - if (filename) { - /* Call WHOIS. The user info is displayed in the WHOIS - command reply. */ - silc_client_command_call(client, conn, NULL, "WHOIS", - "-details", "-pubkey", filename, NULL); - return; - } - - if (!b->proto_data) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), b->name); - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), tmp); - return; - } - - client_entry = silc_client_get_client_by_id(client, conn, b->proto_data); - if (client_entry) { - /* Call WHOIS. The user info is displayed in the WHOIS - command reply. */ - silc_client_command_call(client, conn, NULL, "WHOIS", - client_entry->nickname, "-details", NULL); - } - } else { - /* Call WHOIS just with nickname. */ - silc_client_command_call(client, conn, NULL, "WHOIS", nick, NULL); - } -} - -static void -silcpurple_add_buddy_pk_no(SilcPurpleBuddyRes r) -{ - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not trusted"), - r->b->name); - purple_notify_error(r->client->application, _("Add Buddy"), tmp, - _("You cannot receive buddy notifications until you " - "import his/her public key. You can use the Get Public Key " - "command to get the public key.")); - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); -} - -static void -silcpurple_add_buddy_save(bool success, void *context) -{ - SilcPurpleBuddyRes r = context; - PurpleBuddy *b = r->b; - SilcClient client = r->client; - SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttribute attribute; - SilcVCardStruct vcard; - SilcAttributeObjMime message, extension; -#ifdef SILC_ATTRIBUTE_USER_ICON - SilcAttributeObjMime usericon; -#endif - SilcAttributeObjPk serverpk, usersign, serversign; - gboolean usign_success = TRUE, ssign_success = TRUE; - char filename[512], filename2[512], *fingerprint = NULL, *tmp; - SilcUInt32 len; - int i; - - if (!success) { - /* The user did not trust the public key. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - if (r->offline) { - /* User is offline. Associate the imported public key with - this user. */ - fingerprint = silc_hash_fingerprint(NULL, r->offline_pk, - r->offline_pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - purple_blist_node_set_string((PurpleBlistNode *)b, "public-key", filename); - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - silc_free(fingerprint); - silc_free(r->offline_pk); - silc_free(r); - return; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(r->client, r->conn, - &r->client_id); - if (!client_entry) { - silc_free(r); - return; - } - - memset(&vcard, 0, sizeof(vcard)); - memset(&message, 0, sizeof(message)); - memset(&extension, 0, sizeof(extension)); -#ifdef SILC_ATTRIBUTE_USER_ICON - memset(&usericon, 0, sizeof(usericon)); -#endif - memset(&serverpk, 0, sizeof(serverpk)); - memset(&usersign, 0, sizeof(usersign)); - memset(&serversign, 0, sizeof(serversign)); - - /* Now that we have the public key and we trust it now we - save the attributes of the buddy and update its status. */ - - if (client_entry->attrs) { - silc_dlist_start(client_entry->attrs); - while ((attr = silc_dlist_get(client_entry->attrs)) - != SILC_LIST_END) { - attribute = silc_attribute_get_attribute(attr); - - switch (attribute) { - case SILC_ATTRIBUTE_USER_INFO: - if (!silc_attribute_get_object(attr, (void *)&vcard, - sizeof(vcard))) - continue; - break; - - case SILC_ATTRIBUTE_STATUS_MESSAGE: - if (!silc_attribute_get_object(attr, (void *)&message, - sizeof(message))) - continue; - break; - - case SILC_ATTRIBUTE_EXTENSION: - if (!silc_attribute_get_object(attr, (void *)&extension, - sizeof(extension))) - continue; - break; - -#ifdef SILC_ATTRIBUTE_USER_ICON - case SILC_ATTRIBUTE_USER_ICON: - if (!silc_attribute_get_object(attr, (void *)&usericon, - sizeof(usericon))) - continue; - break; -#endif - - case SILC_ATTRIBUTE_SERVER_PUBLIC_KEY: - if (serverpk.type) - continue; - if (!silc_attribute_get_object(attr, (void *)&serverpk, - sizeof(serverpk))) - continue; - break; - - case SILC_ATTRIBUTE_USER_DIGITAL_SIGNATURE: - if (usersign.data) - continue; - if (!silc_attribute_get_object(attr, (void *)&usersign, - sizeof(usersign))) - continue; - break; - - case SILC_ATTRIBUTE_SERVER_DIGITAL_SIGNATURE: - if (serversign.data) - continue; - if (!silc_attribute_get_object(attr, (void *)&serversign, - sizeof(serversign))) - continue; - break; - - default: - break; - } - } - } - - /* Verify the attribute signatures */ - - if (usersign.data) { - SilcPKCS pkcs; - unsigned char *verifyd; - SilcUInt32 verify_len; - - silc_pkcs_alloc((unsigned char*)"rsa", &pkcs); - verifyd = silc_attribute_get_verify_data(client_entry->attrs, - FALSE, &verify_len); - if (verifyd && silc_pkcs_public_key_set(pkcs, client_entry->public_key)){ - if (!silc_pkcs_verify_with_hash(pkcs, client->sha1hash, - usersign.data, - usersign.data_len, - verifyd, verify_len)) - usign_success = FALSE; - } - silc_free(verifyd); - } - - if (serversign.data && !strcmp(serverpk.type, "silc-rsa")) { - SilcPublicKey public_key; - SilcPKCS pkcs; - unsigned char *verifyd; - SilcUInt32 verify_len; - - if (silc_pkcs_public_key_decode(serverpk.data, serverpk.data_len, - &public_key)) { - silc_pkcs_alloc((unsigned char *)"rsa", &pkcs); - verifyd = silc_attribute_get_verify_data(client_entry->attrs, - TRUE, &verify_len); - if (verifyd && silc_pkcs_public_key_set(pkcs, public_key)) { - if (!silc_pkcs_verify_with_hash(pkcs, client->sha1hash, - serversign.data, - serversign.data_len, - verifyd, verify_len)) - ssign_success = FALSE; - } - silc_pkcs_public_key_free(public_key); - silc_free(verifyd); - } - } - - fingerprint = silc_fingerprint(client_entry->fingerprint, - client_entry->fingerprint_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - - if (usign_success || ssign_success) { - struct passwd *pw; - struct stat st; - - memset(filename2, 0, sizeof(filename2)); - - /* Filename for dir */ - tmp = fingerprint + strlen(fingerprint) - 9; - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "friends" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), tmp); - - pw = getpwuid(getuid()); - if (!pw) - return; - - /* Create dir if it doesn't exist */ - if ((g_stat(filename, &st)) == -1) { - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - int ret = g_mkdir(filename, 0755); - if (ret < 0) - return; - } - } - } - - /* Save VCard */ - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "vcard", filename); - if (vcard.full_name) { - tmp = (char *)silc_vcard_encode(&vcard, &len); - silc_file_writefile(filename2, tmp, len); - silc_free(tmp); - } - - /* Save status message */ - if (message.mime) { - memset(filename2, 0, sizeof(filename2)); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "status_message.mime", - filename); - silc_file_writefile(filename2, (char *)message.mime, - message.mime_len); - } - - /* Save extension data */ - if (extension.mime) { - memset(filename2, 0, sizeof(filename2)); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "extension.mime", - filename); - silc_file_writefile(filename2, (char *)extension.mime, - extension.mime_len); - } - -#ifdef SILC_ATTRIBUTE_USER_ICON - /* Save user icon */ - if (usericon.mime) { - SilcMime m = silc_mime_decode(usericon.mime, - usericon.mime_len); - if (m) { - const char *type = silc_mime_get_field(m, "Content-Type"); - if (!strcmp(type, "image/jpeg") || - !strcmp(type, "image/gif") || - !strcmp(type, "image/bmp") || - !strcmp(type, "image/png")) { - const unsigned char *data; - SilcUInt32 data_len; - data = silc_mime_get_data(m, &data_len); - if (data) { - /* TODO: Check if SILC gives us something to use as the checksum instead */ - purple_buddy_icons_set_for_user(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), g_memdup(data, data_len), data_len, NULL); - } - } - silc_mime_free(m); - } - } -#endif - } - - /* Save the public key path to buddy properties, as it is used - to identify the buddy in the network (and not the nickname). */ - memset(filename, 0, sizeof(filename)); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - purple_blist_node_set_string((PurpleBlistNode *)b, "public-key", filename); - - /* Update online status */ - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - - /* Finally, start watching this user so we receive its status - changes from the server */ - g_snprintf(filename2, sizeof(filename2) - 1, "+%s", filename); - silc_client_command_call(r->client, r->conn, NULL, "WATCH", "-pubkey", - filename2, NULL); - - silc_free(fingerprint); - silc_free(r); -} - -static void -silcpurple_add_buddy_ask_import(void *user_data, const char *name) -{ - SilcPurpleBuddyRes r = (SilcPurpleBuddyRes)user_data; - SilcPublicKey public_key; - - /* Load the public key */ - if (!silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_BIN)) { - silcpurple_add_buddy_ask_pk_cb(r, 0); - purple_notify_error(r->client->application, - _("Add Buddy"), _("Could not load public key"), NULL); - return; - } - - /* Now verify the public key */ - r->offline_pk = silc_pkcs_public_key_encode(public_key, &r->offline_pk_len); - silcpurple_verify_public_key(r->client, r->conn, r->b->name, - SILC_SOCKET_TYPE_CLIENT, - r->offline_pk, r->offline_pk_len, - SILC_SKE_PK_TYPE_SILC, - silcpurple_add_buddy_save, r); -} - -static void -silcpurple_add_buddy_ask_pk_cancel(void *user_data, const char *name) -{ - SilcPurpleBuddyRes r = (SilcPurpleBuddyRes)user_data; - - /* The user did not import public key. The buddy is unusable. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); -} - -static void -silcpurple_add_buddy_ask_pk_cb(SilcPurpleBuddyRes r, gint id) -{ - if (id != 0) { - /* The user did not import public key. The buddy is unusable. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - /* Open file selector to select the public key. */ - purple_request_file(r->client->application, _("Open..."), NULL, FALSE, - G_CALLBACK(silcpurple_add_buddy_ask_import), - G_CALLBACK(silcpurple_add_buddy_ask_pk_cancel), - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r); - -} - -static void -silcpurple_add_buddy_ask_pk(SilcPurpleBuddyRes r) -{ - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not present in the network"), - r->b->name); - purple_request_action(r->client->application, _("Add Buddy"), tmp, - _("To add the buddy you must import his/her public key. " - "Press Import to import a public key."), 0, - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r, 2, - _("Cancel"), G_CALLBACK(silcpurple_add_buddy_ask_pk_cb), - _("_Import..."), G_CALLBACK(silcpurple_add_buddy_ask_pk_cb)); -} - -static void -silcpurple_add_buddy_getkey_cb(SilcPurpleBuddyRes r, - SilcClientCommandReplyContext cmd) -{ - SilcClientEntry client_entry; - unsigned char *pk; - SilcUInt32 pk_len; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(r->client, r->conn, - &r->client_id); - if (!client_entry || !client_entry->public_key) { - /* The buddy is offline/nonexistent. We will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - r->offline = TRUE; - silcpurple_add_buddy_ask_pk(r); - return; - } - - /* Now verify the public key */ - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - silcpurple_verify_public_key(r->client, r->conn, client_entry->nickname, - SILC_SOCKET_TYPE_CLIENT, - pk, pk_len, SILC_SKE_PK_TYPE_SILC, - silcpurple_add_buddy_save, r); - silc_free(pk); -} - -static void -silcpurple_add_buddy_select_cb(SilcPurpleBuddyRes r, PurpleRequestFields *fields) -{ - PurpleRequestField *f; - GList *list; - SilcClientEntry client_entry; - - f = purple_request_fields_get_field(fields, "list"); - list = purple_request_field_list_get_selected(f); - if (!list) { - /* The user did not select any user. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - client_entry = purple_request_field_list_get_data(f, list->data); - silcpurple_add_buddy_resolved(r->client, r->conn, &client_entry, 1, r); -} - -static void -silcpurple_add_buddy_select_cancel(SilcPurpleBuddyRes r, PurpleRequestFields *fields) -{ - /* The user did not select any user. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); -} - -static void -silcpurple_add_buddy_select(SilcPurpleBuddyRes r, - SilcClientEntry *clients, - SilcUInt32 clients_count) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - char tmp[512], tmp2[128]; - int i; - char *fingerprint; - - fields = purple_request_fields_new(); - g = purple_request_field_group_new(NULL); - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_fields_add_group(fields, g); - - for (i = 0; i < clients_count; i++) { - fingerprint = NULL; - if (clients[i]->fingerprint) { - fingerprint = silc_fingerprint(clients[i]->fingerprint, - clients[i]->fingerprint_len); - g_snprintf(tmp2, sizeof(tmp2), "\n%s", fingerprint); - } - g_snprintf(tmp, sizeof(tmp), "%s - %s (%s@%s)%s", - clients[i]->realname, clients[i]->nickname, - clients[i]->username, clients[i]->hostname ? - clients[i]->hostname : "", - fingerprint ? tmp2 : ""); - purple_request_field_list_add_icon(f, tmp, NULL, clients[i]); - silc_free(fingerprint); - } - - purple_request_fields(r->client->application, _("Add Buddy"), - _("Select correct user"), - r->pubkey_search - ? _("More than one user was found with the same public key. Select " - "the correct user from the list to add to the buddy list.") - : _("More than one user was found with the same name. Select " - "the correct user from the list to add to the buddy list."), - fields, - _("OK"), G_CALLBACK(silcpurple_add_buddy_select_cb), - _("Cancel"), G_CALLBACK(silcpurple_add_buddy_select_cancel), - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r); -} - -static void -silcpurple_add_buddy_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - SilcPurpleBuddyRes r = context; - PurpleBuddy *b = r->b; - SilcAttributePayload pub; - SilcAttributeObjPk userpk; - unsigned char *pk; - SilcUInt32 pk_len; - const char *filename; - - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - - /* If the buddy is offline/nonexistent, we will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - if (!clients_count) { - if (r->init) { - silc_free(r); - return; - } - - r->offline = TRUE; - /* If the user has already associated a public key, try loading it - * before prompting the user to load it again */ - if (filename != NULL) - silcpurple_add_buddy_ask_import(r, filename); - else - silcpurple_add_buddy_ask_pk(r); - return; - } - - /* If more than one client was found with nickname, we need to verify - from user which one is the correct. */ - if (clients_count > 1 && !r->pubkey_search) { - if (r->init) { - silc_free(r); - return; - } - - silcpurple_add_buddy_select(r, clients, clients_count); - return; - } - - /* If we searched using public keys and more than one entry was found - the same person is logged on multiple times. */ - if (clients_count > 1 && r->pubkey_search && b->name) { - if (r->init) { - /* Find the entry that closest matches to the - buddy nickname. */ - int i; - for (i = 0; i < clients_count; i++) { - if (!g_ascii_strncasecmp(b->name, clients[i]->nickname, - strlen(b->name))) { - clients[0] = clients[i]; - break; - } - } - } else { - /* Verify from user which one is correct */ - silcpurple_add_buddy_select(r, clients, clients_count); - return; - } - } - - /* The client was found. Now get its public key and verify - that before adding the buddy. */ - memset(&userpk, 0, sizeof(userpk)); - b->proto_data = silc_memdup(clients[0]->id, sizeof(*clients[0]->id)); - r->client_id = *clients[0]->id; - - /* Get the public key from attributes, if not present then - resolve it with GETKEY unless we have it cached already. */ - if (clients[0]->attrs && !clients[0]->public_key) { - pub = silcpurple_get_attr(clients[0]->attrs, - SILC_ATTRIBUTE_USER_PUBLIC_KEY); - if (!pub || !silc_attribute_get_object(pub, (void *)&userpk, - sizeof(userpk))) { - /* Get public key with GETKEY */ - silc_client_command_call(client, conn, NULL, - "GETKEY", clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_add_buddy_getkey_cb, - r); - return; - } - if (!silc_pkcs_public_key_decode(userpk.data, userpk.data_len, - &clients[0]->public_key)) - return; - silc_free(userpk.data); - } else if (filename && !clients[0]->public_key) { - if (!silc_pkcs_load_public_key(filename, &clients[0]->public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(filename, &clients[0]->public_key, - SILC_PKCS_FILE_BIN)) { - /* Get public key with GETKEY */ - silc_client_command_call(client, conn, NULL, - "GETKEY", clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_add_buddy_getkey_cb, - r); - return; - } - } else if (!clients[0]->public_key) { - /* Get public key with GETKEY */ - silc_client_command_call(client, conn, NULL, - "GETKEY", clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_add_buddy_getkey_cb, - r); - return; - } - - /* We have the public key, verify it. */ - pk = silc_pkcs_public_key_encode(clients[0]->public_key, &pk_len); - silcpurple_verify_public_key(client, conn, clients[0]->nickname, - SILC_SOCKET_TYPE_CLIENT, - pk, pk_len, SILC_SKE_PK_TYPE_SILC, - silcpurple_add_buddy_save, r); - silc_free(pk); -} - -static void -silcpurple_add_buddy_i(PurpleConnection *gc, PurpleBuddy *b, gboolean init) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcPurpleBuddyRes r; - SilcBuffer attrs; - const char *filename, *name = b->name; - - r = silc_calloc(1, sizeof(*r)); - if (!r) - return; - r->client = client; - r->conn = conn; - r->b = b; - r->init = init; - - /* See if we have this buddy's public key. If we do use that - to search the details. */ - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - if (filename) { - SilcPublicKey public_key; - SilcAttributeObjPk userpk; - - if (!silc_pkcs_load_public_key(filename, &public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(filename, &public_key, - SILC_PKCS_FILE_BIN)) - return; - - /* Get all attributes, and use the public key to search user */ - name = NULL; - attrs = silc_client_attributes_request(SILC_ATTRIBUTE_USER_INFO, - SILC_ATTRIBUTE_SERVICE, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_ATTRIBUTE_STATUS_FREETEXT, - SILC_ATTRIBUTE_STATUS_MESSAGE, - SILC_ATTRIBUTE_PREFERRED_LANGUAGE, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_ATTRIBUTE_TIMEZONE, - SILC_ATTRIBUTE_GEOLOCATION, -#ifdef SILC_ATTRIBUTE_USER_ICON - SILC_ATTRIBUTE_USER_ICON, -#endif - SILC_ATTRIBUTE_DEVICE_INFO, 0); - userpk.type = "silc-rsa"; - userpk.data = silc_pkcs_public_key_encode(public_key, &userpk.data_len); - attrs = silc_attribute_payload_encode(attrs, - SILC_ATTRIBUTE_USER_PUBLIC_KEY, - SILC_ATTRIBUTE_FLAG_VALID, - &userpk, sizeof(userpk)); - silc_free(userpk.data); - silc_pkcs_public_key_free(public_key); - r->pubkey_search = TRUE; - } else { - /* Get all attributes */ - attrs = silc_client_attributes_request(0); - } - - /* Resolve */ - silc_client_get_clients_whois(client, conn, name, NULL, attrs, - silcpurple_add_buddy_resolved, r); - silc_buffer_free(attrs); -} - -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - /* Don't add if the buddy is already on the list. - * - * SILC doesn't have groups, so we don't need to do anything - * for a move. */ - if (purple_buddy_get_protocol_data(buddy) == NULL) - silcpurple_add_buddy_i(gc, buddy, FALSE); -} - -void silcpurple_send_buddylist(PurpleConnection *gc) -{ - PurpleBuddyList *blist; - PurpleBlistNode *gnode, *cnode, *bnode; - PurpleBuddy *buddy; - PurpleAccount *account; - - account = purple_connection_get_account(gc); - - if ((blist = purple_get_blist()) != NULL) - { - for (gnode = blist->root; gnode != NULL; gnode = gnode->next) - { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) - { - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) - { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *)bnode; - if (purple_buddy_get_account(buddy) == account) - silcpurple_add_buddy_i(gc, buddy, TRUE); - } - } - } - } -} - -void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - silc_free(buddy->proto_data); -} - -void silcpurple_idle_set(PurpleConnection *gc, int idle) - -{ - SilcPurple sg; - SilcClient client; - SilcClientConnection conn; - SilcAttributeObjService service; - const char *server; - int port; - - sg = gc->proto_data; - if (sg == NULL) - return; - - client = sg->client; - if (client == NULL) - return; - - conn = sg->conn; - if (conn == NULL) - return; - - server = purple_account_get_string(sg->account, "server", - "silc.silcnet.org"); - port = purple_account_get_int(sg->account, "port", 706), - - memset(&service, 0, sizeof(service)); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_SERVICE, NULL); - service.port = port; - g_snprintf(service.address, sizeof(service.address), "%s", server); - service.idle = idle; - silc_client_attribute_add(client, conn, SILC_ATTRIBUTE_SERVICE, - &service, sizeof(service)); -} - -char *silcpurple_status_text(PurpleBuddy *b) -{ - SilcPurple sg = b->account->gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientID *client_id = b->proto_data; - SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry) - return NULL; - - /* If user is online, we show the mood status, if available. - If user is offline or away that status is indicated. */ - - if (client_entry->mode & SILC_UMODE_DETACHED) - return g_strdup(_("Detached")); - if (client_entry->mode & SILC_UMODE_GONE) - return g_strdup(_("Away")); - if (client_entry->mode & SILC_UMODE_INDISPOSED) - return g_strdup(_("Indisposed")); - if (client_entry->mode & SILC_UMODE_BUSY) - return g_strdup(_("Busy")); - if (client_entry->mode & SILC_UMODE_PAGE) - return g_strdup(_("Wake Me Up")); - if (client_entry->mode & SILC_UMODE_HYPER) - return g_strdup(_("Hyper Active")); - if (client_entry->mode & SILC_UMODE_ROBOT) - return g_strdup(_("Robot")); - - attr = silcpurple_get_attr(client_entry->attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - /* The mood is a bit mask, so we could show multiple moods, - but let's show only one for now. */ - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - return g_strdup(_("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - return g_strdup(_("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - return g_strdup(_("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - return g_strdup(_("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - return g_strdup(_("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - return g_strdup(_("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - return g_strdup(_("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - return g_strdup(_("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - return g_strdup(_("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - return g_strdup(_("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - return g_strdup(_("Anxious")); - } - - return NULL; -} - -void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - SilcPurple sg = b->account->gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientID *client_id = b->proto_data; - SilcClientEntry client_entry; - char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - char tmp[256]; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry) - return; - - if (client_entry->nickname) - purple_notify_user_info_add_pair(user_info, _("Nickname"), - client_entry->nickname); - if (client_entry->username && client_entry->hostname) { - g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - } - if (client_entry->mode) { - memset(tmp, 0, sizeof(tmp)); - silcpurple_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); - } - - silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); - - if (statusstr) { - purple_notify_user_info_add_pair(user_info, _("Message"), statusstr); - g_free(statusstr); - } - - if (full) { - if (moodstr) { - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); - g_free(moodstr); - } - - if (contactstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); - g_free(contactstr); - } - - if (langstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); - g_free(langstr); - } - - if (devicestr) { - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); - g_free(devicestr); - } - - if (tzstr) { - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); - g_free(tzstr); - } - - if (geostr) { - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); - g_free(geostr); - } - } -} - -static void -silcpurple_buddy_kill(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); - sg = gc->proto_data; - - /* Call KILL */ - silc_client_command_call(sg->client, sg->conn, NULL, "KILL", - b->name, "Killed by operator", NULL); -} - -typedef struct { - SilcPurple sg; - SilcClientEntry client_entry; -} *SilcPurpleBuddyWb; - -static void -silcpurple_buddy_wb(PurpleBlistNode *node, gpointer data) -{ - SilcPurpleBuddyWb wb = data; - silcpurple_wb_init(wb->sg, wb->client_entry); - silc_free(wb); -} - -GList *silcpurple_buddy_menu(PurpleBuddy *buddy) -{ - PurpleConnection *gc = purple_account_get_connection(buddy->account); - SilcPurple sg = gc->proto_data; - SilcClientConnection conn = sg->conn; - const char *pkfile = NULL; - SilcClientEntry client_entry = NULL; - PurpleMenuAction *act; - GList *m = NULL; - SilcPurpleBuddyWb wb; - - pkfile = purple_blist_node_get_string((PurpleBlistNode *) buddy, "public-key"); - client_entry = silc_client_get_client_by_id(sg->client, - sg->conn, - buddy->proto_data); - - if (client_entry && client_entry->send_key) { - act = purple_menu_action_new(_("Reset IM Key"), - PURPLE_CALLBACK(silcpurple_buddy_resetkey), - NULL, NULL); - m = g_list_append(m, act); - - } else { - act = purple_menu_action_new(_("IM with Key Exchange"), - PURPLE_CALLBACK(silcpurple_buddy_keyagr), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("IM with Password"), - PURPLE_CALLBACK(silcpurple_buddy_privkey_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - if (pkfile) { - act = purple_menu_action_new(_("Show Public Key"), - PURPLE_CALLBACK(silcpurple_buddy_showkey), - NULL, NULL); - m = g_list_append(m, act); - - } else { - act = purple_menu_action_new(_("Get Public Key..."), - PURPLE_CALLBACK(silcpurple_buddy_getkey_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - if (conn && conn->local_entry->mode & SILC_UMODE_ROUTER_OPERATOR) { - act = purple_menu_action_new(_("Kill User"), - PURPLE_CALLBACK(silcpurple_buddy_kill), - NULL, NULL); - m = g_list_append(m, act); - } - - if (client_entry) { - wb = silc_calloc(1, sizeof(*wb)); - wb->sg = sg; - wb->client_entry = client_entry; - act = purple_menu_action_new(_("Draw On Whiteboard"), - PURPLE_CALLBACK(silcpurple_buddy_wb), - (void *)wb, NULL); - m = g_list_append(m, act); - } - return m; -} - -#ifdef SILC_ATTRIBUTE_USER_ICON -void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcMime mime; - char type[32]; - unsigned char *icon; - const char *t; - SilcAttributeObjMime obj; - - /* Remove */ - if (!img) { - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_USER_ICON, NULL); - return; - } - - /* Add */ - mime = silc_mime_alloc(); - if (!mime) - return; - - t = purple_imgstore_get_extension(img); - if (!t || !strcmp(t, "icon")) { - silc_mime_free(mime); - return; - } - if (!strcmp(t, "jpg")) - t = "jpeg"; - g_snprintf(type, sizeof(type), "image/%s", t); - silc_mime_add_field(mime, "Content-Type", type); - silc_mime_add_data(mime, purple_imgstore_get_data(img), purple_imgstore_get_size(img)); - - obj.mime = icon = silc_mime_encode(mime, &obj.mime_len); - if (obj.mime) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_USER_ICON, &obj, sizeof(obj)); - - silc_free(icon); - silc_mime_free(mime); -} -#endif diff --git a/libpurple/protocols/silc10/chat.c b/libpurple/protocols/silc10/chat.c deleted file mode 100644 index cc6f509604..0000000000 --- a/libpurple/protocols/silc10/chat.c +++ /dev/null @@ -1,1456 +0,0 @@ -/* - - silcpurple_chat.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/***************************** Channel Routines ******************************/ - -GList *silcpurple_chat_info(PurpleConnection *gc) -{ - GList *ci = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Channel:"); - pce->identifier = "channel"; - pce->required = TRUE; - ci = g_list_append(ci, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Passphrase:"); - pce->identifier = "passphrase"; - pce->secret = TRUE; - ci = g_list_append(ci, pce); - - return ci; -} - -GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); - - return defaults; -} - -static void -silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components); - -static void -silcpurple_chat_getinfo_res(SilcClient client, - SilcClientConnection conn, - SilcChannelEntry *channels, - SilcUInt32 channels_count, - void *context) -{ - GHashTable *components = context; - PurpleConnection *gc = client->application; - const char *chname; - char tmp[256]; - - chname = g_hash_table_lookup(components, "channel"); - if (!chname) - return; - - if (!channels) { - g_snprintf(tmp, sizeof(tmp), - _("Channel %s does not exist in the network"), chname); - purple_notify_error(gc, _("Channel Information"), - _("Cannot get channel information"), tmp); - return; - } - - silcpurple_chat_getinfo(gc, components); -} - - -static void -silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) -{ - SilcPurple sg = gc->proto_data; - const char *chname; - char *buf, tmp[256], *tmp2; - GString *s; - SilcChannelEntry channel; - SilcHashTableList htl; - SilcChannelUser chu; - - if (!components) - return; - - chname = g_hash_table_lookup(components, "channel"); - if (!chname) - return; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (!channel) { - silc_client_get_channel_resolve(sg->client, sg->conn, - (char *)chname, - silcpurple_chat_getinfo_res, - components); - return; - } - - s = g_string_new(""); - tmp2 = g_markup_escape_text(channel->channel_name, -1); - g_string_append_printf(s, _("Channel Name: %s"), tmp2); - g_free(tmp2); - if (channel->user_list && silc_hash_table_count(channel->user_list)) - g_string_append_printf(s, _("
User Count: %d"), - (int)silc_hash_table_count(channel->user_list)); - - silc_hash_table_list(channel->user_list, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { - tmp2 = g_markup_escape_text(chu->client->nickname, -1); - g_string_append_printf(s, _("
Channel Founder: %s"), - tmp2); - g_free(tmp2); - break; - } - } - silc_hash_table_list_reset(&htl); - - if (channel->channel_key) - g_string_append_printf(s, _("
Channel Cipher: %s"), - silc_cipher_get_name(channel->channel_key)); - if (channel->hmac) - /* Definition of HMAC: http://en.wikipedia.org/wiki/HMAC */ - g_string_append_printf(s, _("
Channel HMAC: %s"), - silc_hmac_get_name(channel->hmac)); - - if (channel->topic) { - tmp2 = g_markup_escape_text(channel->topic, -1); - g_string_append_printf(s, _("
Channel Topic:
%s"), tmp2); - g_free(tmp2); - } - - if (channel->mode) { - g_string_append_printf(s, _("
Channel Modes: ")); - silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); - g_string_append(s, tmp); - } - - if (channel->founder_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(channel->founder_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - g_string_append_printf(s, _("
Founder Key Fingerprint:
%s"), fingerprint); - g_string_append_printf(s, _("
Founder Key Babbleprint:
%s"), babbleprint); - - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - - buf = g_string_free(s, FALSE); - purple_notify_formatted(gc, NULL, _("Channel Information"), NULL, buf, NULL, NULL); - g_free(buf); -} - - -static void -silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat = (PurpleChat *)node; - silcpurple_chat_getinfo(chat->account->gc, chat->components); -} - - -#if 0 /* XXX For now these are not implemented. We need better - listview dialog from Purple for these. */ -/************************** Channel Invite List ******************************/ - -static void -silcpurple_chat_invitelist(PurpleBlistNode *node, gpointer data); -{ - -} - - -/**************************** Channel Ban List *******************************/ - -static void -silcpurple_chat_banlist(PurpleBlistNode *node, gpointer data); -{ - -} -#endif - - -/************************* Channel Authentication ****************************/ - -typedef struct { - SilcPurple sg; - SilcChannelEntry channel; - PurpleChat *c; - SilcBuffer pubkeys; -} *SilcPurpleChauth; - -static void -silcpurple_chat_chpk_add(void *user_data, const char *name) -{ - SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; - SilcPurple sg = sgc->sg; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcPublicKey public_key; - SilcBuffer chpks, pk, chidp; - unsigned char mode[4]; - SilcUInt32 m; - - /* Load the public key */ - if (!silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_BIN)) { - silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); - purple_notify_error(client->application, - _("Add Channel Public Key"), - _("Could not load public key"), NULL); - return; - } - - pk = silc_pkcs_public_key_payload_encode(public_key); - chpks = silc_buffer_alloc_size(2); - SILC_PUT16_MSB(1, chpks->head); - chpks = silc_argument_payload_encode_one(chpks, pk->data, - pk->len, 0x00); - silc_buffer_free(pk); - - m = sgc->channel->mode; - m |= SILC_CHANNEL_MODE_CHANNEL_AUTH; - - /* Send CMODE */ - SILC_PUT32_MSB(m, mode); - chidp = silc_id_payload_encode(sgc->channel->id, SILC_ID_CHANNEL); - silc_client_command_send(client, conn, SILC_COMMAND_CMODE, - ++conn->cmd_ident, 3, - 1, chidp->data, chidp->len, - 2, mode, sizeof(mode), - 9, chpks->data, chpks->len); - silc_buffer_free(chpks); - silc_buffer_free(chidp); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -static void -silcpurple_chat_chpk_cancel(void *user_data, const char *name) -{ - SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; - silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -static void -silcpurple_chat_chpk_cb(SilcPurpleChauth sgc, PurpleRequestFields *fields) -{ - SilcPurple sg = sgc->sg; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestField *f; - GList *list; - SilcPublicKey public_key; - SilcBuffer chpks, pk, chidp; - SilcUInt16 c = 0, ct; - unsigned char mode[4]; - SilcUInt32 m; - - f = purple_request_fields_get_field(fields, "list"); - if (!purple_request_field_list_get_selected(f)) { - /* Add new public key */ - purple_request_file(sg->gc, _("Open Public Key..."), NULL, FALSE, - G_CALLBACK(silcpurple_chat_chpk_add), - G_CALLBACK(silcpurple_chat_chpk_cancel), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - return; - } - - list = purple_request_field_list_get_items(f); - chpks = silc_buffer_alloc_size(2); - - for (ct = 0; list; list = list->next, ct++) { - public_key = purple_request_field_list_get_data(f, list->data); - if (purple_request_field_list_is_selected(f, list->data)) { - /* Delete this public key */ - pk = silc_pkcs_public_key_payload_encode(public_key); - chpks = silc_argument_payload_encode_one(chpks, pk->data, - pk->len, 0x01); - silc_buffer_free(pk); - c++; - } - silc_pkcs_public_key_free(public_key); - } - if (!c) { - silc_buffer_free(chpks); - return; - } - SILC_PUT16_MSB(c, chpks->head); - - m = sgc->channel->mode; - if (ct == c) - m &= ~SILC_CHANNEL_MODE_CHANNEL_AUTH; - - /* Send CMODE */ - SILC_PUT32_MSB(m, mode); - chidp = silc_id_payload_encode(sgc->channel->id, SILC_ID_CHANNEL); - silc_client_command_send(client, conn, SILC_COMMAND_CMODE, - ++conn->cmd_ident, 3, - 1, chidp->data, chidp->len, - 2, mode, sizeof(mode), - 9, chpks->data, chpks->len); - silc_buffer_free(chpks); - silc_buffer_free(chidp); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -static void -silcpurple_chat_chauth_ok(SilcPurpleChauth sgc, PurpleRequestFields *fields) -{ - SilcPurple sg = sgc->sg; - PurpleRequestField *f; - const char *curpass, *val; - int set; - - f = purple_request_fields_get_field(fields, "passphrase"); - val = purple_request_field_string_get_value(f); - curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); - - if (!val && curpass) - set = 0; - else if (val && !curpass) - set = 1; - else if (val && curpass && strcmp(val, curpass)) - set = 1; - else - set = -1; - - if (set == 1) { - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - sgc->channel->channel_name, "+a", val, NULL); - purple_blist_node_set_string((PurpleBlistNode *)sgc->c, "passphrase", val); - } else if (set == 0) { - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - sgc->channel->channel_name, "-a", NULL); - purple_blist_node_remove_setting((PurpleBlistNode *)sgc->c, "passphrase"); - } - - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, - SilcBuffer channel_pubkeys) -{ - SilcUInt16 argc; - SilcArgumentPayload chpks; - unsigned char *pk; - SilcUInt32 pk_len, type; - char *fingerprint, *babbleprint; - SilcPublicKey pubkey; - SilcPublicKeyIdentifier ident; - char tmp2[1024], t[512]; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - SilcPurpleChauth sgc; - const char *curpass = NULL; - - sgc = silc_calloc(1, sizeof(*sgc)); - if (!sgc) - return; - sgc->sg = sg; - sgc->channel = channel; - - fields = purple_request_fields_new(); - - if (sgc->c) - curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("passphrase", _("Channel Passphrase"), - curpass, FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_label_new("l1", _("Channel Public Keys List")); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g_snprintf(t, sizeof(t), - _("Channel authentication is used to secure the channel from " - "unauthorized access. The authentication may be based on " - "passphrase and digital signatures. If passphrase is set, it " - "is required to be able to join. If channel public keys are set " - "then only users whose public keys are listed are able to join.")); - - if (!channel_pubkeys) { - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_fields(sg->gc, _("Channel Authentication"), - _("Channel Authentication"), t, fields, - _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), - _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - return; - } - sgc->pubkeys = silc_buffer_copy(channel_pubkeys); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - SILC_GET16_MSB(argc, channel_pubkeys->data); - chpks = silc_argument_payload_parse(channel_pubkeys->data + 2, - channel_pubkeys->len - 2, argc); - if (!chpks) - return; - - pk = silc_argument_get_first_arg(chpks, &type, &pk_len); - while (pk) { - fingerprint = silc_hash_fingerprint(NULL, pk + 4, pk_len - 4); - babbleprint = silc_hash_babbleprint(NULL, pk + 4, pk_len - 4); - silc_pkcs_public_key_payload_decode(pk, pk_len, &pubkey); - ident = silc_pkcs_decode_identifier(pubkey->identifier); - - g_snprintf(tmp2, sizeof(tmp2), "%s\n %s\n %s", - ident->realname ? ident->realname : ident->username ? - ident->username : "", fingerprint, babbleprint); - purple_request_field_list_add_icon(f, tmp2, NULL, pubkey); - - silc_free(fingerprint); - silc_free(babbleprint); - silc_pkcs_free_identifier(ident); - pk = silc_argument_get_next_arg(chpks, &type, &pk_len); - } - - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_fields(sg->gc, _("Channel Authentication"), - _("Channel Authentication"), t, fields, - _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), - _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - - silc_argument_payload_free(chpks); -} - -static void -silcpurple_chat_chauth(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+C", NULL); -} - - -/************************** Channel Private Groups **************************/ - -/* Private groups are "virtual" channels. They are groups inside a channel. - This is implemented by using channel private keys. By knowing a channel - private key user becomes part of that group and is able to talk on that - group. Other users, on the same channel, won't be able to see the - messages of that group. It is possible to have multiple groups inside - a channel - and thus having multiple private keys on the channel. */ - -typedef struct { - SilcPurple sg; - PurpleChat *c; - const char *channel; -} *SilcPurpleCharPrv; - -static void -silcpurple_chat_prv_add(SilcPurpleCharPrv p, PurpleRequestFields *fields) -{ - SilcPurple sg = p->sg; - char tmp[512]; - PurpleRequestField *f; - const char *name, *passphrase, *alias; - GHashTable *comp; - PurpleGroup *g; - PurpleChat *cn; - - f = purple_request_fields_get_field(fields, "name"); - name = purple_request_field_string_get_value(f); - if (!name) { - silc_free(p); - return; - } - f = purple_request_fields_get_field(fields, "passphrase"); - passphrase = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "alias"); - alias = purple_request_field_string_get_value(f); - - /* Add private group to buddy list */ - g_snprintf(tmp, sizeof(tmp), "%s [Private Group]", name); - comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(comp, g_strdup("channel"), g_strdup(tmp)); - g_hash_table_replace(comp, g_strdup("passphrase"), g_strdup(passphrase)); - - cn = purple_chat_new(sg->account, alias, comp); - g = (PurpleGroup *)p->c->node.parent; - purple_blist_add_chat(cn, g, (PurpleBlistNode *)p->c); - - /* Associate to a real channel */ - purple_blist_node_set_string((PurpleBlistNode *)cn, "parentch", p->channel); - - /* Join the group */ - silcpurple_chat_join(sg->gc, comp); - - silc_free(p); -} - -static void -silcpurple_chat_prv_cancel(SilcPurpleCharPrv p, PurpleRequestFields *fields) -{ - silc_free(p); -} - -static void -silcpurple_chat_prv(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - SilcPurpleCharPrv p; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - char tmp[512]; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - p = silc_calloc(1, sizeof(*p)); - if (!p) - return; - p->sg = sg; - - p->channel = g_hash_table_lookup(chat->components, "channel"); - p->c = purple_blist_find_chat(sg->account, p->channel); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("name", _("Group Name"), - NULL, FALSE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new("passphrase", _("Passphrase"), - NULL, FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new("alias", _("Alias"), - NULL, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g_snprintf(tmp, sizeof(tmp), - _("Please enter the %s channel private group name and passphrase."), - p->channel); - purple_request_fields(gc, _("Add Channel Private Group"), NULL, tmp, fields, - _("Add"), G_CALLBACK(silcpurple_chat_prv_add), - _("Cancel"), G_CALLBACK(silcpurple_chat_prv_cancel), - purple_connection_get_account(gc), NULL, NULL, p); -} - - -/****************************** Channel Modes ********************************/ - -static void -silcpurple_chat_permanent_reset(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-f", NULL); -} - -static void -silcpurple_chat_permanent(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - const char *channel; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - if (!sg->conn) - return; - - /* XXX we should have ability to define which founder - key to use. Now we use the user's own public key - (default key). */ - - /* Call CMODE */ - channel = g_hash_table_lookup(chat->components, "channel"); - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", channel, - "+f", NULL); -} - -typedef struct { - SilcPurple sg; - char *channel; -} *SilcPurpleChatInput; - -static void -silcpurple_chat_ulimit_cb(SilcPurpleChatInput s, const char *limit) -{ - SilcChannelEntry channel; - int ulimit = 0; - - channel = silc_client_get_channel(s->sg->client, s->sg->conn, - (char *)s->channel); - if (!channel) - return; - if (limit) - ulimit = atoi(limit); - - if (!limit || !(*limit) || *limit == '0') { - if (limit && ulimit == channel->user_limit) { - silc_free(s); - return; - } - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", - s->channel, "-l", NULL); - - silc_free(s); - return; - } - - if (ulimit == channel->user_limit) { - silc_free(s); - return; - } - - /* Call CMODE */ - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", - s->channel, "+l", limit, NULL); - - silc_free(s); -} - -static void -silcpurple_chat_ulimit(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - SilcPurpleChatInput s; - SilcChannelEntry channel; - char *ch; - char tmp[32]; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - if (!sg->conn) - return; - - ch = g_strdup(g_hash_table_lookup(chat->components, "channel")); - channel = silc_client_get_channel(sg->client, sg->conn, (char *)ch); - if (!channel) - return; - - s = silc_calloc(1, sizeof(*s)); - if (!s) - return; - s->channel = ch; - s->sg = sg; - g_snprintf(tmp, sizeof(tmp), "%d", (int)channel->user_limit); - purple_request_input(gc, _("User Limit"), NULL, - _("Set user limit on channel. Set to zero to reset user limit."), - tmp, FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(silcpurple_chat_ulimit_cb), - _("Cancel"), G_CALLBACK(silcpurple_chat_ulimit_cb), - purple_connection_get_account(gc), NULL, NULL, s); -} - -static void -silcpurple_chat_resettopic(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-t", NULL); -} - -static void -silcpurple_chat_settopic(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+t", NULL); -} - -static void -silcpurple_chat_resetprivate(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-p", NULL); -} - -static void -silcpurple_chat_setprivate(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+p", NULL); -} - -static void -silcpurple_chat_resetsecret(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-s", NULL); -} - -static void -silcpurple_chat_setsecret(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+s", NULL); -} - -typedef struct { - SilcPurple sg; - SilcChannelEntry channel; -} *SilcPurpleChatWb; - -static void -silcpurple_chat_wb(PurpleBlistNode *node, gpointer data) -{ - SilcPurpleChatWb wb = data; - silcpurple_wb_init_ch(wb->sg, wb->channel); - silc_free(wb); -} - -GList *silcpurple_chat_menu(PurpleChat *chat) -{ - GHashTable *components = chat->components; - PurpleConnection *gc = purple_account_get_connection(chat->account); - SilcPurple sg = gc->proto_data; - SilcClientConnection conn = sg->conn; - const char *chname = NULL; - SilcChannelEntry channel = NULL; - SilcChannelUser chu = NULL; - SilcUInt32 mode = 0; - - GList *m = NULL; - PurpleMenuAction *act; - - if (components) - chname = g_hash_table_lookup(components, "channel"); - if (chname) - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (channel) { - chu = silc_client_on_channel(channel, conn->local_entry); - if (chu) - mode = chu->mode; - } - - if (strstr(chname, "[Private Group]")) - return NULL; - - act = purple_menu_action_new(_("Get Info"), - PURPLE_CALLBACK(silcpurple_chat_getinfo_menu), - NULL, NULL); - m = g_list_append(m, act); - -#if 0 /* XXX For now these are not implemented. We need better - listview dialog from Purple for these. */ - if (mode & SILC_CHANNEL_UMODE_CHANOP) { - act = purple_menu_action_new(_("Invite List"), - PURPLE_CALLBACK(silcpurple_chat_invitelist), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("Ban List"), - PURPLE_CALLBACK(silcpurple_chat_banlist), - NULL, NULL); - m = g_list_append(m, act); - } -#endif - - if (chu) { - act = purple_menu_action_new(_("Add Private Group"), - PURPLE_CALLBACK(silcpurple_chat_prv), - NULL, NULL); - m = g_list_append(m, act); - } - - if (mode & SILC_CHANNEL_UMODE_CHANFO) { - act = purple_menu_action_new(_("Channel Authentication"), - PURPLE_CALLBACK(silcpurple_chat_chauth), - NULL, NULL); - m = g_list_append(m, act); - - if (channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) { - act = purple_menu_action_new(_("Reset Permanent"), - PURPLE_CALLBACK(silcpurple_chat_permanent_reset), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Permanent"), - PURPLE_CALLBACK(silcpurple_chat_permanent), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (mode & SILC_CHANNEL_UMODE_CHANOP) { - act = purple_menu_action_new(_("Set User Limit"), - PURPLE_CALLBACK(silcpurple_chat_ulimit), - NULL, NULL); - m = g_list_append(m, act); - - if (channel->mode & SILC_CHANNEL_MODE_TOPIC) { - act = purple_menu_action_new(_("Reset Topic Restriction"), - PURPLE_CALLBACK(silcpurple_chat_resettopic), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Topic Restriction"), - PURPLE_CALLBACK(silcpurple_chat_settopic), - NULL, NULL); - m = g_list_append(m, act); - } - - if (channel->mode & SILC_CHANNEL_MODE_PRIVATE) { - act = purple_menu_action_new(_("Reset Private Channel"), - PURPLE_CALLBACK(silcpurple_chat_resetprivate), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Private Channel"), - PURPLE_CALLBACK(silcpurple_chat_setprivate), - NULL, NULL); - m = g_list_append(m, act); - } - - if (channel->mode & SILC_CHANNEL_MODE_SECRET) { - act = purple_menu_action_new(_("Reset Secret Channel"), - PURPLE_CALLBACK(silcpurple_chat_resetsecret), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Secret Channel"), - PURPLE_CALLBACK(silcpurple_chat_setsecret), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (channel) { - SilcPurpleChatWb wb; - wb = silc_calloc(1, sizeof(*wb)); - wb->sg = sg; - wb->channel = channel; - act = purple_menu_action_new(_("Draw On Whiteboard"), - PURPLE_CALLBACK(silcpurple_chat_wb), - (void *)wb, NULL); - m = g_list_append(m, act); - } - - return m; -} - - -/******************************* Joining Etc. ********************************/ - -void silcpurple_chat_join_done(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcChannelEntry channel = context; - PurpleConversation *convo; - SilcUInt32 retry = SILC_PTR_TO_32(channel->context); - SilcHashTableList htl; - SilcChannelUser chu; - GList *users = NULL, *flags = NULL; - char tmp[256]; - - if (!clients && retry < 1) { - /* Resolving users failed, try again. */ - channel->context = SILC_32_TO_PTR(retry + 1); - silc_client_get_clients_by_channel(client, conn, channel, - silcpurple_chat_join_done, channel); - return; - } - - /* Add channel to Purple */ - channel->context = SILC_32_TO_PTR(++sg->channel_ids); - serv_got_joined_chat(gc, sg->channel_ids, channel->channel_name); - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - return; - - /* Add all users to channel */ - silc_hash_table_list(channel->user_list, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - PurpleConvChatBuddyFlags f = PURPLE_CBFLAGS_NONE; - if (!chu->client->nickname) - continue; - chu->context = SILC_32_TO_PTR(sg->channel_ids); - - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) - f |= PURPLE_CBFLAGS_FOUNDER; - if (chu->mode & SILC_CHANNEL_UMODE_CHANOP) - f |= PURPLE_CBFLAGS_OP; - users = g_list_append(users, g_strdup(chu->client->nickname)); - flags = g_list_append(flags, GINT_TO_POINTER(f)); - - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { - if (chu->client == conn->local_entry) - g_snprintf(tmp, sizeof(tmp), - _("You are channel founder on %s"), - channel->channel_name); - else - g_snprintf(tmp, sizeof(tmp), - _("Channel founder on %s is %s"), - channel->channel_name, chu->client->nickname); - - purple_conversation_write(convo, NULL, tmp, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - } - } - silc_hash_table_list_reset(&htl); - - purple_conv_chat_add_users(PURPLE_CONV_CHAT(convo), users, NULL, flags, FALSE); - g_list_free(users); - g_list_free(flags); - - /* Set topic */ - if (channel->topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, channel->topic); - - /* Set nick */ - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), conn->local_entry->nickname); -} - -char *silcpurple_get_chat_name(GHashTable *data) -{ - return g_strdup(g_hash_table_lookup(data, "channel")); -} - -void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - const char *channel, *passphrase, *parentch; - - if (!conn) - return; - - channel = g_hash_table_lookup(data, "channel"); - passphrase = g_hash_table_lookup(data, "passphrase"); - - /* Check if we are joining a private group. Handle it - purely locally as it's not a real channel */ - if (strstr(channel, "[Private Group]")) { - SilcChannelEntry channel_entry; - SilcChannelPrivateKey key; - PurpleChat *c; - SilcPurplePrvgrp grp; - - c = purple_blist_find_chat(sg->account, channel); - parentch = purple_blist_node_get_string((PurpleBlistNode *)c, "parentch"); - if (!parentch) - return; - - channel_entry = silc_client_get_channel(sg->client, sg->conn, - (char *)parentch); - if (!channel_entry || - !silc_client_on_channel(channel_entry, sg->conn->local_entry)) { - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), - _("You have to join the %s channel before you are " - "able to join the private group"), parentch); - purple_notify_error(gc, _("Join Private Group"), - _("Cannot join private group"), tmp); - return; - } - - /* Add channel private key */ - if (!silc_client_add_channel_private_key(client, conn, - channel_entry, channel, - NULL, NULL, - (unsigned char *)passphrase, - strlen(passphrase), &key)) - return; - - /* Join the group */ - grp = silc_calloc(1, sizeof(*grp)); - if (!grp) - return; - grp->id = ++sg->channel_ids + SILCPURPLE_PRVGRP; - grp->chid = SILC_PTR_TO_32(channel_entry->context); - grp->parentch = parentch; - grp->channel = channel; - grp->key = key; - sg->grps = g_list_append(sg->grps, grp); - serv_got_joined_chat(gc, grp->id, channel); - return; - } - - /* XXX We should have other properties here as well: - 1. whether to try to authenticate to the channel - 1a. with default key, - 1b. with specific key. - 2. whether to try to authenticate to become founder. - 2a. with default key, - 2b. with specific key. - - Since now such variety is not possible in the join dialog - we always use -founder and -auth options, which try to - do both 1 and 2 with default keys. */ - - /* Call JOIN */ - if ((passphrase != NULL) && (*passphrase != '\0')) - silc_client_command_call(client, conn, NULL, "JOIN", - channel, passphrase, "-auth", "-founder", NULL); - else - silc_client_command_call(client, conn, NULL, "JOIN", - channel, "-auth", "-founder", NULL); -} - -void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - - if (!conn) - return; - - /* See if we are inviting on a private group. Invite - to the actual channel */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - id = prv->chid; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call INVITE */ - silc_client_command_call(client, conn, NULL, "INVITE", - chu->channel->channel_name, - name, NULL); -} - -void silcpurple_chat_leave(PurpleConnection *gc, int id) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - GList *l; - SilcPurplePrvgrp prv; - - if (!conn) - return; - - /* See if we are leaving a private group */ - if (id > SILCPURPLE_PRVGRP) { - SilcChannelEntry channel; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)prv->parentch); - if (!channel) - return; - silc_client_del_channel_private_key(client, conn, - channel, prv->key); - silc_free(prv); - sg->grps = g_list_remove(sg->grps, prv); - serv_got_chat_left(gc, id); - return; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call LEAVE */ - silc_client_command_call(client, conn, NULL, "LEAVE", - chu->channel->channel_name, NULL); - - serv_got_chat_left(gc, id); - - /* Leave from private groups on this channel as well */ - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->chid == id) { - prv = l->data; - silc_client_del_channel_private_key(client, conn, - chu->channel, - prv->key); - serv_got_chat_left(gc, prv->id); - silc_free(prv); - sg->grps = g_list_remove(sg->grps, prv); - if (!sg->grps) - break; - } -} - -int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags msgflags) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - SilcChannelEntry channel = NULL; - SilcChannelPrivateKey key = NULL; - SilcUInt32 flags; - int ret; - char *msg2, *tmp; - gboolean found = FALSE; - gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); - - if (!msg || !conn) - return 0; - - flags = SILC_MESSAGE_FLAG_UTF8; - - tmp = msg2 = purple_unescape_html(msg); - - if (!g_ascii_strncasecmp(msg2, "/me ", 4)) - { - msg2 += 4; - if (!*msg2) { - g_free(tmp); - return 0; - } - flags |= SILC_MESSAGE_FLAG_ACTION; - } else if (strlen(msg) > 1 && msg[0] == '/') { - if (!silc_client_command_call(client, conn, msg + 1)) - purple_notify_error(gc, _("Call Command"), _("Cannot call command"), - _("Unknown command")); - g_free(tmp); - return 0; - } - - - if (sign) - flags |= SILC_MESSAGE_FLAG_SIGNED; - - /* Get the channel private key if we are sending on - private group */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) { - g_free(tmp); - return 0; - } - prv = l->data; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)prv->parentch); - if (!channel) { - g_free(tmp); - return 0; - } - key = prv->key; - } - - if (!channel) { - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) { - g_free(tmp); - return 0; - } - channel = chu->channel; - } - - /* Send channel message */ - ret = silc_client_send_channel_message(client, conn, channel, key, - flags, (unsigned char *)msg2, - strlen(msg2), TRUE); - if (ret) { - serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, - time(NULL)); - } - g_free(tmp); - - return ret; -} - -void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - - if (!conn) - return; - - /* See if setting topic on private group. Set it - on the actual channel */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - id = prv->chid; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call TOPIC */ - silc_client_command_call(client, conn, NULL, "TOPIC", - chu->channel->channel_name, topic, NULL); -} - -PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - GList *fields = NULL; - PurpleRoomlistField *f; - - if (!conn) - return NULL; - - if (sg->roomlist) - purple_roomlist_unref(sg->roomlist); - - sg->roomlist_cancelled = FALSE; - - sg->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, - _("Users"), "users", FALSE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, - _("Topic"), "topic", FALSE); - fields = g_list_append(fields, f); - purple_roomlist_set_fields(sg->roomlist, fields); - - /* Call LIST */ - silc_client_command_call(client, conn, "LIST"); - - purple_roomlist_set_in_progress(sg->roomlist, TRUE); - - return sg->roomlist; -} - -void silcpurple_roomlist_cancel(PurpleRoomlist *list) -{ - PurpleConnection *gc = purple_account_get_connection(list->account); - SilcPurple sg; - - if (!gc) - return; - sg = gc->proto_data; - - purple_roomlist_set_in_progress(list, FALSE); - if (sg->roomlist == list) { - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - sg->roomlist_cancelled = TRUE; - } -} diff --git a/libpurple/protocols/silc10/ft.c b/libpurple/protocols/silc10/ft.c deleted file mode 100644 index 39e74495b7..0000000000 --- a/libpurple/protocols/silc10/ft.c +++ /dev/null @@ -1,412 +0,0 @@ -/* - - silcpurple_ft.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" - -/****************************** File Transfer ********************************/ - -/* This implements the secure file transfer protocol (SFTP) using the SILC - SFTP library implementation. The API we use from the SILC Toolkit is the - SILC Client file transfer API, as it provides a simple file transfer we - need in this case. We could use the SILC SFTP API directly, but it would - be an overkill since we'd effectively re-implement the file transfer what - the SILC Client's file transfer API already provides. - - From Purple we do NOT use the FT API to do the transfer as it is very limiting. - In fact it does not suite to file transfers like SFTP at all. For example, - it assumes that read operations are synchronous what they are not in SFTP. - It also assumes that the file transfer socket is to be handled by the Purple - eventloop, and this naturally is something we don't want to do in case of - SILC Toolkit. The FT API suites well to purely stream based file transfers - like HTTP GET and similar. - - For this reason, we directly access the Purple GKT FT API and hack the FT - API to merely provide the user interface experience and all the magic - is done in the SILC Toolkit. Ie. we update the statistics information in - the FT API for user interface, and that's it. A bit dirty but until the - FT API gets better this is the way to go. Good thing that FT API allowed - us to do this. */ - -typedef struct { - SilcPurple sg; - SilcClientEntry client_entry; - SilcUInt32 session_id; - char *hostname; - SilcUInt16 port; - PurpleXfer *xfer; - - SilcClientFileName completion; - void *completion_context; -} *SilcPurpleXfer; - -static void -silcpurple_ftp_monitor(SilcClient client, - SilcClientConnection conn, - SilcClientMonitorStatus status, - SilcClientFileError error, - SilcUInt64 offset, - SilcUInt64 filesize, - SilcClientEntry client_entry, - SilcUInt32 session_id, - const char *filepath, - void *context) -{ - SilcPurpleXfer xfer = context; - PurpleConnection *gc = xfer->sg->gc; - char tmp[256]; - - if (status == SILC_CLIENT_FILE_MONITOR_CLOSED) { - purple_xfer_unref(xfer->xfer); - silc_free(xfer); - return; - } - - if (status == SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT) - return; - - if (status == SILC_CLIENT_FILE_MONITOR_ERROR) { - if (error == SILC_CLIENT_FILE_NO_SUCH_FILE) { - g_snprintf(tmp, sizeof(tmp), "No such file %s", - filepath ? filepath : "[N/A]"); - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), tmp); - } else if (error == SILC_CLIENT_FILE_PERMISSION_DENIED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Permission denied")); - } else if (error == SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Key agreement failed")); - } else if (error == SILC_CLIENT_FILE_UNKNOWN_SESSION) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("File transfer session does not exist")); - } else { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), NULL); - } - silc_client_file_close(client, conn, session_id); - purple_xfer_unref(xfer->xfer); - silc_free(xfer); - return; - } - - /* Update file transfer UI */ - if (!offset && filesize) - purple_xfer_set_size(xfer->xfer, filesize); - if (offset && filesize) { - xfer->xfer->bytes_sent = offset; - xfer->xfer->bytes_remaining = filesize - offset; - } - purple_xfer_update_progress(xfer->xfer); - - if (status == SILC_CLIENT_FILE_MONITOR_SEND || - status == SILC_CLIENT_FILE_MONITOR_RECEIVE) { - if (offset == filesize) { - /* Download finished */ - purple_xfer_set_completed(xfer->xfer, TRUE); - silc_client_file_close(client, conn, session_id); - } - } -} - -static void -silcpurple_ftp_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; - purple_xfer_update_progress(xfer->xfer); - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_ask_name_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - - /* Cancel the transmission */ - xfer->completion(NULL, xfer->completion_context); - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_ask_name_ok(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - const char *name; - - name = purple_xfer_get_local_filename(x); - g_unlink(name); - xfer->completion(name, xfer->completion_context); -} - -static void -silcpurple_ftp_ask_name(SilcClient client, - SilcClientConnection conn, - SilcUInt32 session_id, - const char *remote_filename, - SilcClientFileName completion, - void *completion_context, - void *context) -{ - SilcPurpleXfer xfer = context; - - xfer->completion = completion; - xfer->completion_context = completion_context; - - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_ask_name_ok); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_ask_name_cancel); - - /* Request to save the file */ - purple_xfer_set_filename(xfer->xfer, remote_filename); - purple_xfer_request(xfer->xfer); -} - -static void -silcpurple_ftp_request_result(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - SilcClientFileError status; - PurpleConnection *gc = xfer->sg->gc; - - if (purple_xfer_get_status(x) != PURPLE_XFER_STATUS_ACCEPTED) - return; - - /* Start the file transfer */ - status = silc_client_file_receive(xfer->sg->client, xfer->sg->conn, - silcpurple_ftp_monitor, xfer, - NULL, xfer->session_id, - silcpurple_ftp_ask_name, xfer); - switch (status) { - case SILC_CLIENT_FILE_OK: - return; - break; - - case SILC_CLIENT_FILE_UNKNOWN_SESSION: - purple_notify_error(gc, _("Secure File Transfer"), - _("No file transfer session active"), NULL); - break; - - case SILC_CLIENT_FILE_ALREADY_STARTED: - purple_notify_error(gc, _("Secure File Transfer"), - _("File transfer already started"), NULL); - break; - - case SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED: - purple_notify_error(gc, _("Secure File Transfer"), - _("Could not perform key agreement for file transfer"), - NULL); - break; - - default: - purple_notify_error(gc, _("Secure File Transfer"), - _("Could not start the file transfer"), NULL); - break; - } - - /* Error */ - purple_xfer_unref(xfer->xfer); - g_free(xfer->hostname); - silc_free(xfer); -} - -static void -silcpurple_ftp_request_denied(PurpleXfer *x) -{ - -} - -void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleXfer xfer; - - xfer = silc_calloc(1, sizeof(*xfer)); - if (!xfer) { - silc_client_file_close(sg->client, sg->conn, session_id); - return; - } - - xfer->sg = sg; - xfer->client_entry = client_entry; - xfer->session_id = session_id; - xfer->hostname = g_strdup(hostname); - xfer->port = port; - xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_RECEIVE, - xfer->client_entry->nickname); - if (!xfer->xfer) { - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - g_free(xfer->hostname); - silc_free(xfer); - return; - } - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_request_result); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); - purple_xfer_set_cancel_recv_fnc(xfer->xfer, silcpurple_ftp_cancel); - xfer->xfer->remote_ip = g_strdup(hostname); - xfer->xfer->remote_port = port; - xfer->xfer->data = xfer; - - /* File transfer request */ - purple_xfer_request(xfer->xfer); -} - -static void -silcpurple_ftp_send_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - purple_xfer_unref(xfer->xfer); - g_free(xfer->hostname); - silc_free(xfer); -} - -static void -silcpurple_ftp_send(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - const char *name; - char *local_ip = NULL, *remote_ip = NULL; - gboolean local = TRUE; - - name = purple_xfer_get_local_filename(x); - - /* Do the same magic what we do with key agreement (see silcpurple_buddy.c) - to see if we are behind NAT. */ - if (silc_net_check_local_by_sock(xfer->sg->conn->sock->sock, - NULL, &local_ip)) { - /* Check if the IP is private */ - if (silcpurple_ip_is_private(local_ip)) { - local = FALSE; - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(xfer->sg->conn->sock->sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide the connection point. */ - local = TRUE; - } - } - - if (local && !local_ip) - local_ip = silc_net_localip(); - - /* Send the file */ - silc_client_file_send(xfer->sg->client, xfer->sg->conn, - silcpurple_ftp_monitor, xfer, - local_ip, 0, !local, xfer->client_entry, - name, &xfer->session_id); - - silc_free(local_ip); - silc_free(remote_ip); -} - -static void -silcpurple_ftp_send_file_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(gc, _("Secure File Transfer"), - _("Cannot send file"), tmp); - silc_free(context); - return; - } - - silcpurple_ftp_send_file(client->application, (const char *)context, NULL); - silc_free(context); -} - -PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry *clients; - SilcUInt32 clients_count; - SilcPurpleXfer xfer; - char *nickname; - - g_return_val_if_fail(name != NULL, NULL); - - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return NULL; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, nickname, name, - &clients_count); - if (!clients) { - silc_client_get_clients(client, conn, nickname, NULL, - silcpurple_ftp_send_file_resolved, - strdup(name)); - silc_free(nickname); - return NULL; - } - - xfer = silc_calloc(1, sizeof(*xfer)); - - g_return_val_if_fail(xfer != NULL, NULL); - - xfer->sg = sg; - xfer->client_entry = clients[0]; - xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_SEND, - xfer->client_entry->nickname); - if (!xfer->xfer) { - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - g_free(xfer->hostname); - silc_free(xfer); - return NULL; - } - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_send); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); - purple_xfer_set_cancel_send_fnc(xfer->xfer, silcpurple_ftp_send_cancel); - xfer->xfer->data = xfer; - - silc_free(clients); - silc_free(nickname); - - return xfer->xfer; -} - -void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file) -{ - PurpleXfer *xfer = silcpurple_ftp_new_xfer(gc, name); - - g_return_if_fail(xfer != NULL); - - /* Choose file to send */ - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} diff --git a/libpurple/protocols/silc10/ops.c b/libpurple/protocols/silc10/ops.c deleted file mode 100644 index 0317c95fbf..0000000000 --- a/libpurple/protocols/silc10/ops.c +++ /dev/null @@ -1,2063 +0,0 @@ -/* - - silcpurple_ops.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "imgstore.h" -#include "wb.h" - -static void -silc_channel_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); -static void -silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); - -/* Message sent to the application by library. `conn' associates the - message to a specific connection. `conn', however, may be NULL. - The `type' indicates the type of the message sent by the library. - The application can for example filter the message according the - type. */ - -static void -silc_say(SilcClient client, SilcClientConnection conn, - SilcClientMessageType type, char *msg, ...) -{ - /* Nothing */ -} - -#ifdef HAVE_SILCMIME_H -/* Processes incoming MIME message. Can be private message or channel - message. */ - -static void -silcpurple_mime_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, SilcMime mime, - gboolean recursive) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - const char *type; - const unsigned char *data; - SilcUInt32 data_len; - PurpleMessageFlags cflags = 0; - PurpleConversation *convo = NULL; - - if (!mime) - return; - - /* Check for fragmented MIME message */ - if (silc_mime_is_partial(mime)) { - if (!sg->mimeass) - sg->mimeass = silc_mime_assembler_alloc(); - - /* Defragment */ - mime = silc_mime_assemble(sg->mimeass, mime); - if (!mime) - /* More fragments to come */ - return; - - /* Process the complete message */ - silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, mime, FALSE); - return; - } - - /* Check for multipart message */ - if (silc_mime_is_multipart(mime)) { - SilcMime p; - const char *mtype; - SilcDList parts = silc_mime_get_multiparts(mime, &mtype); - - /* Only "mixed" type supported */ - if (strcmp(mtype, "mixed")) - goto out; - - silc_dlist_start(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) { - /* Recursively process parts */ - silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, p, TRUE); - } - goto out; - } - - /* Get content type and MIME data */ - type = silc_mime_get_field(mime, "Content-Type"); - if (!type) - goto out; - data = silc_mime_get_data(mime, &data_len); - if (!data) - goto out; - - /* Process according to content type */ - - /* Plain text */ - if (strstr(type, "text/plain")) { - /* Default is UTF-8, don't check for other charsets */ - if (!strstr(type, "utf-8")) - goto out; - - if (channel) - silc_channel_message(client, conn, sender, channel, - payload, key, - SILC_MESSAGE_FLAG_UTF8, data, - data_len); - else - silc_private_message(client, conn, sender, payload, - SILC_MESSAGE_FLAG_UTF8, data, - data_len); - goto out; - } - - /* Image */ - if (strstr(type, "image/png") || - strstr(type, "image/jpeg") || - strstr(type, "image/gif") || - strstr(type, "image/tiff")) { - char tmp[32]; - int imgid; - - /* Get channel convo (if message is for channel) */ - if (key && channel) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->key == key) { - prv = l->data; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - prv->channel, sg->account); - break; - } - } - if (channel && !convo) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (channel && !convo) - goto out; - - imgid = purple_imgstore_add_with_id(g_memdup(data, data_len), data_len, ""); - if (imgid) { - cflags |= PURPLE_MESSAGE_IMAGES | PURPLE_MESSAGE_RECV; - g_snprintf(tmp, sizeof(tmp), "", imgid); - - if (channel) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : - "", cflags, - tmp, time(NULL)); - else - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, cflags, time(NULL)); - - purple_imgstore_unref_by_id(imgid); - cflags = 0; - } - goto out; - } - - /* Whiteboard message */ - if (strstr(type, "application/x-wb") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) { - if (channel) - silcpurple_wb_receive_ch(client, conn, sender, channel, - payload, flags, data, data_len); - else - silcpurple_wb_receive(client, conn, sender, payload, - flags, data, data_len); - goto out; - } - - out: - if (!recursive) - silc_mime_free(mime); -} -#endif /* HAVE_SILCMIME_H */ - -/* Message for a channel. The `sender' is the sender of the message - The `channel' is the channel. The `message' is the message. Note - that `message' maybe NULL. The `flags' indicates message flags - and it is used to determine how the message can be interpreted - (like it may tell the message is multimedia message). */ - -static void -silc_channel_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo = NULL; - char *msg, *tmp; - - if (!message) - return; - - if (key) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->key == key) { - prv = l->data; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - prv->channel, sg->account); - break; - } - } - if (!convo) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - return; - - if (flags & SILC_MESSAGE_FLAG_SIGNED && - purple_account_get_bool(sg->account, "sign-verify", FALSE)) { - /* XXX */ - } - - if (flags & SILC_MESSAGE_FLAG_DATA) { - /* Process MIME message */ -#ifdef HAVE_SILCMIME_H - SilcMime mime; - mime = silc_mime_decode(message, message_len); - silcpurple_mime_message(client, conn, sender, channel, payload, - key, flags, mime, FALSE); -#else - char type[128], enc[128]; - unsigned char *data; - SilcUInt32 data_len; - - memset(type, 0, sizeof(type)); - memset(enc, 0, sizeof(enc)); - - if (!silc_mime_parse(message, message_len, NULL, 0, - type, sizeof(type) - 1, enc, sizeof(enc) - 1, &data, - &data_len)) - return; - - if (!strcmp(type, "application/x-wb") && - !strcmp(enc, "binary") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) - silcpurple_wb_receive_ch(client, conn, sender, channel, - payload, flags, data, data_len); -#endif - return; - } - - if (flags & SILC_MESSAGE_FLAG_ACTION) { - msg = g_strdup_printf("/me %s", - (const char *)message); - if (!msg) - return; - - tmp = g_markup_escape_text(msg, -1); - /* Send to Purple */ - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : "", 0, - tmp, time(NULL)); - g_free(tmp); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_NOTICE) { - msg = g_strdup_printf("(notice) %s %s", - sender->nickname ? - sender->nickname : "", - (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - purple_conversation_write(convo, NULL, (const char *)msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); - /* Send to Purple */ - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : "", 0, - tmp, time(NULL)); - g_free(tmp); - } -} - - -/* Private message to the client. The `sender' is the sender of the - message. The message is `message'and maybe NULL. The `flags' - indicates message flags and it is used to determine how the message - can be interpreted (like it may tell the message is multimedia - message). */ - -static void -silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo = NULL; - char *msg, *tmp; - - if (!message) - return; - - if (sender->nickname) - /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - sender->nickname, sg->account); - - if (flags & SILC_MESSAGE_FLAG_SIGNED && - purple_account_get_bool(sg->account, "sign-verify", FALSE)) { - /* XXX */ - } - - if (flags & SILC_MESSAGE_FLAG_DATA) { -#ifdef HAVE_SILCMIME_H - /* Process MIME message */ - SilcMime mime; - mime = silc_mime_decode(message, message_len); - silcpurple_mime_message(client, conn, sender, NULL, payload, - NULL, flags, mime, FALSE); -#else - char type[128], enc[128]; - unsigned char *data; - SilcUInt32 data_len; - - memset(type, 0, sizeof(type)); - memset(enc, 0, sizeof(enc)); - - if (!silc_mime_parse(message, message_len, NULL, 0, - type, sizeof(type) - 1, enc, sizeof(enc) - 1, &data, - &data_len)) - return; - - if (!strcmp(type, "application/x-wb") && - !strcmp(enc, "binary") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) - silcpurple_wb_receive(client, conn, sender, payload, - flags, data, data_len); -#endif - return; - } - - if (flags & SILC_MESSAGE_FLAG_ACTION && convo) { - msg = g_strdup_printf("/me %s", - (const char *)message); - if (!msg) - return; - - tmp = g_markup_escape_text(msg, -1); - /* Send to Purple */ - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, 0, time(NULL)); - g_free(msg); - g_free(tmp); - return; - } - - if (flags & SILC_MESSAGE_FLAG_NOTICE && convo) { - msg = g_strdup_printf("(notice) %s %s", - sender->nickname ? - sender->nickname : "", - (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - purple_conversation_write(convo, NULL, (const char *)msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); - /* Send to Purple */ - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, 0, time(NULL)); - g_free(tmp); - } -} - - -/* Notify message to the client. The notify arguments are sent in the - same order as servers sends them. The arguments are same as received - from the server except for ID's. If ID is received application receives - the corresponding entry to the ID. For example, if Client ID is received - application receives SilcClientEntry. Also, if the notify type is - for channel the channel entry is sent to application (even if server - does not send it because client library gets the channel entry from - the Channel ID in the packet's header). */ - -static void -silc_notify(SilcClient client, SilcClientConnection conn, - SilcNotifyType type, ...) -{ - va_list va; - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo; - SilcClientEntry client_entry, client_entry2; - SilcChannelEntry channel; - SilcServerEntry server_entry; - SilcIdType idtype; - void *entry; - SilcUInt32 mode; - SilcHashTableList htl; - SilcChannelUser chu; - char buf[512], buf2[512], *tmp, *name; - SilcNotifyType notify; - PurpleBuddy *b; - int i; - - va_start(va, type); - memset(buf, 0, sizeof(buf)); - - switch (type) { - - case SILC_NOTIFY_TYPE_NONE: - break; - - case SILC_NOTIFY_TYPE_INVITE: - { - GHashTable *components; - va_arg(va, SilcChannelEntry); - name = va_arg(va, char *); - client_entry = va_arg(va, SilcClientEntry); - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(components, strdup("channel"), strdup(name)); - serv_got_chat_invite(gc, name, client_entry->nickname, NULL, components); - } - break; - - case SILC_NOTIFY_TYPE_JOIN: - client_entry = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - /* If we joined channel, do nothing */ - if (client_entry == conn->local_entry) - break; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - /* Join user to channel */ - g_snprintf(buf, sizeof(buf), "%s@%s", - client_entry->username, client_entry->hostname); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), - g_strdup(client_entry->nickname), buf, PURPLE_CBFLAGS_NONE, TRUE); - - break; - - case SILC_NOTIFY_TYPE_LEAVE: - client_entry = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - /* Remove user from channel */ - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, NULL); - - break; - - case SILC_NOTIFY_TYPE_SIGNOFF: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - - if (!client_entry->nickname) - break; - - /* Remove from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - tmp); - } - silc_hash_table_list_reset(&htl); - - break; - - case SILC_NOTIFY_TYPE_TOPIC_SET: - { - char *esc, *tmp2; - idtype = va_arg(va, int); - entry = va_arg(va, void *); - tmp = va_arg(va, char *); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (!tmp) - break; - - esc = g_markup_escape_text(tmp, -1); - tmp2 = purple_markup_linkify(esc); - g_free(esc); - - if (idtype == SILC_ID_CLIENT) { - client_entry = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - client_entry->nickname, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - client_entry->nickname, tmp); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - server_entry->server_name, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), server_entry->server_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - server_entry->server_name, tmp); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - channel->channel_name, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - channel->channel_name, tmp); - } else { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, tmp); - } - - g_free(tmp2); - - break; - - } - case SILC_NOTIFY_TYPE_NICK_CHANGE: - client_entry = va_arg(va, SilcClientEntry); - client_entry2 = va_arg(va, SilcClientEntry); - - if (!strcmp(client_entry->nickname, client_entry2->nickname)) - break; - - /* Change nick on all channels */ - silc_hash_table_list(client_entry2->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), client_entry->nickname)) - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - client_entry2->nickname); - } - silc_hash_table_list_reset(&htl); - - break; - - case SILC_NOTIFY_TYPE_CMODE_CHANGE: - idtype = va_arg(va, int); - entry = va_arg(va, void *); - mode = va_arg(va, SilcUInt32); - (void)va_arg(va, char *); - (void)va_arg(va, char *); - (void)va_arg(va, char *); - (void)va_arg(va, SilcPublicKey); - (void)va_arg(va, SilcBuffer); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (idtype == SILC_ID_CLIENT) - name = ((SilcClientEntry)entry)->nickname; - else if (idtype == SILC_ID_SERVER) - name = ((SilcServerEntry)entry)->server_name; - else - name = ((SilcChannelEntry)entry)->channel_name; - if (!name) - break; - - if (mode) { - silcpurple_get_chmode_string(mode, buf2, sizeof(buf2)); - g_snprintf(buf, sizeof(buf), - _("%s set channel %s modes to: %s"), name, - channel->channel_name, buf2); - } else { - g_snprintf(buf, sizeof(buf), - _("%s removed all channel %s modes"), name, - channel->channel_name); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - break; - - case SILC_NOTIFY_TYPE_CUMODE_CHANGE: - { - PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE; - idtype = va_arg(va, int); - entry = va_arg(va, void *); - mode = va_arg(va, SilcUInt32); - client_entry2 = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (idtype == SILC_ID_CLIENT) - name = ((SilcClientEntry)entry)->nickname; - else if (idtype == SILC_ID_SERVER) - name = ((SilcServerEntry)entry)->server_name; - else - name = ((SilcChannelEntry)entry)->channel_name; - if (!name) - break; - - if (mode) { - silcpurple_get_chumode_string(mode, buf2, sizeof(buf2)); - g_snprintf(buf, sizeof(buf), - _("%s set %s's modes to: %s"), name, - client_entry2->nickname, buf2); - if (mode & SILC_CHANNEL_UMODE_CHANFO) - flags |= PURPLE_CBFLAGS_FOUNDER; - if (mode & SILC_CHANNEL_UMODE_CHANOP) - flags |= PURPLE_CBFLAGS_OP; - } else { - g_snprintf(buf, sizeof(buf), - _("%s removed all %s's modes"), name, - client_entry2->nickname); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(convo), client_entry2->nickname, flags); - break; - } - - case SILC_NOTIFY_TYPE_MOTD: - tmp = va_arg(va, char *); - silc_free(sg->motd); - sg->motd = silc_memdup(tmp, strlen(tmp)); - break; - - case SILC_NOTIFY_TYPE_KICKED: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - client_entry2 = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (client_entry == conn->local_entry) { - /* Remove us from channel */ - g_snprintf(buf, sizeof(buf), - _("You have been kicked off %s by %s (%s)"), - channel->channel_name, client_entry2->nickname, - tmp ? tmp : ""); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } else { - /* Remove user from channel */ - g_snprintf(buf, sizeof(buf), _("Kicked by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - buf); - } - - break; - - case SILC_NOTIFY_TYPE_KILLED: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - idtype = va_arg(va, int); - entry = va_arg(va, SilcClientEntry); - - if (!client_entry->nickname) - break; - - if (client_entry == conn->local_entry) { - if (idtype == SILC_ID_CLIENT) { - client_entry2 = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - server_entry->server_name, tmp ? tmp : ""); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - channel->channel_name, tmp ? tmp : ""); - } - - /* Remove us from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } - silc_hash_table_list_reset(&htl); - - } else { - if (idtype == SILC_ID_CLIENT) { - client_entry2 = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - server_entry->server_name, tmp ? tmp : ""); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - channel->channel_name, tmp ? tmp : ""); - } - - /* Remove user from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, tmp); - } - silc_hash_table_list_reset(&htl); - } - - break; - - case SILC_NOTIFY_TYPE_CHANNEL_CHANGE: - break; - - case SILC_NOTIFY_TYPE_SERVER_SIGNOFF: - { - int i; - SilcClientEntry *clients; - SilcUInt32 clients_count; - - (void)va_arg(va, void *); - clients = va_arg(va, SilcClientEntry *); - clients_count = va_arg(va, SilcUInt32); - - for (i = 0; i < clients_count; i++) { - if (!clients[i]->nickname) - break; - - /* Remove from all channels */ - silc_hash_table_list(clients[i]->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = - purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - clients[i]->nickname, - _("Server signoff")); - } - silc_hash_table_list_reset(&htl); - } - } - break; - - case SILC_NOTIFY_TYPE_ERROR: - { - SilcStatus error = va_arg(va, int); - purple_notify_error(gc, "Error Notify", - silc_get_status_message(error), - NULL); - } - break; - - case SILC_NOTIFY_TYPE_WATCH: - { - SilcPublicKey public_key; - unsigned char *pk; - SilcUInt32 pk_len; - char *fingerprint; - - client_entry = va_arg(va, SilcClientEntry); - (void)va_arg(va, char *); - mode = va_arg(va, SilcUInt32); - notify = va_arg(va, int); - public_key = va_arg(va, SilcPublicKey); - - b = NULL; - if (public_key) { - PurpleBlistNode *gnode, *cnode, *bnode; - const char *f; - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) - break; - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - g_snprintf(buf, sizeof(buf) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" - G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - silc_free(fingerprint); - silc_free(pk); - - /* Find buddy by associated public key */ - for (gnode = purple_get_blist()->root; gnode; - gnode = gnode->next) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - for (cnode = gnode->child; cnode; cnode = cnode->next) { - if( !PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for (bnode = cnode->child; bnode; - bnode = bnode->next) { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - b = (PurpleBuddy *)bnode; - if (b->account != gc->account) - continue; - f = purple_blist_node_get_string(bnode, "public-key"); - if (f && !strcmp(f, buf)) - goto cont; - b = NULL; - } - } - } - } - cont: - if (!b) { - /* Find buddy by nickname */ - b = purple_find_buddy(sg->account, client_entry->nickname); - if (!b) { - purple_debug_warning("silc", "WATCH for %s, unknown buddy\n", - client_entry->nickname); - break; - } - } - - silc_free(b->proto_data); - b->proto_data = silc_memdup(client_entry->id, - sizeof(*client_entry->id)); - if (notify == SILC_NOTIFY_TYPE_NICK_CHANGE) { - break; - } else if (notify == SILC_NOTIFY_TYPE_UMODE_CHANGE) { - /* See if client was away and is now present */ - if (!(mode & (SILC_UMODE_GONE | SILC_UMODE_INDISPOSED | - SILC_UMODE_BUSY | SILC_UMODE_PAGE | - SILC_UMODE_DETACHED)) && - (client_entry->mode & SILC_UMODE_GONE || - client_entry->mode & SILC_UMODE_INDISPOSED || - client_entry->mode & SILC_UMODE_BUSY || - client_entry->mode & SILC_UMODE_PAGE || - client_entry->mode & SILC_UMODE_DETACHED)) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - } - else if ((mode & SILC_UMODE_GONE) || - (mode & SILC_UMODE_INDISPOSED) || - (mode & SILC_UMODE_BUSY) || - (mode & SILC_UMODE_PAGE) || - (mode & SILC_UMODE_DETACHED)) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - } - } else if (notify == SILC_NOTIFY_TYPE_SIGNOFF || - notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF || - notify == SILC_NOTIFY_TYPE_KILLED) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - } else if (notify == SILC_NOTIFY_TYPE_NONE) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - } - } - break; - - default: - purple_debug_info("silc", "Unhandled notification: %d\n", type); - break; - } - - va_end(va); -} - - -/* Command handler. This function is called always in the command function. - If error occurs it will be called as well. `conn' is the associated - client connection. `cmd_context' is the command context that was - originally sent to the command. `success' is FALSE if error occurred - during command. `command' is the command being processed. It must be - noted that this is not reply from server. This is merely called just - after application has called the command. Just to tell application - that the command really was processed. */ - -static void -silc_command(SilcClient client, SilcClientConnection conn, - SilcClientCommandContext cmd_context, bool success, - SilcCommand command, SilcStatus status) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - switch (command) { - - case SILC_COMMAND_CMODE: - if (cmd_context->argc == 3 && - !strcmp((char *)cmd_context->argv[2], "+C")) - sg->chpk = TRUE; - else - sg->chpk = FALSE; - break; - - default: - break; - } -} - -#if 0 -static void -silcpurple_whois_more(SilcClientEntry client_entry, gint id) -{ - SilcAttributePayload attr; - SilcAttribute attribute; - char *buf; - GString *s; - SilcVCardStruct vcard; - int i; - - if (id != 0) - return; - - memset(&vcard, 0, sizeof(vcard)); - - s = g_string_new(""); - - silc_dlist_start(client_entry->attrs); - while ((attr = silc_dlist_get(client_entry->attrs)) != SILC_LIST_END) { - attribute = silc_attribute_get_attribute(attr); - switch (attribute) { - - case SILC_ATTRIBUTE_USER_INFO: - if (!silc_attribute_get_object(attr, (void *)&vcard, - sizeof(vcard))) - continue; - g_string_append_printf(s, "%s:\n\n", _("Personal Information")); - if (vcard.full_name) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Full Name"), - vcard.full_name); - if (vcard.first_name) - g_string_append_printf(s, "%s:\t%s\n", - _("First Name"), - vcard.first_name); - if (vcard.middle_names) - g_string_append_printf(s, "%s:\t%s\n", - _("Middle Name"), - vcard.middle_names); - if (vcard.family_name) - g_string_append_printf(s, "%s:\t%s\n", - _("Family Name"), - vcard.family_name); - if (vcard.nickname) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Nickname"), - vcard.nickname); - if (vcard.bday) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Birth Day"), - vcard.bday); - if (vcard.title) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Job Title"), - vcard.title); - if (vcard.role) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Job Role"), - vcard.role); - if (vcard.org_name) - g_string_append_printf(s, "%s:\t%s\n", - _("Organization"), - vcard.org_name); - if (vcard.org_unit) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Unit"), - vcard.org_unit); - if (vcard.url) - g_string_append_printf(s, "%s:\t%s\n", - _("Homepage"), - vcard.url); - if (vcard.label) - g_string_append_printf(s, "%s:\t%s\n", - _("Address"), - vcard.label); - for (i = 0; i < vcard.num_tels; i++) { - if (vcard.tels[i].telnum) - g_string_append_printf(s, "%s:\t\t\t%s\n", - _("Phone"), - vcard.tels[i].telnum); - } - for (i = 0; i < vcard.num_emails; i++) { - if (vcard.emails[i].address) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Email"), - vcard.emails[i].address); - } - if (vcard.note) - g_string_append_printf(s, "\n%s:\t\t%s\n", - _("Note"), - vcard.note); - break; - } - } - - buf = g_string_free(s, FALSE); - purple_notify_info(NULL, _("User Information"), _("User Information"), - buf); - g_free(buf); -} -#endif - -/* Command reply handler. This function is called always in the command reply - function. If error occurs it will be called as well. Normal scenario - is that it will be called after the received command data has been parsed - and processed. The function is used to pass the received command data to - the application. - - `conn' is the associated client connection. `cmd_payload' is the command - payload data received from server and it can be ignored. It is provided - if the application would like to re-parse the received command data, - however, it must be noted that the data is parsed already by the library - thus the payload can be ignored. `success' is FALSE if error occurred. - In this case arguments are not sent to the application. The `status' is - the command reply status server returned. The `command' is the command - reply being processed. The function has variable argument list and each - command defines the number and type of arguments it passes to the - application (on error they are not sent). */ - -static void -silc_command_reply(SilcClient client, SilcClientConnection conn, - SilcCommandPayload cmd_payload, bool success, - SilcCommand command, SilcStatus status, ...) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo; - va_list vp; - - va_start(vp, status); - - switch (command) { - case SILC_COMMAND_JOIN: - { - SilcChannelEntry channel_entry; - - if (!success) { - purple_notify_error(gc, _("Join Chat"), _("Cannot join channel"), - silc_get_status_message(status)); - return; - } - - (void)va_arg(vp, char *); - channel_entry = va_arg(vp, SilcChannelEntry); - - /* Resolve users on channel */ - silc_client_get_clients_by_channel(client, conn, channel_entry, - silcpurple_chat_join_done, - channel_entry); - } - break; - - case SILC_COMMAND_LEAVE: - break; - - case SILC_COMMAND_USERS: - break; - - case SILC_COMMAND_WHOIS: - { - SilcUInt32 idle, mode; - SilcBuffer channels, user_modes; - SilcClientEntry client_entry; - char tmp[1024], *tmp2; - char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - PurpleNotifyUserInfo *user_info; - - if (!success) { - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), - silc_get_status_message(status)); - break; - } - - client_entry = va_arg(vp, SilcClientEntry); - if (!client_entry->nickname) - break; - (void)va_arg(vp, char *); - (void)va_arg(vp, char *); - (void)va_arg(vp, char *); - channels = va_arg(vp, SilcBuffer); - mode = va_arg(vp, SilcUInt32); - idle = va_arg(vp, SilcUInt32); - (void)va_arg(vp, unsigned char *); - user_modes = va_arg(vp, SilcBuffer); - - user_info = purple_notify_user_info_new(); - tmp2 = g_markup_escape_text(client_entry->nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp2); - g_free(tmp2); - if (client_entry->realname) { - tmp2 = g_markup_escape_text(client_entry->realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp2); - g_free(tmp2); - } - if (client_entry->username) { - tmp2 = g_markup_escape_text(client_entry->username, -1); - if (client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); - } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp2); - g_free(tmp2); - } - - if (client_entry->mode) { - memset(tmp, 0, sizeof(tmp)); - silcpurple_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); - } - - silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); - if (moodstr) { - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); - g_free(moodstr); - } - - if (statusstr) { - tmp2 = g_markup_escape_text(statusstr, -1); - purple_notify_user_info_add_pair(user_info, _("Status Text"), tmp2); - g_free(statusstr); - g_free(tmp2); - } - - if (contactstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); - g_free(contactstr); - } - - if (langstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); - g_free(langstr); - } - - if (devicestr) { - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); - g_free(devicestr); - } - - if (tzstr) { - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); - g_free(tzstr); - } - - if (geostr) { - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); - g_free(geostr); - } - - if (client_entry->server) - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); - - if (channels && user_modes) { - SilcUInt32 *umodes; - SilcDList list = - silc_channel_payload_parse_list(channels->data, - channels->len); - if (list && silc_get_mode_list(user_modes, - silc_dlist_count(list), - &umodes)) { - SilcChannelPayload entry; - int i = 0; - - memset(tmp, 0, sizeof(tmp)); - silc_dlist_start(list); - while ((entry = silc_dlist_get(list)) - != SILC_LIST_END) { - SilcUInt32 name_len; - char *m = silc_client_chumode_char(umodes[i++]); - char *name = (char *)silc_channel_get_name(entry, &name_len); - if (m) - silc_strncat(tmp, sizeof(tmp) - 1, m, strlen(m)); - silc_strncat(tmp, sizeof(tmp) - 1, name, name_len); - silc_strncat(tmp, sizeof(tmp) - 1, " ", 1); - silc_free(m); - - } - tmp2 = g_markup_escape_text(tmp, -1); - purple_notify_user_info_add_pair(user_info, _("Currently on"), tmp2); - g_free(tmp2); - silc_free(umodes); - } - } - - if (client_entry->public_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - -#if 0 /* XXX for now, let's not show attrs here */ - if (client_entry->attrs) - purple_request_action(gc, _("User Information"), - _("User Information"), - buf, 1, client_entry, 2, - _("OK"), G_CALLBACK(silcpurple_whois_more), - _("_More..."), G_CALLBACK(silcpurple_whois_more), gc->account, NULL, NULL); - else -#endif - purple_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } - break; - - case SILC_COMMAND_WHOWAS: - { - SilcClientEntry client_entry; - char *nickname, *realname, *username, *tmp; - PurpleNotifyUserInfo *user_info; - - if (!success) { - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), - silc_get_status_message(status)); - break; - } - - client_entry = va_arg(vp, SilcClientEntry); - nickname = va_arg(vp, char *); - username = va_arg(vp, char *); - realname = va_arg(vp, char *); - if (!nickname) - break; - - user_info = purple_notify_user_info_new(); - tmp = g_markup_escape_text(nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); - if (realname) { - tmp = g_markup_escape_text(realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp); - g_free(tmp); - } - if (username) { - tmp = g_markup_escape_text(username, -1); - if (client_entry && client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); - } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - g_free(tmp); - } - if (client_entry && client_entry->server) - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); - - - if (client_entry && client_entry->public_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - - purple_notify_userinfo(gc, nickname, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } - break; - - case SILC_COMMAND_DETACH: - if (!success) { - purple_notify_error(gc, _("Detach From Server"), _("Cannot detach"), - silc_get_status_message(status)); - return; - } - break; - - case SILC_COMMAND_TOPIC: - { - SilcChannelEntry channel; - - if (!success) { - purple_notify_error(gc, _("Topic"), _("Cannot set topic"), - silc_get_status_message(status)); - return; - } - - channel = va_arg(vp, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) { - purple_debug_error("silc", "Got a topic for %s, which doesn't exist\n", - channel->channel_name); - break; - } - - /* Set topic */ - if (channel->topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, channel->topic); - } - break; - - case SILC_COMMAND_NICK: - { - /* I don't think we should need to do this because the server should - * be sending a SILC_NOTIFY_TYPE_NICK_CHANGE when we change our own - * nick, but it isn't, so we deal with it here instead. Stu. */ - SilcClientEntry local_entry; - SilcHashTableList htl; - SilcChannelUser chu; - const char *oldnick; - - if (!success) { - purple_notify_error(gc, _("Nick"), _("Failed to change nickname"), - silc_get_status_message(status)); - return; - } - - local_entry = va_arg(vp, SilcClientEntry); - - /* Change nick on all channels */ - silc_hash_table_list(local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - oldnick = purple_conv_chat_get_nick(PURPLE_CONV_CHAT(convo)); - if (strcmp(oldnick, purple_normalize(purple_conversation_get_account(convo), local_entry->nickname))) { - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), - oldnick, local_entry->nickname); - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), local_entry->nickname); - } - } - silc_hash_table_list_reset(&htl); - - purple_connection_set_display_name(gc, local_entry->nickname); - } - break; - - case SILC_COMMAND_LIST: - { - char *topic, *name; - int usercount; - PurpleRoomlistRoom *room; - - if (sg->roomlist_cancelled) - break; - - if (!success) { - purple_notify_error(gc, _("Error"), _("Error retrieving room list"), - silc_get_status_message(status)); - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - return; - } - - (void)va_arg(vp, SilcChannelEntry); - name = va_arg(vp, char *); - if (!name) { - purple_notify_error(gc, _("Roomlist"), _("Cannot get room list"), - silc_get_status_message(status)); - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - return; - } - topic = va_arg(vp, char *); - usercount = va_arg(vp, int); - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); - purple_roomlist_room_add_field(sg->roomlist, room, name); - purple_roomlist_room_add_field(sg->roomlist, room, - SILC_32_TO_PTR(usercount)); - purple_roomlist_room_add_field(sg->roomlist, room, - topic ? topic : ""); - purple_roomlist_room_add(sg->roomlist, room); - - if (status == SILC_STATUS_LIST_END || - status == SILC_STATUS_OK) { - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - } - } - break; - - case SILC_COMMAND_GETKEY: - { - SilcPublicKey public_key; - - if (!success) { - purple_notify_error(gc, _("Get Public Key"), - _("Cannot fetch the public key"), - silc_get_status_message(status)); - return; - } - - (void)va_arg(vp, SilcUInt32); - (void)va_arg(vp, void *); - public_key = va_arg(vp, SilcPublicKey); - - if (!public_key) - purple_notify_error(gc, _("Get Public Key"), - _("Cannot fetch the public key"), - _("No public key was received")); - } - break; - - case SILC_COMMAND_INFO: - { - - char *server_name; - char *server_info; - char tmp[256]; - - if (!success) { - purple_notify_error(gc, _("Server Information"), - _("Cannot get server information"), - silc_get_status_message(status)); - return; - } - - (void)va_arg(vp, SilcServerEntry); - server_name = va_arg(vp, char *); - server_info = va_arg(vp, char *); - - if (server_name && server_info) { - g_snprintf(tmp, sizeof(tmp), "Server: %s\n%s", - server_name, server_info); - purple_notify_info(gc, NULL, _("Server Information"), tmp); - } - } - break; - - case SILC_COMMAND_STATS: - { - SilcUInt32 starttime, uptime, my_clients, my_channels, my_server_ops, - my_router_ops, cell_clients, cell_channels, cell_servers, - clients, channels, servers, routers, server_ops, router_ops; - SilcUInt32 buffer_length; - SilcBufferStruct buf; - - unsigned char *server_stats; - char *msg; - - if (!success) { - purple_notify_error(gc, _("Server Statistics"), - _("Cannot get server statistics"), - silc_get_status_message(status)); - return; - } - - server_stats = va_arg(vp, unsigned char *); - buffer_length = va_arg(vp, SilcUInt32); - if (!server_stats || !buffer_length) { - purple_notify_error(gc, _("Server Statistics"), - _("No server statistics available"), NULL); - break; - } - silc_buffer_set(&buf, server_stats, buffer_length); - silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&starttime), - SILC_STR_UI_INT(&uptime), - SILC_STR_UI_INT(&my_clients), - SILC_STR_UI_INT(&my_channels), - SILC_STR_UI_INT(&my_server_ops), - SILC_STR_UI_INT(&my_router_ops), - SILC_STR_UI_INT(&cell_clients), - SILC_STR_UI_INT(&cell_channels), - SILC_STR_UI_INT(&cell_servers), - SILC_STR_UI_INT(&clients), - SILC_STR_UI_INT(&channels), - SILC_STR_UI_INT(&servers), - SILC_STR_UI_INT(&routers), - SILC_STR_UI_INT(&server_ops), - SILC_STR_UI_INT(&router_ops), - SILC_STR_END); - - msg = g_strdup_printf(_("Local server start time: %s\n" - "Local server uptime: %s\n" - "Local server clients: %d\n" - "Local server channels: %d\n" - "Local server operators: %d\n" - "Local router operators: %d\n" - "Local cell clients: %d\n" - "Local cell channels: %d\n" - "Local cell servers: %d\n" - "Total clients: %d\n" - "Total channels: %d\n" - "Total servers: %d\n" - "Total routers: %d\n" - "Total server operators: %d\n" - "Total router operators: %d\n"), - silc_get_time(starttime), - purple_str_seconds_to_string((int)uptime), - (int)my_clients, (int)my_channels, (int)my_server_ops, (int)my_router_ops, - (int)cell_clients, (int)cell_channels, (int)cell_servers, - (int)clients, (int)channels, (int)servers, (int)routers, - (int)server_ops, (int)router_ops); - - purple_notify_info(gc, NULL, - _("Network Statistics"), msg); - g_free(msg); - } - break; - - case SILC_COMMAND_PING: - { - if (!success) { - purple_notify_error(gc, _("Ping"), _("Ping failed"), - silc_get_status_message(status)); - return; - } - - purple_notify_info(gc, _("Ping"), _("Ping reply received from server"), - NULL); - } - break; - - case SILC_COMMAND_KILL: - if (!success) { - purple_notify_error(gc, _("Kill User"), - _("Could not kill user"), - silc_get_status_message(status)); - return; - } - break; - - case SILC_COMMAND_CMODE: - { - SilcChannelEntry channel_entry; - SilcBuffer channel_pubkeys; - - if (!success) - return; - - channel_entry = va_arg(vp, SilcChannelEntry); - (void)va_arg(vp, SilcUInt32); - (void)va_arg(vp, SilcPublicKey); - channel_pubkeys = va_arg(vp, SilcBuffer); - - if (sg->chpk) - silcpurple_chat_chauth_show(sg, channel_entry, channel_pubkeys); - } - break; - - default: - if (success) - purple_debug_info("silc", "Unhandled command: %d (succeeded)\n", command); - else - purple_debug_info("silc", "Unhandled command: %d (failed: %s)\n", command, - silc_get_status_message(status)); - break; - } - - va_end(vp); -} - - -/* Called to indicate that connection was either successfully established - or connecting failed. This is also the first time application receives - the SilcClientConnection object which it should save somewhere. - If the `success' is FALSE the application must always call the function - silc_client_close_connection. */ - -static void -silc_connected(SilcClient client, SilcClientConnection conn, - SilcClientConnectionStatus status) -{ - PurpleConnection *gc = client->application; - SilcPurple sg; - - if (gc == NULL) { - silc_client_close_connection(client, conn); - return; - } - sg = gc->proto_data; - - switch (status) { - case SILC_CLIENT_CONN_SUCCESS: - case SILC_CLIENT_CONN_SUCCESS_RESUME: - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* Send the server our buddy list */ - silcpurple_send_buddylist(gc); - - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - - /* Send any UMODEs configured for account */ - if (purple_account_get_bool(sg->account, "block-ims", FALSE)) { - silc_client_command_call(sg->client, sg->conn, NULL, - "UMODE", "+P", NULL); - } - - return; - break; - case SILC_CLIENT_CONN_ERROR: - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error during connecting to SILC Server")); - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - break; - - case SILC_CLIENT_CONN_ERROR_KE: - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Key Exchange failed")); - break; - - case SILC_CLIENT_CONN_ERROR_AUTH: - purple_connection_error(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Authentication failed")); - break; - - case SILC_CLIENT_CONN_ERROR_RESUME: - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Resuming detached session failed. " - "Press Reconnect to create new connection.")); - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - break; - - case SILC_CLIENT_CONN_ERROR_TIMEOUT: - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection timed out")); - break; - } - - /* Error */ - sg->conn = NULL; - silc_client_close_connection(client, conn); -} - - -/* Called to indicate that connection was disconnected to the server. - The `status' may tell the reason of the disconnection, and if the - `message' is non-NULL it may include the disconnection message - received from server. */ - -static void -silc_disconnected(SilcClient client, SilcClientConnection conn, - SilcStatus status, const char *message) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - if (sg->resuming && !sg->detaching) - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - - sg->conn = NULL; - - /* Close the connection */ - if (!sg->detaching) - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Disconnected by server")); - else - /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ - purple_account_disconnect(purple_connection_get_account(gc)); -} - - -typedef struct { - SilcGetAuthMeth completion; - void *context; -} *SilcPurpleGetAuthMethod; - -/* Callback called when we've received the authentication method information - from the server after we've requested it. */ - -static void silc_get_auth_method_callback(SilcClient client, - SilcClientConnection conn, - SilcAuthMethod auth_meth, - void *context) -{ - SilcPurpleGetAuthMethod internal = context; - - switch (auth_meth) { - case SILC_AUTH_NONE: - /* No authentication required. */ - (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); - break; - - case SILC_AUTH_PASSWORD: - /* By returning NULL here the library will ask the passphrase from us - by calling the silc_ask_passphrase. */ - (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); - break; - - case SILC_AUTH_PUBLIC_KEY: - /* Do not get the authentication data now, the library will generate - it using our default key, if we do not provide it here. */ - (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); - break; - } - - silc_free(internal); -} - -/* Find authentication method and authentication data by hostname and - port. The hostname may be IP address as well. When the authentication - method has been resolved the `completion' callback with the found - authentication method and authentication data is called. The `conn' - may be NULL. */ - -static void -silc_get_auth_method(SilcClient client, SilcClientConnection conn, - char *hostname, SilcUInt16 port, - SilcGetAuthMeth completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleGetAuthMethod internal; - const char *password; - - /* Progress */ - if (sg->resuming) - purple_connection_update_progress(gc, _("Resuming session"), 4, 5); - else - purple_connection_update_progress(gc, _("Authenticating connection"), 4, 5); - - /* Check configuration if we have this connection configured. If we - have then return that data immediately, as it's faster way. */ - if (purple_account_get_bool(sg->account, "pubkey-auth", FALSE)) { - completion(TRUE, SILC_AUTH_PUBLIC_KEY, NULL, 0, context); - return; - } - password = purple_connection_get_password(gc); - if (password && *password) { - completion(TRUE, SILC_AUTH_PASSWORD, (unsigned char *)password, strlen(password), context); - return; - } - - /* Resolve the authentication method from server, as we may not know it. */ - internal = silc_calloc(1, sizeof(*internal)); - if (!internal) - return; - internal->completion = completion; - internal->context = context; - silc_client_request_authentication_method(client, conn, - silc_get_auth_method_callback, - internal); -} - - -/* Verifies received public key. The `conn_type' indicates which entity - (server, client etc.) has sent the public key. If user decides to trust - the application may save the key as trusted public key for later - use. The `completion' must be called after the public key has been - verified. */ - -static void -silc_verify_public_key(SilcClient client, SilcClientConnection conn, - SilcSocketType conn_type, unsigned char *pk, - SilcUInt32 pk_len, SilcSKEPKType pk_type, - SilcVerifyPublicKey completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - if (!sg->conn && (conn_type == SILC_SOCKET_TYPE_SERVER || - conn_type == SILC_SOCKET_TYPE_ROUTER)) { - /* Progress */ - if (sg->resuming) - purple_connection_update_progress(gc, _("Resuming session"), 3, 5); - else - purple_connection_update_progress(gc, _("Verifying server public key"), - 3, 5); - } - - /* Verify public key */ - silcpurple_verify_public_key(client, conn, NULL, conn_type, pk, - pk_len, pk_type, completion, context); -} - -typedef struct { - SilcAskPassphrase completion; - void *context; -} *SilcPurpleAskPassphrase; - -static void -silc_ask_passphrase_cb(SilcPurpleAskPassphrase internal, const char *passphrase) -{ - if (!passphrase || !(*passphrase)) - internal->completion(NULL, 0, internal->context); - else - internal->completion((unsigned char *)passphrase, - strlen(passphrase), internal->context); - silc_free(internal); -} - -/* Ask (interact, that is) a passphrase from user. The passphrase is - returned to the library by calling the `completion' callback with - the `context'. The returned passphrase SHOULD be in UTF-8 encoded, - if not then the library will attempt to encode. */ - -static void -silc_ask_passphrase(SilcClient client, SilcClientConnection conn, - SilcAskPassphrase completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurpleAskPassphrase internal = silc_calloc(1, sizeof(*internal)); - - if (!internal) - return; - internal->completion = completion; - internal->context = context; - purple_request_input(gc, _("Passphrase"), NULL, - _("Passphrase required"), NULL, FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(silc_ask_passphrase_cb), - _("Cancel"), G_CALLBACK(silc_ask_passphrase_cb), - purple_connection_get_account(gc), NULL, NULL, internal); -} - - -/* Notifies application that failure packet was received. This is called - if there is some protocol active in the client. The `protocol' is the - protocol context. The `failure' is opaque pointer to the failure - indication. Note, that the `failure' is protocol dependant and - application must explicitly cast it to correct type. Usually `failure' - is 32 bit failure type (see protocol specs for all protocol failure - types). */ - -static void -silc_failure(SilcClient client, SilcClientConnection conn, - SilcProtocol protocol, void *failure) -{ - PurpleConnection *gc = client->application; - char buf[128]; - - memset(buf, 0, sizeof(buf)); - - if (protocol->protocol->type == SILC_PROTOCOL_CLIENT_KEY_EXCHANGE) { - SilcSKEStatus status = (SilcSKEStatus)SILC_PTR_TO_32(failure); - - if (status == SILC_SKE_STATUS_BAD_VERSION) - g_snprintf(buf, sizeof(buf), - _("Failure: Version mismatch, upgrade your client")); - if (status == SILC_SKE_STATUS_UNSUPPORTED_PUBLIC_KEY) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not trust/support your public key")); - if (status == SILC_SKE_STATUS_UNKNOWN_GROUP) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed KE group")); - if (status == SILC_SKE_STATUS_UNKNOWN_CIPHER) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed cipher")); - if (status == SILC_SKE_STATUS_UNKNOWN_PKCS) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed PKCS")); - if (status == SILC_SKE_STATUS_UNKNOWN_HASH_FUNCTION) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed hash function")); - if (status == SILC_SKE_STATUS_UNKNOWN_HMAC) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed HMAC")); - if (status == SILC_SKE_STATUS_INCORRECT_SIGNATURE) - g_snprintf(buf, sizeof(buf), _("Failure: Incorrect signature")); - if (status == SILC_SKE_STATUS_INVALID_COOKIE) - g_snprintf(buf, sizeof(buf), _("Failure: Invalid cookie")); - - /* Show the error on the progress bar. A more generic error message - is going to be showed to user after this in the silc_connected. */ - purple_connection_update_progress(gc, buf, 2, 5); - } - - if (protocol->protocol->type == SILC_PROTOCOL_CLIENT_CONNECTION_AUTH) { - SilcUInt32 err = SILC_PTR_TO_32(failure); - - if (err == SILC_AUTH_FAILED) - g_snprintf(buf, sizeof(buf), _("Failure: Authentication failed")); - - /* Show the error on the progress bar. A more generic error message - is going to be showed to user after this in the silc_connected. */ - purple_connection_update_progress(gc, buf, 4, 5); - } -} - -/* Asks whether the user would like to perform the key agreement protocol. - This is called after we have received an key agreement packet or an - reply to our key agreement packet. This returns TRUE if the user wants - the library to perform the key agreement protocol and FALSE if it is not - desired (application may start it later by calling the function - silc_client_perform_key_agreement). If TRUE is returned also the - `completion' and `context' arguments must be set by the application. */ - -static bool -silc_key_agreement(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, const char *hostname, - SilcUInt16 port, SilcKeyAgreementCallback *completion, - void **context) -{ - silcpurple_buddy_keyagr_request(client, conn, client_entry, hostname, port); - *completion = NULL; - *context = NULL; - return FALSE; -} - - -/* Notifies application that file transfer protocol session is being - requested by the remote client indicated by the `client_entry' from - the `hostname' and `port'. The `session_id' is the file transfer - session and it can be used to either accept or reject the file - transfer request, by calling the silc_client_file_receive or - silc_client_file_close, respectively. */ - -static void -silc_ftp(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port) -{ - silcpurple_ftp_request(client, conn, client_entry, session_id, - hostname, port); -} - - -/* Delivers SILC session detachment data indicated by `detach_data' to the - application. If application has issued SILC_COMMAND_DETACH command - the client session in the SILC network is not quit. The client remains - in the network but is detached. The detachment data may be used later - to resume the session in the SILC Network. The appliation is - responsible of saving the `detach_data', to for example in a file. - - The detachment data can be given as argument to the functions - silc_client_connect_to_server, or silc_client_add_connection when - creating connection to remote server, inside SilcClientConnectionParams - structure. If it is provided the client library will attempt to resume - the session in the network. After the connection is created - successfully, the application is responsible of setting the user - interface for user into the same state it was before detaching (showing - same channels, channel modes, etc). It can do this by fetching the - information (like joined channels) from the client library. */ - -static void -silc_detach(SilcClient client, SilcClientConnection conn, - const unsigned char *detach_data, SilcUInt32 detach_data_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - const char *file; - - /* Save the detachment data to file. */ - file = silcpurple_session_file(purple_account_get_username(sg->account)); - g_unlink(file); - silc_file_writefile(file, (char *)detach_data, detach_data_len); -} - -SilcClientOperations ops = { - silc_say, - silc_channel_message, - silc_private_message, - silc_notify, - silc_command, - silc_command_reply, - silc_connected, - silc_disconnected, - silc_get_auth_method, - silc_verify_public_key, - silc_ask_passphrase, - silc_failure, - silc_key_agreement, - silc_ftp, - silc_detach -}; diff --git a/libpurple/protocols/silc10/pk.c b/libpurple/protocols/silc10/pk.c deleted file mode 100644 index 0bd399d6d5..0000000000 --- a/libpurple/protocols/silc10/pk.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - - silcpurple_pk.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" - -/************************* Public Key Verification ***************************/ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - char *filename; - char *entity; - char *entity_name; - char *fingerprint; - char *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - SilcSKEPKType pk_type; - SilcVerifyPublicKey completion; - void *context; - gboolean changed; -} *PublicKeyVerify; - -static void silcpurple_verify_ask(const char *entity, - const char *fingerprint, - const char *babbleprint, - PublicKeyVerify verify); - -static void silcpurple_verify_cb(PublicKeyVerify verify, gint id) -{ - if (id != 2) { - if (verify->completion) - verify->completion(FALSE, verify->context); - } else { - if (verify->completion) - verify->completion(TRUE, verify->context); - - /* Save the key for future checking */ - silc_pkcs_save_public_key_data(verify->filename, verify->pk, - verify->pk_len, SILC_PKCS_FILE_PEM); - } - - silc_free(verify->filename); - silc_free(verify->entity); - silc_free(verify->entity_name); - silc_free(verify->fingerprint); - silc_free(verify->babbleprint); - silc_free(verify->pk); - silc_free(verify); -} - -static void silcpurple_verify_details_cb(PublicKeyVerify verify) -{ - /* What a hack. We have to display the accept dialog _again_ - because Purple closes the dialog after you press the button. Purple - should have option for the dialogs whether the buttons close them - or not. */ - silcpurple_verify_ask(verify->entity, verify->fingerprint, - verify->babbleprint, verify); -} - -static void silcpurple_verify_details(PublicKeyVerify verify, gint id) -{ - SilcPublicKey public_key; - PurpleConnection *gc = verify->client->application; - SilcPurple sg = gc->proto_data; - - silc_pkcs_public_key_decode(verify->pk, verify->pk_len, - &public_key); - silcpurple_show_public_key(sg, verify->entity_name, public_key, - G_CALLBACK(silcpurple_verify_details_cb), - verify); - silc_pkcs_public_key_free(public_key); -} - -static void silcpurple_verify_ask(const char *entity, - const char *fingerprint, - const char *babbleprint, - PublicKeyVerify verify) -{ - PurpleConnection *gc = verify->client->application; - char tmp[256], tmp2[256]; - - if (verify->changed) { - g_snprintf(tmp, sizeof(tmp), - _("Received %s's public key. Your local copy does not match this " - "key. Would you still like to accept this public key?"), - entity); - } else { - g_snprintf(tmp, sizeof(tmp), - _("Received %s's public key. Would you like to accept this " - "public key?"), entity); - } - g_snprintf(tmp2, sizeof(tmp2), - _("Fingerprint and babbleprint for the %s key are:\n\n" - "%s\n%s\n"), entity, fingerprint, babbleprint); - - purple_request_action(gc, _("Verify Public Key"), tmp, tmp2, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), entity, NULL, verify, 3, - _("Yes"), G_CALLBACK(silcpurple_verify_cb), - _("No"), G_CALLBACK(silcpurple_verify_cb), - _("_View..."), G_CALLBACK(silcpurple_verify_details)); -} - -void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, - const char *name, SilcSocketType conn_type, - unsigned char *pk, SilcUInt32 pk_len, - SilcSKEPKType pk_type, - SilcVerifyPublicKey completion, void *context) -{ - PurpleConnection *gc = client->application; - int i; - char file[256], filename[256], filename2[256], *ipf, *hostf = NULL; - char *fingerprint, *babbleprint; - struct passwd *pw; - struct stat st; - char *entity = ((conn_type == SILC_SOCKET_TYPE_SERVER || - conn_type == SILC_SOCKET_TYPE_ROUTER) ? - "server" : "client"); - PublicKeyVerify verify; - - if (pk_type != SILC_SKE_PK_TYPE_SILC) { - purple_notify_error(gc, _("Verify Public Key"), - _("Unsupported public key type"), NULL); - if (completion) - completion(FALSE, context); - return; - } - - pw = getpwuid(getuid()); - if (!pw) { - if (completion) - completion(FALSE, context); - return; - } - - memset(filename, 0, sizeof(filename)); - memset(filename2, 0, sizeof(filename2)); - memset(file, 0, sizeof(file)); - - if (conn_type == SILC_SOCKET_TYPE_SERVER || - conn_type == SILC_SOCKET_TYPE_ROUTER) { - if (!name) { - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - conn->sock->ip, conn->sock->port); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - conn->sock->hostname, conn->sock->port); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - ipf = filename; - hostf = filename2; - } else { - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - name, conn->sock->port); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - ipf = filename; - } - } else { - /* Replace all whitespaces with `_'. */ - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - - g_snprintf(file, sizeof(file) - 1, "%skey_%s.pub", entity, fingerprint); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - silc_free(fingerprint); - - ipf = filename; - } - - verify = silc_calloc(1, sizeof(*verify)); - if (!verify) - return; - verify->client = client; - verify->conn = conn; - verify->filename = strdup(ipf); - verify->entity = strdup(entity); - verify->entity_name = (conn_type != SILC_SOCKET_TYPE_CLIENT ? - (name ? strdup(name) : strdup(conn->sock->hostname)) - : NULL); - verify->pk = silc_memdup(pk, pk_len); - verify->pk_len = pk_len; - verify->pk_type = pk_type; - verify->completion = completion; - verify->context = context; - fingerprint = verify->fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = verify->babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - /* Check whether this key already exists */ - if (g_stat(ipf, &st) < 0 && (!hostf || g_stat(hostf, &st) < 0)) { - /* Key does not exist, ask user to verify the key and save it */ - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } else { - /* The key already exists, verify it. */ - SilcPublicKey public_key; - unsigned char *encpk; - SilcUInt32 encpk_len; - - /* Load the key file, try for both IP filename and hostname filename */ - if (!silc_pkcs_load_public_key(ipf, &public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(ipf, &public_key, - SILC_PKCS_FILE_BIN) && - (!hostf || (!silc_pkcs_load_public_key(hostf, &public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(hostf, &public_key, - SILC_PKCS_FILE_BIN)))) { - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Encode the key data */ - encpk = silc_pkcs_public_key_encode(public_key, &encpk_len); - if (!encpk) { - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Compare the keys */ - if (memcmp(encpk, pk, encpk_len)) { - /* Ask user to verify the key and save it */ - verify->changed = TRUE; - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Local copy matched */ - if (completion) - completion(TRUE, context); - silc_free(verify->filename); - silc_free(verify->entity); - silc_free(verify->entity_name); - silc_free(verify->pk); - silc_free(verify->fingerprint); - silc_free(verify->babbleprint); - silc_free(verify); - } -} diff --git a/libpurple/protocols/silc10/silc.c b/libpurple/protocols/silc10/silc.c deleted file mode 100644 index 71aa6e667f..0000000000 --- a/libpurple/protocols/silc10/silc.c +++ /dev/null @@ -1,1965 +0,0 @@ -/* - - silcpurple.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "version.h" -#include "wb.h" -#include "core.h" - -extern SilcClientOperations ops; -static PurplePlugin *silc_plugin = NULL; - -static const char * -silcpurple_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return (const char *)"silc"; -} - -static GList * -silcpurple_away_states(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_AVAILABLE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_HYPER, _("Hyper Active"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_AWAY, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, SILCPURPLE_STATUS_ID_BUSY, _("Busy"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_INDISPOSED, _("Indisposed"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_PAGE, _("Wake Me Up"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, SILCPURPLE_STATUS_ID_OFFLINE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - - return types; -} - -static void -silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = NULL; - SilcUInt32 mode; - SilcBuffer idp; - unsigned char mb[4]; - const char *state; - - if (gc != NULL) - sg = gc->proto_data; - - if (status == NULL) - return; - - state = purple_status_get_id(status); - - if (state == NULL) - return; - - if ((sg == NULL) || (sg->conn == NULL)) - return; - - mode = sg->conn->local_entry->mode; - mode &= ~(SILC_UMODE_GONE | - SILC_UMODE_HYPER | - SILC_UMODE_BUSY | - SILC_UMODE_INDISPOSED | - SILC_UMODE_PAGE); - - if (!strcmp(state, "hyper")) - mode |= SILC_UMODE_HYPER; - else if (!strcmp(state, "away")) - mode |= SILC_UMODE_GONE; - else if (!strcmp(state, "busy")) - mode |= SILC_UMODE_BUSY; - else if (!strcmp(state, "indisposed")) - mode |= SILC_UMODE_INDISPOSED; - else if (!strcmp(state, "page")) - mode |= SILC_UMODE_PAGE; - - /* Send UMODE */ - idp = silc_id_payload_encode(sg->conn->local_id, SILC_ID_CLIENT); - SILC_PUT32_MSB(mode, mb); - silc_client_command_send(sg->client, sg->conn, SILC_COMMAND_UMODE, - ++sg->conn->cmd_ident, 2, - 1, idp->data, idp->len, - 2, mb, sizeof(mb)); - silc_buffer_free(idp); -} - - -/*************************** Connection Routines *****************************/ - -static void -silcpurple_keepalive(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - silc_client_send_packet(sg->client, sg->conn, SILC_PACKET_HEARTBEAT, - NULL, 0); -} - -static gboolean -silcpurple_scheduler(gpointer *context) -{ - SilcPurple sg = (SilcPurple)context; - silc_client_run_one(sg->client); - return TRUE; -} - -static void -silcpurple_nickname_parse(const char *nickname, - char **ret_nickname) -{ - silc_parse_userfqdn(nickname, ret_nickname, NULL); -} - -static void -silcpurple_login_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - SilcPurple sg; - SilcClient client; - SilcClientConnection conn; - PurpleAccount *account; - SilcClientConnectionParams params; - SilcUInt32 mask; - const char *dfile, *tmp; -#ifdef SILC_ATTRIBUTE_USER_ICON - PurpleStoredImage *img; -#endif -#ifdef HAVE_SYS_UTSNAME_H - struct utsname u; -#endif - - - g_return_if_fail(gc != NULL); - - sg = gc->proto_data; - - if (source < 0) { - purple_connection_error(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - return; - } - - client = sg->client; - account = sg->account; - - /* Get session detachment data, if available */ - memset(¶ms, 0, sizeof(params)); - dfile = silcpurple_session_file(purple_account_get_username(sg->account)); - params.detach_data = (unsigned char *)silc_file_readfile(dfile, ¶ms.detach_data_len); - if (params.detach_data) - params.detach_data[params.detach_data_len] = 0; - - /* Add connection to SILC client library */ - conn = silc_client_add_connection( - sg->client, ¶ms, - (char *)purple_account_get_string(account, "server", - "silc.silcnet.org"), - purple_account_get_int(account, "port", 706), sg); - if (!conn) { - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to initialize SILC Client connection")); - gc->proto_data = NULL; - return; - } - sg->conn = conn; - - /* Progress */ - if (params.detach_data) { - purple_connection_update_progress(gc, _("Resuming session"), 2, 5); - sg->resuming = TRUE; - } else { - purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5); - } - - /* Perform SILC Key Exchange. The "silc_connected" will be called - eventually. */ - silc_client_start_key_exchange(sg->client, sg->conn, source); - - /* Set default attributes */ - mask = SILC_ATTRIBUTE_MOOD_NORMAL; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - mask = SILC_ATTRIBUTE_CONTACT_CHAT; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); -#ifdef HAVE_SYS_UTSNAME_H - if (!uname(&u)) { - SilcAttributeObjDevice dev; - memset(&dev, 0, sizeof(dev)); - dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; - dev.version = u.release; - dev.model = u.sysname; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, - (void *)&dev, sizeof(dev)); - } -#endif -#ifdef _WIN32 - tmp = _tzname[0]; -#else - tmp = tzname[0]; -#endif - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_TIMEZONE, - (void *)tmp, strlen(tmp)); - -#ifdef SILC_ATTRIBUTE_USER_ICON - /* Set our buddy icon */ - img = purple_buddy_icons_find_account_icon(account); - silcpurple_buddy_set_icon(gc, img); - purple_imgstore_unref(img); -#endif - - silc_free(params.detach_data); -} - -static void -silcpurple_login(PurpleAccount *account) -{ - SilcPurple sg; - SilcClient client; - SilcClientParams params; - PurpleConnection *gc; - char pkd[256], prd[256]; - const char *cipher, *hmac; - char *realname; - int i; - - gc = account->gc; - if (!gc) - return; - gc->proto_data = NULL; - - memset(¶ms, 0, sizeof(params)); - strcat(params.nickname_format, "%n@%h%a"); - params.nickname_parse = silcpurple_nickname_parse; - params.ignore_requested_attributes = FALSE; - - /* Allocate SILC client */ - client = silc_client_alloc(&ops, ¶ms, gc, NULL); - if (!client) { - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Out of memory")); - return; - } - - /* Get username, real name and local hostname for SILC library */ - if (purple_account_get_username(account)) { - const char *u = purple_account_get_username(account); - char **up = g_strsplit(u, "@", 2); - client->username = strdup(up[0]); - g_strfreev(up); - } else { - client->username = silc_get_username(); - purple_account_set_username(account, client->username); - } - realname = silc_get_real_name(); - if (purple_account_get_user_info(account)) { - client->realname = strdup(purple_account_get_user_info(account)); - free(realname); - } else if ((silc_get_real_name() != NULL) && (*realname != '\0')) { - client->realname = realname; - purple_account_set_user_info(account, client->realname); - } else { - free(realname); - client->realname = strdup(_("John Noname")); - } - client->hostname = silc_net_localhost(); - - purple_connection_set_display_name(gc, client->username); - - /* Register requested cipher and HMAC */ - cipher = purple_account_get_string(account, "cipher", SILC_DEFAULT_CIPHER); - for (i = 0; silc_default_ciphers[i].name; i++) - if (!strcmp(silc_default_ciphers[i].name, cipher)) { - silc_cipher_register(&(silc_default_ciphers[i])); - break; - } - hmac = purple_account_get_string(account, "hmac", SILC_DEFAULT_HMAC); - for (i = 0; silc_default_hmacs[i].name; i++) - if (!strcmp(silc_default_hmacs[i].name, hmac)) { - silc_hmac_register(&(silc_default_hmacs[i])); - break; - } - - /* Init SILC client */ - if (!silc_client_init(client)) { - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to initialize SILC protocol")); - return; - } - - /* Check the ~/.silc dir and create it, and new key pair if necessary. */ - if (!silcpurple_check_silc_dir(gc)) { - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Error loading SILC key pair")); - return; - } - - /* Progress */ - purple_connection_update_progress(gc, _("Connecting to SILC Server"), 1, 5); - - /* Load SILC key pair */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), - (char *)purple_account_get_string(account, "private-key", prd), - (gc->password == NULL) ? "" : gc->password, &client->pkcs, - &client->public_key, &client->private_key)) { - g_snprintf(pkd, sizeof(pkd), _("Unable to load SILC key pair: %s"), g_strerror(errno)); - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - pkd); - return; - } - - sg = silc_calloc(1, sizeof(*sg)); - if (!sg) - return; - memset(sg, 0, sizeof(*sg)); - sg->client = client; - sg->gc = gc; - sg->account = account; - gc->proto_data = sg; - - /* Connect to the SILC server */ - if (purple_proxy_connect(gc, account, - purple_account_get_string(account, "server", - "silc.silcnet.org"), - purple_account_get_int(account, "port", 706), - silcpurple_login_connected, gc) == NULL) - { - purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create connection")); - return; - } - - /* Schedule SILC using Glib's event loop */ - sg->scheduler = purple_timeout_add(300, (GSourceFunc)silcpurple_scheduler, sg); -} - -static int -silcpurple_close_final(gpointer *context) -{ - SilcPurple sg = (SilcPurple)context; - silc_client_stop(sg->client); - silc_client_free(sg->client); -#ifdef HAVE_SILCMIME_H - if (sg->mimeass) - silc_mime_assembler_free(sg->mimeass); -#endif - silc_free(sg); - return 0; -} - -static void -silcpurple_close(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - GHashTable *ui_info; - const char *ui_name = NULL, *ui_website = NULL; - char *quit_msg; - - g_return_if_fail(sg != NULL); - - ui_info = purple_core_get_ui_info(); - - if(ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_website = g_hash_table_lookup(ui_info, "website"); - } - - if(!ui_name || !ui_website) { - ui_name = "Pidgin"; - ui_website = PURPLE_WEBSITE; - } - quit_msg = g_strdup_printf(_("Download %s: %s"), - ui_name, ui_website); - - /* Send QUIT */ - silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", quit_msg, NULL); - g_free(quit_msg); - - if (sg->conn) - silc_client_close_connection(sg->client, sg->conn); - - purple_timeout_remove(sg->scheduler); - purple_timeout_add(1, (GSourceFunc)silcpurple_close_final, sg); -} - - -/****************************** Protocol Actions *****************************/ - -static void -silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* Nothing */ -} - -static void -silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestField *f; - char *tmp; - SilcUInt32 tmp_len, mask; - SilcAttributeObjService service; - SilcAttributeObjDevice dev; - SilcVCardStruct vcard; - const char *val; - - sg = gc->proto_data; - if (!sg) - return; - - memset(&service, 0, sizeof(service)); - memset(&dev, 0, sizeof(dev)); - memset(&vcard, 0, sizeof(vcard)); - - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_USER_INFO, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_SERVICE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_FREETEXT, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_MESSAGE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_TIMEZONE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_GEOLOCATION, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, NULL); - - /* Set mood */ - mask = 0; - f = purple_request_fields_get_field(fields, "mood_normal"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_NORMAL; - f = purple_request_fields_get_field(fields, "mood_happy"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_HAPPY; - f = purple_request_fields_get_field(fields, "mood_sad"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_SAD; - f = purple_request_fields_get_field(fields, "mood_angry"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ANGRY; - f = purple_request_fields_get_field(fields, "mood_jealous"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_JEALOUS; - f = purple_request_fields_get_field(fields, "mood_ashamed"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ASHAMED; - f = purple_request_fields_get_field(fields, "mood_invincible"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE; - f = purple_request_fields_get_field(fields, "mood_inlove"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_INLOVE; - f = purple_request_fields_get_field(fields, "mood_sleepy"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_SLEEPY; - f = purple_request_fields_get_field(fields, "mood_bored"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_BORED; - f = purple_request_fields_get_field(fields, "mood_excited"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_EXCITED; - f = purple_request_fields_get_field(fields, "mood_anxious"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - - /* Set preferred contact */ - mask = 0; - f = purple_request_fields_get_field(fields, "contact_chat"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_CHAT; - f = purple_request_fields_get_field(fields, "contact_email"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_EMAIL; - f = purple_request_fields_get_field(fields, "contact_call"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_CALL; - f = purple_request_fields_get_field(fields, "contact_sms"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_SMS; - f = purple_request_fields_get_field(fields, "contact_mms"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_MMS; - f = purple_request_fields_get_field(fields, "contact_video"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_VIDEO; - if (mask) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - - /* Set status text */ - val = NULL; - f = purple_request_fields_get_field(fields, "status_text"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_FREETEXT, - (void *)val, strlen(val)); - - /* Set vcard */ - val = NULL; - f = purple_request_fields_get_field(fields, "vcard"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) { - purple_account_set_string(sg->account, "vcard", val); - tmp = silc_file_readfile(val, &tmp_len); - if (tmp) { - tmp[tmp_len] = 0; - if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard)) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_USER_INFO, - (void *)&vcard, - sizeof(vcard)); - } - silc_vcard_free(&vcard); - silc_free(tmp); - } else { - purple_account_set_string(sg->account, "vcard", ""); - } - -#ifdef HAVE_SYS_UTSNAME_H - /* Set device info */ - f = purple_request_fields_get_field(fields, "device"); - if (f && purple_request_field_bool_get_value(f)) { - struct utsname u; - if (!uname(&u)) { - dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; - dev.version = u.release; - dev.model = u.sysname; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, - (void *)&dev, sizeof(dev)); - } - } -#endif - - /* Set timezone */ - val = NULL; - f = purple_request_fields_get_field(fields, "timezone"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_TIMEZONE, - (void *)val, strlen(val)); -} - -static void -silcpurple_attrs(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - SilcHashTable attrs; - SilcAttributePayload attr; - gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE, - mangry = FALSE, mjealous = FALSE, mashamed = FALSE, - minvincible = FALSE, minlove = FALSE, msleepy = FALSE, - mbored = FALSE, mexcited = FALSE, manxious = FALSE; - gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, - cmms = FALSE, cchat = TRUE, cvideo = FALSE; - gboolean device = TRUE; - char status[1024]; - - sg = gc->proto_data; - if (!sg) - return; - - memset(status, 0, sizeof(status)); - - attrs = silc_client_attributes_get(client, conn); - if (attrs) { - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD), - NULL, (void *)&attr)) { - SilcUInt32 mood = 0; - silc_attribute_get_object(attr, &mood, sizeof(mood)); - mnormal = !mood; - mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY); - msad = (mood & SILC_ATTRIBUTE_MOOD_SAD); - mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY); - mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS); - mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED); - minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE); - minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE); - msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY); - mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED); - mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED); - manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS); - } - - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT), - NULL, (void *)&attr)) { - SilcUInt32 contact = 0; - silc_attribute_get_object(attr, &contact, sizeof(contact)); - cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL); - ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL); - csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS); - cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS); - cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT); - cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO); - } - - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT), - NULL, (void *)&attr)) - silc_attribute_get_object(attr, &status, sizeof(status)); - - if (!silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO), - NULL, (void *)&attr)) - device = FALSE; - } - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_label_new("l3", _("Your Current Mood")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_normal", _("Normal"), mnormal); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_happy", _("Happy"), mhappy); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_sad", _("Sad"), msad); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_angry", _("Angry"), mangry); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_jealous", _("Jealous"), mjealous); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_invincible", _("Invincible"), minvincible); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_inlove", _("In love"), minlove); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_bored", _("Bored"), mbored); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_excited", _("Excited"), mexcited); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_anxious", _("Anxious"), manxious); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_label_new("l4", _("\nYour Preferred Contact Methods")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_chat", _("Chat"), cchat); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_email", _("Email"), cemail); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_call", _("Phone"), ccall); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_sms", _("SMS"), csms); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_mms", _("MMS"), cmms); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_video", _("Video conferencing"), cvideo); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("status_text", _("Your Current Status"), - status[0] ? status : NULL, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); -#if 0 - f = purple_request_field_label_new("l2", _("Online Services")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("services", - _("Let others see what services you are using"), - TRUE); - purple_request_field_group_add_field(g, f); -#endif -#ifdef HAVE_SYS_UTSNAME_H - f = purple_request_field_bool_new("device", - _("Let others see what computer you are using"), - device); - purple_request_field_group_add_field(g, f); -#endif - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("vcard", _("Your VCard File"), - purple_account_get_string(sg->account, "vcard", ""), - FALSE); - purple_request_field_group_add_field(g, f); -#ifdef _WIN32 - f = purple_request_field_string_new("timezone", _("Timezone"), _tzname[0], FALSE); -#else - f = purple_request_field_string_new("timezone", _("Timezone"), tzname[0], FALSE); -#endif - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("User Online Status Attributes"), - _("User Online Status Attributes"), - _("You can let other users see your online status information " - "and your personal information. Please fill the information " - "you would like other users to see about yourself."), - fields, - _("OK"), G_CALLBACK(silcpurple_attrs_cb), - _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), - gc->account, NULL, NULL, gc); -} - -static void -silcpurple_detach(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg; - - if (!gc) - return; - sg = gc->proto_data; - if (!sg) - return; - - /* Call DETACH */ - silc_client_command_call(sg->client, sg->conn, "DETACH"); - sg->detaching = TRUE; -} - -static void -silcpurple_view_motd(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg; - char *tmp; - - if (!gc) - return; - sg = gc->proto_data; - if (!sg) - return; - - if (!sg->motd) { - purple_notify_error( - gc, _("Message of the Day"), _("No Message of the Day available"), - _("There is no Message of the Day associated with this connection")); - return; - } - - tmp = g_markup_escape_text(sg->motd, -1); - purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, - tmp, NULL, NULL); - g_free(tmp); -} - -static void -silcpurple_create_keypair_cancel(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* Nothing */ -} - -static void -silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = gc->proto_data; - PurpleRequestField *f; - const char *val, *pkfile = NULL, *prfile = NULL; - const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL; - const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; - char *identifier; - int keylen = SILCPURPLE_DEF_PKCS_LEN; - SilcPublicKey public_key; - - sg = gc->proto_data; - if (!sg) - return; - - val = NULL; - f = purple_request_fields_get_field(fields, "pass1"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - pass1 = val; - else - pass1 = ""; - val = NULL; - f = purple_request_fields_get_field(fields, "pass2"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - pass2 = val; - else - pass2 = ""; - - if (strcmp(pass1, pass2)) { - purple_notify_error( - gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL); - return; - } - - val = NULL; - f = purple_request_fields_get_field(fields, "key"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - keylen = atoi(val); - f = purple_request_fields_get_field(fields, "pkfile"); - if (f) - pkfile = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "prfile"); - if (f) - prfile = purple_request_field_string_get_value(f); - - f = purple_request_fields_get_field(fields, "un"); - if (f) - un = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "hn"); - if (f) - hn = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "rn"); - if (f) - rn = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "e"); - if (f) - e = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "o"); - if (f) - o = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "c"); - if (f) - c = purple_request_field_string_get_value(f); - - identifier = silc_pkcs_encode_identifier((char *)un, (char *)hn, - (char *)rn, (char *)e, (char *)o, (char *)c); - - /* Create the key pair */ - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, keylen, pkfile, prfile, - identifier, pass1, NULL, &public_key, NULL, - FALSE)) { - purple_notify_error( - gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL); - return; - } - - silcpurple_show_public_key(sg, NULL, public_key, NULL, NULL); - - silc_pkcs_public_key_free(public_key); - silc_free(identifier); -} - -static void -silcpurple_create_keypair(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - const char *username, *realname; - char *hostname, **u; - char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256]; - - username = purple_account_get_username(sg->account); - u = g_strsplit(username, "@", 2); - username = u[0]; - realname = purple_account_get_user_info(sg->account); - hostname = silc_net_localhost(); - g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); - - g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); - g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); - g_snprintf(pkd, sizeof(pkd) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd2)); - g_snprintf(prd, sizeof(prd) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd2)); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("pkfile", _("Public key file"), pkd, FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("prfile", _("Private key file"), prd, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("un", _("Username"), username ? username : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("rn", _("Real name"), realname ? realname : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("e", _("Email"), tmp, FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("o", _("Organization"), "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("c", _("Country"), "", FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("pass1", _("Passphrase"), "", FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("pass2", _("Passphrase (retype)"), "", FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("Create New SILC Key Pair"), - _("Create New SILC Key Pair"), NULL, fields, - _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), - _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), - gc->account, NULL, NULL, gc); - - g_strfreev(u); - silc_free(hostname); -} - -static void -silcpurple_change_pass(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_password(purple_connection_get_account(gc)); -} - -static void -silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) -{ - char prd[256]; - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); - silc_change_private_key_passphrase(purple_account_get_string(gc->account, - "private-key", - prd), old ? old : "", new ? new : ""); -} - -static void -silcpurple_show_set_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_user_info(purple_connection_get_account(gc)); -} - -static void -silcpurple_set_info(PurpleConnection *gc, const char *text) -{ -} - -static GList * -silcpurple_actions(PurplePlugin *plugin, gpointer context) -{ - GList *list = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Online Status"), - silcpurple_attrs); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Detach From Server"), - silcpurple_detach); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("View Message of the Day"), - silcpurple_view_motd); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Create SILC Key Pair..."), - silcpurple_create_keypair); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Change Password..."), - silcpurple_change_pass); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Set User Info..."), - silcpurple_show_set_info); - list = g_list_append(list, act); - - return list; -} - - -/******************************* IM Routines *********************************/ - -typedef struct { - char *nick; - char *message; - SilcUInt32 message_len; - SilcMessageFlags flags; - PurpleMessageFlags gflags; -} *SilcPurpleIM; - -static void -silcpurple_send_im_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleIM im = context; - PurpleConversation *convo; - char tmp[256], *nickname = NULL; - SilcClientEntry client_entry; -#ifdef HAVE_SILCMIME_H - SilcDList list; -#endif - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->nick, - sg->account); - if (!convo) - return; - - if (!clients) - goto err; - - if (clients_count > 1) { - silc_parse_userfqdn(im->nick, &nickname, NULL); - - /* Find the correct one. The im->nick might be a formatted nick - so this will find the correct one. */ - clients = silc_client_get_clients_local(client, conn, - nickname, im->nick, - &clients_count); - if (!clients) - goto err; - client_entry = clients[0]; - silc_free(clients); - } else { - client_entry = clients[0]; - } - -#ifdef HAVE_SILCMIME_H - /* Check for images */ - if (im->gflags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(im->message, (SilcUInt32 *)&im->flags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - silc_client_send_private_message(client, conn, - client_entry, im->flags, - buf->data, buf->len, - TRUE); - silc_mime_partial_free(list); - purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, - im->message, 0, time(NULL)); - goto out; - } - } -#endif - - /* Send the message */ - silc_client_send_private_message(client, conn, client_entry, im->flags, - (unsigned char *)im->message, im->message_len, TRUE); - purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, - im->message, 0, time(NULL)); - goto out; - - err: - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), im->nick); - purple_conversation_write(convo, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - - out: - g_free(im->nick); - g_free(im->message); - silc_free(im); - silc_free(nickname); -} - -static int -silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, - PurpleMessageFlags flags) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry *clients; - SilcUInt32 clients_count, mflags; - char *nickname, *msg, *tmp; - int ret = 0; - gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); -#ifdef HAVE_SILCMIME_H - SilcDList list; -#endif - - if (!who || !message) - return 0; - - mflags = SILC_MESSAGE_FLAG_UTF8; - - tmp = msg = purple_unescape_html(message); - - if (!g_ascii_strncasecmp(msg, "/me ", 4)) { - msg += 4; - if (!*msg) { - g_free(tmp); - return 0; - } - mflags |= SILC_MESSAGE_FLAG_ACTION; - } else if (strlen(msg) > 1 && msg[0] == '/') { - if (!silc_client_command_call(client, conn, msg + 1)) - purple_notify_error(gc, _("Call Command"), _("Cannot call command"), - _("Unknown command")); - g_free(tmp); - return 0; - } - - - if (!silc_parse_userfqdn(who, &nickname, NULL)) { - g_free(tmp); - return 0; - } - - if (sign) - mflags |= SILC_MESSAGE_FLAG_SIGNED; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, nickname, who, - &clients_count); - if (!clients) { - /* Resolve unknown user */ - SilcPurpleIM im = silc_calloc(1, sizeof(*im)); - if (!im) { - g_free(tmp); - return 0; - } - im->nick = g_strdup(who); - im->message = g_strdup(message); - im->message_len = strlen(im->message); - im->flags = mflags; - im->gflags = flags; - silc_client_get_clients(client, conn, nickname, NULL, - silcpurple_send_im_resolved, im); - silc_free(nickname); - g_free(tmp); - return 0; - } - -#ifdef HAVE_SILCMIME_H - /* Check for images */ - if (flags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(message, &mflags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - ret = - silc_client_send_private_message(client, conn, - clients[0], mflags, - buf->data, buf->len, - TRUE); - silc_mime_partial_free(list); - g_free(tmp); - silc_free(nickname); - silc_free(clients); - return ret; - } - } -#endif - - /* Send private message directly */ - ret = silc_client_send_private_message(client, conn, clients[0], - mflags, - (unsigned char *)msg, - strlen(msg), TRUE); - - g_free(tmp); - silc_free(nickname); - silc_free(clients); - return ret; -} - - -static GList *silcpurple_blist_node_menu(PurpleBlistNode *node) { - /* split this single menu building function back into the two - original: one for buddies and one for chats */ - - if(PURPLE_BLIST_NODE_IS_CHAT(node)) { - return silcpurple_chat_menu((PurpleChat *) node); - } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return silcpurple_buddy_menu((PurpleBuddy *) node); - } else { - g_return_val_if_reached(NULL); - } -} - -/********************************* Commands **********************************/ - -static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - PurpleConversation *convo = conv; - int id = 0; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - if(args && args[0]) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], - gc->account); - - if (convo != NULL) - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); - - if (id == 0) - return PURPLE_CMD_RET_FAILED; - - silcpurple_chat_leave(gc, id); - - return PURPLE_CMD_RET_OK; - -} - -static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - int id = 0; - char *buf, *tmp, *tmp2; - const char *topic; - - gc = purple_conversation_get_gc(conv); - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - - if (gc == NULL || id == 0) - return PURPLE_CMD_RET_FAILED; - - if (!args || !args[0]) { - topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(conv)); - if (topic) { - tmp = g_markup_escape_text(topic, -1); - tmp2 = purple_markup_linkify(tmp); - buf = g_strdup_printf(_("current topic is: %s"), tmp2); - g_free(tmp); - g_free(tmp2); - } else - buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - - } - - if (args && args[0] && (strlen(args[0]) > 255)) { - *error = g_strdup(_("Topic too long")); - return PURPLE_CMD_RET_FAILED; - } - - silcpurple_chat_set_topic(gc, id, args ? args[0] : NULL); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - GHashTable *comp; - - if(!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - g_hash_table_replace(comp, "channel", args[0]); - if(args[1]) - g_hash_table_replace(comp, "passphrase", args[1]); - - silcpurple_chat_join(purple_conversation_get_gc(conv), comp); - - g_hash_table_destroy(comp); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); - purple_roomlist_show_with_account(purple_connection_get_account(gc)); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - silcpurple_get_info(gc, args[0]); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - int ret; - PurpleConnection *gc; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); - - if (ret) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - int ret = 1; - PurpleConversation *convo; - PurpleConnection *gc; - PurpleAccount *account; - - if (!args || !args[0]) { - *error = g_strdup(_("You must specify a nick")); - return PURPLE_CMD_RET_FAILED; - } - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - account = purple_connection_get_account(gc); - - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, args[0]); - - if (args[1]) { - ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); - purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), - args[1], PURPLE_MESSAGE_SEND, time(NULL)); - } - - if (ret) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - char *tmp; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - if (!sg->motd) { - *error = g_strdup(_("There is no Message of the Day associated with this connection")); - return PURPLE_CMD_RET_FAILED; - } - - tmp = g_markup_escape_text(sg->motd, -1); - purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, - tmp, NULL, NULL); - g_free(tmp); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - silc_client_command_call(sg->client, sg->conn, "DETACH"); - sg->detaching = TRUE; - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - SilcChannelEntry channel; - char *silccmd, *silcargs, *msg, tmp[256]; - const char *chname; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL || !args || gc->proto_data == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (args[0]) - chname = args[0]; - else - chname = purple_conversation_get_name(conv); - - if (!args[1]) { - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (!channel) { - *error = g_strdup_printf(_("channel %s not found"), chname); - return PURPLE_CMD_RET_FAILED; - } - if (channel->mode) { - silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); - msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp); - } else { - msg = g_strdup_printf(_("no channel modes are set on %s"), chname); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "", - msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(msg); - return PURPLE_CMD_RET_OK; - } - - silcargs = g_strjoinv(" ", args); - silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); - g_free(silcargs); - if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { - g_free(silccmd); - *error = g_strdup_printf(_("Failed to set cmodes for %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - g_free(silccmd); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - char *silccmd, *silcargs; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - silcargs = g_strjoinv(" ", args); - silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); - g_free(silcargs); - if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { - g_free(silccmd); - *error = g_strdup_printf(_("Unknown command: %s, (may be a client bug)"), cmd); - return PURPLE_CMD_RET_FAILED; - } - g_free(silccmd); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - GHashTable *ui_info; - const char *ui_name = NULL, *ui_website = NULL; - char *quit_msg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - ui_info = purple_core_get_ui_info(); - - if(ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_website = g_hash_table_lookup(ui_info, "website"); - } - - if(!ui_name || !ui_website) { - ui_name = "Pidgin"; - ui_website = PURPLE_WEBSITE; - } - quit_msg = g_strdup_printf(_("Download %s: %s"), - ui_name, ui_website); - - silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", (args && args[0]) ? args[0] : quit_msg, NULL); - g_free(quit_msg); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - if (!silc_client_command_call(sg->client, sg->conn, args[0])) { - *error = g_strdup_printf(_("Unknown command: %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - - -/************************** Plugin Initialization ****************************/ - -static void -silcpurple_register_commands(void) -{ - purple_cmd_register("part", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_part, _("part [channel]: Leave the chat"), NULL); - purple_cmd_register("leave", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL); - purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", - silcpurple_cmd_chat_topic, _("topic [<new topic>]: View or change the topic"), NULL); - purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_join, - _("join <channel> [<password>]: Join a chat on this network"), NULL); - purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", - silcpurple_cmd_chat_list, _("list: List channels on this network"), NULL); - purple_cmd_register("whois", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", - silcpurple_cmd_whois, _("whois <nick>: View nick's information"), NULL); - purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_msg, - _("msg <nick> <message>: Send a private message to a user"), NULL); - purple_cmd_register("query", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_query, - _("query <nick> [<message>]: Send a private message to a user"), NULL); - purple_cmd_register("motd", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_motd, - _("motd: View the server's Message Of The Day"), NULL); - purple_cmd_register("detach", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_detach, - _("detach: Detach this session"), NULL); - purple_cmd_register("quit", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_quit, - _("quit [message]: Disconnect from the server, with an optional message"), NULL); - purple_cmd_register("call", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_call, - _("call <command>: Call any silc client command"), NULL); - /* These below just get passed through for the silc client library to deal - * with */ - purple_cmd_register("kill", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("kill <nick> [-pubkey|<reason>]: Kill nick"), NULL); - purple_cmd_register("nick", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("nick <newnick>: Change your nickname"), NULL); - purple_cmd_register("whowas", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("whowas <nick>: View nick's information"), NULL); - purple_cmd_register("cmode", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_cmode, - _("cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes"), NULL); - purple_cmd_register("cumode", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("cumode <channel> +|-<modes> <nick>: Change nick's modes on channel"), NULL); - purple_cmd_register("umode", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("umode <usermodes>: Set your modes in the network"), NULL); - purple_cmd_register("oper", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("oper <nick> [-pubkey]: Get server operator privileges"), NULL); - purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("invite <channel> [-|+]<nick>: invite nick or add/remove from channel invite list"), NULL); - purple_cmd_register("kick", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("kick <channel> <nick> [comment]: Kick client from channel"), NULL); - purple_cmd_register("info", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("info [server]: View server administrative details"), NULL); - purple_cmd_register("ban", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("ban [<channel> +|-<nick>]: Ban client from channel"), NULL); - purple_cmd_register("getkey", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("getkey <nick|server>: Retrieve client's or server's public key"), NULL); - purple_cmd_register("stats", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("stats: View server and network statistics"), NULL); - purple_cmd_register("ping", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("ping: Send PING to the connected server"), NULL); -#if 0 /* Purple doesn't handle these yet */ - purple_cmd_register("users", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_users, - _("users <channel>: List users in channel")); - purple_cmd_register("names", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_names, - _("names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)")); -#endif -} - -static PurpleWhiteboardPrplOps silcpurple_wb_ops = -{ - silcpurple_wb_start, - silcpurple_wb_end, - silcpurple_wb_get_dimensions, - silcpurple_wb_set_dimensions, - silcpurple_wb_get_brush, - silcpurple_wb_set_brush, - silcpurple_wb_send, - silcpurple_wb_clear, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginProtocolInfo prpl_info = -{ -#ifdef HAVE_SILCMIME_H - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | - OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE | - OPT_PROTO_SLASH_COMMANDS_NATIVE, -#else - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | - OPT_PROTO_PASSWORD_OPTIONAL | - OPT_PROTO_SLASH_COMMANDS_NATIVE, -#endif - NULL, /* user_splits */ - NULL, /* protocol_options */ -#ifdef SILC_ATTRIBUTE_USER_ICON - {"jpeg,gif,png,bmp", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ -#else - NO_BUDDY_ICONS, -#endif - silcpurple_list_icon, /* list_icon */ - NULL, /* list_emblems */ - silcpurple_status_text, /* status_text */ - silcpurple_tooltip_text, /* tooltip_text */ - silcpurple_away_states, /* away_states */ - silcpurple_blist_node_menu, /* blist_node_menu */ - silcpurple_chat_info, /* chat_info */ - silcpurple_chat_info_defaults,/* chat_info_defaults */ - silcpurple_login, /* login */ - silcpurple_close, /* close */ - silcpurple_send_im, /* send_im */ - silcpurple_set_info, /* set_info */ - NULL, /* send_typing */ - silcpurple_get_info, /* get_info */ - silcpurple_set_status, /* set_status */ - silcpurple_idle_set, /* set_idle */ - silcpurple_change_passwd, /* change_passwd */ - silcpurple_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - silcpurple_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - silcpurple_chat_join, /* join_chat */ - NULL, /* reject_chat */ - silcpurple_get_chat_name, /* get_chat_name */ - silcpurple_chat_invite, /* chat_invite */ - silcpurple_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - silcpurple_chat_send, /* chat_send */ - silcpurple_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ -#ifdef SILC_ATTRIBUTE_USER_ICON - silcpurple_buddy_set_icon, /* set_buddy_icon */ -#else - NULL, -#endif - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - silcpurple_chat_set_topic, /* set_chat_topic */ - NULL, /* find_blist_chat */ - silcpurple_roomlist_get_list, /* roomlist_get_list */ - silcpurple_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - silcpurple_ftp_send_file, /* send_file */ - silcpurple_ftp_new_xfer, /* new_xfer */ - NULL, /* offline_message */ - &silcpurple_wb_ops, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL, /* get_media_caps */ - NULL, /* get_moods */ - NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-silc", /**< id */ - "SILC", /**< name */ - "1.0", /**< version */ - /** summary */ - N_("SILC Protocol Plugin"), - /** description */ - N_("Secure Internet Live Conferencing (SILC) Protocol"), - "Pekka Riikonen", /**< author */ - "http://silcnet.org/", /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - silcpurple_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - PurpleAccountUserSplit *split; - char tmp[256]; - int i; - PurpleKeyValuePair *kvp; - GList *list = NULL; - - silc_plugin = plugin; - - split = purple_account_user_split_new(_("Network"), "silcnet.org", '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - /* Account options */ - option = purple_account_option_string_new(_("Connect server"), - "server", - "silc.silcnet.org"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_int_new(_("Port"), "port", 706); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - option = purple_account_option_string_new(_("Public Key file"), - "public-key", tmp); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - option = purple_account_option_string_new(_("Private Key file"), - "private-key", tmp); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - for (i = 0; silc_default_ciphers[i].name; i++) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(silc_default_ciphers[i].name); - kvp->value = g_strdup(silc_default_ciphers[i].name); - list = g_list_append(list, kvp); - } - option = purple_account_option_list_new(_("Cipher"), "cipher", list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - list = NULL; - for (i = 0; silc_default_hmacs[i].name; i++) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(silc_default_hmacs[i].name); - kvp->value = g_strdup(silc_default_hmacs[i].name); - list = g_list_append(list, kvp); - } - option = purple_account_option_list_new(_("HMAC"), "hmac", list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Public key authentication"), - "pubkey-auth", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Block IMs without Key Exchange"), - "block-ims", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Block messages to whiteboard"), - "block-wb", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Automatically open whiteboard"), - "open-wb", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Digitally sign and verify all messages"), - "sign-verify", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - purple_prefs_remove("/plugins/prpl/silc"); - - silcpurple_register_commands(); - -#ifdef _WIN32 - silc_net_win32_init(); -#endif -} - -PURPLE_INIT_PLUGIN(silc10, init_plugin, info); diff --git a/libpurple/protocols/silc10/silcpurple.h b/libpurple/protocols/silc10/silcpurple.h deleted file mode 100644 index a24d8a0b9d..0000000000 --- a/libpurple/protocols/silc10/silcpurple.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - - silcpurple.h - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef SILCPURPLE_H -#define SILCPURPLE_H - -/* Purple includes */ -#include "internal.h" -#include "account.h" -#include "accountopt.h" -#include "cmds.h" -#include "conversation.h" -#include "debug.h" -#include "ft.h" -#include "notify.h" -#include "prpl.h" -#include "request.h" -#include "roomlist.h" -#include "server.h" -#include "util.h" - -/* Default public and private key file names */ -#define SILCPURPLE_PUBLIC_KEY_NAME "public_key.pub" -#define SILCPURPLE_PRIVATE_KEY_NAME "private_key.prv" - -/* Default settings for creating key pair */ -#define SILCPURPLE_DEF_PKCS "rsa" -#define SILCPURPLE_DEF_PKCS_LEN 2048 - -#define SILCPURPLE_PRVGRP 0x001fffff - -/* Status IDs */ -#define SILCPURPLE_STATUS_ID_OFFLINE "offline" -#define SILCPURPLE_STATUS_ID_AVAILABLE "available" -#define SILCPURPLE_STATUS_ID_HYPER "hyper" -#define SILCPURPLE_STATUS_ID_AWAY "away" -#define SILCPURPLE_STATUS_ID_BUSY "busy" -#define SILCPURPLE_STATUS_ID_INDISPOSED "indisposed" -#define SILCPURPLE_STATUS_ID_PAGE "page" - -typedef struct { - unsigned long id; - const char *channel; - unsigned long chid; - const char *parentch; - SilcChannelPrivateKey key; -} *SilcPurplePrvgrp; - -/* The SILC Purple plugin context */ -typedef struct SilcPurpleStruct { - SilcClient client; - SilcClientConnection conn; - - guint scheduler; - PurpleConnection *gc; - PurpleAccount *account; - unsigned long channel_ids; - GList *grps; - - char *motd; - PurpleRoomlist *roomlist; -#ifdef HAVE_SILCMIME_H - SilcMimeAssembler mimeass; -#endif - unsigned int detaching : 1; - unsigned int resuming : 1; - unsigned int roomlist_cancelled : 1; - unsigned int chpk : 1; -} *SilcPurple; - - -gboolean silcpurple_check_silc_dir(PurpleConnection *gc); -void silcpurple_chat_join_done(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context); -const char *silcpurple_silcdir(void); -const char *silcpurple_session_file(const char *account); -void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, - const char *name, SilcSocketType conn_type, - unsigned char *pk, SilcUInt32 pk_len, - SilcSKEPKType pk_type, - SilcVerifyPublicKey completion, void *context); -GList *silcpurple_buddy_menu(PurpleBuddy *buddy); -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void silcpurple_send_buddylist(PurpleConnection *gc); -void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void silcpurple_buddy_keyagr_request(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 port); -void silcpurple_idle_set(PurpleConnection *gc, int idle); -void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -char *silcpurple_status_text(PurpleBuddy *b); -gboolean silcpurple_ip_is_private(const char *ip); -void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file); -PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name); -void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port); -void silcpurple_show_public_key(SilcPurple sg, - const char *name, SilcPublicKey public_key, - GCallback callback, void *context); -void silcpurple_get_info(PurpleConnection *gc, const char *who); -SilcAttributePayload -silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute); -void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -GList *silcpurple_chat_info(PurpleConnection *gc); -GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name); -GList *silcpurple_chat_menu(PurpleChat *); -void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data); -char *silcpurple_get_chat_name(GHashTable *data); -void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name); -void silcpurple_chat_leave(PurpleConnection *gc, int id); -int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags flags); -void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic); -PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc); -void silcpurple_roomlist_cancel(PurpleRoomlist *list); -void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, - SilcBuffer channel_pubkeys); -void silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, - char **contactstr, char **langstr, char **devicestr, - char **tzstr, char **geostr); -#ifdef SILC_ATTRIBUTE_USER_ICON -void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img); -#endif -#ifdef HAVE_SILCMIME_H -char *silcpurple_file2mime(const char *filename); -SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags); -#endif - -#ifdef _WIN32 -typedef int uid_t; - -struct passwd { - char *pw_name; /* user name */ - char *pw_passwd; /* user password */ - int pw_uid; /* user id */ - int pw_gid; /* group id */ - char *pw_gecos; /* real name */ - char *pw_dir; /* home directory */ - char *pw_shell; /* shell program */ -}; - -struct passwd *getpwuid(int uid); -int getuid(void); -int geteuid(void); -#endif - -#endif /* SILCPURPLE_H */ diff --git a/libpurple/protocols/silc10/util.c b/libpurple/protocols/silc10/util.c deleted file mode 100644 index 792afdea58..0000000000 --- a/libpurple/protocols/silc10/util.c +++ /dev/null @@ -1,776 +0,0 @@ -/* - - silcpurple_util.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "imgstore.h" - -/**************************** Utility Routines *******************************/ - -static char str[256], str2[256]; - -const char *silcpurple_silcdir(void) -{ - const char *hd = purple_home_dir(); - memset(str, 0, sizeof(str)); - g_snprintf(str, sizeof(str) - 1, "%s" G_DIR_SEPARATOR_S ".silc", hd ? hd : "/tmp"); - return (const char *)str; -} - -const char *silcpurple_session_file(const char *account) -{ - memset(str2, 0, sizeof(str2)); - g_snprintf(str2, sizeof(str2) - 1, "%s" G_DIR_SEPARATOR_S "%s_session", - silcpurple_silcdir(), account); - return (const char *)str2; -} - -gboolean silcpurple_ip_is_private(const char *ip) -{ - if (silc_net_is_ip4(ip)) { - if (!strncmp(ip, "10.", 3)) { - return TRUE; - } else if (!strncmp(ip, "172.", 4) && strlen(ip) > 6) { - char tmp[3]; - int s; - memset(tmp, 0, sizeof(tmp)); - strncpy(tmp, ip + 4, 2); - s = atoi(tmp); - if (s >= 16 && s <= 31) - return TRUE; - } else if (!strncmp(ip, "192.168.", 8)) { - return TRUE; - } - } - - return FALSE; -} - -/* This checks stats for various SILC files and directories. First it - checks if ~/.silc directory exist and is owned by the correct user. If - it doesn't exist, it will create the directory. After that it checks if - user's Public and Private key files exists and creates them if needed. */ - -gboolean silcpurple_check_silc_dir(PurpleConnection *gc) -{ - char filename[256], file_public_key[256], file_private_key[256]; - char servfilename[256], clientfilename[256], friendsfilename[256]; - char pkd[256], prd[256]; - struct stat st; - struct passwd *pw; - int fd; - - pw = getpwuid(getuid()); - if (!pw) { - purple_debug_error("silc", "silc: %s\n", g_strerror(errno)); - return FALSE; - } - - g_snprintf(filename, sizeof(filename) - 1, "%s", silcpurple_silcdir()); - g_snprintf(servfilename, sizeof(servfilename) - 1, "%s" G_DIR_SEPARATOR_S "serverkeys", - silcpurple_silcdir()); - g_snprintf(clientfilename, sizeof(clientfilename) - 1, "%s" G_DIR_SEPARATOR_S "clientkeys", - silcpurple_silcdir()); - g_snprintf(friendsfilename, sizeof(friendsfilename) - 1, "%s" G_DIR_SEPARATOR_S "friends", - silcpurple_silcdir()); - - /* - * Check ~/.silc directory - */ - if ((g_stat(filename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(filename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", filename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - filename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", filename, g_strerror(errno)); - return FALSE; - } - } else { -#ifndef _WIN32 - /* Check the owner of the dir */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own '%s' directory\n", - filename); - return FALSE; - } -#endif - } - - /* - * Check ~./silc/serverkeys directory - */ - if ((g_stat(servfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(servfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", servfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - servfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - servfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check ~./silc/clientkeys directory - */ - if ((g_stat(clientfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(clientfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", clientfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - clientfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - clientfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check ~./silc/friends directory - */ - if ((g_stat(friendsfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(friendsfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", friendsfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - friendsfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - friendsfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check Public and Private keys - */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd)); - g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd)); - - if ((g_stat(file_public_key, &st)) == -1) { - /* If file doesn't exist */ - if (errno == ENOENT) { - purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, - SILCPURPLE_DEF_PKCS_LEN, - file_public_key, file_private_key, NULL, - (gc->password == NULL) ? "" : gc->password, - NULL, NULL, NULL, FALSE)) { - purple_debug_error("silc", "Couldn't create key pair\n"); - return FALSE; - } - - if ((g_stat(file_public_key, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n", - file_public_key, g_strerror(errno)); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n", - file_public_key, g_strerror(errno)); - return FALSE; - } - } - -#ifndef _WIN32 - /* Check the owner of the public key */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own your public key!?\n"); - return FALSE; - } -#endif - - if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { - if ((fstat(fd, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - close(fd); - return FALSE; - } - } else if ((g_stat(file_private_key, &st)) == -1) { - /* If file doesn't exist */ - if (errno == ENOENT) { - purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, - SILCPURPLE_DEF_PKCS_LEN, - file_public_key, file_private_key, NULL, - (gc->password == NULL) ? "" : gc->password, - NULL, NULL, NULL, FALSE)) { - purple_debug_error("silc", "Couldn't create key pair\n"); - return FALSE; - } - - if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { - if ((fstat(fd, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - close(fd); - return FALSE; - } - } - /* This shouldn't really happen because silc_create_key_pair() - * will set the permissions */ - else if ((g_stat(file_private_key, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - return FALSE; - } - } - -#ifndef _WIN32 - /* Check the owner of the private key */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own your private key!?\n"); - if (fd != -1) - close(fd); - return FALSE; - } - - /* Check the permissions for the private key */ - if ((st.st_mode & 0777) != 0600) { - purple_debug_warning("silc", "Wrong permissions in your private key file `%s'!\n" - "Trying to change them ...\n", file_private_key); - if ((fd == -1) || (fchmod(fd, S_IRUSR | S_IWUSR)) == -1) { - purple_debug_error("silc", - "Failed to change permissions for private key file!\n" - "Permissions for your private key file must be 0600.\n"); - if (fd != -1) - close(fd); - return FALSE; - } - purple_debug_warning("silc", "Done.\n\n"); - } -#endif - - if (fd != -1) - close(fd); - - return TRUE; -} - -#ifdef _WIN32 -struct passwd *getpwuid(uid_t uid) { - struct passwd *pwd = calloc(1, sizeof(struct passwd)); - return pwd; -} - -uid_t getuid() { - return 0; -} - -uid_t geteuid() { - return 0; -} -#endif - -void silcpurple_show_public_key(SilcPurple sg, - const char *name, SilcPublicKey public_key, - GCallback callback, void *context) -{ - SilcPublicKeyIdentifier ident; - SilcPKCS pkcs; - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len, key_len = 0; - GString *s; - char *buf; - - ident = silc_pkcs_decode_identifier(public_key->identifier); - if (!ident) - return; - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - if (silc_pkcs_alloc((unsigned char *)public_key->name, &pkcs)) { - key_len = silc_pkcs_public_key_set(pkcs, public_key); - silc_pkcs_free(pkcs); - } - - s = g_string_new(""); - if (ident->realname) - /* Hint for translators: Please check the tabulator width here and in - the next strings (short strings: 2 tabs, longer strings 1 tab, - sum: 3 tabs or 24 characters) */ - g_string_append_printf(s, _("Real Name: \t%s\n"), ident->realname); - if (ident->username) - g_string_append_printf(s, _("User Name: \t%s\n"), ident->username); - if (ident->email) - g_string_append_printf(s, _("Email: \t\t%s\n"), ident->email); - if (ident->host) - g_string_append_printf(s, _("Host Name: \t%s\n"), ident->host); - if (ident->org) - g_string_append_printf(s, _("Organization: \t%s\n"), ident->org); - if (ident->country) - g_string_append_printf(s, _("Country: \t%s\n"), ident->country); - g_string_append_printf(s, _("Algorithm: \t%s\n"), public_key->name); - g_string_append_printf(s, _("Key Length: \t%d bits\n"), (int)key_len); - g_string_append_printf(s, "\n"); - g_string_append_printf(s, _("Public Key Fingerprint:\n%s\n\n"), fingerprint); - g_string_append_printf(s, _("Public Key Babbleprint:\n%s"), babbleprint); - - buf = g_string_free(s, FALSE); - - purple_request_action(sg->gc, _("Public Key Information"), - _("Public Key Information"), - buf, 0, purple_connection_get_account(sg->gc), - NULL, NULL, context, 1, _("Close"), callback); - - g_free(buf); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - silc_pkcs_free_identifier(ident); -} - -SilcAttributePayload -silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute) -{ - SilcAttributePayload attr = NULL; - - if (!attrs) - return NULL; - - silc_dlist_start(attrs); - while ((attr = silc_dlist_get(attrs)) != SILC_LIST_END) - if (attribute == silc_attribute_get_attribute(attr)) - break; - - return attr; -} - -void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if ((mode & SILC_UMODE_SERVER_OPERATOR) || - (mode & SILC_UMODE_ROUTER_OPERATOR)) { - strcat(buf, (mode & SILC_UMODE_SERVER_OPERATOR) ? - "[server operator] " : - (mode & SILC_UMODE_ROUTER_OPERATOR) ? - "[SILC operator] " : "[unknown mode] "); - } - if (mode & SILC_UMODE_GONE) - strcat(buf, "[away] "); - if (mode & SILC_UMODE_INDISPOSED) - strcat(buf, "[indisposed] "); - if (mode & SILC_UMODE_BUSY) - strcat(buf, "[busy] "); - if (mode & SILC_UMODE_PAGE) - strcat(buf, "[wake me up] "); - if (mode & SILC_UMODE_HYPER) - strcat(buf, "[hyperactive] "); - if (mode & SILC_UMODE_ROBOT) - strcat(buf, "[robot] "); - if (mode & SILC_UMODE_ANONYMOUS) - strcat(buf, "[anonymous] "); - if (mode & SILC_UMODE_BLOCK_PRIVMSG) - strcat(buf, "[blocks private messages] "); - if (mode & SILC_UMODE_DETACHED) - strcat(buf, "[detached] "); - if (mode & SILC_UMODE_REJECT_WATCHING) - strcat(buf, "[rejects watching] "); - if (mode & SILC_UMODE_BLOCK_INVITE) - strcat(buf, "[blocks invites] "); - g_strchomp(buf); -} - -void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if (mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) - strcat(buf, "[permanent] "); - if (mode & SILC_CHANNEL_MODE_PRIVATE) - strcat(buf, "[private] "); - if (mode & SILC_CHANNEL_MODE_SECRET) - strcat(buf, "[secret] "); - if (mode & SILC_CHANNEL_MODE_PRIVKEY) - strcat(buf, "[private key] "); - if (mode & SILC_CHANNEL_MODE_INVITE) - strcat(buf, "[invite only] "); - if (mode & SILC_CHANNEL_MODE_TOPIC) - strcat(buf, "[topic restricted] "); - if (mode & SILC_CHANNEL_MODE_ULIMIT) - strcat(buf, "[user count limit] "); - if (mode & SILC_CHANNEL_MODE_PASSPHRASE) - strcat(buf, "[passphrase auth] "); - if (mode & SILC_CHANNEL_MODE_CHANNEL_AUTH) - strcat(buf, "[public key auth] "); - if (mode & SILC_CHANNEL_MODE_SILENCE_USERS) - strcat(buf, "[users silenced] "); - if (mode & SILC_CHANNEL_MODE_SILENCE_OPERS) - strcat(buf, "[operators silenced] "); - g_strchomp(buf); -} - -void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if (mode & SILC_CHANNEL_UMODE_CHANFO) - strcat(buf, "[founder] "); - if (mode & SILC_CHANNEL_UMODE_CHANOP) - strcat(buf, "[operator] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES) - strcat(buf, "[blocks messages] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_USERS) - strcat(buf, "[blocks user messages] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_ROBOTS) - strcat(buf, "[blocks robot messages] "); - if (mode & SILC_CHANNEL_UMODE_QUIET) - strcat(buf, "[quieted] "); - g_strchomp(buf); -} - -void -silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, - char **contactstr, char **langstr, char **devicestr, - char **tzstr, char **geostr) -{ - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - SilcAttributeContact contact; - SilcAttributeObjDevice device; - SilcAttributeObjGeo geo; - - char tmp[1024]; - GString *s; - - *moodstr = NULL; - *statusstr = NULL; - *contactstr = NULL; - *langstr = NULL; - *devicestr = NULL; - *tzstr = NULL; - *geostr = NULL; - - if (!attrs) - return; - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - g_string_append_printf(s, "[%s] ", _("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - g_string_append_printf(s, "[%s] ", _("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - g_string_append_printf(s, "[%s] ", _("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - g_string_append_printf(s, "[%s] ", _("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - g_string_append_printf(s, "[%s] ", _("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - g_string_append_printf(s, "[%s] ", _("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - g_string_append_printf(s, "[%s] ", _("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - g_string_append_printf(s, "[%s] ", _("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - g_string_append_printf(s, "[%s] ", _("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - g_string_append_printf(s, "[%s] ", _("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - g_string_append_printf(s, "[%s] ", _("Anxious")); - } - if (strlen(s->str)) { - *moodstr = s->str; - g_string_free(s, FALSE); - g_strchomp(*moodstr); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_STATUS_FREETEXT); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *statusstr = g_strdup(tmp); - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_PREFERRED_CONTACT); - if (attr && silc_attribute_get_object(attr, &contact, sizeof(contact))) { - if (contact & SILC_ATTRIBUTE_CONTACT_CHAT) - g_string_append_printf(s, "[%s] ", _("Chat")); - if (contact & SILC_ATTRIBUTE_CONTACT_EMAIL) - g_string_append_printf(s, "[%s] ", _("Email")); - if (contact & SILC_ATTRIBUTE_CONTACT_CALL) - g_string_append_printf(s, "[%s] ", _("Phone")); - if (contact & SILC_ATTRIBUTE_CONTACT_PAGE) - g_string_append_printf(s, "[%s] ", _("Paging")); - if (contact & SILC_ATTRIBUTE_CONTACT_SMS) - g_string_append_printf(s, "[%s] ", _("SMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_MMS) - g_string_append_printf(s, "[%s] ", _("MMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_VIDEO) - g_string_append_printf(s, "[%s] ", _("Video Conferencing")); - } - if (strlen(s->str)) { - *contactstr = s->str; - g_string_free(s, FALSE); - g_strchomp(*contactstr); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_PREFERRED_LANGUAGE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *langstr = g_strdup(tmp); - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_DEVICE_INFO); - memset(&device, 0, sizeof(device)); - if (attr && silc_attribute_get_object(attr, &device, sizeof(device))) { - if (device.type == SILC_ATTRIBUTE_DEVICE_COMPUTER) - g_string_append_printf(s, "%s: ", _("Computer")); - if (device.type == SILC_ATTRIBUTE_DEVICE_MOBILE_PHONE) - g_string_append_printf(s, "%s: ", _("Mobile Phone")); - if (device.type == SILC_ATTRIBUTE_DEVICE_PDA) - g_string_append_printf(s, "%s: ", _("PDA")); - if (device.type == SILC_ATTRIBUTE_DEVICE_TERMINAL) - g_string_append_printf(s, "%s: ", _("Terminal")); - g_string_append_printf(s, "%s %s %s %s", - device.manufacturer ? device.manufacturer : "", - device.version ? device.version : "", - device.model ? device.model : "", - device.language ? device.language : ""); - } - if (strlen(s->str)) { - *devicestr = s->str; - g_string_free(s, FALSE); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_TIMEZONE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *tzstr = g_strdup(tmp); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_GEOLOCATION); - memset(&geo, 0, sizeof(geo)); - if (attr && silc_attribute_get_object(attr, &geo, sizeof(geo))) - *geostr = g_strdup_printf("%s %s %s (%s)", - geo.longitude ? geo.longitude : "", - geo.latitude ? geo.latitude : "", - geo.altitude ? geo.altitude : "", - geo.accuracy ? geo.accuracy : ""); -} - -#ifdef HAVE_SILCMIME_H -/* Returns MIME type of filetype */ - -char *silcpurple_file2mime(const char *filename) -{ - const char *ct; - - ct = strrchr(filename, '.'); - if (!ct) - return NULL; - else if (!g_ascii_strcasecmp(".png", ct)) - return strdup("image/png"); - else if (!g_ascii_strcasecmp(".jpg", ct)) - return strdup("image/jpeg"); - else if (!g_ascii_strcasecmp(".jpeg", ct)) - return strdup("image/jpeg"); - else if (!g_ascii_strcasecmp(".gif", ct)) - return strdup("image/gif"); - else if (!g_ascii_strcasecmp(".tiff", ct)) - return strdup("image/tiff"); - - return NULL; -} - -/* Checks if message has images, and assembles MIME message if it has. - If only one image is present, creates simple MIME image message. If - there are multiple images and/or text with images multipart MIME - message is created. */ - -SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags) -{ - SilcMime mime = NULL, p; - SilcDList list, parts = NULL; - const char *start, *end, *last; - GData *attribs; - char *type; - gboolean images = FALSE; - - last = msg; - while (last && *last && purple_markup_find_tag("img", last, &start, - &end, &attribs)) { - PurpleStoredImage *image = NULL; - const char *id; - - /* Check if there is text before image */ - if (start - last) { - char *text, *tmp; - p = silc_mime_alloc(); - - /* Add content type */ - silc_mime_add_field(p, "Content-Type", - "text/plain; charset=utf-8"); - - tmp = g_strndup(last, start - last); - text = purple_unescape_html(tmp); - g_free(tmp); - /* Add text */ - silc_mime_add_data(p, (unsigned char *)text, strlen(text)); - g_free(text); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - } - - id = g_datalist_get_data(&attribs, "id"); - if (id && (image = purple_imgstore_find_by_id(atoi(id)))) { - unsigned long imglen = purple_imgstore_get_size(image); - gconstpointer img = purple_imgstore_get_data(image); - - p = silc_mime_alloc(); - - /* Add content type */ - type = silcpurple_file2mime(purple_imgstore_get_filename(image)); - if (!type) { - g_datalist_clear(&attribs); - last = end + 1; - continue; - } - silc_mime_add_field(p, "Content-Type", type); - silc_free(type); - - /* Add content transfer encoding */ - silc_mime_add_field(p, "Content-Transfer-Encoding", "binary"); - - /* Add image data */ - silc_mime_add_data(p, img, imglen); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - images = TRUE; - } - - g_datalist_clear(&attribs); - - /* Continue after tag */ - last = end + 1; - } - - /* Check for text after the image(s) */ - if (images && last && *last) { - char *tmp = purple_unescape_html(last); - p = silc_mime_alloc(); - - /* Add content type */ - silc_mime_add_field(p, "Content-Type", - "text/plain; charset=utf-8"); - - /* Add text */ - silc_mime_add_data(p, (unsigned char *)tmp, strlen(tmp)); - g_free(tmp); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - } - - /* If there weren't any images, don't return anything. */ - if (!images) { - if (parts) - silc_dlist_uninit(parts); - return NULL; - } - - if (silc_dlist_count(parts) > 1) { - /* Multipart MIME message */ - char b[32]; - mime = silc_mime_alloc(); - silc_mime_add_field(mime, "MIME-Version", "1.0"); - g_snprintf(b, sizeof(b), "b%4X%4X", - (unsigned int)time(NULL), - silc_dlist_count(parts)); - silc_mime_set_multipart(mime, "mixed", b); - silc_dlist_start(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) - silc_mime_add_multipart(mime, p); - } else { - /* Simple MIME message */ - silc_dlist_start(parts); - mime = silc_dlist_get(parts); - silc_mime_add_field(mime, "MIME-Version", "1.0"); - } - - *mflags &= ~SILC_MESSAGE_FLAG_UTF8; - *mflags |= SILC_MESSAGE_FLAG_DATA; - - /* Encode message. Fragment if it is too large */ - list = silc_mime_encode_partial(mime, 0xfc00); - - silc_dlist_uninit(parts); - - /* Added multiparts gets freed here */ - silc_mime_free(mime); - - return list; -} - -#endif /* HAVE_SILCMIME_H */ diff --git a/libpurple/protocols/silc10/wb.c b/libpurple/protocols/silc10/wb.c deleted file mode 100644 index 5e917b8cce..0000000000 --- a/libpurple/protocols/silc10/wb.c +++ /dev/null @@ -1,520 +0,0 @@ -/* - - wb.c - - Author: Pekka Riikonen - - Copyright (C) 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/* - SILC Whiteboard packet: - - 1 byte command - 2 bytes width - 2 bytes height - 4 bytes brush color - 2 bytes brush size - n bytes data - - Data: - - 4 bytes x - 4 bytes y - - Commands: - - 0x01 draw - 0x02 clear - - MIME: - - MIME-Version: 1.0 - Content-Type: application/x-wb - Content-Transfer-Encoding: binary - -*/ - -#define SILCPURPLE_WB_MIME "MIME-Version: 1.0\r\nContent-Type: application/x-wb\r\nContent-Transfer-Encoding: binary\r\n\r\n" -#define SILCPURPLE_WB_HEADER strlen(SILCPURPLE_WB_MIME) + 11 - -#define SILCPURPLE_WB_WIDTH 500 -#define SILCPURPLE_WB_HEIGHT 400 -#define SILCPURPLE_WB_WIDTH_MAX 1024 -#define SILCPURPLE_WB_HEIGHT_MAX 1024 - -/* Commands */ -typedef enum { - SILCPURPLE_WB_DRAW = 0x01, - SILCPURPLE_WB_CLEAR = 0x02 -} SilcPurpleWbCommand; - -/* Brush size */ -typedef enum { - SILCPURPLE_WB_BRUSH_SMALL = 2, - SILCPURPLE_WB_BRUSH_MEDIUM = 5, - SILCPURPLE_WB_BRUSH_LARGE = 10 -} SilcPurpleWbBrushSize; - -/* Brush color (XXX Purple should provide default colors) */ -typedef enum { - SILCPURPLE_WB_COLOR_BLACK = 0, - SILCPURPLE_WB_COLOR_RED = 13369344, - SILCPURPLE_WB_COLOR_GREEN = 52224, - SILCPURPLE_WB_COLOR_BLUE = 204, - SILCPURPLE_WB_COLOR_YELLOW = 15658496, - SILCPURPLE_WB_COLOR_ORANGE = 16737792, - SILCPURPLE_WB_COLOR_CYAN = 52428, - SILCPURPLE_WB_COLOR_VIOLET = 5381277, - SILCPURPLE_WB_COLOR_PURPLE = 13369548, - SILCPURPLE_WB_COLOR_TAN = 12093547, - SILCPURPLE_WB_COLOR_BROWN = 5256485, - SILCPURPLE_WB_COLOR_GREY = 11184810, - SILCPURPLE_WB_COLOR_WHITE = 16777215 -} SilcPurpleWbColor; - -typedef struct { - int type; /* 0 = buddy, 1 = channel */ - union { - SilcClientEntry client; - SilcChannelEntry channel; - } u; - int width; - int height; - int brush_size; - int brush_color; -} *SilcPurpleWb; - -/* Initialize whiteboard */ - -PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry) -{ - SilcClientConnection conn; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - conn = sg->conn; - wb = purple_whiteboard_get_session(sg->account, client_entry->nickname); - if (!wb) - wb = purple_whiteboard_create(sg->account, client_entry->nickname, 0); - if (!wb) - return NULL; - - if (!wb->proto_data) { - wbs = silc_calloc(1, sizeof(*wbs)); - if (!wbs) - return NULL; - wbs->type = 0; - wbs->u.client = client_entry; - wbs->width = SILCPURPLE_WB_WIDTH; - wbs->height = SILCPURPLE_WB_HEIGHT; - wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; - wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; - - /* Start the whiteboard */ - purple_whiteboard_start(wb); - purple_whiteboard_clear(wb); - } - - return wb; -} - -PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) -{ - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - wb = purple_whiteboard_get_session(sg->account, channel->channel_name); - if (!wb) - wb = purple_whiteboard_create(sg->account, channel->channel_name, 0); - if (!wb) - return NULL; - - if (!wb->proto_data) { - wbs = silc_calloc(1, sizeof(*wbs)); - if (!wbs) - return NULL; - wbs->type = 1; - wbs->u.channel = channel; - wbs->width = SILCPURPLE_WB_WIDTH; - wbs->height = SILCPURPLE_WB_HEIGHT; - wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; - wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; - - /* Start the whiteboard */ - purple_whiteboard_start(wb); - purple_whiteboard_clear(wb); - } - - return wb; -} - -static void -silcpurple_wb_parse(SilcPurpleWb wbs, PurpleWhiteboard *wb, - unsigned char *message, SilcUInt32 message_len) -{ - SilcUInt8 command; - SilcUInt16 width, height, brush_size; - SilcUInt32 brush_color, x, y, dx, dy; - SilcBufferStruct buf; - int ret; - - /* Parse the packet */ - silc_buffer_set(&buf, message, message_len); - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_CHAR(&command), - SILC_STR_UI_SHORT(&width), - SILC_STR_UI_SHORT(&height), - SILC_STR_UI_INT(&brush_color), - SILC_STR_UI_SHORT(&brush_size), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, ret); - - /* Update whiteboard if its dimensions changed */ - if (width != wbs->width || height != wbs->height) - silcpurple_wb_set_dimensions(wb, height, width); - - if (command == SILCPURPLE_WB_DRAW) { - /* Parse data and draw it */ - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&dx), - SILC_STR_UI_INT(&dy), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, 8); - x = dx; - y = dy; - while (buf.len > 0) { - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&dx), - SILC_STR_UI_INT(&dy), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, 8); - - purple_whiteboard_draw_line(wb, x, y, x + dx, y + dy, - brush_color, brush_size); - x += dx; - y += dy; - } - } - - if (command == SILCPURPLE_WB_CLEAR) - purple_whiteboard_clear(wb); -} - -typedef struct { - unsigned char *message; - SilcUInt32 message_len; - SilcPurple sg; - SilcClientEntry sender; - SilcChannelEntry channel; -} *SilcPurpleWbRequest; - -static void -silcpurple_wb_request_cb(SilcPurpleWbRequest req, gint id) -{ - PurpleWhiteboard *wb; - - if (id != 1) - goto out; - - if (!req->channel) - wb = silcpurple_wb_init(req->sg, req->sender); - else - wb = silcpurple_wb_init_ch(req->sg, req->channel); - - silcpurple_wb_parse(wb->proto_data, wb, req->message, req->message_len); - - out: - silc_free(req->message); - silc_free(req); -} - -static void -silcpurple_wb_request(SilcClient client, const unsigned char *message, - SilcUInt32 message_len, SilcClientEntry sender, - SilcChannelEntry channel) -{ - char tmp[128]; - SilcPurpleWbRequest req; - PurpleConnection *gc; - SilcPurple sg; - - gc = client->application; - sg = gc->proto_data; - - /* Open whiteboard automatically if requested */ - if (purple_account_get_bool(sg->account, "open-wb", FALSE)) { - PurpleWhiteboard *wb; - - if (!channel) - wb = silcpurple_wb_init(sg, sender); - else - wb = silcpurple_wb_init_ch(sg, channel); - - silcpurple_wb_parse(wb->proto_data, wb, (unsigned char *)message, - message_len); - return; - } - - /* Close any previous unaccepted requests */ - purple_request_close_with_handle(sender); - - if (!channel) { - g_snprintf(tmp, sizeof(tmp), - _("%s sent message to whiteboard. Would you like " - "to open the whiteboard?"), sender->nickname); - } else { - g_snprintf(tmp, sizeof(tmp), - _("%s sent message to whiteboard on %s channel. " - "Would you like to open the whiteboard?"), - sender->nickname, channel->channel_name); - } - - req = silc_calloc(1, sizeof(*req)); - if (!req) - return; - req->message = silc_memdup(message, message_len); - req->message_len = message_len; - req->sender = sender; - req->channel = channel; - req->sg = sg; - - purple_request_action(sender, _("Whiteboard"), tmp, NULL, 1, - sg->account, sender->nickname, NULL, req, 2, - _("Yes"), G_CALLBACK(silcpurple_wb_request_cb), - _("No"), G_CALLBACK(silcpurple_wb_request_cb)); -} - -/* Process incoming whiteboard message */ - -void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - SilcPurple sg; - PurpleConnection *gc; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - gc = client->application; - sg = gc->proto_data; - - wb = purple_whiteboard_get_session(sg->account, sender->nickname); - if (!wb) { - /* Ask user if they want to open the whiteboard */ - silcpurple_wb_request(client, message, message_len, - sender, NULL); - return; - } - - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); -} - -/* Process incoming whiteboard message on channel */ - -void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len) -{ - SilcPurple sg; - PurpleConnection *gc; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - gc = client->application; - sg = gc->proto_data; - - wb = purple_whiteboard_get_session(sg->account, channel->channel_name); - if (!wb) { - /* Ask user if they want to open the whiteboard */ - silcpurple_wb_request(client, message, message_len, - sender, channel); - return; - } - - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); -} - -/* Send whiteboard message */ - -void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list) -{ - SilcPurpleWb wbs = wb->proto_data; - SilcBuffer packet; - GList *list; - int len; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(draw_list); - gc = purple_account_get_connection(wb->account); - g_return_if_fail(gc); - sg = gc->proto_data; - g_return_if_fail(sg); - - len = SILCPURPLE_WB_HEADER; - for (list = draw_list; list; list = list->next) - len += 4; - - packet = silc_buffer_alloc_size(len); - if (!packet) - return; - - /* Assmeble packet */ - silc_buffer_format(packet, - SILC_STR_UI32_STRING(SILCPURPLE_WB_MIME), - SILC_STR_UI_CHAR(SILCPURPLE_WB_DRAW), - SILC_STR_UI_SHORT(wbs->width), - SILC_STR_UI_SHORT(wbs->height), - SILC_STR_UI_INT(wbs->brush_color), - SILC_STR_UI_SHORT(wbs->brush_size), - SILC_STR_END); - silc_buffer_pull(packet, SILCPURPLE_WB_HEADER); - for (list = draw_list; list; list = list->next) { - silc_buffer_format(packet, - SILC_STR_UI_INT(GPOINTER_TO_INT(list->data)), - SILC_STR_END); - silc_buffer_pull(packet, 4); - } - - /* Send the message */ - if (wbs->type == 0) { - /* Private message */ - silc_client_send_private_message(sg->client, sg->conn, - wbs->u.client, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } else if (wbs->type == 1) { - /* Channel message. Channel private keys are not supported. */ - silc_client_send_channel_message(sg->client, sg->conn, - wbs->u.channel, NULL, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } - - silc_buffer_free(packet); -} - -/* Purple Whiteboard operations */ - -void silcpurple_wb_start(PurpleWhiteboard *wb) -{ - /* Nothing here. Everything is in initialization */ -} - -void silcpurple_wb_end(PurpleWhiteboard *wb) -{ - silc_free(wb->proto_data); - wb->proto_data = NULL; -} - -void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) -{ - SilcPurpleWb wbs = wb->proto_data; - *width = wbs->width; - *height = wbs->height; -} - -void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height) -{ - SilcPurpleWb wbs = wb->proto_data; - wbs->width = width > SILCPURPLE_WB_WIDTH_MAX ? SILCPURPLE_WB_WIDTH_MAX : - width; - wbs->height = height > SILCPURPLE_WB_HEIGHT_MAX ? SILCPURPLE_WB_HEIGHT_MAX : - height; - - /* Update whiteboard */ - purple_whiteboard_set_dimensions(wb, wbs->width, wbs->height); -} - -void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color) -{ - SilcPurpleWb wbs = wb->proto_data; - *size = wbs->brush_size; - *color = wbs->brush_color; -} - -void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color) -{ - SilcPurpleWb wbs = wb->proto_data; - wbs->brush_size = size; - wbs->brush_color = color; - - /* Update whiteboard */ - purple_whiteboard_set_brush(wb, size, color); -} - -void silcpurple_wb_clear(PurpleWhiteboard *wb) -{ - SilcPurpleWb wbs = wb->proto_data; - SilcBuffer packet; - int len; - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_account_get_connection(wb->account); - g_return_if_fail(gc); - sg = gc->proto_data; - g_return_if_fail(sg); - - len = SILCPURPLE_WB_HEADER; - packet = silc_buffer_alloc_size(len); - if (!packet) - return; - - /* Assmeble packet */ - silc_buffer_format(packet, - SILC_STR_UI32_STRING(SILCPURPLE_WB_MIME), - SILC_STR_UI_CHAR(SILCPURPLE_WB_CLEAR), - SILC_STR_UI_SHORT(wbs->width), - SILC_STR_UI_SHORT(wbs->height), - SILC_STR_UI_INT(wbs->brush_color), - SILC_STR_UI_SHORT(wbs->brush_size), - SILC_STR_END); - - /* Send the message */ - if (wbs->type == 0) { - /* Private message */ - silc_client_send_private_message(sg->client, sg->conn, - wbs->u.client, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } else if (wbs->type == 1) { - /* Channel message */ - silc_client_send_channel_message(sg->client, sg->conn, - wbs->u.channel, NULL, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } - - silc_buffer_free(packet); -} diff --git a/libpurple/protocols/silc10/wb.h b/libpurple/protocols/silc10/wb.h deleted file mode 100644 index 5ad0bf6fdd..0000000000 --- a/libpurple/protocols/silc10/wb.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - - silcpurple.h - - Author: Pekka Riikonen - - Copyright (C) 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef SILCPURPLE_WB_H -#define SILCPURPLE_WB_H - -#include "silcpurple.h" -#include "whiteboard.h" - -PurpleWhiteboard * -silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry); -PurpleWhiteboard * -silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel); -void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); -void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len); -void silcpurple_wb_start(PurpleWhiteboard *wb); -void silcpurple_wb_end(PurpleWhiteboard *wb); -void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height); -void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height); -void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color); -void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color); -void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list); -void silcpurple_wb_clear(PurpleWhiteboard *wb); - -#endif /* SILCPURPLE_WB_H */ -- cgit v1.2.1 From b40155ea3057f1dcd5a8529e85b9a5c81c0bf334 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 07:20:49 +0000 Subject: Please correct me if I'm wrong, but I don't think we gain anything from declaring _PurpleBlah versions of enums if we do a typedef at the same time. I don't think it's necessary. Fixes #4475 --- ChangeLog.API | 17 +++++++++++++++++ finch/libgnt/gntfilesel.h | 2 +- finch/libgnt/gntprogressbar.h | 2 +- finch/libgnt/gnttree.h | 2 +- finch/libgnt/gntwidget.h | 6 +++--- finch/libgnt/gntwm.h | 2 +- libpurple/cipher.h | 4 ++-- libpurple/cmds.h | 8 ++++---- libpurple/prefs.h | 2 +- libpurple/privacy.h | 2 +- libpurple/protocols/bonjour/mdns_types.h | 2 +- libpurple/sound.h | 2 +- libpurple/xmlnode.h | 2 +- pidgin/win32/untar.h | 2 +- 14 files changed, 36 insertions(+), 19 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index acb657b37c..3bc28f4fd4 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -24,6 +24,23 @@ version 3.0.0 (??/??/????): PurpleConnectionError as the second parameter Removed: + * _GntFileType + * _GntKeyPressMode + * _GntMouseEvent + * _GntParamFlags + * _GntProgressBarOrientation + * _GntTreeColumnFlag + * _GntWidgetFlags + * _PurpleCipherBatchMode + * _PurpleCipherCaps + * _PurpleCmdFlag + * _PurpleCmdPriority + * _PurpleCmdRet + * _PurpleCmdStatus + * _PurplePrefType + * _PurplePrivacyType + * _PurpleSoundEventID + * _XMLNodeType * GtkIMHtml.clipboard_html_string * GtkIMHtml.clipboard_text_string * pidgin_blist_update_account_error_state diff --git a/finch/libgnt/gntfilesel.h b/finch/libgnt/gntfilesel.h index bb6b1d6cf9..c31a8ebe52 100644 --- a/finch/libgnt/gntfilesel.h +++ b/finch/libgnt/gntfilesel.h @@ -81,7 +81,7 @@ struct _GntFileSelClass void (*gnt_reserved4)(void); }; -typedef enum _GntFileType +typedef enum { GNT_FILE_REGULAR, GNT_FILE_DIR diff --git a/finch/libgnt/gntprogressbar.h b/finch/libgnt/gntprogressbar.h index fbfd788992..dbbf4a36e1 100644 --- a/finch/libgnt/gntprogressbar.h +++ b/finch/libgnt/gntprogressbar.h @@ -37,7 +37,7 @@ #define GNT_IS_PROGRESS_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNT_TYPE_PROGRESS_BAR)) #define GNT_PROGRESS_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNT_TYPE_PROGRESS_BAR, GntProgressBarClass)) -typedef enum _GntProgressBarOrientation +typedef enum { GNT_PROGRESS_LEFT_TO_RIGHT, GNT_PROGRESS_RIGHT_TO_LEFT, diff --git a/finch/libgnt/gnttree.h b/finch/libgnt/gnttree.h index 2be31b2cce..1cb69ce5f2 100644 --- a/finch/libgnt/gnttree.h +++ b/finch/libgnt/gnttree.h @@ -47,7 +47,7 @@ typedef struct _GntTreeClass GntTreeClass; typedef struct _GntTreeRow GntTreeRow; typedef struct _GntTreeCol GntTreeCol; -typedef enum _GntTreeColumnFlag { +typedef enum { GNT_TREE_COLUMN_INVISIBLE = 1 << 0, GNT_TREE_COLUMN_FIXED_SIZE = 1 << 1, GNT_TREE_COLUMN_BINARY_DATA = 1 << 2, diff --git a/finch/libgnt/gntwidget.h b/finch/libgnt/gntwidget.h index e25d58f711..cb0f597e32 100644 --- a/finch/libgnt/gntwidget.h +++ b/finch/libgnt/gntwidget.h @@ -49,7 +49,7 @@ typedef struct _GntWidget GntWidget; typedef struct _GntWidgetPriv GntWidgetPriv; typedef struct _GntWidgetClass GntWidgetClass; -typedef enum _GntWidgetFlags +typedef enum { GNT_WIDGET_DESTROYING = 1 << 0, GNT_WIDGET_CAN_TAKE_FOCUS = 1 << 1, @@ -69,7 +69,7 @@ typedef enum _GntWidgetFlags } GntWidgetFlags; /* XXX: This will probably move elsewhere */ -typedef enum _GntMouseEvent +typedef enum { GNT_LEFT_MOUSE_DOWN = 1, GNT_RIGHT_MOUSE_DOWN, @@ -80,7 +80,7 @@ typedef enum _GntMouseEvent } GntMouseEvent; /* XXX: I'll have to ask grim what he's using this for in guifications. */ -typedef enum _GntParamFlags +typedef enum { GNT_PARAM_SERIALIZABLE = 1 << G_PARAM_USER_SHIFT } GntParamFlags; diff --git a/finch/libgnt/gntwm.h b/finch/libgnt/gntwm.h index 4d8ace2428..be846e6a92 100644 --- a/finch/libgnt/gntwm.h +++ b/finch/libgnt/gntwm.h @@ -41,7 +41,7 @@ #define GNT_IS_WM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_WM)) #define GNT_WM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_WM, GntWMClass)) -typedef enum _GntKeyPressMode +typedef enum { GNT_KP_MODE_NORMAL, GNT_KP_MODE_RESIZE, diff --git a/libpurple/cipher.h b/libpurple/cipher.h index b6479c69db..1d19212a94 100644 --- a/libpurple/cipher.h +++ b/libpurple/cipher.h @@ -41,7 +41,7 @@ typedef struct _PurpleCipherContext PurpleCipherContext; /**< A context for a Pu /** * Modes for batch encrypters */ -typedef enum _PurpleCipherBatchMode { +typedef enum { PURPLE_CIPHER_BATCH_MODE_ECB, PURPLE_CIPHER_BATCH_MODE_CBC } PurpleCipherBatchMode; @@ -49,7 +49,7 @@ typedef enum _PurpleCipherBatchMode { /** * The operation flags for a cipher */ -typedef enum _PurpleCipherCaps { +typedef enum { PURPLE_CIPHER_CAPS_SET_OPT = 1 << 1, /**< Set option flag */ PURPLE_CIPHER_CAPS_GET_OPT = 1 << 2, /**< Get option flag */ PURPLE_CIPHER_CAPS_INIT = 1 << 3, /**< Init flag */ diff --git a/libpurple/cmds.h b/libpurple/cmds.h index 5e189928f7..dec8a12e8d 100644 --- a/libpurple/cmds.h +++ b/libpurple/cmds.h @@ -32,7 +32,7 @@ /*@{*/ /** The possible results of running a command with purple_cmd_do_command(). */ -typedef enum _PurpleCmdStatus { +typedef enum { PURPLE_CMD_STATUS_OK, PURPLE_CMD_STATUS_FAILED, PURPLE_CMD_STATUS_NOT_FOUND, @@ -48,7 +48,7 @@ typedef enum _PurpleCmdStatus { * #PURPLE_CMD_RET_CONTINUE to cause the core to fall through to other * commands with the same name. */ -typedef enum _PurpleCmdRet { +typedef enum { PURPLE_CMD_RET_OK, /**< Everything's okay; Don't look for another command to call. */ PURPLE_CMD_RET_FAILED, /**< The command failed, but stop looking.*/ PURPLE_CMD_RET_CONTINUE /**< Continue, looking for other commands with the same name to call. */ @@ -68,7 +68,7 @@ typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd, */ typedef guint PurpleCmdId; -typedef enum _PurpleCmdPriority { +typedef enum { PURPLE_CMD_P_VERY_LOW = -1000, PURPLE_CMD_P_LOW = 0, PURPLE_CMD_P_DEFAULT = 1000, @@ -85,7 +85,7 @@ typedef enum _PurpleCmdPriority { * * @see purple_cmd_register */ -typedef enum _PurpleCmdFlag { +typedef enum { /** Command is usable in IMs. */ PURPLE_CMD_FLAG_IM = 0x01, /** Command is usable in multi-user chats. */ diff --git a/libpurple/prefs.h b/libpurple/prefs.h index 2d02f3f2e7..6b542ea1d3 100644 --- a/libpurple/prefs.h +++ b/libpurple/prefs.h @@ -32,7 +32,7 @@ /** * Preference data types. */ -typedef enum _PurplePrefType +typedef enum { PURPLE_PREF_NONE, /**< No type. */ PURPLE_PREF_BOOLEAN, /**< Boolean. */ diff --git a/libpurple/privacy.h b/libpurple/privacy.h index 0250541128..7da35d4902 100644 --- a/libpurple/privacy.h +++ b/libpurple/privacy.h @@ -29,7 +29,7 @@ /** * Privacy data types. */ -typedef enum _PurplePrivacyType +typedef enum { PURPLE_PRIVACY_ALLOW_ALL = 1, PURPLE_PRIVACY_DENY_ALL, diff --git a/libpurple/protocols/bonjour/mdns_types.h b/libpurple/protocols/bonjour/mdns_types.h index c843f140d6..b8ec2d2857 100644 --- a/libpurple/protocols/bonjour/mdns_types.h +++ b/libpurple/protocols/bonjour/mdns_types.h @@ -37,7 +37,7 @@ typedef struct _BonjourDnsSd { gchar *msg; } BonjourDnsSd; -typedef enum _PublishType { +typedef enum { PUBLISH_START, PUBLISH_UPDATE } PublishType; diff --git a/libpurple/sound.h b/libpurple/sound.h index 1879725818..352ab43efb 100644 --- a/libpurple/sound.h +++ b/libpurple/sound.h @@ -38,7 +38,7 @@ * A type of sound. */ -typedef enum _PurpleSoundEventID +typedef enum { PURPLE_SOUND_BUDDY_ARRIVE = 0, /**< Buddy signs on. */ PURPLE_SOUND_BUDDY_LEAVE, /**< Buddy signs off. */ diff --git a/libpurple/xmlnode.h b/libpurple/xmlnode.h index 95b330cde1..f2ac281016 100644 --- a/libpurple/xmlnode.h +++ b/libpurple/xmlnode.h @@ -35,7 +35,7 @@ extern "C" { /** * The valid types for an xmlnode */ -typedef enum _XMLNodeType +typedef enum { XMLNODE_TYPE_TAG, /**< Just a tag */ XMLNODE_TYPE_ATTRIB, /**< Has attributes */ diff --git a/pidgin/win32/untar.h b/pidgin/win32/untar.h index 10e88976f1..54ad9ca007 100644 --- a/pidgin/win32/untar.h +++ b/pidgin/win32/untar.h @@ -12,7 +12,7 @@ extern "C" { #endif /* __cplusplus */ -typedef enum _untar_opt { +typedef enum { UNTAR_LISTING = (1 << 0), UNTAR_QUIET = (1 << 1), UNTAR_VERBOSE = (1 << 2), -- cgit v1.2.1 From 7cded2074e791965960d6fe44604beb0e57aba2b Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 22 Aug 2011 16:17:24 +0000 Subject: Remove silc10 from POTFILES.in --- po/POTFILES.in | 8 -------- 1 file changed, 8 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index fcbc3b4809..aba6b9c232 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -160,14 +160,6 @@ libpurple/protocols/silc/pk.c libpurple/protocols/silc/silc.c libpurple/protocols/silc/util.c libpurple/protocols/silc/wb.c -libpurple/protocols/silc10/buddy.c -libpurple/protocols/silc10/chat.c -libpurple/protocols/silc10/ft.c -libpurple/protocols/silc10/ops.c -libpurple/protocols/silc10/pk.c -libpurple/protocols/silc10/silc.c -libpurple/protocols/silc10/util.c -libpurple/protocols/silc10/wb.c libpurple/protocols/simple/simple.c libpurple/protocols/yahoo/libyahoo.c libpurple/protocols/yahoo/libyahoojp.c -- cgit v1.2.1 From bcbe9f743d2c771cab404842b6903ef93a612979 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 22 Aug 2011 16:36:48 +0000 Subject: Small typo. --- ChangeLog.API | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.API b/ChangeLog.API index 3bc28f4fd4..c23fa90386 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -17,7 +17,7 @@ version 3.0.0 (??/??/????): * purple_notify_user_info_get_entries returns a GQueue instead of a GList * purple_notify_user_info_prepend_pair renamed to - purple_notify_user_info_prepend_pair_html_html + purple_notify_user_info_prepend_pair_html * purple_util_fetch_url_request_len now takes a PurpleAccount as the first parameter * PurpleConnectionUiOps.report_disconnect now passes a -- cgit v1.2.1 From fe443a4f9b376e7bc16e99e6d6dc2e7352dc5bf7 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 22 Aug 2011 22:09:55 +0000 Subject: These should be using purple_notify_user_info_add_pair_plaintext(). --- libpurple/protocols/mxit/mxit.c | 7 ++---- libpurple/protocols/mxit/profile.c | 45 ++++++++++++-------------------------- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index 4cdc09a093..a5df606f9b 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -358,11 +358,8 @@ static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboole purple_notify_user_info_add_pair_plaintext( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); /* rejection message */ - if ( ( contact->subtype == MXIT_SUBTYPE_REJECTED ) && ( contact->msg != NULL ) ) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Rejection Message" ), contact->msg ); - } + if ( ( contact->subtype == MXIT_SUBTYPE_REJECTED ) && ( contact->msg != NULL ) ) + purple_notify_user_info_add_pair_plaintext( info, _( "Rejection Message" ), contact->msg ); } diff --git a/libpurple/protocols/mxit/profile.c b/libpurple/protocols/mxit/profile.c index 53fe4f3f01..f0c1744bb6 100644 --- a/libpurple/protocols/mxit/profile.c +++ b/libpurple/protocols/mxit/profile.c @@ -175,39 +175,25 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc contact = purple_buddy_get_protocol_data( buddy ); } - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Display Name" ), profile->nickname ); + purple_notify_user_info_add_pair_plaintext( info, _( "Display Name" ), profile->nickname ); tmp = g_strdup_printf("%s (%i)", profile->birthday, calculateAge( profile->birthday ) ); - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Birthday" ), tmp ); + purple_notify_user_info_add_pair_plaintext( info, _( "Birthday" ), tmp ); g_free( tmp ); purple_notify_user_info_add_pair_plaintext( info, _( "Gender" ), profile->male ? _( "Male" ) : _( "Female" ) ); /* optional information */ - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "First Name" ), profile->firstname ); - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Last Name" ), profile->lastname ); - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Country" ), profile->regcountry ); - - if ( *profile->aboutme ) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "About Me" ), profile->aboutme ); - } - if ( *profile->whereami ) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Where I Live" ), profile->whereami ); - } + purple_notify_user_info_add_pair_plaintext( info, _( "First Name" ), profile->firstname ); + purple_notify_user_info_add_pair_plaintext( info, _( "Last Name" ), profile->lastname ); + + purple_notify_user_info_add_pair_plaintext( info, _( "Country" ), profile->regcountry ); + + if ( *profile->aboutme ) + purple_notify_user_info_add_pair_plaintext( info, _( "About Me" ), profile->aboutme ); + + if ( *profile->whereami ) + purple_notify_user_info_add_pair_plaintext( info, _( "Where I Live" ), profile->whereami ); purple_notify_user_info_add_section_break( info ); @@ -241,11 +227,8 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc if ( contact ) { /* invite found */ - if ( contact->msg ) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Invite Message" ), contact->msg ); - } + if ( contact->msg ) + purple_notify_user_info_add_pair_plaintext( info, _( "Invite Message" ), contact->msg ); if ( contact->imgid ) { /* this invite has a avatar */ -- cgit v1.2.1 From 21cff98134c0af9ca4111c0a27d75c70c106a768 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 22 Aug 2011 22:18:41 +0000 Subject: Fix vvconfig.c compile. --- pidgin/plugins/vvconfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/plugins/vvconfig.c b/pidgin/plugins/vvconfig.c index caba7310d0..11cb948bca 100644 --- a/pidgin/plugins/vvconfig.c +++ b/pidgin/plugins/vvconfig.c @@ -627,7 +627,7 @@ gst_bus_cb(GstBus *bus, GstMessage *msg, BusCbCtx *ctx) } static void -voice_test_frame_destroy_cb(GtkObject *w, GstElement *pipeline) +voice_test_frame_destroy_cb(GtkWidget *w, GstElement *pipeline) { g_return_if_fail(GST_IS_ELEMENT(pipeline)); @@ -702,7 +702,7 @@ get_voice_test_frame(PurplePlugin *plugin) gtk_range_set_value(GTK_RANGE(volume), purple_prefs_get_int("/purple/media/audio/volume/input")); - gtk_widget_set(volume, "draw-value", FALSE, NULL); + gtk_scale_set_draw_value(GTK_SCALE(volume), FALSE); gtk_range_set_value(GTK_RANGE(threshold), purple_prefs_get_int("/purple/media/audio/silence_threshold")); -- cgit v1.2.1 From 0d43b445d2b2ddc6eb272abb7a9e170e043d79af Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 22 Aug 2011 22:25:09 +0000 Subject: It seems like there's a dereference missing here. Is this the cause of some random menu problems on Windows? --- pidgin/gtkutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index bff3bdf701..d0c8fce1a8 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -1290,7 +1290,7 @@ pidgin_menu_position_func_helper(GtkMenu *menu, monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y); - push_in = FALSE; + *push_in = FALSE; /* * The placement of popup menus horizontally works like this (with -- cgit v1.2.1 From 32c661094fd82f6e5201533d2cd5b32fb30fde7e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 22 Aug 2011 22:45:09 +0000 Subject: Fix some sort of merge error from before. --- pidgin/gtkutils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 9cd56b1642..6e84b08356 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -867,6 +867,8 @@ pidgin_account_option_menu_new(PurpleAccount *default_account, g_object_set_data(G_OBJECT(optmenu), "filter_func", filter_func); return optmenu; +} + void pidgin_setup_gtkspell(GtkTextView *textview) { -- cgit v1.2.1 From b2343bb343b01424477904d06044270a537dbffe Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 22 Aug 2011 22:46:08 +0000 Subject: Force disable GtkSpell, since it's not currently compatible with GTK+3. --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index eea6073d79..aadcc86382 100644 --- a/configure.ac +++ b/configure.ac @@ -545,6 +545,8 @@ Use --disable-sm if you do not need session management support. dnl ####################################################################### dnl # Check for GtkSpell dnl ####################################################################### + dnl GtkSpell is not GTK+3 compatible yet + enable_gtkspell="no" if test "x$enable_gtkspell" = "xyes" ; then PKG_CHECK_MODULES(GTKSPELL, gtkspell-2.0 >= 2.0.2, , [ AC_MSG_RESULT(no) -- cgit v1.2.1 From 00be6694d7ab70d665b3164fad086baa4bbad133 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 22 Aug 2011 22:56:24 +0000 Subject: Remove what seems to be an unnecessary variable. --- pidgin/gtkdocklet.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index 571222e017..bbf997bc63 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -188,7 +188,6 @@ docklet_update_status(void) for(l = purple_accounts_get_all(); l != NULL; l = l->next) { PurpleAccount *account = (PurpleAccount*)l->data; - PurpleStatus *account_status; if (!purple_account_get_enabled(account, PIDGIN_UI)) continue; @@ -196,7 +195,6 @@ docklet_update_status(void) if (purple_account_is_disconnected(account)) continue; - account_status = purple_account_get_active_status(account); if (purple_account_is_connecting(account)) newconnecting = TRUE; } -- cgit v1.2.1 From b4d6d2240ea09ce739acce77d7de1e8407d02ab3 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Tue, 23 Aug 2011 04:32:43 +0000 Subject: Use accessor functions in a few places --- libpurple/plugins/log_reader.c | 31 ++++++++++++++----------------- libpurple/protocols/bonjour/jabber.c | 16 ++++++++++------ 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/libpurple/plugins/log_reader.c b/libpurple/plugins/log_reader.c index 800bc38ae4..c1dafea7ec 100644 --- a/libpurple/plugins/log_reader.c +++ b/libpurple/plugins/log_reader.c @@ -92,7 +92,7 @@ static GList *adium_logger_list(PurpleLogType type, const char *sn, PurpleAccoun prpl_name = g_ascii_strup(prpl_info->list_icon(account, NULL), -1); - temp = g_strdup_printf("%s.%s", prpl_name, account->username); + temp = g_strdup_printf("%s.%s", prpl_name, purple_account_get_username(account)); path = g_build_filename(logdir, temp, sn, NULL); g_free(temp); @@ -635,7 +635,7 @@ static GList *msn_logger_list(PurpleLogType type, const char *sn, PurpleAccount g_return_val_if_fail(sn != NULL, NULL); g_return_val_if_fail(account != NULL, NULL); - if (strcmp(account->protocol_id, "prpl-msn")) + if (strcmp(purple_account_get_protocol_id(account), "prpl-msn")) return NULL; logdir = purple_prefs_get_string("/plugins/core/log_reader/msn/log_directory"); @@ -658,7 +658,7 @@ static GList *msn_logger_list(PurpleLogType type, const char *sn, PurpleAccount return list; } } else { - username = g_strdup(purple_normalize(account, account->username)); + username = g_strdup(purple_normalize(account, purple_account_get_username(account))); } if (buddy) { @@ -974,7 +974,7 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) their_name = from_name; if (from_name && purple_prefs_get_bool("/plugins/core/log_reader/use_name_heuristics")) { - const char *friendly_name = purple_connection_get_display_name(log->account->gc); + const char *friendly_name = purple_connection_get_display_name(purple_account_get_connection(log->account)); if (friendly_name != NULL) { int friendly_name_length = strlen(friendly_name); @@ -987,13 +987,10 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) if (buddy) their_name = purple_buddy_get_alias(buddy); - if (log->account->alias) - { - alias = log->account->alias; + alias = purple_account_get_alias(log->account); + if (alias) { alias_length = strlen(alias); - } - else - { + } else { alias = ""; alias_length = 0; } @@ -1115,10 +1112,10 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) text = g_string_append(text, ""); if (name_guessed == NAME_GUESS_ME) { - if (log->account->alias) - text = g_string_append(text, log->account->alias); + if (purple_account_get_alias(log->account)) + text = g_string_append(text, purple_account_get_alias(log->account)); else - text = g_string_append(text, log->account->username); + text = g_string_append(text, purple_account_get_username(log->account)); } else if (name_guessed == NAME_GUESS_THEM) text = g_string_append(text, their_name); @@ -1781,7 +1778,7 @@ static GList *qip_logger_list(PurpleLogType type, const char *sn, PurpleAccount g_return_val_if_fail(account != NULL, NULL); /* QIP only supports ICQ. */ - if (strcmp(account->protocol_id, "prpl-icq")) + if (strcmp(purple_account_get_protocol_id(account), "prpl-icq")) return NULL; logdir = purple_prefs_get_string("/plugins/core/log_reader/qip/log_directory"); @@ -1798,7 +1795,7 @@ static GList *qip_logger_list(PurpleLogType type, const char *sn, PurpleAccount if (!prpl_info->list_icon) return NULL; - username = g_strdup(purple_normalize(account, account->username)); + username = g_strdup(purple_normalize(account, purple_account_get_username(account))); filename = g_strdup_printf("%s.txt", purple_normalize(account, sn)); path = g_build_filename(logdir, username, "History", filename, NULL); g_free(username); @@ -2241,10 +2238,10 @@ static GList *amsn_logger_list(PurpleLogType type, const char *sn, PurpleAccount return NULL; /* aMSN only works with MSN/WLM */ - if (strcmp(account->protocol_id, "prpl-msn")) + if (strcmp(purple_account_get_protocol_id(account), "prpl-msn")) return NULL; - username = g_strdup(purple_normalize(account, account->username)); + username = g_strdup(purple_normalize(account, purple_account_get_username(account))); buddy_log = g_strdup_printf("%s.log", purple_normalize(account, sn)); log_path = g_build_filename(logdir, username, "logs", NULL); diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index 455d1f2af3..7a15be7953 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -929,7 +929,8 @@ bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { while(tmp) { ip = tmp->data; if (ip != NULL && g_ascii_strcasecmp(ip, bconv->ip) == 0) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; + PurpleConnection *pc = purple_account_get_connection(bconv->account); + BonjourJabber *jdata = ((BonjourData *)pc->proto_data)->jabber_data; purple_debug_info("bonjour", "Matched buddy %s to incoming conversation \"from\" attrib and IP (%s)\n", purple_buddy_get_name(pb), bconv->ip); @@ -962,7 +963,8 @@ bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { void bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; + PurpleConnection *pc = purple_account_get_connection(bconv->account); + BonjourJabber *jdata = ((BonjourData *)pc->proto_data)->jabber_data; struct _match_buddies_by_address_t *mbba; GSList *buddies; @@ -1122,7 +1124,8 @@ _async_bonjour_jabber_close_conversation_cb(gpointer data) { void async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; + PurpleConnection *pc = purple_account_get_connection(bconv->account); + BonjourJabber *jdata = ((BonjourData *)pc->proto_data)->jabber_data; jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); @@ -1142,8 +1145,9 @@ bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) if (bconv != NULL) { BonjourData *bd = NULL; - if(PURPLE_CONNECTION_IS_VALID(bconv->account->gc)) { - bd = bconv->account->gc->proto_data; + PurpleConnection *pc = purple_account_get_connection(bconv->account); + if (PURPLE_CONNECTION_IS_VALID(pc)) { + bd = pc->proto_data; bd->jabber_data->pending_conversations = g_slist_remove(bd->jabber_data->pending_conversations, bconv); } @@ -1215,7 +1219,7 @@ bonjour_jabber_stop(BonjourJabber *jdata) purple_input_remove(jdata->watcher_id6); /* Close all the conversation sockets and remove all the watchers after sending end streams */ - if (jdata->account->gc != NULL) { + if (!purple_account_is_disconnected(jdata->account)) { GSList *buddies, *l; buddies = purple_find_buddies(jdata->account, NULL); -- cgit v1.2.1 From ce0073c3ecd1ac6736541cd67440059a71e28ddb Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Tue, 23 Aug 2011 04:37:58 +0000 Subject: Hide-a-Struct --- ChangeLog.API | 1 + libpurple/request.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++ libpurple/request.h | 89 ----------------------------------------------------- 3 files changed, 87 insertions(+), 89 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index c23fa90386..ebbad31720 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -64,6 +64,7 @@ version 3.0.0 (??/??/????): purple_util_fetch_url_request_len, insetad. * PurpleConnectionUiOps.report_disconnect_reason * struct _GtkIMHtmlFontDetail + * struct _PurpleRequestField version 2.10.0: libpurple: diff --git a/libpurple/request.c b/libpurple/request.c index 01966dc435..3d8950ea4d 100644 --- a/libpurple/request.c +++ b/libpurple/request.c @@ -42,6 +42,92 @@ typedef struct } PurpleRequestInfo; +/** + * A request field. + */ +struct _PurpleRequestField +{ + PurpleRequestFieldType type; + PurpleRequestFieldGroup *group; + + char *id; + char *label; + char *type_hint; + + gboolean visible; + gboolean required; + + union + { + struct + { + gboolean multiline; + gboolean masked; + gboolean editable; + char *default_value; + char *value; + + } string; + + struct + { + int default_value; + int value; + + } integer; + + struct + { + gboolean default_value; + gboolean value; + + } boolean; + + struct + { + int default_value; + int value; + + GList *labels; + + } choice; + + struct + { + GList *items; + GList *icons; + GHashTable *item_data; + GList *selected; + GHashTable *selected_table; + + gboolean multiple_selection; + + } list; + + struct + { + PurpleAccount *default_account; + PurpleAccount *account; + gboolean show_all; + + PurpleFilterAccountFunc filter_func; + + } account; + + struct + { + unsigned int scale_x; + unsigned int scale_y; + const char *buffer; + gsize size; + } image; + + } u; + + void *ui_data; + char *tooltip; + +}; PurpleRequestFields * purple_request_fields_new(void) diff --git a/libpurple/request.h b/libpurple/request.h index 9330894982..41ac859fd9 100644 --- a/libpurple/request.h +++ b/libpurple/request.h @@ -96,95 +96,6 @@ typedef struct } PurpleRequestFieldGroup; -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_REQUEST_C_) -/** - * A request field. - */ -struct _PurpleRequestField -{ - PurpleRequestFieldType type; - PurpleRequestFieldGroup *group; - - char *id; - char *label; - char *type_hint; - - gboolean visible; - gboolean required; - - union - { - struct - { - gboolean multiline; - gboolean masked; - gboolean editable; - char *default_value; - char *value; - - } string; - - struct - { - int default_value; - int value; - - } integer; - - struct - { - gboolean default_value; - gboolean value; - - } boolean; - - struct - { - int default_value; - int value; - - GList *labels; - - } choice; - - struct - { - GList *items; - GList *icons; - GHashTable *item_data; - GList *selected; - GHashTable *selected_table; - - gboolean multiple_selection; - - } list; - - struct - { - PurpleAccount *default_account; - PurpleAccount *account; - gboolean show_all; - - PurpleFilterAccountFunc filter_func; - - } account; - - struct - { - unsigned int scale_x; - unsigned int scale_y; - const char *buffer; - gsize size; - } image; - - } u; - - void *ui_data; - char *tooltip; - -}; -#endif - /** * Request UI operations. */ -- cgit v1.2.1 From a83b5c3eaae70eed6d0b849d68681821623e9d11 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Tue, 23 Aug 2011 05:43:51 +0000 Subject: Some struct hiding. What a pain. --- ChangeLog.API | 10 ++++ finch/gntroomlist.c | 10 +++- libpurple/protocols/irc/irc.c | 3 +- libpurple/protocols/jabber/chat.c | 8 ++- libpurple/protocols/silc/chat.c | 3 +- libpurple/protocols/yahoo/yahoochat.c | 45 +++++++++------ libpurple/roomlist.c | 84 +++++++++++++++++++++++++++- libpurple/roomlist.h | 101 ++++++++++++++++++++++------------ pidgin/gtkroomlist.c | 98 ++++++++++++++++++--------------- 9 files changed, 258 insertions(+), 104 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index ebbad31720..1dfd8f1c73 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -8,6 +8,13 @@ version 3.0.0 (??/??/????): * purple_notify_user_info_prepend_pair_plaintext * purple_request_field_set_tooltip * purple_request_field_get_tooltip + * purple_roomlist_get_account + * purple_roomlist_get_proto_data + * purple_roomlist_get_ui_data + * purple_roomlist_room_get_expanded_once + * purple_roomlist_room_set_expanded_once + * purple_roomlist_set_proto_data + * purple_roomlist_set_ui_data Changed: * purple_connection_error now takes a PurpleConnectionError @@ -65,6 +72,9 @@ version 3.0.0 (??/??/????): * PurpleConnectionUiOps.report_disconnect_reason * struct _GtkIMHtmlFontDetail * struct _PurpleRequestField + * struct _PurpleRoomlist + * struct _PurpleRoomlistField + * struct _PurpleRoomlistRoom version 2.10.0: libpurple: diff --git a/finch/gntroomlist.c b/finch/gntroomlist.c index 92299d3a5c..12cce2862e 100644 --- a/finch/gntroomlist.c +++ b/finch/gntroomlist.c @@ -41,6 +41,12 @@ #define PREF_ROOT "/finch/roomlist" +#undef FINCH_GET_DATA +#undef FINCH_SET_DATA +#define FINCH_GET_DATA(obj) purple_roomlist_get_ui_data(obj) +#define FINCH_SET_DATA(obj, data) purple_roomlist_set_ui_data(obj, data) + + /* Yes, just one roomlist at a time. Let's not get greedy. Aight? */ struct _FinchRoomlist { @@ -146,9 +152,9 @@ roomlist_activated(GntWidget *widget) purple_roomlist_room_join(froomlist.roomlist, room); break; case PURPLE_ROOMLIST_ROOMTYPE_CATEGORY: - if (!room->expanded_once) { + if (!purple_roomlist_room_get_expanded_once(room)) { purple_roomlist_expand_category(froomlist.roomlist, room); - room->expanded_once = TRUE; + purple_roomlist_room_set_expanded_once(room, TRUE); } break; } diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index a5ef1d38cc..07dd1e54dd 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -890,7 +890,8 @@ static PurpleRoomlist *irc_roomlist_get_list(PurpleConnection *gc) static void irc_roomlist_cancel(PurpleRoomlist *list) { - PurpleConnection *gc = purple_account_get_connection(list->account); + PurpleAccount *account = purple_roomlist_get_account(list); + PurpleConnection *gc = purple_account_get_connection(account); struct irc_conn *irc; if (gc == NULL) diff --git a/libpurple/protocols/jabber/chat.c b/libpurple/protocols/jabber/chat.c index dfc52d6539..b4467397f3 100644 --- a/libpurple/protocols/jabber/chat.c +++ b/libpurple/protocols/jabber/chat.c @@ -887,8 +887,8 @@ static void roomlist_ok_cb(JabberStream *js, const char *server) char *jabber_roomlist_room_serialize(PurpleRoomlistRoom *room) { - - return g_strdup_printf("%s@%s", (char*)room->fields->data, (char*)room->fields->next->data); + GList *fields = purple_roomlist_room_get_fields(room); + return g_strdup_printf("%s@%s", (char*)fields->data, (char*)fields->next->data); } PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc) @@ -928,10 +928,12 @@ PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc) void jabber_roomlist_cancel(PurpleRoomlist *list) { + PurpleAccount *account; PurpleConnection *gc; JabberStream *js; - gc = purple_account_get_connection(list->account); + account = purple_roomlist_get_account(list); + gc = purple_account_get_connection(account); js = gc->proto_data; purple_roomlist_set_in_progress(list, FALSE); diff --git a/libpurple/protocols/silc/chat.c b/libpurple/protocols/silc/chat.c index d20667a7c2..39c6033f4b 100644 --- a/libpurple/protocols/silc/chat.c +++ b/libpurple/protocols/silc/chat.c @@ -1419,7 +1419,8 @@ PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) void silcpurple_roomlist_cancel(PurpleRoomlist *list) { - PurpleConnection *gc = purple_account_get_connection(list->account); + PurpleAccount *account = purple_roomlist_get_account(list); + PurpleConnection *gc = purple_account_get_connection(account); SilcPurple sg; if (!gc) diff --git a/libpurple/protocols/yahoo/yahoochat.c b/libpurple/protocols/yahoo/yahoochat.c index 10635908a5..e52f527d19 100644 --- a/libpurple/protocols/yahoo/yahoochat.c +++ b/libpurple/protocols/yahoo/yahoochat.c @@ -1375,7 +1375,9 @@ static void yahoo_roomlist_cleanup(PurpleRoomlist *list, struct yahoo_roomlist * purple_roomlist_set_in_progress(list, FALSE); if (yrl) { - list->proto_data = g_list_remove(list->proto_data, yrl); + GList *proto_data = purple_roomlist_get_proto_data(list); + proto_data = g_list_remove(proto_data, yrl); + purple_roomlist_set_proto_data(list, proto_data); yahoo_roomlist_destroy(yrl); } @@ -1451,7 +1453,7 @@ static void yahoo_roomlist_send_cb(gpointer data, gint source, PurpleInputCondit yrl->inpa = 0; g_free(yrl->txbuf); yrl->txbuf = NULL; - purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); + purple_notify_error(purple_account_get_connection(purple_roomlist_get_account(list)), NULL, _("Unable to connect"), _("Fetching the room list failed.")); yahoo_roomlist_cleanup(list, yrl); return; } @@ -1474,10 +1476,12 @@ static void yahoo_roomlist_got_connected(gpointer data, gint source, const gchar { struct yahoo_roomlist *yrl = data; PurpleRoomlist *list = yrl->list; - YahooData *yd = purple_account_get_connection(list->account)->proto_data; + PurpleAccount *account = purple_roomlist_get_account(list); + PurpleConnection *pc = purple_account_get_connection(account); + YahooData *yd = pc->proto_data; if (source < 0) { - purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); + purple_notify_error(pc, NULL, _("Unable to connect"), _("Fetching the room list failed.")); yahoo_roomlist_cleanup(list, yrl); return; } @@ -1506,6 +1510,7 @@ PurpleRoomlist *yahoo_roomlist_get_list(PurpleConnection *gc) struct yahoo_roomlist *yrl; const char *rll, *rlurl; char *url; + GList *proto_data; account = purple_connection_get_account(gc); @@ -1556,7 +1561,9 @@ PurpleRoomlist *yahoo_roomlist_get_list(PurpleConnection *gc) return NULL; } - rl->proto_data = g_list_append(rl->proto_data, yrl); + proto_data = purple_roomlist_get_proto_data(rl); + proto_data = g_list_append(proto_data, yrl); + purple_roomlist_set_proto_data(rl, proto_data); purple_roomlist_set_in_progress(rl, TRUE); return rl; @@ -1566,8 +1573,8 @@ void yahoo_roomlist_cancel(PurpleRoomlist *list) { GList *l, *k; - k = l = list->proto_data; - list->proto_data = NULL; + k = l = purple_roomlist_get_proto_data(list); + purple_roomlist_set_proto_data(list, NULL); purple_roomlist_set_in_progress(list, FALSE); @@ -1580,36 +1587,42 @@ void yahoo_roomlist_cancel(PurpleRoomlist *list) void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) { + PurpleAccount *account; struct yahoo_roomlist *yrl; char *url; char *id; const char *rll; + GList *proto_data; - if (category->type != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) + if (purple_roomlist_room_get_type(category) != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) return; - if (!(id = g_list_nth_data(category->fields, 1))) { + if (!(id = g_list_nth_data(purple_roomlist_room_get_fields(category), 1))) { purple_roomlist_set_in_progress(list, FALSE); return; } - rll = purple_account_get_string(list->account, "room_list_locale", + account = purple_roomlist_get_account(list); + rll = purple_account_get_string(account, "room_list_locale", YAHOO_ROOMLIST_LOCALE); if (rll != NULL && *rll != '\0') { url = g_strdup_printf("%s?chatroom_%s=0&intl=%s", - purple_account_get_string(list->account,"room_list", + purple_account_get_string(account,"room_list", YAHOO_ROOMLIST_URL), id, rll); } else { url = g_strdup_printf("%s?chatroom_%s=0", - purple_account_get_string(list->account,"room_list", + purple_account_get_string(account,"room_list", YAHOO_ROOMLIST_URL), id); } yrl = g_new0(struct yahoo_roomlist, 1); yrl->list = list; yrl->cat = category; - list->proto_data = g_list_append(list->proto_data, yrl); + + proto_data = purple_roomlist_get_proto_data(list); + proto_data = g_list_append(proto_data, yrl); + purple_roomlist_set_proto_data(list, proto_data); purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); g_free(url); @@ -1617,11 +1630,11 @@ void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *ca yrl->ucat = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY, _("User Rooms"), yrl->cat); purple_roomlist_room_add(list, yrl->ucat); - if (purple_proxy_connect(purple_account_get_connection(list->account), - list->account, yrl->host, 80, + if (purple_proxy_connect(purple_account_get_connection(account), + account, yrl->host, 80, yahoo_roomlist_got_connected, yrl) == NULL) { - purple_notify_error(purple_account_get_connection(list->account), + purple_notify_error(purple_account_get_connection(account), NULL, _("Connection problem"), _("Unable to fetch room list.")); purple_roomlist_ref(list); yahoo_roomlist_cleanup(list, yrl); diff --git a/libpurple/roomlist.c b/libpurple/roomlist.c index 8a415ebe00..a1a797c122 100644 --- a/libpurple/roomlist.c +++ b/libpurple/roomlist.c @@ -32,6 +32,39 @@ #include "roomlist.h" #include "server.h" +/** + * Represents a list of rooms for a given connection on a given protocol. + */ +struct _PurpleRoomlist { + PurpleAccount *account; /**< The account this list belongs to. */ + GList *fields; /**< The fields. */ + GList *rooms; /**< The list of rooms. */ + gboolean in_progress; /**< The listing is in progress. */ + gpointer ui_data; /**< UI private data. */ + gpointer proto_data; /** Prpl private data. */ + guint ref; /**< The reference count. */ +}; + +/** + * Represents a room. + */ +struct _PurpleRoomlistRoom { + PurpleRoomlistRoomType type; /**< The type of room. */ + gchar *name; /**< The name of the room. */ + GList *fields; /**< Other fields. */ + PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */ + gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */ +}; + +/** + * A field a room might have. + */ +struct _PurpleRoomlistField { + PurpleRoomlistFieldType type; /**< The type of field. */ + gchar *label; /**< The i18n user displayed name of the field. */ + gchar *name; /**< The internal name of the field. */ + gboolean hidden; /**< Hidden? */ +}; static PurpleRoomlistUiOps *ops = NULL; @@ -127,6 +160,13 @@ void purple_roomlist_unref(PurpleRoomlist *list) purple_roomlist_destroy(list); } +PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list) +{ + g_return_val_if_fail(list != NULL, NULL); + + return list->account; +} + void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields) { g_return_if_fail(list != NULL); @@ -234,6 +274,34 @@ GList * purple_roomlist_get_fields(PurpleRoomlist *list) return list->fields; } +gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list) +{ + g_return_val_if_fail(list != NULL, NULL); + + return list->proto_data; +} + +void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data) +{ + g_return_if_fail(list != NULL); + + list->proto_data = proto_data; +} + +gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list) +{ + g_return_val_if_fail(list != NULL, NULL); + + return list->ui_data; +} + +void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data) +{ + g_return_if_fail(list != NULL); + + list->ui_data = ui_data; +} + /*@}*/ /**************************************************************************/ @@ -329,7 +397,21 @@ PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room) return room->parent; } -GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room) +gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room) +{ + g_return_val_if_fail(room != NULL, NULL); + + return room->expanded_once; +} + +void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once) +{ + g_return_val_if_fail(room != NULL, NULL); + + room->expanded_once = expanded_once; +} + +GList *purple_roomlist_room_get_fields(PurpleRoomlistRoom *room) { return room->fields; } diff --git a/libpurple/roomlist.h b/libpurple/roomlist.h index de9270f002..87fbdd635b 100644 --- a/libpurple/roomlist.h +++ b/libpurple/roomlist.h @@ -63,40 +63,6 @@ typedef enum /** Data Structures */ /**************************************************************************/ -/** - * Represents a list of rooms for a given connection on a given protocol. - */ -struct _PurpleRoomlist { - PurpleAccount *account; /**< The account this list belongs to. */ - GList *fields; /**< The fields. */ - GList *rooms; /**< The list of rooms. */ - gboolean in_progress; /**< The listing is in progress. */ - gpointer ui_data; /**< UI private data. */ - gpointer proto_data; /** Prpl private data. */ - guint ref; /**< The reference count. */ -}; - -/** - * Represents a room. - */ -struct _PurpleRoomlistRoom { - PurpleRoomlistRoomType type; /**< The type of room. */ - gchar *name; /**< The name of the room. */ - GList *fields; /**< Other fields. */ - PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */ - gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */ -}; - -/** - * A field a room might have. - */ -struct _PurpleRoomlistField { - PurpleRoomlistFieldType type; /**< The type of field. */ - gchar *label; /**< The i18n user displayed name of the field. */ - gchar *name; /**< The internal name of the field. */ - gboolean hidden; /**< Hidden? */ -}; - /** * The room list ops to be filled out by the UI. */ @@ -162,6 +128,14 @@ void purple_roomlist_ref(PurpleRoomlist *list); */ void purple_roomlist_unref(PurpleRoomlist *list); +/** + * Retrieve the PurpleAccount that was given when the room list was + * created. + * + * @return The PurpleAccount tied to this room list. + */ +PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list); + /** * Set the different field types and their names for this protocol. * @@ -241,11 +215,49 @@ void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *c /** * Get the list of fields for a roomlist. * - * @param roomlist The roomlist, which must not be @c NULL. + * @param roomlist The roomlist, which must not be @c NULL. * @constreturn A list of fields * @since 2.4.0 */ -GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist); +GList *purple_roomlist_get_fields(PurpleRoomlist *roomlist); + +/** + * Get the protocol data associated with this room list. + * + * @param roomlist The roomlist, which must not be @c NULL. + * + * @return The protocol data associated with this room list. This is a + * convenience field provided to the protocol plugin--it is not + * used the libuprple core. + */ +gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list); + +/** + * Set the protocol data associated with this room list. + * + * @param list The roomlist, which must not be @c NULL. + * @param proto_data A pointer to associate with this room list. + */ +void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data); + +/** + * Get the UI data associated with this room list. + * + * @param roomlist The roomlist, which must not be @c NULL. + * + * @return The UI data associated with this room list. This is a + * convenience field provided to the UIs--it is not + * used by the libuprple core. + */ +gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list); + +/** + * Set the UI data associated with this room list. + * + * @param list The roomlist, which must not be @c NULL. + * @param UI_data A pointer to associate with this room list. + */ +void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data); /*@}*/ @@ -307,6 +319,23 @@ const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room); */ PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room); +/** + * Get the value of the expanded_once flag. + * + * @param room The room, which must not be @c NULL. + * + * @return The value of the expanded_once flag. + */ +gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room); + +/** + * Set the expanded_once flag. + * + * @param room The room, which must not be @c NULL. + * @param expanded_once The new value of the expanded_once flag. + */ +void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once); + /** * Get the list of fields for a room. * diff --git a/pidgin/gtkroomlist.c b/pidgin/gtkroomlist.c index 63630b1766..99c91ba0a6 100644 --- a/pidgin/gtkroomlist.c +++ b/pidgin/gtkroomlist.c @@ -91,7 +91,7 @@ static gint delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) purple_timeout_remove(dialog->pg_update_to); if (dialog->roomlist) { - PidginRoomlist *rl = dialog->roomlist->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(dialog->roomlist); if (dialog->pg_update_to > 0) /* yes, that's right, unref it twice. */ @@ -115,7 +115,7 @@ static void dialog_select_account_cb(GObject *w, PurpleAccount *account, dialog->account = account; if (change && dialog->roomlist) { - PidginRoomlist *rl = dialog->roomlist->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(dialog->roomlist); if (rl->tree) { gtk_widget_destroy(rl->tree); rl->tree = NULL; @@ -135,7 +135,7 @@ static void list_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) return; if (dialog->roomlist != NULL) { - rl = dialog->roomlist->ui_data; + rl = purple_roomlist_get_ui_data(dialog->roomlist); gtk_widget_destroy(rl->tree); purple_roomlist_unref(dialog->roomlist); } @@ -144,7 +144,7 @@ static void list_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) if (!dialog->roomlist) return; purple_roomlist_ref(dialog->roomlist); - rl = dialog->roomlist->ui_data; + rl = purple_roomlist_get_ui_data(dialog->roomlist); rl->dialog = dialog; if (dialog->account_widget) @@ -203,7 +203,7 @@ selection_changed_cb(GtkTreeSelection *selection, PidginRoomlist *grl) { val.g_type = 0; gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) { + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) { gtk_widget_set_sensitive(dialog->join_button, FALSE); gtk_widget_set_sensitive(dialog->add_button, FALSE); return; @@ -228,7 +228,8 @@ selection_changed_cb(GtkTreeSelection *selection, PidginRoomlist *grl) { static void do_add_room_cb(GtkWidget *w, struct _menu_cb_info *info) { char *name; - PurpleConnection *gc = purple_account_get_connection(info->list->account); + PurpleAccount *account = purple_roomlist_get_account(info->list); + PurpleConnection *gc = purple_account_get_connection(account); PurplePluginProtocolInfo *prpl_info = NULL; if(gc != NULL) @@ -237,9 +238,9 @@ static void do_add_room_cb(GtkWidget *w, struct _menu_cb_info *info) if(prpl_info != NULL && prpl_info->roomlist_room_serialize) name = prpl_info->roomlist_room_serialize(info->room); else - name = g_strdup(info->room->name); + name = g_strdup(purple_roomlist_room_get_name(info->room)); - purple_blist_request_add_chat(info->list->account, NULL, NULL, name); + purple_blist_request_add_chat(account, NULL, NULL, name); g_free(name); } @@ -247,7 +248,7 @@ static void do_add_room_cb(GtkWidget *w, struct _menu_cb_info *info) static void add_room_to_blist_cb(GtkButton *button, PidginRoomlistDialog *dialog) { PurpleRoomlist *rl = dialog->roomlist; - PidginRoomlist *grl = rl->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(rl); struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info"); if(info != NULL) @@ -262,7 +263,7 @@ static void do_join_cb(GtkWidget *w, struct _menu_cb_info *info) static void join_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) { PurpleRoomlist *rl = dialog->roomlist; - PidginRoomlist *grl = rl->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(rl); struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info"); if(info != NULL) @@ -272,7 +273,7 @@ static void join_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *arg2, PurpleRoomlist *list) { - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); GtkTreeIter iter; PurpleRoomlistRoom *room; GValue val; @@ -282,7 +283,7 @@ static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColu val.g_type = 0; gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) return; info.list = list; @@ -294,7 +295,7 @@ static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColu static gboolean room_click_cb(GtkWidget *tv, GdkEventButton *event, PurpleRoomlist *list) { GtkTreePath *path; - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); GValue val; PurpleRoomlistRoom *room; GtkTreeIter iter; @@ -313,7 +314,7 @@ static gboolean room_click_cb(GtkWidget *tv, GdkEventButton *event, PurpleRoomli gtk_tree_model_get_value (GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) return FALSE; info.list = list; @@ -341,9 +342,9 @@ static void row_expanded_cb(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePat gtk_tree_model_get_value(gtk_tree_view_get_model(treeview), arg1, ROOM_COLUMN, &val); category = g_value_get_pointer(&val); - if (!category->expanded_once) { + if (!purple_roomlist_room_get_expanded_once(category)) { purple_roomlist_expand_category(list, category); - category->expanded_once = TRUE; + purple_roomlist_room_set_expanded_once(category, TRUE); } } @@ -354,7 +355,7 @@ static gboolean pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) { PurpleRoomlist *list = user_data; - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); GtkStyle *style; int current_height, max_width; int max_text_width; @@ -393,7 +394,7 @@ pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) static gboolean pidgin_roomlist_create_tip(PurpleRoomlist *list, GtkTreePath *path) { - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); PurpleRoomlistRoom *room; GtkTreeIter iter; GValue val; @@ -414,19 +415,23 @@ static gboolean pidgin_roomlist_create_tip(PurpleRoomlist *list, GtkTreePath *pa gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) return FALSE; tooltip_text = g_string_new(""); gtk_tree_model_get(GTK_TREE_MODEL(grl->model), &iter, NAME_COLUMN, &name, -1); - for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) { + for (j = NUM_OF_COLUMNS, + l = purple_roomlist_room_get_fields(room), + k = purple_roomlist_get_fields(list); + l && k; j++, l = l->next, k = k->next) + { PurpleRoomlistField *f = k->data; gchar *label; - if (f->hidden) + if (purple_roomlist_field_get_hidden(f)) continue; - label = g_markup_escape_text(f->label, -1); - switch (f->type) { + label = g_markup_escape_text(purple_roomlist_field_get_label(f), -1); + switch (purple_roomlist_field_get_type(f)) { case PURPLE_ROOMLIST_FIELD_BOOL: g_string_append_printf(tooltip_text, "%s%s: %s", first ? "" : "\n", label, l->data ? "True" : "False"); break; @@ -478,7 +483,7 @@ pidgin_roomlist_create_tooltip(GtkWidget *widget, GtkTreePath *path, gpointer data, int *w, int *h) { PurpleRoomlist *list = data; - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); grl->tipwindow = widget; if (!pidgin_roomlist_create_tip(data, path)) return FALSE; @@ -622,7 +627,7 @@ static void pidgin_roomlist_new(PurpleRoomlist *list) { PidginRoomlist *rl = g_new0(PidginRoomlist, 1); - list->ui_data = rl; + purple_roomlist_set_ui_data(list, rl); rl->cats = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)gtk_tree_row_reference_free); @@ -685,7 +690,7 @@ _search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *it static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) { - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); gint columns = NUM_OF_COLUMNS; int j; GtkTreeStore *model; @@ -707,7 +712,7 @@ static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { PurpleRoomlistField *f = l->data; - switch (f->type) { + switch (purple_roomlist_field_get_type(f)) { case PURPLE_ROOMLIST_FIELD_BOOL: types[j] = G_TYPE_BOOLEAN; break; @@ -749,18 +754,19 @@ static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { PurpleRoomlistField *f = l->data; - if (f->hidden) + if (purple_roomlist_field_get_hidden(f)) continue; renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(f->label, renderer, - "text", j, NULL); + column = gtk_tree_view_column_new_with_attributes( + purple_roomlist_field_get_label(f), renderer, + "text", j, NULL); gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), GTK_TREE_VIEW_COLUMN_GROW_ONLY); gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), j); gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE); - if (f->type == PURPLE_ROOMLIST_FIELD_INT) { + if (purple_roomlist_field_get_type(f) == PURPLE_ROOMLIST_FIELD_INT) { gtk_tree_view_column_set_cell_data_func(column, renderer, int_cell_data_func, GINT_TO_POINTER(j), NULL); gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model), j, int_sort_func, @@ -789,7 +795,7 @@ static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) static gboolean pidgin_progress_bar_pulse(gpointer data) { PurpleRoomlist *list = data; - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); if (!rl || !rl->dialog || !rl->dialog->pg_needs_pulse) { if (rl && rl->dialog) @@ -805,7 +811,7 @@ static gboolean pidgin_progress_bar_pulse(gpointer data) static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *room) { - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); GtkTreeRowReference *rr, *parentrr = NULL; GtkTreePath *path; GtkTreeIter iter, parent, child; @@ -814,7 +820,7 @@ static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *r gboolean append = TRUE; rl->total_rooms++; - if (room->type == PURPLE_ROOMLIST_ROOMTYPE_ROOM) + if (purple_roomlist_room_get_type(room) == PURPLE_ROOMLIST_ROOMTYPE_ROOM) rl->num_rooms++; if (rl->dialog) { @@ -826,8 +832,8 @@ static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *r rl->dialog->pg_needs_pulse = TRUE; } - if (room->parent) { - parentrr = g_hash_table_lookup(rl->cats, room->parent); + if (purple_roomlist_room_get_parent(room)) { + parentrr = g_hash_table_lookup(rl->cats, purple_roomlist_room_get_parent(room)); path = gtk_tree_row_reference_get_path(parentrr); if (path) { PurpleRoomlistRoom *tmproom = NULL; @@ -848,24 +854,28 @@ static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *r else iter = child; - if (room->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) + if (purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) gtk_tree_store_append(rl->model, &child, &iter); path = gtk_tree_model_get_path(GTK_TREE_MODEL(rl->model), &iter); - if (room->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) { + if (purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) { rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(rl->model), path); g_hash_table_insert(rl->cats, room, rr); } gtk_tree_path_free(path); - gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, room->name, -1); + gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, purple_roomlist_room_get_name(room), -1); gtk_tree_store_set(rl->model, &iter, ROOM_COLUMN, room, -1); - for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) { + for (j = NUM_OF_COLUMNS, + l = purple_roomlist_room_get_fields(room), + k = purple_roomlist_get_fields(list); + l && k; j++, l = l->next, k = k->next) + { PurpleRoomlistField *f = k->data; - if (f->hidden) + if (purple_roomlist_field_get_hidden(f)) continue; gtk_tree_store_set(rl->model, &iter, j, l->data, -1); } @@ -873,7 +883,7 @@ static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *r static void pidgin_roomlist_in_progress(PurpleRoomlist *list, gboolean in_progress) { - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); if (!rl || !rl->dialog) return; @@ -895,7 +905,7 @@ static void pidgin_roomlist_in_progress(PurpleRoomlist *list, gboolean in_progre static void pidgin_roomlist_destroy(PurpleRoomlist *list) { - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); roomlists = g_list_remove(roomlists, list); @@ -903,7 +913,7 @@ static void pidgin_roomlist_destroy(PurpleRoomlist *list) g_hash_table_destroy(rl->cats); g_free(rl); - list->ui_data = NULL; + purple_roomlist_set_ui_data(list, NULL); } static PurpleRoomlistUiOps ops = { -- cgit v1.2.1 From 1e695ae3afde707db8193c73b9fdc5bad60c834c Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Tue, 23 Aug 2011 06:18:42 +0000 Subject: If we don't find an IM theme warn the user and continue. --- pidgin/plugins/adiumthemes/webkit.c | 1 - 1 file changed, 1 deletion(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 117ca7746a..442fa26c35 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -559,7 +559,6 @@ style_set_default () _("Can't find installed styles"), _("Please install some theme and verify the installation path")); - return; } /* pick any one that works. Note that we have first preference -- cgit v1.2.1 From 5fe558b479a93bd7871f92d2a783cddce50efd5b Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Tue, 23 Aug 2011 06:21:27 +0000 Subject: Handle better webkit's navigation-policy-decision-requested signal to be able to manage external files, links and theme files. --- pidgin/gtkwebview.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index fa4f9fd299..9647c01f57 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -184,12 +184,19 @@ webview_link_clicked (WebKitWebView *view, WebKitWebPolicyDecision *policy_decision) { const gchar *uri; + WebKitWebNavigationReason reason; uri = webkit_network_request_get_uri (request); + reason = webkit_web_navigation_action_get_reason(navigation_action); + + if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) { + /* the gtk imhtml way was to create an idle cb, not sure + * why, so right now just using purple_notify_uri directly */ + purple_notify_uri (NULL, uri); + } + + webkit_web_policy_decision_use(policy_decision); - /* the gtk imhtml way was to create an idle cb, not sure - * why, so right now just using purple_notify_uri directly */ - purple_notify_uri (NULL, uri); return TRUE; } -- cgit v1.2.1 From f2e8f72609b68a28ab469bc638e0af785823c703 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 23 Aug 2011 08:23:36 +0000 Subject: Rather use the accessor function purple_account_get_username(). --- libpurple/protocols/mxit/login.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index 509d58beee..26bd01adec 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -53,13 +53,14 @@ static struct MXitSession* mxit_create_object( PurpleAccount* account ) PurpleConnection* con = NULL; /* currently the wapsite does not handle a '+' in front of the username (mxitid) so we just strip it */ - if ( account->username[0] == '+' ) { - char* fixed; + { + const char* username = purple_account_get_username( account ); - /* cut off the '+' */ - fixed = g_strdup( &account->username[1] ); - purple_account_set_username( account, fixed ); - g_free( fixed ); + if ( username[0] == '+' ) { + char* fixed = g_strdup( &account->username[1] ); + purple_account_set_username( account, fixed ); + g_free( fixed ); + } } session = g_new0( struct MXitSession, 1 ); -- cgit v1.2.1 From f286036eaec3a075f07038193629d51890b1bd22 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 23 Aug 2011 08:33:52 +0000 Subject: Fixed properly now. --- libpurple/protocols/mxit/login.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index 26bd01adec..d581ac1b4f 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -57,7 +57,7 @@ static struct MXitSession* mxit_create_object( PurpleAccount* account ) const char* username = purple_account_get_username( account ); if ( username[0] == '+' ) { - char* fixed = g_strdup( &account->username[1] ); + char* fixed = g_strdup( &username[1] ); purple_account_set_username( account, fixed ); g_free( fixed ); } -- cgit v1.2.1 From 79e3011ee9cec5e1aeae01e8a1c46991816e58ce Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 23 Aug 2011 20:43:41 +0000 Subject: Don't access PurpleConnection->proto_data directly, rather use the access functions. --- libpurple/protocols/mxit/actions.c | 14 +++++++------- libpurple/protocols/mxit/filexfer.c | 2 +- libpurple/protocols/mxit/login.c | 17 +++++++---------- libpurple/protocols/mxit/multimx.c | 10 +++++----- libpurple/protocols/mxit/mxit.c | 27 ++++++++++++--------------- libpurple/protocols/mxit/roster.c | 10 +++++----- libpurple/protocols/mxit/splashscreen.c | 2 +- libpurple/protocols/mxit/voicevideo.c | 2 +- 8 files changed, 39 insertions(+), 45 deletions(-) diff --git a/libpurple/protocols/mxit/actions.c b/libpurple/protocols/mxit/actions.c index 40d1d449db..db36259b3d 100644 --- a/libpurple/protocols/mxit/actions.c +++ b/libpurple/protocols/mxit/actions.c @@ -43,7 +43,7 @@ */ static void mxit_profile_cb( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ) ; PurpleRequestField* field = NULL; const char* name = NULL; const char* bday = NULL; @@ -200,7 +200,7 @@ out: static void mxit_profile_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); struct MXitProfile* profile = session->profile; PurpleRequestFields* fields = NULL; @@ -297,7 +297,7 @@ static void mxit_profile_action( PurplePluginAction* action ) */ static void mxit_change_pin_cb( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* pin = NULL; const char* pin2 = NULL; const char* err = NULL; @@ -359,7 +359,7 @@ out: static void mxit_change_pin_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleRequestFields* fields = NULL; PurpleRequestFieldGroup* group = NULL; @@ -395,7 +395,7 @@ static void mxit_change_pin_action( PurplePluginAction* action ) static void mxit_splash_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); if ( splash_current( session ) != NULL ) splash_display( session ); @@ -432,7 +432,7 @@ static void mxit_about_action( PurplePluginAction* action ) static void mxit_suggested_friends_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, @@ -449,7 +449,7 @@ static void mxit_suggested_friends_action( PurplePluginAction* action ) */ static void mxit_user_search_cb( PurpleConnection *gc, const char *input ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, diff --git a/libpurple/protocols/mxit/filexfer.c b/libpurple/protocols/mxit/filexfer.c index bc053fa752..f270ab23a2 100644 --- a/libpurple/protocols/mxit/filexfer.c +++ b/libpurple/protocols/mxit/filexfer.c @@ -295,7 +295,7 @@ gboolean mxit_xfer_enabled( PurpleConnection* gc, const char* who ) */ PurpleXfer* mxit_xfer_new( PurpleConnection* gc, const char* who ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleXfer* xfer = NULL; struct mxitxfer* mx = NULL; diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index 509d58beee..ae817d1cad 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -49,8 +49,8 @@ static void get_clientinfo( struct MXitSession* session ); */ static struct MXitSession* mxit_create_object( PurpleAccount* account ) { + PurpleConnection* con = purple_account_get_connection( account ); struct MXitSession* session = NULL; - PurpleConnection* con = NULL; /* currently the wapsite does not handle a '+' in front of the username (mxitid) so we just strip it */ if ( account->username[0] == '+' ) { @@ -63,15 +63,12 @@ static struct MXitSession* mxit_create_object( PurpleAccount* account ) } session = g_new0( struct MXitSession, 1 ); + session->con = con; + session->acc = account; /* configure the connection (reference: "libpurple/connection.h") */ - con = purple_account_get_connection( account ); - con->proto_data = session; + purple_connection_set_protocol_data( con, session ); con->flags |= PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_SUPPORT_MOODS; - session->con = con; - - /* add account */ - session->acc = account; /* configure the session (reference: "libpurple/account.h") */ g_strlcpy( session->server, purple_account_get_string( account, MXIT_CONFIG_SERVER_ADDR, DEFAULT_SERVER ), sizeof( session->server ) ); @@ -221,7 +218,7 @@ static void mxit_login_connect( struct MXitSession* session ) */ static void mxit_cb_register_ok( PurpleConnection *gc, PurpleRequestFields *fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); struct MXitProfile* profile = session->profile; const char* str; const char* pin; @@ -507,7 +504,7 @@ static void free_logindata( struct login_data* data ) */ static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleUtilFetchUrlData* url_data; PurpleRequestField* field; const char* captcha_resp; @@ -571,7 +568,7 @@ static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* field */ static void mxit_cb_captcha_cancel( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); /* free up the login resources */ free_logindata( session->logindata ); diff --git a/libpurple/protocols/mxit/multimx.c b/libpurple/protocols/mxit/multimx.c index 27f6625e66..09691abcb8 100644 --- a/libpurple/protocols/mxit/multimx.c +++ b/libpurple/protocols/mxit/multimx.c @@ -458,7 +458,7 @@ GList* mxit_chat_info(PurpleConnection *gc) */ void mxit_chat_join(PurpleConnection *gc, GHashTable *components) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); const char* roomname = NULL; struct multimx* multimx = NULL; @@ -500,7 +500,7 @@ void mxit_chat_join(PurpleConnection *gc, GHashTable *components) */ void mxit_chat_reject(PurpleConnection *gc, GHashTable* components) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); const char* roomname = NULL; struct multimx* multimx = NULL; @@ -543,7 +543,7 @@ char* mxit_chat_name(GHashTable *components) */ void mxit_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *username) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); struct multimx* multimx = NULL; PurpleBuddy* buddy; PurpleConversation *convo; @@ -589,7 +589,7 @@ void mxit_chat_invite(PurpleConnection *gc, int id, const char *msg, const char */ void mxit_chat_leave(PurpleConnection *gc, int id) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); struct multimx* multimx = NULL; purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i leave\n", id); @@ -620,7 +620,7 @@ void mxit_chat_leave(PurpleConnection *gc, int id) */ int mxit_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); struct multimx* multimx = NULL; const char* nickname; diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index a5df606f9b..fd53b0a9cd 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -58,7 +58,7 @@ static int not_link_ref_count = 0; static void* mxit_link_click( const char* link64 ) { PurpleAccount* account; - PurpleConnection* con; + PurpleConnection* gc; gchar** parts = NULL; gchar* link = NULL; gsize len; @@ -91,15 +91,15 @@ static void* mxit_link_click( const char* link64 ) account = purple_accounts_find( parts[1], parts[2] ); if ( !account ) goto skip; - con = purple_account_get_connection( account ); - if ( !con ) + gc = purple_account_get_connection( account ); + if ( !gc ) goto skip; /* determine if it's a command-response to send */ is_command = ( atoi( parts[4] ) == 1 ); /* send click message back to MXit */ - mxit_send_message( con->proto_data, parts[3], parts[5], FALSE, is_command ); + mxit_send_message( purple_connection_get_protocol_data( gc ), parts[3], parts[5], FALSE, is_command ); g_free( link ); link = NULL; @@ -370,7 +370,7 @@ static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboole */ static void mxit_close( PurpleConnection* gc ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); /* disable signals */ mxit_disable_signals( session ); @@ -406,7 +406,7 @@ static int mxit_send_im( PurpleConnection* gc, const char* who, const char* mess { purple_debug_info( MXIT_PLUGIN_ID, "Sending message '%s' to buddy '%s'\n", message, who ); - mxit_send_message( gc->proto_data, who, message, TRUE, FALSE ); + mxit_send_message( purple_connection_get_protocol_data( gc ), who, message, TRUE, FALSE ); return 1; /* echo to conversation window */ } @@ -420,7 +420,7 @@ static int mxit_send_im( PurpleConnection* gc, const char* who, const char* mess */ static void mxit_set_status( PurpleAccount* account, PurpleStatus* status ) { - struct MXitSession* session = purple_account_get_connection( account )->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( purple_account_get_connection( account ) ); const char* statusid; int presence; char* statusmsg1; @@ -513,7 +513,7 @@ static void mxit_free_buddy( PurpleBuddy* buddy ) */ static void mxit_keepalive( PurpleConnection *gc ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); /* if not logged in, there is nothing to do */ if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) ) @@ -541,7 +541,7 @@ static void mxit_keepalive( PurpleConnection *gc ) */ static void mxit_set_buddy_icon( PurpleConnection *gc, PurpleStoredImage *img ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); if ( img == NULL ) mxit_set_avatar( session, NULL, 0 ); @@ -560,7 +560,7 @@ static void mxit_get_info( PurpleConnection *gc, const char *who ) { PurpleBuddy* buddy; struct contact* contact; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_LASTSEEN, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, CP_PROFILE_WHEREAMI, CP_PROFILE_ABOUTME }; @@ -611,13 +611,10 @@ static GHashTable* mxit_get_text_table( PurpleAccount* acc ) static void mxit_reinvite( PurpleBlistNode *node, gpointer ignored ) { PurpleBuddy* buddy = (PurpleBuddy *) node; - PurpleConnection* gc; - struct MXitSession* session; + PurpleConnection* gc = purple_account_get_connection( purple_buddy_get_account( buddy ) ); + struct MXitSession* session = purple_connection_get_protocol_data( gc ); struct contact* contact; - gc = purple_account_get_connection( purple_buddy_get_account( buddy ) ); - session = gc->proto_data; - contact = purple_buddy_get_protocol_data( (PurpleBuddy*) node ); if ( !contact ) return; diff --git a/libpurple/protocols/mxit/roster.c b/libpurple/protocols/mxit/roster.c index 3922a42b5c..253b04788d 100644 --- a/libpurple/protocols/mxit/roster.c +++ b/libpurple/protocols/mxit/roster.c @@ -728,7 +728,7 @@ gboolean is_mxit_chatroom_contact( struct MXitSession* session, const char* user */ void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group, const char* message ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); GSList* list = NULL; PurpleBuddy* mxbuddy = NULL; unsigned int i; @@ -804,7 +804,7 @@ void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* grou */ void mxit_remove_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const gchar * buddy_name = purple_buddy_get_name( buddy ); purple_debug_info( MXIT_PLUGIN_ID, "mxit_remove_buddy '%s'\n", buddy_name ); @@ -822,7 +822,7 @@ void mxit_remove_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* g */ void mxit_buddy_alias( PurpleConnection* gc, const char* who, const char* alias ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleBuddy* buddy = NULL; PurpleGroup* group = NULL; @@ -856,7 +856,7 @@ void mxit_buddy_alias( PurpleConnection* gc, const char* who, const char* alias */ void mxit_buddy_group( PurpleConnection* gc, const char* who, const char* old_group, const char* new_group ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleBuddy* buddy = NULL; purple_debug_info( MXIT_PLUGIN_ID, "mxit_buddy_group from '%s' to '%s'\n", old_group, new_group ); @@ -883,7 +883,7 @@ void mxit_buddy_group( PurpleConnection* gc, const char* who, const char* old_gr */ void mxit_rename_group( PurpleConnection* gc, const char* old_name, PurpleGroup* group, GList* moved_buddies ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleBuddy* buddy = NULL; GList* item = NULL; diff --git a/libpurple/protocols/mxit/splashscreen.c b/libpurple/protocols/mxit/splashscreen.c index 9706e33f82..d7e9c04fb6 100644 --- a/libpurple/protocols/mxit/splashscreen.c +++ b/libpurple/protocols/mxit/splashscreen.c @@ -144,7 +144,7 @@ void splash_update(struct MXitSession* session, const char* splashId, const char */ static void splash_click_ok(PurpleConnection* gc, PurpleRequestFields* fields) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); const char* splashId; /* Get current splash ID */ diff --git a/libpurple/protocols/mxit/voicevideo.c b/libpurple/protocols/mxit/voicevideo.c index 246d14671d..9c6581900e 100644 --- a/libpurple/protocols/mxit/voicevideo.c +++ b/libpurple/protocols/mxit/voicevideo.c @@ -63,7 +63,7 @@ gboolean mxit_video_enabled(void) */ PurpleMediaCaps mxit_media_caps(PurpleAccount *account, const char *who) { - struct MXitSession* session = purple_account_get_connection(account)->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(purple_account_get_connection(account)); PurpleBuddy* buddy; struct contact* contact; PurpleMediaCaps capa = PURPLE_MEDIA_CAPS_NONE; -- cgit v1.2.1 From 35ddda7c791822e92987be533d01c37a2c99a073 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 23 Aug 2011 20:48:43 +0000 Subject: Don't access PurpleBuddy->proto_data directly, rather use the accessor functions. --- libpurple/protocols/mxit/roster.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libpurple/protocols/mxit/roster.c b/libpurple/protocols/mxit/roster.c index 253b04788d..664f687aae 100644 --- a/libpurple/protocols/mxit/roster.c +++ b/libpurple/protocols/mxit/roster.c @@ -312,8 +312,8 @@ static PurpleBuddy* mxit_update_buddy_group( struct MXitSession* session, Purple /* create new buddy */ newbuddy = purple_buddy_new( session->acc, buddy->name, buddy->alias ); - newbuddy->proto_data = buddy->proto_data; - buddy->proto_data = NULL; + purple_buddy_set_protocol_data( newbuddy, purple_buddy_get_protocol_data( buddy ) ); + purple_buddy_set_protocol_data( buddy, NULL ); /* remove the buddy */ purple_blist_remove_buddy( buddy ); @@ -396,7 +396,7 @@ void mxit_update_contact( struct MXitSession* session, struct contact* contact ) /* create new buddy */ buddy = purple_buddy_new( session->acc, contact->username, contact->alias ); - purple_buddy_set_protocol_data(buddy, contact); + purple_buddy_set_protocol_data( buddy, contact ); /* add new buddy to list */ purple_blist_add_buddy( buddy, NULL, group, NULL ); -- cgit v1.2.1 From 1927b6a6299e6aa8b0a40e198c9e12ae4cb20387 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 23 Aug 2011 20:57:19 +0000 Subject: Rather access PurpleBuddy->proto_data using the accessor functions. --- libpurple/protocols/mxit/roster.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libpurple/protocols/mxit/roster.c b/libpurple/protocols/mxit/roster.c index 664f687aae..d815be0f23 100644 --- a/libpurple/protocols/mxit/roster.c +++ b/libpurple/protocols/mxit/roster.c @@ -293,14 +293,15 @@ static void dump_contact( struct contact* contact ) */ static PurpleBuddy* mxit_update_buddy_group( struct MXitSession* session, PurpleBuddy* buddy, PurpleGroup* group ) { - struct contact* contact = NULL; PurpleGroup* current_group = purple_buddy_get_group( buddy ); - PurpleBuddy* newbuddy = NULL; /* make sure the groups actually differs */ if ( strcmp( current_group->name, group->name ) != 0 ) { /* groupnames does not match, so we need to make the update */ + struct contact* contact = purple_buddy_get_protocol_data( buddy ); + PurpleBuddy* newbuddy = NULL; + purple_debug_info( MXIT_PLUGIN_ID, "Moving '%s' from group '%s' to '%s'\n", buddy->alias, current_group->name, group->name ); /* @@ -310,9 +311,9 @@ static PurpleBuddy* mxit_update_buddy_group( struct MXitSession* session, Purple * again. This is really not ideal and very irritating, but how else then? */ - /* create new buddy */ + /* create new buddy, and transfer 'contact' data */ newbuddy = purple_buddy_new( session->acc, buddy->name, buddy->alias ); - purple_buddy_set_protocol_data( newbuddy, purple_buddy_get_protocol_data( buddy ) ); + purple_buddy_set_protocol_data( newbuddy, contact ); purple_buddy_set_protocol_data( buddy, NULL ); /* remove the buddy */ @@ -322,7 +323,6 @@ static PurpleBuddy* mxit_update_buddy_group( struct MXitSession* session, Purple purple_blist_add_buddy( newbuddy, NULL, group, NULL ); /* now re-instate his presence again */ - contact = newbuddy->proto_data; if ( contact ) { /* update the buddy's status (reference: "libpurple/prpl.h") */ -- cgit v1.2.1 From af9c6474ff2d7cfbf99440d8436ce297ece41676 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 23 Aug 2011 21:06:12 +0000 Subject: Use accessor functions where available. --- libpurple/protocols/mxit/filexfer.c | 2 +- libpurple/protocols/mxit/login.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/protocols/mxit/filexfer.c b/libpurple/protocols/mxit/filexfer.c index f270ab23a2..9b47caafeb 100644 --- a/libpurple/protocols/mxit/filexfer.c +++ b/libpurple/protocols/mxit/filexfer.c @@ -395,7 +395,7 @@ static PurpleXfer* find_mxit_xfer( struct MXitSession* session, const char* file while ( item ) { xfer = item->data; - if ( xfer->account == session->acc ) { + if ( purple_xfer_get_account( xfer ) == session->acc ) { /* transfer is associated with this MXit account */ struct mxitxfer* mx = xfer->data; diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index ae817d1cad..db68887d05 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -300,7 +300,7 @@ static void mxit_cb_register_cancel( PurpleConnection *gc, PurpleRequestFields * purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_register_cancel\n" ); /* disconnect */ - purple_account_disconnect( gc->account ); + purple_account_disconnect( purple_connection_get_account( gc ) ); } -- cgit v1.2.1 From 8f6e4cce558b23746be046d3b983bcd6d9784995 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 23 Aug 2011 21:39:07 +0000 Subject: Use PurpleXfer accessor functions. --- libpurple/protocols/mxit/filexfer.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/mxit/filexfer.c b/libpurple/protocols/mxit/filexfer.c index 9b47caafeb..6ebc982f8c 100644 --- a/libpurple/protocols/mxit/filexfer.c +++ b/libpurple/protocols/mxit/filexfer.c @@ -126,7 +126,7 @@ static void mxit_xfer_init( PurpleXfer* xfer ) if ( purple_xfer_get_size( xfer ) > CP_MAX_FILESIZE ) { /* the file is too big */ - purple_xfer_error( xfer->type, xfer->account, xfer->who, _( "The file you are trying to send is too large!" ) ); + purple_xfer_error( purple_xfer_get_type( xfer ), purple_xfer_get_account( xfer ), purple_xfer_get_remote_user( xfer ), _( "The file you are trying to send is too large!" ) ); purple_xfer_cancel_local( xfer ); return; } @@ -151,6 +151,7 @@ static void mxit_xfer_init( PurpleXfer* xfer ) */ static void mxit_xfer_start( PurpleXfer* xfer ) { + size_t filesize; unsigned char* buffer; int size; int wrote; @@ -163,10 +164,12 @@ static void mxit_xfer_start( PurpleXfer* xfer ) * a buffer and copy the file data into memory and then we can send it to * the contact. we will send the whole file with one go. */ - buffer = g_malloc( xfer->bytes_remaining ); - size = fread( buffer, xfer->bytes_remaining, 1, xfer->dest_fp ); + filesize = purple_xfer_get_bytes_remaining( xfer ); + buffer = g_malloc( filesize ); + size = fread( buffer, filesize, 1, xfer->dest_fp ); + // TODO: If (size != 1) -> file read error - wrote = purple_xfer_write( xfer, buffer, xfer->bytes_remaining ); + wrote = purple_xfer_write( xfer, buffer, filesize ); if ( wrote > 0 ) purple_xfer_set_bytes_sent( xfer, wrote ); @@ -437,6 +440,7 @@ void mxit_xfer_rx_file( struct MXitSession* session, const char* fileid, const c purple_xfer_ref( xfer ); purple_xfer_start( xfer, -1, NULL, 0 ); fwrite( data, datalen, 1, xfer->dest_fp ); + // TODO: Handle error from fwrite() purple_xfer_unref( xfer ); purple_xfer_set_completed( xfer, TRUE ); purple_xfer_end( xfer ); -- cgit v1.2.1 From 6e9b77505d4cc3a7322fe8d70da5e5abd0dec097 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 24 Aug 2011 03:09:22 +0000 Subject: 'U' messages don't get ack'd, so they shouldn't be saved. applied changes from 5df306b350eb432c548eb847b9c69b7c16198417 through fa5f3108fa8faf96b2a699d4e74e0fbf7f302b85 --- libpurple/protocols/msn/sbconn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libpurple/protocols/msn/sbconn.c b/libpurple/protocols/msn/sbconn.c index a9a6288844..3acb5dd217 100644 --- a/libpurple/protocols/msn/sbconn.c +++ b/libpurple/protocols/msn/sbconn.c @@ -121,6 +121,8 @@ release_msg(MsnSwitchBoard *swboard, MsnMessage *msg) } #endif } + } else { + msn_transaction_set_saveable(trans, FALSE); } trans->payload = payload; -- cgit v1.2.1 From e37355151e951744dba7a07db6bfe5708337f9df Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 24 Aug 2011 03:30:47 +0000 Subject: Fix the _add_pair_html/plaintext calls. --- libpurple/protocols/msn/msn.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index f05aee31ce..bd42ae7d03 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -1101,8 +1101,6 @@ msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean f } if (currentmedia) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair_html(user_info, mediatype, currentmedia); g_free(currentmedia); } @@ -1129,23 +1127,17 @@ msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean f phone = msn_user_get_home_phone(user); if (phone != NULL) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html(user_info, _("Home Phone Number"), phone); + purple_notify_user_info_add_pair_plaintext(user_info, _("Home Phone Number"), phone); } phone = msn_user_get_work_phone(user); if (phone != NULL) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html(user_info, _("Work Phone Number"), phone); + purple_notify_user_info_add_pair_plaintext(user_info, _("Work Phone Number"), phone); } phone = msn_user_get_mobile_phone(user); if (phone != NULL) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html(user_info, _("Mobile Phone Number"), phone); + purple_notify_user_info_add_pair_plaintext(user_info, _("Mobile Phone Number"), phone); } } } -- cgit v1.2.1 From 4afa6dcbf8e8c751427562838db1e54f6d4bab21 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 24 Aug 2011 03:52:06 +0000 Subject: Allow toggling debug and verbose debug from a conversation window. --- pidgin/gtkconv.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 46d8d5998c..c8f431a04d 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -356,8 +356,32 @@ debug_command_cb(PurpleConversation *conv, } tmp = g_string_free(str, FALSE); + } else if (!g_ascii_strcasecmp(args[0], "unsafe")) { + if (purple_debug_is_unsafe()) { + purple_debug_set_unsafe(FALSE); + purple_conversation_write(conv, NULL, _("Unsafe debugging is now disabled."), + PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL)); + } else { + purple_debug_set_unsafe(TRUE); + purple_conversation_write(conv, NULL, _("Unsafe debugging is now enabled."), + PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL)); + } + + return PURPLE_CMD_RET_OK; + } else if (!g_ascii_strcasecmp(args[0], "verbose")) { + if (purple_debug_is_verbose()) { + purple_debug_set_verbose(FALSE); + purple_conversation_write(conv, NULL, _("Verbose debugging is now disabled."), + PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL)); + } else { + purple_debug_set_verbose(TRUE); + purple_conversation_write(conv, NULL, _("Verbose debugging is now enabled."), + PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL)); + } + + return PURPLE_CMD_RET_OK; } else { - purple_conversation_write(conv, NULL, _("Supported debug options are: plugins version"), + purple_conversation_write(conv, NULL, _("Supported debug options are: plugins version unsafe verbose"), PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL)); return PURPLE_CMD_RET_OK; } -- cgit v1.2.1 From 068df5e06b72e400a09dbec1b8103b126ea48033 Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Wed, 24 Aug 2011 04:38:46 +0000 Subject: I want to play hide-a-struct too --- libpurple/pounce.c | 25 +++++++++++++++++++++++++ libpurple/pounce.h | 25 ------------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/libpurple/pounce.c b/libpurple/pounce.c index 7b150e98a9..c8f5f67436 100644 --- a/libpurple/pounce.c +++ b/libpurple/pounce.c @@ -32,6 +32,31 @@ #include "pounce.h" #include "util.h" +/** + * A buddy pounce structure. + * + * Buddy pounces are actions triggered by a buddy-related event. For + * example, a sound can be played or an IM window opened when a buddy + * signs on or returns from away. Such responses are handled in the + * UI. The events themselves are done in the core. + */ +struct _PurplePounce +{ + char *ui_type; /**< The type of UI. */ + + PurplePounceEvent events; /**< The event(s) to pounce on. */ + PurplePounceOption options; /**< The pounce options */ + PurpleAccount *pouncer; /**< The user who is pouncing. */ + + char *pouncee; /**< The buddy to pounce on. */ + + GHashTable *actions; /**< The registered actions. */ + + gboolean save; /**< Whether or not the pounce should + be saved after activation. */ + void *data; /**< Pounce-specific data. */ +}; + typedef struct { GString *buffer; diff --git a/libpurple/pounce.h b/libpurple/pounce.h index 434fe318bb..2114f7f901 100644 --- a/libpurple/pounce.h +++ b/libpurple/pounce.h @@ -59,31 +59,6 @@ typedef enum /** A pounce callback. */ typedef void (*PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *); -/** - * A buddy pounce structure. - * - * Buddy pounces are actions triggered by a buddy-related event. For - * example, a sound can be played or an IM window opened when a buddy - * signs on or returns from away. Such responses are handled in the - * UI. The events themselves are done in the core. - */ -struct _PurplePounce -{ - char *ui_type; /**< The type of UI. */ - - PurplePounceEvent events; /**< The event(s) to pounce on. */ - PurplePounceOption options; /**< The pounce options */ - PurpleAccount *pouncer; /**< The user who is pouncing. */ - - char *pouncee; /**< The buddy to pounce on. */ - - GHashTable *actions; /**< The registered actions. */ - - gboolean save; /**< Whether or not the pounce should - be saved after activation. */ - void *data; /**< Pounce-specific data. */ -}; - #ifdef __cplusplus extern "C" { #endif -- cgit v1.2.1 From 364f90e311388434001fb9dd66ed1ba28fc1cb1b Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 24 Aug 2011 17:54:39 +0000 Subject: In our forked DNS resolver processes, don't bail out if we get a retryable error while reading from our parent socket. I think EAGAIN and EWOULDBLOCK never happen because this is a non-blocking socket AND because we're using select (seems like we'd be fine using one or the other, and it's not necessary to use both?). I believe this is correct behavior and we should be doing this same thing everywhere we read from sockets. I think we probably don't check for EINTR in many places where we should. --- libpurple/dnsquery.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libpurple/dnsquery.c b/libpurple/dnsquery.c index 18246bc56b..343a07f815 100644 --- a/libpurple/dnsquery.c +++ b/libpurple/dnsquery.c @@ -297,6 +297,10 @@ purple_dnsquery_resolver_run(int child_out, int child_in, gboolean show_debug) } rc = read(child_in, &dns_params, sizeof(dns_params_t)); if (rc < 0) { + if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { + /* Try again */ + continue; + } fprintf(stderr, "dns[%d]: Error: Could not read dns_params: " "%s\n", getpid(), strerror(errno)); break; -- cgit v1.2.1 From 75708a7248b5631ef49d8a9383fc58bdfe89fff6 Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Thu, 25 Aug 2011 04:15:16 +0000 Subject: Hide PurpleValue. --- libpurple/status.c | 18 +++++++++--------- libpurple/value.c | 38 ++++++++++++++++++++++++++++++++++++++ libpurple/value.h | 35 +---------------------------------- 3 files changed, 48 insertions(+), 43 deletions(-) diff --git a/libpurple/status.c b/libpurple/status.c index 6d093c99be..dc3e6ec66c 100644 --- a/libpurple/status.c +++ b/libpurple/status.c @@ -763,29 +763,29 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, specified_attr_ids = g_list_prepend(specified_attr_ids, (gpointer)id); - if (value->type == PURPLE_TYPE_STRING) + if (purple_value_get_type(value) == PURPLE_TYPE_STRING) { const gchar *string_data = l->data; l = l->next; - if (purple_strequal(string_data, value->data.string_data)) + if (purple_strequal(string_data, purple_value_get_string(value))) continue; purple_status_set_attr_string(status, id, string_data); changed = TRUE; } - else if (value->type == PURPLE_TYPE_INT) + else if (purple_value_get_type(value) == PURPLE_TYPE_INT) { int int_data = GPOINTER_TO_INT(l->data); l = l->next; - if (int_data == value->data.int_data) + if (int_data == purple_value_get_int(value)) continue; purple_status_set_attr_int(status, id, int_data); changed = TRUE; } - else if (value->type == PURPLE_TYPE_BOOLEAN) + else if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) { gboolean boolean_data = GPOINTER_TO_INT(l->data); l = l->next; - if (boolean_data == value->data.boolean_data) + if (boolean_data == purple_value_get_boolean(value)) continue; purple_status_set_attr_boolean(status, id, boolean_data); changed = TRUE; @@ -809,7 +809,7 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, if (!g_list_find_custom(specified_attr_ids, attr->id, (GCompareFunc)strcmp)) { PurpleValue *default_value; default_value = purple_status_attr_get_value(attr); - if (default_value->type == PURPLE_TYPE_STRING) { + if (purple_value_get_type(default_value) == PURPLE_TYPE_STRING) { const char *cur = purple_status_get_attr_string(status, attr->id); const char *def = purple_value_get_string(default_value); if ((cur == NULL && def == NULL) @@ -819,14 +819,14 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, } purple_status_set_attr_string(status, attr->id, def); - } else if (default_value->type == PURPLE_TYPE_INT) { + } else if (purple_value_get_type(default_value) == PURPLE_TYPE_INT) { int cur = purple_status_get_attr_int(status, attr->id); int def = purple_value_get_int(default_value); if (cur == def) continue; purple_status_set_attr_int(status, attr->id, def); - } else if (default_value->type == PURPLE_TYPE_BOOLEAN) { + } else if (purple_value_get_type(default_value) == PURPLE_TYPE_BOOLEAN) { gboolean cur = purple_status_get_attr_boolean(status, attr->id); gboolean def = purple_value_get_boolean(default_value); if (cur == def) diff --git a/libpurple/value.c b/libpurple/value.c index c7002c60ed..34ed57baa5 100644 --- a/libpurple/value.c +++ b/libpurple/value.c @@ -29,6 +29,44 @@ #define OUTGOING_FLAG 0x01 +/** + * A wrapper for a type, subtype, and specific type of value. + */ +struct _PurpleValue +{ + PurpleType type; + unsigned short flags; + + union + { + char char_data; + unsigned char uchar_data; + gboolean boolean_data; + short short_data; + unsigned short ushort_data; + int int_data; + unsigned int uint_data; + long long_data; + unsigned long ulong_data; + gint64 int64_data; + guint64 uint64_data; + char *string_data; + void *object_data; + void *pointer_data; + int enum_data; + void *boxed_data; + + } data; + + union + { + unsigned int subtype; + char *specific_type; + + } u; + +}; + PurpleValue * purple_value_new(PurpleType type, ...) { diff --git a/libpurple/value.h b/libpurple/value.h index 155c0146b4..b8724ac40f 100644 --- a/libpurple/value.h +++ b/libpurple/value.h @@ -86,40 +86,7 @@ typedef enum /** * A wrapper for a type, subtype, and specific type of value. */ -typedef struct -{ - PurpleType type; - unsigned short flags; - - union - { - char char_data; - unsigned char uchar_data; - gboolean boolean_data; - short short_data; - unsigned short ushort_data; - int int_data; - unsigned int uint_data; - long long_data; - unsigned long ulong_data; - gint64 int64_data; - guint64 uint64_data; - char *string_data; - void *object_data; - void *pointer_data; - int enum_data; - void *boxed_data; - - } data; - - union - { - unsigned int subtype; - char *specific_type; - - } u; - -} PurpleValue; +typedef struct _PurpleValue PurpleValue; #ifdef __cplusplus extern "C" { -- cgit v1.2.1 From 14355c8f297c7efa695a8f652d7eaea536d9fafd Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Thu, 25 Aug 2011 07:36:54 +0000 Subject: Fix build-breakage introduced by a29e3b71d2aef28d5dba23aaaf32c09d32eec5ef. (pidgin: 9000557e: Hide PurpleValue) --- libpurple/dbus-server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/dbus-server.c b/libpurple/dbus-server.c index 86b8f5e122..3318aa1111 100644 --- a/libpurple/dbus-server.c +++ b/libpurple/dbus-server.c @@ -711,7 +711,7 @@ purple_dbus_message_append_purple_values(DBusMessageIter *iter, g_return_val_if_fail(ptr, TRUE); } - switch (purple_values[i]->type) + switch (purple_value_get_type(purple_values[i])) { case PURPLE_TYPE_INT: case PURPLE_TYPE_ENUM: -- cgit v1.2.1 From 2d0e1689ac104115417e7cdc5cb1aa744ea70303 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Fri, 26 Aug 2011 05:00:46 +0000 Subject: Fix two compile warnings. Did I do that? I totally didn't notice. My bad. roomlist.c: In function ?purple_roomlist_room_get_expanded_once?: roomlist.c:402:2: warning: return makes integer from pointer without a cast roomlist.c: In function ?purple_roomlist_room_set_expanded_once?: roomlist.c:409:2: warning: ?return? with a value, in function returning void --- libpurple/roomlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/roomlist.c b/libpurple/roomlist.c index a1a797c122..ad32d6d30b 100644 --- a/libpurple/roomlist.c +++ b/libpurple/roomlist.c @@ -399,14 +399,14 @@ PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room) gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room) { - g_return_val_if_fail(room != NULL, NULL); + g_return_val_if_fail(room != NULL, FALSE); return room->expanded_once; } void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once) { - g_return_val_if_fail(room != NULL, NULL); + g_return_if_fail(room != NULL); room->expanded_once = expanded_once; } -- cgit v1.2.1 From 1ca7deddc499f46f85ed1648f1c07f3195b7ec12 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Fri, 26 Aug 2011 05:05:30 +0000 Subject: This got hide-a-struct'ed --- ChangeLog.API | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.API b/ChangeLog.API index 1dfd8f1c73..9a9a8886c3 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -71,6 +71,7 @@ version 3.0.0 (??/??/????): purple_util_fetch_url_request_len, insetad. * PurpleConnectionUiOps.report_disconnect_reason * struct _GtkIMHtmlFontDetail + * struct _PurplePounce * struct _PurpleRequestField * struct _PurpleRoomlist * struct _PurpleRoomlistField -- cgit v1.2.1 From dabd2d1455b21f232bfb7ee87e7db009fe466aba Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 17:59:08 +0000 Subject: Introduce API purple_xfer_get_protocol_data() and purple_xfer_set_protocol_data(). --- ChangeLog.API | 2 ++ libpurple/ft.c | 16 ++++++++++++++++ libpurple/ft.h | 20 ++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/ChangeLog.API b/ChangeLog.API index 9a9a8886c3..9c05684c84 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -15,6 +15,8 @@ version 3.0.0 (??/??/????): * purple_roomlist_room_set_expanded_once * purple_roomlist_set_proto_data * purple_roomlist_set_ui_data + * purple_xfer_get_protocol_data + * purple_xfer_set_protocol_data Changed: * purple_connection_error now takes a PurpleConnectionError diff --git a/libpurple/ft.c b/libpurple/ft.c index 598a7c2cf3..cf6dceb3f4 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -1701,6 +1701,22 @@ purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats) } } +void +purple_xfer_set_protocol_data(PurpleXfer *xfer, void *proto_data) +{ + g_return_if_fail(xfer != NULL); + + xfer->data = proto_data; +} + +void * +purple_xfer_get_protocol_data(PurpleXfer *xfer) +{ + g_return_val_if_fail(xfer != NULL, NULL); + + return xfer->data; +} + /************************************************************************** * File Transfer Subsystem API **************************************************************************/ diff --git a/libpurple/ft.h b/libpurple/ft.h index 3636cae247..eabb563361 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -737,6 +737,26 @@ void purple_xfer_set_thumbnail(PurpleXfer *xfer, gconstpointer thumbnail, */ void purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats); +/** + * Sets the protocol data for a file transfer. + * + * @param xfer The file transfer. + * @param protol_data The protocol data to set for the file transfer. + * + * @since 3.0.0 + */ +void purple_xfer_set_protocol_data(PurpleXfer *xfer, void *proto_data); + +/** + * Gets the protocol data for a file transfer. + * + * @param xfer The file transfer. + * + * @return The protocol data for the file transfer. + * + * @since 3.0.0 + */ +void *purple_xfer_get_protocol_data(PurpleXfer *xfer); /*@}*/ -- cgit v1.2.1 From 5dc2c75c87bf229b5a699fc439289e7fe33b7c18 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 18:10:05 +0000 Subject: Convert the mxit prpl to use the new API. --- libpurple/protocols/mxit/filexfer.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libpurple/protocols/mxit/filexfer.c b/libpurple/protocols/mxit/filexfer.c index 6ebc982f8c..61b04186fb 100644 --- a/libpurple/protocols/mxit/filexfer.c +++ b/libpurple/protocols/mxit/filexfer.c @@ -97,11 +97,11 @@ const char* file_mime_type( const char* filename, const char* buf, int buflen ) */ static void mxit_xfer_free( PurpleXfer* xfer ) { - struct mxitxfer* mx = (struct mxitxfer*) xfer->data;; + struct mxitxfer* mx = purple_xfer_get_protocol_data( xfer ); if ( mx ) { + purple_xfer_set_protocol_data( xfer, NULL ); g_free( mx ); - xfer->data = NULL; } } @@ -117,7 +117,7 @@ static void mxit_xfer_free( PurpleXfer* xfer ) */ static void mxit_xfer_init( PurpleXfer* xfer ) { - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; + struct mxitxfer* mx = purple_xfer_get_protocol_data( xfer ); purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_init\n" ); @@ -218,7 +218,7 @@ static void mxit_xfer_cancel_send( PurpleXfer* xfer ) */ static gssize mxit_xfer_write( const guchar* buffer, size_t size, PurpleXfer* xfer ) { - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; + struct mxitxfer* mx = purple_xfer_get_protocol_data( xfer ); purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_write\n" ); @@ -248,7 +248,7 @@ static gssize mxit_xfer_write( const guchar* buffer, size_t size, PurpleXfer* xf */ static void mxit_xfer_request_denied( PurpleXfer* xfer ) { - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; + struct mxitxfer* mx = purple_xfer_get_protocol_data( xfer ); purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_request_denied\n" ); @@ -308,7 +308,7 @@ PurpleXfer* mxit_xfer_new( PurpleConnection* gc, const char* who ) /* create file info and attach it to the file transfer */ mx = g_new0( struct mxitxfer, 1 ); mx->session = session; - xfer->data = mx; + purple_xfer_set_protocol_data( xfer, mx ); /* configure callbacks (reference: "libpurple/ft.h") */ purple_xfer_set_init_fnc( xfer, mxit_xfer_init ); @@ -365,7 +365,7 @@ void mxit_xfer_rx_offer( struct MXitSession* session, const char* username, cons mx = g_new0( struct mxitxfer, 1 ); mx->session = session; memcpy( mx->fileid, fileid, MXIT_CHUNK_FILEID_LEN ); - xfer->data = mx; + purple_xfer_set_protocol_data( xfer, mx ); purple_xfer_set_filename( xfer, filename ); if( filesize > 0 ) @@ -400,7 +400,7 @@ static PurpleXfer* find_mxit_xfer( struct MXitSession* session, const char* file if ( purple_xfer_get_account( xfer ) == session->acc ) { /* transfer is associated with this MXit account */ - struct mxitxfer* mx = xfer->data; + struct mxitxfer* mx = purple_xfer_get_protocol_data( xfer ); /* does the fileid match? */ if ( ( mx ) && ( memcmp( mx->fileid, fileid, MXIT_CHUNK_FILEID_LEN ) == 0 ) ) @@ -434,7 +434,7 @@ void mxit_xfer_rx_file( struct MXitSession* session, const char* fileid, const c /* find the file-transfer object */ xfer = find_mxit_xfer( session, fileid ); if ( xfer ) { - mx = xfer->data; + mx = purple_xfer_get_protocol_data( xfer ); /* this is the transfer we have been looking for */ purple_xfer_ref( xfer ); -- cgit v1.2.1 From b11c1c1016216155f9e0ced90fa5f31eae45a87b Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 18:20:25 +0000 Subject: Convert the bonjour prpl to use the new API. --- libpurple/protocols/bonjour/bonjour_ft.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index 3042dbf18c..2f6037e9f8 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -90,7 +90,7 @@ static void bonjour_xfer_cancel_send(PurpleXfer *xfer) static void bonjour_xfer_request_denied(PurpleXfer *xfer) { - XepXfer *xf = xfer->data; + XepXfer *xf = purple_xfer_get_protocol_data(xfer); purple_debug_info("bonjour", "Bonjour-xfer-request-denied.\n"); @@ -162,7 +162,7 @@ bonjour_si_xfer_find(BonjourData *bd, const char *sid, const char *from) xfer = xfers->data; if(xfer == NULL) break; - xf = xfer->data; + xf = purple_xfer_get_protocol_data(xfer); if(xf == NULL) break; if(xf->sid && xfer->who && !strcmp(xf->sid, sid) && @@ -180,7 +180,7 @@ xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) { xmlnode *si_node, *feature, *field, *file, *x; XepIq *iq; - XepXfer *xf = xfer->data; + XepXfer *xf = purple_xfer_get_protocol_data(xfer); BonjourData *bd = NULL; char buf[32]; @@ -249,7 +249,7 @@ xep_ft_si_result(PurpleXfer *xfer, char *to) if(!to || !xfer) return; - xf = xfer->data; + xf = purple_xfer_get_protocol_data(xfer); if(!xf) return; @@ -292,7 +292,7 @@ bonjour_free_xfer(PurpleXfer *xfer) purple_debug_info("bonjour", "bonjour-free-xfer-%p.\n", xfer); - xf = (XepXfer*)xfer->data; + xf = purple_xfer_get_protocol_data(xfer); if(xf != NULL) { BonjourData *bd = (BonjourData*)xf->data; if(bd != NULL) { @@ -311,7 +311,7 @@ bonjour_free_xfer(PurpleXfer *xfer) g_free(xf->buddy_ip); g_free(xf->sid); g_free(xf); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } purple_debug_info("bonjour", "Need close socket=%d.\n", xfer->fd); @@ -334,7 +334,8 @@ bonjour_new_xfer(PurpleConnection *gc, const char *who) /* Build the file transfer handle */ xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - xfer->data = xep_xfer = g_new0(XepXfer, 1); + xep_xfer = g_new0(XepXfer, 1); + purple_xfer_set_protocol_data(xfer, xep_xfer); xep_xfer->data = bd; purple_debug_info("bonjour", "Bonjour-new-xfer bd=%p data=%p.\n", bd, xep_xfer->data); @@ -379,7 +380,7 @@ bonjour_xfer_init(PurpleXfer *xfer) BonjourBuddy *bb; XepXfer *xf; - xf = (XepXfer*)xfer->data; + xf = purple_xfer_get_protocol_data(xfer); if(xf == NULL) return; @@ -530,7 +531,7 @@ xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) int portnum; XepXfer *xf = NULL; - xf = (XepXfer*)xfer->data; + xf = purple_xfer_get_protocol_data(xfer); for(streamhost = xmlnode_get_child(query, "streamhost"); streamhost; streamhost = xmlnode_get_next_twin(streamhost)) { @@ -592,7 +593,8 @@ bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, cons /* Build the file transfer handle */ xfer = purple_xfer_new(pc->account, PURPLE_XFER_RECEIVE, from); - xfer->data = xf = g_new0(XepXfer, 1); + xf = g_new0(XepXfer, 1); + purple_xfer_set_protocol_data(xfer, xf); xf->data = bd; purple_xfer_set_filename(xfer, filename); xf->iq_id = g_strdup(id); @@ -614,7 +616,7 @@ static void bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - XepXfer *xf = xfer->data; + XepXfer *xf = purple_xfer_get_protocol_data(xfer); int acceptfd; int len = 0; @@ -759,7 +761,7 @@ bonjour_bytestreams_listen(int sock, gpointer data) xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, bonjour_sock5_request_cb, xfer); - xf = (XepXfer*)xfer->data; + xf = purple_xfer_get_protocol_data(xfer); xf->listen_data = NULL; bd = xf->data; @@ -797,7 +799,7 @@ bonjour_bytestreams_init(PurpleXfer *xfer) return; purple_debug_info("bonjour", "Bonjour-bytestreams-init.\n"); - xf = xfer->data; + xf = purple_xfer_get_protocol_data(xfer); purple_network_listen_map_external(FALSE); xf->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, @@ -813,7 +815,7 @@ static void bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) { PurpleXfer *xfer = data; - XepXfer *xf = xfer->data; + XepXfer *xf = purple_xfer_get_protocol_data(xfer); XepIq *iq; xmlnode *q_node, *tmp_node; BonjourData *bd; @@ -862,7 +864,7 @@ bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb) purple_debug_info("bonjour", "bonjour-bytestreams-connect.\n"); - xf = (XepXfer*)xfer->data; + xf = purple_xfer_get_protocol_data(xfer); if(!xf) return; -- cgit v1.2.1 From 871804f9c3f233e48ac86526e410f2ac47670a18 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 18:25:12 +0000 Subject: Convert the irc prpl to use the new API. --- libpurple/protocols/irc/dcc_send.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libpurple/protocols/irc/dcc_send.c b/libpurple/protocols/irc/dcc_send.c index 7082fd3ade..59fd7883eb 100644 --- a/libpurple/protocols/irc/dcc_send.c +++ b/libpurple/protocols/irc/dcc_send.c @@ -38,7 +38,7 @@ struct irc_xfer_rx_data { static void irc_dccsend_recv_destroy(PurpleXfer *xfer) { - struct irc_xfer_rx_data *xd = xfer->data; + struct irc_xfer_rx_data *xd = purple_xfer_get_protocol_data(xfer); g_free(xd->ip); g_free(xd); @@ -62,7 +62,7 @@ static void irc_dccsend_recv_ack(PurpleXfer *xfer, const guchar *data, size_t si } static void irc_dccsend_recv_init(PurpleXfer *xfer) { - struct irc_xfer_rx_data *xd = xfer->data; + struct irc_xfer_rx_data *xd = purple_xfer_get_protocol_data(xfer); purple_xfer_start(xfer, -1, xd->ip, xfer->remote_port); g_free(xd->ip); @@ -114,7 +114,7 @@ void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg) { if (xfer) { xd = g_new0(struct irc_xfer_rx_data, 1); - xfer->data = xd; + purple_xfer_set_protocol_data(xfer, xd); purple_xfer_set_filename(xfer, filename->str); xfer->remote_port = atoi(token[i+1]); @@ -157,7 +157,7 @@ struct irc_xfer_send_data { static void irc_dccsend_send_destroy(PurpleXfer *xfer) { - struct irc_xfer_send_data *xd = xfer->data; + struct irc_xfer_send_data *xd = purple_xfer_get_protocol_data(xfer); if (xd == NULL) return; @@ -178,7 +178,7 @@ static void irc_dccsend_send_destroy(PurpleXfer *xfer) static void irc_dccsend_send_read(gpointer data, int source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - struct irc_xfer_send_data *xd = xfer->data; + struct irc_xfer_send_data *xd = purple_xfer_get_protocol_data(xfer); char buffer[64]; int len; @@ -244,7 +244,7 @@ static gssize irc_dccsend_send_write(const guchar *buffer, size_t size, PurpleXf static void irc_dccsend_send_connected(gpointer data, int source, PurpleInputCondition cond) { PurpleXfer *xfer = (PurpleXfer *) data; - struct irc_xfer_send_data *xd = xfer->data; + struct irc_xfer_send_data *xd = purple_xfer_get_protocol_data(xfer); int conn, flags; conn = accept(xd->fd, NULL, 0); @@ -285,7 +285,7 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) struct in_addr addr; unsigned short int port; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); xd->listen_data = NULL; if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL @@ -294,7 +294,7 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) return; } - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); gc = purple_account_get_connection(purple_xfer_get_account(xfer)); irc = gc->proto_data; @@ -331,7 +331,7 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) */ static void irc_dccsend_send_init(PurpleXfer *xfer) { PurpleConnection *gc = purple_account_get_connection(purple_xfer_get_account(xfer)); - struct irc_xfer_send_data *xd = xfer->data; + struct irc_xfer_send_data *xd = purple_xfer_get_protocol_data(xfer); xfer->filename = g_path_get_basename(xfer->local_filename); @@ -359,7 +359,7 @@ PurpleXfer *irc_dccsend_new_xfer(PurpleConnection *gc, const char *who) { { xd = g_new0(struct irc_xfer_send_data, 1); xd->fd = -1; - xfer->data = xd; + purple_xfer_set_protocol_data(xfer, xd); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, irc_dccsend_send_init); -- cgit v1.2.1 From 00e3a030fd8289a07d9b80e144a09f436189bd5f Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 18:29:21 +0000 Subject: Convert the sametime prpl to use the new API. --- libpurple/protocols/sametime/sametime.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index c501dd0a6f..b45e43044c 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -2139,7 +2139,7 @@ static struct mwServiceConference *mw_srvc_conf_new(struct mwSession *s) { static void ft_incoming_cancel(PurpleXfer *xfer) { /* incoming transfer rejected or cancelled in-progress */ - struct mwFileTransfer *ft = xfer->data; + struct mwFileTransfer *ft = purple_xfer_get_protocol_data(xfer); if(ft) mwFileTransfer_reject(ft); } @@ -2155,7 +2155,7 @@ static void ft_incoming_init(PurpleXfer *xfer) { struct mwFileTransfer *ft; FILE *fp; - ft = xfer->data; + ft = purple_xfer_get_protocol_data(xfer); fp = g_fopen(xfer->local_filename, "wb"); if(! fp) { @@ -2202,7 +2202,7 @@ static void mw_ft_offered(struct mwFileTransfer *ft) { { purple_xfer_ref(xfer); mwFileTransfer_setClientData(ft, xfer, (GDestroyNotify) purple_xfer_unref); - xfer->data = ft; + purple_xfer_set_protocol_data(xfer, ft); purple_xfer_set_init_fnc(xfer, ft_incoming_init); purple_xfer_set_cancel_recv_fnc(xfer, ft_incoming_cancel); @@ -2281,7 +2281,7 @@ static void mw_ft_closed(struct mwFileTransfer *ft, guint32 code) { xfer = mwFileTransfer_getClientData(ft); if(xfer) { - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); if(! mwFileTransfer_getRemaining(ft)) { purple_xfer_set_completed(xfer, TRUE); @@ -5106,14 +5106,14 @@ static void ft_outgoing_init(PurpleXfer *xfer) { purple_xfer_ref(xfer); mwFileTransfer_setClientData(ft, xfer, (GDestroyNotify) purple_xfer_unref); - xfer->data = ft; + purple_xfer_set_protocol_data(xfer, ft); mwFileTransfer_offer(ft); } static void ft_outgoing_cancel(PurpleXfer *xfer) { - struct mwFileTransfer *ft = xfer->data; + struct mwFileTransfer *ft = purple_xfer_get_protocol_data(xfer); DEBUG_INFO("ft_outgoing_cancel called\n"); -- cgit v1.2.1 From e5a068416f2fe5c46975c6ab7e60e3dfae75092b Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 18:37:27 +0000 Subject: Convert the msn prpl to use the new API. --- libpurple/protocols/msn/msn.c | 4 ++-- libpurple/protocols/msn/slp.c | 4 ++-- libpurple/protocols/msn/slpcall.c | 4 ++-- libpurple/protocols/msn/slplink.c | 2 +- libpurple/protocols/msn/xfer.c | 10 +++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index bd42ae7d03..f70ad2eec4 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -869,7 +869,7 @@ t_msn_xfer_init(PurpleXfer *xfer) static void t_msn_xfer_cancel_send(PurpleXfer *xfer) { - MsnSlpLink *slplink = xfer->data; + MsnSlpLink *slplink = purple_xfer_get_protocol_data(xfer); msn_slplink_unref(slplink); } @@ -885,7 +885,7 @@ msn_new_xfer(PurpleConnection *gc, const char *who) g_return_val_if_fail(xfer != NULL, NULL); - xfer->data = msn_slplink_ref(msn_session_get_slplink(session, who)); + purple_xfer_set_protocol_data(xfer, msn_slplink_ref(msn_session_get_slplink(session, who))); purple_xfer_set_init_fnc(xfer, t_msn_xfer_init); purple_xfer_set_cancel_send_fnc(xfer, t_msn_xfer_cancel_send); diff --git a/libpurple/protocols/msn/slp.c b/libpurple/protocols/msn/slp.c index 85c78b260a..67e8fb3291 100644 --- a/libpurple/protocols/msn/slp.c +++ b/libpurple/protocols/msn/slp.c @@ -364,7 +364,7 @@ msn_request_ft(PurpleXfer *xfer) fn = purple_xfer_get_filename(xfer); fp = purple_xfer_get_local_filename(xfer); - slplink = xfer->data; + slplink = purple_xfer_get_protocol_data(xfer); g_return_if_fail(slplink != NULL); g_return_if_fail(fp != NULL); @@ -384,7 +384,7 @@ msn_request_ft(PurpleXfer *xfer) purple_xfer_set_read_fnc(xfer, msn_xfer_read); purple_xfer_set_write_fnc(xfer, msn_xfer_write); - xfer->data = slpcall; + purple_xfer_set_protocol_data(xfer, slpcall); context = gen_context(xfer, fn, fp); diff --git a/libpurple/protocols/msn/slpcall.c b/libpurple/protocols/msn/slpcall.c index 2f06124921..81fc610bfc 100644 --- a/libpurple/protocols/msn/slpcall.c +++ b/libpurple/protocols/msn/slpcall.c @@ -113,7 +113,7 @@ msn_slpcall_destroy(MsnSlpCall *slpcall) if (slpcall->xfer != NULL) { if (purple_xfer_get_type(slpcall->xfer) == PURPLE_XFER_RECEIVE) g_byte_array_free(slpcall->u.incoming_data, TRUE); - slpcall->xfer->data = NULL; + purple_xfer_set_protocol_data(slpcall->xfer, NULL); purple_xfer_unref(slpcall->xfer); } @@ -550,7 +550,7 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, slpcall->xfer = xfer; purple_xfer_ref(slpcall->xfer); - xfer->data = slpcall; + purple_xfer_set_protocol_data(xfer, slpcall); if (file_context->preview) { purple_xfer_set_thumbnail(xfer, file_context->preview, diff --git a/libpurple/protocols/msn/slplink.c b/libpurple/protocols/msn/slplink.c index eea9ee27d8..582bfe158b 100644 --- a/libpurple/protocols/msn/slplink.c +++ b/libpurple/protocols/msn/slplink.c @@ -465,7 +465,7 @@ init_first_msg(MsnSlpLink *slplink, MsnP2PInfo *info) purple_xfer_ref(xfer); purple_xfer_start(xfer, -1, NULL, 0); - if (xfer->data == NULL) { + if (purple_xfer_get_protocol_data(xfer) == NULL) { purple_xfer_unref(xfer); msn_slpmsg_destroy(slpmsg); g_return_val_if_reached(NULL); diff --git a/libpurple/protocols/msn/xfer.c b/libpurple/protocols/msn/xfer.c index 4da276dacd..5996beeb93 100644 --- a/libpurple/protocols/msn/xfer.c +++ b/libpurple/protocols/msn/xfer.c @@ -42,7 +42,7 @@ msn_xfer_init(PurpleXfer *xfer) purple_debug_info("msn", "xfer_init\n"); - slpcall = xfer->data; + slpcall = purple_xfer_get_protocol_data(xfer); /* Send Ok */ content = g_strdup_printf("SessionID: %lu\r\n\r\n", @@ -62,9 +62,9 @@ msn_xfer_cancel(PurpleXfer *xfer) char *content; g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->data != NULL); - slpcall = xfer->data; + slpcall = purple_xfer_get_protocol_data(xfer); + g_return_if_fail(slpcall != NULL); if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) { @@ -102,7 +102,7 @@ msn_xfer_write(const guchar *data, gsize len, PurpleXfer *xfer) g_return_val_if_fail(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND, -1); - slpcall = xfer->data; + slpcall = purple_xfer_get_protocol_data(xfer); /* Not sure I trust it'll be there */ g_return_val_if_fail(slpcall != NULL, -1); @@ -126,7 +126,7 @@ msn_xfer_read(guchar **data, PurpleXfer *xfer) g_return_val_if_fail(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE, -1); - slpcall = xfer->data; + slpcall = purple_xfer_get_protocol_data(xfer); /* Not sure I trust it'll be there */ g_return_val_if_fail(slpcall != NULL, -1); -- cgit v1.2.1 From b2e5a91459bc388dd939db5a8b912bcdaf23326f Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 19:06:02 +0000 Subject: Convert the jabber prpl to use the new API. --- libpurple/protocols/jabber/oob.c | 18 +++++------ libpurple/protocols/jabber/si.c | 67 ++++++++++++++++++++-------------------- 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c index 430d17ac7e..23a65d69fe 100644 --- a/libpurple/protocols/jabber/oob.c +++ b/libpurple/protocols/jabber/oob.c @@ -48,13 +48,13 @@ typedef struct _JabberOOBXfer { static void jabber_oob_xfer_init(PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); purple_xfer_start(xfer, -1, jox->address, jox->port); } static void jabber_oob_xfer_free(PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); jox->js->oob_file_transfers = g_list_remove(jox->js->oob_file_transfers, xfer); @@ -67,12 +67,12 @@ static void jabber_oob_xfer_free(PurpleXfer *xfer) purple_input_remove(jox->writeh); g_free(jox); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } static void jabber_oob_xfer_end(PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); JabberIq *iq; iq = jabber_iq_new(jox->js, JABBER_IQ_RESULT); @@ -86,7 +86,7 @@ static void jabber_oob_xfer_end(PurpleXfer *xfer) static void jabber_oob_xfer_request_send(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); int len, total_len = strlen(jox->write_buffer); len = write(xfer->fd, jox->write_buffer + jox->written_len, @@ -110,7 +110,7 @@ static void jabber_oob_xfer_request_send(gpointer data, gint source, PurpleInput static void jabber_oob_xfer_start(PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); if(jox->write_buffer == NULL) { jox->write_buffer = g_strdup_printf( @@ -126,7 +126,7 @@ static void jabber_oob_xfer_start(PurpleXfer *xfer) } static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); char test[2048]; char *tmp, *lenstr; int len; @@ -158,7 +158,7 @@ static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) { } static void jabber_oob_xfer_recv_error(PurpleXfer *xfer, const char *code) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); JabberIq *iq; xmlnode *y, *z; @@ -221,7 +221,7 @@ void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type, xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); if (xfer) { - xfer->data = jox; + purple_xfer_set_protocol_data(xfer, jox); if(!(filename = g_strdup(g_strrstr(jox->page, "/")))) filename = g_strdup(jox->page); diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index 034b2d30fb..caed4caa0f 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -87,7 +87,7 @@ jabber_si_xfer_find(JabberStream *js, const char *sid, const char *from) for(xfers = js->file_transfers; xfers; xfers = xfers->next) { PurpleXfer *xfer = xfers->data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if(jsx->stream_id && xfer->who && !strcmp(jsx->stream_id, sid) && !strcmp(xfer->who, from)) return xfer; @@ -118,7 +118,7 @@ static void jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIq *iq; xmlnode *query, *su; JabberBytestreamsStreamhost *streamhost = jsx->streamhosts->data; @@ -174,7 +174,7 @@ static gboolean connect_timeout_cb(gpointer data) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); purple_debug_info("jabber", "Streamhost connection timeout of %d seconds exceeded.\n", STREAMHOST_CONNECT_TIMEOUT); @@ -203,7 +203,7 @@ static gboolean jabber_si_bytestreams_ibb_timeout_cb(gpointer data) { PurpleXfer *xfer = (PurpleXfer *) data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if (jsx && !jsx->ibb_session) { purple_debug_info("jabber", @@ -218,7 +218,7 @@ jabber_si_bytestreams_ibb_timeout_cb(gpointer data) static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberBytestreamsStreamhost *streamhost; JabberID *dstjid; @@ -337,7 +337,7 @@ void jabber_bytestreams_parse(JabberStream *js, const char *from, if(!(xfer = jabber_si_xfer_find(js, sid, from))) return; - jsx = xfer->data; + jsx = purple_xfer_get_protocol_data(xfer); if(!jsx->accepted) return; @@ -375,7 +375,7 @@ jabber_si_xfer_bytestreams_send_read_again_resp_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); int len; len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen); @@ -412,7 +412,7 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); char buffer[42]; /* 40 for DST.ADDR + 2 bytes for port number*/ int len; char *dstaddr, *hash; @@ -527,7 +527,7 @@ jabber_si_xfer_bytestreams_send_read_response_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); int len; len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen); @@ -568,7 +568,7 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); int i; int len; char buffer[256]; @@ -680,7 +680,7 @@ jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); int acceptfd, flags; purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_connected_cb\n"); @@ -727,12 +727,12 @@ jabber_si_connect_proxy_cb(JabberStream *js, const char *from, return; } + jsx = purple_xfer_get_protocol_data(xfer); + /* In the case of a direct file transfer, this is expected to return */ - if(!xfer->data) + if(!jsx) return; - jsx = xfer->data; - if(type != JABBER_IQ_RESULT) { purple_debug_info("jabber", "jabber_si_xfer_connect_proxy_cb: type = error\n"); @@ -835,7 +835,7 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) JabberBytestreamsStreamhost *sh, *sh2; int streamhost_count = 0; - jsx = xfer->data; + jsx = purple_xfer_get_protocol_data(xfer); jsx->listen_data = NULL; /* I'm not sure under which conditions this can happen @@ -969,7 +969,7 @@ jabber_si_xfer_bytestreams_send_init(PurpleXfer *xfer) purple_xfer_ref(xfer); - jsx = xfer->data; + jsx = purple_xfer_get_protocol_data(xfer); /* TODO: This should probably be done with an account option instead of * piggy-backing on the TOR proxy type. */ @@ -1017,7 +1017,7 @@ jabber_si_xfer_ibb_recv_data_cb(JabberIBBSession *sess, gpointer data, gsize size) { PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if (size <= purple_xfer_get_bytes_remaining(xfer)) { purple_debug_info("jabber", "about to write %" G_GSIZE_FORMAT " bytes from IBB stream\n", @@ -1037,7 +1037,7 @@ jabber_si_xfer_ibb_recv_data_cb(JabberIBBSession *sess, gpointer data, static gssize jabber_si_xfer_ibb_read(guchar **out_buffer, PurpleXfer *xfer) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); guchar *buffer; gsize size; gsize tmp; @@ -1060,7 +1060,7 @@ jabber_si_xfer_ibb_open_cb(JabberStream *js, const char *who, const char *id, const gchar *sid = xmlnode_get_attrib(open, "sid"); PurpleXfer *xfer = jabber_si_xfer_find(js, sid, who); if (xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIBBSession *sess = jabber_ibb_session_create_from_xmlnode(js, who, id, open, xfer); @@ -1105,7 +1105,7 @@ jabber_si_xfer_ibb_open_cb(JabberStream *js, const char *who, const char *id, static gssize jabber_si_xfer_ibb_write(const guchar *buffer, size_t len, PurpleXfer *xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIBBSession *sess = jsx->ibb_session; gsize packet_size = len < jabber_ibb_session_get_max_data_size(sess) ? len : jabber_ibb_session_get_max_data_size(sess); @@ -1149,7 +1149,7 @@ jabber_si_xfer_ibb_opened_cb(JabberIBBSession *sess) static void jabber_si_xfer_ibb_send_init(JabberStream *js, PurpleXfer *xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); jsx->ibb_session = jabber_ibb_session_create(js, jsx->stream_id, purple_xfer_get_remote_user(xfer), xfer); @@ -1206,7 +1206,7 @@ static void jabber_si_xfer_send_method_cb(JabberStream *js, const char *from, for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { const char *var = xmlnode_get_attrib(field, "var"); - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if(var && !strcmp(var, "stream-method")) { if((value = xmlnode_get_child(field, "value"))) { @@ -1237,7 +1237,7 @@ static void jabber_si_xfer_send_method_cb(JabberStream *js, const char *from, static void jabber_si_xfer_send_request(PurpleXfer *xfer) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIq *iq; xmlnode *si, *file, *feature, *x, *field, *option, *value; char buf[32]; @@ -1309,7 +1309,7 @@ static void jabber_si_xfer_send_request(PurpleXfer *xfer) static void jabber_si_xfer_free(PurpleXfer *xfer) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if (jsx) { JabberStream *js = jsx->js; @@ -1356,7 +1356,7 @@ static void jabber_si_xfer_free(PurpleXfer *xfer) /* XXX: free other stuff */ g_free(jsx->rxqueue); g_free(jsx); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } } @@ -1367,7 +1367,7 @@ static void jabber_si_xfer_free(PurpleXfer *xfer) */ static void jabber_si_xfer_cancel_send(PurpleXfer *xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); /* if there is an IBB session active, send close on that */ if (jsx->ibb_session) { @@ -1380,7 +1380,7 @@ static void jabber_si_xfer_cancel_send(PurpleXfer *xfer) static void jabber_si_xfer_request_denied(PurpleXfer *xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberStream *js = jsx->js; /* @@ -1412,7 +1412,7 @@ static void jabber_si_xfer_request_denied(PurpleXfer *xfer) static void jabber_si_xfer_cancel_recv(PurpleXfer *xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); /* if there is an IBB session active, send close */ if (jsx->ibb_session) { jabber_ibb_session_close(jsx->ibb_session); @@ -1432,7 +1432,7 @@ static void jabber_si_xfer_send_disco_cb(JabberStream *js, const char *who, JabberCapabilities capabilities, gpointer data) { PurpleXfer *xfer = (PurpleXfer *) data; - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if (capabilities & JABBER_CAP_IBB) { purple_debug_info("jabber", @@ -1458,7 +1458,7 @@ static void resource_select_cancel_cb(PurpleXfer *xfer, PurpleRequestFields *fie static void do_transfer_send(PurpleXfer *xfer, const char *resource) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); char **who_v = g_strsplit(xfer->who, "/", 2); char *who; JabberBuddy *jb; @@ -1508,7 +1508,7 @@ static void resource_select_ok_cb(PurpleXfer *xfer, PurpleRequestFields *fields) static void jabber_si_xfer_init(PurpleXfer *xfer) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIq *iq; if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { JabberBuddy *jb; @@ -1641,7 +1641,8 @@ PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who) xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); if (xfer) { - xfer->data = jsx = g_new0(JabberSIXfer, 1); + jsx = g_new0(JabberSIXfer, 1); + purple_xfer_set_protocol_data(xfer, jsx); jsx->js = js; jsx->local_streamhost_fd = -1; @@ -1777,7 +1778,7 @@ void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); g_return_if_fail(xfer != NULL); - xfer->data = jsx; + purple_xfer_set_protocol_data(xfer, jsx); purple_xfer_set_filename(xfer, filename); if(filesize > 0) -- cgit v1.2.1 From 13500955f5f630029cea41955951c3dbd6c19e2d Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 19:11:09 +0000 Subject: Convert the oscar prpl to use the new API. --- libpurple/protocols/oscar/oft.c | 12 ++++++------ libpurple/protocols/oscar/oscar.c | 2 +- libpurple/protocols/oscar/peer.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libpurple/protocols/oscar/oft.c b/libpurple/protocols/oscar/oft.c index 2b99ae4212..795029e0fe 100644 --- a/libpurple/protocols/oscar/oft.c +++ b/libpurple/protocols/oscar/oft.c @@ -589,7 +589,7 @@ peer_oft_recvcb_init(PurpleXfer *xfer) { PeerConnection *conn; - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); conn->flags |= PEER_CONNECTION_FLAG_APPROVED; peer_connection_trynext(conn); } @@ -599,7 +599,7 @@ peer_oft_recvcb_end(PurpleXfer *xfer) { PeerConnection *conn; - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); /* Tell the other person that we've received everything */ conn->fd = conn->xfer->fd; @@ -617,7 +617,7 @@ peer_oft_recvcb_ack_recv(PurpleXfer *xfer, const guchar *buffer, size_t size) PeerConnection *conn; /* Update our rolling checksum. Like Walmart, yo. */ - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); conn->xferdata.recvcsum = peer_oft_checksum_chunk(buffer, size, conn->xferdata.recvcsum, purple_xfer_get_bytes_sent(xfer) & 1); } @@ -653,7 +653,7 @@ peer_oft_sendcb_init(PurpleXfer *xfer) PeerConnection *conn; size_t size; - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); conn->flags |= PEER_CONNECTION_FLAG_APPROVED; /* Make sure the file size can be represented in 32 bits */ @@ -713,7 +713,7 @@ peer_oft_sendcb_ack(PurpleXfer *xfer, const guchar *buffer, size_t size) { PeerConnection *conn; - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); /* * If we're done sending, intercept the socket from the core ft code @@ -742,7 +742,7 @@ peer_oft_cb_generic_cancel(PurpleXfer *xfer) { PeerConnection *conn; - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); if (conn == NULL) return; diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 33bded25a0..b3367755dd 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -5476,7 +5476,7 @@ oscar_new_xfer(PurpleConnection *gc, const char *who) conn->flags |= PEER_CONNECTION_FLAG_APPROVED; aim_icbm_makecookie(conn->cookie); conn->xfer = xfer; - xfer->data = conn; + purple_xfer_set_protocol_data(xfer, conn); } return xfer; diff --git a/libpurple/protocols/oscar/peer.c b/libpurple/protocols/oscar/peer.c index 2a17d21e06..ec9aae58f3 100644 --- a/libpurple/protocols/oscar/peer.c +++ b/libpurple/protocols/oscar/peer.c @@ -212,7 +212,7 @@ peer_connection_destroy_cb(gpointer data) if (conn->xfer != NULL) { PurpleXferStatusType status; - conn->xfer->data = NULL; + purple_xfer_set_protocol_data(conn->xfer, NULL); status = purple_xfer_get_status(conn->xfer); if ((status != PURPLE_XFER_STATUS_DONE) && (status != PURPLE_XFER_STATUS_CANCEL_LOCAL) && @@ -1072,7 +1072,7 @@ peer_connection_got_proposition(OscarData *od, const gchar *bn, const gchar *mes conn->xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE, bn); if (conn->xfer) { - conn->xfer->data = conn; + purple_xfer_set_protocol_data(conn->xfer, conn); purple_xfer_ref(conn->xfer); purple_xfer_set_size(conn->xfer, args->info.sendfile.totsize); -- cgit v1.2.1 From 43640374b408fe37e9f150c9ce7f09870085283f Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 19:23:29 +0000 Subject: Convert the yahoo prpl to using the new API. --- libpurple/protocols/yahoo/yahoo_filexfer.c | 63 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index bf87dbe2ab..dfb9d89819 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -123,7 +123,7 @@ static void yahoo_receivefile_send_cb(gpointer data, gint source, PurpleInputCon int remaining, written; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); @@ -160,7 +160,7 @@ static void yahoo_receivefile_connected(gpointer data, gint source, const gchar if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), @@ -194,7 +194,7 @@ static void yahoo_sendfile_send_cb(gpointer data, gint source, PurpleInputCondit int written, remaining; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); @@ -239,7 +239,7 @@ static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *er if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; if (source < 0) { @@ -313,7 +313,7 @@ static void yahoo_xfer_init(PurpleXfer *xfer) PurpleAccount *account; YahooData *yd; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); gc = xfer_data->gc; yd = gc->proto_data; account = purple_connection_get_account(gc); @@ -357,7 +357,7 @@ static void yahoo_xfer_init_15(PurpleXfer *xfer) YahooData *yd; struct yahoo_packet *pkt; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); gc = xfer_data->gc; yd = gc->proto_data; account = purple_connection_get_account(gc); @@ -430,7 +430,7 @@ static gssize yahoo_xfer_read(guchar **buffer, PurpleXfer *xfer) gchar *length; gchar *end; int filelen; - struct yahoo_xfer_data *xd = xfer->data; + struct yahoo_xfer_data *xd = purple_xfer_get_protocol_data(xfer); if (purple_xfer_get_type(xfer) != PURPLE_XFER_RECEIVE) { return 0; @@ -490,7 +490,7 @@ static gssize yahoo_xfer_read(guchar **buffer, PurpleXfer *xfer) static gssize yahoo_xfer_write(const guchar *buffer, size_t size, PurpleXfer *xfer) { gssize len; - struct yahoo_xfer_data *xd = xfer->data; + struct yahoo_xfer_data *xd = purple_xfer_get_protocol_data(xfer); if (!xd) return -1; @@ -516,7 +516,7 @@ static void yahoo_xfer_cancel_send(PurpleXfer *xfer) { struct yahoo_xfer_data *xfer_data; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) { @@ -556,14 +556,14 @@ static void yahoo_xfer_cancel_send(PurpleXfer *xfer) if (xfer_data) yahoo_xfer_data_free(xfer_data); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) { struct yahoo_xfer_data *xfer_data; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) { @@ -603,7 +603,7 @@ static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) if (xfer_data) yahoo_xfer_data_free(xfer_data); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } /* Send HTTP OK after receiving file */ @@ -633,7 +633,7 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) PurpleConnection *gc; YahooData *yd; - xfer_data = xfer_old->data; + xfer_data = purple_xfer_get_protocol_data(xfer_old); if(xfer_data && xfer_data->version == 15 && purple_xfer_get_type(xfer_old) == PURPLE_XFER_RECEIVE && xfer_data->filename_list) { @@ -689,7 +689,7 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) xfer_data->firstoflist = FALSE; /* Dereference xfer_data from old xfer */ - xfer_old->data = NULL; + purple_xfer_set_protocol_data(xfer_old, NULL); /* Build the file transfer handle. */ xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, xfer_old->who); @@ -702,7 +702,7 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) g_free(utf8_filename); purple_xfer_set_size(xfer, filesize); - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); @@ -726,8 +726,7 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) } if (xfer_data) yahoo_xfer_data_free(xfer_data); - xfer_old->data = NULL; - + purple_xfer_set_protocol_data(xfer_old, NULL); } void yahoo_process_p2pfilexfer(PurpleConnection *gc, struct yahoo_packet *pkt) @@ -886,7 +885,7 @@ void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt) g_return_if_reached(); } - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Set the info about the incoming file. */ if (filename) { @@ -943,7 +942,7 @@ PurpleXfer *yahoo_new_xfer(PurpleConnection *gc, const char *who) g_return_val_if_reached(NULL); } - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); @@ -993,7 +992,7 @@ static void yahoo_xfer_dns_connected_15(GSList *hosts, gpointer data, const char if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; gc = xd->gc; account = purple_connection_get_account(gc); @@ -1086,7 +1085,7 @@ void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file) if( !g_hash_table_lookup(yd->peers, who) ) yahoo_send_p2p_pkt(gc, who, 0); - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); xfer_data->status_15 = STARTED; purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); xfer_data->version = 15; @@ -1114,7 +1113,7 @@ static void yahoo_xfer_recv_cb_15(gpointer data, gint source, PurpleInputConditi PurpleConnection *gc; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); account = purple_connection_get_account(xd->gc); gc = xd->gc; @@ -1167,7 +1166,7 @@ static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputConditi int remaining, written; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; written = write(source, xd->txbuf + xd->txbuf_written, remaining); @@ -1239,7 +1238,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; gc = xd->gc; account = purple_connection_get_account(gc); @@ -1373,7 +1372,7 @@ static void yahoo_p2p_ft_POST_cb(gpointer data, gint source, PurpleInputConditio struct yahoo_xfer_data *xd; xfer = data; - if (!(xd = xfer->data)) { + if (!(xd = purple_xfer_get_protocol_data(xfer))) { purple_xfer_cancel_remote(xfer); return; } @@ -1396,7 +1395,7 @@ static void yahoo_p2p_ft_HEAD_GET_cb(gpointer data, gint source, PurpleInputCond char *time_str; xfer = data; - if (!(xd = xfer->data)) { + if (!(xd = purple_xfer_get_protocol_data(xfer))) { purple_xfer_cancel_remote(xfer); return; } @@ -1458,7 +1457,7 @@ static void yahoo_p2p_ft_server_send_connected_cb(gpointer data, gint source, Pu struct yahoo_xfer_data *xd; xfer = data; - if (!(xd = xfer->data)) { + if (!(xd = purple_xfer_get_protocol_data(xfer))) { purple_xfer_cancel_remote(xfer); return; } @@ -1500,7 +1499,7 @@ static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) char *filename_without_spaces = NULL; xfer = data; - if (!(xd = xfer->data) || (listenfd == -1)) { + if (!(xd = purple_xfer_get_protocol_data(xfer)) || (listenfd == -1)) { purple_debug_warning("yahoo","p2p: error starting server for p2p file transfer\n"); purple_xfer_cancel_remote(xfer); return; @@ -1564,7 +1563,7 @@ static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer gchar *filename; struct yahoo_p2p_data *p2p_data; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; account = purple_connection_get_account(gc); @@ -1747,7 +1746,7 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) g_free(utf8_filename); purple_xfer_set_size(xfer, filesize); - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); @@ -1837,7 +1836,7 @@ void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet * return; } - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); xfer_data->info_val_249 = val_249; xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay); @@ -1934,7 +1933,7 @@ void yahoo_process_filetrans_acc_15(PurpleConnection *gc, struct yahoo_packet *p return; } - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); if(url) purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL); -- cgit v1.2.1 From 1fcf625c487f6c5721671894735c97257388a93b Mon Sep 17 00:00:00 2001 From: Daniel Atallah Date: Fri, 26 Aug 2011 19:26:33 +0000 Subject: Remove wpurple_rename(). I suspect nobody actually ever used it directly --- libpurple/win32/libc_interface.c | 6 ------ libpurple/win32/libc_interface.h | 2 +- libpurple/win32/libc_internal.h | 3 --- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/libpurple/win32/libc_interface.c b/libpurple/win32/libc_interface.c index 18f468910b..5697dd51d1 100644 --- a/libpurple/win32/libc_interface.c +++ b/libpurple/win32/libc_interface.c @@ -467,12 +467,6 @@ int wpurple_gettimeofday(struct timeval *p, struct timezone *z) { return res; } -/* stdio.h */ - -int wpurple_rename (const char *oldname, const char *newname) { - return g_rename(oldname, newname); -} - /* time.h */ struct tm * wpurple_localtime_r (const time_t *time, struct tm *resultp) { diff --git a/libpurple/win32/libc_interface.h b/libpurple/win32/libc_interface.h index cc7acc1d72..05029b892e 100644 --- a/libpurple/win32/libc_interface.h +++ b/libpurple/win32/libc_interface.h @@ -135,7 +135,7 @@ wpurple_gettimeofday( timeval, timezone ) #define vsnprintf _vsnprintf #define rename( oldname, newname ) \ -wpurple_rename( oldname, newname ) +g_rename( oldname, newname ) /* sys/stat.h */ #define fchmod(a,b) diff --git a/libpurple/win32/libc_internal.h b/libpurple/win32/libc_internal.h index 2a6b11edec..159939fdb9 100644 --- a/libpurple/win32/libc_internal.h +++ b/libpurple/win32/libc_internal.h @@ -141,9 +141,6 @@ int wpurple_close(int fd); int wpurple_gethostname(char *name, size_t size); -/* stdio.h */ -int wpurple_rename(const char *oldname, const char *newname); - #ifdef __cplusplus } #endif /* __cplusplus */ -- cgit v1.2.1 From bc1570d4b95b027fd36881264c59d573496b198c Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 19:33:50 +0000 Subject: Rename field for consistency. --- libpurple/ft.c | 8 ++++---- libpurple/ft.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libpurple/ft.c b/libpurple/ft.c index cf6dceb3f4..306c4b4a47 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -1702,19 +1702,19 @@ purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats) } void -purple_xfer_set_protocol_data(PurpleXfer *xfer, void *proto_data) +purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data) { g_return_if_fail(xfer != NULL); - xfer->data = proto_data; + xfer->proto_data = proto_data; } -void * +gpointer purple_xfer_get_protocol_data(PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, NULL); - return xfer->data; + return xfer->proto_data; } /************************************************************************** diff --git a/libpurple/ft.h b/libpurple/ft.h index eabb563361..606522188c 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -185,7 +185,7 @@ struct _PurpleXfer PurpleXferUiOps *ui_ops; /**< UI-specific operations. */ void *ui_data; /**< UI-specific data. */ - void *data; /**< prpl-specific data. */ + void *proto_data; /**< prpl-specific data. */ }; #ifdef __cplusplus @@ -745,7 +745,7 @@ void purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats); * * @since 3.0.0 */ -void purple_xfer_set_protocol_data(PurpleXfer *xfer, void *proto_data); +void purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data); /** * Gets the protocol data for a file transfer. @@ -756,7 +756,7 @@ void purple_xfer_set_protocol_data(PurpleXfer *xfer, void *proto_data); * * @since 3.0.0 */ -void *purple_xfer_get_protocol_data(PurpleXfer *xfer); +gpointer purple_xfer_get_protocol_data(PurpleXfer *xfer); /*@}*/ -- cgit v1.2.1 From 1ff1f82e3698780275e054502a3c2c4be6cebc97 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 19:55:34 +0000 Subject: Added accessor functions purple_xfer_get_ui_data() and purple_xfer_set_ui_data(). --- ChangeLog.API | 2 ++ libpurple/ft.c | 15 +++++++++++++++ libpurple/ft.h | 19 +++++++++++++++++++ libpurple/roomlist.h | 4 ++-- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 9c05684c84..00f967de26 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -17,6 +17,8 @@ version 3.0.0 (??/??/????): * purple_roomlist_set_ui_data * purple_xfer_get_protocol_data * purple_xfer_set_protocol_data + * purple_xfer_get_ui_data + * purple_xfer_set_ui_data Changed: * purple_connection_error now takes a PurpleConnectionError diff --git a/libpurple/ft.c b/libpurple/ft.c index 306c4b4a47..f8e5d0138c 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -1717,6 +1717,21 @@ purple_xfer_get_protocol_data(PurpleXfer *xfer) return xfer->proto_data; } +void purple_xfer_set_ui_data(PurpleXfer *xfer, gpointer ui_data) +{ + g_return_if_fail(xfer != NULL); + + xfer->ui_data = ui_data; +} + +gpointer purple_xfer_get_ui_data(PurpleXfer *xfer) +{ + g_return_val_if_fail(xfer != NULL, NULL); + + return xfer->ui_data; +} + + /************************************************************************** * File Transfer Subsystem API **************************************************************************/ diff --git a/libpurple/ft.h b/libpurple/ft.h index 606522188c..3cb745fb6f 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -758,6 +758,25 @@ void purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data); */ gpointer purple_xfer_get_protocol_data(PurpleXfer *xfer); +/** + * Set the UI data associated with this file transfer. + * + * @param xfer The file transfer. + * @param ui_data A pointer to associate with this file transfer. + */ +void purple_xfer_set_ui_data(PurpleXfer *xfer, gpointer ui_data); + +/** + * Get the UI data associated with this file transfer. + * + * @param xfer The file transfer. + * + * @return The UI data associated with this file transfer. This is a + * convenience field provided to the UIs--it is not + * used by the libpurple core. + */ +gpointer purple_xfer_get_ui_data(PurpleXfer *xfer); + /*@}*/ /**************************************************************************/ diff --git a/libpurple/roomlist.h b/libpurple/roomlist.h index 87fbdd635b..354c507665 100644 --- a/libpurple/roomlist.h +++ b/libpurple/roomlist.h @@ -228,7 +228,7 @@ GList *purple_roomlist_get_fields(PurpleRoomlist *roomlist); * * @return The protocol data associated with this room list. This is a * convenience field provided to the protocol plugin--it is not - * used the libuprple core. + * used the libpurple core. */ gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list); @@ -247,7 +247,7 @@ void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data); * * @return The UI data associated with this room list. This is a * convenience field provided to the UIs--it is not - * used by the libuprple core. + * used by the libpurple core. */ gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list); -- cgit v1.2.1 From e6cb5e33a930771640a9527d0d78b79289736da9 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 20:04:35 +0000 Subject: Update Pidgin to use the new accessor methods. --- pidgin/gtkft.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pidgin/gtkft.c b/pidgin/gtkft.c index 4c1bc658ea..820ea3636a 100644 --- a/pidgin/gtkft.c +++ b/pidgin/gtkft.c @@ -37,9 +37,6 @@ #include "pidginstock.h" #include "gtkutils.h" -#define PIDGINXFER(xfer) \ - (PidginXferUiData *)(xfer)->ui_data - /* the maximum size of files we will try to make a thumbnail for */ #define PIDGIN_XFER_MAX_SIZE_IMAGE_THUMBNAIL 10 * 1024 * 1024 @@ -243,7 +240,7 @@ update_detailed_info(PidginXferDialog *dialog, PurpleXfer *xfer) if (dialog == NULL || xfer == NULL) return; - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); get_xfer_info_strings(xfer, &kbsec, &time_elapsed, &time_remaining); @@ -869,7 +866,7 @@ pidgin_xfer_dialog_add_xfer(PidginXferDialog *dialog, PurpleXfer *xfer) purple_xfer_ref(xfer); - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); data->in_list = TRUE; pidgin_xfer_dialog_show(dialog); @@ -926,7 +923,7 @@ pidgin_xfer_dialog_remove_xfer(PidginXferDialog *dialog, g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data == NULL) return; @@ -957,7 +954,7 @@ pidgin_xfer_dialog_cancel_xfer(PidginXferDialog *dialog, g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data == NULL) return; @@ -970,7 +967,7 @@ pidgin_xfer_dialog_cancel_xfer(PidginXferDialog *dialog, return; } - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); update_detailed_info(dialog, xfer); update_title_progress(dialog); @@ -1007,7 +1004,7 @@ pidgin_xfer_dialog_update_xfer(PidginXferDialog *dialog, g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); - if ((data = PIDGINXFER(xfer)) == NULL) + if ((data = purple_xfer_get_ui_data(xfer)) == NULL) return; if (data->in_list == FALSE) @@ -1095,9 +1092,9 @@ pidgin_xfer_new_xfer(PurpleXfer *xfer) { PidginXferUiData *data; - /* This is where we're setting xfer->ui_data for the first time. */ + /* This is where we're setting xfer's "ui_data" for the first time. */ data = g_new0(PidginXferUiData, 1); - xfer->ui_data = data; + purple_xfer_set_ui_data(xfer, data); } static void @@ -1105,11 +1102,11 @@ pidgin_xfer_destroy(PurpleXfer *xfer) { PidginXferUiData *data; - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data) { g_free(data->name); g_free(data); - xfer->ui_data = NULL; + purple_xfer_set_ui_data(xfer, NULL); } } -- cgit v1.2.1 From ead5ced86aeb333feaa9235a98025964df82ed81 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 20:09:35 +0000 Subject: Convert Finch to use the new accessor functions. --- finch/gntft.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/finch/gntft.c b/finch/gntft.c index 262140a7b6..40e8516852 100644 --- a/finch/gntft.c +++ b/finch/gntft.c @@ -42,9 +42,6 @@ #include "gntft.h" #include "prefs.h" -#define FINCHXFER(xfer) \ - (PurpleGntXferUiData *)FINCH_GET_DATA(xfer) - typedef struct { gboolean keep_open; @@ -262,7 +259,7 @@ finch_xfer_dialog_new(void) for (iter = purple_xfers_get_all(); iter; iter = iter->next) { PurpleXfer *xfer = (PurpleXfer *)iter->data; - PurpleGntXferUiData *data = FINCHXFER(xfer); + PurpleGntXferUiData *data = purple_xfer_get_ui_data(xfer); if (data->in_list) { finch_xfer_dialog_add_xfer(xfer); finch_xfer_dialog_update_xfer(xfer); @@ -302,7 +299,7 @@ finch_xfer_dialog_add_xfer(PurpleXfer *xfer) purple_xfer_ref(xfer); - data = FINCHXFER(xfer); + data = purple_xfer_get_ui_data(xfer); data->in_list = TRUE; finch_xfer_dialog_show(); @@ -340,7 +337,7 @@ finch_xfer_dialog_remove_xfer(PurpleXfer *xfer) g_return_if_fail(xfer_dialog != NULL); g_return_if_fail(xfer != NULL); - data = FINCHXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data == NULL) return; @@ -370,7 +367,7 @@ finch_xfer_dialog_cancel_xfer(PurpleXfer *xfer) g_return_if_fail(xfer_dialog != NULL); g_return_if_fail(xfer != NULL); - data = FINCHXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data == NULL) return; @@ -416,7 +413,7 @@ finch_xfer_dialog_update_xfer(PurpleXfer *xfer) g_return_if_fail(xfer_dialog != NULL); g_return_if_fail(xfer != NULL); - if ((data = FINCHXFER(xfer)) == NULL) + if ((data = purple_xfer_get_ui_data(xfer)) == NULL) return; if (data->in_list == FALSE || data->notified) @@ -471,9 +468,9 @@ finch_xfer_new_xfer(PurpleXfer *xfer) { PurpleGntXferUiData *data; - /* This is where we're setting xfer->ui_data for the first time. */ + /* This is where we're setting xfer's "ui_data" for the first time. */ data = g_new0(PurpleGntXferUiData, 1); - FINCH_SET_DATA(xfer, data); + purple_xfer_set_ui_data(xfer, data); } static void @@ -481,11 +478,11 @@ finch_xfer_destroy(PurpleXfer *xfer) { PurpleGntXferUiData *data; - data = FINCHXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data) { g_free(data->name); g_free(data); - FINCH_SET_DATA(xfer, NULL); + purple_xfer_set_ui_data(xfer, NULL); } } -- cgit v1.2.1 From 3a545127ef1676c76b289c066e81ef8cfdadf13f Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 20:29:23 +0000 Subject: Rather use the accessor functions directly. --- finch/gntrequest.c | 36 +++++++++++++++--------------------- finch/gntroomlist.c | 7 +------ 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/finch/gntrequest.c b/finch/gntrequest.c index 37940e01c1..42c9877e14 100644 --- a/finch/gntrequest.c +++ b/finch/gntrequest.c @@ -41,12 +41,6 @@ #include "debug.h" #include "util.h" -/* XXX: Until gobjectification ... */ -#undef FINCH_GET_DATA -#undef FINCH_SET_DATA -#define FINCH_GET_DATA(obj) purple_request_field_get_ui_data(obj) -#define FINCH_SET_DATA(obj, data) purple_request_field_set_ui_data(obj, data) - typedef struct { void *user_data; @@ -323,26 +317,26 @@ request_fields_cb(GntWidget *button, PurpleRequestFields *fields) continue; if (type == PURPLE_REQUEST_FIELD_BOOLEAN) { - GntWidget *check = FINCH_GET_DATA(field); + GntWidget *check = purple_request_field_get_ui_data(field); gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); purple_request_field_bool_set_value(field, value); } else if (type == PURPLE_REQUEST_FIELD_STRING) { - GntWidget *entry = FINCH_GET_DATA(field); + GntWidget *entry = purple_request_field_get_ui_data(field); const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); purple_request_field_string_set_value(field, (text && *text) ? text : NULL); } else if (type == PURPLE_REQUEST_FIELD_INTEGER) { - GntWidget *entry = FINCH_GET_DATA(field); + GntWidget *entry = purple_request_field_get_ui_data(field); const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); int value = (text && *text) ? atoi(text) : 0; purple_request_field_int_set_value(field, value); } else if (type == PURPLE_REQUEST_FIELD_CHOICE) { - GntWidget *combo = FINCH_GET_DATA(field); + GntWidget *combo = purple_request_field_get_ui_data(field); int id; id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); purple_request_field_choice_set_value(field, id); @@ -352,7 +346,7 @@ request_fields_cb(GntWidget *button, PurpleRequestFields *fields) GList *list = NULL, *iter; if (purple_request_field_list_get_multi_select(field)) { - GntWidget *tree = FINCH_GET_DATA(field); + GntWidget *tree = purple_request_field_get_ui_data(field); iter = purple_request_field_list_get_items(field); for (; iter; iter = iter->next) @@ -365,7 +359,7 @@ request_fields_cb(GntWidget *button, PurpleRequestFields *fields) } else { - GntWidget *combo = FINCH_GET_DATA(field); + GntWidget *combo = purple_request_field_get_ui_data(field); gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); iter = purple_request_field_list_get_items(field); @@ -384,7 +378,7 @@ request_fields_cb(GntWidget *button, PurpleRequestFields *fields) } else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) { - GntWidget *combo = FINCH_GET_DATA(field); + GntWidget *combo = purple_request_field_get_ui_data(field); PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); purple_request_field_account_set_value(field, acc); } @@ -633,36 +627,36 @@ finch_request_fields(const char *title, const char *primary, if (type == PURPLE_REQUEST_FIELD_BOOLEAN) { - FINCH_SET_DATA(field, create_boolean_field(field)); + purple_request_field_set_ui_data(field, create_boolean_field(field)); } else if (type == PURPLE_REQUEST_FIELD_STRING) { - FINCH_SET_DATA(field, create_string_field(field, &username)); + purple_request_field_set_ui_data(field, create_string_field(field, &username)); } else if (type == PURPLE_REQUEST_FIELD_INTEGER) { - FINCH_SET_DATA(field, create_integer_field(field)); + purple_request_field_set_ui_data(field, create_integer_field(field)); } else if (type == PURPLE_REQUEST_FIELD_CHOICE) { - FINCH_SET_DATA(field, create_choice_field(field)); + purple_request_field_set_ui_data(field, create_choice_field(field)); } else if (type == PURPLE_REQUEST_FIELD_LIST) { - FINCH_SET_DATA(field, create_list_field(field)); + purple_request_field_set_ui_data(field, create_list_field(field)); } else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) { accountlist = create_account_field(field); - FINCH_SET_DATA(field, accountlist); + purple_request_field_set_ui_data(field, accountlist); } else { - FINCH_SET_DATA(field, gnt_label_new_with_format(_("Not implemented yet."), + purple_request_field_set_ui_data(field, gnt_label_new_with_format(_("Not implemented yet."), GNT_TEXT_FLAG_BOLD)); } gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); - gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(FINCH_GET_DATA(field))); + gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(purple_request_field_get_ui_data(field))); } if (grlist->next) gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); diff --git a/finch/gntroomlist.c b/finch/gntroomlist.c index 12cce2862e..e4a17c73fc 100644 --- a/finch/gntroomlist.c +++ b/finch/gntroomlist.c @@ -41,11 +41,6 @@ #define PREF_ROOT "/finch/roomlist" -#undef FINCH_GET_DATA -#undef FINCH_SET_DATA -#define FINCH_GET_DATA(obj) purple_roomlist_get_ui_data(obj) -#define FINCH_SET_DATA(obj, data) purple_roomlist_set_ui_data(obj, data) - /* Yes, just one roomlist at a time. Let's not get greedy. Aight? */ struct _FinchRoomlist @@ -349,7 +344,7 @@ fl_show_with_account(PurpleAccount *account) static void fl_create(PurpleRoomlist *list) { - FINCH_SET_DATA(list, &froomlist); + purple_roomlist_set_ui_data(list, &froomlist); setup_roomlist(NULL); update_roomlist(list); } -- cgit v1.2.1 From eab138c7c4c4a7ad964758b6d1a8b22d856b8b7c Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 20:51:39 +0000 Subject: Add accessor functions purple_conversation_get_ui_data() and purple_conversation_set_ui_data(). --- ChangeLog.API | 2 ++ libpurple/conversation.c | 15 +++++++++++++++ libpurple/conversation.h | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/ChangeLog.API b/ChangeLog.API index 00f967de26..221b4cc2a4 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -19,6 +19,8 @@ version 3.0.0 (??/??/????): * purple_xfer_set_protocol_data * purple_xfer_get_ui_data * purple_xfer_set_ui_data + * purple_conversation_get_ui_data + * purple_conversation_set_ui_data Changed: * purple_connection_error now takes a PurpleConnectionError diff --git a/libpurple/conversation.c b/libpurple/conversation.c index 09b637aa55..a09364ddfd 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -2323,6 +2323,21 @@ time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg) return msg->when; } +void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data) +{ + g_return_if_fail(conv != NULL); + + conv->ui_data = ui_data; +} + +gpointer purple_conversation_get_ui_data(PurpleConversation *conv) +{ + g_return_val_if_fail(conv != NULL, NULL); + + return conv->ui_data; +} + + gboolean purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **error) diff --git a/libpurple/conversation.h b/libpurple/conversation.h index e01dc19145..6ec6bea45a 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -802,6 +802,25 @@ PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg) */ time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg); +/** + * Set the UI data associated with this conversation. + * + * @param conv The conversation. + * @param ui_data A pointer to associate with this conversation. + */ +void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data); + +/** + * Get the UI data associated with this conversation. + * + * @param conv The conversation. + * + * @return The UI data associated with this conversation. This is a + * convenience field provided to the UIs--it is not + * used by the libpurple core. + */ +gpointer purple_conversation_get_ui_data(PurpleConversation *conv); + /*@}*/ -- cgit v1.2.1 From e15f265adc2196a39959c43787fe9193a38d9514 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 21:09:27 +0000 Subject: Use the new accessor functions. FINCH_GET_DATA() and FINCH_CONV() were both used to do the same thing for a PurpleConversation, so standardize on FINCH_CONV(). --- finch/gntblist.c | 2 +- finch/gntconv.c | 36 ++++++++++++++++++------------------ finch/gntconv.h | 2 +- finch/plugins/gntgf.c | 2 +- finch/plugins/lastlog.c | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/finch/gntblist.c b/finch/gntblist.c index 3a6abfc8f0..8f7bfe6da9 100644 --- a/finch/gntblist.c +++ b/finch/gntblist.c @@ -1060,7 +1060,7 @@ selection_activate(GntWidget *widget, FinchBlist *ggblist) purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)); } else { - FinchConv *ggconv = FINCH_GET_DATA(conv); + FinchConv *ggconv = FINCH_CONV(conv); gnt_window_present(ggconv->window); } finch_conversation_set_active(conv); diff --git a/finch/gntconv.c b/finch/gntconv.c index 04c882857a..ccc0798b48 100644 --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -282,7 +282,7 @@ update_buddy_typing(PurpleAccount *account, const char *who, gpointer null) return; im = PURPLE_CONV_IM(conv); - ggc = FINCH_GET_DATA(conv); + ggc = FINCH_CONV(conv); if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) { int scroll; @@ -321,7 +321,7 @@ buddy_signed_on_off(PurpleBuddy *buddy, gpointer null) PurpleConversation *conv = find_conv_with_contact(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)); if (conv == NULL) return; - generate_send_to_menu(FINCH_GET_DATA(conv)); + generate_send_to_menu(FINCH_CONV(conv)); } static void @@ -333,7 +333,7 @@ account_signed_on_off(PurpleConnection *gc, gpointer null) PurpleConversation *cc = find_conv_with_contact( purple_conversation_get_account(conv), purple_conversation_get_name(conv)); if (cc) - generate_send_to_menu(FINCH_GET_DATA(cc)); + generate_send_to_menu(FINCH_CONV(cc)); list = list->next; } @@ -398,7 +398,7 @@ finch_conv_get_handle(void) static void cleared_message_history_cb(PurpleConversation *conv, gpointer data) { - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); if (ggc) gnt_text_view_clear(GNT_TEXT_VIEW(ggc->tv)); } @@ -749,7 +749,7 @@ cmd_removed_cb(const char *cmd, FinchConv *fconv) static void finch_create_conversation(PurpleConversation *conv) { - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); char *title; PurpleConversationType type; PurpleConversation *cc; @@ -763,8 +763,8 @@ finch_create_conversation(PurpleConversation *conv) account = purple_conversation_get_account(conv); cc = find_conv_with_contact(account, purple_conversation_get_name(conv)); - if (cc && FINCH_GET_DATA(cc)) - ggc = FINCH_GET_DATA(cc); + if (cc && FINCH_CONV(cc)) + ggc = FINCH_CONV(cc); else ggc = g_new0(FinchConv, 1); @@ -776,9 +776,9 @@ finch_create_conversation(PurpleConversation *conv) ggc->list = g_list_prepend(ggc->list, conv); ggc->active_conv = conv; - FINCH_SET_DATA(conv, ggc); + purple_conversation_set_ui_data(conv, ggc); - if (cc && FINCH_GET_DATA(cc) && cc != conv) { + if (cc && FINCH_CONV(cc) && cc != conv) { finch_conversation_set_active(conv); return; } @@ -885,7 +885,7 @@ static void finch_destroy_conversation(PurpleConversation *conv) { /* do stuff here */ - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); ggc->list = g_list_remove(ggc->list, conv); if (ggc->list && conv == ggc->active_conv) { ggc->active_conv = ggc->list->data; @@ -905,7 +905,7 @@ static void finch_write_common(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime) { - FinchConv *ggconv = FINCH_GET_DATA(conv); + FinchConv *ggconv = FINCH_CONV(conv); char *strip, *newline; GntTextFormatFlags fl = 0; int pos; @@ -1069,7 +1069,7 @@ chat_flag_text(PurpleConvChatBuddyFlags flags) static void finch_chat_add_users(PurpleConversation *conv, GList *users, gboolean new_arrivals) { - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); GntEntry *entry = GNT_ENTRY(ggc->entry); if (!new_arrivals) @@ -1111,7 +1111,7 @@ static void finch_chat_rename_user(PurpleConversation *conv, const char *old, const char *new_n, const char *new_a) { /* Update the name for string completion */ - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); GntEntry *entry = GNT_ENTRY(ggc->entry); GntTree *tree = GNT_TREE(ggc->u.chat->userlist); PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), new_n); @@ -1129,7 +1129,7 @@ static void finch_chat_remove_users(PurpleConversation *conv, GList *list) { /* Remove the name from string completion */ - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); GntEntry *entry = GNT_ENTRY(ggc->entry); for (; list; list = list->next) { GntTree *tree = GNT_TREE(ggc->u.chat->userlist); @@ -1142,7 +1142,7 @@ static void finch_chat_update_user(PurpleConversation *conv, const char *user) { PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), user); - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(cb->flags)); } @@ -1368,7 +1368,7 @@ cmd_message_color(PurpleConversation *conv, const char *cmd, char **args, char * static PurpleCmdRet users_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data) { - FinchConv *fc = FINCH_GET_DATA(conv); + FinchConv *fc = FINCH_CONV(conv); FinchConvChat *ch; if (!fc) return PURPLE_CMD_RET_FAILED; @@ -1494,7 +1494,7 @@ void finch_conversation_uninit() void finch_conversation_set_active(PurpleConversation *conv) { - FinchConv *ggconv = FINCH_GET_DATA(conv); + FinchConv *ggconv = FINCH_CONV(conv); PurpleAccount *account; char *title; @@ -1513,7 +1513,7 @@ void finch_conversation_set_active(PurpleConversation *conv) void finch_conversation_set_info_widget(PurpleConversation *conv, GntWidget *widget) { - FinchConv *fc = FINCH_GET_DATA(conv); + FinchConv *fc = FINCH_CONV(conv); int height, width; gnt_box_remove_all(GNT_BOX(fc->info)); diff --git a/finch/gntconv.h b/finch/gntconv.h index b188469bf5..6fb9f34d47 100644 --- a/finch/gntconv.h +++ b/finch/gntconv.h @@ -33,7 +33,7 @@ #include "conversation.h" /* Grabs the conv out of a PurpleConverstation */ -#define FINCH_CONV(conv) ((FinchConv *)(conv)->ui_data) +#define FINCH_CONV(conv) ((FinchConv *)purple_conversation_get_ui_data(conv)) /*************************************************************************** * @name GNT Conversations API diff --git a/finch/plugins/gntgf.c b/finch/plugins/gntgf.c index 9d7d726d86..7e23a22d2a 100644 --- a/finch/plugins/gntgf.c +++ b/finch/plugins/gntgf.c @@ -168,7 +168,7 @@ notify(PurpleConversation *conv, const char *fmt, ...) beep(); if (conv != NULL) { - FinchConv *fc = conv->ui_data; + FinchConv *fc = FINCH_CONV(conv); if (gnt_widget_has_focus(fc->window)) return; } diff --git a/finch/plugins/lastlog.c b/finch/plugins/lastlog.c index 753935bd48..86cd718e2f 100644 --- a/finch/plugins/lastlog.c +++ b/finch/plugins/lastlog.c @@ -60,7 +60,7 @@ window_kpress_cb(GntWidget *wid, const char *key, GntTextView *view) static PurpleCmdRet lastlog_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer null) { - FinchConv *ggconv = conv->ui_data; + FinchConv *ggconv = FINCH_CONV(conv); char **strings = g_strsplit(GNT_TEXT_VIEW(ggconv->tv)->string->str, "\n", 0); GntWidget *win, *tv; int i, j; -- cgit v1.2.1 From 2e6dcf766c680937189641b8331c1d8b8030daf2 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 21:21:45 +0000 Subject: Convert to using the accessor functions. --- pidgin/gtkconv.c | 10 +++++----- pidgin/gtkconv.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index c8f431a04d..6b0ed8399b 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5277,8 +5277,8 @@ pidgin_conv_find_gtkconv(PurpleConversation * conv) PurpleBuddy *b = PURPLE_BUDDY(bn); PurpleConversation *conv; if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account))) { - if (conv->ui_data) - return conv->ui_data; + if (PIDGIN_CONVERSATION(conv)) + return PIDGIN_CONVERSATION(conv); } } @@ -5366,7 +5366,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) PurpleValue *value; if (conv_type == PURPLE_CONV_TYPE_IM && (gtkconv = pidgin_conv_find_gtkconv(conv))) { - conv->ui_data = gtkconv; + purple_conversation_set_ui_data(conv, gtkconv); if (!g_list_find(gtkconv->convs, conv)) gtkconv->convs = g_list_prepend(gtkconv->convs, conv); pidgin_conv_switch_active_conversation(conv); @@ -5374,7 +5374,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) } gtkconv = g_new0(PidginConversation, 1); - conv->ui_data = gtkconv; + purple_conversation_set_ui_data(conv, gtkconv); gtkconv->active_conv = conv; gtkconv->convs = g_list_prepend(gtkconv->convs, conv); gtkconv->send_history = g_list_append(NULL, NULL); @@ -5401,7 +5401,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) g_free(gtkconv->u.im); g_free(gtkconv); - conv->ui_data = NULL; + purple_conversation_set_ui_data(conv, NULL); return; } diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index ad4285bf62..efc2d3908a 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -56,7 +56,7 @@ enum { }; #define PIDGIN_CONVERSATION(conv) \ - ((PidginConversation *)(conv)->ui_data) + ((PidginConversation *)purple_conversation_get_ui_data(conv)) #define PIDGIN_IS_PIDGIN_CONVERSATION(conv) \ (purple_conversation_get_ui_ops(conv) == \ -- cgit v1.2.1 From 15dcb2cc1fa7706e03d6ac0baf7f2edb0fe83717 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 26 Aug 2011 21:25:25 +0000 Subject: These pointers should rather be marked const. --- libpurple/conversation.c | 2 +- libpurple/conversation.h | 2 +- libpurple/ft.c | 4 ++-- libpurple/ft.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libpurple/conversation.c b/libpurple/conversation.c index a09364ddfd..d797a4c1e9 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -2330,7 +2330,7 @@ void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data) conv->ui_data = ui_data; } -gpointer purple_conversation_get_ui_data(PurpleConversation *conv) +gpointer purple_conversation_get_ui_data(const PurpleConversation *conv) { g_return_val_if_fail(conv != NULL, NULL); diff --git a/libpurple/conversation.h b/libpurple/conversation.h index 6ec6bea45a..91e12b758e 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -819,7 +819,7 @@ void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data) * convenience field provided to the UIs--it is not * used by the libpurple core. */ -gpointer purple_conversation_get_ui_data(PurpleConversation *conv); +gpointer purple_conversation_get_ui_data(const PurpleConversation *conv); /*@}*/ diff --git a/libpurple/ft.c b/libpurple/ft.c index f8e5d0138c..fb61af37c3 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -1710,7 +1710,7 @@ purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data) } gpointer -purple_xfer_get_protocol_data(PurpleXfer *xfer) +purple_xfer_get_protocol_data(const PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, NULL); @@ -1724,7 +1724,7 @@ void purple_xfer_set_ui_data(PurpleXfer *xfer, gpointer ui_data) xfer->ui_data = ui_data; } -gpointer purple_xfer_get_ui_data(PurpleXfer *xfer) +gpointer purple_xfer_get_ui_data(const PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, NULL); diff --git a/libpurple/ft.h b/libpurple/ft.h index 3cb745fb6f..3fb2c4818d 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -756,7 +756,7 @@ void purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data); * * @since 3.0.0 */ -gpointer purple_xfer_get_protocol_data(PurpleXfer *xfer); +gpointer purple_xfer_get_protocol_data(const PurpleXfer *xfer); /** * Set the UI data associated with this file transfer. @@ -775,7 +775,7 @@ void purple_xfer_set_ui_data(PurpleXfer *xfer, gpointer ui_data); * convenience field provided to the UIs--it is not * used by the libpurple core. */ -gpointer purple_xfer_get_ui_data(PurpleXfer *xfer); +gpointer purple_xfer_get_ui_data(const PurpleXfer *xfer); /*@}*/ -- cgit v1.2.1 From e6554aba23a59df28d4a6d0b0b5afa9204983f4d Mon Sep 17 00:00:00 2001 From: Daniel Atallah Date: Mon, 29 Aug 2011 02:53:05 +0000 Subject: Fix SILC for purple_xfer_[gs][4~et_protocol_data. --- libpurple/protocols/silc/ft.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libpurple/protocols/silc/ft.c b/libpurple/protocols/silc/ft.c index 0fad6d66e4..a8ce2da4b3 100644 --- a/libpurple/protocols/silc/ft.c +++ b/libpurple/protocols/silc/ft.c @@ -76,7 +76,7 @@ silcpurple_ftp_monitor(SilcClient client, if (status == SILC_CLIENT_FILE_MONITOR_CLOSED) { /* All started sessions terminate here */ - xfer->xfer->data = NULL; + purple_xfer_set_protocol_data(xfer->xfer, NULL); purple_xfer_unref(xfer->xfer); silc_free(xfer); return; @@ -150,7 +150,7 @@ silcpurple_ftp_monitor(SilcClient client, static void silcpurple_ftp_cancel(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); if (!xfer) return; @@ -163,7 +163,7 @@ silcpurple_ftp_cancel(PurpleXfer *x) static void silcpurple_ftp_ask_name_cancel(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); if (!xfer) return; @@ -176,7 +176,7 @@ silcpurple_ftp_ask_name_cancel(PurpleXfer *x) static void silcpurple_ftp_ask_name_ok(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); const char *name; if (!xfer) @@ -212,7 +212,7 @@ silcpurple_ftp_ask_name(SilcClient client, static void silcpurple_ftp_request_result(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); SilcClientFileError status; PurpleConnection *gc = xfer->sg->gc; SilcClientConnectionParams params; @@ -337,7 +337,7 @@ void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, purple_xfer_set_cancel_recv_fnc(xfer->xfer, silcpurple_ftp_cancel); xfer->xfer->remote_ip = g_strdup(hostname); xfer->xfer->remote_port = port; - xfer->xfer->data = xfer; + purple_xfer_set_protocol_data(xfer->xfer, xfer); /* File transfer request */ purple_xfer_request(xfer->xfer); @@ -346,7 +346,7 @@ void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, static void silcpurple_ftp_send_cancel(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); if (!xfer) return; @@ -358,7 +358,7 @@ silcpurple_ftp_send_cancel(PurpleXfer *x) static void silcpurple_ftp_send(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); const char *name; char *local_ip = NULL, *remote_ip = NULL; gboolean local = TRUE; @@ -467,7 +467,7 @@ PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name) purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_send); purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); purple_xfer_set_cancel_send_fnc(xfer->xfer, silcpurple_ftp_send_cancel); - xfer->xfer->data = xfer; + purple_xfer_set_protocol_data(xfer->xfer, xfer); silc_free(clients); -- cgit v1.2.1 From c4049a81b9f3b9bc27879280b2f9c994bde2fd36 Mon Sep 17 00:00:00 2001 From: Daniel Atallah Date: Mon, 29 Aug 2011 03:02:47 +0000 Subject: Use appropriate printf format for gsize --- pidgin/gtkconv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 6b0ed8399b..74239b2037 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -4848,7 +4848,7 @@ setup_chat_userlist(PidginConversation *gtkconv, GtkWidget *hpaned) gtkchat->list = list; - gtk_box_pack_start(GTK_BOX(lbox), + gtk_box_pack_start(GTK_BOX(lbox), pidgin_make_scrollable(list, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1), TRUE, TRUE, 0); } @@ -6451,7 +6451,7 @@ pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, if (!gdk_pixbuf_loader_write(smiley->loader, data, size, &error) || error) { purple_debug_warning("gtkconv", "gdk_pixbuf_loader_write() " - "failed with size=%zu: %s\n", size, + "failed with size=%" G_GSIZE_FORMAT ": %s\n", size, error ? error->message : "(no error message)"); if (error) g_error_free(error); -- cgit v1.2.1 From 870f159744977421dacf1d23608f767674e92785 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 29 Aug 2011 21:32:30 +0000 Subject: Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/bonjour/bonjour.c | 17 ++++++++++------- libpurple/protocols/bonjour/bonjour_ft.c | 8 ++++---- libpurple/protocols/bonjour/jabber.c | 11 +++++++---- libpurple/protocols/bonjour/mdns_avahi.c | 2 +- libpurple/protocols/bonjour/mdns_common.c | 2 +- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c index 805f4d3b10..a3f0455bc3 100644 --- a/libpurple/protocols/bonjour/bonjour.c +++ b/libpurple/protocols/bonjour/bonjour.c @@ -51,7 +51,7 @@ const char * bonjour_get_jid(PurpleAccount *account) { PurpleConnection *conn = purple_account_get_connection(account); - BonjourData *bd = conn->proto_data; + BonjourData *bd = purple_connection_get_protocol_data(conn); return bd->jid; } @@ -103,7 +103,8 @@ bonjour_login(PurpleAccount *account) #endif /* _WIN32 */ gc->flags |= PURPLE_CONNECTION_HTML; - gc->proto_data = bd = g_new0(BonjourData, 1); + bd = g_new0(BonjourData, 1); + purple_connection_set_protocol_data(gc, bd); /* Start waiting for jabber connections (iChat style) */ bd->jabber_data = g_new0(BonjourJabber, 1); @@ -157,7 +158,7 @@ static void bonjour_close(PurpleConnection *connection) { PurpleGroup *bonjour_group; - BonjourData *bd = connection->proto_data; + BonjourData *bd = purple_connection_get_protocol_data(connection); bonjour_group = purple_find_group(BONJOUR_GROUP_NAME); @@ -192,7 +193,7 @@ bonjour_close(PurpleConnection *connection) if (bd != NULL) g_free(bd->jid); g_free(bd); - connection->proto_data = NULL; + purple_connection_set_protocol_data(connection, NULL); } static const char * @@ -204,10 +205,12 @@ bonjour_list_icon(PurpleAccount *account, PurpleBuddy *buddy) static int bonjour_send_im(PurpleConnection *connection, const char *to, const char *msg, PurpleMessageFlags flags) { + BonjourData *bd = purple_connection_get_protocol_data(connection); + if(!to || !msg) return 0; - return bonjour_jabber_send_message(((BonjourData*)(connection->proto_data))->jabber_data, to, msg); + return bonjour_jabber_send_message(bd->jabber_data, to, msg); } static void @@ -220,7 +223,7 @@ bonjour_set_status(PurpleAccount *account, PurpleStatus *status) gchar *stripped; gc = purple_account_get_connection(account); - bd = gc->proto_data; + bd = purple_connection_get_protocol_data(gc); presence = purple_account_get_presence(account); message = purple_status_get_attr_string(status, "message"); @@ -325,7 +328,7 @@ bonjour_convo_closed(PurpleConnection *connection, const char *who) static void bonjour_set_buddy_icon(PurpleConnection *conn, PurpleStoredImage *img) { - BonjourData *bd = conn->proto_data; + BonjourData *bd = purple_connection_get_protocol_data(conn); bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data); } diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index 2f6037e9f8..dd267f14ba 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -328,7 +328,7 @@ bonjour_new_xfer(PurpleConnection *gc, const char *who) return NULL; purple_debug_info("bonjour", "Bonjour-new-xfer to %s.\n", who); - bd = (BonjourData*) gc->proto_data; + bd = purple_connection_get_protocol_data(gc); if(bd == NULL) return NULL; @@ -417,7 +417,7 @@ xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) g_return_if_fail(packet != NULL); g_return_if_fail(pb != NULL); - bd = (BonjourData*) pc->proto_data; + bd = purple_connection_get_protocol_data(pc); if(bd == NULL) return; @@ -503,7 +503,7 @@ xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) g_return_if_fail(packet != NULL); g_return_if_fail(pb != NULL); - bd = (BonjourData*) pc->proto_data; + bd = purple_connection_get_protocol_data(pc); if(bd == NULL) return; @@ -585,7 +585,7 @@ bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, cons if(pc == NULL || id == NULL || from == NULL) return; - bd = (BonjourData*) pc->proto_data; + bd = purple_connection_get_protocol_data(pc); if(bd == NULL) return; diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index 7a15be7953..94e82c3cf7 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -930,7 +930,8 @@ bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { ip = tmp->data; if (ip != NULL && g_ascii_strcasecmp(ip, bconv->ip) == 0) { PurpleConnection *pc = purple_account_get_connection(bconv->account); - BonjourJabber *jdata = ((BonjourData *)pc->proto_data)->jabber_data; + BonjourData *bd = purple_connection_get_protocol_data(pc); + BonjourJabber *jdata = bd->jabber_data; purple_debug_info("bonjour", "Matched buddy %s to incoming conversation \"from\" attrib and IP (%s)\n", purple_buddy_get_name(pb), bconv->ip); @@ -964,7 +965,8 @@ bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { void bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) { PurpleConnection *pc = purple_account_get_connection(bconv->account); - BonjourJabber *jdata = ((BonjourData *)pc->proto_data)->jabber_data; + BonjourData *bd = purple_connection_get_protocol_data(pc); + BonjourJabber *jdata = bd->jabber_data; struct _match_buddies_by_address_t *mbba; GSList *buddies; @@ -1125,7 +1127,8 @@ _async_bonjour_jabber_close_conversation_cb(gpointer data) { void async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) { PurpleConnection *pc = purple_account_get_connection(bconv->account); - BonjourJabber *jdata = ((BonjourData *)pc->proto_data)->jabber_data; + BonjourData *bd = purple_connection_get_protocol_data(pc); + BonjourJabber *jdata = bd->jabber_data; jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); @@ -1147,7 +1150,7 @@ bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) PurpleConnection *pc = purple_account_get_connection(bconv->account); if (PURPLE_CONNECTION_IS_VALID(pc)) { - bd = pc->proto_data; + bd = purple_connection_get_protocol_data(pc); bd->jabber_data->pending_conversations = g_slist_remove(bd->jabber_data->pending_conversations, bconv); } diff --git a/libpurple/protocols/bonjour/mdns_avahi.c b/libpurple/protocols/bonjour/mdns_avahi.c index c402e056de..e3d127e0c9 100644 --- a/libpurple/protocols/bonjour/mdns_avahi.c +++ b/libpurple/protocols/bonjour/mdns_avahi.c @@ -615,7 +615,7 @@ void _mdns_delete_buddy(BonjourBuddy *buddy) { void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) { PurpleConnection *conn = purple_account_get_connection(buddy->account); - BonjourData *bd = conn->proto_data; + BonjourData *bd = purple_connection_get_protocol_data(conn); AvahiSessionImplData *session_idata = bd->dns_sd_data->mdns_impl_data; AvahiBuddyImplData *idata = buddy->mdns_impl_data; gchar *name; diff --git a/libpurple/protocols/bonjour/mdns_common.c b/libpurple/protocols/bonjour/mdns_common.c index 9319e36160..1f87b6496e 100644 --- a/libpurple/protocols/bonjour/mdns_common.c +++ b/libpurple/protocols/bonjour/mdns_common.c @@ -257,7 +257,7 @@ void bonjour_dns_sd_set_jid(PurpleAccount *account, const char *hostname) { PurpleConnection *conn = purple_account_get_connection(account); - BonjourData *bd = conn->proto_data; + BonjourData *bd = purple_connection_get_protocol_data(conn); const char *tmp, *account_name = purple_account_get_username(account); /* Previously we allowed the hostname part of the jid to be set -- cgit v1.2.1 From 725a0ea106c73db0dc30ea4a3c9b8714fca2c97e Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 29 Aug 2011 21:52:24 +0000 Subject: Convert gg prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/gg/buddylist.c | 2 +- libpurple/protocols/gg/confer.c | 8 ++-- libpurple/protocols/gg/gg.c | 84 ++++++++++++++++++++------------------ libpurple/protocols/gg/search.c | 2 +- 4 files changed, 50 insertions(+), 46 deletions(-) diff --git a/libpurple/protocols/gg/buddylist.c b/libpurple/protocols/gg/buddylist.c index 7ed9439f4e..4aefe8093e 100644 --- a/libpurple/protocols/gg/buddylist.c +++ b/libpurple/protocols/gg/buddylist.c @@ -38,7 +38,7 @@ /* void ggp_buddylist_send(PurpleConnection *gc) {{{ */ void ggp_buddylist_send(PurpleConnection *gc) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); GSList *buddies; uin_t *userlist; diff --git a/libpurple/protocols/gg/confer.c b/libpurple/protocols/gg/confer.c index dad03d6518..1f2530a8fb 100644 --- a/libpurple/protocols/gg/confer.c +++ b/libpurple/protocols/gg/confer.c @@ -42,7 +42,7 @@ void ggp_confer_participants_add_uin(PurpleConnection *gc, const gchar *chat_nam const uin_t uin) { PurpleConversation *conv; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPChat *chat; GList *l; gchar *str_uin; @@ -73,7 +73,7 @@ void ggp_confer_participants_add_uin(PurpleConnection *gc, const gchar *chat_nam void ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name, const uin_t *recipients, int count) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GList *l; gchar *str_uin; @@ -111,7 +111,7 @@ void ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name, const char *ggp_confer_find_by_participants(PurpleConnection *gc, const uin_t *recipients, int count) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPChat *chat = NULL; GList *l; int matches; @@ -149,7 +149,7 @@ const char *ggp_confer_find_by_participants(PurpleConnection *gc, /* const char *ggp_confer_add_new(PurpleConnection *gc, const char *name) {{{ */ const char *ggp_confer_add_new(PurpleConnection *gc, const char *name) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPChat *chat; chat = g_new0(GGPChat, 1); diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 5f859ca76a..fc93d3119a 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -97,7 +97,7 @@ static int ggp_setup_proxy(PurpleAccount *account) static void ggp_async_token_handler(gpointer _gc, gint fd, PurpleInputCondition cond) { PurpleConnection *gc = _gc; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPToken *token = info->token; GGPTokenCallback cb; @@ -170,7 +170,7 @@ static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb) if (ggp_setup_proxy(account) == -1) return; - info = gc->proto_data; + info = purple_connection_get_protocol_data(gc); if ((req = gg_token(1)) == NULL) { purple_notify_error(account, @@ -199,7 +199,7 @@ static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb) static void ggp_action_buddylist_get(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); purple_debug_info("gg", "Downloading...\n"); @@ -214,7 +214,7 @@ static void ggp_action_buddylist_get(PurplePluginAction *action) static void ggp_action_buddylist_put(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); char *buddylist = ggp_buddylist_dump(purple_connection_get_account(gc)); @@ -235,7 +235,7 @@ static void ggp_action_buddylist_put(PurplePluginAction *action) static void ggp_action_buddylist_delete(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); purple_debug_info("gg", "Deleting...\n"); @@ -334,7 +334,7 @@ static void ggp_callback_register_account_ok(PurpleConnection *gc, PurpleRequestFields *fields) { PurpleAccount *account; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); struct gg_http *h = NULL; struct gg_pubdir *s; uin_t uin; @@ -415,7 +415,7 @@ exit_err: static void ggp_callback_register_account_cancel(PurpleConnection *gc, PurpleRequestFields *fields) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPToken *token = info->token; purple_account_disconnect(gc->account); @@ -433,7 +433,7 @@ static void ggp_register_user_dialog(PurpleConnection *gc) PurpleRequestFieldGroup *group; PurpleRequestField *field; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPToken *token = info->token; @@ -483,7 +483,7 @@ static void ggp_register_user_dialog(PurpleConnection *gc) static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPSearchForm *form = user_data; guint32 seq; @@ -520,7 +520,7 @@ static void ggp_callback_im(PurpleConnection *gc, GList *row, gpointer user_data static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPSearchForm *form; guint32 seq; @@ -621,7 +621,7 @@ static void ggp_find_buddies(PurplePluginAction *action) static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields) { PurpleAccount *account; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); struct gg_http *h; gchar *cur, *p1, *p2, *t; @@ -696,7 +696,7 @@ static void ggp_change_passwd_dialog(PurpleConnection *gc) PurpleRequestFieldGroup *group; PurpleRequestField *field; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPToken *token = info->token; char *msg; @@ -758,7 +758,7 @@ static void ggp_change_passwd(PurplePluginAction *action) static void ggp_action_change_status_broadcasting_ok(PurpleConnection *gc, PurpleRequestFields *fields) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); int selected_field; PurpleAccount *account = purple_connection_get_account(gc); PurpleStatus *status; @@ -778,7 +778,7 @@ static void ggp_action_change_status_broadcasting_ok(PurpleConnection *gc, Purpl static void ggp_action_change_status_broadcasting(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); PurpleRequestFields *fields; PurpleRequestFieldGroup *group; @@ -848,7 +848,7 @@ static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) buddy = (PurpleBuddy *)node; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - info = gc->proto_data; + info = purple_connection_get_protocol_data(gc); fields = purple_request_fields_new(); group = purple_request_field_group_new(NULL); @@ -879,7 +879,7 @@ static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) static void ggp_add_deny(PurpleConnection *gc, const char *who) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); uin_t uin = ggp_str_to_uin(who); purple_debug_info("gg", "ggp_add_deny: %u\n", uin); @@ -890,7 +890,7 @@ static void ggp_add_deny(PurpleConnection *gc, const char *who) static void ggp_rem_deny(PurpleConnection *gc, const char *who) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); uin_t uin = ggp_str_to_uin(who); purple_debug_info("gg", "ggp_rem_deny: %u\n", uin); @@ -1349,7 +1349,7 @@ static void ggp_pubdir_handle_full(PurpleConnection *gc, gg_pubdir50_t req, static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPSearchForm *form; int res_count; guint32 seq; @@ -1391,7 +1391,7 @@ static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) static void ggp_recv_image_handler(PurpleConnection *gc, const struct gg_event *ev) { gint imgid = 0; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GList *entry = g_list_first(info->pending_richtext_messages); gchar *handlerid = g_strdup_printf("IMGID_HANDLER-%i", ev->event.image_reply.crc32); @@ -1439,7 +1439,7 @@ static void ggp_recv_image_handler(PurpleConnection *gc, const struct gg_event * */ static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); PurpleConversation *conv; gchar *from; gchar *msg; @@ -1608,7 +1608,7 @@ static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event static void ggp_send_image_handler(PurpleConnection *gc, const struct gg_event *ev) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); PurpleStoredImage *image; gint imgid = GPOINTER_TO_INT(g_hash_table_lookup(info->pending_images, GINT_TO_POINTER(ev->event.image_request.crc32))); @@ -1714,7 +1714,7 @@ static void ggp_xml_event_handler(PurpleConnection *gc, char *data) static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) { PurpleConnection *gc = _gc; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); struct gg_event *ev; int i; @@ -1849,7 +1849,7 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); - info = gc->proto_data; + info = purple_connection_get_protocol_data(gc); purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", info->session->check, info->session->state); @@ -2067,13 +2067,15 @@ static GList *ggp_blist_node_menu(PurpleBlistNode *node) PurpleMenuAction *act; GList *m = NULL; PurpleAccount *account; + PurpleConnection *gc; GGPInfo *info; if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) return NULL; account = purple_buddy_get_account((PurpleBuddy *) node); - info = purple_account_get_connection(account)->proto_data; + gc = purple_account_get_connection(account); + info = purple_connection_get_protocol_data(gc); if (info->chats) { act = purple_menu_action_new(_("Add to chat"), PURPLE_CALLBACK(ggp_bmenu_add_to_chat), @@ -2125,7 +2127,7 @@ static void ggp_login(PurpleAccount *account) info->pending_images = g_hash_table_new(g_direct_hash, g_direct_equal); info->status_broadcasting = purple_account_get_bool(account, "status_broadcasting", TRUE); - gc->proto_data = info; + purple_connection_set_protocol_data(gc, info); glp->uin = ggp_get_uin(account); glp->password = (char *)purple_account_get_password(account); @@ -2189,18 +2191,19 @@ static void ggp_login(PurpleAccount *account) static void ggp_close(PurpleConnection *gc) { + PurpleAccount *account; + GGPInfo *info;; if (gc == NULL) { purple_debug_info("gg", "gc == NULL\n"); return; } - if (gc->proto_data) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStatus *status; - GGPInfo *info = gc->proto_data; + account = purple_connection_get_account(gc); + info = purple_connection_get_protocol_data(gc); - status = purple_account_get_active_status(account); + if (info) { + PurpleStatus *status = purple_account_get_active_status(account); if (info->session != NULL) { ggp_set_status(account, status); @@ -2219,7 +2222,7 @@ static void ggp_close(PurpleConnection *gc) g_list_free(info->pending_richtext_messages); g_hash_table_destroy(info->pending_images); g_free(info); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } if (gc->inpa > 0) @@ -2231,7 +2234,7 @@ static void ggp_close(PurpleConnection *gc) static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, PurpleMessageFlags flags) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); char *tmp, *plain; int ret = 1; unsigned char format[1024]; @@ -2349,6 +2352,7 @@ static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, static unsigned int ggp_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) { + GGPInfo *info = purple_connection_get_protocol_data(gc); int dummy_length; // we don't send real length of typed message if (state == PURPLE_TYPED) // not supported @@ -2360,7 +2364,7 @@ static unsigned int ggp_send_typing(PurpleConnection *gc, const char *name, Purp dummy_length = 0; gg_typing_notification( - ((GGPInfo*)gc->proto_data)->session, + info->session, ggp_str_to_uin(name), dummy_length); @@ -2369,7 +2373,7 @@ static unsigned int ggp_send_typing(PurpleConnection *gc, const char *name, Purp static void ggp_get_info(PurpleConnection *gc, const char *name) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPSearchForm *form; guint32 seq; @@ -2445,7 +2449,7 @@ static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) return; gc = purple_account_get_connection(account); - info = gc->proto_data; + info = purple_connection_get_protocol_data(gc); new_status = ggp_to_gg_status(status, &new_msg); @@ -2466,7 +2470,7 @@ static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { PurpleAccount *account; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); const gchar *name = purple_buddy_get_name(buddy); gg_add_notify(info->session, ggp_str_to_uin(name)); @@ -2480,14 +2484,14 @@ static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); gg_remove_notify(info->session, ggp_str_to_uin(purple_buddy_get_name(buddy))); } static void ggp_join_chat(PurpleConnection *gc, GHashTable *data) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPChat *chat; char *chat_name; GList *l; @@ -2525,7 +2529,7 @@ static char *ggp_get_chat_name(GHashTable *data) { static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) { PurpleConversation *conv; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPChat *chat = NULL; GList *l; /* char *msg, *plain; */ @@ -2580,7 +2584,7 @@ static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, Purp static void ggp_keepalive(PurpleConnection *gc) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); /* purple_debug_info("gg", "Keeping connection alive....\n"); */ diff --git a/libpurple/protocols/gg/search.c b/libpurple/protocols/gg/search.c index 67bb1bda18..d3ec62b06b 100644 --- a/libpurple/protocols/gg/search.c +++ b/libpurple/protocols/gg/search.c @@ -135,7 +135,7 @@ void ggp_search_destroy(GGPSearches *searches) /* guint32 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form) {{{ */ guint32 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); gg_pubdir50_t req; guint seq, offset; -- cgit v1.2.1 From de70554638982231a22c57fff5ac07ebfb57afb1 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 29 Aug 2011 22:08:01 +0000 Subject: Convert myspace prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/myspace/myspace.c | 41 ++++++++++++++++++----------------- libpurple/protocols/myspace/user.c | 4 ++-- libpurple/protocols/myspace/zap.c | 4 ++-- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index 57cadab49c..41a9ffcd62 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -429,11 +429,9 @@ msim_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, user = msim_get_user_from_buddy(buddy, TRUE); if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - MsimSession *session; PurpleAccount *account = purple_buddy_get_account(buddy); PurpleConnection *gc = purple_account_get_connection(account); - - session = (MsimSession *)gc->proto_data; + MsimSession *session = purple_connection_get_protocol_data(gc); /* TODO: if (full), do something different? */ @@ -2022,7 +2020,7 @@ msim_input_cb(gpointer gc_uncasted, gint source, PurpleInputCondition cond) g_return_if_fail(source >= 0); /* Note: 0 is a valid fd */ gc = (PurpleConnection *)(gc_uncasted); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* libpurple/eventloop.h only defines these two */ if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) { @@ -2157,7 +2155,7 @@ msim_connect_cb(gpointer data, gint source, const gchar *error_message) g_return_if_fail(data != NULL); gc = (PurpleConnection *)data; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); if (source < 0) { gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), @@ -2191,7 +2189,7 @@ msim_login(PurpleAccount *acct) purple_debug_info("msim", "logging in %s\n", acct->username); gc = purple_account_get_connection(acct); - gc->proto_data = msim_session_new(acct); + purple_connection_set_protocol_data(gc, msim_session_new(acct)); gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC; /* @@ -2259,11 +2257,11 @@ msim_close(PurpleConnection *gc) buddies = g_slist_delete_link(buddies, buddies); } - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); if (session == NULL) return; - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); if (session->gc->inpa) { purple_input_remove(session->gc->inpa); @@ -2304,7 +2302,7 @@ msim_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, /* 'flags' has many options, not used here. */ - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); message_msim = html_to_msim_markup(session, message); @@ -2344,7 +2342,7 @@ msim_send_typing(PurpleConnection *gc, const gchar *name, g_return_val_if_fail(gc != NULL, 0); g_return_val_if_fail(name != NULL, 0); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); switch (state) { case PURPLE_TYPING: @@ -2430,7 +2428,7 @@ msim_get_info(PurpleConnection *gc, const gchar *username) g_return_if_fail(gc != NULL); g_return_if_fail(username != NULL); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* Obtain uid of buddy. */ user = msim_find_user(session, username); @@ -2487,6 +2485,7 @@ msim_set_status_code(MsimSession *session, guint status_code, gchar *statstring) static void msim_set_status(PurpleAccount *account, PurpleStatus *status) { + PurpleConnection *gc = purple_account_get_connection(account); PurpleStatusType *type; PurplePresence *pres; MsimSession *session; @@ -2495,7 +2494,7 @@ msim_set_status(PurpleAccount *account, PurpleStatus *status) gchar *stripped; gchar *unrecognized_msg; - session = (MsimSession *)account->gc->proto_data; + session = purple_connection_get_protocol_data(gc); type = purple_status_get_type(status); pres = purple_status_get_presence(status); @@ -2558,7 +2557,7 @@ msim_set_idle(PurpleConnection *gc, int time) g_return_if_fail(gc != NULL); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); status = purple_account_get_active_status(session->account); @@ -2636,7 +2635,7 @@ msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) MsimMessage *body; const char *name, *gname; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); name = purple_buddy_get_name(buddy); gname = group ? purple_group_get_name(group) : NULL; @@ -2709,7 +2708,7 @@ msim_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) MsimMessage *persist_msg; const char *name; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); name = purple_buddy_get_name(buddy); delbuddy_msg = msim_msg_new( @@ -2766,7 +2765,7 @@ msim_add_deny(PurpleConnection *gc, const char *name) MsimSession *session; MsimMessage *msg, *body; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* Remove from buddy list */ msg = msim_msg_new( @@ -2818,7 +2817,7 @@ msim_rem_deny(PurpleConnection *gc, const char *name) MsimSession *session; MsimMessage *msg, *body; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* * Remove from our list of blocked contacts, so we know they @@ -2948,7 +2947,7 @@ msim_send_really_raw(PurpleConnection *gc, const char *buf, int total_bytes) g_return_val_if_fail(buf != NULL, -1); g_return_val_if_fail(total_bytes >= 0, -1); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* Loop until all data is sent, or a failure occurs. */ total_bytes_sent = 0; @@ -3151,7 +3150,7 @@ static void msim_import_friends(PurplePluginAction *action) gchar *group_name; gc = (PurpleConnection *)action->context; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); group_name = "MySpace Friends"; @@ -3530,6 +3529,7 @@ static gboolean msim_uri_handler(const gchar *proto, const gchar *cmd, GHashTable *params) { PurpleAccount *account; + PurpleConnection *gc; MsimSession *session; GList *l; gchar *uid_str, *cid_str; @@ -3578,7 +3578,8 @@ msim_uri_handler(const gchar *proto, const gchar *cmd, GHashTable *params) return FALSE; } - session = (MsimSession *)account->gc->proto_data; + gc = purple_account_get_connection(account); + session = purple_connection_get_protocol_data(gc); g_return_val_if_fail(session != NULL, FALSE); /* Lookup userid to username. TODO: push this down, to IM sending/contact diff --git a/libpurple/protocols/myspace/user.c b/libpurple/protocols/myspace/user.c index 4d42cc5cdf..85c1784fc7 100644 --- a/libpurple/protocols/myspace/user.c +++ b/libpurple/protocols/myspace/user.c @@ -758,7 +758,7 @@ static void msim_set_username_confirmed_cb(PurpleConnection *gc) g_return_if_fail(gc != NULL); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); user_msg = msim_msg_new( "user", MSIM_TYPE_STRING, g_strdup(msim_username_to_set), @@ -851,7 +851,7 @@ static void msim_check_username_availability_cb(PurpleConnection *gc, const char g_return_if_fail(gc != NULL); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); purple_debug_info("msim_check_username_availability_cb", "Checking username: %s\n", username_to_check); diff --git a/libpurple/protocols/myspace/zap.c b/libpurple/protocols/myspace/zap.c index ed45e56d24..ee19ed3666 100644 --- a/libpurple/protocols/myspace/zap.c +++ b/libpurple/protocols/myspace/zap.c @@ -132,7 +132,7 @@ msim_send_attention(PurpleConnection *gc, const gchar *username, guint code) PurpleAttentionType *attn; PurpleBuddy *buddy; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* Look for this attention type, by the code index given. */ types = msim_attention_types(gc->account); @@ -175,7 +175,7 @@ msim_send_zap_from_menu(PurpleBlistNode *node, gpointer zap_num_ptr) /* Find the session */ account = purple_buddy_get_account(buddy); gc = purple_account_get_connection(account); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); zap = GPOINTER_TO_INT(zap_num_ptr); -- cgit v1.2.1 From bf214aec3297ae3e32803607b8d986d530a004e1 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 29 Aug 2011 22:14:23 +0000 Subject: Update nullprpl for various API changes. --- libpurple/protocols/null/nullprpl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index 32b61f39c9..b6d972cb6b 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -260,7 +260,7 @@ static void nullprpl_tooltip_text(PurpleBuddy *buddy, char *msg = nullprpl_status_text(buddy); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(info, purple_status_get_name(status), + purple_notify_user_info_add_pair_html(info, purple_status_get_name(status), msg); g_free(msg); @@ -269,7 +269,7 @@ static void nullprpl_tooltip_text(PurpleBuddy *buddy, if (user_info) /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(info, _("User info"), user_info); + purple_notify_user_info_add_pair_html(info, _("User info"), user_info); } } else { @@ -516,7 +516,7 @@ static void nullprpl_get_info(PurpleConnection *gc, const char *username) { body = _("No user info."); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(info, "Info", body); + purple_notify_user_info_add_pair_html(info, "Info", body); /* show a buddy's user info in a nice dialog box */ purple_notify_userinfo(gc, /* connection the buddy info came through */ @@ -1019,14 +1019,17 @@ static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { } static void nullprpl_roomlist_cancel(PurpleRoomlist *list) { + PurpleAccount *account = purple_roomlist_get_account(list); purple_debug_info("nullprpl", "%s asked to cancel room list request\n", - list->account->username); + purple_account_get_username(account)); } static void nullprpl_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) { + PurpleAccount *account = purple_roomlist_get_account(list); purple_debug_info("nullprpl", "%s asked to expand room list category %s\n", - list->account->username, category->name); + purple_account_get_username(account), + purple_roomlist_room_get_name(category)); } /* nullprpl doesn't support file transfer...yet... */ -- cgit v1.2.1 From 6599165bbb0d96183a0acf120d25b604ddff054a Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 29 Aug 2011 22:16:06 +0000 Subject: Should use accessor function purple_connection_get_protocol_data() here. --- libpurple/protocols/oscar/oscar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index b3367755dd..0979bc23c7 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -5040,7 +5040,7 @@ oscar_close_directim(gpointer object, gpointer ignored) name = purple_buddy_get_name(buddy); account = purple_buddy_get_account(buddy); gc = purple_account_get_connection(account); - od = gc->proto_data; + od = purple_connection_get_protocol_data(gc); conn = peer_connection_find_by_type(od, name, OSCAR_CAPABILITY_DIRECTIM); if (conn != NULL) -- cgit v1.2.1 From 8e89b9009a19d844eb1e8b6e0955307a52d02861 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 29 Aug 2011 22:27:11 +0000 Subject: Convert zephyr prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/zephyr/zephyr.c | 58 +++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 367dc7e74d..493012a55f 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -347,7 +347,7 @@ static gchar *zephyr_recv_convert(PurpleConnection *gc, gchar *string) { gchar *utf8; GError *err = NULL; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if (g_utf8_validate(string, -1, NULL)) { return g_strdup(string); } else { @@ -762,7 +762,7 @@ static void message_failed(PurpleConnection *gc, ZNotice_t notice, struct sockad static void handle_message(PurpleConnection *gc,ZNotice_t notice) { - zephyr_account* zephyr = gc->proto_data; + zephyr_account* zephyr = purple_connection_get_protocol_data(gc); if (!g_ascii_strcasecmp(notice.z_class, LOGIN_CLASS)) { /* well, we'll be updating in 20 seconds anyway, might as well ignore this. */ @@ -872,7 +872,7 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) } else { zephyr_triple *zt1, *zt2; gchar *send_inst_utf8; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); zt1 = new_triple(zephyr,notice.z_class, notice.z_class_inst, notice.z_recipient); zt2 = find_sub_by_triple(zephyr,zt1); if (!zt2) { @@ -1109,7 +1109,7 @@ static parse_tree *read_from_tzc(zephyr_account* zephyr){ static gint check_notify_tzc(gpointer data) { PurpleConnection *gc = (PurpleConnection *)data; - zephyr_account* zephyr = gc->proto_data; + zephyr_account* zephyr = purple_connection_get_protocol_data(gc); parse_tree *newparsetree = read_from_tzc(zephyr); if (newparsetree != NULL) { gchar *spewtype; @@ -1265,7 +1265,7 @@ static gint check_loc(gpointer data) GSList *buddies; ZLocations_t locations; PurpleConnection *gc = data; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); int numlocs; int one = 1; @@ -1296,7 +1296,7 @@ static gint check_loc(gpointer data) GSList *buddies; ZAsyncLocateData_t ald; PurpleConnection *gc = (PurpleConnection *)data; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); if (use_zeph02(zephyr)) { @@ -1572,7 +1572,8 @@ static void zephyr_login(PurpleAccount * account) username = purple_account_get_username(account); #endif gc->flags |= PURPLE_CONNECTION_AUTO_RESP | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; - gc->proto_data = zephyr=g_new0(zephyr_account,1); + zephyr = g_new0(zephyr_account, 1); + purple_connection_set_protocol_data(gc, zephyr); zephyr->account = account; @@ -1961,7 +1962,7 @@ static void zephyr_close(PurpleConnection * gc) { GList *l; GSList *s; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); pid_t tzc_pid = zephyr->tzc_pid; l = zephyr->pending_zloc_names; @@ -2036,7 +2037,7 @@ static int zephyr_chat_send(PurpleConnection * gc, int id, const char *im, Purpl PurpleConvChat *gcc; char *inst; char *recipient; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); zt = find_sub_by_id(zephyr,id); if (!zt) @@ -2065,7 +2066,7 @@ static int zephyr_chat_send(PurpleConnection * gc, int id, const char *im, Purpl static int zephyr_send_im(PurpleConnection * gc, const char *who, const char *im, PurpleMessageFlags flags) { const char *sig; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if (flags & PURPLE_MESSAGE_AUTO_RESP) sig = "Automated reply:"; else { @@ -2234,7 +2235,7 @@ static const char *zephyr_normalize(const PurpleAccount *account, const char *wh if (gc == NULL) return NULL; - tmp = local_zephyr_normalize(gc->proto_data, who); + tmp = local_zephyr_normalize(purple_connection_get_protocol_data(gc), who); if (strlen(tmp) >= sizeof(buf)) { g_free(tmp); @@ -2250,7 +2251,7 @@ static const char *zephyr_normalize(const PurpleAccount *account, const char *wh static void zephyr_zloc(PurpleConnection *gc, const char *who) { ZAsyncLocateData_t ald; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); gchar* normalized_who = local_zephyr_normalize(zephyr,who); if (use_zeph02(zephyr)) { @@ -2277,7 +2278,8 @@ static void zephyr_zloc(PurpleConnection *gc, const char *who) static void zephyr_set_status(PurpleAccount *account, PurpleStatus *status) { size_t len; size_t result; - zephyr_account *zephyr = purple_account_get_connection(account)->proto_data; + PurpleConnection *gc = purple_account_get_connection(account); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_type(status)); if (zephyr->away) { @@ -2411,7 +2413,7 @@ static void zephyr_join_chat(PurpleConnection * gc, GHashTable * data) const char *classname; const char *instname; const char *recip; - zephyr_account *zephyr=gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); classname = g_hash_table_lookup(data, "class"); instname = g_hash_table_lookup(data, "instance"); recip = g_hash_table_lookup(data, "recipient"); @@ -2474,7 +2476,7 @@ static void zephyr_join_chat(PurpleConnection * gc, GHashTable * data) static void zephyr_chat_leave(PurpleConnection * gc, int id) { zephyr_triple *zt; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); zt = find_sub_by_id(zephyr,id); if (zt) { @@ -2524,7 +2526,7 @@ static const char *zephyr_list_icon(PurpleAccount * a, PurpleBuddy * b) static unsigned int zephyr_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) { gchar *recipient; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if (use_tzc(zephyr)) return 0; @@ -2566,7 +2568,7 @@ static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *top PurpleConversation *gconv; PurpleConvChat *gcc; gchar *topic_utf8; - zephyr_account* zephyr = gc->proto_data; + zephyr_account* zephyr = purple_connection_get_protocol_data(gc); char *sender = (char *)zephyr->username; zt = find_sub_by_id(zephyr,id); @@ -2589,7 +2591,8 @@ static PurpleCmdRet zephyr_purple_cmd_msg(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { char *recipient; - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_gc(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc);; if (!g_ascii_strcasecmp(args[0],"*")) return PURPLE_CMD_RET_FAILED; /* "*" is not a valid argument */ else @@ -2641,7 +2644,8 @@ static PurpleCmdRet zephyr_purple_cmd_zi(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = instance, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_gc(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,"message",args[0],"",args[1],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; else @@ -2652,7 +2656,8 @@ static PurpleCmdRet zephyr_purple_cmd_zci(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = class, instance, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_gc(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,args[0],args[1],"",args[2],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; else @@ -2663,7 +2668,8 @@ static PurpleCmdRet zephyr_purple_cmd_zcir(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = class, instance, recipient, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_gc(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,args[0],args[1],args[2],args[3],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; else @@ -2674,7 +2680,8 @@ static PurpleCmdRet zephyr_purple_cmd_zir(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = instance, recipient, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_gc(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,"message",args[0],args[1],args[2],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; else @@ -2685,7 +2692,8 @@ static PurpleCmdRet zephyr_purple_cmd_zc(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = class, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_gc(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,args[0],"PERSONAL","",args[1],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; else @@ -2766,7 +2774,7 @@ static int zephyr_resubscribe(PurpleConnection *gc) { /* Resubscribe to the in-memory list of subscriptions and also unsubscriptions*/ - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); GSList *s = zephyr->subscrips; zephyr_triple *zt; while (s) { @@ -2791,7 +2799,7 @@ static void zephyr_action_resubscribe(PurplePluginAction *action) static void zephyr_action_get_subs_from_server(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); gchar *title; int retval, nsubs, one,i; ZSubscription_t subs; -- cgit v1.2.1 From cbb4ea76c553d6517a3c87a34b4e075da6ae7f1d Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 29 Aug 2011 22:33:45 +0000 Subject: Convert simple prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/simple/simple.c | 40 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index 73b5120809..7759264c50 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -67,7 +67,7 @@ static const char *simple_list_icon(PurpleAccount *a, PurpleBuddy *b) { } static void simple_keep_alive(PurpleConnection *gc) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); if(sip->udp) { /* in case of UDP send a packet only with a 0 byte to remain in the NAT table */ gchar buf[2] = {0, 0}; @@ -100,14 +100,15 @@ static void do_notifies(struct simple_account_data *sip) { } static void simple_set_status(PurpleAccount *account, PurpleStatus *status) { + PurpleConnection *gc = purple_account_get_connection(account); PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_type(status)); struct simple_account_data *sip = NULL; if (!purple_status_is_active(status)) return; - if (account->gc) - sip = account->gc->proto_data; + if (gc) + sip = purple_connection_get_protocol_data(gc); if (sip) { @@ -194,7 +195,7 @@ static void connection_free_all(struct simple_account_data *sip) { static void simple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); struct simple_buddy *b; const char *name = purple_buddy_get_name(buddy); if(strncmp(name, "sip:", 4)) { @@ -231,7 +232,7 @@ static void simple_get_buddies(PurpleConnection *gc) { static void simple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { const char *name = purple_buddy_get_name(buddy); - struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); struct simple_buddy *b = g_hash_table_lookup(sip->buddies, name); g_hash_table_remove(sip->buddies, name); g_free(b->name); @@ -412,7 +413,7 @@ static void fill_auth(struct simple_account_data *sip, const gchar *hdr, struct static void simple_canwrite_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); gsize max_write; gssize written; @@ -457,7 +458,7 @@ static void send_later_cb(gpointer data, gint source, const gchar *error_message return; } - sip = gc->proto_data; + sip = purple_connection_get_protocol_data(gc); sip->fd = source; sip->connecting = FALSE; @@ -474,7 +475,7 @@ static void send_later_cb(gpointer data, gint source, const gchar *error_message static void sendlater(PurpleConnection *gc, const char *buf) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); if(!sip->connecting) { purple_debug_info("simple", "connecting to %s port %d\n", sip->realhostname ? sip->realhostname : "{NULL}", sip->realport); @@ -491,7 +492,7 @@ static void sendlater(PurpleConnection *gc, const char *buf) { } static void sendout_pkt(PurpleConnection *gc, const char *buf) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); time_t currtime = time(NULL); int writelen = strlen(buf); @@ -629,7 +630,7 @@ static struct transaction *transactions_find(struct simple_account_data *sip, st static void send_sip_request(PurpleConnection *gc, const gchar *method, const gchar *url, const gchar *to, const gchar *addheaders, const gchar *body, struct sip_dialog *dialog, TransCallback tc) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); char *callid = dialog ? g_strdup(dialog->callid) : gencallid(); char *auth = NULL; const char *addh = ""; @@ -1026,7 +1027,7 @@ static void simple_send_message(struct simple_account_data *sip, const char *to, } static int simple_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); char *to = g_strdup(who); char *text = purple_unescape_html(what); simple_send_message(sip, to, text, NULL); @@ -1285,7 +1286,7 @@ static void process_incoming_notify(struct simple_account_data *sip, struct sipm } static unsigned int simple_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); gchar *xml = "\n" "proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); struct sipmsg *msg; int len; time_t currtime = time(NULL); @@ -1681,7 +1682,7 @@ static void simple_udp_process(gpointer data, gint source, PurpleInputCondition static void simple_input_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); int len; struct sip_connection *conn = connection_find(sip, source); if(!conn) { @@ -1714,7 +1715,7 @@ static void simple_input_cb(gpointer data, gint source, PurpleInputCondition con /* Callback for new connections on incoming TCP port */ static void simple_newconn_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); struct sip_connection *conn; int newfd, flags; @@ -1745,7 +1746,7 @@ static void login_cb(gpointer data, gint source, const gchar *error_message) { return; } - sip = gc->proto_data; + sip = purple_connection_get_protocol_data(gc); sip->fd = source; conn = connection_create(sip, source); @@ -1930,7 +1931,8 @@ static void simple_login(PurpleAccount *account) return; } - gc->proto_data = sip = g_new0(struct simple_account_data, 1); + sip = g_new0(struct simple_account_data, 1); + purple_connection_set_protocol_data(gc, sip); sip->gc = gc; sip->fd = -1; sip->listenfd = -1; @@ -1974,7 +1976,7 @@ static void simple_login(PurpleAccount *account) static void simple_close(PurpleConnection *gc) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); if (!sip) return; @@ -2039,7 +2041,7 @@ static void simple_close(PurpleConnection *gc) g_free(sip->realhostname); g_free(sip); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } static PurplePluginProtocolInfo prpl_info = -- cgit v1.2.1 From 33281ddad99465d8dfde1a13ef373f605d02923f Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 29 Aug 2011 22:43:18 +0000 Subject: Convert novell prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/novell/novell.c | 76 +++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index 3037507ae2..c24c7f9167 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -1629,7 +1629,7 @@ _initiate_conference_cb(PurpleBlistNode *node, gpointer ignored) buddy = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -1685,7 +1685,7 @@ novell_ssl_connect_error(PurpleSslConnection * gsc, NMUser *user; gc = data; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); user->conn->ssl_conn->data = NULL; purple_connection_ssl_error (gc, error); @@ -1702,7 +1702,7 @@ novell_ssl_recv_cb(gpointer data, PurpleSslConnection * gsc, if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -1736,7 +1736,7 @@ novell_ssl_connected_cb(gpointer data, PurpleSslConnection * gsc, if (gc == NULL || gsc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if ((user == NULL) || (conn = user->conn) == NULL) return; @@ -2206,7 +2206,7 @@ novell_login(PurpleAccount * account) user = nm_initialize_user(name, server, port, account, _event_callback); if (user && user->conn) { /* save user */ - gc->proto_data = user; + purple_connection_set_protocol_data(gc, user); /* connect to the server */ purple_connection_update_progress(gc, _("Connecting"), @@ -2238,7 +2238,7 @@ novell_close(PurpleConnection * gc) if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { conn = user->conn; if (conn && conn->ssl_conn) { @@ -2246,7 +2246,7 @@ novell_close(PurpleConnection * gc) } nm_deinitialize_user(user); } - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } static int @@ -2266,7 +2266,7 @@ novell_send_im(PurpleConnection * gc, const char *name, message_body == NULL || *message_body == '\0') return 0; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return 0; @@ -2352,7 +2352,7 @@ novell_send_typing(PurpleConnection * gc, const char *name, PurpleTypingState st if (gc == NULL || name == NULL) return 0; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return 0; @@ -2386,7 +2386,7 @@ novell_convo_closed(PurpleConnection * gc, const char *who) if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, who))) { conf = nm_find_conversation(user, dn); if (conf) { @@ -2408,7 +2408,7 @@ novell_chat_leave(PurpleConnection * gc, int id) if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -2440,7 +2440,7 @@ novell_chat_invite(PurpleConnection *gc, int id, if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -2479,7 +2479,7 @@ novell_chat_send(PurpleConnection * gc, int id, const char *text, PurpleMessageF if (gc == NULL || text == NULL) return -1; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return -1; @@ -2619,7 +2619,7 @@ novell_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group if (gc == NULL || buddy == NULL || group == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)))) { gname = purple_group_get_name(group); if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { @@ -2651,7 +2651,7 @@ novell_remove_group(PurpleConnection * gc, PurpleGroup *group) if (gc == NULL || group == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { NMFolder *folder = nm_find_folder(user, purple_group_get_name(group)); @@ -2676,7 +2676,7 @@ novell_alias_buddy(PurpleConnection * gc, const char *name, const char *alias) if (gc == NULL || name == NULL || alias == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, name))) { /* Alias all of instances of the contact */ @@ -2735,7 +2735,7 @@ novell_group_buddy(PurpleConnection * gc, old_group_name == NULL || new_group_name == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, name))) { /* Find the old folder */ @@ -2793,7 +2793,7 @@ novell_rename_group(PurpleConnection * gc, const char *old_name, return; } - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { const char *gname = purple_group_get_name(group); /* Does new folder exist already? */ @@ -2839,7 +2839,7 @@ novell_tooltip_text(PurpleBuddy * buddy, PurpleNotifyUserInfo * user_info, gbool return; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - if (gc == NULL || (user = gc->proto_data) == NULL) + if (gc == NULL || (user = purple_connection_get_protocol_data(gc)) == NULL) return; if (PURPLE_BUDDY_IS_ONLINE(buddy)) { @@ -2891,7 +2891,7 @@ novell_set_idle(PurpleConnection * gc, int time) if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -2920,7 +2920,7 @@ novell_get_info(PurpleConnection * gc, const char *name) if (gc == NULL || name == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { user_record = nm_find_user_record(user, name); @@ -2949,17 +2949,19 @@ novell_status_text(PurpleBuddy * buddy) if (buddy && account) { PurpleConnection *gc = purple_account_get_connection(account); - if (gc && gc->proto_data) { - NMUser *user = gc->proto_data; + if (gc) { + NMUser *user = purple_connection_get_protocol_data(gc); - dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); - if (dn) { - NMUserRecord *user_record = nm_find_user_record(user, dn); + if (user) { + dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); + if (dn) { + NMUserRecord *user_record = nm_find_user_record(user, dn); - if (user_record) { - text = nm_user_record_get_status_text(user_record); - if (text) - return g_strdup(text); + if (user_record) { + text = nm_user_record_get_status_text(user_record); + if (text) + return g_strdup(text); + } } } } @@ -3035,7 +3037,7 @@ novell_set_status(PurpleAccount *account, PurpleStatus *status) return; gc = purple_account_get_connection(account); - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3082,7 +3084,7 @@ novell_add_permit(PurpleConnection *gc, const char *who) if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3126,7 +3128,7 @@ novell_add_deny(PurpleConnection *gc, const char *who) if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3170,7 +3172,7 @@ novell_rem_permit(PurpleConnection *gc, const char *who) if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3200,7 +3202,7 @@ novell_rem_deny(PurpleConnection *gc, const char *who) if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3235,7 +3237,7 @@ novell_set_permit_deny(PurpleConnection *gc) if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3463,7 +3465,7 @@ novell_keepalive(PurpleConnection *gc) if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; -- cgit v1.2.1 From f74f496d15dcb09555874f0466aefcb00f42a1e5 Mon Sep 17 00:00:00 2001 From: Daniel Atallah Date: Mon, 29 Aug 2011 22:55:51 +0000 Subject: Steps toward hiding PurpleXfer. To convert prpls as they are now, lot of new accessors are needed (for stuff that maybe shouldn't be exposed directly). To convert prpls so that they don't keep re-implementing the same type of stuff, a lot of error-prone changes are needed. --- libpurple/protocols/bonjour/bonjour_ft.c | 45 +++++------ libpurple/protocols/irc/dcc_send.c | 23 +++--- libpurple/protocols/jabber/oob.c | 6 +- libpurple/protocols/jabber/si.c | 81 +++++++------------ libpurple/protocols/oscar/oft.c | 14 ++-- libpurple/protocols/sametime/sametime.c | 14 ++-- libpurple/protocols/silc/ft.c | 3 +- libpurple/protocols/yahoo/yahoo_filexfer.c | 125 ++++++++++++++--------------- 8 files changed, 138 insertions(+), 173 deletions(-) diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index dd267f14ba..6aa05bc941 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -95,7 +95,7 @@ static void bonjour_xfer_request_denied(PurpleXfer *xfer) purple_debug_info("bonjour", "Bonjour-xfer-request-denied.\n"); if(xf) - xep_ft_si_reject(xf->data, xf->sid, xfer->who, "403", "cancel"); + xep_ft_si_reject(xf->data, xf->sid, purple_xfer_get_remote_user(xfer), "403", "cancel"); bonjour_free_xfer(xfer); } @@ -165,8 +165,8 @@ bonjour_si_xfer_find(BonjourData *bd, const char *sid, const char *from) xf = purple_xfer_get_protocol_data(xfer); if(xf == NULL) break; - if(xf->sid && xfer->who && !strcmp(xf->sid, sid) && - !strcmp(xfer->who, from)) + if(xf->sid && purple_xfer_get_remote_user(xfer) && !strcmp(xf->sid, sid) && + !strcmp(purple_xfer_get_remote_user(xfer), from)) return xfer; } @@ -210,8 +210,8 @@ xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) file = xmlnode_new_child(si_node, "file"); xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); - xmlnode_set_attrib(file, "name", xfer->filename); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); + xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); + g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); xmlnode_set_attrib(file, "size", buf); feature = xmlnode_new_child(si_node, "feature"); @@ -240,7 +240,7 @@ xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) } static void -xep_ft_si_result(PurpleXfer *xfer, char *to) +xep_ft_si_result(PurpleXfer *xfer, const char *to) { xmlnode *si_node, *feature, *field, *value, *x; XepIq *iq; @@ -290,14 +290,14 @@ bonjour_free_xfer(PurpleXfer *xfer) return; } - purple_debug_info("bonjour", "bonjour-free-xfer-%p.\n", xfer); + purple_debug_misc("bonjour", "bonjour-free-xfer-%p.\n", xfer); xf = purple_xfer_get_protocol_data(xfer); if(xf != NULL) { BonjourData *bd = (BonjourData*)xf->data; if(bd != NULL) { bd->xfer_lists = g_slist_remove(bd->xfer_lists, xfer); - purple_debug_info("bonjour", "B free xfer from lists(%p).\n", bd->xfer_lists); + purple_debug_misc("bonjour", "B free xfer from lists(%p).\n", bd->xfer_lists); } if (xf->proxy_connection != NULL) purple_proxy_connect_cancel(xf->proxy_connection); @@ -314,7 +314,7 @@ bonjour_free_xfer(PurpleXfer *xfer) purple_xfer_set_protocol_data(xfer, NULL); } - purple_debug_info("bonjour", "Need close socket=%d.\n", xfer->fd); + purple_debug_misc("bonjour", "Need close socket.\n"); } PurpleXfer * @@ -386,7 +386,7 @@ bonjour_xfer_init(PurpleXfer *xfer) purple_debug_info("bonjour", "Bonjour-xfer-init.\n"); - buddy = purple_find_buddy(xfer->account, xfer->who); + buddy = purple_find_buddy(purple_xfer_get_account(xfer), purple_xfer_get_remote_user(xfer)); /* this buddy is offline. */ if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL) return; @@ -397,10 +397,10 @@ bonjour_xfer_init(PurpleXfer *xfer) if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { /* initiate file transfer, send SI offer. */ purple_debug_info("bonjour", "Bonjour xfer type is PURPLE_XFER_SEND.\n"); - xep_ft_si_offer(xfer, xfer->who); + xep_ft_si_offer(xfer, purple_xfer_get_remote_user(xfer)); } else { /* accept file transfer request, send SI result. */ - xep_ft_si_result(xfer, xfer->who); + xep_ft_si_result(xfer, purple_xfer_get_remote_user(xfer)); purple_debug_info("bonjour", "Bonjour xfer type is PURPLE_XFER_RECEIVE.\n"); } } @@ -565,7 +565,7 @@ xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) purple_debug_error("bonjour", "Didn't find an acceptable streamhost.\n"); if (iq_id && xfer != NULL) - xep_ft_si_reject(bd, iq_id, xfer->who, "404", "cancel"); + xep_ft_si_reject(bd, iq_id, purple_xfer_get_remote_user(xfer), "404", "cancel"); } } else { @@ -634,8 +634,6 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) /* This should cancel the ft */ purple_debug_error("bonjour", "Error accepting incoming SOCKS5 connection. (%d)\n", errno); - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; @@ -664,9 +662,6 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) if(len < 0 && errno == EAGAIN) return; else if(len <= 0){ - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); purple_xfer_cancel_remote(xfer); return; } else { @@ -685,8 +680,6 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) if (len < 0 && errno == EAGAIN) return; else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; @@ -723,8 +716,6 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) if (len < 0 && errno == EAGAIN) { return; } else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; @@ -766,7 +757,7 @@ bonjour_bytestreams_listen(int sock, gpointer data) bd = xf->data; - iq = xep_iq_new(bd, XEP_IQ_SET, xfer->who, bonjour_get_jid(bd->jabber_data->account), xf->sid); + iq = xep_iq_new(bd, XEP_IQ_SET, purple_xfer_get_remote_user(xfer), bonjour_get_jid(bd->jabber_data->account), xf->sid); query = xmlnode_new_child(iq->node, "query"); xmlnode_set_namespace(query, "http://jabber.org/protocol/bytestreams"); @@ -777,7 +768,7 @@ bonjour_bytestreams_listen(int sock, gpointer data) local_ips = bonjour_jabber_get_local_ips(sock); - port = g_strdup_printf("%hu", xfer->local_port); + port = g_strdup_printf("%hu", purple_xfer_get_local_port(xfer)); while(local_ips) { streamhost = xmlnode_new_child(query, "streamhost"); xmlnode_set_attrib(streamhost, "jid", xf->sid); @@ -825,7 +816,7 @@ bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_me if(source < 0) { purple_debug_error("bonjour", "Error connecting via SOCKS5 - %s\n", error_message ? error_message : "(null)"); - xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel"); + xep_ft_si_reject(xf->data, xf->iq_id, purple_xfer_get_remote_user(xfer), "404", "cancel"); /* Cancel the connection */ purple_xfer_cancel_local(xfer); return; @@ -838,7 +829,7 @@ bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_me /* Here, start the file transfer.*/ /* Notify Initiator of Connection */ - iq = xep_iq_new(bd, XEP_IQ_RESULT, xfer->who, bonjour_get_jid(bd->jabber_data->account), xf->iq_id); + iq = xep_iq_new(bd, XEP_IQ_RESULT, purple_xfer_get_remote_user(xfer), bonjour_get_jid(bd->jabber_data->account), xf->iq_id); q_node = xmlnode_new_child(iq->node, "query"); xmlnode_set_namespace(q_node, "http://jabber.org/protocol/bytestreams"); tmp_node = xmlnode_new_child(q_node, "streamhost-used"); @@ -893,7 +884,7 @@ bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb) bonjour_bytestreams_connect_cb, xfer); if(xf->proxy_connection == NULL) { - xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel"); + xep_ft_si_reject(xf->data, xf->iq_id, purple_xfer_get_remote_user(xfer), "404", "cancel"); /* Cancel the connection */ purple_xfer_cancel_local(xfer); } diff --git a/libpurple/protocols/irc/dcc_send.c b/libpurple/protocols/irc/dcc_send.c index 59fd7883eb..c392afcbad 100644 --- a/libpurple/protocols/irc/dcc_send.c +++ b/libpurple/protocols/irc/dcc_send.c @@ -34,6 +34,7 @@ struct irc_xfer_rx_data { gchar *ip; + unsigned int remote_port; }; static void irc_dccsend_recv_destroy(PurpleXfer *xfer) @@ -51,10 +52,10 @@ static void irc_dccsend_recv_destroy(PurpleXfer *xfer) */ static void irc_dccsend_recv_ack(PurpleXfer *xfer, const guchar *data, size_t size) { guint32 l; - size_t result; + gssize result; - l = htonl(xfer->bytes_sent); - result = write(xfer->fd, &l, sizeof(l)); + l = htonl(purple_xfer_get_bytes_sent(xfer)); + result = purple_xfer_write(xfer, (guchar *)&l, sizeof(l)); if (result != sizeof(l)) { purple_debug_error("irc", "unable to send acknowledgement: %s\n", g_strerror(errno)); /* TODO: We should probably close the connection here or something. */ @@ -64,7 +65,7 @@ static void irc_dccsend_recv_ack(PurpleXfer *xfer, const guchar *data, size_t si static void irc_dccsend_recv_init(PurpleXfer *xfer) { struct irc_xfer_rx_data *xd = purple_xfer_get_protocol_data(xfer); - purple_xfer_start(xfer, -1, xd->ip, xfer->remote_port); + purple_xfer_start(xfer, -1, xd->ip, xd->remote_port); g_free(xd->ip); xd->ip = NULL; } @@ -117,7 +118,7 @@ void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg) { purple_xfer_set_protocol_data(xfer, xd); purple_xfer_set_filename(xfer, filename->str); - xfer->remote_port = atoi(token[i+1]); + xd->remote_port = atoi(token[i+1]); nip = strtoul(token[i], NULL, 10); if (nip) { @@ -228,13 +229,13 @@ static void irc_dccsend_send_read(gpointer data, int source, PurpleInputConditio static gssize irc_dccsend_send_write(const guchar *buffer, size_t size, PurpleXfer *xfer) { gssize s; - int ret; + gssize ret; s = MIN(purple_xfer_get_bytes_remaining(xfer), size); if (!s) return 0; - ret = write(xfer->fd, buffer, s); + ret = purple_xfer_write(xfer, buffer, s); if (ret < 0 && errno == EAGAIN) ret = 0; @@ -316,11 +317,11 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) irc_dccsend_send_connected, xfer); /* Send the intended recipient the DCC request */ - arg[0] = xfer->who; + arg[0] = purple_xfer_get_remote_user(xfer); inet_aton(purple_network_get_my_ip(irc->fd), &addr); arg[1] = tmp = g_strdup_printf("\001DCC SEND \"%s\" %u %hu %" G_GSIZE_FORMAT "\001", - xfer->filename, ntohl(addr.s_addr), - port, xfer->size); + purple_xfer_get_filename(xfer), ntohl(addr.s_addr), + port, purple_xfer_get_size(xfer)); irc_cmd_privmsg(gc->proto_data, "msg", NULL, arg); g_free(tmp); @@ -333,7 +334,7 @@ static void irc_dccsend_send_init(PurpleXfer *xfer) { PurpleConnection *gc = purple_account_get_connection(purple_xfer_get_account(xfer)); struct irc_xfer_send_data *xd = purple_xfer_get_protocol_data(xfer); - xfer->filename = g_path_get_basename(xfer->local_filename); + purple_xfer_set_filename(xfer, g_path_get_basename(purple_xfer_get_local_filename(xfer))); purple_xfer_ref(xfer); diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c index 23a65d69fe..090793bf4d 100644 --- a/libpurple/protocols/jabber/oob.c +++ b/libpurple/protocols/jabber/oob.c @@ -76,7 +76,7 @@ static void jabber_oob_xfer_end(PurpleXfer *xfer) JabberIq *iq; iq = jabber_iq_new(jox->js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jox->iq_id); jabber_iq_send(iq); @@ -89,7 +89,7 @@ static void jabber_oob_xfer_request_send(gpointer data, gint source, PurpleInput JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); int len, total_len = strlen(jox->write_buffer); - len = write(xfer->fd, jox->write_buffer + jox->written_len, + len = purple_xfer_write(xfer, (guchar*) jox->write_buffer + jox->written_len, total_len - jox->written_len); if(len < 0 && errno == EAGAIN) @@ -163,7 +163,7 @@ static void jabber_oob_xfer_recv_error(PurpleXfer *xfer, const char *code) { xmlnode *y, *z; iq = jabber_iq_new(jox->js, JABBER_IQ_ERROR); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jox->iq_id); y = xmlnode_new_child(iq->node, "error"); xmlnode_set_attrib(y, "code", code); diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index caed4caa0f..2aad17a773 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -88,8 +88,8 @@ jabber_si_xfer_find(JabberStream *js, const char *sid, const char *from) for(xfers = js->file_transfers; xfers; xfers = xfers->next) { PurpleXfer *xfer = xfers->data; JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); - if(jsx->stream_id && xfer->who && - !strcmp(jsx->stream_id, sid) && !strcmp(xfer->who, from)) + if(jsx->stream_id && purple_xfer_get_remote_user(xfer) && + !strcmp(jsx->stream_id, sid) && !strcmp(purple_xfer_get_remote_user(xfer), from)) return xfer; } @@ -143,7 +143,7 @@ jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_ } /* unknown file transfer type is assumed to be RECEIVE */ - if(xfer->type == PURPLE_XFER_SEND) + if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { xmlnode *activate; iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS); @@ -151,14 +151,14 @@ jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_ query = xmlnode_get_child(iq->node, "query"); xmlnode_set_attrib(query, "sid", jsx->stream_id); activate = xmlnode_new_child(query, "activate"); - xmlnode_insert_data(activate, xfer->who, -1); + xmlnode_insert_data(activate, purple_xfer_get_remote_user(xfer), -1); /* TODO: We need to wait for an activation result before starting */ } else { iq = jabber_iq_new_query(jsx->js, JABBER_IQ_RESULT, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jsx->iq_id); query = xmlnode_get_child(iq->node, "query"); su = xmlnode_new_child(query, "streamhost-used"); @@ -229,7 +229,7 @@ static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) if(jsx->iq_id) jabber_iq_set_id(iq, jsx->iq_id); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); error = xmlnode_new_child(iq->node, "error"); xmlnode_set_attrib(error, "code", "404"); xmlnode_set_attrib(error, "type", "cancel"); @@ -271,7 +271,7 @@ static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) purple_proxy_info_destroy(jsx->gpi); jsx->gpi = NULL; - dstjid = jabber_id_new(xfer->who); + dstjid = jabber_id_new(purple_xfer_get_remote_user(xfer)); /* TODO: Deal with zeroconf */ @@ -284,7 +284,7 @@ static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) purple_proxy_info_set_port(jsx->gpi, streamhost->port); /* unknown file transfer type is assumed to be RECEIVE */ - if(xfer->type == PURPLE_XFER_SEND) + if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", jsx->stream_id, jsx->js->user->node, jsx->js->user->domain, jsx->js->user->resource, dstjid->node, dstjid->domain, dstjid->resource); else @@ -302,7 +302,7 @@ static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) g_free(dstaddr); /* When selecting a streamhost, timeout after STREAMHOST_CONNECT_TIMEOUT seconds, otherwise it takes forever */ - if (xfer->type != PURPLE_XFER_SEND && jsx->connect_data != NULL) + if (purple_xfer_get_type(xfer) != PURPLE_XFER_SEND && jsx->connect_data != NULL) jsx->connect_timeout = purple_timeout_add_seconds( STREAMHOST_CONNECT_TIMEOUT, connect_timeout_cb, xfer); @@ -382,8 +382,6 @@ jabber_si_xfer_bytestreams_send_read_again_resp_cb(gpointer data, gint source, if (len < 0 && errno == EAGAIN) return; else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; g_free(jsx->rxqueue); jsx->rxqueue = NULL; close(source); @@ -426,8 +424,6 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, if(len < 0 && errno == EAGAIN) return; else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; @@ -441,8 +437,6 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, purple_debug_info("jabber", "Invalid socks5 conn req. header[0x%x,0x%x,0x%x,0x%x,0x%x]\n", jsx->rxqueue[0], jsx->rxqueue[1], jsx->rxqueue[2], jsx->rxqueue[3], jsx->rxqueue[4]); - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; @@ -455,8 +449,6 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, if(len < 0 && errno == EAGAIN) return; else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; @@ -475,7 +467,7 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, dstaddr = g_strdup_printf("%s%s@%s/%s%s", jsx->stream_id, jsx->js->user->node, jsx->js->user->domain, - jsx->js->user->resource, xfer->who); + jsx->js->user->resource, purple_xfer_get_remote_user(xfer)); /* Per XEP-0065, the 'host' must be SHA1(SID + from JID + to JID) */ hash = jabber_calculate_data_hash(dstaddr, strlen(dstaddr), "sha1"); @@ -534,8 +526,6 @@ jabber_si_xfer_bytestreams_send_read_response_cb(gpointer data, gint source, if (len < 0 && errno == EAGAIN) return; else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; g_free(jsx->rxqueue); jsx->rxqueue = NULL; close(source); @@ -547,11 +537,9 @@ jabber_si_xfer_bytestreams_send_read_response_cb(gpointer data, gint source, if (jsx->rxlen < jsx->rxmaxlen) return; - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - /* If we sent a "Success", wait for a response, otherwise give up and cancel */ if (jsx->rxqueue[1] == 0x00) { + purple_input_remove(xfer->watcher); xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, jabber_si_xfer_bytestreams_send_read_again_cb, xfer); g_free(jsx->rxqueue); @@ -584,9 +572,6 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, if(len < 0 && errno == EAGAIN) return; else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); purple_xfer_cancel_remote(xfer); return; } @@ -603,9 +588,6 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, if(len < 0 && errno == EAGAIN) return; else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); purple_xfer_cancel_remote(xfer); return; } @@ -618,13 +600,9 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, if(jsx->rxlen -2 < jsx->rxqueue[1]) return; - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - purple_debug_info("jabber", "checking to make sure we're socks FIVE\n"); if(jsx->rxqueue[0] != 0x05) { - close(source); purple_xfer_cancel_remote(xfer); return; } @@ -641,6 +619,7 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, jsx->rxqueue = g_malloc(jsx->rxmaxlen); jsx->rxqueue[0] = 0x05; jsx->rxqueue[1] = 0x00; + purple_input_remove(xfer->watcher); xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, jabber_si_xfer_bytestreams_send_read_response_cb, xfer); @@ -658,6 +637,7 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, jsx->rxqueue = g_malloc(jsx->rxmaxlen); jsx->rxqueue[0] = 0x05; jsx->rxqueue[1] = 0xFF; + purple_input_remove(xfer->watcher); xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, jabber_si_xfer_bytestreams_send_read_response_cb, xfer); jabber_si_xfer_bytestreams_send_read_response_cb(xfer, @@ -848,7 +828,7 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) purple_xfer_unref(xfer); iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); query = xmlnode_get_child(iq->node, "query"); xmlnode_set_attrib(query, "sid", jsx->stream_id); @@ -866,7 +846,7 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) jid = g_strdup_printf("%s@%s/%s", jsx->js->user->node, jsx->js->user->domain, jsx->js->user->resource); xfer->local_port = purple_network_get_port_from_fd(sock); - g_snprintf(port, sizeof(port), "%hu", xfer->local_port); + g_snprintf(port, sizeof(port), "%hu", purple_xfer_get_local_port(xfer)); public_ip = purple_network_get_my_ip(jsx->js->fd); @@ -1247,10 +1227,10 @@ static void jabber_si_xfer_send_request(PurpleXfer *xfer) purple_xfer_prepare_thumbnail(xfer, "jpeg,png"); #endif - xfer->filename = g_path_get_basename(xfer->local_filename); + purple_xfer_set_filename(xfer, g_path_get_basename(purple_xfer_get_local_filename(xfer))); iq = jabber_iq_new(jsx->js, JABBER_IQ_SET); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); si = xmlnode_new_child(iq->node, "si"); xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); jsx->stream_id = jabber_get_next_id(jsx->js); @@ -1259,8 +1239,8 @@ static void jabber_si_xfer_send_request(PurpleXfer *xfer) file = xmlnode_new_child(si, "file"); xmlnode_set_namespace(file, NS_SI_FILE_TRANSFER); - xmlnode_set_attrib(file, "name", xfer->filename); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); + xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); + g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); xmlnode_set_attrib(file, "size", buf); /* maybe later we'll do hash and date attribs */ @@ -1324,8 +1304,7 @@ static void jabber_si_xfer_free(PurpleXfer *xfer) jabber_iq_remove_callback_by_id(js, jsx->iq_id); if (jsx->local_streamhost_fd >= 0) close(jsx->local_streamhost_fd); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && - xfer->fd >= 0) { + if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xfer->fd >= 0) { purple_debug_info("jabber", "remove port mapping\n"); purple_network_remove_port_mapping(xfer->fd); } @@ -1391,7 +1370,7 @@ static void jabber_si_xfer_request_denied(PurpleXfer *xfer) JabberIq *iq; xmlnode *error, *child; iq = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jsx->iq_id); error = xmlnode_new_child(iq->node, "error"); @@ -1459,7 +1438,7 @@ static void resource_select_cancel_cb(PurpleXfer *xfer, PurpleRequestFields *fie static void do_transfer_send(PurpleXfer *xfer, const char *resource) { JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); - char **who_v = g_strsplit(xfer->who, "/", 2); + char **who_v = g_strsplit(purple_xfer_get_remote_user(xfer), "/", 2); char *who; JabberBuddy *jb; JabberBuddyResource *jbr = NULL; @@ -1516,7 +1495,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) char *resource; GList *resources = NULL; - if(NULL != (resource = jabber_get_resource(xfer->who))) { + if(NULL != (resource = jabber_get_resource(purple_xfer_get_remote_user(xfer)))) { /* they've specified a resource, no need to ask or * default or anything, just do it */ @@ -1525,7 +1504,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) return; } - jb = jabber_buddy_find(jsx->js, xfer->who, TRUE); + jb = jabber_buddy_find(jsx->js, purple_xfer_get_remote_user(xfer), TRUE); if (jb) { GList *l; @@ -1549,11 +1528,11 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) char *msg; if(!jb) { - msg = g_strdup_printf(_("Unable to send file to %s, invalid JID"), xfer->who); + msg = g_strdup_printf(_("Unable to send file to %s, invalid JID"), purple_xfer_get_remote_user(xfer)); } else if(jb->subscription & JABBER_SUB_TO) { - msg = g_strdup_printf(_("Unable to send file to %s, user is not online"), xfer->who); + msg = g_strdup_printf(_("Unable to send file to %s, user is not online"), purple_xfer_get_remote_user(xfer)); } else { - msg = g_strdup_printf(_("Unable to send file to %s, not subscribed to user presence"), xfer->who); + msg = g_strdup_printf(_("Unable to send file to %s, not subscribed to user presence"), purple_xfer_get_remote_user(xfer)); } purple_notify_error(jsx->js->gc, _("File Send Failed"), _("File Send Failed"), msg); @@ -1566,7 +1545,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) } else { /* we've got multiple resources, we need to pick one to send to */ GList *l; - char *msg = g_strdup_printf(_("Please select the resource of %s to which you would like to send a file"), xfer->who); + char *msg = g_strdup_printf(_("Please select the resource of %s to which you would like to send a file"), purple_xfer_get_remote_user(xfer)); PurpleRequestFields *fields = purple_request_fields_new(); PurpleRequestField *field = purple_request_field_choice_new("resource", _("Resource"), 0); PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); @@ -1582,7 +1561,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) purple_request_fields(jsx->js->gc, _("Select a Resource"), msg, NULL, fields, _("Send File"), G_CALLBACK(resource_select_ok_cb), _("Cancel"), G_CALLBACK(resource_select_cancel_cb), - jsx->js->gc->account, xfer->who, NULL, xfer); + jsx->js->gc->account, purple_xfer_get_remote_user(xfer), NULL, xfer); g_free(msg); } @@ -1592,7 +1571,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) xmlnode *si, *feature, *x, *field, *value; iq = jabber_iq_new(jsx->js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); if(jsx->iq_id) jabber_iq_set_id(iq, jsx->iq_id); else diff --git a/libpurple/protocols/oscar/oft.c b/libpurple/protocols/oscar/oft.c index 795029e0fe..632f3c8ecf 100644 --- a/libpurple/protocols/oscar/oft.c +++ b/libpurple/protocols/oscar/oft.c @@ -362,10 +362,10 @@ start_transfer_when_done_sending_data(gpointer data) if (purple_circ_buffer_get_max_read(conn->buffer_outgoing) == 0) { + int fd = conn->fd; conn->sending_data_timer = 0; - conn->xfer->fd = conn->fd; conn->fd = -1; - purple_xfer_start(conn->xfer, conn->xfer->fd, NULL, 0); + purple_xfer_start(conn->xfer, fd, NULL, 0); return FALSE; } @@ -665,9 +665,9 @@ peer_oft_sendcb_init(PurpleXfer *xfer) size2 = purple_str_size_to_units(G_MAXUINT32); tmp = g_strdup_printf(_("File %s is %s, which is larger than " "the maximum size of %s."), - xfer->local_filename, size1, size2); + purple_xfer_get_local_filename(xfer), size1, size2); purple_xfer_error(purple_xfer_get_type(xfer), - purple_xfer_get_account(xfer), xfer->who, tmp); + purple_xfer_get_account(xfer), purple_xfer_get_remote_user(xfer), tmp); g_free(size1); g_free(size2); g_free(tmp); @@ -689,9 +689,9 @@ peer_oft_sendcb_init(PurpleXfer *xfer) strncpy((gchar *)conn->xferdata.idstring, "Cool FileXfer", 31); conn->xferdata.modtime = 0; conn->xferdata.cretime = 0; - xfer->filename = g_path_get_basename(xfer->local_filename); - conn->xferdata.name_length = MAX(64, strlen(xfer->filename) + 1); - conn->xferdata.name = (guchar *)g_strndup(xfer->filename, conn->xferdata.name_length - 1); + purple_xfer_set_filename(xfer, g_path_get_basename(purple_xfer_get_local_filename(xfer))); + conn->xferdata.name_length = MAX(64, strlen(purple_xfer_get_filename(xfer)) + 1); + conn->xferdata.name = (guchar *)g_strndup(purple_xfer_get_filename(xfer), conn->xferdata.name_length - 1); peer_oft_checksum_file(conn, xfer, peer_oft_checksum_calculated_cb, G_MAXUINT32); diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index b45e43044c..77444ccb27 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -2157,7 +2157,7 @@ static void ft_incoming_init(PurpleXfer *xfer) { ft = purple_xfer_get_protocol_data(xfer); - fp = g_fopen(xfer->local_filename, "wb"); + fp = g_fopen(purple_xfer_get_local_filename(xfer), "wb"); if(! fp) { mwFileTransfer_cancel(ft); return; @@ -2231,8 +2231,7 @@ static void ft_send(struct mwFileTransfer *ft, FILE *fp) { if(fread(buf, (size_t) o.len, 1, fp)) { /* calculate progress and display it */ - xfer->bytes_sent += o.len; - xfer->bytes_remaining -= o.len; + purple_xfer_set_bytes_sent(xfer, purple_xfer_get_bytes_sent(xfer) + o.len); purple_xfer_update_progress(xfer); mwFileTransfer_send(ft, &o); @@ -2264,7 +2263,7 @@ static void mw_ft_opened(struct mwFileTransfer *ft) { } if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - xfer->dest_fp = g_fopen(xfer->local_filename, "rb"); + xfer->dest_fp = g_fopen(purple_xfer_get_local_filename(xfer), "rb"); ft_send(ft, xfer->dest_fp); } } @@ -2334,8 +2333,7 @@ static void mw_ft_recv(struct mwFileTransfer *ft, } /* update the progress */ - xfer->bytes_sent += data->len; - xfer->bytes_remaining -= data->len; + purple_xfer_set_bytes_sent(xfer, purple_xfer_get_bytes_sent(xfer) + data->len); purple_xfer_update_progress(xfer); /* let the other side know we got it, and to send some more */ @@ -5082,7 +5080,7 @@ static void ft_outgoing_init(PurpleXfer *xfer) { filename = purple_xfer_get_local_filename(xfer); filesize = purple_xfer_get_size(xfer); - idb.user = xfer->who; + idb.user = purple_xfer_get_remote_user(xfer); purple_xfer_update_progress(xfer); @@ -5091,7 +5089,7 @@ static void ft_outgoing_init(PurpleXfer *xfer) { if(! fp) { char *msg = g_strdup_printf(_("Error reading file %s: \n%s\n"), filename, g_strerror(errno)); - purple_xfer_error(purple_xfer_get_type(xfer), acct, xfer->who, msg); + purple_xfer_error(purple_xfer_get_type(xfer), acct, purple_xfer_get_remote_user(xfer), msg); g_free(msg); return; } diff --git a/libpurple/protocols/silc/ft.c b/libpurple/protocols/silc/ft.c index a8ce2da4b3..09992ef124 100644 --- a/libpurple/protocols/silc/ft.c +++ b/libpurple/protocols/silc/ft.c @@ -132,8 +132,7 @@ silcpurple_ftp_monitor(SilcClient client, if (!offset && filesize) purple_xfer_set_size(xfer->xfer, filesize); if (offset && filesize) { - xfer->xfer->bytes_sent = offset; - xfer->xfer->bytes_remaining = filesize - offset; + purple_xfer_set_bytes_sent(xfer->xfer, offset); } purple_xfer_update_progress(xfer->xfer); diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index dfb9d89819..061e9b3bb7 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -43,7 +43,7 @@ struct yahoo_xfer_data { PurpleConnection *gc; long expires; gboolean started; - gchar *txbuf; + guchar *txbuf; gsize txbuflen; gsize txbuf_written; guint tx_handler; @@ -120,13 +120,13 @@ static void yahoo_receivefile_send_cb(gpointer data, gint source, PurpleInputCon { PurpleXfer *xfer; struct yahoo_xfer_data *xd; - int remaining, written; + gssize remaining, written; xfer = data; xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; - written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); + written = purple_xfer_write(xfer, xd->txbuf + xd->txbuf_written, remaining); if (written < 0 && errno == EAGAIN) written = 0; @@ -164,7 +164,7 @@ static void yahoo_receivefile_connected(gpointer data, gint source, const gchar return; if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); + purple_xfer_get_remote_user(xfer), _("Unable to connect.")); purple_xfer_cancel_remote(xfer); return; } @@ -173,9 +173,10 @@ static void yahoo_receivefile_connected(gpointer data, gint source, const gchar /* The first time we get here, assemble the tx buffer */ if (xd->txbuflen == 0) { - xd->txbuf = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n", + gchar *header = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n", xd->path, xd->host); - xd->txbuflen = strlen(xd->txbuf); + xd->txbuf = (guchar*) header; + xd->txbuflen = strlen(header); xd->txbuf_written = 0; } @@ -191,13 +192,13 @@ static void yahoo_sendfile_send_cb(gpointer data, gint source, PurpleInputCondit { PurpleXfer *xfer; struct yahoo_xfer_data *xd; - int written, remaining; + gssize written, remaining; xfer = data; xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; - written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); + written = purple_xfer_write(xfer, xd->txbuf + xd->txbuf_written, remaining); if (written < 0 && errno == EAGAIN) written = 0; @@ -244,7 +245,7 @@ static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *er if (source < 0) { purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); + purple_xfer_get_remote_user(xfer), _("Unable to connect.")); purple_xfer_cancel_remote(xfer); return; } @@ -264,7 +265,7 @@ static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *er encoded_filename = yahoo_string_encode(gc, filename, NULL); yahoo_packet_hash(pkt, "sssss", 0, purple_connection_get_display_name(gc), - 5, xfer->who, 14, "", 27, encoded_filename, 28, size); + 5, purple_xfer_get_remote_user(xfer), 14, "", 27, encoded_filename, 28, size); g_free(size); g_free(encoded_filename); g_free(filename); @@ -370,14 +371,14 @@ static void yahoo_xfer_init_15(PurpleXfer *xfer) yd->session_id); yahoo_packet_hash(pkt, "sssiiiisiii", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 222, 1, 266, 1, 302, 268, 300, 268, 27, filename, - 28, xfer->size, + 28, purple_xfer_get_size(xfer), 301, 268, 303, 268); g_free(filename); @@ -388,7 +389,7 @@ static void yahoo_xfer_init_15(PurpleXfer *xfer) yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 222, 3); } else { @@ -397,7 +398,7 @@ static void yahoo_xfer_init_15(PurpleXfer *xfer) yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 271, 1); } @@ -535,7 +536,7 @@ static void yahoo_xfer_cancel_send(PurpleXfer *xfer) yd->session_id); yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 66, -1); } @@ -546,7 +547,7 @@ static void yahoo_xfer_cancel_send(PurpleXfer *xfer) yd->session_id); yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 222, 2); } @@ -583,7 +584,7 @@ static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) yd->session_id); yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 222, 4); } @@ -594,7 +595,7 @@ static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) yd->session_id); yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 66, -1); } @@ -612,7 +613,7 @@ static void yahoo_p2p_ft_server_send_OK(PurpleXfer *xfer) char *tx = NULL; int written; - tx = g_strdup_printf("HTTP/1.1 200 OK\r\nContent-Length: 0\r\nContent-Type: application/octet-stream\r\nConnection: close\r\n\r\n"); + tx = "HTTP/1.1 200 OK\r\nContent-Length: 0\r\nContent-Type: application/octet-stream\r\nConnection: close\r\n\r\n"; written = write(xfer->fd, tx, strlen(tx)); if (written < 0 && errno == EAGAIN) @@ -623,7 +624,6 @@ static void yahoo_p2p_ft_server_send_OK(PurpleXfer *xfer) /* close connection */ close(xfer->fd); xfer->fd = -1; - g_free(tx); } static void yahoo_xfer_end(PurpleXfer *xfer_old) @@ -692,7 +692,7 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) purple_xfer_set_protocol_data(xfer_old, NULL); /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, xfer_old->who); + xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, purple_xfer_get_remote_user(xfer_old)); if (xfer) { @@ -1056,7 +1056,7 @@ static void yahoo_xfer_dns_connected_15(GSList *hosts, gpointer data, const char yahoo_packet_hash(pkt, "ssssis", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xd->xfer_peer_idstring, 27, filename, 249, 3, @@ -1107,8 +1107,7 @@ static void yahoo_xfer_recv_cb_15(gpointer data, gint source, PurpleInputConditi PurpleXfer *xfer; struct yahoo_xfer_data *xd; int did; - gchar* buf; - gchar* t; + guchar buf[1000]; PurpleAccount *account; PurpleConnection *gc; @@ -1117,16 +1116,13 @@ static void yahoo_xfer_recv_cb_15(gpointer data, gint source, PurpleInputConditi account = purple_connection_get_account(xd->gc); gc = xd->gc; - buf=g_strnfill(1000, 0); - while((did = read(source, buf, 998)) > 0) + while((did = read(source, buf, sizeof(buf))) > 0) { + /* TODO: Convert to circ buffer, this all is pretty horrible */ + xd->txbuf = g_realloc(xd->txbuf, xd->txbuflen + did); + g_memmove(xd->txbuf + xd->txbuflen, buf, did); xd->txbuflen += did; - buf[did] = '\0'; - t = xd->txbuf; - xd->txbuf = g_strconcat(t,buf,NULL); - g_free(t); } - g_free(buf); if (did < 0 && errno == EAGAIN) return; @@ -1244,7 +1240,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err account = purple_connection_get_account(gc); if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); + purple_xfer_get_remote_user(xfer), _("Unable to connect.")); purple_xfer_cancel_remote(xfer); return; } @@ -1252,6 +1248,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err if (xd->txbuflen == 0) { gchar* cookies; + gchar* initial_buffer; YahooData *yd = gc->proto_data; /* cookies = yahoo_get_cookies(gc); @@ -1265,30 +1262,30 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err if(xd->info_val_249 == 2) { /* sending file via p2p, we are connected as client */ - xd->txbuf = g_strdup_printf("POST /%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("POST /%s HTTP/1.1\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" - "Content-Length: %ld\r\n" + "Content-Length: %" G_GSIZE_FORMAT "\r\n" "Cache-Control: no-cache\r\n\r\n", xd->path, xd->host, - (long int)xfer->size); /* to do, add Referer */ + purple_xfer_get_size(xfer)); /* to do, add Referer */ } else { /* sending file via relaying */ - xd->txbuf = g_strdup_printf("POST /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("POST /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" "Cookie:%s\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" - "Content-Length: %ld\r\n" + "Content-Length: %" G_GSIZE_FORMAT "\r\n" "Cache-Control: no-cache\r\n\r\n", purple_url_encode(xd->xfer_idstring_for_relay), purple_normalize(account, purple_account_get_username(account)), - xfer->who, + purple_xfer_get_remote_user(xfer), cookies, xd->host, - (long int)xfer->size); + purple_xfer_get_size(xfer)); /* to do, add Referer */ } } else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == STARTED) @@ -1296,7 +1293,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err if(xd->info_val_249 == 1) { /* receiving file via p2p, connected as client */ - xd->txbuf = g_strdup_printf("HEAD /%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("HEAD /%s HTTP/1.1\r\n" "Accept: */*\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" @@ -1307,7 +1304,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err else { /* receiving file via relaying */ - xd->txbuf = g_strdup_printf("HEAD /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("HEAD /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" "Accept: */*\r\n" "Cookie: %s\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" @@ -1316,7 +1313,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err "Cache-Control: no-cache\r\n\r\n", purple_url_encode(xd->xfer_idstring_for_relay), purple_normalize(account, purple_account_get_username(account)), - xfer->who, + purple_xfer_get_remote_user(xfer), cookies, xd->host); } @@ -1326,7 +1323,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err if(xd->info_val_249 == 1) { /* receiving file via p2p, connected as client */ - xd->txbuf = g_strdup_printf("GET /%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("GET /%s HTTP/1.1\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" "Connection: Keep-Alive\r\n\r\n", @@ -1335,14 +1332,14 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err else { /* receiving file via relaying */ - xd->txbuf = g_strdup_printf("GET /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("GET /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" "Cookie: %s\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" "Connection: Keep-Alive\r\n\r\n", purple_url_encode(xd->xfer_idstring_for_relay), purple_normalize(account, purple_account_get_username(account)), - xfer->who, + purple_xfer_get_remote_user(xfer), cookies, xd->host); } @@ -1353,7 +1350,8 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err g_free(cookies); return; } - xd->txbuflen = strlen(xd->txbuf); + xd->txbuf = (guchar*) initial_buffer; + xd->txbuflen = strlen(initial_buffer); xd->txbuf_written = 0; g_free(cookies); } @@ -1430,14 +1428,15 @@ static void yahoo_p2p_ft_HEAD_GET_cb(gpointer data, gint source, PurpleInputCond time_str[strlen(time_str) - 1] = '\0'; if (xd->txbuflen == 0) { - xd->txbuf = g_strdup_printf("HTTP/1.0 200 OK\r\n" + gchar *initial_buffer = g_strdup_printf("HTTP/1.0 200 OK\r\n" "Date: %s GMT\r\n" "Server: Y!/1.0\r\n" "MIME-version: 1.0\r\n" "Last-modified: %s GMT\r\n" "Content-length: %" G_GSIZE_FORMAT "\r\n\r\n", - time_str, time_str, xfer->size); - xd->txbuflen = strlen(xd->txbuf); + time_str, time_str, purple_xfer_get_size(xfer)); + xd->txbuf = (guchar *)initial_buffer; + xd->txbuflen = strlen(initial_buffer); xd->txbuf_written = 0; } @@ -1480,7 +1479,7 @@ static void yahoo_p2p_ft_server_send_connected_cb(gpointer data, gint source, Pu /* Add an Input Read event to the file descriptor */ xfer->fd = acceptfd; - if(xfer->type == PURPLE_XFER_RECEIVE) + if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_POST_cb, data); else xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_HEAD_GET_cb, data); @@ -1505,7 +1504,7 @@ static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) return; } - if( (xfer->type == PURPLE_XFER_RECEIVE) || (xd->status_15 != P2P_HEAD_REPLIED) ) { + if( (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) || (xd->status_15 != P2P_HEAD_REPLIED) ) { yd = xd->gc->proto_data; account = purple_connection_get_account(xd->gc); local_ip = purple_network_get_my_ip(listenfd); @@ -1514,18 +1513,18 @@ static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); filename_without_spaces = g_strdup(filename); purple_util_chrreplace(filename_without_spaces, ' ', '+'); - xd->xfer_url = g_strdup_printf("/Messenger.%s.%d000%s?AppID=Messenger&UserID=%s&K=lc9lu2u89gz1llmplwksajkjx", xfer->who, (int)time(NULL), filename_without_spaces, xfer->who); + xd->xfer_url = g_strdup_printf("/Messenger.%s.%d000%s?AppID=Messenger&UserID=%s&K=lc9lu2u89gz1llmplwksajkjx", purple_xfer_get_remote_user(xfer), (int)time(NULL), filename_without_spaces, purple_xfer_get_remote_user(xfer)); url_to_send = g_strdup_printf("http://%s:%d%s", local_ip, xd->yahoo_local_p2p_ft_server_port, xd->xfer_url); - if(xfer->type == PURPLE_XFER_RECEIVE) { + if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) { xd->info_val_249 = 2; /* 249=2: we are p2p server, and receiving file */ pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, YAHOO_STATUS_AVAILABLE, yd->session_id); yahoo_packet_hash(pkt, "ssssis", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xd->xfer_peer_idstring, - 27, xfer->filename, + 27, purple_xfer_get_filename(xfer), 249, 2, 250, url_to_send); } @@ -1534,7 +1533,7 @@ static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); yahoo_packet_hash(pkt, "ssssis", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xd->xfer_peer_idstring, 27, filename, 249, 1, @@ -1569,7 +1568,7 @@ static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer account = purple_connection_get_account(gc); yd = gc->proto_data; - p2p_data = g_hash_table_lookup(yd->peers, xfer->who); + p2p_data = g_hash_table_lookup(yd->peers, purple_xfer_get_remote_user(xfer)); if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER ) if(purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) return; @@ -1579,7 +1578,7 @@ static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer yahoo_packet_hash(pkt, "ssssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xd->xfer_peer_idstring, 27, filename, 249, 2); /* 249=2: we are p2p client */ @@ -1738,8 +1737,6 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) g_return_if_reached(); } - xfer->message = NULL; - /* Set the info about the incoming file. */ utf8_filename = yahoo_string_decode(gc, filename, TRUE); purple_xfer_set_filename(xfer, utf8_filename); @@ -1764,7 +1761,7 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) if(nooffiles > 1) { gchar* message; - message = g_strdup_printf(_("%s is trying to send you a group of %d files.\n"), xfer->who, nooffiles); + message = g_strdup_printf(_("%s is trying to send you a group of %d files.\n"), purple_xfer_get_remote_user(xfer), nooffiles); purple_xfer_conversation_write(xfer, message, FALSE); g_free(message); } @@ -1853,9 +1850,9 @@ void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet * YAHOO_STATUS_AVAILABLE, yd->session_id); yahoo_packet_hash(pkt_to_send, "ssssis", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, - 27, xfer->filename, + 27, purple_xfer_get_filename(xfer), 249, xfer_data->info_val_249, 251, xfer_data->xfer_idstring_for_relay); @@ -1869,7 +1866,7 @@ void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet * } } else if(val_249 == 2) { - p2p_data = g_hash_table_lookup(yd->peers, xfer->who); + p2p_data = g_hash_table_lookup(yd->peers, purple_xfer_get_remote_user(xfer)); if( !( p2p_data && (p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) ) ) { purple_xfer_cancel_remote(xfer); return; -- cgit v1.2.1 From 204c866db7a1abf583f0f5e1a4946d9371df91a8 Mon Sep 17 00:00:00 2001 From: Daniel Atallah Date: Mon, 29 Aug 2011 23:02:26 +0000 Subject: Use accessors for PurpleXfer --- pidgin/gtkft.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pidgin/gtkft.c b/pidgin/gtkft.c index 820ea3636a..b0194115cb 100644 --- a/pidgin/gtkft.c +++ b/pidgin/gtkft.c @@ -113,14 +113,17 @@ get_xfer_info_strings(PurpleXfer *xfer, char **kbsec, char **time_elapsed, double kbps = 0.0; time_t elapsed, now; - if (xfer->end_time != 0) - now = xfer->end_time; - else + now = purple_xfer_get_end_time(xfer); + if (now == 0) now = time(NULL); kb_sent = purple_xfer_get_bytes_sent(xfer) / 1024.0; kb_rem = purple_xfer_get_bytes_remaining(xfer) / 1024.0; - elapsed = (xfer->start_time > 0 ? now - xfer->start_time : 0); + elapsed = purple_xfer_get_start_time(xfer); + if (elapsed > 0) + elapsed = now - elapsed; + else + elapsed = 0; kbps = (elapsed > 0 ? (kb_sent / elapsed) : 0); if (kbsec != NULL) { @@ -132,9 +135,9 @@ get_xfer_info_strings(PurpleXfer *xfer, char **kbsec, char **time_elapsed, int h, m, s; int secs_elapsed; - if (xfer->start_time > 0) + if (purple_xfer_get_start_time(xfer) > 0) { - secs_elapsed = now - xfer->start_time; + secs_elapsed = now - purple_xfer_get_start_time(xfer); h = secs_elapsed / 3600; m = (secs_elapsed % 3600) / 60; @@ -278,10 +281,10 @@ update_detailed_info(PidginXferDialog *dialog, PurpleXfer *xfer) } gtk_label_set_text(GTK_LABEL(dialog->local_user_label), - purple_account_get_username(xfer->account)); - gtk_label_set_text(GTK_LABEL(dialog->remote_user_label), xfer->who); + purple_account_get_username(purple_xfer_get_account(xfer))); + gtk_label_set_text(GTK_LABEL(dialog->remote_user_label), purple_xfer_get_remote_user(xfer)); gtk_label_set_text(GTK_LABEL(dialog->protocol_label), - purple_account_get_protocol_name(xfer->account)); + purple_account_get_protocol_name(purple_xfer_get_account(xfer))); if (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) { gtk_label_set_text(GTK_LABEL(dialog->filename_label), @@ -729,8 +732,8 @@ pidgin_xfer_dialog_new(void) gtk_widget_show(vbox2); /* Setup the listbox */ - gtk_box_pack_start(GTK_BOX(vbox2), - pidgin_make_scrollable(setup_tree(dialog), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, 140), + gtk_box_pack_start(GTK_BOX(vbox2), + pidgin_make_scrollable(setup_tree(dialog), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, 140), TRUE, TRUE, 0); /* "Close this window when all transfers finish" */ -- cgit v1.2.1 From a9e79169df72fcb9403b181ffd417d3841e48b77 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Tue, 30 Aug 2011 06:23:20 +0000 Subject: Alphabetize --- ChangeLog.API | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 221b4cc2a4..261b23cbb9 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -3,6 +3,8 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 3.0.0 (??/??/????): libpurple: Added: + * purple_conversation_get_ui_data + * purple_conversation_set_ui_data * purple_notify_searchresult_column_set_visible * purple_notify_searchresult_column_is_visible * purple_notify_user_info_prepend_pair_plaintext @@ -16,11 +18,9 @@ version 3.0.0 (??/??/????): * purple_roomlist_set_proto_data * purple_roomlist_set_ui_data * purple_xfer_get_protocol_data - * purple_xfer_set_protocol_data * purple_xfer_get_ui_data + * purple_xfer_set_protocol_data * purple_xfer_set_ui_data - * purple_conversation_get_ui_data - * purple_conversation_set_ui_data Changed: * purple_connection_error now takes a PurpleConnectionError -- cgit v1.2.1 From a56a0524597829f818cd82fa788b05389ede92e3 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Tue, 30 Aug 2011 06:37:09 +0000 Subject: A small bit of hide-a-struct --- libpurple/request.c | 41 ++++++++++++++++++++++++++++++++ libpurple/request.h | 67 +++++++++++++++++++++++++++++++---------------------- 2 files changed, 80 insertions(+), 28 deletions(-) diff --git a/libpurple/request.c b/libpurple/request.c index 3d8950ea4d..3a582dffb6 100644 --- a/libpurple/request.c +++ b/libpurple/request.c @@ -126,7 +126,26 @@ struct _PurpleRequestField void *ui_data; char *tooltip; +}; + +struct _PurpleRequestFields +{ + GList *groups; + + GHashTable *fields; + + GList *required_fields; + + void *ui_data; +}; + +struct _PurpleRequestFieldGroup +{ + PurpleRequestFields *fields_list; + + char *title; + GList *fields; }; PurpleRequestFields * @@ -357,6 +376,20 @@ purple_request_fields_get_account(const PurpleRequestFields *fields, return purple_request_field_account_get_value(field); } +gpointer purple_request_fields_get_ui_data(const PurpleRequestFields *fields) +{ + g_return_val_if_fail(fields != NULL, NULL); + + return fields->ui_data; +} + +void purple_request_fields_set_ui_data(PurpleRequestFields *fields, gpointer ui_data) +{ + g_return_if_fail(fields != NULL); + + fields->ui_data = ui_data; +} + PurpleRequestFieldGroup * purple_request_field_group_new(const char *title) { @@ -423,6 +456,14 @@ purple_request_field_group_get_fields(const PurpleRequestFieldGroup *group) return group->fields; } +PurpleRequestFields * +purple_request_field_group_get_fields_list(const PurpleRequestFieldGroup *group) +{ + g_return_val_if_fail(group != NULL, NULL); + + return group->fields_list; +} + PurpleRequestField * purple_request_field_new(const char *id, const char *text, PurpleRequestFieldType type) diff --git a/libpurple/request.h b/libpurple/request.h index 41ac859fd9..5a9f544ffe 100644 --- a/libpurple/request.h +++ b/libpurple/request.h @@ -33,6 +33,16 @@ /** @copydoc _PurpleRequestField */ typedef struct _PurpleRequestField PurpleRequestField; +/** + * Multiple fields request data. + */ +typedef struct _PurpleRequestFields PurpleRequestFields; + +/** + * A group of fields with a title. + */ +typedef struct _PurpleRequestFieldGroup PurpleRequestFieldGroup; + #include "account.h" #define PURPLE_DEFAULT_ACTION_NONE -1 @@ -68,34 +78,6 @@ typedef enum } PurpleRequestFieldType; -/** - * Multiple fields request data. - */ -typedef struct -{ - GList *groups; - - GHashTable *fields; - - GList *required_fields; - - void *ui_data; - -} PurpleRequestFields; - -/** - * A group of fields with a title. - */ -typedef struct -{ - PurpleRequestFields *fields_list; - - char *title; - - GList *fields; - -} PurpleRequestFieldGroup; - /** * Request UI operations. */ @@ -322,6 +304,25 @@ int purple_request_fields_get_choice(const PurpleRequestFields *fields, PurpleAccount *purple_request_fields_get_account(const PurpleRequestFields *fields, const char *id); +/** + * Returns the UI data associated with this object. + * + * @param fields The fields list. + * + * @return The UI data associated with this object. This is a + * convenience field provided to the UIs--it is not + * used by the libuprple core. + */ +gpointer purple_request_fields_get_ui_data(const PurpleRequestFields *fields); + +/** + * Set the UI data associated with this object. + * + * @param fields The fields list. + * @param ui_data A pointer to associate with this object. + */ +void purple_request_fields_set_ui_data(PurpleRequestFields *fields, gpointer data); + /*@}*/ /**************************************************************************/ @@ -374,6 +375,16 @@ const char *purple_request_field_group_get_title( GList *purple_request_field_group_get_fields( const PurpleRequestFieldGroup *group); +/** + * Returns a list of all fields in a group. + * + * @param group The group. + * + * @constreturn The list of fields in the group. + */ +PurpleRequestFields *purple_request_field_group_get_fields_list( + const PurpleRequestFieldGroup *group); + /*@}*/ /**************************************************************************/ -- cgit v1.2.1 From 258786f58711f810bef0b436804e77bc75124b96 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 07:20:56 +0000 Subject: Fix build breakage introduced by 55a194e489bb2b6b8d7c6dde6ace291d8e094356. --- pidgin/gtkrequest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index 8dccd2fd70..cac7e8f8a6 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -749,6 +749,7 @@ static void req_entry_field_changed_cb(GtkWidget *entry, PurpleRequestField *field) { PurpleRequestFieldGroup *group; + PurpleRequestFields *fields; PidginRequestData *req_data; if (purple_request_field_string_is_multiline(field)) @@ -771,10 +772,11 @@ req_entry_field_changed_cb(GtkWidget *entry, PurpleRequestField *field) } group = purple_request_field_get_group(field); - req_data = (PidginRequestData *)group->fields_list->ui_data; + fields = purple_request_field_group_get_fields_list(group); + req_data = purple_request_fields_get_ui_data(fields); gtk_widget_set_sensitive(req_data->ok_button, - purple_request_fields_all_required_filled(group->fields_list)); + purple_request_fields_all_required_filled(fields)); } static void @@ -796,7 +798,7 @@ setup_entry_field(GtkWidget *entry, PurpleRequestField *field) { GtkWidget *optmenu = NULL; PurpleRequestFieldGroup *group = purple_request_field_get_group(field); - GList *fields = group->fields; + GList *fields = purple_request_field_group_get_fields(group); /* Ensure the account option menu is created (if the widget hasn't * been initialized already) for username auto-completion. */ @@ -1220,7 +1222,7 @@ pidgin_request_fields(const char *title, const char *primary, data->user_data = user_data; data->u.multifield.fields = fields; - fields->ui_data = data; + purple_request_fields_set_ui_data(fields, data); data->cb_count = 2; data->cbs = g_new0(GCallback, 2); -- cgit v1.2.1 From 676c863f484c6a85122588f19a9e1ceaca209cee Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Tue, 30 Aug 2011 07:35:50 +0000 Subject: Doh, I failed to checkin two files in my previous commit. --- ChangeLog.API | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 261b23cbb9..d722a99def 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -5,11 +5,14 @@ version 3.0.0 (??/??/????): Added: * purple_conversation_get_ui_data * purple_conversation_set_ui_data - * purple_notify_searchresult_column_set_visible * purple_notify_searchresult_column_is_visible + * purple_notify_searchresult_column_set_visible * purple_notify_user_info_prepend_pair_plaintext - * purple_request_field_set_tooltip * purple_request_field_get_tooltip + * purple_request_field_group_get_fields_list + * purple_request_field_set_tooltip + * purple_request_fields_get_ui_data + * purple_request_fields_set_ui_data * purple_roomlist_get_account * purple_roomlist_get_proto_data * purple_roomlist_get_ui_data -- cgit v1.2.1 From 8b4a4d63c4bcdbd4b61c8ff82cdcb71c6dd152f2 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 18:34:11 +0000 Subject: Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/irc/dcc_send.c | 4 ++-- libpurple/protocols/irc/irc.c | 47 +++++++++++++++++++------------------- libpurple/protocols/irc/parse.c | 2 +- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/libpurple/protocols/irc/dcc_send.c b/libpurple/protocols/irc/dcc_send.c index c392afcbad..d55882cac5 100644 --- a/libpurple/protocols/irc/dcc_send.c +++ b/libpurple/protocols/irc/dcc_send.c @@ -297,7 +297,7 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) xd = purple_xfer_get_protocol_data(xfer); gc = purple_account_get_connection(purple_xfer_get_account(xfer)); - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); purple_xfer_unref(xfer); @@ -323,7 +323,7 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) purple_xfer_get_filename(xfer), ntohl(addr.s_addr), port, purple_xfer_get_size(xfer)); - irc_cmd_privmsg(gc->proto_data, "msg", NULL, arg); + irc_cmd_privmsg(purple_connection_get_protocol_data(gc), "msg", NULL, arg); g_free(tmp); } diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index 07dd1e54dd..78c7f647eb 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -70,11 +70,11 @@ static void irc_view_motd(PurplePluginAction *action) struct irc_conn *irc; char *title; - if (gc == NULL || gc->proto_data == NULL) { + if (gc == NULL || purple_connection_get_protocol_data(gc) == NULL) { purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n"); return; } - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if (irc->motd == NULL) { purple_notify_error(gc, _("Error displaying MOTD"), _("No MOTD available"), _("There is no MOTD associated with this connection.")); @@ -100,7 +100,7 @@ static int do_send(struct irc_conn *irc, const char *buf, gsize len) static int irc_send_raw(PurpleConnection *gc, const char *buf, int len) { - struct irc_conn *irc = (struct irc_conn*)gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if (len == -1) { len = strlen(buf); } @@ -365,7 +365,8 @@ static void irc_login(PurpleAccount *account) return; } - gc->proto_data = irc = g_new0(struct irc_conn, 1); + irc = g_new0(struct irc_conn, 1); + purple_connection_set_protocol_data(gc, irc); irc->fd = -1; irc->account = account; irc->outbuf = purple_circ_buffer_new(512); @@ -415,7 +416,7 @@ static gboolean do_login(PurpleConnection *gc) { char *buf, *tmp = NULL; char *server; const char *username, *realname; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); const char *pass = purple_connection_get_password(gc); if (pass && *pass) { @@ -485,7 +486,7 @@ static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc, static void irc_login_cb(gpointer data, gint source, const gchar *error_message) { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if (source < 0) { gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), @@ -508,7 +509,7 @@ irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, gpointer data) { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); irc->gsc = NULL; @@ -517,7 +518,7 @@ irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, static void irc_close(PurpleConnection *gc) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if (irc == NULL) return; @@ -558,7 +559,7 @@ static void irc_close(PurpleConnection *gc) static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); char *plain; const char *args[2]; @@ -574,7 +575,7 @@ static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, static void irc_get_info(PurpleConnection *gc, const char *who) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); const char *args[2]; args[0] = who; args[1] = NULL; @@ -589,7 +590,7 @@ static void irc_set_status(PurpleAccount *account, PurpleStatus *status) const char *status_id = purple_status_get_id(status); g_return_if_fail(gc != NULL); - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if (!purple_status_is_active(status)) return; @@ -608,7 +609,7 @@ static void irc_set_status(PurpleAccount *account, PurpleStatus *status) static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - struct irc_conn *irc = (struct irc_conn *)gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); struct irc_buddy *ib; const char *bname = purple_buddy_get_name(buddy); @@ -633,7 +634,7 @@ static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - struct irc_conn *irc = (struct irc_conn *)gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); struct irc_buddy *ib; ib = g_hash_table_lookup(irc->buddies, purple_buddy_get_name(buddy)); @@ -678,7 +679,7 @@ static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); int len; if(!g_list_find(purple_connections_get_all(), gc)) { @@ -716,7 +717,7 @@ static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); int len; if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { @@ -746,7 +747,7 @@ static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond) static void irc_chat_join (PurpleConnection *gc, GHashTable *data) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); const char *args[2]; args[0] = g_hash_table_lookup(data, "channel"); @@ -760,7 +761,7 @@ static char *irc_get_chat_name(GHashTable *data) { static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); PurpleConversation *convo = purple_find_chat(gc, id); const char *args[2]; @@ -776,7 +777,7 @@ static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, c static void irc_chat_leave (PurpleConnection *gc, int id) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); PurpleConversation *convo = purple_find_chat(gc, id); const char *args[2]; @@ -791,7 +792,7 @@ static void irc_chat_leave (PurpleConnection *gc, int id) static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); PurpleConversation *convo = purple_find_chat(gc, id); const char *args[2]; char *tmp; @@ -845,7 +846,7 @@ static void irc_chat_set_topic(PurpleConnection *gc, int id, const char *topic) const char *name = NULL; struct irc_conn *irc; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); name = purple_conversation_get_name(purple_find_chat(gc, id)); if (name == NULL) @@ -863,7 +864,7 @@ static PurpleRoomlist *irc_roomlist_get_list(PurpleConnection *gc) PurpleRoomlistField *f; char *buf; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if (irc->roomlist) purple_roomlist_unref(irc->roomlist); @@ -897,7 +898,7 @@ static void irc_roomlist_cancel(PurpleRoomlist *list) if (gc == NULL) return; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); purple_roomlist_set_in_progress(list, FALSE); @@ -909,7 +910,7 @@ static void irc_roomlist_cancel(PurpleRoomlist *list) static void irc_keepalive(PurpleConnection *gc) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if ((time(NULL) - irc->recv_time) > PING_TIMEOUT) irc_cmd_ping(irc, NULL, NULL, NULL); } diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/parse.c index 3008b42cc9..7b2bd318fe 100644 --- a/libpurple/protocols/irc/parse.c +++ b/libpurple/protocols/irc/parse.c @@ -175,7 +175,7 @@ static PurpleCmdRet irc_parse_purple_cmd(PurpleConversation *conv, const gchar * if (!gc) return PURPLE_CMD_RET_FAILED; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if ((cmdent = g_hash_table_lookup(irc->cmds, cmd)) == NULL) return PURPLE_CMD_RET_FAILED; -- cgit v1.2.1 From bc3f1b6e821b4cf81c7b3f2c1466689c9be643eb Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 19:11:26 +0000 Subject: Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/jabber/adhoccommands.c | 5 +-- libpurple/protocols/jabber/buddy.c | 2 +- libpurple/protocols/jabber/caps.c | 2 +- libpurple/protocols/jabber/chat.c | 17 +++++---- libpurple/protocols/jabber/jabber.c | 57 ++++++++++++++++-------------- libpurple/protocols/jabber/jutil.c | 9 +++-- libpurple/protocols/jabber/message.c | 8 ++--- libpurple/protocols/jabber/presence.c | 4 +-- libpurple/protocols/jabber/roster.c | 10 +++--- libpurple/protocols/jabber/si.c | 2 +- libpurple/protocols/jabber/usertune.c | 2 +- 11 files changed, 63 insertions(+), 55 deletions(-) diff --git a/libpurple/protocols/jabber/adhoccommands.c b/libpurple/protocols/jabber/adhoccommands.c index 214f5dfdef..60dc73305d 100644 --- a/libpurple/protocols/jabber/adhoccommands.c +++ b/libpurple/protocols/jabber/adhoccommands.c @@ -228,7 +228,8 @@ void jabber_adhoc_execute_action(PurpleBlistNode *node, gpointer data) { JabberAdHocCommands *cmd = data; PurpleBuddy *buddy = (PurpleBuddy *) node; PurpleAccount *account = purple_buddy_get_account(buddy); - JabberStream *js = purple_account_get_connection(account)->proto_data; + PurpleConnection *gc = purple_account_get_connection(account); + JabberStream *js = purple_connection_get_protocol_data(gc); jabber_adhoc_execute(js, cmd); } @@ -321,7 +322,7 @@ static void jabber_adhoc_server_execute(PurplePluginAction *action) { JabberAdHocCommands *cmd = action->user_data; if(cmd) { PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); jabber_adhoc_execute(js, cmd); } diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 5c4cad5cc6..52d03ac322 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -557,7 +557,7 @@ void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) PurpleAccount *account = purple_connection_get_account(gc); /* Publish the avatar as specified in XEP-0084 */ - jabber_avatar_set(gc->proto_data, img); + jabber_avatar_set(purple_connection_get_protocol_data(gc), img); /* Set the image in our vCard */ jabber_set_info(gc, purple_account_get_user_info(account)); diff --git a/libpurple/protocols/jabber/caps.c b/libpurple/protocols/jabber/caps.c index ead8b1a002..a6221b5576 100644 --- a/libpurple/protocols/jabber/caps.c +++ b/libpurple/protocols/jabber/caps.c @@ -958,7 +958,7 @@ void jabber_caps_broadcast_change() const char *prpl_id = purple_account_get_protocol_id(account); if (g_str_equal("prpl-jabber", prpl_id) && purple_account_is_connected(account)) { PurpleConnection *gc = purple_account_get_connection(account); - jabber_presence_send(gc->proto_data, TRUE); + jabber_presence_send(purple_connection_get_protocol_data(gc), TRUE); } } diff --git a/libpurple/protocols/jabber/chat.c b/libpurple/protocols/jabber/chat.c index b4467397f3..b4a3ec0e89 100644 --- a/libpurple/protocols/jabber/chat.c +++ b/libpurple/protocols/jabber/chat.c @@ -70,7 +70,7 @@ GList *jabber_chat_info(PurpleConnection *gc) GHashTable *jabber_chat_info_defaults(PurpleConnection *gc, const char *chat_name) { GHashTable *defaults; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); @@ -146,7 +146,7 @@ JabberChat *jabber_chat_find_by_conv(PurpleConversation *conv) int id; if (!gc) return NULL; - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); return jabber_chat_find_by_id(js, id); } @@ -154,7 +154,7 @@ JabberChat *jabber_chat_find_by_conv(PurpleConversation *conv) void jabber_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *name) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); JabberChat *chat; xmlnode *message, *body, *x, *invite; char *room_jid; @@ -360,7 +360,7 @@ void jabber_chat_join(PurpleConnection *gc, GHashTable *data) { char *room, *server, *handle, *passwd; JabberID *jid; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); char *tmp; room = g_hash_table_lookup(data, "room"); @@ -418,10 +418,9 @@ void jabber_chat_join(PurpleConnection *gc, GHashTable *data) void jabber_chat_leave(PurpleConnection *gc, int id) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); JabberChat *chat = jabber_chat_find_by_id(js, id); - if(!chat) return; @@ -459,7 +458,7 @@ gboolean jabber_chat_find_buddy(PurpleConversation *conv, const char *name) char *jabber_chat_buddy_real_name(PurpleConnection *gc, int id, const char *who) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); JabberChat *chat; JabberChatMember *jcm; @@ -893,7 +892,7 @@ char *jabber_roomlist_room_serialize(PurpleRoomlistRoom *room) PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); GList *fields = NULL; PurpleRoomlistField *f; @@ -934,7 +933,7 @@ void jabber_roomlist_cancel(PurpleRoomlist *list) account = purple_roomlist_get_account(list); gc = purple_account_get_connection(account); - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); purple_roomlist_set_in_progress(list, FALSE); diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index bb185aa92f..dc6d088777 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -616,7 +616,7 @@ void jabber_send(JabberStream *js, xmlnode *packet) static gboolean jabber_keepalive_timeout(PurpleConnection *gc) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Ping timed out")); js->keepalive_timeout = 0; @@ -642,7 +642,7 @@ jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond) { PurpleConnection *gc = data; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); int len; static char buf[4096]; @@ -747,7 +747,7 @@ jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc, g_return_if_reached(); } - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); if(js->state == JABBER_STREAM_CONNECTING) jabber_send_raw(js, "", -1); @@ -842,7 +842,7 @@ jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, /* If the connection is already disconnected, we don't need to do anything else */ g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); js->gsc = NULL; purple_connection_ssl_error (gc, error); @@ -928,7 +928,8 @@ jabber_stream_new(PurpleAccount *account) gchar *user; gchar *slash; - js = gc->proto_data = g_new0(JabberStream, 1); + js = g_new0(JabberStream, 1); + purple_connection_set_protocol_data(gc, js); js->gc = gc; js->fd = -1; @@ -1559,14 +1560,14 @@ void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrati if(gc->state != PURPLE_CONNECTED) { if(gc->state != PURPLE_CONNECTING) jabber_login(account); - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); js->unregistration = TRUE; js->unregistration_cb = cb; js->unregistration_user_data = user_data; return; } - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); if (js->unregistration) { purple_debug_error("jabber", "Unregistration in process; ignoring duplicate request.\n"); @@ -1726,7 +1727,7 @@ void jabber_close(PurpleConnection *gc) g_free(js); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } void jabber_stream_set_state(JabberStream *js, JabberStreamState state) @@ -1780,7 +1781,7 @@ char *jabber_get_next_id(JabberStream *js) void jabber_idle_set(PurpleConnection *gc, int idle) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); js->idle = idle ? time(NULL) - idle : idle; @@ -2133,7 +2134,7 @@ const char* jabber_list_emblem(PurpleBuddy *b) if(!gc) return NULL; - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); if(js) jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); @@ -2174,8 +2175,8 @@ char *jabber_status_text(PurpleBuddy *b) PurpleAccount *account = purple_buddy_get_account(b); PurpleConnection *gc = purple_account_get_connection(account); - if (gc && gc->proto_data) - jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); + if (gc && purple_connection_get_protocol_data(gc)) + jb = jabber_buddy_find(purple_connection_get_protocol_data(gc), purple_buddy_get_name(b), FALSE); if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) { ret = g_strdup(_("Not Authorized")); @@ -2250,6 +2251,7 @@ void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboole JabberBuddy *jb; PurpleAccount *account; PurpleConnection *gc; + JabberStream *js; g_return_if_fail(b != NULL); @@ -2258,9 +2260,11 @@ void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboole gc = purple_account_get_connection(account); g_return_if_fail(gc != NULL); - g_return_if_fail(gc->proto_data != NULL); - jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); + js = purple_connection_get_protocol_data(gc); + g_return_if_fail(js != NULL); + + jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); if(jb) { JabberBuddyResource *jbr = NULL; @@ -2531,7 +2535,7 @@ static void jabber_password_change(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field; @@ -2563,7 +2567,7 @@ static void jabber_password_change(PurplePluginAction *action) GList *jabber_actions(PurplePlugin *plugin, gpointer context) { PurpleConnection *gc = (PurpleConnection *) context; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); GList *m = NULL; PurplePluginAction *act; @@ -2634,7 +2638,7 @@ PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name) void jabber_convo_closed(PurpleConnection *gc, const char *who) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); JabberID *jid; JabberBuddy *jb; JabberBuddyResource *jbr; @@ -3159,7 +3163,7 @@ static gboolean _jabber_send_buzz(JabberStream *js, const char *username, char * static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - JabberStream *js = conv->account->gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(conv->account->gc); const gchar *who; gchar *description; PurpleBuddy *buddy; @@ -3206,7 +3210,7 @@ GList *jabber_attention_types(PurpleAccount *account) gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); gchar *error = NULL; if (!_jabber_send_buzz(js, username, &error)) { @@ -3289,8 +3293,8 @@ jabber_initiate_media(PurpleAccount *account, const char *who, PurpleMediaSessionType type) { #ifdef USE_VV - JabberStream *js = (JabberStream *) - purple_account_get_connection(account)->proto_data; + PurpleConnection *gc = purple_account_get_connection(account); + JabberStream *js = purple_connection_get_protocol_data(gc); JabberBuddy *jb; JabberBuddyResource *jbr = NULL; char *resource; @@ -3301,7 +3305,6 @@ jabber_initiate_media(PurpleAccount *account, const char *who, return FALSE; } - if((resource = jabber_get_resource(who)) != NULL) { /* they've specified a resource, no need to ask or * default or anything, just do it */ @@ -3432,8 +3435,8 @@ jabber_initiate_media(PurpleAccount *account, const char *who, PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who) { #ifdef USE_VV - JabberStream *js = (JabberStream *) - purple_account_get_connection(account)->proto_data; + PurpleConnection *gc = purple_account_get_connection(account); + JabberStream *js = purple_connection_get_protocol_data(gc); JabberBuddy *jb; JabberBuddyResource *jbr; PurpleMediaCaps total = PURPLE_MEDIA_CAPS_NONE; @@ -3521,7 +3524,7 @@ PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who) gboolean jabber_can_receive_file(PurpleConnection *gc, const char *who) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); if (js) { JabberBuddy *jb = jabber_buddy_find(js, who, FALSE); @@ -3571,7 +3574,7 @@ static PurpleCmdRet jabber_cmd_mood(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - JabberStream *js = conv->account->gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(conv->account->gc); if (js->pep) { /* if no argument was given, unset mood */ @@ -3755,7 +3758,7 @@ jabber_ipc_contact_has_feature(PurpleAccount *account, const gchar *jid, if (!purple_account_is_connected(account)) return FALSE; - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); if (!(resource = jabber_get_resource(jid)) || !(jb = jabber_buddy_find(js, jid, FALSE)) || diff --git a/libpurple/protocols/jabber/jutil.c b/libpurple/protocols/jabber/jutil.c index 38246dd5e7..0156eb5d56 100644 --- a/libpurple/protocols/jabber/jutil.c +++ b/libpurple/protocols/jabber/jutil.c @@ -583,11 +583,16 @@ jabber_id_new(const char *str) const char *jabber_normalize(const PurpleAccount *account, const char *in) { - PurpleConnection *gc = account ? account->gc : NULL; - JabberStream *js = gc ? gc->proto_data : NULL; + PurpleConnection *gc = NULL; + JabberStream *js = NULL; static char buf[3072]; /* maximum legal length of a jabber jid */ JabberID *jid; + if (account) + gc = purple_account_get_connection(account); + if (gc) + js = purple_connection_get_protocol_data(gc); + jid = jabber_id_new_internal(in, TRUE); if(!jid) return NULL; diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c index 609be702f5..71f349fc5d 100644 --- a/libpurple/protocols/jabber/message.c +++ b/libpurple/protocols/jabber/message.c @@ -1148,13 +1148,13 @@ int jabber_message_send_im(PurpleConnection *gc, const char *who, const char *ms resource = jabber_get_resource(who); - jb = jabber_buddy_find(gc->proto_data, who, TRUE); + jb = jabber_buddy_find(purple_connection_get_protocol_data(gc), who, TRUE); jbr = jabber_buddy_find_resource(jb, resource); g_free(resource); jm = g_new0(JabberMessage, 1); - jm->js = gc->proto_data; + jm->js = purple_connection_get_protocol_data(gc); jm->type = JABBER_MESSAGE_CHAT; jm->chat_state = JM_STATE_ACTIVE; jm->to = g_strdup(who); @@ -1211,14 +1211,14 @@ int jabber_message_send_chat(PurpleConnection *gc, int id, const char *msg, Purp if(!msg || !gc) return 0; - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); chat = jabber_chat_find_by_id(js, id); if(!chat) return 0; jm = g_new0(JabberMessage, 1); - jm->js = gc->proto_data; + jm->js = purple_connection_get_protocol_data(gc); jm->type = JABBER_MESSAGE_GROUPCHAT; jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); jm->id = jabber_get_next_id(jm->js); diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c index 7e0a11b93b..454b9ec318 100644 --- a/libpurple/protocols/jabber/presence.c +++ b/libpurple/protocols/jabber/presence.c @@ -393,7 +393,7 @@ static void authorize_add_cb(gpointer data) { struct _jabber_add_permit *jap = data; if(PURPLE_CONNECTION_IS_VALID(jap->gc)) - jabber_presence_subscription_set(jap->gc->proto_data, + jabber_presence_subscription_set(purple_connection_get_protocol_data(jap->gc), jap->who, "subscribed"); g_free(jap->who); g_free(jap); @@ -403,7 +403,7 @@ static void deny_add_cb(gpointer data) { struct _jabber_add_permit *jap = data; if(PURPLE_CONNECTION_IS_VALID(jap->gc)) - jabber_presence_subscription_set(jap->gc->proto_data, + jabber_presence_subscription_set(purple_connection_get_protocol_data(jap->gc), jap->who, "unsubscribed"); g_free(jap->who); g_free(jap); diff --git a/libpurple/protocols/jabber/roster.c b/libpurple/protocols/jabber/roster.c index 9683dbcbb6..21d9beb272 100644 --- a/libpurple/protocols/jabber/roster.c +++ b/libpurple/protocols/jabber/roster.c @@ -360,7 +360,7 @@ static void jabber_roster_update(JabberStream *js, const char *name, void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); char *who; JabberID *jid; JabberBuddy *jb; @@ -431,7 +431,7 @@ void jabber_roster_alias_change(PurpleConnection *gc, const char *name, const ch purple_debug_info("jabber", "jabber_roster_alias_change(): Aliased %s to %s\n", name, alias ? alias : "(null)"); - jabber_roster_update(gc->proto_data, name, NULL); + jabber_roster_update(purple_connection_get_protocol_data(gc), name, NULL); } } @@ -461,7 +461,7 @@ void jabber_roster_group_change(PurpleConnection *gc, const char *name, purple_debug_info("jabber", "jabber_roster_group_change(): Moving %s from %s to %s\n", name, old_group, new_group); - jabber_roster_update(gc->proto_data, name, groups); + jabber_roster_update(purple_connection_get_protocol_data(gc), name, groups); } void jabber_roster_group_rename(PurpleConnection *gc, const char *old_name, @@ -496,9 +496,9 @@ void jabber_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, purple_debug_info("jabber", "jabber_roster_remove_buddy(): Removing %s from %s\n", purple_buddy_get_name(buddy), purple_group_get_name(group)); - jabber_roster_update(gc->proto_data, name, groups); + jabber_roster_update(purple_connection_get_protocol_data(gc), name, groups); } else { - JabberIq *iq = jabber_iq_new_query(gc->proto_data, JABBER_IQ_SET, + JabberIq *iq = jabber_iq_new_query(purple_connection_get_protocol_data(gc), JABBER_IQ_SET, "jabber:iq:roster"); xmlnode *query = xmlnode_get_child(iq->node, "query"); xmlnode *item = xmlnode_new_child(query, "item"); diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index 2aad17a773..8e32b7201c 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -1615,7 +1615,7 @@ PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who) PurpleXfer *xfer; JabberSIXfer *jsx; - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); if (xfer) diff --git a/libpurple/protocols/jabber/usertune.c b/libpurple/protocols/jabber/usertune.c index 03e485ef1b..3fc5c40f91 100644 --- a/libpurple/protocols/jabber/usertune.c +++ b/libpurple/protocols/jabber/usertune.c @@ -117,7 +117,7 @@ void jabber_tune_init(void) { void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo) { xmlnode *publish, *tunenode; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); publish = xmlnode_new("publish"); xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/tune"); -- cgit v1.2.1 From ddcc0c21d7f3bbccf90e4c97a5f3b2433e562c8d Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 19:22:01 +0000 Subject: Convert msn prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/msn/msn.c | 70 +++++++++++++++++++------------------- libpurple/protocols/msn/user.c | 2 +- libpurple/protocols/msn/userlist.c | 4 +-- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index f70ad2eec4..0f80250f46 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -119,7 +119,7 @@ msn_send_attention(PurpleConnection *gc, const char *username, guint type) MsnSwitchBoard *swboard; msg = msn_message_new_nudge(); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_session_get_swboard(session, username, MSN_SB_FLAG_IM); msn_switchboard_send_msg(swboard, msg, TRUE); @@ -326,7 +326,7 @@ msn_set_prp(PurpleConnection *gc, const char *type, const char *entry) MsnSession *session; MsnTransaction *trans; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); cmdproc = session->notification->cmdproc; if (entry == NULL || *entry == '\0') @@ -384,7 +384,7 @@ send_to_mobile(PurpleConnection *gc, const char *who, const char *entry) const char *mobile_number = NULL; gsize payload_len; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); cmdproc = session->notification->cmdproc; page = msn_page_new(); @@ -647,7 +647,7 @@ msn_show_set_home_phone(PurplePluginAction *action) MsnSession *session; gc = (PurpleConnection *) action->context; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); purple_request_input(gc, NULL, _("Set your home phone number."), NULL, msn_user_get_home_phone(session->user), FALSE, FALSE, NULL, @@ -664,7 +664,7 @@ msn_show_set_work_phone(PurplePluginAction *action) MsnSession *session; gc = (PurpleConnection *) action->context; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); purple_request_input(gc, NULL, _("Set your work phone number."), NULL, msn_user_get_work_phone(session->user), FALSE, FALSE, NULL, @@ -681,7 +681,7 @@ msn_show_set_mobile_phone(PurplePluginAction *action) MsnSession *session; gc = (PurpleConnection *) action->context; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); purple_request_input(gc, NULL, _("Set your mobile phone number."), NULL, msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL, @@ -719,7 +719,7 @@ msn_show_blocked_text(PurplePluginAction *action) MsnSession *session; char *title; - session = pc->proto_data; + session = purple_connection_get_protocol_data(pc); title = g_strdup_printf(_("Blocked Text for %s"), session->account->username); if (session->blocked_text == NULL) { @@ -743,7 +743,7 @@ msn_show_hotmail_inbox(PurplePluginAction *action) MsnSession *session; gc = (PurpleConnection *) action->context; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); if (!session->passport_info.email_enabled) { purple_notify_error(gc, NULL, @@ -810,7 +810,7 @@ msn_send_privacy(PurpleConnection *gc) MsnTransaction *trans; account = purple_connection_get_account(gc); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); cmdproc = session->notification->cmdproc; if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL || @@ -840,7 +840,7 @@ initiate_chat_cb(PurpleBlistNode *node, gpointer data) account = purple_buddy_get_account(buddy); gc = purple_account_get_connection(account); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_switchboard_new(session); msn_switchboard_request(swboard); @@ -879,7 +879,7 @@ msn_new_xfer(PurpleConnection *gc, const char *who) MsnSession *session; PurpleXfer *xfer; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); @@ -918,7 +918,7 @@ msn_can_receive_file(PurpleConnection *gc, const char *who) g_free(normal); if (ret) { - MsnSession *session = gc->proto_data; + MsnSession *session = purple_connection_get_protocol_data(gc); if (session) { MsnUser *user = msn_userlist_find_user(session->userlist, who); if (user) { @@ -1216,7 +1216,7 @@ msn_actions(PurplePlugin *plugin, gpointer context) PurplePluginAction *act; gc = (PurpleConnection *) context; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); act = purple_plugin_action_new(_("Set Friendly Name..."), msn_show_set_friendly_name); @@ -1353,7 +1353,7 @@ msn_login(PurpleAccount *account) session = msn_session_new(account); - gc->proto_data = session; + purple_connection_set_protocol_data(gc, session); gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; @@ -1387,13 +1387,13 @@ msn_close(PurpleConnection *gc) { MsnSession *session; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); g_return_if_fail(session != NULL); msn_session_destroy(session); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } static gboolean @@ -1539,7 +1539,7 @@ msn_send_im(PurpleConnection *gc, const char *who, const char *message, account = purple_connection_get_account(gc); username = purple_account_get_username(account); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_session_find_swboard(session, who); if (!strncmp("tel:+", who, 5)) { @@ -1666,7 +1666,7 @@ msn_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) MsnMessage *msg; account = purple_connection_get_account(gc); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* * TODO: I feel like this should be "if (state != PURPLE_TYPING)" @@ -1715,7 +1715,7 @@ msn_set_status(PurpleAccount *account, PurpleStatus *status) if (gc != NULL) { - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); msn_change_status(session); } } @@ -1725,7 +1725,7 @@ msn_set_idle(PurpleConnection *gc, int idle) { MsnSession *session; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); msn_change_status(session); } @@ -1855,7 +1855,7 @@ msn_rem_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) MsnSession *session; MsnUserList *userlist; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; if (!session->logged_in) @@ -1872,7 +1872,7 @@ msn_add_permit(PurpleConnection *gc, const char *who) MsnUserList *userlist; MsnUser *user; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; user = msn_userlist_find_user(userlist, who); @@ -1900,7 +1900,7 @@ msn_add_deny(PurpleConnection *gc, const char *who) MsnUserList *userlist; MsnUser *user; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; user = msn_userlist_find_user(userlist, who); @@ -1927,7 +1927,7 @@ msn_rem_permit(PurpleConnection *gc, const char *who) MsnUserList *userlist; MsnUser *user; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; if (!session->logged_in) @@ -1950,7 +1950,7 @@ msn_rem_deny(PurpleConnection *gc, const char *who) MsnUserList *userlist; MsnUser *user; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; if (!session->logged_in) @@ -1979,7 +1979,7 @@ msn_chat_invite(PurpleConnection *gc, int id, const char *msg, MsnSession *session; MsnSwitchBoard *swboard; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_session_find_swboard_with_id(session, id); @@ -2004,7 +2004,7 @@ msn_chat_leave(PurpleConnection *gc, int id) MsnSwitchBoard *swboard; PurpleConversation *conv; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_session_find_swboard_with_id(session, id); @@ -2041,7 +2041,7 @@ msn_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFl GString *emoticons = NULL; account = purple_connection_get_account(gc); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); username = purple_account_get_username(account); swboard = msn_session_find_swboard_with_id(session, id); @@ -2107,7 +2107,7 @@ msn_keepalive(PurpleConnection *gc) MsnSession *session; MsnTransaction *trans; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); if (!session->http_method) { @@ -2125,7 +2125,7 @@ static void msn_alias_buddy(PurpleConnection *pc, const char *name, const char * { MsnSession *session; - session = pc->proto_data; + session = purple_connection_get_protocol_data(pc); msn_update_contact(session, name, MSN_UPDATE_ALIAS, alias); } @@ -2137,7 +2137,7 @@ msn_group_buddy(PurpleConnection *gc, const char *who, MsnSession *session; MsnUserList *userlist; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; msn_userlist_move_buddy(userlist, who, old_group_name, new_group_name); @@ -2150,7 +2150,7 @@ msn_rename_group(PurpleConnection *gc, const char *old_name, MsnSession *session; const char *gname; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); g_return_if_fail(session != NULL); g_return_if_fail(session->userlist != NULL); @@ -2174,7 +2174,7 @@ msn_convo_closed(PurpleConnection *gc, const char *who) MsnSwitchBoard *swboard; PurpleConversation *conv; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_session_find_swboard(session, who); @@ -2210,7 +2210,7 @@ msn_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) MsnSession *session; MsnUser *user; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); user = session->user; msn_user_set_buddy_icon(user, img); @@ -2224,7 +2224,7 @@ msn_remove_group(PurpleConnection *gc, PurpleGroup *group) MsnSession *session; const char *gname; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); gname = purple_group_get_name(group); purple_debug_info("msn", "Remove group %s\n", gname); diff --git a/libpurple/protocols/msn/user.c b/libpurple/protocols/msn/user.c index 94af6ce6dc..8f9581e0fc 100644 --- a/libpurple/protocols/msn/user.c +++ b/libpurple/protocols/msn/user.c @@ -406,7 +406,7 @@ msn_user_is_yahoo(PurpleAccount *account, const char *name) gc = purple_account_get_connection(account); if (gc != NULL) - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); if ((session != NULL) && (user = msn_userlist_find_user(session->userlist, name)) != NULL) { diff --git a/libpurple/protocols/msn/userlist.c b/libpurple/protocols/msn/userlist.c index 1c4dd4bd8e..6ad7d670bc 100644 --- a/libpurple/protocols/msn/userlist.c +++ b/libpurple/protocols/msn/userlist.c @@ -54,7 +54,7 @@ msn_accept_add_cb(gpointer data) if (PURPLE_CONNECTION_IS_VALID(pa->gc)) { - MsnSession *session = pa->gc->proto_data; + MsnSession *session = purple_connection_get_protocol_data(pa->gc); MsnUserList *userlist = session->userlist; PurpleAccount *account = purple_connection_get_account(pa->gc); @@ -79,7 +79,7 @@ msn_cancel_add_cb(gpointer data) if (PURPLE_CONNECTION_IS_VALID(pa->gc)) { - MsnSession *session = pa->gc->proto_data; + MsnSession *session = purple_connection_get_protocol_data(pa->gc); MsnUserList *userlist = session->userlist; MsnCallbackState *state = msn_callback_state_new(session); -- cgit v1.2.1 From 88161fa676bfe713c0d76803611988f1a56223d0 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 19:32:08 +0000 Subject: Convert sametime prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/sametime/sametime.c | 72 ++++++++++++++++----------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 77444ccb27..abb2ad4d99 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -197,7 +197,7 @@ static guint log_handler[2] = { 0, 0 }; /** the purple plugin data. - available as gc->proto_data and mwSession_getClientData */ + available as purple_connection_get_protocol_data(gc) and mwSession_getClientData */ struct mwPurplePluginData { struct mwSession *session; @@ -320,7 +320,7 @@ static struct mwSession *gc_to_session(PurpleConnection *gc) { g_return_val_if_fail(gc != NULL, NULL); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_val_if_fail(pd != NULL, NULL); return pd->session; @@ -499,7 +499,7 @@ static void mw_aware_list_on_aware(struct mwAwareList *list, gc = mwAwareList_getClientData(list); acct = purple_connection_get_account(gc); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); idle = aware->status.time; stat = aware->status.status; id = aware->id.user; @@ -851,7 +851,7 @@ static void buddy_add(struct mwPurplePluginData *pd, static PurpleBuddy *buddy_ensure(PurpleConnection *gc, PurpleGroup *group, struct mwSametimeUser *stuser) { - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); PurpleBuddy *buddy; PurpleAccount *acct = purple_connection_get_account(gc); @@ -968,7 +968,7 @@ static PurpleGroup *group_ensure(PurpleConnection *gc, if(type == mwSametimeGroup_DYNAMIC) { purple_blist_node_set_string(gn, GROUP_KEY_OWNER, owner); - group_add(gc->proto_data, group); + group_add(purple_connection_get_protocol_data(gc), group); } return group; @@ -3192,7 +3192,7 @@ static struct mwPurplePluginData *mwPurplePluginData_new(PurpleConnection *gc) { mwSession_addCipher(pd->session, mwCipher_new_RC2_128(pd->session)); mwSession_setClientData(pd->session, pd, NULL); - gc->proto_data = pd; + purple_connection_set_protocol_data(gc, pd); return pd; } @@ -3201,7 +3201,7 @@ static struct mwPurplePluginData *mwPurplePluginData_new(PurpleConnection *gc) { static void mwPurplePluginData_free(struct mwPurplePluginData *pd) { g_return_if_fail(pd != NULL); - pd->gc->proto_data = NULL; + purple_connection_set_protocol_data(pd->gc, NULL); mwSession_removeService(pd->session, mwService_AWARE); mwSession_removeService(pd->session, mwService_CONFERENCE); @@ -3263,7 +3263,7 @@ static char *mw_prpl_status_text(PurpleBuddy *b) { const char *ret = NULL; if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) - && (pd = gc->proto_data)) + && (pd = purple_connection_get_protocol_data(gc))) ret = mwServiceAware_getText(pd->srvc_aware, &t); return (ret && g_utf8_validate(ret, -1, NULL)) ? g_markup_escape_text(ret, -1): NULL; @@ -3326,7 +3326,7 @@ static void mw_prpl_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info char *tmp; if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) - && (pd = gc->proto_data)) + && (pd = purple_connection_get_protocol_data(gc))) message = mwServiceAware_getText(pd->srvc_aware, &idb); status = status_text(b); @@ -3403,7 +3403,7 @@ static void conf_create_prompt_join(PurpleBuddy *buddy, acct = purple_buddy_get_account(buddy); gc = purple_account_get_connection(acct); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); srvc = pd->srvc_conf; f = purple_request_fields_get_field(fields, CHAT_KEY_TOPIC); @@ -3569,7 +3569,7 @@ static void blist_menu_conf(PurpleBlistNode *node, gpointer data) { gc = purple_account_get_connection(acct); g_return_if_fail(gc != NULL); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); /* @@ -3608,7 +3608,7 @@ static void blist_menu_announce(PurpleBlistNode *node, gpointer data) { gc = purple_account_get_connection(acct); g_return_if_fail(gc != NULL); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); rcpt_name = g_strdup_printf("@U %s", buddy->name); @@ -3813,7 +3813,7 @@ static void mw_prpl_close(PurpleConnection *gc) { g_return_if_fail(gc != NULL); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); /* get rid of the blist save timeout */ @@ -3827,7 +3827,7 @@ static void mw_prpl_close(PurpleConnection *gc) { mwSession_stop(pd->session, 0x00); /* no longer necessary */ - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); /* stop watching the socket */ if(gc->inpa) { @@ -4018,7 +4018,7 @@ static int mw_prpl_send_im(PurpleConnection *gc, struct mwConversation *conv; g_return_val_if_fail(gc != NULL, 0); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_val_if_fail(pd != NULL, 0); @@ -4093,7 +4093,7 @@ static unsigned int mw_prpl_send_typing(PurpleConnection *gc, gpointer t = GINT_TO_POINTER(!! state); g_return_val_if_fail(gc != NULL, 0); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_val_if_fail(pd != NULL, 0); @@ -4189,7 +4189,7 @@ static void mw_prpl_get_info(PurpleConnection *gc, const char *who) { g_return_if_fail(who != NULL); g_return_if_fail(*who != '\0'); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); acct = purple_connection_get_account(gc); b = purple_find_buddy(acct, who); @@ -4434,7 +4434,7 @@ static void add_buddy_resolved(struct mwServiceResolve *srvc, buddy = data->buddy; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); if(results) res = results->data; @@ -4515,7 +4515,7 @@ static void mw_prpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); struct mwServiceResolve *srvc; GList *query; enum mwResolveFlag flags; @@ -4566,7 +4566,7 @@ static void mw_prpl_add_buddies(PurpleConnection *gc, GHashTable *group_sets; struct mwAwareIdBlock *idbs, *idb; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); /* map PurpleGroup:GList of mwAwareIdBlock */ group_sets = g_hash_table_new(g_direct_hash, g_direct_equal); @@ -4617,7 +4617,7 @@ static void mw_prpl_remove_buddy(PurpleConnection *gc, GList *rem = g_list_prepend(NULL, &idb); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); group = purple_buddy_get_group(buddy); list = list_ensure(pd, group); @@ -4664,7 +4664,7 @@ static void mw_prpl_set_permit_deny(PurpleConnection *gc) { acct = purple_connection_get_account(gc); g_return_if_fail(acct != NULL); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); session = pd->session; @@ -4748,7 +4748,7 @@ static void mw_prpl_join_chat(PurpleConnection *gc, struct mwPurplePluginData *pd; char *c, *t; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); c = g_hash_table_lookup(components, CHAT_KEY_NAME); t = g_hash_table_lookup(components, CHAT_KEY_TOPIC); @@ -4790,7 +4790,7 @@ static void mw_prpl_reject_chat(PurpleConnection *gc, struct mwServiceConference *srvc; char *c; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); srvc = pd->srvc_conf; if(g_hash_table_lookup(components, CHAT_KEY_IS_PLACE)) { @@ -4822,7 +4822,7 @@ static void mw_prpl_chat_invite(PurpleConnection *gc, struct mwPlace *place; struct mwIdBlock idb = { (char *) who, NULL }; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); conf = ID_TO_CONF(pd, id); @@ -4846,7 +4846,7 @@ static void mw_prpl_chat_leave(PurpleConnection *gc, struct mwPurplePluginData *pd; struct mwConference *conf; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); conf = ID_TO_CONF(pd, id); @@ -4882,7 +4882,7 @@ static int mw_prpl_chat_send(PurpleConnection *gc, char *msg; int ret; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_val_if_fail(pd != NULL, 0); conf = ID_TO_CONF(pd, id); @@ -4920,7 +4920,7 @@ static void mw_prpl_alias_buddy(PurpleConnection *gc, const char *who, const char *alias) { - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); /* it's a change to the buddy list, so we've gotta reflect that in @@ -4938,7 +4938,7 @@ static void mw_prpl_group_buddy(PurpleConnection *gc, struct mwAwareIdBlock idb = { mwAware_USER, (char *) who, NULL }; GList *gl = g_list_prepend(NULL, &idb); - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); PurpleGroup *group; struct mwAwareList *list; @@ -4964,7 +4964,7 @@ static void mw_prpl_rename_group(PurpleConnection *gc, PurpleGroup *group, GList *buddies) { - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); /* it's a change in the buddy list, so we've gotta reflect that in @@ -4984,7 +4984,7 @@ static void mw_prpl_buddy_free(PurpleBuddy *buddy) { static void mw_prpl_convo_closed(PurpleConnection *gc, const char *who) { - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); struct mwServiceIm *srvc; struct mwConversation *conv; struct mwIdBlock idb = { (char *) who, NULL }; @@ -5019,7 +5019,7 @@ static void mw_prpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { struct mwPurplePluginData *pd; struct mwAwareList *list; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); g_return_if_fail(pd->group_list_map != NULL); @@ -5043,7 +5043,7 @@ static gboolean mw_prpl_can_receive_file(PurpleConnection *gc, g_return_val_if_fail(gc != NULL, FALSE); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_val_if_fail(pd != NULL, FALSE); srvc = pd->srvc_aware; @@ -5075,7 +5075,7 @@ static void ft_outgoing_init(PurpleXfer *xfer) { acct = purple_xfer_get_account(xfer); gc = purple_account_get_connection(acct); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); srvc = pd->srvc_ft; filename = purple_xfer_get_local_filename(xfer); @@ -5534,7 +5534,7 @@ static void remote_group_action_cb(PurpleConnection *gc, const char *name) { enum mwResolveFlag flags; guint32 req; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); srvc = pd->srvc_resolve; query = g_list_prepend(NULL, (char *) name); @@ -5659,7 +5659,7 @@ static void search_action_cb(PurpleConnection *gc, const char *name) { enum mwResolveFlag flags; guint32 req; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); srvc = pd->srvc_resolve; query = g_list_prepend(NULL, (char *) name); -- cgit v1.2.1 From f07906a27f21f926dedf71f6c390186c975c5f11 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 20:03:11 +0000 Subject: Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data() --- libpurple/protocols/yahoo/libymsg.c | 101 +++++++++++++++-------------- libpurple/protocols/yahoo/util.c | 9 +-- libpurple/protocols/yahoo/yahoo_aliases.c | 8 +-- libpurple/protocols/yahoo/yahoo_doodle.c | 2 +- libpurple/protocols/yahoo/yahoo_filexfer.c | 32 ++++----- libpurple/protocols/yahoo/yahoo_friend.c | 12 ++-- libpurple/protocols/yahoo/yahoo_picture.c | 22 +++---- libpurple/protocols/yahoo/yahoo_profile.c | 6 +- libpurple/protocols/yahoo/yahoochat.c | 32 ++++----- libpurple/protocols/yahoo/ycht.c | 12 ++-- 10 files changed, 120 insertions(+), 116 deletions(-) diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 4709071580..474e0f2768 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -496,7 +496,7 @@ static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt GSList *l = pkt->hash; PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GHashTable *ht; char *norm_bud = NULL; char *temp = NULL; @@ -638,7 +638,7 @@ static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) gboolean got_serv_list = FALSE; YahooFriend *f = NULL; PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GHashTable *ht; char **lines; @@ -787,7 +787,7 @@ static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, YahooFriend *f = NULL; GSList *l = pkt->hash; gint val_11 = 0; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); YahooFederation fed = YAHOO_FEDERATION_NONE; account = purple_connection_get_account(gc); @@ -899,7 +899,7 @@ static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet char *server_msg = NULL; char *m; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); while (l != NULL) { @@ -960,7 +960,7 @@ static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) { PurpleAccount *account; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GSList *l = pkt->hash; GSList *list = NULL; struct _yahoo_im *im = NULL; @@ -1202,7 +1202,7 @@ yahoo_buddy_add_authorize_cb(gpointer data) { struct yahoo_add_request *add_req = data; struct yahoo_packet *pkt; - YahooData *yd = add_req->gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(add_req->gc); const char *who = add_req->who; pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -1233,7 +1233,7 @@ yahoo_buddy_add_authorize_cb(gpointer data) static void yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) { - YahooData *yd = add_req->gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(add_req->gc); struct yahoo_packet *pkt; char *encoded_msg = NULL; const char *who = add_req->who; @@ -1295,7 +1295,7 @@ yahoo_buddy_add_deny_reason_cb(gpointer data) { static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason) { char *notify_msg; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (who == NULL) return; @@ -1625,7 +1625,7 @@ static char *yahoo_decode(const char *text) static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) { PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); const char *who = NULL; const char *email = NULL; const char *subj = NULL; @@ -1709,7 +1709,7 @@ static void to_y64(char *out, const unsigned char *in, gsize inlen) static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); const char *name = purple_normalize(account, purple_account_get_username(account)); PurpleCipher *md5_cipher; @@ -2207,7 +2207,7 @@ static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) { #ifdef TRY_WEBMESSENGER_LOGIN - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); #endif /* TRY_WEBMESSENGER_LOGIN */ GSList *l = pkt->hash; int err = 0; @@ -2300,7 +2300,7 @@ static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pk char *buf; YahooFriend *f; GSList *l = pkt->hash; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); YahooFederation fed = YAHOO_FEDERATION_NONE; while (l) { @@ -2394,7 +2394,7 @@ static void yahoo_p2p_keepalive_cb(gpointer key, gpointer value, gpointer user_d PurpleConnection *gc = user_data; struct yahoo_packet *pkt_to_send; PurpleAccount *account; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); @@ -2413,7 +2413,7 @@ static void yahoo_p2p_keepalive_cb(gpointer key, gpointer value, gpointer user_d static gboolean yahoo_p2p_keepalive(gpointer data) { PurpleConnection *gc = data; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); g_hash_table_foreach(yd->peers, yahoo_p2p_keepalive_cb, gc); @@ -2460,7 +2460,7 @@ static void yahoo_p2p_process_p2pfilexfer(gpointer data, gint source, struct yah if(!(p2p_data = data)) return ; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); /* lets see whats in the packet */ while (l) { @@ -2545,7 +2545,7 @@ static void yahoo_p2p_read_pkt_cb(gpointer data, gint source, PurpleInputConditi if(!(p2p_data = data)) return ; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); len = read(source, buf, sizeof(buf)); if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) @@ -2617,7 +2617,7 @@ static void yahoo_p2p_server_send_connected_cb(gpointer data, gint source, Purpl if(!(p2p_data = data)) return ; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); acceptfd = accept(source, NULL, 0); if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) @@ -2657,7 +2657,7 @@ static gboolean yahoo_cancel_p2p_server_listen_cb(gpointer data) if(!(p2p_data = data)) return FALSE; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect\n"); yahoo_p2p_disconnect_destroy_data(data); @@ -2678,7 +2678,7 @@ static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data) if(!(p2p_data = data)) return ; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); yd->listen_data = NULL; if(listenfd == -1) { @@ -2706,7 +2706,7 @@ void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13) YahooFriend *f; struct yahoo_packet *pkt; PurpleAccount *account; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_p2p_data *p2p_data; const char *norm_username; @@ -2787,7 +2787,7 @@ static void yahoo_p2p_init_cb(gpointer data, gint source, const gchar *error_mes YahooData *yd; p2p_data = data; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); if(error_message != NULL) { purple_debug_warning("yahoo","p2p: %s\n",error_message); @@ -3132,7 +3132,7 @@ static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt) static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); char buf[1024]; int len; @@ -3240,7 +3240,7 @@ static void yahoo_got_connected(gpointer data, gint source, const gchar *error_m return; } - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); yd->fd = source; pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, yd->session_id); @@ -3266,7 +3266,7 @@ static void yahoo_got_web_connected(gpointer data, gint source, const gchar *err return; } - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); yd->fd = source; pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, yd->session_id); @@ -3285,7 +3285,7 @@ static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition c { PurpleConnection *gc = data; PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); char bufread[2048], *i = bufread, *buf = bufread; int len; GString *s; @@ -3364,7 +3364,7 @@ static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCon int written, remaining; gc = data; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); remaining = strlen(yd->auth) - yd->auth_written; written = write(source, yd->auth + yd->auth_written, remaining); @@ -3474,7 +3474,7 @@ yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, { PurpleConnection *gc = (PurpleConnection *)user_data; PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); const char *sn = purple_account_get_username(account); const char *pass = purple_connection_get_password(gc); GHashTable *hash = yahoo_login_page_hash(url_text, len); @@ -3671,12 +3671,13 @@ static void yahoo_got_pager_server(PurpleUtilFetchUrlData *url_data, void yahoo_login(PurpleAccount *account) { PurpleConnection *gc = purple_account_get_connection(account); - YahooData *yd = gc->proto_data = g_new0(YahooData, 1); + YahooData *yd = g_new0(YahooData, 1); PurpleStatus *status = purple_account_get_active_status(account); gboolean use_whole_url = yahoo_account_use_http_proxy(gc); gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); PurpleUtilFetchUrlData *url_data; + purple_connection_set_protocol_data(gc, yd); gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; purple_connection_update_progress(gc, _("Connecting"), 1, 2); @@ -3721,7 +3722,7 @@ void yahoo_login(PurpleAccount *account) { } void yahoo_close(PurpleConnection *gc) { - YahooData *yd = (YahooData *)gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GSList *l; if (gc->inpa) @@ -3810,7 +3811,7 @@ void yahoo_close(PurpleConnection *gc) { g_free(yd->current_list15_grp); g_free(yd); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b) @@ -3827,7 +3828,7 @@ const char *yahoo_list_emblem(PurpleBuddy *b) if (!b || !(account = purple_buddy_get_account(b)) || !(gc = purple_account_get_connection(account)) || - !gc->proto_data) + !purple_connection_get_protocol_data(gc)) return NULL; f = yahoo_friend_find(gc, purple_buddy_get_name(b)); @@ -3892,7 +3893,7 @@ static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) { buddy = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); id = yd->conf_id; components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); @@ -4075,7 +4076,7 @@ static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data) static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { GList *m = NULL; PurpleMenuAction *act; - YahooData *yd = (YahooData *) gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (yd->current_status == YAHOO_STATUS_INVISIBLE) { if (f->presence != YAHOO_PRESENCE_ONLINE) { @@ -4135,7 +4136,7 @@ static GList *yahoo_buddy_menu(PurpleBuddy *buddy) PurpleMenuAction *act; PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); static char buf2[1024]; YahooFriend *f; @@ -4218,7 +4219,7 @@ GList *yahoo_blist_node_menu(PurpleBlistNode *node) static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")]; struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -4235,7 +4236,7 @@ yahoo_get_inbox_token_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, PurpleConnection *gc = user_data; gboolean set_cookie = FALSE; gchar *url; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); @@ -4271,7 +4272,7 @@ static void yahoo_show_inbox(PurplePluginAction *action) /* XXX I have no idea how this will work with Yahoo! Japan. */ PurpleConnection *gc = action->context; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleUtilFetchUrlData *url_data; const char* base_url = "http://login.yahoo.com"; @@ -4385,7 +4386,7 @@ static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer { struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data; PurpleConnection *gc = sms_cb_data->gc; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); char *status = NULL; char *carrier = NULL; PurpleAccount *account = purple_connection_get_account(gc); @@ -4440,7 +4441,7 @@ static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleUtilFetchUrlData *url_data; struct yahoo_sms_carrier_cb_data *sms_cb_data; char *validate_request_str = NULL; @@ -4500,7 +4501,7 @@ static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt = NULL; char *msg = yahoo_html_to_codes(what); char *msg2; @@ -4657,7 +4658,7 @@ int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, Purpl unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_p2p_data *p2p_data; YahooFederation fed = YAHOO_FEDERATION_NONE; struct yahoo_packet *pkt = NULL; @@ -4728,7 +4729,7 @@ void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) gc = purple_account_get_connection(account); presence = purple_status_get_presence(status); - yd = (YahooData *)gc->proto_data; + yd = purple_connection_get_protocol_data(gc); old_status = yd->current_status; yd->current_status = get_yahoo_status_from_purple_status(status); @@ -4794,7 +4795,7 @@ void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) void yahoo_set_idle(PurpleConnection *gc, int idle) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt = NULL; char *msg = NULL, *msg2 = NULL; PurpleStatus *status = NULL; @@ -4913,7 +4914,7 @@ GList *yahoo_status_types(PurpleAccount *account) void yahoo_keepalive(PurpleConnection *gc) { struct yahoo_packet *pkt; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); time_t now = time(NULL); /* We're only allowed to send a ping once an hour or the servers will boot us */ @@ -4946,7 +4947,7 @@ void yahoo_keepalive(PurpleConnection *gc) void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) { - YahooData *yd = (YahooData *)gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; const char *group = NULL; char *group2; @@ -5009,7 +5010,7 @@ void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - YahooData *yd = (YahooData *)gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; GSList *buddies, *l; PurpleGroup *g; @@ -5065,7 +5066,7 @@ void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g } void yahoo_add_deny(PurpleConnection *gc, const char *who) { - YahooData *yd = (YahooData *)gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; YahooFederation fed = YAHOO_FEDERATION_NONE; @@ -5088,7 +5089,7 @@ void yahoo_add_deny(PurpleConnection *gc, const char *who) { } void yahoo_rem_deny(PurpleConnection *gc, const char *who) { - YahooData *yd = (YahooData *)gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; YahooFederation fed = YAHOO_FEDERATION_NONE; @@ -5136,7 +5137,7 @@ void yahoo_set_permit_deny(PurpleConnection *gc) void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; char *gpn, *gpo; YahooFriend *f = yahoo_friend_find(gc, who); @@ -5183,7 +5184,7 @@ void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, void yahoo_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; char *gpn, *gpo; diff --git a/libpurple/protocols/yahoo/util.c b/libpurple/protocols/yahoo/util.c index bcfede658e..ab382af554 100644 --- a/libpurple/protocols/yahoo/util.c +++ b/libpurple/protocols/yahoo/util.c @@ -63,8 +63,9 @@ gchar* yahoo_get_cookies(PurpleConnection *gc) char firstflag = 1; gchar *t1,*t2,*t3; GSList *tmp; - GSList *cookies; - cookies = ((YahooData*)(gc->proto_data))->cookies; + YahooData *yd = purple_connection_get_protocol_data(gc); + GSList *cookies = yd->cookies; + tmp = cookies; while(tmp) { @@ -129,7 +130,7 @@ gchar* yahoo_get_cookies(PurpleConnection *gc) */ char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); char *ret; const char *to_codeset; @@ -158,7 +159,7 @@ char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8) */ char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); char *ret; const char *from_codeset; diff --git a/libpurple/protocols/yahoo/yahoo_aliases.c b/libpurple/protocols/yahoo/yahoo_aliases.c index 00a22894dc..ab657816e7 100644 --- a/libpurple/protocols/yahoo/yahoo_aliases.c +++ b/libpurple/protocols/yahoo/yahoo_aliases.c @@ -74,7 +74,7 @@ static void yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) { PurpleConnection *gc = user_data; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); yd->url_datas = g_slist_remove(yd->url_datas, url_data); @@ -186,7 +186,7 @@ yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, con void yahoo_fetch_aliases(PurpleConnection *gc) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); const char *url; gchar *request, *webpage, *webaddress; PurpleUtilFetchUrlData *url_data; @@ -230,7 +230,7 @@ yahoo_update_alias_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, cons PurpleConnection *gc = cb->gc; YahooData *yd; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); yd->url_datas = g_slist_remove(yd->url_datas, url_data); if (len == 0 || error_message != NULL) { @@ -310,7 +310,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) return; } - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); /* Using callback_data so I have access to gc in the callback function */ cb = g_new0(struct callback_data, 1); diff --git a/libpurple/protocols/yahoo/yahoo_doodle.c b/libpurple/protocols/yahoo/yahoo_doodle.c index f3f44a2631..3e8e34ccdf 100644 --- a/libpurple/protocols/yahoo/yahoo_doodle.c +++ b/libpurple/protocols/yahoo/yahoo_doodle.c @@ -389,7 +389,7 @@ static void yahoo_doodle_command_send_generic(const char *type, purple_debug_info("yahoo", "doodle: Sent %s (%s)\n", type, to); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); /* Make and send an acknowledge (ready) Doodle packet */ pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index 061e9b3bb7..8a122e7a2d 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -85,7 +85,7 @@ static void yahoo_xfer_data_free(struct yahoo_xfer_data *xd) GSList *l; gc = xd->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); /* remove entry from map */ if(xd->xfer_peer_idstring) { @@ -255,7 +255,7 @@ static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *er /* Assemble the tx buffer */ gc = xd->gc; account = purple_connection_get_account(gc); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -316,7 +316,7 @@ static void yahoo_xfer_init(PurpleXfer *xfer) xfer_data = purple_xfer_get_protocol_data(xfer); gc = xfer_data->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { @@ -360,7 +360,7 @@ static void yahoo_xfer_init_15(PurpleXfer *xfer) xfer_data = purple_xfer_get_protocol_data(xfer); gc = xfer_data->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { @@ -527,7 +527,7 @@ static void yahoo_xfer_cancel_send(PurpleXfer *xfer) struct yahoo_packet *pkt; gc = xfer_data->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); if(xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */ { @@ -575,7 +575,7 @@ static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) struct yahoo_packet *pkt; gc = xfer_data->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); if(!xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */ { @@ -662,7 +662,7 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) filesize = atol( xfer_data->size_list->data ); gc = xfer_data->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); /* setting up xfer_data for next file's tranfer */ g_free(xfer_data->host); @@ -805,7 +805,7 @@ void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt) unsigned long filesize = 0L; GSList *l; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -996,7 +996,7 @@ static void yahoo_xfer_dns_connected_15(GSList *hosts, gpointer data, const char return; gc = xd->gc; account = purple_connection_get_account(gc); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); if(!hosts) { @@ -1076,7 +1076,7 @@ gboolean yahoo_can_receive_file(PurpleConnection *gc, const char *who) void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file) { struct yahoo_xfer_data *xfer_data; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleXfer *xfer = yahoo_new_xfer(gc, who); g_return_if_fail(xfer != NULL); @@ -1249,7 +1249,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err { gchar* cookies; gchar* initial_buffer; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); /* cookies = yahoo_get_cookies(gc); * This doesn't seem to be working. The function is returning NULL, which yahoo servers don't like @@ -1505,7 +1505,7 @@ static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) } if( (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) || (xd->status_15 != P2P_HEAD_REPLIED) ) { - yd = xd->gc->proto_data; + yd = purple_connection_get_protocol_data(xd->gc); account = purple_connection_get_account(xd->gc); local_ip = purple_network_get_my_ip(listenfd); xd->yahoo_local_p2p_ft_server_port = purple_network_get_port_from_fd(listenfd); @@ -1566,7 +1566,7 @@ static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer return; account = purple_connection_get_account(gc); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); p2p_data = g_hash_table_lookup(yd->peers, purple_xfer_get_remote_user(xfer)); if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER ) @@ -1607,7 +1607,7 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) GSList *size_list = NULL; int nooffiles = 0; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -1786,7 +1786,7 @@ void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet * struct yahoo_packet *pkt_to_send; struct yahoo_p2p_data *p2p_data; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -1892,7 +1892,7 @@ void yahoo_process_filetrans_acc_15(PurpleConnection *gc, struct yahoo_packet *p gchar *url = NULL; int val_249 = 0; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; diff --git a/libpurple/protocols/yahoo/yahoo_friend.c b/libpurple/protocols/yahoo/yahoo_friend.c index 1acced0d8a..8c5e3a45ef 100644 --- a/libpurple/protocols/yahoo/yahoo_friend.c +++ b/libpurple/protocols/yahoo/yahoo_friend.c @@ -46,9 +46,10 @@ YahooFriend *yahoo_friend_find(PurpleConnection *gc, const char *name) const char *norm; g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(gc->proto_data != NULL, NULL); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); + g_return_val_if_fail(yd != NULL, NULL); + norm = purple_normalize(purple_connection_get_account(gc), name); return g_hash_table_lookup(yd->friends, norm); @@ -61,9 +62,10 @@ YahooFriend *yahoo_friend_find_or_new(PurpleConnection *gc, const char *name) const char *norm; g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(gc->proto_data != NULL, NULL); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); + g_return_val_if_fail(yd != NULL, NULL); + norm = purple_normalize(purple_connection_get_account(gc), name); f = g_hash_table_lookup(yd->friends, norm); @@ -225,7 +227,7 @@ void yahoo_process_presence(PurpleConnection *gc, struct yahoo_packet *pkt) void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, YahooPresenceVisibility presence) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt = NULL; YahooFriend *f; const char *thirtyone, *thirteen; diff --git a/libpurple/protocols/yahoo/yahoo_picture.c b/libpurple/protocols/yahoo/yahoo_picture.c index eefca0686f..7e3d9061b1 100644 --- a/libpurple/protocols/yahoo/yahoo_picture.c +++ b/libpurple/protocols/yahoo/yahoo_picture.c @@ -52,7 +52,7 @@ yahoo_fetch_picture_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, YahooData *yd; d = user_data; - yd = d->gc->proto_data; + yd = purple_connection_get_protocol_data(d->gc); yd->url_datas = g_slist_remove(yd->url_datas, url_data); if (error_message != NULL) { @@ -142,7 +142,7 @@ void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt) "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, yahoo_fetch_picture_cb, data); if (url_data != NULL) { - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); yd->url_datas = g_slist_prepend(yd->url_datas, url_data); } else { g_free(data->who); @@ -192,7 +192,7 @@ void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *p void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt) { PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GSList *l = pkt->hash; char *url = NULL; @@ -268,7 +268,7 @@ void yahoo_process_avatar_update(PurpleConnection *gc, struct yahoo_packet *pkt) void yahoo_send_picture_info(PurpleConnection *gc, const char *who) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; if (!yd->picture_url) { @@ -285,7 +285,7 @@ void yahoo_send_picture_info(PurpleConnection *gc, const char *who) void yahoo_send_picture_request(PurpleConnection *gc, const char *who) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -297,7 +297,7 @@ void yahoo_send_picture_request(PurpleConnection *gc, const char *who) void yahoo_send_picture_checksum(PurpleConnection *gc) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -308,7 +308,7 @@ void yahoo_send_picture_checksum(PurpleConnection *gc) void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -333,7 +333,7 @@ static void yahoo_send_picture_update_foreach(gpointer key, gpointer value, gpoi void yahoo_send_picture_update(PurpleConnection *gc, int type) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yspufe data; data.gc = gc; @@ -432,7 +432,7 @@ static void yahoo_buddy_icon_upload_connected(gpointer data, gint source, const gboolean use_whole_url = yahoo_account_use_http_proxy(gc); account = purple_connection_get_account(gc); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); /* Buddy icon connect is now complete; clear the PurpleProxyConnectData */ yd->buddy_icon_connect_data = NULL; @@ -497,7 +497,7 @@ static void yahoo_buddy_icon_upload_connected(gpointer data, gint source, const void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d) { PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (yd->buddy_icon_connect_data != NULL) { /* Cancel any in-progress buddy icon upload */ @@ -542,7 +542,7 @@ static int yahoo_buddy_icon_calculate_checksum(const guchar *data, gsize len) void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleAccount *account = gc->account; if (img == NULL) { diff --git a/libpurple/protocols/yahoo/yahoo_profile.c b/libpurple/protocols/yahoo/yahoo_profile.c index aa752f6885..58de6724f9 100644 --- a/libpurple/protocols/yahoo/yahoo_profile.c +++ b/libpurple/protocols/yahoo/yahoo_profile.c @@ -789,7 +789,7 @@ static void yahoo_got_info(PurpleUtilFetchUrlData *url_data, gpointer user_data, purple_debug_info("yahoo", "In yahoo_got_info\n"); - yd = info_data->gc->proto_data; + yd = purple_connection_get_protocol_data(info_data->gc); yd->url_datas = g_slist_remove(yd->url_datas, url_data); user_info = purple_notify_user_info_new(); @@ -983,7 +983,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, /* in to purple_markup_strip_html*/ char *fudged_buffer; - yd = info_data->gc->proto_data; + yd = purple_connection_get_protocol_data(info_data->gc); yd->url_datas = g_slist_remove(yd->url_datas, url_data); fudged_buffer = purple_strcasereplace(url_buffer, "", "
"); @@ -1262,7 +1262,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, void yahoo_get_info(PurpleConnection *gc, const char *name) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); YahooGetInfoData *data; char *url; PurpleUtilFetchUrlData *url_data; diff --git a/libpurple/protocols/yahoo/yahoochat.c b/libpurple/protocols/yahoo/yahoochat.c index e52f527d19..39043a628d 100644 --- a/libpurple/protocols/yahoo/yahoochat.c +++ b/libpurple/protocols/yahoo/yahoochat.c @@ -53,7 +53,7 @@ static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char /* special function to log us on to the yahoo chat service */ static void yahoo_chat_online(PurpleConnection *gc) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; const char *rll; @@ -101,7 +101,7 @@ static PurpleConversation *yahoo_find_conference(PurpleConnection *gc, const cha YahooData *yd; GSList *l; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); for (l = yd->confs; l; l = l->next) { PurpleConversation *c = l->data; @@ -372,7 +372,7 @@ void yahoo_process_conference_message(PurpleConnection *gc, struct yahoo_packet static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *room, const char *topic, const char *id) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; char *room2; gboolean utf8 = TRUE; @@ -400,7 +400,7 @@ static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *ro /* this is a confirmation of yahoo_chat_online(); */ void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt) { - YahooData *yd = (YahooData *) gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (pkt->status == 1) { yd->chat_online = TRUE; @@ -432,7 +432,7 @@ void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt) /* this is basicly the opposite of chat_online */ void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt) { - YahooData *yd = (YahooData *) gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GSList *l; for (l = pkt->hash; l; l = l->next) { @@ -462,7 +462,7 @@ void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt) void yahoo_process_chat_join(PurpleConnection *gc, struct yahoo_packet *pkt) { PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = (YahooData *) gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleConversation *c = NULL; GSList *l; GList *members = NULL; @@ -786,7 +786,7 @@ void yahoo_conf_leave(YahooData *yd, const char *room, const char *dn, GList *wh static int yahoo_conf_send(PurpleConnection *gc, const char *dn, const char *room, GList *members, const char *what) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; GList *who; char *msg, *msg2; @@ -843,7 +843,7 @@ static void yahoo_conf_join(YahooData *yd, PurpleConversation *c, const char *dn static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c, const char *dn, const char *buddy, const char *room, const char *msg) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; GList *members; char *msg2 = NULL; @@ -873,7 +873,7 @@ static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c, static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; char *eroom; @@ -924,7 +924,7 @@ static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *room, const char *what, PurpleMessageFlags flags) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; int me = 0; char *msg1, *msg2, *room2; @@ -969,7 +969,7 @@ static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *roo static void yahoo_chat_invite(PurpleConnection *gc, const char *dn, const char *buddy, const char *room, const char *msg) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; char *room2, *msg2 = NULL; gboolean utf8 = TRUE; @@ -997,7 +997,7 @@ void yahoo_chat_goto(PurpleConnection *gc, const char *name) YahooData *yd; struct yahoo_packet *pkt; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); if (yd->wm) { g_return_if_fail(yd->ycht != NULL); @@ -1029,7 +1029,7 @@ void yahoo_chat_goto(PurpleConnection *gc, const char *name) void yahoo_c_leave(PurpleConnection *gc, int id) { - YahooData *yd = (YahooData *) gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleConversation *c; if (!yd) @@ -1056,7 +1056,7 @@ int yahoo_c_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFl int ret; YahooData *yd; - yd = (YahooData *) gc->proto_data; + yd = purple_connection_get_protocol_data(gc); if (!yd) return -1; @@ -1114,7 +1114,7 @@ void yahoo_c_join(PurpleConnection *gc, GHashTable *data) char *room, *topic, *type; PurpleConversation *c; - yd = (YahooData *) gc->proto_data; + yd = purple_connection_get_protocol_data(gc); if (!yd) return; @@ -1478,7 +1478,7 @@ static void yahoo_roomlist_got_connected(gpointer data, gint source, const gchar PurpleRoomlist *list = yrl->list; PurpleAccount *account = purple_roomlist_get_account(list); PurpleConnection *pc = purple_account_get_connection(account); - YahooData *yd = pc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(pc); if (source < 0) { purple_notify_error(pc, NULL, _("Unable to connect"), _("Fetching the room list failed.")); diff --git a/libpurple/protocols/yahoo/ycht.c b/libpurple/protocols/yahoo/ycht.c index 4035397802..22f3142116 100644 --- a/libpurple/protocols/yahoo/ycht.c +++ b/libpurple/protocols/yahoo/ycht.c @@ -53,7 +53,7 @@ static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt) { PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (ycht->logged_in) return; @@ -68,7 +68,7 @@ static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt) static void ycht_process_logout(YchtConn *ycht, YchtPkt *pkt) { PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); yd->chat_online = FALSE; ycht->logged_in = FALSE; @@ -173,7 +173,7 @@ static void ycht_progress_online_friends(YchtConn *ycht, YchtPkt *pkt) { #if 0 PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (ycht->logged_in) return; @@ -429,7 +429,7 @@ static void ycht_packet_free(YchtPkt *pkt) void ycht_connection_close(YchtConn *ycht) { - YahooData *yd = ycht->gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(ycht->gc); if (yd) { yd->ycht = NULL; @@ -541,7 +541,7 @@ static void ycht_got_connected(gpointer data, gint source, const gchar *error_me { YchtConn *ycht = data; PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); YchtPkt *pkt; char *buf; @@ -568,7 +568,7 @@ static void ycht_got_connected(gpointer data, gint source, const gchar *error_me void ycht_connection_open(PurpleConnection *gc) { YchtConn *ycht; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); ycht = g_new0(YchtConn, 1); -- cgit v1.2.1 From 39fa380d628d1568e1ab5cb796eef1b7a1d4ada7 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 20:21:33 +0000 Subject: Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data(). --- libpurple/protocols/silc/buddy.c | 28 +++++++-------- libpurple/protocols/silc/chat.c | 40 +++++++++++----------- libpurple/protocols/silc/ft.c | 4 +-- libpurple/protocols/silc/ops.c | 16 ++++----- libpurple/protocols/silc/pk.c | 2 +- libpurple/protocols/silc/silc.c | 74 ++++++++++++++++++++-------------------- libpurple/protocols/silc/wb.c | 28 +++++++-------- 7 files changed, 96 insertions(+), 96 deletions(-) diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c index 0e7a29b752..61a39e0e92 100644 --- a/libpurple/protocols/silc/buddy.c +++ b/libpurple/protocols/silc/buddy.c @@ -72,7 +72,7 @@ silcpurple_buddy_keyagr_cb(SilcClient client, void *context) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); if (!sg->conn) return; @@ -146,7 +146,7 @@ static void silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, gboolean force_local) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcDList clients; SilcClientEntry client_entry; SilcClientConnectionParams params; @@ -346,7 +346,7 @@ silcpurple_buddy_resetkey(PurpleBlistNode *node, gpointer data) b = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); /* Find client entry */ clients = silc_client_get_clients_local(sg->client, sg->conn, @@ -426,7 +426,7 @@ silcpurple_buddy_privkey_resolved(SilcClient client, static void silcpurple_buddy_privkey(PurpleConnection *gc, const char *name) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurplePrivkey p; SilcDList clients; SilcClientEntry client_entry; @@ -554,7 +554,7 @@ silcpurple_buddy_getkey_resolved(SilcClient client, static void silcpurple_buddy_getkey(PurpleConnection *gc, const char *name) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientEntry client_entry; @@ -618,7 +618,7 @@ silcpurple_buddy_showkey(PurpleBlistNode *node, gpointer data) b = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); pkfile = purple_blist_node_get_string(node, "public-key"); if (!silc_pkcs_load_public_key(pkfile, &public_key)) { @@ -669,7 +669,7 @@ silcpurple_add_buddy_resolved(SilcClient client, void silcpurple_get_info(PurpleConnection *gc, const char *who) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientEntry client_entry; @@ -1338,7 +1338,7 @@ silcpurple_add_buddy_resolved(SilcClient client, static void silcpurple_add_buddy_i(PurpleConnection *gc, PurpleBuddy *b, gboolean init) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcPurpleBuddyRes r; @@ -1437,7 +1437,7 @@ void silcpurple_idle_set(PurpleConnection *gc, int idle) const char *server; int port; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return; @@ -1467,7 +1467,7 @@ char *silcpurple_status_text(PurpleBuddy *b) { PurpleAccount *account = purple_buddy_get_account(b); PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientID *client_id = purple_buddy_get_protocol_data(b); @@ -1533,7 +1533,7 @@ void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gb { PurpleAccount *account = purple_buddy_get_account(b); PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientID *client_id = purple_buddy_get_protocol_data(b); @@ -1629,7 +1629,7 @@ silcpurple_buddy_kill(PurpleBlistNode *node, gpointer data) b = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); /* Call KILL */ silc_client_command_call(sg->client, sg->conn, NULL, "KILL", @@ -1653,7 +1653,7 @@ GList *silcpurple_buddy_menu(PurpleBuddy *buddy) { PurpleAccount *account = purple_buddy_get_account(buddy); PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClientConnection conn = sg->conn; const char *pkfile = NULL; SilcClientEntry client_entry = NULL; @@ -1719,7 +1719,7 @@ GList *silcpurple_buddy_menu(PurpleBuddy *buddy) void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcMime mime; diff --git a/libpurple/protocols/silc/chat.c b/libpurple/protocols/silc/chat.c index 39c6033f4b..fe7be1ab8b 100644 --- a/libpurple/protocols/silc/chat.c +++ b/libpurple/protocols/silc/chat.c @@ -91,7 +91,7 @@ silcpurple_chat_getinfo_res(SilcClient client, static void silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); const char *chname; char tmp[256], *tmp2; GString *s; @@ -500,7 +500,7 @@ silcpurple_chat_chauth(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -587,7 +587,7 @@ silcpurple_chat_prv(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); p = silc_calloc(1, sizeof(*p)); if (!p) @@ -637,7 +637,7 @@ silcpurple_chat_permanent_reset(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -656,7 +656,7 @@ silcpurple_chat_permanent(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg->conn) return; @@ -733,7 +733,7 @@ silcpurple_chat_ulimit(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg->conn) return; @@ -768,7 +768,7 @@ silcpurple_chat_resettopic(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -786,7 +786,7 @@ silcpurple_chat_settopic(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -804,7 +804,7 @@ silcpurple_chat_resetprivate(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -822,7 +822,7 @@ silcpurple_chat_setprivate(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -840,7 +840,7 @@ silcpurple_chat_resetsecret(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -858,7 +858,7 @@ silcpurple_chat_setsecret(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -882,7 +882,7 @@ GList *silcpurple_chat_menu(PurpleChat *chat) { GHashTable *components = purple_chat_get_components(chat); PurpleConnection *gc = purple_account_get_connection(purple_chat_get_account(chat)); - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClientConnection conn = sg->conn; const char *chname = NULL; SilcChannelEntry channel = NULL; @@ -1020,7 +1020,7 @@ char *silcpurple_get_chat_name(GHashTable *data) void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; const char *channel, *passphrase, *parentch; @@ -1103,7 +1103,7 @@ void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *name) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcHashTableList htl; @@ -1148,7 +1148,7 @@ void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, void silcpurple_chat_leave(PurpleConnection *gc, int id) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcHashTableList htl; @@ -1218,7 +1218,7 @@ void silcpurple_chat_leave(PurpleConnection *gc, int id) int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags msgflags) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcHashTableList htl; @@ -1340,7 +1340,7 @@ int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcHashTableList htl; @@ -1384,7 +1384,7 @@ void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; GList *fields = NULL; @@ -1425,7 +1425,7 @@ void silcpurple_roomlist_cancel(PurpleRoomlist *list) if (!gc) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); purple_roomlist_set_in_progress(list, FALSE); if (sg->roomlist == list) { diff --git a/libpurple/protocols/silc/ft.c b/libpurple/protocols/silc/ft.c index 09992ef124..e7dc831d9c 100644 --- a/libpurple/protocols/silc/ft.c +++ b/libpurple/protocols/silc/ft.c @@ -309,7 +309,7 @@ void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, const char *hostname, SilcUInt16 port) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleXfer xfer; xfer = silc_calloc(1, sizeof(*xfer)); @@ -434,7 +434,7 @@ silcpurple_ftp_send_file_resolved(SilcClient client, PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcDList clients; diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c index 7a102d7fb7..d94242f7b8 100644 --- a/libpurple/protocols/silc/ops.c +++ b/libpurple/protocols/silc/ops.c @@ -88,7 +88,7 @@ silcpurple_mime_message(SilcClient client, SilcClientConnection conn, gboolean recursive) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); const char *type; const unsigned char *data; SilcUInt32 data_len; @@ -264,7 +264,7 @@ silc_channel_message(SilcClient client, SilcClientConnection conn, SilcUInt32 message_len) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleConversation *convo = NULL; char *msg, *tmp; @@ -354,7 +354,7 @@ silc_private_message(SilcClient client, SilcClientConnection conn, SilcUInt32 message_len) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleConversation *convo = NULL; char *msg, *tmp; @@ -431,7 +431,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, { va_list va; PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); PurpleConversation *convo; SilcClientEntry client_entry, client_entry2; @@ -941,7 +941,7 @@ silc_command(SilcClient client, SilcClientConnection conn, SilcUInt32 argc, unsigned char **argv) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); switch (command) { @@ -1078,7 +1078,7 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, SilcStatus error, va_list ap) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleConversation *convo; switch (command) { @@ -1724,7 +1724,7 @@ silc_get_auth_method(SilcClient client, SilcClientConnection conn, SilcGetAuthMeth completion, void *context) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleAskPassphrase internal; const char *password; @@ -1775,7 +1775,7 @@ silc_verify_public_key(SilcClient client, SilcClientConnection conn, SilcVerifyPublicKey completion, void *context) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); if (!sg->conn && (conn_type == SILC_CONN_SERVER || conn_type == SILC_CONN_ROUTER)) { diff --git a/libpurple/protocols/silc/pk.c b/libpurple/protocols/silc/pk.c index 6d25db910d..66d2c9fb55 100644 --- a/libpurple/protocols/silc/pk.c +++ b/libpurple/protocols/silc/pk.c @@ -79,7 +79,7 @@ static void silcpurple_verify_details_cb(PublicKeyVerify verify) static void silcpurple_verify_details(PublicKeyVerify verify, gint id) { PurpleConnection *gc = verify->client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); silcpurple_show_public_key(sg, verify->entity_name, verify->public_key, G_CALLBACK(silcpurple_verify_details_cb), diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index 525b24dbf8..b300a8b170 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -78,7 +78,7 @@ silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) const char *state; if (gc != NULL) - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (status == NULL) return; @@ -125,7 +125,7 @@ silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) static void silcpurple_keepalive(PurpleConnection *gc) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); silc_packet_send(sg->conn->stream, SILC_PACKET_HEARTBEAT, 0, NULL, 0); } @@ -180,7 +180,7 @@ silcpurple_scheduler(SilcSchedule schedule, { SilcClient client = (SilcClient)context; PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleTask ptask = NULL; if (added) { @@ -252,7 +252,7 @@ silcpurple_connect_cb(SilcClient client, SilcClientConnection conn, struct utsname u; #endif - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); switch (status) { case SILC_CLIENT_CONN_SUCCESS: @@ -367,7 +367,7 @@ silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream, SilcClientConnectionParams params; const char *dfile; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (status != SILC_SOCKET_OK) { purple_connection_error(gc, @@ -376,7 +376,7 @@ silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream, silc_pkcs_public_key_free(sg->public_key); silc_pkcs_private_key_free(sg->private_key); silc_free(sg); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); return; } @@ -415,7 +415,7 @@ silcpurple_login_connected(gpointer data, gint source, const gchar *error_messag g_return_if_fail(gc != NULL); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (source < 0) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, @@ -423,7 +423,7 @@ silcpurple_login_connected(gpointer data, gint source, const gchar *error_messag silc_pkcs_public_key_free(sg->public_key); silc_pkcs_private_key_free(sg->private_key); silc_free(sg); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); return; } @@ -449,7 +449,7 @@ static void silcpurple_continue_running(SilcPurple sg) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -457,7 +457,7 @@ static void silcpurple_continue_running(SilcPurple sg) static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) { - SilcPurple sg = (SilcPurple)gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); char pkd[256], prd[256]; const char *password; @@ -473,7 +473,7 @@ static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields if (!password || !*password) { purple_notify_error(gc, NULL, _("Password is required to sign on."), NULL); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -492,7 +492,7 @@ static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields &sg->public_key, &sg->private_key)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -505,10 +505,10 @@ static void silcpurple_no_password_cb(PurpleConnection *gc, PurpleRequestFields /* The password prompt dialog doesn't get disposed if the account disconnects */ if (!PURPLE_CONNECTION_IS_VALID(gc)) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); } @@ -537,7 +537,7 @@ static void silcpurple_running(SilcClient client, void *context) } purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -558,7 +558,7 @@ silcpurple_login(PurpleAccount *account) gc = account->gc; if (!gc) return; - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); memset(¶ms, 0, sizeof(params)); strcat(params.nickname_format, "%n#a"); @@ -612,14 +612,14 @@ silcpurple_login(PurpleAccount *account) sg->client = client; sg->gc = gc; sg->account = account; - gc->proto_data = sg; + purple_connection_set_protocol_data(gc, sg); /* Init SILC client */ if (!silc_client_init(client, username, hostname, realname, silcpurple_running, sg)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to initialize SILC protocol")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); silc_free(hostname); g_free(username); @@ -632,7 +632,7 @@ silcpurple_login(PurpleAccount *account) if (!silcpurple_check_silc_dir(gc)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Error loading SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -669,7 +669,7 @@ silcpurple_close_final(gpointer *context) static void silcpurple_close(PurpleConnection *gc) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) SilcPurpleTask task; #endif /* __SILC_TOOLKIT_VERSION */ @@ -733,7 +733,7 @@ silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields) static void silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; PurpleRequestField *f; @@ -744,7 +744,7 @@ silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) SilcVCardStruct vcard; const char *val; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -905,7 +905,7 @@ static void silcpurple_attrs(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; PurpleRequestFields *fields; @@ -922,7 +922,7 @@ silcpurple_attrs(PurplePluginAction *action) gboolean device = TRUE; char status[1024], tz[16]; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1072,7 +1072,7 @@ silcpurple_detach(PurplePluginAction *action) if (!gc) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1090,7 +1090,7 @@ silcpurple_view_motd(PurplePluginAction *action) if (!gc) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1125,7 +1125,7 @@ silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields) int keylen = SILCPURPLE_DEF_PKCS_LEN; SilcPublicKey public_key; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1208,7 +1208,7 @@ static void silcpurple_create_keypair(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleRequestFields *fields; PurpleRequestFieldGroup *g; PurpleRequestField *f; @@ -1356,7 +1356,7 @@ silcpurple_send_im_resolved(SilcClient client, void *context) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleIM im = context; PurpleConversation *convo; char tmp[256]; @@ -1433,7 +1433,7 @@ static int silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, PurpleMessageFlags flags) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcDList clients; @@ -1718,7 +1718,7 @@ static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv, if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1747,7 +1747,7 @@ static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv, if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1769,10 +1769,10 @@ static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv, gc = purple_conversation_get_gc(conv); - if (gc == NULL || !args || gc->proto_data == NULL) + if (gc == NULL || !args || purple_connection_get_protocol_data(gc) == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (args[0]) chname = args[0]; @@ -1823,7 +1823,7 @@ static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv, if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1855,7 +1855,7 @@ static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1892,7 +1892,7 @@ static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; diff --git a/libpurple/protocols/silc/wb.c b/libpurple/protocols/silc/wb.c index 984925e823..ba5cd81098 100644 --- a/libpurple/protocols/silc/wb.c +++ b/libpurple/protocols/silc/wb.c @@ -105,7 +105,7 @@ typedef struct { PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry) { - SilcClientConnection conn; + SilcClientConnection conn; PurpleWhiteboard *wb; SilcPurpleWb wbs; @@ -238,8 +238,8 @@ silcpurple_wb_request_cb(SilcPurpleWbRequest req, gint id) { PurpleWhiteboard *wb; - if (id != 1) - goto out; + if (id != 1) + goto out; if (!req->channel) wb = silcpurple_wb_init(req->sg, req->sender); @@ -264,7 +264,7 @@ silcpurple_wb_request(SilcClient client, const unsigned char *message, SilcPurple sg; gc = client->application; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); /* Open whiteboard automatically if requested */ if (purple_account_get_bool(sg->account, "open-wb", FALSE)) { @@ -318,12 +318,12 @@ void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, SilcUInt32 message_len) { SilcPurple sg; - PurpleConnection *gc; + PurpleConnection *gc; PurpleWhiteboard *wb; SilcPurpleWb wbs; gc = client->application; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); wb = purple_whiteboard_get_session(sg->account, sender->nickname); if (!wb) { @@ -347,12 +347,12 @@ void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, SilcUInt32 message_len) { SilcPurple sg; - PurpleConnection *gc; + PurpleConnection *gc; PurpleWhiteboard *wb; SilcPurpleWb wbs; gc = client->application; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); wb = purple_whiteboard_get_session(sg->account, channel->channel_name); if (!wb) { @@ -374,13 +374,13 @@ void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list) SilcBuffer packet; GList *list; int len; - PurpleConnection *gc; - SilcPurple sg; + PurpleConnection *gc; + SilcPurple sg; g_return_if_fail(draw_list); gc = purple_account_get_connection(wb->account); g_return_if_fail(gc); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); g_return_if_fail(sg); len = SILCPURPLE_WB_HEADER; @@ -480,12 +480,12 @@ void silcpurple_wb_clear(PurpleWhiteboard *wb) SilcPurpleWb wbs = wb->proto_data; SilcBuffer packet; int len; - PurpleConnection *gc; - SilcPurple sg; + PurpleConnection *gc; + SilcPurple sg; gc = purple_account_get_connection(wb->account); g_return_if_fail(gc); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); g_return_if_fail(sg); len = SILCPURPLE_WB_HEADER; -- cgit v1.2.1 From e78f439fdb632887c79c2413f93d1e008af89843 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 20:43:52 +0000 Subject: Added protocol_data and ui_data accessor functions for Whiteboard. --- ChangeLog.API | 4 ++++ libpurple/ft.h | 2 +- libpurple/whiteboard.c | 27 +++++++++++++++++++++++++++ libpurple/whiteboard.h | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/ChangeLog.API b/ChangeLog.API index d722a99def..f27493cc8d 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -20,6 +20,10 @@ version 3.0.0 (??/??/????): * purple_roomlist_room_set_expanded_once * purple_roomlist_set_proto_data * purple_roomlist_set_ui_data + * purple_whiteboard_get_protocol_data + * purple_whiteboard_set_protocol_data + * purple_whiteboard_get_ui_data + * purple_whiteboard_set_ui_data * purple_xfer_get_protocol_data * purple_xfer_get_ui_data * purple_xfer_set_protocol_data diff --git a/libpurple/ft.h b/libpurple/ft.h index 3fb2c4818d..59c51edafb 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -741,7 +741,7 @@ void purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats); * Sets the protocol data for a file transfer. * * @param xfer The file transfer. - * @param protol_data The protocol data to set for the file transfer. + * @param protocol_data The protocol data to set for the file transfer. * * @since 3.0.0 */ diff --git a/libpurple/whiteboard.c b/libpurple/whiteboard.c index 3ac4c4e010..6edbb1ff0d 100644 --- a/libpurple/whiteboard.c +++ b/libpurple/whiteboard.c @@ -206,3 +206,30 @@ void purple_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color) whiteboard_ui_ops->set_brush(wb, size, color); } +void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data) +{ + g_return_if_fail(wb != NULL); + + wb->proto_data = proto_data; +} + +gpointer purple_whiteboard_get_protocol_data(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, NULL); + + return wb->proto_data; +} + +void purple_whiteboard_set_ui_data(PurpleWhiteboard *wb, gpointer ui_data) +{ + g_return_if_fail(wb != NULL); + + wb->ui_data = ui_data; +} + +gpointer purple_whiteboard_get_ui_data(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, NULL); + + return wb->ui_data; +} diff --git a/libpurple/whiteboard.h b/libpurple/whiteboard.h index 7d5700dee9..a29f4f1ba1 100644 --- a/libpurple/whiteboard.h +++ b/libpurple/whiteboard.h @@ -253,6 +253,42 @@ gboolean purple_whiteboard_get_brush(const PurpleWhiteboard *wb, int *size, int */ void purple_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color); +/** + * Sets the protocol data for a whiteboard. + * + * @param wb The whiteboard. + * @param protocol_data The protocol data to set for the whiteboard. + */ +void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data); + +/** + * Gets the protocol data for a whiteboard. + * + * @param wb The whiteboard. + * + * @return The protocol data for the whiteboard. + */ +gpointer purple_whiteboard_get_protocol_data(const PurpleWhiteboard *wb); + +/** + * Set the UI data associated with this whiteboard. + * + * @param wb The whiteboard. + * @param ui_data A pointer to associate with this whiteboard. + */ +void purple_whiteboard_set_ui_data(PurpleWhiteboard *wb, gpointer ui_data); + +/** + * Get the UI data associated with this whiteboard. + * + * @param wb The whiteboard.. + * + * @return The UI data associated with this whiteboard. This is a + * convenience field provided to the UIs--it is not + * used by the libpurple core. + */ +gpointer purple_whiteboard_get_ui_data(const PurpleWhiteboard *wb); + /*@}*/ #ifdef __cplusplus -- cgit v1.2.1 From 08566f10651b2ee07a5498595f4145229652d1f3 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 20:55:12 +0000 Subject: Update silc prpl to use purple_whiteboard_get_protocol_data() and purple_whiteboard_set_protocol_data(). --- libpurple/protocols/silc/wb.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/libpurple/protocols/silc/wb.c b/libpurple/protocols/silc/wb.c index ba5cd81098..1c8d822102 100644 --- a/libpurple/protocols/silc/wb.c +++ b/libpurple/protocols/silc/wb.c @@ -116,7 +116,7 @@ PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry if (!wb) return NULL; - if (!wb->proto_data) { + if (!purple_whiteboard_get_protocol_data(wb)) { wbs = silc_calloc(1, sizeof(*wbs)); if (!wbs) return NULL; @@ -126,7 +126,7 @@ PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry wbs->height = SILCPURPLE_WB_HEIGHT; wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; + purple_whiteboard_set_protocol_data(wb, wbs); /* Start the whiteboard */ purple_whiteboard_start(wb); @@ -147,7 +147,7 @@ PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) if (!wb) return NULL; - if (!wb->proto_data) { + if (!purple_whiteboard_get_protocol_data(wb)) { wbs = silc_calloc(1, sizeof(*wbs)); if (!wbs) return NULL; @@ -157,7 +157,7 @@ PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) wbs->height = SILCPURPLE_WB_HEIGHT; wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; + purple_whiteboard_set_protocol_data(wb, wbs); /* Start the whiteboard */ purple_whiteboard_start(wb); @@ -168,9 +168,10 @@ PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) } static void -silcpurple_wb_parse(SilcPurpleWb wbs, PurpleWhiteboard *wb, +silcpurple_wb_parse(PurpleWhiteboard *wb, unsigned char *message, SilcUInt32 message_len) { + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); SilcUInt8 command; SilcUInt16 width, height, brush_size; SilcUInt32 brush_color, x, y, dx, dy; @@ -246,7 +247,7 @@ silcpurple_wb_request_cb(SilcPurpleWbRequest req, gint id) else wb = silcpurple_wb_init_ch(req->sg, req->channel); - silcpurple_wb_parse(wb->proto_data, wb, req->message, req->message_len); + silcpurple_wb_parse(wb, req->message, req->message_len); out: silc_free(req->message); @@ -275,7 +276,7 @@ silcpurple_wb_request(SilcClient client, const unsigned char *message, else wb = silcpurple_wb_init_ch(sg, channel); - silcpurple_wb_parse(wb->proto_data, wb, + silcpurple_wb_parse(wb, (unsigned char *)message, message_len); return; @@ -320,7 +321,6 @@ void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, SilcPurple sg; PurpleConnection *gc; PurpleWhiteboard *wb; - SilcPurpleWb wbs; gc = client->application; sg = purple_connection_get_protocol_data(gc); @@ -333,8 +333,7 @@ void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, return; } - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); + silcpurple_wb_parse(wb, (unsigned char *)message, message_len); } /* Process incoming whiteboard message on channel */ @@ -349,7 +348,6 @@ void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, SilcPurple sg; PurpleConnection *gc; PurpleWhiteboard *wb; - SilcPurpleWb wbs; gc = client->application; sg = purple_connection_get_protocol_data(gc); @@ -362,15 +360,14 @@ void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, return; } - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); + silcpurple_wb_parse(wb, (unsigned char *)message, message_len); } /* Send whiteboard message */ void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); SilcBuffer packet; GList *list; int len; @@ -435,20 +432,22 @@ void silcpurple_wb_start(PurpleWhiteboard *wb) void silcpurple_wb_end(PurpleWhiteboard *wb) { - silc_free(wb->proto_data); - wb->proto_data = NULL; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); + + silc_free(wbs); + purple_whiteboard_set_protocol_data(wb, NULL); } void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); *width = wbs->width; *height = wbs->height; } void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); wbs->width = width > SILCPURPLE_WB_WIDTH_MAX ? SILCPURPLE_WB_WIDTH_MAX : width; wbs->height = height > SILCPURPLE_WB_HEIGHT_MAX ? SILCPURPLE_WB_HEIGHT_MAX : @@ -460,14 +459,14 @@ void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height) void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); *size = wbs->brush_size; *color = wbs->brush_color; } void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); wbs->brush_size = size; wbs->brush_color = color; @@ -477,7 +476,7 @@ void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color) void silcpurple_wb_clear(PurpleWhiteboard *wb) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); SilcBuffer packet; int len; PurpleConnection *gc; -- cgit v1.2.1 From 6ae4f4e52347ca02782a5e5fcc036f177b8fb755 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 21:00:29 +0000 Subject: Update yahoo prpl to use purple_whiteboard_get_protocol_data() and purple_whiteboard_set_protocol_data(). --- libpurple/protocols/yahoo/libymsg.c | 2 +- libpurple/protocols/yahoo/yahoo_doodle.c | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 474e0f2768..740dd2a097 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -1061,7 +1061,7 @@ static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt doodle_session *ds; wb = purple_whiteboard_create(account, im->from, DOODLE_STATE_REQUESTED); - ds = wb->proto_data; + ds = purple_whiteboard_get_protocol_data(wb); ds->imv_key = g_strdup(pair->value); yahoo_doodle_command_send_request(gc, im->from, pair->value); diff --git a/libpurple/protocols/yahoo/yahoo_doodle.c b/libpurple/protocols/yahoo/yahoo_doodle.c index 3e8e34ccdf..dab58b2644 100644 --- a/libpurple/protocols/yahoo/yahoo_doodle.c +++ b/libpurple/protocols/yahoo/yahoo_doodle.c @@ -161,7 +161,7 @@ static void yahoo_doodle_command_got_request(PurpleConnection *gc, const char *f */ wb = purple_whiteboard_create(account, from, DOODLE_STATE_REQUESTED); - ds = wb->proto_data; + ds = purple_whiteboard_get_protocol_data(wb); ds->imv_key = g_strdup(imv_key); yahoo_doodle_command_send_ready(gc, from, imv_key); @@ -191,7 +191,7 @@ static void yahoo_doodle_command_got_ready(PurpleConnection *gc, const char *fro if(wb->state == DOODLE_STATE_REQUESTING) { - doodle_session *ds = wb->proto_data; + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); purple_whiteboard_start(wb); wb->state = DOODLE_STATE_ESTABLISHED; @@ -450,13 +450,13 @@ void yahoo_doodle_start(PurpleWhiteboard *wb) ds->brush_size = DOODLE_BRUSH_SMALL; ds->brush_color = DOODLE_COLOR_RED; - wb->proto_data = ds; + purple_whiteboard_set_protocol_data(wb, ds); } void yahoo_doodle_end(PurpleWhiteboard *wb) { PurpleConnection *gc = purple_account_get_connection(wb->account); - doodle_session *ds = wb->proto_data; + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); /* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */ @@ -464,7 +464,8 @@ void yahoo_doodle_end(PurpleWhiteboard *wb) yahoo_doodle_command_send_shutdown(gc, wb->who); g_free(ds->imv_key); - g_free(wb->proto_data); + g_free(ds); + purple_whiteboard_set_protocol_data(wb, NULL); } void yahoo_doodle_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) @@ -494,7 +495,7 @@ static char *yahoo_doodle_build_draw_string(doodle_session *ds, GList *draw_list void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list) { - doodle_session *ds = wb->proto_data; + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); char *message; g_return_if_fail(draw_list != NULL); @@ -506,7 +507,7 @@ void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list) void yahoo_doodle_clear(PurpleWhiteboard *wb) { - doodle_session *ds = wb->proto_data; + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); yahoo_doodle_command_send_clear(wb->account->gc, wb->who, ds->imv_key); } @@ -560,14 +561,14 @@ void yahoo_doodle_draw_stroke(PurpleWhiteboard *wb, GList *draw_list) void yahoo_doodle_get_brush(const PurpleWhiteboard *wb, int *size, int *color) { - doodle_session *ds = wb->proto_data; + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); *size = ds->brush_size; *color = ds->brush_color; } void yahoo_doodle_set_brush(PurpleWhiteboard *wb, int size, int color) { - doodle_session *ds = wb->proto_data; + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); ds->brush_size = size; ds->brush_color = color; -- cgit v1.2.1 From e4a04f52a8040da4d6419b348a2f23905511424a Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 22:02:29 +0000 Subject: Add additional accessor functions for Whiteboard. --- libpurple/whiteboard.c | 42 ++++++++++++++++++++++++++++++++++++++++ libpurple/whiteboard.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/libpurple/whiteboard.c b/libpurple/whiteboard.c index 6edbb1ff0d..995e376a56 100644 --- a/libpurple/whiteboard.c +++ b/libpurple/whiteboard.c @@ -90,6 +90,34 @@ void purple_whiteboard_destroy(PurpleWhiteboard *wb) g_free(wb); } +PurpleAccount *purple_whiteboard_get_account(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, NULL); + + return wb->account; +} + +const char *purple_whiteboard_get_who(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, NULL); + + return wb->who; +} + +void purple_whiteboard_set_state(PurpleWhiteboard *wb, int state) +{ + g_return_if_fail(wb != NULL); + + wb->state = state; +} + +int purple_whiteboard_get_state(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, -1); + + return wb->state; +} + void purple_whiteboard_start(PurpleWhiteboard *wb) { /* Create frontend for whiteboard */ @@ -206,6 +234,20 @@ void purple_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color) whiteboard_ui_ops->set_brush(wb, size, color); } +GList *purple_whiteboard_get_draw_list(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, NULL); + + return wb->draw_list; +} + +void purple_whiteboard_set_draw_list(PurpleWhiteboard *wb, GList* draw_list) +{ + g_return_if_fail(wb != NULL); + + wb->draw_list = draw_list; +} + void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data) { g_return_if_fail(wb != NULL); diff --git a/libpurple/whiteboard.h b/libpurple/whiteboard.h index a29f4f1ba1..41a6459c09 100644 --- a/libpurple/whiteboard.h +++ b/libpurple/whiteboard.h @@ -134,6 +134,41 @@ PurpleWhiteboard *purple_whiteboard_create(PurpleAccount *account, const char *w */ void purple_whiteboard_destroy(PurpleWhiteboard *wb); +/** + * Returns the whiteboard's account. + * + * @param wb The whiteboard. + * + * @return The whiteboard's account. + */ +PurpleAccount *purple_whiteboard_get_account(const PurpleWhiteboard *wb); + +/** + * Return who you're drawing with. + * + * @param wb The whiteboard + * + * @return Who you're drawing with. + */ +const char *purple_whiteboard_get_who(const PurpleWhiteboard *wb); + +/** + * Set the state of the whiteboard. + * + * @param wb The whiteboard. + * @param state The state + */ +void purple_whiteboard_set_state(PurpleWhiteboard *wb, int state); + +/** + * Return the state of the whiteboard. + * + * @param wb The whiteboard. + * + * @return The state of the whiteboard. + */ +int purple_whiteboard_get_state(const PurpleWhiteboard *wb); + /** * Starts a whiteboard * @@ -253,6 +288,23 @@ gboolean purple_whiteboard_get_brush(const PurpleWhiteboard *wb, int *size, int */ void purple_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color); +/** + * Return the drawing list. + * + * @param wb The whiteboard. + * + * @return The drawing list + */ +GList *purple_whiteboard_get_draw_list(const PurpleWhiteboard *wb); + +/** + * Set the drawing list. + * + * @param wb The whiteboard + * @param draw_list The drawing list. + */ +void purple_whiteboard_set_draw_list(PurpleWhiteboard *wb, GList* draw_list); + /** * Sets the protocol data for a whiteboard. * -- cgit v1.2.1 From 525ad27a1a72791643f3dbef41b2d3ed3ed4ebc6 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 30 Aug 2011 22:07:19 +0000 Subject: Use the new accessor functions of PidginWhiteboard. --- ChangeLog.API | 6 ++++++ libpurple/protocols/silc/wb.c | 4 ++-- libpurple/protocols/yahoo/yahoo_doodle.c | 36 +++++++++++++++++++------------- pidgin/gtkwhiteboard.c | 32 ++++++++++++++-------------- 4 files changed, 45 insertions(+), 33 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index f27493cc8d..497404b453 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -20,10 +20,16 @@ version 3.0.0 (??/??/????): * purple_roomlist_room_set_expanded_once * purple_roomlist_set_proto_data * purple_roomlist_set_ui_data + * purple_whiteboard_get_account + * purple_whiteboard_get_draw_list + * purple_whiteboard_set_draw_list * purple_whiteboard_get_protocol_data * purple_whiteboard_set_protocol_data + * purple_whiteboard_get_state + * purple_whiteboard_set_state * purple_whiteboard_get_ui_data * purple_whiteboard_set_ui_data + * purple_whiteboard_get_who * purple_xfer_get_protocol_data * purple_xfer_get_ui_data * purple_xfer_set_protocol_data diff --git a/libpurple/protocols/silc/wb.c b/libpurple/protocols/silc/wb.c index 1c8d822102..3036a7404f 100644 --- a/libpurple/protocols/silc/wb.c +++ b/libpurple/protocols/silc/wb.c @@ -375,7 +375,7 @@ void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list) SilcPurple sg; g_return_if_fail(draw_list); - gc = purple_account_get_connection(wb->account); + gc = purple_account_get_connection(purple_whiteboard_get_account(wb)); g_return_if_fail(gc); sg = purple_connection_get_protocol_data(gc); g_return_if_fail(sg); @@ -482,7 +482,7 @@ void silcpurple_wb_clear(PurpleWhiteboard *wb) PurpleConnection *gc; SilcPurple sg; - gc = purple_account_get_connection(wb->account); + gc = purple_account_get_connection(purple_whiteboard_get_account(wb)); g_return_if_fail(gc); sg = purple_connection_get_protocol_data(gc); g_return_if_fail(sg); diff --git a/libpurple/protocols/yahoo/yahoo_doodle.c b/libpurple/protocols/yahoo/yahoo_doodle.c index dab58b2644..dc8e9dff39 100644 --- a/libpurple/protocols/yahoo/yahoo_doodle.c +++ b/libpurple/protocols/yahoo/yahoo_doodle.c @@ -189,19 +189,19 @@ static void yahoo_doodle_command_got_ready(PurpleConnection *gc, const char *fro if(wb == NULL) return; - if(wb->state == DOODLE_STATE_REQUESTING) + if(purple_whiteboard_get_state(wb) == DOODLE_STATE_REQUESTING) { doodle_session *ds = purple_whiteboard_get_protocol_data(wb); purple_whiteboard_start(wb); - wb->state = DOODLE_STATE_ESTABLISHED; + purple_whiteboard_set_state(wb, DOODLE_STATE_ESTABLISHED); yahoo_doodle_command_send_confirm(gc, from, imv_key); /* Let's steal the imv_key and reuse it */ g_free(ds->imv_key); ds->imv_key = g_strdup(imv_key); } - else if(wb->state == DOODLE_STATE_ESTABLISHED) + else if(purple_whiteboard_get_state(wb) == DOODLE_STATE_ESTABLISHED) { /* TODO Ask whether to save picture too */ purple_whiteboard_clear(wb); @@ -211,7 +211,7 @@ static void yahoo_doodle_command_got_ready(PurpleConnection *gc, const char *fro * already thinks we're in a session with them (when their chat message * contains the doodle imv key) */ - else if(wb->state == DOODLE_STATE_REQUESTED) + else if(purple_whiteboard_get_state(wb) == DOODLE_STATE_REQUESTED) { /* purple_whiteboard_start(wb); */ yahoo_doodle_command_send_ready(gc, from, imv_key); @@ -292,7 +292,7 @@ static void yahoo_doodle_command_got_clear(PurpleConnection *gc, const char *fro if(wb == NULL) return; - if(wb->state == DOODLE_STATE_ESTABLISHED) + if(purple_whiteboard_get_state(wb) == DOODLE_STATE_ESTABLISHED) { /* TODO Ask user whether to save the image before clearing it */ @@ -333,9 +333,9 @@ static void yahoo_doodle_command_got_confirm(PurpleConnection *gc, const char *f /* TODO Combine the following IF's? */ /* Check if we requested a doodle session */ - /*if(wb->state == DOODLE_STATE_REQUESTING) + /*if(purple_whiteboard_get_state(wb) == DOODLE_STATE_REQUESTING) { - wb->state = DOODLE_STATE_ESTABLISHED; + purple_whiteboard_set_state(wb, DOODLE_STATE_ESTABLISHED); purple_whiteboard_start(wb); @@ -343,9 +343,9 @@ static void yahoo_doodle_command_got_confirm(PurpleConnection *gc, const char *f }*/ /* Check if we accepted a request for a doodle session */ - if(wb->state == DOODLE_STATE_REQUESTED) + if(purple_whiteboard_get_state(wb) == DOODLE_STATE_REQUESTED) { - wb->state = DOODLE_STATE_ESTABLISHED; + purple_whiteboard_set_state(wb, DOODLE_STATE_ESTABLISHED); purple_whiteboard_start(wb); } @@ -372,7 +372,7 @@ void yahoo_doodle_command_got_shutdown(PurpleConnection *gc, const char *from) /* TODO Ask if user wants to save picture before the session is closed */ - wb->state = DOODLE_STATE_CANCELLED; + purple_whiteboard_set_state(wb, DOODLE_STATE_CANCELLED); purple_whiteboard_destroy(wb); } @@ -455,13 +455,14 @@ void yahoo_doodle_start(PurpleWhiteboard *wb) void yahoo_doodle_end(PurpleWhiteboard *wb) { - PurpleConnection *gc = purple_account_get_connection(wb->account); + PurpleAccount *account = purple_whiteboard_get_account(wb); + PurpleConnection *gc = purple_account_get_connection(account); doodle_session *ds = purple_whiteboard_get_protocol_data(wb); /* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */ - if (gc && wb->state != DOODLE_STATE_CANCELLED) - yahoo_doodle_command_send_shutdown(gc, wb->who); + if (gc && (purple_whiteboard_get_state(wb) != DOODLE_STATE_CANCELLED)) + yahoo_doodle_command_send_shutdown(gc, purple_whiteboard_get_who(wb)); g_free(ds->imv_key); g_free(ds); @@ -495,20 +496,25 @@ static char *yahoo_doodle_build_draw_string(doodle_session *ds, GList *draw_list void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list) { + PurpleAccount *account = purple_whiteboard_get_account(wb); + PurpleConnection *gc = purple_account_get_connection(account); doodle_session *ds = purple_whiteboard_get_protocol_data(wb); char *message; g_return_if_fail(draw_list != NULL); message = yahoo_doodle_build_draw_string(ds, draw_list); - yahoo_doodle_command_send_draw(wb->account->gc, wb->who, message, ds->imv_key); + yahoo_doodle_command_send_draw(gc, purple_whiteboard_get_who(wb), message, ds->imv_key); g_free(message); } void yahoo_doodle_clear(PurpleWhiteboard *wb) { + PurpleAccount *account = purple_whiteboard_get_account(wb); + PurpleConnection *gc = purple_account_get_connection(account); doodle_session *ds = purple_whiteboard_get_protocol_data(wb); - yahoo_doodle_command_send_clear(wb->account->gc, wb->who, ds->imv_key); + + yahoo_doodle_command_send_clear(gc, purple_whiteboard_get_who(wb), ds->imv_key); } diff --git a/pidgin/gtkwhiteboard.c b/pidgin/gtkwhiteboard.c index 8471d9e304..0975481202 100644 --- a/pidgin/gtkwhiteboard.c +++ b/pidgin/gtkwhiteboard.c @@ -125,7 +125,7 @@ static void pidgin_whiteboard_create(PurpleWhiteboard *wb) PidginWhiteboard *gtkwb = g_new0(PidginWhiteboard, 1); gtkwb->wb = wb; - wb->ui_data = gtkwb; + purple_whiteboard_set_ui_data(wb, gtkwb); /* Get dimensions (default?) for the whiteboard canvas */ if (!purple_whiteboard_get_dimensions(wb, >kwb->width, >kwb->height)) @@ -145,11 +145,11 @@ static void pidgin_whiteboard_create(PurpleWhiteboard *wb) /* Try and set window title as the name of the buddy, else just use their * username */ - buddy = purple_find_buddy(wb->account, wb->who); + buddy = purple_find_buddy(purple_whiteboard_get_account(wb), purple_whiteboard_get_who(wb)); - window = pidgin_create_window(buddy != NULL ? purple_buddy_get_contact_alias(buddy) : wb->who, 0, NULL, FALSE); + window = pidgin_create_window(buddy != NULL ? purple_buddy_get_contact_alias(buddy) : purple_whiteboard_get_who(wb), 0, NULL, FALSE); gtkwb->window = window; - gtk_widget_set_name(window, wb->who); + gtk_widget_set_name(window, purple_whiteboard_get_who(wb)); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(whiteboard_close_cb), gtkwb); @@ -274,7 +274,7 @@ static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb) GtkWidget *colour_dialog; g_return_if_fail(wb != NULL); - gtkwb = wb->ui_data; + gtkwb = purple_whiteboard_get_ui_data(wb); g_return_if_fail(gtkwb != NULL); /* TODO Ask if user wants to save picture before the session is closed */ @@ -301,7 +301,7 @@ static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb) gtkwb->window = NULL; } g_free(gtkwb); - wb->ui_data = NULL; + purple_whiteboard_set_ui_data(wb, NULL); } static gboolean whiteboard_close_cb(GtkWidget *widget, GdkEvent *event, PidginWhiteboard *gtkwb) @@ -406,7 +406,7 @@ static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton * GdkPixmap *pixmap = gtkwb->pixmap; PurpleWhiteboard *wb = gtkwb->wb; - GList *draw_list = wb->draw_list; + GList *draw_list = purple_whiteboard_get_draw_list(wb); if(BrushState != BRUSH_STATE_UP) { @@ -441,7 +441,7 @@ static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton * gtkwb->brush_color, gtkwb->brush_size); } - wb->draw_list = draw_list; + purple_whiteboard_set_draw_list(wb, draw_list); return TRUE; } @@ -459,7 +459,7 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion GdkPixmap *pixmap = gtkwb->pixmap; PurpleWhiteboard *wb = gtkwb->wb; - GList *draw_list = wb->draw_list; + GList *draw_list = purple_whiteboard_get_draw_list(wb); if(event->is_hint) gdk_window_get_pointer(event->window, &x, &y, &state); @@ -528,7 +528,7 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion LastY = y; } - wb->draw_list = draw_list; + purple_whiteboard_set_draw_list(wb, draw_list); return TRUE; } @@ -539,7 +539,7 @@ static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *ev GdkPixmap *pixmap = gtkwb->pixmap; PurpleWhiteboard *wb = gtkwb->wb; - GList *draw_list = wb->draw_list; + GList *draw_list = purple_whiteboard_get_draw_list(wb); if((BrushState != BRUSH_STATE_DOWN) && (BrushState != BRUSH_STATE_MOTION)) { @@ -583,7 +583,7 @@ static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *ev if(draw_list) purple_whiteboard_draw_list_destroy(draw_list); - wb->draw_list = NULL; + purple_whiteboard_set_draw_list(wb, NULL); } return TRUE; @@ -591,7 +591,7 @@ static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *ev static void pidgin_whiteboard_draw_brush_point(PurpleWhiteboard *wb, int x, int y, int color, int size) { - PidginWhiteboard *gtkwb = wb->ui_data; + PidginWhiteboard *gtkwb = purple_whiteboard_get_ui_data(wb); GtkWidget *widget = gtkwb->drawing_area; GdkPixmap *pixmap = gtkwb->pixmap; @@ -684,7 +684,7 @@ static void pidgin_whiteboard_draw_brush_line(PurpleWhiteboard *wb, int x0, int static void pidgin_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, int height) { - PidginWhiteboard *gtkwb = wb->ui_data; + PidginWhiteboard *gtkwb = purple_whiteboard_get_ui_data(wb); gtkwb->width = width; gtkwb->height = height; @@ -692,7 +692,7 @@ static void pidgin_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, in static void pidgin_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color) { - PidginWhiteboard *gtkwb = wb->ui_data; + PidginWhiteboard *gtkwb = purple_whiteboard_get_ui_data(wb); gtkwb->brush_size = size; gtkwb->brush_color = color; @@ -700,7 +700,7 @@ static void pidgin_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int colo static void pidgin_whiteboard_clear(PurpleWhiteboard *wb) { - PidginWhiteboard *gtkwb = wb->ui_data; + PidginWhiteboard *gtkwb = purple_whiteboard_get_ui_data(wb); GdkPixmap *pixmap = gtkwb->pixmap; GtkWidget *drawing_area = gtkwb->drawing_area; cairo_t *cr = g_object_get_data(G_OBJECT(pixmap), "cairo-context"); -- cgit v1.2.1 From 04a2374845fc678315dd4ad6fbd27dd210c73665 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Wed, 31 Aug 2011 21:26:02 +0000 Subject: Replace the last raw references to "->proto_data". --- libpurple/protocols/bonjour/mdns_win32.c | 8 ++++---- libpurple/protocols/myspace/user.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libpurple/protocols/bonjour/mdns_win32.c b/libpurple/protocols/bonjour/mdns_win32.c index 5822a9a7be..d7ee2e8e86 100644 --- a/libpurple/protocols/bonjour/mdns_win32.c +++ b/libpurple/protocols/bonjour/mdns_win32.c @@ -177,7 +177,7 @@ _mdns_resolve_host_callback(DNSServiceRef sdRef, DNSServiceFlags flags, args->resolver_query = NULL; if ((pb = purple_find_buddy(args->account, args->res_data->name))) { - if (pb->proto_data != args->bb) { + if (purple_buddy_get_protocol_data(pb) != args->bb) { purple_debug_error("bonjour", "Found purple buddy for %s not matching bonjour buddy record.", args->res_data->name); goto cleanup; @@ -348,7 +348,7 @@ _mdns_service_browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32 /* Is there an existing buddy? */ if ((pb = purple_find_buddy(account, serviceName))) - bb = pb->proto_data; + bb = purple_buddy_get_protocol_data(pb); /* Is there a pending buddy? */ else { while (tmp) { @@ -368,7 +368,7 @@ _mdns_service_browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32 if (pb == NULL) pending_buddies = g_slist_prepend(pending_buddies, bb); else - pb->proto_data = bb; + purple_buddy_set_protocol_data(pb, bb); } rd = g_new0(Win32SvcResolverData, 1); @@ -408,7 +408,7 @@ _mdns_service_browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32 GSList *l; /* There may be multiple presences, we should only get rid of this one */ Win32SvcResolverData *rd_search; - BonjourBuddy *bb = pb->proto_data; + BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); Win32BuddyImplData *idata; g_return_if_fail(bb != NULL); diff --git a/libpurple/protocols/myspace/user.c b/libpurple/protocols/myspace/user.c index 85c1784fc7..48e3d1c880 100644 --- a/libpurple/protocols/myspace/user.c +++ b/libpurple/protocols/myspace/user.c @@ -412,7 +412,7 @@ msim_store_user_info_each(const gchar *key_str, gchar *value_str, MsimUser *user * * @param session * @param msg The user information reply, with any amount of information. - * @param user The structure to save to, or NULL to save in PurpleBuddy->proto_data. + * @param user The structure to save to, or NULL to save in PurpleBuddy's protocol_data. * * Variable information is saved to the passed MsimUser structure. Permanent * information (UserID) is stored in the blist node of the buddy list (and -- cgit v1.2.1 From 838e410baae49d543c8cf48b59d89642a0a02ad5 Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Thu, 1 Sep 2011 04:23:42 +0000 Subject: Hide-a-PurpleMenuAction. --- ChangeLog.API | 8 ++++++ finch/gntblist.c | 22 +++++++++------- libpurple/util.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++ libpurple/util.h | 76 +++++++++++++++++++++++++++++++++++++++++++++++++------ pidgin/gtkutils.c | 26 +++++++++++-------- 5 files changed, 169 insertions(+), 27 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 497404b453..b76c274976 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -8,6 +8,13 @@ version 3.0.0 (??/??/????): * purple_notify_searchresult_column_is_visible * purple_notify_searchresult_column_set_visible * purple_notify_user_info_prepend_pair_plaintext + * purple_menu_action_get_callback + * purple_menu_action_get_children + * purple_menu_action_get_data + * purple_menu_action_set_label + * purple_menu_action_set_data + * purple_menu_action_set_callback + * purple_menu_action_set_children * purple_request_field_get_tooltip * purple_request_field_group_get_fields_list * purple_request_field_set_tooltip @@ -90,6 +97,7 @@ version 3.0.0 (??/??/????): purple_util_fetch_url_request_len, insetad. * PurpleConnectionUiOps.report_disconnect_reason * struct _GtkIMHtmlFontDetail + * struct _PurpleMenuAction * struct _PurplePounce * struct _PurpleRequestField * struct _PurpleRoomlist diff --git a/finch/gntblist.c b/finch/gntblist.c index 8f7bfe6da9..aa21b93ece 100644 --- a/finch/gntblist.c +++ b/finch/gntblist.c @@ -1078,9 +1078,10 @@ context_menu_callback(GntMenuItem *item, gpointer data) PurpleBlistNode *node = ggblist->cnode; if (action) { void (*callback)(PurpleBlistNode *, gpointer); - callback = (void (*)(PurpleBlistNode *, gpointer))action->callback; + callback = (void (*)(PurpleBlistNode *, gpointer)) + purple_menu_action_get_callback(action); if (callback) - callback(node, action->data); + callback(node, purple_menu_action_get_data(action)); else return; } @@ -1095,15 +1096,17 @@ gnt_append_menu_action(GntMenu *menu, PurpleMenuAction *action, gpointer parent) if (action == NULL) return; - item = gnt_menuitem_new(action->label); - if (action->callback) + item = gnt_menuitem_new(purple_menu_action_get_label(action)); + if (purple_menu_action_get_callback(action)) gnt_menuitem_set_callback(GNT_MENU_ITEM(item), context_menu_callback, action); gnt_menu_add_item(menu, GNT_MENU_ITEM(item)); - if (action->children) { + list = purple_menu_action_get_children(action); + + if (list) { GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); gnt_menuitem_set_submenu(item, GNT_MENU(sub)); - for (list = action->children; list; list = list->next) + for (; list; list = list->next) gnt_append_menu_action(GNT_MENU(sub), list->data, action); } } @@ -1123,7 +1126,7 @@ append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) PurpleMenuAction *act = (PurpleMenuAction *) list->data; if (!act) continue; - act->data = node; + purple_menu_action_set_data(act, node); gnt_append_menu_action(menu, act, NULL); g_signal_connect_swapped(G_OBJECT(menu), "destroy", G_CALLBACK(purple_menu_action_free), act); @@ -1216,7 +1219,7 @@ static void autojoin_toggled(GntMenuItem *item, gpointer data) { PurpleMenuAction *action = data; - purple_blist_node_set_bool(action->data, "gnt-autojoin", + purple_blist_node_set_bool(purple_menu_action_get_data(action), "gnt-autojoin", gnt_menuitem_check_get_checked(GNT_MENU_ITEM_CHECK(item))); } @@ -1224,7 +1227,8 @@ static void create_chat_menu(GntMenu *menu, PurpleChat *chat) { PurpleMenuAction *action = purple_menu_action_new(_("Auto-join"), NULL, chat, NULL); - GntMenuItem *check = gnt_menuitem_check_new(action->label); + GntMenuItem *check = gnt_menuitem_check_new( + purple_menu_action_get_label(action)); gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(check), purple_blist_node_get_bool((PurpleBlistNode*)chat, "gnt-autojoin")); gnt_menu_add_item(menu, check); diff --git a/libpurple/util.c b/libpurple/util.c index 26d1676e83..feb1cd2590 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -73,6 +73,14 @@ struct _PurpleUtilFetchUrlData PurpleAccount *account; }; +struct _PurpleMenuAction +{ + char *label; + PurpleCallback callback; + gpointer data; + GList *children; +}; + static char *custom_user_dir = NULL; static char *user_dir = NULL; @@ -98,6 +106,62 @@ purple_menu_action_free(PurpleMenuAction *act) g_free(act); } +char * purple_menu_action_get_label(const PurpleMenuAction *act) +{ + g_return_val_if_fail(act != NULL, NULL); + + return act->label; +} + +PurpleCallback purple_menu_action_get_callback(const PurpleMenuAction *act) +{ + g_return_val_if_fail(act != NULL, NULL); + + return act->callback; +} + +gpointer purple_menu_action_get_data(const PurpleMenuAction *act) +{ + g_return_val_if_fail(act != NULL, NULL); + + return act->data; +} + +GList* purple_menu_action_get_children(const PurpleMenuAction *act) +{ + g_return_val_if_fail(act != NULL, NULL); + + return act->children; +} + +void purple_menu_action_set_label(PurpleMenuAction *act, char *label) +{ + g_return_if_fail(act != NULL); + + act-> label = label; +} + +void purple_menu_action_set_callback(PurpleMenuAction *act, PurpleCallback callback) +{ + g_return_if_fail(act != NULL); + + act->callback = callback; +} + +void purple_menu_action_set_data(PurpleMenuAction *act, gpointer data) +{ + g_return_if_fail(act != NULL); + + act->data = data; +} + +void purple_menu_action_set_children(PurpleMenuAction *act, GList *children) +{ + g_return_if_fail(act != NULL); + + act->children = children; +} + void purple_util_init(void) { diff --git a/libpurple/util.h b/libpurple/util.h index a489b30bb6..61e4c496f5 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -51,14 +51,6 @@ typedef struct _PurpleKeyValuePair PurpleKeyValuePair; extern "C" { #endif -struct _PurpleMenuAction -{ - char *label; - PurpleCallback callback; - gpointer data; - GList *children; -}; - typedef char *(*PurpleInfoFieldFormatCallback)(const char *field, size_t len); /** @@ -95,6 +87,74 @@ PurpleMenuAction *purple_menu_action_new(const char *label, PurpleCallback callb */ void purple_menu_action_free(PurpleMenuAction *act); +/** + * Returns the label of the PurpleMenuAction. + * + * @param act The PurpleMenuAction. + * + * @return The label string. + */ +char * purple_menu_action_get_label(const PurpleMenuAction *act); + +/** + * Returns the callback of the PurpleMenuAction. + * + * @param act The PurpleMenuAction. + * + * @return The callback function. + */ +PurpleCallback purple_menu_action_get_callback(const PurpleMenuAction *act); + +/** + * Returns the data stored in the PurpleMenuAction. + * + * @param act The PurpleMenuAction. + * + * @return The data. + */ +gpointer purple_menu_action_get_data(const PurpleMenuAction *act); + +/** + * Returns the children of the PurpleMenuAction. + * + * @param act The PurpleMenuAction. + * + * @return The GList of children. + */ +GList* purple_menu_action_get_children(const PurpleMenuAction *act); + +/** + * Set the label to the PurpleMenuAction. + * + * @param act The menu action. + * @param label The label for the menu action. + */ +void purple_menu_action_set_label(PurpleMenuAction *act, char *label); + +/** + * Set the callback that will be used by the PurpleMenuAction. + * + * @param act The menu action. + * @param callback The callback. + */ +void purple_menu_action_set_callback(PurpleMenuAction *act, PurpleCallback callback); + +/** + * Set the label to the PurpleMenuAction. + * + * @param act The menu action. + * @param data The data used by this PurpleMenuAction + */ +void purple_menu_action_set_data(PurpleMenuAction *act, gpointer data); + +/** + * Set the children of the PurpleMenuAction. + * + * @param act The menu action. + * @param children The PurpleMenuAtion children + */ +void purple_menu_action_set_children(PurpleMenuAction *act, GList *children); + /** * Set the appropriate presence values for the currently playing song. * diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index b0915eed08..aa0139efb4 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -1816,21 +1816,27 @@ pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, gpointer object) { GtkWidget *menuitem; + GList *list; if (act == NULL) { return pidgin_separator(menu); } - if (act->children == NULL) { - menuitem = gtk_menu_item_new_with_mnemonic(act->label); + list = purple_menu_action_get_children(act); + menuitem = gtk_menu_item_new_with_mnemonic(purple_menu_action_get_label(act)); + + if (list == NULL) { + PurpleCallback callback; - if (act->callback != NULL) { + callback = purple_menu_action_get_callback(act); + + if (callback != NULL) { g_object_set_data(G_OBJECT(menuitem), "purplecallback", - act->callback); + callback); g_object_set_data(G_OBJECT(menuitem), "purplecallbackdata", - act->data); + purple_menu_action_get_data(act)); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menu_action_cb), object); @@ -1844,7 +1850,6 @@ pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, GtkWidget *submenu = NULL; GtkAccelGroup *group; - menuitem = gtk_menu_item_new_with_mnemonic(act->label); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); submenu = gtk_menu_new(); @@ -1852,19 +1857,20 @@ pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, group = gtk_menu_get_accel_group(GTK_MENU(menu)); if (group) { - char *path = g_strdup_printf("%s/%s", GTK_MENU_ITEM(menuitem)->accel_path, act->label); + char *path = g_strdup_printf("%s/%s", GTK_MENU_ITEM(menuitem)->accel_path, + purple_menu_action_get_label(act)); gtk_menu_set_accel_path(GTK_MENU(submenu), path); g_free(path); gtk_menu_set_accel_group(GTK_MENU(submenu), group); } - for (l = act->children; l; l = l->next) { + for (l = list; l; l = l->next) { PurpleMenuAction *act = (PurpleMenuAction *)l->data; pidgin_append_menu_action(submenu, act, object); } - g_list_free(act->children); - act->children = NULL; + g_list_free(list); + purple_menu_action_set_children(act, NULL); } purple_menu_action_free(act); return menuitem; -- cgit v1.2.1 From 40239a8fa6a861d140aa8bfb73b15be8cb0cc8ad Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Thu, 1 Sep 2011 04:32:49 +0000 Subject: Clean util.h from @since tags. --- libpurple/util.h | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/libpurple/util.h b/libpurple/util.h index 61e4c496f5..4e084a2db4 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -161,7 +161,6 @@ void purple_menu_action_set_children(PurpleMenuAction *act, GList *children); * @param title The title of the song, @c NULL to unset the value. * @param artist The artist of the song, can be @c NULL. * @param album The album of the song, can be @c NULL. - * @since 2.4.0 */ void purple_util_set_current_song(const char *title, const char *artist, const char *album); @@ -175,7 +174,6 @@ void purple_util_set_current_song(const char *title, const char *artist, * @param unused Currently unused, must be @c NULL. * * @return The formatted string. The caller must g_free the returned string. - * @since 2.4.0 */ char * purple_util_format_song_info(const char *title, const char *artist, const char *album, gpointer unused); @@ -187,15 +185,11 @@ char * purple_util_format_song_info(const char *title, const char *artist, /** * Initializes the utility subsystem. - * - * @since 2.3.0 */ void purple_util_init(void); /** * Uninitializes the util subsystem. - * - * @since 2.3.0 */ void purple_util_uninit(void); @@ -489,8 +483,6 @@ time_t purple_str_to_time(const char *timestamp, gboolean utc, * This is exactly the same as g_markup_escape_text(), except that it * does not change ' to ' because ' is not a valid HTML 4 entity, * and is displayed literally in IE7. - * - * @since 2.6.0 */ gchar *purple_markup_escape_text(const gchar *text, gssize length); @@ -591,7 +583,6 @@ char *purple_markup_linkify(const char *str); * this string when finished with it. * * @see purple_unescape_html() - * @since 2.7.0 */ char *purple_unescape_text(const char *text); @@ -684,8 +675,6 @@ char * purple_markup_get_css_property(const gchar *style, const gchar *opt); * @param html The HTML text. * * @return TRUE if the text contains RTL text, FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_markup_is_rtl(const char *html); @@ -886,7 +875,6 @@ char *purple_fd_get_ip(int fd); * * @return The address family of the socket (AF_INET, AF_INET6, etc) or -1 * on error. - * @since 2.7.0 */ int purple_socket_get_family(int fd); @@ -898,7 +886,6 @@ int purple_socket_get_family(int fd); * * @param fd The socket file descriptor * @return TRUE if a socket can speak IPv4. - * @since 2.7.0 */ gboolean purple_socket_speaks_ipv4(int fd); @@ -920,8 +907,6 @@ gboolean purple_socket_speaks_ipv4(int fd); * @param right A string to compare with left * * @return @c TRUE if the strings are the same, else @c FALSE. - * - * @since 2.6.0 */ gboolean purple_strequal(const gchar *left, const gchar *right); @@ -1302,7 +1287,6 @@ gboolean purple_ip_address_is_valid(const char *ip); * @param ip The IP address to validate. * * @return True if the IP address is syntactically correct. - * @since 2.6.0 */ gboolean purple_ipv4_address_is_valid(const char *ip); @@ -1312,7 +1296,6 @@ gboolean purple_ipv4_address_is_valid(const char *ip); * @param ip The IP address to validate. * * @return True if the IP address is syntactically correct. - * @since 2.6.0 */ gboolean purple_ipv6_address_is_valid(const char *ip); @@ -1380,7 +1363,6 @@ gchar *purple_utf8_salvage(const char *str); * @param str A valid UTF-8 string. * * @return A newly allocated UTF-8 string without the unprintable characters. - * @since 2.6.0 */ gchar *purple_utf8_strip_unprintables(const gchar *str); @@ -1392,7 +1374,6 @@ gchar *purple_utf8_strip_unprintables(const gchar *str); * @param errnum The error code. * * @return The UTF-8 error message. - * @since 2.4.0 */ G_CONST_RETURN gchar *purple_gai_strerror(gint errnum); @@ -1506,7 +1487,6 @@ const gchar *purple_get_host_name(void); * Returns a type 4 (random) UUID * * @return A UUID, caller is responsible for freeing it - * @since 2.7.0 */ gchar *purple_uuid_random(void); -- cgit v1.2.1 From 8a7ca49c56ab02601eeb7407c4e4b64bab9040a8 Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Thu, 1 Sep 2011 06:00:21 +0000 Subject: Add some get/set functions to help hidding _PrupleXfer. --- libpurple/ft.c | 38 +++++++++++++++++++++++++++++++++++++- libpurple/ft.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/libpurple/ft.c b/libpurple/ft.c index fb61af37c3..405eee771c 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -220,7 +220,7 @@ purple_xfer_unref(PurpleXfer *xfer) purple_xfer_destroy(xfer); } -static void +void purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatusType status) { g_return_if_fail(xfer != NULL); @@ -720,6 +720,20 @@ purple_xfer_request_denied(PurpleXfer *xfer) purple_xfer_unref(xfer); } +int purple_xfer_get_fd(PurpleXfer *xfer) +{ + g_return_val_if_fail(xfer != NULL, 0); + + return xfer->fd; +} + +int purple_xfer_get_watcher(PurpleXfer *xfer) +{ + g_return_val_if_fail(xfer != NULL, 0); + + return xfer->watcher; +} + PurpleXferType purple_xfer_get_type(const PurpleXfer *xfer) { @@ -864,6 +878,20 @@ purple_xfer_get_end_time(const PurpleXfer *xfer) return xfer->end_time; } +void purple_xfer_set_fd(PurpleXfer *xfer, int fd) +{ + g_return_if_fail(xfer != NULL); + + xfer->fd = fd; +} + +void purple_xfer_set_watcher(PurpleXfer *xfer, int watcher) +{ + g_return_if_fail(xfer != NULL); + + xfer->watcher = watcher; +} + void purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed) { @@ -946,6 +974,14 @@ purple_xfer_set_size(PurpleXfer *xfer, size_t size) xfer->bytes_remaining = xfer->size - purple_xfer_get_bytes_sent(xfer); } +void +purple_xfer_set_local_port(PurpleXfer *xfer, unsigned int local_port) +{ + g_return_if_fail(xfer != NULL); + + xfer->local_port = local_port; +} + void purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent) { diff --git a/libpurple/ft.h b/libpurple/ft.h index 59c51edafb..a657d2bf39 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -265,6 +265,24 @@ void purple_xfer_request_accepted(PurpleXfer *xfer, const char *filename); */ void purple_xfer_request_denied(PurpleXfer *xfer); +/** + * Returns the socket file descriptor. + * + * @param xfer The file transfer. + * + * @return The socket file descriptor. + */ +int purple_xfer_get_fd(PurpleXfer *xfer); + +/** + * Returns the Watcher for the transfer. + * + * @param xfer The file transfer. + * + * @return The watcher. + */ +int purple_xfer_get_watcher(PurpleXfer *xfer); + /** * Returns the type of file transfer. * @@ -425,6 +443,22 @@ time_t purple_xfer_get_start_time(const PurpleXfer *xfer); */ time_t purple_xfer_get_end_time(const PurpleXfer *xfer); +/** + * Sets the socket file descriptor. + * + * @param xfer The file transfer. + * @param fd The file descriptor. + */ +void purple_xfer_set_fd(PurpleXfer *xfer, int fd); + +/** + * Sets the watcher for the file transfer. + * + * @param xfer The file transfer. + * @param watcher The watcher. + */ +void purple_xfer_set_watcher(PurpleXfer *xfer, int watcher); + /** * Sets the completed state for the file transfer. * @@ -433,6 +467,14 @@ time_t purple_xfer_get_end_time(const PurpleXfer *xfer); */ void purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed); +/** + * Sets the current status for the file transfer. + * + * @param xfer The file transfer. + * @param status The current status. + */ +void purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatusType status); + /** * Sets the filename for the file transfer. * @@ -465,6 +507,14 @@ void purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename); */ void purple_xfer_set_size(PurpleXfer *xfer, size_t size); +/** + * Sets the local port of the file transfer. + * + * @param xfer The file transfer. + * @param local_port The local port. + */ +void purple_xfer_set_local_port(PurpleXfer *xfer, unsigned int local_port); + /** * Sets the current working position in the active file transfer. This * can be used to jump backward in the file if the protocol detects -- cgit v1.2.1 From c89156fa7eff64da078f3bded0497dd449cd26b7 Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Thu, 1 Sep 2011 06:15:23 +0000 Subject: Add the xfer get/set functions to the Changelog.API. --- ChangeLog.API | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog.API b/ChangeLog.API index b76c274976..91fba71079 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -37,10 +37,16 @@ version 3.0.0 (??/??/????): * purple_whiteboard_get_ui_data * purple_whiteboard_set_ui_data * purple_whiteboard_get_who + * purple_xfer_get_fd * purple_xfer_get_protocol_data * purple_xfer_get_ui_data + * purple_xfer_get_watcher + * purple_xfer_set_fd + * purple_Xfer_set_local_port * purple_xfer_set_protocol_data + * purple_xfer_set_status * purple_xfer_set_ui_data + * purple_xfer_set_watcher Changed: * purple_connection_error now takes a PurpleConnectionError -- cgit v1.2.1 From 38fc9a2c3fb368b13007152cfcc8bb89c4405eb3 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Thu, 1 Sep 2011 06:29:47 +0000 Subject: Hide GtkIMHtmlFontDetail --- ChangeLog.API | 1 + pidgin/gtkimhtml.c | 6 +++--- pidgin/gtkimhtml.h | 3 --- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 91fba71079..fdbed5f67b 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -82,6 +82,7 @@ version 3.0.0 (??/??/????): * _XMLNodeType * GtkIMHtml.clipboard_html_string * GtkIMHtml.clipboard_text_string + * GtkIMHtmlFontDetail * pidgin_blist_update_account_error_state * pidgin_check_if_dir * PIDGIN_DIALOG diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 5dc462d659..eee55cdf84 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -90,8 +90,7 @@ struct _GtkIMHtmlLink GtkTextTag *tag; }; -typedef struct _GtkIMHtmlProtocol -{ +typedef struct { char *name; int length; @@ -99,7 +98,8 @@ typedef struct _GtkIMHtmlProtocol gboolean (*context_menu)(GtkIMHtml *imhtml, GtkIMHtmlLink *link, GtkWidget *menu); } GtkIMHtmlProtocol; -typedef struct _GtkIMHtmlFontDetail { +/* The five elements contained in a FONT tag */ +typedef struct { gushort size; gchar *face; gchar *fore; diff --git a/pidgin/gtkimhtml.h b/pidgin/gtkimhtml.h index 498c376fbe..414ff36a22 100644 --- a/pidgin/gtkimhtml.h +++ b/pidgin/gtkimhtml.h @@ -50,9 +50,6 @@ extern "C" { typedef struct _GtkIMHtml GtkIMHtml; typedef struct _GtkIMHtmlClass GtkIMHtmlClass; -#if !(defined PIDGIN_DISABLE_DEPRECATED) && !(defined _PIDGIN_GTKIMHTML_C_) -typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ -#endif typedef struct _GtkSmileyTree GtkSmileyTree; typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; -- cgit v1.2.1 From cee068f9d6f7e997647b227e90a4886f55495ff8 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Thu, 1 Sep 2011 06:56:17 +0000 Subject: Fix build breakage from c8cf9b704a4953c30e788f35388540c4691cd392. --- libpurple/util.c | 3 ++- libpurple/util.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libpurple/util.c b/libpurple/util.c index feb1cd2590..5cc563b787 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -113,7 +113,8 @@ char * purple_menu_action_get_label(const PurpleMenuAction *act) return act->label; } -PurpleCallback purple_menu_action_get_callback(const PurpleMenuAction *act) +PurpleCallback * +purple_menu_action_get_callback(const PurpleMenuAction *act) { g_return_val_if_fail(act != NULL, NULL); diff --git a/libpurple/util.h b/libpurple/util.h index 4e084a2db4..c56ba759ce 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -103,7 +103,7 @@ char * purple_menu_action_get_label(const PurpleMenuAction *act); * * @return The callback function. */ -PurpleCallback purple_menu_action_get_callback(const PurpleMenuAction *act); +PurpleCallback *purple_menu_action_get_callback(const PurpleMenuAction *act); /** * Returns the data stored in the PurpleMenuAction. -- cgit v1.2.1 From 4f51f14dc61d7e62922b8f40a0271621bd9ba76c Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Thu, 1 Sep 2011 07:27:16 +0000 Subject: Make some gtkimhtml functions private --- ChangeLog.API | 5 + pidgin/gtkimhtml.c | 346 ++++++++++++++++++-------------- pidgin/gtkimhtml.h | 56 ------ pidgin/plugins/perl/common/GtkIMHtml.xs | 13 -- 4 files changed, 199 insertions(+), 221 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index fdbed5f67b..a4afd05753 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -83,6 +83,11 @@ version 3.0.0 (??/??/????): * GtkIMHtml.clipboard_html_string * GtkIMHtml.clipboard_text_string * GtkIMHtmlFontDetail + * gtk_imhtml_animation_free + * gtk_imhtml_animation_new + * gtk_imhtml_image_add_to + * gtk_imhtml_image_free + * gtk_imhtml_image_scale * pidgin_blist_update_account_error_state * pidgin_check_if_dir * PIDGIN_DIALOG diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index eee55cdf84..d299d8dca6 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -3593,125 +3593,38 @@ void gtk_imhtml_page_down (GtkIMHtml *imhtml) gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(imhtml), &iter, 0, TRUE, 0, 0); } -/* GtkIMHtmlScalable, gtk_imhtml_image, gtk_imhtml_hr */ -GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id) -{ - GtkIMHtmlImage *im_image = g_malloc(sizeof(GtkIMHtmlImage)); - - GTK_IMHTML_SCALABLE(im_image)->scale = gtk_imhtml_image_scale; - GTK_IMHTML_SCALABLE(im_image)->add_to = gtk_imhtml_image_add_to; - GTK_IMHTML_SCALABLE(im_image)->free = gtk_imhtml_image_free; - - im_image->pixbuf = img; - im_image->image = GTK_IMAGE(gtk_image_new_from_pixbuf(im_image->pixbuf)); - im_image->width = gdk_pixbuf_get_width(img); - im_image->height = gdk_pixbuf_get_height(img); - im_image->mark = NULL; - im_image->filename = g_strdup(filename); - im_image->id = id; - im_image->filesel = NULL; - - g_object_ref(img); - return GTK_IMHTML_SCALABLE(im_image); -} - -static gboolean -animate_image_cb(gpointer data) -{ - GtkIMHtmlImage *im_image; - int width, height; - int delay; - - im_image = data; - - /* Update the pointer to this GdkPixbuf frame of the animation */ - if (gdk_pixbuf_animation_iter_advance(GTK_IMHTML_ANIMATION(im_image)->iter, NULL)) { - GdkPixbuf *pb = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); - g_object_unref(G_OBJECT(im_image->pixbuf)); - im_image->pixbuf = gdk_pixbuf_copy(pb); - - /* Update the displayed GtkImage */ - width = gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)); - height = gdk_pixbuf_get_height(gtk_image_get_pixbuf(im_image->image)); - if (width > 0 && height > 0) - { - /* Need to scale the new frame to the same size as the old frame */ - GdkPixbuf *tmp; - tmp = gdk_pixbuf_scale_simple(im_image->pixbuf, width, height, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(im_image->image, tmp); - g_object_unref(G_OBJECT(tmp)); - } else { - /* Display at full-size */ - gtk_image_set_from_pixbuf(im_image->image, im_image->pixbuf); - } - } - - delay = MIN(gdk_pixbuf_animation_iter_get_delay_time(GTK_IMHTML_ANIMATION(im_image)->iter), 100); - GTK_IMHTML_ANIMATION(im_image)->timer = g_timeout_add(delay, animate_image_cb, im_image); - - return FALSE; -} - -GtkIMHtmlScalable *gtk_imhtml_animation_new(GdkPixbufAnimation *anim, const gchar *filename, int id) +/** + * Destroys and frees a GTK+ IM/HTML scalable image. + * + * @param scale The GTK+ IM/HTML scalable. + */ +static void gtk_imhtml_image_free(GtkIMHtmlScalable *scale) { - GtkIMHtmlImage *im_image = (GtkIMHtmlImage *) g_new0(GtkIMHtmlAnimation, 1); - - GTK_IMHTML_SCALABLE(im_image)->scale = gtk_imhtml_image_scale; - GTK_IMHTML_SCALABLE(im_image)->add_to = gtk_imhtml_image_add_to; - GTK_IMHTML_SCALABLE(im_image)->free = gtk_imhtml_animation_free; - - GTK_IMHTML_ANIMATION(im_image)->anim = anim; - if (gdk_pixbuf_animation_is_static_image(anim)) { - im_image->pixbuf = gdk_pixbuf_animation_get_static_image(anim); - g_object_ref(im_image->pixbuf); - } else { - int delay; - GdkPixbuf *pb; - GTK_IMHTML_ANIMATION(im_image)->iter = gdk_pixbuf_animation_get_iter(anim, NULL); - pb = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); - im_image->pixbuf = gdk_pixbuf_copy(pb); - delay = MIN(gdk_pixbuf_animation_iter_get_delay_time(GTK_IMHTML_ANIMATION(im_image)->iter), 100); - GTK_IMHTML_ANIMATION(im_image)->timer = g_timeout_add(delay, animate_image_cb, im_image); - } - im_image->image = GTK_IMAGE(gtk_image_new_from_pixbuf(im_image->pixbuf)); - im_image->width = gdk_pixbuf_animation_get_width(anim); - im_image->height = gdk_pixbuf_animation_get_height(anim); - im_image->filename = g_strdup(filename); - im_image->id = id; - - g_object_ref(anim); + GtkIMHtmlImage *image = (GtkIMHtmlImage *)scale; - return GTK_IMHTML_SCALABLE(im_image); + g_object_unref(image->pixbuf); + g_free(image->filename); + if (image->filesel) + gtk_widget_destroy(image->filesel); + g_free(scale); } -void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height) +/** + * Destroys and frees a GTK+ IM/HTML scalable animation. + * + * @param scale The GTK+ IM/HTML scalable. + */ +static void gtk_imhtml_animation_free(GtkIMHtmlScalable *scale) { - GtkIMHtmlImage *im_image = (GtkIMHtmlImage *)scale; - - if (im_image->width > width || im_image->height > height) { - double ratio_w, ratio_h, ratio; - int new_h, new_w; - GdkPixbuf *new_image = NULL; - - ratio_w = ((double)width - 2) / im_image->width; - ratio_h = ((double)height - 2) / im_image->height; - - ratio = (ratio_w < ratio_h) ? ratio_w : ratio_h; - - new_w = (int)(im_image->width * ratio); - new_h = (int)(im_image->height * ratio); + GtkIMHtmlAnimation *animation = (GtkIMHtmlAnimation *)scale; - new_image = gdk_pixbuf_scale_simple(im_image->pixbuf, new_w, new_h, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(im_image->image, new_image); - g_object_unref(G_OBJECT(new_image)); - } else if (gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)) != im_image->width) { - /* Enough space to show the full-size of the image. */ - GdkPixbuf *new_image; + if (animation->timer > 0) + g_source_remove(animation->timer); + if (animation->iter != NULL) + g_object_unref(animation->iter); + g_object_unref(animation->anim); - new_image = gdk_pixbuf_scale_simple(im_image->pixbuf, im_image->width, im_image->height, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(im_image->image, new_image); - g_object_unref(G_OBJECT(new_image)); - } + gtk_imhtml_image_free(scale); } static void @@ -3918,55 +3831,51 @@ static gboolean gtk_imhtml_image_clicked(GtkWidget *w, GdkEvent *event, GtkIMHtm } -static gboolean gtk_imhtml_smiley_clicked(GtkWidget *w, GdkEvent *event, GtkIMHtmlSmiley *smiley) +/** + * Rescales a GTK+ IM/HTML scalable image to a given size. + * + * @param scale The GTK+ IM/HTML scalable. + * @param width The new width. + * @param height The new height. + */ +static void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height) { - GdkPixbufAnimation *anim = NULL; - GtkIMHtmlImageSave *save = NULL; - gboolean ret; - - if (event->type != GDK_BUTTON_RELEASE || ((GdkEventButton*)event)->button != 3) - return FALSE; - - anim = gtk_smiley_get_image(smiley); - if (!anim) - return FALSE; + GtkIMHtmlImage *im_image = (GtkIMHtmlImage *)scale; - save = g_new0(GtkIMHtmlImageSave, 1); - save->image = (GtkIMHtmlScalable *)gtk_imhtml_animation_new(anim, smiley->smile, 0); - save->data = smiley->data; /* Do not need to memdup here, since the smiley is not - destroyed before this GtkIMHtmlImageSave */ - save->datasize = smiley->datasize; - ret = gtk_imhtml_image_clicked(w, event, save); - g_object_set_data_full(G_OBJECT(w), "image-data", save->image, (GDestroyNotify)gtk_imhtml_animation_free); - g_object_set_data_full(G_OBJECT(w), "image-save-data", save, (GDestroyNotify)g_free); - return ret; -} + if (im_image->width > width || im_image->height > height) { + double ratio_w, ratio_h, ratio; + int new_h, new_w; + GdkPixbuf *new_image = NULL; -void gtk_imhtml_image_free(GtkIMHtmlScalable *scale) -{ - GtkIMHtmlImage *image = (GtkIMHtmlImage *)scale; + ratio_w = ((double)width - 2) / im_image->width; + ratio_h = ((double)height - 2) / im_image->height; - g_object_unref(image->pixbuf); - g_free(image->filename); - if (image->filesel) - gtk_widget_destroy(image->filesel); - g_free(scale); -} + ratio = (ratio_w < ratio_h) ? ratio_w : ratio_h; -void gtk_imhtml_animation_free(GtkIMHtmlScalable *scale) -{ - GtkIMHtmlAnimation *animation = (GtkIMHtmlAnimation *)scale; + new_w = (int)(im_image->width * ratio); + new_h = (int)(im_image->height * ratio); - if (animation->timer > 0) - g_source_remove(animation->timer); - if (animation->iter != NULL) - g_object_unref(animation->iter); - g_object_unref(animation->anim); + new_image = gdk_pixbuf_scale_simple(im_image->pixbuf, new_w, new_h, GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(im_image->image, new_image); + g_object_unref(G_OBJECT(new_image)); + } else if (gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)) != im_image->width) { + /* Enough space to show the full-size of the image. */ + GdkPixbuf *new_image; - gtk_imhtml_image_free(scale); + new_image = gdk_pixbuf_scale_simple(im_image->pixbuf, im_image->width, im_image->height, GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(im_image->image, new_image); + g_object_unref(G_OBJECT(new_image)); + } } -void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter) +/** + * Adds a GTK+ IM/HTML scalable image to a given GTK+ IM/HTML at a given iter. + * + * @param scale The GTK+ IM/HTML scalable. + * @param imhtml The GTK+ IM/HTML. + * @param iter The GtkTextIter at which to add the scalable. + */ +static void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter) { GtkIMHtmlImage *image = (GtkIMHtmlImage *)scale; GtkWidget *box = gtk_event_box_new(); @@ -3994,6 +3903,115 @@ void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTex g_object_set_data_full(G_OBJECT(box), "image-save-data", save, (GDestroyNotify)g_free); } +/* GtkIMHtmlScalable, gtk_imhtml_image, gtk_imhtml_hr */ +GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id) +{ + GtkIMHtmlImage *im_image = g_malloc(sizeof(GtkIMHtmlImage)); + + GTK_IMHTML_SCALABLE(im_image)->scale = gtk_imhtml_image_scale; + GTK_IMHTML_SCALABLE(im_image)->add_to = gtk_imhtml_image_add_to; + GTK_IMHTML_SCALABLE(im_image)->free = gtk_imhtml_image_free; + + im_image->pixbuf = img; + im_image->image = GTK_IMAGE(gtk_image_new_from_pixbuf(im_image->pixbuf)); + im_image->width = gdk_pixbuf_get_width(img); + im_image->height = gdk_pixbuf_get_height(img); + im_image->mark = NULL; + im_image->filename = g_strdup(filename); + im_image->id = id; + im_image->filesel = NULL; + + g_object_ref(img); + return GTK_IMHTML_SCALABLE(im_image); +} + +static gboolean +animate_image_cb(gpointer data) +{ + GtkIMHtmlImage *im_image; + int width, height; + int delay; + + im_image = data; + + /* Update the pointer to this GdkPixbuf frame of the animation */ + if (gdk_pixbuf_animation_iter_advance(GTK_IMHTML_ANIMATION(im_image)->iter, NULL)) { + GdkPixbuf *pb = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); + g_object_unref(G_OBJECT(im_image->pixbuf)); + im_image->pixbuf = gdk_pixbuf_copy(pb); + + /* Update the displayed GtkImage */ + width = gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)); + height = gdk_pixbuf_get_height(gtk_image_get_pixbuf(im_image->image)); + if (width > 0 && height > 0) + { + /* Need to scale the new frame to the same size as the old frame */ + GdkPixbuf *tmp; + tmp = gdk_pixbuf_scale_simple(im_image->pixbuf, width, height, GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(im_image->image, tmp); + g_object_unref(G_OBJECT(tmp)); + } else { + /* Display at full-size */ + gtk_image_set_from_pixbuf(im_image->image, im_image->pixbuf); + } + } + + delay = MIN(gdk_pixbuf_animation_iter_get_delay_time(GTK_IMHTML_ANIMATION(im_image)->iter), 100); + GTK_IMHTML_ANIMATION(im_image)->timer = g_timeout_add(delay, animate_image_cb, im_image); + + return FALSE; +} + +/** + * Creates and returns a new GTK+ IM/HTML scalable object with an + * animated image. + * + * @param img A GdkPixbufAnimation of the image to add. + * @param filename The filename to associate with the image. + * @param id The id to associate with the image. + * + * @return A new IM/HTML Scalable object with an image. + * + * @since 2.1.0 + */ +/* + * TODO: All this animation code could be combined much better with + * the image code. It couldn't be done when it was written + * because it requires breaking backward compatibility. It + * would be good to do it for 3.0.0. + */ +static GtkIMHtmlScalable *gtk_imhtml_animation_new(GdkPixbufAnimation *anim, const gchar *filename, int id) +{ + GtkIMHtmlImage *im_image = (GtkIMHtmlImage *) g_new0(GtkIMHtmlAnimation, 1); + + GTK_IMHTML_SCALABLE(im_image)->scale = gtk_imhtml_image_scale; + GTK_IMHTML_SCALABLE(im_image)->add_to = gtk_imhtml_image_add_to; + GTK_IMHTML_SCALABLE(im_image)->free = gtk_imhtml_animation_free; + + GTK_IMHTML_ANIMATION(im_image)->anim = anim; + if (gdk_pixbuf_animation_is_static_image(anim)) { + im_image->pixbuf = gdk_pixbuf_animation_get_static_image(anim); + g_object_ref(im_image->pixbuf); + } else { + int delay; + GdkPixbuf *pb; + GTK_IMHTML_ANIMATION(im_image)->iter = gdk_pixbuf_animation_get_iter(anim, NULL); + pb = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); + im_image->pixbuf = gdk_pixbuf_copy(pb); + delay = MIN(gdk_pixbuf_animation_iter_get_delay_time(GTK_IMHTML_ANIMATION(im_image)->iter), 100); + GTK_IMHTML_ANIMATION(im_image)->timer = g_timeout_add(delay, animate_image_cb, im_image); + } + im_image->image = GTK_IMAGE(gtk_image_new_from_pixbuf(im_image->pixbuf)); + im_image->width = gdk_pixbuf_animation_get_width(anim); + im_image->height = gdk_pixbuf_animation_get_height(anim); + im_image->filename = g_strdup(filename); + im_image->id = id; + + g_object_ref(anim); + + return GTK_IMHTML_SCALABLE(im_image); +} + GtkIMHtmlScalable *gtk_imhtml_hr_new() { GtkIMHtmlHr *hr = g_malloc(sizeof(GtkIMHtmlHr)); @@ -4918,6 +4936,30 @@ static void animated_smiley_destroy_cb(GtkObject *widget, GtkIMHtml *imhtml) } } +static gboolean gtk_imhtml_smiley_clicked(GtkWidget *w, GdkEvent *event, GtkIMHtmlSmiley *smiley) +{ + GdkPixbufAnimation *anim = NULL; + GtkIMHtmlImageSave *save = NULL; + gboolean ret; + + if (event->type != GDK_BUTTON_RELEASE || ((GdkEventButton*)event)->button != 3) + return FALSE; + + anim = gtk_smiley_get_image(smiley); + if (!anim) + return FALSE; + + save = g_new0(GtkIMHtmlImageSave, 1); + save->image = (GtkIMHtmlScalable *)gtk_imhtml_animation_new(anim, smiley->smile, 0); + save->data = smiley->data; /* Do not need to memdup here, since the smiley is not + destroyed before this GtkIMHtmlImageSave */ + save->datasize = smiley->datasize; + ret = gtk_imhtml_image_clicked(w, event, save); + g_object_set_data_full(G_OBJECT(w), "image-data", save->image, (GDestroyNotify)gtk_imhtml_animation_free); + g_object_set_data_full(G_OBJECT(w), "image-save-data", save, (GDestroyNotify)g_free); + return ret; +} + void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter) { GdkPixbuf *pixbuf = NULL; diff --git a/pidgin/gtkimhtml.h b/pidgin/gtkimhtml.h index 414ff36a22..c02b7a08f4 100644 --- a/pidgin/gtkimhtml.h +++ b/pidgin/gtkimhtml.h @@ -426,62 +426,6 @@ GtkIMHtmlScalable *gtk_imhtml_scalable_new(void); */ GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id); -/** - * Creates and returns a new GTK+ IM/HTML scalable object with an - * animated image. - * - * @param img A GdkPixbufAnimation of the image to add. - * @param filename The filename to associate with the image. - * @param id The id to associate with the image. - * - * @return A new IM/HTML Scalable object with an image. - * - * @since 2.1.0 - */ -/* - * TODO: All this animation code could be combined much better with - * the image code. It couldn't be done when it was written - * because it requires breaking backward compatibility. It - * would be good to do it for 3.0.0. - */ -GtkIMHtmlScalable *gtk_imhtml_animation_new(GdkPixbufAnimation *img, const gchar *filename, int id); - -/** - * Destroys and frees a GTK+ IM/HTML scalable image. - * - * @param scale The GTK+ IM/HTML scalable. - */ -/* TODO: Is there any reason this isn't private? */ -void gtk_imhtml_image_free(GtkIMHtmlScalable *scale); - -/** - * Destroys and frees a GTK+ IM/HTML scalable animation. - * - * @param scale The GTK+ IM/HTML scalable. - */ -/* TODO: Is there any reason this isn't private? */ -void gtk_imhtml_animation_free(GtkIMHtmlScalable *scale); - -/** - * Rescales a GTK+ IM/HTML scalable image to a given size. - * - * @param scale The GTK+ IM/HTML scalable. - * @param width The new width. - * @param height The new height. - */ -/* TODO: Is there any reason this isn't private? */ -void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height); - -/** - * Adds a GTK+ IM/HTML scalable image to a given GTK+ IM/HTML at a given iter. - * - * @param scale The GTK+ IM/HTML scalable. - * @param imhtml The GTK+ IM/HTML. - * @param iter The GtkTextIter at which to add the scalable. - */ -/* TODO: Is there any reason this isn't private? */ -void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); - /** * Creates and returns an new GTK+ IM/HTML scalable with a horizontal rule. * diff --git a/pidgin/plugins/perl/common/GtkIMHtml.xs b/pidgin/plugins/perl/common/GtkIMHtml.xs index 992cb6b7f2..ccbf43f512 100644 --- a/pidgin/plugins/perl/common/GtkIMHtml.xs +++ b/pidgin/plugins/perl/common/GtkIMHtml.xs @@ -323,19 +323,6 @@ PPCODE: } XPUSHs(sv_2mortal(newRV_noinc((SV *)lines))); -MODULE = Pidgin::IMHtml PACKAGE = Pidgin::IMHtml::Scalable PREFIX = gtk_imhtml_image_ -PROTOTYPES: ENABLE - -void -gtk_imhtml_image_free(scale) - Pidgin::IMHtml::Scalable scale - -void -gtk_imhtml_image_scale(scale, width, height) - Pidgin::IMHtml::Scalable scale - int width - int height - MODULE = Pidgin::IMHtml PACKAGE = Pidgin::IMHtml::Hr PREFIX = gtk_imhtml_hr_ PROTOTYPES: ENABLE -- cgit v1.2.1 From eb1d2bff3576991cb3eab94e0e332a9747aa0d82 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Thu, 1 Sep 2011 07:32:09 +0000 Subject: Make another gtkimhtml function private. I'm definitely hoping we can get rid of all this code and switch to webkit for 3.0.0. I haven't tried the branch. --- ChangeLog.API | 1 + pidgin/gtkimhtml.c | 12 ++++++++++-- pidgin/gtkimhtml.h | 11 ----------- pidgin/plugins/perl/common/GtkIMHtml.xs | 20 -------------------- 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index a4afd05753..fec13536e6 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -87,6 +87,7 @@ version 3.0.0 (??/??/????): * gtk_imhtml_animation_new * gtk_imhtml_image_add_to * gtk_imhtml_image_free + * gtk_imhtml_image_new * gtk_imhtml_image_scale * pidgin_blist_update_account_error_state * pidgin_check_if_dir diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index d299d8dca6..75eeabeb61 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -3903,8 +3903,16 @@ static void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, g_object_set_data_full(G_OBJECT(box), "image-save-data", save, (GDestroyNotify)g_free); } -/* GtkIMHtmlScalable, gtk_imhtml_image, gtk_imhtml_hr */ -GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id) +/** + * Creates and returns a new GTK+ IM/HTML scalable object with an image. + * + * @param img A GdkPixbuf of the image to add. + * @param filename The filename to associate with the image. + * @param id The id to associate with the image. + * + * @return A new IM/HTML Scalable object with an image. + */ +static GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id) { GtkIMHtmlImage *im_image = g_malloc(sizeof(GtkIMHtmlImage)); diff --git a/pidgin/gtkimhtml.h b/pidgin/gtkimhtml.h index c02b7a08f4..656d106d73 100644 --- a/pidgin/gtkimhtml.h +++ b/pidgin/gtkimhtml.h @@ -415,17 +415,6 @@ void gtk_imhtml_page_down(GtkIMHtml *imhtml); */ GtkIMHtmlScalable *gtk_imhtml_scalable_new(void); -/** - * Creates and returns a new GTK+ IM/HTML scalable object with an image. - * - * @param img A GdkPixbuf of the image to add. - * @param filename The filename to associate with the image. - * @param id The id to associate with the image. - * - * @return A new IM/HTML Scalable object with an image. - */ -GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id); - /** * Creates and returns an new GTK+ IM/HTML scalable with a horizontal rule. * diff --git a/pidgin/plugins/perl/common/GtkIMHtml.xs b/pidgin/plugins/perl/common/GtkIMHtml.xs index ccbf43f512..8a76f05576 100644 --- a/pidgin/plugins/perl/common/GtkIMHtml.xs +++ b/pidgin/plugins/perl/common/GtkIMHtml.xs @@ -77,26 +77,6 @@ gtk_imhtml_get_text(imhtml, start, end) Gtk::TextIter end */ -/* This can't work at the moment since I don't have a typemap for Gdk::Pixbuf. - * I thought about using the one from libgtk2-perl but wasn't sure how to go - * about doing that. -Pidgin::IMHtml::Scalable -gtk_imhtml_image_new(img, filename, id) - Gdk::Pixbuf img - const gchar * filename - int id -*/ - -/* This can't work at the moment since I don't have a typemap for Gtk::Widget. - * I thought about using the one from libgtk2-perl but wasn't sure how to go - * about doing that. -void -gtk_imhtml_image_add_to(scale, imhtml, iter) - Pidgin::IMHtml::Scalable scale - Pidgin::IMHtml imhtml - Gtk::TextIter iter -*/ - /* This can't work at the moment since I don't have a typemap for Gtk::Widget. * I thought about using the one from libgtk2-perl but wasn't sure how to go * about doing that. -- cgit v1.2.1 From 0698876e254166b248365cca628afff65534c25d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 01:57:25 +0000 Subject: Replace purple_dnsquery_a_account with purple_dnsquery_a. --- ChangeLog.API | 4 +++- libpurple/dnsquery.c | 9 +-------- libpurple/dnsquery.h | 23 ++--------------------- libpurple/network.c | 4 ++-- libpurple/protocols/jabber/disco.c | 2 +- libpurple/protocols/jabber/google/jingleinfo.c | 2 +- libpurple/protocols/simple/simple.c | 2 +- libpurple/protocols/yahoo/yahoo_filexfer.c | 4 ++-- libpurple/proxy.c | 8 ++++---- libpurple/stun.c | 2 +- 10 files changed, 18 insertions(+), 42 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index fec13536e6..8a133c3674 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -61,6 +61,7 @@ version 3.0.0 (??/??/????): the first parameter * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter + * purple_dnsquery_a now takes a PurpleAccount as the first parameter Removed: * _GntFileType @@ -98,6 +99,7 @@ version 3.0.0 (??/??/????): * PidginConversation.sg * purple_connection_error_reason * purple_core_migrate + * purple_dnsquery_a_account * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count @@ -107,7 +109,7 @@ version 3.0.0 (??/??/????): * purple_strlcat * purple_strlcpy * purple_util_fetch_url_request_len_with_account. Use - purple_util_fetch_url_request_len, insetad. + purple_util_fetch_url_request_len, instead. * PurpleConnectionUiOps.report_disconnect_reason * struct _GtkIMHtmlFontDetail * struct _PurpleMenuAction diff --git a/libpurple/dnsquery.c b/libpurple/dnsquery.c index 343a07f815..bb98db553d 100644 --- a/libpurple/dnsquery.c +++ b/libpurple/dnsquery.c @@ -914,7 +914,7 @@ initiate_resolving(gpointer data) } PurpleDnsQueryData * -purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port, +purple_dnsquery_a(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data) { PurpleDnsQueryData *query_data; @@ -944,13 +944,6 @@ purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port return query_data; } -PurpleDnsQueryData * -purple_dnsquery_a(const char *hostname, int port, - PurpleDnsQueryConnectFunction callback, gpointer data) -{ - return purple_dnsquery_a_account(NULL, hostname, port, callback, data); -} - void purple_dnsquery_destroy(PurpleDnsQueryData *query_data) { diff --git a/libpurple/dnsquery.h b/libpurple/dnsquery.h index dde19983f6..84183f4383 100644 --- a/libpurple/dnsquery.h +++ b/libpurple/dnsquery.h @@ -88,7 +88,7 @@ extern "C" { /** * Perform an asynchronous DNS query. * - * @param account the account that the query is being done for (or NULL) + * @param account The account that the query is being done for (or NULL) * @param hostname The hostname to resolve. * @param port A port number which is stored in the struct sockaddr. * @param callback The callback function to call after resolving. @@ -98,27 +98,8 @@ extern "C" { * a data structure that can be used to cancel the pending * DNS query, if needed. * - * @since 2.8.0 */ -PurpleDnsQueryData *purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSQUERY_C_) -/** - * Perform an asynchronous DNS query. - * - * @param hostname The hostname to resolve. - * @param port A port number which is stored in the struct sockaddr. - * @param callback The callback function to call after resolving. - * @param data Extra data to pass to the callback function. - * - * @return NULL if there was an error, otherwise return a reference to - * a data structure that can be used to cancel the pending - * DNS query, if needed. - * - * @deprecated Use purple_dnsquery_a_account instead - */ -PurpleDnsQueryData *purple_dnsquery_a(const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data); -#endif +PurpleDnsQueryData *purple_dnsquery_a(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data); /** * Cancel a DNS query and destroy the associated data structure. diff --git a/libpurple/network.c b/libpurple/network.c index 54e8b38361..1d86947ea9 100644 --- a/libpurple/network.c +++ b/libpurple/network.c @@ -991,7 +991,7 @@ purple_network_set_stun_server(const gchar *stun_server) if (stun_server && stun_server[0] != '\0') { if (purple_network_is_available()) { purple_debug_info("network", "running DNS query for STUN server\n"); - purple_dnsquery_a_account(NULL, stun_server, 3478, purple_network_ip_lookup_cb, + purple_dnsquery_a(NULL, stun_server, 3478, purple_network_ip_lookup_cb, &stun_ip); } else { purple_debug_info("network", @@ -1009,7 +1009,7 @@ purple_network_set_turn_server(const gchar *turn_server) if (turn_server && turn_server[0] != '\0') { if (purple_network_is_available()) { purple_debug_info("network", "running DNS query for TURN server\n"); - purple_dnsquery_a_account(NULL, turn_server, + purple_dnsquery_a(NULL, turn_server, purple_prefs_get_int("/purple/network/turn_port"), purple_network_ip_lookup_cb, &turn_ip); } else { diff --git a/libpurple/protocols/jabber/disco.c b/libpurple/protocols/jabber/disco.c index e66a0cb05d..15cac45b07 100644 --- a/libpurple/protocols/jabber/disco.c +++ b/libpurple/protocols/jabber/disco.c @@ -485,7 +485,7 @@ jabber_disco_stun_srv_resolve_cb(PurpleSrvResponse *resp, int results, gpointer resp[0].hostname, resp[0].port); account = purple_connection_get_account(js->gc); js->stun_query = - purple_dnsquery_a_account(account, resp[0].hostname, resp[0].port, + purple_dnsquery_a(account, resp[0].hostname, resp[0].port, jabber_disco_stun_lookup_cb, js); } } diff --git a/libpurple/protocols/jabber/google/jingleinfo.c b/libpurple/protocols/jabber/google/jingleinfo.c index b49642a40e..81deb9d08c 100644 --- a/libpurple/protocols/jabber/google/jingleinfo.c +++ b/libpurple/protocols/jabber/google/jingleinfo.c @@ -117,7 +117,7 @@ jabber_google_jingle_info_common(JabberStream *js, const char *from, purple_dnsquery_destroy(js->stun_query); account = purple_connection_get_account(js->gc); - js->stun_query = purple_dnsquery_a_account(account, host, port, + js->stun_query = purple_dnsquery_a(account, host, port, jabber_google_stun_lookup_cb, js); } } diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index 7759264c50..018b65b107 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -1904,7 +1904,7 @@ static void srvresolved(PurpleSrvResponse *resp, int results, gpointer data) { } else { /* UDP */ purple_debug_info("simple", "using udp with server %s and port %d\n", hostname, port); - sip->query_data = purple_dnsquery_a_account(sip->account, hostname, + sip->query_data = purple_dnsquery_a(sip->account, hostname, port, simple_udp_host_resolved, sip); if (sip->query_data == NULL) { purple_connection_error(sip->gc, diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index 8a122e7a2d..15b09fe05f 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -1681,13 +1681,13 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) account = purple_connection_get_account(gc); if (yd->jp) { - purple_dnsquery_a_account(account, YAHOOJP_XFER_RELAY_HOST, + purple_dnsquery_a(account, YAHOOJP_XFER_RELAY_HOST, YAHOOJP_XFER_RELAY_PORT, yahoo_xfer_dns_connected_15, xfer); } else { - purple_dnsquery_a_account(account, YAHOO_XFER_RELAY_HOST, + purple_dnsquery_a(account, YAHOO_XFER_RELAY_HOST, YAHOO_XFER_RELAY_PORT, yahoo_xfer_dns_connected_15, xfer); } diff --git a/libpurple/proxy.c b/libpurple/proxy.c index 8606f51407..b9245f6e68 100644 --- a/libpurple/proxy.c +++ b/libpurple/proxy.c @@ -1369,7 +1369,7 @@ s4_canwrite(gpointer data, gint source, PurpleInputCondition cond) proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); } else { - connect_data->query_data = purple_dnsquery_a_account( + connect_data->query_data = purple_dnsquery_a( connect_data->account, connect_data->host, connect_data->port, s4_host_resolved, connect_data); @@ -2088,7 +2088,7 @@ proxy_connect_socks5(PurpleProxyConnectData *connect_data, struct sockaddr *addr /** * This function attempts to connect to the next IP address in the list - * of IP addresses returned to us by purple_dnsquery_a() and attemps + * of IP addresses returned to us by purple_dnsquery_a() and attempts * to connect to each one. This is called after the hostname is * resolved, and each time a connection attempt fails (assuming there * is another IP address to try). @@ -2317,7 +2317,7 @@ purple_proxy_connect(void *handle, PurpleAccount *account, return NULL; } - connect_data->query_data = purple_dnsquery_a_account(account, connecthost, + connect_data->query_data = purple_dnsquery_a(account, connecthost, connectport, connection_host_resolved, connect_data); if (connect_data->query_data == NULL) { @@ -2385,7 +2385,7 @@ purple_proxy_connect_udp(void *handle, PurpleAccount *account, return NULL; } - connect_data->query_data = purple_dnsquery_a_account(account, connecthost, + connect_data->query_data = purple_dnsquery_a(account, connecthost, connectport, connection_host_resolved, connect_data); if (connect_data->query_data == NULL) { diff --git a/libpurple/stun.c b/libpurple/stun.c index 809bf6b86f..e4f966e0ae 100644 --- a/libpurple/stun.c +++ b/libpurple/stun.c @@ -365,7 +365,7 @@ static void do_test1(PurpleSrvResponse *resp, int results, gpointer sdata) { purple_debug_info("stun", "got %d SRV responses, server: %s, port: %d\n", results, servername, port); - purple_dnsquery_a_account(NULL, servername, port, hbn_cb, NULL); + purple_dnsquery_a(NULL, servername, port, hbn_cb, NULL); g_free(resp); } -- cgit v1.2.1 From 529a0b92745b701dbd4ab06bc0eb7762b01e8099 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 01:58:56 +0000 Subject: Remove unnecessary @since tag. --- libpurple/imgstore.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libpurple/imgstore.h b/libpurple/imgstore.h index cd29bc6f5d..f647bf32e8 100644 --- a/libpurple/imgstore.h +++ b/libpurple/imgstore.h @@ -68,7 +68,6 @@ purple_imgstore_add(gpointer data, size_t size, const char *filename); * @param path The path to the image. * * @return The stored image. - * @since 2.X.X */ PurpleStoredImage * purple_imgstore_new_from_file(const char *path); -- cgit v1.2.1 From 727dbcacff39564e890c3e01be2b584e69eaadfc Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 02:42:39 +0000 Subject: Hide PurpleProxyInfo struct. --- ChangeLog.API | 1 + libpurple/protocols/yahoo/libymsg.c | 2 +- libpurple/proxy.c | 10 ++++++++++ libpurple/proxy.h | 11 +---------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 8a133c3674..f1218948a2 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -114,6 +114,7 @@ version 3.0.0 (??/??/????): * struct _GtkIMHtmlFontDetail * struct _PurpleMenuAction * struct _PurplePounce + * struct _PurpleProxyInfo * struct _PurpleRequestField * struct _PurpleRoomlist * struct _PurpleRoomlistField diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 740dd2a097..4914d777be 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -4476,7 +4476,7 @@ static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str); /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) + if ((gc->account->proxy_info) && (purple_proxy_info_get_type(gc->account->proxy_info) == PURPLE_PROXY_HTTP)) use_whole_url = TRUE; url_data = purple_util_fetch_url_request_len( diff --git a/libpurple/proxy.c b/libpurple/proxy.c index b9245f6e68..8afac03190 100644 --- a/libpurple/proxy.c +++ b/libpurple/proxy.c @@ -41,6 +41,16 @@ #include "proxy.h" #include "util.h" +struct _PurpleProxyInfo +{ + PurpleProxyType type; /**< The proxy type. */ + + char *host; /**< The host. */ + int port; /**< The port number. */ + char *username; /**< The username. */ + char *password; /**< The password. */ +}; + struct _PurpleProxyConnectData { void *handle; PurpleProxyConnectFunction connect_cb; diff --git a/libpurple/proxy.h b/libpurple/proxy.h index cf91ee8c71..5bd963a8d8 100644 --- a/libpurple/proxy.h +++ b/libpurple/proxy.h @@ -47,16 +47,7 @@ typedef enum /** * Information on proxy settings. */ -typedef struct -{ - PurpleProxyType type; /**< The proxy type. */ - - char *host; /**< The host. */ - int port; /**< The port number. */ - char *username; /**< The username. */ - char *password; /**< The password. */ - -} PurpleProxyInfo; +typedef struct _PurpleProxyInfo PurpleProxyInfo; typedef struct _PurpleProxyConnectData PurpleProxyConnectData; -- cgit v1.2.1 From 9bf7b1c52cefb56d8d8b393291afc2d835e66daf Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 03:18:15 +0000 Subject: Clean up SRV/TXT query functions. * Rename _account functions to their regular form. * Remove the unnecessary _cancel functions. --- ChangeLog.API | 6 +++ libpurple/dnssrv.c | 30 +------------ libpurple/dnssrv.h | 88 +++++++++---------------------------- libpurple/protocols/jabber/disco.c | 2 +- libpurple/protocols/jabber/jabber.c | 6 +-- libpurple/protocols/simple/simple.c | 4 +- libpurple/stun.c | 2 +- 7 files changed, 36 insertions(+), 102 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index f1218948a2..c70fc6dba6 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -62,6 +62,8 @@ version 3.0.0 (??/??/????): * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter * purple_dnsquery_a now takes a PurpleAccount as the first parameter + * purple_srv_resolve now takes a PurpleAccount as the first parameter + * purple_txt_resolve now takes a PurpleAccount as the first parameter Removed: * _GntFileType @@ -104,10 +106,14 @@ version 3.0.0 (??/??/????): * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count * purple_notify_searchresults_row_get + * purple_srv_cancel + * purple_srv_resolve_account * purple_status_type_get_primary_attr * purple_status_type_set_primary_attr * purple_strlcat * purple_strlcpy + * purple_txt_cancel + * purple_txt_resolve_account * purple_util_fetch_url_request_len_with_account. Use purple_util_fetch_url_request_len, instead. * PurpleConnectionUiOps.report_disconnect_reason diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c index 5befb1f342..f72117ae6b 100644 --- a/libpurple/dnssrv.c +++ b/libpurple/dnssrv.c @@ -725,15 +725,7 @@ res_thread(gpointer data) #endif PurpleSrvTxtQueryData * -purple_srv_resolve(const char *protocol, const char *transport, - const char *domain, PurpleSrvCallback cb, gpointer extradata) -{ - return purple_srv_resolve_account(NULL, protocol, transport, domain, - cb, extradata); -} - -PurpleSrvTxtQueryData * -purple_srv_resolve_account(PurpleAccount *account, const char *protocol, +purple_srv_resolve(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata) { @@ -869,13 +861,7 @@ purple_srv_resolve_account(PurpleAccount *account, const char *protocol, #endif } -PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, - const char *domain, PurpleTxtCallback cb, gpointer extradata) -{ - return purple_txt_resolve_account(NULL, owner, domain, cb, extradata); -} - -PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, +PurpleSrvTxtQueryData *purple_txt_resolve(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata) { @@ -1006,18 +992,6 @@ PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, #endif } -void -purple_txt_cancel(PurpleSrvTxtQueryData *query_data) -{ - purple_srv_txt_query_destroy(query_data); -} - -void -purple_srv_cancel(PurpleSrvTxtQueryData *query_data) -{ - purple_srv_txt_query_destroy(query_data); -} - const gchar * purple_txt_response_get_content(PurpleTxtResponse *resp) { diff --git a/libpurple/dnssrv.h b/libpurple/dnssrv.h index 1f2005d800..0a8d24f14f 100644 --- a/libpurple/dnssrv.h +++ b/libpurple/dnssrv.h @@ -99,86 +99,40 @@ typedef void (*PurpleTxtCallback)(GList *responses, gpointer data); /** * Queries an SRV record. * - * @param account the account that the query is being done for (or NULL) - * @param protocol Name of the protocol (e.g. "sip") + * @param account The account that the query is being done for (or NULL) + * @param protocol Name of the protocol (e.g. "sip") * @param transport Name of the transport ("tcp" or "udp") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results + * @param domain Domain name to query (e.g. "blubb.com") + * @param cb A callback which will be called with the results * @param extradata Extra data to be passed to the callback * - * @since 2.8.0 + * @return NULL if there was an error, otherwise return a reference to + * a data structure that can be used to cancel the pending + * DNS query, if needed. */ -PurpleSrvTxtQueryData *purple_srv_resolve_account(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); +PurpleSrvTxtQueryData *purple_srv_resolve(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_) -/** - * Queries an SRV record. - * - * @param protocol Name of the protocol (e.g. "sip") - * @param transport Name of the transport ("tcp" or "udp") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results - * @param extradata Extra data to be passed to the callback - * - * @deprecated Use purple_srv_resolve_account instead - */ -PurpleSrvTxtQueryData *purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); -#endif - -/** - * Cancel an SRV or DNS query. - * - * @param query_data The request to cancel. - * - * @deprecated Use purple_srv_txt_query_destroy instead - */ -void purple_srv_cancel(PurpleSrvTxtQueryData *query_data); - -/** - * Queries an TXT record. - * - * @param account the account that the query is being done for (or NULL) - * @param owner Name of the protocol (e.g. "_xmppconnect") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results - * @param extradata Extra data to be passed to the callback - * - * @since 2.8.0 - */ -PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_) /** * Queries an TXT record. * - * @param owner Name of the protocol (e.g. "_xmppconnect") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results + * @param account The account that the query is being done for (or NULL) + * @param owner Name of the protocol (e.g. "_xmppconnect") + * @param domain Domain name to query (e.g. "blubb.com") + * @param cb A callback which will be called with the results * @param extradata Extra data to be passed to the callback * - * @deprecated Use purple_txt_resolve_account instead - * - * @since 2.6.0 + * @return NULL if there was an error, otherwise return a reference to + * a data structure that can be used to cancel the pending + * DNS query, if needed. */ -PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); -#endif - -/** - * Cancel an TXT DNS query. - * - * @param query_data The request to cancel. - * @since 2.6.0 - * - * @deprecated Use purple_srv_txt_query_destroy instead - */ -void purple_txt_cancel(PurpleSrvTxtQueryData *query_data); +PurpleSrvTxtQueryData *purple_txt_resolve(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); /** * Get the value of the current TXT record. * * @param response The TXT response record - * @returns The value of the current TXT record. - * @since 2.6.0 + * + * @return The value of the current TXT record. */ const gchar *purple_txt_response_get_content(PurpleTxtResponse *response); @@ -186,7 +140,6 @@ const gchar *purple_txt_response_get_content(PurpleTxtResponse *response); * Destroy a TXT DNS response object. * * @param response The PurpleTxtResponse to destroy. - * @since 2.6.0 */ void purple_txt_response_destroy(PurpleTxtResponse *response); @@ -216,7 +169,7 @@ void purple_srv_txt_query_set_ui_ops(PurpleSrvTxtQueryUiOps *ops); PurpleSrvTxtQueryUiOps *purple_srv_txt_query_get_ui_ops(void); /** - * Get the query from a PurpleDnsQueryData + * Get the query from a PurpleSrvTxtQueryData * * @param query_data The SRV/TXT query * @return The query. @@ -224,7 +177,7 @@ PurpleSrvTxtQueryUiOps *purple_srv_txt_query_get_ui_ops(void); char *purple_srv_txt_query_get_query(PurpleSrvTxtQueryData *query_data); /** - * Get the type from a PurpleDnsQueryData (TXT or SRV) + * Get the type from a PurpleSrvTxtQueryData (TXT or SRV) * * @param query_data The query * @return The query. @@ -236,3 +189,4 @@ int purple_srv_txt_query_get_type(PurpleSrvTxtQueryData *query_data); #endif #endif /* _PURPLE_DNSSRV_H */ + diff --git a/libpurple/protocols/jabber/disco.c b/libpurple/protocols/jabber/disco.c index 15cac45b07..236c17fde4 100644 --- a/libpurple/protocols/jabber/disco.c +++ b/libpurple/protocols/jabber/disco.c @@ -550,7 +550,7 @@ jabber_disco_server_info_result_cb(JabberStream *js, const char *from, } else if (purple_network_get_stun_ip() == NULL || purple_strequal(purple_network_get_stun_ip(), "")) { js->srv_query_data = - purple_srv_resolve_account( + purple_srv_resolve( purple_connection_get_account(js->gc), "stun", "udp", js->user->domain, jabber_disco_stun_srv_resolve_cb, js); diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index dc6d088777..a060e07d40 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -813,7 +813,7 @@ jabber_login_callback(gpointer data, gint source, const gchar *error) try_srv_connect(js); } else { purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain); - js->srv_query_data = purple_txt_resolve_account( + js->srv_query_data = purple_txt_resolve( purple_connection_get_account(gc), "_xmppconnect", js->user->domain, txt_resolved_cb, js); } @@ -1074,7 +1074,7 @@ jabber_stream_connect(JabberStream *js) jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222), TRUE); } else { - js->srv_query_data = purple_srv_resolve_account(account, "xmpp-client", + js->srv_query_data = purple_srv_resolve(account, "xmpp-client", "tcp", js->user->domain, srv_resolved_cb, js); } } @@ -1599,7 +1599,7 @@ void jabber_close(PurpleConnection *gc) jabber_send_raw(js, "", -1); if (js->srv_query_data) - purple_srv_cancel(js->srv_query_data); + purple_srv_txt_query_destroy(js->srv_query_data); if(js->gsc) { purple_ssl_close(js->gsc); diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index 018b65b107..08d92049ba 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -1970,7 +1970,7 @@ static void simple_login(PurpleAccount *account) hosttoconnect = purple_account_get_string(account, "proxy", sip->servername); } - sip->srv_query_data = purple_srv_resolve_account(account, "sip", + sip->srv_query_data = purple_srv_resolve(account, "sip", sip->udp ? "udp" : "tcp", hosttoconnect, srvresolved, sip); } @@ -2007,7 +2007,7 @@ static void simple_close(PurpleConnection *gc) purple_dnsquery_destroy(sip->query_data); if (sip->srv_query_data != NULL) - purple_srv_cancel(sip->srv_query_data); + purple_srv_txt_query_destroy(sip->srv_query_data); if (sip->listen_data != NULL) purple_network_listen_cancel(sip->listen_data); diff --git a/libpurple/stun.c b/libpurple/stun.c index e4f966e0ae..5ece26580e 100644 --- a/libpurple/stun.c +++ b/libpurple/stun.c @@ -424,7 +424,7 @@ PurpleStunNatDiscovery *purple_stun_discover(StunCallback cb) { nattype.servername = g_strdup(servername); callbacks = g_slist_append(callbacks, cb); - purple_srv_resolve_account(NULL, "stun", "udp", servername, do_test1, + purple_srv_resolve(NULL, "stun", "udp", servername, do_test1, (gpointer) servername); return &nattype; -- cgit v1.2.1 From c0dbe9534dc48b52f9a17d208ecc9769928bed0c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 03:29:23 +0000 Subject: Remove old serv attention functions. --- ChangeLog.API | 2 ++ libpurple/server.c | 12 ------------ libpurple/server.h | 26 -------------------------- 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index c70fc6dba6..4fce8b90f1 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -117,6 +117,8 @@ version 3.0.0 (??/??/????): * purple_util_fetch_url_request_len_with_account. Use purple_util_fetch_url_request_len, instead. * PurpleConnectionUiOps.report_disconnect_reason + * serv_got_attention + * serv_send_attention * struct _GtkIMHtmlFontDetail * struct _PurpleMenuAction * struct _PurplePounce diff --git a/libpurple/server.c b/libpurple/server.c index 73739720a7..22f41700af 100644 --- a/libpurple/server.c +++ b/libpurple/server.c @@ -325,18 +325,6 @@ PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, return attn; } -void -serv_send_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - purple_prpl_send_attention(gc, who, type_code); -} - -void -serv_got_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - purple_prpl_got_attention(gc, who, type_code); -} - /* * Move a buddy from one group to another on server. diff --git a/libpurple/server.h b/libpurple/server.h index 504011561b..3ddff92036 100644 --- a/libpurple/server.h +++ b/libpurple/server.h @@ -61,32 +61,6 @@ int serv_send_im(PurpleConnection *, const char *, const char *, PurpleMessageF */ PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, guint type_code); -/** Send an attention request message. - * - * @deprecated Use purple_prpl_send_attention() instead. - * - * @param gc The connection to send the message on. - * @param who Whose attention to request. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. 0 if prpl only defines one - * (for example, Yahoo and MSN), but some protocols define more (MySpaceIM). - * - * Note that you can't send arbitrary PurpleAttentionType's, because there is - * only a fixed set of attention commands. - */ -void serv_send_attention(PurpleConnection *gc, const char *who, guint type_code); - -/** Process an incoming attention message. - * - * @deprecated Use purple_prpl_got_attention() instead. - * - * @param gc The connection that received the attention message. - * @param who Who requested your attention. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. - */ -void serv_got_attention(PurpleConnection *gc, const char *who, guint type_code); - void serv_get_info(PurpleConnection *, const char *); void serv_set_info(PurpleConnection *, const char *); -- cgit v1.2.1 From 99aa89944a1d6c9358cb82da6f2ac49dc6631c76 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 03:38:52 +0000 Subject: Hide PurpleAttentionType struct and remove attention @since tags. --- ChangeLog.API | 1 + libpurple/prpl.c | 14 ++++++++++++++ libpurple/prpl.h | 30 ++---------------------------- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 4fce8b90f1..1fc4a78746 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -120,6 +120,7 @@ version 3.0.0 (??/??/????): * serv_got_attention * serv_send_attention * struct _GtkIMHtmlFontDetail + * struct _PurpleAttentionType * struct _PurpleMenuAction * struct _PurplePounce * struct _PurpleProxyInfo diff --git a/libpurple/prpl.c b/libpurple/prpl.c index 7849189d77..1a9c644621 100644 --- a/libpurple/prpl.c +++ b/libpurple/prpl.c @@ -32,6 +32,20 @@ /**************************************************************************/ /** @name Attention Type API */ /**************************************************************************/ + +/** Represents "nudges" and "buzzes" that you may send to a buddy to attract + * their attention (or vice-versa). + */ +struct _PurpleAttentionType +{ + const char *name; /**< Shown in GUI elements */ + const char *incoming_description; /**< Shown when sent */ + const char *outgoing_description; /**< Shown when receied */ + const char *icon_name; /**< Icon to display (optional) */ + const char *unlocalized_name; /**< Unlocalized name for UIs needing it */ +}; + + PurpleAttentionType * purple_attention_type_new(const char *ulname, const char *name, const char *inc_desc, const char *out_desc) diff --git a/libpurple/prpl.h b/libpurple/prpl.h index 51e8575d3e..f5ae9b0062 100644 --- a/libpurple/prpl.h +++ b/libpurple/prpl.h @@ -111,23 +111,6 @@ struct proto_chat_entry { gboolean secret; /**< True if the entry is secret (password) */ }; -/** Represents "nudges" and "buzzes" that you may send to a buddy to attract - * their attention (or vice-versa). - */ -struct _PurpleAttentionType -{ - const char *name; /**< Shown in GUI elements */ - const char *incoming_description; /**< Shown when sent */ - const char *outgoing_description; /**< Shown when receied */ - const char *icon_name; /**< Icon to display (optional) */ - const char *unlocalized_name; /**< Unlocalized name for UIs needing it */ - - /* Reserved fields for future purposes */ - gpointer _reserved2; - gpointer _reserved3; - gpointer _reserved4; -}; - /** * Protocol options * @@ -680,8 +663,8 @@ extern "C" { * should be the same string as @a ulname, with localization. * @param inc_desc A localized description shown when the event is received. * @param out_desc A localized description shown when the event is sent. + * * @return A pointer to the new object. - * @since 2.4.0 */ PurpleAttentionType *purple_attention_type_new(const char *ulname, const char *name, const char *inc_desc, const char *out_desc); @@ -693,7 +676,6 @@ PurpleAttentionType *purple_attention_type_new(const char *ulname, const char *n * @param name The localized name that will be displayed by UIs. This should be * the same string given as the unlocalized name, but with * localization. - * @since 2.4.0 */ void purple_attention_type_set_name(PurpleAttentionType *type, const char *name); @@ -703,7 +685,6 @@ void purple_attention_type_set_name(PurpleAttentionType *type, const char *name) * * @param type The attention type. * @param desc The localized description for incoming events. - * @since 2.4.0 */ void purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const char *desc); @@ -713,7 +694,6 @@ void purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const ch * * @param type The attention type. * @param desc The localized description for outgoing events. - * @since 2.4.0 */ void purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const char *desc); @@ -723,7 +703,6 @@ void purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const ch * @param type The attention type. * @param name The icon's name. * @note Icons are optional for attention events. - * @since 2.4.0 */ void purple_attention_type_set_icon_name(PurpleAttentionType *type, const char *name); @@ -734,7 +713,6 @@ void purple_attention_type_set_icon_name(PurpleAttentionType *type, const char * * @param type The attention type. * @param ulname The unlocalized name. This should be the same string given as * the localized name, but without localization. - * @since 2.4.0 */ void purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const char *ulname); @@ -742,8 +720,8 @@ void purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const * Get the attention type's name as displayed by the UI. * * @param type The attention type. + * * @return The name. - * @since 2.4.0 */ const char *purple_attention_type_get_name(const PurpleAttentionType *type); @@ -752,7 +730,6 @@ const char *purple_attention_type_get_name(const PurpleAttentionType *type); * * @param type The attention type. * @return The description. - * @since 2.4.0 */ const char *purple_attention_type_get_incoming_desc(const PurpleAttentionType *type); @@ -761,7 +738,6 @@ const char *purple_attention_type_get_incoming_desc(const PurpleAttentionType *t * * @param type The attention type. * @return The description. - * @since 2.4.0 */ const char *purple_attention_type_get_outgoing_desc(const PurpleAttentionType *type); @@ -771,7 +747,6 @@ const char *purple_attention_type_get_outgoing_desc(const PurpleAttentionType *t * @param type The attention type. * @return The icon name or @c NULL if unset/empty. * @note Icons are optional for attention events. - * @since 2.4.0 */ const char *purple_attention_type_get_icon_name(const PurpleAttentionType *type); @@ -780,7 +755,6 @@ const char *purple_attention_type_get_icon_name(const PurpleAttentionType *type) * * @param type The attention type * @return The unlocalized name. - * @since 2.4.0 */ const char *purple_attention_type_get_unlocalized_name(const PurpleAttentionType *type); -- cgit v1.2.1 From 064030b1a8daf5098ba66d38d3ec5ec5ef482bb9 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 04:02:11 +0000 Subject: Remove deprecated PurpleStatuc functions. --- libpurple/status.c | 255 ++++++++++++++++++++++------------------------------- libpurple/status.h | 121 ------------------------- 2 files changed, 106 insertions(+), 270 deletions(-) diff --git a/libpurple/status.c b/libpurple/status.c index dc3e6ec66c..1556d2f101 100644 --- a/libpurple/status.c +++ b/libpurple/status.c @@ -257,6 +257,42 @@ purple_status_type_new(PurpleStatusPrimitive primitive, const char *id, user_settable, FALSE); } +static void +status_type_add_attr(PurpleStatusType *status_type, const char *id, + const char *name, PurpleValue *value) +{ + PurpleStatusAttr *attr; + + g_return_if_fail(status_type != NULL); + g_return_if_fail(id != NULL); + g_return_if_fail(name != NULL); + g_return_if_fail(value != NULL); + + attr = purple_status_attr_new(id, name, value); + + status_type->attrs = g_list_append(status_type->attrs, attr); +} + +static void +status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args) +{ + const char *id, *name; + PurpleValue *value; + + g_return_if_fail(status_type != NULL); + + while ((id = va_arg(args, const char *)) != NULL) + { + name = va_arg(args, const char *); + g_return_if_fail(name != NULL); + + value = va_arg(args, PurpleValue *); + g_return_if_fail(value != NULL); + + status_type_add_attr(status_type, id, name, value); + } +} + PurpleStatusType * purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, const char *id, const char *name, @@ -277,10 +313,10 @@ purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, user_settable, independent); /* Add the first attribute */ - purple_status_type_add_attr(status_type, attr_id, attr_name, attr_value); + status_type_add_attr(status_type, attr_id, attr_name, attr_value); va_start(args, attr_value); - purple_status_type_add_attrs_vargs(status_type, args); + status_type_add_attrs_vargs(status_type, args); va_end(args); return status_type; @@ -301,61 +337,6 @@ purple_status_type_destroy(PurpleStatusType *status_type) g_free(status_type); } -void -purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value) -{ - PurpleStatusAttr *attr; - - g_return_if_fail(status_type != NULL); - g_return_if_fail(id != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(value != NULL); - - attr = purple_status_attr_new(id, name, value); - - status_type->attrs = g_list_append(status_type->attrs, attr); -} - -void -purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args) -{ - const char *id, *name; - PurpleValue *value; - - g_return_if_fail(status_type != NULL); - - while ((id = va_arg(args, const char *)) != NULL) - { - name = va_arg(args, const char *); - g_return_if_fail(name != NULL); - - value = va_arg(args, PurpleValue *); - g_return_if_fail(value != NULL); - - purple_status_type_add_attr(status_type, id, name, value); - } -} - -void -purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value, ...) -{ - va_list args; - - g_return_if_fail(status_type != NULL); - g_return_if_fail(id != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(value != NULL); - - /* Add the first attribute */ - purple_status_type_add_attr(status_type, id, name, value); - - va_start(args, value); - purple_status_type_add_attrs_vargs(status_type, args); - va_end(args); -} - PurpleStatusPrimitive purple_status_type_get_primitive(const PurpleStatusType *status_type) { @@ -687,6 +668,68 @@ status_has_changed(PurpleStatus *status) notify_status_update(presence, old_status, status); } +static void +status_set_attr_boolean(PurpleStatus *status, const char *id, + gboolean value) +{ + PurpleValue *attr_value; + + g_return_if_fail(status != NULL); + g_return_if_fail(id != NULL); + + /* Make sure this attribute exists and is the correct type. */ + attr_value = purple_status_get_attr_value(status, id); + g_return_if_fail(attr_value != NULL); + g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_BOOLEAN); + + purple_value_set_boolean(attr_value, value); +} + +static void +status_set_attr_int(PurpleStatus *status, const char *id, int value) +{ + PurpleValue *attr_value; + + g_return_if_fail(status != NULL); + g_return_if_fail(id != NULL); + + /* Make sure this attribute exists and is the correct type. */ + attr_value = purple_status_get_attr_value(status, id); + g_return_if_fail(attr_value != NULL); + g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_INT); + + purple_value_set_int(attr_value, value); +} + +static void +status_set_attr_string(PurpleStatus *status, const char *id, + const char *value) +{ + PurpleValue *attr_value; + + g_return_if_fail(status != NULL); + g_return_if_fail(id != NULL); + + /* Make sure this attribute exists and is the correct type. */ + attr_value = purple_status_get_attr_value(status, id); + /* This used to be g_return_if_fail, but it's failing a LOT, so + * let's generate a log error for now. */ + /* g_return_if_fail(attr_value != NULL); */ + if (attr_value == NULL) { + purple_debug_error("status", + "Attempted to set status attribute '%s' for " + "status '%s', which is not legal. Fix " + "this!\n", id, + purple_status_type_get_name(purple_status_get_type(status))); + return; + } + g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_STRING); + + /* XXX: Check if the value has actually changed. If it has, and the status + * is active, should this trigger 'status_has_changed'? */ + purple_value_set_string(attr_value, value); +} + void purple_status_set_active(PurpleStatus *status, gboolean active) { @@ -769,7 +812,7 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, l = l->next; if (purple_strequal(string_data, purple_value_get_string(value))) continue; - purple_status_set_attr_string(status, id, string_data); + status_set_attr_string(status, id, string_data); changed = TRUE; } else if (purple_value_get_type(value) == PURPLE_TYPE_INT) @@ -778,7 +821,7 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, l = l->next; if (int_data == purple_value_get_int(value)) continue; - purple_status_set_attr_int(status, id, int_data); + status_set_attr_int(status, id, int_data); changed = TRUE; } else if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) @@ -787,7 +830,7 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, l = l->next; if (boolean_data == purple_value_get_boolean(value)) continue; - purple_status_set_attr_boolean(status, id, boolean_data); + status_set_attr_boolean(status, id, boolean_data); changed = TRUE; } else @@ -818,21 +861,21 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, continue; } - purple_status_set_attr_string(status, attr->id, def); + status_set_attr_string(status, attr->id, def); } else if (purple_value_get_type(default_value) == PURPLE_TYPE_INT) { int cur = purple_status_get_attr_int(status, attr->id); int def = purple_value_get_int(default_value); if (cur == def) continue; - purple_status_set_attr_int(status, attr->id, def); + status_set_attr_int(status, attr->id, def); } else if (purple_value_get_type(default_value) == PURPLE_TYPE_BOOLEAN) { gboolean cur = purple_status_get_attr_boolean(status, attr->id); gboolean def = purple_value_get_boolean(default_value); if (cur == def) continue; - purple_status_set_attr_boolean(status, attr->id, def); + status_set_attr_boolean(status, attr->id, def); } changed = TRUE; } @@ -844,68 +887,6 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, status_has_changed(status); } -void -purple_status_set_attr_boolean(PurpleStatus *status, const char *id, - gboolean value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - g_return_if_fail(attr_value != NULL); - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_BOOLEAN); - - purple_value_set_boolean(attr_value, value); -} - -void -purple_status_set_attr_int(PurpleStatus *status, const char *id, int value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - g_return_if_fail(attr_value != NULL); - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_INT); - - purple_value_set_int(attr_value, value); -} - -void -purple_status_set_attr_string(PurpleStatus *status, const char *id, - const char *value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - /* This used to be g_return_if_fail, but it's failing a LOT, so - * let's generate a log error for now. */ - /* g_return_if_fail(attr_value != NULL); */ - if (attr_value == NULL) { - purple_debug_error("status", - "Attempted to set status attribute '%s' for " - "status '%s', which is not legal. Fix " - "this!\n", id, - purple_status_type_get_name(purple_status_get_type(status))); - return; - } - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_STRING); - - /* XXX: Check if the value has actually changed. If it has, and the status - * is active, should this trigger 'status_has_changed'? */ - purple_value_set_string(attr_value, value); -} - PurpleStatusType * purple_status_get_type(const PurpleStatus *status) { @@ -1166,30 +1147,6 @@ purple_presence_destroy(PurplePresence *presence) g_free(presence); } -void -purple_presence_add_status(PurplePresence *presence, PurpleStatus *status) -{ - g_return_if_fail(presence != NULL); - g_return_if_fail(status != NULL); - - presence->statuses = g_list_append(presence->statuses, status); - - g_hash_table_insert(presence->status_table, - g_strdup(purple_status_get_id(status)), status); -} - -void -purple_presence_add_list(PurplePresence *presence, GList *source_list) -{ - GList *l; - - g_return_if_fail(presence != NULL); - g_return_if_fail(source_list != NULL); - - for (l = source_list; l != NULL; l = l->next) - purple_presence_add_status(presence, (PurpleStatus *)l->data); -} - void purple_presence_set_status_active(PurplePresence *presence, const char *status_id, gboolean active) diff --git a/libpurple/status.h b/libpurple/status.h index 7dcce3a26b..a0bed2eb6a 100644 --- a/libpurple/status.h +++ b/libpurple/status.h @@ -271,56 +271,6 @@ PurpleStatusType *purple_status_type_new_with_attrs(PurpleStatusPrimitive primit */ void purple_status_type_destroy(PurpleStatusType *status_type); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds an attribute to a status type. - * - * @param status_type The status type to add the attribute to. - * @param id The ID of the attribute. - * @param name The name presented to the user. - * @param value The value type of this attribute. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds multiple attributes to a status type. - * - * @param status_type The status type to add the attribute to. - * @param id The ID of the first attribute. - * @param name The description of the first attribute. - * @param value The value type of the first attribute attribute. - * @param ... Additional attribute information. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value, ...) G_GNUC_NULL_TERMINATED; -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds multiple attributes to a status type using a va_list. - * - * @param status_type The status type to add the attribute to. - * @param args The va_list of attributes. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, - va_list args); -#endif - /** * Returns the primitive type of a status type. * @@ -552,51 +502,6 @@ void purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active, void purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, GList *attrs); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the boolean value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The boolean value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_boolean(PurpleStatus *status, const char *id, - gboolean value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the integer value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The integer value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_int(PurpleStatus *status, const char *id, - int value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the string value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The string value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_string(PurpleStatus *status, const char *id, - const char *value); -#endif - /** * Returns the status's type. * @@ -803,32 +708,6 @@ PurplePresence *purple_presence_new_for_buddy(PurpleBuddy *buddy); */ void purple_presence_destroy(PurplePresence *presence); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds a status to a presence. - * - * @param presence The presence. - * @param status The status to add. - * - * @deprecated This function is only used by purple_presence_add_list, - * and both should be removed in 3.0.0. - */ -void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds a list of statuses to the presence. - * - * @param presence The presence. - * @param source_list The source list of statuses to add, which is not - * modified or freed by this function. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -void purple_presence_add_list(PurplePresence *presence, GList *source_list); -#endif - /** * Sets the active state of a status in a presence. * -- cgit v1.2.1 From 61c5175e0270ade467cc4aa374c5402ef775757e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 04:23:18 +0000 Subject: Checkin PurpleStatus API changes. --- ChangeLog.API | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ChangeLog.API b/ChangeLog.API index 1fc4a78746..07db89ef90 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -106,8 +106,16 @@ version 3.0.0 (??/??/????): * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count * purple_notify_searchresults_row_get + * purple_presence_add_status + * purple_presence_add_list * purple_srv_cancel * purple_srv_resolve_account + * purple_status_set_attr_boolean + * purple_status_set_attr_int + * purple_status_set_attr_string + * purple_status_type_add_attr + * purple_status_type_add_attrs + * purple_status_type_add_attrs_vargs * purple_status_type_get_primary_attr * purple_status_type_set_primary_attr * purple_strlcat -- cgit v1.2.1 From 7cd0faebbfb7c5a597ce94762a17e0c0bb815ea4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 04:25:04 +0000 Subject: Remove deprecated buddy icon functions and @since tags. --- ChangeLog.API | 3 +++ libpurple/buddyicon.c | 19 ------------------- libpurple/buddyicon.h | 37 ------------------------------------- 3 files changed, 3 insertions(+), 56 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 07db89ef90..5b3ac0b3b2 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -99,6 +99,9 @@ version 3.0.0 (??/??/????): * pidgin_set_custom_buddy_icon * pidgin_setup_screenname_autocomplete * PidginConversation.sg + * purple_buddy_icons_has_custom_icon + * purple_buddy_icons_find_custom_icon + * purple_buddy_icons_set_custom_icon * purple_connection_error_reason * purple_core_migrate * purple_dnsquery_a_account diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c index 26013701c9..4738000290 100644 --- a/libpurple/buddyicon.c +++ b/libpurple/buddyicon.c @@ -955,25 +955,6 @@ purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, return purple_buddy_icons_node_set_custom_icon(node, data, len); } -gboolean -purple_buddy_icons_has_custom_icon(PurpleContact *contact) -{ - return purple_buddy_icons_node_has_custom_icon((PurpleBlistNode*)contact); -} - -PurpleStoredImage * -purple_buddy_icons_find_custom_icon(PurpleContact *contact) -{ - return purple_buddy_icons_node_find_custom_icon((PurpleBlistNode*)contact); -} - -PurpleStoredImage * -purple_buddy_icons_set_custom_icon(PurpleContact *contact, guchar *icon_data, - size_t icon_len) -{ - return purple_buddy_icons_node_set_custom_icon((PurpleBlistNode*)contact, icon_data, icon_len); -} - static void delete_buddy_icon_settings(PurpleBlistNode *node, const char *setting_name) { diff --git a/libpurple/buddyicon.h b/libpurple/buddyicon.h index 7fbecbb9a8..193277e3ed 100644 --- a/libpurple/buddyicon.h +++ b/libpurple/buddyicon.h @@ -275,7 +275,6 @@ purple_buddy_icons_get_account_icon_timestamp(PurpleAccount *account); * @param node The blist node. * * @return A boolean indicating if @a node has a custom buddy icon. - * @since 2.5.0 */ gboolean purple_buddy_icons_node_has_custom_icon(PurpleBlistNode *node); @@ -293,7 +292,6 @@ purple_buddy_icons_node_has_custom_icon(PurpleBlistNode *node); * @param node The node. * * @return The custom buddy icon. - * @since 2.5.0 */ PurpleStoredImage * purple_buddy_icons_node_find_custom_icon(PurpleBlistNode *node); @@ -311,7 +309,6 @@ purple_buddy_icons_node_find_custom_icon(PurpleBlistNode *node); * * @return The icon that was set. The caller does NOT own a reference to this, * and must call purple_imgstore_ref() if it wants one. - * @since 2.5.0 */ PurpleStoredImage * purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, @@ -329,45 +326,11 @@ purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, * * @return The icon that was set. The caller does NOT own a reference to this, * and must call purple_imgstore_ref() if it wants one. - * @since 2.5.0 */ PurpleStoredImage * purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, const gchar *filename); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BUDDYICON_C_) -/** - * PurpleContact version of purple_buddy_icons_node_has_custom_icon. - * - * @copydoc purple_buddy_icons_node_has_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_has_custom_icon instead. - */ -gboolean -purple_buddy_icons_has_custom_icon(PurpleContact *contact); - -/** - * PurpleContact version of purple_buddy_icons_node_find_custom_icon. - * - * @copydoc purple_buddy_icons_node_find_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_find_custom_icon instead. - */ -PurpleStoredImage * -purple_buddy_icons_find_custom_icon(PurpleContact *contact); - -/** - * PurpleContact version of purple_buddy_icons_node_set_custom_icon. - * - * @copydoc purple_buddy_icons_node_set_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_set_custom_icon instead. - */ -PurpleStoredImage * -purple_buddy_icons_set_custom_icon(PurpleContact *contact, - guchar *icon_data, size_t icon_len); -#endif - /** * Sets whether or not buddy icon caching is enabled. * -- cgit v1.2.1 From b13dc8e05c1116d7d0ddc9e8af9c76711ef8c217 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 05:07:37 +0000 Subject: Hide two easy Pidgin structs. --- ChangeLog.API | 2 ++ pidgin/gtkconv.c | 33 +++++++++++++++++++++++++++++++++ pidgin/gtkconv.h | 33 --------------------------------- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 5b3ac0b3b2..2c1f9a0165 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -131,6 +131,8 @@ version 3.0.0 (??/??/????): * serv_got_attention * serv_send_attention * struct _GtkIMHtmlFontDetail + * struct _PidginChatPane + * struct _PidginImPane * struct _PurpleAttentionType * struct _PurpleMenuAction * struct _PurplePounce diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 74239b2037..bb300561c0 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -74,6 +74,39 @@ #include "gtknickcolors.h" +/** + * A GTK+ Instant Message pane. + */ +struct _PidginImPane +{ + GtkWidget *block; + GtkWidget *send_file; + GtkWidget *sep1; + GtkWidget *sep2; + GtkWidget *check; + GtkWidget *progress; + guint32 typing_timer; + + /* Buddy icon stuff */ + GtkWidget *icon_container; + GtkWidget *icon; + gboolean show_icon; + gboolean animate; + GdkPixbufAnimation *anim; + GdkPixbufAnimationIter *iter; + guint32 icon_timer; +}; + +/** + * GTK+ Chat panes. + */ +struct _PidginChatPane +{ + GtkWidget *count; + GtkWidget *list; + GtkWidget *topic_text; +}; + #define CLOSE_CONV_TIMEOUT_SECS (10 * 60) #define AUTO_RESPONSE "<AUTO-REPLY> : " diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index efc2d3908a..eebb4bd186 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -76,39 +76,6 @@ enum { * conversations. */ -/** - * A GTK+ Instant Message pane. - */ -struct _PidginImPane -{ - GtkWidget *block; - GtkWidget *send_file; - GtkWidget *sep1; - GtkWidget *sep2; - GtkWidget *check; - GtkWidget *progress; - guint32 typing_timer; - - /* Buddy icon stuff */ - GtkWidget *icon_container; - GtkWidget *icon; - gboolean show_icon; - gboolean animate; - GdkPixbufAnimation *anim; - GdkPixbufAnimationIter *iter; - guint32 icon_timer; -}; - -/** - * GTK+ Chat panes. - */ -struct _PidginChatPane -{ - GtkWidget *count; - GtkWidget *list; - GtkWidget *topic_text; -}; - /** * A GTK+ conversation pane. */ -- cgit v1.2.1 From ee22692f950d873bc4c346e4c7c79a061dcc9b61 Mon Sep 17 00:00:00 2001 From: Kevin Stange Date: Fri, 2 Sep 2011 06:09:52 +0000 Subject: Fix Perl build by removing functions that are gone from libpurple. --- libpurple/plugins/perl/common/Status.xs | 41 --------------------------------- 1 file changed, 41 deletions(-) diff --git a/libpurple/plugins/perl/common/Status.xs b/libpurple/plugins/perl/common/Status.xs index f77860e61d..8965870ade 100644 --- a/libpurple/plugins/perl/common/Status.xs +++ b/libpurple/plugins/perl/common/Status.xs @@ -74,28 +74,6 @@ BOOT: newCONSTSUB(primitive_stash, (char *)civ->name, newSViv(civ->iv)); } -void -purple_presence_add_list(presence, source_list) - Purple::Presence presence - SV *source_list -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(source_list)); - - for (i = 0; i <= t_len; i++) { - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(source_list), i, 0))); - } - purple_presence_add_list(presence, t_GL); - g_list_free(t_GL); - -void -purple_presence_add_status(presence, status) - Purple::Presence presence - Purple::Status status - gint purple_presence_compare(presence1, presence2) Purple::Presence presence1 @@ -329,28 +307,9 @@ purple_status_set_active(status, active) Purple::Status status gboolean active -void -purple_status_set_attr_boolean(status, id, value) - Purple::Status status - const char *id - gboolean value - -void -purple_status_set_attr_string(status, id, value) - Purple::Status status - const char *id - const char *value - MODULE = Purple::Status PACKAGE = Purple::StatusType PREFIX = purple_status_type_ PROTOTYPES: ENABLE -void -purple_status_type_add_attr(status_type, id, name, value) - Purple::StatusType status_type - const char *id - const char *name - Purple::Value value - void purple_status_type_destroy(status_type) Purple::StatusType status_type -- cgit v1.2.1 From 2f10eb0674f88dc24cd6fb12a1effaaa85839d7b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 06:20:24 +0000 Subject: Remove GtkDocklet abstraction and merge GtkStatusIcon code into it. --- pidgin/Makefile.am | 2 +- pidgin/gtkdocklet-gtk.c | 296 --------------------------------------- pidgin/gtkdocklet.c | 363 ++++++++++++++++++++++++++++++++++++++---------- pidgin/gtkdocklet.h | 24 +--- 4 files changed, 289 insertions(+), 396 deletions(-) delete mode 100644 pidgin/gtkdocklet-gtk.c diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index 23890e775e..6ea4651114 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -52,7 +52,6 @@ pidgin_SOURCES = \ gtkdialogs.c \ gtkdnd-hints.c \ gtkdocklet.c \ - gtkdocklet-gtk.c \ gtkeventloop.c \ gtkft.c \ gtkicon-theme.c \ @@ -181,3 +180,4 @@ AM_CPPFLAGS = \ $(LIBXML_CFLAGS) \ $(INTGG_CFLAGS) endif # ENABLE_GTK + diff --git a/pidgin/gtkdocklet-gtk.c b/pidgin/gtkdocklet-gtk.c deleted file mode 100644 index f70916bb57..0000000000 --- a/pidgin/gtkdocklet-gtk.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * System tray icon (aka docklet) plugin for Purple - * - * Copyright (C) 2007 Anders Hasselqvist - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include "internal.h" -#include "pidgin.h" -#include "debug.h" -#include "prefs.h" -#include "pidginstock.h" -#include "gtkdocklet.h" - -#define SHORT_EMBED_TIMEOUT 5 -#define LONG_EMBED_TIMEOUT 15 - -/* globals */ -static GtkStatusIcon *docklet = NULL; -static guint embed_timeout = 0; - -/* protos */ -static void docklet_gtk_status_create(gboolean); - -static gboolean -docklet_gtk_recreate_cb(gpointer data) -{ - docklet_gtk_status_create(TRUE); - - return FALSE; -} - -static gboolean -docklet_gtk_embed_timeout_cb(gpointer data) -{ -#if !GTK_CHECK_VERSION(2,12,0) - if (gtk_status_icon_is_embedded(docklet)) { - /* Older GTK+ (<2.12) don't implement the embedded signal, but the - information is still accessable through the above function. */ - purple_debug_info("docklet", "embedded\n"); - - pidgin_docklet_embedded(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); - } - else -#endif - { - /* The docklet was not embedded within the timeout. - * Remove it as a visibility manager, but leave the plugin - * loaded so that it can embed automatically if/when a notification - * area becomes available. - */ - purple_debug_info("docklet", "failed to embed within timeout\n"); - pidgin_docklet_remove(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); - } - -#if GTK_CHECK_VERSION(2,12,0) - embed_timeout = 0; - return FALSE; -#else - return TRUE; -#endif -} - -#if GTK_CHECK_VERSION(2,12,0) -static gboolean -docklet_gtk_embedded_cb(GtkWidget *widget, gpointer data) -{ - if (embed_timeout) { - purple_timeout_remove(embed_timeout); - embed_timeout = 0; - } - - if (gtk_status_icon_is_embedded(docklet)) { - purple_debug_info("docklet", "embedded\n"); - - pidgin_docklet_embedded(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); - } else { - purple_debug_info("docklet", "detached\n"); - - pidgin_docklet_remove(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); - } - - return TRUE; -} -#endif - -static void -docklet_gtk_destroyed_cb(GtkWidget *widget, gpointer data) -{ - purple_debug_info("docklet", "destroyed\n"); - - pidgin_docklet_remove(); - - g_object_unref(G_OBJECT(docklet)); - docklet = NULL; - - g_idle_add(docklet_gtk_recreate_cb, NULL); -} - -static void -docklet_gtk_status_activated_cb(GtkStatusIcon *status_icon, gpointer user_data) -{ - pidgin_docklet_clicked(1); -} - -static void -docklet_gtk_status_clicked_cb(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) -{ - purple_debug_info("docklet", "The button is %u\n", button); -#ifdef GDK_WINDOWING_QUARTZ - /* You can only click left mouse button on MacOSX native GTK. Let that be the menu */ - pidgin_docklet_clicked(3); -#else - pidgin_docklet_clicked(button); -#endif -} - -static void -docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) -{ - const gchar *icon_name = NULL; - - switch (status) { - case PURPLE_STATUS_OFFLINE: - icon_name = PIDGIN_STOCK_TRAY_OFFLINE; - break; - case PURPLE_STATUS_AWAY: - icon_name = PIDGIN_STOCK_TRAY_AWAY; - break; - case PURPLE_STATUS_UNAVAILABLE: - icon_name = PIDGIN_STOCK_TRAY_BUSY; - break; - case PURPLE_STATUS_EXTENDED_AWAY: - icon_name = PIDGIN_STOCK_TRAY_XA; - break; - case PURPLE_STATUS_INVISIBLE: - icon_name = PIDGIN_STOCK_TRAY_INVISIBLE; - break; - default: - icon_name = PIDGIN_STOCK_TRAY_AVAILABLE; - break; - } - - if (pending) - icon_name = PIDGIN_STOCK_TRAY_PENDING; - if (connecting) - icon_name = PIDGIN_STOCK_TRAY_CONNECT; - - if (icon_name) { - gtk_status_icon_set_from_icon_name(docklet, icon_name); - } - - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")) { - gtk_status_icon_set_blinking(docklet, (pending && !connecting)); - } else if (gtk_status_icon_get_blinking(docklet)) { - gtk_status_icon_set_blinking(docklet, FALSE); - } -} - -static void -docklet_gtk_status_set_tooltip(gchar *tooltip) -{ - gtk_status_icon_set_tooltip(docklet, tooltip); -} - -static void -docklet_gtk_status_position_menu(GtkMenu *menu, - int *x, int *y, gboolean *push_in, - gpointer user_data) -{ - gtk_status_icon_position_menu(menu, x, y, push_in, docklet); -} - -static void -docklet_gtk_status_destroy(void) -{ - g_return_if_fail(docklet != NULL); - - pidgin_docklet_remove(); - - if (embed_timeout) { - purple_timeout_remove(embed_timeout); - embed_timeout = 0; - } - - gtk_status_icon_set_visible(docklet, FALSE); - g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_gtk_destroyed_cb), NULL); - g_object_unref(G_OBJECT(docklet)); - docklet = NULL; - - purple_debug_info("docklet", "GTK+ destroyed\n"); -} - -static void -docklet_gtk_status_create(gboolean recreate) -{ - if (docklet) { - /* if this is being called when a tray icon exists, it's because - something messed up. try destroying it before we proceed, - although docklet_refcount may be all hosed. hopefully won't happen. */ - purple_debug_warning("docklet", "trying to create icon but it already exists?\n"); - docklet_gtk_status_destroy(); - } - - docklet = gtk_status_icon_new(); - g_return_if_fail(docklet != NULL); - - g_signal_connect(G_OBJECT(docklet), "activate", G_CALLBACK(docklet_gtk_status_activated_cb), NULL); - g_signal_connect(G_OBJECT(docklet), "popup-menu", G_CALLBACK(docklet_gtk_status_clicked_cb), NULL); -#if GTK_CHECK_VERSION(2,12,0) - g_signal_connect(G_OBJECT(docklet), "notify::embedded", G_CALLBACK(docklet_gtk_embedded_cb), NULL); -#endif - g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_gtk_destroyed_cb), NULL); - - gtk_status_icon_set_visible(docklet, TRUE); - - /* This is a hack to avoid a race condition between the docklet getting - * embedded in the notification area and the gtkblist restoring its - * previous visibility state. If the docklet does not get embedded within - * the timeout, it will be removed as a visibility manager until it does - * get embedded. Ideally, we would only call docklet_embedded() when the - * icon was actually embedded. This only happens when the docklet is first - * created, not when being recreated. - * - * The gtk docklet tracks whether it successfully embedded in a pref and - * allows for a longer timeout period if it successfully embedded the last - * time it was run. This should hopefully solve problems with the buddy - * list not properly starting hidden when Pidgin is started on login. - */ - if (!recreate) { - pidgin_docklet_embedded(); -#if GTK_CHECK_VERSION(2,12,0) - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) { - embed_timeout = purple_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); - } else { - embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); - } -#else - embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); -#endif - } - - purple_debug_info("docklet", "GTK+ created\n"); -} - -static void -docklet_gtk_status_create_ui_op(void) -{ - docklet_gtk_status_create(FALSE); -} - -static struct docklet_ui_ops ui_ops = -{ - docklet_gtk_status_create_ui_op, - docklet_gtk_status_destroy, - docklet_gtk_status_update_icon, - NULL, - docklet_gtk_status_set_tooltip, - docklet_gtk_status_position_menu -}; - -void -docklet_ui_init(void) -{ - pidgin_docklet_set_ui_ops(&ui_ops); - - purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet/gtk"); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded")) { - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); - purple_prefs_remove(PIDGIN_PREFS_ROOT "/docklet/x11/embedded"); - } else { - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); - } - - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), - DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "pidgin" G_DIR_SEPARATOR_S "tray"); -} - diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index bbf997bc63..c5d109c28e 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -30,6 +30,7 @@ #include "prefs.h" #include "signals.h" #include "sound.h" +#include "status.h" #include "gtkaccount.h" #include "gtkblist.h" @@ -48,8 +49,12 @@ #define DOCKLET_TOOLTIP_LINE_LIMIT 5 #endif +#define SHORT_EMBED_TIMEOUT 5 +#define LONG_EMBED_TIMEOUT 15 + /* globals */ -static struct docklet_ui_ops *ui_ops = NULL; +static GtkStatusIcon *docklet = NULL; +static guint embed_timeout = 0; static PurpleStatusPrimitive status = PURPLE_STATUS_OFFLINE; static gboolean pending = FALSE; static gboolean connecting = FALSE; @@ -58,9 +63,55 @@ static guint docklet_blinking_timer = 0; static gboolean visible = FALSE; static gboolean visibility_manager = FALSE; +/* protos */ +static void docklet_gtk_status_create(gboolean); +static void docklet_gtk_status_destroy(void); + /************************************************************************** * docklet status and utility functions **************************************************************************/ +static void +docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) +{ + const gchar *icon_name = NULL; + + switch (status) { + case PURPLE_STATUS_OFFLINE: + icon_name = PIDGIN_STOCK_TRAY_OFFLINE; + break; + case PURPLE_STATUS_AWAY: + icon_name = PIDGIN_STOCK_TRAY_AWAY; + break; + case PURPLE_STATUS_UNAVAILABLE: + icon_name = PIDGIN_STOCK_TRAY_BUSY; + break; + case PURPLE_STATUS_EXTENDED_AWAY: + icon_name = PIDGIN_STOCK_TRAY_XA; + break; + case PURPLE_STATUS_INVISIBLE: + icon_name = PIDGIN_STOCK_TRAY_INVISIBLE; + break; + default: + icon_name = PIDGIN_STOCK_TRAY_AVAILABLE; + break; + } + + if (pending) + icon_name = PIDGIN_STOCK_TRAY_PENDING; + if (connecting) + icon_name = PIDGIN_STOCK_TRAY_CONNECT; + + if (icon_name) { + gtk_status_icon_set_from_icon_name(docklet, icon_name); + } + + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")) { + gtk_status_icon_set_blinking(docklet, (pending && !connecting)); + } else if (gtk_status_icon_get_blinking(docklet)) { + gtk_status_icon_set_blinking(docklet, FALSE); + } +} + static gboolean docklet_blink_icon(gpointer data) { @@ -70,11 +121,8 @@ docklet_blink_icon(gpointer data) blinked = !blinked; if(pending && !connecting) { - if (blinked) { - if (ui_ops && ui_ops->blank_icon) - ui_ops->blank_icon(); - } else { - pidgin_docklet_update_icon(); + if (!blinked) { + docklet_gtk_status_update_icon(status, connecting, pending); } ret = TRUE; /* keep blinking */ } else { @@ -126,12 +174,12 @@ docklet_update_status(void) convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT); if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) { - if (convs && ui_ops->create && !visible) { + if (convs && !visible) { g_list_free(convs); - ui_ops->create(); + docklet_gtk_status_create(FALSE); return FALSE; - } else if (!convs && ui_ops->destroy && visible) { - ui_ops->destroy(); + } else if (!convs && visible) { + docklet_gtk_status_destroy(); return FALSE; } } @@ -142,46 +190,43 @@ docklet_update_status(void) } if (convs != NULL) { + /* set tooltip if messages are pending */ + GString *tooltip_text = g_string_new(""); newpending = TRUE; - /* set tooltip if messages are pending */ - if (ui_ops->set_tooltip) { - GString *tooltip_text = g_string_new(""); - for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) { - PurpleConversation *conv = (PurpleConversation *)l->data; - PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - - if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) { - g_string_append(tooltip_text, _("Right-click for more unread messages...\n")); - } else if(gtkconv) { - g_string_append_printf(tooltip_text, - ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), - gtkconv->unseen_count, - purple_conversation_get_title(conv)); - } else { - g_string_append_printf(tooltip_text, - ngettext("%d unread message from %s\n", "%d unread messages from %s\n", - GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"))), - GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")), - purple_conversation_get_title(conv)); - } + for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) { + PurpleConversation *conv = (PurpleConversation *)l->data; + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); + + if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) { + g_string_append(tooltip_text, _("Right-click for more unread messages...\n")); + } else if(gtkconv) { + g_string_append_printf(tooltip_text, + ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), + gtkconv->unseen_count, + purple_conversation_get_title(conv)); + } else { + g_string_append_printf(tooltip_text, + ngettext("%d unread message from %s\n", "%d unread messages from %s\n", + GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"))), + GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")), + purple_conversation_get_title(conv)); } + } - /* get rid of the last newline */ - if (tooltip_text->len > 0) - tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); + /* get rid of the last newline */ + if (tooltip_text->len > 0) + tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); - ui_ops->set_tooltip(tooltip_text->str); - - g_string_free(tooltip_text, TRUE); - } + gtk_status_icon_set_tooltip(docklet, tooltip_text->str); + g_string_free(tooltip_text, TRUE); g_list_free(convs); - } else if (ui_ops->set_tooltip) { + } else { char *tooltip_text = g_strconcat(PIDGIN_NAME, " - ", purple_savedstatus_get_title(saved_status), NULL); - ui_ops->set_tooltip(tooltip_text); + gtk_status_icon_set_tooltip(docklet, tooltip_text); g_free(tooltip_text); } @@ -207,7 +252,7 @@ docklet_update_status(void) pending = newpending; connecting = newconnecting; - pidgin_docklet_update_icon(); + docklet_gtk_status_update_icon(status, connecting, pending); /* and schedule the blinker function if messages are pending */ if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink") @@ -286,17 +331,15 @@ docklet_show_pref_changed_cb(const char *name, PurplePrefType type, { const char *val = value; if (!strcmp(val, "always")) { - if (ui_ops->create) { - if (!visible) - ui_ops->create(); - else if (!visibility_manager) { - pidgin_blist_visibility_manager_add(); - visibility_manager = TRUE; - } + if (!visible) + docklet_gtk_status_create(FALSE); + else if (!visibility_manager) { + pidgin_blist_visibility_manager_add(); + visibility_manager = TRUE; } } else if (!strcmp(val, "never")) { - if (visible && ui_ops->destroy) - ui_ops->destroy(); + if (visible) + docklet_gtk_status_destroy(); } else { if (visibility_manager) { pidgin_blist_visibility_manager_remove(); @@ -750,21 +793,11 @@ docklet_menu(void) #endif gtk_widget_show_all(menu); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, - ui_ops->position_menu, - NULL, 0, gtk_get_current_event_time()); + gtk_status_icon_position_menu, + docklet, 0, gtk_get_current_event_time()); } -/************************************************************************** - * public api for ui_ops - **************************************************************************/ -void -pidgin_docklet_update_icon() -{ - if (ui_ops && ui_ops->update_icon) - ui_ops->update_icon(status, connecting, pending); -} - -void +static void pidgin_docklet_clicked(int button_type) { switch (button_type) { @@ -785,8 +818,8 @@ pidgin_docklet_clicked(int button_type) } } -void -pidgin_docklet_embedded() +static void +pidgin_docklet_embedded(void) { if (!visibility_manager && strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) { @@ -795,11 +828,11 @@ pidgin_docklet_embedded() } visible = TRUE; docklet_update_status(); - pidgin_docklet_update_icon(); + docklet_gtk_status_update_icon(status, connecting, pending); } -void -pidgin_docklet_remove() +static void +pidgin_docklet_remove(void) { if (visible) { if (visibility_manager) { @@ -815,12 +848,179 @@ pidgin_docklet_remove() } } -void -pidgin_docklet_set_ui_ops(struct docklet_ui_ops *ops) +static gboolean +docklet_gtk_recreate_cb(gpointer data) +{ + docklet_gtk_status_create(TRUE); + + return FALSE; +} + +static gboolean +docklet_gtk_embed_timeout_cb(gpointer data) +{ +#if !GTK_CHECK_VERSION(2,12,0) + if (gtk_status_icon_is_embedded(docklet)) { + /* Older GTK+ (<2.12) don't implement the embedded signal, but the + information is still accessible through the above function. */ + purple_debug_info("docklet", "embedded\n"); + + pidgin_docklet_embedded(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); + } + else +#endif + { + /* The docklet was not embedded within the timeout. + * Remove it as a visibility manager, but leave the plugin + * loaded so that it can embed automatically if/when a notification + * area becomes available. + */ + purple_debug_info("docklet", "failed to embed within timeout\n"); + pidgin_docklet_remove(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); + } + +#if GTK_CHECK_VERSION(2,12,0) + embed_timeout = 0; + return FALSE; +#else + return TRUE; +#endif +} + +#if GTK_CHECK_VERSION(2,12,0) +static gboolean +docklet_gtk_embedded_cb(GtkWidget *widget, gpointer data) { - ui_ops = ops; + if (embed_timeout) { + purple_timeout_remove(embed_timeout); + embed_timeout = 0; + } + + if (gtk_status_icon_is_embedded(docklet)) { + purple_debug_info("docklet", "embedded\n"); + + pidgin_docklet_embedded(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); + } else { + purple_debug_info("docklet", "detached\n"); + + pidgin_docklet_remove(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); + } + + return TRUE; } +#endif + +static void +docklet_gtk_destroyed_cb(GtkWidget *widget, gpointer data) +{ + purple_debug_info("docklet", "destroyed\n"); + pidgin_docklet_remove(); + + g_object_unref(G_OBJECT(docklet)); + docklet = NULL; + + g_idle_add(docklet_gtk_recreate_cb, NULL); +} + +static void +docklet_gtk_status_activated_cb(GtkStatusIcon *status_icon, gpointer user_data) +{ + pidgin_docklet_clicked(1); +} + +static void +docklet_gtk_status_clicked_cb(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) +{ + purple_debug_info("docklet", "The button is %u\n", button); +#ifdef GDK_WINDOWING_QUARTZ + /* You can only click left mouse button on MacOSX native GTK. Let that be the menu */ + pidgin_docklet_clicked(3); +#else + pidgin_docklet_clicked(button); +#endif +} + +static void +docklet_gtk_status_destroy(void) +{ + g_return_if_fail(docklet != NULL); + + pidgin_docklet_remove(); + + if (embed_timeout) { + purple_timeout_remove(embed_timeout); + embed_timeout = 0; + } + + gtk_status_icon_set_visible(docklet, FALSE); + g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_gtk_destroyed_cb), NULL); + g_object_unref(G_OBJECT(docklet)); + docklet = NULL; + + purple_debug_info("docklet", "GTK+ destroyed\n"); +} + +static void +docklet_gtk_status_create(gboolean recreate) +{ + if (docklet) { + /* if this is being called when a tray icon exists, it's because + something messed up. try destroying it before we proceed, + although docklet_refcount may be all hosed. hopefully won't happen. */ + purple_debug_warning("docklet", "trying to create icon but it already exists?\n"); + docklet_gtk_status_destroy(); + } + + docklet = gtk_status_icon_new(); + g_return_if_fail(docklet != NULL); + + g_signal_connect(G_OBJECT(docklet), "activate", G_CALLBACK(docklet_gtk_status_activated_cb), NULL); + g_signal_connect(G_OBJECT(docklet), "popup-menu", G_CALLBACK(docklet_gtk_status_clicked_cb), NULL); +#if GTK_CHECK_VERSION(2,12,0) + g_signal_connect(G_OBJECT(docklet), "notify::embedded", G_CALLBACK(docklet_gtk_embedded_cb), NULL); +#endif + g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_gtk_destroyed_cb), NULL); + + gtk_status_icon_set_visible(docklet, TRUE); + + /* This is a hack to avoid a race condition between the docklet getting + * embedded in the notification area and the gtkblist restoring its + * previous visibility state. If the docklet does not get embedded within + * the timeout, it will be removed as a visibility manager until it does + * get embedded. Ideally, we would only call docklet_embedded() when the + * icon was actually embedded. This only happens when the docklet is first + * created, not when being recreated. + * + * The gtk docklet tracks whether it successfully embedded in a pref and + * allows for a longer timeout period if it successfully embedded the last + * time it was run. This should hopefully solve problems with the buddy + * list not properly starting hidden when Pidgin is started on login. + */ + if (!recreate) { + pidgin_docklet_embedded(); +#if GTK_CHECK_VERSION(2,12,0) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) { + embed_timeout = purple_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); + } else { + embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); + } +#else + embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); +#endif + } + + purple_debug_info("docklet", "GTK+ created\n"); +} + +/************************************************************************** + * public api + **************************************************************************/ + void* pidgin_docklet_get_handle() { @@ -843,9 +1043,19 @@ pidgin_docklet_init() purple_prefs_connect_callback(docklet_handle, PIDGIN_PREFS_ROOT "/docklet/show", docklet_show_pref_changed_cb, NULL); - docklet_ui_init(); - if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always") && ui_ops && ui_ops->create) - ui_ops->create(); + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet/gtk"); + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded")) { + purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); + purple_prefs_remove(PIDGIN_PREFS_ROOT "/docklet/x11/embedded"); + } else { + purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); + } + + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), + DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "pidgin" G_DIR_SEPARATOR_S "tray"); + + if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always")) + docklet_gtk_status_create(FALSE); purple_signal_connect(conn_handle, "signed-on", docklet_handle, PURPLE_CALLBACK(docklet_signed_on_cb), NULL); @@ -874,6 +1084,7 @@ pidgin_docklet_init() void pidgin_docklet_uninit() { - if (visible && ui_ops && ui_ops->destroy) - ui_ops->destroy(); + if (visible) + docklet_gtk_status_destroy(); } + diff --git a/pidgin/gtkdocklet.h b/pidgin/gtkdocklet.h index 34f88a14f5..af8538b7bd 100644 --- a/pidgin/gtkdocklet.h +++ b/pidgin/gtkdocklet.h @@ -25,31 +25,9 @@ #ifndef _GTKDOCKLET_H_ #define _GTKDOCKLET_H_ -#include "status.h" - -struct docklet_ui_ops -{ - void (*create)(void); - void (*destroy)(void); - void (*update_icon)(PurpleStatusPrimitive, gboolean, gboolean); - void (*blank_icon)(void); - void (*set_tooltip)(gchar *); - GtkMenuPositionFunc position_menu; -}; - - -/* functions in gtkdocklet.c */ -void pidgin_docklet_update_icon(void); -void pidgin_docklet_clicked(int); -void pidgin_docklet_embedded(void); -void pidgin_docklet_remove(void); -void pidgin_docklet_set_ui_ops(struct docklet_ui_ops *); -void pidgin_docklet_unload(void); void pidgin_docklet_init(void); void pidgin_docklet_uninit(void); void*pidgin_docklet_get_handle(void); -/* function in gtkdocklet-{gtk,x11,win32}.c */ -void docklet_ui_init(void); - #endif /* _GTKDOCKLET_H_ */ + -- cgit v1.2.1 From 80d59e9857c0d122076ea4012c4ee0976a6de89f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 06:21:10 +0000 Subject: Fix Certificate Manager Import/Export icons. --- pidgin/gtkcertmgr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pidgin/gtkcertmgr.c b/pidgin/gtkcertmgr.c index 381ff2c72b..cfff4414e7 100644 --- a/pidgin/gtkcertmgr.c +++ b/pidgin/gtkcertmgr.c @@ -471,9 +471,8 @@ tls_peers_mgmt_build(void) gtk_widget_show(bbox); /* Import button */ - /* TODO: This is the wrong stock button */ tpm_dat->importbutton = importbutton = - gtk_button_new_from_stock(GTK_STOCK_ADD); + gtk_button_new_from_stock(GTK_STOCK_OPEN); gtk_box_pack_start(GTK_BOX(bbox), importbutton, FALSE, FALSE, 0); gtk_widget_show(importbutton); g_signal_connect(G_OBJECT(importbutton), "clicked", @@ -481,9 +480,8 @@ tls_peers_mgmt_build(void) /* Export button */ - /* TODO: This is the wrong stock button */ tpm_dat->exportbutton = exportbutton = - gtk_button_new_from_stock(GTK_STOCK_SAVE); + gtk_button_new_from_stock(GTK_STOCK_SAVE_AS); gtk_box_pack_start(GTK_BOX(bbox), exportbutton, FALSE, FALSE, 0); gtk_widget_show(exportbutton); g_signal_connect(G_OBJECT(exportbutton), "clicked", -- cgit v1.2.1 From 14c4b4d189e9f7f825c6262a21e51733ce859b61 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 06:32:19 +0000 Subject: Allow double-clicking a certificate to show its info. --- pidgin/gtkcertmgr.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pidgin/gtkcertmgr.c b/pidgin/gtkcertmgr.c index cfff4414e7..48b2944a09 100644 --- a/pidgin/gtkcertmgr.c +++ b/pidgin/gtkcertmgr.c @@ -332,6 +332,12 @@ tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data) purple_certificate_destroy(crt); } +static void +tls_peers_mgmt_activated_cb(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data) +{ + tls_peers_mgmt_info_cb(NULL, NULL); +} + static void tls_peers_mgmt_delete_confirm_cb(gchar *id, gint choice) { @@ -452,6 +458,9 @@ tls_peers_mgmt_build(void) g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(tls_peers_mgmt_select_chg_cb), NULL); + g_signal_connect(G_OBJECT(listview), "row-activated", + G_CALLBACK(tls_peers_mgmt_activated_cb), NULL); + gtk_box_pack_start(GTK_BOX(mgmt_widget), pidgin_make_scrollable(GTK_WIDGET(listview), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1), TRUE, TRUE, /* Take up lots of space */ -- cgit v1.2.1 From ab18465fca0bec4f2a4ddbc7720d04bc13f72c8d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 19:50:58 +0000 Subject: Be a bit more specific about removing non-local MSN objects, which HanzZ thinks should fix a leak somewhere. --- libpurple/protocols/msn/msg.c | 6 +++--- libpurple/protocols/msn/msn.c | 2 +- libpurple/protocols/msn/object.c | 11 +++++++---- libpurple/protocols/msn/object.h | 5 +++-- libpurple/protocols/msn/slpcall.c | 2 +- libpurple/protocols/msn/user.c | 6 +++--- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/libpurple/protocols/msn/msg.c b/libpurple/protocols/msn/msg.c index 023bd4a10f..f5f3fc300f 100644 --- a/libpurple/protocols/msn/msg.c +++ b/libpurple/protocols/msn/msg.c @@ -970,7 +970,7 @@ void msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); } - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); obj = NULL; who = NULL; sha1 = NULL; @@ -1025,7 +1025,7 @@ msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg) slplink = msn_session_get_slplink(session, who); msn_slplink_request_object(slplink, data, got_wink_cb, NULL, obj); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); } else if (!strcmp(id, "3")) { @@ -1045,7 +1045,7 @@ msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg) slplink = msn_session_get_slplink(session, who); msn_slplink_request_object(slplink, data, got_voiceclip_cb, NULL, obj); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); } else if (!strcmp(id, "4")) { /* Action */ diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 0f80250f46..659b1c005a 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -1453,7 +1453,7 @@ msn_send_emoticons(MsnSwitchBoard *swboard, GString *body) static void msn_emoticon_destroy(MsnEmoticon *emoticon) { if (emoticon->obj) - msn_object_destroy(emoticon->obj); + msn_object_destroy(emoticon->obj, FALSE); g_free(emoticon->smile); g_free(emoticon); } diff --git a/libpurple/protocols/msn/object.c b/libpurple/protocols/msn/object.c index bee264109a..b635902c85 100644 --- a/libpurple/protocols/msn/object.c +++ b/libpurple/protocols/msn/object.c @@ -103,7 +103,7 @@ msn_object_new_from_string(const char *str) if (obj->creator == NULL || obj->size == 0 || obj->type == 0 || obj->sha1d == NULL) { purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); return NULL; } @@ -111,12 +111,12 @@ msn_object_new_from_string(const char *str) /* Location/friendly are required for non-buddyicon objects */ if (obj->type != MSN_OBJECT_USERTILE) { purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); return NULL; /* Buddy icon object can contain Url/Url1 instead */ } else if (obj->url == NULL || obj->url1 == NULL) { purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); return NULL; } } @@ -193,10 +193,13 @@ msn_object_new_from_image(PurpleStoredImage *img, const char *location, } void -msn_object_destroy(MsnObject *obj) +msn_object_destroy(MsnObject *obj, gboolean only_remote) { g_return_if_fail(obj != NULL); + if (only_remote && obj->local) + return; + g_free(obj->creator); g_free(obj->location); g_free(obj->friendly); diff --git a/libpurple/protocols/msn/object.h b/libpurple/protocols/msn/object.h index 81572dc799..cdd5bfbc16 100644 --- a/libpurple/protocols/msn/object.h +++ b/libpurple/protocols/msn/object.h @@ -86,9 +86,10 @@ MsnObject *msn_object_new_from_image(PurpleStoredImage *img, /** * Destroys an MsnObject structure. * - * @param obj The object structure. + * @param obj The object structure. + * @param only_remote Only destroy non-local objects. */ -void msn_object_destroy(MsnObject *obj); +void msn_object_destroy(MsnObject *obj, gboolean only_remote); /** * Outputs a string representation of an MsnObject. diff --git a/libpurple/protocols/msn/slpcall.c b/libpurple/protocols/msn/slpcall.c index 81fc610bfc..4f2ff99cb5 100644 --- a/libpurple/protocols/msn/slpcall.c +++ b/libpurple/protocols/msn/slpcall.c @@ -485,7 +485,7 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, if (img) purple_imgstore_ref(img); } - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); if (img != NULL) { /* DATA PREP */ diff --git a/libpurple/protocols/msn/user.c b/libpurple/protocols/msn/user.c index 8f9581e0fc..8619d2f9b8 100644 --- a/libpurple/protocols/msn/user.c +++ b/libpurple/protocols/msn/user.c @@ -76,7 +76,7 @@ msn_user_destroy(MsnUser *user) } if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); + msn_object_destroy(user->msnobj, FALSE); g_free(user->passport); g_free(user->friendly_name); @@ -588,8 +588,8 @@ msn_user_set_object(MsnUser *user, MsnObject *obj) { g_return_if_fail(user != NULL); - if (user->msnobj != NULL && !msn_object_find_local(msn_object_get_sha1(obj))) - msn_object_destroy(user->msnobj); + if (user->msnobj != NULL) + msn_object_destroy(user->msnobj, TRUE); user->msnobj = obj; -- cgit v1.2.1 From 1445fd5b7d3d4fa7f4e897c7135424be5ef3da6f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 21:04:02 +0000 Subject: Remove deprecated xmlnode functions. --- ChangeLog.API | 2 ++ libpurple/xmlnode.c | 12 ------------ libpurple/xmlnode.h | 37 +++---------------------------------- 3 files changed, 5 insertions(+), 46 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 2c1f9a0165..a61c2b2297 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -141,6 +141,8 @@ version 3.0.0 (??/??/????): * struct _PurpleRoomlist * struct _PurpleRoomlistField * struct _PurpleRoomlistRoom + * xmlnode_set_attrib_with_namespace + * xmlnode_set_attrib_with_prefix version 2.10.0: libpurple: diff --git a/libpurple/xmlnode.c b/libpurple/xmlnode.c index 6fc7d3dac9..32b9c9d038 100644 --- a/libpurple/xmlnode.c +++ b/libpurple/xmlnode.c @@ -190,18 +190,6 @@ xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value) xmlnode_set_attrib_full(node, attr, NULL, NULL, value); } -void -xmlnode_set_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns, const char *value) -{ - xmlnode_set_attrib_full(node, attr, xmlns, NULL, value); -} - -void -xmlnode_set_attrib_with_prefix(xmlnode *node, const char *attr, const char *prefix, const char *value) -{ - xmlnode_set_attrib_full(node, attr, NULL, prefix, value); -} - void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, const char *prefix, const char *value) { diff --git a/libpurple/xmlnode.h b/libpurple/xmlnode.h index f2ac281016..2a12229c2b 100644 --- a/libpurple/xmlnode.h +++ b/libpurple/xmlnode.h @@ -157,42 +157,14 @@ char *xmlnode_get_data_unescaped(const xmlnode *node); */ void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_XMLNODE_C_) -/** - * Sets a prefixed attribute for a node - * - * @param node The node to set an attribute for. - * @param attr The name of the attribute to set - * @param prefix The prefix of the attribute to ste - * @param value The value of the attribute - * - * @deprecated Use xmlnode_set_attrib_full instead. - */ -void xmlnode_set_attrib_with_prefix(xmlnode *node, const char *attr, const char *prefix, const char *value); - -/** - * Sets a namespaced attribute for a node - * - * @param node The node to set an attribute for. - * @param attr The name of the attribute to set - * @param xmlns The namespace of the attribute to ste - * @param value The value of the attribute - * - * @deprecated Use xmlnode_set_attrib_full instead. - */ -void xmlnode_set_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns, const char *value); -#endif /* PURPLE_DISABLE_DEPRECATED */ - /** * Sets a namespaced attribute for a node * * @param node The node to set an attribute for. * @param attr The name of the attribute to set - * @param xmlns The namespace of the attribute to ste - * @param prefix The prefix of the attribute to ste + * @param xmlns The namespace of the attribute to set + * @param prefix The prefix of the attribute to set * @param value The value of the attribute - * - * @since 2.6.0 */ void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, const char *prefix, const char *value); @@ -273,8 +245,6 @@ const char *xmlnode_get_prefix(const xmlnode *node); * @param child The child node. * * @return The parent or NULL. - * - * @since 2.6.0 */ xmlnode *xmlnode_get_parent(const xmlnode *child); @@ -343,8 +313,6 @@ void xmlnode_free(xmlnode *node); * the category for debugging. * * @return The new node or NULL if an error occurred. - * - * @since 2.6.0 */ xmlnode *xmlnode_from_file(const char *dir, const char *filename, const char *description, const char *process); @@ -354,3 +322,4 @@ xmlnode *xmlnode_from_file(const char *dir, const char *filename, #endif #endif /* _PURPLE_XMLNODE_H_ */ + -- cgit v1.2.1 From bcc4e8b0fc81359dfdbd6bf815256aba534cf992 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 2 Sep 2011 21:15:24 +0000 Subject: Remove deprecated plugin functions. I guess no-one asked for a plugin-probe signal. --- ChangeLog.API | 6 +++++ libpurple/plugin.c | 61 ------------------------------------------------- libpurple/plugin.h | 66 ------------------------------------------------------ 3 files changed, 6 insertions(+), 127 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index a61c2b2297..0f650ad585 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -109,6 +109,12 @@ version 3.0.0 (??/??/????): * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count * purple_notify_searchresults_row_get + * purple_plugins_register_load_notify_cb + * purple_plugins_register_probe_notify_cb + * purple_plugins_register_unload_notify_cb + * purple_plugins_unregister_load_notify_cb + * purple_plugins_unregister_probe_notify_cb + * purple_plugins_unregister_unload_notify_cb * purple_presence_add_status * purple_presence_add_list * purple_srv_cancel diff --git a/libpurple/plugin.c b/libpurple/plugin.c index 4f2b4023ab..c97a9f3d67 100644 --- a/libpurple/plugin.c +++ b/libpurple/plugin.c @@ -64,13 +64,6 @@ static GList *plugin_loaders = NULL; static GList *plugins_to_disable = NULL; #endif -static void (*probe_cb)(void *) = NULL; -static void *probe_cb_data = NULL; -static void (*load_cb)(PurplePlugin *, void *) = NULL; -static void *load_cb_data = NULL; -static void (*unload_cb)(PurplePlugin *, void *) = NULL; -static void *unload_cb_data = NULL; - #ifdef PURPLE_PLUGINS static gboolean @@ -615,9 +608,6 @@ purple_plugin_load(PurplePlugin *plugin) plugin->loaded = TRUE; - if (load_cb != NULL) - load_cb(plugin, load_cb_data); - purple_signal_emit(purple_plugins_get_handle(), "plugin-load", plugin); return TRUE; @@ -745,9 +735,6 @@ purple_plugin_unload(PurplePlugin *plugin) g_free(plugin->error); plugin->error = NULL; - if (unload_cb != NULL) - unload_cb(plugin, unload_cb_data); - purple_signal_emit(purple_plugins_get_handle(), "plugin-unload", plugin); purple_prefs_disconnect_by_handle(plugin); @@ -1439,10 +1426,6 @@ purple_plugins_probe(const char *ext) (GCompareFunc)compare_prpl); } } - - if (probe_cb != NULL) - probe_cb(probe_cb_data); - #endif /* PURPLE_PLUGINS */ } @@ -1513,50 +1496,6 @@ purple_plugins_enabled(void) #endif } -void -purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data) -{ - probe_cb = func; - probe_cb_data = data; -} - -void -purple_plugins_unregister_probe_notify_cb(void (*func)(void *)) -{ - probe_cb = NULL; - probe_cb_data = NULL; -} - -void -purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *), - void *data) -{ - load_cb = func; - load_cb_data = data; -} - -void -purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)) -{ - load_cb = NULL; - load_cb_data = NULL; -} - -void -purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *), - void *data) -{ - unload_cb = func; - unload_cb_data = data; -} - -void -purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *, void *)) -{ - unload_cb = NULL; - unload_cb_data = NULL; -} - PurplePlugin * purple_plugins_find_with_name(const char *name) { diff --git a/libpurple/plugin.h b/libpurple/plugin.h index 9225aecd92..1273cc8bf0 100644 --- a/libpurple/plugin.h +++ b/libpurple/plugin.h @@ -566,72 +566,6 @@ void purple_plugins_probe(const char *ext); */ gboolean purple_plugins_enabled(void); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Registers a function that will be called when probing is finished. - * - * @param func The callback function. - * @param data Data to pass to the callback. - * @deprecated If you need this, ask for a plugin-probe signal to be added. - */ -void purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Unregisters a function that would be called when probing is finished. - * - * @param func The callback function. - * @deprecated If you need this, ask for a plugin-probe signal to be added. - */ -void purple_plugins_unregister_probe_notify_cb(void (*func)(void *)); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Registers a function that will be called when a plugin is loaded. - * - * @param func The callback function. - * @param data Data to pass to the callback. - * @deprecated Use the plugin-load signal instead. - */ -void purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *), - void *data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Unregisters a function that would be called when a plugin is loaded. - * - * @param func The callback function. - * @deprecated Use the plugin-load signal instead. - */ -void purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Registers a function that will be called when a plugin is unloaded. - * - * @param func The callback function. - * @param data Data to pass to the callback. - * @deprecated Use the plugin-unload signal instead. - */ -void purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *), - void *data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Unregisters a function that would be called when a plugin is unloaded. - * - * @param func The callback function. - * @deprecated Use the plugin-unload signal instead. - */ -void purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *, - void *)); -#endif - /** * Finds a plugin with the specified name. * -- cgit v1.2.1 From f2599ca3878666ae6e7dd641615d5e21cd1a2119 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 3 Sep 2011 15:11:20 +0000 Subject: Need to make a copy of the data passed to purple_imgstore_add_with_id(). --- libpurple/protocols/mxit/formcmds.c | 9 ++------- libpurple/protocols/mxit/protocol.c | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/libpurple/protocols/mxit/formcmds.c b/libpurple/protocols/mxit/formcmds.c index 7c8527de5a..73f746517a 100644 --- a/libpurple/protocols/mxit/formcmds.c +++ b/libpurple/protocols/mxit/formcmds.c @@ -86,7 +86,6 @@ struct ii_url_request static void mxit_cb_ii_returned(PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message) { struct ii_url_request* iireq = (struct ii_url_request*) user_data; - char* ii_data; int* intptr = NULL; int id; @@ -106,12 +105,8 @@ static void mxit_cb_ii_returned(PurpleUtilFetchUrlData* url_data, gpointer user_ goto done; } - /* make a copy of the data */ - ii_data = g_malloc(len); - memcpy(ii_data, (const char*) url_text, len); - - /* we now have the inline image, store it in the imagestore */ - id = purple_imgstore_add_with_id(ii_data, len, NULL); + /* we now have the inline image, store a copy in the imagestore */ + id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); /* map the inline image id to purple image id */ intptr = g_malloc(sizeof(int)); diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index 7bcfa1ee68..421bd9f77e 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -2136,13 +2136,13 @@ static void mxit_parse_cmd_media( struct MXitSession* session, struct record** r contact = get_mxit_invite_contact( session, chunk.mxitid ); if ( contact ) { /* this is an invite (add image to the internal image store) */ - contact->imgid = purple_imgstore_add_with_id( chunk.data, chunk.length, NULL ); + contact->imgid = purple_imgstore_add_with_id( g_memdup( chunk.data, chunk.length ), chunk.length, NULL ); /* show the profile */ mxit_show_profile( session, chunk.mxitid, contact->profile ); } else { /* this is a contact's avatar, so update it */ - purple_buddy_icons_set_for_user( session->acc, chunk.mxitid, g_memdup( chunk.data, chunk.length), chunk.length, chunk.avatarid ); + purple_buddy_icons_set_for_user( session->acc, chunk.mxitid, g_memdup( chunk.data, chunk.length ), chunk.length, chunk.avatarid ); } } } -- cgit v1.2.1 From 28c284743c39b3374b3e9731ee932c2279677862 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 3 Sep 2011 23:13:11 +0000 Subject: Rename the _with_invite functions to their counterparts. --- ChangeLog.API | 8 +++ finch/gntblist.c | 2 +- libpurple/account.c | 101 +++----------------------------- libpurple/account.h | 26 +------- libpurple/blist.c | 2 +- libpurple/protocols/bonjour/bonjour.c | 6 +- libpurple/protocols/gg/gg.c | 6 +- libpurple/protocols/irc/irc.c | 6 +- libpurple/protocols/jabber/libxmpp.c | 4 +- libpurple/protocols/jabber/roster.c | 2 +- libpurple/protocols/jabber/roster.h | 2 +- libpurple/protocols/msn/msn.c | 6 +- libpurple/protocols/mxit/mxit.c | 6 +- libpurple/protocols/myspace/myspace.c | 6 +- libpurple/protocols/novell/novell.c | 6 +- libpurple/protocols/null/nullprpl.c | 12 ++-- libpurple/protocols/oscar/libaim.c | 6 +- libpurple/protocols/oscar/libicq.c | 6 +- libpurple/protocols/oscar/oscar.c | 2 +- libpurple/protocols/sametime/sametime.c | 6 +- libpurple/protocols/simple/simple.c | 8 +-- libpurple/protocols/yahoo/libyahoo.c | 4 +- libpurple/protocols/yahoo/libyahoojp.c | 4 +- libpurple/protocols/yahoo/libymsg.c | 4 +- libpurple/protocols/yahoo/libymsg.h | 2 +- libpurple/protocols/zephyr/zephyr.c | 4 +- libpurple/prpl.h | 23 ++------ pidgin/gtkblist.c | 2 +- pidgin/gtkconv.c | 2 +- 29 files changed, 65 insertions(+), 209 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 0f650ad585..c08f14a652 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -64,6 +64,10 @@ version 3.0.0 (??/??/????): * purple_dnsquery_a now takes a PurpleAccount as the first parameter * purple_srv_resolve now takes a PurpleAccount as the first parameter * purple_txt_resolve now takes a PurpleAccount as the first parameter + * purple_account_add_buddy now takes an invite message as the last + parameter + * purple_account_add_buddies now takes an invite message as the last + parameter Removed: * _GntFileType @@ -99,6 +103,8 @@ version 3.0.0 (??/??/????): * pidgin_set_custom_buddy_icon * pidgin_setup_screenname_autocomplete * PidginConversation.sg + * purple_account_add_buddies_with_invite + * purple_account_add_buddy_with_invite * purple_buddy_icons_has_custom_icon * purple_buddy_icons_find_custom_icon * purple_buddy_icons_set_custom_icon @@ -134,6 +140,8 @@ version 3.0.0 (??/??/????): * purple_util_fetch_url_request_len_with_account. Use purple_util_fetch_url_request_len, instead. * PurpleConnectionUiOps.report_disconnect_reason + * PurplePluginProtocolInfo.add_buddy_with_invite + * PurplePluginProtocolInfo.add_buddies_with_invite * serv_got_attention * serv_send_attention * struct _GtkIMHtmlFontDetail diff --git a/finch/gntblist.c b/finch/gntblist.c index aa21b93ece..15c5e08070 100644 --- a/finch/gntblist.c +++ b/finch/gntblist.c @@ -663,7 +663,7 @@ add_buddy_cb(void *data, PurpleRequestFields *allfields) purple_blist_add_buddy(buddy, NULL, grp, NULL); } - purple_account_add_buddy_with_invite(account, buddy, invite); + purple_account_add_buddy(account, buddy, invite); } static void diff --git a/libpurple/account.c b/libpurple/account.c index 360efe9148..e8fccd430a 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -2518,7 +2518,7 @@ purple_account_destroy_log(PurpleAccount *account) } void -purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy) +purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy, const char *message) { PurplePluginProtocolInfo *prpl_info = NULL; PurpleConnection *gc; @@ -2535,89 +2535,13 @@ purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); if (prpl_info != NULL) { - if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite)) - prpl_info->add_buddy_with_invite(gc, buddy, purple_buddy_get_group(buddy), NULL); - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) - prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy)); + if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) + prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy), message); } } void -purple_account_add_buddy_with_invite(PurpleAccount *account, PurpleBuddy *buddy, const char *message) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc; - PurplePlugin *prpl = NULL; - - g_return_if_fail(account != NULL); - g_return_if_fail(buddy != NULL); - - gc = purple_account_get_connection(account); - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info != NULL) { - if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite)) - prpl_info->add_buddy_with_invite(gc, buddy, purple_buddy_get_group(buddy), message); - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) - prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy)); - } -} - -void -purple_account_add_buddies(PurpleAccount *account, GList *buddies) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc = purple_account_get_connection(account); - PurplePlugin *prpl = NULL; - - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info) { - GList *cur, *groups = NULL; - - /* Make a list of what group each buddy is in */ - for (cur = buddies; cur != NULL; cur = cur->next) { - PurpleBuddy *buddy = cur->data; - groups = g_list_append(groups, purple_buddy_get_group(buddy)); - } - - if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies_with_invite)) - prpl_info->add_buddies_with_invite(gc, buddies, groups, NULL); - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies)) - prpl_info->add_buddies(gc, buddies, groups); - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite)) { - GList *curb = buddies, *curg = groups; - - while ((curb != NULL) && (curg != NULL)) { - prpl_info->add_buddy_with_invite(gc, curb->data, curg->data, NULL); - curb = curb->next; - curg = curg->next; - } - } - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) { - GList *curb = buddies, *curg = groups; - - while ((curb != NULL) && (curg != NULL)) { - prpl_info->add_buddy(gc, curb->data, curg->data); - curb = curb->next; - curg = curg->next; - } - } - - g_list_free(groups); - } -} - -void -purple_account_add_buddies_with_invite(PurpleAccount *account, GList *buddies, const char *message) +purple_account_add_buddies(PurpleAccount *account, GList *buddies, const char *message) { PurplePluginProtocolInfo *prpl_info = NULL; PurpleConnection *gc = purple_account_get_connection(account); @@ -2638,24 +2562,13 @@ purple_account_add_buddies_with_invite(PurpleAccount *account, GList *buddies, c groups = g_list_append(groups, purple_buddy_get_group(buddy)); } - if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies_with_invite)) - prpl_info->add_buddies_with_invite(gc, buddies, groups, message); - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite)) { - GList *curb = buddies, *curg = groups; - - while ((curb != NULL) && (curg != NULL)) { - prpl_info->add_buddy_with_invite(gc, curb->data, curg->data, message); - curb = curb->next; - curg = curg->next; - } - } - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies)) - prpl_info->add_buddies(gc, buddies, groups); + if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies)) + prpl_info->add_buddies(gc, buddies, groups, message); else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) { GList *curb = buddies, *curg = groups; while ((curb != NULL) && (curg != NULL)) { - prpl_info->add_buddy(gc, curb->data, curg->data); + prpl_info->add_buddy(gc, curb->data, curg->data, message); curb = curb->next; curg = curg->next; } diff --git a/libpurple/account.h b/libpurple/account.h index 80a153b13f..dfd4f903d2 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -953,45 +953,23 @@ PurpleLog *purple_account_get_log(PurpleAccount *account, gboolean create); */ void purple_account_destroy_log(PurpleAccount *account); -/** - * Adds a buddy to the server-side buddy list for the specified account. - * - * @param account The account. - * @param buddy The buddy to add. - * - * @deprecated Use purple_account_add_buddy_with_invite and \c NULL message. - */ -void purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy); /** * Adds a buddy to the server-side buddy list for the specified account. * * @param account The account. * @param buddy The buddy to add. * @param message The invite message. This may be ignored by a prpl. - * - * @since 2.8.0 */ -void purple_account_add_buddy_with_invite(PurpleAccount *account, PurpleBuddy *buddy, const char *message); +void purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy, const char *message); -/** - * Adds a list of buddies to the server-side buddy list. - * - * @param account The account. - * @param buddies The list of PurpleBlistNodes representing the buddies to add. - * - * @deprecated Use purple_account_add_buddies_with_invite and \c NULL message. - */ -void purple_account_add_buddies(PurpleAccount *account, GList *buddies); /** * Adds a list of buddies to the server-side buddy list. * * @param account The account. * @param buddies The list of PurpleBlistNodes representing the buddies to add. * @param message The invite message. This may be ignored by a prpl. - * - * @since 2.8.0 */ -void purple_account_add_buddies_with_invite(PurpleAccount *account, GList *buddies, const char *message); +void purple_account_add_buddies(PurpleAccount *account, GList *buddies, const char *message); /** * Removes a buddy from the server-side buddy list. diff --git a/libpurple/blist.c b/libpurple/blist.c index 42343e1f01..08b6c0739b 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -1313,7 +1313,7 @@ void purple_blist_rename_group(PurpleGroup *source, const char *name) purple_account_remove_buddies(account, buddies, groups); g_list_free(groups); - purple_account_add_buddies(account, buddies); + purple_account_add_buddies(account, buddies, NULL); } g_list_free(buddies); diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c index a3f0455bc3..bbbd5ace8b 100644 --- a/libpurple/protocols/bonjour/bonjour.c +++ b/libpurple/protocols/bonjour/bonjour.c @@ -256,7 +256,7 @@ bonjour_set_status(PurpleAccount *account, PurpleStatus *status) * if there is no add_buddy callback. */ static void -bonjour_fake_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) { +bonjour_fake_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { purple_debug_error("bonjour", "Buddy '%s' manually added; removing. " "Bonjour buddies must be discovered and not manually added.\n", purple_buddy_get_name(buddy)); @@ -555,9 +555,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index fc93d3119a..34a88b684d 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -2467,7 +2467,7 @@ static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) } -static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { PurpleAccount *account; GGPInfo *info = purple_connection_get_protocol_data(gc); @@ -2726,9 +2726,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* can_do_media */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = { diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index 78c7f647eb..286f61444c 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -607,7 +607,7 @@ static void irc_set_status(PurpleAccount *account, PurpleStatus *status) } } -static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { struct irc_conn *irc = purple_connection_get_protocol_data(gc); struct irc_buddy *ib; @@ -989,9 +989,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static gboolean load_plugin (PurplePlugin *plugin) { diff --git a/libpurple/protocols/jabber/libxmpp.c b/libpurple/protocols/jabber/libxmpp.c index f34052b6e4..17bbd019e4 100644 --- a/libpurple/protocols/jabber/libxmpp.c +++ b/libpurple/protocols/jabber/libxmpp.c @@ -129,9 +129,7 @@ static PurplePluginProtocolInfo prpl_info = jabber_get_media_caps, /* get_media_caps */ jabber_get_moods, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static gboolean load_plugin(PurplePlugin *plugin) diff --git a/libpurple/protocols/jabber/roster.c b/libpurple/protocols/jabber/roster.c index 21d9beb272..8921526df3 100644 --- a/libpurple/protocols/jabber/roster.c +++ b/libpurple/protocols/jabber/roster.c @@ -358,7 +358,7 @@ static void jabber_roster_update(JabberStream *js, const char *name, } void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) + PurpleGroup *group, const char *message) { JabberStream *js = purple_connection_get_protocol_data(gc); char *who; diff --git a/libpurple/protocols/jabber/roster.h b/libpurple/protocols/jabber/roster.h index 4bc4384e03..367fd05d7f 100644 --- a/libpurple/protocols/jabber/roster.h +++ b/libpurple/protocols/jabber/roster.h @@ -32,7 +32,7 @@ void jabber_roster_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, xmlnode *query); void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group); + PurpleGroup *group, const char *message); void jabber_roster_alias_change(PurpleConnection *gc, const char *name, const char *alias); void jabber_roster_group_change(PurpleConnection *gc, const char *name, diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 659b1c005a..11c7032836 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -2951,7 +2951,7 @@ static PurplePluginProtocolInfo prpl_info = msn_set_status, /* set_away */ msn_set_idle, /* set_idle */ NULL, /* change_passwd */ - NULL, /* add_buddy */ + msn_add_buddy, /* add_buddy */ NULL, /* add_buddies */ msn_rem_buddy, /* remove_buddy */ NULL, /* remove_buddies */ @@ -3001,9 +3001,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* get_media_caps */ NULL, /* get_moods */ msn_set_public_alias, /* set_public_alias */ - msn_get_public_alias, /* get_public_alias */ - msn_add_buddy, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + msn_get_public_alias /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index fd53b0a9cd..97afb7cf1c 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -696,7 +696,7 @@ static PurplePluginProtocolInfo proto_info = { mxit_set_status, /* set_status */ NULL, /* set_idle */ NULL, /* change_passwd */ - NULL, /* add_buddy [roster.c] */ + mxit_add_buddy, /* add_buddy [roster.c] */ NULL, /* add_buddies */ mxit_remove_buddy, /* remove_buddy [roster.c] */ NULL, /* remove_buddies */ @@ -746,9 +746,7 @@ static PurplePluginProtocolInfo proto_info = { mxit_media_caps, /* get_media_caps */ mxit_get_moods, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - mxit_add_buddy, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index 41a9ffcd62..76079f9dea 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -2627,7 +2627,7 @@ msim_update_blocklist_for_buddy(MsimSession *session, const char *name, gboolean * Add a buddy to user's buddy list. */ static void -msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { MsimSession *session; MsimMessage *msg; @@ -3082,9 +3082,7 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; /** diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index c24c7f9167..405e7691e7 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -2545,7 +2545,7 @@ novell_chat_send(PurpleConnection * gc, int id, const char *text, PurpleMessageF } static void -novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group) +novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group, const char *message) { NMFolder *folder = NULL; NMContact *contact; @@ -3545,9 +3545,7 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = { diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index b6d972cb6b..d2266ff96b 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -548,7 +548,7 @@ static void nullprpl_change_passwd(PurpleConnection *gc, const char *old_pass, } static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) + PurpleGroup *group, const char *message) { const char *username = gc->account->username; PurpleConnection *buddy_gc = get_nullprpl_gc(buddy->name); @@ -571,20 +571,20 @@ static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, username, NULL, /* local account id (rarely used) */ NULL, /* alias */ - NULL); /* message */ + message); /* message */ } } } static void nullprpl_add_buddies(PurpleConnection *gc, GList *buddies, - GList *groups) { + GList *groups, const char *message) { GList *buddy = buddies; GList *group = groups; purple_debug_info("nullprpl", "adding multiple buddies\n"); while (buddy && group) { - nullprpl_add_buddy(gc, (PurpleBuddy *)buddy->data, (PurpleGroup *)group->data); + nullprpl_add_buddy(gc, (PurpleBuddy *)buddy->data, (PurpleGroup *)group->data, message); buddy = g_list_next(buddy); group = g_list_next(group); } @@ -1131,9 +1131,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static void nullprpl_init(PurplePlugin *plugin) diff --git a/libpurple/protocols/oscar/libaim.c b/libpurple/protocols/oscar/libaim.c index 0a169e9534..5834ab0d8a 100644 --- a/libpurple/protocols/oscar/libaim.c +++ b/libpurple/protocols/oscar/libaim.c @@ -50,7 +50,7 @@ static PurplePluginProtocolInfo prpl_info = oscar_set_status, /* set_status */ oscar_set_idle, /* set_idle */ oscar_change_passwd, /* change_passwd */ - NULL, /* add_buddy */ + oscar_add_buddy, /* add_buddy */ NULL, /* add_buddies */ oscar_remove_buddy, /* remove_buddy */ NULL, /* remove_buddies */ @@ -100,9 +100,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - oscar_add_buddy, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/oscar/libicq.c b/libpurple/protocols/oscar/libicq.c index 18f5451e59..89e2f4d048 100644 --- a/libpurple/protocols/oscar/libicq.c +++ b/libpurple/protocols/oscar/libicq.c @@ -59,7 +59,7 @@ static PurplePluginProtocolInfo prpl_info = oscar_set_status, /* set_status */ oscar_set_idle, /* set_idle */ oscar_change_passwd, /* change_passwd */ - NULL, /* add_buddy */ + oscar_add_buddy, /* add_buddy */ NULL, /* add_buddies */ oscar_remove_buddy, /* remove_buddy */ NULL, /* remove_buddies */ @@ -110,9 +110,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* can_do_media */ oscar_get_purple_moods, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - oscar_add_buddy, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 0979bc23c7..da6ee973ef 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -3806,7 +3806,7 @@ void oscar_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup } purple_account_remove_buddies(account, moved_buddies, groups); - purple_account_add_buddies(account, moved_buddies); + purple_account_add_buddies(account, moved_buddies, NULL); g_list_free(groups); purple_debug_info("oscar", "ssi: moved all buddies from group %s to %s\n", old_name, gname); diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index abb2ad4d99..547c8dd3ab 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -4513,7 +4513,8 @@ static void add_buddy_resolved(struct mwServiceResolve *srvc, static void mw_prpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) { + PurpleGroup *group, + const char *message) { struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); struct mwServiceResolve *srvc; @@ -4560,7 +4561,8 @@ static void foreach_add_buddies(PurpleGroup *group, GList *buddies, static void mw_prpl_add_buddies(PurpleConnection *gc, GList *buddies, - GList *groups) { + GList *groups, + const char *message) { struct mwPurplePluginData *pd; GHashTable *group_sets; diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index 08d92049ba..d555b44370 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -193,7 +193,7 @@ static void connection_free_all(struct simple_account_data *sip) { } } -static void simple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +static void simple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { struct simple_account_data *sip = purple_connection_get_protocol_data(gc); struct simple_buddy *b; @@ -223,7 +223,7 @@ static void simple_get_buddies(PurpleConnection *gc) { buddies = purple_find_buddies(account, NULL); while (buddies) { PurpleBuddy *buddy = buddies->data; - simple_add_buddy(gc, buddy, purple_buddy_get_group(buddy)); + simple_add_buddy(gc, buddy, purple_buddy_get_group(buddy), NULL); buddies = g_slist_delete_link(buddies, buddies); } @@ -2117,9 +2117,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; diff --git a/libpurple/protocols/yahoo/libyahoo.c b/libpurple/protocols/yahoo/libyahoo.c index 4e3d5ce263..a3871e1a72 100644 --- a/libpurple/protocols/yahoo/libyahoo.c +++ b/libpurple/protocols/yahoo/libyahoo.c @@ -267,9 +267,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/yahoo/libyahoojp.c b/libpurple/protocols/yahoo/libyahoojp.c index 219603c1fa..a7342f6bf9 100644 --- a/libpurple/protocols/yahoo/libyahoojp.c +++ b/libpurple/protocols/yahoo/libyahoojp.c @@ -163,9 +163,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 4914d777be..5fa9e57a04 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -4056,7 +4056,7 @@ static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data) buddy = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - yahoo_add_buddy(gc, buddy, NULL); + yahoo_add_buddy(gc, buddy, NULL, NULL); } @@ -4945,7 +4945,7 @@ void yahoo_keepalive(PurpleConnection *gc) } -void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) +void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g, const char *message) { YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; diff --git a/libpurple/protocols/yahoo/libymsg.h b/libpurple/protocols/yahoo/libymsg.h index 3dea10bfee..c6962ed4c5 100644 --- a/libpurple/protocols/yahoo/libymsg.h +++ b/libpurple/protocols/yahoo/libymsg.h @@ -371,7 +371,7 @@ int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, Purpl unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state); void yahoo_set_status(PurpleAccount *account, PurpleStatus *status); void yahoo_set_idle(PurpleConnection *gc, int idle); -void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g); +void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g, const char *message); void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); void yahoo_add_deny(PurpleConnection *gc, const char *who); void yahoo_rem_deny(PurpleConnection *gc, const char *who); diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 493012a55f..e8a848b324 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -2925,9 +2925,7 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = { diff --git a/libpurple/prpl.h b/libpurple/prpl.h index f5ae9b0062..9a8cc84675 100644 --- a/libpurple/prpl.h +++ b/libpurple/prpl.h @@ -316,6 +316,7 @@ struct _PurplePluginProtocolInfo void (*set_idle)(PurpleConnection *, int idletime); void (*change_passwd)(PurpleConnection *, const char *old_pass, const char *new_pass); + /** * Add a buddy to a group on the server. * @@ -324,11 +325,10 @@ struct _PurplePluginProtocolInfo * authorization and the user is not already authorized to see the * status of \a buddy, \a add_buddy should request authorization. * - * @deprecated Since 2.8.0, add_buddy_with_invite is preferred. - * @see add_buddy_with_invite + * If authorization is required, then use the supplied invite message. */ - void (*add_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group); - void (*add_buddies)(PurpleConnection *, GList *buddies, GList *groups); + void (*add_buddy)(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group, const char *message); + void (*add_buddies)(PurpleConnection *pc, GList *buddies, GList *groups, const char *message); void (*remove_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group); void (*remove_buddies)(PurpleConnection *, GList *buddies, GList *groups); void (*add_permit)(PurpleConnection *, const char *name); @@ -615,21 +615,6 @@ struct _PurplePluginProtocolInfo void (*get_public_alias)(PurpleConnection *gc, PurpleGetPublicAliasSuccessCallback success_cb, PurpleGetPublicAliasFailureCallback failure_cb); - - /** - * Add a buddy to a group on the server. - * - * This PRPL function may be called in situations in which the buddy is - * already in the specified group. If the protocol supports - * authorization and the user is not already authorized to see the - * status of \a buddy, \a add_buddy should request authorization. - * - * If authorization is required, then use the supplied invite message. - * - * @since 2.8.0 - */ - void (*add_buddy_with_invite)(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group, const char *message); - void (*add_buddies_with_invite)(PurpleConnection *pc, GList *buddies, GList *groups, const char *message); }; #define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \ diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 27be809f13..7225298762 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -7040,7 +7040,7 @@ add_buddy_cb(GtkWidget *w, int resp, PidginAddBuddyData *data) purple_blist_add_buddy(b, NULL, g, NULL); } - purple_account_add_buddy_with_invite(account, b, invite); + purple_account_add_buddy(account, b, invite); /* Offer to merge people with the same alias. */ if (whoalias != NULL && g != NULL) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index bb300561c0..a4563a993e 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6690,7 +6690,7 @@ gray_stuff_out(PidginConversation *gtkconv) if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - gtk_widget_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL) || (prpl_info->add_buddy_with_invite != NULL)); + gtk_widget_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); gtk_widget_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); gtk_widget_set_sensitive(win->menu.send_file, (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || -- cgit v1.2.1 From e440754ede6dfc934c37000b0624e53567ea080d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 3 Sep 2011 23:30:40 +0000 Subject: Move struct_size to the beginning of the struct. Even if we don't rewrite this somehow (as a GObject or otherwise), it really belongs at the start. --- libpurple/protocols/bonjour/bonjour.c | 2 +- libpurple/protocols/gg/gg.c | 2 +- libpurple/protocols/irc/irc.c | 2 +- libpurple/protocols/jabber/libxmpp.c | 3 +-- libpurple/protocols/msn/msn.c | 2 +- libpurple/protocols/mxit/mxit.c | 2 +- libpurple/protocols/myspace/myspace.c | 2 +- libpurple/protocols/novell/novell.c | 2 +- libpurple/protocols/null/nullprpl.c | 2 +- libpurple/protocols/oscar/libaim.c | 2 +- libpurple/protocols/oscar/libicq.c | 3 +-- libpurple/protocols/sametime/sametime.c | 4 +-- libpurple/protocols/simple/simple.c | 2 +- libpurple/protocols/yahoo/libyahoo.c | 4 +-- libpurple/protocols/yahoo/libyahoojp.c | 2 +- libpurple/protocols/zephyr/zephyr.c | 2 +- libpurple/prpl.h | 45 ++++++++++++++++----------------- 17 files changed, 39 insertions(+), 44 deletions(-) diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c index bbbd5ace8b..35ab87904b 100644 --- a/libpurple/protocols/bonjour/bonjour.c +++ b/libpurple/protocols/bonjour/bonjour.c @@ -484,6 +484,7 @@ static PurplePlugin *my_protocol = NULL; static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_NO_PASSWORD, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -549,7 +550,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 34a88b684d..1e9e369736 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -2655,6 +2655,7 @@ static gboolean ggp_offline_message(const PurpleBuddy *buddy) static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -2720,7 +2721,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* can_do_media */ diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index 286f61444c..50fa18516b 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -917,6 +917,7 @@ static void irc_keepalive(PurpleConnection *gc) static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_SLASH_COMMANDS_NATIVE, NULL, /* user_splits */ @@ -983,7 +984,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/protocols/jabber/libxmpp.c b/libpurple/protocols/jabber/libxmpp.c index 17bbd019e4..fff27fd8df 100644 --- a/libpurple/protocols/jabber/libxmpp.c +++ b/libpurple/protocols/jabber/libxmpp.c @@ -53,6 +53,7 @@ static PurplePlugin *my_protocol = NULL; static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_MAIL_CHECK | #ifdef HAVE_CYRUS_SASL OPT_PROTO_PASSWORD_OPTIONAL | @@ -122,8 +123,6 @@ static PurplePluginProtocolInfo prpl_info = jabber_unregister_account, /* unregister_user */ jabber_send_attention, /* send_attention */ jabber_attention_types, /* attention_types */ - - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ jabber_initiate_media, /* initiate_media */ jabber_get_media_caps, /* get_media_caps */ diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 11c7032836..d3b87e08cd 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -2930,6 +2930,7 @@ static gboolean msn_uri_handler(const char *proto, const char *cmd, GHashTable * static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_MAIL_CHECK|OPT_PROTO_INVITE_MESSAGE, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -2995,7 +2996,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ msn_send_attention, /* send_attention */ msn_attention_types, /* attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ msn_get_account_text_table, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index 97afb7cf1c..f7b5a41015 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -668,6 +668,7 @@ static GHashTable *mxit_chat_info_defaults( PurpleConnection *gc, const char *ch /*========================================================================================================================*/ static PurplePluginProtocolInfo proto_info = { + sizeof( PurplePluginProtocolInfo ), /* struct_size */ OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE, /* options */ NULL, /* user_splits */ NULL, /* protocol_options */ @@ -740,7 +741,6 @@ static PurplePluginProtocolInfo proto_info = { NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* attention_types */ - sizeof( PurplePluginProtocolInfo ), /* struct_size */ mxit_get_text_table, /* get_account_text_table */ mxit_media_initiate, /* initiate_media */ mxit_media_caps, /* get_media_caps */ diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index 76079f9dea..3e6a6596f0 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -3007,6 +3007,7 @@ msim_get_account_text_table(PurpleAccount *unused) * Callbacks called by Purple, to access this plugin. */ static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ /* options */ OPT_PROTO_USE_POINTSIZE /* specify font size in sane point size */ | OPT_PROTO_MAIL_CHECK, @@ -3076,7 +3077,6 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* unregister_user */ msim_send_attention, /* send_attention */ msim_attention_types, /* attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ msim_get_account_text_table, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index 405e7691e7..b7cde14052 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -3474,6 +3474,7 @@ novell_keepalive(PurpleConnection *gc) } static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ 0, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -3539,7 +3540,6 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index d2266ff96b..5ffb717035 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -1052,6 +1052,7 @@ static gboolean nullprpl_offline_message(const PurpleBuddy *buddy) { static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_NO_PASSWORD | OPT_PROTO_CHAT_TOPIC, /* options */ NULL, /* user_splits, initialized in nullprpl_init() */ NULL, /* protocol_options, initialized in nullprpl_init() */ @@ -1125,7 +1126,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/protocols/oscar/libaim.c b/libpurple/protocols/oscar/libaim.c index 5834ab0d8a..7289ae04ff 100644 --- a/libpurple/protocols/oscar/libaim.c +++ b/libpurple/protocols/oscar/libaim.c @@ -29,6 +29,7 @@ static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -94,7 +95,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/protocols/oscar/libicq.c b/libpurple/protocols/oscar/libicq.c index 89e2f4d048..fc219a6477 100644 --- a/libpurple/protocols/oscar/libicq.c +++ b/libpurple/protocols/oscar/libicq.c @@ -38,6 +38,7 @@ icq_get_account_text_table(PurpleAccount *account) static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -103,8 +104,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - - sizeof(PurplePluginProtocolInfo), /* struct_size */ icq_get_account_text_table, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* can_do_media */ diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 547c8dd3ab..b2da115b96 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -5154,6 +5154,7 @@ static void mw_prpl_send_file(PurpleConnection *gc, static PurplePluginProtocolInfo mw_prpl_info = { + .struct_size = sizeof(PurplePluginProtocolInfo), .options = OPT_PROTO_IM_IMAGE, .user_splits = NULL, /*< set in mw_plugin_init */ .protocol_options = NULL, /*< set in mw_plugin_init */ @@ -5213,8 +5214,7 @@ static PurplePluginProtocolInfo mw_prpl_info = { .new_xfer = mw_prpl_new_xfer, .offline_message = NULL, .whiteboard_prpl_ops = NULL, - .send_raw = NULL, - .struct_size = sizeof(PurplePluginProtocolInfo) + .send_raw = NULL }; diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index d555b44370..f938da103f 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -2046,6 +2046,7 @@ static void simple_close(PurpleConnection *gc) static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ 0, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -2111,7 +2112,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/protocols/yahoo/libyahoo.c b/libpurple/protocols/yahoo/libyahoo.c index a3871e1a72..11e700e8aa 100644 --- a/libpurple/protocols/yahoo/libyahoo.c +++ b/libpurple/protocols/yahoo/libyahoo.c @@ -194,6 +194,7 @@ static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops = static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -257,11 +258,8 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* send_raw */ NULL, /* roomlist_room_serialize */ NULL, /* unregister_user */ - yahoo_send_attention, yahoo_attention_types, - - sizeof(PurplePluginProtocolInfo), /* struct_size */ yahoo_get_account_text_table, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/protocols/yahoo/libyahoojp.c b/libpurple/protocols/yahoo/libyahoojp.c index a7342f6bf9..d3593bcf50 100644 --- a/libpurple/protocols/yahoo/libyahoojp.c +++ b/libpurple/protocols/yahoo/libyahoojp.c @@ -90,6 +90,7 @@ static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops = static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -157,7 +158,6 @@ static PurplePluginProtocolInfo prpl_info = yahoo_send_attention, yahoo_attention_types, - sizeof(PurplePluginProtocolInfo), /* struct_size */ yahoojp_get_account_text_table, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index e8a848b324..8e4f9bca36 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -2853,6 +2853,7 @@ static GList *zephyr_actions(PurplePlugin *plugin, gpointer context) static PurplePlugin *my_protocol = NULL; static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_NO_PASSWORD, NULL, /* ??? user_splits */ NULL, /* ??? protocol_options */ @@ -2919,7 +2920,6 @@ static PurplePluginProtocolInfo prpl_info = { NULL, NULL, NULL, - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initate_media */ NULL, /* get_media_caps */ diff --git a/libpurple/prpl.h b/libpurple/prpl.h index 9a8cc84675..438f23786b 100644 --- a/libpurple/prpl.h +++ b/libpurple/prpl.h @@ -205,6 +205,27 @@ typedef enum */ struct _PurplePluginProtocolInfo { + /** + * The size of the PurplePluginProtocolInfo. This should always be sizeof(PurplePluginProtocolInfo). + * This allows adding more functions to this struct without requiring a major version bump. + */ + unsigned long struct_size; + + /* NOTE: + * If more functions are added, they should accessed using the following syntax: + * + * if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, new_function)) + * prpl->new_function(...); + * + * instead of + * + * if (prpl->new_function != NULL) + * prpl->new_function(...); + * + * The PURPLE_PROTOCOL_PLUGIN_HAS_FUNC macro can be used for the older member + * functions (e.g. login, send_im etc.) too. + */ + PurpleProtocolOptions options; /**< Protocol options. */ GList *user_splits; /**< A GList of PurpleAccountUserSplit */ @@ -517,27 +538,6 @@ struct _PurplePluginProtocolInfo gboolean (*send_attention)(PurpleConnection *gc, const char *username, guint type); GList *(*get_attention_types)(PurpleAccount *acct); - /** - * The size of the PurplePluginProtocolInfo. This should always be sizeof(PurplePluginProtocolInfo). - * This allows adding more functions to this struct without requiring a major version bump. - */ - unsigned long struct_size; - - /* NOTE: - * If more functions are added, they should accessed using the following syntax: - * - * if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, new_function)) - * prpl->new_function(...); - * - * instead of - * - * if (prpl->new_function != NULL) - * prpl->new_function(...); - * - * The PURPLE_PROTOCOL_PLUGIN_HAS_FUNC macro can be used for the older member - * functions (e.g. login, send_im etc.) too. - */ - /** This allows protocols to specify additional strings to be used for * various purposes. The idea is to stuff a bunch of strings in this hash * table instead of expanding the struct for every addition. This hash @@ -618,8 +618,7 @@ struct _PurplePluginProtocolInfo }; #define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \ - (((G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < G_STRUCT_OFFSET(PurplePluginProtocolInfo, struct_size)) \ - || (G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < prpl->struct_size)) && \ + (G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < prpl->struct_size && \ prpl->member != NULL) -- cgit v1.2.1 From 18fd291100d5e781c5cace03e0257671ac424e32 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 3 Sep 2011 23:39:48 +0000 Subject: I just don't like this not being in alphabetical order. --- configure.ac | 10 +++++----- libpurple/protocols/Makefile.am | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 89b66d5f41..e62804573f 100644 --- a/configure.ac +++ b/configure.ac @@ -1070,7 +1070,7 @@ if test "x$STATIC_PRPLS" != "x" -a "x$DYNAMIC_PRPLS" = "xall"; then fi if test "x$STATIC_PRPLS" = "xall" ; then - STATIC_PRPLS="bonjour gg irc jabber msn myspace mxit novell oscar sametime silc simple yahoo zephyr" + STATIC_PRPLS="bonjour gg irc jabber msn mxit myspace novell oscar sametime silc simple yahoo zephyr" fi if test "x$have_meanwhile" != "xyes" ; then STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/sametime//'` @@ -1115,8 +1115,8 @@ for i in $STATIC_PRPLS ; do irc) static_irc=yes ;; jabber) static_jabber=yes ;; msn) static_msn=yes ;; - myspace) static_myspace=yes ;; mxit) static_mxit=yes ;; + myspace) static_myspace=yes ;; novell) static_novell=yes ;; oscar) static_oscar=yes ;; aim) static_oscar=yes ;; @@ -1134,8 +1134,8 @@ AM_CONDITIONAL(STATIC_GG, test "x$static_gg" = "xyes") AM_CONDITIONAL(STATIC_IRC, test "x$static_irc" = "xyes") AM_CONDITIONAL(STATIC_JABBER, test "x$static_jabber" = "xyes") AM_CONDITIONAL(STATIC_MSN, test "x$static_msn" = "xyes") -AM_CONDITIONAL(STATIC_MYSPACE, test "x$static_myspace" = "xyes") AM_CONDITIONAL(STATIC_MXIT, test "x$static_mxit" = "xyes") +AM_CONDITIONAL(STATIC_MYSPACE, test "x$static_myspace" = "xyes") AM_CONDITIONAL(STATIC_NOVELL, test "x$static_novell" = "xyes") AM_CONDITIONAL(STATIC_OSCAR, test "x$static_oscar" = "xyes") AM_CONDITIONAL(STATIC_SAMETIME, test "x$static_sametime" = "xyes" -a "x$have_meanwhile" = "xyes") @@ -1149,7 +1149,7 @@ AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init static void static_proto_init AC_ARG_WITH(dynamic_prpls, [AC_HELP_STRING([--with-dynamic-prpls], [specify which protocols to build dynamically])], [DYNAMIC_PRPLS=`echo $withval | $sedpath 's/,/ /g'`]) if test "x$DYNAMIC_PRPLS" = "xall" ; then - DYNAMIC_PRPLS="bonjour gg irc jabber msn myspace mxit novell oscar sametime silc simple yahoo zephyr" + DYNAMIC_PRPLS="bonjour gg irc jabber msn mxit myspace novell oscar sametime silc simple yahoo zephyr" fi if test "x$have_meanwhile" != "xyes"; then DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/sametime//'` @@ -1168,8 +1168,8 @@ for i in $DYNAMIC_PRPLS ; do irc) dynamic_irc=yes ;; jabber) dynamic_jabber=yes ;; msn) dynamic_msn=yes ;; - myspace) dynamic_myspace=yes ;; mxit) dynamic_mxit=yes ;; + myspace) dynamic_myspace=yes ;; novell) dynamic_novell=yes ;; null) dynamic_null=yes ;; oscar) dynamic_oscar=yes ;; diff --git a/libpurple/protocols/Makefile.am b/libpurple/protocols/Makefile.am index b58394f693..c4a74361da 100644 --- a/libpurple/protocols/Makefile.am +++ b/libpurple/protocols/Makefile.am @@ -1,5 +1,5 @@ EXTRA_DIST = Makefile.mingw -DIST_SUBDIRS = bonjour gg irc jabber msn myspace mxit novell null oscar sametime silc simple yahoo zephyr +DIST_SUBDIRS = bonjour gg irc jabber msn mxit myspace novell null oscar sametime silc simple yahoo zephyr SUBDIRS = $(DYNAMIC_PRPLS) $(STATIC_PRPLS) -- cgit v1.2.1 From 186f45f2168fa43ea16dbc6b6a321df99fdb9940 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 3 Sep 2011 23:51:17 +0000 Subject: Fix Perl bindings, which apparently were missing the _with_invite functions originally. --- libpurple/plugins/perl/common/Account.xs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libpurple/plugins/perl/common/Account.xs b/libpurple/plugins/perl/common/Account.xs index 4976b84299..2a400d0379 100644 --- a/libpurple/plugins/perl/common/Account.xs +++ b/libpurple/plugins/perl/common/Account.xs @@ -199,9 +199,10 @@ purple_account_destroy_log(account) Purple::Account account void -purple_account_add_buddies(account, list) +purple_account_add_buddies(account, list, message) Purple::Account account SV * list + const char *message PREINIT: GList *t_GL; int i, t_len; @@ -212,13 +213,14 @@ PPCODE: for (i = 0; i <= t_len; i++) t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(list), i, 0))); - purple_account_add_buddies(account, t_GL); + purple_account_add_buddies(account, t_GL, message); g_list_free(t_GL); void -purple_account_add_buddy(account, buddy) - Purple::Account account - Purple::BuddyList::Buddy buddy +purple_account_add_buddy(account, buddy, message) + Purple::Account account + Purple::BuddyList::Buddy buddy + const char * message void purple_account_change_password(account, a, b) -- cgit v1.2.1 From fe2b43bfb40c35f9a626700e3bea64f241041242 Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Sun, 4 Sep 2011 18:42:42 +0000 Subject: sametime: fix build (add_buddies added param) --- libpurple/protocols/sametime/sametime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index b2da115b96..79fc38df7b 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -1398,7 +1398,7 @@ static void blist_init(PurpleAccount *acct) { } if(add_buds) { - purple_account_add_buddies(acct, add_buds); + purple_account_add_buddies(acct, add_buds, NULL); g_list_free(add_buds); } } -- cgit v1.2.1 From 412d538131d208038f44cc20d25e07685a70c86e Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Sun, 4 Sep 2011 18:45:51 +0000 Subject: silc: Fix build and update for API changes --- libpurple/protocols/silc/buddy.c | 2 +- libpurple/protocols/silc/silc.c | 6 ++---- libpurple/protocols/silc/silcpurple.h | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c index 61a39e0e92..4222d7c3ed 100644 --- a/libpurple/protocols/silc/buddy.c +++ b/libpurple/protocols/silc/buddy.c @@ -1396,7 +1396,7 @@ silcpurple_add_buddy_i(PurpleConnection *gc, PurpleBuddy *b, gboolean init) silc_buffer_free(attrs); } -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { /* Don't add if the buddy is already on the list. * diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index b300a8b170..242aa522e4 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -2050,6 +2050,7 @@ static PurpleWhiteboardPrplOps silcpurple_wb_ops = static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE | OPT_PROTO_SLASH_COMMANDS_NATIVE, @@ -2117,15 +2118,12 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/silc/silcpurple.h b/libpurple/protocols/silc/silcpurple.h index 937e0cc358..4c0cdb8a75 100644 --- a/libpurple/protocols/silc/silcpurple.h +++ b/libpurple/protocols/silc/silcpurple.h @@ -105,7 +105,7 @@ void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, SilcVerifyPublicKey completion, void *context); GList *silcpurple_buddy_menu(PurpleBuddy *buddy); -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); +void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message); void silcpurple_send_buddylist(PurpleConnection *gc); void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); void silcpurple_buddy_keyagr_request(SilcClient client, -- cgit v1.2.1 From 21fcd59fca9c751dc09c371ff2dc75eba842e883 Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Sun, 4 Sep 2011 18:52:18 +0000 Subject: xmlnode: Fix some brokeness in xmlnode serialization with prefixed elements. Basically we were treating node->xmlns as the default namespace, but that isn't the case with prefexed elements. In our serialization, I believe we were adding an extraneous xmlns='' to a prefixed element, which changes the (default) namespace for its children. (It's been a bit too long with this in my tree, so I've forgotten the exact details) --- libpurple/tests/test_xmlnode.c | 62 ++++++++++++++++++++++++++++++++++++++++++ libpurple/xmlnode.c | 56 ++++++++++++++++++++++++++++++++++---- libpurple/xmlnode.h | 21 +++++++++++++- 3 files changed, 132 insertions(+), 7 deletions(-) diff --git a/libpurple/tests/test_xmlnode.c b/libpurple/tests/test_xmlnode.c index 59f8d44338..8353794fa3 100644 --- a/libpurple/tests/test_xmlnode.c +++ b/libpurple/tests/test_xmlnode.c @@ -21,6 +21,66 @@ START_TEST(test_xmlnode_billion_laughs_attack) } END_TEST +#define check_doc_structure(x) { \ + xmlnode *ping, *child1, *child2; \ + fail_if(x == NULL, "Failed to parse document"); \ + ping = xmlnode_get_child(x, "ping"); \ + fail_if(ping == NULL, "Failed to find 'ping' child"); \ + child1 = xmlnode_get_child(ping, "child1"); \ + fail_if(child1 == NULL, "Failed to find 'child1'"); \ + child2 = xmlnode_get_child(child1, "child2"); \ + fail_if(child2 == NULL, "Failed to find 'child2'"); \ + xmlnode_new_child(child2, "a"); \ + \ + assert_string_equal("jabber:client", xmlnode_get_namespace(x)); \ + /* NOTE: xmlnode_get_namespace() returns the namespace of the element, not the + * current default namespace. See http://www.w3.org/TR/xml-names/#defaulting and + * http://www.w3.org/TR/xml-names/#dt-defaultNS. + */ \ + assert_string_equal("urn:xmpp:ping", xmlnode_get_namespace(ping)); \ + assert_string_equal("jabber:client", xmlnode_get_namespace(child1)); \ + assert_string_equal("urn:xmpp:ping", xmlnode_get_namespace(child2)); \ + /* + * This fails (well, actually crashes [the ns is NULL]) unless + * xmlnode_new_child() actually sets the element namespace. + assert_string_equal("jabber:client", xmlnode_get_namespace(xmlnode_get_child(child2, "a"))); + */ \ + \ + assert_string_equal("jabber:client", xmlnode_get_default_namespace(x)); \ + assert_string_equal("jabber:client", xmlnode_get_default_namespace(ping)); \ + assert_string_equal("jabber:client", xmlnode_get_default_namespace(child1)); \ + assert_string_equal("jabber:client", xmlnode_get_default_namespace(child2)); \ +} + +START_TEST(test_xmlnode_prefixes) +{ + const char *xml_doc = + "" + "" + "" + "" /* xmlns='jabber:child' */ + "" + "" + ""; + char *str; + xmlnode *xml, *reparsed; + + xml = xmlnode_from_str(xml_doc, -1); + check_doc_structure(xml); + + /* Check that xmlnode_from_str(xmlnode_to_str(xml, NULL), -1) is idempotent. */ + str = xmlnode_to_str(xml, NULL); + fail_if(str == NULL, "Failed to serialize XMLnode"); + reparsed = xmlnode_from_str(str, -1); + fail_if(reparsed == NULL, "Failed to reparse xml document"); + check_doc_structure(reparsed); + + g_free(str); + xmlnode_free(xml); + xmlnode_free(reparsed); +} +END_TEST + Suite * xmlnode_suite(void) { @@ -28,6 +88,8 @@ xmlnode_suite(void) TCase *tc = tcase_create("xmlnode"); tcase_add_test(tc, test_xmlnode_billion_laughs_attack); + tcase_add_test(tc, test_xmlnode_prefixes); + suite_add_tcase(s, tc); return s; diff --git a/libpurple/xmlnode.c b/libpurple/xmlnode.c index 32b9c9d038..c335247875 100644 --- a/libpurple/xmlnode.c +++ b/libpurple/xmlnode.c @@ -78,6 +78,19 @@ xmlnode_new_child(xmlnode *parent, const char *name) node = new_node(name, XMLNODE_TYPE_TAG); xmlnode_insert_child(parent, node); +#if 0 + /* This would give xmlnodes more appropriate namespacing + * when creating them. Otherwise, unless an explicit namespace + * is set, xmlnode_get_namespace() will return NULL, when + * there may be a default namespace. + * + * I'm unconvinced that it's useful, and concerned it may break things. + * + * _insert_child would need the same thing, probably (assuming + * xmlns->node == NULL) + */ + xmlnode_set_namespace(node, xmlnode_get_default_namespace(node)) +#endif return node; } @@ -255,13 +268,34 @@ void xmlnode_set_namespace(xmlnode *node, const char *xmlns) node->xmlns = g_strdup(xmlns); } -const char *xmlnode_get_namespace(xmlnode *node) +const char *xmlnode_get_namespace(const xmlnode *node) { g_return_val_if_fail(node != NULL, NULL); return node->xmlns; } +const char *xmlnode_get_default_namespace(const xmlnode *node) +{ + const char *ns = NULL; + g_return_val_if_fail(node != NULL, NULL); + + /* If this node does *not* have a prefix, node->xmlns is the default + * namespace. Otherwise, it's the prefix namespace. + */ + if (!node->prefix && node->xmlns) { + return node->xmlns; + } else if (node->namespace_map) { + ns = g_hash_table_lookup(node->namespace_map, ""); + } + + /* No default ns found? Walk up the tree looking for one */ + if (!(ns && *ns) && node->parent) + ns = xmlnode_get_default_namespace(node->parent); + + return ns; +} + void xmlnode_set_prefix(xmlnode *node, const char *prefix) { g_return_if_fail(node != NULL); @@ -443,12 +477,22 @@ xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int de if (node->namespace_map) { g_hash_table_foreach(node->namespace_map, (GHFunc)xmlnode_to_str_foreach_append_ns, text); - } else if (node->xmlns) { - if(!node->parent || !purple_strequal(node->xmlns, node->parent->xmlns)) + } else { + /* Figure out if this node has a different default namespace from parent */ + const char *xmlns = NULL; + const char *parent_xmlns = NULL; + if (!prefix) + xmlns = node->xmlns; + + if (!xmlns) + xmlns = xmlnode_get_default_namespace(node); + if (node->parent) + parent_xmlns = xmlnode_get_default_namespace(node->parent); + if (!purple_strequal(xmlns, parent_xmlns)) { - char *xmlns = g_markup_escape_text(node->xmlns, -1); - g_string_append_printf(text, " xmlns='%s'", xmlns); - g_free(xmlns); + char *escaped_xmlns = g_markup_escape_text(xmlns, -1); + g_string_append_printf(text, " xmlns='%s'", escaped_xmlns); + g_free(escaped_xmlns); } } for(c = node->child; c; c = c->next) diff --git a/libpurple/xmlnode.h b/libpurple/xmlnode.h index 2a12229c2b..1d8eefcf48 100644 --- a/libpurple/xmlnode.h +++ b/libpurple/xmlnode.h @@ -221,7 +221,26 @@ void xmlnode_set_namespace(xmlnode *node, const char *xmlns); * @param node The node to get the namepsace from * @return The namespace of this node */ -const char *xmlnode_get_namespace(xmlnode *node); +const char *xmlnode_get_namespace(const xmlnode *node); + +/** + * Returns the current default namespace. The default + * namespace is the current namespace which applies to child + * elements which are unprefixed and which do not contain their + * own namespace. + * + * For example, given: + * + * + * + * + * The default namespace of all nodes (including 'child1') is "jabber:client", + * though the namespace for 'element' is "http://example.org/ns1". + * + * @param node The node for which to return the default namespace + * @return The default namespace of this node + */ +const char *xmlnode_get_default_namespace(const xmlnode *node); /** * Sets the prefix of a node -- cgit v1.2.1 From 4bbd0a68d544ef9c108318bbd4e8aa78601812a9 Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Sun, 4 Sep 2011 21:06:26 +0000 Subject: xmlnode: Add xmlnode_strip_prefixes This is largely based on a patch from Thijs (sphynx/xnyhps) Alkemade, with some modifications by me to try to maintain namespaces of elements as best as we can. I also rewrote xmlnode_get_default_namespace not to use recursion. References #14529 --- libpurple/tests/test_xmlnode.c | 36 ++++++++++++++++++ libpurple/xmlnode.c | 84 ++++++++++++++++++++++++++++++++++++------ libpurple/xmlnode.h | 22 +++++++++++ 3 files changed, 130 insertions(+), 12 deletions(-) diff --git a/libpurple/tests/test_xmlnode.c b/libpurple/tests/test_xmlnode.c index 8353794fa3..264a468d92 100644 --- a/libpurple/tests/test_xmlnode.c +++ b/libpurple/tests/test_xmlnode.c @@ -81,6 +81,41 @@ START_TEST(test_xmlnode_prefixes) } END_TEST + +START_TEST(test_strip_prefixes) +{ + const char *xml_doc = "" + "" + "xvlc xvlc" + "" + "" + "xvlc xvlc" + "" + "" + ""; + const char *out = "" + "" + "xvlc xvlc" + "" + "" + "

xvlc xvlc

" + "" + "" + "
"; + char *str; + xmlnode *xml; + + xml = xmlnode_from_str(xml_doc, -1); + fail_if(xml == NULL, "Failed to parse XML"); + + xmlnode_strip_prefixes(xml); + str = xmlnode_to_str(xml, NULL); + assert_string_equal_free(out, str); + + xmlnode_free(xml); +} +END_TEST + Suite * xmlnode_suite(void) { @@ -89,6 +124,7 @@ xmlnode_suite(void) TCase *tc = tcase_create("xmlnode"); tcase_add_test(tc, test_xmlnode_billion_laughs_attack); tcase_add_test(tc, test_xmlnode_prefixes); + tcase_add_test(tc, test_strip_prefixes); suite_add_tcase(s, tc); diff --git a/libpurple/xmlnode.c b/libpurple/xmlnode.c index c335247875..e1072056a7 100644 --- a/libpurple/xmlnode.c +++ b/libpurple/xmlnode.c @@ -262,10 +262,18 @@ xmlnode_get_attrib_with_namespace(const xmlnode *node, const char *attr, const c void xmlnode_set_namespace(xmlnode *node, const char *xmlns) { + char *tmp; g_return_if_fail(node != NULL); - g_free(node->xmlns); + tmp = node->xmlns; node->xmlns = g_strdup(xmlns); + + if (node->namespace_map) { + g_hash_table_insert(node->namespace_map, + g_strdup(""), g_strdup(xmlns)); + } + + g_free(tmp); } const char *xmlnode_get_namespace(const xmlnode *node) @@ -277,21 +285,26 @@ const char *xmlnode_get_namespace(const xmlnode *node) const char *xmlnode_get_default_namespace(const xmlnode *node) { + const xmlnode *current_node; const char *ns = NULL; + g_return_val_if_fail(node != NULL, NULL); - /* If this node does *not* have a prefix, node->xmlns is the default - * namespace. Otherwise, it's the prefix namespace. - */ - if (!node->prefix && node->xmlns) { - return node->xmlns; - } else if (node->namespace_map) { - ns = g_hash_table_lookup(node->namespace_map, ""); - } + current_node = node; + while (current_node) { + /* If this node does *not* have a prefix, node->xmlns is the default + * namespace. Otherwise, it's the prefix namespace. + */ + if (!current_node->prefix && current_node->xmlns) { + return current_node->xmlns; + } else if (current_node->namespace_map) { + ns = g_hash_table_lookup(current_node->namespace_map, ""); + if (ns && *ns) + return ns; + } - /* No default ns found? Walk up the tree looking for one */ - if (!(ns && *ns) && node->parent) - ns = xmlnode_get_default_namespace(node->parent); + current_node = current_node->parent; + } return ns; } @@ -310,6 +323,53 @@ const char *xmlnode_get_prefix(const xmlnode *node) return node->prefix; } +const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix) +{ + const xmlnode *current_node; + + g_return_val_if_fail(node != NULL, NULL); + g_return_val_if_fail(prefix != NULL, xmlnode_get_default_namespace(node)); + + current_node = node; + while (current_node) { + if (current_node->prefix && g_str_equal(prefix, current_node->prefix) && + current_node->xmlns) { + return current_node->xmlns; + } else if (current_node->namespace_map) { + const char *ns = g_hash_table_lookup(current_node->namespace_map, prefix); + if (ns && *ns) { + return ns; + } + } + + current_node = current_node->parent; + } + + return NULL; +} + +void xmlnode_strip_prefixes(xmlnode *node) +{ + xmlnode *child; + const char *prefix; + + g_return_if_fail(node != NULL); + + for (child = node->child; child; child = child->next) { + if (child->type == XMLNODE_TYPE_TAG) + xmlnode_strip_prefixes(child); + } + + prefix = xmlnode_get_prefix(node); + if (prefix) { + const char *ns = xmlnode_get_prefix_namespace(node, prefix); + xmlnode_set_namespace(node, ns); + xmlnode_set_prefix(node, NULL); + } else { + xmlnode_set_namespace(node, xmlnode_get_default_namespace(node)); + } +} + xmlnode *xmlnode_get_parent(const xmlnode *child) { g_return_val_if_fail(child != NULL, NULL); diff --git a/libpurple/xmlnode.h b/libpurple/xmlnode.h index 1d8eefcf48..07e4b5a19d 100644 --- a/libpurple/xmlnode.h +++ b/libpurple/xmlnode.h @@ -242,6 +242,15 @@ const char *xmlnode_get_namespace(const xmlnode *node); */ const char *xmlnode_get_default_namespace(const xmlnode *node); +/** + * Returns the defined namespace for a prefix. + * + * @param node The node from which to start the search. + * @param prefix The prefix for which to return the associated namespace. + * @return The namespace for this prefix. + */ +const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix); + /** * Sets the prefix of a node * @@ -258,6 +267,19 @@ void xmlnode_set_prefix(xmlnode *node, const char *prefix); */ const char *xmlnode_get_prefix(const xmlnode *node); +/** + * Remove all element prefixes from an xmlnode tree. The prefix's + * namespace is transformed into the default namespace for an element. + * + * Note that this will not necessarily remove all prefixes in use + * (prefixed attributes may still exist), and that this usage may + * break some applications (SOAP / XPath apparently often rely on + * the prefixes having the same name. + * + * @param node The node from which to strip prefixes + */ +void xmlnode_strip_prefixes(xmlnode *node); + /** * Gets the parent node. * -- cgit v1.2.1 From 83c7f690979764cbfb8fc4c308924998f5212101 Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Sun, 4 Sep 2011 21:08:40 +0000 Subject: jabber: Strip element prefixes on XHTML-IM content. I'm a little late to the party in completing this code, as I believe Google's actually reverted the change. But the consensus was we should present saner content to the core/UIs. Fixes #14529 --- libpurple/protocols/jabber/message.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c index 71f349fc5d..95edd960fc 100644 --- a/libpurple/protocols/jabber/message.c +++ b/libpurple/protocols/jabber/message.c @@ -638,6 +638,8 @@ void jabber_message_parse(JabberStream *js, xmlnode *packet) jabber_message_add_remote_smileys(js, to, packet); } + xmlnode_strip_prefixes(child); + /* reformat xhtml so that img tags with a "cid:" src gets translated to the bare text of the emoticon (the "alt" attrib) */ /* this is done also when custom smiley retrieval is turned off, -- cgit v1.2.1 From 763098249631652ad441e9533c58540d4309ec5a Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Sun, 4 Sep 2011 21:11:24 +0000 Subject: ChangeLog that. Refs #14529 --- ChangeLog | 5 +++++ ChangeLog.API | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dd50b22f7e..285f7742b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,11 @@ version 3.0.0 (??/??/????): * The buddy's name was not centered vertically in the buddy-list if they did not have a status-message or mood set. + XMPP: + * Strip element prefixes from XHTML-IM messages as they're presented + to the core (and UIs) as incoming messages (Thijs Alkemade). + (#14529) + version 2.10.0 (08/18/2011): Pidgin: * Make the max size of incoming smileys a pref instead of hardcoding it. diff --git a/ChangeLog.API b/ChangeLog.API index c08f14a652..5735f95c07 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -46,7 +46,9 @@ version 3.0.0 (??/??/????): * purple_xfer_set_protocol_data * purple_xfer_set_status * purple_xfer_set_ui_data - * purple_xfer_set_watcher + * purple_xfer_set_watcher + * xmlnode_get_default_namespace + * xmlnode_strip_prefixes Changed: * purple_connection_error now takes a PurpleConnectionError -- cgit v1.2.1 From 6ece5b84f6380c6941cd0a80522e0c00d5e57dab Mon Sep 17 00:00:00 2001 From: Daniel Atallah Date: Mon, 5 Sep 2011 17:17:17 +0000 Subject: Fix win32 build for gtkdocklet changes. I'm not happy with the way this works right now: * The menu is scrolled off the bottom of the screen with the default taskbar placement * Closing the buddy list quits --- pidgin/Makefile.mingw | 2 -- pidgin/gtkdocklet.c | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pidgin/Makefile.mingw b/pidgin/Makefile.mingw index 145bb7f6d1..006ea4d5e7 100644 --- a/pidgin/Makefile.mingw +++ b/pidgin/Makefile.mingw @@ -95,8 +95,6 @@ PIDGIN_C_SRC = \ minidialog.c \ pidginstock.c \ pidgintooltip.c \ - win32/MinimizeToTray.c \ - win32/gtkdocklet-win32.c \ win32/gtkwin32dep.c \ win32/untar.c \ win32/wspell.c diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index c5d109c28e..adcd4b4d90 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -1036,6 +1036,7 @@ pidgin_docklet_init() void *accounts_handle = purple_accounts_get_handle(); void *status_handle = purple_savedstatuses_get_handle(); void *docklet_handle = pidgin_docklet_get_handle(); + gchar *tmp; purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet"); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/blink", FALSE); @@ -1051,8 +1052,9 @@ pidgin_docklet_init() purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); } - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), - DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "pidgin" G_DIR_SEPARATOR_S "tray"); + tmp = g_build_path(G_DIR_SEPARATOR_S, DATADIR, "pixmaps", "pidgin", "tray", NULL); + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), tmp); + g_free(tmp); if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always")) docklet_gtk_status_create(FALSE); -- cgit v1.2.1 From 8a62f5a6ddd29e6b1ac06c3e64a89d2b6ba3b604 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 5 Sep 2011 19:58:03 +0000 Subject: purple_blist_update_buddy_icon() has been deprecated since 2.5.0, and can be removed now. --- ChangeLog.API | 1 + libpurple/blist.c | 6 ------ libpurple/blist.h | 12 ------------ libpurple/plugins/perl/common/BuddyList.xs | 4 ---- 4 files changed, 1 insertion(+), 22 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 5735f95c07..b0c00c2bfa 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -107,6 +107,7 @@ version 3.0.0 (??/??/????): * PidginConversation.sg * purple_account_add_buddies_with_invite * purple_account_add_buddy_with_invite + * purple_blist_update_buddy_icon * purple_buddy_icons_has_custom_icon * purple_buddy_icons_find_custom_icon * purple_buddy_icons_set_custom_icon diff --git a/libpurple/blist.c b/libpurple/blist.c index 08b6c0739b..22d033dd6d 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -956,12 +956,6 @@ purple_blist_update_node_icon(PurpleBlistNode *node) ops->update(purplebuddylist, node); } -void -purple_blist_update_buddy_icon(PurpleBuddy *buddy) -{ - purple_blist_update_node_icon((PurpleBlistNode *)buddy); -} - /* * TODO: Maybe remove the call to this from server.c and call it * from oscar.c and toc.c instead? diff --git a/libpurple/blist.h b/libpurple/blist.h index a053d081c6..fbf00de6b5 100644 --- a/libpurple/blist.h +++ b/libpurple/blist.h @@ -454,21 +454,9 @@ void purple_blist_update_buddy_status(PurpleBuddy *buddy, PurpleStatus *old_stat * Updates a node's custom icon. * * @param node The PurpleBlistNode whose custom icon has changed. - * - * @since 2.5.0 */ void purple_blist_update_node_icon(PurpleBlistNode *node); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) -/** - * Updates a buddy's icon. - * - * @param buddy The buddy whose buddy icon has changed - * @deprecated Use purple_blist_update_node_icon() instead. - */ -void purple_blist_update_buddy_icon(PurpleBuddy *buddy); -#endif - /** * Renames a buddy in the buddy list. * diff --git a/libpurple/plugins/perl/common/BuddyList.xs b/libpurple/plugins/perl/common/BuddyList.xs index 65f10184f0..fc4fa04b17 100644 --- a/libpurple/plugins/perl/common/BuddyList.xs +++ b/libpurple/plugins/perl/common/BuddyList.xs @@ -199,10 +199,6 @@ purple_blist_update_buddy_status(buddy, old_status) Purple::BuddyList::Buddy buddy Purple::Status old_status -void -purple_blist_update_buddy_icon(buddy) - Purple::BuddyList::Buddy buddy - void purple_blist_rename_buddy(buddy, name) Purple::BuddyList::Buddy buddy -- cgit v1.2.1 From dd00e85fc13c771bee66494c026f118b49c48233 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 5 Sep 2011 20:02:49 +0000 Subject: purple_contact_set_alias() is deprecated, and can be removed for 3.0.0. --- ChangeLog.API | 1 + libpurple/blist.c | 5 ----- libpurple/blist.h | 12 ------------ libpurple/plugins/perl/common/BuddyList.xs | 5 ----- 4 files changed, 1 insertion(+), 22 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index b0c00c2bfa..9f5e3fd128 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -112,6 +112,7 @@ version 3.0.0 (??/??/????): * purple_buddy_icons_find_custom_icon * purple_buddy_icons_set_custom_icon * purple_connection_error_reason + * purple_contact_set_alias * purple_core_migrate * purple_dnsquery_a_account * purple_notify_searchresults_column_get_title diff --git a/libpurple/blist.c b/libpurple/blist.c index 22d033dd6d..0aa92af194 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -1737,11 +1737,6 @@ purple_contact_get_group(const PurpleContact *contact) return (PurpleGroup *)(((PurpleBlistNode *)contact)->parent); } -void purple_contact_set_alias(PurpleContact *contact, const char *alias) -{ - purple_blist_alias_contact(contact,alias); -} - const char *purple_contact_get_alias(PurpleContact* contact) { g_return_val_if_fail(contact != NULL, NULL); diff --git a/libpurple/blist.h b/libpurple/blist.h index fbf00de6b5..f1cd79edf1 100644 --- a/libpurple/blist.h +++ b/libpurple/blist.h @@ -762,18 +762,6 @@ void purple_blist_merge_contact(PurpleContact *source, PurpleBlistNode *node); */ PurpleBuddy *purple_contact_get_priority_buddy(PurpleContact *contact); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) -/** - * Sets the alias for a contact. - * - * @param contact The contact - * @param alias The alias to set, or NULL to unset - * - * @deprecated Use purple_blist_alias_contact() instead. - */ -void purple_contact_set_alias(PurpleContact *contact, const char *alias); -#endif - /** * Gets the alias for a contact. * diff --git a/libpurple/plugins/perl/common/BuddyList.xs b/libpurple/plugins/perl/common/BuddyList.xs index fc4fa04b17..b747417b17 100644 --- a/libpurple/plugins/perl/common/BuddyList.xs +++ b/libpurple/plugins/perl/common/BuddyList.xs @@ -82,11 +82,6 @@ Purple::BuddyList::Buddy purple_contact_get_priority_buddy(contact) Purple::BuddyList::Contact contact -void -purple_contact_set_alias(contact, alias) - Purple::BuddyList::Contact contact - const char * alias - const char * purple_contact_get_alias(contact) Purple::BuddyList::Contact contact -- cgit v1.2.1 From c64635efdc5db32f66c9270f49faeb38adf696fd Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 5 Sep 2011 20:08:59 +0000 Subject: purple_buddy_get_local_alias() has been deprecated since 2.6.0, and can be removed for 3.0.0. --- ChangeLog.API | 1 + libpurple/blist.c | 20 -------------------- libpurple/blist.h | 13 ------------- libpurple/plugins/perl/common/BuddyList.xs | 4 ---- 4 files changed, 1 insertion(+), 37 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 9f5e3fd128..fbf97c9d2a 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -108,6 +108,7 @@ version 3.0.0 (??/??/????): * purple_account_add_buddies_with_invite * purple_account_add_buddy_with_invite * purple_blist_update_buddy_icon + * purple_buddy_get_local_alias * purple_buddy_icons_has_custom_icon * purple_buddy_icons_find_custom_icon * purple_buddy_icons_set_custom_icon diff --git a/libpurple/blist.c b/libpurple/blist.c index 0aa92af194..bc922a78b2 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -2364,26 +2364,6 @@ const char *purple_buddy_get_server_alias(PurpleBuddy *buddy) return NULL; } -const char *purple_buddy_get_local_alias(PurpleBuddy *buddy) -{ - PurpleContact *c; - - g_return_val_if_fail(buddy != NULL, NULL); - - /* Search for an alias for the buddy. In order of precedence: */ - /* The buddy alias */ - if (buddy->alias != NULL) - return buddy->alias; - - /* The contact alias */ - c = purple_buddy_get_contact(buddy); - if ((c != NULL) && (c->alias != NULL)) - return c->alias; - - /* The buddy's user name (i.e. no alias) */ - return buddy->name; -} - const char *purple_chat_get_name(PurpleChat *chat) { char *ret = NULL; diff --git a/libpurple/blist.h b/libpurple/blist.h index f1cd79edf1..1b073a2c83 100644 --- a/libpurple/blist.h +++ b/libpurple/blist.h @@ -852,19 +852,6 @@ const char *purple_buddy_get_server_alias(PurpleBuddy *buddy); */ const char *purple_buddy_get_contact_alias(PurpleBuddy *buddy); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) -/** - * Returns the correct alias for this user, ignoring server aliases. Used - * when a user-recognizable name is required. In order: buddy's alias; buddy's - * contact alias; buddy's user name. - * - * @param buddy The buddy whose alias will be returned. - * @return The appropriate name or alias. - * @deprecated Try purple_buddy_get_alias(), if server aliases are okay. - */ -const char *purple_buddy_get_local_alias(PurpleBuddy *buddy); -#endif - /** * Returns the correct name to display for a buddy. In order of precedence: * the buddy's alias; the buddy's server alias; the buddy's contact alias; diff --git a/libpurple/plugins/perl/common/BuddyList.xs b/libpurple/plugins/perl/common/BuddyList.xs index b747417b17..d6c1f3b076 100644 --- a/libpurple/plugins/perl/common/BuddyList.xs +++ b/libpurple/plugins/perl/common/BuddyList.xs @@ -420,10 +420,6 @@ const char * purple_buddy_get_contact_alias(buddy) Purple::BuddyList::Buddy buddy -const char * -purple_buddy_get_local_alias(buddy) - Purple::BuddyList::Buddy buddy - const char * purple_buddy_get_alias(buddy) Purple::BuddyList::Buddy buddy -- cgit v1.2.1 From fecdc115504771aa9509463d82ecbd1c05e3b82e Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 5 Sep 2011 20:16:47 +0000 Subject: purple_conv_chat_set_users() has been deprecated since 2.9.0, and can be removed for 3.0.0. --- ChangeLog.API | 1 + libpurple/conversation.c | 10 ---------- libpurple/conversation.h | 16 ---------------- libpurple/plugins/perl/common/Conversation.xs | 18 ------------------ 4 files changed, 1 insertion(+), 44 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index fbf97c9d2a..6f5b26faca 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -114,6 +114,7 @@ version 3.0.0 (??/??/????): * purple_buddy_icons_set_custom_icon * purple_connection_error_reason * purple_contact_set_alias + * purple_conv_chat_set_users * purple_core_migrate * purple_dnsquery_a_account * purple_notify_searchresults_column_get_title diff --git a/libpurple/conversation.c b/libpurple/conversation.c index d797a4c1e9..f0131a7a80 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -1378,16 +1378,6 @@ purple_conv_chat_get_conversation(const PurpleConvChat *chat) return chat->conv; } -GList * -purple_conv_chat_set_users(PurpleConvChat *chat, GList *users) -{ - g_return_val_if_fail(chat != NULL, NULL); - - chat->in_room = users; - - return users; -} - GList * purple_conv_chat_get_users(const PurpleConvChat *chat) { diff --git a/libpurple/conversation.h b/libpurple/conversation.h index 91e12b758e..9bed15c18d 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -1079,22 +1079,6 @@ void purple_conv_custom_smiley_close(PurpleConversation *conv, const char *smile */ PurpleConversation *purple_conv_chat_get_conversation(const PurpleConvChat *chat); -/** - * Sets the list of users in the chat room. - * - * @note Calling this function will not update the display of the users. - * Please use purple_conv_chat_add_user(), purple_conv_chat_add_users(), - * purple_conv_chat_remove_user(), and purple_conv_chat_remove_users() instead. - * - * @param chat The chat. - * @param users The list of users. - * - * @return The list passed. - * - * @deprecated This function will be removed in 3.0.0. You shouldn't be using it anyway. - */ -GList *purple_conv_chat_set_users(PurpleConvChat *chat, GList *users); - /** * Returns a list of users in the chat room. The members of the list * are PurpleConvChatBuddy objects. diff --git a/libpurple/plugins/perl/common/Conversation.xs b/libpurple/plugins/perl/common/Conversation.xs index 3239b57d99..a6e9219486 100644 --- a/libpurple/plugins/perl/common/Conversation.xs +++ b/libpurple/plugins/perl/common/Conversation.xs @@ -337,24 +337,6 @@ Purple::Conversation purple_conv_chat_get_conversation(chat) Purple::Conversation::Chat chat -void -purple_conv_chat_set_users(chat, users) - Purple::Conversation::Chat chat - SV * users -PREINIT: - GList *l, *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(users)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); - - for (l = purple_conv_chat_set_users(chat, t_GL); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - void purple_conv_chat_get_users(chat) Purple::Conversation::Chat chat -- cgit v1.2.1 From d84c60e401651d72941440c4739197344340bad7 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 5 Sep 2011 20:37:04 +0000 Subject: purple_proxy_connect_socks5() was deprecated in 2.8.0, and can be removed for 3.0.0. --- ChangeLog.API | 1 + libpurple/proxy.c | 11 ----------- libpurple/proxy.h | 29 ----------------------------- 3 files changed, 1 insertion(+), 40 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 6f5b26faca..386c073ca7 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -129,6 +129,7 @@ version 3.0.0 (??/??/????): * purple_plugins_unregister_unload_notify_cb * purple_presence_add_status * purple_presence_add_list + * purple_proxy_connect_socks5 * purple_srv_cancel * purple_srv_resolve_account * purple_status_set_attr_boolean diff --git a/libpurple/proxy.c b/libpurple/proxy.c index 8afac03190..dade7f3cc7 100644 --- a/libpurple/proxy.c +++ b/libpurple/proxy.c @@ -2408,17 +2408,6 @@ purple_proxy_connect_udp(void *handle, PurpleAccount *account, return connect_data; } -PurpleProxyConnectData * -purple_proxy_connect_socks5(void *handle, PurpleProxyInfo *gpi, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, - gpointer data) -{ - return purple_proxy_connect_socks5_account(NULL, handle, gpi, - host, port, connect_cb, data); -} - - /* This is called when we connect to the SOCKS5 proxy server (through any * relevant account proxy) */ diff --git a/libpurple/proxy.h b/libpurple/proxy.h index 5bd963a8d8..63f6af35b3 100644 --- a/libpurple/proxy.h +++ b/libpurple/proxy.h @@ -307,35 +307,6 @@ PurpleProxyConnectData *purple_proxy_connect_socks5_account(void *handle, const char *host, int port, PurpleProxyConnectFunction connect_cb, gpointer data); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PROXY_C_) -/** - * Makes a connection through a SOCKS5 proxy. - * - * @param handle A handle that should be associated with this - * connection attempt. The handle can be used - * to cancel the connection attempt using the - * purple_proxy_connect_cancel_with_handle() - * function. - * @param gpi The PurpleProxyInfo specifying the proxy settings - * @param host The destination host. - * @param port The destination port. - * @param connect_cb The function to call when the connection is - * established. If the connection failed then - * fd will be -1 and error message will be set - * to something descriptive (hopefully). - * @param data User-defined data. - * - * @return NULL if there was an error, or a reference to an - * opaque data structure that can be used to cancel - * the pending connection, if needed. - * @deprecated Use purple_proxy_connect_socks5_account instead - */ -PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle, - PurpleProxyInfo *gpi, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data); -#endif - /** * Cancel an in-progress connection attempt. This should be called * by the PRPL if the user disables an account while it is still -- cgit v1.2.1 From 42b832c19b29a0f1883c3228c1c6451ca92c0968 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 5 Sep 2011 21:11:07 +0000 Subject: Remove deprecated and unused PurplePluginProtocolInfo.get_cb_away. --- ChangeLog.API | 1 + libpurple/protocols/bonjour/bonjour.c | 1 - libpurple/protocols/gg/gg.c | 1 - libpurple/protocols/irc/irc.c | 1 - libpurple/protocols/jabber/libxmpp.c | 1 - libpurple/protocols/msn/msn.c | 1 - libpurple/protocols/mxit/mxit.c | 1 - libpurple/protocols/myspace/myspace.c | 1 - libpurple/protocols/novell/novell.c | 1 - libpurple/protocols/null/nullprpl.c | 1 - libpurple/protocols/oscar/libaim.c | 1 - libpurple/protocols/oscar/libicq.c | 1 - libpurple/protocols/sametime/sametime.c | 1 - libpurple/protocols/silc/silc.c | 1 - libpurple/protocols/simple/simple.c | 1 - libpurple/protocols/yahoo/libyahoo.c | 1 - libpurple/protocols/yahoo/libyahoojp.c | 1 - libpurple/protocols/zephyr/zephyr.c | 1 - libpurple/prpl.h | 5 ----- pidgin/gtkconv.c | 36 --------------------------------- 20 files changed, 1 insertion(+), 58 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 386c073ca7..6b806802fa 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -149,6 +149,7 @@ version 3.0.0 (??/??/????): * PurpleConnectionUiOps.report_disconnect_reason * PurplePluginProtocolInfo.add_buddy_with_invite * PurplePluginProtocolInfo.add_buddies_with_invite + * PurplePluginProtocolInfo.get_cb_away * serv_got_attention * serv_send_attention * struct _GtkIMHtmlFontDetail diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c index 35ab87904b..f5a591b8ef 100644 --- a/libpurple/protocols/bonjour/bonjour.c +++ b/libpurple/protocols/bonjour/bonjour.c @@ -525,7 +525,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ bonjour_group_buddy, /* group_buddy */ bonjour_rename_group, /* rename_group */ diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 1e9e369736..079e087405 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -2696,7 +2696,6 @@ static PurplePluginProtocolInfo prpl_info = ggp_keepalive, /* keepalive */ ggp_register_user, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index 50fa18516b..de6eb62626 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -959,7 +959,6 @@ static PurplePluginProtocolInfo prpl_info = irc_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ diff --git a/libpurple/protocols/jabber/libxmpp.c b/libpurple/protocols/jabber/libxmpp.c index fff27fd8df..53b7b9bd75 100644 --- a/libpurple/protocols/jabber/libxmpp.c +++ b/libpurple/protocols/jabber/libxmpp.c @@ -98,7 +98,6 @@ static PurplePluginProtocolInfo prpl_info = jabber_keepalive, /* keepalive */ jabber_register_account, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ jabber_roster_alias_change, /* alias_buddy */ jabber_roster_group_change, /* group_buddy */ jabber_roster_group_rename, /* rename_group */ diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index d3b87e08cd..2325c41ac8 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -2971,7 +2971,6 @@ static PurplePluginProtocolInfo prpl_info = msn_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ msn_alias_buddy, /* alias_buddy */ msn_group_buddy, /* group_buddy */ msn_rename_group, /* rename_group */ diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index f7b5a41015..8d5a5d72db 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -716,7 +716,6 @@ static PurplePluginProtocolInfo proto_info = { mxit_keepalive, /* keepalive */ mxit_register, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ mxit_buddy_alias, /* alias_buddy [roster.c] */ mxit_buddy_group, /* group_buddy [roster.c] */ mxit_rename_group, /* rename_group [roster.c] */ diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index 3e6a6596f0..f0f24bffd8 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -3052,7 +3052,6 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index b7cde14052..0983de5ec5 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -3515,7 +3515,6 @@ static PurplePluginProtocolInfo prpl_info = { novell_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ novell_alias_buddy, /* alias_buddy */ novell_group_buddy, /* group_buddy */ novell_rename_group, /* rename_group */ diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index 5ffb717035..7b17635a20 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -1101,7 +1101,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* keepalive */ nullprpl_register_user, /* register_user */ nullprpl_get_cb_info, /* get_cb_info */ - NULL, /* get_cb_away */ nullprpl_alias_buddy, /* alias_buddy */ nullprpl_group_buddy, /* group_buddy */ nullprpl_rename_group, /* rename_group */ diff --git a/libpurple/protocols/oscar/libaim.c b/libpurple/protocols/oscar/libaim.c index 7289ae04ff..86d280da46 100644 --- a/libpurple/protocols/oscar/libaim.c +++ b/libpurple/protocols/oscar/libaim.c @@ -70,7 +70,6 @@ static PurplePluginProtocolInfo prpl_info = oscar_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ oscar_alias_buddy, /* alias_buddy */ oscar_move_buddy, /* group_buddy */ oscar_rename_group, /* rename_group */ diff --git a/libpurple/protocols/oscar/libicq.c b/libpurple/protocols/oscar/libicq.c index fc219a6477..238ee06c6f 100644 --- a/libpurple/protocols/oscar/libicq.c +++ b/libpurple/protocols/oscar/libicq.c @@ -79,7 +79,6 @@ static PurplePluginProtocolInfo prpl_info = oscar_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ oscar_alias_buddy, /* alias_buddy */ oscar_move_buddy, /* group_buddy */ oscar_rename_group, /* rename_group */ diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 79fc38df7b..e135fa00ee 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -5195,7 +5195,6 @@ static PurplePluginProtocolInfo mw_prpl_info = { .keepalive = mw_prpl_keepalive, .register_user = NULL, .get_cb_info = NULL, - .get_cb_away = NULL, .alias_buddy = mw_prpl_alias_buddy, .group_buddy = mw_prpl_group_buddy, .rename_group = mw_prpl_rename_group, diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index 242aa522e4..1cbe8d0ddd 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -2093,7 +2093,6 @@ static PurplePluginProtocolInfo prpl_info = silcpurple_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index f938da103f..83101a8d91 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -2087,7 +2087,6 @@ static PurplePluginProtocolInfo prpl_info = simple_keep_alive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ diff --git a/libpurple/protocols/yahoo/libyahoo.c b/libpurple/protocols/yahoo/libyahoo.c index 11e700e8aa..0233bfe98c 100644 --- a/libpurple/protocols/yahoo/libyahoo.c +++ b/libpurple/protocols/yahoo/libyahoo.c @@ -235,7 +235,6 @@ static PurplePluginProtocolInfo prpl_info = yahoo_keepalive, NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ yahoo_update_alias, /* alias_buddy */ yahoo_change_buddys_group, yahoo_rename_group, diff --git a/libpurple/protocols/yahoo/libyahoojp.c b/libpurple/protocols/yahoo/libyahoojp.c index d3593bcf50..c06fd81f28 100644 --- a/libpurple/protocols/yahoo/libyahoojp.c +++ b/libpurple/protocols/yahoo/libyahoojp.c @@ -131,7 +131,6 @@ static PurplePluginProtocolInfo prpl_info = yahoo_keepalive, NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ yahoo_update_alias, /* alias_buddy */ yahoo_change_buddys_group, yahoo_rename_group, diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 8e4f9bca36..afbc6975fc 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -2894,7 +2894,6 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* keepalive -- Not necessary*/ NULL, /* register_user -- Not supported*/ NULL, /* XXX get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ diff --git a/libpurple/prpl.h b/libpurple/prpl.h index 438f23786b..3a4a2cf2c0 100644 --- a/libpurple/prpl.h +++ b/libpurple/prpl.h @@ -448,11 +448,6 @@ struct _PurplePluginProtocolInfo * @deprecated Use #PurplePluginProtocolInfo.get_info instead. */ void (*get_cb_info)(PurpleConnection *, int, const char *who); - /** - * @deprecated Use #PurplePluginProtocolInfo.get_cb_real_name and - * #PurplePluginProtocolInfo.status_text instead. - */ - void (*get_cb_away)(PurpleConnection *, int, const char *who); /** save/store buddy's alias on server list/roster */ void (*alias_buddy)(PurpleConnection *, const char *who, diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index a4563a993e..25be17699b 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1578,32 +1578,6 @@ menu_chat_info_cb(GtkWidget *w, PidginConversation *gtkconv) chat_do_info(gtkconv, who); } -static void -menu_chat_get_away_cb(GtkWidget *w, PidginConversation *gtkconv) -{ - PurpleConversation *conv = gtkconv->active_conv; - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc; - char *who; - - gc = purple_conversation_get_gc(conv); - who = g_object_get_data(G_OBJECT(w), "user_data"); - - if (gc != NULL) { - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - - /* - * May want to expand this to work similarly to menu_info_cb? - */ - - if (prpl_info->get_cb_away != NULL) - { - prpl_info->get_cb_away(gc, - purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who); - } - } -} - static void menu_chat_add_remove_cb(GtkWidget *w, PidginConversation *gtkconv) { @@ -1735,16 +1709,6 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); } - if (prpl_info && prpl_info->get_cb_away) { - button = pidgin_new_item_from_stock(menu, _("Get Away Message"), PIDGIN_STOCK_AWAY, - G_CALLBACK(menu_chat_get_away_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); - - if (gc == NULL) - gtk_widget_set_sensitive(button, FALSE); - else - g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); - } - if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { if ((buddy = purple_find_buddy(conv->account, who)) != NULL) button = pidgin_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE, -- cgit v1.2.1 From b10e6908fc99f7fcce07133fd1aced7df4ab2346 Mon Sep 17 00:00:00 2001 From: Daniel Atallah Date: Tue, 6 Sep 2011 00:25:29 +0000 Subject: Improve win32 behavior of the GtkStatusIcon based docklet. * Don't use a placement function (this causes the menu behavior to be "Windows Like" - appear where the cursor was during the click). * Don't deal with waiting for embedding - this doesn't appear to work on win32 (also not really a significant problem - there's always a system tray) --- pidgin/gtkdocklet.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index adcd4b4d90..ae9b9ee6d0 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -715,6 +715,7 @@ docklet_menu(void) { static GtkWidget *menu = NULL; GtkWidget *menuitem; + GtkMenuPositionFunc pos_func = gtk_status_icon_position_menu; if (menu) { gtk_widget_destroy(menu); @@ -790,10 +791,11 @@ docklet_menu(void) #ifdef _WIN32 g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); + pos_func = NULL; #endif gtk_widget_show_all(menu); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, - gtk_status_icon_position_menu, + pos_func, docklet, 0, gtk_get_current_event_time()); } @@ -1003,6 +1005,7 @@ docklet_gtk_status_create(gboolean recreate) */ if (!recreate) { pidgin_docklet_embedded(); +#ifdef _WIN32 #if GTK_CHECK_VERSION(2,12,0) if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) { embed_timeout = purple_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); @@ -1011,6 +1014,7 @@ docklet_gtk_status_create(gboolean recreate) } #else embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); +#endif #endif } -- cgit v1.2.1 From a48a3f11e6e780c5e16107183fda3de36bc9cd06 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 6 Sep 2011 18:22:03 +0000 Subject: disapproval of revision 'c08314ef2b9ceb6479c57fa6114095275488a94c' --- libpurple/util.c | 3 +-- libpurple/util.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libpurple/util.c b/libpurple/util.c index 5cc563b787..feb1cd2590 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -113,8 +113,7 @@ char * purple_menu_action_get_label(const PurpleMenuAction *act) return act->label; } -PurpleCallback * -purple_menu_action_get_callback(const PurpleMenuAction *act) +PurpleCallback purple_menu_action_get_callback(const PurpleMenuAction *act) { g_return_val_if_fail(act != NULL, NULL); diff --git a/libpurple/util.h b/libpurple/util.h index c56ba759ce..4e084a2db4 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -103,7 +103,7 @@ char * purple_menu_action_get_label(const PurpleMenuAction *act); * * @return The callback function. */ -PurpleCallback *purple_menu_action_get_callback(const PurpleMenuAction *act); +PurpleCallback purple_menu_action_get_callback(const PurpleMenuAction *act); /** * Returns the data stored in the PurpleMenuAction. -- cgit v1.2.1 From 174c75bd534186ddefde2c3433aecdd17abef990 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 6 Sep 2011 18:30:43 +0000 Subject: Correctly fix this build error without warnings. Maybe the PurpleMenuAction's callback should be made into a signal instead. --- libpurple/dbus-analyze-functions.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpurple/dbus-analyze-functions.py b/libpurple/dbus-analyze-functions.py index e9b7cc9d3b..06aa3f03f3 100644 --- a/libpurple/dbus-analyze-functions.py +++ b/libpurple/dbus-analyze-functions.py @@ -31,6 +31,11 @@ excluded = [\ "purple_account_unregister", "purple_connection_new_unregister", + # Similar to the above, again + "purple_menu_action_new", + "purple_menu_action_set_callback", + "purple_menu_action_get_callback", + # These functions are excluded because they involve setting arbitrary # data via pointers for protocols and UIs. This just won't work. "purple_blist_get_ui_data", -- cgit v1.2.1 From 85ccd0d11a760386c111e5c82d48e47c1ad66028 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 6 Sep 2011 18:38:01 +0000 Subject: I assume this check was backwards, since embedding should be used on !Windows. Also, fix a warning when the function's not used. --- pidgin/gtkdocklet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index ae9b9ee6d0..d60b534de3 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -858,6 +858,7 @@ docklet_gtk_recreate_cb(gpointer data) return FALSE; } +#ifndef _WIN32 static gboolean docklet_gtk_embed_timeout_cb(gpointer data) { @@ -890,6 +891,7 @@ docklet_gtk_embed_timeout_cb(gpointer data) return TRUE; #endif } +#endif #if GTK_CHECK_VERSION(2,12,0) static gboolean @@ -1005,7 +1007,7 @@ docklet_gtk_status_create(gboolean recreate) */ if (!recreate) { pidgin_docklet_embedded(); -#ifdef _WIN32 +#ifndef _WIN32 #if GTK_CHECK_VERSION(2,12,0) if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) { embed_timeout = purple_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); -- cgit v1.2.1 From b764f7e6ecab7e9d96f706ba646f2fba20a7becf Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Wed, 7 Sep 2011 04:35:38 +0000 Subject: Fix a crash at closing the conversation window. Patch suggested by Paul. --- pidgin/gtkconv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 357f42285d..03e62a919e 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -440,7 +440,8 @@ static void clear_conversation_scrollback(PurpleConversation *conv) static void clear_conversation_scrollback_cb(PurpleConversation *conv, void *data) { - clear_conversation_scrollback(conv); + if (PIDGIN_CONVERSATION(conv)) + clear_conversation_scrollback(conv); } static PurpleCmdRet clear_command_cb(PurpleConversation *conv, -- cgit v1.2.1 From 4f2974a66aa26781e46523de86d95a8bdd7c1700 Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Wed, 7 Sep 2011 04:57:34 +0000 Subject: This looks like a merge error. Fix it. --- pidgin/gtkconv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 03e62a919e..7840a67dbc 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -432,8 +432,6 @@ static void clear_conversation_scrollback(PurpleConversation *conv) gtkconv = PIDGIN_CONVERSATION(conv); webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (gtkconv->webview), "", ""); - for (iter = gtkconv->convs; iter; iter = iter->next) - purple_conversation_clear_message_history(iter->data); } @@ -447,7 +445,7 @@ static PurpleCmdRet clear_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - clear_conversation_scrollback(conv); + purple_conversation_clear_message_history(conv); return PURPLE_CMD_RET_OK; } @@ -455,7 +453,7 @@ static PurpleCmdRet clearall_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - purple_conversation_foreach(clear_conversation_scrollback); + purple_conversation_foreach(purple_conversation_clear_message_history); return PURPLE_CMD_RET_OK; } @@ -1148,7 +1146,7 @@ menu_clear_cb(gpointer data, guint action, GtkWidget *widget) PurpleConversation *conv; conv = pidgin_conv_window_get_active_conversation(win); - clear_conversation_scrollback(conv); + purple_conversation_clear_message_history(conv); } static void -- cgit v1.2.1 From d782fae524c53618d7e2afe16ef1af02f74d3df0 Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Wed, 7 Sep 2011 05:00:48 +0000 Subject: Get rid of a wrapper function. --- pidgin/gtkconv.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 7840a67dbc..c64e8df74c 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -424,22 +424,15 @@ debug_command_cb(PurpleConversation *conv, return PURPLE_CMD_RET_OK; } -static void clear_conversation_scrollback(PurpleConversation *conv) +static void clear_conversation_scrollback_cb(PurpleConversation *conv, + void *data) { PidginConversation *gtkconv = NULL; - GList *iter; gtkconv = PIDGIN_CONVERSATION(conv); - webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (gtkconv->webview), "", ""); -} - - -static void clear_conversation_scrollback_cb(PurpleConversation *conv, - void *data) -{ if (PIDGIN_CONVERSATION(conv)) - clear_conversation_scrollback(conv); + webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (gtkconv->webview), "", ""); } static PurpleCmdRet clear_command_cb(PurpleConversation *conv, -- cgit v1.2.1 From 6ced936dc524cdf95960d1ba8a86b5ecb15937d6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 8 Sep 2011 05:13:53 +0000 Subject: WebKit is only required when building Pidgin. --- configure.ac | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ff630fa3e6..3beab399a0 100644 --- a/configure.ac +++ b/configure.ac @@ -434,6 +434,16 @@ running configure. PKG_CHECK_MODULES(PANGO, [pango >= 1.4.0], AC_DEFINE(HAVE_PANGO14, 1, [Define if we have Pango 1.4 or newer.]),:) + PKG_CHECK_MODULES(WEBKIT, [webkit-1.0 >= 1.1.1], , [ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ +You must have WebKit 1.1.1 or newer development headers installed to compile +Pidgin. If you want to build only Finch then specify --disable-gtkui when +running configure. +])]) + AC_SUBST(WEBKIT_CFLAGS) + AC_SUBST(WEBKIT_LIBS) + dnl ####################################################################### dnl # Check if we should compile with X support dnl ####################################################################### @@ -710,8 +720,6 @@ AM_CONDITIONAL(ENABLE_GNT, test "x$enable_consoleui" = "xyes") #AC_CHECK_FUNC(wcwidth, [AC_DEFINE([HAVE_WCWIDTH], [1], [Define to 1 if you have wcwidth function.])]) -PKG_CHECK_MODULES(WEBKIT, [webkit-1.0 >= 1.1.1]); - dnl ####################################################################### dnl # Check for LibXML2 (required) dnl ####################################################################### -- cgit v1.2.1 From 98de8f8c9a56544302021ffb74dce7a33609a79a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 8 Sep 2011 22:04:35 +0000 Subject: Clean up this WebKit stuff. Fix up broken merging, mark unfinished work with FIXME/TODO, and fix this ungodly formatting. --- pidgin/gtkconv.c | 149 ++++++---- pidgin/gtklog.c | 20 +- pidgin/gtknotify.c | 17 +- pidgin/gtkwebview.c | 268 +++++++++-------- pidgin/gtkwebview.h | 36 ++- pidgin/plugins/adiumthemes/message-style.c | 440 ++++++++++++++------------- pidgin/plugins/adiumthemes/message-style.h | 40 ++- pidgin/plugins/adiumthemes/webkit.c | 463 +++++++++++++++-------------- pidgin/smileyparser.c | 135 +++++---- pidgin/smileyparser.h | 26 +- 10 files changed, 870 insertions(+), 724 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index ac4999cb9c..e546d7f995 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -175,8 +175,6 @@ static GList *available_list = NULL; static GList *away_list = NULL; static GList *busy_list = NULL; static GList *xa_list = NULL; -static GList *login_list = NULL; -static GList *logout_list = NULL; static GList *offline_list = NULL; static GHashTable *prpl_lists = NULL; @@ -315,6 +313,15 @@ default_formatize(PidginConversation *c) gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), conv->features); } +static void +conversation_entry_clear(PidginConversation *gtkconv) +{ + GtkIMHtml *imhtml = GTK_IMHTML(gtkconv->entry); + gtk_source_undo_manager_begin_not_undoable_action(imhtml->undo_manager); + gtk_imhtml_clear(imhtml); + gtk_source_undo_manager_end_not_undoable_action(imhtml->undo_manager); +} + static void clear_formatting_cb(GtkIMHtml *imhtml, PidginConversation *gtkconv) { @@ -425,15 +432,16 @@ debug_command_cb(PurpleConversation *conv, } static void clear_conversation_scrollback_cb(PurpleConversation *conv, - void *data) + void *data) { PidginConversation *gtkconv = NULL; gtkconv = PIDGIN_CONVERSATION(conv); if (PIDGIN_CONVERSATION(conv)) - webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (gtkconv->webview), "", ""); + webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(gtkconv->webview), "", ""); } + static PurpleCmdRet clear_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) @@ -613,7 +621,7 @@ send_cb(GtkWidget *widget, PidginConversation *gtkconv) account = purple_conversation_get_account(conv); if (check_for_and_do_command(conv)) { - gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); + conversation_entry_clear(gtkconv); return; } @@ -668,7 +676,7 @@ send_cb(GtkWidget *widget, PidginConversation *gtkconv) g_free(clean); g_free(buf); - gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); + conversation_entry_clear(gtkconv); gtkconv_set_unseen(gtkconv, PIDGIN_UNSEEN_NONE); } @@ -797,9 +805,9 @@ static void do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) { const char *buddy, *message; - PidginConversation *gtkconv; + PurpleConversation *conv; - gtkconv = PIDGIN_CONVERSATION(info->conv); + conv = info->conv; if (resp == GTK_RESPONSE_OK) { buddy = gtk_entry_get_text(GTK_ENTRY(info->entry)); @@ -808,8 +816,8 @@ do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) if (!g_ascii_strcasecmp(buddy, "")) return; - serv_chat_invite(purple_conversation_get_gc(info->conv), - purple_conv_chat_get_id(PURPLE_CONV_CHAT(info->conv)), + serv_chat_invite(purple_conversation_get_gc(conv), + purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), message, buddy); } @@ -903,7 +911,6 @@ invite_cb(GtkWidget *widget, PidginConversation *gtkconv) InviteBuddyInfo *info = NULL; if (invite_dialog == NULL) { - PurpleConnection *gc; PidginWindow *gtkwin; GtkWidget *label; GtkWidget *vbox, *hbox; @@ -916,7 +923,6 @@ invite_cb(GtkWidget *widget, PidginConversation *gtkconv) info = g_new0(InviteBuddyInfo, 1); info->conv = conv; - gc = purple_conversation_get_gc(conv); gtkwin = pidgin_conv_get_window(gtkconv); /* Create the new dialog. */ @@ -1583,8 +1589,19 @@ get_mark_for_user(PidginConversation *gtkconv, const char *who) static void menu_last_said_cb(GtkWidget *w, PidginConversation *gtkconv) { - /* I don't know what this is! */ - return; +/* FIXME: This doesn't work yet, of course... */ +#if 0 + GtkTextMark *mark; + const char *who; + + who = g_object_get_data(G_OBJECT(w), "user_data"); + mark = get_mark_for_user(gtkconv, who); + + if (mark != NULL) + gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); + else + g_return_if_reached(); +#endif } static GtkWidget * @@ -1789,10 +1806,13 @@ right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, chat_do_im(gtkconv, who); } else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) { /* Move to user's anchor */ - //GtkTextMark *mark = get_mark_for_user(gtkconv, who); +/* FIXME: This isn't implemented yet. */ +#if 0 + GtkTextMark *mark = get_mark_for_user(gtkconv, who); - //if(mark != NULL) - // gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); + if(mark != NULL) + gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); +#endif } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { GtkWidget *menu = create_chat_menu (conv, who, gc); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, @@ -2126,14 +2146,20 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) break; case GDK_Page_Up: - case GDK_KP_Page_Up: - //gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); + case GDK_KP_Page_Up: +/* FIXME: Write this. */ +#if 0 + gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); +#endif return TRUE; break; case GDK_Page_Down: - case GDK_KP_Page_Down: - //gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); + case GDK_KP_Page_Down: +/* FIXME: Write this. */ +#if 0 + gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); +#endif return TRUE; break; @@ -2243,7 +2269,7 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) entry = GTK_IMHTML(gtkconv->entry); protocol_name = purple_account_get_protocol_name(conv->account); gtk_imhtml_set_protocol_name(entry, protocol_name); - //gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); + /* FIXME: gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); */ if (!(conv->features & PURPLE_CONNECTION_HTML)) gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry)); @@ -2608,7 +2634,6 @@ redraw_icon(gpointer data) PidginConversation *gtkconv = (PidginConversation *)data; PurpleConversation *conv = gtkconv->active_conv; PurpleAccount *account; - PurplePluginProtocolInfo *prpl_info = NULL; GdkPixbuf *buf; GdkPixbuf *scale; @@ -3633,7 +3658,41 @@ typing_animation(gpointer data) { static void update_typing_message(PidginConversation *gtkconv, const char *message) { - /* this is not handled at all */ + /* FIXME: this is not handled at all */ +#if 0 + GtkTextBuffer *buffer; + GtkTextMark *stmark, *enmark; + + if (g_object_get_data(G_OBJECT(gtkconv->imhtml), "disable-typing-notification")) + return; + + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); + stmark = gtk_text_buffer_get_mark(buffer, "typing-notification-start"); + enmark = gtk_text_buffer_get_mark(buffer, "typing-notification-end"); + if (stmark && enmark) { + GtkTextIter start, end; + gtk_text_buffer_get_iter_at_mark(buffer, &start, stmark); + gtk_text_buffer_get_iter_at_mark(buffer, &end, enmark); + gtk_text_buffer_delete_mark(buffer, stmark); + gtk_text_buffer_delete_mark(buffer, enmark); + gtk_text_buffer_delete(buffer, &start, &end); + } else if (message && *message == '\n' && message[1] == ' ' && message[2] == '\0') + message = NULL; + +#ifdef RESERVE_LINE + if (!message) + message = "\n "; /* The blank space is required to avoid a GTK+/Pango bug */ +#endif + + if (message) { + GtkTextIter iter; + gtk_text_buffer_get_end_iter(buffer, &iter); + gtk_text_buffer_create_mark(buffer, "typing-notification-start", &iter, TRUE); + gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, message, -1, "TYPING-NOTIFICATION", NULL); + gtk_text_buffer_get_end_iter(buffer, &iter); + gtk_text_buffer_create_mark(buffer, "typing-notification-end", &iter, TRUE); + } +#endif } static void @@ -4979,17 +5038,17 @@ setup_common_pane(PidginConversation *gtkconv) gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_EMBLEM_COLUMN, NULL); g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL); - /* Setup the gtkimhtml widget */ + /* Setup the webkit widget */ /* TODO: create a pidgin_create_webview() function in utils*/ - webview_sw = gtk_scrolled_window_new (NULL, NULL); + webview_sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(webview_sw), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (webview_sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(webview_sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtkconv->webview = gtk_webview_new (); + gtkconv->webview = gtk_webview_new(); gtk_webview_set_vadjustment(GTK_WEBVIEW(gtkconv->webview), gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(webview_sw))); - gtk_container_add (GTK_CONTAINER (webview_sw), gtkconv->webview); - + gtk_container_add(GTK_CONTAINER(webview_sw), gtkconv->webview); + gtk_widget_set_size_request(gtkconv->webview, -1, 0); if (chat) { @@ -5737,11 +5796,8 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a PidginConversation *gtkconv; PurpleConnection *gc; PurpleAccount *account; - PurplePluginProtocolInfo *prpl_info; int gtk_font_options = 0; int gtk_font_options_all = 0; - int max_scrollback_lines; - int line_count; char buf2[BUF_LONG]; gboolean show_date; char *mdate; @@ -5809,12 +5865,9 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a } length = strlen(displaying) + 1; - - prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; - /* if the buffer is not empty add a
*/ - if (!gtk_webview_is_empty (GTK_WEBVIEW(gtkconv->webview))) - gtk_webview_append_html (GTK_WEBVIEW(gtkconv->webview), "
"); + if (!gtk_webview_is_empty(GTK_WEBVIEW(gtkconv->webview))) + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "
"); /* First message in a conversation. */ if (gtkconv->newday == 0) @@ -5870,7 +5923,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a /* TODO: These colors should not be hardcoded so log.c can use them */ if (flags & PURPLE_MESSAGE_RAW) { - gtk_webview_append_html (GTK_WEBVIEW(gtkconv->webview), message); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), message); } else if (flags & PURPLE_MESSAGE_SYSTEM) { g_snprintf(buf2, sizeof(buf2), "%s%s", @@ -5985,10 +6038,10 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a g_free(str); - if(gc){ + if (gc) { char *pre = g_strdup_printf("", sml_attrib ? sml_attrib : ""); char *post = ""; - with_font_tag = g_strdup_printf ("%s%s%s", pre, new_message, post); + with_font_tag = g_strdup_printf("%s%s%s", pre, new_message, post); g_free(pre); } else with_font_tag = g_memdup(new_message, length); @@ -6110,7 +6163,6 @@ pidgin_conv_chat_rename_user(PurpleConversation *conv, const char *old_name, GtkTreeIter iter; GtkTreeModel *model; GtkTextTag *tag; - int f = 1; chat = PURPLE_CONV_CHAT(conv); gtkconv = PIDGIN_CONVERSATION(conv); @@ -6904,7 +6956,6 @@ pidgin_conv_update_buddy_icon(PurpleConversation *conv) int size = 0; PurpleAccount *account; - PurplePluginProtocolInfo *prpl_info = NULL; PurpleBuddyIcon *icon; @@ -6921,8 +6972,6 @@ pidgin_conv_update_buddy_icon(PurpleConversation *conv) return; account = purple_conversation_get_account(conv); - if(account && account->gc) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); /* Remove the current icon stuff */ children = gtk_container_get_children(GTK_CONTAINER(gtkconv->u.im->icon_container)); @@ -6971,7 +7020,6 @@ pidgin_conv_update_buddy_icon(PurpleConversation *conv) if (data == NULL) { icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); - if (icon == NULL) { gtk_widget_set_size_request(gtkconv->u.im->icon_container, @@ -6980,7 +7028,6 @@ pidgin_conv_update_buddy_icon(PurpleConversation *conv) } data = purple_buddy_icon_get_data(icon, &len); - if (data == NULL) { gtk_widget_set_size_request(gtkconv->u.im->icon_container, @@ -7248,8 +7295,11 @@ show_timestamps_pref_cb(const char *name, PurplePrefType type, GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), (gboolean)GPOINTER_TO_INT(value)); - gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->webview), +/* FIXME: Use WebKit version of this. */ +#if 0 + gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); +#endif } } @@ -9879,12 +9929,9 @@ conv_get_group(PidginConversation *conv) static void conv_placement_by_group(PidginConversation *conv) { - PurpleConversationType type; PurpleGroup *group = NULL; GList *wl, *cl; - type = purple_conversation_get_type(conv->active_conv); - group = conv_get_group(conv); /* Go through the list of IMs and find one with this group. */ diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c index fe74abd8c1..f0ff185e5b 100644 --- a/pidgin/gtklog.c +++ b/pidgin/gtklog.c @@ -130,7 +130,7 @@ static void search_cb(GtkWidget *button, PidginLogViewer *lv) populate_log_tree(lv); g_free(lv->search); lv->search = NULL; - webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(lv->web_view)); + webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(lv->web_view)); select_first_log(lv); return; } @@ -138,7 +138,7 @@ static void search_cb(GtkWidget *button, PidginLogViewer *lv) if (lv->search != NULL && !strcmp(lv->search, search_term)) { /* Searching for the same term acts as "Find Next" */ - webkit_web_view_search_text (WEBKIT_WEB_VIEW(lv->web_view), lv->search, FALSE, TRUE, TRUE); + webkit_web_view_search_text(WEBKIT_WEB_VIEW(lv->web_view), lv->search, FALSE, TRUE, TRUE); return; } @@ -148,7 +148,7 @@ static void search_cb(GtkWidget *button, PidginLogViewer *lv) lv->search = g_strdup(search_term); gtk_tree_store_clear(lv->treestore); - webkit_web_view_open (WEBKIT_WEB_VIEW (lv->web_view), "about:blank"); /* clear the view */ + webkit_web_view_open(WEBKIT_WEB_VIEW(lv->web_view), "about:blank"); /* clear the view */ for (logs = lv->logs; logs != NULL; logs = logs->next) { char *read = purple_log_read((PurpleLog*)logs->data, NULL); @@ -419,9 +419,9 @@ static gboolean log_popup_menu_cb(GtkWidget *treeview, PidginLogViewer *lv) static gboolean search_find_cb(gpointer data) { PidginLogViewer *viewer = data; - webkit_web_view_mark_text_matches (WEBKIT_WEB_VIEW (viewer->web_view), viewer->search, FALSE, 0); - webkit_web_view_set_highlight_text_matches (WEBKIT_WEB_VIEW (viewer->web_view), TRUE); - webkit_web_view_search_text (WEBKIT_WEB_VIEW (viewer->web_view), viewer->search, FALSE, TRUE, TRUE); + webkit_web_view_mark_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, 0); + webkit_web_view_set_highlight_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), TRUE); + webkit_web_view_search_text(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, TRUE, TRUE); return FALSE; } @@ -462,11 +462,11 @@ static void log_select_cb(GtkTreeSelection *sel, PidginLogViewer *viewer) { read = purple_log_read(log, &flags); viewer->flags = flags; - webkit_web_view_open (WEBKIT_WEB_VIEW(viewer->web_view), "about:blank"); + webkit_web_view_open(WEBKIT_WEB_VIEW(viewer->web_view), "about:blank"); purple_signal_emit(pidgin_log_get_handle(), "log-displaying", viewer, log); - webkit_web_view_load_html_string (WEBKIT_WEB_VIEW(viewer->web_view), read, ""); + webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(viewer->web_view), read, ""); g_free(read); if (viewer->search != NULL) { @@ -614,7 +614,7 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE); - gtk_paned_add1(GTK_PANED(pane), + gtk_paned_add1(GTK_PANED(pane), pidgin_make_scrollable(lv->treeview, GTK_POLICY_NEVER, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1)); populate_log_tree(lv); @@ -649,7 +649,7 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_paned_add2(GTK_PANED(pane), vbox); /* Viewer ************/ - /* + /* FIXME: sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 73f75adeb3..1bbe24ec46 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -856,11 +856,11 @@ pidgin_notify_formatted(const char *title, const char *primary, /* Add the webview */ scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - web_view = gtk_webview_new (); - gtk_container_add (GTK_CONTAINER (scrolled_window), web_view); + web_view = gtk_webview_new(); + gtk_container_add(GTK_CONTAINER(scrolled_window), web_view); gtk_widget_set_name(web_view, "pidgin_notify_webview"); gtk_widget_set_size_request(web_view, 300, 250); @@ -878,7 +878,7 @@ pidgin_notify_formatted(const char *title, const char *primary, /* Make sure URLs are clickable */ linked_text = purple_markup_linkify(text); - webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (web_view), linked_text, ""); + webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(web_view), linked_text, ""); g_free(linked_text); g_object_set_data(G_OBJECT(window), "webview-widget", web_view); @@ -1138,9 +1138,8 @@ pidgin_notify_userinfo(PurpleConnection *gc, const char *who, if (pinfo != NULL) { GtkWidget *webview = g_object_get_data(G_OBJECT(pinfo->window), "webview-widget"); char *linked_text = purple_markup_linkify(info); - g_assert (webview); - printf ("%s\n", linked_text); - gtk_webview_load_html_string_with_imgstore (GTK_WEBVIEW (webview), linked_text); + g_assert(webview); + gtk_webview_load_html_string_with_imgstore(GTK_WEBVIEW(webview), linked_text); g_free(linked_text); g_free(key); ui_handle = pinfo->window; @@ -1640,7 +1639,7 @@ pidgin_create_notification_dialog(PidginNotifyType type) gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), + gtk_box_pack_start(GTK_BOX(vbox), pidgin_make_scrollable(spec_dialog->treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1), TRUE, TRUE, 2); diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 9647c01f57..b1aea12e4f 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -10,7 +10,7 @@ * source distribution. * * This program is free software; you can redistribute it and/or modify - * under the terms of the GNU General Public License as published by + * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * @@ -53,82 +53,85 @@ struct GtkWebViewPriv { GTimer *scroll_time; }; -GtkWidget* gtk_webview_new (void) +GtkWidget * +gtk_webview_new(void) { - GtkWebView* ret = GTK_WEBVIEW (g_object_new(gtk_webview_get_type(), NULL)); - return GTK_WIDGET (ret); + GtkWebView* ret = GTK_WEBVIEW(g_object_new(gtk_webview_get_type(), NULL)); + return GTK_WIDGET(ret); } -static char* -get_image_filename_from_id (GtkWebView* view, int id) +static char * +get_image_filename_from_id(GtkWebView* view, int id) { char *filename = NULL; FILE *file; PurpleStoredImage* img; if (!view->priv->images) - view->priv->images = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); - - filename = (char*) g_hash_table_lookup (view->priv->images, GINT_TO_POINTER (id)); - if (filename) return filename; - + view->priv->images = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); + + filename = (char *)g_hash_table_lookup(view->priv->images, GINT_TO_POINTER(id)); + if (filename) + return filename; + /* else get from img store */ - file = purple_mkstemp (&filename, TRUE); + file = purple_mkstemp(&filename, TRUE); - img = purple_imgstore_find_by_id (id); + img = purple_imgstore_find_by_id(id); - fwrite (purple_imgstore_get_data (img), purple_imgstore_get_size (img), 1, file); - g_hash_table_insert (view->priv->images, GINT_TO_POINTER (id), filename); - fclose (file); + fwrite(purple_imgstore_get_data(img), purple_imgstore_get_size(img), 1, file); + g_hash_table_insert(view->priv->images, GINT_TO_POINTER(id), filename); + fclose(file); return filename; } static void -clear_single_image (gpointer key, gpointer value, gpointer userdata) +clear_single_image(gpointer key, gpointer value, gpointer userdata) { - g_unlink ((char*) value); + g_unlink((char *)value); } static void -clear_images (GtkWebView* view) +clear_images(GtkWebView *view) { - if (!view->priv->images) return; - g_hash_table_foreach (view->priv->images, clear_single_image, NULL); - g_hash_table_unref (view->priv->images); + if (!view->priv->images) + return; + g_hash_table_foreach(view->priv->images, clear_single_image, NULL); + g_hash_table_unref(view->priv->images); } /* * Replace all tags with . I hoped to never - * write any HTML parsing code, but I'm forced to do this, until + * write any HTML parsing code, but I'm forced to do this, until * purple changes the way it works. */ -static char* -replace_img_id_with_src (GtkWebView *view, const char* html) +static char * +replace_img_id_with_src(GtkWebView *view, const char *html) { - GString *buffer = g_string_sized_new (strlen (html)); + GString *buffer = g_string_sized_new(strlen(html)); const char* cur = html; char *id; int nid; while (*cur) { - const char* img = strstr (cur, ""); + cur = strstr(img, "/>"); if (!cur) - cur = strstr (img, ">"); + cur = strstr(img, ">"); if (!cur) { /* invalid html? */ - g_string_printf (buffer, "%s", html); + g_string_printf(buffer, "%s", html); break; } - if (strstr (img, "src=") || !strstr (img, "id=")) { - g_string_printf (buffer, "%s", html); + if (strstr(img, "src=") || !strstr(img, "id=")) { + g_string_printf(buffer, "%s", html); break; } @@ -138,46 +141,46 @@ replace_img_id_with_src (GtkWebView *view, const char* html) * '=' cannot appear in parameters. */ - id = strstr (img, "id=") + 3; + id = strstr(img, "id=") + 3; /* *id can't be \0, since a ">" appears after this */ - if (isdigit (*id)) - nid = atoi (id); - else - nid = atoi (id+1); + if (isdigit(*id)) + nid = atoi(id); + else + nid = atoi(id + 1); /* let's dump this, tag and then dump the src information */ - g_string_append_len (buffer, img, cur - img); + g_string_append_len(buffer, img, cur - img); - g_string_append_printf (buffer, " src='file://%s' ", get_image_filename_from_id (view, nid)); + g_string_append_printf(buffer, " src='file://%s' ", get_image_filename_from_id(view, nid)); } - return g_string_free (buffer, FALSE); + return g_string_free(buffer, FALSE); } static void -gtk_webview_finalize (GObject *view) +gtk_webview_finalize(GObject *view) { gpointer temp; - - while ((temp = g_queue_pop_head (GTK_WEBVIEW(view)->priv->js_queue))) - g_free (temp); - g_queue_free (GTK_WEBVIEW(view)->priv->js_queue); - - clear_images (GTK_WEBVIEW (view)); - g_free (GTK_WEBVIEW(view)->priv); - G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT(view)); + + while ((temp = g_queue_pop_head(GTK_WEBVIEW(view)->priv->js_queue))) + g_free(temp); + g_queue_free(GTK_WEBVIEW(view)->priv->js_queue); + + clear_images(GTK_WEBVIEW(view)); + g_free(GTK_WEBVIEW(view)->priv); + G_OBJECT_CLASS(parent_class)->finalize(G_OBJECT(view)); } static void -gtk_webview_class_init (GtkWebViewClass *klass, gpointer userdata) +gtk_webview_class_init(GtkWebViewClass *klass, gpointer userdata) { - parent_class = g_type_class_ref (webkit_web_view_get_type ()); - G_OBJECT_CLASS (klass)->finalize = gtk_webview_finalize; + parent_class = g_type_class_ref(webkit_web_view_get_type()); + G_OBJECT_CLASS(klass)->finalize = gtk_webview_finalize; } static gboolean -webview_link_clicked (WebKitWebView *view, +webview_link_clicked(WebKitWebView *view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, @@ -186,13 +189,13 @@ webview_link_clicked (WebKitWebView *view, const gchar *uri; WebKitWebNavigationReason reason; - uri = webkit_network_request_get_uri (request); + uri = webkit_network_request_get_uri(request); reason = webkit_web_navigation_action_get_reason(navigation_action); if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) { /* the gtk imhtml way was to create an idle cb, not sure * why, so right now just using purple_notify_uri directly */ - purple_notify_uri (NULL, uri); + purple_notify_uri(NULL, uri); } webkit_web_policy_decision_use(policy_decision); @@ -201,129 +204,131 @@ webview_link_clicked (WebKitWebView *view, } static gboolean -process_js_script_queue (GtkWebView *view) +process_js_script_queue(GtkWebView *view) { char *script; - if (view->priv->is_loading) return FALSE; /* we will be called when loaded */ - if (!view->priv->js_queue || g_queue_is_empty (view->priv->js_queue)) + if (view->priv->is_loading) + return FALSE; /* we will be called when loaded */ + if (!view->priv->js_queue || g_queue_is_empty(view->priv->js_queue)) return FALSE; /* nothing to do! */ - script = g_queue_pop_head (view->priv->js_queue); - webkit_web_view_execute_script (WEBKIT_WEB_VIEW(view), script); - g_free (script); + script = g_queue_pop_head(view->priv->js_queue); + webkit_web_view_execute_script(WEBKIT_WEB_VIEW(view), script); + g_free(script); return TRUE; /* there may be more for now */ } static void -webview_load_started (WebKitWebView *view, +webview_load_started(WebKitWebView *view, WebKitWebFrame *frame, gpointer userdata) { /* is there a better way to test for is_loading? */ - GTK_WEBVIEW(view)->priv->is_loading = true; + GTK_WEBVIEW(view)->priv->is_loading = TRUE; } static void -webview_load_finished (WebKitWebView *view, +webview_load_finished(WebKitWebView *view, WebKitWebFrame *frame, gpointer userdata) { - GTK_WEBVIEW(view)->priv->is_loading = false; - g_idle_add ((GSourceFunc) process_js_script_queue, view); + GTK_WEBVIEW(view)->priv->is_loading = FALSE; + g_idle_add((GSourceFunc)process_js_script_queue, view); } void -gtk_webview_safe_execute_script (GtkWebView *view, const char* script) +gtk_webview_safe_execute_script(GtkWebView *view, const char *script) { - g_queue_push_tail (view->priv->js_queue, g_strdup (script)); - g_idle_add ((GSourceFunc)process_js_script_queue, view); + g_queue_push_tail(view->priv->js_queue, g_strdup(script)); + g_idle_add((GSourceFunc)process_js_script_queue, view); } static void -gtk_webview_init (GtkWebView *view, gpointer userdata) +gtk_webview_init(GtkWebView *view, gpointer userdata) { - view->priv = g_new0 (struct GtkWebViewPriv, 1); - g_signal_connect (view, "navigation-policy-decision-requested", - G_CALLBACK (webview_link_clicked), + view->priv = g_new0(struct GtkWebViewPriv, 1); + g_signal_connect(view, "navigation-policy-decision-requested", + G_CALLBACK(webview_link_clicked), view); - g_signal_connect (view, "load-started", - G_CALLBACK (webview_load_started), + g_signal_connect(view, "load-started", + G_CALLBACK(webview_load_started), view); - g_signal_connect (view, "load-finished", - G_CALLBACK (webview_load_finished), + g_signal_connect(view, "load-finished", + G_CALLBACK(webview_load_finished), view); view->priv->empty = TRUE; - view->priv->js_queue = g_queue_new (); + view->priv->js_queue = g_queue_new(); } void -gtk_webview_load_html_string_with_imgstore (GtkWebView* view, const char* html) +gtk_webview_load_html_string_with_imgstore(GtkWebView *view, const char *html) { - char* html_imged; - - clear_images (view); - html_imged = replace_img_id_with_src (view, html); - printf ("%s\n", html_imged); - webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (view), html_imged, "file:///"); - g_free (html_imged); + char *html_imged; + + clear_images(view); + html_imged = replace_img_id_with_src(view, html); + webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(view), html_imged, "file:///"); + g_free(html_imged); } -char *gtk_webview_quote_js_string(const char *text) +char * +gtk_webview_quote_js_string(const char *text) { - GString *str = g_string_new("\""); - const char *cur = text; - - while (cur && *cur) { - switch (*cur) { - case '\\': - g_string_append(str, "\\\\"); - break; - case '\"': - g_string_append(str, "\\\""); - break; - case '\r': - g_string_append(str, "
"); - break; - case '\n': - break; - default: - g_string_append_c(str, *cur); + GString *str = g_string_new("\""); + const char *cur = text; + + while (cur && *cur) { + switch (*cur) { + case '\\': + g_string_append(str, "\\\\"); + break; + case '\"': + g_string_append(str, "\\\""); + break; + case '\r': + g_string_append(str, "
"); + break; + case '\n': + break; + default: + g_string_append_c(str, *cur); } - cur ++; + cur++; } - g_string_append_c (str, '"'); - return g_string_free (str, FALSE); + g_string_append_c(str, '"'); + return g_string_free(str, FALSE); } -void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) +void +gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) { webview->priv->vadj = vadj; } -/* this is a "hack", my plan is to eventually handle this +/* this is a "hack", my plan is to eventually handle this * correctly using a signals and a plugin: the plugin will have * the information as to what javascript function to call. It seems * wrong to hardcode that here. */ void -gtk_webview_append_html (GtkWebView* view, const char* html) +gtk_webview_append_html(GtkWebView *view, const char *html) { - char* escaped = gtk_webview_quote_js_string (html); - char* script = g_strdup_printf ("document.write(%s)", escaped); - printf ("script: %s\n", script); - webkit_web_view_execute_script (WEBKIT_WEB_VIEW (view), script); + char *escaped = gtk_webview_quote_js_string(html); + char *script = g_strdup_printf("document.write(%s)", escaped); + webkit_web_view_execute_script(WEBKIT_WEB_VIEW(view), script); view->priv->empty = FALSE; gtk_webview_scroll_to_end(view, TRUE); - g_free (script); - g_free (escaped); + g_free(script); + g_free(escaped); } -gboolean gtk_webview_is_empty (GtkWebView *view) +gboolean +gtk_webview_is_empty(GtkWebView *view) { return view->priv->empty; } @@ -336,7 +341,8 @@ gboolean gtk_webview_is_empty (GtkWebView *view) * * @return TRUE if the window needs to be scrolled further, FALSE if we're at the bottom. */ -static gboolean smooth_scroll_cb(gpointer data) +static gboolean +smooth_scroll_cb(gpointer data) { struct GtkWebViewPriv *priv = data; GtkAdjustment *adj = priv->vadj; @@ -360,18 +366,20 @@ static gboolean smooth_scroll_cb(gpointer data) return TRUE; } -static gboolean scroll_idle_cb(gpointer data) +static gboolean +scroll_idle_cb(gpointer data) { struct GtkWebViewPriv *priv = data; GtkAdjustment *adj = priv->vadj; - if(adj) { + if (adj) { gtk_adjustment_set_value(adj, adj->upper - adj->page_size); } priv->scroll_src = 0; return FALSE; } -void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) +void +gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) { struct GtkWebViewPriv *priv = webview->priv; if (priv->scroll_time) @@ -387,24 +395,26 @@ void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) } } -GType gtk_webview_get_type (void) +GType +gtk_webview_get_type(void) { static GType mview_type = 0; - if (G_UNLIKELY (mview_type == 0)) { + if (G_UNLIKELY(mview_type == 0)) { static const GTypeInfo mview_info = { - sizeof (GtkWebViewClass), + sizeof(GtkWebViewClass), NULL, NULL, (GClassInitFunc) gtk_webview_class_init, NULL, NULL, - sizeof (GtkWebView), + sizeof(GtkWebView), 0, (GInstanceInitFunc) gtk_webview_init, NULL }; - mview_type = g_type_register_static(webkit_web_view_get_type (), + mview_type = g_type_register_static(webkit_web_view_get_type(), "GtkWebView", &mview_info, 0); } return mview_type; } + diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index ff5a59dfdc..5abd79fc9f 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -3,12 +3,14 @@ * @ingroup pidgin */ -/* Pidgin is the legal property of its developers, whose names are too numerous +/* pidgin + * + * Pidgin is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * source distribution. * * This program is free software; you can redistribute it and/or modify - * under the terms of the GNU General Public License as published by + * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * @@ -20,6 +22,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * */ #ifndef _PIDGIN_WEBVIEW_H_ @@ -45,7 +48,7 @@ struct _GtkWebView WebKitWebView webkit_web_view; /*< private >*/ - struct GtkWebViewPriv* priv; + struct GtkWebViewPriv *priv; }; typedef struct _GtkWebView GtkWebView; @@ -63,14 +66,14 @@ typedef struct _GtkWebViewClass GtkWebViewClass; * * @return the GType for GtkWebView widget */ -GType gtk_webview_get_type (void); +GType gtk_webview_get_type(void); /** * Create a new GtkWebView object * * @return a GtkWidget corresponding to the GtkWebView object */ -GtkWidget* gtk_webview_new (void); +GtkWidget *gtk_webview_new(void); /** * Set the vertical adjustment for the GtkWebView. @@ -87,7 +90,7 @@ void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj); * @param webview The GtkWebView object * @param markup The html markup to append */ -void gtk_webview_append_html (GtkWebView *webview, const char* markup); +void gtk_webview_append_html(GtkWebView *webview, const char *markup); /** * Rather than use webkit_webview_load_string, this routine @@ -97,47 +100,48 @@ void gtk_webview_append_html (GtkWebView *webview, const char* markup); * @param webview The GtkWebView object * @param html The HTML content to load */ -void gtk_webview_load_html_string_with_imgstore (GtkWebView* webview, const char* html); +void gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html); /** - * (To be changed, right now it just tests whether an append has been + * FIXME: (To be changed, right now it just tests whether an append has been * called since the last clear or since the Widget was created. So it * does not test for load_string's called in between. * * @param webview The GtkWebView object - * + * * @return gboolean indicating whether the webview is empty. */ -gboolean gtk_webview_is_empty (GtkWebView *webview); +gboolean gtk_webview_is_empty(GtkWebView *webview); /** * Execute the JavaScript only after the webkit_webview_load_string * loads completely. We also guarantee that the scripts are executed - * in the order they are called here.This is useful to avoid race - * conditions when calls JS functions immediately after opening the + * in the order they are called here. This is useful to avoid race + * conditions when calling JS functions immediately after opening the * page. * * @param webview the GtkWebView object * @param script the script to execute */ -void gtk_webview_safe_execute_script (GtkWebView *webview, const char* script); +void gtk_webview_safe_execute_script(GtkWebView *webview, const char *script); /** - * A convenience routine to quote a string for use as a JavaScript + * A convenience routine to quote a string for use as a JavaScript * string. For instance, "hello 'world'" becomes "'hello \\'world\\''" * * @param str The string to escape and quote * * @return the quoted string. */ -char* gtk_webview_quote_js_string (const char* str); +char *gtk_webview_quote_js_string(const char *str); /** * Scrolls the Webview to the end of its contents. * * @param webview The GtkWebView. - * @param smoth A boolean indicating if smooth scrolling should be used. + * @param smooth A boolean indicating if smooth scrolling should be used. */ void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth); #endif /* _PIDGIN_WEBVIEW_H_ */ + diff --git a/pidgin/plugins/adiumthemes/message-style.c b/pidgin/plugins/adiumthemes/message-style.c index 3365d1411f..81919b97bd 100644 --- a/pidgin/plugins/adiumthemes/message-style.c +++ b/pidgin/plugins/adiumthemes/message-style.c @@ -1,21 +1,23 @@ -/* - * Adium Message Styles - * Copyright (C) 2009 Arnold Noronha +/* pidgin * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * */ #include "message-style.h" @@ -28,42 +30,42 @@ #include static void -glist_free_all_string (GList *list) +glist_free_all_string(GList *list) { GList *first = list; - for (; list; list = g_list_next (list)) - g_free (list->data); - g_list_free (first); + for (; list; list = g_list_next(list)) + g_free(list->data); + g_list_free(first); } -static -PidginMessageStyle* pidgin_message_style_new (const char* styledir) +static PidginMessageStyle * +pidgin_message_style_new(const char *styledir) { - PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1); + PidginMessageStyle *ret = g_new0(PidginMessageStyle, 1); ret->ref_counter = 1; - ret->style_dir = g_strdup (styledir); - + ret->style_dir = g_strdup(styledir); + return ret; } /** - * deallocate any memory used for info.plist options + * deallocate any memory used for info.plist options */ static void -pidgin_message_style_unset_info_plist (PidginMessageStyle *style) +pidgin_message_style_unset_info_plist(PidginMessageStyle *style) { style->message_view_version = 0; - g_free (style->cf_bundle_name); + g_free(style->cf_bundle_name); style->cf_bundle_name = NULL; - g_free (style->cf_bundle_identifier); + g_free(style->cf_bundle_identifier); style->cf_bundle_identifier = NULL; - g_free (style->cf_bundle_get_info_string); + g_free(style->cf_bundle_get_info_string); style->cf_bundle_get_info_string = NULL; - g_free (style->default_font_family); + g_free(style->default_font_family); style->default_font_family = NULL; style->default_font_size = 0; @@ -72,112 +74,127 @@ pidgin_message_style_unset_info_plist (PidginMessageStyle *style) style->default_background_is_transparent = FALSE; style->disable_custom_background = FALSE; - g_free (style->default_background_color); + g_free(style->default_background_color); style->default_background_color = NULL; - + style->allow_text_colors = TRUE; - - g_free (style->image_mask); + + g_free(style->image_mask); style->image_mask = NULL; - g_free (style->default_variant); + g_free(style->default_variant); style->default_variant = NULL; } -void pidgin_message_style_unref (PidginMessageStyle *style) +void +pidgin_message_style_unref(PidginMessageStyle *style) { - if (!style) return; + if (!style) + return; g_assert (style->ref_counter > 0); style->ref_counter--; - if (style->ref_counter) return; + if (style->ref_counter) + return; + + g_free(style->style_dir); + g_free(style->template_path); - g_free (style->style_dir); - g_free (style->template_path); - - g_free (style->template_html); - g_free (style->incoming_content_html); - g_free (style->outgoing_content_html); - g_free (style->outgoing_next_content_html); - g_free (style->status_html); - g_free (style->basestyle_css); + g_free(style->template_html); + g_free(style->incoming_content_html); + g_free(style->outgoing_content_html); + g_free(style->outgoing_next_content_html); + g_free(style->status_html); + g_free(style->basestyle_css); - g_free (style); + g_free(style); - pidgin_message_style_unset_info_plist (style); + pidgin_message_style_unset_info_plist(style); } void -pidgin_message_style_save_state (const PidginMessageStyle *style) +pidgin_message_style_save_state(const PidginMessageStyle *style) { - char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); - char *variant = g_strdup_printf ("%s/variant", prefname); - - purple_debug_info ("webkit", "saving state with variant %s\n", style->variant); - purple_prefs_add_none (prefname); - purple_prefs_add_string (variant, ""); - purple_prefs_set_string (variant, style->variant); - - g_free (prefname); - g_free (variant); + char *prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); + char *variant = g_strdup_printf("%s/variant", prefname); + + purple_debug_info("webkit", "saving state with variant %s\n", style->variant); + purple_prefs_add_none(prefname); + purple_prefs_add_string(variant, ""); + purple_prefs_set_string(variant, style->variant); + + g_free(prefname); + g_free(variant); } static void -pidgin_message_style_load_state (PidginMessageStyle *style) +pidgin_message_style_load_state(PidginMessageStyle *style) { - char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); - char *variant = g_strdup_printf ("%s/variant", prefname); + char *prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); + char *variant = g_strdup_printf("%s/variant", prefname); - const char* value = purple_prefs_get_string (variant); - gboolean changed = !style->variant || !g_str_equal (style->variant, value); + const char* value = purple_prefs_get_string(variant); + gboolean changed = !style->variant || !g_str_equal(style->variant, value); - g_free (style->variant); - style->variant = g_strdup (value); + g_free(style->variant); + style->variant = g_strdup(value); - if (changed) pidgin_message_style_read_info_plist (style, style->variant); + if (changed) + pidgin_message_style_read_info_plist(style, style->variant); - g_free (prefname); + g_free(prefname); g_free(variant); } static gboolean -parse_info_plist_key_value (xmlnode* key, gpointer destination, const char* expected) +parse_info_plist_key_value(xmlnode* key, gpointer destination, const char* expected) { xmlnode *val = key->next; - for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next); - if (!val) return FALSE; - - if (expected == NULL || g_str_equal (expected, "string")) { - char** dest = (char**) destination; - if (!g_str_equal (val->name, "string")) return FALSE; - if (*dest) g_free (*dest); - *dest = xmlnode_get_data_unescaped (val); - } else if (g_str_equal (expected, "integer")) { - int* dest = (int*) destination; - char* value = xmlnode_get_data_unescaped (val); - - if (!g_str_equal (val->name, "integer")) return FALSE; - *dest = atoi (value); - g_free (value); - } else if (g_str_equal (expected, "boolean")) { - gboolean *dest = (gboolean*) destination; - if (g_str_equal (val->name, "true")) *dest = TRUE; - else if (g_str_equal (val->name, "false")) *dest = FALSE; - else return FALSE; + for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next) + ; + if (!val) + return FALSE; + + if (expected == NULL || g_str_equal(expected, "string")) { + char **dest = (char **)destination; + if (!g_str_equal(val->name, "string")) + return FALSE; + if (*dest) + g_free(*dest); + *dest = xmlnode_get_data_unescaped(val); + } else if (g_str_equal(expected, "integer")) { + int *dest = (int *)destination; + char *value = xmlnode_get_data_unescaped(val); + + if (!g_str_equal(val->name, "integer")) + return FALSE; + *dest = atoi(value); + g_free(value); + } else if (g_str_equal(expected, "boolean")) { + gboolean *dest = (gboolean *)destination; + if (g_str_equal(val->name, "true")) + *dest = TRUE; + else if (g_str_equal(val->name, "false")) + *dest = FALSE; + else + return FALSE; } else return FALSE; - + return TRUE; } -static -gboolean str_for_key (const char *key, const char *found, const char *variant){ - if (g_str_equal (key, found)) return TRUE; - if (!variant) return FALSE; - return (g_str_has_prefix (found, key) - && g_str_has_suffix (found, variant) - && strlen (found) == strlen (key) + strlen (variant) + 1); +static gboolean +str_for_key(const char *key, const char *found, const char *variant) +{ + if (g_str_equal(key, found)) + return TRUE; + if (!variant) + return FALSE; + return (g_str_has_prefix(found, key) + && g_str_has_suffix(found, variant) + && strlen(found) == strlen(key) + strlen(variant) + 1); } /** @@ -185,55 +202,55 @@ gboolean str_for_key (const char *key, const char *found, const char *variant){ * the keys that take precedence depend on the value of the current variant. */ void -pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant) +pidgin_message_style_read_info_plist(PidginMessageStyle *style, const char *variant) { /* note that if a variant is used the option:VARIANTNAME takes precedence */ - char *contents = g_build_filename (style->style_dir, "Contents", NULL); - xmlnode *plist = xmlnode_from_file (contents, "Info.plist", "Info.plist", "webkit"), *iter; - xmlnode *dict = xmlnode_get_child (plist, "dict"); + char *contents = g_build_filename(style->style_dir, "Contents", NULL); + xmlnode *plist = xmlnode_from_file(contents, "Info.plist", "Info.plist", "webkit"), *iter; + xmlnode *dict = xmlnode_get_child(plist, "dict"); g_assert (dict); - for (iter = xmlnode_get_child (dict, "key"); iter; iter = xmlnode_get_next_twin (iter)) { - char* key = xmlnode_get_data_unescaped (iter); + for (iter = xmlnode_get_child(dict, "key"); iter; iter = xmlnode_get_next_twin(iter)) { + char* key = xmlnode_get_data_unescaped(iter); gboolean pr = TRUE; - if (g_str_equal ("MessageViewVersion", key)) - pr = parse_info_plist_key_value (iter, &style->message_view_version, "integer"); - else if (g_str_equal ("CFBundleName", key)) - pr = parse_info_plist_key_value (iter, &style->cf_bundle_name, "string"); - else if (g_str_equal ("CFBundleIdentifier", key)) - pr = parse_info_plist_key_value (iter, &style->cf_bundle_identifier, "string"); - else if (g_str_equal ("CFBundleGetInfoString", key)) - pr = parse_info_plist_key_value (iter, &style->cf_bundle_get_info_string, "string"); - else if (str_for_key ("DefaultFontFamily", key, variant)) - pr = parse_info_plist_key_value (iter, &style->default_font_family, "string"); - else if (str_for_key ("DefaultFontSize", key, variant)) - pr = parse_info_plist_key_value (iter, &style->default_font_size, "integer"); - else if (str_for_key ("ShowsUserIcons", key, variant)) - pr = parse_info_plist_key_value (iter, &style->shows_user_icons, "boolean"); - else if (str_for_key ("DisableCombineConsecutive", key, variant)) - pr = parse_info_plist_key_value (iter, &style->disable_combine_consecutive, "boolean"); - else if (str_for_key ("DefaultBackgroundIsTransparent", key, variant)) - pr = parse_info_plist_key_value (iter, &style->default_background_is_transparent, "boolean"); - else if (str_for_key ("DisableCustomBackground", key, variant)) - pr = parse_info_plist_key_value (iter, &style->disable_custom_background, "boolean"); - else if (str_for_key ("DefaultBackgroundColor", key, variant)) - pr = parse_info_plist_key_value (iter, &style->default_background_color, "string"); - else if (str_for_key ("AllowTextColors", key, variant)) - pr = parse_info_plist_key_value (iter, &style->allow_text_colors, "integer"); - else if (str_for_key ("ImageMask", key, variant)) - pr = parse_info_plist_key_value (iter, &style->image_mask, "string"); + if (g_str_equal("MessageViewVersion", key)) + pr = parse_info_plist_key_value(iter, &style->message_view_version, "integer"); + else if (g_str_equal("CFBundleName", key)) + pr = parse_info_plist_key_value(iter, &style->cf_bundle_name, "string"); + else if (g_str_equal("CFBundleIdentifier", key)) + pr = parse_info_plist_key_value(iter, &style->cf_bundle_identifier, "string"); + else if (g_str_equal("CFBundleGetInfoString", key)) + pr = parse_info_plist_key_value(iter, &style->cf_bundle_get_info_string, "string"); + else if (str_for_key("DefaultFontFamily", key, variant)) + pr = parse_info_plist_key_value(iter, &style->default_font_family, "string"); + else if (str_for_key("DefaultFontSize", key, variant)) + pr = parse_info_plist_key_value(iter, &style->default_font_size, "integer"); + else if (str_for_key("ShowsUserIcons", key, variant)) + pr = parse_info_plist_key_value(iter, &style->shows_user_icons, "boolean"); + else if (str_for_key("DisableCombineConsecutive", key, variant)) + pr = parse_info_plist_key_value(iter, &style->disable_combine_consecutive, "boolean"); + else if (str_for_key("DefaultBackgroundIsTransparent", key, variant)) + pr = parse_info_plist_key_value(iter, &style->default_background_is_transparent, "boolean"); + else if (str_for_key("DisableCustomBackground", key, variant)) + pr = parse_info_plist_key_value(iter, &style->disable_custom_background, "boolean"); + else if (str_for_key("DefaultBackgroundColor", key, variant)) + pr = parse_info_plist_key_value(iter, &style->default_background_color, "string"); + else if (str_for_key("AllowTextColors", key, variant)) + pr = parse_info_plist_key_value(iter, &style->allow_text_colors, "integer"); + else if (str_for_key("ImageMask", key, variant)) + pr = parse_info_plist_key_value(iter, &style->image_mask, "string"); if (!pr) - purple_debug_warning ("webkit", "Failed to parse key %s\n", key); - g_free (key); + purple_debug_warning("webkit", "Failed to parse key %s\n", key); + g_free(key); } - xmlnode_free (plist); + xmlnode_free(plist); } -PidginMessageStyle* -pidgin_message_style_load (const char* styledir) +PidginMessageStyle * +pidgin_message_style_load(const char *styledir) { /* * the loading process described: @@ -247,14 +264,11 @@ pidgin_message_style_load (const char* styledir) * and if that does not exist, we choose the first one in the * directory. */ - - /* is this style already loaded? */ - char *file; /* temporary variable */ + char *file; PidginMessageStyle *style = NULL; - /* else we need to load it */ - style = pidgin_message_style_new (styledir); - + style = pidgin_message_style_new(styledir); + /* load all other files */ /* The template path can either come from the theme, or can @@ -262,187 +276,187 @@ pidgin_message_style_load (const char* styledir) style->template_path = g_build_filename(styledir, "Contents", "Resources", "Template.html", NULL); if (!g_file_test(style->template_path, G_FILE_TEST_EXISTS)) { - g_free (style->template_path); + g_free(style->template_path); style->template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); } if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) { - purple_debug_error ("webkit", "Could not locate a Template.html (%s)\n", style->template_path); - pidgin_message_style_unref (style); + purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", style->template_path); + pidgin_message_style_unref(style); return NULL; } file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL); if (!g_file_get_contents(file, &style->status_html, NULL, NULL)) { - purple_debug_info ("webkit", "%s could not find Resources/Status.html", styledir); - pidgin_message_style_unref (style); - g_free (file); + purple_debug_info("webkit", "%s could not find Resources/Status.html", styledir); + pidgin_message_style_unref(style); + g_free(file); return NULL; } - g_free (file); + g_free(file); file = g_build_filename(styledir, "Contents", "Resources", "main.css", NULL); if (!g_file_get_contents(file, &style->basestyle_css, NULL, NULL)) - style->basestyle_css = g_strdup (""); - g_free (file); - + style->basestyle_css = g_strdup(""); + g_free(file); + file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL); if (!g_file_get_contents(file, &style->header_html, NULL, NULL)) - style->header_html = g_strdup (""); - g_free (file); + style->header_html = g_strdup(""); + g_free(file); file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL); if (!g_file_get_contents(file, &style->footer_html, NULL, NULL)) - style->footer_html = g_strdup (""); - g_free (file); + style->footer_html = g_strdup(""); + g_free(file); file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); if (!g_file_get_contents(file, &style->incoming_content_html, NULL, NULL)) { - purple_debug_info ("webkit", "%s did not have a Incoming/Content.html\n", styledir); - pidgin_message_style_unref (style); - g_free (file); + purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", styledir); + pidgin_message_style_unref(style); + g_free(file); return NULL; } - g_free (file); + g_free(file); /* according to the spec, the following are optional files */ file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); if (!g_file_get_contents(file, &style->incoming_next_content_html, NULL, NULL)) { - style->incoming_next_content_html = g_strdup (style->incoming_content_html); + style->incoming_next_content_html = g_strdup(style->incoming_content_html); } - g_free (file); + g_free(file); file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "Content.html", NULL); if (!g_file_get_contents(file, &style->outgoing_content_html, NULL, NULL)) { style->outgoing_content_html = g_strdup(style->incoming_content_html); } - g_free (file); + g_free(file); file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); if (!g_file_get_contents(file, &style->outgoing_next_content_html, NULL, NULL)) { - style->outgoing_next_content_html = g_strdup (style->outgoing_content_html); + style->outgoing_next_content_html = g_strdup(style->outgoing_content_html); } - pidgin_message_style_read_info_plist (style, NULL); - pidgin_message_style_load_state (style); + pidgin_message_style_read_info_plist(style, NULL); + pidgin_message_style_load_state(style); /* non variant dependent Info.plist checks */ if (style->message_view_version < 3) { - purple_debug_info ("webkit", "%s is a legacy style (version %d) and will not be loaded\n", style->cf_bundle_name, style->message_view_version); - pidgin_message_style_unref (style); + purple_debug_info("webkit", "%s is a legacy style (version %d) and will not be loaded\n", style->cf_bundle_name, style->message_view_version); + pidgin_message_style_unref(style); return NULL; } if (!style->variant) { - GList *variants = pidgin_message_style_get_variants (style); + GList *variants = pidgin_message_style_get_variants(style); if (variants) - pidgin_message_style_set_variant (style, variants->data); + pidgin_message_style_set_variant(style, variants->data); - glist_free_all_string (variants); + glist_free_all_string(variants); } return style; } -PidginMessageStyle* -pidgin_message_style_copy (const PidginMessageStyle *style) +PidginMessageStyle * +pidgin_message_style_copy(const PidginMessageStyle *style) { - /* it's at times like this that I miss C++ */ - PidginMessageStyle *ret = pidgin_message_style_new (style->style_dir); + PidginMessageStyle *ret = pidgin_message_style_new(style->style_dir); - ret->variant = g_strdup (style->variant); + ret->variant = g_strdup(style->variant); ret->message_view_version = style->message_view_version; - ret->cf_bundle_name = g_strdup (style->cf_bundle_name); - ret->cf_bundle_identifier = g_strdup (style->cf_bundle_identifier); - ret->cf_bundle_get_info_string = g_strdup (style->cf_bundle_get_info_string); - ret->default_font_family = g_strdup (style->default_font_family); + ret->cf_bundle_name = g_strdup(style->cf_bundle_name); + ret->cf_bundle_identifier = g_strdup(style->cf_bundle_identifier); + ret->cf_bundle_get_info_string = g_strdup(style->cf_bundle_get_info_string); + ret->default_font_family = g_strdup(style->default_font_family); ret->default_font_size = style->default_font_size; ret->shows_user_icons = style->shows_user_icons; ret->disable_combine_consecutive = style->disable_combine_consecutive; ret->default_background_is_transparent = style->default_background_is_transparent; ret->disable_custom_background = style->disable_custom_background; - ret->default_background_color = g_strdup (style->default_background_color); + ret->default_background_color = g_strdup(style->default_background_color); ret->allow_text_colors = style->allow_text_colors; - ret->image_mask = g_strdup (style->image_mask); - ret->default_variant = g_strdup (style->default_variant); - - ret->template_path = g_strdup (style->template_path); - ret->template_html = g_strdup (style->template_html); - ret->header_html = g_strdup (style->header_html); - ret->footer_html = g_strdup (style->footer_html); - ret->incoming_content_html = g_strdup (style->incoming_content_html); - ret->outgoing_content_html = g_strdup (style->outgoing_content_html); - ret->incoming_next_content_html = g_strdup (style->incoming_next_content_html); - ret->outgoing_next_content_html = g_strdup (style->outgoing_next_content_html); - ret->status_html = g_strdup (style->status_html); - ret->basestyle_css = g_strdup (style->basestyle_css); + ret->image_mask = g_strdup(style->image_mask); + ret->default_variant = g_strdup(style->default_variant); + + ret->template_path = g_strdup(style->template_path); + ret->template_html = g_strdup(style->template_html); + ret->header_html = g_strdup(style->header_html); + ret->footer_html = g_strdup(style->footer_html); + ret->incoming_content_html = g_strdup(style->incoming_content_html); + ret->outgoing_content_html = g_strdup(style->outgoing_content_html); + ret->incoming_next_content_html = g_strdup(style->incoming_next_content_html); + ret->outgoing_next_content_html = g_strdup(style->outgoing_next_content_html); + ret->status_html = g_strdup(style->status_html); + ret->basestyle_css = g_strdup(style->basestyle_css); return ret; } void -pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant) +pidgin_message_style_set_variant(PidginMessageStyle *style, const char *variant) { /* I'm not going to test whether this variant is valid! */ - g_free (style->variant); - style->variant = g_strdup (variant); + g_free(style->variant); + style->variant = g_strdup(variant); + + pidgin_message_style_read_info_plist(style, variant); - pidgin_message_style_read_info_plist (style, variant); - /* todo, the style has "changed". Ideally, I would like to use signals at this point. */ } -char* pidgin_message_style_get_variant (PidginMessageStyle *style) +char * +pidgin_message_style_get_variant(PidginMessageStyle *style) { - return g_strdup (style->variant); + return g_strdup(style->variant); } /** * Get a list of variants supported by the style. */ GList* -pidgin_message_style_get_variants (PidginMessageStyle *style) +pidgin_message_style_get_variants(PidginMessageStyle *style) { GList *ret = NULL; - GDir *variants; + GDir *variants; const char *css_file; char *css; char *variant_dir; - g_assert (style->style_dir); + g_assert(style->style_dir); variant_dir = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", NULL); variants = g_dir_open(variant_dir, 0, NULL); - if (!variants) return NULL; + if (!variants) + return NULL; while ((css_file = g_dir_read_name(variants)) != NULL) { - if (!g_str_has_suffix (css_file, ".css")) + if (!g_str_has_suffix(css_file, ".css")) continue; - css = g_strndup (css_file, strlen (css_file) - 4); + css = g_strndup(css_file, strlen(css_file) - 4); ret = g_list_append(ret, css); } g_dir_close(variants); g_free(variant_dir); - ret = g_list_sort (ret, (GCompareFunc)g_strcmp0); - return ret; + ret = g_list_sort(ret, (GCompareFunc)g_strcmp0); + return ret; } - -char* pidgin_message_style_get_css (PidginMessageStyle *style) +char * +pidgin_message_style_get_css(PidginMessageStyle *style) { if (!style->variant) { - return g_build_filename (style->style_dir, "Contents", "Resources", "main.css", NULL); + return g_build_filename(style->style_dir, "Contents", "Resources", "main.css", NULL); } else { - char *file = g_strdup_printf ("%s.css", style->variant); - char *ret = g_build_filename (style->style_dir, "Contents", "Resources", "Variants", file, NULL); - g_free (file); + char *file = g_strdup_printf("%s.css", style->variant); + char *ret = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", file, NULL); + g_free(file); return ret; } } - diff --git a/pidgin/plugins/adiumthemes/message-style.h b/pidgin/plugins/adiumthemes/message-style.h index c8f9cdbe9d..92694c6e32 100644 --- a/pidgin/plugins/adiumthemes/message-style.h +++ b/pidgin/plugins/adiumthemes/message-style.h @@ -1,3 +1,24 @@ +/* pidgin + * + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * + */ #include @@ -47,13 +68,14 @@ typedef struct _PidginMessageStyle { char *basestyle_css; } PidginMessageStyle; -PidginMessageStyle* pidgin_message_style_load (const char* styledir); -PidginMessageStyle* pidgin_message_style_copy (const PidginMessageStyle *style); -void pidgin_message_style_save_state (const PidginMessageStyle *style); -void pidgin_message_style_unref (PidginMessageStyle *style); -void pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant); -char* pidgin_message_style_get_variant (PidginMessageStyle *style); -GList* pidgin_message_style_get_variants (PidginMessageStyle *style); -void pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant); +PidginMessageStyle *pidgin_message_style_load(const char *styledir); +PidginMessageStyle *pidgin_message_style_copy(const PidginMessageStyle *style); +void pidgin_message_style_save_state(const PidginMessageStyle *style); +void pidgin_message_style_unref(PidginMessageStyle *style); +void pidgin_message_style_read_info_plist(PidginMessageStyle *style, const char *variant); +char *pidgin_message_style_get_variant(PidginMessageStyle *style); +GList *pidgin_message_style_get_variants(PidginMessageStyle *style); +void pidgin_message_style_set_variant(PidginMessageStyle *style, const char *variant); + +char *pidgin_message_style_get_css(PidginMessageStyle *style); -char* pidgin_message_style_get_css (PidginMessageStyle *style); diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 442fa26c35..22beedeae2 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -1,33 +1,34 @@ -/* - * Adium Message Styles - * Copyright (C) 2009 Arnold Noronha - * Copyright (C) 2007 +/* pidgin + * + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * */ #define PLUGIN_ID "gtk-webview-adium-ims" #define PLUGIN_NAME "webview-adium-ims" /* - * A lot of this was originally written by Sean Egan, but I think I've - * rewrote enough to replace the author for now. + * A lot of this was originally written by Sean Egan, but I think I've + * rewrote enough to replace the author for now. */ #define PLUGIN_AUTHOR "Arnold Noronha " -#define PURPLE_PLUGINS "Hell yeah" +#define PURPLE_PLUGINS "Hell yeah" /* System headers */ #include @@ -59,38 +60,36 @@ static char *cur_style_dir = NULL; static void *handle = NULL; -static inline char* get_absolute_path (const char *path) +static inline char * +get_absolute_path(const char *path) { - if (g_path_is_absolute (path)) return g_strdup (path); + if (g_path_is_absolute(path)) + return g_strdup(path); else { - char* cwd = g_get_current_dir (), *ret; - ret = g_build_filename (cwd, path, NULL); - g_free (cwd); + char *cwd, *ret; + cwd = g_get_current_dir(); + ret = g_build_filename(cwd, path, NULL); + g_free(cwd); return ret; } } -static void -glist_free_all_string (GList *list) -{ - GList *first = list; - for (; list; list = g_list_next (list)) - g_free (list->data); - g_list_free (first); -} - -static void webkit_on_webview_destroy (GtkObject* obj, gpointer data); +static void webkit_on_webview_destroy(GtkObject* obj, gpointer data); -static void* webkit_plugin_get_handle () +static void * +webkit_plugin_get_handle(void) { - if (handle) return handle; - else return (handle = g_malloc (1)); + if (handle) + return handle; + else + return (handle = g_malloc(1)); } -static void webkit_plugin_free_handle () +static void +webkit_plugin_free_handle(void) { - purple_signals_disconnect_by_handle (handle); - g_free (handle); + purple_signals_disconnect_by_handle(handle); + g_free(handle); } static char * @@ -242,12 +241,13 @@ replace_header_tokens(char *text, gsize len, PurpleConversation *conv) } static char * -replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *header, char *footer) { +replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *header, char *footer) +{ GString *str = g_string_new_len(NULL, len); char **ms = g_strsplit(text, "%@", 6); char *base = NULL; - char *csspath = pidgin_message_style_get_css (style); + char *csspath = pidgin_message_style_get_css(style); if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { g_strfreev(ms); g_string_free(str, TRUE); @@ -256,9 +256,9 @@ replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *he g_string_append(str, ms[0]); g_string_append(str, "file://"); - base = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL); + base = g_build_filename(style->style_dir, "Contents", "Resources", "Template.html", NULL); g_string_append(str, base); - g_free (base); + g_free(base); g_string_append(str, ms[1]); @@ -269,8 +269,6 @@ replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *he g_string_append(str, "file://"); g_string_append(str, csspath); - - g_string_append(str, ms[3]); if (header) g_string_append(str, header); @@ -280,8 +278,8 @@ replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *he g_string_append(str, ms[5]); g_strfreev(ms); - g_free (csspath); - return g_string_free (str, FALSE); + g_free(csspath); + return g_string_free(str, FALSE); } static GtkWidget * @@ -295,33 +293,34 @@ get_webkit(PurpleConversation *conv) return gtkconv->webview; } -static void set_theme_webkit_settings (WebKitWebView *webview, PidginMessageStyle *style) +static void +set_theme_webkit_settings(WebKitWebView *webview, PidginMessageStyle *style) { WebKitWebSettings *settings; - g_object_get (G_OBJECT(webview), "settings", &settings, NULL); + g_object_get(G_OBJECT(webview), "settings", &settings, NULL); if (style->default_font_family) - g_object_set (G_OBJECT (settings), "default-font-family", style->default_font_family, NULL); + g_object_set(G_OBJECT(settings), "default-font-family", style->default_font_family, NULL); if (style->default_font_size) - g_object_set (G_OBJECT (settings), "default-font-size", GINT_TO_POINTER (style->default_font_size), NULL); + g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(style->default_font_size), NULL); /* this does not work :( */ - webkit_web_view_set_transparent (webview, style->default_background_is_transparent); + webkit_web_view_set_transparent(webview, style->default_background_is_transparent); } /* * The style specification says that if the conversation is a group - * chat then the
element will be given a class - * 'groupchat'. I can't add another '%@' in Template.html because + * chat then the
element will be given a class + * 'groupchat'. I can't add another '%@' in Template.html because * that breaks style-specific Template.html's. I have to either use libxml * or conveniently play with WebKit's javascript engine. The javascript * engine should work, but it's not an identical behavior. */ static void -webkit_set_groupchat (GtkWebView *webview) +webkit_set_groupchat(GtkWebView *webview) { - gtk_webview_safe_execute_script (webview, "document.getElementById('Chat').className = 'groupchat'"); + gtk_webview_safe_execute_script(webview, "document.getElementById('Chat').className = 'groupchat'"); } @@ -329,7 +328,7 @@ webkit_set_groupchat (GtkWebView *webview) * Called when either a new PurpleConversation is created * or when a PidginConversation changes its active PurpleConversation * This will not change the theme if the theme is already set. - * (This is to prevent accidental theme changes if a new + * (This is to prevent accidental theme changes if a new * PurpleConversation gets added. * * FIXME: it's not at all clear to me as to how @@ -337,7 +336,7 @@ webkit_set_groupchat (GtkWebView *webview) * changes. */ static void -init_theme_for_webkit (PurpleConversation *conv, char *style_dir) +init_theme_for_webkit(PurpleConversation *conv, char *style_dir) { GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; char *header, *footer; @@ -346,67 +345,70 @@ init_theme_for_webkit (PurpleConversation *conv, char *style_dir) char* basedir; char* baseuri; PidginMessageStyle *style, *oldStyle; - oldStyle = g_object_get_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY); + PidginMessageStyle *copy; - if (oldStyle) return; + oldStyle = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY); + if (oldStyle) + return; - purple_debug_info ("webkit", "loading %s\n", style_dir); - style = pidgin_message_style_load (style_dir); - g_assert (style); - g_assert (style->template_html); /* debugging test? */ + purple_debug_info("webkit", "loading %s\n", style_dir); + style = pidgin_message_style_load(style_dir); + g_assert(style); + g_assert(style->template_html); /* debugging test? */ - basedir = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL); - baseuri = g_strdup_printf ("file://%s", basedir); + basedir = g_build_filename(style->style_dir, "Contents", "Resources", "Template.html", NULL); + baseuri = g_strdup_printf("file://%s", basedir); header = replace_header_tokens(style->header_html, strlen(style->header_html), conv); - g_assert (style); + g_assert(style); footer = replace_header_tokens(style->footer_html, strlen(style->footer_html), conv); template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); g_assert(template); - purple_debug_info ("webkit", "template: %s\n", template); + purple_debug_info("webkit", "template: %s\n", template); - set_theme_webkit_settings (WEBKIT_WEB_VIEW(webkit), style); + set_theme_webkit_settings(WEBKIT_WEB_VIEW(webkit), style); webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); - PidginMessageStyle *copy = pidgin_message_style_copy (style); - g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy); + copy = pidgin_message_style_copy(style); + g_object_set_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy); - pidgin_message_style_unref (style); + pidgin_message_style_unref(style); /* I need to unref this style when the webkit object destroys */ - g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); - - if (purple_conversation_get_type (conv) == PURPLE_CONV_TYPE_CHAT) - webkit_set_groupchat (GTK_WEBVIEW (webkit)); - g_free (basedir); - g_free (baseuri); - g_free (header); - g_free (footer); - g_free (template); + g_signal_connect(G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); + + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) + webkit_set_groupchat(GTK_WEBVIEW(webkit)); + g_free(basedir); + g_free(baseuri); + g_free(header); + g_free(footer); + g_free(template); } /* restore the non theme version of the conversation window */ static void -finalize_theme_for_webkit (PurpleConversation *conv) +finalize_theme_for_webkit(PurpleConversation *conv) { GtkWidget *webview = PIDGIN_CONVERSATION(conv)->webview; - PidginMessageStyle *style = g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY); + PidginMessageStyle *style = g_object_get_data(G_OBJECT(webview), MESSAGE_STYLE_KEY); webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), "", "text/html", "UTF-8", ""); - g_object_set_data (G_OBJECT(webview), MESSAGE_STYLE_KEY, NULL); - pidgin_message_style_unref (style); + g_object_set_data(G_OBJECT(webview), MESSAGE_STYLE_KEY, NULL); + pidgin_message_style_unref(style); } static void -webkit_on_webview_destroy (GtkObject *object, gpointer data) +webkit_on_webview_destroy(GtkObject *object, gpointer data) { - pidgin_message_style_unref ((PidginMessageStyle*) data); - g_object_set_data (G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); + pidgin_message_style_unref((PidginMessageStyle *)data); + g_object_set_data(G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); } -static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, +static gboolean +webkit_on_displaying_im_msg(PurpleAccount *account, const char* name, char **pmessage, PurpleConversation *conv, @@ -423,17 +425,16 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, char *script; char *func = "appendMessage"; char *smileyed; - time_t mtime = time (NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */ + time_t mtime = time(NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */ PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); PidginMessageStyle *style; - fprintf (stderr, "hmm.. here %s %s\n", name, message); webkit = get_webkit(conv); stripped = g_strdup(message); - style = g_object_get_data (G_OBJECT (webkit), MESSAGE_STYLE_KEY); - g_assert (style); + style = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY); + g_assert(style); if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) { message_html = style->outgoing_next_content_html; @@ -452,11 +453,11 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, smileyed = smiley_parse_markup(stripped, conv->account->protocol_id); msg = replace_message_tokens(message_html, 0, conv, name, alias, smileyed, flags, mtime); - escape = gtk_webview_quote_js_string (msg); + escape = gtk_webview_quote_js_string(msg); script = g_strdup_printf("%s(%s)", func, escape); - purple_debug_info ("webkit", "JS: %s\n", script); - gtk_webview_safe_execute_script (GTK_WEBVIEW (webkit), script); + purple_debug_info("webkit", "JS: %s\n", script); + gtk_webview_safe_execute_script(GTK_WEBVIEW(webkit), script); g_free(script); g_free(smileyed); @@ -467,7 +468,8 @@ static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, return TRUE; /* GtkConv should not handle this IM */ } -static gboolean webkit_on_displaying_chat_msg (PurpleAccount *account, +static gboolean +webkit_on_displaying_chat_msg(PurpleAccount *account, const char *who, char **message, PurpleConversation *conv, @@ -475,43 +477,43 @@ static gboolean webkit_on_displaying_chat_msg (PurpleAccount *account, gpointer userdata) { /* handle exactly like an IM message for now */ - return webkit_on_displaying_im_msg (account, who, message, conv, flags, NULL); + return webkit_on_displaying_im_msg(account, who, message, conv, flags, NULL); } static void -webkit_on_conversation_displayed (PidginConversation *gtkconv, gpointer data) +webkit_on_conversation_displayed(PidginConversation *gtkconv, gpointer data) { - init_theme_for_webkit (gtkconv->active_conv, cur_style_dir); + init_theme_for_webkit(gtkconv->active_conv, cur_style_dir); } static void -webkit_on_conversation_switched (PurpleConversation *conv, gpointer data) +webkit_on_conversation_switched(PurpleConversation *conv, gpointer data) { - init_theme_for_webkit (conv, cur_style_dir); + init_theme_for_webkit(conv, cur_style_dir); } static void -webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data) +webkit_on_conversation_hiding(PidginConversation *gtkconv, gpointer data) { - /* + /* * I'm not sure if I need to do anything here, but let's keep - * this anyway. + * this anyway. */ } -static GList* -get_dir_dir_list (const char* dirname) +static GList * +get_dir_dir_list(const char *dirname) { GList *ret = NULL; - GDir *dir = g_dir_open (dirname, 0, NULL); + GDir *dir = g_dir_open(dirname, 0, NULL); const char* subdir; if (!dir) return NULL; - while ((subdir = g_dir_read_name (dir))) { - ret = g_list_append (ret, g_build_filename (dirname, subdir, NULL)); + while ((subdir = g_dir_read_name(dir))) { + ret = g_list_append(ret, g_build_filename(dirname, subdir, NULL)); } - g_dir_close (dir); + g_dir_close(dir); return ret; } @@ -520,40 +522,40 @@ get_dir_dir_list (const char* dirname) * directories. I don't guarrantee that these are valid themes, just * that they are in the directories for themes. */ -static GList* -get_style_directory_list () +static GList * +get_style_directory_list(void) { char *user_dir, *user_style_dir, *global_style_dir; GList *list1, *list2; - user_dir = get_absolute_path (purple_user_dir ()); + user_dir = get_absolute_path(purple_user_dir()); - user_style_dir = g_build_filename (user_dir, "styles", NULL); - global_style_dir = g_build_filename (DATADIR, "pidgin", "styles", NULL); + user_style_dir = g_build_filename(user_dir, "styles", NULL); + global_style_dir = g_build_filename(DATADIR, "pidgin", "styles", NULL); - list1 = get_dir_dir_list (user_style_dir); - list2 = get_dir_dir_list (global_style_dir); + list1 = get_dir_dir_list(user_style_dir); + list2 = get_dir_dir_list(global_style_dir); - g_free (global_style_dir); - g_free (user_style_dir); - g_free (user_dir); + g_free(global_style_dir); + g_free(user_style_dir); + g_free(user_dir); - return g_list_concat (list1, list2); + return g_list_concat(list1, list2); } /** - * use heuristics or previous user options to figure out what + * use heuristics or previous user options to figure out what * theme to use as default in this Pidgin instance. */ static void -style_set_default () +style_set_default(void) { - GList* styles = get_style_directory_list (), *iter; - const char *stylepath = purple_prefs_get_string ("/plugins/gtk/adiumthemes/stylepath"); - g_assert (cur_style_dir == NULL); + GList *styles = get_style_directory_list(), *iter; + const char *stylepath = purple_prefs_get_string("/plugins/gtk/adiumthemes/stylepath"); + g_assert(cur_style_dir == NULL); if (stylepath && *stylepath) - styles = g_list_prepend (styles, g_strdup (stylepath)); + styles = g_list_prepend(styles, g_strdup(stylepath)); else { purple_notify_error(handle, _("Webkit themes"), _("Can't find installed styles"), @@ -563,62 +565,63 @@ style_set_default () /* pick any one that works. Note that we have first preference * for the one in the userdir */ - for (iter = styles; iter; iter = g_list_next (iter)) { - PidginMessageStyle *style = pidgin_message_style_load (iter->data); + for (iter = styles; iter; iter = g_list_next(iter)) { + PidginMessageStyle *style = pidgin_message_style_load(iter->data); if (style) { - cur_style_dir = (char*) g_strdup (iter->data); - pidgin_message_style_unref (style); + cur_style_dir = (char *)g_strdup(iter->data); + pidgin_message_style_unref(style); break; } - purple_debug_info ("webkit", "Style %s is invalid\n", (char*) iter->data); + purple_debug_info("webkit", "Style %s is invalid\n", (char *)iter->data); } - for (iter = styles; iter; iter = g_list_next (iter)) - g_free (iter->data); - g_list_free (styles); + for (iter = styles; iter; iter = g_list_next(iter)) + g_free(iter->data); + g_list_free(styles); } static gboolean plugin_load(PurplePlugin *plugin) { - style_set_default (); - if (!cur_style_dir) return FALSE; /* couldn't find a style */ + style_set_default(); + if (!cur_style_dir) + return FALSE; /* couldn't find a style */ - purple_signal_connect (pidgin_conversations_get_handle (), + purple_signal_connect(pidgin_conversations_get_handle(), "displaying-im-msg", - webkit_plugin_get_handle (), + webkit_plugin_get_handle(), PURPLE_CALLBACK(webkit_on_displaying_im_msg), NULL); - purple_signal_connect (pidgin_conversations_get_handle (), + purple_signal_connect(pidgin_conversations_get_handle(), "displaying-chat-msg", - webkit_plugin_get_handle (), + webkit_plugin_get_handle(), PURPLE_CALLBACK(webkit_on_displaying_chat_msg), NULL); - purple_signal_connect (pidgin_conversations_get_handle (), + purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed", - webkit_plugin_get_handle (), + webkit_plugin_get_handle(), PURPLE_CALLBACK(webkit_on_conversation_displayed), NULL); - purple_signal_connect (pidgin_conversations_get_handle (), + purple_signal_connect(pidgin_conversations_get_handle(), "conversation-switched", - webkit_plugin_get_handle (), + webkit_plugin_get_handle(), PURPLE_CALLBACK(webkit_on_conversation_switched), NULL); - purple_signal_connect (pidgin_conversations_get_handle (), + purple_signal_connect(pidgin_conversations_get_handle(), "conversation-hiding", - webkit_plugin_get_handle (), + webkit_plugin_get_handle(), PURPLE_CALLBACK(webkit_on_conversation_hiding), NULL); /* finally update each of the existing conversation windows */ { - GList* list = purple_get_conversations (); + GList *list = purple_get_conversations(); for (;list; list = g_list_next(list)) - init_theme_for_webkit (list->data, cur_style_dir); + init_theme_for_webkit(list->data, cur_style_dir); } return TRUE; @@ -629,9 +632,9 @@ plugin_unload(PurplePlugin *plugin) { GList *list; - webkit_plugin_free_handle (); + webkit_plugin_free_handle(); cur_style_dir = NULL; - list = purple_get_conversations (); + list = purple_get_conversations(); while (list) { finalize_theme_for_webkit(list->data); list = g_list_next(list); @@ -645,156 +648,155 @@ plugin_unload(PurplePlugin *plugin) */ static void -style_changed (GtkWidget* combobox, gpointer null) +style_changed(GtkWidget *combobox, gpointer null) { - char *name = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combobox)); + char *name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combobox)); GtkWidget *dialog; - GList *styles = get_style_directory_list (), *iter; + GList *styles = get_style_directory_list(), *iter; /* find the full path for this name, I wish I could store this info in the combobox itself. :( */ for (iter = styles; iter; iter = g_list_next(iter)) { - char* basename = g_path_get_basename (iter->data); - if (g_str_equal (basename, name)) { - g_free (basename); + char *basename = g_path_get_basename(iter->data); + if (g_str_equal(basename, name)) { + g_free(basename); break; } - g_free (basename); + g_free(basename); } - g_assert (iter); - g_free (name); - g_free (cur_style_dir); - cur_style_dir = g_strdup (iter->data);; - purple_prefs_set_string ("/plugins/gtk/adiumthemes/stylepath", cur_style_dir); + g_assert(iter); + g_free(name); + g_free(cur_style_dir); + cur_style_dir = g_strdup(iter->data);; + purple_prefs_set_string("/plugins/gtk/adiumthemes/stylepath", cur_style_dir); /* inform the user that existing conversations haven't changed */ - dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "The style for existing conversations have not been changed. Please close and re-open the conversation for the changes to take effect."); - g_assert (dialog); - gtk_widget_show (dialog); - g_signal_connect_swapped (dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog); + dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "The style for existing conversations have not been changed. Please close and re-open the conversation for the changes to take effect."); + g_assert(dialog); + gtk_widget_show(dialog); + g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog); } -static GtkWidget* -get_style_config_frame () +static GtkWidget * +get_style_config_frame(void) { - GtkWidget *combobox = gtk_combo_box_new_text (); - GList *styles = get_style_directory_list (), *iter; + GtkWidget *combobox = gtk_combo_box_new_text(); + GList *styles = get_style_directory_list(), *iter; int index = 0, selected = 0; - for (iter = styles; iter; iter = g_list_next (iter)) { - PidginMessageStyle *style = pidgin_message_style_load (iter->data); + for (iter = styles; iter; iter = g_list_next(iter)) { + PidginMessageStyle *style = pidgin_message_style_load(iter->data); if (style) { - char *text = g_path_get_basename (iter->data); - gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), text); - g_free (text); + char *text = g_path_get_basename(iter->data); + gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), text); + g_free(text); - if (g_str_equal (iter->data, cur_style_dir)) + if (g_str_equal(iter->data, cur_style_dir)) selected = index; index++; - pidgin_message_style_unref (style); + pidgin_message_style_unref(style); } } - gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), selected); - g_signal_connect_after (G_OBJECT(combobox), "changed", G_CALLBACK(style_changed), NULL); + gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), selected); + g_signal_connect_after(G_OBJECT(combobox), "changed", G_CALLBACK(style_changed), NULL); return combobox; } static void -variant_update_conversation (PurpleConversation *conv) +variant_update_conversation(PurpleConversation *conv) { - PidginConversation *gtkconv = PIDGIN_CONVERSATION (conv); - WebKitWebView *webview = WEBKIT_WEB_VIEW (gtkconv->webview); - PidginMessageStyle *style = (PidginMessageStyle*) g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY); + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); + WebKitWebView *webview = WEBKIT_WEB_VIEW(gtkconv->webview); + PidginMessageStyle *style = (PidginMessageStyle *)g_object_get_data(G_OBJECT(webview), MESSAGE_STYLE_KEY); char *script; - g_assert (style); + g_assert(style); - script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css (style)); - gtk_webview_safe_execute_script (GTK_WEBVIEW(webview), script); + script = g_strdup_printf("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css(style)); + gtk_webview_safe_execute_script(GTK_WEBVIEW(webview), script); - set_theme_webkit_settings (WEBKIT_WEB_VIEW (gtkconv->webview), style); - g_free (script); + set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), style); + g_free(script); } static void -variant_changed (GtkWidget* combobox, gpointer null) +variant_changed(GtkWidget* combobox, gpointer null) { char *name; GList *list; - PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); + PidginMessageStyle *style = pidgin_message_style_load(cur_style_dir); - g_assert (style); - name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combobox)); - pidgin_message_style_set_variant (style, name); - pidgin_message_style_save_state (style); + g_assert(style); + name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combobox)); + pidgin_message_style_set_variant(style, name); + pidgin_message_style_save_state(style); /* update conversations */ - list = purple_get_conversations (); + list = purple_get_conversations(); while (list) { - variant_update_conversation (list->data); + variant_update_conversation(list->data); list = g_list_next(list); } - g_free (name); - pidgin_message_style_unref (style); + g_free(name); + pidgin_message_style_unref(style); } static GtkWidget * get_variant_config_frame() { - PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); - GList *variants = pidgin_message_style_get_variants (style), *iter; - char *cur_variant = pidgin_message_style_get_variant (style); + PidginMessageStyle *style = pidgin_message_style_load(cur_style_dir); + GList *variants = pidgin_message_style_get_variants(style), *iter; + char *cur_variant = pidgin_message_style_get_variant(style); GtkWidget *combobox = gtk_combo_box_new_text(); int def = -1, index = 0; - pidgin_message_style_unref (style); + pidgin_message_style_unref(style); - for (iter = variants; iter; iter = g_list_next (iter)) { - gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), iter->data); + for (iter = variants; iter; iter = g_list_next(iter)) { + gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), iter->data); - if (g_str_equal (cur_variant, iter->data)) + if (g_str_equal(cur_variant, iter->data)) def = index; index ++; } - gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), def); - g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL); + gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), def); + g_signal_connect(G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL); return combobox; } static void -style_changed_reset_variants (GtkWidget* combobox, gpointer table) +style_changed_reset_variants(GtkWidget* combobox, gpointer table) { /* I hate to do this, I swear. But I don't know how to cleanly clean an existing combobox */ - GtkWidget* variants = g_object_get_data (G_OBJECT(table), "variants-cbox"); - gtk_widget_destroy (variants); - variants = get_variant_config_frame (); - gtk_table_attach_defaults (GTK_TABLE (table), variants, 1, 2, 1, 2); - gtk_widget_show_all (GTK_WIDGET(table)); + GtkWidget* variants = g_object_get_data(G_OBJECT(table), "variants-cbox"); + gtk_widget_destroy(variants); + variants = get_variant_config_frame(); + gtk_table_attach_defaults(GTK_TABLE(table), variants, 1, 2, 1, 2); + gtk_widget_show_all(GTK_WIDGET(table)); - g_object_set_data (G_OBJECT(table), "variants-cbox", variants); + g_object_set_data(G_OBJECT(table), "variants-cbox", variants); } static GtkWidget* get_config_frame(PurplePlugin* plugin) { - GtkWidget *table = gtk_table_new (2, 2, FALSE); - GtkWidget *style_config = get_style_config_frame (); - GtkWidget *variant_config = get_variant_config_frame (); - - gtk_table_attach_defaults (GTK_TABLE(table), gtk_label_new ("Message Style"), 0, 1, 0, 1); - gtk_table_attach_defaults (GTK_TABLE(table), style_config, 1, 2, 0, 1); - gtk_table_attach_defaults (GTK_TABLE(table), gtk_label_new ("Style Variant"), 0, 1, 1, 2); - gtk_table_attach_defaults (GTK_TABLE(table), variant_config, 1, 2, 1, 2); + GtkWidget *table = gtk_table_new(2, 2, FALSE); + GtkWidget *style_config = get_style_config_frame(); + GtkWidget *variant_config = get_variant_config_frame(); + gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new("Message Style"), 0, 1, 0, 1); + gtk_table_attach_defaults(GTK_TABLE(table), style_config, 1, 2, 0, 1); + gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new("Style Variant"), 0, 1, 1, 2); + gtk_table_attach_defaults(GTK_TABLE(table), variant_config, 1, 2, 1, 2); - g_object_set_data (G_OBJECT(table), "variants-cbox", variant_config); + g_object_set_data(G_OBJECT(table), "variants-cbox", variant_config); /* to clarify, this is a second signal connected on style config */ - g_signal_connect_after (G_OBJECT(style_config), "changed", G_CALLBACK(style_changed_reset_variants), table); + g_signal_connect_after(G_OBJECT(style_config), "changed", G_CALLBACK(style_changed_reset_variants), table); return table; } @@ -818,7 +820,7 @@ static PurplePluginInfo info = PURPLE_MAJOR_VERSION, /* Purple Major Version */ PURPLE_MINOR_VERSION, /* Purple Minor Version */ PURPLE_PLUGIN_STANDARD, /* plugin type */ -PIDGIN_PLUGIN_TYPE, /* ui requirement */ + PIDGIN_PLUGIN_TYPE, /* ui requirement */ 0, /* flags */ NULL, /* dependencies */ PURPLE_PRIORITY_DEFAULT, /* priority */ @@ -851,10 +853,11 @@ init_plugin(PurplePlugin *plugin) { info.summary = "Adium-like IMs with Pidgin"; info.description = "You can chat in Pidgin using Adium's WebKit view."; - purple_prefs_add_none ("/plugins"); - purple_prefs_add_none ("/plugins/gtk"); - purple_prefs_add_none ("/plugins/gtk/adiumthemes"); - purple_prefs_add_string ("/plugins/gtk/adiumthemes/stylepath", ""); + purple_prefs_add_none("/plugins"); + purple_prefs_add_none("/plugins/gtk"); + purple_prefs_add_none("/plugins/gtk/adiumthemes"); + purple_prefs_add_string("/plugins/gtk/adiumthemes/stylepath", ""); } PURPLE_INIT_PLUGIN(webkit, init_plugin, info) + diff --git a/pidgin/smileyparser.c b/pidgin/smileyparser.c index 134de3d306..0c6e2d1470 100644 --- a/pidgin/smileyparser.c +++ b/pidgin/smileyparser.c @@ -1,140 +1,165 @@ +/* pidgin + * + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * + */ #include +#include #include "smileyparser.h" #include #include #include "gtkthemes.h" -static char* get_fullpath (const char* filename) +static char * +get_fullpath(const char *filename) { - if (g_path_is_absolute (filename)) return g_strdup (filename); - else return g_build_path (g_get_current_dir (), filename, NULL); + if (g_path_is_absolute(filename)) + return g_strdup(filename); + else + return g_build_path(g_get_current_dir(), filename, NULL); } static void -parse_for_shortcut_plaintext (const char* text, const char* shortcut, const char* file, GString* ret) +parse_for_shortcut_plaintext(const char *text, const char *shortcut, const char *file, GString *ret) { const char *tmp = text; - for(;*tmp;) { - const char *end = strstr (tmp, shortcut); + for (;*tmp;) { + const char *end = strstr(tmp, shortcut); char *path; char *escaped_path; if (end == NULL) { - g_string_append (ret, tmp); + g_string_append(ret, tmp); break; } - path = get_fullpath (file); - escaped_path = g_markup_escape_text (path, -1); + path = get_fullpath(file); + escaped_path = g_markup_escape_text(path, -1); - g_string_append_len (ret, tmp, end-tmp); - g_string_append_printf (ret,"%s", + g_string_append_len(ret, tmp, end-tmp); + g_string_append_printf(ret,"%s", shortcut, escaped_path); - g_free (path); - g_free (escaped_path); - g_assert (strlen (tmp) >= strlen (shortcut)); - tmp = end + strlen (shortcut); + g_free(path); + g_free(escaped_path); + g_assert(strlen(tmp) >= strlen(shortcut)); + tmp = end + strlen(shortcut); } } -static char* -parse_for_shortcut (const char* markup, const char* shortcut, const char* file) +static char * +parse_for_shortcut(const char *markup, const char *shortcut, const char *file) { - GString* ret = g_string_new (""); - char *local_markup = g_strdup (markup); - char *escaped_shortcut = g_markup_escape_text (shortcut, -1); + GString* ret = g_string_new(""); + char *local_markup = g_strdup(markup); + char *escaped_shortcut = g_markup_escape_text(shortcut, -1); char *temp = local_markup; - + for (;*temp;) { - char *end = strchr (temp, '<'); + char *end = strchr(temp, '<'); char *end_of_tag; if (!end) { - parse_for_shortcut_plaintext (temp, escaped_shortcut, file, ret); + parse_for_shortcut_plaintext(temp, escaped_shortcut, file, ret); break; } *end = 0; - parse_for_shortcut_plaintext (temp, escaped_shortcut, file, ret); + parse_for_shortcut_plaintext(temp, escaped_shortcut, file, ret); *end = '<'; /* if this is well-formed, then there should be no '>' within * the tag. TODO: handle a comment tag better :( */ - end_of_tag = strchr (end, '>'); + end_of_tag = strchr(end, '>'); if (!end_of_tag) { - g_string_append (ret, end); + g_string_append(ret, end); break; } - g_string_append_len (ret, end, end_of_tag-end+1); + g_string_append_len(ret, end, end_of_tag - end + 1); temp = end_of_tag + 1; } - g_free (local_markup); - g_free (escaped_shortcut); - return g_string_free (ret, FALSE); + g_free(local_markup); + g_free(escaped_shortcut); + return g_string_free(ret, FALSE); } -static char* -parse_for_purple_smiley (const char* markup, PurpleSmiley *smiley) +static char * +parse_for_purple_smiley(const char *markup, PurpleSmiley *smiley) { - char *file = purple_smiley_get_full_path (smiley); - char *ret = parse_for_shortcut (markup, purple_smiley_get_shortcut (smiley), file); - g_free (file); + char *file = purple_smiley_get_full_path(smiley); + char *ret = parse_for_shortcut(markup, purple_smiley_get_shortcut(smiley), file); + g_free(file); return ret; } -static char* -parse_for_smiley_list (const char* markup, GHashTable* smileys) +static char * +parse_for_smiley_list(const char *markup, GHashTable *smileys) { GHashTableIter iter; char *key, *value; - char *ret = g_strdup (markup); + char *ret = g_strdup(markup); - g_hash_table_iter_init (&iter, smileys); - while (g_hash_table_iter_next (&iter, (gpointer*)&key, (gpointer*)&value)) + g_hash_table_iter_init(&iter, smileys); + while (g_hash_table_iter_next(&iter, (gpointer *)&key, (gpointer *)&value)) { - char* temp = parse_for_shortcut (ret, key, value); - g_free (ret); + char *temp = parse_for_shortcut(ret, key, value); + g_free(ret); ret = temp; } + return ret; } -char* -smiley_parse_markup (const char* markup, const char *proto_id) +char * +smiley_parse_markup(const char *markup, const char *proto_id) { - GList *smileys = purple_smileys_get_all (); - char *temp = g_strdup (markup), *temp2; + GList *smileys = purple_smileys_get_all(); + char *temp = g_strdup(markup), *temp2; struct smiley_list *list; const char *proto_name = "default"; if (proto_id != NULL) { PurplePlugin *proto; - proto = purple_find_prpl (proto_id); + proto = purple_find_prpl(proto_id); proto_name = proto->info->name; } /* unnecessarily slow, but lets manage for now. */ - for (; smileys; smileys = g_list_next (smileys)) { - temp2 = parse_for_purple_smiley (temp, PURPLE_SMILEY (smileys->data)); - g_free (temp); + for (; smileys; smileys = g_list_next(smileys)) { + temp2 = parse_for_purple_smiley(temp, PURPLE_SMILEY(smileys->data)); + g_free(temp); temp = temp2; } /* now for each theme smiley, observe that this does look nasty */ - if (!current_smiley_theme || !(current_smiley_theme->list)) { - printf ("theme does not exist\n"); + purple_debug_warning("smiley", "theme does not exist\n"); return temp; } for (list = current_smiley_theme->list; list; list = list->next) { - if (g_str_equal (list->sml, proto_name)) { - temp2 = parse_for_smiley_list (temp, list->files); - g_free (temp); + if (g_str_equal(list->sml, proto_name)) { + temp2 = parse_for_smiley_list(temp, list->files); + g_free(temp); temp = temp2; } } diff --git a/pidgin/smileyparser.h b/pidgin/smileyparser.h index 9676ab64bb..a8dc349eb3 100644 --- a/pidgin/smileyparser.h +++ b/pidgin/smileyparser.h @@ -1,3 +1,25 @@ +/* pidgin + * + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * + */ + +char * +smiley_parse_markup(const char *markup, const char *sml); -char* -smiley_parse_markup (const char* markup, const char* sml); -- cgit v1.2.1 From e86d4160b23a900f4761166674884371f6bf8342 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 8 Sep 2011 22:10:49 +0000 Subject: Remove unnecessary function. It's also a use-after-free. --- pidgin/plugins/adiumthemes/message-style.c | 47 +++++------------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/pidgin/plugins/adiumthemes/message-style.c b/pidgin/plugins/adiumthemes/message-style.c index 81919b97bd..f70ee01437 100644 --- a/pidgin/plugins/adiumthemes/message-style.c +++ b/pidgin/plugins/adiumthemes/message-style.c @@ -49,43 +49,6 @@ pidgin_message_style_new(const char *styledir) return ret; } -/** - * deallocate any memory used for info.plist options - */ -static void -pidgin_message_style_unset_info_plist(PidginMessageStyle *style) -{ - style->message_view_version = 0; - g_free(style->cf_bundle_name); - style->cf_bundle_name = NULL; - - g_free(style->cf_bundle_identifier); - style->cf_bundle_identifier = NULL; - - g_free(style->cf_bundle_get_info_string); - style->cf_bundle_get_info_string = NULL; - - g_free(style->default_font_family); - style->default_font_family = NULL; - - style->default_font_size = 0; - style->shows_user_icons = TRUE; - style->disable_combine_consecutive = FALSE; - style->default_background_is_transparent = FALSE; - style->disable_custom_background = FALSE; - - g_free(style->default_background_color); - style->default_background_color = NULL; - - style->allow_text_colors = TRUE; - - g_free(style->image_mask); - style->image_mask = NULL; - g_free(style->default_variant); - style->default_variant = NULL; -} - - void pidgin_message_style_unref(PidginMessageStyle *style) { @@ -97,6 +60,14 @@ pidgin_message_style_unref(PidginMessageStyle *style) if (style->ref_counter) return; + g_free(style->cf_bundle_name); + g_free(style->cf_bundle_identifier); + g_free(style->cf_bundle_get_info_string); + g_free(style->default_font_family); + g_free(style->default_background_color); + g_free(style->image_mask); + g_free(style->default_variant); + g_free(style->style_dir); g_free(style->template_path); @@ -108,8 +79,6 @@ pidgin_message_style_unref(PidginMessageStyle *style) g_free(style->basestyle_css); g_free(style); - - pidgin_message_style_unset_info_plist(style); } void -- cgit v1.2.1 From 0262a27902d8fa66b726b53cec4a4de1a4c0cf30 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 8 Sep 2011 22:14:42 +0000 Subject: Simplify, don't loop through list twice. --- pidgin/plugins/adiumthemes/message-style.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pidgin/plugins/adiumthemes/message-style.c b/pidgin/plugins/adiumthemes/message-style.c index f70ee01437..d103136790 100644 --- a/pidgin/plugins/adiumthemes/message-style.c +++ b/pidgin/plugins/adiumthemes/message-style.c @@ -32,10 +32,8 @@ static void glist_free_all_string(GList *list) { - GList *first = list; - for (; list; list = g_list_next(list)) + for (; list; list = g_list_delete_link(list, list)) g_free(list->data); - g_list_free(first); } static PidginMessageStyle * -- cgit v1.2.1 From 43e4864d2d3b376a7db63c49ab87fe6cd0591ced Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 8 Sep 2011 22:24:00 +0000 Subject: Fix notify plugin compile. --- pidgin/plugins/Makefile.am | 4 ++++ pidgin/plugins/notify.c | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index 593118692a..e5d59f0186 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -35,6 +35,7 @@ extplacement_la_LDFLAGS = -module -avoid-version gtk_signals_test_la_LDFLAGS = -module -avoid-version gtkbuddynote_la_LDFLAGS = -module -avoid-version iconaway_la_LDFLAGS = -module -avoid-version +notify_la_LDFLAGS = -module -avoid-version pidginrc_la_LDFLAGS = -module -avoid-version relnot_la_LDFLAGS = -module -avoid-version sendbutton_la_LDFLAGS = -module -avoid-version @@ -50,6 +51,7 @@ plugin_LTLIBRARIES = \ extplacement.la \ gtkbuddynote.la \ iconaway.la \ + notify.la \ pidginrc.la \ relnot.la \ sendbutton.la \ @@ -71,6 +73,7 @@ extplacement_la_SOURCES = extplacement.c gtk_signals_test_la_SOURCES = gtk-signals-test.c gtkbuddynote_la_SOURCES = gtkbuddynote.c iconaway_la_SOURCES = iconaway.c +notify_la_SOURCES = notify.c pidginrc_la_SOURCES = pidginrc.c relnot_la_SOURCES = relnot.c sendbutton_la_SOURCES = sendbutton.c @@ -84,6 +87,7 @@ extplacement_la_LIBADD = $(GTK_LIBS) gtk_signals_test_la_LIBADD = $(GTK_LIBS) gtkbuddynote_la_LIBADD = $(GTK_LIBS) iconaway_la_LIBADD = $(GTK_LIBS) +notify_la_LIBADD = $(GTK_LIBS) pidginrc_la_LIBADD = $(GTK_LIBS) relnot_la_LIBADD = $(GLIB_LIBS) sendbutton_la_LIBADD = $(GTK_LIBS) diff --git a/pidgin/plugins/notify.c b/pidgin/plugins/notify.c index 1e0a38aa8d..fd223d06dd 100644 --- a/pidgin/plugins/notify.c +++ b/pidgin/plugins/notify.c @@ -303,7 +303,7 @@ static int attach_signals(PurpleConversation *conv) { PidginConversation *gtkconv = NULL; - GSList *imhtml_ids = NULL, *entry_ids = NULL; + GSList *webview_ids = NULL, *entry_ids = NULL; guint id; gtkconv = PIDGIN_CONVERSATION(conv); @@ -322,9 +322,9 @@ attach_signals(PurpleConversation *conv) G_CALLBACK(unnotify_cb), conv); entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); - id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "focus-in-event", + id = g_signal_connect(G_OBJECT(gtkconv->webview), "focus-in-event", G_CALLBACK(unnotify_cb), conv); - imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id)); + webview_ids = g_slist_append(webview_ids, GUINT_TO_POINTER(id)); } if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { @@ -334,9 +334,9 @@ attach_signals(PurpleConversation *conv) G_CALLBACK(unnotify_cb), conv); entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); - id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "button-press-event", + id = g_signal_connect(G_OBJECT(gtkconv->webview), "button-press-event", G_CALLBACK(unnotify_cb), conv); - imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id)); + webview_ids = g_slist_append(webview_ids, GUINT_TO_POINTER(id)); } if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) { @@ -345,7 +345,7 @@ attach_signals(PurpleConversation *conv) entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); } - purple_conversation_set_data(conv, "notify-imhtml-signals", imhtml_ids); + purple_conversation_set_data(conv, "notify-webview-signals", webview_ids); purple_conversation_set_data(conv, "notify-entry-signals", entry_ids); return 0; @@ -361,9 +361,9 @@ detach_signals(PurpleConversation *conv) if (!gtkconv) return; - ids = purple_conversation_get_data(conv, "notify-imhtml-signals"); + ids = purple_conversation_get_data(conv, "notify-webview-signals"); for (l = ids; l != NULL; l = l->next) - g_signal_handler_disconnect(gtkconv->imhtml, GPOINTER_TO_INT(l->data)); + g_signal_handler_disconnect(gtkconv->webview, GPOINTER_TO_INT(l->data)); g_slist_free(ids); ids = purple_conversation_get_data(conv, "notify-entry-signals"); @@ -373,7 +373,7 @@ detach_signals(PurpleConversation *conv) purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); - purple_conversation_set_data(conv, "notify-imhtml-signals", NULL); + purple_conversation_set_data(conv, "notify-webview-signals", NULL); purple_conversation_set_data(conv, "notify-entry-signals", NULL); } -- cgit v1.2.1 From c8ab0f91a721a6f453631bd6bed4ae705885dbf8 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 8 Sep 2011 23:28:40 +0000 Subject: Fix history plugin compile. --- pidgin/plugins/Makefile.am | 5 +++++ pidgin/plugins/history.c | 38 +++++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index e5d59f0186..2c03350da1 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -34,6 +34,7 @@ contact_priority_la_LDFLAGS = -module -avoid-version extplacement_la_LDFLAGS = -module -avoid-version gtk_signals_test_la_LDFLAGS = -module -avoid-version gtkbuddynote_la_LDFLAGS = -module -avoid-version +history_la_LDFLAGS = -module -avoid-version iconaway_la_LDFLAGS = -module -avoid-version notify_la_LDFLAGS = -module -avoid-version pidginrc_la_LDFLAGS = -module -avoid-version @@ -50,6 +51,7 @@ plugin_LTLIBRARIES = \ convcolors.la \ extplacement.la \ gtkbuddynote.la \ + history.la \ iconaway.la \ notify.la \ pidginrc.la \ @@ -72,6 +74,7 @@ contact_priority_la_SOURCES = contact_priority.c extplacement_la_SOURCES = extplacement.c gtk_signals_test_la_SOURCES = gtk-signals-test.c gtkbuddynote_la_SOURCES = gtkbuddynote.c +history_la_SOURCES = history.c iconaway_la_SOURCES = iconaway.c notify_la_SOURCES = notify.c pidginrc_la_SOURCES = pidginrc.c @@ -86,6 +89,7 @@ contact_priority_la_LIBADD = $(GTK_LIBS) extplacement_la_LIBADD = $(GTK_LIBS) gtk_signals_test_la_LIBADD = $(GTK_LIBS) gtkbuddynote_la_LIBADD = $(GTK_LIBS) +history_la_LIBADD = $(GTK_LIBS) iconaway_la_LIBADD = $(GTK_LIBS) notify_la_LIBADD = $(GTK_LIBS) pidginrc_la_LIBADD = $(GTK_LIBS) @@ -116,6 +120,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/pidgin \ $(DEBUG_CFLAGS) \ $(GTK_CFLAGS) \ + $(WEBKIT_CFLAGS) \ $(GSTREAMER_CFLAGS) \ $(PLUGIN_CFLAGS) diff --git a/pidgin/plugins/history.c b/pidgin/plugins/history.c index 3d2507343b..6e53097c93 100644 --- a/pidgin/plugins/history.c +++ b/pidgin/plugins/history.c @@ -16,16 +16,17 @@ #include "gtkconv.h" #include "gtkimhtml.h" #include "gtkplugin.h" +#include "gtkwebview.h" #define HISTORY_PLUGIN_ID "gtk-history" #define HISTORY_SIZE (4 * 1024) -static gboolean _scroll_imhtml_to_end(gpointer data) +static gboolean _scroll_webview_to_end(gpointer data) { - GtkIMHtml *imhtml = data; - gtk_imhtml_scroll_to_end(GTK_IMHTML(imhtml), FALSE); - g_object_unref(G_OBJECT(imhtml)); + GtkWebView *webview = data; + gtk_webview_scroll_to_end(GTK_WEBVIEW(webview), FALSE); + g_object_unref(G_OBJECT(webview)); return FALSE; } @@ -39,9 +40,15 @@ static void historize(PurpleConversation *c) guint flags; char *history; PidginConversation *gtkconv; +#if 0 + /* FIXME: WebView has no options */ GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS; +#endif char *header; +#if 0 + /* FIXME: WebView has no protocol setting */ char *protocol; +#endif char *escaped_alias; const char *header_date; @@ -116,15 +123,21 @@ static void historize(PurpleConversation *c) history = purple_log_read((PurpleLog*)logs->data, &flags); gtkconv = PIDGIN_CONVERSATION(c); +#if 0 + /* FIXME: WebView has no options */ if (flags & PURPLE_LOG_READ_NO_NEWLINE) options |= GTK_IMHTML_NO_NEWLINE; +#endif +#if 0 + /* FIXME: WebView has no protocol setting */ protocol = g_strdup(gtk_imhtml_get_protocol_name(GTK_IMHTML(gtkconv->imhtml))); gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), purple_account_get_protocol_name(((PurpleLog*)logs->data)->account)); +#endif - if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "
", options); + if (!gtk_webview_is_empty(GTK_WEBVIEW(gtkconv->webview))) + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "
"); escaped_alias = g_markup_escape_text(alias, -1); @@ -134,21 +147,24 @@ static void historize(PurpleConversation *c) header_date = purple_date_format_full(localtime(&((PurpleLog *)logs->data)->time)); header = g_strdup_printf(_("Conversation with %s on %s:
"), escaped_alias, header_date); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), header, options); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), header); g_free(header); g_free(escaped_alias); g_strchomp(history); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), history, options); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), history); g_free(history); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "
", options); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "
"); +#if 0 + /* FIXME: WebView has no protocol setting */ gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol); g_free(protocol); +#endif - g_object_ref(G_OBJECT(gtkconv->imhtml)); - g_idle_add(_scroll_imhtml_to_end, gtkconv->imhtml); + g_object_ref(G_OBJECT(gtkconv->webview)); + g_idle_add(_scroll_webview_to_end, gtkconv->webview); g_list_foreach(logs, (GFunc)purple_log_free, NULL); g_list_free(logs); -- cgit v1.2.1 From eb29bb1a33be1b54ba7745a14fc3704e936ef659 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 9 Sep 2011 01:52:12 +0000 Subject: Add a pidgin_create_webview utility function, which acts similarly to the imhtml version. Note that an editable webview does not yet exist, so don't call this function with editable=TRUE! --- pidgin/gtkconv.c | 23 ++++---------------- pidgin/gtkutils.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ pidgin/gtkutils.h | 22 +++++++++++++++++++ 3 files changed, 91 insertions(+), 19 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index e546d7f995..7ef22fdabf 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -4947,7 +4947,6 @@ setup_common_pane(PidginConversation *gtkconv) PurpleConversation *conv = gtkconv->active_conv; PurpleBuddy *buddy; gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); - GtkPolicyType webview_sw_hscroll; int buddyicon_size = 0; /* Setup the top part of the pane */ @@ -5039,16 +5038,7 @@ setup_common_pane(PidginConversation *gtkconv) g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL); /* Setup the webkit widget */ - /* TODO: create a pidgin_create_webview() function in utils*/ - webview_sw = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(webview_sw), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(webview_sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - gtkconv->webview = gtk_webview_new(); - gtk_webview_set_vadjustment(GTK_WEBVIEW(gtkconv->webview), - gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(webview_sw))); - gtk_container_add(GTK_CONTAINER(webview_sw), gtkconv->webview); - + frame = pidgin_create_webview(FALSE, >kconv->webview, NULL, &webview_sw); gtk_widget_set_size_request(gtkconv->webview, -1, 0); if (chat) { @@ -5061,23 +5051,18 @@ setup_common_pane(PidginConversation *gtkconv) hpaned = gtk_hpaned_new(); gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); gtk_widget_show(hpaned); - gtk_paned_pack1(GTK_PANED(hpaned), webview_sw, TRUE, TRUE); + gtk_paned_pack1(GTK_PANED(hpaned), frame, TRUE, TRUE); /* Now add the userlist */ setup_chat_userlist(gtkconv, hpaned); } else { - gtk_box_pack_start(GTK_BOX(vbox), webview_sw, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); } - gtk_widget_show_all(webview_sw); + gtk_widget_show_all(frame); gtk_widget_set_name(gtkconv->webview, "pidgin_conv_webview"); g_object_set_data(G_OBJECT(gtkconv->webview), "gtkconv", gtkconv); - gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(webview_sw), - &webview_sw_hscroll, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(webview_sw), - webview_sw_hscroll, GTK_POLICY_ALWAYS); - g_signal_connect_after(G_OBJECT(gtkconv->webview), "button_press_event", G_CALLBACK(entry_stop_rclick_cb), NULL); g_signal_connect(G_OBJECT(gtkconv->webview), "key_press_event", diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index aa0139efb4..dae34ec0a2 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -67,6 +67,7 @@ #include "pidginstock.h" #include "gtkthemes.h" #include "gtkutils.h" +#include "gtkwebview.h" #include "pidgin/minidialog.h" typedef struct { @@ -276,6 +277,70 @@ pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **tool return frame; } +GtkWidget * +pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret) +{ + GtkWidget *frame; + GtkWidget *webview; + GtkWidget *sep; + GtkWidget *sw; + GtkWidget *toolbar = NULL; + GtkWidget *vbox; + + frame = gtk_frame_new(NULL); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(frame), vbox); + gtk_widget_show(vbox); + + if (editable) { + toolbar = gtk_imhtmltoolbar_new(); + gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); + gtk_widget_show(toolbar); + + sep = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); + g_signal_connect_swapped(G_OBJECT(toolbar), "show", G_CALLBACK(gtk_widget_show), sep); + g_signal_connect_swapped(G_OBJECT(toolbar), "hide", G_CALLBACK(gtk_widget_hide), sep); + gtk_widget_show(sep); + } + + webview = gtk_webview_new(); +#if 0 + /* FIXME: Don't have editable webview yet. */ + gtk_webview_set_editable(GTK_WEBVIEW(webview), editable); +#endif + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(webview), GTK_WRAP_WORD_CHAR); +#ifdef USE_GTKSPELL + if (editable && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck")) + pidgin_setup_gtkspell(GTK_TEXT_VIEW(webview)); +#endif + gtk_widget_show(webview); + + if (editable) { + gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(toolbar), webview); + gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(toolbar), "default"); + } + + sw = pidgin_make_scrollable(webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1); + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); + + gtk_webview_set_vadjustment(GTK_WEBVIEW(webview), + gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw))); + + if (webview_ret != NULL) + *webview_ret = webview; + + if (editable && (toolbar_ret != NULL)) + *toolbar_ret = toolbar; + + if (sw_ret != NULL) + *sw_ret = sw; + + return frame; +} + void pidgin_set_sensitive_if_input(GtkWidget *entry, GtkWidget *dialog) { diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h index 7ea8563151..25e3631cbf 100644 --- a/pidgin/gtkutils.h +++ b/pidgin/gtkutils.h @@ -108,6 +108,28 @@ void pidgin_setup_imhtml(GtkWidget *imhtml); */ GtkWidget *pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret); +/** + * Create an GtkWebView widget and associated GtkIMHtmlToolbar widget. This + * function puts both widgets in a nice GtkFrame. They're separated by an + * attractive GtkSeparator. + * FIXME: There is no editable GtkWebView yet. + * + * @param editable @c TRUE if this webview should be editable. If this is + * @c FALSE, then the toolbar will NOT be created. If this webview + * should be read-only at first, but may become editable later, then + * pass in @c TRUE here and then manually call gtk_webview_set_editable() + * later. + * @param webview_ret A pointer to a pointer to a GtkWidget. This pointer + * will be set to the webview when this function exits. + * @param toolbar_ret A pointer to a pointer to a GtkWidget. If editable is + * TRUE then this will be set to the toolbar when this function exits. + * Otherwise this will be set to @c NULL. + * @param sw_ret This will be filled with a pointer to the scrolled window + * widget which contains the webview. + * @return The GtkFrame containing the toolbar and webview. + */ +GtkWidget *pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret); + /** * Creates a small button * -- cgit v1.2.1 From 3c4ddfda4429229fe9cb95da9a0f5b1b1ea99efa Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 9 Sep 2011 01:56:54 +0000 Subject: Remove unnecessary line. --- pidgin/gtkutils.c | 1 - 1 file changed, 1 deletion(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index dae34ec0a2..d8653692b1 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -311,7 +311,6 @@ pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **to /* FIXME: Don't have editable webview yet. */ gtk_webview_set_editable(GTK_WEBVIEW(webview), editable); #endif - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(webview), GTK_WRAP_WORD_CHAR); #ifdef USE_GTKSPELL if (editable && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck")) pidgin_setup_gtkspell(GTK_TEXT_VIEW(webview)); -- cgit v1.2.1 From eeaedc2bc8689043cff579e2b8771e5900eb4733 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 9 Sep 2011 01:58:59 +0000 Subject: Fix log viewer by calling pidgin_create_webview. --- pidgin/gtklog.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c index f0ff185e5b..615b172235 100644 --- a/pidgin/gtklog.c +++ b/pidgin/gtklog.c @@ -649,18 +649,11 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_paned_add2(GTK_PANED(pane), vbox); /* Viewer ************/ - /* FIXME: - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - - lv->web_view = gtk_webview_new (); - gtk_container_add (GTK_CONTAINER (sw), lv->web_view); - */ - frame = pidgin_create_imhtml(FALSE, &lv->web_view, NULL, NULL); + frame = pidgin_create_webview(FALSE, &lv->web_view, NULL, NULL); gtk_widget_set_name(lv->web_view, "pidgin_log_web_view"); gtk_widget_set_size_request(lv->web_view, 320, 200); gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); + gtk_widget_show(frame); /* Search box **********/ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); -- cgit v1.2.1 From 79686ee0ca748842c7c74b66811ed82218d10d7d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 9 Sep 2011 02:40:51 +0000 Subject: Use pidgin_create_webview in the gtknotify code. --- pidgin/gtknotify.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 1bbe24ec46..6cde874ae2 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -819,7 +819,7 @@ pidgin_notify_formatted(const char *title, const char *primary, GtkWidget *label; GtkWidget *button; GtkWidget *web_view; - GtkWidget *scrolled_window; + GtkWidget *frame; char label_text[2048]; char *linked_text, *primary_esc, *secondary_esc; @@ -855,17 +855,11 @@ pidgin_notify_formatted(const char *title, const char *primary, gtk_widget_show(label); /* Add the webview */ - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - web_view = gtk_webview_new(); - gtk_container_add(GTK_CONTAINER(scrolled_window), web_view); - + frame = pidgin_create_webview(FALSE, &web_view, NULL, NULL); gtk_widget_set_name(web_view, "pidgin_notify_webview"); gtk_widget_set_size_request(web_view, 300, 250); - gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0); - gtk_widget_show_all(scrolled_window); + gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); + gtk_widget_show(frame); /* Add the Close button. */ button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); @@ -1138,7 +1132,6 @@ pidgin_notify_userinfo(PurpleConnection *gc, const char *who, if (pinfo != NULL) { GtkWidget *webview = g_object_get_data(G_OBJECT(pinfo->window), "webview-widget"); char *linked_text = purple_markup_linkify(info); - g_assert(webview); gtk_webview_load_html_string_with_imgstore(GTK_WEBVIEW(webview), linked_text); g_free(linked_text); g_free(key); -- cgit v1.2.1 From f84ac6ac4c0a0bbf3a1c3fbc87b391eff0051f1f Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Fri, 9 Sep 2011 03:27:52 +0000 Subject: Let webview manage the navigation ONLY if the reason is the user clicked a link. --- pidgin/gtkwebview.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index b1aea12e4f..4b0edea4e4 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -196,9 +196,8 @@ webview_link_clicked(WebKitWebView *view, /* the gtk imhtml way was to create an idle cb, not sure * why, so right now just using purple_notify_uri directly */ purple_notify_uri(NULL, uri); - } - - webkit_web_policy_decision_use(policy_decision); + } else + webkit_web_policy_decision_use(policy_decision); return TRUE; } -- cgit v1.2.1 From 0f23c2d9cdd69d499a02ee4fbdd989b5dead70b5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 9 Sep 2011 03:28:02 +0000 Subject: Use pidgin_create_webview to make the Help dialog. --- pidgin/gtkdialogs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index a77d031a70..8bb734e6fa 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -421,9 +421,8 @@ pidgin_logo_versionize(GdkPixbuf **original, GtkWidget *widget) { static GtkWidget * pidgin_build_help_dialog(const char *title, const char *role, GString *string) { - GtkWidget *win, *vbox, *frame, *logo, *imhtml, *button; + GtkWidget *win, *vbox, *frame, *logo, *webview, *button; GdkPixbuf *pixbuf; - GtkTextIter iter; AtkObject *obj; char *filename, *tmp; @@ -450,15 +449,15 @@ pidgin_build_help_dialog(const char *title, const char *role, GString *string) g_free(tmp); gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); - frame = pidgin_create_imhtml(FALSE, &imhtml, NULL, NULL); + frame = pidgin_create_webview(FALSE, &webview, NULL, NULL); /* FIXME: Compile now and fix it later when we have a proper replacement for this function gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY); */ gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); - gtk_webview_append_html(GTK_WEBVIEW(imhtml), string->str); - gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter); - gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter); + gtk_webview_append_html(GTK_WEBVIEW(webview), string->str); + /* FIXME: This doesn't seem to stay at the top. */ + webkit_web_view_move_cursor(WEBKIT_WEB_VIEW(webview), GTK_MOVEMENT_BUFFER_ENDS, -1); button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, G_CALLBACK(destroy_win), win); -- cgit v1.2.1 From 51eb6ee2b3314d6c4da9199359d2cbd3ec713e3c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 9 Sep 2011 07:00:03 +0000 Subject: Fix searching in conversation windows. --- pidgin/gtkconv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 7ef22fdabf..a661f1e8cc 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -4875,7 +4875,7 @@ pidgin_conv_end_quickfind(PidginConversation *gtkconv) { gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL); - gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->webview)); + webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(gtkconv->webview)); gtk_widget_hide_all(gtkconv->quickfind.container); gtk_widget_grab_focus(gtkconv->entry); @@ -4888,7 +4888,7 @@ quickfind_process_input(GtkWidget *entry, GdkEventKey *event, PidginConversation switch (event->keyval) { case GDK_Return: case GDK_KP_Enter: - if (gtk_imhtml_search_find(GTK_IMHTML(gtkconv->webview), gtk_entry_get_text(GTK_ENTRY(entry)))) { + if (webkit_web_view_search_text(WEBKIT_WEB_VIEW(gtkconv->webview), gtk_entry_get_text(GTK_ENTRY(entry)), FALSE, TRUE, TRUE)) { gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL); } else { GdkColor col; -- cgit v1.2.1 From 90528162fec9a1002b5a9994f28c472f3a25f0c4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 11 Sep 2011 04:50:52 +0000 Subject: Don't attempt to add smileys to a webview by treating it as imhtml. --- pidgin/gtkconv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index a661f1e8cc..5983412187 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6307,6 +6307,13 @@ add_custom_smiley_for_imhtml(GtkIMHtml *imhtml, const char *sml, const char *smi return TRUE; } +static gboolean +add_custom_smiley_for_webview(GtkWebView *webview, const char *sml, const char *smile) +{ + /* FIXME: Smileys need to be added to webkit stuff */ + return TRUE; +} + static gboolean pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gboolean remote) { @@ -6334,7 +6341,7 @@ pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gbool } } - if (!add_custom_smiley_for_imhtml(GTK_IMHTML(gtkconv->webview), sml, smile)) + if (!add_custom_smiley_for_webview(GTK_WEBVIEW(gtkconv->webview), sml, smile)) return FALSE; if (!remote) /* If it's a local custom smiley, then add it for the entry */ -- cgit v1.2.1 From a546b5772b936e34dd49df1a16116e65020f2190 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 11 Sep 2011 04:52:21 +0000 Subject: Don't try to get a tag from a gtkwebview. --- pidgin/gtkconv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 5983412187..9f35ec4d33 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -4047,10 +4047,13 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c g_free(tmp); if (is_me) { +#if 0 + /* FIXME: No tags in webkit stuff, yet. */ GtkTextTag *tag = gtk_text_tag_table_lookup( gtk_text_buffer_get_tag_table(GTK_IMHTML(gtkconv->webview)->text_buffer), "send-name"); g_object_get(tag, "foreground-gdk", &color, NULL); +#endif } else { GtkTextTag *tag; if ((tag = get_buddy_tag(conv, name, 0, FALSE))) -- cgit v1.2.1 From 504b78f814a135d942a260e5ea16c3deb5cc1b40 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Thu, 15 Sep 2011 21:52:28 +0000 Subject: Remove deprecated wpurple_g_access(). --- ChangeLog.API | 1 + libpurple/win32/libc_interface.c | 12 ------------ 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 6b806802fa..0a6de54477 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -163,6 +163,7 @@ version 3.0.0 (??/??/????): * struct _PurpleRoomlist * struct _PurpleRoomlistField * struct _PurpleRoomlistRoom + * wpurple_g_access * xmlnode_set_attrib_with_namespace * xmlnode_set_attrib_with_prefix diff --git a/libpurple/win32/libc_interface.c b/libpurple/win32/libc_interface.c index 5697dd51d1..e6f33c777f 100644 --- a/libpurple/win32/libc_interface.c +++ b/libpurple/win32/libc_interface.c @@ -1041,15 +1041,3 @@ wpurple_get_timezone_abbreviation(const struct tm *tm) purple_debug_warning("wpurple", "could not find a match for Windows timezone \"%s\"\n", tzname); return ""; } - -int wpurple_g_access (const gchar *filename, int mode); -/** - * @deprecated - remove for 3.0.0 - */ -int -wpurple_g_access (const gchar *filename, int mode) -{ - return g_access(filename, mode); -} - - -- cgit v1.2.1 From 744c143219818f4127c2410a0fd022bbd67744c1 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Thu, 15 Sep 2011 21:57:04 +0000 Subject: Remove deprecated purple_ssl_connect_fd(). --- ChangeLog.API | 1 + libpurple/plugins/perl/common/SSLConn.xs | 7 ------- libpurple/sslconn.c | 9 --------- libpurple/sslconn.h | 20 -------------------- 4 files changed, 1 insertion(+), 36 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 0a6de54477..2caa706548 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -132,6 +132,7 @@ version 3.0.0 (??/??/????): * purple_proxy_connect_socks5 * purple_srv_cancel * purple_srv_resolve_account + * purple_ssl_connect_fd * purple_status_set_attr_boolean * purple_status_set_attr_int * purple_status_set_attr_string diff --git a/libpurple/plugins/perl/common/SSLConn.xs b/libpurple/plugins/perl/common/SSLConn.xs index dbc337ca37..3730e80683 100644 --- a/libpurple/plugins/perl/common/SSLConn.xs +++ b/libpurple/plugins/perl/common/SSLConn.xs @@ -16,13 +16,6 @@ purple_ssl_input_add(gsc, func, data) Purple::Ssl::Connection gsc Purple::SslInputFunction func -Purple::Ssl::Connection -purple_ssl_connect_fd(account, fd, func, error_func, data) - Purple::Account account - int fd - PurpleSslInputFunction func - PurpleSslErrorFunction error_func - */ MODULE = Purple::SSL PACKAGE = Purple::SSL PREFIX = purple_ssl_ diff --git a/libpurple/sslconn.c b/libpurple/sslconn.c index e6365d390e..34e4a102f3 100644 --- a/libpurple/sslconn.c +++ b/libpurple/sslconn.c @@ -184,15 +184,6 @@ purple_ssl_strerror(PurpleSslErrorType error) } } -PurpleSslConnection * -purple_ssl_connect_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - void *data) -{ - return purple_ssl_connect_with_host_fd(account, fd, func, error_func, NULL, data); -} - PurpleSslConnection * purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, PurpleSslInputFunction func, diff --git a/libpurple/sslconn.h b/libpurple/sslconn.h index 0bceccd57a..6889289dbd 100644 --- a/libpurple/sslconn.h +++ b/libpurple/sslconn.h @@ -211,26 +211,6 @@ PurpleSslConnection *purple_ssl_connect_with_ssl_cn(PurpleAccount *account, cons const char *ssl_host, void *data); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_SSLCONN_C_) -/** - * Makes a SSL connection using an already open file descriptor. - * - * @deprecated Use purple_ssl_connect_with_host_fd() instead. - * - * @param account The account making the connection. - * @param fd The file descriptor. - * @param func The SSL input handler function. - * @param error_func The SSL error handler function. - * @param data User-defined data. - * - * @return The SSL connection handle. - */ -PurpleSslConnection *purple_ssl_connect_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - void *data); -#endif - /** * Makes a SSL connection using an already open file descriptor. * -- cgit v1.2.1 From 92daa7201d46233cbf4f5ea263b0e21d09eb4b34 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Thu, 15 Sep 2011 22:02:55 +0000 Subject: Remove deprecated purple_request_field_list_add(). --- ChangeLog.API | 1 + libpurple/plugins/perl/common/Request.xs | 6 ------ libpurple/protocols/gg/gg.c | 2 +- libpurple/protocols/mxit/login.c | 4 ++-- libpurple/request.c | 7 ------- libpurple/request.h | 12 ------------ pidgin/gtkblist.c | 2 +- 7 files changed, 5 insertions(+), 29 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 2caa706548..0f1af2e261 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -130,6 +130,7 @@ version 3.0.0 (??/??/????): * purple_presence_add_status * purple_presence_add_list * purple_proxy_connect_socks5 + * purple_request_field_list_add * purple_srv_cancel * purple_srv_resolve_account * purple_ssl_connect_fd diff --git a/libpurple/plugins/perl/common/Request.xs b/libpurple/plugins/perl/common/Request.xs index 499a6756a8..244f1b2db5 100644 --- a/libpurple/plugins/perl/common/Request.xs +++ b/libpurple/plugins/perl/common/Request.xs @@ -373,12 +373,6 @@ purple_request_field_list_new(class, id, text) const char *text C_ARGS: id, text -void -purple_request_field_list_add(field, item, data) - Purple::Request::Field field - const char *item - void * data - void purple_request_field_list_add_icon(field, item, icon_path, data) Purple::Request::Field field diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 079e087405..ac9eaf8f9f 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -857,7 +857,7 @@ static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) field = purple_request_field_list_new("name", "Chat name"); for (l = info->chats; l != NULL; l = l->next) { GGPChat *chat = l->data; - purple_request_field_list_add(field, chat->name, chat->name); + purple_request_field_list_add_icon(field, chat->name, NULL, chat->name); } purple_request_field_group_add_field(group, field); diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index 27a77e6014..7b9b574269 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -656,7 +656,7 @@ static void mxit_cb_clientinfo1( PurpleUtilFetchUrlData* url_data, gpointer user /* oops, this is not good, time to bail */ break; } - purple_request_field_list_add( field, country[1], g_strdup( country[0] ) ); + purple_request_field_list_add_icon( field, country[1], NULL, g_strdup( country[0] ) ); if ( strcmp( country[1], parts[6] ) == 0 ) { /* based on the user's IP, this is his current country code, so we default to it */ purple_request_field_list_add_selected( field, country[1] ); @@ -677,7 +677,7 @@ static void mxit_cb_clientinfo1( PurpleUtilFetchUrlData* url_data, gpointer user /* oops, this is not good, time to bail */ break; } - purple_request_field_list_add( field, locale[1], g_strdup( locale[0] ) ); + purple_request_field_list_add_icon( field, locale[1], NULL, g_strdup( locale[0] ) ); g_strfreev( locale ); } purple_request_field_list_add_selected( field, "English" ); diff --git a/libpurple/request.c b/libpurple/request.c index 3a582dffb6..3331eb19de 100644 --- a/libpurple/request.c +++ b/libpurple/request.c @@ -991,13 +991,6 @@ purple_request_field_list_get_data(const PurpleRequestField *field, return g_hash_table_lookup(field->u.list.item_data, text); } -void -purple_request_field_list_add(PurpleRequestField *field, const char *item, - void *data) -{ - purple_request_field_list_add_icon(field, item, NULL, data); -} - void purple_request_field_list_add_icon(PurpleRequestField *field, const char *item, const char* icon_path, void *data) diff --git a/libpurple/request.h b/libpurple/request.h index 5a9f544ffe..3f095ff611 100644 --- a/libpurple/request.h +++ b/libpurple/request.h @@ -900,18 +900,6 @@ gboolean purple_request_field_list_get_multi_select( void *purple_request_field_list_get_data(const PurpleRequestField *field, const char *text); -/** - * Adds an item to a list field. - * - * @param field The list field. - * @param item The list item. - * @param data The associated data. - * - * @deprecated Use purple_request_field_list_add_icon() instead. - */ -void purple_request_field_list_add(PurpleRequestField *field, - const char *item, void *data); - /** * Adds an item to a list field. * diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 7225298762..68fe5d2cac 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3539,7 +3539,7 @@ set_mood_cb(GtkWidget *widget, PurpleAccount *account) g = purple_request_field_group_new(NULL); f = purple_request_field_list_new("mood", _("Please select your mood from the list")); - purple_request_field_list_add(f, _("None"), ""); + purple_request_field_list_add_icon(f, _("None"), NULL, ""); if (current_mood == NULL) purple_request_field_list_add_selected(f, _("None")); -- cgit v1.2.1 From 9ae585811b5303985dee98d2e6ba602a27210b99 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Thu, 15 Sep 2011 22:22:11 +0000 Subject: Remove deprecated PidginBuddyList.connection_errors. --- ChangeLog.API | 1 + pidgin/gtkblist.c | 32 -------------------------------- pidgin/gtkblist.h | 9 --------- 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 0f1af2e261..6ae98cb091 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -104,6 +104,7 @@ version 3.0.0 (??/??/????): * pidgin_dialogs_alias_contact * pidgin_set_custom_buddy_icon * pidgin_setup_screenname_autocomplete + * PidginBuddyList.connection_errors * PidginConversation.sg * purple_account_add_buddies_with_invite * purple_account_add_buddy_with_invite diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 68fe5d2cac..f698f50145 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -4763,8 +4763,6 @@ static void pidgin_blist_new_list(PurpleBuddyList *blist) PidginBuddyList *gtkblist; gtkblist = g_new0(PidginBuddyList, 1); - gtkblist->connection_errors = g_hash_table_new_full(g_direct_hash, - g_direct_equal, NULL, g_free); gtkblist->priv = g_new0(PidginBuddyListPrivate, 1); blist->ui_data = gtkblist; @@ -5078,7 +5076,6 @@ static void generic_error_destroy_cb(GtkObject *dialog, PurpleAccount *account) { - g_hash_table_remove(gtkblist->connection_errors, account); /* If the error dialog is being destroyed in response to the * account-error-changed signal, we don't want to clear the current * error. @@ -5336,28 +5333,6 @@ update_signed_on_elsewhere_tooltip(PurpleAccount *account, } -/** - * Was used by the connection API to tell the blist if an account has a - * connection error or no longer has a connection error, but the blist now does - * this itself with the @ref account-error-changed signal. - * - * @param account The account that either has a connection error - * or no longer has a connection error. - * @param message The connection error message, or NULL if this - * account is no longer in an error state. - */ -static void -pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text) -{ - /* connection_errors isn't actually used anywhere; it's just kept in - * sync with reality in case a plugin uses it. - */ - if (text == NULL) - g_hash_table_remove(gtkblist->connection_errors, account); - else - g_hash_table_insert(gtkblist->connection_errors, account, g_strdup(text)); -} - /* Call appropriate error notification code based on error types */ static void update_account_error_state(PurpleAccount *account, @@ -5371,12 +5346,6 @@ update_account_error_state(PurpleAccount *account, if (old == NULL && new == NULL) return; - /* For backwards compatibility: */ - if (new) - pidgin_blist_update_account_error_state(account, new->description); - else - pidgin_blist_update_account_error_state(account, NULL); - if (new != NULL) pidgin_blist_select_notebook_page(gtkblist); @@ -6884,7 +6853,6 @@ static void pidgin_blist_destroy(PurpleBuddyList *list) if (gtkblist->drag_timeout) g_source_remove(gtkblist->drag_timeout); - g_hash_table_destroy(gtkblist->connection_errors); gtkblist->refresh_timer = 0; gtkblist->timeout = 0; gtkblist->drag_timeout = 0; diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index 7da86505af..8f22ef1fd8 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -86,15 +86,6 @@ struct _PidginBuddyList { GtkWidget *menutray; /**< The menu tray widget. */ GtkWidget *menutrayicon; /**< The menu tray icon. */ - /** Caches connection error messages; keys are #PurpleAccount and - * values are non-@c NULL const char *s containing localised - * error messages. (If an account does not have an error, it will not - * appear in the table.) - * @deprecated in favour of purple_account_get_current_error(), which also - * gives you the #PurpleConnectionError value. - */ - GHashTable *connection_errors; - guint refresh_timer; /**< The timer for refreshing every 30 seconds */ guint timeout; /**< The timeout for the tooltip. */ -- cgit v1.2.1 From 9c4977fa22c74f0bb54827e4d71147e15eb6f3aa Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Fri, 16 Sep 2011 04:49:17 +0000 Subject: Workaround the bug that causes a crash when closing a gtkwindow. This bug was caused by some data corruption when using the webview as a GtkIMHtml in the smile themes code. --- pidgin/gtkthemes.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pidgin/gtkthemes.c b/pidgin/gtkthemes.c index 5fd22788fd..48a7033fec 100644 --- a/pidgin/gtkthemes.c +++ b/pidgin/gtkthemes.c @@ -122,6 +122,8 @@ void pidgin_themes_remove_smiley_theme(const char *file) static void _pidgin_themes_smiley_themeize(GtkWidget *imhtml, gboolean custom) { + /* FIXME: move imhtml dependency to use webview. */ +#if 0 struct smiley_list *list; if (!current_smiley_theme) return; @@ -147,6 +149,7 @@ static void _pidgin_themes_smiley_themeize(GtkWidget *imhtml, gboolean custom) list = list->next; } +#endif } void pidgin_themes_smiley_themeize(GtkWidget *imhtml) -- cgit v1.2.1 From e98815ab00127433b6a1e252fc9bb33fde41881f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 16 Sep 2011 06:10:04 +0000 Subject: Add a WebKit Development plugin, that allows opening the builtin inspector on a view. To use, activate the plugin, right-click a view, and select 'Inspect Element'. --- pidgin/plugins/Makefile.am | 6 +- pidgin/plugins/webkit.c | 202 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 pidgin/plugins/webkit.c diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index 2c03350da1..04fd49f8d3 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -43,6 +43,7 @@ sendbutton_la_LDFLAGS = -module -avoid-version spellchk_la_LDFLAGS = -module -avoid-version themeedit_la_LDFLAGS = -module -avoid-version vvconfig_la_LDFLAGS = -module -avoid-version +webkit_la_LDFLAGS = -module -avoid-version xmppconsole_la_LDFLAGS = -module -avoid-version if PLUGINS @@ -58,7 +59,8 @@ plugin_LTLIBRARIES = \ relnot.la \ sendbutton.la \ spellchk.la \ - themeedit.la \ + themeedit.la \ + webkit.la \ xmppconsole.la if USE_VV @@ -82,6 +84,7 @@ relnot_la_SOURCES = relnot.c sendbutton_la_SOURCES = sendbutton.c spellchk_la_SOURCES = spellchk.c themeedit_la_SOURCES = themeedit.c themeedit-icon.c themeedit-icon.h +webkit_la_SOURCES = webkit.c xmppconsole_la_SOURCES = xmppconsole.c convcolors_la_LIBADD = $(GTK_LIBS) @@ -97,6 +100,7 @@ relnot_la_LIBADD = $(GLIB_LIBS) sendbutton_la_LIBADD = $(GTK_LIBS) spellchk_la_LIBADD = $(GTK_LIBS) themeedit_la_LIBADD = $(GTK_LIBS) +webkit_la_LIBADD = $(GTK_LIBS) $(WEBKIT_LIBS) xmppconsole_la_LIBADD = $(GTK_LIBS) endif # PLUGINS diff --git a/pidgin/plugins/webkit.c b/pidgin/plugins/webkit.c new file mode 100644 index 0000000000..8872cf380b --- /dev/null +++ b/pidgin/plugins/webkit.c @@ -0,0 +1,202 @@ +/* + * WebKit - Open the inspector on any WebKit views. + * Copyright (C) 2011 Elliott Sales de Andrade + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "internal.h" + +#include "version.h" + +#include "pidgin.h" + +#include "gtkconv.h" +#include "gtkplugin.h" +#include "gtkwebview.h" + +static WebKitWebView * +create_gtk_window_around_it(WebKitWebInspector *inspector, + WebKitWebView *webview, + PidginConversation *gtkconv) +{ + GtkWidget *win; + GtkWidget *view; + char *title; + + win = gtk_window_new(GTK_WINDOW_TOPLEVEL); + title = g_strdup_printf(_("%s - Inspector"), + gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); + gtk_window_set_title(GTK_WINDOW(win), title); + g_free(title); + gtk_window_set_default_size(GTK_WINDOW(win), 600, 400); + + view = webkit_web_view_new(); + gtk_container_add(GTK_CONTAINER(win), view); + g_object_set_data(G_OBJECT(webview), "inspector-window", win); + + return WEBKIT_WEB_VIEW(view); +} + +static gboolean +show_inspector_window(WebKitWebInspector *inspector, + GtkWidget *webview) +{ + GtkWidget *win; + + win = g_object_get_data(G_OBJECT(webview), "inspector-window"); + + gtk_widget_show_all(win); + + return TRUE; +} + +static void +setup_inspector(PidginConversation *gtkconv) +{ + GtkWidget *webview = gtkconv->webview; + WebKitWebSettings *settings; + WebKitWebInspector *inspector; + + settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(webview)); + inspector = webkit_web_view_get_inspector(WEBKIT_WEB_VIEW(webview)); + + g_object_set(G_OBJECT(settings), "enable-developer-extras", TRUE, NULL); + + g_signal_connect(G_OBJECT(inspector), "inspect-web-view", + G_CALLBACK(create_gtk_window_around_it), gtkconv); + g_signal_connect(G_OBJECT(inspector), "show-window", + G_CALLBACK(show_inspector_window), webview); +} + +static void +remove_inspector(PidginConversation *gtkconv) +{ + GtkWidget *webview = gtkconv->webview; + GtkWidget *win; + WebKitWebSettings *settings; + WebKitWebInspector *inspector; + + win = g_object_get_data(G_OBJECT(webview), "inspector-window"); + gtk_widget_destroy(win); + g_object_set_data(G_OBJECT(webview), "inspector-window", NULL); + + settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(webview)); + inspector = webkit_web_view_get_inspector(WEBKIT_WEB_VIEW(webview)); + + g_object_set(G_OBJECT(settings), "enable-developer-extras", FALSE, NULL); +} + +static void +conversation_displayed_cb(PidginConversation *gtkconv) +{ + GtkWidget *inspect = NULL; + + inspect = g_object_get_data(G_OBJECT(gtkconv->webview), + "inspector-window"); + if (inspect == NULL) { + setup_inspector(gtkconv); + } +} + +static gboolean +plugin_load(PurplePlugin *plugin) +{ + GList *convs = purple_get_conversations(); + void *gtk_conv_handle = pidgin_conversations_get_handle(); + + purple_signal_connect(gtk_conv_handle, "conversation-displayed", plugin, + PURPLE_CALLBACK(conversation_displayed_cb), NULL); + + while (convs) { + PurpleConversation *conv = (PurpleConversation *)convs->data; + + /* Setup WebKit Inspector */ + if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { + setup_inspector(PIDGIN_CONVERSATION(conv)); + } + + convs = convs->next; + } + + return TRUE; +} + +static gboolean +plugin_unload(PurplePlugin *plugin) +{ + GList *convs = purple_get_conversations(); + + while (convs) { + PurpleConversation *conv = (PurpleConversation *)convs->data; + + /* Remove WebKit Inspector */ + if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { + remove_inspector(PIDGIN_CONVERSATION(conv)); + } + + convs = convs->next; + } + + return TRUE; +} + +static PurplePluginInfo info = +{ + PURPLE_PLUGIN_MAGIC, + PURPLE_MAJOR_VERSION, /**< major version */ + PURPLE_MINOR_VERSION, /**< minor version */ + PURPLE_PLUGIN_STANDARD, /**< type */ + PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ + 0, /**< flags */ + NULL, /**< dependencies */ + PURPLE_PRIORITY_DEFAULT, /**< priority */ + + "gtkwebkit-inspect", /**< id */ + N_("WebKit Development"), /**< name */ + DISPLAY_VERSION, /**< version */ + N_("Enables WebKit Inspector."), /**< summary */ + N_("Enables WebKit's built-in inspector in a " + "conversation window. This may be viewed " + "by right-clicking a WebKit widget and " + "selecting 'Inspect Element'."), /**< description */ + "Elliott Sales de Andrade ", /**< author */ + PURPLE_WEBSITE, /**< homepage */ + plugin_load, /**< load */ + plugin_unload, /**< unload */ + NULL, /**< destroy */ + NULL, /**< ui_info */ + NULL, /**< extra_info */ + NULL, /**< prefs_info */ + NULL, /**< actions */ + + /* padding */ + NULL, + NULL, + NULL, + NULL +}; + +static void +init_plugin(PurplePlugin *plugin) +{ +} + +PURPLE_INIT_PLUGIN(webkit-devel, init_plugin, info) + -- cgit v1.2.1 From 759efa80f4dcde3724a502c7d727b2d5e46a6264 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 17 Sep 2011 04:51:57 +0000 Subject: Use GObject's instance private data for all the theme GObjects. --- libpurple/sound-theme.c | 6 +++--- libpurple/sound-theme.h | 1 - libpurple/theme-loader.c | 15 ++++----------- libpurple/theme-loader.h | 1 - libpurple/theme.c | 14 ++++---------- libpurple/theme.h | 1 - pidgin/gtkblist-theme.c | 15 ++++----------- pidgin/gtkblist-theme.h | 1 - pidgin/gtkicon-theme.c | 7 +++---- pidgin/gtkicon-theme.h | 1 - 10 files changed, 18 insertions(+), 44 deletions(-) diff --git a/libpurple/sound-theme.c b/libpurple/sound-theme.c index 4918f40758..1f471a3e5c 100644 --- a/libpurple/sound-theme.c +++ b/libpurple/sound-theme.c @@ -24,7 +24,7 @@ #include "sound-theme.h" #define PURPLE_SOUND_THEME_GET_PRIVATE(Gobject) \ - ((PurpleSoundThemePrivate *) ((PURPLE_SOUND_THEME(Gobject))->priv)) + (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PURPLE_TYPE_SOUND_THEME, PurpleSoundThemePrivate)) /****************************************************************************** * Structs @@ -55,8 +55,6 @@ purple_sound_theme_init(GTypeInstance *instance, { PurpleSoundThemePrivate *priv; - (PURPLE_SOUND_THEME(instance))->priv = g_new0(PurpleSoundThemePrivate, 1); - priv = PURPLE_SOUND_THEME_GET_PRIVATE(instance); priv->sound_files = g_hash_table_new_full(g_str_hash, @@ -82,6 +80,8 @@ purple_sound_theme_class_init(PurpleSoundThemeClass *klass) parent_class = g_type_class_peek_parent(klass); + g_type_class_add_private(klass, sizeof(PurpleSoundThemePrivate)); + obj_class->finalize = purple_sound_theme_finalize; } diff --git a/libpurple/sound-theme.h b/libpurple/sound-theme.h index 3814e4527f..adde4fddea 100644 --- a/libpurple/sound-theme.h +++ b/libpurple/sound-theme.h @@ -51,7 +51,6 @@ typedef struct _PurpleSoundThemeClass PurpleSoundThemeClass; struct _PurpleSoundTheme { PurpleTheme parent; - gpointer priv; }; struct _PurpleSoundThemeClass diff --git a/libpurple/theme-loader.c b/libpurple/theme-loader.c index e9b4a3ba9a..466ee90998 100644 --- a/libpurple/theme-loader.c +++ b/libpurple/theme-loader.c @@ -24,7 +24,7 @@ #include "theme-loader.h" #define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \ - ((PurpleThemeLoaderPrivate *) ((PurpleThemeLoader)->priv)) + (G_TYPE_INSTANCE_GET_PRIVATE((PurpleThemeLoader), PURPLE_TYPE_THEME_LOADER, PurpleThemeLoaderPrivate)) void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type); @@ -85,14 +85,6 @@ purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *val } } -static void -purple_theme_loader_init(GTypeInstance *instance, - gpointer klass) -{ - PurpleThemeLoader *loader = PURPLE_THEME_LOADER(instance); - loader->priv = g_new0(PurpleThemeLoaderPrivate, 1); -} - static void purple_theme_loader_finalize(GObject *obj) { @@ -100,7 +92,6 @@ purple_theme_loader_finalize(GObject *obj) PurpleThemeLoaderPrivate *priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader); g_free(priv->type); - g_free(priv); parent_class->finalize(obj); } @@ -113,6 +104,8 @@ purple_theme_loader_class_init(PurpleThemeLoaderClass *klass) parent_class = g_type_class_peek_parent(klass); + g_type_class_add_private(klass, sizeof(PurpleThemeLoaderPrivate)); + obj_class->get_property = purple_theme_loader_get_property; obj_class->set_property = purple_theme_loader_set_property; obj_class->finalize = purple_theme_loader_finalize; @@ -139,7 +132,7 @@ purple_theme_loader_get_type(void) NULL, /* class_data */ sizeof(PurpleThemeLoader), 0, /* n_preallocs */ - purple_theme_loader_init, /* instance_init */ + NULL, /* instance_init */ NULL, /* value table */ }; type = g_type_register_static(G_TYPE_OBJECT, diff --git a/libpurple/theme-loader.h b/libpurple/theme-loader.h index bf76b38920..6dfa39dc90 100644 --- a/libpurple/theme-loader.h +++ b/libpurple/theme-loader.h @@ -50,7 +50,6 @@ typedef struct _PurpleThemeLoaderClass PurpleThemeLoaderClass; struct _PurpleThemeLoader { GObject parent; - gpointer priv; }; struct _PurpleThemeLoaderClass diff --git a/libpurple/theme.c b/libpurple/theme.c index c21e71a053..cf3bc36985 100644 --- a/libpurple/theme.c +++ b/libpurple/theme.c @@ -25,7 +25,7 @@ #include "util.h" #define PURPLE_THEME_GET_PRIVATE(PurpleTheme) \ - ((PurpleThemePrivate *) ((PurpleTheme)->priv)) + (G_TYPE_INSTANCE_GET_PRIVATE((PurpleTheme), PURPLE_TYPE_THEME, PurpleThemePrivate)) void purple_theme_set_type_string(PurpleTheme *theme, const gchar *type); @@ -128,14 +128,6 @@ purple_theme_set_property(GObject *obj, guint param_id, const GValue *value, } } -static void -purple_theme_init(GTypeInstance *instance, - gpointer klass) -{ - PurpleTheme *theme = PURPLE_THEME(instance); - theme->priv = g_new0(PurpleThemePrivate, 1); -} - static void purple_theme_finalize(GObject *obj) { @@ -160,6 +152,8 @@ purple_theme_class_init(PurpleThemeClass *klass) parent_class = g_type_class_peek_parent(klass); + g_type_class_add_private(klass, sizeof(PurpleThemePrivate)); + obj_class->get_property = purple_theme_get_property; obj_class->set_property = purple_theme_set_property; obj_class->finalize = purple_theme_finalize; @@ -222,7 +216,7 @@ purple_theme_get_type(void) NULL, /* class_data */ sizeof(PurpleTheme), 0, /* n_preallocs */ - purple_theme_init, /* instance_init */ + NULL, /* instance_init */ NULL, /* value table */ }; type = g_type_register_static (G_TYPE_OBJECT, diff --git a/libpurple/theme.h b/libpurple/theme.h index e6ffa130e5..9f4b0bc8f1 100644 --- a/libpurple/theme.h +++ b/libpurple/theme.h @@ -49,7 +49,6 @@ typedef struct _PurpleThemeClass PurpleThemeClass; struct _PurpleTheme { GObject parent; - gpointer priv; }; struct _PurpleThemeClass diff --git a/pidgin/gtkblist-theme.c b/pidgin/gtkblist-theme.c index 83585aa0bd..50a4720822 100644 --- a/pidgin/gtkblist-theme.c +++ b/pidgin/gtkblist-theme.c @@ -24,7 +24,7 @@ #include "gtkblist-theme.h" #define PIDGIN_BLIST_THEME_GET_PRIVATE(Gobject) \ - ((PidginBlistThemePrivate *) ((PIDGIN_BLIST_THEME(Gobject))->priv)) + (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_BLIST_THEME, PidginBlistThemePrivate)) /****************************************************************************** * Structs @@ -188,13 +188,6 @@ pidgin_theme_font_get_color_describe(PidginThemeFont *font) * GObject Stuff *****************************************************************************/ -static void -pidgin_blist_theme_init(GTypeInstance *instance, - gpointer klass) -{ - (PIDGIN_BLIST_THEME(instance))->priv = g_new0(PidginBlistThemePrivate, 1); -} - static void pidgin_blist_theme_get_property(GObject *obj, guint param_id, GValue *value, GParamSpec *psec) @@ -349,8 +342,6 @@ pidgin_blist_theme_finalize(GObject *obj) pidgin_theme_font_free(priv->message_nick_said); pidgin_theme_font_free(priv->status); - g_free(priv); - parent_class->finalize (obj); } @@ -362,6 +353,8 @@ pidgin_blist_theme_class_init(PidginBlistThemeClass *klass) parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private(klass, sizeof(PidginBlistThemePrivate)); + obj_class->get_property = pidgin_blist_theme_get_property; obj_class->set_property = pidgin_blist_theme_set_property; obj_class->finalize = pidgin_blist_theme_finalize; @@ -484,7 +477,7 @@ pidgin_blist_theme_get_type (void) NULL, /* class_data */ sizeof(PidginBlistTheme), 0, /* n_preallocs */ - pidgin_blist_theme_init, /* instance_init */ + NULL, /* instance_init */ NULL, /* value table */ }; type = g_type_register_static (PURPLE_TYPE_THEME, diff --git a/pidgin/gtkblist-theme.h b/pidgin/gtkblist-theme.h index 2c4fb07fb0..db5c6fb9be 100644 --- a/pidgin/gtkblist-theme.h +++ b/pidgin/gtkblist-theme.h @@ -51,7 +51,6 @@ typedef struct _PidginBlistThemeClass PidginBlistThemeClass; struct _PidginBlistTheme { PurpleTheme parent; - gpointer priv; }; struct _PidginBlistThemeClass diff --git a/pidgin/gtkicon-theme.c b/pidgin/gtkicon-theme.c index feca1dd7ef..b669d93522 100644 --- a/pidgin/gtkicon-theme.c +++ b/pidgin/gtkicon-theme.c @@ -26,7 +26,7 @@ #include #define PIDGIN_ICON_THEME_GET_PRIVATE(Gobject) \ - ((PidginIconThemePrivate *) ((PIDGIN_ICON_THEME(Gobject))->priv)) + (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_ICON_THEME, PidginIconThemePrivate)) /****************************************************************************** * Structs @@ -53,8 +53,6 @@ pidgin_icon_theme_init(GTypeInstance *instance, { PidginIconThemePrivate *priv; - (PIDGIN_ICON_THEME(instance))->priv = g_new0(PidginIconThemePrivate, 1); - priv = PIDGIN_ICON_THEME_GET_PRIVATE(instance); priv->icon_files = g_hash_table_new_full(g_str_hash, @@ -69,7 +67,6 @@ pidgin_icon_theme_finalize(GObject *obj) priv = PIDGIN_ICON_THEME_GET_PRIVATE(obj); g_hash_table_destroy(priv->icon_files); - g_free(priv); parent_class->finalize(obj); } @@ -82,6 +79,8 @@ pidgin_icon_theme_class_init(PidginIconThemeClass *klass) parent_class = g_type_class_peek_parent(klass); obj_class->finalize = pidgin_icon_theme_finalize; + + g_type_class_add_private(klass, sizeof(PidginIconThemePrivate)); } GType diff --git a/pidgin/gtkicon-theme.h b/pidgin/gtkicon-theme.h index ce67048ba8..18d0d24497 100644 --- a/pidgin/gtkicon-theme.h +++ b/pidgin/gtkicon-theme.h @@ -50,7 +50,6 @@ typedef struct _PidginIconThemeClass PidginIconThemeClass; struct _PidginIconTheme { PurpleTheme parent; - gpointer priv; }; struct _PidginIconThemeClass -- cgit v1.2.1 From 779e1047eef18f68ff1bb5bae5825bf5bfaf44b0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 17 Sep 2011 05:27:30 +0000 Subject: Add some boilerplate Conversation theme GObjects. These don't do anything yet, and aren't used either. --- pidgin/Makefile.am | 4 ++ pidgin/gtkconv-theme-loader.c | 79 +++++++++++++++++++++++++++++++ pidgin/gtkconv-theme-loader.h | 72 ++++++++++++++++++++++++++++ pidgin/gtkconv-theme.c | 107 ++++++++++++++++++++++++++++++++++++++++++ pidgin/gtkconv-theme.h | 73 ++++++++++++++++++++++++++++ 5 files changed, 335 insertions(+) create mode 100644 pidgin/gtkconv-theme-loader.c create mode 100644 pidgin/gtkconv-theme-loader.h create mode 100644 pidgin/gtkconv-theme.c create mode 100644 pidgin/gtkconv-theme.h diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index 4cc5d4f282..54408a7f27 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -48,6 +48,8 @@ pidgin_SOURCES = \ gtkcertmgr.c \ gtkconn.c \ gtkconv.c \ + gtkconv-theme.c \ + gtkconv-theme-loader.c \ gtkdebug.c \ gtkdialogs.c \ gtkdnd-hints.c \ @@ -99,6 +101,8 @@ pidgin_headers = \ gtkconn.h \ gtkconv.h \ gtkconvwin.h \ + gtkconv-theme.h \ + gtkconv-theme-loader.h \ gtkdebug.h \ gtkdialogs.h \ gtkdnd-hints.h \ diff --git a/pidgin/gtkconv-theme-loader.c b/pidgin/gtkconv-theme-loader.c new file mode 100644 index 0000000000..671da7842d --- /dev/null +++ b/pidgin/gtkconv-theme-loader.c @@ -0,0 +1,79 @@ +/* + * PidginConvThemeLoader for Pidgin + * + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include "gtkconv-theme-loader.h" +#include "gtkconv-theme.h" + +#include "xmlnode.h" +#include "debug.h" + +/***************************************************************************** + * Conversation Theme Builder + *****************************************************************************/ + +static PurpleTheme * +pidgin_conv_loader_build(const gchar *dir) +{ + PidginConvTheme *theme = NULL; + + /* Find the theme file */ + g_return_val_if_fail(dir != NULL, NULL); + + return PURPLE_THEME(theme); +} + +/****************************************************************************** + * GObject Stuff + *****************************************************************************/ + +static void +pidgin_conv_theme_loader_class_init(PidginConvThemeLoaderClass *klass) +{ + PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); + + loader_klass->purple_theme_loader_build = pidgin_conv_loader_build; +} + + +GType +pidgin_conversation_theme_loader_get_type(void) +{ + static GType type = 0; + if (type == 0) { + static const GTypeInfo info = { + sizeof(PidginConvThemeLoaderClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)pidgin_conv_theme_loader_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PidginConvThemeLoader), + 0, /* n_preallocs */ + NULL, /* instance_init */ + NULL, /* value table */ + }; + type = g_type_register_static(PURPLE_TYPE_THEME_LOADER, + "PidginConvThemeLoader", &info, 0); + } + return type; +} + diff --git a/pidgin/gtkconv-theme-loader.h b/pidgin/gtkconv-theme-loader.h new file mode 100644 index 0000000000..09bdb75134 --- /dev/null +++ b/pidgin/gtkconv-theme-loader.h @@ -0,0 +1,72 @@ +/** + * @file gtkconv-theme-loader.h Pidgin Conversation Theme Loader Class API + */ + +/* purple + * + * Purple is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#ifndef PIDGIN_CONV_THEME_LOADER_H +#define PIDGIN_CONV_THEME_LOADER_H + +#include +#include +#include "theme-loader.h" + +/** + * A pidgin conversation theme loader. Extends PurpleThemeLoader (theme-loader.h) + * This is a class designed to build conversation themes + * + * PidginConvThemeLoader is a GObject. + */ +typedef struct _PidginConvThemeLoader PidginConvThemeLoader; +typedef struct _PidginConvThemeLoaderClass PidginConvThemeLoaderClass; + +#define PIDGIN_TYPE_CONV_THEME_LOADER (pidgin_conversation_theme_loader_get_type ()) +#define PIDGIN_CONV_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_CONV_THEME_LOADER, PidginConvThemeLoader)) +#define PIDGIN_CONV_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_CONV_THEME_LOADER, PidginConvThemeLoaderClass)) +#define PIDGIN_IS_CONV_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_CONV_THEME_LOADER)) +#define PIDGIN_IS_CONV_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_CONV_THEME_LOADER)) +#define PIDGIN_CONV_THEME_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_CONV_THEME_LOADER, PidginConvThemeLoaderClass)) + +struct _PidginConvThemeLoader +{ + PurpleThemeLoader parent; +}; + +struct _PidginConvThemeLoaderClass +{ + PurpleThemeLoaderClass parent_class; +}; + +/**************************************************************************/ +/** @name Pidgin Conversation Theme-Loader API */ +/**************************************************************************/ +G_BEGIN_DECLS + +/** + * GObject foo. + * @internal. + */ +GType pidgin_conversation_theme_loader_get_type(void); + +G_END_DECLS +#endif /* PIDGIN_CONV_THEME_LOADER_H */ + diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c new file mode 100644 index 0000000000..a664374c68 --- /dev/null +++ b/pidgin/gtkconv-theme.c @@ -0,0 +1,107 @@ +/* + * Conversation Themes for Pidgin + * + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include "gtkconv-theme.h" +#include "pidginstock.h" + +#include + +#define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \ + (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate)) + +/****************************************************************************** + * Structs + *****************************************************************************/ + +typedef struct { + /* Boilerplate... */ + gpointer unused; +} PidginConvThemePrivate; + +/****************************************************************************** + * Globals + *****************************************************************************/ + +static GObjectClass *parent_class = NULL; + +/****************************************************************************** + * GObject Stuff + *****************************************************************************/ + +static void +pidgin_conv_theme_init(GTypeInstance *instance, + gpointer klass) +{ + PidginConvThemePrivate *priv; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(instance); + + priv->unused = NULL; /* Boilerplate... */ +} + +static void +pidgin_conv_theme_finalize(GObject *obj) +{ + PidginConvThemePrivate *priv; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj); + + parent_class->finalize(obj); +} + +static void +pidgin_conv_theme_class_init(PidginIconThemeClass *klass) +{ + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + + parent_class = g_type_class_peek_parent(klass); + + obj_class->finalize = pidgin_conv_theme_finalize; +} + +GType +pidgin_conversation_theme_get_type(void) +{ + static GType type = 0; + if (type == 0) { + static const GTypeInfo info = { + sizeof(PidginConvThemeClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)pidgin_conv_theme_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(PidginConvTheme), + 0, /* n_preallocs */ + pidgin_conv_theme_init, /* instance_init */ + NULL, /* value table */ + }; + type = g_type_register_static(PURPLE_TYPE_THEME, + "PidginConvTheme", &info, G_TYPE_FLAG_ABSTRACT); + } + return type; +} + +/***************************************************************************** + * Public API functions + *****************************************************************************/ + diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h new file mode 100644 index 0000000000..185c8d60b8 --- /dev/null +++ b/pidgin/gtkconv-theme.h @@ -0,0 +1,73 @@ +/** + * @file gtkconv-theme.h Pidgin Conversation Theme Class API + */ + +/* pidgin + * + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#ifndef PIDGIN_CONV_THEME_H +#define PIDGIN_CONV_THEME_H + +#include +#include +#include "theme.h" + +/** + * extends PurpleTheme (theme.h) + * A pidgin icon theme. + * This object represents a Pidgin icon theme. + * + * PidginConvTheme is a PurpleTheme Object. + */ +typedef struct _PidginConvTheme PidginConvTheme; +typedef struct _PidginConvThemeClass PidginConvThemeClass; + +#define PIDGIN_TYPE_CONV_THEME (pidgin_conversation_theme_get_type ()) +#define PIDGIN_CONV_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_CONV_THEME, PidginConvTheme)) +#define PIDGIN_CONV_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_CONV_THEME, PidginConvThemeClass)) +#define PIDGIN_IS_CONV_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_CONV_THEME)) +#define PIDGIN_IS_CONV_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_CONV_THEME)) +#define PIDGIN_CONV_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_CONV_THEME, PidginConvThemeClass)) + +struct _PidginConvTheme +{ + PurpleTheme parent; +}; + +struct _PidginConvThemeClass +{ + PurpleThemeClass parent_class; +}; + +/**************************************************************************/ +/** @name Pidgin Conversation Theme API */ +/**************************************************************************/ +G_BEGIN_DECLS + +/** + * GObject foo. + * @internal. + */ +GType pidgin_conversation_theme_get_type(void); + +G_END_DECLS +#endif /* PIDGIN_CONV_THEME_H */ + -- cgit v1.2.1 From 52de78b308e9d51a91fa88cf6e1446d5d4ee507b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 17 Sep 2011 05:28:48 +0000 Subject: Add source files to Windows build. --- pidgin/Makefile.mingw | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pidgin/Makefile.mingw b/pidgin/Makefile.mingw index 006ea4d5e7..7c6488e130 100644 --- a/pidgin/Makefile.mingw +++ b/pidgin/Makefile.mingw @@ -58,6 +58,8 @@ PIDGIN_C_SRC = \ gtkcertmgr.c \ gtkconn.c \ gtkconv.c \ + gtkconv-theme.c \ + gtkconv-theme-loader.c \ gtkdebug.c \ gtkdialogs.c \ gtkdnd-hints.c \ -- cgit v1.2.1 From 3c1dfa9d42aee9ec6face56be8ed2b4fd1ef1fcc Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 17 Sep 2011 05:43:58 +0000 Subject: All this G_OBJECT() casting is quite unnecessary. --- pidgin/gtkblist-theme.c | 64 ++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/pidgin/gtkblist-theme.c b/pidgin/gtkblist-theme.c index 50a4720822..cb034bfb2e 100644 --- a/pidgin/gtkblist-theme.c +++ b/pidgin/gtkblist-theme.c @@ -500,7 +500,7 @@ pidgin_blist_theme_get_background_color(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->bgcolor; } @@ -512,7 +512,7 @@ pidgin_blist_theme_get_opacity(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), 1.0); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->opacity; } @@ -524,7 +524,7 @@ pidgin_blist_theme_get_layout(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->layout; } @@ -536,7 +536,7 @@ pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->expanded_color; } @@ -548,7 +548,7 @@ pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->expanded; } @@ -560,7 +560,7 @@ pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->collapsed_color; } @@ -572,7 +572,7 @@ pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->collapsed; } @@ -584,7 +584,7 @@ pidgin_blist_theme_get_contact_color(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->contact_color; } @@ -596,7 +596,7 @@ pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->contact; } @@ -608,7 +608,7 @@ pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->online; } @@ -620,7 +620,7 @@ pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->away; } @@ -632,7 +632,7 @@ pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->offline; } @@ -644,7 +644,7 @@ pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->idle; } @@ -656,7 +656,7 @@ pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->message; } @@ -668,7 +668,7 @@ pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme *them g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->message_nick_said; } @@ -680,7 +680,7 @@ pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->status; } @@ -693,7 +693,7 @@ pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, const GdkColor g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); if (priv->bgcolor) gdk_color_free(priv->bgcolor); @@ -707,7 +707,7 @@ pidgin_blist_theme_set_opacity(PidginBlistTheme *theme, gdouble opacity) g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme) || opacity < 0.0 || opacity > 1.0); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); priv->opacity = opacity; } @@ -719,7 +719,7 @@ pidgin_blist_theme_set_layout(PidginBlistTheme *theme, const PidginBlistLayout * g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); g_free(priv->layout); priv->layout = g_memdup(layout, sizeof(PidginBlistLayout)); @@ -732,7 +732,7 @@ pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, const g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); if (priv->expanded_color) gdk_color_free(priv->expanded_color); @@ -746,7 +746,7 @@ pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, const PidginT g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->expanded); priv->expanded = copy_font_and_color(pair); @@ -759,7 +759,7 @@ pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, const g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); if (priv->collapsed_color) gdk_color_free(priv->collapsed_color); @@ -773,7 +773,7 @@ pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, const Pidgin g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->collapsed); priv->collapsed = copy_font_and_color(pair); @@ -786,7 +786,7 @@ pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, const GdkColor *co g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); if (priv->contact_color) gdk_color_free(priv->contact_color); @@ -800,7 +800,7 @@ pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, const PidginTh g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->contact); priv->contact = copy_font_and_color(pair); @@ -813,7 +813,7 @@ pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, const PidginThe g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->online); priv->online = copy_font_and_color(pair); @@ -826,7 +826,7 @@ pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, const PidginTheme g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->away); priv->away = copy_font_and_color(pair); @@ -839,7 +839,7 @@ pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, const PidginTh g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->offline); priv->offline = copy_font_and_color(pair); @@ -852,7 +852,7 @@ pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, const PidginTheme g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->idle); priv->idle = copy_font_and_color(pair); @@ -865,7 +865,7 @@ pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, const P g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->message); priv->message = copy_font_and_color(pair); @@ -878,7 +878,7 @@ pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme *them g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->message_nick_said); priv->message_nick_said = copy_font_and_color(pair); @@ -891,7 +891,7 @@ pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, const PidginThe g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->status); priv->status = copy_font_and_color(pair); -- cgit v1.2.1 From dd2f7c3f70a57ff6cd26c7594cd25ecaa65b1143 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 17 Sep 2011 06:14:59 +0000 Subject: Fix small typo and remove unnecessary include. --- pidgin/gtkconv-theme.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index a664374c68..5c8705f770 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -21,7 +21,6 @@ */ #include "gtkconv-theme.h" -#include "pidginstock.h" #include @@ -69,7 +68,7 @@ pidgin_conv_theme_finalize(GObject *obj) } static void -pidgin_conv_theme_class_init(PidginIconThemeClass *klass) +pidgin_conv_theme_class_init(PidginConvThemeClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS(klass); -- cgit v1.2.1 From 4d863ea23091fe61868367ea2bddca2694f1fb8c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 17 Sep 2011 06:27:35 +0000 Subject: Attempt to move the message style object from the plugin into the new PurpleConvTheme GObject. This is probably not yet abstracted correctly as I don't quite understand how the ThemeLoader bit fits into it all. --- pidgin/gtkconv-theme.c | 469 ++++++++++++++++++++++++++++++++++++++++++++++++- pidgin/gtkconv-theme.h | 10 ++ 2 files changed, 475 insertions(+), 4 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 5c8705f770..3eb01ab04b 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -22,8 +22,15 @@ #include "gtkconv-theme.h" +#include "debug.h" +#include "prefs.h" +#include "xmlnode.h" + #include +#include +#include + #define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \ (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate)) @@ -32,8 +39,41 @@ *****************************************************************************/ typedef struct { - /* Boilerplate... */ - gpointer unused; + /* current config options */ + char *variant; /* allowed to be NULL if there are no variants */ + + /* Info.plist keys that change with Variant */ + + /* Static Info.plist keys */ + int message_view_version; + char *cf_bundle_name; + char *cf_bundle_identifier; + char *cf_bundle_get_info_string; + char *default_font_family; + int default_font_size; + gboolean shows_user_icons; + gboolean disable_combine_consecutive; + gboolean default_background_is_transparent; + gboolean disable_custom_background; + char *default_background_color; + gboolean allow_text_colors; + char *image_mask; + char *default_variant; + + /* paths */ + char *style_dir; + char *template_path; + + /* caches */ + char *template_html; + char *header_html; + char *footer_html; + char *incoming_content_html; + char *outgoing_content_html; + char *incoming_next_content_html; + char *outgoing_next_content_html; + char *status_html; + char *basestyle_css; } PidginConvThemePrivate; /****************************************************************************** @@ -53,8 +93,6 @@ pidgin_conv_theme_init(GTypeInstance *instance, PidginConvThemePrivate *priv; priv = PIDGIN_CONV_THEME_GET_PRIVATE(instance); - - priv->unused = NULL; /* Boilerplate... */ } static void @@ -64,6 +102,24 @@ pidgin_conv_theme_finalize(GObject *obj) priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj); + g_free(priv->cf_bundle_name); + g_free(priv->cf_bundle_identifier); + g_free(priv->cf_bundle_get_info_string); + g_free(priv->default_font_family); + g_free(priv->default_background_color); + g_free(priv->image_mask); + g_free(priv->default_variant); + + g_free(priv->style_dir); + g_free(priv->template_path); + + g_free(priv->template_html); + g_free(priv->incoming_content_html); + g_free(priv->outgoing_content_html); + g_free(priv->outgoing_next_content_html); + g_free(priv->status_html); + g_free(priv->basestyle_css); + parent_class->finalize(obj); } @@ -104,3 +160,408 @@ pidgin_conversation_theme_get_type(void) * Public API functions *****************************************************************************/ +static PidginConvTheme * +pidgin_conversation_theme_new(const char *styledir) +{ + PidginConvTheme *ret = g_object_new(PIDGIN_TYPE_CONV_THEME, NULL); + PidginConvThemePrivate *priv; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(ret); + priv->style_dir = g_strdup(styledir); + + return ret; +} + +void +pidgin_conversation_theme_save_state(const PidginConvTheme *theme) +{ + PidginConvThemePrivate *priv; + char *prefname; + char *variant; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", priv->cf_bundle_identifier); + variant = g_strdup_printf("%s/variant", prefname); + + purple_debug_info("webkit", "saving state with variant %s\n", priv->variant); + purple_prefs_add_none(prefname); + purple_prefs_add_string(variant, ""); + purple_prefs_set_string(variant, priv->variant); + + g_free(prefname); + g_free(variant); +} + +static void +pidgin_conversation_theme_load_state(PidginConvTheme *theme) +{ + PidginConvThemePrivate *priv; + char *prefname; + char *variant; + const char* value; + gboolean changed; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", priv->cf_bundle_identifier); + variant = g_strdup_printf("%s/variant", prefname); + + value = purple_prefs_get_string(variant); + changed = !priv->variant || !g_str_equal(priv->variant, value); + + g_free(priv->variant); + priv->variant = g_strdup(value); + + if (changed) + pidgin_conversation_theme_read_info_plist(theme, priv->variant); + + g_free(prefname); + g_free(variant); +} + + +static gboolean +parse_info_plist_key_value(xmlnode *key, gpointer destination, const char *expected) +{ + xmlnode *val = key->next; + + for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next) + ; + if (!val) + return FALSE; + + if (expected == NULL || g_str_equal(expected, "string")) { + char **dest = (char **)destination; + if (!g_str_equal(val->name, "string")) + return FALSE; + if (*dest) + g_free(*dest); + *dest = xmlnode_get_data_unescaped(val); + } else if (g_str_equal(expected, "integer")) { + int *dest = (int *)destination; + char *value = xmlnode_get_data_unescaped(val); + + if (!g_str_equal(val->name, "integer")) + return FALSE; + *dest = atoi(value); + g_free(value); + } else if (g_str_equal(expected, "boolean")) { + gboolean *dest = (gboolean *)destination; + if (g_str_equal(val->name, "true")) + *dest = TRUE; + else if (g_str_equal(val->name, "false")) + *dest = FALSE; + else + return FALSE; + } else return FALSE; + + return TRUE; +} + +static gboolean +str_for_key(const char *key, const char *found, const char *variant) +{ + if (g_str_equal(key, found)) + return TRUE; + if (!variant) + return FALSE; + return (g_str_has_prefix(found, key) + && g_str_has_suffix(found, variant) + && strlen(found) == strlen(key) + strlen(variant) + 1); +} + +/** + * Info.plist should be re-read every time the variant changes, this is because + * the keys that take precedence depend on the value of the current variant. + */ +void +pidgin_conversation_theme_read_info_plist(PidginConvTheme *theme, const char *variant) +{ + PidginConvThemePrivate *priv; + char *contents; + xmlnode *plist, *iter; + xmlnode *dict; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + /* note that if a variant is used the option:VARIANTNAME takes precedence */ + contents = g_build_filename(priv->style_dir, "Contents", NULL); + plist = xmlnode_from_file(contents, "Info.plist", "Info.plist", "webkit"); + dict = xmlnode_get_child(plist, "dict"); + + g_assert (dict); + for (iter = xmlnode_get_child(dict, "key"); iter; iter = xmlnode_get_next_twin(iter)) { + char* key = xmlnode_get_data_unescaped(iter); + gboolean pr = TRUE; + + if (g_str_equal("MessageViewVersion", key)) + pr = parse_info_plist_key_value(iter, &priv->message_view_version, "integer"); + else if (g_str_equal("CFBundleName", key)) + pr = parse_info_plist_key_value(iter, &priv->cf_bundle_name, "string"); + else if (g_str_equal("CFBundleIdentifier", key)) + pr = parse_info_plist_key_value(iter, &priv->cf_bundle_identifier, "string"); + else if (g_str_equal("CFBundleGetInfoString", key)) + pr = parse_info_plist_key_value(iter, &priv->cf_bundle_get_info_string, "string"); + else if (str_for_key("DefaultFontFamily", key, variant)) + pr = parse_info_plist_key_value(iter, &priv->default_font_family, "string"); + else if (str_for_key("DefaultFontSize", key, variant)) + pr = parse_info_plist_key_value(iter, &priv->default_font_size, "integer"); + else if (str_for_key("ShowsUserIcons", key, variant)) + pr = parse_info_plist_key_value(iter, &priv->shows_user_icons, "boolean"); + else if (str_for_key("DisableCombineConsecutive", key, variant)) + pr = parse_info_plist_key_value(iter, &priv->disable_combine_consecutive, "boolean"); + else if (str_for_key("DefaultBackgroundIsTransparent", key, variant)) + pr = parse_info_plist_key_value(iter, &priv->default_background_is_transparent, "boolean"); + else if (str_for_key("DisableCustomBackground", key, variant)) + pr = parse_info_plist_key_value(iter, &priv->disable_custom_background, "boolean"); + else if (str_for_key("DefaultBackgroundColor", key, variant)) + pr = parse_info_plist_key_value(iter, &priv->default_background_color, "string"); + else if (str_for_key("AllowTextColors", key, variant)) + pr = parse_info_plist_key_value(iter, &priv->allow_text_colors, "integer"); + else if (str_for_key("ImageMask", key, variant)) + pr = parse_info_plist_key_value(iter, &priv->image_mask, "string"); + + if (!pr) + purple_debug_warning("webkit", "Failed to parse key %s\n", key); + g_free(key); + } + + xmlnode_free(plist); +} + +PidginConvTheme * +pidgin_conversation_theme_load(const char *styledir) +{ + /* + * the loading process described: + * + * First we load all the style .html files, etc. + * The we load any config options that have been stored for + * this variant. + * Then we load the Info.plist, for the currently decided variant. + * At this point, if we find that variants exist, yet + * we don't have a variant selected, we choose DefaultVariant + * and if that does not exist, we choose the first one in the + * directory. + */ + char *file; + PidginConvTheme *theme = NULL; + PidginConvThemePrivate *priv; + + theme = pidgin_conversation_theme_new(styledir); + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + /* load all other files */ + + /* The template path can either come from the theme, or can + * be stock Template.html that comes with the plugin */ + priv->template_path = g_build_filename(styledir, "Contents", "Resources", "Template.html", NULL); + + if (!g_file_test(priv->template_path, G_FILE_TEST_EXISTS)) { + g_free(priv->template_path); + priv->template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); + } + + if (!g_file_get_contents(priv->template_path, &priv->template_html, NULL, NULL)) { + purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", priv->template_path); + g_object_unref(G_OBJECT(theme)); + return NULL; + } + + file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL); + if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { + purple_debug_info("webkit", "%s could not find Resources/Status.html", styledir); + g_object_unref(G_OBJECT(theme)); + g_free(file); + return NULL; + } + g_free(file); + + file = g_build_filename(styledir, "Contents", "Resources", "main.css", NULL); + if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL)) + priv->basestyle_css = g_strdup(""); + g_free(file); + + file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL); + if (!g_file_get_contents(file, &priv->header_html, NULL, NULL)) + priv->header_html = g_strdup(""); + g_free(file); + + file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL); + if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL)) + priv->footer_html = g_strdup(""); + g_free(file); + + file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); + if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) { + purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", styledir); + g_object_unref(G_OBJECT(theme)); + g_free(file); + return NULL; + } + g_free(file); + + + /* according to the spec, the following are optional files */ + file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); + if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) { + priv->incoming_next_content_html = g_strdup(priv->incoming_content_html); + } + g_free(file); + + file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "Content.html", NULL); + if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) { + priv->outgoing_content_html = g_strdup(priv->incoming_content_html); + } + g_free(file); + + file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); + if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { + priv->outgoing_next_content_html = g_strdup(priv->outgoing_content_html); + } + + pidgin_conversation_theme_read_info_plist(theme, NULL); + pidgin_conversation_theme_load_state(theme); + + /* non variant dependent Info.plist checks */ + if (priv->message_view_version < 3) { + purple_debug_info("webkit", "%s is a legacy style (version %d) and will not be loaded\n", priv->cf_bundle_name, priv->message_view_version); + g_object_unref(G_OBJECT(theme)); + return NULL; + } + + if (!priv->variant) + { + GList *variants = pidgin_conversation_theme_get_variants(theme); + + if (variants) + pidgin_conversation_theme_set_variant(theme, variants->data); + + for (; variants; variants = g_list_delete_link(variants, variants)) + g_free(variants->data); + } + + return theme; +} + +PidginConvTheme * +pidgin_conversation_theme_copy(const PidginConvTheme *theme) +{ + PidginConvTheme *ret; + PidginConvThemePrivate *old, *new; + + old = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + ret = pidgin_conversation_theme_new(old->style_dir); + new = PIDGIN_CONV_THEME_GET_PRIVATE(ret); + + new->variant = g_strdup(old->variant); + new->message_view_version = old->message_view_version; + new->cf_bundle_name = g_strdup(old->cf_bundle_name); + new->cf_bundle_identifier = g_strdup(old->cf_bundle_identifier); + new->cf_bundle_get_info_string = g_strdup(old->cf_bundle_get_info_string); + new->default_font_family = g_strdup(old->default_font_family); + new->default_font_size = old->default_font_size; + new->shows_user_icons = old->shows_user_icons; + new->disable_combine_consecutive = old->disable_combine_consecutive; + new->default_background_is_transparent = old->default_background_is_transparent; + new->disable_custom_background = old->disable_custom_background; + new->default_background_color = g_strdup(old->default_background_color); + new->allow_text_colors = old->allow_text_colors; + new->image_mask = g_strdup(old->image_mask); + new->default_variant = g_strdup(old->default_variant); + + new->template_path = g_strdup(old->template_path); + new->template_html = g_strdup(old->template_html); + new->header_html = g_strdup(old->header_html); + new->footer_html = g_strdup(old->footer_html); + new->incoming_content_html = g_strdup(old->incoming_content_html); + new->outgoing_content_html = g_strdup(old->outgoing_content_html); + new->incoming_next_content_html = g_strdup(old->incoming_next_content_html); + new->outgoing_next_content_html = g_strdup(old->outgoing_next_content_html); + new->status_html = g_strdup(old->status_html); + new->basestyle_css = g_strdup(old->basestyle_css); + + return ret; +} + +void +pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant) +{ + PidginConvThemePrivate *priv; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + /* I'm not going to test whether this variant is valid! */ + g_free(priv->variant); + priv->variant = g_strdup(variant); + + pidgin_conversation_theme_read_info_plist(theme, variant); + + /* todo, the style has "changed". Ideally, I would like to use signals at this point. */ +} + +char * +pidgin_conversation_theme_get_variant(PidginConvTheme *theme) +{ + PidginConvThemePrivate *priv; + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + return g_strdup(priv->variant); +} + +/** + * Get a list of variants supported by the style. + */ +GList * +pidgin_conversation_theme_get_variants(PidginConvTheme *theme) +{ + PidginConvThemePrivate *priv; + GList *ret = NULL; + GDir *variants; + const char *css_file; + char *css; + char *variant_dir; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + g_assert(priv->style_dir); + variant_dir = g_build_filename(priv->style_dir, "Contents", "Resources", "Variants", NULL); + + variants = g_dir_open(variant_dir, 0, NULL); + if (!variants) + return NULL; + + while ((css_file = g_dir_read_name(variants)) != NULL) { + if (!g_str_has_suffix(css_file, ".css")) + continue; + + css = g_strndup(css_file, strlen(css_file) - 4); + ret = g_list_append(ret, css); + } + + g_dir_close(variants); + g_free(variant_dir); + + ret = g_list_sort(ret, (GCompareFunc)g_strcmp0); + return ret; +} + +char * +pidgin_conversation_theme_get_css(PidginConvTheme *theme) +{ + PidginConvThemePrivate *priv; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + if (!priv->variant) { + return g_build_filename(priv->style_dir, "Contents", "Resources", "main.css", NULL); + } else { + char *file = g_strdup_printf("%s.css", priv->variant); + char *ret = g_build_filename(priv->style_dir, "Contents", "Resources", "Variants", file, NULL); + g_free(file); + return ret; + } +} + diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 185c8d60b8..69df4b2eea 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -68,6 +68,16 @@ G_BEGIN_DECLS */ GType pidgin_conversation_theme_get_type(void); +PidginConvTheme *pidgin_conversation_theme_load(const char *styledir); +PidginConvTheme *pidgin_conversation_theme_copy(const PidginConvTheme *theme); +void pidgin_conversation_theme_save_state(const PidginConvTheme *theme); +void pidgin_conversation_theme_read_info_plist(PidginConvTheme *theme, const char *variant); +char *pidgin_conversation_theme_get_variant(PidginConvTheme *theme); +GList *pidgin_conversation_theme_get_variants(PidginConvTheme *theme); +void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant); + +char *pidgin_conversation_theme_get_css(PidginConvTheme *theme); + G_END_DECLS #endif /* PIDGIN_CONV_THEME_H */ -- cgit v1.2.1 From 31e39285b324560370a56fd7781dc2164a3aec4d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 17 Sep 2011 06:58:39 +0000 Subject: Using g_string_new_len here is unnecessary, and a real waste of calls to strlen. --- pidgin/plugins/adiumthemes/webkit.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 22beedeae2..3c9e20f5bf 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -95,7 +95,6 @@ webkit_plugin_free_handle(void) static char * replace_message_tokens( const char *text, - gsize len, PurpleConversation *conv, const char *name, const char *alias, @@ -103,7 +102,7 @@ replace_message_tokens( PurpleMessageFlags flags, time_t mtime) { - GString *str = g_string_new_len(NULL, len); + GString *str = g_string_new(NULL); const char *cur = text; const char *prev = cur; @@ -177,9 +176,9 @@ replace_message_tokens( } static char * -replace_header_tokens(char *text, gsize len, PurpleConversation *conv) +replace_header_tokens(char *text, PurpleConversation *conv) { - GString *str = g_string_new_len(NULL, len); + GString *str = g_string_new(NULL); char *cur = text; char *prev = cur; @@ -241,9 +240,9 @@ replace_header_tokens(char *text, gsize len, PurpleConversation *conv) } static char * -replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *header, char *footer) +replace_template_tokens(PidginMessageStyle *style, char *text, char *header, char *footer) { - GString *str = g_string_new_len(NULL, len); + GString *str = g_string_new(NULL); char **ms = g_strsplit(text, "%@", 6); char *base = NULL; @@ -358,10 +357,10 @@ init_theme_for_webkit(PurpleConversation *conv, char *style_dir) basedir = g_build_filename(style->style_dir, "Contents", "Resources", "Template.html", NULL); baseuri = g_strdup_printf("file://%s", basedir); - header = replace_header_tokens(style->header_html, strlen(style->header_html), conv); + header = replace_header_tokens(style->header_html, conv); g_assert(style); - footer = replace_header_tokens(style->footer_html, strlen(style->footer_html), conv); - template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); + footer = replace_header_tokens(style->footer_html, conv); + template = replace_template_tokens(style, style->template_html, header, footer); g_assert(template); @@ -452,7 +451,7 @@ webkit_on_displaying_im_msg(PurpleAccount *account, purple_conversation_set_data(conv, "webkit-lastflags", GINT_TO_POINTER(flags)); smileyed = smiley_parse_markup(stripped, conv->account->protocol_id); - msg = replace_message_tokens(message_html, 0, conv, name, alias, smileyed, flags, mtime); + msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime); escape = gtk_webview_quote_js_string(msg); script = g_strdup_printf("%s(%s)", func, escape); -- cgit v1.2.1 From 849db195b09331b4ea998ec8d46a41fcf9b5ea28 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 17 Sep 2011 07:30:10 +0000 Subject: Temporarily rename the adium IMs plugin so it will install along side the WebKit inspector plugin. It's going away soon... --- pidgin/plugins/adiumthemes/Makefile.am | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pidgin/plugins/adiumthemes/Makefile.am b/pidgin/plugins/adiumthemes/Makefile.am index dba8959310..a0396dbc60 100644 --- a/pidgin/plugins/adiumthemes/Makefile.am +++ b/pidgin/plugins/adiumthemes/Makefile.am @@ -1,24 +1,24 @@ -webkittemplatedir = $(datadir)/pidgin/webkit -webkittemplate_DATA = Template.html +adiumtemplatedir = $(datadir)/pidgin/webkit +adiumtemplate_DATA = Template.html -webkitdir = $(libdir)/pidgin +adiumdir = $(libdir)/pidgin -webkit_la_LDFLAGS = -module -avoid-version +adium_la_LDFLAGS = -module -avoid-version EXTRA_DIST = $(webkittemplate_DATA) if PLUGINS -webkit_LTLIBRARIES = webkit.la +adium_LTLIBRARIES = adium.la -webkit_la_SOURCES = webkit.c \ +adium_la_SOURCES = webkit.c \ message-style.h \ message-style.c endif -webkit_la_LIBADD = $(GTK_LIBS) $(WEBKIT_LIBS) +adium_la_LIBADD = $(GTK_LIBS) $(WEBKIT_LIBS) AM_CPPFLAGS = \ -DDATADIR=\"$(datadir)\" \ -- cgit v1.2.1 From 3e654abd23bd84fe77f9583d58ff38792063a257 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 17 Sep 2011 07:38:54 +0000 Subject: Remove useless notification. --- pidgin/plugins/adiumthemes/webkit.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 3c9e20f5bf..84e097ce80 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -555,12 +555,6 @@ style_set_default(void) if (stylepath && *stylepath) styles = g_list_prepend(styles, g_strdup(stylepath)); - else { - purple_notify_error(handle, _("Webkit themes"), - _("Can't find installed styles"), - _("Please install some theme and verify the installation path")); - - } /* pick any one that works. Note that we have first preference * for the one in the userdir */ -- cgit v1.2.1 From 9c2426b31c2ff4614729138cdf35a407d1b7b288 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 18 Sep 2011 01:33:30 +0000 Subject: Update two translators' email addresses based on bounces/auto-replies I received while trying to contact them. --- pidgin/gtkdialogs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 8bb734e6fa..367387a7bf 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -150,7 +150,7 @@ static const struct translator translators[] = { {N_("Assamese"), "as", "Amitakhya Phukan", "aphukan@fedoraproject.org"}, {N_("Belarusian Latin"), "be@latin", "Ihar Hrachyshka", "ihar.hrachyshka@gmail.com"}, {N_("Bulgarian"), "bg", "Vladimira Girginova", "missing@here.is"}, - {N_("Bulgarian"), "bg", "Vladimir (Kaladan) Petkov", "vpetkov@i-space.org"}, + {N_("Bulgarian"), "bg", "Vladimir (Kaladan) Petkov", "kaladan@gmail.com"}, {N_("Bengali"), "bn", "Israt Jahan", "israt@ankur.org.bd"}, {N_("Bengali"), "bn", "Jamil Ahmed", "jamil@bengalinux.org"}, {N_("Bengali"), "bn", "Samia Nimatullah", "mailsamia2001@yahoo.com"}, @@ -221,7 +221,7 @@ static const struct translator translators[] = { {N_("Oriya"), "or", "Manoj Kumar Giri", "giri.manojkr@gmail.com"}, {N_("Punjabi"), "pa", "Amanpreet Singh Alam", "aalam@users.sf.net"}, {N_("Polish"), "pl", "Piotr Drąg", "piotrdrag@gmail.com"}, - {N_("Polish"), "pl", "Piotr Makowski", "pmakowski@aviary.pl"}, + {N_("Polish"), "pl", "Piotr Makowski", NULL}, {N_("Portuguese"), "pt", "Duarte Henriques", "duarte_henriques@myrealbox.com"}, {N_("Portuguese-Brazil"), "pt_BR", "Rodrigo Luiz Marques Flores", "rodrigomarquesflores@gmail.com"}, {N_("Pashto"), "ps", "Kashif Masood", "masudmails@yahoo.com"}, -- cgit v1.2.1 From c9328a192742cc908600c2b37be50a4d4aa7ab60 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 18 Sep 2011 01:46:56 +0000 Subject: One of the Piotrs tells me that the other Piotr is no longer translating. --- pidgin/gtkdialogs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 367387a7bf..63602b0827 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -221,7 +221,6 @@ static const struct translator translators[] = { {N_("Oriya"), "or", "Manoj Kumar Giri", "giri.manojkr@gmail.com"}, {N_("Punjabi"), "pa", "Amanpreet Singh Alam", "aalam@users.sf.net"}, {N_("Polish"), "pl", "Piotr Drąg", "piotrdrag@gmail.com"}, - {N_("Polish"), "pl", "Piotr Makowski", NULL}, {N_("Portuguese"), "pt", "Duarte Henriques", "duarte_henriques@myrealbox.com"}, {N_("Portuguese-Brazil"), "pt_BR", "Rodrigo Luiz Marques Flores", "rodrigomarquesflores@gmail.com"}, {N_("Pashto"), "ps", "Kashif Masood", "masudmails@yahoo.com"}, @@ -303,6 +302,7 @@ static const struct translator past_translators[] = { {N_("Polish"), "pl", "Emil Nowak", "emil5@go2.pl"}, {N_("Polish"), "pl", "Paweł Godlewski", "pawel@bajk.pl"}, {N_("Polish"), "pl", "Krzysztof Foltman", "krzysztof@foltman.com"}, + {N_("Polish"), "pl", "Piotr Makowski", NULL}, {N_("Polish"), "pl", "Przemysław Sułek", NULL}, {N_("Portuguese-Brazil"), "pt_BR", "Maurício de Lemos Rodrigues Collares Neto", "mauricioc@gmail.com"}, {N_("Russian"), "ru", "Dmitry Beloglazov", "dmaa@users.sf.net"}, -- cgit v1.2.1 From e42e009fee325f39525cdc739bcb2fa8f9e39669 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 18 Sep 2011 06:47:09 +0000 Subject: Copy theme-to-conversation loading stuff into the GObject code. --- pidgin/gtkconv-theme.c | 452 +++++++++++++++++++++++++++++++++++++++++-------- pidgin/gtkconv-theme.h | 4 + 2 files changed, 382 insertions(+), 74 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 3eb01ab04b..3880b13052 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -22,15 +22,21 @@ #include "gtkconv-theme.h" +#include "conversation.h" #include "debug.h" #include "prefs.h" #include "xmlnode.h" -#include +#include "pidgin.h" +#include "gtkconv.h" +#include "gtkwebview.h" #include #include +/* GObject data keys - this will probably go away soon... */ +#define MESSAGE_STYLE_KEY "message-style" + #define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \ (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate)) @@ -62,7 +68,6 @@ typedef struct { /* paths */ char *style_dir; - char *template_path; /* caches */ char *template_html; @@ -111,7 +116,6 @@ pidgin_conv_theme_finalize(GObject *obj) g_free(priv->default_variant); g_free(priv->style_dir); - g_free(priv->template_path); g_free(priv->template_html); g_free(priv->incoming_content_html); @@ -156,8 +160,8 @@ pidgin_conversation_theme_get_type(void) return type; } -/***************************************************************************** - * Public API functions +/****************************************************************************** + * Helper Functions *****************************************************************************/ static PidginConvTheme * @@ -172,6 +176,315 @@ pidgin_conversation_theme_new(const char *styledir) return ret; } +static const char * +get_template_html(PidginConvThemePrivate *priv) +{ + char *file; + + if (priv->template_html) + return priv->template_html; + + /* The template path can either come from the theme, or can + * be stock Template.html that comes with the plugin */ + file = g_build_filename(priv->style_dir, "Contents", "Resources", "Template.html", NULL); + + if (!g_file_test(file, G_FILE_TEST_EXISTS)) { + g_free(file); + file = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); + } + + if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) { + purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file); + priv->template_html = g_strdup(""); + } + g_free(file); + + return priv->template_html; +} + +static const char * +get_status_html(PidginConvThemePrivate *priv) +{ + char *file; + + if (priv->status_html) + return priv->status_html; + + file = g_build_filename(priv->style_dir, "Contents", "Resources", "Status.html", NULL); + if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { + purple_debug_info("webkit", "%s could not find Resources/Status.html", priv->style_dir); + priv->status_html = g_strdup(""); + } + g_free(file); + + return priv->status_html; +} + +static const char * +get_basestyle_css(PidginConvThemePrivate *priv) +{ + char *file; + + if (priv->basestyle_css) + return priv->basestyle_css; + + file = g_build_filename(priv->style_dir, "Contents", "Resources", "main.css", NULL); + if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL)) + priv->basestyle_css = g_strdup(""); + g_free(file); + + return priv->basestyle_css; +} + +static const char * +get_header_html(PidginConvThemePrivate *priv) +{ + char *file; + + if (priv->header_html) + return priv->header_html; + + file = g_build_filename(priv->style_dir, "Contents", "Resources", "Header.html", NULL); + if (!g_file_get_contents(file, &priv->header_html, NULL, NULL)) + priv->header_html = g_strdup(""); + g_free(file); + + return priv->header_html; +} + +static const char * +get_footer_html(PidginConvThemePrivate *priv) +{ + char *file; + + if (priv->footer_html) + return priv->footer_html; + + file = g_build_filename(priv->style_dir, "Contents", "Resources", "Footer.html", NULL); + if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL)) + priv->footer_html = g_strdup(""); + g_free(file); + + return priv->footer_html; +} + +static const char * +get_incoming_content_html(PidginConvThemePrivate *priv) +{ + char *file; + + if (priv->incoming_content_html) + return priv->incoming_content_html; + + file = g_build_filename(priv->style_dir, "Contents", "Resources", "Incoming", "Content.html", NULL); + if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) { + purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", priv->style_dir); + priv->incoming_content_html = g_strdup(""); + } + g_free(file); + + return priv->incoming_content_html; +} + +static const char * +get_incoming_next_content_html(PidginConvThemePrivate *priv) +{ + char *file; + + if (priv->incoming_next_content_html) + return priv->incoming_next_content_html; + + file = g_build_filename(priv->style_dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); + if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) { + priv->incoming_next_content_html = g_strdup(priv->incoming_content_html); + } + g_free(file); + + return priv->incoming_next_content_html; +} + +static const char * +get_outgoing_content_html(PidginConvThemePrivate *priv) +{ + char *file; + + if (priv->outgoing_content_html) + return priv->outgoing_content_html; + + file = g_build_filename(priv->style_dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); + if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) { + priv->outgoing_content_html = g_strdup(priv->incoming_content_html); + } + g_free(file); + + return priv->outgoing_content_html; +} + +static const char * +get_outgoing_next_content_html(PidginConvThemePrivate *priv) +{ + char *file; + + if (priv->outgoing_next_content_html) + return priv->outgoing_next_content_html; + + file = g_build_filename(priv->style_dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); + if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { + priv->outgoing_next_content_html = g_strdup(priv->outgoing_content_html); + } + + return priv->outgoing_next_content_html; +} + +static char * +replace_header_tokens(const char *text, PurpleConversation *conv) +{ + GString *str = g_string_new(NULL); + const char *cur = text; + const char *prev = cur; + + if (text == NULL) + return NULL; + + while ((cur = strchr(cur, '%'))) { + const char *replace = NULL; + char *fin = NULL; + + if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { + replace = conv->name; + } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { + replace = purple_account_get_alias(conv->account); + if (replace == NULL) + replace = purple_account_get_username(conv->account); + } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { + PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + if (buddy) { + replace = purple_buddy_get_alias(buddy); + } else { + replace = conv->name; + } + } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { + PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); + replace = purple_buddy_icon_get_full_path(icon); + } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { + } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { + char *format = NULL; + if (*(cur + strlen("%timeOpened")) == '{') { + const char *start = cur + strlen("%timeOpened") + 1; + char *end = strstr(start, "}%"); + if (!end) /* Invalid string */ + continue; + format = g_strndup(start, end - start); + fin = end + 1; + } + replace = purple_utf8_strftime(format ? format : "%X", NULL); + g_free(format); + } else { + continue; + } + + /* Here we have a replacement to make */ + g_string_append_len(str, prev, cur - prev); + g_string_append(str, replace); + + /* And update the pointers */ + if (fin) { + prev = cur = fin + 1; + } else { + prev = cur = strchr(cur + 1, '%') + 1; + } + } + + /* And wrap it up */ + g_string_append(str, prev); + return g_string_free(str, FALSE); +} + +static char * +replace_template_tokens(PidginConvTheme *theme, const char *text, const char *header, const char *footer) +{ + PidginConvThemePrivate *priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + GString *str = g_string_new(NULL); + + char **ms = g_strsplit(text, "%@", 6); + char *base = NULL; + char *csspath = pidgin_conversation_theme_get_css(theme); + if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { + g_strfreev(ms); + g_string_free(str, TRUE); + return NULL; + } + + g_string_append(str, ms[0]); + g_string_append(str, "file://"); + base = g_build_filename(priv->style_dir, "Contents", "Resources", "Template.html", NULL); + g_string_append(str, base); + g_free(base); + + g_string_append(str, ms[1]); + + g_string_append(str, get_basestyle_css(priv)); + + g_string_append(str, ms[2]); + + g_string_append(str, "file://"); + g_string_append(str, csspath); + + g_string_append(str, ms[3]); + if (header) + g_string_append(str, header); + g_string_append(str, ms[4]); + if (footer) + g_string_append(str, footer); + g_string_append(str, ms[5]); + + g_strfreev(ms); + g_free(csspath); + return g_string_free(str, FALSE); +} + +static void +set_theme_webkit_settings(WebKitWebView *webview, PidginConvTheme *theme) +{ + PidginConvThemePrivate *priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + WebKitWebSettings *settings; + + g_object_get(G_OBJECT(webview), "settings", &settings, NULL); + if (priv->default_font_family) + g_object_set(G_OBJECT(settings), "default-font-family", priv->default_font_family, NULL); + + if (priv->default_font_size) + g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(priv->default_font_size), NULL); + + /* this does not work :( */ + webkit_web_view_set_transparent(webview, priv->default_background_is_transparent); +} + +/* + * The style specification says that if the conversation is a group + * chat then the
element will be given a class + * 'groupchat'. I can't add another '%@' in Template.html because + * that breaks style-specific Template.html's. I have to either use libxml + * or conveniently play with WebKit's javascript engine. The javascript + * engine should work, but it's not an identical behavior. + */ +static void +webkit_set_groupchat(GtkWebView *webview) +{ + gtk_webview_safe_execute_script(webview, "document.getElementById('Chat').className = 'groupchat'"); +} + +static void +webkit_on_webview_destroy(GtkObject *object, gpointer data) +{ + g_object_unref(G_OBJECT(data)); + g_object_set_data(G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); +} + +/***************************************************************************** + * Public API functions + *****************************************************************************/ + void pidgin_conversation_theme_save_state(const PidginConvTheme *theme) { @@ -345,7 +658,6 @@ pidgin_conversation_theme_load(const char *styledir) * and if that does not exist, we choose the first one in the * directory. */ - char *file; PidginConvTheme *theme = NULL; PidginConvThemePrivate *priv; @@ -355,73 +667,6 @@ pidgin_conversation_theme_load(const char *styledir) /* load all other files */ - /* The template path can either come from the theme, or can - * be stock Template.html that comes with the plugin */ - priv->template_path = g_build_filename(styledir, "Contents", "Resources", "Template.html", NULL); - - if (!g_file_test(priv->template_path, G_FILE_TEST_EXISTS)) { - g_free(priv->template_path); - priv->template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); - } - - if (!g_file_get_contents(priv->template_path, &priv->template_html, NULL, NULL)) { - purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", priv->template_path); - g_object_unref(G_OBJECT(theme)); - return NULL; - } - - file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL); - if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { - purple_debug_info("webkit", "%s could not find Resources/Status.html", styledir); - g_object_unref(G_OBJECT(theme)); - g_free(file); - return NULL; - } - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "main.css", NULL); - if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL)) - priv->basestyle_css = g_strdup(""); - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL); - if (!g_file_get_contents(file, &priv->header_html, NULL, NULL)) - priv->header_html = g_strdup(""); - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL); - if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL)) - priv->footer_html = g_strdup(""); - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); - if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) { - purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", styledir); - g_object_unref(G_OBJECT(theme)); - g_free(file); - return NULL; - } - g_free(file); - - - /* according to the spec, the following are optional files */ - file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); - if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) { - priv->incoming_next_content_html = g_strdup(priv->incoming_content_html); - } - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "Content.html", NULL); - if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) { - priv->outgoing_content_html = g_strdup(priv->incoming_content_html); - } - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); - if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { - priv->outgoing_next_content_html = g_strdup(priv->outgoing_content_html); - } - pidgin_conversation_theme_read_info_plist(theme, NULL); pidgin_conversation_theme_load_state(theme); @@ -472,7 +717,6 @@ pidgin_conversation_theme_copy(const PidginConvTheme *theme) new->image_mask = g_strdup(old->image_mask); new->default_variant = g_strdup(old->default_variant); - new->template_path = g_strdup(old->template_path); new->template_html = g_strdup(old->template_html); new->header_html = g_strdup(old->header_html); new->footer_html = g_strdup(old->footer_html); @@ -565,3 +809,63 @@ pidgin_conversation_theme_get_css(PidginConvTheme *theme) } } +/** + * Called when either a new PurpleConversation is created + * or when a PidginConversation changes its active PurpleConversation + * This will not change the theme if the theme is already set. + * (This is to prevent accidental theme changes if a new + * PurpleConversation gets added. + * + * FIXME: it's not at all clear to me as to how + * Adium themes handle the case when the PurpleConversation + * changes. + */ +void +pidgin_conversation_theme_apply(PidginConvTheme *theme, PurpleConversation *conv) +{ + GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; + char *header, *footer; + char *template; + char *basedir; + char *baseuri; + PidginConvTheme *oldTheme; + PidginConvTheme *copy; + PidginConvThemePrivate *priv; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + oldTheme = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY); + if (oldTheme) + return; + + g_assert(theme); + + header = replace_header_tokens(get_header_html(priv), conv); + footer = replace_header_tokens(get_footer_html(priv), conv); + template = replace_template_tokens(theme, get_template_html(priv), header, footer); + + g_assert(template); + + purple_debug_info("webkit", "template: %s\n", template); + + set_theme_webkit_settings(WEBKIT_WEB_VIEW(webkit), theme); + basedir = g_build_filename(priv->style_dir, "Contents", "Resources", "Template.html", NULL); + baseuri = g_strdup_printf("file://%s", basedir); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); + + copy = pidgin_conversation_theme_copy(theme); + g_object_set_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy); + + g_object_unref(G_OBJECT(theme)); + /* I need to unref this style when the webkit object destroys */ + g_signal_connect(G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); + + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) + webkit_set_groupchat(GTK_WEBVIEW(webkit)); + g_free(basedir); + g_free(baseuri); + g_free(header); + g_free(footer); + g_free(template); +} + diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 69df4b2eea..0de8cee7cb 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -28,6 +28,7 @@ #include #include +#include "conversation.h" #include "theme.h" /** @@ -78,6 +79,9 @@ void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *v char *pidgin_conversation_theme_get_css(PidginConvTheme *theme); +void +pidgin_conversation_theme_apply(PidginConvTheme *theme, PurpleConversation *conv); + G_END_DECLS #endif /* PIDGIN_CONV_THEME_H */ -- cgit v1.2.1 From 394d3ffa8479ba5a79451fff2bd19faf9f639065 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 18 Sep 2011 08:59:12 +0000 Subject: Move conversation theme loading into the PidginConvThemeLoader GObject --- pidgin/gtkconv-theme-loader.c | 132 +++++++++++++++++++++- pidgin/gtkconv-theme.c | 256 +++++++++++++----------------------------- pidgin/gtkconv-theme.h | 3 + 3 files changed, 215 insertions(+), 176 deletions(-) diff --git a/pidgin/gtkconv-theme-loader.c b/pidgin/gtkconv-theme-loader.c index 671da7842d..ea3d3760cc 100644 --- a/pidgin/gtkconv-theme-loader.c +++ b/pidgin/gtkconv-theme-loader.c @@ -30,14 +30,144 @@ * Conversation Theme Builder *****************************************************************************/ +static GHashTable * +read_info_plist(xmlnode *plist) +{ + GHashTable *info; + xmlnode *key, *value; + gboolean fail = FALSE; + + info = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + + for (key = xmlnode_get_child(plist, "dict/key"); + key; + key = xmlnode_get_next_twin(key)) { + char *keyname; + GValue *val; + + ; + for (value = key->next; value && value->type != XMLNODE_TYPE_TAG; value = value->next) + ; + if (!value) { + fail = TRUE; + break; + } + + val = g_new0(GValue, 1); + if (g_str_equal(value->name, "string")) { + g_value_init(val, G_TYPE_STRING); + g_value_take_string(val, xmlnode_get_data_unescaped(value)); + + } else if (g_str_equal(value->name, "true")) { + g_value_init(val, G_TYPE_BOOLEAN); + g_value_set_boolean(val, TRUE); + + } else if (g_str_equal(value->name, "false")) { + g_value_init(val, G_TYPE_BOOLEAN); + g_value_set_boolean(val, FALSE); + + } else if (g_str_equal(value->name, "real")) { + char *temp = xmlnode_get_data_unescaped(value); + g_value_init(val, G_TYPE_FLOAT); + g_value_set_float(val, atof(temp)); + g_free(temp); + + } else if (g_str_equal(value->name, "integer")) { + char *temp = xmlnode_get_data_unescaped(value); + g_value_init(val, G_TYPE_INT); + g_value_set_int(val, atoi(temp)); + g_free(temp); + + } else { + /* NOTE: We don't support array, data, date, or dict as values, + since they don't seem to be needed for styles. */ + g_free(val); + fail = TRUE; + break; + } + + keyname = xmlnode_get_data_unescaped(key); + g_hash_table_insert(info, keyname, val); + } + + if (fail) { + g_hash_table_destroy(info); + info = NULL; + } + + return info; +} + static PurpleTheme * pidgin_conv_loader_build(const gchar *dir) { PidginConvTheme *theme = NULL; + char *contents; + xmlnode *plist; + GHashTable *info; + GValue *val; + int MessageViewVersion; + const char *CFBundleName; + const char *CFBundleIdentifier; - /* Find the theme file */ g_return_val_if_fail(dir != NULL, NULL); + /* Load Info.plist for theme information */ + contents = g_build_filename(dir, "Contents", NULL); + plist = xmlnode_from_file(contents, "Info.plist", "Info.plist", "gtkconv-theme-loader"); + g_free(contents); + if (plist == NULL) { + purple_debug_error("gtkconv-theme", "Failed to load Contents/Info.plist in %s\n", dir); + return NULL; + } + + info = read_info_plist(plist); + xmlnode_free(plist); + if (info == NULL) { + purple_debug_error("gtkconv-theme", "Failed to load Contents/Info.plist in %s\n", dir); + return NULL; + } + + /* Check for required keys: CFBundleName */ + val = g_hash_table_lookup(info, "CFBundleName"); + if (!val) { + purple_debug_error("gtkconv-theme", "%s/Contents/Info.plist missing required key CFBundleName.\n", dir); + g_hash_table_destroy(info); + return NULL; + } + CFBundleName = g_value_get_string(val); + + /* Check for required keys: CFBundleIdentifier */ + val = g_hash_table_lookup(info, "CFBundleIdentifier"); + if (!val) { + purple_debug_error("gtkconv-theme", "%s/Contents/Info.plist missing required key CFBundleIdentifier.\n", dir); + g_hash_table_destroy(info); + return NULL; + } + CFBundleIdentifier = g_value_get_string(val); + + /* Check for required keys: MessageViewVersion */ + val = g_hash_table_lookup(info, "MessageViewVersion"); + if (!val) { + purple_debug_error("gtkconv-theme", "%s/Contents/Info.plist missing required key MessageViewVersion.\n", dir); + g_hash_table_destroy(info); + return NULL; + } + + MessageViewVersion = g_value_get_int(val); + if (MessageViewVersion < 3) { + purple_debug_error("gtkconv-theme", "%s is a legacy style (version %d) and will not be loaded.\n", + CFBundleName, MessageViewVersion); + g_hash_table_destroy(info); + return NULL; + } + + theme = g_object_new(PIDGIN_TYPE_CONV_THEME, + "type", "conversation", + "name", CFBundleName, + "directory", dir, + "info", info, NULL); + return PURPLE_THEME(theme); } diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 3880b13052..cd6179e384 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -48,7 +48,8 @@ typedef struct { /* current config options */ char *variant; /* allowed to be NULL if there are no variants */ - /* Info.plist keys that change with Variant */ + /* Info.plist keys/values */ + GHashTable *info; /* Static Info.plist keys */ int message_view_version; @@ -87,10 +88,51 @@ typedef struct { static GObjectClass *parent_class = NULL; +/****************************************************************************** + * Enums + *****************************************************************************/ + +enum { + PROP_ZERO = 0, + PROP_INFO, +}; + /****************************************************************************** * GObject Stuff *****************************************************************************/ +static void +pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value, + GParamSpec *psec) +{ + PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); + + switch (param_id) { + case PROP_INFO: + g_value_set_boxed(value, (gpointer)pidgin_conversation_theme_get_info(theme)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); + break; + } +} + +static void +pidgin_conv_theme_set_property(GObject *obj, guint param_id, const GValue *value, + GParamSpec *psec) +{ + PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); + + switch (param_id) { + case PROP_INFO: + pidgin_conversation_theme_set_info(theme, g_value_get_boxed(value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); + break; + } +} + static void pidgin_conv_theme_init(GTypeInstance *instance, gpointer klass) @@ -124,6 +166,9 @@ pidgin_conv_theme_finalize(GObject *obj) g_free(priv->status_html); g_free(priv->basestyle_css); + if (priv->info) + g_hash_table_destroy(priv->info); + parent_class->finalize(obj); } @@ -131,10 +176,23 @@ static void pidgin_conv_theme_class_init(PidginConvThemeClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS(klass); + GParamSpec *pspec; parent_class = g_type_class_peek_parent(klass); + g_type_class_add_private(klass, sizeof(PidginConvThemePrivate)); + + obj_class->get_property = pidgin_conv_theme_get_property; + obj_class->set_property = pidgin_conv_theme_set_property; obj_class->finalize = pidgin_conv_theme_finalize; + + /* INFO */ + pspec = g_param_spec_boxed("info", "Info", + "The information about this theme", + G_TYPE_HASH_TABLE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property(obj_class, PROP_INFO, pspec); + } GType @@ -155,7 +213,7 @@ pidgin_conversation_theme_get_type(void) NULL, /* value table */ }; type = g_type_register_static(PURPLE_TYPE_THEME, - "PidginConvTheme", &info, G_TYPE_FLAG_ABSTRACT); + "PidginConvTheme", &info, 0); } return type; } @@ -164,18 +222,6 @@ pidgin_conversation_theme_get_type(void) * Helper Functions *****************************************************************************/ -static PidginConvTheme * -pidgin_conversation_theme_new(const char *styledir) -{ - PidginConvTheme *ret = g_object_new(PIDGIN_TYPE_CONV_THEME, NULL); - PidginConvThemePrivate *priv; - - priv = PIDGIN_CONV_THEME_GET_PRIVATE(ret); - priv->style_dir = g_strdup(styledir); - - return ret; -} - static const char * get_template_html(PidginConvThemePrivate *priv) { @@ -485,6 +531,26 @@ webkit_on_webview_destroy(GtkObject *object, gpointer data) * Public API functions *****************************************************************************/ +const GHashTable * +pidgin_conversation_theme_get_info(const PidginConvTheme *theme) +{ + PidginConvThemePrivate *priv; + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + return priv->info; +} + +void +pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info) +{ + PidginConvThemePrivate *priv; + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + if (priv->info) + g_hash_table_destroy(priv->info); + + priv->info = info; +} + void pidgin_conversation_theme_save_state(const PidginConvTheme *theme) { @@ -533,164 +599,6 @@ pidgin_conversation_theme_load_state(PidginConvTheme *theme) g_free(variant); } - -static gboolean -parse_info_plist_key_value(xmlnode *key, gpointer destination, const char *expected) -{ - xmlnode *val = key->next; - - for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next) - ; - if (!val) - return FALSE; - - if (expected == NULL || g_str_equal(expected, "string")) { - char **dest = (char **)destination; - if (!g_str_equal(val->name, "string")) - return FALSE; - if (*dest) - g_free(*dest); - *dest = xmlnode_get_data_unescaped(val); - } else if (g_str_equal(expected, "integer")) { - int *dest = (int *)destination; - char *value = xmlnode_get_data_unescaped(val); - - if (!g_str_equal(val->name, "integer")) - return FALSE; - *dest = atoi(value); - g_free(value); - } else if (g_str_equal(expected, "boolean")) { - gboolean *dest = (gboolean *)destination; - if (g_str_equal(val->name, "true")) - *dest = TRUE; - else if (g_str_equal(val->name, "false")) - *dest = FALSE; - else - return FALSE; - } else return FALSE; - - return TRUE; -} - -static gboolean -str_for_key(const char *key, const char *found, const char *variant) -{ - if (g_str_equal(key, found)) - return TRUE; - if (!variant) - return FALSE; - return (g_str_has_prefix(found, key) - && g_str_has_suffix(found, variant) - && strlen(found) == strlen(key) + strlen(variant) + 1); -} - -/** - * Info.plist should be re-read every time the variant changes, this is because - * the keys that take precedence depend on the value of the current variant. - */ -void -pidgin_conversation_theme_read_info_plist(PidginConvTheme *theme, const char *variant) -{ - PidginConvThemePrivate *priv; - char *contents; - xmlnode *plist, *iter; - xmlnode *dict; - - priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - - /* note that if a variant is used the option:VARIANTNAME takes precedence */ - contents = g_build_filename(priv->style_dir, "Contents", NULL); - plist = xmlnode_from_file(contents, "Info.plist", "Info.plist", "webkit"); - dict = xmlnode_get_child(plist, "dict"); - - g_assert (dict); - for (iter = xmlnode_get_child(dict, "key"); iter; iter = xmlnode_get_next_twin(iter)) { - char* key = xmlnode_get_data_unescaped(iter); - gboolean pr = TRUE; - - if (g_str_equal("MessageViewVersion", key)) - pr = parse_info_plist_key_value(iter, &priv->message_view_version, "integer"); - else if (g_str_equal("CFBundleName", key)) - pr = parse_info_plist_key_value(iter, &priv->cf_bundle_name, "string"); - else if (g_str_equal("CFBundleIdentifier", key)) - pr = parse_info_plist_key_value(iter, &priv->cf_bundle_identifier, "string"); - else if (g_str_equal("CFBundleGetInfoString", key)) - pr = parse_info_plist_key_value(iter, &priv->cf_bundle_get_info_string, "string"); - else if (str_for_key("DefaultFontFamily", key, variant)) - pr = parse_info_plist_key_value(iter, &priv->default_font_family, "string"); - else if (str_for_key("DefaultFontSize", key, variant)) - pr = parse_info_plist_key_value(iter, &priv->default_font_size, "integer"); - else if (str_for_key("ShowsUserIcons", key, variant)) - pr = parse_info_plist_key_value(iter, &priv->shows_user_icons, "boolean"); - else if (str_for_key("DisableCombineConsecutive", key, variant)) - pr = parse_info_plist_key_value(iter, &priv->disable_combine_consecutive, "boolean"); - else if (str_for_key("DefaultBackgroundIsTransparent", key, variant)) - pr = parse_info_plist_key_value(iter, &priv->default_background_is_transparent, "boolean"); - else if (str_for_key("DisableCustomBackground", key, variant)) - pr = parse_info_plist_key_value(iter, &priv->disable_custom_background, "boolean"); - else if (str_for_key("DefaultBackgroundColor", key, variant)) - pr = parse_info_plist_key_value(iter, &priv->default_background_color, "string"); - else if (str_for_key("AllowTextColors", key, variant)) - pr = parse_info_plist_key_value(iter, &priv->allow_text_colors, "integer"); - else if (str_for_key("ImageMask", key, variant)) - pr = parse_info_plist_key_value(iter, &priv->image_mask, "string"); - - if (!pr) - purple_debug_warning("webkit", "Failed to parse key %s\n", key); - g_free(key); - } - - xmlnode_free(plist); -} - -PidginConvTheme * -pidgin_conversation_theme_load(const char *styledir) -{ - /* - * the loading process described: - * - * First we load all the style .html files, etc. - * The we load any config options that have been stored for - * this variant. - * Then we load the Info.plist, for the currently decided variant. - * At this point, if we find that variants exist, yet - * we don't have a variant selected, we choose DefaultVariant - * and if that does not exist, we choose the first one in the - * directory. - */ - PidginConvTheme *theme = NULL; - PidginConvThemePrivate *priv; - - theme = pidgin_conversation_theme_new(styledir); - - priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - - /* load all other files */ - - pidgin_conversation_theme_read_info_plist(theme, NULL); - pidgin_conversation_theme_load_state(theme); - - /* non variant dependent Info.plist checks */ - if (priv->message_view_version < 3) { - purple_debug_info("webkit", "%s is a legacy style (version %d) and will not be loaded\n", priv->cf_bundle_name, priv->message_view_version); - g_object_unref(G_OBJECT(theme)); - return NULL; - } - - if (!priv->variant) - { - GList *variants = pidgin_conversation_theme_get_variants(theme); - - if (variants) - pidgin_conversation_theme_set_variant(theme, variants->data); - - for (; variants; variants = g_list_delete_link(variants, variants)) - g_free(variants->data); - } - - return theme; -} - PidginConvTheme * pidgin_conversation_theme_copy(const PidginConvTheme *theme) { @@ -698,7 +606,7 @@ pidgin_conversation_theme_copy(const PidginConvTheme *theme) PidginConvThemePrivate *old, *new; old = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - ret = pidgin_conversation_theme_new(old->style_dir); + ret = g_object_new(PIDGIN_TYPE_CONV_THEME, "directory", old->style_dir, NULL); new = PIDGIN_CONV_THEME_GET_PRIVATE(ret); new->variant = g_strdup(old->variant); @@ -741,8 +649,6 @@ pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *varian g_free(priv->variant); priv->variant = g_strdup(variant); - pidgin_conversation_theme_read_info_plist(theme, variant); - /* todo, the style has "changed". Ideally, I would like to use signals at this point. */ } diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 0de8cee7cb..1320add334 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -69,6 +69,9 @@ G_BEGIN_DECLS */ GType pidgin_conversation_theme_get_type(void); +const GHashTable *pidgin_conversation_theme_get_info(const PidginConvTheme *theme); +void pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info); + PidginConvTheme *pidgin_conversation_theme_load(const char *styledir); PidginConvTheme *pidgin_conversation_theme_copy(const PidginConvTheme *theme); void pidgin_conversation_theme_save_state(const PidginConvTheme *theme); -- cgit v1.2.1 From 5a93a0dcf65d35abbf8e7d0efc3cf3572b03f3c3 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 18 Sep 2011 16:25:39 +0000 Subject: Fix compilation of the gevolution plugin. Need to pass an invite message parameter to purple_account_add_buddy(). Is it ok to pass NULL here? --- pidgin/plugins/gevolution/gevo-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/plugins/gevolution/gevo-util.c b/pidgin/plugins/gevolution/gevo-util.c index 8f97a7df8f..77d31a4ffe 100644 --- a/pidgin/plugins/gevolution/gevo-util.c +++ b/pidgin/plugins/gevolution/gevo-util.c @@ -49,7 +49,7 @@ gevo_add_buddy(PurpleAccount *account, const char *group_name, purple_blist_add_buddy(buddy, NULL, group, NULL); } - purple_account_add_buddy(account, buddy); + purple_account_add_buddy(account, buddy, NULL); if (conv != NULL) { -- cgit v1.2.1 From c3721e10a6bcfb50c4f0a59e9c1c8f644a5c930f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 18 Sep 2011 18:55:17 +0000 Subject: This shouldn't be here. I wonder why it compiled before. --- pidgin/gtkconv-theme.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index cd6179e384..65862460e9 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -592,9 +592,6 @@ pidgin_conversation_theme_load_state(PidginConvTheme *theme) g_free(priv->variant); priv->variant = g_strdup(value); - if (changed) - pidgin_conversation_theme_read_info_plist(theme, priv->variant); - g_free(prefname); g_free(variant); } -- cgit v1.2.1 From a203c50c2f71569cc0a4a20784ec9a1c3fe8bb35 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 18 Sep 2011 20:18:33 +0000 Subject: Re-arrange these doxygen comments. For comments longer than a few words, putting the comment before the variable like this seems cleaner than trying to cram it on the same line as the variable and using lots of crazy indentation. Anyone have a strong opinion either way? --- libpurple/conversation.h | 52 ++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/libpurple/conversation.h b/libpurple/conversation.h index 9bed15c18d..a8d88d3179 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -291,25 +291,39 @@ struct _PurpleConvChat */ struct _PurpleConvChatBuddy { - char *name; /**< The chat participant's name in the chat. */ - char *alias; /**< The chat participant's alias, if known; - * @a NULL otherwise. - */ - char *alias_key; /**< A string by which this buddy will be sorted, - * or @c NULL if the buddy should be sorted by - * its @c name. (This is currently always @c - * NULL.) - */ - gboolean buddy; /**< @a TRUE if this chat participant is on the - * buddy list; @a FALSE otherwise. - */ - PurpleConvChatBuddyFlags flags; /**< A bitwise OR of flags for this participant, - * such as whether they are a channel operator. - */ - GHashTable *attributes; /**< A hash table of attributes about the user, such as - * real name, user@host, etc. - */ - gpointer ui_data; /** < The UI can put whatever it wants here. */ + /** The chat participant's name in the chat. */ + char *name; + + /** The chat participant's alias, if known; @a NULL otherwise. */ + char *alias; + + /** + * A string by which this buddy will be sorted, or @c NULL if the + * buddy should be sorted by its @c name. (This is currently always + * @c NULL. + */ + char *alias_key; + + /** + * @a TRUE if this chat participant is on the buddy list; + * @a FALSE otherwise. + */ + gboolean buddy; + + /** + * A bitwise OR of flags for this participant, such as whether they + * are a channel operator. + */ + PurpleConvChatBuddyFlags flags; + + /** + * A hash table of attributes about the user, such as real name, + * user@host, etc. + */ + GHashTable *attributes; + + /** The UI can put whatever it wants here. */ + gpointer ui_data; }; /** -- cgit v1.2.1 From 2a8c7909432e538f3eda09f6ea6cd0faa618f992 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 18 Sep 2011 20:20:02 +0000 Subject: Doxygen was complaining about this not being a valid whatchamadinger, so escape it. --- libpurple/conversation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/conversation.h b/libpurple/conversation.h index a8d88d3179..c4343c17c5 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -318,7 +318,7 @@ struct _PurpleConvChatBuddy /** * A hash table of attributes about the user, such as real name, - * user@host, etc. + * user\@host, etc. */ GHashTable *attributes; -- cgit v1.2.1 From cab9805fdb11d59e154f82bbcd986fe49fa983b9 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 18 Sep 2011 20:46:06 +0000 Subject: Fix a bunch of tiny problems generating our doxygen documentation --- libpurple/ft.h | 2 +- libpurple/notify.h | 4 ++-- libpurple/prpl.c | 3 --- libpurple/prpl.h | 5 ++++- libpurple/request.c | 3 --- libpurple/request.h | 6 ++++-- libpurple/roomlist.h | 6 +++--- libpurple/util.h | 15 ++++++++------- libpurple/whiteboard.h | 4 ++-- libpurple/xmlnode.h | 2 ++ pidgin/gtkutils.h | 12 ++++++------ pidgin/gtkwebview.h | 2 +- 12 files changed, 33 insertions(+), 31 deletions(-) diff --git a/libpurple/ft.h b/libpurple/ft.h index a657d2bf39..0174ce4cc0 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -791,7 +791,7 @@ void purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats); * Sets the protocol data for a file transfer. * * @param xfer The file transfer. - * @param protocol_data The protocol data to set for the file transfer. + * @param proto_data The protocol data to set for the file transfer. * * @since 3.0.0 */ diff --git a/libpurple/notify.h b/libpurple/notify.h index 7488a779bb..700bacce2a 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -279,7 +279,7 @@ PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *tit /** * Sets whether or not a search result column is visible. * - * @param field The search column object. + * @param column The search column object. * @param visible TRUE if visible, or FALSE if not. */ void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *column, gboolean visible); @@ -287,7 +287,7 @@ void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *col /** * Returns whether or not a search result column is visible. * - * @param field The search column object. + * @param column The search column object. * * @return TRUE if the search result column is visible. FALSE otherwise. */ diff --git a/libpurple/prpl.c b/libpurple/prpl.c index 1a9c644621..f001daed1a 100644 --- a/libpurple/prpl.c +++ b/libpurple/prpl.c @@ -33,9 +33,6 @@ /** @name Attention Type API */ /**************************************************************************/ -/** Represents "nudges" and "buzzes" that you may send to a buddy to attract - * their attention (or vice-versa). - */ struct _PurpleAttentionType { const char *name; /**< Shown in GUI elements */ diff --git a/libpurple/prpl.h b/libpurple/prpl.h index 3a4a2cf2c0..b65d5456a6 100644 --- a/libpurple/prpl.h +++ b/libpurple/prpl.h @@ -31,7 +31,10 @@ #define _PURPLE_PRPL_H_ typedef struct _PurplePluginProtocolInfo PurplePluginProtocolInfo; -/** @copydoc _PurpleAttentionType */ + +/** Represents "nudges" and "buzzes" that you may send to a buddy to attract + * their attention (or vice-versa). + */ typedef struct _PurpleAttentionType PurpleAttentionType; /**************************************************************************/ diff --git a/libpurple/request.c b/libpurple/request.c index 3331eb19de..985008f7ab 100644 --- a/libpurple/request.c +++ b/libpurple/request.c @@ -42,9 +42,6 @@ typedef struct } PurpleRequestInfo; -/** - * A request field. - */ struct _PurpleRequestField { PurpleRequestFieldType type; diff --git a/libpurple/request.h b/libpurple/request.h index 3f095ff611..8547087e26 100644 --- a/libpurple/request.h +++ b/libpurple/request.h @@ -30,7 +30,9 @@ #include #include -/** @copydoc _PurpleRequestField */ +/** + * A request field. + */ typedef struct _PurpleRequestField PurpleRequestField; /** @@ -321,7 +323,7 @@ gpointer purple_request_fields_get_ui_data(const PurpleRequestFields *fields); * @param fields The fields list. * @param ui_data A pointer to associate with this object. */ -void purple_request_fields_set_ui_data(PurpleRequestFields *fields, gpointer data); +void purple_request_fields_set_ui_data(PurpleRequestFields *fields, gpointer ui_data); /*@}*/ diff --git a/libpurple/roomlist.h b/libpurple/roomlist.h index 354c507665..9e21f818a9 100644 --- a/libpurple/roomlist.h +++ b/libpurple/roomlist.h @@ -224,7 +224,7 @@ GList *purple_roomlist_get_fields(PurpleRoomlist *roomlist); /** * Get the protocol data associated with this room list. * - * @param roomlist The roomlist, which must not be @c NULL. + * @param list The roomlist, which must not be @c NULL. * * @return The protocol data associated with this room list. This is a * convenience field provided to the protocol plugin--it is not @@ -243,7 +243,7 @@ void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data); /** * Get the UI data associated with this room list. * - * @param roomlist The roomlist, which must not be @c NULL. + * @param list The roomlist, which must not be @c NULL. * * @return The UI data associated with this room list. This is a * convenience field provided to the UIs--it is not @@ -255,7 +255,7 @@ gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list); * Set the UI data associated with this room list. * * @param list The roomlist, which must not be @c NULL. - * @param UI_data A pointer to associate with this room list. + * @param ui_data A pointer to associate with this room list. */ void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data); diff --git a/libpurple/util.h b/libpurple/util.h index 4e084a2db4..bfa3ce4a6b 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -36,9 +36,16 @@ * the request. */ typedef struct _PurpleUtilFetchUrlData PurpleUtilFetchUrlData; + /** @copydoc _PurpleMenuAction */ typedef struct _PurpleMenuAction PurpleMenuAction; -/** @copydoc _PurpleKeyValuePair */ + +/** + * A key-value pair. + * + * This is used by, among other things, purple_gtk_combo* functions to pass in a + * list of key-value pairs so it can display a user-friendly value. + */ typedef struct _PurpleKeyValuePair PurpleKeyValuePair; #include "account.h" @@ -53,12 +60,6 @@ extern "C" { typedef char *(*PurpleInfoFieldFormatCallback)(const char *field, size_t len); -/** - * A key-value pair. - * - * This is used by, among other things, purple_gtk_combo* functions to pass in a - * list of key-value pairs so it can display a user-friendly value. - */ struct _PurpleKeyValuePair { gchar *key; diff --git a/libpurple/whiteboard.h b/libpurple/whiteboard.h index 41a6459c09..2c4144d737 100644 --- a/libpurple/whiteboard.h +++ b/libpurple/whiteboard.h @@ -309,10 +309,10 @@ void purple_whiteboard_set_draw_list(PurpleWhiteboard *wb, GList* draw_list); * Sets the protocol data for a whiteboard. * * @param wb The whiteboard. - * @param protocol_data The protocol data to set for the whiteboard. + * @param proto_data The protocol data to set for the whiteboard. */ void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data); - + /** * Gets the protocol data for a whiteboard. * diff --git a/libpurple/xmlnode.h b/libpurple/xmlnode.h index 07e4b5a19d..359eef0e03 100644 --- a/libpurple/xmlnode.h +++ b/libpurple/xmlnode.h @@ -230,9 +230,11 @@ const char *xmlnode_get_namespace(const xmlnode *node); * own namespace. * * For example, given: + * \verbatim * * * + * \endverbatim * * The default namespace of all nodes (including 'child1') is "jabber:client", * though the namespace for 'element' is "http://example.org/ns1". diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h index 25e3631cbf..c0d7fafbef 100644 --- a/pidgin/gtkutils.h +++ b/pidgin/gtkutils.h @@ -928,12 +928,12 @@ GdkPixbuf *pidgin_pixbuf_new_from_file_at_scale(const char *filename, int width, /** * Add scrollbars to a widget - * @param widget The child widget - * @hscrollbar_policy Horizontal scrolling policy - * @vscrollbar_policy Vertical scrolling policy - * @shadow Shadow type - * @width Desired widget width, or -1 for default - * @height Desired widget height, or -1 for default + * @param child The child widget + * @param hscrollbar_policy Horizontal scrolling policy + * @param vscrollbar_policy Vertical scrolling policy + * @param shadow_type Shadow type + * @param width Desired widget width, or -1 for default + * @param height Desired widget height, or -1 for default * * @since 2.8.0 */ diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 5abd79fc9f..0c0511c320 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -94,7 +94,7 @@ void gtk_webview_append_html(GtkWebView *webview, const char *markup); /** * Rather than use webkit_webview_load_string, this routine - * parses and displays the tags that make use of the + * parses and displays the \ tags that make use of the * Pidgin imgstore. * * @param webview The GtkWebView object -- cgit v1.2.1 From edd6bbe20700186c5609b1d1bbf3f7271f22267c Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 18 Sep 2011 21:32:10 +0000 Subject: Apparently this never had documentation --- libpurple/util.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libpurple/util.h b/libpurple/util.h index bfa3ce4a6b..ed96558c52 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -37,7 +37,6 @@ */ typedef struct _PurpleUtilFetchUrlData PurpleUtilFetchUrlData; -/** @copydoc _PurpleMenuAction */ typedef struct _PurpleMenuAction PurpleMenuAction; /** -- cgit v1.2.1 From 2e9e60dccbb0564eea6ea9aacc5a8eb6d83343b9 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 18 Sep 2011 21:45:29 +0000 Subject: I guess doxygen wants this struct to have a comment if prpl.h is going to have an explicit reference to it. --- libpurple/util.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpurple/util.h b/libpurple/util.h index ed96558c52..9b79b8cc98 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -37,6 +37,11 @@ */ typedef struct _PurpleUtilFetchUrlData PurpleUtilFetchUrlData; +/** + * A generic structure that contains information about an "action." One + * place this is is used is by PRPLs to tell the core the list of available + * right-click actions for a buddy list row. + */ typedef struct _PurpleMenuAction PurpleMenuAction; /** -- cgit v1.2.1 From f433c292f5a99c235e5dd1b0c791053bb2892064 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 18 Sep 2011 21:45:51 +0000 Subject: Correct the name of this reference. This was a copy/paste error from dnsquery.h --- libpurple/dnssrv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/dnssrv.h b/libpurple/dnssrv.h index 0a8d24f14f..c0eb194c41 100644 --- a/libpurple/dnssrv.h +++ b/libpurple/dnssrv.h @@ -70,7 +70,7 @@ typedef struct /** Called just before @a query_data is freed; this should cancel any * further use of @a query_data the UI would make. Unneeded if - * #resolve_host is not implemented. + * #resolve is not implemented. */ void (*destroy)(PurpleSrvTxtQueryData *query_data); -- cgit v1.2.1 From b706599f4c9c60731536648c5fc76319c28d6d88 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 02:42:00 +0000 Subject: Lookup style key information from the hash table instead of the struct members, which are not set in this new code. --- pidgin/gtkconv-theme.c | 158 ++++++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 82 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 65862460e9..759379063d 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -51,25 +51,6 @@ typedef struct { /* Info.plist keys/values */ GHashTable *info; - /* Static Info.plist keys */ - int message_view_version; - char *cf_bundle_name; - char *cf_bundle_identifier; - char *cf_bundle_get_info_string; - char *default_font_family; - int default_font_size; - gboolean shows_user_icons; - gboolean disable_combine_consecutive; - gboolean default_background_is_transparent; - gboolean disable_custom_background; - char *default_background_color; - gboolean allow_text_colors; - char *image_mask; - char *default_variant; - - /* paths */ - char *style_dir; - /* caches */ char *template_html; char *header_html; @@ -149,16 +130,6 @@ pidgin_conv_theme_finalize(GObject *obj) priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj); - g_free(priv->cf_bundle_name); - g_free(priv->cf_bundle_identifier); - g_free(priv->cf_bundle_get_info_string); - g_free(priv->default_font_family); - g_free(priv->default_background_color); - g_free(priv->image_mask); - g_free(priv->default_variant); - - g_free(priv->style_dir); - g_free(priv->template_html); g_free(priv->incoming_content_html); g_free(priv->outgoing_content_html); @@ -222,8 +193,28 @@ pidgin_conversation_theme_get_type(void) * Helper Functions *****************************************************************************/ +static const GValue * +get_key(PidginConvThemePrivate *priv, const char *key, gboolean specific) +{ + GValue *val = NULL; + + /* Try variant-specific key */ + if (specific && priv->variant) { + char *name = g_strdup_printf("%s:%s", key, priv->variant); + val = g_hash_table_lookup(priv->info, name); + g_free(name); + } + + /* Try generic key */ + if (!val) { + val = g_hash_table_lookup(priv->info, key); + } + + return val; +} + static const char * -get_template_html(PidginConvThemePrivate *priv) +get_template_html(PidginConvThemePrivate *priv, const char *dir) { char *file; @@ -232,7 +223,7 @@ get_template_html(PidginConvThemePrivate *priv) /* The template path can either come from the theme, or can * be stock Template.html that comes with the plugin */ - file = g_build_filename(priv->style_dir, "Contents", "Resources", "Template.html", NULL); + file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL); if (!g_file_test(file, G_FILE_TEST_EXISTS)) { g_free(file); @@ -249,16 +240,16 @@ get_template_html(PidginConvThemePrivate *priv) } static const char * -get_status_html(PidginConvThemePrivate *priv) +get_status_html(PidginConvThemePrivate *priv, const char *dir) { char *file; if (priv->status_html) return priv->status_html; - file = g_build_filename(priv->style_dir, "Contents", "Resources", "Status.html", NULL); + file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { - purple_debug_info("webkit", "%s could not find Resources/Status.html", priv->style_dir); + purple_debug_info("webkit", "%s could not find Resources/Status.html", dir); priv->status_html = g_strdup(""); } g_free(file); @@ -267,14 +258,14 @@ get_status_html(PidginConvThemePrivate *priv) } static const char * -get_basestyle_css(PidginConvThemePrivate *priv) +get_basestyle_css(PidginConvThemePrivate *priv, const char *dir) { char *file; if (priv->basestyle_css) return priv->basestyle_css; - file = g_build_filename(priv->style_dir, "Contents", "Resources", "main.css", NULL); + file = g_build_filename(dir, "Contents", "Resources", "main.css", NULL); if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL)) priv->basestyle_css = g_strdup(""); g_free(file); @@ -283,14 +274,14 @@ get_basestyle_css(PidginConvThemePrivate *priv) } static const char * -get_header_html(PidginConvThemePrivate *priv) +get_header_html(PidginConvThemePrivate *priv, const char *dir) { char *file; if (priv->header_html) return priv->header_html; - file = g_build_filename(priv->style_dir, "Contents", "Resources", "Header.html", NULL); + file = g_build_filename(dir, "Contents", "Resources", "Header.html", NULL); if (!g_file_get_contents(file, &priv->header_html, NULL, NULL)) priv->header_html = g_strdup(""); g_free(file); @@ -299,14 +290,14 @@ get_header_html(PidginConvThemePrivate *priv) } static const char * -get_footer_html(PidginConvThemePrivate *priv) +get_footer_html(PidginConvThemePrivate *priv, const char *dir) { char *file; if (priv->footer_html) return priv->footer_html; - file = g_build_filename(priv->style_dir, "Contents", "Resources", "Footer.html", NULL); + file = g_build_filename(dir, "Contents", "Resources", "Footer.html", NULL); if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL)) priv->footer_html = g_strdup(""); g_free(file); @@ -315,16 +306,16 @@ get_footer_html(PidginConvThemePrivate *priv) } static const char * -get_incoming_content_html(PidginConvThemePrivate *priv) +get_incoming_content_html(PidginConvThemePrivate *priv, const char *dir) { char *file; if (priv->incoming_content_html) return priv->incoming_content_html; - file = g_build_filename(priv->style_dir, "Contents", "Resources", "Incoming", "Content.html", NULL); + file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Content.html", NULL); if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) { - purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", priv->style_dir); + purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", dir); priv->incoming_content_html = g_strdup(""); } g_free(file); @@ -333,14 +324,14 @@ get_incoming_content_html(PidginConvThemePrivate *priv) } static const char * -get_incoming_next_content_html(PidginConvThemePrivate *priv) +get_incoming_next_content_html(PidginConvThemePrivate *priv, const char *dir) { char *file; if (priv->incoming_next_content_html) return priv->incoming_next_content_html; - file = g_build_filename(priv->style_dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); + file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) { priv->incoming_next_content_html = g_strdup(priv->incoming_content_html); } @@ -350,14 +341,14 @@ get_incoming_next_content_html(PidginConvThemePrivate *priv) } static const char * -get_outgoing_content_html(PidginConvThemePrivate *priv) +get_outgoing_content_html(PidginConvThemePrivate *priv, const char *dir) { char *file; if (priv->outgoing_content_html) return priv->outgoing_content_html; - file = g_build_filename(priv->style_dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); + file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) { priv->outgoing_content_html = g_strdup(priv->incoming_content_html); } @@ -367,14 +358,14 @@ get_outgoing_content_html(PidginConvThemePrivate *priv) } static const char * -get_outgoing_next_content_html(PidginConvThemePrivate *priv) +get_outgoing_next_content_html(PidginConvThemePrivate *priv, const char *dir) { char *file; if (priv->outgoing_next_content_html) return priv->outgoing_next_content_html; - file = g_build_filename(priv->style_dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); + file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { priv->outgoing_next_content_html = g_strdup(priv->outgoing_content_html); } @@ -451,6 +442,7 @@ replace_template_tokens(PidginConvTheme *theme, const char *text, const char *he { PidginConvThemePrivate *priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); GString *str = g_string_new(NULL); + const char *themedir; char **ms = g_strsplit(text, "%@", 6); char *base = NULL; @@ -461,15 +453,17 @@ replace_template_tokens(PidginConvTheme *theme, const char *text, const char *he return NULL; } + themedir = purple_theme_get_dir(PURPLE_THEME(theme)); + g_string_append(str, ms[0]); g_string_append(str, "file://"); - base = g_build_filename(priv->style_dir, "Contents", "Resources", "Template.html", NULL); + base = g_build_filename(themedir, "Contents", "Resources", "Template.html", NULL); g_string_append(str, base); g_free(base); g_string_append(str, ms[1]); - g_string_append(str, get_basestyle_css(priv)); + g_string_append(str, get_basestyle_css(priv, themedir)); g_string_append(str, ms[2]); @@ -494,16 +488,22 @@ set_theme_webkit_settings(WebKitWebView *webview, PidginConvTheme *theme) { PidginConvThemePrivate *priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); WebKitWebSettings *settings; + const GValue *val; g_object_get(G_OBJECT(webview), "settings", &settings, NULL); - if (priv->default_font_family) - g_object_set(G_OBJECT(settings), "default-font-family", priv->default_font_family, NULL); - if (priv->default_font_size) - g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(priv->default_font_size), NULL); + val = get_key(priv, "DefaultFontFamily", TRUE); + if (val) + g_object_set(G_OBJECT(settings), "default-font-family", g_value_get_string(val), NULL); + + val = get_key(priv, "DefaultFontSize", TRUE); + if (val) + g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(g_value_get_int(val)), NULL); - /* this does not work :( */ - webkit_web_view_set_transparent(webview, priv->default_background_is_transparent); + val = get_key(priv, "DefaultBackgroundIsTransparent", TRUE); + if (val) + /* this does not work :( */ + webkit_web_view_set_transparent(webview, g_value_get_boolean(val)); } /* @@ -555,12 +555,14 @@ void pidgin_conversation_theme_save_state(const PidginConvTheme *theme) { PidginConvThemePrivate *priv; + const GValue *val; char *prefname; char *variant; priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", priv->cf_bundle_identifier); + val = get_key(priv, "CFBundleIdentifier", FALSE); + prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", g_value_get_string(val)); variant = g_strdup_printf("%s/variant", prefname); purple_debug_info("webkit", "saving state with variant %s\n", priv->variant); @@ -576,6 +578,7 @@ static void pidgin_conversation_theme_load_state(PidginConvTheme *theme) { PidginConvThemePrivate *priv; + const GValue *val; char *prefname; char *variant; const char* value; @@ -583,7 +586,8 @@ pidgin_conversation_theme_load_state(PidginConvTheme *theme) priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", priv->cf_bundle_identifier); + val = get_key(priv, "CFBundleIdentifier", FALSE); + prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", g_value_get_string(val)); variant = g_strdup_printf("%s/variant", prefname); value = purple_prefs_get_string(variant); @@ -603,24 +607,10 @@ pidgin_conversation_theme_copy(const PidginConvTheme *theme) PidginConvThemePrivate *old, *new; old = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - ret = g_object_new(PIDGIN_TYPE_CONV_THEME, "directory", old->style_dir, NULL); + ret = g_object_new(PIDGIN_TYPE_CONV_THEME, "directory", purple_theme_get_dir(PURPLE_THEME(theme)), NULL); new = PIDGIN_CONV_THEME_GET_PRIVATE(ret); new->variant = g_strdup(old->variant); - new->message_view_version = old->message_view_version; - new->cf_bundle_name = g_strdup(old->cf_bundle_name); - new->cf_bundle_identifier = g_strdup(old->cf_bundle_identifier); - new->cf_bundle_get_info_string = g_strdup(old->cf_bundle_get_info_string); - new->default_font_family = g_strdup(old->default_font_family); - new->default_font_size = old->default_font_size; - new->shows_user_icons = old->shows_user_icons; - new->disable_combine_consecutive = old->disable_combine_consecutive; - new->default_background_is_transparent = old->default_background_is_transparent; - new->disable_custom_background = old->disable_custom_background; - new->default_background_color = g_strdup(old->default_background_color); - new->allow_text_colors = old->allow_text_colors; - new->image_mask = g_strdup(old->image_mask); - new->default_variant = g_strdup(old->default_variant); new->template_html = g_strdup(old->template_html); new->header_html = g_strdup(old->header_html); @@ -673,8 +663,7 @@ pidgin_conversation_theme_get_variants(PidginConvTheme *theme) priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - g_assert(priv->style_dir); - variant_dir = g_build_filename(priv->style_dir, "Contents", "Resources", "Variants", NULL); + variant_dir = g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), "Contents", "Resources", "Variants", NULL); variants = g_dir_open(variant_dir, 0, NULL); if (!variants) @@ -699,14 +688,16 @@ char * pidgin_conversation_theme_get_css(PidginConvTheme *theme) { PidginConvThemePrivate *priv; + const char *dir; priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + dir = purple_theme_get_dir(PURPLE_THEME(theme)); if (!priv->variant) { - return g_build_filename(priv->style_dir, "Contents", "Resources", "main.css", NULL); + return g_build_filename(dir, "Contents", "Resources", "main.css", NULL); } else { char *file = g_strdup_printf("%s.css", priv->variant); - char *ret = g_build_filename(priv->style_dir, "Contents", "Resources", "Variants", file, NULL); + char *ret = g_build_filename(dir, "Contents", "Resources", "Variants", file, NULL); g_free(file); return ret; } @@ -727,6 +718,7 @@ void pidgin_conversation_theme_apply(PidginConvTheme *theme, PurpleConversation *conv) { GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; + const char *themedir; char *header, *footer; char *template; char *basedir; @@ -743,16 +735,18 @@ pidgin_conversation_theme_apply(PidginConvTheme *theme, PurpleConversation *conv g_assert(theme); - header = replace_header_tokens(get_header_html(priv), conv); - footer = replace_header_tokens(get_footer_html(priv), conv); - template = replace_template_tokens(theme, get_template_html(priv), header, footer); + themedir = purple_theme_get_dir(PURPLE_THEME(theme)); + + header = replace_header_tokens(get_header_html(priv, themedir), conv); + footer = replace_header_tokens(get_footer_html(priv, themedir), conv); + template = replace_template_tokens(theme, get_template_html(priv, themedir), header, footer); g_assert(template); purple_debug_info("webkit", "template: %s\n", template); set_theme_webkit_settings(WEBKIT_WEB_VIEW(webkit), theme); - basedir = g_build_filename(priv->style_dir, "Contents", "Resources", "Template.html", NULL); + basedir = g_build_filename(themedir, "Contents", "Resources", "Template.html", NULL); baseuri = g_strdup_printf("file://%s", basedir); webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); -- cgit v1.2.1 From ec381418e5711c9507280efac4d86ba1f1d3e08c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 02:53:08 +0000 Subject: Register the conversation theme loader on gtkconv initialization. --- pidgin/gtkconv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 9f35ec4d33..8cc5e5a888 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -52,6 +52,8 @@ #include "notify.h" #include "prpl.h" #include "request.h" +#include "theme-loader.h" +#include "theme-manager.h" #include "util.h" #include "version.h" @@ -59,6 +61,8 @@ #include "gtkblist.h" #include "gtkconv.h" #include "gtkconvwin.h" +#include "gtkconv-theme.h" +#include "gtkconv-theme-loader.h" #include "gtkdialogs.h" #include "gtkimhtml.h" #include "gtkimhtmltoolbar.h" @@ -8120,6 +8124,8 @@ pidgin_conversations_init(void) purple_signal_connect(purple_conversations_get_handle(), "wrote-chat-msg", handle, PURPLE_CALLBACK(wrote_msg_update_unseen_cb), NULL); + purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_CONV_THEME_LOADER, "type", "conversation", NULL)); + { /* Set default tab colors */ GString *str = g_string_new(NULL); -- cgit v1.2.1 From 8d8d23416f72c41d22277f429212d56a7decaa78 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 02:56:08 +0000 Subject: Add a prefs combo for the conversation theme. Variants are added as separate entries, which is much much too long, but that can be fixed later. Note: These preferences are not applied anywhere! --- pidgin/gtkprefs.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index c950214fd9..e5e07a5dbc 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -45,6 +45,7 @@ #include "gtkblist.h" #include "gtkconv.h" +#include "gtkconv-theme.h" #include "gtkdebug.h" #include "gtkdialogs.h" #include "gtkimhtml.h" @@ -83,6 +84,7 @@ static GtkWidget *sample_imhtml = NULL; /* Themes page */ static GtkWidget *prefs_sound_themes_combo_box; static GtkWidget *prefs_blist_themes_combo_box; +static GtkWidget *prefs_conv_themes_combo_box; static GtkWidget *prefs_status_themes_combo_box; static GtkWidget *prefs_smiley_themes_combo_box; @@ -94,6 +96,7 @@ static gboolean prefs_sound_themes_loading; /* These exist outside the lifetime of the prefs dialog */ static GtkListStore *prefs_sound_themes; static GtkListStore *prefs_blist_themes; +static GtkListStore *prefs_conv_themes; static GtkListStore *prefs_status_icon_themes; static GtkListStore *prefs_smiley_themes; @@ -339,6 +342,7 @@ delete_prefs(GtkWidget *asdf, void *gdsa) prefs_sound_themes_combo_box = NULL; prefs_blist_themes_combo_box = NULL; + prefs_conv_themes_combo_box = NULL; prefs_status_themes_combo_box = NULL; prefs_smiley_themes_combo_box = NULL; @@ -490,6 +494,30 @@ prefs_themes_sort(PurpleTheme *theme) g_free(markup); if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); + + } else if (PIDGIN_IS_CONV_THEME(theme)) { + GList *variants; + + /* No image available? */ + + name = purple_theme_get_name(theme); + /* No author available */ + /* No description available */ + + /* We'll re-use the description field to show variants... + * This is probably too long to be useful... Will fix later... + */ + for (variants = pidgin_conversation_theme_get_variants(PIDGIN_CONV_THEME(theme)); + variants; + variants = g_list_delete_link(variants, variants)) { + + markup = get_theme_markup(name, FALSE, NULL, variants->data); + + gtk_list_store_append(prefs_conv_themes, &iter); + gtk_list_store_set(prefs_conv_themes, &iter, 1, markup, 2, name, -1); + + g_free(variants->data); + } } } @@ -545,6 +573,9 @@ prefs_themes_refresh(void) gtk_list_store_set(prefs_blist_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); g_free(tmp); + /* conversation themes */ + gtk_list_store_clear(prefs_conv_themes); + /* status icon themes */ gtk_list_store_clear(prefs_status_icon_themes); gtk_list_store_append(prefs_status_icon_themes, &iter); @@ -565,6 +596,7 @@ prefs_themes_refresh(void) /* set active */ prefs_set_active_theme_combo(prefs_sound_themes_combo_box, prefs_sound_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme")); prefs_set_active_theme_combo(prefs_blist_themes_combo_box, prefs_blist_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme")); + prefs_set_active_theme_combo(prefs_conv_themes_combo_box, prefs_conv_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversation/theme")); prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); prefs_set_active_theme_combo(prefs_smiley_themes_combo_box, prefs_smiley_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme")); prefs_sound_themes_loading = FALSE; @@ -578,6 +610,8 @@ prefs_themes_init(void) prefs_blist_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); + prefs_conv_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); + prefs_status_icon_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); prefs_smiley_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); @@ -1019,6 +1053,27 @@ prefs_set_blist_theme_cb(GtkComboBox *combo_box, gpointer user_data) } } +/* sets the current conversation theme */ +static void +prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) +{ + PidginConvTheme *theme = NULL; + GtkTreeIter iter; + gchar *name = NULL; + + if (gtk_combo_box_get_active_iter(combo_box, &iter)) { + + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); + + if(!name || !g_str_equal(name, "")) + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + + g_free(name); + + purple_debug_info("theme", "Setting conversation theme...\n"); + } +} + /* sets the current icon theme */ static void prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data) @@ -1101,6 +1156,12 @@ theme_page(void) (GCallback)prefs_set_blist_theme_cb, NULL, _("Buddy List Theme:"), PIDGIN_PREFS_ROOT "/blist/theme", "blist"); + /* Conversation Themes */ + prefs_conv_themes_combo_box = add_theme_prefs_combo( + vbox, combo_sg, label_sg, prefs_conv_themes, + (GCallback)prefs_set_conv_theme_cb, NULL, + _("Conversation Theme:"), PIDGIN_PREFS_ROOT "/conversation/theme", "conversation"); + /* Status Icon Themes */ prefs_status_themes_combo_box = add_theme_prefs_combo( vbox, combo_sg, label_sg, prefs_status_icon_themes, @@ -2866,6 +2927,10 @@ pidgin_prefs_init(void) /* Themes */ prefs_themes_init(); + /* Conversation Themes */ + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversation"); + purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversation/theme", "Default"); + /* Smiley Themes */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/smileys"); purple_prefs_add_string(PIDGIN_PREFS_ROOT "/smileys/theme", "Default"); -- cgit v1.2.1 From ac336dafddd22488e62a6a26a5e7c4150ddfbbaf Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 03:10:41 +0000 Subject: Fix theme variant pref names. --- pidgin/gtkconv-theme.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 759379063d..6c72a9132a 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -562,7 +562,7 @@ pidgin_conversation_theme_save_state(const PidginConvTheme *theme) priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); val = get_key(priv, "CFBundleIdentifier", FALSE); - prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", g_value_get_string(val)); + prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversation/themes/%s", g_value_get_string(val)); variant = g_strdup_printf("%s/variant", prefname); purple_debug_info("webkit", "saving state with variant %s\n", priv->variant); @@ -580,24 +580,21 @@ pidgin_conversation_theme_load_state(PidginConvTheme *theme) PidginConvThemePrivate *priv; const GValue *val; char *prefname; - char *variant; const char* value; gboolean changed; priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); val = get_key(priv, "CFBundleIdentifier", FALSE); - prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", g_value_get_string(val)); - variant = g_strdup_printf("%s/variant", prefname); + prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversation/themes/%s/variant", g_value_get_string(val)); - value = purple_prefs_get_string(variant); + value = purple_prefs_get_string(prefname); changed = !priv->variant || !g_str_equal(priv->variant, value); g_free(priv->variant); priv->variant = g_strdup(value); g_free(prefname); - g_free(variant); } PidginConvTheme * -- cgit v1.2.1 From ba2c8515a6031a0395ca6d4134723ef9666aa21e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 18:48:00 +0000 Subject: Load the list of variants when building the theme. --- pidgin/gtkconv-theme-loader.c | 25 ++++++++++ pidgin/gtkconv-theme.c | 111 ++++++++++-------------------------------- pidgin/gtkconv-theme.h | 9 ++-- pidgin/gtkprefs.c | 6 +-- 4 files changed, 58 insertions(+), 93 deletions(-) diff --git a/pidgin/gtkconv-theme-loader.c b/pidgin/gtkconv-theme-loader.c index ea3d3760cc..daa55cf023 100644 --- a/pidgin/gtkconv-theme-loader.c +++ b/pidgin/gtkconv-theme-loader.c @@ -109,6 +109,8 @@ pidgin_conv_loader_build(const gchar *dir) int MessageViewVersion; const char *CFBundleName; const char *CFBundleIdentifier; + GDir *variants; + char *variant_dir; g_return_val_if_fail(dir != NULL, NULL); @@ -168,6 +170,29 @@ pidgin_conv_loader_build(const gchar *dir) "directory", dir, "info", info, NULL); + /* Read list of variants */ + variant_dir = g_build_filename(dir, "Contents", "Resources", "Variants", NULL); + variants = g_dir_open(variant_dir, 0, NULL); + g_free(variant_dir); + + if (variants) { + const char *file; + char *name; + + while ((file = g_dir_read_name(variants)) != NULL) { + const char *end = g_strrstr(file, ".css"); + char *name; + + if ((end == NULL) || (*(end + 4) != '\0')) + continue; + + name = g_strndup(file, end - file); + pidgin_conversation_theme_add_variant(theme, name); + } + + g_dir_close(variants); + } + return PURPLE_THEME(theme); } diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 6c72a9132a..724cef06b0 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -47,6 +47,7 @@ typedef struct { /* current config options */ char *variant; /* allowed to be NULL if there are no variants */ + GList *variants; /* Info.plist keys/values */ GHashTable *info; @@ -552,51 +553,50 @@ pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info) } void -pidgin_conversation_theme_save_state(const PidginConvTheme *theme) +pidgin_conversation_theme_add_variant(PidginConvTheme *theme, const char *variant) { PidginConvThemePrivate *priv; - const GValue *val; - char *prefname; - char *variant; - priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - val = get_key(priv, "CFBundleIdentifier", FALSE); - prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversation/themes/%s", g_value_get_string(val)); - variant = g_strdup_printf("%s/variant", prefname); + priv->variants = g_list_prepend(priv->variants, g_strdup(variant)); +} - purple_debug_info("webkit", "saving state with variant %s\n", priv->variant); - purple_prefs_add_none(prefname); - purple_prefs_add_string(variant, ""); - purple_prefs_set_string(variant, priv->variant); +const char * +pidgin_conversation_theme_get_variant(PidginConvTheme *theme) +{ + PidginConvThemePrivate *priv; + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - g_free(prefname); - g_free(variant); + return g_strdup(priv->variant); } -static void -pidgin_conversation_theme_load_state(PidginConvTheme *theme) +void +pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant) { PidginConvThemePrivate *priv; const GValue *val; char *prefname; - const char* value; - gboolean changed; - priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - val = get_key(priv, "CFBundleIdentifier", FALSE); - prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversation/themes/%s/variant", g_value_get_string(val)); - - value = purple_prefs_get_string(prefname); - changed = !priv->variant || !g_str_equal(priv->variant, value); - g_free(priv->variant); - priv->variant = g_strdup(value); + priv->variant = g_strdup(variant); + val = get_key(priv, "CFBundleIdentifier", FALSE); + prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversation/themes/%s/variant", + g_value_get_string(val)); + purple_prefs_set_string(prefname, variant); g_free(prefname); } +const GList * +pidgin_conversation_theme_get_variants(PidginConvTheme *theme) +{ + PidginConvThemePrivate *priv; + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + return priv->variants; +} + PidginConvTheme * pidgin_conversation_theme_copy(const PidginConvTheme *theme) { @@ -622,65 +622,6 @@ pidgin_conversation_theme_copy(const PidginConvTheme *theme) return ret; } -void -pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant) -{ - PidginConvThemePrivate *priv; - - priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - - /* I'm not going to test whether this variant is valid! */ - g_free(priv->variant); - priv->variant = g_strdup(variant); - - /* todo, the style has "changed". Ideally, I would like to use signals at this point. */ -} - -char * -pidgin_conversation_theme_get_variant(PidginConvTheme *theme) -{ - PidginConvThemePrivate *priv; - priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - - return g_strdup(priv->variant); -} - -/** - * Get a list of variants supported by the style. - */ -GList * -pidgin_conversation_theme_get_variants(PidginConvTheme *theme) -{ - PidginConvThemePrivate *priv; - GList *ret = NULL; - GDir *variants; - const char *css_file; - char *css; - char *variant_dir; - - priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - - variant_dir = g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), "Contents", "Resources", "Variants", NULL); - - variants = g_dir_open(variant_dir, 0, NULL); - if (!variants) - return NULL; - - while ((css_file = g_dir_read_name(variants)) != NULL) { - if (!g_str_has_suffix(css_file, ".css")) - continue; - - css = g_strndup(css_file, strlen(css_file) - 4); - ret = g_list_append(ret, css); - } - - g_dir_close(variants); - g_free(variant_dir); - - ret = g_list_sort(ret, (GCompareFunc)g_strcmp0); - return ret; -} - char * pidgin_conversation_theme_get_css(PidginConvTheme *theme) { diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 1320add334..306af69000 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -72,13 +72,14 @@ GType pidgin_conversation_theme_get_type(void); const GHashTable *pidgin_conversation_theme_get_info(const PidginConvTheme *theme); void pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info); +void pidgin_conversation_theme_add_variant(PidginConvTheme *theme, const char *variant); +const char *pidgin_conversation_theme_get_variant(PidginConvTheme *theme); +void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant); +const GList *pidgin_conversation_theme_get_variants(PidginConvTheme *theme); + PidginConvTheme *pidgin_conversation_theme_load(const char *styledir); PidginConvTheme *pidgin_conversation_theme_copy(const PidginConvTheme *theme); void pidgin_conversation_theme_save_state(const PidginConvTheme *theme); -void pidgin_conversation_theme_read_info_plist(PidginConvTheme *theme, const char *variant); -char *pidgin_conversation_theme_get_variant(PidginConvTheme *theme); -GList *pidgin_conversation_theme_get_variants(PidginConvTheme *theme); -void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant); char *pidgin_conversation_theme_get_css(PidginConvTheme *theme); diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index e5e07a5dbc..49c8028df8 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -496,7 +496,7 @@ prefs_themes_sort(PurpleTheme *theme) g_object_unref(G_OBJECT(pixbuf)); } else if (PIDGIN_IS_CONV_THEME(theme)) { - GList *variants; + const GList *variants; /* No image available? */ @@ -509,14 +509,12 @@ prefs_themes_sort(PurpleTheme *theme) */ for (variants = pidgin_conversation_theme_get_variants(PIDGIN_CONV_THEME(theme)); variants; - variants = g_list_delete_link(variants, variants)) { + variants = g_list_next(variants)) { markup = get_theme_markup(name, FALSE, NULL, variants->data); gtk_list_store_append(prefs_conv_themes, &iter); gtk_list_store_set(prefs_conv_themes, &iter, 1, markup, 2, name, -1); - - g_free(variants->data); } } } -- cgit v1.2.1 From 2c7fcc50dd61ef3408aacd1787567a86fcd9e13a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 18:51:53 +0000 Subject: Use a consistent prefs name. It should be conversation*s* to match rest of the gtkconv code. --- pidgin/gtkconv-theme.c | 2 +- pidgin/gtkprefs.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 724cef06b0..03a744c138 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -582,7 +582,7 @@ pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *varian priv->variant = g_strdup(variant); val = get_key(priv, "CFBundleIdentifier", FALSE); - prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversation/themes/%s/variant", + prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", g_value_get_string(val)); purple_prefs_set_string(prefname, variant); g_free(prefname); diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 49c8028df8..0d3ec796f0 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -594,7 +594,7 @@ prefs_themes_refresh(void) /* set active */ prefs_set_active_theme_combo(prefs_sound_themes_combo_box, prefs_sound_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme")); prefs_set_active_theme_combo(prefs_blist_themes_combo_box, prefs_blist_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme")); - prefs_set_active_theme_combo(prefs_conv_themes_combo_box, prefs_conv_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversation/theme")); + prefs_set_active_theme_combo(prefs_conv_themes_combo_box, prefs_conv_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme")); prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); prefs_set_active_theme_combo(prefs_smiley_themes_combo_box, prefs_smiley_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme")); prefs_sound_themes_loading = FALSE; @@ -1158,7 +1158,7 @@ theme_page(void) prefs_conv_themes_combo_box = add_theme_prefs_combo( vbox, combo_sg, label_sg, prefs_conv_themes, (GCallback)prefs_set_conv_theme_cb, NULL, - _("Conversation Theme:"), PIDGIN_PREFS_ROOT "/conversation/theme", "conversation"); + _("Conversation Theme:"), PIDGIN_PREFS_ROOT "/conversations/theme", "conversation"); /* Status Icon Themes */ prefs_status_themes_combo_box = add_theme_prefs_combo( @@ -2926,8 +2926,8 @@ pidgin_prefs_init(void) prefs_themes_init(); /* Conversation Themes */ - purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversation"); - purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversation/theme", "Default"); + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); + purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/theme", "Default"); /* Smiley Themes */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/smileys"); -- cgit v1.2.1 From ef11a90c26dba3d35cfa3963ba1ead985bf70335 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 20:23:13 +0000 Subject: Fix a leak. pidgin_conversation_theme_add_variant should only be used by the theme builder, so it's fine if we let it take ownership of the variant name string. --- pidgin/gtkconv-theme.c | 4 ++-- pidgin/gtkconv-theme.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 03a744c138..3e8ef0d820 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -553,12 +553,12 @@ pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info) } void -pidgin_conversation_theme_add_variant(PidginConvTheme *theme, const char *variant) +pidgin_conversation_theme_add_variant(PidginConvTheme *theme, char *variant) { PidginConvThemePrivate *priv; priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - priv->variants = g_list_prepend(priv->variants, g_strdup(variant)); + priv->variants = g_list_prepend(priv->variants, variant); } const char * diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 306af69000..e7b4a71b1a 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -72,7 +72,7 @@ GType pidgin_conversation_theme_get_type(void); const GHashTable *pidgin_conversation_theme_get_info(const PidginConvTheme *theme); void pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info); -void pidgin_conversation_theme_add_variant(PidginConvTheme *theme, const char *variant); +void pidgin_conversation_theme_add_variant(PidginConvTheme *theme, char *variant); const char *pidgin_conversation_theme_get_variant(PidginConvTheme *theme); void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant); const GList *pidgin_conversation_theme_get_variants(PidginConvTheme *theme); -- cgit v1.2.1 From e8bdf71eb4d506b7e7268cdc2ff9916725d671b4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 20:31:33 +0000 Subject: Use a consistent debugging domain. --- pidgin/gtkconv-theme-loader.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pidgin/gtkconv-theme-loader.c b/pidgin/gtkconv-theme-loader.c index daa55cf023..670607eea6 100644 --- a/pidgin/gtkconv-theme-loader.c +++ b/pidgin/gtkconv-theme-loader.c @@ -119,21 +119,25 @@ pidgin_conv_loader_build(const gchar *dir) plist = xmlnode_from_file(contents, "Info.plist", "Info.plist", "gtkconv-theme-loader"); g_free(contents); if (plist == NULL) { - purple_debug_error("gtkconv-theme", "Failed to load Contents/Info.plist in %s\n", dir); + purple_debug_error("gtkconv-theme-loader", + "Failed to load Contents/Info.plist in %s\n", dir); return NULL; } info = read_info_plist(plist); xmlnode_free(plist); if (info == NULL) { - purple_debug_error("gtkconv-theme", "Failed to load Contents/Info.plist in %s\n", dir); + purple_debug_error("gtkconv-theme-loader", + "Failed to load Contents/Info.plist in %s\n", dir); return NULL; } /* Check for required keys: CFBundleName */ val = g_hash_table_lookup(info, "CFBundleName"); if (!val) { - purple_debug_error("gtkconv-theme", "%s/Contents/Info.plist missing required key CFBundleName.\n", dir); + purple_debug_error("gtkconv-theme-loader", + "%s/Contents/Info.plist missing required key CFBundleName.\n", + dir); g_hash_table_destroy(info); return NULL; } @@ -142,7 +146,9 @@ pidgin_conv_loader_build(const gchar *dir) /* Check for required keys: CFBundleIdentifier */ val = g_hash_table_lookup(info, "CFBundleIdentifier"); if (!val) { - purple_debug_error("gtkconv-theme", "%s/Contents/Info.plist missing required key CFBundleIdentifier.\n", dir); + purple_debug_error("gtkconv-theme-loader", + "%s/Contents/Info.plist missing required key CFBundleIdentifier.\n", + dir); g_hash_table_destroy(info); return NULL; } @@ -151,15 +157,18 @@ pidgin_conv_loader_build(const gchar *dir) /* Check for required keys: MessageViewVersion */ val = g_hash_table_lookup(info, "MessageViewVersion"); if (!val) { - purple_debug_error("gtkconv-theme", "%s/Contents/Info.plist missing required key MessageViewVersion.\n", dir); + purple_debug_error("gtkconv-theme-loader", + "%s/Contents/Info.plist missing required key MessageViewVersion.\n", + dir); g_hash_table_destroy(info); return NULL; } MessageViewVersion = g_value_get_int(val); if (MessageViewVersion < 3) { - purple_debug_error("gtkconv-theme", "%s is a legacy style (version %d) and will not be loaded.\n", - CFBundleName, MessageViewVersion); + purple_debug_error("gtkconv-theme-loader", + "%s is a legacy style (version %d) and will not be loaded.\n", + CFBundleName, MessageViewVersion); g_hash_table_destroy(info); return NULL; } -- cgit v1.2.1 From 452348cfccc8962ab1492e6a1852b182289fd98b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 20:36:05 +0000 Subject: Be a bit stricter about types in Info.plist. --- pidgin/gtkconv-theme-loader.c | 12 ++++++------ pidgin/gtkconv-theme.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pidgin/gtkconv-theme-loader.c b/pidgin/gtkconv-theme-loader.c index 670607eea6..d726121f87 100644 --- a/pidgin/gtkconv-theme-loader.c +++ b/pidgin/gtkconv-theme-loader.c @@ -134,9 +134,9 @@ pidgin_conv_loader_build(const gchar *dir) /* Check for required keys: CFBundleName */ val = g_hash_table_lookup(info, "CFBundleName"); - if (!val) { + if (!val || !G_VALUE_HOLDS_STRING(val)) { purple_debug_error("gtkconv-theme-loader", - "%s/Contents/Info.plist missing required key CFBundleName.\n", + "%s/Contents/Info.plist missing required string key CFBundleName.\n", dir); g_hash_table_destroy(info); return NULL; @@ -145,9 +145,9 @@ pidgin_conv_loader_build(const gchar *dir) /* Check for required keys: CFBundleIdentifier */ val = g_hash_table_lookup(info, "CFBundleIdentifier"); - if (!val) { + if (!val || !G_VALUE_HOLDS_STRING(val)) { purple_debug_error("gtkconv-theme-loader", - "%s/Contents/Info.plist missing required key CFBundleIdentifier.\n", + "%s/Contents/Info.plist missing required string key CFBundleIdentifier.\n", dir); g_hash_table_destroy(info); return NULL; @@ -156,9 +156,9 @@ pidgin_conv_loader_build(const gchar *dir) /* Check for required keys: MessageViewVersion */ val = g_hash_table_lookup(info, "MessageViewVersion"); - if (!val) { + if (!val || !G_VALUE_HOLDS_INT(val)) { purple_debug_error("gtkconv-theme-loader", - "%s/Contents/Info.plist missing required key MessageViewVersion.\n", + "%s/Contents/Info.plist missing required integer key MessageViewVersion.\n", dir); g_hash_table_destroy(info); return NULL; diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 3e8ef0d820..596b70feb3 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -494,15 +494,15 @@ set_theme_webkit_settings(WebKitWebView *webview, PidginConvTheme *theme) g_object_get(G_OBJECT(webview), "settings", &settings, NULL); val = get_key(priv, "DefaultFontFamily", TRUE); - if (val) + if (val && G_VALUE_HOLDS_STRING(val)) g_object_set(G_OBJECT(settings), "default-font-family", g_value_get_string(val), NULL); val = get_key(priv, "DefaultFontSize", TRUE); - if (val) + if (val && G_VALUE_HOLDS_INT(val)) g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(g_value_get_int(val)), NULL); val = get_key(priv, "DefaultBackgroundIsTransparent", TRUE); - if (val) + if (val && G_VALUE_HOLDS_BOOLEAN(val)) /* this does not work :( */ webkit_web_view_set_transparent(webview, g_value_get_boolean(val)); } -- cgit v1.2.1 From 1c5e3d5850b4cca227c0848a307f5705a2f97125 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 20:39:09 +0000 Subject: Remove old prototypes. --- pidgin/gtkconv-theme.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index e7b4a71b1a..9d83cf7c90 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -77,9 +77,7 @@ const char *pidgin_conversation_theme_get_variant(PidginConvTheme *theme); void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant); const GList *pidgin_conversation_theme_get_variants(PidginConvTheme *theme); -PidginConvTheme *pidgin_conversation_theme_load(const char *styledir); PidginConvTheme *pidgin_conversation_theme_copy(const PidginConvTheme *theme); -void pidgin_conversation_theme_save_state(const PidginConvTheme *theme); char *pidgin_conversation_theme_get_css(PidginConvTheme *theme); -- cgit v1.2.1 From b577744e2e6f98b4dd86d7d42bd323b24ef17a76 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 21:03:21 +0000 Subject: Set the default variant when loading the theme. The priorities are value-from-prefs > default-from-theme > first-name-read. --- pidgin/gtkconv-theme-loader.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv-theme-loader.c b/pidgin/gtkconv-theme-loader.c index d726121f87..87c7bdc604 100644 --- a/pidgin/gtkconv-theme-loader.c +++ b/pidgin/gtkconv-theme-loader.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#include "pidgin.h" #include "gtkconv-theme-loader.h" #include "gtkconv-theme.h" @@ -185,8 +186,31 @@ pidgin_conv_loader_build(const gchar *dir) g_free(variant_dir); if (variants) { + char *prefname; + const char *default_variant = NULL; const char *file; - char *name; + + /* Try user-set variant */ + prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", + CFBundleIdentifier); + default_variant = purple_prefs_get_string(prefname); + g_free(prefname); + + if (default_variant && *default_variant) { + pidgin_conversation_theme_set_variant(theme, default_variant); + + } else { + /* Try theme default */ + val = g_hash_table_lookup(info, "DefaultVariant"); + if (val && G_VALUE_HOLDS_STRING(val)) { + default_variant = g_value_get_string(val); + if (default_variant && *default_variant) + pidgin_conversation_theme_set_variant(theme, default_variant); + else + default_variant = NULL; + } else + default_variant = NULL; + } while ((file = g_dir_read_name(variants)) != NULL) { const char *end = g_strrstr(file, ".css"); @@ -197,6 +221,12 @@ pidgin_conv_loader_build(const gchar *dir) name = g_strndup(file, end - file); pidgin_conversation_theme_add_variant(theme, name); + + /* Set variant with first found */ + if (!default_variant) { + pidgin_conversation_theme_set_variant(theme, name); + default_variant = name; + } } g_dir_close(variants); -- cgit v1.2.1 From a2d9fef15da1d09fb1482c9a2cc9b825e3f25a4f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 21:03:41 +0000 Subject: Add documentation for conversation themes. --- pidgin/gtkconv-theme.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 9d83cf7c90..091f2a22eb 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -69,12 +69,65 @@ G_BEGIN_DECLS */ GType pidgin_conversation_theme_get_type(void); +/** + * Get the Info.plist hash table from a conversation theme. + * + * @param theme The conversation theme + * + * @return The hash table. Keys are strings as outlined for message styles, + * values are GValue*s. This is an internal structure. Take a ref if + * necessary, but don't destroy it yourself. + */ const GHashTable *pidgin_conversation_theme_get_info(const PidginConvTheme *theme); + +/** + * Set the Info.plist hash table for a conversation theme. + * + * @param theme The conversation theme + * @param info The new hash table. The theme will take ownership of this hash + * table. Do not use it yourself afterwards with holding a ref. + * For key and value specifications, @see pidgin_conversation_theme_get_info. + * + */ void pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info); +/** + * Add an available variant name to a conversation theme. + * + * @param theme The conversation theme + * @param variant The name of the variant + * + * @Note The conversation theme will take ownership of the variant name string. + * This function should normally only be called by the theme loader. + */ void pidgin_conversation_theme_add_variant(PidginConvTheme *theme, char *variant); + +/** + * Get the currently set variant name for a conversation theme. + * + * @param theme The conversation theme + * + * @return The current variant name. + */ const char *pidgin_conversation_theme_get_variant(PidginConvTheme *theme); + +/** + * Set the variant name for a conversation theme. + * + * @param theme The conversation theme + * @param variant The name of the variant + * + */ void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant); + +/** + * Get a list of available variants for a conversation theme. + * + * @param theme The conversation theme + * + * @return The list of variants. This GList and the string data are owned by + * the theme and should not be freed by the caller. + */ const GList *pidgin_conversation_theme_get_variants(PidginConvTheme *theme); PidginConvTheme *pidgin_conversation_theme_copy(const PidginConvTheme *theme); -- cgit v1.2.1 From 17c799ed1a5cceffaf7967d68c3cb77e94d815c2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 19 Sep 2011 23:22:10 +0000 Subject: Avoid an error log for non-existent prefs. --- pidgin/gtkconv-theme-loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv-theme-loader.c b/pidgin/gtkconv-theme-loader.c index 87c7bdc604..e6d7369184 100644 --- a/pidgin/gtkconv-theme-loader.c +++ b/pidgin/gtkconv-theme-loader.c @@ -193,7 +193,8 @@ pidgin_conv_loader_build(const gchar *dir) /* Try user-set variant */ prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", CFBundleIdentifier); - default_variant = purple_prefs_get_string(prefname); + if (purple_prefs_exists(prefname)) + default_variant = purple_prefs_get_string(prefname); g_free(prefname); if (default_variant && *default_variant) { -- cgit v1.2.1 From b3f3e2bffedc48134fad35f2baf83a16989b9883 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 21 Sep 2011 00:24:10 +0000 Subject: Add an accessor for template data. Also, fix some fallbacks. --- pidgin/gtkconv-theme.c | 230 +++++++++++++++++++++++++++++++++++++++++++------ pidgin/gtkconv-theme.h | 20 +++++ 2 files changed, 226 insertions(+), 24 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 596b70feb3..bdcf552b31 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -56,11 +56,17 @@ typedef struct { char *template_html; char *header_html; char *footer_html; + char *topic_html; + char *status_html; + char *content_html; char *incoming_content_html; char *outgoing_content_html; char *incoming_next_content_html; char *outgoing_next_content_html; - char *status_html; + char *incoming_context_html; + char *outgoing_context_html; + char *incoming_next_context_html; + char *outgoing_next_context_html; char *basestyle_css; } PidginConvThemePrivate; @@ -132,10 +138,19 @@ pidgin_conv_theme_finalize(GObject *obj) priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj); g_free(priv->template_html); + g_free(priv->header_html); + g_free(priv->footer_html); + g_free(priv->topic_html); + g_free(priv->status_html); + g_free(priv->content_html); g_free(priv->incoming_content_html); g_free(priv->outgoing_content_html); + g_free(priv->incoming_next_content_html); g_free(priv->outgoing_next_content_html); - g_free(priv->status_html); + g_free(priv->incoming_context_html); + g_free(priv->outgoing_context_html); + g_free(priv->incoming_next_context_html); + g_free(priv->outgoing_next_context_html); g_free(priv->basestyle_css); if (priv->info) @@ -240,24 +255,6 @@ get_template_html(PidginConvThemePrivate *priv, const char *dir) return priv->template_html; } -static const char * -get_status_html(PidginConvThemePrivate *priv, const char *dir) -{ - char *file; - - if (priv->status_html) - return priv->status_html; - - file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); - if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { - purple_debug_info("webkit", "%s could not find Resources/Status.html", dir); - priv->status_html = g_strdup(""); - } - g_free(file); - - return priv->status_html; -} - static const char * get_basestyle_css(PidginConvThemePrivate *priv, const char *dir) { @@ -306,6 +303,60 @@ get_footer_html(PidginConvThemePrivate *priv, const char *dir) return priv->footer_html; } +static const char * +get_topic_html(PidginConvThemePrivate *priv, const char *dir) +{ + char *file; + + if (priv->topic_html) + return priv->topic_html; + + file = g_build_filename(dir, "Contents", "Resources", "Topic.html", NULL); + if (!g_file_get_contents(file, &priv->topic_html, NULL, NULL)) { + purple_debug_info("webkit", "%s could not find Resources/Topic.html", dir); + priv->topic_html = g_strdup(""); + } + g_free(file); + + return priv->topic_html; +} + +static const char * +get_status_html(PidginConvThemePrivate *priv, const char *dir) +{ + char *file; + + if (priv->status_html) + return priv->status_html; + + file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); + if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { + purple_debug_info("webkit", "%s could not find Resources/Status.html", dir); + priv->status_html = g_strdup(""); + } + g_free(file); + + return priv->status_html; +} + +static const char * +get_content_html(PidginConvThemePrivate *priv, const char *dir) +{ + char *file; + + if (priv->content_html) + return priv->content_html; + + file = g_build_filename(dir, "Contents", "Resources", "Content.html", NULL); + if (!g_file_get_contents(file, &priv->content_html, NULL, NULL)) { + purple_debug_info("webkit", "%s did not have a Content.html\n", dir); + priv->content_html = g_strdup(""); + } + g_free(file); + + return priv->content_html; +} + static const char * get_incoming_content_html(PidginConvThemePrivate *priv, const char *dir) { @@ -317,7 +368,7 @@ get_incoming_content_html(PidginConvThemePrivate *priv, const char *dir) file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Content.html", NULL); if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) { purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", dir); - priv->incoming_content_html = g_strdup(""); + priv->incoming_content_html = g_strdup(get_content_html(priv, dir)); } g_free(file); @@ -334,13 +385,48 @@ get_incoming_next_content_html(PidginConvThemePrivate *priv, const char *dir) file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) { - priv->incoming_next_content_html = g_strdup(priv->incoming_content_html); + priv->incoming_next_content_html = g_strdup(get_incoming_content_html(priv, dir)); } g_free(file); return priv->incoming_next_content_html; } +static const char * +get_incoming_context_html(PidginConvThemePrivate *priv, const char *dir) +{ + char *file; + + if (priv->incoming_context_html) + return priv->incoming_context_html; + + file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Context.html", NULL); + if (!g_file_get_contents(file, &priv->incoming_context_html, NULL, NULL)) { + purple_debug_info("webkit", "%s did not have a Incoming/Context.html\n", dir); + priv->incoming_context_html = g_strdup(get_incoming_content_html(priv, dir)); + } + g_free(file); + + return priv->incoming_context_html; +} + +static const char * +get_incoming_next_context_html(PidginConvThemePrivate *priv, const char *dir) +{ + char *file; + + if (priv->incoming_next_context_html) + return priv->incoming_next_context_html; + + file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContext.html", NULL); + if (!g_file_get_contents(file, &priv->incoming_next_context_html, NULL, NULL)) { + priv->incoming_next_context_html = g_strdup(get_incoming_context_html(priv, dir)); + } + g_free(file); + + return priv->incoming_next_context_html; +} + static const char * get_outgoing_content_html(PidginConvThemePrivate *priv, const char *dir) { @@ -351,7 +437,7 @@ get_outgoing_content_html(PidginConvThemePrivate *priv, const char *dir) file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) { - priv->outgoing_content_html = g_strdup(priv->incoming_content_html); + priv->outgoing_content_html = g_strdup(get_incoming_content_html(priv, dir)); } g_free(file); @@ -368,12 +454,45 @@ get_outgoing_next_content_html(PidginConvThemePrivate *priv, const char *dir) file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { - priv->outgoing_next_content_html = g_strdup(priv->outgoing_content_html); + priv->outgoing_next_content_html = g_strdup(get_outgoing_content_html(priv, dir)); } return priv->outgoing_next_content_html; } +static const char * +get_outgoing_context_html(PidginConvThemePrivate *priv, const char *dir) +{ + char *file; + + if (priv->outgoing_context_html) + return priv->outgoing_context_html; + + file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Context.html", NULL); + if (!g_file_get_contents(file, &priv->outgoing_context_html, NULL, NULL)) { + priv->outgoing_context_html = g_strdup(get_incoming_context_html(priv, dir)); + } + g_free(file); + + return priv->outgoing_context_html; +} + +static const char * +get_outgoing_next_context_html(PidginConvThemePrivate *priv, const char *dir) +{ + char *file; + + if (priv->outgoing_next_context_html) + return priv->outgoing_next_context_html; + + file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContext.html", NULL); + if (!g_file_get_contents(file, &priv->outgoing_next_context_html, NULL, NULL)) { + priv->outgoing_next_context_html = g_strdup(get_outgoing_context_html(priv, dir)); + } + + return priv->outgoing_next_context_html; +} + static char * replace_header_tokens(const char *text, PurpleConversation *conv) { @@ -552,6 +671,69 @@ pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info) priv->info = info; } +const char * +pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTemplateType type) +{ + PidginConvThemePrivate *priv; + const char *dir; + const char *html; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + dir = purple_theme_get_dir(PURPLE_THEME(theme)); + + switch (type) { + case PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN: + html = get_template_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER: + html = get_header_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER: + html = get_footer_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_TOPIC: + html = get_topic_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS: + html = get_status_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_CONTENT: + html = get_content_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT: + html = get_incoming_content_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT: + html = get_incoming_next_content_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTEXT: + html = get_incoming_context_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTEXT: + html = get_incoming_next_context_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT: + html = get_outgoing_content_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT: + html = get_outgoing_next_content_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTEXT: + html = get_outgoing_context_html(priv, dir); + break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTEXT: + html = get_outgoing_next_context_html(priv, dir); + break; + default: + purple_debug_error("gtkconv-theme", + "Requested invalid template type (%d) for theme %s.\n", + type, purple_theme_get_name(PURPLE_THEME(theme))); + html = NULL; + } + + return html; +} + void pidgin_conversation_theme_add_variant(PidginConvTheme *theme, char *variant) { diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 091f2a22eb..41c536ace7 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -58,6 +58,24 @@ struct _PidginConvThemeClass PurpleThemeClass parent_class; }; +typedef enum { + PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN, + PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER, + PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER, + PIDGIN_CONVERSATION_THEME_TEMPLATE_TOPIC, + PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS, + PIDGIN_CONVERSATION_THEME_TEMPLATE_CONTENT, + PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT, + PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT, + PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTEXT, + PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTEXT, + PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT, + PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT, + PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTEXT, + PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTEXT + +} PidginConvThemeTemplateType; + /**************************************************************************/ /** @name Pidgin Conversation Theme API */ /**************************************************************************/ @@ -91,6 +109,8 @@ const GHashTable *pidgin_conversation_theme_get_info(const PidginConvTheme *them */ void pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info); +const char *pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTemplateType type); + /** * Add an available variant name to a conversation theme. * -- cgit v1.2.1 From 144d26522766516826fc385ad479c7f17f2a49ed Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 21 Sep 2011 01:51:34 +0000 Subject: Document things. --- pidgin/gtkconv-theme.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 41c536ace7..1055b71e3e 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -109,6 +109,15 @@ const GHashTable *pidgin_conversation_theme_get_info(const PidginConvTheme *them */ void pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info); +/** + * Get the template data from a conversation theme. + * + * @param theme The conversation theme + * @param type The type of template data + * + * @return The template data requested. Fallback is made as required by styles. + * Subsequent calls to this function will return cached values. + */ const char *pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTemplateType type); /** -- cgit v1.2.1 From b9477899b754bf102536d3d80aeac774cb86d14a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 21 Sep 2011 02:54:35 +0000 Subject: Add a function for lookup of Info.plist entries. --- pidgin/gtkconv-theme.c | 9 +++++++++ pidgin/gtkconv-theme.h | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index bdcf552b31..b10f7bd5a8 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -671,6 +671,15 @@ pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info) priv->info = info; } +const GValue * +pidgin_conversation_theme_lookup(PidginConvTheme *theme, const char *key, gboolean specific) +{ + PidginConvThemePrivate *priv; + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + return get_key(priv, key, specific); +} + const char * pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTemplateType type) { diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 1055b71e3e..5d988a36e5 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -109,6 +109,19 @@ const GHashTable *pidgin_conversation_theme_get_info(const PidginConvTheme *them */ void pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info); +/** + * Lookup a key in a theme + * + * @param theme The conversation theme + * @param key The key to find + * @param specific Whether to search variant-specific keys + * + * @return The key information. If @a specific is @c TRUE, then keys are first + * searched by variant, then by general ones. Otherwise, only general + * key values are returned. + */ +const GValue *pidgin_conversation_theme_lookup(PidginConvTheme *theme, const char *key, gboolean specific); + /** * Get the template data from a conversation theme. * -- cgit v1.2.1 From 8da70ef910b6fd073ba51a1facd410cb2e88df4e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 21 Sep 2011 03:14:57 +0000 Subject: Add template lookup for 'basestyle' CSS. --- pidgin/gtkconv-theme.c | 3 +++ pidgin/gtkconv-theme.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index b10f7bd5a8..5fd99ee6fa 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -733,6 +733,9 @@ pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTe case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTEXT: html = get_outgoing_next_context_html(priv, dir); break; + case PIDGIN_CONVERSATION_THEME_TEMPLATE_BASESTYLE_CSS: + html = get_basestyle_css(priv, dir); + break; default: purple_debug_error("gtkconv-theme", "Requested invalid template type (%d) for theme %s.\n", diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 5d988a36e5..655929eafc 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -72,7 +72,8 @@ typedef enum { PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTEXT, - PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTEXT + PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTEXT, + PIDGIN_CONVERSATION_THEME_TEMPLATE_BASESTYLE_CSS } PidginConvThemeTemplateType; -- cgit v1.2.1 From e5ada0be35ece3a732d61332d46527b6f24daa3b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 21 Sep 2011 06:45:26 +0000 Subject: Apply conversation theme when opening the GTK conversation. All the parsing stuff was moved out of the theme code and into the conversation code. Someone (not me!) needs to check the code I commented out and see if we really need that stuff (and then port it to WebKit/styling). We also need to determine where to place Template.html and the rest of our (not-yet-written) default theme. --- pidgin/gtkconv-theme.c | 252 ++----------------------------------- pidgin/gtkconv-theme.h | 21 +++- pidgin/gtkconv.c | 329 +++++++++++++++++++++++++++++++++++++++++++++++++ pidgin/gtkconv.h | 3 + 4 files changed, 360 insertions(+), 245 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 5fd99ee6fa..428d2808bc 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -34,9 +34,6 @@ #include #include -/* GObject data keys - this will probably go away soon... */ -#define MESSAGE_STYLE_KEY "message-style" - #define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \ (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate)) @@ -493,160 +490,6 @@ get_outgoing_next_context_html(PidginConvThemePrivate *priv, const char *dir) return priv->outgoing_next_context_html; } -static char * -replace_header_tokens(const char *text, PurpleConversation *conv) -{ - GString *str = g_string_new(NULL); - const char *cur = text; - const char *prev = cur; - - if (text == NULL) - return NULL; - - while ((cur = strchr(cur, '%'))) { - const char *replace = NULL; - char *fin = NULL; - - if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { - replace = conv->name; - } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { - replace = purple_account_get_alias(conv->account); - if (replace == NULL) - replace = purple_account_get_username(conv->account); - } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { - PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); - if (buddy) { - replace = purple_buddy_get_alias(buddy); - } else { - replace = conv->name; - } - } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { - PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); - replace = purple_buddy_icon_get_full_path(icon); - } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { - } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { - char *format = NULL; - if (*(cur + strlen("%timeOpened")) == '{') { - const char *start = cur + strlen("%timeOpened") + 1; - char *end = strstr(start, "}%"); - if (!end) /* Invalid string */ - continue; - format = g_strndup(start, end - start); - fin = end + 1; - } - replace = purple_utf8_strftime(format ? format : "%X", NULL); - g_free(format); - } else { - continue; - } - - /* Here we have a replacement to make */ - g_string_append_len(str, prev, cur - prev); - g_string_append(str, replace); - - /* And update the pointers */ - if (fin) { - prev = cur = fin + 1; - } else { - prev = cur = strchr(cur + 1, '%') + 1; - } - } - - /* And wrap it up */ - g_string_append(str, prev); - return g_string_free(str, FALSE); -} - -static char * -replace_template_tokens(PidginConvTheme *theme, const char *text, const char *header, const char *footer) -{ - PidginConvThemePrivate *priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - GString *str = g_string_new(NULL); - const char *themedir; - - char **ms = g_strsplit(text, "%@", 6); - char *base = NULL; - char *csspath = pidgin_conversation_theme_get_css(theme); - if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { - g_strfreev(ms); - g_string_free(str, TRUE); - return NULL; - } - - themedir = purple_theme_get_dir(PURPLE_THEME(theme)); - - g_string_append(str, ms[0]); - g_string_append(str, "file://"); - base = g_build_filename(themedir, "Contents", "Resources", "Template.html", NULL); - g_string_append(str, base); - g_free(base); - - g_string_append(str, ms[1]); - - g_string_append(str, get_basestyle_css(priv, themedir)); - - g_string_append(str, ms[2]); - - g_string_append(str, "file://"); - g_string_append(str, csspath); - - g_string_append(str, ms[3]); - if (header) - g_string_append(str, header); - g_string_append(str, ms[4]); - if (footer) - g_string_append(str, footer); - g_string_append(str, ms[5]); - - g_strfreev(ms); - g_free(csspath); - return g_string_free(str, FALSE); -} - -static void -set_theme_webkit_settings(WebKitWebView *webview, PidginConvTheme *theme) -{ - PidginConvThemePrivate *priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - WebKitWebSettings *settings; - const GValue *val; - - g_object_get(G_OBJECT(webview), "settings", &settings, NULL); - - val = get_key(priv, "DefaultFontFamily", TRUE); - if (val && G_VALUE_HOLDS_STRING(val)) - g_object_set(G_OBJECT(settings), "default-font-family", g_value_get_string(val), NULL); - - val = get_key(priv, "DefaultFontSize", TRUE); - if (val && G_VALUE_HOLDS_INT(val)) - g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(g_value_get_int(val)), NULL); - - val = get_key(priv, "DefaultBackgroundIsTransparent", TRUE); - if (val && G_VALUE_HOLDS_BOOLEAN(val)) - /* this does not work :( */ - webkit_web_view_set_transparent(webview, g_value_get_boolean(val)); -} - -/* - * The style specification says that if the conversation is a group - * chat then the
element will be given a class - * 'groupchat'. I can't add another '%@' in Template.html because - * that breaks style-specific Template.html's. I have to either use libxml - * or conveniently play with WebKit's javascript engine. The javascript - * engine should work, but it's not an identical behavior. - */ -static void -webkit_set_groupchat(GtkWebView *webview) -{ - gtk_webview_safe_execute_script(webview, "document.getElementById('Chat').className = 'groupchat'"); -} - -static void -webkit_on_webview_destroy(GtkObject *object, gpointer data) -{ - g_object_unref(G_OBJECT(data)); - g_object_set_data(G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); -} - /***************************************************************************** * Public API functions *****************************************************************************/ @@ -791,33 +634,25 @@ pidgin_conversation_theme_get_variants(PidginConvTheme *theme) return priv->variants; } -PidginConvTheme * -pidgin_conversation_theme_copy(const PidginConvTheme *theme) +char * +pidgin_conversation_theme_get_template_path(PidginConvTheme *theme) { - PidginConvTheme *ret; - PidginConvThemePrivate *old, *new; - - old = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - ret = g_object_new(PIDGIN_TYPE_CONV_THEME, "directory", purple_theme_get_dir(PURPLE_THEME(theme)), NULL); - new = PIDGIN_CONV_THEME_GET_PRIVATE(ret); + const char *dir; + char *filename; - new->variant = g_strdup(old->variant); + dir = purple_theme_get_dir(PURPLE_THEME(theme)); + filename = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL); - new->template_html = g_strdup(old->template_html); - new->header_html = g_strdup(old->header_html); - new->footer_html = g_strdup(old->footer_html); - new->incoming_content_html = g_strdup(old->incoming_content_html); - new->outgoing_content_html = g_strdup(old->outgoing_content_html); - new->incoming_next_content_html = g_strdup(old->incoming_next_content_html); - new->outgoing_next_content_html = g_strdup(old->outgoing_next_content_html); - new->status_html = g_strdup(old->status_html); - new->basestyle_css = g_strdup(old->basestyle_css); + if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { + g_free(filename); + filename = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); + } - return ret; + return filename; } char * -pidgin_conversation_theme_get_css(PidginConvTheme *theme) +pidgin_conversation_theme_get_css_path(PidginConvTheme *theme) { PidginConvThemePrivate *priv; const char *dir; @@ -835,66 +670,3 @@ pidgin_conversation_theme_get_css(PidginConvTheme *theme) } } -/** - * Called when either a new PurpleConversation is created - * or when a PidginConversation changes its active PurpleConversation - * This will not change the theme if the theme is already set. - * (This is to prevent accidental theme changes if a new - * PurpleConversation gets added. - * - * FIXME: it's not at all clear to me as to how - * Adium themes handle the case when the PurpleConversation - * changes. - */ -void -pidgin_conversation_theme_apply(PidginConvTheme *theme, PurpleConversation *conv) -{ - GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; - const char *themedir; - char *header, *footer; - char *template; - char *basedir; - char *baseuri; - PidginConvTheme *oldTheme; - PidginConvTheme *copy; - PidginConvThemePrivate *priv; - - priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - - oldTheme = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY); - if (oldTheme) - return; - - g_assert(theme); - - themedir = purple_theme_get_dir(PURPLE_THEME(theme)); - - header = replace_header_tokens(get_header_html(priv, themedir), conv); - footer = replace_header_tokens(get_footer_html(priv, themedir), conv); - template = replace_template_tokens(theme, get_template_html(priv, themedir), header, footer); - - g_assert(template); - - purple_debug_info("webkit", "template: %s\n", template); - - set_theme_webkit_settings(WEBKIT_WEB_VIEW(webkit), theme); - basedir = g_build_filename(themedir, "Contents", "Resources", "Template.html", NULL); - baseuri = g_strdup_printf("file://%s", basedir); - webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); - - copy = pidgin_conversation_theme_copy(theme); - g_object_set_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy); - - g_object_unref(G_OBJECT(theme)); - /* I need to unref this style when the webkit object destroys */ - g_signal_connect(G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); - - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) - webkit_set_groupchat(GTK_WEBVIEW(webkit)); - g_free(basedir); - g_free(baseuri); - g_free(header); - g_free(footer); - g_free(template); -} - diff --git a/pidgin/gtkconv-theme.h b/pidgin/gtkconv-theme.h index 655929eafc..053c4c320f 100644 --- a/pidgin/gtkconv-theme.h +++ b/pidgin/gtkconv-theme.h @@ -173,12 +173,23 @@ void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *v */ const GList *pidgin_conversation_theme_get_variants(PidginConvTheme *theme); -PidginConvTheme *pidgin_conversation_theme_copy(const PidginConvTheme *theme); - -char *pidgin_conversation_theme_get_css(PidginConvTheme *theme); +/** + * Get the path to the template HTML file. + * + * @param theme The conversation theme + * + * @return The path to the HTML file. + */ +char *pidgin_conversation_theme_get_template_path(PidginConvTheme *theme); -void -pidgin_conversation_theme_apply(PidginConvTheme *theme, PurpleConversation *conv); +/** + * Get the path to the current variant CSS file. + * + * @param theme The conversation theme + * + * @return The path to the CSS file. + */ +char *pidgin_conversation_theme_get_css_path(PidginConvTheme *theme); G_END_DECLS #endif /* PIDGIN_CONV_THEME_H */ diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 8cc5e5a888..b9341de775 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -76,6 +76,7 @@ #include "gtkwebview.h" #include "pidginstock.h" #include "pidgintooltip.h" +#include "smileyparser.h" #include "gtknickcolors.h" @@ -4945,6 +4946,152 @@ pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) /* }}} */ +static char * +replace_header_tokens(PurpleConversation *conv, const char *text) +{ + GString *str; + const char *cur = text; + const char *prev = cur; + + if (text == NULL || *text == '\0') + return NULL; + + str = g_string_new(NULL); + while ((cur = strchr(cur, '%'))) { + const char *replace = NULL; + const char *fin = NULL; + + if (g_str_has_prefix(cur, "%chatName%")) { + replace = conv->name; + + } else if (g_str_has_prefix(cur, "%sourceName%")) { + replace = purple_account_get_alias(conv->account); + if (replace == NULL) + replace = purple_account_get_username(conv->account); + + } else if (g_str_has_prefix(cur, "%destinationName%")) { + PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + if (buddy) { + replace = purple_buddy_get_alias(buddy); + } else { + replace = conv->name; + } + + } else if (g_str_has_prefix(cur, "%incomingIconPath%")) { + PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); + if (icon) + replace = purple_buddy_icon_get_full_path(icon); + + } else if (g_str_has_prefix(cur, "%outgoingIconPath%")) { + replace = purple_account_get_buddy_icon_path(conv->account); + + } else if (g_str_has_prefix(cur, "%timeOpened")) { + const char *tmp = cur + strlen("%timeOpened"); + char *format = NULL; + if (*tmp == '{') { + const char *end; + tmp++; + end = strstr(tmp, "}%"); + if (!end) /* Invalid string */ + continue; + format = g_strndup(tmp, end - tmp); + fin = end + 1; + } + replace = purple_utf8_strftime(format ? format : "%X", NULL); + g_free(format); + + } else { + continue; + } + + /* Here we have a replacement to make */ + g_string_append_len(str, prev, cur - prev); + if (replace) + g_string_append(str, replace); + + /* And update the pointers */ + if (fin) { + prev = cur = fin + 1; + } else { + prev = cur = strchr(cur + 1, '%') + 1; + } + } + + /* And wrap it up */ + g_string_append(str, prev); + return g_string_free(str, FALSE); +} + +static char * +replace_template_tokens(PidginConvTheme *theme, const char *header, const char *footer) +{ + GString *str; + const char *text; + char **ms; + char *path; + + text = pidgin_conversation_theme_get_template(theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN); + ms = g_strsplit(text, "%@", 6); + if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { + g_strfreev(ms); + return NULL; + } + + str = g_string_new(NULL); + + g_string_append(str, ms[0]); + g_string_append(str, "file://"); + path = pidgin_conversation_theme_get_template_path(theme); + g_string_append(str, path); + g_free(path); + + g_string_append(str, ms[1]); + + text = pidgin_conversation_theme_get_template(theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_BASESTYLE_CSS); + g_string_append(str, text); + + g_string_append(str, ms[2]); + + g_string_append(str, "file://"); + path = pidgin_conversation_theme_get_css_path(theme); + g_string_append(str, path); + g_free(path); + + g_string_append(str, ms[3]); + if (header) + g_string_append(str, header); + g_string_append(str, ms[4]); + if (footer) + g_string_append(str, footer); + g_string_append(str, ms[5]); + + g_strfreev(ms); + + return g_string_free(str, FALSE); +} + +static void +set_theme_webkit_settings(WebKitWebView *webview, PidginConvTheme *theme) +{ + WebKitWebSettings *settings; + const GValue *val; + + g_object_get(G_OBJECT(webview), "settings", &settings, NULL); + + val = pidgin_conversation_theme_lookup(theme, "DefaultFontFamily", TRUE); + if (val && G_VALUE_HOLDS_STRING(val)) + g_object_set(G_OBJECT(settings), "default-font-family", g_value_get_string(val), NULL); + + val = pidgin_conversation_theme_lookup(theme, "DefaultFontSize", TRUE); + if (val && G_VALUE_HOLDS_INT(val)) + g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(g_value_get_int(val)), NULL); + + val = pidgin_conversation_theme_lookup(theme, "DefaultBackgroundIsTransparent", TRUE); + if (val && G_VALUE_HOLDS_BOOLEAN(val)) + /* this does not work :( */ + webkit_web_view_set_transparent(webview, g_value_get_boolean(val)); +} + static GtkWidget * setup_common_pane(PidginConversation *gtkconv) { @@ -4955,6 +5102,8 @@ setup_common_pane(PidginConversation *gtkconv) PurpleBuddy *buddy; gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); int buddyicon_size = 0; + char *header, *footer; + char *template; /* Setup the top part of the pane */ vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -5048,6 +5197,34 @@ setup_common_pane(PidginConversation *gtkconv) frame = pidgin_create_webview(FALSE, >kconv->webview, NULL, &webview_sw); gtk_widget_set_size_request(gtkconv->webview, -1, 0); + header = replace_header_tokens(conv, + pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER)); + footer = replace_header_tokens(conv, + pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER)); + template = replace_template_tokens(gtkconv->theme, header, footer); + g_free(header); + g_free(footer); + + if (template != NULL) { + char *basedir; + char *baseuri; + + purple_debug_info("webkit", "template: %s\n", template); + + set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), gtkconv->theme); + + basedir = pidgin_conversation_theme_get_template_path(gtkconv->theme); + baseuri = g_strdup_printf("file://%s", basedir); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(gtkconv->webview), template, "text/html", "UTF-8", baseuri); + + if (chat) + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), "document.getElementById('Chat').className = 'groupchat'"); + + g_free(basedir); + g_free(baseuri); + g_free(template); + } + if (chat) { GtkWidget *hpaned; @@ -5357,6 +5534,7 @@ static void private_gtkconv_new(PurpleConversation *conv, gboolean hidden) { PidginConversation *gtkconv; + PurpleTheme *theme; PurpleConversationType conv_type = purple_conversation_get_type(conv); GtkWidget *pane = NULL; GtkWidget *tab_cont; @@ -5381,6 +5559,11 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) gtkconv->tooltips = gtk_tooltips_new(); gtkconv->unseen_state = PIDGIN_UNSEEN_NONE; gtkconv->unseen_count = 0; + theme = purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme"), "conversation"); + if (!theme) + theme = purple_theme_manager_find_theme("Default", "conversation"); + gtkconv->theme = PIDGIN_CONV_THEME(theme); + gtkconv->last_flags = 0; if (conv_type == PURPLE_CONV_TYPE_IM) { gtkconv->u.im = g_malloc0(sizeof(PidginImPane)); @@ -5611,6 +5794,7 @@ pidgin_conv_write_im(PurpleConversation *conv, const char *who, purple_conversation_write(conv, who, message, flags, mtime); } +#if 0 static const char * get_text_tag_color(GtkTextTag *tag) { @@ -5691,6 +5875,7 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, return FALSE; } +#endif static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, PurpleMessageFlags flag, gboolean create) @@ -5734,6 +5919,7 @@ static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, Purp return NULL; } +#if 0 static void pidgin_conv_calculate_newday(PidginConversation *gtkconv, time_t mtime) { struct tm *tm = localtime(&mtime); @@ -5779,6 +5965,101 @@ str_embed_direction_chars(char **str) *str = ret; #endif } +#endif + +static char * +replace_message_tokens( + const char *text, + PurpleConversation *conv, + const char *name, + const char *alias, + const char *message, + PurpleMessageFlags flags, + time_t mtime) +{ + GString *str = g_string_new(NULL); + const char *cur = text; + const char *prev = cur; + + while ((cur = strchr(cur, '%'))) { + const char *replace = NULL; + const char *fin = NULL; + + if (g_str_has_prefix(cur, "%message%")) { + replace = message; + + } else if (g_str_has_prefix(cur, "%messageClasses%")) { + replace = flags & PURPLE_MESSAGE_SEND ? "outgoing" : + flags & PURPLE_MESSAGE_RECV ? "incoming" : "event"; + + } else if (g_str_has_prefix(cur, "%time")) { + const char *tmp = cur + strlen("%time"); + char *format = NULL; + if (*tmp == '{') { + char *end; + tmp++; + end = strstr(tmp, "}%"); + if (!end) /* Invalid string */ + continue; + format = g_strndup(tmp, end - tmp); + fin = end + 1; + } + replace = purple_utf8_strftime(format ? format : "%X", NULL); + g_free(format); + + } else if (g_str_has_prefix(cur, "%userIconPath%")) { + if (flags & PURPLE_MESSAGE_SEND) { + if (purple_account_get_bool(conv->account, "use-global-buddyicon", TRUE)) { + replace = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon"); + } else { + PurpleStoredImage *img = purple_buddy_icons_find_account_icon(conv->account); + replace = purple_imgstore_get_filename(img); + } + if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { + replace = g_build_filename("Outgoing", "buddy_icon.png", NULL); + } + } else if (flags & PURPLE_MESSAGE_RECV) { + PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); + if (icon) + replace = purple_buddy_icon_get_full_path(icon); + if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { + replace = g_build_filename("Incoming", "buddy_icon.png", NULL); + } + } + + } else if (g_str_has_prefix(cur, "%senderScreenName%")) { + replace = name; + + } else if (g_str_has_prefix(cur, "%sender%")) { + replace = alias; + + } else if (g_str_has_prefix(cur, "%service%")) { + replace = purple_account_get_protocol_name(conv->account); + + } else { + cur++; + continue; + } + + /* Here we have a replacement to make */ + g_string_append_len(str, prev, cur - prev); + if (replace) + g_string_append(str, replace); + + /* And update the pointers */ + if (fin) { + prev = cur = fin + 1; + } else { + prev = cur = strchr(cur + 1, '%') + 1; + } + + } + + /* And wrap it up */ + g_string_append(str, prev); + + return g_string_free(str, FALSE); +} static void pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *alias, @@ -5788,6 +6069,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a PidginConversation *gtkconv; PurpleConnection *gc; PurpleAccount *account; +#if 0 int gtk_font_options = 0; int gtk_font_options_all = 0; char buf2[BUF_LONG]; @@ -5796,11 +6078,22 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a char *str; char *with_font_tag; char *sml_attrib = NULL; +#endif size_t length; PurpleConversationType type; char *displaying; gboolean plugin_return; +#if 0 gboolean is_rtl_message = FALSE; +#endif + + const char *message_html; + char *msg; + char *escape; + char *script; + char *smileyed; + PurpleMessageFlags old_flags; + const char *func = "appendMessage"; g_return_if_fail(conv != NULL); gtkconv = PIDGIN_CONVERSATION(conv); @@ -5857,6 +6150,36 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a } length = strlen(displaying) + 1; + old_flags = gtkconv->last_flags; + if ((flags & PURPLE_MESSAGE_SEND) && (old_flags & PURPLE_MESSAGE_SEND)) { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT); + func = "appendNextMessage"; + } else if (flags & PURPLE_MESSAGE_SEND) { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT); + } else if ((flags & PURPLE_MESSAGE_RECV) && (old_flags & PURPLE_MESSAGE_RECV)) { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT); + func = "appendNextMessage"; + } else if (flags & PURPLE_MESSAGE_RECV) { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); + } else { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS); + } + gtkconv->last_flags = flags; + + smileyed = smiley_parse_markup(message, purple_account_get_protocol_id(account)); + msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime); + escape = gtk_webview_quote_js_string(msg); + script = g_strdup_printf("%s(%s)", func, escape); + + purple_debug_info("webkit", "JS: %s\n", script); + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), script); + + g_free(script); + g_free(smileyed); + g_free(msg); + g_free(escape); + +#if 0 /* if the buffer is not empty add a
*/ if (!gtk_webview_is_empty(GTK_WEBVIEW(gtkconv->webview))) gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "
"); @@ -6048,6 +6371,8 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a g_free(mdate); g_free(sml_attrib); +#endif + /* Tab highlighting stuff */ if (!(flags & PURPLE_MESSAGE_SEND) && !pidgin_conv_has_focus(conv)) { @@ -6066,11 +6391,13 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a gtkconv_set_unseen(gtkconv, unseen); } +#if 0 if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) { /* Restore the smiley-data */ pidgin_themes_smiley_themeize(gtkconv->webview); } +#endif purple_signal_emit(pidgin_conversations_get_handle(), (type == PURPLE_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"), @@ -6715,8 +7042,10 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) } } +#if 0 if (fields & PIDGIN_CONV_SMILEY_THEME) pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->webview); +#endif if ((fields & PIDGIN_CONV_COLORIZE_TITLE) || (fields & PIDGIN_CONV_SET_TITLE) || diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index 795f4cf731..ce06c630c1 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -65,6 +65,7 @@ enum { #include "pidgin.h" #include "conversation.h" #include "gtkconvwin.h" +#include "gtkconv-theme.h" /************************************************************************** * @name Structures @@ -95,6 +96,8 @@ struct _PidginConversation GtkWidget *tabby; GtkWidget *menu_tabby; + PidginConvTheme *theme; + PurpleMessageFlags last_flags; GtkWidget *webview; GtkTextBuffer *entry_buffer; GtkWidget *entry; -- cgit v1.2.1 From 2c6b186776371c538aa19bf8d74fb1591012cc8f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 21 Sep 2011 07:01:58 +0000 Subject: Add some NULL checks. Now it should not crash even if you don't have the default theme installed (which you won't since it's not even written yet!) You just won't see anything... --- pidgin/gtkconv-theme.c | 29 +++++++++++++++++++++++++++++ pidgin/gtkconv.c | 9 ++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 428d2808bc..72e740140e 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -498,6 +498,9 @@ const GHashTable * pidgin_conversation_theme_get_info(const PidginConvTheme *theme) { PidginConvThemePrivate *priv; + + g_return_val_if_fail(theme != NULL, NULL); + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); return priv->info; } @@ -506,6 +509,9 @@ void pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info) { PidginConvThemePrivate *priv; + + g_return_if_fail(theme != NULL); + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); if (priv->info) @@ -518,6 +524,9 @@ const GValue * pidgin_conversation_theme_lookup(PidginConvTheme *theme, const char *key, gboolean specific) { PidginConvThemePrivate *priv; + + g_return_val_if_fail(theme != NULL, NULL); + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); return get_key(priv, key, specific); @@ -530,6 +539,8 @@ pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTe const char *dir; const char *html; + g_return_val_if_fail(theme != NULL, NULL); + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); dir = purple_theme_get_dir(PURPLE_THEME(theme)); @@ -593,6 +604,10 @@ void pidgin_conversation_theme_add_variant(PidginConvTheme *theme, char *variant) { PidginConvThemePrivate *priv; + + g_return_if_fail(theme != NULL); + g_return_if_fail(variant != NULL); + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); priv->variants = g_list_prepend(priv->variants, variant); @@ -602,6 +617,9 @@ const char * pidgin_conversation_theme_get_variant(PidginConvTheme *theme) { PidginConvThemePrivate *priv; + + g_return_val_if_fail(theme != NULL, NULL); + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); return g_strdup(priv->variant); @@ -613,6 +631,10 @@ pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *varian PidginConvThemePrivate *priv; const GValue *val; char *prefname; + + g_return_if_fail(theme != NULL); + g_return_if_fail(variant != NULL); + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); g_free(priv->variant); @@ -629,6 +651,9 @@ const GList * pidgin_conversation_theme_get_variants(PidginConvTheme *theme) { PidginConvThemePrivate *priv; + + g_return_val_if_fail(theme != NULL, NULL); + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); return priv->variants; @@ -640,6 +665,8 @@ pidgin_conversation_theme_get_template_path(PidginConvTheme *theme) const char *dir; char *filename; + g_return_val_if_fail(theme != NULL, NULL); + dir = purple_theme_get_dir(PURPLE_THEME(theme)); filename = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL); @@ -657,6 +684,8 @@ pidgin_conversation_theme_get_css_path(PidginConvTheme *theme) PidginConvThemePrivate *priv; const char *dir; + g_return_val_if_fail(theme != NULL, NULL); + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); dir = purple_theme_get_dir(PURPLE_THEME(theme)); diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index b9341de775..20b04e3cb6 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5031,6 +5031,9 @@ replace_template_tokens(PidginConvTheme *theme, const char *header, const char * char *path; text = pidgin_conversation_theme_get_template(theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN); + if (text == NULL) + return NULL; + ms = g_strsplit(text, "%@", 6); if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { g_strfreev(ms); @@ -5977,10 +5980,14 @@ replace_message_tokens( PurpleMessageFlags flags, time_t mtime) { - GString *str = g_string_new(NULL); + GString *str; const char *cur = text; const char *prev = cur; + if (text == NULL) + return g_strdup(""); + + str = g_string_new(NULL); while ((cur = strchr(cur, '%'))) { const char *replace = NULL; const char *fin = NULL; -- cgit v1.2.1 From 49addf48a71c7cd04ce6536374fd32564bacc96b Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 21 Sep 2011 07:39:32 +0000 Subject: Mark webkit-related missing functionality with "TODO WEBKIT" instead of "FIXME". Should make it easier to grep for. --- pidgin/gtkconv.c | 84 +++++++++++++++++++++++++++++++++++------------------ pidgin/gtkdialogs.c | 4 +-- pidgin/gtkthemes.c | 4 +-- pidgin/gtkutils.c | 4 +-- pidgin/gtkutils.h | 3 +- pidgin/gtkwebview.c | 2 +- pidgin/gtkwebview.h | 6 ++-- 7 files changed, 68 insertions(+), 39 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 20b04e3cb6..cb6fd1d8d7 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1052,7 +1052,35 @@ menu_join_chat_cb(gpointer data, guint action, GtkWidget *widget) static void savelog_writefile_cb(void *user_data, const char *filename) { - /* TODO: I don't know how to support this using webkit yet. */ + /* TODO WEBKIT: I don't know how to support this using webkit yet. */ +#if 0 + PurpleConversation *conv = (PurpleConversation *)user_data; + FILE *fp; + const char *name; + char **lines; + gchar *text; + + if ((fp = g_fopen(filename, "w+")) == NULL) { + purple_notify_error(PIDGIN_CONVERSATION(conv), NULL, _("Unable to open file."), NULL); + return; + } + + name = purple_conversation_get_name(conv); + fprintf(fp, "\n\n"); + fprintf(fp, "\n"); + fprintf(fp, "%s\n\n\n", name); + fprintf(fp, _("

Conversation with %s

\n"), name); + + lines = gtk_imhtml_get_markup_lines( + GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml)); + text = g_strjoinv("
\n", lines); + fprintf(fp, "%s", text); + g_free(text); + g_strfreev(lines); + + fprintf(fp, "\n\n\n"); + fclose(fp); +#endif /* if 0 */ } /* @@ -1594,7 +1622,7 @@ get_mark_for_user(PidginConversation *gtkconv, const char *who) static void menu_last_said_cb(GtkWidget *w, PidginConversation *gtkconv) { -/* FIXME: This doesn't work yet, of course... */ +/* TODO WEBKIT: This doesn't work yet, of course... */ #if 0 GtkTextMark *mark; const char *who; @@ -1606,7 +1634,7 @@ menu_last_said_cb(GtkWidget *w, PidginConversation *gtkconv) gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); else g_return_if_reached(); -#endif +#endif /* if 0 */ } static GtkWidget * @@ -1811,13 +1839,13 @@ right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, chat_do_im(gtkconv, who); } else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) { /* Move to user's anchor */ -/* FIXME: This isn't implemented yet. */ +/* TODO WEBKIT: This isn't implemented yet. */ #if 0 GtkTextMark *mark = get_mark_for_user(gtkconv, who); if(mark != NULL) gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); -#endif +#endif /* if 0 */ } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { GtkWidget *menu = create_chat_menu (conv, who, gc); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, @@ -2152,19 +2180,19 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) case GDK_Page_Up: case GDK_KP_Page_Up: -/* FIXME: Write this. */ +/* TODO WEBKIT: Write this. */ #if 0 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); -#endif +#endif /* if 0 */ return TRUE; break; case GDK_Page_Down: case GDK_KP_Page_Down: -/* FIXME: Write this. */ +/* TODO WEBKIT: Write this. */ #if 0 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); -#endif +#endif /* if 0 */ return TRUE; break; @@ -2274,7 +2302,7 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) entry = GTK_IMHTML(gtkconv->entry); protocol_name = purple_account_get_protocol_name(conv->account); gtk_imhtml_set_protocol_name(entry, protocol_name); - /* FIXME: gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); */ + /* TODO WEBKIT: gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); */ if (!(conv->features & PURPLE_CONNECTION_HTML)) gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry)); @@ -3663,7 +3691,7 @@ typing_animation(gpointer data) { static void update_typing_message(PidginConversation *gtkconv, const char *message) { - /* FIXME: this is not handled at all */ + /* TODO WEBKIT: this is not handled at all */ #if 0 GtkTextBuffer *buffer; GtkTextMark *stmark, *enmark; @@ -3697,7 +3725,7 @@ update_typing_message(PidginConversation *gtkconv, const char *message) gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_create_mark(buffer, "typing-notification-end", &iter, TRUE); } -#endif +#endif /* if 0 */ } static void @@ -3939,7 +3967,7 @@ generate_send_to_items(PidginWindow *win) continue; account = purple_buddy_get_account(buddy); - /* FIXME: */ + /* TODO WEBKIT: (I'm not actually sure if this is webkit-related --Mark Doliner) */ if (purple_account_is_connected(account) /*|| account == gtkconv->active_conv->account*/) { /* Use the PurplePresence to get unique buddies. */ @@ -4053,12 +4081,12 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c if (is_me) { #if 0 - /* FIXME: No tags in webkit stuff, yet. */ + /* TODO WEBKIT: No tags in webkit stuff, yet. */ GtkTextTag *tag = gtk_text_tag_table_lookup( gtk_text_buffer_get_tag_table(GTK_IMHTML(gtkconv->webview)->text_buffer), "send-name"); g_object_get(tag, "foreground-gdk", &color, NULL); -#endif +#endif /* if 0 */ } else { GtkTextTag *tag; if ((tag = get_buddy_tag(conv, name, 0, FALSE))) @@ -5495,7 +5523,7 @@ ignore_middle_click(GtkWidget *widget, GdkEventButton *e, gpointer null) static void set_typing_font(GtkWidget *widget, GtkStyle *style, PidginConversation *gtkconv) { -/* FIXME */ +/* TODO WEBKIT */ #if 0 static PangoFontDescription *font_desc = NULL; static GdkColor *color = NULL; @@ -5527,7 +5555,7 @@ static void set_typing_font(GtkWidget *widget, GtkStyle *style, PidginConversati } g_signal_handlers_disconnect_by_func(G_OBJECT(widget), set_typing_font, gtkconv); -#endif +#endif /* if 0 */ } /************************************************************************** @@ -5883,7 +5911,7 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, PurpleMessageFlags flag, gboolean create) { -/* FIXME */ +/* TODO WEBKIT */ #if 0 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); GtkTextTag *buddytag; @@ -5918,7 +5946,7 @@ static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, Purp g_free(str); return buddytag; -#endif +#endif /* if 0 */ return NULL; } @@ -6335,7 +6363,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a g_free(alias_escaped); - /* FIXME: */ + /* TODO WEBKIT */ #if 0 if (tagname) tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), tagname); @@ -6354,7 +6382,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a color ? "COLOR=\"" : "", color ? color : "", color ? "\"" : "", mdate); gtk_webview_append_html (GTK_WEBVIEW(gtkconv->webview), buf2); } -#endif +#endif /* if 0 */ g_snprintf(buf2, BUF_LONG, "%s ", sml_attrib ? sml_attrib : "", str); gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), buf2); @@ -6651,7 +6679,7 @@ add_custom_smiley_for_imhtml(GtkIMHtml *imhtml, const char *sml, const char *smi static gboolean add_custom_smiley_for_webview(GtkWebView *webview, const char *sml, const char *smile) { - /* FIXME: Smileys need to be added to webkit stuff */ + /* TODO WEBKIT: Smileys need to be added to webkit stuff */ return TRUE; } @@ -6696,7 +6724,7 @@ static void pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, const guchar *data, gsize size) { -/* FIXME */ +/* TODO WEBKIT */ #if 0 PidginConversation *gtkconv; GtkIMHtmlSmiley *smiley; @@ -6732,13 +6760,13 @@ pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, g_object_unref(G_OBJECT(smiley->loader)); smiley->loader = gdk_pixbuf_loader_new(); } -#endif +#endif /* if 0 */ } static void pidgin_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) { -/* FIXME*/ +/* TODO WEBKIT */ #if 0 PidginConversation *gtkconv; GtkIMHtmlSmiley *smiley; @@ -6776,7 +6804,7 @@ pidgin_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) g_object_unref(G_OBJECT(smiley->loader)); smiley->loader = gdk_pixbuf_loader_new(); } -#endif +#endif /* if 0 */ } static void @@ -7630,11 +7658,11 @@ show_timestamps_pref_cb(const char *name, PurplePrefType type, GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), (gboolean)GPOINTER_TO_INT(value)); -/* FIXME: Use WebKit version of this. */ +/* TODO WEBKIT: Use WebKit version of this. */ #if 0 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); -#endif +#endif /* if 0 */ } } diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 63602b0827..2e62e14f30 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -450,13 +450,13 @@ pidgin_build_help_dialog(const char *title, const char *role, GString *string) gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); frame = pidgin_create_webview(FALSE, &webview, NULL, NULL); - /* FIXME: Compile now and fix it later when we have a proper replacement for this function + /* TODO WEBKIT: Compile now and fix it later when we have a proper replacement for this function gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY); */ gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); gtk_webview_append_html(GTK_WEBVIEW(webview), string->str); - /* FIXME: This doesn't seem to stay at the top. */ + /* TODO WEBKIT: This doesn't seem to stay at the top. */ webkit_web_view_move_cursor(WEBKIT_WEB_VIEW(webview), GTK_MOVEMENT_BUFFER_ENDS, -1); button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, diff --git a/pidgin/gtkthemes.c b/pidgin/gtkthemes.c index 48a7033fec..d4fb77d5ba 100644 --- a/pidgin/gtkthemes.c +++ b/pidgin/gtkthemes.c @@ -122,7 +122,7 @@ void pidgin_themes_remove_smiley_theme(const char *file) static void _pidgin_themes_smiley_themeize(GtkWidget *imhtml, gboolean custom) { - /* FIXME: move imhtml dependency to use webview. */ + /* TODO WEBKIT: move imhtml dependency to use webview. */ #if 0 struct smiley_list *list; if (!current_smiley_theme) @@ -149,7 +149,7 @@ static void _pidgin_themes_smiley_themeize(GtkWidget *imhtml, gboolean custom) list = list->next; } -#endif +#endif /* if 0 */ } void pidgin_themes_smiley_themeize(GtkWidget *imhtml) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index d8653692b1..ed533d4979 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -308,9 +308,9 @@ pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **to webview = gtk_webview_new(); #if 0 - /* FIXME: Don't have editable webview yet. */ + /* TODO WEBKIT: Don't have editable webview yet. */ gtk_webview_set_editable(GTK_WEBVIEW(webview), editable); -#endif +#endif /* if 0 */ #ifdef USE_GTKSPELL if (editable && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck")) pidgin_setup_gtkspell(GTK_TEXT_VIEW(webview)); diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h index c0d7fafbef..49cd38549f 100644 --- a/pidgin/gtkutils.h +++ b/pidgin/gtkutils.h @@ -112,7 +112,7 @@ GtkWidget *pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWi * Create an GtkWebView widget and associated GtkIMHtmlToolbar widget. This * function puts both widgets in a nice GtkFrame. They're separated by an * attractive GtkSeparator. - * FIXME: There is no editable GtkWebView yet. + * TODO WEBKIT: editable isn't supported yet * * @param editable @c TRUE if this webview should be editable. If this is * @c FALSE, then the toolbar will NOT be created. If this webview @@ -126,6 +126,7 @@ GtkWidget *pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWi * Otherwise this will be set to @c NULL. * @param sw_ret This will be filled with a pointer to the scrolled window * widget which contains the webview. + * * @return The GtkFrame containing the toolbar and webview. */ GtkWidget *pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret); diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 4b0edea4e4..9317045098 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -43,7 +43,7 @@ static WebKitWebViewClass *parent_class = NULL; struct GtkWebViewPriv { GHashTable *images; /**< a map from id to temporary file for the image */ - gboolean empty; /**< whether anything has been appended **/ + gboolean empty; /**< whether anything has been appended **/ /* JS execute queue */ GQueue *js_queue; diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 0c0511c320..d548282971 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -103,9 +103,9 @@ void gtk_webview_append_html(GtkWebView *webview, const char *markup); void gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html); /** - * FIXME: (To be changed, right now it just tests whether an append has been - * called since the last clear or since the Widget was created. So it - * does not test for load_string's called in between. + * TODO WEBKIT: Right now this just tests whether an append has been called + * since the last clear or since the Widget was created. So it does not + * test for load_string's called in between. * * @param webview The GtkWebView object * -- cgit v1.2.1 From 398df39db2d83e7dcef9523273cc5de09fa1fa05 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 21 Sep 2011 07:40:25 +0000 Subject: These two files are listed in Makefile.am, so it seems like they should be listed here, too. Although I don't know the purpose of smileyparser.h It's currently only used by a plugin --- pidgin/Makefile.mingw | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pidgin/Makefile.mingw b/pidgin/Makefile.mingw index 7c6488e130..8d407b08e6 100644 --- a/pidgin/Makefile.mingw +++ b/pidgin/Makefile.mingw @@ -93,10 +93,12 @@ PIDGIN_C_SRC = \ gtkstatusbox.c \ gtkthemes.c \ gtkutils.c \ + gtkwebview.c \ gtkwhiteboard.c \ minidialog.c \ pidginstock.c \ pidgintooltip.c \ + smileyparser.c \ win32/gtkwin32dep.c \ win32/untar.c \ win32/wspell.c -- cgit v1.2.1 From f9297746b3ad486c112efa73863ad7227c0eddde Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 21 Sep 2011 07:43:16 +0000 Subject: Mention webkit functions here. We may want to list everything here, but for now I just added a single line. I imagine the list will change between now and the time we release --- ChangeLog.API | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog.API b/ChangeLog.API index 6ae98cb091..90857ffa06 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -3,6 +3,7 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 3.0.0 (??/??/????): libpurple: Added: + * pidgin_create_webview * purple_conversation_get_ui_data * purple_conversation_set_ui_data * purple_notify_searchresult_column_is_visible @@ -47,6 +48,7 @@ version 3.0.0 (??/??/????): * purple_xfer_set_status * purple_xfer_set_ui_data * purple_xfer_set_watcher + * Various WebKit-related functions in gtkwebview.h * xmlnode_get_default_namespace * xmlnode_strip_prefixes -- cgit v1.2.1 From e207c4e75b46d2eb512ba20b09c66aa92f1cfc7c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 21 Sep 2011 21:10:14 +0000 Subject: Destroy the inspector window when a tab is closed. This prevents a crash if you try to use the inspector without the tab open. Also, remove an unused variable. --- pidgin/plugins/webkit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pidgin/plugins/webkit.c b/pidgin/plugins/webkit.c index 8872cf380b..d9f3fedf3e 100644 --- a/pidgin/plugins/webkit.c +++ b/pidgin/plugins/webkit.c @@ -46,6 +46,7 @@ create_gtk_window_around_it(WebKitWebInspector *inspector, gtk_window_set_title(GTK_WINDOW(win), title); g_free(title); gtk_window_set_default_size(GTK_WINDOW(win), 600, 400); + g_signal_connect_swapped(G_OBJECT(gtkconv->tab_cont), "destroy", G_CALLBACK(gtk_widget_destroy), win); view = webkit_web_view_new(); gtk_container_add(GTK_CONTAINER(win), view); @@ -91,14 +92,12 @@ remove_inspector(PidginConversation *gtkconv) GtkWidget *webview = gtkconv->webview; GtkWidget *win; WebKitWebSettings *settings; - WebKitWebInspector *inspector; win = g_object_get_data(G_OBJECT(webview), "inspector-window"); gtk_widget_destroy(win); g_object_set_data(G_OBJECT(webview), "inspector-window", NULL); settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(webview)); - inspector = webkit_web_view_get_inspector(WEBKIT_WEB_VIEW(webview)); g_object_set(G_OBJECT(settings), "enable-developer-extras", FALSE, NULL); } -- cgit v1.2.1 From 5bee4e9bc356b666a9660df5adc0ba85048fda92 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 21 Sep 2011 21:37:37 +0000 Subject: Add the "default" theme to the beginning of the conversation theme preferences. --- pidgin/gtkprefs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 0d3ec796f0..2ab3337af5 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -573,6 +573,11 @@ prefs_themes_refresh(void) /* conversation themes */ gtk_list_store_clear(prefs_conv_themes); + gtk_list_store_append(prefs_conv_themes, &iter); + tmp = get_theme_markup(_("Default"), FALSE, _("Penguin Pimps"), + _("The default Pidgin conversation theme")); + gtk_list_store_set(prefs_conv_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); + g_free(tmp); /* status icon themes */ gtk_list_store_clear(prefs_status_icon_themes); -- cgit v1.2.1 From e38c0aba1ac5886eddf0af10db56ab324fc1100f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Sep 2011 07:02:44 +0000 Subject: I don't know why this happens, but I keep getting a critical debug message because account->presence is NULL, and it's annoying me when I set fatal-criticals. --- libpurple/account.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libpurple/account.c b/libpurple/account.c index e8fccd430a..aa7d0540c7 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -1086,7 +1086,8 @@ purple_account_destroy(PurpleAccount *account) purple_account_set_status_types(account, NULL); - purple_presence_destroy(account->presence); + if (account->presence) + purple_presence_destroy(account->presence); if(account->system_log) purple_log_free(account->system_log); -- cgit v1.2.1 From 757c07973996983c11429b79d77882604783d602 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Sep 2011 07:09:39 +0000 Subject: Add a separate combo box for selecting the theme variant, and actually save the prefs when the combo is changed. --- pidgin/gtkprefs.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 98 insertions(+), 16 deletions(-) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 2ab3337af5..d887bfb1f5 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -85,6 +85,7 @@ static GtkWidget *sample_imhtml = NULL; static GtkWidget *prefs_sound_themes_combo_box; static GtkWidget *prefs_blist_themes_combo_box; static GtkWidget *prefs_conv_themes_combo_box; +static GtkWidget *prefs_conv_variants_combo_box; static GtkWidget *prefs_status_themes_combo_box; static GtkWidget *prefs_smiley_themes_combo_box; @@ -97,6 +98,7 @@ static gboolean prefs_sound_themes_loading; static GtkListStore *prefs_sound_themes; static GtkListStore *prefs_blist_themes; static GtkListStore *prefs_conv_themes; +static GtkListStore *prefs_conv_variants; static GtkListStore *prefs_status_icon_themes; static GtkListStore *prefs_smiley_themes; @@ -343,6 +345,7 @@ delete_prefs(GtkWidget *asdf, void *gdsa) prefs_sound_themes_combo_box = NULL; prefs_blist_themes_combo_box = NULL; prefs_conv_themes_combo_box = NULL; + prefs_conv_variants_combo_box = NULL; prefs_status_themes_combo_box = NULL; prefs_smiley_themes_combo_box = NULL; @@ -496,26 +499,16 @@ prefs_themes_sort(PurpleTheme *theme) g_object_unref(G_OBJECT(pixbuf)); } else if (PIDGIN_IS_CONV_THEME(theme)) { - const GList *variants; - /* No image available? */ name = purple_theme_get_name(theme); /* No author available */ /* No description available */ - /* We'll re-use the description field to show variants... - * This is probably too long to be useful... Will fix later... - */ - for (variants = pidgin_conversation_theme_get_variants(PIDGIN_CONV_THEME(theme)); - variants; - variants = g_list_next(variants)) { - - markup = get_theme_markup(name, FALSE, NULL, variants->data); + markup = get_theme_markup(name, FALSE, NULL, NULL); - gtk_list_store_append(prefs_conv_themes, &iter); - gtk_list_store_set(prefs_conv_themes, &iter, 1, markup, 2, name, -1); - } + gtk_list_store_append(prefs_conv_themes, &iter); + gtk_list_store_set(prefs_conv_themes, &iter, 1, markup, 2, name, -1); } } @@ -579,6 +572,9 @@ prefs_themes_refresh(void) gtk_list_store_set(prefs_conv_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); g_free(tmp); + /* conversation theme variants */ + gtk_list_store_clear(prefs_conv_variants); + /* status icon themes */ gtk_list_store_clear(prefs_status_icon_themes); gtk_list_store_append(prefs_status_icon_themes, &iter); @@ -615,6 +611,8 @@ prefs_themes_init(void) prefs_conv_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); + prefs_conv_variants = gtk_list_store_new(1, G_TYPE_STRING); + prefs_status_icon_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); prefs_smiley_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); @@ -1065,15 +1063,60 @@ prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) gchar *name = NULL; if (gtk_combo_box_get_active_iter(combo_box, &iter)) { + const GList *variants; + const char *current_variant; + gboolean unset = TRUE; gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); + if (!name || !*name) { + g_free(name); + return; + } - if(!name || !g_str_equal(name, "")) - theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/theme", name); + + /* Update list of variants */ + gtk_list_store_clear(prefs_conv_variants); + + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + current_variant = pidgin_conversation_theme_get_variant(theme); + + variants = pidgin_conversation_theme_get_variants(theme); + for (; variants && current_variant; variants = g_list_next(variants)) { + gtk_list_store_append(prefs_conv_variants, &iter); + gtk_list_store_set(prefs_conv_variants, &iter, 0, variants->data, -1); + + if (g_str_equal(variants->data, current_variant)) { + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(prefs_conv_variants_combo_box), &iter); + unset = FALSE; + } + } + + if (unset) + gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0); + + g_free(name); + } +} + +/* sets the current conversation theme variant */ +static void +prefs_set_conv_variant_cb(GtkComboBox *combo_box, gpointer user_data) +{ + PidginConvTheme *theme = NULL; + GtkTreeIter iter; + gchar *name = NULL; + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(prefs_conv_themes_combo_box), &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); g_free(name); - purple_debug_info("theme", "Setting conversation theme...\n"); + if (gtk_combo_box_get_active_iter(combo_box, &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_variants), &iter, 0, &name, -1); + pidgin_conversation_theme_set_variant(theme, name); + g_free(name); + } } } @@ -1129,6 +1172,40 @@ add_theme_prefs_combo(GtkWidget *vbox, return combo_box; } +static GtkWidget * +add_child_theme_prefs_combo(GtkWidget *vbox, GtkSizeGroup *combo_sg, + GtkSizeGroup *label_sg, GtkListStore *theme_store, + GCallback combo_box_cb, gpointer combo_box_cb_user_data, + const char *label_str) +{ + GtkWidget *label; + GtkWidget *combo_box; + GtkWidget *themesel_hbox; + GtkCellRenderer *cell_rend; + + themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + gtk_box_pack_start(GTK_BOX(vbox), themesel_hbox, FALSE, FALSE, 0); + + label = gtk_label_new(label_str); + gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); + gtk_size_group_add_widget(label_sg, label); + gtk_box_pack_start(GTK_BOX(themesel_hbox), label, FALSE, FALSE, 0); + + combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(theme_store)); + + cell_rend = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo_box), cell_rend, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_box), cell_rend, "text", 0, NULL); + g_object_set(cell_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); + + g_signal_connect(G_OBJECT(combo_box), "changed", + (GCallback)combo_box_cb, combo_box_cb_user_data); + gtk_size_group_add_widget(combo_sg, combo_box); + gtk_box_pack_start(GTK_BOX(themesel_hbox), combo_box, TRUE, TRUE, 0); + + return combo_box; +} + static GtkWidget * theme_page(void) { @@ -1165,6 +1242,11 @@ theme_page(void) (GCallback)prefs_set_conv_theme_cb, NULL, _("Conversation Theme:"), PIDGIN_PREFS_ROOT "/conversations/theme", "conversation"); + /* Conversation Theme Variants */ + prefs_conv_variants_combo_box = add_child_theme_prefs_combo( + vbox, combo_sg, label_sg, prefs_conv_variants, + (GCallback)prefs_set_conv_variant_cb, NULL, _("\tVariant:")); + /* Status Icon Themes */ prefs_status_themes_combo_box = add_theme_prefs_combo( vbox, combo_sg, label_sg, prefs_status_icon_themes, -- cgit v1.2.1 From 4c69418a8ed6d84032d8a0ea0d8e5f5e28c61854 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Sep 2011 23:49:39 +0000 Subject: Add some missing newlines in debug output. --- pidgin/gtkconv-theme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 72e740140e..61afe9d805 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -310,7 +310,7 @@ get_topic_html(PidginConvThemePrivate *priv, const char *dir) file = g_build_filename(dir, "Contents", "Resources", "Topic.html", NULL); if (!g_file_get_contents(file, &priv->topic_html, NULL, NULL)) { - purple_debug_info("webkit", "%s could not find Resources/Topic.html", dir); + purple_debug_info("webkit", "%s could not find Resources/Topic.html\n", dir); priv->topic_html = g_strdup(""); } g_free(file); @@ -328,7 +328,7 @@ get_status_html(PidginConvThemePrivate *priv, const char *dir) file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { - purple_debug_info("webkit", "%s could not find Resources/Status.html", dir); + purple_debug_info("webkit", "%s could not find Resources/Status.html\n", dir); priv->status_html = g_strdup(""); } g_free(file); -- cgit v1.2.1 From ecd9d30c6294dcd6e7334b8c794cd7d5be20afea Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Sep 2011 00:05:48 +0000 Subject: Fix the gestures plugin, which really only needed a widget from which events could be obtained. It had no GtkIMHtml-specific code. --- pidgin/plugins/Makefile.am | 3 +++ pidgin/plugins/gestures/gestures.c | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index 04fd49f8d3..0674f7ea80 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -16,6 +16,9 @@ if USE_PERL PERL_DIR = perl endif +if ENABLE_GESTURES +GESTURE_DIR = gestures +endif SUBDIRS = \ $(CAP_DIR) \ diff --git a/pidgin/plugins/gestures/gestures.c b/pidgin/plugins/gestures/gestures.c index 4848a844b1..0ef93713f1 100644 --- a/pidgin/plugins/gestures/gestures.c +++ b/pidgin/plugins/gestures/gestures.c @@ -48,7 +48,7 @@ stroke_close(GtkWidget *widget, void *data) gtkconv = PIDGIN_CONVERSATION(conv); - gstroke_cleanup(gtkconv->imhtml); + gstroke_cleanup(gtkconv->webview); purple_conversation_destroy(conv); } @@ -126,15 +126,15 @@ attach_signals(PurpleConversation *conv) gtkconv = PIDGIN_CONVERSATION(conv); - gstroke_enable(gtkconv->imhtml); - gstroke_signal_connect(gtkconv->imhtml, "14789", stroke_close, conv); - gstroke_signal_connect(gtkconv->imhtml, "1456", stroke_close, conv); - gstroke_signal_connect(gtkconv->imhtml, "1489", stroke_close, conv); - gstroke_signal_connect(gtkconv->imhtml, "74123", stroke_next_tab, conv); - gstroke_signal_connect(gtkconv->imhtml, "7456", stroke_next_tab, conv); - gstroke_signal_connect(gtkconv->imhtml, "96321", stroke_prev_tab, conv); - gstroke_signal_connect(gtkconv->imhtml, "9654", stroke_prev_tab, conv); - gstroke_signal_connect(gtkconv->imhtml, "25852", stroke_new_win, conv); + gstroke_enable(gtkconv->webview); + gstroke_signal_connect(gtkconv->webview, "14789", stroke_close, conv); + gstroke_signal_connect(gtkconv->webview, "1456", stroke_close, conv); + gstroke_signal_connect(gtkconv->webview, "1489", stroke_close, conv); + gstroke_signal_connect(gtkconv->webview, "74123", stroke_next_tab, conv); + gstroke_signal_connect(gtkconv->webview, "7456", stroke_next_tab, conv); + gstroke_signal_connect(gtkconv->webview, "96321", stroke_prev_tab, conv); + gstroke_signal_connect(gtkconv->webview, "9654", stroke_prev_tab, conv); + gstroke_signal_connect(gtkconv->webview, "25852", stroke_new_win, conv); } static void @@ -215,8 +215,8 @@ plugin_unload(PurplePlugin *plugin) gtkconv = PIDGIN_CONVERSATION(conv); - gstroke_cleanup(gtkconv->imhtml); - gstroke_disable(gtkconv->imhtml); + gstroke_cleanup(gtkconv->webview); + gstroke_disable(gtkconv->webview); } return TRUE; -- cgit v1.2.1 From 9b83ccd385a4f315482ba199c6bcfd7166cb3290 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Sep 2011 02:19:47 +0000 Subject: Fix fallback of Status.html to Content.html. --- pidgin/gtkconv-theme.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 61afe9d805..75fbe8f56d 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -319,39 +319,39 @@ get_topic_html(PidginConvThemePrivate *priv, const char *dir) } static const char * -get_status_html(PidginConvThemePrivate *priv, const char *dir) +get_content_html(PidginConvThemePrivate *priv, const char *dir) { char *file; - if (priv->status_html) - return priv->status_html; + if (priv->content_html) + return priv->content_html; - file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); - if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { - purple_debug_info("webkit", "%s could not find Resources/Status.html\n", dir); - priv->status_html = g_strdup(""); + file = g_build_filename(dir, "Contents", "Resources", "Content.html", NULL); + if (!g_file_get_contents(file, &priv->content_html, NULL, NULL)) { + purple_debug_info("webkit", "%s did not have a Content.html\n", dir); + priv->content_html = g_strdup(""); } g_free(file); - return priv->status_html; + return priv->content_html; } static const char * -get_content_html(PidginConvThemePrivate *priv, const char *dir) +get_status_html(PidginConvThemePrivate *priv, const char *dir) { char *file; - if (priv->content_html) - return priv->content_html; + if (priv->status_html) + return priv->status_html; - file = g_build_filename(dir, "Contents", "Resources", "Content.html", NULL); - if (!g_file_get_contents(file, &priv->content_html, NULL, NULL)) { - purple_debug_info("webkit", "%s did not have a Content.html\n", dir); - priv->content_html = g_strdup(""); + file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); + if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { + purple_debug_info("webkit", "%s could not find Resources/Status.html\n", dir); + priv->status_html = g_strdup(get_content_html(priv, dir)); } g_free(file); - return priv->content_html; + return priv->status_html; } static const char * -- cgit v1.2.1 From 858270d100a5d3e824663b97e65d94829dcf6a2a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Sep 2011 17:50:24 +0000 Subject: Make sure our pref parents exist, or else saved variants will be forgotten when restarting or re-opening the Preferences. --- pidgin/gtkconv-theme-loader.c | 6 ++++++ pidgin/gtkconv.c | 1 + 2 files changed, 7 insertions(+) diff --git a/pidgin/gtkconv-theme-loader.c b/pidgin/gtkconv-theme-loader.c index e6d7369184..9ca6cec937 100644 --- a/pidgin/gtkconv-theme-loader.c +++ b/pidgin/gtkconv-theme-loader.c @@ -190,6 +190,12 @@ pidgin_conv_loader_build(const gchar *dir) const char *default_variant = NULL; const char *file; + /* Make sure prefs exist */ + prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s", + CFBundleIdentifier); + purple_prefs_add_none(prefname); + g_free(prefname); + /* Try user-set variant */ prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", CFBundleIdentifier); diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index cb6fd1d8d7..4241cc4e0f 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -8205,6 +8205,7 @@ pidgin_conversations_init(void) /* Conversations */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/themes"); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); -- cgit v1.2.1 From 4389d959bdae25c292210e0aed440a4b9bfec241 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Sep 2011 18:24:01 +0000 Subject: Sort the variant list in the Preferences. It tends to be very long, so it shouldn't be done at load time, but its average length dictates that it should be done for the UI, at least. --- pidgin/gtkprefs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index d887bfb1f5..7a15c51e46 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -1247,6 +1247,9 @@ theme_page(void) vbox, combo_sg, label_sg, prefs_conv_variants, (GCallback)prefs_set_conv_variant_cb, NULL, _("\tVariant:")); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(prefs_conv_variants), + 0, GTK_SORT_ASCENDING); + /* Status Icon Themes */ prefs_status_themes_combo_box = add_theme_prefs_combo( vbox, combo_sg, label_sg, prefs_status_icon_themes, -- cgit v1.2.1 From 7512734ee235c14b5c82598175a84277561d9234 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 24 Sep 2011 16:36:57 +0000 Subject: Remove the old deprecated purple_certificate_check_signature_chain. Rename purple_certificate_check_signature_chain_with_failing to purple_certificate_check_signature_chain. --- ChangeLog.API | 2 ++ libpurple/certificate.c | 10 ++-------- libpurple/certificate.h | 23 +---------------------- libpurple/plugins/perl/common/Certificate.xs | 2 +- 4 files changed, 6 insertions(+), 31 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 90857ffa06..8fa145f339 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -53,6 +53,8 @@ version 3.0.0 (??/??/????): * xmlnode_strip_prefixes Changed: + * purple_certificate_check_signature_chain_with_failing renamed + to purple_certificate_check_signature_chain * purple_connection_error now takes a PurpleConnectionError as the second parameter * purple_notify_user_info_add_pair renamed to diff --git a/libpurple/certificate.c b/libpurple/certificate.c index 4453a4e059..dc2b53b472 100644 --- a/libpurple/certificate.c +++ b/libpurple/certificate.c @@ -275,7 +275,7 @@ purple_certificate_signed_by(PurpleCertificate *crt, PurpleCertificate *issuer) } gboolean -purple_certificate_check_signature_chain_with_failing(GList *chain, +purple_certificate_check_signature_chain(GList *chain, PurpleCertificate **failing) { GList *cur; @@ -363,12 +363,6 @@ purple_certificate_check_signature_chain_with_failing(GList *chain, return TRUE; } -gboolean -purple_certificate_check_signature_chain(GList *chain) -{ - return purple_certificate_check_signature_chain_with_failing(chain, NULL); -} - PurpleCertificate * purple_certificate_import(PurpleCertificateScheme *scheme, const gchar *filename) { @@ -1622,7 +1616,7 @@ x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq, ca = purple_certificate_find_pool(x509_tls_cached.scheme_name, "ca"); /* Next, check that the certificate chain is valid */ - if (!purple_certificate_check_signature_chain_with_failing(chain, + if (!purple_certificate_check_signature_chain(chain, &failing_crt)) { gboolean chain_validated = FALSE; diff --git a/libpurple/certificate.h b/libpurple/certificate.h index 66d961770c..6c0d2664f4 100644 --- a/libpurple/certificate.h +++ b/libpurple/certificate.h @@ -462,32 +462,11 @@ purple_certificate_signed_by(PurpleCertificate *crt, PurpleCertificate *issuer); * chain fails to validate, this will be set to the * certificate whose signature could not be validated. * @return TRUE if the chain is valid. See description. - * - * @since 2.6.0 - * @deprecated This function will become - * purple_certificate_check_signature_chain in 3.0.0 */ gboolean -purple_certificate_check_signature_chain_with_failing(GList *chain, +purple_certificate_check_signature_chain(GList *chain, PurpleCertificate **failing); -/** - * Check that a certificate chain is valid - * - * Uses purple_certificate_signed_by() to verify that each PurpleCertificate - * in the chain carries a valid signature from the next. A single-certificate - * chain is considered to be valid. - * - * @param chain List of PurpleCertificate instances comprising the chain, - * in the order certificate, issuer, issuer's issuer, etc. - * @return TRUE if the chain is valid. See description. - * @todo Specify which certificate in the chain caused a failure - * @deprecated This function will be removed in 3.0.0 and replaced with - * purple_certificate_check_signature_chain_with_failing - */ -gboolean -purple_certificate_check_signature_chain(GList *chain); - /** * Imports a PurpleCertificate from a file * diff --git a/libpurple/plugins/perl/common/Certificate.xs b/libpurple/plugins/perl/common/Certificate.xs index 02888722ec..92fa36c8e2 100644 --- a/libpurple/plugins/perl/common/Certificate.xs +++ b/libpurple/plugins/perl/common/Certificate.xs @@ -202,7 +202,7 @@ purple_certificate_check_signature_chain(...) l = g_list_prepend(l, purple_perl_ref_object(ST(i))); } l = g_list_reverse(l); - ret = purple_certificate_check_signature_chain(l); + ret = purple_certificate_check_signature_chain(l, NULL); g_list_free(l); if(ret) XSRETURN_YES; XSRETURN_NO; -- cgit v1.2.1 From 29f5f4cd5998582eb09f986a389e6810a2fcc328 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 24 Sep 2011 17:04:09 +0000 Subject: The following were deprecated since they were moved to the internal API: purple_connection_new purple_connection_new_unregister purple_connection_destroy Remove the public interface. --- ChangeLog.API | 3 ++ libpurple/connection.c | 17 --------- libpurple/connection.h | 57 ----------------------------- libpurple/dbus-analyze-functions.py | 1 - libpurple/plugins/perl/common/Connection.xs | 4 -- 5 files changed, 3 insertions(+), 79 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 8fa145f339..13af890f7e 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -118,6 +118,9 @@ version 3.0.0 (??/??/????): * purple_buddy_icons_find_custom_icon * purple_buddy_icons_set_custom_icon * purple_connection_error_reason + * purple_connection_new + * purple_connection_new_unregister + * purple_connection_destroy * purple_contact_set_alias * purple_conv_chat_set_users * purple_core_migrate diff --git a/libpurple/connection.c b/libpurple/connection.c index 914e3b9de8..f6d37c76bd 100644 --- a/libpurple/connection.c +++ b/libpurple/connection.c @@ -91,12 +91,6 @@ update_keepalive(PurpleConnection *gc, gboolean on) } } -void -purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) -{ - _purple_connection_new(account, regist, password); -} - void _purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) { @@ -171,11 +165,6 @@ _purple_connection_new(PurpleAccount *account, gboolean regist, const char *pass prpl_info->login(account); } } -void -purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) -{ - _purple_connection_new_unregister(account, password, cb, user_data); -} void _purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) @@ -233,12 +222,6 @@ _purple_connection_new_unregister(PurpleAccount *account, const char *password, prpl_info->unregister_user(account, cb, user_data); } -void -purple_connection_destroy(PurpleConnection *gc) -{ - _purple_connection_destroy(gc); -} - void _purple_connection_destroy(PurpleConnection *gc) { diff --git a/libpurple/connection.h b/libpurple/connection.h index 3a7f95f5c5..655191a02a 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -272,63 +272,6 @@ extern "C" { /**************************************************************************/ /*@{*/ -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) -/** - * This function should only be called by purple_account_connect() - * in account.c. If you're trying to sign on an account, use that - * function instead. - * - * Creates a connection to the specified account and either connects - * or attempts to register a new account. If you are logging in, - * the connection uses the current active status for this account. - * So if you want to sign on as "away," for example, you need to - * have called purple_account_set_status(account, "away"). - * (And this will call purple_account_connect() automatically). - * - * @param account The account the connection should be connecting to. - * @param regist Whether we are registering a new account or just - * trying to do a normal signon. - * @param password The password to use. - * - * @deprecated As this is internal, we should make it private in 3.0.0. - */ -void purple_connection_new(PurpleAccount *account, gboolean regist, - const char *password); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) -/** - * This function should only be called by purple_account_unregister() - * in account.c. - * - * Tries to unregister the account on the server. If the account is not - * connected, also creates a new connection. - * - * @param account The account to unregister - * @param password The password to use. - * @param cb Optional callback to be called when unregistration is complete - * @param user_data user data to pass to the callback - * - * @deprecated As this is internal, we should make it private in 3.0.0. - */ -void purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) -/** - * Disconnects and destroys a PurpleConnection. - * - * This function should only be called by purple_account_disconnect() - * in account.c. If you're trying to sign off an account, use that - * function instead. - * - * @param gc The purple connection to destroy. - * - * @deprecated As this is internal, we should make it private in 3.0.0. - */ -void purple_connection_destroy(PurpleConnection *gc); -#endif - /** * Sets the connection state. PRPLs should call this and pass in * the state #PURPLE_CONNECTED when the account is completely diff --git a/libpurple/dbus-analyze-functions.py b/libpurple/dbus-analyze-functions.py index 06aa3f03f3..2003e85d6e 100644 --- a/libpurple/dbus-analyze-functions.py +++ b/libpurple/dbus-analyze-functions.py @@ -29,7 +29,6 @@ excluded = [\ # Similar to the above: "purple_account_set_register_callback", "purple_account_unregister", - "purple_connection_new_unregister", # Similar to the above, again "purple_menu_action_new", diff --git a/libpurple/plugins/perl/common/Connection.xs b/libpurple/plugins/perl/common/Connection.xs index 473cd56bdb..dc0c2660e1 100644 --- a/libpurple/plugins/perl/common/Connection.xs +++ b/libpurple/plugins/perl/common/Connection.xs @@ -35,10 +35,6 @@ purple_connection_notice(gc, text) Purple::Connection gc const char *text -void -purple_connection_destroy(gc) - Purple::Connection gc - void purple_connection_set_state(gc, state) Purple::Connection gc -- cgit v1.2.1 From 138e2d6098116496182e8872e3d803b1bb8aae94 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 24 Sep 2011 20:36:47 +0000 Subject: Remove the deprecated purple_network_listen(), and rename the newer purple_network_listen_family() to renamed to purple_network_listen(). --- ChangeLog.API | 1 + libpurple/network.c | 10 +--------- libpurple/network.h | 31 +++++++++++------------------- libpurple/plugins/perl/common/Network.xs | 3 ++- libpurple/protocols/bonjour/jabber.c | 2 +- libpurple/protocols/yahoo/libymsg.c | 2 +- libpurple/protocols/yahoo/yahoo_filexfer.c | 2 +- 7 files changed, 18 insertions(+), 33 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 13af890f7e..a8bb26bd06 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -57,6 +57,7 @@ version 3.0.0 (??/??/????): to purple_certificate_check_signature_chain * purple_connection_error now takes a PurpleConnectionError as the second parameter + * purple_network_listen_family renamed to purple_network_listen * purple_notify_user_info_add_pair renamed to purple_notify_user_info_add_pair_html * purple_notify_user_info_get_entries returns a GQueue instead of diff --git a/libpurple/network.c b/libpurple/network.c index 1d86947ea9..54fd82c90b 100644 --- a/libpurple/network.c +++ b/libpurple/network.c @@ -531,7 +531,7 @@ purple_network_do_listen(unsigned short port, int socket_family, int socket_type } PurpleNetworkListenData * -purple_network_listen_family(unsigned short port, int socket_family, +purple_network_listen(unsigned short port, int socket_family, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data) { @@ -541,14 +541,6 @@ purple_network_listen_family(unsigned short port, int socket_family, cb, cb_data); } -PurpleNetworkListenData * -purple_network_listen(unsigned short port, int socket_type, - PurpleNetworkListenCallback cb, gpointer cb_data) -{ - return purple_network_listen_family(port, AF_UNSPEC, socket_type, - cb, cb_data); -} - PurpleNetworkListenData * purple_network_listen_range_family(unsigned short start, unsigned short end, int socket_family, int socket_type, diff --git a/libpurple/network.h b/libpurple/network.h index 333f8e7f30..44a4d2ed58 100644 --- a/libpurple/network.h +++ b/libpurple/network.h @@ -142,7 +142,18 @@ void purple_network_listen_map_external(gboolean map_external); * close the listening socket, and add a new watcher on the new socket accept * returned. * + * Libpurple does not currently do any port mapping (stateful firewall hole + * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped + * addresses, a mapping is done). + * * @param port The port number to bind to. Must be greater than 0. + * @param socket_family The protocol family of the socket. This should be + * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets + * may or may not be able to accept IPv4 connections + * based on the system configuration (use + * purple_socket_speaks_ipv4 to check). If an IPv6 + * socket doesn't accept V4-mapped addresses, you will + * need a second listener to support both v4 and v6. * @param socket_type The type of socket to open for listening. * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. * @param cb The callback to be invoked when the port to listen on is available. @@ -155,26 +166,6 @@ void purple_network_listen_map_external(gboolean map_external); * socket to listen on. */ PurpleNetworkListenData *purple_network_listen(unsigned short port, - int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); - -/** - * \copydoc purple_network_listen - * - * Libpurple does not currently do any port mapping (stateful firewall hole - * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped - * addresses, a mapping is done). - * - * @param socket_family The protocol family of the socket. This should be - * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets - * may or may not be able to accept IPv4 connections - * based on the system configuration (use - * purple_socket_speaks_ipv4 to check). If an IPv6 - * socket doesn't accept V4-mapped addresses, you will - * need a second listener to support both v4 and v6. - * @since 2.7.0 - * @deprecated This function will be renamed to purple_network_listen in 3.0.0. - */ -PurpleNetworkListenData *purple_network_listen_family(unsigned short port, int socket_family, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); diff --git a/libpurple/plugins/perl/common/Network.xs b/libpurple/plugins/perl/common/Network.xs index 7b3ae1c91d..8830cb433b 100644 --- a/libpurple/plugins/perl/common/Network.xs +++ b/libpurple/plugins/perl/common/Network.xs @@ -23,8 +23,9 @@ purple_network_ip_atoi(ip) const char *ip Purple::NetworkListenData -purple_network_listen(port, socket_type, cb, cb_data) +purple_network_listen(port, socket_family, socket_type, cb, cb_data) unsigned short port + int socket_family int socket_type Purple::NetworkListenCallback cb gpointer cb_data diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index 94e82c3cf7..7ff2e3a6c4 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -744,7 +744,7 @@ start_serversocket_listening(int port, int socket, struct sockaddr *addr, size_t #if 0 /* TODO: Why isn't this being used? */ - data->socket = purple_network_listen(jdata->port, SOCK_STREAM); + data->socket = purple_network_listen(jdata->port, AF_UNSPEC, SOCK_STREAM); if (jdata->socket == -1) { diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 5fa9e57a04..3d17a71f45 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -2770,7 +2770,7 @@ void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13) if (yd->listen_data) purple_debug_warning("yahoo","p2p: Failed to create p2p server - server already exists\n"); else { - yd->listen_data = purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data); + yd->listen_data = purple_network_listen(YAHOO_PAGER_PORT_P2P, AF_UNSPEC, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data); if (yd->listen_data == NULL) purple_debug_warning("yahoo","p2p: Failed to created p2p server\n"); } diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index 15b09fe05f..3831baee27 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -1216,7 +1216,7 @@ static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputConditi close(source); xfer->fd = -1; /* start local server, listen for connections */ - purple_network_listen(xd->yahoo_local_p2p_ft_server_port, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer); + purple_network_listen(xd->yahoo_local_p2p_ft_server_port, AF_UNSPEC, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer); } else { -- cgit v1.2.1 From 26ee015d3d75da7f974a92648acce0e9656d869a Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 24 Sep 2011 20:48:59 +0000 Subject: Rename purple_network_listen_range_family() to purple_network_listen_range(). --- ChangeLog.API | 2 ++ libpurple/network.c | 11 +--------- libpurple/network.h | 35 ++++++++++-------------------- libpurple/plugins/perl/common/Network.xs | 3 ++- libpurple/protocols/bonjour/bonjour_ft.c | 2 +- libpurple/protocols/irc/dcc_send.c | 2 +- libpurple/protocols/jabber/si.c | 2 +- libpurple/protocols/msn/slpcall.c | 2 ++ libpurple/protocols/oscar/peer.c | 2 +- libpurple/protocols/simple/simple.c | 4 ++-- libpurple/protocols/yahoo/yahoo_filexfer.c | 4 ++-- libpurple/stun.c | 2 +- 12 files changed, 28 insertions(+), 43 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index a8bb26bd06..59445c7c57 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -58,6 +58,8 @@ version 3.0.0 (??/??/????): * purple_connection_error now takes a PurpleConnectionError as the second parameter * purple_network_listen_family renamed to purple_network_listen + * purple_network_listen_range_family renamed to + purple_network_listen_range * purple_notify_user_info_add_pair renamed to purple_notify_user_info_add_pair_html * purple_notify_user_info_get_entries returns a GQueue instead of diff --git a/libpurple/network.c b/libpurple/network.c index 54fd82c90b..df9875628e 100644 --- a/libpurple/network.c +++ b/libpurple/network.c @@ -542,7 +542,7 @@ purple_network_listen(unsigned short port, int socket_family, } PurpleNetworkListenData * -purple_network_listen_range_family(unsigned short start, unsigned short end, +purple_network_listen_range(unsigned short start, unsigned short end, int socket_family, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data) @@ -566,15 +566,6 @@ purple_network_listen_range_family(unsigned short start, unsigned short end, return ret; } -PurpleNetworkListenData * -purple_network_listen_range(unsigned short start, unsigned short end, - int socket_type, PurpleNetworkListenCallback cb, - gpointer cb_data) -{ - return purple_network_listen_range_family(start, end, AF_UNSPEC, - socket_type, cb, cb_data); -} - void purple_network_listen_cancel(PurpleNetworkListenData *listen_data) { if (listen_data->mapping_data != NULL) diff --git a/libpurple/network.h b/libpurple/network.h index 44a4d2ed58..7fd87d0c00 100644 --- a/libpurple/network.h +++ b/libpurple/network.h @@ -183,11 +183,22 @@ PurpleNetworkListenData *purple_network_listen(unsigned short port, * the listening socket, and add a new watcher on the new socket accept * returned. * + * Libpurple does not currently do any port mapping (stateful firewall hole + * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped + * addresses, a mapping is done). + * * @param start The port number to bind to, or 0 to pick a random port. * Users are allowed to override this arg in prefs. * @param end The highest possible port in the range of ports to listen on, * or 0 to pick a random port. Users are allowed to override this * arg in prefs. + * @param socket_family The protocol family of the socket. This should be + * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets + * may or may not be able to accept IPv4 connections + * based on the system configuration (use + * purple_socket_speaks_ipv4 to check). If an IPv6 + * socket doesn't accept V4-mapped addresses, you will + * need a second listener to support both v4 and v6. * @param socket_type The type of socket to open for listening. * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. * @param cb The callback to be invoked when the port to listen on is available. @@ -199,29 +210,7 @@ PurpleNetworkListenData *purple_network_listen(unsigned short port, * the pending listener, or NULL if unable to obtain a local * socket to listen on. */ -PurpleNetworkListenData *purple_network_listen_range(unsigned short start, - unsigned short end, int socket_type, - PurpleNetworkListenCallback cb, gpointer cb_data); - -/** - * \copydoc purple_network_listen_range - * - * Libpurple does not currently do any port mapping (stateful firewall hole - * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped - * addresses, a mapping is done). - * - * @param socket_family The protocol family of the socket. This should be - * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets - * may or may not be able to accept IPv4 connections - * based on the system configuration (use - * purple_socket_speaks_ipv4 to check). If an IPv6 - * socket doesn't accept V4-mapped addresses, you will - * need a second listener to support both v4 and v6. - * @since 2.7.0 - * @deprecated This function will be renamed to purple_network_listen_range - * in 3.0.0. - */ -PurpleNetworkListenData *purple_network_listen_range_family( +PurpleNetworkListenData *purple_network_listen_range( unsigned short start, unsigned short end, int socket_family, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); diff --git a/libpurple/plugins/perl/common/Network.xs b/libpurple/plugins/perl/common/Network.xs index 8830cb433b..21d3b4f56a 100644 --- a/libpurple/plugins/perl/common/Network.xs +++ b/libpurple/plugins/perl/common/Network.xs @@ -31,9 +31,10 @@ purple_network_listen(port, socket_family, socket_type, cb, cb_data) gpointer cb_data Purple::NetworkListenData -purple_network_listen_range(start, end, socket_type, cb, cb_data) +purple_network_listen_range(start, end, socket_family, socket_type, cb, cb_data) unsigned short start unsigned short end + int socket_family int socket_type Purple::NetworkListenCallback cb gpointer cb_data diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index 6aa05bc941..2ee9157df8 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -793,7 +793,7 @@ bonjour_bytestreams_init(PurpleXfer *xfer) xf = purple_xfer_get_protocol_data(xfer); purple_network_listen_map_external(FALSE); - xf->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, + xf->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, bonjour_bytestreams_listen, xfer); purple_network_listen_map_external(TRUE); if (xf->listen_data == NULL) diff --git a/libpurple/protocols/irc/dcc_send.c b/libpurple/protocols/irc/dcc_send.c index d55882cac5..55d5b39739 100644 --- a/libpurple/protocols/irc/dcc_send.c +++ b/libpurple/protocols/irc/dcc_send.c @@ -339,7 +339,7 @@ static void irc_dccsend_send_init(PurpleXfer *xfer) { purple_xfer_ref(xfer); /* Create a listening socket */ - xd->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, + xd->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, irc_dccsend_network_listen_cb, xfer); if (xd->listen_data == NULL) { purple_xfer_unref(xfer); diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index 8e32b7201c..ff46c2a4c5 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -959,7 +959,7 @@ jabber_si_xfer_bytestreams_send_init(PurpleXfer *xfer) purple_debug_info("jabber", "Skipping attempting local streamhost.\n"); jsx->listen_data = NULL; } else - jsx->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, + jsx->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, jabber_si_xfer_bytestreams_listen_cb, xfer); if (jsx->listen_data == NULL) { diff --git a/libpurple/protocols/msn/slpcall.c b/libpurple/protocols/msn/slpcall.c index 4f2ff99cb5..67acd7ab87 100644 --- a/libpurple/protocols/msn/slpcall.c +++ b/libpurple/protocols/msn/slpcall.c @@ -731,6 +731,7 @@ got_invite(MsnSlpCall *slpcall, dc->listen_data = purple_network_listen_range( 0, 0, + AF_UNSPEC, SOCK_STREAM, msn_dc_listen_socket_created_cb, dc @@ -832,6 +833,7 @@ got_ok(MsnSlpCall *slpcall, dc->listen_data = purple_network_listen_range( 0, 0, + AF_UNSPEC, SOCK_STREAM, msn_dc_listen_socket_created_cb, dc diff --git a/libpurple/protocols/oscar/peer.c b/libpurple/protocols/oscar/peer.c index ec9aae58f3..1f0c2ce2ea 100644 --- a/libpurple/protocols/oscar/peer.c +++ b/libpurple/protocols/oscar/peer.c @@ -842,7 +842,7 @@ peer_connection_trynext(PeerConnection *conn) */ conn->flags |= PEER_CONNECTION_FLAG_IS_INCOMING; - conn->listen_data = purple_network_listen_range(5190, 5290, SOCK_STREAM, + conn->listen_data = purple_network_listen_range(5190, 5290, AF_UNSPEC, SOCK_STREAM, peer_connection_establish_listener_cb, conn); if (conn->listen_data != NULL) { diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index 83101a8d91..39a936317f 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -1823,7 +1823,7 @@ static void simple_udp_host_resolved(GSList *hosts, gpointer data, const char *e } /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_DGRAM, + sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_DGRAM, simple_udp_host_resolved_listen_cb, sip); if (sip->listen_data == NULL) { purple_connection_error(sip->gc, @@ -1893,7 +1893,7 @@ static void srvresolved(PurpleSrvResponse *resp, int results, gpointer data) { /* TCP case */ if(!sip->udp) { /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_STREAM, + sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_STREAM, simple_tcp_connect_listen_cb, sip); if (sip->listen_data == NULL) { purple_connection_error(sip->gc, diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index 3831baee27..7acfd8a673 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -1570,7 +1570,7 @@ static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer p2p_data = g_hash_table_lookup(yd->peers, purple_xfer_get_remote_user(xfer)); if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER ) - if(purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) + if(purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) return; pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -1871,7 +1871,7 @@ void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet * purple_xfer_cancel_remote(xfer); return; } - if(!purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) { + if(!purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) { purple_xfer_cancel_remote(xfer); return; } diff --git a/libpurple/stun.c b/libpurple/stun.c index 5ece26580e..6a6eec83ad 100644 --- a/libpurple/stun.c +++ b/libpurple/stun.c @@ -338,7 +338,7 @@ static void hbn_cb(GSList *hosts, gpointer data, const char *error_message) { return; } - if (!purple_network_listen_range(12108, 12208, SOCK_DGRAM, hbn_listen_cb, hosts)) { + if (!purple_network_listen_range(12108, 12208, AF_UNSPEC, SOCK_DGRAM, hbn_listen_cb, hosts)) { while (hosts) { hosts = g_slist_delete_link(hosts, hosts); g_free(hosts->data); -- cgit v1.2.1 From eddc0224677eefece6cea7d6264231f588efefdf Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 24 Sep 2011 21:10:41 +0000 Subject: Remove deprecated purple_network_listen_map_external(). Update purple_network_listen() and purple_network_listen_range() to have a boolean parameter that indicates if the port should be mapped externally. --- ChangeLog.API | 1 + libpurple/network.c | 21 ++++++++------------- libpurple/network.h | 23 ++++++++--------------- libpurple/plugins/perl/common/Network.xs | 6 ++++-- libpurple/protocols/bonjour/bonjour_ft.c | 4 +--- libpurple/protocols/bonjour/jabber.c | 2 +- libpurple/protocols/irc/dcc_send.c | 2 +- libpurple/protocols/jabber/si.c | 2 +- libpurple/protocols/msn/slpcall.c | 2 ++ libpurple/protocols/oscar/peer.c | 2 +- libpurple/protocols/simple/simple.c | 4 ++-- libpurple/protocols/yahoo/libymsg.c | 2 +- libpurple/protocols/yahoo/yahoo_filexfer.c | 6 +++--- libpurple/stun.c | 2 +- 14 files changed, 35 insertions(+), 44 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 59445c7c57..98439c9c41 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -128,6 +128,7 @@ version 3.0.0 (??/??/????): * purple_conv_chat_set_users * purple_core_migrate * purple_dnsquery_a_account + * purple_network_listen_map_external * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count diff --git a/libpurple/network.c b/libpurple/network.c index df9875628e..4e30d17f20 100644 --- a/libpurple/network.c +++ b/libpurple/network.c @@ -391,14 +391,9 @@ purple_network_finish_pmp_map_cb(gpointer data) return FALSE; } -static gboolean listen_map_external = TRUE; -void purple_network_listen_map_external(gboolean map_external) -{ - listen_map_external = map_external; -} - static PurpleNetworkListenData * -purple_network_do_listen(unsigned short port, int socket_family, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data) +purple_network_do_listen(unsigned short port, int socket_family, int socket_type, gboolean map_external, + PurpleNetworkListenCallback cb, gpointer cb_data) { int listenfd = -1; int flags; @@ -503,7 +498,7 @@ purple_network_do_listen(unsigned short port, int socket_family, int socket_type listen_data->cb_data = cb_data; listen_data->socket_type = socket_type; - if (!purple_socket_speaks_ipv4(listenfd) || !listen_map_external || + if (!purple_socket_speaks_ipv4(listenfd) || !map_external || !purple_prefs_get_bool("/purple/network/map_ports")) { purple_debug_info("network", "Skipping external port mapping.\n"); @@ -531,19 +526,19 @@ purple_network_do_listen(unsigned short port, int socket_family, int socket_type } PurpleNetworkListenData * -purple_network_listen(unsigned short port, int socket_family, - int socket_type, PurpleNetworkListenCallback cb, +purple_network_listen(unsigned short port, int socket_family, int socket_type, + gboolean map_external, PurpleNetworkListenCallback cb, gpointer cb_data) { g_return_val_if_fail(port != 0, NULL); - return purple_network_do_listen(port, socket_family, socket_type, + return purple_network_do_listen(port, socket_family, socket_type, map_external, cb, cb_data); } PurpleNetworkListenData * purple_network_listen_range(unsigned short start, unsigned short end, - int socket_family, int socket_type, + int socket_family, int socket_type, gboolean map_external, PurpleNetworkListenCallback cb, gpointer cb_data) { @@ -558,7 +553,7 @@ purple_network_listen_range(unsigned short start, unsigned short end, } for (; start <= end; start++) { - ret = purple_network_do_listen(start, AF_UNSPEC, socket_type, cb, cb_data); + ret = purple_network_do_listen(start, AF_UNSPEC, socket_type, map_external, cb, cb_data); if (ret != NULL) break; } diff --git a/libpurple/network.h b/libpurple/network.h index 7fd87d0c00..3327970dbe 100644 --- a/libpurple/network.h +++ b/libpurple/network.h @@ -117,18 +117,6 @@ GList *purple_network_get_all_local_system_ips(void); */ const char *purple_network_get_my_ip(int fd); -/** - * Should calls to purple_network_listen() and purple_network_listen_range() - * map the port externally using NAT-PMP or UPnP? - * The default value is TRUE - * - * @param map_external Should the open port be mapped externally? - * @deprecated In 3.0.0 a boolean will be added to the functions mentioned - * above to perform the same function. - * @since 2.3.0 - */ -void purple_network_listen_map_external(gboolean map_external); - /** * Attempts to open a listening port ONLY on the specified port number. * You probably want to use purple_network_listen_range() instead of this. @@ -156,6 +144,8 @@ void purple_network_listen_map_external(gboolean map_external); * need a second listener to support both v4 and v6. * @param socket_type The type of socket to open for listening. * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. + * @param map_external Should the open port be mapped externally using + * NAT-PNP or UPnP? (default should be TRUE) * @param cb The callback to be invoked when the port to listen on is available. * The file descriptor of the listening socket will be specified in * this callback, or -1 if no socket could be established. @@ -166,8 +156,8 @@ void purple_network_listen_map_external(gboolean map_external); * socket to listen on. */ PurpleNetworkListenData *purple_network_listen(unsigned short port, - int socket_family, int socket_type, PurpleNetworkListenCallback cb, - gpointer cb_data); + int socket_family, int socket_type, gboolean map_external, + PurpleNetworkListenCallback cb, gpointer cb_data); /** * Opens a listening port selected from a range of ports. The range of @@ -201,6 +191,8 @@ PurpleNetworkListenData *purple_network_listen(unsigned short port, * need a second listener to support both v4 and v6. * @param socket_type The type of socket to open for listening. * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. + * @param map_external Should the open port be mapped externally using + * NAT-PNP or UPnP? (default should be TRUE) * @param cb The callback to be invoked when the port to listen on is available. * The file descriptor of the listening socket will be specified in * this callback, or -1 if no socket could be established. @@ -212,7 +204,8 @@ PurpleNetworkListenData *purple_network_listen(unsigned short port, */ PurpleNetworkListenData *purple_network_listen_range( unsigned short start, unsigned short end, int socket_family, - int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); + int socket_type, gboolean map_external, + PurpleNetworkListenCallback cb, gpointer cb_data); /** * This can be used to cancel any in-progress listener connection diff --git a/libpurple/plugins/perl/common/Network.xs b/libpurple/plugins/perl/common/Network.xs index 21d3b4f56a..1388b3abed 100644 --- a/libpurple/plugins/perl/common/Network.xs +++ b/libpurple/plugins/perl/common/Network.xs @@ -23,19 +23,21 @@ purple_network_ip_atoi(ip) const char *ip Purple::NetworkListenData -purple_network_listen(port, socket_family, socket_type, cb, cb_data) +purple_network_listen(port, socket_family, socket_type, map_external, cb, cb_data) unsigned short port int socket_family int socket_type + gboolean map_external Purple::NetworkListenCallback cb gpointer cb_data Purple::NetworkListenData -purple_network_listen_range(start, end, socket_family, socket_type, cb, cb_data) +purple_network_listen_range(start, end, socket_family, socket_type, map_external, cb, cb_data) unsigned short start unsigned short end int socket_family int socket_type + gboolean map_external Purple::NetworkListenCallback cb gpointer cb_data diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index 2ee9157df8..e4407917e1 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -792,10 +792,8 @@ bonjour_bytestreams_init(PurpleXfer *xfer) purple_debug_info("bonjour", "Bonjour-bytestreams-init.\n"); xf = purple_xfer_get_protocol_data(xfer); - purple_network_listen_map_external(FALSE); - xf->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, + xf->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, FALSE, bonjour_bytestreams_listen, xfer); - purple_network_listen_map_external(TRUE); if (xf->listen_data == NULL) purple_xfer_cancel_local(xfer); diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index 7ff2e3a6c4..327075e669 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -744,7 +744,7 @@ start_serversocket_listening(int port, int socket, struct sockaddr *addr, size_t #if 0 /* TODO: Why isn't this being used? */ - data->socket = purple_network_listen(jdata->port, AF_UNSPEC, SOCK_STREAM); + data->socket = purple_network_listen(jdata->port, AF_UNSPEC, SOCK_STREAM, TRUE); if (jdata->socket == -1) { diff --git a/libpurple/protocols/irc/dcc_send.c b/libpurple/protocols/irc/dcc_send.c index 55d5b39739..6a2f1ebf51 100644 --- a/libpurple/protocols/irc/dcc_send.c +++ b/libpurple/protocols/irc/dcc_send.c @@ -339,7 +339,7 @@ static void irc_dccsend_send_init(PurpleXfer *xfer) { purple_xfer_ref(xfer); /* Create a listening socket */ - xd->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, + xd->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, irc_dccsend_network_listen_cb, xfer); if (xd->listen_data == NULL) { purple_xfer_unref(xfer); diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index ff46c2a4c5..ae0f818fb0 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -959,7 +959,7 @@ jabber_si_xfer_bytestreams_send_init(PurpleXfer *xfer) purple_debug_info("jabber", "Skipping attempting local streamhost.\n"); jsx->listen_data = NULL; } else - jsx->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, + jsx->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, jabber_si_xfer_bytestreams_listen_cb, xfer); if (jsx->listen_data == NULL) { diff --git a/libpurple/protocols/msn/slpcall.c b/libpurple/protocols/msn/slpcall.c index 67acd7ab87..8f29699ded 100644 --- a/libpurple/protocols/msn/slpcall.c +++ b/libpurple/protocols/msn/slpcall.c @@ -733,6 +733,7 @@ got_invite(MsnSlpCall *slpcall, 0, 0, AF_UNSPEC, SOCK_STREAM, + TRUE, msn_dc_listen_socket_created_cb, dc ); @@ -835,6 +836,7 @@ got_ok(MsnSlpCall *slpcall, 0, 0, AF_UNSPEC, SOCK_STREAM, + TRUE, msn_dc_listen_socket_created_cb, dc ); diff --git a/libpurple/protocols/oscar/peer.c b/libpurple/protocols/oscar/peer.c index 1f0c2ce2ea..d67d310285 100644 --- a/libpurple/protocols/oscar/peer.c +++ b/libpurple/protocols/oscar/peer.c @@ -842,7 +842,7 @@ peer_connection_trynext(PeerConnection *conn) */ conn->flags |= PEER_CONNECTION_FLAG_IS_INCOMING; - conn->listen_data = purple_network_listen_range(5190, 5290, AF_UNSPEC, SOCK_STREAM, + conn->listen_data = purple_network_listen_range(5190, 5290, AF_UNSPEC, SOCK_STREAM, TRUE, peer_connection_establish_listener_cb, conn); if (conn->listen_data != NULL) { diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index 39a936317f..45ded930bc 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -1823,7 +1823,7 @@ static void simple_udp_host_resolved(GSList *hosts, gpointer data, const char *e } /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_DGRAM, + sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_DGRAM, TRUE, simple_udp_host_resolved_listen_cb, sip); if (sip->listen_data == NULL) { purple_connection_error(sip->gc, @@ -1893,7 +1893,7 @@ static void srvresolved(PurpleSrvResponse *resp, int results, gpointer data) { /* TCP case */ if(!sip->udp) { /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_STREAM, + sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_STREAM, TRUE, simple_tcp_connect_listen_cb, sip); if (sip->listen_data == NULL) { purple_connection_error(sip->gc, diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 3d17a71f45..31a6617550 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -2770,7 +2770,7 @@ void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13) if (yd->listen_data) purple_debug_warning("yahoo","p2p: Failed to create p2p server - server already exists\n"); else { - yd->listen_data = purple_network_listen(YAHOO_PAGER_PORT_P2P, AF_UNSPEC, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data); + yd->listen_data = purple_network_listen(YAHOO_PAGER_PORT_P2P, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_server_listen_cb, p2p_data); if (yd->listen_data == NULL) purple_debug_warning("yahoo","p2p: Failed to created p2p server\n"); } diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index 7acfd8a673..37b051aa3e 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -1216,7 +1216,7 @@ static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputConditi close(source); xfer->fd = -1; /* start local server, listen for connections */ - purple_network_listen(xd->yahoo_local_p2p_ft_server_port, AF_UNSPEC, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer); + purple_network_listen(xd->yahoo_local_p2p_ft_server_port, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_ft_server_listen_cb, xfer); } else { @@ -1570,7 +1570,7 @@ static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer p2p_data = g_hash_table_lookup(yd->peers, purple_xfer_get_remote_user(xfer)); if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER ) - if(purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) + if(purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_ft_server_listen_cb, xfer)) return; pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -1871,7 +1871,7 @@ void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet * purple_xfer_cancel_remote(xfer); return; } - if(!purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) { + if(!purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_ft_server_listen_cb, xfer)) { purple_xfer_cancel_remote(xfer); return; } diff --git a/libpurple/stun.c b/libpurple/stun.c index 6a6eec83ad..8f1d47a5ce 100644 --- a/libpurple/stun.c +++ b/libpurple/stun.c @@ -338,7 +338,7 @@ static void hbn_cb(GSList *hosts, gpointer data, const char *error_message) { return; } - if (!purple_network_listen_range(12108, 12208, AF_UNSPEC, SOCK_DGRAM, hbn_listen_cb, hosts)) { + if (!purple_network_listen_range(12108, 12208, AF_UNSPEC, SOCK_DGRAM, TRUE, hbn_listen_cb, hosts)) { while (hosts) { hosts = g_slist_delete_link(hosts, hosts); g_free(hosts->data); -- cgit v1.2.1 From 823d96d91d8b256d019291a44496fa8967c92e2f Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 24 Sep 2011 21:14:19 +0000 Subject: jabber_presence_create() is marked as deprecated and is not used - so remove it. --- libpurple/protocols/jabber/presence.c | 5 ----- libpurple/protocols/jabber/presence.h | 1 - 2 files changed, 6 deletions(-) diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c index 454b9ec318..9f64e52575 100644 --- a/libpurple/protocols/jabber/presence.c +++ b/libpurple/protocols/jabber/presence.c @@ -299,11 +299,6 @@ void jabber_presence_send(JabberStream *js, gboolean force) jabber_presence_fake_to_self(js, status); } -xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority) -{ - return jabber_presence_create_js(NULL, state, msg, priority); -} - xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority) { xmlnode *show, *status, *presence, *pri, *c; diff --git a/libpurple/protocols/jabber/presence.h b/libpurple/protocols/jabber/presence.h index e83309278a..98322fd9ae 100644 --- a/libpurple/protocols/jabber/presence.h +++ b/libpurple/protocols/jabber/presence.h @@ -92,7 +92,6 @@ void jabber_set_status(PurpleAccount *account, PurpleStatus *status); */ void jabber_presence_send(JabberStream *js, gboolean force); -xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority); /* DEPRECATED */ xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority); void jabber_presence_parse(JabberStream *js, xmlnode *packet); void jabber_presence_subscription_set(JabberStream *js, const char *who, -- cgit v1.2.1 From 517535725dfdaef23ded01a73bec59c3b590f07b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 24 Sep 2011 21:15:29 +0000 Subject: Make the current variant a property. --- pidgin/gtkconv-theme.c | 76 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 23 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 75fbe8f56d..f7a1b27276 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -37,6 +37,8 @@ #define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \ (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate)) +static void _set_variant(PidginConvTheme *theme, const char *variant); + /****************************************************************************** * Structs *****************************************************************************/ @@ -67,12 +69,6 @@ typedef struct { char *basestyle_css; } PidginConvThemePrivate; -/****************************************************************************** - * Globals - *****************************************************************************/ - -static GObjectClass *parent_class = NULL; - /****************************************************************************** * Enums *****************************************************************************/ @@ -80,8 +76,17 @@ static GObjectClass *parent_class = NULL; enum { PROP_ZERO = 0, PROP_INFO, + PROP_VARIANT, + PROP_LAST }; +/****************************************************************************** + * Globals + *****************************************************************************/ + +static GObjectClass *parent_class = NULL; +static GParamSpec *properties[PROP_LAST]; + /****************************************************************************** * GObject Stuff *****************************************************************************/ @@ -96,6 +101,11 @@ pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value, case PROP_INFO: g_value_set_boxed(value, (gpointer)pidgin_conversation_theme_get_info(theme)); break; + + case PROP_VARIANT: + g_value_set_string(value, pidgin_conversation_theme_get_variant(theme)); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); break; @@ -112,6 +122,11 @@ pidgin_conv_theme_set_property(GObject *obj, guint param_id, const GValue *value case PROP_INFO: pidgin_conversation_theme_set_info(theme, g_value_get_boxed(value)); break; + + case PROP_VARIANT: + _set_variant(theme, g_value_get_string(value)); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); break; @@ -176,6 +191,14 @@ pidgin_conv_theme_class_init(PidginConvThemeClass *klass) G_TYPE_HASH_TABLE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property(obj_class, PROP_INFO, pspec); + properties[PROP_INFO] = pspec; + + /* VARIANT */ + pspec = g_param_spec_string("variant", "Variant", + "The current variant for this theme", + NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property(obj_class, PROP_VARIANT, pspec); + properties[PROP_VARIANT] = pspec; } @@ -490,6 +513,28 @@ get_outgoing_next_context_html(PidginConvThemePrivate *priv, const char *dir) return priv->outgoing_next_context_html; } +static void +_set_variant(PidginConvTheme *theme, const char *variant) +{ + PidginConvThemePrivate *priv; + const GValue *val; + char *prefname; + + g_return_if_fail(theme != NULL); + g_return_if_fail(variant != NULL); + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); + + g_free(priv->variant); + priv->variant = g_strdup(variant); + + val = get_key(priv, "CFBundleIdentifier", FALSE); + prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", + g_value_get_string(val)); + purple_prefs_set_string(prefname, variant); + g_free(prefname); +} + /***************************************************************************** * Public API functions *****************************************************************************/ @@ -628,23 +673,8 @@ pidgin_conversation_theme_get_variant(PidginConvTheme *theme) void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant) { - PidginConvThemePrivate *priv; - const GValue *val; - char *prefname; - - g_return_if_fail(theme != NULL); - g_return_if_fail(variant != NULL); - - priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - - g_free(priv->variant); - priv->variant = g_strdup(variant); - - val = get_key(priv, "CFBundleIdentifier", FALSE); - prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", - g_value_get_string(val)); - purple_prefs_set_string(prefname, variant); - g_free(prefname); + _set_variant(theme, variant); + g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_VARIANT]); } const GList * -- cgit v1.2.1 From 53f02f76448f4d8dedf7841d983138abb172eb01 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 24 Sep 2011 21:16:14 +0000 Subject: Rearrange to drop the prototypes. --- pidgin/gtkconv-theme.c | 278 ++++++++++++++++++++++++------------------------- 1 file changed, 138 insertions(+), 140 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index f7a1b27276..fc009582ce 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -37,8 +37,6 @@ #define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \ (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate)) -static void _set_variant(PidginConvTheme *theme, const char *variant); - /****************************************************************************** * Structs *****************************************************************************/ @@ -87,144 +85,6 @@ enum { static GObjectClass *parent_class = NULL; static GParamSpec *properties[PROP_LAST]; -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value, - GParamSpec *psec) -{ - PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); - - switch (param_id) { - case PROP_INFO: - g_value_set_boxed(value, (gpointer)pidgin_conversation_theme_get_info(theme)); - break; - - case PROP_VARIANT: - g_value_set_string(value, pidgin_conversation_theme_get_variant(theme)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); - break; - } -} - -static void -pidgin_conv_theme_set_property(GObject *obj, guint param_id, const GValue *value, - GParamSpec *psec) -{ - PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); - - switch (param_id) { - case PROP_INFO: - pidgin_conversation_theme_set_info(theme, g_value_get_boxed(value)); - break; - - case PROP_VARIANT: - _set_variant(theme, g_value_get_string(value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); - break; - } -} - -static void -pidgin_conv_theme_init(GTypeInstance *instance, - gpointer klass) -{ - PidginConvThemePrivate *priv; - - priv = PIDGIN_CONV_THEME_GET_PRIVATE(instance); -} - -static void -pidgin_conv_theme_finalize(GObject *obj) -{ - PidginConvThemePrivate *priv; - - priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj); - - g_free(priv->template_html); - g_free(priv->header_html); - g_free(priv->footer_html); - g_free(priv->topic_html); - g_free(priv->status_html); - g_free(priv->content_html); - g_free(priv->incoming_content_html); - g_free(priv->outgoing_content_html); - g_free(priv->incoming_next_content_html); - g_free(priv->outgoing_next_content_html); - g_free(priv->incoming_context_html); - g_free(priv->outgoing_context_html); - g_free(priv->incoming_next_context_html); - g_free(priv->outgoing_next_context_html); - g_free(priv->basestyle_css); - - if (priv->info) - g_hash_table_destroy(priv->info); - - parent_class->finalize(obj); -} - -static void -pidgin_conv_theme_class_init(PidginConvThemeClass *klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS(klass); - GParamSpec *pspec; - - parent_class = g_type_class_peek_parent(klass); - - g_type_class_add_private(klass, sizeof(PidginConvThemePrivate)); - - obj_class->get_property = pidgin_conv_theme_get_property; - obj_class->set_property = pidgin_conv_theme_set_property; - obj_class->finalize = pidgin_conv_theme_finalize; - - /* INFO */ - pspec = g_param_spec_boxed("info", "Info", - "The information about this theme", - G_TYPE_HASH_TABLE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); - g_object_class_install_property(obj_class, PROP_INFO, pspec); - properties[PROP_INFO] = pspec; - - /* VARIANT */ - pspec = g_param_spec_string("variant", "Variant", - "The current variant for this theme", - NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); - g_object_class_install_property(obj_class, PROP_VARIANT, pspec); - properties[PROP_VARIANT] = pspec; - -} - -GType -pidgin_conversation_theme_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PidginConvThemeClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)pidgin_conv_theme_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PidginConvTheme), - 0, /* n_preallocs */ - pidgin_conv_theme_init, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static(PURPLE_TYPE_THEME, - "PidginConvTheme", &info, 0); - } - return type; -} - /****************************************************************************** * Helper Functions *****************************************************************************/ @@ -535,6 +395,144 @@ _set_variant(PidginConvTheme *theme, const char *variant) g_free(prefname); } +/****************************************************************************** + * GObject Stuff + *****************************************************************************/ + +static void +pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value, + GParamSpec *psec) +{ + PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); + + switch (param_id) { + case PROP_INFO: + g_value_set_boxed(value, (gpointer)pidgin_conversation_theme_get_info(theme)); + break; + + case PROP_VARIANT: + g_value_set_string(value, pidgin_conversation_theme_get_variant(theme)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); + break; + } +} + +static void +pidgin_conv_theme_set_property(GObject *obj, guint param_id, const GValue *value, + GParamSpec *psec) +{ + PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); + + switch (param_id) { + case PROP_INFO: + pidgin_conversation_theme_set_info(theme, g_value_get_boxed(value)); + break; + + case PROP_VARIANT: + _set_variant(theme, g_value_get_string(value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); + break; + } +} + +static void +pidgin_conv_theme_init(GTypeInstance *instance, + gpointer klass) +{ + PidginConvThemePrivate *priv; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(instance); +} + +static void +pidgin_conv_theme_finalize(GObject *obj) +{ + PidginConvThemePrivate *priv; + + priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj); + + g_free(priv->template_html); + g_free(priv->header_html); + g_free(priv->footer_html); + g_free(priv->topic_html); + g_free(priv->status_html); + g_free(priv->content_html); + g_free(priv->incoming_content_html); + g_free(priv->outgoing_content_html); + g_free(priv->incoming_next_content_html); + g_free(priv->outgoing_next_content_html); + g_free(priv->incoming_context_html); + g_free(priv->outgoing_context_html); + g_free(priv->incoming_next_context_html); + g_free(priv->outgoing_next_context_html); + g_free(priv->basestyle_css); + + if (priv->info) + g_hash_table_destroy(priv->info); + + parent_class->finalize(obj); +} + +static void +pidgin_conv_theme_class_init(PidginConvThemeClass *klass) +{ + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + GParamSpec *pspec; + + parent_class = g_type_class_peek_parent(klass); + + g_type_class_add_private(klass, sizeof(PidginConvThemePrivate)); + + obj_class->get_property = pidgin_conv_theme_get_property; + obj_class->set_property = pidgin_conv_theme_set_property; + obj_class->finalize = pidgin_conv_theme_finalize; + + /* INFO */ + pspec = g_param_spec_boxed("info", "Info", + "The information about this theme", + G_TYPE_HASH_TABLE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property(obj_class, PROP_INFO, pspec); + properties[PROP_INFO] = pspec; + + /* VARIANT */ + pspec = g_param_spec_string("variant", "Variant", + "The current variant for this theme", + NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property(obj_class, PROP_VARIANT, pspec); + properties[PROP_VARIANT] = pspec; + +} + +GType +pidgin_conversation_theme_get_type(void) +{ + static GType type = 0; + if (type == 0) { + static const GTypeInfo info = { + sizeof(PidginConvThemeClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)pidgin_conv_theme_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(PidginConvTheme), + 0, /* n_preallocs */ + pidgin_conv_theme_init, /* instance_init */ + NULL, /* value table */ + }; + type = g_type_register_static(PURPLE_TYPE_THEME, + "PidginConvTheme", &info, 0); + } + return type; +} + /***************************************************************************** * Public API functions *****************************************************************************/ -- cgit v1.2.1 From 3bc499073e6d11799fb695597ed7cc76750705ab Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 24 Sep 2011 21:18:17 +0000 Subject: Don't leak variant name and list. --- pidgin/gtkconv-theme.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index fc009582ce..5977569d7a 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -454,6 +454,7 @@ static void pidgin_conv_theme_finalize(GObject *obj) { PidginConvThemePrivate *priv; + GList *list; priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj); @@ -476,6 +477,13 @@ pidgin_conv_theme_finalize(GObject *obj) if (priv->info) g_hash_table_destroy(priv->info); + list = priv->variants; + while (list) { + g_free(list->data); + list = g_list_delete_link(list, list); + } + g_free(priv->variant); + parent_class->finalize(obj); } -- cgit v1.2.1 From 8aee5ff71a03c80d5c226367c10ed4b82ae4a6fc Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 24 Sep 2011 21:19:26 +0000 Subject: Fix a leak. This strdup shouldn't be here. --- pidgin/gtkconv-theme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 5977569d7a..be528d5ed3 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -673,7 +673,7 @@ pidgin_conversation_theme_get_variant(PidginConvTheme *theme) priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); - return g_strdup(priv->variant); + return priv->variant; } void -- cgit v1.2.1 From 6a61ed72f08cedd3dc821daf9bc6d9cc4f85f542 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 24 Sep 2011 22:09:40 +0000 Subject: * purple_util_fetch_url_request_len() renamed to purple_util_fetch_url_request(). * purple_util_fetch_url_len() renamed to purple_util_fetch_url(). --- ChangeLog.API | 16 +++++++----- finch/plugins/gnttinyurl.c | 4 +-- libpurple/protocols/gg/gg.c | 4 +-- libpurple/protocols/jabber/google/relay.c | 2 +- libpurple/protocols/jabber/useravatar.c | 2 +- libpurple/protocols/msn/msn.c | 4 +-- libpurple/protocols/msn/slp.c | 2 +- libpurple/protocols/mxit/formcmds.c | 2 +- libpurple/protocols/mxit/login.c | 4 +-- libpurple/protocols/mxit/markup.c | 2 +- libpurple/protocols/mxit/protocol.c | 2 +- libpurple/protocols/myspace/user.c | 2 +- libpurple/protocols/oscar/clientlogin.c | 4 +-- libpurple/protocols/yahoo/libymsg.c | 12 ++++----- libpurple/protocols/yahoo/yahoo_aliases.c | 6 ++--- libpurple/protocols/yahoo/yahoo_picture.c | 2 +- libpurple/protocols/yahoo/yahoo_profile.c | 4 +-- libpurple/upnp.c | 4 +-- libpurple/util.c | 14 +--------- libpurple/util.h | 43 +++---------------------------- pidgin/gtkprefs.c | 4 +-- pidgin/gtksmiley.c | 4 +-- pidgin/gtkstatusbox.c | 2 +- pidgin/plugins/relnot.c | 2 +- 24 files changed, 50 insertions(+), 97 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 98439c9c41..0555a3c8ed 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -53,10 +53,15 @@ version 3.0.0 (??/??/????): * xmlnode_strip_prefixes Changed: + * purple_account_add_buddy now takes an invite message as the last + parameter + * purple_account_add_buddies now takes an invite message as the last + parameter * purple_certificate_check_signature_chain_with_failing renamed to purple_certificate_check_signature_chain * purple_connection_error now takes a PurpleConnectionError as the second parameter + * purple_dnsquery_a now takes a PurpleAccount as the first parameter * purple_network_listen_family renamed to purple_network_listen * purple_network_listen_range_family renamed to purple_network_listen_range @@ -66,17 +71,14 @@ version 3.0.0 (??/??/????): a GList * purple_notify_user_info_prepend_pair renamed to purple_notify_user_info_prepend_pair_html + * purple_srv_resolve now takes a PurpleAccount as the first parameter + * purple_txt_resolve now takes a PurpleAccount as the first parameter * purple_util_fetch_url_request_len now takes a PurpleAccount as the first parameter + * purple_util_fetch_url_request_len renamed to purple_util_fetch_url_request + * purple_util_fetch_url_len renamed to purple_util_fetch_url * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter - * purple_dnsquery_a now takes a PurpleAccount as the first parameter - * purple_srv_resolve now takes a PurpleAccount as the first parameter - * purple_txt_resolve now takes a PurpleAccount as the first parameter - * purple_account_add_buddy now takes an invite message as the last - parameter - * purple_account_add_buddies now takes an invite message as the last - parameter Removed: * _GntFileType diff --git a/finch/plugins/gnttinyurl.c b/finch/plugins/gnttinyurl.c index 4d70de1d03..2718f5fe75 100644 --- a/finch/plugins/gnttinyurl.c +++ b/finch/plugins/gnttinyurl.c @@ -319,7 +319,7 @@ process_urls(PurpleConversation *conv, GList *urls) url = g_strdup_printf("%s%s", purple_prefs_get_string(PREF_URL), purple_url_encode(tmp)); } g_free(tmp); - purple_util_fetch_url(url, TRUE, "finch", FALSE, url_fetched, cbdata); + purple_util_fetch_url(url, TRUE, "finch", FALSE, -1, url_fetched, cbdata); i = gnt_text_view_get_lines_below(tv); str = g_strdup_printf(_("\nFetching TinyURL...")); gnt_text_view_append_text_with_tag((tv), str, GNT_TEXT_FLAG_DIM, cbdata->tag); @@ -383,7 +383,7 @@ tinyurl_notify_uri(const char *uri) /* Store the return value of _fetch_url and destroy that when win is destroyed, so that the callback for _fetch_url does not try to molest a non-existent window */ - urlcb = purple_util_fetch_url(fullurl, TRUE, "finch", FALSE, tinyurl_notify_fetch_cb, win); + urlcb = purple_util_fetch_url(fullurl, TRUE, "finch", FALSE, -1, tinyurl_notify_fetch_cb, win); g_free(fullurl); g_signal_connect_swapped(G_OBJECT(win), "destroy", G_CALLBACK(purple_util_fetch_url_cancel), urlcb); diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index ac9eaf8f9f..cd1b54512f 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -1024,7 +1024,7 @@ static void gg_get_avatar_url_cb(PurpleUtilFetchUrlData *url_data, gpointer user purple_debug_info("gg", "gg_get_avatar_url_cb: " "requesting avatar for %s\n", uin); - url_data = purple_util_fetch_url_request_len(account, + url_data = purple_util_fetch_url_request(account, bigavatar, TRUE, "Mozilla/4.0 (compatible; MSIE 5.0)", FALSE, NULL, FALSE, -1, gg_fetch_avatar_cb, data); } @@ -1052,7 +1052,7 @@ static void ggp_update_buddy_avatar(PurpleConnection *gc, uin_t uin) avatarurl = g_strdup_printf("http://api.gadu-gadu.pl/avatars/%u/0.xml", uin); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), avatarurl, TRUE, "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, NULL, FALSE, -1, gg_get_avatar_url_cb, gc); diff --git a/libpurple/protocols/jabber/google/relay.c b/libpurple/protocols/jabber/google/relay.c index 4b48a8034e..bdc6fd644a 100644 --- a/libpurple/protocols/jabber/google/relay.c +++ b/libpurple/protocols/jabber/google/relay.c @@ -137,7 +137,7 @@ jabber_google_do_relay_request(JabberStream *js, GoogleSession *session, purple_debug_info("jabber", "sending Google relay request %s to %s\n", request, url); url_data = - purple_util_fetch_url_request(url, FALSE, NULL, FALSE, request, FALSE, + purple_util_fetch_url_request(NULL, url, FALSE, NULL, FALSE, request, FALSE, -1, jabber_google_relay_fetch_cb, data); if (url_data) { js->google_relay_requests = diff --git a/libpurple/protocols/jabber/useravatar.c b/libpurple/protocols/jabber/useravatar.c index 37c0b5a0cb..60a16fac91 100644 --- a/libpurple/protocols/jabber/useravatar.c +++ b/libpurple/protocols/jabber/useravatar.c @@ -377,7 +377,7 @@ update_buddy_metadata(JabberStream *js, const char *from, xmlnode *items) JabberBuddyAvatarUpdateURLInfo *info = g_new0(JabberBuddyAvatarUpdateURLInfo, 1); info->js = js; - url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, + url_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, MAX_HTTP_BUDDYICON_BYTES, do_buddy_avatar_update_fromurl, info); if (url_data) { diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 2325c41ac8..a886cdc901 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -2742,7 +2742,7 @@ msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, /* Try to put the photo in there too, if there's one */ if (photo_url_text) { - url_data = purple_util_fetch_url_len(photo_url_text, FALSE, NULL, FALSE, + url_data = purple_util_fetch_url(photo_url_text, FALSE, NULL, FALSE, MAX_HTTP_BUDDYICON_BYTES, msn_got_photo, info2_data); session->url_datas = g_slist_prepend(session->url_datas, url_data); @@ -2841,7 +2841,7 @@ msn_get_info(PurpleConnection *gc, const char *name) url_data = purple_util_fetch_url(url, FALSE, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", - TRUE, msn_got_info, data); + TRUE, -1, msn_got_info, data); session->url_datas = g_slist_prepend(session->url_datas, url_data); g_free(url); diff --git a/libpurple/protocols/msn/slp.c b/libpurple/protocols/msn/slp.c index 67e8fb3291..699a1b1a6d 100644 --- a/libpurple/protocols/msn/slp.c +++ b/libpurple/protocols/msn/slp.c @@ -253,7 +253,7 @@ msn_request_user_display(MsnUser *user) data->session = session; data->remote_user = user->passport; data->sha1 = info; - url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, 200*1024, + url_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, 200*1024, fetched_user_display, data); session->url_datas = g_slist_prepend(session->url_datas, url_data); } else { diff --git a/libpurple/protocols/mxit/formcmds.c b/libpurple/protocols/mxit/formcmds.c index 73f746517a..6c163bcd66 100644 --- a/libpurple/protocols/mxit/formcmds.c +++ b/libpurple/protocols/mxit/formcmds.c @@ -362,7 +362,7 @@ static void command_image(struct RXMsgData* mx, GHashTable* hash, GString* msg) purple_debug_info(MXIT_PLUGIN_ID, "sending request for inline image '%s'\n", iireq->url); /* request the image (reference: "libpurple/util.h") */ - purple_util_fetch_url_request(iireq->url, TRUE, NULL, TRUE, NULL, FALSE, mxit_cb_ii_returned, iireq); + purple_util_fetch_url(iireq->url, TRUE, NULL, TRUE, -1, mxit_cb_ii_returned, iireq); mx->img_count++; } } diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index 7b9b574269..42ee5d5ae6 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -549,7 +549,7 @@ static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* field session->logindata->wapserver, session->logindata->sessionid, purple_url_encode( session->acc->username ), PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_MICRO_VERSION, MXIT_CLIENT_ID, MXIT_CP_ARCH, captcha_resp, session->logindata->cc, session->logindata->locale, ( state == MXIT_STATE_REGISTER1 ) ? 0 : 1, MXIT_CP_PLATFORM, MXIT_CP_OS, MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_clientinfo2, session ); + url_data = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_clientinfo2, session ); #ifdef DEBUG_PROTOCOL purple_debug_info( MXIT_PLUGIN_ID, "HTTP REQUEST: '%s'\n", url ); @@ -713,7 +713,7 @@ static void get_clientinfo( struct MXitSession* session ) /* reference: "libpurple/util.h" */ url = g_strdup_printf( "%s/res/?type=challenge&getcountries=true&getlanguage=true&getimage=true&h=%i&w=%i&ts=%li", wapserver, MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_clientinfo1, session ); + url_data = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_clientinfo1, session ); #ifdef DEBUG_PROTOCOL purple_debug_info( MXIT_PLUGIN_ID, "HTTP REQUEST: '%s'\n", url ); diff --git a/libpurple/protocols/mxit/markup.c b/libpurple/protocols/mxit/markup.c index b319467700..635b1b06d3 100644 --- a/libpurple/protocols/mxit/markup.c +++ b/libpurple/protocols/mxit/markup.c @@ -628,7 +628,7 @@ static void emoticon_request( struct RXMsgData* mx, const char* id ) /* reference: "libpurple/util.h" */ url = g_strdup_printf( "%s/res/?type=emo&mlh=%i&sc=%s&ts=%li", wapserver, MXIT_EMOTICON_SIZE, id, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, NULL, TRUE, NULL, FALSE, emoticon_returned, mx ); + url_data = purple_util_fetch_url( url, TRUE, NULL, TRUE, -1, emoticon_returned, mx ); g_free( url ); } diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index 421bd9f77e..ac373e2785 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -311,7 +311,7 @@ static void mxit_write_http_get( struct MXitSession* session, struct tx_packet* #endif /* send the HTTP request */ - session->http_out_req = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_http_rx, session ); + session->http_out_req = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_http_rx, session ); g_free( url ); if ( part ) diff --git a/libpurple/protocols/myspace/user.c b/libpurple/protocols/myspace/user.c index 48e3d1c880..357c6a180d 100644 --- a/libpurple/protocols/myspace/user.c +++ b/libpurple/protocols/myspace/user.c @@ -384,7 +384,7 @@ msim_store_user_info_each(const gchar *key_str, gchar *value_str, MsimUser *user if (!previous_url || !g_str_equal(previous_url, user->image_url)) { if (user->url_data != NULL) purple_util_fetch_url_cancel(user->url_data); - user->url_data = purple_util_fetch_url(user->image_url, TRUE, NULL, TRUE, msim_downloaded_buddy_icon, (gpointer)user); + user->url_data = purple_util_fetch_url(user->image_url, TRUE, NULL, TRUE, -1, msim_downloaded_buddy_icon, (gpointer)user); } } else if (g_str_equal(key_str, "LastImageUpdated")) { /* TODO: use somewhere */ diff --git a/libpurple/protocols/oscar/clientlogin.c b/libpurple/protocols/oscar/clientlogin.c index a4ea3995ff..26ad4c67a8 100644 --- a/libpurple/protocols/oscar/clientlogin.c +++ b/libpurple/protocols/oscar/clientlogin.c @@ -384,7 +384,7 @@ static void send_start_oscar_session(OscarData *od, const char *token, const cha g_free(signature); /* Make the request */ - od->url_data = purple_util_fetch_url_request_len(account, + od->url_data = purple_util_fetch_url_request(account, url, TRUE, NULL, FALSE, NULL, FALSE, -1, start_oscar_session_cb, od); g_free(url); @@ -646,7 +646,7 @@ void send_client_login(OscarData *od, const char *username) g_string_free(body, TRUE); /* Send the POST request */ - od->url_data = purple_util_fetch_url_request_len( + od->url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), get_client_login_url(od), TRUE, NULL, FALSE, request->str, FALSE, -1, client_login_cb, od); diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 31a6617550..961506cdf4 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -2014,7 +2014,7 @@ static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *url_data, gpointer us gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, TRUE, -1, yahoo_auth16_stage2, auth_data); if (url_data) @@ -2055,7 +2055,7 @@ static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed) g_free(encoded_password); g_free(encoded_username); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, yahoo_auth16_stage1_cb, auth_data); @@ -2247,7 +2247,7 @@ static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pk if (gc->inpa) purple_input_remove(gc->inpa); url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, - "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc); + "Purple/" VERSION, FALSE, -1, yahoo_login_page_cb, gc); if (url_data != NULL) yd->url_datas = g_slist_prepend(yd->url_datas, url_data); return; @@ -3709,7 +3709,7 @@ void yahoo_login(PurpleAccount *account) { /* Get the pager server. Actually start connecting in the callback since we * must have the contents of the HTTP response to proceed. */ - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( proxy_ssl ? purple_connection_get_account(gc) : NULL, yd->jp ? YAHOOJP_PAGER_HOST_REQ_URL : YAHOO_PAGER_HOST_REQ_URL, use_whole_url ? TRUE : FALSE, @@ -4287,7 +4287,7 @@ static void yahoo_show_inbox(PurplePluginAction *action) use_whole_url ? base_url : "", yd->cookie_t, yd->cookie_y); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), base_url, use_whole_url, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_get_inbox_token_cb, gc); @@ -4479,7 +4479,7 @@ static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) if ((gc->account->proxy_info) && (purple_proxy_info_get_type(gc->account->proxy_info) == PURPLE_PROXY_HTTP)) use_whole_url = TRUE; - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_get_sms_carrier_cb, data); diff --git a/libpurple/protocols/yahoo/yahoo_aliases.c b/libpurple/protocols/yahoo/yahoo_aliases.c index ab657816e7..5856d6395c 100644 --- a/libpurple/protocols/yahoo/yahoo_aliases.c +++ b/libpurple/protocols/yahoo/yahoo_aliases.c @@ -207,7 +207,7 @@ yahoo_fetch_aliases(PurpleConnection *gc) webaddress); /* We have a URL and some header information, let's connect and get some aliases */ - url_data = purple_util_fetch_url_request_len(purple_connection_get_account(gc), + url_data = purple_util_fetch_url_request(purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, request, FALSE, -1, yahoo_fetch_aliases_cb, gc); if (url_data != NULL) @@ -379,7 +379,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) content); /* We have a URL and some header information, let's connect and update the alias */ - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, request, FALSE, -1, yahoo_update_alias_cb, cb); if (url_data != NULL) @@ -517,7 +517,7 @@ yahoo_set_userinfo_cb(PurpleConnection *gc, PurpleRequestFields *fields) } #endif - url_data = purple_util_fetch_url_request_len(account, webaddress, FALSE, + url_data = purple_util_fetch_url_request(account, webaddress, FALSE, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_fetch_aliases_cb, gc); if (url_data != NULL) diff --git a/libpurple/protocols/yahoo/yahoo_picture.c b/libpurple/protocols/yahoo/yahoo_picture.c index 9877d359a0..8a43b59ded 100644 --- a/libpurple/protocols/yahoo/yahoo_picture.c +++ b/libpurple/protocols/yahoo/yahoo_picture.c @@ -132,7 +132,7 @@ void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt) data->checksum = checksum; /* TODO: Does this need to be MSIE 5.0? */ url_data = purple_util_fetch_url(url, use_whole_url, - "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, + "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, -1, yahoo_fetch_picture_cb, data); if (url_data != NULL) { yd = purple_connection_get_protocol_data(gc); diff --git a/libpurple/protocols/yahoo/yahoo_profile.c b/libpurple/protocols/yahoo/yahoo_profile.c index 58de6724f9..b7c173367e 100644 --- a/libpurple/protocols/yahoo/yahoo_profile.c +++ b/libpurple/protocols/yahoo/yahoo_profile.c @@ -940,7 +940,7 @@ static void yahoo_got_info(PurpleUtilFetchUrlData *url_data, gpointer user_data, * we specify HTTP 1.1. So we have to specify 1.0 & fix purple_util_fetch_url */ url_data = purple_util_fetch_url(photo_url_text, use_whole_url, NULL, - FALSE, yahoo_got_photo, info2_data); + FALSE, -1, yahoo_got_photo, info2_data); if (url_data != NULL) yd->url_datas = g_slist_prepend(yd->url_datas, url_data); } else { @@ -1274,7 +1274,7 @@ void yahoo_get_info(PurpleConnection *gc, const char *name) url = g_strdup_printf("%s%s", (yd->jp ? YAHOOJP_PROFILE_URL : YAHOO_PROFILE_URL), name); - url_data = purple_util_fetch_url(url, TRUE, NULL, FALSE, yahoo_got_info, data); + url_data = purple_util_fetch_url(url, TRUE, NULL, FALSE, -1, yahoo_got_info, data); if (url_data != NULL) yd->url_datas = g_slist_prepend(yd->url_datas, url_data); else { diff --git a/libpurple/upnp.c b/libpurple/upnp.c index 923417fc7f..61b5ef3b84 100644 --- a/libpurple/upnp.c +++ b/libpurple/upnp.c @@ -464,7 +464,7 @@ purple_upnp_parse_description(const gchar* descriptionURL, UPnPDiscoveryData *dd purple_timeout_remove(dd->tima); dd->tima = 0; - purple_util_fetch_url_request_len(NULL, descriptionURL, TRUE, NULL, TRUE, httpRequest, + purple_util_fetch_url_request(NULL, descriptionURL, TRUE, NULL, TRUE, httpRequest, TRUE, MAX_UPNP_DOWNLOAD, upnp_parse_description_cb, dd); g_free(httpRequest); @@ -730,7 +730,7 @@ purple_upnp_generate_action_message_and_send(const gchar* actionName, g_free(pathOfControl); g_free(soapMessage); - gfud = purple_util_fetch_url_request_len(NULL, control_info.control_url, FALSE, NULL, TRUE, + gfud = purple_util_fetch_url_request(NULL, control_info.control_url, FALSE, NULL, TRUE, totalSendMessage, TRUE, MAX_UPNP_DOWNLOAD, cb, cb_data); g_free(totalSendMessage); diff --git a/libpurple/util.c b/libpurple/util.c index feb1cd2590..286ba28ff3 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -4167,19 +4167,7 @@ static void ssl_url_fetch_error_cb(PurpleSslConnection *ssl_connection, PurpleSs } PurpleUtilFetchUrlData * -purple_util_fetch_url_request(const char *url, gboolean full, - const char *user_agent, gboolean http11, - const char *request, gboolean include_headers, - PurpleUtilFetchUrlCallback callback, void *user_data) -{ - return purple_util_fetch_url_request_len(NULL, url, full, - user_agent, http11, - request, include_headers, -1, - callback, user_data); -} - -PurpleUtilFetchUrlData * -purple_util_fetch_url_request_len(PurpleAccount *account, +purple_util_fetch_url_request(PurpleAccount *account, const char *url, gboolean full, const char *user_agent, gboolean http11, const char *request, gboolean include_headers, gssize max_len, PurpleUtilFetchUrlCallback callback, void *user_data) diff --git a/libpurple/util.h b/libpurple/util.h index 9b79b8cc98..45022f8c74 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -1159,21 +1159,6 @@ gboolean purple_url_parse(const char *url, char **ret_host, int *ret_port, */ typedef void (*PurpleUtilFetchUrlCallback)(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message); -/** - * Fetches the data from a URL, and passes it to a callback function. - * - * @param url The URL. - * @param full TRUE if this is the full URL, or FALSE if it's a - * partial URL. - * @param user_agent The user agent field to use, or NULL. - * @param http11 TRUE if HTTP/1.1 should be used to download the file. - * @param cb The callback function. - * @param data The user data to pass to the callback function. - */ -#define purple_util_fetch_url(url, full, user_agent, http11, cb, data) \ - purple_util_fetch_url_request(url, full, user_agent, http11, NULL, \ - FALSE, cb, data); - /** * Fetches the data from a URL, and passes it to a callback function. * @@ -1185,32 +1170,11 @@ typedef void (*PurpleUtilFetchUrlCallback)(PurpleUtilFetchUrlData *url_data, gpo * @param max_len The maximum number of bytes to retrieve (-1 for unlimited) * @param cb The callback function. * @param data The user data to pass to the callback function. - * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url" and get rid of the old one */ -#define purple_util_fetch_url_len(url, full, user_agent, http11, max_len, cb, data) \ - purple_util_fetch_url_request_len(NULL, url, full, user_agent, http11, NULL, \ +#define purple_util_fetch_url(url, full, user_agent, http11, max_len, cb, data) \ + purple_util_fetch_url_request(NULL, url, full, user_agent, http11, NULL, \ FALSE, max_len, cb, data); -/** - * Fetches the data from a URL, and passes it to a callback function. - * - * @param url The URL. - * @param full TRUE if this is the full URL, or FALSE if it's a - * partial URL. - * @param user_agent The user agent field to use, or NULL. - * @param http11 TRUE if HTTP/1.1 should be used to download the file. - * @param request A HTTP request to send to the server instead of the - * standard GET - * @param include_headers - * If TRUE, include the HTTP headers in the response. - * @param callback The callback function. - * @param data The user data to pass to the callback function. - */ -PurpleUtilFetchUrlData *purple_util_fetch_url_request(const gchar *url, - gboolean full, const gchar *user_agent, gboolean http11, - const gchar *request, gboolean include_headers, - PurpleUtilFetchUrlCallback callback, gpointer data); - /** * Fetches the data from a URL, and passes it to a callback function. * @@ -1227,9 +1191,8 @@ PurpleUtilFetchUrlData *purple_util_fetch_url_request(const gchar *url, * @param max_len The maximum number of bytes to retrieve (-1 for unlimited) * @param callback The callback function. * @param data The user data to pass to the callback function. - * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url_request" and get rid of the old one */ -PurpleUtilFetchUrlData *purple_util_fetch_url_request_len( +PurpleUtilFetchUrlData *purple_util_fetch_url_request( PurpleAccount *account, const gchar *url, gboolean full, const gchar *user_agent, gboolean http11, const gchar *request, gboolean include_headers, gssize max_len, diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 7a15c51e46..5b3b928efd 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -891,7 +891,7 @@ theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, } else if (!g_ascii_strncasecmp(name, "http://", 7)) { /* Oo, a web drag and drop. This is where things * will start to get interesting */ - purple_util_fetch_url(name, TRUE, NULL, FALSE, theme_got_url, info); + purple_util_fetch_url(name, TRUE, NULL, FALSE, -1, theme_got_url, info); } else if (!g_ascii_strncasecmp(name, "https://", 8)) { /* purple_util_fetch_url() doesn't support HTTPS, but we want users * to be able to drag and drop links from the SF trackers, so @@ -902,7 +902,7 @@ theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, tmp[2] = 't'; tmp[3] = 'p'; - purple_util_fetch_url(tmp, TRUE, NULL, FALSE, theme_got_url, info); + purple_util_fetch_url(tmp, TRUE, NULL, FALSE, -1, theme_got_url, info); g_free(tmp); } else free_theme_info(info); diff --git a/pidgin/gtksmiley.c b/pidgin/gtksmiley.c index 2ea41edc14..558ac79fdd 100644 --- a/pidgin/gtksmiley.c +++ b/pidgin/gtksmiley.c @@ -750,7 +750,7 @@ smiley_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, } else if (!g_ascii_strncasecmp(name, "http://", 7)) { /* Oo, a web drag and drop. This is where things * will start to get interesting */ - purple_util_fetch_url(name, TRUE, NULL, FALSE, smiley_got_url, dialog); + purple_util_fetch_url(name, TRUE, NULL, FALSE, -1, smiley_got_url, dialog); } else if (!g_ascii_strncasecmp(name, "https://", 8)) { /* purple_util_fetch_url() doesn't support HTTPS */ char *tmp = g_strdup(name + 1); @@ -759,7 +759,7 @@ smiley_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, tmp[2] = 't'; tmp[3] = 'p'; - purple_util_fetch_url(tmp, TRUE, NULL, FALSE, smiley_got_url, dialog); + purple_util_fetch_url(tmp, TRUE, NULL, FALSE, -1, smiley_got_url, dialog); g_free(tmp); } diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index ff75b29c19..422f84904c 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -412,7 +412,7 @@ statusbox_uri_handler(const char *proto, const char *cmd, GHashTable *params, vo if (src == NULL) return FALSE; - purple_util_fetch_url(src, TRUE, NULL, FALSE, statusbox_got_url, data); + purple_util_fetch_url(src, TRUE, NULL, FALSE, -1, statusbox_got_url, data); return TRUE; } diff --git a/pidgin/plugins/relnot.c b/pidgin/plugins/relnot.c index d3d1817741..2c381fe354 100644 --- a/pidgin/plugins/relnot.c +++ b/pidgin/plugins/relnot.c @@ -152,7 +152,7 @@ do_check(void) url, host); - purple_util_fetch_url_request_len(NULL, url, TRUE, NULL, FALSE, + purple_util_fetch_url_request(NULL, url, TRUE, NULL, FALSE, request, TRUE, -1, version_fetch_cb, NULL); g_free(request); -- cgit v1.2.1 From cd91e56b3c0d86a6ffe77de89fe6a4ee1bdde6fd Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 24 Sep 2011 22:20:58 +0000 Subject: purple_ip_address_is_valid() now checks for an IPv4 or IPv6 address. --- libpurple/plugins/perl/common/Util.xs | 8 ++++++++ libpurple/util.c | 3 +-- libpurple/util.h | 9 +++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libpurple/plugins/perl/common/Util.xs b/libpurple/plugins/perl/common/Util.xs index b339cc75af..6f2cb9b561 100644 --- a/libpurple/plugins/perl/common/Util.xs +++ b/libpurple/plugins/perl/common/Util.xs @@ -202,6 +202,14 @@ gboolean purple_ip_address_is_valid(ip) const char* ip +gboolean +purple_ipv4_address_is_valid(ip) + const char* ip + +gboolean +purple_ipv6_address_is_valid(ip) + const char* ip + const char* purple_normalize_nocase(account, str) Purple::Account account diff --git a/libpurple/util.c b/libpurple/util.c index 286ba28ff3..7403537e2f 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -4454,11 +4454,10 @@ purple_ipv6_address_is_valid(const gchar *ip) return (double_colon && chunks < 8) || (!double_colon && chunks == 8); } -/* TODO 3.0.0: Add ipv6 check, too */ gboolean purple_ip_address_is_valid(const char *ip) { - return purple_ipv4_address_is_valid(ip); + return (purple_ipv4_address_is_valid(ip) || purple_ipv6_address_is_valid(ip)); } /* Stolen from gnome_uri_list_extract_uris */ diff --git a/libpurple/util.h b/libpurple/util.h index 45022f8c74..4a6fd6d083 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -1238,14 +1238,15 @@ const char *purple_url_encode(const char *str); gboolean purple_email_is_valid(const char *address); /** - * Checks if the given IP address is a syntactically valid IPv4 address. + * Checks if the given IP address is a syntactically valid IPv4 or + * IPv6 address. + * If you specifically want to check for an IPv4 address use + * purple_ipv4_address_is_valid(), or for an IPv6 address use + * purple_ipv6_address_is_valid(). * * @param ip The IP address to validate. * * @return True if the IP address is syntactically correct. - * @deprecated This function will be replaced with one that validates - * as either IPv4 or IPv6 in 3.0.0. If you don't want this, - * behavior, use one of the more specific functions. */ gboolean purple_ip_address_is_valid(const char *ip); -- cgit v1.2.1 From 3158b749f7e5df28b8b4819c2ff1ba54c403a8a4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 25 Sep 2011 05:47:54 +0000 Subject: Ref/unref the theme for a conversation. --- pidgin/gtkconv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 4241cc4e0f..4ae12d138f 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5593,7 +5593,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) theme = purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme"), "conversation"); if (!theme) theme = purple_theme_manager_find_theme("Default", "conversation"); - gtkconv->theme = PIDGIN_CONV_THEME(theme); + gtkconv->theme = PIDGIN_CONV_THEME(g_object_ref(theme)); gtkconv->last_flags = 0; if (conv_type == PURPLE_CONV_TYPE_IM) { @@ -5798,6 +5798,8 @@ pidgin_conv_destroy(PurpleConversation *conv) g_source_remove(gtkconv->attach.timer); } + g_object_unref(gtkconv->theme); + g_free(gtkconv); } -- cgit v1.2.1 From 05a4189d4bbeb28bcc99029f628b2bcc7bf3e079 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 25 Sep 2011 18:56:58 +0000 Subject: Clean the API documentation in preparation for 3.0.0 by removing all the old @since tags. --- doc/account-signals.dox | 10 ------- doc/blist-signals.dox | 2 -- doc/connection-signals.dox | 1 - doc/conversation-signals.dox | 6 ----- doc/gtkconv-signals.dox | 2 -- doc/notify-signals.dox | 2 -- finch/gntaccount.h | 2 -- finch/gntblist.h | 7 ----- finch/gntrequest.h | 1 - finch/gntsound.h | 12 --------- libpurple/account.h | 11 -------- libpurple/blist.h | 49 +++------------------------------- libpurple/certificate.h | 1 - libpurple/cmds.h | 3 --- libpurple/connection.h | 16 ------------ libpurple/conversation.h | 32 ++++------------------- libpurple/core.h | 4 --- libpurple/dbus-server.h | 2 -- libpurple/debug.h | 8 ------ libpurple/eventloop.h | 3 --- libpurple/ft.h | 20 -------------- libpurple/log.h | 2 -- libpurple/media-gst.h | 16 ------------ libpurple/media.h | 58 ----------------------------------------- libpurple/media/backend-fs2.h | 2 -- libpurple/media/backend-iface.h | 20 -------------- libpurple/media/candidate.h | 34 ------------------------ libpurple/media/codec.h | 28 -------------------- libpurple/media/enum-types.h | 12 --------- libpurple/mediamanager.h | 28 -------------------- libpurple/network.h | 9 ------- libpurple/notify.h | 2 -- libpurple/plugin.h | 4 --- libpurple/pounce.h | 3 --- libpurple/prefs.h | 2 -- libpurple/proxy.h | 1 - libpurple/prpl.h | 13 --------- libpurple/purple.h.in | 1 - libpurple/request.h | 10 +------ libpurple/roomlist.h | 8 ------ libpurple/smiley.h | 1 - libpurple/sslconn.h | 5 ---- libpurple/version.h.in | 6 ----- pidgin/gtkblist.h | 10 ------- pidgin/gtkconv.h | 6 +---- pidgin/gtkimhtml.c | 2 -- pidgin/gtkimhtml.h | 24 +++-------------- pidgin/gtkimhtmltoolbar.h | 3 --- pidgin/gtkprefs.h | 2 -- pidgin/gtksmiley.c | 6 ++--- pidgin/gtksmiley.h | 3 --- pidgin/gtksound.h | 2 -- pidgin/gtkthemes.h | 6 ----- pidgin/gtkutils.h | 51 ------------------------------------ pidgin/pidgintooltip.h | 8 ------ 55 files changed, 17 insertions(+), 565 deletions(-) diff --git a/doc/account-signals.dox b/doc/account-signals.dox index 9ef431cced..c4964bcc7b 100644 --- a/doc/account-signals.dox +++ b/doc/account-signals.dox @@ -34,7 +34,6 @@ void (*account_created)(PurpleAccount *account); @signaldesc Emitted when an account is created by calling purple_account_new. @param account The account. - @since 2.6.0 @endsignaldef @signaldef account-destroying @@ -44,7 +43,6 @@ void (*account_destroying)(PurpleAccount *account); @signaldesc Emitted when an account is about to be destroyed. @param account The account. - @since 2.6.0 @endsignaldef @signaldef account-added @@ -156,7 +154,6 @@ int (*account_authorization_requested)(PurpleAccount *account, const char *user) @return Less than zero to deny the request without prompting, greater than zero if the request should be granted. If zero is returned, then the user will be prompted with the request. - @since 2.3.0 @endsignaldef @signaldef account-authorization-requested-with-message @@ -173,7 +170,6 @@ int (*account_authorization_requested)(PurpleAccount *account, const char *user, get informed, PURPLE_ACCOUNT_RESPONSE_ACCEPT if the request should be granted. If PURPLE_ACCOUNT_RESPONSE_PASS is returned, then the user will be prompted with the request. - @since 2.8.0 @endsignaldef @signaldef account-authorization-denied @@ -184,7 +180,6 @@ void (*account_authorization_denied)(PurpleAccount *account, const char *user); Emitted when the authorization request for a buddy is denied. @param account The account. @param user The name of the user requesting authorization. - @since 2.3.0 @endsignaldef @signaldef account-authorization-granted @@ -195,7 +190,6 @@ void (*account_authorization_granted)(PurpleAccount *account, const char *user); Emitted when the authorization request for a buddy is granted. @param account The account. @param user The name of the user requesting authorization. - @since 2.3.0 @endsignaldef @signaldef account-error-changed @@ -214,7 +208,6 @@ void (*account_error_changed)(PurpleAccount *account, const PurpleConnectionErro pointer just after the next time this signal is emitted for this @a account. @see purple_account_get_current_error() - @since 2.3.0 @endsignaldef @signaldef account-signed-on @@ -224,7 +217,6 @@ void (*signed_on)(PurpleAccount *account); @signaldesc Emitted when an account has signed on. @param account The account that has signed on. - @since 2.7.0 @endsignaldef @signaldef account-signed-off @@ -234,7 +226,6 @@ void (*signed_off)(PurpleAccount *account); @signaldesc Emitted when an account has signed off. @param account The account that has signed off. - @since 2.7.0 @endsignaldef @signaldef account-connection-error @@ -246,7 +237,6 @@ void (*connection_error)(PurpleAccount *gc, PurpleConnectionError err, const gch @param account The account on which the error has occurred @param err The error that occurred @param desc A description of the error, giving more information. - @since 2.7.0 @endsignaldef */ // vim: syntax=c.doxygen tw=75 et diff --git a/doc/blist-signals.dox b/doc/blist-signals.dox index 3617a389db..5c3c68035c 100644 --- a/doc/blist-signals.dox +++ b/doc/blist-signals.dox @@ -136,7 +136,6 @@ void (*buddy_caps_changed)(PurpleBuddy *buddy, PurpleMediaCaps newcaps, @param buddy The buddy @param newcaps @param oldcaps - @since 2.7.0 @endsignaldef @signaldef ui-caps-changed @@ -147,7 +146,6 @@ void (*ui_caps_changed)(PurpleMediaCaps newcaps, PurpleMediaCaps oldcaps) Emitted when updating the media capabilities of the UI. @param newcaps @param oldcaps - @since 2.7.0 @endsignaldef */ diff --git a/doc/connection-signals.dox b/doc/connection-signals.dox index ee0d62fba6..84849876e8 100644 --- a/doc/connection-signals.dox +++ b/doc/connection-signals.dox @@ -44,7 +44,6 @@ gboolean (*autojoin)(PurpleConnection *gc); @return @c TRUE if the signal was handled or @c FALSE otherwise. In practice, the return value is irrelevant, as it really only exists so plugins can block the UI's autojoin. - @since 2.7.0 @endsignaldef @signaldef signing-off diff --git a/doc/conversation-signals.dox b/doc/conversation-signals.dox index 30415a9d1c..b9746990ac 100644 --- a/doc/conversation-signals.dox +++ b/doc/conversation-signals.dox @@ -149,7 +149,6 @@ void (*blocked_im_msg)(PurpleAccount *account, const char *sender, @param message The message that was blocked. @param flags The IM message flags. @param when The time the message was sent. - @since 2.5.0 @endsignaldef @signaldef writing-chat-msg @@ -436,7 +435,6 @@ void (*chat_invite_blocked)(PurpleAccount *account, const char *inviter, @param name The name of the chat invited to. @param message The invitation message sent. @param data Hashtable containing data about the invited chat. - @since 2.5.0 @endsignaldef @signaldef chat-joined @@ -477,7 +475,6 @@ void (*conversation_extended_menu)(PurpleConversation *conv, GList **list); conversation. @param conv The conversation. @param list A pointer to the list of actions. - @since 2.1.0 @endsignaldef @signaldef cleared-message-history @@ -487,7 +484,6 @@ void (*cleared_message_history)(PurpleConversation *conv); @signaldesc Emitted when the conversation history is cleared. @param conv The conversation. - @since 2.8.0 @endsignaldef @signaldef sent-attention @@ -501,7 +497,6 @@ void (*got_attention)(PurpleAccount *account, const char *who, @param who The name of the person receiving the attention @param conv The conversation @param type The attention type (an index starting at 0) - @since 2.7.0 @endsignaldef @signaldef got-attention @@ -515,7 +510,6 @@ void (*got_attention)(PurpleAccount *account, const char *who, @param who The name of the person sending the attention @param conv The conversation @param type The attention type (an index starting at 0) - @since 2.7.0 @endsignaldef */ // vim: syntax=c.doxygen tw=75 et diff --git a/doc/gtkconv-signals.dox b/doc/gtkconv-signals.dox index b1df1bbd8a..b9427516ef 100644 --- a/doc/gtkconv-signals.dox +++ b/doc/gtkconv-signals.dox @@ -129,7 +129,6 @@ void (*conversation_hiding)(PidginConversation *gtkconv); @signaldesc Emitted immediately before an existing conversation is hidden. @param gtkconv The PidginConversation - @since 2.2.0 @endsignaldef @signaldef conversation-displayed @@ -139,7 +138,6 @@ void (*conversation_displayed)(PidginConversation *gtkconv); @signaldesc Emitted right after the Pidgin UI is attached to a new or a hidden conversation. @param gtkconv The PidginConversation - @since 2.2.0 @endsignaldef */ diff --git a/doc/notify-signals.dox b/doc/notify-signals.dox index 820298c604..2606936083 100644 --- a/doc/notify-signals.dox +++ b/doc/notify-signals.dox @@ -35,7 +35,6 @@ void (*displaying_email_notification)(const char *subject, @param from Who the email is from. @param to Who the email is to. @param url A url to view the email. - @since 2.1.0 @endsignaldef @signaldef displaying-emails-notification @@ -53,7 +52,6 @@ void (*displaying_emails_notification)(const char **subjects, @param tos Who the emails are to. @param urls The urls to view the emails. @param count Number of emails being notified of. - @since 2.1.0 @endsignaldef */ diff --git a/finch/gntaccount.h b/finch/gntaccount.h index 2cf7d8f9e7..e1fd0378d6 100644 --- a/finch/gntaccount.h +++ b/finch/gntaccount.h @@ -59,8 +59,6 @@ void finch_accounts_show_all(void); * Show the edit dialog for an account. * * @param account The account to edit, or @c NULL to create a new account. - * - * @since 2.2.0 */ void finch_account_dialog_show(PurpleAccount *account); diff --git a/finch/gntblist.h b/finch/gntblist.h index a8037d597d..5b67691970 100644 --- a/finch/gntblist.h +++ b/finch/gntblist.h @@ -115,15 +115,12 @@ void finch_blist_set_size(int width, int height); * @param name The user to get information about. * * @return Returns the ui-handle for the userinfo notification. - * - * @since 2.1.0 */ gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name); /** * Get the tree list of the buddy list. * @return The GntTree widget. - * @since 2.4.0 */ GntTree * finch_blist_get_tree(void); @@ -131,7 +128,6 @@ GntTree * finch_blist_get_tree(void); * Add an alternate buddy list manager. * * @param manager The alternate buddylist manager. - * @since 2.4.0 */ void finch_blist_install_manager(const FinchBlistManager *manager); @@ -139,7 +135,6 @@ void finch_blist_install_manager(const FinchBlistManager *manager); * Remove an alternate buddy list manager. * * @param manager The buddy list manager to remove. - * @since 2.4.0 */ void finch_blist_uninstall_manager(const FinchBlistManager *manager); @@ -149,7 +144,6 @@ void finch_blist_uninstall_manager(const FinchBlistManager *manager); * @param id The identifier for the desired buddy list manager. * * @return The manager with the requested identifier, if available. @c NULL otherwise. - * @since 2.4.0 */ FinchBlistManager * finch_blist_manager_find(const char *id); @@ -157,7 +151,6 @@ FinchBlistManager * finch_blist_manager_find(const char *id); * Request the active buddy list manager to add a node. * * @param node The node to add - * @since 2.4.0 */ void finch_blist_manager_add_node(PurpleBlistNode *node); diff --git a/finch/gntrequest.h b/finch/gntrequest.h index 2e1c33fde5..63c4534486 100644 --- a/finch/gntrequest.h +++ b/finch/gntrequest.h @@ -63,7 +63,6 @@ void finch_request_save_in_prefs(gpointer null, PurpleRequestFields *fields); * @param field The request field. * * @return A GntWidget for the request field. - * @since 2.4.0 */ GntWidget *finch_request_field_get_widget(PurpleRequestField *field); /*@}*/ diff --git a/finch/gntsound.h b/finch/gntsound.h index c1edfaac6f..56deb9915e 100644 --- a/finch/gntsound.h +++ b/finch/gntsound.h @@ -37,8 +37,6 @@ * Get the name of the active sound profile. * * @return The name of the profile - * - * @since 2.1.0 */ const char *finch_sound_get_active_profile(void); @@ -46,8 +44,6 @@ const char *finch_sound_get_active_profile(void); * Set the active profile. If the profile doesn't exist, nothing is changed. * * @param name The name of the profile - * - * @since 2.1.0 */ void finch_sound_set_active_profile(const char *name); @@ -56,8 +52,6 @@ void finch_sound_set_active_profile(const char *name); * * @return A list of strings denoting sound profile names. * Caller must free the list (but not the data). - * - * @since 2.1.0 */ GList *finch_sound_get_profiles(void); @@ -66,8 +60,6 @@ GList *finch_sound_get_profiles(void); * * @return Returns FALSE if preference is set to 'No sound', or if volume is * set to zero. - * - * @since 2.2.0 */ gboolean finch_sound_is_enabled(void); @@ -75,15 +67,11 @@ gboolean finch_sound_is_enabled(void); * Gets GNT sound UI ops. * * @return The UI operations structure. - * - * @since 2.1.0 */ PurpleSoundUiOps *finch_sound_get_ui_ops(void); /** * Show the sound settings dialog. - * - * @since 2.1.0 */ void finch_sounds_show_all(void); diff --git a/libpurple/account.h b/libpurple/account.h index dfd4f903d2..ced1bff95f 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -433,8 +433,6 @@ void purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *info * * @param account The account. * @param privacy_type The privacy type. - * - * @since 2.7.0 */ void purple_account_set_privacy_type(PurpleAccount *account, PurplePrivacyType privacy_type); @@ -491,8 +489,6 @@ void purple_account_set_status_list(PurpleAccount *account, * is successfully set on the server (or NULL). * @param failure_cb A callback which will be called if the alias * is not successfully set on the server (or NULL). - * - * @since 2.7.0 */ void purple_account_set_public_alias(PurpleAccount *account, const char *alias, PurpleSetPublicAliasSuccessCallback success_cb, @@ -506,7 +502,6 @@ void purple_account_set_public_alias(PurpleAccount *account, * @param success_cb A callback which will be called with the alias * @param failure_cb A callback which will be called if the prpl is * unable to retrieve the server-side alias. - * @since 2.7.0 */ void purple_account_get_public_alias(PurpleAccount *account, PurpleGetPublicAliasSuccessCallback success_cb, @@ -542,8 +537,6 @@ void purple_account_clear_settings(PurpleAccount *account); * * @param account The account. * @param setting The setting to remove. - * - * @since 2.6.0 */ void purple_account_remove_setting(PurpleAccount *account, const char *setting); @@ -717,8 +710,6 @@ PurpleConnection *purple_account_get_connection(const PurpleAccount *account); * @param account The account. * * @return The name to display. - * - * @since 2.7.0 */ const gchar *purple_account_get_name_for_display(const PurpleAccount *account); @@ -767,8 +758,6 @@ PurpleProxyInfo *purple_account_get_proxy_info(const PurpleAccount *account); * @param account The account. * * @return The privacy type. - * - * @since 2.7.0 */ PurplePrivacyType purple_account_get_privacy_type(const PurpleAccount *account); diff --git a/libpurple/blist.h b/libpurple/blist.h index 1b073a2c83..64fa7e42fb 100644 --- a/libpurple/blist.h +++ b/libpurple/blist.h @@ -75,9 +75,6 @@ typedef enum } PurpleBlistNodeFlags; -/** - * @since 2.6.0 - */ #define PURPLE_BLIST_NODE(obj) ((PurpleBlistNode *)(obj)) #define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (purple_blist_node_get_flags((PurpleBlistNode*)(b)) & (f)) @@ -86,24 +83,12 @@ typedef enum #define PURPLE_BLIST_NODE_NAME(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CHAT_NODE ? purple_chat_get_name((PurpleChat*)n) : \ purple_blist_node_get_type(n) == PURPLE_BLIST_BUDDY_NODE ? purple_buddy_get_name((PurpleBuddy*)n) : NULL) -/** - * @since 2.6.0 - */ #define PURPLE_GROUP(obj) ((PurpleGroup *)(obj)) -/** - * @since 2.6.0 - */ #define PURPLE_CONTACT(obj) ((PurpleContact *)(obj)) -/** - * @since 2.6.0 - */ #define PURPLE_BUDDY(obj) ((PurpleBuddy *)(obj)) -/** - * @since 2.6.0 - */ #define PURPLE_CHAT(obj) ((PurpleChat *)(obj)) #include "account.h" @@ -226,8 +211,6 @@ struct _PurpleBlistUiOps * previous libpurple versions. * * @param node The node which has been modified. - * - * @since 2.6.0. */ void (*save_node)(PurpleBlistNode *node); @@ -241,7 +224,6 @@ struct _PurpleBlistUiOps * previous libpurple versions. * * @param node The node which has been modified. - * @since 2.6.0. */ void (*remove_node)(PurpleBlistNode *node); @@ -256,7 +238,6 @@ struct _PurpleBlistUiOps * * @param account The account whose data to save. If NULL, save all data * for all accounts. - * @since 2.6.0. */ void (*save_account)(PurpleAccount *account); @@ -311,7 +292,6 @@ PurpleBlistNode *purple_blist_get_root(void); * freeing the list. * * @see purple_find_buddies - * @since 2.6.0 */ GSList *purple_blist_get_buddies(void); @@ -319,8 +299,6 @@ GSList *purple_blist_get_buddies(void); * Returns the UI data for the list. * * @return The UI data for the list. - * - * @since 2.6.0 */ gpointer purple_blist_get_ui_data(void); @@ -328,8 +306,6 @@ gpointer purple_blist_get_ui_data(void); * Sets the UI data for the list. * * @param ui_data The UI data for the list. - * - * @since 2.6.0 */ void purple_blist_set_ui_data(gpointer ui_data); @@ -352,7 +328,7 @@ PurpleBlistNode *purple_blist_node_next(PurpleBlistNode *node, gboolean offline) * * @param node A node. * @return The parent node. - * @since 2.4.0 + * * @see purple_blist_node_get_first_child * @see purple_blist_node_get_sibling_next * @see purple_blist_node_get_sibling_prev @@ -365,7 +341,7 @@ PurpleBlistNode *purple_blist_node_get_parent(PurpleBlistNode *node); * * @param node A node. * @return The child node. - * @since 2.4.0 + * * @see purple_blist_node_get_parent * @see purple_blist_node_get_sibling_next * @see purple_blist_node_get_sibling_prev @@ -378,7 +354,7 @@ PurpleBlistNode *purple_blist_node_get_first_child(PurpleBlistNode *node); * * @param node A node. * @return The sibling node. - * @since 2.4.0 + * * @see purple_blist_node_get_parent * @see purple_blist_node_get_first_child * @see purple_blist_node_get_sibling_prev @@ -391,7 +367,7 @@ PurpleBlistNode *purple_blist_node_get_sibling_next(PurpleBlistNode *node); * * @param node A node. * @return The sibling node. - * @since 2.4.0 + * * @see purple_blist_node_get_parent * @see purple_blist_node_get_first_child * @see purple_blist_node_get_sibling_next @@ -404,7 +380,6 @@ PurpleBlistNode *purple_blist_node_get_sibling_prev(PurpleBlistNode *node); * * @param node The node. * @return The UI data. - * @since 2.6.0 */ gpointer purple_blist_node_get_ui_data(const PurpleBlistNode *node); @@ -413,8 +388,6 @@ gpointer purple_blist_node_get_ui_data(const PurpleBlistNode *node); * * @param node The node. * @param ui_data The UI data. - * - * @since 2.6.0 */ void purple_blist_node_set_ui_data(PurpleBlistNode *node, gpointer ui_data); @@ -611,7 +584,6 @@ PurpleBuddyIcon *purple_buddy_get_icon(const PurpleBuddy *buddy); * @return The protocol data. * * @see purple_buddy_set_protocol_data() - * @since 2.6.0 */ gpointer purple_buddy_get_protocol_data(const PurpleBuddy *buddy); @@ -624,7 +596,6 @@ gpointer purple_buddy_get_protocol_data(const PurpleBuddy *buddy); * @param data The data. * * @see purple_buddy_get_protocol_data() - * @since 2.6.0 */ void purple_buddy_set_protocol_data(PurpleBuddy *buddy, gpointer data); @@ -651,8 +622,6 @@ PurplePresence *purple_buddy_get_presence(const PurpleBuddy *buddy); * * @param buddy The buddy. * @return The media caps. - * - * @since 2.7.0 */ PurpleMediaCaps purple_buddy_get_media_caps(const PurpleBuddy *buddy); @@ -727,8 +696,6 @@ void purple_contact_destroy(PurpleContact *contact); * * @param contact The contact * @return The group - * - * @since 2.7.0 */ PurpleGroup *purple_contact_get_group(const PurpleContact *contact); @@ -867,8 +834,6 @@ const char *purple_buddy_get_alias(PurpleBuddy *buddy); * * @param buddy The buddy * @return The local alias for the buddy - * - * @since 2.6.0 */ const char *purple_buddy_get_local_buddy_alias(PurpleBuddy *buddy); @@ -944,8 +909,6 @@ PurpleGroup *purple_chat_get_group(PurpleChat *chat); * @param chat The chat. * * @return The account the chat belongs to. - * - * @since 2.4.0 */ PurpleAccount *purple_chat_get_account(PurpleChat *chat); @@ -955,8 +918,6 @@ PurpleAccount *purple_chat_get_account(PurpleChat *chat); * @param chat The chat. * * @constreturn The hashtable. - * - * @since 2.4.0 */ GHashTable *purple_chat_get_components(PurpleChat *chat); @@ -1174,8 +1135,6 @@ PurpleBlistNodeFlags purple_blist_node_get_flags(PurpleBlistNode *node); * @param node The node. * * @return The type of the node. - * - * @since 2.1.0 */ PurpleBlistNodeType purple_blist_node_get_type(PurpleBlistNode *node); diff --git a/libpurple/certificate.h b/libpurple/certificate.h index 6c0d2664f4..b2cdf738fc 100644 --- a/libpurple/certificate.h +++ b/libpurple/certificate.h @@ -2,7 +2,6 @@ * @file certificate.h Public-Key Certificate API * @ingroup core * @see @ref certificate-signals - * @since 2.2.0 */ /* diff --git a/libpurple/cmds.h b/libpurple/cmds.h index dec8a12e8d..87fce8090d 100644 --- a/libpurple/cmds.h +++ b/libpurple/cmds.h @@ -225,19 +225,16 @@ GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd); /** * Get the handle for the commands API * @return The handle - * @since 2.5.0 */ gpointer purple_cmds_get_handle(void); /** * Initialize the commands subsystem. - * @since 2.5.0 */ void purple_cmds_init(void); /** * Uninitialize the commands subsystem. - * @since 2.5.0 */ void purple_cmds_uninit(void); diff --git a/libpurple/connection.h b/libpurple/connection.h index 655191a02a..b3c005c115 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -59,8 +59,6 @@ typedef enum /** * Possible errors that can cause a connection to be closed. - * - * @since 2.3.0 */ typedef enum { @@ -216,8 +214,6 @@ typedef struct * @param text a localized message describing the disconnection * in more detail to the user. * @see #purple_connection_error - * - * @since 2.3.0 */ void (*report_disconnect)(PurpleConnection *gc, PurpleConnectionError reason, @@ -305,8 +301,6 @@ void purple_connection_set_display_name(PurpleConnection *gc, const char *name); * * @param connection The PurpleConnection. * @param proto_data The protocol data to set for the connection. - * - * @since 2.6.0 */ void purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data); @@ -342,8 +336,6 @@ PurpleAccount *purple_connection_get_account(const PurpleConnection *gc); * @param gc The connection. * * @return The protocol plugin. - * - * @since 2.4.0 */ PurplePlugin * purple_connection_get_prpl(const PurpleConnection *gc); @@ -371,8 +363,6 @@ const char *purple_connection_get_display_name(const PurpleConnection *gc); * @param connection The PurpleConnection. * * @return The protocol data for the connection. - * - * @since 2.6.0 */ void *purple_connection_get_protocol_data(const PurpleConnection *connection); @@ -404,8 +394,6 @@ void purple_connection_notice(PurpleConnection *gc, const char *text); * @param gc the connection which is closing. * @param reason why the connection is closing. * @param description a non-@c NULL localized description of the error. - * - * @since 2.3.0 */ void purple_connection_error(PurpleConnection *gc, @@ -416,8 +404,6 @@ purple_connection_error(PurpleConnection *gc, * Closes a connection due to an SSL error; this is basically a shortcut to * turning the #PurpleSslErrorType into a #PurpleConnectionError and a * human-readable string and then calling purple_connection_error(). - * - * @since 2.3.0 */ void purple_connection_ssl_error (PurpleConnection *gc, @@ -440,8 +426,6 @@ purple_connection_ssl_error (PurpleConnection *gc, * * @return @c TRUE if the account should not be automatically reconnected, and * @c FALSE otherwise. - * - * @since 2.3.0 */ gboolean purple_connection_error_is_fatal (PurpleConnectionError reason); diff --git a/libpurple/conversation.h b/libpurple/conversation.h index c4343c17c5..71848cca0c 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -125,7 +125,7 @@ typedef enum PURPLE_MESSAGE_IMAGES = 0x1000, /**< Message contains images */ PURPLE_MESSAGE_NOTIFY = 0x2000, /**< Message is a notification */ PURPLE_MESSAGE_NO_LINKIFY = 0x4000, /**< Message should not be auto- - linkified @since 2.1.0 */ + linkified */ PURPLE_MESSAGE_INVISIBLE = 0x8000 /**< Message should not be displayed */ } PurpleMessageFlags; @@ -140,7 +140,7 @@ typedef enum PURPLE_CBFLAGS_OP = 0x0004, /**< Channel Op or Moderator */ PURPLE_CBFLAGS_FOUNDER = 0x0008, /**< Channel Founder */ PURPLE_CBFLAGS_TYPING = 0x0010, /**< Currently typing */ - PURPLE_CBFLAGS_AWAY = 0x0020 /**< Currently away. @since 2.8.0 */ + PURPLE_CBFLAGS_AWAY = 0x0020 /**< Currently away. */ } PurpleConvChatBuddyFlags; @@ -281,9 +281,7 @@ struct _PurpleConvChat char *nick; /**< Your nick in this chat. */ gboolean left; /**< We left the chat and kept the window open */ - GHashTable *users; /**< Hash table of the users in the room. - * @since 2.9.0 - */ + GHashTable *users; /**< Hash table of the users in the room. */ }; /** @@ -328,8 +326,6 @@ struct _PurpleConvChatBuddy /** * Description of a conversation message - * - * @since 2.2.0 */ struct _PurpleConvMessage { @@ -337,8 +333,8 @@ struct _PurpleConvMessage char *what; PurpleMessageFlags flags; time_t when; - PurpleConversation *conv; /**< @since 2.3.0 */ - char *alias; /**< @since 2.3.0 */ + PurpleConversation *conv; + char *alias; }; /** @@ -758,8 +754,6 @@ void purple_conversation_foreach(void (*func)(PurpleConversation *conv)); * @return A GList of PurpleConvMessage's. The must not modify the list or the data within. * The list contains the newest message at the beginning, and the oldest message at * the end. - * - * @since 2.2.0 */ GList *purple_conversation_get_message_history(PurpleConversation *conv); @@ -767,8 +761,6 @@ GList *purple_conversation_get_message_history(PurpleConversation *conv); * Clear the message history of a conversation. * * @param conv The conversation - * - * @since 2.2.0 */ void purple_conversation_clear_message_history(PurpleConversation *conv); @@ -778,8 +770,6 @@ void purple_conversation_clear_message_history(PurpleConversation *conv); * @param msg A PurpleConvMessage * * @return The name of the sender of the message - * - * @since 2.2.0 */ const char *purple_conversation_message_get_sender(PurpleConvMessage *msg); @@ -789,8 +779,6 @@ const char *purple_conversation_message_get_sender(PurpleConvMessage *msg); * @param msg A PurpleConvMessage * * @return The name of the sender of the message - * - * @since 2.2.0 */ const char *purple_conversation_message_get_message(PurpleConvMessage *msg); @@ -800,8 +788,6 @@ const char *purple_conversation_message_get_message(PurpleConvMessage *msg); * @param msg A PurpleConvMessage * * @return The message flags - * - * @since 2.2.0 */ PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg); @@ -811,8 +797,6 @@ PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg) * @param msg A PurpleConvMessage * * @return The timestamp of the message - * - * @since 2.2.0 */ time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg); @@ -1379,8 +1363,6 @@ void purple_conv_chat_left(PurpleConvChat *chat); * @param message The message to send with the invitation. * @param confirm Prompt before sending the invitation. The user is always * prompted if either \a user or \a message is @c NULL. - * - * @since 2.6.0 */ void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, const char *message, gboolean confirm); @@ -1440,8 +1422,6 @@ void purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb); * @return A list of PurpleMenuAction items, harvested by the * chat-extended-menu signal. The list and the menuaction * items should be freed by the caller. - * - * @since 2.1.0 */ GList * purple_conversation_get_extended_menu(PurpleConversation *conv); @@ -1455,8 +1435,6 @@ GList * purple_conversation_get_extended_menu(PurpleConversation *conv); * message, if not @c NULL. It must be freed by the caller with g_free(). * * @return @c TRUE if the command was executed successfully, @c FALSE otherwise. - * - * @since 2.1.0 */ gboolean purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **error); diff --git a/libpurple/core.h b/libpurple/core.h index edebd94a3a..5c67e35dd6 100644 --- a/libpurple/core.h +++ b/libpurple/core.h @@ -163,8 +163,6 @@ PurpleCoreUiOps *purple_core_get_ui_ops(void); * * @return @c TRUE if this is the first instance of libpurple running; * @c FALSE if there is another instance running. - * - * @since 2.1.0 */ gboolean purple_core_ensure_single_instance(void); @@ -196,8 +194,6 @@ gboolean purple_core_ensure_single_instance(void); * @return A GHashTable with strings for keys and values. This * hash table must not be freed and should not be modified. * - * @since 2.1.0 - * */ GHashTable* purple_core_get_ui_info(void); diff --git a/libpurple/dbus-server.h b/libpurple/dbus-server.h index 5215dccbae..5810dab8c7 100644 --- a/libpurple/dbus-server.h +++ b/libpurple/dbus-server.h @@ -173,8 +173,6 @@ void *purple_dbus_get_handle(void); /** * Determines whether this instance owns the DBus service name - * - * @since 2.1.0 */ gboolean purple_dbus_is_owner(void); diff --git a/libpurple/debug.h b/libpurple/debug.h index b90b86b99c..475df9f335 100644 --- a/libpurple/debug.h +++ b/libpurple/debug.h @@ -161,8 +161,6 @@ gboolean purple_debug_is_enabled(void); * plugins. * * @param verbose TRUE to enable verbose debugging or FALSE to disable it. - * - * @since 2.6.0 */ void purple_debug_set_verbose(gboolean verbose); @@ -170,8 +168,6 @@ void purple_debug_set_verbose(gboolean verbose); * Check if verbose logging is enabled. * * @return TRUE if verbose debugging is enabled, FALSE if it is not. - * - * @since 2.6.0 */ gboolean purple_debug_is_verbose(void); @@ -183,8 +179,6 @@ gboolean purple_debug_is_verbose(void); * @param unsafe TRUE to enable debug logging of messages that could * potentially contain passwords and other sensitive information. * FALSE to disable it. - * - * @since 2.6.0 */ void purple_debug_set_unsafe(gboolean unsafe); @@ -194,8 +188,6 @@ void purple_debug_set_unsafe(gboolean unsafe); * @return TRUE if the debug logging of all messages is enabled, FALSE * if messages that could potentially contain passwords and other * sensitive information are not logged. - * - * @since 2.6.0 */ gboolean purple_debug_is_unsafe(void); diff --git a/libpurple/eventloop.h b/libpurple/eventloop.h index ca95f6cbe8..76448492ce 100644 --- a/libpurple/eventloop.h +++ b/libpurple/eventloop.h @@ -145,7 +145,6 @@ struct _PurpleEventLoopUiOps * #timeout_add. * * @see purple_timeout_add_seconds() - * @since 2.1.0 **/ guint (*timeout_add_seconds)(guint interval, GSourceFunc function, gpointer data); @@ -192,8 +191,6 @@ guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data); * @param data data to pass to @a function. * @return A handle to the timer which can be passed to * purple_timeout_remove() to remove the timer. - * - * @since 2.1.0 */ guint purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data); diff --git a/libpurple/ft.h b/libpurple/ft.h index 0174ce4cc0..bd85589de0 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -87,7 +87,6 @@ typedef struct * * @return size if the write was successful, or a value between 0 and * size on error. - * @since 2.6.0 */ gssize (*ui_write)(PurpleXfer *xfer, const guchar *buffer, gssize size); @@ -102,7 +101,6 @@ typedef struct * @returns The amount of data in the buffer, 0 if nothing is available, * and a negative value if an error occurred and the transfer * should be cancelled (libpurple will cancel). - * @since 2.6.0 */ gssize (*ui_read)(PurpleXfer *xfer, guchar **buffer, gssize size); @@ -115,8 +113,6 @@ typedef struct * @param xfer The file transfer structure * @param buffer A pointer to the beginning of the unwritten data. * @param size The amount of unwritten data. - * - * @since 2.6.0 */ void (*data_not_sent)(PurpleXfer *xfer, const guchar *buffer, gsize size); @@ -307,8 +303,6 @@ PurpleAccount *purple_xfer_get_account(const PurpleXfer *xfer); * @param xfer The file transfer. * * @return The name of the remote user. - * - * @since 2.1.0 */ const char *purple_xfer_get_remote_user(const PurpleXfer *xfer); @@ -429,7 +423,6 @@ unsigned int purple_xfer_get_remote_port(const PurpleXfer *xfer); * @param xfer The file transfer. * * @return The time when the transfer started. - * @since 2.4.0 */ time_t purple_xfer_get_start_time(const PurpleXfer *xfer); @@ -439,7 +432,6 @@ time_t purple_xfer_get_start_time(const PurpleXfer *xfer); * @param xfer The file transfer. * * @return The time when the transfer ended. - * @since 2.4.0 */ time_t purple_xfer_get_end_time(const PurpleXfer *xfer); @@ -727,8 +719,6 @@ void purple_xfer_conversation_write(PurpleXfer *xfer, char *message, gboolean is * read/write/data_not_sent UI ops. * * @param xfer The file transfer which is ready. - * - * @since 2.6.0 */ void purple_xfer_ui_ready(PurpleXfer *xfer); @@ -738,8 +728,6 @@ void purple_xfer_ui_ready(PurpleXfer *xfer); * ops and cannot/does not provide a raw fd to the core. * * @param xfer The file transfer which is ready. - * - * @since 2.6.0 */ void purple_xfer_prpl_ready(PurpleXfer *xfer); @@ -750,7 +738,6 @@ void purple_xfer_prpl_ready(PurpleXfer *xfer); * @param len If not @c NULL, the length of the thumbnail data returned * will be set in the location pointed to by this. * @return The thumbnail data, or NULL if there is no thumbnail - * @since 2.7.0 */ gconstpointer purple_xfer_get_thumbnail(const PurpleXfer *xfer, gsize *len); @@ -759,7 +746,6 @@ gconstpointer purple_xfer_get_thumbnail(const PurpleXfer *xfer, gsize *len); * * @param xfer The file transfer to get the mimetype for * @return The mimetype of the thumbnail, or @c NULL if not thumbnail is set - * @since 2.7.0 */ const gchar *purple_xfer_get_thumbnail_mimetype(const PurpleXfer *xfer); @@ -771,7 +757,6 @@ const gchar *purple_xfer_get_thumbnail_mimetype(const PurpleXfer *xfer); * @param thumbnail A pointer to the thumbnail data, this will be copied * @param size The size in bytes of the passed in thumbnail data * @param mimetype The mimetype of the generated thumbnail - * @since 2.7.0 */ void purple_xfer_set_thumbnail(PurpleXfer *xfer, gconstpointer thumbnail, gsize size, const gchar *mimetype); @@ -783,7 +768,6 @@ void purple_xfer_set_thumbnail(PurpleXfer *xfer, gconstpointer thumbnail, * @param xfer The file transfer to create a thumbnail for * @param formats A comma-separated list of mimetypes for image formats * the protocols can use for thumbnails. - * @since 2.7.0 */ void purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats); @@ -792,8 +776,6 @@ void purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats); * * @param xfer The file transfer. * @param proto_data The protocol data to set for the file transfer. - * - * @since 3.0.0 */ void purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data); @@ -803,8 +785,6 @@ void purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data); * @param xfer The file transfer. * * @return The protocol data for the file transfer. - * - * @since 3.0.0 */ gpointer purple_xfer_get_protocol_data(const PurpleXfer *xfer); diff --git a/libpurple/log.h b/libpurple/log.h index 59249b5162..e57e9f7487 100644 --- a/libpurple/log.h +++ b/libpurple/log.h @@ -301,8 +301,6 @@ int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccoun * @param name The name of the log * @param account The account * @return The activity score - * - * @since 2.6.0 */ int purple_log_get_activity_score(PurpleLogType type, const char *name, PurpleAccount *account); diff --git a/libpurple/media-gst.h b/libpurple/media-gst.h index 91d9986d8a..32d2b3c9d2 100644 --- a/libpurple/media-gst.h +++ b/libpurple/media-gst.h @@ -81,8 +81,6 @@ extern "C" { * Gets the element type's GType. * * @return The element type's GType. - * - * @since 2.6.0 */ GType purple_media_element_type_get_type(void); @@ -90,8 +88,6 @@ GType purple_media_element_type_get_type(void); * Gets the element info's GType. * * @return The element info's GType. - * - * @since 2.6.0 */ GType purple_media_element_info_get_type(void); @@ -102,8 +98,6 @@ GType purple_media_element_info_get_type(void); * @param sess_id The session id of the session to get the source from. * * @return The source retrieved. - * - * @since 2.6.0 */ GstElement *purple_media_get_src(PurpleMedia *media, const gchar *sess_id); @@ -115,8 +109,6 @@ GstElement *purple_media_get_src(PurpleMedia *media, const gchar *sess_id); * @param participant Optionally, the participant of the stream to get the tee from. * * @return The GstTee element from the chosen session/stream. - * - * @since 2.6.0 */ GstElement *purple_media_get_tee(PurpleMedia *media, const gchar *session_id, const gchar *participant); @@ -128,8 +120,6 @@ GstElement *purple_media_get_tee(PurpleMedia *media, * @param manager The media manager to get the pipeline from. * * @return The pipeline. - * - * @since 2.6.0 */ GstElement *purple_media_manager_get_pipeline(PurpleMediaManager *manager); @@ -141,8 +131,6 @@ GstElement *purple_media_manager_get_pipeline(PurpleMediaManager *manager); * @param media The media call this element is requested for. * @param session_id The id of the session this element is requested for or NULL. * @param participant The remote user this element is requested for or NULL. - * - * @since 2.6.0 */ GstElement *purple_media_manager_get_element(PurpleMediaManager *manager, PurpleMediaSessionType type, PurpleMedia *media, @@ -167,8 +155,6 @@ PurpleMediaElementInfo *purple_media_manager_get_active_element( * * @param manager The media manager to set the media formats. * @param caps Set of allowed media formats. - * - * @since 2.8.0 */ void purple_media_manager_set_video_caps(PurpleMediaManager *manager, GstCaps *caps); @@ -179,8 +165,6 @@ void purple_media_manager_set_video_caps(PurpleMediaManager *manager, * @param manager The media manager to get the media formats from. * * @return @c GstCaps limiting the video source's formats. - * - * @since 2.8.0 */ GstCaps *purple_media_manager_get_video_caps(PurpleMediaManager *manager); diff --git a/libpurple/media.h b/libpurple/media.h index b001b7511c..ce23a98587 100644 --- a/libpurple/media.h +++ b/libpurple/media.h @@ -57,8 +57,6 @@ extern "C" { * Gets the media class's GType * * @return The media class's GType. - * - * @since 2.6.0 */ GType purple_media_get_type(void); @@ -68,8 +66,6 @@ GType purple_media_get_type(void); * @param media The media session from which to retrieve session IDs. * * @return GList of session IDs. The caller must free the list. - * - * @since 2.6.0 */ GList *purple_media_get_session_ids(PurpleMedia *media); @@ -79,8 +75,6 @@ GList *purple_media_get_session_ids(PurpleMedia *media); * @param media The media session to retrieve the account from. * * @return The account retrieved. - * - * @since 2.6.0 */ PurpleAccount *purple_media_get_account(PurpleMedia *media); @@ -90,8 +84,6 @@ PurpleAccount *purple_media_get_account(PurpleMedia *media); * @param media The media session to retrieve the prpl data from. * * @return The prpl data retrieved. - * - * @since 2.6.0 */ gpointer purple_media_get_prpl_data(PurpleMedia *media); @@ -100,8 +92,6 @@ gpointer purple_media_get_prpl_data(PurpleMedia *media); * * @param media The media session to set the prpl data on. * @param prpl_data The data to set on the media session. - * - * @since 2.6.0 */ void purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data); @@ -111,8 +101,6 @@ void purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data); * @param media The media object to set the state on. * @param error The format of the error message to send in the signal. * @param ... The arguments to plug into the format. - * - * @since 2.6.0 */ void purple_media_error(PurpleMedia *media, const gchar *error, ...); @@ -122,8 +110,6 @@ void purple_media_error(PurpleMedia *media, const gchar *error, ...); * @param media The media object with which to end streams. * @param session_id The session to end streams on. * @param participant The participant to end streams with. - * - * @since 2.6.0 */ void purple_media_end(PurpleMedia *media, const gchar *session_id, const gchar *participant); @@ -136,8 +122,6 @@ void purple_media_end(PurpleMedia *media, const gchar *session_id, * @param session_id The id of the session of the stream being signaled. * @param participant The participant of the stream being signaled. * @param local TRUE if the info originated locally, FALSE if on the remote end. - * - * @since 2.6.0 */ void purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type, const gchar *session_id, const gchar *participant, @@ -158,8 +142,6 @@ void purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type, * @param media The media object to set the parameters on. * @param num_params The number of parameters to pass * @param params Array of @c GParameter to pass - * - * @since 2.8.0 */ void purple_media_set_params(PurpleMedia *media, guint num_params, GParameter *params); @@ -172,8 +154,6 @@ void purple_media_set_params(PurpleMedia *media, * @param media The media object * * @return NULL-terminated array of names of supported parameters. - * - * @since 2.8.0 */ const gchar **purple_media_get_available_params(PurpleMedia *media); @@ -184,8 +164,6 @@ const gchar **purple_media_get_available_params(PurpleMedia *media); * @param param name of parameter * * @return @c TRUE if backend recognizes the parameter, @c FALSE otherwise. - * - * @since 2.8.0 */ gboolean purple_media_param_is_supported(PurpleMedia *media, const gchar *param); @@ -205,8 +183,6 @@ gboolean purple_media_param_is_supported(PurpleMedia *media, const gchar *param) * @param params The parameters to pass to Farsight. * * @return @c TRUE The stream was added successfully, @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who, PurpleMediaSessionType type, @@ -220,8 +196,6 @@ gboolean purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, * @param sess_id The session id of the session to get the type from. * * @return The retreived session type. - * - * @since 2.6.0 */ PurpleMediaSessionType purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id); @@ -231,8 +205,6 @@ PurpleMediaSessionType purple_media_get_session_type(PurpleMedia *media, const g * @param media The media object to get the manager instance from. * * @return The PurpleMediaManager instance retrieved. - * - * @since 2.6.0 */ struct _PurpleMediaManager *purple_media_get_manager(PurpleMedia *media); @@ -243,8 +215,6 @@ struct _PurpleMediaManager *purple_media_get_manager(PurpleMedia *media); * @param sess_id The session id of the session to get the codecs from. * * @return The retreieved codecs. - * - * @since 2.6.0 */ GList *purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id); @@ -255,8 +225,6 @@ GList *purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id); * @param sess_id The session id of the session find the stream in. * @param participant The name of the remote user to add the candidates for. * @param remote_candidates The remote candidates to add. - * - * @since 2.6.0 */ void purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id, @@ -269,8 +237,6 @@ void purple_media_add_remote_candidates(PurpleMedia *media, * @param media The media object to find the session in. * @param sess_id The session id of the session to find the stream in. * @param participant The name of the remote user to get the candidates from. - * - * @since 2.6.0 */ GList *purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, @@ -285,8 +251,6 @@ GList *purple_media_get_local_candidates(PurpleMedia *media, * from. * * @return The active candidates retrieved. - * - * @since 2.8.0 */ GList *purple_media_get_active_local_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *participant); @@ -300,8 +264,6 @@ GList *purple_media_get_active_local_candidates(PurpleMedia *media, * from. * * @return The remote candidates retrieved. - * - * @since 2.8.0 */ GList *purple_media_get_active_remote_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *participant); @@ -315,8 +277,6 @@ GList *purple_media_get_active_remote_candidates(PurpleMedia *media, * @param codecs The list of remote codecs to set. * * @return @c TRUE The codecs were set successfully, or @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, const gchar *participant, GList *codecs); @@ -329,8 +289,6 @@ gboolean purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id * @param participant The remote user to check for. * * @return @c TRUE All streams for the given session_id/participant combination have candidates prepared, @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_candidates_prepared(PurpleMedia *media, const gchar *session_id, const gchar *participant); @@ -343,8 +301,6 @@ gboolean purple_media_candidates_prepared(PurpleMedia *media, * @param codec The codec to set the session to stream. * * @return @c TRUE The codec was successfully changed, or @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec); @@ -355,8 +311,6 @@ gboolean purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, P * @param sess_id The session id of the session to check. * * @return @c TRUE The codecs are ready, or @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id); @@ -368,8 +322,6 @@ gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id); * @param participant The participant of the stream to check. * * @return TRUE if the local user is the stream's initator, else FALSE. - * - * @since 2.6.0 */ gboolean purple_media_is_initiator(PurpleMedia *media, const gchar *sess_id, const gchar *participant); @@ -382,8 +334,6 @@ gboolean purple_media_is_initiator(PurpleMedia *media, * @param participant The participant to check. * * @return @c TRUE The selected streams have been accepted, or @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_accepted(PurpleMedia *media, const gchar *sess_id, const gchar *participant); @@ -394,8 +344,6 @@ gboolean purple_media_accepted(PurpleMedia *media, const gchar *sess_id, * @param media The media object the sessions are in. * @param session_id The session to select (if any). * @param level The level to set the volume to. - * - * @since 2.6.0 */ void purple_media_set_input_volume(PurpleMedia *media, const gchar *session_id, double level); @@ -406,8 +354,6 @@ void purple_media_set_input_volume(PurpleMedia *media, const gchar *session_id, * @param session_id The session to limit the streams to (if any). * @param participant The participant to limit the streams to (if any). * @param level The level to set the volume to. - * - * @since 2.6.0 */ void purple_media_set_output_volume(PurpleMedia *media, const gchar *session_id, const gchar *participant, double level); @@ -421,8 +367,6 @@ void purple_media_set_output_volume(PurpleMedia *media, const gchar *session_id, * @param window_id The window id use for embedding the video in. * * @return An id to reference the output window. - * - * @since 2.6.0 */ gulong purple_media_set_output_window(PurpleMedia *media, const gchar *session_id, const gchar *participant, @@ -432,8 +376,6 @@ gulong purple_media_set_output_window(PurpleMedia *media, * Removes all output windows from a given media session. * * @param media The instance to remove all output windows from. - * - * @since 2.6.0 */ void purple_media_remove_output_windows(PurpleMedia *media); diff --git a/libpurple/media/backend-fs2.h b/libpurple/media/backend-fs2.h index 47fb02dac5..e79f84db47 100644 --- a/libpurple/media/backend-fs2.h +++ b/libpurple/media/backend-fs2.h @@ -50,8 +50,6 @@ typedef struct _PurpleMediaBackendFs2 PurpleMediaBackendFs2; * Gets the type of the Farsight 2 media backend object. * * @return The Farsight 2 media backend's GType - * - * @since 2.7.0 */ GType purple_media_backend_fs2_get_type(void); diff --git a/libpurple/media/backend-iface.h b/libpurple/media/backend-iface.h index 94105fbaca..a0c96a6fed 100644 --- a/libpurple/media/backend-iface.h +++ b/libpurple/media/backend-iface.h @@ -77,8 +77,6 @@ struct _PurpleMediaBackendIface * Gets the media backend's GType. * * @return The media backend's GType. - * - * @since 2.7.0 */ GType purple_media_backend_get_type(void); @@ -95,8 +93,6 @@ GType purple_media_backend_get_type(void); * @param params The additional parameters to pass when creating the stream. * * @return True if the stream was successfully created, othewise False. - * - * @since 2.7.0 */ gboolean purple_media_backend_add_stream(PurpleMediaBackend *self, const gchar *sess_id, const gchar *who, @@ -111,8 +107,6 @@ gboolean purple_media_backend_add_stream(PurpleMediaBackend *self, * @param sess_id The session id associated with the stream. * @param participant The participant associated with the stream. * @param remote_candidates The list of remote candidates to add. - * - * @since 2.7.0 */ void purple_media_backend_add_remote_candidates(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, @@ -128,8 +122,6 @@ void purple_media_backend_add_remote_candidates(PurpleMediaBackend *self, * @param sess_id The session id of the session to check. * * @return True if the codecs are ready, otherwise False. - * - * @since 2.7.0 */ gboolean purple_media_backend_codecs_ready(PurpleMediaBackend *self, const gchar *sess_id); @@ -144,8 +136,6 @@ gboolean purple_media_backend_codecs_ready(PurpleMediaBackend *self, * @param sess_id The session id of the session to use. * * @return The codec intersection list. - * - * @since 2.7.0 */ GList *purple_media_backend_get_codecs(PurpleMediaBackend *self, const gchar *sess_id); @@ -158,8 +148,6 @@ GList *purple_media_backend_get_codecs(PurpleMediaBackend *self, * @param particilant The participant associated with the stream. * * @return The list of local candidates. - * - * @since 2.7.0 */ GList *purple_media_backend_get_local_candidates(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant); @@ -173,8 +161,6 @@ GList *purple_media_backend_get_local_candidates(PurpleMediaBackend *self, * @param codecs The list of remote codecs to set. * * @return True if the remote codecs were set successfully, otherwise False. - * - * @since 2.7.0 */ gboolean purple_media_backend_set_remote_codecs(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, @@ -188,8 +174,6 @@ gboolean purple_media_backend_set_remote_codecs(PurpleMediaBackend *self, * @param codec The codec to set. * * @return True if set successfully, otherwise False. - * - * @since 2.7.0 */ gboolean purple_media_backend_set_send_codec(PurpleMediaBackend *self, const gchar *sess_id, PurpleMediaCodec *codec); @@ -200,8 +184,6 @@ gboolean purple_media_backend_set_send_codec(PurpleMediaBackend *self, * @param self The media backend to set the parameters on. * @param num_params The number of parameters to pass to backend * @param params Array of @c GParameter to pass to backend - * - * @since 2.8.0 */ void purple_media_backend_set_params(PurpleMediaBackend *self, guint num_params, GParameter *params); @@ -214,8 +196,6 @@ void purple_media_backend_set_params(PurpleMediaBackend *self, * @param self The media backend * * @return NULL-terminated array of names of supported parameters. - * - * @since 2.8.0 */ const gchar **purple_media_backend_get_available_params(PurpleMediaBackend *self); diff --git a/libpurple/media/candidate.h b/libpurple/media/candidate.h index 1dfa0fd05e..85a103bf05 100644 --- a/libpurple/media/candidate.h +++ b/libpurple/media/candidate.h @@ -47,8 +47,6 @@ typedef struct _PurpleMediaCandidate PurpleMediaCandidate; * Gets the type of the media candidate structure. * * @return The media canditate's GType - * - * @since 2.6.0 */ GType purple_media_candidate_get_type(void); @@ -63,8 +61,6 @@ GType purple_media_candidate_get_type(void); * @param port The network port. * * @return The newly created PurpleMediaCandidate instance. - * - * @since 2.6.0 */ PurpleMediaCandidate *purple_media_candidate_new( const gchar *foundation, guint component_id, @@ -78,8 +74,6 @@ PurpleMediaCandidate *purple_media_candidate_new( * @param candidate The candidate to copy. * * @return The copy of the PurpleMediaCandidate. - * - * @since 2.7.0 */ PurpleMediaCandidate *purple_media_candidate_copy( PurpleMediaCandidate *candidate); @@ -90,8 +84,6 @@ PurpleMediaCandidate *purple_media_candidate_copy( * @param candidates The list of candidates to be copied. * * @return The copy of the GList. - * - * @since 2.6.0 */ GList *purple_media_candidate_list_copy(GList *candidates); @@ -99,8 +91,6 @@ GList *purple_media_candidate_list_copy(GList *candidates); * Frees a GList of PurpleMediaCandidate and its contents. * * @param candidates The list of candidates to be freed. - * - * @since 2.6.0 */ void purple_media_candidate_list_free(GList *candidates); @@ -110,8 +100,6 @@ void purple_media_candidate_list_free(GList *candidates); * @param candidate The candidate to get the foundation from. * * @return The foundation. - * - * @since 2.6.0 */ gchar *purple_media_candidate_get_foundation(PurpleMediaCandidate *candidate); @@ -121,8 +109,6 @@ gchar *purple_media_candidate_get_foundation(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the compnent id from. * * @return The component id. - * - * @since 2.6.0 */ guint purple_media_candidate_get_component_id(PurpleMediaCandidate *candidate); @@ -132,8 +118,6 @@ guint purple_media_candidate_get_component_id(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the IP address from. * * @return The IP address. - * - * @since 2.6.0 */ gchar *purple_media_candidate_get_ip(PurpleMediaCandidate *candidate); @@ -143,8 +127,6 @@ gchar *purple_media_candidate_get_ip(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the port from. * * @return The port. - * - * @since 2.6.0 */ guint16 purple_media_candidate_get_port(PurpleMediaCandidate *candidate); @@ -156,8 +138,6 @@ guint16 purple_media_candidate_get_port(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the base IP address from. * * @return The base IP address. - * - * @since 2.6.0 */ gchar *purple_media_candidate_get_base_ip(PurpleMediaCandidate *candidate); @@ -169,8 +149,6 @@ gchar *purple_media_candidate_get_base_ip(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the base port. * * @return The base port. - * - * @since 2.6.0 */ guint16 purple_media_candidate_get_base_port(PurpleMediaCandidate *candidate); @@ -180,8 +158,6 @@ guint16 purple_media_candidate_get_base_port(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the protocol from. * * @return The protocol. - * - * @since 2.6.0 */ PurpleMediaNetworkProtocol purple_media_candidate_get_protocol( PurpleMediaCandidate *candidate); @@ -192,8 +168,6 @@ PurpleMediaNetworkProtocol purple_media_candidate_get_protocol( * @param candidate The candidate to get the priority from. * * @return The priority. - * - * @since 2.6.0 */ guint32 purple_media_candidate_get_priority(PurpleMediaCandidate *candidate); @@ -203,8 +177,6 @@ guint32 purple_media_candidate_get_priority(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the candidate type from. * * @return The candidate type. - * - * @since 2.6.0 */ PurpleMediaCandidateType purple_media_candidate_get_candidate_type( PurpleMediaCandidate *candidate); @@ -217,8 +189,6 @@ PurpleMediaCandidateType purple_media_candidate_get_candidate_type( * @param The candidate to get the username from. * * @return The username. - * - * @since 2.6.0 */ gchar *purple_media_candidate_get_username(PurpleMediaCandidate *candidate); @@ -230,8 +200,6 @@ gchar *purple_media_candidate_get_username(PurpleMediaCandidate *candidate); * @param The candidate to get the password from. * * @return The password. - * - * @since 2.6.0 */ gchar *purple_media_candidate_get_password(PurpleMediaCandidate *candidate); @@ -241,8 +209,6 @@ gchar *purple_media_candidate_get_password(PurpleMediaCandidate *candidate); * @param The candidate to get the TTL from. * * @return The TTL. - * - * @since 2.6.0 */ guint purple_media_candidate_get_ttl(PurpleMediaCandidate *candidate); diff --git a/libpurple/media/codec.h b/libpurple/media/codec.h index 46a4ee194e..5bdcdd4f15 100644 --- a/libpurple/media/codec.h +++ b/libpurple/media/codec.h @@ -50,8 +50,6 @@ G_BEGIN_DECLS * Gets the type of the media codec structure. * * @return The media codec's GType - * - * @since 2.6.0 */ GType purple_media_codec_get_type(void); @@ -64,8 +62,6 @@ GType purple_media_codec_get_type(void); * @param clock_rate The clock rate this codec encodes at, if applicable. * * @return The newly created PurpleMediaCodec. - * - * @since 2.6.0 */ PurpleMediaCodec *purple_media_codec_new(int id, const char *encoding_name, PurpleMediaSessionType media_type, guint clock_rate); @@ -76,8 +72,6 @@ PurpleMediaCodec *purple_media_codec_new(int id, const char *encoding_name, * @param The codec to get the id from. * * @return The codec id. - * - * @since 2.6.0 */ guint purple_media_codec_get_id(PurpleMediaCodec *codec); @@ -87,8 +81,6 @@ guint purple_media_codec_get_id(PurpleMediaCodec *codec); * @param The codec to get the encoding name from. * * @return The encoding name. - * - * @since 2.6.0 */ gchar *purple_media_codec_get_encoding_name(PurpleMediaCodec *codec); @@ -98,8 +90,6 @@ gchar *purple_media_codec_get_encoding_name(PurpleMediaCodec *codec); * @param The codec to get the clock rate from. * * @return The clock rate. - * - * @since 2.6.0 */ guint purple_media_codec_get_clock_rate(PurpleMediaCodec *codec); @@ -109,8 +99,6 @@ guint purple_media_codec_get_clock_rate(PurpleMediaCodec *codec); * @param The codec to get the number of channels from. * * @return The number of channels. - * - * @since 2.6.0 */ guint purple_media_codec_get_channels(PurpleMediaCodec *codec); @@ -123,8 +111,6 @@ guint purple_media_codec_get_channels(PurpleMediaCodec *codec); * * @return The list of optional parameters. The list is owned by the codec and * should not be freed. - * - * @since 2.6.0 */ GList *purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec); @@ -134,8 +120,6 @@ GList *purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec); * @param codec The codec to add the parameter to. * @param name The name of the parameter to add. * @param value The value of the parameter to add. - * - * @since 2.6.0 */ void purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, const gchar *name, const gchar *value); @@ -145,8 +129,6 @@ void purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, * * @param codec The codec to remove the parameter from. * @param param A pointer to the parameter to remove. - * - * @since 2.6.0 */ void purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec, PurpleKeyValuePair *param); @@ -159,8 +141,6 @@ void purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec, * @param value The value to search for or NULL. * * @return The value found or NULL. - * - * @since 2.6.0 */ PurpleKeyValuePair *purple_media_codec_get_optional_parameter( PurpleMediaCodec *codec, const gchar *name, @@ -172,8 +152,6 @@ PurpleKeyValuePair *purple_media_codec_get_optional_parameter( * @param codec The codec to copy. * * @return The copy of the codec. - * - * @since 2.7.0 */ PurpleMediaCodec *purple_media_codec_copy(PurpleMediaCodec *codec); @@ -183,8 +161,6 @@ PurpleMediaCodec *purple_media_codec_copy(PurpleMediaCodec *codec); * @param codecs The list of codecs to be copied. * * @return The copy of the GList. - * - * @since 2.6.0 */ GList *purple_media_codec_list_copy(GList *codecs); @@ -192,8 +168,6 @@ GList *purple_media_codec_list_copy(GList *codecs); * Frees a GList of PurpleMediaCodec and its contents. * * @param codecs The list of codecs to be freed. - * - * @since 2.6.0 */ void purple_media_codec_list_free(GList *codecs); @@ -203,8 +177,6 @@ void purple_media_codec_list_free(GList *codecs); * @param codec The codec to create the string of. * * @return The new string representation. - * - * @since 2.6.0 */ gchar *purple_media_codec_to_string(const PurpleMediaCodec *codec); diff --git a/libpurple/media/enum-types.h b/libpurple/media/enum-types.h index dd163d56ab..5e23e11e05 100644 --- a/libpurple/media/enum-types.h +++ b/libpurple/media/enum-types.h @@ -107,8 +107,6 @@ typedef enum { * Gets the media candidate type's GType * * @return The media candidate type's GType. - * - * @since 2.6.0 */ GType purple_media_candidate_type_get_type(void); @@ -116,8 +114,6 @@ GType purple_media_candidate_type_get_type(void); * Gets the type of the media caps flags * * @return The media caps flags' GType - * - * @since 2.7.0 */ GType purple_media_caps_get_type(void); @@ -125,8 +121,6 @@ GType purple_media_caps_get_type(void); * Gets the type of the info type enum * * @return The info type enum's GType - * - * @since 2.6.0 */ GType purple_media_info_type_get_type(void); @@ -134,8 +128,6 @@ GType purple_media_info_type_get_type(void); * Gets the media network protocol's GType * * @return The media network protocol's GType. - * - * @since 2.6.0 */ GType purple_media_network_protocol_get_type(void); @@ -143,8 +135,6 @@ GType purple_media_network_protocol_get_type(void); * Gets the media session type's GType * * @return The media session type's GType. - * - * @since 2.6.0 */ GType purple_media_session_type_get_type(void); @@ -152,8 +142,6 @@ GType purple_media_session_type_get_type(void); * Gets the type of the state-changed enum * * @return The state-changed enum's GType - * - * @since 2.6.0 */ GType purple_media_state_changed_get_type(void); diff --git a/libpurple/mediamanager.h b/libpurple/mediamanager.h index d9f54ad543..099972a4ac 100644 --- a/libpurple/mediamanager.h +++ b/libpurple/mediamanager.h @@ -60,8 +60,6 @@ extern "C" { * Gets the media manager's GType. * * @return The media manager's GType. - * - * @since 2.6.0 */ GType purple_media_manager_get_type(void); @@ -69,8 +67,6 @@ GType purple_media_manager_get_type(void); * Gets the "global" media manager object. It's created if it doesn't already exist. * * @return The "global" instance of the media manager object. - * - * @since 2.6.0 */ PurpleMediaManager *purple_media_manager_get(void); @@ -84,8 +80,6 @@ PurpleMediaManager *purple_media_manager_get(void); * @param initiator TRUE if the local user is the initiator of this media call, FALSE otherwise. * * @return A newly created media session. - * - * @since 2.6.0 */ PurpleMedia *purple_media_manager_create_media(PurpleMediaManager *manager, PurpleAccount *account, @@ -99,8 +93,6 @@ PurpleMedia *purple_media_manager_create_media(PurpleMediaManager *manager, * @param manager The media manager to get all of the sessions from. * * @return A list of all the media sessions. - * - * @since 2.6.0 */ GList *purple_media_manager_get_media(PurpleMediaManager *manager); @@ -111,8 +103,6 @@ GList *purple_media_manager_get_media(PurpleMediaManager *manager); * @param account The account the sessions are on. * * @return A list of the media sessions on the given account. - * - * @since 2.6.0 */ GList *purple_media_manager_get_media_by_account( PurpleMediaManager *manager, PurpleAccount *account); @@ -122,8 +112,6 @@ GList *purple_media_manager_get_media_by_account( * * @param manager The media manager to remove the media session from. * @param media The media session to remove. - * - * @since 2.6.0 */ void purple_media_manager_remove_media(PurpleMediaManager *manager, @@ -140,8 +128,6 @@ purple_media_manager_remove_media(PurpleMediaManager *manager, * @param participant The participant the output windows are registered with. * * @return TRUE if it succeeded, FALSE if it failed. - * - * @since 2.6.0 */ gboolean purple_media_manager_create_output_window( PurpleMediaManager *manager, PurpleMedia *media, @@ -157,8 +143,6 @@ gboolean purple_media_manager_create_output_window( * @param window_id The window ID to embed the video in. * * @return A unique ID to the registered output window, 0 if it failed. - * - * @since 2.6.0 */ gulong purple_media_manager_set_output_window(PurpleMediaManager *manager, PurpleMedia *media, const gchar *session_id, @@ -171,8 +155,6 @@ gulong purple_media_manager_set_output_window(PurpleMediaManager *manager, * @param output_window_id The ID of the output window. * * @return TRUE if it found the output window and was successful, else FALSE. - * - * @since 2.6.0 */ gboolean purple_media_manager_remove_output_window( PurpleMediaManager *manager, gulong output_window_id); @@ -184,8 +166,6 @@ gboolean purple_media_manager_remove_output_window( * @param media The media instance the output windows were registered for. * @param session_id The session the output windows were registered for. * @param participant The participant the output windows were registered for. - * - * @since 2.6.0 */ void purple_media_manager_remove_output_windows( PurpleMediaManager *manager, PurpleMedia *media, @@ -196,8 +176,6 @@ void purple_media_manager_remove_output_windows( * * @param manager The manager to set the caps on. * @param caps The caps to set. - * - * @since 2.6.0 */ void purple_media_manager_set_ui_caps(PurpleMediaManager *manager, PurpleMediaCaps caps); @@ -208,8 +186,6 @@ void purple_media_manager_set_ui_caps(PurpleMediaManager *manager, * @param manager The manager to get caps from. * * @return caps The caps retrieved. - * - * @since 2.6.0 */ PurpleMediaCaps purple_media_manager_get_ui_caps(PurpleMediaManager *manager); @@ -218,8 +194,6 @@ PurpleMediaCaps purple_media_manager_get_ui_caps(PurpleMediaManager *manager); * * @param manager The manager to set the caps on. * @param backend_type The media backend type to use. - * - * @since 2.7.0 */ void purple_media_manager_set_backend_type(PurpleMediaManager *manager, GType backend_type); @@ -230,8 +204,6 @@ void purple_media_manager_set_backend_type(PurpleMediaManager *manager, * @param manager The manager to get the media backend type from. * * @return The type of media backend type media objects will use. - * - * @since 2.7.0 */ GType purple_media_manager_get_backend_type(PurpleMediaManager *manager); diff --git a/libpurple/network.h b/libpurple/network.h index 3327970dbe..7686214906 100644 --- a/libpurple/network.h +++ b/libpurple/network.h @@ -92,7 +92,6 @@ const char *purple_network_get_local_system_ip(int fd); * * @note The caller must free this list. If libpurple was built with * support for it, this function also enumerates IPv6 addresses. - * @since 2.7.0 * * @return A list of local IP addresses. */ @@ -240,8 +239,6 @@ gboolean purple_network_is_available(void); * This is what backs the --force-online command line argument in Pidgin, * for example. This is useful for offline testing, especially when * combined with nullprpl. - * - * @since 2.6.0 */ void purple_network_force_online(void); @@ -257,7 +254,6 @@ void *purple_network_get_handle(void); * Will result in a DNS query being executed asynchronous * * @param stun_server The host name of the STUN server to set - * @since 2.6.0 */ void purple_network_set_stun_server(const gchar *stun_server); @@ -265,7 +261,6 @@ void purple_network_set_stun_server(const gchar *stun_server); * Get the IP address of the STUN server as a string representation * * @return the IP address - * @since 2.6.0 */ const gchar *purple_network_get_stun_ip(void); @@ -274,7 +269,6 @@ const gchar *purple_network_get_stun_ip(void); * Will result in a DNS query being executed asynchronous * * @param turn_server The host name of the TURN server to set - * @since 2.6.0 */ void purple_network_set_turn_server(const gchar *turn_server); @@ -282,7 +276,6 @@ void purple_network_set_turn_server(const gchar *turn_server); * Get the IP address of the TURN server as a string representation * * @return the IP address - * @since 2.6.0 */ const gchar *purple_network_get_turn_ip(void); @@ -290,7 +283,6 @@ const gchar *purple_network_get_turn_ip(void); * Remove a port mapping (UPnP or NAT-PMP) associated with listening socket * * @param fd Socket to remove the port mapping for - * @since 2.6.0 */ void purple_network_remove_port_mapping(gint fd); @@ -309,7 +301,6 @@ void purple_network_remove_port_mapping(gint fd); * The caller is responsible for freeing this. * @returns 0 on success, -1 if the out is NULL, or an error code * that currently corresponds to the Idna_rc enum in libidn. - * @since 2.6.0 */ int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out); diff --git a/libpurple/notify.h b/libpurple/notify.h index 700bacce2a..358bf04508 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -550,7 +550,6 @@ void purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info); * Prepend a section break. A UI might display this as a horizontal line. * * @param user_info The PurpleNotifyUserInfo - * @since 2.5.0 */ void purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info); @@ -569,7 +568,6 @@ void purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, * * @param user_info The PurpleNotifyUserInfo * @param label The name of the section - * @since 2.5.0 */ void purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label); diff --git a/libpurple/plugin.h b/libpurple/plugin.h index 1273cc8bf0..5d6b48b663 100644 --- a/libpurple/plugin.h +++ b/libpurple/plugin.h @@ -317,8 +317,6 @@ gboolean purple_plugin_unload(PurplePlugin *plugin); * startup" by excluding said plugins from the list of plugins to save. The * UI needs to call purple_plugins_save_loaded() after calling this for it * to have any effect. - * - * @since 2.3.0 */ void purple_plugin_disable(PurplePlugin *plugin); @@ -515,8 +513,6 @@ void purple_plugins_add_search_path(const char *path); * Returns a list of plugin search paths. * * @constreturn A list of searched paths. - * - * @since 2.6.0 */ GList *purple_plugins_get_search_paths(void); diff --git a/libpurple/pounce.h b/libpurple/pounce.h index 2114f7f901..1b3a30cdc7 100644 --- a/libpurple/pounce.h +++ b/libpurple/pounce.h @@ -101,8 +101,6 @@ void purple_pounce_destroy_all_by_account(PurpleAccount *account); * Destroys all buddy pounces for a buddy * * @param buddy The buddy whose pounces are to be removed - * - * @since 2.8.0 */ void purple_pounce_destroy_all_by_buddy(PurpleBuddy *buddy); @@ -334,7 +332,6 @@ GList *purple_pounces_get_all(void); * * @return The list of buddy pounces. The list should be freed by * the caller when it's no longer used. - * @since 2.1.0 */ GList *purple_pounces_get_all_for_ui(const char *ui); diff --git a/libpurple/prefs.h b/libpurple/prefs.h index 6b542ea1d3..42fc7687bb 100644 --- a/libpurple/prefs.h +++ b/libpurple/prefs.h @@ -317,8 +317,6 @@ GList *purple_prefs_get_path_list(const char *name); * @return A list of newly allocated strings denoting the names of the children. * Returns @c NULL if there are no children or if pref doesn't exist. * The caller must free all the strings and the list. - * - * @since 2.1.0 */ GList *purple_prefs_get_children_names(const char *name); diff --git a/libpurple/proxy.h b/libpurple/proxy.h index 63f6af35b3..e12e328bc2 100644 --- a/libpurple/proxy.h +++ b/libpurple/proxy.h @@ -182,7 +182,6 @@ PurpleProxyInfo *purple_global_proxy_get_info(void); * Set purple's global proxy information. * * @param info The proxy information. - * @since 2.6.0 */ void purple_global_proxy_set_info(PurpleProxyInfo *info); diff --git a/libpurple/prpl.h b/libpurple/prpl.h index b65d5456a6..f20cfb2a25 100644 --- a/libpurple/prpl.h +++ b/libpurple/prpl.h @@ -186,14 +186,12 @@ typedef enum /** * Indicates that slash commands are native to this protocol. * Used as a hint that unknown commands should not be sent as messages. - * @since 2.1.0 */ OPT_PROTO_SLASH_COMMANDS_NATIVE = 0x00000400, /** * Indicates that this protocol supports sending a user-supplied message * along with an invitation. - * @since 2.8.0 */ OPT_PROTO_INVITE_MESSAGE = 0x00000800 @@ -571,7 +569,6 @@ struct _PurplePluginProtocolInfo /** * Returns an array of "PurpleMood"s, with the last one having * "mood" set to @c NULL. - * @since 2.7.0 */ PurpleMood *(*get_moods)(PurpleAccount *account); @@ -591,7 +588,6 @@ struct _PurplePluginProtocolInfo * @param failure_cb Callback to be called if setting the public alias * fails * @see purple_account_set_public_alias - * @since 2.7.0 */ void (*set_public_alias)(PurpleConnection *gc, const char *alias, PurpleSetPublicAliasSuccessCallback success_cb, @@ -608,7 +604,6 @@ struct _PurplePluginProtocolInfo * @param failure_cb Callback to be called if the prpl is unable to * retrieve the alias * @see purple_account_get_public_alias - * @since 2.7.0 */ void (*get_public_alias)(PurpleConnection *gc, PurpleGetPublicAliasSuccessCallback success_cb, @@ -792,7 +787,6 @@ void purple_prpl_got_account_status(PurpleAccount *account, * @param account The account. * * @see account-actions-changed - * @since 2.6.0 */ void purple_prpl_got_account_actions(PurpleAccount *account); @@ -883,8 +877,6 @@ GList *purple_prpl_get_statuses(PurpleAccount *account, PurplePresence *presence * * Note that you can't send arbitrary PurpleAttentionType's, because there is * only a fixed set of attention commands. - * - * @since 2.5.0 */ void purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_code); @@ -895,8 +887,6 @@ void purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint typ * @param who Who requested your attention. * @param type_code An index into the prpl's attention_types list determining the type * of the attention request command to send. - * - * @since 2.5.0 */ void purple_prpl_got_attention(PurpleConnection *gc, const char *who, guint type_code); @@ -908,8 +898,6 @@ void purple_prpl_got_attention(PurpleConnection *gc, const char *who, guint type * @param who Who requested your attention. * @param type_code An index into the prpl's attention_types list determining the type * of the attention request command to send. - * - * @since 2.5.0 */ void purple_prpl_got_attention_in_chat(PurpleConnection *gc, int id, const char *who, guint type_code); @@ -944,7 +932,6 @@ gboolean purple_prpl_initiate_media(PurpleAccount *account, * * @param account The account the user is on. * @param who The name of the contact for which capabilities have been received. - * @since 2.7.0 */ void purple_prpl_got_media_caps(PurpleAccount *account, const char *who); diff --git a/libpurple/purple.h.in b/libpurple/purple.h.in index a96b2537ec..327bea0f9c 100644 --- a/libpurple/purple.h.in +++ b/libpurple/purple.h.in @@ -6,7 +6,6 @@ * include any other libpurple files. * * @ingroup core libpurple - * @since 2.3.0 */ /* purple diff --git a/libpurple/request.h b/libpurple/request.h index 8547087e26..009c32bedb 100644 --- a/libpurple/request.h +++ b/libpurple/request.h @@ -477,8 +477,6 @@ PurpleRequestFieldType purple_request_field_get_type(const PurpleRequestField *f * @param field The field. * * @return The UI data. - * - * @since 2.6.0 */ PurpleRequestFieldGroup *purple_request_field_get_group(const PurpleRequestField *field); @@ -542,8 +540,6 @@ gboolean purple_request_field_is_required(const PurpleRequestField *field); * @param field The field. * * @return The UI data. - * - * @since 2.6.0 */ gpointer purple_request_field_get_ui_data(const PurpleRequestField *field); @@ -554,8 +550,6 @@ gpointer purple_request_field_get_ui_data(const PurpleRequestField *field); * @param ui_data The UI data. * * @return The UI data. - * - * @since 2.6.0 */ void purple_request_field_set_ui_data(PurpleRequestField *field, gpointer ui_data); @@ -1336,8 +1330,7 @@ void *purple_request_action_varg(void *handle, const char *title, /** * Version of purple_request_action() supplying an image for the UI to - * optionally display as an icon in the dialog; see its documentation - * @since 2.7.0 + * optionally display as an icon in the dialog; see its documentation. */ void *purple_request_action_with_icon(void *handle, const char *title, const char *primary, const char *secondary, int default_action, @@ -1348,7 +1341,6 @@ void *purple_request_action_with_icon(void *handle, const char *title, /** * va_list version of purple_request_action_with_icon(); * see its documentation. - * @since 2.7.0 */ void *purple_request_action_with_icon_varg(void *handle, const char *title, const char *primary, const char *secondary, int default_action, diff --git a/libpurple/roomlist.h b/libpurple/roomlist.h index 9e21f818a9..b85933b76b 100644 --- a/libpurple/roomlist.h +++ b/libpurple/roomlist.h @@ -217,7 +217,6 @@ void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *c * * @param roomlist The roomlist, which must not be @c NULL. * @constreturn A list of fields - * @since 2.4.0 */ GList *purple_roomlist_get_fields(PurpleRoomlist *roomlist); @@ -299,7 +298,6 @@ void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room); * Get the type of a room. * @param room The room, which must not be @c NULL. * @return The type of the room. - * @since 2.4.0 */ PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room); @@ -307,7 +305,6 @@ PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room); * Get the name of a room. * @param room The room, which must not be @c NULL. * @return The name of the room. - * @since 2.4.0 */ const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room); @@ -315,7 +312,6 @@ const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room); * Get the parent of a room. * @param room The room, which must not be @c NULL. * @return The parent of the room, which can be @c NULL. - * @since 2.4.0 */ PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room); @@ -341,7 +337,6 @@ void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean e * * @param room The room, which must not be @c NULL. * @constreturn A list of fields - * @since 2.4.0 */ GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room); @@ -373,7 +368,6 @@ PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, * @param field A PurpleRoomlistField, which must not be @c NULL. * * @return The type of the field. - * @since 2.4.0 */ PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field); @@ -383,7 +377,6 @@ PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *fiel * @param field A PurpleRoomlistField, which must not be @c NULL. * * @return The label of the field. - * @since 2.4.0 */ const char * purple_roomlist_field_get_label(PurpleRoomlistField *field); @@ -392,7 +385,6 @@ const char * purple_roomlist_field_get_label(PurpleRoomlistField *field); * @param field A PurpleRoomlistField, which must not be @c NULL. * * @return @c TRUE if the field is hidden, @c FALSE otherwise. - * @since 2.4.0 */ gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field); diff --git a/libpurple/smiley.h b/libpurple/smiley.h index 73202bda47..9721c228da 100644 --- a/libpurple/smiley.h +++ b/libpurple/smiley.h @@ -1,7 +1,6 @@ /** * @file smiley.h Smiley API * @ingroup core - * @since 2.5.0 */ /* purple diff --git a/libpurple/sslconn.h b/libpurple/sslconn.h index 6889289dbd..bb176505df 100644 --- a/libpurple/sslconn.h +++ b/libpurple/sslconn.h @@ -203,7 +203,6 @@ PurpleSslConnection *purple_ssl_connect(PurpleAccount *account, const char *host * @param data User-defined data. * * @return The SSL connection handle. - * @since 2.6.0 */ PurpleSslConnection *purple_ssl_connect_with_ssl_cn(PurpleAccount *account, const char *host, int port, PurpleSslInputFunction func, @@ -222,8 +221,6 @@ PurpleSslConnection *purple_ssl_connect_with_ssl_cn(PurpleAccount *account, cons * @param data User-defined data. * * @return The SSL connection handle. - * - * @since 2.2.0 */ PurpleSslConnection *purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, PurpleSslInputFunction func, @@ -278,8 +275,6 @@ size_t purple_ssl_write(PurpleSslConnection *gsc, const void *buffer, size_t len * * @return The peer certificate chain, in the order of certificate, issuer, * issuer's issuer, etc. @a NULL if no certificates have been provided, - * - * @since 2.2.0 */ GList * purple_ssl_get_peer_certificates(PurpleSslConnection *gsc); diff --git a/libpurple/version.h.in b/libpurple/version.h.in index 6e13bb3748..a77ca0f252 100644 --- a/libpurple/version.h.in +++ b/libpurple/version.h.in @@ -56,8 +56,6 @@ const char *purple_version_check(guint required_major, guint required_minor, gui * The major version of the running libpurple. Contrast with * #PURPLE_MAJOR_VERSION, which expands at compile time to the major version of * libpurple being compiled against. - * - * @since 2.4.0 */ extern const guint purple_major_version; @@ -65,8 +63,6 @@ extern const guint purple_major_version; * The minor version of the running libpurple. Contrast with * #PURPLE_MINOR_VERSION, which expands at compile time to the minor version of * libpurple being compiled against. - * - * @since 2.4.0 */ extern const guint purple_minor_version; @@ -75,8 +71,6 @@ extern const guint purple_minor_version; * The micro version of the running libpurple. Contrast with * #PURPLE_MICRO_VERSION, which expands at compile time to the micro version of * libpurple being compiled against. - * - * @since 2.4.0 */ extern const guint purple_micro_version; diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index 8f22ef1fd8..37e79a4029 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -250,8 +250,6 @@ void pidgin_blist_add_alert(GtkWidget *widget); * Sets the current theme for Pidgin to use * * @param theme the new theme to use - * - * @since 2.6.0 */ void pidgin_blist_set_theme(PidginBlistTheme *theme); @@ -259,8 +257,6 @@ void pidgin_blist_set_theme(PidginBlistTheme *theme); * Gets Pidgin's current buddy list theme * * @returns the current theme - * - * @since 2.6.0 */ PidginBlistTheme *pidgin_blist_get_theme(void); @@ -382,8 +378,6 @@ void pidgin_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback ca * @param selected Whether this buddy is selected. If TRUE, the markup will not change the color. * @param aliased TRUE to return the appropriate alias of this buddy, FALSE to return its username and status information * @return The markup for this buddy - * - * @since 2.1.0 */ gchar *pidgin_blist_get_name_markup(PurpleBuddy *buddy, gboolean selected, gboolean aliased); @@ -395,15 +389,11 @@ gchar *pidgin_blist_get_name_markup(PurpleBuddy *buddy, gboolean selected, gbool * * @param node The buddy list node to show a tooltip for * @param widget The widget to draw the tooltip on - * - * @since 2.1.0 */ void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget); /** * Destroys the current (if any) Buddy List tooltip - * - * @since 2.1.0 */ void pidgin_blist_tooltip_destroy(void); diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index ce06c630c1..154da253be 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -51,7 +51,7 @@ enum { CHAT_USERS_FLAGS_COLUMN, CHAT_USERS_COLOR_COLUMN, CHAT_USERS_WEIGHT_COLUMN, - CHAT_USERS_ICON_STOCK_COLUMN, /** @since 2.6.0 */ + CHAT_USERS_ICON_STOCK_COLUMN, CHAT_USERS_COLUMNS }; @@ -144,8 +144,6 @@ struct _PidginConversation /** * Quick Find. - * - * @since 2.7.0 */ struct { GtkWidget *entry; @@ -233,8 +231,6 @@ void pidgin_conv_present_conversation(PurpleConversation *conv); * @param conv The conversation. * * @return Wheter Pidgin UI was successfully attached. - * - * @since 2.2.0 */ gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv); diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 75eeabeb61..8168692dfc 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -3979,8 +3979,6 @@ animate_image_cb(gpointer data) * @param id The id to associate with the image. * * @return A new IM/HTML Scalable object with an image. - * - * @since 2.1.0 */ /* * TODO: All this animation code could be combined much better with diff --git a/pidgin/gtkimhtml.h b/pidgin/gtkimhtml.h index 656d106d73..655b9f3233 100644 --- a/pidgin/gtkimhtml.h +++ b/pidgin/gtkimhtml.h @@ -58,9 +58,6 @@ typedef struct _GtkIMHtmlAnimation GtkIMHtmlAnimation; typedef struct _GtkIMHtmlHr GtkIMHtmlHr; typedef struct _GtkIMHtmlFuncs GtkIMHtmlFuncs; -/** - * @since 2.6.0 - */ typedef struct _GtkIMHtmlLink GtkIMHtmlLink; typedef enum { @@ -78,7 +75,7 @@ typedef enum { GTK_IMHTML_SMILEY = 1 << 11, GTK_IMHTML_LINKDESC = 1 << 12, GTK_IMHTML_STRIKE = 1 << 13, - /** Show custom smileys when appropriate. @since 2.5.0 */ + /** Show custom smileys when appropriate. */ GTK_IMHTML_CUSTOM_SMILEY = 1 << 14, GTK_IMHTML_ALL = -1 } GtkIMHtmlButtons; @@ -166,8 +163,8 @@ struct _GtkIMHtmlSmiley { GSList *anchors; GtkIMHtmlSmileyFlags flags; GtkIMHtml *imhtml; - gpointer data; /** @since 2.6.0 */ - gsize datasize; /** @since 2.6.0 */ + gpointer data; + gsize datasize; }; struct _GtkIMHtmlScalable { @@ -766,8 +763,6 @@ char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *st * * @param imhtml The GTK+ IM/HTML. * @param flags The connection flag which describes the allowed types of formatting. - * - * @since 2.1.0 */ void gtk_imhtml_setup_entry(GtkIMHtml *imhtml, PurpleConnectionFlags flags); @@ -780,7 +775,6 @@ void gtk_imhtml_setup_entry(GtkIMHtml *imhtml, PurpleConnectionFlags flags); * @param flags The smiley flags * * @return The newly created smiley - * @since 2.5.0 */ GtkIMHtmlSmiley *gtk_imhtml_smiley_create(const char *file, const char *shortcut, gboolean hide, GtkIMHtmlSmileyFlags flags); @@ -789,8 +783,6 @@ GtkIMHtmlSmiley *gtk_imhtml_smiley_create(const char *file, const char *shortcut * Reload the image data for the smiley. * * @param smiley The smiley to reload - * - * @since 2.5.0 */ void gtk_imhtml_smiley_reload(GtkIMHtmlSmiley *smiley); @@ -798,8 +790,6 @@ void gtk_imhtml_smiley_reload(GtkIMHtmlSmiley *smiley); * Destroy a GtkIMHtmlSmiley. * * @param smiley The smiley to destroy - * - * @since 2.5.0 */ void gtk_imhtml_smiley_destroy(GtkIMHtmlSmiley *smiley); @@ -818,8 +808,6 @@ void gtk_imhtml_smiley_destroy(GtkIMHtmlSmiley *smiley); * successfully, @c FALSE otherwise. * * @return @c TRUE if the protocol was successfully registered (or unregistered, when \a activate is @c NULL) - * - * @since 2.6.0 */ gboolean gtk_imhtml_class_register_protocol(const char *name, gboolean (*activate)(GtkIMHtml *imhtml, GtkIMHtmlLink *link), @@ -831,8 +819,6 @@ gboolean gtk_imhtml_class_register_protocol(const char *name, * @param link The GtkIMHtmlLink object sent to the callback functions * * @return The URL - * - * @since 2.6.0 */ const char *gtk_imhtml_link_get_url(GtkIMHtmlLink *link); @@ -842,8 +828,6 @@ const char *gtk_imhtml_link_get_url(GtkIMHtmlLink *link); * @param link The GtkIMHtmlLink object sent to the callback functions * * @return The GtkTextTag object, or @c NULL - * - * @since 2.6.0 */ const GtkTextTag *gtk_imhtml_link_get_text_tag(GtkIMHtmlLink *link); @@ -854,8 +838,6 @@ const GtkTextTag *gtk_imhtml_link_get_text_tag(GtkIMHtmlLink *link); * @param link The GtkIMHtmlLink object sent to the callback functions * * @return @c TRUE if 'url-clicked' signal was emitted, @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean gtk_imhtml_link_activate(GtkIMHtmlLink *link); diff --git a/pidgin/gtkimhtmltoolbar.h b/pidgin/gtkimhtmltoolbar.h index d31f46c22a..673fc0fcfe 100644 --- a/pidgin/gtkimhtmltoolbar.h +++ b/pidgin/gtkimhtmltoolbar.h @@ -90,9 +90,6 @@ GtkWidget* gtk_imhtmltoolbar_new (void); void gtk_imhtmltoolbar_attach (GtkIMHtmlToolbar *toolbar, GtkWidget *imhtml); void gtk_imhtmltoolbar_associate_smileys (GtkIMHtmlToolbar *toolbar, const char *proto_id); -/** - * @since 2.7.0 - */ void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, PurpleConversation *conv); diff --git a/pidgin/gtkprefs.h b/pidgin/gtkprefs.h index d07c968b8a..fc7119c7a4 100644 --- a/pidgin/gtkprefs.h +++ b/pidgin/gtkprefs.h @@ -92,8 +92,6 @@ GtkWidget *pidgin_prefs_labeled_entry(GtkWidget *page, const gchar *title, * @return An hbox containing both the label and the entry. Can be used to set * the widgets to sensitive or insensitive based on the value of a * checkbox. - * - * @since 2.6.0 */ GtkWidget *pidgin_prefs_labeled_password(GtkWidget *page, const gchar *title, const char *key, GtkSizeGroup *sg); diff --git a/pidgin/gtksmiley.c b/pidgin/gtksmiley.c index 558ac79fdd..a8819db89b 100644 --- a/pidgin/gtksmiley.c +++ b/pidgin/gtksmiley.c @@ -47,9 +47,9 @@ struct _PidginSmiley GtkWidget *smiley_image; gchar *filename; GdkPixbuf *custom_pixbuf; - gpointer data; /** @since 2.6.0 */ - gsize datasize; /** @since 2.6.0 */ - gint entry_len; /** @since 2.6.0 */ + gpointer data; + gsize datasize; + gint entry_len; }; typedef struct diff --git a/pidgin/gtksmiley.h b/pidgin/gtksmiley.h index 8cf62a8add..fb65227db1 100644 --- a/pidgin/gtksmiley.h +++ b/pidgin/gtksmiley.h @@ -1,7 +1,6 @@ /** * @file gtksmiley.h GTK+ Custom Smiley API * @ingroup pidgin - * @since 2.5.0 */ /* pidgin @@ -106,8 +105,6 @@ void pidgin_smiley_editor_set_image(PidginSmiley *editor, GdkPixbuf *image); * @param editor A smiley editor dialog * @param data A pointer to smiley's data * @param datasize The size of smiley's data - * - * @since 2.6.0 */ void pidgin_smiley_editor_set_data(PidginSmiley *editor, gpointer data, gsize datasize); diff --git a/pidgin/gtksound.h b/pidgin/gtksound.h index f55713907e..872b865f51 100644 --- a/pidgin/gtksound.h +++ b/pidgin/gtksound.h @@ -67,8 +67,6 @@ void *pidgin_sound_get_handle(void); * Returns true Pidgin is using customized sounds * * @return TRUE if non default sounds are used. - * - * @since 2.6.0 */ gboolean pidgin_sound_is_customized(void); diff --git a/pidgin/gtkthemes.h b/pidgin/gtkthemes.h index 8cf4b1dff7..7d739f8e1b 100644 --- a/pidgin/gtkthemes.h +++ b/pidgin/gtkthemes.h @@ -52,18 +52,12 @@ gboolean pidgin_themes_smileys_disabled(void); void pidgin_themes_smiley_themeize(GtkWidget *); -/** - * @since 2.5.0 - */ void pidgin_themes_smiley_themeize_custom(GtkWidget *); void pidgin_themes_smiley_theme_probe(void); void pidgin_themes_load_smiley_theme(const char *file, gboolean load); -/** - * @since 2.1.0 - */ void pidgin_themes_remove_smiley_theme(const char *file); GSList *pidgin_themes_get_proto_smileys(const char *id); diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h index 49cd38549f..84456a7ad7 100644 --- a/pidgin/gtkutils.h +++ b/pidgin/gtkutils.h @@ -137,7 +137,6 @@ GtkWidget *pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, Gtk * @param image A button image. * * @return A GtkButton created from the image. - * @since 2.7.0 */ GtkWidget *pidgin_create_small_button(GtkWidget *image); @@ -148,8 +147,6 @@ GtkWidget *pidgin_create_small_button(GtkWidget *image); * @param border_width The window's desired border width * @param role A string indicating what the window is responsible for doing, or @c NULL * @param resizable Whether the window should be resizable (@c TRUE) or not (@c FALSE) - * - * @since 2.1.0 */ GtkWidget *pidgin_create_window(const char *title, guint border_width, const char *role, gboolean resizable); @@ -160,8 +157,6 @@ GtkWidget *pidgin_create_window(const char *title, guint border_width, const cha * @param border_width The window's desired border width * @param role A string indicating what the window is responsible for doing, or @c NULL * @param resizable Whether the window should be resizable (@c TRUE) or not (@c FALSE) - * - * @since 2.4.0 */ GtkWidget *pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable); @@ -171,8 +166,6 @@ GtkWidget *pidgin_create_dialog(const char *title, guint border_width, const cha * @param dialog The dialog window * @param homogeneous TRUE if all children are to be given equal space allotments. * @param spacing the number of pixels to place by default between children - * - * @since 2.4.0 */ GtkWidget *pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing); @@ -180,8 +173,6 @@ GtkWidget *pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean ho * Retrieves the main content box (vbox) from a pidgin dialog window * * @param dialog The dialog window - * - * @since 2.4.0 */ GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog); @@ -194,7 +185,6 @@ GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog); * @param callbackdata The user data for the callback function * * @return The created button. - * @since 2.4.0 */ GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label, GCallback callback, gpointer callbackdata); @@ -203,8 +193,6 @@ GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label, * Retrieves the action area (button box) from a pidgin dialog window * * @param dialog The dialog window - * - * @since 2.4.0 */ GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog); @@ -438,8 +426,6 @@ void pidgin_load_accels(void); * * @param conn The connection to get information from. * @param name The user to get information about. - * - * @since 2.1.0 */ void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name); @@ -449,8 +435,6 @@ void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name); * @param conn The connection to get information from. * @param name The user to get information about. * @param chatid The chat id. - * - * @since 2.1.0 */ void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, int chatid); @@ -489,8 +473,6 @@ void pidgin_set_accessible_label(GtkWidget *w, GtkWidget *l); * * @param w The widget that we want to label. * @param l A GtkLabel that we want to use as the label for the widget. - * - * @since 2.2.0 */ void pidgin_set_accessible_relations(GtkWidget *w, GtkWidget *l); @@ -505,8 +487,6 @@ void pidgin_set_accessible_relations(GtkWidget *w, GtkWidget *l); * where the menu shall be drawn. This is an output parameter. * @param push_in This is an output parameter? * @param data Not used by this particular position function. - * - * @since 2.1.0 */ void pidgin_menu_position_func_helper(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data); @@ -578,8 +558,6 @@ GdkPixbuf * pidgin_create_status_icon(PurpleStatusPrimitive primitive, GtkWidget * @param prim The status primitive * * @return The stock-id - * - * @since 2.6.0 */ const char *pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim); @@ -589,8 +567,6 @@ const char *pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim); * @param presence The presence. * * @return The stock-id - * - * @since 2.6.0 */ const char *pidgin_stock_id_from_presence(PurplePresence *presence); @@ -758,8 +734,6 @@ const char *pidgin_get_dim_grey_string(GtkWidget *widget); * * @return A newly created text GtkComboBox containing a GtkEntry * child. - * - * @since 2.2.0 */ GtkWidget *pidgin_text_combo_box_entry_new(const char *default_item, GList *items); @@ -769,8 +743,6 @@ GtkWidget *pidgin_text_combo_box_entry_new(const char *default_item, GList *item * @param widget The simple text GtkComboBoxEntry equivalent widget * * @return The text in the widget's entry. It must not be freed - * - * @since 2.2.0 */ const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget); @@ -779,8 +751,6 @@ const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget); * * @param widget The simple text GtkComboBoxEntry equivalent widget * @param text The text to set - * - * @since 2.2.0 */ void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text); @@ -790,8 +760,6 @@ void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text); * @param window The window to make transient. * * @return Whether the window was made transient or not. - * - * @since 2.4.0 */ gboolean pidgin_auto_parent_window(GtkWidget *window); @@ -806,7 +774,6 @@ gboolean pidgin_auto_parent_window(GtkWidget *window); * @param p_label Place to store a pointer to the GtkLabel, or @c NULL if you don't care. * * @return A GtkHBox already added to the GtkVBox containing the GtkLabel and the GtkWidget. - * @since 2.4.0 */ GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label); @@ -818,8 +785,6 @@ GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, Gtk * * @return A GdkPixbuf created from the image data, or NULL if * there was an error parsing the data. - * - * @since 2.9.0 */ GdkPixbuf *pidgin_pixbuf_from_data(const guchar *buf, gsize count); @@ -831,8 +796,6 @@ GdkPixbuf *pidgin_pixbuf_from_data(const guchar *buf, gsize count); * * @return A GdkPixbufAnimation created from the image data, or NULL if * there was an error parsing the data. - * - * @since 2.9.0 */ GdkPixbufAnimation *pidgin_pixbuf_anim_from_data(const guchar *buf, gsize count); @@ -842,8 +805,6 @@ GdkPixbufAnimation *pidgin_pixbuf_anim_from_data(const guchar *buf, gsize count) * @param image A PurpleStoredImage. * * @return A GdkPixbuf created from the stored image. - * - * @since 2.5.0 */ GdkPixbuf *pidgin_pixbuf_from_imgstore(PurpleStoredImage *image); @@ -867,8 +828,6 @@ GdkPixbuf *pidgin_pixbuf_from_imgstore(PurpleStoredImage *image); * * @return The GdkPixbuf if successful. Otherwise NULL is returned and * a warning is logged. - * - * @since 2.9.0 */ GdkPixbuf *pidgin_pixbuf_new_from_file(const char *filename); @@ -894,8 +853,6 @@ GdkPixbuf *pidgin_pixbuf_new_from_file(const char *filename); * * @return The GdkPixbuf if successful. Otherwise NULL is returned and * a warning is logged. - * - * @since 2.9.0 */ GdkPixbuf *pidgin_pixbuf_new_from_file_at_size(const char *filename, int width, int height); @@ -922,8 +879,6 @@ GdkPixbuf *pidgin_pixbuf_new_from_file_at_size(const char *filename, int width, * * @return The GdkPixbuf if successful. Otherwise NULL is returned and * a warning is logged. - * - * @since 2.9.0 */ GdkPixbuf *pidgin_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, gboolean preserve_aspect_ratio); @@ -935,22 +890,16 @@ GdkPixbuf *pidgin_pixbuf_new_from_file_at_scale(const char *filename, int width, * @param shadow_type Shadow type * @param width Desired widget width, or -1 for default * @param height Desired widget height, or -1 for default - * - * @since 2.8.0 */ GtkWidget *pidgin_make_scrollable(GtkWidget *child, GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, GtkShadowType shadow_type, int width, int height); /** * Initialize some utility functions. - * - * @since 2.6.0 */ void pidgin_utils_init(void); /** * Uninitialize some utility functions. - * - * @since 2.6.0 */ void pidgin_utils_uninit(void); diff --git a/pidgin/pidgintooltip.h b/pidgin/pidgintooltip.h index 889232341e..0d6519bcf9 100644 --- a/pidgin/pidgintooltip.h +++ b/pidgin/pidgintooltip.h @@ -36,7 +36,6 @@ * @param h The value of this should be set to the desired height of the tooltip window. * * @return @c TRUE if the tooltip was created correctly, @c FALSE otherwise. - * @since 2.4.0 */ typedef gboolean (*PidginTooltipCreateForTree)(GtkWidget *tipwindow, GtkTreePath *path, gpointer userdata, int *w, int *h); @@ -48,7 +47,6 @@ typedef gboolean (*PidginTooltipCreateForTree)(GtkWidget *tipwindow, * @param h The value of this should be set to the desired height of the tooltip window. * * @return @c TRUE if the tooltip was created correctly, @c FALSE otherwise. - * @since 2.4.0 */ typedef gboolean (*PidginTooltipCreate)(GtkWidget *tipwindow, gpointer userdata, int *w, int *h); @@ -58,7 +56,6 @@ typedef gboolean (*PidginTooltipCreate)(GtkWidget *tipwindow, * @param userdata The userdata set during pidgin_tooltip_setup_for_treeview or pidgin_tooltip_show. * * @return @c TRUE if the tooltip was painted correctly, @c FALSE otherwise. - * @since 2.4.0 */ typedef gboolean (*PidginTooltipPaint)(GtkWidget *tipwindow, gpointer userdata); @@ -71,7 +68,6 @@ typedef gboolean (*PidginTooltipPaint)(GtkWidget *tipwindow, gpointer userdata); * @param paint_cb Callback function to paint the tooltip * * @return @c TRUE if the tooltip callbacks were setup correctly. - * @since 2.4.0 */ gboolean pidgin_tooltip_setup_for_treeview(GtkWidget *tree, gpointer userdata, PidginTooltipCreateForTree create_cb, PidginTooltipPaint paint_cb); @@ -85,14 +81,12 @@ gboolean pidgin_tooltip_setup_for_treeview(GtkWidget *tree, gpointer userdata, * @param paint_cb Callback function to paint the tooltip * * @return @c TRUE if the tooltip callbacks were setup correctly. - * @since 2.4.0 */ gboolean pidgin_tooltip_setup_for_widget(GtkWidget *widget, gpointer userdata, PidginTooltipCreate create_cb, PidginTooltipPaint paint_cb); /** * Destroy the tooltip. - * @since 2.4.0 */ void pidgin_tooltip_destroy(void); @@ -103,8 +97,6 @@ void pidgin_tooltip_destroy(void); * @param userdata The userdata to send to the callback functions * @param create_cb Callback function to create the tooltip from the GtkTreePath * @param paint_cb Callback function to paint the tooltip - * - * @since 2.4.0 */ void pidgin_tooltip_show(GtkWidget *widget, gpointer userdata, PidginTooltipCreate create_cb, PidginTooltipPaint paint_cb); -- cgit v1.2.1 From f93f567761ecfe56b073b07560ff71974e3cd89a Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 25 Sep 2011 19:09:01 +0000 Subject: Remove obsolete preference "/purple/debug/timestamps". --- libpurple/debug.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libpurple/debug.c b/libpurple/debug.c index ca17f62bde..095d90bb49 100644 --- a/libpurple/debug.c +++ b/libpurple/debug.c @@ -224,12 +224,5 @@ purple_debug_init(void) purple_debug_set_verbose(TRUE); purple_prefs_add_none("/purple/debug"); - - /* - * This pref is obsolete and no longer referenced anywhere. It only - * survives here because it would be an API break if we removed it. - * Remove this when we get to 3.0.0 :) - */ - purple_prefs_add_bool("/purple/debug/timestamps", TRUE); } -- cgit v1.2.1 From 271340fe4fec40607fa0c0318de84f181ced17b2 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 25 Sep 2011 19:15:05 +0000 Subject: purple_xfer_is_canceled() renamed to purple_xfer_is_cancelled() --- ChangeLog.API | 1 + finch/gntft.c | 6 +++--- libpurple/ft.c | 3 +-- libpurple/ft.h | 3 +-- libpurple/plugins/perl/common/FT.xs | 2 +- pidgin/gtkft.c | 6 +++--- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 0555a3c8ed..2ecbcd3b52 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -77,6 +77,7 @@ version 3.0.0 (??/??/????): the first parameter * purple_util_fetch_url_request_len renamed to purple_util_fetch_url_request * purple_util_fetch_url_len renamed to purple_util_fetch_url + * purple_xfer_is_canceled renamed to purple_xfer_is_cancelled * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter diff --git a/finch/gntft.c b/finch/gntft.c index 40e8516852..95c806bbeb 100644 --- a/finch/gntft.c +++ b/finch/gntft.c @@ -149,7 +149,7 @@ toggle_clear_finished_cb(GntWidget *w) while (iter) { PurpleXfer *xfer = iter->data; iter = iter->next; - if (purple_xfer_is_completed(xfer) || purple_xfer_is_canceled(xfer)) + if (purple_xfer_is_completed(xfer) || purple_xfer_is_cancelled(xfer)) finch_xfer_dialog_remove_xfer(xfer); } } @@ -160,7 +160,7 @@ remove_button_cb(GntButton *button) { PurpleXfer *selected_xfer = gnt_tree_get_selection_data(GNT_TREE(xfer_dialog->tree)); if (selected_xfer && (purple_xfer_is_completed(selected_xfer) || - purple_xfer_is_canceled(selected_xfer))) { + purple_xfer_is_cancelled(selected_xfer))) { finch_xfer_dialog_remove_xfer(selected_xfer); } } @@ -382,7 +382,7 @@ finch_xfer_dialog_cancel_xfer(PurpleXfer *xfer) update_title_progress(); - if (purple_xfer_is_canceled(xfer)) + if (purple_xfer_is_cancelled(xfer)) status = _("Cancelled"); else status = _("Failed"); diff --git a/libpurple/ft.c b/libpurple/ft.c index 405eee771c..1b3c5dc456 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -765,9 +765,8 @@ purple_xfer_get_status(const PurpleXfer *xfer) return xfer->status; } -/* FIXME: Rename with cancelled for 3.0.0. */ gboolean -purple_xfer_is_canceled(const PurpleXfer *xfer) +purple_xfer_is_cancelled(const PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, TRUE); diff --git a/libpurple/ft.h b/libpurple/ft.h index bd85589de0..b8a1c665b2 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -321,9 +321,8 @@ PurpleXferStatusType purple_xfer_get_status(const PurpleXfer *xfer); * @param xfer The file transfer. * * @return Whether or not the transfer was cancelled. - * FIXME: This should be renamed using cancelled for 3.0.0. */ -gboolean purple_xfer_is_canceled(const PurpleXfer *xfer); +gboolean purple_xfer_is_cancelled(const PurpleXfer *xfer); /** * Returns the completed state for a file transfer. diff --git a/libpurple/plugins/perl/common/FT.xs b/libpurple/plugins/perl/common/FT.xs index 58d1985a72..eca4cfa04e 100644 --- a/libpurple/plugins/perl/common/FT.xs +++ b/libpurple/plugins/perl/common/FT.xs @@ -113,7 +113,7 @@ purple_xfer_get_type(xfer) Purple::Xfer xfer gboolean -purple_xfer_is_canceled(xfer) +purple_xfer_is_cancelled(xfer) Purple::Xfer xfer gboolean diff --git a/pidgin/gtkft.c b/pidgin/gtkft.c index b0194115cb..793988e0a1 100644 --- a/pidgin/gtkft.c +++ b/pidgin/gtkft.c @@ -155,7 +155,7 @@ get_xfer_info_strings(PurpleXfer *xfer, char **kbsec, char **time_elapsed, if (purple_xfer_is_completed(xfer)) { *time_remaining = g_strdup(_("Finished")); } - else if (purple_xfer_is_canceled(xfer)) { + else if (purple_xfer_is_cancelled(xfer)) { *time_remaining = g_strdup(_("Cancelled")); } else if (purple_xfer_get_size(xfer) == 0 || (kb_sent > 0 && kbps == 0)) { @@ -357,7 +357,7 @@ update_buttons(PidginXferDialog *dialog, PurpleXfer *xfer) #endif gtk_widget_set_sensitive(dialog->remove_button, TRUE); - } else if (purple_xfer_is_canceled(xfer)) { + } else if (purple_xfer_is_cancelled(xfer)) { gtk_widget_hide(dialog->stop_button); gtk_widget_show(dialog->remove_button); @@ -979,7 +979,7 @@ pidgin_xfer_dialog_cancel_xfer(PidginXferDialog *dialog, PIDGIN_STOCK_FILE_CANCELED, GTK_ICON_SIZE_MENU, NULL); - if (purple_xfer_is_canceled(xfer)) + if (purple_xfer_is_cancelled(xfer)) status = _("Cancelled"); else status = _("Failed"); -- cgit v1.2.1 From 33ca886f4c8fb1422d9d015736ad730b3a5fa498 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 25 Sep 2011 19:28:12 +0000 Subject: Remove the special case of fd=0 in purple_xfer_start(). All the included protocol prpl's seem to do the right thing. --- libpurple/ft.c | 7 ------- libpurple/ft.h | 7 ++----- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/libpurple/ft.c b/libpurple/ft.c index 1b3c5dc456..2f18d14566 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -1439,13 +1439,6 @@ purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip, purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_STARTED); - /* - * FIXME 3.0.0 -- there's too much broken code depending on fd == 0 - * meaning "don't use a real fd" - */ - if (fd == 0) - fd = -1; - if (type == PURPLE_XFER_RECEIVE) { cond = PURPLE_INPUT_READ; diff --git a/libpurple/ft.h b/libpurple/ft.h index b8a1c665b2..d8819109e2 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -637,11 +637,8 @@ gssize purple_xfer_write(PurpleXfer *xfer, const guchar *buffer, gsize size); * file receive transfer. On send, @a fd must be specified, and * @a ip and @a port are ignored. * - * Prior to libpurple 2.6.0, passing '0' to @a fd was special-cased to - * allow the protocol plugin to facilitate the file transfer itself. As of - * 2.6.0, this is supported (for backward compatibility), but will be - * removed in libpurple 3.0.0. If a prpl detects that the running libpurple - * is running 2.6.0 or higher, it should use the invalid fd '-1'. + * Passing @a fd as '-1' is a special-case and indicates to the + * protocol plugin to facilitate the file transfer itself. * * @param xfer The file transfer. * @param fd The file descriptor for the socket. -- cgit v1.2.1 From cceed951efe3381645023fe815452f6843d79a93 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Sep 2011 04:57:10 +0000 Subject: Correct API Changelog for renamed entries. --- ChangeLog.API | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 2ecbcd3b52..ea794b6d88 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -57,14 +57,19 @@ version 3.0.0 (??/??/????): parameter * purple_account_add_buddies now takes an invite message as the last parameter - * purple_certificate_check_signature_chain_with_failing renamed - to purple_certificate_check_signature_chain + * purple_certificate_check_signature_chain now returns a list of failing + PurpleCertificate*s as the second parameter * purple_connection_error now takes a PurpleConnectionError as the second parameter * purple_dnsquery_a now takes a PurpleAccount as the first parameter - * purple_network_listen_family renamed to purple_network_listen - * purple_network_listen_range_family renamed to - purple_network_listen_range + * purple_network_listen now takes the protocol family as the second + parameter + * purple_network_listen now takes a boolean indicating external port + mapping as the fourth parameter + * purple_network_listen_range now takes a boolean indicating external + port mapping as the fifth parameter + * purple_network_listen_range now takes the protocol family as the + third parameter * purple_notify_user_info_add_pair renamed to purple_notify_user_info_add_pair_html * purple_notify_user_info_get_entries returns a GQueue instead of @@ -73,10 +78,11 @@ version 3.0.0 (??/??/????): purple_notify_user_info_prepend_pair_html * purple_srv_resolve now takes a PurpleAccount as the first parameter * purple_txt_resolve now takes a PurpleAccount as the first parameter - * purple_util_fetch_url_request_len now takes a PurpleAccount as + * purple_util_fetch_url_request now takes a PurpleAccount as the first parameter - * purple_util_fetch_url_request_len renamed to purple_util_fetch_url_request - * purple_util_fetch_url_len renamed to purple_util_fetch_url + * purple_util_fetch_url_request now takes a length as the eighth + parameter + * purple_util_fetch_url_len now takes a length as the fifth parameter * purple_xfer_is_canceled renamed to purple_xfer_is_cancelled * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter @@ -123,6 +129,8 @@ version 3.0.0 (??/??/????): * purple_buddy_icons_has_custom_icon * purple_buddy_icons_find_custom_icon * purple_buddy_icons_set_custom_icon + * purple_certificate_check_signature_chain_with_failing. Use + purple_certificate_check_signature_chain, instead * purple_connection_error_reason * purple_connection_new * purple_connection_new_unregister @@ -131,7 +139,10 @@ version 3.0.0 (??/??/????): * purple_conv_chat_set_users * purple_core_migrate * purple_dnsquery_a_account + * purple_network_listen_family. Use purple_network_listen, instead. * purple_network_listen_map_external + * purple_network_listen_range_family. Use purple_network_listen, + instead. * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count @@ -161,8 +172,11 @@ version 3.0.0 (??/??/????): * purple_strlcpy * purple_txt_cancel * purple_txt_resolve_account + * purple_util_fetch_url_len. Use purple_util_fetch_url, instead. + * purple_util_fetch_url_request_len. Use purple_util_fetch_url_request, + instead. * purple_util_fetch_url_request_len_with_account. Use - purple_util_fetch_url_request_len, instead. + purple_util_fetch_url_request, instead. * PurpleConnectionUiOps.report_disconnect_reason * PurplePluginProtocolInfo.add_buddy_with_invite * PurplePluginProtocolInfo.add_buddies_with_invite -- cgit v1.2.1 From 85cf2785bbda81f026319e53150cd99e530c4900 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Sep 2011 05:03:40 +0000 Subject: Correct Perl API for purple_util_fetch_url. --- libpurple/plugins/perl/common/Util.xs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libpurple/plugins/perl/common/Util.xs b/libpurple/plugins/perl/common/Util.xs index 6f2cb9b561..7426c9b458 100644 --- a/libpurple/plugins/perl/common/Util.xs +++ b/libpurple/plugins/perl/common/Util.xs @@ -462,12 +462,13 @@ PROTOTYPES: ENABLE #XXX: expand... void -purple_util_fetch_url(plugin, url, full, user_agent, http11, cb) +purple_util_fetch_url(plugin, url, full, user_agent, http11, max_len, cb) Purple::Plugin plugin const char *url gboolean full const char *user_agent gboolean http11 + gssize max_len SV * cb PREINIT: PurpleUtilFetchUrlData *data; @@ -476,7 +477,7 @@ PPCODE: SV *sv = purple_perl_sv_from_fun(plugin, cb); if (sv != NULL) { - data = purple_util_fetch_url(url, full, user_agent, http11, + data = purple_util_fetch_url(url, full, user_agent, http11, max_len, purple_perl_util_url_cb, sv); XPUSHs(sv_2mortal(purple_perl_bless_object(data, "Purple::Util::FetchUrlData"))); } else { -- cgit v1.2.1 From 378d7d0326ea25829de6c7f28b49d43e286b1f6c Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 11:02:15 +0000 Subject: Use purple_conv_chat_get_nick() rather than accessing chat->nick directly. --- finch/gntsound.c | 4 ++-- finch/plugins/gntgf.c | 2 +- pidgin/gtkconv.c | 6 +++--- pidgin/gtksound.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/finch/gntsound.c b/finch/gntsound.c index 296fee1ef3..3a5deb99d0 100644 --- a/finch/gntsound.c +++ b/finch/gntsound.c @@ -150,7 +150,7 @@ chat_nick_matches_name(PurpleConversation *conv, const char *aname) return ret; account = purple_conversation_get_account(conv); - nick = g_strdup(purple_normalize(account, chat->nick)); + nick = g_strdup(purple_normalize(account, purple_conv_chat_get_nick(chat))); name = g_strdup(purple_normalize(account, aname)); if (g_utf8_collate(nick, name) == 0) @@ -268,7 +268,7 @@ chat_msg_received_cb(PurpleAccount *account, char *sender, if (chat_nick_matches_name(conv, sender)) return; - if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, chat->nick)) + if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, purple_conv_chat_get_nick(chat))) play_conv_event(conv, PURPLE_SOUND_CHAT_NICK); else play_conv_event(conv, event); diff --git a/finch/plugins/gntgf.c b/finch/plugins/gntgf.c index 7e23a22d2a..925c24834d 100644 --- a/finch/plugins/gntgf.c +++ b/finch/plugins/gntgf.c @@ -256,7 +256,7 @@ received_chat_msg(PurpleAccount *account, const char *sender, const char *msg, if (flags & PURPLE_MESSAGE_WHISPER) return; - nick = PURPLE_CONV_CHAT(conv)->nick; + nick = purple_conv_chat_get_nick(PURPLE_CONV_CHAT(conv)); if (g_utf8_collate(sender, nick) == 0) return; diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 4ae12d138f..9b64b465ad 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1657,7 +1657,7 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc if (menu) gtk_widget_destroy(menu); - if (!strcmp(chat->nick, purple_normalize(conv->account, who))) + if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(conv->account, who))) is_me = TRUE; menu = gtk_menu_new(); @@ -4070,7 +4070,7 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c stock = get_chat_buddy_status_icon(chat, name, flags); - if (!strcmp(chat->nick, purple_normalize(conv->account, old_name != NULL ? old_name : name))) + if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(conv->account, old_name != NULL ? old_name : name))) is_me = TRUE; is_buddy = cb->buddy; @@ -4474,7 +4474,7 @@ update_chat_alias(PurpleBuddy *buddy, PurpleConversation *conv, PurpleConnection char *alias_key = NULL; PurpleBuddy *buddy2; - if (strcmp(chat->nick, purple_normalize(conv->account, name))) { + if (strcmp(purple_conv_chat_get_nick(chat), purple_normalize(conv->account, name))) { /* This user is not me, so look into updating the alias. */ if ((buddy2 = purple_find_buddy(conv->account, name)) != NULL) { diff --git a/pidgin/gtksound.c b/pidgin/gtksound.c index e8e96d5de9..ad26ee054c 100644 --- a/pidgin/gtksound.c +++ b/pidgin/gtksound.c @@ -96,7 +96,7 @@ chat_nick_matches_name(PurpleConversation *conv, const char *aname) if (chat==NULL) return ret; - nick = g_strdup(purple_normalize(conv->account, chat->nick)); + nick = g_strdup(purple_normalize(conv->account, purple_conv_chat_get_nick(chat))); name = g_strdup(purple_normalize(conv->account, aname)); if (g_utf8_collate(nick, name) == 0) @@ -212,7 +212,7 @@ chat_msg_received_cb(PurpleAccount *account, char *sender, if (chat_nick_matches_name(conv, sender)) return; - if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, chat->nick)) + if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, purple_conv_chat_get_nick(chat))) /* This isn't quite right; if you have the PURPLE_SOUND_CHAT_NICK event disabled * and the PURPLE_SOUND_CHAT_SAY event enabled, you won't get a sound at all */ play_conv_event(conv, PURPLE_SOUND_CHAT_NICK); -- cgit v1.2.1 From 28d8148c58d58128c44be35a19c64ffd80dc49a3 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 11:29:43 +0000 Subject: Hide struct _PurpleConvChat. --- ChangeLog.API | 1 + libpurple/conversation.c | 20 ++++++++++++++++++++ libpurple/conversation.h | 20 -------------------- libpurple/protocols/zephyr/zephyr.c | 3 +-- pidgin/gtkconv.c | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index ea794b6d88..d8dd311ff5 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -187,6 +187,7 @@ version 3.0.0 (??/??/????): * struct _PidginChatPane * struct _PidginImPane * struct _PurpleAttentionType + * struct _PurpleConvChat * struct _PurpleMenuAction * struct _PurplePounce * struct _PurpleProxyInfo diff --git a/libpurple/conversation.c b/libpurple/conversation.c index f0131a7a80..63d3586c6e 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -35,6 +35,26 @@ #define SEND_TYPED_TIMEOUT_SECONDS 5 +/** + * Data specific to Chats. + */ +struct _PurpleConvChat +{ + PurpleConversation *conv; /**< The parent conversation. */ + + GList *in_room; /**< The users in the room. + * @deprecated Will be removed in 3.0.0 + */ + GList *ignored; /**< Ignored users. */ + char *who; /**< The person who set the topic. */ + char *topic; /**< The topic. */ + int id; /**< The chat ID. */ + char *nick; /**< Your nick in this chat. */ + + gboolean left; /**< We left the chat and kept the window open */ + GHashTable *users; /**< Hash table of the users in the room. */ +}; + static GList *conversations = NULL; static GList *ims = NULL; static GList *chats = NULL; diff --git a/libpurple/conversation.h b/libpurple/conversation.h index 71848cca0c..175ca880a9 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -264,26 +264,6 @@ struct _PurpleConvIm PurpleBuddyIcon *icon; /**< The buddy icon. */ }; -/** - * Data specific to Chats. - */ -struct _PurpleConvChat -{ - PurpleConversation *conv; /**< The parent conversation. */ - - GList *in_room; /**< The users in the room. - * @deprecated Will be removed in 3.0.0 - */ - GList *ignored; /**< Ignored users. */ - char *who; /**< The person who set the topic. */ - char *topic; /**< The topic. */ - int id; /**< The chat ID. */ - char *nick; /**< Your nick in this chat. */ - - gboolean left; /**< We left the chat and kept the window open */ - GHashTable *users; /**< Hash table of the users in the room. */ -}; - /** * Data for "Chat Buddies" */ diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index afbc6975fc..634e03ea40 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -2622,9 +2622,8 @@ static PurpleCmdRet zephyr_purple_cmd_instance(PurpleConversation *conv, * one word isn't ideal either. */ PurpleConvChat *gcc = purple_conversation_get_chat_data(conv); - int id = gcc->id; const char* instance = args[0]; - zephyr_chat_set_topic(purple_conversation_get_gc(conv),id,instance); + zephyr_chat_set_topic(purple_conversation_get_gc(conv),purple_conv_chat_get_id(gcc),instance); return PURPLE_CMD_RET_OK; } diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 9b64b465ad..ef5b1f4145 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -8185,7 +8185,7 @@ gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv) if (conv->type == PURPLE_CONV_TYPE_CHAT) { pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC); - pidgin_conv_chat_add_users(conv, PURPLE_CONV_CHAT(conv)->in_room, TRUE); + pidgin_conv_chat_add_users(conv, purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv)), TRUE); } return TRUE; -- cgit v1.2.1 From 5dc741b2426be22becf7f1726a60c5853b61a640 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 11:35:15 +0000 Subject: Hide struct _PurpleConvIm. --- ChangeLog.API | 1 + libpurple/conversation.c | 15 +++++++++++++++ libpurple/conversation.h | 15 --------------- libpurple/server.c | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index d8dd311ff5..e948d1b29c 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -188,6 +188,7 @@ version 3.0.0 (??/??/????): * struct _PidginImPane * struct _PurpleAttentionType * struct _PurpleConvChat + * struct _PurpleConvIm * struct _PurpleMenuAction * struct _PurplePounce * struct _PurpleProxyInfo diff --git a/libpurple/conversation.c b/libpurple/conversation.c index 63d3586c6e..afdda2148d 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -55,6 +55,21 @@ struct _PurpleConvChat GHashTable *users; /**< Hash table of the users in the room. */ }; +/** + * Data specific to Instant Messages. + */ +struct _PurpleConvIm +{ + PurpleConversation *conv; /**< The parent conversation. */ + + PurpleTypingState typing_state; /**< The current typing state. */ + guint typing_timeout; /**< The typing timer handle. */ + time_t type_again; /**< The type again time. */ + guint send_typed_timeout; /**< The type again timer handle. */ + + PurpleBuddyIcon *icon; /**< The buddy icon. */ +}; + static GList *conversations = NULL; static GList *ims = NULL; static GList *chats = NULL; diff --git a/libpurple/conversation.h b/libpurple/conversation.h index 175ca880a9..1fbe04f500 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -249,21 +249,6 @@ struct _PurpleConversationUiOps void (*_purple_reserved4)(void); }; -/** - * Data specific to Instant Messages. - */ -struct _PurpleConvIm -{ - PurpleConversation *conv; /**< The parent conversation. */ - - PurpleTypingState typing_state; /**< The current typing state. */ - guint typing_timeout; /**< The typing timer handle. */ - time_t type_again; /**< The type again time. */ - guint send_typed_timeout; /**< The type again timer handle. */ - - PurpleBuddyIcon *icon; /**< The buddy icon. */ -}; - /** * Data for "Chat Buddies" */ diff --git a/libpurple/server.c b/libpurple/server.c index 22f41700af..f4ab43140c 100644 --- a/libpurple/server.c +++ b/libpurple/server.c @@ -725,7 +725,7 @@ void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { { im = PURPLE_CONV_IM(conv); - if (im->typing_state == PURPLE_NOT_TYPING) + if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) return; purple_conv_im_stop_typing_timeout(im); -- cgit v1.2.1 From 7e42d67c900700879c6fda79471cc94bd71c3b31 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 13:03:38 +0000 Subject: Hide struct _PurpleConvChatBuddy. Add accessor methods: * purple_conv_chat_cb_get_alias * purple_conv_chat_cb_get_flags * purple_conv_chat_cb_is_buddy * purple_conv_chat_cb_get_ui_data * purple_conv_chat_cb_set_ui_data --- ChangeLog.API | 6 +++ finch/gntconv.c | 18 ++++----- libpurple/conversation.c | 80 +++++++++++++++++++++++++++++++++++++- libpurple/conversation.h | 88 ++++++++++++++++++++++-------------------- libpurple/protocols/irc/msgs.c | 6 +-- pidgin/gtkconv.c | 38 +++++++++--------- 6 files changed, 164 insertions(+), 72 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index e948d1b29c..493051214e 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -4,6 +4,11 @@ version 3.0.0 (??/??/????): libpurple: Added: * pidgin_create_webview + * purple_conv_chat_cb_get_alias + * purple_conv_chat_cb_get_flags + * purple_conv_chat_cb_is_buddy + * purple_conv_chat_cb_get_ui_data + * purple_conv_chat_cb_set_ui_data * purple_conversation_get_ui_data * purple_conversation_set_ui_data * purple_notify_searchresult_column_is_visible @@ -188,6 +193,7 @@ version 3.0.0 (??/??/????): * struct _PidginImPane * struct _PurpleAttentionType * struct _PurpleConvChat + * struct _PurpleConvChatBuddy * struct _PurpleConvIm * struct _PurpleMenuAction * struct _PurplePounce diff --git a/finch/gntconv.c b/finch/gntconv.c index ccc0798b48..4648c5755c 100644 --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -1084,10 +1084,10 @@ finch_chat_add_users(PurpleConversation *conv, GList *users, gboolean new_arriva for (iter = users; iter; iter = iter->next) { PurpleConvChatBuddy *cbuddy = iter->data; - char *str; + const char *str; - if ((str = cbuddy->alias) == NULL) - str = cbuddy->name; + if ((str = purple_conv_chat_cb_get_alias(cbuddy)) == NULL) + str = purple_conv_chat_cb_get_name(cbuddy); g_string_append_printf(string, "[ %s ]", str); } @@ -1100,10 +1100,10 @@ finch_chat_add_users(PurpleConversation *conv, GList *users, gboolean new_arriva { PurpleConvChatBuddy *cbuddy = users->data; GntTree *tree = GNT_TREE(ggc->u.chat->userlist); - gnt_entry_add_suggest(entry, cbuddy->name); - gnt_entry_add_suggest(entry, cbuddy->alias); - gnt_tree_add_row_after(tree, g_strdup(cbuddy->name), - gnt_tree_create_row(tree, chat_flag_text(cbuddy->flags), cbuddy->alias), NULL, NULL); + gnt_entry_add_suggest(entry, purple_conv_chat_cb_get_name(cbuddy)); + gnt_entry_add_suggest(entry, purple_conv_chat_cb_get_alias(cbuddy)); + gnt_tree_add_row_after(tree, g_strdup(purple_conv_chat_cb_get_name(cbuddy)), + gnt_tree_create_row(tree, chat_flag_text(purple_conv_chat_cb_get_flags(cbuddy)), purple_conv_chat_cb_get_alias(cbuddy)), NULL, NULL); } } @@ -1122,7 +1122,7 @@ finch_chat_rename_user(PurpleConversation *conv, const char *old, const char *ne gnt_entry_add_suggest(entry, new_n); gnt_entry_add_suggest(entry, new_a); gnt_tree_add_row_after(tree, g_strdup(new_n), - gnt_tree_create_row(tree, chat_flag_text(cb->flags), new_a), NULL, NULL); + gnt_tree_create_row(tree, chat_flag_text(purple_conv_chat_cb_get_flags(cb)), new_a), NULL, NULL); } static void @@ -1143,7 +1143,7 @@ finch_chat_update_user(PurpleConversation *conv, const char *user) { PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), user); FinchConv *ggc = FINCH_CONV(conv); - gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(cb->flags)); + gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(purple_conv_chat_cb_get_flags(cb))); } static void diff --git a/libpurple/conversation.c b/libpurple/conversation.c index afdda2148d..e0b5c08ac2 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -70,6 +70,47 @@ struct _PurpleConvIm PurpleBuddyIcon *icon; /**< The buddy icon. */ }; +/** + * Data for "Chat Buddies" + */ +struct _PurpleConvChatBuddy +{ + /** The chat participant's name in the chat. */ + char *name; + + /** The chat participant's alias, if known; @a NULL otherwise. */ + char *alias; + + /** + * A string by which this buddy will be sorted, or @c NULL if the + * buddy should be sorted by its @c name. (This is currently always + * @c NULL. + */ + char *alias_key; + + /** + * @a TRUE if this chat participant is on the buddy list; + * @a FALSE otherwise. + */ + gboolean buddy; + + /** + * A bitwise OR of flags for this participant, such as whether they + * are a channel operator. + */ + PurpleConvChatBuddyFlags flags; + + /** + * A hash table of attributes about the user, such as real name, + * user\@host, etc. + */ + GHashTable *attributes; + + /** The UI can put whatever it wants here. */ + gpointer ui_data; +}; + + static GList *conversations = NULL; static GList *ims = NULL; static GList *chats = NULL; @@ -2219,14 +2260,51 @@ purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb) g_free(cb); } +void purple_conv_chat_cb_set_ui_data(PurpleConvChatBuddy *cb, gpointer ui_data) +{ + g_return_if_fail(cb != NULL); + + cb->ui_data = ui_data; +} + +gpointer purple_conv_chat_cb_get_ui_data(const PurpleConvChatBuddy *cb) +{ + g_return_val_if_fail(cb != NULL, NULL); + + return cb->ui_data; +} + +const char * +purple_conv_chat_cb_get_alias(const PurpleConvChatBuddy *cb) +{ + g_return_val_if_fail(cb != NULL, NULL); + + return cb->alias; +} + const char * -purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb) +purple_conv_chat_cb_get_name(const PurpleConvChatBuddy *cb) { g_return_val_if_fail(cb != NULL, NULL); return cb->name; } +PurpleConvChatBuddyFlags +purple_conv_chat_cb_get_flags(const PurpleConvChatBuddy *cb) +{ + g_return_val_if_fail(cb != NULL, PURPLE_CBFLAGS_NONE); + + return cb->flags; +} + +gboolean purple_conv_chat_cb_is_buddy(const PurpleConvChatBuddy *cb) +{ + g_return_val_if_fail(cb != NULL, FALSE); + + return cb->buddy; +} + const char * purple_conv_chat_cb_get_attribute(PurpleConvChatBuddy *cb, const char *key) { diff --git a/libpurple/conversation.h b/libpurple/conversation.h index 1fbe04f500..ebf9b485d8 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -249,46 +249,6 @@ struct _PurpleConversationUiOps void (*_purple_reserved4)(void); }; -/** - * Data for "Chat Buddies" - */ -struct _PurpleConvChatBuddy -{ - /** The chat participant's name in the chat. */ - char *name; - - /** The chat participant's alias, if known; @a NULL otherwise. */ - char *alias; - - /** - * A string by which this buddy will be sorted, or @c NULL if the - * buddy should be sorted by its @c name. (This is currently always - * @c NULL. - */ - char *alias_key; - - /** - * @a TRUE if this chat participant is on the buddy list; - * @a FALSE otherwise. - */ - gboolean buddy; - - /** - * A bitwise OR of flags for this participant, such as whether they - * are a channel operator. - */ - PurpleConvChatBuddyFlags flags; - - /** - * A hash table of attributes about the user, such as real name, - * user\@host, etc. - */ - GHashTable *attributes; - - /** The UI can put whatever it wants here. */ - gpointer ui_data; -}; - /** * Description of a conversation message */ @@ -1363,6 +1323,34 @@ PurpleConvChatBuddy *purple_conv_chat_cb_new(const char *name, const char *alias */ PurpleConvChatBuddy *purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name); +/** + * Set the UI data associated with this chat buddy. + * + * @param cb The chat buddy + * @param ui_data A pointer to associate with this chat buddy. + */ +void purple_conv_chat_cb_set_ui_data(PurpleConvChatBuddy *cb, gpointer ui_data); + +/** + * Get the UI data associated with this chat buddy. + * + * @param cb The chat buddy. + * + * @return The UI data associated with this chat buddy. This is a + * convenience field provided to the UIs--it is not + * used by the libpurple core. + */ +gpointer purple_conv_chat_cb_get_ui_data(const PurpleConvChatBuddy *conv); + +/** + * Get the alias of a chat buddy + * + * @param cb The chat buddy. + * + * @return The alias of the chat buddy. + */ +const char *purple_conv_chat_cb_get_alias(const PurpleConvChatBuddy *cb); + /** * Get the name of a chat buddy * @@ -1370,7 +1358,25 @@ PurpleConvChatBuddy *purple_conv_chat_cb_find(PurpleConvChat *chat, const char * * * @return The name of the chat buddy. */ -const char *purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb); +const char *purple_conv_chat_cb_get_name(const PurpleConvChatBuddy *cb); + +/** + * Get the flags of a chat buddy. + * + * @param cb The chat buddy. + * + * @return The flags of the chat buddy. + */ +PurpleConvChatBuddyFlags purple_conv_chat_cb_get_flags(const PurpleConvChatBuddy *cb); + +/** + * Indicates if this chat buddy is on the buddy list. + * + * @param cb The chat buddy. + * + * @return TRUE if the chat buddy is on the buddy list. + */ +gboolean purple_conv_chat_cb_is_buddy(const PurpleConvChatBuddy *cb); /** * Destroys a chat buddy diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c index 4ee1c19e95..111da50865 100644 --- a/libpurple/protocols/irc/msgs.c +++ b/libpurple/protocols/irc/msgs.c @@ -457,12 +457,12 @@ void irc_msg_who(struct irc_conn *irc, const char *name, const char *from, char g_free(userhost); g_free(realname); - flags = cb->flags; + flags = purple_conv_chat_cb_get_flags(cb); if (args[6][0] == 'G' && !(flags & PURPLE_CBFLAGS_AWAY)) { - purple_conv_chat_user_set_flags(chat, cb->name, flags | PURPLE_CBFLAGS_AWAY); + purple_conv_chat_user_set_flags(chat, purple_conv_chat_cb_get_name(cb), flags | PURPLE_CBFLAGS_AWAY); } else if(args[6][0] == 'H' && (flags & PURPLE_CBFLAGS_AWAY)) { - purple_conv_chat_user_set_flags(chat, cb->name, flags & ~PURPLE_CBFLAGS_AWAY); + purple_conv_chat_user_set_flags(chat, purple_conv_chat_cb_get_name(cb), flags & ~PURPLE_CBFLAGS_AWAY); } } } diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index ef5b1f4145..8afa361509 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -4027,10 +4027,11 @@ get_chat_buddy_status_icon(PurpleConvChat *chat, const char *name, PurpleConvCha static void deleting_chat_buddy_cb(PurpleConvChatBuddy *cb) { - if (cb->ui_data) { - GtkTreeRowReference *ref = cb->ui_data; + GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(cb); + + if (ref) { gtk_tree_row_reference_free(ref); - cb->ui_data = NULL; + purple_conv_chat_cb_set_ui_data(cb, NULL); } } @@ -4049,13 +4050,14 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c GtkTreeIter iter; gboolean is_me = FALSE; gboolean is_buddy; - gchar *tmp, *alias_key, *name, *alias; + const gchar *name, *alias; + gchar *tmp, *alias_key; PurpleConvChatBuddyFlags flags; GdkColor *color = NULL; - alias = cb->alias; - name = cb->name; - flags = cb->flags; + alias = purple_conv_chat_cb_get_alias(cb); + name = purple_conv_chat_cb_get_name(cb); + flags = purple_conv_chat_cb_get_flags(cb); chat = PURPLE_CONV_CHAT(conv); gtkconv = PIDGIN_CONVERSATION(conv); @@ -4073,7 +4075,7 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(conv->account, old_name != NULL ? old_name : name))) is_me = TRUE; - is_buddy = cb->buddy; + is_buddy = purple_conv_chat_cb_is_buddy(cb); tmp = g_utf8_casefold(alias, -1); alias_key = g_utf8_collate_key(tmp, -1); @@ -4114,13 +4116,13 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1); - if (cb->ui_data) { - GtkTreeRowReference *ref = cb->ui_data; + if (purple_conv_chat_cb_get_ui_data(cb)) { + GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(cb); gtk_tree_row_reference_free(ref); } newpath = gtk_tree_model_get_path(tm, &iter); - cb->ui_data = gtk_tree_row_reference_new(tm, newpath); + purple_conv_chat_cb_set_ui_data(cb, gtk_tree_row_reference_new(tm, newpath)); gtk_tree_path_free(newpath); if (is_me && color) @@ -4150,7 +4152,7 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c */ static void tab_complete_process_item(int *most_matched, const char *entered, gsize entered_bytes, char **partial, char *nick_partial, - GList **matches, char *name) + GList **matches, const char *name) { memcpy(nick_partial, name, entered_bytes); if (purple_utf8_strcasecmp(nick_partial, entered)) @@ -4272,7 +4274,7 @@ tab_complete(PurpleConversation *conv) /* Users */ for (; l != NULL; l = l->next) { tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, - &matches, ((PurpleConvChatBuddy *)l->data)->name); + &matches, purple_conv_chat_cb_get_name((PurpleConvChatBuddy *)l->data)); } @@ -6445,7 +6447,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a static gboolean get_iter_from_chatbuddy(PurpleConvChatBuddy *cb, GtkTreeIter *iter) { - GtkTreeRowReference *ref = cb->ui_data; + GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(cb); GtkTreePath *path; GtkTreeModel *model; @@ -6531,11 +6533,11 @@ pidgin_conv_chat_rename_user(PurpleConversation *conv, const char *old_name, old_cbuddy = purple_conv_chat_cb_find(chat, old_name); if (get_iter_from_chatbuddy(old_cbuddy, &iter)) { - GtkTreeRowReference *ref = old_cbuddy->ui_data; + GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(old_cbuddy); gtk_list_store_remove(GTK_LIST_STORE(model), &iter); gtk_tree_row_reference_free(ref); - old_cbuddy->ui_data = NULL; + purple_conv_chat_cb_set_ui_data(old_cbuddy, NULL); } if ((tag = get_buddy_tag(conv, old_name, 0, FALSE))) @@ -6629,10 +6631,10 @@ pidgin_conv_chat_update_user(PurpleConversation *conv, const char *user) cbuddy = purple_conv_chat_cb_find(chat, user); if (get_iter_from_chatbuddy(cbuddy, &iter)) { - GtkTreeRowReference *ref = cbuddy->ui_data; + GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(cbuddy); gtk_list_store_remove(GTK_LIST_STORE(model), &iter); gtk_tree_row_reference_free(ref); - cbuddy->ui_data = NULL; + purple_conv_chat_cb_set_ui_data(cbuddy, NULL); } if (cbuddy) -- cgit v1.2.1 From 1eaf7ba89b8870c2441836b61965e67666bfa3b5 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 13:49:37 +0000 Subject: PURPLE_CONV_TYPE_MISC never actually used. --- finch/gntconv.c | 3 --- libpurple/conversation.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/finch/gntconv.c b/finch/gntconv.c index 4648c5755c..22fd7e9c52 100644 --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -801,9 +801,6 @@ finch_create_conversation(PurpleConversation *conv) case PURPLE_CONV_TYPE_CHAT: gnt_widget_set_name(ggc->window, "conversation-window-chat" ); break; - case PURPLE_CONV_TYPE_MISC: - gnt_widget_set_name(ggc->window, "conversation-window-misc" ); - break; case PURPLE_CONV_TYPE_ANY: gnt_widget_set_name(ggc->window, "conversation-window-any" ); break; diff --git a/libpurple/conversation.h b/libpurple/conversation.h index ebf9b485d8..c3c9d2d56c 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -53,7 +53,6 @@ typedef enum PURPLE_CONV_TYPE_UNKNOWN = 0, /**< Unknown conversation type. */ PURPLE_CONV_TYPE_IM, /**< Instant Message. */ PURPLE_CONV_TYPE_CHAT, /**< Chat room. */ - PURPLE_CONV_TYPE_MISC, /**< A misc. conversation. */ PURPLE_CONV_TYPE_ANY /**< Any type of conversation. */ } PurpleConversationType; @@ -285,8 +284,6 @@ struct _PurpleConversation { PurpleConvIm *im; /**< IM-specific data. */ PurpleConvChat *chat; /**< Chat-specific data. */ - void *misc; /**< Misc. data. */ - } u; PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ -- cgit v1.2.1 From 649308378240a8cbb66458bd4b25e34414f72a9f Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 15:03:57 +0000 Subject: Use purple_conversation accessor methods. --- libpurple/plugins/statenotify.c | 2 +- libpurple/protocols/gg/gg.c | 2 +- libpurple/protocols/irc/irc.c | 2 +- libpurple/protocols/jabber/jabber.c | 10 ++++++---- libpurple/protocols/sametime/sametime.c | 4 ++-- libpurple/protocols/yahoo/libymsg.c | 4 ++-- libpurple/protocols/yahoo/yahoochat.c | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/libpurple/plugins/statenotify.c b/libpurple/plugins/statenotify.c index bfbe595e50..a2d6aa8a35 100644 --- a/libpurple/plugins/statenotify.c +++ b/libpurple/plugins/statenotify.c @@ -30,7 +30,7 @@ write_status(PurpleBuddy *buddy, const char *message) if (conv == NULL) return; - g_return_if_fail(conv->type == PURPLE_CONV_TYPE_IM); + g_return_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM); /* Prevent duplicate notifications for buddies in multiple groups */ if (buddy != purple_find_buddy(account, buddy_name)) diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index cd1b54512f..f27e82d402 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -2543,7 +2543,7 @@ static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, Purp for (l = info->chats; l != NULL; l = l->next) { chat = l->data; - if (g_utf8_collate(chat->name, conv->name) == 0) { + if (g_utf8_collate(chat->name, purple_conversation_get_name(conv)) == 0) { break; } diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index de6eb62626..cee9acc3a6 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -807,7 +807,7 @@ static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleM } #endif purple_markup_html_to_xhtml(what, NULL, &tmp); - args[0] = convo->name; + args[0] = purple_conversation_get_name(convo); args[1] = tmp; irc_cmd_privmsg(irc, "msg", NULL, args); diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index a060e07d40..0f26759e46 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -3163,13 +3163,14 @@ static gboolean _jabber_send_buzz(JabberStream *js, const char *username, char * static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - JabberStream *js = purple_connection_get_protocol_data(conv->account->gc); + PurpleAccount *account = purple_conversation_get_account(conv); + JabberStream *js = purple_connection_get_protocol_data(account->gc); const gchar *who; gchar *description; PurpleBuddy *buddy; const char *alias; PurpleAttentionType *attn = - purple_get_attention_type_from_code(conv->account, 0); + purple_get_attention_type_from_code(account, 0); if (!args || !args[0]) { /* use the buddy from conversation, if it's a one-to-one conversation */ @@ -3182,7 +3183,7 @@ static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, who = args[0]; } - buddy = purple_find_buddy(conv->account, who); + buddy = purple_find_buddy(account, who); if (buddy != NULL) alias = purple_buddy_get_contact_alias(buddy); else @@ -3574,7 +3575,8 @@ static PurpleCmdRet jabber_cmd_mood(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - JabberStream *js = purple_connection_get_protocol_data(conv->account->gc); + PurpleAccount *account = purple_conversation_get_account(conv); + JabberStream *js = purple_connection_get_protocol_data(account->gc); if (js->pep) { /* if no argument was given, unset mood */ diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index e135fa00ee..cacadeda41 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -2480,12 +2480,12 @@ static void convo_error(struct mwConversation *conv, guint32 err) { text = g_strconcat(_("Unable to send message: "), tmp, NULL); gconv = convo_get_gconv(conv); - if(gconv && !purple_conv_present_error(idb->user, gconv->account, text)) { + if(gconv && !purple_conv_present_error(idb->user, purple_conversation_get_account(gconv), text)) { g_free(text); text = g_strdup_printf(_("Unable to send message to %s:"), (idb->user)? idb->user: "(unknown)"); - purple_notify_error(purple_account_get_connection(gconv->account), + purple_notify_error(purple_account_get_connection(purple_conversation_get_account(gconv)), NULL, text, tmp); } diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 961506cdf4..5254d4e4fc 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -5213,7 +5213,7 @@ yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gcha if (*args && args[0]) return PURPLE_CMD_RET_FAILED; - purple_prpl_send_attention(account->gc, c->name, YAHOO_BUZZ); + purple_prpl_send_attention(account->gc, purple_conversation_get_name(c), YAHOO_BUZZ); return PURPLE_CMD_RET_OK; } @@ -5267,7 +5267,7 @@ gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint g_return_val_if_fail(c != NULL, FALSE); purple_debug_info("yahoo", "Sending on account %s to buddy %s.\n", - username, c->name); + username, purple_conversation_get_name(c)); purple_conv_im_send_with_flags(PURPLE_CONV_IM(c), "", PURPLE_MESSAGE_INVISIBLE); return TRUE; diff --git a/libpurple/protocols/yahoo/yahoochat.c b/libpurple/protocols/yahoo/yahoochat.c index 39043a628d..c384dcf859 100644 --- a/libpurple/protocols/yahoo/yahoochat.c +++ b/libpurple/protocols/yahoo/yahoochat.c @@ -1166,7 +1166,7 @@ void yahoo_c_invite(PurpleConnection *gc, int id, const char *msg, const char *n PurpleConversation *c; c = purple_find_chat(gc, id); - if (!c || !c->name) + if (!c || !purple_conversation_get_name(c)) return; if (id != YAHOO_CHAT_ID) { -- cgit v1.2.1 From 7f4853316c2dc574dd60750ca2d7897579144e0f Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 15:48:36 +0000 Subject: nullprpl also updated to use accessor methods. --- libpurple/protocols/null/nullprpl.c | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index 7b17635a20..20685d9720 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -138,11 +138,11 @@ static void call_chat_func(gpointer data, gpointer userdata) { PurpleConnection *to = (PurpleConnection *)data; ChatFuncData *cfdata = (ChatFuncData *)userdata; - int id = cfdata->from_chat->id; + int id = purple_conv_chat_get_id(cfdata->from_chat); PurpleConversation *conv = purple_find_chat(to, id); if (conv) { PurpleConvChat *chat = purple_conversation_get_chat_data(conv); - cfdata->fn(cfdata->from_chat, chat, id, conv->name, cfdata->userdata); + cfdata->fn(cfdata->from_chat, chat, id, purple_conversation_get_name(conv), cfdata->userdata); } } @@ -648,9 +648,9 @@ static void joined_chat(PurpleConvChat *from, PurpleConvChat *to, int id, const char *room, gpointer userdata) { /* tell their chat window that we joined */ purple_debug_info("nullprpl", "%s sees that %s joined chat room %s\n", - to->nick, from->nick, room); + purple_conv_chat_get_nick(to), purple_conv_chat_get_nick(from), room); purple_conv_chat_add_user(to, - from->nick, + purple_conv_chat_get_nick(from), NULL, /* user-provided join message, IRC style */ PURPLE_CBFLAGS_NONE, TRUE); /* show a join message */ @@ -658,9 +658,9 @@ static void joined_chat(PurpleConvChat *from, PurpleConvChat *to, if (from != to) { /* add them to our chat window */ purple_debug_info("nullprpl", "%s sees that %s is in chat room %s\n", - from->nick, to->nick, room); + purple_conv_chat_get_nick(from), purple_conv_chat_get_nick(to), room); purple_conv_chat_add_user(from, - to->nick, + purple_conv_chat_get_nick(to), NULL, /* user-provided join message, IRC style */ PURPLE_CBFLAGS_NONE, FALSE); /* show a join message */ @@ -721,7 +721,7 @@ static void nullprpl_chat_invite(PurpleConnection *gc, int id, const char *message, const char *who) { const char *username = gc->account->username; PurpleConversation *conv = purple_find_chat(gc, id); - const char *room = conv->name; + const char *room = purple_conversation_get_name(conv); PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); purple_debug_info("nullprpl", "%s is inviting %s to join chat room %s\n", @@ -752,9 +752,9 @@ static void left_chat_room(PurpleConvChat *from, PurpleConvChat *to, if (from != to) { /* tell their chat window that we left */ purple_debug_info("nullprpl", "%s sees that %s left chat room %s\n", - to->nick, from->nick, room); + purple_conv_chat_get_nick(to), purple_conv_chat_get_nick(from), room); purple_conv_chat_remove_user(to, - from->nick, + purple_conv_chat_get_nick(from), NULL); /* user-provided message, IRC style */ } } @@ -762,7 +762,7 @@ static void left_chat_room(PurpleConvChat *from, PurpleConvChat *to, static void nullprpl_chat_leave(PurpleConnection *gc, int id) { PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "%s is leaving chat room %s\n", - gc->account->username, conv->name); + gc->account->username, purple_conversation_get_name(conv)); /* tell everyone that we left */ foreach_gc_in_chat(left_chat_room, gc, id, NULL); @@ -789,9 +789,9 @@ static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, return PURPLE_CMD_RET_FAILED; } - from_username = conv->account->username; + from_username = purple_conversation_get_account(conv)->username; purple_debug_info("nullprpl", "%s whispers to %s in chat room %s: %s\n", - from_username, to_username, conv->name, message); + from_username, to_username, purple_conversation_get_name(conv), message); chat = purple_conversation_get_chat_data(conv); chat_buddy = purple_conv_chat_cb_find(chat, to_username); @@ -813,7 +813,7 @@ static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, g_free(message_to); /* send the whisper */ - serv_chat_whisper(to, chat->id, from_username, message); + serv_chat_whisper(to, purple_conv_chat_get_id(chat), from_username, message); return PURPLE_CMD_RET_OK; } @@ -825,7 +825,7 @@ static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "%s receives whisper from %s in chat room %s: %s\n", - username, who, conv->name, message); + username, who, purple_conversation_get_name(conv), message); /* receive whisper on recipient's account */ serv_got_chat_in(gc, id, who, PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_WHISPER, @@ -835,12 +835,12 @@ static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, static void receive_chat_message(PurpleConvChat *from, PurpleConvChat *to, int id, const char *room, gpointer userdata) { const char *message = (const char *)userdata; - PurpleConnection *to_gc = get_nullprpl_gc(to->nick); + PurpleConnection *to_gc = get_nullprpl_gc(purple_conv_chat_get_nick(to)); purple_debug_info("nullprpl", "%s receives message from %s in chat room %s: %s\n", - to->nick, from->nick, room, message); - serv_got_chat_in(to_gc, id, from->nick, PURPLE_MESSAGE_RECV, message, + purple_conv_chat_get_nick(to), purple_conv_chat_get_nick(from), room, message); + serv_got_chat_in(to_gc, id, purple_conv_chat_get_nick(from), PURPLE_MESSAGE_RECV, message, time(NULL)); } @@ -852,7 +852,7 @@ static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, if (conv) { purple_debug_info("nullprpl", "%s is sending message to chat room %s: %s\n", username, - conv->name, message); + purple_conversation_get_name(conv), message); /* send message to everyone in the chat room */ foreach_gc_in_chat(receive_chat_message, gc, id, (gpointer)message); @@ -875,7 +875,7 @@ static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "retrieving %s's info for %s in chat room %s\n", who, - gc->account->username, conv->name); + gc->account->username, purple_conversation_get_name(conv)); nullprpl_get_info(gc, who); } @@ -928,7 +928,7 @@ static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { static void set_chat_topic_fn(PurpleConvChat *from, PurpleConvChat *to, int id, const char *room, gpointer userdata) { const char *topic = (const char *)userdata; - const char *username = from->conv->account->username; + const char *username = purple_conversation_get_account(purple_conv_chat_get_conversation(from))->username; char *msg; purple_conv_chat_set_topic(to, username, topic); @@ -954,7 +954,7 @@ static void nullprpl_set_chat_topic(PurpleConnection *gc, int id, return; purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", - gc->account->username, conv->name, topic); + gc->account->username, purple_conversation_get_name(conv), topic); last_topic = purple_conv_chat_get_topic(chat); if ((!topic && !last_topic) || @@ -994,8 +994,8 @@ static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { for (chats = purple_get_chats(); chats; chats = g_list_next(chats)) { PurpleConversation *conv = (PurpleConversation *)chats->data; PurpleRoomlistRoom *room; - const char *name = conv->name; - int id = purple_conversation_get_chat_data(conv)->id; + const char *name = purple_conversation_get_name(conv); + int id = purple_conv_chat_get_id(purple_conversation_get_chat_data(conv)); /* have we already added this room? */ if (g_list_find_custom(seen_ids, name, (GCompareFunc)strcmp)) -- cgit v1.2.1 From b5c884e6dacd2534371269aa1a4046a2951428f1 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 15:50:20 +0000 Subject: More code changed to use the accessor functions. --- libpurple/plugins/statenotify.c | 2 +- libpurple/status.c | 2 +- pidgin/gtkblist.c | 13 ++-- pidgin/gtkconv.c | 99 +++++++++++++------------- pidgin/plugins/adiumthemes/webkit.c | 20 +++--- pidgin/plugins/musicmessaging/musicmessaging.c | 7 +- 6 files changed, 75 insertions(+), 68 deletions(-) diff --git a/libpurple/plugins/statenotify.c b/libpurple/plugins/statenotify.c index a2d6aa8a35..ca74854e90 100644 --- a/libpurple/plugins/statenotify.c +++ b/libpurple/plugins/statenotify.c @@ -42,7 +42,7 @@ write_status(PurpleBuddy *buddy, const char *message) g_snprintf(buf, sizeof(buf), message, escaped); g_free(escaped); - purple_conv_im_write(conv->u.im, NULL, buf, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_ACTIVE_ONLY | PURPLE_MESSAGE_NO_LINKIFY, time(NULL)); + purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, buf, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_ACTIVE_ONLY | PURPLE_MESSAGE_NO_LINKIFY, time(NULL)); } static void diff --git a/libpurple/status.c b/libpurple/status.c index 1556d2f101..9d43446efb 100644 --- a/libpurple/status.c +++ b/libpurple/status.c @@ -1099,7 +1099,7 @@ purple_presence_new_for_conv(PurpleConversation *conv) presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_CONV); presence->u.chat.conv = conv; - /* presence->statuses = purple_prpl_get_statuses(conv->account, presence); ? */ + /* presence->statuses = purple_prpl_get_statuses(purple_conversation_get_account(conv), presence); ? */ return presence; } diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index f698f50145..2fae16b73f 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -4590,6 +4590,7 @@ static void conversation_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type, PidginBuddyList *gtkblist) { + PurpleAccount *account = purple_conversation_get_account(conv); GList *convs = NULL; GList *ims, *chats; GList *l = NULL; @@ -4597,8 +4598,8 @@ conversation_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type, if (type != PURPLE_CONV_UPDATE_UNSEEN) return; - if(conv->account != NULL && conv->name != NULL) { - PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + if(account != NULL && purple_conversation_get_name(conv) != NULL) { + PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); if(buddy != NULL) pidgin_blist_update_buddy(NULL, (PurpleBlistNode *)buddy, TRUE); } @@ -4707,10 +4708,12 @@ displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node) static void conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) { - switch (conv->type) { + PurpleAccount *account = purple_conversation_get_account(conv); + + switch (purple_conversation_get_type(conv)) { case PURPLE_CONV_TYPE_IM: { - GSList *buddies = purple_find_buddies(conv->account, conv->name); + GSList *buddies = purple_find_buddies(account, purple_conversation_get_name(conv)); while (buddies) { PurpleBlistNode *buddy = buddies->data; struct _pidgin_blist_node *ui = buddy->ui_data; @@ -4731,7 +4734,7 @@ conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) break; case PURPLE_CONV_TYPE_CHAT: { - PurpleChat *chat = purple_blist_find_chat(conv->account, conv->name); + PurpleChat *chat = purple_blist_find_chat(account, purple_conversation_get_name(conv)); struct _pidgin_blist_node *ui; if (!chat) break; diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 8afa361509..6771c55d94 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -235,15 +235,16 @@ static const GdkColor *get_nick_color(PidginConversation *gtkconv, const char *n static PurpleBlistNode * get_conversation_blist_node(PurpleConversation *conv) { + PurpleAccount *account = purple_conversation_get_account(conv); PurpleBlistNode *node = NULL; switch (purple_conversation_get_type(conv)) { case PURPLE_CONV_TYPE_IM: - node = PURPLE_BLIST_NODE(purple_find_buddy(conv->account, conv->name)); + node = PURPLE_BLIST_NODE(purple_find_buddy(account, purple_conversation_get_name(conv))); node = node ? node->parent : NULL; break; case PURPLE_CONV_TYPE_CHAT: - node = PURPLE_BLIST_NODE(purple_blist_find_chat(conv->account, conv->name)); + node = PURPLE_BLIST_NODE(purple_blist_find_chat(account, purple_conversation_get_name(conv))); break; default: break; @@ -315,7 +316,7 @@ static void default_formatize(PidginConversation *c) { PurpleConversation *conv = c->active_conv; - gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), conv->features); + gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), purple_conversation_get_features(conv)); } static void @@ -655,7 +656,7 @@ send_cb(GtkWidget *widget, PidginConversation *gtkconv) flags |= PURPLE_MESSAGE_IMAGES; gc = purple_account_get_connection(account); - if (gc && (conv->features & PURPLE_CONNECTION_NO_NEWLINES)) { + if (gc && (purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_NEWLINES)) { char **bufs; int i; @@ -1092,7 +1093,7 @@ menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); - PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + PurpleBuddy *buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); const char *name; gchar *buf; gchar *c; @@ -1100,7 +1101,7 @@ menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) if (buddy != NULL) name = purple_buddy_get_contact_alias(buddy); else - name = purple_normalize(conv->account, conv->name); + name = purple_normalize(conv->account, purple_conversation_get_name(conv)); buf = g_strdup_printf("%s.html", name); for (c = buf ; *c ; c++) @@ -1440,7 +1441,7 @@ menu_logging_cb(gpointer data, guint action, GtkWidget *widget) } /* Save the setting IFF it's different than the pref. */ - switch (conv->type) + switch (purple_conversation_get_type(conv)) { case PURPLE_CONV_TYPE_IM: if (logging == purple_prefs_get_bool("/purple/logging/log_ims")) @@ -2304,10 +2305,10 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) gtk_imhtml_set_protocol_name(entry, protocol_name); /* TODO WEBKIT: gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); */ - if (!(conv->features & PURPLE_CONNECTION_HTML)) + if (!(purple_conversation_get_features(conv) & PURPLE_CONNECTION_HTML)) gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry)); - else if (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO && - !(old_conv->features & PURPLE_CONNECTION_FORMATTING_WBFO)) + else if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_FORMATTING_WBFO && + !(purple_conversation_get_features(old_conv) & PURPLE_CONNECTION_FORMATTING_WBFO)) { /* The old conversation allowed formatting on parts of the * buffer, but the new one only allows it on the whole @@ -2347,12 +2348,12 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) gtk_imhtml_toggle_fontface(entry, fontface); - if (!(conv->features & PURPLE_CONNECTION_NO_FONTSIZE)) + if (!(purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_FONTSIZE)) gtk_imhtml_font_set_size(entry, fontsize); gtk_imhtml_toggle_forecolor(entry, forecolor); - if (!(conv->features & PURPLE_CONNECTION_NO_BGCOLOR)) + if (!(purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_BGCOLOR)) { gtk_imhtml_toggle_backcolor(entry, backcolor); gtk_imhtml_toggle_background(entry, background); @@ -2370,7 +2371,7 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) * here, we didn't call gtk_imhtml_clear_formatting() (because we want to * preserve the formatting exactly as it is), so we have to do this now. */ gtk_imhtml_set_whole_buffer_formatting_only(entry, - (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO)); + (purple_conversation_get_features(conv) & PURPLE_CONNECTION_FORMATTING_WBFO)); } purple_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv); @@ -2600,7 +2601,7 @@ update_tab_icon(PurpleConversation *conv) status = infopane_status = pidgin_conv_get_icon_stock(conv); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - PurpleBuddy *b = purple_find_buddy(conv->account, conv->name); + PurpleBuddy *b = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); if (b) emblem = pidgin_blist_get_emblem((PurpleBlistNode*)b); } @@ -2884,7 +2885,7 @@ icon_menu_save_cb(GtkWidget *widget, PidginConversation *gtkconv) ext = purple_buddy_icon_get_extension(purple_conv_im_get_icon(PURPLE_CONV_IM(conv))); - buf = g_strdup_printf("%s.%s", purple_normalize(conv->account, conv->name), ext); + buf = g_strdup_printf("%s.%s", purple_normalize(conv->account, purple_conversation_get_name(conv)), ext); purple_request_file(gtkconv, _("Save Icon"), buf, TRUE, G_CALLBACK(saveicon_writefile_cb), NULL, @@ -3236,7 +3237,7 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea conv = gtkconv->active_conv; if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - chat = purple_blist_find_chat(conv->account, conv->name); + chat = purple_blist_find_chat(conv->account, purple_conversation_get_name(conv)); if ((chat == NULL) && (gtkconv->webview != NULL)) { chat = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat"); @@ -3267,7 +3268,7 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea if (!purple_account_is_connected(conv->account)) return FALSE; - buddy = purple_find_buddy(conv->account, conv->name); + buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); /* gotta remain bug-compatible :( libpurple < 2.0.2 didn't handle * removing "isolated" buddy nodes well */ @@ -3277,7 +3278,7 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea } if ((buddy == NULL) && (gtkconv->webview != NULL)) { - buddy = purple_buddy_new(conv->account, conv->name, NULL); + buddy = purple_buddy_new(conv->account, purple_conversation_get_name(conv), NULL); purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE); g_object_set_data_full(G_OBJECT(gtkconv->webview), "transient_buddy", @@ -3782,7 +3783,7 @@ update_send_to_selection(PidginWindow *win) if (win->menu.send_to == NULL) return FALSE; - if (!(b = purple_find_buddy(account, conv->name))) + if (!(b = purple_find_buddy(account, purple_conversation_get_name(conv)))) return FALSE; @@ -3942,7 +3943,7 @@ generate_send_to_items(PidginWindow *win) gtk_widget_show(menu); - if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_IM) { + if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_IM) { buds = purple_find_buddies(gtkconv->active_conv->account, gtkconv->active_conv->name); if (buds == NULL) @@ -4890,11 +4891,11 @@ pidgin_conv_create_tooltip(GtkWidget *tipwindow, gpointer userdata, int *w, int conv = gtkconv->active_conv; if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - node = (PurpleBlistNode*)(purple_blist_find_chat(conv->account, conv->name)); + node = (PurpleBlistNode*)(purple_blist_find_chat(conv->account, purple_conversation_get_name(conv))); if (!node) node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat"); } else { - node = (PurpleBlistNode*)(purple_find_buddy(conv->account, conv->name)); + node = (PurpleBlistNode*)(purple_find_buddy(conv->account, purple_conversation_get_name(conv))); #if 0 /* Using the transient blist nodes to show the tooltip doesn't quite work yet. */ if (!node) @@ -4992,7 +4993,7 @@ replace_header_tokens(PurpleConversation *conv, const char *text) const char *fin = NULL; if (g_str_has_prefix(cur, "%chatName%")) { - replace = conv->name; + replace = purple_conversation_get_name(conv); } else if (g_str_has_prefix(cur, "%sourceName%")) { replace = purple_account_get_alias(conv->account); @@ -5000,11 +5001,11 @@ replace_header_tokens(PurpleConversation *conv, const char *text) replace = purple_account_get_username(conv->account); } else if (g_str_has_prefix(cur, "%destinationName%")) { - PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + PurpleBuddy *buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); if (buddy) { replace = purple_buddy_get_alias(buddy); } else { - replace = conv->name; + replace = purple_conversation_get_name(conv); } } else if (g_str_has_prefix(cur, "%incomingIconPath%")) { @@ -5133,7 +5134,7 @@ setup_common_pane(PidginConversation *gtkconv) GtkTreePath *path; PurpleConversation *conv = gtkconv->active_conv; PurpleBuddy *buddy; - gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); + gboolean chat = (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT); int buddyicon_size = 0; char *header, *footer; char *template; @@ -5467,7 +5468,7 @@ static const GtkTargetEntry te[] = static PidginConversation * pidgin_conv_find_gtkconv(PurpleConversation * conv) { - PurpleBuddy *bud = purple_find_buddy(conv->account, conv->name); + PurpleBuddy *bud = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); PurpleContact *c; PurpleBlistNode *cn, *bn; @@ -5689,7 +5690,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->webview)->base[GTK_STATE_NORMAL]); } - if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) + if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) pidgin_themes_smiley_themeize_custom(gtkconv->entry); } @@ -6269,7 +6270,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a gtk_font_options |= GTK_IMHTML_USE_POINTSIZE; } - if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) + if (!(flags & PURPLE_MESSAGE_RECV) && (purple_conversation_get_features(conv) & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) { /* We want to see our own smileys. Need to revert it after send*/ pidgin_themes_smiley_themeize_custom(gtkconv->webview); @@ -6431,7 +6432,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a } #if 0 - if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) + if (!(flags & PURPLE_MESSAGE_RECV) && (purple_conversation_get_features(conv) & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) { /* Restore the smiley-data */ pidgin_themes_smiley_themeize(gtkconv->webview); @@ -6920,29 +6921,29 @@ gray_stuff_out(PidginConversation *gtkconv) { /* Account is online */ /* Deal with the toolbar */ - if (conv->features & PURPLE_CONNECTION_HTML) + if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_HTML) { buttons = GTK_IMHTML_ALL; /* Everything on */ - if (conv->features & PURPLE_CONNECTION_NO_BGCOLOR) + if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_BGCOLOR) buttons &= ~GTK_IMHTML_BACKCOLOR; - if (conv->features & PURPLE_CONNECTION_NO_FONTSIZE) + if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_FONTSIZE) { buttons &= ~GTK_IMHTML_GROW; buttons &= ~GTK_IMHTML_SHRINK; } - if (conv->features & PURPLE_CONNECTION_NO_URLDESC) + if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_URLDESC) buttons &= ~GTK_IMHTML_LINKDESC; } else { buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; } if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) - conv->features |= PURPLE_CONNECTION_NO_IMAGES; + purple_conversation_set_features(conv, purple_conversation_get_features(conv) | PURPLE_CONNECTION_NO_IMAGES); - if(conv->features & PURPLE_CONNECTION_NO_IMAGES) + if(purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_IMAGES) buttons &= ~GTK_IMHTML_IMAGE; - if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) + if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) buttons |= GTK_IMHTML_CUSTOM_SMILEY; else buttons &= ~GTK_IMHTML_CUSTOM_SMILEY; @@ -6956,8 +6957,8 @@ gray_stuff_out(PidginConversation *gtkconv) gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); - gtk_widget_set_sensitive(win->menu.insert_link, (conv->features & PURPLE_CONNECTION_HTML)); - gtk_widget_set_sensitive(win->menu.insert_image, !(conv->features & PURPLE_CONNECTION_NO_IMAGES)); + gtk_widget_set_sensitive(win->menu.insert_link, (purple_conversation_get_features(conv) & PURPLE_CONNECTION_HTML)); + gtk_widget_set_sensitive(win->menu.insert_image, !(purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_IMAGES)); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { @@ -7008,7 +7009,7 @@ gray_stuff_out(PidginConversation *gtkconv) if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) && (gtkconv->u.im->anim)) { - PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + PurpleBuddy *buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); window_icon = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); @@ -7111,7 +7112,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) title = g_strdup(purple_conversation_get_title(conv)); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - buddy = purple_find_buddy(account, conv->name); + buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); if (buddy) { markup = pidgin_blist_get_name_markup(buddy, FALSE, FALSE); } else { @@ -7156,7 +7157,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) style = "tab-label-attention"; } else if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT) { atk_object_set_description(accessibility_obj, _("Unread Messages")); - if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_CHAT) + if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_CHAT) style = "tab-label-unreadchat"; else style = "tab-label-attention"; @@ -7834,7 +7835,7 @@ hide_new_pref_cb(const char *name, PurplePrefType type, conv = gtkconv->active_conv; - if (conv->type == PURPLE_CONV_TYPE_CHAT || + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT || gtkconv->unseen_count == 0 || (when_away && !purple_status_is_available( purple_account_get_active_status( @@ -7899,14 +7900,14 @@ account_signed_off_cb(PurpleConnection *gc, gpointer event) PIDGIN_CONV_MENU | PIDGIN_CONV_COLORIZE_TITLE); if (PURPLE_CONNECTION_IS_CONNECTED(gc) && - conv->type == PURPLE_CONV_TYPE_CHAT && + purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && conv->account == gc->account && purple_conversation_get_data(conv, "want-to-rejoin")) { GHashTable *comps = NULL; - PurpleChat *chat = purple_blist_find_chat(conv->account, conv->name); + PurpleChat *chat = purple_blist_find_chat(conv->account, purple_conversation_get_name(conv)); if (chat == NULL) { if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) - comps = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, conv->name); + comps = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, purple_conversation_get_name(conv)); } else { comps = chat->components; } @@ -8061,7 +8062,7 @@ add_message_history_to_gtkconv(gpointer data) int count = 0; int timer = gtkconv->attach.timer; time_t when = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkconv->entry), "attach-start-time")); - gboolean im = (gtkconv->active_conv->type == PURPLE_CONV_TYPE_IM); + gboolean im = (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_IM); gtkconv->attach.timer = 0; while (gtkconv->attach.current && count < 100) { /* XXX: 100 is a random value here */ @@ -8185,7 +8186,7 @@ gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv) "conversation-displayed", gtkconv); } - if (conv->type == PURPLE_CONV_TYPE_CHAT) { + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC); pidgin_conv_chat_add_users(conv, purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv)), TRUE); } @@ -9389,7 +9390,7 @@ infopane_entry_activate(PidginConversation *gtkconv) } if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - PurpleBuddy *buddy = purple_find_buddy(gtkconv->active_conv->account, gtkconv->active_conv->name); + PurpleBuddy *buddy = purple_find_buddy(gtkconv->active_conv->account, purple_conversation_get_name(gtkconv->active_conv)); if (!buddy) /* This buddy isn't in your buddy list, so we can't alias him */ return FALSE; diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index 84e097ce80..ab1a8fc3f2 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -102,6 +102,7 @@ replace_message_tokens( PurpleMessageFlags flags, time_t mtime) { + PurpleAccount *account = purple_conversation_get_account(conv); GString *str = g_string_new(NULL); const char *cur = text; const char *prev = cur; @@ -129,10 +130,10 @@ replace_message_tokens( g_free(format); } else if (!strncmp(cur, "%userIconPath%", strlen("%userIconPath%"))) { if (flags & PURPLE_MESSAGE_SEND) { - if (purple_account_get_bool(conv->account, "use-global-buddyicon", TRUE)) { + if (purple_account_get_bool(account, "use-global-buddyicon", TRUE)) { replace = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon"); } else { - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(conv->account); + PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); replace = purple_imgstore_get_filename(img); } if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { @@ -151,7 +152,7 @@ replace_message_tokens( } else if (!strncmp(cur, "%sender%", strlen("%sender%"))) { replace = alias; } else if (!strncmp(cur, "%service%", strlen("%service%"))) { - replace = purple_account_get_protocol_name(conv->account); + replace = purple_account_get_protocol_name(account); } else { cur++; continue; @@ -178,6 +179,7 @@ replace_message_tokens( static char * replace_header_tokens(char *text, PurpleConversation *conv) { + PurpleAccount *account = purple_conversation_get_account(conv); GString *str = g_string_new(NULL); char *cur = text; char *prev = cur; @@ -190,17 +192,17 @@ replace_header_tokens(char *text, PurpleConversation *conv) char *fin = NULL; if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { - replace = conv->name; + replace = purple_conversation_get_name(conv); } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { - replace = purple_account_get_alias(conv->account); + replace = purple_account_get_alias(account); if (replace == NULL) - replace = purple_account_get_username(conv->account); + replace = purple_account_get_username(account); } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { - PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); if (buddy) { replace = purple_buddy_get_alias(buddy); } else { - replace = conv->name; + replace = purple_conversation_get_name(conv); } } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); @@ -450,7 +452,7 @@ webkit_on_displaying_im_msg(PurpleAccount *account, } purple_conversation_set_data(conv, "webkit-lastflags", GINT_TO_POINTER(flags)); - smileyed = smiley_parse_markup(stripped, conv->account->protocol_id); + smileyed = smiley_parse_markup(stripped, purple_conversation_get_account(conv)->protocol_id); msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime); escape = gtk_webview_quote_js_string(msg); script = g_strdup_printf("%s(%s)", func, escape); diff --git a/pidgin/plugins/musicmessaging/musicmessaging.c b/pidgin/plugins/musicmessaging/musicmessaging.c index 1a735d7c9a..c47d9b8206 100644 --- a/pidgin/plugins/musicmessaging/musicmessaging.c +++ b/pidgin/plugins/musicmessaging/musicmessaging.c @@ -104,7 +104,7 @@ void music_messaging_change_request(const int session, const char *command, cons { if (mmconv->originator) { - char *name = (mmconv->conv)->name; + const char *name = purple_conversation_get_name(mmconv->conv); send_change_request (session, name, command, parameters); } else { @@ -376,7 +376,7 @@ intercept_received(PurpleAccount *account, char **sender, char **message, Purple if (mmconv->originator) { int session = mmconv_from_conv_loc(conv); - char *id = (mmconv->conv)->name; + const char *id = purple_conversation_get_name(mmconv->conv); char *command; char *parameters; @@ -424,7 +424,8 @@ intercept_received(PurpleAccount *account, char **sender, char **message, Purple command = strtok(NULL, " "); /* char *parameters = strtok(NULL, "#"); DONT NEED PARAMETERS */ - if ((mmconv->conv)->name == id) + // TODO: Shouldn't this be strcmp() ? + if (purple_conversation_get_name(mmconv->conv) == id) { purple_notify_message(plugin_pointer, PURPLE_NOTIFY_MSG_ERROR, _("Music Messaging"), -- cgit v1.2.1 From e99e63c0197b22700c6fa51b80ff22656170731f Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 16:21:16 +0000 Subject: Use purple_conversation accessor methods. --- pidgin/gtkconv.c | 102 +++++++++++++++++++++++++++++------------------------- pidgin/gtksound.c | 4 +-- pidgin/gtkutils.c | 2 +- 3 files changed, 57 insertions(+), 51 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 6771c55d94..799d77e375 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1093,7 +1093,8 @@ menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); - PurpleBuddy *buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); + PurpleAccount *account = purple_conversation_get_account(conv); + PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); const char *name; gchar *buf; gchar *c; @@ -1101,7 +1102,7 @@ menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) if (buddy != NULL) name = purple_buddy_get_contact_alias(buddy); else - name = purple_normalize(conv->account, purple_conversation_get_name(conv)); + name = purple_normalize(account, purple_conversation_get_name(conv)); buf = g_strdup_printf("%s.html", name); for (c = buf ; *c ; c++) @@ -1644,6 +1645,7 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc static GtkWidget *menu = NULL; PurplePluginProtocolInfo *prpl_info = NULL; PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); + PurpleAccount *account = purple_conversation_get_account(conv); gboolean is_me = FALSE; GtkWidget *button; PurpleBuddy *buddy = NULL; @@ -1658,7 +1660,7 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc if (menu) gtk_widget_destroy(menu); - if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(conv->account, who))) + if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(account, who))) is_me = TRUE; menu = gtk_menu_new(); @@ -1724,7 +1726,7 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc } if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { - if ((buddy = purple_find_buddy(conv->account, who)) != NULL) + if ((buddy = purple_find_buddy(account, who)) != NULL) button = pidgin_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE, G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); else @@ -1745,8 +1747,8 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc if (buddy != NULL) { - if (purple_account_is_connected(conv->account)) - pidgin_append_blist_node_proto_menu(menu, conv->account->gc, + if (purple_account_is_connected(account)) + pidgin_append_blist_node_proto_menu(menu, account->gc, (PurpleBlistNode *)buddy); pidgin_append_blist_node_extended_menu(menu, (PurpleBlistNode *)buddy); gtk_widget_show_all(menu); @@ -2301,7 +2303,7 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging))); entry = GTK_IMHTML(gtkconv->entry); - protocol_name = purple_account_get_protocol_name(conv->account); + protocol_name = purple_account_get_protocol_name(purple_conversation_get_account(conv)); gtk_imhtml_set_protocol_name(entry, protocol_name); /* TODO WEBKIT: gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); */ @@ -2601,7 +2603,7 @@ update_tab_icon(PurpleConversation *conv) status = infopane_status = pidgin_conv_get_icon_stock(conv); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - PurpleBuddy *b = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); + PurpleBuddy *b = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); if (b) emblem = pidgin_blist_get_emblem((PurpleBlistNode*)b); } @@ -2622,7 +2624,7 @@ update_tab_icon(PurpleConversation *conv) g_object_unref(emblem); if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) { - emblem = pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL); + emblem = pidgin_create_prpl_icon(purple_conversation_get_account(gtkconv->active_conv), PIDGIN_PRPL_ICON_SMALL); } else { emblem = NULL; } @@ -2885,11 +2887,11 @@ icon_menu_save_cb(GtkWidget *widget, PidginConversation *gtkconv) ext = purple_buddy_icon_get_extension(purple_conv_im_get_icon(PURPLE_CONV_IM(conv))); - buf = g_strdup_printf("%s.%s", purple_normalize(conv->account, purple_conversation_get_name(conv)), ext); + buf = g_strdup_printf("%s.%s", purple_normalize(purple_conversation_get_account(conv), purple_conversation_get_name(conv)), ext); purple_request_file(gtkconv, _("Save Icon"), buf, TRUE, G_CALLBACK(saveicon_writefile_cb), NULL, - conv->account, NULL, conv, + purple_conversation_get_account(conv), NULL, conv, gtkconv); g_free(buf); @@ -3229,15 +3231,17 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea { GList *list; PurpleConversation *conv; + PurpleAccount *account; PurpleBlistNode *node = NULL; PurpleChat *chat = NULL; PurpleBuddy *buddy = NULL; gboolean ret; conv = gtkconv->active_conv; + account = purple_conversation_get_account(conv); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - chat = purple_blist_find_chat(conv->account, purple_conversation_get_name(conv)); + chat = purple_blist_find_chat(account, purple_conversation_get_name(conv)); if ((chat == NULL) && (gtkconv->webview != NULL)) { chat = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat"); @@ -3258,17 +3262,17 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea g_hash_table_replace(components, g_strdup("channel"), g_strdup(purple_conversation_get_name(conv))); } - chat = purple_chat_new(conv->account, NULL, components); + chat = purple_chat_new(account, NULL, components); purple_blist_node_set_flags((PurpleBlistNode *)chat, PURPLE_BLIST_NODE_FLAG_NO_SAVE); g_object_set_data_full(G_OBJECT(gtkconv->webview), "transient_chat", chat, (GDestroyNotify)purple_blist_remove_chat); } } else { - if (!purple_account_is_connected(conv->account)) + if (!purple_account_is_connected(account)) return FALSE; - buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); + buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); /* gotta remain bug-compatible :( libpurple < 2.0.2 didn't handle * removing "isolated" buddy nodes well */ @@ -3278,7 +3282,7 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea } if ((buddy == NULL) && (gtkconv->webview != NULL)) { - buddy = purple_buddy_new(conv->account, purple_conversation_get_name(conv), NULL); + buddy = purple_buddy_new(account, purple_conversation_get_name(conv), NULL); purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE); g_object_set_data_full(G_OBJECT(gtkconv->webview), "transient_buddy", @@ -3300,8 +3304,8 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea /* XXX: */ } } else if (node) { - if (purple_account_is_connected(conv->account)) - pidgin_append_blist_node_proto_menu(menu, conv->account->gc, node); + if (purple_account_is_connected(account)) + pidgin_append_blist_node_proto_menu(menu, account->gc, node); pidgin_append_blist_node_extended_menu(menu, node); } @@ -3944,7 +3948,7 @@ generate_send_to_items(PidginWindow *win) gtk_widget_show(menu); if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_IM) { - buds = purple_find_buddies(gtkconv->active_conv->account, gtkconv->active_conv->name); + buds = purple_find_buddies(purple_conversation_get_account(gtkconv->active_conv), purple_conversation_get_name(gtkconv->active_conv)); if (buds == NULL) { @@ -3969,7 +3973,7 @@ generate_send_to_items(PidginWindow *win) account = purple_buddy_get_account(buddy); /* TODO WEBKIT: (I'm not actually sure if this is webkit-related --Mark Doliner) */ - if (purple_account_is_connected(account) /*|| account == gtkconv->active_conv->account*/) + if (purple_account_is_connected(account) /*|| account == purple_conversation_get_account(gtkconv->active_conv)*/) { /* Use the PurplePresence to get unique buddies. */ PurplePresence *presence = purple_buddy_get_presence(buddy); @@ -4073,7 +4077,7 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c stock = get_chat_buddy_status_icon(chat, name, flags); - if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(conv->account, old_name != NULL ? old_name : name))) + if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(purple_conversation_get_account(conv), old_name != NULL ? old_name : name))) is_me = TRUE; is_buddy = purple_conv_chat_cb_is_buddy(cb); @@ -4450,6 +4454,7 @@ update_chat_alias(PurpleBuddy *buddy, PurpleConversation *conv, PurpleConnection { PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); + PurpleAccount *account = purple_conversation_get_account(conv); GtkTreeModel *model; char *normalized_name; GtkTreeIter iter; @@ -4464,23 +4469,23 @@ update_chat_alias(PurpleBuddy *buddy, PurpleConversation *conv, PurpleConnection if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) return; - normalized_name = g_strdup(purple_normalize(conv->account, buddy->name)); + normalized_name = g_strdup(purple_normalize(account, buddy->name)); do { char *name; gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1); - if (!strcmp(normalized_name, purple_normalize(conv->account, name))) { + if (!strcmp(normalized_name, purple_normalize(account, name))) { const char *alias = name; char *tmp; char *alias_key = NULL; PurpleBuddy *buddy2; - if (strcmp(purple_conv_chat_get_nick(chat), purple_normalize(conv->account, name))) { + if (strcmp(purple_conv_chat_get_nick(chat), purple_normalize(account, name))) { /* This user is not me, so look into updating the alias. */ - if ((buddy2 = purple_find_buddy(conv->account, name)) != NULL) { + if ((buddy2 = purple_find_buddy(account, name)) != NULL) { alias = purple_buddy_get_contact_alias(buddy2); } @@ -4567,14 +4572,14 @@ buddy_cb_common(PurpleBuddy *buddy, PurpleConversation *conv, gboolean is_buddy) if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) return; - normalized_name = g_strdup(purple_normalize(conv->account, buddy->name)); + normalized_name = g_strdup(purple_normalize(purple_conversation_get_account(conv), buddy->name)); do { char *name; gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1); - if (!strcmp(normalized_name, purple_normalize(conv->account, name))) { + if (!strcmp(normalized_name, purple_normalize(purple_conversation_get_account(conv), name))) { gtk_list_store_set(GTK_LIST_STORE(model), &iter, CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1); g_free(name); @@ -4776,7 +4781,7 @@ pidgin_conv_userlist_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path, gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); - node = (PurpleBlistNode*)(purple_find_buddy(conv->account, who)); + node = (PurpleBlistNode*)(purple_find_buddy(purple_conversation_get_account(conv), who)); if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) pidgin_blist_draw_tooltip(node, gtkconv->infopane); @@ -4891,11 +4896,11 @@ pidgin_conv_create_tooltip(GtkWidget *tipwindow, gpointer userdata, int *w, int conv = gtkconv->active_conv; if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - node = (PurpleBlistNode*)(purple_blist_find_chat(conv->account, purple_conversation_get_name(conv))); + node = (PurpleBlistNode*)(purple_blist_find_chat(purple_conversation_get_account(conv), purple_conversation_get_name(conv))); if (!node) node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat"); } else { - node = (PurpleBlistNode*)(purple_find_buddy(conv->account, purple_conversation_get_name(conv))); + node = (PurpleBlistNode*)(purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv))); #if 0 /* Using the transient blist nodes to show the tooltip doesn't quite work yet. */ if (!node) @@ -4980,6 +4985,7 @@ pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) static char * replace_header_tokens(PurpleConversation *conv, const char *text) { + PurpleAccount *account = purple_conversation_get_account(conv); GString *str; const char *cur = text; const char *prev = cur; @@ -4996,12 +5002,12 @@ replace_header_tokens(PurpleConversation *conv, const char *text) replace = purple_conversation_get_name(conv); } else if (g_str_has_prefix(cur, "%sourceName%")) { - replace = purple_account_get_alias(conv->account); + replace = purple_account_get_alias(account); if (replace == NULL) - replace = purple_account_get_username(conv->account); + replace = purple_account_get_username(account); } else if (g_str_has_prefix(cur, "%destinationName%")) { - PurpleBuddy *buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); + PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); if (buddy) { replace = purple_buddy_get_alias(buddy); } else { @@ -5014,7 +5020,7 @@ replace_header_tokens(PurpleConversation *conv, const char *text) replace = purple_buddy_icon_get_full_path(icon); } else if (g_str_has_prefix(cur, "%outgoingIconPath%")) { - replace = purple_account_get_buddy_icon_path(conv->account); + replace = purple_account_get_buddy_icon_path(account); } else if (g_str_has_prefix(cur, "%timeOpened")) { const char *tmp = cur + strlen("%timeOpened"); @@ -5301,7 +5307,7 @@ setup_common_pane(PidginConversation *gtkconv) gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), - purple_account_get_protocol_name(conv->account)); + purple_account_get_protocol_name(purple_conversation_get_account(conv))); g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", G_CALLBACK(entry_popup_menu_cb), gtkconv); @@ -5468,7 +5474,7 @@ static const GtkTargetEntry te[] = static PidginConversation * pidgin_conv_find_gtkconv(PurpleConversation * conv) { - PurpleBuddy *bud = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); + PurpleBuddy *bud = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); PurpleContact *c; PurpleBlistNode *cn, *bn; @@ -6049,10 +6055,10 @@ replace_message_tokens( } else if (g_str_has_prefix(cur, "%userIconPath%")) { if (flags & PURPLE_MESSAGE_SEND) { - if (purple_account_get_bool(conv->account, "use-global-buddyicon", TRUE)) { + if (purple_account_get_bool(purple_conversation_get_account(conv), "use-global-buddyicon", TRUE)) { replace = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon"); } else { - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(conv->account); + PurpleStoredImage *img = purple_buddy_icons_find_account_icon(purple_conversation_get_account(conv)); replace = purple_imgstore_get_filename(img); } if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { @@ -6074,7 +6080,7 @@ replace_message_tokens( replace = alias; } else if (g_str_has_prefix(cur, "%service%")) { - replace = purple_account_get_protocol_name(conv->account); + replace = purple_account_get_protocol_name(purple_conversation_get_account(conv)); } else { cur++; @@ -6265,7 +6271,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a gtk_font_options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES | GTK_IMHTML_NO_FORMATTING; /* this is gonna crash one day, I can feel it. */ - if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(conv->account)))->options & + if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(purple_conversation_get_account(conv))))->options & OPT_PROTO_USE_POINTSIZE) { gtk_font_options |= GTK_IMHTML_USE_POINTSIZE; } @@ -6705,7 +6711,7 @@ pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gbool /* If possible add this smiley to the current theme. * The addition is only temporary: custom smilies aren't saved to disk. */ - conv_sml = purple_account_get_protocol_name(conv->account); + conv_sml = purple_account_get_protocol_name(purple_conversation_get_account(conv)); gtkconv = PIDGIN_CONVERSATION(conv); for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) { @@ -6736,7 +6742,7 @@ pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, const char *sml; GError *error = NULL; - sml = purple_account_get_protocol_name(conv->account); + sml = purple_account_get_protocol_name(purple_conversation_get_account(conv)); gtkconv = PIDGIN_CONVERSATION(conv); smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); @@ -6781,7 +6787,7 @@ pidgin_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) g_return_if_fail(conv != NULL); g_return_if_fail(smile != NULL); - sml = purple_account_get_protocol_name(conv->account); + sml = purple_account_get_protocol_name(purple_conversation_get_account(conv)); gtkconv = PIDGIN_CONVERSATION(conv); smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); @@ -7009,7 +7015,7 @@ gray_stuff_out(PidginConversation *gtkconv) if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) && (gtkconv->u.im->anim)) { - PurpleBuddy *buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv)); + PurpleBuddy *buddy = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); window_icon = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); @@ -7901,10 +7907,10 @@ account_signed_off_cb(PurpleConnection *gc, gpointer event) if (PURPLE_CONNECTION_IS_CONNECTED(gc) && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && - conv->account == gc->account && + purple_conversation_get_account(conv) == gc->account && purple_conversation_get_data(conv, "want-to-rejoin")) { GHashTable *comps = NULL; - PurpleChat *chat = purple_blist_find_chat(conv->account, purple_conversation_get_name(conv)); + PurpleChat *chat = purple_blist_find_chat(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); if (chat == NULL) { if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) comps = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, purple_conversation_get_name(conv)); @@ -9384,13 +9390,13 @@ infopane_entry_activate(PidginConversation *gtkconv) return FALSE; } - if (!purple_account_is_connected(gtkconv->active_conv->account)) { + if (!purple_account_is_connected(purple_conversation_get_account(gtkconv->active_conv))) { /* Do not allow aliasing someone on a disconnected account. */ return FALSE; } if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - PurpleBuddy *buddy = purple_find_buddy(gtkconv->active_conv->account, purple_conversation_get_name(gtkconv->active_conv)); + PurpleBuddy *buddy = purple_find_buddy(purple_conversation_get_account(gtkconv->active_conv), purple_conversation_get_name(gtkconv->active_conv)); if (!buddy) /* This buddy isn't in your buddy list, so we can't alias him */ return FALSE; diff --git a/pidgin/gtksound.c b/pidgin/gtksound.c index ad26ee054c..814b926c1e 100644 --- a/pidgin/gtksound.c +++ b/pidgin/gtksound.c @@ -96,8 +96,8 @@ chat_nick_matches_name(PurpleConversation *conv, const char *aname) if (chat==NULL) return ret; - nick = g_strdup(purple_normalize(conv->account, purple_conv_chat_get_nick(chat))); - name = g_strdup(purple_normalize(conv->account, aname)); + nick = g_strdup(purple_normalize(purple_conversation_get_account(conv), purple_conv_chat_get_nick(chat))); + name = g_strdup(purple_normalize(purple_conversation_get_account(conv), aname)); if (g_utf8_collate(nick, name) == 0) ret = TRUE; diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index ed533d4979..cd42fc3ed0 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -3480,7 +3480,7 @@ save_file_cb(GtkWidget *item, const char *url) return TRUE; purple_request_file(conv->active_conv, _("Save File"), NULL, TRUE, G_CALLBACK(savefile_write_cb), NULL, - conv->active_conv->account, NULL, conv->active_conv, + purple_conversation_get_account(conv->active_conv), NULL, conv->active_conv, (void *)url); return TRUE; } -- cgit v1.2.1 From 2ca879c1c91bae48e4ea916c1ca9e657ef961ebd Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 16:48:40 +0000 Subject: Hide struct _PurpleConversation. --- ChangeLog.API | 1 + libpurple/conversation.c | 34 ++++++++++++++++++++++++++++++++++ libpurple/conversation.h | 34 ---------------------------------- pidgin/gtkconv.c | 6 ++---- 4 files changed, 37 insertions(+), 38 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 493051214e..9428d99435 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -192,6 +192,7 @@ version 3.0.0 (??/??/????): * struct _PidginChatPane * struct _PidginImPane * struct _PurpleAttentionType + * struct _PurpleConversation * struct _PurpleConvChat * struct _PurpleConvChatBuddy * struct _PurpleConvIm diff --git a/libpurple/conversation.c b/libpurple/conversation.c index e0b5c08ac2..a479b50597 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -110,6 +110,40 @@ struct _PurpleConvChatBuddy gpointer ui_data; }; +/** + * A core representation of a conversation between two or more people. + * + * The conversation can be an IM or a chat. + */ +struct _PurpleConversation +{ + PurpleConversationType type; /**< The type of conversation. */ + + PurpleAccount *account; /**< The user using this conversation. */ + + + char *name; /**< The name of the conversation. */ + char *title; /**< The window title. */ + + gboolean logging; /**< The status of logging. */ + + GList *logs; /**< This conversation's logs */ + + union + { + PurpleConvIm *im; /**< IM-specific data. */ + PurpleConvChat *chat; /**< Chat-specific data. */ + } u; + + PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ + void *ui_data; /**< UI-specific data. */ + + GHashTable *data; /**< Plugin-specific data. */ + + PurpleConnectionFlags features; /**< The supported features */ + GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ +}; + static GList *conversations = NULL; static GList *ims = NULL; diff --git a/libpurple/conversation.h b/libpurple/conversation.h index c3c9d2d56c..e4ec3667c6 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -261,40 +261,6 @@ struct _PurpleConvMessage char *alias; }; -/** - * A core representation of a conversation between two or more people. - * - * The conversation can be an IM or a chat. - */ -struct _PurpleConversation -{ - PurpleConversationType type; /**< The type of conversation. */ - - PurpleAccount *account; /**< The user using this conversation. */ - - - char *name; /**< The name of the conversation. */ - char *title; /**< The window title. */ - - gboolean logging; /**< The status of logging. */ - - GList *logs; /**< This conversation's logs */ - - union - { - PurpleConvIm *im; /**< IM-specific data. */ - PurpleConvChat *chat; /**< Chat-specific data. */ - } u; - - PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ - void *ui_data; /**< UI-specific data. */ - - GHashTable *data; /**< Plugin-specific data. */ - - PurpleConnectionFlags features; /**< The supported features */ - GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ -}; - #ifdef __cplusplus extern "C" { #endif diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 799d77e375..99230b22e9 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1425,16 +1425,14 @@ menu_logging_cb(gpointer data, guint action, GtkWidget *widget) purple_conversation_write(conv, NULL, _("Logging started. Future messages in this conversation will be logged."), - conv->logs ? (PURPLE_MESSAGE_SYSTEM) : - (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG), + PURPLE_MESSAGE_SYSTEM, time(NULL)); } else { purple_conversation_write(conv, NULL, _("Logging stopped. Future messages in this conversation will not be logged."), - conv->logs ? (PURPLE_MESSAGE_SYSTEM) : - (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG), + PURPLE_MESSAGE_SYSTEM, time(NULL)); /* Disable the logging second, so that the above message can be logged. */ -- cgit v1.2.1 From 64d8e0de5f4a6f6f50abcfa9c31ec85c363c8bdc Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 17:10:45 +0000 Subject: Hide structs PurpleAccountOption and PurpleAccountUserSplit. --- ChangeLog.API | 2 ++ libpurple/accountopt.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ libpurple/accountopt.h | 49 +++++++------------------------------------------ 3 files changed, 54 insertions(+), 42 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 9428d99435..f91c4ee79a 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -203,6 +203,8 @@ version 3.0.0 (??/??/????): * struct _PurpleRoomlist * struct _PurpleRoomlistField * struct _PurpleRoomlistRoom + * struct PurpleAccountOption + * struct PurpleAccountUserSplit * wpurple_g_access * xmlnode_set_attrib_with_namespace * xmlnode_set_attrib_with_prefix diff --git a/libpurple/accountopt.c b/libpurple/accountopt.c index 726f385f5e..266610c19d 100644 --- a/libpurple/accountopt.c +++ b/libpurple/accountopt.c @@ -28,6 +28,51 @@ #include "accountopt.h" #include "util.h" +/** + * An option for an account. + * + * This is set by protocol plugins, and appears in the account settings + * dialogs. + */ +struct _PurpleAccountOption +{ + PurplePrefType type; /**< The type of value. */ + + char *text; /**< The text that will appear to the user. */ + char *pref_name; /**< The name of the associated preference. */ + + union + { + gboolean boolean; /**< The default boolean value. */ + int integer; /**< The default integer value. */ + char *string; /**< The default string value. */ + GList *list; /**< The default list value. */ + + } default_value; + + gboolean masked; /**< Whether the value entered should be + * obscured from view (for passwords and + * similar options) + */ +}; + +/** + * A username split. + * + * This is used by some protocols to separate the fields of the username + * into more human-readable components. + */ +struct _PurpleAccountUserSplit +{ + char *text; /**< The text that will appear to the user. */ + char *default_value; /**< The default value. */ + char field_sep; /**< The field separator. */ + gboolean reverse; /**< TRUE if the separator should be found + starting a the end of the string, FALSE + otherwise */ +}; + + PurpleAccountOption * purple_account_option_new(PurplePrefType type, const char *text, const char *pref_name) diff --git a/libpurple/accountopt.h b/libpurple/accountopt.h index 85aa181149..b0b7d392ea 100644 --- a/libpurple/accountopt.h +++ b/libpurple/accountopt.h @@ -28,50 +28,15 @@ #include "prefs.h" -/** - * An option for an account. - * - * This is set by protocol plugins, and appears in the account settings - * dialogs. - */ -typedef struct -{ - PurplePrefType type; /**< The type of value. */ - - char *text; /**< The text that will appear to the user. */ - char *pref_name; /**< The name of the associated preference. */ - - union - { - gboolean boolean; /**< The default boolean value. */ - int integer; /**< The default integer value. */ - char *string; /**< The default string value. */ - GList *list; /**< The default list value. */ - - } default_value; +/**************************************************************************/ +/** Data Structures */ +/**************************************************************************/ - gboolean masked; /**< Whether the value entered should be - * obscured from view (for passwords and - * similar options) - */ -} PurpleAccountOption; +/** @copydoc _PurpleAccountOption */ +typedef struct _PurpleAccountOption PurpleAccountOption; +/** @copydoc _PurpleAccountUserSplit */ +typedef struct _PurpleAccountUserSplit PurpleAccountUserSplit; -/** - * A username split. - * - * This is used by some protocols to separate the fields of the username - * into more human-readable components. - */ -typedef struct -{ - char *text; /**< The text that will appear to the user. */ - char *default_value; /**< The default value. */ - char field_sep; /**< The field separator. */ - gboolean reverse; /**< TRUE if the separator should be found - starting a the end of the string, FALSE - otherwise */ - -} PurpleAccountUserSplit; #ifdef __cplusplus extern "C" { -- cgit v1.2.1 From 5b4cb9c2e1c0b3c2e06ee7bd9bd2434e00b2b5fe Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 18:21:43 +0000 Subject: Convert libpurple and protocol prpl's to use the purple_account_* accessor functions. --- libpurple/blist.c | 4 +- libpurple/connection.c | 2 +- libpurple/conversation.c | 4 +- libpurple/dbus-useful.c | 2 +- libpurple/example/nullclient.c | 2 +- libpurple/log.c | 2 +- libpurple/pounce.c | 2 +- libpurple/privacy.c | 22 +++---- libpurple/protocols/jabber/jabber.c | 3 +- libpurple/protocols/msn/msn.c | 6 +- libpurple/protocols/mxit/actions.c | 4 +- libpurple/protocols/mxit/cipher.c | 9 +-- libpurple/protocols/mxit/login.c | 19 +++++- libpurple/protocols/mxit/protocol.c | 2 +- libpurple/protocols/myspace/myspace.c | 18 +++--- libpurple/protocols/novell/novell.c | 10 ++-- libpurple/protocols/null/nullprpl.c | 94 +++++++++++++++--------------- libpurple/protocols/oscar/family_feedbag.c | 4 +- libpurple/protocols/oscar/family_icbm.c | 6 +- libpurple/protocols/oscar/oscar.c | 10 ++-- libpurple/protocols/sametime/sametime.c | 4 +- libpurple/protocols/silc/silc.c | 2 +- libpurple/protocols/yahoo/libymsg.c | 18 +++--- libpurple/savedstatuses.c | 2 +- 24 files changed, 132 insertions(+), 119 deletions(-) diff --git a/libpurple/blist.c b/libpurple/blist.c index bc922a78b2..8d888c510d 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -314,7 +314,7 @@ accountprivacy_to_xmlnode(PurpleAccount *account) node = xmlnode_new("account"); xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); xmlnode_set_attrib(node, "name", purple_account_get_username(account)); - g_snprintf(buf, sizeof(buf), "%d", account->perm_deny); + g_snprintf(buf, sizeof(buf), "%d", purple_account_get_privacy_type(account)); xmlnode_set_attrib(node, "mode", buf); for (cur = account->permit; cur; cur = cur->next) @@ -641,7 +641,7 @@ purple_blist_load() continue; imode = atoi(mode); - account->perm_deny = (imode != 0 ? imode : PURPLE_PRIVACY_ALLOW_ALL); + purple_account_set_privacy_type(account, (imode != 0 ? imode : PURPLE_PRIVACY_ALLOW_ALL)); for (x = anode->child; x; x = x->next) { char *name; diff --git a/libpurple/connection.c b/libpurple/connection.c index f6d37c76bd..aa65adfeb6 100644 --- a/libpurple/connection.c +++ b/libpurple/connection.c @@ -440,7 +440,7 @@ purple_connection_get_password(const PurpleConnection *gc) { g_return_val_if_fail(gc != NULL, NULL); - return gc->password ? gc->password : gc->account->password; + return gc->password ? gc->password : purple_account_get_password(gc->account); } const char * diff --git a/libpurple/conversation.c b/libpurple/conversation.c index a479b50597..e28f88931c 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -372,7 +372,7 @@ add_message_to_history(PurpleConversation *conv, const char *who, const char *al if (gc) me = purple_connection_get_display_name(gc); if (!me) - me = conv->account->username; + me = purple_account_get_username(conv->account); who = me; } @@ -1100,7 +1100,7 @@ purple_conversation_write(PurpleConversation *conv, const char *who, purple_account_get_username(account)); if (purple_account_get_alias(account) != NULL) - alias = account->alias; + alias = purple_account_get_alias(account); else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b))) alias = purple_buddy_get_contact_alias(b); else if (purple_connection_get_display_name(gc) != NULL) diff --git a/libpurple/dbus-useful.c b/libpurple/dbus-useful.c index b288887b1f..4a685fc88f 100644 --- a/libpurple/dbus-useful.c +++ b/libpurple/dbus-useful.c @@ -25,7 +25,7 @@ purple_accounts_find_ext(const char *name, const char *protocol_id, if (who && strcmp(purple_normalize(NULL, purple_account_get_username(account)), who)) continue; - if (protocol_id && strcmp(account->protocol_id, protocol_id)) + if (protocol_id && strcmp(purple_account_get_protocol_id(account), protocol_id)) continue; if (account_test && !account_test(account)) diff --git a/libpurple/example/nullclient.c b/libpurple/example/nullclient.c index 31fc0a230f..113fcf8e2e 100644 --- a/libpurple/example/nullclient.c +++ b/libpurple/example/nullclient.c @@ -237,7 +237,7 @@ static void signed_on(PurpleConnection *gc, gpointer null) { PurpleAccount *account = purple_connection_get_account(gc); - printf("Account connected: %s %s\n", account->username, account->protocol_id); + printf("Account connected: %s %s\n", purple_account_get_username(account), purple_account_get_protocol_id(account)); } static void diff --git a/libpurple/log.c b/libpurple/log.c index 41a1890fcf..22a2933f78 100644 --- a/libpurple/log.c +++ b/libpurple/log.c @@ -1103,7 +1103,7 @@ static void log_get_log_sets_common(GHashTable *sets) /* Find the account for username in the list of accounts for protocol. */ username_unescaped = purple_unescape_filename(username); for (account_iter = g_list_first(accounts) ; account_iter != NULL ; account_iter = account_iter->next) { - if (purple_strequal(((PurpleAccount *)account_iter->data)->username, username_unescaped)) { + if (purple_strequal(purple_account_get_username((PurpleAccount *)account_iter->data), username_unescaped)) { account = account_iter->data; break; } diff --git a/libpurple/pounce.c b/libpurple/pounce.c index c8f5f67436..4130f0087f 100644 --- a/libpurple/pounce.c +++ b/libpurple/pounce.c @@ -205,7 +205,7 @@ pounce_to_xmlnode(PurplePounce *pounce) xmlnode_set_attrib(node, "ui", pounce->ui_type); child = xmlnode_new_child(node, "account"); - xmlnode_set_attrib(child, "protocol", pouncer->protocol_id); + xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(pouncer)); xmlnode_insert_data(child, purple_normalize(pouncer, purple_account_get_username(pouncer)), -1); diff --git a/libpurple/privacy.c b/libpurple/privacy.c index 00dd7e4493..9f9d28838f 100644 --- a/libpurple/privacy.c +++ b/libpurple/privacy.c @@ -264,9 +264,9 @@ purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, gboolean restore) { GSList *list; - PurplePrivacyType type = account->perm_deny; + PurplePrivacyType type = purple_account_get_privacy_type(account); - switch (account->perm_deny) { + switch (type) { case PURPLE_PRIVACY_ALLOW_ALL: return; case PURPLE_PRIVACY_ALLOW_USERS: @@ -287,13 +287,13 @@ purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, } } purple_privacy_permit_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_ALLOW_USERS); break; case PURPLE_PRIVACY_ALLOW_BUDDYLIST: if (!purple_find_buddy(account, who)) { add_all_buddies_to_permit_list(account, local); purple_privacy_permit_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_ALLOW_USERS); } break; default: @@ -301,7 +301,7 @@ purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, } /* Notify the server if the privacy setting was changed */ - if (type != account->perm_deny && purple_account_is_connected(account)) + if (type != purple_account_get_privacy_type(account) && purple_account_is_connected(account)) serv_set_permit_deny(purple_account_get_connection(account)); } @@ -316,9 +316,9 @@ purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, gboolean restore) { GSList *list; - PurplePrivacyType type = account->perm_deny; + PurplePrivacyType type = purple_account_get_privacy_type(account); - switch (account->perm_deny) { + switch (type) { case PURPLE_PRIVACY_ALLOW_ALL: if (!restore) { /* Empty the deny-list. */ @@ -331,7 +331,7 @@ purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, } } purple_privacy_deny_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_DENY_USERS); break; case PURPLE_PRIVACY_ALLOW_USERS: purple_privacy_permit_remove(account, who, local); @@ -345,7 +345,7 @@ purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, if (purple_find_buddy(account, who)) { add_all_buddies_to_permit_list(account, local); purple_privacy_permit_remove(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_ALLOW_USERS); } break; default: @@ -353,7 +353,7 @@ purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, } /* Notify the server if the privacy setting was changed */ - if (type != account->perm_deny && purple_account_is_connected(account)) + if (type != purple_account_get_privacy_type(account) && purple_account_is_connected(account)) serv_set_permit_deny(purple_account_get_connection(account)); } @@ -362,7 +362,7 @@ purple_privacy_check(PurpleAccount *account, const char *who) { GSList *list; - switch (account->perm_deny) { + switch (purple_account_get_privacy_type(account)) { case PURPLE_PRIVACY_ALLOW_ALL: return TRUE; diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 0f26759e46..6b538d941f 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -1872,8 +1872,7 @@ static void jabber_blocklist_parse(JabberStream *js, const char *from, return; /* This is the only privacy method supported by XEP-0191 */ - if (account->perm_deny != PURPLE_PRIVACY_DENY_USERS) - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_DENY_USERS); /* * TODO: When account->deny is something more than a hash table, this can diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index a886cdc901..050f2d46c3 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -813,8 +813,8 @@ msn_send_privacy(PurpleConnection *gc) session = purple_connection_get_protocol_data(gc); cmdproc = session->notification->cmdproc; - if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL || - account->perm_deny == PURPLE_PRIVACY_DENY_USERS) + if (purple_account_get_privacy_type(account) == PURPLE_PRIVACY_ALLOW_ALL || + purple_account_get_privacy_type(account) == PURPLE_PRIVACY_DENY_USERS) trans = msn_transaction_new(cmdproc, "BLP", "%s", "AL"); else trans = msn_transaction_new(cmdproc, "BLP", "%s", "BL"); @@ -1643,7 +1643,7 @@ msn_send_im(PurpleConnection *gc, const char *who, const char *message, purple_debug_info("msn", "prepare to send offline Message\n"); - friendname = msn_encode_mime(account->username); + friendname = msn_encode_mime(purple_account_get_username(account)); msn_oim_prep_send_msg_info(session->oim, purple_account_get_username(account), friendname, who, msgtext); diff --git a/libpurple/protocols/mxit/actions.c b/libpurple/protocols/mxit/actions.c index db36259b3d..35ad2ad747 100644 --- a/libpurple/protocols/mxit/actions.c +++ b/libpurple/protocols/mxit/actions.c @@ -372,12 +372,12 @@ static void mxit_change_pin_action( PurplePluginAction* action ) purple_request_fields_add_group( fields, group ); /* pin */ - field = purple_request_field_string_new( "pin", _( "PIN" ), session->acc->password, FALSE ); + field = purple_request_field_string_new( "pin", _( "PIN" ), purple_account_get_password( session->acc ), FALSE ); purple_request_field_string_set_masked( field, TRUE ); purple_request_field_group_add_field( group, field ); /* verify pin */ - field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), session->acc->password, FALSE ); + field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), purple_account_get_password( session->acc ), FALSE ); purple_request_field_string_set_masked( field, TRUE ); purple_request_field_group_add_field( group, field ); diff --git a/libpurple/protocols/mxit/cipher.c b/libpurple/protocols/mxit/cipher.c index 9dba336ece..f079cc2cc3 100644 --- a/libpurple/protocols/mxit/cipher.c +++ b/libpurple/protocols/mxit/cipher.c @@ -79,7 +79,8 @@ static void padding_remove( GString* data ) static char* transport_layer_key( struct MXitSession* session ) { static char key[16 + 1]; - int passlen = strlen( session->acc->password ); + const char* password = purple_account_get_password( session->acc ); + int passlen = strlen( password ); /* initialize with initial key */ g_strlcpy( key, INITIAL_KEY, sizeof( key ) ); @@ -89,9 +90,9 @@ static char* transport_layer_key( struct MXitSession* session ) /* add last 8 characters of the PIN (no padding if less characters) */ if ( passlen <= 8 ) - memcpy( key + 8, session->acc->password, passlen ); + memcpy( key + 8, password, passlen ); else - memcpy( key + 8, session->acc->password + ( passlen - 8 ), 8 ); + memcpy( key + 8, password + ( passlen - 8 ), 8 ); return key; } @@ -124,7 +125,7 @@ char* mxit_encrypt_password( struct MXitSession* session ) /* build the secret data to be encrypted: SECRET_HEADER + password */ pass = g_string_new( SECRET_HEADER ); - g_string_append( pass, session->acc->password ); + g_string_append( pass, purple_account_get_password( session->acc) ); padding_add( pass ); /* add ISO10126 padding */ /* now encrypt the secret. we encrypt each block separately (ECB mode) */ diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index 42ee5d5ae6..d156b27952 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -546,9 +546,22 @@ static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* field state = purple_account_get_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); url = g_strdup_printf( "%s?type=getpid&sessionid=%s&login=%s&ver=%i.%i.%i&clientid=%s&cat=%s&chalresp=%s&cc=%s&loc=%s&path=%i&brand=%s&model=%s&h=%i&w=%i&ts=%li", - session->logindata->wapserver, session->logindata->sessionid, purple_url_encode( session->acc->username ), PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_MICRO_VERSION, MXIT_CLIENT_ID, MXIT_CP_ARCH, - captcha_resp, session->logindata->cc, session->logindata->locale, ( state == MXIT_STATE_REGISTER1 ) ? 0 : 1, MXIT_CP_PLATFORM, MXIT_CP_OS, - MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); + session->logindata->wapserver, + session->logindata->sessionid, + purple_url_encode( purple_account_get_username( session->acc ) ), + PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_MICRO_VERSION, + MXIT_CLIENT_ID, + MXIT_CP_ARCH, + captcha_resp, + session->logindata->cc, + session->logindata->locale, + ( state == MXIT_STATE_REGISTER1 ) ? 0 : 1, + MXIT_CP_PLATFORM, + MXIT_CP_OS, + MXIT_CAPTCHA_HEIGHT, + MXIT_CAPTCHA_WIDTH, + time( NULL ) + ); url_data = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_clientinfo2, session ); #ifdef DEBUG_PROTOCOL diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index ac373e2785..697bdf6842 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -458,7 +458,7 @@ static void mxit_queue_packet( struct MXitSession* session, const char* data, in packet->headerlen = 0; /* create generic packet header */ - hlen = snprintf( header, sizeof( header ), "id=%s%c", session->acc->username, CP_REC_TERM ); /* client msisdn */ + hlen = snprintf( header, sizeof( header ), "id=%s%c", purple_account_get_username( session->acc), CP_REC_TERM ); /* client msisdn */ if ( session->http ) { /* http connection only */ diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index f0f24bffd8..fc7c5af340 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -254,7 +254,7 @@ msim_send_bm(MsimSession *session, const gchar *who, const gchar *text, g_return_val_if_fail(who != NULL, FALSE); g_return_val_if_fail(text != NULL, FALSE); - from_username = session->account->username; + from_username = purple_account_get_username(session->account); g_return_val_if_fail(from_username != NULL, FALSE); @@ -705,14 +705,14 @@ msim_login_challenge(MsimSession *session, MsimMessage *msg) purple_connection_update_progress(session->gc, _("Logging in"), 2, 4); response_len = 0; - response = msim_compute_login_response(nc, account->username, account->password, &response_len); + response = msim_compute_login_response(nc, purple_account_get_username(account), purple_account_get_password(account), &response_len); g_free(nc); ret = msim_send(session, "login2", MSIM_TYPE_INTEGER, MSIM_AUTH_ALGORITHM, /* This is actually user's email address. */ - "username", MSIM_TYPE_STRING, g_strdup(account->username), + "username", MSIM_TYPE_STRING, g_strdup(purple_account_get_username(account)), /* GString will be freed in msim_msg_free() in msim_send(). */ "response", MSIM_TYPE_BINARY, g_string_new_len(response, response_len), "clientver", MSIM_TYPE_INTEGER, MSIM_CLIENT_VERSION, @@ -752,8 +752,8 @@ msim_unrecognized(MsimSession *session, MsimMessage *msg, gchar *note) */ purple_debug_info("msim", "Unrecognized data on account for %s\n", - (session && session->account && session->account->username) ? - session->account->username : "(NULL)"); + (session && session->account && purple_account_get_username(session->account)) ? + purple_account_get_username(session->account) : "(NULL)"); if (note) { purple_debug_info("msim", "(Note: %s)\n", note); } @@ -1838,7 +1838,7 @@ msim_error(MsimSession *session, MsimMessage *msg) if (!purple_account_get_remember_password(session->account)) purple_account_set_password(session->account, NULL); #ifdef MSIM_MAX_PASSWORD_LENGTH - if (session->account->password && (strlen(session->account->password) > MSIM_MAX_PASSWORD_LENGTH)) { + if (purple_account_get_password(session->account) && (strlen(purple_account_get_password(session->account)) > MSIM_MAX_PASSWORD_LENGTH)) { gchar *suggestion; suggestion = g_strdup_printf(_("%s Your password is " @@ -1846,7 +1846,7 @@ msim_error(MsimSession *session, MsimMessage *msg) "maximum length of %d. Please shorten your " "password at http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword and try again."), full_errmsg, - strlen(session->account->password), + strlen(purple_account_get_password(session->account)), MSIM_MAX_PASSWORD_LENGTH); /* Replace full_errmsg. */ @@ -2184,9 +2184,9 @@ msim_login(PurpleAccount *acct) int port; g_return_if_fail(acct != NULL); - g_return_if_fail(acct->username != NULL); + g_return_if_fail(purple_account_get_username(acct) != NULL); - purple_debug_info("msim", "logging in %s\n", acct->username); + purple_debug_info("msim", "logging in %s\n", purple_account_get_username(acct)); gc = purple_account_get_connection(acct); purple_connection_set_protocol_data(gc, msim_session_new(acct)); diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index 0983de5ec5..067d0fc8d4 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -1404,15 +1404,15 @@ _sync_privacy_lists(NMUser *user) /* Set the Purple privacy setting */ if (user->default_deny) { if (user->allow_list == NULL) { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_ALL; + purple_account_set_privacy_type(gc->account, PURPLE_PRIVACY_DENY_ALL); } else { - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; + purple_account_set_privacy_type(gc->account, PURPLE_PRIVACY_ALLOW_USERS); } } else { if (user->deny_list == NULL) { - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL; + purple_account_set_privacy_type(gc->account, PURPLE_PRIVACY_ALLOW_ALL); } else { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; + purple_account_set_privacy_type(gc->account, PURPLE_PRIVACY_DENY_USERS); } } @@ -3253,7 +3253,7 @@ novell_set_permit_deny(PurpleConnection *gc) return; } - switch (gc->account->perm_deny) { + switch (purple_account_get_privacy_type(gc->account)) { case PURPLE_PRIVACY_ALLOW_ALL: rc = nm_send_set_privacy_default(user, FALSE, diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index 20685d9720..7e968c5cf3 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -113,7 +113,7 @@ static void call_if_nullprpl(gpointer data, gpointer userdata) { PurpleConnection *gc = (PurpleConnection *)(data); GcFuncData *gcfdata = (GcFuncData *)userdata; - if (!strcmp(gc->account->protocol_id, NULLPRPL_ID)) + if (!strcmp(purple_account_get_protocol_id(gc->account), NULLPRPL_ID)) gcfdata->fn(gcfdata->from, gc, gcfdata->userdata); } @@ -160,8 +160,8 @@ static void foreach_gc_in_chat(ChatFunc fn, PurpleConnection *from, static void discover_status(PurpleConnection *from, PurpleConnection *to, gpointer userdata) { - const char *from_username = from->account->username; - const char *to_username = to->account->username; + const char *from_username = purple_account_get_username(from->account); + const char *to_username = purple_account_get_username(to->account); if (purple_find_buddy(from->account, to_username)) { PurpleStatus *status = purple_account_get_active_status(to->account); @@ -186,7 +186,7 @@ static void discover_status(PurpleConnection *from, PurpleConnection *to, static void report_status_change(PurpleConnection *from, PurpleConnection *to, gpointer userdata) { purple_debug_info("nullprpl", "notifying %s that %s changed status\n", - to->account->username, from->account->username); + purple_account_get_username(to->account), purple_account_get_username(from->account)); discover_status(to, from, NULL); } @@ -199,7 +199,7 @@ static void nullprpl_input_user_info(PurplePluginAction *action) PurpleConnection *gc = (PurpleConnection *)action->context; PurpleAccount *acct = purple_connection_get_account(gc); purple_debug_info("nullprpl", "showing 'Set User Info' dialog for %s\n", - acct->username); + purple_account_get_username(acct)); purple_account_request_change_user_info(acct); } @@ -225,7 +225,7 @@ static const char *nullprpl_list_icon(PurpleAccount *acct, PurpleBuddy *buddy) static char *nullprpl_status_text(PurpleBuddy *buddy) { purple_debug_info("nullprpl", "getting %s's status text for %s\n", - buddy->name, buddy->account->username); + buddy->name, purple_account_get_username(buddy->account)); if (purple_find_buddy(buddy->account, buddy->name)) { PurplePresence *presence = purple_buddy_get_presence(buddy); @@ -287,7 +287,7 @@ static GList *nullprpl_status_types(PurpleAccount *acct) PurpleStatusType *type; purple_debug_info("nullprpl", "returning status types for %s: %s, %s, %s\n", - acct->username, + purple_account_get_username(acct), NULL_STATUS_ONLINE, NULL_STATUS_AWAY, NULL_STATUS_OFFLINE); type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, @@ -366,7 +366,7 @@ static void nullprpl_login(PurpleAccount *acct) PurpleConnection *gc = purple_account_get_connection(acct); GList *offline_messages; - purple_debug_info("nullprpl", "logging in %s\n", acct->username); + purple_debug_info("nullprpl", "logging in %s\n", purple_account_get_username(acct)); purple_connection_update_progress(gc, _("Connecting"), 0, /* which connection step this is */ @@ -385,12 +385,12 @@ static void nullprpl_login(PurpleAccount *acct) /* fetch stored offline messages */ purple_debug_info("nullprpl", "checking for offline messages for %s\n", - acct->username); - offline_messages = g_hash_table_lookup(goffline_messages, acct->username); + purple_account_get_username(acct)); + offline_messages = g_hash_table_lookup(goffline_messages, purple_account_get_username(acct)); while (offline_messages) { GOfflineMessage *message = (GOfflineMessage *)offline_messages->data; purple_debug_info("nullprpl", "delivering offline message to %s: %s\n", - acct->username, message->message); + purple_account_get_username(acct), message->message); serv_got_im(gc, message->from, message->message, message->flags, message->mtime); offline_messages = g_list_next(offline_messages); @@ -401,7 +401,7 @@ static void nullprpl_login(PurpleAccount *acct) } g_list_free(offline_messages); - g_hash_table_remove(goffline_messages, &acct->username); + g_hash_table_remove(goffline_messages, purple_account_get_username(acct)); } static void nullprpl_close(PurpleConnection *gc) @@ -413,7 +413,7 @@ static void nullprpl_close(PurpleConnection *gc) static int nullprpl_send_im(PurpleConnection *gc, const char *who, const char *message, PurpleMessageFlags flags) { - const char *from_username = gc->account->username; + const char *from_username = purple_account_get_username(gc->account); PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND) | PURPLE_MESSAGE_RECV); PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); @@ -423,7 +423,7 @@ static int nullprpl_send_im(PurpleConnection *gc, const char *who, from_username, who, message); /* is the sender blocked by the recipient's privacy settings? */ - if (to_acct && !purple_privacy_check(to_acct, gc->account->username)) { + if (to_acct && !purple_privacy_check(to_acct, purple_account_get_username(gc->account))) { char *msg = g_strdup_printf( _("Your message was blocked by %s's privacy settings."), who); purple_debug_info("nullprpl", @@ -461,7 +461,7 @@ static int nullprpl_send_im(PurpleConnection *gc, const char *who, static void nullprpl_set_info(PurpleConnection *gc, const char *info) { purple_debug_info("nullprpl", "setting %s's user info to %s\n", - gc->account->username, info); + purple_account_get_username(gc->account), info); } static const char *typing_state_to_string(PurpleTypingState typing) { @@ -475,10 +475,10 @@ static const char *typing_state_to_string(PurpleTypingState typing) { static void notify_typing(PurpleConnection *from, PurpleConnection *to, gpointer typing) { - const char *from_username = from->account->username; + const char *from_username = purple_account_get_username(from->account); const char *action = typing_state_to_string((PurpleTypingState)typing); purple_debug_info("nullprpl", "notifying %s that %s %s\n", - to->account->username, from_username, action); + purple_account_get_username(to->account), from_username, action); serv_got_typing(to, from_username, @@ -489,7 +489,7 @@ static void notify_typing(PurpleConnection *from, PurpleConnection *to, static unsigned int nullprpl_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState typing) { - purple_debug_info("nullprpl", "%s %s\n", gc->account->username, + purple_debug_info("nullprpl", "%s %s\n", purple_account_get_username(gc->account), typing_state_to_string(typing)); foreach_nullprpl_gc(notify_typing, gc, (gpointer)typing); return 0; @@ -501,7 +501,7 @@ static void nullprpl_get_info(PurpleConnection *gc, const char *username) { PurpleAccount *acct; purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username, - gc->account->username); + purple_account_get_username(gc->account)); if (!get_nullprpl_gc(username)) { char *msg = g_strdup_printf(_("%s is not logged in."), username); @@ -529,28 +529,28 @@ static void nullprpl_get_info(PurpleConnection *gc, const char *username) { static void nullprpl_set_status(PurpleAccount *acct, PurpleStatus *status) { const char *msg = purple_status_get_attr_string(status, "message"); purple_debug_info("nullprpl", "setting %s's status to %s: %s\n", - acct->username, purple_status_get_name(status), msg); + purple_account_get_username(acct), purple_status_get_name(status), msg); - foreach_nullprpl_gc(report_status_change, get_nullprpl_gc(acct->username), + foreach_nullprpl_gc(report_status_change, get_nullprpl_gc(purple_account_get_username(acct)), NULL); } static void nullprpl_set_idle(PurpleConnection *gc, int idletime) { purple_debug_info("nullprpl", "purple reports that %s has been idle for %d seconds\n", - gc->account->username, idletime); + purple_account_get_username(gc->account), idletime); } static void nullprpl_change_passwd(PurpleConnection *gc, const char *old_pass, const char *new_pass) { purple_debug_info("nullprpl", "%s wants to change their password\n", - gc->account->username); + purple_account_get_username(gc->account)); } static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(gc->account); PurpleConnection *buddy_gc = get_nullprpl_gc(buddy->name); purple_debug_info("nullprpl", "adding %s to %s's buddy list\n", buddy->name, @@ -594,7 +594,7 @@ static void nullprpl_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { purple_debug_info("nullprpl", "removing %s from %s's buddy list\n", - buddy->name, gc->account->username); + buddy->name, purple_account_get_username(gc->account)); } static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, @@ -620,22 +620,22 @@ static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, */ static void nullprpl_add_permit(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s adds %s to their allowed list\n", - gc->account->username, name); + purple_account_get_username(gc->account), name); } static void nullprpl_add_deny(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s adds %s to their blocked list\n", - gc->account->username, name); + purple_account_get_username(gc->account), name); } static void nullprpl_rem_permit(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s removes %s from their allowed list\n", - gc->account->username, name); + purple_account_get_username(gc->account), name); } static void nullprpl_rem_deny(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s removes %s from their blocked list\n", - gc->account->username, name); + purple_account_get_username(gc->account), name); } static void nullprpl_set_permit_deny(PurpleConnection *gc) { @@ -668,7 +668,7 @@ static void joined_chat(PurpleConvChat *from, PurpleConvChat *to, } static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(gc->account); const char *room = g_hash_table_lookup(components, "room"); int chat_id = g_str_hash(room); purple_debug_info("nullprpl", "%s is joining chat room %s\n", username, room); @@ -692,7 +692,7 @@ static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { static void nullprpl_reject_chat(PurpleConnection *gc, GHashTable *components) { const char *invited_by = g_hash_table_lookup(components, "invited_by"); const char *room = g_hash_table_lookup(components, "room"); - const char *username = gc->account->username; + const char *username = purple_account_get_username(gc->account); PurpleConnection *invited_by_gc = get_nullprpl_gc(invited_by); char *message = g_strdup_printf( "%s %s %s.", @@ -719,7 +719,7 @@ static char *nullprpl_get_chat_name(GHashTable *components) { static void nullprpl_chat_invite(PurpleConnection *gc, int id, const char *message, const char *who) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(gc->account); PurpleConversation *conv = purple_find_chat(gc, id); const char *room = purple_conversation_get_name(conv); PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); @@ -762,7 +762,7 @@ static void left_chat_room(PurpleConvChat *from, PurpleConvChat *to, static void nullprpl_chat_leave(PurpleConnection *gc, int id) { PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "%s is leaving chat room %s\n", - gc->account->username, purple_conversation_get_name(conv)); + purple_account_get_username(gc->account), purple_conversation_get_name(conv)); /* tell everyone that we left */ foreach_gc_in_chat(left_chat_room, gc, id, NULL); @@ -789,7 +789,7 @@ static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, return PURPLE_CMD_RET_FAILED; } - from_username = purple_conversation_get_account(conv)->username; + from_username = purple_account_get_username(purple_conversation_get_account(conv)); purple_debug_info("nullprpl", "%s whispers to %s in chat room %s: %s\n", from_username, to_username, purple_conversation_get_name(conv), message); @@ -821,7 +821,7 @@ static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, const char *message) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(gc->account); PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "%s receives whisper from %s in chat room %s: %s\n", @@ -846,7 +846,7 @@ static void receive_chat_message(PurpleConvChat *from, PurpleConvChat *to, static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(gc->account); PurpleConversation *conv = purple_find_chat(gc, id); if (conv) { @@ -868,14 +868,14 @@ static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, static void nullprpl_register_user(PurpleAccount *acct) { purple_debug_info("nullprpl", "registering account for %s\n", - acct->username); + purple_account_get_username(acct)); } static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) { PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "retrieving %s's info for %s in chat room %s\n", who, - gc->account->username, purple_conversation_get_name(conv)); + purple_account_get_username(gc->account), purple_conversation_get_name(conv)); nullprpl_get_info(gc, who); } @@ -883,25 +883,25 @@ static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) static void nullprpl_alias_buddy(PurpleConnection *gc, const char *who, const char *alias) { purple_debug_info("nullprpl", "%s sets %s's alias to %s\n", - gc->account->username, who, alias); + purple_account_get_username(gc->account), who, alias); } static void nullprpl_group_buddy(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group) { purple_debug_info("nullprpl", "%s has moved %s from group %s to group %s\n", - gc->account->username, who, old_group, new_group); + purple_account_get_username(gc->account), who, old_group, new_group); } static void nullprpl_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) { purple_debug_info("nullprpl", "%s has renamed group %s to %s\n", - gc->account->username, old_name, group->name); + purple_account_get_username(gc->account), old_name, group->name); } static void nullprpl_convo_closed(PurpleConnection *gc, const char *who) { purple_debug_info("nullprpl", "%s's conversation with %s was closed\n", - gc->account->username, who); + purple_account_get_username(gc->account), who); } /* normalize a username (e.g. remove whitespace, add default domain, etc.) @@ -915,20 +915,20 @@ static const char *nullprpl_normalize(const PurpleAccount *acct, static void nullprpl_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) { purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n", - gc->account->username, + purple_account_get_username(gc->account), img ? purple_imgstore_get_filename(img) : "(null)"); } static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { purple_debug_info("nullprpl", "%s has removed group %s\n", - gc->account->username, group->name); + purple_account_get_username(gc->account), group->name); } static void set_chat_topic_fn(PurpleConvChat *from, PurpleConvChat *to, int id, const char *room, gpointer userdata) { const char *topic = (const char *)userdata; - const char *username = purple_conversation_get_account(purple_conv_chat_get_conversation(from))->username; + const char *username = purple_account_get_username(purple_conversation_get_account(purple_conv_chat_get_conversation(from))); char *msg; purple_conv_chat_set_topic(to, username, topic); @@ -954,7 +954,7 @@ static void nullprpl_set_chat_topic(PurpleConnection *gc, int id, return; purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", - gc->account->username, purple_conversation_get_name(conv), topic); + purple_account_get_username(gc->account), purple_conversation_get_name(conv), topic); last_topic = purple_conv_chat_get_topic(chat); if ((!topic && !last_topic) || @@ -970,7 +970,7 @@ static gboolean nullprpl_finish_get_roomlist(gpointer roomlist) { } static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(gc->account); PurpleRoomlist *roomlist = purple_roomlist_new(gc->account); GList *fields = NULL; PurpleRoomlistField *field; diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c index 9f3cfca269..06e278567e 100644 --- a/libpurple/protocols/oscar/family_feedbag.c +++ b/libpurple/protocols/oscar/family_feedbag.c @@ -661,7 +661,7 @@ static int aim_ssi_sync(OscarData *od) for (cur1 = od->ssi.local.data; cur1; cur1 = cur1->next) aim_ssi_item_debug_append(debugstr, "\t", cur1); purple_debug_misc("oscar", "Dumping item list of account %s:\n%s", - purple_connection_get_account(od->gc)->username, debugstr->str); + purple_account_get_username(purple_connection_get_account(od->gc)), debugstr->str); } } g_string_free(debugstr, TRUE); @@ -1284,7 +1284,7 @@ static int parsedata(OscarData *od, FlapConnection *conn, aim_module_t *mod, Fla aim_tlvlist_free(data); } purple_debug_misc("oscar", "Reading items from tlvlist for account %s:\n%s", - purple_connection_get_account(od->gc)->username, debugstr->str); + purple_account_get_username(purple_connection_get_account(od->gc)), debugstr->str); g_string_free(debugstr, TRUE); /* Read in the timestamp */ diff --git a/libpurple/protocols/oscar/family_icbm.c b/libpurple/protocols/oscar/family_icbm.c index 2b5a629143..4f748c2679 100644 --- a/libpurple/protocols/oscar/family_icbm.c +++ b/libpurple/protocols/oscar/family_icbm.c @@ -1941,7 +1941,7 @@ int icq_im_xstatus_request(OscarData *od, const char *sn) account = purple_connection_get_account(od->gc); - statxml = g_strdup_printf(fmt, account->username); + statxml = g_strdup_printf(fmt, purple_account_get_username(account)); xmllen = strlen(statxml); aim_icbm_makecookie(cookie); @@ -2035,7 +2035,7 @@ int icq_relay_xstatus(OscarData *od, const char *sn, const guchar *cookie) /* if (!strcmp(account->username, sn)) icq_im_xstatus_request(od, sn); */ - status = purple_presence_get_active_status(account->presence); + status = purple_presence_get_active_status(purple_account_get_presence(account)); if (!status) return -EINVAL; @@ -2051,7 +2051,7 @@ int icq_relay_xstatus(OscarData *od, const char *sn, const guchar *cookie) if (!msg) return -EINVAL; - statxml = g_strdup_printf(fmt, account->username, title, msg); + statxml = g_strdup_printf(fmt, purple_account_get_username(account), title, msg); len = strlen(statxml); purple_debug_misc("oscar", "X-Status AutoReply: %s, %s\n", formatted_msg, msg); diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index da6ee973ef..112e433f5f 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -2816,7 +2816,7 @@ static int purple_parse_locaterights(OscarData *od, FlapConnection *conn, FlapFr od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; aim_locate_setcaps(od, purple_caps); - oscar_set_info_and_status(account, TRUE, account->user_info, TRUE, + oscar_set_info_and_status(account, TRUE, purple_account_get_user_info(account), TRUE, purple_account_get_active_status(account)); return 1; @@ -4108,11 +4108,11 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * */ if (!od->icq && curitem->data) { guint8 perm_deny = aim_ssi_getpermdeny(&od->ssi.local); - if (perm_deny != 0 && perm_deny != account->perm_deny) + if (perm_deny != 0 && perm_deny != purple_account_get_privacy_type(account)) { purple_debug_info("oscar", - "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, perm_deny); - account->perm_deny = perm_deny; + "ssi: changing permdeny from %d to %hhu\n", purple_account_get_privacy_type(account), perm_deny); + purple_account_set_privacy_type(account, perm_deny); } } } break; @@ -4741,7 +4741,7 @@ void oscar_set_aim_permdeny(PurpleConnection *gc) { * values of libpurple's PurplePrivacyType and the values used * by the oscar protocol. */ - aim_ssi_setpermdeny(od, account->perm_deny); + aim_ssi_setpermdeny(od, purple_account_get_privacy_type(account)); } void oscar_add_permit(PurpleConnection *gc, const char *who) { diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index cacadeda41..0a94b351a6 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -4672,7 +4672,7 @@ static void mw_prpl_set_permit_deny(PurpleConnection *gc) { session = pd->session; g_return_if_fail(session != NULL); - switch(acct->perm_deny) { + switch(purple_account_get_privacy_type(acct)) { case PURPLE_PRIVACY_DENY_USERS: DEBUG_INFO("PURPLE_PRIVACY_DENY_USERS\n"); privacy_fill(&privacy, acct->deny); @@ -4696,7 +4696,7 @@ static void mw_prpl_set_permit_deny(PurpleConnection *gc) { break; default: - DEBUG_INFO("acct->perm_deny is 0x%x\n", acct->perm_deny); + DEBUG_INFO("acct->perm_deny is 0x%x\n", purple_account_get_privacy_type(acct)); return; } diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index 1cbe8d0ddd..18eeed314f 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -1593,7 +1593,7 @@ static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, g_free(tmp2); } else buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf, + purple_conv_chat_write(PURPLE_CONV_CHAT(conv), purple_account_get_username(gc->account), buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); g_free(buf); diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 5254d4e4fc..7f7cd5cef9 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -573,7 +573,7 @@ static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT); } else { /* This buddy is on the ignore list (and therefore in no group) */ - purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud); + purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n", purple_account_get_username(account), norm_bud); purple_privacy_deny_add(account, norm_bud, 1); } @@ -748,13 +748,13 @@ static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) } if (got_serv_list && - ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && - (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) && - (account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS))) + ((purple_account_get_privacy_type(account) != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && + (purple_account_get_privacy_type(account) != PURPLE_PRIVACY_DENY_ALL) && + (purple_account_get_privacy_type(account) != PURPLE_PRIVACY_ALLOW_USERS))) { - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_DENY_USERS); purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n", - account->username); + purple_account_get_username(account)); } if (yd->tmp_serv_plist) { @@ -763,7 +763,7 @@ static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) f = yahoo_friend_find(gc, *bud); if (f) { purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", - account->username, *bud); + purple_account_get_username(account), *bud); f->presence = YAHOO_PRESENCE_PERM_OFFLINE; } } @@ -4476,7 +4476,7 @@ static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str); /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) && (purple_proxy_info_get_type(gc->account->proxy_info) == PURPLE_PROXY_HTTP)) + if ((purple_account_get_proxy_info(gc->account)) && (purple_proxy_info_get_type(purple_account_get_proxy_info(gc->account)) == PURPLE_PROXY_HTTP)) use_whole_url = TRUE; url_data = purple_util_fetch_url_request( @@ -5117,7 +5117,7 @@ void yahoo_set_permit_deny(PurpleConnection *gc) account = purple_connection_get_account(gc); - switch (account->perm_deny) + switch (purple_account_get_privacy_type(account)) { case PURPLE_PRIVACY_ALLOW_ALL: for (deny = account->deny; deny; deny = deny->next) diff --git a/libpurple/savedstatuses.c b/libpurple/savedstatuses.c index 40377f7b1a..eaee07ee68 100644 --- a/libpurple/savedstatuses.c +++ b/libpurple/savedstatuses.c @@ -403,7 +403,7 @@ parse_substatus(xmlnode *substatus) if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) { ret->type = purple_status_type_find_with_id( - ret->account->status_types, data); + purple_account_get_status_types(ret->account), data); g_free(data); } -- cgit v1.2.1 From 0a4330c2022a1b38758ae1565f1602460c684743 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 21:04:35 +0000 Subject: Convert code to use the purple_account accessor functions. --- libpurple/conversation.c | 4 ++-- libpurple/protocols/irc/irc.c | 3 ++- libpurple/protocols/jabber/jabber.c | 4 ++-- libpurple/protocols/msn/contact.c | 4 ++-- libpurple/protocols/msn/error.c | 2 +- libpurple/protocols/msn/httpconn.c | 6 ++++-- libpurple/protocols/msn/msg.c | 14 ++++++++------ libpurple/protocols/msn/nexus.c | 2 +- libpurple/protocols/msn/notification.c | 10 +++++----- libpurple/protocols/msn/oim.c | 4 ++-- libpurple/protocols/msn/servconn.c | 6 ++++-- libpurple/protocols/msn/session.c | 2 +- libpurple/protocols/msn/switchboard.c | 4 ++-- libpurple/protocols/msn/user.c | 2 +- libpurple/protocols/myspace/myspace.c | 4 ++-- libpurple/protocols/silc/silc.c | 2 +- libpurple/protocols/yahoo/libymsg.c | 2 +- libpurple/protocols/zephyr/zephyr.c | 2 +- pidgin/gtkblist.c | 22 +++++++++++----------- pidgin/gtkconv.c | 14 +++++++------- pidgin/gtkpounce.c | 4 ++-- pidgin/gtkprivacy.c | 10 +++++----- pidgin/plugins/adiumthemes/webkit.c | 2 +- pidgin/plugins/xmppconsole.c | 4 ++-- 24 files changed, 70 insertions(+), 63 deletions(-) diff --git a/libpurple/conversation.c b/libpurple/conversation.c index e28f88931c..b0dc1b2437 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -526,7 +526,7 @@ purple_conversation_new(PurpleConversationType type, PurpleAccount *account, chats = g_list_prepend(chats, conv); - if ((disp = purple_connection_get_display_name(account->gc))) + if ((disp = purple_connection_get_display_name(purple_account_get_connection(account)))) purple_conv_chat_set_nick(conv->u.chat, disp); else purple_conv_chat_set_nick(conv->u.chat, @@ -815,7 +815,7 @@ purple_conversation_get_gc(const PurpleConversation *conv) if (account == NULL) return NULL; - return account->gc; + return purple_account_get_connection(account); } void diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index cee9acc3a6..b770c73041 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -645,9 +645,10 @@ static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGro static void read_input(struct irc_conn *irc, int len) { + PurpleConnection *connection = purple_account_get_connection(irc->account); char *cur, *end; - irc->account->gc->last_received = time(NULL); + connection->last_received = time(NULL); irc->inbufused += len; irc->inbuf[irc->inbufused] = '\0'; diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 6b538d941f..59c1b438d0 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -3163,7 +3163,7 @@ static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { PurpleAccount *account = purple_conversation_get_account(conv); - JabberStream *js = purple_connection_get_protocol_data(account->gc); + JabberStream *js = purple_connection_get_protocol_data(purple_account_get_connection(account)); const gchar *who; gchar *description; PurpleBuddy *buddy; @@ -3575,7 +3575,7 @@ jabber_cmd_mood(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { PurpleAccount *account = purple_conversation_get_account(conv); - JabberStream *js = purple_connection_get_protocol_data(account->gc); + JabberStream *js = purple_connection_get_protocol_data(purple_account_get_connection(account)); if (js->pep) { /* if no argument was given, unset mood */ diff --git a/libpurple/protocols/msn/contact.c b/libpurple/protocols/msn/contact.c index 33a1c3c9ea..3349d37864 100644 --- a/libpurple/protocols/msn/contact.c +++ b/libpurple/protocols/msn/contact.c @@ -968,7 +968,7 @@ msn_get_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) purple_debug_misc("msn", "Got the Address Book!\n"); if (msn_parse_addressbook(session, resp->xml)) { - msn_send_privacy(session->account->gc); + msn_send_privacy(purple_account_get_connection(session->account)); msn_notification_dump_contact(session); } else { /* This is making us loop infinitely when we fail to parse the @@ -1251,7 +1251,7 @@ msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state, body = g_markup_escape_text(user->invite_message, -1); /* Ignore the cast, we treat it as const anyway. */ - tmp = (char *)purple_connection_get_display_name(session->account->gc); + tmp = (char *)purple_connection_get_display_name(purple_account_get_connection(session->account)); tmp = tmp ? g_markup_escape_text(tmp, -1) : g_strdup(""); invite = g_strdup_printf(MSN_CONTACT_INVITE_MESSAGE_XML, body, tmp); diff --git a/libpurple/protocols/msn/error.c b/libpurple/protocols/msn/error.c index 68690ef384..18df67a8d5 100644 --- a/libpurple/protocols/msn/error.c +++ b/libpurple/protocols/msn/error.c @@ -274,7 +274,7 @@ msn_error_handle(MsnSession *session, unsigned int type) if (debug) purple_debug_warning("msn", "error %d: %s\n", type, buf); else - purple_notify_error(session->account->gc, NULL, buf, NULL); + purple_notify_error(purple_account_get_connection(session->account), NULL, buf, NULL); g_free(buf); } diff --git a/libpurple/protocols/msn/httpconn.c b/libpurple/protocols/msn/httpconn.c index 5bdcd61c15..a750d5369d 100644 --- a/libpurple/protocols/msn/httpconn.c +++ b/libpurple/protocols/msn/httpconn.c @@ -285,8 +285,10 @@ read_cb(gpointer data, gint source, PurpleInputCondition cond) httpconn = data; servconn = httpconn->servconn; - if (servconn->type == MSN_SERVCONN_NS) - servconn->session->account->gc->last_received = time(NULL); + if (servconn->type == MSN_SERVCONN_NS) { + PurpleConnection *gc = purple_account_get_connection(servconn->session); + gc->last_received = time(NULL); + } len = read(httpconn->fd, buf, sizeof(buf) - 1); if (len < 0 && errno == EAGAIN) diff --git a/libpurple/protocols/msn/msg.c b/libpurple/protocols/msn/msg.c index f5f3fc300f..494131a1aa 100644 --- a/libpurple/protocols/msn/msg.c +++ b/libpurple/protocols/msn/msg.c @@ -627,7 +627,7 @@ msn_plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) const char *passport; const char *value; - gc = cmdproc->session->account->gc; + gc = purple_account_get_connection(cmdproc->session->account); body = msn_message_get_bin_data(msg, &body_len); body_enc = g_markup_escape_text(body, body_len); @@ -713,7 +713,7 @@ msn_control_msg(MsnCmdProc *cmdproc, MsnMessage *msg) PurpleConnection *gc; char *passport; - gc = cmdproc->session->account->gc; + gc = purple_account_get_connection(cmdproc->session->account); passport = msg->remote_user; if (msn_message_get_header_value(msg, "TypingUser") == NULL) @@ -762,7 +762,7 @@ datacast_inform_user(MsnSwitchBoard *swboard, const char *who, if (swboard->conv == NULL) { if (chat) - swboard->conv = purple_find_chat(account->gc, swboard->chat_id); + swboard->conv = purple_find_chat(purple_account_get_connection(account), swboard->chat_id); else { swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); @@ -991,21 +991,23 @@ msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg) /* Nudge */ PurpleAccount *account; const char *user; + PurpleConnection *gc; account = cmdproc->session->account; user = msg->remote_user; + gc = purple_account_get_connection(account); if (cmdproc->servconn->type == MSN_SERVCONN_SB) { MsnSwitchBoard *swboard = cmdproc->data; if (swboard->current_users > 1 || ((swboard->conv != NULL) && purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - purple_prpl_got_attention_in_chat(account->gc, swboard->chat_id, user, MSN_NUDGE); + purple_prpl_got_attention_in_chat(gc, swboard->chat_id, user, MSN_NUDGE); else - purple_prpl_got_attention(account->gc, user, MSN_NUDGE); + purple_prpl_got_attention(gc, user, MSN_NUDGE); } else { - purple_prpl_got_attention(account->gc, user, MSN_NUDGE); + purple_prpl_got_attention(gc, user, MSN_NUDGE); } } else if (!strcmp(id, "2")) { diff --git a/libpurple/protocols/msn/nexus.c b/libpurple/protocols/msn/nexus.c index 968e44f6b1..7985f66def 100644 --- a/libpurple/protocols/msn/nexus.c +++ b/libpurple/protocols/msn/nexus.c @@ -390,7 +390,7 @@ msn_nexus_connect(MsnNexus *nexus) msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); username = purple_account_get_username(session->account); - password = purple_connection_get_password(session->account->gc); + password = purple_connection_get_password(purple_account_get_connection(session->account)); if (g_utf8_strlen(password, -1) > 16) { /* max byte size for 16 utf8 characters is 64 + 1 for the null */ gchar truncated[65]; diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index d6486b3f88..6af64aa1ba 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -1390,7 +1390,7 @@ url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) session = cmdproc->session; account = session->account; - gc = account->gc; + gc = purple_account_get_connection(account); rru = cmd->params[1]; url = cmd->params[2]; @@ -2011,7 +2011,7 @@ initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) const char *unread; session = cmdproc->session; - gc = session->account->gc; + gc = purple_account_get_connection(session->account); if (strcmp(msg->remote_user, "Hotmail")) /* This isn't an official message. */ @@ -2062,7 +2062,7 @@ initial_mdata_msg(MsnCmdProc *cmdproc, MsnMessage *msg) const char *mdata, *unread; session = cmdproc->session; - gc = session->account->gc; + gc = purple_account_get_connection(session->account); if (strcmp(msg->remote_user, "Hotmail")) /* This isn't an official message. */ @@ -2134,7 +2134,7 @@ email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) char *from, *subject, *tmp; session = cmdproc->session; - gc = session->account->gc; + gc = purple_account_get_connection(session->account); if (strcmp(msg->remote_user, "Hotmail")) /* This isn't an official message. */ @@ -2219,7 +2219,7 @@ system_msg(MsnCmdProc *cmdproc, MsnMessage *msg) } if (*buf != '\0') - purple_notify_info(cmdproc->session->account->gc, NULL, buf, NULL); + purple_notify_info(purple_account_get_connection(cmdproc->session->account), NULL, buf, NULL); } g_hash_table_destroy(table); diff --git a/libpurple/protocols/msn/oim.c b/libpurple/protocols/msn/oim.c index 9aa8c51389..e294244302 100644 --- a/libpurple/protocols/msn/oim.c +++ b/libpurple/protocols/msn/oim.c @@ -695,7 +695,7 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) purple_debug_info("msn", "oim Date:{%s},passport{%s}\n", date, passport); - serv_got_im(rdata->oim->session->account->gc, passport, decode_msg, 0, + serv_got_im(purple_account_get_connection(rdata->oim->session->account), passport, decode_msg, 0, stamp); /*Now get the oim message ID from the oim_list. @@ -785,7 +785,7 @@ msn_parse_oim_xml(MsnOim *oim, xmlnode *node) /* XXX/khc: pretty sure this is wrong */ if (count > 0) - purple_notify_emails(session->account->gc, count, FALSE, NULL, + purple_notify_emails(purple_account_get_connection(session->account), count, FALSE, NULL, NULL, passports, urls, NULL, NULL); g_free(unread); } diff --git a/libpurple/protocols/msn/servconn.c b/libpurple/protocols/msn/servconn.c index 617216cee2..0a692fde1f 100644 --- a/libpurple/protocols/msn/servconn.c +++ b/libpurple/protocols/msn/servconn.c @@ -421,8 +421,10 @@ read_cb(gpointer data, gint source, PurpleInputCondition cond) servconn = data; - if (servconn->type == MSN_SERVCONN_NS) - servconn->session->account->gc->last_received = time(NULL); + if (servconn->type == MSN_SERVCONN_NS) { + PurpleConnection *gc = purple_account_get_connection(servconn->session->account); + gc->last_received = time(NULL); + } len = read(servconn->fd, buf, sizeof(buf) - 1); if (len < 0 && errno == EAGAIN) diff --git a/libpurple/protocols/msn/session.c b/libpurple/protocols/msn/session.c index ff871648ec..d177e453d9 100644 --- a/libpurple/protocols/msn/session.c +++ b/libpurple/protocols/msn/session.c @@ -459,7 +459,7 @@ msn_session_set_login_step(MsnSession *session, MsnLoginStep step) if (session->logged_in) return; - gc = session->account->gc; + gc = purple_account_get_connection(session->account); session->login_step = step; diff --git a/libpurple/protocols/msn/switchboard.c b/libpurple/protocols/msn/switchboard.c index 7fb26ffac1..b459797613 100644 --- a/libpurple/protocols/msn/switchboard.c +++ b/libpurple/protocols/msn/switchboard.c @@ -312,7 +312,7 @@ msn_switchboard_add_user(MsnSwitchBoard *swboard, const char *user) swboard->chat_id = msn_switchboard_get_chat_id(); swboard->flag |= MSN_SB_FLAG_IM; - swboard->conv = serv_got_joined_chat(account->gc, + swboard->conv = serv_got_joined_chat(purple_account_get_connection(account), swboard->chat_id, "MSN Chat"); @@ -750,7 +750,7 @@ out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) PurpleConnection *gc; MsnSwitchBoard *swboard; - gc = cmdproc->session->account->gc; + gc = purple_account_get_connection(cmdproc->session->account); swboard = cmdproc->data; if (swboard->current_users > 1) diff --git a/libpurple/protocols/msn/user.c b/libpurple/protocols/msn/user.c index 8619d2f9b8..afb0988445 100644 --- a/libpurple/protocols/msn/user.c +++ b/libpurple/protocols/msn/user.c @@ -566,7 +566,7 @@ queue_buddy_icon_request(MsnUser *user) return; } - if (!buddy_icon_cached(account->gc, obj)) { + if (!buddy_icon_cached(purple_account_get_connection(account), obj)) { MsnUserList *userlist; userlist = user->userlist; diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index fc7c5af340..08dc80f549 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -2543,7 +2543,7 @@ msim_set_status(PurpleAccount *account, PurpleStatus *status) /* If we should be idle, set that status. Time is irrelevant here. */ if (purple_presence_is_idle(pres) && status_code != MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN) - msim_set_idle(account->gc, 1); + msim_set_idle(purple_account_get_connection(account), 1); } /** @@ -2864,7 +2864,7 @@ static const char *msim_normalize(const PurpleAccount *account, const char *str) const char *username; /* If the account does not exist, we can't look up the user. */ - if (!account || !account->gc) + if (!account || !purple_account_get_connection(account)) return str; id = atol(str); diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index 18eeed314f..5df9097fe8 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -555,7 +555,7 @@ silcpurple_login(PurpleAccount *account) char *username, *hostname, *realname, **up; int i; - gc = account->gc; + gc = purple_account_get_connection(account); if (!gc) return; purple_connection_set_protocol_data(gc, NULL); diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 7f7cd5cef9..e55bb9e635 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -5213,7 +5213,7 @@ yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gcha if (*args && args[0]) return PURPLE_CMD_RET_FAILED; - purple_prpl_send_attention(account->gc, purple_conversation_get_name(c), YAHOO_BUZZ); + purple_prpl_send_attention(purple_account_get_connection(account), purple_conversation_get_name(c), YAHOO_BUZZ); return PURPLE_CMD_RET_OK; } diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 634e03ea40..a9c244f5d3 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -1842,7 +1842,7 @@ static void zephyr_login(PurpleAccount * account) if (zephyr_subscribe_to(zephyr,"MESSAGE","PERSONAL",zephyr->username,NULL) != ZERR_NONE) { /* XXX don't translate this yet. It could be written better */ /* XXX error messages could be handled with more detail */ - purple_notify_error(account->gc, NULL, + purple_notify_error(purple_account_get_connection(account), NULL, "Unable to subscribe to messages", "Unable to subscribe to initial messages"); return; } diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 2fae16b73f..2ae01ffd4c 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -1519,7 +1519,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) if (prpl_info && prpl_info->send_file) { if (!prpl_info->can_receive_file || - prpl_info->can_receive_file(buddy->account->gc, buddy->name)) + prpl_info->can_receive_file(purple_account_get_connection(buddy->account), buddy->name)) { pidgin_new_item_from_stock(menu, _("_Send File..."), PIDGIN_STOCK_TOOLBAR_SEND_FILE, @@ -1547,7 +1547,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL); } - pidgin_append_blist_node_proto_menu(menu, buddy->account->gc, node); + pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(buddy->account), node); pidgin_append_blist_node_extended_menu(menu, node); if (!contact_expanded && contact != NULL) @@ -1600,7 +1600,7 @@ gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) return FALSE; } if(buddy) - pidgin_retrieve_user_info(buddy->account->gc, buddy->name); + pidgin_retrieve_user_info(purple_account_get_connection(buddy->account), buddy->name); } else { switch (event->keyval) { case GDK_F2: @@ -1753,7 +1753,7 @@ create_chat_menu(PurpleBlistNode *node, PurpleChat *c) pidgin_new_item_from_stock(menu, _("View _Log"), NULL, G_CALLBACK(gtk_blist_menu_showlog_cb), node, 0, 0, NULL); - pidgin_append_blist_node_proto_menu(menu, c->account->gc, node); + pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(c->account), node); pidgin_append_blist_node_extended_menu(menu, node); pidgin_separator(menu); @@ -1838,7 +1838,7 @@ create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) if(buddy == b) continue; - if(!buddy->account->gc) + if(!purple_account_get_connection(buddy->account)) continue; if(!show_offline && !PURPLE_BUDDY_IS_ONLINE(buddy)) continue; @@ -1967,7 +1967,7 @@ gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_da prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); if (prpl && prpl_info->get_info) - pidgin_retrieve_user_info(b->account->gc, b->name); + pidgin_retrieve_user_info(purple_account_get_connection(b->account), b->name); handled = TRUE; } @@ -2673,8 +2673,8 @@ static GdkPixbuf *pidgin_blist_get_buddy_icon(PurpleBlistNode *node, account = purple_buddy_get_account(buddy); } - if(account && account->gc) { - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); + if(account && purple_account_get_connection(account)) { + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_account_get_connection(account)->prpl); } #if 0 @@ -3681,7 +3681,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) connections = purple_connections_get_all(); if (connections && connections->next) { - tmp = g_markup_escape_text(chat->account->username, -1); + tmp = g_markup_escape_text(purple_account_get_username(chat->account), -1); g_string_append_printf(str, _("Account: %s"), tmp); g_free(tmp); } @@ -3713,7 +3713,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) } if (prpl_info && prpl_info->chat_info != NULL) - cur = prpl_info->chat_info(chat->account->gc); + cur = prpl_info->chat_info(purple_account_get_connection(chat->account)); else cur = NULL; @@ -4235,7 +4235,7 @@ pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased if (prpl != NULL) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info && prpl_info->status_text && b->account->gc) { + if (prpl_info && prpl_info->status_text && purple_account_get_connection(b->account)) { char *tmp = prpl_info->status_text(b); const char *end; diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 99230b22e9..91dff2d9e5 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1746,7 +1746,7 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc if (buddy != NULL) { if (purple_account_is_connected(account)) - pidgin_append_blist_node_proto_menu(menu, account->gc, + pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(account), (PurpleBlistNode *)buddy); pidgin_append_blist_node_extended_menu(menu, (PurpleBlistNode *)buddy); gtk_widget_show_all(menu); @@ -1772,7 +1772,7 @@ gtkconv_chat_popup_menu_cb(GtkWidget *widget, PidginConversation *gtkconv) gtkconv = PIDGIN_CONVERSATION(conv); gtkchat = gtkconv->u.chat; account = purple_conversation_get_account(conv); - gc = account->gc; + gc = purple_account_get_connection(account); model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); @@ -1808,7 +1808,7 @@ right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, gtkchat = gtkconv->u.chat; account = purple_conversation_get_account(conv); - gc = account->gc; + gc = purple_account_get_connection(account); model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); @@ -2678,7 +2678,7 @@ redraw_icon(gpointer data) gtkconv = PIDGIN_CONVERSATION(conv); account = purple_conversation_get_account(conv); - if (!(account && account->gc)) { + if (!(account && purple_account_get_connection(account))) { gtkconv->u.im->icon_timer = 0; return FALSE; } @@ -3303,7 +3303,7 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea } } else if (node) { if (purple_account_is_connected(account)) - pidgin_append_blist_node_proto_menu(menu, account->gc, node); + pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(account), node); pidgin_append_blist_node_extended_menu(menu, node); } @@ -4770,7 +4770,7 @@ pidgin_conv_userlist_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path, PurpleAccount *account = purple_conversation_get_account(conv); char *who = NULL; - if (account->gc == NULL) + if (purple_account_get_connection(account) == NULL) return FALSE; if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path)) @@ -4778,7 +4778,7 @@ pidgin_conv_userlist_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path, gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_account_get_connection(account)->prpl); node = (PurpleBlistNode*)(purple_find_buddy(purple_conversation_get_account(conv), who)); if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) pidgin_blist_draw_tooltip(node, gtkconv->infopane); diff --git a/pidgin/gtkpounce.c b/pidgin/gtkpounce.c index bb440939f0..dbaca6430a 100644 --- a/pidgin/gtkpounce.c +++ b/pidgin/gtkpounce.c @@ -476,7 +476,7 @@ reset_send_msg_entry(PidginPounceDialog *dialog, GtkWidget *dontcare) { PurpleAccount *account = pidgin_account_option_menu_get_selected(dialog->account_menu); gtk_imhtml_setup_entry(GTK_IMHTML(dialog->send_msg_entry), - (account && account->gc) ? account->gc->flags : PURPLE_CONNECTION_HTML); + (account && purple_account_get_connection(account)) ? purple_account_get_connection(account)->flags : PURPLE_CONNECTION_HTML); } void @@ -1483,7 +1483,7 @@ pounce_cb(PurplePounce *pounce, PurplePounceEvent events, void *data) purple_conversation_write(conv, NULL, message, PURPLE_MESSAGE_SEND, time(NULL)); - serv_send_im(account->gc, (char *)pouncee, (char *)message, 0); + serv_send_im(purple_account_get_connection(account), (char *)pouncee, (char *)message, 0); } } diff --git a/pidgin/gtkprivacy.c b/pidgin/gtkprivacy.c index 78f7278f13..3ed3debbc2 100644 --- a/pidgin/gtkprivacy.c +++ b/pidgin/gtkprivacy.c @@ -211,7 +211,7 @@ select_account_cb(GtkWidget *dropdown, PurpleAccount *account, dialog->account = account; for (i = 0; i < menu_entry_count; i++) { - if (menu_entries[i].num == account->perm_deny) { + if (menu_entries[i].num == purple_account_get_privacy_type(account)) { gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), i); break; } @@ -230,7 +230,7 @@ type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog) { int new_type = menu_entries[gtk_combo_box_get_active(combo)].num; - dialog->account->perm_deny = new_type; + purple_account_set_privacy_type(dialog->account, new_type); serv_set_permit_deny(purple_account_get_connection(dialog->account)); gtk_widget_hide(dialog->allow_widget); @@ -371,7 +371,7 @@ privacy_dialog_new(void) gtk_combo_box_append_text(GTK_COMBO_BOX(dialog->type_menu), _(menu_entries[i].text)); - if (menu_entries[i].num == dialog->account->perm_deny) + if (menu_entries[i].num == purple_account_get_privacy_type(dialog->account)) selected = i; } @@ -411,12 +411,12 @@ privacy_dialog_new(void) type_changed_cb(GTK_COMBO_BOX(dialog->type_menu), dialog); #if 0 - if (dialog->account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) { + if (purple_account_get_privacy_type(dialog->account) == PURPLE_PRIVACY_ALLOW_USERS) { gtk_widget_show(dialog->allow_widget); gtk_widget_show(dialog->button_box); dialog->in_allow_list = TRUE; } - else if (dialog->account->perm_deny == PURPLE_PRIVACY_DENY_USERS) { + else if (purple_account_get_privacy_type(dialog->account) == PURPLE_PRIVACY_DENY_USERS) { gtk_widget_show(dialog->block_widget); gtk_widget_show(dialog->button_box); dialog->in_allow_list = FALSE; diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c index ab1a8fc3f2..b37bd5e780 100644 --- a/pidgin/plugins/adiumthemes/webkit.c +++ b/pidgin/plugins/adiumthemes/webkit.c @@ -452,7 +452,7 @@ webkit_on_displaying_im_msg(PurpleAccount *account, } purple_conversation_set_data(conv, "webkit-lastflags", GINT_TO_POINTER(flags)); - smileyed = smiley_parse_markup(stripped, purple_conversation_get_account(conv)->protocol_id); + smileyed = smiley_parse_markup(stripped, purple_account_get_protocol_id(purple_conversation_get_account(conv))); msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime); escape = gtk_webview_quote_js_string(msg); script = g_strdup_printf("%s(%s)", func, escape); diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index 6fcd66ac91..717edd49ef 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -733,10 +733,10 @@ dropdown_changed_cb(GtkComboBox *widget, gpointer nul) account = purple_accounts_find(gtk_combo_box_get_active_text(GTK_COMBO_BOX(console->dropdown)), "prpl-jabber"); - if (!account || !account->gc) + if (!account || !purple_account_get_connection(account)) return; - console->gc = account->gc; + console->gc = purple_account_get_connection(account); gtk_imhtml_clear(GTK_IMHTML(console->imhtml)); } -- cgit v1.2.1 From 041da1069bea3f2fa9b4e3e23258b50cb2486bc3 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 21:11:11 +0000 Subject: Fix for previous commit. --- libpurple/protocols/msn/httpconn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/msn/httpconn.c b/libpurple/protocols/msn/httpconn.c index a750d5369d..471b15cdbb 100644 --- a/libpurple/protocols/msn/httpconn.c +++ b/libpurple/protocols/msn/httpconn.c @@ -286,7 +286,7 @@ read_cb(gpointer data, gint source, PurpleInputCondition cond) servconn = httpconn->servconn; if (servconn->type == MSN_SERVCONN_NS) { - PurpleConnection *gc = purple_account_get_connection(servconn->session); + PurpleConnection *gc = purple_account_get_connection(servconn->session->account); gc->last_received = time(NULL); } -- cgit v1.2.1 From 585efde70f848a3d94fa92c6c6c0e4043337524a Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 21:32:38 +0000 Subject: _PurpleAccount.ui_data is unused. --- ChangeLog.API | 1 + libpurple/account.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.API b/ChangeLog.API index f91c4ee79a..16396dda58 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -100,6 +100,7 @@ version 3.0.0 (??/??/????): * _GntProgressBarOrientation * _GntTreeColumnFlag * _GntWidgetFlags + * _PurpleAccount.ui_data * _PurpleCipherBatchMode * _PurpleCipherCaps * _PurpleCmdFlag diff --git a/libpurple/account.h b/libpurple/account.h index ced1bff95f..8d173b82cd 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -164,7 +164,6 @@ struct _PurpleAccount PurplePresence *presence; /**< Presence. */ PurpleLog *system_log; /**< The system log */ - void *ui_data; /**< The UI can put data here. */ PurpleAccountRegistrationCb registration_cb; void *registration_cb_user_data; -- cgit v1.2.1 From 1abd812568687dfb50371494fb147449943dc286 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sat, 1 Oct 2011 21:54:15 +0000 Subject: The intention is to make PurpleAccount a private structure in account.c, so merge PurpleAccountPrivate into PurpleAccount. --- libpurple/account.c | 35 ++++++++--------------------------- libpurple/account.h | 2 +- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/libpurple/account.c b/libpurple/account.c index aa7d0540c7..a7926ea1c5 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -41,14 +41,6 @@ #include "util.h" #include "xmlnode.h" -typedef struct -{ - PurpleConnectionErrorInfo *current_error; -} PurpleAccountPrivate; - -#define PURPLE_ACCOUNT_GET_PRIVATE(account) \ - ((PurpleAccountPrivate *) (account->priv)) - /* TODO: Should use PurpleValue instead of this? What about "ui"? */ typedef struct { @@ -361,8 +353,6 @@ current_error_to_xmlnode(PurpleConnectionErrorInfo *err) static xmlnode * account_to_xmlnode(PurpleAccount *account) { - PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - xmlnode *node, *child; const char *tmp; PurplePresence *presence; @@ -419,7 +409,7 @@ account_to_xmlnode(PurpleAccount *account) xmlnode_insert_child(node, child); } - child = current_error_to_xmlnode(priv->current_error); + child = current_error_to_xmlnode(account->current_error); xmlnode_insert_child(node, child); return node; @@ -996,7 +986,6 @@ PurpleAccount * purple_account_new(const char *username, const char *protocol_id) { PurpleAccount *account = NULL; - PurpleAccountPrivate *priv = NULL; PurplePlugin *prpl = NULL; PurplePluginProtocolInfo *prpl_info = NULL; PurpleStatusType *status_type; @@ -1011,8 +1000,6 @@ purple_account_new(const char *username, const char *protocol_id) account = g_new0(PurpleAccount, 1); PURPLE_DBUS_REGISTER_POINTER(account, PurpleAccount); - priv = g_new0(PurpleAccountPrivate, 1); - account->priv = priv; purple_account_set_username(account, username); @@ -1055,7 +1042,6 @@ purple_account_new(const char *username, const char *protocol_id) void purple_account_destroy(PurpleAccount *account) { - PurpleAccountPrivate *priv = NULL; GList *l; g_return_if_fail(account != NULL); @@ -1102,13 +1088,11 @@ purple_account_destroy(PurpleAccount *account) account->permit = g_slist_delete_link(account->permit, account->permit); } - priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - PURPLE_DBUS_UNREGISTER_POINTER(priv->current_error); - if (priv->current_error) { - g_free(priv->current_error->description); - g_free(priv->current_error); + PURPLE_DBUS_UNREGISTER_POINTER(account->current_error); + if (account->current_error) { + g_free(account->current_error->description); + g_free(account->current_error); } - g_free(priv); PURPLE_DBUS_UNREGISTER_POINTER(account); g_free(account); @@ -2709,18 +2693,16 @@ signed_off_cb(PurpleConnection *gc, static void set_current_error(PurpleAccount *account, PurpleConnectionErrorInfo *new_err) { - PurpleAccountPrivate *priv; PurpleConnectionErrorInfo *old_err; g_return_if_fail(account != NULL); - priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - old_err = priv->current_error; + old_err = account->current_error; if(new_err == old_err) return; - priv->current_error = new_err; + account->current_error = new_err; purple_signal_emit(purple_accounts_get_handle(), "account-error-changed", @@ -2762,8 +2744,7 @@ connection_error_cb(PurpleConnection *gc, const PurpleConnectionErrorInfo * purple_account_get_current_error(PurpleAccount *account) { - PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - return priv->current_error; + return account->current_error; } void diff --git a/libpurple/account.h b/libpurple/account.h index 8d173b82cd..34cc5f197b 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -167,7 +167,7 @@ struct _PurpleAccount PurpleAccountRegistrationCb registration_cb; void *registration_cb_user_data; - gpointer priv; /**< Pointer to opaque private data. */ + PurpleConnectionErrorInfo *current_error; /**< Errors */ }; #ifdef __cplusplus -- cgit v1.2.1 From da2ee5646d2046061275872b34a540576b0ff478 Mon Sep 17 00:00:00 2001 From: Kevin Stange Date: Sat, 1 Oct 2011 23:24:41 +0000 Subject: disapproval of revision 'c11d59fa749fd2299edf12c187847f8956ed11ad' Just because Pidgin and Finch don't use this, doesn't mean a third party won't need it --- ChangeLog.API | 1 - libpurple/account.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.API b/ChangeLog.API index 16396dda58..f91c4ee79a 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -100,7 +100,6 @@ version 3.0.0 (??/??/????): * _GntProgressBarOrientation * _GntTreeColumnFlag * _GntWidgetFlags - * _PurpleAccount.ui_data * _PurpleCipherBatchMode * _PurpleCipherCaps * _PurpleCmdFlag diff --git a/libpurple/account.h b/libpurple/account.h index 8d173b82cd..ced1bff95f 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -164,6 +164,7 @@ struct _PurpleAccount PurplePresence *presence; /**< Presence. */ PurpleLog *system_log; /**< The system log */ + void *ui_data; /**< The UI can put data here. */ PurpleAccountRegistrationCb registration_cb; void *registration_cb_user_data; -- cgit v1.2.1 From 3c83c0b819ad88f30283adfee95ffd6c14786aa2 Mon Sep 17 00:00:00 2001 From: Kevin Stange Date: Sat, 1 Oct 2011 23:41:15 +0000 Subject: Add accessors for _PurpleAccount.ui_data --- ChangeLog.API | 2 ++ libpurple/account.c | 18 ++++++++++++++++++ libpurple/account.h | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/ChangeLog.API b/ChangeLog.API index f91c4ee79a..aab00699c3 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -4,6 +4,8 @@ version 3.0.0 (??/??/????): libpurple: Added: * pidgin_create_webview + * purple_account_get_ui_data + * purple_account_set_ui_data * purple_conv_chat_cb_get_alias * purple_conv_chat_cb_get_flags * purple_conv_chat_cb_is_buddy diff --git a/libpurple/account.c b/libpurple/account.c index a7926ea1c5..a2c6e73e8a 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -2471,6 +2471,24 @@ purple_account_get_ui_bool(const PurpleAccount *account, const char *ui, return setting->value.boolean; } +gpointer +purple_account_get_ui_data(const PurpleAccount *account) +{ + g_return_val_if_fail(account != NULL, NULL); + + return account->ui_data; +} + +void +purple_request_field_set_ui_data(PurpleAccount *account, + gpointer ui_data) +{ + g_return_if_fail(acount != NULL); + + account->ui_data = ui_data; +} + + PurpleLog * purple_account_get_log(PurpleAccount *account, gboolean create) { diff --git a/libpurple/account.h b/libpurple/account.h index d64ba93833..b6ab43be25 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -602,6 +602,25 @@ void purple_account_set_ui_string(PurpleAccount *account, const char *ui, void purple_account_set_ui_bool(PurpleAccount *account, const char *ui, const char *name, gboolean value); +/** + * Returns the UI data associated with this account. + * + * @param account The account. + * + * @return The UI data associated with this object. This is a + * convenience field provided to the UIs--it is not + * used by the libuprple core. + */ +gpointer purple_account_get_ui_data(const PurpleAccount *account); + +/** + * Set the UI data associated with this account. + * + * @param account The account. + * @param ui_data A pointer to associate with this object. + */ +void purple_account_set_ui_data(PurpleAccount *account, gpointer ui_data); + /** * Returns whether or not the account is connected. * -- cgit v1.2.1 From 3156d94c789b51a1246d7c81b978d7de92af92f1 Mon Sep 17 00:00:00 2001 From: Kevin Stange Date: Sun, 2 Oct 2011 00:05:00 +0000 Subject: disapproval of revision '6dcccea9ce3519e26a2f40c2e26185af62865425' --- finch/gntconv.c | 3 +++ libpurple/conversation.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/finch/gntconv.c b/finch/gntconv.c index 22fd7e9c52..4648c5755c 100644 --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -801,6 +801,9 @@ finch_create_conversation(PurpleConversation *conv) case PURPLE_CONV_TYPE_CHAT: gnt_widget_set_name(ggc->window, "conversation-window-chat" ); break; + case PURPLE_CONV_TYPE_MISC: + gnt_widget_set_name(ggc->window, "conversation-window-misc" ); + break; case PURPLE_CONV_TYPE_ANY: gnt_widget_set_name(ggc->window, "conversation-window-any" ); break; diff --git a/libpurple/conversation.h b/libpurple/conversation.h index c3c9d2d56c..ebf9b485d8 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -53,6 +53,7 @@ typedef enum PURPLE_CONV_TYPE_UNKNOWN = 0, /**< Unknown conversation type. */ PURPLE_CONV_TYPE_IM, /**< Instant Message. */ PURPLE_CONV_TYPE_CHAT, /**< Chat room. */ + PURPLE_CONV_TYPE_MISC, /**< A misc. conversation. */ PURPLE_CONV_TYPE_ANY /**< Any type of conversation. */ } PurpleConversationType; @@ -284,6 +285,8 @@ struct _PurpleConversation { PurpleConvIm *im; /**< IM-specific data. */ PurpleConvChat *chat; /**< Chat-specific data. */ + void *misc; /**< Misc. data. */ + } u; PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ -- cgit v1.2.1 From de3327b3112b12a2fce5156d53a92bfe49d39584 Mon Sep 17 00:00:00 2001 From: Kevin Stange Date: Sun, 2 Oct 2011 00:14:08 +0000 Subject: Restore a union member lost in the merge due to struct hiding. --- libpurple/conversation.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libpurple/conversation.c b/libpurple/conversation.c index b0dc1b2437..f7b018d98b 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -133,6 +133,8 @@ struct _PurpleConversation { PurpleConvIm *im; /**< IM-specific data. */ PurpleConvChat *chat; /**< Chat-specific data. */ + void *misc; /**< Misc. data. */ + } u; PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ -- cgit v1.2.1 From dabca82cc736470ffefbe46c7a5ba61850fcff97 Mon Sep 17 00:00:00 2001 From: Kevin Stange Date: Sun, 2 Oct 2011 02:37:56 +0000 Subject: I guess I shouldn't copy/paste code while running out the door. --- libpurple/account.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/account.c b/libpurple/account.c index a2c6e73e8a..409446b86c 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -2480,10 +2480,10 @@ purple_account_get_ui_data(const PurpleAccount *account) } void -purple_request_field_set_ui_data(PurpleAccount *account, +purple_account_set_ui_data(PurpleAccount *account, gpointer ui_data) { - g_return_if_fail(acount != NULL); + g_return_if_fail(account != NULL); account->ui_data = ui_data; } -- cgit v1.2.1 From 259cc169ca7fa980285661f4cb3f05e831c35751 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 5 Oct 2011 07:35:09 +0000 Subject: Fix a mistake I made while manually propagating from im.pidgin.pidgin.2.x.y --- libpurple/protocols/sametime/sametime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 04b75fbd8b..15bb25cba1 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -3721,7 +3721,7 @@ static void mw_prpl_login(PurpleAccount *account) { /* somehow, we don't have a host to connect to. Well, we need one to actually continue, so let's ask the user directly. */ g_free(user); - purple_connection_error_reason(gc, + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("A server is required to connect this account")); return; -- cgit v1.2.1 From f2bf61a443380f7fc7d351bbf354132fd2ded0de Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 5 Oct 2011 07:45:13 +0000 Subject: Switch back to initializing the struct this way. I guess the other way doesn't work on Windows? I lost this change when I propagated from the 2.x.y branch because I wasn't comfortable making this change during the manual merge. --- libpurple/protocols/sametime/sametime.c | 131 +++++++++++++++++--------------- 1 file changed, 71 insertions(+), 60 deletions(-) diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 15bb25cba1..83bd9db522 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -5118,66 +5118,77 @@ static void mw_prpl_send_file(PurpleConnection *gc, static PurplePluginProtocolInfo mw_prpl_info = { - .struct_size = sizeof(PurplePluginProtocolInfo), - .options = OPT_PROTO_IM_IMAGE, - .user_splits = NULL, /*< set in mw_plugin_init */ - .protocol_options = NULL, /*< set in mw_plugin_init */ - .icon_spec = NO_BUDDY_ICONS, - .list_icon = mw_prpl_list_icon, - .list_emblem = mw_prpl_list_emblem, - .status_text = mw_prpl_status_text, - .tooltip_text = mw_prpl_tooltip_text, - .status_types = mw_prpl_status_types, - .blist_node_menu = mw_prpl_blist_node_menu, - .chat_info = mw_prpl_chat_info, - .chat_info_defaults = mw_prpl_chat_info_defaults, - .login = mw_prpl_login, - .close = mw_prpl_close, - .send_im = mw_prpl_send_im, - .set_info = NULL, - .send_typing = mw_prpl_send_typing, - .get_info = mw_prpl_get_info, - .set_status = mw_prpl_set_status, - .set_idle = mw_prpl_set_idle, - .change_passwd = NULL, - .add_buddy = mw_prpl_add_buddy, - .add_buddies = mw_prpl_add_buddies, - .remove_buddy = mw_prpl_remove_buddy, - .remove_buddies = NULL, - .add_permit = mw_prpl_add_permit, - .add_deny = mw_prpl_add_deny, - .rem_permit = mw_prpl_rem_permit, - .rem_deny = mw_prpl_rem_deny, - .set_permit_deny = mw_prpl_set_permit_deny, - .join_chat = mw_prpl_join_chat, - .reject_chat = mw_prpl_reject_chat, - .get_chat_name = mw_prpl_get_chat_name, - .chat_invite = mw_prpl_chat_invite, - .chat_leave = mw_prpl_chat_leave, - .chat_whisper = mw_prpl_chat_whisper, - .chat_send = mw_prpl_chat_send, - .keepalive = mw_prpl_keepalive, - .register_user = NULL, - .get_cb_info = NULL, - .alias_buddy = mw_prpl_alias_buddy, - .group_buddy = mw_prpl_group_buddy, - .rename_group = mw_prpl_rename_group, - .buddy_free = mw_prpl_buddy_free, - .convo_closed = mw_prpl_convo_closed, - .normalize = mw_prpl_normalize, - .set_buddy_icon = NULL, - .remove_group = mw_prpl_remove_group, - .get_cb_real_name = NULL, - .set_chat_topic = NULL, - .find_blist_chat = NULL, - .roomlist_get_list = NULL, - .roomlist_expand_category = NULL, - .can_receive_file = mw_prpl_can_receive_file, - .send_file = mw_prpl_send_file, - .new_xfer = mw_prpl_new_xfer, - .offline_message = NULL, - .whiteboard_prpl_ops = NULL, - .send_raw = NULL + sizeof(PurplePluginProtocolInfo), + OPT_PROTO_IM_IMAGE, + NULL, /*< set in mw_plugin_init */ + NULL, /*< set in mw_plugin_init */ + NO_BUDDY_ICONS, + mw_prpl_list_icon, + mw_prpl_list_emblem, + mw_prpl_status_text, + mw_prpl_tooltip_text, + mw_prpl_status_types, + mw_prpl_blist_node_menu, + mw_prpl_chat_info, + mw_prpl_chat_info_defaults, + mw_prpl_login, + mw_prpl_close, + mw_prpl_send_im, + NULL, + mw_prpl_send_typing, + mw_prpl_get_info, + mw_prpl_set_status, + mw_prpl_set_idle, + NULL, + mw_prpl_add_buddy, + mw_prpl_add_buddies, + mw_prpl_remove_buddy, + NULL, + mw_prpl_add_permit, + mw_prpl_add_deny, + mw_prpl_rem_permit, + mw_prpl_rem_deny, + mw_prpl_set_permit_deny, + mw_prpl_join_chat, + mw_prpl_reject_chat, + mw_prpl_get_chat_name, + mw_prpl_chat_invite, + mw_prpl_chat_leave, + mw_prpl_chat_whisper, + mw_prpl_chat_send, + mw_prpl_keepalive, + NULL, + NULL, + mw_prpl_alias_buddy, + mw_prpl_group_buddy, + mw_prpl_rename_group, + mw_prpl_buddy_free, + mw_prpl_convo_closed, + mw_prpl_normalize, + NULL, + mw_prpl_remove_group, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + mw_prpl_can_receive_file, + mw_prpl_send_file, + mw_prpl_new_xfer, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL }; -- cgit v1.2.1 From 75b2330b5d4738f1f46efc3374c727370f66fabc Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 02:37:14 +0000 Subject: The variant property is not construct-only. --- pidgin/gtkconv-theme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index be528d5ed3..4c36bcaa87 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -512,7 +512,7 @@ pidgin_conv_theme_class_init(PidginConvThemeClass *klass) /* VARIANT */ pspec = g_param_spec_string("variant", "Variant", "The current variant for this theme", - NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + NULL, G_PARAM_READWRITE); g_object_class_install_property(obj_class, PROP_VARIANT, pspec); properties[PROP_VARIANT] = pspec; -- cgit v1.2.1 From 8b73e8161644109ad024232078a8ac25f4d0f818 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 02:44:27 +0000 Subject: Fix compile with glib<2.26. --- pidgin/gtkconv-theme.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 4c36bcaa87..9e08fac2d0 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -83,7 +83,9 @@ enum { *****************************************************************************/ static GObjectClass *parent_class = NULL; +#if GLIB_CHECK_VERSION(2,26,0) static GParamSpec *properties[PROP_LAST]; +#endif /****************************************************************************** * Helper Functions @@ -507,15 +509,18 @@ pidgin_conv_theme_class_init(PidginConvThemeClass *klass) G_TYPE_HASH_TABLE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property(obj_class, PROP_INFO, pspec); +#if GLIB_CHECK_VERSION(2,26,0) properties[PROP_INFO] = pspec; +#endif /* VARIANT */ pspec = g_param_spec_string("variant", "Variant", "The current variant for this theme", NULL, G_PARAM_READWRITE); g_object_class_install_property(obj_class, PROP_VARIANT, pspec); +#if GLIB_CHECK_VERSION(2,26,0) properties[PROP_VARIANT] = pspec; - +#endif } GType @@ -680,7 +685,11 @@ void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant) { _set_variant(theme, variant); +#if GLIB_CHECK_VERSION(2,26,0) g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_VARIANT]); +#else + g_object_notify(G_OBJECT(theme), "variant"); +#endif } const GList * -- cgit v1.2.1 From d08583a0522255485f2b86954287cf4b76eb07a1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 02:51:52 +0000 Subject: Update the variant in existing conversations when changed. Actually, this doesn't really work since opening the prefs re-scans the themes and creates new GObjects. --- pidgin/gtkconv.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 91dff2d9e5..20b54c2a03 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5130,6 +5130,19 @@ set_theme_webkit_settings(WebKitWebView *webview, PidginConvTheme *theme) webkit_web_view_set_transparent(webview, g_value_get_boolean(val)); } +static void +conv_variant_changed_cb(GObject *gobject, GParamSpec *pspec, gpointer user_data) +{ + PidginConversation *gtkconv = user_data; + const char *path; + char *js; + + path = pidgin_conversation_theme_get_css_path(PIDGIN_CONV_THEME(gobject)); + js = g_strdup_printf("setStylesheet(\"mainStyle\", \"file://%s\");", path); + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), js); + g_free(js); +} + static GtkWidget * setup_common_pane(PidginConversation *gtkconv) { @@ -5258,6 +5271,9 @@ setup_common_pane(PidginConversation *gtkconv) if (chat) gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), "document.getElementById('Chat').className = 'groupchat'"); + g_signal_connect(G_OBJECT(gtkconv->theme), "notify::variant", + G_CALLBACK(conv_variant_changed_cb), gtkconv); + g_free(basedir); g_free(baseuri); g_free(template); @@ -5805,6 +5821,8 @@ pidgin_conv_destroy(PurpleConversation *conv) g_source_remove(gtkconv->attach.timer); } + g_object_disconnect(G_OBJECT(gtkconv->theme), "any_signal::notify", + conv_variant_changed_cb, gtkconv, NULL); g_object_unref(gtkconv->theme); g_free(gtkconv); -- cgit v1.2.1 From 0fbc9b22029ee76a7c75d74ef1723ac3affb1f65 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 07:35:35 +0000 Subject: Try not to call purple_conversation_get_features a million times. --- pidgin/gtkconv.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 20b54c2a03..7a5f26d22a 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -2280,6 +2280,7 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) PurpleConversation *old_conv; GtkIMHtml *entry; const char *protocol_name; + PurpleConnectionFlags features; g_return_if_fail(conv != NULL); @@ -2305,9 +2306,10 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) gtk_imhtml_set_protocol_name(entry, protocol_name); /* TODO WEBKIT: gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); */ - if (!(purple_conversation_get_features(conv) & PURPLE_CONNECTION_HTML)) + features = purple_conversation_get_features(conv); + if (!(features & PURPLE_CONNECTION_HTML)) gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry)); - else if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_FORMATTING_WBFO && + else if (features & PURPLE_CONNECTION_FORMATTING_WBFO && !(purple_conversation_get_features(old_conv) & PURPLE_CONNECTION_FORMATTING_WBFO)) { /* The old conversation allowed formatting on parts of the @@ -2348,12 +2350,12 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) gtk_imhtml_toggle_fontface(entry, fontface); - if (!(purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_FONTSIZE)) + if (!(features & PURPLE_CONNECTION_NO_FONTSIZE)) gtk_imhtml_font_set_size(entry, fontsize); gtk_imhtml_toggle_forecolor(entry, forecolor); - if (!(purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_BGCOLOR)) + if (!(features & PURPLE_CONNECTION_NO_BGCOLOR)) { gtk_imhtml_toggle_backcolor(entry, backcolor); gtk_imhtml_toggle_background(entry, background); @@ -2371,7 +2373,7 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) * here, we didn't call gtk_imhtml_clear_formatting() (because we want to * preserve the formatting exactly as it is), so we have to do this now. */ gtk_imhtml_set_whole_buffer_formatting_only(entry, - (purple_conversation_get_features(conv) & PURPLE_CONNECTION_FORMATTING_WBFO)); + (features & PURPLE_CONNECTION_FORMATTING_WBFO)); } purple_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv); @@ -6941,31 +6943,34 @@ gray_stuff_out(PidginConversation *gtkconv) ((purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT) || !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)) )) { + PurpleConnectionFlags features = purple_conversation_get_features(conv); /* Account is online */ /* Deal with the toolbar */ - if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_HTML) + if (features & PURPLE_CONNECTION_HTML) { buttons = GTK_IMHTML_ALL; /* Everything on */ - if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_BGCOLOR) + if (features & PURPLE_CONNECTION_NO_BGCOLOR) buttons &= ~GTK_IMHTML_BACKCOLOR; - if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_FONTSIZE) + if (features & PURPLE_CONNECTION_NO_FONTSIZE) { buttons &= ~GTK_IMHTML_GROW; buttons &= ~GTK_IMHTML_SHRINK; } - if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_URLDESC) + if (features & PURPLE_CONNECTION_NO_URLDESC) buttons &= ~GTK_IMHTML_LINKDESC; } else { buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; } - if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) - purple_conversation_set_features(conv, purple_conversation_get_features(conv) | PURPLE_CONNECTION_NO_IMAGES); + if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) { + features |= PURPLE_CONNECTION_NO_IMAGES; + purple_conversation_set_features(conv, features); + } - if(purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_IMAGES) + if (features & PURPLE_CONNECTION_NO_IMAGES) buttons &= ~GTK_IMHTML_IMAGE; - if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) + if (features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) buttons |= GTK_IMHTML_CUSTOM_SMILEY; else buttons &= ~GTK_IMHTML_CUSTOM_SMILEY; @@ -6979,8 +6984,8 @@ gray_stuff_out(PidginConversation *gtkconv) gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); - gtk_widget_set_sensitive(win->menu.insert_link, (purple_conversation_get_features(conv) & PURPLE_CONNECTION_HTML)); - gtk_widget_set_sensitive(win->menu.insert_image, !(purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_IMAGES)); + gtk_widget_set_sensitive(win->menu.insert_link, (features & PURPLE_CONNECTION_HTML)); + gtk_widget_set_sensitive(win->menu.insert_image, !(features & PURPLE_CONNECTION_NO_IMAGES)); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { -- cgit v1.2.1 From d71f3b9bbf0323bcebd0b58e109aa8d44b00289d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 07:44:40 +0000 Subject: Only update conversation features if they've actually changed. This prevents an infinite loop through the 'conversation-updated' signal. Though it can probably be fixed a bit better, since I think it means pidgin_conv_update_fields gets called twice. --- pidgin/gtkconv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 7a5f26d22a..18c02ceb9c 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6962,7 +6962,8 @@ gray_stuff_out(PidginConversation *gtkconv) buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; } - if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) { + if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) + && !(features & PURPLE_CONNECTION_NO_IMAGES)) { features |= PURPLE_CONNECTION_NO_IMAGES; purple_conversation_set_features(conv, features); } -- cgit v1.2.1 From b9c6021921b4d8cde6f296e55e34a3fed1d703b4 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sat, 8 Oct 2011 15:49:37 +0000 Subject: Gadu-Gadu: possibility to require encryption; use encryption when available is default option now --- ChangeLog | 4 ++++ libpurple/protocols/gg/gg.c | 32 ++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4932dcde08..11bbfcda60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ version 3.0.0 (??/??/????): * Don't try to format ICQ usernames entered as email addresses. Gets rid of an "Unable to format username" error at login. (#13883) + Gadu-Gadu: + * Possibility to require encryption. Also, using encryption when + available is default option now. (Tomasz Wasilczyk) + MXit: * Remove all reference to Hidden Number. * Fix decoding of font-size changes in the markup of received messages. diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index f27e82d402..816e8ad8b1 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -2143,13 +2143,28 @@ static void ggp_login(PurpleAccount *account) glp->async = 1; glp->status = ggp_to_gg_status(status, &glp->status_descr); - encryption_type = purple_account_get_string(account, "encryption", "none"); - purple_debug_info("gg", "Requested encryption type: %s\n", encryption_type); + encryption_type = purple_account_get_string(account, "encryption", + "opportunistic_tls"); + purple_debug_info("gg", "Requested encryption type: %s\n", + encryption_type); if (strcmp(encryption_type, "opportunistic_tls") == 0) - glp->tls = 1; - else - glp->tls = 0; - purple_debug_info("gg", "TLS enabled: %d\n", glp->tls); + glp->tls = GG_SSL_ENABLED; + else if (strcmp(encryption_type, "require_tls") == 0) + { + if (gg_libgadu_check_feature(GG_LIBGADU_FEATURE_SSL)) + glp->tls = GG_SSL_REQUIRED; + else + { + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, + _("SSL support unavailable")); + g_free(glp); + return; + } + } + else /* encryption_type == "none" */ + glp->tls = GG_SSL_DISABLED; + purple_debug_info("gg", "TLS mode: %d\n", glp->tls); if (!info->status_broadcasting) glp->status = glp->status|GG_STATUS_FRIENDS_MASK; @@ -2808,13 +2823,10 @@ static void init_plugin(PurplePlugin *plugin) list = g_list_append(list, kvp); \ } - ADD_VALUE(encryption_options, _("Don't use encryption"), "none"); ADD_VALUE(encryption_options, _("Use encryption if available"), "opportunistic_tls"); -#if 0 - /* TODO */ ADD_VALUE(encryption_options, _("Require encryption"), "require_tls"); -#endif + ADD_VALUE(encryption_options, _("Don't use encryption"), "none"); option = purple_account_option_list_new(_("Connection security"), "encryption", encryption_options); -- cgit v1.2.1 From 92023b763769b94042774b454ee76893fa1dc43d Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sat, 8 Oct 2011 19:18:58 +0000 Subject: Gadu-Gadu: nick field does absolutely nothing --- libpurple/protocols/gg/gg.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 816e8ad8b1..d176df8a2c 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -2806,11 +2806,6 @@ static void init_plugin(PurplePlugin *plugin) PurpleAccountOption *option; GList *encryption_options = NULL; - option = purple_account_option_string_new(_("Nickname"), - "nick", _("Gadu-Gadu User")); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - option = purple_account_option_string_new(_("GG server"), "gg_server", ""); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, -- cgit v1.2.1 From 7710c67a34fe8ce2c946ad7d8ff5990b1ed2bedc Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sat, 8 Oct 2011 21:23:26 +0000 Subject: Gadu-Gadu: Show local time for incoming messages. Fixes #4579 --- ChangeLog | 1 + libpurple/protocols/gg/gg.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 11bbfcda60..6c0c965c85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ version 3.0.0 (??/??/????): Gadu-Gadu: * Possibility to require encryption. Also, using encryption when available is default option now. (Tomasz Wasilczyk) + * Show local time for incoming messages. (Tomasz Wasilczyk) (#4579) MXit: * Remove all reference to Hidden Number. diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index d176df8a2c..9845a4af20 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -1444,6 +1444,7 @@ static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event gchar *from; gchar *msg; gchar *tmp; + time_t mtime; if (ev->event.msg.message == NULL) { @@ -1572,8 +1573,13 @@ static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event from, msg, ev->event.msg.msgclass, ev->event.msg.recipients_count); + if (ev->event.msg.msgclass & GG_CLASS_QUEUED) + mtime = ev->event.msg.time; + else + mtime = time(NULL); + if (ev->event.msg.recipients_count == 0) { - serv_got_im(gc, from, msg, 0, ev->event.msg.time); + serv_got_im(gc, from, msg, 0, mtime); } else { const char *chat_name; int chat_id; @@ -1599,7 +1605,7 @@ static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event buddy_name = ggp_buddy_get_name(gc, ev->event.msg.sender); serv_got_chat_in(gc, chat_id, buddy_name, - PURPLE_MESSAGE_RECV, msg, ev->event.msg.time); + PURPLE_MESSAGE_RECV, msg, mtime); g_free(buddy_name); } g_free(msg); -- cgit v1.2.1 From 54ca733fefd0e191e88e2b60ce2969bab3e2f06d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 21:24:14 +0000 Subject: Fix merge problem. --- pidgin/gtkaccount.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 744352e575..9bbe988922 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -595,9 +595,6 @@ add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) if (!strcmp(_("Domain"), purple_account_user_split_get_text(split)) && !value) value = google_talk_default_domain_hackery(dialog->protocol_menu, "gmail.com"); - if (!strcmp(_("Domain"), purple_account_user_split_get_text(split)) && !value) - value = - if (value != NULL) gtk_entry_set_text(GTK_ENTRY(entry), value); } @@ -2748,4 +2745,5 @@ pidgin_account_uninit(void) purple_signals_disconnect_by_handle(pidgin_account_get_handle()); purple_signals_unregister_by_instance(pidgin_account_get_handle()); -} \ No newline at end of file +} + -- cgit v1.2.1 From fff95693c6c9f9eb4f1a7b66a7dda4531b97f22e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 21:48:38 +0000 Subject: Apply some changes that don't require GTK+ 3.0. applied changes from 26816ff01c715b8be636c7575f2bb94d44ae3023 through 4532c15d999487ce36760791463cad3c227f6323 Changelog: Hide some Facebook settings hacks for now. applied changes from 4532c15d999487ce36760791463cad3c227f6323 through de0aaedf2fd8e0ebed1f31e3854bb3e70425ad2f Changelog: We don't need this extra slash. applied changes from de0aaedf2fd8e0ebed1f31e3854bb3e70425ad2f through b63cac732d6e9e4ebb651536af993f0bf55b310f Changelog: Add back the More and plugin action menu entries. applied changes from 24aa672083047c3c28cff92f9c8a374f65cb123c through f5ffae7772f18eb58efbfa82c94363ce5f8d8c30 Changelog: Enable the menu-refreshing logic in the conversation menu, now that the signal (un)blocking affects the correct widget. --- pidgin/gtkaccount.c | 6 ++++++ pidgin/gtkconv.c | 32 +++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 9bbe988922..99c4a22870 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -829,8 +829,11 @@ add_protocol_options(AccountPrefsDialog *dialog) gtk_label_new_with_mnemonic(_("Ad_vanced")), 1); gtk_widget_show(vbox); +/* FIXME: Facebook forced-options hack */ +#if 0 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->protocol_menu)); item = gtk_menu_get_active(GTK_MENU(menu)); +#endif for (l = dialog->prpl_info->protocol_options; l != NULL; l = l->next) { @@ -946,9 +949,12 @@ add_protocol_options(AccountPrefsDialog *dialog) model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); opt_entry->widget = combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model)); +/* FIXME: Facebook forced-options hack */ +#if 0 if (g_object_get_data(G_OBJECT(item), "fakefacebook") && !strcmp(opt_entry->setting, "connection_security")) str_value = "opportunistic_tls"; +#endif /* Loop through list of PurpleKeyValuePair items */ for (node = list; node != NULL; node = node->next) { diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 3637ba2e6f..5e12e0d0c2 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3132,7 +3132,7 @@ static GtkActionEntry menu_entries[] = { "MediaMenu", NULL, N_("M_edia"), NULL, NULL, NULL }, { "AudioCall", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, N_("_Audio Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, { "VideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("_Video Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, - { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio\\/Video _Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, + { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio/Video _Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, #endif { "SendFile", PIDGIN_STOCK_TOOLBAR_SEND_FILE, N_("Se_nd File..."), NULL, NULL, G_CALLBACK(menu_send_file_cb) }, @@ -3464,14 +3464,21 @@ regenerate_media_items(PidginWindow *win) static void regenerate_options_items(PidginWindow *win) { -#if GTK_CHECK_VERSION(2,6,0) -#else GtkWidget *menu; PidginConversation *gtkconv; GList *list; +#if GTK_CHECK_VERSION(2,6,0) + GtkWidget *more_menu; + gtkconv = pidgin_conv_window_get_active_gtkconv(win); + more_menu = gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/MoreMenu"); + gtk_widget_show(more_menu); + menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(more_menu)); +#else gtkconv = pidgin_conv_window_get_active_gtkconv(win); menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More")); +#endif /* Remove the previous entries */ for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; ) @@ -3489,7 +3496,6 @@ regenerate_options_items(PidginWindow *win) } gtk_widget_show_all(menu); -#endif } static void @@ -3503,8 +3509,6 @@ remove_from_list(GtkWidget *widget, PidginWindow *win) static void regenerate_plugins_items(PidginWindow *win) { -#if GTK_CHECK_VERSION(2,6,0) -#else GList *action_items; GtkWidget *menu; GList *list; @@ -3530,7 +3534,12 @@ regenerate_plugins_items(PidginWindow *win) action_items = g_list_delete_link(action_items, action_items); } +#if GTK_CHECK_VERSION(2,6,0) + item = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/OptionsMenu"); + menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(item)); +#else menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Options")); +#endif list = purple_conversation_get_extended_menu(conv); if (list) { @@ -3546,10 +3555,8 @@ regenerate_plugins_items(PidginWindow *win) g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(remove_from_list), win); } g_object_set_data(G_OBJECT(win->window), "plugin-actions", action_items); -#endif } -#if 0 static void menubar_activated(GtkWidget *item, gpointer data) { PidginWindow *win = data; @@ -3568,12 +3575,11 @@ focus_out_from_menubar(GtkWidget *wid, PidginWindow *win) { /* The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time * the 'Conversation' menu pops up. */ - GtkWidget *menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation")); + GtkWidget *menuitem = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/ConversationMenu"); g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win); g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar), G_CALLBACK(focus_out_from_menubar), win); } -#endif static GtkWidget * setup_menubar(PidginWindow *win) @@ -3582,6 +3588,7 @@ setup_menubar(PidginWindow *win) const char *method; GtkActionGroup *action_group; GError *error; + GtkWidget *menuitem; action_group = gtk_action_group_new("ConversationActions"); gtk_action_group_add_actions(action_group, @@ -3616,6 +3623,9 @@ setup_menubar(PidginWindow *win) win->menu.menubar = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation"); + menuitem = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/ConversationMenu"); + g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menubar_activated), win); + win->menu.view_log = gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/ViewLog"); @@ -10773,4 +10783,4 @@ generate_nick_colors(guint *color_count, GdkColor background) } return colors; -} \ No newline at end of file +} -- cgit v1.2.1 From 51f84cd4b4d4a2453b40d9e02d6223262c9aff6b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 21:54:32 +0000 Subject: Fix a type warning. --- pidgin/plugins/ticker/gtkticker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/plugins/ticker/gtkticker.c b/pidgin/plugins/ticker/gtkticker.c index d4c11a8105..56bc388187 100644 --- a/pidgin/plugins/ticker/gtkticker.c +++ b/pidgin/plugins/ticker/gtkticker.c @@ -178,7 +178,7 @@ static void gtk_ticker_put (GtkTicker *ticker, GtkWidget *widget) ticker->children = g_list_append (ticker->children, child_info); - if (gtk_widget_get_realized (ticker)) + if (gtk_widget_get_realized (GTK_WIDGET (ticker))) gtk_widget_realize (widget); if (gtk_widget_get_visible (GTK_WIDGET (ticker)) && -- cgit v1.2.1 From 7c6555aae428d52819fd489045f371f736b30d88 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 21:57:46 +0000 Subject: Silence a warning. --- pidgin/gtkprefs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index f1df11ee18..3facb3d8ab 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -246,7 +246,7 @@ pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, int int_value = 0; const char *str_value = NULL; gboolean bool_value = FALSE; - GtkListStore *store; + GtkListStore *store = NULL; GtkTreeIter iter; GtkTreeIter active; GtkCellRenderer *renderer; @@ -262,6 +262,9 @@ pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, } else if (type == PURPLE_PREF_BOOLEAN) { store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_BOOLEAN); stored_bool = purple_prefs_get_bool(key); + } else { + g_warn_if_reached(); + return NULL; } dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); -- cgit v1.2.1 From b0f51c1d433c24983d4a9f63bcb98b9c2bda117a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 21:58:16 +0000 Subject: Fix an incorrect function call. Probably a merge error. --- pidgin/gtkconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 5e12e0d0c2..f46441eb63 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3444,7 +3444,7 @@ regenerate_media_items(PidginWindow *win) gtk_action_set_sensitive(win->video_call, caps & PURPLE_MEDIA_CAPS_VIDEO ? TRUE : FALSE); - gtk_widget_set_sensitive(win->audio_video_call, + gtk_action_set_sensitive(win->audio_video_call, caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO ? TRUE : FALSE); } else if (purple_conversation_get_type(conv) -- cgit v1.2.1 From b1813e3ae9ef7ae0ecbeac13b3b033dbad13e9ed Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 22:17:55 +0000 Subject: Fix minor unused variable warning. --- pidgin/gtkmenutray.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pidgin/gtkmenutray.c b/pidgin/gtkmenutray.c index be3f8552f7..00cfce120c 100644 --- a/pidgin/gtkmenutray.c +++ b/pidgin/gtkmenutray.c @@ -92,7 +92,9 @@ pidgin_menu_tray_map(GtkWidget *widget) static void pidgin_menu_tray_finalize(GObject *obj) { +#if !GTK_CHECK_VERSION(2,12,0) PidginMenuTray *tray = PIDGIN_MENU_TRAY(obj); +#endif #if 0 /* This _might_ be leaking, but I have a sneaking suspicion that the widget is * getting destroyed in GtkContainer's finalize function. But if were are -- cgit v1.2.1 From 67c898226cc4c3d40f31da9b21e4f5fa7ac2ea6d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 22:35:05 +0000 Subject: Remove unnecessary GTK+ version checks now that we depend on 2.10.0. I thought I did some of this already, though. --- pidgin/gtkconv.c | 17 ----------------- pidgin/gtkmenutray.h | 4 +--- pidgin/plugins/gestures/gestures.c | 34 ---------------------------------- 3 files changed, 1 insertion(+), 54 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index f46441eb63..4e24114905 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1146,9 +1146,6 @@ menu_view_log_cb(GtkAction *action, gpointer data) gdk_window_set_cursor(gtkblist->window->window, cursor); gdk_window_set_cursor(win->window->window, cursor); gdk_cursor_unref(cursor); -#if GTK_CHECK_VERSION(2,4,0) && !GTK_CHECK_VERSION(2,6,0) //FIXME: What? - gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); -#endif name = purple_conversation_get_name(conv); account = purple_conversation_get_account(conv); @@ -3467,7 +3464,6 @@ regenerate_options_items(PidginWindow *win) GtkWidget *menu; PidginConversation *gtkconv; GList *list; -#if GTK_CHECK_VERSION(2,6,0) GtkWidget *more_menu; gtkconv = pidgin_conv_window_get_active_gtkconv(win); @@ -3475,10 +3471,6 @@ regenerate_options_items(PidginWindow *win) "/Conversation/ConversationMenu/MoreMenu"); gtk_widget_show(more_menu); menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(more_menu)); -#else - gtkconv = pidgin_conv_window_get_active_gtkconv(win); - menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More")); -#endif /* Remove the previous entries */ for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; ) @@ -3534,12 +3526,8 @@ regenerate_plugins_items(PidginWindow *win) action_items = g_list_delete_link(action_items, action_items); } -#if GTK_CHECK_VERSION(2,6,0) item = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/OptionsMenu"); menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(item)); -#else - menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Options")); -#endif list = purple_conversation_get_extended_menu(conv); if (list) { @@ -10130,12 +10118,7 @@ pidgin_conv_window_remove_gtkconv(PidginWindow *win, PidginConversation *gtkconv index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont); -#if GTK_CHECK_VERSION(2,10,0) g_object_ref_sink(G_OBJECT(gtkconv->tab_cont)); -#else - g_object_ref(gtkconv->tab_cont); - gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); -#endif gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index); diff --git a/pidgin/gtkmenutray.h b/pidgin/gtkmenutray.h index 07b0ce91cb..158530a7bb 100644 --- a/pidgin/gtkmenutray.h +++ b/pidgin/gtkmenutray.h @@ -40,9 +40,7 @@ typedef struct _PidginMenuTrayClass PidginMenuTrayClass; struct _PidginMenuTray { GtkMenuItem gparent; /**< The parent instance */ GtkWidget *tray; /**< The tray */ -#if GTK_CHECK_VERSION(2,12,0) - gpointer depr1; -#else +#if !GTK_CHECK_VERSION(2,12,0) GtkTooltips *tooltips; /**< Tooltips */ #endif }; diff --git a/pidgin/plugins/gestures/gestures.c b/pidgin/plugins/gestures/gestures.c index 0ef93713f1..51c13f011e 100644 --- a/pidgin/plugins/gestures/gestures.c +++ b/pidgin/plugins/gestures/gestures.c @@ -145,7 +145,6 @@ new_conv_cb(PurpleConversation *conv) } #if 0 -#if GTK_CHECK_VERSION(2,4,0) static void mouse_button_menu_cb(GtkComboBox *opt, gpointer data) { @@ -153,15 +152,6 @@ mouse_button_menu_cb(GtkComboBox *opt, gpointer data) gstroke_set_mouse_button(button + 2); } -#else -static void -mouse_button_menu_cb(GtkMenuItem *item, gpointer data) -{ - int button = (int)data; - - gstroke_set_mouse_button(button + 2); -} -#endif #endif static void @@ -230,9 +220,6 @@ get_config_frame(PurplePlugin *plugin) GtkWidget *toggle; #if 0 GtkWidget *opt; -#if GTK_CHECK_VERSION(2,4,0) - GtkWidget *menu, *item; -#endif #endif /* Outside container */ @@ -243,7 +230,6 @@ get_config_frame(PurplePlugin *plugin) vbox = pidgin_make_frame(ret, _("Mouse Gestures Configuration")); #if 0 -#if GTK_CHECK_VERSION(2,4,0) /* Mouse button drop-down menu */ opt = gtk_combo_box_new_text(); @@ -255,26 +241,6 @@ get_config_frame(PurplePlugin *plugin) gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); gtk_combo_box_set_active(GTK_COMBO_BOX(opt), gstroke_get_mouse_button() - 2); -#else - /* Mouse button drop-down menu */ - menu = gtk_menu_new(); - opt = gtk_option_menu_new(); - - item = gtk_menu_item_new_with_label(_("Middle mouse button")); - g_signal_connect(G_OBJECT(item), "activate", - G_CALLBACK(mouse_button_menu_cb), opt); - gtk_menu_append(menu, item); - - item = gtk_menu_item_new_with_label(_("Right mouse button")); - g_signal_connect(G_OBJECT(item), "activate", - G_CALLBACK(mouse_button_menu_cb), opt); - gtk_menu_append(menu, item); - - gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); - gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu); - gtk_option_menu_set_history(GTK_OPTION_MENU(opt), - gstroke_get_mouse_button() - 2); -#endif #endif /* "Visual gesture display" checkbox */ -- cgit v1.2.1 From 6e0357584a12b2b284319f0fb405cd054f97f542 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 22:49:05 +0000 Subject: Pluck one more fix. applied changes from f539a2c083b25ec4a1c2c34452c22d6d36c65bd4 through 112a798126b1d2681bed1f99a9f370c00f757619 Changelog: Fix vvconfig.c compile. --- pidgin/plugins/vvconfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/plugins/vvconfig.c b/pidgin/plugins/vvconfig.c index 93d85be586..209c620c4a 100644 --- a/pidgin/plugins/vvconfig.c +++ b/pidgin/plugins/vvconfig.c @@ -627,7 +627,7 @@ gst_bus_cb(GstBus *bus, GstMessage *msg, BusCbCtx *ctx) } static void -voice_test_frame_destroy_cb(GtkObject *w, GstElement *pipeline) +voice_test_frame_destroy_cb(GtkWidget *w, GstElement *pipeline) { g_return_if_fail(GST_IS_ELEMENT(pipeline)); @@ -702,7 +702,7 @@ get_voice_test_frame(PurplePlugin *plugin) gtk_range_set_value(GTK_RANGE(volume), purple_prefs_get_int("/purple/media/audio/volume/input")); - gtk_widget_set(volume, "draw-value", FALSE, NULL); + gtk_scale_set_draw_value(GTK_SCALE(volume), FALSE); gtk_range_set_value(GTK_RANGE(threshold), purple_prefs_get_int("/purple/media/audio/silence_threshold")); -- cgit v1.2.1 From c76339e8adb688e54713bd19e67fc4849c37e722 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sat, 8 Oct 2011 22:53:35 +0000 Subject: Gadu-Gadu: detailed descriptions on connection failures. Fixes #14648 --- ChangeLog | 2 ++ libpurple/protocols/gg/gg.c | 68 ++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c0c965c85..83fe1feb03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ version 3.0.0 (??/??/????): * Possibility to require encryption. Also, using encryption when available is default option now. (Tomasz Wasilczyk) * Show local time for incoming messages. (Tomasz Wasilczyk) (#4579) + * Detailed descriptions on connection failures. (Tomasz Wasilczyk) + (#14648) MXit: * Remove all reference to Hidden Number. diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 9845a4af20..3a8f0462c5 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -1932,9 +1932,56 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition case GG_EVENT_CONN_FAILED: purple_input_remove(gc->inpa); gc->inpa = 0; - purple_connection_error (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); + purple_debug_info("gg", "Connection failure: %d\n", + ev->event.failure); + switch (ev->event.failure) { + case GG_FAILURE_RESOLVING: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Unable to resolve " + "hostname")); + break; + case GG_FAILURE_PASSWORD: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, + _("Incorrect password")); + break; + case GG_FAILURE_TLS: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, + _("SSL Connection Failed")); + break; + case GG_FAILURE_INTRUDER: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, + _("Your account has been " + "disabled because too many " + "incorrect passwords were " + "entered")); + break; + case GG_FAILURE_UNAVAILABLE: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Service temporarily " + "unavailable")); + break; + case GG_FAILURE_PROXY: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Error connecting to proxy " + "server")); + break; + case GG_FAILURE_HUB: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Error connecting to master " + "server")); + break; + default: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Connection failed")); + } break; case GG_EVENT_MSG: if (ev->event.msg.sender == 0) @@ -2137,6 +2184,15 @@ static void ggp_login(PurpleAccount *account) glp->uin = ggp_get_uin(account); glp->password = (char *)purple_account_get_password(account); + + if (glp->uin == 0) { + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_INVALID_USERNAME, + _("The username specified is invalid.")); + g_free(glp); + return; + } + glp->image_size = 255; presence = purple_account_get_presence(account); @@ -2155,12 +2211,10 @@ static void ggp_login(PurpleAccount *account) encryption_type); if (strcmp(encryption_type, "opportunistic_tls") == 0) glp->tls = GG_SSL_ENABLED; - else if (strcmp(encryption_type, "require_tls") == 0) - { + else if (strcmp(encryption_type, "require_tls") == 0) { if (gg_libgadu_check_feature(GG_LIBGADU_FEATURE_SSL)) glp->tls = GG_SSL_REQUIRED; - else - { + else { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); -- cgit v1.2.1 From 992e79ac2b395cdc33559db98f99d913f2627b0a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 23:01:54 +0000 Subject: Restore missing Join a Chat menu item in UI-factory mode. --- pidgin/gtkconv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 4e24114905..96a4bdd52e 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1044,7 +1044,7 @@ menu_new_conv_cb(GtkAction *action, gpointer data) } static void -menu_join_chat_cb(gpointer data, guint action, GtkWidget *widget) +menu_join_chat_cb(GtkAction *action, gpointer data) { pidgin_blist_joinchat_show(); } @@ -3120,6 +3120,7 @@ static GtkActionEntry menu_entries[] = /* Conversation menu */ { "ConversationMenu", NULL, N_("_Conversation"), NULL, NULL, NULL }, { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "M", NULL, G_CALLBACK(menu_new_conv_cb) }, + { "JoinAChat", PIDGIN_STOCK_CHAT, N_("Join a _Chat..."), NULL, NULL, G_CALLBACK(menu_join_chat_cb) }, { "Find", GTK_STOCK_FIND, N_("_Find..."), NULL, NULL, G_CALLBACK(menu_find_cb) }, { "ViewLog", NULL, N_("View _Log"), NULL, NULL, G_CALLBACK(menu_view_log_cb) }, { "SaveAs", GTK_STOCK_SAVE_AS, N_("_Save As..."), NULL, NULL, G_CALLBACK(menu_save_as_cb) }, @@ -3164,6 +3165,7 @@ static const char *conversation_menu = "" "" "" + "" "" "" "" -- cgit v1.2.1 From ac3cb30f4e51ab86e21d4be22a2d3e8a1f101c53 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sat, 8 Oct 2011 23:07:45 +0000 Subject: Gadu-Gadu: check for NULL pointer before logging system messages. --- libpurple/protocols/gg/gg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 3a8f0462c5..48f2d3cea6 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -1985,9 +1985,14 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition break; case GG_EVENT_MSG: if (ev->event.msg.sender == 0) + { + if (ev->event.msg.message == NULL) + break; + /* system messages are mostly ads */ purple_debug_info("gg", "System message:\n%s\n", ev->event.msg.message); + } else purple_debug_warning("gg", "GG_EVENT_MSG: message from user %u " "unexpected while connecting:\n%s\n", -- cgit v1.2.1 From bf794b773d61152f668b394b800957901a4b8e73 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 23:26:28 +0000 Subject: Apply some updates to UI Manager version of blist menu: Change the key shortcut for Set Mood to Ctrl+D, Add Plugin Information menu item to Help menu. --- pidgin/gtkblist.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 76f4ff4b8c..7701070e97 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3607,6 +3607,8 @@ set_mood_show(void) #if 1 /* TODO: fill out tooltips... */ static const GtkActionEntry blist_menu_entries[] = { +/* NOTE: Do not set any accelerator to Control+O. It is mapped by + gtk_blist_key_press_cb to "Get User Info" on the selected buddy. */ /* Buddies menu */ { "BuddiesMenu", NULL, N_("_Buddies"), NULL, NULL, NULL }, { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "M", NULL, pidgin_dialogs_im }, @@ -3633,7 +3635,7 @@ static const GtkActionEntry blist_menu_entries[] = { { "Plugins", PIDGIN_STOCK_TOOLBAR_PLUGINS, N_("Plu_gins"), "U", NULL, pidgin_plugin_dialog_show }, { "Preferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), "P", NULL, pidgin_prefs_show }, { "Privacy", NULL, N_("Pr_ivacy"), NULL, NULL, pidgin_privacy_dialog_show }, - { "SetMood", NULL, N_("Set _Mood"), "O", NULL, set_mood_show }, + { "SetMood", NULL, N_("Set _Mood"), "D", NULL, set_mood_show }, { "FileTransfers", PIDGIN_STOCK_TOOLBAR_TRANSFER, N_("_File Transfers"), "T", NULL, G_CALLBACK(gtk_blist_show_xfer_dialog_cb) }, { "RoomList", NULL, N_("R_oom List"), NULL, NULL, pidgin_roomlist_dialog_show }, { "SystemLog", NULL, N_("System _Log"), NULL, NULL, gtk_blist_show_systemlog_cb }, @@ -3644,6 +3646,7 @@ static const GtkActionEntry blist_menu_entries[] = { { "BuildInformation", NULL, N_("_Build Information"), NULL, NULL, pidgin_dialogs_buildinfo }, { "DebugWindow", NULL, N_("_Debug Window"), NULL, NULL, toggle_debug }, { "DeveloperInformation", NULL, N_("De_veloper Information"), NULL, NULL, pidgin_dialogs_developers }, + { "PluginInformation", NULL, N_("_Plugin Information"), NULL, NULL, pidgin_dialogs_plugins_info }, { "TranslatorInformation", NULL, N_("_Translator Information"), NULL, NULL, pidgin_dialogs_translators }, { "About", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, pidgin_dialogs_about }, }; @@ -3713,6 +3716,7 @@ static const char *blist_menu = "" "" "" + "" "" "" "" @@ -3723,9 +3727,6 @@ static const char *blist_menu = #else static GtkItemFactoryEntry blist_menu[] = { -/* NOTE: Do not set any accelerator to Control+O. It is mapped by - gtk_blist_key_press_cb to "Get User Info" on the selected buddy. */ - /* Buddies menu */ { N_("/_Buddies"), NULL, NULL, 0, "", NULL }, { N_("/Buddies/New Instant _Message..."), "M", pidgin_dialogs_im, 0, "", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, @@ -8376,4 +8377,5 @@ pidgin_blist_update_sort_methods(void) sort_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string->str, -1, NULL); g_string_free(ui_string, TRUE); -} \ No newline at end of file +} + -- cgit v1.2.1 From fec75889449a3e72817e50d137ac2129cd3c86eb Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 8 Oct 2011 23:29:06 +0000 Subject: Remove ItemFactory version of menu. --- pidgin/gtkblist.c | 58 --------------------------------------- pidgin/gtkconv.c | 82 ------------------------------------------------------- 2 files changed, 140 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 7701070e97..a79e781c9d 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -3604,7 +3604,6 @@ set_mood_show(void) /*************************************************** * Crap * ***************************************************/ -#if 1 /* TODO: fill out tooltips... */ static const GtkActionEntry blist_menu_entries[] = { /* NOTE: Do not set any accelerator to Control+O. It is mapped by @@ -3724,63 +3723,6 @@ static const char *blist_menu = "" ""; -#else -static GtkItemFactoryEntry blist_menu[] = -{ - /* Buddies menu */ - { N_("/_Buddies"), NULL, NULL, 0, "", NULL }, - { N_("/Buddies/New Instant _Message..."), "M", pidgin_dialogs_im, 0, "", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, - { N_("/Buddies/Join a _Chat..."), "C", pidgin_blist_joinchat_show, 0, "", PIDGIN_STOCK_CHAT }, - { N_("/Buddies/Get User _Info..."), "I", pidgin_dialogs_info, 0, "", PIDGIN_STOCK_TOOLBAR_USER_INFO }, - { N_("/Buddies/View User _Log..."), "L", pidgin_dialogs_log, 0, "", NULL }, - { "/Buddies/sep1", NULL, NULL, 0, "", NULL }, - { N_("/Buddies/Sh_ow"), NULL, NULL, 0, "", NULL}, - { N_("/Buddies/Show/_Offline Buddies"), NULL, pidgin_blist_edit_mode_cb, 1, "", NULL }, - { N_("/Buddies/Show/_Empty Groups"), NULL, pidgin_blist_show_empty_groups_cb, 1, "", NULL }, - { N_("/Buddies/Show/Buddy _Details"), NULL, pidgin_blist_buddy_details_cb, 1, "", NULL }, - { N_("/Buddies/Show/Idle _Times"), NULL, pidgin_blist_show_idle_time_cb, 1, "", NULL }, - { N_("/Buddies/Show/_Protocol Icons"), NULL, pidgin_blist_show_protocol_icons_cb, 1, "", NULL }, - { N_("/Buddies/_Sort Buddies"), NULL, NULL, 0, "", NULL }, - { "/Buddies/sep2", NULL, NULL, 0, "", NULL }, - { N_("/Buddies/_Add Buddy..."), "B", pidgin_blist_add_buddy_cb, 0, "", GTK_STOCK_ADD }, - { N_("/Buddies/Add C_hat..."), NULL, pidgin_blist_add_chat_cb, 0, "", GTK_STOCK_ADD }, - { N_("/Buddies/Add _Group..."), NULL, purple_blist_request_add_group, 0, "", GTK_STOCK_ADD }, - { "/Buddies/sep3", NULL, NULL, 0, "", NULL }, - { N_("/Buddies/_Quit"), "Q", purple_core_quit, 0, "", GTK_STOCK_QUIT }, - - /* Accounts menu */ - { N_("/_Accounts"), NULL, NULL, 0, "", NULL }, - { N_("/Accounts/Manage Accounts"), "A", pidgin_accounts_window_show, 0, "", NULL }, - - /* Tools */ - { N_("/_Tools"), NULL, NULL, 0, "", NULL }, - { N_("/Tools/Buddy _Pounces"), NULL, pidgin_pounces_manager_show, 1, "", NULL }, - { N_("/Tools/_Certificates"), NULL, pidgin_certmgr_show, 0, "", NULL }, - { N_("/Tools/Custom Smile_ys"), "Y", pidgin_smiley_manager_show, 0, "", PIDGIN_STOCK_TOOLBAR_SMILEY }, - { N_("/Tools/Plu_gins"), "U", pidgin_plugin_dialog_show, 2, "", PIDGIN_STOCK_TOOLBAR_PLUGINS }, - { N_("/Tools/Pr_eferences"), "P", pidgin_prefs_show, 0, "", GTK_STOCK_PREFERENCES }, - { N_("/Tools/Pr_ivacy"), NULL, pidgin_privacy_dialog_show, 0, "", NULL }, - { N_("/Tools/Set _Mood"), "D", set_mood_show, 0, "", NULL }, - { "/Tools/sep2", NULL, NULL, 0, "", NULL }, - { N_("/Tools/_File Transfers"), "T", pidgin_xfer_dialog_show, 0, "", PIDGIN_STOCK_TOOLBAR_TRANSFER }, - { N_("/Tools/R_oom List"), NULL, pidgin_roomlist_dialog_show, 0, "", NULL }, - { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 3, "", NULL }, - { "/Tools/sep3", NULL, NULL, 0, "", NULL }, - { N_("/Tools/Mute _Sounds"), NULL, pidgin_blist_mute_sounds_cb, 0, "", NULL }, - /* Help */ - { N_("/_Help"), NULL, NULL, 0, "", NULL }, - { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "", GTK_STOCK_HELP }, - { "/Help/sep1", NULL, NULL, 0, "", NULL }, - { N_("/Help/_Build Information"), NULL, pidgin_dialogs_buildinfo, 0, "", NULL }, - { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "", NULL }, - { N_("/Help/De_veloper Information"), NULL, pidgin_dialogs_developers, 0, "", NULL }, - { N_("/Help/_Plugin Information"), NULL, pidgin_dialogs_plugins_info, 0, "", NULL }, - { N_("/Help/_Translator Information"), NULL, pidgin_dialogs_translators, 0, "", NULL }, - { "/Help/sep2", NULL, NULL, 0, "", NULL }, - { N_("/Help/_About"), NULL, pidgin_dialogs_about, 4, "", GTK_STOCK_ABOUT }, -}; -#endif - /********************************************************* * Private Utility functions * *********************************************************/ diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 96a4bdd52e..33772d7077 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3112,8 +3112,6 @@ pidgin_conv_get_window(PidginConversation *gtkconv) return gtkconv->win; } -#if 1 - static GtkActionEntry menu_entries[] = /* TODO: fill out tooltips... */ { @@ -3207,86 +3205,6 @@ static const char *conversation_menu = "" ""; -#else - -static GtkItemFactoryEntry menu_items[] = -{ - /* Conversation menu */ - { N_("/_Conversation"), NULL, NULL, 0, "", NULL }, - - { N_("/Conversation/New Instant _Message..."), "M", menu_new_conv_cb, - 0, "", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, - { N_("/Conversation/Join a _Chat..."), NULL, menu_join_chat_cb, - 0, "", PIDGIN_STOCK_CHAT }, - - { "/Conversation/sep0", NULL, NULL, 0, "", NULL }, - - { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, - "", GTK_STOCK_FIND }, - { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "", NULL }, - { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, - "", GTK_STOCK_SAVE_AS }, - { N_("/Conversation/Clea_r Scrollback"), "L", menu_clear_cb, 0, "", GTK_STOCK_CLEAR }, - - { "/Conversation/sep1", NULL, NULL, 0, "", NULL }, - -#ifdef USE_VV - { N_("/Conversation/M_edia"), NULL, NULL, 0, "", NULL }, - - { N_("/Conversation/Media/_Audio Call"), NULL, menu_initiate_media_call_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL }, - { N_("/Conversation/Media/_Video Call"), NULL, menu_initiate_media_call_cb, 1, - "", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL }, - { N_("/Conversation/Media/Audio\\/Video _Call"), NULL, menu_initiate_media_call_cb, 2, - "", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL }, -#endif - - { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "", PIDGIN_STOCK_TOOLBAR_SEND_FILE }, - { N_("/Conversation/Get _Attention"), NULL, menu_get_attention_cb, 0, "", PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION }, - { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, - 0, "", NULL }, - { N_("/Conversation/_Get Info"), "O", menu_get_info_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_USER_INFO }, - { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, - "", NULL }, - { N_("/Conversation/M_ore"), NULL, NULL, 0, "", NULL }, - - { "/Conversation/sep2", NULL, NULL, 0, "", NULL }, - - { N_("/Conversation/Al_ias..."), NULL, menu_alias_cb, 0, - "", NULL }, - { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_BLOCK }, - { N_("/Conversation/_Unblock..."), NULL, menu_unblock_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_UNBLOCK }, - { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, - "", GTK_STOCK_ADD }, - { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, - "", GTK_STOCK_REMOVE }, - - { "/Conversation/sep3", NULL, NULL, 0, "", NULL }, - - { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_INSERT_LINK }, - { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE }, - - { "/Conversation/sep4", NULL, NULL, 0, "", NULL }, - - - { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, - "", GTK_STOCK_CLOSE }, - - /* Options */ - { N_("/_Options"), NULL, NULL, 0, "", NULL }, - { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "", NULL }, - { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "", NULL }, - { "/Options/sep0", NULL, NULL, 0, "", NULL }, - { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "", NULL }, - { N_("/Options/Show Ti_mestamps"), NULL, menu_timestamps_cb, 0, "", NULL }, -}; -#endif - static void sound_method_pref_changed_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data) -- cgit v1.2.1 From 80b2947262a7260319370e60014d240c5f2452c7 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 00:17:12 +0000 Subject: The function gtk_dialog_set_has_separator was removed in GTK+ 2.22. --- pidgin/gtkconv.c | 7 +++++-- pidgin/gtkdebug.c | 2 ++ pidgin/gtkdialogs.c | 2 ++ pidgin/gtklog.c | 2 ++ pidgin/gtknotify.c | 4 ++++ pidgin/gtkrequest.c | 6 ++++++ pidgin/plugins/themeedit.c | 2 ++ pidgin/plugins/xmppconsole.c | 6 ++++++ 8 files changed, 29 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 33772d7077..9225ad526b 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -941,7 +941,9 @@ invite_cb(GtkWidget *widget, PidginConversation *gtkconv) GTK_RESPONSE_OK); gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); +#endif info->window = GTK_WIDGET(invite_dialog); @@ -8704,8 +8706,9 @@ build_warn_close_dialog(PidginWindow *gtkwin) gtk_container_set_border_width(GTK_CONTAINER(warn_close_dialog), 6); gtk_window_set_resizable(GTK_WINDOW(warn_close_dialog), FALSE); - gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog), - FALSE); +#if !GTK_CHECK_VERSION(2,22,0) + gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog), FALSE); +#endif /* Setup the outside spacing. */ vbox = GTK_DIALOG(warn_close_dialog)->vbox; diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index 895ba5b32d..74c45f7f4a 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -186,7 +186,9 @@ find_cb(GtkWidget *w, DebugWindow *win) gtk_container_set_border_width(GTK_CONTAINER(win->find), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(win->find), FALSE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(win->find), FALSE); +#endif gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(win->find)->vbox), PIDGIN_HIG_BORDER); gtk_container_set_border_width( GTK_CONTAINER(GTK_DIALOG(win->find)->vbox), PIDGIN_HIG_BOX_SPACE); diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 2e62e14f30..f569ec597f 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -947,7 +947,9 @@ pidgin_dialogs_ee(const char *ee) gtk_container_set_border_width (GTK_CONTAINER(window), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); +#endif gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), PIDGIN_HIG_BORDER); gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), PIDGIN_HIG_BOX_SPACE); diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c index 615b172235..d539c58c6e 100644 --- a/pidgin/gtklog.c +++ b/pidgin/gtklog.c @@ -575,7 +575,9 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_dialog_add_button(GTK_DIALOG(lv->window), _("_Browse logs folder"), GTK_RESPONSE_HELP); #endif gtk_container_set_border_width (GTK_CONTAINER(lv->window), PIDGIN_HIG_BOX_SPACE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE); +#endif gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(lv->window)->vbox), 0); g_signal_connect(G_OBJECT(lv->window), "response", G_CALLBACK(destroy_cb), ht); diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 6cde874ae2..1b995c0301 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -534,7 +534,9 @@ pidgin_notify_message(PurpleNotifyMsgType type, const char *title, gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BOX_SPACE); @@ -1494,7 +1496,9 @@ pidgin_create_notification_dialog(PidginNotifyType type) /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BOX_SPACE); gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BOX_SPACE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); /* Vertical box */ diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index 54a7d2cdb0..ae67095116 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -362,7 +362,9 @@ pidgin_request_input(const char *title, const char *primary, gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2); if (!multiline) gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0); gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); @@ -528,7 +530,9 @@ pidgin_request_choice(const char *title, const char *primary, gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ @@ -650,7 +654,9 @@ pidgin_request_action_with_icon(const char *title, const char *primary, gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ diff --git a/pidgin/plugins/themeedit.c b/pidgin/plugins/themeedit.c index 0290d36075..de4a2abf90 100644 --- a/pidgin/plugins/themeedit.c +++ b/pidgin/plugins/themeedit.c @@ -306,7 +306,9 @@ pidgin_blist_theme_edit(PurplePluginAction *unused) } } +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), TRUE); +#endif #ifdef NOT_SADRUL pidgin_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_SAVE, G_CALLBACK(save_blist_theme), dialog); #endif diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index 717edd49ef..14881a36d4 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -274,7 +274,9 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); #if GTK_CHECK_VERSION(2,14,0) @@ -362,7 +364,9 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); #if GTK_CHECK_VERSION(2,14,0) @@ -520,7 +524,9 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); #if GTK_CHECK_VERSION(2,14,0) -- cgit v1.2.1 From 11444cc72daf8e517522658f74fff7595e45d1c7 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 02:50:20 +0000 Subject: Fix all deprecated GTK_WIDGET_* macros. --- pidgin/gtkblist.c | 19 ++++++++++++------- pidgin/gtkcellrendererexpander.c | 5 +++++ pidgin/gtkconv.c | 21 +++++++++++++++------ pidgin/gtkdebug.c | 8 ++++++++ pidgin/gtkimhtml.c | 18 ++++++++++++++---- pidgin/gtkimhtmltoolbar.c | 11 ++++++++--- pidgin/gtkmenutray.c | 8 ++++++-- pidgin/gtknotify.c | 8 ++++++++ pidgin/gtkpounce.c | 4 ++++ pidgin/gtkrequest.c | 4 ++++ pidgin/gtksavedstatuses.c | 4 ++++ pidgin/gtkstatusbox.c | 10 +++++++--- pidgin/gtkutils.c | 15 ++++++++++----- 13 files changed, 105 insertions(+), 30 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index a79e781c9d..233dec9888 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -124,6 +124,11 @@ typedef struct #define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \ ((PidginBuddyListPrivate *)((list)->priv)) +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) +#define gtk_widget_has_focus(x) GTK_WIDGET_HAS_FOCUS(x) +#endif + static guint accounts_merge_id; static GtkActionGroup *accounts_action_group = NULL; @@ -245,7 +250,7 @@ static gboolean gtk_blist_configure_cb(GtkWidget *w, GdkEventConfigure *event, g /* check for visibility because when we aren't visible, this will * * give us bogus (0,0) coordinates. - xOr */ - if (GTK_WIDGET_VISIBLE(w)) + if (gtk_widget_get_visible(w)) gtk_window_get_position(GTK_WINDOW(w), &x, &y); else return FALSE; /* carry on normally */ @@ -4456,7 +4461,7 @@ static void pidgin_blist_restore_position(void) /* if the window exists, is hidden, we're saving positions, and the * position is sane... */ if (gtkblist && gtkblist->window && - !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) { + !gtk_widget_get_visible(gtkblist->window) && blist_width != 0) { blist_x = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/x"); blist_y = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/y"); @@ -4486,7 +4491,7 @@ static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list) PurpleBlistNode *gnode, *cnode; if (gtk_blist_visibility == GDK_VISIBILITY_FULLY_OBSCURED - || !GTK_WIDGET_VISIBLE(gtkblist->window)) + || !gtk_widget_get_visible(gtkblist->window)) return TRUE; for(gnode = list->root; gnode; gnode = gnode->next) { @@ -6995,7 +7000,7 @@ static void pidgin_blist_set_visible(PurpleBuddyList *list, gboolean show) return; if (show) { - if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && !GTK_WIDGET_VISIBLE(gtkblist->window)) + if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && !gtk_widget_get_visible(gtkblist->window)) purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-unhiding", gtkblist); pidgin_blist_restore_position(); gtk_window_present(GTK_WINDOW(gtkblist->window)); @@ -7004,7 +7009,7 @@ static void pidgin_blist_set_visible(PurpleBuddyList *list, gboolean show) purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-hiding", gtkblist); gtk_widget_hide(gtkblist->window); } else { - if (!GTK_WIDGET_VISIBLE(gtkblist->window)) + if (!gtk_widget_get_visible(gtkblist->window)) gtk_widget_show(gtkblist->window); gtk_window_iconify(GTK_WINDOW(gtkblist->window)); } @@ -7409,7 +7414,7 @@ void pidgin_blist_toggle_visibility() { if (gtkblist && gtkblist->window) { - if (GTK_WIDGET_VISIBLE(gtkblist->window)) { + if (gtk_widget_get_visible(gtkblist->window)) { /* make the buddy list visible if it is iconified or if it is * obscured and not currently focused (the focus part ensures * that we do something reasonable if the buddy list is obscured @@ -7474,7 +7479,7 @@ pidgin_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback callbac static void set_urgent(void) { - if (gtkblist->window && !GTK_WIDGET_HAS_FOCUS(gtkblist->window)) + if (gtkblist->window && !gtk_widget_has_focus(gtkblist->window)) pidgin_set_urgent(GTK_WINDOW(gtkblist->window), TRUE); } diff --git a/pidgin/gtkcellrendererexpander.c b/pidgin/gtkcellrendererexpander.c index a5bb6c8a98..10d899e977 100644 --- a/pidgin/gtkcellrendererexpander.c +++ b/pidgin/gtkcellrendererexpander.c @@ -250,8 +250,13 @@ static void pidgin_cell_renderer_expander_render(GtkCellRenderer *cell, state = GTK_STATE_INSENSITIVE; else if (flags & GTK_CELL_RENDERER_PRELIT) state = GTK_STATE_PRELIGHT; +#if GTK_CHECK_VERSION(2,18,0) + else if (gtk_widget_has_focus (widget) && flags & GTK_CELL_RENDERER_SELECTED) + state = GTK_STATE_ACTIVE; +#else else if (GTK_WIDGET_HAS_FOCUS (widget) && flags & GTK_CELL_RENDERER_SELECTED) state = GTK_STATE_ACTIVE; +#endif else state = GTK_STATE_NORMAL; diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 9225ad526b..17d5a5c562 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -80,6 +80,15 @@ #include "gtknickcolors.h" +#if !GTK_CHECK_VERSION(2,20,0) +#define gtk_widget_get_realized(x) GTK_WIDGET_REALIZED(x) + +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) +#define gtk_widget_is_drawable(x) GTK_WIDGET_DRAWABLE(x) +#endif +#endif + /** * A GTK+ Instant Message pane. */ @@ -7205,7 +7214,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) if (title != markup) g_free(markup); - if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) + if (!gtk_widget_get_realized(gtkconv->tab_label)) gtk_widget_realize(gtkconv->tab_label); accessibility_obj = gtk_widget_get_accessible(gtkconv->tab_cont); @@ -7599,7 +7608,7 @@ pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right) tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page); /* Make sure the tab is not hidden beyond an arrow */ - if (!GTK_WIDGET_DRAWABLE(tab) && gtk_notebook_get_show_tabs(notebook)) + if (!gtk_widget_is_drawable(tab) && gtk_notebook_get_show_tabs(notebook)) continue; if (horiz) { @@ -9446,7 +9455,7 @@ infopane_entry_activate(PidginConversation *gtkconv) PurpleConversation *conv = gtkconv->active_conv; const char *text = NULL; - if (!GTK_WIDGET_VISIBLE(gtkconv->infopane)) { + if (!gtk_widget_get_visible(gtkconv->infopane)) { /* There's already an entry for alias. Let's not create another one. */ return FALSE; } @@ -9606,7 +9615,7 @@ plugin_changed_cb(PurplePlugin *p, gpointer data) static gboolean gtk_conv_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data) { int x, y; - if (GTK_WIDGET_VISIBLE(w)) + if (gtk_widget_get_visible(w)) gtk_window_get_position(GTK_WINDOW(w), &x, &y); else return FALSE; /* carry on normally */ @@ -9641,7 +9650,7 @@ pidgin_conv_set_position_size(PidginWindow *win, int conv_x, int conv_y, /* if the window exists, is hidden, we're saving positions, and the * position is sane... */ if (win && win->window && - !GTK_WIDGET_VISIBLE(win->window) && conv_width != 0) { + !gtk_widget_get_visible(win->window) && conv_width != 0) { #ifdef _WIN32 /* only override window manager placement on Windows */ /* ...check position is on screen... */ @@ -10246,7 +10255,7 @@ conv_placement_last_created_win_type_configured_cb(GtkWidget *w, PurpleConversationType type = purple_conversation_get_type(conv->active_conv); GList *all; - if (GTK_WIDGET_VISIBLE(w)) + if (gtk_widget_get_visible(w)) gtk_window_get_position(GTK_WINDOW(w), &x, &y); else return FALSE; /* carry on normally */ diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index 74c45f7f4a..ddd82309df 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -128,7 +128,11 @@ debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) static gboolean configure_cb(GtkWidget *w, GdkEventConfigure *event, DebugWindow *win) { +#if GTK_CHECK_VERSION(2,18,0) + if (gtk_widget_get_visible(w)) { +#else if (GTK_WIDGET_VISIBLE(w)) { +#endif purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/width", event->width); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/height", event->height); } @@ -625,7 +629,11 @@ regex_changed_cb(GtkWidget *w, DebugWindow *win) { static void regex_key_release_cb(GtkWidget *w, GdkEventKey *e, DebugWindow *win) { if(e->keyval == GDK_Return && +#if GTK_CHECK_VERSION(2,18,0) + gtk_widget_is_sensitive(win->filter) && +#else GTK_WIDGET_IS_SENSITIVE(win->filter) && +#endif !gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter), TRUE); diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 8168692dfc..c3515c7f90 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -65,6 +65,16 @@ #define TOOLTIP_TIMEOUT 500 +#if !GTK_CHECK_VERSION(2,20,0) +#define gtk_widget_get_realized(x) GTK_WIDGET_REALIZED(x) + +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_has_window(x) !GTK_WIDGET_NO_WINDOW(x) +#define gtk_widget_get_state(x) GTK_WIDGET_STATE(x) +#define gtk_widget_is_drawable(x) GTK_WIDGET_DRAWABLE(x) +#endif +#endif + static GtkTextViewClass *parent_class = NULL; struct scalable_data { @@ -422,7 +432,7 @@ static void gtk_imhtml_size_allocate(GtkWidget *widget, GtkAllocation *alloc) /* Don't scroll here if we're in the middle of a smooth scroll */ if (scroll && imhtml->scroll_time == NULL && - GTK_WIDGET_REALIZED(imhtml)) + gtk_widget_get_realized(GTK_WIDGET(imhtml))) gtk_imhtml_scroll_to_end(imhtml, FALSE); } @@ -539,7 +549,7 @@ gtk_imhtml_tip (gpointer data) g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); - if (!imhtml->tip || !GTK_WIDGET_DRAWABLE (GTK_WIDGET(imhtml))) { + if (!imhtml->tip || !gtk_widget_is_drawable (GTK_WIDGET(imhtml))) { imhtml->tip_timer = 0; return FALSE; } @@ -592,7 +602,7 @@ gtk_imhtml_tip (gpointer data) h = 8 + baseline_skip; gdk_window_get_pointer (NULL, &x, &y, NULL); - if (GTK_WIDGET_NO_WINDOW (GTK_WIDGET(imhtml))) + if (!gtk_widget_get_has_window (GTK_WIDGET(imhtml))) y += GTK_WIDGET(imhtml)->allocation.y; scr_w = gdk_screen_width(); @@ -788,7 +798,7 @@ gtk_imhtml_expose_event (GtkWidget *widget, gdk_color_parse(GTK_IMHTML(widget)->edit.background, &gcolor); gdk_cairo_set_source_color(cr, &gcolor); } else { - gdk_cairo_set_source_color(cr, &(widget->style->base[GTK_WIDGET_STATE(widget)])); + gdk_cairo_set_source_color(cr, &(widget->style->base[gtk_widget_get_state(widget)])); } cairo_rectangle(cr, diff --git a/pidgin/gtkimhtmltoolbar.c b/pidgin/gtkimhtmltoolbar.c index 5a8f4c5458..6e57ed9aa5 100644 --- a/pidgin/gtkimhtmltoolbar.c +++ b/pidgin/gtkimhtmltoolbar.c @@ -43,6 +43,11 @@ #include +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) +#define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE(x) +#endif + static GtkHBoxClass *parent_class = NULL; static void toggle_button_set_active_block(GtkToggleButton *button, @@ -1196,7 +1201,7 @@ gtk_imhtmltoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, GtkIMHtml if (event->button != 3) return FALSE; - wide = GTK_WIDGET_VISIBLE(toolbar->bold); + wide = gtk_widget_get_visible(toolbar->bold); menu = gtk_menu_new(); item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items")); @@ -1291,7 +1296,7 @@ static void gtk_imhtmltoolbar_create_old_buttons(GtkIMHtmlToolbar *toolbar) static void button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) { - if (GTK_WIDGET_VISIBLE(button)) + if (gtk_widget_get_visible(button)) gtk_widget_hide(item); else gtk_widget_show(item); @@ -1300,7 +1305,7 @@ button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) static void button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) { - gtk_widget_set_sensitive(item, GTK_WIDGET_IS_SENSITIVE(button)); + gtk_widget_set_sensitive(item, gtk_widget_is_sensitive(button)); } static void diff --git a/pidgin/gtkmenutray.c b/pidgin/gtkmenutray.c index 00cfce120c..f78661ad2d 100644 --- a/pidgin/gtkmenutray.c +++ b/pidgin/gtkmenutray.c @@ -40,6 +40,10 @@ static GObjectClass *parent_class = NULL; * Internal Stuff *****************************************************************************/ +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_has_window(x) !GTK_WIDGET_NO_WINDOW(x) +#endif + /****************************************************************************** * Item Stuff *****************************************************************************/ @@ -209,7 +213,7 @@ pidgin_menu_tray_add(PidginMenuTray *menu_tray, GtkWidget *widget, g_return_if_fail(PIDGIN_IS_MENU_TRAY(menu_tray)); g_return_if_fail(GTK_IS_WIDGET(widget)); - if (GTK_WIDGET_NO_WINDOW(widget)) + if (!gtk_widget_get_has_window(widget)) { GtkWidget *event; @@ -256,7 +260,7 @@ pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const * case, we want to set the tooltip on the widget's parent, * not on the widget itself. */ - if (GTK_WIDGET_NO_WINDOW(widget)) + if (!gtk_widget_get_has_window(widget)) widget = widget->parent; #if GTK_CHECK_VERSION(2,12,0) diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 1b995c0301..1c1422ca57 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -777,7 +777,11 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, } } +#if GTK_CHECK_VERSION(2,18,0) + if (!gtk_widget_get_visible(mail_dialog->dialog)) { +#else if (!GTK_WIDGET_VISIBLE(mail_dialog->dialog)) { +#endif GdkPixbuf *pixbuf = gtk_widget_render_icon(mail_dialog->dialog, PIDGIN_STOCK_DIALOG_MAIL, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), NULL); char *label_text = g_strdup_printf(ngettext("%d new email.", @@ -793,7 +797,11 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, g_free(label_text); if (pixbuf) g_object_unref(pixbuf); +#if GTK_CHECK_VERSION(2,18,0) + } else if (!gtk_widget_has_focus(mail_dialog->dialog)) +#else } else if (!GTK_WIDGET_HAS_FOCUS(mail_dialog->dialog)) +#endif pidgin_set_urgent(GTK_WINDOW(mail_dialog->dialog), TRUE); return data; diff --git a/pidgin/gtkpounce.c b/pidgin/gtkpounce.c index dbaca6430a..be797e3b73 100644 --- a/pidgin/gtkpounce.c +++ b/pidgin/gtkpounce.c @@ -1018,7 +1018,11 @@ pidgin_pounce_editor_show(PurpleAccount *account, const char *name, static gboolean pounces_manager_configure_cb(GtkWidget *widget, GdkEventConfigure *event, PouncesManager *dialog) { +#if GTK_CHECK_VERSION(2,18,0) + if (gtk_widget_get_visible(widget)) { +#else if (GTK_WIDGET_VISIBLE(widget)) { +#endif purple_prefs_set_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width", event->width); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height", event->height); } diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index ae67095116..b0f4227c83 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -263,7 +263,11 @@ multifield_ok_cb(GtkWidget *button, PidginRequestData *data) { generic_response_start(data); +#if GTK_CHECK_VERSION(2,18,0) + if (!gtk_widget_has_focus(button)) +#else if (!GTK_WIDGET_HAS_FOCUS(button)) +#endif gtk_widget_grab_focus(button); if (data->cbs[0] != NULL) diff --git a/pidgin/gtksavedstatuses.c b/pidgin/gtksavedstatuses.c index c82c8317f3..bf8d1394c1 100644 --- a/pidgin/gtksavedstatuses.c +++ b/pidgin/gtksavedstatuses.c @@ -524,7 +524,11 @@ create_saved_status_list(StatusWindow *dialog) static gboolean configure_cb(GtkWidget *widget, GdkEventConfigure *event, StatusWindow *dialog) { +#if GTK_CHECK_VERSION(2,18,0) + if (gtk_widget_get_visible(widget)) +#else if (GTK_WIDGET_VISIBLE(widget)) +#endif { purple_prefs_set_int(PIDGIN_PREFS_ROOT "/status/dialog/width", event->width); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/status/dialog/height", event->height); diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index 422f84904c..f163b68c33 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -70,6 +70,10 @@ /* Timeout for typing notifications in seconds */ #define TYPING_TIMEOUT 4 +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE(x) +#endif + static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data); static void remove_typing_cb(PidginStatusBox *box); @@ -2625,7 +2629,7 @@ static void pidgin_status_box_changed(PidginStatusBox *status_box) purple_timeout_remove(status_box->typing); status_box->typing = 0; - if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) + if (gtk_widget_is_sensitive(GTK_WIDGET(status_box))) { if (type == PIDGIN_STATUS_BOX_TYPE_POPULAR || type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR) { @@ -2687,7 +2691,7 @@ static void pidgin_status_box_changed(PidginStatusBox *status_box) } g_list_free(accounts); - if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) + if (gtk_widget_is_sensitive(GTK_WIDGET(status_box))) { if (status_box->imhtml_visible) { @@ -2743,7 +2747,7 @@ get_statusbox_index(PidginStatusBox *box, PurpleSavedStatus *saved_status) static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) { PidginStatusBox *status_box = (PidginStatusBox*)data; - if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) + if (gtk_widget_is_sensitive(GTK_WIDGET(status_box))) { if (status_box->typing != 0) { pidgin_status_box_pulse_typing(status_box); diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 55b23dab65..0b64e68882 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -70,6 +70,11 @@ #include "gtkwebview.h" #include "pidgin/minidialog.h" +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) +#define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE(x) +#endif + typedef struct { GtkTreeModel *model; gint default_item; @@ -356,7 +361,7 @@ pidgin_toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) if (to_toggle == NULL) return; - sensitivity = GTK_WIDGET_IS_SENSITIVE(to_toggle); + sensitivity = gtk_widget_is_sensitive(to_toggle); gtk_widget_set_sensitive(to_toggle, !sensitivity); } @@ -373,7 +378,7 @@ pidgin_toggle_sensitive_array(GtkWidget *w, GPtrArray *data) if (element == NULL) continue; - sensitivity = GTK_WIDGET_IS_SENSITIVE(element); + sensitivity = gtk_widget_is_sensitive(element); gtk_widget_set_sensitive(element, !sensitivity); } @@ -385,7 +390,7 @@ pidgin_toggle_showhide(GtkWidget *widget, GtkWidget *to_toggle) if (to_toggle == NULL) return; - if (GTK_WIDGET_VISIBLE(to_toggle)) + if (gtk_widget_get_visible(to_toggle)) gtk_widget_hide(to_toggle); else gtk_widget_show(to_toggle); @@ -2991,7 +2996,7 @@ gboolean pidgin_auto_parent_window(GtkWidget *widget) windows = g_list_delete_link(windows, windows); if (window == widget || - !GTK_WIDGET_VISIBLE(window)) + !gtk_widget_get_visible(window)) continue; if (!gdk_property_get(window->window, _WindowTime, _Cardinal, 0, sizeof(time_t), FALSE, @@ -3045,7 +3050,7 @@ gboolean pidgin_auto_parent_window(GtkWidget *widget) windows = g_list_delete_link(windows, windows); if (window == widget || - !GTK_WIDGET_VISIBLE(window)) { + !gtk_widget_get_visible(window)) { continue; } -- cgit v1.2.1 From e7aec25293fa551ce3116fd160e5c3213495c0de Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 03:35:22 +0000 Subject: Fix calls to GTK_WIDGET_SET_FLAGS, which oddly enough does not seem to be deprecated even though the underlying GTK_OBJECT_FLAGS is. --- pidgin/gtkdialogs.c | 4 ++++ pidgin/gtkrequest.c | 23 +++++++++++++++++++---- pidgin/gtkstatusbox.c | 8 +++++++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index f569ec597f..6c12901fa0 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -462,7 +462,11 @@ pidgin_build_help_dialog(const char *title, const char *role, GString *string) button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, G_CALLBACK(destroy_win), win); +#if GTK_CHECK_VERSION(2,18,0) + gtk_widget_set_can_default(button, TRUE); +#else GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); +#endif gtk_widget_grab_default(button); gtk_widget_show_all(win); diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index b0f4227c83..23ed979514 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -39,6 +39,21 @@ #include +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_set_can_default(x,y) do {\ + if (y) \ + GTK_WIDGET_SET_FLAGS(x, GTK_CAN_DEFAULT); \ + else \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_CAN_DEFAULT); \ +} while(0) +#define gtk_widget_set_can_focus(x,y) do {\ + if (y) \ + GTK_WIDGET_SET_FLAGS(x, GTK_CAN_FOCUS); \ + else \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_CAN_FOCUS); \ +} while(0) +#endif + static GtkWidget * create_account_field(PurpleRequestField *field); typedef struct @@ -731,8 +746,8 @@ pidgin_request_action_with_icon(const char *title, const char *primary, if (default_action == PURPLE_DEFAULT_ACTION_NONE) { - GTK_WIDGET_SET_FLAGS(img, GTK_CAN_DEFAULT); - GTK_WIDGET_SET_FLAGS(img, GTK_CAN_FOCUS); + gtk_widget_set_can_default(img, TRUE); + gtk_widget_set_can_focus(img, TRUE); gtk_widget_grab_focus(img); gtk_widget_grab_default(img); } else @@ -1270,12 +1285,12 @@ pidgin_request_fields(const char *title, const char *primary, /* Cancel button */ button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(cancel_text), G_CALLBACK(multifield_cancel_cb), data); - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(button, TRUE); /* OK button */ button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(ok_text), G_CALLBACK(multifield_ok_cb), data); data->ok_button = button; - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(button, TRUE); gtk_window_set_default(GTK_WINDOW(win), button); pidgin_widget_decorate_account(hbox, account); diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index f163b68c33..f1d5c422ff 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -72,6 +72,12 @@ #if !GTK_CHECK_VERSION(2,18,0) #define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE(x) +#define gtk_widget_set_has_window(x, y) do { \ + if (y) \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_WIDGET_NO_WINDOW); \ + else \ + GTK_WIDGET_SET_FLAGS(x, GTK_WIDGET_NO_WINDOW); \ +} while (0) #endif static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); @@ -1753,7 +1759,7 @@ pidgin_status_box_init (PidginStatusBox *status_box) GtkWidget *toplevel; GtkTreeSelection *sel; - GTK_WIDGET_SET_FLAGS (status_box, GTK_NO_WINDOW); + gtk_widget_set_has_window(GTK_WIDGET(status_box), FALSE); status_box->imhtml_visible = FALSE; status_box->network_available = purple_network_is_available(); status_box->connecting = FALSE; -- cgit v1.2.1 From b68ce0c2e5dabf98c450cb0886800e43eacdc35d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 03:40:34 +0000 Subject: It appears that GtkNotebookPage is deprecated, though the 'switch-page' signal that uses it doesn't seem to have a replacement. Anyway, we don't use that parameter, so we can just leave it as a generic widget. --- pidgin/gtkscrollbook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkscrollbook.c b/pidgin/gtkscrollbook.c index aa499932ed..50f5748dca 100644 --- a/pidgin/gtkscrollbook.c +++ b/pidgin/gtkscrollbook.c @@ -147,7 +147,7 @@ scroll_close_cb(PidginScrollBook *scroll_book, GdkEventButton *event) } static void -switch_page_cb(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, PidginScrollBook *scroll_book) +switch_page_cb(GtkNotebook *notebook, GtkWidget *page, guint page_num, PidginScrollBook *scroll_book) { int count; count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook)); -- cgit v1.2.1 From 30fc4b8966e3b371b007ccc0c89eb96d89c6b5e5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 03:56:58 +0000 Subject: Replace the deprecated gtk_notebook_set_tab_label_packing with a call to gtk_container_child_set with the relevant properties. --- pidgin/gtkconv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 17d5a5c562..62b6e7056a 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -10024,9 +10024,9 @@ pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv) gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox); } - gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, - !tabs_side && !angle, - TRUE, GTK_PACK_START); + gtk_container_child_set(GTK_CONTAINER(win->notebook), gtkconv->tab_cont, + "tab-expand", !tabs_side && !angle, + "tab-fill", TRUE, NULL); if (pidgin_conv_window_get_gtkconv_count(win) == 1) gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), -- cgit v1.2.1 From f00ce77a54bfc3a88a68932180b4c57fc42427b8 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 04:55:33 +0000 Subject: GDK_DISPLAY has been deprecated, and its replacement has been around for a long time. --- pidgin/gtkidle.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkidle.c b/pidgin/gtkidle.c index f5cf624b97..39862ca4fb 100644 --- a/pidgin/gtkidle.c +++ b/pidgin/gtkidle.c @@ -107,14 +107,16 @@ pidgin_get_time_idle(void) int event_base, error_base; if (has_extension == -1) - has_extension = XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base); + has_extension = XScreenSaverQueryExtension(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), + &event_base, &error_base); if (has_extension) { if (mit_info == NULL) mit_info = XScreenSaverAllocInfo(); - XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info); + XScreenSaverQueryInfo(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), + GDK_ROOT_WINDOW(), mit_info); return (mit_info->idle) / 1000; } else -- cgit v1.2.1 From 614c5c6cc74af2dd09928a51cc675bfb3eba4312 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 05:03:55 +0000 Subject: Cairo-ify buddy list tooltips. --- pidgin/gtkblist.c | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 233dec9888..75fc7f27da 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -2940,6 +2940,7 @@ static gboolean pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) { GtkStyle *style; + cairo_t *cr; int current_height, max_width; int max_text_width; int max_avatar_width; @@ -2973,6 +2974,7 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) else prpl_col = TOOLTIP_BORDER + status_size + SMALL_SPACE + max_text_width - PRPL_SIZE; + cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(gtkblist->tipwindow))); current_height = 12; for(l = gtkblist->tooltipdata; l; l = l->next) { @@ -2992,30 +2994,37 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) } if (td->status_icon) { - if (dir == GTK_TEXT_DIR_RTL) - gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon, - 0, 0, max_width - TOOLTIP_BORDER - status_size, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); - else - gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon, - 0, 0, TOOLTIP_BORDER, current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); + if (dir == GTK_TEXT_DIR_RTL) { + gdk_cairo_set_source_pixbuf(cr, td->status_icon, + max_width - TOOLTIP_BORDER - status_size, + current_height); + cairo_paint(cr); + } else { + gdk_cairo_set_source_pixbuf(cr, td->status_icon, + TOOLTIP_BORDER, current_height); + cairo_paint(cr); + } } if(td->avatar) { - if (dir == GTK_TEXT_DIR_RTL) - gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, - td->avatar, 0, 0, TOOLTIP_BORDER, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); - else - gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, - td->avatar, 0, 0, max_width - (td->avatar_width + TOOLTIP_BORDER), - current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); + if (dir == GTK_TEXT_DIR_RTL) { + gdk_cairo_set_source_pixbuf(cr, td->avatar, + TOOLTIP_BORDER, current_height); + cairo_paint(cr); + } else { + gdk_cairo_set_source_pixbuf(cr, td->avatar, + max_width - (td->avatar_width + TOOLTIP_BORDER), + current_height); + cairo_paint(cr); + } } - if (!td->avatar_is_prpl_icon && td->prpl_icon) - gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->prpl_icon, - 0, 0, - prpl_col, - current_height + ((td->name_height / 2) - (PRPL_SIZE / 2)), - -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); + if (!td->avatar_is_prpl_icon && td->prpl_icon) { + gdk_cairo_set_source_pixbuf(cr, td->prpl_icon, prpl_col, + current_height + + (td->name_height - PRPL_SIZE) / 2); + cairo_paint(cr); + } if (td->name_layout) { if (dir == GTK_TEXT_DIR_RTL) { @@ -3046,6 +3055,8 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) current_height += MAX(td->name_height + td->height, td->avatar_height) + td->padding; } + + cairo_destroy(cr); return FALSE; } -- cgit v1.2.1 From ffb0b5b3c9a26962e541e6063dfd3f3f256d9876 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 05:37:17 +0000 Subject: Render the DND hint windows using the new window's colourmap instead of trying to force a colourmap on the window. --- pidgin/gtkdnd-hints.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pidgin/gtkdnd-hints.c b/pidgin/gtkdnd-hints.c index faed31c511..750d6aef4b 100644 --- a/pidgin/gtkdnd-hints.c +++ b/pidgin/gtkdnd-hints.c @@ -62,19 +62,20 @@ dnd_hints_init_window(const gchar *fname) GdkBitmap *bitmap; GtkWidget *pix; GtkWidget *win; + GdkColormap *colormap; pixbuf = gdk_pixbuf_new_from_file(fname, NULL); g_return_val_if_fail(pixbuf, NULL); - gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, &bitmap, 128); + win = gtk_window_new(GTK_WINDOW_POPUP); + colormap = gtk_widget_get_colormap(win); + gdk_pixbuf_render_pixmap_and_mask_for_colormap(pixbuf, colormap, + &pixmap, &bitmap, 128); g_object_unref(G_OBJECT(pixbuf)); - gtk_widget_push_colormap(gdk_rgb_get_colormap()); - win = gtk_window_new(GTK_WINDOW_POPUP); pix = gtk_image_new_from_pixmap(pixmap, bitmap); gtk_container_add(GTK_CONTAINER(win), pix); gtk_widget_shape_combine_mask(win, bitmap, 0, 0); - gtk_widget_pop_colormap(); g_object_unref(G_OBJECT(pixmap)); g_object_unref(G_OBJECT(bitmap)); -- cgit v1.2.1 From d812a921d6dfee774d1cc096ba9d29529272db35 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 06:01:04 +0000 Subject: Add the Get Attention action to the PidginWindow menu structure, and correctly initialize its value. --- pidgin/gtkconv.c | 13 ++++++++----- pidgin/gtkconvwin.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 62b6e7056a..a3553520e5 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3567,6 +3567,10 @@ setup_menubar(PidginWindow *win) gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/SendFile"); + win->menu.get_attention = + gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/GetAttention"); + win->menu.add_pounce = gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/AddBuddyPounce"); @@ -6925,7 +6929,7 @@ gray_stuff_out(PidginConversation *gtkconv) /* Deal with menu items */ gtk_action_set_visible(win->menu.view_log, TRUE); gtk_action_set_visible(win->menu.send_file, TRUE); - gtk_action_set_visible(g_object_get_data(G_OBJECT(win->window), "get_attention"), TRUE); + gtk_action_set_visible(win->menu.get_attention, TRUE); gtk_action_set_visible(win->menu.add_pounce, TRUE); gtk_action_set_visible(win->menu.get_info, TRUE); gtk_action_set_visible(win->menu.invite, FALSE); @@ -6954,7 +6958,7 @@ gray_stuff_out(PidginConversation *gtkconv) /* Deal with menu items */ gtk_action_set_visible(win->menu.view_log, TRUE); gtk_action_set_visible(win->menu.send_file, FALSE); - gtk_action_set_visible(g_object_get_data(G_OBJECT(win->window), "get_attention"), FALSE); + gtk_action_set_visible(win->menu.get_attention, FALSE); gtk_action_set_visible(win->menu.add_pounce, FALSE); gtk_action_set_visible(win->menu.get_info, FALSE); gtk_action_set_visible(win->menu.invite, TRUE); @@ -7036,7 +7040,7 @@ gray_stuff_out(PidginConversation *gtkconv) gtk_action_set_sensitive(win->menu.send_file, (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, purple_conversation_get_name(conv))))); - gtk_action_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL)); + gtk_action_set_sensitive(win->menu.get_attention, (prpl_info->send_attention != NULL)); gtk_action_set_sensitive(win->menu.alias, (account != NULL) && (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); @@ -7057,8 +7061,7 @@ gray_stuff_out(PidginConversation *gtkconv) /* Then deal with menu items */ gtk_action_set_sensitive(win->menu.view_log, TRUE); gtk_action_set_sensitive(win->menu.send_file, FALSE); - gtk_action_set_sensitive(g_object_get_data(G_OBJECT(win->window), - "get_attention"), FALSE); + gtk_action_set_sensitive(win->menu.get_attention, FALSE); gtk_action_set_sensitive(win->menu.add_pounce, TRUE); gtk_action_set_sensitive(win->menu.get_info, FALSE); gtk_action_set_sensitive(win->menu.invite, FALSE); diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index ee42f17e61..c27f92ce8f 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -51,6 +51,7 @@ struct _PidginWindow GtkAction *view_log; GtkAction *send_file; + GtkAction *get_attention; GtkAction *add_pounce; GtkAction *get_info; GtkAction *invite; -- cgit v1.2.1 From 294dd0e229bbdd6b5a3f91bda8d4f8270ebdbb0e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 07:09:39 +0000 Subject: This existing Send To menu stuff works already, and isn't really deprecated yet, so might as well leave it as is. --- pidgin/gtkconv.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index a3553520e5..11f5593694 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3824,7 +3824,6 @@ update_send_to_selection(PidginWindow *win) if (!(b = purple_find_buddy(account, purple_conversation_get_name(conv)))) return FALSE; -#if 0 /* TODO */ gtk_widget_show(win->menu.send_to); menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(win->menu.send_to)); @@ -3846,7 +3845,6 @@ update_send_to_selection(PidginWindow *win) break; } } -#endif return FALSE; } @@ -3956,7 +3954,6 @@ compare_buddy_presence(PurplePresence *p1, PurplePresence *p2) static void generate_send_to_items(PidginWindow *win) { -#if 0 /* TODO */ GtkWidget *menu; GSList *group = NULL; GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -4042,7 +4039,6 @@ generate_send_to_items(PidginWindow *win) if (!group) gtk_widget_set_sensitive(win->menu.send_to, FALSE); update_send_to_selection(win); -#endif } static const char * @@ -9022,9 +9018,8 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc /* Right click was pressed. Popup the context menu. */ GtkWidget *menu = gtk_menu_new(), *sub; gboolean populated = populate_menu_with_options(menu, gtkconv, TRUE); -#if 0 /* TODO */ - sub = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to)); + sub = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to)); if (sub && GTK_WIDGET_IS_SENSITIVE(gtkconv->win->menu.send_to)) { GtkWidget *item = gtk_menu_item_new_with_mnemonic(_("S_end To")); if (populated) @@ -9037,7 +9032,7 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc gtk_widget_destroy(menu); return FALSE; } -#endif + gtk_widget_show_all(menu); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); return TRUE; -- cgit v1.2.1 From 2c9a49b47cda1e459b21d573ef1731928f4a6be9 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 9 Oct 2011 07:10:36 +0000 Subject: Oops, fix up one deprecated line. --- pidgin/gtkconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 11f5593694..ffac6e2a4b 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -9020,7 +9020,7 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc gboolean populated = populate_menu_with_options(menu, gtkconv, TRUE); sub = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to)); - if (sub && GTK_WIDGET_IS_SENSITIVE(gtkconv->win->menu.send_to)) { + if (sub && gtk_widget_is_sensitive(gtkconv->win->menu.send_to)) { GtkWidget *item = gtk_menu_item_new_with_mnemonic(_("S_end To")); if (populated) pidgin_separator(menu); -- cgit v1.2.1 From 6bf27c5f5754e0df67249846216d9dc81647444a Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Mon, 10 Oct 2011 23:39:33 +0000 Subject: Gadu-Gadu: Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. Fixes #14652 --- ChangeLog | 2 + libpurple/protocols/gg/gg-utils.c | 13 ++++ libpurple/protocols/gg/gg-utils.h | 15 ++++ libpurple/protocols/gg/gg.c | 151 ++++++++++++++++++++++++++---------- libpurple/protocols/gg/lib/common.c | 2 +- 5 files changed, 140 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83fe1feb03..e33686baae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ version 3.0.0 (??/??/????): * Show local time for incoming messages. (Tomasz Wasilczyk) (#4579) * Detailed descriptions on connection failures. (Tomasz Wasilczyk) (#14648) + * Fixed password change dialog and problems with connecting to accounts + with non-ASCII passwords. (Tomasz Wasilczyk) (#14652) MXit: * Remove all reference to Hidden Number. diff --git a/libpurple/protocols/gg/gg-utils.c b/libpurple/protocols/gg/gg-utils.c index 96e3b295ce..7c89e155d4 100644 --- a/libpurple/protocols/gg/gg-utils.c +++ b/libpurple/protocols/gg/gg-utils.c @@ -143,5 +143,18 @@ void ggp_status_fake_to_self(PurpleAccount *account) msg ? "message" : NULL, msg, NULL); } +guint ggp_http_input_add(struct gg_http *http_req, PurpleInputFunction func, + gpointer user_data) +{ + PurpleInputCondition cond = 0; + int check = http_req->check; + + if (check & GG_CHECK_READ) + cond |= PURPLE_INPUT_READ; + if (check & GG_CHECK_WRITE) + cond |= PURPLE_INPUT_WRITE; + + return purple_input_add(http_req->fd, cond, func, user_data); +} /* vim: set ts=8 sts=0 sw=8 noet: */ diff --git a/libpurple/protocols/gg/gg-utils.h b/libpurple/protocols/gg/gg-utils.h index 48e8188250..7c7b800263 100644 --- a/libpurple/protocols/gg/gg-utils.h +++ b/libpurple/protocols/gg/gg-utils.h @@ -101,6 +101,21 @@ void ggp_status_fake_to_self(PurpleAccount *account); +/** + * Adds an input handler in purple event loop for http request. + * + * @see purple_input_add + * + * @param http_req Http connection to watch. + * @param func The callback function for data. + * @param user_data User-specified data. + * + * @return The resulting handle (will be greater than 0). + */ +guint +ggp_http_input_add(struct gg_http *http_req, PurpleInputFunction func, + gpointer user_data); + #endif /* _PURPLE_GG_UTILS_H */ /* vim: set ts=8 sts=0 sw=8 noet: */ diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 48f2d3cea6..e17bf10529 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -616,75 +616,137 @@ static void ggp_find_buddies(PurplePluginAction *action) gc); } -/* ----- CHANGE PASSWORD ------------------------------------------------ */ +/* ----- CHANGE PASSWORD ---------------------------------------------------- */ -static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields) +typedef struct +{ + guint inpa; + struct gg_http *http_req; + gchar *new_password; + PurpleAccount *account; +} ggp_change_passwd_request; + +static void ggp_callback_change_passwd_handler(gpointer _req, gint fd, + PurpleInputCondition cond) +{ + ggp_change_passwd_request *req = _req; + const char *messagesTitle = + _("Change password for the Gadu-Gadu account"); + + purple_input_remove(req->inpa); + + if (gg_pubdir_watch_fd(req->http_req) == -1 || + req->http_req->state == GG_STATE_ERROR) + goto exit_error; + + if (req->http_req->state != GG_STATE_DONE) + { + req->inpa = ggp_http_input_add(req->http_req, + ggp_callback_change_passwd_handler, req); + return; + } + + if (req->http_req->data != NULL && + ((struct gg_pubdir*)req->http_req->data)->success == 1) + { + purple_account_set_password(req->account, req->new_password); + purple_notify_info(req->account, messagesTitle, + _("Password was changed successfully!"), NULL); + goto exit_cleanup; + } + +exit_error: + purple_notify_error(req->account, messagesTitle, + _("Unable to change password. Error occurred.\n"), NULL); + +exit_cleanup: + gg_pubdir_free(req->http_req); + g_free(req->new_password); + g_free(req); +} + +static void ggp_callback_change_passwd_ok(PurpleConnection *gc, + PurpleRequestFields *fields) { PurpleAccount *account; GGPInfo *info = purple_connection_get_protocol_data(gc); struct gg_http *h; - gchar *cur, *p1, *p2, *t; - - cur = charset_convert( - purple_request_fields_get_string(fields, "password_cur"), - "UTF-8", "CP1250"); - p1 = charset_convert( - purple_request_fields_get_string(fields, "password1"), - "UTF-8", "CP1250"); - p2 = charset_convert( - purple_request_fields_get_string(fields, "password2"), - "UTF-8", "CP1250"); - t = charset_convert( - purple_request_fields_get_string(fields, "token"), - "UTF-8", "CP1250"); + gchar *cur, *p1, *p2, *t, *mail; + const char *messagesTitle = + _("Change password for the Gadu-Gadu account"); + + cur = g_strdup(purple_request_fields_get_string(fields, + "password_cur")); + p1 = g_strdup(purple_request_fields_get_string(fields, "password1")); + p2 = g_strdup(purple_request_fields_get_string(fields, "password2")); + t = g_strdup(purple_request_fields_get_string(fields, "token")); + mail = g_strdup(purple_request_fields_get_string(fields, "email")); account = purple_connection_get_account(gc); if (cur == NULL || p1 == NULL || p2 == NULL || t == NULL || - *cur == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { - purple_notify_error(account, NULL, _("Fill in the fields."), NULL); + mail == NULL || *cur == '\0' || *p1 == '\0' || *p2 == '\0' || + *t == '\0' || *mail == '\0') { + purple_notify_error(account, messagesTitle, + _("Fill in the fields."), NULL); goto exit_err; } if (g_utf8_collate(p1, p2) != 0) { - purple_notify_error(account, NULL, - _("New passwords do not match."), NULL); + purple_notify_error(account, messagesTitle, + _("New passwords do not match."), NULL); goto exit_err; } - if (g_utf8_collate(cur, purple_account_get_password(account)) != 0) { - purple_notify_error(account, NULL, - _("Your current password is different from the one that you specified."), + if (strlen(p1) > 15) { + purple_notify_error(account, messagesTitle, + _("New password should be at most 15 characters long."), NULL); goto exit_err; } - purple_debug_info("gg", "Changing password\n"); - - /* XXX: this email should be a pref... */ - h = gg_change_passwd4(ggp_get_uin(account), - "user@example.net", purple_account_get_password(account), - p1, info->token->id, t, 0); - - if (h == NULL) { - purple_notify_error(account, NULL, - _("Unable to change password. Error occurred.\n"), - NULL); + if (g_utf8_collate(cur, purple_account_get_password(account)) != 0) { + purple_notify_error(account, messagesTitle, + _("Your current password is different from the one that" + " you specified."), NULL); goto exit_err; } - purple_account_set_password(account, p1); + if (!purple_email_is_valid(mail)) { + purple_notify_error(account, messagesTitle, + _("Invalid email address"), NULL); + goto exit_err; + } - gg_change_passwd_free(h); + purple_debug_info("gg", "Changing password with email \"%s\"...\n", + mail); - purple_notify_info(account, _("Change password for the Gadu-Gadu account"), - _("Password was changed successfully!"), NULL); + h = gg_change_passwd4(ggp_get_uin(account), mail, + purple_account_get_password(account), p1, info->token->id, t, + 1); + if (h == NULL) + purple_notify_error(account, messagesTitle, + _("Unable to change password. Error occurred.\n"), + NULL); + else + { + ggp_change_passwd_request *req = + g_new(ggp_change_passwd_request, 1); + req->http_req = h; + req->new_password = g_strdup(p1); + req->account = account; + + req->inpa = ggp_http_input_add(h, + ggp_callback_change_passwd_handler, req); + } + exit_err: g_free(cur); g_free(p1); g_free(p2); g_free(t); + g_free(mail); g_free(info->token->id); g_free(info->token->data); g_free(info->token); @@ -701,7 +763,6 @@ static void ggp_change_passwd_dialog(PurpleConnection *gc) char *msg; - fields = purple_request_fields_new(); group = purple_request_field_group_new(NULL); purple_request_fields_add_group(fields, group); @@ -721,6 +782,11 @@ static void ggp_change_passwd_dialog(PurpleConnection *gc) purple_request_field_string_set_masked(field, TRUE); purple_request_field_group_add_field(group, field); + field = purple_request_field_string_new("email", + _("Email Address"), "", FALSE); + purple_request_field_string_set_masked(field, FALSE); + purple_request_field_group_add_field(group, field); + field = purple_request_field_string_new("token", _("Enter current token"), "", FALSE); purple_request_field_string_set_masked(field, FALSE); @@ -732,8 +798,8 @@ static void ggp_change_passwd_dialog(PurpleConnection *gc) purple_request_field_group_add_field(group, field); msg = g_strdup_printf("%s %d", - _("Please, enter your current password and your new password for UIN: "), - ggp_get_uin(purple_connection_get_account(gc))); + _("Please, enter your current password and your new password " + "for UIN: "), ggp_get_uin(purple_connection_get_account(gc))); purple_request_fields(gc, _("Change Gadu-Gadu Password"), @@ -2188,7 +2254,8 @@ static void ggp_login(PurpleAccount *account) purple_connection_set_protocol_data(gc, info); glp->uin = ggp_get_uin(account); - glp->password = (char *)purple_account_get_password(account); + glp->password = charset_convert(purple_account_get_password(account), + "UTF-8", "CP1250"); if (glp->uin == 0) { purple_connection_error(gc, diff --git a/libpurple/protocols/gg/lib/common.c b/libpurple/protocols/gg/lib/common.c index 4bb053f943..ee888056e2 100644 --- a/libpurple/protocols/gg/lib/common.c +++ b/libpurple/protocols/gg/lib/common.c @@ -92,7 +92,7 @@ char *gg_vsaprintf(const char *format, va_list ap) } buf = tmp; res = vsnprintf(buf, size, format, ap); - } while (res == size - 1 || res == -1); + } while (res >= size - 1 || res == -1); } #else { -- cgit v1.2.1 From 4933b2062689932d50ec96fdb37b596cd94c5cf4 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Tue, 11 Oct 2011 10:18:00 +0000 Subject: Gadu-Gadu: use correct libgadu api functions to change password --- libpurple/protocols/gg/gg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index e17bf10529..7cd3ce48ba 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -635,7 +635,7 @@ static void ggp_callback_change_passwd_handler(gpointer _req, gint fd, purple_input_remove(req->inpa); - if (gg_pubdir_watch_fd(req->http_req) == -1 || + if (gg_change_passwd_watch_fd(req->http_req) == -1 || req->http_req->state == GG_STATE_ERROR) goto exit_error; @@ -660,7 +660,7 @@ exit_error: _("Unable to change password. Error occurred.\n"), NULL); exit_cleanup: - gg_pubdir_free(req->http_req); + gg_change_passwd_free(req->http_req); g_free(req->new_password); g_free(req); } -- cgit v1.2.1 From 42153aa0d4031308dec1f9c170a68c98f2dafd28 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Tue, 11 Oct 2011 10:27:00 +0000 Subject: Gadu-Gadu: reorder actions to clean up the mess in gg account menu --- libpurple/protocols/gg/gg.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 7cd3ce48ba..d981310689 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -2756,14 +2756,16 @@ static GList *ggp_actions(PurplePlugin *plugin, gpointer context) GList *m = NULL; PurplePluginAction *act; + act = purple_plugin_action_new(_("Change password..."), + ggp_change_passwd); + m = g_list_append(m, act); + act = purple_plugin_action_new(_("Find buddies..."), ggp_find_buddies); m = g_list_append(m, act); - m = g_list_append(m, NULL); - - act = purple_plugin_action_new(_("Change password..."), - ggp_change_passwd); + act = purple_plugin_action_new(_("Change status broadcasting"), + ggp_action_change_status_broadcasting); m = g_list_append(m, act); m = g_list_append(m, NULL); @@ -2788,10 +2790,6 @@ static GList *ggp_actions(PurplePlugin *plugin, gpointer context) ggp_action_buddylist_load); m = g_list_append(m, act); - act = purple_plugin_action_new(_("Change status broadcasting"), - ggp_action_change_status_broadcasting); - m = g_list_append(m, act); - return m; } -- cgit v1.2.1 From 03a55c909012b913b0f43ab96b278ad6b2d6cc20 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Wed, 12 Oct 2011 21:06:20 +0000 Subject: Gadu-Gadu: option to show links from strangers. Fixes #10591 --- ChangeLog | 1 + libpurple/protocols/gg/gg.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index e33686baae..614cd37d01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ version 3.0.0 (??/??/????): (#14648) * Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. (Tomasz Wasilczyk) (#14652) + * Option to show links from strangers. (Tomasz Wasilczyk) (#10591) MXit: * Remove all reference to Hidden Number. diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index d981310689..2c75ffd884 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -2266,6 +2266,10 @@ static void ggp_login(PurpleAccount *account) } glp->image_size = 255; + glp->status_flags = GG_STATUS_FLAG_UNKNOWN; + + if (purple_account_get_bool(account, "show_links_from_strangers", 1)) + glp->status_flags |= GG_STATUS_FLAG_SPAM; presence = purple_account_get_presence(account); status = purple_presence_get_active_status(presence); @@ -2958,6 +2962,11 @@ static void init_plugin(PurplePlugin *plugin) prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + option = purple_account_option_bool_new(_("Show links from strangers"), + "show_links_from_strangers", 1); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + my_protocol = plugin; gg_debug_handler = purple_gg_debug_handler; -- cgit v1.2.1 From a018103f62ee00e1085a9096b9fe7a4564e4538b Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Thu, 13 Oct 2011 15:27:52 +0000 Subject: Gadu-Gadu: function to normalize gg usernames --- libpurple/protocols/gg/gg.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 2c75ffd884..e41ab5f8a5 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -2082,6 +2082,19 @@ static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy) return "gadu-gadu"; } +static const char *ggp_normalize(const PurpleAccount *account, const char *who) +{ + static char normalized[21]; /* maximum unsigned long long int size */ + + uin_t uin = ggp_str_to_uin(who); + if (uin <= 0) + return NULL; + + g_snprintf(normalized, sizeof(normalized), "%u", uin); + + return normalized; +} + static char *ggp_status_text(PurpleBuddy *b) { PurpleStatus *status; @@ -2850,7 +2863,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* rename_group */ NULL, /* buddy_free */ NULL, /* convo_closed */ - NULL, /* normalize */ + ggp_normalize, /* normalize */ NULL, /* set_buddy_icon */ NULL, /* remove_group */ NULL, /* get_cb_real_name */ -- cgit v1.2.1 From 50e6fa2878accc94de0bfda43f6f50bfe23b5558 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Fri, 14 Oct 2011 18:33:52 +0000 Subject: Gadu-Gadu: better handling of invisible and chatty statuses. Fixes #13836 --- ChangeLog | 2 ++ libpurple/protocols/gg/gg.c | 73 ++++++++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 614cd37d01..5521791ea1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ version 3.0.0 (??/??/????): * Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. (Tomasz Wasilczyk) (#14652) * Option to show links from strangers. (Tomasz Wasilczyk) (#10591) + * Better handling of "invisible" and "chatty" statuses. (Tomasz + Wasilczyk) (#13836) MXit: * Remove all reference to Hidden Number. diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index e41ab5f8a5..3f6dcf906c 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -1152,7 +1152,7 @@ static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, break; case GG_STATUS_FFC: case GG_STATUS_FFC_DESCR: - st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE); + st = "freeforchat"; break; case GG_STATUS_AVAIL: case GG_STATUS_AVAIL_DESCR: @@ -1162,6 +1162,10 @@ static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, case GG_STATUS_BUSY_DESCR: st = purple_primitive_get_id_from_type(PURPLE_STATUS_AWAY); break; + case GG_STATUS_INVISIBLE: + case GG_STATUS_INVISIBLE_DESCR: + st = purple_primitive_get_id_from_type(PURPLE_STATUS_INVISIBLE); + break; case GG_STATUS_DND: case GG_STATUS_DND_DESCR: st = purple_primitive_get_id_from_type(PURPLE_STATUS_UNAVAILABLE); @@ -2150,50 +2154,60 @@ static GList *ggp_status_types(PurpleAccount *account) PurpleStatusType *type; GList *types = NULL; - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, + NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); /* - * Without this selecting Invisible as own status doesn't - * work. It's not used and not needed to show status of buddies. + * New status for GG 8.0: PoGGadaj ze mna (chatty). + * NOTE: at this time, this is used only to set our own status. */ - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_INVISIBLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, + "freeforchat", _("Chatty"), TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, + NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); /* - * New statuses for GG 8.0 like PoGGadaj ze mna (not yet because - * libpurple can't support Chatty status) and Nie przeszkadzac + * New status for GG 8.0: Nie przeszkadzac (do not disturb). */ - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_UNAVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, + NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); + types = g_list_append(types, type); + + /* + * It's used on buddy list if and only if it's showing our own + * (invisible) status. + */ + type = purple_status_type_new_with_attrs(PURPLE_STATUS_INVISIBLE, + NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); /* * This status is necessary to display guys who are blocking *us*. */ - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_INVISIBLE, "blocked", _("Blocked"), TRUE, FALSE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_INVISIBLE, + "blocked", _("Blocked"), TRUE, FALSE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, + NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); return types; @@ -2565,6 +2579,9 @@ static int ggp_to_gg_status(PurpleStatus *status, char **msg) if (strcmp(status_id, "available") == 0) { new_status = GG_STATUS_AVAIL; new_status_descr = GG_STATUS_AVAIL_DESCR; + } else if (strcmp(status_id, "freeforchat") == 0) { + new_status = GG_STATUS_FFC; + new_status_descr = GG_STATUS_FFC_DESCR; } else if (strcmp(status_id, "away") == 0) { new_status = GG_STATUS_BUSY; new_status_descr = GG_STATUS_BUSY_DESCR; -- cgit v1.2.1 From 99b2e55ecd00877f9f4a28b6e09b4022d380f3cb Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Fri, 14 Oct 2011 18:36:16 +0000 Subject: I don't think, it's worth mentioning in ChangeLog. --- ChangeLog | 2 -- 1 file changed, 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5521791ea1..e12e25e336 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,8 +10,6 @@ version 3.0.0 (??/??/????): * Possibility to require encryption. Also, using encryption when available is default option now. (Tomasz Wasilczyk) * Show local time for incoming messages. (Tomasz Wasilczyk) (#4579) - * Detailed descriptions on connection failures. (Tomasz Wasilczyk) - (#14648) * Fixed password change dialog and problems with connecting to accounts with non-ASCII passwords. (Tomasz Wasilczyk) (#14652) * Option to show links from strangers. (Tomasz Wasilczyk) (#10591) -- cgit v1.2.1 From 5f5b33f8b010201f285a80e2cd0f2b54c8529871 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Fri, 14 Oct 2011 19:24:43 +0000 Subject: Gadu-Gadu: more debug messages for win32thread resolver. --- libpurple/protocols/gg/lib/resolver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libpurple/protocols/gg/lib/resolver.c b/libpurple/protocols/gg/lib/resolver.c index 529b9cb9cb..df1df28ec3 100644 --- a/libpurple/protocols/gg/lib/resolver.c +++ b/libpurple/protocols/gg/lib/resolver.c @@ -508,6 +508,8 @@ static int gg_resolve_win32thread(int *fd, void **resolver, const char *hostname return -1; } + gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() creating pipes...\n"); + if (socket_pipe(pipes) == -1) { gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() unable to create pipes (errno=%d, %s)\n", errno, strerror(errno)); return -1; @@ -529,6 +531,8 @@ static int gg_resolve_win32thread(int *fd, void **resolver, const char *hostname d->fd = pipes[1]; + gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() creating thread...\n"); + h = CreateThread(NULL, 0, gg_resolve_win32thread_thread, d, 0, &dwTId); -- cgit v1.2.1 From 121f5fc6fdaa231af8ddc1892207edccb0cfb646 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 15 Oct 2011 23:11:35 +0000 Subject: Hide unused gtkimhtml structs (aka, the easy ones). --- ChangeLog.API | 5 +++++ pidgin/gtkimhtml.c | 36 ++++++++++++++++++++++++++++++++++++ pidgin/gtkimhtml.h | 36 ------------------------------------ 3 files changed, 41 insertions(+), 36 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index aab00699c3..d131b008ed 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -190,7 +190,12 @@ version 3.0.0 (??/??/????): * PurplePluginProtocolInfo.get_cb_away * serv_got_attention * serv_send_attention + * struct _GtkIMHtmlAnimation * struct _GtkIMHtmlFontDetail + * struct _GtkIMHtmlHr + * struct _GtkIMHtmlImage + * struct _GtkIMHtmlScalable + * struct _GtkSmileyTree * struct _PidginChatPane * struct _PidginImPane * struct _PurpleAttentionType diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 8168692dfc..50b429b62b 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -83,6 +83,36 @@ struct im_image_data { GtkTextMark *mark; }; +struct _GtkIMHtmlScalable { + void (*scale)(struct _GtkIMHtmlScalable *, int, int); + void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); + void (*free)(struct _GtkIMHtmlScalable *); +}; + +struct _GtkIMHtmlHr { + GtkIMHtmlScalable scalable; + GtkWidget *sep; +}; + +struct _GtkIMHtmlImage { + GtkIMHtmlScalable scalable; + GtkImage *image; /**< Contains the scaled version of this pixbuf. */ + GdkPixbuf *pixbuf; /**< The original pixbuf, before any scaling. */ + GtkTextMark *mark; + gchar *filename; + int width; + int height; + int id; + GtkWidget *filesel; +}; + +struct _GtkIMHtmlAnimation { + GtkIMHtmlImage imhtmlimage; + GdkPixbufAnimation *anim; /**< The original animation, before any scaling. */ + GdkPixbufAnimationIter *iter; + guint timer; +}; + struct _GtkIMHtmlLink { GtkIMHtml *imhtml; @@ -90,6 +120,12 @@ struct _GtkIMHtmlLink GtkTextTag *tag; }; +struct _GtkSmileyTree { + GString *values; + GtkSmileyTree **children; + GtkIMHtmlSmiley *image; +}; + typedef struct { char *name; int length; diff --git a/pidgin/gtkimhtml.h b/pidgin/gtkimhtml.h index 655b9f3233..4b2f2bd46b 100644 --- a/pidgin/gtkimhtml.h +++ b/pidgin/gtkimhtml.h @@ -148,12 +148,6 @@ struct _GtkIMHtmlClass { GList *protocols; /* List of GtkIMHtmlProtocol's */ }; -struct _GtkSmileyTree { - GString *values; - GtkSmileyTree **children; - GtkIMHtmlSmiley *image; -}; - struct _GtkIMHtmlSmiley { gchar *smile; gchar *file; @@ -167,36 +161,6 @@ struct _GtkIMHtmlSmiley { gsize datasize; }; -struct _GtkIMHtmlScalable { - void (*scale)(struct _GtkIMHtmlScalable *, int, int); - void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); - void (*free)(struct _GtkIMHtmlScalable *); -}; - -struct _GtkIMHtmlImage { - GtkIMHtmlScalable scalable; - GtkImage *image; /**< Contains the scaled version of this pixbuf. */ - GdkPixbuf *pixbuf; /**< The original pixbuf, before any scaling. */ - GtkTextMark *mark; - gchar *filename; - int width; - int height; - int id; - GtkWidget *filesel; -}; - -struct _GtkIMHtmlAnimation { - GtkIMHtmlImage imhtmlimage; - GdkPixbufAnimation *anim; /**< The original animation, before any scaling. */ - GdkPixbufAnimationIter *iter; - guint timer; -}; - -struct _GtkIMHtmlHr { - GtkIMHtmlScalable scalable; - GtkWidget *sep; -}; - typedef enum { GTK_IMHTML_NO_COLOURS = 1 << 0, GTK_IMHTML_NO_FONTS = 1 << 1, -- cgit v1.2.1 From 9039217d9fe24979356ebd419fc448821db88992 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 15 Oct 2011 23:25:32 +0000 Subject: Clean up documentation. --- pidgin/gtkwebview.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index d548282971..ce0b608499 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -64,22 +64,22 @@ typedef struct _GtkWebViewClass GtkWebViewClass; /** * Returns the GType for a GtkWebView widget * - * @return the GType for GtkWebView widget + * @return The GType for GtkWebView widget */ GType gtk_webview_get_type(void); /** * Create a new GtkWebView object * - * @return a GtkWidget corresponding to the GtkWebView object + * @return A GtkWidget corresponding to the GtkWebView object */ GtkWidget *gtk_webview_new(void); /** * Set the vertical adjustment for the GtkWebView. * - * @param webview The GtkWebView. - * @param vadj The GtkAdjustment that control the webview. + * @param webview The GtkWebView object + * @param vadj The GtkAdjustment that control the webview */ void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj); @@ -109,7 +109,7 @@ void gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char * * @param webview The GtkWebView object * - * @return gboolean indicating whether the webview is empty. + * @return gboolean indicating whether the webview is empty */ gboolean gtk_webview_is_empty(GtkWebView *webview); @@ -120,8 +120,8 @@ gboolean gtk_webview_is_empty(GtkWebView *webview); * conditions when calling JS functions immediately after opening the * page. * - * @param webview the GtkWebView object - * @param script the script to execute + * @param webview The GtkWebView object + * @param script The script to execute */ void gtk_webview_safe_execute_script(GtkWebView *webview, const char *script); @@ -131,15 +131,15 @@ void gtk_webview_safe_execute_script(GtkWebView *webview, const char *script); * * @param str The string to escape and quote * - * @return the quoted string. + * @return The quoted string */ char *gtk_webview_quote_js_string(const char *str); /** * Scrolls the Webview to the end of its contents. * - * @param webview The GtkWebView. - * @param smooth A boolean indicating if smooth scrolling should be used. + * @param webview The GtkWebView object + * @param smooth A boolean indicating if smooth scrolling should be used */ void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth); -- cgit v1.2.1 From e60d09d3e7bc69a1eb6b8120236355fadf9ca876 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 15 Oct 2011 23:33:31 +0000 Subject: It doesn't make sense to set the entire slpcall wasted just because we've received a single packet. Anyway, this means our ACKs never get sent, and the MSN2011 client thinks we didn't receive the file. --- libpurple/protocols/msn/slpcall.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libpurple/protocols/msn/slpcall.c b/libpurple/protocols/msn/slpcall.c index 8f29699ded..98dcc58e7c 100644 --- a/libpurple/protocols/msn/slpcall.c +++ b/libpurple/protocols/msn/slpcall.c @@ -1145,8 +1145,6 @@ msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) if (slpcall->cb) slpcall->cb(slpcall, body, body_len); - - slpcall->wasted = TRUE; } } else if (msn_p2p_info_is_ack(slpmsg->p2p_info)) -- cgit v1.2.1 From a755c1dbd5398ffdc85afafd3f5028e8290bfd16 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 15 Oct 2011 23:43:14 +0000 Subject: Since we don't know what these fields are, and we don't use them, there's probably no need to waste memory for them. --- libpurple/protocols/msn/slp.c | 2 ++ libpurple/protocols/msn/xfer.c | 10 ++++++++++ libpurple/protocols/msn/xfer.h | 2 ++ 3 files changed, 14 insertions(+) diff --git a/libpurple/protocols/msn/slp.c b/libpurple/protocols/msn/slp.c index 699a1b1a6d..a69f89e333 100644 --- a/libpurple/protocols/msn/slp.c +++ b/libpurple/protocols/msn/slp.c @@ -336,8 +336,10 @@ gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) } memset(&context.file_name[currentChar], 0x00, (MAX_FILE_NAME_LEN - currentChar) * 2); +#if 0 memset(&context.unknown1, 0, sizeof(context.unknown1)); context.unknown2 = 0xffffffff; +#endif /* Mind the cast, as in, don't free it after! */ context.preview = (char *)preview; diff --git a/libpurple/protocols/msn/xfer.c b/libpurple/protocols/msn/xfer.c index 5996beeb93..89c9126d00 100644 --- a/libpurple/protocols/msn/xfer.c +++ b/libpurple/protocols/msn/xfer.c @@ -174,9 +174,15 @@ msn_file_context_to_wire(MsnFileContext *context) msn_push32le(tmp, context->type); memcpy(tmp, context->file_name, MAX_FILE_NAME_LEN * 2); tmp += MAX_FILE_NAME_LEN * 2; +#if 0 memcpy(tmp, context->unknown1, sizeof(context->unknown1)); tmp += sizeof(context->unknown1); msn_push32le(tmp, context->unknown2); +#else + memset(tmp, 0, sizeof(gchar[30])); + tmp += sizeof(gchar[30]); + msn_push32le(tmp, 0); +#endif if (context->preview) { memcpy(tmp, context->preview, context->preview_len); } @@ -218,9 +224,13 @@ msn_file_context_from_wire(const char *buf, gsize len) context->type = msn_pop32le(buf); memcpy(context->file_name, buf, MAX_FILE_NAME_LEN * 2); buf += MAX_FILE_NAME_LEN * 2; +#if 0 memcpy(context->unknown1, buf, sizeof(context->unknown1)); buf += sizeof(context->unknown1); context->unknown2 = msn_pop32le(buf); +#else + buf += sizeof(gchar[30]) + sizeof(guint32); +#endif if (context->type == 0 && len > context->length) { context->preview_len = len - context->length; diff --git a/libpurple/protocols/msn/xfer.h b/libpurple/protocols/msn/xfer.h index 23e19f37c3..022d05f0c1 100644 --- a/libpurple/protocols/msn/xfer.h +++ b/libpurple/protocols/msn/xfer.h @@ -39,8 +39,10 @@ typedef struct guint64 file_size; /*< Size of file */ guint32 type; /*< Transfer type */ gunichar2 file_name[MAX_FILE_NAME_LEN]; /*< Self-explanatory */ +#if 0 gchar unknown1[30]; /*< Used somehow for background sharing */ guint32 unknown2; /*< Possibly for background sharing as well */ +#endif gchar *preview; /*< File preview data, 96x96 PNG */ gsize preview_len; } MsnFileContext; -- cgit v1.2.1 From f5749fdc19fa4395670c375a36de78562817b7a5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 00:03:52 +0000 Subject: The second unknown field should be 0xffffffff to match previous and accepted behaviour. --- libpurple/protocols/msn/xfer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/msn/xfer.c b/libpurple/protocols/msn/xfer.c index 89c9126d00..75ea41f74b 100644 --- a/libpurple/protocols/msn/xfer.c +++ b/libpurple/protocols/msn/xfer.c @@ -181,7 +181,7 @@ msn_file_context_to_wire(MsnFileContext *context) #else memset(tmp, 0, sizeof(gchar[30])); tmp += sizeof(gchar[30]); - msn_push32le(tmp, 0); + msn_push32le(tmp, 0xffffffff); #endif if (context->preview) { memcpy(tmp, context->preview, context->preview_len); -- cgit v1.2.1 From 71519e7a1c82d175070840b5890cb9d1428f305e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 00:15:40 +0000 Subject: Add support for file context v0, which is used by older official MSN clients on Macs. --- ChangeLog | 3 +++ libpurple/protocols/msn/slp.c | 4 ++-- libpurple/protocols/msn/xfer.c | 31 +++++++++++++++++++++---------- libpurple/protocols/msn/xfer.h | 4 +++- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index e12e25e336..662f237dc1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,9 @@ version 3.0.0 (??/??/????): * Better handling of "invisible" and "chatty" statuses. (Tomasz Wasilczyk) (#13836) + MSN: + * Fix file transfer with older Mac MSN clients. + MXit: * Remove all reference to Hidden Number. * Fix decoding of font-size changes in the markup of received messages. diff --git a/libpurple/protocols/msn/slp.c b/libpurple/protocols/msn/slp.c index a69f89e333..ca1045989d 100644 --- a/libpurple/protocols/msn/slp.c +++ b/libpurple/protocols/msn/slp.c @@ -322,7 +322,7 @@ gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) preview = purple_xfer_get_thumbnail(xfer, &preview_len); - context.length = MSN_FILE_CONTEXT_SIZE; + context.length = MSN_FILE_CONTEXT_SIZE_V2; context.version = 2; /* V.3 contains additional unnecessary data */ context.file_size = size; if (preview) @@ -346,7 +346,7 @@ gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) context.preview_len = preview_len; u8 = msn_file_context_to_wire(&context); - ret = purple_base64_encode((const guchar *)u8, MSN_FILE_CONTEXT_SIZE + preview_len); + ret = purple_base64_encode((const guchar *)u8, MSN_FILE_CONTEXT_SIZE_V2 + preview_len); g_free(uni); g_free(u8); diff --git a/libpurple/protocols/msn/xfer.c b/libpurple/protocols/msn/xfer.c index 75ea41f74b..30f7789ea4 100644 --- a/libpurple/protocols/msn/xfer.c +++ b/libpurple/protocols/msn/xfer.c @@ -166,7 +166,7 @@ msn_file_context_to_wire(MsnFileContext *context) { gchar *ret, *tmp; - tmp = ret = g_new(gchar, MSN_FILE_CONTEXT_SIZE + context->preview_len + 1); + tmp = ret = g_new(gchar, MSN_FILE_CONTEXT_SIZE_V2 + context->preview_len + 1); msn_push32le(tmp, context->length); msn_push32le(tmp, context->version); @@ -196,21 +196,30 @@ msn_file_context_from_wire(const char *buf, gsize len) { MsnFileContext *context; - if (!buf || len < MSN_FILE_CONTEXT_SIZE) + if (!buf || len < MSN_FILE_CONTEXT_SIZE_V0) return NULL; context = g_new(MsnFileContext, 1); context->length = msn_pop32le(buf); context->version = msn_pop32le(buf); - if (context->version == 2) { + if (context->version == 0) { + if (context->length != MSN_FILE_CONTEXT_SIZE_V0) { + g_free(context); + return NULL; + } + } else if (context->version == 2) { /* The length field is broken for this version. No check. */ - context->length = MSN_FILE_CONTEXT_SIZE; + context->length = MSN_FILE_CONTEXT_SIZE_V2; + if (len < MSN_FILE_CONTEXT_SIZE_V2) { + g_free(context); + return NULL; + } } else if (context->version == 3) { - if (context->length != MSN_FILE_CONTEXT_SIZE + 63) { + if (context->length != MSN_FILE_CONTEXT_SIZE_V3) { g_free(context); return NULL; - } else if (len < MSN_FILE_CONTEXT_SIZE + 63) { + } else if (len < MSN_FILE_CONTEXT_SIZE_V3) { g_free(context); return NULL; } @@ -224,13 +233,15 @@ msn_file_context_from_wire(const char *buf, gsize len) context->type = msn_pop32le(buf); memcpy(context->file_name, buf, MAX_FILE_NAME_LEN * 2); buf += MAX_FILE_NAME_LEN * 2; + if (context->version > 0) { #if 0 - memcpy(context->unknown1, buf, sizeof(context->unknown1)); - buf += sizeof(context->unknown1); - context->unknown2 = msn_pop32le(buf); + memcpy(context->unknown1, buf, sizeof(context->unknown1)); + buf += sizeof(context->unknown1); + context->unknown2 = msn_pop32le(buf); #else - buf += sizeof(gchar[30]) + sizeof(guint32); + buf += sizeof(gchar[30]) + sizeof(guint32); #endif + } if (context->type == 0 && len > context->length) { context->preview_len = len - context->length; diff --git a/libpurple/protocols/msn/xfer.h b/libpurple/protocols/msn/xfer.h index 022d05f0c1..78f6a81b98 100644 --- a/libpurple/protocols/msn/xfer.h +++ b/libpurple/protocols/msn/xfer.h @@ -47,7 +47,9 @@ typedef struct gsize preview_len; } MsnFileContext; -#define MSN_FILE_CONTEXT_SIZE (4*4 + 1*8 + 2*MAX_FILE_NAME_LEN + 30) +#define MSN_FILE_CONTEXT_SIZE_V0 (4*3 + 1*8 + 2*MAX_FILE_NAME_LEN) +#define MSN_FILE_CONTEXT_SIZE_V2 (MSN_FILE_CONTEXT_SIZE_V0 + 4*1 + 30) +#define MSN_FILE_CONTEXT_SIZE_V3 (MSN_FILE_CONTEXT_SIZE_V2 + 63) void msn_xfer_init(PurpleXfer *xfer); void msn_xfer_cancel(PurpleXfer *xfer); -- cgit v1.2.1 From 1b3bebd921733af4d218cd72512f45d76fc12228 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 03:03:39 +0000 Subject: Remove free_memory argument from D-Bus list functions. It's already always set to FALSE in the auto-generated code. Fixes #1747. --- libpurple/dbus-analyze-functions.py | 4 ++-- libpurple/dbus-bindings.h | 12 ++++-------- libpurple/dbus-server.c | 20 ++++---------------- 3 files changed, 10 insertions(+), 26 deletions(-) diff --git a/libpurple/dbus-analyze-functions.py b/libpurple/dbus-analyze-functions.py index 2003e85d6e..32612bee61 100644 --- a/libpurple/dbus-analyze-functions.py +++ b/libpurple/dbus-analyze-functions.py @@ -495,7 +495,7 @@ class ServerBinding (Binding): if self.function.name in stringlists: self.cdecls.append("\tchar **%s;" % name) self.ccode.append("\tlist = %s;" % self.call) - self.ccode.append("\t%s = (char **)purple_%s_to_array(list, FALSE, &%s_LEN);" % \ + self.ccode.append("\t%s = (char **)purple_%s_to_array(list, &%s_LEN);" % \ (name, type[0], name)) self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &%s, %s_LEN" \ % (name, name)) @@ -507,7 +507,7 @@ class ServerBinding (Binding): else: self.cdecls.append("\tdbus_int32_t *%s;" % name) self.ccode.append("\tlist = %s;" % self.call) - self.ccode.append("\t%s = purple_dbusify_%s(list, FALSE, &%s_LEN);" % \ + self.ccode.append("\t%s = purple_dbusify_%s(list, &%s_LEN);" % \ (name, type[0], name)) if (not (self.function.name in constlists)): self.ccode.append("\tg_%s_free(list);" % type[0].lower()[1:]) diff --git a/libpurple/dbus-bindings.h b/libpurple/dbus-bindings.h index 5611ae58a7..1d6f95875e 100644 --- a/libpurple/dbus-bindings.h +++ b/libpurple/dbus-bindings.h @@ -84,14 +84,10 @@ purple_dbus_message_iter_get_args_valist (DBusMessageIter *iter, int first_arg_type, va_list var_args); -dbus_int32_t* purple_dbusify_GList(GList *list, gboolean free_memory, - dbus_int32_t *len); -dbus_int32_t* purple_dbusify_GSList(GSList *list, gboolean free_memory, - dbus_int32_t *len); -gpointer* purple_GList_to_array(GList *list, gboolean free_memory, - dbus_int32_t *len); -gpointer* purple_GSList_to_array(GSList *list, gboolean free_memory, - dbus_int32_t *len); +dbus_int32_t* purple_dbusify_GList(GList *list, dbus_int32_t *len); +dbus_int32_t* purple_dbusify_GSList(GSList *list, dbus_int32_t *len); +gpointer* purple_GList_to_array(GList *list, dbus_int32_t *len); +gpointer* purple_GSList_to_array(GSList *list, dbus_int32_t *len); GHashTable *purple_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error); const char* empty_to_null(const char *str); diff --git a/libpurple/dbus-server.c b/libpurple/dbus-server.c index 3318aa1111..72efc57107 100644 --- a/libpurple/dbus-server.c +++ b/libpurple/dbus-server.c @@ -300,7 +300,7 @@ null_to_empty(const char *s) } dbus_int32_t * -purple_dbusify_GList(GList *list, gboolean free_memory, dbus_int32_t *len) +purple_dbusify_GList(GList *list, dbus_int32_t *len) { dbus_int32_t *array; int i; @@ -311,14 +311,11 @@ purple_dbusify_GList(GList *list, gboolean free_memory, dbus_int32_t *len) for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) array[i] = purple_dbus_pointer_to_id(elem->data); - if (free_memory) - g_list_free(list); - return array; } dbus_int32_t * -purple_dbusify_GSList(GSList *list, gboolean free_memory, dbus_int32_t *len) +purple_dbusify_GSList(GSList *list, dbus_int32_t *len) { dbus_int32_t *array; int i; @@ -329,14 +326,11 @@ purple_dbusify_GSList(GSList *list, gboolean free_memory, dbus_int32_t *len) for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) array[i] = purple_dbus_pointer_to_id(elem->data); - if (free_memory) - g_slist_free(list); - return array; } gpointer * -purple_GList_to_array(GList *list, gboolean free_memory, dbus_int32_t *len) +purple_GList_to_array(GList *list, dbus_int32_t *len) { gpointer *array; int i; @@ -347,14 +341,11 @@ purple_GList_to_array(GList *list, gboolean free_memory, dbus_int32_t *len) for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) array[i] = elem->data; - if (free_memory) - g_list_free(list); - return array; } gpointer * -purple_GSList_to_array(GSList *list, gboolean free_memory, dbus_int32_t *len) +purple_GSList_to_array(GSList *list, dbus_int32_t *len) { gpointer *array; int i; @@ -365,9 +356,6 @@ purple_GSList_to_array(GSList *list, gboolean free_memory, dbus_int32_t *len) for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) array[i] = elem->data; - if (free_memory) - g_slist_free(list); - return array; } -- cgit v1.2.1 From 00f89648fc90a12773bfa6908464f186c083e9f2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 04:38:12 +0000 Subject: Upgrade PurpleXfer for a 64-bit world. Prpls and UIs still need to handle this properly though. Refs #1185. Refs #8477. --- ChangeLog.API | 10 ++++++++++ libpurple/ft.c | 12 ++++++------ libpurple/ft.h | 17 +++++++++-------- libpurple/util.c | 6 +++--- libpurple/util.h | 2 +- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index d131b008ed..fe0421dd59 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -84,15 +84,25 @@ version 3.0.0 (??/??/????): * purple_notify_user_info_prepend_pair renamed to purple_notify_user_info_prepend_pair_html * purple_srv_resolve now takes a PurpleAccount as the first parameter + * purple_str_size_to_units now takes a goffset as the size parameter * purple_txt_resolve now takes a PurpleAccount as the first parameter * purple_util_fetch_url_request now takes a PurpleAccount as the first parameter * purple_util_fetch_url_request now takes a length as the eighth parameter * purple_util_fetch_url_len now takes a length as the fifth parameter + * purple_xfer_get_bytes_remaining now returns a goffset + * purple_xfer_get_bytes_sent now returns a goffset + * purple_xfer_get_size now returns a goffset * purple_xfer_is_canceled renamed to purple_xfer_is_cancelled + * purple_xfer_set_bytes_sent now takes a goffset as the bytes_sent + parameter + * purple_xfer_set_size now takes a goffset as the size parameter * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter + * PurpleXfer.bytes_remaining is now a goffset + * PurpleXfer.bytes_sent is now a goffset + * PurpleXfer.size is now a goffset Removed: * _GntFileType diff --git a/libpurple/ft.c b/libpurple/ft.c index 2f18d14566..a7a3e09967 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -490,7 +490,7 @@ static void purple_xfer_ask_recv(PurpleXfer *xfer) { char *buf, *size_buf; - size_t size; + goffset size; gconstpointer thumb; gsize thumb_size; @@ -801,7 +801,7 @@ purple_xfer_get_local_filename(const PurpleXfer *xfer) return xfer->local_filename; } -size_t +goffset purple_xfer_get_bytes_sent(const PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, 0); @@ -809,7 +809,7 @@ purple_xfer_get_bytes_sent(const PurpleXfer *xfer) return xfer->bytes_sent; } -size_t +goffset purple_xfer_get_bytes_remaining(const PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, 0); @@ -817,7 +817,7 @@ purple_xfer_get_bytes_remaining(const PurpleXfer *xfer) return xfer->bytes_remaining; } -size_t +goffset purple_xfer_get_size(const PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, 0); @@ -965,7 +965,7 @@ purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename) } void -purple_xfer_set_size(PurpleXfer *xfer, size_t size) +purple_xfer_set_size(PurpleXfer *xfer, goffset size) { g_return_if_fail(xfer != NULL); @@ -982,7 +982,7 @@ purple_xfer_set_local_port(PurpleXfer *xfer, unsigned int local_port) } void -purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent) +purple_xfer_set_bytes_sent(PurpleXfer *xfer, goffset bytes_sent) { g_return_if_fail(xfer != NULL); diff --git a/libpurple/ft.h b/libpurple/ft.h index d8819109e2..8f18877d5c 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -140,7 +140,7 @@ struct _PurpleXfer char *message; /**< A message sent with the request */ char *filename; /**< The name sent over the network. */ char *local_filename; /**< The name on the local hard drive. */ - size_t size; /**< The size of the file. */ + goffset size; /**< The size of the file. */ FILE *dest_fp; /**< The destination file pointer. */ @@ -151,8 +151,8 @@ struct _PurpleXfer int fd; /**< The socket file descriptor. */ int watcher; /**< Watcher. */ - size_t bytes_sent; /**< The number of bytes sent. */ - size_t bytes_remaining; /**< The number of bytes remaining. */ + goffset bytes_sent; /**< The number of bytes sent. */ + goffset bytes_remaining; /**< The number of bytes remaining. */ time_t start_time; /**< When the transfer of data began. */ time_t end_time; /**< When the transfer of data ended. */ @@ -358,7 +358,7 @@ const char *purple_xfer_get_local_filename(const PurpleXfer *xfer); * * @return The number of bytes sent. */ -size_t purple_xfer_get_bytes_sent(const PurpleXfer *xfer); +goffset purple_xfer_get_bytes_sent(const PurpleXfer *xfer); /** * Returns the number of bytes remaining to send or receive. @@ -367,7 +367,7 @@ size_t purple_xfer_get_bytes_sent(const PurpleXfer *xfer); * * @return The number of bytes remaining. */ -size_t purple_xfer_get_bytes_remaining(const PurpleXfer *xfer); +goffset purple_xfer_get_bytes_remaining(const PurpleXfer *xfer); /** * Returns the size of the file being sent or received. @@ -376,7 +376,7 @@ size_t purple_xfer_get_bytes_remaining(const PurpleXfer *xfer); * * @return The total size of the file. */ -size_t purple_xfer_get_size(const PurpleXfer *xfer); +goffset purple_xfer_get_size(const PurpleXfer *xfer); /** * Returns the current percentage of progress of the transfer. @@ -496,7 +496,7 @@ void purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename); * @param xfer The file transfer. * @param size The size of the file. */ -void purple_xfer_set_size(PurpleXfer *xfer, size_t size); +void purple_xfer_set_size(PurpleXfer *xfer, goffset size); /** * Sets the local port of the file transfer. @@ -519,7 +519,7 @@ void purple_xfer_set_local_port(PurpleXfer *xfer, unsigned int local_port); * send. If we're receiving a file, this is the * next byte that we expect to receive. */ -void purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent); +void purple_xfer_set_bytes_sent(PurpleXfer *xfer, goffset bytes_sent); /** * Returns the UI operations structure for a file transfer. @@ -848,3 +848,4 @@ PurpleXferUiOps *purple_xfers_get_ui_ops(void); #endif #endif /* _PURPLE_FT_H_ */ + diff --git a/libpurple/util.c b/libpurple/util.c index 7403537e2f..8e2a057893 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -3331,9 +3331,9 @@ purple_strcasestr(const char *haystack, const char *needle) } char * -purple_str_size_to_units(size_t size) +purple_str_size_to_units(goffset size) { - static const char * const size_str[] = { "bytes", "KiB", "MiB", "GiB" }; + static const char * const size_str[] = { "bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" }; float size_mag; int size_index = 0; @@ -3346,7 +3346,7 @@ purple_str_size_to_units(size_t size) else { size_mag = (float)size; - while ((size_index < 3) && (size_mag > 1024)) { + while ((size_index < G_N_ELEMENTS(size_str) - 1) && (size_mag > 1024)) { size_mag /= 1024; size_index++; } diff --git a/libpurple/util.h b/libpurple/util.h index 4a6fd6d083..35894464f9 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -1091,7 +1091,7 @@ const char *purple_strcasestr(const char *haystack, const char *needle); * * @return The string in units form. This must be freed. */ -char *purple_str_size_to_units(size_t size); +char *purple_str_size_to_units(goffset size); /** * Converts seconds into a human-readable form. -- cgit v1.2.1 From f6288dcc19681d74fe4318039520fc95a2b4fa23 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 06:12:25 +0000 Subject: Update Bonjour for 64-bit file transfers. Refs #8477. --- libpurple/protocols/bonjour/bonjour_ft.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index e4407917e1..b4f1f90c82 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -38,7 +38,7 @@ static void bonjour_xfer_init(PurpleXfer *xfer); static void bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, - const int filesize, const char *filename, int option); + const goffset filesize, const char *filename, int option); static void bonjour_free_xfer(PurpleXfer *xfer); /* Look for specific xfer handle */ @@ -211,7 +211,7 @@ xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) file = xmlnode_new_child(si_node, "file"); xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); + g_snprintf(buf, sizeof(buf), "%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); xmlnode_set_attrib(file, "size", buf); feature = xmlnode_new_child(si_node, "feature"); @@ -439,7 +439,7 @@ xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) if (si && (profile = xmlnode_get_attrib(si, "profile")) && !strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { const char *filename = NULL, *filesize_str = NULL; - int filesize = 0; + goffset filesize = 0; xmlnode *file; const char *sid = xmlnode_get_attrib(si, "id"); @@ -447,7 +447,7 @@ xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) if ((file = xmlnode_get_child(si, "file"))) { filename = xmlnode_get_attrib(file, "name"); if((filesize_str = xmlnode_get_attrib(file, "size"))) - filesize = atoi(filesize_str); + filesize = g_ascii_strtoll(filesize_str, NULL, 10); } /* TODO: Make sure that it is advertising a bytestreams transfer */ @@ -576,7 +576,7 @@ xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) static void bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, - const int filesize, const char *filename, int option) + const goffset filesize, const char *filename, int option) { PurpleXfer *xfer; XepXfer *xf; -- cgit v1.2.1 From 5af11c42e51d718fa30c238af4042524bd38213e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 06:52:12 +0000 Subject: Update XMPP for 64-bit transfers. Refs #8477. --- libpurple/protocols/jabber/oob.c | 4 ++-- libpurple/protocols/jabber/si.c | 19 ++++--------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c index 090793bf4d..bf0cc70b68 100644 --- a/libpurple/protocols/jabber/oob.c +++ b/libpurple/protocols/jabber/oob.c @@ -137,8 +137,8 @@ static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) { *tmp = '\0'; lenstr = strstr(jox->headers->str, "Content-Length: "); if(lenstr) { - int size; - sscanf(lenstr, "Content-Length: %d", &size); + goffset size; + sscanf(lenstr, "Content-Length: %" G_GOFFSET_FORMAT, &size); purple_xfer_set_size(xfer, size); } purple_xfer_set_read_fnc(xfer, NULL); diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index ae0f818fb0..87e3e0926c 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -1099,7 +1099,7 @@ static void jabber_si_xfer_ibb_sent_cb(JabberIBBSession *sess) { PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - gsize remaining = purple_xfer_get_bytes_remaining(xfer); + goffset remaining = purple_xfer_get_bytes_remaining(xfer); if (remaining == 0) { /* close the session */ @@ -1240,7 +1240,7 @@ static void jabber_si_xfer_send_request(PurpleXfer *xfer) file = xmlnode_new_child(si, "file"); xmlnode_set_namespace(file, NS_SI_FILE_TRANSFER); xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); + g_snprintf(buf, sizeof(buf), "%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); xmlnode_set_attrib(file, "size", buf); /* maybe later we'll do hash and date attribs */ @@ -1676,8 +1676,7 @@ void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, xmlnode *thumbnail; #endif const char *stream_id, *filename, *filesize_c, *profile; - guint64 filesize_64 = 0; - size_t filesize = 0; + goffset filesize = 0; if(!(profile = xmlnode_get_attrib(si, "profile")) || strcmp(profile, NS_SI_FILE_TRANSFER)) @@ -1693,17 +1692,7 @@ void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, return; if((filesize_c = xmlnode_get_attrib(file, "size"))) - filesize_64 = g_ascii_strtoull(filesize_c, NULL, 10); - /* TODO 3.0.0: When the core uses a guint64, this is redundant. - * See #8477. - */ - if (filesize_64 > G_MAXSIZE) { - /* Should this pop up a warning? */ - purple_debug_warning("jabber", "Unable to transfer file (too large)" - " -- see #8477 for more details."); - return; - } - filesize = filesize_64; + filesize = g_ascii_strtoull(filesize_c, NULL, 10); if(!(feature = xmlnode_get_child(si, "feature"))) return; -- cgit v1.2.1 From d58fcb37f12db09888f3254d9128b4bb187f17e6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 07:01:52 +0000 Subject: Update MSN for 64-bit file transfers. Refs #8477. --- libpurple/protocols/msn/slp.c | 2 +- libpurple/protocols/msn/slpcall.c | 5 +---- libpurple/protocols/msn/slpmsg.c | 2 +- libpurple/protocols/msn/slpmsg.h | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/libpurple/protocols/msn/slp.c b/libpurple/protocols/msn/slp.c index ca1045989d..22a86da656 100644 --- a/libpurple/protocols/msn/slp.c +++ b/libpurple/protocols/msn/slp.c @@ -291,7 +291,7 @@ send_file_cb(MsnSlpCall *slpcall) static gchar * gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) { - gsize size = 0; + goffset size = 0; MsnFileContext context; gchar *u8 = NULL; gchar *ret; diff --git a/libpurple/protocols/msn/slpcall.c b/libpurple/protocols/msn/slpcall.c index 98dcc58e7c..2a98e80384 100644 --- a/libpurple/protocols/msn/slpcall.c +++ b/libpurple/protocols/msn/slpcall.c @@ -512,7 +512,6 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, MsnFileContext *file_context; char *buf; gsize bin_len; - guint32 file_size; char *file_name; account = slpcall->slplink->session->account; @@ -529,8 +528,6 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, file_context = msn_file_context_from_wire(buf, bin_len); if (file_context != NULL) { - file_size = file_context->file_size; - file_name = g_convert((const gchar *)&file_context->file_name, MAX_FILE_NAME_LEN * 2, "UTF-8", "UTF-16LE", @@ -538,7 +535,7 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, purple_xfer_set_filename(xfer, file_name ? file_name : ""); g_free(file_name); - purple_xfer_set_size(xfer, file_size); + purple_xfer_set_size(xfer, file_context->file_size); purple_xfer_set_init_fnc(xfer, msn_xfer_init); purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); diff --git a/libpurple/protocols/msn/slpmsg.c b/libpurple/protocols/msn/slpmsg.c index 4a75e3abc9..1246397384 100644 --- a/libpurple/protocols/msn/slpmsg.c +++ b/libpurple/protocols/msn/slpmsg.c @@ -239,7 +239,7 @@ MsnSlpMessage *msn_slpmsg_dataprep_new(MsnSlpCall *slpcall) } -MsnSlpMessage *msn_slpmsg_file_new(MsnSlpCall *slpcall, size_t size) +MsnSlpMessage *msn_slpmsg_file_new(MsnSlpCall *slpcall, goffset size) { MsnSlpMessage *slpmsg; diff --git a/libpurple/protocols/msn/slpmsg.h b/libpurple/protocols/msn/slpmsg.h index 11e9901bc1..fb045e7c3a 100644 --- a/libpurple/protocols/msn/slpmsg.h +++ b/libpurple/protocols/msn/slpmsg.h @@ -133,7 +133,7 @@ MsnSlpMessage *msn_slpmsg_dataprep_new(MsnSlpCall *slpcall); * * @return A new SlpMessage with the file transfer info. */ -MsnSlpMessage *msn_slpmsg_file_new(MsnSlpCall *slpcall, size_t size); +MsnSlpMessage *msn_slpmsg_file_new(MsnSlpCall *slpcall, goffset size); /** * Serialize the MsnSlpMessage in a way it can be used to be transmited -- cgit v1.2.1 From ffb9d4a90e48141c3aeee2b71a15fff00089f972 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 07:10:29 +0000 Subject: MXit doesn't actually support very large file transfers, but fix the variable types, at least. --- libpurple/protocols/mxit/filexfer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/protocols/mxit/filexfer.c b/libpurple/protocols/mxit/filexfer.c index 61b04186fb..7f4c90634f 100644 --- a/libpurple/protocols/mxit/filexfer.c +++ b/libpurple/protocols/mxit/filexfer.c @@ -139,7 +139,7 @@ static void mxit_xfer_init( PurpleXfer* xfer ) * we have just accepted a file transfer request from MXit. send a confirmation * to the MXit server so that can send us the file */ - mxit_send_file_accept( mx->session, mx->fileid, purple_xfer_get_size( xfer ), 0 ); + mxit_send_file_accept( mx->session, mx->fileid, (int) purple_xfer_get_size( xfer ), 0 ); } } @@ -151,7 +151,7 @@ static void mxit_xfer_init( PurpleXfer* xfer ) */ static void mxit_xfer_start( PurpleXfer* xfer ) { - size_t filesize; + goffset filesize; unsigned char* buffer; int size; int wrote; -- cgit v1.2.1 From e6e2cc0481d1c25b805b3779dcc17b92f74f0ed1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 07:41:49 +0000 Subject: Update Yahoo for 64-bit file transfers. I'm not really sure if this will work, but since the file sizes are strings, it's should be okay, theoretically. The only exception is this yahoo_xfer_init_15 function, though it seems we never parse have to parse that packet. Refs #8477. --- libpurple/protocols/yahoo/yahoo_filexfer.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index 37b051aa3e..727c281947 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -260,7 +260,7 @@ static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *er pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, YAHOO_STATUS_AVAILABLE, yd->session_id); - size = g_strdup_printf("%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); + size = g_strdup_printf("%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); encoded_filename = yahoo_string_encode(gc, filename, NULL); @@ -279,7 +279,7 @@ static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *er port = purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT); header = g_strdup_printf( "POST http://%s:%d/notifyft HTTP/1.0\r\n" - "Content-length: %" G_GSIZE_FORMAT "\r\n" + "Content-length: %" G_GOFFSET_FORMAT "\r\n" "Host: %s:%d\r\n" "Cookie: Y=%s; T=%s\r\n" "\r\n", @@ -378,7 +378,7 @@ static void yahoo_xfer_init_15(PurpleXfer *xfer) 302, 268, 300, 268, 27, filename, - 28, purple_xfer_get_size(xfer), + 28, (int)purple_xfer_get_size(xfer), 301, 268, 303, 268); g_free(filename); @@ -411,14 +411,14 @@ static void yahoo_xfer_start(PurpleXfer *xfer) /* We don't need to do anything here, do we? */ } -static guint calculate_length(const gchar *l, size_t len) +static goffset calculate_length(const gchar *l, size_t len) { int i; for (i = 0; i < len; i++) { if (!g_ascii_isdigit(l[i])) continue; - return strtol(l + i, NULL, 10); + return g_ascii_strtoll(l + i, NULL, 10); } return 0; } @@ -430,7 +430,7 @@ static gssize yahoo_xfer_read(guchar **buffer, PurpleXfer *xfer) gchar *start = NULL; gchar *length; gchar *end; - int filelen; + goffset filelen; struct yahoo_xfer_data *xd = purple_xfer_get_protocol_data(xfer); if (purple_xfer_get_type(xfer) != PURPLE_XFER_RECEIVE) { @@ -656,10 +656,10 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) if(xfer_data->filename_list) { gchar* filename; - long filesize; + goffset filesize; filename = xfer_data->filename_list->data; - filesize = atol( xfer_data->size_list->data ); + filesize = g_ascii_strtoll( xfer_data->size_list->data, NULL, 10 ); gc = xfer_data->gc; yd = purple_connection_get_protocol_data(gc); @@ -802,7 +802,7 @@ void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt) struct yahoo_xfer_data *xfer_data; char *service = NULL; char *filename = NULL; - unsigned long filesize = 0L; + goffset filesize = G_GOFFSET_CONSTANT(0); GSList *l; yd = purple_connection_get_protocol_data(gc); @@ -830,7 +830,7 @@ void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt) filename = pair->value; break; case 28: - filesize = atol(pair->value); + filesize = g_ascii_strtoll(pair->value, NULL, 10); break; case 49: service = pair->value; @@ -1265,7 +1265,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err initial_buffer = g_strdup_printf("POST /%s HTTP/1.1\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" + "Content-Length: %" G_GOFFSET_FORMAT "\r\n" "Cache-Control: no-cache\r\n\r\n", xd->path, xd->host, @@ -1278,7 +1278,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err "Cookie:%s\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" + "Content-Length: %" G_GOFFSET_FORMAT "\r\n" "Cache-Control: no-cache\r\n\r\n", purple_url_encode(xd->xfer_idstring_for_relay), purple_normalize(account, purple_account_get_username(account)), @@ -1433,7 +1433,7 @@ static void yahoo_p2p_ft_HEAD_GET_cb(gpointer data, gint source, PurpleInputCond "Server: Y!/1.0\r\n" "MIME-version: 1.0\r\n" "Last-modified: %s GMT\r\n" - "Content-length: %" G_GSIZE_FORMAT "\r\n\r\n", + "Content-length: %" G_GOFFSET_FORMAT "\r\n\r\n", time_str, time_str, purple_xfer_get_size(xfer)); xd->txbuf = (guchar *)initial_buffer; xd->txbuflen = strlen(initial_buffer); @@ -1601,7 +1601,7 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) char *filename = NULL; char *xfer_peer_idstring = NULL; char *utf8_filename; - unsigned long filesize = 0L; + goffset filesize = G_GOFFSET_CONSTANT(0); GSList *l; GSList *filename_list = NULL; GSList *size_list = NULL; @@ -1718,7 +1718,7 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) filename_list = g_slist_reverse(filename_list); size_list = g_slist_reverse(size_list); filename = filename_list->data; - filesize = atol(size_list->data); + filesize = g_ascii_strtoll(size_list->data, NULL, 10); if(!from) return; xfer_data = g_new0(struct yahoo_xfer_data, 1); -- cgit v1.2.1 From 0a7133bb3389659a905e8f214a3658a142d0296e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 07:47:40 +0000 Subject: Update IRC for 64-bit file transfers. This probably won't really make much of a difference, since there seems to be lots of 4-byte sizes passed around. This really just fixes the printf so it doesn't do something wrong. Refs #8477. --- libpurple/protocols/irc/dcc_send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/irc/dcc_send.c b/libpurple/protocols/irc/dcc_send.c index 6a2f1ebf51..309193e585 100644 --- a/libpurple/protocols/irc/dcc_send.c +++ b/libpurple/protocols/irc/dcc_send.c @@ -319,7 +319,7 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) /* Send the intended recipient the DCC request */ arg[0] = purple_xfer_get_remote_user(xfer); inet_aton(purple_network_get_my_ip(irc->fd), &addr); - arg[1] = tmp = g_strdup_printf("\001DCC SEND \"%s\" %u %hu %" G_GSIZE_FORMAT "\001", + arg[1] = tmp = g_strdup_printf("\001DCC SEND \"%s\" %u %hu %" G_GOFFSET_FORMAT "\001", purple_xfer_get_filename(xfer), ntohl(addr.s_addr), port, purple_xfer_get_size(xfer)); -- cgit v1.2.1 From ada35cb9bf8edfcce8863f1a9d250151e617c635 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 07:52:24 +0000 Subject: Update Oscar for 64-bit file transfers. This doesn't actually add any support for >32-bit files; just fixes some variable types. Someone probably needs to RE the protocol for 64-bit-ness. Refs #1185. Refs #8477. --- libpurple/protocols/oscar/oft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/oscar/oft.c b/libpurple/protocols/oscar/oft.c index 632f3c8ecf..88665b0f61 100644 --- a/libpurple/protocols/oscar/oft.c +++ b/libpurple/protocols/oscar/oft.c @@ -651,7 +651,7 @@ void peer_oft_sendcb_init(PurpleXfer *xfer) { PeerConnection *conn; - size_t size; + goffset size; conn = purple_xfer_get_protocol_data(xfer); conn->flags |= PEER_CONNECTION_FLAG_APPROVED; -- cgit v1.2.1 From 82685ddcaa82596995e54bc5a3ae409b7576bb24 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 08:00:17 +0000 Subject: Fix printf format in Pidgin for 64-bit file transfers. --- pidgin/gtkft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkft.c b/pidgin/gtkft.c index 793988e0a1..d8cb8855c6 100644 --- a/pidgin/gtkft.c +++ b/pidgin/gtkft.c @@ -247,7 +247,7 @@ update_detailed_info(PidginXferDialog *dialog, PurpleXfer *xfer) get_xfer_info_strings(xfer, &kbsec, &time_elapsed, &time_remaining); - status = g_strdup_printf("%d%% (%" G_GSIZE_FORMAT " of %" G_GSIZE_FORMAT " bytes)", + status = g_strdup_printf("%d%% (%" G_GOFFSET_FORMAT " of %" G_GOFFSET_FORMAT " bytes)", (int)(purple_xfer_get_progress(xfer)*100), purple_xfer_get_bytes_sent(xfer), purple_xfer_get_size(xfer)); -- cgit v1.2.1 From 85b8652a85e7a8220fa4b037948c482d3b357de1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 16 Oct 2011 08:20:07 +0000 Subject: Changelog 64-bit file transfer fix. --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 662f237dc1..828227391b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ version 3.0.0 (??/??/????): * Don't try to format ICQ usernames entered as email addresses. Gets rid of an "Unable to format username" error at login. (#13883) + Bonjour: + * Support file transfers up to ~9 EiB. + Gadu-Gadu: * Possibility to require encryption. Also, using encryption when available is default option now. (Tomasz Wasilczyk) @@ -18,6 +21,7 @@ version 3.0.0 (??/??/????): MSN: * Fix file transfer with older Mac MSN clients. + * Support file transfers up to ~9 EiB. MXit: * Remove all reference to Hidden Number. @@ -31,6 +35,7 @@ version 3.0.0 (??/??/????): * Strip element prefixes from XHTML-IM messages as they're presented to the core (and UIs) as incoming messages (Thijs Alkemade). (#14529) + * Support file transfers up to ~9 EiB. version 2.10.1 (??/??/????): SILC: -- cgit v1.2.1 From 3d5a2128fd5f33f0df44a26d1588c5cf8c3a2ff0 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Mon, 17 Oct 2011 20:09:23 +0000 Subject: Gadu-Gadu: fix win32 warnings, patch from upstream. --- libpurple/protocols/gg/lib/dcc.c | 5 +++-- libpurple/protocols/gg/lib/dcc7.c | 4 ++-- libpurple/protocols/gg/lib/handlers.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libpurple/protocols/gg/lib/dcc.c b/libpurple/protocols/gg/lib/dcc.c index d479f124bd..f9ce811f04 100644 --- a/libpurple/protocols/gg/lib/dcc.c +++ b/libpurple/protocols/gg/lib/dcc.c @@ -601,7 +601,7 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h) struct sockaddr_in sin; struct gg_dcc *c; int fd, one = 1; - unsigned int sin_len = sizeof(sin); + socklen_t sin_len = sizeof(sin); if ((fd = accept(h->fd, (struct sockaddr*) &sin, &sin_len)) == -1) { gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() can't accept() new connection (errno=%d, %s)\n", errno, strerror(errno)); @@ -648,7 +648,8 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h) struct gg_dcc_small_packet small; struct gg_dcc_big_packet big; int size, tmp, res; - unsigned int utmp, res_size = sizeof(res); + unsigned int utmp; + socklen_t res_size = sizeof(res); char buf[1024], ack[] = "UDAG"; struct gg_dcc_file_info_packet { diff --git a/libpurple/protocols/gg/lib/dcc7.c b/libpurple/protocols/gg/lib/dcc7.c index 9b045cfdd9..d6a9511caa 100644 --- a/libpurple/protocols/gg/lib/dcc7.c +++ b/libpurple/protocols/gg/lib/dcc7.c @@ -1095,7 +1095,7 @@ struct gg_event *gg_dcc7_watch_fd(struct gg_dcc7 *dcc) case GG_STATE_CONNECTING: { int res = 0, error = 0; - unsigned int error_size = sizeof(error); + socklen_t error_size = sizeof(error); gg_debug_dcc(dcc, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() GG_STATE_CONNECTING\n"); @@ -1384,7 +1384,7 @@ struct gg_event *gg_dcc7_watch_fd(struct gg_dcc7 *dcc) case GG_STATE_CONNECTING_RELAY: { int res; - unsigned int res_size = sizeof(res); + socklen_t res_size = sizeof(res); struct gg_dcc7_relay_req pkt; gg_debug_dcc(dcc, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() GG_STATE_CONNECTING_RELAY\n"); diff --git a/libpurple/protocols/gg/lib/handlers.c b/libpurple/protocols/gg/lib/handlers.c index 4d64286135..3973d97550 100644 --- a/libpurple/protocols/gg/lib/handlers.c +++ b/libpurple/protocols/gg/lib/handlers.c @@ -92,7 +92,7 @@ static int gg_session_handle_welcome(struct gg_session *gs, uint32_t type, const uint8_t hash_buf[64]; uint32_t local_ip; struct sockaddr_in sin; - unsigned int sin_len = sizeof(sin); + socklen_t sin_len = sizeof(sin); if (len < sizeof(struct gg_welcome)) { ge->type = GG_EVENT_CONN_FAILED; -- cgit v1.2.1 From 4a9543e98b6651bb22905bff117782ad24e7682b Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Mon, 17 Oct 2011 21:25:53 +0000 Subject: Gadu-Gadu: move our win32 resolver out of libgadu sources. Refs #343 --- libpurple/protocols/gg/Makefile.am | 2 + libpurple/protocols/gg/Makefile.mingw | 3 +- libpurple/protocols/gg/gg.c | 9 + libpurple/protocols/gg/lib/libgadu.h | 7 +- libpurple/protocols/gg/lib/resolver.c | 309 +----------------------------- libpurple/protocols/gg/win32-resolver.c | 321 ++++++++++++++++++++++++++++++++ libpurple/protocols/gg/win32-resolver.h | 46 +++++ 7 files changed, 389 insertions(+), 308 deletions(-) create mode 100644 libpurple/protocols/gg/win32-resolver.c create mode 100644 libpurple/protocols/gg/win32-resolver.h diff --git a/libpurple/protocols/gg/Makefile.am b/libpurple/protocols/gg/Makefile.am index cd64052e4a..de65da176c 100644 --- a/libpurple/protocols/gg/Makefile.am +++ b/libpurple/protocols/gg/Makefile.am @@ -1,5 +1,7 @@ EXTRA_DIST = \ Makefile.mingw \ + win32-resolver.c \ + win32-resolver.h \ lib/common.c \ lib/compat.h \ lib/COPYING \ diff --git a/libpurple/protocols/gg/Makefile.mingw b/libpurple/protocols/gg/Makefile.mingw index 9ac7833657..5531c14728 100644 --- a/libpurple/protocols/gg/Makefile.mingw +++ b/libpurple/protocols/gg/Makefile.mingw @@ -60,7 +60,8 @@ C_SRC = \ confer.c \ gg.c \ search.c \ - gg-utils.c + gg-utils.c \ + win32-resolver.c OBJECTS = $(C_SRC:%.c=%.o) diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 3f6dcf906c..25279aa53b 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -47,6 +47,10 @@ #include "buddylist.h" #include "gg-utils.h" +#ifdef _WIN32 +# include "win32-resolver.h" +#endif + static PurplePlugin *my_protocol = NULL; /* Prototypes */ @@ -3000,6 +3004,11 @@ static void init_plugin(PurplePlugin *plugin) my_protocol = plugin; gg_debug_handler = purple_gg_debug_handler; + +#ifdef _WIN32 + gg_global_set_custom_resolver(ggp_resolver_win32thread_start, + ggp_resolver_win32thread_cleanup); +#endif } PURPLE_INIT_PLUGIN(gg, init_plugin, info); diff --git a/libpurple/protocols/gg/lib/libgadu.h b/libpurple/protocols/gg/lib/libgadu.h index aad79b301e..b4478c8b1a 100644 --- a/libpurple/protocols/gg/lib/libgadu.h +++ b/libpurple/protocols/gg/lib/libgadu.h @@ -95,6 +95,12 @@ extern "C" { /* Defined if uintX_t types are defined in . */ #undef GG_CONFIG_HAVE_SYS_TYPES_H +#ifdef _WIN32 +# undef GG_CONFIG_HAVE_FORK +#else +# define GG_CONFIG_HAVE_FORK +#endif + #ifdef GG_CONFIG_HAVE_OPENSSL #include #endif @@ -195,7 +201,6 @@ typedef enum { GG_RESOLVER_DEFAULT = 0, /**< Domyślny sposób rozwiązywania nazw (jeden z poniższych) */ GG_RESOLVER_FORK, /**< Rozwiązywanie nazw bazujące na procesach */ GG_RESOLVER_PTHREAD, /**< Rozwiązywanie nazw bazujące na wątkach */ - GG_RESOLVER_WIN32, GG_RESOLVER_CUSTOM, /**< Funkcje rozwiązywania nazw dostarczone przed aplikację */ GG_RESOLVER_INVALID = -1 /**< Nieprawidłowy sposób rozwiązywania nazw (wynik \c gg_session_get_resolver) */ } gg_resolver_t; diff --git a/libpurple/protocols/gg/lib/resolver.c b/libpurple/protocols/gg/lib/resolver.c index df1df28ec3..1150cb03a3 100644 --- a/libpurple/protocols/gg/lib/resolver.c +++ b/libpurple/protocols/gg/lib/resolver.c @@ -319,283 +319,6 @@ struct gg_resolver_fork_data { int pid; /*< Identyfikator procesu */ }; -#ifdef _WIN32 -/** - * Deal with the fact that you can't select() on a win32 file fd. - * This makes it practically impossible to tie into purple's event loop. - * - * -This is thanks to Tor Lillqvist. - * XXX - Move this to where the rest of the the win32 compatiblity stuff goes when we push the changes back to libgadu. - */ -static int -socket_pipe (int *fds) -{ - SOCKET temp, socket1 = -1, socket2 = -1; - struct sockaddr_in saddr; - int len; - u_long arg; - fd_set read_set, write_set; - struct timeval tv; - - temp = socket(AF_INET, SOCK_STREAM, 0); - - if (temp == INVALID_SOCKET) { - goto out0; - } - - arg = 1; - if (ioctlsocket(temp, FIONBIO, &arg) == SOCKET_ERROR) { - goto out0; - } - - memset(&saddr, 0, sizeof(saddr)); - saddr.sin_family = AF_INET; - saddr.sin_port = 0; - saddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (bind(temp, (struct sockaddr *)&saddr, sizeof (saddr))) { - goto out0; - } - - if (listen(temp, 1) == SOCKET_ERROR) { - goto out0; - } - - len = sizeof(saddr); - if (getsockname(temp, (struct sockaddr *)&saddr, &len)) { - goto out0; - } - - socket1 = socket(AF_INET, SOCK_STREAM, 0); - - if (socket1 == INVALID_SOCKET) { - goto out0; - } - - arg = 1; - if (ioctlsocket(socket1, FIONBIO, &arg) == SOCKET_ERROR) { - goto out1; - } - - if (connect(socket1, (struct sockaddr *)&saddr, len) != SOCKET_ERROR || - WSAGetLastError() != WSAEWOULDBLOCK) { - goto out1; - } - - FD_ZERO(&read_set); - FD_SET(temp, &read_set); - - tv.tv_sec = 0; - tv.tv_usec = 0; - - if (select(0, &read_set, NULL, NULL, NULL) == SOCKET_ERROR) { - goto out1; - } - - if (!FD_ISSET(temp, &read_set)) { - goto out1; - } - - socket2 = accept(temp, (struct sockaddr *) &saddr, &len); - if (socket2 == INVALID_SOCKET) { - goto out1; - } - - FD_ZERO(&write_set); - FD_SET(socket1, &write_set); - - tv.tv_sec = 0; - tv.tv_usec = 0; - - if (select(0, NULL, &write_set, NULL, NULL) == SOCKET_ERROR) { - goto out2; - } - - if (!FD_ISSET(socket1, &write_set)) { - goto out2; - } - - arg = 0; - if (ioctlsocket(socket1, FIONBIO, &arg) == SOCKET_ERROR) { - goto out2; - } - - arg = 0; - if (ioctlsocket(socket2, FIONBIO, &arg) == SOCKET_ERROR) { - goto out2; - } - - fds[0] = socket1; - fds[1] = socket2; - - closesocket (temp); - - return 0; - -out2: - closesocket (socket2); -out1: - closesocket (socket1); -out0: - closesocket (temp); - errno = EIO; /* XXX */ - - return -1; -} -#endif - - - -#ifdef _WIN32 -struct gg_resolve_win32thread_data { - char *hostname; - int fd; -}; - -static DWORD WINAPI gg_resolve_win32thread_thread(LPVOID arg) -{ - struct gg_resolve_win32thread_data *d = arg; - struct in_addr addr_ip[2], *addr_list; - int addr_count; - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_thread() host: %s, fd: %i called\n", d->hostname, d->fd); - - if ((addr_ip[0].s_addr = inet_addr(d->hostname)) == INADDR_NONE) { - /* W przypadku błędu gg_gethostbyname_real() zwróci -1 - * i nie zmieni &addr. Tam jest już INADDR_NONE, - * więc nie musimy robić nic więcej. */ - if (gg_gethostbyname_real(d->hostname, &addr_list, &addr_count, 0) == -1) - { - addr_list = addr_ip; - } - } else { - addr_list = addr_ip; - addr_ip[1].s_addr = INADDR_NONE; - addr_count = 1; - } - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_thread() count = %d\n", addr_count); - - write(d->fd, addr_list, (addr_count+1) * sizeof(struct in_addr)); - close(d->fd); - - free(d->hostname); - d->hostname = NULL; - - free(d); - - if (addr_list != addr_ip) - free(addr_list); - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_thread() done\n"); - - return 0; -} - - -static int gg_resolve_win32thread(int *fd, void **resolver, const char *hostname) -{ - struct gg_resolve_win32thread_data *d = NULL; - HANDLE h; - DWORD dwTId; - int pipes[2], new_errno; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_resolve_win32thread(%p, %p, \"%s\");\n", fd, resolver, hostname); - - if (!resolver || !fd || !hostname) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() creating pipes...\n"); - - if (socket_pipe(pipes) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() unable to create pipes (errno=%d, %s)\n", errno, strerror(errno)); - return -1; - } - - if (!(d = malloc(sizeof(*d)))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() out of memory\n"); - new_errno = errno; - goto cleanup; - } - - d->hostname = NULL; - - if (!(d->hostname = strdup(hostname))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() out of memory\n"); - new_errno = errno; - goto cleanup; - } - - d->fd = pipes[1]; - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() creating thread...\n"); - - h = CreateThread(NULL, 0, gg_resolve_win32thread_thread, - d, 0, &dwTId); - - if (h == NULL) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() unable to create thread\n"); - new_errno = errno; - goto cleanup; - } - - *resolver = h; - *fd = pipes[0]; - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() done\n"); - - return 0; - -cleanup: - if (d) { - free(d->hostname); - free(d); - } - - close(pipes[0]); - close(pipes[1]); - - errno = new_errno; - - return -1; - -} - -static void gg_resolve_win32thread_cleanup(void **priv_data, int force) -{ - struct gg_resolve_win32thread_data *data; - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_cleanup() force: %i called\n", force); - - if (priv_data == NULL || *priv_data == NULL) - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_cleanup() priv_data: NULL\n"); - return; - - data = (struct gg_resolve_win32thread_data*) *priv_data; - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_cleanup() data: %s called\n", data->hostname); - *priv_data = NULL; - - if (force) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_cleanup() force called\n", force); - //pthread_cancel(data->thread); - //pthread_join(data->thread, NULL); - } - - free(data->hostname); - data->hostname = NULL; - - if (data->fd != -1) { - close(data->fd); - data->fd = -1; - } - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_cleanup() done\n"); - free(data); -} -#endif - #ifndef _WIN32 /** * \internal Rozwiązuje nazwę serwera w osobnym procesie. @@ -873,24 +596,14 @@ int gg_session_set_resolver(struct gg_session *gs, gg_resolver_t type) } #if !defined(GG_CONFIG_HAVE_PTHREAD) || !defined(GG_CONFIG_PTHREAD_DEFAULT) -# ifdef _WIN32 - type = GG_RESOLVER_WIN32; -# else type = GG_RESOLVER_FORK; -# endif #else type = GG_RESOLVER_PTHREAD; #endif } switch (type) { -#ifdef _WIN32 - case GG_RESOLVER_WIN32: - gs->resolver_type = type; - gs->resolver_start = gg_resolve_win32thread; - gs->resolver_cleanup = gg_resolve_win32thread_cleanup; - return 0; -#else +#ifdef GG_CONFIG_HAVE_FORK case GG_RESOLVER_FORK: gs->resolver_type = type; gs->resolver_start = gg_resolver_fork_start; @@ -994,24 +707,14 @@ int gg_http_set_resolver(struct gg_http *gh, gg_resolver_t type) } #if !defined(GG_CONFIG_HAVE_PTHREAD) || !defined(GG_CONFIG_PTHREAD_DEFAULT) -# ifdef _WIN32 - type = GG_RESOLVER_WIN32; -# else type = GG_RESOLVER_FORK; -# endif #else type = GG_RESOLVER_PTHREAD; #endif } switch (type) { -#ifdef _WIN32 - case GG_RESOLVER_WIN32: - gh->resolver_type = type; - gh->resolver_start = gg_resolve_win32thread; - gh->resolver_cleanup = gg_resolve_win32thread_cleanup; - return 0; -#else +#ifdef GG_CONFIG_HAVE_FORK case GG_RESOLVER_FORK: gh->resolver_type = type; gh->resolver_start = gg_resolver_fork_start; @@ -1089,13 +792,7 @@ int gg_global_set_resolver(gg_resolver_t type) gg_global_resolver_cleanup = NULL; return 0; -#ifdef _WIN32 - case GG_RESOLVER_WIN32: - gg_global_resolver_type = type; - gg_global_resolver_start = gg_resolve_win32thread; - gg_global_resolver_cleanup = gg_resolve_win32thread_cleanup; - return 0; -#else +#ifdef GG_CONFIG_HAVE_FORK case GG_RESOLVER_FORK: gg_global_resolver_type = type; gg_global_resolver_start = gg_resolver_fork_start; diff --git a/libpurple/protocols/gg/win32-resolver.c b/libpurple/protocols/gg/win32-resolver.c new file mode 100644 index 0000000000..d7bd7c0b0d --- /dev/null +++ b/libpurple/protocols/gg/win32-resolver.c @@ -0,0 +1,321 @@ +/** + * @file win32-resolver.c + * + * purple + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include "win32-resolver.h" + +#include +#include +#include "debug.h" + +#ifndef _WIN32 +#error "win32thread resolver is not supported on current platform" +#endif + +/** + * Deal with the fact that you can't select() on a win32 file fd. + * This makes it practically impossible to tie into purple's event loop. + * + * -This is thanks to Tor Lillqvist. + */ +static int ggp_resolver_win32thread_socket_pipe(int *fds) +{ + SOCKET temp, socket1 = -1, socket2 = -1; + struct sockaddr_in saddr; + int len; + u_long arg; + fd_set read_set, write_set; + struct timeval tv; + + purple_debug_misc("gg", "ggp_resolver_win32thread_socket_pipe(&%d)\n", + *fds); + + temp = socket(AF_INET, SOCK_STREAM, 0); + + if (temp == INVALID_SOCKET) { + goto out0; + } + + arg = 1; + if (ioctlsocket(temp, FIONBIO, &arg) == SOCKET_ERROR) { + goto out0; + } + + memset(&saddr, 0, sizeof(saddr)); + saddr.sin_family = AF_INET; + saddr.sin_port = 0; + saddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind(temp, (struct sockaddr *)&saddr, sizeof (saddr))) { + goto out0; + } + + if (listen(temp, 1) == SOCKET_ERROR) { + goto out0; + } + + len = sizeof(saddr); + if (getsockname(temp, (struct sockaddr *)&saddr, &len)) { + goto out0; + } + + socket1 = socket(AF_INET, SOCK_STREAM, 0); + + if (socket1 == INVALID_SOCKET) { + goto out0; + } + + arg = 1; + if (ioctlsocket(socket1, FIONBIO, &arg) == SOCKET_ERROR) { + goto out1; + } + + if (connect(socket1, (struct sockaddr *)&saddr, len) != SOCKET_ERROR || + WSAGetLastError() != WSAEWOULDBLOCK) { + goto out1; + } + + FD_ZERO(&read_set); + FD_SET(temp, &read_set); + + tv.tv_sec = 0; + tv.tv_usec = 0; + + if (select(0, &read_set, NULL, NULL, NULL) == SOCKET_ERROR) { + goto out1; + } + + if (!FD_ISSET(temp, &read_set)) { + goto out1; + } + + socket2 = accept(temp, (struct sockaddr *) &saddr, &len); + if (socket2 == INVALID_SOCKET) { + goto out1; + } + + FD_ZERO(&write_set); + FD_SET(socket1, &write_set); + + tv.tv_sec = 0; + tv.tv_usec = 0; + + if (select(0, NULL, &write_set, NULL, NULL) == SOCKET_ERROR) { + goto out2; + } + + if (!FD_ISSET(socket1, &write_set)) { + goto out2; + } + + arg = 0; + if (ioctlsocket(socket1, FIONBIO, &arg) == SOCKET_ERROR) { + goto out2; + } + + arg = 0; + if (ioctlsocket(socket2, FIONBIO, &arg) == SOCKET_ERROR) { + goto out2; + } + + fds[0] = socket1; + fds[1] = socket2; + + closesocket (temp); + + return 0; + +out2: + closesocket (socket2); +out1: + closesocket (socket1); +out0: + closesocket (temp); + errno = EIO; /* XXX */ + + return -1; +} + +struct ggp_resolver_win32thread_data { + char *hostname; + int fd; +}; + +static DWORD WINAPI ggp_resolver_win32thread_thread(LPVOID arg) +{ + struct ggp_resolver_win32thread_data *data = arg; + struct in_addr addr_ip[2], *addr_list; + int addr_count; + + purple_debug_info("gg", "ggp_resolver_win32thread_thread() host: %s, " + "fd: %i called\n", data->hostname, data->fd); + + if ((addr_ip[0].s_addr = inet_addr(data->hostname)) == INADDR_NONE) { + /* W przypadku błędu gg_gethostbyname_real() zwróci -1 + * i nie zmieni &addr. Tam jest już INADDR_NONE, + * więc nie musimy robić nic więcej. */ + if (gg_gethostbyname_real(data->hostname, &addr_list, + &addr_count, 0) == -1) { + addr_list = addr_ip; + } + } else { + addr_list = addr_ip; + addr_ip[1].s_addr = INADDR_NONE; + addr_count = 1; + } + + purple_debug_misc("gg", "ggp_resolver_win32thread_thread() " + "count = %d\n", addr_count); + + write(data->fd, addr_list, (addr_count+1) * sizeof(struct in_addr)); + close(data->fd); + + free(data->hostname); + data->hostname = NULL; + + free(data); + + if (addr_list != addr_ip) + free(addr_list); + + purple_debug_misc("gg", "ggp_resolver_win32thread_thread() done\n"); + + return 0; +} + + +int ggp_resolver_win32thread_start(int *fd, void **private_data, + const char *hostname) +{ + struct ggp_resolver_win32thread_data *data = NULL; + HANDLE h; + DWORD dwTId; + int pipes[2], new_errno; + + purple_debug_info("gg", "ggp_resolver_win32thread_start(%p, %p, " + "\"%s\");\n", fd, private_data, hostname); + + if (!private_data || !fd || !hostname) { + purple_debug_error("gg", "ggp_resolver_win32thread_start() " + "invalid arguments\n"); + errno = EFAULT; + return -1; + } + + purple_debug_misc("gg", "ggp_resolver_win32thread_start() creating " + "pipes...\n"); + + if (ggp_resolver_win32thread_socket_pipe(pipes) == -1) { + purple_debug_error("gg", "ggp_resolver_win32thread_start() " + "unable to create pipes (errno=%d, %s)\n", + errno, strerror(errno)); + return -1; + } + + if (!(data = malloc(sizeof(*data)))) { + purple_debug_error("gg", "ggp_resolver_win32thread_start() out " + "of memory\n"); + new_errno = errno; + goto cleanup; + } + + data->hostname = NULL; + + if (!(data->hostname = strdup(hostname))) { + purple_debug_error("gg", "ggp_resolver_win32thread_start() out " + "of memory\n"); + new_errno = errno; + goto cleanup; + } + + data->fd = pipes[1]; + + purple_debug_misc("gg", "ggp_resolver_win32thread_start() creating " + "thread...\n"); + + h = CreateThread(NULL, 0, ggp_resolver_win32thread_thread, data, 0, + &dwTId); + + if (h == NULL) { + purple_debug_error("gg", "ggp_resolver_win32thread_start() " + "unable to create thread\n"); + new_errno = errno; + goto cleanup; + } + + *private_data = h; + *fd = pipes[0]; + + purple_debug_misc("gg", "ggp_resolver_win32thread_start() done\n"); + + return 0; + +cleanup: + if (data) { + free(data->hostname); + free(data); + } + + close(pipes[0]); + close(pipes[1]); + + errno = new_errno; + + return -1; + +} + +void ggp_resolver_win32thread_cleanup(void **private_data, int force) +{ + struct ggp_resolver_win32thread_data *data; + + purple_debug_info("gg", "ggp_resolver_win32thread_cleanup() force: %i " + "called\n", force); + + if (private_data == NULL || *private_data == NULL) { + purple_debug_error("gg", "ggp_resolver_win32thread_cleanup() " + "private_data: NULL\n"); + return; + } + return; /* XXX */ + + data = (struct ggp_resolver_win32thread_data*) *private_data; + purple_debug_misc("gg", "ggp_resolver_win32thread_cleanup() data: " + "%s called\n", data->hostname); + *private_data = NULL; + + if (force) { + purple_debug_misc("gg", "ggp_resolver_win32thread_cleanup() " + "force called\n"); + //pthread_cancel(data->thread); + //pthread_join(data->thread, NULL); + } + + free(data->hostname); + data->hostname = NULL; + + if (data->fd != -1) { + close(data->fd); + data->fd = -1; + } + purple_debug_info("gg", "ggp_resolver_win32thread_cleanup() done\n"); + free(data); +} + +/* vim: set ts=8 sts=0 sw=8 noet: */ diff --git a/libpurple/protocols/gg/win32-resolver.h b/libpurple/protocols/gg/win32-resolver.h new file mode 100644 index 0000000000..ab20571364 --- /dev/null +++ b/libpurple/protocols/gg/win32-resolver.h @@ -0,0 +1,46 @@ +/** + * @file win32-resolver.h + * + * purple + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#ifndef _PURPLE_GG_WIN32_RESOLVER +#define _PURPLE_GG_WIN32_RESOLVER + +/** + * Starts hostname resolving in new win32 thread. + * + * @param fd Pointer to variable, where pipe descriptor will be saved. + * @param private_data Pointer to variable, where pointer to private data will + * be saved. + * @param hostname Hostname to resolve. + */ +int ggp_resolver_win32thread_start(int *fd, void **private_data, + const char *hostname); + +/** + * Cleans up resources after hostname resolving. + * + * @param private_data Pointer to variable storing pointer to private data. + * @param force TRUE, if resources should be cleaned up even, if + * resolving process didn't finished. + */ +void ggp_resolver_win32thread_cleanup(void **private_data, int force); + +#endif /* _PURPLE_GG_WIN32_RESOLVER */ + +/* vim: set ts=8 sts=0 sw=8 noet: */ -- cgit v1.2.1 From 7a2f206a529a14f7b777d2b80c93c267259579ab Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Tue, 18 Oct 2011 00:55:59 +0000 Subject: Gadu-Gadu: synchronize internal libgadu with upstream. Refs #343 --- libpurple/protocols/gg/gg.c | 2 -- libpurple/protocols/gg/gg.h | 1 + libpurple/protocols/gg/lib/common.c | 6 +++--- libpurple/protocols/gg/lib/dcc.c | 6 +++--- libpurple/protocols/gg/lib/dcc7.c | 6 +++--- libpurple/protocols/gg/lib/events.c | 1 - libpurple/protocols/gg/lib/handlers.c | 7 ++----- libpurple/protocols/gg/lib/http.c | 2 +- libpurple/protocols/gg/lib/libgadu-config.h | 2 ++ libpurple/protocols/gg/lib/libgadu.c | 9 +++------ libpurple/protocols/gg/lib/libgadu.h | 3 ++- libpurple/protocols/gg/lib/pubdir.c | 1 - libpurple/protocols/gg/lib/pubdir50.c | 1 - libpurple/protocols/gg/lib/resolver.c | 5 ++--- libpurple/protocols/gg/win32-resolver.c | 9 +++++---- 15 files changed, 27 insertions(+), 34 deletions(-) diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 25279aa53b..a2c4087155 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -39,8 +39,6 @@ #include "request.h" #include "xmlnode.h" -#include - #include "gg.h" #include "confer.h" #include "search.h" diff --git a/libpurple/protocols/gg/gg.h b/libpurple/protocols/gg/gg.h index 3e75a082b3..8757de17ca 100644 --- a/libpurple/protocols/gg/gg.h +++ b/libpurple/protocols/gg/gg.h @@ -24,6 +24,7 @@ #ifndef _PURPLE_GG_H #define _PURPLE_GG_H +#undef printf #include #include "internal.h" #include "search.h" diff --git a/libpurple/protocols/gg/lib/common.c b/libpurple/protocols/gg/lib/common.c index ee888056e2..cd8c0a9146 100644 --- a/libpurple/protocols/gg/lib/common.c +++ b/libpurple/protocols/gg/lib/common.c @@ -30,9 +30,9 @@ # include # include # include -# ifdef sun -# include -# endif +#endif +#ifdef sun +# include #endif #include diff --git a/libpurple/protocols/gg/lib/dcc.c b/libpurple/protocols/gg/lib/dcc.c index f9ce811f04..26b5729e47 100644 --- a/libpurple/protocols/gg/lib/dcc.c +++ b/libpurple/protocols/gg/lib/dcc.c @@ -33,9 +33,9 @@ # include # include # include -# ifdef sun -# include -# endif +#endif +#ifdef sun +# include #endif #include diff --git a/libpurple/protocols/gg/lib/dcc7.c b/libpurple/protocols/gg/lib/dcc7.c index d6a9511caa..195a88ba4c 100644 --- a/libpurple/protocols/gg/lib/dcc7.c +++ b/libpurple/protocols/gg/lib/dcc7.c @@ -36,9 +36,9 @@ # include # include # include -# ifdef sun -# include -# endif +#endif +#ifdef sun +# include #endif #include diff --git a/libpurple/protocols/gg/lib/events.c b/libpurple/protocols/gg/lib/events.c index d5dc509bf5..d62b055d53 100644 --- a/libpurple/protocols/gg/lib/events.c +++ b/libpurple/protocols/gg/lib/events.c @@ -38,7 +38,6 @@ #include "compat.h" #include "libgadu.h" -#include "libgadu-config.h" #include "protocol.h" #include "libgadu-internal.h" #include "encoding.h" diff --git a/libpurple/protocols/gg/lib/handlers.c b/libpurple/protocols/gg/lib/handlers.c index 3973d97550..e41e854db7 100644 --- a/libpurple/protocols/gg/lib/handlers.c +++ b/libpurple/protocols/gg/lib/handlers.c @@ -33,15 +33,12 @@ # include #endif #include -#ifndef _WIN32 -# ifdef sun -# include -# endif +#ifdef sun +# include #endif #include "compat.h" #include "libgadu.h" -#include "libgadu-config.h" #include "resolver.h" #include "session.h" #include "protocol.h" diff --git a/libpurple/protocols/gg/lib/http.c b/libpurple/protocols/gg/lib/http.c index 7d014f8a33..fed244cd70 100644 --- a/libpurple/protocols/gg/lib/http.c +++ b/libpurple/protocols/gg/lib/http.c @@ -258,7 +258,7 @@ int gg_http_watch_fd(struct gg_http *h) } if (h->state == GG_STATE_SENDING_QUERY) { - size_t res; + ssize_t res; if ((res = write(h->fd, h->query, strlen(h->query))) < 1) { gg_debug(GG_DEBUG_MISC, "=> http, write() failed (len=%d, res=%d, errno=%d)\n", strlen(h->query), res, errno); diff --git a/libpurple/protocols/gg/lib/libgadu-config.h b/libpurple/protocols/gg/lib/libgadu-config.h index 8fa28ae370..13bf4cf919 100644 --- a/libpurple/protocols/gg/lib/libgadu-config.h +++ b/libpurple/protocols/gg/lib/libgadu-config.h @@ -5,6 +5,8 @@ #ifndef __GG_LIBGADU_CONFIG_H #define __GG_LIBGADU_CONFIG_H +#define GG_LIBGADU_VERSION "1.11.0" + /* Defined if libgadu was compiled for bigendian machine. */ #undef __GG_LIBGADU_BIGENDIAN #ifdef WORDS_BIGENDIAN diff --git a/libpurple/protocols/gg/lib/libgadu.c b/libpurple/protocols/gg/lib/libgadu.c index fa26fa1047..d7744bb317 100644 --- a/libpurple/protocols/gg/lib/libgadu.c +++ b/libpurple/protocols/gg/lib/libgadu.c @@ -38,14 +38,13 @@ # include # include # include -# ifdef sun -# include -# endif +#endif +#ifdef sun +# include #endif #include "compat.h" #include "libgadu.h" -#include "libgadu-config.h" #include "protocol.h" #include "resolver.h" #include "libgadu-internal.h" @@ -74,8 +73,6 @@ # include #endif -#define GG_LIBGADU_VERSION "1.11.0" - /** * Port gniazda nasłuchującego dla połączeń bezpośrednich. * diff --git a/libpurple/protocols/gg/lib/libgadu.h b/libpurple/protocols/gg/lib/libgadu.h index b4478c8b1a..c6b8f1810d 100644 --- a/libpurple/protocols/gg/lib/libgadu.h +++ b/libpurple/protocols/gg/lib/libgadu.h @@ -1447,7 +1447,6 @@ int gg_pubdir50_handle_reply(struct gg_event *e, const char *packet, int length) int gg_file_hash_sha1(int fd, uint8_t *result) GG_DEPRECATED; -#undef printf #ifdef __GNUC__ char *gg_saprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))) GG_DEPRECATED; #else @@ -2313,6 +2312,8 @@ struct gg_dcc7_dunno1 { #endif /* __GG_LIBGADU_H */ +#include "libgadu-config.h" + /* * Local variables: * c-indentation-style: k&r diff --git a/libpurple/protocols/gg/lib/pubdir.c b/libpurple/protocols/gg/lib/pubdir.c index dad5e44da3..04f3f0a9a5 100644 --- a/libpurple/protocols/gg/lib/pubdir.c +++ b/libpurple/protocols/gg/lib/pubdir.c @@ -35,7 +35,6 @@ #include #include "libgadu.h" -#include "libgadu-config.h" /** * Rejestruje nowego użytkownika. diff --git a/libpurple/protocols/gg/lib/pubdir50.c b/libpurple/protocols/gg/lib/pubdir50.c index 9222ea56ed..1d1bd55382 100644 --- a/libpurple/protocols/gg/lib/pubdir50.c +++ b/libpurple/protocols/gg/lib/pubdir50.c @@ -31,7 +31,6 @@ #include #include "libgadu.h" -#include "libgadu-config.h" #include "libgadu-internal.h" #include "encoding.h" diff --git a/libpurple/protocols/gg/lib/resolver.c b/libpurple/protocols/gg/lib/resolver.c index 1150cb03a3..ca68d1e27a 100644 --- a/libpurple/protocols/gg/lib/resolver.c +++ b/libpurple/protocols/gg/lib/resolver.c @@ -41,7 +41,6 @@ #endif #include "libgadu.h" -#include "libgadu-config.h" #include "resolver.h" #include "compat.h" #include "session.h" @@ -249,7 +248,7 @@ int gg_gethostbyname_real(const char *hostname, struct in_addr **result, int *co #endif /* GG_CONFIG_HAVE_GETHOSTBYNAME_R */ } -#if defined(GG_CONFIG_HAVE_PTHREAD) || !defined(_WIN32) +#if defined(GG_CONFIG_HAVE_PTHREAD) || defined(GG_CONFIG_HAVE_FORK) /** * \internal Rozwiązuje nazwę i zapisuje wynik do podanego desktyptora. * @@ -319,7 +318,7 @@ struct gg_resolver_fork_data { int pid; /*< Identyfikator procesu */ }; -#ifndef _WIN32 +#ifdef GG_CONFIG_HAVE_FORK /** * \internal Rozwiązuje nazwę serwera w osobnym procesie. * diff --git a/libpurple/protocols/gg/win32-resolver.c b/libpurple/protocols/gg/win32-resolver.c index d7bd7c0b0d..63a65e0963 100644 --- a/libpurple/protocols/gg/win32-resolver.c +++ b/libpurple/protocols/gg/win32-resolver.c @@ -157,6 +157,9 @@ struct ggp_resolver_win32thread_data { int fd; }; +/** + * Copy-paste from gg_resolver_run(). + */ static DWORD WINAPI ggp_resolver_win32thread_thread(LPVOID arg) { struct ggp_resolver_win32thread_data *data = arg; @@ -167,12 +170,10 @@ static DWORD WINAPI ggp_resolver_win32thread_thread(LPVOID arg) "fd: %i called\n", data->hostname, data->fd); if ((addr_ip[0].s_addr = inet_addr(data->hostname)) == INADDR_NONE) { - /* W przypadku błędu gg_gethostbyname_real() zwróci -1 - * i nie zmieni &addr. Tam jest już INADDR_NONE, - * więc nie musimy robić nic więcej. */ if (gg_gethostbyname_real(data->hostname, &addr_list, &addr_count, 0) == -1) { addr_list = addr_ip; + /* addr_ip[0] już zawiera INADDR_NONE */ } } else { addr_list = addr_ip; @@ -183,7 +184,7 @@ static DWORD WINAPI ggp_resolver_win32thread_thread(LPVOID arg) purple_debug_misc("gg", "ggp_resolver_win32thread_thread() " "count = %d\n", addr_count); - write(data->fd, addr_list, (addr_count+1) * sizeof(struct in_addr)); + write(data->fd, addr_list, (addr_count + 1) * sizeof(struct in_addr)); close(data->fd); free(data->hostname); -- cgit v1.2.1 From 962c9ba89cd4737ca309e2d5eef94e68f848d922 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 18 Oct 2011 04:17:47 +0000 Subject: Put conversation theme in its own directory. --- configure.ac | 1 + pidgin/Makefile.am | 2 +- pidgin/plugins/adiumthemes/Template.html | 164 ------------------------------- pidgin/themes/Makefile.am | 6 ++ pidgin/themes/Template.html | 164 +++++++++++++++++++++++++++++++ 5 files changed, 172 insertions(+), 165 deletions(-) delete mode 100644 pidgin/plugins/adiumthemes/Template.html create mode 100644 pidgin/themes/Makefile.am create mode 100644 pidgin/themes/Template.html diff --git a/configure.ac b/configure.ac index 3beab399a0..c671230f1b 100644 --- a/configure.ac +++ b/configure.ac @@ -2505,6 +2505,7 @@ AC_CONFIG_FILES([Makefile pidgin/plugins/perl/Makefile pidgin/plugins/perl/common/Makefile.PL pidgin/plugins/ticker/Makefile + pidgin/themes/Makefile libpurple/ciphers/Makefile libpurple/example/Makefile libpurple/gconf/Makefile diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index 54408a7f27..5b2c2d0038 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -34,7 +34,7 @@ if ENABLE_GTK pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = pidgin-3.pc -SUBDIRS = pixmaps plugins +SUBDIRS = pixmaps plugins themes bin_PROGRAMS = pidgin diff --git a/pidgin/plugins/adiumthemes/Template.html b/pidgin/plugins/adiumthemes/Template.html deleted file mode 100644 index 0a7f9d6662..0000000000 --- a/pidgin/plugins/adiumthemes/Template.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - -%@ -
-
-%@ - - diff --git a/pidgin/themes/Makefile.am b/pidgin/themes/Makefile.am new file mode 100644 index 0000000000..5ad5c18b55 --- /dev/null +++ b/pidgin/themes/Makefile.am @@ -0,0 +1,6 @@ + +themetemplatedir = $(datadir)/pidgin/theme/conversation +themetemplate_DATA = Template.html + +EXTRA_DIST = $(themetemplate_DATA) + diff --git a/pidgin/themes/Template.html b/pidgin/themes/Template.html new file mode 100644 index 0000000000..0a7f9d6662 --- /dev/null +++ b/pidgin/themes/Template.html @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + +%@ +
+
+%@ + + -- cgit v1.2.1 From 7bae99a23531e49c606c2e088b0aa5951cc62d73 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 18 Oct 2011 04:47:58 +0000 Subject: Goodbye Adium themes plugin. I never really liked you anyway. PS, someone write our default theme for us... --- configure.ac | 1 - pidgin/plugins/Makefile.am | 5 +- pidgin/plugins/adiumthemes/Makefile.am | 30 - pidgin/plugins/adiumthemes/message-style.c | 429 --------------- pidgin/plugins/adiumthemes/message-style.h | 81 --- pidgin/plugins/adiumthemes/webkit.c | 858 ----------------------------- 6 files changed, 2 insertions(+), 1402 deletions(-) delete mode 100644 pidgin/plugins/adiumthemes/Makefile.am delete mode 100644 pidgin/plugins/adiumthemes/message-style.c delete mode 100644 pidgin/plugins/adiumthemes/message-style.h delete mode 100644 pidgin/plugins/adiumthemes/webkit.c diff --git a/configure.ac b/configure.ac index c671230f1b..cc4d7958fe 100644 --- a/configure.ac +++ b/configure.ac @@ -2496,7 +2496,6 @@ AC_CONFIG_FILES([Makefile pidgin/pixmaps/emotes/none/Makefile pidgin/pixmaps/emotes/small/16/Makefile pidgin/plugins/Makefile - pidgin/plugins/adiumthemes/Makefile pidgin/plugins/cap/Makefile pidgin/plugins/disco/Makefile pidgin/plugins/gestures/Makefile diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index 0674f7ea80..4485e025e2 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -1,4 +1,4 @@ -DIST_SUBDIRS = adiumthemes cap disco gestures gevolution musicmessaging perl ticker +DIST_SUBDIRS = cap disco gestures gevolution musicmessaging perl ticker if BUILD_GEVOLUTION GEVOLUTION_DIR = gevolution @@ -27,8 +27,7 @@ SUBDIRS = \ $(MUSICMESSAGING_DIR) \ $(PERL_DIR) \ disco \ - ticker \ - adiumthemes + ticker plugindir = $(libdir)/pidgin diff --git a/pidgin/plugins/adiumthemes/Makefile.am b/pidgin/plugins/adiumthemes/Makefile.am deleted file mode 100644 index a0396dbc60..0000000000 --- a/pidgin/plugins/adiumthemes/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ - -adiumtemplatedir = $(datadir)/pidgin/webkit -adiumtemplate_DATA = Template.html - -adiumdir = $(libdir)/pidgin - -adium_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = $(webkittemplate_DATA) - -if PLUGINS - -adium_LTLIBRARIES = adium.la - -adium_la_SOURCES = webkit.c \ - message-style.h \ - message-style.c - -endif - -adium_la_LIBADD = $(GTK_LIBS) $(WEBKIT_LIBS) - -AM_CPPFLAGS = \ - -DDATADIR=\"$(datadir)\" \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -I$(top_srcdir)/pidgin \ - $(DEBUG_CFLAGS) \ - $(GTK_CFLAGS) \ - $(WEBKIT_CFLAGS) diff --git a/pidgin/plugins/adiumthemes/message-style.c b/pidgin/plugins/adiumthemes/message-style.c deleted file mode 100644 index d103136790..0000000000 --- a/pidgin/plugins/adiumthemes/message-style.c +++ /dev/null @@ -1,429 +0,0 @@ -/* pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "message-style.h" - -#include - -#include - -#include -#include - -static void -glist_free_all_string(GList *list) -{ - for (; list; list = g_list_delete_link(list, list)) - g_free(list->data); -} - -static PidginMessageStyle * -pidgin_message_style_new(const char *styledir) -{ - PidginMessageStyle *ret = g_new0(PidginMessageStyle, 1); - - ret->ref_counter = 1; - ret->style_dir = g_strdup(styledir); - - return ret; -} - -void -pidgin_message_style_unref(PidginMessageStyle *style) -{ - if (!style) - return; - g_assert (style->ref_counter > 0); - - style->ref_counter--; - if (style->ref_counter) - return; - - g_free(style->cf_bundle_name); - g_free(style->cf_bundle_identifier); - g_free(style->cf_bundle_get_info_string); - g_free(style->default_font_family); - g_free(style->default_background_color); - g_free(style->image_mask); - g_free(style->default_variant); - - g_free(style->style_dir); - g_free(style->template_path); - - g_free(style->template_html); - g_free(style->incoming_content_html); - g_free(style->outgoing_content_html); - g_free(style->outgoing_next_content_html); - g_free(style->status_html); - g_free(style->basestyle_css); - - g_free(style); -} - -void -pidgin_message_style_save_state(const PidginMessageStyle *style) -{ - char *prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); - char *variant = g_strdup_printf("%s/variant", prefname); - - purple_debug_info("webkit", "saving state with variant %s\n", style->variant); - purple_prefs_add_none(prefname); - purple_prefs_add_string(variant, ""); - purple_prefs_set_string(variant, style->variant); - - g_free(prefname); - g_free(variant); -} - -static void -pidgin_message_style_load_state(PidginMessageStyle *style) -{ - char *prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier); - char *variant = g_strdup_printf("%s/variant", prefname); - - const char* value = purple_prefs_get_string(variant); - gboolean changed = !style->variant || !g_str_equal(style->variant, value); - - g_free(style->variant); - style->variant = g_strdup(value); - - if (changed) - pidgin_message_style_read_info_plist(style, style->variant); - - g_free(prefname); - g_free(variant); -} - - -static gboolean -parse_info_plist_key_value(xmlnode* key, gpointer destination, const char* expected) -{ - xmlnode *val = key->next; - - for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next) - ; - if (!val) - return FALSE; - - if (expected == NULL || g_str_equal(expected, "string")) { - char **dest = (char **)destination; - if (!g_str_equal(val->name, "string")) - return FALSE; - if (*dest) - g_free(*dest); - *dest = xmlnode_get_data_unescaped(val); - } else if (g_str_equal(expected, "integer")) { - int *dest = (int *)destination; - char *value = xmlnode_get_data_unescaped(val); - - if (!g_str_equal(val->name, "integer")) - return FALSE; - *dest = atoi(value); - g_free(value); - } else if (g_str_equal(expected, "boolean")) { - gboolean *dest = (gboolean *)destination; - if (g_str_equal(val->name, "true")) - *dest = TRUE; - else if (g_str_equal(val->name, "false")) - *dest = FALSE; - else - return FALSE; - } else return FALSE; - - return TRUE; -} - -static gboolean -str_for_key(const char *key, const char *found, const char *variant) -{ - if (g_str_equal(key, found)) - return TRUE; - if (!variant) - return FALSE; - return (g_str_has_prefix(found, key) - && g_str_has_suffix(found, variant) - && strlen(found) == strlen(key) + strlen(variant) + 1); -} - -/** - * Info.plist should be re-read every time the variant changes, this is because - * the keys that take precedence depend on the value of the current variant. - */ -void -pidgin_message_style_read_info_plist(PidginMessageStyle *style, const char *variant) -{ - /* note that if a variant is used the option:VARIANTNAME takes precedence */ - char *contents = g_build_filename(style->style_dir, "Contents", NULL); - xmlnode *plist = xmlnode_from_file(contents, "Info.plist", "Info.plist", "webkit"), *iter; - xmlnode *dict = xmlnode_get_child(plist, "dict"); - - g_assert (dict); - for (iter = xmlnode_get_child(dict, "key"); iter; iter = xmlnode_get_next_twin(iter)) { - char* key = xmlnode_get_data_unescaped(iter); - gboolean pr = TRUE; - - if (g_str_equal("MessageViewVersion", key)) - pr = parse_info_plist_key_value(iter, &style->message_view_version, "integer"); - else if (g_str_equal("CFBundleName", key)) - pr = parse_info_plist_key_value(iter, &style->cf_bundle_name, "string"); - else if (g_str_equal("CFBundleIdentifier", key)) - pr = parse_info_plist_key_value(iter, &style->cf_bundle_identifier, "string"); - else if (g_str_equal("CFBundleGetInfoString", key)) - pr = parse_info_plist_key_value(iter, &style->cf_bundle_get_info_string, "string"); - else if (str_for_key("DefaultFontFamily", key, variant)) - pr = parse_info_plist_key_value(iter, &style->default_font_family, "string"); - else if (str_for_key("DefaultFontSize", key, variant)) - pr = parse_info_plist_key_value(iter, &style->default_font_size, "integer"); - else if (str_for_key("ShowsUserIcons", key, variant)) - pr = parse_info_plist_key_value(iter, &style->shows_user_icons, "boolean"); - else if (str_for_key("DisableCombineConsecutive", key, variant)) - pr = parse_info_plist_key_value(iter, &style->disable_combine_consecutive, "boolean"); - else if (str_for_key("DefaultBackgroundIsTransparent", key, variant)) - pr = parse_info_plist_key_value(iter, &style->default_background_is_transparent, "boolean"); - else if (str_for_key("DisableCustomBackground", key, variant)) - pr = parse_info_plist_key_value(iter, &style->disable_custom_background, "boolean"); - else if (str_for_key("DefaultBackgroundColor", key, variant)) - pr = parse_info_plist_key_value(iter, &style->default_background_color, "string"); - else if (str_for_key("AllowTextColors", key, variant)) - pr = parse_info_plist_key_value(iter, &style->allow_text_colors, "integer"); - else if (str_for_key("ImageMask", key, variant)) - pr = parse_info_plist_key_value(iter, &style->image_mask, "string"); - - if (!pr) - purple_debug_warning("webkit", "Failed to parse key %s\n", key); - g_free(key); - } - - xmlnode_free(plist); -} - -PidginMessageStyle * -pidgin_message_style_load(const char *styledir) -{ - /* - * the loading process described: - * - * First we load all the style .html files, etc. - * The we load any config options that have been stored for - * this variant. - * Then we load the Info.plist, for the currently decided variant. - * At this point, if we find that variants exist, yet - * we don't have a variant selected, we choose DefaultVariant - * and if that does not exist, we choose the first one in the - * directory. - */ - char *file; - PidginMessageStyle *style = NULL; - - style = pidgin_message_style_new(styledir); - - /* load all other files */ - - /* The template path can either come from the theme, or can - * be stock Template.html that comes with the plugin */ - style->template_path = g_build_filename(styledir, "Contents", "Resources", "Template.html", NULL); - - if (!g_file_test(style->template_path, G_FILE_TEST_EXISTS)) { - g_free(style->template_path); - style->template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); - } - - if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) { - purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", style->template_path); - pidgin_message_style_unref(style); - return NULL; - } - - file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL); - if (!g_file_get_contents(file, &style->status_html, NULL, NULL)) { - purple_debug_info("webkit", "%s could not find Resources/Status.html", styledir); - pidgin_message_style_unref(style); - g_free(file); - return NULL; - } - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "main.css", NULL); - if (!g_file_get_contents(file, &style->basestyle_css, NULL, NULL)) - style->basestyle_css = g_strdup(""); - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL); - if (!g_file_get_contents(file, &style->header_html, NULL, NULL)) - style->header_html = g_strdup(""); - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL); - if (!g_file_get_contents(file, &style->footer_html, NULL, NULL)) - style->footer_html = g_strdup(""); - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); - if (!g_file_get_contents(file, &style->incoming_content_html, NULL, NULL)) { - purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", styledir); - pidgin_message_style_unref(style); - g_free(file); - return NULL; - } - g_free(file); - - - /* according to the spec, the following are optional files */ - file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); - if (!g_file_get_contents(file, &style->incoming_next_content_html, NULL, NULL)) { - style->incoming_next_content_html = g_strdup(style->incoming_content_html); - } - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "Content.html", NULL); - if (!g_file_get_contents(file, &style->outgoing_content_html, NULL, NULL)) { - style->outgoing_content_html = g_strdup(style->incoming_content_html); - } - g_free(file); - - file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); - if (!g_file_get_contents(file, &style->outgoing_next_content_html, NULL, NULL)) { - style->outgoing_next_content_html = g_strdup(style->outgoing_content_html); - } - - pidgin_message_style_read_info_plist(style, NULL); - pidgin_message_style_load_state(style); - - /* non variant dependent Info.plist checks */ - if (style->message_view_version < 3) { - purple_debug_info("webkit", "%s is a legacy style (version %d) and will not be loaded\n", style->cf_bundle_name, style->message_view_version); - pidgin_message_style_unref(style); - return NULL; - } - - if (!style->variant) - { - GList *variants = pidgin_message_style_get_variants(style); - - if (variants) - pidgin_message_style_set_variant(style, variants->data); - - glist_free_all_string(variants); - } - - return style; -} - -PidginMessageStyle * -pidgin_message_style_copy(const PidginMessageStyle *style) -{ - PidginMessageStyle *ret = pidgin_message_style_new(style->style_dir); - - ret->variant = g_strdup(style->variant); - ret->message_view_version = style->message_view_version; - ret->cf_bundle_name = g_strdup(style->cf_bundle_name); - ret->cf_bundle_identifier = g_strdup(style->cf_bundle_identifier); - ret->cf_bundle_get_info_string = g_strdup(style->cf_bundle_get_info_string); - ret->default_font_family = g_strdup(style->default_font_family); - ret->default_font_size = style->default_font_size; - ret->shows_user_icons = style->shows_user_icons; - ret->disable_combine_consecutive = style->disable_combine_consecutive; - ret->default_background_is_transparent = style->default_background_is_transparent; - ret->disable_custom_background = style->disable_custom_background; - ret->default_background_color = g_strdup(style->default_background_color); - ret->allow_text_colors = style->allow_text_colors; - ret->image_mask = g_strdup(style->image_mask); - ret->default_variant = g_strdup(style->default_variant); - - ret->template_path = g_strdup(style->template_path); - ret->template_html = g_strdup(style->template_html); - ret->header_html = g_strdup(style->header_html); - ret->footer_html = g_strdup(style->footer_html); - ret->incoming_content_html = g_strdup(style->incoming_content_html); - ret->outgoing_content_html = g_strdup(style->outgoing_content_html); - ret->incoming_next_content_html = g_strdup(style->incoming_next_content_html); - ret->outgoing_next_content_html = g_strdup(style->outgoing_next_content_html); - ret->status_html = g_strdup(style->status_html); - ret->basestyle_css = g_strdup(style->basestyle_css); - return ret; -} - -void -pidgin_message_style_set_variant(PidginMessageStyle *style, const char *variant) -{ - /* I'm not going to test whether this variant is valid! */ - g_free(style->variant); - style->variant = g_strdup(variant); - - pidgin_message_style_read_info_plist(style, variant); - - /* todo, the style has "changed". Ideally, I would like to use signals at this point. */ -} - -char * -pidgin_message_style_get_variant(PidginMessageStyle *style) -{ - return g_strdup(style->variant); -} - -/** - * Get a list of variants supported by the style. - */ -GList* -pidgin_message_style_get_variants(PidginMessageStyle *style) -{ - GList *ret = NULL; - GDir *variants; - const char *css_file; - char *css; - char *variant_dir; - - g_assert(style->style_dir); - variant_dir = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", NULL); - - variants = g_dir_open(variant_dir, 0, NULL); - if (!variants) - return NULL; - - while ((css_file = g_dir_read_name(variants)) != NULL) { - if (!g_str_has_suffix(css_file, ".css")) - continue; - - css = g_strndup(css_file, strlen(css_file) - 4); - ret = g_list_append(ret, css); - } - - g_dir_close(variants); - g_free(variant_dir); - - ret = g_list_sort(ret, (GCompareFunc)g_strcmp0); - return ret; -} - -char * -pidgin_message_style_get_css(PidginMessageStyle *style) -{ - if (!style->variant) { - return g_build_filename(style->style_dir, "Contents", "Resources", "main.css", NULL); - } else { - char *file = g_strdup_printf("%s.css", style->variant); - char *ret = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", file, NULL); - g_free(file); - return ret; - } -} - diff --git a/pidgin/plugins/adiumthemes/message-style.h b/pidgin/plugins/adiumthemes/message-style.h deleted file mode 100644 index 92694c6e32..0000000000 --- a/pidgin/plugins/adiumthemes/message-style.h +++ /dev/null @@ -1,81 +0,0 @@ -/* pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include - -/* - * I'm going to allow a different style for each PidginConversation. - * This way I can do two things: 1) change the theme on the fly and not - * change existing themes, and 2) Use a different theme for IMs and - * chats. - */ -typedef struct _PidginMessageStyle { - int ref_counter; - - /* current config options */ - char *variant; /* allowed to be NULL if there are no variants */ - - /* Info.plist keys that change with Variant */ - - /* Static Info.plist keys */ - int message_view_version; - char *cf_bundle_name; - char *cf_bundle_identifier; - char *cf_bundle_get_info_string; - char *default_font_family; - int default_font_size; - gboolean shows_user_icons; - gboolean disable_combine_consecutive; - gboolean default_background_is_transparent; - gboolean disable_custom_background; - char *default_background_color; - gboolean allow_text_colors; - char *image_mask; - char *default_variant; - - /* paths */ - char *style_dir; - char *template_path; - - /* caches */ - char *template_html; - char *header_html; - char *footer_html; - char *incoming_content_html; - char *outgoing_content_html; - char *incoming_next_content_html; - char *outgoing_next_content_html; - char *status_html; - char *basestyle_css; -} PidginMessageStyle; - -PidginMessageStyle *pidgin_message_style_load(const char *styledir); -PidginMessageStyle *pidgin_message_style_copy(const PidginMessageStyle *style); -void pidgin_message_style_save_state(const PidginMessageStyle *style); -void pidgin_message_style_unref(PidginMessageStyle *style); -void pidgin_message_style_read_info_plist(PidginMessageStyle *style, const char *variant); -char *pidgin_message_style_get_variant(PidginMessageStyle *style); -GList *pidgin_message_style_get_variants(PidginMessageStyle *style); -void pidgin_message_style_set_variant(PidginMessageStyle *style, const char *variant); - -char *pidgin_message_style_get_css(PidginMessageStyle *style); - diff --git a/pidgin/plugins/adiumthemes/webkit.c b/pidgin/plugins/adiumthemes/webkit.c deleted file mode 100644 index b37bd5e780..0000000000 --- a/pidgin/plugins/adiumthemes/webkit.c +++ /dev/null @@ -1,858 +0,0 @@ -/* pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#define PLUGIN_ID "gtk-webview-adium-ims" -#define PLUGIN_NAME "webview-adium-ims" - -/* - * A lot of this was originally written by Sean Egan, but I think I've - * rewrote enough to replace the author for now. - */ -#define PLUGIN_AUTHOR "Arnold Noronha " -#define PURPLE_PLUGINS "Hell yeah" - -/* System headers */ -#include -#include -#include - -#include - -/* Purple headers */ -#include -#include -#include -#include -#include -#include - -/* Pidgin headers */ -#include -#include -#include -#include - -#include - -#include "message-style.h" -/* GObject data keys */ -#define MESSAGE_STYLE_KEY "message-style" - -static char *cur_style_dir = NULL; -static void *handle = NULL; - -static inline char * -get_absolute_path(const char *path) -{ - if (g_path_is_absolute(path)) - return g_strdup(path); - else { - char *cwd, *ret; - cwd = g_get_current_dir(); - ret = g_build_filename(cwd, path, NULL); - g_free(cwd); - return ret; - } -} - -static void webkit_on_webview_destroy(GtkObject* obj, gpointer data); - -static void * -webkit_plugin_get_handle(void) -{ - if (handle) - return handle; - else - return (handle = g_malloc(1)); -} - -static void -webkit_plugin_free_handle(void) -{ - purple_signals_disconnect_by_handle(handle); - g_free(handle); -} - -static char * -replace_message_tokens( - const char *text, - PurpleConversation *conv, - const char *name, - const char *alias, - const char *message, - PurpleMessageFlags flags, - time_t mtime) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - GString *str = g_string_new(NULL); - const char *cur = text; - const char *prev = cur; - - while ((cur = strchr(cur, '%'))) { - const char *replace = NULL; - char *fin = NULL; - - if (!strncmp(cur, "%message%", strlen("%message%"))) { - replace = message; - } else if (!strncmp(cur, "%messageClasses%", strlen("%messageClasses%"))) { - replace = flags & PURPLE_MESSAGE_SEND ? "outgoing" : - flags & PURPLE_MESSAGE_RECV ? "incoming" : "event"; - } else if (!strncmp(cur, "%time", strlen("%time"))) { - char *format = NULL; - if (*(cur + strlen("%time")) == '{') { - const char *start = cur + strlen("%time") + 1; - char *end = strstr(start, "}%"); - if (!end) /* Invalid string */ - continue; - format = g_strndup(start, end - start); - fin = end + 1; - } - replace = purple_utf8_strftime(format ? format : "%X", NULL); - g_free(format); - } else if (!strncmp(cur, "%userIconPath%", strlen("%userIconPath%"))) { - if (flags & PURPLE_MESSAGE_SEND) { - if (purple_account_get_bool(account, "use-global-buddyicon", TRUE)) { - replace = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon"); - } else { - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - replace = purple_imgstore_get_filename(img); - } - if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { - replace = g_build_filename("Outgoing", "buddy_icon.png", NULL); - } - } else if (flags & PURPLE_MESSAGE_RECV) { - PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); - replace = purple_buddy_icon_get_full_path(icon); - if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { - replace = g_build_filename("Incoming", "buddy_icon.png", NULL); - } - } - - } else if (!strncmp(cur, "%senderScreenName%", strlen("%senderScreenName%"))) { - replace = name; - } else if (!strncmp(cur, "%sender%", strlen("%sender%"))) { - replace = alias; - } else if (!strncmp(cur, "%service%", strlen("%service%"))) { - replace = purple_account_get_protocol_name(account); - } else { - cur++; - continue; - } - - /* Here we have a replacement to make */ - g_string_append_len(str, prev, cur - prev); - g_string_append(str, replace); - - /* And update the pointers */ - if (fin) { - prev = cur = fin + 1; - } else { - prev = cur = strchr(cur + 1, '%') + 1; - } - - } - - /* And wrap it up */ - g_string_append(str, prev); - return g_string_free(str, FALSE); -} - -static char * -replace_header_tokens(char *text, PurpleConversation *conv) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - GString *str = g_string_new(NULL); - char *cur = text; - char *prev = cur; - - if (text == NULL) - return NULL; - - while ((cur = strchr(cur, '%'))) { - const char *replace = NULL; - char *fin = NULL; - - if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { - replace = purple_conversation_get_name(conv); - } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { - replace = purple_account_get_alias(account); - if (replace == NULL) - replace = purple_account_get_username(account); - } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { - PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); - if (buddy) { - replace = purple_buddy_get_alias(buddy); - } else { - replace = purple_conversation_get_name(conv); - } - } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { - PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); - replace = purple_buddy_icon_get_full_path(icon); - } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { - } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { - char *format = NULL; - if (*(cur + strlen("%timeOpened")) == '{') { - char *start = cur + strlen("%timeOpened") + 1; - char *end = strstr(start, "}%"); - if (!end) /* Invalid string */ - continue; - format = g_strndup(start, end - start); - fin = end + 1; - } - replace = purple_utf8_strftime(format ? format : "%X", NULL); - g_free(format); - } else { - continue; - } - - /* Here we have a replacement to make */ - g_string_append_len(str, prev, cur - prev); - g_string_append(str, replace); - - /* And update the pointers */ - if (fin) { - prev = cur = fin + 1; - } else { - prev = cur = strchr(cur + 1, '%') + 1; - } - } - - /* And wrap it up */ - g_string_append(str, prev); - return g_string_free(str, FALSE); -} - -static char * -replace_template_tokens(PidginMessageStyle *style, char *text, char *header, char *footer) -{ - GString *str = g_string_new(NULL); - - char **ms = g_strsplit(text, "%@", 6); - char *base = NULL; - char *csspath = pidgin_message_style_get_css(style); - if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { - g_strfreev(ms); - g_string_free(str, TRUE); - return NULL; - } - - g_string_append(str, ms[0]); - g_string_append(str, "file://"); - base = g_build_filename(style->style_dir, "Contents", "Resources", "Template.html", NULL); - g_string_append(str, base); - g_free(base); - - g_string_append(str, ms[1]); - - g_string_append(str, style->basestyle_css); - - g_string_append(str, ms[2]); - - g_string_append(str, "file://"); - g_string_append(str, csspath); - - g_string_append(str, ms[3]); - if (header) - g_string_append(str, header); - g_string_append(str, ms[4]); - if (footer) - g_string_append(str, footer); - g_string_append(str, ms[5]); - - g_strfreev(ms); - g_free(csspath); - return g_string_free(str, FALSE); -} - -static GtkWidget * -get_webkit(PurpleConversation *conv) -{ - PidginConversation *gtkconv; - gtkconv = PIDGIN_CONVERSATION(conv); - if (!gtkconv) - return NULL; - else - return gtkconv->webview; -} - -static void -set_theme_webkit_settings(WebKitWebView *webview, PidginMessageStyle *style) -{ - WebKitWebSettings *settings; - - g_object_get(G_OBJECT(webview), "settings", &settings, NULL); - if (style->default_font_family) - g_object_set(G_OBJECT(settings), "default-font-family", style->default_font_family, NULL); - - if (style->default_font_size) - g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(style->default_font_size), NULL); - - /* this does not work :( */ - webkit_web_view_set_transparent(webview, style->default_background_is_transparent); -} - -/* - * The style specification says that if the conversation is a group - * chat then the
element will be given a class - * 'groupchat'. I can't add another '%@' in Template.html because - * that breaks style-specific Template.html's. I have to either use libxml - * or conveniently play with WebKit's javascript engine. The javascript - * engine should work, but it's not an identical behavior. - */ -static void -webkit_set_groupchat(GtkWebView *webview) -{ - gtk_webview_safe_execute_script(webview, "document.getElementById('Chat').className = 'groupchat'"); -} - - -/** - * Called when either a new PurpleConversation is created - * or when a PidginConversation changes its active PurpleConversation - * This will not change the theme if the theme is already set. - * (This is to prevent accidental theme changes if a new - * PurpleConversation gets added. - * - * FIXME: it's not at all clear to me as to how - * Adium themes handle the case when the PurpleConversation - * changes. - */ -static void -init_theme_for_webkit(PurpleConversation *conv, char *style_dir) -{ - GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; - char *header, *footer; - char *template; - - char* basedir; - char* baseuri; - PidginMessageStyle *style, *oldStyle; - PidginMessageStyle *copy; - - oldStyle = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY); - if (oldStyle) - return; - - purple_debug_info("webkit", "loading %s\n", style_dir); - style = pidgin_message_style_load(style_dir); - g_assert(style); - g_assert(style->template_html); /* debugging test? */ - - basedir = g_build_filename(style->style_dir, "Contents", "Resources", "Template.html", NULL); - baseuri = g_strdup_printf("file://%s", basedir); - header = replace_header_tokens(style->header_html, conv); - g_assert(style); - footer = replace_header_tokens(style->footer_html, conv); - template = replace_template_tokens(style, style->template_html, header, footer); - - g_assert(template); - - purple_debug_info("webkit", "template: %s\n", template); - - set_theme_webkit_settings(WEBKIT_WEB_VIEW(webkit), style); - webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); - - copy = pidgin_message_style_copy(style); - g_object_set_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy); - - pidgin_message_style_unref(style); - /* I need to unref this style when the webkit object destroys */ - g_signal_connect(G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); - - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) - webkit_set_groupchat(GTK_WEBVIEW(webkit)); - g_free(basedir); - g_free(baseuri); - g_free(header); - g_free(footer); - g_free(template); -} - - -/* restore the non theme version of the conversation window */ -static void -finalize_theme_for_webkit(PurpleConversation *conv) -{ - GtkWidget *webview = PIDGIN_CONVERSATION(conv)->webview; - PidginMessageStyle *style = g_object_get_data(G_OBJECT(webview), MESSAGE_STYLE_KEY); - - webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), "", "text/html", "UTF-8", ""); - - g_object_set_data(G_OBJECT(webview), MESSAGE_STYLE_KEY, NULL); - pidgin_message_style_unref(style); -} - -static void -webkit_on_webview_destroy(GtkObject *object, gpointer data) -{ - pidgin_message_style_unref((PidginMessageStyle *)data); - g_object_set_data(G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); -} - -static gboolean -webkit_on_displaying_im_msg(PurpleAccount *account, - const char* name, - char **pmessage, - PurpleConversation *conv, - PurpleMessageFlags flags, - gpointer data) -{ - GtkWidget *webkit; - char *message = *pmessage; - const char *alias = name; /* FIXME: signal doesn't give me alias */ - char *stripped; - char *message_html; - char *msg; - char *escape; - char *script; - char *func = "appendMessage"; - char *smileyed; - time_t mtime = time(NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */ - - PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); - PidginMessageStyle *style; - - webkit = get_webkit(conv); - stripped = g_strdup(message); - - style = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY); - g_assert(style); - - if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) { - message_html = style->outgoing_next_content_html; - func = "appendNextMessage"; - } else if (flags & PURPLE_MESSAGE_SEND) { - message_html = style->outgoing_content_html; - } else if (flags & PURPLE_MESSAGE_RECV && old_flags & PURPLE_MESSAGE_RECV) { - message_html = style->incoming_next_content_html; - func = "appendNextMessage"; - } else if (flags & PURPLE_MESSAGE_RECV) { - message_html = style->incoming_content_html; - } else { - message_html = style->status_html; - } - purple_conversation_set_data(conv, "webkit-lastflags", GINT_TO_POINTER(flags)); - - smileyed = smiley_parse_markup(stripped, purple_account_get_protocol_id(purple_conversation_get_account(conv))); - msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime); - escape = gtk_webview_quote_js_string(msg); - script = g_strdup_printf("%s(%s)", func, escape); - - purple_debug_info("webkit", "JS: %s\n", script); - gtk_webview_safe_execute_script(GTK_WEBVIEW(webkit), script); - - g_free(script); - g_free(smileyed); - g_free(msg); - g_free(stripped); - g_free(escape); - - return TRUE; /* GtkConv should not handle this IM */ -} - -static gboolean -webkit_on_displaying_chat_msg(PurpleAccount *account, - const char *who, - char **message, - PurpleConversation *conv, - PurpleMessageFlags flags, - gpointer userdata) -{ - /* handle exactly like an IM message for now */ - return webkit_on_displaying_im_msg(account, who, message, conv, flags, NULL); -} - -static void -webkit_on_conversation_displayed(PidginConversation *gtkconv, gpointer data) -{ - init_theme_for_webkit(gtkconv->active_conv, cur_style_dir); -} - -static void -webkit_on_conversation_switched(PurpleConversation *conv, gpointer data) -{ - init_theme_for_webkit(conv, cur_style_dir); -} - -static void -webkit_on_conversation_hiding(PidginConversation *gtkconv, gpointer data) -{ - /* - * I'm not sure if I need to do anything here, but let's keep - * this anyway. - */ -} - -static GList * -get_dir_dir_list(const char *dirname) -{ - GList *ret = NULL; - GDir *dir = g_dir_open(dirname, 0, NULL); - const char* subdir; - - if (!dir) return NULL; - while ((subdir = g_dir_read_name(dir))) { - ret = g_list_append(ret, g_build_filename(dirname, subdir, NULL)); - } - - g_dir_close(dir); - return ret; -} - -/** - * Get me a list of all the available themes specified by their - * directories. I don't guarrantee that these are valid themes, just - * that they are in the directories for themes. - */ -static GList * -get_style_directory_list(void) -{ - char *user_dir, *user_style_dir, *global_style_dir; - GList *list1, *list2; - - user_dir = get_absolute_path(purple_user_dir()); - - user_style_dir = g_build_filename(user_dir, "styles", NULL); - global_style_dir = g_build_filename(DATADIR, "pidgin", "styles", NULL); - - list1 = get_dir_dir_list(user_style_dir); - list2 = get_dir_dir_list(global_style_dir); - - g_free(global_style_dir); - g_free(user_style_dir); - g_free(user_dir); - - return g_list_concat(list1, list2); -} - -/** - * use heuristics or previous user options to figure out what - * theme to use as default in this Pidgin instance. - */ -static void -style_set_default(void) -{ - GList *styles = get_style_directory_list(), *iter; - const char *stylepath = purple_prefs_get_string("/plugins/gtk/adiumthemes/stylepath"); - g_assert(cur_style_dir == NULL); - - if (stylepath && *stylepath) - styles = g_list_prepend(styles, g_strdup(stylepath)); - - /* pick any one that works. Note that we have first preference - * for the one in the userdir */ - for (iter = styles; iter; iter = g_list_next(iter)) { - PidginMessageStyle *style = pidgin_message_style_load(iter->data); - if (style) { - cur_style_dir = (char *)g_strdup(iter->data); - pidgin_message_style_unref(style); - break; - } - purple_debug_info("webkit", "Style %s is invalid\n", (char *)iter->data); - } - - for (iter = styles; iter; iter = g_list_next(iter)) - g_free(iter->data); - g_list_free(styles); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - style_set_default(); - if (!cur_style_dir) - return FALSE; /* couldn't find a style */ - - purple_signal_connect(pidgin_conversations_get_handle(), - "displaying-im-msg", - webkit_plugin_get_handle(), - PURPLE_CALLBACK(webkit_on_displaying_im_msg), - NULL); - - purple_signal_connect(pidgin_conversations_get_handle(), - "displaying-chat-msg", - webkit_plugin_get_handle(), - PURPLE_CALLBACK(webkit_on_displaying_chat_msg), - NULL); - - purple_signal_connect(pidgin_conversations_get_handle(), - "conversation-displayed", - webkit_plugin_get_handle(), - PURPLE_CALLBACK(webkit_on_conversation_displayed), - NULL); - - purple_signal_connect(pidgin_conversations_get_handle(), - "conversation-switched", - webkit_plugin_get_handle(), - PURPLE_CALLBACK(webkit_on_conversation_switched), - NULL); - - purple_signal_connect(pidgin_conversations_get_handle(), - "conversation-hiding", - webkit_plugin_get_handle(), - PURPLE_CALLBACK(webkit_on_conversation_hiding), - NULL); - - /* finally update each of the existing conversation windows */ - { - GList *list = purple_get_conversations(); - for (;list; list = g_list_next(list)) - init_theme_for_webkit(list->data, cur_style_dir); - - } - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - GList *list; - - webkit_plugin_free_handle(); - cur_style_dir = NULL; - list = purple_get_conversations(); - while (list) { - finalize_theme_for_webkit(list->data); - list = g_list_next(list); - } - - return TRUE; -} - -/* - * UI config code - */ - -static void -style_changed(GtkWidget *combobox, gpointer null) -{ - char *name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combobox)); - GtkWidget *dialog; - GList *styles = get_style_directory_list(), *iter; - - /* find the full path for this name, I wish I could store this info in the combobox itself. :( */ - for (iter = styles; iter; iter = g_list_next(iter)) { - char *basename = g_path_get_basename(iter->data); - if (g_str_equal(basename, name)) { - g_free(basename); - break; - } - g_free(basename); - } - - g_assert(iter); - g_free(name); - g_free(cur_style_dir); - cur_style_dir = g_strdup(iter->data);; - purple_prefs_set_string("/plugins/gtk/adiumthemes/stylepath", cur_style_dir); - - /* inform the user that existing conversations haven't changed */ - dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "The style for existing conversations have not been changed. Please close and re-open the conversation for the changes to take effect."); - g_assert(dialog); - gtk_widget_show(dialog); - g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog); -} - -static GtkWidget * -get_style_config_frame(void) -{ - GtkWidget *combobox = gtk_combo_box_new_text(); - GList *styles = get_style_directory_list(), *iter; - int index = 0, selected = 0; - - for (iter = styles; iter; iter = g_list_next(iter)) { - PidginMessageStyle *style = pidgin_message_style_load(iter->data); - - if (style) { - char *text = g_path_get_basename(iter->data); - gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), text); - g_free(text); - - if (g_str_equal(iter->data, cur_style_dir)) - selected = index; - index++; - pidgin_message_style_unref(style); - } - } - gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), selected); - g_signal_connect_after(G_OBJECT(combobox), "changed", G_CALLBACK(style_changed), NULL); - return combobox; -} - -static void -variant_update_conversation(PurpleConversation *conv) -{ - PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - WebKitWebView *webview = WEBKIT_WEB_VIEW(gtkconv->webview); - PidginMessageStyle *style = (PidginMessageStyle *)g_object_get_data(G_OBJECT(webview), MESSAGE_STYLE_KEY); - char *script; - - g_assert(style); - - script = g_strdup_printf("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css(style)); - gtk_webview_safe_execute_script(GTK_WEBVIEW(webview), script); - - set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), style); - g_free(script); -} - -static void -variant_changed(GtkWidget* combobox, gpointer null) -{ - char *name; - GList *list; - PidginMessageStyle *style = pidgin_message_style_load(cur_style_dir); - - g_assert(style); - name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combobox)); - pidgin_message_style_set_variant(style, name); - pidgin_message_style_save_state(style); - - /* update conversations */ - list = purple_get_conversations(); - while (list) { - variant_update_conversation(list->data); - list = g_list_next(list); - } - - g_free(name); - pidgin_message_style_unref(style); -} - -static GtkWidget * -get_variant_config_frame() -{ - PidginMessageStyle *style = pidgin_message_style_load(cur_style_dir); - GList *variants = pidgin_message_style_get_variants(style), *iter; - char *cur_variant = pidgin_message_style_get_variant(style); - GtkWidget *combobox = gtk_combo_box_new_text(); - int def = -1, index = 0; - - pidgin_message_style_unref(style); - - for (iter = variants; iter; iter = g_list_next(iter)) { - gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), iter->data); - - if (g_str_equal(cur_variant, iter->data)) - def = index; - index ++; - - } - - gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), def); - g_signal_connect(G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL); - - return combobox; -} - -static void -style_changed_reset_variants(GtkWidget* combobox, gpointer table) -{ - /* I hate to do this, I swear. But I don't know how to cleanly clean an existing combobox */ - GtkWidget* variants = g_object_get_data(G_OBJECT(table), "variants-cbox"); - gtk_widget_destroy(variants); - variants = get_variant_config_frame(); - gtk_table_attach_defaults(GTK_TABLE(table), variants, 1, 2, 1, 2); - gtk_widget_show_all(GTK_WIDGET(table)); - - g_object_set_data(G_OBJECT(table), "variants-cbox", variants); -} - -static GtkWidget* -get_config_frame(PurplePlugin* plugin) -{ - GtkWidget *table = gtk_table_new(2, 2, FALSE); - GtkWidget *style_config = get_style_config_frame(); - GtkWidget *variant_config = get_variant_config_frame(); - - gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new("Message Style"), 0, 1, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(table), style_config, 1, 2, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new("Style Variant"), 0, 1, 1, 2); - gtk_table_attach_defaults(GTK_TABLE(table), variant_config, 1, 2, 1, 2); - - g_object_set_data(G_OBJECT(table), "variants-cbox", variant_config); - /* to clarify, this is a second signal connected on style config */ - g_signal_connect_after(G_OBJECT(style_config), "changed", G_CALLBACK(style_changed_reset_variants), table); - - return table; -} - -PidginPluginUiInfo ui_info = -{ - get_config_frame, - 0, /* page_num (Reserved) */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, /* Magic */ - PURPLE_MAJOR_VERSION, /* Purple Major Version */ - PURPLE_MINOR_VERSION, /* Purple Minor Version */ - PURPLE_PLUGIN_STANDARD, /* plugin type */ - PIDGIN_PLUGIN_TYPE, /* ui requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - - PLUGIN_ID, /* plugin id */ - NULL, /* name */ - "0.1", /* version */ - NULL, /* summary */ - NULL, /* description */ - PLUGIN_AUTHOR, /* author */ - "http://pidgin.im", /* website */ - - plugin_load, /* load */ - plugin_unload, /* unload */ - NULL, /* destroy */ - - &ui_info, /* ui_info */ - NULL, /* extra_info */ - NULL, /* prefs_info */ - NULL, /* actions */ - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - NULL, /* reserved 3 */ - NULL /* reserved 4 */ -}; - -static void -init_plugin(PurplePlugin *plugin) { - info.name = "Adium IMs"; - info.summary = "Adium-like IMs with Pidgin"; - info.description = "You can chat in Pidgin using Adium's WebKit view."; - - purple_prefs_add_none("/plugins"); - purple_prefs_add_none("/plugins/gtk"); - purple_prefs_add_none("/plugins/gtk/adiumthemes"); - purple_prefs_add_string("/plugins/gtk/adiumthemes/stylepath", ""); -} - -PURPLE_INIT_PLUGIN(webkit, init_plugin, info) - -- cgit v1.2.1 From aef068eae24236332043f938e188340f779b56a7 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 18 Oct 2011 18:47:48 +0000 Subject: On the way to hiding the PurpleConnection struct. * Added purple_connection_get_flags() and purple_connection_set_flags() * Use purple_connection_ accessor functions. --- ChangeLog.API | 2 + finch/gntconv.c | 2 +- libpurple/account.c | 2 +- libpurple/connection.c | 16 +++++ libpurple/connection.h | 17 +++++ libpurple/conversation.c | 12 ++-- libpurple/protocols/bonjour/bonjour.c | 8 +-- libpurple/protocols/bonjour/bonjour_ft.c | 4 +- libpurple/protocols/gg/gg.c | 2 +- libpurple/protocols/irc/irc.c | 2 +- libpurple/protocols/irc/msgs.c | 2 +- libpurple/protocols/jabber/buddy.c | 12 ++-- libpurple/protocols/jabber/disco.c | 8 ++- libpurple/protocols/jabber/google/gmail.c | 2 +- .../protocols/jabber/google/google_presence.c | 4 +- libpurple/protocols/jabber/jabber.c | 21 +++--- libpurple/protocols/jabber/oob.c | 2 +- libpurple/protocols/jabber/presence.c | 2 +- libpurple/protocols/jabber/roster.c | 14 ++-- libpurple/protocols/jabber/si.c | 6 +- libpurple/protocols/jabber/usermood.c | 4 +- libpurple/protocols/jabber/usertune.c | 4 +- libpurple/protocols/msn/msg.c | 2 +- libpurple/protocols/msn/msn.c | 9 +-- libpurple/protocols/msn/notification.c | 2 +- libpurple/protocols/mxit/login.c | 7 +- libpurple/protocols/myspace/myspace.c | 2 +- libpurple/protocols/myspace/zap.c | 2 +- libpurple/protocols/novell/novell.c | 66 ++++++++--------- libpurple/protocols/null/nullprpl.c | 82 +++++++++++----------- libpurple/protocols/oscar/oscar.c | 17 +++-- libpurple/protocols/sametime/sametime.c | 4 +- libpurple/protocols/silc/buddy.c | 6 +- libpurple/protocols/silc/silc.c | 14 ++-- libpurple/protocols/silc/util.c | 4 +- libpurple/protocols/simple/simple.c | 4 +- libpurple/protocols/yahoo/libymsg.c | 24 +++---- libpurple/protocols/yahoo/yahoo_aliases.c | 8 +-- libpurple/protocols/yahoo/yahoo_doodle.c | 2 +- libpurple/protocols/yahoo/yahoo_filexfer.c | 8 +-- libpurple/protocols/yahoo/yahoo_picture.c | 6 +- libpurple/protocols/zephyr/zephyr.c | 50 ++++++------- libpurple/prpl.c | 8 +-- libpurple/server.c | 28 ++++---- pidgin/gtkblist.c | 47 +++++++------ pidgin/gtkconv.c | 34 ++++----- pidgin/gtkdocklet.c | 6 +- pidgin/gtknotify.c | 2 +- pidgin/gtkpounce.c | 2 +- pidgin/gtkroomlist.c | 4 +- pidgin/gtkutils.c | 8 +-- pidgin/plugins/xmppconsole.c | 4 +- 52 files changed, 331 insertions(+), 279 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index fe0421dd59..c3028ad9f8 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -11,6 +11,8 @@ version 3.0.0 (??/??/????): * purple_conv_chat_cb_is_buddy * purple_conv_chat_cb_get_ui_data * purple_conv_chat_cb_set_ui_data + * purple_connection_get_flags + * purple_connection_set_flags * purple_conversation_get_ui_data * purple_conversation_set_ui_data * purple_notify_searchresult_column_is_visible diff --git a/finch/gntconv.c b/finch/gntconv.c index 4648c5755c..0912fbec54 100644 --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -683,7 +683,7 @@ create_conv_from_userlist(GntWidget *widget, FinchConv *fc) name = gnt_tree_get_selection_data(GNT_TREE(widget)); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_cb_real_name)) realname = prpl_info->get_cb_real_name(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(fc->active_conv)), name); else diff --git a/libpurple/account.c b/libpurple/account.c index 409446b86c..f1628ff69e 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -1591,7 +1591,7 @@ purple_account_request_change_user_info(PurpleAccount *account) purple_request_input(gc, _("Set User Info"), primary, NULL, purple_account_get_user_info(account), TRUE, FALSE, ((gc != NULL) && - (gc->flags & PURPLE_CONNECTION_HTML) ? "html" : NULL), + (purple_connection_get_flags(gc) & PURPLE_CONNECTION_HTML) ? "html" : NULL), _("Save"), G_CALLBACK(set_user_info_cb), _("Cancel"), NULL, account, NULL, NULL, diff --git a/libpurple/connection.c b/libpurple/connection.c index aa65adfeb6..0425836e10 100644 --- a/libpurple/connection.c +++ b/libpurple/connection.c @@ -386,6 +386,14 @@ purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state) } } +void +purple_connection_set_flags(PurpleConnection *gc, PurpleConnectionFlags flags) +{ + g_return_if_fail(gc != NULL); + + gc->flags = flags; +} + void purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account) { @@ -419,6 +427,14 @@ purple_connection_get_state(const PurpleConnection *gc) return gc->state; } +PurpleConnectionFlags +purple_connection_get_flags(const PurpleConnection *gc) +{ + g_return_val_if_fail(gc != NULL, 0); + + return gc->flags; +} + PurpleAccount * purple_connection_get_account(const PurpleConnection *gc) { diff --git a/libpurple/connection.h b/libpurple/connection.h index b3c005c115..684ef244e6 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -280,6 +280,14 @@ extern "C" { */ void purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state); +/** + * Sets the connection flags. + * + * @param gc The connection. + * @param flags The flags. + */ +void purple_connection_set_flags(PurpleConnection *gc, PurpleConnectionFlags flags); + /** * Sets the connection's account. * @@ -313,6 +321,15 @@ void purple_connection_set_protocol_data(PurpleConnection *connection, void *pro */ PurpleConnectionState purple_connection_get_state(const PurpleConnection *gc); +/** + * Returns the connection flags. + * + * @param gc The connection. + * + * @return The connection flags. + */ +PurpleConnectionFlags purple_connection_get_flags(const PurpleConnection *gc); + /** * Returns TRUE if the account is connected, otherwise returns FALSE. * diff --git a/libpurple/conversation.c b/libpurple/conversation.c index f7b018d98b..2d92326573 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -493,7 +493,7 @@ purple_conversation_new(PurpleConversationType type, PurpleAccount *account, conv->data = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); /* copy features from the connection. */ - conv->features = gc->flags; + conv->features = purple_connection_get_flags(gc); if (type == PURPLE_CONV_TYPE_IM) { @@ -1789,7 +1789,7 @@ purple_conv_chat_add_users(PurpleConvChat *chat, GList *users, GList *extra_msgs } } else { PurpleBuddy *buddy; - if ((buddy = purple_find_buddy(gc->account, user)) != NULL) + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL) alias = purple_buddy_get_contact_alias(buddy); } } @@ -1887,7 +1887,7 @@ purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, } } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { PurpleBuddy *buddy; - if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL) + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) new_alias = purple_buddy_get_contact_alias(buddy); } @@ -1936,9 +1936,9 @@ purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { PurpleBuddy *buddy; - if ((buddy = purple_find_buddy(gc->account, old_user)) != NULL) + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), old_user)) != NULL) old_alias = purple_buddy_get_contact_alias(buddy); - if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL) + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) new_alias = purple_buddy_get_contact_alias(buddy); } @@ -2013,7 +2013,7 @@ purple_conv_chat_remove_users(PurpleConvChat *chat, GList *users, const char *re if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { PurpleBuddy *buddy; - if ((buddy = purple_find_buddy(gc->account, user)) != NULL) + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL) alias = purple_buddy_get_contact_alias(buddy); } diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c index f5a591b8ef..c9b9a8ee6a 100644 --- a/libpurple/protocols/bonjour/bonjour.c +++ b/libpurple/protocols/bonjour/bonjour.c @@ -102,7 +102,7 @@ bonjour_login(PurpleAccount *account) } #endif /* _WIN32 */ - gc->flags |= PURPLE_CONNECTION_HTML; + purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML); bd = g_new0(BonjourData, 1); purple_connection_set_protocol_data(gc, bd); @@ -309,7 +309,7 @@ bonjour_status_types(PurpleAccount *account) static void bonjour_convo_closed(PurpleConnection *connection, const char *who) { - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); + PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(connection), who); BonjourBuddy *bb; if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL) @@ -439,7 +439,7 @@ bonjour_do_group_change(PurpleBuddy *buddy, const char *new_group) { static void bonjour_group_buddy(PurpleConnection *connection, const char *who, const char *old_group, const char *new_group) { - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); + PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(connection), who); bonjour_do_group_change(buddy, new_group); @@ -464,7 +464,7 @@ bonjour_rename_group(PurpleConnection *connection, const char *old_name, PurpleG static gboolean bonjour_can_receive_file(PurpleConnection *connection, const char *who) { - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); + PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(connection), who); return (buddy != NULL && purple_buddy_get_protocol_data(buddy) != NULL); } diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index b4f1f90c82..3cc46458ee 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -333,7 +333,7 @@ bonjour_new_xfer(PurpleConnection *gc, const char *who) return NULL; /* Build the file transfer handle */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); xep_xfer = g_new0(XepXfer, 1); purple_xfer_set_protocol_data(xfer, xep_xfer); xep_xfer->data = bd; @@ -592,7 +592,7 @@ bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, cons purple_debug_info("bonjour", "bonjour-xfer-receive.\n"); /* Build the file transfer handle */ - xfer = purple_xfer_new(pc->account, PURPLE_XFER_RECEIVE, from); + xfer = purple_xfer_new(purple_connection_get_account(pc), PURPLE_XFER_RECEIVE, from); xf = g_new0(XepXfer, 1); purple_xfer_set_protocol_data(xfer, xf); xf->data = bd; diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index a2c4087155..4d3ebe2e00 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -420,7 +420,7 @@ static void ggp_callback_register_account_cancel(PurpleConnection *gc, GGPInfo *info = purple_connection_get_protocol_data(gc); GGPToken *token = info->token; - purple_account_disconnect(gc->account); + purple_account_disconnect(purple_connection_get_account(gc)); g_free(token->id); g_free(token->data); diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index b770c73041..b798c12421 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -356,7 +356,7 @@ static void irc_login(PurpleAccount *account) const char *username = purple_account_get_username(account); gc = purple_account_get_connection(account); - gc->flags |= PURPLE_CONNECTION_NO_NEWLINES; + purple_connection_set_flags(gc, PURPLE_CONNECTION_NO_NEWLINES); if (strpbrk(username, " \t\v\r\n") != NULL) { purple_connection_error (gc, diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c index 111da50865..36753893e2 100644 --- a/libpurple/protocols/irc/msgs.c +++ b/libpurple/protocols/irc/msgs.c @@ -92,7 +92,7 @@ static void irc_connected(struct irc_conn *irc, const char *nick) /* If we're away then set our away message */ status = purple_account_get_active_status(irc->account); if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) { - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); prpl_info->set_status(irc->account, status); } diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 52d03ac322..374eba2eb2 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -501,7 +501,7 @@ void jabber_set_info(PurpleConnection *gc, const char *info) vc_node = NULL; } - if ((img = purple_buddy_icons_find_account_icon(gc->account))) { + if ((img = purple_buddy_icons_find_account_icon(purple_connection_get_account(gc)))) { gconstpointer avatar_data; gsize avatar_len; xmlnode *photo, *binval, *type; @@ -642,7 +642,7 @@ void jabber_setup_set_info(PurplePluginAction *action) /* * Get existing, XML-formatted, user info */ - if((user_info = purple_account_get_user_info(gc->account)) != NULL) + if((user_info = purple_account_get_user_info(purple_connection_get_account(gc))) != NULL) x_vc_data = xmlnode_from_str(user_info, -1); /* @@ -1360,7 +1360,7 @@ static void jabber_last_parse(JabberStream *js, const char *from, if (jbr == jabber_buddy_find_resource(jb, NULL)) { - purple_prpl_got_user_idle(js->gc->account, + purple_prpl_got_user_idle(purple_connection_get_account(js->gc), buddy_name, jbr->idle, jbr->idle); } } @@ -2255,10 +2255,10 @@ void jabber_user_search(JabberStream *js, const char *directory) make sure we aren't persisting an old value */ if(js->user_directories && js->user_directories->data && !strcmp(directory, js->user_directories->data)) { - purple_account_set_string(js->gc->account, "user_directory", ""); + purple_account_set_string(purple_connection_get_account(js->gc), "user_directory", ""); } else { - purple_account_set_string(js->gc->account, "user_directory", directory); + purple_account_set_string(purple_connection_get_account(js->gc), "user_directory", directory); } iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:search"); @@ -2273,7 +2273,7 @@ void jabber_user_search_begin(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; JabberStream *js = purple_connection_get_protocol_data(gc); - const char *def_val = purple_account_get_string(js->gc->account, "user_directory", ""); + const char *def_val = purple_account_get_string(purple_connection_get_account(js->gc), "user_directory", ""); if(!*def_val && js->user_directories) def_val = js->user_directories->data; diff --git a/libpurple/protocols/jabber/disco.c b/libpurple/protocols/jabber/disco.c index 236c17fde4..1b5a3deac1 100644 --- a/libpurple/protocols/jabber/disco.c +++ b/libpurple/protocols/jabber/disco.c @@ -387,7 +387,7 @@ jabber_disco_finish_server_info_result_cb(JabberStream *js) } /* If there are manually specified bytestream proxies, query them */ - ft_proxies = purple_account_get_string(js->gc->account, "ft_proxies", NULL); + ft_proxies = purple_account_get_string(purple_connection_get_account(js->gc), "ft_proxies", NULL); if (ft_proxies) { JabberIq *iq; JabberBytestreamsStreamhost *sh; @@ -524,8 +524,10 @@ jabber_disco_server_info_result_cb(JabberStream *js, const char *from, if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) { PurpleConnection *gc = js->gc; js->pep = TRUE; - gc->flags |= PURPLE_CONNECTION_SUPPORT_MOODS | - PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES; + purple_connection_set_flags(gc, + purple_connection_get_flags(gc) + | PURPLE_CONNECTION_SUPPORT_MOODS + | PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES); } if (!category || strcmp(category, "server")) continue; diff --git a/libpurple/protocols/jabber/google/gmail.c b/libpurple/protocols/jabber/google/gmail.c index 5f86b8efac..b5461e8168 100644 --- a/libpurple/protocols/jabber/google/gmail.c +++ b/libpurple/protocols/jabber/google/gmail.c @@ -150,7 +150,7 @@ jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, JabberIq *iq; /* bail if the user isn't interested */ - if (!purple_account_get_check_mail(js->gc->account)) + if (!purple_account_get_check_mail(purple_connection_get_account(js->gc))) return; /* Is this an initial incoming mail notification? If so, send a request for more info */ diff --git a/libpurple/protocols/jabber/google/google_presence.c b/libpurple/protocols/jabber/google/google_presence.c index c5ec55d946..b0095adcd4 100644 --- a/libpurple/protocols/jabber/google/google_presence.c +++ b/libpurple/protocols/jabber/google/google_presence.c @@ -27,12 +27,12 @@ void jabber_google_presence_incoming(JabberStream *js, const char *user, JabberB if (!js->googletalk) return; if (jbr->status && purple_str_has_prefix(jbr->status, "♫ ")) { - purple_prpl_got_user_status(js->gc->account, user, "tune", + purple_prpl_got_user_status(purple_connection_get_account(js->gc), user, "tune", PURPLE_TUNE_TITLE, jbr->status + strlen("♫ "), NULL); g_free(jbr->status); jbr->status = NULL; } else { - purple_prpl_got_user_status_deactive(js->gc->account, user, "tune"); + purple_prpl_got_user_status_deactive(purple_connection_get_account(js->gc), user, "tune"); } } diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 59c1b438d0..594d8fee83 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -852,7 +852,7 @@ static void tls_init(JabberStream *js) { purple_input_remove(js->gc->inpa); js->gc->inpa = 0; - js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, js->fd, + js->gsc = purple_ssl_connect_with_host_fd(purple_connection_get_account(js->gc), js->fd, jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); /* The fd is no longer our concern */ js->fd = -1; @@ -1086,8 +1086,7 @@ jabber_login(PurpleAccount *account) JabberStream *js; PurpleStoredImage *image; - gc->flags |= PURPLE_CONNECTION_HTML | - PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; + purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY); js = jabber_stream_new(account); if (js == NULL) return; @@ -1265,7 +1264,7 @@ jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) cbdata->js->user->node = g_strdup(value); } if(cbdata->js->registration && !strcmp(id, "password")) - purple_account_set_password(cbdata->js->gc->account, value); + purple_account_set_password(purple_connection_get_account(cbdata->js->gc), value); } } } @@ -1274,7 +1273,7 @@ jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) username = g_strdup_printf("%s@%s%s%s", cbdata->js->user->node, cbdata->js->user->domain, cbdata->js->user->resource ? "/" : "", cbdata->js->user->resource ? cbdata->js->user->resource : ""); - purple_account_set_username(cbdata->js->gc->account, username); + purple_account_set_username(purple_connection_get_account(cbdata->js->gc), username); g_free(username); } @@ -1423,7 +1422,7 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type if((node = xmlnode_get_child(query, "name"))) { if(js->registration) field = purple_request_field_string_new("name", _("Name"), - purple_account_get_alias(js->gc->account), FALSE); + purple_account_get_alias(purple_connection_get_account(js->gc)), FALSE); else { char *data = xmlnode_get_data(node); field = purple_request_field_string_new("name", _("Name"), data, FALSE); @@ -1557,8 +1556,8 @@ void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrati PurpleConnection *gc = purple_account_get_connection(account); JabberStream *js; - if(gc->state != PURPLE_CONNECTED) { - if(gc->state != PURPLE_CONNECTING) + if (purple_connection_get_state(gc) != PURPLE_CONNECTED) { + if (purple_connection_get_state(gc) != PURPLE_CONNECTING) jabber_login(account); js = purple_connection_get_protocol_data(gc); js->unregistration = TRUE; @@ -2487,7 +2486,7 @@ jabber_password_change_result_cb(JabberStream *js, const char *from, purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), _("Your password has been changed.")); - purple_account_set_password(js->gc->account, (char *)data); + purple_account_set_password(purple_connection_get_account(js->gc), (char *)data); } else { char *msg = jabber_parse_error(js, packet, NULL); @@ -2742,8 +2741,8 @@ char *jabber_parse_error(JabberStream *js, } else if(xmlnode_get_child(packet, "not-authorized")) { SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); /* Clear the pasword if it isn't being saved */ - if (!purple_account_get_remember_password(js->gc->account)) - purple_account_set_password(js->gc->account, NULL); + if (!purple_account_get_remember_password(purple_connection_get_account(js->gc))) + purple_account_set_password(purple_connection_get_account(js->gc), NULL); text = _("Not Authorized"); } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { text = _("Temporary Authentication Failure"); diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c index bf0cc70b68..61b97a3833 100644 --- a/libpurple/protocols/jabber/oob.c +++ b/libpurple/protocols/jabber/oob.c @@ -218,7 +218,7 @@ void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type, jox->headers = g_string_new(""); jox->iq_id = g_strdup(id); - xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); + xfer = purple_xfer_new(purple_connection_get_account(js->gc), PURPLE_XFER_RECEIVE, from); if (xfer) { purple_xfer_set_protocol_data(xfer, jox); diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c index 9f64e52575..a95bf4bb3f 100644 --- a/libpurple/protocols/jabber/presence.c +++ b/libpurple/protocols/jabber/presence.c @@ -459,7 +459,7 @@ jabber_vcard_parse_avatar(JabberStream *js, const char *from, hash = jabber_calculate_data_hash(data, size, "sha1"); } - purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash); + purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, data, size, hash); g_free(hash); } diff --git a/libpurple/protocols/jabber/roster.c b/libpurple/protocols/jabber/roster.c index 8921526df3..1dd565be35 100644 --- a/libpurple/protocols/jabber/roster.c +++ b/libpurple/protocols/jabber/roster.c @@ -96,7 +96,7 @@ static void remove_purple_buddies(JabberStream *js, const char *jid) { GSList *buddies, *l; - buddies = purple_find_buddies(js->gc->account, jid); + buddies = purple_find_buddies(purple_connection_get_account(js->gc), jid); for(l = buddies; l; l = l->next) purple_blist_remove_buddy(l->data); @@ -110,7 +110,7 @@ static void add_purple_buddy_to_groups(JabberStream *js, const char *jid, GSList *buddies, *l; PurpleAccount *account = purple_connection_get_account(js->gc); - buddies = purple_find_buddies(js->gc->account, jid); + buddies = purple_find_buddies(purple_connection_get_account(js->gc), jid); if(!groups) { if(!buddies) @@ -304,7 +304,7 @@ static void jabber_roster_update(JabberStream *js, const char *name, if (js->currently_parsing_roster_push) return; - if(!(b = purple_find_buddy(js->gc->account, name))) + if(!(b = purple_find_buddy(purple_connection_get_account(js->gc), name))) return; if (groups) { @@ -314,7 +314,7 @@ static void jabber_roster_update(JabberStream *js, const char *name, "groups]: groups: %s\n", name, tmp); g_free(tmp); } else { - GSList *buddies = purple_find_buddies(js->gc->account, name); + GSList *buddies = purple_find_buddies(purple_connection_get_account(js->gc), name); char *tmp; if(!buddies) @@ -413,7 +413,7 @@ void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, } else if(!jb || !(jb->subscription & JABBER_SUB_TO)) { jabber_presence_subscription_set(js, who, "subscribe"); } else if((jbr =jabber_buddy_find_resource(jb, NULL))) { - purple_prpl_got_user_status(gc->account, who, + purple_prpl_got_user_status(purple_connection_get_account(gc), who, jabber_buddy_state_get_status_id(jbr->state), "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL); } @@ -423,7 +423,7 @@ void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, void jabber_roster_alias_change(PurpleConnection *gc, const char *name, const char *alias) { - PurpleBuddy *b = purple_find_buddy(gc->account, name); + PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), name); if(b != NULL) { purple_blist_alias_buddy(b, alias); @@ -446,7 +446,7 @@ void jabber_roster_group_change(PurpleConnection *gc, const char *name, if(!old_group || !new_group || !strcmp(old_group, new_group)) return; - buddies = purple_find_buddies(gc->account, name); + buddies = purple_find_buddies(purple_connection_get_account(gc), name); while(buddies) { b = buddies->data; g = purple_buddy_get_group(b); diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index 87e3e0926c..8afbfdc881 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -1561,7 +1561,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) purple_request_fields(jsx->js->gc, _("Select a Resource"), msg, NULL, fields, _("Send File"), G_CALLBACK(resource_select_ok_cb), _("Cancel"), G_CALLBACK(resource_select_cancel_cb), - jsx->js->gc->account, purple_xfer_get_remote_user(xfer), NULL, xfer); + purple_connection_get_account(jsx->js->gc), purple_xfer_get_remote_user(xfer), NULL, xfer); g_free(msg); } @@ -1617,7 +1617,7 @@ PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who) js = purple_connection_get_protocol_data(gc); - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); if (xfer) { jsx = g_new0(JabberSIXfer, 1); @@ -1743,7 +1743,7 @@ void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, jsx->stream_id = g_strdup(stream_id); jsx->iq_id = g_strdup(id); - xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); + xfer = purple_xfer_new(purple_connection_get_account(js->gc), PURPLE_XFER_RECEIVE, from); g_return_if_fail(xfer != NULL); purple_xfer_set_protocol_data(xfer, jsx); diff --git a/libpurple/protocols/jabber/usermood.c b/libpurple/protocols/jabber/usermood.c index 39138b2c1d..545ce60ec9 100644 --- a/libpurple/protocols/jabber/usermood.c +++ b/libpurple/protocols/jabber/usermood.c @@ -155,12 +155,12 @@ static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) { break; } if (newmood != NULL) { - purple_prpl_got_user_status(js->gc->account, from, "mood", + purple_prpl_got_user_status(purple_connection_get_account(js->gc), from, "mood", PURPLE_MOOD_NAME, newmood, PURPLE_MOOD_COMMENT, moodtext, NULL); } else { - purple_prpl_got_user_status_deactive(js->gc->account, from, "mood"); + purple_prpl_got_user_status_deactive(purple_connection_get_account(js->gc), from, "mood"); } g_free(moodtext); } diff --git a/libpurple/protocols/jabber/usertune.c b/libpurple/protocols/jabber/usertune.c index 3fc5c40f91..99c3ed87d9 100644 --- a/libpurple/protocols/jabber/usertune.c +++ b/libpurple/protocols/jabber/usertune.c @@ -92,7 +92,7 @@ static void jabber_tune_cb(JabberStream *js, const char *from, xmlnode *items) { } if (valid) { - purple_prpl_got_user_status(js->gc->account, from, "tune", + purple_prpl_got_user_status(purple_connection_get_account(js->gc), from, "tune", PURPLE_TUNE_ARTIST, tuneinfodata.artist, PURPLE_TUNE_TITLE, tuneinfodata.title, PURPLE_TUNE_ALBUM, tuneinfodata.album, @@ -100,7 +100,7 @@ static void jabber_tune_cb(JabberStream *js, const char *from, xmlnode *items) { PURPLE_TUNE_TIME, tuneinfodata.time, PURPLE_TUNE_URL, tuneinfodata.url, NULL); } else { - purple_prpl_got_user_status_deactive(js->gc->account, from, "tune"); + purple_prpl_got_user_status_deactive(purple_connection_get_account(js->gc), from, "tune"); } g_free(tuneinfodata.artist); diff --git a/libpurple/protocols/msn/msg.c b/libpurple/protocols/msn/msg.c index 494131a1aa..2b09225393 100644 --- a/libpurple/protocols/msn/msg.c +++ b/libpurple/protocols/msn/msg.c @@ -688,7 +688,7 @@ msn_plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) swboard->flag |= MSN_SB_FLAG_IM; } } - else if (!g_str_equal(passport, purple_account_get_username(gc->account))) + else if (!g_str_equal(passport, purple_account_get_username(purple_connection_get_account(gc)))) { /* Don't im ourselves ... */ serv_got_im(gc, passport, body_final, 0, time(NULL)); diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 050f2d46c3..4f9e9d7a4a 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -881,7 +881,7 @@ msn_new_xfer(PurpleConnection *gc, const char *who) session = purple_connection_get_protocol_data(gc); - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); g_return_val_if_fail(xfer != NULL, NULL); @@ -1354,8 +1354,9 @@ msn_login(PurpleAccount *account) session = msn_session_new(account); purple_connection_set_protocol_data(gc, session); - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | - PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; + purple_connection_set_flags(gc, + PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | + PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY); msn_session_set_login_step(session, MSN_LOGIN_STEP_START); @@ -1526,7 +1527,7 @@ msn_send_im(PurpleConnection *gc, const char *who, const char *message, PurpleMessageFlags flags) { PurpleAccount *account; - PurpleBuddy *buddy = purple_find_buddy(gc->account, who); + PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(gc), who); MsnSession *session; MsnSwitchBoard *swboard; MsnMessage *msg; diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index 6af64aa1ba..0acc084cd0 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -1193,7 +1193,7 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) if (id && strcmp(id, "1")) { PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - who, gc->account); + who, purple_connection_get_account(gc)); if (conv != NULL) { const char *error; if (!strcmp(id, "407")) diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index d156b27952..8c4b34382e 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -69,7 +69,12 @@ static struct MXitSession* mxit_create_object( PurpleAccount* account ) /* configure the connection (reference: "libpurple/connection.h") */ purple_connection_set_protocol_data( con, session ); - con->flags |= PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_SUPPORT_MOODS; + purple_connection_set_flags( con, + PURPLE_CONNECTION_NO_BGCOLOR + | PURPLE_CONNECTION_NO_URLDESC + | PURPLE_CONNECTION_HTML + | PURPLE_CONNECTION_SUPPORT_MOODS + ); /* configure the session (reference: "libpurple/account.h") */ g_strlcpy( session->server, purple_account_get_string( account, MXIT_CONFIG_SERVER_ADDR, DEFAULT_SERVER ), sizeof( session->server ) ); diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index 08dc80f549..b4d80205e7 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -2190,7 +2190,7 @@ msim_login(PurpleAccount *acct) gc = purple_account_get_connection(acct); purple_connection_set_protocol_data(gc, msim_session_new(acct)); - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC; + purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC); /* * Lets wipe out our local list of blocked buddies. We'll get a diff --git a/libpurple/protocols/myspace/zap.c b/libpurple/protocols/myspace/zap.c index ee19ed3666..653b4d9f34 100644 --- a/libpurple/protocols/myspace/zap.c +++ b/libpurple/protocols/myspace/zap.c @@ -135,7 +135,7 @@ msim_send_attention(PurpleConnection *gc, const gchar *username, guint code) session = purple_connection_get_protocol_data(gc); /* Look for this attention type, by the code index given. */ - types = msim_attention_types(gc->account); + types = msim_attention_types(purple_connection_get_account(gc)); attn = (PurpleAttentionType *)g_list_nth_data(types, code); if (!attn) { diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index 067d0fc8d4..45765c9821 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -131,8 +131,8 @@ _login_resp_cb(NMUser * user, NMERR_T ret_code, /* Don't attempt to auto-reconnect if our * password was invalid. */ - if (!purple_account_get_remember_password(gc->account)) - purple_account_set_password(gc->account, NULL); + if (!purple_account_get_remember_password(purple_connection_get_account(gc))) + purple_account_set_password(purple_connection_get_account(gc), NULL); reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; break; default: @@ -741,16 +741,16 @@ _get_details_resp_add_privacy_item(NMUser *user, NMERR_T ret_code, if (allowed) { - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, display_id, TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE); } } else { - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, display_id, TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE); } } @@ -789,10 +789,10 @@ _create_privacy_item_deny_resp_cb(NMUser *user, NMERR_T ret_code, if (display_id) { - if (!g_slist_find_custom(gc->account->deny, + if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, display_id, TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE); } } else { @@ -840,11 +840,11 @@ _create_privacy_item_permit_resp_cb(NMUser *user, NMERR_T ret_code, if (display_id) { - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, display_id, TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE); } } else { @@ -1404,15 +1404,15 @@ _sync_privacy_lists(NMUser *user) /* Set the Purple privacy setting */ if (user->default_deny) { if (user->allow_list == NULL) { - purple_account_set_privacy_type(gc->account, PURPLE_PRIVACY_DENY_ALL); + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_ALL); } else { - purple_account_set_privacy_type(gc->account, PURPLE_PRIVACY_ALLOW_USERS); + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_USERS); } } else { if (user->deny_list == NULL) { - purple_account_set_privacy_type(gc->account, PURPLE_PRIVACY_ALLOW_ALL); + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_ALL); } else { - purple_account_set_privacy_type(gc->account, PURPLE_PRIVACY_DENY_USERS); + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_USERS); } } @@ -1424,9 +1424,9 @@ _sync_privacy_lists(NMUser *user) else name =(char *)node->data; - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, name , TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE); } } @@ -1437,15 +1437,15 @@ _sync_privacy_lists(NMUser *user) else name =(char *)node->data; - if (!g_slist_find_custom(gc->account->deny, + if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, name, TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), name, TRUE); } } /* Remove stuff */ - for (node = gc->account->permit; node; node = node->next) { + for (node = purple_connection_get_account(gc)->permit; node; node = node->next) { dn = nm_lookup_dn(user, (char *)node->data); if (dn != NULL && !g_slist_find_custom(user->allow_list, @@ -1456,13 +1456,13 @@ _sync_privacy_lists(NMUser *user) if (rem_list) { for (node = rem_list; node; node = node->next) { - purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } g_slist_free(rem_list); rem_list = NULL; } - for (node = gc->account->deny; node; node = node->next) { + for (node = purple_connection_get_account(gc)->deny; node; node = node->next) { dn = nm_lookup_dn(user, (char *)node->data); if (dn != NULL && !g_slist_find_custom(user->deny_list, @@ -1473,7 +1473,7 @@ _sync_privacy_lists(NMUser *user) if (rem_list) { for (node = rem_list; node; node = node->next) { - purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } g_slist_free(rem_list); } @@ -3091,7 +3091,7 @@ novell_add_permit(PurpleConnection *gc, const char *who) /* Remove first -- we will add it back in when we get * the okay from the server */ - purple_privacy_permit_remove(gc->account, who, TRUE); + purple_privacy_permit_remove(purple_connection_get_account(gc), who, TRUE); if (nm_user_is_privacy_locked(user)) { _show_privacy_locked_error(gc, user); @@ -3135,7 +3135,7 @@ novell_add_deny(PurpleConnection *gc, const char *who) /* Remove first -- we will add it back in when we get * the okay from the server */ - purple_privacy_deny_remove(gc->account, who, TRUE); + purple_privacy_deny_remove(purple_connection_get_account(gc), who, TRUE); if (nm_user_is_privacy_locked(user)) { _show_privacy_locked_error(gc, user); @@ -3253,7 +3253,7 @@ novell_set_permit_deny(PurpleConnection *gc) return; } - switch (purple_account_get_privacy_type(gc->account)) { + switch (purple_account_get_privacy_type(purple_connection_get_account(gc))) { case PURPLE_PRIVACY_ALLOW_ALL: rc = nm_send_set_privacy_default(user, FALSE, @@ -3309,14 +3309,14 @@ novell_set_permit_deny(PurpleConnection *gc) if (user_record) { name = nm_user_record_get_display_id(user_record); - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, name , TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE); } } } - for (node = gc->account->permit; node; node = node->next) { + for (node = purple_connection_get_account(gc)->permit; node; node = node->next) { name = NULL; dn = nm_lookup_dn(user, (char *)node->data); if (dn) { @@ -3330,7 +3330,7 @@ novell_set_permit_deny(PurpleConnection *gc) g_strdup(dn)); } } else { - purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } } } @@ -3351,14 +3351,14 @@ novell_set_permit_deny(PurpleConnection *gc) if (user_record) { name = nm_user_record_get_display_id(user_record); - if (!g_slist_find_custom(gc->account->deny, + if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, name , TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), name , TRUE); } } } - for (node = gc->account->deny; node; node = node->next) { + for (node = purple_connection_get_account(gc)->deny; node; node = node->next) { name = NULL; dn = nm_lookup_dn(user, (char *)node->data); @@ -3373,7 +3373,7 @@ novell_set_permit_deny(PurpleConnection *gc) g_strdup(name)); } } else { - purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } } diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index 7e968c5cf3..8516f728ab 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -113,7 +113,7 @@ static void call_if_nullprpl(gpointer data, gpointer userdata) { PurpleConnection *gc = (PurpleConnection *)(data); GcFuncData *gcfdata = (GcFuncData *)userdata; - if (!strcmp(purple_account_get_protocol_id(gc->account), NULLPRPL_ID)) + if (!strcmp(purple_account_get_protocol_id(purple_connection_get_account(gc)), NULLPRPL_ID)) gcfdata->fn(gcfdata->from, gc, gcfdata->userdata); } @@ -160,11 +160,11 @@ static void foreach_gc_in_chat(ChatFunc fn, PurpleConnection *from, static void discover_status(PurpleConnection *from, PurpleConnection *to, gpointer userdata) { - const char *from_username = purple_account_get_username(from->account); - const char *to_username = purple_account_get_username(to->account); + const char *from_username = purple_account_get_username(purple_connection_get_account(from)); + const char *to_username = purple_account_get_username(purple_connection_get_account(to)); - if (purple_find_buddy(from->account, to_username)) { - PurpleStatus *status = purple_account_get_active_status(to->account); + if (purple_find_buddy(purple_connection_get_account(from), to_username)) { + PurpleStatus *status = purple_account_get_active_status(purple_connection_get_account(to)); const char *status_id = purple_status_get_id(status); const char *message = purple_status_get_attr_string(status, "message"); @@ -173,7 +173,7 @@ static void discover_status(PurpleConnection *from, PurpleConnection *to, !strcmp(status_id, NULL_STATUS_OFFLINE)) { purple_debug_info("nullprpl", "%s sees that %s is %s: %s\n", from_username, to_username, status_id, message); - purple_prpl_got_user_status(from->account, to_username, status_id, + purple_prpl_got_user_status(purple_connection_get_account(from), to_username, status_id, (message) ? "message" : NULL, message, NULL); } else { purple_debug_error("nullprpl", @@ -186,7 +186,7 @@ static void discover_status(PurpleConnection *from, PurpleConnection *to, static void report_status_change(PurpleConnection *from, PurpleConnection *to, gpointer userdata) { purple_debug_info("nullprpl", "notifying %s that %s changed status\n", - purple_account_get_username(to->account), purple_account_get_username(from->account)); + purple_account_get_username(purple_connection_get_account(to)), purple_account_get_username(purple_connection_get_account(from))); discover_status(to, from, NULL); } @@ -265,7 +265,7 @@ static void nullprpl_tooltip_text(PurpleBuddy *buddy, g_free(msg); if (full) { - const char *user_info = purple_account_get_user_info(gc->account); + const char *user_info = purple_account_get_user_info(purple_connection_get_account(gc)); if (user_info) /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ @@ -413,7 +413,7 @@ static void nullprpl_close(PurpleConnection *gc) static int nullprpl_send_im(PurpleConnection *gc, const char *who, const char *message, PurpleMessageFlags flags) { - const char *from_username = purple_account_get_username(gc->account); + const char *from_username = purple_account_get_username(purple_connection_get_account(gc)); PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND) | PURPLE_MESSAGE_RECV); PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); @@ -423,13 +423,13 @@ static int nullprpl_send_im(PurpleConnection *gc, const char *who, from_username, who, message); /* is the sender blocked by the recipient's privacy settings? */ - if (to_acct && !purple_privacy_check(to_acct, purple_account_get_username(gc->account))) { + if (to_acct && !purple_privacy_check(to_acct, purple_account_get_username(purple_connection_get_account(gc)))) { char *msg = g_strdup_printf( _("Your message was blocked by %s's privacy settings."), who); purple_debug_info("nullprpl", "discarding; %s is blocked by %s's privacy settings\n", from_username, who); - purple_conv_present_error(who, gc->account, msg); + purple_conv_present_error(who, purple_connection_get_account(gc), msg); g_free(msg); return 0; } @@ -461,7 +461,7 @@ static int nullprpl_send_im(PurpleConnection *gc, const char *who, static void nullprpl_set_info(PurpleConnection *gc, const char *info) { purple_debug_info("nullprpl", "setting %s's user info to %s\n", - purple_account_get_username(gc->account), info); + purple_account_get_username(purple_connection_get_account(gc)), info); } static const char *typing_state_to_string(PurpleTypingState typing) { @@ -475,10 +475,10 @@ static const char *typing_state_to_string(PurpleTypingState typing) { static void notify_typing(PurpleConnection *from, PurpleConnection *to, gpointer typing) { - const char *from_username = purple_account_get_username(from->account); + const char *from_username = purple_account_get_username(purple_connection_get_account(from)); const char *action = typing_state_to_string((PurpleTypingState)typing); purple_debug_info("nullprpl", "notifying %s that %s %s\n", - purple_account_get_username(to->account), from_username, action); + purple_account_get_username(purple_connection_get_account(to)), from_username, action); serv_got_typing(to, from_username, @@ -489,7 +489,7 @@ static void notify_typing(PurpleConnection *from, PurpleConnection *to, static unsigned int nullprpl_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState typing) { - purple_debug_info("nullprpl", "%s %s\n", purple_account_get_username(gc->account), + purple_debug_info("nullprpl", "%s %s\n", purple_account_get_username(purple_connection_get_account(gc)), typing_state_to_string(typing)); foreach_nullprpl_gc(notify_typing, gc, (gpointer)typing); return 0; @@ -501,7 +501,7 @@ static void nullprpl_get_info(PurpleConnection *gc, const char *username) { PurpleAccount *acct; purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username, - purple_account_get_username(gc->account)); + purple_account_get_username(purple_connection_get_account(gc))); if (!get_nullprpl_gc(username)) { char *msg = g_strdup_printf(_("%s is not logged in."), username); @@ -538,26 +538,26 @@ static void nullprpl_set_status(PurpleAccount *acct, PurpleStatus *status) { static void nullprpl_set_idle(PurpleConnection *gc, int idletime) { purple_debug_info("nullprpl", "purple reports that %s has been idle for %d seconds\n", - purple_account_get_username(gc->account), idletime); + purple_account_get_username(purple_connection_get_account(gc)), idletime); } static void nullprpl_change_passwd(PurpleConnection *gc, const char *old_pass, const char *new_pass) { purple_debug_info("nullprpl", "%s wants to change their password\n", - purple_account_get_username(gc->account)); + purple_account_get_username(purple_connection_get_account(gc))); } static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { - const char *username = purple_account_get_username(gc->account); + const char *username = purple_account_get_username(purple_connection_get_account(gc)); PurpleConnection *buddy_gc = get_nullprpl_gc(buddy->name); purple_debug_info("nullprpl", "adding %s to %s's buddy list\n", buddy->name, username); if (buddy_gc) { - PurpleAccount *buddy_acct = buddy_gc->account; + PurpleAccount *buddy_acct = purple_connection_get_account(buddy_gc); discover_status(gc, buddy_gc, NULL); @@ -594,7 +594,7 @@ static void nullprpl_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { purple_debug_info("nullprpl", "removing %s from %s's buddy list\n", - buddy->name, purple_account_get_username(gc->account)); + buddy->name, purple_account_get_username(purple_connection_get_account(gc))); } static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, @@ -620,22 +620,22 @@ static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, */ static void nullprpl_add_permit(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s adds %s to their allowed list\n", - purple_account_get_username(gc->account), name); + purple_account_get_username(purple_connection_get_account(gc)), name); } static void nullprpl_add_deny(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s adds %s to their blocked list\n", - purple_account_get_username(gc->account), name); + purple_account_get_username(purple_connection_get_account(gc)), name); } static void nullprpl_rem_permit(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s removes %s from their allowed list\n", - purple_account_get_username(gc->account), name); + purple_account_get_username(purple_connection_get_account(gc)), name); } static void nullprpl_rem_deny(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s removes %s from their blocked list\n", - purple_account_get_username(gc->account), name); + purple_account_get_username(purple_connection_get_account(gc)), name); } static void nullprpl_set_permit_deny(PurpleConnection *gc) { @@ -668,7 +668,7 @@ static void joined_chat(PurpleConvChat *from, PurpleConvChat *to, } static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { - const char *username = purple_account_get_username(gc->account); + const char *username = purple_account_get_username(purple_connection_get_account(gc)); const char *room = g_hash_table_lookup(components, "room"); int chat_id = g_str_hash(room); purple_debug_info("nullprpl", "%s is joining chat room %s\n", username, room); @@ -692,7 +692,7 @@ static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { static void nullprpl_reject_chat(PurpleConnection *gc, GHashTable *components) { const char *invited_by = g_hash_table_lookup(components, "invited_by"); const char *room = g_hash_table_lookup(components, "room"); - const char *username = purple_account_get_username(gc->account); + const char *username = purple_account_get_username(purple_connection_get_account(gc)); PurpleConnection *invited_by_gc = get_nullprpl_gc(invited_by); char *message = g_strdup_printf( "%s %s %s.", @@ -719,7 +719,7 @@ static char *nullprpl_get_chat_name(GHashTable *components) { static void nullprpl_chat_invite(PurpleConnection *gc, int id, const char *message, const char *who) { - const char *username = purple_account_get_username(gc->account); + const char *username = purple_account_get_username(purple_connection_get_account(gc)); PurpleConversation *conv = purple_find_chat(gc, id); const char *room = purple_conversation_get_name(conv); PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); @@ -762,7 +762,7 @@ static void left_chat_room(PurpleConvChat *from, PurpleConvChat *to, static void nullprpl_chat_leave(PurpleConnection *gc, int id) { PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "%s is leaving chat room %s\n", - purple_account_get_username(gc->account), purple_conversation_get_name(conv)); + purple_account_get_username(purple_connection_get_account(gc)), purple_conversation_get_name(conv)); /* tell everyone that we left */ foreach_gc_in_chat(left_chat_room, gc, id, NULL); @@ -821,7 +821,7 @@ static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, const char *message) { - const char *username = purple_account_get_username(gc->account); + const char *username = purple_account_get_username(purple_connection_get_account(gc)); PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "%s receives whisper from %s in chat room %s: %s\n", @@ -846,7 +846,7 @@ static void receive_chat_message(PurpleConvChat *from, PurpleConvChat *to, static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) { - const char *username = purple_account_get_username(gc->account); + const char *username = purple_account_get_username(purple_connection_get_account(gc)); PurpleConversation *conv = purple_find_chat(gc, id); if (conv) { @@ -875,7 +875,7 @@ static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "retrieving %s's info for %s in chat room %s\n", who, - purple_account_get_username(gc->account), purple_conversation_get_name(conv)); + purple_account_get_username(purple_connection_get_account(gc)), purple_conversation_get_name(conv)); nullprpl_get_info(gc, who); } @@ -883,25 +883,25 @@ static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) static void nullprpl_alias_buddy(PurpleConnection *gc, const char *who, const char *alias) { purple_debug_info("nullprpl", "%s sets %s's alias to %s\n", - purple_account_get_username(gc->account), who, alias); + purple_account_get_username(purple_connection_get_account(gc)), who, alias); } static void nullprpl_group_buddy(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group) { purple_debug_info("nullprpl", "%s has moved %s from group %s to group %s\n", - purple_account_get_username(gc->account), who, old_group, new_group); + purple_account_get_username(purple_connection_get_account(gc)), who, old_group, new_group); } static void nullprpl_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) { purple_debug_info("nullprpl", "%s has renamed group %s to %s\n", - purple_account_get_username(gc->account), old_name, group->name); + purple_account_get_username(purple_connection_get_account(gc)), old_name, group->name); } static void nullprpl_convo_closed(PurpleConnection *gc, const char *who) { purple_debug_info("nullprpl", "%s's conversation with %s was closed\n", - purple_account_get_username(gc->account), who); + purple_account_get_username(purple_connection_get_account(gc)), who); } /* normalize a username (e.g. remove whitespace, add default domain, etc.) @@ -915,13 +915,13 @@ static const char *nullprpl_normalize(const PurpleAccount *acct, static void nullprpl_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) { purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n", - purple_account_get_username(gc->account), + purple_account_get_username(purple_connection_get_account(gc)), img ? purple_imgstore_get_filename(img) : "(null)"); } static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { purple_debug_info("nullprpl", "%s has removed group %s\n", - purple_account_get_username(gc->account), group->name); + purple_account_get_username(purple_connection_get_account(gc)), group->name); } @@ -954,7 +954,7 @@ static void nullprpl_set_chat_topic(PurpleConnection *gc, int id, return; purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", - purple_account_get_username(gc->account), purple_conversation_get_name(conv), topic); + purple_account_get_username(purple_connection_get_account(gc)), purple_conversation_get_name(conv), topic); last_topic = purple_conv_chat_get_topic(chat); if ((!topic && !last_topic) || @@ -970,8 +970,8 @@ static gboolean nullprpl_finish_get_roomlist(gpointer roomlist) { } static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { - const char *username = purple_account_get_username(gc->account); - PurpleRoomlist *roomlist = purple_roomlist_new(gc->account); + const char *username = purple_account_get_username(purple_connection_get_account(gc)); + PurpleRoomlist *roomlist = purple_roomlist_new(purple_connection_get_account(gc)); GList *fields = NULL; PurpleRoomlistField *field; GList *chats; diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 112e433f5f..29a57fba89 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -655,6 +655,7 @@ oscar_login(PurpleAccount *account) GList *sorted_handlers; GList *cur; GString *msg = g_string_new(""); + PurpleConnectionFlags flags; gc = purple_account_get_connection(account); od = oscar_data_new(); @@ -740,17 +741,19 @@ oscar_login(PurpleAccount *account) return; } - gc->flags |= PURPLE_CONNECTION_HTML; + flags = PURPLE_CONNECTION_HTML; if (g_str_equal(purple_account_get_protocol_id(account), "prpl-icq")) { od->icq = TRUE; } else { - gc->flags |= PURPLE_CONNECTION_AUTO_RESP; + flags |= PURPLE_CONNECTION_AUTO_RESP; } /* Set this flag based on the protocol_id rather than the username, because that is what's tied to the get_moods prpl callback. */ if (g_str_equal(purple_account_get_protocol_id(account), "prpl-icq")) - gc->flags |= PURPLE_CONNECTION_SUPPORT_MOODS; + flags |= PURPLE_CONNECTION_SUPPORT_MOODS; + + purple_connection_set_flags(gc, flags); od->default_port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT); @@ -1000,7 +1003,7 @@ static int purple_memrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, pos->len = len; pos->modname = g_strdup(modname); - if (purple_proxy_connect(pos->gc, pos->gc->account, "pidgin.im", 80, + if (purple_proxy_connect(pos->gc, purple_connection_get_account(pos->gc), "pidgin.im", 80, straight_to_hell, pos) == NULL) { char buf[256]; @@ -1547,7 +1550,7 @@ static int purple_parse_offgoing(OscarData *od, FlapConnection *conn, FlapFrame purple_prpl_got_user_status(account, info->bn, OSCAR_STATUS_ID_OFFLINE, NULL); purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE); - g_hash_table_remove(od->buddyinfo, purple_normalize(gc->account, info->bn)); + g_hash_table_remove(od->buddyinfo, purple_normalize(purple_connection_get_account(gc), info->bn)); return 1; } @@ -3176,9 +3179,9 @@ oscar_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState stat else { /* Don't send if this turkey is in our deny list */ GSList *list; - for (list=gc->account->deny; (list && oscar_util_name_compare(name, list->data)); list=list->next); + for (list=purple_connection_get_account(gc)->deny; (list && oscar_util_name_compare(name, list->data)); list=list->next); if (!list) { - struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(gc->account, name)); + struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(purple_connection_get_account(gc), name)); if (bi && bi->typingnot) { if (state == PURPLE_TYPING) aim_im_sendmtn(od, 0x0001, name, 0x0002); diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 83bd9db522..fef257ef14 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -2531,7 +2531,7 @@ static void convo_nofeatures(struct mwConversation *conv) { gc = purple_conversation_get_gc(gconv); if(! gc) return; - purple_conversation_set_features(gconv, gc->flags); + purple_conversation_set_features(gconv, purple_connection_get_flags(gc)); } @@ -3701,7 +3701,7 @@ static void mw_prpl_login(PurpleAccount *account) { pd = mwPurplePluginData_new(gc); /* while we do support images, the default is to not offer it */ - gc->flags |= PURPLE_CONNECTION_NO_IMAGES; + purple_connection_set_flags(gc, PURPLE_CONNECTION_NO_IMAGES); user = g_strdup(purple_account_get_username(account)); diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c index 4222d7c3ed..e79b3dde85 100644 --- a/libpurple/protocols/silc/buddy.c +++ b/libpurple/protocols/silc/buddy.c @@ -314,7 +314,7 @@ void silcpurple_buddy_keyagr_request(SilcClient client, a->port = port; purple_request_action(client->application, _("Key Agreement Request"), tmp, - hostname ? tmp2 : NULL, 1, gc->account, client_entry->nickname, + hostname ? tmp2 : NULL, 1, purple_connection_get_account(gc), client_entry->nickname, NULL, a, 2, _("Yes"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb), _("No"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb)); } @@ -457,7 +457,7 @@ silcpurple_buddy_privkey(PurpleConnection *gc, const char *name) _("Set IM Password"), NULL, FALSE, TRUE, NULL, _("OK"), G_CALLBACK(silcpurple_buddy_privkey_cb), _("Cancel"), G_CALLBACK(silcpurple_buddy_privkey_cb), - gc->account, NULL, NULL, p); + purple_connection_get_account(gc), NULL, NULL, p); silc_client_list_free(sg->client, sg->conn, clients); } @@ -686,7 +686,7 @@ void silcpurple_get_info(PurpleConnection *gc, const char *who) if (strlen(who) > 2 && who[0] == '*' && who[1] == '@') nick = who + 2; - b = purple_find_buddy(gc->account, nick); + b = purple_find_buddy(purple_connection_get_account(gc), nick); if (b) { /* See if we have this buddy's public key. If we do use that to search the details. */ diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index 5df9097fe8..58a652f77e 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -1061,7 +1061,7 @@ silcpurple_attrs(PurplePluginAction *action) fields, _("OK"), G_CALLBACK(silcpurple_attrs_cb), _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), - gc->account, NULL, NULL, gc); + purple_connection_get_account(gc), NULL, NULL, gc); } static void @@ -1226,9 +1226,9 @@ silcpurple_create_keypair(PurplePluginAction *action) g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); g_snprintf(pkd, sizeof(pkd) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd2)); + purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd2)); g_snprintf(prd, sizeof(prd) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd2)); + purple_account_get_string(purple_connection_get_account(gc), "private-key", prd2)); fields = purple_request_fields_new(); @@ -1269,7 +1269,7 @@ silcpurple_create_keypair(PurplePluginAction *action) _("Create New SILC Key Pair"), NULL, fields, _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), - gc->account, NULL, NULL, gc); + purple_connection_get_account(gc), NULL, NULL, gc); g_strfreev(u); silc_free(hostname); @@ -1287,7 +1287,7 @@ silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) { char prd[256]; g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); - silc_change_private_key_passphrase(purple_account_get_string(gc->account, + silc_change_private_key_passphrase(purple_account_get_string(purple_connection_get_account(gc), "private-key", prd), old ? old : "", new ? new : ""); } @@ -1555,7 +1555,7 @@ static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, if(args && args[0]) convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], - gc->account); + purple_connection_get_account(gc)); if (convo != NULL) id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); @@ -1593,7 +1593,7 @@ static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, g_free(tmp2); } else buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), purple_account_get_username(gc->account), buf, + purple_conv_chat_write(PURPLE_CONV_CHAT(conv), purple_account_get_username(purple_connection_get_account(gc)), buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); g_free(buf); diff --git a/libpurple/protocols/silc/util.c b/libpurple/protocols/silc/util.c index 5436e1490b..bc52eeed06 100644 --- a/libpurple/protocols/silc/util.c +++ b/libpurple/protocols/silc/util.c @@ -198,9 +198,9 @@ gboolean silcpurple_check_silc_dir(PurpleConnection *gc) g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd)); + purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd)); g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd)); + purple_account_get_string(purple_connection_get_account(gc), "private-key", prd)); if ((g_stat(file_public_key, &st)) == -1) { /* If file doesn't exist */ diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index 45ded930bc..dcda3f6e1d 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -1121,8 +1121,8 @@ gboolean process_register_response(struct simple_account_data *sip, struct sipms if(sip->registerstatus != SIMPLE_REGISTER_RETRY) { purple_debug_info("simple", "REGISTER retries %d\n", sip->registrar.retries); if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { - if (!purple_account_get_remember_password(sip->gc->account)) - purple_account_set_password(sip->gc->account, NULL); + if (!purple_account_get_remember_password(purple_connection_get_account(sip->gc))) + purple_account_set_password(purple_connection_get_account(sip->gc), NULL); purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password")); diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index e55bb9e635..29f40e6b0d 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -337,12 +337,12 @@ static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt) if (!name) break; - b = purple_find_buddy(gc->account, name); + b = purple_find_buddy(purple_connection_get_account(gc), name); if (!cksum || (cksum == -1)) { if (f) yahoo_friend_set_buddy_icon_need_request(f, TRUE); - purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL); + purple_buddy_icons_set_for_user(purple_connection_get_account(gc), name, NULL, 0, NULL); break; } @@ -2180,12 +2180,12 @@ static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) who, (ignore ? "ignoring" : "unignoring")); if (ignore) { - b = purple_find_buddy(gc->account, who); + b = purple_find_buddy(purple_connection_get_account(gc), who); g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the " "user is on your buddy list. Clicking \"Yes\" " "will remove and ignore the buddy."), who); purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, - gc->account, who, NULL, + purple_connection_get_account(gc), who, NULL, b, G_CALLBACK(ignore_buddy), G_CALLBACK(keep_buddy)); @@ -2214,7 +2214,7 @@ static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pk char *msg; char *url = NULL; char *fullmsg; - PurpleAccount *account = gc->account; + PurpleAccount *account = purple_connection_get_account(gc); PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; while (l) { @@ -3245,7 +3245,7 @@ static void yahoo_got_connected(gpointer data, gint source, const gchar *error_m pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, yd->session_id); - yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc)))); + yahoo_packet_hash_str(pkt, 1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc)))); yahoo_packet_send_and_free(pkt, yd); gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); @@ -3272,8 +3272,8 @@ static void yahoo_got_web_connected(gpointer data, gint source, const gchar *err pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, yd->session_id); yahoo_packet_hash(pkt, "sss", 0, - purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), - 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), + purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))), + 1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))), 6, yd->auth); yahoo_packet_send_and_free(pkt, yd); @@ -3678,7 +3678,7 @@ void yahoo_login(PurpleAccount *account) { PurpleUtilFetchUrlData *url_data; purple_connection_set_protocol_data(gc, yd); - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; + purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC); purple_connection_update_progress(gc, _("Connecting"), 1, 2); @@ -4476,7 +4476,7 @@ static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str); /* use whole URL if using HTTP Proxy */ - if ((purple_account_get_proxy_info(gc->account)) && (purple_proxy_info_get_type(purple_account_get_proxy_info(gc->account)) == PURPLE_PROXY_HTTP)) + if ((purple_account_get_proxy_info(purple_connection_get_account(gc))) && (purple_proxy_info_get_type(purple_account_get_proxy_info(purple_connection_get_account(gc))) == PURPLE_PROXY_HTTP)) use_whole_url = TRUE; url_data = purple_util_fetch_url_request( @@ -4612,7 +4612,7 @@ int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, Purpl * * If they have not set an IMVironment, then use the default. */ - wb = purple_whiteboard_get_session(gc->account, who); + wb = purple_whiteboard_get_session(purple_connection_get_account(gc), who); if (wb) yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY); else @@ -5262,7 +5262,7 @@ gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint PurpleConversation *c; c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - username, gc->account); + username, purple_connection_get_account(gc)); g_return_val_if_fail(c != NULL, FALSE); diff --git a/libpurple/protocols/yahoo/yahoo_aliases.c b/libpurple/protocols/yahoo/yahoo_aliases.c index 5856d6395c..c790f156a9 100644 --- a/libpurple/protocols/yahoo/yahoo_aliases.c +++ b/libpurple/protocols/yahoo/yahoo_aliases.c @@ -331,7 +331,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); content = g_strdup_printf("\n" "\n\r\n", - purple_account_get_username(gc->account), + purple_account_get_username(purple_connection_get_account(gc)), who, converted_alias_jp); g_free(converted_alias_jp); g_free(alias_jp); @@ -339,7 +339,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) gchar *escaped_alias = g_markup_escape_text(alias, -1); content = g_strdup_printf("\n" "\n\r\n", - purple_account_get_username(gc->account), + purple_account_get_username(purple_connection_get_account(gc)), who, escaped_alias); g_free(escaped_alias); } @@ -351,7 +351,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); content = g_strdup_printf("\n" "\n\r\n", - purple_account_get_username(gc->account), + purple_account_get_username(purple_connection_get_account(gc)), who, cb->id, converted_alias_jp); g_free(converted_alias_jp); g_free(alias_jp); @@ -359,7 +359,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) gchar *escaped_alias = g_markup_escape_text(alias, -1); content = g_strdup_printf("\n" "\n\r\n", - purple_account_get_username(gc->account), + purple_account_get_username(purple_connection_get_account(gc)), who, cb->id, escaped_alias); g_free(escaped_alias); } diff --git a/libpurple/protocols/yahoo/yahoo_doodle.c b/libpurple/protocols/yahoo/yahoo_doodle.c index dc8e9dff39..972b8f4c5b 100644 --- a/libpurple/protocols/yahoo/yahoo_doodle.c +++ b/libpurple/protocols/yahoo/yahoo_doodle.c @@ -394,7 +394,7 @@ static void yahoo_doodle_command_send_generic(const char *type, /* Make and send an acknowledge (ready) Doodle packet */ pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); yahoo_packet_hash_str(pkt, 49, "IMVIRONMENT"); - yahoo_packet_hash_str(pkt, 1, purple_account_get_username(gc->account)); + yahoo_packet_hash_str(pkt, 1, purple_account_get_username(purple_connection_get_account(gc))); yahoo_packet_hash_str(pkt, 14, message); yahoo_packet_hash_int(pkt, 13, command); yahoo_packet_hash_str(pkt, 5, to); diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index 727c281947..8bb223a9df 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -692,7 +692,7 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) purple_xfer_set_protocol_data(xfer_old, NULL); /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, purple_xfer_get_remote_user(xfer_old)); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_RECEIVE, purple_xfer_get_remote_user(xfer_old)); if (xfer) { @@ -879,7 +879,7 @@ void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt) xfer_data->host, xfer_data->port, xfer_data->path, url); /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_RECEIVE, from); if (xfer == NULL) { g_free(xfer_data); g_return_if_reached(); @@ -935,7 +935,7 @@ PurpleXfer *yahoo_new_xfer(PurpleConnection *gc, const char *who) xfer_data->gc = gc; /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); if (xfer == NULL) { g_free(xfer_data); @@ -1730,7 +1730,7 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) xfer_data->size_list = size_list; /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_RECEIVE, from); if (xfer == NULL) { g_free(xfer_data); diff --git a/libpurple/protocols/yahoo/yahoo_picture.c b/libpurple/protocols/yahoo/yahoo_picture.c index 8a43b59ded..4911486847 100644 --- a/libpurple/protocols/yahoo/yahoo_picture.c +++ b/libpurple/protocols/yahoo/yahoo_picture.c @@ -170,7 +170,7 @@ void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *p } if (who) { - PurpleBuddy *b = purple_find_buddy(gc->account, who); + PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), who); const char *locksum = NULL; /* FIXME: Cleanup this strtol() stuff if possible. */ @@ -251,7 +251,7 @@ void yahoo_process_avatar_update(PurpleConnection *gc, struct yahoo_packet *pkt) yahoo_send_picture_request(gc, who); else if ((avatar == 0) || (avatar == 1)) { YahooFriend *f; - purple_buddy_icons_set_for_user(gc->account, who, NULL, 0, NULL); + purple_buddy_icons_set_for_user(purple_connection_get_account(gc), who, NULL, 0, NULL); if ((f = yahoo_friend_find(gc, who))) yahoo_friend_set_buddy_icon_need_request(f, TRUE); purple_debug_misc("yahoo", "Setting user %s's icon to NULL.\n", who); @@ -536,7 +536,7 @@ static int yahoo_buddy_icon_calculate_checksum(const guchar *data, gsize len) void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) { YahooData *yd = purple_connection_get_protocol_data(gc); - PurpleAccount *account = gc->account; + PurpleAccount *account = purple_connection_get_account(gc); if (img == NULL) { g_free(yd->picture_url); diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index a9c244f5d3..3f8b7e0ae9 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -777,9 +777,9 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) if (ZParseLocations(¬ice, NULL, &nlocs, &user) != ZERR_NONE) return; - if ((b = purple_find_buddy(gc->account, user)) == NULL) { + if ((b = purple_find_buddy(purple_connection_get_account(gc), user)) == NULL) { char* stripped_user = zephyr_strip_local_realm(zephyr,user); - b = purple_find_buddy(gc->account,stripped_user); + b = purple_find_buddy(purple_connection_get_account(gc),stripped_user); g_free(stripped_user); } @@ -815,9 +815,9 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) purple_notify_user_info_destroy(user_info); } else { if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); + purple_prpl_got_user_status(purple_connection_get_account(gc), b ? bname : user, "available", NULL); else - purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); + purple_prpl_got_user_status(purple_connection_get_account(gc), b ? bname : user, "offline", NULL); } g_free(user); @@ -900,7 +900,7 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) } gconv1 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - zt2->name, gc->account); + zt2->name, purple_connection_get_account(gc)); gcc = purple_conversation_get_chat_data(gconv1); #ifndef INET_ADDRSTRLEN #define INET_ADDRSTRLEN 16 @@ -1156,9 +1156,9 @@ static gint check_notify_tzc(gpointer data) gchar *locval; user = tree_child(find_node(newparsetree,"user"),2)->contents; - if ((b = purple_find_buddy(gc->account, user)) == NULL) { + if ((b = purple_find_buddy(purple_connection_get_account(gc), user)) == NULL) { gchar *stripped_user = zephyr_strip_local_realm(zephyr,user); - b = purple_find_buddy(gc->account, stripped_user); + b = purple_find_buddy(purple_connection_get_account(gc), stripped_user); g_free(stripped_user); } locations = find_node(newparsetree,"locations"); @@ -1200,9 +1200,9 @@ static gint check_notify_tzc(gpointer data) purple_notify_user_info_destroy(user_info); } else { if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); + purple_prpl_got_user_status(purple_connection_get_account(gc), b ? bname : user, "available", NULL); else - purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); + purple_prpl_got_user_status(purple_connection_get_account(gc), b ? bname : user, "offline", NULL); } } else if (!g_ascii_strncasecmp(spewtype,"subscribed",10)) { @@ -1521,11 +1521,11 @@ static void process_anyone(PurpleConnection *gc) while (fgets(buff, BUFSIZ, fd)) { strip_comments(buff); if (buff[0]) { - if (!(b = purple_find_buddy(gc->account, buff))) { + if (!(b = purple_find_buddy(purple_connection_get_account(gc), buff))) { char *stripped_user = zephyr_strip_local_realm(zephyr,buff); purple_debug_info("zephyr","stripped_user %s\n",stripped_user); - if (!(b = purple_find_buddy(gc->account,stripped_user))){ - b = purple_buddy_new(gc->account, stripped_user, NULL); + if (!(b = purple_find_buddy(purple_connection_get_account(gc),stripped_user))){ + b = purple_buddy_new(purple_connection_get_account(gc), stripped_user, NULL); purple_blist_add_buddy(b, NULL, g, NULL); } g_free(stripped_user); @@ -1564,14 +1564,14 @@ static void zephyr_login(PurpleAccount * account) gchar *exposure; gc = purple_account_get_connection(account); - read_anyone = purple_account_get_bool(gc->account,"read_anyone",TRUE); - read_zsubs = purple_account_get_bool(gc->account,"read_zsubs",TRUE); - exposure = (gchar *)purple_account_get_string(gc->account, "exposure_level", EXPOSE_REALMVIS); + read_anyone = purple_account_get_bool(purple_connection_get_account(gc),"read_anyone",TRUE); + read_zsubs = purple_account_get_bool(purple_connection_get_account(gc),"read_zsubs",TRUE); + exposure = (gchar *)purple_account_get_string(purple_connection_get_account(gc), "exposure_level", EXPOSE_REALMVIS); #ifdef WIN32 username = purple_account_get_username(account); #endif - gc->flags |= PURPLE_CONNECTION_AUTO_RESP | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; + purple_connection_set_flags(gc, PURPLE_CONNECTION_AUTO_RESP | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC); zephyr = g_new0(zephyr_account, 1); purple_connection_set_protocol_data(gc, zephyr); @@ -1580,13 +1580,13 @@ static void zephyr_login(PurpleAccount * account) /* Make sure that the exposure (visibility) is set to a sane value */ zephyr->exposure=g_strdup(normalize_zephyr_exposure(exposure)); - if (purple_account_get_bool(gc->account,"use_tzc",0)) { + if (purple_account_get_bool(purple_connection_get_account(gc),"use_tzc",0)) { zephyr->connection_type = PURPLE_ZEPHYR_TZC; } else { zephyr->connection_type = PURPLE_ZEPHYR_KRB4; } - zephyr->encoding = (char *)purple_account_get_string(gc->account, "encoding", ZEPHYR_FALLBACK_CHARSET); + zephyr->encoding = (char *)purple_account_get_string(purple_connection_get_account(gc), "encoding", ZEPHYR_FALLBACK_CHARSET); purple_connection_update_progress(gc, _("Connecting"), 0, 8); /* XXX z_call_s should actually try to report the com_err determined error */ @@ -1607,7 +1607,7 @@ static void zephyr_login(PurpleAccount * account) if (pid == 0) { unsigned int i=0; gboolean found_ps = FALSE; - gchar ** tzc_cmd_array = g_strsplit(purple_account_get_string(gc->account,"tzc_command","/usr/bin/tzc -e %s")," ",0); + gchar ** tzc_cmd_array = g_strsplit(purple_account_get_string(purple_connection_get_account(gc),"tzc_command","/usr/bin/tzc -e %s")," ",0); if (close(1) == -1) { exit(-1); } @@ -1779,7 +1779,7 @@ static void zephyr_login(PurpleAccount * account) if ((realm = strchr(username,'@'))) zephyr->realm = g_strdup_printf("%s",realm+1); else { - realm = (gchar *)purple_account_get_string(gc->account,"realm",""); + realm = (gchar *)purple_account_get_string(purple_connection_get_account(gc),"realm",""); if (!*realm) { realm = "local-realm"; } @@ -1816,7 +1816,7 @@ static void zephyr_login(PurpleAccount * account) z_call_s(ZOpenPort(&(zephyr->port)), "Couldn't open port"); z_call_s(ZSetLocation((char *)zephyr->exposure), "Couldn't set location"); - realm = (gchar *)purple_account_get_string(gc->account,"realm",""); + realm = (gchar *)purple_account_get_string(purple_connection_get_account(gc),"realm",""); if (!*realm) { realm = ZGetRealm(); } @@ -1972,10 +1972,10 @@ static void zephyr_close(PurpleConnection * gc) } g_list_free(zephyr->pending_zloc_names); - if (purple_account_get_bool(gc->account, "write_anyone", FALSE)) + if (purple_account_get_bool(purple_connection_get_account(gc), "write_anyone", FALSE)) write_anyone(zephyr); - if (purple_account_get_bool(gc->account, "write_zsubs", FALSE)) + if (purple_account_get_bool(purple_connection_get_account(gc), "write_zsubs", FALSE)) write_zsubs(zephyr); s = zephyr->subscrips; @@ -2047,7 +2047,7 @@ static int zephyr_chat_send(PurpleConnection * gc, int id, const char *im, Purpl sig = zephyr_get_signature(); gconv1 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, zt->name, - gc->account); + purple_connection_get_account(gc)); gcc = purple_conversation_get_chat_data(gconv1); if (!(inst = (char *)purple_conv_chat_get_topic(gcc))) @@ -2576,7 +2576,7 @@ static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *top if (!zt) return; gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, zt->name, - gc->account); + purple_connection_get_account(gc)); gcc = purple_conversation_get_chat_data(gconv); topic_utf8 = zephyr_recv_convert(gc,(gchar *)topic); diff --git a/libpurple/prpl.c b/libpurple/prpl.c index f001daed1a..b366079d47 100644 --- a/libpurple/prpl.c +++ b/libpurple/prpl.c @@ -446,13 +446,13 @@ purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_cod g_return_if_fail(gc != NULL); g_return_if_fail(who != NULL); - prpl = purple_find_prpl(purple_account_get_protocol_id(gc->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_connection_get_account(gc))); send_attention = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention; g_return_if_fail(send_attention != NULL); mtime = time(NULL); - attn = purple_get_attention_type_from_code(gc->account, type_code); + attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code); if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) alias = purple_buddy_get_contact_alias(buddy); @@ -473,7 +473,7 @@ purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_cod if (!send_attention(gc, who, type_code)) return; - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, gc->account, who); + conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, purple_connection_get_account(gc), who); purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, description, flags, mtime); purple_prpl_attention(conv, who, type_code, PURPLE_MESSAGE_SEND, time(NULL)); @@ -492,7 +492,7 @@ got_attention(PurpleConnection *gc, int id, const char *who, guint type_code) mtime = time(NULL); - attn = purple_get_attention_type_from_code(gc->account, type_code); + attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code); /* PURPLE_MESSAGE_NOTIFY is for attention messages. */ flags = PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_RECV; diff --git a/libpurple/server.c b/libpurple/server.c index f4ab43140c..ded5f084ae 100644 --- a/libpurple/server.c +++ b/libpurple/server.c @@ -149,7 +149,7 @@ int serv_send_im(PurpleConnection *gc, const char *name, const char *message, * this only reset lar->sent if we're away AND idle? */ auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); - if((gc->flags & PURPLE_CONNECTION_AUTO_RESP) && + if((purple_connection_get_flags(gc) & PURPLE_CONNECTION_AUTO_RESP) && !purple_presence_is_available(presence) && !purple_strequal(auto_reply_pref, "never")) { @@ -570,7 +570,7 @@ void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, * We should update the conversation window buttons and menu, * if it exists. */ - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, gc->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, purple_connection_get_account(gc)); /* * Make copies of the message and the sender in case plugins want @@ -581,7 +581,7 @@ void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, plugin_return = GPOINTER_TO_INT( purple_signal_emit_return_1(purple_conversations_get_handle(), - "receiving-im-msg", gc->account, + "receiving-im-msg", purple_connection_get_account(gc), &angel, &buffy, conv, &flags)); if (!buffy || !angel || plugin_return) { @@ -593,12 +593,12 @@ void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, name = angel; message = buffy; - purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", gc->account, + purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", purple_connection_get_account(gc), name, message, conv, flags); /* search for conversation again in case it was created by received-im-msg handler */ if (conv == NULL) - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc)); if (conv == NULL) conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); @@ -615,7 +615,7 @@ void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, * - or we're not idle and the 'only auto respond if idle' pref * is set */ - if (gc->flags & PURPLE_CONNECTION_AUTO_RESP) + if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_AUTO_RESP) { PurplePresence *presence; PurpleStatus *status; @@ -688,7 +688,7 @@ void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, PurpleConversation *conv; PurpleConvIm *im = NULL; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc)); if (conv != NULL) { im = PURPLE_CONV_IM(conv); @@ -698,15 +698,15 @@ void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, { case PURPLE_TYPING: purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing", gc->account, name); + "buddy-typing", purple_connection_get_account(gc), name); break; case PURPLE_TYPED: purple_signal_emit(purple_conversations_get_handle(), - "buddy-typed", gc->account, name); + "buddy-typed", purple_connection_get_account(gc), name); break; case PURPLE_NOT_TYPING: purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing-stopped", gc->account, name); + "buddy-typing-stopped", purple_connection_get_account(gc), name); break; } } @@ -720,7 +720,7 @@ void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { PurpleConversation *conv; PurpleConvIm *im; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc)); if (conv != NULL) { im = PURPLE_CONV_IM(conv); @@ -734,7 +734,7 @@ void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { else { purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing-stopped", gc->account, name); + "buddy-typing-stopped", purple_connection_get_account(gc), name); } } @@ -925,7 +925,7 @@ void serv_got_chat_in(PurpleConnection *g, int id, const char *who, plugin_return = GPOINTER_TO_INT( purple_signal_emit_return_1(purple_conversations_get_handle(), - "receiving-chat-msg", g->account, + "receiving-chat-msg", purple_connection_get_account(g), &angel, &buffy, conv, &flags)); if (!buffy || !angel || plugin_return) { @@ -937,7 +937,7 @@ void serv_got_chat_in(PurpleConnection *g, int id, const char *who, who = angel; message = buffy; - purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", g->account, + purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", purple_connection_get_account(g), who, message, conv, flags); purple_conv_chat_write(chat, who, message, flags, mtime); diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 2ae01ffd4c..1011c0168c 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -916,7 +916,7 @@ set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data) gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), GTK_RESPONSE_OK, sensitive); gc = purple_account_get_connection(data->rq_data.account); - prpl_info = (gc != NULL) ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; + prpl_info = (gc != NULL) ? PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)) : NULL; sensitive = (prpl_info != NULL && prpl_info->roomlist_get_list != NULL); gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), 1, sensitive); @@ -940,7 +940,7 @@ chat_account_filter_func(PurpleAccount *account) if (gc == NULL) return FALSE; - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); return (prpl_info->chat_info != NULL); } @@ -1030,6 +1030,7 @@ static void rebuild_chat_entries(PidginChatData *data, const char *default_chat_name) { PurpleConnection *gc; + PurplePluginProtocolInfo *prpl_info; GList *list = NULL, *tmp; GHashTable *defaults = NULL; struct proto_chat_entry *pce; @@ -1038,17 +1039,18 @@ rebuild_chat_entries(PidginChatData *data, const char *default_chat_name) g_return_if_fail(data->rq_data.account != NULL); gc = purple_account_get_connection(data->rq_data.account); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); gtk_container_foreach(GTK_CONTAINER(data->rq_data.vbox), (GtkCallback)gtk_widget_destroy, NULL); g_list_free(data->entries); data->entries = NULL; - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) - list = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc); + if (prpl_info->chat_info != NULL) + list = prpl_info->chat_info(gc); - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) - defaults = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, default_chat_name); + if (prpl_info->chat_info_defaults != NULL) + defaults = prpl_info->chat_info_defaults(gc, default_chat_name); for (tmp = list; tmp; tmp = tmp->next) { @@ -1411,7 +1413,7 @@ pidgin_append_blist_node_proto_menu(GtkWidget *menu, PurpleConnection *gc, PurpleBlistNode *node) { GList *l, *ll; - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if(!prpl_info || !prpl_info->blist_node_menu) return; @@ -2301,7 +2303,7 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, } protocol = - PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account, + PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->list_icon(buddy->account, buddy); str = g_string_new(NULL); @@ -2674,7 +2676,7 @@ static GdkPixbuf *pidgin_blist_get_buddy_icon(PurpleBlistNode *node, } if(account && purple_account_get_connection(account)) { - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_account_get_connection(account)->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(purple_account_get_connection(account))); } #if 0 @@ -3382,7 +3384,7 @@ edit_mood_cb(PurpleConnection *gc, PurpleRequestFields *fields) const char *text; PurpleAccount *account = purple_connection_get_account(gc); - if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES) { + if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES) { PurpleRequestField *text_field; text_field = purple_request_fields_get_field(fields, "text"); text = purple_request_field_string_get_value(text_field); @@ -3398,7 +3400,7 @@ edit_mood_cb(PurpleConnection *gc, PurpleRequestFields *fields) PurpleAccount *account = (PurpleAccount *) accounts->data; PurpleConnection *gc = purple_account_get_connection(account); - if (gc && gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) { + if (gc && (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOODS)) { update_status_with_mood(account, mood, NULL); } } @@ -3433,9 +3435,9 @@ get_global_moods(void) if (purple_account_is_connected(account)) { PurpleConnection *gc = purple_account_get_connection(account); - if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) { + if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOODS) { PurplePluginProtocolInfo *prpl_info = - PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); PurpleMood *mood = NULL; /* PURPLE_CONNECTION_SUPPORT_MOODS would not be set if the prpl doesn't @@ -3493,7 +3495,7 @@ get_global_mood_status(void) PurpleAccount *account = (PurpleAccount *) accounts->data; if (purple_account_is_connected(account) && - (purple_account_get_connection(account)->flags & + (purple_connection_get_flags(purple_account_get_connection(account)) & PURPLE_CONNECTION_SUPPORT_MOODS)) { PurplePresence *presence = purple_account_get_presence(account); PurpleStatus *status = purple_presence_get_status(presence, "mood"); @@ -3528,8 +3530,8 @@ set_mood_cb(GtkWidget *widget, PurpleAccount *account) PurplePresence *presence = purple_account_get_presence(account); PurpleStatus *status = purple_presence_get_status(presence, "mood"); gc = purple_account_get_connection(account); - g_return_if_fail(gc->prpl != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + g_return_if_fail(purple_connection_get_prpl(gc) != NULL); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); current_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME); } else { current_mood = get_global_mood_status(); @@ -3568,7 +3570,7 @@ set_mood_cb(GtkWidget *widget, PurpleAccount *account) purple_request_fields_add_group(fields, g); /* if the connection allows setting a mood message */ - if (gc && (gc->flags & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES)) { + if (gc && (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES)) { g = purple_request_field_group_new(NULL); f = purple_request_field_string_new("text", _("Message (optional)"), NULL, FALSE); @@ -7203,11 +7205,13 @@ pidgin_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, GList *l; PurpleConnection *gc; GtkBox *vbox; + PurplePluginProtocolInfo *prpl_info = NULL; if (account != NULL) { gc = purple_account_get_connection(account); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) { + if (prpl_info->join_chat == NULL) { purple_notify_error(gc, NULL, _("This protocol does not support chat rooms."), NULL); return; } @@ -7215,8 +7219,9 @@ pidgin_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, /* Find an account with chat capabilities */ for (l = purple_connections_get_all(); l != NULL; l = l->next) { gc = (PurpleConnection *)l->data; + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) { + if (prpl_info->join_chat != NULL) { account = purple_connection_get_account(gc); break; } @@ -8081,14 +8086,14 @@ pidgin_blist_update_accounts_menu(void) pidgin_separator(submenu); gc = purple_account_get_connection(account); - plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; + plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? purple_connection_get_prpl(gc) : NULL; prpl_info = plugin ? PURPLE_PLUGIN_PROTOCOL_INFO(plugin) : NULL; if (prpl_info && (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) || PURPLE_PLUGIN_HAS_ACTIONS(plugin))) { if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) && - gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) { + (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOODS)) { if (purple_account_get_status(account, "mood")) { menuitem = gtk_menu_item_new_with_mnemonic(_("Set _Mood...")); diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 18c02ceb9c..ff4a30d249 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -564,7 +564,7 @@ check_for_and_do_command(PurpleConversation *conv) PurpleConnection *gc; if ((gc = purple_conversation_get_gc(conv))) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_SLASH_COMMANDS_NATIVE)) { char *spaceslash; @@ -1512,7 +1512,7 @@ chat_do_im(PidginConversation *gtkconv, const char *who) gc = purple_account_get_connection(account); g_return_if_fail(gc != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && prpl_info->get_cb_real_name) real_who = prpl_info->get_cb_real_name(gc, @@ -1568,7 +1568,7 @@ menu_chat_send_file_cb(GtkWidget *w, PidginConversation *gtkconv) g_return_if_fail(gc != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && prpl_info->get_cb_real_name) real_who = prpl_info->get_cb_real_name(gc, @@ -1649,7 +1649,7 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc PurpleBuddy *buddy = NULL; if (gc != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); /* * If a menu already exists, destroy it before creating a new one, @@ -4069,7 +4069,7 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c gtkchat = gtkconv->u.chat; gc = purple_conversation_get_gc(conv); - if (!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) + if (!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)))) return; tm = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); @@ -4379,7 +4379,7 @@ static void topic_callback(GtkWidget *w, PidginConversation *gtkconv) gc = purple_conversation_get_gc(conv); - if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) + if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)))) return; if(prpl_info->set_chat_topic == NULL) @@ -4522,8 +4522,8 @@ blist_node_aliased_cb(PurpleBlistNode *node, const char *old_alias, PurpleConver gc = purple_conversation_get_gc(conv); g_return_if_fail(gc != NULL); - g_return_if_fail(gc->prpl != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + g_return_if_fail(purple_connection_get_prpl(gc) != NULL); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) return; @@ -4731,7 +4731,7 @@ setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox) { PurpleConversation *conv = gtkconv->active_conv; PurpleConnection *gc = purple_conversation_get_gc(conv); - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) { GtkWidget *hbox, *label; @@ -4780,7 +4780,7 @@ pidgin_conv_userlist_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path, gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_account_get_connection(account)->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(purple_account_get_connection(account))); node = (PurpleBlistNode*)(purple_find_buddy(purple_conversation_get_account(conv), who)); if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) pidgin_blist_draw_tooltip(node, gtkconv->infopane); @@ -5370,7 +5370,7 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, PurpleConversation *c; PurpleAccount *convaccount = purple_conversation_get_account(conv); PurpleConnection *gc = purple_account_get_connection(convaccount); - PurplePluginProtocolInfo *prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; + PurplePluginProtocolInfo *prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)) : NULL; if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { @@ -6865,7 +6865,7 @@ gray_stuff_out(PidginConversation *gtkconv) account = purple_conversation_get_account(conv); if (gc != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (win->menu.send_to != NULL) update_send_to_selection(win); @@ -7929,13 +7929,15 @@ account_signed_off_cb(PurpleConnection *gc, gpointer event) if (PURPLE_CONNECTION_IS_CONNECTED(gc) && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && - purple_conversation_get_account(conv) == gc->account && + purple_conversation_get_account(conv) == purple_connection_get_account(gc) && purple_conversation_get_data(conv, "want-to-rejoin")) { GHashTable *comps = NULL; PurpleChat *chat = purple_blist_find_chat(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); if (chat == NULL) { - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) - comps = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, purple_conversation_get_name(conv)); + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); + + if (prpl_info->chat_info_defaults != NULL) + comps = prpl_info->chat_info_defaults(gc, purple_conversation_get_name(conv)); } else { comps = chat->components; } @@ -9430,7 +9432,7 @@ infopane_entry_activate(PidginConversation *gtkconv) gc = purple_conversation_get_gc(conv); if (gc != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && prpl_info->set_chat_topic == NULL) /* This protocol doesn't support setting the chat room topic */ return FALSE; diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index d60b534de3..7ee5e738dc 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -272,7 +272,7 @@ online_account_supports_chat(void) while(c != NULL) { PurpleConnection *gc = c->data; - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info != NULL && prpl_info->chat_info != NULL) return TRUE; c = c->next; @@ -309,7 +309,7 @@ static void docklet_signed_on_cb(PurpleConnection *gc) { if (!enable_join_chat) { - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) + if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info != NULL) enable_join_chat = TRUE; } docklet_update_status(); @@ -319,7 +319,7 @@ static void docklet_signed_off_cb(PurpleConnection *gc) { if (enable_join_chat) { - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) + if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info != NULL) enable_join_chat = online_account_supports_chat(); } docklet_update_status(); diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 6cde874ae2..c119eb66e4 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -1076,7 +1076,7 @@ pidgin_notify_searchresults(PurpleConnection *gc, const char *title, g_signal_connect_swapped(G_OBJECT(close_button), "clicked", G_CALLBACK(searchresults_close_cb), data); - data->account = gc->account; + data->account = purple_connection_get_account(gc); data->model = model; data->treeview = treeview; data->window = window; diff --git a/pidgin/gtkpounce.c b/pidgin/gtkpounce.c index dbaca6430a..c12dd81ffa 100644 --- a/pidgin/gtkpounce.c +++ b/pidgin/gtkpounce.c @@ -476,7 +476,7 @@ reset_send_msg_entry(PidginPounceDialog *dialog, GtkWidget *dontcare) { PurpleAccount *account = pidgin_account_option_menu_get_selected(dialog->account_menu); gtk_imhtml_setup_entry(GTK_IMHTML(dialog->send_msg_entry), - (account && purple_account_get_connection(account)) ? purple_account_get_connection(account)->flags : PURPLE_CONNECTION_HTML); + (account && purple_account_get_connection(account)) ? purple_connection_get_flags(purple_account_get_connection(account)) : PURPLE_CONNECTION_HTML); } void diff --git a/pidgin/gtkroomlist.c b/pidgin/gtkroomlist.c index 99c91ba0a6..21a3864483 100644 --- a/pidgin/gtkroomlist.c +++ b/pidgin/gtkroomlist.c @@ -233,7 +233,7 @@ static void do_add_room_cb(GtkWidget *w, struct _menu_cb_info *info) PurplePluginProtocolInfo *prpl_info = NULL; if(gc != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if(prpl_info != NULL && prpl_info->roomlist_room_serialize) name = prpl_info->roomlist_room_serialize(info->room); @@ -502,7 +502,7 @@ static gboolean account_filter_func(PurpleAccount *account) PurplePluginProtocolInfo *prpl_info = NULL; if (conn && PURPLE_CONNECTION_IS_CONNECTED(conn)) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(conn->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(conn)); return (prpl_info && prpl_info->roomlist_get_list != NULL); } diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index cd42fc3ed0..487c7b99b1 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -1069,7 +1069,7 @@ void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, return; } - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(conn->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(conn)); if (prpl_info != NULL && prpl_info->get_cb_real_name) who = prpl_info->get_cb_real_name(conn, chat, name); if (prpl_info == NULL || prpl_info->get_cb_info == NULL) { @@ -1195,7 +1195,7 @@ pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts, gc = (PurpleConnection *)l->data; account = purple_connection_get_account(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); } protoname = prpl_info->list_icon(account, NULL); @@ -1237,7 +1237,7 @@ pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts, gc = (PurpleConnection *)l->data; account = purple_connection_get_account(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); } protoname = prpl_info->list_icon(account, NULL); @@ -1649,7 +1649,7 @@ pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char data->account = account; if (gc) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && prpl_info->options & OPT_PROTO_IM_IMAGE) im = TRUE; diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index 717edd49ef..7951593758 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -190,7 +190,7 @@ static void message_send_cb(GtkWidget *widget, gpointer p) gc = console->gc; if (gc) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); gtk_text_buffer_get_start_iter(buffer, &start); @@ -643,7 +643,7 @@ signing_on_cb(PurpleConnection *gc) if (!console) return; - gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), purple_account_get_username(gc->account)); + gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), purple_account_get_username(purple_connection_get_account(gc))); console->accounts = g_list_append(console->accounts, gc); console->count++; -- cgit v1.2.1 From a3febf291c9693e1fefd0afe6a6bd0bd611bd945 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 18 Oct 2011 20:25:41 +0000 Subject: Add a purple_connection_update_last_received() function to update the PurpleConnection->last_received value. --- ChangeLog.API | 1 + libpurple/connection.c | 7 +++++++ libpurple/connection.h | 8 ++++++++ libpurple/protocols/irc/irc.c | 2 +- libpurple/protocols/jabber/jabber.c | 4 ++-- libpurple/protocols/msn/httpconn.c | 2 +- libpurple/protocols/msn/servconn.c | 2 +- libpurple/protocols/oscar/flap_connection.c | 2 +- libpurple/protocols/simple/simple.c | 2 +- libpurple/protocols/yahoo/libymsg.c | 2 +- 10 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index c3028ad9f8..b1f752ba61 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -13,6 +13,7 @@ version 3.0.0 (??/??/????): * purple_conv_chat_cb_set_ui_data * purple_connection_get_flags * purple_connection_set_flags + * purple_connection_update_last_received * purple_conversation_get_ui_data * purple_conversation_set_ui_data * purple_notify_searchresult_column_is_visible diff --git a/libpurple/connection.c b/libpurple/connection.c index 0425836e10..8a67a550e4 100644 --- a/libpurple/connection.c +++ b/libpurple/connection.c @@ -627,6 +627,13 @@ purple_connection_error_is_fatal (PurpleConnectionError reason) } } +void purple_connection_update_last_received(PurpleConnection *gc) +{ + g_return_if_fail(gc != NULL); + + gc->last_received = time(NULL); +} + void purple_connections_disconnect_all(void) { diff --git a/libpurple/connection.h b/libpurple/connection.h index 684ef244e6..4c39653885 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -447,6 +447,14 @@ purple_connection_ssl_error (PurpleConnection *gc, gboolean purple_connection_error_is_fatal (PurpleConnectionError reason); +/** + * Indicate that a packet was received on the connection. + * Set by the prpl to avoid sending unneeded keepalives. + * + * @param gc The connection. + */ +void purple_connection_update_last_received(PurpleConnection *gc); + /*@}*/ /**************************************************************************/ diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index b798c12421..424a77ac53 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -648,7 +648,7 @@ static void read_input(struct irc_conn *irc, int len) PurpleConnection *connection = purple_account_get_connection(irc->account); char *cur, *end; - connection->last_received = time(NULL); + purple_connection_update_last_received(connection); irc->inbufused += len; irc->inbuf[irc->inbufused] = '\0'; diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 594d8fee83..ef1ac51370 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -653,7 +653,7 @@ jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, } while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); buf[len] = '\0'; purple_debug_info("jabber", "Recv (ssl)(%d): %s\n", len, buf); jabber_parser_process(js, buf, len); @@ -687,7 +687,7 @@ jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition) g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); #ifdef HAVE_CYRUS_SASL if (js->sasl_maxbuf > 0) { const char *out; diff --git a/libpurple/protocols/msn/httpconn.c b/libpurple/protocols/msn/httpconn.c index 471b15cdbb..36718342bd 100644 --- a/libpurple/protocols/msn/httpconn.c +++ b/libpurple/protocols/msn/httpconn.c @@ -287,7 +287,7 @@ read_cb(gpointer data, gint source, PurpleInputCondition cond) if (servconn->type == MSN_SERVCONN_NS) { PurpleConnection *gc = purple_account_get_connection(servconn->session->account); - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); } len = read(httpconn->fd, buf, sizeof(buf) - 1); diff --git a/libpurple/protocols/msn/servconn.c b/libpurple/protocols/msn/servconn.c index 0a692fde1f..697134ed57 100644 --- a/libpurple/protocols/msn/servconn.c +++ b/libpurple/protocols/msn/servconn.c @@ -423,7 +423,7 @@ read_cb(gpointer data, gint source, PurpleInputCondition cond) if (servconn->type == MSN_SERVCONN_NS) { PurpleConnection *gc = purple_account_get_connection(servconn->session->account); - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); } len = read(servconn->fd, buf, sizeof(buf) - 1); diff --git a/libpurple/protocols/oscar/flap_connection.c b/libpurple/protocols/oscar/flap_connection.c index c28a20f28c..94663a844a 100644 --- a/libpurple/protocols/oscar/flap_connection.c +++ b/libpurple/protocols/oscar/flap_connection.c @@ -921,7 +921,7 @@ flap_connection_recv(FlapConnection *conn) OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); break; } - conn->od->gc->last_received = time(NULL); + purple_connection_update_last_received(conn->od->gc); /* If we don't even have a complete FLAP header then do nothing */ conn->header_received += read; diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index dcda3f6e1d..706aa646a7 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -1705,7 +1705,7 @@ static void simple_input_cb(gpointer data, gint source, PurpleInputCondition con if(sip->fd == source) sip->fd = -1; return; } - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); conn->inbufused += len; conn->inbuf[conn->inbufused] = '\0'; diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 29f40e6b0d..c7352dda13 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -3155,7 +3155,7 @@ static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) _("Server closed the connection")); return; } - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); memcpy(yd->rxqueue + yd->rxlen, buf, len); yd->rxlen += len; -- cgit v1.2.1 From 75a4397a27f06ff3ebe5933526cc5d3e0b06cfb9 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 18 Oct 2011 20:58:39 +0000 Subject: MXit: Move "inpa" input watcher from PurpleConnection into PurpleConnection->proto_data. --- libpurple/protocols/mxit/login.c | 8 ++++---- libpurple/protocols/mxit/mxit.h | 1 + libpurple/protocols/mxit/protocol.c | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index 8c4b34382e..eaf96828ba 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -176,7 +176,7 @@ static void mxit_cb_connect( gpointer user_data, gint source, const gchar* error session->fd = source; /* start listening on the open connection for messages from the server (reference: "libpurple/eventloop.h") */ - session->con->inpa = purple_input_add( session->fd, PURPLE_INPUT_READ, mxit_cb_rx, session ); + session->inpa = purple_input_add( session->fd, PURPLE_INPUT_READ, mxit_cb_rx, session ); mxit_connected( session ); } @@ -780,9 +780,9 @@ void mxit_reconnect( struct MXitSession* session ) purple_debug_info( MXIT_PLUGIN_ID, "mxit_reconnect\n" ); /* remove the input cb function */ - if ( session->con->inpa ) { - purple_input_remove( session->con->inpa ); - session->con->inpa = 0; + if ( session->inpa ) { + purple_input_remove( session->inpa ); + session->inpa = 0; } /* close existing connection */ diff --git a/libpurple/protocols/mxit/mxit.h b/libpurple/protocols/mxit/mxit.h index 0d2131fbb9..2f4bcebff3 100644 --- a/libpurple/protocols/mxit/mxit.h +++ b/libpurple/protocols/mxit/mxit.h @@ -161,6 +161,7 @@ struct MXitSession { /* libpurple */ PurpleAccount* acc; /* pointer to the libpurple internal account struct */ PurpleConnection* con; /* pointer to the libpurple internal connection struct */ + guint inpa; /* the input watcher */ /* transmit */ struct tx_queue queue; /* transmit packet queue (FIFO mode) */ diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index 697bdf6842..2e0abe8ed2 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -2819,9 +2819,9 @@ void mxit_close_connection( struct MXitSession* session ) } /* remove the input cb function */ - if ( session->con->inpa ) { - purple_input_remove( session->con->inpa ); - session->con->inpa = 0; + if ( session->inpa ) { + purple_input_remove( session->inpa ); + session->inpa = 0; } /* remove HTTP poll timer */ -- cgit v1.2.1 From b813995d9f42676d4742aa3e1804f84713926efa Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 18 Oct 2011 21:02:58 +0000 Subject: Myspace: Move "inpa" input watcher into protocol_data. --- libpurple/protocols/myspace/myspace.c | 8 ++++---- libpurple/protocols/myspace/session.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index b4d80205e7..6295806b47 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -2167,8 +2167,7 @@ msim_connect_cb(gpointer data, gint source, const gchar *error_message) } session->fd = source; - - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, msim_input_cb, gc); + session->inpa = purple_input_add(source, PURPLE_INPUT_READ, msim_input_cb, gc); } /** @@ -2263,8 +2262,9 @@ msim_close(PurpleConnection *gc) purple_connection_set_protocol_data(gc, NULL); - if (session->gc->inpa) { - purple_input_remove(session->gc->inpa); + if (session->inpa) { + purple_input_remove(session->inpa); + session->inpa = 0; } if (session->fd >= 0) { close(session->fd); diff --git a/libpurple/protocols/myspace/session.h b/libpurple/protocols/myspace/session.h index 34e1ba96cd..b8b902e769 100644 --- a/libpurple/protocols/myspace/session.h +++ b/libpurple/protocols/myspace/session.h @@ -38,6 +38,7 @@ typedef struct _MsimSession int privacy_mode; /**< This is a bitmask */ int offline_message_mode; gint fd; /**< File descriptor to/from server */ + guint inpa; /**< The input watcher */ /* TODO: Remove. */ GHashTable *user_lookup_cb; /**< Username -> userid lookup callback */ -- cgit v1.2.1 From 73c8045881e0c175d1dd46488cbfad3ac4a770a4 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 18 Oct 2011 21:11:40 +0000 Subject: IRC: Move the "inpa" input watcher into protocol_data. --- libpurple/protocols/irc/irc.c | 8 +++++--- libpurple/protocols/irc/irc.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index 424a77ac53..1b02c67df6 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -500,7 +500,7 @@ static void irc_login_cb(gpointer data, gint source, const gchar *error_message) irc->fd = source; if (do_login(gc)) { - gc->inpa = purple_input_add(irc->fd, PURPLE_INPUT_READ, irc_input_cb, gc); + irc->inpa = purple_input_add(irc->fd, PURPLE_INPUT_READ, irc_input_cb, gc); } } @@ -526,8 +526,10 @@ static void irc_close(PurpleConnection *gc) if (irc->gsc || (irc->fd >= 0)) irc_cmd_quit(irc, "quit", NULL, NULL); - if (gc->inpa) - purple_input_remove(gc->inpa); + if (irc->inpa) { + purple_input_remove(irc->inpa); + irc->inpa = 0; + } g_free(irc->inbuf); if (irc->gsc) { diff --git a/libpurple/protocols/irc/irc.h b/libpurple/protocols/irc/irc.h index 31d6030176..2a4c417c2a 100644 --- a/libpurple/protocols/irc/irc.h +++ b/libpurple/protocols/irc/irc.h @@ -54,6 +54,7 @@ struct irc_conn { GHashTable *cmds; char *server; int fd; + guint inpa; guint timer; guint who_channel_timer; GHashTable *buddies; -- cgit v1.2.1 From f250d3fb8d42d726af7e89f85b702d68d92b14fe Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 18 Oct 2011 21:17:08 +0000 Subject: Samtime: Move the "inpa" input watcher into protocol_data. --- libpurple/connection.h | 2 +- libpurple/protocols/sametime/sametime.c | 22 +++++++++++----------- libpurple/protocols/silc/silc.c | 2 +- libpurple/protocols/silc/util.c | 6 ++---- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/libpurple/connection.h b/libpurple/connection.h index 4c39653885..06587e4c1e 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -235,7 +235,7 @@ struct _PurpleConnection PurpleAccount *account; /**< The account being connected to. */ char *password; /**< The password used. */ - int inpa; /**< The input watcher. */ + int inpa_; /**< The input watcher. */ GSList *buddy_chats; /**< A list of active chats (#PurpleConversation structs of type diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index fef257ef14..980d1368b8 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -217,6 +217,7 @@ struct mwPurplePluginData { /** socket fd */ int socket; + guint inpa; /* input watcher */ gint outpa; /* like inpa, but the other way */ /** circular buffer for outgoing data */ @@ -449,9 +450,9 @@ static void mw_session_io_close(struct mwSession *session) { pd->socket = 0; } - if(gc->inpa) { - purple_input_remove(gc->inpa); - gc->inpa = 0; + if(pd->inpa) { + purple_input_remove(pd->inpa); + pd->inpa = 0; } } @@ -1760,9 +1761,9 @@ static void read_cb(gpointer data, gint source, PurpleInputCondition cond) { pd->socket = 0; } - if(pd->gc->inpa) { - purple_input_remove(pd->gc->inpa); - pd->gc->inpa = 0; + if(pd->inpa) { + purple_input_remove(pd->inpa); + pd->inpa = 0; } if(! ret) { @@ -1791,7 +1792,6 @@ static void read_cb(gpointer data, gint source, PurpleInputCondition cond) { static void connect_cb(gpointer data, gint source, const gchar *error_message) { struct mwPurplePluginData *pd = data; - PurpleConnection *gc = pd->gc; if(source < 0) { /* connection failed */ @@ -1819,7 +1819,7 @@ static void connect_cb(gpointer data, gint source, const gchar *error_message) { } pd->socket = source; - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, + pd->inpa = purple_input_add(source, PURPLE_INPUT_READ, read_cb, pd); mwSession_start(pd->session); @@ -3794,9 +3794,9 @@ static void mw_prpl_close(PurpleConnection *gc) { purple_connection_set_protocol_data(gc, NULL); /* stop watching the socket */ - if(gc->inpa) { - purple_input_remove(gc->inpa); - gc->inpa = 0; + if(pd->inpa) { + purple_input_remove(pd->inpa); + pd->inpa = 0; } /* clean up the rest */ diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index 58a652f77e..a365fc79e0 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -528,7 +528,7 @@ static void silcpurple_running(SilcClient client, void *context) g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), (char *)purple_account_get_string(account, "private-key", prd), - (gc->password == NULL) ? "" : gc->password, + (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), &sg->public_key, &sg->private_key)) { if (!purple_account_get_password(account)) { purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb), diff --git a/libpurple/protocols/silc/util.c b/libpurple/protocols/silc/util.c index bc52eeed06..3dc6c0118d 100644 --- a/libpurple/protocols/silc/util.c +++ b/libpurple/protocols/silc/util.c @@ -210,8 +210,7 @@ gboolean silcpurple_check_silc_dir(PurpleConnection *gc) SILCPURPLE_DEF_PKCS_LEN, file_public_key, file_private_key, NULL, - (gc->password == NULL) - ? "" : gc->password, + (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), NULL, NULL, FALSE)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to create SILC key pair")); @@ -253,8 +252,7 @@ gboolean silcpurple_check_silc_dir(PurpleConnection *gc) SILCPURPLE_DEF_PKCS_LEN, file_public_key, file_private_key, NULL, - (gc->password == NULL) - ? "" : gc->password, + (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), NULL, NULL, FALSE)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to create SILC key pair")); -- cgit v1.2.1 From b2261e9c0952cac53bda85a7d2cdbe4cea99730b Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 18 Oct 2011 21:20:56 +0000 Subject: Jabber: Move the "inpa" input watcher into protocol_data. --- libpurple/protocols/jabber/jabber.c | 12 +++++++----- libpurple/protocols/jabber/jabber.h | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index ef1ac51370..e88fefb8f7 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -829,7 +829,7 @@ jabber_login_callback(gpointer data, gint source, const gchar *error) jabber_send_raw(js, "", -1); jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); - gc->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); + js->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); } static void @@ -850,8 +850,8 @@ jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, static void tls_init(JabberStream *js) { - purple_input_remove(js->gc->inpa); - js->gc->inpa = 0; + purple_input_remove(js->inpa); + js->inpa = 0; js->gsc = purple_ssl_connect_with_host_fd(purple_connection_get_account(js->gc), js->fd, jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); /* The fd is no longer our concern */ @@ -1603,8 +1603,10 @@ void jabber_close(PurpleConnection *gc) if(js->gsc) { purple_ssl_close(js->gsc); } else if (js->fd > 0) { - if(js->gc->inpa) - purple_input_remove(js->gc->inpa); + if(js->inpa) { + purple_input_remove(js->inpa); + js->inpa = 0; + } close(js->fd); } diff --git a/libpurple/protocols/jabber/jabber.h b/libpurple/protocols/jabber/jabber.h index 543d0af2d8..00bc0a3675 100644 --- a/libpurple/protocols/jabber/jabber.h +++ b/libpurple/protocols/jabber/jabber.h @@ -99,6 +99,7 @@ typedef enum { struct _JabberStream { int fd; + guint inpa; PurpleSrvTxtQueryData *srv_query_data; -- cgit v1.2.1 From ae21f33ecadaf082894de28296929a0a2b30438d Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 18 Oct 2011 21:27:51 +0000 Subject: GG: Move the "inpa" input watcher into protocol_data. --- libpurple/protocols/gg/gg.c | 24 +++++++++++++----------- libpurple/protocols/gg/gg.h | 1 + 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 4d3ebe2e00..189e3cdbe7 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -1974,11 +1974,12 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", info->session->check, info->session->state); - purple_input_remove(gc->inpa); + purple_input_remove(info->inpa); + info->inpa = 0; /** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */ if (info->session->fd >= 0) - gc->inpa = purple_input_add(info->session->fd, + info->inpa = purple_input_add(info->session->fd, (info->session->check == 1) ? PURPLE_INPUT_WRITE : PURPLE_INPUT_READ, ggp_async_login_handler, gc); @@ -1991,8 +1992,8 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition case GG_EVENT_CONN_SUCCESS: { purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); - purple_input_remove(gc->inpa); - gc->inpa = purple_input_add(info->session->fd, + purple_input_remove(info->inpa); + info->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, ggp_callback_recv, gc); @@ -2002,8 +2003,8 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition } break; case GG_EVENT_CONN_FAILED: - purple_input_remove(gc->inpa); - gc->inpa = 0; + purple_input_remove(info->inpa); + info->inpa = 0; purple_debug_info("gg", "Connection failure: %d\n", ev->event.failure); switch (ev->event.failure) { @@ -2365,7 +2366,7 @@ static void ggp_login(PurpleAccount *account) g_free(glp); return; } - gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, + info->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, ggp_async_login_handler, gc); } @@ -2401,13 +2402,14 @@ static void ggp_close(PurpleConnection *gc) ggp_search_destroy(info->searches); g_list_free(info->pending_richtext_messages); g_hash_table_destroy(info->pending_images); - g_free(info); + + if (info->inpa > 0) + purple_input_remove(info->inpa); + purple_connection_set_protocol_data(gc, NULL); + g_free(info); } - if (gc->inpa > 0) - purple_input_remove(gc->inpa); - purple_debug_info("gg", "Connection closed.\n"); } diff --git a/libpurple/protocols/gg/gg.h b/libpurple/protocols/gg/gg.h index 8757de17ca..7d6c0edda3 100644 --- a/libpurple/protocols/gg/gg.h +++ b/libpurple/protocols/gg/gg.h @@ -59,6 +59,7 @@ typedef struct typedef struct { struct gg_session *session; + guint inpa; GGPToken *token; GList *chats; GGPSearches *searches; -- cgit v1.2.1 From 8adc0bd47af6bd20cb5862704afffbd8ef7a162c Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 18 Oct 2011 21:39:25 +0000 Subject: Yahoo: Move the "inpa" input watcher into protocol_data. --- libpurple/protocols/yahoo/libymsg.c | 42 ++++++++++++++++++++----------------- libpurple/protocols/yahoo/libymsg.h | 1 + 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index c7352dda13..617f849906 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -2244,8 +2244,10 @@ static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pk yd->wm = TRUE; if (yd->fd >= 0) close(yd->fd); - if (gc->inpa) - purple_input_remove(gc->inpa); + if (yd->inpa) { + purple_input_remove(yd->inpa); + yd->inpa = 0; + } url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, "Purple/" VERSION, FALSE, -1, yahoo_login_page_cb, gc); if (url_data != NULL) @@ -3248,7 +3250,7 @@ static void yahoo_got_connected(gpointer data, gint source, const gchar *error_m yahoo_packet_hash_str(pkt, 1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc)))); yahoo_packet_send_and_free(pkt, yd); - gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); + yd->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); } #ifdef TRY_WEBMESSENGER_LOGIN @@ -3278,7 +3280,7 @@ static void yahoo_got_web_connected(gpointer data, gint source, const gchar *err yahoo_packet_send_and_free(pkt, yd); g_free(yd->auth); - gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); + yd->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); } static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) @@ -3342,7 +3344,8 @@ static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition c } yd->auth = g_string_free(s, FALSE); - purple_input_remove(gc->inpa); + purple_input_remove(yd->inpa); + yd->inpa = 0; close(source); g_free(yd->rxqueue); yd->rxqueue = NULL; @@ -3359,13 +3362,10 @@ static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition c static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) { - PurpleConnection *gc; - YahooData *yd; + PurpleConnection *gc = data; + YahooData *yd = purple_connection_get_protocol_data(gc); int written, remaining; - gc = data; - yd = purple_connection_get_protocol_data(gc); - remaining = strlen(yd->auth) - yd->auth_written; written = write(source, yd->auth + yd->auth_written, remaining); @@ -3375,9 +3375,10 @@ static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCon gchar *tmp; g_free(yd->auth); yd->auth = NULL; - if (gc->inpa) - purple_input_remove(gc->inpa); - gc->inpa = 0; + if (yd->inpa) { + purple_input_remove(yd->inpa); + yd->inpa = 0; + } tmp = g_strdup_printf(_("Lost connection with %s: %s"), "login.yahoo.com:80", g_strerror(errno)); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); @@ -3393,13 +3394,14 @@ static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCon g_free(yd->auth); yd->auth = NULL; yd->auth_written = 0; - purple_input_remove(gc->inpa); - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); + purple_input_remove(yd->inpa); + yd->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); } static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message) { PurpleConnection *gc = data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (source < 0) { gchar *tmp; @@ -3410,9 +3412,9 @@ static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_mes return; } - if (gc->inpa == 0) + if (yd->inpa == 0) { - gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, + yd->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, yahoo_got_cookies_send_cb, gc); yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE); } @@ -3725,8 +3727,10 @@ void yahoo_close(PurpleConnection *gc) { YahooData *yd = purple_connection_get_protocol_data(gc); GSList *l; - if (gc->inpa) - purple_input_remove(gc->inpa); + if (yd->inpa) { + purple_input_remove(yd->inpa); + yd->inpa = 0; + } while (yd->url_datas) { purple_util_fetch_url_cancel(yd->url_datas->data); diff --git a/libpurple/protocols/yahoo/libymsg.h b/libpurple/protocols/yahoo/libymsg.h index c6962ed4c5..31bfade8d0 100644 --- a/libpurple/protocols/yahoo/libymsg.h +++ b/libpurple/protocols/yahoo/libymsg.h @@ -188,6 +188,7 @@ typedef struct _YahooPersonalDetails { typedef struct { PurpleConnection *gc; int fd; + guint inpa; guchar *rxqueue; int rxlen; PurpleCircBuffer *txbuf; -- cgit v1.2.1 From 45d4a17110dff07e4e87aad04246f39c87aa5c40 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 18 Oct 2011 21:44:25 +0000 Subject: The PurpleConnection->inpa handle is now stored (if needed) within each protocol prpl's protocol_data. --- libpurple/connection.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libpurple/connection.h b/libpurple/connection.h index 06587e4c1e..9ff72d4ed3 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -235,7 +235,6 @@ struct _PurpleConnection PurpleAccount *account; /**< The account being connected to. */ char *password; /**< The password used. */ - int inpa_; /**< The input watcher. */ GSList *buddy_chats; /**< A list of active chats (#PurpleConversation structs of type -- cgit v1.2.1 From 47890507ac11a8eee068228d1d8d04292d7691ca Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Fri, 21 Oct 2011 12:48:30 +0000 Subject: Gadu-Gadu: synchronize internal libgadu with upstream - second encounter. Refs #343 --- libpurple/protocols/gg/lib/common.c | 9 +---- libpurple/protocols/gg/lib/compat.h | 15 +++++++ libpurple/protocols/gg/lib/dcc.c | 7 +--- libpurple/protocols/gg/lib/dcc7.c | 6 --- libpurple/protocols/gg/lib/events.c | 6 --- libpurple/protocols/gg/lib/handlers.c | 8 ---- libpurple/protocols/gg/lib/http.c | 8 ---- libpurple/protocols/gg/lib/libgadu-config.h | 61 +++++++++++++++++------------ libpurple/protocols/gg/lib/libgadu.c | 18 ++------- libpurple/protocols/gg/lib/libgadu.h | 36 ++++++----------- libpurple/protocols/gg/lib/pubdir.c | 2 +- libpurple/protocols/gg/lib/resolver.c | 49 ++++++++++++----------- libpurple/protocols/gg/lib/resolver.h | 4 +- 13 files changed, 97 insertions(+), 132 deletions(-) diff --git a/libpurple/protocols/gg/lib/common.c b/libpurple/protocols/gg/lib/common.c index cd8c0a9146..f44ef5b569 100644 --- a/libpurple/protocols/gg/lib/common.c +++ b/libpurple/protocols/gg/lib/common.c @@ -24,13 +24,8 @@ * * \brief Funkcje wykorzystywane przez różne moduły biblioteki */ -#ifndef _WIN32 -# include -# include -# include -# include -# include -#endif +#include "compat.h" +#include #ifdef sun # include #endif diff --git a/libpurple/protocols/gg/lib/compat.h b/libpurple/protocols/gg/lib/compat.h index 46fe305e71..3c4e64967b 100644 --- a/libpurple/protocols/gg/lib/compat.h +++ b/libpurple/protocols/gg/lib/compat.h @@ -28,6 +28,21 @@ #ifndef __COMPAT_H #define __COMPAT_H +#ifdef _WIN32 +# include +# include +# define EINPROGRESS WSAEINPROGRESS +# define ETIMEDOUT WSAETIMEDOUT +# define ENOTCONN WSAENOTCONN +# define ECONNRESET WSAECONNRESET +#else +# include +# include +# include +# include +# include +#endif + #ifdef sun # define INADDR_NONE ((in_addr_t) 0xffffffff) #endif diff --git a/libpurple/protocols/gg/lib/dcc.c b/libpurple/protocols/gg/lib/dcc.c index 26b5729e47..38a17cec9a 100644 --- a/libpurple/protocols/gg/lib/dcc.c +++ b/libpurple/protocols/gg/lib/dcc.c @@ -26,14 +26,9 @@ * \brief Obsługa połączeń bezpośrednich do wersji Gadu-Gadu 6.x */ +#include "compat.h" #include #include -#ifndef _WIN32 -# include -# include -# include -# include -#endif #ifdef sun # include #endif diff --git a/libpurple/protocols/gg/lib/dcc7.c b/libpurple/protocols/gg/lib/dcc7.c index 195a88ba4c..6d938c7543 100644 --- a/libpurple/protocols/gg/lib/dcc7.c +++ b/libpurple/protocols/gg/lib/dcc7.c @@ -31,12 +31,6 @@ #include #include -#ifndef _WIN32 -# include -# include -# include -# include -#endif #ifdef sun # include #endif diff --git a/libpurple/protocols/gg/lib/events.c b/libpurple/protocols/gg/lib/events.c index d62b055d53..167b16a7e3 100644 --- a/libpurple/protocols/gg/lib/events.c +++ b/libpurple/protocols/gg/lib/events.c @@ -28,12 +28,6 @@ */ #include -#ifndef _WIN32 -# include -# include -# include -# include -#endif #include #include "compat.h" diff --git a/libpurple/protocols/gg/lib/handlers.c b/libpurple/protocols/gg/lib/handlers.c index e41e854db7..b9b4057c1e 100644 --- a/libpurple/protocols/gg/lib/handlers.c +++ b/libpurple/protocols/gg/lib/handlers.c @@ -27,11 +27,6 @@ */ #include -#ifndef _WIN32 -# include -# include -# include -#endif #include #ifdef sun # include @@ -48,9 +43,6 @@ #include "deflate.h" #include -#ifndef _WIN32 -# include -#endif #include #include #include diff --git a/libpurple/protocols/gg/lib/http.c b/libpurple/protocols/gg/lib/http.c index fed244cd70..b35f729f37 100644 --- a/libpurple/protocols/gg/lib/http.c +++ b/libpurple/protocols/gg/lib/http.c @@ -25,11 +25,6 @@ */ #include -#ifndef _WIN32 -# include -# include -# include -#endif #include "compat.h" #include "libgadu.h" @@ -37,9 +32,6 @@ #include #include -#ifndef _WIN32 -# include -#endif #include #include #include diff --git a/libpurple/protocols/gg/lib/libgadu-config.h b/libpurple/protocols/gg/lib/libgadu-config.h index 13bf4cf919..4ca5aea111 100644 --- a/libpurple/protocols/gg/lib/libgadu-config.h +++ b/libpurple/protocols/gg/lib/libgadu-config.h @@ -5,13 +5,33 @@ #ifndef __GG_LIBGADU_CONFIG_H #define __GG_LIBGADU_CONFIG_H -#define GG_LIBGADU_VERSION "1.11.0" - /* Defined if libgadu was compiled for bigendian machine. */ #undef __GG_LIBGADU_BIGENDIAN #ifdef WORDS_BIGENDIAN -#define __GG_LIBGADU_BIGENDIAN -#endif /* WORDS_BIGENDIAN */ +# define __GG_LIBGADU_BIGENDIAN +#endif + +/* Defined if this machine has gethostbyname_r(). */ +#undef GG_CONFIG_HAVE_GETHOSTBYNAME_R + +/* Defined if this machine has _exit(). */ +#define GG_CONFIG_HAVE__EXIT + +/* Defined if libgadu was compiled and linked with fork support. */ +#undef GG_CONFIG_HAVE_FORK +#ifndef _WIN32 +# define GG_CONFIG_HAVE_FORK +#endif + +/* Defined if libgadu was compiled and linked with pthread support. */ +/* We don't like pthreads. */ +#undef __GG_LIBGADU_HAVE_PTHREAD + +/* Defined if this machine has C99-compiliant vsnprintf(). */ +#undef __GG_LIBGADU_HAVE_C99_VSNPRINTF +#ifndef _WIN32 +# define __GG_LIBGADU_HAVE_C99_VSNPRINTF +#endif /* Defined if this machine has va_copy(). */ #define __GG_LIBGADU_HAVE_VA_COPY @@ -22,40 +42,29 @@ /* Defined if this machine supports long long. */ #undef __GG_LIBGADU_HAVE_LONG_LONG #ifdef HAVE_LONG_LONG -#define __GG_LIBGADU_HAVE_LONG_LONG -#endif /* HAVE_LONG_LONG */ - -/* Defined if libgadu was compiled and linked with pthread support. */ -/* We don't like pthreads. */ -#undef __GG_LIBGADU_HAVE_PTHREAD +# define __GG_LIBGADU_HAVE_LONG_LONG +#endif -/* Defined if libgadu was compiled and linked with GnuTLS encryption support. */ +/* Defined if libgadu was compiled and linked with GnuTLS support. */ +#undef GG_CONFIG_HAVE_GNUTLS #ifdef HAVE_GNUTLS # define GG_CONFIG_HAVE_GNUTLS -#else -# undef GG_CONFIG_HAVE_GNUTLS #endif -/* Defined if libgadu was compiled and linked with TLS support. */ +/* Defined if libgadu was compiled and linked with OpenSSL support. */ /* Always undefined in Purple. */ #undef __GG_LIBGADU_HAVE_OPENSSL -/* Include file containing uintXX_t declarations. */ +/* Defined if libgadu was compiled and linked with zlib support. */ +#undef GG_CONFIG_HAVE_ZLIB + +/* Defined if uintX_t types are defined in . */ +#undef GG_CONFIG_HAVE_STDINT_H #if HAVE_STDINT_H -#include +# define GG_CONFIG_HAVE_STDINT_H #endif -/* Defined if this machine has C99-compiliant vsnprintf(). */ -#ifndef _WIN32 -#define __GG_LIBGADU_HAVE_C99_VSNPRINTF -#else -#undef __GG_LIBGADU_HAVE_C99_VSNPRINTF -#endif #define vnsprintf g_vnsprintf -#ifdef _WIN32 -#define random (long) rand #endif - -#endif /* __GG_LIBGADU_CONFIG_H */ diff --git a/libpurple/protocols/gg/lib/libgadu.c b/libpurple/protocols/gg/lib/libgadu.c index d7744bb317..b46e046884 100644 --- a/libpurple/protocols/gg/lib/libgadu.c +++ b/libpurple/protocols/gg/lib/libgadu.c @@ -29,16 +29,6 @@ */ #include -#ifdef _WIN32 -# include -# include -# include -# define SHUT_RDWR SD_BOTH -#else -# include -# include -# include -#endif #ifdef sun # include #endif @@ -54,10 +44,7 @@ #include "message.h" #include "deflate.h" -#ifndef _WIN32 -# include /* on Win32 this is included above */ -# include -#endif +#include #include #include #include @@ -73,6 +60,8 @@ # include #endif +#define GG_LIBGADU_VERSION "1.11.0" + /** * Port gniazda nasłuchującego dla połączeń bezpośrednich. * @@ -1119,7 +1108,6 @@ void gg_logoff(struct gg_session *sess) sess->resolver_cleanup(&sess->resolver, 1); if (sess->fd != -1) { - shutdown(sess->fd, SHUT_RDWR); close(sess->fd); sess->fd = -1; } diff --git a/libpurple/protocols/gg/lib/libgadu.h b/libpurple/protocols/gg/lib/libgadu.h index c6b8f1810d..c9f4f3e0c2 100644 --- a/libpurple/protocols/gg/lib/libgadu.h +++ b/libpurple/protocols/gg/lib/libgadu.h @@ -33,7 +33,7 @@ #ifndef __GG_LIBGADU_H #define __GG_LIBGADU_H -#ifdef _WIN32 +#if defined(__cplusplus) || defined(_WIN32) #pragma pack(push, 1) #endif @@ -53,6 +53,12 @@ extern "C" { /* Defined if this machine has gethostbyname_r(). */ #undef GG_CONFIG_HAVE_GETHOSTBYNAME_R +/* Defined if this machine has _exit(). */ +#undef GG_CONFIG_HAVE__EXIT + +/* Defined if libgadu was compiled and linked with fork support. */ +#undef GG_CONFIG_HAVE_FORK + /* Defined if libgadu was compiled and linked with pthread support. */ #undef GG_CONFIG_HAVE_PTHREAD @@ -95,11 +101,7 @@ extern "C" { /* Defined if uintX_t types are defined in . */ #undef GG_CONFIG_HAVE_SYS_TYPES_H -#ifdef _WIN32 -# undef GG_CONFIG_HAVE_FORK -#else -# define GG_CONFIG_HAVE_FORK -#endif +#include "libgadu-config.h" #ifdef GG_CONFIG_HAVE_OPENSSL #include @@ -121,24 +123,12 @@ extern "C" { # include # else -#ifndef __AC_STDINT_H -#define __AC_STDINT_H - /* ISO C 9X: 7.18 Integer types */ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; -#if !defined(__CYGWIN__) && !defined(__SunOS) && !defined(_INCLUDE_HPUX_SOURCE) -#define __int8_t_defined -typedef signed char int8_t; -typedef signed short int16_t; -typedef signed int int32_t; -#endif - -#endif /* __AC_STDINT_H */ - # endif # endif # endif @@ -2302,17 +2292,15 @@ struct gg_dcc7_dunno1 { #define GG_DCC7_TIMEOUT_FILE_ACK 300 /* 5 minut */ #define GG_DCC7_TIMEOUT_VOICE_ACK 300 /* 5 minut */ -#ifdef _WIN32 -#pragma pack(pop) -#endif - #ifdef __cplusplus } #endif -#endif /* __GG_LIBGADU_H */ +#if defined(__cplusplus) || defined(_WIN32) +#pragma pack(pop) +#endif -#include "libgadu-config.h" +#endif /* __GG_LIBGADU_H */ /* * Local variables: diff --git a/libpurple/protocols/gg/lib/pubdir.c b/libpurple/protocols/gg/lib/pubdir.c index 04f3f0a9a5..e0f2b2b590 100644 --- a/libpurple/protocols/gg/lib/pubdir.c +++ b/libpurple/protocols/gg/lib/pubdir.c @@ -193,7 +193,7 @@ struct gg_http *gg_unregister3(uin_t uin, const char *password, const char *toke return NULL; } - __pwd = gg_saprintf("%ld", random()); + __pwd = gg_saprintf("%d", rand()); __fmpwd = gg_urlencode(password); __tokenid = gg_urlencode(tokenid); __tokenval = gg_urlencode(tokenval); diff --git a/libpurple/protocols/gg/lib/resolver.c b/libpurple/protocols/gg/lib/resolver.c index ca68d1e27a..f1f6b14258 100644 --- a/libpurple/protocols/gg/lib/resolver.c +++ b/libpurple/protocols/gg/lib/resolver.c @@ -26,25 +26,21 @@ * \brief Funkcje rozwiązywania nazw */ -#ifndef _WIN32 -# include -# include -#endif #include #include #include #include -#ifndef _WIN32 -# include -# include -# include -#endif #include "libgadu.h" #include "resolver.h" #include "compat.h" #include "session.h" +#ifdef GG_CONFIG_HAVE_FORK +#include +#include +#endif + /** Sposób rozwiązywania nazw serwerów */ static gg_resolver_t gg_global_resolver_type = GG_RESOLVER_DEFAULT; @@ -249,6 +245,7 @@ int gg_gethostbyname_real(const char *hostname, struct in_addr **result, int *co } #if defined(GG_CONFIG_HAVE_PTHREAD) || defined(GG_CONFIG_HAVE_FORK) + /** * \internal Rozwiązuje nazwę i zapisuje wynik do podanego desktyptora. * @@ -286,7 +283,8 @@ static int gg_resolver_run(int fd, const char *hostname) return res; } -#endif + +#endif /* GG_CONFIG_HAVE_PTHREAD || GG_CONFIG_HAVE_FORK */ /** * \internal Odpowiednik \c gethostbyname zapewniający współbieżność. @@ -311,6 +309,8 @@ struct in_addr *gg_gethostbyname(const char *hostname) return result; } +#ifdef GG_CONFIG_HAVE_FORK + /** * \internal Struktura przekazywana do wątku rozwiązującego nazwę. */ @@ -318,7 +318,6 @@ struct gg_resolver_fork_data { int pid; /*< Identyfikator procesu */ }; -#ifdef GG_CONFIG_HAVE_FORK /** * \internal Rozwiązuje nazwę serwera w osobnym procesie. * @@ -370,12 +369,17 @@ static int gg_resolver_fork_start(int *fd, void **priv_data, const char *hostnam } if (data->pid == 0) { + int status; + close(pipes[0]); - if (gg_resolver_run(pipes[1], hostname) == -1) - _exit(1); - else - _exit(0); + status = (gg_resolver_run(pipes[1], hostname) == -1) ? 1 : 0; + +#ifdef GG_CONFIG_HAVE__EXIT + _exit(status); +#else + exit(status); +#endif } close(pipes[1]); @@ -424,7 +428,8 @@ static void gg_resolver_fork_cleanup(void **priv_data, int force) free(data); } -#endif + +#endif /* GG_CONFIG_HAVE_FORK */ #ifdef GG_CONFIG_HAVE_PTHREAD @@ -594,10 +599,10 @@ int gg_session_set_resolver(struct gg_session *gs, gg_resolver_t type) return 0; } -#if !defined(GG_CONFIG_HAVE_PTHREAD) || !defined(GG_CONFIG_PTHREAD_DEFAULT) - type = GG_RESOLVER_FORK; -#else +#if defined(GG_CONFIG_HAVE_PTHREAD) && defined(GG_CONFIG_PTHREAD_DEFAULT) type = GG_RESOLVER_PTHREAD; +#elif defined(GG_CONFIG_HAVE_FORK) + type = GG_RESOLVER_FORK; #endif } @@ -705,10 +710,10 @@ int gg_http_set_resolver(struct gg_http *gh, gg_resolver_t type) return 0; } -#if !defined(GG_CONFIG_HAVE_PTHREAD) || !defined(GG_CONFIG_PTHREAD_DEFAULT) - type = GG_RESOLVER_FORK; -#else +#if defined(GG_CONFIG_HAVE_PTHREAD) && defined(GG_CONFIG_PTHREAD_DEFAULT) type = GG_RESOLVER_PTHREAD; +#elif defined(GG_CONFIG_HAVE_FORK) + type = GG_RESOLVER_FORK; #endif } diff --git a/libpurple/protocols/gg/lib/resolver.h b/libpurple/protocols/gg/lib/resolver.h index 80a1adec90..09b230cec8 100644 --- a/libpurple/protocols/gg/lib/resolver.h +++ b/libpurple/protocols/gg/lib/resolver.h @@ -19,9 +19,7 @@ #ifndef LIBGADU_RESOLVER_H #define LIBGADU_RESOLVER_H -#ifndef _WIN32 -# include -#endif +#include "compat.h" int gg_gethostbyname_real(const char *hostname, struct in_addr **result, int *count, int pthread); -- cgit v1.2.1 From b5156f049c6ffe659deaaadf245ec3ae2d8bdb8d Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 21 Oct 2011 20:39:29 +0000 Subject: Hide struct _PurpleConvMessage. --- ChangeLog.API | 3 +++ libpurple/conversation.c | 33 +++++++++++++++++++++++++++++---- libpurple/conversation.h | 39 ++++++++++++++++++++++----------------- pidgin/gtkconv.c | 24 ++++++++++++++++++------ 4 files changed, 72 insertions(+), 27 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index b1f752ba61..9ff621ec28 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -16,6 +16,8 @@ version 3.0.0 (??/??/????): * purple_connection_update_last_received * purple_conversation_get_ui_data * purple_conversation_set_ui_data + * purple_conversation_message_get_alias + * purple_conversation_message_get_conv * purple_notify_searchresult_column_is_visible * purple_notify_searchresult_column_set_visible * purple_notify_user_info_prepend_pair_plaintext @@ -216,6 +218,7 @@ version 3.0.0 (??/??/????): * struct _PurpleConvChat * struct _PurpleConvChatBuddy * struct _PurpleConvIm + * struct _PurpleConvMessage * struct _PurpleMenuAction * struct _PurplePounce * struct _PurpleProxyInfo diff --git a/libpurple/conversation.c b/libpurple/conversation.c index 2d92326573..1da993e7fa 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -146,6 +146,19 @@ struct _PurpleConversation GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ }; +/** + * Description of a conversation message + */ +struct _PurpleConvMessage +{ + char *who; + char *what; + PurpleMessageFlags flags; + time_t when; + PurpleConversation *conv; + char *alias; +}; + static GList *conversations = NULL; static GList *ims = NULL; @@ -2438,30 +2451,42 @@ GList *purple_conversation_get_message_history(PurpleConversation *conv) return conv->message_history; } -const char *purple_conversation_message_get_sender(PurpleConvMessage *msg) +const char *purple_conversation_message_get_sender(const PurpleConvMessage *msg) { g_return_val_if_fail(msg, NULL); return msg->who; } -const char *purple_conversation_message_get_message(PurpleConvMessage *msg) +const char *purple_conversation_message_get_message(const PurpleConvMessage *msg) { g_return_val_if_fail(msg, NULL); return msg->what; } -PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg) +PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConvMessage *msg) { g_return_val_if_fail(msg, 0); return msg->flags; } -time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg) +time_t purple_conversation_message_get_timestamp(const PurpleConvMessage *msg) { g_return_val_if_fail(msg, 0); return msg->when; } +const char *purple_conversation_message_get_alias(const PurpleConvMessage *msg) +{ + g_return_val_if_fail(msg, NULL); + return msg->alias; +} + +PurpleConversation *purple_conversation_message_get_conv(const PurpleConvMessage *msg) +{ + g_return_val_if_fail(msg, NULL); + return msg->conv; +} + void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data) { g_return_if_fail(conv != NULL); diff --git a/libpurple/conversation.h b/libpurple/conversation.h index bf785965c8..3b2785a600 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -249,19 +249,6 @@ struct _PurpleConversationUiOps void (*_purple_reserved4)(void); }; -/** - * Description of a conversation message - */ -struct _PurpleConvMessage -{ - char *who; - char *what; - PurpleMessageFlags flags; - time_t when; - PurpleConversation *conv; - char *alias; -}; - #ifdef __cplusplus extern "C" { #endif @@ -660,7 +647,7 @@ void purple_conversation_clear_message_history(PurpleConversation *conv); * * @return The name of the sender of the message */ -const char *purple_conversation_message_get_sender(PurpleConvMessage *msg); +const char *purple_conversation_message_get_sender(const PurpleConvMessage *msg); /** * Get the message from a PurpleConvMessage @@ -669,7 +656,7 @@ const char *purple_conversation_message_get_sender(PurpleConvMessage *msg); * * @return The name of the sender of the message */ -const char *purple_conversation_message_get_message(PurpleConvMessage *msg); +const char *purple_conversation_message_get_message(const PurpleConvMessage *msg); /** * Get the message-flags of a PurpleConvMessage @@ -678,7 +665,7 @@ const char *purple_conversation_message_get_message(PurpleConvMessage *msg); * * @return The message flags */ -PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg); +PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConvMessage *msg); /** * Get the timestamp of a PurpleConvMessage @@ -687,7 +674,25 @@ PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg) * * @return The timestamp of the message */ -time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg); +time_t purple_conversation_message_get_timestamp(const PurpleConvMessage *msg); + +/** + * Get the alias from a PurpleConvMessage + * + * @param msg A PurpleConvMessage + * + * @return The alias of the sender of the message + */ +const char *purple_conversation_message_get_alias(const PurpleConvMessage *msg); + +/** + * Get the conversation associated with the PurpleConvMessage + * + * @param msg A PurpleConvMessage + * + * @return The conversation + */ +PurpleConversation *purple_conversation_message_get_conv(const PurpleConvMessage *msg); /** * Set the UI data associated with this conversation. diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index ff4a30d249..03cef8e80a 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -8081,7 +8081,7 @@ static int message_compare(gconstpointer p1, gconstpointer p2) { const PurpleConvMessage *m1 = p1, *m2 = p2; - return (m1->when > m2->when); + return (purple_conversation_message_get_timestamp(m1) > purple_conversation_message_get_timestamp(m2)); } /* Adds some message history to the gtkconv. This happens in a idle-callback. */ @@ -8097,11 +8097,17 @@ add_message_history_to_gtkconv(gpointer data) gtkconv->attach.timer = 0; while (gtkconv->attach.current && count < 100) { /* XXX: 100 is a random value here */ PurpleConvMessage *msg = gtkconv->attach.current->data; - if (!im && when && when < msg->when) { + if (!im && when && when < purple_conversation_message_get_timestamp(msg)) { gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "

"); g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL); } - pidgin_conv_write_conv(msg->conv, msg->who, msg->alias, msg->what, msg->flags, msg->when); + pidgin_conv_write_conv( + purple_conversation_message_get_conv(msg), + purple_conversation_message_get_sender(msg), + purple_conversation_message_get_alias(msg), + purple_conversation_message_get_message(msg), + purple_conversation_message_get_flags(msg), + purple_conversation_message_get_timestamp(msg)); if (im) { gtkconv->attach.current = g_list_delete_link(gtkconv->attach.current, gtkconv->attach.current); } else { @@ -8124,14 +8130,20 @@ add_message_history_to_gtkconv(gpointer data) GList *history = purple_conversation_get_message_history(conv); for (; history; history = history->next) { PurpleConvMessage *msg = history->data; - if (msg->when > when) + if (purple_conversation_message_get_timestamp(msg) > when) msgs = g_list_prepend(msgs, msg); } } msgs = g_list_sort(msgs, message_compare); for (; msgs; msgs = g_list_delete_link(msgs, msgs)) { PurpleConvMessage *msg = msgs->data; - pidgin_conv_write_conv(msg->conv, msg->who, msg->alias, msg->what, msg->flags, msg->when); + pidgin_conv_write_conv( + purple_conversation_message_get_conv(msg), + purple_conversation_message_get_sender(msg), + purple_conversation_message_get_alias(msg), + purple_conversation_message_get_message(msg), + purple_conversation_message_get_flags(msg), + purple_conversation_message_get_timestamp(msg)); } gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "

"); g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL); @@ -8209,7 +8221,7 @@ gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv) g_return_val_if_reached(TRUE); } g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", - GINT_TO_POINTER(((PurpleConvMessage*)(list->data))->when)); + GINT_TO_POINTER(purple_conversation_message_get_timestamp((PurpleConvMessage*)(list->data)))); gtkconv->attach.timer = g_idle_add(add_message_history_to_gtkconv, gtkconv); } else { purple_signal_emit(pidgin_conversations_get_handle(), -- cgit v1.2.1 From 2e94db515ecc28da9e20b5405590862e6825b3d0 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Fri, 21 Oct 2011 21:29:33 +0000 Subject: Hide struct PurpleNotifySearchColumn. --- ChangeLog.API | 2 ++ finch/gntnotify.c | 2 +- libpurple/notify.c | 17 +++++++++++++++++ libpurple/notify.h | 23 +++++++++++++---------- pidgin/gtknotify.c | 2 +- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 9ff621ec28..e05b489030 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -18,6 +18,7 @@ version 3.0.0 (??/??/????): * purple_conversation_set_ui_data * purple_conversation_message_get_alias * purple_conversation_message_get_conv + * purple_notify_searchresult_column_get_title * purple_notify_searchresult_column_is_visible * purple_notify_searchresult_column_set_visible * purple_notify_user_info_prepend_pair_plaintext @@ -228,6 +229,7 @@ version 3.0.0 (??/??/????): * struct _PurpleRoomlistRoom * struct PurpleAccountOption * struct PurpleAccountUserSplit + * struct PurpleNotifySearchColumn * wpurple_g_access * xmlnode_set_attrib_with_namespace * xmlnode_set_attrib_with_prefix diff --git a/finch/gntnotify.c b/finch/gntnotify.c index 94ed5959e0..8f01243c30 100644 --- a/finch/gntnotify.c +++ b/finch/gntnotify.c @@ -429,7 +429,7 @@ finch_notify_searchresults(PurpleConnection *gc, const char *title, for (iter = results->columns; iter; iter = iter->next) { PurpleNotifySearchColumn *column = iter->data; - gnt_tree_set_column_title(GNT_TREE(tree), i, column->title); + gnt_tree_set_column_title(GNT_TREE(tree), i, purple_notify_searchresult_column_get_title(column)); if (!purple_notify_searchresult_column_is_visible(column)) gnt_tree_set_column_visible(GNT_TREE(tree), i, FALSE); diff --git a/libpurple/notify.c b/libpurple/notify.c index ede75a20e3..288dc8591c 100644 --- a/libpurple/notify.c +++ b/libpurple/notify.c @@ -56,6 +56,16 @@ struct _PurpleNotifyUserInfo GQueue entries; }; +/** + * Single column of a search result. + */ +struct _PurpleNotifySearchColumn +{ + char *title; /**< Title of the column. */ + gboolean visible; /**< Should the column be visible to the user. Defaults to TRUE. */ + +}; + void * purple_notify_message(void *handle, PurpleNotifyMsgType type, const char *title, const char *primary, @@ -368,6 +378,13 @@ purple_notify_searchresults_column_new(const char *title) return sc; } +const char *purple_notify_searchresult_column_get_title(const PurpleNotifySearchColumn *column) +{ + g_return_val_if_fail(column != NULL, NULL); + + return column->title; +} + void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *column, gboolean visible) { g_return_if_fail(column != NULL); diff --git a/libpurple/notify.h b/libpurple/notify.h index 358bf04508..ec4d34968f 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -32,10 +32,13 @@ #include typedef struct _PurpleNotifyUserInfoEntry PurpleNotifyUserInfoEntry; -typedef struct _PurpleNotifyUserInfo PurpleNotifyUserInfo; +typedef struct _PurpleNotifyUserInfo PurpleNotifyUserInfo; +/** @copydoc _PurpleNotifySearchColumn */ +typedef struct _PurpleNotifySearchColumn PurpleNotifySearchColumn; #include "connection.h" + /** * Notification close callbacks. */ @@ -106,15 +109,6 @@ typedef enum PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER } PurpleNotifyUserInfoEntryType; -/** - * Single column of a search result. - */ -typedef struct -{ - char *title; /**< Title of the column. */ - gboolean visible; /**< Should the column be visible to the user. Defaults to TRUE. */ - -} PurpleNotifySearchColumn; /** @@ -276,6 +270,15 @@ PurpleNotifySearchResults *purple_notify_searchresults_new(void); */ PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title); +/** + * Returns the title of the column + * + * @param column The search column object. + * + * @return The title of the column + */ +const char *purple_notify_searchresult_column_get_title(const PurpleNotifySearchColumn *column); + /** * Sets whether or not a search result column is visible. * diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index c119eb66e4..43745029ee 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -1017,7 +1017,7 @@ pidgin_notify_searchresults(PurpleConnection *gc, const char *title, renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, - column->title, renderer, "text", i, NULL); + purple_notify_searchresult_column_get_title(column), renderer, "text", i, NULL); if (!purple_notify_searchresult_column_is_visible(column)) gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i), FALSE); -- cgit v1.2.1 From 783d366437244db8aed78e8ce8a6bdfe573839a9 Mon Sep 17 00:00:00 2001 From: Jochen Kemnade Date: Sat, 22 Oct 2011 10:41:31 +0000 Subject: update German translation --- po/de.po | 343 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 176 insertions(+), 167 deletions(-) diff --git a/po/de.po b/po/de.po index 5c16c146e5..2e9252c952 100644 --- a/po/de.po +++ b/po/de.po @@ -11,9 +11,9 @@ msgid "" msgstr "" "Project-Id-Version: de\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-11 10:27+0200\n" -"PO-Revision-Date: 2011-08-11 10:12+0200\n" -"Last-Translator: Björn Voigt \n" +"POT-Creation-Date: 2011-10-22 12:37+0200\n" +"PO-Revision-Date: 2011-10-22 12:37+0200\n" +"Last-Translator: Jochen Kemnade \n" "Language-Team: German \n" "Language: de\n" "MIME-Version: 1.0\n" @@ -50,17 +50,6 @@ msgstr "" " -n, --nologin nicht automatisch anmelden\n" " -v, --version zeigt aktuelle Version und beendet das Programm\n" -#, c-format -msgid "" -"%s encountered errors migrating your settings from %s to %s. Please " -"investigate and complete the migration by hand. Please report this error at " -"http://developer.pidgin.im" -msgstr "" -"%s ist beim Übertragen Ihrer Einstellungen von %s nach %s auf Fehler " -"gestoßen. Bitte untersuchen Sie das Problem und vervollständigen Sie die " -"Migration per Hand. Bitte melden Sie diesen Fehler auf http://developer." -"pidgin.im" - #. the user did not fill in the captcha msgid "Error" msgstr "Fehler" @@ -213,6 +202,8 @@ msgstr "Das gewählte Konto ist nicht online." msgid "Error adding buddy" msgstr "Fehler beim Hinzufügen des Buddys" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Username" msgstr "Benutzer" @@ -346,7 +337,11 @@ msgstr "Markierung umkehren" msgid "View Log" msgstr "Mitschnitt anzeigen" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. General +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Nickname" msgstr "Spitzname" @@ -800,7 +795,11 @@ msgid "Remaining" msgstr "Verbleibend" #. XXX: Use of ggp_str_to_uin() is an ugly hack! +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext #. presence +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status" msgstr "Status" @@ -914,7 +913,7 @@ msgid "Reject" msgstr "Ablehnen" msgid "Call in progress." -msgstr "Verbindungsaufbau." +msgstr "Anruf im Gange." msgid "The call has been terminated." msgstr "Der Anruf wurde beendet." @@ -1389,6 +1388,8 @@ msgstr "Titel" msgid "Type" msgstr "Typ" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. Statuses are almost all the same. Define a macro to reduce code repetition. #. PurpleStatusPrimitive #. id - use default @@ -1397,6 +1398,8 @@ msgstr "Typ" #. user_settable #. not independent #. Attributes - each status can have a message. +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Message" msgstr "Nachricht" @@ -3025,19 +3028,29 @@ msgid "" msgstr "Keine Verbindung zum lokalen mDNS-Server. Ist er aktiviert?" # old strings +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "First name" msgstr "Vorname" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Last name" msgstr "Nachname" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. email msgid "Email" msgstr "E-Mail" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "AIM Account" msgstr "AIM-Konto" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "XMPP Account" msgstr "XMPP-Konto" @@ -3152,6 +3165,8 @@ msgstr "Registrierung eines neuen Gadu-Gadu-Kontos" msgid "Please, fill in the following fields" msgstr "Bitte füllen Sie die folgenden Felder aus" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "City" msgstr "Stadt" @@ -3159,6 +3174,8 @@ msgid "Year of birth" msgstr "Geburtsjahr" #. gender +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Gender" msgstr "Geschlecht" @@ -3181,20 +3198,26 @@ msgstr "Suche Buddys" msgid "Please, enter your search criteria below" msgstr "Bitte geben Sie Ihre Suchkriterien unten ein" -msgid "Fill in the fields." -msgstr "Füllen Sie die Felder aus." +msgid "Change password for the Gadu-Gadu account" +msgstr "Ändern des Passworts für dieses Gadu-Gadu-Konto" -msgid "Your current password is different from the one that you specified." -msgstr "Ihr aktuelles Passwort ist anders als das angegebene." +msgid "Password was changed successfully!" +msgstr "Das Passwort wurde erfolgreich geändert!" msgid "Unable to change password. Error occurred.\n" msgstr "Konnte das Passwort nicht ändern. Es trat ein Fehler auf.\n" -msgid "Change password for the Gadu-Gadu account" -msgstr "Ändern des Passworts für dieses Gadu-Gadu-Konto" +msgid "Fill in the fields." +msgstr "Füllen Sie die Felder aus." -msgid "Password was changed successfully!" -msgstr "Das Passwort wurde erfolgreich geändert!" +msgid "New password should be at most 15 characters long." +msgstr "Das neue Passwort darf maximal 15 Zeichen lang sein." + +msgid "Your current password is different from the one that you specified." +msgstr "Ihr aktuelles Passwort ist anders als das angegebene." + +msgid "Invalid email address" +msgstr "Ungültige E-Mail-Adresse" msgid "Current password" msgstr "Aktuelles Passwort" @@ -3202,6 +3225,9 @@ msgstr "Aktuelles Passwort" msgid "Password (retype)" msgstr "Passwort (nochmal)" +msgid "Email Address" +msgstr "E-Mail-Adresse" + msgid "Enter current token" msgstr "Geben Sie das aktuelle Token ein" @@ -3257,14 +3283,20 @@ msgstr "Nicht stören" msgid "Away" msgstr "Abwesend" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "UIN" msgstr "UIN" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. first name #. optional information msgid "First Name" msgstr "Vorname" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Birth Year" msgstr "Geburtsjahr" @@ -3304,6 +3336,30 @@ msgstr "Ihre Buddy-Liste wurde auf dem Server gespeichert." msgid "Connected" msgstr "Verbunden" +msgid "Unable to resolve hostname" +msgstr "Hostname konnte nicht aufgelöst werden" + +msgid "Incorrect password" +msgstr "Falsches Passwort" + +msgid "SSL Connection Failed" +msgstr "SSL-Verbindung gescheitert" + +msgid "" +"Your account has been disabled because too many incorrect passwords were " +"entered" +msgstr "" +"Ihr Konto wurde wegen zu vielen falsch eingegebenen Passworten gesperrt" + +msgid "Service temporarily unavailable" +msgstr "Dienst momentan nicht verfügbar" + +msgid "Error connecting to proxy server" +msgstr "Fehler beim Verbinden mit dem Proxy-Server" + +msgid "Error connecting to master server" +msgstr "Fehler beim Verbinden mit dem Master-Server" + msgid "Connection failed" msgstr "Verbindung fehlgeschlagen" @@ -3313,6 +3369,12 @@ msgstr "Zum Chat hinzufügen" msgid "Chat _name:" msgstr "Chat_name:" +msgid "The username specified is invalid." +msgstr "Der angegebene Benutzername ist ungültig." + +msgid "SSL support unavailable" +msgstr "SSL-Unterstützung nicht verfügbar" + #, c-format msgid "Unable to resolve hostname '%s': %s" msgstr "Hostname '%s' kann nicht aufgelöst werden: %s" @@ -3331,12 +3393,12 @@ msgstr "Dieser Chatname existiert bereits" msgid "Not connected to the server" msgstr "Nicht mit dem Server verbunden" -msgid "Find buddies..." -msgstr "Finde Buddys..." - msgid "Change password..." msgstr "Passwort ändern..." +msgid "Find buddies..." +msgstr "Finde Buddys..." + msgid "Upload buddylist to Server" msgstr "Buddy-Liste zum Server hochladen" @@ -3367,25 +3429,24 @@ msgstr "Gadu-Gadu-Protokoll-Plugin" msgid "Polish popular IM" msgstr "Beliebter polnischer IM-Dienst" -msgid "Gadu-Gadu User" -msgstr "Gadu-Gadu-Benutzer" - msgid "GG server" msgstr "GG-Server" -msgid "Don't use encryption" -msgstr "Keine Verschlüsselung benutzen" - msgid "Use encryption if available" msgstr "Verschlüsselung benutzen, wenn verfügbar" -#. TODO msgid "Require encryption" msgstr "Verschlüsselung fordern" +msgid "Don't use encryption" +msgstr "Keine Verschlüsselung benutzen" + msgid "Connection security" msgstr "Verbindungssicherheit" +msgid "Show links from strangers" +msgstr "Links von Fremden anzeigen" + #, c-format msgid "Unknown command: %s" msgstr "Unbekanntes Kommando: %s" @@ -3438,9 +3499,6 @@ msgstr "_Passwort:" msgid "IRC nick and server may not contain whitespace" msgstr "IRC-Server und -Spitzname dürfen keinen Leerraum enthalten" -msgid "SSL support unavailable" -msgstr "SSL-Unterstützung nicht verfügbar" - msgid "Unable to connect" msgstr "Verbindung nicht möglich" @@ -3474,7 +3532,9 @@ msgstr "IRC-Protokoll-Plugin" msgid "The IRC Protocol Plugin that Sucks Less" msgstr "Das IRC-Protokoll-Plugin mit weniger Problemen" -#. host to connect to +#. set up account ID as user:server +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Server" msgstr "Server" @@ -4013,6 +4073,8 @@ msgstr "Die Verbindung mit dem Server konnte nicht hergestellt werden: %s" msgid "Unable to establish SSL connection" msgstr "Kann SSL-Verbindung nicht erstellen" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Full Name" msgstr "Vollständiger Name" @@ -4083,9 +4145,13 @@ msgstr "" "Die folgenden Punkte sind optional. Geben Sie nur die Informationen an, die " "Sie angeben möchten." +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Client" msgstr "Client" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Operating System" msgstr "Betriebssystem" @@ -4095,6 +4161,8 @@ msgstr "Lokale Zeit" msgid "Priority" msgstr "Priorität" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Resource" msgstr "Ressource" @@ -4191,9 +4259,6 @@ msgstr "" "Füllen Sie ein oder mehrere Felder aus, um nach entsprechenden XMPP-" "Benutzern zu suchen." -msgid "Email Address" -msgstr "E-Mail-Adresse" - msgid "Search for XMPP users" msgstr "Suche nach XMPP-Benutzern" @@ -4404,6 +4469,8 @@ msgstr "Server unterstützt kein Blockieren" msgid "Not Authorized" msgstr "Nicht autorisiert" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Mood" msgstr "Stimmung" @@ -5253,9 +5320,6 @@ msgstr "Kann die Nachricht nicht parsen" msgid "Syntax Error (probably a client bug)" msgstr "Syntaxfehler (wahrscheinlich ein Client-Bug)" -msgid "Invalid email address" -msgstr "Ungültige E-Mail-Adresse" - msgid "User does not exist" msgstr "Benutzer existiert nicht" @@ -5323,9 +5387,6 @@ msgstr "Zu viele Treffer zu einem FND" msgid "Not logged in" msgstr "Nicht angemeldet" -msgid "Service temporarily unavailable" -msgstr "Dienst momentan nicht verfügbar" - msgid "Database server error" msgstr "Fehler des Datenbank-Servers" @@ -5673,6 +5734,8 @@ msgstr "Alter" msgid "Occupation" msgstr "Beruf" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Location" msgstr "Ort" @@ -6056,9 +6119,6 @@ msgstr "Buddy aus dem Adressbuch löschen?" msgid "Do you want to delete this buddy from your address book as well?" msgstr "Möchten Sie diesen Buddy außerdem aus Ihrem Adressbuch löschen?" -msgid "The username specified is invalid." -msgstr "Der angegebene Benutzername ist ungültig." - msgid "The Display Name you entered is invalid." msgstr "Der eingegebene Anzeigename ist ungültig." @@ -6074,6 +6134,8 @@ msgstr "Profil-Aktualisierungsfehler" #. no profile information yet, so we cannot update #. (reference: "libpurple/request.h") +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Profile" msgstr "Profil" @@ -6307,16 +6369,14 @@ msgstr "Sie haben eingeladen" msgid "Loading menu..." msgstr "Lade das Menü..." +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status Message" msgstr "Status-Nachricht" msgid "Rejection Message" msgstr "Ablehnungsnachricht" -#. hidden number -msgid "Hidden Number" -msgstr "Versteckte Nummer" - msgid "No profile available" msgstr "Kein Profil verfügbar" @@ -6400,6 +6460,12 @@ msgstr "" msgid "Message Error" msgstr "Nachrichtenfehler" +#. could not be decrypted +msgid "An encrypted message was received which could not be decrypted." +msgstr "" +"Eine verschlüsselte Nachricht wurde empfangen und konnte nicht entschlüsselt " +"werden." + msgid "Cannot perform redirect using the specified protocol" msgstr "Kann die Umleitung nicht mit dem angegebenen Protokoll durchführen" @@ -6664,18 +6730,26 @@ msgstr "Bildschirmauflösung (dpi)" msgid "Base font size (points)" msgstr "Basis-Schriftgröße (Punkt)" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User" msgstr "Benutzer" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Headline" msgstr "Überschrift" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Song" msgstr "Lied" msgid "Total Friends" msgstr "Freunde insgesamt" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Client Version" msgstr "Client-Version" @@ -6879,9 +6953,6 @@ msgstr "Nicht unterstützt" msgid "Password has expired" msgstr "Passwort ist abgelaufen" -msgid "Incorrect password" -msgstr "Falsches Passwort" - msgid "Account has been disabled" msgstr "Konto wurde deaktiviert" @@ -6908,12 +6979,6 @@ msgstr "" "Konnte den Rechnernamen des Benutzers, den Sie eingegeben haben, nicht " "erkennen" -msgid "" -"Your account has been disabled because too many incorrect passwords were " -"entered" -msgstr "" -"Ihr Konto wurde wegen zu vielen falsch eingegebenen Passworten gesperrt" - msgid "You cannot add the same person twice to a conversation" msgstr "Sie können die selbe Person nicht zweimal zu einem Gespräch hinzufügen" @@ -7039,12 +7104,10 @@ msgstr "Hauspostcode" msgid "User ID" msgstr "Benutzer-ID" -#. tag = _("DN"); -#. value = nm_user_record_get_dn(user_record); -#. if (value) { -#. purple_notify_user_info_add_pair(user_info, tag, value); -#. } -#. +#, fuzzy +msgid "DN" +msgstr "DN" + msgid "Full name" msgstr "Vollständiger Name" @@ -8147,6 +8210,7 @@ msgstr "Benutzerinformation nicht verfügbar: %s" msgid "Mobile Phone" msgstr "Handynummer" +#. TODO: Is it correct to pass info->email here...? msgid "Personal Web Page" msgstr "Persönliche Webseite" @@ -8167,6 +8231,7 @@ msgstr "Abteilung" msgid "Position" msgstr "Position" +#. TODO: Is it correct to pass info->email here...? msgid "Web Page" msgstr "Webseite" @@ -8433,33 +8498,16 @@ msgstr "Sende TEST-Nachricht" msgid "Topic:" msgstr "Thema:" -msgid "No Sametime Community Server specified" -msgstr "Kein Sametime-Community Server angegeben" - -#, c-format -msgid "" -"No host or IP address has been configured for the Meanwhile account %s. " -"Please enter one below to continue logging in." -msgstr "" -"Es wurde kein Rechner für das Meanwhile-Konto %s angegeben. Bitte geben Sie " -"einen Rechner an, um die Anmeldung fortzusetzen." - -msgid "Meanwhile Connection Setup" -msgstr "Meanwhile-Verbindungseinstellungen" - -msgid "No Sametime Community Server Specified" -msgstr "Kein Sametime-Community Server angegeben" +msgid "A server is required to connect this account" +msgstr "Es wird ein Server benötigt um dieses Konto zu verbinden." -msgid "Connect" -msgstr "Verbinden" +msgid "Last Known Client" +msgstr "Letzter bekannter Client" #, c-format msgid "Unknown (0x%04x)
" msgstr "Unbekannt (0x%04x)
" -msgid "Last Known Client" -msgstr "Letzter bekannter Client" - msgid "User Name" msgstr "Benutzername" @@ -8782,21 +8830,33 @@ msgstr "Hyperaktiv" msgid "Robot" msgstr "Robot" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User Modes" msgstr "Benutzermodi" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Contact" msgstr "Bevorzugter Kontakt" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Language" msgstr "Bevorzugte Sprache" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Device" msgstr "Gerät" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Timezone" msgstr "Zeitzone" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Geolocation" msgstr "Geographische Koordinaten" @@ -9666,78 +9726,12 @@ msgstr "" msgid "Whiteboard" msgstr "Whiteboard" -msgid "No server statistics available" -msgstr "Keine Serverstatistik verfügbar" - -msgid "Error during connecting to SILC Server" -msgstr "Fehler beim Verbinden mit dem SILC-Server" - -#, c-format -msgid "Failure: Version mismatch, upgrade your client" -msgstr "Fehler: Unterschiedliche Version, aktualisieren Sie Ihren Client" - -#, c-format -msgid "Failure: Remote does not trust/support your public key" -msgstr "" -"Fehler: Die entfernte Seite vertraut Ihrem öffentlichen Schlüssel nicht" - -#, c-format -msgid "Failure: Remote does not support proposed KE group" -msgstr "" -"Fehler: Entferntes Programm unterstützt nicht die vorgeschlagen KE-Gruppe" - -#, c-format -msgid "Failure: Remote does not support proposed cipher" -msgstr "" -"Fehler: Entferntes Programm unterstützt die vorgeschlagene Chiffre nicht" - -#, c-format -msgid "Failure: Remote does not support proposed PKCS" -msgstr "Fehler: Entferntes Programm unterstützt die vorgeschlagene PKCS nicht" - -#, c-format -msgid "Failure: Remote does not support proposed hash function" -msgstr "" -"Fehler: Entferntes Programm unterstützt die vorgeschlagen Hashfunktion nicht" - -#, c-format -msgid "Failure: Remote does not support proposed HMAC" -msgstr "Fehler: Entferntes Programm unterstützt das vorgeschlagene HMAC nicht" - -#, c-format -msgid "Failure: Incorrect signature" -msgstr "Fehler: Falsche Signatur" - -#, c-format -msgid "Failure: Invalid cookie" -msgstr "Fehler: Ungültiger Cookie" - -#, c-format -msgid "Failure: Authentication failed" -msgstr "Fehler: Authentifizierung fehlgeschlagen" - -msgid "Unable to initialize SILC Client connection" -msgstr "SILC-Client-Verbindung konnte nicht hergestellt werden" - -msgid "John Noname" -msgstr "Max Mustermann" - -#, c-format -msgid "Unable to load SILC key pair: %s" -msgstr "SILC-Schlüsselpaar konnte nicht geladen werden: %s" - -msgid "Unable to create connection" -msgstr "Kann Verbindung nicht erstellen" - msgid "Unknown server response" msgstr "Unbekannte Serverantwort" msgid "Unable to create listen socket" msgstr "Lauschender Socket konnte nicht erstellt werden" -msgid "Unable to resolve hostname" -msgstr "Hostname konnte nicht aufgelöst werden" - msgid "SIP usernames may not contain whitespaces or @ symbols" msgstr "SIP-Benutzernamen dürfen keine Leerzeichen oder @-Symbole enthalten" @@ -10218,6 +10212,8 @@ msgstr "Kann nicht an den Chat %s,%s,%s senden" msgid "Hidden or not logged-in" msgstr "Versteckt oder nicht angemeldet" +#. TODO: Need to escape locs.host and locs.time? +#. TODO: Need to escape the two strings that make up tmp? #, c-format msgid "
At %s since %s" msgstr "
Bei %s seit %s" @@ -10426,9 +10422,6 @@ msgstr "Gespeichertes Bild" msgid "Stored Image. (that'll have to do for now)" msgstr "Gespeichertes Bild. (Das muss erstmal reichen)" -msgid "SSL Connection Failed" -msgstr "SSL-Verbindung gescheitert" - msgid "SSL Handshake Failed" msgstr "SSL-Verhandlung gescheitert" @@ -11394,6 +11387,21 @@ msgstr "Geben Sie einen Hostnamen für dieses Zertifikat an." msgid "SSL Servers" msgstr "SSL-Server" +msgid "Unsafe debugging is now disabled." +msgstr "" + +msgid "Unsafe debugging is now enabled." +msgstr "" + +msgid "Verbose debugging is now disabled." +msgstr "Ausführliches Debugging ist nun deaktiviert." + +msgid "Verbose debugging is now enabled." +msgstr "Ausführliches Debugging ist nun aktiviert." + +msgid "Supported debug options are: plugins version unsafe verbose" +msgstr "Unterstützte Debug-Optionen sind: plugins version unsafe verbose" + msgid "Unknown command." msgstr "Unbekanntes Kommando." @@ -11428,9 +11436,6 @@ msgstr "Nicht Ignorieren" msgid "Ignore" msgstr "Ignorieren" -msgid "Get Away Message" -msgstr "Neue Abwesenheitsnachricht abholen" - msgid "Last Said" msgstr "Zuletzt gesagt" @@ -12178,12 +12183,6 @@ msgstr "" msgid "View User Log" msgstr "Benutzer-Mitschnitt anzeigen" -msgid "Alias Contact" -msgstr "Kontakt-Alias" - -msgid "Enter an alias for this contact." -msgstr "Geben Sie einen Alias für diesen Kontakt ein." - #, c-format msgid "Enter an alias for %s." msgstr "Geben Sie einen Alias %s ein." @@ -13004,6 +13003,9 @@ msgstr "Das Standard-Klangthema für Pidgin" msgid "The default Pidgin buddy list theme" msgstr "Das Standard-Buddy-Listen-Thema für Pidgin" +msgid "The default Pidgin conversation theme" +msgstr "Das Standard-Thema für Pidgin-Unterhaltungen" + msgid "The default Pidgin status icon theme" msgstr "Das Standard-Status-Icon-Thema für Pidgin" @@ -13031,6 +13033,13 @@ msgstr "" msgid "Buddy List Theme:" msgstr "Buddy-Listen-Thema:" +msgid "Conversation Theme:" +msgstr "Unterhaltungs-Thema:" + +#, fuzzy +msgid "\tVariant:" +msgstr "\tVariante:" + msgid "Status Icon Theme:" msgstr "Status-Icon-Thema:" -- cgit v1.2.1 From a49f3b0b2a4fe4b3e4090550916dd4a7d3e53a7f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 23 Oct 2011 23:50:19 +0000 Subject: Set the XMPP Console's toolbar buttons to be 'important', or else they won't show their text on recent GTK+ versions. --- pidgin/plugins/xmppconsole.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index 7951593758..aa1b18dda6 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -793,14 +793,17 @@ create_console(PurplePluginAction *action) toolbar = gtk_toolbar_new(); button = gtk_tool_button_new(NULL, ""); + gtk_tool_item_set_is_important(button, TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); button = gtk_tool_button_new(NULL, ""); + gtk_tool_item_set_is_important(button, TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); button = gtk_tool_button_new(NULL, ""); + gtk_tool_item_set_is_important(button, TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); -- cgit v1.2.1 From 97d2c552dd800b2cd811a9ec6866789e2b830bf4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 24 Oct 2011 01:15:48 +0000 Subject: Add the get_attention widget to the PidginWindow structure, instead of an added GObject data of the window. --- pidgin/gtkconv.c | 14 +++++++------- pidgin/gtkconvwin.h | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 03cef8e80a..c482edd73e 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3534,9 +3534,10 @@ setup_menubar(PidginWindow *win) gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/Send File...")); - g_object_set_data(G_OBJECT(win->window), "get_attention", + win->menu.get_attention = gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Get Attention"))); + N_("/Conversation/Get Attention")); + win->menu.add_pounce = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/Add Buddy Pounce...")); @@ -6884,7 +6885,7 @@ gray_stuff_out(PidginConversation *gtkconv) /* Deal with menu items */ gtk_widget_show(win->menu.view_log); gtk_widget_show(win->menu.send_file); - gtk_widget_show(g_object_get_data(G_OBJECT(win->window), "get_attention")); + gtk_widget_show(win->menu.get_attention); gtk_widget_show(win->menu.add_pounce); gtk_widget_show(win->menu.get_info); gtk_widget_hide(win->menu.invite); @@ -6913,7 +6914,7 @@ gray_stuff_out(PidginConversation *gtkconv) /* Deal with menu items */ gtk_widget_show(win->menu.view_log); gtk_widget_hide(win->menu.send_file); - gtk_widget_hide(g_object_get_data(G_OBJECT(win->window), "get_attention")); + gtk_widget_hide(win->menu.get_attention); gtk_widget_hide(win->menu.add_pounce); gtk_widget_hide(win->menu.get_info); gtk_widget_show(win->menu.invite); @@ -6995,7 +6996,7 @@ gray_stuff_out(PidginConversation *gtkconv) gtk_widget_set_sensitive(win->menu.send_file, (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, purple_conversation_get_name(conv))))); - gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL)); + gtk_widget_set_sensitive(win->menu.get_attention, (prpl_info->send_attention != NULL)); gtk_widget_set_sensitive(win->menu.alias, (account != NULL) && (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); @@ -7016,8 +7017,7 @@ gray_stuff_out(PidginConversation *gtkconv) /* Then deal with menu items */ gtk_widget_set_sensitive(win->menu.view_log, TRUE); gtk_widget_set_sensitive(win->menu.send_file, FALSE); - gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window), - "get_attention"), FALSE); + gtk_widget_set_sensitive(win->menu.get_attention, FALSE); gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); gtk_widget_set_sensitive(win->menu.get_info, FALSE); gtk_widget_set_sensitive(win->menu.invite, FALSE); diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index 986b1ca28f..54b1306848 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -51,6 +51,7 @@ struct _PidginWindow GtkWidget *view_log; GtkWidget *send_file; + GtkWidget *get_attention; GtkWidget *add_pounce; GtkWidget *get_info; GtkWidget *invite; -- cgit v1.2.1 From 1b7b2a541b1795fb53ef2a3f374de9a54988197a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 24 Oct 2011 04:48:42 +0000 Subject: Add a submenu to the 'Get Attention' item for non-default attention types. Anyone have MySpace want to test this out? Refs #4810. --- pidgin/gtkconv.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index c482edd73e..7d191a9190 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1228,8 +1228,13 @@ menu_get_attention_cb(gpointer data, guint action, GtkWidget *widget) PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { + int index; + if (widget == win->menu.get_attention) + index = 0; + else + index = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "index")); purple_prpl_send_attention(purple_conversation_get_gc(conv), - purple_conversation_get_name(conv), 0); + purple_conversation_get_name(conv), index); } } @@ -3374,6 +3379,60 @@ regenerate_media_items(PidginWindow *win) #endif } +static void +regenerate_attention_items(PidginWindow *win) +{ + GtkWidget *menu; + PurpleConversation *conv; + PurpleConnection *pc; + PurplePlugin *prpl = NULL; + PurplePluginProtocolInfo *prpl_info = NULL; + GList *list; + + conv = pidgin_conv_window_get_active_conversation(win); + if (!conv) + return; + + /* Remove the previous entries */ + gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.get_attention), NULL); + + pc = purple_conversation_get_gc(conv); + if (pc != NULL) + prpl = purple_connection_get_prpl(pc); + if (prpl != NULL) + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + + if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_attention_types)) { + list = prpl_info->get_attention_types(purple_connection_get_account(pc)); + + /* Multiple attention types */ + if (list && list->next) { + int index = 0; + + menu = gtk_menu_new(); + while (list) { + PurpleAttentionType *type; + GtkWidget *menuitem; + + type = list->data; + + menuitem = gtk_menu_item_new_with_label(purple_attention_type_get_name(type)); + g_object_set_data(G_OBJECT(menuitem), "index", GINT_TO_POINTER(index)); + g_signal_connect(G_OBJECT(menuitem), "activate", + G_CALLBACK(menu_get_attention_cb), + win); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + + index++; + list = g_list_delete_link(list, list); + } + + gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.get_attention), menu); + gtk_widget_show_all(menu); + } + } +} + static void regenerate_options_items(PidginWindow *win) { @@ -3462,6 +3521,7 @@ static void menubar_activated(GtkWidget *item, gpointer data) regenerate_media_items(win); regenerate_options_items(win); regenerate_plugins_items(win); + regenerate_attention_items(win); /* The following are to make sure the 'More' submenu is not regenerated every time * the focus shifts from 'Conversations' to some other menu and back. */ -- cgit v1.2.1 From 162cf40ba5969f36836b3fc53daf200ea817b13d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 24 Oct 2011 05:37:19 +0000 Subject: Our API really shouldn't have a 'gc' in it anymore. --- ChangeLog.API | 2 ++ finch/gntconv.c | 8 +++--- libpurple/conversation.c | 20 +++++++------- libpurple/conversation.h | 4 +-- libpurple/plugins/perl/common/Conversation.xs | 2 +- libpurple/protocols/irc/parse.c | 2 +- libpurple/protocols/jabber/jabber.c | 6 ++--- libpurple/protocols/mxit/mxit.c | 2 +- libpurple/protocols/sametime/sametime.c | 4 +-- libpurple/protocols/silc/silc.c | 26 +++++++++---------- libpurple/protocols/yahoo/libymsg.c | 2 +- libpurple/protocols/zephyr/zephyr.c | 18 ++++++------- pidgin/gtkconv.c | 36 +++++++++++++------------- pidgin/gtkimhtmltoolbar.c | 4 +-- pidgin/plugins/musicmessaging/musicmessaging.c | 4 +-- 15 files changed, 70 insertions(+), 70 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index e05b489030..acf2254fa0 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -74,6 +74,8 @@ version 3.0.0 (??/??/????): PurpleCertificate*s as the second parameter * purple_connection_error now takes a PurpleConnectionError as the second parameter + * purple_conversation_get_gc renamed to + purple_conversation_get_connection * purple_dnsquery_a now takes a PurpleAccount as the first parameter * purple_network_listen now takes the protocol family as the second parameter diff --git a/finch/gntconv.c b/finch/gntconv.c index 0912fbec54..4d194c0e47 100644 --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -123,7 +123,7 @@ send_typing_notification(GntWidget *w, FinchConv *ggconv) if (send || (purple_conv_im_get_type_again(im) != 0 && time(NULL) > purple_conv_im_get_type_again(im))) { unsigned int timeout; - timeout = serv_send_typing(purple_conversation_get_gc(conv), + timeout = serv_send_typing(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), PURPLE_TYPING); purple_conv_im_set_type_again(im, timeout); @@ -131,7 +131,7 @@ send_typing_notification(GntWidget *w, FinchConv *ggconv) } else { purple_conv_im_stop_send_typed_timeout(im); - serv_send_typing(purple_conversation_get_gc(conv), + serv_send_typing(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), PURPLE_NOT_TYPING); } @@ -414,7 +414,7 @@ static void send_file_cb(GntMenuItem *item, gpointer ggconv) { FinchConv *ggc = ggconv; - serv_send_file(purple_conversation_get_gc(ggc->active_conv), + serv_send_file(purple_conversation_get_connection(ggc->active_conv), purple_conversation_get_name(ggc->active_conv), NULL); } @@ -431,7 +431,7 @@ static void get_info_cb(GntMenuItem *item, gpointer ggconv) { FinchConv *ggc = ggconv; - finch_retrieve_user_info(purple_conversation_get_gc(ggc->active_conv), + finch_retrieve_user_info(purple_conversation_get_connection(ggc->active_conv), purple_conversation_get_name(ggc->active_conv)); } diff --git a/libpurple/conversation.c b/libpurple/conversation.c index 1da993e7fa..f719c5ea8d 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -241,7 +241,7 @@ send_typed_cb(gpointer data) g_return_val_if_fail(conv != NULL, FALSE); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); name = purple_conversation_get_name(conv); if (gc != NULL && name != NULL) { @@ -271,7 +271,7 @@ common_send(PurpleConversation *conv, const char *message, PurpleMessageFlags ms return; account = purple_conversation_get_account(conv); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); g_return_if_fail(account != NULL); g_return_if_fail(gc != NULL); @@ -594,7 +594,7 @@ purple_conversation_destroy(PurpleConversation *conv) purple_request_close_with_handle(conv); ops = purple_conversation_get_ui_ops(conv); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); name = purple_conversation_get_name(conv); if (gc != NULL) @@ -819,7 +819,7 @@ purple_conversation_get_account(const PurpleConversation *conv) } PurpleConnection * -purple_conversation_get_gc(const PurpleConversation *conv) +purple_conversation_get_connection(const PurpleConversation *conv) { PurpleAccount *account; @@ -1659,7 +1659,7 @@ purple_conv_chat_write(PurpleConvChat *chat, const char *who, const char *messag g_return_if_fail(message != NULL); conv = purple_conv_chat_get_conversation(chat); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); account = purple_connection_get_account(gc); /* Don't display this if the person who wrote it is ignored. */ @@ -1775,7 +1775,7 @@ purple_conv_chat_add_users(PurpleConvChat *chat, GList *users, GList *extra_msgs conv = purple_conv_chat_get_conversation(chat); ops = purple_conversation_get_ui_ops(conv); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); g_return_if_fail(gc != NULL); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); g_return_if_fail(prpl_info != NULL); @@ -1876,7 +1876,7 @@ purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, conv = purple_conv_chat_get_conversation(chat); ops = purple_conversation_get_ui_ops(conv); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); g_return_if_fail(gc != NULL); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); g_return_if_fail(prpl_info != NULL); @@ -1995,7 +1995,7 @@ purple_conv_chat_remove_users(PurpleConvChat *chat, GList *users, const char *re conv = purple_conv_chat_get_conversation(chat); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); g_return_if_fail(gc != NULL); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); g_return_if_fail(prpl_info != NULL); @@ -2180,7 +2180,7 @@ purple_find_chat(const PurpleConnection *gc, int id) conv = (PurpleConversation *)l->data; if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)) == id && - purple_conversation_get_gc(conv) == gc) + purple_conversation_get_connection(conv) == gc) return conv; } @@ -2208,7 +2208,7 @@ invite_user_to_chat(gpointer data, PurpleRequestFields *fields) user = purple_request_fields_get_string(fields, "screenname"); message = purple_request_fields_get_string(fields, "message"); - serv_chat_invite(purple_conversation_get_gc(conv), chat->id, message, user); + serv_chat_invite(purple_conversation_get_connection(conv), chat->id, message, user); } void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, diff --git a/libpurple/conversation.h b/libpurple/conversation.h index 3b2785a600..32e992f352 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -355,13 +355,11 @@ PurpleAccount *purple_conversation_get_account(const PurpleConversation *conv); /** * Returns the specified conversation's purple_connection. * - * This is the same as purple_conversation_get_user(conv)->gc. - * * @param conv The conversation. * * @return The conversation's purple_connection. */ -PurpleConnection *purple_conversation_get_gc(const PurpleConversation *conv); +PurpleConnection *purple_conversation_get_connection(const PurpleConversation *conv); /** * Sets the specified conversation's title. diff --git a/libpurple/plugins/perl/common/Conversation.xs b/libpurple/plugins/perl/common/Conversation.xs index a6e9219486..3263aafc4c 100644 --- a/libpurple/plugins/perl/common/Conversation.xs +++ b/libpurple/plugins/perl/common/Conversation.xs @@ -146,7 +146,7 @@ purple_conversation_get_account(conv) Purple::Conversation conv Purple::Connection -purple_conversation_get_gc(conv) +purple_conversation_get_connection(conv) Purple::Conversation conv void diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/parse.c index 363c5a4cd0..5bd750eed6 100644 --- a/libpurple/protocols/irc/parse.c +++ b/libpurple/protocols/irc/parse.c @@ -171,7 +171,7 @@ static PurpleCmdRet irc_parse_purple_cmd(PurpleConversation *conv, const gchar * struct irc_conn *irc; struct _irc_user_cmd *cmdent; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (!gc) return PURPLE_CMD_RET_FAILED; diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index e88fefb8f7..575aeb7f95 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -3001,7 +3001,7 @@ static PurpleCmdRet jabber_cmd_chat_invite(PurpleConversation *conv, if(!args || !args[0]) return PURPLE_CMD_RET_FAILED; - jabber_chat_invite(purple_conversation_get_gc(conv), + jabber_chat_invite(purple_conversation_get_connection(conv), purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), args[1] ? args[1] : "", args[0]); @@ -3048,7 +3048,7 @@ static PurpleCmdRet jabber_cmd_chat_join(PurpleConversation *conv, if (args[1]) g_hash_table_insert(components, "password", args[1]); - jabber_chat_join(purple_conversation_get_gc(conv), components); + jabber_chat_join(purple_conversation_get_connection(conv), components); g_hash_table_destroy(components); jabber_id_free(jid); @@ -3082,7 +3082,7 @@ static PurpleCmdRet jabber_cmd_chat_msg(PurpleConversation *conv, who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]); - jabber_message_send_im(purple_conversation_get_gc(conv), who, args[1], 0); + jabber_message_send_im(purple_conversation_get_connection(conv), who, args[1], 0); g_free(who); return PURPLE_CMD_RET_OK; diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index 8d5a5d72db..ec606ff211 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -176,7 +176,7 @@ static void mxit_cb_chat_created( PurpleConversation* conv, struct MXitSession* const char* who; char* tmp; - gc = purple_conversation_get_gc( conv ); + gc = purple_conversation_get_connection( conv ); if ( session->con != gc ) { /* not our conversation */ return; diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 980d1368b8..805ef16602 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -1280,7 +1280,7 @@ static void conversation_created_cb(PurpleConversation *g_conv, struct mwIdBlock who = { 0, 0 }; struct mwConversation *conv; - gc = purple_conversation_get_gc(g_conv); + gc = purple_conversation_get_connection(g_conv); if(pd->gc != gc) return; /* not ours */ @@ -2528,7 +2528,7 @@ static void convo_nofeatures(struct mwConversation *conv) { gconv = convo_get_gconv(conv); if(! gconv) return; - gc = purple_conversation_get_gc(gconv); + gc = purple_conversation_get_connection(gconv); if(! gc) return; purple_conversation_set_features(gconv, purple_connection_get_flags(gc)); diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index a365fc79e0..c6b15fd2da 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -1548,7 +1548,7 @@ static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, PurpleConversation *convo = conv; int id = 0; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1577,7 +1577,7 @@ static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, char *buf, *tmp, *tmp2; const char *topic; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); if (gc == NULL || id == 0) @@ -1623,7 +1623,7 @@ static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv, if(args[1]) g_hash_table_replace(comp, "passphrase", args[1]); - silcpurple_chat_join(purple_conversation_get_gc(conv), comp); + silcpurple_chat_join(purple_conversation_get_connection(conv), comp); g_hash_table_destroy(comp); return PURPLE_CMD_RET_OK; @@ -1633,7 +1633,7 @@ static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); purple_roomlist_show_with_account(purple_connection_get_account(gc)); return PURPLE_CMD_RET_OK; } @@ -1643,7 +1643,7 @@ static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, { PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1659,7 +1659,7 @@ static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv, int ret; PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1685,7 +1685,7 @@ static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, return PURPLE_CMD_RET_FAILED; } - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1713,7 +1713,7 @@ static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv, SilcPurple sg; char *tmp; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1742,7 +1742,7 @@ static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv, PurpleConnection *gc; SilcPurple sg; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1767,7 +1767,7 @@ static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv, char *silccmd, *silcargs, *msg, tmp[256]; const char *chname; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL || !args || purple_connection_get_protocol_data(gc) == NULL) return PURPLE_CMD_RET_FAILED; @@ -1818,7 +1818,7 @@ static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv, SilcPurple sg; char *silccmd, *silcargs; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1850,7 +1850,7 @@ static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, const char *ui_name = NULL, *ui_website = NULL; char *quit_msg; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1887,7 +1887,7 @@ static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, PurpleConnection *gc; SilcPurple sg; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 617f849906..eab9242fb8 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -5232,7 +5232,7 @@ yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, if (!args || !args[0]) return PURPLE_CMD_RET_FAILED; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); purple_debug_info("yahoo", "Trying to join %s \n", args[0]); comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 3f8b7e0ae9..c02d5d2226 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -2591,7 +2591,7 @@ static PurpleCmdRet zephyr_purple_cmd_msg(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { char *recipient; - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); zephyr_account *zephyr = purple_connection_get_protocol_data(gc);; if (!g_ascii_strcasecmp(args[0],"*")) return PURPLE_CMD_RET_FAILED; /* "*" is not a valid argument */ @@ -2610,7 +2610,7 @@ static PurpleCmdRet zephyr_purple_cmd_msg(PurpleConversation *conv, static PurpleCmdRet zephyr_purple_cmd_zlocate(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - zephyr_zloc(purple_conversation_get_gc(conv),args[0]); + zephyr_zloc(purple_conversation_get_connection(conv),args[0]); return PURPLE_CMD_RET_OK; } @@ -2623,7 +2623,7 @@ static PurpleCmdRet zephyr_purple_cmd_instance(PurpleConversation *conv, PurpleConvChat *gcc = purple_conversation_get_chat_data(conv); const char* instance = args[0]; - zephyr_chat_set_topic(purple_conversation_get_gc(conv),purple_conv_chat_get_id(gcc),instance); + zephyr_chat_set_topic(purple_conversation_get_connection(conv),purple_conv_chat_get_id(gcc),instance); return PURPLE_CMD_RET_OK; } @@ -2635,7 +2635,7 @@ static PurpleCmdRet zephyr_purple_cmd_joinchat_cir(PurpleConversation *conv, g_hash_table_insert(triple,"class",args[0]); g_hash_table_insert(triple,"instance",args[1]); g_hash_table_insert(triple,"recipient",args[2]); - zephyr_join_chat(purple_conversation_get_gc(conv),triple); + zephyr_join_chat(purple_conversation_get_connection(conv),triple); return PURPLE_CMD_RET_OK; } @@ -2643,7 +2643,7 @@ static PurpleCmdRet zephyr_purple_cmd_zi(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = instance, message */ - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,"message",args[0],"",args[1],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; @@ -2655,7 +2655,7 @@ static PurpleCmdRet zephyr_purple_cmd_zci(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = class, instance, message */ - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,args[0],args[1],"",args[2],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; @@ -2667,7 +2667,7 @@ static PurpleCmdRet zephyr_purple_cmd_zcir(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = class, instance, recipient, message */ - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,args[0],args[1],args[2],args[3],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; @@ -2679,7 +2679,7 @@ static PurpleCmdRet zephyr_purple_cmd_zir(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = instance, recipient, message */ - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,"message",args[0],args[1],args[2],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; @@ -2691,7 +2691,7 @@ static PurpleCmdRet zephyr_purple_cmd_zc(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = class, message */ - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,args[0],"PERSONAL","",args[1],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 7d191a9190..adab9b849d 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -563,7 +563,7 @@ check_for_and_do_command(PurpleConversation *conv) PurplePluginProtocolInfo *prpl_info = NULL; PurpleConnection *gc; - if ((gc = purple_conversation_get_gc(conv))) + if ((gc = purple_conversation_get_connection(conv))) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_SLASH_COMMANDS_NATIVE)) { @@ -722,7 +722,7 @@ static void chat_do_info(PidginConversation *gtkconv, const char *who) PurpleConversation *conv = gtkconv->active_conv; PurpleConnection *gc; - if ((gc = purple_conversation_get_gc(conv))) { + if ((gc = purple_conversation_get_connection(conv))) { pidgin_retrieve_user_info_in_chat(gc, who, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); } } @@ -734,7 +734,7 @@ info_cb(GtkWidget *widget, PidginConversation *gtkconv) PurpleConversation *conv = gtkconv->active_conv; if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - pidgin_retrieve_user_info(purple_conversation_get_gc(conv), + pidgin_retrieve_user_info(purple_conversation_get_connection(conv), purple_conversation_get_name(conv)); gtk_widget_grab_focus(gtkconv->entry); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { @@ -822,7 +822,7 @@ do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) if (!g_ascii_strcasecmp(buddy, "")) return; - serv_chat_invite(purple_conversation_get_gc(conv), + serv_chat_invite(purple_conversation_get_connection(conv), purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), message, buddy); } @@ -1216,7 +1216,7 @@ menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - serv_send_file(purple_conversation_get_gc(conv), purple_conversation_get_name(conv), NULL); + serv_send_file(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), NULL); } } @@ -1233,7 +1233,7 @@ menu_get_attention_cb(gpointer data, guint action, GtkWidget *widget) index = 0; else index = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "index")); - purple_prpl_send_attention(purple_conversation_get_gc(conv), + purple_prpl_send_attention(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), index); } } @@ -1568,7 +1568,7 @@ menu_chat_send_file_cb(GtkWidget *w, PidginConversation *gtkconv) PurplePluginProtocolInfo *prpl_info; PurpleConversation *conv = gtkconv->active_conv; const char *who = g_object_get_data(G_OBJECT(w), "user_data"); - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); gchar *real_who = NULL; g_return_if_fail(gc != NULL); @@ -2443,7 +2443,7 @@ delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, /* We deleted all the text, so turn off typing. */ purple_conv_im_stop_send_typed_timeout(im); - serv_send_typing(purple_conversation_get_gc(conv), + serv_send_typing(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), PURPLE_NOT_TYPING); } @@ -3396,7 +3396,7 @@ regenerate_attention_items(PidginWindow *win) /* Remove the previous entries */ gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.get_attention), NULL); - pc = purple_conversation_get_gc(conv); + pc = purple_conversation_get_connection(conv); if (pc != NULL) prpl = purple_connection_get_prpl(pc); if (prpl != NULL) @@ -3706,7 +3706,7 @@ got_typing_keypress(PidginConversation *gtkconv, gboolean first) time(NULL) > purple_conv_im_get_type_again(im))) { unsigned int timeout; - timeout = serv_send_typing(purple_conversation_get_gc(conv), + timeout = serv_send_typing(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), PURPLE_TYPING); purple_conv_im_set_type_again(im, timeout); @@ -4128,7 +4128,7 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c chat = PURPLE_CONV_CHAT(conv); gtkconv = PIDGIN_CONVERSATION(conv); gtkchat = gtkconv->u.chat; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)))) return; @@ -4438,7 +4438,7 @@ static void topic_callback(GtkWidget *w, PidginConversation *gtkconv) char *new_topic; const char *current_topic; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)))) return; @@ -4581,7 +4581,7 @@ blist_node_aliased_cb(PurpleBlistNode *node, const char *old_alias, PurpleConver g_return_if_fail(node != NULL); g_return_if_fail(conv != NULL); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); g_return_if_fail(gc != NULL); g_return_if_fail(purple_connection_get_prpl(gc) != NULL); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); @@ -4791,7 +4791,7 @@ static void setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox) { PurpleConversation *conv = gtkconv->active_conv; - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) { @@ -5979,7 +5979,7 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, &start, &end)) { GtkWidget *menu = NULL; PurpleConnection *gc = - purple_conversation_get_gc(conv); + purple_conversation_get_connection(conv); menu = create_chat_menu(conv, buddyname, gc); @@ -6922,7 +6922,7 @@ gray_stuff_out(PidginConversation *gtkconv) PurpleAccount *account; win = pidgin_conv_get_window(gtkconv); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); account = purple_conversation_get_account(conv); if (gc != NULL) @@ -7457,7 +7457,7 @@ pidgin_conv_update_buddy_icon(PurpleConversation *conv) if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons")) return; - if (purple_conversation_get_gc(conv) == NULL) + if (purple_conversation_get_connection(conv) == NULL) return; buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); @@ -9502,7 +9502,7 @@ infopane_entry_activate(PidginConversation *gtkconv) PurpleConnection *gc; PurplePluginProtocolInfo *prpl_info = NULL; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc != NULL) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && prpl_info->set_chat_topic == NULL) diff --git a/pidgin/gtkimhtmltoolbar.c b/pidgin/gtkimhtmltoolbar.c index e6d6f7652b..3adaa3c7f6 100644 --- a/pidgin/gtkimhtmltoolbar.c +++ b/pidgin/gtkimhtmltoolbar.c @@ -904,7 +904,7 @@ static void send_attention_cb(GtkWidget *attention, GtkIMHtmlToolbar *toolbar) PurpleConversation *conv = g_object_get_data(G_OBJECT(toolbar), "active_conv"); const gchar *who = purple_conversation_get_name(conv); - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); toggle_button_set_active_block(GTK_TOGGLE_BUTTON(attention), FALSE, toolbar); purple_prpl_send_attention(gc, who, 0); @@ -1581,7 +1581,7 @@ void gtk_imhtmltoolbar_associate_smileys(GtkIMHtmlToolbar *toolbar, const char * void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, PurpleConversation *conv) { - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); PurplePlugin *prpl = purple_connection_get_prpl(gc); GtkWidget *attention = g_object_get_data(G_OBJECT(toolbar), "attention"); diff --git a/pidgin/plugins/musicmessaging/musicmessaging.c b/pidgin/plugins/musicmessaging/musicmessaging.c index c47d9b8206..4399f19ed6 100644 --- a/pidgin/plugins/musicmessaging/musicmessaging.c +++ b/pidgin/plugins/musicmessaging/musicmessaging.c @@ -466,14 +466,14 @@ intercept_received(PurpleAccount *account, char **sender, char **message, Purple static void send_request(MMConversation *mmconv) { - PurpleConnection *connection = purple_conversation_get_gc(mmconv->conv); + PurpleConnection *connection = purple_conversation_get_connection(mmconv->conv); const char *convName = purple_conversation_get_name(mmconv->conv); serv_send_im(connection, convName, MUSICMESSAGING_START_MSG, PURPLE_MESSAGE_SEND); } static void send_request_confirmed(MMConversation *mmconv) { - PurpleConnection *connection = purple_conversation_get_gc(mmconv->conv); + PurpleConnection *connection = purple_conversation_get_connection(mmconv->conv); const char *convName = purple_conversation_get_name(mmconv->conv); serv_send_im(connection, convName, MUSICMESSAGING_CONFIRM_MSG, PURPLE_MESSAGE_SEND); } -- cgit v1.2.1 From a53da18d38b450404fa8142ec6fca14eb5667b28 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 24 Oct 2011 06:04:43 +0000 Subject: Move the Attention toolbar button into the GtkIMHtmlToolbar struct. --- pidgin/gtkimhtmltoolbar.c | 24 ++++++------------------ pidgin/gtkimhtmltoolbar.h | 1 + 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/pidgin/gtkimhtmltoolbar.c b/pidgin/gtkimhtmltoolbar.c index 3adaa3c7f6..de2a3a874e 100644 --- a/pidgin/gtkimhtmltoolbar.c +++ b/pidgin/gtkimhtmltoolbar.c @@ -1239,6 +1239,7 @@ static void gtk_imhtmltoolbar_create_old_buttons(GtkIMHtmlToolbar *toolbar) {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, {"", NULL, NULL, NULL}, {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, + {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &toolbar->attention, _("Send Attention")}, {NULL, NULL, NULL, NULL} }; int iter; @@ -1257,14 +1258,6 @@ static void gtk_imhtmltoolbar_create_old_buttons(GtkIMHtmlToolbar *toolbar) button = gtk_vseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); } - /* create the attention button (this is a bit hacky to not break ABI) */ - button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION); - g_signal_connect(G_OBJECT(button), "button-press-event", G_CALLBACK(gtk_imhtmltoolbar_popup_menu), toolbar); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(send_attention_cb), toolbar); - g_object_set_data(G_OBJECT(toolbar), "attention", button); - gtk_tooltips_set_tip(toolbar->tooltips, button, _("Send Attention"), NULL); - gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox); @@ -1327,7 +1320,6 @@ static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar) GtkWidget *insert_menu; GtkWidget *menuitem; GtkWidget *sep; - GObject *wide_attention_button; int i; struct { const char *label; @@ -1478,8 +1470,6 @@ static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar) gtk_widget_show_all(sep); /* Attention */ - wide_attention_button = g_object_get_data(G_OBJECT(toolbar), "attention"); - attention_button = gtk_button_new(); gtk_button_set_relief(GTK_BUTTON(attention_button), GTK_RELIEF_NONE); bbox = gtk_hbox_new(FALSE, 3); @@ -1491,16 +1481,16 @@ static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar) gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", - G_CALLBACK(gtk_button_clicked), wide_attention_button); + G_CALLBACK(gtk_button_clicked), toolbar->attention); gtk_widget_show_all(attention_button); - g_signal_connect(wide_attention_button, "notify::sensitive", + g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive", G_CALLBACK(button_sensitiveness_changed), attention_button); - g_signal_connect(wide_attention_button, "notify::visible", + g_signal_connect(G_OBJECT(toolbar->attention), "notify::visible", G_CALLBACK(button_visibility_changed), attention_button); /* set attention button to be greyed out until we get a conversation */ - gtk_widget_set_sensitive(GTK_WIDGET(wide_attention_button), FALSE); + gtk_widget_set_sensitive(toolbar->attention, FALSE); gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(hbox), "lean-view", box); @@ -1583,14 +1573,12 @@ void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, { PurpleConnection *gc = purple_conversation_get_connection(conv); PurplePlugin *prpl = purple_connection_get_prpl(gc); - GtkWidget *attention = - g_object_get_data(G_OBJECT(toolbar), "attention"); g_object_set_data(G_OBJECT(toolbar), "active_conv", conv); /* gray out attention button on protocols that don't support it for the time being it is always disabled for chats */ - gtk_widget_set_sensitive(attention, + gtk_widget_set_sensitive(toolbar->attention, conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); } diff --git a/pidgin/gtkimhtmltoolbar.h b/pidgin/gtkimhtmltoolbar.h index 673fc0fcfe..1b0af60ec2 100644 --- a/pidgin/gtkimhtmltoolbar.h +++ b/pidgin/gtkimhtmltoolbar.h @@ -65,6 +65,7 @@ struct _GtkIMHtmlToolbar { GtkWidget *image; GtkWidget *link; GtkWidget *smiley; + GtkWidget *attention; GtkWidget *font_dialog; GtkWidget *fgcolor_dialog; -- cgit v1.2.1 From 1427373a4d55f9ac48b38af9854f72c43d054d18 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 30 Oct 2011 15:42:24 +0000 Subject: Autoaccept: Use file-transfer accessor functions. --- libpurple/plugins/autoaccept.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libpurple/plugins/autoaccept.c b/libpurple/plugins/autoaccept.c index 7cd461a381..0f965fc541 100644 --- a/libpurple/plugins/autoaccept.c +++ b/libpurple/plugins/autoaccept.c @@ -73,10 +73,10 @@ static void auto_accept_complete_cb(PurpleXfer *xfer, PurpleXfer *my) { if (xfer == my && purple_prefs_get_bool(PREF_NOTIFY) && - !purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who, xfer->account)) + !purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_xfer_get_remote_user(xfer), purple_xfer_get_account(xfer))) { char *message = g_strdup_printf(_("Autoaccepted file transfer of \"%s\" from \"%s\" completed."), - xfer->filename, xfer->who); + purple_xfer_get_filename(xfer), purple_xfer_get_remote_user(xfer)); purple_notify_info(NULL, _("Autoaccept complete"), message, NULL); g_free(message); } @@ -93,8 +93,8 @@ file_recv_request_cb(PurpleXfer *xfer, gpointer handle) int accept_setting; - account = xfer->account; - node = PURPLE_BLIST_NODE(purple_find_buddy(account, xfer->who)); + account = purple_xfer_get_account(xfer); + node = PURPLE_BLIST_NODE(purple_find_buddy(account, purple_xfer_get_remote_user(xfer))); /* If person is on buddy list, use the buddy setting; otherwise, use the stranger setting. */ @@ -121,7 +121,7 @@ file_recv_request_cb(PurpleXfer *xfer, gpointer handle) gchar *ext; if (purple_prefs_get_bool(PREF_NEWDIR)) - dirname = g_build_filename(pref, purple_normalize(account, xfer->who), NULL); + dirname = g_build_filename(pref, purple_normalize(account, purple_xfer_get_remote_user(xfer)), NULL); else dirname = g_build_filename(pref, NULL); @@ -133,9 +133,9 @@ file_recv_request_cb(PurpleXfer *xfer, gpointer handle) /* Escape filename (if escaping is turned on) */ if (purple_prefs_get_bool(PREF_ESCAPE)) { - escape = purple_escape_filename(xfer->filename); + escape = purple_escape_filename(purple_xfer_get_filename(xfer)); } else { - escape = xfer->filename; + escape = purple_xfer_get_filename(xfer); } filename = g_build_filename(dirname, escape, NULL); @@ -174,7 +174,7 @@ file_recv_request_cb(PurpleXfer *xfer, gpointer handle) PURPLE_CALLBACK(auto_accept_complete_cb), xfer); break; case FT_REJECT: - xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; + purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); break; } } -- cgit v1.2.1 From 923d4435638ee8e7b81a2aee27c5a79098e6a97e Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 30 Oct 2011 15:46:31 +0000 Subject: Bonjour: Use file-transfer accessor functions. --- libpurple/protocols/bonjour/bonjour_ft.c | 40 ++++++++++++++++---------------- libpurple/protocols/bonjour/jabber.c | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index 3cc46458ee..343c02b10a 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -136,8 +136,8 @@ static void bonjour_xfer_end(PurpleXfer *xfer) * otherwise there is a RST resulting in an error on the client side */ if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && purple_xfer_is_completed(xfer)) { struct socket_cleanup *sc = g_new0(struct socket_cleanup, 1); - sc->fd = xfer->fd; - xfer->fd = -1; + sc->fd = purple_xfer_get_fd(xfer); + purple_xfer_set_fd(xfer, -1); sc->handle = purple_input_add(sc->fd, PURPLE_INPUT_READ, _wait_for_socket_close, sc); } @@ -648,16 +648,16 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) fcntl(acceptfd, F_SETFD, FD_CLOEXEC); #endif - purple_input_remove(xfer->watcher); + purple_input_remove(purple_xfer_get_watcher(xfer)); close(source); - xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(acceptfd, PURPLE_INPUT_READ, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; } break; case 0x01: - xfer->fd = source; + purple_xfer_set_fd(xfer, source); len = read(source, xf->rx_buf + xf->rxlen, 3); if(len < 0 && errno == EAGAIN) return; @@ -665,9 +665,9 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) purple_xfer_cancel_remote(xfer); return; } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - bonjour_sock5_request_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); @@ -684,9 +684,9 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) purple_xfer_cancel_remote(xfer); return; } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_READ, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; } @@ -695,9 +695,9 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) len = read(source, xf->rx_buf + xf->rxlen, 20); if(len<=0){ } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - bonjour_sock5_request_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); @@ -720,8 +720,8 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) purple_xfer_cancel_remote(xfer); return; } else { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); xf->rxlen = 0; /*close(source);*/ purple_xfer_start(xfer, source, NULL, -1); @@ -750,8 +750,8 @@ bonjour_bytestreams_listen(int sock, gpointer data) return; } - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(sock, PURPLE_INPUT_READ, + bonjour_sock5_request_cb, xfer)); xf = purple_xfer_get_protocol_data(xfer); xf->listen_data = NULL; @@ -764,7 +764,7 @@ bonjour_bytestreams_listen(int sock, gpointer data) xmlnode_set_attrib(query, "sid", xf->sid); xmlnode_set_attrib(query, "mode", "tcp"); - xfer->local_port = purple_network_get_port_from_fd(sock); + purple_xfer_set_local_port(xfer, purple_network_get_port_from_fd(sock)); local_ips = bonjour_jabber_get_local_ips(sock); diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index 327075e669..c25266af34 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -1164,7 +1164,7 @@ bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) tmp_next = xfers->next; /* We only need to cancel this if it hasn't actually started transferring. */ /* This will change if we ever support IBB transfers. */ - if (strcmp(xfer->who, purple_buddy_get_name(bconv->pb)) == 0 + if (strcmp(purple_xfer_get_remote_user(xfer), purple_buddy_get_name(bconv->pb)) == 0 && (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_NOT_STARTED || purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_UNKNOWN)) { purple_xfer_cancel_remote(xfer); -- cgit v1.2.1 From cab6f9bdc7f76f40b4636be8d0b7d42c7521081f Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 30 Oct 2011 15:47:29 +0000 Subject: IRC: Use file-transfer accessor function. s --- libpurple/protocols/irc/dcc_send.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/irc/dcc_send.c b/libpurple/protocols/irc/dcc_send.c index 309193e585..132bfceef9 100644 --- a/libpurple/protocols/irc/dcc_send.c +++ b/libpurple/protocols/irc/dcc_send.c @@ -258,8 +258,8 @@ static void irc_dccsend_send_connected(gpointer data, int source, PurpleInputCon return; } - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); close(xd->fd); xd->fd = -1; @@ -313,8 +313,8 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) port = purple_network_get_port_from_fd(sock); purple_debug_misc("irc", "port is %hu\n", port); /* Monitor the listening socket */ - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - irc_dccsend_send_connected, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(sock, PURPLE_INPUT_READ, + irc_dccsend_send_connected, xfer)); /* Send the intended recipient the DCC request */ arg[0] = purple_xfer_get_remote_user(xfer); -- cgit v1.2.1 From 5fadc2a44445266cfe6d8db10eb24fc0eb9c70c5 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 30 Oct 2011 15:52:45 +0000 Subject: Jabber: Use file-transfer accessor functions --- libpurple/protocols/jabber/oob.c | 6 ++--- libpurple/protocols/jabber/si.c | 56 ++++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c index 61b97a3833..e32a59fcc9 100644 --- a/libpurple/protocols/jabber/oob.c +++ b/libpurple/protocols/jabber/oob.c @@ -119,10 +119,10 @@ static void jabber_oob_xfer_start(PurpleXfer *xfer) jox->written_len = 0; } - jox->writeh = purple_input_add(xfer->fd, PURPLE_INPUT_WRITE, + jox->writeh = purple_input_add(purple_xfer_get_fd(xfer), PURPLE_INPUT_WRITE, jabber_oob_xfer_request_send, xfer); - jabber_oob_xfer_request_send(xfer, xfer->fd, PURPLE_INPUT_WRITE); + jabber_oob_xfer_request_send(xfer, purple_xfer_get_fd(xfer), PURPLE_INPUT_WRITE); } static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) { @@ -131,7 +131,7 @@ static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) { char *tmp, *lenstr; int len; - if((len = read(xfer->fd, test, sizeof(test))) > 0) { + if((len = read(purple_xfer_get_fd(xfer), test, sizeof(test))) > 0) { jox->headers = g_string_append_len(jox->headers, test, len); if((tmp = strstr(jox->headers->str, "\r\n\r\n"))) { *tmp = '\0'; diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index 8afbfdc881..c97988042b 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -393,8 +393,8 @@ jabber_si_xfer_bytestreams_send_read_again_resp_cb(gpointer data, gint source, if (jsx->rxlen < jsx->rxmaxlen) return; - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); g_free(jsx->rxqueue); jsx->rxqueue = NULL; @@ -462,8 +462,8 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) return; - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); dstaddr = g_strdup_printf("%s%s@%s/%s%s", jsx->stream_id, jsx->js->user->node, jsx->js->user->domain, @@ -508,8 +508,8 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, jsx->rxqueue[5+strlen(host)] = 0x00; jsx->rxqueue[6+strlen(host)] = 0x00; - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - jabber_si_xfer_bytestreams_send_read_again_resp_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, + jabber_si_xfer_bytestreams_send_read_again_resp_cb, xfer)); jabber_si_xfer_bytestreams_send_read_again_resp_cb(xfer, source, PURPLE_INPUT_WRITE); } @@ -539,9 +539,9 @@ jabber_si_xfer_bytestreams_send_read_response_cb(gpointer data, gint source, /* If we sent a "Success", wait for a response, otherwise give up and cancel */ if (jsx->rxqueue[1] == 0x00) { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_read_again_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_READ, + jabber_si_xfer_bytestreams_send_read_again_cb, xfer)); g_free(jsx->rxqueue); jsx->rxqueue = NULL; jsx->rxlen = 0; @@ -563,7 +563,7 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_read_cb\n"); - xfer->fd = source; + purple_xfer_set_fd(xfer, source); /** Try to read the SOCKS5 header */ if(jsx->rxlen < 2) { @@ -619,10 +619,10 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, jsx->rxqueue = g_malloc(jsx->rxmaxlen); jsx->rxqueue[0] = 0x05; jsx->rxqueue[1] = 0x00; - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, jabber_si_xfer_bytestreams_send_read_response_cb, - xfer); + xfer)); jabber_si_xfer_bytestreams_send_read_response_cb(xfer, source, PURPLE_INPUT_WRITE); jsx->rxqueue = NULL; @@ -637,9 +637,9 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, jsx->rxqueue = g_malloc(jsx->rxmaxlen); jsx->rxqueue[0] = 0x05; jsx->rxqueue[1] = 0xFF; - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - jabber_si_xfer_bytestreams_send_read_response_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, + jabber_si_xfer_bytestreams_send_read_response_cb, xfer)); jabber_si_xfer_bytestreams_send_read_response_cb(xfer, source, PURPLE_INPUT_WRITE); } @@ -674,7 +674,7 @@ jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source, return; } - purple_input_remove(xfer->watcher); + purple_input_remove(purple_xfer_get_watcher(xfer)); close(source); jsx->local_streamhost_fd = -1; @@ -684,8 +684,8 @@ jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source, fcntl(acceptfd, F_SETFD, FD_CLOEXEC); #endif - xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_read_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(acceptfd, PURPLE_INPUT_READ, + jabber_si_xfer_bytestreams_send_read_cb, xfer)); } static void @@ -761,7 +761,7 @@ jabber_si_connect_proxy_cb(JabberStream *js, const char *from, jsx->js->user->domain, jsx->js->user->resource); if (!strcmp(jid, my_jid)) { purple_debug_info("jabber", "Got local SOCKS5 streamhost-used.\n"); - purple_xfer_start(xfer, xfer->fd, NULL, -1); + purple_xfer_start(xfer, purple_xfer_get_fd(xfer), NULL, -1); } else { /* if available, try to revert to IBB... */ if (jsx->stream_method & STREAM_METHOD_IBB) { @@ -785,9 +785,9 @@ jabber_si_connect_proxy_cb(JabberStream *js, const char *from, } /* Clean up the local streamhost - it isn't going to be used.*/ - if (xfer->watcher > 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + if (purple_xfer_get_watcher(xfer) > 0) { + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); } if (jsx->local_streamhost_fd >= 0) { close(jsx->local_streamhost_fd); @@ -845,7 +845,7 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) jid = g_strdup_printf("%s@%s/%s", jsx->js->user->node, jsx->js->user->domain, jsx->js->user->resource); - xfer->local_port = purple_network_get_port_from_fd(sock); + purple_xfer_set_local_port(xfer, purple_network_get_port_from_fd(sock)); g_snprintf(port, sizeof(port), "%hu", purple_xfer_get_local_port(xfer)); public_ip = purple_network_get_my_ip(jsx->js->fd); @@ -876,8 +876,8 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) g_free(jid); /* The listener for the local proxy */ - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_connected_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(sock, PURPLE_INPUT_READ, + jabber_si_xfer_bytestreams_send_connected_cb, xfer)); } for (tmp = jsx->js->bs_proxies; tmp; tmp = tmp->next) { @@ -1304,9 +1304,9 @@ static void jabber_si_xfer_free(PurpleXfer *xfer) jabber_iq_remove_callback_by_id(js, jsx->iq_id); if (jsx->local_streamhost_fd >= 0) close(jsx->local_streamhost_fd); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xfer->fd >= 0) { + if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && purple_xfer_get_fd(xfer) >= 0) { purple_debug_info("jabber", "remove port mapping\n"); - purple_network_remove_port_mapping(xfer->fd); + purple_network_remove_port_mapping(purple_xfer_get_fd(xfer)); } if (jsx->connect_timeout > 0) purple_timeout_remove(jsx->connect_timeout); -- cgit v1.2.1 From 906d3e7a1fcf6c765d38f4348bd09d11cd3041a3 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 30 Oct 2011 15:55:56 +0000 Subject: Oscar: Use file-transfer accessor functions --- libpurple/protocols/oscar/oft.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libpurple/protocols/oscar/oft.c b/libpurple/protocols/oscar/oft.c index 88665b0f61..49cbcb06da 100644 --- a/libpurple/protocols/oscar/oft.c +++ b/libpurple/protocols/oscar/oft.c @@ -508,7 +508,7 @@ peer_oft_recv_frame_done(PeerConnection *conn, OftFrame *frame) purple_input_remove(conn->watcher_incoming); conn->watcher_incoming = 0; - conn->xfer->fd = conn->fd; + purple_xfer_set_fd(conn->xfer, conn->fd); conn->fd = -1; conn->disconnect_reason = OSCAR_DISCONNECT_DONE; peer_connection_schedule_destroy(conn, conn->disconnect_reason, NULL); @@ -602,8 +602,8 @@ peer_oft_recvcb_end(PurpleXfer *xfer) conn = purple_xfer_get_protocol_data(xfer); /* Tell the other person that we've received everything */ - conn->fd = conn->xfer->fd; - conn->xfer->fd = -1; + conn->fd = purple_xfer_get_fd(conn->xfer); + purple_xfer_set_fd(conn->xfer, -1); peer_oft_send_done(conn); conn->disconnect_reason = OSCAR_DISCONNECT_DONE; @@ -721,9 +721,9 @@ peer_oft_sendcb_ack(PurpleXfer *xfer, const guchar *buffer, size_t size) */ if (purple_xfer_get_bytes_remaining(xfer) <= 0) { - purple_input_remove(xfer->watcher); - conn->fd = xfer->fd; - xfer->fd = -1; + purple_input_remove(purple_xfer_get_watcher(xfer)); + conn->fd = purple_xfer_get_fd(xfer); + purple_xfer_set_fd(xfer, -1); conn->watcher_incoming = purple_input_add(conn->fd, PURPLE_INPUT_READ, peer_connection_recv_cb, conn); } -- cgit v1.2.1 From b35bcfa928d2e6c9d24b5cd9050f4748ca147330 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 30 Oct 2011 15:56:56 +0000 Subject: Sametime: Use file-transfer accessor functions --- libpurple/protocols/sametime/sametime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 805ef16602..8d1841ebe3 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -2351,7 +2351,7 @@ static void mw_ft_ack(struct mwFileTransfer *ft) { xfer = mwFileTransfer_getClientData(ft); g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->watcher == 0); + g_return_if_fail(purple_xfer_get_watcher(xfer) == 0); if(! mwFileTransfer_getRemaining(ft)) { purple_xfer_set_completed(xfer, TRUE); -- cgit v1.2.1 From 0f341c7c08640e19ed422d294c61eda149b12f9c Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 30 Oct 2011 15:58:20 +0000 Subject: Silc: Use file-transfer accessor functions --- libpurple/protocols/silc/ft.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libpurple/protocols/silc/ft.c b/libpurple/protocols/silc/ft.c index e7dc831d9c..fabae1c0a2 100644 --- a/libpurple/protocols/silc/ft.c +++ b/libpurple/protocols/silc/ft.c @@ -86,7 +86,7 @@ silcpurple_ftp_monitor(SilcClient client, purple_notify_error(gc, _("Secure File Transfer"), _("Error during file transfer"), _("Remote disconnected")); - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE; + purple_xfer_set_status(xfer->xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE); purple_xfer_update_progress(xfer->xfer); silc_client_file_close(client, conn, session_id); return; @@ -122,7 +122,7 @@ silcpurple_ftp_monitor(SilcClient client, _("Error during file transfer"), _("File transfer session does not exist")); } - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE; + purple_xfer_set_status(xfer->xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE); purple_xfer_update_progress(xfer->xfer); silc_client_file_close(client, conn, session_id); return; @@ -154,7 +154,7 @@ silcpurple_ftp_cancel(PurpleXfer *x) if (!xfer) return; - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; + purple_xfer_set_status(xfer->xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); purple_xfer_update_progress(xfer->xfer); silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); } -- cgit v1.2.1 From a8deb5e90d446f7c904b0048bedb7438bb382b86 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 30 Oct 2011 16:00:14 +0000 Subject: Yahoo: Use file-transfer accessor functions. --- libpurple/protocols/yahoo/yahoo_filexfer.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index 8bb223a9df..1b0ff85187 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -169,7 +169,7 @@ static void yahoo_receivefile_connected(gpointer data, gint source, const gchar return; } - xfer->fd = source; + purple_xfer_set_fd(xfer, source); /* The first time we get here, assemble the tx buffer */ if (xd->txbuflen == 0) { @@ -250,7 +250,7 @@ static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *er return; } - xfer->fd = source; + purple_xfer_set_fd(xfer, source); /* Assemble the tx buffer */ gc = xd->gc; @@ -340,7 +340,7 @@ static void yahoo_xfer_init(PurpleXfer *xfer) } } } else { - xfer->fd = -1; + purple_xfer_set_fd(xfer, -1); if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, yahoo_receivefile_connected, xfer) == NULL) { purple_notify_error(gc, NULL, _("File Transfer Failed"), @@ -437,7 +437,7 @@ static gssize yahoo_xfer_read(guchar **buffer, PurpleXfer *xfer) return 0; } - len = read(xfer->fd, buf, sizeof(buf)); + len = read(purple_xfer_get_fd(xfer), buf, sizeof(buf)); if (len <= 0) { if ((purple_xfer_get_size(xfer) > 0) && @@ -500,7 +500,7 @@ static gssize yahoo_xfer_write(const guchar *buffer, size_t size, PurpleXfer *xf return -1; } - len = write(xfer->fd, buffer, size); + len = write(purple_xfer_get_fd(xfer), buffer, size); if (len == -1) { if (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer)) @@ -612,9 +612,10 @@ static void yahoo_p2p_ft_server_send_OK(PurpleXfer *xfer) { char *tx = NULL; int written; + int fd = purple_xfer_get_fd(xfer); tx = "HTTP/1.1 200 OK\r\nContent-Length: 0\r\nContent-Type: application/octet-stream\r\nConnection: close\r\n\r\n"; - written = write(xfer->fd, tx, strlen(tx)); + written = write(fd, tx, strlen(tx)); if (written < 0 && errno == EAGAIN) written = 0; @@ -622,8 +623,8 @@ static void yahoo_p2p_ft_server_send_OK(PurpleXfer *xfer) purple_debug_info("yahoo", "p2p filetransfer: Unable to write HTTP OK"); /* close connection */ - close(xfer->fd); - xfer->fd = -1; + close(fd); + purple_xfer_set_fd(xfer, -1); } static void yahoo_xfer_end(PurpleXfer *xfer_old) @@ -639,7 +640,7 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) && xfer_data->filename_list) { /* Send HTTP OK in case of p2p transfer, when we act as server */ - if((xfer_data->xfer_url != NULL) && (xfer_old->fd >=0) && (purple_xfer_get_status(xfer_old) == PURPLE_XFER_STATUS_DONE)) + if((xfer_data->xfer_url != NULL) && (purple_xfer_get_fd(xfer_old) >=0) && (purple_xfer_get_status(xfer_old) == PURPLE_XFER_STATUS_DONE)) yahoo_p2p_ft_server_send_OK(xfer_old); /* removing top of filename & size list completely */ @@ -1195,13 +1196,13 @@ static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputConditi else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == HEAD_REPLY_RECEIVED) { xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; + purple_xfer_set_fd(xfer, source); purple_xfer_start(xfer, source, NULL, 0); } else if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && (xd->status_15 == ACCEPTED || xd->status_15 == P2P_GET_REQUESTED) ) { xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; + purple_xfer_set_fd(xfer, source); /* Remove Read event */ purple_input_remove(xd->input_event); xd->input_event = 0; @@ -1214,7 +1215,7 @@ static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputConditi purple_input_remove(xd->input_event); xd->input_event = 0; close(source); - xfer->fd = -1; + purple_xfer_set_fd(xfer, -1); /* start local server, listen for connections */ purple_network_listen(xd->yahoo_local_p2p_ft_server_port, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_ft_server_listen_cb, xfer); } @@ -1377,7 +1378,7 @@ static void yahoo_p2p_ft_POST_cb(gpointer data, gint source, PurpleInputConditio purple_input_remove(xd->input_event); xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; + purple_xfer_set_fd(xfer, source); purple_xfer_start(xfer, source, NULL, 0); } @@ -1478,7 +1479,7 @@ static void yahoo_p2p_ft_server_send_connected_cb(gpointer data, gint source, Pu close(xd->yahoo_local_p2p_ft_server_fd); /* Add an Input Read event to the file descriptor */ - xfer->fd = acceptfd; + purple_xfer_set_fd(xfer, acceptfd); if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_POST_cb, data); else -- cgit v1.2.1 From 964bd28e6ed4b294b65ec745663640b2180c83ce Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 30 Oct 2011 16:54:03 +0000 Subject: Hide struct PurpleWhiteboard. --- ChangeLog.API | 1 + libpurple/whiteboard.c | 17 +++++++++++++++++ libpurple/whiteboard.h | 19 +++---------------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index acf2254fa0..2e06e642ee 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -229,6 +229,7 @@ version 3.0.0 (??/??/????): * struct _PurpleRoomlist * struct _PurpleRoomlistField * struct _PurpleRoomlistRoom + * struct _PurpleWhiteboard * struct PurpleAccountOption * struct PurpleAccountUserSplit * struct PurpleNotifySearchColumn diff --git a/libpurple/whiteboard.c b/libpurple/whiteboard.c index 995e376a56..3390819e18 100644 --- a/libpurple/whiteboard.c +++ b/libpurple/whiteboard.c @@ -25,6 +25,23 @@ #include "whiteboard.h" #include "prpl.h" +/** + * A PurpleWhiteboard + */ +struct _PurpleWhiteboard +{ + int state; /**< State of whiteboard session */ + + PurpleAccount *account; /**< Account associated with this session */ + char *who; /**< Name of the remote user */ + + void *ui_data; /**< Graphical user-interface data */ + void *proto_data; /**< Protocol specific data */ + PurpleWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */ + + GList *draw_list; /**< List of drawing elements/deltas to send */ +}; + /****************************************************************************** * Globals *****************************************************************************/ diff --git a/libpurple/whiteboard.h b/libpurple/whiteboard.h index 2c4144d737..bd2d4fdfad 100644 --- a/libpurple/whiteboard.h +++ b/libpurple/whiteboard.h @@ -26,6 +26,9 @@ #ifndef _PURPLE_WHITEBOARD_H_ #define _PURPLE_WHITEBOARD_H_ +/** @copydoc _PurpleWhiteboard */ +typedef struct _PurpleWhiteboard PurpleWhiteboard; + /** * Whiteboard PRPL Operations */ @@ -33,22 +36,6 @@ typedef struct _PurpleWhiteboardPrplOps PurpleWhiteboardPrplOps; #include "account.h" -/** - * A PurpleWhiteboard - */ -typedef struct _PurpleWhiteboard -{ - int state; /**< State of whiteboard session */ - - PurpleAccount *account; /**< Account associated with this session */ - char *who; /**< Name of the remote user */ - - void *ui_data; /**< Graphical user-interface data */ - void *proto_data; /**< Protocol specific data */ - PurpleWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */ - - GList *draw_list; /**< List of drawing elements/deltas to send */ -} PurpleWhiteboard; /** * The PurpleWhiteboard UI Operations -- cgit v1.2.1 From 092b4c71f2dcf7889173891f4c7047fbb3704225 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 30 Oct 2011 21:46:51 +0000 Subject: Use the PurpleBuddy accessor functions. --- pidgin/gtkblist.c | 76 ++++++++++++++++++++++++++--------------------------- pidgin/gtkconv.c | 14 +++++----- pidgin/gtkdialogs.c | 22 ++++++++-------- pidgin/gtkpounce.c | 6 ++--- pidgin/gtkutils.c | 6 ++--- 5 files changed, 62 insertions(+), 62 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 1011c0168c..27bb484fdf 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -1521,7 +1521,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) if (prpl_info && prpl_info->send_file) { if (!prpl_info->can_receive_file || - prpl_info->can_receive_file(purple_account_get_connection(buddy->account), buddy->name)) + prpl_info->can_receive_file(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy))) { pidgin_new_item_from_stock(menu, _("_Send File..."), PIDGIN_STOCK_TOOLBAR_SEND_FILE, @@ -1549,7 +1549,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL); } - pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(buddy->account), node); + pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(purple_buddy_get_account(buddy)), node); pidgin_append_blist_node_extended_menu(menu, node); if (!contact_expanded && contact != NULL) @@ -1602,7 +1602,7 @@ gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) return FALSE; } if(buddy) - pidgin_retrieve_user_info(purple_account_get_connection(buddy->account), buddy->name); + pidgin_retrieve_user_info(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy)); } else { switch (event->keyval) { case GDK_F2: @@ -1840,13 +1840,13 @@ create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) if(buddy == b) continue; - if(!purple_account_get_connection(buddy->account)) + if(!purple_account_get_connection(purple_buddy_get_account(buddy))) continue; if(!show_offline && !PURPLE_BUDDY_IS_ONLINE(buddy)) continue; - menuitem = gtk_image_menu_item_new_with_label(buddy->name); - buf = pidgin_create_prpl_icon(buddy->account,PIDGIN_PRPL_ICON_SMALL); + menuitem = gtk_image_menu_item_new_with_label(purple_buddy_get_name(buddy)); + buf = pidgin_create_prpl_icon(purple_buddy_get_account(buddy), PIDGIN_PRPL_ICON_SMALL); image = gtk_image_new_from_pixbuf(buf); g_object_unref(G_OBJECT(buf)); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), @@ -1964,12 +1964,12 @@ gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_da else b = (PurpleBuddy *)node; - prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b))); if (prpl != NULL) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); if (prpl && prpl_info->get_info) - pidgin_retrieve_user_info(purple_account_get_connection(b->account), b->name); + pidgin_retrieve_user_info(purple_account_get_connection(purple_buddy_get_account(b)), purple_buddy_get_name(b)); handled = TRUE; } @@ -2294,7 +2294,7 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, buddy = (PurpleBuddy *)node; } - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); if (gc == NULL) { @@ -2303,7 +2303,7 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, } protocol = - PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->list_icon(buddy->account, + PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->list_icon(purple_buddy_get_account(buddy), buddy); str = g_string_new(NULL); @@ -2313,13 +2313,13 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, "X-IM-Protocol: %s\r\n" "X-IM-Username: %s\r\n", protocol, - buddy->name); + purple_buddy_get_name(buddy)); - if (buddy->alias != NULL) + if (purple_buddy_get_local_buddy_alias(buddy) != NULL) { g_string_append_printf(str, "X-IM-Alias: %s\r\n", - buddy->alias); + purple_buddy_get_local_buddy_alias(buddy)); } g_string_append(str, "\r\n"); @@ -2602,7 +2602,7 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) { PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node)); - pidgin_dnd_file_manage(sd, b->account, b->name); + pidgin_dnd_file_manage(sd, purple_buddy_get_account(b), purple_buddy_get_name(b)); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } else { gtk_drag_finish(dc, FALSE, FALSE, t); @@ -2702,7 +2702,7 @@ static GdkPixbuf *pidgin_blist_get_buddy_icon(PurpleBlistNode *node, if (data == NULL) { if (buddy) { /* Not sure I like this...*/ - if (!(icon = purple_buddy_icons_find(buddy->account, buddy->name))) + if (!(icon = purple_buddy_icons_find(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)))) return NULL; data = purple_buddy_icon_get_data(icon, &len); } @@ -2872,7 +2872,7 @@ static struct tooltip_data * create_tip_for_node(PurpleBlistNode *node, gboolean char *tmp = NULL, *node_name = NULL, *tooltip_text = NULL; if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - account = ((PurpleBuddy*)(node))->account; + account = purple_buddy_get_account((PurpleBuddy*)(node)); } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { account = ((PurpleChat*)(node))->account; } @@ -3205,8 +3205,8 @@ static gboolean buddy_is_displayable(PurpleBuddy *buddy) gtknode = ((PurpleBlistNode*)buddy)->ui_data; - return (purple_account_is_connected(buddy->account) && - (purple_presence_is_online(buddy->presence) || + return (purple_account_is_connected(purple_buddy_get_account(buddy)) && + (purple_presence_is_online(purple_buddy_get_presence(buddy)) || (gtknode && gtknode->recent_signonoff) || purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies") || purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline"))); @@ -3766,7 +3766,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) c = purple_buddy_get_contact(b); } - prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b))); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); presence = purple_buddy_get_presence(b); @@ -3783,12 +3783,12 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) /* Alias */ /* If there's not a contact alias, the node is being displayed with * this alias, so there's no point in showing it in the tooltip. */ - if (full && c && b->alias != NULL && b->alias[0] != '\0' && + if (full && c && purple_buddy_get_local_buddy_alias(b) != NULL && purple_buddy_get_local_buddy_alias(b)[0] != '\0' && (c->alias != NULL && c->alias[0] != '\0') && - strcmp(c->alias, b->alias) != 0) + strcmp(c->alias, purple_buddy_get_local_buddy_alias(b)) != 0) { purple_notify_user_info_add_pair_plaintext(user_info, - _("Buddy Alias"), b->alias); + _("Buddy Alias"), purple_buddy_get_local_buddy_alias(b)); } /* Nickname/Server Alias */ @@ -3796,10 +3796,10 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) * alias, but many people on MSN set long nicknames, which * get ellipsized, so the only way to see the whole thing is * to look at the tooltip. */ - if (full && b->server_alias != NULL && b->server_alias[0] != '\0') + if (full && purple_buddy_get_server_alias(b)) { purple_notify_user_info_add_pair_plaintext(user_info, - _("Nickname"), b->server_alias); + _("Nickname"), purple_buddy_get_server_alias(b)); } /* Logged In */ @@ -3874,7 +3874,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Offline")); } - if (purple_account_is_connected(b->account) && + if (purple_account_is_connected(purple_buddy_get_account(b)) && prpl_info && prpl_info->tooltip_text) { /* Additional text from the PRPL */ @@ -3882,11 +3882,11 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) } /* These are Easter Eggs. Patches to remove them will be rejected. */ - if (!g_ascii_strcasecmp(b->name, "robflynn")) + if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "robflynn")) purple_notify_user_info_add_pair_plaintext(user_info, _("Description"), _("Spooky")); - if (!g_ascii_strcasecmp(b->name, "seanegn")) + if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "seanegn")) purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Awesome")); - if (!g_ascii_strcasecmp(b->name, "chipx86")) + if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "chipx86")) purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Rockin'")); tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n"); @@ -3989,7 +3989,7 @@ pidgin_blist_get_emblem(PurpleBlistNode *node) if (((struct _pidgin_blist_node*)(node->parent->ui_data))->contact_expanded) { if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) return NULL; - return pidgin_create_prpl_icon(((PurpleBuddy*)node)->account, PIDGIN_PRPL_ICON_SMALL); + return pidgin_create_prpl_icon(purple_buddy_get_account((PurpleBuddy*)node), PIDGIN_PRPL_ICON_SMALL); } } else { return NULL; @@ -3997,7 +3997,7 @@ pidgin_blist_get_emblem(PurpleBlistNode *node) g_return_val_if_fail(buddy != NULL, NULL); - if (!purple_privacy_check(buddy->account, purple_buddy_get_name(buddy))) { + if (!purple_privacy_check(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy))) { path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "blocked.png", NULL); return _pidgin_blist_get_cached_emblem(path); } @@ -4033,7 +4033,7 @@ pidgin_blist_get_emblem(PurpleBlistNode *node) return _pidgin_blist_get_cached_emblem(path); } - prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(buddy))); if (!prpl) return NULL; @@ -4097,7 +4097,7 @@ pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) PurplePlugin *prpl; if(buddy) - account = buddy->account; + account = purple_buddy_get_account(buddy); else account = chat->account; @@ -4232,12 +4232,12 @@ pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased if (!aliased || biglist) { /* Status Info */ - prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b))); if (prpl != NULL) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info && prpl_info->status_text && purple_account_get_connection(b->account)) { + if (prpl_info && prpl_info->status_text && purple_account_get_connection(purple_buddy_get_account(b))) { char *tmp = prpl_info->status_text(b); const char *end; @@ -6295,7 +6295,7 @@ static gboolean pidgin_blist_group_has_show_offline_buddy(PurpleGroup *group) if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { for(bnode = cnode->child; bnode; bnode = bnode->next) { PurpleBuddy *buddy = (PurpleBuddy *)bnode; - if (purple_account_is_connected(buddy->account) && + if (purple_account_is_connected(purple_buddy_get_account(buddy)) && purple_blist_node_get_bool(bnode, "show_offline")) return TRUE; } @@ -6527,7 +6527,7 @@ static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *n } } - prpl_icon = pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL); + prpl_icon = pidgin_create_prpl_icon(purple_buddy_get_account(buddy), PIDGIN_PRPL_ICON_SMALL); if (theme != NULL) color = pidgin_blist_theme_get_contact_color(theme); @@ -7828,7 +7828,7 @@ static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *bli PurpleBuddy *buddy; for (n = node->child; n; n = n->next) { buddy = (PurpleBuddy*)n; - activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account); + activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); } buddy_name = purple_contact_get_alias((PurpleContact*)node); } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) { @@ -7864,7 +7864,7 @@ static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *bli if(PURPLE_BLIST_NODE_IS_CONTACT(n)) { for (n2 = n->child; n2; n2 = n2->next) { buddy = (PurpleBuddy*)n2; - this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account); + this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); } this_buddy_name = purple_contact_get_alias((PurpleContact*)n); } else { diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index adab9b849d..29ab4a52ed 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -857,7 +857,7 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, else return; - if (strcmp(convprotocol, purple_account_get_protocol_id(buddy->account))) + if (strcmp(convprotocol, purple_account_get_protocol_id(purple_buddy_get_account(buddy)))) { purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL, _("That buddy is not on the same protocol as this " @@ -4530,7 +4530,7 @@ update_chat_alias(PurpleBuddy *buddy, PurpleConversation *conv, PurpleConnection if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) return; - normalized_name = g_strdup(purple_normalize(account, buddy->name)); + normalized_name = g_strdup(purple_normalize(account, purple_buddy_get_name(buddy))); do { char *name; @@ -4633,7 +4633,7 @@ buddy_cb_common(PurpleBuddy *buddy, PurpleConversation *conv, gboolean is_buddy) if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) return; - normalized_name = g_strdup(purple_normalize(purple_conversation_get_account(conv), buddy->name)); + normalized_name = g_strdup(purple_normalize(purple_conversation_get_account(conv), purple_buddy_get_name(buddy))); do { char *name; @@ -5565,7 +5565,7 @@ pidgin_conv_find_gtkconv(PurpleConversation * conv) for (bn = purple_blist_node_get_first_child(cn); bn; bn = purple_blist_node_get_sibling_next(bn)) { PurpleBuddy *b = PURPLE_BUDDY(bn); PurpleConversation *conv; - if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account))) { + if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(b), purple_buddy_get_account(b)))) { if (PIDGIN_CONVERSATION(conv)) return PIDGIN_CONVERSATION(conv); } @@ -7963,7 +7963,7 @@ get_gtkconv_with_contact(PurpleContact *contact) { PurpleBuddy *buddy = (PurpleBuddy*)node; PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (conv) return PIDGIN_CONVERSATION(conv); } @@ -8066,7 +8066,7 @@ update_buddy_idle_changed(PurpleBuddy *buddy, gboolean old, gboolean newidle) { PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (conv) pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON); } @@ -8076,7 +8076,7 @@ update_buddy_icon(PurpleBuddy *buddy) { PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (conv) pidgin_conv_update_fields(conv, PIDGIN_CONV_BUDDY_ICON); } diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 2e62e14f30..c43a42d59a 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -1127,10 +1127,10 @@ pidgin_dialogs_alias_buddy(PurpleBuddy *buddy) g_return_if_fail(buddy != NULL); - secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name); + secondary = g_strdup_printf(_("Enter an alias for %s."), purple_buddy_get_name(buddy)); purple_request_input(NULL, _("Alias Buddy"), NULL, - secondary, buddy->alias, FALSE, FALSE, NULL, + secondary, purple_buddy_get_local_buddy_alias(buddy), FALSE, FALSE, NULL, _("Alias"), G_CALLBACK(pidgin_dialogs_alias_buddy_cb), _("Cancel"), NULL, purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL, @@ -1169,8 +1169,8 @@ pidgin_dialogs_remove_contact_cb(PurpleContact *contact) group = (PurpleGroup*)cnode->parent; for (bnode = cnode->child; bnode; bnode = bnode->next) { PurpleBuddy *buddy = (PurpleBuddy*)bnode; - if (purple_account_is_connected(buddy->account)) - purple_account_remove_buddy(buddy->account, buddy, group); + if (purple_account_is_connected(purple_buddy_get_account(buddy))) + purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group); } purple_blist_remove_contact(contact); } @@ -1196,7 +1196,7 @@ pidgin_dialogs_remove_contact(PurpleContact *contact) "You are about to remove the contact containing %s " "and %d other buddies from your buddy list. Do you " "want to continue?", contact->totalsize - 1), - buddy->name, contact->totalsize - 1); + purple_buddy_get_name(buddy), contact->totalsize - 1); purple_request_action(contact, NULL, _("Remove Contact"), text, 0, NULL, purple_contact_get_alias(contact), NULL, @@ -1264,8 +1264,8 @@ pidgin_dialogs_remove_group_cb(PurpleGroup *group) if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) { buddy = (PurpleBuddy*)bnode; bnode = bnode->next; - if (purple_account_is_connected(buddy->account)) { - purple_account_remove_buddy(buddy->account, buddy, group); + if (purple_account_is_connected(purple_buddy_get_account(buddy))) { + purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group); purple_blist_remove_buddy(buddy); } } else { @@ -1313,10 +1313,10 @@ pidgin_dialogs_remove_buddy_cb(PurpleBuddy *buddy) PurpleAccount *account; group = purple_buddy_get_group(buddy); - name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */ - account = buddy->account; + name = g_strdup(purple_buddy_get_name(buddy)); /* purple_buddy_get_name() is a crasher after remove_buddy */ + account = purple_buddy_get_account(buddy); - purple_debug_info("blist", "Removing '%s' from buddy list.\n", buddy->name); + purple_debug_info("blist", "Removing '%s' from buddy list.\n", purple_buddy_get_name(buddy)); /* TODO - Should remove from blist first... then call purple_account_remove_buddy()? */ purple_account_remove_buddy(account, buddy, group); purple_blist_remove_buddy(buddy); @@ -1332,7 +1332,7 @@ pidgin_dialogs_remove_buddy(PurpleBuddy *buddy) g_return_if_fail(buddy != NULL); text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), - buddy->name); + purple_buddy_get_name(buddy)); purple_request_action(buddy, NULL, _("Remove Buddy"), text, 0, purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL, diff --git a/pidgin/gtkpounce.c b/pidgin/gtkpounce.c index c12dd81ffa..e1237e6a11 100644 --- a/pidgin/gtkpounce.c +++ b/pidgin/gtkpounce.c @@ -427,9 +427,9 @@ pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, dialog = (PidginPounceDialog *)data; - gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), buddy->name); - dialog->account = buddy->account; - pidgin_account_option_menu_set_selected(dialog->account_menu, buddy->account); + gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), purple_buddy_get_name(buddy)); + dialog->account = purple_buddy_get_account(buddy); + pidgin_account_option_menu_set_selected(dialog->account_menu, purple_buddy_get_account(buddy)); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 487c7b99b1..8e066d4bdf 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -2134,8 +2134,8 @@ add_completion_list(PidginCompletionData *data) add_buddyname_autocomplete_entry(data->store, ((PurpleContact *)cnode)->alias, purple_buddy_get_contact_alias(entry.entry.buddy), - entry.entry.buddy->account, - entry.entry.buddy->name + purple_buddy_get_account(entry.entry.buddy), + purple_buddy_get_name(entry.entry.buddy) ); } } @@ -2227,7 +2227,7 @@ pidgin_screenname_autocomplete_default_filter(const PidginBuddyCompletionEntry * gboolean all = GPOINTER_TO_INT(all_accounts); if (completion_entry->is_buddy) { - return all || purple_account_is_connected(completion_entry->entry.buddy->account); + return all || purple_account_is_connected(purple_buddy_get_account(completion_entry->entry.buddy)); } else { return all || (completion_entry->entry.logged_buddy->account != NULL && purple_account_is_connected(completion_entry->entry.logged_buddy->account)); } -- cgit v1.2.1 From 9bb3b748fbfa3cad8318bd7d3939330a1d4dc287 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 31 Oct 2011 02:29:14 +0000 Subject: Remove a period from a phrase that appears in the status bar of active calls --- pidgin/gtkmedia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c index 83577f191c..ecf46710d3 100644 --- a/pidgin/gtkmedia.c +++ b/pidgin/gtkmedia.c @@ -969,7 +969,7 @@ pidgin_media_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED); pidgin_media_emit_message(gtkmedia, _("Call in progress.")); gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar), - 0, _("Call in progress.")); + 0, _("Call in progress")); gtk_widget_show(GTK_WIDGET(gtkmedia)); } } -- cgit v1.2.1 From 4be9c7e058022a5f6bdb4f544c9f2a95559e4953 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 31 Oct 2011 19:00:39 +0000 Subject: Use the purple_group_get_name() accessor function. --- pidgin/gtkblist.c | 12 +++++------- pidgin/gtkdialogs.c | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 27bb484fdf..3582ec5cf1 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -2113,7 +2113,7 @@ add_buddies_from_vcard(const char *prpl_id, PurpleGroup *group, GList *list, for (l = list; l != NULL; l = l->next) { purple_blist_request_add_buddy(account, l->data, - (group ? group->name : NULL), + (group ? purple_group_get_name(group) : NULL), alias); } } @@ -2535,7 +2535,7 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, else { purple_blist_request_add_buddy(account, username, - (group ? group->name : NULL), + (group ? purple_group_get_name(group) : NULL), alias); } } @@ -6435,7 +6435,7 @@ static char *pidgin_get_group_title(PurpleBlistNode *gnode, gboolean expanded) text_color = selected ? NULL : theme_font_get_color_default(pair, NULL); text_font = theme_font_get_face_default(pair, ""); - esc = g_markup_escape_text(group->name, -1); + esc = g_markup_escape_text(purple_group_get_name(group), -1); if (text_color) { mark = g_strdup_printf("%s%s%s%s", text_color, text_font, @@ -6909,7 +6909,6 @@ static GList * groups_tree(void) { static GList *list = NULL; - char *tmp2; PurpleGroup *g; PurpleBlistNode *gnode; @@ -6929,8 +6928,7 @@ groups_tree(void) if (PURPLE_BLIST_NODE_IS_GROUP(gnode)) { g = (PurpleGroup *)gnode; - tmp2 = g->name; - list = g_list_append(list, tmp2); + list = g_list_append(list, (char *) purple_group_get_name(g)); } } } @@ -7265,7 +7263,7 @@ pidgin_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, if (name != NULL) gtk_widget_grab_focus(data->alias_entry); - data->group_combo = pidgin_text_combo_box_entry_new(group ? group->name : NULL, groups_tree()); + data->group_combo = pidgin_text_combo_box_entry_new(group ? purple_group_get_name(group) : NULL, groups_tree()); pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Group:"), data->chat_data.rq_data.sg, data->group_combo, TRUE, NULL); diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index c43a42d59a..ce2d089cde 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -1233,7 +1233,7 @@ pidgin_dialogs_merge_groups(PurpleGroup *source, const char *new_name) text = g_strdup_printf( _("You are about to merge the group called %s into the group " - "called %s. Do you want to continue?"), source->name, new_name); + "called %s. Do you want to continue?"), purple_group_get_name(source), new_name); ggp = g_new(struct _PidginGroupMergeObject, 1); ggp->parent = source; @@ -1293,7 +1293,7 @@ pidgin_dialogs_remove_group(PurpleGroup *group) g_return_if_fail(group != NULL); text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"), - group->name); + purple_group_get_name(group)); purple_request_action(group, NULL, _("Remove Group"), text, 0, NULL, NULL, NULL, -- cgit v1.2.1 From 486af63dec9465d245ac3e315fde5784711f720e Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 31 Oct 2011 19:21:14 +0000 Subject: Use the PurpleChat accessor functions. --- pidgin/gtkblist.c | 28 ++++++++++++++-------------- pidgin/gtkconv.c | 4 ++-- pidgin/gtkdialogs.c | 6 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 3582ec5cf1..4fc60bc01c 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -1755,7 +1755,7 @@ create_chat_menu(PurpleBlistNode *node, PurpleChat *c) pidgin_new_item_from_stock(menu, _("View _Log"), NULL, G_CALLBACK(gtk_blist_menu_showlog_cb), node, 0, 0, NULL); - pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(c->account), node); + pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(purple_chat_get_account(c)), node); pidgin_append_blist_node_extended_menu(menu, node); pidgin_separator(menu); @@ -2874,7 +2874,7 @@ static struct tooltip_data * create_tip_for_node(PurpleBlistNode *node, gboolean if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { account = purple_buddy_get_account((PurpleBuddy*)(node)); } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { - account = ((PurpleChat*)(node))->account; + account = purple_chat_get_account((PurpleChat*)(node)); } td->padding = TOOLTIP_BORDER; @@ -3677,13 +3677,13 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) PidginBlistNode *bnode = node->ui_data; chat = (PurpleChat *)node; - prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_chat_get_account(chat))); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); connections = purple_connections_get_all(); if (connections && connections->next) { - tmp = g_markup_escape_text(purple_account_get_username(chat->account), -1); + tmp = g_markup_escape_text(purple_account_get_username(purple_chat_get_account(chat)), -1); g_string_append_printf(str, _("Account: %s"), tmp); g_free(tmp); } @@ -3693,12 +3693,12 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) } else { char *chat_name; if (prpl_info && prpl_info->get_chat_name) - chat_name = prpl_info->get_chat_name(chat->components); + chat_name = prpl_info->get_chat_name(purple_chat_get_components(chat)); else chat_name = g_strdup(purple_chat_get_name(chat)); conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chat_name, - chat->account); + purple_chat_get_account(chat)); g_free(chat_name); } @@ -3715,7 +3715,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) } if (prpl_info && prpl_info->chat_info != NULL) - cur = prpl_info->chat_info(purple_account_get_connection(chat->account)); + cur = prpl_info->chat_info(purple_account_get_connection(purple_chat_get_account(chat))); else cur = NULL; @@ -3724,13 +3724,13 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) pce = cur->data; if (!pce->secret && (!pce->required && - g_hash_table_lookup(chat->components, pce->identifier) == NULL)) + g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier) == NULL)) { tmp = purple_text_strip_mnemonic(pce->label); name = g_markup_escape_text(tmp, -1); g_free(tmp); value = g_markup_escape_text(g_hash_table_lookup( - chat->components, pce->identifier), -1); + purple_chat_get_components(chat), pce->identifier), -1); g_string_append_printf(str, "\n%s %s", name ? name : "", value ? value : ""); @@ -4099,7 +4099,7 @@ pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) if(buddy) account = purple_buddy_get_account(buddy); else - account = chat->account; + account = purple_chat_get_account(chat); prpl = purple_find_prpl(purple_account_get_protocol_id(account)); if(!prpl) @@ -6706,7 +6706,7 @@ static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *nod chat = (PurpleChat*)node; - if(purple_account_is_connected(chat->account)) { + if(purple_account_is_connected(purple_chat_get_account(chat))) { GtkTreeIter iter; GdkPixbuf *status, *avatar, *emblem, *prpl_icon; const gchar *color, *font; @@ -6770,7 +6770,7 @@ static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *nod g_free(mark); mark = tmp; - prpl_icon = pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL); + prpl_icon = pidgin_create_prpl_icon(purple_chat_get_account(chat), PIDGIN_PRPL_ICON_SMALL); if (theme != NULL) bgcolor = pidgin_blist_theme_get_contact_color(theme); @@ -7420,11 +7420,11 @@ static gboolean autojoin_cb(PurpleConnection *gc, gpointer data) chat = (PurpleChat *)cnode; - if(chat->account != account) + if(purple_chat_get_account(chat) != account) continue; if (purple_blist_node_get_bool((PurpleBlistNode*)chat, "gtk-autojoin")) - serv_join_chat(gc, chat->components); + serv_join_chat(gc, purple_chat_get_components(chat)); } } diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 29ab4a52ed..e21dab8ae7 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -4604,7 +4604,7 @@ blist_node_aliased_cb(PurpleBlistNode *node, const char *old_alias, PurpleConver else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) update_chat_alias((PurpleBuddy *)node, conv, gc, prpl_info); else if (PURPLE_BLIST_NODE_IS_CHAT(node) && - purple_conversation_get_account(conv) == ((PurpleChat*)node)->account) + purple_conversation_get_account(conv) == purple_chat_get_account((PurpleChat*)node)) { if (old_alias == NULL || g_utf8_collate(old_alias, purple_conversation_get_title(conv)) == 0) pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE); @@ -7999,7 +7999,7 @@ account_signed_off_cb(PurpleConnection *gc, gpointer event) if (prpl_info->chat_info_defaults != NULL) comps = prpl_info->chat_info_defaults(gc, purple_conversation_get_name(conv)); } else { - comps = chat->components; + comps = purple_chat_get_components(chat); } serv_join_chat(gc, comps); if (chat == NULL && comps != NULL) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index ce2d089cde..cde1f7b99c 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -1155,7 +1155,7 @@ pidgin_dialogs_alias_chat(PurpleChat *chat) chat->alias, FALSE, FALSE, NULL, _("Alias"), G_CALLBACK(pidgin_dialogs_alias_chat_cb), _("Cancel"), NULL, - chat->account, NULL, NULL, + purple_chat_get_account(chat), NULL, NULL, chat); } @@ -1275,7 +1275,7 @@ pidgin_dialogs_remove_group_cb(PurpleGroup *group) } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { PurpleChat *chat = (PurpleChat *)cnode; cnode = cnode->next; - if (purple_account_is_connected(chat->account)) + if (purple_account_is_connected(purple_chat_get_account(chat))) purple_blist_remove_chat(chat); } else { cnode = cnode->next; @@ -1362,7 +1362,7 @@ pidgin_dialogs_remove_chat(PurpleChat *chat) name ? name : ""); purple_request_action(chat, NULL, _("Remove Chat"), text, 0, - chat->account, NULL, NULL, + purple_chat_get_account(chat), NULL, NULL, chat, 2, _("_Remove Chat"), G_CALLBACK(pidgin_dialogs_remove_chat_cb), _("Cancel"), NULL); -- cgit v1.2.1 From 83a218ec6e79f8571bacdf1b1c6269106df6607d Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 31 Oct 2011 20:35:39 +0000 Subject: Add purple_contact_get_contact_size(). --- ChangeLog.API | 1 + finch/gntblist.c | 2 +- finch/plugins/grouping.c | 2 +- libpurple/blist.c | 7 +++++++ libpurple/blist.h | 9 +++++++++ pidgin/gtkdialogs.c | 4 ++-- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 2e06e642ee..20da49cc64 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -18,6 +18,7 @@ version 3.0.0 (??/??/????): * purple_conversation_set_ui_data * purple_conversation_message_get_alias * purple_conversation_message_get_conv + * purple_contact_get_contact_size * purple_notify_searchresult_column_get_title * purple_notify_searchresult_column_is_visible * purple_notify_searchresult_column_set_visible diff --git a/finch/gntblist.c b/finch/gntblist.c index 15c5e08070..387e9c7a89 100644 --- a/finch/gntblist.c +++ b/finch/gntblist.c @@ -1561,7 +1561,7 @@ finch_blist_remove_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node) if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { PurpleContact *c = (PurpleContact*)node; name = purple_contact_get_alias(c); - if (c->totalsize > 1) + if (purple_contact_get_contact_size(c, TRUE) > 1) sec = _("Removing this contact will also remove all the buddies in the contact"); } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { name = purple_buddy_get_name((PurpleBuddy*)node); diff --git a/finch/plugins/grouping.c b/finch/plugins/grouping.c index b312c7dc3b..18ebd4cbe0 100644 --- a/finch/plugins/grouping.c +++ b/finch/plugins/grouping.c @@ -54,7 +54,7 @@ static gboolean on_offline_can_add_node(PurpleBlistNode *node) case PURPLE_BLIST_CONTACT_NODE: { PurpleContact *contact = (PurpleContact*)node; - if (contact->currentsize > 0) + if (purple_contact_get_contact_size(contact, FALSE) > 0) return TRUE; return FALSE; } diff --git a/libpurple/blist.c b/libpurple/blist.c index 8d888c510d..e751febfc1 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -1774,6 +1774,13 @@ void purple_contact_invalidate_priority_buddy(PurpleContact *contact) contact->priority_valid = FALSE; } +int purple_contact_get_contact_size(PurpleContact *contact, gboolean offline) +{ + g_return_val_if_fail(contact != NULL, 0); + + return offline ? contact->totalsize : contact->currentsize; +} + PurpleGroup *purple_group_new(const char *name) { PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); diff --git a/libpurple/blist.h b/libpurple/blist.h index 64fa7e42fb..c7f9b636c5 100644 --- a/libpurple/blist.h +++ b/libpurple/blist.h @@ -755,6 +755,15 @@ gboolean purple_contact_on_account(PurpleContact *contact, PurpleAccount *accoun */ void purple_contact_invalidate_priority_buddy(PurpleContact *contact); +/** + * Determines the total size of a contact. + * + * @param contact The contact + * @param offline Count buddies in offline accounts + * @return The number of buddies in the contact + */ +int purple_contact_get_contact_size(PurpleContact *contact, gboolean offline); + /** * Removes a buddy from the buddy list and frees the memory allocated to it. * This doesn't actually try to remove the buddy from the server list. diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index cde1f7b99c..c24a3c1c05 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -1195,8 +1195,8 @@ pidgin_dialogs_remove_contact(PurpleContact *contact) "want to continue?", "You are about to remove the contact containing %s " "and %d other buddies from your buddy list. Do you " - "want to continue?", contact->totalsize - 1), - purple_buddy_get_name(buddy), contact->totalsize - 1); + "want to continue?", purple_contact_get_contact_size(contact, TRUE) - 1), + purple_buddy_get_name(buddy), purple_contact_get_contact_size(contact, TRUE) - 1); purple_request_action(contact, NULL, _("Remove Contact"), text, 0, NULL, purple_contact_get_alias(contact), NULL, -- cgit v1.2.1 From 6e346bc256b2937efebaf64eee72f27ab57cddb6 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 31 Oct 2011 20:44:22 +0000 Subject: Finch: Use purple_blist_node_get_ui_data() and purple_blist_node_set_ui_data(). --- finch/gntblist.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/finch/gntblist.c b/finch/gntblist.c index 387e9c7a89..31612b6f79 100644 --- a/finch/gntblist.c +++ b/finch/gntblist.c @@ -169,7 +169,7 @@ static gboolean default_can_add_node(PurpleBlistNode *node) if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { PurpleBuddy *buddy = (PurpleBuddy*)node; - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (!purple_buddy_get_contact(buddy)) return FALSE; /* When a new buddy is added and show-offline is set */ if (PURPLE_BUDDY_IS_ONLINE(buddy)) @@ -329,11 +329,11 @@ static GList *managers; static FinchBlistNode * create_finch_blist_node(PurpleBlistNode *node, gpointer row) { - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (!fnode) { fnode = g_new0(FinchBlistNode, 1); fnode->signed_timer = 0; - FINCH_SET_DATA(node, fnode); + purple_blist_node_set_ui_data(node, fnode); } fnode->row = row; return fnode; @@ -342,13 +342,13 @@ create_finch_blist_node(PurpleBlistNode *node, gpointer row) static void reset_blist_node_ui_data(PurpleBlistNode *node) { - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (fnode == NULL) return; if (fnode->signed_timer) purple_timeout_remove(fnode->signed_timer); g_free(fnode); - FINCH_SET_DATA(node, NULL); + purple_blist_node_set_ui_data(node, NULL); } static int @@ -381,7 +381,7 @@ static GntTextFormatFlags get_blist_node_flag(PurpleBlistNode *node) { GntTextFormatFlags flag = 0; - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (ggblist->tagged && g_list_find(ggblist->tagged, node)) flag |= GNT_TEXT_FLAG_BOLD; @@ -390,7 +390,7 @@ get_blist_node_flag(PurpleBlistNode *node) flag |= GNT_TEXT_FLAG_BLINK; else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); - fnode = FINCH_GET_DATA(node); + fnode = purple_blist_node_get_ui_data(node); if (fnode && fnode->signed_timer) flag |= GNT_TEXT_FLAG_BLINK; } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { @@ -406,7 +406,7 @@ get_blist_node_flag(PurpleBlistNode *node) node = purple_blist_node_get_sibling_next(node)) { PurpleBlistNode *pnode; pnode = purple_contact_get_priority_buddy((PurpleContact*)node); - fnode = FINCH_GET_DATA(node); + fnode = purple_blist_node_get_ui_data(node); if (fnode && fnode->signed_timer) { flag |= GNT_TEXT_FLAG_BLINK; break; @@ -433,7 +433,7 @@ is_contact_online(PurpleContact *contact) PurpleBlistNode *node; for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)contact)); node; node = purple_blist_node_get_sibling_next(node)) { - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node) || (fnode && fnode->signed_timer)) return TRUE; @@ -465,7 +465,7 @@ new_node(PurpleBlistNode *node) static void add_node(PurpleBlistNode *node, FinchBlist *ggblist) { - if (FINCH_GET_DATA(node)) + if (purple_blist_node_get_ui_data(node)) return; if (!ggblist->manager->can_add_node(node)) @@ -502,7 +502,7 @@ node_remove(PurpleBuddyList *list, PurpleBlistNode *node) FinchBlist *ggblist = FINCH_GET_DATA(list); PurpleBlistNode *parent; - if (ggblist == NULL || FINCH_GET_DATA(node) == NULL) + if (ggblist == NULL || purple_blist_node_get_ui_data(node) == NULL) return; if (PURPLE_BLIST_NODE_IS_GROUP(node) && ggblist->new_group) { @@ -543,7 +543,7 @@ node_update(PurpleBuddyList *list, PurpleBlistNode *node) if (ggblist->window == NULL) return; - if (FINCH_GET_DATA(node)!= NULL) { + if (purple_blist_node_get_ui_data(node)!= NULL) { gnt_tree_change_text(GNT_TREE(ggblist->tree), node, 0, get_display_name(node)); gnt_tree_sort_row(GNT_TREE(ggblist->tree), node); @@ -560,7 +560,7 @@ node_update(PurpleBuddyList *list, PurpleBlistNode *node) } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { add_node(node, FINCH_GET_DATA(list)); } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { - if (FINCH_GET_DATA(node)== NULL) { + if (purple_blist_node_get_ui_data(node)== NULL) { /* The core seems to expect the UI to add the buddies. */ for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node)) add_node(node, FINCH_GET_DATA(list)); @@ -839,7 +839,7 @@ add_group_cb(gpointer null, const char *group) /* Select the group */ if (ggblist->tree) { - FinchBlistNode *fnode = FINCH_GET_DATA((PurpleBlistNode*)grp); + FinchBlistNode *fnode = purple_blist_node_get_ui_data((PurpleBlistNode*)grp); if (!fnode) add_node((PurpleBlistNode*)grp, ggblist); gnt_tree_set_selected(GNT_TREE(ggblist->tree), grp); @@ -887,7 +887,7 @@ add_group(PurpleGroup *group, FinchBlist *ggblist) { gpointer parent; PurpleBlistNode *node = (PurpleBlistNode *)group; - if (FINCH_GET_DATA(node)) + if (purple_blist_node_get_ui_data(node)) return; parent = ggblist->manager->find_parent((PurpleBlistNode*)group); create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, @@ -960,7 +960,7 @@ add_chat(PurpleChat *chat, FinchBlist *ggblist) { gpointer parent; PurpleBlistNode *node = (PurpleBlistNode *)chat; - if (FINCH_GET_DATA(node)) + if (purple_blist_node_get_ui_data(node)) return; if (!purple_account_is_connected(purple_chat_get_account(chat))) return; @@ -979,7 +979,7 @@ add_contact(PurpleContact *contact, FinchBlist *ggblist) PurpleBlistNode *node = (PurpleBlistNode*)contact; const char *name; - if (FINCH_GET_DATA(node)) + if (purple_blist_node_get_ui_data(node)) return; name = get_display_name(node); @@ -1002,7 +1002,7 @@ add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist) PurpleBlistNode *node = (PurpleBlistNode *)buddy; PurpleContact *contact; - if (FINCH_GET_DATA(node)) + if (purple_blist_node_get_ui_data(node)) return; contact = purple_buddy_get_contact(buddy); @@ -2545,7 +2545,7 @@ static gboolean buddy_recent_signed_on_off(gpointer data) { PurpleBlistNode *node = data; - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); purple_timeout_remove(fnode->signed_timer); fnode->signed_timer = 0; @@ -2565,7 +2565,7 @@ static gboolean buddy_signed_on_off_cb(gpointer data) { PurpleBlistNode *node = data; - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (!ggblist || !fnode) return FALSE; -- cgit v1.2.1 From b39fef3deae7303ad364236b7bf9327fd880bb63 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 31 Oct 2011 21:27:32 +0000 Subject: Pidgin: Use the purple_blist_node_ accessor functions. --- pidgin/gtkblist.c | 116 +++++++++++++++++++++++++++--------------------------- 1 file changed, 57 insertions(+), 59 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 4fc60bc01c..e2f350b6ae 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -343,13 +343,13 @@ static void gtk_blist_menu_move_to_cb(GtkWidget *w, PurpleBlistNode *node) static void gtk_blist_menu_autojoin_cb(GtkWidget *w, PurpleChat *chat) { - purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin", + purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-autojoin", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); } static void gtk_blist_menu_persistent_cb(GtkWidget *w, PurpleChat *chat) { - purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-persistent", + purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-persistent", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); } @@ -1553,7 +1553,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) pidgin_append_blist_node_extended_menu(menu, node); if (!contact_expanded && contact != NULL) - pidgin_append_blist_node_move_to_menu(menu, (PurpleBlistNode *)contact); + pidgin_append_blist_node_move_to_menu(menu, PURPLE_BLIST_NODE(contact)); if (node->parent && node->parent->child->next && !sub && !contact_expanded) { @@ -1805,7 +1805,7 @@ create_contact_menu (PurpleBlistNode *node) static GtkWidget * create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) { - struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkWidget *menu; GtkWidget *menuitem; gboolean show_offline = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies"); @@ -1873,12 +1873,10 @@ pidgin_blist_show_context_menu(PurpleBlistNode *node, guint button, guint32 time) { - struct _pidgin_blist_node *gtknode; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkWidget *menu = NULL; gboolean handled = FALSE; - gtknode = (struct _pidgin_blist_node *)node->ui_data; - /* Create a menu based on the thing we right-clicked on */ if (PURPLE_BLIST_NODE_IS_GROUP(node)) { PurpleGroup *g = (PurpleGroup *)node; @@ -1940,7 +1938,7 @@ gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_da return FALSE; gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); - gtknode = (struct _pidgin_blist_node *)node->ui_data; + gtknode = purple_blist_node_get_ui_data(node); /* Right click draws a context menu */ if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) { @@ -2358,7 +2356,7 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, &iter, path); gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); - gtknode = node->ui_data; + gtknode = purple_blist_node_get_ui_data(node); if (PURPLE_BLIST_NODE_IS_CONTACT(n)) { PurpleContact *c = (PurpleContact*)n; @@ -2689,7 +2687,7 @@ static GdkPixbuf *pidgin_blist_get_buddy_icon(PurpleBlistNode *node, * a contact then this is a group or some other type of node and we * want to use that directly. */ if (contact) { - custom_img = purple_buddy_icons_node_find_custom_icon((PurpleBlistNode*)contact); + custom_img = purple_buddy_icons_node_find_custom_icon(PURPLE_BLIST_NODE(contact)); } else { custom_img = purple_buddy_icons_node_find_custom_icon(node); } @@ -3174,7 +3172,7 @@ static gboolean pidgin_blist_expand_timeout(GtkWidget *tv) return FALSE; } - gtknode = node->ui_data; + gtknode = purple_blist_node_get_ui_data(node); if (!gtknode->contact_expanded) { GtkTreeIter i; @@ -3203,13 +3201,13 @@ static gboolean buddy_is_displayable(PurpleBuddy *buddy) if(!buddy) return FALSE; - gtknode = ((PurpleBlistNode*)buddy)->ui_data; + gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); return (purple_account_is_connected(purple_buddy_get_account(buddy)) && (purple_presence_is_online(purple_buddy_get_presence(buddy)) || (gtknode && gtknode->recent_signonoff) || purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies") || - purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline"))); + purple_blist_node_get_bool(PURPLE_BLIST_NODE(buddy), "show_offline"))); } void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget) @@ -3674,7 +3672,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) struct proto_chat_entry *pce; char *name, *value; PurpleConversation *conv; - PidginBlistNode *bnode = node->ui_data; + PidginBlistNode *bnode = purple_blist_node_get_ui_data(node); chat = (PurpleChat *)node; prpl = purple_find_prpl(purple_account_get_protocol_id(purple_chat_get_account(chat))); @@ -3834,7 +3832,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) /* Last Seen */ if (full && c && !PURPLE_BUDDY_IS_ONLINE(b)) { - struct _pidgin_blist_node *gtknode = ((PurpleBlistNode *)c)->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(c)); PurpleBlistNode *bnode; int lastseen = 0; @@ -3963,7 +3961,7 @@ GdkPixbuf * pidgin_blist_get_emblem(PurpleBlistNode *node) { PurpleBuddy *buddy = NULL; - struct _pidgin_blist_node *gtknode = node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); PurplePlugin *prpl; PurplePluginProtocolInfo *prpl_info; const char *name = NULL; @@ -3986,7 +3984,7 @@ pidgin_blist_get_emblem(PurpleBlistNode *node) return _pidgin_blist_get_cached_emblem(path); } - if (((struct _pidgin_blist_node*)(node->parent->ui_data))->contact_expanded) { + if (((struct _pidgin_blist_node*)purple_blist_node_get_ui_data(node->parent))->contact_expanded) { if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) return NULL; return pidgin_create_prpl_icon(purple_buddy_get_account((PurpleBuddy*)node), PIDGIN_PRPL_ICON_SMALL); @@ -4070,7 +4068,7 @@ pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) { GdkPixbuf *ret; const char *icon = NULL; - struct _pidgin_blist_node *gtknode = node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); struct _pidgin_blist_node *gtkbuddynode = NULL; PurpleBuddy *buddy = NULL; PurpleChat *chat = NULL; @@ -4081,11 +4079,11 @@ pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) if(!gtknode->contact_expanded) { buddy = purple_contact_get_priority_buddy((PurpleContact*)node); if (buddy != NULL) - gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data; + gtkbuddynode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); } } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { buddy = (PurpleBuddy*)node; - gtkbuddynode = node->ui_data; + gtkbuddynode = purple_blist_node_get_ui_data(node); } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) { chat = (PurpleChat*)node; } else { @@ -4114,7 +4112,7 @@ pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) if(conv != NULL) { PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); if (gtkconv == NULL && size == PIDGIN_STATUS_ICON_SMALL) { - PidginBlistNode *ui = buddy->node.ui_data; + PidginBlistNode *ui = purple_blist_node_get_ui_data(&(buddy->node)); if (ui == NULL || (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE)) return gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_MESSAGE, icon_size, "GtkTreeView"); @@ -4198,7 +4196,7 @@ pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased PidginBlistTheme *theme; if (conv != NULL) { - PidginBlistNode *ui = b->node.ui_data; + PidginBlistNode *ui = purple_blist_node_get_ui_data(&(b->node)); if (ui) { if (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE) hidden_conv = TRUE; @@ -4432,7 +4430,7 @@ static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list) if (buddy && purple_presence_is_idle(purple_buddy_get_presence(buddy))) - pidgin_blist_update_contact(list, (PurpleBlistNode*)buddy); + pidgin_blist_update_contact(list, PURPLE_BLIST_NODE(buddy)); } } } @@ -4443,7 +4441,7 @@ static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list) static void pidgin_blist_hide_node(PurpleBuddyList *list, PurpleBlistNode *node, gboolean update) { - struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkTreeIter iter; if (!gtknode || !gtknode->row || !gtkblist) @@ -4603,7 +4601,7 @@ conversation_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type, if(account != NULL && purple_conversation_get_name(conv) != NULL) { PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); if(buddy != NULL) - pidgin_blist_update_buddy(NULL, (PurpleBlistNode *)buddy, TRUE); + pidgin_blist_update_buddy(NULL, PURPLE_BLIST_NODE(buddy), TRUE); } if (gtkblist->menutrayicon) { @@ -4683,7 +4681,7 @@ static void written_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *message, PurpleConversation *conv, PurpleMessageFlags flag, PurpleBlistNode *node) { - PidginBlistNode *ui = node->ui_data; + PidginBlistNode *ui = purple_blist_node_get_ui_data(node); if (ui->conv.conv != conv || !pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) || !(flag & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))) return; @@ -4699,7 +4697,7 @@ written_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *me static void displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node) { - PidginBlistNode *ui = node->ui_data; + PidginBlistNode *ui = purple_blist_node_get_ui_data(node); if (ui->conv.conv != gtkconv->active_conv) return; ui->conv.flags &= ~(PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE | @@ -4718,7 +4716,7 @@ conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) GSList *buddies = purple_find_buddies(account, purple_conversation_get_name(conv)); while (buddies) { PurpleBlistNode *buddy = buddies->data; - struct _pidgin_blist_node *ui = buddy->ui_data; + struct _pidgin_blist_node *ui = purple_blist_node_get_ui_data(buddy); buddies = g_slist_delete_link(buddies, buddies); if (!ui) continue; @@ -4740,7 +4738,7 @@ conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) struct _pidgin_blist_node *ui; if (!chat) break; - ui = chat->node.ui_data; + ui = purple_blist_node_get_ui_data(&(chat->node)); if (!ui) break; ui->conv.conv = conv; @@ -4775,7 +4773,7 @@ static void pidgin_blist_new_list(PurpleBuddyList *blist) static void pidgin_blist_new_node(PurpleBlistNode *node) { - node->ui_data = g_new0(struct _pidgin_blist_node, 1); + purple_blist_node_set_ui_data(node, g_new0(struct _pidgin_blist_node, 1)); } gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node) @@ -4788,7 +4786,7 @@ gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node) g_return_val_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node), FALSE); - return ((struct _pidgin_blist_node *)node->ui_data)->contact_expanded; + return ((struct _pidgin_blist_node *)purple_blist_node_get_ui_data(node))->contact_expanded; } enum { @@ -4844,7 +4842,7 @@ static void _prefs_change_redo_list(const char *name, PurplePrefType type, struct _pidgin_blist_node *gtknode; GtkTreePath *path; - gtknode = node->ui_data; + gtknode = purple_blist_node_get_ui_data(node); if (gtknode && gtknode->row) { path = gtk_tree_row_reference_get_path(gtknode->row); @@ -6130,7 +6128,7 @@ pidgin_blist_update_refresh_timeout() } static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter) { - struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkTreePath *path; if (!gtknode) { @@ -6159,7 +6157,7 @@ static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter) { static void pidgin_blist_remove(PurpleBuddyList *list, PurpleBlistNode *node) { - struct _pidgin_blist_node *gtknode = node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); purple_request_close_with_handle(node); @@ -6181,9 +6179,9 @@ static void pidgin_blist_remove(PurpleBuddyList *list, PurpleBlistNode *node) if(gtknode->recent_signonoff_timer > 0) purple_timeout_remove(gtknode->recent_signonoff_timer); - purple_signals_disconnect_by_handle(node->ui_data); - g_free(node->ui_data); - node->ui_data = NULL; + purple_signals_disconnect_by_handle(gtknode); + g_free(gtknode); + purple_blist_node_set_ui_data(node, NULL); } } @@ -6228,7 +6226,7 @@ static void pidgin_blist_selection_changed(GtkTreeSelection *selection, gpointer static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTreeIter *iter) { GtkTreeIter parent_iter, cur, *curptr = NULL; - struct _pidgin_blist_node *gtknode = node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkTreePath *newpath; if(!iter) @@ -6250,7 +6248,7 @@ static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTre gtk_tree_row_reference_free(gtknode->row); } else { pidgin_blist_new_node(node); - gtknode = (struct _pidgin_blist_node *)node->ui_data; + gtknode = purple_blist_node_get_ui_data(node); } newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), @@ -6268,7 +6266,7 @@ static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTre if(node->parent) { GtkTreePath *expand = NULL; - struct _pidgin_blist_node *gtkparentnode = node->parent->ui_data; + struct _pidgin_blist_node *gtkparentnode = purple_blist_node_get_ui_data(node->parent); if(PURPLE_BLIST_NODE_IS_GROUP(node->parent)) { if(!purple_blist_node_get_bool(node->parent, "collapsed")) @@ -6290,7 +6288,7 @@ static gboolean pidgin_blist_group_has_show_offline_buddy(PurpleGroup *group) { PurpleBlistNode *gnode, *cnode, *bnode; - gnode = (PurpleBlistNode *)group; + gnode = PURPLE_BLIST_NODE(group); for(cnode = gnode->child; cnode; cnode = cnode->next) { if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { for(bnode = cnode->child; bnode; bnode = bnode->next) { @@ -6462,7 +6460,7 @@ static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *n GdkColor *color = NULL; char *mark; char *idle = NULL; - gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded; + gboolean expanded = ((struct _pidgin_blist_node *)purple_blist_node_get_ui_data(node->parent))->contact_expanded; gboolean selected = (gtkblist->selected_node == node); gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); PidginBlistTheme *theme; @@ -6470,12 +6468,12 @@ static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *n if (editing_blist) return; - status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy, + status = pidgin_blist_get_status_icon(PURPLE_BLIST_NODE(buddy), biglist ? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL); /* Speed it up if we don't want buddy icons. */ if(biglist) - avatar = pidgin_blist_get_buddy_icon((PurpleBlistNode *)buddy, TRUE, TRUE); + avatar = pidgin_blist_get_buddy_icon(PURPLE_BLIST_NODE(buddy), TRUE, TRUE); else avatar = NULL; @@ -6486,7 +6484,7 @@ static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *n do_alphashift(avatar, 77); } - emblem = pidgin_blist_get_emblem((PurpleBlistNode*) buddy); + emblem = pidgin_blist_get_emblem(PURPLE_BLIST_NODE(buddy)); mark = pidgin_blist_get_name_markup(buddy, selected, TRUE); theme = pidgin_blist_get_theme(); @@ -6598,7 +6596,7 @@ static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode * if(!insert_node(list, cnode, &iter)) return; - gtknode = (struct _pidgin_blist_node *)cnode->ui_data; + gtknode = purple_blist_node_get_ui_data(cnode); if(gtknode->contact_expanded) { GdkPixbuf *status; @@ -6675,7 +6673,7 @@ static void pidgin_blist_update_buddy(PurpleBuddyList *list, PurpleBlistNode *no /* First things first, update the contact */ pidgin_blist_update_contact(list, node); - gtkparentnode = (struct _pidgin_blist_node *)node->parent->ui_data; + gtkparentnode = purple_blist_node_get_ui_data(node->parent); if (gtkparentnode->contact_expanded && buddy_is_displayable(buddy)) { @@ -6725,7 +6723,7 @@ static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *nod if (!insert_node(list, node, &iter)) return; - ui = node->ui_data; + ui = purple_blist_node_get_ui_data(node); conv = ui->conv.conv; if (conv && pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) { hidden = (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE); @@ -6811,7 +6809,7 @@ static void pidgin_blist_update(PurpleBuddyList *list, PurpleBlistNode *node) if(!gtkblist || !gtkblist->treeview || !node) return; - if (node->ui_data == NULL) + if (purple_blist_node_get_ui_data(node) == NULL) pidgin_blist_new_node(node); switch(node->type) { @@ -7015,7 +7013,7 @@ add_buddy_cb(GtkWidget *w, int resp, PidginAddBuddyData *data) /* Offer to merge people with the same alias. */ if (whoalias != NULL && g != NULL) - gtk_blist_auto_personize((PurpleBlistNode *)g, whoalias); + gtk_blist_auto_personize(PURPLE_BLIST_NODE(g), whoalias); /* * XXX @@ -7163,10 +7161,10 @@ add_chat_cb(GtkWidget *w, PidginAddChatData *data) purple_blist_add_chat(chat, group, NULL); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->autojoin))) - purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin", TRUE); + purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-autojoin", TRUE); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->persistent))) - purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-persistent", TRUE); + purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-persistent", TRUE); } gtk_widget_destroy(data->chat_data.rq_data.window); @@ -7423,7 +7421,7 @@ static gboolean autojoin_cb(PurpleConnection *gc, gpointer data) if(purple_chat_get_account(chat) != account) continue; - if (purple_blist_node_get_bool((PurpleBlistNode*)chat, "gtk-autojoin")) + if (purple_blist_node_get_bool(PURPLE_BLIST_NODE(chat), "gtk-autojoin")) serv_join_chat(gc, purple_chat_get_components(chat)); } } @@ -7441,25 +7439,25 @@ pidgin_blist_get_handle() { static gboolean buddy_signonoff_timeout_cb(PurpleBuddy *buddy) { - struct _pidgin_blist_node *gtknode = ((PurpleBlistNode*)buddy)->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); gtknode->recent_signonoff = FALSE; gtknode->recent_signonoff_timer = 0; - pidgin_blist_update(NULL, (PurpleBlistNode*)buddy); + pidgin_blist_update(NULL, PURPLE_BLIST_NODE(buddy)); return FALSE; } static void buddy_signonoff_cb(PurpleBuddy *buddy) { - struct _pidgin_blist_node *gtknode; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); - if(!((PurpleBlistNode*)buddy)->ui_data) { - pidgin_blist_new_node((PurpleBlistNode*)buddy); + if(!gtknode) { + pidgin_blist_new_node(PURPLE_BLIST_NODE(buddy)); } - gtknode = ((PurpleBlistNode*)buddy)->ui_data; + gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); gtknode->recent_signonoff = TRUE; -- cgit v1.2.1 From 43d9f395513bf12ebdb68d84804f098a42103a0e Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Tue, 1 Nov 2011 17:28:17 +0000 Subject: Convert to using purple_blist_node_ accessor functions. --- pidgin/gtkblist.c | 2 +- pidgin/gtkconv.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index e2f350b6ae..8bdca7e76b 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -6812,7 +6812,7 @@ static void pidgin_blist_update(PurpleBuddyList *list, PurpleBlistNode *node) if (purple_blist_node_get_ui_data(node) == NULL) pidgin_blist_new_node(node); - switch(node->type) { + switch (purple_blist_node_get_type(node)) { case PURPLE_BLIST_GROUP_NODE: pidgin_blist_update_group(list, node); break; diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index e21dab8ae7..8a45d4a2fd 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5656,7 +5656,6 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) GtkWidget *pane = NULL; GtkWidget *tab_cont; PurpleBlistNode *convnode; - PurpleValue *value; if (conv_type == PURPLE_CONV_TYPE_IM && (gtkconv = pidgin_conv_find_gtkconv(conv))) { purple_conversation_set_ui_data(conv, gtkconv); @@ -5741,11 +5740,9 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) if (convnode == NULL || !purple_blist_node_get_bool(convnode, "gtk-mute-sound")) gtkconv->make_sound = TRUE; - if (convnode != NULL && - (value = g_hash_table_lookup(convnode->settings, "enable-logging")) && - purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) - { - purple_conversation_set_logging(conv, purple_value_get_boolean(value)); + if (convnode != NULL) { + gboolean logging = purple_blist_node_get_bool(convnode, "enable-logging"); + purple_conversation_set_logging(conv, logging); } if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar")) -- cgit v1.2.1 From e757baf2c878e3d0197556a68d8824e993d78b34 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Wed, 2 Nov 2011 09:51:48 +0000 Subject: MXit is increasing the limit on the size of files that can be transferred. --- libpurple/protocols/mxit/filexfer.c | 2 +- libpurple/protocols/mxit/protocol.c | 4 ++-- libpurple/protocols/mxit/protocol.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libpurple/protocols/mxit/filexfer.c b/libpurple/protocols/mxit/filexfer.c index 7f4c90634f..a6e4beedeb 100644 --- a/libpurple/protocols/mxit/filexfer.c +++ b/libpurple/protocols/mxit/filexfer.c @@ -124,7 +124,7 @@ static void mxit_xfer_init( PurpleXfer* xfer ) if ( purple_xfer_get_type( xfer ) == PURPLE_XFER_SEND ) { /* we are trying to send a file to MXit */ - if ( purple_xfer_get_size( xfer ) > CP_MAX_FILESIZE ) { + if ( purple_xfer_get_size( xfer ) > ( CP_MAX_PACKET - 1000 ) ) { /* need to reserve some space for packet headers */ /* the file is too big */ purple_xfer_error( purple_xfer_get_type( xfer ), purple_xfer_get_account( xfer ), purple_xfer_get_remote_user( xfer ), _( "The file you are trying to send is too large!" ) ); purple_xfer_cancel_local( xfer ); diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index 2e0abe8ed2..733723b936 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -718,7 +718,7 @@ void mxit_send_register( struct MXitSession* session ) "%s%c%i%c%s%c%s%c" /* dateOfBirth\1gender\1location\1capabilities\1 */ "%s%c%i%c%s%c%s" /* dc\1features\1dialingcode\1locale */ "%c%i%c%i", /* \1protocolVer\1lastRosterUpdate */ - session->encpwd, CP_FLD_TERM, clientVersion, CP_FLD_TERM, CP_MAX_FILESIZE, CP_FLD_TERM, profile->nickname, CP_FLD_TERM, + session->encpwd, CP_FLD_TERM, clientVersion, CP_FLD_TERM, CP_MAX_PACKET, CP_FLD_TERM, profile->nickname, CP_FLD_TERM, profile->birthday, CP_FLD_TERM, ( profile->male ) ? 1 : 0, CP_FLD_TERM, MXIT_DEFAULT_LOC, CP_FLD_TERM, MXIT_CP_CAP, CP_FLD_TERM, session->distcode, CP_FLD_TERM, features, CP_FLD_TERM, session->dialcode, CP_FLD_TERM, locale, CP_FLD_TERM, MXIT_CP_PROTO_VESION, CP_FLD_TERM, 0 @@ -765,7 +765,7 @@ void mxit_send_login( struct MXitSession* session ) session->encpwd, CP_FLD_TERM, clientVersion, CP_FLD_TERM, 1, CP_FLD_TERM, MXIT_CP_CAP, CP_FLD_TERM, session->distcode, CP_FLD_TERM, features, CP_FLD_TERM, session->dialcode, CP_FLD_TERM, locale, CP_FLD_TERM, - CP_MAX_FILESIZE, CP_FLD_TERM, MXIT_CP_PROTO_VESION, CP_FLD_TERM, 0 + CP_MAX_PACKET, CP_FLD_TERM, MXIT_CP_PROTO_VESION, CP_FLD_TERM, 0 ); /* include "custom resource" information */ diff --git a/libpurple/protocols/mxit/protocol.h b/libpurple/protocols/mxit/protocol.h index af93f952df..203ce445a2 100644 --- a/libpurple/protocols/mxit/protocol.h +++ b/libpurple/protocols/mxit/protocol.h @@ -34,8 +34,7 @@ #define CP_PKT_TERM '\x02' /* packet terminator */ -#define CP_MAX_PACKET ( 1024 * 1024 ) /* maximum client protocol packet size (1 MiB) */ -#define CP_MAX_FILESIZE ( 150 * 1000 ) /* maximum client protocol file transfer size (150 KB) */ +#define CP_MAX_PACKET ( 1 * 1000 * 1000 ) /* maximum client protocol packet size (1 MB) */ #define MXIT_EMOTICON_SIZE 18 /* icon size for custom emoticons */ #define CP_MAX_STATUS_MSG 250 /* maximum status message length (in characters) */ @@ -77,6 +76,7 @@ #define MXIT_CF_GAMING_UPDATE 0x800000 #define MXIT_CF_VOICE 0x1000000 #define MXIT_CF_VIDEO 0x2000000 +#define MXIT_CF_TOUCHSCREEN 0x4000000 /* Client features supported by this implementation */ #define MXIT_CP_FEATURES ( MXIT_CF_FILE_TRANSFER | MXIT_CF_FILE_ACCESS | MXIT_CF_AUDIO | MXIT_CF_MARKUP | MXIT_CF_EXT_MARKUP | MXIT_CF_NO_GATEWAYS | MXIT_CF_IMAGES | MXIT_CF_COMMANDS | MXIT_CF_VIBES | MXIT_CF_MIDP2 ) -- cgit v1.2.1 From 6ab34a45463e05f58509cd1fc7162b7d80f7d626 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 6 Nov 2011 05:28:11 +0000 Subject: Simplify SSL Makefile.am by using += on variables. --- libpurple/plugins/ssl/Makefile.am | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/libpurple/plugins/ssl/Makefile.am b/libpurple/plugins/ssl/Makefile.am index f95ef88f58..d874abd4ef 100644 --- a/libpurple/plugins/ssl/Makefile.am +++ b/libpurple/plugins/ssl/Makefile.am @@ -9,30 +9,15 @@ ssl_nss_la_LDFLAGS = -module -avoid-version if PLUGINS -# I'm sorry to report that Automake Conditionals don't support -# if USE_GNUTLS && USE_NSS -# but only support testing a single variable. Hence: - -if USE_GNUTLS -if USE_NSS plugin_LTLIBRARIES = \ - ssl.la \ - ssl-gnutls.la \ - ssl-nss.la -else -plugin_LTLIBRARIES = \ - ssl.la \ + ssl.la +if USE_GNUTLS +plugin_LTLIBRARIES += \ ssl-gnutls.la endif -else if USE_NSS -plugin_LTLIBRARIES = \ - ssl.la \ +plugin_LTLIBRARIES += \ ssl-nss.la -else -plugin_LTLIBRARIES = \ - ssl.la -endif endif ssl_la_SOURCES = ssl.c @@ -56,3 +41,4 @@ AM_CPPFLAGS = \ ssl_gnutls_la_CFLAGS = $(AM_CPPFLAGS) $(GNUTLS_CFLAGS) ssl_nss_la_CFLAGS = $(AM_CPPFLAGS) $(NSS_CFLAGS) + -- cgit v1.2.1 From 9dd58f1ec233afd621d2395834ba50612a630831 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sun, 6 Nov 2011 13:34:58 +0000 Subject: Gadu-Gadu: synchronize internal libgadu with upstream - tiny sync. Refs #343 --- libpurple/protocols/gg/lib/common.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libpurple/protocols/gg/lib/common.c b/libpurple/protocols/gg/lib/common.c index f44ef5b569..acac5fb35f 100644 --- a/libpurple/protocols/gg/lib/common.c +++ b/libpurple/protocols/gg/lib/common.c @@ -32,9 +32,6 @@ #include #include -#ifndef _WIN32 -# include -#endif #include #include #include -- cgit v1.2.1 From 786a41d34ccb484f3171716567b6f2a1f927e9a2 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 6 Nov 2011 19:46:57 +0000 Subject: Introduce purple_account_register_completed() to handle the invoking of any registration callback. --- ChangeLog.API | 1 + libpurple/account.c | 9 +++++++++ libpurple/account.h | 9 +++++++++ libpurple/protocols/gg/gg.c | 7 +++---- libpurple/protocols/jabber/jabber.c | 16 ++++++---------- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 20da49cc64..4656de7734 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -6,6 +6,7 @@ version 3.0.0 (??/??/????): * pidgin_create_webview * purple_account_get_ui_data * purple_account_set_ui_data + * purple_account_register_completed * purple_conv_chat_cb_get_alias * purple_conv_chat_cb_get_flags * purple_conv_chat_cb_is_buddy diff --git a/libpurple/account.c b/libpurple/account.c index f1628ff69e..fe3de2223d 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -1118,6 +1118,15 @@ purple_account_register(PurpleAccount *account) _purple_connection_new(account, TRUE, purple_account_get_password(account)); } +void +purple_account_register_completed(PurpleAccount *account, gboolean succeeded) +{ + g_return_if_fail(account != NULL); + + if (account->registration_cb) + (account->registration_cb)(account, succeeded, account->registration_cb_user_data); +} + void purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { diff --git a/libpurple/account.h b/libpurple/account.h index b6ab43be25..45cf95b4f1 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -220,6 +220,15 @@ void purple_account_set_register_callback(PurpleAccount *account, PurpleAccountR */ void purple_account_register(PurpleAccount *account); +/** + * Registration of the account was completed. + * Calls the registration call-back set with purple_account_set_register_callback(). + * + * @param account The account being registered. + * @param succeeded Was the account registration successful? + */ +void purple_account_register_completed(PurpleAccount *account, gboolean succeeded); + /** * Unregisters an account (deleting it from the server). * diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 189e3cdbe7..5d721cc74e 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -391,8 +391,8 @@ static void ggp_callback_register_account_ok(PurpleConnection *gc, purple_notify_info(NULL, _("New Gadu-Gadu Account Registered"), _("Registration completed successfully!"), NULL); - if(account->registration_cb) - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); + purple_account_register_completed(account, TRUE); + /* TODO: the currently open Accounts Window will not be updated withthe * new username and etc, we need to somehow have it refresh at this * point @@ -402,8 +402,7 @@ static void ggp_callback_register_account_ok(PurpleConnection *gc, purple_account_disconnect(account); exit_err: - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); gg_register_free(h); g_free(email); diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 575aeb7f95..8ab22d0ad2 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -1144,8 +1144,7 @@ jabber_registration_result_cb(JabberStream *js, const char *from, if(js->registration) { buf = g_strdup_printf(_("Registration of %s@%s successful"), js->user->node, js->user->domain); - if(account->registration_cb) - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); + purple_account_register_completed(account, TRUE); } else { g_return_if_fail(to != NULL); buf = g_strdup_printf(_("Registration to %s successful"), @@ -1163,8 +1162,7 @@ jabber_registration_result_cb(JabberStream *js, const char *from, purple_notify_error(NULL, _("Registration Failed"), _("Registration Failed"), msg); g_free(msg); - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); } g_free(to); if(js->registration) @@ -1288,8 +1286,7 @@ jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fie { PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); if(account && cbdata->js->registration) { - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); jabber_connection_schedule_close(cbdata->js); } g_free(cbdata->who); @@ -1358,8 +1355,7 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type if(js->registration) { purple_notify_error(NULL, _("Already Registered"), _("Already Registered"), NULL); - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); jabber_connection_schedule_close(js); return; } @@ -1380,8 +1376,8 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type if(js->registration) { js->gc->wants_to_die = TRUE; - if(account->registration_cb) /* succeeded, but we have no login info */ - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); + /* succeeded, but we have no login info */ + purple_account_register_completed(account, TRUE); jabber_connection_schedule_close(js); } return; -- cgit v1.2.1 From c2ef55d4bf215b0ba2e31eabe21dfdd78a1bfb1b Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 6 Nov 2011 20:31:14 +0000 Subject: Add purple_account_is_disconnecting() accessor function. --- ChangeLog.API | 1 + libpurple/account.c | 8 ++++++++ libpurple/account.h | 9 +++++++++ libpurple/protocols/irc/cmds.c | 2 +- libpurple/protocols/jabber/jabber.c | 2 +- libpurple/protocols/oscar/flap_connection.c | 2 +- 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 4656de7734..dada09c965 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -4,6 +4,7 @@ version 3.0.0 (??/??/????): libpurple: Added: * pidgin_create_webview + * purple_account_is_disconnecting * purple_account_get_ui_data * purple_account_set_ui_data * purple_account_register_completed diff --git a/libpurple/account.c b/libpurple/account.c index fe3de2223d..5948344a36 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -1274,6 +1274,14 @@ purple_account_disconnect(PurpleAccount *account) account->disconnecting = FALSE; } +gboolean +purple_account_is_disconnecting(const PurpleAccount *account) +{ + g_return_val_if_fail(account != NULL, TRUE); + + return account->disconnecting; +} + void purple_account_notify_added(PurpleAccount *account, const char *remote_user, const char *id, const char *alias, diff --git a/libpurple/account.h b/libpurple/account.h index 45cf95b4f1..69fd16cbe9 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -245,6 +245,15 @@ void purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrati */ void purple_account_disconnect(PurpleAccount *account); +/** + * Indicates if the account is currently being disconnected. + * + * @param account The account + * + * @return TRUE if the account is being disconnected. + */ +gboolean purple_account_is_disconnecting(const PurpleAccount *account); + /** * Notifies the user that the account was added to a remote user's * buddy list. diff --git a/libpurple/protocols/irc/cmds.c b/libpurple/protocols/irc/cmds.c index b725b76e57..5a704a243f 100644 --- a/libpurple/protocols/irc/cmds.c +++ b/libpurple/protocols/irc/cmds.c @@ -423,7 +423,7 @@ int irc_cmd_quit(struct irc_conn *irc, const char *cmd, const char *target, cons irc->quitting = TRUE; - if (!irc->account->disconnecting) + if (!purple_account_is_disconnecting(irc->account)) purple_account_set_status(irc->account, "offline", TRUE, NULL); } diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 8ab22d0ad2..690e2a5b2d 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -440,7 +440,7 @@ static gboolean do_jabber_send_raw(JabberStream *js, const char *data, int len) * we're disconnecting, don't generate (possibly another) error that * (for some UIs) would mask the first. */ - if (!account->disconnecting) { + if (!purple_account_is_disconnecting(account)) { gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); purple_connection_error(js->gc, diff --git a/libpurple/protocols/oscar/flap_connection.c b/libpurple/protocols/oscar/flap_connection.c index 94663a844a..a7441c69ed 100644 --- a/libpurple/protocols/oscar/flap_connection.c +++ b/libpurple/protocols/oscar/flap_connection.c @@ -456,7 +456,7 @@ flap_connection_destroy_cb(gpointer data) * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then * we should try to request one instead of disconnecting. */ - if (!account->disconnecting && ((od->oscar_connections == NULL) + if (!purple_account_is_disconnecting(account) && ((od->oscar_connections == NULL) || (!flap_connection_getbytype(od, SNAC_FAMILY_LOCATE)))) { /* No more FLAP connections! Sign off this PurpleConnection! */ -- cgit v1.2.1 From f9d80a42fbfe96c904c54eb49621f2cb6c892fb2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 18 Nov 2011 18:11:18 +0000 Subject: Fix fallback to builtin Template.html file. --- pidgin/gtkconv-theme.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 9e08fac2d0..e90e78310b 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -111,23 +111,33 @@ get_key(PidginConvThemePrivate *priv, const char *key, gboolean specific) return val; } -static const char * -get_template_html(PidginConvThemePrivate *priv, const char *dir) +/* The template path can either come from the theme, or can + * be stock Template.html that comes with Pidgin */ +static char * +get_template_path(const char *dir) { char *file; - if (priv->template_html) - return priv->template_html; - - /* The template path can either come from the theme, or can - * be stock Template.html that comes with the plugin */ file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL); if (!g_file_test(file, G_FILE_TEST_EXISTS)) { g_free(file); - file = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); + file = g_build_filename(DATADIR, "pidgin", "theme", "conversation", "Template.html", NULL); } + return file; +} + +static const char * +get_template_html(PidginConvThemePrivate *priv, const char *dir) +{ + char *file; + + if (priv->template_html) + return priv->template_html; + + file = get_template_path(dir); + if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) { purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file); priv->template_html = g_strdup(""); @@ -708,19 +718,12 @@ char * pidgin_conversation_theme_get_template_path(PidginConvTheme *theme) { const char *dir; - char *filename; g_return_val_if_fail(theme != NULL, NULL); dir = purple_theme_get_dir(PURPLE_THEME(theme)); - filename = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL); - - if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { - g_free(filename); - filename = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); - } - return filename; + return get_template_path(dir); } char * -- cgit v1.2.1 From 3b590301c41d9e83432a4153c2203da12fcb9da7 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 18 Nov 2011 18:22:50 +0000 Subject: Fix an infinite loop if there's a tag in the theme header that we don't understand. --- pidgin/gtkconv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 8a45d4a2fd..789cff86e8 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5099,6 +5099,7 @@ replace_header_tokens(PurpleConversation *conv, const char *text) g_free(format); } else { + cur++; continue; } -- cgit v1.2.1 From 9f601a1e6c6d90a1eafe2e97e65eef3fc73c5bc4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 18 Nov 2011 19:08:09 +0000 Subject: Add support for %dateOpened% in templates. --- pidgin/gtkconv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 789cff86e8..ae158ce794 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5098,6 +5098,9 @@ replace_header_tokens(PurpleConversation *conv, const char *text) replace = purple_utf8_strftime(format ? format : "%X", NULL); g_free(format); + } else if (g_str_has_prefix(cur, "%dateOpened%")) { + replace = purple_date_format_short(NULL); + } else { cur++; continue; -- cgit v1.2.1 From 5e78d63a4f01aedbc241a0cd1daad160ed3f2002 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 18 Nov 2011 19:37:04 +0000 Subject: Fix a small leak. --- pidgin/gtkconv-theme.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index e90e78310b..d306594ee1 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -381,6 +381,7 @@ get_outgoing_next_context_html(PidginConvThemePrivate *priv, const char *dir) if (!g_file_get_contents(file, &priv->outgoing_next_context_html, NULL, NULL)) { priv->outgoing_next_context_html = g_strdup(get_outgoing_context_html(priv, dir)); } + g_free(file); return priv->outgoing_next_context_html; } -- cgit v1.2.1 From 7ec29bd3eacc5ce86fffdb1cdf04488d2bb2897b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 18 Nov 2011 19:49:08 +0000 Subject: Add support for %shortTime% in themed messages. This is probably not localized correctly. --- pidgin/gtkconv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index ae158ce794..b72ab8f899 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6133,6 +6133,9 @@ replace_message_tokens( replace = purple_utf8_strftime(format ? format : "%X", NULL); g_free(format); + } else if (g_str_has_prefix(cur, "%shortTime%")) { + replace = purple_utf8_strftime("%H:%M", NULL); + } else if (g_str_has_prefix(cur, "%userIconPath%")) { if (flags & PURPLE_MESSAGE_SEND) { if (purple_account_get_bool(purple_conversation_get_account(conv), "use-global-buddyicon", TRUE)) { -- cgit v1.2.1 From 03f49a587b95a056f97c97090612a40f6dd6341b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 18 Nov 2011 19:53:46 +0000 Subject: Add support for %messageDirection% for RTL messages. --- pidgin/gtkconv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index b72ab8f899..d8983dd635 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6165,6 +6165,9 @@ replace_message_tokens( } else if (g_str_has_prefix(cur, "%service%")) { replace = purple_account_get_protocol_name(purple_conversation_get_account(conv)); + } else if (g_str_has_prefix(cur, "%messageDirection%")) { + replace = purple_markup_is_rtl(message) ? "rtl" : "ltr"; + } else { cur++; continue; -- cgit v1.2.1 From 7dd54401bfe8fa4d4ff3608119afb2458e485cb8 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 28 Nov 2011 08:33:30 +0000 Subject: Fix minor typo in ChangeLog.API --- ChangeLog.API | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.API b/ChangeLog.API index dada09c965..e7fa98b930 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -59,7 +59,7 @@ version 3.0.0 (??/??/????): * purple_xfer_get_ui_data * purple_xfer_get_watcher * purple_xfer_set_fd - * purple_Xfer_set_local_port + * purple_xfer_set_local_port * purple_xfer_set_protocol_data * purple_xfer_set_status * purple_xfer_set_ui_data -- cgit v1.2.1 From e3ffb09498c2eb7b4cc189431811014c11a148d5 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 28 Nov 2011 08:52:34 +0000 Subject: We haven't used this pref in a while. We stopped adding it in revision 1e0347d48af7ad0cec658e5282152dd3247d7ebc. We also need to stop trying to rename it, and we should remove it if it exists. For 3.0.0 we should go through the prefs that we're migrating and removing and stop migrating/removing them if we've been doing it since before 2.0.0. --- libpurple/prefs.c | 1 + pidgin/gtkprefs.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libpurple/prefs.c b/libpurple/prefs.c index a24b4c4b62..b6d0e8b053 100644 --- a/libpurple/prefs.c +++ b/libpurple/prefs.c @@ -1357,6 +1357,7 @@ purple_prefs_update_old() purple_prefs_remove("/purple/conversations/chat/show_leave"); purple_prefs_remove("/purple/conversations/combine_chat_im"); purple_prefs_remove("/purple/conversations/use_alias_for_title"); + purple_prefs_remove("/purple/debug/timestamps"); purple_prefs_remove("/purple/logging/log_signon_signoff"); purple_prefs_remove("/purple/logging/log_idle_state"); purple_prefs_remove("/purple/logging/log_away_state"); diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 5b3b928efd..67b72ce077 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -3041,7 +3041,6 @@ pidgin_prefs_update_old(void) purple_prefs_rename("/purple/conversations/placement", PIDGIN_PREFS_ROOT "/conversations/placement"); - purple_prefs_rename(PIDGIN_PREFS_ROOT "/debug/timestamps", "/purple/debug/timestamps"); purple_prefs_rename(PIDGIN_PREFS_ROOT "/conversations/im/raise_on_events", "/plugins/gtk/X11/notify/method_raise"); purple_prefs_rename_boolean_toggle(PIDGIN_PREFS_ROOT "/conversations/ignore_colors", @@ -3087,6 +3086,7 @@ pidgin_prefs_update_old(void) purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/ignore_fonts"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/ignore_font_sizes"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/passthrough_unknown_commands"); + purple_prefs_remove(PIDGIN_PREFS_ROOT "/debug/timestamps"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/idle"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/logging/individual_logs"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/signon"); -- cgit v1.2.1 From 3c32ecc71e3788574ac55c65eaac6d5bc6c7b937 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Thu, 1 Dec 2011 20:11:42 +0000 Subject: Fix compilation of Bonjour prpl on 3.0. --- libpurple/protocols/bonjour/bonjour_ft.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index 35eee18009..4d08badd0e 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -554,9 +554,8 @@ __xep_bytestreams_parse(PurpleBuddy *pb, PurpleXfer *xfer, xmlnode *query, const char *jid, *host, *port; int portnum; xmlnode *streamhost; - XepXfer *xf = NULL; + XepXfer *xf = purple_xfer_get_protocol_data(xfer); - xf = (XepXfer*)xfer->data; for(streamhost = xmlnode_get_child(query, "streamhost"); streamhost; streamhost = xmlnode_get_next_twin(streamhost)) { -- cgit v1.2.1 From 73186d99db108bb22f1887949a14ba7321facc72 Mon Sep 17 00:00:00 2001 From: John Bailey Date: Sun, 4 Dec 2011 21:12:56 +0000 Subject: This change is needed to make external plugins compile. It's either this or go through every source file and change every reference to account.h, request.h, etc. to libpurple/account.h, libpurple/request.h, etc. The same goes for the change in pidgin-3.pc. I know this might not be a popular change, but I want my plugins to compile. --- libpurple/purple-3.pc.in | 2 +- pidgin/pidgin-3.pc.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/purple-3.pc.in b/libpurple/purple-3.pc.in index 9506b6f5be..281a522a96 100644 --- a/libpurple/purple-3.pc.in +++ b/libpurple/purple-3.pc.in @@ -1,7 +1,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@ +includedir=@includedir@/libpurple datarootdir=@datarootdir@ datadir=@datadir@ sysconfdir=@sysconfdir@ diff --git a/pidgin/pidgin-3.pc.in b/pidgin/pidgin-3.pc.in index 6b60b53544..9464d8a6c3 100644 --- a/pidgin/pidgin-3.pc.in +++ b/pidgin/pidgin-3.pc.in @@ -1,7 +1,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@ +includedir=@includedir@/pidgin datarootdir=@datarootdir@ datadir=@datadir@ sysconfdir=@sysconfdir@ -- cgit v1.2.1 From b4ce6ff950c6d90c309ec764083fd82ea7325aef Mon Sep 17 00:00:00 2001 From: Gary Kramlich Date: Sun, 4 Dec 2011 22:11:15 +0000 Subject: G_CONST_RETURN has been deprecated, use const instead --- libpurple/util.c | 2 +- libpurple/util.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/util.c b/libpurple/util.c index 8e2a057893..f513f6790b 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -4637,7 +4637,7 @@ purple_utf8_strip_unprintables(const gchar *str) * This function is copied from g_strerror() but changed to use * gai_strerror(). */ -G_CONST_RETURN gchar * +const gchar * purple_gai_strerror(gint errnum) { static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT; diff --git a/libpurple/util.h b/libpurple/util.h index 35894464f9..36d06ff165 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -1344,7 +1344,7 @@ gchar *purple_utf8_strip_unprintables(const gchar *str); * * @return The UTF-8 error message. */ -G_CONST_RETURN gchar *purple_gai_strerror(gint errnum); +const gchar *purple_gai_strerror(gint errnum); /** * Compares two UTF-8 strings case-insensitively. This comparison is -- cgit v1.2.1 From 9f3b46d5de176184c7f2779685af7297e62e09cf Mon Sep 17 00:00:00 2001 From: Jochen Kemnade Date: Sun, 11 Dec 2011 09:42:52 +0000 Subject: update German translation --- po/de.po | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/po/de.po b/po/de.po index 2e9252c952..bd9647b6af 100644 --- a/po/de.po +++ b/po/de.po @@ -11,8 +11,8 @@ msgid "" msgstr "" "Project-Id-Version: de\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-22 12:37+0200\n" -"PO-Revision-Date: 2011-10-22 12:37+0200\n" +"POT-Creation-Date: 2011-12-11 10:41+0100\n" +"PO-Revision-Date: 2011-12-11 10:40+0100\n" "Last-Translator: Jochen Kemnade \n" "Language-Team: German \n" "Language: de\n" @@ -6249,6 +6249,8 @@ msgstr "Startbildschirm anzeigen..." msgid "About..." msgstr "Über..." +#. we are trying to send a file to MXit +#. need to reserve some space for packet headers #. the file is too big msgid "The file you are trying to send is too large!" msgstr "Die Datei, die Sie senden möchten ist zu groß!" @@ -7104,7 +7106,6 @@ msgstr "Hauspostcode" msgid "User ID" msgstr "Benutzer-ID" -#, fuzzy msgid "DN" msgstr "DN" @@ -11388,10 +11389,10 @@ msgid "SSL Servers" msgstr "SSL-Server" msgid "Unsafe debugging is now disabled." -msgstr "" +msgstr "Unsicheres Debugging ist nun deaktiviert." msgid "Unsafe debugging is now enabled." -msgstr "" +msgstr "Unsicheres Debugging ist nun aktiviert." msgid "Verbose debugging is now disabled." msgstr "Ausführliches Debugging ist nun deaktiviert." @@ -12778,9 +12779,18 @@ msgstr "%s möchte eine Video-Sitzung mit Ihnen starten." msgid "Incoming Call" msgstr "Eingehender Anruf" +msgid "_Hold" +msgstr "_Halten" + msgid "_Pause" msgstr "_Pause" +msgid "_Mute" +msgstr "Stu_mmschalten" + +msgid "Call in progress" +msgstr "Anruf im Gange" + #, c-format msgid "%s has %d new message." msgid_plural "%s has %d new messages." -- cgit v1.2.1 From 65219005c54d0d037e375b02b6683757b64be325 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 12 Dec 2011 07:30:21 +0000 Subject: Fix an inconsequential memory leak. We weren't freeing this dudes at shutdown. Now we R. --- libpurple/cmds.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpurple/cmds.c b/libpurple/cmds.c index 6a495acd06..b29e4c4818 100644 --- a/libpurple/cmds.c +++ b/libpurple/cmds.c @@ -385,5 +385,10 @@ void purple_cmds_init(void) void purple_cmds_uninit(void) { purple_signals_unregister_by_instance(purple_cmds_get_handle()); + + while (cmds) { + purple_cmd_free(cmds->data); + cmds = g_list_delete_link(cmds, cmds); + } } -- cgit v1.2.1 From 1d08259b043a37d425965106d4a9cc95c7917f5e Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 12 Dec 2011 08:53:24 +0000 Subject: If we encounter a buddy not in a group, or in a group with an invalid UTF-8 name, then put them in the localized group "Buddies" rather than in the sometimes-localized group "Orphans" --- libpurple/protocols/oscar/family_feedbag.c | 2 +- libpurple/protocols/oscar/oscar.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c index 98afaf998a..929dbe2213 100644 --- a/libpurple/protocols/oscar/family_feedbag.c +++ b/libpurple/protocols/oscar/family_feedbag.c @@ -764,7 +764,7 @@ int aim_ssi_cleanlist(OscarData *od) aim_ssi_del_from_private_list(od, NULL, cur->type); } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(&od->ssi.local, cur->gid, 0x0000)))) { char *alias = aim_ssi_getalias(&od->ssi.local, NULL, cur->name); - aim_ssi_addbuddy(od, cur->name, "orphans", NULL, alias, NULL, NULL, FALSE); + aim_ssi_addbuddy(od, cur->name, _("Buddies"), NULL, alias, NULL, NULL, FALSE); aim_ssi_delbuddy(od, cur->name, NULL); g_free(alias); } diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 29a57fba89..e74e767275 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -4035,9 +4035,9 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * gname = groupitem ? groupitem->name : NULL; gname_utf8 = oscar_utf8_try_convert(account, od, gname); - g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")); + g = purple_find_group(gname_utf8 ? gname_utf8 : _("Buddies")); if (g == NULL) { - g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); + g = purple_group_new(gname_utf8 ? gname_utf8 : _("Buddies")); purple_blist_add_group(g, NULL); } @@ -4261,13 +4261,13 @@ purple_ssi_parseaddmod(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) */ b = purple_buddy_new(account, name, alias_utf8); - if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { - g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); + if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Buddies")))) { + g = purple_group_new(gname_utf8 ? gname_utf8 : _("Buddies")); purple_blist_add_group(g, NULL); } purple_debug_info("oscar", - "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); + "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Buddies")); purple_blist_add_buddy(b, NULL, g, NULL); /* Mobile users should always be online */ -- cgit v1.2.1 From fd9a2a20d0c0d47404390e0a3803675e082ab1ce Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 12 Dec 2011 08:58:22 +0000 Subject: Cleanup the formatting of this code a little. No functionality change. --- libpurple/protocols/oscar/family_feedbag.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c index 929dbe2213..c214e26e19 100644 --- a/libpurple/protocols/oscar/family_feedbag.c +++ b/libpurple/protocols/oscar/family_feedbag.c @@ -771,16 +771,23 @@ int aim_ssi_cleanlist(OscarData *od) cur = next; } - /* Make sure there aren't any duplicate buddies in a group, or duplicate permits or denies */ cur = od->ssi.local.data; while (cur) { if ((cur->type == AIM_SSI_TYPE_BUDDY) || (cur->type == AIM_SSI_TYPE_PERMIT) || (cur->type == AIM_SSI_TYPE_DENY)) { struct aim_ssi_item *cur2, *next2; + + /* Make sure there aren't any duplicate permits or denies, or + duplicate buddies within a group */ cur2 = cur->next; while (cur2) { next2 = cur2->next; - if ((cur->type == cur2->type) && (cur->gid == cur2->gid) && (cur->name != NULL) && (cur2->name != NULL) && (!oscar_util_name_compare(cur->name, cur2->name))) { + if (cur->type == cur2->type + && cur->gid == cur2->gid + && cur->name + && cur2->name + && !oscar_util_name_compare(cur->name, cur2->name)) + { aim_ssi_itemlist_del(&od->ssi.local, cur2); } cur2 = next2; -- cgit v1.2.1 From 7d34aa61a394df17395e825606dde95e73a83d35 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 12 Dec 2011 09:01:21 +0000 Subject: Make the oscar cleanlist function ensure that buddy comments and aliases are valid utf8. If they're not, then we use purple_utf8_salvage() to fix them and save the result in our server list. --- libpurple/protocols/oscar/family_feedbag.c | 41 +++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c index c214e26e19..bf4bfd1e9a 100644 --- a/libpurple/protocols/oscar/family_feedbag.c +++ b/libpurple/protocols/oscar/family_feedbag.c @@ -734,10 +734,37 @@ aim_ssi_freelist(OscarData *od) } /** - * This "cleans" the ssi list. It does the following: - * 1) Makes sure all buddies, permits, and denies have names. - * 2) Makes sure that all buddies are in a group that exist. - * 3) Deletes any empty groups + * Look up the given TLV type in the item's data. If the value of + * the TLV is not a valid UTF-8 string then use purple_utf8_salvage() + * to replace invalid bytes with question marks. + */ +static void cleanlist_ensure_utf8_data(struct aim_ssi_item *item, guint16 tlvtype) +{ + aim_tlv_t *tlv; + gchar *value, *salvaged; + + tlv = aim_tlv_gettlv(item->data, tlvtype, 1); + if (tlv && tlv->length && !g_utf8_validate((const gchar *)tlv->value, tlv->length, NULL)) { + purple_debug_warning("oscar", "cleanlist found invalid UTF-8 " + "for 0x%04hx field of 0x%04hx item with name %s. " + "Attempting to repair.\n", + tlvtype, item->type, item->name ? item->name : "(null)"); + value = g_strndup((const gchar *)tlv->value, tlv->length); + salvaged = purple_utf8_salvage(value); + g_free(value); + if (*salvaged) + aim_tlvlist_replace_str(&item->data, tlvtype, salvaged); + else + aim_tlvlist_remove(&item->data, tlvtype); + g_free(salvaged); + } +} + +/** + * This "cleans" the ssi list. It does things like: + * - Makes sure all buddies, permits, and denies have names + * - Makes sure all buddies are in a group that exist + * - Makes sure strings are valid UTF-8 * * @param od The oscar odion. * @return Return 0 if no errors, otherwise return the error number. @@ -792,6 +819,12 @@ int aim_ssi_cleanlist(OscarData *od) } cur2 = next2; } + + /* Make sure alias is valid UTF-8 */ + cleanlist_ensure_utf8_data(cur, 0x0131); + + /* Make sure comment is valid UTF-8 */ + cleanlist_ensure_utf8_data(cur, 0x013c); } cur = cur->next; } -- cgit v1.2.1 From 17d7d3171690db36eb5533f2347275db1a4ef055 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 21 Dec 2011 08:47:08 +0000 Subject: Add support for the GNOME3 Network dialog. Closes #13882. --- pidgin/gtkprefs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 67b72ce077..e518412418 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -2185,6 +2185,14 @@ proxy_page(void) path = g_find_program_in_path("gnome-network-properties"); if (path == NULL) path = g_find_program_in_path("gnome-network-preferences"); + if (path == NULL) { + path = g_find_program_in_path("gnome-control-center"); + if (path != NULL) { + char *tmp = g_strdup_printf("%s network", path); + g_free(path); + path = tmp; + } + } if (path == NULL) { label = gtk_label_new(NULL); -- cgit v1.2.1 From 94a0e39d3eef2afdd3e9f6948ec92fe09d737f62 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 22 Dec 2011 00:50:40 +0000 Subject: Support new connection states and signals for NetworkManager 0.9+. Fixes #13859. committer: Elliott Sales de Andrade --- ChangeLog | 4 ++++ libpurple/network.c | 22 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6052503dd6..47d54db55f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 3.0.0 (??/??/????): + libpurple: + * Support new connection states and signals for NetworkManager 0.9+. + (Dan Williams) (#13859) + AIM and ICQ: * Make buddy list management code more efficient. (Oliver) (#4816) * Don't try to format ICQ usernames entered as email addresses. diff --git a/libpurple/network.c b/libpurple/network.c index 4e30d17f20..f0e4508477 100644 --- a/libpurple/network.c +++ b/libpurple/network.c @@ -811,8 +811,20 @@ purple_network_is_available(void) purple_debug_warning("network", "NetworkManager not active. Assuming connection exists.\n"); } - if (nm_state == NM_STATE_UNKNOWN || nm_state == NM_STATE_CONNECTED) - return TRUE; + switch (nm_state) + { + case NM_STATE_UNKNOWN: +#if NM_CHECK_VERSION(0,8,992) + case NM_STATE_CONNECTED_LOCAL: + case NM_STATE_CONNECTED_SITE: + case NM_STATE_CONNECTED_GLOBAL: +#else + case NM_STATE_CONNECTED: +#endif + return TRUE; + default: + break; + } return FALSE; @@ -1149,9 +1161,14 @@ purple_network_init(void) NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE); + /* NM 0.6 signal */ dbus_g_proxy_add_signal(nm_proxy, "StateChange", G_TYPE_UINT, G_TYPE_INVALID); dbus_g_proxy_connect_signal(nm_proxy, "StateChange", G_CALLBACK(nm_state_change_cb), NULL, NULL); + /* NM 0.7 and later signal */ + dbus_g_proxy_add_signal(nm_proxy, "StateChanged", G_TYPE_UINT, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(nm_proxy, "StateChanged", + G_CALLBACK(nm_state_change_cb), NULL, NULL); dbus_proxy = dbus_g_proxy_new_for_name(nm_conn, DBUS_SERVICE_DBUS, @@ -1186,6 +1203,7 @@ purple_network_uninit(void) #ifdef HAVE_NETWORKMANAGER if (nm_proxy) { dbus_g_proxy_disconnect_signal(nm_proxy, "StateChange", G_CALLBACK(nm_state_change_cb), NULL); + dbus_g_proxy_disconnect_signal(nm_proxy, "StateChanged", G_CALLBACK(nm_state_change_cb), NULL); g_object_unref(G_OBJECT(nm_proxy)); } if (dbus_proxy) { -- cgit v1.2.1 From 9a2fdb311d0e9c5e4bc8056c614f6b3b12f658bb Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 01:13:20 +0000 Subject: Rearrange code to prevent a NULL-deference. Thanks to clh for pointing out this issue. Closes #14392. --- pidgin/gtkconv.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index d8983dd635..6da5a91817 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6624,7 +6624,15 @@ pidgin_conv_chat_rename_user(PurpleConversation *conv, const char *old_name, if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) return; + if ((tag = get_buddy_tag(conv, old_name, 0, FALSE))) + g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL); + if ((tag = get_buddy_tag(conv, old_name, PURPLE_MESSAGE_NICK, FALSE))) + g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL); + old_cbuddy = purple_conv_chat_cb_find(chat, old_name); + if (!old_cbuddy) + return; + if (get_iter_from_chatbuddy(old_cbuddy, &iter)) { GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(old_cbuddy); @@ -6633,14 +6641,6 @@ pidgin_conv_chat_rename_user(PurpleConversation *conv, const char *old_name, purple_conv_chat_cb_set_ui_data(old_cbuddy, NULL); } - if ((tag = get_buddy_tag(conv, old_name, 0, FALSE))) - g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL); - if ((tag = get_buddy_tag(conv, old_name, PURPLE_MESSAGE_NICK, FALSE))) - g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL); - - if (!old_cbuddy) - return; - g_return_if_fail(new_alias != NULL); new_cbuddy = purple_conv_chat_cb_find(chat, new_name); -- cgit v1.2.1 From caa9b225e1e702423a931c02d69e618edb318ace Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Thu, 22 Dec 2011 01:27:58 +0000 Subject: Add support for selecting the sndio backends in the VV config plugin. Fixes #14414. committer: Elliott Sales de Andrade --- ChangeLog | 4 ++++ pidgin/plugins/vvconfig.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 47d54db55f..481278887f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,6 +41,10 @@ version 3.0.0 (??/??/????): (#14529) * Support file transfers up to ~9 EiB. + Plugins: + * The Voice/Video Settings plugin supports using the sndio GStreamer + backends. (Brad Smith) (#14414) + version 2.10.1 (12/06/2011): Finch: * Fix compilation on OpenBSD. diff --git a/pidgin/plugins/vvconfig.c b/pidgin/plugins/vvconfig.c index 93d85be586..e5017152f3 100644 --- a/pidgin/plugins/vvconfig.c +++ b/pidgin/plugins/vvconfig.c @@ -39,6 +39,7 @@ static const gchar *AUDIO_SRC_PLUGINS[] = { /* "esdmon", "ESD", ? */ "osssrc", "OSS", "pulsesrc", "PulseAudio", + "libsndiosrc", "sndio", /* "audiotestsrc wave=silence", "Silence", */ "audiotestsrc", "Test Sound", NULL @@ -50,6 +51,7 @@ static const gchar *AUDIO_SINK_PLUGINS[] = { "esdsink", "ESD", "osssink", "OSS", "pulsesink", "PulseAudio", + "libsndiosink", "sndio", NULL }; -- cgit v1.2.1 From cd226f649ed38b2b46ee9f31235d8a4fdf913569 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 01:42:18 +0000 Subject: Use correct format for printing gsize types. --- pidgin/gtkutils.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 8e066d4bdf..eb2574e51d 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -2533,9 +2533,9 @@ pidgin_convert_buddy_icon(PurplePlugin *plugin, const char *path, size_t *len) the image. */ purple_debug_info("buddyicon", "Converted image from " "%dx%d to %dx%d, format=%s, quality=%u, " - "filesize=%zu\n", orig_width, orig_height, - new_width, new_height, prpl_formats[i], quality, - length); + "filesize=%" G_GSIZE_FORMAT "\n", + orig_width, orig_height, new_width, new_height, + prpl_formats[i], quality, length); if (len) *len = length; g_strfreev(prpl_formats); @@ -3126,7 +3126,7 @@ static GObject *pidgin_pixbuf_from_data_helper(const guchar *buf, gsize count, g if (!gdk_pixbuf_loader_write(loader, buf, count, &error) || error) { purple_debug_warning("gtkutils", "gdk_pixbuf_loader_write() " - "failed with size=%zu: %s\n", count, + "failed with size=%" G_GSIZE_FORMAT ": %s\n", count, error ? error->message : "(no error message)"); if (error) g_error_free(error); @@ -3136,7 +3136,7 @@ static GObject *pidgin_pixbuf_from_data_helper(const guchar *buf, gsize count, g if (!gdk_pixbuf_loader_close(loader, &error) || error) { purple_debug_warning("gtkutils", "gdk_pixbuf_loader_close() " - "failed for image of size %zu: %s\n", count, + "failed for image of size %" G_GSIZE_FORMAT ": %s\n", count, error ? error->message : "(no error message)"); if (error) g_error_free(error); @@ -3150,7 +3150,7 @@ static GObject *pidgin_pixbuf_from_data_helper(const guchar *buf, gsize count, g pixbuf = G_OBJECT(gdk_pixbuf_loader_get_pixbuf(loader)); if (!pixbuf) { purple_debug_warning("gtkutils", "%s() returned NULL for image " - "of size %zu\n", + "of size %" G_GSIZE_FORMAT "\n", animated ? "gdk_pixbuf_loader_get_animation" : "gdk_pixbuf_loader_get_pixbuf", count); g_object_unref(G_OBJECT(loader)); -- cgit v1.2.1 From d86f4b3d45d0807e11a37dbe845f3e469854c31e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 03:09:12 +0000 Subject: Check for libm. I think I read somewhere that GDK pixbuf dropped its dependency on it, which is probably why this is showing up now. Closes #14799. --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index cc4d7958fe..b1e58e0ab4 100644 --- a/configure.ac +++ b/configure.ac @@ -202,6 +202,12 @@ AC_SYS_LARGEFILE dnl FreeBSD doesn't have libdl, dlopen is provided by libc AC_CHECK_FUNC(dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")]) +dnl Haiku does not use libm for the math functions, they are part +dnl of the C library +AC_SEARCH_LIBS([ceil], [m], [], [ + AC_MSG_ERROR([unable to find the floor() function]) +]) + AC_MSG_CHECKING(for fileno()) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include -- cgit v1.2.1 From b74e72f789ad512eb7d4f33ffd2083decbfac3db Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 04:27:59 +0000 Subject: The function gst_msg_db_to_percent already retyrns a number between 0.0 and 1.0, and a GtkProgressBar is between 0.0 and 1.0, so I don't know why the level is multiplied by 5. Maybe microphones aren't that loud? I expect the "volume" control to increase it, so I'm not so sure. I guess we'll see what people think. Fixes #14426. --- pidgin/gtkmedia.c | 2 +- pidgin/plugins/vvconfig.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c index 9f08449de4..598a3f4b74 100644 --- a/pidgin/gtkmedia.c +++ b/pidgin/gtkmedia.c @@ -455,7 +455,7 @@ level_message_cb(PurpleMedia *media, gchar *session_id, gchar *participant, progress = pidgin_media_get_widget(gtkmedia, session_id, participant); if (progress) - gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), level * 5); + gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), level); } diff --git a/pidgin/plugins/vvconfig.c b/pidgin/plugins/vvconfig.c index e5017152f3..f2b856fdd4 100644 --- a/pidgin/plugins/vvconfig.c +++ b/pidgin/plugins/vvconfig.c @@ -612,7 +612,7 @@ gst_bus_cb(GstBus *bus, GstMessage *msg, BusCbCtx *ctx) GstElement *valve; percent = gst_msg_db_to_percent(msg, "rms"); - gtk_progress_bar_set_fraction(ctx->level, percent * 5); + gtk_progress_bar_set_fraction(ctx->level, percent); percent = gst_msg_db_to_percent(msg, "decay"); threshold = gtk_range_get_value(ctx->threshold) / 100.0; -- cgit v1.2.1 From 1ecfcbb2999e7fd0ba54692e96b1cf57cdd2d926 Mon Sep 17 00:00:00 2001 From: Eion Robb Date: Thu, 22 Dec 2011 04:38:44 +0000 Subject: Allow compile of V/V on OSX without X11. Patch by Eion Robb. Fixes #14525. committer: Elliott Sales de Andrade --- pidgin/gtkmedia.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c index 598a3f4b74..f928290658 100644 --- a/pidgin/gtkmedia.c +++ b/pidgin/gtkmedia.c @@ -40,6 +40,8 @@ #ifdef _WIN32 #include +#elif defined(GDK_WINDOWING_QUARTZ) +#include #endif #include @@ -560,6 +562,8 @@ realize_cb_cb(PidginMediaRealizeData *data) window_id = GDK_WINDOW_HWND(window); #elif defined(HAVE_X11) window_id = GDK_WINDOW_XWINDOW(window); +#elif defined(GDK_WINDOWING_QUARTZ) + window_id = (gulong) gdk_quartz_window_get_nsview(window); #else # error "Unsupported windowing system" #endif @@ -1082,6 +1086,10 @@ create_default_video_src(PurpleMedia *media, src = gst_element_factory_make("dshowvideosrc", NULL); if (src == NULL) src = gst_element_factory_make("autovideosrc", NULL); +#elif defined(__APPLE__) + src = gst_element_factory_make("osxvideosrc", NULL); + if (src == NULL) + src = gst_element_factory_make("autovideosrc", NULL); #else src = gst_element_factory_make("gconfvideosrc", NULL); if (src == NULL) @@ -1136,6 +1144,8 @@ create_default_audio_src(PurpleMedia *media, src = gst_element_factory_make("osssrc", NULL); if (src == NULL) src = gst_element_factory_make("dshowaudiosrc", NULL); + if (src == NULL) + src = gst_element_factory_make("osxaudiosrc", NULL); if (src == NULL) { purple_debug_error("gtkmedia", "Unable to find a suitable " "element for the default audio source.\n"); -- cgit v1.2.1 From 4cbb88b60c6e9bc9c3c5ce23c7ff052f539dd56f Mon Sep 17 00:00:00 2001 From: The OpenSUSE Project Date: Thu, 22 Dec 2011 05:26:52 +0000 Subject: Fix building with GLib 2.31 and single includes. Fixes #14773. committer: Elliott Sales de Andrade --- libpurple/protocols/mxit/formcmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/mxit/formcmds.c b/libpurple/protocols/mxit/formcmds.c index 6c163bcd66..f14dbbd2b5 100644 --- a/libpurple/protocols/mxit/formcmds.c +++ b/libpurple/protocols/mxit/formcmds.c @@ -25,7 +25,7 @@ #include "internal.h" -#include +#include #include "purple.h" -- cgit v1.2.1 From 476fff3dd82429bf681bc18d3e4827f4728693f6 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 22 Dec 2011 05:45:40 +0000 Subject: Ensure that the user's close callback is invoked when search results are closed in finch. Fixes #14820. committer: Elliott Sales de Andrade --- finch/gntnotify.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/finch/gntnotify.c b/finch/gntnotify.c index 8f01243c30..11b3a3e590 100644 --- a/finch/gntnotify.c +++ b/finch/gntnotify.c @@ -397,6 +397,12 @@ finch_notify_sr_new_rows(PurpleConnection *gc, } } +static void +notify_sr_destroy_cb(GntWidget *window, void *data) +{ + purple_notify_close(PURPLE_NOTIFY_SEARCHRESULTS, window); +} + static void * finch_notify_searchresults(PurpleConnection *gc, const char *title, const char *primary, const char *secondary, @@ -481,6 +487,8 @@ finch_notify_searchresults(PurpleConnection *gc, const char *title, } gnt_box_add_widget(GNT_BOX(window), box); + g_signal_connect(G_OBJECT(tree), "destroy", + G_CALLBACK(notify_sr_destroy_cb), NULL); finch_notify_sr_new_rows(gc, results, tree); -- cgit v1.2.1 From 28d86b4d059dfc891bc6d247311958be01064ab8 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 22 Dec 2011 05:47:25 +0000 Subject: Ensure labelled buttons are shown for search results in Pidgin. Fixes #14821. committer: Elliott Sales de Andrade --- pidgin/gtknotify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 43745029ee..1511d3ab5c 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -1031,7 +1031,7 @@ pidgin_notify_searchresults(PurpleConnection *gc, const char *title, switch (b->type) { case PURPLE_NOTIFY_BUTTON_LABELED: if(b->label) { - button = gtk_button_new_with_label(b->label); + button = gtk_dialog_add_button(GTK_DIALOG(window), b->label, GTK_RESPONSE_NONE); } else { purple_debug_warning("gtknotify", "Missing button label\n"); } -- cgit v1.2.1 From 8b8f9d9c3850d9a5dff6d9ff32faa028d65f6e1e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 05:47:55 +0000 Subject: Add Howard to COPYRIGHT also. --- COPYRIGHT | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT b/COPYRIGHT index 3b5692d66f..2fde9f71f1 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -107,6 +107,7 @@ Patrick Cheung Ka-Hing Cheung Sadrul Habib Chowdhury Brian Chu +Howard Chu Arturo Cisneros, Jr. Vincas Ciziunas Jonathan Clark -- cgit v1.2.1 From 6b738568e890056899d884757b98847cf366a202 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 06:14:38 +0000 Subject: Use g_list_prepend, since we're going to sort this list afterwards. --- libpurple/protocols/jabber/caps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/protocols/jabber/caps.c b/libpurple/protocols/jabber/caps.c index a6221b5576..adda875202 100644 --- a/libpurple/protocols/jabber/caps.c +++ b/libpurple/protocols/jabber/caps.c @@ -794,11 +794,11 @@ static GList* jabber_caps_xdata_get_fields(const xmlnode *x) for (value = xmlnode_get_child(field, "value"); value; value = xmlnode_get_next_twin(value)) { gchar *val = xmlnode_get_data(value); - xdatafield->values = g_list_append(xdatafield->values, val); + xdatafield->values = g_list_prepend(xdatafield->values, val); } xdatafield->values = g_list_sort(xdatafield->values, (GCompareFunc)strcmp); - fields = g_list_append(fields, xdatafield); + fields = g_list_prepend(fields, xdatafield); } fields = g_list_sort(fields, jabber_caps_xdata_field_compare); -- cgit v1.2.1 From 035a747229b9cfbea8d0d7be8e048ab543813d51 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 06:28:12 +0000 Subject: Fix some leaks in XMPP caps hashing, as pointed out by max ulidtko. However, I didn't really apply his patch specifically, and made some other optimizations while I was there. Fixes #14701. --- libpurple/protocols/jabber/caps.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libpurple/protocols/jabber/caps.c b/libpurple/protocols/jabber/caps.c index adda875202..b03623af6f 100644 --- a/libpurple/protocols/jabber/caps.c +++ b/libpurple/protocols/jabber/caps.c @@ -875,21 +875,24 @@ gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash) g_free(formtype); while (fields) { - GList *value; JabberDataFormField *field = (JabberDataFormField*)fields->data; if (!g_str_equal(field->var, "FORM_TYPE")) { /* Append the "var" attribute */ append_escaped_string(context, field->var); /* Append elements' cdata */ - for (value = field->values; value; value = value->next) { - append_escaped_string(context, value->data); - g_free(value->data); + while (field->values) { + append_escaped_string(context, field->values->data); + g_free(field->values->data); + field->values = g_list_delete_link(field->values, + field->values); } + } else { + g_list_free_full(field->values, g_free); } g_free(field->var); - g_list_free(field->values); + g_free(field); fields = g_list_delete_link(fields, fields); } -- cgit v1.2.1 From e55021da6664a17bf8fadbad108f543e73c8eea0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 07:14:31 +0000 Subject: Fix a possible malloc(0). Not too sure if this can happen, though. --- libpurple/protocols/zephyr/ZRetSubs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpurple/protocols/zephyr/ZRetSubs.c b/libpurple/protocols/zephyr/ZRetSubs.c index 35ade9c2f4..376b218a3a 100644 --- a/libpurple/protocols/zephyr/ZRetSubs.c +++ b/libpurple/protocols/zephyr/ZRetSubs.c @@ -132,6 +132,11 @@ static Code_t Z_RetSubs(notice, nsubs, auth_routine) __subscriptions_num = __subscriptions_num / 3; + if (!__subscriptions_num) { + ZFreeNotice(&retnotice); + continue; + } + __subscriptions_list = (ZSubscription_t *) malloc((unsigned)(__subscriptions_num* sizeof(ZSubscription_t))); -- cgit v1.2.1 From ba99d78e6cfd6703aa96c2b8282b4456cb99ddf0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 07:31:50 +0000 Subject: Initialize parent_iter to prevent clang-analyzer from complaining. In fact, it's not a problem. If the node is not a group, then it has a group as a parent. If it is a group, then sort_method_none will be called, which checks node->parent before using the iter. But clang-analyzer can't know these things. --- pidgin/gtkblist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 8bdca7e76b..58b2add530 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -6225,7 +6225,7 @@ static void pidgin_blist_selection_changed(GtkTreeSelection *selection, gpointer static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTreeIter *iter) { - GtkTreeIter parent_iter, cur, *curptr = NULL; + GtkTreeIter parent_iter = {0, NULL, NULL, NULL}, cur, *curptr = NULL; struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkTreePath *newpath; -- cgit v1.2.1 From f1d2101fdcd26eaf2fa9bbac940525f66c60a0cb Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 07:40:15 +0000 Subject: It seems to me this should be new_alias, not alias. --- libpurple/conversation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/conversation.c b/libpurple/conversation.c index f719c5ea8d..b6a6058675 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -1895,7 +1895,7 @@ purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, { const char *display_name = purple_connection_get_display_name(gc); if (display_name != NULL) - alias = display_name; + new_alias = display_name; } } } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { -- cgit v1.2.1 From 76b1a7e3b809eebbee946d1c4b3d4d3a3ea6788e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 07:55:41 +0000 Subject: It seems like we should be using this color tag for something... --- libpurple/protocols/bonjour/jabber.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index f1a9c07684..a750e07260 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -206,7 +206,9 @@ _jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb) g_string_append_printf(str, " face='%s'", font_face); if (font_size) g_string_append_printf(str, " size='%s'", font_size); - if (ichat_text_color) + if (font_color) + g_string_append_printf(str, " color='%s'", font_color); + else if (ichat_text_color) g_string_append_printf(str, " color='%s'", ichat_text_color); if (ichat_balloon_color) g_string_append_printf(str, " back='%s'", ichat_balloon_color); -- cgit v1.2.1 From 2efb74f44ae4e187e628aa86a6d8318f59c75d68 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 22 Dec 2011 08:39:45 +0000 Subject: Remove dead assignments found with clang-analyzer. Also, remove the unused variables resulting from this cleanup. Added a FIXME in cases where variables are not read, but should be used later. --- libpurple/plugins/log_reader.c | 1 - libpurple/protocols/gg/gg.c | 2 ++ libpurple/protocols/mxit/filexfer.c | 3 --- libpurple/protocols/mxit/login.c | 2 ++ libpurple/protocols/mxit/markup.c | 1 + libpurple/protocols/novell/novell.c | 3 --- libpurple/protocols/oscar/oscar.c | 6 ------ libpurple/protocols/oscar/peer.c | 4 ---- libpurple/protocols/oscar/userinfo.c | 4 ---- libpurple/protocols/silc/ops.c | 1 - libpurple/protocols/silc/silc.c | 2 +- libpurple/protocols/silc/wb.c | 2 -- libpurple/protocols/yahoo/libymsg.c | 2 -- libpurple/proxy.c | 1 - pidgin/gtkpounce.c | 9 --------- 15 files changed, 6 insertions(+), 37 deletions(-) diff --git a/libpurple/plugins/log_reader.c b/libpurple/plugins/log_reader.c index c1dafea7ec..3520221656 100644 --- a/libpurple/plugins/log_reader.c +++ b/libpurple/plugins/log_reader.c @@ -2203,7 +2203,6 @@ static GList *amsn_logger_parse_file(char *filename, const char *sn, PurpleAccou log->logger = amsn_logger; log->logger_data = data; list = g_list_prepend(list, log); - found_start = FALSE; purple_debug_info("aMSN logger", "Found log for %s:" diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 5d721cc74e..140d0be586 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -1091,6 +1091,7 @@ static void gg_get_avatar_url_cb(PurpleUtilFetchUrlData *url_data, gpointer user purple_debug_info("gg", "gg_get_avatar_url_cb: " "requesting avatar for %s\n", uin); + /* FIXME: This should be cancelled somewhere if not needed. */ url_data = purple_util_fetch_url_request(account, bigavatar, TRUE, "Mozilla/4.0 (compatible; MSIE 5.0)", FALSE, NULL, FALSE, -1, gg_fetch_avatar_cb, data); @@ -1119,6 +1120,7 @@ static void ggp_update_buddy_avatar(PurpleConnection *gc, uin_t uin) avatarurl = g_strdup_printf("http://api.gadu-gadu.pl/avatars/%u/0.xml", uin); + /* FIXME: This should be cancelled somewhere if not needed. */ url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), avatarurl, TRUE, "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, NULL, FALSE, -1, diff --git a/libpurple/protocols/mxit/filexfer.c b/libpurple/protocols/mxit/filexfer.c index a6e4beedeb..ec948e1c91 100644 --- a/libpurple/protocols/mxit/filexfer.c +++ b/libpurple/protocols/mxit/filexfer.c @@ -427,15 +427,12 @@ static PurpleXfer* find_mxit_xfer( struct MXitSession* session, const char* file void mxit_xfer_rx_file( struct MXitSession* session, const char* fileid, const char* data, int datalen ) { PurpleXfer* xfer = NULL; - struct mxitxfer* mx = NULL; purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_rx_file: (size=%i)\n", datalen ); /* find the file-transfer object */ xfer = find_mxit_xfer( session, fileid ); if ( xfer ) { - mx = purple_xfer_get_protocol_data( xfer ); - /* this is the transfer we have been looking for */ purple_xfer_ref( xfer ); purple_xfer_start( xfer, -1, NULL, 0 ); diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index eaf96828ba..66bf26db88 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -567,6 +567,7 @@ static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* field MXIT_CAPTCHA_WIDTH, time( NULL ) ); + /* FIXME: This should be cancelled somewhere if not needed. */ url_data = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_clientinfo2, session ); #ifdef DEBUG_PROTOCOL @@ -731,6 +732,7 @@ static void get_clientinfo( struct MXitSession* session ) /* reference: "libpurple/util.h" */ url = g_strdup_printf( "%s/res/?type=challenge&getcountries=true&getlanguage=true&getimage=true&h=%i&w=%i&ts=%li", wapserver, MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); + /* FIXME: This should be cancelled somewhere if not needed. */ url_data = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_clientinfo1, session ); #ifdef DEBUG_PROTOCOL diff --git a/libpurple/protocols/mxit/markup.c b/libpurple/protocols/mxit/markup.c index 635b1b06d3..f209b42a14 100644 --- a/libpurple/protocols/mxit/markup.c +++ b/libpurple/protocols/mxit/markup.c @@ -628,6 +628,7 @@ static void emoticon_request( struct RXMsgData* mx, const char* id ) /* reference: "libpurple/util.h" */ url = g_strdup_printf( "%s/res/?type=emo&mlh=%i&sc=%s&ts=%li", wapserver, MXIT_EMOTICON_SIZE, id, time( NULL ) ); + /* FIXME: This should be cancelled somewhere if not needed. */ url_data = purple_util_fetch_url( url, TRUE, NULL, TRUE, -1, emoticon_returned, mx ); g_free( url ); } diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index 45765c9821..416e0b0279 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -1177,7 +1177,6 @@ _update_buddy_status(NMUser *user, PurpleBuddy * buddy, int novellstatus, int gm const char *dn; const char *name; int idle = 0; - gboolean loggedin = TRUE; account = purple_buddy_get_account(buddy); name = purple_buddy_get_name(buddy); @@ -1194,7 +1193,6 @@ _update_buddy_status(NMUser *user, PurpleBuddy * buddy, int novellstatus, int gm break; case NM_STATUS_OFFLINE: status_id = NOVELL_STATUS_TYPE_OFFLINE; - loggedin = FALSE; break; case NM_STATUS_AWAY_IDLE: status_id = NOVELL_STATUS_TYPE_AWAY; @@ -1202,7 +1200,6 @@ _update_buddy_status(NMUser *user, PurpleBuddy * buddy, int novellstatus, int gm break; default: status_id = NOVELL_STATUS_TYPE_OFFLINE; - loggedin = FALSE; break; } diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index e74e767275..96b0c71384 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -3481,13 +3481,11 @@ oscar_set_info(PurpleConnection *gc, const char *rawinfo) static guint32 oscar_get_extended_status(PurpleConnection *gc) { - OscarData *od; PurpleAccount *account; PurpleStatus *status; const gchar *status_id; guint32 data = 0x00000000; - od = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); status = purple_account_get_active_status(account); status_id = purple_status_get_id(status); @@ -4619,7 +4617,6 @@ const char *oscar_list_emblem(PurpleBuddy *b) PurpleAccount *account = NULL; PurplePresence *presence; PurpleStatus *status; - const char *status_id; aim_userinfo_t *userinfo = NULL; const char *name; @@ -4634,7 +4631,6 @@ const char *oscar_list_emblem(PurpleBuddy *b) presence = purple_buddy_get_presence(b); status = purple_presence_get_active_status(presence); - status_id = purple_status_get_id(status); if (purple_presence_is_online(presence) == FALSE) { char *gname; @@ -4693,7 +4689,6 @@ char *oscar_status_text(PurpleBuddy *b) OscarData *od; const PurplePresence *presence; const PurpleStatus *status; - const char *id; const char *message; gchar *ret = NULL; @@ -4702,7 +4697,6 @@ char *oscar_status_text(PurpleBuddy *b) od = purple_connection_get_protocol_data(gc); presence = purple_buddy_get_presence(b); status = purple_presence_get_active_status(presence); - id = purple_status_get_id(status); if ((od != NULL) && !purple_presence_is_online(presence)) { diff --git a/libpurple/protocols/oscar/peer.c b/libpurple/protocols/oscar/peer.c index d67d310285..36cd573fda 100644 --- a/libpurple/protocols/oscar/peer.c +++ b/libpurple/protocols/oscar/peer.c @@ -603,15 +603,11 @@ void peer_connection_listen_cb(gpointer data, gint source, PurpleInputCondition cond) { PeerConnection *conn; - OscarData *od; - PurpleConnection *gc; struct sockaddr addr; socklen_t addrlen = sizeof(addr); int flags; conn = data; - od = conn->od; - gc = od->gc; purple_debug_info("oscar", "Accepting connection on listener socket.\n"); diff --git a/libpurple/protocols/oscar/userinfo.c b/libpurple/protocols/oscar/userinfo.c index 73f685cf3e..60e96af75c 100644 --- a/libpurple/protocols/oscar/userinfo.c +++ b/libpurple/protocols/oscar/userinfo.c @@ -307,8 +307,6 @@ oscar_user_info_append_extra_info(PurpleConnection *gc, PurpleNotifyUserInfo *us { OscarData *od; PurpleAccount *account; - PurplePresence *presence = NULL; - PurpleStatus *status = NULL; PurpleGroup *g = NULL; struct buddyinfo *bi = NULL; char *tmp; @@ -330,8 +328,6 @@ oscar_user_info_append_extra_info(PurpleConnection *gc, PurpleNotifyUserInfo *us bname = purple_buddy_get_name(b); g = purple_buddy_get_group(b); gname = purple_group_get_name(g); - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); } if (userinfo != NULL) diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c index bcb121539a..11d062e26c 100644 --- a/libpurple/protocols/silc/ops.c +++ b/libpurple/protocols/silc/ops.c @@ -224,7 +224,6 @@ silcpurple_mime_message(SilcClient client, SilcClientConnection conn, tmp, cflags, time(NULL)); purple_imgstore_unref_by_id(imgid); - cflags = 0; ret = TRUE; } goto out; diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index c6b15fd2da..c44054b6c7 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -400,7 +400,7 @@ silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream, } /* Perform SILC Key Exchange. */ - silc_client_key_exchange(sg->client, ¶ms, sg->public_key, + silc_client_key_exchange(client, ¶ms, sg->public_key, sg->private_key, stream, SILC_CONN_SERVER, silcpurple_connect_cb, gc); diff --git a/libpurple/protocols/silc/wb.c b/libpurple/protocols/silc/wb.c index 3036a7404f..b7dcde7a4f 100644 --- a/libpurple/protocols/silc/wb.c +++ b/libpurple/protocols/silc/wb.c @@ -105,11 +105,9 @@ typedef struct { PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry) { - SilcClientConnection conn; PurpleWhiteboard *wb; SilcPurpleWb wbs; - conn = sg->conn; wb = purple_whiteboard_get_session(sg->account, client_entry->nickname); if (!wb) wb = purple_whiteboard_create(sg->account, client_entry->nickname, 0); diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index eab9242fb8..61736b9b6b 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -634,7 +634,6 @@ static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) { GSList *l = pkt->hash; - gboolean export = FALSE; gboolean got_serv_list = FALSE; YahooFriend *f = NULL; PurpleAccount *account = purple_connection_get_account(gc); @@ -712,7 +711,6 @@ static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) } b = purple_buddy_new(account, norm_bud, NULL); purple_blist_add_buddy(b, NULL, g, NULL); - export = TRUE; } yahoo_do_group_check(account, ht, norm_bud, grp); diff --git a/libpurple/proxy.c b/libpurple/proxy.c index dade7f3cc7..807d73da6d 100644 --- a/libpurple/proxy.c +++ b/libpurple/proxy.c @@ -2024,7 +2024,6 @@ s5_canwrite(gpointer data, gint source, PurpleInputCondition cond) return; } - i = 0; buf[0] = 0x05; /* SOCKS version 5 */ if (purple_proxy_info_get_username(connect_data->gpi) != NULL) { diff --git a/pidgin/gtkpounce.c b/pidgin/gtkpounce.c index e1237e6a11..7c87b6ef05 100644 --- a/pidgin/gtkpounce.c +++ b/pidgin/gtkpounce.c @@ -1419,7 +1419,6 @@ pounce_cb(PurplePounce *pounce, PurplePounceEvent events, void *data) if (purple_pounce_action_is_enabled(pounce, "popup-notify")) { char *tmp; - const char *name_shown; const char *reason; reason = purple_pounce_action_get_attribute(pounce, "popup-notify", "reason"); @@ -1452,14 +1451,6 @@ pounce_cb(PurplePounce *pounce, PurplePounceEvent events, void *data) _("Unknown.... Please report this!") ); - /* - * Ok here is where I change the second argument, title, from - * NULL to the account alias if we have it or the account - * name if that's all we have - */ - if ((name_shown = purple_account_get_alias(account)) == NULL) - name_shown = purple_account_get_username(account); - pidgin_notify_pounce_add(account, pounce, alias, tmp, reason, purple_date_format_full(NULL)); -- cgit v1.2.1 From 7c87d10fdc668d240faf22f2d531f41316a29e7c Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 22 Dec 2011 23:23:49 +0000 Subject: Fix insertion order of search results in Finch. I fixed the type from the original patch by Howard. Fixes #14822. committer: Elliott Sales de Andrade --- finch/gntnotify.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/finch/gntnotify.c b/finch/gntnotify.c index 11b3a3e590..103495dc93 100644 --- a/finch/gntnotify.c +++ b/finch/gntnotify.c @@ -386,6 +386,7 @@ finch_notify_sr_new_rows(PurpleConnection *gc, { GntTree *tree = GNT_TREE(data); GList *o; + GntTreeRow *prev = NULL; /* XXX: Do I need to empty the tree here? */ @@ -393,7 +394,8 @@ finch_notify_sr_new_rows(PurpleConnection *gc, { gnt_tree_add_row_after(GNT_TREE(tree), o->data, gnt_tree_create_row_from_list(GNT_TREE(tree), o->data), - NULL, NULL); + NULL, prev); + prev = o->data; } } -- cgit v1.2.1 From c66f511062c268cae1fc9eecbdc6e9b74448f4a5 Mon Sep 17 00:00:00 2001 From: Tim Retout Date: Thu, 22 Dec 2011 23:51:01 +0000 Subject: Select the first item in the mail-notification dialog. Also, change the treeview to "Browse" mode. I changed the patch to use a GtkTreeIter instead of a GtkTreePath, which is simpler. Also, remove some redundant function calls due to the newly introduced variables. Fixes #5789. committer: Elliott Sales de Andrade --- COPYRIGHT | 1 + pidgin/gtknotify.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index 2fde9f71f1..df76c15727 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -429,6 +429,7 @@ Etan Reisner David Reiss Luoh Ren-Shan Noa Resare +Tim Retout Daniele Ricci Kristian Rietveld Pekka Riikonen diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 1511d3ab5c..791341233e 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -689,6 +689,8 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, PurpleAccount *account; PidginNotifyMailData *data = NULL, *data2; gboolean new_data = FALSE; + GtkTreeSelection *sel; + GtkTreeIter iter; /* Don't bother updating if there aren't new emails and we don't have any displayed currently */ if (count == 0 && mail_dialog == NULL) @@ -775,6 +777,13 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, } } + /* Select first item if nothing selected */ + sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(mail_dialog->treeview)); + if ((gtk_tree_selection_count_selected_rows(sel) < 1) + && gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) { + gtk_tree_selection_select_iter(sel, &iter); + } + if (!GTK_WIDGET_VISIBLE(mail_dialog->dialog)) { GdkPixbuf *pixbuf = gtk_widget_render_icon(mail_dialog->dialog, PIDGIN_STOCK_DIALOG_MAIL, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), NULL); @@ -1530,11 +1539,13 @@ pidgin_create_notification_dialog(PidginNotifyType type) gtk_tree_view_set_search_column(GTK_TREE_VIEW(spec_dialog->treeview), PIDGIN_MAIL_TEXT); gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(spec_dialog->treeview), pidgin_tree_view_search_equal_func, NULL, NULL); + sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(spec_dialog->treeview)); + gtk_tree_selection_set_mode(sel, GTK_SELECTION_BROWSE); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(email_response_cb), spec_dialog); - g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(spec_dialog->treeview))), - "changed", G_CALLBACK(selection_changed_cb), spec_dialog); + g_signal_connect(G_OBJECT(sel), "changed", + G_CALLBACK(selection_changed_cb), spec_dialog); g_signal_connect(G_OBJECT(spec_dialog->treeview), "row-activated", G_CALLBACK(email_row_activated_cb), NULL); column = gtk_tree_view_column_new(); -- cgit v1.2.1 From a1424630db772eecf0046bb441623c38ea541f6f Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 22 Dec 2011 23:57:38 +0000 Subject: Regenerate plugins menu on conversation feature change too Fixes #14843. committer: Elliott Sales de Andrade --- pidgin/gtkconv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 6da5a91817..e1f1d53fb7 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -7152,6 +7152,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) { gray_stuff_out(PIDGIN_CONVERSATION(conv)); generate_send_to_items(win); + regenerate_plugins_items(win); } if (fields & PIDGIN_CONV_TAB_ICON) -- cgit v1.2.1 From 985f1aede3c2608500273cc8cfefd994cf5b7ec7 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Dec 2011 01:09:13 +0000 Subject: Add a function for retrieving the raw DER representation of a certification. --- libpurple/certificate.c | 18 ++++++++++++++++++ libpurple/certificate.h | 21 ++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/libpurple/certificate.c b/libpurple/certificate.c index dc2b53b472..f92a207e48 100644 --- a/libpurple/certificate.c +++ b/libpurple/certificate.c @@ -499,6 +499,24 @@ purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t return (scheme->get_times)(crt, activation, expiration); } +GByteArray * +purple_certificate_get_der_data(PurpleCertificate *crt) +{ + PurpleCertificateScheme *scheme; + GByteArray *data; + + g_return_val_if_fail(crt, NULL); + g_return_val_if_fail(crt->scheme, NULL); + + scheme = crt->scheme; + + g_return_val_if_fail(scheme->get_der_data, NULL); + + data = (scheme->get_der_data)(crt); + + return data; +} + gchar * purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id) { diff --git a/libpurple/certificate.h b/libpurple/certificate.h index b2cdf738fc..c13b38696d 100644 --- a/libpurple/certificate.h +++ b/libpurple/certificate.h @@ -257,9 +257,17 @@ struct _PurpleCertificateScheme */ GSList * (* import_certificates)(const gchar * filename); + /** + * Retrieves the certificate data in DER form + * + * @param crt Certificate instance + * @return Binary DER representation of certificate - must be freed using + * g_byte_array_free() + */ + GByteArray * (* get_der_data)(PurpleCertificate *crt); + void (*_purple_reserved1)(void); void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); }; /** A set of operations used to provide logic for verifying a Certificate's @@ -561,6 +569,17 @@ purple_certificate_check_subject_name(PurpleCertificate *crt, const gchar *name) gboolean purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t *expiration); +/** + * Retrieves the certificate data in DER form. + * + * @param crt Certificate instance + * + * @return Binary DER representation of the certificate - must be freed using + * g_byte_array_free(). + */ +GByteArray * +purple_certificate_get_der_data(PurpleCertificate *crt); + /*@}*/ /*****************************************************************************/ -- cgit v1.2.1 From 0b303dfd669f5683994aeed72e1afae4a0d75566 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Dec 2011 01:52:16 +0000 Subject: Add NSS support for getting DER data. --- libpurple/plugins/ssl/ssl-nss.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/libpurple/plugins/ssl/ssl-nss.c b/libpurple/plugins/ssl/ssl-nss.c index 6ed90db538..82121989e4 100644 --- a/libpurple/plugins/ssl/ssl-nss.c +++ b/libpurple/plugins/ssl/ssl-nss.c @@ -930,6 +930,29 @@ x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration) return TRUE; } +static GByteArray * +x509_get_der_data(PurpleCertificate *crt) +{ + CERTCertificate *crt_dat; + SECItem *dercrt; + GByteArray *data; + + crt_dat = X509_NSS_DATA(crt); + g_return_val_if_fail(crt_dat, NULL); + + dercrt = SEC_ASN1EncodeItem(NULL, NULL, crt_dat, + SEC_ASN1_GET(SEC_SignedCertificateTemplate)); + g_return_val_if_fail(dercrt != NULL, FALSE); + + data = g_byte_array_sized_new(dercrt->len); + memcpy(data->data, dercrt->data, dercrt->len); + data->len = dercrt->len; + + SECITEM_FreeItem(dercrt, PR_TRUE); + + return data; +} + static PurpleCertificateScheme x509_nss = { "x509", /* Scheme name */ N_("X.509 Certificates"), /* User-visible scheme name */ @@ -945,8 +968,8 @@ static PurpleCertificateScheme x509_nss = { x509_check_name, /* Check subject name */ x509_times, /* Activation/Expiration time */ x509_importcerts_from_file, /* Multiple certificate import function */ + x509_get_der_data, /* Binary DER data */ - NULL, NULL, NULL }; -- cgit v1.2.1 From cf1ec87456519ed5620f41969d5918a015bb3b06 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Dec 2011 02:05:09 +0000 Subject: Add GnuTLS support for exporting DER data. --- libpurple/plugins/ssl/ssl-gnutls.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/libpurple/plugins/ssl/ssl-gnutls.c b/libpurple/plugins/ssl/ssl-gnutls.c index 00b691ba81..8ae0fa0aa7 100644 --- a/libpurple/plugins/ssl/ssl-gnutls.c +++ b/libpurple/plugins/ssl/ssl-gnutls.c @@ -1142,6 +1142,37 @@ x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration) return success; } +static GByteArray * +x509_get_der_data(PurpleCertificate *crt) +{ + gnutls_x509_crt crt_dat; + GByteArray *data; + size_t len; + int ret; + + crt_dat = X509_GET_GNUTLS_DATA(crt); + g_return_val_if_fail(crt_dat, NULL); + + /* Obtain the output size required */ + len = 0; + ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_DER, NULL, &len); + g_return_val_if_fail(ret == GNUTLS_E_SHORT_MEMORY_BUFFER, NULL); + + /* Now allocate a buffer and *really* export it */ + data = g_byte_array_sized_new(len); + data->len = len; + ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_DER, data->data, &len); + if (ret != 0) { + purple_debug_error("gnutls/x509", + "Failed to export cert to buffer with code %d\n", + ret); + g_byte_array_free(data, TRUE); + return NULL; + } + + return data; +} + /* X.509 certificate operations provided by this plugin */ static PurpleCertificateScheme x509_gnutls = { "x509", /* Scheme name */ @@ -1158,8 +1189,8 @@ static PurpleCertificateScheme x509_gnutls = { x509_check_name, /* Check subject name */ x509_times, /* Activation/Expiration time */ x509_importcerts_from_file, /* Multiple certificates import function */ + x509_get_der_data, /* Binary DER data */ - NULL, NULL, NULL -- cgit v1.2.1 From db95793ecf69ec1a13a3bf5e1474a94e30723d10 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Dec 2011 02:13:20 +0000 Subject: rekkanoryo pointed out that this error message is for a different function than is actually tested. Also, make a note that Windows does not use libm. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b1e58e0ab4..54e4659ea1 100644 --- a/configure.ac +++ b/configure.ac @@ -202,10 +202,10 @@ AC_SYS_LARGEFILE dnl FreeBSD doesn't have libdl, dlopen is provided by libc AC_CHECK_FUNC(dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")]) -dnl Haiku does not use libm for the math functions, they are part +dnl Windows and Haiku do not use libm for the math functions, they are part dnl of the C library AC_SEARCH_LIBS([ceil], [m], [], [ - AC_MSG_ERROR([unable to find the floor() function]) + AC_MSG_ERROR([unable to find the ceil() function]) ]) AC_MSG_CHECKING(for fileno()) -- cgit v1.2.1 From 159c89bfa8b8c5929f6f116d73c507c6b8cdce4c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Dec 2011 03:59:39 +0000 Subject: Optionally show certificates using GCR's widgets. These are much more functional than the prompts we used to show. However, this is only applied to the Certificate Viewer, and not any errors, etc. I think we'll have to make a change to the request API for showing certificates in a dialog and have the UI decide how to show them, but that's for later. This was written for Fedora 14, which I no longer have. I made some tweaks and cleanup since I just added the _get_der_data function, but I can't guarantee this still works. --- configure.ac | 25 ++++++++++++++++++++++++- pidgin/Makefile.am | 2 ++ pidgin/gtkcertmgr.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 54e4659ea1..a2bb4f0fc1 100644 --- a/configure.ac +++ b/configure.ac @@ -407,6 +407,10 @@ AC_ARG_ENABLE(gestures, [AC_HELP_STRING([--disable-gestures], [compile without the gestures plugin])], enable_gestures="$enableval", enable_gestures="yes") +AC_ARG_ENABLE(gcr, + [AC_HELP_STRING([--enable-gcr], + [compile with GCR certificate widgets])], + enable_gcr="$enableval", enable_gcr="no") AC_PATH_XTRA # We can't assume that $x_libraries will be set, because autoconf does not @@ -620,9 +624,26 @@ Use --disable-cap if you do not need the Contact Availability Prediction plugin. ]) fi]) fi - + + dnl ####################################################################### + dnl # Check for GCR for its certificate widgets + dnl ####################################################################### + if test "x$enable_gcr" = "xyes"; then + PKG_CHECK_MODULES(GCR, gcr-0, [ + AC_DEFINE(ENABLE_GCR, 1, [Define to 1 if GCR is found.])], [ + AC_MSG_RESULT(no) + enable_gcr="no" + if test "x$force_deps" = "xyes" ; then + AC_MSG_ERROR([ +GCR development headers not found. +Use --disable-gcr if you do not need GCR certificate widgets. +]) + fi]) + fi + else # GTK + enable_gcr=no enable_cap=no enable_gevolution=no enable_gtkspell=no @@ -635,6 +656,7 @@ AM_CONDITIONAL(ENABLE_GTK, test "x$enable_gtkui" = "xyes") AM_CONDITIONAL(BUILD_GEVOLUTION, test "x$enable_gevolution" = "xyes") AM_CONDITIONAL(ENABLE_CAP, test "x$enable_cap" = "xyes") AM_CONDITIONAL(ENABLE_GESTURES, test "x$enable_gestures" = "xyes") +AM_CONDITIONAL(ENABLE_GCR, test "x$enable_gcr" = "xyes") dnl ####################################################################### @@ -2594,6 +2616,7 @@ echo Use XScreenSaver Extension.... : $enable_screensaver echo Use X Session Management...... : $enable_sm echo Use startup notification...... : $enable_startup_notification echo Build with GtkSpell support... : $enable_gtkspell +echo Build with GCR widgets........ : $enable_gcr echo echo Build with plugin support..... : $enable_plugins echo Build with Mono support....... : $enable_mono diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index 5b2c2d0038..043c8196a2 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -156,6 +156,7 @@ pidgin_LDFLAGS = -export-dynamic pidgin_LDADD = \ @LIBOBJS@ \ $(GLIB_LIBS) \ + $(GCR_LIBS) \ $(DBUS_LIBS) \ $(GSTREAMER_LIBS) \ $(XSS_LIBS) \ @@ -181,6 +182,7 @@ AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ $(GLIB_CFLAGS) \ + $(GCR_CFLAGS) \ $(GSTREAMER_CFLAGS) \ $(DEBUG_CFLAGS) \ $(GTK_CFLAGS) \ diff --git a/pidgin/gtkcertmgr.c b/pidgin/gtkcertmgr.c index 48b2944a09..daf999ccc2 100644 --- a/pidgin/gtkcertmgr.c +++ b/pidgin/gtkcertmgr.c @@ -40,6 +40,12 @@ #include "gtkcertmgr.h" +#ifdef ENABLE_GCR +#define GCR_API_SUBJECT_TO_CHANGE +#include +#include +#endif + /***************************************************************************** * X.509 tls_peers management interface * *****************************************************************************/ @@ -310,6 +316,13 @@ tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data) GtkTreeModel *model; gchar *id; PurpleCertificate *crt; +#ifdef ENABLE_GCR + GByteArray *der; + GcrCertificate *gcrt; + char *title; + GtkWidget *dialog; + GcrCertificateBasicsWidget *cert_widget; +#endif /* See if things are selected */ if (!gtk_tree_selection_get_selected(select, &model, &iter)) { @@ -325,11 +338,38 @@ tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data) crt = purple_certificate_pool_retrieve(tpm_dat->tls_peers, id); g_return_if_fail(crt); +#ifdef ENABLE_GCR + der = purple_certificate_get_der_data(crt); + g_return_if_fail(der); + + gcrt = gcr_simple_certificate_new(der->data, der->len); + g_return_if_fail(gcrt); + + /* Fire the notification */ + title = g_strdup_printf(_("Certificate Information for %s"), id); + dialog = gtk_dialog_new_with_buttons(title, + NULL, + 0, + GTK_STOCK_OK, + GTK_RESPONSE_ACCEPT, + NULL); + cert_widget = gcr_certificate_basics_widget_new(gcrt); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + GTK_WIDGET(cert_widget), TRUE, TRUE, 0); + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + gtk_widget_show_all(dialog); + + g_byte_array_free(der, TRUE); + g_object_unref(G_OBJECT(gcrt)); +#else /* Fire the notification */ purple_certificate_display_x509(crt); g_free(id); purple_certificate_destroy(crt); +#endif } static void -- cgit v1.2.1 From 6f8c70b32b119325b6cdac3dd67c7b3c1219302e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Dec 2011 08:06:49 +0000 Subject: Fix some merging typos. --- pidgin/gtkconv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index d424c6fb17..9565dadfe8 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1231,17 +1231,17 @@ menu_send_file_cb(GtkAction *action, gpointer data) } static void -menu_get_attention_cb(GtkAction *ation, gpointer data) +menu_get_attention_cb(GObject *obj, gpointer data) { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { int index; - if (widget == win->menu.get_attention) + if ((GtkAction *)obj == win->menu.get_attention) index = 0; else - index = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "index")); + index = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(obj), "index")); purple_prpl_send_attention(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), index); } -- cgit v1.2.1 From 3c13c41667f2613aad9d45d9803afb9a24fd981f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 23 Dec 2011 08:21:58 +0000 Subject: A boring and large patch so I can merge heads. --- COPYRIGHT | 2 + ChangeLog | 70 + ChangeLog.API | 186 ++- configure.ac | 58 +- doc/account-signals.dox | 10 - doc/blist-signals.dox | 2 - doc/connection-signals.dox | 1 - doc/conversation-signals.dox | 6 - doc/gtkconv-signals.dox | 2 - doc/notify-signals.dox | 2 - finch/gntaccount.h | 2 - finch/gntblist.c | 68 +- finch/gntblist.h | 7 - finch/gntconv.c | 64 +- finch/gntconv.h | 2 +- finch/gntft.c | 27 +- finch/gntnotify.c | 14 +- finch/gntrequest.c | 36 +- finch/gntrequest.h | 1 - finch/gntroomlist.c | 7 +- finch/gntsound.c | 4 +- finch/gntsound.h | 12 - finch/libgnt/gntwm.c | 2 +- finch/plugins/gntgf.c | 4 +- finch/plugins/gnttinyurl.c | 4 +- finch/plugins/grouping.c | 2 +- finch/plugins/lastlog.c | 2 +- libpurple/account.c | 176 +-- libpurple/account.h | 76 +- libpurple/accountopt.c | 45 + libpurple/accountopt.h | 49 +- libpurple/blist.c | 44 +- libpurple/blist.h | 95 +- libpurple/buddyicon.c | 19 - libpurple/buddyicon.h | 37 - libpurple/certificate.c | 28 +- libpurple/certificate.h | 45 +- libpurple/cmds.c | 5 + libpurple/cmds.h | 3 - libpurple/connection.c | 42 +- libpurple/connection.h | 99 +- libpurple/conversation.c | 251 ++- libpurple/conversation.h | 247 ++- libpurple/core.h | 4 - libpurple/dbus-analyze-functions.py | 10 +- libpurple/dbus-bindings.h | 12 +- libpurple/dbus-server.c | 22 +- libpurple/dbus-server.h | 2 - libpurple/dbus-useful.c | 2 +- libpurple/debug.c | 7 - libpurple/debug.h | 8 - libpurple/dnsquery.c | 13 +- libpurple/dnsquery.h | 23 +- libpurple/dnssrv.c | 30 +- libpurple/dnssrv.h | 90 +- libpurple/eventloop.h | 3 - libpurple/example/nullclient.c | 2 +- libpurple/ft.c | 91 +- libpurple/ft.h | 130 +- libpurple/imgstore.h | 1 - libpurple/log.c | 2 +- libpurple/log.h | 2 - libpurple/media-gst.h | 16 - libpurple/media.h | 58 - libpurple/media/backend-fs2.h | 2 - libpurple/media/backend-iface.h | 20 - libpurple/media/candidate.h | 34 - libpurple/media/codec.h | 28 - libpurple/media/enum-types.h | 12 - libpurple/mediamanager.h | 28 - libpurple/network.c | 66 +- libpurple/network.h | 98 +- libpurple/notify.c | 17 + libpurple/notify.h | 29 +- libpurple/plugin.c | 61 - libpurple/plugin.h | 70 - libpurple/plugins/autoaccept.c | 16 +- libpurple/plugins/log_reader.c | 32 +- libpurple/plugins/perl/common/Account.xs | 12 +- libpurple/plugins/perl/common/BuddyList.xs | 13 - libpurple/plugins/perl/common/Certificate.xs | 2 +- libpurple/plugins/perl/common/Connection.xs | 4 - libpurple/plugins/perl/common/Conversation.xs | 20 +- libpurple/plugins/perl/common/FT.xs | 2 +- libpurple/plugins/perl/common/Network.xs | 8 +- libpurple/plugins/perl/common/Request.xs | 6 - libpurple/plugins/perl/common/SSLConn.xs | 7 - libpurple/plugins/perl/common/Status.xs | 41 - libpurple/plugins/perl/common/Util.xs | 13 +- libpurple/plugins/ssl/Makefile.am | 24 +- libpurple/plugins/ssl/ssl-gnutls.c | 33 +- libpurple/plugins/ssl/ssl-nss.c | 25 +- libpurple/plugins/statenotify.c | 4 +- libpurple/pounce.c | 27 +- libpurple/pounce.h | 28 - libpurple/prefs.c | 1 + libpurple/prefs.h | 2 - libpurple/privacy.c | 22 +- libpurple/protocols/Makefile.am | 2 +- libpurple/protocols/bonjour/bonjour.c | 34 +- libpurple/protocols/bonjour/bonjour_ft.c | 397 ++--- libpurple/protocols/bonjour/jabber.c | 49 +- libpurple/protocols/bonjour/jabber.h | 2 + libpurple/protocols/bonjour/mdns_avahi.c | 7 +- libpurple/protocols/bonjour/mdns_common.c | 2 +- libpurple/protocols/bonjour/mdns_win32.c | 8 +- libpurple/protocols/gg/Makefile.am | 6 +- libpurple/protocols/gg/Makefile.mingw | 3 +- libpurple/protocols/gg/buddylist.c | 2 +- libpurple/protocols/gg/confer.c | 8 +- libpurple/protocols/gg/gg-utils.c | 13 + libpurple/protocols/gg/gg-utils.h | 15 + libpurple/protocols/gg/gg.c | 519 +++++-- libpurple/protocols/gg/gg.h | 2 + libpurple/protocols/gg/lib/common.c | 18 +- libpurple/protocols/gg/lib/compat.h | 15 + libpurple/protocols/gg/lib/dcc.c | 16 +- libpurple/protocols/gg/lib/dcc7.c | 14 +- libpurple/protocols/gg/lib/events.c | 7 - libpurple/protocols/gg/lib/handlers.c | 17 +- libpurple/protocols/gg/lib/http.c | 10 +- libpurple/protocols/gg/lib/libgadu-config.h | 59 +- libpurple/protocols/gg/lib/libgadu.c | 21 +- libpurple/protocols/gg/lib/libgadu.h | 32 +- libpurple/protocols/gg/lib/pubdir.c | 3 +- libpurple/protocols/gg/lib/pubdir50.c | 1 - libpurple/protocols/gg/lib/resolver.c | 357 +---- libpurple/protocols/gg/lib/resolver.h | 4 +- libpurple/protocols/gg/search.c | 2 +- libpurple/protocols/irc/cmds.c | 2 +- libpurple/protocols/irc/dcc_send.c | 59 +- libpurple/protocols/irc/irc.c | 74 +- libpurple/protocols/irc/irc.h | 1 + libpurple/protocols/irc/msgs.c | 8 +- libpurple/protocols/irc/parse.c | 29 +- libpurple/protocols/jabber/adhoccommands.c | 5 +- libpurple/protocols/jabber/buddy.c | 14 +- libpurple/protocols/jabber/caps.c | 19 +- libpurple/protocols/jabber/chat.c | 25 +- libpurple/protocols/jabber/disco.c | 12 +- libpurple/protocols/jabber/google/gmail.c | 2 +- .../protocols/jabber/google/google_presence.c | 4 +- libpurple/protocols/jabber/google/jingleinfo.c | 2 +- libpurple/protocols/jabber/google/relay.c | 2 +- libpurple/protocols/jabber/jabber.c | 133 +- libpurple/protocols/jabber/jabber.h | 1 + libpurple/protocols/jabber/jingle/content.c | 6 + libpurple/protocols/jabber/jingle/iceudp.c | 4 + libpurple/protocols/jabber/jingle/jingle.c | 2 +- libpurple/protocols/jabber/jingle/rawudp.c | 4 + libpurple/protocols/jabber/jingle/rtp.c | 90 +- libpurple/protocols/jabber/jingle/session.c | 42 +- libpurple/protocols/jabber/jingle/transport.c | 3 + libpurple/protocols/jabber/jutil.c | 9 +- libpurple/protocols/jabber/libxmpp.c | 8 +- libpurple/protocols/jabber/message.c | 10 +- libpurple/protocols/jabber/oob.c | 36 +- libpurple/protocols/jabber/presence.c | 11 +- libpurple/protocols/jabber/presence.h | 1 - libpurple/protocols/jabber/roster.c | 26 +- libpurple/protocols/jabber/roster.h | 2 +- libpurple/protocols/jabber/si.c | 221 ++- libpurple/protocols/jabber/useravatar.c | 2 +- libpurple/protocols/jabber/usermood.c | 4 +- libpurple/protocols/jabber/usertune.c | 6 +- libpurple/protocols/msn/contact.c | 4 +- libpurple/protocols/msn/error.c | 2 +- libpurple/protocols/msn/httpconn.c | 6 +- libpurple/protocols/msn/msg.c | 22 +- libpurple/protocols/msn/msn.c | 118 +- libpurple/protocols/msn/nexus.c | 2 +- libpurple/protocols/msn/notification.c | 12 +- libpurple/protocols/msn/object.c | 11 +- libpurple/protocols/msn/object.h | 5 +- libpurple/protocols/msn/oim.c | 4 +- libpurple/protocols/msn/sbconn.c | 2 + libpurple/protocols/msn/servconn.c | 6 +- libpurple/protocols/msn/session.c | 2 +- libpurple/protocols/msn/slp.c | 14 +- libpurple/protocols/msn/slpcall.c | 17 +- libpurple/protocols/msn/slplink.c | 2 +- libpurple/protocols/msn/slpmsg.c | 2 +- libpurple/protocols/msn/slpmsg.h | 2 +- libpurple/protocols/msn/switchboard.c | 4 +- libpurple/protocols/msn/user.c | 10 +- libpurple/protocols/msn/userlist.c | 4 +- libpurple/protocols/msn/xfer.c | 49 +- libpurple/protocols/msn/xfer.h | 6 +- libpurple/protocols/mxit/actions.c | 18 +- libpurple/protocols/mxit/cipher.c | 9 +- libpurple/protocols/mxit/filexfer.c | 39 +- libpurple/protocols/mxit/formcmds.c | 13 +- libpurple/protocols/mxit/login.c | 76 +- libpurple/protocols/mxit/markup.c | 3 +- libpurple/protocols/mxit/multimx.c | 10 +- libpurple/protocols/mxit/mxit.c | 45 +- libpurple/protocols/mxit/mxit.h | 1 + libpurple/protocols/mxit/profile.c | 45 +- libpurple/protocols/mxit/protocol.c | 18 +- libpurple/protocols/mxit/protocol.h | 4 +- libpurple/protocols/mxit/roster.c | 24 +- libpurple/protocols/mxit/splashscreen.c | 2 +- libpurple/protocols/mxit/voicevideo.c | 2 +- libpurple/protocols/myspace/myspace.c | 82 +- libpurple/protocols/myspace/session.h | 1 + libpurple/protocols/myspace/user.c | 8 +- libpurple/protocols/myspace/zap.c | 6 +- libpurple/protocols/novell/novell.c | 154 +- libpurple/protocols/null/nullprpl.c | 172 +-- libpurple/protocols/oscar/clientlogin.c | 4 +- libpurple/protocols/oscar/family_feedbag.c | 173 ++- libpurple/protocols/oscar/family_icbm.c | 6 +- libpurple/protocols/oscar/flap_connection.c | 4 +- libpurple/protocols/oscar/libaim.c | 9 +- libpurple/protocols/oscar/libicq.c | 10 +- libpurple/protocols/oscar/oft.c | 40 +- libpurple/protocols/oscar/oscar.c | 49 +- libpurple/protocols/oscar/peer.c | 10 +- libpurple/protocols/oscar/userinfo.c | 4 - libpurple/protocols/sametime/sametime.c | 351 ++--- libpurple/protocols/silc/buddy.c | 36 +- libpurple/protocols/silc/chat.c | 43 +- libpurple/protocols/silc/ft.c | 31 +- libpurple/protocols/silc/ops.c | 35 +- libpurple/protocols/silc/pk.c | 2 +- libpurple/protocols/silc/silc.c | 127 +- libpurple/protocols/silc/silcpurple.h | 2 +- libpurple/protocols/silc/util.c | 10 +- libpurple/protocols/silc/wb.c | 73 +- libpurple/protocols/simple/simple.c | 67 +- libpurple/protocols/yahoo/libyahoo.c | 9 +- libpurple/protocols/yahoo/libyahoojp.c | 7 +- libpurple/protocols/yahoo/libymsg.c | 211 +-- libpurple/protocols/yahoo/libymsg.h | 3 +- libpurple/protocols/yahoo/util.c | 9 +- libpurple/protocols/yahoo/yahoo_aliases.c | 22 +- libpurple/protocols/yahoo/yahoo_doodle.c | 59 +- libpurple/protocols/yahoo/yahoo_filexfer.c | 289 ++-- libpurple/protocols/yahoo/yahoo_friend.c | 12 +- libpurple/protocols/yahoo/yahoo_picture.c | 37 +- libpurple/protocols/yahoo/yahoo_profile.c | 10 +- libpurple/protocols/yahoo/yahoochat.c | 77 +- libpurple/protocols/yahoo/ycht.c | 12 +- libpurple/protocols/zephyr/ZRetSubs.c | 5 + libpurple/protocols/zephyr/zephyr.c | 124 +- libpurple/proxy.c | 30 +- libpurple/proxy.h | 41 +- libpurple/prpl.c | 19 +- libpurple/prpl.h | 121 +- libpurple/purple-3.pc.in | 2 +- libpurple/purple.h.in | 1 - libpurple/request.c | 131 +- libpurple/request.h | 182 +-- libpurple/roomlist.c | 84 +- libpurple/roomlist.h | 109 +- libpurple/savedstatuses.c | 2 +- libpurple/server.c | 42 +- libpurple/server.h | 26 - libpurple/smiley.h | 1 - libpurple/sound-theme.c | 6 +- libpurple/sound-theme.h | 1 - libpurple/sslconn.c | 9 - libpurple/sslconn.h | 25 - libpurple/status.c | 275 ++-- libpurple/status.h | 121 -- libpurple/stun.c | 6 +- libpurple/tests/test_xmlnode.c | 98 ++ libpurple/theme-loader.c | 15 +- libpurple/theme-loader.h | 1 - libpurple/theme.c | 14 +- libpurple/theme.h | 1 - libpurple/upnp.c | 4 +- libpurple/util.c | 89 +- libpurple/util.h | 173 ++- libpurple/value.c | 38 + libpurple/value.h | 35 +- libpurple/version.h.in | 6 - libpurple/whiteboard.c | 86 ++ libpurple/whiteboard.h | 107 +- libpurple/win32/libc_interface.c | 62 +- libpurple/win32/libc_interface.h | 5 +- libpurple/win32/libc_internal.h | 4 +- libpurple/xmlnode.c | 130 +- libpurple/xmlnode.h | 82 +- pidgin/Makefile.am | 20 +- pidgin/Makefile.mingw | 6 +- pidgin/gtkaccount.c | 31 +- pidgin/gtkblist-theme-loader.c | 3 +- pidgin/gtkblist-theme.c | 79 +- pidgin/gtkblist-theme.h | 1 - pidgin/gtkblist.c | 600 ++++---- pidgin/gtkblist.h | 19 - pidgin/gtkcellrendererexpander.c | 95 +- pidgin/gtkcertmgr.c | 55 +- pidgin/gtkconv.c | 1607 ++++++++++++-------- pidgin/gtkconv.h | 46 +- pidgin/gtkconvwin.h | 1 + pidgin/gtkdebug.c | 26 +- pidgin/gtkdialogs.c | 71 +- pidgin/gtkdialogs.h | 2 +- pidgin/gtkdnd-hints.c | 53 +- pidgin/gtkdocklet-gtk.c | 290 ---- pidgin/gtkdocklet.c | 403 +++-- pidgin/gtkdocklet.h | 24 +- pidgin/gtkft.c | 56 +- pidgin/gtkicon-theme.c | 7 +- pidgin/gtkicon-theme.h | 1 - pidgin/gtkidle.c | 4 +- pidgin/gtkimhtml.c | 633 ++++---- pidgin/gtkimhtml.h | 130 +- pidgin/gtkimhtmltoolbar.c | 118 +- pidgin/gtkimhtmltoolbar.h | 4 +- pidgin/gtklog.c | 52 +- pidgin/gtklog.h | 2 +- pidgin/gtkmedia.c | 28 +- pidgin/gtkmenutray.c | 18 +- pidgin/gtkmenutray.h | 4 +- pidgin/gtknotify.c | 99 +- pidgin/gtkplugin.c | 20 +- pidgin/gtkpounce.c | 39 +- pidgin/gtkprefs.c | 194 ++- pidgin/gtkprefs.h | 2 - pidgin/gtkprivacy.c | 18 +- pidgin/gtkrequest.c | 75 +- pidgin/gtkroomlist.c | 123 +- pidgin/gtksavedstatuses.c | 4 + pidgin/gtkscrollbook.c | 4 +- pidgin/gtksession.c | 2 +- pidgin/gtksmiley.c | 25 +- pidgin/gtksmiley.h | 3 - pidgin/gtksound.c | 6 +- pidgin/gtksound.h | 2 - pidgin/gtksourceundomanager.c | 3 +- pidgin/gtkstatusbox.c | 138 +- pidgin/gtkthemes.c | 7 +- pidgin/gtkthemes.h | 7 +- pidgin/gtkutils.c | 192 ++- pidgin/gtkutils.h | 86 +- pidgin/gtkwhiteboard.c | 130 +- pidgin/gtkwhiteboard.h | 2 +- pidgin/minidialog.c | 2 +- pidgin/pidgin-3.pc.in | 2 +- pidgin/pidginstock.c | 2 +- pidgin/pidgintooltip.c | 15 +- pidgin/pidgintooltip.h | 8 - pidgin/plugins/Makefile.am | 21 +- pidgin/plugins/contact_priority.c | 2 +- pidgin/plugins/convcolors.c | 4 +- pidgin/plugins/disco/gtkdisco.c | 9 +- pidgin/plugins/gestures/gestures.c | 58 +- pidgin/plugins/gestures/stroke-draw.c | 2 +- pidgin/plugins/gevolution/gevo-util.c | 2 +- pidgin/plugins/history.c | 38 +- pidgin/plugins/markerline.c | 23 +- pidgin/plugins/musicmessaging/musicmessaging.c | 11 +- pidgin/plugins/notify.c | 18 +- pidgin/plugins/perl/common/GtkIMHtml.xs | 33 - pidgin/plugins/relnot.c | 2 +- pidgin/plugins/themeedit.c | 3 + pidgin/plugins/ticker/gtkticker.c | 8 +- pidgin/plugins/timestamp.c | 2 +- pidgin/plugins/timestamp_format.c | 3 +- pidgin/plugins/vvconfig.c | 8 +- pidgin/plugins/xmppconsole.c | 101 +- po/ChangeLog | 3 + po/de.po | 353 +++-- 366 files changed, 8756 insertions(+), 8558 deletions(-) delete mode 100644 pidgin/gtkdocklet-gtk.c diff --git a/COPYRIGHT b/COPYRIGHT index 3b5692d66f..df76c15727 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -107,6 +107,7 @@ Patrick Cheung Ka-Hing Cheung Sadrul Habib Chowdhury Brian Chu +Howard Chu Arturo Cisneros, Jr. Vincas Ciziunas Jonathan Clark @@ -428,6 +429,7 @@ Etan Reisner David Reiss Luoh Ren-Shan Noa Resare +Tim Retout Daniele Ricci Kristian Rietveld Pekka Riikonen diff --git a/ChangeLog b/ChangeLog index dd50b22f7e..481278887f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,32 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 3.0.0 (??/??/????): + libpurple: + * Support new connection states and signals for NetworkManager 0.9+. + (Dan Williams) (#13859) + AIM and ICQ: * Make buddy list management code more efficient. (Oliver) (#4816) * Don't try to format ICQ usernames entered as email addresses. Gets rid of an "Unable to format username" error at login. (#13883) + Bonjour: + * Support file transfers up to ~9 EiB. + + Gadu-Gadu: + * Possibility to require encryption. Also, using encryption when + available is default option now. (Tomasz Wasilczyk) + * Show local time for incoming messages. (Tomasz Wasilczyk) (#4579) + * Fixed password change dialog and problems with connecting to accounts + with non-ASCII passwords. (Tomasz Wasilczyk) (#14652) + * Option to show links from strangers. (Tomasz Wasilczyk) (#10591) + * Better handling of "invisible" and "chatty" statuses. (Tomasz + Wasilczyk) (#13836) + + MSN: + * Fix file transfer with older Mac MSN clients. + * Support file transfers up to ~9 EiB. + MXit: * Remove all reference to Hidden Number. * Fix decoding of font-size changes in the markup of received messages. @@ -14,6 +35,55 @@ version 3.0.0 (??/??/????): * The buddy's name was not centered vertically in the buddy-list if they did not have a status-message or mood set. + XMPP: + * Strip element prefixes from XHTML-IM messages as they're presented + to the core (and UIs) as incoming messages (Thijs Alkemade). + (#14529) + * Support file transfers up to ~9 EiB. + + Plugins: + * The Voice/Video Settings plugin supports using the sndio GStreamer + backends. (Brad Smith) (#14414) + +version 2.10.1 (12/06/2011): + Finch: + * Fix compilation on OpenBSD. + + AIM and ICQ: + * Fix remotely-triggerable crashes by validating strings in a few + messages related to buddy list management. Thanks to Evgeny Boger + for reporting this! (#14682) + + Bonjour: + * IPv6 fixes (Linus Lüssing) + + Gadu-Gadu: + * Fix problems linking against GnuTLS. (#14544) + + IRC: + * Fix a memory leak when admitting UTF-8 text with a non-UTF-8 primary + encoding. (#14700) + + Jabber: + * Fix crashes and memory leaks when receiving malformed voice + and video requests. Thanks to Thijs Alkemade for reporting this! + + Sametime: + * Separate "username" and "server" when adding new Sametime accounts. + (#14608) + * Fix compilation in Visual C++. (#14608) + + SILC: + * Fix CVE-2011-3594, by UTF-8 validating incoming messages before + passing them to glib or libpurple. Identified by Diego Bauche + Madero from IOActive. (#14636) + + Yahoo!: + * Fetch buddy icons in some cases where we previously weren't. (#13050) + + Windows-Specific Changes: + * Fix compilation + version 2.10.0 (08/18/2011): Pidgin: * Make the max size of incoming smileys a pref instead of hardcoding it. diff --git a/ChangeLog.API b/ChangeLog.API index c23fa90386..c26857477d 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -3,25 +3,117 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 3.0.0 (??/??/????): libpurple: Added: - * purple_notify_searchresult_column_set_visible + * pidgin_create_webview + * purple_account_is_disconnecting + * purple_account_get_ui_data + * purple_account_set_ui_data + * purple_account_register_completed + * purple_conv_chat_cb_get_alias + * purple_conv_chat_cb_get_flags + * purple_conv_chat_cb_is_buddy + * purple_conv_chat_cb_get_ui_data + * purple_conv_chat_cb_set_ui_data + * purple_connection_get_flags + * purple_connection_set_flags + * purple_connection_update_last_received + * purple_conversation_get_ui_data + * purple_conversation_set_ui_data + * purple_conversation_message_get_alias + * purple_conversation_message_get_conv + * purple_contact_get_contact_size + * purple_notify_searchresult_column_get_title * purple_notify_searchresult_column_is_visible + * purple_notify_searchresult_column_set_visible * purple_notify_user_info_prepend_pair_plaintext - * purple_request_field_set_tooltip + * purple_menu_action_get_callback + * purple_menu_action_get_children + * purple_menu_action_get_data + * purple_menu_action_set_label + * purple_menu_action_set_data + * purple_menu_action_set_callback + * purple_menu_action_set_children * purple_request_field_get_tooltip + * purple_request_field_group_get_fields_list + * purple_request_field_set_tooltip + * purple_request_fields_get_ui_data + * purple_request_fields_set_ui_data + * purple_roomlist_get_account + * purple_roomlist_get_proto_data + * purple_roomlist_get_ui_data + * purple_roomlist_room_get_expanded_once + * purple_roomlist_room_set_expanded_once + * purple_roomlist_set_proto_data + * purple_roomlist_set_ui_data + * purple_whiteboard_get_account + * purple_whiteboard_get_draw_list + * purple_whiteboard_set_draw_list + * purple_whiteboard_get_protocol_data + * purple_whiteboard_set_protocol_data + * purple_whiteboard_get_state + * purple_whiteboard_set_state + * purple_whiteboard_get_ui_data + * purple_whiteboard_set_ui_data + * purple_whiteboard_get_who + * purple_xfer_get_fd + * purple_xfer_get_protocol_data + * purple_xfer_get_ui_data + * purple_xfer_get_watcher + * purple_xfer_set_fd + * purple_xfer_set_local_port + * purple_xfer_set_protocol_data + * purple_xfer_set_status + * purple_xfer_set_ui_data + * purple_xfer_set_watcher + * Various WebKit-related functions in gtkwebview.h + * xmlnode_get_default_namespace + * xmlnode_strip_prefixes Changed: + * purple_account_add_buddy now takes an invite message as the last + parameter + * purple_account_add_buddies now takes an invite message as the last + parameter + * purple_certificate_check_signature_chain now returns a list of failing + PurpleCertificate*s as the second parameter * purple_connection_error now takes a PurpleConnectionError as the second parameter + * purple_conversation_get_gc renamed to + purple_conversation_get_connection + * purple_dnsquery_a now takes a PurpleAccount as the first parameter + * purple_network_listen now takes the protocol family as the second + parameter + * purple_network_listen now takes a boolean indicating external port + mapping as the fourth parameter + * purple_network_listen_range now takes a boolean indicating external + port mapping as the fifth parameter + * purple_network_listen_range now takes the protocol family as the + third parameter * purple_notify_user_info_add_pair renamed to purple_notify_user_info_add_pair_html * purple_notify_user_info_get_entries returns a GQueue instead of a GList * purple_notify_user_info_prepend_pair renamed to purple_notify_user_info_prepend_pair_html - * purple_util_fetch_url_request_len now takes a PurpleAccount as + * purple_srv_resolve now takes a PurpleAccount as the first parameter + * purple_str_size_to_units now takes a goffset as the size parameter + * purple_txt_resolve now takes a PurpleAccount as the first parameter + * purple_util_fetch_url_request now takes a PurpleAccount as the first parameter + * purple_util_fetch_url_request now takes a length as the eighth + parameter + * purple_util_fetch_url_len now takes a length as the fifth parameter + * purple_xfer_get_bytes_remaining now returns a goffset + * purple_xfer_get_bytes_sent now returns a goffset + * purple_xfer_get_size now returns a goffset + * purple_xfer_is_canceled renamed to purple_xfer_is_cancelled + * purple_xfer_set_bytes_sent now takes a goffset as the bytes_sent + parameter + * purple_xfer_set_size now takes a goffset as the size parameter * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter + * PurpleXfer.bytes_remaining is now a goffset + * PurpleXfer.bytes_sent is now a goffset + * PurpleXfer.size is now a goffset Removed: * _GntFileType @@ -43,27 +135,113 @@ version 3.0.0 (??/??/????): * _XMLNodeType * GtkIMHtml.clipboard_html_string * GtkIMHtml.clipboard_text_string + * GtkIMHtmlFontDetail + * gtk_imhtml_animation_free + * gtk_imhtml_animation_new + * gtk_imhtml_image_add_to + * gtk_imhtml_image_free + * gtk_imhtml_image_new + * gtk_imhtml_image_scale * pidgin_blist_update_account_error_state * pidgin_check_if_dir * PIDGIN_DIALOG * pidgin_dialogs_alias_contact * pidgin_set_custom_buddy_icon * pidgin_setup_screenname_autocomplete + * PidginBuddyList.connection_errors * PidginConversation.sg + * purple_account_add_buddies_with_invite + * purple_account_add_buddy_with_invite + * purple_blist_update_buddy_icon + * purple_buddy_get_local_alias + * purple_buddy_icons_has_custom_icon + * purple_buddy_icons_find_custom_icon + * purple_buddy_icons_set_custom_icon + * purple_certificate_check_signature_chain_with_failing. Use + purple_certificate_check_signature_chain, instead * purple_connection_error_reason + * purple_connection_new + * purple_connection_new_unregister + * purple_connection_destroy + * purple_contact_set_alias + * purple_conv_chat_set_users * purple_core_migrate + * purple_dnsquery_a_account + * purple_network_listen_family. Use purple_network_listen, instead. + * purple_network_listen_map_external + * purple_network_listen_range_family. Use purple_network_listen, + instead. * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count * purple_notify_searchresults_row_get + * purple_plugins_register_load_notify_cb + * purple_plugins_register_probe_notify_cb + * purple_plugins_register_unload_notify_cb + * purple_plugins_unregister_load_notify_cb + * purple_plugins_unregister_probe_notify_cb + * purple_plugins_unregister_unload_notify_cb + * purple_presence_add_status + * purple_presence_add_list + * purple_proxy_connect_socks5 + * purple_request_field_list_add + * purple_srv_cancel + * purple_srv_resolve_account + * purple_ssl_connect_fd + * purple_status_set_attr_boolean + * purple_status_set_attr_int + * purple_status_set_attr_string + * purple_status_type_add_attr + * purple_status_type_add_attrs + * purple_status_type_add_attrs_vargs * purple_status_type_get_primary_attr * purple_status_type_set_primary_attr * purple_strlcat * purple_strlcpy + * purple_txt_cancel + * purple_txt_resolve_account + * purple_util_fetch_url_len. Use purple_util_fetch_url, instead. + * purple_util_fetch_url_request_len. Use purple_util_fetch_url_request, + instead. * purple_util_fetch_url_request_len_with_account. Use - purple_util_fetch_url_request_len, insetad. + purple_util_fetch_url_request, instead. * PurpleConnectionUiOps.report_disconnect_reason + * PurplePluginProtocolInfo.add_buddy_with_invite + * PurplePluginProtocolInfo.add_buddies_with_invite + * PurplePluginProtocolInfo.get_cb_away + * serv_got_attention + * serv_send_attention + * struct _GtkIMHtmlAnimation * struct _GtkIMHtmlFontDetail + * struct _GtkIMHtmlHr + * struct _GtkIMHtmlImage + * struct _GtkIMHtmlScalable + * struct _GtkSmileyTree + * struct _PidginChatPane + * struct _PidginImPane + * struct _PurpleAttentionType + * struct _PurpleConversation + * struct _PurpleConvChat + * struct _PurpleConvChatBuddy + * struct _PurpleConvIm + * struct _PurpleConvMessage + * struct _PurpleMenuAction + * struct _PurplePounce + * struct _PurpleProxyInfo + * struct _PurpleRequestField + * struct _PurpleRoomlist + * struct _PurpleRoomlistField + * struct _PurpleRoomlistRoom + * struct _PurpleWhiteboard + * struct PurpleAccountOption + * struct PurpleAccountUserSplit + * struct PurpleNotifySearchColumn + * wpurple_g_access + * xmlnode_set_attrib_with_namespace + * xmlnode_set_attrib_with_prefix + +version 2.10.1: + * No changes version 2.10.0: libpurple: diff --git a/configure.ac b/configure.ac index aadcc86382..a2bb4f0fc1 100644 --- a/configure.ac +++ b/configure.ac @@ -202,6 +202,12 @@ AC_SYS_LARGEFILE dnl FreeBSD doesn't have libdl, dlopen is provided by libc AC_CHECK_FUNC(dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")]) +dnl Windows and Haiku do not use libm for the math functions, they are part +dnl of the C library +AC_SEARCH_LIBS([ceil], [m], [], [ + AC_MSG_ERROR([unable to find the ceil() function]) +]) + AC_MSG_CHECKING(for fileno()) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include @@ -401,6 +407,10 @@ AC_ARG_ENABLE(gestures, [AC_HELP_STRING([--disable-gestures], [compile without the gestures plugin])], enable_gestures="$enableval", enable_gestures="yes") +AC_ARG_ENABLE(gcr, + [AC_HELP_STRING([--enable-gcr], + [compile with GCR certificate widgets])], + enable_gcr="$enableval", enable_gcr="no") AC_PATH_XTRA # We can't assume that $x_libraries will be set, because autoconf does not @@ -418,11 +428,11 @@ else fi if test "x$enable_gtkui" = "xyes" ; then - PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0], , [ + PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.10.0], , [ AC_MSG_RESULT(no) AC_MSG_ERROR([ -You must have GTK+ 2.91.5 or newer development headers installed to compile +You must have GTK+ 2.10.0 or newer development headers installed to compile Pidgin. If you want to build only Finch then specify --disable-gtkui when running configure. ])]) @@ -434,6 +444,16 @@ running configure. PKG_CHECK_MODULES(PANGO, [pango >= 1.4.0], AC_DEFINE(HAVE_PANGO14, 1, [Define if we have Pango 1.4 or newer.]),:) + PKG_CHECK_MODULES(WEBKIT, [webkit-1.0 >= 1.1.1], , [ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ +You must have WebKit 1.1.1 or newer development headers installed to compile +Pidgin. If you want to build only Finch then specify --disable-gtkui when +running configure. +])]) + AC_SUBST(WEBKIT_CFLAGS) + AC_SUBST(WEBKIT_LIBS) + dnl ####################################################################### dnl # Check if we should compile with X support dnl ####################################################################### @@ -545,8 +565,6 @@ Use --disable-sm if you do not need session management support. dnl ####################################################################### dnl # Check for GtkSpell dnl ####################################################################### - dnl GtkSpell is not GTK+3 compatible yet - enable_gtkspell="no" if test "x$enable_gtkspell" = "xyes" ; then PKG_CHECK_MODULES(GTKSPELL, gtkspell-2.0 >= 2.0.2, , [ AC_MSG_RESULT(no) @@ -606,9 +624,26 @@ Use --disable-cap if you do not need the Contact Availability Prediction plugin. ]) fi]) fi - + + dnl ####################################################################### + dnl # Check for GCR for its certificate widgets + dnl ####################################################################### + if test "x$enable_gcr" = "xyes"; then + PKG_CHECK_MODULES(GCR, gcr-0, [ + AC_DEFINE(ENABLE_GCR, 1, [Define to 1 if GCR is found.])], [ + AC_MSG_RESULT(no) + enable_gcr="no" + if test "x$force_deps" = "xyes" ; then + AC_MSG_ERROR([ +GCR development headers not found. +Use --disable-gcr if you do not need GCR certificate widgets. +]) + fi]) + fi + else # GTK + enable_gcr=no enable_cap=no enable_gevolution=no enable_gtkspell=no @@ -621,6 +656,7 @@ AM_CONDITIONAL(ENABLE_GTK, test "x$enable_gtkui" = "xyes") AM_CONDITIONAL(BUILD_GEVOLUTION, test "x$enable_gevolution" = "xyes") AM_CONDITIONAL(ENABLE_CAP, test "x$enable_cap" = "xyes") AM_CONDITIONAL(ENABLE_GESTURES, test "x$enable_gestures" = "xyes") +AM_CONDITIONAL(ENABLE_GCR, test "x$enable_gcr" = "xyes") dnl ####################################################################### @@ -1072,7 +1108,7 @@ if test "x$STATIC_PRPLS" != "x" -a "x$DYNAMIC_PRPLS" = "xall"; then fi if test "x$STATIC_PRPLS" = "xall" ; then - STATIC_PRPLS="bonjour gg irc jabber msn myspace mxit novell oscar sametime silc simple yahoo zephyr" + STATIC_PRPLS="bonjour gg irc jabber msn mxit myspace novell oscar sametime silc simple yahoo zephyr" fi if test "x$have_meanwhile" != "xyes" ; then STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/sametime//'` @@ -1117,8 +1153,8 @@ for i in $STATIC_PRPLS ; do irc) static_irc=yes ;; jabber) static_jabber=yes ;; msn) static_msn=yes ;; - myspace) static_myspace=yes ;; mxit) static_mxit=yes ;; + myspace) static_myspace=yes ;; novell) static_novell=yes ;; oscar) static_oscar=yes ;; aim) static_oscar=yes ;; @@ -1136,8 +1172,8 @@ AM_CONDITIONAL(STATIC_GG, test "x$static_gg" = "xyes") AM_CONDITIONAL(STATIC_IRC, test "x$static_irc" = "xyes") AM_CONDITIONAL(STATIC_JABBER, test "x$static_jabber" = "xyes") AM_CONDITIONAL(STATIC_MSN, test "x$static_msn" = "xyes") -AM_CONDITIONAL(STATIC_MYSPACE, test "x$static_myspace" = "xyes") AM_CONDITIONAL(STATIC_MXIT, test "x$static_mxit" = "xyes") +AM_CONDITIONAL(STATIC_MYSPACE, test "x$static_myspace" = "xyes") AM_CONDITIONAL(STATIC_NOVELL, test "x$static_novell" = "xyes") AM_CONDITIONAL(STATIC_OSCAR, test "x$static_oscar" = "xyes") AM_CONDITIONAL(STATIC_SAMETIME, test "x$static_sametime" = "xyes" -a "x$have_meanwhile" = "xyes") @@ -1151,7 +1187,7 @@ AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init static void static_proto_init AC_ARG_WITH(dynamic_prpls, [AC_HELP_STRING([--with-dynamic-prpls], [specify which protocols to build dynamically])], [DYNAMIC_PRPLS=`echo $withval | $sedpath 's/,/ /g'`]) if test "x$DYNAMIC_PRPLS" = "xall" ; then - DYNAMIC_PRPLS="bonjour gg irc jabber msn myspace mxit novell oscar sametime silc simple yahoo zephyr" + DYNAMIC_PRPLS="bonjour gg irc jabber msn mxit myspace novell oscar sametime silc simple yahoo zephyr" fi if test "x$have_meanwhile" != "xyes"; then DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/sametime//'` @@ -1170,8 +1206,8 @@ for i in $DYNAMIC_PRPLS ; do irc) dynamic_irc=yes ;; jabber) dynamic_jabber=yes ;; msn) dynamic_msn=yes ;; - myspace) dynamic_myspace=yes ;; mxit) dynamic_mxit=yes ;; + myspace) dynamic_myspace=yes ;; novell) dynamic_novell=yes ;; null) dynamic_null=yes ;; oscar) dynamic_oscar=yes ;; @@ -2496,6 +2532,7 @@ AC_CONFIG_FILES([Makefile pidgin/plugins/perl/Makefile pidgin/plugins/perl/common/Makefile.PL pidgin/plugins/ticker/Makefile + pidgin/themes/Makefile libpurple/ciphers/Makefile libpurple/example/Makefile libpurple/gconf/Makefile @@ -2579,6 +2616,7 @@ echo Use XScreenSaver Extension.... : $enable_screensaver echo Use X Session Management...... : $enable_sm echo Use startup notification...... : $enable_startup_notification echo Build with GtkSpell support... : $enable_gtkspell +echo Build with GCR widgets........ : $enable_gcr echo echo Build with plugin support..... : $enable_plugins echo Build with Mono support....... : $enable_mono diff --git a/doc/account-signals.dox b/doc/account-signals.dox index 9ef431cced..c4964bcc7b 100644 --- a/doc/account-signals.dox +++ b/doc/account-signals.dox @@ -34,7 +34,6 @@ void (*account_created)(PurpleAccount *account); @signaldesc Emitted when an account is created by calling purple_account_new. @param account The account. - @since 2.6.0 @endsignaldef @signaldef account-destroying @@ -44,7 +43,6 @@ void (*account_destroying)(PurpleAccount *account); @signaldesc Emitted when an account is about to be destroyed. @param account The account. - @since 2.6.0 @endsignaldef @signaldef account-added @@ -156,7 +154,6 @@ int (*account_authorization_requested)(PurpleAccount *account, const char *user) @return Less than zero to deny the request without prompting, greater than zero if the request should be granted. If zero is returned, then the user will be prompted with the request. - @since 2.3.0 @endsignaldef @signaldef account-authorization-requested-with-message @@ -173,7 +170,6 @@ int (*account_authorization_requested)(PurpleAccount *account, const char *user, get informed, PURPLE_ACCOUNT_RESPONSE_ACCEPT if the request should be granted. If PURPLE_ACCOUNT_RESPONSE_PASS is returned, then the user will be prompted with the request. - @since 2.8.0 @endsignaldef @signaldef account-authorization-denied @@ -184,7 +180,6 @@ void (*account_authorization_denied)(PurpleAccount *account, const char *user); Emitted when the authorization request for a buddy is denied. @param account The account. @param user The name of the user requesting authorization. - @since 2.3.0 @endsignaldef @signaldef account-authorization-granted @@ -195,7 +190,6 @@ void (*account_authorization_granted)(PurpleAccount *account, const char *user); Emitted when the authorization request for a buddy is granted. @param account The account. @param user The name of the user requesting authorization. - @since 2.3.0 @endsignaldef @signaldef account-error-changed @@ -214,7 +208,6 @@ void (*account_error_changed)(PurpleAccount *account, const PurpleConnectionErro pointer just after the next time this signal is emitted for this @a account. @see purple_account_get_current_error() - @since 2.3.0 @endsignaldef @signaldef account-signed-on @@ -224,7 +217,6 @@ void (*signed_on)(PurpleAccount *account); @signaldesc Emitted when an account has signed on. @param account The account that has signed on. - @since 2.7.0 @endsignaldef @signaldef account-signed-off @@ -234,7 +226,6 @@ void (*signed_off)(PurpleAccount *account); @signaldesc Emitted when an account has signed off. @param account The account that has signed off. - @since 2.7.0 @endsignaldef @signaldef account-connection-error @@ -246,7 +237,6 @@ void (*connection_error)(PurpleAccount *gc, PurpleConnectionError err, const gch @param account The account on which the error has occurred @param err The error that occurred @param desc A description of the error, giving more information. - @since 2.7.0 @endsignaldef */ // vim: syntax=c.doxygen tw=75 et diff --git a/doc/blist-signals.dox b/doc/blist-signals.dox index 3617a389db..5c3c68035c 100644 --- a/doc/blist-signals.dox +++ b/doc/blist-signals.dox @@ -136,7 +136,6 @@ void (*buddy_caps_changed)(PurpleBuddy *buddy, PurpleMediaCaps newcaps, @param buddy The buddy @param newcaps @param oldcaps - @since 2.7.0 @endsignaldef @signaldef ui-caps-changed @@ -147,7 +146,6 @@ void (*ui_caps_changed)(PurpleMediaCaps newcaps, PurpleMediaCaps oldcaps) Emitted when updating the media capabilities of the UI. @param newcaps @param oldcaps - @since 2.7.0 @endsignaldef */ diff --git a/doc/connection-signals.dox b/doc/connection-signals.dox index ee0d62fba6..84849876e8 100644 --- a/doc/connection-signals.dox +++ b/doc/connection-signals.dox @@ -44,7 +44,6 @@ gboolean (*autojoin)(PurpleConnection *gc); @return @c TRUE if the signal was handled or @c FALSE otherwise. In practice, the return value is irrelevant, as it really only exists so plugins can block the UI's autojoin. - @since 2.7.0 @endsignaldef @signaldef signing-off diff --git a/doc/conversation-signals.dox b/doc/conversation-signals.dox index 30415a9d1c..b9746990ac 100644 --- a/doc/conversation-signals.dox +++ b/doc/conversation-signals.dox @@ -149,7 +149,6 @@ void (*blocked_im_msg)(PurpleAccount *account, const char *sender, @param message The message that was blocked. @param flags The IM message flags. @param when The time the message was sent. - @since 2.5.0 @endsignaldef @signaldef writing-chat-msg @@ -436,7 +435,6 @@ void (*chat_invite_blocked)(PurpleAccount *account, const char *inviter, @param name The name of the chat invited to. @param message The invitation message sent. @param data Hashtable containing data about the invited chat. - @since 2.5.0 @endsignaldef @signaldef chat-joined @@ -477,7 +475,6 @@ void (*conversation_extended_menu)(PurpleConversation *conv, GList **list); conversation. @param conv The conversation. @param list A pointer to the list of actions. - @since 2.1.0 @endsignaldef @signaldef cleared-message-history @@ -487,7 +484,6 @@ void (*cleared_message_history)(PurpleConversation *conv); @signaldesc Emitted when the conversation history is cleared. @param conv The conversation. - @since 2.8.0 @endsignaldef @signaldef sent-attention @@ -501,7 +497,6 @@ void (*got_attention)(PurpleAccount *account, const char *who, @param who The name of the person receiving the attention @param conv The conversation @param type The attention type (an index starting at 0) - @since 2.7.0 @endsignaldef @signaldef got-attention @@ -515,7 +510,6 @@ void (*got_attention)(PurpleAccount *account, const char *who, @param who The name of the person sending the attention @param conv The conversation @param type The attention type (an index starting at 0) - @since 2.7.0 @endsignaldef */ // vim: syntax=c.doxygen tw=75 et diff --git a/doc/gtkconv-signals.dox b/doc/gtkconv-signals.dox index b1df1bbd8a..b9427516ef 100644 --- a/doc/gtkconv-signals.dox +++ b/doc/gtkconv-signals.dox @@ -129,7 +129,6 @@ void (*conversation_hiding)(PidginConversation *gtkconv); @signaldesc Emitted immediately before an existing conversation is hidden. @param gtkconv The PidginConversation - @since 2.2.0 @endsignaldef @signaldef conversation-displayed @@ -139,7 +138,6 @@ void (*conversation_displayed)(PidginConversation *gtkconv); @signaldesc Emitted right after the Pidgin UI is attached to a new or a hidden conversation. @param gtkconv The PidginConversation - @since 2.2.0 @endsignaldef */ diff --git a/doc/notify-signals.dox b/doc/notify-signals.dox index 820298c604..2606936083 100644 --- a/doc/notify-signals.dox +++ b/doc/notify-signals.dox @@ -35,7 +35,6 @@ void (*displaying_email_notification)(const char *subject, @param from Who the email is from. @param to Who the email is to. @param url A url to view the email. - @since 2.1.0 @endsignaldef @signaldef displaying-emails-notification @@ -53,7 +52,6 @@ void (*displaying_emails_notification)(const char **subjects, @param tos Who the emails are to. @param urls The urls to view the emails. @param count Number of emails being notified of. - @since 2.1.0 @endsignaldef */ diff --git a/finch/gntaccount.h b/finch/gntaccount.h index 2cf7d8f9e7..e1fd0378d6 100644 --- a/finch/gntaccount.h +++ b/finch/gntaccount.h @@ -59,8 +59,6 @@ void finch_accounts_show_all(void); * Show the edit dialog for an account. * * @param account The account to edit, or @c NULL to create a new account. - * - * @since 2.2.0 */ void finch_account_dialog_show(PurpleAccount *account); diff --git a/finch/gntblist.c b/finch/gntblist.c index 3a6abfc8f0..31612b6f79 100644 --- a/finch/gntblist.c +++ b/finch/gntblist.c @@ -169,7 +169,7 @@ static gboolean default_can_add_node(PurpleBlistNode *node) if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { PurpleBuddy *buddy = (PurpleBuddy*)node; - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (!purple_buddy_get_contact(buddy)) return FALSE; /* When a new buddy is added and show-offline is set */ if (PURPLE_BUDDY_IS_ONLINE(buddy)) @@ -329,11 +329,11 @@ static GList *managers; static FinchBlistNode * create_finch_blist_node(PurpleBlistNode *node, gpointer row) { - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (!fnode) { fnode = g_new0(FinchBlistNode, 1); fnode->signed_timer = 0; - FINCH_SET_DATA(node, fnode); + purple_blist_node_set_ui_data(node, fnode); } fnode->row = row; return fnode; @@ -342,13 +342,13 @@ create_finch_blist_node(PurpleBlistNode *node, gpointer row) static void reset_blist_node_ui_data(PurpleBlistNode *node) { - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (fnode == NULL) return; if (fnode->signed_timer) purple_timeout_remove(fnode->signed_timer); g_free(fnode); - FINCH_SET_DATA(node, NULL); + purple_blist_node_set_ui_data(node, NULL); } static int @@ -381,7 +381,7 @@ static GntTextFormatFlags get_blist_node_flag(PurpleBlistNode *node) { GntTextFormatFlags flag = 0; - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (ggblist->tagged && g_list_find(ggblist->tagged, node)) flag |= GNT_TEXT_FLAG_BOLD; @@ -390,7 +390,7 @@ get_blist_node_flag(PurpleBlistNode *node) flag |= GNT_TEXT_FLAG_BLINK; else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); - fnode = FINCH_GET_DATA(node); + fnode = purple_blist_node_get_ui_data(node); if (fnode && fnode->signed_timer) flag |= GNT_TEXT_FLAG_BLINK; } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { @@ -406,7 +406,7 @@ get_blist_node_flag(PurpleBlistNode *node) node = purple_blist_node_get_sibling_next(node)) { PurpleBlistNode *pnode; pnode = purple_contact_get_priority_buddy((PurpleContact*)node); - fnode = FINCH_GET_DATA(node); + fnode = purple_blist_node_get_ui_data(node); if (fnode && fnode->signed_timer) { flag |= GNT_TEXT_FLAG_BLINK; break; @@ -433,7 +433,7 @@ is_contact_online(PurpleContact *contact) PurpleBlistNode *node; for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)contact)); node; node = purple_blist_node_get_sibling_next(node)) { - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node) || (fnode && fnode->signed_timer)) return TRUE; @@ -465,7 +465,7 @@ new_node(PurpleBlistNode *node) static void add_node(PurpleBlistNode *node, FinchBlist *ggblist) { - if (FINCH_GET_DATA(node)) + if (purple_blist_node_get_ui_data(node)) return; if (!ggblist->manager->can_add_node(node)) @@ -502,7 +502,7 @@ node_remove(PurpleBuddyList *list, PurpleBlistNode *node) FinchBlist *ggblist = FINCH_GET_DATA(list); PurpleBlistNode *parent; - if (ggblist == NULL || FINCH_GET_DATA(node) == NULL) + if (ggblist == NULL || purple_blist_node_get_ui_data(node) == NULL) return; if (PURPLE_BLIST_NODE_IS_GROUP(node) && ggblist->new_group) { @@ -543,7 +543,7 @@ node_update(PurpleBuddyList *list, PurpleBlistNode *node) if (ggblist->window == NULL) return; - if (FINCH_GET_DATA(node)!= NULL) { + if (purple_blist_node_get_ui_data(node)!= NULL) { gnt_tree_change_text(GNT_TREE(ggblist->tree), node, 0, get_display_name(node)); gnt_tree_sort_row(GNT_TREE(ggblist->tree), node); @@ -560,7 +560,7 @@ node_update(PurpleBuddyList *list, PurpleBlistNode *node) } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { add_node(node, FINCH_GET_DATA(list)); } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { - if (FINCH_GET_DATA(node)== NULL) { + if (purple_blist_node_get_ui_data(node)== NULL) { /* The core seems to expect the UI to add the buddies. */ for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node)) add_node(node, FINCH_GET_DATA(list)); @@ -663,7 +663,7 @@ add_buddy_cb(void *data, PurpleRequestFields *allfields) purple_blist_add_buddy(buddy, NULL, grp, NULL); } - purple_account_add_buddy_with_invite(account, buddy, invite); + purple_account_add_buddy(account, buddy, invite); } static void @@ -839,7 +839,7 @@ add_group_cb(gpointer null, const char *group) /* Select the group */ if (ggblist->tree) { - FinchBlistNode *fnode = FINCH_GET_DATA((PurpleBlistNode*)grp); + FinchBlistNode *fnode = purple_blist_node_get_ui_data((PurpleBlistNode*)grp); if (!fnode) add_node((PurpleBlistNode*)grp, ggblist); gnt_tree_set_selected(GNT_TREE(ggblist->tree), grp); @@ -887,7 +887,7 @@ add_group(PurpleGroup *group, FinchBlist *ggblist) { gpointer parent; PurpleBlistNode *node = (PurpleBlistNode *)group; - if (FINCH_GET_DATA(node)) + if (purple_blist_node_get_ui_data(node)) return; parent = ggblist->manager->find_parent((PurpleBlistNode*)group); create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, @@ -960,7 +960,7 @@ add_chat(PurpleChat *chat, FinchBlist *ggblist) { gpointer parent; PurpleBlistNode *node = (PurpleBlistNode *)chat; - if (FINCH_GET_DATA(node)) + if (purple_blist_node_get_ui_data(node)) return; if (!purple_account_is_connected(purple_chat_get_account(chat))) return; @@ -979,7 +979,7 @@ add_contact(PurpleContact *contact, FinchBlist *ggblist) PurpleBlistNode *node = (PurpleBlistNode*)contact; const char *name; - if (FINCH_GET_DATA(node)) + if (purple_blist_node_get_ui_data(node)) return; name = get_display_name(node); @@ -1002,7 +1002,7 @@ add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist) PurpleBlistNode *node = (PurpleBlistNode *)buddy; PurpleContact *contact; - if (FINCH_GET_DATA(node)) + if (purple_blist_node_get_ui_data(node)) return; contact = purple_buddy_get_contact(buddy); @@ -1060,7 +1060,7 @@ selection_activate(GntWidget *widget, FinchBlist *ggblist) purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)); } else { - FinchConv *ggconv = FINCH_GET_DATA(conv); + FinchConv *ggconv = FINCH_CONV(conv); gnt_window_present(ggconv->window); } finch_conversation_set_active(conv); @@ -1078,9 +1078,10 @@ context_menu_callback(GntMenuItem *item, gpointer data) PurpleBlistNode *node = ggblist->cnode; if (action) { void (*callback)(PurpleBlistNode *, gpointer); - callback = (void (*)(PurpleBlistNode *, gpointer))action->callback; + callback = (void (*)(PurpleBlistNode *, gpointer)) + purple_menu_action_get_callback(action); if (callback) - callback(node, action->data); + callback(node, purple_menu_action_get_data(action)); else return; } @@ -1095,15 +1096,17 @@ gnt_append_menu_action(GntMenu *menu, PurpleMenuAction *action, gpointer parent) if (action == NULL) return; - item = gnt_menuitem_new(action->label); - if (action->callback) + item = gnt_menuitem_new(purple_menu_action_get_label(action)); + if (purple_menu_action_get_callback(action)) gnt_menuitem_set_callback(GNT_MENU_ITEM(item), context_menu_callback, action); gnt_menu_add_item(menu, GNT_MENU_ITEM(item)); - if (action->children) { + list = purple_menu_action_get_children(action); + + if (list) { GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); gnt_menuitem_set_submenu(item, GNT_MENU(sub)); - for (list = action->children; list; list = list->next) + for (; list; list = list->next) gnt_append_menu_action(GNT_MENU(sub), list->data, action); } } @@ -1123,7 +1126,7 @@ append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) PurpleMenuAction *act = (PurpleMenuAction *) list->data; if (!act) continue; - act->data = node; + purple_menu_action_set_data(act, node); gnt_append_menu_action(menu, act, NULL); g_signal_connect_swapped(G_OBJECT(menu), "destroy", G_CALLBACK(purple_menu_action_free), act); @@ -1216,7 +1219,7 @@ static void autojoin_toggled(GntMenuItem *item, gpointer data) { PurpleMenuAction *action = data; - purple_blist_node_set_bool(action->data, "gnt-autojoin", + purple_blist_node_set_bool(purple_menu_action_get_data(action), "gnt-autojoin", gnt_menuitem_check_get_checked(GNT_MENU_ITEM_CHECK(item))); } @@ -1224,7 +1227,8 @@ static void create_chat_menu(GntMenu *menu, PurpleChat *chat) { PurpleMenuAction *action = purple_menu_action_new(_("Auto-join"), NULL, chat, NULL); - GntMenuItem *check = gnt_menuitem_check_new(action->label); + GntMenuItem *check = gnt_menuitem_check_new( + purple_menu_action_get_label(action)); gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(check), purple_blist_node_get_bool((PurpleBlistNode*)chat, "gnt-autojoin")); gnt_menu_add_item(menu, check); @@ -1557,7 +1561,7 @@ finch_blist_remove_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node) if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { PurpleContact *c = (PurpleContact*)node; name = purple_contact_get_alias(c); - if (c->totalsize > 1) + if (purple_contact_get_contact_size(c, TRUE) > 1) sec = _("Removing this contact will also remove all the buddies in the contact"); } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { name = purple_buddy_get_name((PurpleBuddy*)node); @@ -2541,7 +2545,7 @@ static gboolean buddy_recent_signed_on_off(gpointer data) { PurpleBlistNode *node = data; - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); purple_timeout_remove(fnode->signed_timer); fnode->signed_timer = 0; @@ -2561,7 +2565,7 @@ static gboolean buddy_signed_on_off_cb(gpointer data) { PurpleBlistNode *node = data; - FinchBlistNode *fnode = FINCH_GET_DATA(node); + FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); if (!ggblist || !fnode) return FALSE; diff --git a/finch/gntblist.h b/finch/gntblist.h index a8037d597d..5b67691970 100644 --- a/finch/gntblist.h +++ b/finch/gntblist.h @@ -115,15 +115,12 @@ void finch_blist_set_size(int width, int height); * @param name The user to get information about. * * @return Returns the ui-handle for the userinfo notification. - * - * @since 2.1.0 */ gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name); /** * Get the tree list of the buddy list. * @return The GntTree widget. - * @since 2.4.0 */ GntTree * finch_blist_get_tree(void); @@ -131,7 +128,6 @@ GntTree * finch_blist_get_tree(void); * Add an alternate buddy list manager. * * @param manager The alternate buddylist manager. - * @since 2.4.0 */ void finch_blist_install_manager(const FinchBlistManager *manager); @@ -139,7 +135,6 @@ void finch_blist_install_manager(const FinchBlistManager *manager); * Remove an alternate buddy list manager. * * @param manager The buddy list manager to remove. - * @since 2.4.0 */ void finch_blist_uninstall_manager(const FinchBlistManager *manager); @@ -149,7 +144,6 @@ void finch_blist_uninstall_manager(const FinchBlistManager *manager); * @param id The identifier for the desired buddy list manager. * * @return The manager with the requested identifier, if available. @c NULL otherwise. - * @since 2.4.0 */ FinchBlistManager * finch_blist_manager_find(const char *id); @@ -157,7 +151,6 @@ FinchBlistManager * finch_blist_manager_find(const char *id); * Request the active buddy list manager to add a node. * * @param node The node to add - * @since 2.4.0 */ void finch_blist_manager_add_node(PurpleBlistNode *node); diff --git a/finch/gntconv.c b/finch/gntconv.c index 04c882857a..4d194c0e47 100644 --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -123,7 +123,7 @@ send_typing_notification(GntWidget *w, FinchConv *ggconv) if (send || (purple_conv_im_get_type_again(im) != 0 && time(NULL) > purple_conv_im_get_type_again(im))) { unsigned int timeout; - timeout = serv_send_typing(purple_conversation_get_gc(conv), + timeout = serv_send_typing(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), PURPLE_TYPING); purple_conv_im_set_type_again(im, timeout); @@ -131,7 +131,7 @@ send_typing_notification(GntWidget *w, FinchConv *ggconv) } else { purple_conv_im_stop_send_typed_timeout(im); - serv_send_typing(purple_conversation_get_gc(conv), + serv_send_typing(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), PURPLE_NOT_TYPING); } @@ -282,7 +282,7 @@ update_buddy_typing(PurpleAccount *account, const char *who, gpointer null) return; im = PURPLE_CONV_IM(conv); - ggc = FINCH_GET_DATA(conv); + ggc = FINCH_CONV(conv); if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) { int scroll; @@ -321,7 +321,7 @@ buddy_signed_on_off(PurpleBuddy *buddy, gpointer null) PurpleConversation *conv = find_conv_with_contact(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)); if (conv == NULL) return; - generate_send_to_menu(FINCH_GET_DATA(conv)); + generate_send_to_menu(FINCH_CONV(conv)); } static void @@ -333,7 +333,7 @@ account_signed_on_off(PurpleConnection *gc, gpointer null) PurpleConversation *cc = find_conv_with_contact( purple_conversation_get_account(conv), purple_conversation_get_name(conv)); if (cc) - generate_send_to_menu(FINCH_GET_DATA(cc)); + generate_send_to_menu(FINCH_CONV(cc)); list = list->next; } @@ -398,7 +398,7 @@ finch_conv_get_handle(void) static void cleared_message_history_cb(PurpleConversation *conv, gpointer data) { - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); if (ggc) gnt_text_view_clear(GNT_TEXT_VIEW(ggc->tv)); } @@ -414,7 +414,7 @@ static void send_file_cb(GntMenuItem *item, gpointer ggconv) { FinchConv *ggc = ggconv; - serv_send_file(purple_conversation_get_gc(ggc->active_conv), + serv_send_file(purple_conversation_get_connection(ggc->active_conv), purple_conversation_get_name(ggc->active_conv), NULL); } @@ -431,7 +431,7 @@ static void get_info_cb(GntMenuItem *item, gpointer ggconv) { FinchConv *ggc = ggconv; - finch_retrieve_user_info(purple_conversation_get_gc(ggc->active_conv), + finch_retrieve_user_info(purple_conversation_get_connection(ggc->active_conv), purple_conversation_get_name(ggc->active_conv)); } @@ -683,7 +683,7 @@ create_conv_from_userlist(GntWidget *widget, FinchConv *fc) name = gnt_tree_get_selection_data(GNT_TREE(widget)); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_cb_real_name)) realname = prpl_info->get_cb_real_name(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(fc->active_conv)), name); else @@ -749,7 +749,7 @@ cmd_removed_cb(const char *cmd, FinchConv *fconv) static void finch_create_conversation(PurpleConversation *conv) { - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); char *title; PurpleConversationType type; PurpleConversation *cc; @@ -763,8 +763,8 @@ finch_create_conversation(PurpleConversation *conv) account = purple_conversation_get_account(conv); cc = find_conv_with_contact(account, purple_conversation_get_name(conv)); - if (cc && FINCH_GET_DATA(cc)) - ggc = FINCH_GET_DATA(cc); + if (cc && FINCH_CONV(cc)) + ggc = FINCH_CONV(cc); else ggc = g_new0(FinchConv, 1); @@ -776,9 +776,9 @@ finch_create_conversation(PurpleConversation *conv) ggc->list = g_list_prepend(ggc->list, conv); ggc->active_conv = conv; - FINCH_SET_DATA(conv, ggc); + purple_conversation_set_ui_data(conv, ggc); - if (cc && FINCH_GET_DATA(cc) && cc != conv) { + if (cc && FINCH_CONV(cc) && cc != conv) { finch_conversation_set_active(conv); return; } @@ -885,7 +885,7 @@ static void finch_destroy_conversation(PurpleConversation *conv) { /* do stuff here */ - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); ggc->list = g_list_remove(ggc->list, conv); if (ggc->list && conv == ggc->active_conv) { ggc->active_conv = ggc->list->data; @@ -905,7 +905,7 @@ static void finch_write_common(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime) { - FinchConv *ggconv = FINCH_GET_DATA(conv); + FinchConv *ggconv = FINCH_CONV(conv); char *strip, *newline; GntTextFormatFlags fl = 0; int pos; @@ -1069,7 +1069,7 @@ chat_flag_text(PurpleConvChatBuddyFlags flags) static void finch_chat_add_users(PurpleConversation *conv, GList *users, gboolean new_arrivals) { - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); GntEntry *entry = GNT_ENTRY(ggc->entry); if (!new_arrivals) @@ -1084,10 +1084,10 @@ finch_chat_add_users(PurpleConversation *conv, GList *users, gboolean new_arriva for (iter = users; iter; iter = iter->next) { PurpleConvChatBuddy *cbuddy = iter->data; - char *str; + const char *str; - if ((str = cbuddy->alias) == NULL) - str = cbuddy->name; + if ((str = purple_conv_chat_cb_get_alias(cbuddy)) == NULL) + str = purple_conv_chat_cb_get_name(cbuddy); g_string_append_printf(string, "[ %s ]", str); } @@ -1100,10 +1100,10 @@ finch_chat_add_users(PurpleConversation *conv, GList *users, gboolean new_arriva { PurpleConvChatBuddy *cbuddy = users->data; GntTree *tree = GNT_TREE(ggc->u.chat->userlist); - gnt_entry_add_suggest(entry, cbuddy->name); - gnt_entry_add_suggest(entry, cbuddy->alias); - gnt_tree_add_row_after(tree, g_strdup(cbuddy->name), - gnt_tree_create_row(tree, chat_flag_text(cbuddy->flags), cbuddy->alias), NULL, NULL); + gnt_entry_add_suggest(entry, purple_conv_chat_cb_get_name(cbuddy)); + gnt_entry_add_suggest(entry, purple_conv_chat_cb_get_alias(cbuddy)); + gnt_tree_add_row_after(tree, g_strdup(purple_conv_chat_cb_get_name(cbuddy)), + gnt_tree_create_row(tree, chat_flag_text(purple_conv_chat_cb_get_flags(cbuddy)), purple_conv_chat_cb_get_alias(cbuddy)), NULL, NULL); } } @@ -1111,7 +1111,7 @@ static void finch_chat_rename_user(PurpleConversation *conv, const char *old, const char *new_n, const char *new_a) { /* Update the name for string completion */ - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); GntEntry *entry = GNT_ENTRY(ggc->entry); GntTree *tree = GNT_TREE(ggc->u.chat->userlist); PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), new_n); @@ -1122,14 +1122,14 @@ finch_chat_rename_user(PurpleConversation *conv, const char *old, const char *ne gnt_entry_add_suggest(entry, new_n); gnt_entry_add_suggest(entry, new_a); gnt_tree_add_row_after(tree, g_strdup(new_n), - gnt_tree_create_row(tree, chat_flag_text(cb->flags), new_a), NULL, NULL); + gnt_tree_create_row(tree, chat_flag_text(purple_conv_chat_cb_get_flags(cb)), new_a), NULL, NULL); } static void finch_chat_remove_users(PurpleConversation *conv, GList *list) { /* Remove the name from string completion */ - FinchConv *ggc = FINCH_GET_DATA(conv); + FinchConv *ggc = FINCH_CONV(conv); GntEntry *entry = GNT_ENTRY(ggc->entry); for (; list; list = list->next) { GntTree *tree = GNT_TREE(ggc->u.chat->userlist); @@ -1142,8 +1142,8 @@ static void finch_chat_update_user(PurpleConversation *conv, const char *user) { PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), user); - FinchConv *ggc = FINCH_GET_DATA(conv); - gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(cb->flags)); + FinchConv *ggc = FINCH_CONV(conv); + gnt_tree_change_text(GNT_TREE(ggc->u.chat->userlist), (gpointer)user, 0, chat_flag_text(purple_conv_chat_cb_get_flags(cb))); } static void @@ -1368,7 +1368,7 @@ cmd_message_color(PurpleConversation *conv, const char *cmd, char **args, char * static PurpleCmdRet users_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data) { - FinchConv *fc = FINCH_GET_DATA(conv); + FinchConv *fc = FINCH_CONV(conv); FinchConvChat *ch; if (!fc) return PURPLE_CMD_RET_FAILED; @@ -1494,7 +1494,7 @@ void finch_conversation_uninit() void finch_conversation_set_active(PurpleConversation *conv) { - FinchConv *ggconv = FINCH_GET_DATA(conv); + FinchConv *ggconv = FINCH_CONV(conv); PurpleAccount *account; char *title; @@ -1513,7 +1513,7 @@ void finch_conversation_set_active(PurpleConversation *conv) void finch_conversation_set_info_widget(PurpleConversation *conv, GntWidget *widget) { - FinchConv *fc = FINCH_GET_DATA(conv); + FinchConv *fc = FINCH_CONV(conv); int height, width; gnt_box_remove_all(GNT_BOX(fc->info)); diff --git a/finch/gntconv.h b/finch/gntconv.h index b188469bf5..6fb9f34d47 100644 --- a/finch/gntconv.h +++ b/finch/gntconv.h @@ -33,7 +33,7 @@ #include "conversation.h" /* Grabs the conv out of a PurpleConverstation */ -#define FINCH_CONV(conv) ((FinchConv *)(conv)->ui_data) +#define FINCH_CONV(conv) ((FinchConv *)purple_conversation_get_ui_data(conv)) /*************************************************************************** * @name GNT Conversations API diff --git a/finch/gntft.c b/finch/gntft.c index 262140a7b6..95c806bbeb 100644 --- a/finch/gntft.c +++ b/finch/gntft.c @@ -42,9 +42,6 @@ #include "gntft.h" #include "prefs.h" -#define FINCHXFER(xfer) \ - (PurpleGntXferUiData *)FINCH_GET_DATA(xfer) - typedef struct { gboolean keep_open; @@ -152,7 +149,7 @@ toggle_clear_finished_cb(GntWidget *w) while (iter) { PurpleXfer *xfer = iter->data; iter = iter->next; - if (purple_xfer_is_completed(xfer) || purple_xfer_is_canceled(xfer)) + if (purple_xfer_is_completed(xfer) || purple_xfer_is_cancelled(xfer)) finch_xfer_dialog_remove_xfer(xfer); } } @@ -163,7 +160,7 @@ remove_button_cb(GntButton *button) { PurpleXfer *selected_xfer = gnt_tree_get_selection_data(GNT_TREE(xfer_dialog->tree)); if (selected_xfer && (purple_xfer_is_completed(selected_xfer) || - purple_xfer_is_canceled(selected_xfer))) { + purple_xfer_is_cancelled(selected_xfer))) { finch_xfer_dialog_remove_xfer(selected_xfer); } } @@ -262,7 +259,7 @@ finch_xfer_dialog_new(void) for (iter = purple_xfers_get_all(); iter; iter = iter->next) { PurpleXfer *xfer = (PurpleXfer *)iter->data; - PurpleGntXferUiData *data = FINCHXFER(xfer); + PurpleGntXferUiData *data = purple_xfer_get_ui_data(xfer); if (data->in_list) { finch_xfer_dialog_add_xfer(xfer); finch_xfer_dialog_update_xfer(xfer); @@ -302,7 +299,7 @@ finch_xfer_dialog_add_xfer(PurpleXfer *xfer) purple_xfer_ref(xfer); - data = FINCHXFER(xfer); + data = purple_xfer_get_ui_data(xfer); data->in_list = TRUE; finch_xfer_dialog_show(); @@ -340,7 +337,7 @@ finch_xfer_dialog_remove_xfer(PurpleXfer *xfer) g_return_if_fail(xfer_dialog != NULL); g_return_if_fail(xfer != NULL); - data = FINCHXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data == NULL) return; @@ -370,7 +367,7 @@ finch_xfer_dialog_cancel_xfer(PurpleXfer *xfer) g_return_if_fail(xfer_dialog != NULL); g_return_if_fail(xfer != NULL); - data = FINCHXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data == NULL) return; @@ -385,7 +382,7 @@ finch_xfer_dialog_cancel_xfer(PurpleXfer *xfer) update_title_progress(); - if (purple_xfer_is_canceled(xfer)) + if (purple_xfer_is_cancelled(xfer)) status = _("Cancelled"); else status = _("Failed"); @@ -416,7 +413,7 @@ finch_xfer_dialog_update_xfer(PurpleXfer *xfer) g_return_if_fail(xfer_dialog != NULL); g_return_if_fail(xfer != NULL); - if ((data = FINCHXFER(xfer)) == NULL) + if ((data = purple_xfer_get_ui_data(xfer)) == NULL) return; if (data->in_list == FALSE || data->notified) @@ -471,9 +468,9 @@ finch_xfer_new_xfer(PurpleXfer *xfer) { PurpleGntXferUiData *data; - /* This is where we're setting xfer->ui_data for the first time. */ + /* This is where we're setting xfer's "ui_data" for the first time. */ data = g_new0(PurpleGntXferUiData, 1); - FINCH_SET_DATA(xfer, data); + purple_xfer_set_ui_data(xfer, data); } static void @@ -481,11 +478,11 @@ finch_xfer_destroy(PurpleXfer *xfer) { PurpleGntXferUiData *data; - data = FINCHXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data) { g_free(data->name); g_free(data); - FINCH_SET_DATA(xfer, NULL); + purple_xfer_set_ui_data(xfer, NULL); } } diff --git a/finch/gntnotify.c b/finch/gntnotify.c index 94ed5959e0..103495dc93 100644 --- a/finch/gntnotify.c +++ b/finch/gntnotify.c @@ -386,6 +386,7 @@ finch_notify_sr_new_rows(PurpleConnection *gc, { GntTree *tree = GNT_TREE(data); GList *o; + GntTreeRow *prev = NULL; /* XXX: Do I need to empty the tree here? */ @@ -393,10 +394,17 @@ finch_notify_sr_new_rows(PurpleConnection *gc, { gnt_tree_add_row_after(GNT_TREE(tree), o->data, gnt_tree_create_row_from_list(GNT_TREE(tree), o->data), - NULL, NULL); + NULL, prev); + prev = o->data; } } +static void +notify_sr_destroy_cb(GntWidget *window, void *data) +{ + purple_notify_close(PURPLE_NOTIFY_SEARCHRESULTS, window); +} + static void * finch_notify_searchresults(PurpleConnection *gc, const char *title, const char *primary, const char *secondary, @@ -429,7 +437,7 @@ finch_notify_searchresults(PurpleConnection *gc, const char *title, for (iter = results->columns; iter; iter = iter->next) { PurpleNotifySearchColumn *column = iter->data; - gnt_tree_set_column_title(GNT_TREE(tree), i, column->title); + gnt_tree_set_column_title(GNT_TREE(tree), i, purple_notify_searchresult_column_get_title(column)); if (!purple_notify_searchresult_column_is_visible(column)) gnt_tree_set_column_visible(GNT_TREE(tree), i, FALSE); @@ -481,6 +489,8 @@ finch_notify_searchresults(PurpleConnection *gc, const char *title, } gnt_box_add_widget(GNT_BOX(window), box); + g_signal_connect(G_OBJECT(tree), "destroy", + G_CALLBACK(notify_sr_destroy_cb), NULL); finch_notify_sr_new_rows(gc, results, tree); diff --git a/finch/gntrequest.c b/finch/gntrequest.c index 37940e01c1..42c9877e14 100644 --- a/finch/gntrequest.c +++ b/finch/gntrequest.c @@ -41,12 +41,6 @@ #include "debug.h" #include "util.h" -/* XXX: Until gobjectification ... */ -#undef FINCH_GET_DATA -#undef FINCH_SET_DATA -#define FINCH_GET_DATA(obj) purple_request_field_get_ui_data(obj) -#define FINCH_SET_DATA(obj, data) purple_request_field_set_ui_data(obj, data) - typedef struct { void *user_data; @@ -323,26 +317,26 @@ request_fields_cb(GntWidget *button, PurpleRequestFields *fields) continue; if (type == PURPLE_REQUEST_FIELD_BOOLEAN) { - GntWidget *check = FINCH_GET_DATA(field); + GntWidget *check = purple_request_field_get_ui_data(field); gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); purple_request_field_bool_set_value(field, value); } else if (type == PURPLE_REQUEST_FIELD_STRING) { - GntWidget *entry = FINCH_GET_DATA(field); + GntWidget *entry = purple_request_field_get_ui_data(field); const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); purple_request_field_string_set_value(field, (text && *text) ? text : NULL); } else if (type == PURPLE_REQUEST_FIELD_INTEGER) { - GntWidget *entry = FINCH_GET_DATA(field); + GntWidget *entry = purple_request_field_get_ui_data(field); const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); int value = (text && *text) ? atoi(text) : 0; purple_request_field_int_set_value(field, value); } else if (type == PURPLE_REQUEST_FIELD_CHOICE) { - GntWidget *combo = FINCH_GET_DATA(field); + GntWidget *combo = purple_request_field_get_ui_data(field); int id; id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); purple_request_field_choice_set_value(field, id); @@ -352,7 +346,7 @@ request_fields_cb(GntWidget *button, PurpleRequestFields *fields) GList *list = NULL, *iter; if (purple_request_field_list_get_multi_select(field)) { - GntWidget *tree = FINCH_GET_DATA(field); + GntWidget *tree = purple_request_field_get_ui_data(field); iter = purple_request_field_list_get_items(field); for (; iter; iter = iter->next) @@ -365,7 +359,7 @@ request_fields_cb(GntWidget *button, PurpleRequestFields *fields) } else { - GntWidget *combo = FINCH_GET_DATA(field); + GntWidget *combo = purple_request_field_get_ui_data(field); gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); iter = purple_request_field_list_get_items(field); @@ -384,7 +378,7 @@ request_fields_cb(GntWidget *button, PurpleRequestFields *fields) } else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) { - GntWidget *combo = FINCH_GET_DATA(field); + GntWidget *combo = purple_request_field_get_ui_data(field); PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); purple_request_field_account_set_value(field, acc); } @@ -633,36 +627,36 @@ finch_request_fields(const char *title, const char *primary, if (type == PURPLE_REQUEST_FIELD_BOOLEAN) { - FINCH_SET_DATA(field, create_boolean_field(field)); + purple_request_field_set_ui_data(field, create_boolean_field(field)); } else if (type == PURPLE_REQUEST_FIELD_STRING) { - FINCH_SET_DATA(field, create_string_field(field, &username)); + purple_request_field_set_ui_data(field, create_string_field(field, &username)); } else if (type == PURPLE_REQUEST_FIELD_INTEGER) { - FINCH_SET_DATA(field, create_integer_field(field)); + purple_request_field_set_ui_data(field, create_integer_field(field)); } else if (type == PURPLE_REQUEST_FIELD_CHOICE) { - FINCH_SET_DATA(field, create_choice_field(field)); + purple_request_field_set_ui_data(field, create_choice_field(field)); } else if (type == PURPLE_REQUEST_FIELD_LIST) { - FINCH_SET_DATA(field, create_list_field(field)); + purple_request_field_set_ui_data(field, create_list_field(field)); } else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) { accountlist = create_account_field(field); - FINCH_SET_DATA(field, accountlist); + purple_request_field_set_ui_data(field, accountlist); } else { - FINCH_SET_DATA(field, gnt_label_new_with_format(_("Not implemented yet."), + purple_request_field_set_ui_data(field, gnt_label_new_with_format(_("Not implemented yet."), GNT_TEXT_FLAG_BOLD)); } gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); - gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(FINCH_GET_DATA(field))); + gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(purple_request_field_get_ui_data(field))); } if (grlist->next) gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); diff --git a/finch/gntrequest.h b/finch/gntrequest.h index 2e1c33fde5..63c4534486 100644 --- a/finch/gntrequest.h +++ b/finch/gntrequest.h @@ -63,7 +63,6 @@ void finch_request_save_in_prefs(gpointer null, PurpleRequestFields *fields); * @param field The request field. * * @return A GntWidget for the request field. - * @since 2.4.0 */ GntWidget *finch_request_field_get_widget(PurpleRequestField *field); /*@}*/ diff --git a/finch/gntroomlist.c b/finch/gntroomlist.c index 92299d3a5c..e4a17c73fc 100644 --- a/finch/gntroomlist.c +++ b/finch/gntroomlist.c @@ -41,6 +41,7 @@ #define PREF_ROOT "/finch/roomlist" + /* Yes, just one roomlist at a time. Let's not get greedy. Aight? */ struct _FinchRoomlist { @@ -146,9 +147,9 @@ roomlist_activated(GntWidget *widget) purple_roomlist_room_join(froomlist.roomlist, room); break; case PURPLE_ROOMLIST_ROOMTYPE_CATEGORY: - if (!room->expanded_once) { + if (!purple_roomlist_room_get_expanded_once(room)) { purple_roomlist_expand_category(froomlist.roomlist, room); - room->expanded_once = TRUE; + purple_roomlist_room_set_expanded_once(room, TRUE); } break; } @@ -343,7 +344,7 @@ fl_show_with_account(PurpleAccount *account) static void fl_create(PurpleRoomlist *list) { - FINCH_SET_DATA(list, &froomlist); + purple_roomlist_set_ui_data(list, &froomlist); setup_roomlist(NULL); update_roomlist(list); } diff --git a/finch/gntsound.c b/finch/gntsound.c index 296fee1ef3..3a5deb99d0 100644 --- a/finch/gntsound.c +++ b/finch/gntsound.c @@ -150,7 +150,7 @@ chat_nick_matches_name(PurpleConversation *conv, const char *aname) return ret; account = purple_conversation_get_account(conv); - nick = g_strdup(purple_normalize(account, chat->nick)); + nick = g_strdup(purple_normalize(account, purple_conv_chat_get_nick(chat))); name = g_strdup(purple_normalize(account, aname)); if (g_utf8_collate(nick, name) == 0) @@ -268,7 +268,7 @@ chat_msg_received_cb(PurpleAccount *account, char *sender, if (chat_nick_matches_name(conv, sender)) return; - if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, chat->nick)) + if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, purple_conv_chat_get_nick(chat))) play_conv_event(conv, PURPLE_SOUND_CHAT_NICK); else play_conv_event(conv, event); diff --git a/finch/gntsound.h b/finch/gntsound.h index c1edfaac6f..56deb9915e 100644 --- a/finch/gntsound.h +++ b/finch/gntsound.h @@ -37,8 +37,6 @@ * Get the name of the active sound profile. * * @return The name of the profile - * - * @since 2.1.0 */ const char *finch_sound_get_active_profile(void); @@ -46,8 +44,6 @@ const char *finch_sound_get_active_profile(void); * Set the active profile. If the profile doesn't exist, nothing is changed. * * @param name The name of the profile - * - * @since 2.1.0 */ void finch_sound_set_active_profile(const char *name); @@ -56,8 +52,6 @@ void finch_sound_set_active_profile(const char *name); * * @return A list of strings denoting sound profile names. * Caller must free the list (but not the data). - * - * @since 2.1.0 */ GList *finch_sound_get_profiles(void); @@ -66,8 +60,6 @@ GList *finch_sound_get_profiles(void); * * @return Returns FALSE if preference is set to 'No sound', or if volume is * set to zero. - * - * @since 2.2.0 */ gboolean finch_sound_is_enabled(void); @@ -75,15 +67,11 @@ gboolean finch_sound_is_enabled(void); * Gets GNT sound UI ops. * * @return The UI operations structure. - * - * @since 2.1.0 */ PurpleSoundUiOps *finch_sound_get_ui_ops(void); /** * Show the sound settings dialog. - * - * @since 2.1.0 */ void finch_sounds_show_all(void); diff --git a/finch/libgnt/gntwm.c b/finch/libgnt/gntwm.c index e3e113ed17..69b1cca972 100644 --- a/finch/libgnt/gntwm.c +++ b/finch/libgnt/gntwm.c @@ -32,7 +32,7 @@ #define _GNU_SOURCE #endif -#if !defined _XOPEN_SOURCE_EXTENDED && (defined(__APPLE__) || defined(__unix__)) && !defined(__FreeBSD__) && !defined(__OpenBSD__) +#if !defined _XOPEN_SOURCE_EXTENDED && (defined(__APPLE__) || defined(__unix__)) && !defined(__FreeBSD__) #define _XOPEN_SOURCE_EXTENDED #endif diff --git a/finch/plugins/gntgf.c b/finch/plugins/gntgf.c index 9d7d726d86..925c24834d 100644 --- a/finch/plugins/gntgf.c +++ b/finch/plugins/gntgf.c @@ -168,7 +168,7 @@ notify(PurpleConversation *conv, const char *fmt, ...) beep(); if (conv != NULL) { - FinchConv *fc = conv->ui_data; + FinchConv *fc = FINCH_CONV(conv); if (gnt_widget_has_focus(fc->window)) return; } @@ -256,7 +256,7 @@ received_chat_msg(PurpleAccount *account, const char *sender, const char *msg, if (flags & PURPLE_MESSAGE_WHISPER) return; - nick = PURPLE_CONV_CHAT(conv)->nick; + nick = purple_conv_chat_get_nick(PURPLE_CONV_CHAT(conv)); if (g_utf8_collate(sender, nick) == 0) return; diff --git a/finch/plugins/gnttinyurl.c b/finch/plugins/gnttinyurl.c index 4d70de1d03..2718f5fe75 100644 --- a/finch/plugins/gnttinyurl.c +++ b/finch/plugins/gnttinyurl.c @@ -319,7 +319,7 @@ process_urls(PurpleConversation *conv, GList *urls) url = g_strdup_printf("%s%s", purple_prefs_get_string(PREF_URL), purple_url_encode(tmp)); } g_free(tmp); - purple_util_fetch_url(url, TRUE, "finch", FALSE, url_fetched, cbdata); + purple_util_fetch_url(url, TRUE, "finch", FALSE, -1, url_fetched, cbdata); i = gnt_text_view_get_lines_below(tv); str = g_strdup_printf(_("\nFetching TinyURL...")); gnt_text_view_append_text_with_tag((tv), str, GNT_TEXT_FLAG_DIM, cbdata->tag); @@ -383,7 +383,7 @@ tinyurl_notify_uri(const char *uri) /* Store the return value of _fetch_url and destroy that when win is destroyed, so that the callback for _fetch_url does not try to molest a non-existent window */ - urlcb = purple_util_fetch_url(fullurl, TRUE, "finch", FALSE, tinyurl_notify_fetch_cb, win); + urlcb = purple_util_fetch_url(fullurl, TRUE, "finch", FALSE, -1, tinyurl_notify_fetch_cb, win); g_free(fullurl); g_signal_connect_swapped(G_OBJECT(win), "destroy", G_CALLBACK(purple_util_fetch_url_cancel), urlcb); diff --git a/finch/plugins/grouping.c b/finch/plugins/grouping.c index b312c7dc3b..18ebd4cbe0 100644 --- a/finch/plugins/grouping.c +++ b/finch/plugins/grouping.c @@ -54,7 +54,7 @@ static gboolean on_offline_can_add_node(PurpleBlistNode *node) case PURPLE_BLIST_CONTACT_NODE: { PurpleContact *contact = (PurpleContact*)node; - if (contact->currentsize > 0) + if (purple_contact_get_contact_size(contact, FALSE) > 0) return TRUE; return FALSE; } diff --git a/finch/plugins/lastlog.c b/finch/plugins/lastlog.c index 753935bd48..86cd718e2f 100644 --- a/finch/plugins/lastlog.c +++ b/finch/plugins/lastlog.c @@ -60,7 +60,7 @@ window_kpress_cb(GntWidget *wid, const char *key, GntTextView *view) static PurpleCmdRet lastlog_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer null) { - FinchConv *ggconv = conv->ui_data; + FinchConv *ggconv = FINCH_CONV(conv); char **strings = g_strsplit(GNT_TEXT_VIEW(ggconv->tv)->string->str, "\n", 0); GntWidget *win, *tv; int i, j; diff --git a/libpurple/account.c b/libpurple/account.c index 360efe9148..5948344a36 100644 --- a/libpurple/account.c +++ b/libpurple/account.c @@ -41,14 +41,6 @@ #include "util.h" #include "xmlnode.h" -typedef struct -{ - PurpleConnectionErrorInfo *current_error; -} PurpleAccountPrivate; - -#define PURPLE_ACCOUNT_GET_PRIVATE(account) \ - ((PurpleAccountPrivate *) (account->priv)) - /* TODO: Should use PurpleValue instead of this? What about "ui"? */ typedef struct { @@ -361,8 +353,6 @@ current_error_to_xmlnode(PurpleConnectionErrorInfo *err) static xmlnode * account_to_xmlnode(PurpleAccount *account) { - PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - xmlnode *node, *child; const char *tmp; PurplePresence *presence; @@ -419,7 +409,7 @@ account_to_xmlnode(PurpleAccount *account) xmlnode_insert_child(node, child); } - child = current_error_to_xmlnode(priv->current_error); + child = current_error_to_xmlnode(account->current_error); xmlnode_insert_child(node, child); return node; @@ -996,7 +986,6 @@ PurpleAccount * purple_account_new(const char *username, const char *protocol_id) { PurpleAccount *account = NULL; - PurpleAccountPrivate *priv = NULL; PurplePlugin *prpl = NULL; PurplePluginProtocolInfo *prpl_info = NULL; PurpleStatusType *status_type; @@ -1011,8 +1000,6 @@ purple_account_new(const char *username, const char *protocol_id) account = g_new0(PurpleAccount, 1); PURPLE_DBUS_REGISTER_POINTER(account, PurpleAccount); - priv = g_new0(PurpleAccountPrivate, 1); - account->priv = priv; purple_account_set_username(account, username); @@ -1055,7 +1042,6 @@ purple_account_new(const char *username, const char *protocol_id) void purple_account_destroy(PurpleAccount *account) { - PurpleAccountPrivate *priv = NULL; GList *l; g_return_if_fail(account != NULL); @@ -1086,7 +1072,8 @@ purple_account_destroy(PurpleAccount *account) purple_account_set_status_types(account, NULL); - purple_presence_destroy(account->presence); + if (account->presence) + purple_presence_destroy(account->presence); if(account->system_log) purple_log_free(account->system_log); @@ -1101,13 +1088,11 @@ purple_account_destroy(PurpleAccount *account) account->permit = g_slist_delete_link(account->permit, account->permit); } - priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - PURPLE_DBUS_UNREGISTER_POINTER(priv->current_error); - if (priv->current_error) { - g_free(priv->current_error->description); - g_free(priv->current_error); + PURPLE_DBUS_UNREGISTER_POINTER(account->current_error); + if (account->current_error) { + g_free(account->current_error->description); + g_free(account->current_error); } - g_free(priv); PURPLE_DBUS_UNREGISTER_POINTER(account); g_free(account); @@ -1133,6 +1118,15 @@ purple_account_register(PurpleAccount *account) _purple_connection_new(account, TRUE, purple_account_get_password(account)); } +void +purple_account_register_completed(PurpleAccount *account, gboolean succeeded) +{ + g_return_if_fail(account != NULL); + + if (account->registration_cb) + (account->registration_cb)(account, succeeded, account->registration_cb_user_data); +} + void purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { @@ -1280,6 +1274,14 @@ purple_account_disconnect(PurpleAccount *account) account->disconnecting = FALSE; } +gboolean +purple_account_is_disconnecting(const PurpleAccount *account) +{ + g_return_val_if_fail(account != NULL, TRUE); + + return account->disconnecting; +} + void purple_account_notify_added(PurpleAccount *account, const char *remote_user, const char *id, const char *alias, @@ -1606,7 +1608,7 @@ purple_account_request_change_user_info(PurpleAccount *account) purple_request_input(gc, _("Set User Info"), primary, NULL, purple_account_get_user_info(account), TRUE, FALSE, ((gc != NULL) && - (gc->flags & PURPLE_CONNECTION_HTML) ? "html" : NULL), + (purple_connection_get_flags(gc) & PURPLE_CONNECTION_HTML) ? "html" : NULL), _("Save"), G_CALLBACK(set_user_info_cb), _("Cancel"), NULL, account, NULL, NULL, @@ -2486,6 +2488,24 @@ purple_account_get_ui_bool(const PurpleAccount *account, const char *ui, return setting->value.boolean; } +gpointer +purple_account_get_ui_data(const PurpleAccount *account) +{ + g_return_val_if_fail(account != NULL, NULL); + + return account->ui_data; +} + +void +purple_account_set_ui_data(PurpleAccount *account, + gpointer ui_data) +{ + g_return_if_fail(account != NULL); + + account->ui_data = ui_data; +} + + PurpleLog * purple_account_get_log(PurpleAccount *account, gboolean create) { @@ -2518,7 +2538,7 @@ purple_account_destroy_log(PurpleAccount *account) } void -purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy) +purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy, const char *message) { PurplePluginProtocolInfo *prpl_info = NULL; PurpleConnection *gc; @@ -2535,40 +2555,13 @@ purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); if (prpl_info != NULL) { - if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite)) - prpl_info->add_buddy_with_invite(gc, buddy, purple_buddy_get_group(buddy), NULL); - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) - prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy)); + if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) + prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy), message); } } void -purple_account_add_buddy_with_invite(PurpleAccount *account, PurpleBuddy *buddy, const char *message) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc; - PurplePlugin *prpl = NULL; - - g_return_if_fail(account != NULL); - g_return_if_fail(buddy != NULL); - - gc = purple_account_get_connection(account); - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info != NULL) { - if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite)) - prpl_info->add_buddy_with_invite(gc, buddy, purple_buddy_get_group(buddy), message); - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) - prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy)); - } -} - -void -purple_account_add_buddies(PurpleAccount *account, GList *buddies) +purple_account_add_buddies(PurpleAccount *account, GList *buddies, const char *message) { PurplePluginProtocolInfo *prpl_info = NULL; PurpleConnection *gc = purple_account_get_connection(account); @@ -2589,73 +2582,13 @@ purple_account_add_buddies(PurpleAccount *account, GList *buddies) groups = g_list_append(groups, purple_buddy_get_group(buddy)); } - if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies_with_invite)) - prpl_info->add_buddies_with_invite(gc, buddies, groups, NULL); - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies)) - prpl_info->add_buddies(gc, buddies, groups); - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite)) { - GList *curb = buddies, *curg = groups; - - while ((curb != NULL) && (curg != NULL)) { - prpl_info->add_buddy_with_invite(gc, curb->data, curg->data, NULL); - curb = curb->next; - curg = curg->next; - } - } - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) { - GList *curb = buddies, *curg = groups; - - while ((curb != NULL) && (curg != NULL)) { - prpl_info->add_buddy(gc, curb->data, curg->data); - curb = curb->next; - curg = curg->next; - } - } - - g_list_free(groups); - } -} - -void -purple_account_add_buddies_with_invite(PurpleAccount *account, GList *buddies, const char *message) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc = purple_account_get_connection(account); - PurplePlugin *prpl = NULL; - - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info) { - GList *cur, *groups = NULL; - - /* Make a list of what group each buddy is in */ - for (cur = buddies; cur != NULL; cur = cur->next) { - PurpleBuddy *buddy = cur->data; - groups = g_list_append(groups, purple_buddy_get_group(buddy)); - } - - if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies_with_invite)) - prpl_info->add_buddies_with_invite(gc, buddies, groups, message); - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite)) { - GList *curb = buddies, *curg = groups; - - while ((curb != NULL) && (curg != NULL)) { - prpl_info->add_buddy_with_invite(gc, curb->data, curg->data, message); - curb = curb->next; - curg = curg->next; - } - } - else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies)) - prpl_info->add_buddies(gc, buddies, groups); + if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies)) + prpl_info->add_buddies(gc, buddies, groups, message); else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) { GList *curb = buddies, *curg = groups; while ((curb != NULL) && (curg != NULL)) { - prpl_info->add_buddy(gc, curb->data, curg->data); + prpl_info->add_buddy(gc, curb->data, curg->data, message); curb = curb->next; curg = curg->next; } @@ -2795,18 +2728,16 @@ signed_off_cb(PurpleConnection *gc, static void set_current_error(PurpleAccount *account, PurpleConnectionErrorInfo *new_err) { - PurpleAccountPrivate *priv; PurpleConnectionErrorInfo *old_err; g_return_if_fail(account != NULL); - priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - old_err = priv->current_error; + old_err = account->current_error; if(new_err == old_err) return; - priv->current_error = new_err; + account->current_error = new_err; purple_signal_emit(purple_accounts_get_handle(), "account-error-changed", @@ -2848,8 +2779,7 @@ connection_error_cb(PurpleConnection *gc, const PurpleConnectionErrorInfo * purple_account_get_current_error(PurpleAccount *account) { - PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - return priv->current_error; + return account->current_error; } void diff --git a/libpurple/account.h b/libpurple/account.h index 80a153b13f..69fd16cbe9 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -168,7 +168,7 @@ struct _PurpleAccount PurpleAccountRegistrationCb registration_cb; void *registration_cb_user_data; - gpointer priv; /**< Pointer to opaque private data. */ + PurpleConnectionErrorInfo *current_error; /**< Errors */ }; #ifdef __cplusplus @@ -220,6 +220,15 @@ void purple_account_set_register_callback(PurpleAccount *account, PurpleAccountR */ void purple_account_register(PurpleAccount *account); +/** + * Registration of the account was completed. + * Calls the registration call-back set with purple_account_set_register_callback(). + * + * @param account The account being registered. + * @param succeeded Was the account registration successful? + */ +void purple_account_register_completed(PurpleAccount *account, gboolean succeeded); + /** * Unregisters an account (deleting it from the server). * @@ -236,6 +245,15 @@ void purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrati */ void purple_account_disconnect(PurpleAccount *account); +/** + * Indicates if the account is currently being disconnected. + * + * @param account The account + * + * @return TRUE if the account is being disconnected. + */ +gboolean purple_account_is_disconnecting(const PurpleAccount *account); + /** * Notifies the user that the account was added to a remote user's * buddy list. @@ -433,8 +451,6 @@ void purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *info * * @param account The account. * @param privacy_type The privacy type. - * - * @since 2.7.0 */ void purple_account_set_privacy_type(PurpleAccount *account, PurplePrivacyType privacy_type); @@ -491,8 +507,6 @@ void purple_account_set_status_list(PurpleAccount *account, * is successfully set on the server (or NULL). * @param failure_cb A callback which will be called if the alias * is not successfully set on the server (or NULL). - * - * @since 2.7.0 */ void purple_account_set_public_alias(PurpleAccount *account, const char *alias, PurpleSetPublicAliasSuccessCallback success_cb, @@ -506,7 +520,6 @@ void purple_account_set_public_alias(PurpleAccount *account, * @param success_cb A callback which will be called with the alias * @param failure_cb A callback which will be called if the prpl is * unable to retrieve the server-side alias. - * @since 2.7.0 */ void purple_account_get_public_alias(PurpleAccount *account, PurpleGetPublicAliasSuccessCallback success_cb, @@ -542,8 +555,6 @@ void purple_account_clear_settings(PurpleAccount *account); * * @param account The account. * @param setting The setting to remove. - * - * @since 2.6.0 */ void purple_account_remove_setting(PurpleAccount *account, const char *setting); @@ -609,6 +620,25 @@ void purple_account_set_ui_string(PurpleAccount *account, const char *ui, void purple_account_set_ui_bool(PurpleAccount *account, const char *ui, const char *name, gboolean value); +/** + * Returns the UI data associated with this account. + * + * @param account The account. + * + * @return The UI data associated with this object. This is a + * convenience field provided to the UIs--it is not + * used by the libuprple core. + */ +gpointer purple_account_get_ui_data(const PurpleAccount *account); + +/** + * Set the UI data associated with this account. + * + * @param account The account. + * @param ui_data A pointer to associate with this object. + */ +void purple_account_set_ui_data(PurpleAccount *account, gpointer ui_data); + /** * Returns whether or not the account is connected. * @@ -717,8 +747,6 @@ PurpleConnection *purple_account_get_connection(const PurpleAccount *account); * @param account The account. * * @return The name to display. - * - * @since 2.7.0 */ const gchar *purple_account_get_name_for_display(const PurpleAccount *account); @@ -767,8 +795,6 @@ PurpleProxyInfo *purple_account_get_proxy_info(const PurpleAccount *account); * @param account The account. * * @return The privacy type. - * - * @since 2.7.0 */ PurplePrivacyType purple_account_get_privacy_type(const PurpleAccount *account); @@ -953,45 +979,23 @@ PurpleLog *purple_account_get_log(PurpleAccount *account, gboolean create); */ void purple_account_destroy_log(PurpleAccount *account); -/** - * Adds a buddy to the server-side buddy list for the specified account. - * - * @param account The account. - * @param buddy The buddy to add. - * - * @deprecated Use purple_account_add_buddy_with_invite and \c NULL message. - */ -void purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy); /** * Adds a buddy to the server-side buddy list for the specified account. * * @param account The account. * @param buddy The buddy to add. * @param message The invite message. This may be ignored by a prpl. - * - * @since 2.8.0 */ -void purple_account_add_buddy_with_invite(PurpleAccount *account, PurpleBuddy *buddy, const char *message); +void purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy, const char *message); -/** - * Adds a list of buddies to the server-side buddy list. - * - * @param account The account. - * @param buddies The list of PurpleBlistNodes representing the buddies to add. - * - * @deprecated Use purple_account_add_buddies_with_invite and \c NULL message. - */ -void purple_account_add_buddies(PurpleAccount *account, GList *buddies); /** * Adds a list of buddies to the server-side buddy list. * * @param account The account. * @param buddies The list of PurpleBlistNodes representing the buddies to add. * @param message The invite message. This may be ignored by a prpl. - * - * @since 2.8.0 */ -void purple_account_add_buddies_with_invite(PurpleAccount *account, GList *buddies, const char *message); +void purple_account_add_buddies(PurpleAccount *account, GList *buddies, const char *message); /** * Removes a buddy from the server-side buddy list. diff --git a/libpurple/accountopt.c b/libpurple/accountopt.c index 726f385f5e..266610c19d 100644 --- a/libpurple/accountopt.c +++ b/libpurple/accountopt.c @@ -28,6 +28,51 @@ #include "accountopt.h" #include "util.h" +/** + * An option for an account. + * + * This is set by protocol plugins, and appears in the account settings + * dialogs. + */ +struct _PurpleAccountOption +{ + PurplePrefType type; /**< The type of value. */ + + char *text; /**< The text that will appear to the user. */ + char *pref_name; /**< The name of the associated preference. */ + + union + { + gboolean boolean; /**< The default boolean value. */ + int integer; /**< The default integer value. */ + char *string; /**< The default string value. */ + GList *list; /**< The default list value. */ + + } default_value; + + gboolean masked; /**< Whether the value entered should be + * obscured from view (for passwords and + * similar options) + */ +}; + +/** + * A username split. + * + * This is used by some protocols to separate the fields of the username + * into more human-readable components. + */ +struct _PurpleAccountUserSplit +{ + char *text; /**< The text that will appear to the user. */ + char *default_value; /**< The default value. */ + char field_sep; /**< The field separator. */ + gboolean reverse; /**< TRUE if the separator should be found + starting a the end of the string, FALSE + otherwise */ +}; + + PurpleAccountOption * purple_account_option_new(PurplePrefType type, const char *text, const char *pref_name) diff --git a/libpurple/accountopt.h b/libpurple/accountopt.h index 85aa181149..b0b7d392ea 100644 --- a/libpurple/accountopt.h +++ b/libpurple/accountopt.h @@ -28,50 +28,15 @@ #include "prefs.h" -/** - * An option for an account. - * - * This is set by protocol plugins, and appears in the account settings - * dialogs. - */ -typedef struct -{ - PurplePrefType type; /**< The type of value. */ - - char *text; /**< The text that will appear to the user. */ - char *pref_name; /**< The name of the associated preference. */ - - union - { - gboolean boolean; /**< The default boolean value. */ - int integer; /**< The default integer value. */ - char *string; /**< The default string value. */ - GList *list; /**< The default list value. */ - - } default_value; +/**************************************************************************/ +/** Data Structures */ +/**************************************************************************/ - gboolean masked; /**< Whether the value entered should be - * obscured from view (for passwords and - * similar options) - */ -} PurpleAccountOption; +/** @copydoc _PurpleAccountOption */ +typedef struct _PurpleAccountOption PurpleAccountOption; +/** @copydoc _PurpleAccountUserSplit */ +typedef struct _PurpleAccountUserSplit PurpleAccountUserSplit; -/** - * A username split. - * - * This is used by some protocols to separate the fields of the username - * into more human-readable components. - */ -typedef struct -{ - char *text; /**< The text that will appear to the user. */ - char *default_value; /**< The default value. */ - char field_sep; /**< The field separator. */ - gboolean reverse; /**< TRUE if the separator should be found - starting a the end of the string, FALSE - otherwise */ - -} PurpleAccountUserSplit; #ifdef __cplusplus extern "C" { diff --git a/libpurple/blist.c b/libpurple/blist.c index 42343e1f01..e751febfc1 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -314,7 +314,7 @@ accountprivacy_to_xmlnode(PurpleAccount *account) node = xmlnode_new("account"); xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); xmlnode_set_attrib(node, "name", purple_account_get_username(account)); - g_snprintf(buf, sizeof(buf), "%d", account->perm_deny); + g_snprintf(buf, sizeof(buf), "%d", purple_account_get_privacy_type(account)); xmlnode_set_attrib(node, "mode", buf); for (cur = account->permit; cur; cur = cur->next) @@ -641,7 +641,7 @@ purple_blist_load() continue; imode = atoi(mode); - account->perm_deny = (imode != 0 ? imode : PURPLE_PRIVACY_ALLOW_ALL); + purple_account_set_privacy_type(account, (imode != 0 ? imode : PURPLE_PRIVACY_ALLOW_ALL)); for (x = anode->child; x; x = x->next) { char *name; @@ -956,12 +956,6 @@ purple_blist_update_node_icon(PurpleBlistNode *node) ops->update(purplebuddylist, node); } -void -purple_blist_update_buddy_icon(PurpleBuddy *buddy) -{ - purple_blist_update_node_icon((PurpleBlistNode *)buddy); -} - /* * TODO: Maybe remove the call to this from server.c and call it * from oscar.c and toc.c instead? @@ -1313,7 +1307,7 @@ void purple_blist_rename_group(PurpleGroup *source, const char *name) purple_account_remove_buddies(account, buddies, groups); g_list_free(groups); - purple_account_add_buddies(account, buddies); + purple_account_add_buddies(account, buddies, NULL); } g_list_free(buddies); @@ -1743,11 +1737,6 @@ purple_contact_get_group(const PurpleContact *contact) return (PurpleGroup *)(((PurpleBlistNode *)contact)->parent); } -void purple_contact_set_alias(PurpleContact *contact, const char *alias) -{ - purple_blist_alias_contact(contact,alias); -} - const char *purple_contact_get_alias(PurpleContact* contact) { g_return_val_if_fail(contact != NULL, NULL); @@ -1785,6 +1774,13 @@ void purple_contact_invalidate_priority_buddy(PurpleContact *contact) contact->priority_valid = FALSE; } +int purple_contact_get_contact_size(PurpleContact *contact, gboolean offline) +{ + g_return_val_if_fail(contact != NULL, 0); + + return offline ? contact->totalsize : contact->currentsize; +} + PurpleGroup *purple_group_new(const char *name) { PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); @@ -2375,26 +2371,6 @@ const char *purple_buddy_get_server_alias(PurpleBuddy *buddy) return NULL; } -const char *purple_buddy_get_local_alias(PurpleBuddy *buddy) -{ - PurpleContact *c; - - g_return_val_if_fail(buddy != NULL, NULL); - - /* Search for an alias for the buddy. In order of precedence: */ - /* The buddy alias */ - if (buddy->alias != NULL) - return buddy->alias; - - /* The contact alias */ - c = purple_buddy_get_contact(buddy); - if ((c != NULL) && (c->alias != NULL)) - return c->alias; - - /* The buddy's user name (i.e. no alias) */ - return buddy->name; -} - const char *purple_chat_get_name(PurpleChat *chat) { char *ret = NULL; diff --git a/libpurple/blist.h b/libpurple/blist.h index a053d081c6..c7f9b636c5 100644 --- a/libpurple/blist.h +++ b/libpurple/blist.h @@ -75,9 +75,6 @@ typedef enum } PurpleBlistNodeFlags; -/** - * @since 2.6.0 - */ #define PURPLE_BLIST_NODE(obj) ((PurpleBlistNode *)(obj)) #define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (purple_blist_node_get_flags((PurpleBlistNode*)(b)) & (f)) @@ -86,24 +83,12 @@ typedef enum #define PURPLE_BLIST_NODE_NAME(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CHAT_NODE ? purple_chat_get_name((PurpleChat*)n) : \ purple_blist_node_get_type(n) == PURPLE_BLIST_BUDDY_NODE ? purple_buddy_get_name((PurpleBuddy*)n) : NULL) -/** - * @since 2.6.0 - */ #define PURPLE_GROUP(obj) ((PurpleGroup *)(obj)) -/** - * @since 2.6.0 - */ #define PURPLE_CONTACT(obj) ((PurpleContact *)(obj)) -/** - * @since 2.6.0 - */ #define PURPLE_BUDDY(obj) ((PurpleBuddy *)(obj)) -/** - * @since 2.6.0 - */ #define PURPLE_CHAT(obj) ((PurpleChat *)(obj)) #include "account.h" @@ -226,8 +211,6 @@ struct _PurpleBlistUiOps * previous libpurple versions. * * @param node The node which has been modified. - * - * @since 2.6.0. */ void (*save_node)(PurpleBlistNode *node); @@ -241,7 +224,6 @@ struct _PurpleBlistUiOps * previous libpurple versions. * * @param node The node which has been modified. - * @since 2.6.0. */ void (*remove_node)(PurpleBlistNode *node); @@ -256,7 +238,6 @@ struct _PurpleBlistUiOps * * @param account The account whose data to save. If NULL, save all data * for all accounts. - * @since 2.6.0. */ void (*save_account)(PurpleAccount *account); @@ -311,7 +292,6 @@ PurpleBlistNode *purple_blist_get_root(void); * freeing the list. * * @see purple_find_buddies - * @since 2.6.0 */ GSList *purple_blist_get_buddies(void); @@ -319,8 +299,6 @@ GSList *purple_blist_get_buddies(void); * Returns the UI data for the list. * * @return The UI data for the list. - * - * @since 2.6.0 */ gpointer purple_blist_get_ui_data(void); @@ -328,8 +306,6 @@ gpointer purple_blist_get_ui_data(void); * Sets the UI data for the list. * * @param ui_data The UI data for the list. - * - * @since 2.6.0 */ void purple_blist_set_ui_data(gpointer ui_data); @@ -352,7 +328,7 @@ PurpleBlistNode *purple_blist_node_next(PurpleBlistNode *node, gboolean offline) * * @param node A node. * @return The parent node. - * @since 2.4.0 + * * @see purple_blist_node_get_first_child * @see purple_blist_node_get_sibling_next * @see purple_blist_node_get_sibling_prev @@ -365,7 +341,7 @@ PurpleBlistNode *purple_blist_node_get_parent(PurpleBlistNode *node); * * @param node A node. * @return The child node. - * @since 2.4.0 + * * @see purple_blist_node_get_parent * @see purple_blist_node_get_sibling_next * @see purple_blist_node_get_sibling_prev @@ -378,7 +354,7 @@ PurpleBlistNode *purple_blist_node_get_first_child(PurpleBlistNode *node); * * @param node A node. * @return The sibling node. - * @since 2.4.0 + * * @see purple_blist_node_get_parent * @see purple_blist_node_get_first_child * @see purple_blist_node_get_sibling_prev @@ -391,7 +367,7 @@ PurpleBlistNode *purple_blist_node_get_sibling_next(PurpleBlistNode *node); * * @param node A node. * @return The sibling node. - * @since 2.4.0 + * * @see purple_blist_node_get_parent * @see purple_blist_node_get_first_child * @see purple_blist_node_get_sibling_next @@ -404,7 +380,6 @@ PurpleBlistNode *purple_blist_node_get_sibling_prev(PurpleBlistNode *node); * * @param node The node. * @return The UI data. - * @since 2.6.0 */ gpointer purple_blist_node_get_ui_data(const PurpleBlistNode *node); @@ -413,8 +388,6 @@ gpointer purple_blist_node_get_ui_data(const PurpleBlistNode *node); * * @param node The node. * @param ui_data The UI data. - * - * @since 2.6.0 */ void purple_blist_node_set_ui_data(PurpleBlistNode *node, gpointer ui_data); @@ -454,21 +427,9 @@ void purple_blist_update_buddy_status(PurpleBuddy *buddy, PurpleStatus *old_stat * Updates a node's custom icon. * * @param node The PurpleBlistNode whose custom icon has changed. - * - * @since 2.5.0 */ void purple_blist_update_node_icon(PurpleBlistNode *node); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) -/** - * Updates a buddy's icon. - * - * @param buddy The buddy whose buddy icon has changed - * @deprecated Use purple_blist_update_node_icon() instead. - */ -void purple_blist_update_buddy_icon(PurpleBuddy *buddy); -#endif - /** * Renames a buddy in the buddy list. * @@ -623,7 +584,6 @@ PurpleBuddyIcon *purple_buddy_get_icon(const PurpleBuddy *buddy); * @return The protocol data. * * @see purple_buddy_set_protocol_data() - * @since 2.6.0 */ gpointer purple_buddy_get_protocol_data(const PurpleBuddy *buddy); @@ -636,7 +596,6 @@ gpointer purple_buddy_get_protocol_data(const PurpleBuddy *buddy); * @param data The data. * * @see purple_buddy_get_protocol_data() - * @since 2.6.0 */ void purple_buddy_set_protocol_data(PurpleBuddy *buddy, gpointer data); @@ -663,8 +622,6 @@ PurplePresence *purple_buddy_get_presence(const PurpleBuddy *buddy); * * @param buddy The buddy. * @return The media caps. - * - * @since 2.7.0 */ PurpleMediaCaps purple_buddy_get_media_caps(const PurpleBuddy *buddy); @@ -739,8 +696,6 @@ void purple_contact_destroy(PurpleContact *contact); * * @param contact The contact * @return The group - * - * @since 2.7.0 */ PurpleGroup *purple_contact_get_group(const PurpleContact *contact); @@ -774,18 +729,6 @@ void purple_blist_merge_contact(PurpleContact *source, PurpleBlistNode *node); */ PurpleBuddy *purple_contact_get_priority_buddy(PurpleContact *contact); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) -/** - * Sets the alias for a contact. - * - * @param contact The contact - * @param alias The alias to set, or NULL to unset - * - * @deprecated Use purple_blist_alias_contact() instead. - */ -void purple_contact_set_alias(PurpleContact *contact, const char *alias); -#endif - /** * Gets the alias for a contact. * @@ -812,6 +755,15 @@ gboolean purple_contact_on_account(PurpleContact *contact, PurpleAccount *accoun */ void purple_contact_invalidate_priority_buddy(PurpleContact *contact); +/** + * Determines the total size of a contact. + * + * @param contact The contact + * @param offline Count buddies in offline accounts + * @return The number of buddies in the contact + */ +int purple_contact_get_contact_size(PurpleContact *contact, gboolean offline); + /** * Removes a buddy from the buddy list and frees the memory allocated to it. * This doesn't actually try to remove the buddy from the server list. @@ -876,19 +828,6 @@ const char *purple_buddy_get_server_alias(PurpleBuddy *buddy); */ const char *purple_buddy_get_contact_alias(PurpleBuddy *buddy); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) -/** - * Returns the correct alias for this user, ignoring server aliases. Used - * when a user-recognizable name is required. In order: buddy's alias; buddy's - * contact alias; buddy's user name. - * - * @param buddy The buddy whose alias will be returned. - * @return The appropriate name or alias. - * @deprecated Try purple_buddy_get_alias(), if server aliases are okay. - */ -const char *purple_buddy_get_local_alias(PurpleBuddy *buddy); -#endif - /** * Returns the correct name to display for a buddy. In order of precedence: * the buddy's alias; the buddy's server alias; the buddy's contact alias; @@ -904,8 +843,6 @@ const char *purple_buddy_get_alias(PurpleBuddy *buddy); * * @param buddy The buddy * @return The local alias for the buddy - * - * @since 2.6.0 */ const char *purple_buddy_get_local_buddy_alias(PurpleBuddy *buddy); @@ -981,8 +918,6 @@ PurpleGroup *purple_chat_get_group(PurpleChat *chat); * @param chat The chat. * * @return The account the chat belongs to. - * - * @since 2.4.0 */ PurpleAccount *purple_chat_get_account(PurpleChat *chat); @@ -992,8 +927,6 @@ PurpleAccount *purple_chat_get_account(PurpleChat *chat); * @param chat The chat. * * @constreturn The hashtable. - * - * @since 2.4.0 */ GHashTable *purple_chat_get_components(PurpleChat *chat); @@ -1211,8 +1144,6 @@ PurpleBlistNodeFlags purple_blist_node_get_flags(PurpleBlistNode *node); * @param node The node. * * @return The type of the node. - * - * @since 2.1.0 */ PurpleBlistNodeType purple_blist_node_get_type(PurpleBlistNode *node); diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c index 26013701c9..4738000290 100644 --- a/libpurple/buddyicon.c +++ b/libpurple/buddyicon.c @@ -955,25 +955,6 @@ purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, return purple_buddy_icons_node_set_custom_icon(node, data, len); } -gboolean -purple_buddy_icons_has_custom_icon(PurpleContact *contact) -{ - return purple_buddy_icons_node_has_custom_icon((PurpleBlistNode*)contact); -} - -PurpleStoredImage * -purple_buddy_icons_find_custom_icon(PurpleContact *contact) -{ - return purple_buddy_icons_node_find_custom_icon((PurpleBlistNode*)contact); -} - -PurpleStoredImage * -purple_buddy_icons_set_custom_icon(PurpleContact *contact, guchar *icon_data, - size_t icon_len) -{ - return purple_buddy_icons_node_set_custom_icon((PurpleBlistNode*)contact, icon_data, icon_len); -} - static void delete_buddy_icon_settings(PurpleBlistNode *node, const char *setting_name) { diff --git a/libpurple/buddyicon.h b/libpurple/buddyicon.h index 7fbecbb9a8..193277e3ed 100644 --- a/libpurple/buddyicon.h +++ b/libpurple/buddyicon.h @@ -275,7 +275,6 @@ purple_buddy_icons_get_account_icon_timestamp(PurpleAccount *account); * @param node The blist node. * * @return A boolean indicating if @a node has a custom buddy icon. - * @since 2.5.0 */ gboolean purple_buddy_icons_node_has_custom_icon(PurpleBlistNode *node); @@ -293,7 +292,6 @@ purple_buddy_icons_node_has_custom_icon(PurpleBlistNode *node); * @param node The node. * * @return The custom buddy icon. - * @since 2.5.0 */ PurpleStoredImage * purple_buddy_icons_node_find_custom_icon(PurpleBlistNode *node); @@ -311,7 +309,6 @@ purple_buddy_icons_node_find_custom_icon(PurpleBlistNode *node); * * @return The icon that was set. The caller does NOT own a reference to this, * and must call purple_imgstore_ref() if it wants one. - * @since 2.5.0 */ PurpleStoredImage * purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, @@ -329,45 +326,11 @@ purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, * * @return The icon that was set. The caller does NOT own a reference to this, * and must call purple_imgstore_ref() if it wants one. - * @since 2.5.0 */ PurpleStoredImage * purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, const gchar *filename); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BUDDYICON_C_) -/** - * PurpleContact version of purple_buddy_icons_node_has_custom_icon. - * - * @copydoc purple_buddy_icons_node_has_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_has_custom_icon instead. - */ -gboolean -purple_buddy_icons_has_custom_icon(PurpleContact *contact); - -/** - * PurpleContact version of purple_buddy_icons_node_find_custom_icon. - * - * @copydoc purple_buddy_icons_node_find_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_find_custom_icon instead. - */ -PurpleStoredImage * -purple_buddy_icons_find_custom_icon(PurpleContact *contact); - -/** - * PurpleContact version of purple_buddy_icons_node_set_custom_icon. - * - * @copydoc purple_buddy_icons_node_set_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_set_custom_icon instead. - */ -PurpleStoredImage * -purple_buddy_icons_set_custom_icon(PurpleContact *contact, - guchar *icon_data, size_t icon_len); -#endif - /** * Sets whether or not buddy icon caching is enabled. * diff --git a/libpurple/certificate.c b/libpurple/certificate.c index 4453a4e059..f92a207e48 100644 --- a/libpurple/certificate.c +++ b/libpurple/certificate.c @@ -275,7 +275,7 @@ purple_certificate_signed_by(PurpleCertificate *crt, PurpleCertificate *issuer) } gboolean -purple_certificate_check_signature_chain_with_failing(GList *chain, +purple_certificate_check_signature_chain(GList *chain, PurpleCertificate **failing) { GList *cur; @@ -363,12 +363,6 @@ purple_certificate_check_signature_chain_with_failing(GList *chain, return TRUE; } -gboolean -purple_certificate_check_signature_chain(GList *chain) -{ - return purple_certificate_check_signature_chain_with_failing(chain, NULL); -} - PurpleCertificate * purple_certificate_import(PurpleCertificateScheme *scheme, const gchar *filename) { @@ -505,6 +499,24 @@ purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t return (scheme->get_times)(crt, activation, expiration); } +GByteArray * +purple_certificate_get_der_data(PurpleCertificate *crt) +{ + PurpleCertificateScheme *scheme; + GByteArray *data; + + g_return_val_if_fail(crt, NULL); + g_return_val_if_fail(crt->scheme, NULL); + + scheme = crt->scheme; + + g_return_val_if_fail(scheme->get_der_data, NULL); + + data = (scheme->get_der_data)(crt); + + return data; +} + gchar * purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id) { @@ -1622,7 +1634,7 @@ x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq, ca = purple_certificate_find_pool(x509_tls_cached.scheme_name, "ca"); /* Next, check that the certificate chain is valid */ - if (!purple_certificate_check_signature_chain_with_failing(chain, + if (!purple_certificate_check_signature_chain(chain, &failing_crt)) { gboolean chain_validated = FALSE; diff --git a/libpurple/certificate.h b/libpurple/certificate.h index 66d961770c..c13b38696d 100644 --- a/libpurple/certificate.h +++ b/libpurple/certificate.h @@ -2,7 +2,6 @@ * @file certificate.h Public-Key Certificate API * @ingroup core * @see @ref certificate-signals - * @since 2.2.0 */ /* @@ -258,9 +257,17 @@ struct _PurpleCertificateScheme */ GSList * (* import_certificates)(const gchar * filename); + /** + * Retrieves the certificate data in DER form + * + * @param crt Certificate instance + * @return Binary DER representation of certificate - must be freed using + * g_byte_array_free() + */ + GByteArray * (* get_der_data)(PurpleCertificate *crt); + void (*_purple_reserved1)(void); void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); }; /** A set of operations used to provide logic for verifying a Certificate's @@ -462,32 +469,11 @@ purple_certificate_signed_by(PurpleCertificate *crt, PurpleCertificate *issuer); * chain fails to validate, this will be set to the * certificate whose signature could not be validated. * @return TRUE if the chain is valid. See description. - * - * @since 2.6.0 - * @deprecated This function will become - * purple_certificate_check_signature_chain in 3.0.0 */ gboolean -purple_certificate_check_signature_chain_with_failing(GList *chain, +purple_certificate_check_signature_chain(GList *chain, PurpleCertificate **failing); -/** - * Check that a certificate chain is valid - * - * Uses purple_certificate_signed_by() to verify that each PurpleCertificate - * in the chain carries a valid signature from the next. A single-certificate - * chain is considered to be valid. - * - * @param chain List of PurpleCertificate instances comprising the chain, - * in the order certificate, issuer, issuer's issuer, etc. - * @return TRUE if the chain is valid. See description. - * @todo Specify which certificate in the chain caused a failure - * @deprecated This function will be removed in 3.0.0 and replaced with - * purple_certificate_check_signature_chain_with_failing - */ -gboolean -purple_certificate_check_signature_chain(GList *chain); - /** * Imports a PurpleCertificate from a file * @@ -583,6 +569,17 @@ purple_certificate_check_subject_name(PurpleCertificate *crt, const gchar *name) gboolean purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t *expiration); +/** + * Retrieves the certificate data in DER form. + * + * @param crt Certificate instance + * + * @return Binary DER representation of the certificate - must be freed using + * g_byte_array_free(). + */ +GByteArray * +purple_certificate_get_der_data(PurpleCertificate *crt); + /*@}*/ /*****************************************************************************/ diff --git a/libpurple/cmds.c b/libpurple/cmds.c index 6a495acd06..b29e4c4818 100644 --- a/libpurple/cmds.c +++ b/libpurple/cmds.c @@ -385,5 +385,10 @@ void purple_cmds_init(void) void purple_cmds_uninit(void) { purple_signals_unregister_by_instance(purple_cmds_get_handle()); + + while (cmds) { + purple_cmd_free(cmds->data); + cmds = g_list_delete_link(cmds, cmds); + } } diff --git a/libpurple/cmds.h b/libpurple/cmds.h index dec8a12e8d..87fce8090d 100644 --- a/libpurple/cmds.h +++ b/libpurple/cmds.h @@ -225,19 +225,16 @@ GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd); /** * Get the handle for the commands API * @return The handle - * @since 2.5.0 */ gpointer purple_cmds_get_handle(void); /** * Initialize the commands subsystem. - * @since 2.5.0 */ void purple_cmds_init(void); /** * Uninitialize the commands subsystem. - * @since 2.5.0 */ void purple_cmds_uninit(void); diff --git a/libpurple/connection.c b/libpurple/connection.c index 914e3b9de8..8a67a550e4 100644 --- a/libpurple/connection.c +++ b/libpurple/connection.c @@ -91,12 +91,6 @@ update_keepalive(PurpleConnection *gc, gboolean on) } } -void -purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) -{ - _purple_connection_new(account, regist, password); -} - void _purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) { @@ -171,11 +165,6 @@ _purple_connection_new(PurpleAccount *account, gboolean regist, const char *pass prpl_info->login(account); } } -void -purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) -{ - _purple_connection_new_unregister(account, password, cb, user_data); -} void _purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) @@ -233,12 +222,6 @@ _purple_connection_new_unregister(PurpleAccount *account, const char *password, prpl_info->unregister_user(account, cb, user_data); } -void -purple_connection_destroy(PurpleConnection *gc) -{ - _purple_connection_destroy(gc); -} - void _purple_connection_destroy(PurpleConnection *gc) { @@ -403,6 +386,14 @@ purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state) } } +void +purple_connection_set_flags(PurpleConnection *gc, PurpleConnectionFlags flags) +{ + g_return_if_fail(gc != NULL); + + gc->flags = flags; +} + void purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account) { @@ -436,6 +427,14 @@ purple_connection_get_state(const PurpleConnection *gc) return gc->state; } +PurpleConnectionFlags +purple_connection_get_flags(const PurpleConnection *gc) +{ + g_return_val_if_fail(gc != NULL, 0); + + return gc->flags; +} + PurpleAccount * purple_connection_get_account(const PurpleConnection *gc) { @@ -457,7 +456,7 @@ purple_connection_get_password(const PurpleConnection *gc) { g_return_val_if_fail(gc != NULL, NULL); - return gc->password ? gc->password : gc->account->password; + return gc->password ? gc->password : purple_account_get_password(gc->account); } const char * @@ -628,6 +627,13 @@ purple_connection_error_is_fatal (PurpleConnectionError reason) } } +void purple_connection_update_last_received(PurpleConnection *gc) +{ + g_return_if_fail(gc != NULL); + + gc->last_received = time(NULL); +} + void purple_connections_disconnect_all(void) { diff --git a/libpurple/connection.h b/libpurple/connection.h index 3a7f95f5c5..9ff72d4ed3 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -59,8 +59,6 @@ typedef enum /** * Possible errors that can cause a connection to be closed. - * - * @since 2.3.0 */ typedef enum { @@ -216,8 +214,6 @@ typedef struct * @param text a localized message describing the disconnection * in more detail to the user. * @see #purple_connection_error - * - * @since 2.3.0 */ void (*report_disconnect)(PurpleConnection *gc, PurpleConnectionError reason, @@ -239,7 +235,6 @@ struct _PurpleConnection PurpleAccount *account; /**< The account being connected to. */ char *password; /**< The password used. */ - int inpa; /**< The input watcher. */ GSList *buddy_chats; /**< A list of active chats (#PurpleConversation structs of type @@ -272,63 +267,6 @@ extern "C" { /**************************************************************************/ /*@{*/ -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) -/** - * This function should only be called by purple_account_connect() - * in account.c. If you're trying to sign on an account, use that - * function instead. - * - * Creates a connection to the specified account and either connects - * or attempts to register a new account. If you are logging in, - * the connection uses the current active status for this account. - * So if you want to sign on as "away," for example, you need to - * have called purple_account_set_status(account, "away"). - * (And this will call purple_account_connect() automatically). - * - * @param account The account the connection should be connecting to. - * @param regist Whether we are registering a new account or just - * trying to do a normal signon. - * @param password The password to use. - * - * @deprecated As this is internal, we should make it private in 3.0.0. - */ -void purple_connection_new(PurpleAccount *account, gboolean regist, - const char *password); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) -/** - * This function should only be called by purple_account_unregister() - * in account.c. - * - * Tries to unregister the account on the server. If the account is not - * connected, also creates a new connection. - * - * @param account The account to unregister - * @param password The password to use. - * @param cb Optional callback to be called when unregistration is complete - * @param user_data user data to pass to the callback - * - * @deprecated As this is internal, we should make it private in 3.0.0. - */ -void purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) -/** - * Disconnects and destroys a PurpleConnection. - * - * This function should only be called by purple_account_disconnect() - * in account.c. If you're trying to sign off an account, use that - * function instead. - * - * @param gc The purple connection to destroy. - * - * @deprecated As this is internal, we should make it private in 3.0.0. - */ -void purple_connection_destroy(PurpleConnection *gc); -#endif - /** * Sets the connection state. PRPLs should call this and pass in * the state #PURPLE_CONNECTED when the account is completely @@ -341,6 +279,14 @@ void purple_connection_destroy(PurpleConnection *gc); */ void purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state); +/** + * Sets the connection flags. + * + * @param gc The connection. + * @param flags The flags. + */ +void purple_connection_set_flags(PurpleConnection *gc, PurpleConnectionFlags flags); + /** * Sets the connection's account. * @@ -362,8 +308,6 @@ void purple_connection_set_display_name(PurpleConnection *gc, const char *name); * * @param connection The PurpleConnection. * @param proto_data The protocol data to set for the connection. - * - * @since 2.6.0 */ void purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data); @@ -376,6 +320,15 @@ void purple_connection_set_protocol_data(PurpleConnection *connection, void *pro */ PurpleConnectionState purple_connection_get_state(const PurpleConnection *gc); +/** + * Returns the connection flags. + * + * @param gc The connection. + * + * @return The connection flags. + */ +PurpleConnectionFlags purple_connection_get_flags(const PurpleConnection *gc); + /** * Returns TRUE if the account is connected, otherwise returns FALSE. * @@ -399,8 +352,6 @@ PurpleAccount *purple_connection_get_account(const PurpleConnection *gc); * @param gc The connection. * * @return The protocol plugin. - * - * @since 2.4.0 */ PurplePlugin * purple_connection_get_prpl(const PurpleConnection *gc); @@ -428,8 +379,6 @@ const char *purple_connection_get_display_name(const PurpleConnection *gc); * @param connection The PurpleConnection. * * @return The protocol data for the connection. - * - * @since 2.6.0 */ void *purple_connection_get_protocol_data(const PurpleConnection *connection); @@ -461,8 +410,6 @@ void purple_connection_notice(PurpleConnection *gc, const char *text); * @param gc the connection which is closing. * @param reason why the connection is closing. * @param description a non-@c NULL localized description of the error. - * - * @since 2.3.0 */ void purple_connection_error(PurpleConnection *gc, @@ -473,8 +420,6 @@ purple_connection_error(PurpleConnection *gc, * Closes a connection due to an SSL error; this is basically a shortcut to * turning the #PurpleSslErrorType into a #PurpleConnectionError and a * human-readable string and then calling purple_connection_error(). - * - * @since 2.3.0 */ void purple_connection_ssl_error (PurpleConnection *gc, @@ -497,12 +442,18 @@ purple_connection_ssl_error (PurpleConnection *gc, * * @return @c TRUE if the account should not be automatically reconnected, and * @c FALSE otherwise. - * - * @since 2.3.0 */ gboolean purple_connection_error_is_fatal (PurpleConnectionError reason); +/** + * Indicate that a packet was received on the connection. + * Set by the prpl to avoid sending unneeded keepalives. + * + * @param gc The connection. + */ +void purple_connection_update_last_received(PurpleConnection *gc); + /*@}*/ /**************************************************************************/ diff --git a/libpurple/conversation.c b/libpurple/conversation.c index 09b637aa55..b6a6058675 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -35,6 +35,131 @@ #define SEND_TYPED_TIMEOUT_SECONDS 5 +/** + * Data specific to Chats. + */ +struct _PurpleConvChat +{ + PurpleConversation *conv; /**< The parent conversation. */ + + GList *in_room; /**< The users in the room. + * @deprecated Will be removed in 3.0.0 + */ + GList *ignored; /**< Ignored users. */ + char *who; /**< The person who set the topic. */ + char *topic; /**< The topic. */ + int id; /**< The chat ID. */ + char *nick; /**< Your nick in this chat. */ + + gboolean left; /**< We left the chat and kept the window open */ + GHashTable *users; /**< Hash table of the users in the room. */ +}; + +/** + * Data specific to Instant Messages. + */ +struct _PurpleConvIm +{ + PurpleConversation *conv; /**< The parent conversation. */ + + PurpleTypingState typing_state; /**< The current typing state. */ + guint typing_timeout; /**< The typing timer handle. */ + time_t type_again; /**< The type again time. */ + guint send_typed_timeout; /**< The type again timer handle. */ + + PurpleBuddyIcon *icon; /**< The buddy icon. */ +}; + +/** + * Data for "Chat Buddies" + */ +struct _PurpleConvChatBuddy +{ + /** The chat participant's name in the chat. */ + char *name; + + /** The chat participant's alias, if known; @a NULL otherwise. */ + char *alias; + + /** + * A string by which this buddy will be sorted, or @c NULL if the + * buddy should be sorted by its @c name. (This is currently always + * @c NULL. + */ + char *alias_key; + + /** + * @a TRUE if this chat participant is on the buddy list; + * @a FALSE otherwise. + */ + gboolean buddy; + + /** + * A bitwise OR of flags for this participant, such as whether they + * are a channel operator. + */ + PurpleConvChatBuddyFlags flags; + + /** + * A hash table of attributes about the user, such as real name, + * user\@host, etc. + */ + GHashTable *attributes; + + /** The UI can put whatever it wants here. */ + gpointer ui_data; +}; + +/** + * A core representation of a conversation between two or more people. + * + * The conversation can be an IM or a chat. + */ +struct _PurpleConversation +{ + PurpleConversationType type; /**< The type of conversation. */ + + PurpleAccount *account; /**< The user using this conversation. */ + + + char *name; /**< The name of the conversation. */ + char *title; /**< The window title. */ + + gboolean logging; /**< The status of logging. */ + + GList *logs; /**< This conversation's logs */ + + union + { + PurpleConvIm *im; /**< IM-specific data. */ + PurpleConvChat *chat; /**< Chat-specific data. */ + void *misc; /**< Misc. data. */ + + } u; + + PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ + void *ui_data; /**< UI-specific data. */ + + GHashTable *data; /**< Plugin-specific data. */ + + PurpleConnectionFlags features; /**< The supported features */ + GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ +}; + +/** + * Description of a conversation message + */ +struct _PurpleConvMessage +{ + char *who; + char *what; + PurpleMessageFlags flags; + time_t when; + PurpleConversation *conv; + char *alias; +}; + + static GList *conversations = NULL; static GList *ims = NULL; static GList *chats = NULL; @@ -116,7 +241,7 @@ send_typed_cb(gpointer data) g_return_val_if_fail(conv != NULL, FALSE); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); name = purple_conversation_get_name(conv); if (gc != NULL && name != NULL) { @@ -146,7 +271,7 @@ common_send(PurpleConversation *conv, const char *message, PurpleMessageFlags ms return; account = purple_conversation_get_account(conv); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); g_return_if_fail(account != NULL); g_return_if_fail(gc != NULL); @@ -262,7 +387,7 @@ add_message_to_history(PurpleConversation *conv, const char *who, const char *al if (gc) me = purple_connection_get_display_name(gc); if (!me) - me = conv->account->username; + me = purple_account_get_username(conv->account); who = me; } @@ -381,7 +506,7 @@ purple_conversation_new(PurpleConversationType type, PurpleAccount *account, conv->data = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); /* copy features from the connection. */ - conv->features = gc->flags; + conv->features = purple_connection_get_flags(gc); if (type == PURPLE_CONV_TYPE_IM) { @@ -416,7 +541,7 @@ purple_conversation_new(PurpleConversationType type, PurpleAccount *account, chats = g_list_prepend(chats, conv); - if ((disp = purple_connection_get_display_name(account->gc))) + if ((disp = purple_connection_get_display_name(purple_account_get_connection(account)))) purple_conv_chat_set_nick(conv->u.chat, disp); else purple_conv_chat_set_nick(conv->u.chat, @@ -469,7 +594,7 @@ purple_conversation_destroy(PurpleConversation *conv) purple_request_close_with_handle(conv); ops = purple_conversation_get_ui_ops(conv); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); name = purple_conversation_get_name(conv); if (gc != NULL) @@ -694,7 +819,7 @@ purple_conversation_get_account(const PurpleConversation *conv) } PurpleConnection * -purple_conversation_get_gc(const PurpleConversation *conv) +purple_conversation_get_connection(const PurpleConversation *conv) { PurpleAccount *account; @@ -705,7 +830,7 @@ purple_conversation_get_gc(const PurpleConversation *conv) if (account == NULL) return NULL; - return account->gc; + return purple_account_get_connection(account); } void @@ -990,7 +1115,7 @@ purple_conversation_write(PurpleConversation *conv, const char *who, purple_account_get_username(account)); if (purple_account_get_alias(account) != NULL) - alias = account->alias; + alias = purple_account_get_alias(account); else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b))) alias = purple_buddy_get_contact_alias(b); else if (purple_connection_get_display_name(gc) != NULL) @@ -1378,16 +1503,6 @@ purple_conv_chat_get_conversation(const PurpleConvChat *chat) return chat->conv; } -GList * -purple_conv_chat_set_users(PurpleConvChat *chat, GList *users) -{ - g_return_val_if_fail(chat != NULL, NULL); - - chat->in_room = users; - - return users; -} - GList * purple_conv_chat_get_users(const PurpleConvChat *chat) { @@ -1544,7 +1659,7 @@ purple_conv_chat_write(PurpleConvChat *chat, const char *who, const char *messag g_return_if_fail(message != NULL); conv = purple_conv_chat_get_conversation(chat); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); account = purple_connection_get_account(gc); /* Don't display this if the person who wrote it is ignored. */ @@ -1660,7 +1775,7 @@ purple_conv_chat_add_users(PurpleConvChat *chat, GList *users, GList *extra_msgs conv = purple_conv_chat_get_conversation(chat); ops = purple_conversation_get_ui_ops(conv); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); g_return_if_fail(gc != NULL); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); g_return_if_fail(prpl_info != NULL); @@ -1687,7 +1802,7 @@ purple_conv_chat_add_users(PurpleConvChat *chat, GList *users, GList *extra_msgs } } else { PurpleBuddy *buddy; - if ((buddy = purple_find_buddy(gc->account, user)) != NULL) + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL) alias = purple_buddy_get_contact_alias(buddy); } } @@ -1761,7 +1876,7 @@ purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, conv = purple_conv_chat_get_conversation(chat); ops = purple_conversation_get_ui_ops(conv); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); g_return_if_fail(gc != NULL); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); g_return_if_fail(prpl_info != NULL); @@ -1780,12 +1895,12 @@ purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, { const char *display_name = purple_connection_get_display_name(gc); if (display_name != NULL) - alias = display_name; + new_alias = display_name; } } } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { PurpleBuddy *buddy; - if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL) + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) new_alias = purple_buddy_get_contact_alias(buddy); } @@ -1834,9 +1949,9 @@ purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { PurpleBuddy *buddy; - if ((buddy = purple_find_buddy(gc->account, old_user)) != NULL) + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), old_user)) != NULL) old_alias = purple_buddy_get_contact_alias(buddy); - if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL) + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), new_user)) != NULL) new_alias = purple_buddy_get_contact_alias(buddy); } @@ -1880,7 +1995,7 @@ purple_conv_chat_remove_users(PurpleConvChat *chat, GList *users, const char *re conv = purple_conv_chat_get_conversation(chat); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); g_return_if_fail(gc != NULL); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); g_return_if_fail(prpl_info != NULL); @@ -1911,7 +2026,7 @@ purple_conv_chat_remove_users(PurpleConvChat *chat, GList *users, const char *re if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { PurpleBuddy *buddy; - if ((buddy = purple_find_buddy(gc->account, user)) != NULL) + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), user)) != NULL) alias = purple_buddy_get_contact_alias(buddy); } @@ -2065,7 +2180,7 @@ purple_find_chat(const PurpleConnection *gc, int id) conv = (PurpleConversation *)l->data; if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)) == id && - purple_conversation_get_gc(conv) == gc) + purple_conversation_get_connection(conv) == gc) return conv; } @@ -2093,7 +2208,7 @@ invite_user_to_chat(gpointer data, PurpleRequestFields *fields) user = purple_request_fields_get_string(fields, "screenname"); message = purple_request_fields_get_string(fields, "message"); - serv_chat_invite(purple_conversation_get_gc(conv), chat->id, message, user); + serv_chat_invite(purple_conversation_get_connection(conv), chat->id, message, user); } void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, @@ -2194,14 +2309,51 @@ purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb) g_free(cb); } +void purple_conv_chat_cb_set_ui_data(PurpleConvChatBuddy *cb, gpointer ui_data) +{ + g_return_if_fail(cb != NULL); + + cb->ui_data = ui_data; +} + +gpointer purple_conv_chat_cb_get_ui_data(const PurpleConvChatBuddy *cb) +{ + g_return_val_if_fail(cb != NULL, NULL); + + return cb->ui_data; +} + const char * -purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb) +purple_conv_chat_cb_get_alias(const PurpleConvChatBuddy *cb) +{ + g_return_val_if_fail(cb != NULL, NULL); + + return cb->alias; +} + +const char * +purple_conv_chat_cb_get_name(const PurpleConvChatBuddy *cb) { g_return_val_if_fail(cb != NULL, NULL); return cb->name; } +PurpleConvChatBuddyFlags +purple_conv_chat_cb_get_flags(const PurpleConvChatBuddy *cb) +{ + g_return_val_if_fail(cb != NULL, PURPLE_CBFLAGS_NONE); + + return cb->flags; +} + +gboolean purple_conv_chat_cb_is_buddy(const PurpleConvChatBuddy *cb) +{ + g_return_val_if_fail(cb != NULL, FALSE); + + return cb->buddy; +} + const char * purple_conv_chat_cb_get_attribute(PurpleConvChatBuddy *cb, const char *key) { @@ -2299,30 +2451,57 @@ GList *purple_conversation_get_message_history(PurpleConversation *conv) return conv->message_history; } -const char *purple_conversation_message_get_sender(PurpleConvMessage *msg) +const char *purple_conversation_message_get_sender(const PurpleConvMessage *msg) { g_return_val_if_fail(msg, NULL); return msg->who; } -const char *purple_conversation_message_get_message(PurpleConvMessage *msg) +const char *purple_conversation_message_get_message(const PurpleConvMessage *msg) { g_return_val_if_fail(msg, NULL); return msg->what; } -PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg) +PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConvMessage *msg) { g_return_val_if_fail(msg, 0); return msg->flags; } -time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg) +time_t purple_conversation_message_get_timestamp(const PurpleConvMessage *msg) { g_return_val_if_fail(msg, 0); return msg->when; } +const char *purple_conversation_message_get_alias(const PurpleConvMessage *msg) +{ + g_return_val_if_fail(msg, NULL); + return msg->alias; +} + +PurpleConversation *purple_conversation_message_get_conv(const PurpleConvMessage *msg) +{ + g_return_val_if_fail(msg, NULL); + return msg->conv; +} + +void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data) +{ + g_return_if_fail(conv != NULL); + + conv->ui_data = ui_data; +} + +gpointer purple_conversation_get_ui_data(const PurpleConversation *conv) +{ + g_return_val_if_fail(conv != NULL, NULL); + + return conv->ui_data; +} + + gboolean purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **error) diff --git a/libpurple/conversation.h b/libpurple/conversation.h index e01dc19145..32e992f352 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -125,7 +125,7 @@ typedef enum PURPLE_MESSAGE_IMAGES = 0x1000, /**< Message contains images */ PURPLE_MESSAGE_NOTIFY = 0x2000, /**< Message is a notification */ PURPLE_MESSAGE_NO_LINKIFY = 0x4000, /**< Message should not be auto- - linkified @since 2.1.0 */ + linkified */ PURPLE_MESSAGE_INVISIBLE = 0x8000 /**< Message should not be displayed */ } PurpleMessageFlags; @@ -140,7 +140,7 @@ typedef enum PURPLE_CBFLAGS_OP = 0x0004, /**< Channel Op or Moderator */ PURPLE_CBFLAGS_FOUNDER = 0x0008, /**< Channel Founder */ PURPLE_CBFLAGS_TYPING = 0x0010, /**< Currently typing */ - PURPLE_CBFLAGS_AWAY = 0x0020 /**< Currently away. @since 2.8.0 */ + PURPLE_CBFLAGS_AWAY = 0x0020 /**< Currently away. */ } PurpleConvChatBuddyFlags; @@ -249,120 +249,6 @@ struct _PurpleConversationUiOps void (*_purple_reserved4)(void); }; -/** - * Data specific to Instant Messages. - */ -struct _PurpleConvIm -{ - PurpleConversation *conv; /**< The parent conversation. */ - - PurpleTypingState typing_state; /**< The current typing state. */ - guint typing_timeout; /**< The typing timer handle. */ - time_t type_again; /**< The type again time. */ - guint send_typed_timeout; /**< The type again timer handle. */ - - PurpleBuddyIcon *icon; /**< The buddy icon. */ -}; - -/** - * Data specific to Chats. - */ -struct _PurpleConvChat -{ - PurpleConversation *conv; /**< The parent conversation. */ - - GList *in_room; /**< The users in the room. - * @deprecated Will be removed in 3.0.0 - */ - GList *ignored; /**< Ignored users. */ - char *who; /**< The person who set the topic. */ - char *topic; /**< The topic. */ - int id; /**< The chat ID. */ - char *nick; /**< Your nick in this chat. */ - - gboolean left; /**< We left the chat and kept the window open */ - GHashTable *users; /**< Hash table of the users in the room. - * @since 2.9.0 - */ -}; - -/** - * Data for "Chat Buddies" - */ -struct _PurpleConvChatBuddy -{ - char *name; /**< The chat participant's name in the chat. */ - char *alias; /**< The chat participant's alias, if known; - * @a NULL otherwise. - */ - char *alias_key; /**< A string by which this buddy will be sorted, - * or @c NULL if the buddy should be sorted by - * its @c name. (This is currently always @c - * NULL.) - */ - gboolean buddy; /**< @a TRUE if this chat participant is on the - * buddy list; @a FALSE otherwise. - */ - PurpleConvChatBuddyFlags flags; /**< A bitwise OR of flags for this participant, - * such as whether they are a channel operator. - */ - GHashTable *attributes; /**< A hash table of attributes about the user, such as - * real name, user@host, etc. - */ - gpointer ui_data; /** < The UI can put whatever it wants here. */ -}; - -/** - * Description of a conversation message - * - * @since 2.2.0 - */ -struct _PurpleConvMessage -{ - char *who; - char *what; - PurpleMessageFlags flags; - time_t when; - PurpleConversation *conv; /**< @since 2.3.0 */ - char *alias; /**< @since 2.3.0 */ -}; - -/** - * A core representation of a conversation between two or more people. - * - * The conversation can be an IM or a chat. - */ -struct _PurpleConversation -{ - PurpleConversationType type; /**< The type of conversation. */ - - PurpleAccount *account; /**< The user using this conversation. */ - - - char *name; /**< The name of the conversation. */ - char *title; /**< The window title. */ - - gboolean logging; /**< The status of logging. */ - - GList *logs; /**< This conversation's logs */ - - union - { - PurpleConvIm *im; /**< IM-specific data. */ - PurpleConvChat *chat; /**< Chat-specific data. */ - void *misc; /**< Misc. data. */ - - } u; - - PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ - void *ui_data; /**< UI-specific data. */ - - GHashTable *data; /**< Plugin-specific data. */ - - PurpleConnectionFlags features; /**< The supported features */ - GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ -}; - #ifdef __cplusplus extern "C" { #endif @@ -469,13 +355,11 @@ PurpleAccount *purple_conversation_get_account(const PurpleConversation *conv); /** * Returns the specified conversation's purple_connection. * - * This is the same as purple_conversation_get_user(conv)->gc. - * * @param conv The conversation. * * @return The conversation's purple_connection. */ -PurpleConnection *purple_conversation_get_gc(const PurpleConversation *conv); +PurpleConnection *purple_conversation_get_connection(const PurpleConversation *conv); /** * Sets the specified conversation's title. @@ -744,8 +628,6 @@ void purple_conversation_foreach(void (*func)(PurpleConversation *conv)); * @return A GList of PurpleConvMessage's. The must not modify the list or the data within. * The list contains the newest message at the beginning, and the oldest message at * the end. - * - * @since 2.2.0 */ GList *purple_conversation_get_message_history(PurpleConversation *conv); @@ -753,8 +635,6 @@ GList *purple_conversation_get_message_history(PurpleConversation *conv); * Clear the message history of a conversation. * * @param conv The conversation - * - * @since 2.2.0 */ void purple_conversation_clear_message_history(PurpleConversation *conv); @@ -764,10 +644,8 @@ void purple_conversation_clear_message_history(PurpleConversation *conv); * @param msg A PurpleConvMessage * * @return The name of the sender of the message - * - * @since 2.2.0 */ -const char *purple_conversation_message_get_sender(PurpleConvMessage *msg); +const char *purple_conversation_message_get_sender(const PurpleConvMessage *msg); /** * Get the message from a PurpleConvMessage @@ -775,10 +653,8 @@ const char *purple_conversation_message_get_sender(PurpleConvMessage *msg); * @param msg A PurpleConvMessage * * @return The name of the sender of the message - * - * @since 2.2.0 */ -const char *purple_conversation_message_get_message(PurpleConvMessage *msg); +const char *purple_conversation_message_get_message(const PurpleConvMessage *msg); /** * Get the message-flags of a PurpleConvMessage @@ -786,10 +662,8 @@ const char *purple_conversation_message_get_message(PurpleConvMessage *msg); * @param msg A PurpleConvMessage * * @return The message flags - * - * @since 2.2.0 */ -PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg); +PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConvMessage *msg); /** * Get the timestamp of a PurpleConvMessage @@ -797,10 +671,45 @@ PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg) * @param msg A PurpleConvMessage * * @return The timestamp of the message + */ +time_t purple_conversation_message_get_timestamp(const PurpleConvMessage *msg); + +/** + * Get the alias from a PurpleConvMessage + * + * @param msg A PurpleConvMessage + * + * @return The alias of the sender of the message + */ +const char *purple_conversation_message_get_alias(const PurpleConvMessage *msg); + +/** + * Get the conversation associated with the PurpleConvMessage + * + * @param msg A PurpleConvMessage + * + * @return The conversation + */ +PurpleConversation *purple_conversation_message_get_conv(const PurpleConvMessage *msg); + +/** + * Set the UI data associated with this conversation. + * + * @param conv The conversation. + * @param ui_data A pointer to associate with this conversation. + */ +void purple_conversation_set_ui_data(PurpleConversation *conv, gpointer ui_data); + +/** + * Get the UI data associated with this conversation. + * + * @param conv The conversation. * - * @since 2.2.0 + * @return The UI data associated with this conversation. This is a + * convenience field provided to the UIs--it is not + * used by the libpurple core. */ -time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg); +gpointer purple_conversation_get_ui_data(const PurpleConversation *conv); /*@}*/ @@ -1060,22 +969,6 @@ void purple_conv_custom_smiley_close(PurpleConversation *conv, const char *smile */ PurpleConversation *purple_conv_chat_get_conversation(const PurpleConvChat *chat); -/** - * Sets the list of users in the chat room. - * - * @note Calling this function will not update the display of the users. - * Please use purple_conv_chat_add_user(), purple_conv_chat_add_users(), - * purple_conv_chat_remove_user(), and purple_conv_chat_remove_users() instead. - * - * @param chat The chat. - * @param users The list of users. - * - * @return The list passed. - * - * @deprecated This function will be removed in 3.0.0. You shouldn't be using it anyway. - */ -GList *purple_conv_chat_set_users(PurpleConvChat *chat, GList *users); - /** * Returns a list of users in the chat room. The members of the list * are PurpleConvChatBuddy objects. @@ -1362,8 +1255,6 @@ void purple_conv_chat_left(PurpleConvChat *chat); * @param message The message to send with the invitation. * @param confirm Prompt before sending the invitation. The user is always * prompted if either \a user or \a message is @c NULL. - * - * @since 2.6.0 */ void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, const char *message, gboolean confirm); @@ -1399,6 +1290,34 @@ PurpleConvChatBuddy *purple_conv_chat_cb_new(const char *name, const char *alias */ PurpleConvChatBuddy *purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name); +/** + * Set the UI data associated with this chat buddy. + * + * @param cb The chat buddy + * @param ui_data A pointer to associate with this chat buddy. + */ +void purple_conv_chat_cb_set_ui_data(PurpleConvChatBuddy *cb, gpointer ui_data); + +/** + * Get the UI data associated with this chat buddy. + * + * @param cb The chat buddy. + * + * @return The UI data associated with this chat buddy. This is a + * convenience field provided to the UIs--it is not + * used by the libpurple core. + */ +gpointer purple_conv_chat_cb_get_ui_data(const PurpleConvChatBuddy *conv); + +/** + * Get the alias of a chat buddy + * + * @param cb The chat buddy. + * + * @return The alias of the chat buddy. + */ +const char *purple_conv_chat_cb_get_alias(const PurpleConvChatBuddy *cb); + /** * Get the name of a chat buddy * @@ -1406,7 +1325,25 @@ PurpleConvChatBuddy *purple_conv_chat_cb_find(PurpleConvChat *chat, const char * * * @return The name of the chat buddy. */ -const char *purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb); +const char *purple_conv_chat_cb_get_name(const PurpleConvChatBuddy *cb); + +/** + * Get the flags of a chat buddy. + * + * @param cb The chat buddy. + * + * @return The flags of the chat buddy. + */ +PurpleConvChatBuddyFlags purple_conv_chat_cb_get_flags(const PurpleConvChatBuddy *cb); + +/** + * Indicates if this chat buddy is on the buddy list. + * + * @param cb The chat buddy. + * + * @return TRUE if the chat buddy is on the buddy list. + */ +gboolean purple_conv_chat_cb_is_buddy(const PurpleConvChatBuddy *cb); /** * Destroys a chat buddy @@ -1423,8 +1360,6 @@ void purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb); * @return A list of PurpleMenuAction items, harvested by the * chat-extended-menu signal. The list and the menuaction * items should be freed by the caller. - * - * @since 2.1.0 */ GList * purple_conversation_get_extended_menu(PurpleConversation *conv); @@ -1438,8 +1373,6 @@ GList * purple_conversation_get_extended_menu(PurpleConversation *conv); * message, if not @c NULL. It must be freed by the caller with g_free(). * * @return @c TRUE if the command was executed successfully, @c FALSE otherwise. - * - * @since 2.1.0 */ gboolean purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **error); diff --git a/libpurple/core.h b/libpurple/core.h index edebd94a3a..5c67e35dd6 100644 --- a/libpurple/core.h +++ b/libpurple/core.h @@ -163,8 +163,6 @@ PurpleCoreUiOps *purple_core_get_ui_ops(void); * * @return @c TRUE if this is the first instance of libpurple running; * @c FALSE if there is another instance running. - * - * @since 2.1.0 */ gboolean purple_core_ensure_single_instance(void); @@ -196,8 +194,6 @@ gboolean purple_core_ensure_single_instance(void); * @return A GHashTable with strings for keys and values. This * hash table must not be freed and should not be modified. * - * @since 2.1.0 - * */ GHashTable* purple_core_get_ui_info(void); diff --git a/libpurple/dbus-analyze-functions.py b/libpurple/dbus-analyze-functions.py index e9b7cc9d3b..32612bee61 100644 --- a/libpurple/dbus-analyze-functions.py +++ b/libpurple/dbus-analyze-functions.py @@ -29,7 +29,11 @@ excluded = [\ # Similar to the above: "purple_account_set_register_callback", "purple_account_unregister", - "purple_connection_new_unregister", + + # Similar to the above, again + "purple_menu_action_new", + "purple_menu_action_set_callback", + "purple_menu_action_get_callback", # These functions are excluded because they involve setting arbitrary # data via pointers for protocols and UIs. This just won't work. @@ -491,7 +495,7 @@ class ServerBinding (Binding): if self.function.name in stringlists: self.cdecls.append("\tchar **%s;" % name) self.ccode.append("\tlist = %s;" % self.call) - self.ccode.append("\t%s = (char **)purple_%s_to_array(list, FALSE, &%s_LEN);" % \ + self.ccode.append("\t%s = (char **)purple_%s_to_array(list, &%s_LEN);" % \ (name, type[0], name)) self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &%s, %s_LEN" \ % (name, name)) @@ -503,7 +507,7 @@ class ServerBinding (Binding): else: self.cdecls.append("\tdbus_int32_t *%s;" % name) self.ccode.append("\tlist = %s;" % self.call) - self.ccode.append("\t%s = purple_dbusify_%s(list, FALSE, &%s_LEN);" % \ + self.ccode.append("\t%s = purple_dbusify_%s(list, &%s_LEN);" % \ (name, type[0], name)) if (not (self.function.name in constlists)): self.ccode.append("\tg_%s_free(list);" % type[0].lower()[1:]) diff --git a/libpurple/dbus-bindings.h b/libpurple/dbus-bindings.h index 5611ae58a7..1d6f95875e 100644 --- a/libpurple/dbus-bindings.h +++ b/libpurple/dbus-bindings.h @@ -84,14 +84,10 @@ purple_dbus_message_iter_get_args_valist (DBusMessageIter *iter, int first_arg_type, va_list var_args); -dbus_int32_t* purple_dbusify_GList(GList *list, gboolean free_memory, - dbus_int32_t *len); -dbus_int32_t* purple_dbusify_GSList(GSList *list, gboolean free_memory, - dbus_int32_t *len); -gpointer* purple_GList_to_array(GList *list, gboolean free_memory, - dbus_int32_t *len); -gpointer* purple_GSList_to_array(GSList *list, gboolean free_memory, - dbus_int32_t *len); +dbus_int32_t* purple_dbusify_GList(GList *list, dbus_int32_t *len); +dbus_int32_t* purple_dbusify_GSList(GSList *list, dbus_int32_t *len); +gpointer* purple_GList_to_array(GList *list, dbus_int32_t *len); +gpointer* purple_GSList_to_array(GSList *list, dbus_int32_t *len); GHashTable *purple_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error); const char* empty_to_null(const char *str); diff --git a/libpurple/dbus-server.c b/libpurple/dbus-server.c index 86b8f5e122..72efc57107 100644 --- a/libpurple/dbus-server.c +++ b/libpurple/dbus-server.c @@ -300,7 +300,7 @@ null_to_empty(const char *s) } dbus_int32_t * -purple_dbusify_GList(GList *list, gboolean free_memory, dbus_int32_t *len) +purple_dbusify_GList(GList *list, dbus_int32_t *len) { dbus_int32_t *array; int i; @@ -311,14 +311,11 @@ purple_dbusify_GList(GList *list, gboolean free_memory, dbus_int32_t *len) for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) array[i] = purple_dbus_pointer_to_id(elem->data); - if (free_memory) - g_list_free(list); - return array; } dbus_int32_t * -purple_dbusify_GSList(GSList *list, gboolean free_memory, dbus_int32_t *len) +purple_dbusify_GSList(GSList *list, dbus_int32_t *len) { dbus_int32_t *array; int i; @@ -329,14 +326,11 @@ purple_dbusify_GSList(GSList *list, gboolean free_memory, dbus_int32_t *len) for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) array[i] = purple_dbus_pointer_to_id(elem->data); - if (free_memory) - g_slist_free(list); - return array; } gpointer * -purple_GList_to_array(GList *list, gboolean free_memory, dbus_int32_t *len) +purple_GList_to_array(GList *list, dbus_int32_t *len) { gpointer *array; int i; @@ -347,14 +341,11 @@ purple_GList_to_array(GList *list, gboolean free_memory, dbus_int32_t *len) for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) array[i] = elem->data; - if (free_memory) - g_list_free(list); - return array; } gpointer * -purple_GSList_to_array(GSList *list, gboolean free_memory, dbus_int32_t *len) +purple_GSList_to_array(GSList *list, dbus_int32_t *len) { gpointer *array; int i; @@ -365,9 +356,6 @@ purple_GSList_to_array(GSList *list, gboolean free_memory, dbus_int32_t *len) for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) array[i] = elem->data; - if (free_memory) - g_slist_free(list); - return array; } @@ -711,7 +699,7 @@ purple_dbus_message_append_purple_values(DBusMessageIter *iter, g_return_val_if_fail(ptr, TRUE); } - switch (purple_values[i]->type) + switch (purple_value_get_type(purple_values[i])) { case PURPLE_TYPE_INT: case PURPLE_TYPE_ENUM: diff --git a/libpurple/dbus-server.h b/libpurple/dbus-server.h index 5215dccbae..5810dab8c7 100644 --- a/libpurple/dbus-server.h +++ b/libpurple/dbus-server.h @@ -173,8 +173,6 @@ void *purple_dbus_get_handle(void); /** * Determines whether this instance owns the DBus service name - * - * @since 2.1.0 */ gboolean purple_dbus_is_owner(void); diff --git a/libpurple/dbus-useful.c b/libpurple/dbus-useful.c index b288887b1f..4a685fc88f 100644 --- a/libpurple/dbus-useful.c +++ b/libpurple/dbus-useful.c @@ -25,7 +25,7 @@ purple_accounts_find_ext(const char *name, const char *protocol_id, if (who && strcmp(purple_normalize(NULL, purple_account_get_username(account)), who)) continue; - if (protocol_id && strcmp(account->protocol_id, protocol_id)) + if (protocol_id && strcmp(purple_account_get_protocol_id(account), protocol_id)) continue; if (account_test && !account_test(account)) diff --git a/libpurple/debug.c b/libpurple/debug.c index ca17f62bde..095d90bb49 100644 --- a/libpurple/debug.c +++ b/libpurple/debug.c @@ -224,12 +224,5 @@ purple_debug_init(void) purple_debug_set_verbose(TRUE); purple_prefs_add_none("/purple/debug"); - - /* - * This pref is obsolete and no longer referenced anywhere. It only - * survives here because it would be an API break if we removed it. - * Remove this when we get to 3.0.0 :) - */ - purple_prefs_add_bool("/purple/debug/timestamps", TRUE); } diff --git a/libpurple/debug.h b/libpurple/debug.h index b90b86b99c..475df9f335 100644 --- a/libpurple/debug.h +++ b/libpurple/debug.h @@ -161,8 +161,6 @@ gboolean purple_debug_is_enabled(void); * plugins. * * @param verbose TRUE to enable verbose debugging or FALSE to disable it. - * - * @since 2.6.0 */ void purple_debug_set_verbose(gboolean verbose); @@ -170,8 +168,6 @@ void purple_debug_set_verbose(gboolean verbose); * Check if verbose logging is enabled. * * @return TRUE if verbose debugging is enabled, FALSE if it is not. - * - * @since 2.6.0 */ gboolean purple_debug_is_verbose(void); @@ -183,8 +179,6 @@ gboolean purple_debug_is_verbose(void); * @param unsafe TRUE to enable debug logging of messages that could * potentially contain passwords and other sensitive information. * FALSE to disable it. - * - * @since 2.6.0 */ void purple_debug_set_unsafe(gboolean unsafe); @@ -194,8 +188,6 @@ void purple_debug_set_unsafe(gboolean unsafe); * @return TRUE if the debug logging of all messages is enabled, FALSE * if messages that could potentially contain passwords and other * sensitive information are not logged. - * - * @since 2.6.0 */ gboolean purple_debug_is_unsafe(void); diff --git a/libpurple/dnsquery.c b/libpurple/dnsquery.c index 18246bc56b..bb98db553d 100644 --- a/libpurple/dnsquery.c +++ b/libpurple/dnsquery.c @@ -297,6 +297,10 @@ purple_dnsquery_resolver_run(int child_out, int child_in, gboolean show_debug) } rc = read(child_in, &dns_params, sizeof(dns_params_t)); if (rc < 0) { + if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { + /* Try again */ + continue; + } fprintf(stderr, "dns[%d]: Error: Could not read dns_params: " "%s\n", getpid(), strerror(errno)); break; @@ -910,7 +914,7 @@ initiate_resolving(gpointer data) } PurpleDnsQueryData * -purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port, +purple_dnsquery_a(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data) { PurpleDnsQueryData *query_data; @@ -940,13 +944,6 @@ purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port return query_data; } -PurpleDnsQueryData * -purple_dnsquery_a(const char *hostname, int port, - PurpleDnsQueryConnectFunction callback, gpointer data) -{ - return purple_dnsquery_a_account(NULL, hostname, port, callback, data); -} - void purple_dnsquery_destroy(PurpleDnsQueryData *query_data) { diff --git a/libpurple/dnsquery.h b/libpurple/dnsquery.h index dde19983f6..84183f4383 100644 --- a/libpurple/dnsquery.h +++ b/libpurple/dnsquery.h @@ -88,7 +88,7 @@ extern "C" { /** * Perform an asynchronous DNS query. * - * @param account the account that the query is being done for (or NULL) + * @param account The account that the query is being done for (or NULL) * @param hostname The hostname to resolve. * @param port A port number which is stored in the struct sockaddr. * @param callback The callback function to call after resolving. @@ -98,27 +98,8 @@ extern "C" { * a data structure that can be used to cancel the pending * DNS query, if needed. * - * @since 2.8.0 */ -PurpleDnsQueryData *purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSQUERY_C_) -/** - * Perform an asynchronous DNS query. - * - * @param hostname The hostname to resolve. - * @param port A port number which is stored in the struct sockaddr. - * @param callback The callback function to call after resolving. - * @param data Extra data to pass to the callback function. - * - * @return NULL if there was an error, otherwise return a reference to - * a data structure that can be used to cancel the pending - * DNS query, if needed. - * - * @deprecated Use purple_dnsquery_a_account instead - */ -PurpleDnsQueryData *purple_dnsquery_a(const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data); -#endif +PurpleDnsQueryData *purple_dnsquery_a(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data); /** * Cancel a DNS query and destroy the associated data structure. diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c index 5befb1f342..f72117ae6b 100644 --- a/libpurple/dnssrv.c +++ b/libpurple/dnssrv.c @@ -725,15 +725,7 @@ res_thread(gpointer data) #endif PurpleSrvTxtQueryData * -purple_srv_resolve(const char *protocol, const char *transport, - const char *domain, PurpleSrvCallback cb, gpointer extradata) -{ - return purple_srv_resolve_account(NULL, protocol, transport, domain, - cb, extradata); -} - -PurpleSrvTxtQueryData * -purple_srv_resolve_account(PurpleAccount *account, const char *protocol, +purple_srv_resolve(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata) { @@ -869,13 +861,7 @@ purple_srv_resolve_account(PurpleAccount *account, const char *protocol, #endif } -PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, - const char *domain, PurpleTxtCallback cb, gpointer extradata) -{ - return purple_txt_resolve_account(NULL, owner, domain, cb, extradata); -} - -PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, +PurpleSrvTxtQueryData *purple_txt_resolve(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata) { @@ -1006,18 +992,6 @@ PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, #endif } -void -purple_txt_cancel(PurpleSrvTxtQueryData *query_data) -{ - purple_srv_txt_query_destroy(query_data); -} - -void -purple_srv_cancel(PurpleSrvTxtQueryData *query_data) -{ - purple_srv_txt_query_destroy(query_data); -} - const gchar * purple_txt_response_get_content(PurpleTxtResponse *resp) { diff --git a/libpurple/dnssrv.h b/libpurple/dnssrv.h index 1f2005d800..c0eb194c41 100644 --- a/libpurple/dnssrv.h +++ b/libpurple/dnssrv.h @@ -70,7 +70,7 @@ typedef struct /** Called just before @a query_data is freed; this should cancel any * further use of @a query_data the UI would make. Unneeded if - * #resolve_host is not implemented. + * #resolve is not implemented. */ void (*destroy)(PurpleSrvTxtQueryData *query_data); @@ -99,86 +99,40 @@ typedef void (*PurpleTxtCallback)(GList *responses, gpointer data); /** * Queries an SRV record. * - * @param account the account that the query is being done for (or NULL) - * @param protocol Name of the protocol (e.g. "sip") + * @param account The account that the query is being done for (or NULL) + * @param protocol Name of the protocol (e.g. "sip") * @param transport Name of the transport ("tcp" or "udp") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results + * @param domain Domain name to query (e.g. "blubb.com") + * @param cb A callback which will be called with the results * @param extradata Extra data to be passed to the callback * - * @since 2.8.0 + * @return NULL if there was an error, otherwise return a reference to + * a data structure that can be used to cancel the pending + * DNS query, if needed. */ -PurpleSrvTxtQueryData *purple_srv_resolve_account(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); +PurpleSrvTxtQueryData *purple_srv_resolve(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_) -/** - * Queries an SRV record. - * - * @param protocol Name of the protocol (e.g. "sip") - * @param transport Name of the transport ("tcp" or "udp") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results - * @param extradata Extra data to be passed to the callback - * - * @deprecated Use purple_srv_resolve_account instead - */ -PurpleSrvTxtQueryData *purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); -#endif - -/** - * Cancel an SRV or DNS query. - * - * @param query_data The request to cancel. - * - * @deprecated Use purple_srv_txt_query_destroy instead - */ -void purple_srv_cancel(PurpleSrvTxtQueryData *query_data); - -/** - * Queries an TXT record. - * - * @param account the account that the query is being done for (or NULL) - * @param owner Name of the protocol (e.g. "_xmppconnect") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results - * @param extradata Extra data to be passed to the callback - * - * @since 2.8.0 - */ -PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_) /** * Queries an TXT record. * - * @param owner Name of the protocol (e.g. "_xmppconnect") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results + * @param account The account that the query is being done for (or NULL) + * @param owner Name of the protocol (e.g. "_xmppconnect") + * @param domain Domain name to query (e.g. "blubb.com") + * @param cb A callback which will be called with the results * @param extradata Extra data to be passed to the callback * - * @deprecated Use purple_txt_resolve_account instead - * - * @since 2.6.0 + * @return NULL if there was an error, otherwise return a reference to + * a data structure that can be used to cancel the pending + * DNS query, if needed. */ -PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); -#endif - -/** - * Cancel an TXT DNS query. - * - * @param query_data The request to cancel. - * @since 2.6.0 - * - * @deprecated Use purple_srv_txt_query_destroy instead - */ -void purple_txt_cancel(PurpleSrvTxtQueryData *query_data); +PurpleSrvTxtQueryData *purple_txt_resolve(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); /** * Get the value of the current TXT record. * * @param response The TXT response record - * @returns The value of the current TXT record. - * @since 2.6.0 + * + * @return The value of the current TXT record. */ const gchar *purple_txt_response_get_content(PurpleTxtResponse *response); @@ -186,7 +140,6 @@ const gchar *purple_txt_response_get_content(PurpleTxtResponse *response); * Destroy a TXT DNS response object. * * @param response The PurpleTxtResponse to destroy. - * @since 2.6.0 */ void purple_txt_response_destroy(PurpleTxtResponse *response); @@ -216,7 +169,7 @@ void purple_srv_txt_query_set_ui_ops(PurpleSrvTxtQueryUiOps *ops); PurpleSrvTxtQueryUiOps *purple_srv_txt_query_get_ui_ops(void); /** - * Get the query from a PurpleDnsQueryData + * Get the query from a PurpleSrvTxtQueryData * * @param query_data The SRV/TXT query * @return The query. @@ -224,7 +177,7 @@ PurpleSrvTxtQueryUiOps *purple_srv_txt_query_get_ui_ops(void); char *purple_srv_txt_query_get_query(PurpleSrvTxtQueryData *query_data); /** - * Get the type from a PurpleDnsQueryData (TXT or SRV) + * Get the type from a PurpleSrvTxtQueryData (TXT or SRV) * * @param query_data The query * @return The query. @@ -236,3 +189,4 @@ int purple_srv_txt_query_get_type(PurpleSrvTxtQueryData *query_data); #endif #endif /* _PURPLE_DNSSRV_H */ + diff --git a/libpurple/eventloop.h b/libpurple/eventloop.h index ca95f6cbe8..76448492ce 100644 --- a/libpurple/eventloop.h +++ b/libpurple/eventloop.h @@ -145,7 +145,6 @@ struct _PurpleEventLoopUiOps * #timeout_add. * * @see purple_timeout_add_seconds() - * @since 2.1.0 **/ guint (*timeout_add_seconds)(guint interval, GSourceFunc function, gpointer data); @@ -192,8 +191,6 @@ guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data); * @param data data to pass to @a function. * @return A handle to the timer which can be passed to * purple_timeout_remove() to remove the timer. - * - * @since 2.1.0 */ guint purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data); diff --git a/libpurple/example/nullclient.c b/libpurple/example/nullclient.c index 31fc0a230f..113fcf8e2e 100644 --- a/libpurple/example/nullclient.c +++ b/libpurple/example/nullclient.c @@ -237,7 +237,7 @@ static void signed_on(PurpleConnection *gc, gpointer null) { PurpleAccount *account = purple_connection_get_account(gc); - printf("Account connected: %s %s\n", account->username, account->protocol_id); + printf("Account connected: %s %s\n", purple_account_get_username(account), purple_account_get_protocol_id(account)); } static void diff --git a/libpurple/ft.c b/libpurple/ft.c index 598a7c2cf3..a7a3e09967 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -220,7 +220,7 @@ purple_xfer_unref(PurpleXfer *xfer) purple_xfer_destroy(xfer); } -static void +void purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatusType status) { g_return_if_fail(xfer != NULL); @@ -490,7 +490,7 @@ static void purple_xfer_ask_recv(PurpleXfer *xfer) { char *buf, *size_buf; - size_t size; + goffset size; gconstpointer thumb; gsize thumb_size; @@ -720,6 +720,20 @@ purple_xfer_request_denied(PurpleXfer *xfer) purple_xfer_unref(xfer); } +int purple_xfer_get_fd(PurpleXfer *xfer) +{ + g_return_val_if_fail(xfer != NULL, 0); + + return xfer->fd; +} + +int purple_xfer_get_watcher(PurpleXfer *xfer) +{ + g_return_val_if_fail(xfer != NULL, 0); + + return xfer->watcher; +} + PurpleXferType purple_xfer_get_type(const PurpleXfer *xfer) { @@ -751,9 +765,8 @@ purple_xfer_get_status(const PurpleXfer *xfer) return xfer->status; } -/* FIXME: Rename with cancelled for 3.0.0. */ gboolean -purple_xfer_is_canceled(const PurpleXfer *xfer) +purple_xfer_is_cancelled(const PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, TRUE); @@ -788,7 +801,7 @@ purple_xfer_get_local_filename(const PurpleXfer *xfer) return xfer->local_filename; } -size_t +goffset purple_xfer_get_bytes_sent(const PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, 0); @@ -796,7 +809,7 @@ purple_xfer_get_bytes_sent(const PurpleXfer *xfer) return xfer->bytes_sent; } -size_t +goffset purple_xfer_get_bytes_remaining(const PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, 0); @@ -804,7 +817,7 @@ purple_xfer_get_bytes_remaining(const PurpleXfer *xfer) return xfer->bytes_remaining; } -size_t +goffset purple_xfer_get_size(const PurpleXfer *xfer) { g_return_val_if_fail(xfer != NULL, 0); @@ -864,6 +877,20 @@ purple_xfer_get_end_time(const PurpleXfer *xfer) return xfer->end_time; } +void purple_xfer_set_fd(PurpleXfer *xfer, int fd) +{ + g_return_if_fail(xfer != NULL); + + xfer->fd = fd; +} + +void purple_xfer_set_watcher(PurpleXfer *xfer, int watcher) +{ + g_return_if_fail(xfer != NULL); + + xfer->watcher = watcher; +} + void purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed) { @@ -938,7 +965,7 @@ purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename) } void -purple_xfer_set_size(PurpleXfer *xfer, size_t size) +purple_xfer_set_size(PurpleXfer *xfer, goffset size) { g_return_if_fail(xfer != NULL); @@ -947,7 +974,15 @@ purple_xfer_set_size(PurpleXfer *xfer, size_t size) } void -purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent) +purple_xfer_set_local_port(PurpleXfer *xfer, unsigned int local_port) +{ + g_return_if_fail(xfer != NULL); + + xfer->local_port = local_port; +} + +void +purple_xfer_set_bytes_sent(PurpleXfer *xfer, goffset bytes_sent) { g_return_if_fail(xfer != NULL); @@ -1404,13 +1439,6 @@ purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip, purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_STARTED); - /* - * FIXME 3.0.0 -- there's too much broken code depending on fd == 0 - * meaning "don't use a real fd" - */ - if (fd == 0) - fd = -1; - if (type == PURPLE_XFER_RECEIVE) { cond = PURPLE_INPUT_READ; @@ -1701,6 +1729,37 @@ purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats) } } +void +purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data) +{ + g_return_if_fail(xfer != NULL); + + xfer->proto_data = proto_data; +} + +gpointer +purple_xfer_get_protocol_data(const PurpleXfer *xfer) +{ + g_return_val_if_fail(xfer != NULL, NULL); + + return xfer->proto_data; +} + +void purple_xfer_set_ui_data(PurpleXfer *xfer, gpointer ui_data) +{ + g_return_if_fail(xfer != NULL); + + xfer->ui_data = ui_data; +} + +gpointer purple_xfer_get_ui_data(const PurpleXfer *xfer) +{ + g_return_val_if_fail(xfer != NULL, NULL); + + return xfer->ui_data; +} + + /************************************************************************** * File Transfer Subsystem API **************************************************************************/ diff --git a/libpurple/ft.h b/libpurple/ft.h index 3636cae247..8f18877d5c 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -87,7 +87,6 @@ typedef struct * * @return size if the write was successful, or a value between 0 and * size on error. - * @since 2.6.0 */ gssize (*ui_write)(PurpleXfer *xfer, const guchar *buffer, gssize size); @@ -102,7 +101,6 @@ typedef struct * @returns The amount of data in the buffer, 0 if nothing is available, * and a negative value if an error occurred and the transfer * should be cancelled (libpurple will cancel). - * @since 2.6.0 */ gssize (*ui_read)(PurpleXfer *xfer, guchar **buffer, gssize size); @@ -115,8 +113,6 @@ typedef struct * @param xfer The file transfer structure * @param buffer A pointer to the beginning of the unwritten data. * @param size The amount of unwritten data. - * - * @since 2.6.0 */ void (*data_not_sent)(PurpleXfer *xfer, const guchar *buffer, gsize size); @@ -144,7 +140,7 @@ struct _PurpleXfer char *message; /**< A message sent with the request */ char *filename; /**< The name sent over the network. */ char *local_filename; /**< The name on the local hard drive. */ - size_t size; /**< The size of the file. */ + goffset size; /**< The size of the file. */ FILE *dest_fp; /**< The destination file pointer. */ @@ -155,8 +151,8 @@ struct _PurpleXfer int fd; /**< The socket file descriptor. */ int watcher; /**< Watcher. */ - size_t bytes_sent; /**< The number of bytes sent. */ - size_t bytes_remaining; /**< The number of bytes remaining. */ + goffset bytes_sent; /**< The number of bytes sent. */ + goffset bytes_remaining; /**< The number of bytes remaining. */ time_t start_time; /**< When the transfer of data began. */ time_t end_time; /**< When the transfer of data ended. */ @@ -185,7 +181,7 @@ struct _PurpleXfer PurpleXferUiOps *ui_ops; /**< UI-specific operations. */ void *ui_data; /**< UI-specific data. */ - void *data; /**< prpl-specific data. */ + void *proto_data; /**< prpl-specific data. */ }; #ifdef __cplusplus @@ -265,6 +261,24 @@ void purple_xfer_request_accepted(PurpleXfer *xfer, const char *filename); */ void purple_xfer_request_denied(PurpleXfer *xfer); +/** + * Returns the socket file descriptor. + * + * @param xfer The file transfer. + * + * @return The socket file descriptor. + */ +int purple_xfer_get_fd(PurpleXfer *xfer); + +/** + * Returns the Watcher for the transfer. + * + * @param xfer The file transfer. + * + * @return The watcher. + */ +int purple_xfer_get_watcher(PurpleXfer *xfer); + /** * Returns the type of file transfer. * @@ -289,8 +303,6 @@ PurpleAccount *purple_xfer_get_account(const PurpleXfer *xfer); * @param xfer The file transfer. * * @return The name of the remote user. - * - * @since 2.1.0 */ const char *purple_xfer_get_remote_user(const PurpleXfer *xfer); @@ -309,9 +321,8 @@ PurpleXferStatusType purple_xfer_get_status(const PurpleXfer *xfer); * @param xfer The file transfer. * * @return Whether or not the transfer was cancelled. - * FIXME: This should be renamed using cancelled for 3.0.0. */ -gboolean purple_xfer_is_canceled(const PurpleXfer *xfer); +gboolean purple_xfer_is_cancelled(const PurpleXfer *xfer); /** * Returns the completed state for a file transfer. @@ -347,7 +358,7 @@ const char *purple_xfer_get_local_filename(const PurpleXfer *xfer); * * @return The number of bytes sent. */ -size_t purple_xfer_get_bytes_sent(const PurpleXfer *xfer); +goffset purple_xfer_get_bytes_sent(const PurpleXfer *xfer); /** * Returns the number of bytes remaining to send or receive. @@ -356,7 +367,7 @@ size_t purple_xfer_get_bytes_sent(const PurpleXfer *xfer); * * @return The number of bytes remaining. */ -size_t purple_xfer_get_bytes_remaining(const PurpleXfer *xfer); +goffset purple_xfer_get_bytes_remaining(const PurpleXfer *xfer); /** * Returns the size of the file being sent or received. @@ -365,7 +376,7 @@ size_t purple_xfer_get_bytes_remaining(const PurpleXfer *xfer); * * @return The total size of the file. */ -size_t purple_xfer_get_size(const PurpleXfer *xfer); +goffset purple_xfer_get_size(const PurpleXfer *xfer); /** * Returns the current percentage of progress of the transfer. @@ -411,7 +422,6 @@ unsigned int purple_xfer_get_remote_port(const PurpleXfer *xfer); * @param xfer The file transfer. * * @return The time when the transfer started. - * @since 2.4.0 */ time_t purple_xfer_get_start_time(const PurpleXfer *xfer); @@ -421,10 +431,25 @@ time_t purple_xfer_get_start_time(const PurpleXfer *xfer); * @param xfer The file transfer. * * @return The time when the transfer ended. - * @since 2.4.0 */ time_t purple_xfer_get_end_time(const PurpleXfer *xfer); +/** + * Sets the socket file descriptor. + * + * @param xfer The file transfer. + * @param fd The file descriptor. + */ +void purple_xfer_set_fd(PurpleXfer *xfer, int fd); + +/** + * Sets the watcher for the file transfer. + * + * @param xfer The file transfer. + * @param watcher The watcher. + */ +void purple_xfer_set_watcher(PurpleXfer *xfer, int watcher); + /** * Sets the completed state for the file transfer. * @@ -433,6 +458,14 @@ time_t purple_xfer_get_end_time(const PurpleXfer *xfer); */ void purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed); +/** + * Sets the current status for the file transfer. + * + * @param xfer The file transfer. + * @param status The current status. + */ +void purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatusType status); + /** * Sets the filename for the file transfer. * @@ -463,7 +496,15 @@ void purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename); * @param xfer The file transfer. * @param size The size of the file. */ -void purple_xfer_set_size(PurpleXfer *xfer, size_t size); +void purple_xfer_set_size(PurpleXfer *xfer, goffset size); + +/** + * Sets the local port of the file transfer. + * + * @param xfer The file transfer. + * @param local_port The local port. + */ +void purple_xfer_set_local_port(PurpleXfer *xfer, unsigned int local_port); /** * Sets the current working position in the active file transfer. This @@ -478,7 +519,7 @@ void purple_xfer_set_size(PurpleXfer *xfer, size_t size); * send. If we're receiving a file, this is the * next byte that we expect to receive. */ -void purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent); +void purple_xfer_set_bytes_sent(PurpleXfer *xfer, goffset bytes_sent); /** * Returns the UI operations structure for a file transfer. @@ -596,11 +637,8 @@ gssize purple_xfer_write(PurpleXfer *xfer, const guchar *buffer, gsize size); * file receive transfer. On send, @a fd must be specified, and * @a ip and @a port are ignored. * - * Prior to libpurple 2.6.0, passing '0' to @a fd was special-cased to - * allow the protocol plugin to facilitate the file transfer itself. As of - * 2.6.0, this is supported (for backward compatibility), but will be - * removed in libpurple 3.0.0. If a prpl detects that the running libpurple - * is running 2.6.0 or higher, it should use the invalid fd '-1'. + * Passing @a fd as '-1' is a special-case and indicates to the + * protocol plugin to facilitate the file transfer itself. * * @param xfer The file transfer. * @param fd The file descriptor for the socket. @@ -677,8 +715,6 @@ void purple_xfer_conversation_write(PurpleXfer *xfer, char *message, gboolean is * read/write/data_not_sent UI ops. * * @param xfer The file transfer which is ready. - * - * @since 2.6.0 */ void purple_xfer_ui_ready(PurpleXfer *xfer); @@ -688,8 +724,6 @@ void purple_xfer_ui_ready(PurpleXfer *xfer); * ops and cannot/does not provide a raw fd to the core. * * @param xfer The file transfer which is ready. - * - * @since 2.6.0 */ void purple_xfer_prpl_ready(PurpleXfer *xfer); @@ -700,7 +734,6 @@ void purple_xfer_prpl_ready(PurpleXfer *xfer); * @param len If not @c NULL, the length of the thumbnail data returned * will be set in the location pointed to by this. * @return The thumbnail data, or NULL if there is no thumbnail - * @since 2.7.0 */ gconstpointer purple_xfer_get_thumbnail(const PurpleXfer *xfer, gsize *len); @@ -709,7 +742,6 @@ gconstpointer purple_xfer_get_thumbnail(const PurpleXfer *xfer, gsize *len); * * @param xfer The file transfer to get the mimetype for * @return The mimetype of the thumbnail, or @c NULL if not thumbnail is set - * @since 2.7.0 */ const gchar *purple_xfer_get_thumbnail_mimetype(const PurpleXfer *xfer); @@ -721,7 +753,6 @@ const gchar *purple_xfer_get_thumbnail_mimetype(const PurpleXfer *xfer); * @param thumbnail A pointer to the thumbnail data, this will be copied * @param size The size in bytes of the passed in thumbnail data * @param mimetype The mimetype of the generated thumbnail - * @since 2.7.0 */ void purple_xfer_set_thumbnail(PurpleXfer *xfer, gconstpointer thumbnail, gsize size, const gchar *mimetype); @@ -733,10 +764,44 @@ void purple_xfer_set_thumbnail(PurpleXfer *xfer, gconstpointer thumbnail, * @param xfer The file transfer to create a thumbnail for * @param formats A comma-separated list of mimetypes for image formats * the protocols can use for thumbnails. - * @since 2.7.0 */ void purple_xfer_prepare_thumbnail(PurpleXfer *xfer, const gchar *formats); +/** + * Sets the protocol data for a file transfer. + * + * @param xfer The file transfer. + * @param proto_data The protocol data to set for the file transfer. + */ +void purple_xfer_set_protocol_data(PurpleXfer *xfer, gpointer proto_data); + +/** + * Gets the protocol data for a file transfer. + * + * @param xfer The file transfer. + * + * @return The protocol data for the file transfer. + */ +gpointer purple_xfer_get_protocol_data(const PurpleXfer *xfer); + +/** + * Set the UI data associated with this file transfer. + * + * @param xfer The file transfer. + * @param ui_data A pointer to associate with this file transfer. + */ +void purple_xfer_set_ui_data(PurpleXfer *xfer, gpointer ui_data); + +/** + * Get the UI data associated with this file transfer. + * + * @param xfer The file transfer. + * + * @return The UI data associated with this file transfer. This is a + * convenience field provided to the UIs--it is not + * used by the libpurple core. + */ +gpointer purple_xfer_get_ui_data(const PurpleXfer *xfer); /*@}*/ @@ -783,3 +848,4 @@ PurpleXferUiOps *purple_xfers_get_ui_ops(void); #endif #endif /* _PURPLE_FT_H_ */ + diff --git a/libpurple/imgstore.h b/libpurple/imgstore.h index cd29bc6f5d..f647bf32e8 100644 --- a/libpurple/imgstore.h +++ b/libpurple/imgstore.h @@ -68,7 +68,6 @@ purple_imgstore_add(gpointer data, size_t size, const char *filename); * @param path The path to the image. * * @return The stored image. - * @since 2.X.X */ PurpleStoredImage * purple_imgstore_new_from_file(const char *path); diff --git a/libpurple/log.c b/libpurple/log.c index 41a1890fcf..22a2933f78 100644 --- a/libpurple/log.c +++ b/libpurple/log.c @@ -1103,7 +1103,7 @@ static void log_get_log_sets_common(GHashTable *sets) /* Find the account for username in the list of accounts for protocol. */ username_unescaped = purple_unescape_filename(username); for (account_iter = g_list_first(accounts) ; account_iter != NULL ; account_iter = account_iter->next) { - if (purple_strequal(((PurpleAccount *)account_iter->data)->username, username_unescaped)) { + if (purple_strequal(purple_account_get_username((PurpleAccount *)account_iter->data), username_unescaped)) { account = account_iter->data; break; } diff --git a/libpurple/log.h b/libpurple/log.h index 59249b5162..e57e9f7487 100644 --- a/libpurple/log.h +++ b/libpurple/log.h @@ -301,8 +301,6 @@ int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccoun * @param name The name of the log * @param account The account * @return The activity score - * - * @since 2.6.0 */ int purple_log_get_activity_score(PurpleLogType type, const char *name, PurpleAccount *account); diff --git a/libpurple/media-gst.h b/libpurple/media-gst.h index 91d9986d8a..32d2b3c9d2 100644 --- a/libpurple/media-gst.h +++ b/libpurple/media-gst.h @@ -81,8 +81,6 @@ extern "C" { * Gets the element type's GType. * * @return The element type's GType. - * - * @since 2.6.0 */ GType purple_media_element_type_get_type(void); @@ -90,8 +88,6 @@ GType purple_media_element_type_get_type(void); * Gets the element info's GType. * * @return The element info's GType. - * - * @since 2.6.0 */ GType purple_media_element_info_get_type(void); @@ -102,8 +98,6 @@ GType purple_media_element_info_get_type(void); * @param sess_id The session id of the session to get the source from. * * @return The source retrieved. - * - * @since 2.6.0 */ GstElement *purple_media_get_src(PurpleMedia *media, const gchar *sess_id); @@ -115,8 +109,6 @@ GstElement *purple_media_get_src(PurpleMedia *media, const gchar *sess_id); * @param participant Optionally, the participant of the stream to get the tee from. * * @return The GstTee element from the chosen session/stream. - * - * @since 2.6.0 */ GstElement *purple_media_get_tee(PurpleMedia *media, const gchar *session_id, const gchar *participant); @@ -128,8 +120,6 @@ GstElement *purple_media_get_tee(PurpleMedia *media, * @param manager The media manager to get the pipeline from. * * @return The pipeline. - * - * @since 2.6.0 */ GstElement *purple_media_manager_get_pipeline(PurpleMediaManager *manager); @@ -141,8 +131,6 @@ GstElement *purple_media_manager_get_pipeline(PurpleMediaManager *manager); * @param media The media call this element is requested for. * @param session_id The id of the session this element is requested for or NULL. * @param participant The remote user this element is requested for or NULL. - * - * @since 2.6.0 */ GstElement *purple_media_manager_get_element(PurpleMediaManager *manager, PurpleMediaSessionType type, PurpleMedia *media, @@ -167,8 +155,6 @@ PurpleMediaElementInfo *purple_media_manager_get_active_element( * * @param manager The media manager to set the media formats. * @param caps Set of allowed media formats. - * - * @since 2.8.0 */ void purple_media_manager_set_video_caps(PurpleMediaManager *manager, GstCaps *caps); @@ -179,8 +165,6 @@ void purple_media_manager_set_video_caps(PurpleMediaManager *manager, * @param manager The media manager to get the media formats from. * * @return @c GstCaps limiting the video source's formats. - * - * @since 2.8.0 */ GstCaps *purple_media_manager_get_video_caps(PurpleMediaManager *manager); diff --git a/libpurple/media.h b/libpurple/media.h index b001b7511c..ce23a98587 100644 --- a/libpurple/media.h +++ b/libpurple/media.h @@ -57,8 +57,6 @@ extern "C" { * Gets the media class's GType * * @return The media class's GType. - * - * @since 2.6.0 */ GType purple_media_get_type(void); @@ -68,8 +66,6 @@ GType purple_media_get_type(void); * @param media The media session from which to retrieve session IDs. * * @return GList of session IDs. The caller must free the list. - * - * @since 2.6.0 */ GList *purple_media_get_session_ids(PurpleMedia *media); @@ -79,8 +75,6 @@ GList *purple_media_get_session_ids(PurpleMedia *media); * @param media The media session to retrieve the account from. * * @return The account retrieved. - * - * @since 2.6.0 */ PurpleAccount *purple_media_get_account(PurpleMedia *media); @@ -90,8 +84,6 @@ PurpleAccount *purple_media_get_account(PurpleMedia *media); * @param media The media session to retrieve the prpl data from. * * @return The prpl data retrieved. - * - * @since 2.6.0 */ gpointer purple_media_get_prpl_data(PurpleMedia *media); @@ -100,8 +92,6 @@ gpointer purple_media_get_prpl_data(PurpleMedia *media); * * @param media The media session to set the prpl data on. * @param prpl_data The data to set on the media session. - * - * @since 2.6.0 */ void purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data); @@ -111,8 +101,6 @@ void purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data); * @param media The media object to set the state on. * @param error The format of the error message to send in the signal. * @param ... The arguments to plug into the format. - * - * @since 2.6.0 */ void purple_media_error(PurpleMedia *media, const gchar *error, ...); @@ -122,8 +110,6 @@ void purple_media_error(PurpleMedia *media, const gchar *error, ...); * @param media The media object with which to end streams. * @param session_id The session to end streams on. * @param participant The participant to end streams with. - * - * @since 2.6.0 */ void purple_media_end(PurpleMedia *media, const gchar *session_id, const gchar *participant); @@ -136,8 +122,6 @@ void purple_media_end(PurpleMedia *media, const gchar *session_id, * @param session_id The id of the session of the stream being signaled. * @param participant The participant of the stream being signaled. * @param local TRUE if the info originated locally, FALSE if on the remote end. - * - * @since 2.6.0 */ void purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type, const gchar *session_id, const gchar *participant, @@ -158,8 +142,6 @@ void purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type, * @param media The media object to set the parameters on. * @param num_params The number of parameters to pass * @param params Array of @c GParameter to pass - * - * @since 2.8.0 */ void purple_media_set_params(PurpleMedia *media, guint num_params, GParameter *params); @@ -172,8 +154,6 @@ void purple_media_set_params(PurpleMedia *media, * @param media The media object * * @return NULL-terminated array of names of supported parameters. - * - * @since 2.8.0 */ const gchar **purple_media_get_available_params(PurpleMedia *media); @@ -184,8 +164,6 @@ const gchar **purple_media_get_available_params(PurpleMedia *media); * @param param name of parameter * * @return @c TRUE if backend recognizes the parameter, @c FALSE otherwise. - * - * @since 2.8.0 */ gboolean purple_media_param_is_supported(PurpleMedia *media, const gchar *param); @@ -205,8 +183,6 @@ gboolean purple_media_param_is_supported(PurpleMedia *media, const gchar *param) * @param params The parameters to pass to Farsight. * * @return @c TRUE The stream was added successfully, @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who, PurpleMediaSessionType type, @@ -220,8 +196,6 @@ gboolean purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, * @param sess_id The session id of the session to get the type from. * * @return The retreived session type. - * - * @since 2.6.0 */ PurpleMediaSessionType purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id); @@ -231,8 +205,6 @@ PurpleMediaSessionType purple_media_get_session_type(PurpleMedia *media, const g * @param media The media object to get the manager instance from. * * @return The PurpleMediaManager instance retrieved. - * - * @since 2.6.0 */ struct _PurpleMediaManager *purple_media_get_manager(PurpleMedia *media); @@ -243,8 +215,6 @@ struct _PurpleMediaManager *purple_media_get_manager(PurpleMedia *media); * @param sess_id The session id of the session to get the codecs from. * * @return The retreieved codecs. - * - * @since 2.6.0 */ GList *purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id); @@ -255,8 +225,6 @@ GList *purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id); * @param sess_id The session id of the session find the stream in. * @param participant The name of the remote user to add the candidates for. * @param remote_candidates The remote candidates to add. - * - * @since 2.6.0 */ void purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id, @@ -269,8 +237,6 @@ void purple_media_add_remote_candidates(PurpleMedia *media, * @param media The media object to find the session in. * @param sess_id The session id of the session to find the stream in. * @param participant The name of the remote user to get the candidates from. - * - * @since 2.6.0 */ GList *purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, @@ -285,8 +251,6 @@ GList *purple_media_get_local_candidates(PurpleMedia *media, * from. * * @return The active candidates retrieved. - * - * @since 2.8.0 */ GList *purple_media_get_active_local_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *participant); @@ -300,8 +264,6 @@ GList *purple_media_get_active_local_candidates(PurpleMedia *media, * from. * * @return The remote candidates retrieved. - * - * @since 2.8.0 */ GList *purple_media_get_active_remote_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *participant); @@ -315,8 +277,6 @@ GList *purple_media_get_active_remote_candidates(PurpleMedia *media, * @param codecs The list of remote codecs to set. * * @return @c TRUE The codecs were set successfully, or @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, const gchar *participant, GList *codecs); @@ -329,8 +289,6 @@ gboolean purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id * @param participant The remote user to check for. * * @return @c TRUE All streams for the given session_id/participant combination have candidates prepared, @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_candidates_prepared(PurpleMedia *media, const gchar *session_id, const gchar *participant); @@ -343,8 +301,6 @@ gboolean purple_media_candidates_prepared(PurpleMedia *media, * @param codec The codec to set the session to stream. * * @return @c TRUE The codec was successfully changed, or @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec); @@ -355,8 +311,6 @@ gboolean purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, P * @param sess_id The session id of the session to check. * * @return @c TRUE The codecs are ready, or @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id); @@ -368,8 +322,6 @@ gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id); * @param participant The participant of the stream to check. * * @return TRUE if the local user is the stream's initator, else FALSE. - * - * @since 2.6.0 */ gboolean purple_media_is_initiator(PurpleMedia *media, const gchar *sess_id, const gchar *participant); @@ -382,8 +334,6 @@ gboolean purple_media_is_initiator(PurpleMedia *media, * @param participant The participant to check. * * @return @c TRUE The selected streams have been accepted, or @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_media_accepted(PurpleMedia *media, const gchar *sess_id, const gchar *participant); @@ -394,8 +344,6 @@ gboolean purple_media_accepted(PurpleMedia *media, const gchar *sess_id, * @param media The media object the sessions are in. * @param session_id The session to select (if any). * @param level The level to set the volume to. - * - * @since 2.6.0 */ void purple_media_set_input_volume(PurpleMedia *media, const gchar *session_id, double level); @@ -406,8 +354,6 @@ void purple_media_set_input_volume(PurpleMedia *media, const gchar *session_id, * @param session_id The session to limit the streams to (if any). * @param participant The participant to limit the streams to (if any). * @param level The level to set the volume to. - * - * @since 2.6.0 */ void purple_media_set_output_volume(PurpleMedia *media, const gchar *session_id, const gchar *participant, double level); @@ -421,8 +367,6 @@ void purple_media_set_output_volume(PurpleMedia *media, const gchar *session_id, * @param window_id The window id use for embedding the video in. * * @return An id to reference the output window. - * - * @since 2.6.0 */ gulong purple_media_set_output_window(PurpleMedia *media, const gchar *session_id, const gchar *participant, @@ -432,8 +376,6 @@ gulong purple_media_set_output_window(PurpleMedia *media, * Removes all output windows from a given media session. * * @param media The instance to remove all output windows from. - * - * @since 2.6.0 */ void purple_media_remove_output_windows(PurpleMedia *media); diff --git a/libpurple/media/backend-fs2.h b/libpurple/media/backend-fs2.h index 47fb02dac5..e79f84db47 100644 --- a/libpurple/media/backend-fs2.h +++ b/libpurple/media/backend-fs2.h @@ -50,8 +50,6 @@ typedef struct _PurpleMediaBackendFs2 PurpleMediaBackendFs2; * Gets the type of the Farsight 2 media backend object. * * @return The Farsight 2 media backend's GType - * - * @since 2.7.0 */ GType purple_media_backend_fs2_get_type(void); diff --git a/libpurple/media/backend-iface.h b/libpurple/media/backend-iface.h index 94105fbaca..a0c96a6fed 100644 --- a/libpurple/media/backend-iface.h +++ b/libpurple/media/backend-iface.h @@ -77,8 +77,6 @@ struct _PurpleMediaBackendIface * Gets the media backend's GType. * * @return The media backend's GType. - * - * @since 2.7.0 */ GType purple_media_backend_get_type(void); @@ -95,8 +93,6 @@ GType purple_media_backend_get_type(void); * @param params The additional parameters to pass when creating the stream. * * @return True if the stream was successfully created, othewise False. - * - * @since 2.7.0 */ gboolean purple_media_backend_add_stream(PurpleMediaBackend *self, const gchar *sess_id, const gchar *who, @@ -111,8 +107,6 @@ gboolean purple_media_backend_add_stream(PurpleMediaBackend *self, * @param sess_id The session id associated with the stream. * @param participant The participant associated with the stream. * @param remote_candidates The list of remote candidates to add. - * - * @since 2.7.0 */ void purple_media_backend_add_remote_candidates(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, @@ -128,8 +122,6 @@ void purple_media_backend_add_remote_candidates(PurpleMediaBackend *self, * @param sess_id The session id of the session to check. * * @return True if the codecs are ready, otherwise False. - * - * @since 2.7.0 */ gboolean purple_media_backend_codecs_ready(PurpleMediaBackend *self, const gchar *sess_id); @@ -144,8 +136,6 @@ gboolean purple_media_backend_codecs_ready(PurpleMediaBackend *self, * @param sess_id The session id of the session to use. * * @return The codec intersection list. - * - * @since 2.7.0 */ GList *purple_media_backend_get_codecs(PurpleMediaBackend *self, const gchar *sess_id); @@ -158,8 +148,6 @@ GList *purple_media_backend_get_codecs(PurpleMediaBackend *self, * @param particilant The participant associated with the stream. * * @return The list of local candidates. - * - * @since 2.7.0 */ GList *purple_media_backend_get_local_candidates(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant); @@ -173,8 +161,6 @@ GList *purple_media_backend_get_local_candidates(PurpleMediaBackend *self, * @param codecs The list of remote codecs to set. * * @return True if the remote codecs were set successfully, otherwise False. - * - * @since 2.7.0 */ gboolean purple_media_backend_set_remote_codecs(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, @@ -188,8 +174,6 @@ gboolean purple_media_backend_set_remote_codecs(PurpleMediaBackend *self, * @param codec The codec to set. * * @return True if set successfully, otherwise False. - * - * @since 2.7.0 */ gboolean purple_media_backend_set_send_codec(PurpleMediaBackend *self, const gchar *sess_id, PurpleMediaCodec *codec); @@ -200,8 +184,6 @@ gboolean purple_media_backend_set_send_codec(PurpleMediaBackend *self, * @param self The media backend to set the parameters on. * @param num_params The number of parameters to pass to backend * @param params Array of @c GParameter to pass to backend - * - * @since 2.8.0 */ void purple_media_backend_set_params(PurpleMediaBackend *self, guint num_params, GParameter *params); @@ -214,8 +196,6 @@ void purple_media_backend_set_params(PurpleMediaBackend *self, * @param self The media backend * * @return NULL-terminated array of names of supported parameters. - * - * @since 2.8.0 */ const gchar **purple_media_backend_get_available_params(PurpleMediaBackend *self); diff --git a/libpurple/media/candidate.h b/libpurple/media/candidate.h index 1dfa0fd05e..85a103bf05 100644 --- a/libpurple/media/candidate.h +++ b/libpurple/media/candidate.h @@ -47,8 +47,6 @@ typedef struct _PurpleMediaCandidate PurpleMediaCandidate; * Gets the type of the media candidate structure. * * @return The media canditate's GType - * - * @since 2.6.0 */ GType purple_media_candidate_get_type(void); @@ -63,8 +61,6 @@ GType purple_media_candidate_get_type(void); * @param port The network port. * * @return The newly created PurpleMediaCandidate instance. - * - * @since 2.6.0 */ PurpleMediaCandidate *purple_media_candidate_new( const gchar *foundation, guint component_id, @@ -78,8 +74,6 @@ PurpleMediaCandidate *purple_media_candidate_new( * @param candidate The candidate to copy. * * @return The copy of the PurpleMediaCandidate. - * - * @since 2.7.0 */ PurpleMediaCandidate *purple_media_candidate_copy( PurpleMediaCandidate *candidate); @@ -90,8 +84,6 @@ PurpleMediaCandidate *purple_media_candidate_copy( * @param candidates The list of candidates to be copied. * * @return The copy of the GList. - * - * @since 2.6.0 */ GList *purple_media_candidate_list_copy(GList *candidates); @@ -99,8 +91,6 @@ GList *purple_media_candidate_list_copy(GList *candidates); * Frees a GList of PurpleMediaCandidate and its contents. * * @param candidates The list of candidates to be freed. - * - * @since 2.6.0 */ void purple_media_candidate_list_free(GList *candidates); @@ -110,8 +100,6 @@ void purple_media_candidate_list_free(GList *candidates); * @param candidate The candidate to get the foundation from. * * @return The foundation. - * - * @since 2.6.0 */ gchar *purple_media_candidate_get_foundation(PurpleMediaCandidate *candidate); @@ -121,8 +109,6 @@ gchar *purple_media_candidate_get_foundation(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the compnent id from. * * @return The component id. - * - * @since 2.6.0 */ guint purple_media_candidate_get_component_id(PurpleMediaCandidate *candidate); @@ -132,8 +118,6 @@ guint purple_media_candidate_get_component_id(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the IP address from. * * @return The IP address. - * - * @since 2.6.0 */ gchar *purple_media_candidate_get_ip(PurpleMediaCandidate *candidate); @@ -143,8 +127,6 @@ gchar *purple_media_candidate_get_ip(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the port from. * * @return The port. - * - * @since 2.6.0 */ guint16 purple_media_candidate_get_port(PurpleMediaCandidate *candidate); @@ -156,8 +138,6 @@ guint16 purple_media_candidate_get_port(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the base IP address from. * * @return The base IP address. - * - * @since 2.6.0 */ gchar *purple_media_candidate_get_base_ip(PurpleMediaCandidate *candidate); @@ -169,8 +149,6 @@ gchar *purple_media_candidate_get_base_ip(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the base port. * * @return The base port. - * - * @since 2.6.0 */ guint16 purple_media_candidate_get_base_port(PurpleMediaCandidate *candidate); @@ -180,8 +158,6 @@ guint16 purple_media_candidate_get_base_port(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the protocol from. * * @return The protocol. - * - * @since 2.6.0 */ PurpleMediaNetworkProtocol purple_media_candidate_get_protocol( PurpleMediaCandidate *candidate); @@ -192,8 +168,6 @@ PurpleMediaNetworkProtocol purple_media_candidate_get_protocol( * @param candidate The candidate to get the priority from. * * @return The priority. - * - * @since 2.6.0 */ guint32 purple_media_candidate_get_priority(PurpleMediaCandidate *candidate); @@ -203,8 +177,6 @@ guint32 purple_media_candidate_get_priority(PurpleMediaCandidate *candidate); * @param candidate The candidate to get the candidate type from. * * @return The candidate type. - * - * @since 2.6.0 */ PurpleMediaCandidateType purple_media_candidate_get_candidate_type( PurpleMediaCandidate *candidate); @@ -217,8 +189,6 @@ PurpleMediaCandidateType purple_media_candidate_get_candidate_type( * @param The candidate to get the username from. * * @return The username. - * - * @since 2.6.0 */ gchar *purple_media_candidate_get_username(PurpleMediaCandidate *candidate); @@ -230,8 +200,6 @@ gchar *purple_media_candidate_get_username(PurpleMediaCandidate *candidate); * @param The candidate to get the password from. * * @return The password. - * - * @since 2.6.0 */ gchar *purple_media_candidate_get_password(PurpleMediaCandidate *candidate); @@ -241,8 +209,6 @@ gchar *purple_media_candidate_get_password(PurpleMediaCandidate *candidate); * @param The candidate to get the TTL from. * * @return The TTL. - * - * @since 2.6.0 */ guint purple_media_candidate_get_ttl(PurpleMediaCandidate *candidate); diff --git a/libpurple/media/codec.h b/libpurple/media/codec.h index 46a4ee194e..5bdcdd4f15 100644 --- a/libpurple/media/codec.h +++ b/libpurple/media/codec.h @@ -50,8 +50,6 @@ G_BEGIN_DECLS * Gets the type of the media codec structure. * * @return The media codec's GType - * - * @since 2.6.0 */ GType purple_media_codec_get_type(void); @@ -64,8 +62,6 @@ GType purple_media_codec_get_type(void); * @param clock_rate The clock rate this codec encodes at, if applicable. * * @return The newly created PurpleMediaCodec. - * - * @since 2.6.0 */ PurpleMediaCodec *purple_media_codec_new(int id, const char *encoding_name, PurpleMediaSessionType media_type, guint clock_rate); @@ -76,8 +72,6 @@ PurpleMediaCodec *purple_media_codec_new(int id, const char *encoding_name, * @param The codec to get the id from. * * @return The codec id. - * - * @since 2.6.0 */ guint purple_media_codec_get_id(PurpleMediaCodec *codec); @@ -87,8 +81,6 @@ guint purple_media_codec_get_id(PurpleMediaCodec *codec); * @param The codec to get the encoding name from. * * @return The encoding name. - * - * @since 2.6.0 */ gchar *purple_media_codec_get_encoding_name(PurpleMediaCodec *codec); @@ -98,8 +90,6 @@ gchar *purple_media_codec_get_encoding_name(PurpleMediaCodec *codec); * @param The codec to get the clock rate from. * * @return The clock rate. - * - * @since 2.6.0 */ guint purple_media_codec_get_clock_rate(PurpleMediaCodec *codec); @@ -109,8 +99,6 @@ guint purple_media_codec_get_clock_rate(PurpleMediaCodec *codec); * @param The codec to get the number of channels from. * * @return The number of channels. - * - * @since 2.6.0 */ guint purple_media_codec_get_channels(PurpleMediaCodec *codec); @@ -123,8 +111,6 @@ guint purple_media_codec_get_channels(PurpleMediaCodec *codec); * * @return The list of optional parameters. The list is owned by the codec and * should not be freed. - * - * @since 2.6.0 */ GList *purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec); @@ -134,8 +120,6 @@ GList *purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec); * @param codec The codec to add the parameter to. * @param name The name of the parameter to add. * @param value The value of the parameter to add. - * - * @since 2.6.0 */ void purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, const gchar *name, const gchar *value); @@ -145,8 +129,6 @@ void purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, * * @param codec The codec to remove the parameter from. * @param param A pointer to the parameter to remove. - * - * @since 2.6.0 */ void purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec, PurpleKeyValuePair *param); @@ -159,8 +141,6 @@ void purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec, * @param value The value to search for or NULL. * * @return The value found or NULL. - * - * @since 2.6.0 */ PurpleKeyValuePair *purple_media_codec_get_optional_parameter( PurpleMediaCodec *codec, const gchar *name, @@ -172,8 +152,6 @@ PurpleKeyValuePair *purple_media_codec_get_optional_parameter( * @param codec The codec to copy. * * @return The copy of the codec. - * - * @since 2.7.0 */ PurpleMediaCodec *purple_media_codec_copy(PurpleMediaCodec *codec); @@ -183,8 +161,6 @@ PurpleMediaCodec *purple_media_codec_copy(PurpleMediaCodec *codec); * @param codecs The list of codecs to be copied. * * @return The copy of the GList. - * - * @since 2.6.0 */ GList *purple_media_codec_list_copy(GList *codecs); @@ -192,8 +168,6 @@ GList *purple_media_codec_list_copy(GList *codecs); * Frees a GList of PurpleMediaCodec and its contents. * * @param codecs The list of codecs to be freed. - * - * @since 2.6.0 */ void purple_media_codec_list_free(GList *codecs); @@ -203,8 +177,6 @@ void purple_media_codec_list_free(GList *codecs); * @param codec The codec to create the string of. * * @return The new string representation. - * - * @since 2.6.0 */ gchar *purple_media_codec_to_string(const PurpleMediaCodec *codec); diff --git a/libpurple/media/enum-types.h b/libpurple/media/enum-types.h index dd163d56ab..5e23e11e05 100644 --- a/libpurple/media/enum-types.h +++ b/libpurple/media/enum-types.h @@ -107,8 +107,6 @@ typedef enum { * Gets the media candidate type's GType * * @return The media candidate type's GType. - * - * @since 2.6.0 */ GType purple_media_candidate_type_get_type(void); @@ -116,8 +114,6 @@ GType purple_media_candidate_type_get_type(void); * Gets the type of the media caps flags * * @return The media caps flags' GType - * - * @since 2.7.0 */ GType purple_media_caps_get_type(void); @@ -125,8 +121,6 @@ GType purple_media_caps_get_type(void); * Gets the type of the info type enum * * @return The info type enum's GType - * - * @since 2.6.0 */ GType purple_media_info_type_get_type(void); @@ -134,8 +128,6 @@ GType purple_media_info_type_get_type(void); * Gets the media network protocol's GType * * @return The media network protocol's GType. - * - * @since 2.6.0 */ GType purple_media_network_protocol_get_type(void); @@ -143,8 +135,6 @@ GType purple_media_network_protocol_get_type(void); * Gets the media session type's GType * * @return The media session type's GType. - * - * @since 2.6.0 */ GType purple_media_session_type_get_type(void); @@ -152,8 +142,6 @@ GType purple_media_session_type_get_type(void); * Gets the type of the state-changed enum * * @return The state-changed enum's GType - * - * @since 2.6.0 */ GType purple_media_state_changed_get_type(void); diff --git a/libpurple/mediamanager.h b/libpurple/mediamanager.h index d9f54ad543..099972a4ac 100644 --- a/libpurple/mediamanager.h +++ b/libpurple/mediamanager.h @@ -60,8 +60,6 @@ extern "C" { * Gets the media manager's GType. * * @return The media manager's GType. - * - * @since 2.6.0 */ GType purple_media_manager_get_type(void); @@ -69,8 +67,6 @@ GType purple_media_manager_get_type(void); * Gets the "global" media manager object. It's created if it doesn't already exist. * * @return The "global" instance of the media manager object. - * - * @since 2.6.0 */ PurpleMediaManager *purple_media_manager_get(void); @@ -84,8 +80,6 @@ PurpleMediaManager *purple_media_manager_get(void); * @param initiator TRUE if the local user is the initiator of this media call, FALSE otherwise. * * @return A newly created media session. - * - * @since 2.6.0 */ PurpleMedia *purple_media_manager_create_media(PurpleMediaManager *manager, PurpleAccount *account, @@ -99,8 +93,6 @@ PurpleMedia *purple_media_manager_create_media(PurpleMediaManager *manager, * @param manager The media manager to get all of the sessions from. * * @return A list of all the media sessions. - * - * @since 2.6.0 */ GList *purple_media_manager_get_media(PurpleMediaManager *manager); @@ -111,8 +103,6 @@ GList *purple_media_manager_get_media(PurpleMediaManager *manager); * @param account The account the sessions are on. * * @return A list of the media sessions on the given account. - * - * @since 2.6.0 */ GList *purple_media_manager_get_media_by_account( PurpleMediaManager *manager, PurpleAccount *account); @@ -122,8 +112,6 @@ GList *purple_media_manager_get_media_by_account( * * @param manager The media manager to remove the media session from. * @param media The media session to remove. - * - * @since 2.6.0 */ void purple_media_manager_remove_media(PurpleMediaManager *manager, @@ -140,8 +128,6 @@ purple_media_manager_remove_media(PurpleMediaManager *manager, * @param participant The participant the output windows are registered with. * * @return TRUE if it succeeded, FALSE if it failed. - * - * @since 2.6.0 */ gboolean purple_media_manager_create_output_window( PurpleMediaManager *manager, PurpleMedia *media, @@ -157,8 +143,6 @@ gboolean purple_media_manager_create_output_window( * @param window_id The window ID to embed the video in. * * @return A unique ID to the registered output window, 0 if it failed. - * - * @since 2.6.0 */ gulong purple_media_manager_set_output_window(PurpleMediaManager *manager, PurpleMedia *media, const gchar *session_id, @@ -171,8 +155,6 @@ gulong purple_media_manager_set_output_window(PurpleMediaManager *manager, * @param output_window_id The ID of the output window. * * @return TRUE if it found the output window and was successful, else FALSE. - * - * @since 2.6.0 */ gboolean purple_media_manager_remove_output_window( PurpleMediaManager *manager, gulong output_window_id); @@ -184,8 +166,6 @@ gboolean purple_media_manager_remove_output_window( * @param media The media instance the output windows were registered for. * @param session_id The session the output windows were registered for. * @param participant The participant the output windows were registered for. - * - * @since 2.6.0 */ void purple_media_manager_remove_output_windows( PurpleMediaManager *manager, PurpleMedia *media, @@ -196,8 +176,6 @@ void purple_media_manager_remove_output_windows( * * @param manager The manager to set the caps on. * @param caps The caps to set. - * - * @since 2.6.0 */ void purple_media_manager_set_ui_caps(PurpleMediaManager *manager, PurpleMediaCaps caps); @@ -208,8 +186,6 @@ void purple_media_manager_set_ui_caps(PurpleMediaManager *manager, * @param manager The manager to get caps from. * * @return caps The caps retrieved. - * - * @since 2.6.0 */ PurpleMediaCaps purple_media_manager_get_ui_caps(PurpleMediaManager *manager); @@ -218,8 +194,6 @@ PurpleMediaCaps purple_media_manager_get_ui_caps(PurpleMediaManager *manager); * * @param manager The manager to set the caps on. * @param backend_type The media backend type to use. - * - * @since 2.7.0 */ void purple_media_manager_set_backend_type(PurpleMediaManager *manager, GType backend_type); @@ -230,8 +204,6 @@ void purple_media_manager_set_backend_type(PurpleMediaManager *manager, * @param manager The manager to get the media backend type from. * * @return The type of media backend type media objects will use. - * - * @since 2.7.0 */ GType purple_media_manager_get_backend_type(PurpleMediaManager *manager); diff --git a/libpurple/network.c b/libpurple/network.c index 54e8b38361..f0e4508477 100644 --- a/libpurple/network.c +++ b/libpurple/network.c @@ -391,14 +391,9 @@ purple_network_finish_pmp_map_cb(gpointer data) return FALSE; } -static gboolean listen_map_external = TRUE; -void purple_network_listen_map_external(gboolean map_external) -{ - listen_map_external = map_external; -} - static PurpleNetworkListenData * -purple_network_do_listen(unsigned short port, int socket_family, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data) +purple_network_do_listen(unsigned short port, int socket_family, int socket_type, gboolean map_external, + PurpleNetworkListenCallback cb, gpointer cb_data) { int listenfd = -1; int flags; @@ -503,7 +498,7 @@ purple_network_do_listen(unsigned short port, int socket_family, int socket_type listen_data->cb_data = cb_data; listen_data->socket_type = socket_type; - if (!purple_socket_speaks_ipv4(listenfd) || !listen_map_external || + if (!purple_socket_speaks_ipv4(listenfd) || !map_external || !purple_prefs_get_bool("/purple/network/map_ports")) { purple_debug_info("network", "Skipping external port mapping.\n"); @@ -531,27 +526,19 @@ purple_network_do_listen(unsigned short port, int socket_family, int socket_type } PurpleNetworkListenData * -purple_network_listen_family(unsigned short port, int socket_family, - int socket_type, PurpleNetworkListenCallback cb, +purple_network_listen(unsigned short port, int socket_family, int socket_type, + gboolean map_external, PurpleNetworkListenCallback cb, gpointer cb_data) { g_return_val_if_fail(port != 0, NULL); - return purple_network_do_listen(port, socket_family, socket_type, + return purple_network_do_listen(port, socket_family, socket_type, map_external, cb, cb_data); } PurpleNetworkListenData * -purple_network_listen(unsigned short port, int socket_type, - PurpleNetworkListenCallback cb, gpointer cb_data) -{ - return purple_network_listen_family(port, AF_UNSPEC, socket_type, - cb, cb_data); -} - -PurpleNetworkListenData * -purple_network_listen_range_family(unsigned short start, unsigned short end, - int socket_family, int socket_type, +purple_network_listen_range(unsigned short start, unsigned short end, + int socket_family, int socket_type, gboolean map_external, PurpleNetworkListenCallback cb, gpointer cb_data) { @@ -566,7 +553,7 @@ purple_network_listen_range_family(unsigned short start, unsigned short end, } for (; start <= end; start++) { - ret = purple_network_do_listen(start, AF_UNSPEC, socket_type, cb, cb_data); + ret = purple_network_do_listen(start, AF_UNSPEC, socket_type, map_external, cb, cb_data); if (ret != NULL) break; } @@ -574,15 +561,6 @@ purple_network_listen_range_family(unsigned short start, unsigned short end, return ret; } -PurpleNetworkListenData * -purple_network_listen_range(unsigned short start, unsigned short end, - int socket_type, PurpleNetworkListenCallback cb, - gpointer cb_data) -{ - return purple_network_listen_range_family(start, end, AF_UNSPEC, - socket_type, cb, cb_data); -} - void purple_network_listen_cancel(PurpleNetworkListenData *listen_data) { if (listen_data->mapping_data != NULL) @@ -833,8 +811,20 @@ purple_network_is_available(void) purple_debug_warning("network", "NetworkManager not active. Assuming connection exists.\n"); } - if (nm_state == NM_STATE_UNKNOWN || nm_state == NM_STATE_CONNECTED) - return TRUE; + switch (nm_state) + { + case NM_STATE_UNKNOWN: +#if NM_CHECK_VERSION(0,8,992) + case NM_STATE_CONNECTED_LOCAL: + case NM_STATE_CONNECTED_SITE: + case NM_STATE_CONNECTED_GLOBAL: +#else + case NM_STATE_CONNECTED: +#endif + return TRUE; + default: + break; + } return FALSE; @@ -991,7 +981,7 @@ purple_network_set_stun_server(const gchar *stun_server) if (stun_server && stun_server[0] != '\0') { if (purple_network_is_available()) { purple_debug_info("network", "running DNS query for STUN server\n"); - purple_dnsquery_a_account(NULL, stun_server, 3478, purple_network_ip_lookup_cb, + purple_dnsquery_a(NULL, stun_server, 3478, purple_network_ip_lookup_cb, &stun_ip); } else { purple_debug_info("network", @@ -1009,7 +999,7 @@ purple_network_set_turn_server(const gchar *turn_server) if (turn_server && turn_server[0] != '\0') { if (purple_network_is_available()) { purple_debug_info("network", "running DNS query for TURN server\n"); - purple_dnsquery_a_account(NULL, turn_server, + purple_dnsquery_a(NULL, turn_server, purple_prefs_get_int("/purple/network/turn_port"), purple_network_ip_lookup_cb, &turn_ip); } else { @@ -1171,9 +1161,14 @@ purple_network_init(void) NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE); + /* NM 0.6 signal */ dbus_g_proxy_add_signal(nm_proxy, "StateChange", G_TYPE_UINT, G_TYPE_INVALID); dbus_g_proxy_connect_signal(nm_proxy, "StateChange", G_CALLBACK(nm_state_change_cb), NULL, NULL); + /* NM 0.7 and later signal */ + dbus_g_proxy_add_signal(nm_proxy, "StateChanged", G_TYPE_UINT, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(nm_proxy, "StateChanged", + G_CALLBACK(nm_state_change_cb), NULL, NULL); dbus_proxy = dbus_g_proxy_new_for_name(nm_conn, DBUS_SERVICE_DBUS, @@ -1208,6 +1203,7 @@ purple_network_uninit(void) #ifdef HAVE_NETWORKMANAGER if (nm_proxy) { dbus_g_proxy_disconnect_signal(nm_proxy, "StateChange", G_CALLBACK(nm_state_change_cb), NULL); + dbus_g_proxy_disconnect_signal(nm_proxy, "StateChanged", G_CALLBACK(nm_state_change_cb), NULL); g_object_unref(G_OBJECT(nm_proxy)); } if (dbus_proxy) { diff --git a/libpurple/network.h b/libpurple/network.h index 333f8e7f30..7686214906 100644 --- a/libpurple/network.h +++ b/libpurple/network.h @@ -92,7 +92,6 @@ const char *purple_network_get_local_system_ip(int fd); * * @note The caller must free this list. If libpurple was built with * support for it, this function also enumerates IPv6 addresses. - * @since 2.7.0 * * @return A list of local IP addresses. */ @@ -117,18 +116,6 @@ GList *purple_network_get_all_local_system_ips(void); */ const char *purple_network_get_my_ip(int fd); -/** - * Should calls to purple_network_listen() and purple_network_listen_range() - * map the port externally using NAT-PMP or UPnP? - * The default value is TRUE - * - * @param map_external Should the open port be mapped externally? - * @deprecated In 3.0.0 a boolean will be added to the functions mentioned - * above to perform the same function. - * @since 2.3.0 - */ -void purple_network_listen_map_external(gboolean map_external); - /** * Attempts to open a listening port ONLY on the specified port number. * You probably want to use purple_network_listen_range() instead of this. @@ -142,9 +129,22 @@ void purple_network_listen_map_external(gboolean map_external); * close the listening socket, and add a new watcher on the new socket accept * returned. * + * Libpurple does not currently do any port mapping (stateful firewall hole + * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped + * addresses, a mapping is done). + * * @param port The port number to bind to. Must be greater than 0. + * @param socket_family The protocol family of the socket. This should be + * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets + * may or may not be able to accept IPv4 connections + * based on the system configuration (use + * purple_socket_speaks_ipv4 to check). If an IPv6 + * socket doesn't accept V4-mapped addresses, you will + * need a second listener to support both v4 and v6. * @param socket_type The type of socket to open for listening. * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. + * @param map_external Should the open port be mapped externally using + * NAT-PNP or UPnP? (default should be TRUE) * @param cb The callback to be invoked when the port to listen on is available. * The file descriptor of the listening socket will be specified in * this callback, or -1 if no socket could be established. @@ -155,28 +155,8 @@ void purple_network_listen_map_external(gboolean map_external); * socket to listen on. */ PurpleNetworkListenData *purple_network_listen(unsigned short port, - int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); - -/** - * \copydoc purple_network_listen - * - * Libpurple does not currently do any port mapping (stateful firewall hole - * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped - * addresses, a mapping is done). - * - * @param socket_family The protocol family of the socket. This should be - * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets - * may or may not be able to accept IPv4 connections - * based on the system configuration (use - * purple_socket_speaks_ipv4 to check). If an IPv6 - * socket doesn't accept V4-mapped addresses, you will - * need a second listener to support both v4 and v6. - * @since 2.7.0 - * @deprecated This function will be renamed to purple_network_listen in 3.0.0. - */ -PurpleNetworkListenData *purple_network_listen_family(unsigned short port, - int socket_family, int socket_type, PurpleNetworkListenCallback cb, - gpointer cb_data); + int socket_family, int socket_type, gboolean map_external, + PurpleNetworkListenCallback cb, gpointer cb_data); /** * Opens a listening port selected from a range of ports. The range of @@ -192,13 +172,26 @@ PurpleNetworkListenData *purple_network_listen_family(unsigned short port, * the listening socket, and add a new watcher on the new socket accept * returned. * + * Libpurple does not currently do any port mapping (stateful firewall hole + * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped + * addresses, a mapping is done). + * * @param start The port number to bind to, or 0 to pick a random port. * Users are allowed to override this arg in prefs. * @param end The highest possible port in the range of ports to listen on, * or 0 to pick a random port. Users are allowed to override this * arg in prefs. + * @param socket_family The protocol family of the socket. This should be + * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets + * may or may not be able to accept IPv4 connections + * based on the system configuration (use + * purple_socket_speaks_ipv4 to check). If an IPv6 + * socket doesn't accept V4-mapped addresses, you will + * need a second listener to support both v4 and v6. * @param socket_type The type of socket to open for listening. * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. + * @param map_external Should the open port be mapped externally using + * NAT-PNP or UPnP? (default should be TRUE) * @param cb The callback to be invoked when the port to listen on is available. * The file descriptor of the listening socket will be specified in * this callback, or -1 if no socket could be established. @@ -208,31 +201,10 @@ PurpleNetworkListenData *purple_network_listen_family(unsigned short port, * the pending listener, or NULL if unable to obtain a local * socket to listen on. */ -PurpleNetworkListenData *purple_network_listen_range(unsigned short start, - unsigned short end, int socket_type, - PurpleNetworkListenCallback cb, gpointer cb_data); - -/** - * \copydoc purple_network_listen_range - * - * Libpurple does not currently do any port mapping (stateful firewall hole - * poking) for IPv6-only listeners (if an IPv6 socket supports v4-mapped - * addresses, a mapping is done). - * - * @param socket_family The protocol family of the socket. This should be - * AF_INET for IPv4 or AF_INET6 for IPv6. IPv6 sockets - * may or may not be able to accept IPv4 connections - * based on the system configuration (use - * purple_socket_speaks_ipv4 to check). If an IPv6 - * socket doesn't accept V4-mapped addresses, you will - * need a second listener to support both v4 and v6. - * @since 2.7.0 - * @deprecated This function will be renamed to purple_network_listen_range - * in 3.0.0. - */ -PurpleNetworkListenData *purple_network_listen_range_family( +PurpleNetworkListenData *purple_network_listen_range( unsigned short start, unsigned short end, int socket_family, - int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); + int socket_type, gboolean map_external, + PurpleNetworkListenCallback cb, gpointer cb_data); /** * This can be used to cancel any in-progress listener connection @@ -267,8 +239,6 @@ gboolean purple_network_is_available(void); * This is what backs the --force-online command line argument in Pidgin, * for example. This is useful for offline testing, especially when * combined with nullprpl. - * - * @since 2.6.0 */ void purple_network_force_online(void); @@ -284,7 +254,6 @@ void *purple_network_get_handle(void); * Will result in a DNS query being executed asynchronous * * @param stun_server The host name of the STUN server to set - * @since 2.6.0 */ void purple_network_set_stun_server(const gchar *stun_server); @@ -292,7 +261,6 @@ void purple_network_set_stun_server(const gchar *stun_server); * Get the IP address of the STUN server as a string representation * * @return the IP address - * @since 2.6.0 */ const gchar *purple_network_get_stun_ip(void); @@ -301,7 +269,6 @@ const gchar *purple_network_get_stun_ip(void); * Will result in a DNS query being executed asynchronous * * @param turn_server The host name of the TURN server to set - * @since 2.6.0 */ void purple_network_set_turn_server(const gchar *turn_server); @@ -309,7 +276,6 @@ void purple_network_set_turn_server(const gchar *turn_server); * Get the IP address of the TURN server as a string representation * * @return the IP address - * @since 2.6.0 */ const gchar *purple_network_get_turn_ip(void); @@ -317,7 +283,6 @@ const gchar *purple_network_get_turn_ip(void); * Remove a port mapping (UPnP or NAT-PMP) associated with listening socket * * @param fd Socket to remove the port mapping for - * @since 2.6.0 */ void purple_network_remove_port_mapping(gint fd); @@ -336,7 +301,6 @@ void purple_network_remove_port_mapping(gint fd); * The caller is responsible for freeing this. * @returns 0 on success, -1 if the out is NULL, or an error code * that currently corresponds to the Idna_rc enum in libidn. - * @since 2.6.0 */ int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out); diff --git a/libpurple/notify.c b/libpurple/notify.c index ede75a20e3..288dc8591c 100644 --- a/libpurple/notify.c +++ b/libpurple/notify.c @@ -56,6 +56,16 @@ struct _PurpleNotifyUserInfo GQueue entries; }; +/** + * Single column of a search result. + */ +struct _PurpleNotifySearchColumn +{ + char *title; /**< Title of the column. */ + gboolean visible; /**< Should the column be visible to the user. Defaults to TRUE. */ + +}; + void * purple_notify_message(void *handle, PurpleNotifyMsgType type, const char *title, const char *primary, @@ -368,6 +378,13 @@ purple_notify_searchresults_column_new(const char *title) return sc; } +const char *purple_notify_searchresult_column_get_title(const PurpleNotifySearchColumn *column) +{ + g_return_val_if_fail(column != NULL, NULL); + + return column->title; +} + void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *column, gboolean visible) { g_return_if_fail(column != NULL); diff --git a/libpurple/notify.h b/libpurple/notify.h index 7488a779bb..ec4d34968f 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -32,10 +32,13 @@ #include typedef struct _PurpleNotifyUserInfoEntry PurpleNotifyUserInfoEntry; -typedef struct _PurpleNotifyUserInfo PurpleNotifyUserInfo; +typedef struct _PurpleNotifyUserInfo PurpleNotifyUserInfo; +/** @copydoc _PurpleNotifySearchColumn */ +typedef struct _PurpleNotifySearchColumn PurpleNotifySearchColumn; #include "connection.h" + /** * Notification close callbacks. */ @@ -106,15 +109,6 @@ typedef enum PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER } PurpleNotifyUserInfoEntryType; -/** - * Single column of a search result. - */ -typedef struct -{ - char *title; /**< Title of the column. */ - gboolean visible; /**< Should the column be visible to the user. Defaults to TRUE. */ - -} PurpleNotifySearchColumn; /** @@ -276,10 +270,19 @@ PurpleNotifySearchResults *purple_notify_searchresults_new(void); */ PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title); +/** + * Returns the title of the column + * + * @param column The search column object. + * + * @return The title of the column + */ +const char *purple_notify_searchresult_column_get_title(const PurpleNotifySearchColumn *column); + /** * Sets whether or not a search result column is visible. * - * @param field The search column object. + * @param column The search column object. * @param visible TRUE if visible, or FALSE if not. */ void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *column, gboolean visible); @@ -287,7 +290,7 @@ void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *col /** * Returns whether or not a search result column is visible. * - * @param field The search column object. + * @param column The search column object. * * @return TRUE if the search result column is visible. FALSE otherwise. */ @@ -550,7 +553,6 @@ void purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info); * Prepend a section break. A UI might display this as a horizontal line. * * @param user_info The PurpleNotifyUserInfo - * @since 2.5.0 */ void purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info); @@ -569,7 +571,6 @@ void purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, * * @param user_info The PurpleNotifyUserInfo * @param label The name of the section - * @since 2.5.0 */ void purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label); diff --git a/libpurple/plugin.c b/libpurple/plugin.c index 4f2b4023ab..c97a9f3d67 100644 --- a/libpurple/plugin.c +++ b/libpurple/plugin.c @@ -64,13 +64,6 @@ static GList *plugin_loaders = NULL; static GList *plugins_to_disable = NULL; #endif -static void (*probe_cb)(void *) = NULL; -static void *probe_cb_data = NULL; -static void (*load_cb)(PurplePlugin *, void *) = NULL; -static void *load_cb_data = NULL; -static void (*unload_cb)(PurplePlugin *, void *) = NULL; -static void *unload_cb_data = NULL; - #ifdef PURPLE_PLUGINS static gboolean @@ -615,9 +608,6 @@ purple_plugin_load(PurplePlugin *plugin) plugin->loaded = TRUE; - if (load_cb != NULL) - load_cb(plugin, load_cb_data); - purple_signal_emit(purple_plugins_get_handle(), "plugin-load", plugin); return TRUE; @@ -745,9 +735,6 @@ purple_plugin_unload(PurplePlugin *plugin) g_free(plugin->error); plugin->error = NULL; - if (unload_cb != NULL) - unload_cb(plugin, unload_cb_data); - purple_signal_emit(purple_plugins_get_handle(), "plugin-unload", plugin); purple_prefs_disconnect_by_handle(plugin); @@ -1439,10 +1426,6 @@ purple_plugins_probe(const char *ext) (GCompareFunc)compare_prpl); } } - - if (probe_cb != NULL) - probe_cb(probe_cb_data); - #endif /* PURPLE_PLUGINS */ } @@ -1513,50 +1496,6 @@ purple_plugins_enabled(void) #endif } -void -purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data) -{ - probe_cb = func; - probe_cb_data = data; -} - -void -purple_plugins_unregister_probe_notify_cb(void (*func)(void *)) -{ - probe_cb = NULL; - probe_cb_data = NULL; -} - -void -purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *), - void *data) -{ - load_cb = func; - load_cb_data = data; -} - -void -purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)) -{ - load_cb = NULL; - load_cb_data = NULL; -} - -void -purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *), - void *data) -{ - unload_cb = func; - unload_cb_data = data; -} - -void -purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *, void *)) -{ - unload_cb = NULL; - unload_cb_data = NULL; -} - PurplePlugin * purple_plugins_find_with_name(const char *name) { diff --git a/libpurple/plugin.h b/libpurple/plugin.h index 9225aecd92..5d6b48b663 100644 --- a/libpurple/plugin.h +++ b/libpurple/plugin.h @@ -317,8 +317,6 @@ gboolean purple_plugin_unload(PurplePlugin *plugin); * startup" by excluding said plugins from the list of plugins to save. The * UI needs to call purple_plugins_save_loaded() after calling this for it * to have any effect. - * - * @since 2.3.0 */ void purple_plugin_disable(PurplePlugin *plugin); @@ -515,8 +513,6 @@ void purple_plugins_add_search_path(const char *path); * Returns a list of plugin search paths. * * @constreturn A list of searched paths. - * - * @since 2.6.0 */ GList *purple_plugins_get_search_paths(void); @@ -566,72 +562,6 @@ void purple_plugins_probe(const char *ext); */ gboolean purple_plugins_enabled(void); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Registers a function that will be called when probing is finished. - * - * @param func The callback function. - * @param data Data to pass to the callback. - * @deprecated If you need this, ask for a plugin-probe signal to be added. - */ -void purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Unregisters a function that would be called when probing is finished. - * - * @param func The callback function. - * @deprecated If you need this, ask for a plugin-probe signal to be added. - */ -void purple_plugins_unregister_probe_notify_cb(void (*func)(void *)); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Registers a function that will be called when a plugin is loaded. - * - * @param func The callback function. - * @param data Data to pass to the callback. - * @deprecated Use the plugin-load signal instead. - */ -void purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *), - void *data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Unregisters a function that would be called when a plugin is loaded. - * - * @param func The callback function. - * @deprecated Use the plugin-load signal instead. - */ -void purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Registers a function that will be called when a plugin is unloaded. - * - * @param func The callback function. - * @param data Data to pass to the callback. - * @deprecated Use the plugin-unload signal instead. - */ -void purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *), - void *data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Unregisters a function that would be called when a plugin is unloaded. - * - * @param func The callback function. - * @deprecated Use the plugin-unload signal instead. - */ -void purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *, - void *)); -#endif - /** * Finds a plugin with the specified name. * diff --git a/libpurple/plugins/autoaccept.c b/libpurple/plugins/autoaccept.c index 7cd461a381..0f965fc541 100644 --- a/libpurple/plugins/autoaccept.c +++ b/libpurple/plugins/autoaccept.c @@ -73,10 +73,10 @@ static void auto_accept_complete_cb(PurpleXfer *xfer, PurpleXfer *my) { if (xfer == my && purple_prefs_get_bool(PREF_NOTIFY) && - !purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who, xfer->account)) + !purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_xfer_get_remote_user(xfer), purple_xfer_get_account(xfer))) { char *message = g_strdup_printf(_("Autoaccepted file transfer of \"%s\" from \"%s\" completed."), - xfer->filename, xfer->who); + purple_xfer_get_filename(xfer), purple_xfer_get_remote_user(xfer)); purple_notify_info(NULL, _("Autoaccept complete"), message, NULL); g_free(message); } @@ -93,8 +93,8 @@ file_recv_request_cb(PurpleXfer *xfer, gpointer handle) int accept_setting; - account = xfer->account; - node = PURPLE_BLIST_NODE(purple_find_buddy(account, xfer->who)); + account = purple_xfer_get_account(xfer); + node = PURPLE_BLIST_NODE(purple_find_buddy(account, purple_xfer_get_remote_user(xfer))); /* If person is on buddy list, use the buddy setting; otherwise, use the stranger setting. */ @@ -121,7 +121,7 @@ file_recv_request_cb(PurpleXfer *xfer, gpointer handle) gchar *ext; if (purple_prefs_get_bool(PREF_NEWDIR)) - dirname = g_build_filename(pref, purple_normalize(account, xfer->who), NULL); + dirname = g_build_filename(pref, purple_normalize(account, purple_xfer_get_remote_user(xfer)), NULL); else dirname = g_build_filename(pref, NULL); @@ -133,9 +133,9 @@ file_recv_request_cb(PurpleXfer *xfer, gpointer handle) /* Escape filename (if escaping is turned on) */ if (purple_prefs_get_bool(PREF_ESCAPE)) { - escape = purple_escape_filename(xfer->filename); + escape = purple_escape_filename(purple_xfer_get_filename(xfer)); } else { - escape = xfer->filename; + escape = purple_xfer_get_filename(xfer); } filename = g_build_filename(dirname, escape, NULL); @@ -174,7 +174,7 @@ file_recv_request_cb(PurpleXfer *xfer, gpointer handle) PURPLE_CALLBACK(auto_accept_complete_cb), xfer); break; case FT_REJECT: - xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; + purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); break; } } diff --git a/libpurple/plugins/log_reader.c b/libpurple/plugins/log_reader.c index 800bc38ae4..3520221656 100644 --- a/libpurple/plugins/log_reader.c +++ b/libpurple/plugins/log_reader.c @@ -92,7 +92,7 @@ static GList *adium_logger_list(PurpleLogType type, const char *sn, PurpleAccoun prpl_name = g_ascii_strup(prpl_info->list_icon(account, NULL), -1); - temp = g_strdup_printf("%s.%s", prpl_name, account->username); + temp = g_strdup_printf("%s.%s", prpl_name, purple_account_get_username(account)); path = g_build_filename(logdir, temp, sn, NULL); g_free(temp); @@ -635,7 +635,7 @@ static GList *msn_logger_list(PurpleLogType type, const char *sn, PurpleAccount g_return_val_if_fail(sn != NULL, NULL); g_return_val_if_fail(account != NULL, NULL); - if (strcmp(account->protocol_id, "prpl-msn")) + if (strcmp(purple_account_get_protocol_id(account), "prpl-msn")) return NULL; logdir = purple_prefs_get_string("/plugins/core/log_reader/msn/log_directory"); @@ -658,7 +658,7 @@ static GList *msn_logger_list(PurpleLogType type, const char *sn, PurpleAccount return list; } } else { - username = g_strdup(purple_normalize(account, account->username)); + username = g_strdup(purple_normalize(account, purple_account_get_username(account))); } if (buddy) { @@ -974,7 +974,7 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) their_name = from_name; if (from_name && purple_prefs_get_bool("/plugins/core/log_reader/use_name_heuristics")) { - const char *friendly_name = purple_connection_get_display_name(log->account->gc); + const char *friendly_name = purple_connection_get_display_name(purple_account_get_connection(log->account)); if (friendly_name != NULL) { int friendly_name_length = strlen(friendly_name); @@ -987,13 +987,10 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) if (buddy) their_name = purple_buddy_get_alias(buddy); - if (log->account->alias) - { - alias = log->account->alias; + alias = purple_account_get_alias(log->account); + if (alias) { alias_length = strlen(alias); - } - else - { + } else { alias = ""; alias_length = 0; } @@ -1115,10 +1112,10 @@ static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) text = g_string_append(text, ""); if (name_guessed == NAME_GUESS_ME) { - if (log->account->alias) - text = g_string_append(text, log->account->alias); + if (purple_account_get_alias(log->account)) + text = g_string_append(text, purple_account_get_alias(log->account)); else - text = g_string_append(text, log->account->username); + text = g_string_append(text, purple_account_get_username(log->account)); } else if (name_guessed == NAME_GUESS_THEM) text = g_string_append(text, their_name); @@ -1781,7 +1778,7 @@ static GList *qip_logger_list(PurpleLogType type, const char *sn, PurpleAccount g_return_val_if_fail(account != NULL, NULL); /* QIP only supports ICQ. */ - if (strcmp(account->protocol_id, "prpl-icq")) + if (strcmp(purple_account_get_protocol_id(account), "prpl-icq")) return NULL; logdir = purple_prefs_get_string("/plugins/core/log_reader/qip/log_directory"); @@ -1798,7 +1795,7 @@ static GList *qip_logger_list(PurpleLogType type, const char *sn, PurpleAccount if (!prpl_info->list_icon) return NULL; - username = g_strdup(purple_normalize(account, account->username)); + username = g_strdup(purple_normalize(account, purple_account_get_username(account))); filename = g_strdup_printf("%s.txt", purple_normalize(account, sn)); path = g_build_filename(logdir, username, "History", filename, NULL); g_free(username); @@ -2206,7 +2203,6 @@ static GList *amsn_logger_parse_file(char *filename, const char *sn, PurpleAccou log->logger = amsn_logger; log->logger_data = data; list = g_list_prepend(list, log); - found_start = FALSE; purple_debug_info("aMSN logger", "Found log for %s:" @@ -2241,10 +2237,10 @@ static GList *amsn_logger_list(PurpleLogType type, const char *sn, PurpleAccount return NULL; /* aMSN only works with MSN/WLM */ - if (strcmp(account->protocol_id, "prpl-msn")) + if (strcmp(purple_account_get_protocol_id(account), "prpl-msn")) return NULL; - username = g_strdup(purple_normalize(account, account->username)); + username = g_strdup(purple_normalize(account, purple_account_get_username(account))); buddy_log = g_strdup_printf("%s.log", purple_normalize(account, sn)); log_path = g_build_filename(logdir, username, "logs", NULL); diff --git a/libpurple/plugins/perl/common/Account.xs b/libpurple/plugins/perl/common/Account.xs index 4976b84299..2a400d0379 100644 --- a/libpurple/plugins/perl/common/Account.xs +++ b/libpurple/plugins/perl/common/Account.xs @@ -199,9 +199,10 @@ purple_account_destroy_log(account) Purple::Account account void -purple_account_add_buddies(account, list) +purple_account_add_buddies(account, list, message) Purple::Account account SV * list + const char *message PREINIT: GList *t_GL; int i, t_len; @@ -212,13 +213,14 @@ PPCODE: for (i = 0; i <= t_len; i++) t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(list), i, 0))); - purple_account_add_buddies(account, t_GL); + purple_account_add_buddies(account, t_GL, message); g_list_free(t_GL); void -purple_account_add_buddy(account, buddy) - Purple::Account account - Purple::BuddyList::Buddy buddy +purple_account_add_buddy(account, buddy, message) + Purple::Account account + Purple::BuddyList::Buddy buddy + const char * message void purple_account_change_password(account, a, b) diff --git a/libpurple/plugins/perl/common/BuddyList.xs b/libpurple/plugins/perl/common/BuddyList.xs index 65f10184f0..d6c1f3b076 100644 --- a/libpurple/plugins/perl/common/BuddyList.xs +++ b/libpurple/plugins/perl/common/BuddyList.xs @@ -82,11 +82,6 @@ Purple::BuddyList::Buddy purple_contact_get_priority_buddy(contact) Purple::BuddyList::Contact contact -void -purple_contact_set_alias(contact, alias) - Purple::BuddyList::Contact contact - const char * alias - const char * purple_contact_get_alias(contact) Purple::BuddyList::Contact contact @@ -199,10 +194,6 @@ purple_blist_update_buddy_status(buddy, old_status) Purple::BuddyList::Buddy buddy Purple::Status old_status -void -purple_blist_update_buddy_icon(buddy) - Purple::BuddyList::Buddy buddy - void purple_blist_rename_buddy(buddy, name) Purple::BuddyList::Buddy buddy @@ -429,10 +420,6 @@ const char * purple_buddy_get_contact_alias(buddy) Purple::BuddyList::Buddy buddy -const char * -purple_buddy_get_local_alias(buddy) - Purple::BuddyList::Buddy buddy - const char * purple_buddy_get_alias(buddy) Purple::BuddyList::Buddy buddy diff --git a/libpurple/plugins/perl/common/Certificate.xs b/libpurple/plugins/perl/common/Certificate.xs index 02888722ec..92fa36c8e2 100644 --- a/libpurple/plugins/perl/common/Certificate.xs +++ b/libpurple/plugins/perl/common/Certificate.xs @@ -202,7 +202,7 @@ purple_certificate_check_signature_chain(...) l = g_list_prepend(l, purple_perl_ref_object(ST(i))); } l = g_list_reverse(l); - ret = purple_certificate_check_signature_chain(l); + ret = purple_certificate_check_signature_chain(l, NULL); g_list_free(l); if(ret) XSRETURN_YES; XSRETURN_NO; diff --git a/libpurple/plugins/perl/common/Connection.xs b/libpurple/plugins/perl/common/Connection.xs index 473cd56bdb..dc0c2660e1 100644 --- a/libpurple/plugins/perl/common/Connection.xs +++ b/libpurple/plugins/perl/common/Connection.xs @@ -35,10 +35,6 @@ purple_connection_notice(gc, text) Purple::Connection gc const char *text -void -purple_connection_destroy(gc) - Purple::Connection gc - void purple_connection_set_state(gc, state) Purple::Connection gc diff --git a/libpurple/plugins/perl/common/Conversation.xs b/libpurple/plugins/perl/common/Conversation.xs index 3239b57d99..3263aafc4c 100644 --- a/libpurple/plugins/perl/common/Conversation.xs +++ b/libpurple/plugins/perl/common/Conversation.xs @@ -146,7 +146,7 @@ purple_conversation_get_account(conv) Purple::Conversation conv Purple::Connection -purple_conversation_get_gc(conv) +purple_conversation_get_connection(conv) Purple::Conversation conv void @@ -337,24 +337,6 @@ Purple::Conversation purple_conv_chat_get_conversation(chat) Purple::Conversation::Chat chat -void -purple_conv_chat_set_users(chat, users) - Purple::Conversation::Chat chat - SV * users -PREINIT: - GList *l, *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(users)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); - - for (l = purple_conv_chat_set_users(chat, t_GL); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - void purple_conv_chat_get_users(chat) Purple::Conversation::Chat chat diff --git a/libpurple/plugins/perl/common/FT.xs b/libpurple/plugins/perl/common/FT.xs index 58d1985a72..eca4cfa04e 100644 --- a/libpurple/plugins/perl/common/FT.xs +++ b/libpurple/plugins/perl/common/FT.xs @@ -113,7 +113,7 @@ purple_xfer_get_type(xfer) Purple::Xfer xfer gboolean -purple_xfer_is_canceled(xfer) +purple_xfer_is_cancelled(xfer) Purple::Xfer xfer gboolean diff --git a/libpurple/plugins/perl/common/Network.xs b/libpurple/plugins/perl/common/Network.xs index 7b3ae1c91d..1388b3abed 100644 --- a/libpurple/plugins/perl/common/Network.xs +++ b/libpurple/plugins/perl/common/Network.xs @@ -23,17 +23,21 @@ purple_network_ip_atoi(ip) const char *ip Purple::NetworkListenData -purple_network_listen(port, socket_type, cb, cb_data) +purple_network_listen(port, socket_family, socket_type, map_external, cb, cb_data) unsigned short port + int socket_family int socket_type + gboolean map_external Purple::NetworkListenCallback cb gpointer cb_data Purple::NetworkListenData -purple_network_listen_range(start, end, socket_type, cb, cb_data) +purple_network_listen_range(start, end, socket_family, socket_type, map_external, cb, cb_data) unsigned short start unsigned short end + int socket_family int socket_type + gboolean map_external Purple::NetworkListenCallback cb gpointer cb_data diff --git a/libpurple/plugins/perl/common/Request.xs b/libpurple/plugins/perl/common/Request.xs index 499a6756a8..244f1b2db5 100644 --- a/libpurple/plugins/perl/common/Request.xs +++ b/libpurple/plugins/perl/common/Request.xs @@ -373,12 +373,6 @@ purple_request_field_list_new(class, id, text) const char *text C_ARGS: id, text -void -purple_request_field_list_add(field, item, data) - Purple::Request::Field field - const char *item - void * data - void purple_request_field_list_add_icon(field, item, icon_path, data) Purple::Request::Field field diff --git a/libpurple/plugins/perl/common/SSLConn.xs b/libpurple/plugins/perl/common/SSLConn.xs index dbc337ca37..3730e80683 100644 --- a/libpurple/plugins/perl/common/SSLConn.xs +++ b/libpurple/plugins/perl/common/SSLConn.xs @@ -16,13 +16,6 @@ purple_ssl_input_add(gsc, func, data) Purple::Ssl::Connection gsc Purple::SslInputFunction func -Purple::Ssl::Connection -purple_ssl_connect_fd(account, fd, func, error_func, data) - Purple::Account account - int fd - PurpleSslInputFunction func - PurpleSslErrorFunction error_func - */ MODULE = Purple::SSL PACKAGE = Purple::SSL PREFIX = purple_ssl_ diff --git a/libpurple/plugins/perl/common/Status.xs b/libpurple/plugins/perl/common/Status.xs index f77860e61d..8965870ade 100644 --- a/libpurple/plugins/perl/common/Status.xs +++ b/libpurple/plugins/perl/common/Status.xs @@ -74,28 +74,6 @@ BOOT: newCONSTSUB(primitive_stash, (char *)civ->name, newSViv(civ->iv)); } -void -purple_presence_add_list(presence, source_list) - Purple::Presence presence - SV *source_list -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(source_list)); - - for (i = 0; i <= t_len; i++) { - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(source_list), i, 0))); - } - purple_presence_add_list(presence, t_GL); - g_list_free(t_GL); - -void -purple_presence_add_status(presence, status) - Purple::Presence presence - Purple::Status status - gint purple_presence_compare(presence1, presence2) Purple::Presence presence1 @@ -329,28 +307,9 @@ purple_status_set_active(status, active) Purple::Status status gboolean active -void -purple_status_set_attr_boolean(status, id, value) - Purple::Status status - const char *id - gboolean value - -void -purple_status_set_attr_string(status, id, value) - Purple::Status status - const char *id - const char *value - MODULE = Purple::Status PACKAGE = Purple::StatusType PREFIX = purple_status_type_ PROTOTYPES: ENABLE -void -purple_status_type_add_attr(status_type, id, name, value) - Purple::StatusType status_type - const char *id - const char *name - Purple::Value value - void purple_status_type_destroy(status_type) Purple::StatusType status_type diff --git a/libpurple/plugins/perl/common/Util.xs b/libpurple/plugins/perl/common/Util.xs index b339cc75af..7426c9b458 100644 --- a/libpurple/plugins/perl/common/Util.xs +++ b/libpurple/plugins/perl/common/Util.xs @@ -202,6 +202,14 @@ gboolean purple_ip_address_is_valid(ip) const char* ip +gboolean +purple_ipv4_address_is_valid(ip) + const char* ip + +gboolean +purple_ipv6_address_is_valid(ip) + const char* ip + const char* purple_normalize_nocase(account, str) Purple::Account account @@ -454,12 +462,13 @@ PROTOTYPES: ENABLE #XXX: expand... void -purple_util_fetch_url(plugin, url, full, user_agent, http11, cb) +purple_util_fetch_url(plugin, url, full, user_agent, http11, max_len, cb) Purple::Plugin plugin const char *url gboolean full const char *user_agent gboolean http11 + gssize max_len SV * cb PREINIT: PurpleUtilFetchUrlData *data; @@ -468,7 +477,7 @@ PPCODE: SV *sv = purple_perl_sv_from_fun(plugin, cb); if (sv != NULL) { - data = purple_util_fetch_url(url, full, user_agent, http11, + data = purple_util_fetch_url(url, full, user_agent, http11, max_len, purple_perl_util_url_cb, sv); XPUSHs(sv_2mortal(purple_perl_bless_object(data, "Purple::Util::FetchUrlData"))); } else { diff --git a/libpurple/plugins/ssl/Makefile.am b/libpurple/plugins/ssl/Makefile.am index f95ef88f58..d874abd4ef 100644 --- a/libpurple/plugins/ssl/Makefile.am +++ b/libpurple/plugins/ssl/Makefile.am @@ -9,30 +9,15 @@ ssl_nss_la_LDFLAGS = -module -avoid-version if PLUGINS -# I'm sorry to report that Automake Conditionals don't support -# if USE_GNUTLS && USE_NSS -# but only support testing a single variable. Hence: - -if USE_GNUTLS -if USE_NSS plugin_LTLIBRARIES = \ - ssl.la \ - ssl-gnutls.la \ - ssl-nss.la -else -plugin_LTLIBRARIES = \ - ssl.la \ + ssl.la +if USE_GNUTLS +plugin_LTLIBRARIES += \ ssl-gnutls.la endif -else if USE_NSS -plugin_LTLIBRARIES = \ - ssl.la \ +plugin_LTLIBRARIES += \ ssl-nss.la -else -plugin_LTLIBRARIES = \ - ssl.la -endif endif ssl_la_SOURCES = ssl.c @@ -56,3 +41,4 @@ AM_CPPFLAGS = \ ssl_gnutls_la_CFLAGS = $(AM_CPPFLAGS) $(GNUTLS_CFLAGS) ssl_nss_la_CFLAGS = $(AM_CPPFLAGS) $(NSS_CFLAGS) + diff --git a/libpurple/plugins/ssl/ssl-gnutls.c b/libpurple/plugins/ssl/ssl-gnutls.c index 00b691ba81..8ae0fa0aa7 100644 --- a/libpurple/plugins/ssl/ssl-gnutls.c +++ b/libpurple/plugins/ssl/ssl-gnutls.c @@ -1142,6 +1142,37 @@ x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration) return success; } +static GByteArray * +x509_get_der_data(PurpleCertificate *crt) +{ + gnutls_x509_crt crt_dat; + GByteArray *data; + size_t len; + int ret; + + crt_dat = X509_GET_GNUTLS_DATA(crt); + g_return_val_if_fail(crt_dat, NULL); + + /* Obtain the output size required */ + len = 0; + ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_DER, NULL, &len); + g_return_val_if_fail(ret == GNUTLS_E_SHORT_MEMORY_BUFFER, NULL); + + /* Now allocate a buffer and *really* export it */ + data = g_byte_array_sized_new(len); + data->len = len; + ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_DER, data->data, &len); + if (ret != 0) { + purple_debug_error("gnutls/x509", + "Failed to export cert to buffer with code %d\n", + ret); + g_byte_array_free(data, TRUE); + return NULL; + } + + return data; +} + /* X.509 certificate operations provided by this plugin */ static PurpleCertificateScheme x509_gnutls = { "x509", /* Scheme name */ @@ -1158,8 +1189,8 @@ static PurpleCertificateScheme x509_gnutls = { x509_check_name, /* Check subject name */ x509_times, /* Activation/Expiration time */ x509_importcerts_from_file, /* Multiple certificates import function */ + x509_get_der_data, /* Binary DER data */ - NULL, NULL, NULL diff --git a/libpurple/plugins/ssl/ssl-nss.c b/libpurple/plugins/ssl/ssl-nss.c index 6ed90db538..82121989e4 100644 --- a/libpurple/plugins/ssl/ssl-nss.c +++ b/libpurple/plugins/ssl/ssl-nss.c @@ -930,6 +930,29 @@ x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration) return TRUE; } +static GByteArray * +x509_get_der_data(PurpleCertificate *crt) +{ + CERTCertificate *crt_dat; + SECItem *dercrt; + GByteArray *data; + + crt_dat = X509_NSS_DATA(crt); + g_return_val_if_fail(crt_dat, NULL); + + dercrt = SEC_ASN1EncodeItem(NULL, NULL, crt_dat, + SEC_ASN1_GET(SEC_SignedCertificateTemplate)); + g_return_val_if_fail(dercrt != NULL, FALSE); + + data = g_byte_array_sized_new(dercrt->len); + memcpy(data->data, dercrt->data, dercrt->len); + data->len = dercrt->len; + + SECITEM_FreeItem(dercrt, PR_TRUE); + + return data; +} + static PurpleCertificateScheme x509_nss = { "x509", /* Scheme name */ N_("X.509 Certificates"), /* User-visible scheme name */ @@ -945,8 +968,8 @@ static PurpleCertificateScheme x509_nss = { x509_check_name, /* Check subject name */ x509_times, /* Activation/Expiration time */ x509_importcerts_from_file, /* Multiple certificate import function */ + x509_get_der_data, /* Binary DER data */ - NULL, NULL, NULL }; diff --git a/libpurple/plugins/statenotify.c b/libpurple/plugins/statenotify.c index bfbe595e50..ca74854e90 100644 --- a/libpurple/plugins/statenotify.c +++ b/libpurple/plugins/statenotify.c @@ -30,7 +30,7 @@ write_status(PurpleBuddy *buddy, const char *message) if (conv == NULL) return; - g_return_if_fail(conv->type == PURPLE_CONV_TYPE_IM); + g_return_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM); /* Prevent duplicate notifications for buddies in multiple groups */ if (buddy != purple_find_buddy(account, buddy_name)) @@ -42,7 +42,7 @@ write_status(PurpleBuddy *buddy, const char *message) g_snprintf(buf, sizeof(buf), message, escaped); g_free(escaped); - purple_conv_im_write(conv->u.im, NULL, buf, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_ACTIVE_ONLY | PURPLE_MESSAGE_NO_LINKIFY, time(NULL)); + purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, buf, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_ACTIVE_ONLY | PURPLE_MESSAGE_NO_LINKIFY, time(NULL)); } static void diff --git a/libpurple/pounce.c b/libpurple/pounce.c index 7b150e98a9..4130f0087f 100644 --- a/libpurple/pounce.c +++ b/libpurple/pounce.c @@ -32,6 +32,31 @@ #include "pounce.h" #include "util.h" +/** + * A buddy pounce structure. + * + * Buddy pounces are actions triggered by a buddy-related event. For + * example, a sound can be played or an IM window opened when a buddy + * signs on or returns from away. Such responses are handled in the + * UI. The events themselves are done in the core. + */ +struct _PurplePounce +{ + char *ui_type; /**< The type of UI. */ + + PurplePounceEvent events; /**< The event(s) to pounce on. */ + PurplePounceOption options; /**< The pounce options */ + PurpleAccount *pouncer; /**< The user who is pouncing. */ + + char *pouncee; /**< The buddy to pounce on. */ + + GHashTable *actions; /**< The registered actions. */ + + gboolean save; /**< Whether or not the pounce should + be saved after activation. */ + void *data; /**< Pounce-specific data. */ +}; + typedef struct { GString *buffer; @@ -180,7 +205,7 @@ pounce_to_xmlnode(PurplePounce *pounce) xmlnode_set_attrib(node, "ui", pounce->ui_type); child = xmlnode_new_child(node, "account"); - xmlnode_set_attrib(child, "protocol", pouncer->protocol_id); + xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(pouncer)); xmlnode_insert_data(child, purple_normalize(pouncer, purple_account_get_username(pouncer)), -1); diff --git a/libpurple/pounce.h b/libpurple/pounce.h index 434fe318bb..1b3a30cdc7 100644 --- a/libpurple/pounce.h +++ b/libpurple/pounce.h @@ -59,31 +59,6 @@ typedef enum /** A pounce callback. */ typedef void (*PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *); -/** - * A buddy pounce structure. - * - * Buddy pounces are actions triggered by a buddy-related event. For - * example, a sound can be played or an IM window opened when a buddy - * signs on or returns from away. Such responses are handled in the - * UI. The events themselves are done in the core. - */ -struct _PurplePounce -{ - char *ui_type; /**< The type of UI. */ - - PurplePounceEvent events; /**< The event(s) to pounce on. */ - PurplePounceOption options; /**< The pounce options */ - PurpleAccount *pouncer; /**< The user who is pouncing. */ - - char *pouncee; /**< The buddy to pounce on. */ - - GHashTable *actions; /**< The registered actions. */ - - gboolean save; /**< Whether or not the pounce should - be saved after activation. */ - void *data; /**< Pounce-specific data. */ -}; - #ifdef __cplusplus extern "C" { #endif @@ -126,8 +101,6 @@ void purple_pounce_destroy_all_by_account(PurpleAccount *account); * Destroys all buddy pounces for a buddy * * @param buddy The buddy whose pounces are to be removed - * - * @since 2.8.0 */ void purple_pounce_destroy_all_by_buddy(PurpleBuddy *buddy); @@ -359,7 +332,6 @@ GList *purple_pounces_get_all(void); * * @return The list of buddy pounces. The list should be freed by * the caller when it's no longer used. - * @since 2.1.0 */ GList *purple_pounces_get_all_for_ui(const char *ui); diff --git a/libpurple/prefs.c b/libpurple/prefs.c index a24b4c4b62..b6d0e8b053 100644 --- a/libpurple/prefs.c +++ b/libpurple/prefs.c @@ -1357,6 +1357,7 @@ purple_prefs_update_old() purple_prefs_remove("/purple/conversations/chat/show_leave"); purple_prefs_remove("/purple/conversations/combine_chat_im"); purple_prefs_remove("/purple/conversations/use_alias_for_title"); + purple_prefs_remove("/purple/debug/timestamps"); purple_prefs_remove("/purple/logging/log_signon_signoff"); purple_prefs_remove("/purple/logging/log_idle_state"); purple_prefs_remove("/purple/logging/log_away_state"); diff --git a/libpurple/prefs.h b/libpurple/prefs.h index 6b542ea1d3..42fc7687bb 100644 --- a/libpurple/prefs.h +++ b/libpurple/prefs.h @@ -317,8 +317,6 @@ GList *purple_prefs_get_path_list(const char *name); * @return A list of newly allocated strings denoting the names of the children. * Returns @c NULL if there are no children or if pref doesn't exist. * The caller must free all the strings and the list. - * - * @since 2.1.0 */ GList *purple_prefs_get_children_names(const char *name); diff --git a/libpurple/privacy.c b/libpurple/privacy.c index 00dd7e4493..9f9d28838f 100644 --- a/libpurple/privacy.c +++ b/libpurple/privacy.c @@ -264,9 +264,9 @@ purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, gboolean restore) { GSList *list; - PurplePrivacyType type = account->perm_deny; + PurplePrivacyType type = purple_account_get_privacy_type(account); - switch (account->perm_deny) { + switch (type) { case PURPLE_PRIVACY_ALLOW_ALL: return; case PURPLE_PRIVACY_ALLOW_USERS: @@ -287,13 +287,13 @@ purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, } } purple_privacy_permit_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_ALLOW_USERS); break; case PURPLE_PRIVACY_ALLOW_BUDDYLIST: if (!purple_find_buddy(account, who)) { add_all_buddies_to_permit_list(account, local); purple_privacy_permit_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_ALLOW_USERS); } break; default: @@ -301,7 +301,7 @@ purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, } /* Notify the server if the privacy setting was changed */ - if (type != account->perm_deny && purple_account_is_connected(account)) + if (type != purple_account_get_privacy_type(account) && purple_account_is_connected(account)) serv_set_permit_deny(purple_account_get_connection(account)); } @@ -316,9 +316,9 @@ purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, gboolean restore) { GSList *list; - PurplePrivacyType type = account->perm_deny; + PurplePrivacyType type = purple_account_get_privacy_type(account); - switch (account->perm_deny) { + switch (type) { case PURPLE_PRIVACY_ALLOW_ALL: if (!restore) { /* Empty the deny-list. */ @@ -331,7 +331,7 @@ purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, } } purple_privacy_deny_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_DENY_USERS); break; case PURPLE_PRIVACY_ALLOW_USERS: purple_privacy_permit_remove(account, who, local); @@ -345,7 +345,7 @@ purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, if (purple_find_buddy(account, who)) { add_all_buddies_to_permit_list(account, local); purple_privacy_permit_remove(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_ALLOW_USERS); } break; default: @@ -353,7 +353,7 @@ purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, } /* Notify the server if the privacy setting was changed */ - if (type != account->perm_deny && purple_account_is_connected(account)) + if (type != purple_account_get_privacy_type(account) && purple_account_is_connected(account)) serv_set_permit_deny(purple_account_get_connection(account)); } @@ -362,7 +362,7 @@ purple_privacy_check(PurpleAccount *account, const char *who) { GSList *list; - switch (account->perm_deny) { + switch (purple_account_get_privacy_type(account)) { case PURPLE_PRIVACY_ALLOW_ALL: return TRUE; diff --git a/libpurple/protocols/Makefile.am b/libpurple/protocols/Makefile.am index b58394f693..c4a74361da 100644 --- a/libpurple/protocols/Makefile.am +++ b/libpurple/protocols/Makefile.am @@ -1,5 +1,5 @@ EXTRA_DIST = Makefile.mingw -DIST_SUBDIRS = bonjour gg irc jabber msn myspace mxit novell null oscar sametime silc simple yahoo zephyr +DIST_SUBDIRS = bonjour gg irc jabber msn mxit myspace novell null oscar sametime silc simple yahoo zephyr SUBDIRS = $(DYNAMIC_PRPLS) $(STATIC_PRPLS) diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c index 805f4d3b10..c9b9a8ee6a 100644 --- a/libpurple/protocols/bonjour/bonjour.c +++ b/libpurple/protocols/bonjour/bonjour.c @@ -51,7 +51,7 @@ const char * bonjour_get_jid(PurpleAccount *account) { PurpleConnection *conn = purple_account_get_connection(account); - BonjourData *bd = conn->proto_data; + BonjourData *bd = purple_connection_get_protocol_data(conn); return bd->jid; } @@ -102,8 +102,9 @@ bonjour_login(PurpleAccount *account) } #endif /* _WIN32 */ - gc->flags |= PURPLE_CONNECTION_HTML; - gc->proto_data = bd = g_new0(BonjourData, 1); + purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML); + bd = g_new0(BonjourData, 1); + purple_connection_set_protocol_data(gc, bd); /* Start waiting for jabber connections (iChat style) */ bd->jabber_data = g_new0(BonjourJabber, 1); @@ -157,7 +158,7 @@ static void bonjour_close(PurpleConnection *connection) { PurpleGroup *bonjour_group; - BonjourData *bd = connection->proto_data; + BonjourData *bd = purple_connection_get_protocol_data(connection); bonjour_group = purple_find_group(BONJOUR_GROUP_NAME); @@ -192,7 +193,7 @@ bonjour_close(PurpleConnection *connection) if (bd != NULL) g_free(bd->jid); g_free(bd); - connection->proto_data = NULL; + purple_connection_set_protocol_data(connection, NULL); } static const char * @@ -204,10 +205,12 @@ bonjour_list_icon(PurpleAccount *account, PurpleBuddy *buddy) static int bonjour_send_im(PurpleConnection *connection, const char *to, const char *msg, PurpleMessageFlags flags) { + BonjourData *bd = purple_connection_get_protocol_data(connection); + if(!to || !msg) return 0; - return bonjour_jabber_send_message(((BonjourData*)(connection->proto_data))->jabber_data, to, msg); + return bonjour_jabber_send_message(bd->jabber_data, to, msg); } static void @@ -220,7 +223,7 @@ bonjour_set_status(PurpleAccount *account, PurpleStatus *status) gchar *stripped; gc = purple_account_get_connection(account); - bd = gc->proto_data; + bd = purple_connection_get_protocol_data(gc); presence = purple_account_get_presence(account); message = purple_status_get_attr_string(status, "message"); @@ -253,7 +256,7 @@ bonjour_set_status(PurpleAccount *account, PurpleStatus *status) * if there is no add_buddy callback. */ static void -bonjour_fake_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) { +bonjour_fake_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { purple_debug_error("bonjour", "Buddy '%s' manually added; removing. " "Bonjour buddies must be discovered and not manually added.\n", purple_buddy_get_name(buddy)); @@ -306,7 +309,7 @@ bonjour_status_types(PurpleAccount *account) static void bonjour_convo_closed(PurpleConnection *connection, const char *who) { - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); + PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(connection), who); BonjourBuddy *bb; if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL) @@ -325,7 +328,7 @@ bonjour_convo_closed(PurpleConnection *connection, const char *who) static void bonjour_set_buddy_icon(PurpleConnection *conn, PurpleStoredImage *img) { - BonjourData *bd = conn->proto_data; + BonjourData *bd = purple_connection_get_protocol_data(conn); bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data); } @@ -436,7 +439,7 @@ bonjour_do_group_change(PurpleBuddy *buddy, const char *new_group) { static void bonjour_group_buddy(PurpleConnection *connection, const char *who, const char *old_group, const char *new_group) { - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); + PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(connection), who); bonjour_do_group_change(buddy, new_group); @@ -461,7 +464,7 @@ bonjour_rename_group(PurpleConnection *connection, const char *old_name, PurpleG static gboolean bonjour_can_receive_file(PurpleConnection *connection, const char *who) { - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); + PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(connection), who); return (buddy != NULL && purple_buddy_get_protocol_data(buddy) != NULL); } @@ -481,6 +484,7 @@ static PurplePlugin *my_protocol = NULL; static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_NO_PASSWORD, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -521,7 +525,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ bonjour_group_buddy, /* group_buddy */ bonjour_rename_group, /* rename_group */ @@ -546,15 +549,12 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c index 3042dbf18c..4d08badd0e 100644 --- a/libpurple/protocols/bonjour/bonjour_ft.c +++ b/libpurple/protocols/bonjour/bonjour_ft.c @@ -38,7 +38,7 @@ static void bonjour_xfer_init(PurpleXfer *xfer); static void bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, - const int filesize, const char *filename, int option); + const goffset filesize, const char *filename, int option); static void bonjour_free_xfer(PurpleXfer *xfer); /* Look for specific xfer handle */ @@ -90,12 +90,12 @@ static void bonjour_xfer_cancel_send(PurpleXfer *xfer) static void bonjour_xfer_request_denied(PurpleXfer *xfer) { - XepXfer *xf = xfer->data; + XepXfer *xf = purple_xfer_get_protocol_data(xfer); purple_debug_info("bonjour", "Bonjour-xfer-request-denied.\n"); if(xf) - xep_ft_si_reject(xf->data, xf->sid, xfer->who, "403", "cancel"); + xep_ft_si_reject(xf->data, xf->sid, purple_xfer_get_remote_user(xfer), "403", "cancel"); bonjour_free_xfer(xfer); } @@ -136,8 +136,8 @@ static void bonjour_xfer_end(PurpleXfer *xfer) * otherwise there is a RST resulting in an error on the client side */ if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && purple_xfer_is_completed(xfer)) { struct socket_cleanup *sc = g_new0(struct socket_cleanup, 1); - sc->fd = xfer->fd; - xfer->fd = -1; + sc->fd = purple_xfer_get_fd(xfer); + purple_xfer_set_fd(xfer, -1); sc->handle = purple_input_add(sc->fd, PURPLE_INPUT_READ, _wait_for_socket_close, sc); } @@ -162,11 +162,11 @@ bonjour_si_xfer_find(BonjourData *bd, const char *sid, const char *from) xfer = xfers->data; if(xfer == NULL) break; - xf = xfer->data; + xf = purple_xfer_get_protocol_data(xfer); if(xf == NULL) break; - if(xf->sid && xfer->who && !strcmp(xf->sid, sid) && - !strcmp(xfer->who, from)) + if(xf->sid && purple_xfer_get_remote_user(xfer) && !strcmp(xf->sid, sid) && + !strcmp(purple_xfer_get_remote_user(xfer), from)) return xfer; } @@ -180,7 +180,7 @@ xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) { xmlnode *si_node, *feature, *field, *file, *x; XepIq *iq; - XepXfer *xf = xfer->data; + XepXfer *xf = purple_xfer_get_protocol_data(xfer); BonjourData *bd = NULL; char buf[32]; @@ -210,8 +210,8 @@ xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) file = xmlnode_new_child(si_node, "file"); xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); - xmlnode_set_attrib(file, "name", xfer->filename); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); + xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); + g_snprintf(buf, sizeof(buf), "%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); xmlnode_set_attrib(file, "size", buf); feature = xmlnode_new_child(si_node, "feature"); @@ -240,7 +240,7 @@ xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) } static void -xep_ft_si_result(PurpleXfer *xfer, char *to) +xep_ft_si_result(PurpleXfer *xfer, const char *to) { xmlnode *si_node, *feature, *field, *value, *x; XepIq *iq; @@ -249,7 +249,7 @@ xep_ft_si_result(PurpleXfer *xfer, char *to) if(!to || !xfer) return; - xf = xfer->data; + xf = purple_xfer_get_protocol_data(xfer); if(!xf) return; @@ -290,14 +290,14 @@ bonjour_free_xfer(PurpleXfer *xfer) return; } - purple_debug_info("bonjour", "bonjour-free-xfer-%p.\n", xfer); + purple_debug_misc("bonjour", "bonjour-free-xfer-%p.\n", xfer); - xf = (XepXfer*)xfer->data; + xf = purple_xfer_get_protocol_data(xfer); if(xf != NULL) { BonjourData *bd = (BonjourData*)xf->data; if(bd != NULL) { bd->xfer_lists = g_slist_remove(bd->xfer_lists, xfer); - purple_debug_info("bonjour", "B free xfer from lists(%p).\n", bd->xfer_lists); + purple_debug_misc("bonjour", "B free xfer from lists(%p).\n", bd->xfer_lists); } if (xf->proxy_connection != NULL) purple_proxy_connect_cancel(xf->proxy_connection); @@ -311,10 +311,10 @@ bonjour_free_xfer(PurpleXfer *xfer) g_free(xf->buddy_ip); g_free(xf->sid); g_free(xf); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } - purple_debug_info("bonjour", "Need close socket=%d.\n", xfer->fd); + purple_debug_misc("bonjour", "Need close socket.\n"); } PurpleXfer * @@ -328,13 +328,14 @@ bonjour_new_xfer(PurpleConnection *gc, const char *who) return NULL; purple_debug_info("bonjour", "Bonjour-new-xfer to %s.\n", who); - bd = (BonjourData*) gc->proto_data; + bd = purple_connection_get_protocol_data(gc); if(bd == NULL) return NULL; /* Build the file transfer handle */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - xfer->data = xep_xfer = g_new0(XepXfer, 1); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); + xep_xfer = g_new0(XepXfer, 1); + purple_xfer_set_protocol_data(xfer, xep_xfer); xep_xfer->data = bd; purple_debug_info("bonjour", "Bonjour-new-xfer bd=%p data=%p.\n", bd, xep_xfer->data); @@ -379,13 +380,13 @@ bonjour_xfer_init(PurpleXfer *xfer) BonjourBuddy *bb; XepXfer *xf; - xf = (XepXfer*)xfer->data; + xf = purple_xfer_get_protocol_data(xfer); if(xf == NULL) return; purple_debug_info("bonjour", "Bonjour-xfer-init.\n"); - buddy = purple_find_buddy(xfer->account, xfer->who); + buddy = purple_find_buddy(purple_xfer_get_account(xfer), purple_xfer_get_remote_user(xfer)); /* this buddy is offline. */ if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL) return; @@ -396,10 +397,10 @@ bonjour_xfer_init(PurpleXfer *xfer) if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { /* initiate file transfer, send SI offer. */ purple_debug_info("bonjour", "Bonjour xfer type is PURPLE_XFER_SEND.\n"); - xep_ft_si_offer(xfer, xfer->who); + xep_ft_si_offer(xfer, purple_xfer_get_remote_user(xfer)); } else { /* accept file transfer request, send SI result. */ - xep_ft_si_result(xfer, xfer->who); + xep_ft_si_result(xfer, purple_xfer_get_remote_user(xfer)); purple_debug_info("bonjour", "Bonjour xfer type is PURPLE_XFER_RECEIVE.\n"); } } @@ -416,7 +417,7 @@ xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) g_return_if_fail(packet != NULL); g_return_if_fail(pb != NULL); - bd = (BonjourData*) pc->proto_data; + bd = purple_connection_get_protocol_data(pc); if(bd == NULL) return; @@ -426,83 +427,178 @@ xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) type = xmlnode_get_attrib(packet, "type"); id = xmlnode_get_attrib(packet, "id"); - if(type) { - if(!strcmp(type, "set")) { - const char *profile; - xmlnode *si; - gboolean parsed_receive = FALSE; + if(!type) + return; + + if(!strcmp(type, "set")) { + const char *profile; + xmlnode *si; + gboolean parsed_receive = FALSE; - si = xmlnode_get_child(packet, "si"); + si = xmlnode_get_child(packet, "si"); - purple_debug_info("bonjour", "si offer Message type - SET.\n"); - if (si && (profile = xmlnode_get_attrib(si, "profile")) - && !strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { - const char *filename = NULL, *filesize_str = NULL; - int filesize = 0; - xmlnode *file; + purple_debug_info("bonjour", "si offer Message type - SET.\n"); + if (si && (profile = xmlnode_get_attrib(si, "profile")) + && !strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { + const char *filename = NULL, *filesize_str = NULL; + int filesize = 0; + xmlnode *file; - const char *sid = xmlnode_get_attrib(si, "id"); + const char *sid = xmlnode_get_attrib(si, "id"); - if ((file = xmlnode_get_child(si, "file"))) { - filename = xmlnode_get_attrib(file, "name"); - if((filesize_str = xmlnode_get_attrib(file, "size"))) - filesize = atoi(filesize_str); - } + if ((file = xmlnode_get_child(si, "file"))) { + filename = xmlnode_get_attrib(file, "name"); + if((filesize_str = xmlnode_get_attrib(file, "size"))) + filesize = atoi(filesize_str); + } - /* TODO: Make sure that it is advertising a bytestreams transfer */ + /* TODO: Make sure that it is advertising a bytestreams transfer */ - if (filename) { - bonjour_xfer_receive(pc, id, sid, name, filesize, filename, XEP_BYTESTREAMS); + if (filename) { + bonjour_xfer_receive(pc, id, sid, name, filesize, filename, XEP_BYTESTREAMS); - parsed_receive = TRUE; - } + parsed_receive = TRUE; } + } - if (!parsed_receive) { - BonjourData *bd = purple_connection_get_protocol_data(pc); + if (!parsed_receive) { + BonjourData *bd = purple_connection_get_protocol_data(pc); - purple_debug_info("bonjour", "rejecting unrecognized si SET offer.\n"); - xep_ft_si_reject(bd, id, name, "403", "cancel"); - /*TODO: Send Cancel (501) */ - } - } else if(!strcmp(type, "result")) { - purple_debug_info("bonjour", "si offer Message type - RESULT.\n"); + purple_debug_info("bonjour", "rejecting unrecognized si SET offer.\n"); + xep_ft_si_reject(bd, id, name, "403", "cancel"); + /*TODO: Send Cancel (501) */ + } + } else if(!strcmp(type, "result")) { + purple_debug_info("bonjour", "si offer Message type - RESULT.\n"); - xfer = bonjour_si_xfer_find(bd, id, name); + xfer = bonjour_si_xfer_find(bd, id, name); - if(xfer == NULL) { - BonjourData *bd = purple_connection_get_protocol_data(pc); - purple_debug_info("bonjour", "xfer find fail.\n"); - xep_ft_si_reject(bd, id, name, "403", "cancel"); - } else - bonjour_bytestreams_init(xfer); + if(xfer == NULL) { + BonjourData *bd = purple_connection_get_protocol_data(pc); + purple_debug_info("bonjour", "xfer find fail.\n"); + xep_ft_si_reject(bd, id, name, "403", "cancel"); + } else + bonjour_bytestreams_init(xfer); - } else if(!strcmp(type, "error")) { - purple_debug_info("bonjour", "si offer Message type - ERROR.\n"); + } else if(!strcmp(type, "error")) { + purple_debug_info("bonjour", "si offer Message type - ERROR.\n"); - xfer = bonjour_si_xfer_find(bd, id, name); + xfer = bonjour_si_xfer_find(bd, id, name); - if(xfer == NULL) - purple_debug_info("bonjour", "xfer find fail.\n"); - else - purple_xfer_cancel_remote(xfer); - } else - purple_debug_info("bonjour", "si offer Message type - Unknown-%s.\n", type); + if(xfer == NULL) + purple_debug_info("bonjour", "xfer find fail.\n"); + else + purple_xfer_cancel_remote(xfer); + } else + purple_debug_info("bonjour", "si offer Message type - Unknown-%s.\n", type); +} + +/** + * Will compare a host with a buddy_ip. + * + * Additionally to a common '!strcmp(host, buddy_ip)', it will also return TRUE + * if 'host' is a link local IPv6 address without an appended interface + * identifier and 'buddy_ip' string is "host" + "%iface". + * + * Note: This may theoretically result in the attempt to connect to the wrong + * host, because we do not know for sure which interface the according link + * local IPv6 address might relate to and RFC4862 for instance only ensures the + * uniqueness of this address on a given link. So we could possibly have two + * distinct buddies with the same ipv6 link local address on two distinct + * interfaces. Unfortunately XEP-0065 does not seem to specify how to deal with + * link local ip addresses properly... + * However, in practice the possiblity for such a conflict is relatively low + * (2011 - might be different in the future though?). + * + * @param host ipv4 or ipv6 address string + * @param buddy_ip ipv4 or ipv6 address string + * @return TRUE if they match, FALSE otherwise + */ +static gboolean +xep_cmp_addr(const char *host, const char *buddy_ip) +{ +#if defined(AF_INET6) && defined(HAVE_GETADDRINFO) + struct addrinfo hint, *res = NULL; + int ret; + + memset(&hint, 0, sizeof(hint)); + hint.ai_family = AF_UNSPEC; + hint.ai_flags = AI_NUMERICHOST; + + ret = getaddrinfo(host, NULL, &hint, &res); + if(ret) + goto out; + + if(res->ai_family != AF_INET6 || + !IN6_IS_ADDR_LINKLOCAL(&((struct sockaddr_in6 *)res->ai_addr)->sin6_addr)) { + freeaddrinfo(res); + goto out; } + freeaddrinfo(res); + + if(strlen(buddy_ip) <= strlen(host) || + buddy_ip[strlen(host)] != '%') + return FALSE; + + return !strncmp(host, buddy_ip, strlen(host)); + +out: +#endif + return !strcmp(host, buddy_ip); +} + +static gboolean +__xep_bytestreams_parse(PurpleBuddy *pb, PurpleXfer *xfer, xmlnode *query, + const char *iq_id) +{ + const char *jid, *host, *port; + int portnum; + xmlnode *streamhost; + XepXfer *xf = purple_xfer_get_protocol_data(xfer); + + for(streamhost = xmlnode_get_child(query, "streamhost"); + streamhost; + streamhost = xmlnode_get_next_twin(streamhost)) { + + if(!(jid = xmlnode_get_attrib(streamhost, "jid")) || + !(host = xmlnode_get_attrib(streamhost, "host")) || + !(port = xmlnode_get_attrib(streamhost, "port")) || + !(portnum = atoi(port))) { + purple_debug_info("bonjour", "bytestream offer Message parse error.\n"); + continue; + } + + if(!xep_cmp_addr(host, xf->buddy_ip)) + continue; + + g_free(xf->iq_id); + xf->iq_id = g_strdup(iq_id); + xf->jid = g_strdup(jid); + xf->proxy_host = g_strdup(xf->buddy_ip); + xf->proxy_port = portnum; + purple_debug_info("bonjour", "bytestream offer parse" + "jid=%s host=%s port=%d.\n", jid, host, portnum); + bonjour_bytestreams_connect(xfer, pb); + return TRUE; + } + + return FALSE; } + void xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) { - const char *type, *from; + const char *type, *from, *iq_id, *sid; xmlnode *query; BonjourData *bd; + PurpleXfer *xfer; g_return_if_fail(pc != NULL); g_return_if_fail(packet != NULL); g_return_if_fail(pb != NULL); - bd = (BonjourData*) pc->proto_data; + bd = purple_connection_get_protocol_data(pc); if(bd == NULL) return; @@ -511,71 +607,32 @@ xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) type = xmlnode_get_attrib(packet, "type"); from = purple_buddy_get_name(pb); query = xmlnode_get_child(packet,"query"); - if(type) { - if(!strcmp(type, "set")) { - const char *iq_id, *sid; - gboolean found = FALSE; - PurpleXfer *xfer; - - purple_debug_info("bonjour", "bytestream offer Message type - SET.\n"); - - iq_id = xmlnode_get_attrib(packet, "id"); - - sid = xmlnode_get_attrib(query, "sid"); - xfer = bonjour_si_xfer_find(bd, sid, from); - - if(xfer) { - const char *jid, *host, *port; - xmlnode *streamhost; - int portnum; - XepXfer *xf = NULL; - - xf = (XepXfer*)xfer->data; - for(streamhost = xmlnode_get_child(query, "streamhost"); - streamhost; - streamhost = xmlnode_get_next_twin(streamhost)) { - - if((jid = xmlnode_get_attrib(streamhost, "jid")) && - (host = xmlnode_get_attrib(streamhost, "host")) && - (port = xmlnode_get_attrib(streamhost, "port")) && - (portnum = atoi(port))) { - - if(!strcmp(host, xf->buddy_ip)) { - g_free(xf->iq_id); - xf->iq_id = g_strdup(iq_id); - xf->jid = g_strdup(jid); - xf->proxy_host = g_strdup(host); - xf->proxy_port = portnum; - purple_debug_info("bonjour", "bytestream offer parse" - "jid=%s host=%s port=%d.\n", jid, host, portnum); - bonjour_bytestreams_connect(xfer, pb); - found = TRUE; - break; - } - } else { - purple_debug_info("bonjour", "bytestream offer Message parse error.\n"); - } - } - } else { + if(!type) + return; - } + if(strcmp(type, "set")) { + purple_debug_info("bonjour", "bytestream offer Message type - Unknown-%s.\n", type); + return; + } - if (!found) { - purple_debug_error("bonjour", "Didn't find an acceptable streamhost.\n"); + purple_debug_info("bonjour", "bytestream offer Message type - SET.\n"); - if (iq_id && xfer != NULL) - xep_ft_si_reject(bd, iq_id, xfer->who, "404", "cancel"); - } + iq_id = xmlnode_get_attrib(packet, "id"); - } else { - purple_debug_info("bonjour", "bytestream offer Message type - Unknown-%s.\n", type); - } - } + sid = xmlnode_get_attrib(query, "sid"); + xfer = bonjour_si_xfer_find(bd, sid, from); + if(xfer && __xep_bytestreams_parse(pb, xfer, query, iq_id)) + return; /* success */ + + purple_debug_error("bonjour", "Didn't find an acceptable streamhost.\n"); + + if (iq_id && xfer != NULL) + xep_ft_si_reject(bd, iq_id, xfer->who, "404", "cancel"); } static void bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, - const int filesize, const char *filename, int option) + const goffset filesize, const char *filename, int option) { PurpleXfer *xfer; XepXfer *xf; @@ -584,15 +641,16 @@ bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, cons if(pc == NULL || id == NULL || from == NULL) return; - bd = (BonjourData*) pc->proto_data; + bd = purple_connection_get_protocol_data(pc); if(bd == NULL) return; purple_debug_info("bonjour", "bonjour-xfer-receive.\n"); /* Build the file transfer handle */ - xfer = purple_xfer_new(pc->account, PURPLE_XFER_RECEIVE, from); - xfer->data = xf = g_new0(XepXfer, 1); + xfer = purple_xfer_new(purple_connection_get_account(pc), PURPLE_XFER_RECEIVE, from); + xf = g_new0(XepXfer, 1); + purple_xfer_set_protocol_data(xfer, xf); xf->data = bd; purple_xfer_set_filename(xfer, filename); xf->iq_id = g_strdup(id); @@ -614,7 +672,7 @@ static void bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - XepXfer *xf = xfer->data; + XepXfer *xf = purple_xfer_get_protocol_data(xfer); int acceptfd; int len = 0; @@ -632,8 +690,6 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) /* This should cancel the ft */ purple_debug_error("bonjour", "Error accepting incoming SOCKS5 connection. (%d)\n", errno); - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; @@ -648,29 +704,26 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) fcntl(acceptfd, F_SETFD, FD_CLOEXEC); #endif - purple_input_remove(xfer->watcher); + purple_input_remove(purple_xfer_get_watcher(xfer)); close(source); - xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(acceptfd, PURPLE_INPUT_READ, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; } break; case 0x01: - xfer->fd = source; + purple_xfer_set_fd(xfer, source); len = read(source, xf->rx_buf + xf->rxlen, 3); if(len < 0 && errno == EAGAIN) return; else if(len <= 0){ - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); purple_xfer_cancel_remote(xfer); return; } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - bonjour_sock5_request_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); @@ -683,15 +736,13 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) if (len < 0 && errno == EAGAIN) return; else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_READ, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; } @@ -700,9 +751,9 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) len = read(source, xf->rx_buf + xf->rxlen, 20); if(len<=0){ } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - bonjour_sock5_request_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, + bonjour_sock5_request_cb, xfer)); xf->sock5_req_state++; xf->rxlen = 0; bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); @@ -721,14 +772,12 @@ bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) if (len < 0 && errno == EAGAIN) { return; } else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; } else { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); xf->rxlen = 0; /*close(source);*/ purple_xfer_start(xfer, source, NULL, -1); @@ -757,25 +806,25 @@ bonjour_bytestreams_listen(int sock, gpointer data) return; } - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); - xf = (XepXfer*)xfer->data; + purple_xfer_set_watcher(xfer, purple_input_add(sock, PURPLE_INPUT_READ, + bonjour_sock5_request_cb, xfer)); + xf = purple_xfer_get_protocol_data(xfer); xf->listen_data = NULL; bd = xf->data; - iq = xep_iq_new(bd, XEP_IQ_SET, xfer->who, bonjour_get_jid(bd->jabber_data->account), xf->sid); + iq = xep_iq_new(bd, XEP_IQ_SET, purple_xfer_get_remote_user(xfer), bonjour_get_jid(bd->jabber_data->account), xf->sid); query = xmlnode_new_child(iq->node, "query"); xmlnode_set_namespace(query, "http://jabber.org/protocol/bytestreams"); xmlnode_set_attrib(query, "sid", xf->sid); xmlnode_set_attrib(query, "mode", "tcp"); - xfer->local_port = purple_network_get_port_from_fd(sock); + purple_xfer_set_local_port(xfer, purple_network_get_port_from_fd(sock)); local_ips = bonjour_jabber_get_local_ips(sock); - port = g_strdup_printf("%hu", xfer->local_port); + port = g_strdup_printf("%hu", purple_xfer_get_local_port(xfer)); while(local_ips) { streamhost = xmlnode_new_child(query, "streamhost"); xmlnode_set_attrib(streamhost, "jid", xf->sid); @@ -797,12 +846,10 @@ bonjour_bytestreams_init(PurpleXfer *xfer) return; purple_debug_info("bonjour", "Bonjour-bytestreams-init.\n"); - xf = xfer->data; + xf = purple_xfer_get_protocol_data(xfer); - purple_network_listen_map_external(FALSE); - xf->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, + xf->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, FALSE, bonjour_bytestreams_listen, xfer); - purple_network_listen_map_external(TRUE); if (xf->listen_data == NULL) purple_xfer_cancel_local(xfer); @@ -813,7 +860,7 @@ static void bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) { PurpleXfer *xfer = data; - XepXfer *xf = xfer->data; + XepXfer *xf = purple_xfer_get_protocol_data(xfer); XepIq *iq; xmlnode *q_node, *tmp_node; BonjourData *bd; @@ -823,7 +870,7 @@ bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_me if(source < 0) { purple_debug_error("bonjour", "Error connecting via SOCKS5 - %s\n", error_message ? error_message : "(null)"); - xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel"); + xep_ft_si_reject(xf->data, xf->iq_id, purple_xfer_get_remote_user(xfer), "404", "cancel"); /* Cancel the connection */ purple_xfer_cancel_local(xfer); return; @@ -836,7 +883,7 @@ bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_me /* Here, start the file transfer.*/ /* Notify Initiator of Connection */ - iq = xep_iq_new(bd, XEP_IQ_RESULT, xfer->who, bonjour_get_jid(bd->jabber_data->account), xf->iq_id); + iq = xep_iq_new(bd, XEP_IQ_RESULT, purple_xfer_get_remote_user(xfer), bonjour_get_jid(bd->jabber_data->account), xf->iq_id); q_node = xmlnode_new_child(iq->node, "query"); xmlnode_set_namespace(q_node, "http://jabber.org/protocol/bytestreams"); tmp_node = xmlnode_new_child(q_node, "streamhost-used"); @@ -862,7 +909,7 @@ bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb) purple_debug_info("bonjour", "bonjour-bytestreams-connect.\n"); - xf = (XepXfer*)xfer->data; + xf = purple_xfer_get_protocol_data(xfer); if(!xf) return; @@ -891,7 +938,7 @@ bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb) bonjour_bytestreams_connect_cb, xfer); if(xf->proxy_connection == NULL) { - xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel"); + xep_ft_si_reject(xf->data, xf->iq_id, purple_xfer_get_remote_user(xfer), "404", "cancel"); /* Cancel the connection */ purple_xfer_cancel_local(xfer); } diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index 455d1f2af3..a750e07260 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -206,7 +206,9 @@ _jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb) g_string_append_printf(str, " face='%s'", font_face); if (font_size) g_string_append_printf(str, " size='%s'", font_size); - if (ichat_text_color) + if (font_color) + g_string_append_printf(str, " color='%s'", font_color); + else if (ichat_text_color) g_string_append_printf(str, " color='%s'", ichat_text_color); if (ichat_balloon_color) g_string_append_printf(str, " back='%s'", ichat_balloon_color); @@ -665,9 +667,13 @@ _server_socket_handler(gpointer data, int server_socket, PurpleInputCondition co /* Look for the buddy that has opened the conversation and fill information */ #ifdef HAVE_INET_NTOP - if (their_addr.ss_family == AF_INET6) + if (their_addr.ss_family == AF_INET6) { address_text = inet_ntop(their_addr.ss_family, &((struct sockaddr_in6 *)&their_addr)->sin6_addr, addrstr, sizeof(addrstr)); + + append_iface_if_linklocal(addrstr, + ((struct sockaddr_in6 *)&their_addr)->sin6_scope_id); + } else address_text = inet_ntop(their_addr.ss_family, &((struct sockaddr_in *)&their_addr)->sin_addr, addrstr, sizeof(addrstr)); @@ -744,7 +750,7 @@ start_serversocket_listening(int port, int socket, struct sockaddr *addr, size_t #if 0 /* TODO: Why isn't this being used? */ - data->socket = purple_network_listen(jdata->port, SOCK_STREAM); + data->socket = purple_network_listen(jdata->port, AF_UNSPEC, SOCK_STREAM, TRUE); if (jdata->socket == -1) { @@ -929,7 +935,9 @@ bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { while(tmp) { ip = tmp->data; if (ip != NULL && g_ascii_strcasecmp(ip, bconv->ip) == 0) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; + PurpleConnection *pc = purple_account_get_connection(bconv->account); + BonjourData *bd = purple_connection_get_protocol_data(pc); + BonjourJabber *jdata = bd->jabber_data; purple_debug_info("bonjour", "Matched buddy %s to incoming conversation \"from\" attrib and IP (%s)\n", purple_buddy_get_name(pb), bconv->ip); @@ -962,7 +970,9 @@ bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { void bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; + PurpleConnection *pc = purple_account_get_connection(bconv->account); + BonjourData *bd = purple_connection_get_protocol_data(pc); + BonjourJabber *jdata = bd->jabber_data; struct _match_buddies_by_address_t *mbba; GSList *buddies; @@ -1122,7 +1132,9 @@ _async_bonjour_jabber_close_conversation_cb(gpointer data) { void async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; + PurpleConnection *pc = purple_account_get_connection(bconv->account); + BonjourData *bd = purple_connection_get_protocol_data(pc); + BonjourJabber *jdata = bd->jabber_data; jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); @@ -1142,8 +1154,9 @@ bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) if (bconv != NULL) { BonjourData *bd = NULL; - if(PURPLE_CONNECTION_IS_VALID(bconv->account->gc)) { - bd = bconv->account->gc->proto_data; + PurpleConnection *pc = purple_account_get_connection(bconv->account); + if (PURPLE_CONNECTION_IS_VALID(pc)) { + bd = purple_connection_get_protocol_data(pc); bd->jabber_data->pending_conversations = g_slist_remove(bd->jabber_data->pending_conversations, bconv); } @@ -1157,7 +1170,7 @@ bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) tmp_next = xfers->next; /* We only need to cancel this if it hasn't actually started transferring. */ /* This will change if we ever support IBB transfers. */ - if (strcmp(xfer->who, purple_buddy_get_name(bconv->pb)) == 0 + if (strcmp(purple_xfer_get_remote_user(xfer), purple_buddy_get_name(bconv->pb)) == 0 && (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_NOT_STARTED || purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_UNKNOWN)) { purple_xfer_cancel_remote(xfer); @@ -1215,7 +1228,7 @@ bonjour_jabber_stop(BonjourJabber *jdata) purple_input_remove(jdata->watcher_id6); /* Close all the conversation sockets and remove all the watchers after sending end streams */ - if (jdata->account->gc != NULL) { + if (!purple_account_is_disconnected(jdata->account)) { GSList *buddies, *l; buddies = purple_find_buddies(jdata->account, NULL); @@ -1442,3 +1455,19 @@ bonjour_jabber_get_local_ips(int fd) return ips; } + +void +append_iface_if_linklocal(char *ip, guint32 interface_param) { + struct in6_addr in6_addr; + int len_remain = INET6_ADDRSTRLEN - strlen(ip); + + if (len_remain <= 1) + return; + + if (inet_pton(AF_INET6, ip, &in6_addr) != 1 || + !IN6_IS_ADDR_LINKLOCAL(&in6_addr)) + return; + + snprintf(ip + strlen(ip), len_remain, "%%%d", + interface_param); +} diff --git a/libpurple/protocols/bonjour/jabber.h b/libpurple/protocols/bonjour/jabber.h index 4b406000ff..4096497008 100644 --- a/libpurple/protocols/bonjour/jabber.h +++ b/libpurple/protocols/bonjour/jabber.h @@ -111,4 +111,6 @@ XepIq *xep_iq_new(void *data, XepIqType type, const char *to, const char *from, int xep_iq_send_and_free(XepIq *iq); GSList * bonjour_jabber_get_local_ips(int fd); +void append_iface_if_linklocal(char *ip, guint32 interface_param); + #endif /* _BONJOUR_JABBER_H_ */ diff --git a/libpurple/protocols/bonjour/mdns_avahi.c b/libpurple/protocols/bonjour/mdns_avahi.c index c402e056de..07dc63e161 100644 --- a/libpurple/protocols/bonjour/mdns_avahi.c +++ b/libpurple/protocols/bonjour/mdns_avahi.c @@ -179,6 +179,9 @@ _resolver_callback(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiProtoco ip[0] = '\0'; avahi_address_snprint(ip, AVAHI_ADDRESS_STR_MAX, a); + if (protocol == AVAHI_PROTO_INET6) + append_iface_if_linklocal(ip, interface); + purple_debug_info("bonjour", "_resolve_callback - name:%s ip:%s prev_ip:%s\n", name, ip, rd->ip); @@ -190,7 +193,7 @@ _resolver_callback(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiProtoco } /* IPv6 goes at the front of the list and IPv4 at the end so that we "prefer" IPv6, if present */ if (protocol == AVAHI_PROTO_INET6) { - rd->ip = g_strdup_printf("%s%%%d", ip, interface); + rd->ip = g_strdup_printf("%s", ip); bb->ips = g_slist_prepend(bb->ips, (gchar *) rd->ip); } else { rd->ip = g_strdup(ip); @@ -615,7 +618,7 @@ void _mdns_delete_buddy(BonjourBuddy *buddy) { void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) { PurpleConnection *conn = purple_account_get_connection(buddy->account); - BonjourData *bd = conn->proto_data; + BonjourData *bd = purple_connection_get_protocol_data(conn); AvahiSessionImplData *session_idata = bd->dns_sd_data->mdns_impl_data; AvahiBuddyImplData *idata = buddy->mdns_impl_data; gchar *name; diff --git a/libpurple/protocols/bonjour/mdns_common.c b/libpurple/protocols/bonjour/mdns_common.c index 9319e36160..1f87b6496e 100644 --- a/libpurple/protocols/bonjour/mdns_common.c +++ b/libpurple/protocols/bonjour/mdns_common.c @@ -257,7 +257,7 @@ void bonjour_dns_sd_set_jid(PurpleAccount *account, const char *hostname) { PurpleConnection *conn = purple_account_get_connection(account); - BonjourData *bd = conn->proto_data; + BonjourData *bd = purple_connection_get_protocol_data(conn); const char *tmp, *account_name = purple_account_get_username(account); /* Previously we allowed the hostname part of the jid to be set diff --git a/libpurple/protocols/bonjour/mdns_win32.c b/libpurple/protocols/bonjour/mdns_win32.c index 5822a9a7be..d7ee2e8e86 100644 --- a/libpurple/protocols/bonjour/mdns_win32.c +++ b/libpurple/protocols/bonjour/mdns_win32.c @@ -177,7 +177,7 @@ _mdns_resolve_host_callback(DNSServiceRef sdRef, DNSServiceFlags flags, args->resolver_query = NULL; if ((pb = purple_find_buddy(args->account, args->res_data->name))) { - if (pb->proto_data != args->bb) { + if (purple_buddy_get_protocol_data(pb) != args->bb) { purple_debug_error("bonjour", "Found purple buddy for %s not matching bonjour buddy record.", args->res_data->name); goto cleanup; @@ -348,7 +348,7 @@ _mdns_service_browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32 /* Is there an existing buddy? */ if ((pb = purple_find_buddy(account, serviceName))) - bb = pb->proto_data; + bb = purple_buddy_get_protocol_data(pb); /* Is there a pending buddy? */ else { while (tmp) { @@ -368,7 +368,7 @@ _mdns_service_browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32 if (pb == NULL) pending_buddies = g_slist_prepend(pending_buddies, bb); else - pb->proto_data = bb; + purple_buddy_set_protocol_data(pb, bb); } rd = g_new0(Win32SvcResolverData, 1); @@ -408,7 +408,7 @@ _mdns_service_browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32 GSList *l; /* There may be multiple presences, we should only get rid of this one */ Win32SvcResolverData *rd_search; - BonjourBuddy *bb = pb->proto_data; + BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); Win32BuddyImplData *idata; g_return_if_fail(bb != NULL); diff --git a/libpurple/protocols/gg/Makefile.am b/libpurple/protocols/gg/Makefile.am index 277c20de26..de65da176c 100644 --- a/libpurple/protocols/gg/Makefile.am +++ b/libpurple/protocols/gg/Makefile.am @@ -1,5 +1,7 @@ EXTRA_DIST = \ Makefile.mingw \ + win32-resolver.c \ + win32-resolver.h \ lib/common.c \ lib/compat.h \ lib/COPYING \ @@ -61,11 +63,11 @@ INTGGSOURCES = \ lib/sha1.c INTGG_CFLAGS = -I$(top_srcdir)/libpurple/protocols/gg/lib -DGG_IGNORE_DEPRECATED -DUSE_INTERNAL_LIBGADU +endif if USE_GNUTLS GADU_LIBS += $(GNUTLS_LIBS) -endif - +GADU_CFLAGS += $(GNUTLS_CFLAGS) endif GGSOURCES = \ diff --git a/libpurple/protocols/gg/Makefile.mingw b/libpurple/protocols/gg/Makefile.mingw index 9ac7833657..5531c14728 100644 --- a/libpurple/protocols/gg/Makefile.mingw +++ b/libpurple/protocols/gg/Makefile.mingw @@ -60,7 +60,8 @@ C_SRC = \ confer.c \ gg.c \ search.c \ - gg-utils.c + gg-utils.c \ + win32-resolver.c OBJECTS = $(C_SRC:%.c=%.o) diff --git a/libpurple/protocols/gg/buddylist.c b/libpurple/protocols/gg/buddylist.c index 7ed9439f4e..4aefe8093e 100644 --- a/libpurple/protocols/gg/buddylist.c +++ b/libpurple/protocols/gg/buddylist.c @@ -38,7 +38,7 @@ /* void ggp_buddylist_send(PurpleConnection *gc) {{{ */ void ggp_buddylist_send(PurpleConnection *gc) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); GSList *buddies; uin_t *userlist; diff --git a/libpurple/protocols/gg/confer.c b/libpurple/protocols/gg/confer.c index dad03d6518..1f2530a8fb 100644 --- a/libpurple/protocols/gg/confer.c +++ b/libpurple/protocols/gg/confer.c @@ -42,7 +42,7 @@ void ggp_confer_participants_add_uin(PurpleConnection *gc, const gchar *chat_nam const uin_t uin) { PurpleConversation *conv; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPChat *chat; GList *l; gchar *str_uin; @@ -73,7 +73,7 @@ void ggp_confer_participants_add_uin(PurpleConnection *gc, const gchar *chat_nam void ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name, const uin_t *recipients, int count) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GList *l; gchar *str_uin; @@ -111,7 +111,7 @@ void ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name, const char *ggp_confer_find_by_participants(PurpleConnection *gc, const uin_t *recipients, int count) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPChat *chat = NULL; GList *l; int matches; @@ -149,7 +149,7 @@ const char *ggp_confer_find_by_participants(PurpleConnection *gc, /* const char *ggp_confer_add_new(PurpleConnection *gc, const char *name) {{{ */ const char *ggp_confer_add_new(PurpleConnection *gc, const char *name) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPChat *chat; chat = g_new0(GGPChat, 1); diff --git a/libpurple/protocols/gg/gg-utils.c b/libpurple/protocols/gg/gg-utils.c index 96e3b295ce..7c89e155d4 100644 --- a/libpurple/protocols/gg/gg-utils.c +++ b/libpurple/protocols/gg/gg-utils.c @@ -143,5 +143,18 @@ void ggp_status_fake_to_self(PurpleAccount *account) msg ? "message" : NULL, msg, NULL); } +guint ggp_http_input_add(struct gg_http *http_req, PurpleInputFunction func, + gpointer user_data) +{ + PurpleInputCondition cond = 0; + int check = http_req->check; + + if (check & GG_CHECK_READ) + cond |= PURPLE_INPUT_READ; + if (check & GG_CHECK_WRITE) + cond |= PURPLE_INPUT_WRITE; + + return purple_input_add(http_req->fd, cond, func, user_data); +} /* vim: set ts=8 sts=0 sw=8 noet: */ diff --git a/libpurple/protocols/gg/gg-utils.h b/libpurple/protocols/gg/gg-utils.h index 48e8188250..7c7b800263 100644 --- a/libpurple/protocols/gg/gg-utils.h +++ b/libpurple/protocols/gg/gg-utils.h @@ -101,6 +101,21 @@ void ggp_status_fake_to_self(PurpleAccount *account); +/** + * Adds an input handler in purple event loop for http request. + * + * @see purple_input_add + * + * @param http_req Http connection to watch. + * @param func The callback function for data. + * @param user_data User-specified data. + * + * @return The resulting handle (will be greater than 0). + */ +guint +ggp_http_input_add(struct gg_http *http_req, PurpleInputFunction func, + gpointer user_data); + #endif /* _PURPLE_GG_UTILS_H */ /* vim: set ts=8 sts=0 sw=8 noet: */ diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c index 5f859ca76a..140d0be586 100644 --- a/libpurple/protocols/gg/gg.c +++ b/libpurple/protocols/gg/gg.c @@ -39,14 +39,16 @@ #include "request.h" #include "xmlnode.h" -#include - #include "gg.h" #include "confer.h" #include "search.h" #include "buddylist.h" #include "gg-utils.h" +#ifdef _WIN32 +# include "win32-resolver.h" +#endif + static PurplePlugin *my_protocol = NULL; /* Prototypes */ @@ -97,7 +99,7 @@ static int ggp_setup_proxy(PurpleAccount *account) static void ggp_async_token_handler(gpointer _gc, gint fd, PurpleInputCondition cond) { PurpleConnection *gc = _gc; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPToken *token = info->token; GGPTokenCallback cb; @@ -170,7 +172,7 @@ static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb) if (ggp_setup_proxy(account) == -1) return; - info = gc->proto_data; + info = purple_connection_get_protocol_data(gc); if ((req = gg_token(1)) == NULL) { purple_notify_error(account, @@ -199,7 +201,7 @@ static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb) static void ggp_action_buddylist_get(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); purple_debug_info("gg", "Downloading...\n"); @@ -214,7 +216,7 @@ static void ggp_action_buddylist_get(PurplePluginAction *action) static void ggp_action_buddylist_put(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); char *buddylist = ggp_buddylist_dump(purple_connection_get_account(gc)); @@ -235,7 +237,7 @@ static void ggp_action_buddylist_put(PurplePluginAction *action) static void ggp_action_buddylist_delete(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); purple_debug_info("gg", "Deleting...\n"); @@ -334,7 +336,7 @@ static void ggp_callback_register_account_ok(PurpleConnection *gc, PurpleRequestFields *fields) { PurpleAccount *account; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); struct gg_http *h = NULL; struct gg_pubdir *s; uin_t uin; @@ -389,8 +391,8 @@ static void ggp_callback_register_account_ok(PurpleConnection *gc, purple_notify_info(NULL, _("New Gadu-Gadu Account Registered"), _("Registration completed successfully!"), NULL); - if(account->registration_cb) - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); + purple_account_register_completed(account, TRUE); + /* TODO: the currently open Accounts Window will not be updated withthe * new username and etc, we need to somehow have it refresh at this * point @@ -400,8 +402,7 @@ static void ggp_callback_register_account_ok(PurpleConnection *gc, purple_account_disconnect(account); exit_err: - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); gg_register_free(h); g_free(email); @@ -415,10 +416,10 @@ exit_err: static void ggp_callback_register_account_cancel(PurpleConnection *gc, PurpleRequestFields *fields) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPToken *token = info->token; - purple_account_disconnect(gc->account); + purple_account_disconnect(purple_connection_get_account(gc)); g_free(token->id); g_free(token->data); @@ -433,7 +434,7 @@ static void ggp_register_user_dialog(PurpleConnection *gc) PurpleRequestFieldGroup *group; PurpleRequestField *field; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPToken *token = info->token; @@ -483,7 +484,7 @@ static void ggp_register_user_dialog(PurpleConnection *gc) static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPSearchForm *form = user_data; guint32 seq; @@ -520,7 +521,7 @@ static void ggp_callback_im(PurpleConnection *gc, GList *row, gpointer user_data static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPSearchForm *form; guint32 seq; @@ -616,75 +617,137 @@ static void ggp_find_buddies(PurplePluginAction *action) gc); } -/* ----- CHANGE PASSWORD ------------------------------------------------ */ +/* ----- CHANGE PASSWORD ---------------------------------------------------- */ -static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields) +typedef struct { + guint inpa; + struct gg_http *http_req; + gchar *new_password; PurpleAccount *account; - GGPInfo *info = gc->proto_data; +} ggp_change_passwd_request; + +static void ggp_callback_change_passwd_handler(gpointer _req, gint fd, + PurpleInputCondition cond) +{ + ggp_change_passwd_request *req = _req; + const char *messagesTitle = + _("Change password for the Gadu-Gadu account"); + + purple_input_remove(req->inpa); + + if (gg_change_passwd_watch_fd(req->http_req) == -1 || + req->http_req->state == GG_STATE_ERROR) + goto exit_error; + + if (req->http_req->state != GG_STATE_DONE) + { + req->inpa = ggp_http_input_add(req->http_req, + ggp_callback_change_passwd_handler, req); + return; + } + + if (req->http_req->data != NULL && + ((struct gg_pubdir*)req->http_req->data)->success == 1) + { + purple_account_set_password(req->account, req->new_password); + purple_notify_info(req->account, messagesTitle, + _("Password was changed successfully!"), NULL); + goto exit_cleanup; + } + +exit_error: + purple_notify_error(req->account, messagesTitle, + _("Unable to change password. Error occurred.\n"), NULL); + +exit_cleanup: + gg_change_passwd_free(req->http_req); + g_free(req->new_password); + g_free(req); +} + +static void ggp_callback_change_passwd_ok(PurpleConnection *gc, + PurpleRequestFields *fields) +{ + PurpleAccount *account; + GGPInfo *info = purple_connection_get_protocol_data(gc); struct gg_http *h; - gchar *cur, *p1, *p2, *t; - - cur = charset_convert( - purple_request_fields_get_string(fields, "password_cur"), - "UTF-8", "CP1250"); - p1 = charset_convert( - purple_request_fields_get_string(fields, "password1"), - "UTF-8", "CP1250"); - p2 = charset_convert( - purple_request_fields_get_string(fields, "password2"), - "UTF-8", "CP1250"); - t = charset_convert( - purple_request_fields_get_string(fields, "token"), - "UTF-8", "CP1250"); + gchar *cur, *p1, *p2, *t, *mail; + const char *messagesTitle = + _("Change password for the Gadu-Gadu account"); + + cur = g_strdup(purple_request_fields_get_string(fields, + "password_cur")); + p1 = g_strdup(purple_request_fields_get_string(fields, "password1")); + p2 = g_strdup(purple_request_fields_get_string(fields, "password2")); + t = g_strdup(purple_request_fields_get_string(fields, "token")); + mail = g_strdup(purple_request_fields_get_string(fields, "email")); account = purple_connection_get_account(gc); if (cur == NULL || p1 == NULL || p2 == NULL || t == NULL || - *cur == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { - purple_notify_error(account, NULL, _("Fill in the fields."), NULL); + mail == NULL || *cur == '\0' || *p1 == '\0' || *p2 == '\0' || + *t == '\0' || *mail == '\0') { + purple_notify_error(account, messagesTitle, + _("Fill in the fields."), NULL); goto exit_err; } if (g_utf8_collate(p1, p2) != 0) { - purple_notify_error(account, NULL, - _("New passwords do not match."), NULL); + purple_notify_error(account, messagesTitle, + _("New passwords do not match."), NULL); goto exit_err; } - if (g_utf8_collate(cur, purple_account_get_password(account)) != 0) { - purple_notify_error(account, NULL, - _("Your current password is different from the one that you specified."), + if (strlen(p1) > 15) { + purple_notify_error(account, messagesTitle, + _("New password should be at most 15 characters long."), NULL); goto exit_err; } - purple_debug_info("gg", "Changing password\n"); - - /* XXX: this email should be a pref... */ - h = gg_change_passwd4(ggp_get_uin(account), - "user@example.net", purple_account_get_password(account), - p1, info->token->id, t, 0); - - if (h == NULL) { - purple_notify_error(account, NULL, - _("Unable to change password. Error occurred.\n"), - NULL); + if (g_utf8_collate(cur, purple_account_get_password(account)) != 0) { + purple_notify_error(account, messagesTitle, + _("Your current password is different from the one that" + " you specified."), NULL); goto exit_err; } - purple_account_set_password(account, p1); + if (!purple_email_is_valid(mail)) { + purple_notify_error(account, messagesTitle, + _("Invalid email address"), NULL); + goto exit_err; + } - gg_change_passwd_free(h); + purple_debug_info("gg", "Changing password with email \"%s\"...\n", + mail); - purple_notify_info(account, _("Change password for the Gadu-Gadu account"), - _("Password was changed successfully!"), NULL); + h = gg_change_passwd4(ggp_get_uin(account), mail, + purple_account_get_password(account), p1, info->token->id, t, + 1); + if (h == NULL) + purple_notify_error(account, messagesTitle, + _("Unable to change password. Error occurred.\n"), + NULL); + else + { + ggp_change_passwd_request *req = + g_new(ggp_change_passwd_request, 1); + req->http_req = h; + req->new_password = g_strdup(p1); + req->account = account; + + req->inpa = ggp_http_input_add(h, + ggp_callback_change_passwd_handler, req); + } + exit_err: g_free(cur); g_free(p1); g_free(p2); g_free(t); + g_free(mail); g_free(info->token->id); g_free(info->token->data); g_free(info->token); @@ -696,12 +759,11 @@ static void ggp_change_passwd_dialog(PurpleConnection *gc) PurpleRequestFieldGroup *group; PurpleRequestField *field; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPToken *token = info->token; char *msg; - fields = purple_request_fields_new(); group = purple_request_field_group_new(NULL); purple_request_fields_add_group(fields, group); @@ -721,6 +783,11 @@ static void ggp_change_passwd_dialog(PurpleConnection *gc) purple_request_field_string_set_masked(field, TRUE); purple_request_field_group_add_field(group, field); + field = purple_request_field_string_new("email", + _("Email Address"), "", FALSE); + purple_request_field_string_set_masked(field, FALSE); + purple_request_field_group_add_field(group, field); + field = purple_request_field_string_new("token", _("Enter current token"), "", FALSE); purple_request_field_string_set_masked(field, FALSE); @@ -732,8 +799,8 @@ static void ggp_change_passwd_dialog(PurpleConnection *gc) purple_request_field_group_add_field(group, field); msg = g_strdup_printf("%s %d", - _("Please, enter your current password and your new password for UIN: "), - ggp_get_uin(purple_connection_get_account(gc))); + _("Please, enter your current password and your new password " + "for UIN: "), ggp_get_uin(purple_connection_get_account(gc))); purple_request_fields(gc, _("Change Gadu-Gadu Password"), @@ -758,7 +825,7 @@ static void ggp_change_passwd(PurplePluginAction *action) static void ggp_action_change_status_broadcasting_ok(PurpleConnection *gc, PurpleRequestFields *fields) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); int selected_field; PurpleAccount *account = purple_connection_get_account(gc); PurpleStatus *status; @@ -778,7 +845,7 @@ static void ggp_action_change_status_broadcasting_ok(PurpleConnection *gc, Purpl static void ggp_action_change_status_broadcasting(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); PurpleRequestFields *fields; PurpleRequestFieldGroup *group; @@ -848,7 +915,7 @@ static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) buddy = (PurpleBuddy *)node; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - info = gc->proto_data; + info = purple_connection_get_protocol_data(gc); fields = purple_request_fields_new(); group = purple_request_field_group_new(NULL); @@ -857,7 +924,7 @@ static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) field = purple_request_field_list_new("name", "Chat name"); for (l = info->chats; l != NULL; l = l->next) { GGPChat *chat = l->data; - purple_request_field_list_add(field, chat->name, chat->name); + purple_request_field_list_add_icon(field, chat->name, NULL, chat->name); } purple_request_field_group_add_field(group, field); @@ -879,7 +946,7 @@ static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) static void ggp_add_deny(PurpleConnection *gc, const char *who) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); uin_t uin = ggp_str_to_uin(who); purple_debug_info("gg", "ggp_add_deny: %u\n", uin); @@ -890,7 +957,7 @@ static void ggp_add_deny(PurpleConnection *gc, const char *who) static void ggp_rem_deny(PurpleConnection *gc, const char *who) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); uin_t uin = ggp_str_to_uin(who); purple_debug_info("gg", "ggp_rem_deny: %u\n", uin); @@ -1024,7 +1091,8 @@ static void gg_get_avatar_url_cb(PurpleUtilFetchUrlData *url_data, gpointer user purple_debug_info("gg", "gg_get_avatar_url_cb: " "requesting avatar for %s\n", uin); - url_data = purple_util_fetch_url_request_len(account, + /* FIXME: This should be cancelled somewhere if not needed. */ + url_data = purple_util_fetch_url_request(account, bigavatar, TRUE, "Mozilla/4.0 (compatible; MSIE 5.0)", FALSE, NULL, FALSE, -1, gg_fetch_avatar_cb, data); } @@ -1052,7 +1120,8 @@ static void ggp_update_buddy_avatar(PurpleConnection *gc, uin_t uin) avatarurl = g_strdup_printf("http://api.gadu-gadu.pl/avatars/%u/0.xml", uin); - url_data = purple_util_fetch_url_request_len( + /* FIXME: This should be cancelled somewhere if not needed. */ + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), avatarurl, TRUE, "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, NULL, FALSE, -1, gg_get_avatar_url_cb, gc); @@ -1086,7 +1155,7 @@ static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, break; case GG_STATUS_FFC: case GG_STATUS_FFC_DESCR: - st = purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE); + st = "freeforchat"; break; case GG_STATUS_AVAIL: case GG_STATUS_AVAIL_DESCR: @@ -1096,6 +1165,10 @@ static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, case GG_STATUS_BUSY_DESCR: st = purple_primitive_get_id_from_type(PURPLE_STATUS_AWAY); break; + case GG_STATUS_INVISIBLE: + case GG_STATUS_INVISIBLE_DESCR: + st = purple_primitive_get_id_from_type(PURPLE_STATUS_INVISIBLE); + break; case GG_STATUS_DND: case GG_STATUS_DND_DESCR: st = purple_primitive_get_id_from_type(PURPLE_STATUS_UNAVAILABLE); @@ -1349,7 +1422,7 @@ static void ggp_pubdir_handle_full(PurpleConnection *gc, gg_pubdir50_t req, static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPSearchForm *form; int res_count; guint32 seq; @@ -1391,7 +1464,7 @@ static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) static void ggp_recv_image_handler(PurpleConnection *gc, const struct gg_event *ev) { gint imgid = 0; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GList *entry = g_list_first(info->pending_richtext_messages); gchar *handlerid = g_strdup_printf("IMGID_HANDLER-%i", ev->event.image_reply.crc32); @@ -1439,11 +1512,12 @@ static void ggp_recv_image_handler(PurpleConnection *gc, const struct gg_event * */ static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); PurpleConversation *conv; gchar *from; gchar *msg; gchar *tmp; + time_t mtime; if (ev->event.msg.message == NULL) { @@ -1572,8 +1646,13 @@ static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event from, msg, ev->event.msg.msgclass, ev->event.msg.recipients_count); + if (ev->event.msg.msgclass & GG_CLASS_QUEUED) + mtime = ev->event.msg.time; + else + mtime = time(NULL); + if (ev->event.msg.recipients_count == 0) { - serv_got_im(gc, from, msg, 0, ev->event.msg.time); + serv_got_im(gc, from, msg, 0, mtime); } else { const char *chat_name; int chat_id; @@ -1599,7 +1678,7 @@ static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event buddy_name = ggp_buddy_get_name(gc, ev->event.msg.sender); serv_got_chat_in(gc, chat_id, buddy_name, - PURPLE_MESSAGE_RECV, msg, ev->event.msg.time); + PURPLE_MESSAGE_RECV, msg, mtime); g_free(buddy_name); } g_free(msg); @@ -1608,7 +1687,7 @@ static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event static void ggp_send_image_handler(PurpleConnection *gc, const struct gg_event *ev) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); PurpleStoredImage *image; gint imgid = GPOINTER_TO_INT(g_hash_table_lookup(info->pending_images, GINT_TO_POINTER(ev->event.image_request.crc32))); @@ -1714,7 +1793,7 @@ static void ggp_xml_event_handler(PurpleConnection *gc, char *data) static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) { PurpleConnection *gc = _gc; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); struct gg_event *ev; int i; @@ -1849,7 +1928,7 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); - info = gc->proto_data; + info = purple_connection_get_protocol_data(gc); purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", info->session->check, info->session->state); @@ -1896,11 +1975,12 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", info->session->check, info->session->state); - purple_input_remove(gc->inpa); + purple_input_remove(info->inpa); + info->inpa = 0; /** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */ if (info->session->fd >= 0) - gc->inpa = purple_input_add(info->session->fd, + info->inpa = purple_input_add(info->session->fd, (info->session->check == 1) ? PURPLE_INPUT_WRITE : PURPLE_INPUT_READ, ggp_async_login_handler, gc); @@ -1913,8 +1993,8 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition case GG_EVENT_CONN_SUCCESS: { purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); - purple_input_remove(gc->inpa); - gc->inpa = purple_input_add(info->session->fd, + purple_input_remove(info->inpa); + info->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, ggp_callback_recv, gc); @@ -1924,17 +2004,69 @@ static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition } break; case GG_EVENT_CONN_FAILED: - purple_input_remove(gc->inpa); - gc->inpa = 0; - purple_connection_error (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); + purple_input_remove(info->inpa); + info->inpa = 0; + purple_debug_info("gg", "Connection failure: %d\n", + ev->event.failure); + switch (ev->event.failure) { + case GG_FAILURE_RESOLVING: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Unable to resolve " + "hostname")); + break; + case GG_FAILURE_PASSWORD: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, + _("Incorrect password")); + break; + case GG_FAILURE_TLS: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, + _("SSL Connection Failed")); + break; + case GG_FAILURE_INTRUDER: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, + _("Your account has been " + "disabled because too many " + "incorrect passwords were " + "entered")); + break; + case GG_FAILURE_UNAVAILABLE: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Service temporarily " + "unavailable")); + break; + case GG_FAILURE_PROXY: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Error connecting to proxy " + "server")); + break; + case GG_FAILURE_HUB: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Error connecting to master " + "server")); + break; + default: + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Connection failed")); + } break; case GG_EVENT_MSG: if (ev->event.msg.sender == 0) + { + if (ev->event.msg.message == NULL) + break; + /* system messages are mostly ads */ purple_debug_info("gg", "System message:\n%s\n", ev->event.msg.message); + } else purple_debug_warning("gg", "GG_EVENT_MSG: message from user %u " "unexpected while connecting:\n%s\n", @@ -1958,6 +2090,19 @@ static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy) return "gadu-gadu"; } +static const char *ggp_normalize(const PurpleAccount *account, const char *who) +{ + static char normalized[21]; /* maximum unsigned long long int size */ + + uin_t uin = ggp_str_to_uin(who); + if (uin <= 0) + return NULL; + + g_snprintf(normalized, sizeof(normalized), "%u", uin); + + return normalized; +} + static char *ggp_status_text(PurpleBuddy *b) { PurpleStatus *status; @@ -2013,50 +2158,60 @@ static GList *ggp_status_types(PurpleAccount *account) PurpleStatusType *type; GList *types = NULL; - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, + NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); /* - * Without this selecting Invisible as own status doesn't - * work. It's not used and not needed to show status of buddies. + * New status for GG 8.0: PoGGadaj ze mna (chatty). + * NOTE: at this time, this is used only to set our own status. */ - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_INVISIBLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, + "freeforchat", _("Chatty"), TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, + NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); /* - * New statuses for GG 8.0 like PoGGadaj ze mna (not yet because - * libpurple can't support Chatty status) and Nie przeszkadzac + * New status for GG 8.0: Nie przeszkadzac (do not disturb). */ - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_UNAVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, + NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); + types = g_list_append(types, type); + + /* + * It's used on buddy list if and only if it's showing our own + * (invisible) status. + */ + type = purple_status_type_new_with_attrs(PURPLE_STATUS_INVISIBLE, + NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); /* * This status is necessary to display guys who are blocking *us*. */ - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_INVISIBLE, "blocked", _("Blocked"), TRUE, FALSE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_INVISIBLE, + "blocked", _("Blocked"), TRUE, FALSE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); + type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, + NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), + NULL); types = g_list_append(types, type); return types; @@ -2067,13 +2222,15 @@ static GList *ggp_blist_node_menu(PurpleBlistNode *node) PurpleMenuAction *act; GList *m = NULL; PurpleAccount *account; + PurpleConnection *gc; GGPInfo *info; if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) return NULL; account = purple_buddy_get_account((PurpleBuddy *) node); - info = purple_account_get_connection(account)->proto_data; + gc = purple_account_get_connection(account); + info = purple_connection_get_protocol_data(gc); if (info->chats) { act = purple_menu_action_new(_("Add to chat"), PURPLE_CALLBACK(ggp_bmenu_add_to_chat), @@ -2125,11 +2282,25 @@ static void ggp_login(PurpleAccount *account) info->pending_images = g_hash_table_new(g_direct_hash, g_direct_equal); info->status_broadcasting = purple_account_get_bool(account, "status_broadcasting", TRUE); - gc->proto_data = info; + purple_connection_set_protocol_data(gc, info); glp->uin = ggp_get_uin(account); - glp->password = (char *)purple_account_get_password(account); + glp->password = charset_convert(purple_account_get_password(account), + "UTF-8", "CP1250"); + + if (glp->uin == 0) { + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_INVALID_USERNAME, + _("The username specified is invalid.")); + g_free(glp); + return; + } + glp->image_size = 255; + glp->status_flags = GG_STATUS_FLAG_UNKNOWN; + + if (purple_account_get_bool(account, "show_links_from_strangers", 1)) + glp->status_flags |= GG_STATUS_FLAG_SPAM; presence = purple_account_get_presence(account); status = purple_presence_get_active_status(presence); @@ -2141,13 +2312,26 @@ static void ggp_login(PurpleAccount *account) glp->async = 1; glp->status = ggp_to_gg_status(status, &glp->status_descr); - encryption_type = purple_account_get_string(account, "encryption", "none"); - purple_debug_info("gg", "Requested encryption type: %s\n", encryption_type); + encryption_type = purple_account_get_string(account, "encryption", + "opportunistic_tls"); + purple_debug_info("gg", "Requested encryption type: %s\n", + encryption_type); if (strcmp(encryption_type, "opportunistic_tls") == 0) - glp->tls = 1; - else - glp->tls = 0; - purple_debug_info("gg", "TLS enabled: %d\n", glp->tls); + glp->tls = GG_SSL_ENABLED; + else if (strcmp(encryption_type, "require_tls") == 0) { + if (gg_libgadu_check_feature(GG_LIBGADU_FEATURE_SSL)) + glp->tls = GG_SSL_REQUIRED; + else { + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, + _("SSL support unavailable")); + g_free(glp); + return; + } + } + else /* encryption_type == "none" */ + glp->tls = GG_SSL_DISABLED; + purple_debug_info("gg", "TLS mode: %d\n", glp->tls); if (!info->status_broadcasting) glp->status = glp->status|GG_STATUS_FRIENDS_MASK; @@ -2183,24 +2367,25 @@ static void ggp_login(PurpleAccount *account) g_free(glp); return; } - gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, + info->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, ggp_async_login_handler, gc); } static void ggp_close(PurpleConnection *gc) { + PurpleAccount *account; + GGPInfo *info;; if (gc == NULL) { purple_debug_info("gg", "gc == NULL\n"); return; } - if (gc->proto_data) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStatus *status; - GGPInfo *info = gc->proto_data; + account = purple_connection_get_account(gc); + info = purple_connection_get_protocol_data(gc); - status = purple_account_get_active_status(account); + if (info) { + PurpleStatus *status = purple_account_get_active_status(account); if (info->session != NULL) { ggp_set_status(account, status); @@ -2218,20 +2403,21 @@ static void ggp_close(PurpleConnection *gc) ggp_search_destroy(info->searches); g_list_free(info->pending_richtext_messages); g_hash_table_destroy(info->pending_images); + + if (info->inpa > 0) + purple_input_remove(info->inpa); + + purple_connection_set_protocol_data(gc, NULL); g_free(info); - gc->proto_data = NULL; } - if (gc->inpa > 0) - purple_input_remove(gc->inpa); - purple_debug_info("gg", "Connection closed.\n"); } static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, PurpleMessageFlags flags) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); char *tmp, *plain; int ret = 1; unsigned char format[1024]; @@ -2349,6 +2535,7 @@ static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, static unsigned int ggp_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) { + GGPInfo *info = purple_connection_get_protocol_data(gc); int dummy_length; // we don't send real length of typed message if (state == PURPLE_TYPED) // not supported @@ -2360,7 +2547,7 @@ static unsigned int ggp_send_typing(PurpleConnection *gc, const char *name, Purp dummy_length = 0; gg_typing_notification( - ((GGPInfo*)gc->proto_data)->session, + info->session, ggp_str_to_uin(name), dummy_length); @@ -2369,7 +2556,7 @@ static unsigned int ggp_send_typing(PurpleConnection *gc, const char *name, Purp static void ggp_get_info(PurpleConnection *gc, const char *name) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPSearchForm *form; guint32 seq; @@ -2397,6 +2584,9 @@ static int ggp_to_gg_status(PurpleStatus *status, char **msg) if (strcmp(status_id, "available") == 0) { new_status = GG_STATUS_AVAIL; new_status_descr = GG_STATUS_AVAIL_DESCR; + } else if (strcmp(status_id, "freeforchat") == 0) { + new_status = GG_STATUS_FFC; + new_status_descr = GG_STATUS_FFC_DESCR; } else if (strcmp(status_id, "away") == 0) { new_status = GG_STATUS_BUSY; new_status_descr = GG_STATUS_BUSY_DESCR; @@ -2445,7 +2635,7 @@ static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) return; gc = purple_account_get_connection(account); - info = gc->proto_data; + info = purple_connection_get_protocol_data(gc); new_status = ggp_to_gg_status(status, &new_msg); @@ -2463,10 +2653,10 @@ static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) } -static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { PurpleAccount *account; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); const gchar *name = purple_buddy_get_name(buddy); gg_add_notify(info->session, ggp_str_to_uin(name)); @@ -2480,14 +2670,14 @@ static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); gg_remove_notify(info->session, ggp_str_to_uin(purple_buddy_get_name(buddy))); } static void ggp_join_chat(PurpleConnection *gc, GHashTable *data) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPChat *chat; char *chat_name; GList *l; @@ -2525,7 +2715,7 @@ static char *ggp_get_chat_name(GHashTable *data) { static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) { PurpleConversation *conv; - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); GGPChat *chat = NULL; GList *l; /* char *msg, *plain; */ @@ -2539,7 +2729,7 @@ static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, Purp for (l = info->chats; l != NULL; l = l->next) { chat = l->data; - if (g_utf8_collate(chat->name, conv->name) == 0) { + if (g_utf8_collate(chat->name, purple_conversation_get_name(conv)) == 0) { break; } @@ -2580,7 +2770,7 @@ static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, Purp static void ggp_keepalive(PurpleConnection *gc) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); /* purple_debug_info("gg", "Keeping connection alive....\n"); */ @@ -2605,14 +2795,16 @@ static GList *ggp_actions(PurplePlugin *plugin, gpointer context) GList *m = NULL; PurplePluginAction *act; + act = purple_plugin_action_new(_("Change password..."), + ggp_change_passwd); + m = g_list_append(m, act); + act = purple_plugin_action_new(_("Find buddies..."), ggp_find_buddies); m = g_list_append(m, act); - m = g_list_append(m, NULL); - - act = purple_plugin_action_new(_("Change password..."), - ggp_change_passwd); + act = purple_plugin_action_new(_("Change status broadcasting"), + ggp_action_change_status_broadcasting); m = g_list_append(m, act); m = g_list_append(m, NULL); @@ -2637,10 +2829,6 @@ static GList *ggp_actions(PurplePlugin *plugin, gpointer context) ggp_action_buddylist_load); m = g_list_append(m, act); - act = purple_plugin_action_new(_("Change status broadcasting"), - ggp_action_change_status_broadcasting); - m = g_list_append(m, act); - return m; } @@ -2651,6 +2839,7 @@ static gboolean ggp_offline_message(const PurpleBuddy *buddy) static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -2691,13 +2880,12 @@ static PurplePluginProtocolInfo prpl_info = ggp_keepalive, /* keepalive */ ggp_register_user, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ NULL, /* buddy_free */ NULL, /* convo_closed */ - NULL, /* normalize */ + ggp_normalize, /* normalize */ NULL, /* set_buddy_icon */ NULL, /* remove_group */ NULL, /* get_cb_real_name */ @@ -2716,15 +2904,12 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* can_do_media */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = { @@ -2790,11 +2975,6 @@ static void init_plugin(PurplePlugin *plugin) PurpleAccountOption *option; GList *encryption_options = NULL; - option = purple_account_option_string_new(_("Nickname"), - "nick", _("Gadu-Gadu User")); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - option = purple_account_option_string_new(_("GG server"), "gg_server", ""); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, @@ -2807,22 +2987,29 @@ static void init_plugin(PurplePlugin *plugin) list = g_list_append(list, kvp); \ } - ADD_VALUE(encryption_options, _("Don't use encryption"), "none"); ADD_VALUE(encryption_options, _("Use encryption if available"), "opportunistic_tls"); -#if 0 - /* TODO */ ADD_VALUE(encryption_options, _("Require encryption"), "require_tls"); -#endif + ADD_VALUE(encryption_options, _("Don't use encryption"), "none"); option = purple_account_option_list_new(_("Connection security"), "encryption", encryption_options); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + option = purple_account_option_bool_new(_("Show links from strangers"), + "show_links_from_strangers", 1); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + my_protocol = plugin; gg_debug_handler = purple_gg_debug_handler; + +#ifdef _WIN32 + gg_global_set_custom_resolver(ggp_resolver_win32thread_start, + ggp_resolver_win32thread_cleanup); +#endif } PURPLE_INIT_PLUGIN(gg, init_plugin, info); diff --git a/libpurple/protocols/gg/gg.h b/libpurple/protocols/gg/gg.h index 3e75a082b3..7d6c0edda3 100644 --- a/libpurple/protocols/gg/gg.h +++ b/libpurple/protocols/gg/gg.h @@ -24,6 +24,7 @@ #ifndef _PURPLE_GG_H #define _PURPLE_GG_H +#undef printf #include #include "internal.h" #include "search.h" @@ -58,6 +59,7 @@ typedef struct typedef struct { struct gg_session *session; + guint inpa; GGPToken *token; GList *chats; GGPSearches *searches; diff --git a/libpurple/protocols/gg/lib/common.c b/libpurple/protocols/gg/lib/common.c index 4bb053f943..acac5fb35f 100644 --- a/libpurple/protocols/gg/lib/common.c +++ b/libpurple/protocols/gg/lib/common.c @@ -24,22 +24,14 @@ * * \brief Funkcje wykorzystywane przez różne moduły biblioteki */ -#ifndef _WIN32 -# include -# include -# include -# include -# include -# ifdef sun -# include -# endif +#include "compat.h" +#include +#ifdef sun +# include #endif #include #include -#ifndef _WIN32 -# include -#endif #include #include #include @@ -92,7 +84,7 @@ char *gg_vsaprintf(const char *format, va_list ap) } buf = tmp; res = vsnprintf(buf, size, format, ap); - } while (res == size - 1 || res == -1); + } while (res >= size - 1 || res == -1); } #else { diff --git a/libpurple/protocols/gg/lib/compat.h b/libpurple/protocols/gg/lib/compat.h index 46fe305e71..3c4e64967b 100644 --- a/libpurple/protocols/gg/lib/compat.h +++ b/libpurple/protocols/gg/lib/compat.h @@ -28,6 +28,21 @@ #ifndef __COMPAT_H #define __COMPAT_H +#ifdef _WIN32 +# include +# include +# define EINPROGRESS WSAEINPROGRESS +# define ETIMEDOUT WSAETIMEDOUT +# define ENOTCONN WSAENOTCONN +# define ECONNRESET WSAECONNRESET +#else +# include +# include +# include +# include +# include +#endif + #ifdef sun # define INADDR_NONE ((in_addr_t) 0xffffffff) #endif diff --git a/libpurple/protocols/gg/lib/dcc.c b/libpurple/protocols/gg/lib/dcc.c index d479f124bd..38a17cec9a 100644 --- a/libpurple/protocols/gg/lib/dcc.c +++ b/libpurple/protocols/gg/lib/dcc.c @@ -26,16 +26,11 @@ * \brief Obsługa połączeń bezpośrednich do wersji Gadu-Gadu 6.x */ +#include "compat.h" #include #include -#ifndef _WIN32 -# include -# include -# include -# include -# ifdef sun -# include -# endif +#ifdef sun +# include #endif #include @@ -601,7 +596,7 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h) struct sockaddr_in sin; struct gg_dcc *c; int fd, one = 1; - unsigned int sin_len = sizeof(sin); + socklen_t sin_len = sizeof(sin); if ((fd = accept(h->fd, (struct sockaddr*) &sin, &sin_len)) == -1) { gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() can't accept() new connection (errno=%d, %s)\n", errno, strerror(errno)); @@ -648,7 +643,8 @@ struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h) struct gg_dcc_small_packet small; struct gg_dcc_big_packet big; int size, tmp, res; - unsigned int utmp, res_size = sizeof(res); + unsigned int utmp; + socklen_t res_size = sizeof(res); char buf[1024], ack[] = "UDAG"; struct gg_dcc_file_info_packet { diff --git a/libpurple/protocols/gg/lib/dcc7.c b/libpurple/protocols/gg/lib/dcc7.c index 9b045cfdd9..6d938c7543 100644 --- a/libpurple/protocols/gg/lib/dcc7.c +++ b/libpurple/protocols/gg/lib/dcc7.c @@ -31,14 +31,8 @@ #include #include -#ifndef _WIN32 -# include -# include -# include -# include -# ifdef sun -# include -# endif +#ifdef sun +# include #endif #include @@ -1095,7 +1089,7 @@ struct gg_event *gg_dcc7_watch_fd(struct gg_dcc7 *dcc) case GG_STATE_CONNECTING: { int res = 0, error = 0; - unsigned int error_size = sizeof(error); + socklen_t error_size = sizeof(error); gg_debug_dcc(dcc, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() GG_STATE_CONNECTING\n"); @@ -1384,7 +1378,7 @@ struct gg_event *gg_dcc7_watch_fd(struct gg_dcc7 *dcc) case GG_STATE_CONNECTING_RELAY: { int res; - unsigned int res_size = sizeof(res); + socklen_t res_size = sizeof(res); struct gg_dcc7_relay_req pkt; gg_debug_dcc(dcc, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() GG_STATE_CONNECTING_RELAY\n"); diff --git a/libpurple/protocols/gg/lib/events.c b/libpurple/protocols/gg/lib/events.c index d5dc509bf5..167b16a7e3 100644 --- a/libpurple/protocols/gg/lib/events.c +++ b/libpurple/protocols/gg/lib/events.c @@ -28,17 +28,10 @@ */ #include -#ifndef _WIN32 -# include -# include -# include -# include -#endif #include #include "compat.h" #include "libgadu.h" -#include "libgadu-config.h" #include "protocol.h" #include "libgadu-internal.h" #include "encoding.h" diff --git a/libpurple/protocols/gg/lib/handlers.c b/libpurple/protocols/gg/lib/handlers.c index 4d64286135..b9b4057c1e 100644 --- a/libpurple/protocols/gg/lib/handlers.c +++ b/libpurple/protocols/gg/lib/handlers.c @@ -27,21 +27,13 @@ */ #include -#ifndef _WIN32 -# include -# include -# include -#endif #include -#ifndef _WIN32 -# ifdef sun -# include -# endif +#ifdef sun +# include #endif #include "compat.h" #include "libgadu.h" -#include "libgadu-config.h" #include "resolver.h" #include "session.h" #include "protocol.h" @@ -51,9 +43,6 @@ #include "deflate.h" #include -#ifndef _WIN32 -# include -#endif #include #include #include @@ -92,7 +81,7 @@ static int gg_session_handle_welcome(struct gg_session *gs, uint32_t type, const uint8_t hash_buf[64]; uint32_t local_ip; struct sockaddr_in sin; - unsigned int sin_len = sizeof(sin); + socklen_t sin_len = sizeof(sin); if (len < sizeof(struct gg_welcome)) { ge->type = GG_EVENT_CONN_FAILED; diff --git a/libpurple/protocols/gg/lib/http.c b/libpurple/protocols/gg/lib/http.c index 7d014f8a33..b35f729f37 100644 --- a/libpurple/protocols/gg/lib/http.c +++ b/libpurple/protocols/gg/lib/http.c @@ -25,11 +25,6 @@ */ #include -#ifndef _WIN32 -# include -# include -# include -#endif #include "compat.h" #include "libgadu.h" @@ -37,9 +32,6 @@ #include #include -#ifndef _WIN32 -# include -#endif #include #include #include @@ -258,7 +250,7 @@ int gg_http_watch_fd(struct gg_http *h) } if (h->state == GG_STATE_SENDING_QUERY) { - size_t res; + ssize_t res; if ((res = write(h->fd, h->query, strlen(h->query))) < 1) { gg_debug(GG_DEBUG_MISC, "=> http, write() failed (len=%d, res=%d, errno=%d)\n", strlen(h->query), res, errno); diff --git a/libpurple/protocols/gg/lib/libgadu-config.h b/libpurple/protocols/gg/lib/libgadu-config.h index 8fa28ae370..4ca5aea111 100644 --- a/libpurple/protocols/gg/lib/libgadu-config.h +++ b/libpurple/protocols/gg/lib/libgadu-config.h @@ -8,8 +8,30 @@ /* Defined if libgadu was compiled for bigendian machine. */ #undef __GG_LIBGADU_BIGENDIAN #ifdef WORDS_BIGENDIAN -#define __GG_LIBGADU_BIGENDIAN -#endif /* WORDS_BIGENDIAN */ +# define __GG_LIBGADU_BIGENDIAN +#endif + +/* Defined if this machine has gethostbyname_r(). */ +#undef GG_CONFIG_HAVE_GETHOSTBYNAME_R + +/* Defined if this machine has _exit(). */ +#define GG_CONFIG_HAVE__EXIT + +/* Defined if libgadu was compiled and linked with fork support. */ +#undef GG_CONFIG_HAVE_FORK +#ifndef _WIN32 +# define GG_CONFIG_HAVE_FORK +#endif + +/* Defined if libgadu was compiled and linked with pthread support. */ +/* We don't like pthreads. */ +#undef __GG_LIBGADU_HAVE_PTHREAD + +/* Defined if this machine has C99-compiliant vsnprintf(). */ +#undef __GG_LIBGADU_HAVE_C99_VSNPRINTF +#ifndef _WIN32 +# define __GG_LIBGADU_HAVE_C99_VSNPRINTF +#endif /* Defined if this machine has va_copy(). */ #define __GG_LIBGADU_HAVE_VA_COPY @@ -20,40 +42,29 @@ /* Defined if this machine supports long long. */ #undef __GG_LIBGADU_HAVE_LONG_LONG #ifdef HAVE_LONG_LONG -#define __GG_LIBGADU_HAVE_LONG_LONG -#endif /* HAVE_LONG_LONG */ - -/* Defined if libgadu was compiled and linked with pthread support. */ -/* We don't like pthreads. */ -#undef __GG_LIBGADU_HAVE_PTHREAD +# define __GG_LIBGADU_HAVE_LONG_LONG +#endif -/* Defined if libgadu was compiled and linked with GnuTLS encryption support. */ +/* Defined if libgadu was compiled and linked with GnuTLS support. */ +#undef GG_CONFIG_HAVE_GNUTLS #ifdef HAVE_GNUTLS # define GG_CONFIG_HAVE_GNUTLS -#else -# undef GG_CONFIG_HAVE_GNUTLS #endif -/* Defined if libgadu was compiled and linked with TLS support. */ +/* Defined if libgadu was compiled and linked with OpenSSL support. */ /* Always undefined in Purple. */ #undef __GG_LIBGADU_HAVE_OPENSSL -/* Include file containing uintXX_t declarations. */ +/* Defined if libgadu was compiled and linked with zlib support. */ +#undef GG_CONFIG_HAVE_ZLIB + +/* Defined if uintX_t types are defined in . */ +#undef GG_CONFIG_HAVE_STDINT_H #if HAVE_STDINT_H -#include +# define GG_CONFIG_HAVE_STDINT_H #endif -/* Defined if this machine has C99-compiliant vsnprintf(). */ -#ifndef _WIN32 -#define __GG_LIBGADU_HAVE_C99_VSNPRINTF -#else -#undef __GG_LIBGADU_HAVE_C99_VSNPRINTF -#endif #define vnsprintf g_vnsprintf -#ifdef _WIN32 -#define random (long) rand #endif - -#endif /* __GG_LIBGADU_CONFIG_H */ diff --git a/libpurple/protocols/gg/lib/libgadu.c b/libpurple/protocols/gg/lib/libgadu.c index fa26fa1047..b46e046884 100644 --- a/libpurple/protocols/gg/lib/libgadu.c +++ b/libpurple/protocols/gg/lib/libgadu.c @@ -29,23 +29,12 @@ */ #include -#ifdef _WIN32 -# include -# include -# include -# define SHUT_RDWR SD_BOTH -#else -# include -# include -# include -# ifdef sun -# include -# endif +#ifdef sun +# include #endif #include "compat.h" #include "libgadu.h" -#include "libgadu-config.h" #include "protocol.h" #include "resolver.h" #include "libgadu-internal.h" @@ -55,10 +44,7 @@ #include "message.h" #include "deflate.h" -#ifndef _WIN32 -# include /* on Win32 this is included above */ -# include -#endif +#include #include #include #include @@ -1122,7 +1108,6 @@ void gg_logoff(struct gg_session *sess) sess->resolver_cleanup(&sess->resolver, 1); if (sess->fd != -1) { - shutdown(sess->fd, SHUT_RDWR); close(sess->fd); sess->fd = -1; } diff --git a/libpurple/protocols/gg/lib/libgadu.h b/libpurple/protocols/gg/lib/libgadu.h index aad79b301e..c9f4f3e0c2 100644 --- a/libpurple/protocols/gg/lib/libgadu.h +++ b/libpurple/protocols/gg/lib/libgadu.h @@ -33,7 +33,7 @@ #ifndef __GG_LIBGADU_H #define __GG_LIBGADU_H -#ifdef _WIN32 +#if defined(__cplusplus) || defined(_WIN32) #pragma pack(push, 1) #endif @@ -53,6 +53,12 @@ extern "C" { /* Defined if this machine has gethostbyname_r(). */ #undef GG_CONFIG_HAVE_GETHOSTBYNAME_R +/* Defined if this machine has _exit(). */ +#undef GG_CONFIG_HAVE__EXIT + +/* Defined if libgadu was compiled and linked with fork support. */ +#undef GG_CONFIG_HAVE_FORK + /* Defined if libgadu was compiled and linked with pthread support. */ #undef GG_CONFIG_HAVE_PTHREAD @@ -95,6 +101,8 @@ extern "C" { /* Defined if uintX_t types are defined in . */ #undef GG_CONFIG_HAVE_SYS_TYPES_H +#include "libgadu-config.h" + #ifdef GG_CONFIG_HAVE_OPENSSL #include #endif @@ -115,24 +123,12 @@ extern "C" { # include # else -#ifndef __AC_STDINT_H -#define __AC_STDINT_H - /* ISO C 9X: 7.18 Integer types */ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; -#if !defined(__CYGWIN__) && !defined(__SunOS) && !defined(_INCLUDE_HPUX_SOURCE) -#define __int8_t_defined -typedef signed char int8_t; -typedef signed short int16_t; -typedef signed int int32_t; -#endif - -#endif /* __AC_STDINT_H */ - # endif # endif # endif @@ -195,7 +191,6 @@ typedef enum { GG_RESOLVER_DEFAULT = 0, /**< Domyślny sposób rozwiązywania nazw (jeden z poniższych) */ GG_RESOLVER_FORK, /**< Rozwiązywanie nazw bazujące na procesach */ GG_RESOLVER_PTHREAD, /**< Rozwiązywanie nazw bazujące na wątkach */ - GG_RESOLVER_WIN32, GG_RESOLVER_CUSTOM, /**< Funkcje rozwiązywania nazw dostarczone przed aplikację */ GG_RESOLVER_INVALID = -1 /**< Nieprawidłowy sposób rozwiązywania nazw (wynik \c gg_session_get_resolver) */ } gg_resolver_t; @@ -1442,7 +1437,6 @@ int gg_pubdir50_handle_reply(struct gg_event *e, const char *packet, int length) int gg_file_hash_sha1(int fd, uint8_t *result) GG_DEPRECATED; -#undef printf #ifdef __GNUC__ char *gg_saprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))) GG_DEPRECATED; #else @@ -2298,14 +2292,14 @@ struct gg_dcc7_dunno1 { #define GG_DCC7_TIMEOUT_FILE_ACK 300 /* 5 minut */ #define GG_DCC7_TIMEOUT_VOICE_ACK 300 /* 5 minut */ -#ifdef _WIN32 -#pragma pack(pop) -#endif - #ifdef __cplusplus } #endif +#if defined(__cplusplus) || defined(_WIN32) +#pragma pack(pop) +#endif + #endif /* __GG_LIBGADU_H */ /* diff --git a/libpurple/protocols/gg/lib/pubdir.c b/libpurple/protocols/gg/lib/pubdir.c index dad5e44da3..e0f2b2b590 100644 --- a/libpurple/protocols/gg/lib/pubdir.c +++ b/libpurple/protocols/gg/lib/pubdir.c @@ -35,7 +35,6 @@ #include #include "libgadu.h" -#include "libgadu-config.h" /** * Rejestruje nowego użytkownika. @@ -194,7 +193,7 @@ struct gg_http *gg_unregister3(uin_t uin, const char *password, const char *toke return NULL; } - __pwd = gg_saprintf("%ld", random()); + __pwd = gg_saprintf("%d", rand()); __fmpwd = gg_urlencode(password); __tokenid = gg_urlencode(tokenid); __tokenval = gg_urlencode(tokenval); diff --git a/libpurple/protocols/gg/lib/pubdir50.c b/libpurple/protocols/gg/lib/pubdir50.c index 9222ea56ed..1d1bd55382 100644 --- a/libpurple/protocols/gg/lib/pubdir50.c +++ b/libpurple/protocols/gg/lib/pubdir50.c @@ -31,7 +31,6 @@ #include #include "libgadu.h" -#include "libgadu-config.h" #include "libgadu-internal.h" #include "encoding.h" diff --git a/libpurple/protocols/gg/lib/resolver.c b/libpurple/protocols/gg/lib/resolver.c index 529b9cb9cb..f1f6b14258 100644 --- a/libpurple/protocols/gg/lib/resolver.c +++ b/libpurple/protocols/gg/lib/resolver.c @@ -26,26 +26,21 @@ * \brief Funkcje rozwiązywania nazw */ -#ifndef _WIN32 -# include -# include -#endif #include #include #include #include -#ifndef _WIN32 -# include -# include -# include -#endif #include "libgadu.h" -#include "libgadu-config.h" #include "resolver.h" #include "compat.h" #include "session.h" +#ifdef GG_CONFIG_HAVE_FORK +#include +#include +#endif + /** Sposób rozwiązywania nazw serwerów */ static gg_resolver_t gg_global_resolver_type = GG_RESOLVER_DEFAULT; @@ -249,7 +244,8 @@ int gg_gethostbyname_real(const char *hostname, struct in_addr **result, int *co #endif /* GG_CONFIG_HAVE_GETHOSTBYNAME_R */ } -#if defined(GG_CONFIG_HAVE_PTHREAD) || !defined(_WIN32) +#if defined(GG_CONFIG_HAVE_PTHREAD) || defined(GG_CONFIG_HAVE_FORK) + /** * \internal Rozwiązuje nazwę i zapisuje wynik do podanego desktyptora. * @@ -287,7 +283,8 @@ static int gg_resolver_run(int fd, const char *hostname) return res; } -#endif + +#endif /* GG_CONFIG_HAVE_PTHREAD || GG_CONFIG_HAVE_FORK */ /** * \internal Odpowiednik \c gethostbyname zapewniający współbieżność. @@ -312,6 +309,8 @@ struct in_addr *gg_gethostbyname(const char *hostname) return result; } +#ifdef GG_CONFIG_HAVE_FORK + /** * \internal Struktura przekazywana do wątku rozwiązującego nazwę. */ @@ -319,280 +318,6 @@ struct gg_resolver_fork_data { int pid; /*< Identyfikator procesu */ }; -#ifdef _WIN32 -/** - * Deal with the fact that you can't select() on a win32 file fd. - * This makes it practically impossible to tie into purple's event loop. - * - * -This is thanks to Tor Lillqvist. - * XXX - Move this to where the rest of the the win32 compatiblity stuff goes when we push the changes back to libgadu. - */ -static int -socket_pipe (int *fds) -{ - SOCKET temp, socket1 = -1, socket2 = -1; - struct sockaddr_in saddr; - int len; - u_long arg; - fd_set read_set, write_set; - struct timeval tv; - - temp = socket(AF_INET, SOCK_STREAM, 0); - - if (temp == INVALID_SOCKET) { - goto out0; - } - - arg = 1; - if (ioctlsocket(temp, FIONBIO, &arg) == SOCKET_ERROR) { - goto out0; - } - - memset(&saddr, 0, sizeof(saddr)); - saddr.sin_family = AF_INET; - saddr.sin_port = 0; - saddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (bind(temp, (struct sockaddr *)&saddr, sizeof (saddr))) { - goto out0; - } - - if (listen(temp, 1) == SOCKET_ERROR) { - goto out0; - } - - len = sizeof(saddr); - if (getsockname(temp, (struct sockaddr *)&saddr, &len)) { - goto out0; - } - - socket1 = socket(AF_INET, SOCK_STREAM, 0); - - if (socket1 == INVALID_SOCKET) { - goto out0; - } - - arg = 1; - if (ioctlsocket(socket1, FIONBIO, &arg) == SOCKET_ERROR) { - goto out1; - } - - if (connect(socket1, (struct sockaddr *)&saddr, len) != SOCKET_ERROR || - WSAGetLastError() != WSAEWOULDBLOCK) { - goto out1; - } - - FD_ZERO(&read_set); - FD_SET(temp, &read_set); - - tv.tv_sec = 0; - tv.tv_usec = 0; - - if (select(0, &read_set, NULL, NULL, NULL) == SOCKET_ERROR) { - goto out1; - } - - if (!FD_ISSET(temp, &read_set)) { - goto out1; - } - - socket2 = accept(temp, (struct sockaddr *) &saddr, &len); - if (socket2 == INVALID_SOCKET) { - goto out1; - } - - FD_ZERO(&write_set); - FD_SET(socket1, &write_set); - - tv.tv_sec = 0; - tv.tv_usec = 0; - - if (select(0, NULL, &write_set, NULL, NULL) == SOCKET_ERROR) { - goto out2; - } - - if (!FD_ISSET(socket1, &write_set)) { - goto out2; - } - - arg = 0; - if (ioctlsocket(socket1, FIONBIO, &arg) == SOCKET_ERROR) { - goto out2; - } - - arg = 0; - if (ioctlsocket(socket2, FIONBIO, &arg) == SOCKET_ERROR) { - goto out2; - } - - fds[0] = socket1; - fds[1] = socket2; - - closesocket (temp); - - return 0; - -out2: - closesocket (socket2); -out1: - closesocket (socket1); -out0: - closesocket (temp); - errno = EIO; /* XXX */ - - return -1; -} -#endif - - - -#ifdef _WIN32 -struct gg_resolve_win32thread_data { - char *hostname; - int fd; -}; - -static DWORD WINAPI gg_resolve_win32thread_thread(LPVOID arg) -{ - struct gg_resolve_win32thread_data *d = arg; - struct in_addr addr_ip[2], *addr_list; - int addr_count; - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_thread() host: %s, fd: %i called\n", d->hostname, d->fd); - - if ((addr_ip[0].s_addr = inet_addr(d->hostname)) == INADDR_NONE) { - /* W przypadku błędu gg_gethostbyname_real() zwróci -1 - * i nie zmieni &addr. Tam jest już INADDR_NONE, - * więc nie musimy robić nic więcej. */ - if (gg_gethostbyname_real(d->hostname, &addr_list, &addr_count, 0) == -1) - { - addr_list = addr_ip; - } - } else { - addr_list = addr_ip; - addr_ip[1].s_addr = INADDR_NONE; - addr_count = 1; - } - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_thread() count = %d\n", addr_count); - - write(d->fd, addr_list, (addr_count+1) * sizeof(struct in_addr)); - close(d->fd); - - free(d->hostname); - d->hostname = NULL; - - free(d); - - if (addr_list != addr_ip) - free(addr_list); - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_thread() done\n"); - - return 0; -} - - -static int gg_resolve_win32thread(int *fd, void **resolver, const char *hostname) -{ - struct gg_resolve_win32thread_data *d = NULL; - HANDLE h; - DWORD dwTId; - int pipes[2], new_errno; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_resolve_win32thread(%p, %p, \"%s\");\n", fd, resolver, hostname); - - if (!resolver || !fd || !hostname) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - if (socket_pipe(pipes) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() unable to create pipes (errno=%d, %s)\n", errno, strerror(errno)); - return -1; - } - - if (!(d = malloc(sizeof(*d)))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() out of memory\n"); - new_errno = errno; - goto cleanup; - } - - d->hostname = NULL; - - if (!(d->hostname = strdup(hostname))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() out of memory\n"); - new_errno = errno; - goto cleanup; - } - - d->fd = pipes[1]; - - h = CreateThread(NULL, 0, gg_resolve_win32thread_thread, - d, 0, &dwTId); - - if (h == NULL) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() unable to create thread\n"); - new_errno = errno; - goto cleanup; - } - - *resolver = h; - *fd = pipes[0]; - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() done\n"); - - return 0; - -cleanup: - if (d) { - free(d->hostname); - free(d); - } - - close(pipes[0]); - close(pipes[1]); - - errno = new_errno; - - return -1; - -} - -static void gg_resolve_win32thread_cleanup(void **priv_data, int force) -{ - struct gg_resolve_win32thread_data *data; - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_cleanup() force: %i called\n", force); - - if (priv_data == NULL || *priv_data == NULL) - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_cleanup() priv_data: NULL\n"); - return; - - data = (struct gg_resolve_win32thread_data*) *priv_data; - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_cleanup() data: %s called\n", data->hostname); - *priv_data = NULL; - - if (force) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_cleanup() force called\n", force); - //pthread_cancel(data->thread); - //pthread_join(data->thread, NULL); - } - - free(data->hostname); - data->hostname = NULL; - - if (data->fd != -1) { - close(data->fd); - data->fd = -1; - } - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread_cleanup() done\n"); - free(data); -} -#endif - -#ifndef _WIN32 /** * \internal Rozwiązuje nazwę serwera w osobnym procesie. * @@ -644,12 +369,17 @@ static int gg_resolver_fork_start(int *fd, void **priv_data, const char *hostnam } if (data->pid == 0) { + int status; + close(pipes[0]); - if (gg_resolver_run(pipes[1], hostname) == -1) - _exit(1); - else - _exit(0); + status = (gg_resolver_run(pipes[1], hostname) == -1) ? 1 : 0; + +#ifdef GG_CONFIG_HAVE__EXIT + _exit(status); +#else + exit(status); +#endif } close(pipes[1]); @@ -698,7 +428,8 @@ static void gg_resolver_fork_cleanup(void **priv_data, int force) free(data); } -#endif + +#endif /* GG_CONFIG_HAVE_FORK */ #ifdef GG_CONFIG_HAVE_PTHREAD @@ -868,25 +599,15 @@ int gg_session_set_resolver(struct gg_session *gs, gg_resolver_t type) return 0; } -#if !defined(GG_CONFIG_HAVE_PTHREAD) || !defined(GG_CONFIG_PTHREAD_DEFAULT) -# ifdef _WIN32 - type = GG_RESOLVER_WIN32; -# else - type = GG_RESOLVER_FORK; -# endif -#else +#if defined(GG_CONFIG_HAVE_PTHREAD) && defined(GG_CONFIG_PTHREAD_DEFAULT) type = GG_RESOLVER_PTHREAD; +#elif defined(GG_CONFIG_HAVE_FORK) + type = GG_RESOLVER_FORK; #endif } switch (type) { -#ifdef _WIN32 - case GG_RESOLVER_WIN32: - gs->resolver_type = type; - gs->resolver_start = gg_resolve_win32thread; - gs->resolver_cleanup = gg_resolve_win32thread_cleanup; - return 0; -#else +#ifdef GG_CONFIG_HAVE_FORK case GG_RESOLVER_FORK: gs->resolver_type = type; gs->resolver_start = gg_resolver_fork_start; @@ -989,25 +710,15 @@ int gg_http_set_resolver(struct gg_http *gh, gg_resolver_t type) return 0; } -#if !defined(GG_CONFIG_HAVE_PTHREAD) || !defined(GG_CONFIG_PTHREAD_DEFAULT) -# ifdef _WIN32 - type = GG_RESOLVER_WIN32; -# else - type = GG_RESOLVER_FORK; -# endif -#else +#if defined(GG_CONFIG_HAVE_PTHREAD) && defined(GG_CONFIG_PTHREAD_DEFAULT) type = GG_RESOLVER_PTHREAD; +#elif defined(GG_CONFIG_HAVE_FORK) + type = GG_RESOLVER_FORK; #endif } switch (type) { -#ifdef _WIN32 - case GG_RESOLVER_WIN32: - gh->resolver_type = type; - gh->resolver_start = gg_resolve_win32thread; - gh->resolver_cleanup = gg_resolve_win32thread_cleanup; - return 0; -#else +#ifdef GG_CONFIG_HAVE_FORK case GG_RESOLVER_FORK: gh->resolver_type = type; gh->resolver_start = gg_resolver_fork_start; @@ -1085,13 +796,7 @@ int gg_global_set_resolver(gg_resolver_t type) gg_global_resolver_cleanup = NULL; return 0; -#ifdef _WIN32 - case GG_RESOLVER_WIN32: - gg_global_resolver_type = type; - gg_global_resolver_start = gg_resolve_win32thread; - gg_global_resolver_cleanup = gg_resolve_win32thread_cleanup; - return 0; -#else +#ifdef GG_CONFIG_HAVE_FORK case GG_RESOLVER_FORK: gg_global_resolver_type = type; gg_global_resolver_start = gg_resolver_fork_start; diff --git a/libpurple/protocols/gg/lib/resolver.h b/libpurple/protocols/gg/lib/resolver.h index 80a1adec90..09b230cec8 100644 --- a/libpurple/protocols/gg/lib/resolver.h +++ b/libpurple/protocols/gg/lib/resolver.h @@ -19,9 +19,7 @@ #ifndef LIBGADU_RESOLVER_H #define LIBGADU_RESOLVER_H -#ifndef _WIN32 -# include -#endif +#include "compat.h" int gg_gethostbyname_real(const char *hostname, struct in_addr **result, int *count, int pthread); diff --git a/libpurple/protocols/gg/search.c b/libpurple/protocols/gg/search.c index 67bb1bda18..d3ec62b06b 100644 --- a/libpurple/protocols/gg/search.c +++ b/libpurple/protocols/gg/search.c @@ -135,7 +135,7 @@ void ggp_search_destroy(GGPSearches *searches) /* guint32 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form) {{{ */ guint32 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form) { - GGPInfo *info = gc->proto_data; + GGPInfo *info = purple_connection_get_protocol_data(gc); gg_pubdir50_t req; guint seq, offset; diff --git a/libpurple/protocols/irc/cmds.c b/libpurple/protocols/irc/cmds.c index b725b76e57..5a704a243f 100644 --- a/libpurple/protocols/irc/cmds.c +++ b/libpurple/protocols/irc/cmds.c @@ -423,7 +423,7 @@ int irc_cmd_quit(struct irc_conn *irc, const char *cmd, const char *target, cons irc->quitting = TRUE; - if (!irc->account->disconnecting) + if (!purple_account_is_disconnecting(irc->account)) purple_account_set_status(irc->account, "offline", TRUE, NULL); } diff --git a/libpurple/protocols/irc/dcc_send.c b/libpurple/protocols/irc/dcc_send.c index 7082fd3ade..132bfceef9 100644 --- a/libpurple/protocols/irc/dcc_send.c +++ b/libpurple/protocols/irc/dcc_send.c @@ -34,11 +34,12 @@ struct irc_xfer_rx_data { gchar *ip; + unsigned int remote_port; }; static void irc_dccsend_recv_destroy(PurpleXfer *xfer) { - struct irc_xfer_rx_data *xd = xfer->data; + struct irc_xfer_rx_data *xd = purple_xfer_get_protocol_data(xfer); g_free(xd->ip); g_free(xd); @@ -51,10 +52,10 @@ static void irc_dccsend_recv_destroy(PurpleXfer *xfer) */ static void irc_dccsend_recv_ack(PurpleXfer *xfer, const guchar *data, size_t size) { guint32 l; - size_t result; + gssize result; - l = htonl(xfer->bytes_sent); - result = write(xfer->fd, &l, sizeof(l)); + l = htonl(purple_xfer_get_bytes_sent(xfer)); + result = purple_xfer_write(xfer, (guchar *)&l, sizeof(l)); if (result != sizeof(l)) { purple_debug_error("irc", "unable to send acknowledgement: %s\n", g_strerror(errno)); /* TODO: We should probably close the connection here or something. */ @@ -62,9 +63,9 @@ static void irc_dccsend_recv_ack(PurpleXfer *xfer, const guchar *data, size_t si } static void irc_dccsend_recv_init(PurpleXfer *xfer) { - struct irc_xfer_rx_data *xd = xfer->data; + struct irc_xfer_rx_data *xd = purple_xfer_get_protocol_data(xfer); - purple_xfer_start(xfer, -1, xd->ip, xfer->remote_port); + purple_xfer_start(xfer, -1, xd->ip, xd->remote_port); g_free(xd->ip); xd->ip = NULL; } @@ -114,10 +115,10 @@ void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg) { if (xfer) { xd = g_new0(struct irc_xfer_rx_data, 1); - xfer->data = xd; + purple_xfer_set_protocol_data(xfer, xd); purple_xfer_set_filename(xfer, filename->str); - xfer->remote_port = atoi(token[i+1]); + xd->remote_port = atoi(token[i+1]); nip = strtoul(token[i], NULL, 10); if (nip) { @@ -157,7 +158,7 @@ struct irc_xfer_send_data { static void irc_dccsend_send_destroy(PurpleXfer *xfer) { - struct irc_xfer_send_data *xd = xfer->data; + struct irc_xfer_send_data *xd = purple_xfer_get_protocol_data(xfer); if (xd == NULL) return; @@ -178,7 +179,7 @@ static void irc_dccsend_send_destroy(PurpleXfer *xfer) static void irc_dccsend_send_read(gpointer data, int source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - struct irc_xfer_send_data *xd = xfer->data; + struct irc_xfer_send_data *xd = purple_xfer_get_protocol_data(xfer); char buffer[64]; int len; @@ -228,13 +229,13 @@ static void irc_dccsend_send_read(gpointer data, int source, PurpleInputConditio static gssize irc_dccsend_send_write(const guchar *buffer, size_t size, PurpleXfer *xfer) { gssize s; - int ret; + gssize ret; s = MIN(purple_xfer_get_bytes_remaining(xfer), size); if (!s) return 0; - ret = write(xfer->fd, buffer, s); + ret = purple_xfer_write(xfer, buffer, s); if (ret < 0 && errno == EAGAIN) ret = 0; @@ -244,7 +245,7 @@ static gssize irc_dccsend_send_write(const guchar *buffer, size_t size, PurpleXf static void irc_dccsend_send_connected(gpointer data, int source, PurpleInputCondition cond) { PurpleXfer *xfer = (PurpleXfer *) data; - struct irc_xfer_send_data *xd = xfer->data; + struct irc_xfer_send_data *xd = purple_xfer_get_protocol_data(xfer); int conn, flags; conn = accept(xd->fd, NULL, 0); @@ -257,8 +258,8 @@ static void irc_dccsend_send_connected(gpointer data, int source, PurpleInputCon return; } - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); close(xd->fd); xd->fd = -1; @@ -285,7 +286,7 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) struct in_addr addr; unsigned short int port; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); xd->listen_data = NULL; if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL @@ -294,9 +295,9 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) return; } - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); gc = purple_account_get_connection(purple_xfer_get_account(xfer)); - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); purple_xfer_unref(xfer); @@ -312,17 +313,17 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) port = purple_network_get_port_from_fd(sock); purple_debug_misc("irc", "port is %hu\n", port); /* Monitor the listening socket */ - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - irc_dccsend_send_connected, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(sock, PURPLE_INPUT_READ, + irc_dccsend_send_connected, xfer)); /* Send the intended recipient the DCC request */ - arg[0] = xfer->who; + arg[0] = purple_xfer_get_remote_user(xfer); inet_aton(purple_network_get_my_ip(irc->fd), &addr); - arg[1] = tmp = g_strdup_printf("\001DCC SEND \"%s\" %u %hu %" G_GSIZE_FORMAT "\001", - xfer->filename, ntohl(addr.s_addr), - port, xfer->size); + arg[1] = tmp = g_strdup_printf("\001DCC SEND \"%s\" %u %hu %" G_GOFFSET_FORMAT "\001", + purple_xfer_get_filename(xfer), ntohl(addr.s_addr), + port, purple_xfer_get_size(xfer)); - irc_cmd_privmsg(gc->proto_data, "msg", NULL, arg); + irc_cmd_privmsg(purple_connection_get_protocol_data(gc), "msg", NULL, arg); g_free(tmp); } @@ -331,14 +332,14 @@ irc_dccsend_network_listen_cb(int sock, gpointer data) */ static void irc_dccsend_send_init(PurpleXfer *xfer) { PurpleConnection *gc = purple_account_get_connection(purple_xfer_get_account(xfer)); - struct irc_xfer_send_data *xd = xfer->data; + struct irc_xfer_send_data *xd = purple_xfer_get_protocol_data(xfer); - xfer->filename = g_path_get_basename(xfer->local_filename); + purple_xfer_set_filename(xfer, g_path_get_basename(purple_xfer_get_local_filename(xfer))); purple_xfer_ref(xfer); /* Create a listening socket */ - xd->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, + xd->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, irc_dccsend_network_listen_cb, xfer); if (xd->listen_data == NULL) { purple_xfer_unref(xfer); @@ -359,7 +360,7 @@ PurpleXfer *irc_dccsend_new_xfer(PurpleConnection *gc, const char *who) { { xd = g_new0(struct irc_xfer_send_data, 1); xd->fd = -1; - xfer->data = xd; + purple_xfer_set_protocol_data(xfer, xd); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, irc_dccsend_send_init); diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c index a5ef1d38cc..1b02c67df6 100644 --- a/libpurple/protocols/irc/irc.c +++ b/libpurple/protocols/irc/irc.c @@ -70,11 +70,11 @@ static void irc_view_motd(PurplePluginAction *action) struct irc_conn *irc; char *title; - if (gc == NULL || gc->proto_data == NULL) { + if (gc == NULL || purple_connection_get_protocol_data(gc) == NULL) { purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n"); return; } - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if (irc->motd == NULL) { purple_notify_error(gc, _("Error displaying MOTD"), _("No MOTD available"), _("There is no MOTD associated with this connection.")); @@ -100,7 +100,7 @@ static int do_send(struct irc_conn *irc, const char *buf, gsize len) static int irc_send_raw(PurpleConnection *gc, const char *buf, int len) { - struct irc_conn *irc = (struct irc_conn*)gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if (len == -1) { len = strlen(buf); } @@ -356,7 +356,7 @@ static void irc_login(PurpleAccount *account) const char *username = purple_account_get_username(account); gc = purple_account_get_connection(account); - gc->flags |= PURPLE_CONNECTION_NO_NEWLINES; + purple_connection_set_flags(gc, PURPLE_CONNECTION_NO_NEWLINES); if (strpbrk(username, " \t\v\r\n") != NULL) { purple_connection_error (gc, @@ -365,7 +365,8 @@ static void irc_login(PurpleAccount *account) return; } - gc->proto_data = irc = g_new0(struct irc_conn, 1); + irc = g_new0(struct irc_conn, 1); + purple_connection_set_protocol_data(gc, irc); irc->fd = -1; irc->account = account; irc->outbuf = purple_circ_buffer_new(512); @@ -415,7 +416,7 @@ static gboolean do_login(PurpleConnection *gc) { char *buf, *tmp = NULL; char *server; const char *username, *realname; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); const char *pass = purple_connection_get_password(gc); if (pass && *pass) { @@ -485,7 +486,7 @@ static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc, static void irc_login_cb(gpointer data, gint source, const gchar *error_message) { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if (source < 0) { gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), @@ -499,7 +500,7 @@ static void irc_login_cb(gpointer data, gint source, const gchar *error_message) irc->fd = source; if (do_login(gc)) { - gc->inpa = purple_input_add(irc->fd, PURPLE_INPUT_READ, irc_input_cb, gc); + irc->inpa = purple_input_add(irc->fd, PURPLE_INPUT_READ, irc_input_cb, gc); } } @@ -508,7 +509,7 @@ irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, gpointer data) { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); irc->gsc = NULL; @@ -517,7 +518,7 @@ irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, static void irc_close(PurpleConnection *gc) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if (irc == NULL) return; @@ -525,8 +526,10 @@ static void irc_close(PurpleConnection *gc) if (irc->gsc || (irc->fd >= 0)) irc_cmd_quit(irc, "quit", NULL, NULL); - if (gc->inpa) - purple_input_remove(gc->inpa); + if (irc->inpa) { + purple_input_remove(irc->inpa); + irc->inpa = 0; + } g_free(irc->inbuf); if (irc->gsc) { @@ -558,7 +561,7 @@ static void irc_close(PurpleConnection *gc) static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); char *plain; const char *args[2]; @@ -574,7 +577,7 @@ static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, static void irc_get_info(PurpleConnection *gc, const char *who) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); const char *args[2]; args[0] = who; args[1] = NULL; @@ -589,7 +592,7 @@ static void irc_set_status(PurpleAccount *account, PurpleStatus *status) const char *status_id = purple_status_get_id(status); g_return_if_fail(gc != NULL); - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if (!purple_status_is_active(status)) return; @@ -606,9 +609,9 @@ static void irc_set_status(PurpleAccount *account, PurpleStatus *status) } } -static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { - struct irc_conn *irc = (struct irc_conn *)gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); struct irc_buddy *ib; const char *bname = purple_buddy_get_name(buddy); @@ -633,7 +636,7 @@ static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - struct irc_conn *irc = (struct irc_conn *)gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); struct irc_buddy *ib; ib = g_hash_table_lookup(irc->buddies, purple_buddy_get_name(buddy)); @@ -644,9 +647,10 @@ static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGro static void read_input(struct irc_conn *irc, int len) { + PurpleConnection *connection = purple_account_get_connection(irc->account); char *cur, *end; - irc->account->gc->last_received = time(NULL); + purple_connection_update_last_received(connection); irc->inbufused += len; irc->inbuf[irc->inbufused] = '\0'; @@ -678,7 +682,7 @@ static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); int len; if(!g_list_find(purple_connections_get_all(), gc)) { @@ -716,7 +720,7 @@ static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); int len; if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { @@ -746,7 +750,7 @@ static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond) static void irc_chat_join (PurpleConnection *gc, GHashTable *data) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); const char *args[2]; args[0] = g_hash_table_lookup(data, "channel"); @@ -760,7 +764,7 @@ static char *irc_get_chat_name(GHashTable *data) { static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); PurpleConversation *convo = purple_find_chat(gc, id); const char *args[2]; @@ -776,7 +780,7 @@ static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, c static void irc_chat_leave (PurpleConnection *gc, int id) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); PurpleConversation *convo = purple_find_chat(gc, id); const char *args[2]; @@ -791,7 +795,7 @@ static void irc_chat_leave (PurpleConnection *gc, int id) static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); PurpleConversation *convo = purple_find_chat(gc, id); const char *args[2]; char *tmp; @@ -806,7 +810,7 @@ static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleM } #endif purple_markup_html_to_xhtml(what, NULL, &tmp); - args[0] = convo->name; + args[0] = purple_conversation_get_name(convo); args[1] = tmp; irc_cmd_privmsg(irc, "msg", NULL, args); @@ -845,7 +849,7 @@ static void irc_chat_set_topic(PurpleConnection *gc, int id, const char *topic) const char *name = NULL; struct irc_conn *irc; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); name = purple_conversation_get_name(purple_find_chat(gc, id)); if (name == NULL) @@ -863,7 +867,7 @@ static PurpleRoomlist *irc_roomlist_get_list(PurpleConnection *gc) PurpleRoomlistField *f; char *buf; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if (irc->roomlist) purple_roomlist_unref(irc->roomlist); @@ -890,13 +894,14 @@ static PurpleRoomlist *irc_roomlist_get_list(PurpleConnection *gc) static void irc_roomlist_cancel(PurpleRoomlist *list) { - PurpleConnection *gc = purple_account_get_connection(list->account); + PurpleAccount *account = purple_roomlist_get_account(list); + PurpleConnection *gc = purple_account_get_connection(account); struct irc_conn *irc; if (gc == NULL) return; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); purple_roomlist_set_in_progress(list, FALSE); @@ -908,13 +913,14 @@ static void irc_roomlist_cancel(PurpleRoomlist *list) static void irc_keepalive(PurpleConnection *gc) { - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc = purple_connection_get_protocol_data(gc); if ((time(NULL) - irc->recv_time) > PING_TIMEOUT) irc_cmd_ping(irc, NULL, NULL, NULL); } static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_SLASH_COMMANDS_NATIVE, NULL, /* user_splits */ @@ -956,7 +962,6 @@ static PurplePluginProtocolInfo prpl_info = irc_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ @@ -981,15 +986,12 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static gboolean load_plugin (PurplePlugin *plugin) { diff --git a/libpurple/protocols/irc/irc.h b/libpurple/protocols/irc/irc.h index 31d6030176..2a4c417c2a 100644 --- a/libpurple/protocols/irc/irc.h +++ b/libpurple/protocols/irc/irc.h @@ -54,6 +54,7 @@ struct irc_conn { GHashTable *cmds; char *server; int fd; + guint inpa; guint timer; guint who_channel_timer; GHashTable *buddies; diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c index 4ee1c19e95..36753893e2 100644 --- a/libpurple/protocols/irc/msgs.c +++ b/libpurple/protocols/irc/msgs.c @@ -92,7 +92,7 @@ static void irc_connected(struct irc_conn *irc, const char *nick) /* If we're away then set our away message */ status = purple_account_get_active_status(irc->account); if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) { - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); prpl_info->set_status(irc->account, status); } @@ -457,12 +457,12 @@ void irc_msg_who(struct irc_conn *irc, const char *name, const char *from, char g_free(userhost); g_free(realname); - flags = cb->flags; + flags = purple_conv_chat_cb_get_flags(cb); if (args[6][0] == 'G' && !(flags & PURPLE_CBFLAGS_AWAY)) { - purple_conv_chat_user_set_flags(chat, cb->name, flags | PURPLE_CBFLAGS_AWAY); + purple_conv_chat_user_set_flags(chat, purple_conv_chat_cb_get_name(cb), flags | PURPLE_CBFLAGS_AWAY); } else if(args[6][0] == 'H' && (flags & PURPLE_CBFLAGS_AWAY)) { - purple_conv_chat_user_set_flags(chat, cb->name, flags & ~PURPLE_CBFLAGS_AWAY); + purple_conv_chat_user_set_flags(chat, purple_conv_chat_cb_get_name(cb), flags & ~PURPLE_CBFLAGS_AWAY); } } } diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/parse.c index 3008b42cc9..9a8fb8298f 100644 --- a/libpurple/protocols/irc/parse.c +++ b/libpurple/protocols/irc/parse.c @@ -171,11 +171,11 @@ static PurpleCmdRet irc_parse_purple_cmd(PurpleConversation *conv, const gchar * struct irc_conn *irc; struct _irc_user_cmd *cmdent; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (!gc) return PURPLE_CMD_RET_FAILED; - irc = gc->proto_data; + irc = purple_connection_get_protocol_data(gc); if ((cmdent = g_hash_table_lookup(irc->cmds, cmd)) == NULL) return PURPLE_CMD_RET_FAILED; @@ -260,6 +260,12 @@ static char *irc_recv_convert(struct irc_conn *irc, const char *string) gboolean autodetect; int i; + autodetect = purple_account_get_bool(irc->account, "autodetect_utf8", IRC_DEFAULT_AUTODETECT); + + if (autodetect && g_utf8_validate(string, -1, NULL)) { + return g_strdup(string); + } + enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); encodings = g_strsplit(enclist, ",", -1); @@ -268,12 +274,6 @@ static char *irc_recv_convert(struct irc_conn *irc, const char *string) return purple_utf8_salvage(string); } - autodetect = purple_account_get_bool(irc->account, "autodetect_utf8", IRC_DEFAULT_AUTODETECT); - - if (autodetect && g_utf8_validate(string, -1, NULL)) { - return g_strdup(string); - } - for (i = 0; encodings[i] != NULL; i++) { charset = encodings[i]; while (*charset == ' ') @@ -708,7 +708,14 @@ void irc_parse_msg(struct irc_conn *irc, char *input) switch (fmt[i]) { case 'v': if (!(end = strchr(cur, ' '))) end = cur + strlen(cur); - args[i] = g_strndup(cur, end - cur); + /* This is a string of unknown encoding which we do not + * want to transcode, but it may or may not be valid + * UTF-8, so we'll salvage it. If a nick/channel/target + * field has inadvertently been marked verbatim, this + * could cause weirdness. */ + tmp = g_strndup(cur, end - cur); + args[i] = purple_utf8_salvage(tmp); + g_free(tmp); cur += end - cur; break; case 't': @@ -726,7 +733,9 @@ void irc_parse_msg(struct irc_conn *irc, char *input) cur = cur + strlen(cur); break; case '*': - args[i] = g_strdup(cur); + /* Ditto 'v' above; we're going to salvage this in case + * it leaks past the IRC prpl */ + args[i] = purple_utf8_salvage(cur); cur = cur + strlen(cur); break; default: diff --git a/libpurple/protocols/jabber/adhoccommands.c b/libpurple/protocols/jabber/adhoccommands.c index 214f5dfdef..60dc73305d 100644 --- a/libpurple/protocols/jabber/adhoccommands.c +++ b/libpurple/protocols/jabber/adhoccommands.c @@ -228,7 +228,8 @@ void jabber_adhoc_execute_action(PurpleBlistNode *node, gpointer data) { JabberAdHocCommands *cmd = data; PurpleBuddy *buddy = (PurpleBuddy *) node; PurpleAccount *account = purple_buddy_get_account(buddy); - JabberStream *js = purple_account_get_connection(account)->proto_data; + PurpleConnection *gc = purple_account_get_connection(account); + JabberStream *js = purple_connection_get_protocol_data(gc); jabber_adhoc_execute(js, cmd); } @@ -321,7 +322,7 @@ static void jabber_adhoc_server_execute(PurplePluginAction *action) { JabberAdHocCommands *cmd = action->user_data; if(cmd) { PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); jabber_adhoc_execute(js, cmd); } diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 5c4cad5cc6..374eba2eb2 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -501,7 +501,7 @@ void jabber_set_info(PurpleConnection *gc, const char *info) vc_node = NULL; } - if ((img = purple_buddy_icons_find_account_icon(gc->account))) { + if ((img = purple_buddy_icons_find_account_icon(purple_connection_get_account(gc)))) { gconstpointer avatar_data; gsize avatar_len; xmlnode *photo, *binval, *type; @@ -557,7 +557,7 @@ void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) PurpleAccount *account = purple_connection_get_account(gc); /* Publish the avatar as specified in XEP-0084 */ - jabber_avatar_set(gc->proto_data, img); + jabber_avatar_set(purple_connection_get_protocol_data(gc), img); /* Set the image in our vCard */ jabber_set_info(gc, purple_account_get_user_info(account)); @@ -642,7 +642,7 @@ void jabber_setup_set_info(PurplePluginAction *action) /* * Get existing, XML-formatted, user info */ - if((user_info = purple_account_get_user_info(gc->account)) != NULL) + if((user_info = purple_account_get_user_info(purple_connection_get_account(gc))) != NULL) x_vc_data = xmlnode_from_str(user_info, -1); /* @@ -1360,7 +1360,7 @@ static void jabber_last_parse(JabberStream *js, const char *from, if (jbr == jabber_buddy_find_resource(jb, NULL)) { - purple_prpl_got_user_idle(js->gc->account, + purple_prpl_got_user_idle(purple_connection_get_account(js->gc), buddy_name, jbr->idle, jbr->idle); } } @@ -2255,10 +2255,10 @@ void jabber_user_search(JabberStream *js, const char *directory) make sure we aren't persisting an old value */ if(js->user_directories && js->user_directories->data && !strcmp(directory, js->user_directories->data)) { - purple_account_set_string(js->gc->account, "user_directory", ""); + purple_account_set_string(purple_connection_get_account(js->gc), "user_directory", ""); } else { - purple_account_set_string(js->gc->account, "user_directory", directory); + purple_account_set_string(purple_connection_get_account(js->gc), "user_directory", directory); } iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:search"); @@ -2273,7 +2273,7 @@ void jabber_user_search_begin(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; JabberStream *js = purple_connection_get_protocol_data(gc); - const char *def_val = purple_account_get_string(js->gc->account, "user_directory", ""); + const char *def_val = purple_account_get_string(purple_connection_get_account(js->gc), "user_directory", ""); if(!*def_val && js->user_directories) def_val = js->user_directories->data; diff --git a/libpurple/protocols/jabber/caps.c b/libpurple/protocols/jabber/caps.c index ead8b1a002..b03623af6f 100644 --- a/libpurple/protocols/jabber/caps.c +++ b/libpurple/protocols/jabber/caps.c @@ -794,11 +794,11 @@ static GList* jabber_caps_xdata_get_fields(const xmlnode *x) for (value = xmlnode_get_child(field, "value"); value; value = xmlnode_get_next_twin(value)) { gchar *val = xmlnode_get_data(value); - xdatafield->values = g_list_append(xdatafield->values, val); + xdatafield->values = g_list_prepend(xdatafield->values, val); } xdatafield->values = g_list_sort(xdatafield->values, (GCompareFunc)strcmp); - fields = g_list_append(fields, xdatafield); + fields = g_list_prepend(fields, xdatafield); } fields = g_list_sort(fields, jabber_caps_xdata_field_compare); @@ -875,21 +875,24 @@ gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash) g_free(formtype); while (fields) { - GList *value; JabberDataFormField *field = (JabberDataFormField*)fields->data; if (!g_str_equal(field->var, "FORM_TYPE")) { /* Append the "var" attribute */ append_escaped_string(context, field->var); /* Append elements' cdata */ - for (value = field->values; value; value = value->next) { - append_escaped_string(context, value->data); - g_free(value->data); + while (field->values) { + append_escaped_string(context, field->values->data); + g_free(field->values->data); + field->values = g_list_delete_link(field->values, + field->values); } + } else { + g_list_free_full(field->values, g_free); } g_free(field->var); - g_list_free(field->values); + g_free(field); fields = g_list_delete_link(fields, fields); } @@ -958,7 +961,7 @@ void jabber_caps_broadcast_change() const char *prpl_id = purple_account_get_protocol_id(account); if (g_str_equal("prpl-jabber", prpl_id) && purple_account_is_connected(account)) { PurpleConnection *gc = purple_account_get_connection(account); - jabber_presence_send(gc->proto_data, TRUE); + jabber_presence_send(purple_connection_get_protocol_data(gc), TRUE); } } diff --git a/libpurple/protocols/jabber/chat.c b/libpurple/protocols/jabber/chat.c index dfc52d6539..b4a3ec0e89 100644 --- a/libpurple/protocols/jabber/chat.c +++ b/libpurple/protocols/jabber/chat.c @@ -70,7 +70,7 @@ GList *jabber_chat_info(PurpleConnection *gc) GHashTable *jabber_chat_info_defaults(PurpleConnection *gc, const char *chat_name) { GHashTable *defaults; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); @@ -146,7 +146,7 @@ JabberChat *jabber_chat_find_by_conv(PurpleConversation *conv) int id; if (!gc) return NULL; - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); return jabber_chat_find_by_id(js, id); } @@ -154,7 +154,7 @@ JabberChat *jabber_chat_find_by_conv(PurpleConversation *conv) void jabber_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *name) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); JabberChat *chat; xmlnode *message, *body, *x, *invite; char *room_jid; @@ -360,7 +360,7 @@ void jabber_chat_join(PurpleConnection *gc, GHashTable *data) { char *room, *server, *handle, *passwd; JabberID *jid; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); char *tmp; room = g_hash_table_lookup(data, "room"); @@ -418,10 +418,9 @@ void jabber_chat_join(PurpleConnection *gc, GHashTable *data) void jabber_chat_leave(PurpleConnection *gc, int id) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); JabberChat *chat = jabber_chat_find_by_id(js, id); - if(!chat) return; @@ -459,7 +458,7 @@ gboolean jabber_chat_find_buddy(PurpleConversation *conv, const char *name) char *jabber_chat_buddy_real_name(PurpleConnection *gc, int id, const char *who) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); JabberChat *chat; JabberChatMember *jcm; @@ -887,13 +886,13 @@ static void roomlist_ok_cb(JabberStream *js, const char *server) char *jabber_roomlist_room_serialize(PurpleRoomlistRoom *room) { - - return g_strdup_printf("%s@%s", (char*)room->fields->data, (char*)room->fields->next->data); + GList *fields = purple_roomlist_room_get_fields(room); + return g_strdup_printf("%s@%s", (char*)fields->data, (char*)fields->next->data); } PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); GList *fields = NULL; PurpleRoomlistField *f; @@ -928,11 +927,13 @@ PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc) void jabber_roomlist_cancel(PurpleRoomlist *list) { + PurpleAccount *account; PurpleConnection *gc; JabberStream *js; - gc = purple_account_get_connection(list->account); - js = gc->proto_data; + account = purple_roomlist_get_account(list); + gc = purple_account_get_connection(account); + js = purple_connection_get_protocol_data(gc); purple_roomlist_set_in_progress(list, FALSE); diff --git a/libpurple/protocols/jabber/disco.c b/libpurple/protocols/jabber/disco.c index e66a0cb05d..1b5a3deac1 100644 --- a/libpurple/protocols/jabber/disco.c +++ b/libpurple/protocols/jabber/disco.c @@ -387,7 +387,7 @@ jabber_disco_finish_server_info_result_cb(JabberStream *js) } /* If there are manually specified bytestream proxies, query them */ - ft_proxies = purple_account_get_string(js->gc->account, "ft_proxies", NULL); + ft_proxies = purple_account_get_string(purple_connection_get_account(js->gc), "ft_proxies", NULL); if (ft_proxies) { JabberIq *iq; JabberBytestreamsStreamhost *sh; @@ -485,7 +485,7 @@ jabber_disco_stun_srv_resolve_cb(PurpleSrvResponse *resp, int results, gpointer resp[0].hostname, resp[0].port); account = purple_connection_get_account(js->gc); js->stun_query = - purple_dnsquery_a_account(account, resp[0].hostname, resp[0].port, + purple_dnsquery_a(account, resp[0].hostname, resp[0].port, jabber_disco_stun_lookup_cb, js); } } @@ -524,8 +524,10 @@ jabber_disco_server_info_result_cb(JabberStream *js, const char *from, if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) { PurpleConnection *gc = js->gc; js->pep = TRUE; - gc->flags |= PURPLE_CONNECTION_SUPPORT_MOODS | - PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES; + purple_connection_set_flags(gc, + purple_connection_get_flags(gc) + | PURPLE_CONNECTION_SUPPORT_MOODS + | PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES); } if (!category || strcmp(category, "server")) continue; @@ -550,7 +552,7 @@ jabber_disco_server_info_result_cb(JabberStream *js, const char *from, } else if (purple_network_get_stun_ip() == NULL || purple_strequal(purple_network_get_stun_ip(), "")) { js->srv_query_data = - purple_srv_resolve_account( + purple_srv_resolve( purple_connection_get_account(js->gc), "stun", "udp", js->user->domain, jabber_disco_stun_srv_resolve_cb, js); diff --git a/libpurple/protocols/jabber/google/gmail.c b/libpurple/protocols/jabber/google/gmail.c index 5f86b8efac..b5461e8168 100644 --- a/libpurple/protocols/jabber/google/gmail.c +++ b/libpurple/protocols/jabber/google/gmail.c @@ -150,7 +150,7 @@ jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, JabberIq *iq; /* bail if the user isn't interested */ - if (!purple_account_get_check_mail(js->gc->account)) + if (!purple_account_get_check_mail(purple_connection_get_account(js->gc))) return; /* Is this an initial incoming mail notification? If so, send a request for more info */ diff --git a/libpurple/protocols/jabber/google/google_presence.c b/libpurple/protocols/jabber/google/google_presence.c index c5ec55d946..b0095adcd4 100644 --- a/libpurple/protocols/jabber/google/google_presence.c +++ b/libpurple/protocols/jabber/google/google_presence.c @@ -27,12 +27,12 @@ void jabber_google_presence_incoming(JabberStream *js, const char *user, JabberB if (!js->googletalk) return; if (jbr->status && purple_str_has_prefix(jbr->status, "♫ ")) { - purple_prpl_got_user_status(js->gc->account, user, "tune", + purple_prpl_got_user_status(purple_connection_get_account(js->gc), user, "tune", PURPLE_TUNE_TITLE, jbr->status + strlen("♫ "), NULL); g_free(jbr->status); jbr->status = NULL; } else { - purple_prpl_got_user_status_deactive(js->gc->account, user, "tune"); + purple_prpl_got_user_status_deactive(purple_connection_get_account(js->gc), user, "tune"); } } diff --git a/libpurple/protocols/jabber/google/jingleinfo.c b/libpurple/protocols/jabber/google/jingleinfo.c index b49642a40e..81deb9d08c 100644 --- a/libpurple/protocols/jabber/google/jingleinfo.c +++ b/libpurple/protocols/jabber/google/jingleinfo.c @@ -117,7 +117,7 @@ jabber_google_jingle_info_common(JabberStream *js, const char *from, purple_dnsquery_destroy(js->stun_query); account = purple_connection_get_account(js->gc); - js->stun_query = purple_dnsquery_a_account(account, host, port, + js->stun_query = purple_dnsquery_a(account, host, port, jabber_google_stun_lookup_cb, js); } } diff --git a/libpurple/protocols/jabber/google/relay.c b/libpurple/protocols/jabber/google/relay.c index 4b48a8034e..bdc6fd644a 100644 --- a/libpurple/protocols/jabber/google/relay.c +++ b/libpurple/protocols/jabber/google/relay.c @@ -137,7 +137,7 @@ jabber_google_do_relay_request(JabberStream *js, GoogleSession *session, purple_debug_info("jabber", "sending Google relay request %s to %s\n", request, url); url_data = - purple_util_fetch_url_request(url, FALSE, NULL, FALSE, request, FALSE, + purple_util_fetch_url_request(NULL, url, FALSE, NULL, FALSE, request, FALSE, -1, jabber_google_relay_fetch_cb, data); if (url_data) { js->google_relay_requests = diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index bb185aa92f..690e2a5b2d 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -440,7 +440,7 @@ static gboolean do_jabber_send_raw(JabberStream *js, const char *data, int len) * we're disconnecting, don't generate (possibly another) error that * (for some UIs) would mask the first. */ - if (!account->disconnecting) { + if (!purple_account_is_disconnecting(account)) { gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); purple_connection_error(js->gc, @@ -616,7 +616,7 @@ void jabber_send(JabberStream *js, xmlnode *packet) static gboolean jabber_keepalive_timeout(PurpleConnection *gc) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Ping timed out")); js->keepalive_timeout = 0; @@ -642,7 +642,7 @@ jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond) { PurpleConnection *gc = data; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); int len; static char buf[4096]; @@ -653,7 +653,7 @@ jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, } while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); buf[len] = '\0'; purple_debug_info("jabber", "Recv (ssl)(%d): %s\n", len, buf); jabber_parser_process(js, buf, len); @@ -687,7 +687,7 @@ jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition) g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); #ifdef HAVE_CYRUS_SASL if (js->sasl_maxbuf > 0) { const char *out; @@ -747,7 +747,7 @@ jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc, g_return_if_reached(); } - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); if(js->state == JABBER_STREAM_CONNECTING) jabber_send_raw(js, "", -1); @@ -813,7 +813,7 @@ jabber_login_callback(gpointer data, gint source, const gchar *error) try_srv_connect(js); } else { purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain); - js->srv_query_data = purple_txt_resolve_account( + js->srv_query_data = purple_txt_resolve( purple_connection_get_account(gc), "_xmppconnect", js->user->domain, txt_resolved_cb, js); } @@ -829,7 +829,7 @@ jabber_login_callback(gpointer data, gint source, const gchar *error) jabber_send_raw(js, "", -1); jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); - gc->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); + js->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); } static void @@ -842,7 +842,7 @@ jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, /* If the connection is already disconnected, we don't need to do anything else */ g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); js->gsc = NULL; purple_connection_ssl_error (gc, error); @@ -850,9 +850,9 @@ jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, static void tls_init(JabberStream *js) { - purple_input_remove(js->gc->inpa); - js->gc->inpa = 0; - js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, js->fd, + purple_input_remove(js->inpa); + js->inpa = 0; + js->gsc = purple_ssl_connect_with_host_fd(purple_connection_get_account(js->gc), js->fd, jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); /* The fd is no longer our concern */ js->fd = -1; @@ -928,7 +928,8 @@ jabber_stream_new(PurpleAccount *account) gchar *user; gchar *slash; - js = gc->proto_data = g_new0(JabberStream, 1); + js = g_new0(JabberStream, 1); + purple_connection_set_protocol_data(gc, js); js->gc = gc; js->fd = -1; @@ -1073,7 +1074,7 @@ jabber_stream_connect(JabberStream *js) jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222), TRUE); } else { - js->srv_query_data = purple_srv_resolve_account(account, "xmpp-client", + js->srv_query_data = purple_srv_resolve(account, "xmpp-client", "tcp", js->user->domain, srv_resolved_cb, js); } } @@ -1085,8 +1086,7 @@ jabber_login(PurpleAccount *account) JabberStream *js; PurpleStoredImage *image; - gc->flags |= PURPLE_CONNECTION_HTML | - PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; + purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY); js = jabber_stream_new(account); if (js == NULL) return; @@ -1144,8 +1144,7 @@ jabber_registration_result_cb(JabberStream *js, const char *from, if(js->registration) { buf = g_strdup_printf(_("Registration of %s@%s successful"), js->user->node, js->user->domain); - if(account->registration_cb) - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); + purple_account_register_completed(account, TRUE); } else { g_return_if_fail(to != NULL); buf = g_strdup_printf(_("Registration to %s successful"), @@ -1163,8 +1162,7 @@ jabber_registration_result_cb(JabberStream *js, const char *from, purple_notify_error(NULL, _("Registration Failed"), _("Registration Failed"), msg); g_free(msg); - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); } g_free(to); if(js->registration) @@ -1264,7 +1262,7 @@ jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) cbdata->js->user->node = g_strdup(value); } if(cbdata->js->registration && !strcmp(id, "password")) - purple_account_set_password(cbdata->js->gc->account, value); + purple_account_set_password(purple_connection_get_account(cbdata->js->gc), value); } } } @@ -1273,7 +1271,7 @@ jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) username = g_strdup_printf("%s@%s%s%s", cbdata->js->user->node, cbdata->js->user->domain, cbdata->js->user->resource ? "/" : "", cbdata->js->user->resource ? cbdata->js->user->resource : ""); - purple_account_set_username(cbdata->js->gc->account, username); + purple_account_set_username(purple_connection_get_account(cbdata->js->gc), username); g_free(username); } @@ -1288,8 +1286,7 @@ jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fie { PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); if(account && cbdata->js->registration) { - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); jabber_connection_schedule_close(cbdata->js); } g_free(cbdata->who); @@ -1358,8 +1355,7 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type if(js->registration) { purple_notify_error(NULL, _("Already Registered"), _("Already Registered"), NULL); - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); jabber_connection_schedule_close(js); return; } @@ -1380,8 +1376,8 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type if(js->registration) { js->gc->wants_to_die = TRUE; - if(account->registration_cb) /* succeeded, but we have no login info */ - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); + /* succeeded, but we have no login info */ + purple_account_register_completed(account, TRUE); jabber_connection_schedule_close(js); } return; @@ -1422,7 +1418,7 @@ void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type if((node = xmlnode_get_child(query, "name"))) { if(js->registration) field = purple_request_field_string_new("name", _("Name"), - purple_account_get_alias(js->gc->account), FALSE); + purple_account_get_alias(purple_connection_get_account(js->gc)), FALSE); else { char *data = xmlnode_get_data(node); field = purple_request_field_string_new("name", _("Name"), data, FALSE); @@ -1556,17 +1552,17 @@ void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrati PurpleConnection *gc = purple_account_get_connection(account); JabberStream *js; - if(gc->state != PURPLE_CONNECTED) { - if(gc->state != PURPLE_CONNECTING) + if (purple_connection_get_state(gc) != PURPLE_CONNECTED) { + if (purple_connection_get_state(gc) != PURPLE_CONNECTING) jabber_login(account); - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); js->unregistration = TRUE; js->unregistration_cb = cb; js->unregistration_user_data = user_data; return; } - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); if (js->unregistration) { purple_debug_error("jabber", "Unregistration in process; ignoring duplicate request.\n"); @@ -1598,13 +1594,15 @@ void jabber_close(PurpleConnection *gc) jabber_send_raw(js, "", -1); if (js->srv_query_data) - purple_srv_cancel(js->srv_query_data); + purple_srv_txt_query_destroy(js->srv_query_data); if(js->gsc) { purple_ssl_close(js->gsc); } else if (js->fd > 0) { - if(js->gc->inpa) - purple_input_remove(js->gc->inpa); + if(js->inpa) { + purple_input_remove(js->inpa); + js->inpa = 0; + } close(js->fd); } @@ -1726,7 +1724,7 @@ void jabber_close(PurpleConnection *gc) g_free(js); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } void jabber_stream_set_state(JabberStream *js, JabberStreamState state) @@ -1780,7 +1778,7 @@ char *jabber_get_next_id(JabberStream *js) void jabber_idle_set(PurpleConnection *gc, int idle) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); js->idle = idle ? time(NULL) - idle : idle; @@ -1871,8 +1869,7 @@ static void jabber_blocklist_parse(JabberStream *js, const char *from, return; /* This is the only privacy method supported by XEP-0191 */ - if (account->perm_deny != PURPLE_PRIVACY_DENY_USERS) - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_DENY_USERS); /* * TODO: When account->deny is something more than a hash table, this can @@ -2133,7 +2130,7 @@ const char* jabber_list_emblem(PurpleBuddy *b) if(!gc) return NULL; - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); if(js) jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); @@ -2174,8 +2171,8 @@ char *jabber_status_text(PurpleBuddy *b) PurpleAccount *account = purple_buddy_get_account(b); PurpleConnection *gc = purple_account_get_connection(account); - if (gc && gc->proto_data) - jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); + if (gc && purple_connection_get_protocol_data(gc)) + jb = jabber_buddy_find(purple_connection_get_protocol_data(gc), purple_buddy_get_name(b), FALSE); if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) { ret = g_strdup(_("Not Authorized")); @@ -2250,6 +2247,7 @@ void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboole JabberBuddy *jb; PurpleAccount *account; PurpleConnection *gc; + JabberStream *js; g_return_if_fail(b != NULL); @@ -2258,9 +2256,11 @@ void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboole gc = purple_account_get_connection(account); g_return_if_fail(gc != NULL); - g_return_if_fail(gc->proto_data != NULL); - jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); + js = purple_connection_get_protocol_data(gc); + g_return_if_fail(js != NULL); + + jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); if(jb) { JabberBuddyResource *jbr = NULL; @@ -2484,7 +2484,7 @@ jabber_password_change_result_cb(JabberStream *js, const char *from, purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), _("Your password has been changed.")); - purple_account_set_password(js->gc->account, (char *)data); + purple_account_set_password(purple_connection_get_account(js->gc), (char *)data); } else { char *msg = jabber_parse_error(js, packet, NULL); @@ -2531,7 +2531,7 @@ static void jabber_password_change(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field; @@ -2563,7 +2563,7 @@ static void jabber_password_change(PurplePluginAction *action) GList *jabber_actions(PurplePlugin *plugin, gpointer context) { PurpleConnection *gc = (PurpleConnection *) context; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); GList *m = NULL; PurplePluginAction *act; @@ -2634,7 +2634,7 @@ PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name) void jabber_convo_closed(PurpleConnection *gc, const char *who) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); JabberID *jid; JabberBuddy *jb; JabberBuddyResource *jbr; @@ -2739,8 +2739,8 @@ char *jabber_parse_error(JabberStream *js, } else if(xmlnode_get_child(packet, "not-authorized")) { SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); /* Clear the pasword if it isn't being saved */ - if (!purple_account_get_remember_password(js->gc->account)) - purple_account_set_password(js->gc->account, NULL); + if (!purple_account_get_remember_password(purple_connection_get_account(js->gc))) + purple_account_set_password(purple_connection_get_account(js->gc), NULL); text = _("Not Authorized"); } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { text = _("Temporary Authentication Failure"); @@ -2997,7 +2997,7 @@ static PurpleCmdRet jabber_cmd_chat_invite(PurpleConversation *conv, if(!args || !args[0]) return PURPLE_CMD_RET_FAILED; - jabber_chat_invite(purple_conversation_get_gc(conv), + jabber_chat_invite(purple_conversation_get_connection(conv), purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), args[1] ? args[1] : "", args[0]); @@ -3044,7 +3044,7 @@ static PurpleCmdRet jabber_cmd_chat_join(PurpleConversation *conv, if (args[1]) g_hash_table_insert(components, "password", args[1]); - jabber_chat_join(purple_conversation_get_gc(conv), components); + jabber_chat_join(purple_conversation_get_connection(conv), components); g_hash_table_destroy(components); jabber_id_free(jid); @@ -3078,7 +3078,7 @@ static PurpleCmdRet jabber_cmd_chat_msg(PurpleConversation *conv, who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]); - jabber_message_send_im(purple_conversation_get_gc(conv), who, args[1], 0); + jabber_message_send_im(purple_conversation_get_connection(conv), who, args[1], 0); g_free(who); return PURPLE_CMD_RET_OK; @@ -3159,13 +3159,14 @@ static gboolean _jabber_send_buzz(JabberStream *js, const char *username, char * static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - JabberStream *js = conv->account->gc->proto_data; + PurpleAccount *account = purple_conversation_get_account(conv); + JabberStream *js = purple_connection_get_protocol_data(purple_account_get_connection(account)); const gchar *who; gchar *description; PurpleBuddy *buddy; const char *alias; PurpleAttentionType *attn = - purple_get_attention_type_from_code(conv->account, 0); + purple_get_attention_type_from_code(account, 0); if (!args || !args[0]) { /* use the buddy from conversation, if it's a one-to-one conversation */ @@ -3178,7 +3179,7 @@ static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, who = args[0]; } - buddy = purple_find_buddy(conv->account, who); + buddy = purple_find_buddy(account, who); if (buddy != NULL) alias = purple_buddy_get_contact_alias(buddy); else @@ -3206,7 +3207,7 @@ GList *jabber_attention_types(PurpleAccount *account) gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); gchar *error = NULL; if (!_jabber_send_buzz(js, username, &error)) { @@ -3289,8 +3290,8 @@ jabber_initiate_media(PurpleAccount *account, const char *who, PurpleMediaSessionType type) { #ifdef USE_VV - JabberStream *js = (JabberStream *) - purple_account_get_connection(account)->proto_data; + PurpleConnection *gc = purple_account_get_connection(account); + JabberStream *js = purple_connection_get_protocol_data(gc); JabberBuddy *jb; JabberBuddyResource *jbr = NULL; char *resource; @@ -3301,7 +3302,6 @@ jabber_initiate_media(PurpleAccount *account, const char *who, return FALSE; } - if((resource = jabber_get_resource(who)) != NULL) { /* they've specified a resource, no need to ask or * default or anything, just do it */ @@ -3432,8 +3432,8 @@ jabber_initiate_media(PurpleAccount *account, const char *who, PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who) { #ifdef USE_VV - JabberStream *js = (JabberStream *) - purple_account_get_connection(account)->proto_data; + PurpleConnection *gc = purple_account_get_connection(account); + JabberStream *js = purple_connection_get_protocol_data(gc); JabberBuddy *jb; JabberBuddyResource *jbr; PurpleMediaCaps total = PURPLE_MEDIA_CAPS_NONE; @@ -3521,7 +3521,7 @@ PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who) gboolean jabber_can_receive_file(PurpleConnection *gc, const char *who) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); if (js) { JabberBuddy *jb = jabber_buddy_find(js, who, FALSE); @@ -3571,7 +3571,8 @@ static PurpleCmdRet jabber_cmd_mood(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - JabberStream *js = conv->account->gc->proto_data; + PurpleAccount *account = purple_conversation_get_account(conv); + JabberStream *js = purple_connection_get_protocol_data(purple_account_get_connection(account)); if (js->pep) { /* if no argument was given, unset mood */ @@ -3755,7 +3756,7 @@ jabber_ipc_contact_has_feature(PurpleAccount *account, const gchar *jid, if (!purple_account_is_connected(account)) return FALSE; - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); if (!(resource = jabber_get_resource(jid)) || !(jb = jabber_buddy_find(js, jid, FALSE)) || diff --git a/libpurple/protocols/jabber/jabber.h b/libpurple/protocols/jabber/jabber.h index 543d0af2d8..00bc0a3675 100644 --- a/libpurple/protocols/jabber/jabber.h +++ b/libpurple/protocols/jabber/jabber.h @@ -99,6 +99,7 @@ typedef enum { struct _JabberStream { int fd; + guint inpa; PurpleSrvTxtQueryData *srv_query_data; diff --git a/libpurple/protocols/jabber/jingle/content.c b/libpurple/protocols/jabber/jingle/content.c index d264199d29..f19d186cb4 100644 --- a/libpurple/protocols/jabber/jingle/content.c +++ b/libpurple/protocols/jabber/jingle/content.c @@ -181,6 +181,8 @@ static void jingle_content_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { JingleContent *content; + + g_return_if_fail(object != NULL); g_return_if_fail(JINGLE_IS_CONTENT(object)); content = JINGLE_CONTENT(object); @@ -225,6 +227,8 @@ static void jingle_content_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { JingleContent *content; + + g_return_if_fail(object != NULL); g_return_if_fail(JINGLE_IS_CONTENT(object)); content = JINGLE_CONTENT(object); @@ -454,6 +458,7 @@ jingle_content_to_xml_internal(JingleContent *content, xmlnode *jingle, JingleAc xmlnode * jingle_content_to_xml(JingleContent *content, xmlnode *jingle, JingleActionType action) { + g_return_val_if_fail(content != NULL, NULL); g_return_val_if_fail(JINGLE_IS_CONTENT(content), NULL); return JINGLE_CONTENT_GET_CLASS(content)->to_xml(content, jingle, action); } @@ -461,6 +466,7 @@ jingle_content_to_xml(JingleContent *content, xmlnode *jingle, JingleActionType void jingle_content_handle_action(JingleContent *content, xmlnode *xmlcontent, JingleActionType action) { + g_return_if_fail(content != NULL); g_return_if_fail(JINGLE_IS_CONTENT(content)); JINGLE_CONTENT_GET_CLASS(content)->handle_action(content, xmlcontent, action); } diff --git a/libpurple/protocols/jabber/jingle/iceudp.c b/libpurple/protocols/jabber/jingle/iceudp.c index 43a42f818b..54c0d91d03 100644 --- a/libpurple/protocols/jabber/jingle/iceudp.c +++ b/libpurple/protocols/jabber/jingle/iceudp.c @@ -202,6 +202,8 @@ static void jingle_iceudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { JingleIceUdp *iceudp; + + g_return_if_fail(object != NULL); g_return_if_fail(JINGLE_IS_ICEUDP(object)); iceudp = JINGLE_ICEUDP(object); @@ -225,6 +227,8 @@ static void jingle_iceudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { JingleIceUdp *iceudp; + + g_return_if_fail(object != NULL); g_return_if_fail(JINGLE_IS_ICEUDP(object)); iceudp = JINGLE_ICEUDP(object); diff --git a/libpurple/protocols/jabber/jingle/jingle.c b/libpurple/protocols/jabber/jingle/jingle.c index 4cf9a044a6..798536d966 100644 --- a/libpurple/protocols/jabber/jingle/jingle.c +++ b/libpurple/protocols/jabber/jingle/jingle.c @@ -126,7 +126,7 @@ jingle_handle_content_modify(JingleSession *session, xmlnode *jingle) if (local_content != NULL) { const gchar *senders = xmlnode_get_attrib(content, "senders"); gchar *local_senders = jingle_content_get_senders(local_content); - if (strcmp(senders, local_senders)) + if (!purple_strequal(senders, local_senders)) jingle_content_modify(local_content, senders); g_free(local_senders); } else { diff --git a/libpurple/protocols/jabber/jingle/rawudp.c b/libpurple/protocols/jabber/jingle/rawudp.c index 7561f86eca..b50e5a79a4 100644 --- a/libpurple/protocols/jabber/jingle/rawudp.c +++ b/libpurple/protocols/jabber/jingle/rawudp.c @@ -174,6 +174,8 @@ static void jingle_rawudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { JingleRawUdp *rawudp; + + g_return_if_fail(object != NULL); g_return_if_fail(JINGLE_IS_RAWUDP(object)); rawudp = JINGLE_RAWUDP(object); @@ -197,6 +199,8 @@ static void jingle_rawudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { JingleRawUdp *rawudp; + + g_return_if_fail(object != NULL); g_return_if_fail(JINGLE_IS_RAWUDP(object)); rawudp = JINGLE_RAWUDP(object); diff --git a/libpurple/protocols/jabber/jingle/rtp.c b/libpurple/protocols/jabber/jingle/rtp.c index c09a100b78..3b34c164d3 100644 --- a/libpurple/protocols/jabber/jingle/rtp.c +++ b/libpurple/protocols/jabber/jingle/rtp.c @@ -577,11 +577,12 @@ jingle_rtp_init_media(JingleContent *content) guint num_params; /* maybe this create ought to just be in initiate and handle initiate */ - if (media == NULL) + if (media == NULL) { media = jingle_rtp_create_media(content); - if (media == NULL) - return FALSE; + if (media == NULL) + return FALSE; + } name = jingle_content_get_name(content); media_type = jingle_rtp_get_media_type(content); @@ -589,6 +590,16 @@ jingle_rtp_init_media(JingleContent *content) senders = jingle_content_get_senders(content); transport = jingle_content_get_transport(content); + if (media_type == NULL) { + g_free(name); + g_free(remote_jid); + g_free(senders); + g_free(params); + g_object_unref(transport); + g_object_unref(session); + return FALSE; + } + if (JINGLE_IS_RAWUDP(transport)) transmitter = "rawudp"; else if (JINGLE_IS_ICEUDP(transport)) @@ -597,17 +608,17 @@ jingle_rtp_init_media(JingleContent *content) transmitter = "notransmitter"; g_object_unref(transport); - is_audio = !strcmp(media_type, "audio"); + is_audio = g_str_equal(media_type, "audio"); - if (!strcmp(senders, "both")) - type = is_audio == TRUE ? PURPLE_MEDIA_AUDIO + if (purple_strequal(senders, "both")) + type = is_audio ? PURPLE_MEDIA_AUDIO : PURPLE_MEDIA_VIDEO; - else if ((strcmp(senders, "initiator") == 0) == + else if (purple_strequal(senders, "initiator") == jingle_session_is_initiator(session)) - type = is_audio == TRUE ? PURPLE_MEDIA_SEND_AUDIO + type = is_audio ? PURPLE_MEDIA_SEND_AUDIO : PURPLE_MEDIA_SEND_VIDEO; else - type = is_audio == TRUE ? PURPLE_MEDIA_RECV_AUDIO + type = is_audio ? PURPLE_MEDIA_RECV_AUDIO : PURPLE_MEDIA_RECV_VIDEO; params = @@ -615,7 +626,17 @@ jingle_rtp_init_media(JingleContent *content) NULL, NULL, &num_params); creator = jingle_content_get_creator(content); - if (!strcmp(creator, "initiator")) + if (creator == NULL) { + g_free(name); + g_free(media_type); + g_free(remote_jid); + g_free(senders); + g_free(params); + g_object_unref(session); + return FALSE; + } + + if (g_str_equal(creator, "initiator")) is_creator = jingle_session_is_initiator(session); else is_creator = !jingle_session_is_initiator(session); @@ -624,6 +645,8 @@ jingle_rtp_init_media(JingleContent *content) if(!purple_media_add_stream(media, name, remote_jid, type, is_creator, transmitter, num_params, params)) { purple_media_end(media, NULL, NULL); + /* TODO: How much clean-up is necessary here? (does calling + purple_media_end lead to cleaning up Jingle structs?) */ return FALSE; } @@ -645,9 +668,22 @@ jingle_rtp_parse_codecs(xmlnode *description) const char *encoding_name,*id, *clock_rate; PurpleMediaCodec *codec; const gchar *media = xmlnode_get_attrib(description, "media"); - PurpleMediaSessionType type = - !strcmp(media, "video") ? PURPLE_MEDIA_VIDEO : - !strcmp(media, "audio") ? PURPLE_MEDIA_AUDIO : 0; + PurpleMediaSessionType type; + + if (media == NULL) { + purple_debug_warning("jingle-rtp", "missing media type\n"); + return NULL; + } + + if (g_str_equal(media, "video")) { + type = PURPLE_MEDIA_VIDEO; + } else if (g_str_equal(media, "audio")) { + type = PURPLE_MEDIA_AUDIO; + } else { + purple_debug_warning("jingle-rtp", "unknown media type: %s\n", + media); + return NULL; + } for (codec_element = xmlnode_get_child(description, "payload-type") ; codec_element ; @@ -768,19 +804,19 @@ jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, J switch (action) { case JINGLE_SESSION_ACCEPT: case JINGLE_SESSION_INITIATE: { - JingleSession *session = jingle_content_get_session(content); - JingleTransport *transport = jingle_transport_parse( - xmlnode_get_child(xmlcontent, "transport")); - xmlnode *description = xmlnode_get_child(xmlcontent, "description"); - GList *candidates = jingle_rtp_transport_to_candidates(transport); - GList *codecs = jingle_rtp_parse_codecs(description); - gchar *name = jingle_content_get_name(content); - gchar *remote_jid = - jingle_session_get_remote_jid(session); + JingleSession *session; + JingleTransport *transport; + xmlnode *description; + GList *candidates; + GList *codecs; + gchar *name; + gchar *remote_jid; PurpleMedia *media; + session = jingle_content_get_session(content); + if (action == JINGLE_SESSION_INITIATE && - jingle_rtp_init_media(content) == FALSE) { + !jingle_rtp_init_media(content)) { /* XXX: send error */ jabber_iq_send(jingle_session_terminate_packet( session, "general-error")); @@ -788,6 +824,14 @@ jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, J break; } + transport = jingle_transport_parse( + xmlnode_get_child(xmlcontent, "transport")); + description = xmlnode_get_child(xmlcontent, "description"); + candidates = jingle_rtp_transport_to_candidates(transport); + codecs = jingle_rtp_parse_codecs(description); + name = jingle_content_get_name(content); + remote_jid = jingle_session_get_remote_jid(session); + media = jingle_rtp_get_media(session); purple_media_set_remote_codecs(media, name, remote_jid, codecs); diff --git a/libpurple/protocols/jabber/jingle/session.c b/libpurple/protocols/jabber/jingle/session.c index 398f6e8680..5d612aa476 100644 --- a/libpurple/protocols/jabber/jingle/session.c +++ b/libpurple/protocols/jabber/jingle/session.c @@ -189,6 +189,8 @@ static void jingle_session_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { JingleSession *session; + + g_return_if_fail(object != NULL); g_return_if_fail(JINGLE_IS_SESSION(object)); session = JINGLE_SESSION(object); @@ -231,6 +233,8 @@ static void jingle_session_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { JingleSession *session; + + g_return_if_fail(object != NULL); g_return_if_fail(JINGLE_IS_SESSION(object)); session = JINGLE_SESSION(object); @@ -284,7 +288,7 @@ jingle_session_create(JabberStream *js, const gchar *sid, if (!js->sessions) { purple_debug_info("jingle", "Creating hash table for sessions\n"); - js->sessions = g_hash_table_new(g_str_hash, g_str_equal); + js->sessions = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); } purple_debug_info("jingle", "inserting session with key: %s into table\n", sid); @@ -407,26 +411,24 @@ jingle_add_jingle_packet(JingleSession *session, xmlnode_new("jingle"); gchar *local_jid = jingle_session_get_local_jid(session); gchar *remote_jid = jingle_session_get_remote_jid(session); + gchar *sid = jingle_session_get_sid(session); xmlnode_set_namespace(jingle, JINGLE); xmlnode_set_attrib(jingle, "action", jingle_get_action_name(action)); if (jingle_session_is_initiator(session)) { - xmlnode_set_attrib(jingle, "initiator", - jingle_session_get_local_jid(session)); - xmlnode_set_attrib(jingle, "responder", - jingle_session_get_remote_jid(session)); + xmlnode_set_attrib(jingle, "initiator", local_jid); + xmlnode_set_attrib(jingle, "responder", remote_jid); } else { - xmlnode_set_attrib(jingle, "initiator", - jingle_session_get_remote_jid(session)); - xmlnode_set_attrib(jingle, "responder", - jingle_session_get_local_jid(session)); + xmlnode_set_attrib(jingle, "initiator", remote_jid); + xmlnode_set_attrib(jingle, "responder", local_jid); } + xmlnode_set_attrib(jingle, "sid", sid); + g_free(local_jid); g_free(remote_jid); - - xmlnode_set_attrib(jingle, "sid", jingle_session_get_sid(session)); + g_free(sid); return jingle; } @@ -504,11 +506,16 @@ void jingle_session_handle_action(JingleSession *session, xmlnode *jingle, Jingl JingleContent * jingle_session_find_content(JingleSession *session, const gchar *name, const gchar *creator) { - GList *iter = session->priv->contents; + GList *iter; + + if (name == NULL) + return NULL; + + iter = session->priv->contents; for (; iter; iter = g_list_next(iter)) { JingleContent *content = iter->data; gchar *cname = jingle_content_get_name(content); - gboolean result = !strcmp(name, cname); + gboolean result = g_str_equal(name, cname); g_free(cname); if (creator != NULL) { @@ -526,11 +533,16 @@ jingle_session_find_content(JingleSession *session, const gchar *name, const gch JingleContent * jingle_session_find_pending_content(JingleSession *session, const gchar *name, const gchar *creator) { - GList *iter = session->priv->pending_contents; + GList *iter; + + if (name == NULL) + return NULL; + + iter = session->priv->pending_contents; for (; iter; iter = g_list_next(iter)) { JingleContent *content = iter->data; gchar *cname = jingle_content_get_name(content); - gboolean result = !strcmp(name, cname); + gboolean result = g_str_equal(name, cname); g_free(cname); if (creator != NULL) { diff --git a/libpurple/protocols/jabber/jingle/transport.c b/libpurple/protocols/jabber/jingle/transport.c index e667a72d57..7ca867085c 100644 --- a/libpurple/protocols/jabber/jingle/transport.c +++ b/libpurple/protocols/jabber/jingle/transport.c @@ -108,6 +108,7 @@ jingle_transport_finalize (GObject *transport) static void jingle_transport_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { + g_return_if_fail(object != NULL); g_return_if_fail(JINGLE_IS_TRANSPORT(object)); switch (prop_id) { @@ -120,6 +121,7 @@ jingle_transport_set_property (GObject *object, guint prop_id, const GValue *val static void jingle_transport_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { + g_return_if_fail(object != NULL); g_return_if_fail(JINGLE_IS_TRANSPORT(object)); switch (prop_id) { @@ -170,6 +172,7 @@ jingle_transport_parse(xmlnode *transport) xmlnode * jingle_transport_to_xml(JingleTransport *transport, xmlnode *content, JingleActionType action) { + g_return_val_if_fail(transport != NULL, NULL); g_return_val_if_fail(JINGLE_IS_TRANSPORT(transport), NULL); return JINGLE_TRANSPORT_GET_CLASS(transport)->to_xml(transport, content, action); } diff --git a/libpurple/protocols/jabber/jutil.c b/libpurple/protocols/jabber/jutil.c index 38246dd5e7..0156eb5d56 100644 --- a/libpurple/protocols/jabber/jutil.c +++ b/libpurple/protocols/jabber/jutil.c @@ -583,11 +583,16 @@ jabber_id_new(const char *str) const char *jabber_normalize(const PurpleAccount *account, const char *in) { - PurpleConnection *gc = account ? account->gc : NULL; - JabberStream *js = gc ? gc->proto_data : NULL; + PurpleConnection *gc = NULL; + JabberStream *js = NULL; static char buf[3072]; /* maximum legal length of a jabber jid */ JabberID *jid; + if (account) + gc = purple_account_get_connection(account); + if (gc) + js = purple_connection_get_protocol_data(gc); + jid = jabber_id_new_internal(in, TRUE); if(!jid) return NULL; diff --git a/libpurple/protocols/jabber/libxmpp.c b/libpurple/protocols/jabber/libxmpp.c index f34052b6e4..53b7b9bd75 100644 --- a/libpurple/protocols/jabber/libxmpp.c +++ b/libpurple/protocols/jabber/libxmpp.c @@ -53,6 +53,7 @@ static PurplePlugin *my_protocol = NULL; static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_MAIL_CHECK | #ifdef HAVE_CYRUS_SASL OPT_PROTO_PASSWORD_OPTIONAL | @@ -97,7 +98,6 @@ static PurplePluginProtocolInfo prpl_info = jabber_keepalive, /* keepalive */ jabber_register_account, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ jabber_roster_alias_change, /* alias_buddy */ jabber_roster_group_change, /* group_buddy */ jabber_roster_group_rename, /* rename_group */ @@ -122,16 +122,12 @@ static PurplePluginProtocolInfo prpl_info = jabber_unregister_account, /* unregister_user */ jabber_send_attention, /* send_attention */ jabber_attention_types, /* attention_types */ - - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ jabber_initiate_media, /* initiate_media */ jabber_get_media_caps, /* get_media_caps */ jabber_get_moods, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static gboolean load_plugin(PurplePlugin *plugin) diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c index 609be702f5..95edd960fc 100644 --- a/libpurple/protocols/jabber/message.c +++ b/libpurple/protocols/jabber/message.c @@ -638,6 +638,8 @@ void jabber_message_parse(JabberStream *js, xmlnode *packet) jabber_message_add_remote_smileys(js, to, packet); } + xmlnode_strip_prefixes(child); + /* reformat xhtml so that img tags with a "cid:" src gets translated to the bare text of the emoticon (the "alt" attrib) */ /* this is done also when custom smiley retrieval is turned off, @@ -1148,13 +1150,13 @@ int jabber_message_send_im(PurpleConnection *gc, const char *who, const char *ms resource = jabber_get_resource(who); - jb = jabber_buddy_find(gc->proto_data, who, TRUE); + jb = jabber_buddy_find(purple_connection_get_protocol_data(gc), who, TRUE); jbr = jabber_buddy_find_resource(jb, resource); g_free(resource); jm = g_new0(JabberMessage, 1); - jm->js = gc->proto_data; + jm->js = purple_connection_get_protocol_data(gc); jm->type = JABBER_MESSAGE_CHAT; jm->chat_state = JM_STATE_ACTIVE; jm->to = g_strdup(who); @@ -1211,14 +1213,14 @@ int jabber_message_send_chat(PurpleConnection *gc, int id, const char *msg, Purp if(!msg || !gc) return 0; - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); chat = jabber_chat_find_by_id(js, id); if(!chat) return 0; jm = g_new0(JabberMessage, 1); - jm->js = gc->proto_data; + jm->js = purple_connection_get_protocol_data(gc); jm->type = JABBER_MESSAGE_GROUPCHAT; jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); jm->id = jabber_get_next_id(jm->js); diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c index 430d17ac7e..e32a59fcc9 100644 --- a/libpurple/protocols/jabber/oob.c +++ b/libpurple/protocols/jabber/oob.c @@ -48,13 +48,13 @@ typedef struct _JabberOOBXfer { static void jabber_oob_xfer_init(PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); purple_xfer_start(xfer, -1, jox->address, jox->port); } static void jabber_oob_xfer_free(PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); jox->js->oob_file_transfers = g_list_remove(jox->js->oob_file_transfers, xfer); @@ -67,16 +67,16 @@ static void jabber_oob_xfer_free(PurpleXfer *xfer) purple_input_remove(jox->writeh); g_free(jox); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } static void jabber_oob_xfer_end(PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); JabberIq *iq; iq = jabber_iq_new(jox->js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jox->iq_id); jabber_iq_send(iq); @@ -86,10 +86,10 @@ static void jabber_oob_xfer_end(PurpleXfer *xfer) static void jabber_oob_xfer_request_send(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); int len, total_len = strlen(jox->write_buffer); - len = write(xfer->fd, jox->write_buffer + jox->written_len, + len = purple_xfer_write(xfer, (guchar*) jox->write_buffer + jox->written_len, total_len - jox->written_len); if(len < 0 && errno == EAGAIN) @@ -110,7 +110,7 @@ static void jabber_oob_xfer_request_send(gpointer data, gint source, PurpleInput static void jabber_oob_xfer_start(PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); if(jox->write_buffer == NULL) { jox->write_buffer = g_strdup_printf( @@ -119,26 +119,26 @@ static void jabber_oob_xfer_start(PurpleXfer *xfer) jox->written_len = 0; } - jox->writeh = purple_input_add(xfer->fd, PURPLE_INPUT_WRITE, + jox->writeh = purple_input_add(purple_xfer_get_fd(xfer), PURPLE_INPUT_WRITE, jabber_oob_xfer_request_send, xfer); - jabber_oob_xfer_request_send(xfer, xfer->fd, PURPLE_INPUT_WRITE); + jabber_oob_xfer_request_send(xfer, purple_xfer_get_fd(xfer), PURPLE_INPUT_WRITE); } static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); char test[2048]; char *tmp, *lenstr; int len; - if((len = read(xfer->fd, test, sizeof(test))) > 0) { + if((len = read(purple_xfer_get_fd(xfer), test, sizeof(test))) > 0) { jox->headers = g_string_append_len(jox->headers, test, len); if((tmp = strstr(jox->headers->str, "\r\n\r\n"))) { *tmp = '\0'; lenstr = strstr(jox->headers->str, "Content-Length: "); if(lenstr) { - int size; - sscanf(lenstr, "Content-Length: %d", &size); + goffset size; + sscanf(lenstr, "Content-Length: %" G_GOFFSET_FORMAT, &size); purple_xfer_set_size(xfer, size); } purple_xfer_set_read_fnc(xfer, NULL); @@ -158,12 +158,12 @@ static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) { } static void jabber_oob_xfer_recv_error(PurpleXfer *xfer, const char *code) { - JabberOOBXfer *jox = xfer->data; + JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer); JabberIq *iq; xmlnode *y, *z; iq = jabber_iq_new(jox->js, JABBER_IQ_ERROR); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jox->iq_id); y = xmlnode_new_child(iq->node, "error"); xmlnode_set_attrib(y, "code", code); @@ -218,10 +218,10 @@ void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type, jox->headers = g_string_new(""); jox->iq_id = g_strdup(id); - xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); + xfer = purple_xfer_new(purple_connection_get_account(js->gc), PURPLE_XFER_RECEIVE, from); if (xfer) { - xfer->data = jox; + purple_xfer_set_protocol_data(xfer, jox); if(!(filename = g_strdup(g_strrstr(jox->page, "/")))) filename = g_strdup(jox->page); diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c index 7e0a11b93b..a95bf4bb3f 100644 --- a/libpurple/protocols/jabber/presence.c +++ b/libpurple/protocols/jabber/presence.c @@ -299,11 +299,6 @@ void jabber_presence_send(JabberStream *js, gboolean force) jabber_presence_fake_to_self(js, status); } -xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority) -{ - return jabber_presence_create_js(NULL, state, msg, priority); -} - xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority) { xmlnode *show, *status, *presence, *pri, *c; @@ -393,7 +388,7 @@ static void authorize_add_cb(gpointer data) { struct _jabber_add_permit *jap = data; if(PURPLE_CONNECTION_IS_VALID(jap->gc)) - jabber_presence_subscription_set(jap->gc->proto_data, + jabber_presence_subscription_set(purple_connection_get_protocol_data(jap->gc), jap->who, "subscribed"); g_free(jap->who); g_free(jap); @@ -403,7 +398,7 @@ static void deny_add_cb(gpointer data) { struct _jabber_add_permit *jap = data; if(PURPLE_CONNECTION_IS_VALID(jap->gc)) - jabber_presence_subscription_set(jap->gc->proto_data, + jabber_presence_subscription_set(purple_connection_get_protocol_data(jap->gc), jap->who, "unsubscribed"); g_free(jap->who); g_free(jap); @@ -464,7 +459,7 @@ jabber_vcard_parse_avatar(JabberStream *js, const char *from, hash = jabber_calculate_data_hash(data, size, "sha1"); } - purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash); + purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, data, size, hash); g_free(hash); } diff --git a/libpurple/protocols/jabber/presence.h b/libpurple/protocols/jabber/presence.h index e83309278a..98322fd9ae 100644 --- a/libpurple/protocols/jabber/presence.h +++ b/libpurple/protocols/jabber/presence.h @@ -92,7 +92,6 @@ void jabber_set_status(PurpleAccount *account, PurpleStatus *status); */ void jabber_presence_send(JabberStream *js, gboolean force); -xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority); /* DEPRECATED */ xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority); void jabber_presence_parse(JabberStream *js, xmlnode *packet); void jabber_presence_subscription_set(JabberStream *js, const char *who, diff --git a/libpurple/protocols/jabber/roster.c b/libpurple/protocols/jabber/roster.c index 9683dbcbb6..1dd565be35 100644 --- a/libpurple/protocols/jabber/roster.c +++ b/libpurple/protocols/jabber/roster.c @@ -96,7 +96,7 @@ static void remove_purple_buddies(JabberStream *js, const char *jid) { GSList *buddies, *l; - buddies = purple_find_buddies(js->gc->account, jid); + buddies = purple_find_buddies(purple_connection_get_account(js->gc), jid); for(l = buddies; l; l = l->next) purple_blist_remove_buddy(l->data); @@ -110,7 +110,7 @@ static void add_purple_buddy_to_groups(JabberStream *js, const char *jid, GSList *buddies, *l; PurpleAccount *account = purple_connection_get_account(js->gc); - buddies = purple_find_buddies(js->gc->account, jid); + buddies = purple_find_buddies(purple_connection_get_account(js->gc), jid); if(!groups) { if(!buddies) @@ -304,7 +304,7 @@ static void jabber_roster_update(JabberStream *js, const char *name, if (js->currently_parsing_roster_push) return; - if(!(b = purple_find_buddy(js->gc->account, name))) + if(!(b = purple_find_buddy(purple_connection_get_account(js->gc), name))) return; if (groups) { @@ -314,7 +314,7 @@ static void jabber_roster_update(JabberStream *js, const char *name, "groups]: groups: %s\n", name, tmp); g_free(tmp); } else { - GSList *buddies = purple_find_buddies(js->gc->account, name); + GSList *buddies = purple_find_buddies(purple_connection_get_account(js->gc), name); char *tmp; if(!buddies) @@ -358,9 +358,9 @@ static void jabber_roster_update(JabberStream *js, const char *name, } void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) + PurpleGroup *group, const char *message) { - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); char *who; JabberID *jid; JabberBuddy *jb; @@ -413,7 +413,7 @@ void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, } else if(!jb || !(jb->subscription & JABBER_SUB_TO)) { jabber_presence_subscription_set(js, who, "subscribe"); } else if((jbr =jabber_buddy_find_resource(jb, NULL))) { - purple_prpl_got_user_status(gc->account, who, + purple_prpl_got_user_status(purple_connection_get_account(gc), who, jabber_buddy_state_get_status_id(jbr->state), "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL); } @@ -423,7 +423,7 @@ void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, void jabber_roster_alias_change(PurpleConnection *gc, const char *name, const char *alias) { - PurpleBuddy *b = purple_find_buddy(gc->account, name); + PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), name); if(b != NULL) { purple_blist_alias_buddy(b, alias); @@ -431,7 +431,7 @@ void jabber_roster_alias_change(PurpleConnection *gc, const char *name, const ch purple_debug_info("jabber", "jabber_roster_alias_change(): Aliased %s to %s\n", name, alias ? alias : "(null)"); - jabber_roster_update(gc->proto_data, name, NULL); + jabber_roster_update(purple_connection_get_protocol_data(gc), name, NULL); } } @@ -446,7 +446,7 @@ void jabber_roster_group_change(PurpleConnection *gc, const char *name, if(!old_group || !new_group || !strcmp(old_group, new_group)) return; - buddies = purple_find_buddies(gc->account, name); + buddies = purple_find_buddies(purple_connection_get_account(gc), name); while(buddies) { b = buddies->data; g = purple_buddy_get_group(b); @@ -461,7 +461,7 @@ void jabber_roster_group_change(PurpleConnection *gc, const char *name, purple_debug_info("jabber", "jabber_roster_group_change(): Moving %s from %s to %s\n", name, old_group, new_group); - jabber_roster_update(gc->proto_data, name, groups); + jabber_roster_update(purple_connection_get_protocol_data(gc), name, groups); } void jabber_roster_group_rename(PurpleConnection *gc, const char *old_name, @@ -496,9 +496,9 @@ void jabber_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, purple_debug_info("jabber", "jabber_roster_remove_buddy(): Removing %s from %s\n", purple_buddy_get_name(buddy), purple_group_get_name(group)); - jabber_roster_update(gc->proto_data, name, groups); + jabber_roster_update(purple_connection_get_protocol_data(gc), name, groups); } else { - JabberIq *iq = jabber_iq_new_query(gc->proto_data, JABBER_IQ_SET, + JabberIq *iq = jabber_iq_new_query(purple_connection_get_protocol_data(gc), JABBER_IQ_SET, "jabber:iq:roster"); xmlnode *query = xmlnode_get_child(iq->node, "query"); xmlnode *item = xmlnode_new_child(query, "item"); diff --git a/libpurple/protocols/jabber/roster.h b/libpurple/protocols/jabber/roster.h index 4bc4384e03..367fd05d7f 100644 --- a/libpurple/protocols/jabber/roster.h +++ b/libpurple/protocols/jabber/roster.h @@ -32,7 +32,7 @@ void jabber_roster_parse(JabberStream *js, const char *from, JabberIqType type, const char *id, xmlnode *query); void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group); + PurpleGroup *group, const char *message); void jabber_roster_alias_change(PurpleConnection *gc, const char *name, const char *alias); void jabber_roster_group_change(PurpleConnection *gc, const char *name, diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c index 034b2d30fb..c97988042b 100644 --- a/libpurple/protocols/jabber/si.c +++ b/libpurple/protocols/jabber/si.c @@ -87,9 +87,9 @@ jabber_si_xfer_find(JabberStream *js, const char *sid, const char *from) for(xfers = js->file_transfers; xfers; xfers = xfers->next) { PurpleXfer *xfer = xfers->data; - JabberSIXfer *jsx = xfer->data; - if(jsx->stream_id && xfer->who && - !strcmp(jsx->stream_id, sid) && !strcmp(xfer->who, from)) + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); + if(jsx->stream_id && purple_xfer_get_remote_user(xfer) && + !strcmp(jsx->stream_id, sid) && !strcmp(purple_xfer_get_remote_user(xfer), from)) return xfer; } @@ -118,7 +118,7 @@ static void jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIq *iq; xmlnode *query, *su; JabberBytestreamsStreamhost *streamhost = jsx->streamhosts->data; @@ -143,7 +143,7 @@ jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_ } /* unknown file transfer type is assumed to be RECEIVE */ - if(xfer->type == PURPLE_XFER_SEND) + if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { xmlnode *activate; iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS); @@ -151,14 +151,14 @@ jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_ query = xmlnode_get_child(iq->node, "query"); xmlnode_set_attrib(query, "sid", jsx->stream_id); activate = xmlnode_new_child(query, "activate"); - xmlnode_insert_data(activate, xfer->who, -1); + xmlnode_insert_data(activate, purple_xfer_get_remote_user(xfer), -1); /* TODO: We need to wait for an activation result before starting */ } else { iq = jabber_iq_new_query(jsx->js, JABBER_IQ_RESULT, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jsx->iq_id); query = xmlnode_get_child(iq->node, "query"); su = xmlnode_new_child(query, "streamhost-used"); @@ -174,7 +174,7 @@ static gboolean connect_timeout_cb(gpointer data) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); purple_debug_info("jabber", "Streamhost connection timeout of %d seconds exceeded.\n", STREAMHOST_CONNECT_TIMEOUT); @@ -203,7 +203,7 @@ static gboolean jabber_si_bytestreams_ibb_timeout_cb(gpointer data) { PurpleXfer *xfer = (PurpleXfer *) data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if (jsx && !jsx->ibb_session) { purple_debug_info("jabber", @@ -218,7 +218,7 @@ jabber_si_bytestreams_ibb_timeout_cb(gpointer data) static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberBytestreamsStreamhost *streamhost; JabberID *dstjid; @@ -229,7 +229,7 @@ static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) if(jsx->iq_id) jabber_iq_set_id(iq, jsx->iq_id); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); error = xmlnode_new_child(iq->node, "error"); xmlnode_set_attrib(error, "code", "404"); xmlnode_set_attrib(error, "type", "cancel"); @@ -271,7 +271,7 @@ static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) purple_proxy_info_destroy(jsx->gpi); jsx->gpi = NULL; - dstjid = jabber_id_new(xfer->who); + dstjid = jabber_id_new(purple_xfer_get_remote_user(xfer)); /* TODO: Deal with zeroconf */ @@ -284,7 +284,7 @@ static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) purple_proxy_info_set_port(jsx->gpi, streamhost->port); /* unknown file transfer type is assumed to be RECEIVE */ - if(xfer->type == PURPLE_XFER_SEND) + if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", jsx->stream_id, jsx->js->user->node, jsx->js->user->domain, jsx->js->user->resource, dstjid->node, dstjid->domain, dstjid->resource); else @@ -302,7 +302,7 @@ static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) g_free(dstaddr); /* When selecting a streamhost, timeout after STREAMHOST_CONNECT_TIMEOUT seconds, otherwise it takes forever */ - if (xfer->type != PURPLE_XFER_SEND && jsx->connect_data != NULL) + if (purple_xfer_get_type(xfer) != PURPLE_XFER_SEND && jsx->connect_data != NULL) jsx->connect_timeout = purple_timeout_add_seconds( STREAMHOST_CONNECT_TIMEOUT, connect_timeout_cb, xfer); @@ -337,7 +337,7 @@ void jabber_bytestreams_parse(JabberStream *js, const char *from, if(!(xfer = jabber_si_xfer_find(js, sid, from))) return; - jsx = xfer->data; + jsx = purple_xfer_get_protocol_data(xfer); if(!jsx->accepted) return; @@ -375,15 +375,13 @@ jabber_si_xfer_bytestreams_send_read_again_resp_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); int len; len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen); if (len < 0 && errno == EAGAIN) return; else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; g_free(jsx->rxqueue); jsx->rxqueue = NULL; close(source); @@ -395,8 +393,8 @@ jabber_si_xfer_bytestreams_send_read_again_resp_cb(gpointer data, gint source, if (jsx->rxlen < jsx->rxmaxlen) return; - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); g_free(jsx->rxqueue); jsx->rxqueue = NULL; @@ -412,7 +410,7 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); char buffer[42]; /* 40 for DST.ADDR + 2 bytes for port number*/ int len; char *dstaddr, *hash; @@ -426,8 +424,6 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, if(len < 0 && errno == EAGAIN) return; else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; @@ -441,8 +437,6 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, purple_debug_info("jabber", "Invalid socks5 conn req. header[0x%x,0x%x,0x%x,0x%x,0x%x]\n", jsx->rxqueue[0], jsx->rxqueue[1], jsx->rxqueue[2], jsx->rxqueue[3], jsx->rxqueue[4]); - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; @@ -455,8 +449,6 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, if(len < 0 && errno == EAGAIN) return; else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; close(source); purple_xfer_cancel_remote(xfer); return; @@ -470,12 +462,12 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) return; - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); dstaddr = g_strdup_printf("%s%s@%s/%s%s", jsx->stream_id, jsx->js->user->node, jsx->js->user->domain, - jsx->js->user->resource, xfer->who); + jsx->js->user->resource, purple_xfer_get_remote_user(xfer)); /* Per XEP-0065, the 'host' must be SHA1(SID + from JID + to JID) */ hash = jabber_calculate_data_hash(dstaddr, strlen(dstaddr), "sha1"); @@ -516,8 +508,8 @@ jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, jsx->rxqueue[5+strlen(host)] = 0x00; jsx->rxqueue[6+strlen(host)] = 0x00; - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - jabber_si_xfer_bytestreams_send_read_again_resp_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, + jabber_si_xfer_bytestreams_send_read_again_resp_cb, xfer)); jabber_si_xfer_bytestreams_send_read_again_resp_cb(xfer, source, PURPLE_INPUT_WRITE); } @@ -527,15 +519,13 @@ jabber_si_xfer_bytestreams_send_read_response_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); int len; len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen); if (len < 0 && errno == EAGAIN) return; else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; g_free(jsx->rxqueue); jsx->rxqueue = NULL; close(source); @@ -547,13 +537,11 @@ jabber_si_xfer_bytestreams_send_read_response_cb(gpointer data, gint source, if (jsx->rxlen < jsx->rxmaxlen) return; - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - /* If we sent a "Success", wait for a response, otherwise give up and cancel */ if (jsx->rxqueue[1] == 0x00) { - xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_read_again_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_READ, + jabber_si_xfer_bytestreams_send_read_again_cb, xfer)); g_free(jsx->rxqueue); jsx->rxqueue = NULL; jsx->rxlen = 0; @@ -568,14 +556,14 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); int i; int len; char buffer[256]; purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_read_cb\n"); - xfer->fd = source; + purple_xfer_set_fd(xfer, source); /** Try to read the SOCKS5 header */ if(jsx->rxlen < 2) { @@ -584,9 +572,6 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, if(len < 0 && errno == EAGAIN) return; else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); purple_xfer_cancel_remote(xfer); return; } @@ -603,9 +588,6 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, if(len < 0 && errno == EAGAIN) return; else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); purple_xfer_cancel_remote(xfer); return; } @@ -618,13 +600,9 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, if(jsx->rxlen -2 < jsx->rxqueue[1]) return; - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - purple_debug_info("jabber", "checking to make sure we're socks FIVE\n"); if(jsx->rxqueue[0] != 0x05) { - close(source); purple_xfer_cancel_remote(xfer); return; } @@ -641,9 +619,10 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, jsx->rxqueue = g_malloc(jsx->rxmaxlen); jsx->rxqueue[0] = 0x05; jsx->rxqueue[1] = 0x00; - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, jabber_si_xfer_bytestreams_send_read_response_cb, - xfer); + xfer)); jabber_si_xfer_bytestreams_send_read_response_cb(xfer, source, PURPLE_INPUT_WRITE); jsx->rxqueue = NULL; @@ -658,8 +637,9 @@ jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, jsx->rxqueue = g_malloc(jsx->rxmaxlen); jsx->rxqueue[0] = 0x05; jsx->rxqueue[1] = 0xFF; - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - jabber_si_xfer_bytestreams_send_read_response_cb, xfer); + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, purple_input_add(source, PURPLE_INPUT_WRITE, + jabber_si_xfer_bytestreams_send_read_response_cb, xfer)); jabber_si_xfer_bytestreams_send_read_response_cb(xfer, source, PURPLE_INPUT_WRITE); } @@ -680,7 +660,7 @@ jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); int acceptfd, flags; purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_connected_cb\n"); @@ -694,7 +674,7 @@ jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source, return; } - purple_input_remove(xfer->watcher); + purple_input_remove(purple_xfer_get_watcher(xfer)); close(source); jsx->local_streamhost_fd = -1; @@ -704,8 +684,8 @@ jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source, fcntl(acceptfd, F_SETFD, FD_CLOEXEC); #endif - xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_read_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(acceptfd, PURPLE_INPUT_READ, + jabber_si_xfer_bytestreams_send_read_cb, xfer)); } static void @@ -727,12 +707,12 @@ jabber_si_connect_proxy_cb(JabberStream *js, const char *from, return; } + jsx = purple_xfer_get_protocol_data(xfer); + /* In the case of a direct file transfer, this is expected to return */ - if(!xfer->data) + if(!jsx) return; - jsx = xfer->data; - if(type != JABBER_IQ_RESULT) { purple_debug_info("jabber", "jabber_si_xfer_connect_proxy_cb: type = error\n"); @@ -781,7 +761,7 @@ jabber_si_connect_proxy_cb(JabberStream *js, const char *from, jsx->js->user->domain, jsx->js->user->resource); if (!strcmp(jid, my_jid)) { purple_debug_info("jabber", "Got local SOCKS5 streamhost-used.\n"); - purple_xfer_start(xfer, xfer->fd, NULL, -1); + purple_xfer_start(xfer, purple_xfer_get_fd(xfer), NULL, -1); } else { /* if available, try to revert to IBB... */ if (jsx->stream_method & STREAM_METHOD_IBB) { @@ -805,9 +785,9 @@ jabber_si_connect_proxy_cb(JabberStream *js, const char *from, } /* Clean up the local streamhost - it isn't going to be used.*/ - if (xfer->watcher > 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; + if (purple_xfer_get_watcher(xfer) > 0) { + purple_input_remove(purple_xfer_get_watcher(xfer)); + purple_xfer_set_watcher(xfer, 0); } if (jsx->local_streamhost_fd >= 0) { close(jsx->local_streamhost_fd); @@ -835,7 +815,7 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) JabberBytestreamsStreamhost *sh, *sh2; int streamhost_count = 0; - jsx = xfer->data; + jsx = purple_xfer_get_protocol_data(xfer); jsx->listen_data = NULL; /* I'm not sure under which conditions this can happen @@ -848,7 +828,7 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) purple_xfer_unref(xfer); iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); query = xmlnode_get_child(iq->node, "query"); xmlnode_set_attrib(query, "sid", jsx->stream_id); @@ -865,8 +845,8 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) jid = g_strdup_printf("%s@%s/%s", jsx->js->user->node, jsx->js->user->domain, jsx->js->user->resource); - xfer->local_port = purple_network_get_port_from_fd(sock); - g_snprintf(port, sizeof(port), "%hu", xfer->local_port); + purple_xfer_set_local_port(xfer, purple_network_get_port_from_fd(sock)); + g_snprintf(port, sizeof(port), "%hu", purple_xfer_get_local_port(xfer)); public_ip = purple_network_get_my_ip(jsx->js->fd); @@ -896,8 +876,8 @@ jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) g_free(jid); /* The listener for the local proxy */ - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_connected_cb, xfer); + purple_xfer_set_watcher(xfer, purple_input_add(sock, PURPLE_INPUT_READ, + jabber_si_xfer_bytestreams_send_connected_cb, xfer)); } for (tmp = jsx->js->bs_proxies; tmp; tmp = tmp->next) { @@ -969,7 +949,7 @@ jabber_si_xfer_bytestreams_send_init(PurpleXfer *xfer) purple_xfer_ref(xfer); - jsx = xfer->data; + jsx = purple_xfer_get_protocol_data(xfer); /* TODO: This should probably be done with an account option instead of * piggy-backing on the TOR proxy type. */ @@ -979,7 +959,7 @@ jabber_si_xfer_bytestreams_send_init(PurpleXfer *xfer) purple_debug_info("jabber", "Skipping attempting local streamhost.\n"); jsx->listen_data = NULL; } else - jsx->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, + jsx->listen_data = purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, jabber_si_xfer_bytestreams_listen_cb, xfer); if (jsx->listen_data == NULL) { @@ -1017,7 +997,7 @@ jabber_si_xfer_ibb_recv_data_cb(JabberIBBSession *sess, gpointer data, gsize size) { PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if (size <= purple_xfer_get_bytes_remaining(xfer)) { purple_debug_info("jabber", "about to write %" G_GSIZE_FORMAT " bytes from IBB stream\n", @@ -1037,7 +1017,7 @@ jabber_si_xfer_ibb_recv_data_cb(JabberIBBSession *sess, gpointer data, static gssize jabber_si_xfer_ibb_read(guchar **out_buffer, PurpleXfer *xfer) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); guchar *buffer; gsize size; gsize tmp; @@ -1060,7 +1040,7 @@ jabber_si_xfer_ibb_open_cb(JabberStream *js, const char *who, const char *id, const gchar *sid = xmlnode_get_attrib(open, "sid"); PurpleXfer *xfer = jabber_si_xfer_find(js, sid, who); if (xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIBBSession *sess = jabber_ibb_session_create_from_xmlnode(js, who, id, open, xfer); @@ -1105,7 +1085,7 @@ jabber_si_xfer_ibb_open_cb(JabberStream *js, const char *who, const char *id, static gssize jabber_si_xfer_ibb_write(const guchar *buffer, size_t len, PurpleXfer *xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIBBSession *sess = jsx->ibb_session; gsize packet_size = len < jabber_ibb_session_get_max_data_size(sess) ? len : jabber_ibb_session_get_max_data_size(sess); @@ -1119,7 +1099,7 @@ static void jabber_si_xfer_ibb_sent_cb(JabberIBBSession *sess) { PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - gsize remaining = purple_xfer_get_bytes_remaining(xfer); + goffset remaining = purple_xfer_get_bytes_remaining(xfer); if (remaining == 0) { /* close the session */ @@ -1149,7 +1129,7 @@ jabber_si_xfer_ibb_opened_cb(JabberIBBSession *sess) static void jabber_si_xfer_ibb_send_init(JabberStream *js, PurpleXfer *xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); jsx->ibb_session = jabber_ibb_session_create(js, jsx->stream_id, purple_xfer_get_remote_user(xfer), xfer); @@ -1206,7 +1186,7 @@ static void jabber_si_xfer_send_method_cb(JabberStream *js, const char *from, for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { const char *var = xmlnode_get_attrib(field, "var"); - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if(var && !strcmp(var, "stream-method")) { if((value = xmlnode_get_child(field, "value"))) { @@ -1237,7 +1217,7 @@ static void jabber_si_xfer_send_method_cb(JabberStream *js, const char *from, static void jabber_si_xfer_send_request(PurpleXfer *xfer) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIq *iq; xmlnode *si, *file, *feature, *x, *field, *option, *value; char buf[32]; @@ -1247,10 +1227,10 @@ static void jabber_si_xfer_send_request(PurpleXfer *xfer) purple_xfer_prepare_thumbnail(xfer, "jpeg,png"); #endif - xfer->filename = g_path_get_basename(xfer->local_filename); + purple_xfer_set_filename(xfer, g_path_get_basename(purple_xfer_get_local_filename(xfer))); iq = jabber_iq_new(jsx->js, JABBER_IQ_SET); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); si = xmlnode_new_child(iq->node, "si"); xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); jsx->stream_id = jabber_get_next_id(jsx->js); @@ -1259,8 +1239,8 @@ static void jabber_si_xfer_send_request(PurpleXfer *xfer) file = xmlnode_new_child(si, "file"); xmlnode_set_namespace(file, NS_SI_FILE_TRANSFER); - xmlnode_set_attrib(file, "name", xfer->filename); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); + xmlnode_set_attrib(file, "name", purple_xfer_get_filename(xfer)); + g_snprintf(buf, sizeof(buf), "%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); xmlnode_set_attrib(file, "size", buf); /* maybe later we'll do hash and date attribs */ @@ -1309,7 +1289,7 @@ static void jabber_si_xfer_send_request(PurpleXfer *xfer) static void jabber_si_xfer_free(PurpleXfer *xfer) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if (jsx) { JabberStream *js = jsx->js; @@ -1324,10 +1304,9 @@ static void jabber_si_xfer_free(PurpleXfer *xfer) jabber_iq_remove_callback_by_id(js, jsx->iq_id); if (jsx->local_streamhost_fd >= 0) close(jsx->local_streamhost_fd); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && - xfer->fd >= 0) { + if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && purple_xfer_get_fd(xfer) >= 0) { purple_debug_info("jabber", "remove port mapping\n"); - purple_network_remove_port_mapping(xfer->fd); + purple_network_remove_port_mapping(purple_xfer_get_fd(xfer)); } if (jsx->connect_timeout > 0) purple_timeout_remove(jsx->connect_timeout); @@ -1356,7 +1335,7 @@ static void jabber_si_xfer_free(PurpleXfer *xfer) /* XXX: free other stuff */ g_free(jsx->rxqueue); g_free(jsx); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } } @@ -1367,7 +1346,7 @@ static void jabber_si_xfer_free(PurpleXfer *xfer) */ static void jabber_si_xfer_cancel_send(PurpleXfer *xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); /* if there is an IBB session active, send close on that */ if (jsx->ibb_session) { @@ -1380,7 +1359,7 @@ static void jabber_si_xfer_cancel_send(PurpleXfer *xfer) static void jabber_si_xfer_request_denied(PurpleXfer *xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberStream *js = jsx->js; /* @@ -1391,7 +1370,7 @@ static void jabber_si_xfer_request_denied(PurpleXfer *xfer) JabberIq *iq; xmlnode *error, *child; iq = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); jabber_iq_set_id(iq, jsx->iq_id); error = xmlnode_new_child(iq->node, "error"); @@ -1412,7 +1391,7 @@ static void jabber_si_xfer_request_denied(PurpleXfer *xfer) static void jabber_si_xfer_cancel_recv(PurpleXfer *xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); /* if there is an IBB session active, send close */ if (jsx->ibb_session) { jabber_ibb_session_close(jsx->ibb_session); @@ -1432,7 +1411,7 @@ static void jabber_si_xfer_send_disco_cb(JabberStream *js, const char *who, JabberCapabilities capabilities, gpointer data) { PurpleXfer *xfer = (PurpleXfer *) data; - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); if (capabilities & JABBER_CAP_IBB) { purple_debug_info("jabber", @@ -1458,8 +1437,8 @@ static void resource_select_cancel_cb(PurpleXfer *xfer, PurpleRequestFields *fie static void do_transfer_send(PurpleXfer *xfer, const char *resource) { - JabberSIXfer *jsx = xfer->data; - char **who_v = g_strsplit(xfer->who, "/", 2); + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); + char **who_v = g_strsplit(purple_xfer_get_remote_user(xfer), "/", 2); char *who; JabberBuddy *jb; JabberBuddyResource *jbr = NULL; @@ -1508,7 +1487,7 @@ static void resource_select_ok_cb(PurpleXfer *xfer, PurpleRequestFields *fields) static void jabber_si_xfer_init(PurpleXfer *xfer) { - JabberSIXfer *jsx = xfer->data; + JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer); JabberIq *iq; if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { JabberBuddy *jb; @@ -1516,7 +1495,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) char *resource; GList *resources = NULL; - if(NULL != (resource = jabber_get_resource(xfer->who))) { + if(NULL != (resource = jabber_get_resource(purple_xfer_get_remote_user(xfer)))) { /* they've specified a resource, no need to ask or * default or anything, just do it */ @@ -1525,7 +1504,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) return; } - jb = jabber_buddy_find(jsx->js, xfer->who, TRUE); + jb = jabber_buddy_find(jsx->js, purple_xfer_get_remote_user(xfer), TRUE); if (jb) { GList *l; @@ -1549,11 +1528,11 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) char *msg; if(!jb) { - msg = g_strdup_printf(_("Unable to send file to %s, invalid JID"), xfer->who); + msg = g_strdup_printf(_("Unable to send file to %s, invalid JID"), purple_xfer_get_remote_user(xfer)); } else if(jb->subscription & JABBER_SUB_TO) { - msg = g_strdup_printf(_("Unable to send file to %s, user is not online"), xfer->who); + msg = g_strdup_printf(_("Unable to send file to %s, user is not online"), purple_xfer_get_remote_user(xfer)); } else { - msg = g_strdup_printf(_("Unable to send file to %s, not subscribed to user presence"), xfer->who); + msg = g_strdup_printf(_("Unable to send file to %s, not subscribed to user presence"), purple_xfer_get_remote_user(xfer)); } purple_notify_error(jsx->js->gc, _("File Send Failed"), _("File Send Failed"), msg); @@ -1566,7 +1545,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) } else { /* we've got multiple resources, we need to pick one to send to */ GList *l; - char *msg = g_strdup_printf(_("Please select the resource of %s to which you would like to send a file"), xfer->who); + char *msg = g_strdup_printf(_("Please select the resource of %s to which you would like to send a file"), purple_xfer_get_remote_user(xfer)); PurpleRequestFields *fields = purple_request_fields_new(); PurpleRequestField *field = purple_request_field_choice_new("resource", _("Resource"), 0); PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); @@ -1582,7 +1561,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) purple_request_fields(jsx->js->gc, _("Select a Resource"), msg, NULL, fields, _("Send File"), G_CALLBACK(resource_select_ok_cb), _("Cancel"), G_CALLBACK(resource_select_cancel_cb), - jsx->js->gc->account, xfer->who, NULL, xfer); + purple_connection_get_account(jsx->js->gc), purple_xfer_get_remote_user(xfer), NULL, xfer); g_free(msg); } @@ -1592,7 +1571,7 @@ static void jabber_si_xfer_init(PurpleXfer *xfer) xmlnode *si, *feature, *x, *field, *value; iq = jabber_iq_new(jsx->js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", xfer->who); + xmlnode_set_attrib(iq->node, "to", purple_xfer_get_remote_user(xfer)); if(jsx->iq_id) jabber_iq_set_id(iq, jsx->iq_id); else @@ -1636,12 +1615,13 @@ PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who) PurpleXfer *xfer; JabberSIXfer *jsx; - js = gc->proto_data; + js = purple_connection_get_protocol_data(gc); - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); if (xfer) { - xfer->data = jsx = g_new0(JabberSIXfer, 1); + jsx = g_new0(JabberSIXfer, 1); + purple_xfer_set_protocol_data(xfer, jsx); jsx->js = js; jsx->local_streamhost_fd = -1; @@ -1696,8 +1676,7 @@ void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, xmlnode *thumbnail; #endif const char *stream_id, *filename, *filesize_c, *profile; - guint64 filesize_64 = 0; - size_t filesize = 0; + goffset filesize = 0; if(!(profile = xmlnode_get_attrib(si, "profile")) || strcmp(profile, NS_SI_FILE_TRANSFER)) @@ -1713,17 +1692,7 @@ void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, return; if((filesize_c = xmlnode_get_attrib(file, "size"))) - filesize_64 = g_ascii_strtoull(filesize_c, NULL, 10); - /* TODO 3.0.0: When the core uses a guint64, this is redundant. - * See #8477. - */ - if (filesize_64 > G_MAXSIZE) { - /* Should this pop up a warning? */ - purple_debug_warning("jabber", "Unable to transfer file (too large)" - " -- see #8477 for more details."); - return; - } - filesize = filesize_64; + filesize = g_ascii_strtoull(filesize_c, NULL, 10); if(!(feature = xmlnode_get_child(si, "feature"))) return; @@ -1774,10 +1743,10 @@ void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, jsx->stream_id = g_strdup(stream_id); jsx->iq_id = g_strdup(id); - xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); + xfer = purple_xfer_new(purple_connection_get_account(js->gc), PURPLE_XFER_RECEIVE, from); g_return_if_fail(xfer != NULL); - xfer->data = jsx; + purple_xfer_set_protocol_data(xfer, jsx); purple_xfer_set_filename(xfer, filename); if(filesize > 0) diff --git a/libpurple/protocols/jabber/useravatar.c b/libpurple/protocols/jabber/useravatar.c index 37c0b5a0cb..60a16fac91 100644 --- a/libpurple/protocols/jabber/useravatar.c +++ b/libpurple/protocols/jabber/useravatar.c @@ -377,7 +377,7 @@ update_buddy_metadata(JabberStream *js, const char *from, xmlnode *items) JabberBuddyAvatarUpdateURLInfo *info = g_new0(JabberBuddyAvatarUpdateURLInfo, 1); info->js = js; - url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, + url_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, MAX_HTTP_BUDDYICON_BYTES, do_buddy_avatar_update_fromurl, info); if (url_data) { diff --git a/libpurple/protocols/jabber/usermood.c b/libpurple/protocols/jabber/usermood.c index 39138b2c1d..545ce60ec9 100644 --- a/libpurple/protocols/jabber/usermood.c +++ b/libpurple/protocols/jabber/usermood.c @@ -155,12 +155,12 @@ static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) { break; } if (newmood != NULL) { - purple_prpl_got_user_status(js->gc->account, from, "mood", + purple_prpl_got_user_status(purple_connection_get_account(js->gc), from, "mood", PURPLE_MOOD_NAME, newmood, PURPLE_MOOD_COMMENT, moodtext, NULL); } else { - purple_prpl_got_user_status_deactive(js->gc->account, from, "mood"); + purple_prpl_got_user_status_deactive(purple_connection_get_account(js->gc), from, "mood"); } g_free(moodtext); } diff --git a/libpurple/protocols/jabber/usertune.c b/libpurple/protocols/jabber/usertune.c index 03e485ef1b..99c3ed87d9 100644 --- a/libpurple/protocols/jabber/usertune.c +++ b/libpurple/protocols/jabber/usertune.c @@ -92,7 +92,7 @@ static void jabber_tune_cb(JabberStream *js, const char *from, xmlnode *items) { } if (valid) { - purple_prpl_got_user_status(js->gc->account, from, "tune", + purple_prpl_got_user_status(purple_connection_get_account(js->gc), from, "tune", PURPLE_TUNE_ARTIST, tuneinfodata.artist, PURPLE_TUNE_TITLE, tuneinfodata.title, PURPLE_TUNE_ALBUM, tuneinfodata.album, @@ -100,7 +100,7 @@ static void jabber_tune_cb(JabberStream *js, const char *from, xmlnode *items) { PURPLE_TUNE_TIME, tuneinfodata.time, PURPLE_TUNE_URL, tuneinfodata.url, NULL); } else { - purple_prpl_got_user_status_deactive(js->gc->account, from, "tune"); + purple_prpl_got_user_status_deactive(purple_connection_get_account(js->gc), from, "tune"); } g_free(tuneinfodata.artist); @@ -117,7 +117,7 @@ void jabber_tune_init(void) { void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo) { xmlnode *publish, *tunenode; - JabberStream *js = gc->proto_data; + JabberStream *js = purple_connection_get_protocol_data(gc); publish = xmlnode_new("publish"); xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/tune"); diff --git a/libpurple/protocols/msn/contact.c b/libpurple/protocols/msn/contact.c index 33a1c3c9ea..3349d37864 100644 --- a/libpurple/protocols/msn/contact.c +++ b/libpurple/protocols/msn/contact.c @@ -968,7 +968,7 @@ msn_get_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) purple_debug_misc("msn", "Got the Address Book!\n"); if (msn_parse_addressbook(session, resp->xml)) { - msn_send_privacy(session->account->gc); + msn_send_privacy(purple_account_get_connection(session->account)); msn_notification_dump_contact(session); } else { /* This is making us loop infinitely when we fail to parse the @@ -1251,7 +1251,7 @@ msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state, body = g_markup_escape_text(user->invite_message, -1); /* Ignore the cast, we treat it as const anyway. */ - tmp = (char *)purple_connection_get_display_name(session->account->gc); + tmp = (char *)purple_connection_get_display_name(purple_account_get_connection(session->account)); tmp = tmp ? g_markup_escape_text(tmp, -1) : g_strdup(""); invite = g_strdup_printf(MSN_CONTACT_INVITE_MESSAGE_XML, body, tmp); diff --git a/libpurple/protocols/msn/error.c b/libpurple/protocols/msn/error.c index 68690ef384..18df67a8d5 100644 --- a/libpurple/protocols/msn/error.c +++ b/libpurple/protocols/msn/error.c @@ -274,7 +274,7 @@ msn_error_handle(MsnSession *session, unsigned int type) if (debug) purple_debug_warning("msn", "error %d: %s\n", type, buf); else - purple_notify_error(session->account->gc, NULL, buf, NULL); + purple_notify_error(purple_account_get_connection(session->account), NULL, buf, NULL); g_free(buf); } diff --git a/libpurple/protocols/msn/httpconn.c b/libpurple/protocols/msn/httpconn.c index 5bdcd61c15..36718342bd 100644 --- a/libpurple/protocols/msn/httpconn.c +++ b/libpurple/protocols/msn/httpconn.c @@ -285,8 +285,10 @@ read_cb(gpointer data, gint source, PurpleInputCondition cond) httpconn = data; servconn = httpconn->servconn; - if (servconn->type == MSN_SERVCONN_NS) - servconn->session->account->gc->last_received = time(NULL); + if (servconn->type == MSN_SERVCONN_NS) { + PurpleConnection *gc = purple_account_get_connection(servconn->session->account); + purple_connection_update_last_received(gc); + } len = read(httpconn->fd, buf, sizeof(buf) - 1); if (len < 0 && errno == EAGAIN) diff --git a/libpurple/protocols/msn/msg.c b/libpurple/protocols/msn/msg.c index 023bd4a10f..2b09225393 100644 --- a/libpurple/protocols/msn/msg.c +++ b/libpurple/protocols/msn/msg.c @@ -627,7 +627,7 @@ msn_plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) const char *passport; const char *value; - gc = cmdproc->session->account->gc; + gc = purple_account_get_connection(cmdproc->session->account); body = msn_message_get_bin_data(msg, &body_len); body_enc = g_markup_escape_text(body, body_len); @@ -688,7 +688,7 @@ msn_plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) swboard->flag |= MSN_SB_FLAG_IM; } } - else if (!g_str_equal(passport, purple_account_get_username(gc->account))) + else if (!g_str_equal(passport, purple_account_get_username(purple_connection_get_account(gc)))) { /* Don't im ourselves ... */ serv_got_im(gc, passport, body_final, 0, time(NULL)); @@ -713,7 +713,7 @@ msn_control_msg(MsnCmdProc *cmdproc, MsnMessage *msg) PurpleConnection *gc; char *passport; - gc = cmdproc->session->account->gc; + gc = purple_account_get_connection(cmdproc->session->account); passport = msg->remote_user; if (msn_message_get_header_value(msg, "TypingUser") == NULL) @@ -762,7 +762,7 @@ datacast_inform_user(MsnSwitchBoard *swboard, const char *who, if (swboard->conv == NULL) { if (chat) - swboard->conv = purple_find_chat(account->gc, swboard->chat_id); + swboard->conv = purple_find_chat(purple_account_get_connection(account), swboard->chat_id); else { swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); @@ -970,7 +970,7 @@ void msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); } - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); obj = NULL; who = NULL; sha1 = NULL; @@ -991,21 +991,23 @@ msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg) /* Nudge */ PurpleAccount *account; const char *user; + PurpleConnection *gc; account = cmdproc->session->account; user = msg->remote_user; + gc = purple_account_get_connection(account); if (cmdproc->servconn->type == MSN_SERVCONN_SB) { MsnSwitchBoard *swboard = cmdproc->data; if (swboard->current_users > 1 || ((swboard->conv != NULL) && purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - purple_prpl_got_attention_in_chat(account->gc, swboard->chat_id, user, MSN_NUDGE); + purple_prpl_got_attention_in_chat(gc, swboard->chat_id, user, MSN_NUDGE); else - purple_prpl_got_attention(account->gc, user, MSN_NUDGE); + purple_prpl_got_attention(gc, user, MSN_NUDGE); } else { - purple_prpl_got_attention(account->gc, user, MSN_NUDGE); + purple_prpl_got_attention(gc, user, MSN_NUDGE); } } else if (!strcmp(id, "2")) { @@ -1025,7 +1027,7 @@ msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg) slplink = msn_session_get_slplink(session, who); msn_slplink_request_object(slplink, data, got_wink_cb, NULL, obj); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); } else if (!strcmp(id, "3")) { @@ -1045,7 +1047,7 @@ msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg) slplink = msn_session_get_slplink(session, who); msn_slplink_request_object(slplink, data, got_voiceclip_cb, NULL, obj); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); } else if (!strcmp(id, "4")) { /* Action */ diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index f05aee31ce..4f9e9d7a4a 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -119,7 +119,7 @@ msn_send_attention(PurpleConnection *gc, const char *username, guint type) MsnSwitchBoard *swboard; msg = msn_message_new_nudge(); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_session_get_swboard(session, username, MSN_SB_FLAG_IM); msn_switchboard_send_msg(swboard, msg, TRUE); @@ -326,7 +326,7 @@ msn_set_prp(PurpleConnection *gc, const char *type, const char *entry) MsnSession *session; MsnTransaction *trans; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); cmdproc = session->notification->cmdproc; if (entry == NULL || *entry == '\0') @@ -384,7 +384,7 @@ send_to_mobile(PurpleConnection *gc, const char *who, const char *entry) const char *mobile_number = NULL; gsize payload_len; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); cmdproc = session->notification->cmdproc; page = msn_page_new(); @@ -647,7 +647,7 @@ msn_show_set_home_phone(PurplePluginAction *action) MsnSession *session; gc = (PurpleConnection *) action->context; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); purple_request_input(gc, NULL, _("Set your home phone number."), NULL, msn_user_get_home_phone(session->user), FALSE, FALSE, NULL, @@ -664,7 +664,7 @@ msn_show_set_work_phone(PurplePluginAction *action) MsnSession *session; gc = (PurpleConnection *) action->context; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); purple_request_input(gc, NULL, _("Set your work phone number."), NULL, msn_user_get_work_phone(session->user), FALSE, FALSE, NULL, @@ -681,7 +681,7 @@ msn_show_set_mobile_phone(PurplePluginAction *action) MsnSession *session; gc = (PurpleConnection *) action->context; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); purple_request_input(gc, NULL, _("Set your mobile phone number."), NULL, msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL, @@ -719,7 +719,7 @@ msn_show_blocked_text(PurplePluginAction *action) MsnSession *session; char *title; - session = pc->proto_data; + session = purple_connection_get_protocol_data(pc); title = g_strdup_printf(_("Blocked Text for %s"), session->account->username); if (session->blocked_text == NULL) { @@ -743,7 +743,7 @@ msn_show_hotmail_inbox(PurplePluginAction *action) MsnSession *session; gc = (PurpleConnection *) action->context; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); if (!session->passport_info.email_enabled) { purple_notify_error(gc, NULL, @@ -810,11 +810,11 @@ msn_send_privacy(PurpleConnection *gc) MsnTransaction *trans; account = purple_connection_get_account(gc); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); cmdproc = session->notification->cmdproc; - if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL || - account->perm_deny == PURPLE_PRIVACY_DENY_USERS) + if (purple_account_get_privacy_type(account) == PURPLE_PRIVACY_ALLOW_ALL || + purple_account_get_privacy_type(account) == PURPLE_PRIVACY_DENY_USERS) trans = msn_transaction_new(cmdproc, "BLP", "%s", "AL"); else trans = msn_transaction_new(cmdproc, "BLP", "%s", "BL"); @@ -840,7 +840,7 @@ initiate_chat_cb(PurpleBlistNode *node, gpointer data) account = purple_buddy_get_account(buddy); gc = purple_account_get_connection(account); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_switchboard_new(session); msn_switchboard_request(swboard); @@ -869,7 +869,7 @@ t_msn_xfer_init(PurpleXfer *xfer) static void t_msn_xfer_cancel_send(PurpleXfer *xfer) { - MsnSlpLink *slplink = xfer->data; + MsnSlpLink *slplink = purple_xfer_get_protocol_data(xfer); msn_slplink_unref(slplink); } @@ -879,13 +879,13 @@ msn_new_xfer(PurpleConnection *gc, const char *who) MsnSession *session; PurpleXfer *xfer; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); g_return_val_if_fail(xfer != NULL, NULL); - xfer->data = msn_slplink_ref(msn_session_get_slplink(session, who)); + purple_xfer_set_protocol_data(xfer, msn_slplink_ref(msn_session_get_slplink(session, who))); purple_xfer_set_init_fnc(xfer, t_msn_xfer_init); purple_xfer_set_cancel_send_fnc(xfer, t_msn_xfer_cancel_send); @@ -918,7 +918,7 @@ msn_can_receive_file(PurpleConnection *gc, const char *who) g_free(normal); if (ret) { - MsnSession *session = gc->proto_data; + MsnSession *session = purple_connection_get_protocol_data(gc); if (session) { MsnUser *user = msn_userlist_find_user(session->userlist, who); if (user) { @@ -1101,8 +1101,6 @@ msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean f } if (currentmedia) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ purple_notify_user_info_add_pair_html(user_info, mediatype, currentmedia); g_free(currentmedia); } @@ -1129,23 +1127,17 @@ msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean f phone = msn_user_get_home_phone(user); if (phone != NULL) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html(user_info, _("Home Phone Number"), phone); + purple_notify_user_info_add_pair_plaintext(user_info, _("Home Phone Number"), phone); } phone = msn_user_get_work_phone(user); if (phone != NULL) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html(user_info, _("Work Phone Number"), phone); + purple_notify_user_info_add_pair_plaintext(user_info, _("Work Phone Number"), phone); } phone = msn_user_get_mobile_phone(user); if (phone != NULL) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html(user_info, _("Mobile Phone Number"), phone); + purple_notify_user_info_add_pair_plaintext(user_info, _("Mobile Phone Number"), phone); } } } @@ -1224,7 +1216,7 @@ msn_actions(PurplePlugin *plugin, gpointer context) PurplePluginAction *act; gc = (PurpleConnection *) context; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); act = purple_plugin_action_new(_("Set Friendly Name..."), msn_show_set_friendly_name); @@ -1361,9 +1353,10 @@ msn_login(PurpleAccount *account) session = msn_session_new(account); - gc->proto_data = session; - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | - PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; + purple_connection_set_protocol_data(gc, session); + purple_connection_set_flags(gc, + PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | + PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY); msn_session_set_login_step(session, MSN_LOGIN_STEP_START); @@ -1395,13 +1388,13 @@ msn_close(PurpleConnection *gc) { MsnSession *session; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); g_return_if_fail(session != NULL); msn_session_destroy(session); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } static gboolean @@ -1461,7 +1454,7 @@ msn_send_emoticons(MsnSwitchBoard *swboard, GString *body) static void msn_emoticon_destroy(MsnEmoticon *emoticon) { if (emoticon->obj) - msn_object_destroy(emoticon->obj); + msn_object_destroy(emoticon->obj, FALSE); g_free(emoticon->smile); g_free(emoticon); } @@ -1534,7 +1527,7 @@ msn_send_im(PurpleConnection *gc, const char *who, const char *message, PurpleMessageFlags flags) { PurpleAccount *account; - PurpleBuddy *buddy = purple_find_buddy(gc->account, who); + PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(gc), who); MsnSession *session; MsnSwitchBoard *swboard; MsnMessage *msg; @@ -1547,7 +1540,7 @@ msn_send_im(PurpleConnection *gc, const char *who, const char *message, account = purple_connection_get_account(gc); username = purple_account_get_username(account); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_session_find_swboard(session, who); if (!strncmp("tel:+", who, 5)) { @@ -1651,7 +1644,7 @@ msn_send_im(PurpleConnection *gc, const char *who, const char *message, purple_debug_info("msn", "prepare to send offline Message\n"); - friendname = msn_encode_mime(account->username); + friendname = msn_encode_mime(purple_account_get_username(account)); msn_oim_prep_send_msg_info(session->oim, purple_account_get_username(account), friendname, who, msgtext); @@ -1674,7 +1667,7 @@ msn_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) MsnMessage *msg; account = purple_connection_get_account(gc); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* * TODO: I feel like this should be "if (state != PURPLE_TYPING)" @@ -1723,7 +1716,7 @@ msn_set_status(PurpleAccount *account, PurpleStatus *status) if (gc != NULL) { - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); msn_change_status(session); } } @@ -1733,7 +1726,7 @@ msn_set_idle(PurpleConnection *gc, int idle) { MsnSession *session; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); msn_change_status(session); } @@ -1863,7 +1856,7 @@ msn_rem_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) MsnSession *session; MsnUserList *userlist; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; if (!session->logged_in) @@ -1880,7 +1873,7 @@ msn_add_permit(PurpleConnection *gc, const char *who) MsnUserList *userlist; MsnUser *user; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; user = msn_userlist_find_user(userlist, who); @@ -1908,7 +1901,7 @@ msn_add_deny(PurpleConnection *gc, const char *who) MsnUserList *userlist; MsnUser *user; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; user = msn_userlist_find_user(userlist, who); @@ -1935,7 +1928,7 @@ msn_rem_permit(PurpleConnection *gc, const char *who) MsnUserList *userlist; MsnUser *user; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; if (!session->logged_in) @@ -1958,7 +1951,7 @@ msn_rem_deny(PurpleConnection *gc, const char *who) MsnUserList *userlist; MsnUser *user; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; if (!session->logged_in) @@ -1987,7 +1980,7 @@ msn_chat_invite(PurpleConnection *gc, int id, const char *msg, MsnSession *session; MsnSwitchBoard *swboard; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_session_find_swboard_with_id(session, id); @@ -2012,7 +2005,7 @@ msn_chat_leave(PurpleConnection *gc, int id) MsnSwitchBoard *swboard; PurpleConversation *conv; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_session_find_swboard_with_id(session, id); @@ -2049,7 +2042,7 @@ msn_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFl GString *emoticons = NULL; account = purple_connection_get_account(gc); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); username = purple_account_get_username(account); swboard = msn_session_find_swboard_with_id(session, id); @@ -2115,7 +2108,7 @@ msn_keepalive(PurpleConnection *gc) MsnSession *session; MsnTransaction *trans; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); if (!session->http_method) { @@ -2133,7 +2126,7 @@ static void msn_alias_buddy(PurpleConnection *pc, const char *name, const char * { MsnSession *session; - session = pc->proto_data; + session = purple_connection_get_protocol_data(pc); msn_update_contact(session, name, MSN_UPDATE_ALIAS, alias); } @@ -2145,7 +2138,7 @@ msn_group_buddy(PurpleConnection *gc, const char *who, MsnSession *session; MsnUserList *userlist; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); userlist = session->userlist; msn_userlist_move_buddy(userlist, who, old_group_name, new_group_name); @@ -2158,7 +2151,7 @@ msn_rename_group(PurpleConnection *gc, const char *old_name, MsnSession *session; const char *gname; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); g_return_if_fail(session != NULL); g_return_if_fail(session->userlist != NULL); @@ -2182,7 +2175,7 @@ msn_convo_closed(PurpleConnection *gc, const char *who) MsnSwitchBoard *swboard; PurpleConversation *conv; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); swboard = msn_session_find_swboard(session, who); @@ -2218,7 +2211,7 @@ msn_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) MsnSession *session; MsnUser *user; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); user = session->user; msn_user_set_buddy_icon(user, img); @@ -2232,7 +2225,7 @@ msn_remove_group(PurpleConnection *gc, PurpleGroup *group) MsnSession *session; const char *gname; - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); gname = purple_group_get_name(group); purple_debug_info("msn", "Remove group %s\n", gname); @@ -2750,7 +2743,7 @@ msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, /* Try to put the photo in there too, if there's one */ if (photo_url_text) { - url_data = purple_util_fetch_url_len(photo_url_text, FALSE, NULL, FALSE, + url_data = purple_util_fetch_url(photo_url_text, FALSE, NULL, FALSE, MAX_HTTP_BUDDYICON_BYTES, msn_got_photo, info2_data); session->url_datas = g_slist_prepend(session->url_datas, url_data); @@ -2849,7 +2842,7 @@ msn_get_info(PurpleConnection *gc, const char *name) url_data = purple_util_fetch_url(url, FALSE, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", - TRUE, msn_got_info, data); + TRUE, -1, msn_got_info, data); session->url_datas = g_slist_prepend(session->url_datas, url_data); g_free(url); @@ -2938,6 +2931,7 @@ static gboolean msn_uri_handler(const char *proto, const char *cmd, GHashTable * static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_MAIL_CHECK|OPT_PROTO_INVITE_MESSAGE, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -2959,7 +2953,7 @@ static PurplePluginProtocolInfo prpl_info = msn_set_status, /* set_away */ msn_set_idle, /* set_idle */ NULL, /* change_passwd */ - NULL, /* add_buddy */ + msn_add_buddy, /* add_buddy */ NULL, /* add_buddies */ msn_rem_buddy, /* remove_buddy */ NULL, /* remove_buddies */ @@ -2978,7 +2972,6 @@ static PurplePluginProtocolInfo prpl_info = msn_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ msn_alias_buddy, /* alias_buddy */ msn_group_buddy, /* group_buddy */ msn_rename_group, /* rename_group */ @@ -3003,15 +2996,12 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ msn_send_attention, /* send_attention */ msn_attention_types, /* attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ msn_get_account_text_table, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ msn_set_public_alias, /* set_public_alias */ - msn_get_public_alias, /* get_public_alias */ - msn_add_buddy, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + msn_get_public_alias /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/msn/nexus.c b/libpurple/protocols/msn/nexus.c index 968e44f6b1..7985f66def 100644 --- a/libpurple/protocols/msn/nexus.c +++ b/libpurple/protocols/msn/nexus.c @@ -390,7 +390,7 @@ msn_nexus_connect(MsnNexus *nexus) msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); username = purple_account_get_username(session->account); - password = purple_connection_get_password(session->account->gc); + password = purple_connection_get_password(purple_account_get_connection(session->account)); if (g_utf8_strlen(password, -1) > 16) { /* max byte size for 16 utf8 characters is 64 + 1 for the null */ gchar truncated[65]; diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index d6486b3f88..0acc084cd0 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -1193,7 +1193,7 @@ ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) if (id && strcmp(id, "1")) { PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - who, gc->account); + who, purple_connection_get_account(gc)); if (conv != NULL) { const char *error; if (!strcmp(id, "407")) @@ -1390,7 +1390,7 @@ url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) session = cmdproc->session; account = session->account; - gc = account->gc; + gc = purple_account_get_connection(account); rru = cmd->params[1]; url = cmd->params[2]; @@ -2011,7 +2011,7 @@ initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) const char *unread; session = cmdproc->session; - gc = session->account->gc; + gc = purple_account_get_connection(session->account); if (strcmp(msg->remote_user, "Hotmail")) /* This isn't an official message. */ @@ -2062,7 +2062,7 @@ initial_mdata_msg(MsnCmdProc *cmdproc, MsnMessage *msg) const char *mdata, *unread; session = cmdproc->session; - gc = session->account->gc; + gc = purple_account_get_connection(session->account); if (strcmp(msg->remote_user, "Hotmail")) /* This isn't an official message. */ @@ -2134,7 +2134,7 @@ email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) char *from, *subject, *tmp; session = cmdproc->session; - gc = session->account->gc; + gc = purple_account_get_connection(session->account); if (strcmp(msg->remote_user, "Hotmail")) /* This isn't an official message. */ @@ -2219,7 +2219,7 @@ system_msg(MsnCmdProc *cmdproc, MsnMessage *msg) } if (*buf != '\0') - purple_notify_info(cmdproc->session->account->gc, NULL, buf, NULL); + purple_notify_info(purple_account_get_connection(cmdproc->session->account), NULL, buf, NULL); } g_hash_table_destroy(table); diff --git a/libpurple/protocols/msn/object.c b/libpurple/protocols/msn/object.c index bee264109a..b635902c85 100644 --- a/libpurple/protocols/msn/object.c +++ b/libpurple/protocols/msn/object.c @@ -103,7 +103,7 @@ msn_object_new_from_string(const char *str) if (obj->creator == NULL || obj->size == 0 || obj->type == 0 || obj->sha1d == NULL) { purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); return NULL; } @@ -111,12 +111,12 @@ msn_object_new_from_string(const char *str) /* Location/friendly are required for non-buddyicon objects */ if (obj->type != MSN_OBJECT_USERTILE) { purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); return NULL; /* Buddy icon object can contain Url/Url1 instead */ } else if (obj->url == NULL || obj->url1 == NULL) { purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); return NULL; } } @@ -193,10 +193,13 @@ msn_object_new_from_image(PurpleStoredImage *img, const char *location, } void -msn_object_destroy(MsnObject *obj) +msn_object_destroy(MsnObject *obj, gboolean only_remote) { g_return_if_fail(obj != NULL); + if (only_remote && obj->local) + return; + g_free(obj->creator); g_free(obj->location); g_free(obj->friendly); diff --git a/libpurple/protocols/msn/object.h b/libpurple/protocols/msn/object.h index 81572dc799..cdd5bfbc16 100644 --- a/libpurple/protocols/msn/object.h +++ b/libpurple/protocols/msn/object.h @@ -86,9 +86,10 @@ MsnObject *msn_object_new_from_image(PurpleStoredImage *img, /** * Destroys an MsnObject structure. * - * @param obj The object structure. + * @param obj The object structure. + * @param only_remote Only destroy non-local objects. */ -void msn_object_destroy(MsnObject *obj); +void msn_object_destroy(MsnObject *obj, gboolean only_remote); /** * Outputs a string representation of an MsnObject. diff --git a/libpurple/protocols/msn/oim.c b/libpurple/protocols/msn/oim.c index 9aa8c51389..e294244302 100644 --- a/libpurple/protocols/msn/oim.c +++ b/libpurple/protocols/msn/oim.c @@ -695,7 +695,7 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) purple_debug_info("msn", "oim Date:{%s},passport{%s}\n", date, passport); - serv_got_im(rdata->oim->session->account->gc, passport, decode_msg, 0, + serv_got_im(purple_account_get_connection(rdata->oim->session->account), passport, decode_msg, 0, stamp); /*Now get the oim message ID from the oim_list. @@ -785,7 +785,7 @@ msn_parse_oim_xml(MsnOim *oim, xmlnode *node) /* XXX/khc: pretty sure this is wrong */ if (count > 0) - purple_notify_emails(session->account->gc, count, FALSE, NULL, + purple_notify_emails(purple_account_get_connection(session->account), count, FALSE, NULL, NULL, passports, urls, NULL, NULL); g_free(unread); } diff --git a/libpurple/protocols/msn/sbconn.c b/libpurple/protocols/msn/sbconn.c index a9a6288844..3acb5dd217 100644 --- a/libpurple/protocols/msn/sbconn.c +++ b/libpurple/protocols/msn/sbconn.c @@ -121,6 +121,8 @@ release_msg(MsnSwitchBoard *swboard, MsnMessage *msg) } #endif } + } else { + msn_transaction_set_saveable(trans, FALSE); } trans->payload = payload; diff --git a/libpurple/protocols/msn/servconn.c b/libpurple/protocols/msn/servconn.c index 617216cee2..697134ed57 100644 --- a/libpurple/protocols/msn/servconn.c +++ b/libpurple/protocols/msn/servconn.c @@ -421,8 +421,10 @@ read_cb(gpointer data, gint source, PurpleInputCondition cond) servconn = data; - if (servconn->type == MSN_SERVCONN_NS) - servconn->session->account->gc->last_received = time(NULL); + if (servconn->type == MSN_SERVCONN_NS) { + PurpleConnection *gc = purple_account_get_connection(servconn->session->account); + purple_connection_update_last_received(gc); + } len = read(servconn->fd, buf, sizeof(buf) - 1); if (len < 0 && errno == EAGAIN) diff --git a/libpurple/protocols/msn/session.c b/libpurple/protocols/msn/session.c index ff871648ec..d177e453d9 100644 --- a/libpurple/protocols/msn/session.c +++ b/libpurple/protocols/msn/session.c @@ -459,7 +459,7 @@ msn_session_set_login_step(MsnSession *session, MsnLoginStep step) if (session->logged_in) return; - gc = session->account->gc; + gc = purple_account_get_connection(session->account); session->login_step = step; diff --git a/libpurple/protocols/msn/slp.c b/libpurple/protocols/msn/slp.c index 85c78b260a..22a86da656 100644 --- a/libpurple/protocols/msn/slp.c +++ b/libpurple/protocols/msn/slp.c @@ -253,7 +253,7 @@ msn_request_user_display(MsnUser *user) data->session = session; data->remote_user = user->passport; data->sha1 = info; - url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, 200*1024, + url_data = purple_util_fetch_url(url, TRUE, NULL, TRUE, 200*1024, fetched_user_display, data); session->url_datas = g_slist_prepend(session->url_datas, url_data); } else { @@ -291,7 +291,7 @@ send_file_cb(MsnSlpCall *slpcall) static gchar * gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) { - gsize size = 0; + goffset size = 0; MsnFileContext context; gchar *u8 = NULL; gchar *ret; @@ -322,7 +322,7 @@ gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) preview = purple_xfer_get_thumbnail(xfer, &preview_len); - context.length = MSN_FILE_CONTEXT_SIZE; + context.length = MSN_FILE_CONTEXT_SIZE_V2; context.version = 2; /* V.3 contains additional unnecessary data */ context.file_size = size; if (preview) @@ -336,15 +336,17 @@ gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) } memset(&context.file_name[currentChar], 0x00, (MAX_FILE_NAME_LEN - currentChar) * 2); +#if 0 memset(&context.unknown1, 0, sizeof(context.unknown1)); context.unknown2 = 0xffffffff; +#endif /* Mind the cast, as in, don't free it after! */ context.preview = (char *)preview; context.preview_len = preview_len; u8 = msn_file_context_to_wire(&context); - ret = purple_base64_encode((const guchar *)u8, MSN_FILE_CONTEXT_SIZE + preview_len); + ret = purple_base64_encode((const guchar *)u8, MSN_FILE_CONTEXT_SIZE_V2 + preview_len); g_free(uni); g_free(u8); @@ -364,7 +366,7 @@ msn_request_ft(PurpleXfer *xfer) fn = purple_xfer_get_filename(xfer); fp = purple_xfer_get_local_filename(xfer); - slplink = xfer->data; + slplink = purple_xfer_get_protocol_data(xfer); g_return_if_fail(slplink != NULL); g_return_if_fail(fp != NULL); @@ -384,7 +386,7 @@ msn_request_ft(PurpleXfer *xfer) purple_xfer_set_read_fnc(xfer, msn_xfer_read); purple_xfer_set_write_fnc(xfer, msn_xfer_write); - xfer->data = slpcall; + purple_xfer_set_protocol_data(xfer, slpcall); context = gen_context(xfer, fn, fp); diff --git a/libpurple/protocols/msn/slpcall.c b/libpurple/protocols/msn/slpcall.c index 2f06124921..2a98e80384 100644 --- a/libpurple/protocols/msn/slpcall.c +++ b/libpurple/protocols/msn/slpcall.c @@ -113,7 +113,7 @@ msn_slpcall_destroy(MsnSlpCall *slpcall) if (slpcall->xfer != NULL) { if (purple_xfer_get_type(slpcall->xfer) == PURPLE_XFER_RECEIVE) g_byte_array_free(slpcall->u.incoming_data, TRUE); - slpcall->xfer->data = NULL; + purple_xfer_set_protocol_data(slpcall->xfer, NULL); purple_xfer_unref(slpcall->xfer); } @@ -485,7 +485,7 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, if (img) purple_imgstore_ref(img); } - msn_object_destroy(obj); + msn_object_destroy(obj, FALSE); if (img != NULL) { /* DATA PREP */ @@ -512,7 +512,6 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, MsnFileContext *file_context; char *buf; gsize bin_len; - guint32 file_size; char *file_name; account = slpcall->slplink->session->account; @@ -529,8 +528,6 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, file_context = msn_file_context_from_wire(buf, bin_len); if (file_context != NULL) { - file_size = file_context->file_size; - file_name = g_convert((const gchar *)&file_context->file_name, MAX_FILE_NAME_LEN * 2, "UTF-8", "UTF-16LE", @@ -538,7 +535,7 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, purple_xfer_set_filename(xfer, file_name ? file_name : ""); g_free(file_name); - purple_xfer_set_size(xfer, file_size); + purple_xfer_set_size(xfer, file_context->file_size); purple_xfer_set_init_fnc(xfer, msn_xfer_init); purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); @@ -550,7 +547,7 @@ got_sessionreq(MsnSlpCall *slpcall, const char *branch, slpcall->xfer = xfer; purple_xfer_ref(slpcall->xfer); - xfer->data = slpcall; + purple_xfer_set_protocol_data(xfer, slpcall); if (file_context->preview) { purple_xfer_set_thumbnail(xfer, file_context->preview, @@ -731,7 +728,9 @@ got_invite(MsnSlpCall *slpcall, dc->listen_data = purple_network_listen_range( 0, 0, + AF_UNSPEC, SOCK_STREAM, + TRUE, msn_dc_listen_socket_created_cb, dc ); @@ -832,7 +831,9 @@ got_ok(MsnSlpCall *slpcall, dc->listen_data = purple_network_listen_range( 0, 0, + AF_UNSPEC, SOCK_STREAM, + TRUE, msn_dc_listen_socket_created_cb, dc ); @@ -1141,8 +1142,6 @@ msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) if (slpcall->cb) slpcall->cb(slpcall, body, body_len); - - slpcall->wasted = TRUE; } } else if (msn_p2p_info_is_ack(slpmsg->p2p_info)) diff --git a/libpurple/protocols/msn/slplink.c b/libpurple/protocols/msn/slplink.c index eea9ee27d8..582bfe158b 100644 --- a/libpurple/protocols/msn/slplink.c +++ b/libpurple/protocols/msn/slplink.c @@ -465,7 +465,7 @@ init_first_msg(MsnSlpLink *slplink, MsnP2PInfo *info) purple_xfer_ref(xfer); purple_xfer_start(xfer, -1, NULL, 0); - if (xfer->data == NULL) { + if (purple_xfer_get_protocol_data(xfer) == NULL) { purple_xfer_unref(xfer); msn_slpmsg_destroy(slpmsg); g_return_val_if_reached(NULL); diff --git a/libpurple/protocols/msn/slpmsg.c b/libpurple/protocols/msn/slpmsg.c index 4a75e3abc9..1246397384 100644 --- a/libpurple/protocols/msn/slpmsg.c +++ b/libpurple/protocols/msn/slpmsg.c @@ -239,7 +239,7 @@ MsnSlpMessage *msn_slpmsg_dataprep_new(MsnSlpCall *slpcall) } -MsnSlpMessage *msn_slpmsg_file_new(MsnSlpCall *slpcall, size_t size) +MsnSlpMessage *msn_slpmsg_file_new(MsnSlpCall *slpcall, goffset size) { MsnSlpMessage *slpmsg; diff --git a/libpurple/protocols/msn/slpmsg.h b/libpurple/protocols/msn/slpmsg.h index 11e9901bc1..fb045e7c3a 100644 --- a/libpurple/protocols/msn/slpmsg.h +++ b/libpurple/protocols/msn/slpmsg.h @@ -133,7 +133,7 @@ MsnSlpMessage *msn_slpmsg_dataprep_new(MsnSlpCall *slpcall); * * @return A new SlpMessage with the file transfer info. */ -MsnSlpMessage *msn_slpmsg_file_new(MsnSlpCall *slpcall, size_t size); +MsnSlpMessage *msn_slpmsg_file_new(MsnSlpCall *slpcall, goffset size); /** * Serialize the MsnSlpMessage in a way it can be used to be transmited diff --git a/libpurple/protocols/msn/switchboard.c b/libpurple/protocols/msn/switchboard.c index 7fb26ffac1..b459797613 100644 --- a/libpurple/protocols/msn/switchboard.c +++ b/libpurple/protocols/msn/switchboard.c @@ -312,7 +312,7 @@ msn_switchboard_add_user(MsnSwitchBoard *swboard, const char *user) swboard->chat_id = msn_switchboard_get_chat_id(); swboard->flag |= MSN_SB_FLAG_IM; - swboard->conv = serv_got_joined_chat(account->gc, + swboard->conv = serv_got_joined_chat(purple_account_get_connection(account), swboard->chat_id, "MSN Chat"); @@ -750,7 +750,7 @@ out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) PurpleConnection *gc; MsnSwitchBoard *swboard; - gc = cmdproc->session->account->gc; + gc = purple_account_get_connection(cmdproc->session->account); swboard = cmdproc->data; if (swboard->current_users > 1) diff --git a/libpurple/protocols/msn/user.c b/libpurple/protocols/msn/user.c index 94af6ce6dc..afb0988445 100644 --- a/libpurple/protocols/msn/user.c +++ b/libpurple/protocols/msn/user.c @@ -76,7 +76,7 @@ msn_user_destroy(MsnUser *user) } if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); + msn_object_destroy(user->msnobj, FALSE); g_free(user->passport); g_free(user->friendly_name); @@ -406,7 +406,7 @@ msn_user_is_yahoo(PurpleAccount *account, const char *name) gc = purple_account_get_connection(account); if (gc != NULL) - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); if ((session != NULL) && (user = msn_userlist_find_user(session->userlist, name)) != NULL) { @@ -566,7 +566,7 @@ queue_buddy_icon_request(MsnUser *user) return; } - if (!buddy_icon_cached(account->gc, obj)) { + if (!buddy_icon_cached(purple_account_get_connection(account), obj)) { MsnUserList *userlist; userlist = user->userlist; @@ -588,8 +588,8 @@ msn_user_set_object(MsnUser *user, MsnObject *obj) { g_return_if_fail(user != NULL); - if (user->msnobj != NULL && !msn_object_find_local(msn_object_get_sha1(obj))) - msn_object_destroy(user->msnobj); + if (user->msnobj != NULL) + msn_object_destroy(user->msnobj, TRUE); user->msnobj = obj; diff --git a/libpurple/protocols/msn/userlist.c b/libpurple/protocols/msn/userlist.c index 1c4dd4bd8e..6ad7d670bc 100644 --- a/libpurple/protocols/msn/userlist.c +++ b/libpurple/protocols/msn/userlist.c @@ -54,7 +54,7 @@ msn_accept_add_cb(gpointer data) if (PURPLE_CONNECTION_IS_VALID(pa->gc)) { - MsnSession *session = pa->gc->proto_data; + MsnSession *session = purple_connection_get_protocol_data(pa->gc); MsnUserList *userlist = session->userlist; PurpleAccount *account = purple_connection_get_account(pa->gc); @@ -79,7 +79,7 @@ msn_cancel_add_cb(gpointer data) if (PURPLE_CONNECTION_IS_VALID(pa->gc)) { - MsnSession *session = pa->gc->proto_data; + MsnSession *session = purple_connection_get_protocol_data(pa->gc); MsnUserList *userlist = session->userlist; MsnCallbackState *state = msn_callback_state_new(session); diff --git a/libpurple/protocols/msn/xfer.c b/libpurple/protocols/msn/xfer.c index 4da276dacd..30f7789ea4 100644 --- a/libpurple/protocols/msn/xfer.c +++ b/libpurple/protocols/msn/xfer.c @@ -42,7 +42,7 @@ msn_xfer_init(PurpleXfer *xfer) purple_debug_info("msn", "xfer_init\n"); - slpcall = xfer->data; + slpcall = purple_xfer_get_protocol_data(xfer); /* Send Ok */ content = g_strdup_printf("SessionID: %lu\r\n\r\n", @@ -62,9 +62,9 @@ msn_xfer_cancel(PurpleXfer *xfer) char *content; g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->data != NULL); - slpcall = xfer->data; + slpcall = purple_xfer_get_protocol_data(xfer); + g_return_if_fail(slpcall != NULL); if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) { @@ -102,7 +102,7 @@ msn_xfer_write(const guchar *data, gsize len, PurpleXfer *xfer) g_return_val_if_fail(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND, -1); - slpcall = xfer->data; + slpcall = purple_xfer_get_protocol_data(xfer); /* Not sure I trust it'll be there */ g_return_val_if_fail(slpcall != NULL, -1); @@ -126,7 +126,7 @@ msn_xfer_read(guchar **data, PurpleXfer *xfer) g_return_val_if_fail(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE, -1); - slpcall = xfer->data; + slpcall = purple_xfer_get_protocol_data(xfer); /* Not sure I trust it'll be there */ g_return_val_if_fail(slpcall != NULL, -1); @@ -166,7 +166,7 @@ msn_file_context_to_wire(MsnFileContext *context) { gchar *ret, *tmp; - tmp = ret = g_new(gchar, MSN_FILE_CONTEXT_SIZE + context->preview_len + 1); + tmp = ret = g_new(gchar, MSN_FILE_CONTEXT_SIZE_V2 + context->preview_len + 1); msn_push32le(tmp, context->length); msn_push32le(tmp, context->version); @@ -174,9 +174,15 @@ msn_file_context_to_wire(MsnFileContext *context) msn_push32le(tmp, context->type); memcpy(tmp, context->file_name, MAX_FILE_NAME_LEN * 2); tmp += MAX_FILE_NAME_LEN * 2; +#if 0 memcpy(tmp, context->unknown1, sizeof(context->unknown1)); tmp += sizeof(context->unknown1); msn_push32le(tmp, context->unknown2); +#else + memset(tmp, 0, sizeof(gchar[30])); + tmp += sizeof(gchar[30]); + msn_push32le(tmp, 0xffffffff); +#endif if (context->preview) { memcpy(tmp, context->preview, context->preview_len); } @@ -190,21 +196,30 @@ msn_file_context_from_wire(const char *buf, gsize len) { MsnFileContext *context; - if (!buf || len < MSN_FILE_CONTEXT_SIZE) + if (!buf || len < MSN_FILE_CONTEXT_SIZE_V0) return NULL; context = g_new(MsnFileContext, 1); context->length = msn_pop32le(buf); context->version = msn_pop32le(buf); - if (context->version == 2) { + if (context->version == 0) { + if (context->length != MSN_FILE_CONTEXT_SIZE_V0) { + g_free(context); + return NULL; + } + } else if (context->version == 2) { /* The length field is broken for this version. No check. */ - context->length = MSN_FILE_CONTEXT_SIZE; + context->length = MSN_FILE_CONTEXT_SIZE_V2; + if (len < MSN_FILE_CONTEXT_SIZE_V2) { + g_free(context); + return NULL; + } } else if (context->version == 3) { - if (context->length != MSN_FILE_CONTEXT_SIZE + 63) { + if (context->length != MSN_FILE_CONTEXT_SIZE_V3) { g_free(context); return NULL; - } else if (len < MSN_FILE_CONTEXT_SIZE + 63) { + } else if (len < MSN_FILE_CONTEXT_SIZE_V3) { g_free(context); return NULL; } @@ -218,9 +233,15 @@ msn_file_context_from_wire(const char *buf, gsize len) context->type = msn_pop32le(buf); memcpy(context->file_name, buf, MAX_FILE_NAME_LEN * 2); buf += MAX_FILE_NAME_LEN * 2; - memcpy(context->unknown1, buf, sizeof(context->unknown1)); - buf += sizeof(context->unknown1); - context->unknown2 = msn_pop32le(buf); + if (context->version > 0) { +#if 0 + memcpy(context->unknown1, buf, sizeof(context->unknown1)); + buf += sizeof(context->unknown1); + context->unknown2 = msn_pop32le(buf); +#else + buf += sizeof(gchar[30]) + sizeof(guint32); +#endif + } if (context->type == 0 && len > context->length) { context->preview_len = len - context->length; diff --git a/libpurple/protocols/msn/xfer.h b/libpurple/protocols/msn/xfer.h index 23e19f37c3..78f6a81b98 100644 --- a/libpurple/protocols/msn/xfer.h +++ b/libpurple/protocols/msn/xfer.h @@ -39,13 +39,17 @@ typedef struct guint64 file_size; /*< Size of file */ guint32 type; /*< Transfer type */ gunichar2 file_name[MAX_FILE_NAME_LEN]; /*< Self-explanatory */ +#if 0 gchar unknown1[30]; /*< Used somehow for background sharing */ guint32 unknown2; /*< Possibly for background sharing as well */ +#endif gchar *preview; /*< File preview data, 96x96 PNG */ gsize preview_len; } MsnFileContext; -#define MSN_FILE_CONTEXT_SIZE (4*4 + 1*8 + 2*MAX_FILE_NAME_LEN + 30) +#define MSN_FILE_CONTEXT_SIZE_V0 (4*3 + 1*8 + 2*MAX_FILE_NAME_LEN) +#define MSN_FILE_CONTEXT_SIZE_V2 (MSN_FILE_CONTEXT_SIZE_V0 + 4*1 + 30) +#define MSN_FILE_CONTEXT_SIZE_V3 (MSN_FILE_CONTEXT_SIZE_V2 + 63) void msn_xfer_init(PurpleXfer *xfer); void msn_xfer_cancel(PurpleXfer *xfer); diff --git a/libpurple/protocols/mxit/actions.c b/libpurple/protocols/mxit/actions.c index 40d1d449db..35ad2ad747 100644 --- a/libpurple/protocols/mxit/actions.c +++ b/libpurple/protocols/mxit/actions.c @@ -43,7 +43,7 @@ */ static void mxit_profile_cb( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ) ; PurpleRequestField* field = NULL; const char* name = NULL; const char* bday = NULL; @@ -200,7 +200,7 @@ out: static void mxit_profile_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); struct MXitProfile* profile = session->profile; PurpleRequestFields* fields = NULL; @@ -297,7 +297,7 @@ static void mxit_profile_action( PurplePluginAction* action ) */ static void mxit_change_pin_cb( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* pin = NULL; const char* pin2 = NULL; const char* err = NULL; @@ -359,7 +359,7 @@ out: static void mxit_change_pin_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleRequestFields* fields = NULL; PurpleRequestFieldGroup* group = NULL; @@ -372,12 +372,12 @@ static void mxit_change_pin_action( PurplePluginAction* action ) purple_request_fields_add_group( fields, group ); /* pin */ - field = purple_request_field_string_new( "pin", _( "PIN" ), session->acc->password, FALSE ); + field = purple_request_field_string_new( "pin", _( "PIN" ), purple_account_get_password( session->acc ), FALSE ); purple_request_field_string_set_masked( field, TRUE ); purple_request_field_group_add_field( group, field ); /* verify pin */ - field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), session->acc->password, FALSE ); + field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), purple_account_get_password( session->acc ), FALSE ); purple_request_field_string_set_masked( field, TRUE ); purple_request_field_group_add_field( group, field ); @@ -395,7 +395,7 @@ static void mxit_change_pin_action( PurplePluginAction* action ) static void mxit_splash_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); if ( splash_current( session ) != NULL ) splash_display( session ); @@ -432,7 +432,7 @@ static void mxit_about_action( PurplePluginAction* action ) static void mxit_suggested_friends_action( PurplePluginAction* action ) { PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, @@ -449,7 +449,7 @@ static void mxit_suggested_friends_action( PurplePluginAction* action ) */ static void mxit_user_search_cb( PurpleConnection *gc, const char *input ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, diff --git a/libpurple/protocols/mxit/cipher.c b/libpurple/protocols/mxit/cipher.c index 9dba336ece..f079cc2cc3 100644 --- a/libpurple/protocols/mxit/cipher.c +++ b/libpurple/protocols/mxit/cipher.c @@ -79,7 +79,8 @@ static void padding_remove( GString* data ) static char* transport_layer_key( struct MXitSession* session ) { static char key[16 + 1]; - int passlen = strlen( session->acc->password ); + const char* password = purple_account_get_password( session->acc ); + int passlen = strlen( password ); /* initialize with initial key */ g_strlcpy( key, INITIAL_KEY, sizeof( key ) ); @@ -89,9 +90,9 @@ static char* transport_layer_key( struct MXitSession* session ) /* add last 8 characters of the PIN (no padding if less characters) */ if ( passlen <= 8 ) - memcpy( key + 8, session->acc->password, passlen ); + memcpy( key + 8, password, passlen ); else - memcpy( key + 8, session->acc->password + ( passlen - 8 ), 8 ); + memcpy( key + 8, password + ( passlen - 8 ), 8 ); return key; } @@ -124,7 +125,7 @@ char* mxit_encrypt_password( struct MXitSession* session ) /* build the secret data to be encrypted: SECRET_HEADER + password */ pass = g_string_new( SECRET_HEADER ); - g_string_append( pass, session->acc->password ); + g_string_append( pass, purple_account_get_password( session->acc) ); padding_add( pass ); /* add ISO10126 padding */ /* now encrypt the secret. we encrypt each block separately (ECB mode) */ diff --git a/libpurple/protocols/mxit/filexfer.c b/libpurple/protocols/mxit/filexfer.c index bc053fa752..ec948e1c91 100644 --- a/libpurple/protocols/mxit/filexfer.c +++ b/libpurple/protocols/mxit/filexfer.c @@ -97,11 +97,11 @@ const char* file_mime_type( const char* filename, const char* buf, int buflen ) */ static void mxit_xfer_free( PurpleXfer* xfer ) { - struct mxitxfer* mx = (struct mxitxfer*) xfer->data;; + struct mxitxfer* mx = purple_xfer_get_protocol_data( xfer ); if ( mx ) { + purple_xfer_set_protocol_data( xfer, NULL ); g_free( mx ); - xfer->data = NULL; } } @@ -117,16 +117,16 @@ static void mxit_xfer_free( PurpleXfer* xfer ) */ static void mxit_xfer_init( PurpleXfer* xfer ) { - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; + struct mxitxfer* mx = purple_xfer_get_protocol_data( xfer ); purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_init\n" ); if ( purple_xfer_get_type( xfer ) == PURPLE_XFER_SEND ) { /* we are trying to send a file to MXit */ - if ( purple_xfer_get_size( xfer ) > CP_MAX_FILESIZE ) { + if ( purple_xfer_get_size( xfer ) > ( CP_MAX_PACKET - 1000 ) ) { /* need to reserve some space for packet headers */ /* the file is too big */ - purple_xfer_error( xfer->type, xfer->account, xfer->who, _( "The file you are trying to send is too large!" ) ); + purple_xfer_error( purple_xfer_get_type( xfer ), purple_xfer_get_account( xfer ), purple_xfer_get_remote_user( xfer ), _( "The file you are trying to send is too large!" ) ); purple_xfer_cancel_local( xfer ); return; } @@ -139,7 +139,7 @@ static void mxit_xfer_init( PurpleXfer* xfer ) * we have just accepted a file transfer request from MXit. send a confirmation * to the MXit server so that can send us the file */ - mxit_send_file_accept( mx->session, mx->fileid, purple_xfer_get_size( xfer ), 0 ); + mxit_send_file_accept( mx->session, mx->fileid, (int) purple_xfer_get_size( xfer ), 0 ); } } @@ -151,6 +151,7 @@ static void mxit_xfer_init( PurpleXfer* xfer ) */ static void mxit_xfer_start( PurpleXfer* xfer ) { + goffset filesize; unsigned char* buffer; int size; int wrote; @@ -163,10 +164,12 @@ static void mxit_xfer_start( PurpleXfer* xfer ) * a buffer and copy the file data into memory and then we can send it to * the contact. we will send the whole file with one go. */ - buffer = g_malloc( xfer->bytes_remaining ); - size = fread( buffer, xfer->bytes_remaining, 1, xfer->dest_fp ); + filesize = purple_xfer_get_bytes_remaining( xfer ); + buffer = g_malloc( filesize ); + size = fread( buffer, filesize, 1, xfer->dest_fp ); + // TODO: If (size != 1) -> file read error - wrote = purple_xfer_write( xfer, buffer, xfer->bytes_remaining ); + wrote = purple_xfer_write( xfer, buffer, filesize ); if ( wrote > 0 ) purple_xfer_set_bytes_sent( xfer, wrote ); @@ -215,7 +218,7 @@ static void mxit_xfer_cancel_send( PurpleXfer* xfer ) */ static gssize mxit_xfer_write( const guchar* buffer, size_t size, PurpleXfer* xfer ) { - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; + struct mxitxfer* mx = purple_xfer_get_protocol_data( xfer ); purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_write\n" ); @@ -245,7 +248,7 @@ static gssize mxit_xfer_write( const guchar* buffer, size_t size, PurpleXfer* xf */ static void mxit_xfer_request_denied( PurpleXfer* xfer ) { - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; + struct mxitxfer* mx = purple_xfer_get_protocol_data( xfer ); purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_request_denied\n" ); @@ -295,7 +298,7 @@ gboolean mxit_xfer_enabled( PurpleConnection* gc, const char* who ) */ PurpleXfer* mxit_xfer_new( PurpleConnection* gc, const char* who ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleXfer* xfer = NULL; struct mxitxfer* mx = NULL; @@ -305,7 +308,7 @@ PurpleXfer* mxit_xfer_new( PurpleConnection* gc, const char* who ) /* create file info and attach it to the file transfer */ mx = g_new0( struct mxitxfer, 1 ); mx->session = session; - xfer->data = mx; + purple_xfer_set_protocol_data( xfer, mx ); /* configure callbacks (reference: "libpurple/ft.h") */ purple_xfer_set_init_fnc( xfer, mxit_xfer_init ); @@ -362,7 +365,7 @@ void mxit_xfer_rx_offer( struct MXitSession* session, const char* username, cons mx = g_new0( struct mxitxfer, 1 ); mx->session = session; memcpy( mx->fileid, fileid, MXIT_CHUNK_FILEID_LEN ); - xfer->data = mx; + purple_xfer_set_protocol_data( xfer, mx ); purple_xfer_set_filename( xfer, filename ); if( filesize > 0 ) @@ -395,9 +398,9 @@ static PurpleXfer* find_mxit_xfer( struct MXitSession* session, const char* file while ( item ) { xfer = item->data; - if ( xfer->account == session->acc ) { + if ( purple_xfer_get_account( xfer ) == session->acc ) { /* transfer is associated with this MXit account */ - struct mxitxfer* mx = xfer->data; + struct mxitxfer* mx = purple_xfer_get_protocol_data( xfer ); /* does the fileid match? */ if ( ( mx ) && ( memcmp( mx->fileid, fileid, MXIT_CHUNK_FILEID_LEN ) == 0 ) ) @@ -424,19 +427,17 @@ static PurpleXfer* find_mxit_xfer( struct MXitSession* session, const char* file void mxit_xfer_rx_file( struct MXitSession* session, const char* fileid, const char* data, int datalen ) { PurpleXfer* xfer = NULL; - struct mxitxfer* mx = NULL; purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_rx_file: (size=%i)\n", datalen ); /* find the file-transfer object */ xfer = find_mxit_xfer( session, fileid ); if ( xfer ) { - mx = xfer->data; - /* this is the transfer we have been looking for */ purple_xfer_ref( xfer ); purple_xfer_start( xfer, -1, NULL, 0 ); fwrite( data, datalen, 1, xfer->dest_fp ); + // TODO: Handle error from fwrite() purple_xfer_unref( xfer ); purple_xfer_set_completed( xfer, TRUE ); purple_xfer_end( xfer ); diff --git a/libpurple/protocols/mxit/formcmds.c b/libpurple/protocols/mxit/formcmds.c index 7c8527de5a..f14dbbd2b5 100644 --- a/libpurple/protocols/mxit/formcmds.c +++ b/libpurple/protocols/mxit/formcmds.c @@ -25,7 +25,7 @@ #include "internal.h" -#include +#include #include "purple.h" @@ -86,7 +86,6 @@ struct ii_url_request static void mxit_cb_ii_returned(PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message) { struct ii_url_request* iireq = (struct ii_url_request*) user_data; - char* ii_data; int* intptr = NULL; int id; @@ -106,12 +105,8 @@ static void mxit_cb_ii_returned(PurpleUtilFetchUrlData* url_data, gpointer user_ goto done; } - /* make a copy of the data */ - ii_data = g_malloc(len); - memcpy(ii_data, (const char*) url_text, len); - - /* we now have the inline image, store it in the imagestore */ - id = purple_imgstore_add_with_id(ii_data, len, NULL); + /* we now have the inline image, store a copy in the imagestore */ + id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); /* map the inline image id to purple image id */ intptr = g_malloc(sizeof(int)); @@ -367,7 +362,7 @@ static void command_image(struct RXMsgData* mx, GHashTable* hash, GString* msg) purple_debug_info(MXIT_PLUGIN_ID, "sending request for inline image '%s'\n", iireq->url); /* request the image (reference: "libpurple/util.h") */ - purple_util_fetch_url_request(iireq->url, TRUE, NULL, TRUE, NULL, FALSE, mxit_cb_ii_returned, iireq); + purple_util_fetch_url(iireq->url, TRUE, NULL, TRUE, -1, mxit_cb_ii_returned, iireq); mx->img_count++; } } diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c index 509d58beee..66bf26db88 100644 --- a/libpurple/protocols/mxit/login.c +++ b/libpurple/protocols/mxit/login.c @@ -49,30 +49,33 @@ static void get_clientinfo( struct MXitSession* session ); */ static struct MXitSession* mxit_create_object( PurpleAccount* account ) { + PurpleConnection* con = purple_account_get_connection( account ); struct MXitSession* session = NULL; - PurpleConnection* con = NULL; /* currently the wapsite does not handle a '+' in front of the username (mxitid) so we just strip it */ - if ( account->username[0] == '+' ) { - char* fixed; + { + const char* username = purple_account_get_username( account ); - /* cut off the '+' */ - fixed = g_strdup( &account->username[1] ); - purple_account_set_username( account, fixed ); - g_free( fixed ); + if ( username[0] == '+' ) { + char* fixed = g_strdup( &username[1] ); + purple_account_set_username( account, fixed ); + g_free( fixed ); + } } session = g_new0( struct MXitSession, 1 ); - - /* configure the connection (reference: "libpurple/connection.h") */ - con = purple_account_get_connection( account ); - con->proto_data = session; - con->flags |= PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_SUPPORT_MOODS; session->con = con; - - /* add account */ session->acc = account; + /* configure the connection (reference: "libpurple/connection.h") */ + purple_connection_set_protocol_data( con, session ); + purple_connection_set_flags( con, + PURPLE_CONNECTION_NO_BGCOLOR + | PURPLE_CONNECTION_NO_URLDESC + | PURPLE_CONNECTION_HTML + | PURPLE_CONNECTION_SUPPORT_MOODS + ); + /* configure the session (reference: "libpurple/account.h") */ g_strlcpy( session->server, purple_account_get_string( account, MXIT_CONFIG_SERVER_ADDR, DEFAULT_SERVER ), sizeof( session->server ) ); g_strlcpy( session->http_server, purple_account_get_string( account, MXIT_CONFIG_HTTPSERVER, DEFAULT_HTTP_SERVER ), sizeof( session->http_server ) ); @@ -173,7 +176,7 @@ static void mxit_cb_connect( gpointer user_data, gint source, const gchar* error session->fd = source; /* start listening on the open connection for messages from the server (reference: "libpurple/eventloop.h") */ - session->con->inpa = purple_input_add( session->fd, PURPLE_INPUT_READ, mxit_cb_rx, session ); + session->inpa = purple_input_add( session->fd, PURPLE_INPUT_READ, mxit_cb_rx, session ); mxit_connected( session ); } @@ -221,7 +224,7 @@ static void mxit_login_connect( struct MXitSession* session ) */ static void mxit_cb_register_ok( PurpleConnection *gc, PurpleRequestFields *fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); struct MXitProfile* profile = session->profile; const char* str; const char* pin; @@ -303,7 +306,7 @@ static void mxit_cb_register_cancel( PurpleConnection *gc, PurpleRequestFields * purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_register_cancel\n" ); /* disconnect */ - purple_account_disconnect( gc->account ); + purple_account_disconnect( purple_connection_get_account( gc ) ); } @@ -507,7 +510,7 @@ static void free_logindata( struct login_data* data ) */ static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleUtilFetchUrlData* url_data; PurpleRequestField* field; const char* captcha_resp; @@ -548,10 +551,24 @@ static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* field state = purple_account_get_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); url = g_strdup_printf( "%s?type=getpid&sessionid=%s&login=%s&ver=%i.%i.%i&clientid=%s&cat=%s&chalresp=%s&cc=%s&loc=%s&path=%i&brand=%s&model=%s&h=%i&w=%i&ts=%li", - session->logindata->wapserver, session->logindata->sessionid, purple_url_encode( session->acc->username ), PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_MICRO_VERSION, MXIT_CLIENT_ID, MXIT_CP_ARCH, - captcha_resp, session->logindata->cc, session->logindata->locale, ( state == MXIT_STATE_REGISTER1 ) ? 0 : 1, MXIT_CP_PLATFORM, MXIT_CP_OS, - MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_clientinfo2, session ); + session->logindata->wapserver, + session->logindata->sessionid, + purple_url_encode( purple_account_get_username( session->acc ) ), + PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_MICRO_VERSION, + MXIT_CLIENT_ID, + MXIT_CP_ARCH, + captcha_resp, + session->logindata->cc, + session->logindata->locale, + ( state == MXIT_STATE_REGISTER1 ) ? 0 : 1, + MXIT_CP_PLATFORM, + MXIT_CP_OS, + MXIT_CAPTCHA_HEIGHT, + MXIT_CAPTCHA_WIDTH, + time( NULL ) + ); + /* FIXME: This should be cancelled somewhere if not needed. */ + url_data = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_clientinfo2, session ); #ifdef DEBUG_PROTOCOL purple_debug_info( MXIT_PLUGIN_ID, "HTTP REQUEST: '%s'\n", url ); @@ -571,7 +588,7 @@ static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* field */ static void mxit_cb_captcha_cancel( PurpleConnection* gc, PurpleRequestFields* fields ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); /* free up the login resources */ free_logindata( session->logindata ); @@ -658,7 +675,7 @@ static void mxit_cb_clientinfo1( PurpleUtilFetchUrlData* url_data, gpointer user /* oops, this is not good, time to bail */ break; } - purple_request_field_list_add( field, country[1], g_strdup( country[0] ) ); + purple_request_field_list_add_icon( field, country[1], NULL, g_strdup( country[0] ) ); if ( strcmp( country[1], parts[6] ) == 0 ) { /* based on the user's IP, this is his current country code, so we default to it */ purple_request_field_list_add_selected( field, country[1] ); @@ -679,7 +696,7 @@ static void mxit_cb_clientinfo1( PurpleUtilFetchUrlData* url_data, gpointer user /* oops, this is not good, time to bail */ break; } - purple_request_field_list_add( field, locale[1], g_strdup( locale[0] ) ); + purple_request_field_list_add_icon( field, locale[1], NULL, g_strdup( locale[0] ) ); g_strfreev( locale ); } purple_request_field_list_add_selected( field, "English" ); @@ -715,7 +732,8 @@ static void get_clientinfo( struct MXitSession* session ) /* reference: "libpurple/util.h" */ url = g_strdup_printf( "%s/res/?type=challenge&getcountries=true&getlanguage=true&getimage=true&h=%i&w=%i&ts=%li", wapserver, MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_clientinfo1, session ); + /* FIXME: This should be cancelled somewhere if not needed. */ + url_data = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_clientinfo1, session ); #ifdef DEBUG_PROTOCOL purple_debug_info( MXIT_PLUGIN_ID, "HTTP REQUEST: '%s'\n", url ); @@ -764,9 +782,9 @@ void mxit_reconnect( struct MXitSession* session ) purple_debug_info( MXIT_PLUGIN_ID, "mxit_reconnect\n" ); /* remove the input cb function */ - if ( session->con->inpa ) { - purple_input_remove( session->con->inpa ); - session->con->inpa = 0; + if ( session->inpa ) { + purple_input_remove( session->inpa ); + session->inpa = 0; } /* close existing connection */ diff --git a/libpurple/protocols/mxit/markup.c b/libpurple/protocols/mxit/markup.c index b319467700..f209b42a14 100644 --- a/libpurple/protocols/mxit/markup.c +++ b/libpurple/protocols/mxit/markup.c @@ -628,7 +628,8 @@ static void emoticon_request( struct RXMsgData* mx, const char* id ) /* reference: "libpurple/util.h" */ url = g_strdup_printf( "%s/res/?type=emo&mlh=%i&sc=%s&ts=%li", wapserver, MXIT_EMOTICON_SIZE, id, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, NULL, TRUE, NULL, FALSE, emoticon_returned, mx ); + /* FIXME: This should be cancelled somewhere if not needed. */ + url_data = purple_util_fetch_url( url, TRUE, NULL, TRUE, -1, emoticon_returned, mx ); g_free( url ); } diff --git a/libpurple/protocols/mxit/multimx.c b/libpurple/protocols/mxit/multimx.c index 27f6625e66..09691abcb8 100644 --- a/libpurple/protocols/mxit/multimx.c +++ b/libpurple/protocols/mxit/multimx.c @@ -458,7 +458,7 @@ GList* mxit_chat_info(PurpleConnection *gc) */ void mxit_chat_join(PurpleConnection *gc, GHashTable *components) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); const char* roomname = NULL; struct multimx* multimx = NULL; @@ -500,7 +500,7 @@ void mxit_chat_join(PurpleConnection *gc, GHashTable *components) */ void mxit_chat_reject(PurpleConnection *gc, GHashTable* components) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); const char* roomname = NULL; struct multimx* multimx = NULL; @@ -543,7 +543,7 @@ char* mxit_chat_name(GHashTable *components) */ void mxit_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *username) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); struct multimx* multimx = NULL; PurpleBuddy* buddy; PurpleConversation *convo; @@ -589,7 +589,7 @@ void mxit_chat_invite(PurpleConnection *gc, int id, const char *msg, const char */ void mxit_chat_leave(PurpleConnection *gc, int id) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); struct multimx* multimx = NULL; purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i leave\n", id); @@ -620,7 +620,7 @@ void mxit_chat_leave(PurpleConnection *gc, int id) */ int mxit_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); struct multimx* multimx = NULL; const char* nickname; diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c index 4cdc09a093..ec606ff211 100644 --- a/libpurple/protocols/mxit/mxit.c +++ b/libpurple/protocols/mxit/mxit.c @@ -58,7 +58,7 @@ static int not_link_ref_count = 0; static void* mxit_link_click( const char* link64 ) { PurpleAccount* account; - PurpleConnection* con; + PurpleConnection* gc; gchar** parts = NULL; gchar* link = NULL; gsize len; @@ -91,15 +91,15 @@ static void* mxit_link_click( const char* link64 ) account = purple_accounts_find( parts[1], parts[2] ); if ( !account ) goto skip; - con = purple_account_get_connection( account ); - if ( !con ) + gc = purple_account_get_connection( account ); + if ( !gc ) goto skip; /* determine if it's a command-response to send */ is_command = ( atoi( parts[4] ) == 1 ); /* send click message back to MXit */ - mxit_send_message( con->proto_data, parts[3], parts[5], FALSE, is_command ); + mxit_send_message( purple_connection_get_protocol_data( gc ), parts[3], parts[5], FALSE, is_command ); g_free( link ); link = NULL; @@ -176,7 +176,7 @@ static void mxit_cb_chat_created( PurpleConversation* conv, struct MXitSession* const char* who; char* tmp; - gc = purple_conversation_get_gc( conv ); + gc = purple_conversation_get_connection( conv ); if ( session->con != gc ) { /* not our conversation */ return; @@ -358,11 +358,8 @@ static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboole purple_notify_user_info_add_pair_plaintext( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); /* rejection message */ - if ( ( contact->subtype == MXIT_SUBTYPE_REJECTED ) && ( contact->msg != NULL ) ) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Rejection Message" ), contact->msg ); - } + if ( ( contact->subtype == MXIT_SUBTYPE_REJECTED ) && ( contact->msg != NULL ) ) + purple_notify_user_info_add_pair_plaintext( info, _( "Rejection Message" ), contact->msg ); } @@ -373,7 +370,7 @@ static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboole */ static void mxit_close( PurpleConnection* gc ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); /* disable signals */ mxit_disable_signals( session ); @@ -409,7 +406,7 @@ static int mxit_send_im( PurpleConnection* gc, const char* who, const char* mess { purple_debug_info( MXIT_PLUGIN_ID, "Sending message '%s' to buddy '%s'\n", message, who ); - mxit_send_message( gc->proto_data, who, message, TRUE, FALSE ); + mxit_send_message( purple_connection_get_protocol_data( gc ), who, message, TRUE, FALSE ); return 1; /* echo to conversation window */ } @@ -423,7 +420,7 @@ static int mxit_send_im( PurpleConnection* gc, const char* who, const char* mess */ static void mxit_set_status( PurpleAccount* account, PurpleStatus* status ) { - struct MXitSession* session = purple_account_get_connection( account )->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( purple_account_get_connection( account ) ); const char* statusid; int presence; char* statusmsg1; @@ -516,7 +513,7 @@ static void mxit_free_buddy( PurpleBuddy* buddy ) */ static void mxit_keepalive( PurpleConnection *gc ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); /* if not logged in, there is nothing to do */ if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) ) @@ -544,7 +541,7 @@ static void mxit_keepalive( PurpleConnection *gc ) */ static void mxit_set_buddy_icon( PurpleConnection *gc, PurpleStoredImage *img ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); if ( img == NULL ) mxit_set_avatar( session, NULL, 0 ); @@ -563,7 +560,7 @@ static void mxit_get_info( PurpleConnection *gc, const char *who ) { PurpleBuddy* buddy; struct contact* contact; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_LASTSEEN, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, CP_PROFILE_WHEREAMI, CP_PROFILE_ABOUTME }; @@ -614,13 +611,10 @@ static GHashTable* mxit_get_text_table( PurpleAccount* acc ) static void mxit_reinvite( PurpleBlistNode *node, gpointer ignored ) { PurpleBuddy* buddy = (PurpleBuddy *) node; - PurpleConnection* gc; - struct MXitSession* session; + PurpleConnection* gc = purple_account_get_connection( purple_buddy_get_account( buddy ) ); + struct MXitSession* session = purple_connection_get_protocol_data( gc ); struct contact* contact; - gc = purple_account_get_connection( purple_buddy_get_account( buddy ) ); - session = gc->proto_data; - contact = purple_buddy_get_protocol_data( (PurpleBuddy*) node ); if ( !contact ) return; @@ -674,6 +668,7 @@ static GHashTable *mxit_chat_info_defaults( PurpleConnection *gc, const char *ch /*========================================================================================================================*/ static PurplePluginProtocolInfo proto_info = { + sizeof( PurplePluginProtocolInfo ), /* struct_size */ OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE, /* options */ NULL, /* user_splits */ NULL, /* protocol_options */ @@ -702,7 +697,7 @@ static PurplePluginProtocolInfo proto_info = { mxit_set_status, /* set_status */ NULL, /* set_idle */ NULL, /* change_passwd */ - NULL, /* add_buddy [roster.c] */ + mxit_add_buddy, /* add_buddy [roster.c] */ NULL, /* add_buddies */ mxit_remove_buddy, /* remove_buddy [roster.c] */ NULL, /* remove_buddies */ @@ -721,7 +716,6 @@ static PurplePluginProtocolInfo proto_info = { mxit_keepalive, /* keepalive */ mxit_register, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ mxit_buddy_alias, /* alias_buddy [roster.c] */ mxit_buddy_group, /* group_buddy [roster.c] */ mxit_rename_group, /* rename_group [roster.c] */ @@ -746,15 +740,12 @@ static PurplePluginProtocolInfo proto_info = { NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* attention_types */ - sizeof( PurplePluginProtocolInfo ), /* struct_size */ mxit_get_text_table, /* get_account_text_table */ mxit_media_initiate, /* initiate_media */ mxit_media_caps, /* get_media_caps */ mxit_get_moods, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - mxit_add_buddy, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; diff --git a/libpurple/protocols/mxit/mxit.h b/libpurple/protocols/mxit/mxit.h index 0d2131fbb9..2f4bcebff3 100644 --- a/libpurple/protocols/mxit/mxit.h +++ b/libpurple/protocols/mxit/mxit.h @@ -161,6 +161,7 @@ struct MXitSession { /* libpurple */ PurpleAccount* acc; /* pointer to the libpurple internal account struct */ PurpleConnection* con; /* pointer to the libpurple internal connection struct */ + guint inpa; /* the input watcher */ /* transmit */ struct tx_queue queue; /* transmit packet queue (FIFO mode) */ diff --git a/libpurple/protocols/mxit/profile.c b/libpurple/protocols/mxit/profile.c index 53fe4f3f01..f0c1744bb6 100644 --- a/libpurple/protocols/mxit/profile.c +++ b/libpurple/protocols/mxit/profile.c @@ -175,39 +175,25 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc contact = purple_buddy_get_protocol_data( buddy ); } - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Display Name" ), profile->nickname ); + purple_notify_user_info_add_pair_plaintext( info, _( "Display Name" ), profile->nickname ); tmp = g_strdup_printf("%s (%i)", profile->birthday, calculateAge( profile->birthday ) ); - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Birthday" ), tmp ); + purple_notify_user_info_add_pair_plaintext( info, _( "Birthday" ), tmp ); g_free( tmp ); purple_notify_user_info_add_pair_plaintext( info, _( "Gender" ), profile->male ? _( "Male" ) : _( "Female" ) ); /* optional information */ - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "First Name" ), profile->firstname ); - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Last Name" ), profile->lastname ); - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Country" ), profile->regcountry ); - - if ( *profile->aboutme ) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "About Me" ), profile->aboutme ); - } - if ( *profile->whereami ) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Where I Live" ), profile->whereami ); - } + purple_notify_user_info_add_pair_plaintext( info, _( "First Name" ), profile->firstname ); + purple_notify_user_info_add_pair_plaintext( info, _( "Last Name" ), profile->lastname ); + + purple_notify_user_info_add_pair_plaintext( info, _( "Country" ), profile->regcountry ); + + if ( *profile->aboutme ) + purple_notify_user_info_add_pair_plaintext( info, _( "About Me" ), profile->aboutme ); + + if ( *profile->whereami ) + purple_notify_user_info_add_pair_plaintext( info, _( "Where I Live" ), profile->whereami ); purple_notify_user_info_add_section_break( info ); @@ -241,11 +227,8 @@ void mxit_show_profile( struct MXitSession* session, const char* username, struc if ( contact ) { /* invite found */ - if ( contact->msg ) { - /* TODO: Check whether it's correct to call add_pair_html, - or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair_html( info, _( "Invite Message" ), contact->msg ); - } + if ( contact->msg ) + purple_notify_user_info_add_pair_plaintext( info, _( "Invite Message" ), contact->msg ); if ( contact->imgid ) { /* this invite has a avatar */ diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c index 7bcfa1ee68..733723b936 100644 --- a/libpurple/protocols/mxit/protocol.c +++ b/libpurple/protocols/mxit/protocol.c @@ -311,7 +311,7 @@ static void mxit_write_http_get( struct MXitSession* session, struct tx_packet* #endif /* send the HTTP request */ - session->http_out_req = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_http_rx, session ); + session->http_out_req = purple_util_fetch_url_request( session->acc, url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, -1, mxit_cb_http_rx, session ); g_free( url ); if ( part ) @@ -458,7 +458,7 @@ static void mxit_queue_packet( struct MXitSession* session, const char* data, in packet->headerlen = 0; /* create generic packet header */ - hlen = snprintf( header, sizeof( header ), "id=%s%c", session->acc->username, CP_REC_TERM ); /* client msisdn */ + hlen = snprintf( header, sizeof( header ), "id=%s%c", purple_account_get_username( session->acc), CP_REC_TERM ); /* client msisdn */ if ( session->http ) { /* http connection only */ @@ -718,7 +718,7 @@ void mxit_send_register( struct MXitSession* session ) "%s%c%i%c%s%c%s%c" /* dateOfBirth\1gender\1location\1capabilities\1 */ "%s%c%i%c%s%c%s" /* dc\1features\1dialingcode\1locale */ "%c%i%c%i", /* \1protocolVer\1lastRosterUpdate */ - session->encpwd, CP_FLD_TERM, clientVersion, CP_FLD_TERM, CP_MAX_FILESIZE, CP_FLD_TERM, profile->nickname, CP_FLD_TERM, + session->encpwd, CP_FLD_TERM, clientVersion, CP_FLD_TERM, CP_MAX_PACKET, CP_FLD_TERM, profile->nickname, CP_FLD_TERM, profile->birthday, CP_FLD_TERM, ( profile->male ) ? 1 : 0, CP_FLD_TERM, MXIT_DEFAULT_LOC, CP_FLD_TERM, MXIT_CP_CAP, CP_FLD_TERM, session->distcode, CP_FLD_TERM, features, CP_FLD_TERM, session->dialcode, CP_FLD_TERM, locale, CP_FLD_TERM, MXIT_CP_PROTO_VESION, CP_FLD_TERM, 0 @@ -765,7 +765,7 @@ void mxit_send_login( struct MXitSession* session ) session->encpwd, CP_FLD_TERM, clientVersion, CP_FLD_TERM, 1, CP_FLD_TERM, MXIT_CP_CAP, CP_FLD_TERM, session->distcode, CP_FLD_TERM, features, CP_FLD_TERM, session->dialcode, CP_FLD_TERM, locale, CP_FLD_TERM, - CP_MAX_FILESIZE, CP_FLD_TERM, MXIT_CP_PROTO_VESION, CP_FLD_TERM, 0 + CP_MAX_PACKET, CP_FLD_TERM, MXIT_CP_PROTO_VESION, CP_FLD_TERM, 0 ); /* include "custom resource" information */ @@ -2136,13 +2136,13 @@ static void mxit_parse_cmd_media( struct MXitSession* session, struct record** r contact = get_mxit_invite_contact( session, chunk.mxitid ); if ( contact ) { /* this is an invite (add image to the internal image store) */ - contact->imgid = purple_imgstore_add_with_id( chunk.data, chunk.length, NULL ); + contact->imgid = purple_imgstore_add_with_id( g_memdup( chunk.data, chunk.length ), chunk.length, NULL ); /* show the profile */ mxit_show_profile( session, chunk.mxitid, contact->profile ); } else { /* this is a contact's avatar, so update it */ - purple_buddy_icons_set_for_user( session->acc, chunk.mxitid, g_memdup( chunk.data, chunk.length), chunk.length, chunk.avatarid ); + purple_buddy_icons_set_for_user( session->acc, chunk.mxitid, g_memdup( chunk.data, chunk.length ), chunk.length, chunk.avatarid ); } } } @@ -2819,9 +2819,9 @@ void mxit_close_connection( struct MXitSession* session ) } /* remove the input cb function */ - if ( session->con->inpa ) { - purple_input_remove( session->con->inpa ); - session->con->inpa = 0; + if ( session->inpa ) { + purple_input_remove( session->inpa ); + session->inpa = 0; } /* remove HTTP poll timer */ diff --git a/libpurple/protocols/mxit/protocol.h b/libpurple/protocols/mxit/protocol.h index af93f952df..203ce445a2 100644 --- a/libpurple/protocols/mxit/protocol.h +++ b/libpurple/protocols/mxit/protocol.h @@ -34,8 +34,7 @@ #define CP_PKT_TERM '\x02' /* packet terminator */ -#define CP_MAX_PACKET ( 1024 * 1024 ) /* maximum client protocol packet size (1 MiB) */ -#define CP_MAX_FILESIZE ( 150 * 1000 ) /* maximum client protocol file transfer size (150 KB) */ +#define CP_MAX_PACKET ( 1 * 1000 * 1000 ) /* maximum client protocol packet size (1 MB) */ #define MXIT_EMOTICON_SIZE 18 /* icon size for custom emoticons */ #define CP_MAX_STATUS_MSG 250 /* maximum status message length (in characters) */ @@ -77,6 +76,7 @@ #define MXIT_CF_GAMING_UPDATE 0x800000 #define MXIT_CF_VOICE 0x1000000 #define MXIT_CF_VIDEO 0x2000000 +#define MXIT_CF_TOUCHSCREEN 0x4000000 /* Client features supported by this implementation */ #define MXIT_CP_FEATURES ( MXIT_CF_FILE_TRANSFER | MXIT_CF_FILE_ACCESS | MXIT_CF_AUDIO | MXIT_CF_MARKUP | MXIT_CF_EXT_MARKUP | MXIT_CF_NO_GATEWAYS | MXIT_CF_IMAGES | MXIT_CF_COMMANDS | MXIT_CF_VIBES | MXIT_CF_MIDP2 ) diff --git a/libpurple/protocols/mxit/roster.c b/libpurple/protocols/mxit/roster.c index 3922a42b5c..d815be0f23 100644 --- a/libpurple/protocols/mxit/roster.c +++ b/libpurple/protocols/mxit/roster.c @@ -293,14 +293,15 @@ static void dump_contact( struct contact* contact ) */ static PurpleBuddy* mxit_update_buddy_group( struct MXitSession* session, PurpleBuddy* buddy, PurpleGroup* group ) { - struct contact* contact = NULL; PurpleGroup* current_group = purple_buddy_get_group( buddy ); - PurpleBuddy* newbuddy = NULL; /* make sure the groups actually differs */ if ( strcmp( current_group->name, group->name ) != 0 ) { /* groupnames does not match, so we need to make the update */ + struct contact* contact = purple_buddy_get_protocol_data( buddy ); + PurpleBuddy* newbuddy = NULL; + purple_debug_info( MXIT_PLUGIN_ID, "Moving '%s' from group '%s' to '%s'\n", buddy->alias, current_group->name, group->name ); /* @@ -310,10 +311,10 @@ static PurpleBuddy* mxit_update_buddy_group( struct MXitSession* session, Purple * again. This is really not ideal and very irritating, but how else then? */ - /* create new buddy */ + /* create new buddy, and transfer 'contact' data */ newbuddy = purple_buddy_new( session->acc, buddy->name, buddy->alias ); - newbuddy->proto_data = buddy->proto_data; - buddy->proto_data = NULL; + purple_buddy_set_protocol_data( newbuddy, contact ); + purple_buddy_set_protocol_data( buddy, NULL ); /* remove the buddy */ purple_blist_remove_buddy( buddy ); @@ -322,7 +323,6 @@ static PurpleBuddy* mxit_update_buddy_group( struct MXitSession* session, Purple purple_blist_add_buddy( newbuddy, NULL, group, NULL ); /* now re-instate his presence again */ - contact = newbuddy->proto_data; if ( contact ) { /* update the buddy's status (reference: "libpurple/prpl.h") */ @@ -396,7 +396,7 @@ void mxit_update_contact( struct MXitSession* session, struct contact* contact ) /* create new buddy */ buddy = purple_buddy_new( session->acc, contact->username, contact->alias ); - purple_buddy_set_protocol_data(buddy, contact); + purple_buddy_set_protocol_data( buddy, contact ); /* add new buddy to list */ purple_blist_add_buddy( buddy, NULL, group, NULL ); @@ -728,7 +728,7 @@ gboolean is_mxit_chatroom_contact( struct MXitSession* session, const char* user */ void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group, const char* message ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); GSList* list = NULL; PurpleBuddy* mxbuddy = NULL; unsigned int i; @@ -804,7 +804,7 @@ void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* grou */ void mxit_remove_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); const gchar * buddy_name = purple_buddy_get_name( buddy ); purple_debug_info( MXIT_PLUGIN_ID, "mxit_remove_buddy '%s'\n", buddy_name ); @@ -822,7 +822,7 @@ void mxit_remove_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* g */ void mxit_buddy_alias( PurpleConnection* gc, const char* who, const char* alias ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleBuddy* buddy = NULL; PurpleGroup* group = NULL; @@ -856,7 +856,7 @@ void mxit_buddy_alias( PurpleConnection* gc, const char* who, const char* alias */ void mxit_buddy_group( PurpleConnection* gc, const char* who, const char* old_group, const char* new_group ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleBuddy* buddy = NULL; purple_debug_info( MXIT_PLUGIN_ID, "mxit_buddy_group from '%s' to '%s'\n", old_group, new_group ); @@ -883,7 +883,7 @@ void mxit_buddy_group( PurpleConnection* gc, const char* who, const char* old_gr */ void mxit_rename_group( PurpleConnection* gc, const char* old_name, PurpleGroup* group, GList* moved_buddies ) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data( gc ); PurpleBuddy* buddy = NULL; GList* item = NULL; diff --git a/libpurple/protocols/mxit/splashscreen.c b/libpurple/protocols/mxit/splashscreen.c index 9706e33f82..d7e9c04fb6 100644 --- a/libpurple/protocols/mxit/splashscreen.c +++ b/libpurple/protocols/mxit/splashscreen.c @@ -144,7 +144,7 @@ void splash_update(struct MXitSession* session, const char* splashId, const char */ static void splash_click_ok(PurpleConnection* gc, PurpleRequestFields* fields) { - struct MXitSession* session = (struct MXitSession*) gc->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(gc); const char* splashId; /* Get current splash ID */ diff --git a/libpurple/protocols/mxit/voicevideo.c b/libpurple/protocols/mxit/voicevideo.c index 246d14671d..9c6581900e 100644 --- a/libpurple/protocols/mxit/voicevideo.c +++ b/libpurple/protocols/mxit/voicevideo.c @@ -63,7 +63,7 @@ gboolean mxit_video_enabled(void) */ PurpleMediaCaps mxit_media_caps(PurpleAccount *account, const char *who) { - struct MXitSession* session = purple_account_get_connection(account)->proto_data; + struct MXitSession* session = purple_connection_get_protocol_data(purple_account_get_connection(account)); PurpleBuddy* buddy; struct contact* contact; PurpleMediaCaps capa = PURPLE_MEDIA_CAPS_NONE; diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index 57cadab49c..6295806b47 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -254,7 +254,7 @@ msim_send_bm(MsimSession *session, const gchar *who, const gchar *text, g_return_val_if_fail(who != NULL, FALSE); g_return_val_if_fail(text != NULL, FALSE); - from_username = session->account->username; + from_username = purple_account_get_username(session->account); g_return_val_if_fail(from_username != NULL, FALSE); @@ -429,11 +429,9 @@ msim_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, user = msim_get_user_from_buddy(buddy, TRUE); if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - MsimSession *session; PurpleAccount *account = purple_buddy_get_account(buddy); PurpleConnection *gc = purple_account_get_connection(account); - - session = (MsimSession *)gc->proto_data; + MsimSession *session = purple_connection_get_protocol_data(gc); /* TODO: if (full), do something different? */ @@ -707,14 +705,14 @@ msim_login_challenge(MsimSession *session, MsimMessage *msg) purple_connection_update_progress(session->gc, _("Logging in"), 2, 4); response_len = 0; - response = msim_compute_login_response(nc, account->username, account->password, &response_len); + response = msim_compute_login_response(nc, purple_account_get_username(account), purple_account_get_password(account), &response_len); g_free(nc); ret = msim_send(session, "login2", MSIM_TYPE_INTEGER, MSIM_AUTH_ALGORITHM, /* This is actually user's email address. */ - "username", MSIM_TYPE_STRING, g_strdup(account->username), + "username", MSIM_TYPE_STRING, g_strdup(purple_account_get_username(account)), /* GString will be freed in msim_msg_free() in msim_send(). */ "response", MSIM_TYPE_BINARY, g_string_new_len(response, response_len), "clientver", MSIM_TYPE_INTEGER, MSIM_CLIENT_VERSION, @@ -754,8 +752,8 @@ msim_unrecognized(MsimSession *session, MsimMessage *msg, gchar *note) */ purple_debug_info("msim", "Unrecognized data on account for %s\n", - (session && session->account && session->account->username) ? - session->account->username : "(NULL)"); + (session && session->account && purple_account_get_username(session->account)) ? + purple_account_get_username(session->account) : "(NULL)"); if (note) { purple_debug_info("msim", "(Note: %s)\n", note); } @@ -1840,7 +1838,7 @@ msim_error(MsimSession *session, MsimMessage *msg) if (!purple_account_get_remember_password(session->account)) purple_account_set_password(session->account, NULL); #ifdef MSIM_MAX_PASSWORD_LENGTH - if (session->account->password && (strlen(session->account->password) > MSIM_MAX_PASSWORD_LENGTH)) { + if (purple_account_get_password(session->account) && (strlen(purple_account_get_password(session->account)) > MSIM_MAX_PASSWORD_LENGTH)) { gchar *suggestion; suggestion = g_strdup_printf(_("%s Your password is " @@ -1848,7 +1846,7 @@ msim_error(MsimSession *session, MsimMessage *msg) "maximum length of %d. Please shorten your " "password at http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword and try again."), full_errmsg, - strlen(session->account->password), + strlen(purple_account_get_password(session->account)), MSIM_MAX_PASSWORD_LENGTH); /* Replace full_errmsg. */ @@ -2022,7 +2020,7 @@ msim_input_cb(gpointer gc_uncasted, gint source, PurpleInputCondition cond) g_return_if_fail(source >= 0); /* Note: 0 is a valid fd */ gc = (PurpleConnection *)(gc_uncasted); - session = gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* libpurple/eventloop.h only defines these two */ if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) { @@ -2157,7 +2155,7 @@ msim_connect_cb(gpointer data, gint source, const gchar *error_message) g_return_if_fail(data != NULL); gc = (PurpleConnection *)data; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); if (source < 0) { gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), @@ -2169,8 +2167,7 @@ msim_connect_cb(gpointer data, gint source, const gchar *error_message) } session->fd = source; - - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, msim_input_cb, gc); + session->inpa = purple_input_add(source, PURPLE_INPUT_READ, msim_input_cb, gc); } /** @@ -2186,13 +2183,13 @@ msim_login(PurpleAccount *acct) int port; g_return_if_fail(acct != NULL); - g_return_if_fail(acct->username != NULL); + g_return_if_fail(purple_account_get_username(acct) != NULL); - purple_debug_info("msim", "logging in %s\n", acct->username); + purple_debug_info("msim", "logging in %s\n", purple_account_get_username(acct)); gc = purple_account_get_connection(acct); - gc->proto_data = msim_session_new(acct); - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC; + purple_connection_set_protocol_data(gc, msim_session_new(acct)); + purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC); /* * Lets wipe out our local list of blocked buddies. We'll get a @@ -2259,14 +2256,15 @@ msim_close(PurpleConnection *gc) buddies = g_slist_delete_link(buddies, buddies); } - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); if (session == NULL) return; - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); - if (session->gc->inpa) { - purple_input_remove(session->gc->inpa); + if (session->inpa) { + purple_input_remove(session->inpa); + session->inpa = 0; } if (session->fd >= 0) { close(session->fd); @@ -2304,7 +2302,7 @@ msim_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, /* 'flags' has many options, not used here. */ - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); message_msim = html_to_msim_markup(session, message); @@ -2344,7 +2342,7 @@ msim_send_typing(PurpleConnection *gc, const gchar *name, g_return_val_if_fail(gc != NULL, 0); g_return_val_if_fail(name != NULL, 0); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); switch (state) { case PURPLE_TYPING: @@ -2430,7 +2428,7 @@ msim_get_info(PurpleConnection *gc, const gchar *username) g_return_if_fail(gc != NULL); g_return_if_fail(username != NULL); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* Obtain uid of buddy. */ user = msim_find_user(session, username); @@ -2487,6 +2485,7 @@ msim_set_status_code(MsimSession *session, guint status_code, gchar *statstring) static void msim_set_status(PurpleAccount *account, PurpleStatus *status) { + PurpleConnection *gc = purple_account_get_connection(account); PurpleStatusType *type; PurplePresence *pres; MsimSession *session; @@ -2495,7 +2494,7 @@ msim_set_status(PurpleAccount *account, PurpleStatus *status) gchar *stripped; gchar *unrecognized_msg; - session = (MsimSession *)account->gc->proto_data; + session = purple_connection_get_protocol_data(gc); type = purple_status_get_type(status); pres = purple_status_get_presence(status); @@ -2544,7 +2543,7 @@ msim_set_status(PurpleAccount *account, PurpleStatus *status) /* If we should be idle, set that status. Time is irrelevant here. */ if (purple_presence_is_idle(pres) && status_code != MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN) - msim_set_idle(account->gc, 1); + msim_set_idle(purple_account_get_connection(account), 1); } /** @@ -2558,7 +2557,7 @@ msim_set_idle(PurpleConnection *gc, int time) g_return_if_fail(gc != NULL); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); status = purple_account_get_active_status(session->account); @@ -2628,7 +2627,7 @@ msim_update_blocklist_for_buddy(MsimSession *session, const char *name, gboolean * Add a buddy to user's buddy list. */ static void -msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { MsimSession *session; MsimMessage *msg; @@ -2636,7 +2635,7 @@ msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) MsimMessage *body; const char *name, *gname; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); name = purple_buddy_get_name(buddy); gname = group ? purple_group_get_name(group) : NULL; @@ -2709,7 +2708,7 @@ msim_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) MsimMessage *persist_msg; const char *name; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); name = purple_buddy_get_name(buddy); delbuddy_msg = msim_msg_new( @@ -2766,7 +2765,7 @@ msim_add_deny(PurpleConnection *gc, const char *name) MsimSession *session; MsimMessage *msg, *body; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* Remove from buddy list */ msg = msim_msg_new( @@ -2818,7 +2817,7 @@ msim_rem_deny(PurpleConnection *gc, const char *name) MsimSession *session; MsimMessage *msg, *body; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* * Remove from our list of blocked contacts, so we know they @@ -2865,7 +2864,7 @@ static const char *msim_normalize(const PurpleAccount *account, const char *str) const char *username; /* If the account does not exist, we can't look up the user. */ - if (!account || !account->gc) + if (!account || !purple_account_get_connection(account)) return str; id = atol(str); @@ -2948,7 +2947,7 @@ msim_send_really_raw(PurpleConnection *gc, const char *buf, int total_bytes) g_return_val_if_fail(buf != NULL, -1); g_return_val_if_fail(total_bytes >= 0, -1); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* Loop until all data is sent, or a failure occurs. */ total_bytes_sent = 0; @@ -3008,6 +3007,7 @@ msim_get_account_text_table(PurpleAccount *unused) * Callbacks called by Purple, to access this plugin. */ static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ /* options */ OPT_PROTO_USE_POINTSIZE /* specify font size in sane point size */ | OPT_PROTO_MAIL_CHECK, @@ -3052,7 +3052,6 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ @@ -3077,15 +3076,12 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* unregister_user */ msim_send_attention, /* send_attention */ msim_attention_types, /* attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ msim_get_account_text_table, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; /** @@ -3151,7 +3147,7 @@ static void msim_import_friends(PurplePluginAction *action) gchar *group_name; gc = (PurpleConnection *)action->context; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); group_name = "MySpace Friends"; @@ -3530,6 +3526,7 @@ static gboolean msim_uri_handler(const gchar *proto, const gchar *cmd, GHashTable *params) { PurpleAccount *account; + PurpleConnection *gc; MsimSession *session; GList *l; gchar *uid_str, *cid_str; @@ -3578,7 +3575,8 @@ msim_uri_handler(const gchar *proto, const gchar *cmd, GHashTable *params) return FALSE; } - session = (MsimSession *)account->gc->proto_data; + gc = purple_account_get_connection(account); + session = purple_connection_get_protocol_data(gc); g_return_val_if_fail(session != NULL, FALSE); /* Lookup userid to username. TODO: push this down, to IM sending/contact diff --git a/libpurple/protocols/myspace/session.h b/libpurple/protocols/myspace/session.h index 34e1ba96cd..b8b902e769 100644 --- a/libpurple/protocols/myspace/session.h +++ b/libpurple/protocols/myspace/session.h @@ -38,6 +38,7 @@ typedef struct _MsimSession int privacy_mode; /**< This is a bitmask */ int offline_message_mode; gint fd; /**< File descriptor to/from server */ + guint inpa; /**< The input watcher */ /* TODO: Remove. */ GHashTable *user_lookup_cb; /**< Username -> userid lookup callback */ diff --git a/libpurple/protocols/myspace/user.c b/libpurple/protocols/myspace/user.c index 4d42cc5cdf..357c6a180d 100644 --- a/libpurple/protocols/myspace/user.c +++ b/libpurple/protocols/myspace/user.c @@ -384,7 +384,7 @@ msim_store_user_info_each(const gchar *key_str, gchar *value_str, MsimUser *user if (!previous_url || !g_str_equal(previous_url, user->image_url)) { if (user->url_data != NULL) purple_util_fetch_url_cancel(user->url_data); - user->url_data = purple_util_fetch_url(user->image_url, TRUE, NULL, TRUE, msim_downloaded_buddy_icon, (gpointer)user); + user->url_data = purple_util_fetch_url(user->image_url, TRUE, NULL, TRUE, -1, msim_downloaded_buddy_icon, (gpointer)user); } } else if (g_str_equal(key_str, "LastImageUpdated")) { /* TODO: use somewhere */ @@ -412,7 +412,7 @@ msim_store_user_info_each(const gchar *key_str, gchar *value_str, MsimUser *user * * @param session * @param msg The user information reply, with any amount of information. - * @param user The structure to save to, or NULL to save in PurpleBuddy->proto_data. + * @param user The structure to save to, or NULL to save in PurpleBuddy's protocol_data. * * Variable information is saved to the passed MsimUser structure. Permanent * information (UserID) is stored in the blist node of the buddy list (and @@ -758,7 +758,7 @@ static void msim_set_username_confirmed_cb(PurpleConnection *gc) g_return_if_fail(gc != NULL); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); user_msg = msim_msg_new( "user", MSIM_TYPE_STRING, g_strdup(msim_username_to_set), @@ -851,7 +851,7 @@ static void msim_check_username_availability_cb(PurpleConnection *gc, const char g_return_if_fail(gc != NULL); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); purple_debug_info("msim_check_username_availability_cb", "Checking username: %s\n", username_to_check); diff --git a/libpurple/protocols/myspace/zap.c b/libpurple/protocols/myspace/zap.c index ed45e56d24..653b4d9f34 100644 --- a/libpurple/protocols/myspace/zap.c +++ b/libpurple/protocols/myspace/zap.c @@ -132,10 +132,10 @@ msim_send_attention(PurpleConnection *gc, const gchar *username, guint code) PurpleAttentionType *attn; PurpleBuddy *buddy; - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); /* Look for this attention type, by the code index given. */ - types = msim_attention_types(gc->account); + types = msim_attention_types(purple_connection_get_account(gc)); attn = (PurpleAttentionType *)g_list_nth_data(types, code); if (!attn) { @@ -175,7 +175,7 @@ msim_send_zap_from_menu(PurpleBlistNode *node, gpointer zap_num_ptr) /* Find the session */ account = purple_buddy_get_account(buddy); gc = purple_account_get_connection(account); - session = (MsimSession *)gc->proto_data; + session = purple_connection_get_protocol_data(gc); zap = GPOINTER_TO_INT(zap_num_ptr); diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c index 3037507ae2..416e0b0279 100644 --- a/libpurple/protocols/novell/novell.c +++ b/libpurple/protocols/novell/novell.c @@ -131,8 +131,8 @@ _login_resp_cb(NMUser * user, NMERR_T ret_code, /* Don't attempt to auto-reconnect if our * password was invalid. */ - if (!purple_account_get_remember_password(gc->account)) - purple_account_set_password(gc->account, NULL); + if (!purple_account_get_remember_password(purple_connection_get_account(gc))) + purple_account_set_password(purple_connection_get_account(gc), NULL); reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; break; default: @@ -741,16 +741,16 @@ _get_details_resp_add_privacy_item(NMUser *user, NMERR_T ret_code, if (allowed) { - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, display_id, TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE); } } else { - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, display_id, TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE); } } @@ -789,10 +789,10 @@ _create_privacy_item_deny_resp_cb(NMUser *user, NMERR_T ret_code, if (display_id) { - if (!g_slist_find_custom(gc->account->deny, + if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, display_id, TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE); } } else { @@ -840,11 +840,11 @@ _create_privacy_item_permit_resp_cb(NMUser *user, NMERR_T ret_code, if (display_id) { - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, display_id, TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE); } } else { @@ -1177,7 +1177,6 @@ _update_buddy_status(NMUser *user, PurpleBuddy * buddy, int novellstatus, int gm const char *dn; const char *name; int idle = 0; - gboolean loggedin = TRUE; account = purple_buddy_get_account(buddy); name = purple_buddy_get_name(buddy); @@ -1194,7 +1193,6 @@ _update_buddy_status(NMUser *user, PurpleBuddy * buddy, int novellstatus, int gm break; case NM_STATUS_OFFLINE: status_id = NOVELL_STATUS_TYPE_OFFLINE; - loggedin = FALSE; break; case NM_STATUS_AWAY_IDLE: status_id = NOVELL_STATUS_TYPE_AWAY; @@ -1202,7 +1200,6 @@ _update_buddy_status(NMUser *user, PurpleBuddy * buddy, int novellstatus, int gm break; default: status_id = NOVELL_STATUS_TYPE_OFFLINE; - loggedin = FALSE; break; } @@ -1404,15 +1401,15 @@ _sync_privacy_lists(NMUser *user) /* Set the Purple privacy setting */ if (user->default_deny) { if (user->allow_list == NULL) { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_ALL; + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_ALL); } else { - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_USERS); } } else { if (user->deny_list == NULL) { - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL; + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_ALL); } else { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; + purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_USERS); } } @@ -1424,9 +1421,9 @@ _sync_privacy_lists(NMUser *user) else name =(char *)node->data; - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, name , TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE); } } @@ -1437,15 +1434,15 @@ _sync_privacy_lists(NMUser *user) else name =(char *)node->data; - if (!g_slist_find_custom(gc->account->deny, + if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, name, TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), name, TRUE); } } /* Remove stuff */ - for (node = gc->account->permit; node; node = node->next) { + for (node = purple_connection_get_account(gc)->permit; node; node = node->next) { dn = nm_lookup_dn(user, (char *)node->data); if (dn != NULL && !g_slist_find_custom(user->allow_list, @@ -1456,13 +1453,13 @@ _sync_privacy_lists(NMUser *user) if (rem_list) { for (node = rem_list; node; node = node->next) { - purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } g_slist_free(rem_list); rem_list = NULL; } - for (node = gc->account->deny; node; node = node->next) { + for (node = purple_connection_get_account(gc)->deny; node; node = node->next) { dn = nm_lookup_dn(user, (char *)node->data); if (dn != NULL && !g_slist_find_custom(user->deny_list, @@ -1473,7 +1470,7 @@ _sync_privacy_lists(NMUser *user) if (rem_list) { for (node = rem_list; node; node = node->next) { - purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } g_slist_free(rem_list); } @@ -1629,7 +1626,7 @@ _initiate_conference_cb(PurpleBlistNode *node, gpointer ignored) buddy = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -1685,7 +1682,7 @@ novell_ssl_connect_error(PurpleSslConnection * gsc, NMUser *user; gc = data; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); user->conn->ssl_conn->data = NULL; purple_connection_ssl_error (gc, error); @@ -1702,7 +1699,7 @@ novell_ssl_recv_cb(gpointer data, PurpleSslConnection * gsc, if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -1736,7 +1733,7 @@ novell_ssl_connected_cb(gpointer data, PurpleSslConnection * gsc, if (gc == NULL || gsc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if ((user == NULL) || (conn = user->conn) == NULL) return; @@ -2206,7 +2203,7 @@ novell_login(PurpleAccount * account) user = nm_initialize_user(name, server, port, account, _event_callback); if (user && user->conn) { /* save user */ - gc->proto_data = user; + purple_connection_set_protocol_data(gc, user); /* connect to the server */ purple_connection_update_progress(gc, _("Connecting"), @@ -2238,7 +2235,7 @@ novell_close(PurpleConnection * gc) if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { conn = user->conn; if (conn && conn->ssl_conn) { @@ -2246,7 +2243,7 @@ novell_close(PurpleConnection * gc) } nm_deinitialize_user(user); } - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } static int @@ -2266,7 +2263,7 @@ novell_send_im(PurpleConnection * gc, const char *name, message_body == NULL || *message_body == '\0') return 0; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return 0; @@ -2352,7 +2349,7 @@ novell_send_typing(PurpleConnection * gc, const char *name, PurpleTypingState st if (gc == NULL || name == NULL) return 0; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return 0; @@ -2386,7 +2383,7 @@ novell_convo_closed(PurpleConnection * gc, const char *who) if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, who))) { conf = nm_find_conversation(user, dn); if (conf) { @@ -2408,7 +2405,7 @@ novell_chat_leave(PurpleConnection * gc, int id) if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -2440,7 +2437,7 @@ novell_chat_invite(PurpleConnection *gc, int id, if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -2479,7 +2476,7 @@ novell_chat_send(PurpleConnection * gc, int id, const char *text, PurpleMessageF if (gc == NULL || text == NULL) return -1; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return -1; @@ -2545,7 +2542,7 @@ novell_chat_send(PurpleConnection * gc, int id, const char *text, PurpleMessageF } static void -novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group) +novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group, const char *message) { NMFolder *folder = NULL; NMContact *contact; @@ -2619,7 +2616,7 @@ novell_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group if (gc == NULL || buddy == NULL || group == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)))) { gname = purple_group_get_name(group); if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { @@ -2651,7 +2648,7 @@ novell_remove_group(PurpleConnection * gc, PurpleGroup *group) if (gc == NULL || group == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { NMFolder *folder = nm_find_folder(user, purple_group_get_name(group)); @@ -2676,7 +2673,7 @@ novell_alias_buddy(PurpleConnection * gc, const char *name, const char *alias) if (gc == NULL || name == NULL || alias == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, name))) { /* Alias all of instances of the contact */ @@ -2735,7 +2732,7 @@ novell_group_buddy(PurpleConnection * gc, old_group_name == NULL || new_group_name == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user && (dn = nm_lookup_dn(user, name))) { /* Find the old folder */ @@ -2793,7 +2790,7 @@ novell_rename_group(PurpleConnection * gc, const char *old_name, return; } - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { const char *gname = purple_group_get_name(group); /* Does new folder exist already? */ @@ -2839,7 +2836,7 @@ novell_tooltip_text(PurpleBuddy * buddy, PurpleNotifyUserInfo * user_info, gbool return; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - if (gc == NULL || (user = gc->proto_data) == NULL) + if (gc == NULL || (user = purple_connection_get_protocol_data(gc)) == NULL) return; if (PURPLE_BUDDY_IS_ONLINE(buddy)) { @@ -2891,7 +2888,7 @@ novell_set_idle(PurpleConnection * gc, int time) if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -2920,7 +2917,7 @@ novell_get_info(PurpleConnection * gc, const char *name) if (gc == NULL || name == NULL) return; - user = (NMUser *) gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user) { user_record = nm_find_user_record(user, name); @@ -2949,17 +2946,19 @@ novell_status_text(PurpleBuddy * buddy) if (buddy && account) { PurpleConnection *gc = purple_account_get_connection(account); - if (gc && gc->proto_data) { - NMUser *user = gc->proto_data; + if (gc) { + NMUser *user = purple_connection_get_protocol_data(gc); - dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); - if (dn) { - NMUserRecord *user_record = nm_find_user_record(user, dn); + if (user) { + dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); + if (dn) { + NMUserRecord *user_record = nm_find_user_record(user, dn); - if (user_record) { - text = nm_user_record_get_status_text(user_record); - if (text) - return g_strdup(text); + if (user_record) { + text = nm_user_record_get_status_text(user_record); + if (text) + return g_strdup(text); + } } } } @@ -3035,7 +3034,7 @@ novell_set_status(PurpleAccount *account, PurpleStatus *status) return; gc = purple_account_get_connection(account); - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3082,14 +3081,14 @@ novell_add_permit(PurpleConnection *gc, const char *who) if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; /* Remove first -- we will add it back in when we get * the okay from the server */ - purple_privacy_permit_remove(gc->account, who, TRUE); + purple_privacy_permit_remove(purple_connection_get_account(gc), who, TRUE); if (nm_user_is_privacy_locked(user)) { _show_privacy_locked_error(gc, user); @@ -3126,14 +3125,14 @@ novell_add_deny(PurpleConnection *gc, const char *who) if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; /* Remove first -- we will add it back in when we get * the okay from the server */ - purple_privacy_deny_remove(gc->account, who, TRUE); + purple_privacy_deny_remove(purple_connection_get_account(gc), who, TRUE); if (nm_user_is_privacy_locked(user)) { _show_privacy_locked_error(gc, user); @@ -3170,7 +3169,7 @@ novell_rem_permit(PurpleConnection *gc, const char *who) if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3200,7 +3199,7 @@ novell_rem_deny(PurpleConnection *gc, const char *who) if (gc == NULL || who == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3235,7 +3234,7 @@ novell_set_permit_deny(PurpleConnection *gc) if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3251,7 +3250,7 @@ novell_set_permit_deny(PurpleConnection *gc) return; } - switch (gc->account->perm_deny) { + switch (purple_account_get_privacy_type(purple_connection_get_account(gc))) { case PURPLE_PRIVACY_ALLOW_ALL: rc = nm_send_set_privacy_default(user, FALSE, @@ -3307,14 +3306,14 @@ novell_set_permit_deny(PurpleConnection *gc) if (user_record) { name = nm_user_record_get_display_id(user_record); - if (!g_slist_find_custom(gc->account->permit, + if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, name , TRUE); + purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE); } } } - for (node = gc->account->permit; node; node = node->next) { + for (node = purple_connection_get_account(gc)->permit; node; node = node->next) { name = NULL; dn = nm_lookup_dn(user, (char *)node->data); if (dn) { @@ -3328,7 +3327,7 @@ novell_set_permit_deny(PurpleConnection *gc) g_strdup(dn)); } } else { - purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } } } @@ -3349,14 +3348,14 @@ novell_set_permit_deny(PurpleConnection *gc) if (user_record) { name = nm_user_record_get_display_id(user_record); - if (!g_slist_find_custom(gc->account->deny, + if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, name , TRUE); + purple_privacy_deny_add(purple_connection_get_account(gc), name , TRUE); } } } - for (node = gc->account->deny; node; node = node->next) { + for (node = purple_connection_get_account(gc)->deny; node; node = node->next) { name = NULL; dn = nm_lookup_dn(user, (char *)node->data); @@ -3371,7 +3370,7 @@ novell_set_permit_deny(PurpleConnection *gc) g_strdup(name)); } } else { - purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); + purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); } } @@ -3463,7 +3462,7 @@ novell_keepalive(PurpleConnection *gc) if (gc == NULL) return; - user = gc->proto_data; + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3472,6 +3471,7 @@ novell_keepalive(PurpleConnection *gc) } static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ 0, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -3512,7 +3512,6 @@ static PurplePluginProtocolInfo prpl_info = { novell_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ novell_alias_buddy, /* alias_buddy */ novell_group_buddy, /* group_buddy */ novell_rename_group, /* rename_group */ @@ -3537,15 +3536,12 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = { diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c index 32b61f39c9..8516f728ab 100644 --- a/libpurple/protocols/null/nullprpl.c +++ b/libpurple/protocols/null/nullprpl.c @@ -113,7 +113,7 @@ static void call_if_nullprpl(gpointer data, gpointer userdata) { PurpleConnection *gc = (PurpleConnection *)(data); GcFuncData *gcfdata = (GcFuncData *)userdata; - if (!strcmp(gc->account->protocol_id, NULLPRPL_ID)) + if (!strcmp(purple_account_get_protocol_id(purple_connection_get_account(gc)), NULLPRPL_ID)) gcfdata->fn(gcfdata->from, gc, gcfdata->userdata); } @@ -138,11 +138,11 @@ static void call_chat_func(gpointer data, gpointer userdata) { PurpleConnection *to = (PurpleConnection *)data; ChatFuncData *cfdata = (ChatFuncData *)userdata; - int id = cfdata->from_chat->id; + int id = purple_conv_chat_get_id(cfdata->from_chat); PurpleConversation *conv = purple_find_chat(to, id); if (conv) { PurpleConvChat *chat = purple_conversation_get_chat_data(conv); - cfdata->fn(cfdata->from_chat, chat, id, conv->name, cfdata->userdata); + cfdata->fn(cfdata->from_chat, chat, id, purple_conversation_get_name(conv), cfdata->userdata); } } @@ -160,11 +160,11 @@ static void foreach_gc_in_chat(ChatFunc fn, PurpleConnection *from, static void discover_status(PurpleConnection *from, PurpleConnection *to, gpointer userdata) { - const char *from_username = from->account->username; - const char *to_username = to->account->username; + const char *from_username = purple_account_get_username(purple_connection_get_account(from)); + const char *to_username = purple_account_get_username(purple_connection_get_account(to)); - if (purple_find_buddy(from->account, to_username)) { - PurpleStatus *status = purple_account_get_active_status(to->account); + if (purple_find_buddy(purple_connection_get_account(from), to_username)) { + PurpleStatus *status = purple_account_get_active_status(purple_connection_get_account(to)); const char *status_id = purple_status_get_id(status); const char *message = purple_status_get_attr_string(status, "message"); @@ -173,7 +173,7 @@ static void discover_status(PurpleConnection *from, PurpleConnection *to, !strcmp(status_id, NULL_STATUS_OFFLINE)) { purple_debug_info("nullprpl", "%s sees that %s is %s: %s\n", from_username, to_username, status_id, message); - purple_prpl_got_user_status(from->account, to_username, status_id, + purple_prpl_got_user_status(purple_connection_get_account(from), to_username, status_id, (message) ? "message" : NULL, message, NULL); } else { purple_debug_error("nullprpl", @@ -186,7 +186,7 @@ static void discover_status(PurpleConnection *from, PurpleConnection *to, static void report_status_change(PurpleConnection *from, PurpleConnection *to, gpointer userdata) { purple_debug_info("nullprpl", "notifying %s that %s changed status\n", - to->account->username, from->account->username); + purple_account_get_username(purple_connection_get_account(to)), purple_account_get_username(purple_connection_get_account(from))); discover_status(to, from, NULL); } @@ -199,7 +199,7 @@ static void nullprpl_input_user_info(PurplePluginAction *action) PurpleConnection *gc = (PurpleConnection *)action->context; PurpleAccount *acct = purple_connection_get_account(gc); purple_debug_info("nullprpl", "showing 'Set User Info' dialog for %s\n", - acct->username); + purple_account_get_username(acct)); purple_account_request_change_user_info(acct); } @@ -225,7 +225,7 @@ static const char *nullprpl_list_icon(PurpleAccount *acct, PurpleBuddy *buddy) static char *nullprpl_status_text(PurpleBuddy *buddy) { purple_debug_info("nullprpl", "getting %s's status text for %s\n", - buddy->name, buddy->account->username); + buddy->name, purple_account_get_username(buddy->account)); if (purple_find_buddy(buddy->account, buddy->name)) { PurplePresence *presence = purple_buddy_get_presence(buddy); @@ -260,16 +260,16 @@ static void nullprpl_tooltip_text(PurpleBuddy *buddy, char *msg = nullprpl_status_text(buddy); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(info, purple_status_get_name(status), + purple_notify_user_info_add_pair_html(info, purple_status_get_name(status), msg); g_free(msg); if (full) { - const char *user_info = purple_account_get_user_info(gc->account); + const char *user_info = purple_account_get_user_info(purple_connection_get_account(gc)); if (user_info) /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(info, _("User info"), user_info); + purple_notify_user_info_add_pair_html(info, _("User info"), user_info); } } else { @@ -287,7 +287,7 @@ static GList *nullprpl_status_types(PurpleAccount *acct) PurpleStatusType *type; purple_debug_info("nullprpl", "returning status types for %s: %s, %s, %s\n", - acct->username, + purple_account_get_username(acct), NULL_STATUS_ONLINE, NULL_STATUS_AWAY, NULL_STATUS_OFFLINE); type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, @@ -366,7 +366,7 @@ static void nullprpl_login(PurpleAccount *acct) PurpleConnection *gc = purple_account_get_connection(acct); GList *offline_messages; - purple_debug_info("nullprpl", "logging in %s\n", acct->username); + purple_debug_info("nullprpl", "logging in %s\n", purple_account_get_username(acct)); purple_connection_update_progress(gc, _("Connecting"), 0, /* which connection step this is */ @@ -385,12 +385,12 @@ static void nullprpl_login(PurpleAccount *acct) /* fetch stored offline messages */ purple_debug_info("nullprpl", "checking for offline messages for %s\n", - acct->username); - offline_messages = g_hash_table_lookup(goffline_messages, acct->username); + purple_account_get_username(acct)); + offline_messages = g_hash_table_lookup(goffline_messages, purple_account_get_username(acct)); while (offline_messages) { GOfflineMessage *message = (GOfflineMessage *)offline_messages->data; purple_debug_info("nullprpl", "delivering offline message to %s: %s\n", - acct->username, message->message); + purple_account_get_username(acct), message->message); serv_got_im(gc, message->from, message->message, message->flags, message->mtime); offline_messages = g_list_next(offline_messages); @@ -401,7 +401,7 @@ static void nullprpl_login(PurpleAccount *acct) } g_list_free(offline_messages); - g_hash_table_remove(goffline_messages, &acct->username); + g_hash_table_remove(goffline_messages, purple_account_get_username(acct)); } static void nullprpl_close(PurpleConnection *gc) @@ -413,7 +413,7 @@ static void nullprpl_close(PurpleConnection *gc) static int nullprpl_send_im(PurpleConnection *gc, const char *who, const char *message, PurpleMessageFlags flags) { - const char *from_username = gc->account->username; + const char *from_username = purple_account_get_username(purple_connection_get_account(gc)); PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND) | PURPLE_MESSAGE_RECV); PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); @@ -423,13 +423,13 @@ static int nullprpl_send_im(PurpleConnection *gc, const char *who, from_username, who, message); /* is the sender blocked by the recipient's privacy settings? */ - if (to_acct && !purple_privacy_check(to_acct, gc->account->username)) { + if (to_acct && !purple_privacy_check(to_acct, purple_account_get_username(purple_connection_get_account(gc)))) { char *msg = g_strdup_printf( _("Your message was blocked by %s's privacy settings."), who); purple_debug_info("nullprpl", "discarding; %s is blocked by %s's privacy settings\n", from_username, who); - purple_conv_present_error(who, gc->account, msg); + purple_conv_present_error(who, purple_connection_get_account(gc), msg); g_free(msg); return 0; } @@ -461,7 +461,7 @@ static int nullprpl_send_im(PurpleConnection *gc, const char *who, static void nullprpl_set_info(PurpleConnection *gc, const char *info) { purple_debug_info("nullprpl", "setting %s's user info to %s\n", - gc->account->username, info); + purple_account_get_username(purple_connection_get_account(gc)), info); } static const char *typing_state_to_string(PurpleTypingState typing) { @@ -475,10 +475,10 @@ static const char *typing_state_to_string(PurpleTypingState typing) { static void notify_typing(PurpleConnection *from, PurpleConnection *to, gpointer typing) { - const char *from_username = from->account->username; + const char *from_username = purple_account_get_username(purple_connection_get_account(from)); const char *action = typing_state_to_string((PurpleTypingState)typing); purple_debug_info("nullprpl", "notifying %s that %s %s\n", - to->account->username, from_username, action); + purple_account_get_username(purple_connection_get_account(to)), from_username, action); serv_got_typing(to, from_username, @@ -489,7 +489,7 @@ static void notify_typing(PurpleConnection *from, PurpleConnection *to, static unsigned int nullprpl_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState typing) { - purple_debug_info("nullprpl", "%s %s\n", gc->account->username, + purple_debug_info("nullprpl", "%s %s\n", purple_account_get_username(purple_connection_get_account(gc)), typing_state_to_string(typing)); foreach_nullprpl_gc(notify_typing, gc, (gpointer)typing); return 0; @@ -501,7 +501,7 @@ static void nullprpl_get_info(PurpleConnection *gc, const char *username) { PurpleAccount *acct; purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username, - gc->account->username); + purple_account_get_username(purple_connection_get_account(gc))); if (!get_nullprpl_gc(username)) { char *msg = g_strdup_printf(_("%s is not logged in."), username); @@ -516,7 +516,7 @@ static void nullprpl_get_info(PurpleConnection *gc, const char *username) { body = _("No user info."); /* TODO: Check whether it's correct to call add_pair_html, or if we should be using add_pair_plaintext */ - purple_notify_user_info_add_pair(info, "Info", body); + purple_notify_user_info_add_pair_html(info, "Info", body); /* show a buddy's user info in a nice dialog box */ purple_notify_userinfo(gc, /* connection the buddy info came through */ @@ -529,35 +529,35 @@ static void nullprpl_get_info(PurpleConnection *gc, const char *username) { static void nullprpl_set_status(PurpleAccount *acct, PurpleStatus *status) { const char *msg = purple_status_get_attr_string(status, "message"); purple_debug_info("nullprpl", "setting %s's status to %s: %s\n", - acct->username, purple_status_get_name(status), msg); + purple_account_get_username(acct), purple_status_get_name(status), msg); - foreach_nullprpl_gc(report_status_change, get_nullprpl_gc(acct->username), + foreach_nullprpl_gc(report_status_change, get_nullprpl_gc(purple_account_get_username(acct)), NULL); } static void nullprpl_set_idle(PurpleConnection *gc, int idletime) { purple_debug_info("nullprpl", "purple reports that %s has been idle for %d seconds\n", - gc->account->username, idletime); + purple_account_get_username(purple_connection_get_account(gc)), idletime); } static void nullprpl_change_passwd(PurpleConnection *gc, const char *old_pass, const char *new_pass) { purple_debug_info("nullprpl", "%s wants to change their password\n", - gc->account->username); + purple_account_get_username(purple_connection_get_account(gc))); } static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) + PurpleGroup *group, const char *message) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(purple_connection_get_account(gc)); PurpleConnection *buddy_gc = get_nullprpl_gc(buddy->name); purple_debug_info("nullprpl", "adding %s to %s's buddy list\n", buddy->name, username); if (buddy_gc) { - PurpleAccount *buddy_acct = buddy_gc->account; + PurpleAccount *buddy_acct = purple_connection_get_account(buddy_gc); discover_status(gc, buddy_gc, NULL); @@ -571,20 +571,20 @@ static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, username, NULL, /* local account id (rarely used) */ NULL, /* alias */ - NULL); /* message */ + message); /* message */ } } } static void nullprpl_add_buddies(PurpleConnection *gc, GList *buddies, - GList *groups) { + GList *groups, const char *message) { GList *buddy = buddies; GList *group = groups; purple_debug_info("nullprpl", "adding multiple buddies\n"); while (buddy && group) { - nullprpl_add_buddy(gc, (PurpleBuddy *)buddy->data, (PurpleGroup *)group->data); + nullprpl_add_buddy(gc, (PurpleBuddy *)buddy->data, (PurpleGroup *)group->data, message); buddy = g_list_next(buddy); group = g_list_next(group); } @@ -594,7 +594,7 @@ static void nullprpl_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { purple_debug_info("nullprpl", "removing %s from %s's buddy list\n", - buddy->name, gc->account->username); + buddy->name, purple_account_get_username(purple_connection_get_account(gc))); } static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, @@ -620,22 +620,22 @@ static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, */ static void nullprpl_add_permit(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s adds %s to their allowed list\n", - gc->account->username, name); + purple_account_get_username(purple_connection_get_account(gc)), name); } static void nullprpl_add_deny(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s adds %s to their blocked list\n", - gc->account->username, name); + purple_account_get_username(purple_connection_get_account(gc)), name); } static void nullprpl_rem_permit(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s removes %s from their allowed list\n", - gc->account->username, name); + purple_account_get_username(purple_connection_get_account(gc)), name); } static void nullprpl_rem_deny(PurpleConnection *gc, const char *name) { purple_debug_info("nullprpl", "%s removes %s from their blocked list\n", - gc->account->username, name); + purple_account_get_username(purple_connection_get_account(gc)), name); } static void nullprpl_set_permit_deny(PurpleConnection *gc) { @@ -648,9 +648,9 @@ static void joined_chat(PurpleConvChat *from, PurpleConvChat *to, int id, const char *room, gpointer userdata) { /* tell their chat window that we joined */ purple_debug_info("nullprpl", "%s sees that %s joined chat room %s\n", - to->nick, from->nick, room); + purple_conv_chat_get_nick(to), purple_conv_chat_get_nick(from), room); purple_conv_chat_add_user(to, - from->nick, + purple_conv_chat_get_nick(from), NULL, /* user-provided join message, IRC style */ PURPLE_CBFLAGS_NONE, TRUE); /* show a join message */ @@ -658,9 +658,9 @@ static void joined_chat(PurpleConvChat *from, PurpleConvChat *to, if (from != to) { /* add them to our chat window */ purple_debug_info("nullprpl", "%s sees that %s is in chat room %s\n", - from->nick, to->nick, room); + purple_conv_chat_get_nick(from), purple_conv_chat_get_nick(to), room); purple_conv_chat_add_user(from, - to->nick, + purple_conv_chat_get_nick(to), NULL, /* user-provided join message, IRC style */ PURPLE_CBFLAGS_NONE, FALSE); /* show a join message */ @@ -668,7 +668,7 @@ static void joined_chat(PurpleConvChat *from, PurpleConvChat *to, } static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(purple_connection_get_account(gc)); const char *room = g_hash_table_lookup(components, "room"); int chat_id = g_str_hash(room); purple_debug_info("nullprpl", "%s is joining chat room %s\n", username, room); @@ -692,7 +692,7 @@ static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { static void nullprpl_reject_chat(PurpleConnection *gc, GHashTable *components) { const char *invited_by = g_hash_table_lookup(components, "invited_by"); const char *room = g_hash_table_lookup(components, "room"); - const char *username = gc->account->username; + const char *username = purple_account_get_username(purple_connection_get_account(gc)); PurpleConnection *invited_by_gc = get_nullprpl_gc(invited_by); char *message = g_strdup_printf( "%s %s %s.", @@ -719,9 +719,9 @@ static char *nullprpl_get_chat_name(GHashTable *components) { static void nullprpl_chat_invite(PurpleConnection *gc, int id, const char *message, const char *who) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(purple_connection_get_account(gc)); PurpleConversation *conv = purple_find_chat(gc, id); - const char *room = conv->name; + const char *room = purple_conversation_get_name(conv); PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); purple_debug_info("nullprpl", "%s is inviting %s to join chat room %s\n", @@ -752,9 +752,9 @@ static void left_chat_room(PurpleConvChat *from, PurpleConvChat *to, if (from != to) { /* tell their chat window that we left */ purple_debug_info("nullprpl", "%s sees that %s left chat room %s\n", - to->nick, from->nick, room); + purple_conv_chat_get_nick(to), purple_conv_chat_get_nick(from), room); purple_conv_chat_remove_user(to, - from->nick, + purple_conv_chat_get_nick(from), NULL); /* user-provided message, IRC style */ } } @@ -762,7 +762,7 @@ static void left_chat_room(PurpleConvChat *from, PurpleConvChat *to, static void nullprpl_chat_leave(PurpleConnection *gc, int id) { PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "%s is leaving chat room %s\n", - gc->account->username, conv->name); + purple_account_get_username(purple_connection_get_account(gc)), purple_conversation_get_name(conv)); /* tell everyone that we left */ foreach_gc_in_chat(left_chat_room, gc, id, NULL); @@ -789,9 +789,9 @@ static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, return PURPLE_CMD_RET_FAILED; } - from_username = conv->account->username; + from_username = purple_account_get_username(purple_conversation_get_account(conv)); purple_debug_info("nullprpl", "%s whispers to %s in chat room %s: %s\n", - from_username, to_username, conv->name, message); + from_username, to_username, purple_conversation_get_name(conv), message); chat = purple_conversation_get_chat_data(conv); chat_buddy = purple_conv_chat_cb_find(chat, to_username); @@ -813,7 +813,7 @@ static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, g_free(message_to); /* send the whisper */ - serv_chat_whisper(to, chat->id, from_username, message); + serv_chat_whisper(to, purple_conv_chat_get_id(chat), from_username, message); return PURPLE_CMD_RET_OK; } @@ -821,11 +821,11 @@ static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, const char *message) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(purple_connection_get_account(gc)); PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "%s receives whisper from %s in chat room %s: %s\n", - username, who, conv->name, message); + username, who, purple_conversation_get_name(conv), message); /* receive whisper on recipient's account */ serv_got_chat_in(gc, id, who, PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_WHISPER, @@ -835,24 +835,24 @@ static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, static void receive_chat_message(PurpleConvChat *from, PurpleConvChat *to, int id, const char *room, gpointer userdata) { const char *message = (const char *)userdata; - PurpleConnection *to_gc = get_nullprpl_gc(to->nick); + PurpleConnection *to_gc = get_nullprpl_gc(purple_conv_chat_get_nick(to)); purple_debug_info("nullprpl", "%s receives message from %s in chat room %s: %s\n", - to->nick, from->nick, room, message); - serv_got_chat_in(to_gc, id, from->nick, PURPLE_MESSAGE_RECV, message, + purple_conv_chat_get_nick(to), purple_conv_chat_get_nick(from), room, message); + serv_got_chat_in(to_gc, id, purple_conv_chat_get_nick(from), PURPLE_MESSAGE_RECV, message, time(NULL)); } static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) { - const char *username = gc->account->username; + const char *username = purple_account_get_username(purple_connection_get_account(gc)); PurpleConversation *conv = purple_find_chat(gc, id); if (conv) { purple_debug_info("nullprpl", "%s is sending message to chat room %s: %s\n", username, - conv->name, message); + purple_conversation_get_name(conv), message); /* send message to everyone in the chat room */ foreach_gc_in_chat(receive_chat_message, gc, id, (gpointer)message); @@ -868,14 +868,14 @@ static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, static void nullprpl_register_user(PurpleAccount *acct) { purple_debug_info("nullprpl", "registering account for %s\n", - acct->username); + purple_account_get_username(acct)); } static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) { PurpleConversation *conv = purple_find_chat(gc, id); purple_debug_info("nullprpl", "retrieving %s's info for %s in chat room %s\n", who, - gc->account->username, conv->name); + purple_account_get_username(purple_connection_get_account(gc)), purple_conversation_get_name(conv)); nullprpl_get_info(gc, who); } @@ -883,25 +883,25 @@ static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) static void nullprpl_alias_buddy(PurpleConnection *gc, const char *who, const char *alias) { purple_debug_info("nullprpl", "%s sets %s's alias to %s\n", - gc->account->username, who, alias); + purple_account_get_username(purple_connection_get_account(gc)), who, alias); } static void nullprpl_group_buddy(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group) { purple_debug_info("nullprpl", "%s has moved %s from group %s to group %s\n", - gc->account->username, who, old_group, new_group); + purple_account_get_username(purple_connection_get_account(gc)), who, old_group, new_group); } static void nullprpl_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) { purple_debug_info("nullprpl", "%s has renamed group %s to %s\n", - gc->account->username, old_name, group->name); + purple_account_get_username(purple_connection_get_account(gc)), old_name, group->name); } static void nullprpl_convo_closed(PurpleConnection *gc, const char *who) { purple_debug_info("nullprpl", "%s's conversation with %s was closed\n", - gc->account->username, who); + purple_account_get_username(purple_connection_get_account(gc)), who); } /* normalize a username (e.g. remove whitespace, add default domain, etc.) @@ -915,20 +915,20 @@ static const char *nullprpl_normalize(const PurpleAccount *acct, static void nullprpl_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) { purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n", - gc->account->username, + purple_account_get_username(purple_connection_get_account(gc)), img ? purple_imgstore_get_filename(img) : "(null)"); } static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { purple_debug_info("nullprpl", "%s has removed group %s\n", - gc->account->username, group->name); + purple_account_get_username(purple_connection_get_account(gc)), group->name); } static void set_chat_topic_fn(PurpleConvChat *from, PurpleConvChat *to, int id, const char *room, gpointer userdata) { const char *topic = (const char *)userdata; - const char *username = from->conv->account->username; + const char *username = purple_account_get_username(purple_conversation_get_account(purple_conv_chat_get_conversation(from))); char *msg; purple_conv_chat_set_topic(to, username, topic); @@ -954,7 +954,7 @@ static void nullprpl_set_chat_topic(PurpleConnection *gc, int id, return; purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", - gc->account->username, conv->name, topic); + purple_account_get_username(purple_connection_get_account(gc)), purple_conversation_get_name(conv), topic); last_topic = purple_conv_chat_get_topic(chat); if ((!topic && !last_topic) || @@ -970,8 +970,8 @@ static gboolean nullprpl_finish_get_roomlist(gpointer roomlist) { } static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { - const char *username = gc->account->username; - PurpleRoomlist *roomlist = purple_roomlist_new(gc->account); + const char *username = purple_account_get_username(purple_connection_get_account(gc)); + PurpleRoomlist *roomlist = purple_roomlist_new(purple_connection_get_account(gc)); GList *fields = NULL; PurpleRoomlistField *field; GList *chats; @@ -994,8 +994,8 @@ static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { for (chats = purple_get_chats(); chats; chats = g_list_next(chats)) { PurpleConversation *conv = (PurpleConversation *)chats->data; PurpleRoomlistRoom *room; - const char *name = conv->name; - int id = purple_conversation_get_chat_data(conv)->id; + const char *name = purple_conversation_get_name(conv); + int id = purple_conv_chat_get_id(purple_conversation_get_chat_data(conv)); /* have we already added this room? */ if (g_list_find_custom(seen_ids, name, (GCompareFunc)strcmp)) @@ -1019,14 +1019,17 @@ static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { } static void nullprpl_roomlist_cancel(PurpleRoomlist *list) { + PurpleAccount *account = purple_roomlist_get_account(list); purple_debug_info("nullprpl", "%s asked to cancel room list request\n", - list->account->username); + purple_account_get_username(account)); } static void nullprpl_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) { + PurpleAccount *account = purple_roomlist_get_account(list); purple_debug_info("nullprpl", "%s asked to expand room list category %s\n", - list->account->username, category->name); + purple_account_get_username(account), + purple_roomlist_room_get_name(category)); } /* nullprpl doesn't support file transfer...yet... */ @@ -1049,6 +1052,7 @@ static gboolean nullprpl_offline_message(const PurpleBuddy *buddy) { static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_NO_PASSWORD | OPT_PROTO_CHAT_TOPIC, /* options */ NULL, /* user_splits, initialized in nullprpl_init() */ NULL, /* protocol_options, initialized in nullprpl_init() */ @@ -1097,7 +1101,6 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* keepalive */ nullprpl_register_user, /* register_user */ nullprpl_get_cb_info, /* get_cb_info */ - NULL, /* get_cb_away */ nullprpl_alias_buddy, /* alias_buddy */ nullprpl_group_buddy, /* group_buddy */ nullprpl_rename_group, /* rename_group */ @@ -1122,15 +1125,12 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static void nullprpl_init(PurplePlugin *plugin) diff --git a/libpurple/protocols/oscar/clientlogin.c b/libpurple/protocols/oscar/clientlogin.c index a4ea3995ff..26ad4c67a8 100644 --- a/libpurple/protocols/oscar/clientlogin.c +++ b/libpurple/protocols/oscar/clientlogin.c @@ -384,7 +384,7 @@ static void send_start_oscar_session(OscarData *od, const char *token, const cha g_free(signature); /* Make the request */ - od->url_data = purple_util_fetch_url_request_len(account, + od->url_data = purple_util_fetch_url_request(account, url, TRUE, NULL, FALSE, NULL, FALSE, -1, start_oscar_session_cb, od); g_free(url); @@ -646,7 +646,7 @@ void send_client_login(OscarData *od, const char *username) g_string_free(body, TRUE); /* Send the POST request */ - od->url_data = purple_util_fetch_url_request_len( + od->url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), get_client_login_url(od), TRUE, NULL, FALSE, request->str, FALSE, -1, client_login_cb, od); diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c index 9f3cfca269..bf4bfd1e9a 100644 --- a/libpurple/protocols/oscar/family_feedbag.c +++ b/libpurple/protocols/oscar/family_feedbag.c @@ -661,7 +661,7 @@ static int aim_ssi_sync(OscarData *od) for (cur1 = od->ssi.local.data; cur1; cur1 = cur1->next) aim_ssi_item_debug_append(debugstr, "\t", cur1); purple_debug_misc("oscar", "Dumping item list of account %s:\n%s", - purple_connection_get_account(od->gc)->username, debugstr->str); + purple_account_get_username(purple_connection_get_account(od->gc)), debugstr->str); } } g_string_free(debugstr, TRUE); @@ -734,10 +734,37 @@ aim_ssi_freelist(OscarData *od) } /** - * This "cleans" the ssi list. It does the following: - * 1) Makes sure all buddies, permits, and denies have names. - * 2) Makes sure that all buddies are in a group that exist. - * 3) Deletes any empty groups + * Look up the given TLV type in the item's data. If the value of + * the TLV is not a valid UTF-8 string then use purple_utf8_salvage() + * to replace invalid bytes with question marks. + */ +static void cleanlist_ensure_utf8_data(struct aim_ssi_item *item, guint16 tlvtype) +{ + aim_tlv_t *tlv; + gchar *value, *salvaged; + + tlv = aim_tlv_gettlv(item->data, tlvtype, 1); + if (tlv && tlv->length && !g_utf8_validate((const gchar *)tlv->value, tlv->length, NULL)) { + purple_debug_warning("oscar", "cleanlist found invalid UTF-8 " + "for 0x%04hx field of 0x%04hx item with name %s. " + "Attempting to repair.\n", + tlvtype, item->type, item->name ? item->name : "(null)"); + value = g_strndup((const gchar *)tlv->value, tlv->length); + salvaged = purple_utf8_salvage(value); + g_free(value); + if (*salvaged) + aim_tlvlist_replace_str(&item->data, tlvtype, salvaged); + else + aim_tlvlist_remove(&item->data, tlvtype); + g_free(salvaged); + } +} + +/** + * This "cleans" the ssi list. It does things like: + * - Makes sure all buddies, permits, and denies have names + * - Makes sure all buddies are in a group that exist + * - Makes sure strings are valid UTF-8 * * @param od The oscar odion. * @return Return 0 if no errors, otherwise return the error number. @@ -764,27 +791,40 @@ int aim_ssi_cleanlist(OscarData *od) aim_ssi_del_from_private_list(od, NULL, cur->type); } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(&od->ssi.local, cur->gid, 0x0000)))) { char *alias = aim_ssi_getalias(&od->ssi.local, NULL, cur->name); - aim_ssi_addbuddy(od, cur->name, "orphans", NULL, alias, NULL, NULL, FALSE); + aim_ssi_addbuddy(od, cur->name, _("Buddies"), NULL, alias, NULL, NULL, FALSE); aim_ssi_delbuddy(od, cur->name, NULL); g_free(alias); } cur = next; } - /* Make sure there aren't any duplicate buddies in a group, or duplicate permits or denies */ cur = od->ssi.local.data; while (cur) { if ((cur->type == AIM_SSI_TYPE_BUDDY) || (cur->type == AIM_SSI_TYPE_PERMIT) || (cur->type == AIM_SSI_TYPE_DENY)) { struct aim_ssi_item *cur2, *next2; + + /* Make sure there aren't any duplicate permits or denies, or + duplicate buddies within a group */ cur2 = cur->next; while (cur2) { next2 = cur2->next; - if ((cur->type == cur2->type) && (cur->gid == cur2->gid) && (cur->name != NULL) && (cur2->name != NULL) && (!oscar_util_name_compare(cur->name, cur2->name))) { + if (cur->type == cur2->type + && cur->gid == cur2->gid + && cur->name + && cur2->name + && !oscar_util_name_compare(cur->name, cur2->name)) + { aim_ssi_itemlist_del(&od->ssi.local, cur2); } cur2 = next2; } + + /* Make sure alias is valid UTF-8 */ + cleanlist_ensure_utf8_data(cur, 0x0131); + + /* Make sure comment is valid UTF-8 */ + cleanlist_ensure_utf8_data(cur, 0x013c); } cur = cur->next; } @@ -1284,7 +1324,7 @@ static int parsedata(OscarData *od, FlapConnection *conn, aim_module_t *mod, Fla aim_tlvlist_free(data); } purple_debug_misc("oscar", "Reading items from tlvlist for account %s:\n%s", - purple_connection_get_account(od->gc)->username, debugstr->str); + purple_account_get_username(purple_connection_get_account(od->gc)), debugstr->str); g_string_free(debugstr, TRUE); /* Read in the timestamp */ @@ -1674,18 +1714,35 @@ static int receiveauthgrant(OscarData *od, FlapConnection *conn, aim_module_t *m int ret = 0; aim_rxcallback_t userfunc; guint16 tmp; - char *bn, *msg; + char *bn, *msg, *tmpstr; /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; + tmp = byte_stream_get8(bs); + if (!tmp) { + purple_debug_warning("oscar", "Dropping auth grant SNAC " + "because username was empty\n"); + return 0; + } + bn = byte_stream_getstr(bs, tmp); + if (!g_utf8_validate(bn, -1, NULL)) { + purple_debug_warning("oscar", "Dropping auth grant SNAC " + "because the username was not valid UTF-8\n"); + g_free(bn); + } - /* Read message (null terminated) */ - if ((tmp = byte_stream_get16(bs))) + /* Read message */ + tmp = byte_stream_get16(bs); + if (tmp) { msg = byte_stream_getstr(bs, tmp); - else + if (!g_utf8_validate(msg, -1, NULL)) { + /* Ugh, msg isn't UTF8. Let's salvage. */ + purple_debug_warning("oscar", "Got non-UTF8 message in auth " + "grant from %s\n", bn); + tmpstr = purple_utf8_salvage(msg); + g_free(msg); + msg = tmpstr; + } + } else msg = NULL; /* Unknown */ @@ -1748,18 +1805,35 @@ static int receiveauthrequest(OscarData *od, FlapConnection *conn, aim_module_t int ret = 0; aim_rxcallback_t userfunc; guint16 tmp; - char *bn, *msg; + char *bn, *msg, *tmpstr; /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; + tmp = byte_stream_get8(bs); + if (!tmp) { + purple_debug_warning("oscar", "Dropping auth request SNAC " + "because username was empty\n"); + return 0; + } + bn = byte_stream_getstr(bs, tmp); + if (!g_utf8_validate(bn, -1, NULL)) { + purple_debug_warning("oscar", "Dropping auth request SNAC " + "because the username was not valid UTF-8\n"); + g_free(bn); + } - /* Read message (null terminated) */ - if ((tmp = byte_stream_get16(bs))) + /* Read message */ + tmp = byte_stream_get16(bs); + if (tmp) { msg = byte_stream_getstr(bs, tmp); - else + if (!g_utf8_validate(msg, -1, NULL)) { + /* Ugh, msg isn't UTF8. Let's salvage. */ + purple_debug_warning("oscar", "Got non-UTF8 message in auth " + "request from %s\n", bn); + tmpstr = purple_utf8_salvage(msg); + g_free(msg); + msg = tmpstr; + } + } else msg = NULL; /* Unknown */ @@ -1832,21 +1906,38 @@ static int receiveauthreply(OscarData *od, FlapConnection *conn, aim_module_t *m aim_rxcallback_t userfunc; guint16 tmp; guint8 reply; - char *bn, *msg; + char *bn, *msg, *tmpstr; /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; + tmp = byte_stream_get8(bs); + if (!tmp) { + purple_debug_warning("oscar", "Dropping auth reply SNAC " + "because username was empty\n"); + return 0; + } + bn = byte_stream_getstr(bs, tmp); + if (!g_utf8_validate(bn, -1, NULL)) { + purple_debug_warning("oscar", "Dropping auth reply SNAC " + "because the username was not valid UTF-8\n"); + g_free(bn); + } /* Read reply */ reply = byte_stream_get8(bs); - /* Read message (null terminated) */ - if ((tmp = byte_stream_get16(bs))) + /* Read message */ + tmp = byte_stream_get16(bs); + if (tmp) { msg = byte_stream_getstr(bs, tmp); - else + if (!g_utf8_validate(msg, -1, NULL)) { + /* Ugh, msg isn't UTF8. Let's salvage. */ + purple_debug_warning("oscar", "Got non-UTF8 message in auth " + "reply from %s\n", bn); + tmpstr = purple_utf8_salvage(msg); + g_free(msg); + msg = tmpstr; + } + } else msg = NULL; /* Unknown */ @@ -1872,10 +1963,18 @@ static int receiveadded(OscarData *od, FlapConnection *conn, aim_module_t *mod, char *bn; /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; + tmp = byte_stream_get8(bs); + if (!tmp) { + purple_debug_warning("oscar", "Dropping 'you were added' SNAC " + "because username was empty\n"); + return 0; + } + bn = byte_stream_getstr(bs, tmp); + if (!g_utf8_validate(bn, -1, NULL)) { + purple_debug_warning("oscar", "Dropping 'you were added' SNAC " + "because the username was not valid UTF-8\n"); + g_free(bn); + } if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) ret = userfunc(od, conn, frame, bn); diff --git a/libpurple/protocols/oscar/family_icbm.c b/libpurple/protocols/oscar/family_icbm.c index 2b5a629143..4f748c2679 100644 --- a/libpurple/protocols/oscar/family_icbm.c +++ b/libpurple/protocols/oscar/family_icbm.c @@ -1941,7 +1941,7 @@ int icq_im_xstatus_request(OscarData *od, const char *sn) account = purple_connection_get_account(od->gc); - statxml = g_strdup_printf(fmt, account->username); + statxml = g_strdup_printf(fmt, purple_account_get_username(account)); xmllen = strlen(statxml); aim_icbm_makecookie(cookie); @@ -2035,7 +2035,7 @@ int icq_relay_xstatus(OscarData *od, const char *sn, const guchar *cookie) /* if (!strcmp(account->username, sn)) icq_im_xstatus_request(od, sn); */ - status = purple_presence_get_active_status(account->presence); + status = purple_presence_get_active_status(purple_account_get_presence(account)); if (!status) return -EINVAL; @@ -2051,7 +2051,7 @@ int icq_relay_xstatus(OscarData *od, const char *sn, const guchar *cookie) if (!msg) return -EINVAL; - statxml = g_strdup_printf(fmt, account->username, title, msg); + statxml = g_strdup_printf(fmt, purple_account_get_username(account), title, msg); len = strlen(statxml); purple_debug_misc("oscar", "X-Status AutoReply: %s, %s\n", formatted_msg, msg); diff --git a/libpurple/protocols/oscar/flap_connection.c b/libpurple/protocols/oscar/flap_connection.c index c28a20f28c..a7441c69ed 100644 --- a/libpurple/protocols/oscar/flap_connection.c +++ b/libpurple/protocols/oscar/flap_connection.c @@ -456,7 +456,7 @@ flap_connection_destroy_cb(gpointer data) * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then * we should try to request one instead of disconnecting. */ - if (!account->disconnecting && ((od->oscar_connections == NULL) + if (!purple_account_is_disconnecting(account) && ((od->oscar_connections == NULL) || (!flap_connection_getbytype(od, SNAC_FAMILY_LOCATE)))) { /* No more FLAP connections! Sign off this PurpleConnection! */ @@ -921,7 +921,7 @@ flap_connection_recv(FlapConnection *conn) OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); break; } - conn->od->gc->last_received = time(NULL); + purple_connection_update_last_received(conn->od->gc); /* If we don't even have a complete FLAP header then do nothing */ conn->header_received += read; diff --git a/libpurple/protocols/oscar/libaim.c b/libpurple/protocols/oscar/libaim.c index 0a169e9534..86d280da46 100644 --- a/libpurple/protocols/oscar/libaim.c +++ b/libpurple/protocols/oscar/libaim.c @@ -29,6 +29,7 @@ static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -50,7 +51,7 @@ static PurplePluginProtocolInfo prpl_info = oscar_set_status, /* set_status */ oscar_set_idle, /* set_idle */ oscar_change_passwd, /* change_passwd */ - NULL, /* add_buddy */ + oscar_add_buddy, /* add_buddy */ NULL, /* add_buddies */ oscar_remove_buddy, /* remove_buddy */ NULL, /* remove_buddies */ @@ -69,7 +70,6 @@ static PurplePluginProtocolInfo prpl_info = oscar_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ oscar_alias_buddy, /* alias_buddy */ oscar_move_buddy, /* group_buddy */ oscar_rename_group, /* rename_group */ @@ -94,15 +94,12 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - oscar_add_buddy, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/oscar/libicq.c b/libpurple/protocols/oscar/libicq.c index 18f5451e59..238ee06c6f 100644 --- a/libpurple/protocols/oscar/libicq.c +++ b/libpurple/protocols/oscar/libicq.c @@ -38,6 +38,7 @@ icq_get_account_text_table(PurpleAccount *account) static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -59,7 +60,7 @@ static PurplePluginProtocolInfo prpl_info = oscar_set_status, /* set_status */ oscar_set_idle, /* set_idle */ oscar_change_passwd, /* change_passwd */ - NULL, /* add_buddy */ + oscar_add_buddy, /* add_buddy */ NULL, /* add_buddies */ oscar_remove_buddy, /* remove_buddy */ NULL, /* remove_buddies */ @@ -78,7 +79,6 @@ static PurplePluginProtocolInfo prpl_info = oscar_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ oscar_alias_buddy, /* alias_buddy */ oscar_move_buddy, /* group_buddy */ oscar_rename_group, /* rename_group */ @@ -103,16 +103,12 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - - sizeof(PurplePluginProtocolInfo), /* struct_size */ icq_get_account_text_table, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* can_do_media */ oscar_get_purple_moods, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - oscar_add_buddy, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/oscar/oft.c b/libpurple/protocols/oscar/oft.c index 2b99ae4212..49cbcb06da 100644 --- a/libpurple/protocols/oscar/oft.c +++ b/libpurple/protocols/oscar/oft.c @@ -362,10 +362,10 @@ start_transfer_when_done_sending_data(gpointer data) if (purple_circ_buffer_get_max_read(conn->buffer_outgoing) == 0) { + int fd = conn->fd; conn->sending_data_timer = 0; - conn->xfer->fd = conn->fd; conn->fd = -1; - purple_xfer_start(conn->xfer, conn->xfer->fd, NULL, 0); + purple_xfer_start(conn->xfer, fd, NULL, 0); return FALSE; } @@ -508,7 +508,7 @@ peer_oft_recv_frame_done(PeerConnection *conn, OftFrame *frame) purple_input_remove(conn->watcher_incoming); conn->watcher_incoming = 0; - conn->xfer->fd = conn->fd; + purple_xfer_set_fd(conn->xfer, conn->fd); conn->fd = -1; conn->disconnect_reason = OSCAR_DISCONNECT_DONE; peer_connection_schedule_destroy(conn, conn->disconnect_reason, NULL); @@ -589,7 +589,7 @@ peer_oft_recvcb_init(PurpleXfer *xfer) { PeerConnection *conn; - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); conn->flags |= PEER_CONNECTION_FLAG_APPROVED; peer_connection_trynext(conn); } @@ -599,11 +599,11 @@ peer_oft_recvcb_end(PurpleXfer *xfer) { PeerConnection *conn; - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); /* Tell the other person that we've received everything */ - conn->fd = conn->xfer->fd; - conn->xfer->fd = -1; + conn->fd = purple_xfer_get_fd(conn->xfer); + purple_xfer_set_fd(conn->xfer, -1); peer_oft_send_done(conn); conn->disconnect_reason = OSCAR_DISCONNECT_DONE; @@ -617,7 +617,7 @@ peer_oft_recvcb_ack_recv(PurpleXfer *xfer, const guchar *buffer, size_t size) PeerConnection *conn; /* Update our rolling checksum. Like Walmart, yo. */ - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); conn->xferdata.recvcsum = peer_oft_checksum_chunk(buffer, size, conn->xferdata.recvcsum, purple_xfer_get_bytes_sent(xfer) & 1); } @@ -651,9 +651,9 @@ void peer_oft_sendcb_init(PurpleXfer *xfer) { PeerConnection *conn; - size_t size; + goffset size; - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); conn->flags |= PEER_CONNECTION_FLAG_APPROVED; /* Make sure the file size can be represented in 32 bits */ @@ -665,9 +665,9 @@ peer_oft_sendcb_init(PurpleXfer *xfer) size2 = purple_str_size_to_units(G_MAXUINT32); tmp = g_strdup_printf(_("File %s is %s, which is larger than " "the maximum size of %s."), - xfer->local_filename, size1, size2); + purple_xfer_get_local_filename(xfer), size1, size2); purple_xfer_error(purple_xfer_get_type(xfer), - purple_xfer_get_account(xfer), xfer->who, tmp); + purple_xfer_get_account(xfer), purple_xfer_get_remote_user(xfer), tmp); g_free(size1); g_free(size2); g_free(tmp); @@ -689,9 +689,9 @@ peer_oft_sendcb_init(PurpleXfer *xfer) strncpy((gchar *)conn->xferdata.idstring, "Cool FileXfer", 31); conn->xferdata.modtime = 0; conn->xferdata.cretime = 0; - xfer->filename = g_path_get_basename(xfer->local_filename); - conn->xferdata.name_length = MAX(64, strlen(xfer->filename) + 1); - conn->xferdata.name = (guchar *)g_strndup(xfer->filename, conn->xferdata.name_length - 1); + purple_xfer_set_filename(xfer, g_path_get_basename(purple_xfer_get_local_filename(xfer))); + conn->xferdata.name_length = MAX(64, strlen(purple_xfer_get_filename(xfer)) + 1); + conn->xferdata.name = (guchar *)g_strndup(purple_xfer_get_filename(xfer), conn->xferdata.name_length - 1); peer_oft_checksum_file(conn, xfer, peer_oft_checksum_calculated_cb, G_MAXUINT32); @@ -713,7 +713,7 @@ peer_oft_sendcb_ack(PurpleXfer *xfer, const guchar *buffer, size_t size) { PeerConnection *conn; - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); /* * If we're done sending, intercept the socket from the core ft code @@ -721,9 +721,9 @@ peer_oft_sendcb_ack(PurpleXfer *xfer, const guchar *buffer, size_t size) */ if (purple_xfer_get_bytes_remaining(xfer) <= 0) { - purple_input_remove(xfer->watcher); - conn->fd = xfer->fd; - xfer->fd = -1; + purple_input_remove(purple_xfer_get_watcher(xfer)); + conn->fd = purple_xfer_get_fd(xfer); + purple_xfer_set_fd(xfer, -1); conn->watcher_incoming = purple_input_add(conn->fd, PURPLE_INPUT_READ, peer_connection_recv_cb, conn); } @@ -742,7 +742,7 @@ peer_oft_cb_generic_cancel(PurpleXfer *xfer) { PeerConnection *conn; - conn = xfer->data; + conn = purple_xfer_get_protocol_data(xfer); if (conn == NULL) return; diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 33bded25a0..96b0c71384 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -655,6 +655,7 @@ oscar_login(PurpleAccount *account) GList *sorted_handlers; GList *cur; GString *msg = g_string_new(""); + PurpleConnectionFlags flags; gc = purple_account_get_connection(account); od = oscar_data_new(); @@ -740,17 +741,19 @@ oscar_login(PurpleAccount *account) return; } - gc->flags |= PURPLE_CONNECTION_HTML; + flags = PURPLE_CONNECTION_HTML; if (g_str_equal(purple_account_get_protocol_id(account), "prpl-icq")) { od->icq = TRUE; } else { - gc->flags |= PURPLE_CONNECTION_AUTO_RESP; + flags |= PURPLE_CONNECTION_AUTO_RESP; } /* Set this flag based on the protocol_id rather than the username, because that is what's tied to the get_moods prpl callback. */ if (g_str_equal(purple_account_get_protocol_id(account), "prpl-icq")) - gc->flags |= PURPLE_CONNECTION_SUPPORT_MOODS; + flags |= PURPLE_CONNECTION_SUPPORT_MOODS; + + purple_connection_set_flags(gc, flags); od->default_port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT); @@ -1000,7 +1003,7 @@ static int purple_memrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, pos->len = len; pos->modname = g_strdup(modname); - if (purple_proxy_connect(pos->gc, pos->gc->account, "pidgin.im", 80, + if (purple_proxy_connect(pos->gc, purple_connection_get_account(pos->gc), "pidgin.im", 80, straight_to_hell, pos) == NULL) { char buf[256]; @@ -1547,7 +1550,7 @@ static int purple_parse_offgoing(OscarData *od, FlapConnection *conn, FlapFrame purple_prpl_got_user_status(account, info->bn, OSCAR_STATUS_ID_OFFLINE, NULL); purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE); - g_hash_table_remove(od->buddyinfo, purple_normalize(gc->account, info->bn)); + g_hash_table_remove(od->buddyinfo, purple_normalize(purple_connection_get_account(gc), info->bn)); return 1; } @@ -2816,7 +2819,7 @@ static int purple_parse_locaterights(OscarData *od, FlapConnection *conn, FlapFr od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; aim_locate_setcaps(od, purple_caps); - oscar_set_info_and_status(account, TRUE, account->user_info, TRUE, + oscar_set_info_and_status(account, TRUE, purple_account_get_user_info(account), TRUE, purple_account_get_active_status(account)); return 1; @@ -3176,9 +3179,9 @@ oscar_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState stat else { /* Don't send if this turkey is in our deny list */ GSList *list; - for (list=gc->account->deny; (list && oscar_util_name_compare(name, list->data)); list=list->next); + for (list=purple_connection_get_account(gc)->deny; (list && oscar_util_name_compare(name, list->data)); list=list->next); if (!list) { - struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(gc->account, name)); + struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(purple_connection_get_account(gc), name)); if (bi && bi->typingnot) { if (state == PURPLE_TYPING) aim_im_sendmtn(od, 0x0001, name, 0x0002); @@ -3478,13 +3481,11 @@ oscar_set_info(PurpleConnection *gc, const char *rawinfo) static guint32 oscar_get_extended_status(PurpleConnection *gc) { - OscarData *od; PurpleAccount *account; PurpleStatus *status; const gchar *status_id; guint32 data = 0x00000000; - od = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); status = purple_account_get_active_status(account); status_id = purple_status_get_id(status); @@ -3806,7 +3807,7 @@ void oscar_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup } purple_account_remove_buddies(account, moved_buddies, groups); - purple_account_add_buddies(account, moved_buddies); + purple_account_add_buddies(account, moved_buddies, NULL); g_list_free(groups); purple_debug_info("oscar", "ssi: moved all buddies from group %s to %s\n", old_name, gname); @@ -4032,9 +4033,9 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * gname = groupitem ? groupitem->name : NULL; gname_utf8 = oscar_utf8_try_convert(account, od, gname); - g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")); + g = purple_find_group(gname_utf8 ? gname_utf8 : _("Buddies")); if (g == NULL) { - g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); + g = purple_group_new(gname_utf8 ? gname_utf8 : _("Buddies")); purple_blist_add_group(g, NULL); } @@ -4108,11 +4109,11 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * */ if (!od->icq && curitem->data) { guint8 perm_deny = aim_ssi_getpermdeny(&od->ssi.local); - if (perm_deny != 0 && perm_deny != account->perm_deny) + if (perm_deny != 0 && perm_deny != purple_account_get_privacy_type(account)) { purple_debug_info("oscar", - "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, perm_deny); - account->perm_deny = perm_deny; + "ssi: changing permdeny from %d to %hhu\n", purple_account_get_privacy_type(account), perm_deny); + purple_account_set_privacy_type(account, perm_deny); } } } break; @@ -4258,13 +4259,13 @@ purple_ssi_parseaddmod(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) */ b = purple_buddy_new(account, name, alias_utf8); - if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { - g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); + if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Buddies")))) { + g = purple_group_new(gname_utf8 ? gname_utf8 : _("Buddies")); purple_blist_add_group(g, NULL); } purple_debug_info("oscar", - "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); + "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Buddies")); purple_blist_add_buddy(b, NULL, g, NULL); /* Mobile users should always be online */ @@ -4616,7 +4617,6 @@ const char *oscar_list_emblem(PurpleBuddy *b) PurpleAccount *account = NULL; PurplePresence *presence; PurpleStatus *status; - const char *status_id; aim_userinfo_t *userinfo = NULL; const char *name; @@ -4631,7 +4631,6 @@ const char *oscar_list_emblem(PurpleBuddy *b) presence = purple_buddy_get_presence(b); status = purple_presence_get_active_status(presence); - status_id = purple_status_get_id(status); if (purple_presence_is_online(presence) == FALSE) { char *gname; @@ -4690,7 +4689,6 @@ char *oscar_status_text(PurpleBuddy *b) OscarData *od; const PurplePresence *presence; const PurpleStatus *status; - const char *id; const char *message; gchar *ret = NULL; @@ -4699,7 +4697,6 @@ char *oscar_status_text(PurpleBuddy *b) od = purple_connection_get_protocol_data(gc); presence = purple_buddy_get_presence(b); status = purple_presence_get_active_status(presence); - id = purple_status_get_id(status); if ((od != NULL) && !purple_presence_is_online(presence)) { @@ -4741,7 +4738,7 @@ void oscar_set_aim_permdeny(PurpleConnection *gc) { * values of libpurple's PurplePrivacyType and the values used * by the oscar protocol. */ - aim_ssi_setpermdeny(od, account->perm_deny); + aim_ssi_setpermdeny(od, purple_account_get_privacy_type(account)); } void oscar_add_permit(PurpleConnection *gc, const char *who) { @@ -5040,7 +5037,7 @@ oscar_close_directim(gpointer object, gpointer ignored) name = purple_buddy_get_name(buddy); account = purple_buddy_get_account(buddy); gc = purple_account_get_connection(account); - od = gc->proto_data; + od = purple_connection_get_protocol_data(gc); conn = peer_connection_find_by_type(od, name, OSCAR_CAPABILITY_DIRECTIM); if (conn != NULL) @@ -5476,7 +5473,7 @@ oscar_new_xfer(PurpleConnection *gc, const char *who) conn->flags |= PEER_CONNECTION_FLAG_APPROVED; aim_icbm_makecookie(conn->cookie); conn->xfer = xfer; - xfer->data = conn; + purple_xfer_set_protocol_data(xfer, conn); } return xfer; diff --git a/libpurple/protocols/oscar/peer.c b/libpurple/protocols/oscar/peer.c index 2a17d21e06..36cd573fda 100644 --- a/libpurple/protocols/oscar/peer.c +++ b/libpurple/protocols/oscar/peer.c @@ -212,7 +212,7 @@ peer_connection_destroy_cb(gpointer data) if (conn->xfer != NULL) { PurpleXferStatusType status; - conn->xfer->data = NULL; + purple_xfer_set_protocol_data(conn->xfer, NULL); status = purple_xfer_get_status(conn->xfer); if ((status != PURPLE_XFER_STATUS_DONE) && (status != PURPLE_XFER_STATUS_CANCEL_LOCAL) && @@ -603,15 +603,11 @@ void peer_connection_listen_cb(gpointer data, gint source, PurpleInputCondition cond) { PeerConnection *conn; - OscarData *od; - PurpleConnection *gc; struct sockaddr addr; socklen_t addrlen = sizeof(addr); int flags; conn = data; - od = conn->od; - gc = od->gc; purple_debug_info("oscar", "Accepting connection on listener socket.\n"); @@ -842,7 +838,7 @@ peer_connection_trynext(PeerConnection *conn) */ conn->flags |= PEER_CONNECTION_FLAG_IS_INCOMING; - conn->listen_data = purple_network_listen_range(5190, 5290, SOCK_STREAM, + conn->listen_data = purple_network_listen_range(5190, 5290, AF_UNSPEC, SOCK_STREAM, TRUE, peer_connection_establish_listener_cb, conn); if (conn->listen_data != NULL) { @@ -1072,7 +1068,7 @@ peer_connection_got_proposition(OscarData *od, const gchar *bn, const gchar *mes conn->xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE, bn); if (conn->xfer) { - conn->xfer->data = conn; + purple_xfer_set_protocol_data(conn->xfer, conn); purple_xfer_ref(conn->xfer); purple_xfer_set_size(conn->xfer, args->info.sendfile.totsize); diff --git a/libpurple/protocols/oscar/userinfo.c b/libpurple/protocols/oscar/userinfo.c index 73f685cf3e..60e96af75c 100644 --- a/libpurple/protocols/oscar/userinfo.c +++ b/libpurple/protocols/oscar/userinfo.c @@ -307,8 +307,6 @@ oscar_user_info_append_extra_info(PurpleConnection *gc, PurpleNotifyUserInfo *us { OscarData *od; PurpleAccount *account; - PurplePresence *presence = NULL; - PurpleStatus *status = NULL; PurpleGroup *g = NULL; struct buddyinfo *bi = NULL; char *tmp; @@ -330,8 +328,6 @@ oscar_user_info_append_extra_info(PurpleConnection *gc, PurpleNotifyUserInfo *us bname = purple_buddy_get_name(b); g = purple_buddy_get_group(b); gname = purple_group_get_name(g); - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); } if (userinfo != NULL) diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index c501dd0a6f..8d1841ebe3 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -171,10 +171,10 @@ enum blist_choice { /* debugging output */ -#define DEBUG_ERROR(a...) purple_debug_error(G_LOG_DOMAIN, a) -#define DEBUG_INFO(a...) purple_debug_info(G_LOG_DOMAIN, a) -#define DEBUG_MISC(a...) purple_debug_misc(G_LOG_DOMAIN, a) -#define DEBUG_WARN(a...) purple_debug_warning(G_LOG_DOMAIN, a) +#define DEBUG_ERROR(...) purple_debug_error(G_LOG_DOMAIN, __VA_ARGS__) +#define DEBUG_INFO(...) purple_debug_info(G_LOG_DOMAIN, __VA_ARGS__) +#define DEBUG_MISC(...) purple_debug_misc(G_LOG_DOMAIN, __VA_ARGS__) +#define DEBUG_WARN(...) purple_debug_warning(G_LOG_DOMAIN, __VA_ARGS__) /** ensure non-null strings */ @@ -197,7 +197,7 @@ static guint log_handler[2] = { 0, 0 }; /** the purple plugin data. - available as gc->proto_data and mwSession_getClientData */ + available as purple_connection_get_protocol_data(gc) and mwSession_getClientData */ struct mwPurplePluginData { struct mwSession *session; @@ -217,6 +217,7 @@ struct mwPurplePluginData { /** socket fd */ int socket; + guint inpa; /* input watcher */ gint outpa; /* like inpa, but the other way */ /** circular buffer for outgoing data */ @@ -320,7 +321,7 @@ static struct mwSession *gc_to_session(PurpleConnection *gc) { g_return_val_if_fail(gc != NULL, NULL); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_val_if_fail(pd != NULL, NULL); return pd->session; @@ -449,9 +450,9 @@ static void mw_session_io_close(struct mwSession *session) { pd->socket = 0; } - if(gc->inpa) { - purple_input_remove(gc->inpa); - gc->inpa = 0; + if(pd->inpa) { + purple_input_remove(pd->inpa); + pd->inpa = 0; } } @@ -499,7 +500,7 @@ static void mw_aware_list_on_aware(struct mwAwareList *list, gc = mwAwareList_getClientData(list); acct = purple_connection_get_account(gc); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); idle = aware->status.time; stat = aware->status.status; id = aware->id.user; @@ -851,7 +852,7 @@ static void buddy_add(struct mwPurplePluginData *pd, static PurpleBuddy *buddy_ensure(PurpleConnection *gc, PurpleGroup *group, struct mwSametimeUser *stuser) { - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); PurpleBuddy *buddy; PurpleAccount *acct = purple_connection_get_account(gc); @@ -927,6 +928,11 @@ static PurpleGroup *group_ensure(PurpleConnection *gc, return NULL; } + if (!name) { + DEBUG_WARN("Can't ensure a null group\n"); + return NULL; + } + DEBUG_INFO("attempting to ensure group %s, called %s\n", NSTR(name), NSTR(alias)); @@ -968,7 +974,7 @@ static PurpleGroup *group_ensure(PurpleConnection *gc, if(type == mwSametimeGroup_DYNAMIC) { purple_blist_node_set_string(gn, GROUP_KEY_OWNER, owner); - group_add(gc->proto_data, group); + group_add(purple_connection_get_protocol_data(gc), group); } return group; @@ -1274,7 +1280,7 @@ static void conversation_created_cb(PurpleConversation *g_conv, struct mwIdBlock who = { 0, 0 }; struct mwConversation *conv; - gc = purple_conversation_get_gc(g_conv); + gc = purple_conversation_get_connection(g_conv); if(pd->gc != gc) return; /* not ours */ @@ -1398,7 +1404,7 @@ static void blist_init(PurpleAccount *acct) { } if(add_buds) { - purple_account_add_buddies(acct, add_buds); + purple_account_add_buddies(acct, add_buds, NULL); g_list_free(add_buds); } } @@ -1755,9 +1761,9 @@ static void read_cb(gpointer data, gint source, PurpleInputCondition cond) { pd->socket = 0; } - if(pd->gc->inpa) { - purple_input_remove(pd->gc->inpa); - pd->gc->inpa = 0; + if(pd->inpa) { + purple_input_remove(pd->inpa); + pd->inpa = 0; } if(! ret) { @@ -1786,7 +1792,6 @@ static void read_cb(gpointer data, gint source, PurpleInputCondition cond) { static void connect_cb(gpointer data, gint source, const gchar *error_message) { struct mwPurplePluginData *pd = data; - PurpleConnection *gc = pd->gc; if(source < 0) { /* connection failed */ @@ -1814,7 +1819,7 @@ static void connect_cb(gpointer data, gint source, const gchar *error_message) { } pd->socket = source; - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, + pd->inpa = purple_input_add(source, PURPLE_INPUT_READ, read_cb, pd); mwSession_start(pd->session); @@ -2139,7 +2144,7 @@ static struct mwServiceConference *mw_srvc_conf_new(struct mwSession *s) { static void ft_incoming_cancel(PurpleXfer *xfer) { /* incoming transfer rejected or cancelled in-progress */ - struct mwFileTransfer *ft = xfer->data; + struct mwFileTransfer *ft = purple_xfer_get_protocol_data(xfer); if(ft) mwFileTransfer_reject(ft); } @@ -2155,9 +2160,9 @@ static void ft_incoming_init(PurpleXfer *xfer) { struct mwFileTransfer *ft; FILE *fp; - ft = xfer->data; + ft = purple_xfer_get_protocol_data(xfer); - fp = g_fopen(xfer->local_filename, "wb"); + fp = g_fopen(purple_xfer_get_local_filename(xfer), "wb"); if(! fp) { mwFileTransfer_cancel(ft); return; @@ -2202,7 +2207,7 @@ static void mw_ft_offered(struct mwFileTransfer *ft) { { purple_xfer_ref(xfer); mwFileTransfer_setClientData(ft, xfer, (GDestroyNotify) purple_xfer_unref); - xfer->data = ft; + purple_xfer_set_protocol_data(xfer, ft); purple_xfer_set_init_fnc(xfer, ft_incoming_init); purple_xfer_set_cancel_recv_fnc(xfer, ft_incoming_cancel); @@ -2219,7 +2224,7 @@ static void mw_ft_offered(struct mwFileTransfer *ft) { static void ft_send(struct mwFileTransfer *ft, FILE *fp) { guchar buf[MW_FT_LEN]; - struct mwOpaque o = { .data = buf, .len = MW_FT_LEN }; + struct mwOpaque o = { MW_FT_LEN, buf }; guint32 rem; PurpleXfer *xfer; @@ -2231,8 +2236,7 @@ static void ft_send(struct mwFileTransfer *ft, FILE *fp) { if(fread(buf, (size_t) o.len, 1, fp)) { /* calculate progress and display it */ - xfer->bytes_sent += o.len; - xfer->bytes_remaining -= o.len; + purple_xfer_set_bytes_sent(xfer, purple_xfer_get_bytes_sent(xfer) + o.len); purple_xfer_update_progress(xfer); mwFileTransfer_send(ft, &o); @@ -2264,7 +2268,7 @@ static void mw_ft_opened(struct mwFileTransfer *ft) { } if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - xfer->dest_fp = g_fopen(xfer->local_filename, "rb"); + xfer->dest_fp = g_fopen(purple_xfer_get_local_filename(xfer), "rb"); ft_send(ft, xfer->dest_fp); } } @@ -2281,7 +2285,7 @@ static void mw_ft_closed(struct mwFileTransfer *ft, guint32 code) { xfer = mwFileTransfer_getClientData(ft); if(xfer) { - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); if(! mwFileTransfer_getRemaining(ft)) { purple_xfer_set_completed(xfer, TRUE); @@ -2334,8 +2338,7 @@ static void mw_ft_recv(struct mwFileTransfer *ft, } /* update the progress */ - xfer->bytes_sent += data->len; - xfer->bytes_remaining -= data->len; + purple_xfer_set_bytes_sent(xfer, purple_xfer_get_bytes_sent(xfer) + data->len); purple_xfer_update_progress(xfer); /* let the other side know we got it, and to send some more */ @@ -2348,7 +2351,7 @@ static void mw_ft_ack(struct mwFileTransfer *ft) { xfer = mwFileTransfer_getClientData(ft); g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->watcher == 0); + g_return_if_fail(purple_xfer_get_watcher(xfer) == 0); if(! mwFileTransfer_getRemaining(ft)) { purple_xfer_set_completed(xfer, TRUE); @@ -2482,12 +2485,12 @@ static void convo_error(struct mwConversation *conv, guint32 err) { text = g_strconcat(_("Unable to send message: "), tmp, NULL); gconv = convo_get_gconv(conv); - if(gconv && !purple_conv_present_error(idb->user, gconv->account, text)) { + if(gconv && !purple_conv_present_error(idb->user, purple_conversation_get_account(gconv), text)) { g_free(text); text = g_strdup_printf(_("Unable to send message to %s:"), (idb->user)? idb->user: "(unknown)"); - purple_notify_error(purple_account_get_connection(gconv->account), + purple_notify_error(purple_account_get_connection(purple_conversation_get_account(gconv)), NULL, text, tmp); } @@ -2525,10 +2528,10 @@ static void convo_nofeatures(struct mwConversation *conv) { gconv = convo_get_gconv(conv); if(! gconv) return; - gc = purple_conversation_get_gc(gconv); + gc = purple_conversation_get_connection(gconv); if(! gc) return; - purple_conversation_set_features(gconv, gc->flags); + purple_conversation_set_features(gconv, purple_connection_get_flags(gc)); } @@ -3194,7 +3197,7 @@ static struct mwPurplePluginData *mwPurplePluginData_new(PurpleConnection *gc) { mwSession_addCipher(pd->session, mwCipher_new_RC2_128(pd->session)); mwSession_setClientData(pd->session, pd, NULL); - gc->proto_data = pd; + purple_connection_set_protocol_data(gc, pd); return pd; } @@ -3203,7 +3206,7 @@ static struct mwPurplePluginData *mwPurplePluginData_new(PurpleConnection *gc) { static void mwPurplePluginData_free(struct mwPurplePluginData *pd) { g_return_if_fail(pd != NULL); - pd->gc->proto_data = NULL; + purple_connection_set_protocol_data(pd->gc, NULL); mwSession_removeService(pd->session, mwService_AWARE); mwSession_removeService(pd->session, mwService_CONFERENCE); @@ -3265,7 +3268,7 @@ static char *mw_prpl_status_text(PurpleBuddy *b) { const char *ret = NULL; if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) - && (pd = gc->proto_data)) + && (pd = purple_connection_get_protocol_data(gc))) ret = mwServiceAware_getText(pd->srvc_aware, &t); return (ret && g_utf8_validate(ret, -1, NULL)) ? g_markup_escape_text(ret, -1): NULL; @@ -3328,7 +3331,7 @@ static void mw_prpl_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info char *tmp; if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) - && (pd = gc->proto_data)) + && (pd = purple_connection_get_protocol_data(gc))) message = mwServiceAware_getText(pd->srvc_aware, &idb); status = status_text(b); @@ -3405,7 +3408,7 @@ static void conf_create_prompt_join(PurpleBuddy *buddy, acct = purple_buddy_get_account(buddy); gc = purple_account_get_connection(acct); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); srvc = pd->srvc_conf; f = purple_request_fields_get_field(fields, CHAT_KEY_TOPIC); @@ -3571,7 +3574,7 @@ static void blist_menu_conf(PurpleBlistNode *node, gpointer data) { gc = purple_account_get_connection(acct); g_return_if_fail(gc != NULL); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); /* @@ -3610,7 +3613,7 @@ static void blist_menu_announce(PurpleBlistNode *node, gpointer data) { gc = purple_account_get_connection(acct); g_return_if_fail(gc != NULL); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); rcpt_name = g_strdup_printf("@U %s", buddy->name); @@ -3687,49 +3690,6 @@ static GHashTable *mw_prpl_chat_info_defaults(PurpleConnection *gc, static void mw_prpl_login(PurpleAccount *acct); -static void prompt_host_cancel_cb(PurpleConnection *gc) { - const char *msg = _("No Sametime Community Server specified"); - purple_connection_error(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - msg); -} - - -static void prompt_host_ok_cb(PurpleConnection *gc, const char *host) { - if(host && *host) { - PurpleAccount *acct = purple_connection_get_account(gc); - purple_account_set_string(acct, MW_KEY_HOST, host); - mw_prpl_login(acct); - - } else { - prompt_host_cancel_cb(gc); - } -} - - -static void prompt_host(PurpleConnection *gc) { - PurpleAccount *acct; - const char *msgA; - char *msg; - - acct = purple_connection_get_account(gc); - msgA = _("No host or IP address has been configured for the" - " Meanwhile account %s. Please enter one below to" - " continue logging in."); - msg = g_strdup_printf(msgA, NSTR(purple_account_get_username(acct))); - - purple_request_input(gc, _("Meanwhile Connection Setup"), - _("No Sametime Community Server Specified"), msg, - MW_PLUGIN_DEFAULT_HOST, FALSE, FALSE, NULL, - _("Connect"), G_CALLBACK(prompt_host_ok_cb), - _("Cancel"), G_CALLBACK(prompt_host_cancel_cb), - acct, NULL, NULL, - gc); - - g_free(msg); -} - - static void mw_prpl_login(PurpleAccount *account) { PurpleConnection *gc; struct mwPurplePluginData *pd; @@ -3741,7 +3701,7 @@ static void mw_prpl_login(PurpleAccount *account) { pd = mwPurplePluginData_new(gc); /* while we do support images, the default is to not offer it */ - gc->flags |= PURPLE_CONNECTION_NO_IMAGES; + purple_connection_set_flags(gc, PURPLE_CONNECTION_NO_IMAGES); user = g_strdup(purple_account_get_username(account)); @@ -3761,7 +3721,9 @@ static void mw_prpl_login(PurpleAccount *account) { /* somehow, we don't have a host to connect to. Well, we need one to actually continue, so let's ask the user directly. */ g_free(user); - prompt_host(gc); + purple_connection_error(gc, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, + _("A server is required to connect this account")); return; } @@ -3815,7 +3777,7 @@ static void mw_prpl_close(PurpleConnection *gc) { g_return_if_fail(gc != NULL); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); /* get rid of the blist save timeout */ @@ -3829,12 +3791,12 @@ static void mw_prpl_close(PurpleConnection *gc) { mwSession_stop(pd->session, 0x00); /* no longer necessary */ - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); /* stop watching the socket */ - if(gc->inpa) { - purple_input_remove(gc->inpa); - gc->inpa = 0; + if(pd->inpa) { + purple_input_remove(pd->inpa); + pd->inpa = 0; } /* clean up the rest */ @@ -4020,7 +3982,7 @@ static int mw_prpl_send_im(PurpleConnection *gc, struct mwConversation *conv; g_return_val_if_fail(gc != NULL, 0); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_val_if_fail(pd != NULL, 0); @@ -4095,7 +4057,7 @@ static unsigned int mw_prpl_send_typing(PurpleConnection *gc, gpointer t = GINT_TO_POINTER(!! state); g_return_val_if_fail(gc != NULL, 0); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_val_if_fail(pd != NULL, 0); @@ -4191,7 +4153,7 @@ static void mw_prpl_get_info(PurpleConnection *gc, const char *who) { g_return_if_fail(who != NULL); g_return_if_fail(*who != '\0'); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); acct = purple_connection_get_account(gc); b = purple_find_buddy(acct, who); @@ -4436,7 +4398,7 @@ static void add_buddy_resolved(struct mwServiceResolve *srvc, buddy = data->buddy; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); if(results) res = results->data; @@ -4515,9 +4477,10 @@ static void add_buddy_resolved(struct mwServiceResolve *srvc, static void mw_prpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) { + PurpleGroup *group, + const char *message) { - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); struct mwServiceResolve *srvc; GList *query; enum mwResolveFlag flags; @@ -4562,13 +4525,14 @@ static void foreach_add_buddies(PurpleGroup *group, GList *buddies, static void mw_prpl_add_buddies(PurpleConnection *gc, GList *buddies, - GList *groups) { + GList *groups, + const char *message) { struct mwPurplePluginData *pd; GHashTable *group_sets; struct mwAwareIdBlock *idbs, *idb; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); /* map PurpleGroup:GList of mwAwareIdBlock */ group_sets = g_hash_table_new(g_direct_hash, g_direct_equal); @@ -4619,7 +4583,7 @@ static void mw_prpl_remove_buddy(PurpleConnection *gc, GList *rem = g_list_prepend(NULL, &idb); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); group = purple_buddy_get_group(buddy); list = list_ensure(pd, group); @@ -4666,13 +4630,13 @@ static void mw_prpl_set_permit_deny(PurpleConnection *gc) { acct = purple_connection_get_account(gc); g_return_if_fail(acct != NULL); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); session = pd->session; g_return_if_fail(session != NULL); - switch(acct->perm_deny) { + switch(purple_account_get_privacy_type(acct)) { case PURPLE_PRIVACY_DENY_USERS: DEBUG_INFO("PURPLE_PRIVACY_DENY_USERS\n"); privacy_fill(&privacy, acct->deny); @@ -4696,7 +4660,7 @@ static void mw_prpl_set_permit_deny(PurpleConnection *gc) { break; default: - DEBUG_INFO("acct->perm_deny is 0x%x\n", acct->perm_deny); + DEBUG_INFO("acct->perm_deny is 0x%x\n", purple_account_get_privacy_type(acct)); return; } @@ -4750,7 +4714,7 @@ static void mw_prpl_join_chat(PurpleConnection *gc, struct mwPurplePluginData *pd; char *c, *t; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); c = g_hash_table_lookup(components, CHAT_KEY_NAME); t = g_hash_table_lookup(components, CHAT_KEY_TOPIC); @@ -4792,7 +4756,7 @@ static void mw_prpl_reject_chat(PurpleConnection *gc, struct mwServiceConference *srvc; char *c; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); srvc = pd->srvc_conf; if(g_hash_table_lookup(components, CHAT_KEY_IS_PLACE)) { @@ -4824,7 +4788,7 @@ static void mw_prpl_chat_invite(PurpleConnection *gc, struct mwPlace *place; struct mwIdBlock idb = { (char *) who, NULL }; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); conf = ID_TO_CONF(pd, id); @@ -4848,7 +4812,7 @@ static void mw_prpl_chat_leave(PurpleConnection *gc, struct mwPurplePluginData *pd; struct mwConference *conf; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); conf = ID_TO_CONF(pd, id); @@ -4884,7 +4848,7 @@ static int mw_prpl_chat_send(PurpleConnection *gc, char *msg; int ret; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_val_if_fail(pd != NULL, 0); conf = ID_TO_CONF(pd, id); @@ -4922,7 +4886,7 @@ static void mw_prpl_alias_buddy(PurpleConnection *gc, const char *who, const char *alias) { - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); /* it's a change to the buddy list, so we've gotta reflect that in @@ -4940,7 +4904,7 @@ static void mw_prpl_group_buddy(PurpleConnection *gc, struct mwAwareIdBlock idb = { mwAware_USER, (char *) who, NULL }; GList *gl = g_list_prepend(NULL, &idb); - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); PurpleGroup *group; struct mwAwareList *list; @@ -4966,7 +4930,7 @@ static void mw_prpl_rename_group(PurpleConnection *gc, PurpleGroup *group, GList *buddies) { - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); /* it's a change in the buddy list, so we've gotta reflect that in @@ -4986,7 +4950,7 @@ static void mw_prpl_buddy_free(PurpleBuddy *buddy) { static void mw_prpl_convo_closed(PurpleConnection *gc, const char *who) { - struct mwPurplePluginData *pd = gc->proto_data; + struct mwPurplePluginData *pd = purple_connection_get_protocol_data(gc); struct mwServiceIm *srvc; struct mwConversation *conv; struct mwIdBlock idb = { (char *) who, NULL }; @@ -5021,7 +4985,7 @@ static void mw_prpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { struct mwPurplePluginData *pd; struct mwAwareList *list; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_if_fail(pd != NULL); g_return_if_fail(pd->group_list_map != NULL); @@ -5045,7 +5009,7 @@ static gboolean mw_prpl_can_receive_file(PurpleConnection *gc, g_return_val_if_fail(gc != NULL, FALSE); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); g_return_val_if_fail(pd != NULL, FALSE); srvc = pd->srvc_aware; @@ -5077,12 +5041,12 @@ static void ft_outgoing_init(PurpleXfer *xfer) { acct = purple_xfer_get_account(xfer); gc = purple_account_get_connection(acct); - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); srvc = pd->srvc_ft; filename = purple_xfer_get_local_filename(xfer); filesize = purple_xfer_get_size(xfer); - idb.user = xfer->who; + idb.user = purple_xfer_get_remote_user(xfer); purple_xfer_update_progress(xfer); @@ -5091,7 +5055,7 @@ static void ft_outgoing_init(PurpleXfer *xfer) { if(! fp) { char *msg = g_strdup_printf(_("Error reading file %s: \n%s\n"), filename, g_strerror(errno)); - purple_xfer_error(purple_xfer_get_type(xfer), acct, xfer->who, msg); + purple_xfer_error(purple_xfer_get_type(xfer), acct, purple_xfer_get_remote_user(xfer), msg); g_free(msg); return; } @@ -5106,14 +5070,14 @@ static void ft_outgoing_init(PurpleXfer *xfer) { purple_xfer_ref(xfer); mwFileTransfer_setClientData(ft, xfer, (GDestroyNotify) purple_xfer_unref); - xfer->data = ft; + purple_xfer_set_protocol_data(xfer, ft); mwFileTransfer_offer(ft); } static void ft_outgoing_cancel(PurpleXfer *xfer) { - struct mwFileTransfer *ft = xfer->data; + struct mwFileTransfer *ft = purple_xfer_get_protocol_data(xfer); DEBUG_INFO("ft_outgoing_cancel called\n"); @@ -5154,67 +5118,77 @@ static void mw_prpl_send_file(PurpleConnection *gc, static PurplePluginProtocolInfo mw_prpl_info = { - .options = OPT_PROTO_IM_IMAGE, - .user_splits = NULL, /*< set in mw_plugin_init */ - .protocol_options = NULL, /*< set in mw_plugin_init */ - .icon_spec = NO_BUDDY_ICONS, - .list_icon = mw_prpl_list_icon, - .list_emblem = mw_prpl_list_emblem, - .status_text = mw_prpl_status_text, - .tooltip_text = mw_prpl_tooltip_text, - .status_types = mw_prpl_status_types, - .blist_node_menu = mw_prpl_blist_node_menu, - .chat_info = mw_prpl_chat_info, - .chat_info_defaults = mw_prpl_chat_info_defaults, - .login = mw_prpl_login, - .close = mw_prpl_close, - .send_im = mw_prpl_send_im, - .set_info = NULL, - .send_typing = mw_prpl_send_typing, - .get_info = mw_prpl_get_info, - .set_status = mw_prpl_set_status, - .set_idle = mw_prpl_set_idle, - .change_passwd = NULL, - .add_buddy = mw_prpl_add_buddy, - .add_buddies = mw_prpl_add_buddies, - .remove_buddy = mw_prpl_remove_buddy, - .remove_buddies = NULL, - .add_permit = mw_prpl_add_permit, - .add_deny = mw_prpl_add_deny, - .rem_permit = mw_prpl_rem_permit, - .rem_deny = mw_prpl_rem_deny, - .set_permit_deny = mw_prpl_set_permit_deny, - .join_chat = mw_prpl_join_chat, - .reject_chat = mw_prpl_reject_chat, - .get_chat_name = mw_prpl_get_chat_name, - .chat_invite = mw_prpl_chat_invite, - .chat_leave = mw_prpl_chat_leave, - .chat_whisper = mw_prpl_chat_whisper, - .chat_send = mw_prpl_chat_send, - .keepalive = mw_prpl_keepalive, - .register_user = NULL, - .get_cb_info = NULL, - .get_cb_away = NULL, - .alias_buddy = mw_prpl_alias_buddy, - .group_buddy = mw_prpl_group_buddy, - .rename_group = mw_prpl_rename_group, - .buddy_free = mw_prpl_buddy_free, - .convo_closed = mw_prpl_convo_closed, - .normalize = mw_prpl_normalize, - .set_buddy_icon = NULL, - .remove_group = mw_prpl_remove_group, - .get_cb_real_name = NULL, - .set_chat_topic = NULL, - .find_blist_chat = NULL, - .roomlist_get_list = NULL, - .roomlist_expand_category = NULL, - .can_receive_file = mw_prpl_can_receive_file, - .send_file = mw_prpl_send_file, - .new_xfer = mw_prpl_new_xfer, - .offline_message = NULL, - .whiteboard_prpl_ops = NULL, - .send_raw = NULL, - .struct_size = sizeof(PurplePluginProtocolInfo) + sizeof(PurplePluginProtocolInfo), + OPT_PROTO_IM_IMAGE, + NULL, /*< set in mw_plugin_init */ + NULL, /*< set in mw_plugin_init */ + NO_BUDDY_ICONS, + mw_prpl_list_icon, + mw_prpl_list_emblem, + mw_prpl_status_text, + mw_prpl_tooltip_text, + mw_prpl_status_types, + mw_prpl_blist_node_menu, + mw_prpl_chat_info, + mw_prpl_chat_info_defaults, + mw_prpl_login, + mw_prpl_close, + mw_prpl_send_im, + NULL, + mw_prpl_send_typing, + mw_prpl_get_info, + mw_prpl_set_status, + mw_prpl_set_idle, + NULL, + mw_prpl_add_buddy, + mw_prpl_add_buddies, + mw_prpl_remove_buddy, + NULL, + mw_prpl_add_permit, + mw_prpl_add_deny, + mw_prpl_rem_permit, + mw_prpl_rem_deny, + mw_prpl_set_permit_deny, + mw_prpl_join_chat, + mw_prpl_reject_chat, + mw_prpl_get_chat_name, + mw_prpl_chat_invite, + mw_prpl_chat_leave, + mw_prpl_chat_whisper, + mw_prpl_chat_send, + mw_prpl_keepalive, + NULL, + NULL, + mw_prpl_alias_buddy, + mw_prpl_group_buddy, + mw_prpl_rename_group, + mw_prpl_buddy_free, + mw_prpl_convo_closed, + mw_prpl_normalize, + NULL, + mw_prpl_remove_group, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + mw_prpl_can_receive_file, + mw_prpl_send_file, + mw_prpl_new_xfer, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL }; @@ -5536,7 +5510,7 @@ static void remote_group_action_cb(PurpleConnection *gc, const char *name) { enum mwResolveFlag flags; guint32 req; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); srvc = pd->srvc_resolve; query = g_list_prepend(NULL, (char *) name); @@ -5661,7 +5635,7 @@ static void search_action_cb(PurpleConnection *gc, const char *name) { enum mwResolveFlag flags; guint32 req; - pd = gc->proto_data; + pd = purple_connection_get_protocol_data(gc); srvc = pd->srvc_resolve; query = g_list_prepend(NULL, (char *) name); @@ -5791,6 +5765,7 @@ static void mw_log_handler(const gchar *domain, GLogLevelFlags flags, static void mw_plugin_init(PurplePlugin *plugin) { + PurpleAccountUserSplit *split; PurpleAccountOption *opt; GList *l = NULL; @@ -5801,15 +5776,15 @@ static void mw_plugin_init(PurplePlugin *plugin) { purple_prefs_add_none(MW_PRPL_OPT_BASE); purple_prefs_add_int(MW_PRPL_OPT_BLIST_ACTION, BLIST_CHOICE_DEFAULT); + /* set up account ID as user:server */ + split = purple_account_user_split_new(_("Server"), + MW_PLUGIN_DEFAULT_HOST, ':'); + mw_prpl_info.user_splits = g_list_append(mw_prpl_info.user_splits, split); + /* remove dead preferences */ purple_prefs_remove(MW_PRPL_OPT_PSYCHIC); purple_prefs_remove(MW_PRPL_OPT_SAVE_DYNAMIC); - /* host to connect to */ - opt = purple_account_option_string_new(_("Server"), MW_KEY_HOST, - MW_PLUGIN_DEFAULT_HOST); - l = g_list_append(l, opt); - /* port to connect to */ opt = purple_account_option_int_new(_("Port"), MW_KEY_PORT, MW_PLUGIN_DEFAULT_PORT); diff --git a/libpurple/protocols/silc/buddy.c b/libpurple/protocols/silc/buddy.c index 0e7a29b752..e79b3dde85 100644 --- a/libpurple/protocols/silc/buddy.c +++ b/libpurple/protocols/silc/buddy.c @@ -72,7 +72,7 @@ silcpurple_buddy_keyagr_cb(SilcClient client, void *context) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); if (!sg->conn) return; @@ -146,7 +146,7 @@ static void silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, gboolean force_local) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcDList clients; SilcClientEntry client_entry; SilcClientConnectionParams params; @@ -314,7 +314,7 @@ void silcpurple_buddy_keyagr_request(SilcClient client, a->port = port; purple_request_action(client->application, _("Key Agreement Request"), tmp, - hostname ? tmp2 : NULL, 1, gc->account, client_entry->nickname, + hostname ? tmp2 : NULL, 1, purple_connection_get_account(gc), client_entry->nickname, NULL, a, 2, _("Yes"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb), _("No"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb)); } @@ -346,7 +346,7 @@ silcpurple_buddy_resetkey(PurpleBlistNode *node, gpointer data) b = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); /* Find client entry */ clients = silc_client_get_clients_local(sg->client, sg->conn, @@ -426,7 +426,7 @@ silcpurple_buddy_privkey_resolved(SilcClient client, static void silcpurple_buddy_privkey(PurpleConnection *gc, const char *name) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurplePrivkey p; SilcDList clients; SilcClientEntry client_entry; @@ -457,7 +457,7 @@ silcpurple_buddy_privkey(PurpleConnection *gc, const char *name) _("Set IM Password"), NULL, FALSE, TRUE, NULL, _("OK"), G_CALLBACK(silcpurple_buddy_privkey_cb), _("Cancel"), G_CALLBACK(silcpurple_buddy_privkey_cb), - gc->account, NULL, NULL, p); + purple_connection_get_account(gc), NULL, NULL, p); silc_client_list_free(sg->client, sg->conn, clients); } @@ -554,7 +554,7 @@ silcpurple_buddy_getkey_resolved(SilcClient client, static void silcpurple_buddy_getkey(PurpleConnection *gc, const char *name) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientEntry client_entry; @@ -618,7 +618,7 @@ silcpurple_buddy_showkey(PurpleBlistNode *node, gpointer data) b = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); pkfile = purple_blist_node_get_string(node, "public-key"); if (!silc_pkcs_load_public_key(pkfile, &public_key)) { @@ -669,7 +669,7 @@ silcpurple_add_buddy_resolved(SilcClient client, void silcpurple_get_info(PurpleConnection *gc, const char *who) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientEntry client_entry; @@ -686,7 +686,7 @@ void silcpurple_get_info(PurpleConnection *gc, const char *who) if (strlen(who) > 2 && who[0] == '*' && who[1] == '@') nick = who + 2; - b = purple_find_buddy(gc->account, nick); + b = purple_find_buddy(purple_connection_get_account(gc), nick); if (b) { /* See if we have this buddy's public key. If we do use that to search the details. */ @@ -1338,7 +1338,7 @@ silcpurple_add_buddy_resolved(SilcClient client, static void silcpurple_add_buddy_i(PurpleConnection *gc, PurpleBuddy *b, gboolean init) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcPurpleBuddyRes r; @@ -1396,7 +1396,7 @@ silcpurple_add_buddy_i(PurpleConnection *gc, PurpleBuddy *b, gboolean init) silc_buffer_free(attrs); } -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { /* Don't add if the buddy is already on the list. * @@ -1437,7 +1437,7 @@ void silcpurple_idle_set(PurpleConnection *gc, int idle) const char *server; int port; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return; @@ -1467,7 +1467,7 @@ char *silcpurple_status_text(PurpleBuddy *b) { PurpleAccount *account = purple_buddy_get_account(b); PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientID *client_id = purple_buddy_get_protocol_data(b); @@ -1533,7 +1533,7 @@ void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gb { PurpleAccount *account = purple_buddy_get_account(b); PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcClientID *client_id = purple_buddy_get_protocol_data(b); @@ -1629,7 +1629,7 @@ silcpurple_buddy_kill(PurpleBlistNode *node, gpointer data) b = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); /* Call KILL */ silc_client_command_call(sg->client, sg->conn, NULL, "KILL", @@ -1653,7 +1653,7 @@ GList *silcpurple_buddy_menu(PurpleBuddy *buddy) { PurpleAccount *account = purple_buddy_get_account(buddy); PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClientConnection conn = sg->conn; const char *pkfile = NULL; SilcClientEntry client_entry = NULL; @@ -1719,7 +1719,7 @@ GList *silcpurple_buddy_menu(PurpleBuddy *buddy) void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcMime mime; diff --git a/libpurple/protocols/silc/chat.c b/libpurple/protocols/silc/chat.c index d20667a7c2..fe7be1ab8b 100644 --- a/libpurple/protocols/silc/chat.c +++ b/libpurple/protocols/silc/chat.c @@ -91,7 +91,7 @@ silcpurple_chat_getinfo_res(SilcClient client, static void silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); const char *chname; char tmp[256], *tmp2; GString *s; @@ -500,7 +500,7 @@ silcpurple_chat_chauth(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -587,7 +587,7 @@ silcpurple_chat_prv(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); p = silc_calloc(1, sizeof(*p)); if (!p) @@ -637,7 +637,7 @@ silcpurple_chat_permanent_reset(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -656,7 +656,7 @@ silcpurple_chat_permanent(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg->conn) return; @@ -733,7 +733,7 @@ silcpurple_chat_ulimit(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg->conn) return; @@ -768,7 +768,7 @@ silcpurple_chat_resettopic(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -786,7 +786,7 @@ silcpurple_chat_settopic(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -804,7 +804,7 @@ silcpurple_chat_resetprivate(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -822,7 +822,7 @@ silcpurple_chat_setprivate(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -840,7 +840,7 @@ silcpurple_chat_resetsecret(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -858,7 +858,7 @@ silcpurple_chat_setsecret(PurpleBlistNode *node, gpointer data) chat = (PurpleChat *) node; gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", g_hash_table_lookup(purple_chat_get_components(chat), "channel"), @@ -882,7 +882,7 @@ GList *silcpurple_chat_menu(PurpleChat *chat) { GHashTable *components = purple_chat_get_components(chat); PurpleConnection *gc = purple_account_get_connection(purple_chat_get_account(chat)); - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClientConnection conn = sg->conn; const char *chname = NULL; SilcChannelEntry channel = NULL; @@ -1020,7 +1020,7 @@ char *silcpurple_get_chat_name(GHashTable *data) void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; const char *channel, *passphrase, *parentch; @@ -1103,7 +1103,7 @@ void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *name) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcHashTableList htl; @@ -1148,7 +1148,7 @@ void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, void silcpurple_chat_leave(PurpleConnection *gc, int id) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcHashTableList htl; @@ -1218,7 +1218,7 @@ void silcpurple_chat_leave(PurpleConnection *gc, int id) int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags msgflags) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcHashTableList htl; @@ -1340,7 +1340,7 @@ int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcHashTableList htl; @@ -1384,7 +1384,7 @@ void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; GList *fields = NULL; @@ -1419,12 +1419,13 @@ PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) void silcpurple_roomlist_cancel(PurpleRoomlist *list) { - PurpleConnection *gc = purple_account_get_connection(list->account); + PurpleAccount *account = purple_roomlist_get_account(list); + PurpleConnection *gc = purple_account_get_connection(account); SilcPurple sg; if (!gc) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); purple_roomlist_set_in_progress(list, FALSE); if (sg->roomlist == list) { diff --git a/libpurple/protocols/silc/ft.c b/libpurple/protocols/silc/ft.c index 0fad6d66e4..fabae1c0a2 100644 --- a/libpurple/protocols/silc/ft.c +++ b/libpurple/protocols/silc/ft.c @@ -76,7 +76,7 @@ silcpurple_ftp_monitor(SilcClient client, if (status == SILC_CLIENT_FILE_MONITOR_CLOSED) { /* All started sessions terminate here */ - xfer->xfer->data = NULL; + purple_xfer_set_protocol_data(xfer->xfer, NULL); purple_xfer_unref(xfer->xfer); silc_free(xfer); return; @@ -86,7 +86,7 @@ silcpurple_ftp_monitor(SilcClient client, purple_notify_error(gc, _("Secure File Transfer"), _("Error during file transfer"), _("Remote disconnected")); - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE; + purple_xfer_set_status(xfer->xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE); purple_xfer_update_progress(xfer->xfer); silc_client_file_close(client, conn, session_id); return; @@ -122,7 +122,7 @@ silcpurple_ftp_monitor(SilcClient client, _("Error during file transfer"), _("File transfer session does not exist")); } - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE; + purple_xfer_set_status(xfer->xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE); purple_xfer_update_progress(xfer->xfer); silc_client_file_close(client, conn, session_id); return; @@ -132,8 +132,7 @@ silcpurple_ftp_monitor(SilcClient client, if (!offset && filesize) purple_xfer_set_size(xfer->xfer, filesize); if (offset && filesize) { - xfer->xfer->bytes_sent = offset; - xfer->xfer->bytes_remaining = filesize - offset; + purple_xfer_set_bytes_sent(xfer->xfer, offset); } purple_xfer_update_progress(xfer->xfer); @@ -150,12 +149,12 @@ silcpurple_ftp_monitor(SilcClient client, static void silcpurple_ftp_cancel(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); if (!xfer) return; - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; + purple_xfer_set_status(xfer->xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); purple_xfer_update_progress(xfer->xfer); silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); } @@ -163,7 +162,7 @@ silcpurple_ftp_cancel(PurpleXfer *x) static void silcpurple_ftp_ask_name_cancel(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); if (!xfer) return; @@ -176,7 +175,7 @@ silcpurple_ftp_ask_name_cancel(PurpleXfer *x) static void silcpurple_ftp_ask_name_ok(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); const char *name; if (!xfer) @@ -212,7 +211,7 @@ silcpurple_ftp_ask_name(SilcClient client, static void silcpurple_ftp_request_result(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); SilcClientFileError status; PurpleConnection *gc = xfer->sg->gc; SilcClientConnectionParams params; @@ -310,7 +309,7 @@ void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, const char *hostname, SilcUInt16 port) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleXfer xfer; xfer = silc_calloc(1, sizeof(*xfer)); @@ -337,7 +336,7 @@ void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, purple_xfer_set_cancel_recv_fnc(xfer->xfer, silcpurple_ftp_cancel); xfer->xfer->remote_ip = g_strdup(hostname); xfer->xfer->remote_port = port; - xfer->xfer->data = xfer; + purple_xfer_set_protocol_data(xfer->xfer, xfer); /* File transfer request */ purple_xfer_request(xfer->xfer); @@ -346,7 +345,7 @@ void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, static void silcpurple_ftp_send_cancel(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); if (!xfer) return; @@ -358,7 +357,7 @@ silcpurple_ftp_send_cancel(PurpleXfer *x) static void silcpurple_ftp_send(PurpleXfer *x) { - SilcPurpleXfer xfer = x->data; + SilcPurpleXfer xfer = purple_xfer_get_protocol_data(x); const char *name; char *local_ip = NULL, *remote_ip = NULL; gboolean local = TRUE; @@ -435,7 +434,7 @@ silcpurple_ftp_send_file_resolved(SilcClient client, PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcDList clients; @@ -467,7 +466,7 @@ PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name) purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_send); purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); purple_xfer_set_cancel_send_fnc(xfer->xfer, silcpurple_ftp_send_cancel); - xfer->xfer->data = xfer; + purple_xfer_set_protocol_data(xfer->xfer, xfer); silc_free(clients); diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c index 7a102d7fb7..11d062e26c 100644 --- a/libpurple/protocols/silc/ops.c +++ b/libpurple/protocols/silc/ops.c @@ -88,7 +88,7 @@ silcpurple_mime_message(SilcClient client, SilcClientConnection conn, gboolean recursive) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); const char *type; const unsigned char *data; SilcUInt32 data_len; @@ -224,7 +224,6 @@ silcpurple_mime_message(SilcClient client, SilcClientConnection conn, tmp, cflags, time(NULL)); purple_imgstore_unref_by_id(imgid); - cflags = 0; ret = TRUE; } goto out; @@ -264,7 +263,7 @@ silc_channel_message(SilcClient client, SilcClientConnection conn, SilcUInt32 message_len) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleConversation *convo = NULL; char *msg, *tmp; @@ -332,10 +331,17 @@ silc_channel_message(SilcClient client, SilcClientConnection conn, } if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); + const char *msg = (const char *)message; + char *salvaged = NULL; + if (!g_utf8_validate((const char *)message, -1, NULL)) { + salvaged = purple_utf8_salvage((const char *)message); + msg = salvaged; + } + tmp = g_markup_escape_text(msg, -1); /* Send to Purple */ serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), sender->nickname, 0, tmp, time(NULL)); + g_free(salvaged); g_free(tmp); } } @@ -354,7 +360,7 @@ silc_private_message(SilcClient client, SilcClientConnection conn, SilcUInt32 message_len) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleConversation *convo = NULL; char *msg, *tmp; @@ -408,9 +414,16 @@ silc_private_message(SilcClient client, SilcClientConnection conn, } if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); + const char *msg = (const char *)message; + char *salvaged = NULL; + if (!g_utf8_validate((const char *)message, -1, NULL)) { + salvaged = purple_utf8_salvage((const char *)message); + msg = salvaged; + } + tmp = g_markup_escape_text(msg, -1); /* Send to Purple */ serv_got_im(gc, sender->nickname, tmp, 0, time(NULL)); + g_free(salvaged); g_free(tmp); } } @@ -431,7 +444,7 @@ silc_notify(SilcClient client, SilcClientConnection conn, { va_list va; PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); PurpleConversation *convo; SilcClientEntry client_entry, client_entry2; @@ -941,7 +954,7 @@ silc_command(SilcClient client, SilcClientConnection conn, SilcUInt32 argc, unsigned char **argv) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); switch (command) { @@ -1078,7 +1091,7 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, SilcStatus error, va_list ap) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleConversation *convo; switch (command) { @@ -1724,7 +1737,7 @@ silc_get_auth_method(SilcClient client, SilcClientConnection conn, SilcGetAuthMeth completion, void *context) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleAskPassphrase internal; const char *password; @@ -1775,7 +1788,7 @@ silc_verify_public_key(SilcClient client, SilcClientConnection conn, SilcVerifyPublicKey completion, void *context) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); if (!sg->conn && (conn_type == SILC_CONN_SERVER || conn_type == SILC_CONN_ROUTER)) { diff --git a/libpurple/protocols/silc/pk.c b/libpurple/protocols/silc/pk.c index 6d25db910d..66d2c9fb55 100644 --- a/libpurple/protocols/silc/pk.c +++ b/libpurple/protocols/silc/pk.c @@ -79,7 +79,7 @@ static void silcpurple_verify_details_cb(PublicKeyVerify verify) static void silcpurple_verify_details(PublicKeyVerify verify, gint id) { PurpleConnection *gc = verify->client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); silcpurple_show_public_key(sg, verify->entity_name, verify->public_key, G_CALLBACK(silcpurple_verify_details_cb), diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c index 525b24dbf8..c44054b6c7 100644 --- a/libpurple/protocols/silc/silc.c +++ b/libpurple/protocols/silc/silc.c @@ -78,7 +78,7 @@ silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) const char *state; if (gc != NULL) - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (status == NULL) return; @@ -125,7 +125,7 @@ silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) static void silcpurple_keepalive(PurpleConnection *gc) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); silc_packet_send(sg->conn->stream, SILC_PACKET_HEARTBEAT, 0, NULL, 0); } @@ -180,7 +180,7 @@ silcpurple_scheduler(SilcSchedule schedule, { SilcClient client = (SilcClient)context; PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleTask ptask = NULL; if (added) { @@ -252,7 +252,7 @@ silcpurple_connect_cb(SilcClient client, SilcClientConnection conn, struct utsname u; #endif - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); switch (status) { case SILC_CLIENT_CONN_SUCCESS: @@ -367,7 +367,7 @@ silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream, SilcClientConnectionParams params; const char *dfile; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (status != SILC_SOCKET_OK) { purple_connection_error(gc, @@ -376,7 +376,7 @@ silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream, silc_pkcs_public_key_free(sg->public_key); silc_pkcs_private_key_free(sg->private_key); silc_free(sg); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); return; } @@ -400,7 +400,7 @@ silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream, } /* Perform SILC Key Exchange. */ - silc_client_key_exchange(sg->client, ¶ms, sg->public_key, + silc_client_key_exchange(client, ¶ms, sg->public_key, sg->private_key, stream, SILC_CONN_SERVER, silcpurple_connect_cb, gc); @@ -415,7 +415,7 @@ silcpurple_login_connected(gpointer data, gint source, const gchar *error_messag g_return_if_fail(gc != NULL); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (source < 0) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, @@ -423,7 +423,7 @@ silcpurple_login_connected(gpointer data, gint source, const gchar *error_messag silc_pkcs_public_key_free(sg->public_key); silc_pkcs_private_key_free(sg->private_key); silc_free(sg); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); return; } @@ -449,7 +449,7 @@ static void silcpurple_continue_running(SilcPurple sg) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -457,7 +457,7 @@ static void silcpurple_continue_running(SilcPurple sg) static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) { - SilcPurple sg = (SilcPurple)gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); char pkd[256], prd[256]; const char *password; @@ -473,7 +473,7 @@ static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields if (!password || !*password) { purple_notify_error(gc, NULL, _("Password is required to sign on."), NULL); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -492,7 +492,7 @@ static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields &sg->public_key, &sg->private_key)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -505,10 +505,10 @@ static void silcpurple_no_password_cb(PurpleConnection *gc, PurpleRequestFields /* The password prompt dialog doesn't get disposed if the account disconnects */ if (!PURPLE_CONNECTION_IS_VALID(gc)) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); } @@ -528,7 +528,7 @@ static void silcpurple_running(SilcClient client, void *context) g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), (char *)purple_account_get_string(account, "private-key", prd), - (gc->password == NULL) ? "" : gc->password, + (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), &sg->public_key, &sg->private_key)) { if (!purple_account_get_password(account)) { purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb), @@ -537,7 +537,7 @@ static void silcpurple_running(SilcClient client, void *context) } purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to load SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -555,10 +555,10 @@ silcpurple_login(PurpleAccount *account) char *username, *hostname, *realname, **up; int i; - gc = account->gc; + gc = purple_account_get_connection(account); if (!gc) return; - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); memset(¶ms, 0, sizeof(params)); strcat(params.nickname_format, "%n#a"); @@ -612,14 +612,14 @@ silcpurple_login(PurpleAccount *account) sg->client = client; sg->gc = gc; sg->account = account; - gc->proto_data = sg; + purple_connection_set_protocol_data(gc, sg); /* Init SILC client */ if (!silc_client_init(client, username, hostname, realname, silcpurple_running, sg)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to initialize SILC protocol")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); silc_free(hostname); g_free(username); @@ -632,7 +632,7 @@ silcpurple_login(PurpleAccount *account) if (!silcpurple_check_silc_dir(gc)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Error loading SILC key pair")); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); silc_free(sg); return; } @@ -669,7 +669,7 @@ silcpurple_close_final(gpointer *context) static void silcpurple_close(PurpleConnection *gc) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); #if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) SilcPurpleTask task; #endif /* __SILC_TOOLKIT_VERSION */ @@ -733,7 +733,7 @@ silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields) static void silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; PurpleRequestField *f; @@ -744,7 +744,7 @@ silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) SilcVCardStruct vcard; const char *val; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -905,7 +905,7 @@ static void silcpurple_attrs(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; PurpleRequestFields *fields; @@ -922,7 +922,7 @@ silcpurple_attrs(PurplePluginAction *action) gboolean device = TRUE; char status[1024], tz[16]; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1061,7 +1061,7 @@ silcpurple_attrs(PurplePluginAction *action) fields, _("OK"), G_CALLBACK(silcpurple_attrs_cb), _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), - gc->account, NULL, NULL, gc); + purple_connection_get_account(gc), NULL, NULL, gc); } static void @@ -1072,7 +1072,7 @@ silcpurple_detach(PurplePluginAction *action) if (!gc) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1090,7 +1090,7 @@ silcpurple_view_motd(PurplePluginAction *action) if (!gc) return; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1125,7 +1125,7 @@ silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields) int keylen = SILCPURPLE_DEF_PKCS_LEN; SilcPublicKey public_key; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (!sg) return; @@ -1208,7 +1208,7 @@ static void silcpurple_create_keypair(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); PurpleRequestFields *fields; PurpleRequestFieldGroup *g; PurpleRequestField *f; @@ -1226,9 +1226,9 @@ silcpurple_create_keypair(PurplePluginAction *action) g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); g_snprintf(pkd, sizeof(pkd) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd2)); + purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd2)); g_snprintf(prd, sizeof(prd) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd2)); + purple_account_get_string(purple_connection_get_account(gc), "private-key", prd2)); fields = purple_request_fields_new(); @@ -1269,7 +1269,7 @@ silcpurple_create_keypair(PurplePluginAction *action) _("Create New SILC Key Pair"), NULL, fields, _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), - gc->account, NULL, NULL, gc); + purple_connection_get_account(gc), NULL, NULL, gc); g_strfreev(u); silc_free(hostname); @@ -1287,7 +1287,7 @@ silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) { char prd[256]; g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); - silc_change_private_key_passphrase(purple_account_get_string(gc->account, + silc_change_private_key_passphrase(purple_account_get_string(purple_connection_get_account(gc), "private-key", prd), old ? old : "", new ? new : ""); } @@ -1356,7 +1356,7 @@ silcpurple_send_im_resolved(SilcClient client, void *context) { PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcPurpleIM im = context; PurpleConversation *convo; char tmp[256]; @@ -1433,7 +1433,7 @@ static int silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, PurpleMessageFlags flags) { - SilcPurple sg = gc->proto_data; + SilcPurple sg = purple_connection_get_protocol_data(gc); SilcClient client = sg->client; SilcClientConnection conn = sg->conn; SilcDList clients; @@ -1548,14 +1548,14 @@ static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, PurpleConversation *convo = conv; int id = 0; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; if(args && args[0]) convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], - gc->account); + purple_connection_get_account(gc)); if (convo != NULL) id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); @@ -1577,7 +1577,7 @@ static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, char *buf, *tmp, *tmp2; const char *topic; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); if (gc == NULL || id == 0) @@ -1593,7 +1593,7 @@ static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, g_free(tmp2); } else buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf, + purple_conv_chat_write(PURPLE_CONV_CHAT(conv), purple_account_get_username(purple_connection_get_account(gc)), buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); g_free(buf); @@ -1623,7 +1623,7 @@ static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv, if(args[1]) g_hash_table_replace(comp, "passphrase", args[1]); - silcpurple_chat_join(purple_conversation_get_gc(conv), comp); + silcpurple_chat_join(purple_conversation_get_connection(conv), comp); g_hash_table_destroy(comp); return PURPLE_CMD_RET_OK; @@ -1633,7 +1633,7 @@ static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); purple_roomlist_show_with_account(purple_connection_get_account(gc)); return PURPLE_CMD_RET_OK; } @@ -1643,7 +1643,7 @@ static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, { PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1659,7 +1659,7 @@ static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv, int ret; PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1685,7 +1685,7 @@ static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, return PURPLE_CMD_RET_FAILED; } - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; @@ -1713,12 +1713,12 @@ static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv, SilcPurple sg; char *tmp; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1742,12 +1742,12 @@ static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv, PurpleConnection *gc; SilcPurple sg; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1767,12 +1767,12 @@ static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv, char *silccmd, *silcargs, *msg, tmp[256]; const char *chname; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); - if (gc == NULL || !args || gc->proto_data == NULL) + if (gc == NULL || !args || purple_connection_get_protocol_data(gc) == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (args[0]) chname = args[0]; @@ -1818,12 +1818,12 @@ static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv, SilcPurple sg; char *silccmd, *silcargs; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1850,12 +1850,12 @@ static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, const char *ui_name = NULL, *ui_website = NULL; char *quit_msg; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -1887,12 +1887,12 @@ static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, PurpleConnection *gc; SilcPurple sg; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc == NULL) return PURPLE_CMD_RET_FAILED; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); if (sg == NULL) return PURPLE_CMD_RET_FAILED; @@ -2050,6 +2050,7 @@ static PurpleWhiteboardPrplOps silcpurple_wb_ops = static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE | OPT_PROTO_SLASH_COMMANDS_NATIVE, @@ -2092,7 +2093,6 @@ static PurplePluginProtocolInfo prpl_info = silcpurple_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ @@ -2117,15 +2117,12 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/silc/silcpurple.h b/libpurple/protocols/silc/silcpurple.h index 937e0cc358..4c0cdb8a75 100644 --- a/libpurple/protocols/silc/silcpurple.h +++ b/libpurple/protocols/silc/silcpurple.h @@ -105,7 +105,7 @@ void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, SilcVerifyPublicKey completion, void *context); GList *silcpurple_buddy_menu(PurpleBuddy *buddy); -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); +void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message); void silcpurple_send_buddylist(PurpleConnection *gc); void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); void silcpurple_buddy_keyagr_request(SilcClient client, diff --git a/libpurple/protocols/silc/util.c b/libpurple/protocols/silc/util.c index 5436e1490b..3dc6c0118d 100644 --- a/libpurple/protocols/silc/util.c +++ b/libpurple/protocols/silc/util.c @@ -198,9 +198,9 @@ gboolean silcpurple_check_silc_dir(PurpleConnection *gc) g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd)); + purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd)); g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd)); + purple_account_get_string(purple_connection_get_account(gc), "private-key", prd)); if ((g_stat(file_public_key, &st)) == -1) { /* If file doesn't exist */ @@ -210,8 +210,7 @@ gboolean silcpurple_check_silc_dir(PurpleConnection *gc) SILCPURPLE_DEF_PKCS_LEN, file_public_key, file_private_key, NULL, - (gc->password == NULL) - ? "" : gc->password, + (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), NULL, NULL, FALSE)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to create SILC key pair")); @@ -253,8 +252,7 @@ gboolean silcpurple_check_silc_dir(PurpleConnection *gc) SILCPURPLE_DEF_PKCS_LEN, file_public_key, file_private_key, NULL, - (gc->password == NULL) - ? "" : gc->password, + (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc), NULL, NULL, FALSE)) { purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to create SILC key pair")); diff --git a/libpurple/protocols/silc/wb.c b/libpurple/protocols/silc/wb.c index 984925e823..b7dcde7a4f 100644 --- a/libpurple/protocols/silc/wb.c +++ b/libpurple/protocols/silc/wb.c @@ -105,18 +105,16 @@ typedef struct { PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry) { - SilcClientConnection conn; PurpleWhiteboard *wb; SilcPurpleWb wbs; - conn = sg->conn; wb = purple_whiteboard_get_session(sg->account, client_entry->nickname); if (!wb) wb = purple_whiteboard_create(sg->account, client_entry->nickname, 0); if (!wb) return NULL; - if (!wb->proto_data) { + if (!purple_whiteboard_get_protocol_data(wb)) { wbs = silc_calloc(1, sizeof(*wbs)); if (!wbs) return NULL; @@ -126,7 +124,7 @@ PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry wbs->height = SILCPURPLE_WB_HEIGHT; wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; + purple_whiteboard_set_protocol_data(wb, wbs); /* Start the whiteboard */ purple_whiteboard_start(wb); @@ -147,7 +145,7 @@ PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) if (!wb) return NULL; - if (!wb->proto_data) { + if (!purple_whiteboard_get_protocol_data(wb)) { wbs = silc_calloc(1, sizeof(*wbs)); if (!wbs) return NULL; @@ -157,7 +155,7 @@ PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) wbs->height = SILCPURPLE_WB_HEIGHT; wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; + purple_whiteboard_set_protocol_data(wb, wbs); /* Start the whiteboard */ purple_whiteboard_start(wb); @@ -168,9 +166,10 @@ PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) } static void -silcpurple_wb_parse(SilcPurpleWb wbs, PurpleWhiteboard *wb, +silcpurple_wb_parse(PurpleWhiteboard *wb, unsigned char *message, SilcUInt32 message_len) { + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); SilcUInt8 command; SilcUInt16 width, height, brush_size; SilcUInt32 brush_color, x, y, dx, dy; @@ -238,15 +237,15 @@ silcpurple_wb_request_cb(SilcPurpleWbRequest req, gint id) { PurpleWhiteboard *wb; - if (id != 1) - goto out; + if (id != 1) + goto out; if (!req->channel) wb = silcpurple_wb_init(req->sg, req->sender); else wb = silcpurple_wb_init_ch(req->sg, req->channel); - silcpurple_wb_parse(wb->proto_data, wb, req->message, req->message_len); + silcpurple_wb_parse(wb, req->message, req->message_len); out: silc_free(req->message); @@ -264,7 +263,7 @@ silcpurple_wb_request(SilcClient client, const unsigned char *message, SilcPurple sg; gc = client->application; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); /* Open whiteboard automatically if requested */ if (purple_account_get_bool(sg->account, "open-wb", FALSE)) { @@ -275,7 +274,7 @@ silcpurple_wb_request(SilcClient client, const unsigned char *message, else wb = silcpurple_wb_init_ch(sg, channel); - silcpurple_wb_parse(wb->proto_data, wb, + silcpurple_wb_parse(wb, (unsigned char *)message, message_len); return; @@ -318,12 +317,11 @@ void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, SilcUInt32 message_len) { SilcPurple sg; - PurpleConnection *gc; + PurpleConnection *gc; PurpleWhiteboard *wb; - SilcPurpleWb wbs; gc = client->application; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); wb = purple_whiteboard_get_session(sg->account, sender->nickname); if (!wb) { @@ -333,8 +331,7 @@ void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, return; } - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); + silcpurple_wb_parse(wb, (unsigned char *)message, message_len); } /* Process incoming whiteboard message on channel */ @@ -347,12 +344,11 @@ void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, SilcUInt32 message_len) { SilcPurple sg; - PurpleConnection *gc; + PurpleConnection *gc; PurpleWhiteboard *wb; - SilcPurpleWb wbs; gc = client->application; - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); wb = purple_whiteboard_get_session(sg->account, channel->channel_name); if (!wb) { @@ -362,25 +358,24 @@ void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, return; } - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); + silcpurple_wb_parse(wb, (unsigned char *)message, message_len); } /* Send whiteboard message */ void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); SilcBuffer packet; GList *list; int len; - PurpleConnection *gc; - SilcPurple sg; + PurpleConnection *gc; + SilcPurple sg; g_return_if_fail(draw_list); - gc = purple_account_get_connection(wb->account); + gc = purple_account_get_connection(purple_whiteboard_get_account(wb)); g_return_if_fail(gc); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); g_return_if_fail(sg); len = SILCPURPLE_WB_HEADER; @@ -435,20 +430,22 @@ void silcpurple_wb_start(PurpleWhiteboard *wb) void silcpurple_wb_end(PurpleWhiteboard *wb) { - silc_free(wb->proto_data); - wb->proto_data = NULL; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); + + silc_free(wbs); + purple_whiteboard_set_protocol_data(wb, NULL); } void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); *width = wbs->width; *height = wbs->height; } void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); wbs->width = width > SILCPURPLE_WB_WIDTH_MAX ? SILCPURPLE_WB_WIDTH_MAX : width; wbs->height = height > SILCPURPLE_WB_HEIGHT_MAX ? SILCPURPLE_WB_HEIGHT_MAX : @@ -460,14 +457,14 @@ void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height) void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); *size = wbs->brush_size; *color = wbs->brush_color; } void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); wbs->brush_size = size; wbs->brush_color = color; @@ -477,15 +474,15 @@ void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color) void silcpurple_wb_clear(PurpleWhiteboard *wb) { - SilcPurpleWb wbs = wb->proto_data; + SilcPurpleWb wbs = purple_whiteboard_get_protocol_data(wb); SilcBuffer packet; int len; - PurpleConnection *gc; - SilcPurple sg; + PurpleConnection *gc; + SilcPurple sg; - gc = purple_account_get_connection(wb->account); + gc = purple_account_get_connection(purple_whiteboard_get_account(wb)); g_return_if_fail(gc); - sg = gc->proto_data; + sg = purple_connection_get_protocol_data(gc); g_return_if_fail(sg); len = SILCPURPLE_WB_HEADER; diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c index 73b5120809..706aa646a7 100644 --- a/libpurple/protocols/simple/simple.c +++ b/libpurple/protocols/simple/simple.c @@ -67,7 +67,7 @@ static const char *simple_list_icon(PurpleAccount *a, PurpleBuddy *b) { } static void simple_keep_alive(PurpleConnection *gc) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); if(sip->udp) { /* in case of UDP send a packet only with a 0 byte to remain in the NAT table */ gchar buf[2] = {0, 0}; @@ -100,14 +100,15 @@ static void do_notifies(struct simple_account_data *sip) { } static void simple_set_status(PurpleAccount *account, PurpleStatus *status) { + PurpleConnection *gc = purple_account_get_connection(account); PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_type(status)); struct simple_account_data *sip = NULL; if (!purple_status_is_active(status)) return; - if (account->gc) - sip = account->gc->proto_data; + if (gc) + sip = purple_connection_get_protocol_data(gc); if (sip) { @@ -192,9 +193,9 @@ static void connection_free_all(struct simple_account_data *sip) { } } -static void simple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) +static void simple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) { - struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); struct simple_buddy *b; const char *name = purple_buddy_get_name(buddy); if(strncmp(name, "sip:", 4)) { @@ -222,7 +223,7 @@ static void simple_get_buddies(PurpleConnection *gc) { buddies = purple_find_buddies(account, NULL); while (buddies) { PurpleBuddy *buddy = buddies->data; - simple_add_buddy(gc, buddy, purple_buddy_get_group(buddy)); + simple_add_buddy(gc, buddy, purple_buddy_get_group(buddy), NULL); buddies = g_slist_delete_link(buddies, buddies); } @@ -231,7 +232,7 @@ static void simple_get_buddies(PurpleConnection *gc) { static void simple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { const char *name = purple_buddy_get_name(buddy); - struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); struct simple_buddy *b = g_hash_table_lookup(sip->buddies, name); g_hash_table_remove(sip->buddies, name); g_free(b->name); @@ -412,7 +413,7 @@ static void fill_auth(struct simple_account_data *sip, const gchar *hdr, struct static void simple_canwrite_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); gsize max_write; gssize written; @@ -457,7 +458,7 @@ static void send_later_cb(gpointer data, gint source, const gchar *error_message return; } - sip = gc->proto_data; + sip = purple_connection_get_protocol_data(gc); sip->fd = source; sip->connecting = FALSE; @@ -474,7 +475,7 @@ static void send_later_cb(gpointer data, gint source, const gchar *error_message static void sendlater(PurpleConnection *gc, const char *buf) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); if(!sip->connecting) { purple_debug_info("simple", "connecting to %s port %d\n", sip->realhostname ? sip->realhostname : "{NULL}", sip->realport); @@ -491,7 +492,7 @@ static void sendlater(PurpleConnection *gc, const char *buf) { } static void sendout_pkt(PurpleConnection *gc, const char *buf) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); time_t currtime = time(NULL); int writelen = strlen(buf); @@ -629,7 +630,7 @@ static struct transaction *transactions_find(struct simple_account_data *sip, st static void send_sip_request(PurpleConnection *gc, const gchar *method, const gchar *url, const gchar *to, const gchar *addheaders, const gchar *body, struct sip_dialog *dialog, TransCallback tc) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); char *callid = dialog ? g_strdup(dialog->callid) : gencallid(); char *auth = NULL; const char *addh = ""; @@ -1026,7 +1027,7 @@ static void simple_send_message(struct simple_account_data *sip, const char *to, } static int simple_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); char *to = g_strdup(who); char *text = purple_unescape_html(what); simple_send_message(sip, to, text, NULL); @@ -1120,8 +1121,8 @@ gboolean process_register_response(struct simple_account_data *sip, struct sipms if(sip->registerstatus != SIMPLE_REGISTER_RETRY) { purple_debug_info("simple", "REGISTER retries %d\n", sip->registrar.retries); if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { - if (!purple_account_get_remember_password(sip->gc->account)) - purple_account_set_password(sip->gc->account, NULL); + if (!purple_account_get_remember_password(purple_connection_get_account(sip->gc))) + purple_account_set_password(purple_connection_get_account(sip->gc), NULL); purple_connection_error(sip->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password")); @@ -1285,7 +1286,7 @@ static void process_incoming_notify(struct simple_account_data *sip, struct sipm } static unsigned int simple_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); gchar *xml = "\n" "proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); struct sipmsg *msg; int len; time_t currtime = time(NULL); @@ -1681,7 +1682,7 @@ static void simple_udp_process(gpointer data, gint source, PurpleInputCondition static void simple_input_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); int len; struct sip_connection *conn = connection_find(sip, source); if(!conn) { @@ -1704,7 +1705,7 @@ static void simple_input_cb(gpointer data, gint source, PurpleInputCondition con if(sip->fd == source) sip->fd = -1; return; } - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); conn->inbufused += len; conn->inbuf[conn->inbufused] = '\0'; @@ -1714,7 +1715,7 @@ static void simple_input_cb(gpointer data, gint source, PurpleInputCondition con /* Callback for new connections on incoming TCP port */ static void simple_newconn_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); struct sip_connection *conn; int newfd, flags; @@ -1745,7 +1746,7 @@ static void login_cb(gpointer data, gint source, const gchar *error_message) { return; } - sip = gc->proto_data; + sip = purple_connection_get_protocol_data(gc); sip->fd = source; conn = connection_create(sip, source); @@ -1822,7 +1823,7 @@ static void simple_udp_host_resolved(GSList *hosts, gpointer data, const char *e } /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_DGRAM, + sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_DGRAM, TRUE, simple_udp_host_resolved_listen_cb, sip); if (sip->listen_data == NULL) { purple_connection_error(sip->gc, @@ -1892,7 +1893,7 @@ static void srvresolved(PurpleSrvResponse *resp, int results, gpointer data) { /* TCP case */ if(!sip->udp) { /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_STREAM, + sip->listen_data = purple_network_listen_range(5060, 5160, AF_UNSPEC, SOCK_STREAM, TRUE, simple_tcp_connect_listen_cb, sip); if (sip->listen_data == NULL) { purple_connection_error(sip->gc, @@ -1903,7 +1904,7 @@ static void srvresolved(PurpleSrvResponse *resp, int results, gpointer data) { } else { /* UDP */ purple_debug_info("simple", "using udp with server %s and port %d\n", hostname, port); - sip->query_data = purple_dnsquery_a_account(sip->account, hostname, + sip->query_data = purple_dnsquery_a(sip->account, hostname, port, simple_udp_host_resolved, sip); if (sip->query_data == NULL) { purple_connection_error(sip->gc, @@ -1930,7 +1931,8 @@ static void simple_login(PurpleAccount *account) return; } - gc->proto_data = sip = g_new0(struct simple_account_data, 1); + sip = g_new0(struct simple_account_data, 1); + purple_connection_set_protocol_data(gc, sip); sip->gc = gc; sip->fd = -1; sip->listenfd = -1; @@ -1968,13 +1970,13 @@ static void simple_login(PurpleAccount *account) hosttoconnect = purple_account_get_string(account, "proxy", sip->servername); } - sip->srv_query_data = purple_srv_resolve_account(account, "sip", + sip->srv_query_data = purple_srv_resolve(account, "sip", sip->udp ? "udp" : "tcp", hosttoconnect, srvresolved, sip); } static void simple_close(PurpleConnection *gc) { - struct simple_account_data *sip = gc->proto_data; + struct simple_account_data *sip = purple_connection_get_protocol_data(gc); if (!sip) return; @@ -2005,7 +2007,7 @@ static void simple_close(PurpleConnection *gc) purple_dnsquery_destroy(sip->query_data); if (sip->srv_query_data != NULL) - purple_srv_cancel(sip->srv_query_data); + purple_srv_txt_query_destroy(sip->srv_query_data); if (sip->listen_data != NULL) purple_network_listen_cancel(sip->listen_data); @@ -2039,11 +2041,12 @@ static void simple_close(PurpleConnection *gc) g_free(sip->realhostname); g_free(sip); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ 0, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -2084,7 +2087,6 @@ static PurplePluginProtocolInfo prpl_info = simple_keep_alive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ @@ -2109,15 +2111,12 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* unregister_user */ NULL, /* send_attention */ NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; diff --git a/libpurple/protocols/yahoo/libyahoo.c b/libpurple/protocols/yahoo/libyahoo.c index 4e3d5ce263..0233bfe98c 100644 --- a/libpurple/protocols/yahoo/libyahoo.c +++ b/libpurple/protocols/yahoo/libyahoo.c @@ -194,6 +194,7 @@ static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops = static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -234,7 +235,6 @@ static PurplePluginProtocolInfo prpl_info = yahoo_keepalive, NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ yahoo_update_alias, /* alias_buddy */ yahoo_change_buddys_group, yahoo_rename_group, @@ -257,19 +257,14 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* send_raw */ NULL, /* roomlist_room_serialize */ NULL, /* unregister_user */ - yahoo_send_attention, yahoo_attention_types, - - sizeof(PurplePluginProtocolInfo), /* struct_size */ yahoo_get_account_text_table, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/yahoo/libyahoojp.c b/libpurple/protocols/yahoo/libyahoojp.c index 219603c1fa..c06fd81f28 100644 --- a/libpurple/protocols/yahoo/libyahoojp.c +++ b/libpurple/protocols/yahoo/libyahoojp.c @@ -90,6 +90,7 @@ static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops = static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, NULL, /* user_splits */ NULL, /* protocol_options */ @@ -130,7 +131,6 @@ static PurplePluginProtocolInfo prpl_info = yahoo_keepalive, NULL, /* register_user */ NULL, /* get_cb_info */ - NULL, /* get_cb_away */ yahoo_update_alias, /* alias_buddy */ yahoo_change_buddys_group, yahoo_rename_group, @@ -157,15 +157,12 @@ static PurplePluginProtocolInfo prpl_info = yahoo_send_attention, yahoo_attention_types, - sizeof(PurplePluginProtocolInfo), /* struct_size */ yahoojp_get_account_text_table, /* get_account_text_table */ NULL, /* initiate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c index 4709071580..61736b9b6b 100644 --- a/libpurple/protocols/yahoo/libymsg.c +++ b/libpurple/protocols/yahoo/libymsg.c @@ -337,12 +337,12 @@ static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt) if (!name) break; - b = purple_find_buddy(gc->account, name); + b = purple_find_buddy(purple_connection_get_account(gc), name); if (!cksum || (cksum == -1)) { if (f) yahoo_friend_set_buddy_icon_need_request(f, TRUE); - purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL); + purple_buddy_icons_set_for_user(purple_connection_get_account(gc), name, NULL, 0, NULL); break; } @@ -496,7 +496,7 @@ static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt GSList *l = pkt->hash; PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GHashTable *ht; char *norm_bud = NULL; char *temp = NULL; @@ -573,7 +573,7 @@ static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT); } else { /* This buddy is on the ignore list (and therefore in no group) */ - purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud); + purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n", purple_account_get_username(account), norm_bud); purple_privacy_deny_add(account, norm_bud, 1); } @@ -634,11 +634,10 @@ static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) { GSList *l = pkt->hash; - gboolean export = FALSE; gboolean got_serv_list = FALSE; YahooFriend *f = NULL; PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GHashTable *ht; char **lines; @@ -712,7 +711,6 @@ static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) } b = purple_buddy_new(account, norm_bud, NULL); purple_blist_add_buddy(b, NULL, g, NULL); - export = TRUE; } yahoo_do_group_check(account, ht, norm_bud, grp); @@ -748,13 +746,13 @@ static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) } if (got_serv_list && - ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && - (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) && - (account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS))) + ((purple_account_get_privacy_type(account) != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && + (purple_account_get_privacy_type(account) != PURPLE_PRIVACY_DENY_ALL) && + (purple_account_get_privacy_type(account) != PURPLE_PRIVACY_ALLOW_USERS))) { - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; + purple_account_set_privacy_type(account, PURPLE_PRIVACY_DENY_USERS); purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n", - account->username); + purple_account_get_username(account)); } if (yd->tmp_serv_plist) { @@ -763,7 +761,7 @@ static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) f = yahoo_friend_find(gc, *bud); if (f) { purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", - account->username, *bud); + purple_account_get_username(account), *bud); f->presence = YAHOO_PRESENCE_PERM_OFFLINE; } } @@ -787,7 +785,7 @@ static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, YahooFriend *f = NULL; GSList *l = pkt->hash; gint val_11 = 0; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); YahooFederation fed = YAHOO_FEDERATION_NONE; account = purple_connection_get_account(gc); @@ -899,7 +897,7 @@ static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet char *server_msg = NULL; char *m; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); while (l != NULL) { @@ -960,7 +958,7 @@ static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) { PurpleAccount *account; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GSList *l = pkt->hash; GSList *list = NULL; struct _yahoo_im *im = NULL; @@ -1061,7 +1059,7 @@ static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt doodle_session *ds; wb = purple_whiteboard_create(account, im->from, DOODLE_STATE_REQUESTED); - ds = wb->proto_data; + ds = purple_whiteboard_get_protocol_data(wb); ds->imv_key = g_strdup(pair->value); yahoo_doodle_command_send_request(gc, im->from, pair->value); @@ -1202,7 +1200,7 @@ yahoo_buddy_add_authorize_cb(gpointer data) { struct yahoo_add_request *add_req = data; struct yahoo_packet *pkt; - YahooData *yd = add_req->gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(add_req->gc); const char *who = add_req->who; pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -1233,7 +1231,7 @@ yahoo_buddy_add_authorize_cb(gpointer data) static void yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) { - YahooData *yd = add_req->gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(add_req->gc); struct yahoo_packet *pkt; char *encoded_msg = NULL; const char *who = add_req->who; @@ -1295,7 +1293,7 @@ yahoo_buddy_add_deny_reason_cb(gpointer data) { static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason) { char *notify_msg; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (who == NULL) return; @@ -1625,7 +1623,7 @@ static char *yahoo_decode(const char *text) static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) { PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); const char *who = NULL; const char *email = NULL; const char *subj = NULL; @@ -1709,7 +1707,7 @@ static void to_y64(char *out, const unsigned char *in, gsize inlen) static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); const char *name = purple_normalize(account, purple_account_get_username(account)); PurpleCipher *md5_cipher; @@ -2014,7 +2012,7 @@ static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *url_data, gpointer us gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, TRUE, -1, yahoo_auth16_stage2, auth_data); if (url_data) @@ -2055,7 +2053,7 @@ static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed) g_free(encoded_password); g_free(encoded_username); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, yahoo_auth16_stage1_cb, auth_data); @@ -2180,12 +2178,12 @@ static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) who, (ignore ? "ignoring" : "unignoring")); if (ignore) { - b = purple_find_buddy(gc->account, who); + b = purple_find_buddy(purple_connection_get_account(gc), who); g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the " "user is on your buddy list. Clicking \"Yes\" " "will remove and ignore the buddy."), who); purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, - gc->account, who, NULL, + purple_connection_get_account(gc), who, NULL, b, G_CALLBACK(ignore_buddy), G_CALLBACK(keep_buddy)); @@ -2207,14 +2205,14 @@ static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) { #ifdef TRY_WEBMESSENGER_LOGIN - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); #endif /* TRY_WEBMESSENGER_LOGIN */ GSList *l = pkt->hash; int err = 0; char *msg; char *url = NULL; char *fullmsg; - PurpleAccount *account = gc->account; + PurpleAccount *account = purple_connection_get_account(gc); PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; while (l) { @@ -2244,10 +2242,12 @@ static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pk yd->wm = TRUE; if (yd->fd >= 0) close(yd->fd); - if (gc->inpa) - purple_input_remove(gc->inpa); + if (yd->inpa) { + purple_input_remove(yd->inpa); + yd->inpa = 0; + } url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, - "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc); + "Purple/" VERSION, FALSE, -1, yahoo_login_page_cb, gc); if (url_data != NULL) yd->url_datas = g_slist_prepend(yd->url_datas, url_data); return; @@ -2300,7 +2300,7 @@ static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pk char *buf; YahooFriend *f; GSList *l = pkt->hash; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); YahooFederation fed = YAHOO_FEDERATION_NONE; while (l) { @@ -2394,7 +2394,7 @@ static void yahoo_p2p_keepalive_cb(gpointer key, gpointer value, gpointer user_d PurpleConnection *gc = user_data; struct yahoo_packet *pkt_to_send; PurpleAccount *account; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); @@ -2413,7 +2413,7 @@ static void yahoo_p2p_keepalive_cb(gpointer key, gpointer value, gpointer user_d static gboolean yahoo_p2p_keepalive(gpointer data) { PurpleConnection *gc = data; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); g_hash_table_foreach(yd->peers, yahoo_p2p_keepalive_cb, gc); @@ -2460,7 +2460,7 @@ static void yahoo_p2p_process_p2pfilexfer(gpointer data, gint source, struct yah if(!(p2p_data = data)) return ; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); /* lets see whats in the packet */ while (l) { @@ -2545,7 +2545,7 @@ static void yahoo_p2p_read_pkt_cb(gpointer data, gint source, PurpleInputConditi if(!(p2p_data = data)) return ; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); len = read(source, buf, sizeof(buf)); if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) @@ -2617,7 +2617,7 @@ static void yahoo_p2p_server_send_connected_cb(gpointer data, gint source, Purpl if(!(p2p_data = data)) return ; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); acceptfd = accept(source, NULL, 0); if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) @@ -2657,7 +2657,7 @@ static gboolean yahoo_cancel_p2p_server_listen_cb(gpointer data) if(!(p2p_data = data)) return FALSE; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect\n"); yahoo_p2p_disconnect_destroy_data(data); @@ -2678,7 +2678,7 @@ static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data) if(!(p2p_data = data)) return ; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); yd->listen_data = NULL; if(listenfd == -1) { @@ -2706,7 +2706,7 @@ void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13) YahooFriend *f; struct yahoo_packet *pkt; PurpleAccount *account; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_p2p_data *p2p_data; const char *norm_username; @@ -2770,7 +2770,7 @@ void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13) if (yd->listen_data) purple_debug_warning("yahoo","p2p: Failed to create p2p server - server already exists\n"); else { - yd->listen_data = purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data); + yd->listen_data = purple_network_listen(YAHOO_PAGER_PORT_P2P, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_server_listen_cb, p2p_data); if (yd->listen_data == NULL) purple_debug_warning("yahoo","p2p: Failed to created p2p server\n"); } @@ -2787,7 +2787,7 @@ static void yahoo_p2p_init_cb(gpointer data, gint source, const gchar *error_mes YahooData *yd; p2p_data = data; - yd = p2p_data->gc->proto_data; + yd = purple_connection_get_protocol_data(p2p_data->gc); if(error_message != NULL) { purple_debug_warning("yahoo","p2p: %s\n",error_message); @@ -3132,7 +3132,7 @@ static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt) static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); char buf[1024]; int len; @@ -3155,7 +3155,7 @@ static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) _("Server closed the connection")); return; } - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); memcpy(yd->rxqueue + yd->rxlen, buf, len); yd->rxlen += len; @@ -3240,15 +3240,15 @@ static void yahoo_got_connected(gpointer data, gint source, const gchar *error_m return; } - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); yd->fd = source; pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, yd->session_id); - yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc)))); + yahoo_packet_hash_str(pkt, 1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc)))); yahoo_packet_send_and_free(pkt, yd); - gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); + yd->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); } #ifdef TRY_WEBMESSENGER_LOGIN @@ -3266,26 +3266,26 @@ static void yahoo_got_web_connected(gpointer data, gint source, const gchar *err return; } - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); yd->fd = source; pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, yd->session_id); yahoo_packet_hash(pkt, "sss", 0, - purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), - 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), + purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))), + 1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))), 6, yd->auth); yahoo_packet_send_and_free(pkt, yd); g_free(yd->auth); - gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); + yd->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); } static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); char bufread[2048], *i = bufread, *buf = bufread; int len; GString *s; @@ -3342,7 +3342,8 @@ static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition c } yd->auth = g_string_free(s, FALSE); - purple_input_remove(gc->inpa); + purple_input_remove(yd->inpa); + yd->inpa = 0; close(source); g_free(yd->rxqueue); yd->rxqueue = NULL; @@ -3359,13 +3360,10 @@ static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition c static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) { - PurpleConnection *gc; - YahooData *yd; + PurpleConnection *gc = data; + YahooData *yd = purple_connection_get_protocol_data(gc); int written, remaining; - gc = data; - yd = gc->proto_data; - remaining = strlen(yd->auth) - yd->auth_written; written = write(source, yd->auth + yd->auth_written, remaining); @@ -3375,9 +3373,10 @@ static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCon gchar *tmp; g_free(yd->auth); yd->auth = NULL; - if (gc->inpa) - purple_input_remove(gc->inpa); - gc->inpa = 0; + if (yd->inpa) { + purple_input_remove(yd->inpa); + yd->inpa = 0; + } tmp = g_strdup_printf(_("Lost connection with %s: %s"), "login.yahoo.com:80", g_strerror(errno)); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); @@ -3393,13 +3392,14 @@ static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCon g_free(yd->auth); yd->auth = NULL; yd->auth_written = 0; - purple_input_remove(gc->inpa); - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); + purple_input_remove(yd->inpa); + yd->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); } static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message) { PurpleConnection *gc = data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (source < 0) { gchar *tmp; @@ -3410,9 +3410,9 @@ static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_mes return; } - if (gc->inpa == 0) + if (yd->inpa == 0) { - gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, + yd->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, yahoo_got_cookies_send_cb, gc); yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE); } @@ -3474,7 +3474,7 @@ yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, { PurpleConnection *gc = (PurpleConnection *)user_data; PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); const char *sn = purple_account_get_username(account); const char *pass = purple_connection_get_password(gc); GHashTable *hash = yahoo_login_page_hash(url_text, len); @@ -3671,13 +3671,14 @@ static void yahoo_got_pager_server(PurpleUtilFetchUrlData *url_data, void yahoo_login(PurpleAccount *account) { PurpleConnection *gc = purple_account_get_connection(account); - YahooData *yd = gc->proto_data = g_new0(YahooData, 1); + YahooData *yd = g_new0(YahooData, 1); PurpleStatus *status = purple_account_get_active_status(account); gboolean use_whole_url = yahoo_account_use_http_proxy(gc); gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); PurpleUtilFetchUrlData *url_data; - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; + purple_connection_set_protocol_data(gc, yd); + purple_connection_set_flags(gc, PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC); purple_connection_update_progress(gc, _("Connecting"), 1, 2); @@ -3708,7 +3709,7 @@ void yahoo_login(PurpleAccount *account) { /* Get the pager server. Actually start connecting in the callback since we * must have the contents of the HTTP response to proceed. */ - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( proxy_ssl ? purple_connection_get_account(gc) : NULL, yd->jp ? YAHOOJP_PAGER_HOST_REQ_URL : YAHOO_PAGER_HOST_REQ_URL, use_whole_url ? TRUE : FALSE, @@ -3721,11 +3722,13 @@ void yahoo_login(PurpleAccount *account) { } void yahoo_close(PurpleConnection *gc) { - YahooData *yd = (YahooData *)gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GSList *l; - if (gc->inpa) - purple_input_remove(gc->inpa); + if (yd->inpa) { + purple_input_remove(yd->inpa); + yd->inpa = 0; + } while (yd->url_datas) { purple_util_fetch_url_cancel(yd->url_datas->data); @@ -3810,7 +3813,7 @@ void yahoo_close(PurpleConnection *gc) { g_free(yd->current_list15_grp); g_free(yd); - gc->proto_data = NULL; + purple_connection_set_protocol_data(gc, NULL); } const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b) @@ -3827,7 +3830,7 @@ const char *yahoo_list_emblem(PurpleBuddy *b) if (!b || !(account = purple_buddy_get_account(b)) || !(gc = purple_account_get_connection(account)) || - !gc->proto_data) + !purple_connection_get_protocol_data(gc)) return NULL; f = yahoo_friend_find(gc, purple_buddy_get_name(b)); @@ -3892,7 +3895,7 @@ static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) { buddy = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); id = yd->conf_id; components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); @@ -4055,7 +4058,7 @@ static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data) buddy = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - yahoo_add_buddy(gc, buddy, NULL); + yahoo_add_buddy(gc, buddy, NULL, NULL); } @@ -4075,7 +4078,7 @@ static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data) static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { GList *m = NULL; PurpleMenuAction *act; - YahooData *yd = (YahooData *) gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (yd->current_status == YAHOO_STATUS_INVISIBLE) { if (f->presence != YAHOO_PRESENCE_ONLINE) { @@ -4135,7 +4138,7 @@ static GList *yahoo_buddy_menu(PurpleBuddy *buddy) PurpleMenuAction *act; PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); static char buf2[1024]; YahooFriend *f; @@ -4218,7 +4221,7 @@ GList *yahoo_blist_node_menu(PurpleBlistNode *node) static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")]; struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -4235,7 +4238,7 @@ yahoo_get_inbox_token_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, PurpleConnection *gc = user_data; gboolean set_cookie = FALSE; gchar *url; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); @@ -4271,7 +4274,7 @@ static void yahoo_show_inbox(PurplePluginAction *action) /* XXX I have no idea how this will work with Yahoo! Japan. */ PurpleConnection *gc = action->context; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleUtilFetchUrlData *url_data; const char* base_url = "http://login.yahoo.com"; @@ -4286,7 +4289,7 @@ static void yahoo_show_inbox(PurplePluginAction *action) use_whole_url ? base_url : "", yd->cookie_t, yd->cookie_y); - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), base_url, use_whole_url, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_get_inbox_token_cb, gc); @@ -4385,7 +4388,7 @@ static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer { struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data; PurpleConnection *gc = sms_cb_data->gc; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); char *status = NULL; char *carrier = NULL; PurpleAccount *account = purple_connection_get_account(gc); @@ -4440,7 +4443,7 @@ static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleUtilFetchUrlData *url_data; struct yahoo_sms_carrier_cb_data *sms_cb_data; char *validate_request_str = NULL; @@ -4475,10 +4478,10 @@ static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str); /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) + if ((purple_account_get_proxy_info(purple_connection_get_account(gc))) && (purple_proxy_info_get_type(purple_account_get_proxy_info(purple_connection_get_account(gc))) == PURPLE_PROXY_HTTP)) use_whole_url = TRUE; - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_get_sms_carrier_cb, data); @@ -4500,7 +4503,7 @@ static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt = NULL; char *msg = yahoo_html_to_codes(what); char *msg2; @@ -4611,7 +4614,7 @@ int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, Purpl * * If they have not set an IMVironment, then use the default. */ - wb = purple_whiteboard_get_session(gc->account, who); + wb = purple_whiteboard_get_session(purple_connection_get_account(gc), who); if (wb) yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY); else @@ -4657,7 +4660,7 @@ int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, Purpl unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_p2p_data *p2p_data; YahooFederation fed = YAHOO_FEDERATION_NONE; struct yahoo_packet *pkt = NULL; @@ -4728,7 +4731,7 @@ void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) gc = purple_account_get_connection(account); presence = purple_status_get_presence(status); - yd = (YahooData *)gc->proto_data; + yd = purple_connection_get_protocol_data(gc); old_status = yd->current_status; yd->current_status = get_yahoo_status_from_purple_status(status); @@ -4794,7 +4797,7 @@ void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) void yahoo_set_idle(PurpleConnection *gc, int idle) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt = NULL; char *msg = NULL, *msg2 = NULL; PurpleStatus *status = NULL; @@ -4913,7 +4916,7 @@ GList *yahoo_status_types(PurpleAccount *account) void yahoo_keepalive(PurpleConnection *gc) { struct yahoo_packet *pkt; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); time_t now = time(NULL); /* We're only allowed to send a ping once an hour or the servers will boot us */ @@ -4944,9 +4947,9 @@ void yahoo_keepalive(PurpleConnection *gc) } -void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) +void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g, const char *message) { - YahooData *yd = (YahooData *)gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; const char *group = NULL; char *group2; @@ -5009,7 +5012,7 @@ void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - YahooData *yd = (YahooData *)gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; GSList *buddies, *l; PurpleGroup *g; @@ -5065,7 +5068,7 @@ void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g } void yahoo_add_deny(PurpleConnection *gc, const char *who) { - YahooData *yd = (YahooData *)gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; YahooFederation fed = YAHOO_FEDERATION_NONE; @@ -5088,7 +5091,7 @@ void yahoo_add_deny(PurpleConnection *gc, const char *who) { } void yahoo_rem_deny(PurpleConnection *gc, const char *who) { - YahooData *yd = (YahooData *)gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; YahooFederation fed = YAHOO_FEDERATION_NONE; @@ -5116,7 +5119,7 @@ void yahoo_set_permit_deny(PurpleConnection *gc) account = purple_connection_get_account(gc); - switch (account->perm_deny) + switch (purple_account_get_privacy_type(account)) { case PURPLE_PRIVACY_ALLOW_ALL: for (deny = account->deny; deny; deny = deny->next) @@ -5136,7 +5139,7 @@ void yahoo_set_permit_deny(PurpleConnection *gc) void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; char *gpn, *gpo; YahooFriend *f = yahoo_friend_find(gc, who); @@ -5183,7 +5186,7 @@ void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, void yahoo_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; char *gpn, *gpo; @@ -5212,7 +5215,7 @@ yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gcha if (*args && args[0]) return PURPLE_CMD_RET_FAILED; - purple_prpl_send_attention(account->gc, c->name, YAHOO_BUZZ); + purple_prpl_send_attention(purple_account_get_connection(account), purple_conversation_get_name(c), YAHOO_BUZZ); return PURPLE_CMD_RET_OK; } @@ -5227,7 +5230,7 @@ yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, if (!args || !args[0]) return PURPLE_CMD_RET_FAILED; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); purple_debug_info("yahoo", "Trying to join %s \n", args[0]); comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); @@ -5261,12 +5264,12 @@ gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint PurpleConversation *c; c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - username, gc->account); + username, purple_connection_get_account(gc)); g_return_val_if_fail(c != NULL, FALSE); purple_debug_info("yahoo", "Sending on account %s to buddy %s.\n", - username, c->name); + username, purple_conversation_get_name(c)); purple_conv_im_send_with_flags(PURPLE_CONV_IM(c), "", PURPLE_MESSAGE_INVISIBLE); return TRUE; diff --git a/libpurple/protocols/yahoo/libymsg.h b/libpurple/protocols/yahoo/libymsg.h index 3dea10bfee..31bfade8d0 100644 --- a/libpurple/protocols/yahoo/libymsg.h +++ b/libpurple/protocols/yahoo/libymsg.h @@ -188,6 +188,7 @@ typedef struct _YahooPersonalDetails { typedef struct { PurpleConnection *gc; int fd; + guint inpa; guchar *rxqueue; int rxlen; PurpleCircBuffer *txbuf; @@ -371,7 +372,7 @@ int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, Purpl unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state); void yahoo_set_status(PurpleAccount *account, PurpleStatus *status); void yahoo_set_idle(PurpleConnection *gc, int idle); -void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g); +void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g, const char *message); void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); void yahoo_add_deny(PurpleConnection *gc, const char *who); void yahoo_rem_deny(PurpleConnection *gc, const char *who); diff --git a/libpurple/protocols/yahoo/util.c b/libpurple/protocols/yahoo/util.c index bcfede658e..ab382af554 100644 --- a/libpurple/protocols/yahoo/util.c +++ b/libpurple/protocols/yahoo/util.c @@ -63,8 +63,9 @@ gchar* yahoo_get_cookies(PurpleConnection *gc) char firstflag = 1; gchar *t1,*t2,*t3; GSList *tmp; - GSList *cookies; - cookies = ((YahooData*)(gc->proto_data))->cookies; + YahooData *yd = purple_connection_get_protocol_data(gc); + GSList *cookies = yd->cookies; + tmp = cookies; while(tmp) { @@ -129,7 +130,7 @@ gchar* yahoo_get_cookies(PurpleConnection *gc) */ char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); char *ret; const char *to_codeset; @@ -158,7 +159,7 @@ char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8) */ char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); char *ret; const char *from_codeset; diff --git a/libpurple/protocols/yahoo/yahoo_aliases.c b/libpurple/protocols/yahoo/yahoo_aliases.c index 00a22894dc..c790f156a9 100644 --- a/libpurple/protocols/yahoo/yahoo_aliases.c +++ b/libpurple/protocols/yahoo/yahoo_aliases.c @@ -74,7 +74,7 @@ static void yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) { PurpleConnection *gc = user_data; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); yd->url_datas = g_slist_remove(yd->url_datas, url_data); @@ -186,7 +186,7 @@ yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, con void yahoo_fetch_aliases(PurpleConnection *gc) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); const char *url; gchar *request, *webpage, *webaddress; PurpleUtilFetchUrlData *url_data; @@ -207,7 +207,7 @@ yahoo_fetch_aliases(PurpleConnection *gc) webaddress); /* We have a URL and some header information, let's connect and get some aliases */ - url_data = purple_util_fetch_url_request_len(purple_connection_get_account(gc), + url_data = purple_util_fetch_url_request(purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, request, FALSE, -1, yahoo_fetch_aliases_cb, gc); if (url_data != NULL) @@ -230,7 +230,7 @@ yahoo_update_alias_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, cons PurpleConnection *gc = cb->gc; YahooData *yd; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); yd->url_datas = g_slist_remove(yd->url_datas, url_data); if (len == 0 || error_message != NULL) { @@ -310,7 +310,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) return; } - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); /* Using callback_data so I have access to gc in the callback function */ cb = g_new0(struct callback_data, 1); @@ -331,7 +331,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); content = g_strdup_printf("\n" "\n\r\n", - purple_account_get_username(gc->account), + purple_account_get_username(purple_connection_get_account(gc)), who, converted_alias_jp); g_free(converted_alias_jp); g_free(alias_jp); @@ -339,7 +339,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) gchar *escaped_alias = g_markup_escape_text(alias, -1); content = g_strdup_printf("\n" "\n\r\n", - purple_account_get_username(gc->account), + purple_account_get_username(purple_connection_get_account(gc)), who, escaped_alias); g_free(escaped_alias); } @@ -351,7 +351,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); content = g_strdup_printf("\n" "\n\r\n", - purple_account_get_username(gc->account), + purple_account_get_username(purple_connection_get_account(gc)), who, cb->id, converted_alias_jp); g_free(converted_alias_jp); g_free(alias_jp); @@ -359,7 +359,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) gchar *escaped_alias = g_markup_escape_text(alias, -1); content = g_strdup_printf("\n" "\n\r\n", - purple_account_get_username(gc->account), + purple_account_get_username(purple_connection_get_account(gc)), who, cb->id, escaped_alias); g_free(escaped_alias); } @@ -379,7 +379,7 @@ yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) content); /* We have a URL and some header information, let's connect and update the alias */ - url_data = purple_util_fetch_url_request_len( + url_data = purple_util_fetch_url_request( purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, request, FALSE, -1, yahoo_update_alias_cb, cb); if (url_data != NULL) @@ -517,7 +517,7 @@ yahoo_set_userinfo_cb(PurpleConnection *gc, PurpleRequestFields *fields) } #endif - url_data = purple_util_fetch_url_request_len(account, webaddress, FALSE, + url_data = purple_util_fetch_url_request(account, webaddress, FALSE, YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, yahoo_fetch_aliases_cb, gc); if (url_data != NULL) diff --git a/libpurple/protocols/yahoo/yahoo_doodle.c b/libpurple/protocols/yahoo/yahoo_doodle.c index f3f44a2631..972b8f4c5b 100644 --- a/libpurple/protocols/yahoo/yahoo_doodle.c +++ b/libpurple/protocols/yahoo/yahoo_doodle.c @@ -161,7 +161,7 @@ static void yahoo_doodle_command_got_request(PurpleConnection *gc, const char *f */ wb = purple_whiteboard_create(account, from, DOODLE_STATE_REQUESTED); - ds = wb->proto_data; + ds = purple_whiteboard_get_protocol_data(wb); ds->imv_key = g_strdup(imv_key); yahoo_doodle_command_send_ready(gc, from, imv_key); @@ -189,19 +189,19 @@ static void yahoo_doodle_command_got_ready(PurpleConnection *gc, const char *fro if(wb == NULL) return; - if(wb->state == DOODLE_STATE_REQUESTING) + if(purple_whiteboard_get_state(wb) == DOODLE_STATE_REQUESTING) { - doodle_session *ds = wb->proto_data; + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); purple_whiteboard_start(wb); - wb->state = DOODLE_STATE_ESTABLISHED; + purple_whiteboard_set_state(wb, DOODLE_STATE_ESTABLISHED); yahoo_doodle_command_send_confirm(gc, from, imv_key); /* Let's steal the imv_key and reuse it */ g_free(ds->imv_key); ds->imv_key = g_strdup(imv_key); } - else if(wb->state == DOODLE_STATE_ESTABLISHED) + else if(purple_whiteboard_get_state(wb) == DOODLE_STATE_ESTABLISHED) { /* TODO Ask whether to save picture too */ purple_whiteboard_clear(wb); @@ -211,7 +211,7 @@ static void yahoo_doodle_command_got_ready(PurpleConnection *gc, const char *fro * already thinks we're in a session with them (when their chat message * contains the doodle imv key) */ - else if(wb->state == DOODLE_STATE_REQUESTED) + else if(purple_whiteboard_get_state(wb) == DOODLE_STATE_REQUESTED) { /* purple_whiteboard_start(wb); */ yahoo_doodle_command_send_ready(gc, from, imv_key); @@ -292,7 +292,7 @@ static void yahoo_doodle_command_got_clear(PurpleConnection *gc, const char *fro if(wb == NULL) return; - if(wb->state == DOODLE_STATE_ESTABLISHED) + if(purple_whiteboard_get_state(wb) == DOODLE_STATE_ESTABLISHED) { /* TODO Ask user whether to save the image before clearing it */ @@ -333,9 +333,9 @@ static void yahoo_doodle_command_got_confirm(PurpleConnection *gc, const char *f /* TODO Combine the following IF's? */ /* Check if we requested a doodle session */ - /*if(wb->state == DOODLE_STATE_REQUESTING) + /*if(purple_whiteboard_get_state(wb) == DOODLE_STATE_REQUESTING) { - wb->state = DOODLE_STATE_ESTABLISHED; + purple_whiteboard_set_state(wb, DOODLE_STATE_ESTABLISHED); purple_whiteboard_start(wb); @@ -343,9 +343,9 @@ static void yahoo_doodle_command_got_confirm(PurpleConnection *gc, const char *f }*/ /* Check if we accepted a request for a doodle session */ - if(wb->state == DOODLE_STATE_REQUESTED) + if(purple_whiteboard_get_state(wb) == DOODLE_STATE_REQUESTED) { - wb->state = DOODLE_STATE_ESTABLISHED; + purple_whiteboard_set_state(wb, DOODLE_STATE_ESTABLISHED); purple_whiteboard_start(wb); } @@ -372,7 +372,7 @@ void yahoo_doodle_command_got_shutdown(PurpleConnection *gc, const char *from) /* TODO Ask if user wants to save picture before the session is closed */ - wb->state = DOODLE_STATE_CANCELLED; + purple_whiteboard_set_state(wb, DOODLE_STATE_CANCELLED); purple_whiteboard_destroy(wb); } @@ -389,12 +389,12 @@ static void yahoo_doodle_command_send_generic(const char *type, purple_debug_info("yahoo", "doodle: Sent %s (%s)\n", type, to); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); /* Make and send an acknowledge (ready) Doodle packet */ pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); yahoo_packet_hash_str(pkt, 49, "IMVIRONMENT"); - yahoo_packet_hash_str(pkt, 1, purple_account_get_username(gc->account)); + yahoo_packet_hash_str(pkt, 1, purple_account_get_username(purple_connection_get_account(gc))); yahoo_packet_hash_str(pkt, 14, message); yahoo_packet_hash_int(pkt, 13, command); yahoo_packet_hash_str(pkt, 5, to); @@ -450,21 +450,23 @@ void yahoo_doodle_start(PurpleWhiteboard *wb) ds->brush_size = DOODLE_BRUSH_SMALL; ds->brush_color = DOODLE_COLOR_RED; - wb->proto_data = ds; + purple_whiteboard_set_protocol_data(wb, ds); } void yahoo_doodle_end(PurpleWhiteboard *wb) { - PurpleConnection *gc = purple_account_get_connection(wb->account); - doodle_session *ds = wb->proto_data; + PurpleAccount *account = purple_whiteboard_get_account(wb); + PurpleConnection *gc = purple_account_get_connection(account); + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); /* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */ - if (gc && wb->state != DOODLE_STATE_CANCELLED) - yahoo_doodle_command_send_shutdown(gc, wb->who); + if (gc && (purple_whiteboard_get_state(wb) != DOODLE_STATE_CANCELLED)) + yahoo_doodle_command_send_shutdown(gc, purple_whiteboard_get_who(wb)); g_free(ds->imv_key); - g_free(wb->proto_data); + g_free(ds); + purple_whiteboard_set_protocol_data(wb, NULL); } void yahoo_doodle_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) @@ -494,20 +496,25 @@ static char *yahoo_doodle_build_draw_string(doodle_session *ds, GList *draw_list void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list) { - doodle_session *ds = wb->proto_data; + PurpleAccount *account = purple_whiteboard_get_account(wb); + PurpleConnection *gc = purple_account_get_connection(account); + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); char *message; g_return_if_fail(draw_list != NULL); message = yahoo_doodle_build_draw_string(ds, draw_list); - yahoo_doodle_command_send_draw(wb->account->gc, wb->who, message, ds->imv_key); + yahoo_doodle_command_send_draw(gc, purple_whiteboard_get_who(wb), message, ds->imv_key); g_free(message); } void yahoo_doodle_clear(PurpleWhiteboard *wb) { - doodle_session *ds = wb->proto_data; - yahoo_doodle_command_send_clear(wb->account->gc, wb->who, ds->imv_key); + PurpleAccount *account = purple_whiteboard_get_account(wb); + PurpleConnection *gc = purple_account_get_connection(account); + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); + + yahoo_doodle_command_send_clear(gc, purple_whiteboard_get_who(wb), ds->imv_key); } @@ -560,14 +567,14 @@ void yahoo_doodle_draw_stroke(PurpleWhiteboard *wb, GList *draw_list) void yahoo_doodle_get_brush(const PurpleWhiteboard *wb, int *size, int *color) { - doodle_session *ds = wb->proto_data; + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); *size = ds->brush_size; *color = ds->brush_color; } void yahoo_doodle_set_brush(PurpleWhiteboard *wb, int size, int color) { - doodle_session *ds = wb->proto_data; + doodle_session *ds = purple_whiteboard_get_protocol_data(wb); ds->brush_size = size; ds->brush_color = color; diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c index bf87dbe2ab..1b0ff85187 100644 --- a/libpurple/protocols/yahoo/yahoo_filexfer.c +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c @@ -43,7 +43,7 @@ struct yahoo_xfer_data { PurpleConnection *gc; long expires; gboolean started; - gchar *txbuf; + guchar *txbuf; gsize txbuflen; gsize txbuf_written; guint tx_handler; @@ -85,7 +85,7 @@ static void yahoo_xfer_data_free(struct yahoo_xfer_data *xd) GSList *l; gc = xd->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); /* remove entry from map */ if(xd->xfer_peer_idstring) { @@ -120,13 +120,13 @@ static void yahoo_receivefile_send_cb(gpointer data, gint source, PurpleInputCon { PurpleXfer *xfer; struct yahoo_xfer_data *xd; - int remaining, written; + gssize remaining, written; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; - written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); + written = purple_xfer_write(xfer, xd->txbuf + xd->txbuf_written, remaining); if (written < 0 && errno == EAGAIN) written = 0; @@ -160,22 +160,23 @@ static void yahoo_receivefile_connected(gpointer data, gint source, const gchar if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); + purple_xfer_get_remote_user(xfer), _("Unable to connect.")); purple_xfer_cancel_remote(xfer); return; } - xfer->fd = source; + purple_xfer_set_fd(xfer, source); /* The first time we get here, assemble the tx buffer */ if (xd->txbuflen == 0) { - xd->txbuf = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n", + gchar *header = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n", xd->path, xd->host); - xd->txbuflen = strlen(xd->txbuf); + xd->txbuf = (guchar*) header; + xd->txbuflen = strlen(header); xd->txbuf_written = 0; } @@ -191,13 +192,13 @@ static void yahoo_sendfile_send_cb(gpointer data, gint source, PurpleInputCondit { PurpleXfer *xfer; struct yahoo_xfer_data *xd; - int written, remaining; + gssize written, remaining; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; - written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); + written = purple_xfer_write(xfer, xd->txbuf + xd->txbuf_written, remaining); if (written < 0 && errno == EAGAIN) written = 0; @@ -239,32 +240,32 @@ static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *er if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; if (source < 0) { purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); + purple_xfer_get_remote_user(xfer), _("Unable to connect.")); purple_xfer_cancel_remote(xfer); return; } - xfer->fd = source; + purple_xfer_set_fd(xfer, source); /* Assemble the tx buffer */ gc = xd->gc; account = purple_connection_get_account(gc); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, YAHOO_STATUS_AVAILABLE, yd->session_id); - size = g_strdup_printf("%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); + size = g_strdup_printf("%" G_GOFFSET_FORMAT, purple_xfer_get_size(xfer)); filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); encoded_filename = yahoo_string_encode(gc, filename, NULL); yahoo_packet_hash(pkt, "sssss", 0, purple_connection_get_display_name(gc), - 5, xfer->who, 14, "", 27, encoded_filename, 28, size); + 5, purple_xfer_get_remote_user(xfer), 14, "", 27, encoded_filename, 28, size); g_free(size); g_free(encoded_filename); g_free(filename); @@ -278,7 +279,7 @@ static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *er port = purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT); header = g_strdup_printf( "POST http://%s:%d/notifyft HTTP/1.0\r\n" - "Content-length: %" G_GSIZE_FORMAT "\r\n" + "Content-length: %" G_GOFFSET_FORMAT "\r\n" "Host: %s:%d\r\n" "Cookie: Y=%s; T=%s\r\n" "\r\n", @@ -313,9 +314,9 @@ static void yahoo_xfer_init(PurpleXfer *xfer) PurpleAccount *account; YahooData *yd; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); gc = xfer_data->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { @@ -339,7 +340,7 @@ static void yahoo_xfer_init(PurpleXfer *xfer) } } } else { - xfer->fd = -1; + purple_xfer_set_fd(xfer, -1); if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, yahoo_receivefile_connected, xfer) == NULL) { purple_notify_error(gc, NULL, _("File Transfer Failed"), @@ -357,9 +358,9 @@ static void yahoo_xfer_init_15(PurpleXfer *xfer) YahooData *yd; struct yahoo_packet *pkt; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); gc = xfer_data->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { @@ -370,14 +371,14 @@ static void yahoo_xfer_init_15(PurpleXfer *xfer) yd->session_id); yahoo_packet_hash(pkt, "sssiiiisiii", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 222, 1, 266, 1, 302, 268, 300, 268, 27, filename, - 28, xfer->size, + 28, (int)purple_xfer_get_size(xfer), 301, 268, 303, 268); g_free(filename); @@ -388,7 +389,7 @@ static void yahoo_xfer_init_15(PurpleXfer *xfer) yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 222, 3); } else { @@ -397,7 +398,7 @@ static void yahoo_xfer_init_15(PurpleXfer *xfer) yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 271, 1); } @@ -410,14 +411,14 @@ static void yahoo_xfer_start(PurpleXfer *xfer) /* We don't need to do anything here, do we? */ } -static guint calculate_length(const gchar *l, size_t len) +static goffset calculate_length(const gchar *l, size_t len) { int i; for (i = 0; i < len; i++) { if (!g_ascii_isdigit(l[i])) continue; - return strtol(l + i, NULL, 10); + return g_ascii_strtoll(l + i, NULL, 10); } return 0; } @@ -429,14 +430,14 @@ static gssize yahoo_xfer_read(guchar **buffer, PurpleXfer *xfer) gchar *start = NULL; gchar *length; gchar *end; - int filelen; - struct yahoo_xfer_data *xd = xfer->data; + goffset filelen; + struct yahoo_xfer_data *xd = purple_xfer_get_protocol_data(xfer); if (purple_xfer_get_type(xfer) != PURPLE_XFER_RECEIVE) { return 0; } - len = read(xfer->fd, buf, sizeof(buf)); + len = read(purple_xfer_get_fd(xfer), buf, sizeof(buf)); if (len <= 0) { if ((purple_xfer_get_size(xfer) > 0) && @@ -490,7 +491,7 @@ static gssize yahoo_xfer_read(guchar **buffer, PurpleXfer *xfer) static gssize yahoo_xfer_write(const guchar *buffer, size_t size, PurpleXfer *xfer) { gssize len; - struct yahoo_xfer_data *xd = xfer->data; + struct yahoo_xfer_data *xd = purple_xfer_get_protocol_data(xfer); if (!xd) return -1; @@ -499,7 +500,7 @@ static gssize yahoo_xfer_write(const guchar *buffer, size_t size, PurpleXfer *xf return -1; } - len = write(xfer->fd, buffer, size); + len = write(purple_xfer_get_fd(xfer), buffer, size); if (len == -1) { if (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer)) @@ -516,7 +517,7 @@ static void yahoo_xfer_cancel_send(PurpleXfer *xfer) { struct yahoo_xfer_data *xfer_data; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) { @@ -526,7 +527,7 @@ static void yahoo_xfer_cancel_send(PurpleXfer *xfer) struct yahoo_packet *pkt; gc = xfer_data->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); if(xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */ { @@ -535,7 +536,7 @@ static void yahoo_xfer_cancel_send(PurpleXfer *xfer) yd->session_id); yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 66, -1); } @@ -546,7 +547,7 @@ static void yahoo_xfer_cancel_send(PurpleXfer *xfer) yd->session_id); yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 222, 2); } @@ -556,14 +557,14 @@ static void yahoo_xfer_cancel_send(PurpleXfer *xfer) if (xfer_data) yahoo_xfer_data_free(xfer_data); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) { struct yahoo_xfer_data *xfer_data; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) { @@ -574,7 +575,7 @@ static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) struct yahoo_packet *pkt; gc = xfer_data->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); account = purple_connection_get_account(gc); if(!xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */ { @@ -583,7 +584,7 @@ static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) yd->session_id); yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 222, 4); } @@ -594,7 +595,7 @@ static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) yd->session_id); yahoo_packet_hash(pkt, "sssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, 66, -1); } @@ -603,7 +604,7 @@ static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) if (xfer_data) yahoo_xfer_data_free(xfer_data); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } /* Send HTTP OK after receiving file */ @@ -611,9 +612,10 @@ static void yahoo_p2p_ft_server_send_OK(PurpleXfer *xfer) { char *tx = NULL; int written; + int fd = purple_xfer_get_fd(xfer); - tx = g_strdup_printf("HTTP/1.1 200 OK\r\nContent-Length: 0\r\nContent-Type: application/octet-stream\r\nConnection: close\r\n\r\n"); - written = write(xfer->fd, tx, strlen(tx)); + tx = "HTTP/1.1 200 OK\r\nContent-Length: 0\r\nContent-Type: application/octet-stream\r\nConnection: close\r\n\r\n"; + written = write(fd, tx, strlen(tx)); if (written < 0 && errno == EAGAIN) written = 0; @@ -621,9 +623,8 @@ static void yahoo_p2p_ft_server_send_OK(PurpleXfer *xfer) purple_debug_info("yahoo", "p2p filetransfer: Unable to write HTTP OK"); /* close connection */ - close(xfer->fd); - xfer->fd = -1; - g_free(tx); + close(fd); + purple_xfer_set_fd(xfer, -1); } static void yahoo_xfer_end(PurpleXfer *xfer_old) @@ -633,13 +634,13 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) PurpleConnection *gc; YahooData *yd; - xfer_data = xfer_old->data; + xfer_data = purple_xfer_get_protocol_data(xfer_old); if(xfer_data && xfer_data->version == 15 && purple_xfer_get_type(xfer_old) == PURPLE_XFER_RECEIVE && xfer_data->filename_list) { /* Send HTTP OK in case of p2p transfer, when we act as server */ - if((xfer_data->xfer_url != NULL) && (xfer_old->fd >=0) && (purple_xfer_get_status(xfer_old) == PURPLE_XFER_STATUS_DONE)) + if((xfer_data->xfer_url != NULL) && (purple_xfer_get_fd(xfer_old) >=0) && (purple_xfer_get_status(xfer_old) == PURPLE_XFER_STATUS_DONE)) yahoo_p2p_ft_server_send_OK(xfer_old); /* removing top of filename & size list completely */ @@ -656,13 +657,13 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) if(xfer_data->filename_list) { gchar* filename; - long filesize; + goffset filesize; filename = xfer_data->filename_list->data; - filesize = atol( xfer_data->size_list->data ); + filesize = g_ascii_strtoll( xfer_data->size_list->data, NULL, 10 ); gc = xfer_data->gc; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); /* setting up xfer_data for next file's tranfer */ g_free(xfer_data->host); @@ -689,10 +690,10 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) xfer_data->firstoflist = FALSE; /* Dereference xfer_data from old xfer */ - xfer_old->data = NULL; + purple_xfer_set_protocol_data(xfer_old, NULL); /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, xfer_old->who); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_RECEIVE, purple_xfer_get_remote_user(xfer_old)); if (xfer) { @@ -702,7 +703,7 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) g_free(utf8_filename); purple_xfer_set_size(xfer, filesize); - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); @@ -726,8 +727,7 @@ static void yahoo_xfer_end(PurpleXfer *xfer_old) } if (xfer_data) yahoo_xfer_data_free(xfer_data); - xfer_old->data = NULL; - + purple_xfer_set_protocol_data(xfer_old, NULL); } void yahoo_process_p2pfilexfer(PurpleConnection *gc, struct yahoo_packet *pkt) @@ -803,10 +803,10 @@ void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt) struct yahoo_xfer_data *xfer_data; char *service = NULL; char *filename = NULL; - unsigned long filesize = 0L; + goffset filesize = G_GOFFSET_CONSTANT(0); GSList *l; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -831,7 +831,7 @@ void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt) filename = pair->value; break; case 28: - filesize = atol(pair->value); + filesize = g_ascii_strtoll(pair->value, NULL, 10); break; case 49: service = pair->value; @@ -880,13 +880,13 @@ void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt) xfer_data->host, xfer_data->port, xfer_data->path, url); /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_RECEIVE, from); if (xfer == NULL) { g_free(xfer_data); g_return_if_reached(); } - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Set the info about the incoming file. */ if (filename) { @@ -936,14 +936,14 @@ PurpleXfer *yahoo_new_xfer(PurpleConnection *gc, const char *who) xfer_data->gc = gc; /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); if (xfer == NULL) { g_free(xfer_data); g_return_val_if_reached(NULL); } - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); @@ -993,11 +993,11 @@ static void yahoo_xfer_dns_connected_15(GSList *hosts, gpointer data, const char if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; gc = xd->gc; account = purple_connection_get_account(gc); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); if(!hosts) { @@ -1057,7 +1057,7 @@ static void yahoo_xfer_dns_connected_15(GSList *hosts, gpointer data, const char yahoo_packet_hash(pkt, "ssssis", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xd->xfer_peer_idstring, 27, filename, 249, 3, @@ -1077,7 +1077,7 @@ gboolean yahoo_can_receive_file(PurpleConnection *gc, const char *who) void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file) { struct yahoo_xfer_data *xfer_data; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleXfer *xfer = yahoo_new_xfer(gc, who); g_return_if_fail(xfer != NULL); @@ -1086,7 +1086,7 @@ void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file) if( !g_hash_table_lookup(yd->peers, who) ) yahoo_send_p2p_pkt(gc, who, 0); - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); xfer_data->status_15 = STARTED; purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); xfer_data->version = 15; @@ -1108,26 +1108,22 @@ static void yahoo_xfer_recv_cb_15(gpointer data, gint source, PurpleInputConditi PurpleXfer *xfer; struct yahoo_xfer_data *xd; int did; - gchar* buf; - gchar* t; + guchar buf[1000]; PurpleAccount *account; PurpleConnection *gc; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); account = purple_connection_get_account(xd->gc); gc = xd->gc; - buf=g_strnfill(1000, 0); - while((did = read(source, buf, 998)) > 0) + while((did = read(source, buf, sizeof(buf))) > 0) { + /* TODO: Convert to circ buffer, this all is pretty horrible */ + xd->txbuf = g_realloc(xd->txbuf, xd->txbuflen + did); + g_memmove(xd->txbuf + xd->txbuflen, buf, did); xd->txbuflen += did; - buf[did] = '\0'; - t = xd->txbuf; - xd->txbuf = g_strconcat(t,buf,NULL); - g_free(t); } - g_free(buf); if (did < 0 && errno == EAGAIN) return; @@ -1167,7 +1163,7 @@ static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputConditi int remaining, written; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; written = write(source, xd->txbuf + xd->txbuf_written, remaining); @@ -1200,13 +1196,13 @@ static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputConditi else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == HEAD_REPLY_RECEIVED) { xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; + purple_xfer_set_fd(xfer, source); purple_xfer_start(xfer, source, NULL, 0); } else if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && (xd->status_15 == ACCEPTED || xd->status_15 == P2P_GET_REQUESTED) ) { xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; + purple_xfer_set_fd(xfer, source); /* Remove Read event */ purple_input_remove(xd->input_event); xd->input_event = 0; @@ -1219,9 +1215,9 @@ static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputConditi purple_input_remove(xd->input_event); xd->input_event = 0; close(source); - xfer->fd = -1; + purple_xfer_set_fd(xfer, -1); /* start local server, listen for connections */ - purple_network_listen(xd->yahoo_local_p2p_ft_server_port, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer); + purple_network_listen(xd->yahoo_local_p2p_ft_server_port, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_ft_server_listen_cb, xfer); } else { @@ -1239,13 +1235,13 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; gc = xd->gc; account = purple_connection_get_account(gc); if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); + purple_xfer_get_remote_user(xfer), _("Unable to connect.")); purple_xfer_cancel_remote(xfer); return; } @@ -1253,7 +1249,8 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err if (xd->txbuflen == 0) { gchar* cookies; - YahooData *yd = gc->proto_data; + gchar* initial_buffer; + YahooData *yd = purple_connection_get_protocol_data(gc); /* cookies = yahoo_get_cookies(gc); * This doesn't seem to be working. The function is returning NULL, which yahoo servers don't like @@ -1266,30 +1263,30 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err if(xd->info_val_249 == 2) { /* sending file via p2p, we are connected as client */ - xd->txbuf = g_strdup_printf("POST /%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("POST /%s HTTP/1.1\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" - "Content-Length: %ld\r\n" + "Content-Length: %" G_GOFFSET_FORMAT "\r\n" "Cache-Control: no-cache\r\n\r\n", xd->path, xd->host, - (long int)xfer->size); /* to do, add Referer */ + purple_xfer_get_size(xfer)); /* to do, add Referer */ } else { /* sending file via relaying */ - xd->txbuf = g_strdup_printf("POST /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("POST /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" "Cookie:%s\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" - "Content-Length: %ld\r\n" + "Content-Length: %" G_GOFFSET_FORMAT "\r\n" "Cache-Control: no-cache\r\n\r\n", purple_url_encode(xd->xfer_idstring_for_relay), purple_normalize(account, purple_account_get_username(account)), - xfer->who, + purple_xfer_get_remote_user(xfer), cookies, xd->host, - (long int)xfer->size); + purple_xfer_get_size(xfer)); /* to do, add Referer */ } } else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == STARTED) @@ -1297,7 +1294,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err if(xd->info_val_249 == 1) { /* receiving file via p2p, connected as client */ - xd->txbuf = g_strdup_printf("HEAD /%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("HEAD /%s HTTP/1.1\r\n" "Accept: */*\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" @@ -1308,7 +1305,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err else { /* receiving file via relaying */ - xd->txbuf = g_strdup_printf("HEAD /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("HEAD /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" "Accept: */*\r\n" "Cookie: %s\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" @@ -1317,7 +1314,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err "Cache-Control: no-cache\r\n\r\n", purple_url_encode(xd->xfer_idstring_for_relay), purple_normalize(account, purple_account_get_username(account)), - xfer->who, + purple_xfer_get_remote_user(xfer), cookies, xd->host); } @@ -1327,7 +1324,7 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err if(xd->info_val_249 == 1) { /* receiving file via p2p, connected as client */ - xd->txbuf = g_strdup_printf("GET /%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("GET /%s HTTP/1.1\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" "Connection: Keep-Alive\r\n\r\n", @@ -1336,14 +1333,14 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err else { /* receiving file via relaying */ - xd->txbuf = g_strdup_printf("GET /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" + initial_buffer = g_strdup_printf("GET /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" "Cookie: %s\r\n" "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" "Host: %s\r\n" "Connection: Keep-Alive\r\n\r\n", purple_url_encode(xd->xfer_idstring_for_relay), purple_normalize(account, purple_account_get_username(account)), - xfer->who, + purple_xfer_get_remote_user(xfer), cookies, xd->host); } @@ -1354,7 +1351,8 @@ static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *err g_free(cookies); return; } - xd->txbuflen = strlen(xd->txbuf); + xd->txbuf = (guchar*) initial_buffer; + xd->txbuflen = strlen(initial_buffer); xd->txbuf_written = 0; g_free(cookies); } @@ -1373,14 +1371,14 @@ static void yahoo_p2p_ft_POST_cb(gpointer data, gint source, PurpleInputConditio struct yahoo_xfer_data *xd; xfer = data; - if (!(xd = xfer->data)) { + if (!(xd = purple_xfer_get_protocol_data(xfer))) { purple_xfer_cancel_remote(xfer); return; } purple_input_remove(xd->input_event); xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; + purple_xfer_set_fd(xfer, source); purple_xfer_start(xfer, source, NULL, 0); } @@ -1396,7 +1394,7 @@ static void yahoo_p2p_ft_HEAD_GET_cb(gpointer data, gint source, PurpleInputCond char *time_str; xfer = data; - if (!(xd = xfer->data)) { + if (!(xd = purple_xfer_get_protocol_data(xfer))) { purple_xfer_cancel_remote(xfer); return; } @@ -1431,14 +1429,15 @@ static void yahoo_p2p_ft_HEAD_GET_cb(gpointer data, gint source, PurpleInputCond time_str[strlen(time_str) - 1] = '\0'; if (xd->txbuflen == 0) { - xd->txbuf = g_strdup_printf("HTTP/1.0 200 OK\r\n" + gchar *initial_buffer = g_strdup_printf("HTTP/1.0 200 OK\r\n" "Date: %s GMT\r\n" "Server: Y!/1.0\r\n" "MIME-version: 1.0\r\n" "Last-modified: %s GMT\r\n" - "Content-length: %" G_GSIZE_FORMAT "\r\n\r\n", - time_str, time_str, xfer->size); - xd->txbuflen = strlen(xd->txbuf); + "Content-length: %" G_GOFFSET_FORMAT "\r\n\r\n", + time_str, time_str, purple_xfer_get_size(xfer)); + xd->txbuf = (guchar *)initial_buffer; + xd->txbuflen = strlen(initial_buffer); xd->txbuf_written = 0; } @@ -1458,7 +1457,7 @@ static void yahoo_p2p_ft_server_send_connected_cb(gpointer data, gint source, Pu struct yahoo_xfer_data *xd; xfer = data; - if (!(xd = xfer->data)) { + if (!(xd = purple_xfer_get_protocol_data(xfer))) { purple_xfer_cancel_remote(xfer); return; } @@ -1480,8 +1479,8 @@ static void yahoo_p2p_ft_server_send_connected_cb(gpointer data, gint source, Pu close(xd->yahoo_local_p2p_ft_server_fd); /* Add an Input Read event to the file descriptor */ - xfer->fd = acceptfd; - if(xfer->type == PURPLE_XFER_RECEIVE) + purple_xfer_set_fd(xfer, acceptfd); + if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_POST_cb, data); else xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_HEAD_GET_cb, data); @@ -1500,14 +1499,14 @@ static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) char *filename_without_spaces = NULL; xfer = data; - if (!(xd = xfer->data) || (listenfd == -1)) { + if (!(xd = purple_xfer_get_protocol_data(xfer)) || (listenfd == -1)) { purple_debug_warning("yahoo","p2p: error starting server for p2p file transfer\n"); purple_xfer_cancel_remote(xfer); return; } - if( (xfer->type == PURPLE_XFER_RECEIVE) || (xd->status_15 != P2P_HEAD_REPLIED) ) { - yd = xd->gc->proto_data; + if( (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) || (xd->status_15 != P2P_HEAD_REPLIED) ) { + yd = purple_connection_get_protocol_data(xd->gc); account = purple_connection_get_account(xd->gc); local_ip = purple_network_get_my_ip(listenfd); xd->yahoo_local_p2p_ft_server_port = purple_network_get_port_from_fd(listenfd); @@ -1515,18 +1514,18 @@ static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); filename_without_spaces = g_strdup(filename); purple_util_chrreplace(filename_without_spaces, ' ', '+'); - xd->xfer_url = g_strdup_printf("/Messenger.%s.%d000%s?AppID=Messenger&UserID=%s&K=lc9lu2u89gz1llmplwksajkjx", xfer->who, (int)time(NULL), filename_without_spaces, xfer->who); + xd->xfer_url = g_strdup_printf("/Messenger.%s.%d000%s?AppID=Messenger&UserID=%s&K=lc9lu2u89gz1llmplwksajkjx", purple_xfer_get_remote_user(xfer), (int)time(NULL), filename_without_spaces, purple_xfer_get_remote_user(xfer)); url_to_send = g_strdup_printf("http://%s:%d%s", local_ip, xd->yahoo_local_p2p_ft_server_port, xd->xfer_url); - if(xfer->type == PURPLE_XFER_RECEIVE) { + if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) { xd->info_val_249 = 2; /* 249=2: we are p2p server, and receiving file */ pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, YAHOO_STATUS_AVAILABLE, yd->session_id); yahoo_packet_hash(pkt, "ssssis", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xd->xfer_peer_idstring, - 27, xfer->filename, + 27, purple_xfer_get_filename(xfer), 249, 2, 250, url_to_send); } @@ -1535,7 +1534,7 @@ static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); yahoo_packet_hash(pkt, "ssssis", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xd->xfer_peer_idstring, 27, filename, 249, 1, @@ -1564,15 +1563,15 @@ static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer gchar *filename; struct yahoo_p2p_data *p2p_data; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; account = purple_connection_get_account(gc); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); - p2p_data = g_hash_table_lookup(yd->peers, xfer->who); + p2p_data = g_hash_table_lookup(yd->peers, purple_xfer_get_remote_user(xfer)); if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER ) - if(purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) + if(purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_ft_server_listen_cb, xfer)) return; pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -1580,7 +1579,7 @@ static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer yahoo_packet_hash(pkt, "ssssi", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xd->xfer_peer_idstring, 27, filename, 249, 2); /* 249=2: we are p2p client */ @@ -1603,13 +1602,13 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) char *filename = NULL; char *xfer_peer_idstring = NULL; char *utf8_filename; - unsigned long filesize = 0L; + goffset filesize = G_GOFFSET_CONSTANT(0); GSList *l; GSList *filename_list = NULL; GSList *size_list = NULL; int nooffiles = 0; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -1683,13 +1682,13 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) account = purple_connection_get_account(gc); if (yd->jp) { - purple_dnsquery_a_account(account, YAHOOJP_XFER_RELAY_HOST, + purple_dnsquery_a(account, YAHOOJP_XFER_RELAY_HOST, YAHOOJP_XFER_RELAY_PORT, yahoo_xfer_dns_connected_15, xfer); } else { - purple_dnsquery_a_account(account, YAHOO_XFER_RELAY_HOST, + purple_dnsquery_a(account, YAHOO_XFER_RELAY_HOST, YAHOO_XFER_RELAY_PORT, yahoo_xfer_dns_connected_15, xfer); } @@ -1720,7 +1719,7 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) filename_list = g_slist_reverse(filename_list); size_list = g_slist_reverse(size_list); filename = filename_list->data; - filesize = atol(size_list->data); + filesize = g_ascii_strtoll(size_list->data, NULL, 10); if(!from) return; xfer_data = g_new0(struct yahoo_xfer_data, 1); @@ -1732,22 +1731,20 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) xfer_data->size_list = size_list; /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); + xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_RECEIVE, from); if (xfer == NULL) { g_free(xfer_data); g_return_if_reached(); } - xfer->message = NULL; - /* Set the info about the incoming file. */ utf8_filename = yahoo_string_decode(gc, filename, TRUE); purple_xfer_set_filename(xfer, utf8_filename); g_free(utf8_filename); purple_xfer_set_size(xfer, filesize); - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); @@ -1765,7 +1762,7 @@ void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) if(nooffiles > 1) { gchar* message; - message = g_strdup_printf(_("%s is trying to send you a group of %d files.\n"), xfer->who, nooffiles); + message = g_strdup_printf(_("%s is trying to send you a group of %d files.\n"), purple_xfer_get_remote_user(xfer), nooffiles); purple_xfer_conversation_write(xfer, message, FALSE); g_free(message); } @@ -1790,7 +1787,7 @@ void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet * struct yahoo_packet *pkt_to_send; struct yahoo_p2p_data *p2p_data; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -1837,7 +1834,7 @@ void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet * return; } - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); xfer_data->info_val_249 = val_249; xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay); @@ -1854,9 +1851,9 @@ void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet * YAHOO_STATUS_AVAILABLE, yd->session_id); yahoo_packet_hash(pkt_to_send, "ssssis", 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, + 5, purple_xfer_get_remote_user(xfer), 265, xfer_data->xfer_peer_idstring, - 27, xfer->filename, + 27, purple_xfer_get_filename(xfer), 249, xfer_data->info_val_249, 251, xfer_data->xfer_idstring_for_relay); @@ -1870,12 +1867,12 @@ void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet * } } else if(val_249 == 2) { - p2p_data = g_hash_table_lookup(yd->peers, xfer->who); + p2p_data = g_hash_table_lookup(yd->peers, purple_xfer_get_remote_user(xfer)); if( !( p2p_data && (p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) ) ) { purple_xfer_cancel_remote(xfer); return; } - if(!purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) { + if(!purple_network_listen_range(0, 0, AF_UNSPEC, SOCK_STREAM, TRUE, yahoo_p2p_ft_server_listen_cb, xfer)) { purple_xfer_cancel_remote(xfer); return; } @@ -1896,7 +1893,7 @@ void yahoo_process_filetrans_acc_15(PurpleConnection *gc, struct yahoo_packet *p gchar *url = NULL; int val_249 = 0; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -1934,7 +1931,7 @@ void yahoo_process_filetrans_acc_15(PurpleConnection *gc, struct yahoo_packet *p return; } - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); if(url) purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL); diff --git a/libpurple/protocols/yahoo/yahoo_friend.c b/libpurple/protocols/yahoo/yahoo_friend.c index 1acced0d8a..8c5e3a45ef 100644 --- a/libpurple/protocols/yahoo/yahoo_friend.c +++ b/libpurple/protocols/yahoo/yahoo_friend.c @@ -46,9 +46,10 @@ YahooFriend *yahoo_friend_find(PurpleConnection *gc, const char *name) const char *norm; g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(gc->proto_data != NULL, NULL); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); + g_return_val_if_fail(yd != NULL, NULL); + norm = purple_normalize(purple_connection_get_account(gc), name); return g_hash_table_lookup(yd->friends, norm); @@ -61,9 +62,10 @@ YahooFriend *yahoo_friend_find_or_new(PurpleConnection *gc, const char *name) const char *norm; g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(gc->proto_data != NULL, NULL); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); + g_return_val_if_fail(yd != NULL, NULL); + norm = purple_normalize(purple_connection_get_account(gc), name); f = g_hash_table_lookup(yd->friends, norm); @@ -225,7 +227,7 @@ void yahoo_process_presence(PurpleConnection *gc, struct yahoo_packet *pkt) void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, YahooPresenceVisibility presence) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt = NULL; YahooFriend *f; const char *thirtyone, *thirteen; diff --git a/libpurple/protocols/yahoo/yahoo_picture.c b/libpurple/protocols/yahoo/yahoo_picture.c index eefca0686f..4911486847 100644 --- a/libpurple/protocols/yahoo/yahoo_picture.c +++ b/libpurple/protocols/yahoo/yahoo_picture.c @@ -52,7 +52,7 @@ yahoo_fetch_picture_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, YahooData *yd; d = user_data; - yd = d->gc->proto_data; + yd = purple_connection_get_protocol_data(d->gc); yd->url_datas = g_slist_remove(yd->url_datas, url_data); if (error_message != NULL) { @@ -123,26 +123,19 @@ void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt) /* TODO: make this work p2p, try p2p before the url */ PurpleUtilFetchUrlData *url_data; struct yahoo_fetch_picture_data *data; - PurpleBuddy *b = purple_find_buddy(gc->account, who); - const char *locksum = NULL; /* use whole URL if using HTTP Proxy */ gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - /* FIXME: Cleanup this strtol() stuff if possible. */ - if (b && (locksum = purple_buddy_icons_get_checksum_for_user(b)) != NULL && - (checksum == strtol(locksum, NULL, 10))) - return; - data = g_new0(struct yahoo_fetch_picture_data, 1); data->gc = gc; data->who = g_strdup(who); data->checksum = checksum; /* TODO: Does this need to be MSIE 5.0? */ url_data = purple_util_fetch_url(url, use_whole_url, - "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, + "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, -1, yahoo_fetch_picture_cb, data); if (url_data != NULL) { - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); yd->url_datas = g_slist_prepend(yd->url_datas, url_data); } else { g_free(data->who); @@ -177,7 +170,7 @@ void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *p } if (who) { - PurpleBuddy *b = purple_find_buddy(gc->account, who); + PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), who); const char *locksum = NULL; /* FIXME: Cleanup this strtol() stuff if possible. */ @@ -192,7 +185,7 @@ void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *p void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt) { PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GSList *l = pkt->hash; char *url = NULL; @@ -258,7 +251,7 @@ void yahoo_process_avatar_update(PurpleConnection *gc, struct yahoo_packet *pkt) yahoo_send_picture_request(gc, who); else if ((avatar == 0) || (avatar == 1)) { YahooFriend *f; - purple_buddy_icons_set_for_user(gc->account, who, NULL, 0, NULL); + purple_buddy_icons_set_for_user(purple_connection_get_account(gc), who, NULL, 0, NULL); if ((f = yahoo_friend_find(gc, who))) yahoo_friend_set_buddy_icon_need_request(f, TRUE); purple_debug_misc("yahoo", "Setting user %s's icon to NULL.\n", who); @@ -268,7 +261,7 @@ void yahoo_process_avatar_update(PurpleConnection *gc, struct yahoo_packet *pkt) void yahoo_send_picture_info(PurpleConnection *gc, const char *who) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; if (!yd->picture_url) { @@ -285,7 +278,7 @@ void yahoo_send_picture_info(PurpleConnection *gc, const char *who) void yahoo_send_picture_request(PurpleConnection *gc, const char *who) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -297,7 +290,7 @@ void yahoo_send_picture_request(PurpleConnection *gc, const char *who) void yahoo_send_picture_checksum(PurpleConnection *gc) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -308,7 +301,7 @@ void yahoo_send_picture_checksum(PurpleConnection *gc) void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -333,7 +326,7 @@ static void yahoo_send_picture_update_foreach(gpointer key, gpointer value, gpoi void yahoo_send_picture_update(PurpleConnection *gc, int type) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yspufe data; data.gc = gc; @@ -432,7 +425,7 @@ static void yahoo_buddy_icon_upload_connected(gpointer data, gint source, const gboolean use_whole_url = yahoo_account_use_http_proxy(gc); account = purple_connection_get_account(gc); - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); /* Buddy icon connect is now complete; clear the PurpleProxyConnectData */ yd->buddy_icon_connect_data = NULL; @@ -497,7 +490,7 @@ static void yahoo_buddy_icon_upload_connected(gpointer data, gint source, const void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d) { PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (yd->buddy_icon_connect_data != NULL) { /* Cancel any in-progress buddy icon upload */ @@ -542,8 +535,8 @@ static int yahoo_buddy_icon_calculate_checksum(const guchar *data, gsize len) void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) { - YahooData *yd = gc->proto_data; - PurpleAccount *account = gc->account; + YahooData *yd = purple_connection_get_protocol_data(gc); + PurpleAccount *account = purple_connection_get_account(gc); if (img == NULL) { g_free(yd->picture_url); diff --git a/libpurple/protocols/yahoo/yahoo_profile.c b/libpurple/protocols/yahoo/yahoo_profile.c index aa752f6885..b7c173367e 100644 --- a/libpurple/protocols/yahoo/yahoo_profile.c +++ b/libpurple/protocols/yahoo/yahoo_profile.c @@ -789,7 +789,7 @@ static void yahoo_got_info(PurpleUtilFetchUrlData *url_data, gpointer user_data, purple_debug_info("yahoo", "In yahoo_got_info\n"); - yd = info_data->gc->proto_data; + yd = purple_connection_get_protocol_data(info_data->gc); yd->url_datas = g_slist_remove(yd->url_datas, url_data); user_info = purple_notify_user_info_new(); @@ -940,7 +940,7 @@ static void yahoo_got_info(PurpleUtilFetchUrlData *url_data, gpointer user_data, * we specify HTTP 1.1. So we have to specify 1.0 & fix purple_util_fetch_url */ url_data = purple_util_fetch_url(photo_url_text, use_whole_url, NULL, - FALSE, yahoo_got_photo, info2_data); + FALSE, -1, yahoo_got_photo, info2_data); if (url_data != NULL) yd->url_datas = g_slist_prepend(yd->url_datas, url_data); } else { @@ -983,7 +983,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, /* in to purple_markup_strip_html*/ char *fudged_buffer; - yd = info_data->gc->proto_data; + yd = purple_connection_get_protocol_data(info_data->gc); yd->url_datas = g_slist_remove(yd->url_datas, url_data); fudged_buffer = purple_strcasereplace(url_buffer, "", "
"); @@ -1262,7 +1262,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, void yahoo_get_info(PurpleConnection *gc, const char *name) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); YahooGetInfoData *data; char *url; PurpleUtilFetchUrlData *url_data; @@ -1274,7 +1274,7 @@ void yahoo_get_info(PurpleConnection *gc, const char *name) url = g_strdup_printf("%s%s", (yd->jp ? YAHOOJP_PROFILE_URL : YAHOO_PROFILE_URL), name); - url_data = purple_util_fetch_url(url, TRUE, NULL, FALSE, yahoo_got_info, data); + url_data = purple_util_fetch_url(url, TRUE, NULL, FALSE, -1, yahoo_got_info, data); if (url_data != NULL) yd->url_datas = g_slist_prepend(yd->url_datas, url_data); else { diff --git a/libpurple/protocols/yahoo/yahoochat.c b/libpurple/protocols/yahoo/yahoochat.c index 10635908a5..c384dcf859 100644 --- a/libpurple/protocols/yahoo/yahoochat.c +++ b/libpurple/protocols/yahoo/yahoochat.c @@ -53,7 +53,7 @@ static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char /* special function to log us on to the yahoo chat service */ static void yahoo_chat_online(PurpleConnection *gc) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; const char *rll; @@ -101,7 +101,7 @@ static PurpleConversation *yahoo_find_conference(PurpleConnection *gc, const cha YahooData *yd; GSList *l; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); for (l = yd->confs; l; l = l->next) { PurpleConversation *c = l->data; @@ -372,7 +372,7 @@ void yahoo_process_conference_message(PurpleConnection *gc, struct yahoo_packet static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *room, const char *topic, const char *id) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; char *room2; gboolean utf8 = TRUE; @@ -400,7 +400,7 @@ static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *ro /* this is a confirmation of yahoo_chat_online(); */ void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt) { - YahooData *yd = (YahooData *) gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (pkt->status == 1) { yd->chat_online = TRUE; @@ -432,7 +432,7 @@ void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt) /* this is basicly the opposite of chat_online */ void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt) { - YahooData *yd = (YahooData *) gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); GSList *l; for (l = pkt->hash; l; l = l->next) { @@ -462,7 +462,7 @@ void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt) void yahoo_process_chat_join(PurpleConnection *gc, struct yahoo_packet *pkt) { PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = (YahooData *) gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleConversation *c = NULL; GSList *l; GList *members = NULL; @@ -786,7 +786,7 @@ void yahoo_conf_leave(YahooData *yd, const char *room, const char *dn, GList *wh static int yahoo_conf_send(PurpleConnection *gc, const char *dn, const char *room, GList *members, const char *what) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; GList *who; char *msg, *msg2; @@ -843,7 +843,7 @@ static void yahoo_conf_join(YahooData *yd, PurpleConversation *c, const char *dn static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c, const char *dn, const char *buddy, const char *room, const char *msg) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; GList *members; char *msg2 = NULL; @@ -873,7 +873,7 @@ static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c, static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; char *eroom; @@ -924,7 +924,7 @@ static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *room, const char *what, PurpleMessageFlags flags) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; int me = 0; char *msg1, *msg2, *room2; @@ -969,7 +969,7 @@ static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *roo static void yahoo_chat_invite(PurpleConnection *gc, const char *dn, const char *buddy, const char *room, const char *msg) { - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); struct yahoo_packet *pkt; char *room2, *msg2 = NULL; gboolean utf8 = TRUE; @@ -997,7 +997,7 @@ void yahoo_chat_goto(PurpleConnection *gc, const char *name) YahooData *yd; struct yahoo_packet *pkt; - yd = gc->proto_data; + yd = purple_connection_get_protocol_data(gc); if (yd->wm) { g_return_if_fail(yd->ycht != NULL); @@ -1029,7 +1029,7 @@ void yahoo_chat_goto(PurpleConnection *gc, const char *name) void yahoo_c_leave(PurpleConnection *gc, int id) { - YahooData *yd = (YahooData *) gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleConversation *c; if (!yd) @@ -1056,7 +1056,7 @@ int yahoo_c_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFl int ret; YahooData *yd; - yd = (YahooData *) gc->proto_data; + yd = purple_connection_get_protocol_data(gc); if (!yd) return -1; @@ -1114,7 +1114,7 @@ void yahoo_c_join(PurpleConnection *gc, GHashTable *data) char *room, *topic, *type; PurpleConversation *c; - yd = (YahooData *) gc->proto_data; + yd = purple_connection_get_protocol_data(gc); if (!yd) return; @@ -1166,7 +1166,7 @@ void yahoo_c_invite(PurpleConnection *gc, int id, const char *msg, const char *n PurpleConversation *c; c = purple_find_chat(gc, id); - if (!c || !c->name) + if (!c || !purple_conversation_get_name(c)) return; if (id != YAHOO_CHAT_ID) { @@ -1375,7 +1375,9 @@ static void yahoo_roomlist_cleanup(PurpleRoomlist *list, struct yahoo_roomlist * purple_roomlist_set_in_progress(list, FALSE); if (yrl) { - list->proto_data = g_list_remove(list->proto_data, yrl); + GList *proto_data = purple_roomlist_get_proto_data(list); + proto_data = g_list_remove(proto_data, yrl); + purple_roomlist_set_proto_data(list, proto_data); yahoo_roomlist_destroy(yrl); } @@ -1451,7 +1453,7 @@ static void yahoo_roomlist_send_cb(gpointer data, gint source, PurpleInputCondit yrl->inpa = 0; g_free(yrl->txbuf); yrl->txbuf = NULL; - purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); + purple_notify_error(purple_account_get_connection(purple_roomlist_get_account(list)), NULL, _("Unable to connect"), _("Fetching the room list failed.")); yahoo_roomlist_cleanup(list, yrl); return; } @@ -1474,10 +1476,12 @@ static void yahoo_roomlist_got_connected(gpointer data, gint source, const gchar { struct yahoo_roomlist *yrl = data; PurpleRoomlist *list = yrl->list; - YahooData *yd = purple_account_get_connection(list->account)->proto_data; + PurpleAccount *account = purple_roomlist_get_account(list); + PurpleConnection *pc = purple_account_get_connection(account); + YahooData *yd = purple_connection_get_protocol_data(pc); if (source < 0) { - purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); + purple_notify_error(pc, NULL, _("Unable to connect"), _("Fetching the room list failed.")); yahoo_roomlist_cleanup(list, yrl); return; } @@ -1506,6 +1510,7 @@ PurpleRoomlist *yahoo_roomlist_get_list(PurpleConnection *gc) struct yahoo_roomlist *yrl; const char *rll, *rlurl; char *url; + GList *proto_data; account = purple_connection_get_account(gc); @@ -1556,7 +1561,9 @@ PurpleRoomlist *yahoo_roomlist_get_list(PurpleConnection *gc) return NULL; } - rl->proto_data = g_list_append(rl->proto_data, yrl); + proto_data = purple_roomlist_get_proto_data(rl); + proto_data = g_list_append(proto_data, yrl); + purple_roomlist_set_proto_data(rl, proto_data); purple_roomlist_set_in_progress(rl, TRUE); return rl; @@ -1566,8 +1573,8 @@ void yahoo_roomlist_cancel(PurpleRoomlist *list) { GList *l, *k; - k = l = list->proto_data; - list->proto_data = NULL; + k = l = purple_roomlist_get_proto_data(list); + purple_roomlist_set_proto_data(list, NULL); purple_roomlist_set_in_progress(list, FALSE); @@ -1580,36 +1587,42 @@ void yahoo_roomlist_cancel(PurpleRoomlist *list) void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) { + PurpleAccount *account; struct yahoo_roomlist *yrl; char *url; char *id; const char *rll; + GList *proto_data; - if (category->type != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) + if (purple_roomlist_room_get_type(category) != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) return; - if (!(id = g_list_nth_data(category->fields, 1))) { + if (!(id = g_list_nth_data(purple_roomlist_room_get_fields(category), 1))) { purple_roomlist_set_in_progress(list, FALSE); return; } - rll = purple_account_get_string(list->account, "room_list_locale", + account = purple_roomlist_get_account(list); + rll = purple_account_get_string(account, "room_list_locale", YAHOO_ROOMLIST_LOCALE); if (rll != NULL && *rll != '\0') { url = g_strdup_printf("%s?chatroom_%s=0&intl=%s", - purple_account_get_string(list->account,"room_list", + purple_account_get_string(account,"room_list", YAHOO_ROOMLIST_URL), id, rll); } else { url = g_strdup_printf("%s?chatroom_%s=0", - purple_account_get_string(list->account,"room_list", + purple_account_get_string(account,"room_list", YAHOO_ROOMLIST_URL), id); } yrl = g_new0(struct yahoo_roomlist, 1); yrl->list = list; yrl->cat = category; - list->proto_data = g_list_append(list->proto_data, yrl); + + proto_data = purple_roomlist_get_proto_data(list); + proto_data = g_list_append(proto_data, yrl); + purple_roomlist_set_proto_data(list, proto_data); purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); g_free(url); @@ -1617,11 +1630,11 @@ void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *ca yrl->ucat = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY, _("User Rooms"), yrl->cat); purple_roomlist_room_add(list, yrl->ucat); - if (purple_proxy_connect(purple_account_get_connection(list->account), - list->account, yrl->host, 80, + if (purple_proxy_connect(purple_account_get_connection(account), + account, yrl->host, 80, yahoo_roomlist_got_connected, yrl) == NULL) { - purple_notify_error(purple_account_get_connection(list->account), + purple_notify_error(purple_account_get_connection(account), NULL, _("Connection problem"), _("Unable to fetch room list.")); purple_roomlist_ref(list); yahoo_roomlist_cleanup(list, yrl); diff --git a/libpurple/protocols/yahoo/ycht.c b/libpurple/protocols/yahoo/ycht.c index 4035397802..22f3142116 100644 --- a/libpurple/protocols/yahoo/ycht.c +++ b/libpurple/protocols/yahoo/ycht.c @@ -53,7 +53,7 @@ static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt) { PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (ycht->logged_in) return; @@ -68,7 +68,7 @@ static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt) static void ycht_process_logout(YchtConn *ycht, YchtPkt *pkt) { PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); yd->chat_online = FALSE; ycht->logged_in = FALSE; @@ -173,7 +173,7 @@ static void ycht_progress_online_friends(YchtConn *ycht, YchtPkt *pkt) { #if 0 PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (ycht->logged_in) return; @@ -429,7 +429,7 @@ static void ycht_packet_free(YchtPkt *pkt) void ycht_connection_close(YchtConn *ycht) { - YahooData *yd = ycht->gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(ycht->gc); if (yd) { yd->ycht = NULL; @@ -541,7 +541,7 @@ static void ycht_got_connected(gpointer data, gint source, const gchar *error_me { YchtConn *ycht = data; PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); YchtPkt *pkt; char *buf; @@ -568,7 +568,7 @@ static void ycht_got_connected(gpointer data, gint source, const gchar *error_me void ycht_connection_open(PurpleConnection *gc) { YchtConn *ycht; - YahooData *yd = gc->proto_data; + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); ycht = g_new0(YchtConn, 1); diff --git a/libpurple/protocols/zephyr/ZRetSubs.c b/libpurple/protocols/zephyr/ZRetSubs.c index 35ade9c2f4..376b218a3a 100644 --- a/libpurple/protocols/zephyr/ZRetSubs.c +++ b/libpurple/protocols/zephyr/ZRetSubs.c @@ -132,6 +132,11 @@ static Code_t Z_RetSubs(notice, nsubs, auth_routine) __subscriptions_num = __subscriptions_num / 3; + if (!__subscriptions_num) { + ZFreeNotice(&retnotice); + continue; + } + __subscriptions_list = (ZSubscription_t *) malloc((unsigned)(__subscriptions_num* sizeof(ZSubscription_t))); diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c index 367dc7e74d..c02d5d2226 100644 --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -347,7 +347,7 @@ static gchar *zephyr_recv_convert(PurpleConnection *gc, gchar *string) { gchar *utf8; GError *err = NULL; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if (g_utf8_validate(string, -1, NULL)) { return g_strdup(string); } else { @@ -762,7 +762,7 @@ static void message_failed(PurpleConnection *gc, ZNotice_t notice, struct sockad static void handle_message(PurpleConnection *gc,ZNotice_t notice) { - zephyr_account* zephyr = gc->proto_data; + zephyr_account* zephyr = purple_connection_get_protocol_data(gc); if (!g_ascii_strcasecmp(notice.z_class, LOGIN_CLASS)) { /* well, we'll be updating in 20 seconds anyway, might as well ignore this. */ @@ -777,9 +777,9 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) if (ZParseLocations(¬ice, NULL, &nlocs, &user) != ZERR_NONE) return; - if ((b = purple_find_buddy(gc->account, user)) == NULL) { + if ((b = purple_find_buddy(purple_connection_get_account(gc), user)) == NULL) { char* stripped_user = zephyr_strip_local_realm(zephyr,user); - b = purple_find_buddy(gc->account,stripped_user); + b = purple_find_buddy(purple_connection_get_account(gc),stripped_user); g_free(stripped_user); } @@ -815,9 +815,9 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) purple_notify_user_info_destroy(user_info); } else { if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); + purple_prpl_got_user_status(purple_connection_get_account(gc), b ? bname : user, "available", NULL); else - purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); + purple_prpl_got_user_status(purple_connection_get_account(gc), b ? bname : user, "offline", NULL); } g_free(user); @@ -872,7 +872,7 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) } else { zephyr_triple *zt1, *zt2; gchar *send_inst_utf8; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); zt1 = new_triple(zephyr,notice.z_class, notice.z_class_inst, notice.z_recipient); zt2 = find_sub_by_triple(zephyr,zt1); if (!zt2) { @@ -900,7 +900,7 @@ static void handle_message(PurpleConnection *gc,ZNotice_t notice) } gconv1 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - zt2->name, gc->account); + zt2->name, purple_connection_get_account(gc)); gcc = purple_conversation_get_chat_data(gconv1); #ifndef INET_ADDRSTRLEN #define INET_ADDRSTRLEN 16 @@ -1109,7 +1109,7 @@ static parse_tree *read_from_tzc(zephyr_account* zephyr){ static gint check_notify_tzc(gpointer data) { PurpleConnection *gc = (PurpleConnection *)data; - zephyr_account* zephyr = gc->proto_data; + zephyr_account* zephyr = purple_connection_get_protocol_data(gc); parse_tree *newparsetree = read_from_tzc(zephyr); if (newparsetree != NULL) { gchar *spewtype; @@ -1156,9 +1156,9 @@ static gint check_notify_tzc(gpointer data) gchar *locval; user = tree_child(find_node(newparsetree,"user"),2)->contents; - if ((b = purple_find_buddy(gc->account, user)) == NULL) { + if ((b = purple_find_buddy(purple_connection_get_account(gc), user)) == NULL) { gchar *stripped_user = zephyr_strip_local_realm(zephyr,user); - b = purple_find_buddy(gc->account, stripped_user); + b = purple_find_buddy(purple_connection_get_account(gc), stripped_user); g_free(stripped_user); } locations = find_node(newparsetree,"locations"); @@ -1200,9 +1200,9 @@ static gint check_notify_tzc(gpointer data) purple_notify_user_info_destroy(user_info); } else { if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); + purple_prpl_got_user_status(purple_connection_get_account(gc), b ? bname : user, "available", NULL); else - purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); + purple_prpl_got_user_status(purple_connection_get_account(gc), b ? bname : user, "offline", NULL); } } else if (!g_ascii_strncasecmp(spewtype,"subscribed",10)) { @@ -1265,7 +1265,7 @@ static gint check_loc(gpointer data) GSList *buddies; ZLocations_t locations; PurpleConnection *gc = data; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); int numlocs; int one = 1; @@ -1296,7 +1296,7 @@ static gint check_loc(gpointer data) GSList *buddies; ZAsyncLocateData_t ald; PurpleConnection *gc = (PurpleConnection *)data; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); if (use_zeph02(zephyr)) { @@ -1521,11 +1521,11 @@ static void process_anyone(PurpleConnection *gc) while (fgets(buff, BUFSIZ, fd)) { strip_comments(buff); if (buff[0]) { - if (!(b = purple_find_buddy(gc->account, buff))) { + if (!(b = purple_find_buddy(purple_connection_get_account(gc), buff))) { char *stripped_user = zephyr_strip_local_realm(zephyr,buff); purple_debug_info("zephyr","stripped_user %s\n",stripped_user); - if (!(b = purple_find_buddy(gc->account,stripped_user))){ - b = purple_buddy_new(gc->account, stripped_user, NULL); + if (!(b = purple_find_buddy(purple_connection_get_account(gc),stripped_user))){ + b = purple_buddy_new(purple_connection_get_account(gc), stripped_user, NULL); purple_blist_add_buddy(b, NULL, g, NULL); } g_free(stripped_user); @@ -1564,28 +1564,29 @@ static void zephyr_login(PurpleAccount * account) gchar *exposure; gc = purple_account_get_connection(account); - read_anyone = purple_account_get_bool(gc->account,"read_anyone",TRUE); - read_zsubs = purple_account_get_bool(gc->account,"read_zsubs",TRUE); - exposure = (gchar *)purple_account_get_string(gc->account, "exposure_level", EXPOSE_REALMVIS); + read_anyone = purple_account_get_bool(purple_connection_get_account(gc),"read_anyone",TRUE); + read_zsubs = purple_account_get_bool(purple_connection_get_account(gc),"read_zsubs",TRUE); + exposure = (gchar *)purple_account_get_string(purple_connection_get_account(gc), "exposure_level", EXPOSE_REALMVIS); #ifdef WIN32 username = purple_account_get_username(account); #endif - gc->flags |= PURPLE_CONNECTION_AUTO_RESP | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; - gc->proto_data = zephyr=g_new0(zephyr_account,1); + purple_connection_set_flags(gc, PURPLE_CONNECTION_AUTO_RESP | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC); + zephyr = g_new0(zephyr_account, 1); + purple_connection_set_protocol_data(gc, zephyr); zephyr->account = account; /* Make sure that the exposure (visibility) is set to a sane value */ zephyr->exposure=g_strdup(normalize_zephyr_exposure(exposure)); - if (purple_account_get_bool(gc->account,"use_tzc",0)) { + if (purple_account_get_bool(purple_connection_get_account(gc),"use_tzc",0)) { zephyr->connection_type = PURPLE_ZEPHYR_TZC; } else { zephyr->connection_type = PURPLE_ZEPHYR_KRB4; } - zephyr->encoding = (char *)purple_account_get_string(gc->account, "encoding", ZEPHYR_FALLBACK_CHARSET); + zephyr->encoding = (char *)purple_account_get_string(purple_connection_get_account(gc), "encoding", ZEPHYR_FALLBACK_CHARSET); purple_connection_update_progress(gc, _("Connecting"), 0, 8); /* XXX z_call_s should actually try to report the com_err determined error */ @@ -1606,7 +1607,7 @@ static void zephyr_login(PurpleAccount * account) if (pid == 0) { unsigned int i=0; gboolean found_ps = FALSE; - gchar ** tzc_cmd_array = g_strsplit(purple_account_get_string(gc->account,"tzc_command","/usr/bin/tzc -e %s")," ",0); + gchar ** tzc_cmd_array = g_strsplit(purple_account_get_string(purple_connection_get_account(gc),"tzc_command","/usr/bin/tzc -e %s")," ",0); if (close(1) == -1) { exit(-1); } @@ -1778,7 +1779,7 @@ static void zephyr_login(PurpleAccount * account) if ((realm = strchr(username,'@'))) zephyr->realm = g_strdup_printf("%s",realm+1); else { - realm = (gchar *)purple_account_get_string(gc->account,"realm",""); + realm = (gchar *)purple_account_get_string(purple_connection_get_account(gc),"realm",""); if (!*realm) { realm = "local-realm"; } @@ -1815,7 +1816,7 @@ static void zephyr_login(PurpleAccount * account) z_call_s(ZOpenPort(&(zephyr->port)), "Couldn't open port"); z_call_s(ZSetLocation((char *)zephyr->exposure), "Couldn't set location"); - realm = (gchar *)purple_account_get_string(gc->account,"realm",""); + realm = (gchar *)purple_account_get_string(purple_connection_get_account(gc),"realm",""); if (!*realm) { realm = ZGetRealm(); } @@ -1841,7 +1842,7 @@ static void zephyr_login(PurpleAccount * account) if (zephyr_subscribe_to(zephyr,"MESSAGE","PERSONAL",zephyr->username,NULL) != ZERR_NONE) { /* XXX don't translate this yet. It could be written better */ /* XXX error messages could be handled with more detail */ - purple_notify_error(account->gc, NULL, + purple_notify_error(purple_account_get_connection(account), NULL, "Unable to subscribe to messages", "Unable to subscribe to initial messages"); return; } @@ -1961,7 +1962,7 @@ static void zephyr_close(PurpleConnection * gc) { GList *l; GSList *s; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); pid_t tzc_pid = zephyr->tzc_pid; l = zephyr->pending_zloc_names; @@ -1971,10 +1972,10 @@ static void zephyr_close(PurpleConnection * gc) } g_list_free(zephyr->pending_zloc_names); - if (purple_account_get_bool(gc->account, "write_anyone", FALSE)) + if (purple_account_get_bool(purple_connection_get_account(gc), "write_anyone", FALSE)) write_anyone(zephyr); - if (purple_account_get_bool(gc->account, "write_zsubs", FALSE)) + if (purple_account_get_bool(purple_connection_get_account(gc), "write_zsubs", FALSE)) write_zsubs(zephyr); s = zephyr->subscrips; @@ -2036,7 +2037,7 @@ static int zephyr_chat_send(PurpleConnection * gc, int id, const char *im, Purpl PurpleConvChat *gcc; char *inst; char *recipient; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); zt = find_sub_by_id(zephyr,id); if (!zt) @@ -2046,7 +2047,7 @@ static int zephyr_chat_send(PurpleConnection * gc, int id, const char *im, Purpl sig = zephyr_get_signature(); gconv1 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, zt->name, - gc->account); + purple_connection_get_account(gc)); gcc = purple_conversation_get_chat_data(gconv1); if (!(inst = (char *)purple_conv_chat_get_topic(gcc))) @@ -2065,7 +2066,7 @@ static int zephyr_chat_send(PurpleConnection * gc, int id, const char *im, Purpl static int zephyr_send_im(PurpleConnection * gc, const char *who, const char *im, PurpleMessageFlags flags) { const char *sig; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if (flags & PURPLE_MESSAGE_AUTO_RESP) sig = "Automated reply:"; else { @@ -2234,7 +2235,7 @@ static const char *zephyr_normalize(const PurpleAccount *account, const char *wh if (gc == NULL) return NULL; - tmp = local_zephyr_normalize(gc->proto_data, who); + tmp = local_zephyr_normalize(purple_connection_get_protocol_data(gc), who); if (strlen(tmp) >= sizeof(buf)) { g_free(tmp); @@ -2250,7 +2251,7 @@ static const char *zephyr_normalize(const PurpleAccount *account, const char *wh static void zephyr_zloc(PurpleConnection *gc, const char *who) { ZAsyncLocateData_t ald; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); gchar* normalized_who = local_zephyr_normalize(zephyr,who); if (use_zeph02(zephyr)) { @@ -2277,7 +2278,8 @@ static void zephyr_zloc(PurpleConnection *gc, const char *who) static void zephyr_set_status(PurpleAccount *account, PurpleStatus *status) { size_t len; size_t result; - zephyr_account *zephyr = purple_account_get_connection(account)->proto_data; + PurpleConnection *gc = purple_account_get_connection(account); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_type(status)); if (zephyr->away) { @@ -2411,7 +2413,7 @@ static void zephyr_join_chat(PurpleConnection * gc, GHashTable * data) const char *classname; const char *instname; const char *recip; - zephyr_account *zephyr=gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); classname = g_hash_table_lookup(data, "class"); instname = g_hash_table_lookup(data, "instance"); recip = g_hash_table_lookup(data, "recipient"); @@ -2474,7 +2476,7 @@ static void zephyr_join_chat(PurpleConnection * gc, GHashTable * data) static void zephyr_chat_leave(PurpleConnection * gc, int id) { zephyr_triple *zt; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); zt = find_sub_by_id(zephyr,id); if (zt) { @@ -2524,7 +2526,7 @@ static const char *zephyr_list_icon(PurpleAccount * a, PurpleBuddy * b) static unsigned int zephyr_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) { gchar *recipient; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if (use_tzc(zephyr)) return 0; @@ -2566,7 +2568,7 @@ static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *top PurpleConversation *gconv; PurpleConvChat *gcc; gchar *topic_utf8; - zephyr_account* zephyr = gc->proto_data; + zephyr_account* zephyr = purple_connection_get_protocol_data(gc); char *sender = (char *)zephyr->username; zt = find_sub_by_id(zephyr,id); @@ -2574,7 +2576,7 @@ static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *top if (!zt) return; gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, zt->name, - gc->account); + purple_connection_get_account(gc)); gcc = purple_conversation_get_chat_data(gconv); topic_utf8 = zephyr_recv_convert(gc,(gchar *)topic); @@ -2589,7 +2591,8 @@ static PurpleCmdRet zephyr_purple_cmd_msg(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { char *recipient; - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_connection(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc);; if (!g_ascii_strcasecmp(args[0],"*")) return PURPLE_CMD_RET_FAILED; /* "*" is not a valid argument */ else @@ -2607,7 +2610,7 @@ static PurpleCmdRet zephyr_purple_cmd_msg(PurpleConversation *conv, static PurpleCmdRet zephyr_purple_cmd_zlocate(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { - zephyr_zloc(purple_conversation_get_gc(conv),args[0]); + zephyr_zloc(purple_conversation_get_connection(conv),args[0]); return PURPLE_CMD_RET_OK; } @@ -2619,9 +2622,8 @@ static PurpleCmdRet zephyr_purple_cmd_instance(PurpleConversation *conv, * one word isn't ideal either. */ PurpleConvChat *gcc = purple_conversation_get_chat_data(conv); - int id = gcc->id; const char* instance = args[0]; - zephyr_chat_set_topic(purple_conversation_get_gc(conv),id,instance); + zephyr_chat_set_topic(purple_conversation_get_connection(conv),purple_conv_chat_get_id(gcc),instance); return PURPLE_CMD_RET_OK; } @@ -2633,7 +2635,7 @@ static PurpleCmdRet zephyr_purple_cmd_joinchat_cir(PurpleConversation *conv, g_hash_table_insert(triple,"class",args[0]); g_hash_table_insert(triple,"instance",args[1]); g_hash_table_insert(triple,"recipient",args[2]); - zephyr_join_chat(purple_conversation_get_gc(conv),triple); + zephyr_join_chat(purple_conversation_get_connection(conv),triple); return PURPLE_CMD_RET_OK; } @@ -2641,7 +2643,8 @@ static PurpleCmdRet zephyr_purple_cmd_zi(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = instance, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_connection(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,"message",args[0],"",args[1],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; else @@ -2652,7 +2655,8 @@ static PurpleCmdRet zephyr_purple_cmd_zci(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = class, instance, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_connection(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,args[0],args[1],"",args[2],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; else @@ -2663,7 +2667,8 @@ static PurpleCmdRet zephyr_purple_cmd_zcir(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = class, instance, recipient, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_connection(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,args[0],args[1],args[2],args[3],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; else @@ -2674,7 +2679,8 @@ static PurpleCmdRet zephyr_purple_cmd_zir(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = instance, recipient, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_connection(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,"message",args[0],args[1],args[2],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; else @@ -2685,7 +2691,8 @@ static PurpleCmdRet zephyr_purple_cmd_zc(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) { /* args = class, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; + PurpleConnection *gc = purple_conversation_get_connection(conv); + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); if ( zephyr_send_message(zephyr,args[0],"PERSONAL","",args[1],zephyr_get_signature(),"")) return PURPLE_CMD_RET_OK; else @@ -2766,7 +2773,7 @@ static int zephyr_resubscribe(PurpleConnection *gc) { /* Resubscribe to the in-memory list of subscriptions and also unsubscriptions*/ - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); GSList *s = zephyr->subscrips; zephyr_triple *zt; while (s) { @@ -2791,7 +2798,7 @@ static void zephyr_action_resubscribe(PurplePluginAction *action) static void zephyr_action_get_subs_from_server(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; - zephyr_account *zephyr = gc->proto_data; + zephyr_account *zephyr = purple_connection_get_protocol_data(gc); gchar *title; int retval, nsubs, one,i; ZSubscription_t subs; @@ -2845,6 +2852,7 @@ static GList *zephyr_actions(PurplePlugin *plugin, gpointer context) static PurplePlugin *my_protocol = NULL; static PurplePluginProtocolInfo prpl_info = { + sizeof(PurplePluginProtocolInfo), /* struct_size */ OPT_PROTO_CHAT_TOPIC | OPT_PROTO_NO_PASSWORD, NULL, /* ??? user_splits */ NULL, /* ??? protocol_options */ @@ -2885,7 +2893,6 @@ static PurplePluginProtocolInfo prpl_info = { NULL, /* keepalive -- Not necessary*/ NULL, /* register_user -- Not supported*/ NULL, /* XXX get_cb_info */ - NULL, /* get_cb_away */ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ @@ -2911,15 +2918,12 @@ static PurplePluginProtocolInfo prpl_info = { NULL, NULL, NULL, - sizeof(PurplePluginProtocolInfo), /* struct_size */ NULL, /* get_account_text_table */ NULL, /* initate_media */ NULL, /* get_media_caps */ NULL, /* get_moods */ NULL, /* set_public_alias */ - NULL, /* get_public_alias */ - NULL, /* add_buddy_with_invite */ - NULL /* add_buddies_with_invite */ + NULL /* get_public_alias */ }; static PurplePluginInfo info = { diff --git a/libpurple/proxy.c b/libpurple/proxy.c index 8606f51407..807d73da6d 100644 --- a/libpurple/proxy.c +++ b/libpurple/proxy.c @@ -41,6 +41,16 @@ #include "proxy.h" #include "util.h" +struct _PurpleProxyInfo +{ + PurpleProxyType type; /**< The proxy type. */ + + char *host; /**< The host. */ + int port; /**< The port number. */ + char *username; /**< The username. */ + char *password; /**< The password. */ +}; + struct _PurpleProxyConnectData { void *handle; PurpleProxyConnectFunction connect_cb; @@ -1369,7 +1379,7 @@ s4_canwrite(gpointer data, gint source, PurpleInputCondition cond) proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); } else { - connect_data->query_data = purple_dnsquery_a_account( + connect_data->query_data = purple_dnsquery_a( connect_data->account, connect_data->host, connect_data->port, s4_host_resolved, connect_data); @@ -2014,7 +2024,6 @@ s5_canwrite(gpointer data, gint source, PurpleInputCondition cond) return; } - i = 0; buf[0] = 0x05; /* SOCKS version 5 */ if (purple_proxy_info_get_username(connect_data->gpi) != NULL) { @@ -2088,7 +2097,7 @@ proxy_connect_socks5(PurpleProxyConnectData *connect_data, struct sockaddr *addr /** * This function attempts to connect to the next IP address in the list - * of IP addresses returned to us by purple_dnsquery_a() and attemps + * of IP addresses returned to us by purple_dnsquery_a() and attempts * to connect to each one. This is called after the hostname is * resolved, and each time a connection attempt fails (assuming there * is another IP address to try). @@ -2317,7 +2326,7 @@ purple_proxy_connect(void *handle, PurpleAccount *account, return NULL; } - connect_data->query_data = purple_dnsquery_a_account(account, connecthost, + connect_data->query_data = purple_dnsquery_a(account, connecthost, connectport, connection_host_resolved, connect_data); if (connect_data->query_data == NULL) { @@ -2385,7 +2394,7 @@ purple_proxy_connect_udp(void *handle, PurpleAccount *account, return NULL; } - connect_data->query_data = purple_dnsquery_a_account(account, connecthost, + connect_data->query_data = purple_dnsquery_a(account, connecthost, connectport, connection_host_resolved, connect_data); if (connect_data->query_data == NULL) { @@ -2398,17 +2407,6 @@ purple_proxy_connect_udp(void *handle, PurpleAccount *account, return connect_data; } -PurpleProxyConnectData * -purple_proxy_connect_socks5(void *handle, PurpleProxyInfo *gpi, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, - gpointer data) -{ - return purple_proxy_connect_socks5_account(NULL, handle, gpi, - host, port, connect_cb, data); -} - - /* This is called when we connect to the SOCKS5 proxy server (through any * relevant account proxy) */ diff --git a/libpurple/proxy.h b/libpurple/proxy.h index cf91ee8c71..e12e328bc2 100644 --- a/libpurple/proxy.h +++ b/libpurple/proxy.h @@ -47,16 +47,7 @@ typedef enum /** * Information on proxy settings. */ -typedef struct -{ - PurpleProxyType type; /**< The proxy type. */ - - char *host; /**< The host. */ - int port; /**< The port number. */ - char *username; /**< The username. */ - char *password; /**< The password. */ - -} PurpleProxyInfo; +typedef struct _PurpleProxyInfo PurpleProxyInfo; typedef struct _PurpleProxyConnectData PurpleProxyConnectData; @@ -191,7 +182,6 @@ PurpleProxyInfo *purple_global_proxy_get_info(void); * Set purple's global proxy information. * * @param info The proxy information. - * @since 2.6.0 */ void purple_global_proxy_set_info(PurpleProxyInfo *info); @@ -316,35 +306,6 @@ PurpleProxyConnectData *purple_proxy_connect_socks5_account(void *handle, const char *host, int port, PurpleProxyConnectFunction connect_cb, gpointer data); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PROXY_C_) -/** - * Makes a connection through a SOCKS5 proxy. - * - * @param handle A handle that should be associated with this - * connection attempt. The handle can be used - * to cancel the connection attempt using the - * purple_proxy_connect_cancel_with_handle() - * function. - * @param gpi The PurpleProxyInfo specifying the proxy settings - * @param host The destination host. - * @param port The destination port. - * @param connect_cb The function to call when the connection is - * established. If the connection failed then - * fd will be -1 and error message will be set - * to something descriptive (hopefully). - * @param data User-defined data. - * - * @return NULL if there was an error, or a reference to an - * opaque data structure that can be used to cancel - * the pending connection, if needed. - * @deprecated Use purple_proxy_connect_socks5_account instead - */ -PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle, - PurpleProxyInfo *gpi, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data); -#endif - /** * Cancel an in-progress connection attempt. This should be called * by the PRPL if the user disables an account while it is still diff --git a/libpurple/prpl.c b/libpurple/prpl.c index 7849189d77..b366079d47 100644 --- a/libpurple/prpl.c +++ b/libpurple/prpl.c @@ -32,6 +32,17 @@ /**************************************************************************/ /** @name Attention Type API */ /**************************************************************************/ + +struct _PurpleAttentionType +{ + const char *name; /**< Shown in GUI elements */ + const char *incoming_description; /**< Shown when sent */ + const char *outgoing_description; /**< Shown when receied */ + const char *icon_name; /**< Icon to display (optional) */ + const char *unlocalized_name; /**< Unlocalized name for UIs needing it */ +}; + + PurpleAttentionType * purple_attention_type_new(const char *ulname, const char *name, const char *inc_desc, const char *out_desc) @@ -435,13 +446,13 @@ purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_cod g_return_if_fail(gc != NULL); g_return_if_fail(who != NULL); - prpl = purple_find_prpl(purple_account_get_protocol_id(gc->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_connection_get_account(gc))); send_attention = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention; g_return_if_fail(send_attention != NULL); mtime = time(NULL); - attn = purple_get_attention_type_from_code(gc->account, type_code); + attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code); if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) alias = purple_buddy_get_contact_alias(buddy); @@ -462,7 +473,7 @@ purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_cod if (!send_attention(gc, who, type_code)) return; - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, gc->account, who); + conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, purple_connection_get_account(gc), who); purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, description, flags, mtime); purple_prpl_attention(conv, who, type_code, PURPLE_MESSAGE_SEND, time(NULL)); @@ -481,7 +492,7 @@ got_attention(PurpleConnection *gc, int id, const char *who, guint type_code) mtime = time(NULL); - attn = purple_get_attention_type_from_code(gc->account, type_code); + attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code); /* PURPLE_MESSAGE_NOTIFY is for attention messages. */ flags = PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_RECV; diff --git a/libpurple/prpl.h b/libpurple/prpl.h index 51e8575d3e..f20cfb2a25 100644 --- a/libpurple/prpl.h +++ b/libpurple/prpl.h @@ -31,7 +31,10 @@ #define _PURPLE_PRPL_H_ typedef struct _PurplePluginProtocolInfo PurplePluginProtocolInfo; -/** @copydoc _PurpleAttentionType */ + +/** Represents "nudges" and "buzzes" that you may send to a buddy to attract + * their attention (or vice-versa). + */ typedef struct _PurpleAttentionType PurpleAttentionType; /**************************************************************************/ @@ -111,23 +114,6 @@ struct proto_chat_entry { gboolean secret; /**< True if the entry is secret (password) */ }; -/** Represents "nudges" and "buzzes" that you may send to a buddy to attract - * their attention (or vice-versa). - */ -struct _PurpleAttentionType -{ - const char *name; /**< Shown in GUI elements */ - const char *incoming_description; /**< Shown when sent */ - const char *outgoing_description; /**< Shown when receied */ - const char *icon_name; /**< Icon to display (optional) */ - const char *unlocalized_name; /**< Unlocalized name for UIs needing it */ - - /* Reserved fields for future purposes */ - gpointer _reserved2; - gpointer _reserved3; - gpointer _reserved4; -}; - /** * Protocol options * @@ -200,14 +186,12 @@ typedef enum /** * Indicates that slash commands are native to this protocol. * Used as a hint that unknown commands should not be sent as messages. - * @since 2.1.0 */ OPT_PROTO_SLASH_COMMANDS_NATIVE = 0x00000400, /** * Indicates that this protocol supports sending a user-supplied message * along with an invitation. - * @since 2.8.0 */ OPT_PROTO_INVITE_MESSAGE = 0x00000800 @@ -222,6 +206,27 @@ typedef enum */ struct _PurplePluginProtocolInfo { + /** + * The size of the PurplePluginProtocolInfo. This should always be sizeof(PurplePluginProtocolInfo). + * This allows adding more functions to this struct without requiring a major version bump. + */ + unsigned long struct_size; + + /* NOTE: + * If more functions are added, they should accessed using the following syntax: + * + * if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, new_function)) + * prpl->new_function(...); + * + * instead of + * + * if (prpl->new_function != NULL) + * prpl->new_function(...); + * + * The PURPLE_PROTOCOL_PLUGIN_HAS_FUNC macro can be used for the older member + * functions (e.g. login, send_im etc.) too. + */ + PurpleProtocolOptions options; /**< Protocol options. */ GList *user_splits; /**< A GList of PurpleAccountUserSplit */ @@ -333,6 +338,7 @@ struct _PurplePluginProtocolInfo void (*set_idle)(PurpleConnection *, int idletime); void (*change_passwd)(PurpleConnection *, const char *old_pass, const char *new_pass); + /** * Add a buddy to a group on the server. * @@ -341,11 +347,10 @@ struct _PurplePluginProtocolInfo * authorization and the user is not already authorized to see the * status of \a buddy, \a add_buddy should request authorization. * - * @deprecated Since 2.8.0, add_buddy_with_invite is preferred. - * @see add_buddy_with_invite + * If authorization is required, then use the supplied invite message. */ - void (*add_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group); - void (*add_buddies)(PurpleConnection *, GList *buddies, GList *groups); + void (*add_buddy)(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group, const char *message); + void (*add_buddies)(PurpleConnection *pc, GList *buddies, GList *groups, const char *message); void (*remove_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group); void (*remove_buddies)(PurpleConnection *, GList *buddies, GList *groups); void (*add_permit)(PurpleConnection *, const char *name); @@ -444,11 +449,6 @@ struct _PurplePluginProtocolInfo * @deprecated Use #PurplePluginProtocolInfo.get_info instead. */ void (*get_cb_info)(PurpleConnection *, int, const char *who); - /** - * @deprecated Use #PurplePluginProtocolInfo.get_cb_real_name and - * #PurplePluginProtocolInfo.status_text instead. - */ - void (*get_cb_away)(PurpleConnection *, int, const char *who); /** save/store buddy's alias on server list/roster */ void (*alias_buddy)(PurpleConnection *, const char *who, @@ -534,27 +534,6 @@ struct _PurplePluginProtocolInfo gboolean (*send_attention)(PurpleConnection *gc, const char *username, guint type); GList *(*get_attention_types)(PurpleAccount *acct); - /** - * The size of the PurplePluginProtocolInfo. This should always be sizeof(PurplePluginProtocolInfo). - * This allows adding more functions to this struct without requiring a major version bump. - */ - unsigned long struct_size; - - /* NOTE: - * If more functions are added, they should accessed using the following syntax: - * - * if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, new_function)) - * prpl->new_function(...); - * - * instead of - * - * if (prpl->new_function != NULL) - * prpl->new_function(...); - * - * The PURPLE_PROTOCOL_PLUGIN_HAS_FUNC macro can be used for the older member - * functions (e.g. login, send_im etc.) too. - */ - /** This allows protocols to specify additional strings to be used for * various purposes. The idea is to stuff a bunch of strings in this hash * table instead of expanding the struct for every addition. This hash @@ -590,7 +569,6 @@ struct _PurplePluginProtocolInfo /** * Returns an array of "PurpleMood"s, with the last one having * "mood" set to @c NULL. - * @since 2.7.0 */ PurpleMood *(*get_moods)(PurpleAccount *account); @@ -610,7 +588,6 @@ struct _PurplePluginProtocolInfo * @param failure_cb Callback to be called if setting the public alias * fails * @see purple_account_set_public_alias - * @since 2.7.0 */ void (*set_public_alias)(PurpleConnection *gc, const char *alias, PurpleSetPublicAliasSuccessCallback success_cb, @@ -627,31 +604,14 @@ struct _PurplePluginProtocolInfo * @param failure_cb Callback to be called if the prpl is unable to * retrieve the alias * @see purple_account_get_public_alias - * @since 2.7.0 */ void (*get_public_alias)(PurpleConnection *gc, PurpleGetPublicAliasSuccessCallback success_cb, PurpleGetPublicAliasFailureCallback failure_cb); - - /** - * Add a buddy to a group on the server. - * - * This PRPL function may be called in situations in which the buddy is - * already in the specified group. If the protocol supports - * authorization and the user is not already authorized to see the - * status of \a buddy, \a add_buddy should request authorization. - * - * If authorization is required, then use the supplied invite message. - * - * @since 2.8.0 - */ - void (*add_buddy_with_invite)(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group, const char *message); - void (*add_buddies_with_invite)(PurpleConnection *pc, GList *buddies, GList *groups, const char *message); }; #define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \ - (((G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < G_STRUCT_OFFSET(PurplePluginProtocolInfo, struct_size)) \ - || (G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < prpl->struct_size)) && \ + (G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < prpl->struct_size && \ prpl->member != NULL) @@ -680,8 +640,8 @@ extern "C" { * should be the same string as @a ulname, with localization. * @param inc_desc A localized description shown when the event is received. * @param out_desc A localized description shown when the event is sent. + * * @return A pointer to the new object. - * @since 2.4.0 */ PurpleAttentionType *purple_attention_type_new(const char *ulname, const char *name, const char *inc_desc, const char *out_desc); @@ -693,7 +653,6 @@ PurpleAttentionType *purple_attention_type_new(const char *ulname, const char *n * @param name The localized name that will be displayed by UIs. This should be * the same string given as the unlocalized name, but with * localization. - * @since 2.4.0 */ void purple_attention_type_set_name(PurpleAttentionType *type, const char *name); @@ -703,7 +662,6 @@ void purple_attention_type_set_name(PurpleAttentionType *type, const char *name) * * @param type The attention type. * @param desc The localized description for incoming events. - * @since 2.4.0 */ void purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const char *desc); @@ -713,7 +671,6 @@ void purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const ch * * @param type The attention type. * @param desc The localized description for outgoing events. - * @since 2.4.0 */ void purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const char *desc); @@ -723,7 +680,6 @@ void purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const ch * @param type The attention type. * @param name The icon's name. * @note Icons are optional for attention events. - * @since 2.4.0 */ void purple_attention_type_set_icon_name(PurpleAttentionType *type, const char *name); @@ -734,7 +690,6 @@ void purple_attention_type_set_icon_name(PurpleAttentionType *type, const char * * @param type The attention type. * @param ulname The unlocalized name. This should be the same string given as * the localized name, but without localization. - * @since 2.4.0 */ void purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const char *ulname); @@ -742,8 +697,8 @@ void purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const * Get the attention type's name as displayed by the UI. * * @param type The attention type. + * * @return The name. - * @since 2.4.0 */ const char *purple_attention_type_get_name(const PurpleAttentionType *type); @@ -752,7 +707,6 @@ const char *purple_attention_type_get_name(const PurpleAttentionType *type); * * @param type The attention type. * @return The description. - * @since 2.4.0 */ const char *purple_attention_type_get_incoming_desc(const PurpleAttentionType *type); @@ -761,7 +715,6 @@ const char *purple_attention_type_get_incoming_desc(const PurpleAttentionType *t * * @param type The attention type. * @return The description. - * @since 2.4.0 */ const char *purple_attention_type_get_outgoing_desc(const PurpleAttentionType *type); @@ -771,7 +724,6 @@ const char *purple_attention_type_get_outgoing_desc(const PurpleAttentionType *t * @param type The attention type. * @return The icon name or @c NULL if unset/empty. * @note Icons are optional for attention events. - * @since 2.4.0 */ const char *purple_attention_type_get_icon_name(const PurpleAttentionType *type); @@ -780,7 +732,6 @@ const char *purple_attention_type_get_icon_name(const PurpleAttentionType *type) * * @param type The attention type * @return The unlocalized name. - * @since 2.4.0 */ const char *purple_attention_type_get_unlocalized_name(const PurpleAttentionType *type); @@ -836,7 +787,6 @@ void purple_prpl_got_account_status(PurpleAccount *account, * @param account The account. * * @see account-actions-changed - * @since 2.6.0 */ void purple_prpl_got_account_actions(PurpleAccount *account); @@ -927,8 +877,6 @@ GList *purple_prpl_get_statuses(PurpleAccount *account, PurplePresence *presence * * Note that you can't send arbitrary PurpleAttentionType's, because there is * only a fixed set of attention commands. - * - * @since 2.5.0 */ void purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_code); @@ -939,8 +887,6 @@ void purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint typ * @param who Who requested your attention. * @param type_code An index into the prpl's attention_types list determining the type * of the attention request command to send. - * - * @since 2.5.0 */ void purple_prpl_got_attention(PurpleConnection *gc, const char *who, guint type_code); @@ -952,8 +898,6 @@ void purple_prpl_got_attention(PurpleConnection *gc, const char *who, guint type * @param who Who requested your attention. * @param type_code An index into the prpl's attention_types list determining the type * of the attention request command to send. - * - * @since 2.5.0 */ void purple_prpl_got_attention_in_chat(PurpleConnection *gc, int id, const char *who, guint type_code); @@ -988,7 +932,6 @@ gboolean purple_prpl_initiate_media(PurpleAccount *account, * * @param account The account the user is on. * @param who The name of the contact for which capabilities have been received. - * @since 2.7.0 */ void purple_prpl_got_media_caps(PurpleAccount *account, const char *who); diff --git a/libpurple/purple-3.pc.in b/libpurple/purple-3.pc.in index 9506b6f5be..281a522a96 100644 --- a/libpurple/purple-3.pc.in +++ b/libpurple/purple-3.pc.in @@ -1,7 +1,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@ +includedir=@includedir@/libpurple datarootdir=@datarootdir@ datadir=@datadir@ sysconfdir=@sysconfdir@ diff --git a/libpurple/purple.h.in b/libpurple/purple.h.in index a96b2537ec..327bea0f9c 100644 --- a/libpurple/purple.h.in +++ b/libpurple/purple.h.in @@ -6,7 +6,6 @@ * include any other libpurple files. * * @ingroup core libpurple - * @since 2.3.0 */ /* purple diff --git a/libpurple/request.c b/libpurple/request.c index 01966dc435..985008f7ab 100644 --- a/libpurple/request.c +++ b/libpurple/request.c @@ -42,6 +42,108 @@ typedef struct } PurpleRequestInfo; +struct _PurpleRequestField +{ + PurpleRequestFieldType type; + PurpleRequestFieldGroup *group; + + char *id; + char *label; + char *type_hint; + + gboolean visible; + gboolean required; + + union + { + struct + { + gboolean multiline; + gboolean masked; + gboolean editable; + char *default_value; + char *value; + + } string; + + struct + { + int default_value; + int value; + + } integer; + + struct + { + gboolean default_value; + gboolean value; + + } boolean; + + struct + { + int default_value; + int value; + + GList *labels; + + } choice; + + struct + { + GList *items; + GList *icons; + GHashTable *item_data; + GList *selected; + GHashTable *selected_table; + + gboolean multiple_selection; + + } list; + + struct + { + PurpleAccount *default_account; + PurpleAccount *account; + gboolean show_all; + + PurpleFilterAccountFunc filter_func; + + } account; + + struct + { + unsigned int scale_x; + unsigned int scale_y; + const char *buffer; + gsize size; + } image; + + } u; + + void *ui_data; + char *tooltip; +}; + +struct _PurpleRequestFields +{ + GList *groups; + + GHashTable *fields; + + GList *required_fields; + + void *ui_data; +}; + +struct _PurpleRequestFieldGroup +{ + PurpleRequestFields *fields_list; + + char *title; + + GList *fields; +}; PurpleRequestFields * purple_request_fields_new(void) @@ -271,6 +373,20 @@ purple_request_fields_get_account(const PurpleRequestFields *fields, return purple_request_field_account_get_value(field); } +gpointer purple_request_fields_get_ui_data(const PurpleRequestFields *fields) +{ + g_return_val_if_fail(fields != NULL, NULL); + + return fields->ui_data; +} + +void purple_request_fields_set_ui_data(PurpleRequestFields *fields, gpointer ui_data) +{ + g_return_if_fail(fields != NULL); + + fields->ui_data = ui_data; +} + PurpleRequestFieldGroup * purple_request_field_group_new(const char *title) { @@ -337,6 +453,14 @@ purple_request_field_group_get_fields(const PurpleRequestFieldGroup *group) return group->fields; } +PurpleRequestFields * +purple_request_field_group_get_fields_list(const PurpleRequestFieldGroup *group) +{ + g_return_val_if_fail(group != NULL, NULL); + + return group->fields_list; +} + PurpleRequestField * purple_request_field_new(const char *id, const char *text, PurpleRequestFieldType type) @@ -864,13 +988,6 @@ purple_request_field_list_get_data(const PurpleRequestField *field, return g_hash_table_lookup(field->u.list.item_data, text); } -void -purple_request_field_list_add(PurpleRequestField *field, const char *item, - void *data) -{ - purple_request_field_list_add_icon(field, item, NULL, data); -} - void purple_request_field_list_add_icon(PurpleRequestField *field, const char *item, const char* icon_path, void *data) diff --git a/libpurple/request.h b/libpurple/request.h index 9330894982..009c32bedb 100644 --- a/libpurple/request.h +++ b/libpurple/request.h @@ -30,9 +30,21 @@ #include #include -/** @copydoc _PurpleRequestField */ +/** + * A request field. + */ typedef struct _PurpleRequestField PurpleRequestField; +/** + * Multiple fields request data. + */ +typedef struct _PurpleRequestFields PurpleRequestFields; + +/** + * A group of fields with a title. + */ +typedef struct _PurpleRequestFieldGroup PurpleRequestFieldGroup; + #include "account.h" #define PURPLE_DEFAULT_ACTION_NONE -1 @@ -68,123 +80,6 @@ typedef enum } PurpleRequestFieldType; -/** - * Multiple fields request data. - */ -typedef struct -{ - GList *groups; - - GHashTable *fields; - - GList *required_fields; - - void *ui_data; - -} PurpleRequestFields; - -/** - * A group of fields with a title. - */ -typedef struct -{ - PurpleRequestFields *fields_list; - - char *title; - - GList *fields; - -} PurpleRequestFieldGroup; - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_REQUEST_C_) -/** - * A request field. - */ -struct _PurpleRequestField -{ - PurpleRequestFieldType type; - PurpleRequestFieldGroup *group; - - char *id; - char *label; - char *type_hint; - - gboolean visible; - gboolean required; - - union - { - struct - { - gboolean multiline; - gboolean masked; - gboolean editable; - char *default_value; - char *value; - - } string; - - struct - { - int default_value; - int value; - - } integer; - - struct - { - gboolean default_value; - gboolean value; - - } boolean; - - struct - { - int default_value; - int value; - - GList *labels; - - } choice; - - struct - { - GList *items; - GList *icons; - GHashTable *item_data; - GList *selected; - GHashTable *selected_table; - - gboolean multiple_selection; - - } list; - - struct - { - PurpleAccount *default_account; - PurpleAccount *account; - gboolean show_all; - - PurpleFilterAccountFunc filter_func; - - } account; - - struct - { - unsigned int scale_x; - unsigned int scale_y; - const char *buffer; - gsize size; - } image; - - } u; - - void *ui_data; - char *tooltip; - -}; -#endif - /** * Request UI operations. */ @@ -411,6 +306,25 @@ int purple_request_fields_get_choice(const PurpleRequestFields *fields, PurpleAccount *purple_request_fields_get_account(const PurpleRequestFields *fields, const char *id); +/** + * Returns the UI data associated with this object. + * + * @param fields The fields list. + * + * @return The UI data associated with this object. This is a + * convenience field provided to the UIs--it is not + * used by the libuprple core. + */ +gpointer purple_request_fields_get_ui_data(const PurpleRequestFields *fields); + +/** + * Set the UI data associated with this object. + * + * @param fields The fields list. + * @param ui_data A pointer to associate with this object. + */ +void purple_request_fields_set_ui_data(PurpleRequestFields *fields, gpointer ui_data); + /*@}*/ /**************************************************************************/ @@ -463,6 +377,16 @@ const char *purple_request_field_group_get_title( GList *purple_request_field_group_get_fields( const PurpleRequestFieldGroup *group); +/** + * Returns a list of all fields in a group. + * + * @param group The group. + * + * @constreturn The list of fields in the group. + */ +PurpleRequestFields *purple_request_field_group_get_fields_list( + const PurpleRequestFieldGroup *group); + /*@}*/ /**************************************************************************/ @@ -553,8 +477,6 @@ PurpleRequestFieldType purple_request_field_get_type(const PurpleRequestField *f * @param field The field. * * @return The UI data. - * - * @since 2.6.0 */ PurpleRequestFieldGroup *purple_request_field_get_group(const PurpleRequestField *field); @@ -618,8 +540,6 @@ gboolean purple_request_field_is_required(const PurpleRequestField *field); * @param field The field. * * @return The UI data. - * - * @since 2.6.0 */ gpointer purple_request_field_get_ui_data(const PurpleRequestField *field); @@ -630,8 +550,6 @@ gpointer purple_request_field_get_ui_data(const PurpleRequestField *field); * @param ui_data The UI data. * * @return The UI data. - * - * @since 2.6.0 */ void purple_request_field_set_ui_data(PurpleRequestField *field, gpointer ui_data); @@ -978,18 +896,6 @@ gboolean purple_request_field_list_get_multi_select( void *purple_request_field_list_get_data(const PurpleRequestField *field, const char *text); -/** - * Adds an item to a list field. - * - * @param field The list field. - * @param item The list item. - * @param data The associated data. - * - * @deprecated Use purple_request_field_list_add_icon() instead. - */ -void purple_request_field_list_add(PurpleRequestField *field, - const char *item, void *data); - /** * Adds an item to a list field. * @@ -1424,8 +1330,7 @@ void *purple_request_action_varg(void *handle, const char *title, /** * Version of purple_request_action() supplying an image for the UI to - * optionally display as an icon in the dialog; see its documentation - * @since 2.7.0 + * optionally display as an icon in the dialog; see its documentation. */ void *purple_request_action_with_icon(void *handle, const char *title, const char *primary, const char *secondary, int default_action, @@ -1436,7 +1341,6 @@ void *purple_request_action_with_icon(void *handle, const char *title, /** * va_list version of purple_request_action_with_icon(); * see its documentation. - * @since 2.7.0 */ void *purple_request_action_with_icon_varg(void *handle, const char *title, const char *primary, const char *secondary, int default_action, diff --git a/libpurple/roomlist.c b/libpurple/roomlist.c index 8a415ebe00..ad32d6d30b 100644 --- a/libpurple/roomlist.c +++ b/libpurple/roomlist.c @@ -32,6 +32,39 @@ #include "roomlist.h" #include "server.h" +/** + * Represents a list of rooms for a given connection on a given protocol. + */ +struct _PurpleRoomlist { + PurpleAccount *account; /**< The account this list belongs to. */ + GList *fields; /**< The fields. */ + GList *rooms; /**< The list of rooms. */ + gboolean in_progress; /**< The listing is in progress. */ + gpointer ui_data; /**< UI private data. */ + gpointer proto_data; /** Prpl private data. */ + guint ref; /**< The reference count. */ +}; + +/** + * Represents a room. + */ +struct _PurpleRoomlistRoom { + PurpleRoomlistRoomType type; /**< The type of room. */ + gchar *name; /**< The name of the room. */ + GList *fields; /**< Other fields. */ + PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */ + gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */ +}; + +/** + * A field a room might have. + */ +struct _PurpleRoomlistField { + PurpleRoomlistFieldType type; /**< The type of field. */ + gchar *label; /**< The i18n user displayed name of the field. */ + gchar *name; /**< The internal name of the field. */ + gboolean hidden; /**< Hidden? */ +}; static PurpleRoomlistUiOps *ops = NULL; @@ -127,6 +160,13 @@ void purple_roomlist_unref(PurpleRoomlist *list) purple_roomlist_destroy(list); } +PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list) +{ + g_return_val_if_fail(list != NULL, NULL); + + return list->account; +} + void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields) { g_return_if_fail(list != NULL); @@ -234,6 +274,34 @@ GList * purple_roomlist_get_fields(PurpleRoomlist *list) return list->fields; } +gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list) +{ + g_return_val_if_fail(list != NULL, NULL); + + return list->proto_data; +} + +void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data) +{ + g_return_if_fail(list != NULL); + + list->proto_data = proto_data; +} + +gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list) +{ + g_return_val_if_fail(list != NULL, NULL); + + return list->ui_data; +} + +void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data) +{ + g_return_if_fail(list != NULL); + + list->ui_data = ui_data; +} + /*@}*/ /**************************************************************************/ @@ -329,7 +397,21 @@ PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room) return room->parent; } -GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room) +gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room) +{ + g_return_val_if_fail(room != NULL, FALSE); + + return room->expanded_once; +} + +void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once) +{ + g_return_if_fail(room != NULL); + + room->expanded_once = expanded_once; +} + +GList *purple_roomlist_room_get_fields(PurpleRoomlistRoom *room) { return room->fields; } diff --git a/libpurple/roomlist.h b/libpurple/roomlist.h index de9270f002..b85933b76b 100644 --- a/libpurple/roomlist.h +++ b/libpurple/roomlist.h @@ -63,40 +63,6 @@ typedef enum /** Data Structures */ /**************************************************************************/ -/** - * Represents a list of rooms for a given connection on a given protocol. - */ -struct _PurpleRoomlist { - PurpleAccount *account; /**< The account this list belongs to. */ - GList *fields; /**< The fields. */ - GList *rooms; /**< The list of rooms. */ - gboolean in_progress; /**< The listing is in progress. */ - gpointer ui_data; /**< UI private data. */ - gpointer proto_data; /** Prpl private data. */ - guint ref; /**< The reference count. */ -}; - -/** - * Represents a room. - */ -struct _PurpleRoomlistRoom { - PurpleRoomlistRoomType type; /**< The type of room. */ - gchar *name; /**< The name of the room. */ - GList *fields; /**< Other fields. */ - PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */ - gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */ -}; - -/** - * A field a room might have. - */ -struct _PurpleRoomlistField { - PurpleRoomlistFieldType type; /**< The type of field. */ - gchar *label; /**< The i18n user displayed name of the field. */ - gchar *name; /**< The internal name of the field. */ - gboolean hidden; /**< Hidden? */ -}; - /** * The room list ops to be filled out by the UI. */ @@ -162,6 +128,14 @@ void purple_roomlist_ref(PurpleRoomlist *list); */ void purple_roomlist_unref(PurpleRoomlist *list); +/** + * Retrieve the PurpleAccount that was given when the room list was + * created. + * + * @return The PurpleAccount tied to this room list. + */ +PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list); + /** * Set the different field types and their names for this protocol. * @@ -241,11 +215,48 @@ void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *c /** * Get the list of fields for a roomlist. * - * @param roomlist The roomlist, which must not be @c NULL. + * @param roomlist The roomlist, which must not be @c NULL. * @constreturn A list of fields - * @since 2.4.0 */ -GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist); +GList *purple_roomlist_get_fields(PurpleRoomlist *roomlist); + +/** + * Get the protocol data associated with this room list. + * + * @param list The roomlist, which must not be @c NULL. + * + * @return The protocol data associated with this room list. This is a + * convenience field provided to the protocol plugin--it is not + * used the libpurple core. + */ +gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list); + +/** + * Set the protocol data associated with this room list. + * + * @param list The roomlist, which must not be @c NULL. + * @param proto_data A pointer to associate with this room list. + */ +void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data); + +/** + * Get the UI data associated with this room list. + * + * @param list The roomlist, which must not be @c NULL. + * + * @return The UI data associated with this room list. This is a + * convenience field provided to the UIs--it is not + * used by the libpurple core. + */ +gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list); + +/** + * Set the UI data associated with this room list. + * + * @param list The roomlist, which must not be @c NULL. + * @param ui_data A pointer to associate with this room list. + */ +void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data); /*@}*/ @@ -287,7 +298,6 @@ void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room); * Get the type of a room. * @param room The room, which must not be @c NULL. * @return The type of the room. - * @since 2.4.0 */ PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room); @@ -295,7 +305,6 @@ PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room); * Get the name of a room. * @param room The room, which must not be @c NULL. * @return The name of the room. - * @since 2.4.0 */ const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room); @@ -303,16 +312,31 @@ const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room); * Get the parent of a room. * @param room The room, which must not be @c NULL. * @return The parent of the room, which can be @c NULL. - * @since 2.4.0 */ PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room); +/** + * Get the value of the expanded_once flag. + * + * @param room The room, which must not be @c NULL. + * + * @return The value of the expanded_once flag. + */ +gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room); + +/** + * Set the expanded_once flag. + * + * @param room The room, which must not be @c NULL. + * @param expanded_once The new value of the expanded_once flag. + */ +void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once); + /** * Get the list of fields for a room. * * @param room The room, which must not be @c NULL. * @constreturn A list of fields - * @since 2.4.0 */ GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room); @@ -344,7 +368,6 @@ PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, * @param field A PurpleRoomlistField, which must not be @c NULL. * * @return The type of the field. - * @since 2.4.0 */ PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field); @@ -354,7 +377,6 @@ PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *fiel * @param field A PurpleRoomlistField, which must not be @c NULL. * * @return The label of the field. - * @since 2.4.0 */ const char * purple_roomlist_field_get_label(PurpleRoomlistField *field); @@ -363,7 +385,6 @@ const char * purple_roomlist_field_get_label(PurpleRoomlistField *field); * @param field A PurpleRoomlistField, which must not be @c NULL. * * @return @c TRUE if the field is hidden, @c FALSE otherwise. - * @since 2.4.0 */ gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field); diff --git a/libpurple/savedstatuses.c b/libpurple/savedstatuses.c index 40377f7b1a..eaee07ee68 100644 --- a/libpurple/savedstatuses.c +++ b/libpurple/savedstatuses.c @@ -403,7 +403,7 @@ parse_substatus(xmlnode *substatus) if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) { ret->type = purple_status_type_find_with_id( - ret->account->status_types, data); + purple_account_get_status_types(ret->account), data); g_free(data); } diff --git a/libpurple/server.c b/libpurple/server.c index 73739720a7..ded5f084ae 100644 --- a/libpurple/server.c +++ b/libpurple/server.c @@ -149,7 +149,7 @@ int serv_send_im(PurpleConnection *gc, const char *name, const char *message, * this only reset lar->sent if we're away AND idle? */ auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); - if((gc->flags & PURPLE_CONNECTION_AUTO_RESP) && + if((purple_connection_get_flags(gc) & PURPLE_CONNECTION_AUTO_RESP) && !purple_presence_is_available(presence) && !purple_strequal(auto_reply_pref, "never")) { @@ -325,18 +325,6 @@ PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, return attn; } -void -serv_send_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - purple_prpl_send_attention(gc, who, type_code); -} - -void -serv_got_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - purple_prpl_got_attention(gc, who, type_code); -} - /* * Move a buddy from one group to another on server. @@ -582,7 +570,7 @@ void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, * We should update the conversation window buttons and menu, * if it exists. */ - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, gc->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, purple_connection_get_account(gc)); /* * Make copies of the message and the sender in case plugins want @@ -593,7 +581,7 @@ void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, plugin_return = GPOINTER_TO_INT( purple_signal_emit_return_1(purple_conversations_get_handle(), - "receiving-im-msg", gc->account, + "receiving-im-msg", purple_connection_get_account(gc), &angel, &buffy, conv, &flags)); if (!buffy || !angel || plugin_return) { @@ -605,12 +593,12 @@ void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, name = angel; message = buffy; - purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", gc->account, + purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", purple_connection_get_account(gc), name, message, conv, flags); /* search for conversation again in case it was created by received-im-msg handler */ if (conv == NULL) - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc)); if (conv == NULL) conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); @@ -627,7 +615,7 @@ void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, * - or we're not idle and the 'only auto respond if idle' pref * is set */ - if (gc->flags & PURPLE_CONNECTION_AUTO_RESP) + if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_AUTO_RESP) { PurplePresence *presence; PurpleStatus *status; @@ -700,7 +688,7 @@ void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, PurpleConversation *conv; PurpleConvIm *im = NULL; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc)); if (conv != NULL) { im = PURPLE_CONV_IM(conv); @@ -710,15 +698,15 @@ void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, { case PURPLE_TYPING: purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing", gc->account, name); + "buddy-typing", purple_connection_get_account(gc), name); break; case PURPLE_TYPED: purple_signal_emit(purple_conversations_get_handle(), - "buddy-typed", gc->account, name); + "buddy-typed", purple_connection_get_account(gc), name); break; case PURPLE_NOT_TYPING: purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing-stopped", gc->account, name); + "buddy-typing-stopped", purple_connection_get_account(gc), name); break; } } @@ -732,12 +720,12 @@ void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { PurpleConversation *conv; PurpleConvIm *im; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc)); if (conv != NULL) { im = PURPLE_CONV_IM(conv); - if (im->typing_state == PURPLE_NOT_TYPING) + if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) return; purple_conv_im_stop_typing_timeout(im); @@ -746,7 +734,7 @@ void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { else { purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing-stopped", gc->account, name); + "buddy-typing-stopped", purple_connection_get_account(gc), name); } } @@ -937,7 +925,7 @@ void serv_got_chat_in(PurpleConnection *g, int id, const char *who, plugin_return = GPOINTER_TO_INT( purple_signal_emit_return_1(purple_conversations_get_handle(), - "receiving-chat-msg", g->account, + "receiving-chat-msg", purple_connection_get_account(g), &angel, &buffy, conv, &flags)); if (!buffy || !angel || plugin_return) { @@ -949,7 +937,7 @@ void serv_got_chat_in(PurpleConnection *g, int id, const char *who, who = angel; message = buffy; - purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", g->account, + purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", purple_connection_get_account(g), who, message, conv, flags); purple_conv_chat_write(chat, who, message, flags, mtime); diff --git a/libpurple/server.h b/libpurple/server.h index 504011561b..3ddff92036 100644 --- a/libpurple/server.h +++ b/libpurple/server.h @@ -61,32 +61,6 @@ int serv_send_im(PurpleConnection *, const char *, const char *, PurpleMessageF */ PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, guint type_code); -/** Send an attention request message. - * - * @deprecated Use purple_prpl_send_attention() instead. - * - * @param gc The connection to send the message on. - * @param who Whose attention to request. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. 0 if prpl only defines one - * (for example, Yahoo and MSN), but some protocols define more (MySpaceIM). - * - * Note that you can't send arbitrary PurpleAttentionType's, because there is - * only a fixed set of attention commands. - */ -void serv_send_attention(PurpleConnection *gc, const char *who, guint type_code); - -/** Process an incoming attention message. - * - * @deprecated Use purple_prpl_got_attention() instead. - * - * @param gc The connection that received the attention message. - * @param who Who requested your attention. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. - */ -void serv_got_attention(PurpleConnection *gc, const char *who, guint type_code); - void serv_get_info(PurpleConnection *, const char *); void serv_set_info(PurpleConnection *, const char *); diff --git a/libpurple/smiley.h b/libpurple/smiley.h index 73202bda47..9721c228da 100644 --- a/libpurple/smiley.h +++ b/libpurple/smiley.h @@ -1,7 +1,6 @@ /** * @file smiley.h Smiley API * @ingroup core - * @since 2.5.0 */ /* purple diff --git a/libpurple/sound-theme.c b/libpurple/sound-theme.c index 4918f40758..1f471a3e5c 100644 --- a/libpurple/sound-theme.c +++ b/libpurple/sound-theme.c @@ -24,7 +24,7 @@ #include "sound-theme.h" #define PURPLE_SOUND_THEME_GET_PRIVATE(Gobject) \ - ((PurpleSoundThemePrivate *) ((PURPLE_SOUND_THEME(Gobject))->priv)) + (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PURPLE_TYPE_SOUND_THEME, PurpleSoundThemePrivate)) /****************************************************************************** * Structs @@ -55,8 +55,6 @@ purple_sound_theme_init(GTypeInstance *instance, { PurpleSoundThemePrivate *priv; - (PURPLE_SOUND_THEME(instance))->priv = g_new0(PurpleSoundThemePrivate, 1); - priv = PURPLE_SOUND_THEME_GET_PRIVATE(instance); priv->sound_files = g_hash_table_new_full(g_str_hash, @@ -82,6 +80,8 @@ purple_sound_theme_class_init(PurpleSoundThemeClass *klass) parent_class = g_type_class_peek_parent(klass); + g_type_class_add_private(klass, sizeof(PurpleSoundThemePrivate)); + obj_class->finalize = purple_sound_theme_finalize; } diff --git a/libpurple/sound-theme.h b/libpurple/sound-theme.h index 3814e4527f..adde4fddea 100644 --- a/libpurple/sound-theme.h +++ b/libpurple/sound-theme.h @@ -51,7 +51,6 @@ typedef struct _PurpleSoundThemeClass PurpleSoundThemeClass; struct _PurpleSoundTheme { PurpleTheme parent; - gpointer priv; }; struct _PurpleSoundThemeClass diff --git a/libpurple/sslconn.c b/libpurple/sslconn.c index e6365d390e..34e4a102f3 100644 --- a/libpurple/sslconn.c +++ b/libpurple/sslconn.c @@ -184,15 +184,6 @@ purple_ssl_strerror(PurpleSslErrorType error) } } -PurpleSslConnection * -purple_ssl_connect_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - void *data) -{ - return purple_ssl_connect_with_host_fd(account, fd, func, error_func, NULL, data); -} - PurpleSslConnection * purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, PurpleSslInputFunction func, diff --git a/libpurple/sslconn.h b/libpurple/sslconn.h index 0bceccd57a..bb176505df 100644 --- a/libpurple/sslconn.h +++ b/libpurple/sslconn.h @@ -203,7 +203,6 @@ PurpleSslConnection *purple_ssl_connect(PurpleAccount *account, const char *host * @param data User-defined data. * * @return The SSL connection handle. - * @since 2.6.0 */ PurpleSslConnection *purple_ssl_connect_with_ssl_cn(PurpleAccount *account, const char *host, int port, PurpleSslInputFunction func, @@ -211,26 +210,6 @@ PurpleSslConnection *purple_ssl_connect_with_ssl_cn(PurpleAccount *account, cons const char *ssl_host, void *data); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_SSLCONN_C_) -/** - * Makes a SSL connection using an already open file descriptor. - * - * @deprecated Use purple_ssl_connect_with_host_fd() instead. - * - * @param account The account making the connection. - * @param fd The file descriptor. - * @param func The SSL input handler function. - * @param error_func The SSL error handler function. - * @param data User-defined data. - * - * @return The SSL connection handle. - */ -PurpleSslConnection *purple_ssl_connect_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - void *data); -#endif - /** * Makes a SSL connection using an already open file descriptor. * @@ -242,8 +221,6 @@ PurpleSslConnection *purple_ssl_connect_fd(PurpleAccount *account, int fd, * @param data User-defined data. * * @return The SSL connection handle. - * - * @since 2.2.0 */ PurpleSslConnection *purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, PurpleSslInputFunction func, @@ -298,8 +275,6 @@ size_t purple_ssl_write(PurpleSslConnection *gsc, const void *buffer, size_t len * * @return The peer certificate chain, in the order of certificate, issuer, * issuer's issuer, etc. @a NULL if no certificates have been provided, - * - * @since 2.2.0 */ GList * purple_ssl_get_peer_certificates(PurpleSslConnection *gsc); diff --git a/libpurple/status.c b/libpurple/status.c index 6d093c99be..9d43446efb 100644 --- a/libpurple/status.c +++ b/libpurple/status.c @@ -257,6 +257,42 @@ purple_status_type_new(PurpleStatusPrimitive primitive, const char *id, user_settable, FALSE); } +static void +status_type_add_attr(PurpleStatusType *status_type, const char *id, + const char *name, PurpleValue *value) +{ + PurpleStatusAttr *attr; + + g_return_if_fail(status_type != NULL); + g_return_if_fail(id != NULL); + g_return_if_fail(name != NULL); + g_return_if_fail(value != NULL); + + attr = purple_status_attr_new(id, name, value); + + status_type->attrs = g_list_append(status_type->attrs, attr); +} + +static void +status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args) +{ + const char *id, *name; + PurpleValue *value; + + g_return_if_fail(status_type != NULL); + + while ((id = va_arg(args, const char *)) != NULL) + { + name = va_arg(args, const char *); + g_return_if_fail(name != NULL); + + value = va_arg(args, PurpleValue *); + g_return_if_fail(value != NULL); + + status_type_add_attr(status_type, id, name, value); + } +} + PurpleStatusType * purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, const char *id, const char *name, @@ -277,10 +313,10 @@ purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, user_settable, independent); /* Add the first attribute */ - purple_status_type_add_attr(status_type, attr_id, attr_name, attr_value); + status_type_add_attr(status_type, attr_id, attr_name, attr_value); va_start(args, attr_value); - purple_status_type_add_attrs_vargs(status_type, args); + status_type_add_attrs_vargs(status_type, args); va_end(args); return status_type; @@ -301,61 +337,6 @@ purple_status_type_destroy(PurpleStatusType *status_type) g_free(status_type); } -void -purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value) -{ - PurpleStatusAttr *attr; - - g_return_if_fail(status_type != NULL); - g_return_if_fail(id != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(value != NULL); - - attr = purple_status_attr_new(id, name, value); - - status_type->attrs = g_list_append(status_type->attrs, attr); -} - -void -purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args) -{ - const char *id, *name; - PurpleValue *value; - - g_return_if_fail(status_type != NULL); - - while ((id = va_arg(args, const char *)) != NULL) - { - name = va_arg(args, const char *); - g_return_if_fail(name != NULL); - - value = va_arg(args, PurpleValue *); - g_return_if_fail(value != NULL); - - purple_status_type_add_attr(status_type, id, name, value); - } -} - -void -purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value, ...) -{ - va_list args; - - g_return_if_fail(status_type != NULL); - g_return_if_fail(id != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(value != NULL); - - /* Add the first attribute */ - purple_status_type_add_attr(status_type, id, name, value); - - va_start(args, value); - purple_status_type_add_attrs_vargs(status_type, args); - va_end(args); -} - PurpleStatusPrimitive purple_status_type_get_primitive(const PurpleStatusType *status_type) { @@ -687,6 +668,68 @@ status_has_changed(PurpleStatus *status) notify_status_update(presence, old_status, status); } +static void +status_set_attr_boolean(PurpleStatus *status, const char *id, + gboolean value) +{ + PurpleValue *attr_value; + + g_return_if_fail(status != NULL); + g_return_if_fail(id != NULL); + + /* Make sure this attribute exists and is the correct type. */ + attr_value = purple_status_get_attr_value(status, id); + g_return_if_fail(attr_value != NULL); + g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_BOOLEAN); + + purple_value_set_boolean(attr_value, value); +} + +static void +status_set_attr_int(PurpleStatus *status, const char *id, int value) +{ + PurpleValue *attr_value; + + g_return_if_fail(status != NULL); + g_return_if_fail(id != NULL); + + /* Make sure this attribute exists and is the correct type. */ + attr_value = purple_status_get_attr_value(status, id); + g_return_if_fail(attr_value != NULL); + g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_INT); + + purple_value_set_int(attr_value, value); +} + +static void +status_set_attr_string(PurpleStatus *status, const char *id, + const char *value) +{ + PurpleValue *attr_value; + + g_return_if_fail(status != NULL); + g_return_if_fail(id != NULL); + + /* Make sure this attribute exists and is the correct type. */ + attr_value = purple_status_get_attr_value(status, id); + /* This used to be g_return_if_fail, but it's failing a LOT, so + * let's generate a log error for now. */ + /* g_return_if_fail(attr_value != NULL); */ + if (attr_value == NULL) { + purple_debug_error("status", + "Attempted to set status attribute '%s' for " + "status '%s', which is not legal. Fix " + "this!\n", id, + purple_status_type_get_name(purple_status_get_type(status))); + return; + } + g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_STRING); + + /* XXX: Check if the value has actually changed. If it has, and the status + * is active, should this trigger 'status_has_changed'? */ + purple_value_set_string(attr_value, value); +} + void purple_status_set_active(PurpleStatus *status, gboolean active) { @@ -763,31 +806,31 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, specified_attr_ids = g_list_prepend(specified_attr_ids, (gpointer)id); - if (value->type == PURPLE_TYPE_STRING) + if (purple_value_get_type(value) == PURPLE_TYPE_STRING) { const gchar *string_data = l->data; l = l->next; - if (purple_strequal(string_data, value->data.string_data)) + if (purple_strequal(string_data, purple_value_get_string(value))) continue; - purple_status_set_attr_string(status, id, string_data); + status_set_attr_string(status, id, string_data); changed = TRUE; } - else if (value->type == PURPLE_TYPE_INT) + else if (purple_value_get_type(value) == PURPLE_TYPE_INT) { int int_data = GPOINTER_TO_INT(l->data); l = l->next; - if (int_data == value->data.int_data) + if (int_data == purple_value_get_int(value)) continue; - purple_status_set_attr_int(status, id, int_data); + status_set_attr_int(status, id, int_data); changed = TRUE; } - else if (value->type == PURPLE_TYPE_BOOLEAN) + else if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) { gboolean boolean_data = GPOINTER_TO_INT(l->data); l = l->next; - if (boolean_data == value->data.boolean_data) + if (boolean_data == purple_value_get_boolean(value)) continue; - purple_status_set_attr_boolean(status, id, boolean_data); + status_set_attr_boolean(status, id, boolean_data); changed = TRUE; } else @@ -809,7 +852,7 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, if (!g_list_find_custom(specified_attr_ids, attr->id, (GCompareFunc)strcmp)) { PurpleValue *default_value; default_value = purple_status_attr_get_value(attr); - if (default_value->type == PURPLE_TYPE_STRING) { + if (purple_value_get_type(default_value) == PURPLE_TYPE_STRING) { const char *cur = purple_status_get_attr_string(status, attr->id); const char *def = purple_value_get_string(default_value); if ((cur == NULL && def == NULL) @@ -818,21 +861,21 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, continue; } - purple_status_set_attr_string(status, attr->id, def); - } else if (default_value->type == PURPLE_TYPE_INT) { + status_set_attr_string(status, attr->id, def); + } else if (purple_value_get_type(default_value) == PURPLE_TYPE_INT) { int cur = purple_status_get_attr_int(status, attr->id); int def = purple_value_get_int(default_value); if (cur == def) continue; - purple_status_set_attr_int(status, attr->id, def); - } else if (default_value->type == PURPLE_TYPE_BOOLEAN) { + status_set_attr_int(status, attr->id, def); + } else if (purple_value_get_type(default_value) == PURPLE_TYPE_BOOLEAN) { gboolean cur = purple_status_get_attr_boolean(status, attr->id); gboolean def = purple_value_get_boolean(default_value); if (cur == def) continue; - purple_status_set_attr_boolean(status, attr->id, def); + status_set_attr_boolean(status, attr->id, def); } changed = TRUE; } @@ -844,68 +887,6 @@ purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, status_has_changed(status); } -void -purple_status_set_attr_boolean(PurpleStatus *status, const char *id, - gboolean value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - g_return_if_fail(attr_value != NULL); - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_BOOLEAN); - - purple_value_set_boolean(attr_value, value); -} - -void -purple_status_set_attr_int(PurpleStatus *status, const char *id, int value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - g_return_if_fail(attr_value != NULL); - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_INT); - - purple_value_set_int(attr_value, value); -} - -void -purple_status_set_attr_string(PurpleStatus *status, const char *id, - const char *value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - /* This used to be g_return_if_fail, but it's failing a LOT, so - * let's generate a log error for now. */ - /* g_return_if_fail(attr_value != NULL); */ - if (attr_value == NULL) { - purple_debug_error("status", - "Attempted to set status attribute '%s' for " - "status '%s', which is not legal. Fix " - "this!\n", id, - purple_status_type_get_name(purple_status_get_type(status))); - return; - } - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_STRING); - - /* XXX: Check if the value has actually changed. If it has, and the status - * is active, should this trigger 'status_has_changed'? */ - purple_value_set_string(attr_value, value); -} - PurpleStatusType * purple_status_get_type(const PurpleStatus *status) { @@ -1118,7 +1099,7 @@ purple_presence_new_for_conv(PurpleConversation *conv) presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_CONV); presence->u.chat.conv = conv; - /* presence->statuses = purple_prpl_get_statuses(conv->account, presence); ? */ + /* presence->statuses = purple_prpl_get_statuses(purple_conversation_get_account(conv), presence); ? */ return presence; } @@ -1166,30 +1147,6 @@ purple_presence_destroy(PurplePresence *presence) g_free(presence); } -void -purple_presence_add_status(PurplePresence *presence, PurpleStatus *status) -{ - g_return_if_fail(presence != NULL); - g_return_if_fail(status != NULL); - - presence->statuses = g_list_append(presence->statuses, status); - - g_hash_table_insert(presence->status_table, - g_strdup(purple_status_get_id(status)), status); -} - -void -purple_presence_add_list(PurplePresence *presence, GList *source_list) -{ - GList *l; - - g_return_if_fail(presence != NULL); - g_return_if_fail(source_list != NULL); - - for (l = source_list; l != NULL; l = l->next) - purple_presence_add_status(presence, (PurpleStatus *)l->data); -} - void purple_presence_set_status_active(PurplePresence *presence, const char *status_id, gboolean active) diff --git a/libpurple/status.h b/libpurple/status.h index 7dcce3a26b..a0bed2eb6a 100644 --- a/libpurple/status.h +++ b/libpurple/status.h @@ -271,56 +271,6 @@ PurpleStatusType *purple_status_type_new_with_attrs(PurpleStatusPrimitive primit */ void purple_status_type_destroy(PurpleStatusType *status_type); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds an attribute to a status type. - * - * @param status_type The status type to add the attribute to. - * @param id The ID of the attribute. - * @param name The name presented to the user. - * @param value The value type of this attribute. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds multiple attributes to a status type. - * - * @param status_type The status type to add the attribute to. - * @param id The ID of the first attribute. - * @param name The description of the first attribute. - * @param value The value type of the first attribute attribute. - * @param ... Additional attribute information. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value, ...) G_GNUC_NULL_TERMINATED; -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds multiple attributes to a status type using a va_list. - * - * @param status_type The status type to add the attribute to. - * @param args The va_list of attributes. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, - va_list args); -#endif - /** * Returns the primitive type of a status type. * @@ -552,51 +502,6 @@ void purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active, void purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, GList *attrs); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the boolean value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The boolean value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_boolean(PurpleStatus *status, const char *id, - gboolean value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the integer value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The integer value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_int(PurpleStatus *status, const char *id, - int value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the string value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The string value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_string(PurpleStatus *status, const char *id, - const char *value); -#endif - /** * Returns the status's type. * @@ -803,32 +708,6 @@ PurplePresence *purple_presence_new_for_buddy(PurpleBuddy *buddy); */ void purple_presence_destroy(PurplePresence *presence); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds a status to a presence. - * - * @param presence The presence. - * @param status The status to add. - * - * @deprecated This function is only used by purple_presence_add_list, - * and both should be removed in 3.0.0. - */ -void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds a list of statuses to the presence. - * - * @param presence The presence. - * @param source_list The source list of statuses to add, which is not - * modified or freed by this function. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -void purple_presence_add_list(PurplePresence *presence, GList *source_list); -#endif - /** * Sets the active state of a status in a presence. * diff --git a/libpurple/stun.c b/libpurple/stun.c index 809bf6b86f..8f1d47a5ce 100644 --- a/libpurple/stun.c +++ b/libpurple/stun.c @@ -338,7 +338,7 @@ static void hbn_cb(GSList *hosts, gpointer data, const char *error_message) { return; } - if (!purple_network_listen_range(12108, 12208, SOCK_DGRAM, hbn_listen_cb, hosts)) { + if (!purple_network_listen_range(12108, 12208, AF_UNSPEC, SOCK_DGRAM, TRUE, hbn_listen_cb, hosts)) { while (hosts) { hosts = g_slist_delete_link(hosts, hosts); g_free(hosts->data); @@ -365,7 +365,7 @@ static void do_test1(PurpleSrvResponse *resp, int results, gpointer sdata) { purple_debug_info("stun", "got %d SRV responses, server: %s, port: %d\n", results, servername, port); - purple_dnsquery_a_account(NULL, servername, port, hbn_cb, NULL); + purple_dnsquery_a(NULL, servername, port, hbn_cb, NULL); g_free(resp); } @@ -424,7 +424,7 @@ PurpleStunNatDiscovery *purple_stun_discover(StunCallback cb) { nattype.servername = g_strdup(servername); callbacks = g_slist_append(callbacks, cb); - purple_srv_resolve_account(NULL, "stun", "udp", servername, do_test1, + purple_srv_resolve(NULL, "stun", "udp", servername, do_test1, (gpointer) servername); return &nattype; diff --git a/libpurple/tests/test_xmlnode.c b/libpurple/tests/test_xmlnode.c index 59f8d44338..264a468d92 100644 --- a/libpurple/tests/test_xmlnode.c +++ b/libpurple/tests/test_xmlnode.c @@ -21,6 +21,101 @@ START_TEST(test_xmlnode_billion_laughs_attack) } END_TEST +#define check_doc_structure(x) { \ + xmlnode *ping, *child1, *child2; \ + fail_if(x == NULL, "Failed to parse document"); \ + ping = xmlnode_get_child(x, "ping"); \ + fail_if(ping == NULL, "Failed to find 'ping' child"); \ + child1 = xmlnode_get_child(ping, "child1"); \ + fail_if(child1 == NULL, "Failed to find 'child1'"); \ + child2 = xmlnode_get_child(child1, "child2"); \ + fail_if(child2 == NULL, "Failed to find 'child2'"); \ + xmlnode_new_child(child2, "a"); \ + \ + assert_string_equal("jabber:client", xmlnode_get_namespace(x)); \ + /* NOTE: xmlnode_get_namespace() returns the namespace of the element, not the + * current default namespace. See http://www.w3.org/TR/xml-names/#defaulting and + * http://www.w3.org/TR/xml-names/#dt-defaultNS. + */ \ + assert_string_equal("urn:xmpp:ping", xmlnode_get_namespace(ping)); \ + assert_string_equal("jabber:client", xmlnode_get_namespace(child1)); \ + assert_string_equal("urn:xmpp:ping", xmlnode_get_namespace(child2)); \ + /* + * This fails (well, actually crashes [the ns is NULL]) unless + * xmlnode_new_child() actually sets the element namespace. + assert_string_equal("jabber:client", xmlnode_get_namespace(xmlnode_get_child(child2, "a"))); + */ \ + \ + assert_string_equal("jabber:client", xmlnode_get_default_namespace(x)); \ + assert_string_equal("jabber:client", xmlnode_get_default_namespace(ping)); \ + assert_string_equal("jabber:client", xmlnode_get_default_namespace(child1)); \ + assert_string_equal("jabber:client", xmlnode_get_default_namespace(child2)); \ +} + +START_TEST(test_xmlnode_prefixes) +{ + const char *xml_doc = + "" + "" + "" + "" /* xmlns='jabber:child' */ + "" + "" + ""; + char *str; + xmlnode *xml, *reparsed; + + xml = xmlnode_from_str(xml_doc, -1); + check_doc_structure(xml); + + /* Check that xmlnode_from_str(xmlnode_to_str(xml, NULL), -1) is idempotent. */ + str = xmlnode_to_str(xml, NULL); + fail_if(str == NULL, "Failed to serialize XMLnode"); + reparsed = xmlnode_from_str(str, -1); + fail_if(reparsed == NULL, "Failed to reparse xml document"); + check_doc_structure(reparsed); + + g_free(str); + xmlnode_free(xml); + xmlnode_free(reparsed); +} +END_TEST + + +START_TEST(test_strip_prefixes) +{ + const char *xml_doc = "" + "" + "xvlc xvlc" + "" + "" + "xvlc xvlc" + "" + "" + ""; + const char *out = "" + "" + "xvlc xvlc" + "" + "" + "

xvlc xvlc

" + "" + "" + "
"; + char *str; + xmlnode *xml; + + xml = xmlnode_from_str(xml_doc, -1); + fail_if(xml == NULL, "Failed to parse XML"); + + xmlnode_strip_prefixes(xml); + str = xmlnode_to_str(xml, NULL); + assert_string_equal_free(out, str); + + xmlnode_free(xml); +} +END_TEST + Suite * xmlnode_suite(void) { @@ -28,6 +123,9 @@ xmlnode_suite(void) TCase *tc = tcase_create("xmlnode"); tcase_add_test(tc, test_xmlnode_billion_laughs_attack); + tcase_add_test(tc, test_xmlnode_prefixes); + tcase_add_test(tc, test_strip_prefixes); + suite_add_tcase(s, tc); return s; diff --git a/libpurple/theme-loader.c b/libpurple/theme-loader.c index e9b4a3ba9a..466ee90998 100644 --- a/libpurple/theme-loader.c +++ b/libpurple/theme-loader.c @@ -24,7 +24,7 @@ #include "theme-loader.h" #define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \ - ((PurpleThemeLoaderPrivate *) ((PurpleThemeLoader)->priv)) + (G_TYPE_INSTANCE_GET_PRIVATE((PurpleThemeLoader), PURPLE_TYPE_THEME_LOADER, PurpleThemeLoaderPrivate)) void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type); @@ -85,14 +85,6 @@ purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *val } } -static void -purple_theme_loader_init(GTypeInstance *instance, - gpointer klass) -{ - PurpleThemeLoader *loader = PURPLE_THEME_LOADER(instance); - loader->priv = g_new0(PurpleThemeLoaderPrivate, 1); -} - static void purple_theme_loader_finalize(GObject *obj) { @@ -100,7 +92,6 @@ purple_theme_loader_finalize(GObject *obj) PurpleThemeLoaderPrivate *priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader); g_free(priv->type); - g_free(priv); parent_class->finalize(obj); } @@ -113,6 +104,8 @@ purple_theme_loader_class_init(PurpleThemeLoaderClass *klass) parent_class = g_type_class_peek_parent(klass); + g_type_class_add_private(klass, sizeof(PurpleThemeLoaderPrivate)); + obj_class->get_property = purple_theme_loader_get_property; obj_class->set_property = purple_theme_loader_set_property; obj_class->finalize = purple_theme_loader_finalize; @@ -139,7 +132,7 @@ purple_theme_loader_get_type(void) NULL, /* class_data */ sizeof(PurpleThemeLoader), 0, /* n_preallocs */ - purple_theme_loader_init, /* instance_init */ + NULL, /* instance_init */ NULL, /* value table */ }; type = g_type_register_static(G_TYPE_OBJECT, diff --git a/libpurple/theme-loader.h b/libpurple/theme-loader.h index bf76b38920..6dfa39dc90 100644 --- a/libpurple/theme-loader.h +++ b/libpurple/theme-loader.h @@ -50,7 +50,6 @@ typedef struct _PurpleThemeLoaderClass PurpleThemeLoaderClass; struct _PurpleThemeLoader { GObject parent; - gpointer priv; }; struct _PurpleThemeLoaderClass diff --git a/libpurple/theme.c b/libpurple/theme.c index c21e71a053..cf3bc36985 100644 --- a/libpurple/theme.c +++ b/libpurple/theme.c @@ -25,7 +25,7 @@ #include "util.h" #define PURPLE_THEME_GET_PRIVATE(PurpleTheme) \ - ((PurpleThemePrivate *) ((PurpleTheme)->priv)) + (G_TYPE_INSTANCE_GET_PRIVATE((PurpleTheme), PURPLE_TYPE_THEME, PurpleThemePrivate)) void purple_theme_set_type_string(PurpleTheme *theme, const gchar *type); @@ -128,14 +128,6 @@ purple_theme_set_property(GObject *obj, guint param_id, const GValue *value, } } -static void -purple_theme_init(GTypeInstance *instance, - gpointer klass) -{ - PurpleTheme *theme = PURPLE_THEME(instance); - theme->priv = g_new0(PurpleThemePrivate, 1); -} - static void purple_theme_finalize(GObject *obj) { @@ -160,6 +152,8 @@ purple_theme_class_init(PurpleThemeClass *klass) parent_class = g_type_class_peek_parent(klass); + g_type_class_add_private(klass, sizeof(PurpleThemePrivate)); + obj_class->get_property = purple_theme_get_property; obj_class->set_property = purple_theme_set_property; obj_class->finalize = purple_theme_finalize; @@ -222,7 +216,7 @@ purple_theme_get_type(void) NULL, /* class_data */ sizeof(PurpleTheme), 0, /* n_preallocs */ - purple_theme_init, /* instance_init */ + NULL, /* instance_init */ NULL, /* value table */ }; type = g_type_register_static (G_TYPE_OBJECT, diff --git a/libpurple/theme.h b/libpurple/theme.h index e6ffa130e5..9f4b0bc8f1 100644 --- a/libpurple/theme.h +++ b/libpurple/theme.h @@ -49,7 +49,6 @@ typedef struct _PurpleThemeClass PurpleThemeClass; struct _PurpleTheme { GObject parent; - gpointer priv; }; struct _PurpleThemeClass diff --git a/libpurple/upnp.c b/libpurple/upnp.c index 923417fc7f..61b5ef3b84 100644 --- a/libpurple/upnp.c +++ b/libpurple/upnp.c @@ -464,7 +464,7 @@ purple_upnp_parse_description(const gchar* descriptionURL, UPnPDiscoveryData *dd purple_timeout_remove(dd->tima); dd->tima = 0; - purple_util_fetch_url_request_len(NULL, descriptionURL, TRUE, NULL, TRUE, httpRequest, + purple_util_fetch_url_request(NULL, descriptionURL, TRUE, NULL, TRUE, httpRequest, TRUE, MAX_UPNP_DOWNLOAD, upnp_parse_description_cb, dd); g_free(httpRequest); @@ -730,7 +730,7 @@ purple_upnp_generate_action_message_and_send(const gchar* actionName, g_free(pathOfControl); g_free(soapMessage); - gfud = purple_util_fetch_url_request_len(NULL, control_info.control_url, FALSE, NULL, TRUE, + gfud = purple_util_fetch_url_request(NULL, control_info.control_url, FALSE, NULL, TRUE, totalSendMessage, TRUE, MAX_UPNP_DOWNLOAD, cb, cb_data); g_free(totalSendMessage); diff --git a/libpurple/util.c b/libpurple/util.c index 26d1676e83..f513f6790b 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -73,6 +73,14 @@ struct _PurpleUtilFetchUrlData PurpleAccount *account; }; +struct _PurpleMenuAction +{ + char *label; + PurpleCallback callback; + gpointer data; + GList *children; +}; + static char *custom_user_dir = NULL; static char *user_dir = NULL; @@ -98,6 +106,62 @@ purple_menu_action_free(PurpleMenuAction *act) g_free(act); } +char * purple_menu_action_get_label(const PurpleMenuAction *act) +{ + g_return_val_if_fail(act != NULL, NULL); + + return act->label; +} + +PurpleCallback purple_menu_action_get_callback(const PurpleMenuAction *act) +{ + g_return_val_if_fail(act != NULL, NULL); + + return act->callback; +} + +gpointer purple_menu_action_get_data(const PurpleMenuAction *act) +{ + g_return_val_if_fail(act != NULL, NULL); + + return act->data; +} + +GList* purple_menu_action_get_children(const PurpleMenuAction *act) +{ + g_return_val_if_fail(act != NULL, NULL); + + return act->children; +} + +void purple_menu_action_set_label(PurpleMenuAction *act, char *label) +{ + g_return_if_fail(act != NULL); + + act-> label = label; +} + +void purple_menu_action_set_callback(PurpleMenuAction *act, PurpleCallback callback) +{ + g_return_if_fail(act != NULL); + + act->callback = callback; +} + +void purple_menu_action_set_data(PurpleMenuAction *act, gpointer data) +{ + g_return_if_fail(act != NULL); + + act->data = data; +} + +void purple_menu_action_set_children(PurpleMenuAction *act, GList *children) +{ + g_return_if_fail(act != NULL); + + act->children = children; +} + void purple_util_init(void) { @@ -3267,9 +3331,9 @@ purple_strcasestr(const char *haystack, const char *needle) } char * -purple_str_size_to_units(size_t size) +purple_str_size_to_units(goffset size) { - static const char * const size_str[] = { "bytes", "KiB", "MiB", "GiB" }; + static const char * const size_str[] = { "bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" }; float size_mag; int size_index = 0; @@ -3282,7 +3346,7 @@ purple_str_size_to_units(size_t size) else { size_mag = (float)size; - while ((size_index < 3) && (size_mag > 1024)) { + while ((size_index < G_N_ELEMENTS(size_str) - 1) && (size_mag > 1024)) { size_mag /= 1024; size_index++; } @@ -4103,19 +4167,7 @@ static void ssl_url_fetch_error_cb(PurpleSslConnection *ssl_connection, PurpleSs } PurpleUtilFetchUrlData * -purple_util_fetch_url_request(const char *url, gboolean full, - const char *user_agent, gboolean http11, - const char *request, gboolean include_headers, - PurpleUtilFetchUrlCallback callback, void *user_data) -{ - return purple_util_fetch_url_request_len(NULL, url, full, - user_agent, http11, - request, include_headers, -1, - callback, user_data); -} - -PurpleUtilFetchUrlData * -purple_util_fetch_url_request_len(PurpleAccount *account, +purple_util_fetch_url_request(PurpleAccount *account, const char *url, gboolean full, const char *user_agent, gboolean http11, const char *request, gboolean include_headers, gssize max_len, PurpleUtilFetchUrlCallback callback, void *user_data) @@ -4402,11 +4454,10 @@ purple_ipv6_address_is_valid(const gchar *ip) return (double_colon && chunks < 8) || (!double_colon && chunks == 8); } -/* TODO 3.0.0: Add ipv6 check, too */ gboolean purple_ip_address_is_valid(const char *ip) { - return purple_ipv4_address_is_valid(ip); + return (purple_ipv4_address_is_valid(ip) || purple_ipv6_address_is_valid(ip)); } /* Stolen from gnome_uri_list_extract_uris */ @@ -4586,7 +4637,7 @@ purple_utf8_strip_unprintables(const gchar *str) * This function is copied from g_strerror() but changed to use * gai_strerror(). */ -G_CONST_RETURN gchar * +const gchar * purple_gai_strerror(gint errnum) { static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT; diff --git a/libpurple/util.h b/libpurple/util.h index a489b30bb6..36d06ff165 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -36,9 +36,20 @@ * the request. */ typedef struct _PurpleUtilFetchUrlData PurpleUtilFetchUrlData; -/** @copydoc _PurpleMenuAction */ + +/** + * A generic structure that contains information about an "action." One + * place this is is used is by PRPLs to tell the core the list of available + * right-click actions for a buddy list row. + */ typedef struct _PurpleMenuAction PurpleMenuAction; -/** @copydoc _PurpleKeyValuePair */ + +/** + * A key-value pair. + * + * This is used by, among other things, purple_gtk_combo* functions to pass in a + * list of key-value pairs so it can display a user-friendly value. + */ typedef struct _PurpleKeyValuePair PurpleKeyValuePair; #include "account.h" @@ -51,22 +62,8 @@ typedef struct _PurpleKeyValuePair PurpleKeyValuePair; extern "C" { #endif -struct _PurpleMenuAction -{ - char *label; - PurpleCallback callback; - gpointer data; - GList *children; -}; - typedef char *(*PurpleInfoFieldFormatCallback)(const char *field, size_t len); -/** - * A key-value pair. - * - * This is used by, among other things, purple_gtk_combo* functions to pass in a - * list of key-value pairs so it can display a user-friendly value. - */ struct _PurpleKeyValuePair { gchar *key; @@ -95,13 +92,80 @@ PurpleMenuAction *purple_menu_action_new(const char *label, PurpleCallback callb */ void purple_menu_action_free(PurpleMenuAction *act); +/** + * Returns the label of the PurpleMenuAction. + * + * @param act The PurpleMenuAction. + * + * @return The label string. + */ +char * purple_menu_action_get_label(const PurpleMenuAction *act); + +/** + * Returns the callback of the PurpleMenuAction. + * + * @param act The PurpleMenuAction. + * + * @return The callback function. + */ +PurpleCallback purple_menu_action_get_callback(const PurpleMenuAction *act); + +/** + * Returns the data stored in the PurpleMenuAction. + * + * @param act The PurpleMenuAction. + * + * @return The data. + */ +gpointer purple_menu_action_get_data(const PurpleMenuAction *act); + +/** + * Returns the children of the PurpleMenuAction. + * + * @param act The PurpleMenuAction. + * + * @return The GList of children. + */ +GList* purple_menu_action_get_children(const PurpleMenuAction *act); + +/** + * Set the label to the PurpleMenuAction. + * + * @param act The menu action. + * @param label The label for the menu action. + */ +void purple_menu_action_set_label(PurpleMenuAction *act, char *label); + +/** + * Set the callback that will be used by the PurpleMenuAction. + * + * @param act The menu action. + * @param callback The callback. + */ +void purple_menu_action_set_callback(PurpleMenuAction *act, PurpleCallback callback); + +/** + * Set the label to the PurpleMenuAction. + * + * @param act The menu action. + * @param data The data used by this PurpleMenuAction + */ +void purple_menu_action_set_data(PurpleMenuAction *act, gpointer data); + +/** + * Set the children of the PurpleMenuAction. + * + * @param act The menu action. + * @param children The PurpleMenuAtion children + */ +void purple_menu_action_set_children(PurpleMenuAction *act, GList *children); + /** * Set the appropriate presence values for the currently playing song. * * @param title The title of the song, @c NULL to unset the value. * @param artist The artist of the song, can be @c NULL. * @param album The album of the song, can be @c NULL. - * @since 2.4.0 */ void purple_util_set_current_song(const char *title, const char *artist, const char *album); @@ -115,7 +179,6 @@ void purple_util_set_current_song(const char *title, const char *artist, * @param unused Currently unused, must be @c NULL. * * @return The formatted string. The caller must g_free the returned string. - * @since 2.4.0 */ char * purple_util_format_song_info(const char *title, const char *artist, const char *album, gpointer unused); @@ -127,15 +190,11 @@ char * purple_util_format_song_info(const char *title, const char *artist, /** * Initializes the utility subsystem. - * - * @since 2.3.0 */ void purple_util_init(void); /** * Uninitializes the util subsystem. - * - * @since 2.3.0 */ void purple_util_uninit(void); @@ -429,8 +488,6 @@ time_t purple_str_to_time(const char *timestamp, gboolean utc, * This is exactly the same as g_markup_escape_text(), except that it * does not change ' to ' because ' is not a valid HTML 4 entity, * and is displayed literally in IE7. - * - * @since 2.6.0 */ gchar *purple_markup_escape_text(const gchar *text, gssize length); @@ -531,7 +588,6 @@ char *purple_markup_linkify(const char *str); * this string when finished with it. * * @see purple_unescape_html() - * @since 2.7.0 */ char *purple_unescape_text(const char *text); @@ -624,8 +680,6 @@ char * purple_markup_get_css_property(const gchar *style, const gchar *opt); * @param html The HTML text. * * @return TRUE if the text contains RTL text, FALSE otherwise. - * - * @since 2.6.0 */ gboolean purple_markup_is_rtl(const char *html); @@ -826,7 +880,6 @@ char *purple_fd_get_ip(int fd); * * @return The address family of the socket (AF_INET, AF_INET6, etc) or -1 * on error. - * @since 2.7.0 */ int purple_socket_get_family(int fd); @@ -838,7 +891,6 @@ int purple_socket_get_family(int fd); * * @param fd The socket file descriptor * @return TRUE if a socket can speak IPv4. - * @since 2.7.0 */ gboolean purple_socket_speaks_ipv4(int fd); @@ -860,8 +912,6 @@ gboolean purple_socket_speaks_ipv4(int fd); * @param right A string to compare with left * * @return @c TRUE if the strings are the same, else @c FALSE. - * - * @since 2.6.0 */ gboolean purple_strequal(const gchar *left, const gchar *right); @@ -1041,7 +1091,7 @@ const char *purple_strcasestr(const char *haystack, const char *needle); * * @return The string in units form. This must be freed. */ -char *purple_str_size_to_units(size_t size); +char *purple_str_size_to_units(goffset size); /** * Converts seconds into a human-readable form. @@ -1109,21 +1159,6 @@ gboolean purple_url_parse(const char *url, char **ret_host, int *ret_port, */ typedef void (*PurpleUtilFetchUrlCallback)(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message); -/** - * Fetches the data from a URL, and passes it to a callback function. - * - * @param url The URL. - * @param full TRUE if this is the full URL, or FALSE if it's a - * partial URL. - * @param user_agent The user agent field to use, or NULL. - * @param http11 TRUE if HTTP/1.1 should be used to download the file. - * @param cb The callback function. - * @param data The user data to pass to the callback function. - */ -#define purple_util_fetch_url(url, full, user_agent, http11, cb, data) \ - purple_util_fetch_url_request(url, full, user_agent, http11, NULL, \ - FALSE, cb, data); - /** * Fetches the data from a URL, and passes it to a callback function. * @@ -1135,32 +1170,11 @@ typedef void (*PurpleUtilFetchUrlCallback)(PurpleUtilFetchUrlData *url_data, gpo * @param max_len The maximum number of bytes to retrieve (-1 for unlimited) * @param cb The callback function. * @param data The user data to pass to the callback function. - * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url" and get rid of the old one */ -#define purple_util_fetch_url_len(url, full, user_agent, http11, max_len, cb, data) \ - purple_util_fetch_url_request_len(NULL, url, full, user_agent, http11, NULL, \ +#define purple_util_fetch_url(url, full, user_agent, http11, max_len, cb, data) \ + purple_util_fetch_url_request(NULL, url, full, user_agent, http11, NULL, \ FALSE, max_len, cb, data); -/** - * Fetches the data from a URL, and passes it to a callback function. - * - * @param url The URL. - * @param full TRUE if this is the full URL, or FALSE if it's a - * partial URL. - * @param user_agent The user agent field to use, or NULL. - * @param http11 TRUE if HTTP/1.1 should be used to download the file. - * @param request A HTTP request to send to the server instead of the - * standard GET - * @param include_headers - * If TRUE, include the HTTP headers in the response. - * @param callback The callback function. - * @param data The user data to pass to the callback function. - */ -PurpleUtilFetchUrlData *purple_util_fetch_url_request(const gchar *url, - gboolean full, const gchar *user_agent, gboolean http11, - const gchar *request, gboolean include_headers, - PurpleUtilFetchUrlCallback callback, gpointer data); - /** * Fetches the data from a URL, and passes it to a callback function. * @@ -1177,9 +1191,8 @@ PurpleUtilFetchUrlData *purple_util_fetch_url_request(const gchar *url, * @param max_len The maximum number of bytes to retrieve (-1 for unlimited) * @param callback The callback function. * @param data The user data to pass to the callback function. - * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url_request" and get rid of the old one */ -PurpleUtilFetchUrlData *purple_util_fetch_url_request_len( +PurpleUtilFetchUrlData *purple_util_fetch_url_request( PurpleAccount *account, const gchar *url, gboolean full, const gchar *user_agent, gboolean http11, const gchar *request, gboolean include_headers, gssize max_len, @@ -1225,14 +1238,15 @@ const char *purple_url_encode(const char *str); gboolean purple_email_is_valid(const char *address); /** - * Checks if the given IP address is a syntactically valid IPv4 address. + * Checks if the given IP address is a syntactically valid IPv4 or + * IPv6 address. + * If you specifically want to check for an IPv4 address use + * purple_ipv4_address_is_valid(), or for an IPv6 address use + * purple_ipv6_address_is_valid(). * * @param ip The IP address to validate. * * @return True if the IP address is syntactically correct. - * @deprecated This function will be replaced with one that validates - * as either IPv4 or IPv6 in 3.0.0. If you don't want this, - * behavior, use one of the more specific functions. */ gboolean purple_ip_address_is_valid(const char *ip); @@ -1242,7 +1256,6 @@ gboolean purple_ip_address_is_valid(const char *ip); * @param ip The IP address to validate. * * @return True if the IP address is syntactically correct. - * @since 2.6.0 */ gboolean purple_ipv4_address_is_valid(const char *ip); @@ -1252,7 +1265,6 @@ gboolean purple_ipv4_address_is_valid(const char *ip); * @param ip The IP address to validate. * * @return True if the IP address is syntactically correct. - * @since 2.6.0 */ gboolean purple_ipv6_address_is_valid(const char *ip); @@ -1320,7 +1332,6 @@ gchar *purple_utf8_salvage(const char *str); * @param str A valid UTF-8 string. * * @return A newly allocated UTF-8 string without the unprintable characters. - * @since 2.6.0 */ gchar *purple_utf8_strip_unprintables(const gchar *str); @@ -1332,9 +1343,8 @@ gchar *purple_utf8_strip_unprintables(const gchar *str); * @param errnum The error code. * * @return The UTF-8 error message. - * @since 2.4.0 */ -G_CONST_RETURN gchar *purple_gai_strerror(gint errnum); +const gchar *purple_gai_strerror(gint errnum); /** * Compares two UTF-8 strings case-insensitively. This comparison is @@ -1446,7 +1456,6 @@ const gchar *purple_get_host_name(void); * Returns a type 4 (random) UUID * * @return A UUID, caller is responsible for freeing it - * @since 2.7.0 */ gchar *purple_uuid_random(void); diff --git a/libpurple/value.c b/libpurple/value.c index c7002c60ed..34ed57baa5 100644 --- a/libpurple/value.c +++ b/libpurple/value.c @@ -29,6 +29,44 @@ #define OUTGOING_FLAG 0x01 +/** + * A wrapper for a type, subtype, and specific type of value. + */ +struct _PurpleValue +{ + PurpleType type; + unsigned short flags; + + union + { + char char_data; + unsigned char uchar_data; + gboolean boolean_data; + short short_data; + unsigned short ushort_data; + int int_data; + unsigned int uint_data; + long long_data; + unsigned long ulong_data; + gint64 int64_data; + guint64 uint64_data; + char *string_data; + void *object_data; + void *pointer_data; + int enum_data; + void *boxed_data; + + } data; + + union + { + unsigned int subtype; + char *specific_type; + + } u; + +}; + PurpleValue * purple_value_new(PurpleType type, ...) { diff --git a/libpurple/value.h b/libpurple/value.h index 155c0146b4..b8724ac40f 100644 --- a/libpurple/value.h +++ b/libpurple/value.h @@ -86,40 +86,7 @@ typedef enum /** * A wrapper for a type, subtype, and specific type of value. */ -typedef struct -{ - PurpleType type; - unsigned short flags; - - union - { - char char_data; - unsigned char uchar_data; - gboolean boolean_data; - short short_data; - unsigned short ushort_data; - int int_data; - unsigned int uint_data; - long long_data; - unsigned long ulong_data; - gint64 int64_data; - guint64 uint64_data; - char *string_data; - void *object_data; - void *pointer_data; - int enum_data; - void *boxed_data; - - } data; - - union - { - unsigned int subtype; - char *specific_type; - - } u; - -} PurpleValue; +typedef struct _PurpleValue PurpleValue; #ifdef __cplusplus extern "C" { diff --git a/libpurple/version.h.in b/libpurple/version.h.in index 6e13bb3748..a77ca0f252 100644 --- a/libpurple/version.h.in +++ b/libpurple/version.h.in @@ -56,8 +56,6 @@ const char *purple_version_check(guint required_major, guint required_minor, gui * The major version of the running libpurple. Contrast with * #PURPLE_MAJOR_VERSION, which expands at compile time to the major version of * libpurple being compiled against. - * - * @since 2.4.0 */ extern const guint purple_major_version; @@ -65,8 +63,6 @@ extern const guint purple_major_version; * The minor version of the running libpurple. Contrast with * #PURPLE_MINOR_VERSION, which expands at compile time to the minor version of * libpurple being compiled against. - * - * @since 2.4.0 */ extern const guint purple_minor_version; @@ -75,8 +71,6 @@ extern const guint purple_minor_version; * The micro version of the running libpurple. Contrast with * #PURPLE_MICRO_VERSION, which expands at compile time to the micro version of * libpurple being compiled against. - * - * @since 2.4.0 */ extern const guint purple_micro_version; diff --git a/libpurple/whiteboard.c b/libpurple/whiteboard.c index 3ac4c4e010..3390819e18 100644 --- a/libpurple/whiteboard.c +++ b/libpurple/whiteboard.c @@ -25,6 +25,23 @@ #include "whiteboard.h" #include "prpl.h" +/** + * A PurpleWhiteboard + */ +struct _PurpleWhiteboard +{ + int state; /**< State of whiteboard session */ + + PurpleAccount *account; /**< Account associated with this session */ + char *who; /**< Name of the remote user */ + + void *ui_data; /**< Graphical user-interface data */ + void *proto_data; /**< Protocol specific data */ + PurpleWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */ + + GList *draw_list; /**< List of drawing elements/deltas to send */ +}; + /****************************************************************************** * Globals *****************************************************************************/ @@ -90,6 +107,34 @@ void purple_whiteboard_destroy(PurpleWhiteboard *wb) g_free(wb); } +PurpleAccount *purple_whiteboard_get_account(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, NULL); + + return wb->account; +} + +const char *purple_whiteboard_get_who(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, NULL); + + return wb->who; +} + +void purple_whiteboard_set_state(PurpleWhiteboard *wb, int state) +{ + g_return_if_fail(wb != NULL); + + wb->state = state; +} + +int purple_whiteboard_get_state(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, -1); + + return wb->state; +} + void purple_whiteboard_start(PurpleWhiteboard *wb) { /* Create frontend for whiteboard */ @@ -206,3 +251,44 @@ void purple_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color) whiteboard_ui_ops->set_brush(wb, size, color); } +GList *purple_whiteboard_get_draw_list(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, NULL); + + return wb->draw_list; +} + +void purple_whiteboard_set_draw_list(PurpleWhiteboard *wb, GList* draw_list) +{ + g_return_if_fail(wb != NULL); + + wb->draw_list = draw_list; +} + +void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data) +{ + g_return_if_fail(wb != NULL); + + wb->proto_data = proto_data; +} + +gpointer purple_whiteboard_get_protocol_data(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, NULL); + + return wb->proto_data; +} + +void purple_whiteboard_set_ui_data(PurpleWhiteboard *wb, gpointer ui_data) +{ + g_return_if_fail(wb != NULL); + + wb->ui_data = ui_data; +} + +gpointer purple_whiteboard_get_ui_data(const PurpleWhiteboard *wb) +{ + g_return_val_if_fail(wb != NULL, NULL); + + return wb->ui_data; +} diff --git a/libpurple/whiteboard.h b/libpurple/whiteboard.h index 7d5700dee9..bd2d4fdfad 100644 --- a/libpurple/whiteboard.h +++ b/libpurple/whiteboard.h @@ -26,6 +26,9 @@ #ifndef _PURPLE_WHITEBOARD_H_ #define _PURPLE_WHITEBOARD_H_ +/** @copydoc _PurpleWhiteboard */ +typedef struct _PurpleWhiteboard PurpleWhiteboard; + /** * Whiteboard PRPL Operations */ @@ -33,22 +36,6 @@ typedef struct _PurpleWhiteboardPrplOps PurpleWhiteboardPrplOps; #include "account.h" -/** - * A PurpleWhiteboard - */ -typedef struct _PurpleWhiteboard -{ - int state; /**< State of whiteboard session */ - - PurpleAccount *account; /**< Account associated with this session */ - char *who; /**< Name of the remote user */ - - void *ui_data; /**< Graphical user-interface data */ - void *proto_data; /**< Protocol specific data */ - PurpleWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */ - - GList *draw_list; /**< List of drawing elements/deltas to send */ -} PurpleWhiteboard; /** * The PurpleWhiteboard UI Operations @@ -134,6 +121,41 @@ PurpleWhiteboard *purple_whiteboard_create(PurpleAccount *account, const char *w */ void purple_whiteboard_destroy(PurpleWhiteboard *wb); +/** + * Returns the whiteboard's account. + * + * @param wb The whiteboard. + * + * @return The whiteboard's account. + */ +PurpleAccount *purple_whiteboard_get_account(const PurpleWhiteboard *wb); + +/** + * Return who you're drawing with. + * + * @param wb The whiteboard + * + * @return Who you're drawing with. + */ +const char *purple_whiteboard_get_who(const PurpleWhiteboard *wb); + +/** + * Set the state of the whiteboard. + * + * @param wb The whiteboard. + * @param state The state + */ +void purple_whiteboard_set_state(PurpleWhiteboard *wb, int state); + +/** + * Return the state of the whiteboard. + * + * @param wb The whiteboard. + * + * @return The state of the whiteboard. + */ +int purple_whiteboard_get_state(const PurpleWhiteboard *wb); + /** * Starts a whiteboard * @@ -253,6 +275,59 @@ gboolean purple_whiteboard_get_brush(const PurpleWhiteboard *wb, int *size, int */ void purple_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color); +/** + * Return the drawing list. + * + * @param wb The whiteboard. + * + * @return The drawing list + */ +GList *purple_whiteboard_get_draw_list(const PurpleWhiteboard *wb); + +/** + * Set the drawing list. + * + * @param wb The whiteboard + * @param draw_list The drawing list. + */ +void purple_whiteboard_set_draw_list(PurpleWhiteboard *wb, GList* draw_list); + +/** + * Sets the protocol data for a whiteboard. + * + * @param wb The whiteboard. + * @param proto_data The protocol data to set for the whiteboard. + */ +void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data); + +/** + * Gets the protocol data for a whiteboard. + * + * @param wb The whiteboard. + * + * @return The protocol data for the whiteboard. + */ +gpointer purple_whiteboard_get_protocol_data(const PurpleWhiteboard *wb); + +/** + * Set the UI data associated with this whiteboard. + * + * @param wb The whiteboard. + * @param ui_data A pointer to associate with this whiteboard. + */ +void purple_whiteboard_set_ui_data(PurpleWhiteboard *wb, gpointer ui_data); + +/** + * Get the UI data associated with this whiteboard. + * + * @param wb The whiteboard.. + * + * @return The UI data associated with this whiteboard. This is a + * convenience field provided to the UIs--it is not + * used by the libpurple core. + */ +gpointer purple_whiteboard_get_ui_data(const PurpleWhiteboard *wb); + /*@}*/ #ifdef __cplusplus diff --git a/libpurple/win32/libc_interface.c b/libpurple/win32/libc_interface.c index 18f468910b..1e597acc62 100644 --- a/libpurple/win32/libc_interface.c +++ b/libpurple/win32/libc_interface.c @@ -300,6 +300,50 @@ wpurple_inet_ntop (int af, const void *src, char *dst, socklen_t cnt) return (const char *) dst; } +int +wpurple_inet_pton(int af, const char *src, void *dst) +{ + /* struct sockaddr can't accomodate struct sockaddr_in6. */ + union { + struct sockaddr_in6 sin6; + struct sockaddr_in sin; + } sa; + size_t srcsize; + + switch(af) + { + case AF_INET: + sa.sin.sin_family = AF_INET; + srcsize = sizeof (sa.sin); + break; + case AF_INET6: + sa.sin6.sin6_family = AF_INET6; + srcsize = sizeof (sa.sin6); + break; + default: + errno = WSAEPFNOSUPPORT; + return -1; + } + + if (WSAStringToAddress(src, af, NULL, (struct sockaddr *) &sa, &srcsize) != 0) + { + errno = WSAGetLastError(); + return -1; + } + + switch(af) + { + case AF_INET: + memcpy(dst, &sa.sin.sin_addr, sizeof(sa.sin.sin_addr)); + break; + case AF_INET6: + memcpy(dst, &sa.sin6.sin6_addr, sizeof(sa.sin6.sin6_addr)); + break; + } + + return 1; +} + /* netdb.h */ struct hostent* wpurple_gethostbyname(const char *name) { @@ -467,12 +511,6 @@ int wpurple_gettimeofday(struct timeval *p, struct timezone *z) { return res; } -/* stdio.h */ - -int wpurple_rename (const char *oldname, const char *newname) { - return g_rename(oldname, newname); -} - /* time.h */ struct tm * wpurple_localtime_r (const time_t *time, struct tm *resultp) { @@ -1047,15 +1085,3 @@ wpurple_get_timezone_abbreviation(const struct tm *tm) purple_debug_warning("wpurple", "could not find a match for Windows timezone \"%s\"\n", tzname); return ""; } - -int wpurple_g_access (const gchar *filename, int mode); -/** - * @deprecated - remove for 3.0.0 - */ -int -wpurple_g_access (const gchar *filename, int mode) -{ - return g_access(filename, mode); -} - - diff --git a/libpurple/win32/libc_interface.h b/libpurple/win32/libc_interface.h index cc7acc1d72..19e1284e0f 100644 --- a/libpurple/win32/libc_interface.h +++ b/libpurple/win32/libc_interface.h @@ -89,6 +89,9 @@ wpurple_inet_aton( name, addr ) #define inet_ntop( af, src, dst, cnt ) \ wpurple_inet_ntop( af, src, dst, cnt ) +#define inet_pton( af, src, dst ) \ +wpurple_inet_pton( af, src, dst ) + /* netdb.h */ #define gethostbyname( name ) \ wpurple_gethostbyname( name ) @@ -135,7 +138,7 @@ wpurple_gettimeofday( timeval, timezone ) #define vsnprintf _vsnprintf #define rename( oldname, newname ) \ -wpurple_rename( oldname, newname ) +g_rename( oldname, newname ) /* sys/stat.h */ #define fchmod(a,b) diff --git a/libpurple/win32/libc_internal.h b/libpurple/win32/libc_internal.h index 2a6b11edec..10fa2483e8 100644 --- a/libpurple/win32/libc_internal.h +++ b/libpurple/win32/libc_internal.h @@ -48,6 +48,7 @@ int wpurple_send(int fd, const void *buf, unsigned int size, int flags); int wpurple_inet_aton(const char *name, struct in_addr *addr); const char * wpurple_inet_ntop (int af, const void *src, char *dst, socklen_t cnt); +int wpurple_inet_pton(int af, const char *src, void *dst); /* netdb.h */ struct hostent* wpurple_gethostbyname(const char *name); @@ -141,9 +142,6 @@ int wpurple_close(int fd); int wpurple_gethostname(char *name, size_t size); -/* stdio.h */ -int wpurple_rename(const char *oldname, const char *newname); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/libpurple/xmlnode.c b/libpurple/xmlnode.c index 6fc7d3dac9..e1072056a7 100644 --- a/libpurple/xmlnode.c +++ b/libpurple/xmlnode.c @@ -78,6 +78,19 @@ xmlnode_new_child(xmlnode *parent, const char *name) node = new_node(name, XMLNODE_TYPE_TAG); xmlnode_insert_child(parent, node); +#if 0 + /* This would give xmlnodes more appropriate namespacing + * when creating them. Otherwise, unless an explicit namespace + * is set, xmlnode_get_namespace() will return NULL, when + * there may be a default namespace. + * + * I'm unconvinced that it's useful, and concerned it may break things. + * + * _insert_child would need the same thing, probably (assuming + * xmlns->node == NULL) + */ + xmlnode_set_namespace(node, xmlnode_get_default_namespace(node)) +#endif return node; } @@ -190,18 +203,6 @@ xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value) xmlnode_set_attrib_full(node, attr, NULL, NULL, value); } -void -xmlnode_set_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns, const char *value) -{ - xmlnode_set_attrib_full(node, attr, xmlns, NULL, value); -} - -void -xmlnode_set_attrib_with_prefix(xmlnode *node, const char *attr, const char *prefix, const char *value) -{ - xmlnode_set_attrib_full(node, attr, NULL, prefix, value); -} - void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, const char *prefix, const char *value) { @@ -261,19 +262,53 @@ xmlnode_get_attrib_with_namespace(const xmlnode *node, const char *attr, const c void xmlnode_set_namespace(xmlnode *node, const char *xmlns) { + char *tmp; g_return_if_fail(node != NULL); - g_free(node->xmlns); + tmp = node->xmlns; node->xmlns = g_strdup(xmlns); + + if (node->namespace_map) { + g_hash_table_insert(node->namespace_map, + g_strdup(""), g_strdup(xmlns)); + } + + g_free(tmp); } -const char *xmlnode_get_namespace(xmlnode *node) +const char *xmlnode_get_namespace(const xmlnode *node) { g_return_val_if_fail(node != NULL, NULL); return node->xmlns; } +const char *xmlnode_get_default_namespace(const xmlnode *node) +{ + const xmlnode *current_node; + const char *ns = NULL; + + g_return_val_if_fail(node != NULL, NULL); + + current_node = node; + while (current_node) { + /* If this node does *not* have a prefix, node->xmlns is the default + * namespace. Otherwise, it's the prefix namespace. + */ + if (!current_node->prefix && current_node->xmlns) { + return current_node->xmlns; + } else if (current_node->namespace_map) { + ns = g_hash_table_lookup(current_node->namespace_map, ""); + if (ns && *ns) + return ns; + } + + current_node = current_node->parent; + } + + return ns; +} + void xmlnode_set_prefix(xmlnode *node, const char *prefix) { g_return_if_fail(node != NULL); @@ -288,6 +323,53 @@ const char *xmlnode_get_prefix(const xmlnode *node) return node->prefix; } +const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix) +{ + const xmlnode *current_node; + + g_return_val_if_fail(node != NULL, NULL); + g_return_val_if_fail(prefix != NULL, xmlnode_get_default_namespace(node)); + + current_node = node; + while (current_node) { + if (current_node->prefix && g_str_equal(prefix, current_node->prefix) && + current_node->xmlns) { + return current_node->xmlns; + } else if (current_node->namespace_map) { + const char *ns = g_hash_table_lookup(current_node->namespace_map, prefix); + if (ns && *ns) { + return ns; + } + } + + current_node = current_node->parent; + } + + return NULL; +} + +void xmlnode_strip_prefixes(xmlnode *node) +{ + xmlnode *child; + const char *prefix; + + g_return_if_fail(node != NULL); + + for (child = node->child; child; child = child->next) { + if (child->type == XMLNODE_TYPE_TAG) + xmlnode_strip_prefixes(child); + } + + prefix = xmlnode_get_prefix(node); + if (prefix) { + const char *ns = xmlnode_get_prefix_namespace(node, prefix); + xmlnode_set_namespace(node, ns); + xmlnode_set_prefix(node, NULL); + } else { + xmlnode_set_namespace(node, xmlnode_get_default_namespace(node)); + } +} + xmlnode *xmlnode_get_parent(const xmlnode *child) { g_return_val_if_fail(child != NULL, NULL); @@ -455,12 +537,22 @@ xmlnode_to_str_helper(const xmlnode *node, int *len, gboolean formatting, int de if (node->namespace_map) { g_hash_table_foreach(node->namespace_map, (GHFunc)xmlnode_to_str_foreach_append_ns, text); - } else if (node->xmlns) { - if(!node->parent || !purple_strequal(node->xmlns, node->parent->xmlns)) + } else { + /* Figure out if this node has a different default namespace from parent */ + const char *xmlns = NULL; + const char *parent_xmlns = NULL; + if (!prefix) + xmlns = node->xmlns; + + if (!xmlns) + xmlns = xmlnode_get_default_namespace(node); + if (node->parent) + parent_xmlns = xmlnode_get_default_namespace(node->parent); + if (!purple_strequal(xmlns, parent_xmlns)) { - char *xmlns = g_markup_escape_text(node->xmlns, -1); - g_string_append_printf(text, " xmlns='%s'", xmlns); - g_free(xmlns); + char *escaped_xmlns = g_markup_escape_text(xmlns, -1); + g_string_append_printf(text, " xmlns='%s'", escaped_xmlns); + g_free(escaped_xmlns); } } for(c = node->child; c; c = c->next) diff --git a/libpurple/xmlnode.h b/libpurple/xmlnode.h index f2ac281016..359eef0e03 100644 --- a/libpurple/xmlnode.h +++ b/libpurple/xmlnode.h @@ -157,42 +157,14 @@ char *xmlnode_get_data_unescaped(const xmlnode *node); */ void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_XMLNODE_C_) -/** - * Sets a prefixed attribute for a node - * - * @param node The node to set an attribute for. - * @param attr The name of the attribute to set - * @param prefix The prefix of the attribute to ste - * @param value The value of the attribute - * - * @deprecated Use xmlnode_set_attrib_full instead. - */ -void xmlnode_set_attrib_with_prefix(xmlnode *node, const char *attr, const char *prefix, const char *value); - -/** - * Sets a namespaced attribute for a node - * - * @param node The node to set an attribute for. - * @param attr The name of the attribute to set - * @param xmlns The namespace of the attribute to ste - * @param value The value of the attribute - * - * @deprecated Use xmlnode_set_attrib_full instead. - */ -void xmlnode_set_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns, const char *value); -#endif /* PURPLE_DISABLE_DEPRECATED */ - /** * Sets a namespaced attribute for a node * * @param node The node to set an attribute for. * @param attr The name of the attribute to set - * @param xmlns The namespace of the attribute to ste - * @param prefix The prefix of the attribute to ste + * @param xmlns The namespace of the attribute to set + * @param prefix The prefix of the attribute to set * @param value The value of the attribute - * - * @since 2.6.0 */ void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, const char *prefix, const char *value); @@ -249,7 +221,37 @@ void xmlnode_set_namespace(xmlnode *node, const char *xmlns); * @param node The node to get the namepsace from * @return The namespace of this node */ -const char *xmlnode_get_namespace(xmlnode *node); +const char *xmlnode_get_namespace(const xmlnode *node); + +/** + * Returns the current default namespace. The default + * namespace is the current namespace which applies to child + * elements which are unprefixed and which do not contain their + * own namespace. + * + * For example, given: + * \verbatim + * + * + * + * \endverbatim + * + * The default namespace of all nodes (including 'child1') is "jabber:client", + * though the namespace for 'element' is "http://example.org/ns1". + * + * @param node The node for which to return the default namespace + * @return The default namespace of this node + */ +const char *xmlnode_get_default_namespace(const xmlnode *node); + +/** + * Returns the defined namespace for a prefix. + * + * @param node The node from which to start the search. + * @param prefix The prefix for which to return the associated namespace. + * @return The namespace for this prefix. + */ +const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix); /** * Sets the prefix of a node @@ -267,14 +269,25 @@ void xmlnode_set_prefix(xmlnode *node, const char *prefix); */ const char *xmlnode_get_prefix(const xmlnode *node); +/** + * Remove all element prefixes from an xmlnode tree. The prefix's + * namespace is transformed into the default namespace for an element. + * + * Note that this will not necessarily remove all prefixes in use + * (prefixed attributes may still exist), and that this usage may + * break some applications (SOAP / XPath apparently often rely on + * the prefixes having the same name. + * + * @param node The node from which to strip prefixes + */ +void xmlnode_strip_prefixes(xmlnode *node); + /** * Gets the parent node. * * @param child The child node. * * @return The parent or NULL. - * - * @since 2.6.0 */ xmlnode *xmlnode_get_parent(const xmlnode *child); @@ -343,8 +356,6 @@ void xmlnode_free(xmlnode *node); * the category for debugging. * * @return The new node or NULL if an error occurred. - * - * @since 2.6.0 */ xmlnode *xmlnode_from_file(const char *dir, const char *filename, const char *description, const char *process); @@ -354,3 +365,4 @@ xmlnode *xmlnode_from_file(const char *dir, const char *filename, #endif #endif /* _PURPLE_XMLNODE_H_ */ + diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index 23890e775e..043c8196a2 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -34,7 +34,7 @@ if ENABLE_GTK pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = pidgin-3.pc -SUBDIRS = pixmaps plugins +SUBDIRS = pixmaps plugins themes bin_PROGRAMS = pidgin @@ -48,11 +48,12 @@ pidgin_SOURCES = \ gtkcertmgr.c \ gtkconn.c \ gtkconv.c \ + gtkconv-theme.c \ + gtkconv-theme-loader.c \ gtkdebug.c \ gtkdialogs.c \ gtkdnd-hints.c \ gtkdocklet.c \ - gtkdocklet-gtk.c \ gtkeventloop.c \ gtkft.c \ gtkicon-theme.c \ @@ -84,9 +85,11 @@ pidgin_SOURCES = \ gtkstatusbox.c \ gtkthemes.c \ gtkutils.c \ + gtkwebview.c \ gtkwhiteboard.c \ minidialog.c \ - pidgintooltip.c + pidgintooltip.c \ + smileyparser.c pidgin_headers = \ gtkaccount.h \ @@ -98,6 +101,8 @@ pidgin_headers = \ gtkconn.h \ gtkconv.h \ gtkconvwin.h \ + gtkconv-theme.h \ + gtkconv-theme-loader.h \ gtkdebug.h \ gtkdialogs.h \ gtkdnd-hints.h \ @@ -134,10 +139,12 @@ pidgin_headers = \ pidginstock.h \ gtkthemes.h \ gtkutils.h \ + gtkwebview.h \ gtkwhiteboard.h \ minidialog.h \ pidgintooltip.h \ - pidgin.h + pidgin.h \ + smileyparser.h pidginincludedir=$(includedir)/pidgin pidgininclude_HEADERS = \ @@ -149,6 +156,7 @@ pidgin_LDFLAGS = -export-dynamic pidgin_LDADD = \ @LIBOBJS@ \ $(GLIB_LIBS) \ + $(GCR_LIBS) \ $(DBUS_LIBS) \ $(GSTREAMER_LIBS) \ $(XSS_LIBS) \ @@ -156,6 +164,7 @@ pidgin_LDADD = \ $(INTLLIBS) \ $(GTKSPELL_LIBS) \ $(LIBXML_LIBS) \ + $(WEBKIT_LIBS) \ $(GTK_LIBS) \ $(top_builddir)/libpurple/libpurple.la @@ -173,11 +182,14 @@ AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ $(GLIB_CFLAGS) \ + $(GCR_CFLAGS) \ $(GSTREAMER_CFLAGS) \ $(DEBUG_CFLAGS) \ $(GTK_CFLAGS) \ $(DBUS_CFLAGS) \ $(GTKSPELL_CFLAGS) \ $(LIBXML_CFLAGS) \ + $(WEBKIT_CFLAGS) \ $(INTGG_CFLAGS) endif # ENABLE_GTK + diff --git a/pidgin/Makefile.mingw b/pidgin/Makefile.mingw index 145bb7f6d1..8d407b08e6 100644 --- a/pidgin/Makefile.mingw +++ b/pidgin/Makefile.mingw @@ -58,6 +58,8 @@ PIDGIN_C_SRC = \ gtkcertmgr.c \ gtkconn.c \ gtkconv.c \ + gtkconv-theme.c \ + gtkconv-theme-loader.c \ gtkdebug.c \ gtkdialogs.c \ gtkdnd-hints.c \ @@ -91,12 +93,12 @@ PIDGIN_C_SRC = \ gtkstatusbox.c \ gtkthemes.c \ gtkutils.c \ + gtkwebview.c \ gtkwhiteboard.c \ minidialog.c \ pidginstock.c \ pidgintooltip.c \ - win32/MinimizeToTray.c \ - win32/gtkdocklet-win32.c \ + smileyparser.c \ win32/gtkwin32dep.c \ win32/untar.c \ win32/wspell.c diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index e07bfe2b70..99c4a22870 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -167,7 +167,7 @@ static void add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent); static void add_voice_options(AccountPrefsDialog *dialog); static const char * -xmpp_default_domain_hackery(GtkWidget *protocol_combo) +google_talk_default_domain_hackery(GtkWidget *protocol_combo, const char *value_if_gtalk) { GtkTreeModel *model; GtkTreeIter iter; @@ -185,12 +185,7 @@ xmpp_default_domain_hackery(GtkWidget *protocol_combo) gtk_tree_model_get(model, &iter, 1, &item_name, -1); if (item_name) { if (!strcmp(item_name, _("Google Talk"))) - value = "gmail.com"; - g_free(item_name); - } - if (item_name) { - if (!strcmp(item_name, _("Facebook"))) - value = "chat.facebook.com"; + value = value_if_gtalk; g_free(item_name); } /* If it's not GTalk, but still Jabber then the value is not NULL, it's empty */ @@ -390,11 +385,9 @@ static void account_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *sd, guint info, guint t, AccountPrefsDialog *dialog) { - const gchar *name = (gchar *) gtk_selection_data_get_data(sd); - gint length = gtk_selection_data_get_length(sd); - gint format = gtk_selection_data_get_format(sd); + gchar *name = (gchar *)sd->data; - if (length >= 0 && format == 8) { + if ((sd->length >= 0) && (sd->format == 8)) { /* Well, it looks like the drag event was cool. * Let's do something with it */ if (!g_ascii_strncasecmp(name, "file://", 7)) { @@ -600,7 +593,7 @@ add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) /* Google Talk default domain hackery! */ if (!strcmp(_("Domain"), purple_account_user_split_get_text(split)) && !value) - value = xmpp_default_domain_hackery(dialog->protocol_menu); + value = google_talk_default_domain_hackery(dialog->protocol_menu, "gmail.com"); if (value != NULL) gtk_entry_set_text(GTK_ENTRY(entry), value); @@ -1089,7 +1082,7 @@ proxy_type_changed_cb(GtkWidget *menu, AccountPrefsDialog *dialog) dialog->new_proxy_type == PURPLE_PROXY_NONE || dialog->new_proxy_type == PURPLE_PROXY_USE_ENVVAR) { - gtk_widget_hide(dialog->proxy_vbox); + gtk_widget_hide_all(dialog->proxy_vbox); } else gtk_widget_show_all(dialog->proxy_vbox); @@ -1792,9 +1785,7 @@ drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx, GtkSelectionData *data, guint info, guint time, AccountsWindow *dialog) { - GdkAtom target = gtk_selection_data_get_target(data); - - if (target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE)) { + if (data->target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE)) { GtkTreeRowReference *ref; GtkTreePath *source_row; GtkTreeIter iter; @@ -1865,16 +1856,13 @@ drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx, guint x, guint y, GtkSelectionData *sd, guint info, guint t, AccountsWindow *dialog) { - GdkAtom target = gtk_selection_data_get_target(sd); - const guchar *data = gtk_selection_data_get_data(sd); - - if (target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE) && data) { + if (sd->target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE) && sd->data) { gint dest_index; PurpleAccount *a = NULL; GtkTreePath *path = NULL; GtkTreeViewDropPosition position; - memcpy(&a, data, sizeof(a)); + memcpy(&a, sd->data, sizeof(a)); if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) { @@ -2764,3 +2752,4 @@ pidgin_account_uninit(void) purple_signals_disconnect_by_handle(pidgin_account_get_handle()); purple_signals_unregister_by_instance(pidgin_account_get_handle()); } + diff --git a/pidgin/gtkblist-theme-loader.c b/pidgin/gtkblist-theme-loader.c index 2d8ee55f43..b5936f3916 100644 --- a/pidgin/gtkblist-theme-loader.c +++ b/pidgin/gtkblist-theme-loader.c @@ -65,8 +65,7 @@ parse_color(xmlnode *node, const char *tag) GdkColor color; if (temp && gdk_color_parse(temp, &color)) { - /* TODO: fix this for gtk+ 3.0 */ - /*gdk_colormap_alloc_color(gdk_colormap_get_system(), &color, FALSE, TRUE);*/ + gdk_colormap_alloc_color(gdk_colormap_get_system(), &color, FALSE, TRUE); return gdk_color_copy(&color); } else { return NULL; diff --git a/pidgin/gtkblist-theme.c b/pidgin/gtkblist-theme.c index 83585aa0bd..cb034bfb2e 100644 --- a/pidgin/gtkblist-theme.c +++ b/pidgin/gtkblist-theme.c @@ -24,7 +24,7 @@ #include "gtkblist-theme.h" #define PIDGIN_BLIST_THEME_GET_PRIVATE(Gobject) \ - ((PidginBlistThemePrivate *) ((PIDGIN_BLIST_THEME(Gobject))->priv)) + (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_BLIST_THEME, PidginBlistThemePrivate)) /****************************************************************************** * Structs @@ -188,13 +188,6 @@ pidgin_theme_font_get_color_describe(PidginThemeFont *font) * GObject Stuff *****************************************************************************/ -static void -pidgin_blist_theme_init(GTypeInstance *instance, - gpointer klass) -{ - (PIDGIN_BLIST_THEME(instance))->priv = g_new0(PidginBlistThemePrivate, 1); -} - static void pidgin_blist_theme_get_property(GObject *obj, guint param_id, GValue *value, GParamSpec *psec) @@ -349,8 +342,6 @@ pidgin_blist_theme_finalize(GObject *obj) pidgin_theme_font_free(priv->message_nick_said); pidgin_theme_font_free(priv->status); - g_free(priv); - parent_class->finalize (obj); } @@ -362,6 +353,8 @@ pidgin_blist_theme_class_init(PidginBlistThemeClass *klass) parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private(klass, sizeof(PidginBlistThemePrivate)); + obj_class->get_property = pidgin_blist_theme_get_property; obj_class->set_property = pidgin_blist_theme_set_property; obj_class->finalize = pidgin_blist_theme_finalize; @@ -484,7 +477,7 @@ pidgin_blist_theme_get_type (void) NULL, /* class_data */ sizeof(PidginBlistTheme), 0, /* n_preallocs */ - pidgin_blist_theme_init, /* instance_init */ + NULL, /* instance_init */ NULL, /* value table */ }; type = g_type_register_static (PURPLE_TYPE_THEME, @@ -507,7 +500,7 @@ pidgin_blist_theme_get_background_color(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->bgcolor; } @@ -519,7 +512,7 @@ pidgin_blist_theme_get_opacity(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), 1.0); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->opacity; } @@ -531,7 +524,7 @@ pidgin_blist_theme_get_layout(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->layout; } @@ -543,7 +536,7 @@ pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->expanded_color; } @@ -555,7 +548,7 @@ pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->expanded; } @@ -567,7 +560,7 @@ pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->collapsed_color; } @@ -579,7 +572,7 @@ pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->collapsed; } @@ -591,7 +584,7 @@ pidgin_blist_theme_get_contact_color(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->contact_color; } @@ -603,7 +596,7 @@ pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->contact; } @@ -615,7 +608,7 @@ pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->online; } @@ -627,7 +620,7 @@ pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->away; } @@ -639,7 +632,7 @@ pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->offline; } @@ -651,7 +644,7 @@ pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->idle; } @@ -663,7 +656,7 @@ pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->message; } @@ -675,7 +668,7 @@ pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme *them g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->message_nick_said; } @@ -687,7 +680,7 @@ pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme) g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); return priv->status; } @@ -700,7 +693,7 @@ pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, const GdkColor g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); if (priv->bgcolor) gdk_color_free(priv->bgcolor); @@ -714,7 +707,7 @@ pidgin_blist_theme_set_opacity(PidginBlistTheme *theme, gdouble opacity) g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme) || opacity < 0.0 || opacity > 1.0); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); priv->opacity = opacity; } @@ -726,7 +719,7 @@ pidgin_blist_theme_set_layout(PidginBlistTheme *theme, const PidginBlistLayout * g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); g_free(priv->layout); priv->layout = g_memdup(layout, sizeof(PidginBlistLayout)); @@ -739,7 +732,7 @@ pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, const g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); if (priv->expanded_color) gdk_color_free(priv->expanded_color); @@ -753,7 +746,7 @@ pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, const PidginT g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->expanded); priv->expanded = copy_font_and_color(pair); @@ -766,7 +759,7 @@ pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, const g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); if (priv->collapsed_color) gdk_color_free(priv->collapsed_color); @@ -780,7 +773,7 @@ pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, const Pidgin g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->collapsed); priv->collapsed = copy_font_and_color(pair); @@ -793,7 +786,7 @@ pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, const GdkColor *co g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); if (priv->contact_color) gdk_color_free(priv->contact_color); @@ -807,7 +800,7 @@ pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, const PidginTh g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->contact); priv->contact = copy_font_and_color(pair); @@ -820,7 +813,7 @@ pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, const PidginThe g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->online); priv->online = copy_font_and_color(pair); @@ -833,7 +826,7 @@ pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, const PidginTheme g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->away); priv->away = copy_font_and_color(pair); @@ -846,7 +839,7 @@ pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, const PidginTh g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->offline); priv->offline = copy_font_and_color(pair); @@ -859,7 +852,7 @@ pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, const PidginTheme g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->idle); priv->idle = copy_font_and_color(pair); @@ -872,7 +865,7 @@ pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, const P g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->message); priv->message = copy_font_and_color(pair); @@ -885,7 +878,7 @@ pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme *them g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->message_nick_said); priv->message_nick_said = copy_font_and_color(pair); @@ -898,7 +891,7 @@ pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, const PidginThe g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme)); - priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); + priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme); pidgin_theme_font_free(priv->status); priv->status = copy_font_and_color(pair); diff --git a/pidgin/gtkblist-theme.h b/pidgin/gtkblist-theme.h index 2c4fb07fb0..db5c6fb9be 100644 --- a/pidgin/gtkblist-theme.h +++ b/pidgin/gtkblist-theme.h @@ -51,7 +51,6 @@ typedef struct _PidginBlistThemeClass PidginBlistThemeClass; struct _PidginBlistTheme { PurpleTheme parent; - gpointer priv; }; struct _PidginBlistThemeClass diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 727881642d..4d7fc2b1bf 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -124,6 +124,11 @@ typedef struct #define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \ ((PidginBuddyListPrivate *)((list)->priv)) +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) +#define gtk_widget_has_focus(x) GTK_WIDGET_HAS_FOCUS(x) +#endif + static guint accounts_merge_id; static GtkActionGroup *accounts_action_group = NULL; @@ -346,13 +351,13 @@ static void gtk_blist_menu_move_to_cb(GtkWidget *w, PurpleBlistNode *node) static void gtk_blist_menu_autojoin_cb(GtkWidget *w, PurpleChat *chat) { - purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin", + purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-autojoin", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); } static void gtk_blist_menu_persistent_cb(GtkWidget *w, PurpleChat *chat) { - purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-persistent", + purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-persistent", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); } @@ -462,9 +467,9 @@ gtk_blist_do_personize(GList *merges) GList *tmp; /* First, we find the contact to merge the rest of the buddies into. - * This will be the contact with the most buddies in it; ties are broken - * by which contact is higher in the list - */ + * This will be the contact with the most buddies in it; ties are broken + * by which contact is higher in the list + */ for (tmp = merges; tmp; tmp = tmp->next) { PurpleBlistNode *node = tmp->data; PurpleBlistNode *b; @@ -919,7 +924,7 @@ set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data) gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), GTK_RESPONSE_OK, sensitive); gc = purple_account_get_connection(data->rq_data.account); - prpl_info = (gc != NULL) ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; + prpl_info = (gc != NULL) ? PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)) : NULL; sensitive = (prpl_info != NULL && prpl_info->roomlist_get_list != NULL); gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), 1, sensitive); @@ -943,7 +948,7 @@ chat_account_filter_func(PurpleAccount *account) if (gc == NULL) return FALSE; - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); return (prpl_info->chat_info != NULL); } @@ -985,23 +990,20 @@ make_blist_request_dialog(PidginBlistRequestData *data, PurpleAccount *account, gtkblist = PIDGIN_BLIST(purple_get_blist()); blist_window = gtkblist ? GTK_WINDOW(gtkblist->window) : NULL; - /* TODO: set no separator in gtk+ 3... */ data->window = gtk_dialog_new_with_buttons(title, - blist_window, 0, NULL); + blist_window, GTK_DIALOG_NO_SEPARATOR, + NULL); gtk_window_set_transient_for(GTK_WINDOW(data->window), blist_window); gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK); gtk_container_set_border_width(GTK_CONTAINER(data->window), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE); - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), - PIDGIN_HIG_BORDER); - gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), - PIDGIN_HIG_BOX_SPACE); + gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), PIDGIN_HIG_BORDER); + gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), PIDGIN_HIG_BOX_SPACE); gtk_window_set_role(GTK_WINDOW(data->window), window_role); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), - hbox); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox); gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); gtk_misc_set_alignment(GTK_MISC(img), 0, 0); @@ -1036,6 +1038,7 @@ static void rebuild_chat_entries(PidginChatData *data, const char *default_chat_name) { PurpleConnection *gc; + PurplePluginProtocolInfo *prpl_info; GList *list = NULL, *tmp; GHashTable *defaults = NULL; struct proto_chat_entry *pce; @@ -1044,17 +1047,18 @@ rebuild_chat_entries(PidginChatData *data, const char *default_chat_name) g_return_if_fail(data->rq_data.account != NULL); gc = purple_account_get_connection(data->rq_data.account); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); gtk_container_foreach(GTK_CONTAINER(data->rq_data.vbox), (GtkCallback)gtk_widget_destroy, NULL); g_list_free(data->entries); data->entries = NULL; - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) - list = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc); + if (prpl_info->chat_info != NULL) + list = prpl_info->chat_info(gc); - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) - defaults = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, default_chat_name); + if (prpl_info->chat_info_defaults != NULL) + defaults = prpl_info->chat_info_defaults(gc, default_chat_name); for (tmp = list; tmp; tmp = tmp->next) { @@ -1064,7 +1068,7 @@ rebuild_chat_entries(PidginChatData *data, const char *default_chat_name) if (pce->is_int) { - GtkAdjustment *adjust; + GtkObject *adjust; adjust = gtk_adjustment_new(pce->min, pce->min, pce->max, 1, 10, 10); input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); @@ -1417,7 +1421,7 @@ pidgin_append_blist_node_proto_menu(GtkWidget *menu, PurpleConnection *gc, PurpleBlistNode *node) { GList *l, *ll; - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if(!prpl_info || !prpl_info->blist_node_menu) return; @@ -1525,7 +1529,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) if (prpl_info && prpl_info->send_file) { if (!prpl_info->can_receive_file || - prpl_info->can_receive_file(buddy->account->gc, buddy->name)) + prpl_info->can_receive_file(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy))) { pidgin_new_item_from_stock(menu, _("_Send File..."), PIDGIN_STOCK_TOOLBAR_SEND_FILE, @@ -1553,14 +1557,14 @@ pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL); } - pidgin_append_blist_node_proto_menu(menu, buddy->account->gc, node); + pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(purple_buddy_get_account(buddy)), node); pidgin_append_blist_node_extended_menu(menu, node); if (!contact_expanded && contact != NULL) - pidgin_append_blist_node_move_to_menu(menu, (PurpleBlistNode *)contact); + pidgin_append_blist_node_move_to_menu(menu, PURPLE_BLIST_NODE(contact)); if (node->parent && node->parent->child->next && - !sub && !contact_expanded) { + !sub && !contact_expanded) { pidgin_separator(menu); pidgin_append_blist_node_privacy_menu(menu, node); pidgin_new_item_from_stock(menu, _("_Alias..."), PIDGIN_STOCK_ALIAS, @@ -1606,14 +1610,14 @@ gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) return FALSE; } if(buddy) - pidgin_retrieve_user_info(buddy->account->gc, buddy->name); + pidgin_retrieve_user_info(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy)); } else { switch (event->keyval) { - case GDK_KEY_F2: + case GDK_F2: gtk_blist_menu_alias_cb(tv, node); break; - case GDK_KEY_Left: + case GDK_Left: path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) { /* Collapse the Group */ @@ -1635,7 +1639,7 @@ gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) gtk_tree_path_free(path); break; - case GDK_KEY_Right: + case GDK_Right: path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter); if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) { /* Expand the Group */ @@ -1759,7 +1763,7 @@ create_chat_menu(PurpleBlistNode *node, PurpleChat *c) pidgin_new_item_from_stock(menu, _("View _Log"), NULL, G_CALLBACK(gtk_blist_menu_showlog_cb), node, 0, 0, NULL); - pidgin_append_blist_node_proto_menu(menu, c->account->gc, node); + pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(purple_chat_get_account(c)), node); pidgin_append_blist_node_extended_menu(menu, node); pidgin_separator(menu); @@ -1809,7 +1813,7 @@ create_contact_menu (PurpleBlistNode *node) static GtkWidget * create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) { - struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkWidget *menu; GtkWidget *menuitem; gboolean show_offline = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies"); @@ -1844,13 +1848,13 @@ create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) if(buddy == b) continue; - if(!buddy->account->gc) + if(!purple_account_get_connection(purple_buddy_get_account(buddy))) continue; if(!show_offline && !PURPLE_BUDDY_IS_ONLINE(buddy)) continue; - menuitem = gtk_image_menu_item_new_with_label(buddy->name); - buf = pidgin_create_prpl_icon(buddy->account,PIDGIN_PRPL_ICON_SMALL); + menuitem = gtk_image_menu_item_new_with_label(purple_buddy_get_name(buddy)); + buf = pidgin_create_prpl_icon(purple_buddy_get_account(buddy), PIDGIN_PRPL_ICON_SMALL); image = gtk_image_new_from_pixbuf(buf); g_object_unref(G_OBJECT(buf)); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), @@ -1877,12 +1881,10 @@ pidgin_blist_show_context_menu(PurpleBlistNode *node, guint button, guint32 time) { - struct _pidgin_blist_node *gtknode; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkWidget *menu = NULL; gboolean handled = FALSE; - gtknode = (struct _pidgin_blist_node *)node->ui_data; - /* Create a menu based on the thing we right-clicked on */ if (PURPLE_BLIST_NODE_IS_GROUP(node)) { PurpleGroup *g = (PurpleGroup *)node; @@ -1944,7 +1946,7 @@ gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_da return FALSE; gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path); gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); - gtknode = (struct _pidgin_blist_node *)node->ui_data; + gtknode = purple_blist_node_get_ui_data(node); /* Right click draws a context menu */ if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) { @@ -1968,12 +1970,12 @@ gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_da else b = (PurpleBuddy *)node; - prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b))); if (prpl != NULL) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); if (prpl && prpl_info->get_info) - pidgin_retrieve_user_info(b->account->gc, b->name); + pidgin_retrieve_user_info(purple_account_get_connection(purple_buddy_get_account(b)), purple_buddy_get_name(b)); handled = TRUE; } @@ -2123,7 +2125,7 @@ add_buddies_from_vcard(const char *prpl_id, PurpleGroup *group, GList *list, for (l = list; l != NULL; l = l->next) { purple_blist_request_add_buddy(account, l->data, - (group ? group->name : NULL), + (group ? purple_group_get_name(group) : NULL), alias); } } @@ -2250,9 +2252,9 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, guint time, gpointer null) { - GdkAtom target = gtk_selection_data_get_target(data); - if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { + if (data->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) + { GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row"); GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref); GtkTreeIter iter; @@ -2268,7 +2270,9 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, sizeof (node)); gtk_tree_path_free(sourcerow); - } else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) { + } + else if (data->target == gdk_atom_intern("application/x-im-contact", FALSE)) + { GtkTreeRowReference *ref; GtkTreePath *sourcerow; GtkTreeIter iter; @@ -2302,7 +2306,7 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, buddy = (PurpleBuddy *)node; } - gc = purple_account_get_connection(buddy->account); + gc = purple_account_get_connection(purple_buddy_get_account(buddy)); if (gc == NULL) { @@ -2311,7 +2315,7 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, } protocol = - PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account, + PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->list_icon(purple_buddy_get_account(buddy), buddy); str = g_string_new(NULL); @@ -2321,13 +2325,13 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, "X-IM-Protocol: %s\r\n" "X-IM-Username: %s\r\n", protocol, - buddy->name); + purple_buddy_get_name(buddy)); - if (buddy->alias != NULL) + if (purple_buddy_get_local_buddy_alias(buddy) != NULL) { g_string_append_printf(str, "X-IM-Alias: %s\r\n", - buddy->alias); + purple_buddy_get_local_buddy_alias(buddy)); } g_string_append(str, "\r\n"); @@ -2346,19 +2350,16 @@ static void pidgin_blist_drag_data_get_cb(GtkWidget *widget, static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, guint info, guint t) { - GdkAtom target = gtk_selection_data_get_target(sd); - const guchar *data = gtk_selection_data_get_data(sd); - if (gtkblist->drag_timeout) { g_source_remove(gtkblist->drag_timeout); gtkblist->drag_timeout = 0; } - if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE) && data) { + if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE) && sd->data) { PurpleBlistNode *n = NULL; GtkTreePath *path = NULL; GtkTreeViewDropPosition position; - memcpy(&n, data, sizeof(n)); + memcpy(&n, sd->data, sizeof(n)); if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) { /* if we're here, I think it means the drop is ok */ GtkTreeIter iter; @@ -2369,7 +2370,7 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, &iter, path); gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); - gtknode = node->ui_data; + gtknode = purple_blist_node_get_ui_data(node); if (PURPLE_BLIST_NODE_IS_CONTACT(n)) { PurpleContact *c = (PurpleContact*)n; @@ -2494,10 +2495,12 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, } gtk_tree_path_free(path); - gtk_drag_finish(dc, TRUE, (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } - } else if (target == gdk_atom_intern("application/x-im-contact", - FALSE) && data) { + } + else if (sd->target == gdk_atom_intern("application/x-im-contact", + FALSE) && sd->data) + { PurpleGroup *group = NULL; GtkTreePath *path = NULL; GtkTreeViewDropPosition position; @@ -2532,7 +2535,7 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, } } - if (pidgin_parse_x_im_contact((const char *) data, FALSE, &account, + if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, &protocol, &username, &alias)) { if (account == NULL) @@ -2544,7 +2547,7 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, else { purple_blist_request_add_buddy(account, username, - (group ? group->name : NULL), + (group ? purple_group_get_name(group) : NULL), alias); } } @@ -2556,10 +2559,9 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, if (path != NULL) gtk_tree_path_free(path); - gtk_drag_finish(dc, TRUE, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } - else if (target == gdk_atom_intern("text/x-vcard", FALSE) && data) + else if (sd->target == gdk_atom_intern("text/x-vcard", FALSE) && sd->data) { gboolean result; PurpleGroup *group = NULL; @@ -2592,11 +2594,10 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, } } - result = parse_vcard((const gchar *) data, group); + result = parse_vcard((const gchar *)sd->data, group); - gtk_drag_finish(dc, result, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); - } else if (target == gdk_atom_intern("text/uri-list", FALSE) && data) { + gtk_drag_finish(dc, result, (dc->action == GDK_ACTION_MOVE), t); + } else if (sd->target == gdk_atom_intern("text/uri-list", FALSE) && sd->data) { GtkTreePath *path = NULL; GtkTreeViewDropPosition position; @@ -2613,9 +2614,8 @@ static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) { PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node)); - pidgin_dnd_file_manage(sd, b->account, b->name); - gtk_drag_finish(dc, TRUE, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + pidgin_dnd_file_manage(sd, purple_buddy_get_account(b), purple_buddy_get_name(b)); + gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } else { gtk_drag_finish(dc, FALSE, FALSE, t); } @@ -2687,8 +2687,8 @@ static GdkPixbuf *pidgin_blist_get_buddy_icon(PurpleBlistNode *node, account = purple_buddy_get_account(buddy); } - if(account && account->gc) { - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); + if(account && purple_account_get_connection(account)) { + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(purple_account_get_connection(account))); } #if 0 @@ -2701,7 +2701,7 @@ static GdkPixbuf *pidgin_blist_get_buddy_icon(PurpleBlistNode *node, * a contact then this is a group or some other type of node and we * want to use that directly. */ if (contact) { - custom_img = purple_buddy_icons_node_find_custom_icon((PurpleBlistNode*)contact); + custom_img = purple_buddy_icons_node_find_custom_icon(PURPLE_BLIST_NODE(contact)); } else { custom_img = purple_buddy_icons_node_find_custom_icon(node); } @@ -2714,7 +2714,7 @@ static GdkPixbuf *pidgin_blist_get_buddy_icon(PurpleBlistNode *node, if (data == NULL) { if (buddy) { /* Not sure I like this...*/ - if (!(icon = purple_buddy_icons_find(buddy->account, buddy->name))) + if (!(icon = purple_buddy_icons_find(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)))) return NULL; data = purple_buddy_icon_get_data(icon, &len); } @@ -2884,9 +2884,9 @@ static struct tooltip_data * create_tip_for_node(PurpleBlistNode *node, gboolean char *tmp = NULL, *node_name = NULL, *tooltip_text = NULL; if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - account = ((PurpleBuddy*)(node))->account; + account = purple_buddy_get_account((PurpleBuddy*)(node)); } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { - account = ((PurpleChat*)(node))->account; + account = purple_chat_get_account((PurpleChat*)(node)); } td->padding = TOOLTIP_BORDER; @@ -2940,6 +2940,7 @@ static gboolean pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) { GtkStyle *style; + cairo_t *cr; int current_height, max_width; int max_text_width; int max_avatar_width; @@ -2951,7 +2952,7 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) if(gtkblist->tooltipdata == NULL) return FALSE; - style = gtk_widget_get_style(gtkblist->tipwindow); + style = gtkblist->tipwindow->style; max_text_width = 0; max_avatar_width = 0; @@ -2973,86 +2974,89 @@ pidgin_blist_paint_tip(GtkWidget *widget, gpointer null) else prpl_col = TOOLTIP_BORDER + status_size + SMALL_SPACE + max_text_width - PRPL_SIZE; + cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(gtkblist->tipwindow))); current_height = 12; for(l = gtkblist->tooltipdata; l; l = l->next) { struct tooltip_data *td = l->data; - cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(gtkblist->tipwindow)); if (td->avatar && pidgin_gdk_pixbuf_is_opaque(td->avatar)) { if (dir == GTK_TEXT_DIR_RTL) - gtk_paint_flat_box(style, cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - gtkblist->tipwindow, "tooltip", - TOOLTIP_BORDER - 1, current_height - 1, - td->avatar_width + 2, td->avatar_height + 2); + gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + NULL, gtkblist->tipwindow, "tooltip", + TOOLTIP_BORDER -1, current_height -1, td->avatar_width +2, td->avatar_height + 2); else - gtk_paint_flat_box(style, cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - gtkblist->tipwindow, "tooltip", - max_width - (td->avatar_width + TOOLTIP_BORDER) - 1, - current_height - 1, - td->avatar_width + 2, td->avatar_height + 2); + gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + NULL, gtkblist->tipwindow, "tooltip", + max_width - (td->avatar_width+ TOOLTIP_BORDER)-1, + current_height-1,td->avatar_width+2, td->avatar_height+2); } if (td->status_icon) { if (dir == GTK_TEXT_DIR_RTL) { gdk_cairo_set_source_pixbuf(cr, td->status_icon, - max_width - TOOLTIP_BORDER - status_size, current_height); + max_width - TOOLTIP_BORDER - status_size, + current_height); cairo_paint(cr); } else { - gdk_cairo_set_source_pixbuf(cr, td->status_icon, TOOLTIP_BORDER, current_height); + gdk_cairo_set_source_pixbuf(cr, td->status_icon, + TOOLTIP_BORDER, current_height); cairo_paint(cr); } } - if (td->avatar) { + if(td->avatar) { if (dir == GTK_TEXT_DIR_RTL) { - gdk_cairo_set_source_pixbuf(cr, td->avatar, TOOLTIP_BORDER, - current_height); + gdk_cairo_set_source_pixbuf(cr, td->avatar, + TOOLTIP_BORDER, current_height); cairo_paint(cr); } else { gdk_cairo_set_source_pixbuf(cr, td->avatar, - max_width - (td->avatar_width + TOOLTIP_BORDER), current_height); + max_width - (td->avatar_width + TOOLTIP_BORDER), + current_height); cairo_paint(cr); } } if (!td->avatar_is_prpl_icon && td->prpl_icon) { gdk_cairo_set_source_pixbuf(cr, td->prpl_icon, prpl_col, - current_height + ((td->name_height / 2) - (PRPL_SIZE / 2))); + current_height + + (td->name_height - PRPL_SIZE) / 2); cairo_paint(cr); } if (td->name_layout) { if (dir == GTK_TEXT_DIR_RTL) { - gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, - gtkblist->tipwindow, "tooltip", - max_width - (TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), + gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, + NULL, gtkblist->tipwindow, "tooltip", + max_width -(TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), current_height, td->name_layout); } else { - gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, - gtkblist->tipwindow, "tooltip", + gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, + NULL, gtkblist->tipwindow, "tooltip", TOOLTIP_BORDER + status_size + SMALL_SPACE, current_height, td->name_layout); } } if (td->layout) { if (dir != GTK_TEXT_DIR_RTL) { - gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, - gtkblist->tipwindow, "tooltip", + gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, + NULL, gtkblist->tipwindow, "tooltip", TOOLTIP_BORDER + status_size + SMALL_SPACE, current_height + td->name_height, td->layout); } else { - gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, - gtkblist->tipwindow, "tooltip", + gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, + NULL, gtkblist->tipwindow, "tooltip", max_width - (TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), current_height + td->name_height, td->layout); } } - cairo_destroy(cr); current_height += MAX(td->name_height + td->height, td->avatar_height) + td->padding; } + + cairo_destroy(cr); return FALSE; } @@ -3193,7 +3197,7 @@ static gboolean pidgin_blist_expand_timeout(GtkWidget *tv) return FALSE; } - gtknode = node->ui_data; + gtknode = purple_blist_node_get_ui_data(node); if (!gtknode->contact_expanded) { GtkTreeIter i; @@ -3201,8 +3205,7 @@ static gboolean pidgin_blist_expand_timeout(GtkWidget *tv) pidgin_blist_expand_contact_cb(NULL, node); gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, >kblist->contact_rect); - gtkblist->contact_rect.width = - gdk_window_get_width(gtk_widget_get_window(tv)); + gdk_drawable_get_size(GDK_DRAWABLE(tv->window), &(gtkblist->contact_rect.width), NULL); gtkblist->mouseover_contact = node; gtk_tree_path_down (path); while (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &i, path)) { @@ -3223,13 +3226,13 @@ static gboolean buddy_is_displayable(PurpleBuddy *buddy) if(!buddy) return FALSE; - gtknode = ((PurpleBlistNode*)buddy)->ui_data; + gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); - return (purple_account_is_connected(buddy->account) && - (purple_presence_is_online(buddy->presence) || + return (purple_account_is_connected(purple_buddy_get_account(buddy)) && + (purple_presence_is_online(purple_buddy_get_presence(buddy)) || (gtknode && gtknode->recent_signonoff) || purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies") || - purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline"))); + purple_blist_node_get_bool(PURPLE_BLIST_NODE(buddy), "show_offline"))); } void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget) @@ -3404,7 +3407,7 @@ edit_mood_cb(PurpleConnection *gc, PurpleRequestFields *fields) const char *text; PurpleAccount *account = purple_connection_get_account(gc); - if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES) { + if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES) { PurpleRequestField *text_field; text_field = purple_request_fields_get_field(fields, "text"); text = purple_request_field_string_get_value(text_field); @@ -3420,7 +3423,7 @@ edit_mood_cb(PurpleConnection *gc, PurpleRequestFields *fields) PurpleAccount *account = (PurpleAccount *) accounts->data; PurpleConnection *gc = purple_account_get_connection(account); - if (gc && gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) { + if (gc && (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOODS)) { update_status_with_mood(account, mood, NULL); } } @@ -3455,9 +3458,9 @@ get_global_moods(void) if (purple_account_is_connected(account)) { PurpleConnection *gc = purple_account_get_connection(account); - if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) { + if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOODS) { PurplePluginProtocolInfo *prpl_info = - PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); PurpleMood *mood = NULL; /* PURPLE_CONNECTION_SUPPORT_MOODS would not be set if the prpl doesn't @@ -3515,7 +3518,7 @@ get_global_mood_status(void) PurpleAccount *account = (PurpleAccount *) accounts->data; if (purple_account_is_connected(account) && - (purple_account_get_connection(account)->flags & + (purple_connection_get_flags(purple_account_get_connection(account)) & PURPLE_CONNECTION_SUPPORT_MOODS)) { PurplePresence *presence = purple_account_get_presence(account); PurpleStatus *status = purple_presence_get_status(presence, "mood"); @@ -3550,8 +3553,8 @@ set_mood_cb(GtkWidget *widget, PurpleAccount *account) PurplePresence *presence = purple_account_get_presence(account); PurpleStatus *status = purple_presence_get_status(presence, "mood"); gc = purple_account_get_connection(account); - g_return_if_fail(gc->prpl != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + g_return_if_fail(purple_connection_get_prpl(gc) != NULL); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); current_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME); } else { current_mood = get_global_mood_status(); @@ -3561,7 +3564,7 @@ set_mood_cb(GtkWidget *widget, PurpleAccount *account) g = purple_request_field_group_new(NULL); f = purple_request_field_list_new("mood", _("Please select your mood from the list")); - purple_request_field_list_add(f, _("None"), ""); + purple_request_field_list_add_icon(f, _("None"), NULL, ""); if (current_mood == NULL) purple_request_field_list_add_selected(f, _("None")); @@ -3590,7 +3593,7 @@ set_mood_cb(GtkWidget *widget, PurpleAccount *account) purple_request_fields_add_group(fields, g); /* if the connection allows setting a mood message */ - if (gc && (gc->flags & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES)) { + if (gc && (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES)) { g = purple_request_field_group_new(NULL); f = purple_request_field_string_new("text", _("Message (optional)"), NULL, FALSE); @@ -3599,11 +3602,11 @@ set_mood_cb(GtkWidget *widget, PurpleAccount *account) } purple_request_fields(gc, _("Edit User Mood"), _("Edit User Mood"), - NULL, fields, - _("OK"), G_CALLBACK(edit_mood_cb), - _("Cancel"), NULL, - gc ? purple_connection_get_account(gc) : NULL, - NULL, NULL, gc); + NULL, fields, + _("OK"), G_CALLBACK(edit_mood_cb), + _("Cancel"), NULL, + gc ? purple_connection_get_account(gc) : NULL, + NULL, NULL, gc); g_free(global_moods); } @@ -3617,9 +3620,10 @@ set_mood_show(void) /*************************************************** * Crap * ***************************************************/ -#if 1 /* TODO: fill out tooltips... */ static const GtkActionEntry blist_menu_entries[] = { +/* NOTE: Do not set any accelerator to Control+O. It is mapped by + gtk_blist_key_press_cb to "Get User Info" on the selected buddy. */ /* Buddies menu */ { "BuddiesMenu", NULL, N_("_Buddies"), NULL, NULL, NULL }, { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "M", NULL, pidgin_dialogs_im }, @@ -3646,7 +3650,7 @@ static const GtkActionEntry blist_menu_entries[] = { { "Plugins", PIDGIN_STOCK_TOOLBAR_PLUGINS, N_("Plu_gins"), "U", NULL, pidgin_plugin_dialog_show }, { "Preferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), "P", NULL, pidgin_prefs_show }, { "Privacy", NULL, N_("Pr_ivacy"), NULL, NULL, pidgin_privacy_dialog_show }, - { "SetMood", NULL, N_("Set _Mood"), "O", NULL, set_mood_show }, + { "SetMood", NULL, N_("Set _Mood"), "D", NULL, set_mood_show }, { "FileTransfers", PIDGIN_STOCK_TOOLBAR_TRANSFER, N_("_File Transfers"), "T", NULL, G_CALLBACK(gtk_blist_show_xfer_dialog_cb) }, { "RoomList", NULL, N_("R_oom List"), NULL, NULL, pidgin_roomlist_dialog_show }, { "SystemLog", NULL, N_("System _Log"), NULL, NULL, gtk_blist_show_systemlog_cb }, @@ -3657,6 +3661,7 @@ static const GtkActionEntry blist_menu_entries[] = { { "BuildInformation", NULL, N_("_Build Information"), NULL, NULL, pidgin_dialogs_buildinfo }, { "DebugWindow", NULL, N_("_Debug Window"), NULL, NULL, toggle_debug }, { "DeveloperInformation", NULL, N_("De_veloper Information"), NULL, NULL, pidgin_dialogs_developers }, + { "PluginInformation", NULL, N_("_Plugin Information"), NULL, NULL, pidgin_dialogs_plugins_info }, { "TranslatorInformation", NULL, N_("_Translator Information"), NULL, NULL, pidgin_dialogs_translators }, { "About", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, pidgin_dialogs_about }, }; @@ -3726,6 +3731,7 @@ static const char *blist_menu = "" "" "" + "" "" "" "" @@ -3733,66 +3739,6 @@ static const char *blist_menu = "" ""; -#else -static GtkItemFactoryEntry blist_menu[] = -{ -/* NOTE: Do not set any accelerator to Control+O. It is mapped by - gtk_blist_key_press_cb to "Get User Info" on the selected buddy. */ - - /* Buddies menu */ - { N_("/_Buddies"), NULL, NULL, 0, "", NULL }, - { N_("/Buddies/New Instant _Message..."), "M", pidgin_dialogs_im, 0, "", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, - { N_("/Buddies/Join a _Chat..."), "C", pidgin_blist_joinchat_show, 0, "", PIDGIN_STOCK_CHAT }, - { N_("/Buddies/Get User _Info..."), "I", pidgin_dialogs_info, 0, "", PIDGIN_STOCK_TOOLBAR_USER_INFO }, - { N_("/Buddies/View User _Log..."), "L", pidgin_dialogs_log, 0, "", NULL }, - { "/Buddies/sep1", NULL, NULL, 0, "", NULL }, - { N_("/Buddies/Sh_ow"), NULL, NULL, 0, "", NULL}, - { N_("/Buddies/Show/_Offline Buddies"), NULL, pidgin_blist_edit_mode_cb, 1, "", NULL }, - { N_("/Buddies/Show/_Empty Groups"), NULL, pidgin_blist_show_empty_groups_cb, 1, "", NULL }, - { N_("/Buddies/Show/Buddy _Details"), NULL, pidgin_blist_buddy_details_cb, 1, "", NULL }, - { N_("/Buddies/Show/Idle _Times"), NULL, pidgin_blist_show_idle_time_cb, 1, "", NULL }, - { N_("/Buddies/Show/_Protocol Icons"), NULL, pidgin_blist_show_protocol_icons_cb, 1, "", NULL }, - { N_("/Buddies/_Sort Buddies"), NULL, NULL, 0, "", NULL }, - { "/Buddies/sep2", NULL, NULL, 0, "", NULL }, - { N_("/Buddies/_Add Buddy..."), "B", pidgin_blist_add_buddy_cb, 0, "", GTK_STOCK_ADD }, - { N_("/Buddies/Add C_hat..."), NULL, pidgin_blist_add_chat_cb, 0, "", GTK_STOCK_ADD }, - { N_("/Buddies/Add _Group..."), NULL, purple_blist_request_add_group, 0, "", GTK_STOCK_ADD }, - { "/Buddies/sep3", NULL, NULL, 0, "", NULL }, - { N_("/Buddies/_Quit"), "Q", purple_core_quit, 0, "", GTK_STOCK_QUIT }, - - /* Accounts menu */ - { N_("/_Accounts"), NULL, NULL, 0, "", NULL }, - { N_("/Accounts/Manage Accounts"), "A", pidgin_accounts_window_show, 0, "", NULL }, - - /* Tools */ - { N_("/_Tools"), NULL, NULL, 0, "", NULL }, - { N_("/Tools/Buddy _Pounces"), NULL, pidgin_pounces_manager_show, 1, "", NULL }, - { N_("/Tools/_Certificates"), NULL, pidgin_certmgr_show, 0, "", NULL }, - { N_("/Tools/Custom Smile_ys"), "Y", pidgin_smiley_manager_show, 0, "", PIDGIN_STOCK_TOOLBAR_SMILEY }, - { N_("/Tools/Plu_gins"), "U", pidgin_plugin_dialog_show, 2, "", PIDGIN_STOCK_TOOLBAR_PLUGINS }, - { N_("/Tools/Pr_eferences"), "P", pidgin_prefs_show, 0, "", GTK_STOCK_PREFERENCES }, - { N_("/Tools/Pr_ivacy"), NULL, pidgin_privacy_dialog_show, 0, "", NULL }, - { N_("/Tools/Set _Mood"), "D", set_mood_show, 0, "", NULL }, - { "/Tools/sep2", NULL, NULL, 0, "", NULL }, - { N_("/Tools/_File Transfers"), "T", pidgin_xfer_dialog_show, 0, "", PIDGIN_STOCK_TOOLBAR_TRANSFER }, - { N_("/Tools/R_oom List"), NULL, pidgin_roomlist_dialog_show, 0, "", NULL }, - { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 3, "", NULL }, - { "/Tools/sep3", NULL, NULL, 0, "", NULL }, - { N_("/Tools/Mute _Sounds"), NULL, pidgin_blist_mute_sounds_cb, 0, "", NULL }, - /* Help */ - { N_("/_Help"), NULL, NULL, 0, "", NULL }, - { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "", GTK_STOCK_HELP }, - { "/Help/sep1", NULL, NULL, 0, "", NULL }, - { N_("/Help/_Build Information"), NULL, pidgin_dialogs_buildinfo, 0, "", NULL }, - { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "", NULL }, - { N_("/Help/De_veloper Information"), NULL, pidgin_dialogs_developers, 0, "", NULL }, - { N_("/Help/_Plugin Information"), NULL, pidgin_dialogs_plugins_info, 0, "", NULL }, - { N_("/Help/_Translator Information"), NULL, pidgin_dialogs_translators, 0, "", NULL }, - { "/Help/sep2", NULL, NULL, 0, "", NULL }, - { N_("/Help/_About"), NULL, pidgin_dialogs_about, 4, "", GTK_STOCK_ABOUT }, -}; -#endif - /********************************************************* * Private Utility functions * *********************************************************/ @@ -3812,16 +3758,16 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) struct proto_chat_entry *pce; char *name, *value; PurpleConversation *conv; - PidginBlistNode *bnode = node->ui_data; + PidginBlistNode *bnode = purple_blist_node_get_ui_data(node); chat = (PurpleChat *)node; - prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_chat_get_account(chat))); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); connections = purple_connections_get_all(); if (connections && connections->next) { - tmp = g_markup_escape_text(chat->account->username, -1); + tmp = g_markup_escape_text(purple_account_get_username(purple_chat_get_account(chat)), -1); g_string_append_printf(str, _("Account: %s"), tmp); g_free(tmp); } @@ -3831,12 +3777,12 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) } else { char *chat_name; if (prpl_info && prpl_info->get_chat_name) - chat_name = prpl_info->get_chat_name(chat->components); + chat_name = prpl_info->get_chat_name(purple_chat_get_components(chat)); else chat_name = g_strdup(purple_chat_get_name(chat)); conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chat_name, - chat->account); + purple_chat_get_account(chat)); g_free(chat_name); } @@ -3853,7 +3799,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) } if (prpl_info && prpl_info->chat_info != NULL) - cur = prpl_info->chat_info(chat->account->gc); + cur = prpl_info->chat_info(purple_account_get_connection(purple_chat_get_account(chat))); else cur = NULL; @@ -3862,13 +3808,13 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) pce = cur->data; if (!pce->secret && (!pce->required && - g_hash_table_lookup(chat->components, pce->identifier) == NULL)) + g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier) == NULL)) { tmp = purple_text_strip_mnemonic(pce->label); name = g_markup_escape_text(tmp, -1); g_free(tmp); value = g_markup_escape_text(g_hash_table_lookup( - chat->components, pce->identifier), -1); + purple_chat_get_components(chat), pce->identifier), -1); g_string_append_printf(str, "\n%s %s", name ? name : "", value ? value : ""); @@ -3904,7 +3850,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) c = purple_buddy_get_contact(b); } - prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b))); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); presence = purple_buddy_get_presence(b); @@ -3921,12 +3867,12 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) /* Alias */ /* If there's not a contact alias, the node is being displayed with * this alias, so there's no point in showing it in the tooltip. */ - if (full && c && b->alias != NULL && b->alias[0] != '\0' && + if (full && c && purple_buddy_get_local_buddy_alias(b) != NULL && purple_buddy_get_local_buddy_alias(b)[0] != '\0' && (c->alias != NULL && c->alias[0] != '\0') && - strcmp(c->alias, b->alias) != 0) + strcmp(c->alias, purple_buddy_get_local_buddy_alias(b)) != 0) { purple_notify_user_info_add_pair_plaintext(user_info, - _("Buddy Alias"), b->alias); + _("Buddy Alias"), purple_buddy_get_local_buddy_alias(b)); } /* Nickname/Server Alias */ @@ -3934,10 +3880,10 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) * alias, but many people on MSN set long nicknames, which * get ellipsized, so the only way to see the whole thing is * to look at the tooltip. */ - if (full && b->server_alias != NULL && b->server_alias[0] != '\0') + if (full && purple_buddy_get_server_alias(b)) { purple_notify_user_info_add_pair_plaintext(user_info, - _("Nickname"), b->server_alias); + _("Nickname"), purple_buddy_get_server_alias(b)); } /* Logged In */ @@ -3972,7 +3918,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) /* Last Seen */ if (full && c && !PURPLE_BUDDY_IS_ONLINE(b)) { - struct _pidgin_blist_node *gtknode = ((PurpleBlistNode *)c)->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(c)); PurpleBlistNode *bnode; int lastseen = 0; @@ -4012,7 +3958,7 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Offline")); } - if (purple_account_is_connected(b->account) && + if (purple_account_is_connected(purple_buddy_get_account(b)) && prpl_info && prpl_info->tooltip_text) { /* Additional text from the PRPL */ @@ -4020,11 +3966,11 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) } /* These are Easter Eggs. Patches to remove them will be rejected. */ - if (!g_ascii_strcasecmp(b->name, "robflynn")) + if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "robflynn")) purple_notify_user_info_add_pair_plaintext(user_info, _("Description"), _("Spooky")); - if (!g_ascii_strcasecmp(b->name, "seanegn")) + if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "seanegn")) purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Awesome")); - if (!g_ascii_strcasecmp(b->name, "chipx86")) + if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "chipx86")) purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Rockin'")); tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n"); @@ -4101,7 +4047,7 @@ GdkPixbuf * pidgin_blist_get_emblem(PurpleBlistNode *node) { PurpleBuddy *buddy = NULL; - struct _pidgin_blist_node *gtknode = node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); PurplePlugin *prpl; PurplePluginProtocolInfo *prpl_info; const char *name = NULL; @@ -4124,10 +4070,10 @@ pidgin_blist_get_emblem(PurpleBlistNode *node) return _pidgin_blist_get_cached_emblem(path); } - if (((struct _pidgin_blist_node*)(node->parent->ui_data))->contact_expanded) { + if (((struct _pidgin_blist_node*)purple_blist_node_get_ui_data(node->parent))->contact_expanded) { if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) return NULL; - return pidgin_create_prpl_icon(((PurpleBuddy*)node)->account, PIDGIN_PRPL_ICON_SMALL); + return pidgin_create_prpl_icon(purple_buddy_get_account((PurpleBuddy*)node), PIDGIN_PRPL_ICON_SMALL); } } else { return NULL; @@ -4135,7 +4081,7 @@ pidgin_blist_get_emblem(PurpleBlistNode *node) g_return_val_if_fail(buddy != NULL, NULL); - if (!purple_privacy_check(buddy->account, purple_buddy_get_name(buddy))) { + if (!purple_privacy_check(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy))) { path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "blocked.png", NULL); return _pidgin_blist_get_cached_emblem(path); } @@ -4171,7 +4117,7 @@ pidgin_blist_get_emblem(PurpleBlistNode *node) return _pidgin_blist_get_cached_emblem(path); } - prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(buddy))); if (!prpl) return NULL; @@ -4208,7 +4154,7 @@ pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) { GdkPixbuf *ret; const char *icon = NULL; - struct _pidgin_blist_node *gtknode = node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); struct _pidgin_blist_node *gtkbuddynode = NULL; PurpleBuddy *buddy = NULL; PurpleChat *chat = NULL; @@ -4219,11 +4165,11 @@ pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) if(!gtknode->contact_expanded) { buddy = purple_contact_get_priority_buddy((PurpleContact*)node); if (buddy != NULL) - gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data; + gtkbuddynode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); } } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { buddy = (PurpleBuddy*)node; - gtkbuddynode = node->ui_data; + gtkbuddynode = purple_blist_node_get_ui_data(node); } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) { chat = (PurpleChat*)node; } else { @@ -4235,9 +4181,9 @@ pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) PurplePlugin *prpl; if(buddy) - account = buddy->account; + account = purple_buddy_get_account(buddy); else - account = chat->account; + account = purple_chat_get_account(chat); prpl = purple_find_prpl(purple_account_get_protocol_id(account)); if(!prpl) @@ -4252,7 +4198,7 @@ pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) if(conv != NULL) { PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); if (gtkconv == NULL && size == PIDGIN_STATUS_ICON_SMALL) { - PidginBlistNode *ui = buddy->node.ui_data; + PidginBlistNode *ui = purple_blist_node_get_ui_data(&(buddy->node)); if (ui == NULL || (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE)) return gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), PIDGIN_STOCK_STATUS_MESSAGE, icon_size, "GtkTreeView"); @@ -4336,7 +4282,7 @@ pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased PidginBlistTheme *theme; if (conv != NULL) { - PidginBlistNode *ui = b->node.ui_data; + PidginBlistNode *ui = purple_blist_node_get_ui_data(&(b->node)); if (ui) { if (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE) hidden_conv = TRUE; @@ -4370,12 +4316,12 @@ pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased if (!aliased || biglist) { /* Status Info */ - prpl = purple_find_prpl(purple_account_get_protocol_id(b->account)); + prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b))); if (prpl != NULL) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info && prpl_info->status_text && b->account->gc) { + if (prpl_info && prpl_info->status_text && purple_account_get_connection(purple_buddy_get_account(b))) { char *tmp = prpl_info->status_text(b); const char *end; @@ -4570,7 +4516,7 @@ static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list) if (buddy && purple_presence_is_idle(purple_buddy_get_presence(buddy))) - pidgin_blist_update_contact(list, (PurpleBlistNode*)buddy); + pidgin_blist_update_contact(list, PURPLE_BLIST_NODE(buddy)); } } } @@ -4581,7 +4527,7 @@ static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list) static void pidgin_blist_hide_node(PurpleBuddyList *list, PurpleBlistNode *node, gboolean update) { - struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkTreeIter iter; if (!gtknode || !gtknode->row || !gtkblist) @@ -4739,6 +4685,7 @@ static void conversation_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type, PidginBuddyList *gtkblist) { + PurpleAccount *account = purple_conversation_get_account(conv); GList *convs = NULL; GList *ims, *chats; GList *l = NULL; @@ -4746,10 +4693,10 @@ conversation_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type, if (type != PURPLE_CONV_UPDATE_UNSEEN) return; - if(conv->account != NULL && conv->name != NULL) { - PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + if(account != NULL && purple_conversation_get_name(conv) != NULL) { + PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); if(buddy != NULL) - pidgin_blist_update_buddy(NULL, (PurpleBlistNode *)buddy, TRUE); + pidgin_blist_update_buddy(NULL, PURPLE_BLIST_NODE(buddy), TRUE); } if (gtkblist->menutrayicon) { @@ -4829,7 +4776,7 @@ static void written_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *message, PurpleConversation *conv, PurpleMessageFlags flag, PurpleBlistNode *node) { - PidginBlistNode *ui = node->ui_data; + PidginBlistNode *ui = purple_blist_node_get_ui_data(node); if (ui->conv.conv != conv || !pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) || !(flag & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))) return; @@ -4845,7 +4792,7 @@ written_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *me static void displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node) { - PidginBlistNode *ui = node->ui_data; + PidginBlistNode *ui = purple_blist_node_get_ui_data(node); if (ui->conv.conv != gtkconv->active_conv) return; ui->conv.flags &= ~(PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE | @@ -4856,13 +4803,15 @@ displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node) static void conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) { - switch (conv->type) { + PurpleAccount *account = purple_conversation_get_account(conv); + + switch (purple_conversation_get_type(conv)) { case PURPLE_CONV_TYPE_IM: { - GSList *buddies = purple_find_buddies(conv->account, conv->name); + GSList *buddies = purple_find_buddies(account, purple_conversation_get_name(conv)); while (buddies) { PurpleBlistNode *buddy = buddies->data; - struct _pidgin_blist_node *ui = buddy->ui_data; + struct _pidgin_blist_node *ui = purple_blist_node_get_ui_data(buddy); buddies = g_slist_delete_link(buddies, buddies); if (!ui) continue; @@ -4880,11 +4829,11 @@ conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) break; case PURPLE_CONV_TYPE_CHAT: { - PurpleChat *chat = purple_blist_find_chat(conv->account, conv->name); + PurpleChat *chat = purple_blist_find_chat(account, purple_conversation_get_name(conv)); struct _pidgin_blist_node *ui; if (!chat) break; - ui = chat->node.ui_data; + ui = purple_blist_node_get_ui_data(&(chat->node)); if (!ui) break; ui->conv.conv = conv; @@ -4912,8 +4861,6 @@ static void pidgin_blist_new_list(PurpleBuddyList *blist) PidginBuddyList *gtkblist; gtkblist = g_new0(PidginBuddyList, 1); - gtkblist->connection_errors = g_hash_table_new_full(g_direct_hash, - g_direct_equal, NULL, g_free); gtkblist->priv = g_new0(PidginBuddyListPrivate, 1); blist->ui_data = gtkblist; @@ -4921,7 +4868,7 @@ static void pidgin_blist_new_list(PurpleBuddyList *blist) static void pidgin_blist_new_node(PurpleBlistNode *node) { - node->ui_data = g_new0(struct _pidgin_blist_node, 1); + purple_blist_node_set_ui_data(node, g_new0(struct _pidgin_blist_node, 1)); } gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node) @@ -4934,7 +4881,7 @@ gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node) g_return_val_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node), FALSE); - return ((struct _pidgin_blist_node *)node->ui_data)->contact_expanded; + return ((struct _pidgin_blist_node *)purple_blist_node_get_ui_data(node))->contact_expanded; } enum { @@ -4984,7 +4931,7 @@ static void _prefs_change_redo_list(const char *name, PurplePrefType type, struct _pidgin_blist_node *gtknode; GtkTreePath *path; - gtknode = node->ui_data; + gtknode = purple_blist_node_get_ui_data(node); if (gtknode && gtknode->row) { path = gtk_tree_row_reference_get_path(gtknode->row); @@ -5068,7 +5015,7 @@ gtk_blist_window_key_press_cb(GtkWidget *w, GdkEventKey *event, PidginBuddyList widget = gtk_window_get_focus(GTK_WINDOW(gtkblist->window)); if (GTK_IS_IMHTML(widget) || GTK_IS_ENTRY(widget)) { - if (gtk_bindings_activate(G_OBJECT(widget), event->keyval, event->state)) + if (gtk_bindings_activate(GTK_OBJECT(widget), event->keyval, event->state)) return TRUE; } return FALSE; @@ -5077,14 +5024,14 @@ gtk_blist_window_key_press_cb(GtkWidget *w, GdkEventKey *event, PidginBuddyList static gboolean headline_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginBuddyList *gtkblist) { - gdk_window_set_cursor(gtk_widget_get_window(widget), gtkblist->hand_cursor); + gdk_window_set_cursor(widget->window, gtkblist->hand_cursor); return FALSE; } static gboolean headline_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginBuddyList *gtkblist) { - gdk_window_set_cursor(gtk_widget_get_window(widget), gtkblist->arrow_cursor); + gdk_window_set_cursor(widget->window, gtkblist->arrow_cursor); return FALSE; } @@ -5218,10 +5165,9 @@ generic_error_enable_cb(PurpleAccount *account) } static void -generic_error_destroy_cb(GtkWidget *dialog, +generic_error_destroy_cb(GtkObject *dialog, PurpleAccount *account) { - g_hash_table_remove(gtkblist->connection_errors, account); /* If the error dialog is being destroyed in response to the * account-error-changed signal, we don't want to clear the current * error. @@ -5479,28 +5425,6 @@ update_signed_on_elsewhere_tooltip(PurpleAccount *account, } -/** - * Was used by the connection API to tell the blist if an account has a - * connection error or no longer has a connection error, but the blist now does - * this itself with the @ref account-error-changed signal. - * - * @param account The account that either has a connection error - * or no longer has a connection error. - * @param message The connection error message, or NULL if this - * account is no longer in an error state. - */ -static void -pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text) -{ - /* connection_errors isn't actually used anywhere; it's just kept in - * sync with reality in case a plugin uses it. - */ - if (text == NULL) - g_hash_table_remove(gtkblist->connection_errors, account); - else - g_hash_table_insert(gtkblist->connection_errors, account, g_strdup(text)); -} - /* Call appropriate error notification code based on error types */ static void update_account_error_state(PurpleAccount *account, @@ -5514,12 +5438,6 @@ update_account_error_state(PurpleAccount *account, if (old == NULL && new == NULL) return; - /* For backwards compatibility: */ - if (new) - pidgin_blist_update_account_error_state(account, new->description); - else - pidgin_blist_update_account_error_state(account, NULL); - if (new != NULL) pidgin_blist_select_notebook_page(gtkblist); @@ -5590,22 +5508,17 @@ paint_headline_hbox (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { - cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget)); - GtkAllocation allocation; - - gtk_widget_get_allocation(widget, &allocation); - gtk_paint_flat_box (gtk_widget_get_style(widget), - cr, - GTK_STATE_NORMAL, - GTK_SHADOW_OUT, - widget, - "tooltip", - allocation.x + 1, - allocation.y + 1, - allocation.width - 2, - allocation.height - 2); - cairo_destroy(cr); - + gtk_paint_flat_box (widget->style, + widget->window, + GTK_STATE_NORMAL, + GTK_SHADOW_OUT, + NULL, + widget, + "tooltip", + widget->allocation.x + 1, + widget->allocation.y + 1, + widget->allocation.width - 2, + widget->allocation.height - 2); return FALSE; } @@ -5944,9 +5857,7 @@ static void pidgin_blist_show(PurpleBuddyList *list) G_CALLBACK(blist_focus_cb), gtkblist); g_signal_connect(G_OBJECT(gtkblist->window), "focus-out-event", G_CALLBACK(blist_focus_cb), gtkblist); - - /* TODO: how is this done in gtk+ 3.0? */ - /*GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE;*/ + GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE; gtkblist->main_vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(gtkblist->main_vbox); @@ -6015,6 +5926,7 @@ static void pidgin_blist_show(PurpleBuddyList *list) pretty = pidgin_make_pretty_arrows(tmp); g_free(tmp); label = gtk_label_new(NULL); + gtk_widget_set_size_request(label, purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width") - 12, -1); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.2); gtk_label_set_markup(GTK_LABEL(label), pretty); @@ -6031,8 +5943,10 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtk_container_set_border_width(GTK_CONTAINER(gtkblist->headline_hbox), 6); gtk_container_add(GTK_CONTAINER(ebox), gtkblist->headline_hbox); gtkblist->headline_image = gtk_image_new_from_pixbuf(NULL); - gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.5, 0.5); + gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.0, 0); gtkblist->headline_label = gtk_label_new(NULL); + gtk_widget_set_size_request(gtkblist->headline_label, + purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width")-25,-1); gtk_label_set_line_wrap(GTK_LABEL(gtkblist->headline_label), TRUE); gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_image, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_label, TRUE, TRUE, 0); @@ -6042,7 +5956,7 @@ static void pidgin_blist_show(PurpleBuddyList *list) G_CALLBACK(headline_style_set), NULL); g_signal_connect (gtkblist->headline_hbox, - "draw", + "expose_event", G_CALLBACK (paint_headline_hbox), NULL); gtk_widget_set_name(gtkblist->headline_hbox, "gtk-tooltips"); @@ -6339,7 +6253,7 @@ pidgin_blist_update_refresh_timeout() } static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter) { - struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkTreePath *path; if (!gtknode) { @@ -6368,7 +6282,7 @@ static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter) { static void pidgin_blist_remove(PurpleBuddyList *list, PurpleBlistNode *node) { - struct _pidgin_blist_node *gtknode = node->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); purple_request_close_with_handle(node); @@ -6390,9 +6304,9 @@ static void pidgin_blist_remove(PurpleBuddyList *list, PurpleBlistNode *node) if(gtknode->recent_signonoff_timer > 0) purple_timeout_remove(gtknode->recent_signonoff_timer); - purple_signals_disconnect_by_handle(node->ui_data); - g_free(node->ui_data); - node->ui_data = NULL; + purple_signals_disconnect_by_handle(gtknode); + g_free(gtknode); + purple_blist_node_set_ui_data(node, NULL); } } @@ -6436,8 +6350,8 @@ static void pidgin_blist_selection_changed(GtkTreeSelection *selection, gpointer static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTreeIter *iter) { - GtkTreeIter parent_iter, cur, *curptr = NULL; - struct _pidgin_blist_node *gtknode = node->ui_data; + GtkTreeIter parent_iter = {0, NULL, NULL, NULL}, cur, *curptr = NULL; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(node); GtkTreePath *newpath; if(!iter) @@ -6459,7 +6373,7 @@ static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTre gtk_tree_row_reference_free(gtknode->row); } else { pidgin_blist_new_node(node); - gtknode = (struct _pidgin_blist_node *)node->ui_data; + gtknode = purple_blist_node_get_ui_data(node); } newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), @@ -6477,7 +6391,7 @@ static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTre if(node->parent) { GtkTreePath *expand = NULL; - struct _pidgin_blist_node *gtkparentnode = node->parent->ui_data; + struct _pidgin_blist_node *gtkparentnode = purple_blist_node_get_ui_data(node->parent); if(PURPLE_BLIST_NODE_IS_GROUP(node->parent)) { if(!purple_blist_node_get_bool(node->parent, "collapsed")) @@ -6499,12 +6413,12 @@ static gboolean pidgin_blist_group_has_show_offline_buddy(PurpleGroup *group) { PurpleBlistNode *gnode, *cnode, *bnode; - gnode = (PurpleBlistNode *)group; + gnode = PURPLE_BLIST_NODE(group); for(cnode = gnode->child; cnode; cnode = cnode->next) { if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { for(bnode = cnode->child; bnode; bnode = bnode->next) { PurpleBuddy *buddy = (PurpleBuddy *)bnode; - if (purple_account_is_connected(buddy->account) && + if (purple_account_is_connected(purple_buddy_get_account(buddy)) && purple_blist_node_get_bool(bnode, "show_offline")) return TRUE; } @@ -6644,7 +6558,7 @@ static char *pidgin_get_group_title(PurpleBlistNode *gnode, gboolean expanded) text_color = selected ? NULL : theme_font_get_color_default(pair, NULL); text_font = theme_font_get_face_default(pair, ""); - esc = g_markup_escape_text(group->name, -1); + esc = g_markup_escape_text(purple_group_get_name(group), -1); if (text_color) { mark = g_strdup_printf("%s%s%s%s", text_color, text_font, @@ -6671,7 +6585,7 @@ static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *n GdkColor *color = NULL; char *mark; char *idle = NULL; - gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded; + gboolean expanded = ((struct _pidgin_blist_node *)purple_blist_node_get_ui_data(node->parent))->contact_expanded; gboolean selected = (gtkblist->selected_node == node); gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); PidginBlistTheme *theme; @@ -6679,12 +6593,12 @@ static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *n if (editing_blist) return; - status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy, + status = pidgin_blist_get_status_icon(PURPLE_BLIST_NODE(buddy), biglist ? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL); /* Speed it up if we don't want buddy icons. */ if(biglist) - avatar = pidgin_blist_get_buddy_icon((PurpleBlistNode *)buddy, TRUE, TRUE); + avatar = pidgin_blist_get_buddy_icon(PURPLE_BLIST_NODE(buddy), TRUE, TRUE); else avatar = NULL; @@ -6695,7 +6609,7 @@ static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *n do_alphashift(avatar, 77); } - emblem = pidgin_blist_get_emblem((PurpleBlistNode*) buddy); + emblem = pidgin_blist_get_emblem(PURPLE_BLIST_NODE(buddy)); mark = pidgin_blist_get_name_markup(buddy, selected, TRUE); theme = pidgin_blist_get_theme(); @@ -6736,7 +6650,7 @@ static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *n } } - prpl_icon = pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL); + prpl_icon = pidgin_create_prpl_icon(purple_buddy_get_account(buddy), PIDGIN_PRPL_ICON_SMALL); if (theme != NULL) color = pidgin_blist_theme_get_contact_color(theme); @@ -6807,7 +6721,7 @@ static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode * if(!insert_node(list, cnode, &iter)) return; - gtknode = (struct _pidgin_blist_node *)cnode->ui_data; + gtknode = purple_blist_node_get_ui_data(cnode); if(gtknode->contact_expanded) { GdkPixbuf *status; @@ -6884,7 +6798,7 @@ static void pidgin_blist_update_buddy(PurpleBuddyList *list, PurpleBlistNode *no /* First things first, update the contact */ pidgin_blist_update_contact(list, node); - gtkparentnode = (struct _pidgin_blist_node *)node->parent->ui_data; + gtkparentnode = purple_blist_node_get_ui_data(node->parent); if (gtkparentnode->contact_expanded && buddy_is_displayable(buddy)) { @@ -6915,7 +6829,7 @@ static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *nod chat = (PurpleChat*)node; - if(purple_account_is_connected(chat->account)) { + if(purple_account_is_connected(purple_chat_get_account(chat))) { GtkTreeIter iter; GdkPixbuf *status, *avatar, *emblem, *prpl_icon; const gchar *color, *font; @@ -6934,7 +6848,7 @@ static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *nod if (!insert_node(list, node, &iter)) return; - ui = node->ui_data; + ui = purple_blist_node_get_ui_data(node); conv = ui->conv.conv; if (conv && pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) { hidden = (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE); @@ -6979,7 +6893,7 @@ static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *nod g_free(mark); mark = tmp; - prpl_icon = pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL); + prpl_icon = pidgin_create_prpl_icon(purple_chat_get_account(chat), PIDGIN_PRPL_ICON_SMALL); if (theme != NULL) bgcolor = pidgin_blist_theme_get_contact_color(theme); @@ -7020,10 +6934,10 @@ static void pidgin_blist_update(PurpleBuddyList *list, PurpleBlistNode *node) if(!gtkblist || !gtkblist->treeview || !node) return; - if (node->ui_data == NULL) + if (purple_blist_node_get_ui_data(node) == NULL) pidgin_blist_new_node(node); - switch(node->type) { + switch (purple_blist_node_get_type(node)) { case PURPLE_BLIST_GROUP_NODE: pidgin_blist_update_group(list, node); break; @@ -7067,7 +6981,6 @@ static void pidgin_blist_destroy(PurpleBuddyList *list) if (gtkblist->drag_timeout) g_source_remove(gtkblist->drag_timeout); - g_hash_table_destroy(gtkblist->connection_errors); gtkblist->refresh_timer = 0; gtkblist->timeout = 0; gtkblist->drag_timeout = 0; @@ -7098,8 +7011,7 @@ static void pidgin_blist_set_visible(PurpleBuddyList *list, gboolean show) return; if (show) { - if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && - !gtk_widget_get_visible(gtkblist->window)) + if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && !gtk_widget_get_visible(gtkblist->window)) purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-unhiding", gtkblist); pidgin_blist_restore_position(); gtk_window_present(GTK_WINDOW(gtkblist->window)); @@ -7119,7 +7031,6 @@ static GList * groups_tree(void) { static GList *list = NULL; - char *tmp2; PurpleGroup *g; PurpleBlistNode *gnode; @@ -7139,8 +7050,7 @@ groups_tree(void) if (PURPLE_BLIST_NODE_IS_GROUP(gnode)) { g = (PurpleGroup *)gnode; - tmp2 = g->name; - list = g_list_append(list, tmp2); + list = g_list_append(list, (char *) purple_group_get_name(g)); } } } @@ -7223,11 +7133,11 @@ add_buddy_cb(GtkWidget *w, int resp, PidginAddBuddyData *data) purple_blist_add_buddy(b, NULL, g, NULL); } - purple_account_add_buddy_with_invite(account, b, invite); + purple_account_add_buddy(account, b, invite); /* Offer to merge people with the same alias. */ if (whoalias != NULL && g != NULL) - gtk_blist_auto_personize((PurpleBlistNode *)g, whoalias); + gtk_blist_auto_personize(PURPLE_BLIST_NODE(g), whoalias); /* * XXX @@ -7375,10 +7285,10 @@ add_chat_cb(GtkWidget *w, PidginAddChatData *data) purple_blist_add_chat(chat, group, NULL); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->autojoin))) - purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin", TRUE); + purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-autojoin", TRUE); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->persistent))) - purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-persistent", TRUE); + purple_blist_node_set_bool(PURPLE_BLIST_NODE(chat), "gtk-persistent", TRUE); } gtk_widget_destroy(data->chat_data.rq_data.window); @@ -7415,11 +7325,13 @@ pidgin_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, GList *l; PurpleConnection *gc; GtkBox *vbox; + PurplePluginProtocolInfo *prpl_info = NULL; if (account != NULL) { gc = purple_account_get_connection(account); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) { + if (prpl_info->join_chat == NULL) { purple_notify_error(gc, NULL, _("This protocol does not support chat rooms."), NULL); return; } @@ -7427,8 +7339,9 @@ pidgin_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, /* Find an account with chat capabilities */ for (l = purple_connections_get_all(); l != NULL; l = l->next) { gc = (PurpleConnection *)l->data; + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) { + if (prpl_info->join_chat != NULL) { account = purple_connection_get_account(gc); break; } @@ -7472,7 +7385,7 @@ pidgin_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, if (name != NULL) gtk_widget_grab_focus(data->alias_entry); - data->group_combo = pidgin_text_combo_box_entry_new(group ? group->name : NULL, groups_tree()); + data->group_combo = pidgin_text_combo_box_entry_new(group ? purple_group_get_name(group) : NULL, groups_tree()); pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Group:"), data->chat_data.rq_data.sg, data->group_combo, TRUE, NULL); @@ -7578,7 +7491,7 @@ pidgin_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback callbac static void set_urgent(void) { - if (gtkblist->window && !gtk_widget_is_focus(gtkblist->window)) + if (gtkblist->window && !gtk_widget_has_focus(gtkblist->window)) pidgin_set_urgent(GTK_WINDOW(gtkblist->window), TRUE); } @@ -7629,11 +7542,11 @@ static gboolean autojoin_cb(PurpleConnection *gc, gpointer data) chat = (PurpleChat *)cnode; - if(chat->account != account) + if(purple_chat_get_account(chat) != account) continue; - if (purple_blist_node_get_bool((PurpleBlistNode*)chat, "gtk-autojoin")) - serv_join_chat(gc, chat->components); + if (purple_blist_node_get_bool(PURPLE_BLIST_NODE(chat), "gtk-autojoin")) + serv_join_chat(gc, purple_chat_get_components(chat)); } } @@ -7650,25 +7563,25 @@ pidgin_blist_get_handle() { static gboolean buddy_signonoff_timeout_cb(PurpleBuddy *buddy) { - struct _pidgin_blist_node *gtknode = ((PurpleBlistNode*)buddy)->ui_data; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); gtknode->recent_signonoff = FALSE; gtknode->recent_signonoff_timer = 0; - pidgin_blist_update(NULL, (PurpleBlistNode*)buddy); + pidgin_blist_update(NULL, PURPLE_BLIST_NODE(buddy)); return FALSE; } static void buddy_signonoff_cb(PurpleBuddy *buddy) { - struct _pidgin_blist_node *gtknode; + struct _pidgin_blist_node *gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); - if(!((PurpleBlistNode*)buddy)->ui_data) { - pidgin_blist_new_node((PurpleBlistNode*)buddy); + if(!gtknode) { + pidgin_blist_new_node(PURPLE_BLIST_NODE(buddy)); } - gtknode = ((PurpleBlistNode*)buddy)->ui_data; + gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy)); gtknode->recent_signonoff = TRUE; @@ -8035,7 +7948,7 @@ static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *bli PurpleBuddy *buddy; for (n = node->child; n; n = n->next) { buddy = (PurpleBuddy*)n; - activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account); + activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); } buddy_name = purple_contact_get_alias((PurpleContact*)node); } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) { @@ -8070,8 +7983,8 @@ static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *bli if(PURPLE_BLIST_NODE_IS_CONTACT(n)) { for (n2 = n->child; n2; n2 = n2->next) { - buddy = (PurpleBuddy*)n2; - this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account); + buddy = (PurpleBuddy*)n2; + this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); } this_buddy_name = purple_contact_get_alias((PurpleContact*)n); } else { @@ -8106,7 +8019,7 @@ static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *bli } static void -plugin_act(GtkWidget *obj, PurplePluginAction *pam) +plugin_act(GtkObject *obj, PurplePluginAction *pam) { if (pam && pam->callback) pam->callback(pam); @@ -8247,7 +8160,7 @@ pidgin_blist_update_accounts_menu(void) g_string_append(accounts_ui, ""); gc = purple_account_get_connection(account); - plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; + plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? purple_connection_get_prpl(gc) : NULL; if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { build_plugin_actions(accounts_action_group, accounts_ui, base, plugin, gc); } else { @@ -8424,3 +8337,4 @@ pidgin_blist_update_sort_methods(void) g_string_free(ui_string, TRUE); } + diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index f86e1a9d41..ff0a023df9 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -86,15 +86,6 @@ struct _PidginBuddyList { GtkWidget *menutray; /**< The menu tray widget. */ GtkWidget *menutrayicon; /**< The menu tray icon. */ - /** Caches connection error messages; keys are #PurpleAccount and - * values are non-@c NULL const char *s containing localised - * error messages. (If an account does not have an error, it will not - * appear in the table.) - * @deprecated in favour of purple_account_get_current_error(), which also - * gives you the #PurpleConnectionError value. - */ - GHashTable *connection_errors; - guint refresh_timer; /**< The timer for refreshing every 30 seconds */ guint timeout; /**< The timeout for the tooltip. */ @@ -259,8 +250,6 @@ void pidgin_blist_add_alert(GtkWidget *widget); * Sets the current theme for Pidgin to use * * @param theme the new theme to use - * - * @since 2.6.0 */ void pidgin_blist_set_theme(PidginBlistTheme *theme); @@ -268,8 +257,6 @@ void pidgin_blist_set_theme(PidginBlistTheme *theme); * Gets Pidgin's current buddy list theme * * @returns the current theme - * - * @since 2.6.0 */ PidginBlistTheme *pidgin_blist_get_theme(void); @@ -391,8 +378,6 @@ void pidgin_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback ca * @param selected Whether this buddy is selected. If TRUE, the markup will not change the color. * @param aliased TRUE to return the appropriate alias of this buddy, FALSE to return its username and status information * @return The markup for this buddy - * - * @since 2.1.0 */ gchar *pidgin_blist_get_name_markup(PurpleBuddy *buddy, gboolean selected, gboolean aliased); @@ -404,15 +389,11 @@ gchar *pidgin_blist_get_name_markup(PurpleBuddy *buddy, gboolean selected, gbool * * @param node The buddy list node to show a tooltip for * @param widget The widget to draw the tooltip on - * - * @since 2.1.0 */ void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget); /** * Destroys the current (if any) Buddy List tooltip - * - * @since 2.1.0 */ void pidgin_blist_tooltip_destroy(void); diff --git a/pidgin/gtkcellrendererexpander.c b/pidgin/gtkcellrendererexpander.c index 4d96a0ac65..10d899e977 100644 --- a/pidgin/gtkcellrendererexpander.c +++ b/pidgin/gtkcellrendererexpander.c @@ -44,23 +44,24 @@ static void pidgin_cell_renderer_expander_init (PidginCellRendererExpander static void pidgin_cell_renderer_expander_class_init (PidginCellRendererExpanderClass *class); static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell, GtkWidget *widget, - const GdkRectangle *cell_area, + GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height); static void pidgin_cell_renderer_expander_render (GtkCellRenderer *cell, - cairo_t *cr, + GdkWindow *window, GtkWidget *widget, - const GdkRectangle *background_area, - const GdkRectangle *cell_area, - GtkCellRendererState flags); + GdkRectangle *background_area, + GdkRectangle *cell_area, + GdkRectangle *expose_area, + guint flags); static gboolean pidgin_cell_renderer_expander_activate (GtkCellRenderer *r, GdkEvent *event, GtkWidget *widget, const gchar *p, - const GdkRectangle *bg, - const GdkRectangle *cell, + GdkRectangle *bg, + GdkRectangle *cell, GtkCellRendererState flags); static void pidgin_cell_renderer_expander_finalize (GObject *gobject); @@ -107,10 +108,9 @@ GType pidgin_cell_renderer_expander_get_type (void) static void pidgin_cell_renderer_expander_init (PidginCellRendererExpander *cellexpander) { - g_object_set(G_OBJECT(cellexpander), "mode", - GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL); - /*GTK_CELL_RENDERER(cellexpander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;*/ - gtk_cell_renderer_set_padding(GTK_CELL_RENDERER(cellexpander), 0, 2); + GTK_CELL_RENDERER(cellexpander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE; + GTK_CELL_RENDERER(cellexpander)->xpad = 0; + GTK_CELL_RENDERER(cellexpander)->ypad = 2; } static void pidgin_cell_renderer_expander_class_init (PidginCellRendererExpanderClass *class) @@ -190,7 +190,7 @@ GtkCellRenderer *pidgin_cell_renderer_expander_new(void) static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell, GtkWidget *widget, - const GdkRectangle *cell_area, + GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, @@ -199,17 +199,11 @@ static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell, gint calc_width; gint calc_height; gint expander_size; - gint xpad; - gint ypad; - gfloat xalign; - gfloat yalign; - + gtk_widget_style_get(widget, "expander-size", &expander_size, NULL); - gtk_cell_renderer_get_padding(cell, &xpad, &ypad); - gtk_cell_renderer_get_alignment(cell, &xalign, &yalign); - calc_width = (gint) xpad * 2 + expander_size; - calc_height = (gint) ypad * 2 + expander_size; + calc_width = (gint) cell->xpad * 2 + expander_size; + calc_height = (gint) cell->ypad * 2 + expander_size; if (width) *width = calc_width; @@ -221,12 +215,12 @@ static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell, { if (x_offset) { - *x_offset = xalign * (cell_area->width - calc_width); + *x_offset = cell->xalign * (cell_area->width - calc_width); *x_offset = MAX (*x_offset, 0); } if (y_offset) { - *y_offset = yalign * (cell_area->height - calc_height); + *y_offset = cell->yalign * (cell_area->height - calc_height); *y_offset = MAX (*y_offset, 0); } } @@ -234,64 +228,61 @@ static void pidgin_cell_renderer_expander_get_size (GtkCellRenderer *cell, static void pidgin_cell_renderer_expander_render(GtkCellRenderer *cell, - cairo_t *cr, + GdkWindow *window, GtkWidget *widget, - const GdkRectangle *background_area, - const GdkRectangle *cell_area, - GtkCellRendererState flags) + GdkRectangle *background_area, + GdkRectangle *cell_area, + GdkRectangle *expose_area, + guint flags) { PidginCellRendererExpander *cellexpander = (PidginCellRendererExpander *) cell; gboolean set; gint width, height; GtkStateType state; - gint xpad; - gint ypad; - gboolean is_expanded; - GtkAllocation allocation; - - gtk_cell_renderer_get_padding(cell, &xpad, &ypad); - g_object_get(G_OBJECT(cell), "is-expanded", &is_expanded, NULL); - + if (!cellexpander->is_expander) return; width = cell_area->width; height = cell_area->height; - if (!gtk_widget_get_sensitive(widget)) + if (!cell->sensitive) state = GTK_STATE_INSENSITIVE; else if (flags & GTK_CELL_RENDERER_PRELIT) state = GTK_STATE_PRELIGHT; - else if (gtk_widget_has_focus(widget) && flags & GTK_CELL_RENDERER_SELECTED) +#if GTK_CHECK_VERSION(2,18,0) + else if (gtk_widget_has_focus (widget) && flags & GTK_CELL_RENDERER_SELECTED) state = GTK_STATE_ACTIVE; +#else + else if (GTK_WIDGET_HAS_FOCUS (widget) && flags & GTK_CELL_RENDERER_SELECTED) + state = GTK_STATE_ACTIVE; +#endif else state = GTK_STATE_NORMAL; - width -= xpad*2; - height -= ypad*2; + width -= cell->xpad*2; + height -= cell->ypad*2; - gtk_paint_expander (gtk_widget_get_style(widget), - cr, state, - widget, "treeview", - cell_area->x + xpad + (width / 2), - cell_area->y + ypad + (height / 2), - is_expanded ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED); + gtk_paint_expander (widget->style, + window, state, + NULL, widget, "treeview", + cell_area->x + cell->xpad + (width / 2), + cell_area->y + cell->ypad + (height / 2), + cell->is_expanded ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED); /* only draw the line if the color isn't set - this prevents a bug where the hline appears only under the expander */ g_object_get(cellexpander, "cell-background-set", &set, NULL); - gtk_widget_get_allocation(widget, &allocation); - - if (is_expanded && !set) - gtk_paint_hline (gtk_widget_get_style(widget), cr, state, widget, NULL, 0, - allocation.width, cell_area->y + cell_area->height); + if (cell->is_expanded && !set) + gtk_paint_hline (widget->style, window, state, NULL, widget, NULL, 0, + widget->allocation.width, cell_area->y + cell_area->height); } static gboolean pidgin_cell_renderer_expander_activate(GtkCellRenderer *r, GdkEvent *event, GtkWidget *widget, const gchar *p, - const GdkRectangle *bg, - const GdkRectangle *cell, + GdkRectangle *bg, + GdkRectangle *cell, GtkCellRendererState flags) { GtkTreePath *path = gtk_tree_path_new_from_string(p); diff --git a/pidgin/gtkcertmgr.c b/pidgin/gtkcertmgr.c index 381ff2c72b..daf999ccc2 100644 --- a/pidgin/gtkcertmgr.c +++ b/pidgin/gtkcertmgr.c @@ -40,6 +40,12 @@ #include "gtkcertmgr.h" +#ifdef ENABLE_GCR +#define GCR_API_SUBJECT_TO_CHANGE +#include +#include +#endif + /***************************************************************************** * X.509 tls_peers management interface * *****************************************************************************/ @@ -310,6 +316,13 @@ tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data) GtkTreeModel *model; gchar *id; PurpleCertificate *crt; +#ifdef ENABLE_GCR + GByteArray *der; + GcrCertificate *gcrt; + char *title; + GtkWidget *dialog; + GcrCertificateBasicsWidget *cert_widget; +#endif /* See if things are selected */ if (!gtk_tree_selection_get_selected(select, &model, &iter)) { @@ -325,11 +338,44 @@ tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data) crt = purple_certificate_pool_retrieve(tpm_dat->tls_peers, id); g_return_if_fail(crt); +#ifdef ENABLE_GCR + der = purple_certificate_get_der_data(crt); + g_return_if_fail(der); + + gcrt = gcr_simple_certificate_new(der->data, der->len); + g_return_if_fail(gcrt); + + /* Fire the notification */ + title = g_strdup_printf(_("Certificate Information for %s"), id); + dialog = gtk_dialog_new_with_buttons(title, + NULL, + 0, + GTK_STOCK_OK, + GTK_RESPONSE_ACCEPT, + NULL); + cert_widget = gcr_certificate_basics_widget_new(gcrt); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + GTK_WIDGET(cert_widget), TRUE, TRUE, 0); + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + gtk_widget_show_all(dialog); + + g_byte_array_free(der, TRUE); + g_object_unref(G_OBJECT(gcrt)); +#else /* Fire the notification */ purple_certificate_display_x509(crt); g_free(id); purple_certificate_destroy(crt); +#endif +} + +static void +tls_peers_mgmt_activated_cb(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data) +{ + tls_peers_mgmt_info_cb(NULL, NULL); } static void @@ -452,6 +498,9 @@ tls_peers_mgmt_build(void) g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(tls_peers_mgmt_select_chg_cb), NULL); + g_signal_connect(G_OBJECT(listview), "row-activated", + G_CALLBACK(tls_peers_mgmt_activated_cb), NULL); + gtk_box_pack_start(GTK_BOX(mgmt_widget), pidgin_make_scrollable(GTK_WIDGET(listview), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1), TRUE, TRUE, /* Take up lots of space */ @@ -471,9 +520,8 @@ tls_peers_mgmt_build(void) gtk_widget_show(bbox); /* Import button */ - /* TODO: This is the wrong stock button */ tpm_dat->importbutton = importbutton = - gtk_button_new_from_stock(GTK_STOCK_ADD); + gtk_button_new_from_stock(GTK_STOCK_OPEN); gtk_box_pack_start(GTK_BOX(bbox), importbutton, FALSE, FALSE, 0); gtk_widget_show(importbutton); g_signal_connect(G_OBJECT(importbutton), "clicked", @@ -481,9 +529,8 @@ tls_peers_mgmt_build(void) /* Export button */ - /* TODO: This is the wrong stock button */ tpm_dat->exportbutton = exportbutton = - gtk_button_new_from_stock(GTK_STOCK_SAVE); + gtk_button_new_from_stock(GTK_STOCK_SAVE_AS); gtk_box_pack_start(GTK_BOX(bbox), exportbutton, FALSE, FALSE, 0); gtk_widget_show(exportbutton); g_signal_connect(G_OBJECT(exportbutton), "clicked", diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index dc3f8656b0..9565dadfe8 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -52,6 +52,8 @@ #include "notify.h" #include "prpl.h" #include "request.h" +#include "theme-loader.h" +#include "theme-manager.h" #include "util.h" #include "version.h" @@ -59,6 +61,8 @@ #include "gtkblist.h" #include "gtkconv.h" #include "gtkconvwin.h" +#include "gtkconv-theme.h" +#include "gtkconv-theme-loader.h" #include "gtkdialogs.h" #include "gtkimhtml.h" #include "gtkimhtmltoolbar.h" @@ -69,11 +73,55 @@ #include "gtkprivacy.h" #include "gtkthemes.h" #include "gtkutils.h" +#include "gtkwebview.h" #include "pidginstock.h" #include "pidgintooltip.h" +#include "smileyparser.h" #include "gtknickcolors.h" +#if !GTK_CHECK_VERSION(2,20,0) +#define gtk_widget_get_realized(x) GTK_WIDGET_REALIZED(x) + +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) +#define gtk_widget_is_drawable(x) GTK_WIDGET_DRAWABLE(x) +#endif +#endif + +/** + * A GTK+ Instant Message pane. + */ +struct _PidginImPane +{ + GtkWidget *block; + GtkWidget *send_file; + GtkWidget *sep1; + GtkWidget *sep2; + GtkWidget *check; + GtkWidget *progress; + guint32 typing_timer; + + /* Buddy icon stuff */ + GtkWidget *icon_container; + GtkWidget *icon; + gboolean show_icon; + gboolean animate; + GdkPixbufAnimation *anim; + GdkPixbufAnimationIter *iter; + guint32 icon_timer; +}; + +/** + * GTK+ Chat panes. + */ +struct _PidginChatPane +{ + GtkWidget *count; + GtkWidget *list; + GtkWidget *topic_text; +}; + #define CLOSE_CONV_TIMEOUT_SECS (10 * 60) #define AUTO_RESPONSE "<AUTO-REPLY> : " @@ -175,7 +223,7 @@ static gboolean pidgin_conv_xy_to_right_infopane(PidginWindow *win, int x, int y static const GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) { static GdkColor col; - GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml); + GtkStyle *style = gtk_widget_get_style(gtkconv->webview); float scale; col = nick_colors[g_str_hash(name) % nbr_nick_colors]; @@ -195,15 +243,16 @@ static const GdkColor *get_nick_color(PidginConversation *gtkconv, const char *n static PurpleBlistNode * get_conversation_blist_node(PurpleConversation *conv) { + PurpleAccount *account = purple_conversation_get_account(conv); PurpleBlistNode *node = NULL; switch (purple_conversation_get_type(conv)) { case PURPLE_CONV_TYPE_IM: - node = PURPLE_BLIST_NODE(purple_find_buddy(conv->account, conv->name)); + node = PURPLE_BLIST_NODE(purple_find_buddy(account, purple_conversation_get_name(conv))); node = node ? node->parent : NULL; break; case PURPLE_CONV_TYPE_CHAT: - node = PURPLE_BLIST_NODE(purple_blist_find_chat(conv->account, conv->name)); + node = PURPLE_BLIST_NODE(purple_blist_find_chat(account, purple_conversation_get_name(conv))); break; default: break; @@ -275,7 +324,7 @@ static void default_formatize(PidginConversation *c) { PurpleConversation *conv = c->active_conv; - gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), conv->features); + gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), purple_conversation_get_features(conv)); } static void @@ -355,8 +404,32 @@ debug_command_cb(PurpleConversation *conv, } tmp = g_string_free(str, FALSE); + } else if (!g_ascii_strcasecmp(args[0], "unsafe")) { + if (purple_debug_is_unsafe()) { + purple_debug_set_unsafe(FALSE); + purple_conversation_write(conv, NULL, _("Unsafe debugging is now disabled."), + PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL)); + } else { + purple_debug_set_unsafe(TRUE); + purple_conversation_write(conv, NULL, _("Unsafe debugging is now enabled."), + PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL)); + } + + return PURPLE_CMD_RET_OK; + } else if (!g_ascii_strcasecmp(args[0], "verbose")) { + if (purple_debug_is_verbose()) { + purple_debug_set_verbose(FALSE); + purple_conversation_write(conv, NULL, _("Verbose debugging is now disabled."), + PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL)); + } else { + purple_debug_set_verbose(TRUE); + purple_conversation_write(conv, NULL, _("Verbose debugging is now enabled."), + PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL)); + } + + return PURPLE_CMD_RET_OK; } else { - purple_conversation_write(conv, NULL, _("Supported debug options are: plugins version"), + purple_conversation_write(conv, NULL, _("Supported debug options are: plugins version unsafe verbose"), PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL)); return PURPLE_CMD_RET_OK; } @@ -378,8 +451,9 @@ static void clear_conversation_scrollback_cb(PurpleConversation *conv, PidginConversation *gtkconv = NULL; gtkconv = PIDGIN_CONVERSATION(conv); - if (gtkconv) - gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); + + if (PIDGIN_CONVERSATION(conv)) + webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(gtkconv->webview), "", ""); } static PurpleCmdRet @@ -497,8 +571,8 @@ check_for_and_do_command(PurpleConversation *conv) PurplePluginProtocolInfo *prpl_info = NULL; PurpleConnection *gc; - if ((gc = purple_conversation_get_gc(conv))) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + if ((gc = purple_conversation_get_connection(conv))) + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if ((prpl_info != NULL) && (prpl_info->options & OPT_PROTO_SLASH_COMMANDS_NATIVE)) { char *spaceslash; @@ -590,7 +664,7 @@ send_cb(GtkWidget *widget, PidginConversation *gtkconv) flags |= PURPLE_MESSAGE_IMAGES; gc = purple_account_get_connection(account); - if (gc && (conv->features & PURPLE_CONNECTION_NO_NEWLINES)) { + if (gc && (purple_conversation_get_features(conv) & PURPLE_CONNECTION_NO_NEWLINES)) { char **bufs; int i; @@ -656,7 +730,7 @@ static void chat_do_info(PidginConversation *gtkconv, const char *who) PurpleConversation *conv = gtkconv->active_conv; PurpleConnection *gc; - if ((gc = purple_conversation_get_gc(conv))) { + if ((gc = purple_conversation_get_connection(conv))) { pidgin_retrieve_user_info_in_chat(gc, who, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); } } @@ -668,7 +742,7 @@ info_cb(GtkWidget *widget, PidginConversation *gtkconv) PurpleConversation *conv = gtkconv->active_conv; if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - pidgin_retrieve_user_info(purple_conversation_get_gc(conv), + pidgin_retrieve_user_info(purple_conversation_get_connection(conv), purple_conversation_get_name(conv)); gtk_widget_grab_focus(gtkconv->entry); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { @@ -756,7 +830,7 @@ do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) if (!g_ascii_strcasecmp(buddy, "")) return; - serv_chat_invite(purple_conversation_get_gc(conv), + serv_chat_invite(purple_conversation_get_connection(conv), purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), message, buddy); } @@ -774,17 +848,15 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, InviteBuddyInfo *info = (InviteBuddyInfo *)data; const char *convprotocol; gboolean success = TRUE; - GdkAtom target = gtk_selection_data_get_target(sd); convprotocol = purple_account_get_protocol_id(purple_conversation_get_account(info->conv)); - if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) + if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { PurpleBlistNode *node = NULL; PurpleBuddy *buddy; - const guchar *data = gtk_selection_data_get_data(sd); - memcpy(&node, data, sizeof(node)); + memcpy(&node, sd->data, sizeof(node)); if (PURPLE_BLIST_NODE_IS_CONTACT(node)) buddy = purple_contact_get_priority_buddy((PurpleContact *)node); @@ -793,7 +865,7 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, else return; - if (strcmp(convprotocol, purple_account_get_protocol_id(buddy->account))) + if (strcmp(convprotocol, purple_account_get_protocol_id(purple_buddy_get_account(buddy)))) { purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL, _("That buddy is not on the same protocol as this " @@ -803,16 +875,15 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, else gtk_entry_set_text(GTK_ENTRY(info->entry), purple_buddy_get_name(buddy)); - gtk_drag_finish(dc, success, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gtk_drag_finish(dc, success, (dc->action == GDK_ACTION_MOVE), t); } - else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) + else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) { char *protocol = NULL; char *username = NULL; PurpleAccount *account; - if (pidgin_parse_x_im_contact((const char *) data, FALSE, &account, + if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, &protocol, &username, NULL)) { if (account == NULL) @@ -837,8 +908,7 @@ invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, g_free(username); g_free(protocol); - gtk_drag_finish(dc, success, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gtk_drag_finish(dc, success, (dc->action == GDK_ACTION_MOVE), t); } } @@ -880,15 +950,14 @@ invite_cb(GtkWidget *widget, PidginConversation *gtkconv) GTK_RESPONSE_OK); gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); - /* TODO: set no separator using GTK+ 3.0 */ -#if 0 +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); #endif info->window = GTK_WIDGET(invite_dialog); /* Setup the outside spacing. */ - vbox = gtk_dialog_get_content_area(GTK_DIALOG(invite_dialog)); + vbox = GTK_DIALOG(invite_dialog)->vbox; gtk_box_set_spacing(GTK_BOX(vbox), PIDGIN_HIG_BORDER); gtk_container_set_border_width(GTK_CONTAINER(vbox), PIDGIN_HIG_BOX_SPACE); @@ -986,7 +1055,7 @@ menu_new_conv_cb(GtkAction *action, gpointer data) } static void -menu_join_chat_cb(gpointer data, guint action, GtkWidget *widget) +menu_join_chat_cb(GtkAction *action, gpointer data) { pidgin_blist_joinchat_show(); } @@ -994,6 +1063,8 @@ menu_join_chat_cb(gpointer data, guint action, GtkWidget *widget) static void savelog_writefile_cb(void *user_data, const char *filename) { + /* TODO WEBKIT: I don't know how to support this using webkit yet. */ +#if 0 PurpleConversation *conv = (PurpleConversation *)user_data; FILE *fp; const char *name; @@ -1020,6 +1091,7 @@ savelog_writefile_cb(void *user_data, const char *filename) fprintf(fp, "\n\n\n"); fclose(fp); +#endif /* if 0 */ } /* @@ -1031,7 +1103,8 @@ menu_save_as_cb(GtkAction *action, gpointer data) { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); - PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + PurpleAccount *account = purple_conversation_get_account(conv); + PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); const char *name; gchar *buf; gchar *c; @@ -1039,7 +1112,7 @@ menu_save_as_cb(GtkAction *action, gpointer data) if (buddy != NULL) name = purple_buddy_get_contact_alias(buddy); else - name = purple_normalize(conv->account, conv->name); + name = purple_normalize(account, purple_conversation_get_name(conv)); buf = g_strdup_printf("%s.html", name); for (c = buf ; *c ; c++) @@ -1081,12 +1154,9 @@ menu_view_log_cb(GtkAction *action, gpointer data) gtkblist = pidgin_blist_get_default_gtk_blist(); cursor = gdk_cursor_new(GDK_WATCH); - gdk_window_set_cursor(gtk_widget_get_window(gtkblist->window), cursor); - gdk_window_set_cursor(gtk_widget_get_window(win->window), cursor); + gdk_window_set_cursor(gtkblist->window->window, cursor); + gdk_window_set_cursor(win->window->window, cursor); gdk_cursor_unref(cursor); -#if GTK_CHECK_VERSION(2,4,0) && !GTK_CHECK_VERSION(2,6,0) //FIXME: What? - gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); -#endif name = purple_conversation_get_name(conv); account = purple_conversation_get_account(conv); @@ -1099,8 +1169,8 @@ menu_view_log_cb(GtkAction *action, gpointer data) { pidgin_log_show_contact((PurpleContact *)node->parent); g_slist_free(buddies); - gdk_window_set_cursor(gtk_widget_get_window(gtkblist->window), NULL); - gdk_window_set_cursor(gtk_widget_get_window(win->window), NULL); + gdk_window_set_cursor(gtkblist->window->window, NULL); + gdk_window_set_cursor(win->window->window, NULL); return; } } @@ -1108,8 +1178,8 @@ menu_view_log_cb(GtkAction *action, gpointer data) pidgin_log_show(type, name, account); - gdk_window_set_cursor(gtk_widget_get_window(gtkblist->window), NULL); - gdk_window_set_cursor(gtk_widget_get_window(win->window), NULL); + gdk_window_set_cursor(gtkblist->window->window, NULL); + gdk_window_set_cursor(win->window->window, NULL); } static void @@ -1155,20 +1225,25 @@ menu_send_file_cb(GtkAction *action, gpointer data) PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - serv_send_file(purple_conversation_get_gc(conv), purple_conversation_get_name(conv), NULL); + serv_send_file(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), NULL); } } static void -menu_get_attention_cb(GtkAction *ation, gpointer data) +menu_get_attention_cb(GObject *obj, gpointer data) { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - purple_prpl_send_attention(purple_conversation_get_gc(conv), - purple_conversation_get_name(conv), 0); + int index; + if ((GtkAction *)obj == win->menu.get_attention) + index = 0; + else + index = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(obj), "index")); + purple_prpl_send_attention(purple_conversation_get_connection(conv), + purple_conversation_get_name(conv), index); } } @@ -1364,16 +1439,14 @@ menu_logging_cb(GtkAction *action, gpointer data) purple_conversation_write(conv, NULL, _("Logging started. Future messages in this conversation will be logged."), - conv->logs ? (PURPLE_MESSAGE_SYSTEM) : - (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG), + PURPLE_MESSAGE_SYSTEM, time(NULL)); } else { purple_conversation_write(conv, NULL, _("Logging stopped. Future messages in this conversation will not be logged."), - conv->logs ? (PURPLE_MESSAGE_SYSTEM) : - (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG), + PURPLE_MESSAGE_SYSTEM, time(NULL)); /* Disable the logging second, so that the above message can be logged. */ @@ -1381,7 +1454,7 @@ menu_logging_cb(GtkAction *action, gpointer data) } /* Save the setting IFF it's different than the pref. */ - switch (conv->type) + switch (purple_conversation_get_type(conv)) { case PURPLE_CONV_TYPE_IM: if (logging == purple_prefs_get_bool("/purple/logging/log_ims")) @@ -1453,7 +1526,7 @@ chat_do_im(PidginConversation *gtkconv, const char *who) gc = purple_account_get_connection(account); g_return_if_fail(gc != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && prpl_info->get_cb_real_name) real_who = prpl_info->get_cb_real_name(gc, @@ -1504,12 +1577,12 @@ menu_chat_send_file_cb(GtkWidget *w, PidginConversation *gtkconv) PurplePluginProtocolInfo *prpl_info; PurpleConversation *conv = gtkconv->active_conv; const char *who = g_object_get_data(G_OBJECT(w), "user_data"); - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); gchar *real_who = NULL; g_return_if_fail(gc != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && prpl_info->get_cb_real_name) real_who = prpl_info->get_cb_real_name(gc, @@ -1529,32 +1602,6 @@ menu_chat_info_cb(GtkWidget *w, PidginConversation *gtkconv) chat_do_info(gtkconv, who); } -static void -menu_chat_get_away_cb(GtkWidget *w, PidginConversation *gtkconv) -{ - PurpleConversation *conv = gtkconv->active_conv; - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc; - char *who; - - gc = purple_conversation_get_gc(conv); - who = g_object_get_data(G_OBJECT(w), "user_data"); - - if (gc != NULL) { - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - - /* - * May want to expand this to work similarly to menu_info_cb? - */ - - if (prpl_info->get_cb_away != NULL) - { - prpl_info->get_cb_away(gc, - purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who); - } - } -} - static void menu_chat_add_remove_cb(GtkWidget *w, PidginConversation *gtkconv) { @@ -1578,7 +1625,7 @@ menu_chat_add_remove_cb(GtkWidget *w, PidginConversation *gtkconv) static GtkTextMark * get_mark_for_user(PidginConversation *gtkconv, const char *who) { - GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); + GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->webview)); char *tmp = g_strconcat("user:", who, NULL); GtkTextMark *mark = gtk_text_buffer_get_mark(buf, tmp); @@ -1589,6 +1636,8 @@ get_mark_for_user(PidginConversation *gtkconv, const char *who) static void menu_last_said_cb(GtkWidget *w, PidginConversation *gtkconv) { +/* TODO WEBKIT: This doesn't work yet, of course... */ +#if 0 GtkTextMark *mark; const char *who; @@ -1599,6 +1648,7 @@ menu_last_said_cb(GtkWidget *w, PidginConversation *gtkconv) gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); else g_return_if_reached(); +#endif /* if 0 */ } static GtkWidget * @@ -1607,12 +1657,13 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc static GtkWidget *menu = NULL; PurplePluginProtocolInfo *prpl_info = NULL; PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); + PurpleAccount *account = purple_conversation_get_account(conv); gboolean is_me = FALSE; GtkWidget *button; PurpleBuddy *buddy = NULL; if (gc != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); /* * If a menu already exists, destroy it before creating a new one, @@ -1621,7 +1672,7 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc if (menu) gtk_widget_destroy(menu); - if (!strcmp(chat->nick, purple_normalize(conv->account, who))) + if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(account, who))) is_me = TRUE; menu = gtk_menu_new(); @@ -1686,18 +1737,8 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); } - if (prpl_info && prpl_info->get_cb_away) { - button = pidgin_new_item_from_stock(menu, _("Get Away Message"), PIDGIN_STOCK_AWAY, - G_CALLBACK(menu_chat_get_away_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); - - if (gc == NULL) - gtk_widget_set_sensitive(button, FALSE); - else - g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); - } - if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { - if ((buddy = purple_find_buddy(conv->account, who)) != NULL) + if ((buddy = purple_find_buddy(account, who)) != NULL) button = pidgin_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE, G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); else @@ -1718,8 +1759,8 @@ create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc if (buddy != NULL) { - if (purple_account_is_connected(conv->account)) - pidgin_append_blist_node_proto_menu(menu, conv->account->gc, + if (purple_account_is_connected(account)) + pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(account), (PurpleBlistNode *)buddy); pidgin_append_blist_node_extended_menu(menu, (PurpleBlistNode *)buddy); gtk_widget_show_all(menu); @@ -1745,7 +1786,7 @@ gtkconv_chat_popup_menu_cb(GtkWidget *widget, PidginConversation *gtkconv) gtkconv = PIDGIN_CONVERSATION(conv); gtkchat = gtkconv->u.chat; account = purple_conversation_get_account(conv); - gc = account->gc; + gc = purple_account_get_connection(account); model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); @@ -1781,7 +1822,7 @@ right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, gtkchat = gtkconv->u.chat; account = purple_conversation_get_account(conv); - gc = account->gc; + gc = purple_account_get_connection(account); model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); @@ -1813,10 +1854,13 @@ right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, chat_do_im(gtkconv, who); } else if (event->button == 2 && event->type == GDK_BUTTON_PRESS) { /* Move to user's anchor */ +/* TODO WEBKIT: This isn't implemented yet. */ +#if 0 GtkTextMark *mark = get_mark_for_user(gtkconv, who); if(mark != NULL) gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); +#endif /* if 0 */ } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { GtkWidget *menu = create_chat_menu (conv, who, gc); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, @@ -1893,8 +1937,8 @@ gtkconv_cycle_focus(PidginConversation *gtkconv, GtkDirectionType dir) GtkWidget *from; GtkWidget *to; } transitions[] = { - {gtkconv->entry, gtkconv->imhtml}, - {gtkconv->imhtml, chat ? gtkconv->u.chat->list : gtkconv->entry}, + {gtkconv->entry, gtkconv->webview}, + {gtkconv->webview, chat ? gtkconv->u.chat->list : gtkconv->entry}, {chat ? gtkconv->u.chat->list : NULL, gtkconv->entry}, {NULL, NULL} }, *ptr; @@ -1932,8 +1976,8 @@ conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) /* If CTRL was held down... */ if (event->state & GDK_CONTROL_MASK) { switch (event->keyval) { - case GDK_KEY_Page_Down: - case GDK_KEY_KP_Page_Down: + case GDK_Page_Down: + case GDK_KP_Page_Down: case ']': if (!pidgin_conv_window_get_gtkconv_at_index(win, curconv + 1)) gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); @@ -1942,8 +1986,8 @@ conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) return TRUE; break; - case GDK_KEY_Page_Up: - case GDK_KEY_KP_Page_Up: + case GDK_Page_Up: + case GDK_KP_Page_Up: case '[': if (!pidgin_conv_window_get_gtkconv_at_index(win, curconv - 1)) gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), -1); @@ -1952,9 +1996,9 @@ conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) return TRUE; break; - case GDK_KEY_Tab: - case GDK_KEY_KP_Tab: - case GDK_KEY_ISO_Left_Tab: + case GDK_Tab: + case GDK_KP_Tab: + case GDK_ISO_Left_Tab: if (event->state & GDK_SHIFT_MASK) { move_to_next_unread_tab(gtkconv, FALSE); } else { @@ -1964,20 +2008,20 @@ conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) return TRUE; break; - case GDK_KEY_comma: + case GDK_comma: gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv), curconv - 1); return TRUE; break; - case GDK_KEY_period: + case GDK_period: gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv), (curconv + 1) % gtk_notebook_get_n_pages(GTK_NOTEBOOK(win->notebook))); return TRUE; break; - case GDK_KEY_F6: + case GDK_F6: if (gtkconv_cycle_focus(gtkconv, event->state & GDK_SHIFT_MASK ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD)) return TRUE; break; @@ -2001,13 +2045,13 @@ conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event) else { switch (event->keyval) { - case GDK_KEY_F2: + case GDK_F2: if (gtk_widget_is_focus(GTK_WIDGET(win->notebook))) { infopane_entry_activate(gtkconv); return TRUE; } break; - case GDK_KEY_F6: + case GDK_F6: if (gtkconv_cycle_focus(gtkconv, event->state & GDK_SHIFT_MASK ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD)) return TRUE; break; @@ -2031,7 +2075,7 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) /* If CTRL was held down... */ if (event->state & GDK_CONTROL_MASK) { switch (event->keyval) { - case GDK_KEY_Up: + case GDK_Up: if (!gtkconv->send_history) break; @@ -2082,7 +2126,7 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) return TRUE; break; - case GDK_KEY_Down: + case GDK_Down: if (!gtkconv->send_history) break; @@ -2135,9 +2179,9 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) /* If neither CTRL nor ALT were held down... */ else { switch (event->keyval) { - case GDK_KEY_Tab: - case GDK_KEY_KP_Tab: - case GDK_KEY_ISO_Left_Tab: + case GDK_Tab: + case GDK_KP_Tab: + case GDK_ISO_Left_Tab: if (gtkconv->entry != entry) break; { @@ -2149,15 +2193,21 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) } break; - case GDK_KEY_Page_Up: - case GDK_KEY_KP_Page_Up: + case GDK_Page_Up: + case GDK_KP_Page_Up: +/* TODO WEBKIT: Write this. */ +#if 0 gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); +#endif /* if 0 */ return TRUE; break; - case GDK_KEY_Page_Down: - case GDK_KEY_KP_Page_Down: + case GDK_Page_Down: + case GDK_KP_Page_Down: +/* TODO WEBKIT: Write this. */ +#if 0 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); +#endif /* if 0 */ return TRUE; break; @@ -2200,26 +2250,26 @@ refocus_entry_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) /* If we have a valid key for the conversation display, then exit */ if ((event->state & GDK_CONTROL_MASK) || - (event->keyval == GDK_KEY_F6) || - (event->keyval == GDK_KEY_F10) || - (event->keyval == GDK_KEY_Shift_L) || - (event->keyval == GDK_KEY_Shift_R) || - (event->keyval == GDK_KEY_Control_L) || - (event->keyval == GDK_KEY_Control_R) || - (event->keyval == GDK_KEY_Escape) || - (event->keyval == GDK_KEY_Up) || - (event->keyval == GDK_KEY_Down) || - (event->keyval == GDK_KEY_Left) || - (event->keyval == GDK_KEY_Right) || - (event->keyval == GDK_KEY_Page_Up) || - (event->keyval == GDK_KEY_KP_Page_Up) || - (event->keyval == GDK_KEY_Page_Down) || - (event->keyval == GDK_KEY_KP_Page_Down) || - (event->keyval == GDK_KEY_Home) || - (event->keyval == GDK_KEY_End) || - (event->keyval == GDK_KEY_Tab) || - (event->keyval == GDK_KEY_KP_Tab) || - (event->keyval == GDK_KEY_ISO_Left_Tab)) + (event->keyval == GDK_F6) || + (event->keyval == GDK_F10) || + (event->keyval == GDK_Shift_L) || + (event->keyval == GDK_Shift_R) || + (event->keyval == GDK_Control_L) || + (event->keyval == GDK_Control_R) || + (event->keyval == GDK_Escape) || + (event->keyval == GDK_Up) || + (event->keyval == GDK_Down) || + (event->keyval == GDK_Left) || + (event->keyval == GDK_Right) || + (event->keyval == GDK_Page_Up) || + (event->keyval == GDK_KP_Page_Up) || + (event->keyval == GDK_Page_Down) || + (event->keyval == GDK_KP_Page_Down) || + (event->keyval == GDK_Home) || + (event->keyval == GDK_End) || + (event->keyval == GDK_Tab) || + (event->keyval == GDK_KP_Tab) || + (event->keyval == GDK_ISO_Left_Tab)) { if (event->type == GDK_KEY_PRESS) return conv_keypress_common(gtkconv, event); @@ -2244,6 +2294,7 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) PurpleConversation *old_conv; GtkIMHtml *entry; const char *protocol_name; + PurpleConnectionFlags features; g_return_if_fail(conv != NULL); @@ -2265,14 +2316,15 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(gtkconv->win->menu.logging))); entry = GTK_IMHTML(gtkconv->entry); - protocol_name = purple_account_get_protocol_name(conv->account); + protocol_name = purple_account_get_protocol_name(purple_conversation_get_account(conv)); gtk_imhtml_set_protocol_name(entry, protocol_name); - gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); + /* TODO WEBKIT: gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); */ - if (!(conv->features & PURPLE_CONNECTION_HTML)) + features = purple_conversation_get_features(conv); + if (!(features & PURPLE_CONNECTION_HTML)) gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry)); - else if (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO && - !(old_conv->features & PURPLE_CONNECTION_FORMATTING_WBFO)) + else if (features & PURPLE_CONNECTION_FORMATTING_WBFO && + !(purple_conversation_get_features(old_conv) & PURPLE_CONNECTION_FORMATTING_WBFO)) { /* The old conversation allowed formatting on parts of the * buffer, but the new one only allows it on the whole @@ -2312,12 +2364,12 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) gtk_imhtml_toggle_fontface(entry, fontface); - if (!(conv->features & PURPLE_CONNECTION_NO_FONTSIZE)) + if (!(features & PURPLE_CONNECTION_NO_FONTSIZE)) gtk_imhtml_font_set_size(entry, fontsize); gtk_imhtml_toggle_forecolor(entry, forecolor); - if (!(conv->features & PURPLE_CONNECTION_NO_BGCOLOR)) + if (!(features & PURPLE_CONNECTION_NO_BGCOLOR)) { gtk_imhtml_toggle_backcolor(entry, backcolor); gtk_imhtml_toggle_background(entry, background); @@ -2335,7 +2387,7 @@ pidgin_conv_switch_active_conversation(PurpleConversation *conv) * here, we didn't call gtk_imhtml_clear_formatting() (because we want to * preserve the formatting exactly as it is), so we have to do this now. */ gtk_imhtml_set_whole_buffer_formatting_only(entry, - (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO)); + (features & PURPLE_CONNECTION_FORMATTING_WBFO)); } purple_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv); @@ -2400,7 +2452,7 @@ delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, /* We deleted all the text, so turn off typing. */ purple_conv_im_stop_send_typed_timeout(im); - serv_send_typing(purple_conversation_get_gc(conv), + serv_send_typing(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), PURPLE_NOT_TYPING); } @@ -2450,7 +2502,8 @@ pidgin_conv_get_tab_icons(PurpleConversation *conv) if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { PurpleBuddy *b = purple_find_buddy(account, name); if (b != NULL) { - PurplePresence *p = purple_buddy_get_presence(b); + PurplePresence *p; + p = purple_buddy_get_presence(b); if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY)) return away_list; if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE)) @@ -2564,7 +2617,7 @@ update_tab_icon(PurpleConversation *conv) status = infopane_status = pidgin_conv_get_icon_stock(conv); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - PurpleBuddy *b = purple_find_buddy(conv->account, conv->name); + PurpleBuddy *b = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); if (b) emblem = pidgin_blist_get_emblem((PurpleBlistNode*)b); } @@ -2585,7 +2638,7 @@ update_tab_icon(PurpleConversation *conv) g_object_unref(emblem); if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) { - emblem = pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL); + emblem = pidgin_create_prpl_icon(purple_conversation_get_account(gtkconv->active_conv), PIDGIN_PRPL_ICON_SMALL); } else { emblem = NULL; } @@ -2641,7 +2694,7 @@ redraw_icon(gpointer data) gtkconv = PIDGIN_CONVERSATION(conv); account = purple_conversation_get_account(conv); - if (!(account && account->gc)) { + if (!(account && purple_account_get_connection(account))) { gtkconv->u.im->icon_timer = 0; return FALSE; } @@ -2686,7 +2739,7 @@ redraw_icon(gpointer data) } static void -start_anim(GtkWidget *widget, PidginConversation *gtkconv) +start_anim(GtkObject *obj, PidginConversation *gtkconv) { int delay; @@ -2848,18 +2901,18 @@ icon_menu_save_cb(GtkWidget *widget, PidginConversation *gtkconv) ext = purple_buddy_icon_get_extension(purple_conv_im_get_icon(PURPLE_CONV_IM(conv))); - buf = g_strdup_printf("%s.%s", purple_normalize(conv->account, conv->name), ext); + buf = g_strdup_printf("%s.%s", purple_normalize(purple_conversation_get_account(conv), purple_conversation_get_name(conv)), ext); purple_request_file(gtkconv, _("Save Icon"), buf, TRUE, G_CALLBACK(saveicon_writefile_cb), NULL, - conv->account, NULL, conv, + purple_conversation_get_account(conv), NULL, conv, gtkconv); g_free(buf); } static void -stop_anim(GtkWidget *widget, PidginConversation *gtkconv) +stop_anim(GtkObject *obj, PidginConversation *gtkconv) { if (gtkconv->u.im->icon_timer != 0) g_source_remove(gtkconv->u.im->icon_timer); @@ -2881,7 +2934,7 @@ toggle_icon_animate_cb(GtkWidget *w, PidginConversation *gtkconv) } static gboolean -icon_menu(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkconv) +icon_menu(GtkObject *obj, GdkEventButton *e, PidginConversation *gtkconv) { static GtkWidget *menu = NULL; PurpleConversation *conv; @@ -3075,14 +3128,13 @@ pidgin_conv_get_window(PidginConversation *gtkconv) return gtkconv->win; } -#if 1 - static GtkActionEntry menu_entries[] = /* TODO: fill out tooltips... */ { /* Conversation menu */ { "ConversationMenu", NULL, N_("_Conversation"), NULL, NULL, NULL }, { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "M", NULL, G_CALLBACK(menu_new_conv_cb) }, + { "JoinAChat", PIDGIN_STOCK_CHAT, N_("Join a _Chat..."), NULL, NULL, G_CALLBACK(menu_join_chat_cb) }, { "Find", GTK_STOCK_FIND, N_("_Find..."), NULL, NULL, G_CALLBACK(menu_find_cb) }, { "ViewLog", NULL, N_("View _Log"), NULL, NULL, G_CALLBACK(menu_view_log_cb) }, { "SaveAs", GTK_STOCK_SAVE_AS, N_("_Save As..."), NULL, NULL, G_CALLBACK(menu_save_as_cb) }, @@ -3127,6 +3179,7 @@ static const char *conversation_menu = "" "" "" + "" "" "" "" @@ -3168,86 +3221,6 @@ static const char *conversation_menu = "" ""; -#else - -static GtkItemFactoryEntry menu_items[] = -{ - /* Conversation menu */ - { N_("/_Conversation"), NULL, NULL, 0, "", NULL }, - - { N_("/Conversation/New Instant _Message..."), "M", menu_new_conv_cb, - 0, "", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, - { N_("/Conversation/Join a _Chat..."), NULL, menu_join_chat_cb, - 0, "", PIDGIN_STOCK_CHAT }, - - { "/Conversation/sep0", NULL, NULL, 0, "", NULL }, - - { N_("/Conversation/_Find..."), NULL, menu_find_cb, 0, - "", GTK_STOCK_FIND }, - { N_("/Conversation/View _Log"), NULL, menu_view_log_cb, 0, "", NULL }, - { N_("/Conversation/_Save As..."), NULL, menu_save_as_cb, 0, - "", GTK_STOCK_SAVE_AS }, - { N_("/Conversation/Clea_r Scrollback"), "L", menu_clear_cb, 0, "", GTK_STOCK_CLEAR }, - - { "/Conversation/sep1", NULL, NULL, 0, "", NULL }, - -#ifdef USE_VV - { N_("/Conversation/M_edia"), NULL, NULL, 0, "", NULL }, - - { N_("/Conversation/Media/_Audio Call"), NULL, menu_initiate_media_call_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL }, - { N_("/Conversation/Media/_Video Call"), NULL, menu_initiate_media_call_cb, 1, - "", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL }, - { N_("/Conversation/Media/Audio\\/Video _Call"), NULL, menu_initiate_media_call_cb, 2, - "", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL }, -#endif - - { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "", PIDGIN_STOCK_TOOLBAR_SEND_FILE }, - { N_("/Conversation/Get _Attention"), NULL, menu_get_attention_cb, 0, "", PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION }, - { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, - 0, "", NULL }, - { N_("/Conversation/_Get Info"), "O", menu_get_info_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_USER_INFO }, - { N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0, - "", NULL }, - { N_("/Conversation/M_ore"), NULL, NULL, 0, "", NULL }, - - { "/Conversation/sep2", NULL, NULL, 0, "", NULL }, - - { N_("/Conversation/Al_ias..."), NULL, menu_alias_cb, 0, - "", NULL }, - { N_("/Conversation/_Block..."), NULL, menu_block_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_BLOCK }, - { N_("/Conversation/_Unblock..."), NULL, menu_unblock_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_UNBLOCK }, - { N_("/Conversation/_Add..."), NULL, menu_add_remove_cb, 0, - "", GTK_STOCK_ADD }, - { N_("/Conversation/_Remove..."), NULL, menu_add_remove_cb, 0, - "", GTK_STOCK_REMOVE }, - - { "/Conversation/sep3", NULL, NULL, 0, "", NULL }, - - { N_("/Conversation/Insert Lin_k..."), NULL, menu_insert_link_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_INSERT_LINK }, - { N_("/Conversation/Insert Imag_e..."), NULL, menu_insert_image_cb, 0, - "", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE }, - - { "/Conversation/sep4", NULL, NULL, 0, "", NULL }, - - - { N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0, - "", GTK_STOCK_CLOSE }, - - /* Options */ - { N_("/_Options"), NULL, NULL, 0, "", NULL }, - { N_("/Options/Enable _Logging"), NULL, menu_logging_cb, 0, "", NULL }, - { N_("/Options/Enable _Sounds"), NULL, menu_sounds_cb, 0, "", NULL }, - { "/Options/sep0", NULL, NULL, 0, "", NULL }, - { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "", NULL }, - { N_("/Options/Show Ti_mestamps"), NULL, menu_timestamps_cb, 0, "", NULL }, -}; -#endif - static void sound_method_pref_changed_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data) @@ -3278,21 +3251,23 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea { GList *list; PurpleConversation *conv; + PurpleAccount *account; PurpleBlistNode *node = NULL; PurpleChat *chat = NULL; PurpleBuddy *buddy = NULL; gboolean ret; conv = gtkconv->active_conv; + account = purple_conversation_get_account(conv); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - chat = purple_blist_find_chat(conv->account, conv->name); + chat = purple_blist_find_chat(account, purple_conversation_get_name(conv)); - if ((chat == NULL) && (gtkconv->imhtml != NULL)) { - chat = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_chat"); + if ((chat == NULL) && (gtkconv->webview != NULL)) { + chat = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat"); } - if ((chat == NULL) && (gtkconv->imhtml != NULL)) { + if ((chat == NULL) && (gtkconv->webview != NULL)) { GHashTable *components; PurpleAccount *account = purple_conversation_get_account(conv); PurplePlugin *prpl = purple_find_prpl(purple_account_get_protocol_id(account)); @@ -3307,30 +3282,30 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea g_hash_table_replace(components, g_strdup("channel"), g_strdup(purple_conversation_get_name(conv))); } - chat = purple_chat_new(conv->account, NULL, components); + chat = purple_chat_new(account, NULL, components); purple_blist_node_set_flags((PurpleBlistNode *)chat, PURPLE_BLIST_NODE_FLAG_NO_SAVE); - g_object_set_data_full(G_OBJECT(gtkconv->imhtml), "transient_chat", + g_object_set_data_full(G_OBJECT(gtkconv->webview), "transient_chat", chat, (GDestroyNotify)purple_blist_remove_chat); } } else { - if (!purple_account_is_connected(conv->account)) + if (!purple_account_is_connected(account)) return FALSE; - buddy = purple_find_buddy(conv->account, conv->name); + buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); /* gotta remain bug-compatible :( libpurple < 2.0.2 didn't handle * removing "isolated" buddy nodes well */ if (purple_version_check(2, 0, 2) == NULL) { - if ((buddy == NULL) && (gtkconv->imhtml != NULL)) { - buddy = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_buddy"); + if ((buddy == NULL) && (gtkconv->webview != NULL)) { + buddy = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_buddy"); } - if ((buddy == NULL) && (gtkconv->imhtml != NULL)) { - buddy = purple_buddy_new(conv->account, conv->name, NULL); + if ((buddy == NULL) && (gtkconv->webview != NULL)) { + buddy = purple_buddy_new(account, purple_conversation_get_name(conv), NULL); purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE); - g_object_set_data_full(G_OBJECT(gtkconv->imhtml), "transient_buddy", + g_object_set_data_full(G_OBJECT(gtkconv->webview), "transient_buddy", buddy, (GDestroyNotify)purple_buddy_destroy); } } @@ -3349,8 +3324,8 @@ populate_menu_with_options(GtkWidget *menu, PidginConversation *gtkconv, gboolea /* XXX: */ } } else if (node) { - if (purple_account_is_connected(conv->account)) - pidgin_append_blist_node_proto_menu(menu, conv->account->gc, node); + if (purple_account_is_connected(account)) + pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(account), node); pidgin_append_blist_node_extended_menu(menu, node); } @@ -3402,7 +3377,7 @@ regenerate_media_items(PidginWindow *win) gtk_action_set_sensitive(win->video_call, caps & PURPLE_MEDIA_CAPS_VIDEO ? TRUE : FALSE); - gtk_action_set_sensitive(win->audio_video_call, + gtk_action_set_sensitive(win->audio_video_call, caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO ? TRUE : FALSE); } else if (purple_conversation_get_type(conv) @@ -3419,13 +3394,66 @@ regenerate_media_items(PidginWindow *win) #endif } +static void +regenerate_attention_items(PidginWindow *win) +{ + GtkWidget *menu; + PurpleConversation *conv; + PurpleConnection *pc; + PurplePlugin *prpl = NULL; + PurplePluginProtocolInfo *prpl_info = NULL; + GList *list; + + conv = pidgin_conv_window_get_active_conversation(win); + if (!conv) + return; + + /* Remove the previous entries */ + gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.get_attention), NULL); + + pc = purple_conversation_get_connection(conv); + if (pc != NULL) + prpl = purple_connection_get_prpl(pc); + if (prpl != NULL) + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + + if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_attention_types)) { + list = prpl_info->get_attention_types(purple_connection_get_account(pc)); + + /* Multiple attention types */ + if (list && list->next) { + int index = 0; + + menu = gtk_menu_new(); + while (list) { + PurpleAttentionType *type; + GtkWidget *menuitem; + + type = list->data; + + menuitem = gtk_menu_item_new_with_label(purple_attention_type_get_name(type)); + g_object_set_data(G_OBJECT(menuitem), "index", GINT_TO_POINTER(index)); + g_signal_connect(G_OBJECT(menuitem), "activate", + G_CALLBACK(menu_get_attention_cb), + win); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + + index++; + list = g_list_delete_link(list, list); + } + + gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.get_attention), menu); + gtk_widget_show_all(menu); + } + } +} + static void regenerate_options_items(PidginWindow *win) { GtkWidget *menu; PidginConversation *gtkconv; GList *list; -#if GTK_CHECK_VERSION(2,6,0) GtkWidget *more_menu; gtkconv = pidgin_conv_window_get_active_gtkconv(win); @@ -3433,10 +3461,6 @@ regenerate_options_items(PidginWindow *win) "/Conversation/ConversationMenu/MoreMenu"); gtk_widget_show(more_menu); menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(more_menu)); -#else - gtkconv = pidgin_conv_window_get_active_gtkconv(win); - menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More")); -#endif /* Remove the previous entries */ for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; ) @@ -3492,12 +3516,8 @@ regenerate_plugins_items(PidginWindow *win) action_items = g_list_delete_link(action_items, action_items); } -#if GTK_CHECK_VERSION(2,6,0) item = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/OptionsMenu"); menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(item)); -#else - menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Options")); -#endif list = purple_conversation_get_extended_menu(conv); if (list) { @@ -3521,6 +3541,7 @@ static void menubar_activated(GtkWidget *item, gpointer data) regenerate_media_items(win); regenerate_options_items(win); regenerate_plugins_items(win); + regenerate_attention_items(win); /* The following are to make sure the 'More' submenu is not regenerated every time * the focus shifts from 'Conversations' to some other menu and back. */ @@ -3606,9 +3627,9 @@ setup_menubar(PidginWindow *win) gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/SendFile"); - g_object_set_data(G_OBJECT(win->window), "get_attention", + win->menu.get_attention = gtk_ui_manager_get_action(win->menu.ui, - "/Conversation/ConversationMenu/GetAttention")); + "/Conversation/ConversationMenu/GetAttention"); win->menu.add_pounce = gtk_ui_manager_get_action(win->menu.ui, @@ -3718,7 +3739,7 @@ got_typing_keypress(PidginConversation *gtkconv, gboolean first) time(NULL) > purple_conv_im_get_type_again(im))) { unsigned int timeout; - timeout = serv_send_typing(purple_conversation_get_gc(conv), + timeout = serv_send_typing(purple_conversation_get_connection(conv), purple_conversation_get_name(conv), PURPLE_TYPING); purple_conv_im_set_type_again(im, timeout); @@ -3754,10 +3775,10 @@ typing_animation(gpointer data) { break; } if (gtkwin->menu.typing_icon == NULL) { - gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU); - pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray), - gtkwin->menu.typing_icon, - _("User is typing...")); + gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU); + pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray), + gtkwin->menu.typing_icon, + _("User is typing...")); } else { gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU); } @@ -3769,6 +3790,8 @@ typing_animation(gpointer data) { static void update_typing_message(PidginConversation *gtkconv, const char *message) { + /* TODO WEBKIT: this is not handled at all */ +#if 0 GtkTextBuffer *buffer; GtkTextMark *stmark, *enmark; @@ -3801,6 +3824,7 @@ update_typing_message(PidginConversation *gtkconv, const char *message) gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_create_mark(buffer, "typing-notification-end", &iter, TRUE); } +#endif /* if 0 */ } static void @@ -3857,10 +3881,9 @@ update_send_to_selection(PidginWindow *win) if (win->menu.send_to == NULL) return FALSE; - if (!(b = purple_find_buddy(account, conv->name))) + if (!(b = purple_find_buddy(account, purple_conversation_get_name(conv)))) return FALSE; -#if 0 /* TODO */ gtk_widget_show(win->menu.send_to); menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(win->menu.send_to)); @@ -3882,7 +3905,6 @@ update_send_to_selection(PidginWindow *win) break; } } -#endif return FALSE; } @@ -3992,7 +4014,6 @@ compare_buddy_presence(PurplePresence *p1, PurplePresence *p2) static void generate_send_to_items(PidginWindow *win) { -#if 0 /* TODO */ GtkWidget *menu; GSList *group = NULL; GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -4019,8 +4040,8 @@ generate_send_to_items(PidginWindow *win) gtk_widget_show(menu); - if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_IM) { - buds = purple_find_buddies(gtkconv->active_conv->account, gtkconv->active_conv->name); + if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_IM) { + buds = purple_find_buddies(purple_conversation_get_account(gtkconv->active_conv), purple_conversation_get_name(gtkconv->active_conv)); if (buds == NULL) { @@ -4044,7 +4065,8 @@ generate_send_to_items(PidginWindow *win) continue; account = purple_buddy_get_account(buddy); - if (purple_account_is_connected(account) || account == gtkconv->active_conv->account) + /* TODO WEBKIT: (I'm not actually sure if this is webkit-related --Mark Doliner) */ + if (purple_account_is_connected(account) /*|| account == purple_conversation_get_account(gtkconv->active_conv)*/) { /* Use the PurplePresence to get unique buddies. */ PurplePresence *presence = purple_buddy_get_presence(buddy); @@ -4077,7 +4099,6 @@ generate_send_to_items(PidginWindow *win) if (!group) gtk_widget_set_sensitive(win->menu.send_to, FALSE); update_send_to_selection(win); -#endif } static const char * @@ -4104,10 +4125,11 @@ get_chat_buddy_status_icon(PurpleConvChat *chat, const char *name, PurpleConvCha static void deleting_chat_buddy_cb(PurpleConvChatBuddy *cb) { - if (cb->ui_data) { - GtkTreeRowReference *ref = cb->ui_data; + GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(cb); + + if (ref) { gtk_tree_row_reference_free(ref); - cb->ui_data = NULL; + purple_conv_chat_cb_set_ui_data(cb, NULL); } } @@ -4126,20 +4148,21 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c GtkTreeIter iter; gboolean is_me = FALSE; gboolean is_buddy; - gchar *tmp, *alias_key, *name, *alias; + const gchar *name, *alias; + gchar *tmp, *alias_key; PurpleConvChatBuddyFlags flags; GdkColor *color = NULL; - alias = cb->alias; - name = cb->name; - flags = cb->flags; + alias = purple_conv_chat_cb_get_alias(cb); + name = purple_conv_chat_cb_get_name(cb); + flags = purple_conv_chat_cb_get_flags(cb); chat = PURPLE_CONV_CHAT(conv); gtkconv = PIDGIN_CONVERSATION(conv); gtkchat = gtkconv->u.chat; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); - if (!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) + if (!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)))) return; tm = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); @@ -4147,20 +4170,23 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c stock = get_chat_buddy_status_icon(chat, name, flags); - if (!strcmp(chat->nick, purple_normalize(conv->account, old_name != NULL ? old_name : name))) + if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(purple_conversation_get_account(conv), old_name != NULL ? old_name : name))) is_me = TRUE; - is_buddy = cb->buddy; + is_buddy = purple_conv_chat_cb_is_buddy(cb); tmp = g_utf8_casefold(alias, -1); alias_key = g_utf8_collate_key(tmp, -1); g_free(tmp); if (is_me) { +#if 0 + /* TODO WEBKIT: No tags in webkit stuff, yet. */ GtkTextTag *tag = gtk_text_tag_table_lookup( - gtk_text_buffer_get_tag_table(GTK_IMHTML(gtkconv->imhtml)->text_buffer), + gtk_text_buffer_get_tag_table(GTK_IMHTML(gtkconv->webview)->text_buffer), "send-name"); g_object_get(tag, "foreground-gdk", &color, NULL); +#endif /* if 0 */ } else { GtkTextTag *tag; if ((tag = get_buddy_tag(conv, name, 0, FALSE))) @@ -4188,13 +4214,13 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1); - if (cb->ui_data) { - GtkTreeRowReference *ref = cb->ui_data; + if (purple_conv_chat_cb_get_ui_data(cb)) { + GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(cb); gtk_tree_row_reference_free(ref); } newpath = gtk_tree_model_get_path(tm, &iter); - cb->ui_data = gtk_tree_row_reference_new(tm, newpath); + purple_conv_chat_cb_set_ui_data(cb, gtk_tree_row_reference_new(tm, newpath)); gtk_tree_path_free(newpath); if (is_me && color) @@ -4224,7 +4250,7 @@ add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const c */ static void tab_complete_process_item(int *most_matched, const char *entered, gsize entered_bytes, char **partial, char *nick_partial, - GList **matches, char *name) + GList **matches, const char *name) { memcpy(nick_partial, name, entered_bytes); if (purple_utf8_strcasecmp(nick_partial, entered)) @@ -4346,7 +4372,7 @@ tab_complete(PurpleConversation *conv) /* Users */ for (; l != NULL; l = l->next) { tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, - &matches, ((PurpleConvChatBuddy *)l->data)->name); + &matches, purple_conv_chat_cb_get_name((PurpleConvChatBuddy *)l->data)); } @@ -4444,9 +4470,9 @@ static void topic_callback(GtkWidget *w, PidginConversation *gtkconv) char *new_topic; const char *current_topic; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); - if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) + if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)))) return; if(prpl_info->set_chat_topic == NULL) @@ -4521,6 +4547,7 @@ update_chat_alias(PurpleBuddy *buddy, PurpleConversation *conv, PurpleConnection { PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); + PurpleAccount *account = purple_conversation_get_account(conv); GtkTreeModel *model; char *normalized_name; GtkTreeIter iter; @@ -4535,23 +4562,23 @@ update_chat_alias(PurpleBuddy *buddy, PurpleConversation *conv, PurpleConnection if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) return; - normalized_name = g_strdup(purple_normalize(conv->account, buddy->name)); + normalized_name = g_strdup(purple_normalize(account, purple_buddy_get_name(buddy))); do { char *name; gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1); - if (!strcmp(normalized_name, purple_normalize(conv->account, name))) { + if (!strcmp(normalized_name, purple_normalize(account, name))) { const char *alias = name; char *tmp; char *alias_key = NULL; PurpleBuddy *buddy2; - if (strcmp(chat->nick, purple_normalize(conv->account, name))) { + if (strcmp(purple_conv_chat_get_nick(chat), purple_normalize(account, name))) { /* This user is not me, so look into updating the alias. */ - if ((buddy2 = purple_find_buddy(conv->account, name)) != NULL) { + if ((buddy2 = purple_find_buddy(account, name)) != NULL) { alias = purple_buddy_get_contact_alias(buddy2); } @@ -4586,10 +4613,10 @@ blist_node_aliased_cb(PurpleBlistNode *node, const char *old_alias, PurpleConver g_return_if_fail(node != NULL); g_return_if_fail(conv != NULL); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); g_return_if_fail(gc != NULL); - g_return_if_fail(gc->prpl != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + g_return_if_fail(purple_connection_get_prpl(gc) != NULL); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) return; @@ -4609,7 +4636,7 @@ blist_node_aliased_cb(PurpleBlistNode *node, const char *old_alias, PurpleConver else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) update_chat_alias((PurpleBuddy *)node, conv, gc, prpl_info); else if (PURPLE_BLIST_NODE_IS_CHAT(node) && - purple_conversation_get_account(conv) == ((PurpleChat*)node)->account) + purple_conversation_get_account(conv) == purple_chat_get_account((PurpleChat*)node)) { if (old_alias == NULL || g_utf8_collate(old_alias, purple_conversation_get_title(conv)) == 0) pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE); @@ -4638,14 +4665,14 @@ buddy_cb_common(PurpleBuddy *buddy, PurpleConversation *conv, gboolean is_buddy) if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) return; - normalized_name = g_strdup(purple_normalize(conv->account, buddy->name)); + normalized_name = g_strdup(purple_normalize(purple_conversation_get_account(conv), purple_buddy_get_name(buddy))); do { char *name; gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1); - if (!strcmp(normalized_name, purple_normalize(conv->account, name))) { + if (!strcmp(normalized_name, purple_normalize(purple_conversation_get_account(conv), name))) { gtk_list_store_set(GTK_LIST_STORE(model), &iter, CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1); g_free(name); @@ -4724,21 +4751,12 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv) GdkRectangle oneline; int height, diff; int pad_top, pad_inside, pad_bottom; - int total_height; - int max_height; + int total_height = (gtkconv->webview->allocation.height + gtkconv->entry->allocation.height); + int max_height = total_height / 2; int min_lines = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines"); int min_height; gboolean interior_focus; int focus_width; - GtkAllocation imhtml_allocation; - GtkAllocation entry_allocation; - GtkAllocation lower_hbox_allocation; - - gtk_widget_get_allocation(gtkconv->imhtml, &imhtml_allocation); - gtk_widget_get_allocation(gtkconv->entry, &entry_allocation); - gtk_widget_get_allocation(gtkconv->lower_hbox, &lower_hbox_allocation); - total_height = imhtml_allocation.height + entry_allocation.height; - max_height = total_height / 2; pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry)); pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry)); @@ -4772,15 +4790,12 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv) if (!interior_focus) height += 2 * focus_width; - diff = height - entry_allocation.height; + diff = height - gtkconv->entry->allocation.height; if (ABS(diff) < oneline.height / 2) return FALSE; - purple_debug_info("pidgin", "resizing to %d, %d lines, diff %d\n", - diff + lower_hbox_allocation.height, min_lines, diff); - gtk_widget_set_size_request(gtkconv->lower_hbox, -1, - diff + lower_hbox_allocation.height); + diff + gtkconv->lower_hbox->allocation.height); return FALSE; } @@ -4808,8 +4823,8 @@ static void setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox) { PurpleConversation *conv = gtkconv->active_conv; - PurpleConnection *gc = purple_conversation_get_gc(conv); - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + PurpleConnection *gc = purple_conversation_get_connection(conv); + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) { GtkWidget *hbox, *label; @@ -4827,7 +4842,7 @@ setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox) if(prpl_info->set_chat_topic == NULL) { gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); } else { - g_signal_connect(GTK_WIDGET(gtkchat->topic_text), "activate", + g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate", G_CALLBACK(topic_callback), gtkconv); } @@ -4850,7 +4865,7 @@ pidgin_conv_userlist_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path, PurpleAccount *account = purple_conversation_get_account(conv); char *who = NULL; - if (account->gc == NULL) + if (purple_account_get_connection(account) == NULL) return FALSE; if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path)) @@ -4858,8 +4873,8 @@ pidgin_conv_userlist_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path, gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); - node = (PurpleBlistNode*)(purple_find_buddy(conv->account, who)); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(purple_account_get_connection(account))); + node = (PurpleBlistNode*)(purple_find_buddy(purple_conversation_get_account(conv), who)); if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) pidgin_blist_draw_tooltip(node, gtkconv->infopane); @@ -4960,7 +4975,7 @@ setup_chat_userlist(PidginConversation *gtkconv, GtkWidget *hpaned) gtkchat->list = list; - gtk_box_pack_start(GTK_BOX(lbox), + gtk_box_pack_start(GTK_BOX(lbox), pidgin_make_scrollable(list, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1), TRUE, TRUE, 0); } @@ -4974,15 +4989,15 @@ pidgin_conv_create_tooltip(GtkWidget *tipwindow, gpointer userdata, int *w, int conv = gtkconv->active_conv; if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - node = (PurpleBlistNode*)(purple_blist_find_chat(conv->account, conv->name)); + node = (PurpleBlistNode*)(purple_blist_find_chat(purple_conversation_get_account(conv), purple_conversation_get_name(conv))); if (!node) - node = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_chat"); + node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat"); } else { - node = (PurpleBlistNode*)(purple_find_buddy(conv->account, conv->name)); + node = (PurpleBlistNode*)(purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv))); #if 0 /* Using the transient blist nodes to show the tooltip doesn't quite work yet. */ if (!node) - node = g_object_get_data(G_OBJECT(gtkconv->imhtml), "transient_buddy"); + node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_buddy"); #endif } @@ -4997,8 +5012,8 @@ pidgin_conv_end_quickfind(PidginConversation *gtkconv) { gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL); - gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml)); - gtk_widget_hide(gtkconv->quickfind.container); + webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(gtkconv->webview)); + gtk_widget_hide_all(gtkconv->quickfind.container); gtk_widget_grab_focus(gtkconv->entry); return TRUE; @@ -5008,9 +5023,9 @@ static gboolean quickfind_process_input(GtkWidget *entry, GdkEventKey *event, PidginConversation *gtkconv) { switch (event->keyval) { - case GDK_KEY_Return: - case GDK_KEY_KP_Enter: - if (gtk_imhtml_search_find(GTK_IMHTML(gtkconv->imhtml), gtk_entry_get_text(GTK_ENTRY(entry)))) { + case GDK_Return: + case GDK_KP_Enter: + if (webkit_web_view_search_text(WEBKIT_WEB_VIEW(gtkconv->webview), gtk_entry_get_text(GTK_ENTRY(entry)), FALSE, TRUE, TRUE)) { gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL); } else { GdkColor col; @@ -5020,7 +5035,7 @@ quickfind_process_input(GtkWidget *entry, GdkEventKey *event, PidginConversation gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, &col); } break; - case GDK_KEY_Escape: + case GDK_Escape: pidgin_conv_end_quickfind(gtkconv); break; default: @@ -5064,16 +5079,185 @@ pidgin_conv_setup_quickfind(PidginConversation *gtkconv, GtkWidget *container) /* }}} */ +static char * +replace_header_tokens(PurpleConversation *conv, const char *text) +{ + PurpleAccount *account = purple_conversation_get_account(conv); + GString *str; + const char *cur = text; + const char *prev = cur; + + if (text == NULL || *text == '\0') + return NULL; + + str = g_string_new(NULL); + while ((cur = strchr(cur, '%'))) { + const char *replace = NULL; + const char *fin = NULL; + + if (g_str_has_prefix(cur, "%chatName%")) { + replace = purple_conversation_get_name(conv); + + } else if (g_str_has_prefix(cur, "%sourceName%")) { + replace = purple_account_get_alias(account); + if (replace == NULL) + replace = purple_account_get_username(account); + + } else if (g_str_has_prefix(cur, "%destinationName%")) { + PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); + if (buddy) { + replace = purple_buddy_get_alias(buddy); + } else { + replace = purple_conversation_get_name(conv); + } + + } else if (g_str_has_prefix(cur, "%incomingIconPath%")) { + PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); + if (icon) + replace = purple_buddy_icon_get_full_path(icon); + + } else if (g_str_has_prefix(cur, "%outgoingIconPath%")) { + replace = purple_account_get_buddy_icon_path(account); + + } else if (g_str_has_prefix(cur, "%timeOpened")) { + const char *tmp = cur + strlen("%timeOpened"); + char *format = NULL; + if (*tmp == '{') { + const char *end; + tmp++; + end = strstr(tmp, "}%"); + if (!end) /* Invalid string */ + continue; + format = g_strndup(tmp, end - tmp); + fin = end + 1; + } + replace = purple_utf8_strftime(format ? format : "%X", NULL); + g_free(format); + + } else if (g_str_has_prefix(cur, "%dateOpened%")) { + replace = purple_date_format_short(NULL); + + } else { + cur++; + continue; + } + + /* Here we have a replacement to make */ + g_string_append_len(str, prev, cur - prev); + if (replace) + g_string_append(str, replace); + + /* And update the pointers */ + if (fin) { + prev = cur = fin + 1; + } else { + prev = cur = strchr(cur + 1, '%') + 1; + } + } + + /* And wrap it up */ + g_string_append(str, prev); + return g_string_free(str, FALSE); +} + +static char * +replace_template_tokens(PidginConvTheme *theme, const char *header, const char *footer) +{ + GString *str; + const char *text; + char **ms; + char *path; + + text = pidgin_conversation_theme_get_template(theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN); + if (text == NULL) + return NULL; + + ms = g_strsplit(text, "%@", 6); + if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { + g_strfreev(ms); + return NULL; + } + + str = g_string_new(NULL); + + g_string_append(str, ms[0]); + g_string_append(str, "file://"); + path = pidgin_conversation_theme_get_template_path(theme); + g_string_append(str, path); + g_free(path); + + g_string_append(str, ms[1]); + + text = pidgin_conversation_theme_get_template(theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_BASESTYLE_CSS); + g_string_append(str, text); + + g_string_append(str, ms[2]); + + g_string_append(str, "file://"); + path = pidgin_conversation_theme_get_css_path(theme); + g_string_append(str, path); + g_free(path); + + g_string_append(str, ms[3]); + if (header) + g_string_append(str, header); + g_string_append(str, ms[4]); + if (footer) + g_string_append(str, footer); + g_string_append(str, ms[5]); + + g_strfreev(ms); + + return g_string_free(str, FALSE); +} + +static void +set_theme_webkit_settings(WebKitWebView *webview, PidginConvTheme *theme) +{ + WebKitWebSettings *settings; + const GValue *val; + + g_object_get(G_OBJECT(webview), "settings", &settings, NULL); + + val = pidgin_conversation_theme_lookup(theme, "DefaultFontFamily", TRUE); + if (val && G_VALUE_HOLDS_STRING(val)) + g_object_set(G_OBJECT(settings), "default-font-family", g_value_get_string(val), NULL); + + val = pidgin_conversation_theme_lookup(theme, "DefaultFontSize", TRUE); + if (val && G_VALUE_HOLDS_INT(val)) + g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(g_value_get_int(val)), NULL); + + val = pidgin_conversation_theme_lookup(theme, "DefaultBackgroundIsTransparent", TRUE); + if (val && G_VALUE_HOLDS_BOOLEAN(val)) + /* this does not work :( */ + webkit_web_view_set_transparent(webview, g_value_get_boolean(val)); +} + +static void +conv_variant_changed_cb(GObject *gobject, GParamSpec *pspec, gpointer user_data) +{ + PidginConversation *gtkconv = user_data; + const char *path; + char *js; + + path = pidgin_conversation_theme_get_css_path(PIDGIN_CONV_THEME(gobject)); + js = g_strdup_printf("setStylesheet(\"mainStyle\", \"file://%s\");", path); + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), js); + g_free(js); +} + static GtkWidget * setup_common_pane(PidginConversation *gtkconv) { - GtkWidget *vbox, *frame, *imhtml_sw, *event_box; + GtkWidget *vbox, *frame, *webview_sw, *event_box; GtkCellRenderer *rend; GtkTreePath *path; PurpleConversation *conv = gtkconv->active_conv; PurpleBuddy *buddy; - gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT); + gboolean chat = (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT); int buddyicon_size = 0; + char *header, *footer; + char *template; /* Setup the top part of the pane */ vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -5163,9 +5347,41 @@ setup_common_pane(PidginConversation *gtkconv) gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gtkconv->infopane), rend, "pixbuf", CONV_EMBLEM_COLUMN, NULL); g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL); - /* Setup the gtkimhtml widget */ - frame = pidgin_create_imhtml(FALSE, >kconv->imhtml, NULL, &imhtml_sw); - gtk_widget_set_size_request(gtkconv->imhtml, -1, 0); + /* Setup the webkit widget */ + frame = pidgin_create_webview(FALSE, >kconv->webview, NULL, &webview_sw); + gtk_widget_set_size_request(gtkconv->webview, -1, 0); + + header = replace_header_tokens(conv, + pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER)); + footer = replace_header_tokens(conv, + pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER)); + template = replace_template_tokens(gtkconv->theme, header, footer); + g_free(header); + g_free(footer); + + if (template != NULL) { + char *basedir; + char *baseuri; + + purple_debug_info("webkit", "template: %s\n", template); + + set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), gtkconv->theme); + + basedir = pidgin_conversation_theme_get_template_path(gtkconv->theme); + baseuri = g_strdup_printf("file://%s", basedir); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(gtkconv->webview), template, "text/html", "UTF-8", baseuri); + + if (chat) + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), "document.getElementById('Chat').className = 'groupchat'"); + + g_signal_connect(G_OBJECT(gtkconv->theme), "notify::variant", + G_CALLBACK(conv_variant_changed_cb), gtkconv); + + g_free(basedir); + g_free(baseuri); + g_free(template); + } + if (chat) { GtkWidget *hpaned; @@ -5183,19 +5399,16 @@ setup_common_pane(PidginConversation *gtkconv) } else { gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); } - gtk_widget_show(frame); - - gtk_widget_set_name(gtkconv->imhtml, "pidgin_conv_imhtml"); - gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),TRUE); - g_object_set_data(G_OBJECT(gtkconv->imhtml), "gtkconv", gtkconv); + gtk_widget_show_all(frame); - g_object_set(G_OBJECT(imhtml_sw), "vscrollbar-policy", GTK_POLICY_ALWAYS, NULL); + gtk_widget_set_name(gtkconv->webview, "pidgin_conv_webview"); + g_object_set_data(G_OBJECT(gtkconv->webview), "gtkconv", gtkconv); - g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", + g_signal_connect_after(G_OBJECT(gtkconv->webview), "button_press_event", G_CALLBACK(entry_stop_rclick_cb), NULL); - g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_press_event", + g_signal_connect(G_OBJECT(gtkconv->webview), "key_press_event", G_CALLBACK(refocus_entry_cb), gtkconv); - g_signal_connect(G_OBJECT(gtkconv->imhtml), "key_release_event", + g_signal_connect(G_OBJECT(gtkconv->webview), "key_release_event", G_CALLBACK(refocus_entry_cb), gtkconv); pidgin_conv_setup_quickfind(gtkconv, vbox); @@ -5211,7 +5424,7 @@ setup_common_pane(PidginConversation *gtkconv) gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), - purple_account_get_protocol_name(conv->account)); + purple_account_get_protocol_name(purple_conversation_get_account(conv))); g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", G_CALLBACK(entry_popup_menu_cb), gtkconv); @@ -5258,11 +5471,9 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, PurpleConversation *c; PurpleAccount *convaccount = purple_conversation_get_account(conv); PurpleConnection *gc = purple_account_get_connection(convaccount); - PurplePluginProtocolInfo *prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; - GdkAtom target = gtk_selection_data_get_target(sd); - const guchar *data = gtk_selection_data_get_data(sd); + PurplePluginProtocolInfo *prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)) : NULL; - if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) + if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { PurpleBlistNode *n = NULL; PurpleBuddy *b; @@ -5270,7 +5481,7 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, PurpleAccount *buddyaccount; const char *buddyname; - n = *(PurpleBlistNode **) data; + n = *(PurpleBlistNode **)sd->data; if (PURPLE_BLIST_NODE_IS_CONTACT(n)) b = purple_contact_get_priority_buddy((PurpleContact*)n); @@ -5318,17 +5529,16 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, pidgin_conv_window_switch_gtkconv(win, gtkconv); } - gtk_drag_finish(dc, TRUE, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } - else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) + else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) { char *protocol = NULL; char *username = NULL; PurpleAccount *account; PidginConversation *gtkconv; - if (pidgin_parse_x_im_contact((const char *) data, FALSE, &account, + if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, &protocol, &username, NULL)) { if (account == NULL) @@ -5359,14 +5569,12 @@ conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, g_free(username); g_free(protocol); - gtk_drag_finish(dc, TRUE, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } - else if (target == gdk_atom_intern("text/uri-list", FALSE)) { + else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) pidgin_dnd_file_manage(sd, convaccount, purple_conversation_get_name(conv)); - gtk_drag_finish(dc, TRUE, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } else gtk_drag_finish(dc, FALSE, FALSE, t); @@ -5383,7 +5591,7 @@ static const GtkTargetEntry te[] = static PidginConversation * pidgin_conv_find_gtkconv(PurpleConversation * conv) { - PurpleBuddy *bud = purple_find_buddy(conv->account, conv->name); + PurpleBuddy *bud = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); PurpleContact *c; PurpleBlistNode *cn, *bn; @@ -5397,9 +5605,9 @@ pidgin_conv_find_gtkconv(PurpleConversation * conv) for (bn = purple_blist_node_get_first_child(cn); bn; bn = purple_blist_node_get_sibling_next(bn)) { PurpleBuddy *b = PURPLE_BUDDY(bn); PurpleConversation *conv; - if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account))) { - if (conv->ui_data) - return conv->ui_data; + if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(b), purple_buddy_get_account(b)))) { + if (PIDGIN_CONVERSATION(conv)) + return PIDGIN_CONVERSATION(conv); } } @@ -5441,6 +5649,8 @@ ignore_middle_click(GtkWidget *widget, GdkEventButton *e, gpointer null) static void set_typing_font(GtkWidget *widget, GtkStyle *style, PidginConversation *gtkconv) { +/* TODO WEBKIT */ +#if 0 static PangoFontDescription *font_desc = NULL; static GdkColor *color = NULL; static gboolean enable = TRUE; @@ -5471,6 +5681,7 @@ static void set_typing_font(GtkWidget *widget, GtkStyle *style, PidginConversati } g_signal_handlers_disconnect_by_func(G_OBJECT(widget), set_typing_font, gtkconv); +#endif /* if 0 */ } /************************************************************************** @@ -5480,14 +5691,14 @@ static void private_gtkconv_new(PurpleConversation *conv, gboolean hidden) { PidginConversation *gtkconv; + PurpleTheme *theme; PurpleConversationType conv_type = purple_conversation_get_type(conv); GtkWidget *pane = NULL; GtkWidget *tab_cont; PurpleBlistNode *convnode; - PurpleValue *value; if (conv_type == PURPLE_CONV_TYPE_IM && (gtkconv = pidgin_conv_find_gtkconv(conv))) { - conv->ui_data = gtkconv; + purple_conversation_set_ui_data(conv, gtkconv); if (!g_list_find(gtkconv->convs, conv)) gtkconv->convs = g_list_prepend(gtkconv->convs, conv); pidgin_conv_switch_active_conversation(conv); @@ -5495,7 +5706,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) } gtkconv = g_new0(PidginConversation, 1); - conv->ui_data = gtkconv; + purple_conversation_set_ui_data(conv, gtkconv); gtkconv->active_conv = conv; gtkconv->convs = g_list_prepend(gtkconv->convs, conv); gtkconv->send_history = g_list_append(NULL, NULL); @@ -5506,6 +5717,11 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) #endif gtkconv->unseen_state = PIDGIN_UNSEEN_NONE; gtkconv->unseen_count = 0; + theme = purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme"), "conversation"); + if (!theme) + theme = purple_theme_manager_find_theme("Default", "conversation"); + gtkconv->theme = PIDGIN_CONV_THEME(g_object_ref(theme)); + gtkconv->last_flags = 0; if (conv_type == PURPLE_CONV_TYPE_IM) { gtkconv->u.im = g_malloc0(sizeof(PidginImPane)); @@ -5514,9 +5730,6 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) } pane = setup_common_pane(gtkconv); - gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->imhtml), - gtk_imhtml_get_format_functions(GTK_IMHTML(gtkconv->imhtml)) | GTK_IMHTML_IMAGE); - if (pane == NULL) { if (conv_type == PURPLE_CONV_TYPE_CHAT) g_free(gtkconv->u.chat); @@ -5524,7 +5737,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) g_free(gtkconv->u.im); g_free(gtkconv); - conv->ui_data = NULL; + purple_conversation_set_ui_data(conv, NULL); return; } @@ -5539,7 +5752,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) GTK_DEST_DEFAULT_DROP, te, sizeof(te) / sizeof(GtkTargetEntry), GDK_ACTION_COPY); - gtk_drag_dest_set(gtkconv->imhtml, 0, + gtk_drag_dest_set(gtkconv->webview, 0, te, sizeof(te) / sizeof(GtkTargetEntry), GDK_ACTION_COPY); @@ -5551,12 +5764,12 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) G_CALLBACK(ignore_middle_click), NULL); g_signal_connect(G_OBJECT(pane), "drag_data_received", G_CALLBACK(conv_dnd_recv), gtkconv); - g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", + g_signal_connect(G_OBJECT(gtkconv->webview), "drag_data_received", G_CALLBACK(conv_dnd_recv), gtkconv); g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", G_CALLBACK(conv_dnd_recv), gtkconv); - g_signal_connect(gtkconv->imhtml, "style-set", G_CALLBACK(set_typing_font), gtkconv); + g_signal_connect(gtkconv->webview, "style-set", G_CALLBACK(set_typing_font), gtkconv); /* Setup the container for the tab. */ gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -5569,11 +5782,9 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) if (convnode == NULL || !purple_blist_node_get_bool(convnode, "gtk-mute-sound")) gtkconv->make_sound = TRUE; - if (convnode != NULL && - (value = g_hash_table_lookup(convnode->settings, "enable-logging")) && - purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) - { - purple_conversation_set_logging(conv, purple_value_get_boolean(value)); + if (convnode != NULL) { + gboolean logging = purple_blist_node_get_bool(convnode, "enable-logging"); + purple_conversation_set_logging(conv, logging); } if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar")) @@ -5586,10 +5797,6 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) else gtk_widget_hide(gtkconv->infopane_hbox); - gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); - gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), - purple_account_get_protocol_name(conv->account)); g_signal_connect_swapped(G_OBJECT(pane), "focus", G_CALLBACK(gtk_widget_grab_focus), @@ -5602,10 +5809,10 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) if (nick_colors == NULL) { nbr_nick_colors = NUM_NICK_COLORS; - nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->imhtml)->base[GTK_STATE_NORMAL]); + nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->webview)->base[GTK_STATE_NORMAL]); } - if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) + if (purple_conversation_get_features(conv) & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) pidgin_themes_smiley_themeize_custom(gtkconv->entry); } @@ -5718,6 +5925,10 @@ pidgin_conv_destroy(PurpleConversation *conv) g_source_remove(gtkconv->attach.timer); } + g_object_disconnect(G_OBJECT(gtkconv->theme), "any_signal::notify", + conv_variant_changed_cb, gtkconv, NULL); + g_object_unref(gtkconv->theme); + g_free(gtkconv); } @@ -5745,6 +5956,7 @@ pidgin_conv_write_im(PurpleConversation *conv, const char *who, purple_conversation_write(conv, who, message, flags, mtime); } +#if 0 static const char * get_text_tag_color(GtkTextTag *tag) { @@ -5772,37 +5984,33 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, GdkEventButton *btn_event = (GdkEventButton*) event; PurpleConversation *conv = data; char *buddyname; - gchar *name; - - g_object_get(G_OBJECT(tag), "name", &name, NULL); /* strlen("BUDDY " or "HILIT ") == 6 */ - g_return_val_if_fail((name != NULL) && (strlen(name) > 6), FALSE); + g_return_val_if_fail((tag->name != NULL) + && (strlen(tag->name) > 6), FALSE); - buddyname = name + 6; + buddyname = (tag->name) + 6; /* emit chat-nick-clicked signal */ if (event->type == GDK_BUTTON_PRESS) { gint plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( pidgin_conversations_get_handle(), "chat-nick-clicked", data, buddyname, btn_event->button)); - if (plugin_return) { - g_free(name); + if (plugin_return) return TRUE; - } } - if (btn_event->button == 1 && event->type == GDK_2BUTTON_PRESS) { + if (btn_event->button == 1 && + event->type == GDK_2BUTTON_PRESS) { chat_do_im(PIDGIN_CONVERSATION(conv), buddyname); - g_free(name); - return TRUE; - } else if (btn_event->button == 2 && event->type == GDK_2BUTTON_PRESS) { + } else if (btn_event->button == 2 + && event->type == GDK_2BUTTON_PRESS) { chat_do_info(PIDGIN_CONVERSATION(conv), buddyname); - g_free(name); return TRUE; - } else if (btn_event->button == 3 && event->type == GDK_BUTTON_PRESS) { + } else if (btn_event->button == 3 + && event->type == GDK_BUTTON_PRESS) { GtkTextIter start, end; /* we shouldn't display the popup @@ -5812,7 +6020,7 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, &start, &end)) { GtkWidget *menu = NULL; PurpleConnection *gc = - purple_conversation_get_gc(conv); + purple_conversation_get_connection(conv); menu = create_chat_menu(conv, buddyname, gc); @@ -5821,22 +6029,21 @@ static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, btn_event->button, btn_event->time); - g_free(name); - /* Don't propagate the event any further */ return TRUE; } } - - g_free(name); } return FALSE; } +#endif static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, PurpleMessageFlags flag, gboolean create) { +/* TODO WEBKIT */ +#if 0 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); GtkTextTag *buddytag; gchar *str; @@ -5870,8 +6077,11 @@ static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, Purp g_free(str); return buddytag; +#endif /* if 0 */ + return NULL; } +#if 0 static void pidgin_conv_calculate_newday(PidginConversation *gtkconv, time_t mtime) { struct tm *tm = localtime(&mtime); @@ -5917,6 +6127,111 @@ str_embed_direction_chars(char **str) *str = ret; #endif } +#endif + +static char * +replace_message_tokens( + const char *text, + PurpleConversation *conv, + const char *name, + const char *alias, + const char *message, + PurpleMessageFlags flags, + time_t mtime) +{ + GString *str; + const char *cur = text; + const char *prev = cur; + + if (text == NULL) + return g_strdup(""); + + str = g_string_new(NULL); + while ((cur = strchr(cur, '%'))) { + const char *replace = NULL; + const char *fin = NULL; + + if (g_str_has_prefix(cur, "%message%")) { + replace = message; + + } else if (g_str_has_prefix(cur, "%messageClasses%")) { + replace = flags & PURPLE_MESSAGE_SEND ? "outgoing" : + flags & PURPLE_MESSAGE_RECV ? "incoming" : "event"; + + } else if (g_str_has_prefix(cur, "%time")) { + const char *tmp = cur + strlen("%time"); + char *format = NULL; + if (*tmp == '{') { + char *end; + tmp++; + end = strstr(tmp, "}%"); + if (!end) /* Invalid string */ + continue; + format = g_strndup(tmp, end - tmp); + fin = end + 1; + } + replace = purple_utf8_strftime(format ? format : "%X", NULL); + g_free(format); + + } else if (g_str_has_prefix(cur, "%shortTime%")) { + replace = purple_utf8_strftime("%H:%M", NULL); + + } else if (g_str_has_prefix(cur, "%userIconPath%")) { + if (flags & PURPLE_MESSAGE_SEND) { + if (purple_account_get_bool(purple_conversation_get_account(conv), "use-global-buddyicon", TRUE)) { + replace = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon"); + } else { + PurpleStoredImage *img = purple_buddy_icons_find_account_icon(purple_conversation_get_account(conv)); + replace = purple_imgstore_get_filename(img); + } + if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { + replace = g_build_filename("Outgoing", "buddy_icon.png", NULL); + } + } else if (flags & PURPLE_MESSAGE_RECV) { + PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); + if (icon) + replace = purple_buddy_icon_get_full_path(icon); + if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { + replace = g_build_filename("Incoming", "buddy_icon.png", NULL); + } + } + + } else if (g_str_has_prefix(cur, "%senderScreenName%")) { + replace = name; + + } else if (g_str_has_prefix(cur, "%sender%")) { + replace = alias; + + } else if (g_str_has_prefix(cur, "%service%")) { + replace = purple_account_get_protocol_name(purple_conversation_get_account(conv)); + + } else if (g_str_has_prefix(cur, "%messageDirection%")) { + replace = purple_markup_is_rtl(message) ? "rtl" : "ltr"; + + } else { + cur++; + continue; + } + + /* Here we have a replacement to make */ + g_string_append_len(str, prev, cur - prev); + if (replace) + g_string_append(str, replace); + + /* And update the pointers */ + if (fin) { + prev = cur = fin + 1; + } else { + prev = cur = strchr(cur + 1, '%') + 1; + } + + } + + /* And wrap it up */ + g_string_append(str, prev); + + return g_string_free(str, FALSE); +} static void pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *alias, @@ -5926,23 +6241,31 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a PidginConversation *gtkconv; PurpleConnection *gc; PurpleAccount *account; +#if 0 int gtk_font_options = 0; int gtk_font_options_all = 0; - int max_scrollback_lines; - int line_count; char buf2[BUF_LONG]; gboolean show_date; char *mdate; char *str; char *with_font_tag; char *sml_attrib = NULL; +#endif size_t length; PurpleConversationType type; char *displaying; gboolean plugin_return; - char *bracket; - int tag_count = 0; +#if 0 gboolean is_rtl_message = FALSE; +#endif + + const char *message_html; + char *msg; + char *escape; + char *script; + char *smileyed; + PurpleMessageFlags old_flags; + const char *func = "appendMessage"; g_return_if_fail(conv != NULL); gtkconv = PIDGIN_CONVERSATION(conv); @@ -5999,56 +6322,39 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a } length = strlen(displaying) + 1; - /* Awful hack to work around GtkIMHtml's inefficient rendering of messages with lots of formatting changes. - * If a message has over 100 '<' characters, strip formatting before appending it. Hopefully nobody actually - * needs that much formatting, anyway. - */ - for (bracket = strchr(displaying, '<'); bracket && *(bracket + 1); bracket = strchr(bracket + 1, '<')) - tag_count++; - - if (tag_count > 100) { - char *tmp = displaying; - displaying = purple_markup_strip_html(tmp); - g_free(tmp); - } - - line_count = gtk_text_buffer_get_line_count( - gtk_text_view_get_buffer(GTK_TEXT_VIEW( - gtkconv->imhtml))); - - max_scrollback_lines = purple_prefs_get_int( - PIDGIN_PREFS_ROOT "/conversations/scrollback_lines"); - /* If we're sitting at more than 100 lines more than the - max scrollback, trim down to max scrollback */ - if (max_scrollback_lines > 0 - && line_count > (max_scrollback_lines + 100)) { - GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( - GTK_TEXT_VIEW(gtkconv->imhtml)); - GtkTextIter start, end; - - gtk_text_buffer_get_start_iter(text_buffer, &start); - gtk_text_buffer_get_iter_at_line(text_buffer, &end, - (line_count - max_scrollback_lines)); - gtk_imhtml_delete(GTK_IMHTML(gtkconv->imhtml), &start, &end); + old_flags = gtkconv->last_flags; + if ((flags & PURPLE_MESSAGE_SEND) && (old_flags & PURPLE_MESSAGE_SEND)) { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT); + func = "appendNextMessage"; + } else if (flags & PURPLE_MESSAGE_SEND) { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT); + } else if ((flags & PURPLE_MESSAGE_RECV) && (old_flags & PURPLE_MESSAGE_RECV)) { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT); + func = "appendNextMessage"; + } else if (flags & PURPLE_MESSAGE_RECV) { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); + } else { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS); } + gtkconv->last_flags = flags; - if (type == PURPLE_CONV_TYPE_CHAT) - { - /* Create anchor for user */ - GtkTextIter iter; - char *tmp = g_strconcat("user:", name, NULL); + smileyed = smiley_parse_markup(message, purple_account_get_protocol_id(account)); + msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime); + escape = gtk_webview_quote_js_string(msg); + script = g_strdup_printf("%s(%s)", func, escape); - gtk_text_buffer_get_end_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)), &iter); - gtk_text_buffer_create_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)), - tmp, &iter, TRUE); - g_free(tmp); - } + purple_debug_info("webkit", "JS: %s\n", script); + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), script); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling")) - gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING; + g_free(script); + g_free(smileyed); + g_free(msg); + g_free(escape); - if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "
", gtk_font_options_all | GTK_IMHTML_NO_SCROLL); +#if 0 + /* if the buffer is not empty add a
*/ + if (!gtk_webview_is_empty(GTK_WEBVIEW(gtkconv->webview))) + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "
"); /* First message in a conversation. */ if (gtkconv->newday == 0) @@ -6091,40 +6397,40 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a gtk_font_options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES | GTK_IMHTML_NO_FORMATTING; /* this is gonna crash one day, I can feel it. */ - if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(conv->account)))->options & + if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(purple_conversation_get_account(conv))))->options & OPT_PROTO_USE_POINTSIZE) { gtk_font_options |= GTK_IMHTML_USE_POINTSIZE; } - if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) + if (!(flags & PURPLE_MESSAGE_RECV) && (purple_conversation_get_features(conv) & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) { /* We want to see our own smileys. Need to revert it after send*/ - pidgin_themes_smiley_themeize_custom(gtkconv->imhtml); + pidgin_themes_smiley_themeize_custom(gtkconv->webview); } /* TODO: These colors should not be hardcoded so log.c can use them */ if (flags & PURPLE_MESSAGE_RAW) { - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, gtk_font_options_all); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), message); } else if (flags & PURPLE_MESSAGE_SYSTEM) { g_snprintf(buf2, sizeof(buf2), - "%s", + "%s%s", sml_attrib ? sml_attrib : "", mdate, displaying); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), buf2); } else if (flags & PURPLE_MESSAGE_ERROR) { g_snprintf(buf2, sizeof(buf2), - "%s", + "%s %s", sml_attrib ? sml_attrib : "", mdate, displaying); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), buf2); } else if (flags & PURPLE_MESSAGE_NO_LOG) { g_snprintf(buf2, BUF_LONG, - "%s", + "%s", sml_attrib ? sml_attrib : "", displaying); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), buf2); } else { char *new_message = g_memdup(displaying, length); char *alias_escaped = (alias ? g_markup_escape_text(alias, strlen(alias)) : g_strdup("")); @@ -6134,11 +6440,6 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a int tag_end_offset = 0; const char *tagname = NULL; - GtkTextIter start, end; - GtkTextMark *mark; - GtkTextTag *tag; - GtkTextBuffer *buffer = GTK_IMHTML(gtkconv->imhtml)->text_buffer; - /* Enforce direction on alias */ if (is_rtl_message) str_embed_direction_chars(&alias_escaped); @@ -6199,55 +6500,41 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a g_free(alias_escaped); + /* TODO WEBKIT */ +#if 0 if (tagname) tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), tagname); else tag = get_buddy_tag(conv, name, flags, TRUE); if (GTK_IMHTML(gtkconv->imhtml)->show_comments) { + { /* The color for the timestamp has to be set in the font-tags, unfortunately. * Applying the nick-tag to timestamps would work, but that can make it * bold. I thought applying the "comment" tag again, which has "weight" set * to PANGO_WEIGHT_NORMAL, would remove the boldness. But it doesn't. So * this will have to do. I don't terribly like it. -- sadrul */ - const char *color = get_text_tag_color(tag); + /* const char *color = get_text_tag_color(tag); */ g_snprintf(buf2, BUF_LONG, "", color ? "COLOR=\"" : "", color ? color : "", color ? "\"" : "", mdate); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL); + gtk_webview_append_html (GTK_WEBVIEW(gtkconv->webview), buf2); } - - gtk_text_buffer_get_end_iter(buffer, &end); - mark = gtk_text_buffer_create_mark(buffer, NULL, &end, TRUE); - - g_snprintf(buf2, BUF_LONG, "%s ", sml_attrib ? sml_attrib : "", str); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL); - - gtk_text_buffer_get_end_iter(buffer, &end); - gtk_text_buffer_get_iter_at_mark(buffer, &start, mark); - gtk_text_buffer_apply_tag(buffer, tag, &start, &end); - gtk_text_buffer_delete_mark(buffer, mark); +#endif /* if 0 */ + g_snprintf(buf2, BUF_LONG, "%s ", sml_attrib ? sml_attrib : "", str); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), buf2); g_free(str); - if(gc){ + if (gc) { char *pre = g_strdup_printf("", sml_attrib ? sml_attrib : ""); char *post = ""; - int pre_len = strlen(pre); - int post_len = strlen(post); - - with_font_tag = g_malloc(length + pre_len + post_len + 1); - - strcpy(with_font_tag, pre); - memcpy(with_font_tag + pre_len, new_message, length); - strcpy(with_font_tag + pre_len + length, post); - - length += pre_len + post_len; + with_font_tag = g_strdup_printf("%s%s%s", pre, new_message, post); g_free(pre); } else with_font_tag = g_memdup(new_message, length); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), - with_font_tag, gtk_font_options | gtk_font_options_all); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), + with_font_tag); g_free(with_font_tag); g_free(new_message); @@ -6256,6 +6543,8 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a g_free(mdate); g_free(sml_attrib); +#endif + /* Tab highlighting stuff */ if (!(flags & PURPLE_MESSAGE_SEND) && !pidgin_conv_has_focus(conv)) { @@ -6274,11 +6563,13 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a gtkconv_set_unseen(gtkconv, unseen); } - if (!(flags & PURPLE_MESSAGE_RECV) && (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) +#if 0 + if (!(flags & PURPLE_MESSAGE_RECV) && (purple_conversation_get_features(conv) & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)) { /* Restore the smiley-data */ - pidgin_themes_smiley_themeize(gtkconv->imhtml); + pidgin_themes_smiley_themeize(gtkconv->webview); } +#endif purple_signal_emit(pidgin_conversations_get_handle(), (type == PURPLE_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"), @@ -6289,7 +6580,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a static gboolean get_iter_from_chatbuddy(PurpleConvChatBuddy *cb, GtkTreeIter *iter) { - GtkTreeRowReference *ref = cb->ui_data; + GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(cb); GtkTreePath *path; GtkTreeModel *model; @@ -6373,23 +6664,23 @@ pidgin_conv_chat_rename_user(PurpleConversation *conv, const char *old_name, if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) return; - old_cbuddy = purple_conv_chat_cb_find(chat, old_name); - if (get_iter_from_chatbuddy(old_cbuddy, &iter)) { - GtkTreeRowReference *ref = old_cbuddy->ui_data; - - gtk_list_store_remove(GTK_LIST_STORE(model), &iter); - gtk_tree_row_reference_free(ref); - old_cbuddy->ui_data = NULL; - } - if ((tag = get_buddy_tag(conv, old_name, 0, FALSE))) g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL); if ((tag = get_buddy_tag(conv, old_name, PURPLE_MESSAGE_NICK, FALSE))) g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL); + old_cbuddy = purple_conv_chat_cb_find(chat, old_name); if (!old_cbuddy) return; + if (get_iter_from_chatbuddy(old_cbuddy, &iter)) { + GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(old_cbuddy); + + gtk_list_store_remove(GTK_LIST_STORE(model), &iter); + gtk_tree_row_reference_free(ref); + purple_conv_chat_cb_set_ui_data(old_cbuddy, NULL); + } + g_return_if_fail(new_alias != NULL); new_cbuddy = purple_conv_chat_cb_find(chat, new_name); @@ -6473,10 +6764,10 @@ pidgin_conv_chat_update_user(PurpleConversation *conv, const char *user) cbuddy = purple_conv_chat_cb_find(chat, user); if (get_iter_from_chatbuddy(cbuddy, &iter)) { - GtkTreeRowReference *ref = cbuddy->ui_data; + GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(cbuddy); gtk_list_store_remove(GTK_LIST_STORE(model), &iter); gtk_tree_row_reference_free(ref); - cbuddy->ui_data = NULL; + purple_conv_chat_cb_set_ui_data(cbuddy, NULL); } if (cbuddy) @@ -6522,6 +6813,13 @@ add_custom_smiley_for_imhtml(GtkIMHtml *imhtml, const char *sml, const char *smi return TRUE; } +static gboolean +add_custom_smiley_for_webview(GtkWebView *webview, const char *sml, const char *smile) +{ + /* TODO WEBKIT: Smileys need to be added to webkit stuff */ + return TRUE; +} + static gboolean pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gboolean remote) { @@ -6539,7 +6837,7 @@ pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gbool /* If possible add this smiley to the current theme. * The addition is only temporary: custom smilies aren't saved to disk. */ - conv_sml = purple_account_get_protocol_name(conv->account); + conv_sml = purple_account_get_protocol_name(purple_conversation_get_account(conv)); gtkconv = PIDGIN_CONVERSATION(conv); for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) { @@ -6549,7 +6847,7 @@ pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gbool } } - if (!add_custom_smiley_for_imhtml(GTK_IMHTML(gtkconv->imhtml), sml, smile)) + if (!add_custom_smiley_for_webview(GTK_WEBVIEW(gtkconv->webview), sml, smile)) return FALSE; if (!remote) /* If it's a local custom smiley, then add it for the entry */ @@ -6563,12 +6861,14 @@ static void pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, const guchar *data, gsize size) { +/* TODO WEBKIT */ +#if 0 PidginConversation *gtkconv; GtkIMHtmlSmiley *smiley; const char *sml; GError *error = NULL; - sml = purple_account_get_protocol_name(conv->account); + sml = purple_account_get_protocol_name(purple_conversation_get_account(conv)); gtkconv = PIDGIN_CONVERSATION(conv); smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); @@ -6584,7 +6884,7 @@ pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, if (!gdk_pixbuf_loader_write(smiley->loader, data, size, &error) || error) { purple_debug_warning("gtkconv", "gdk_pixbuf_loader_write() " - "failed with size=%zu: %s\n", size, + "failed with size=%" G_GSIZE_FORMAT ": %s\n", size, error ? error->message : "(no error message)"); if (error) g_error_free(error); @@ -6597,11 +6897,14 @@ pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, g_object_unref(G_OBJECT(smiley->loader)); smiley->loader = gdk_pixbuf_loader_new(); } +#endif /* if 0 */ } static void pidgin_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) { +/* TODO WEBKIT */ +#if 0 PidginConversation *gtkconv; GtkIMHtmlSmiley *smiley; const char *sml; @@ -6610,7 +6913,7 @@ pidgin_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) g_return_if_fail(conv != NULL); g_return_if_fail(smile != NULL); - sml = purple_account_get_protocol_name(conv->account); + sml = purple_account_get_protocol_name(purple_conversation_get_account(conv)); gtkconv = PIDGIN_CONVERSATION(conv); smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); @@ -6638,6 +6941,7 @@ pidgin_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) g_object_unref(G_OBJECT(smiley->loader)); smiley->loader = gdk_pixbuf_loader_new(); } +#endif /* if 0 */ } static void @@ -6665,11 +6969,11 @@ gray_stuff_out(PidginConversation *gtkconv) PurpleAccount *account; win = pidgin_conv_get_window(gtkconv); - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); account = purple_conversation_get_account(conv); if (gc != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (win->menu.send_to != NULL) update_send_to_selection(win); @@ -6688,7 +6992,7 @@ gray_stuff_out(PidginConversation *gtkconv) /* Deal with menu items */ gtk_action_set_visible(win->menu.view_log, TRUE); gtk_action_set_visible(win->menu.send_file, TRUE); - gtk_action_set_visible(GTK_ACTION(g_object_get_data(G_OBJECT(win->window), "get_attention")), TRUE); + gtk_action_set_visible(win->menu.get_attention, TRUE); gtk_action_set_visible(win->menu.add_pounce, TRUE); gtk_action_set_visible(win->menu.get_info, TRUE); gtk_action_set_visible(win->menu.invite, FALSE); @@ -6717,7 +7021,7 @@ gray_stuff_out(PidginConversation *gtkconv) /* Deal with menu items */ gtk_action_set_visible(win->menu.view_log, TRUE); gtk_action_set_visible(win->menu.send_file, FALSE); - gtk_action_set_visible(g_object_get_data(G_OBJECT(win->window), "get_attention"), FALSE); + gtk_action_set_visible(win->menu.get_attention, FALSE); gtk_action_set_visible(win->menu.add_pounce, FALSE); gtk_action_set_visible(win->menu.get_info, FALSE); gtk_action_set_visible(win->menu.invite, TRUE); @@ -6747,31 +7051,35 @@ gray_stuff_out(PidginConversation *gtkconv) ((purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT) || !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)) )) { + PurpleConnectionFlags features = purple_conversation_get_features(conv); /* Account is online */ /* Deal with the toolbar */ - if (conv->features & PURPLE_CONNECTION_HTML) + if (features & PURPLE_CONNECTION_HTML) { buttons = GTK_IMHTML_ALL; /* Everything on */ - if (conv->features & PURPLE_CONNECTION_NO_BGCOLOR) + if (features & PURPLE_CONNECTION_NO_BGCOLOR) buttons &= ~GTK_IMHTML_BACKCOLOR; - if (conv->features & PURPLE_CONNECTION_NO_FONTSIZE) + if (features & PURPLE_CONNECTION_NO_FONTSIZE) { buttons &= ~GTK_IMHTML_GROW; buttons &= ~GTK_IMHTML_SHRINK; } - if (conv->features & PURPLE_CONNECTION_NO_URLDESC) + if (features & PURPLE_CONNECTION_NO_URLDESC) buttons &= ~GTK_IMHTML_LINKDESC; } else { buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; } - if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)) - conv->features |= PURPLE_CONNECTION_NO_IMAGES; + if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) + && !(features & PURPLE_CONNECTION_NO_IMAGES)) { + features |= PURPLE_CONNECTION_NO_IMAGES; + purple_conversation_set_features(conv, features); + } - if(conv->features & PURPLE_CONNECTION_NO_IMAGES) + if (features & PURPLE_CONNECTION_NO_IMAGES) buttons &= ~GTK_IMHTML_IMAGE; - if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) + if (features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) buttons |= GTK_IMHTML_CUSTOM_SMILEY; else buttons &= ~GTK_IMHTML_CUSTOM_SMILEY; @@ -6785,17 +7093,17 @@ gray_stuff_out(PidginConversation *gtkconv) gtk_action_set_sensitive(win->menu.add_pounce, TRUE); gtk_action_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); gtk_action_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); - gtk_action_set_sensitive(win->menu.insert_link, (conv->features & PURPLE_CONNECTION_HTML)); - gtk_action_set_sensitive(win->menu.insert_image, !(conv->features & PURPLE_CONNECTION_NO_IMAGES)); + gtk_action_set_sensitive(win->menu.insert_link, (features & PURPLE_CONNECTION_HTML)); + gtk_action_set_sensitive(win->menu.insert_image, !(features & PURPLE_CONNECTION_NO_IMAGES)); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - gtk_action_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL) || (prpl_info->add_buddy_with_invite != NULL)); + gtk_action_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); gtk_action_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); gtk_action_set_sensitive(win->menu.send_file, (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, purple_conversation_get_name(conv))))); - gtk_action_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL)); + gtk_action_set_sensitive(win->menu.get_attention, (prpl_info->send_attention != NULL)); gtk_action_set_sensitive(win->menu.alias, (account != NULL) && (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); @@ -6816,8 +7124,7 @@ gray_stuff_out(PidginConversation *gtkconv) /* Then deal with menu items */ gtk_action_set_sensitive(win->menu.view_log, TRUE); gtk_action_set_sensitive(win->menu.send_file, FALSE); - gtk_action_set_sensitive(g_object_get_data(G_OBJECT(win->window), - "get_attention"), FALSE); + gtk_action_set_sensitive(win->menu.get_attention, FALSE); gtk_action_set_sensitive(win->menu.add_pounce, TRUE); gtk_action_set_sensitive(win->menu.get_info, FALSE); gtk_action_set_sensitive(win->menu.invite, FALSE); @@ -6837,7 +7144,7 @@ gray_stuff_out(PidginConversation *gtkconv) if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) && (gtkconv->u.im->anim)) { - PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); + PurpleBuddy *buddy = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); window_icon = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); @@ -6885,6 +7192,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) { gray_stuff_out(PIDGIN_CONVERSATION(conv)); generate_send_to_items(win); + regenerate_plugins_items(win); } if (fields & PIDGIN_CONV_TAB_ICON) @@ -6915,12 +7223,14 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) } } +#if 0 if (fields & PIDGIN_CONV_SMILEY_THEME) - pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml); + pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->webview); +#endif if ((fields & PIDGIN_CONV_COLORIZE_TITLE) || (fields & PIDGIN_CONV_SET_TITLE) || - (fields & PIDGIN_CONV_TOPIC)) + (fields & PIDGIN_CONV_TOPIC)) { char *title; PurpleConvIm *im = NULL; @@ -6943,7 +7253,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) title = g_strdup(purple_conversation_get_title(conv)); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - buddy = purple_find_buddy(account, conv->name); + buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); if (buddy) { markup = pidgin_blist_get_name_markup(buddy, FALSE, FALSE); } else { @@ -6988,7 +7298,7 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) style = "tab-label-attention"; } else if (gtkconv->unseen_state == PIDGIN_UNSEEN_TEXT) { atk_object_set_description(accessibility_obj, _("Unread Messages")); - if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_CHAT) + if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_CHAT) style = "tab-label-unreadchat"; else style = "tab-label-attention"; @@ -7200,7 +7510,7 @@ pidgin_conv_update_buddy_icon(PurpleConversation *conv) if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/show_buddy_icons")) return; - if (purple_conversation_get_gc(conv) == NULL) + if (purple_conversation_get_connection(conv) == NULL) return; buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); @@ -7286,7 +7596,7 @@ pidgin_conv_update_buddy_icon(PurpleConversation *conv) gtk_container_add(GTK_CONTAINER(gtkconv->u.im->icon_container), event); gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), FALSE); gtk_widget_add_events(event, - GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); + GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); g_signal_connect(G_OBJECT(event), "button-press-event", G_CALLBACK(icon_menu), gtkconv); @@ -7328,14 +7638,11 @@ pidgin_conv_xy_to_right_infopane(PidginWindow *win, int x, int y) { gint pane_x, pane_y, x_rel; PidginConversation *gtkconv; - GtkAllocation allocation; - gdk_window_get_origin(gtk_widget_get_window(win->notebook), - &pane_x, &pane_y); + gdk_window_get_origin(win->notebook->window, &pane_x, &pane_y); x_rel = x - pane_x; gtkconv = pidgin_conv_window_get_active_gtkconv(win); - gtk_widget_get_allocation(gtkconv->infopane, &allocation); - return (x_rel > allocation.x + allocation.width / 2); + return (x_rel > gtkconv->infopane->allocation.x + gtkconv->infopane->allocation.width / 2); } int @@ -7353,7 +7660,7 @@ pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right) notebook = GTK_NOTEBOOK(win->notebook); - gdk_window_get_origin(gtk_widget_get_window(win->notebook), &nb_x, &nb_y); + gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y); x_rel = x - nb_x; y_rel = y - nb_y; @@ -7363,32 +7670,30 @@ pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right) count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); for (i = 0; i < count; i++) { - GtkAllocation allocation; page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i); tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page); - gtk_widget_get_allocation(tab, &allocation); /* Make sure the tab is not hidden beyond an arrow */ if (!gtk_widget_is_drawable(tab) && gtk_notebook_get_show_tabs(notebook)) continue; if (horiz) { - if (x_rel >= allocation.x - PIDGIN_HIG_BOX_SPACE && - x_rel <= allocation.x + allocation.width + PIDGIN_HIG_BOX_SPACE) { + if (x_rel >= tab->allocation.x - PIDGIN_HIG_BOX_SPACE && + x_rel <= tab->allocation.x + tab->allocation.width + PIDGIN_HIG_BOX_SPACE) { page_num = i; - if (to_right && x_rel >= allocation.x + allocation.width/2) + if (to_right && x_rel >= tab->allocation.x + tab->allocation.width/2) *to_right = TRUE; break; } } else { - if (y_rel >= allocation.y - PIDGIN_HIG_BOX_SPACE && - y_rel <= allocation.y + allocation.height + PIDGIN_HIG_BOX_SPACE) { + if (y_rel >= tab->allocation.y - PIDGIN_HIG_BOX_SPACE && + y_rel <= tab->allocation.y + tab->allocation.height + PIDGIN_HIG_BOX_SPACE) { page_num = i; - if (to_right && y_rel >= allocation.y + allocation.height/2) + if (to_right && y_rel >= tab->allocation.y + tab->allocation.height/2) *to_right = TRUE; break; @@ -7499,8 +7804,11 @@ show_timestamps_pref_cb(const char *name, PurplePrefType type, GTK_TOGGLE_ACTION(win->menu.show_timestamps), (gboolean)GPOINTER_TO_INT(value)); +/* TODO WEBKIT: Use WebKit version of this. */ +#if 0 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); +#endif /* if 0 */ } } @@ -7668,7 +7976,7 @@ hide_new_pref_cb(const char *name, PurplePrefType type, conv = gtkconv->active_conv; - if (conv->type == PURPLE_CONV_TYPE_CHAT || + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT || gtkconv->unseen_count == 0 || (when_away && !purple_status_is_available( purple_account_get_active_status( @@ -7708,7 +8016,7 @@ get_gtkconv_with_contact(PurpleContact *contact) { PurpleBuddy *buddy = (PurpleBuddy*)node; PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (conv) return PIDGIN_CONVERSATION(conv); } @@ -7733,16 +8041,18 @@ account_signed_off_cb(PurpleConnection *gc, gpointer event) PIDGIN_CONV_MENU | PIDGIN_CONV_COLORIZE_TITLE); if (PURPLE_CONNECTION_IS_CONNECTED(gc) && - conv->type == PURPLE_CONV_TYPE_CHAT && - conv->account == gc->account && + purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && + purple_conversation_get_account(conv) == purple_connection_get_account(gc) && purple_conversation_get_data(conv, "want-to-rejoin")) { GHashTable *comps = NULL; - PurpleChat *chat = purple_blist_find_chat(conv->account, conv->name); + PurpleChat *chat = purple_blist_find_chat(purple_conversation_get_account(conv), purple_conversation_get_name(conv)); if (chat == NULL) { - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) - comps = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, conv->name); + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); + + if (prpl_info->chat_info_defaults != NULL) + comps = prpl_info->chat_info_defaults(gc, purple_conversation_get_name(conv)); } else { - comps = chat->components; + comps = purple_chat_get_components(chat); } serv_join_chat(gc, comps); if (chat == NULL && comps != NULL) @@ -7809,7 +8119,7 @@ update_buddy_idle_changed(PurpleBuddy *buddy, gboolean old, gboolean newidle) { PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (conv) pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON); } @@ -7819,7 +8129,7 @@ update_buddy_icon(PurpleBuddy *buddy) { PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); if (conv) pidgin_conv_update_fields(conv, PIDGIN_CONV_BUDDY_ICON); } @@ -7884,7 +8194,7 @@ static int message_compare(gconstpointer p1, gconstpointer p2) { const PurpleConvMessage *m1 = p1, *m2 = p2; - return (m1->when > m2->when); + return (purple_conversation_message_get_timestamp(m1) > purple_conversation_message_get_timestamp(m2)); } /* Adds some message history to the gtkconv. This happens in a idle-callback. */ @@ -7895,16 +8205,22 @@ add_message_history_to_gtkconv(gpointer data) int count = 0; int timer = gtkconv->attach.timer; time_t when = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkconv->entry), "attach-start-time")); - gboolean im = (gtkconv->active_conv->type == PURPLE_CONV_TYPE_IM); + gboolean im = (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_IM); gtkconv->attach.timer = 0; while (gtkconv->attach.current && count < 100) { /* XXX: 100 is a random value here */ PurpleConvMessage *msg = gtkconv->attach.current->data; - if (!im && when && when < msg->when) { - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "

", 0); + if (!im && when && when < purple_conversation_message_get_timestamp(msg)) { + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "

"); g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL); } - pidgin_conv_write_conv(msg->conv, msg->who, msg->alias, msg->what, msg->flags, msg->when); + pidgin_conv_write_conv( + purple_conversation_message_get_conv(msg), + purple_conversation_message_get_sender(msg), + purple_conversation_message_get_alias(msg), + purple_conversation_message_get_message(msg), + purple_conversation_message_get_flags(msg), + purple_conversation_message_get_timestamp(msg)); if (im) { gtkconv->attach.current = g_list_delete_link(gtkconv->attach.current, gtkconv->attach.current); } else { @@ -7927,16 +8243,22 @@ add_message_history_to_gtkconv(gpointer data) GList *history = purple_conversation_get_message_history(conv); for (; history; history = history->next) { PurpleConvMessage *msg = history->data; - if (msg->when > when) + if (purple_conversation_message_get_timestamp(msg) > when) msgs = g_list_prepend(msgs, msg); } } msgs = g_list_sort(msgs, message_compare); for (; msgs; msgs = g_list_delete_link(msgs, msgs)) { PurpleConvMessage *msg = msgs->data; - pidgin_conv_write_conv(msg->conv, msg->who, msg->alias, msg->what, msg->flags, msg->when); + pidgin_conv_write_conv( + purple_conversation_message_get_conv(msg), + purple_conversation_message_get_sender(msg), + purple_conversation_message_get_alias(msg), + purple_conversation_message_get_message(msg), + purple_conversation_message_get_flags(msg), + purple_conversation_message_get_timestamp(msg)); } - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "

", 0); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "

"); g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL); } @@ -8012,16 +8334,16 @@ gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv) g_return_val_if_reached(TRUE); } g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", - GINT_TO_POINTER(((PurpleConvMessage*)(list->data))->when)); + GINT_TO_POINTER(purple_conversation_message_get_timestamp((PurpleConvMessage*)(list->data)))); gtkconv->attach.timer = g_idle_add(add_message_history_to_gtkconv, gtkconv); } else { purple_signal_emit(pidgin_conversations_get_handle(), "conversation-displayed", gtkconv); } - if (conv->type == PURPLE_CONV_TYPE_CHAT) { + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC); - pidgin_conv_chat_add_users(conv, PURPLE_CONV_CHAT(conv)->in_room, TRUE); + pidgin_conv_chat_add_users(conv, purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv)), TRUE); } return TRUE; @@ -8043,6 +8365,7 @@ pidgin_conversations_init(void) /* Conversations */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/themes"); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_smooth_scrolling", TRUE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", TRUE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); @@ -8130,7 +8453,7 @@ pidgin_conversations_init(void) purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_protocol_icons", show_protocol_icons_pref_cb, NULL); purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/hide_new", - hide_new_pref_cb, NULL); + hide_new_pref_cb, NULL); @@ -8287,7 +8610,7 @@ pidgin_conversations_init(void) window_list = g_list_remove(window_list, hidden_convwin); purple_signal_connect(purple_accounts_get_handle(), "account-status-changed", - handle, PURPLE_CALLBACK(account_status_changed_cb), NULL); + handle, PURPLE_CALLBACK(account_status_changed_cb), NULL); /* Callbacks to update a conversation */ purple_signal_connect(blist_handle, "blist-node-added", handle, @@ -8326,6 +8649,8 @@ pidgin_conversations_init(void) purple_signal_connect(purple_conversations_get_handle(), "wrote-chat-msg", handle, PURPLE_CALLBACK(wrote_msg_update_unseen_cb), NULL); + purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_CONV_THEME_LOADER, "type", "conversation", NULL)); + { /* Set default tab colors */ GString *str = g_string_new(NULL); @@ -8471,15 +8796,12 @@ build_warn_close_dialog(PidginWindow *gtkwin) gtk_container_set_border_width(GTK_CONTAINER(warn_close_dialog), 6); gtk_window_set_resizable(GTK_WINDOW(warn_close_dialog), FALSE); - - /* TODO: figure out how to set no separator in GTK+ 3.0 */ -#if 0 - gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog), - FALSE); +#if !GTK_CHECK_VERSION(2,22,0) + gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog), FALSE); #endif /* Setup the outside spacing. */ - vbox = gtk_dialog_get_content_area(GTK_DIALOG(warn_close_dialog)); + vbox = GTK_DIALOG(warn_close_dialog)->vbox; gtk_box_set_spacing(GTK_BOX(vbox), 12); gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); @@ -8633,7 +8955,7 @@ notebook_init_grab(PidginWindow *gtkwin, GtkWidget *widget) always be true after a button press. */ if (!gdk_pointer_is_grabbed()) #endif - gdk_pointer_grab(gtk_widget_get_window(gtkwin->notebook), FALSE, + gdk_pointer_grab(gtkwin->notebook->window, FALSE, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, cursor, GDK_CURRENT_TIME); } @@ -8753,9 +9075,6 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc if (e->button == 1) { int nb_x, nb_y; - GtkAllocation allocation; - - gtk_widget_get_allocation(gtkconv->infopane_hbox, &allocation); if (gtkconv->win->in_drag) return TRUE; @@ -8763,12 +9082,12 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc gtkconv->win->in_predrag = TRUE; gtkconv->win->drag_tab = gtk_notebook_page_num(GTK_NOTEBOOK(gtkconv->win->notebook), gtkconv->tab_cont); - gdk_window_get_origin(gtk_widget_get_window(gtkconv->infopane_hbox), &nb_x, &nb_y); + gdk_window_get_origin(gtkconv->infopane_hbox->window, &nb_x, &nb_y); - gtkconv->win->drag_min_x = allocation.x + nb_x; - gtkconv->win->drag_min_y = allocation.y + nb_y; - gtkconv->win->drag_max_x = allocation.width + gtkconv->win->drag_min_x; - gtkconv->win->drag_max_y = allocation.height + gtkconv->win->drag_min_y; + gtkconv->win->drag_min_x = gtkconv->infopane_hbox->allocation.x + nb_x; + gtkconv->win->drag_min_y = gtkconv->infopane_hbox->allocation.y + nb_y; + gtkconv->win->drag_max_x = gtkconv->infopane_hbox->allocation.width + gtkconv->win->drag_min_x; + gtkconv->win->drag_max_y = gtkconv->infopane_hbox->allocation.height + gtkconv->win->drag_min_y; gtkconv->win->drag_motion_signal = g_signal_connect(G_OBJECT(gtkconv->win->notebook), "motion_notify_event", G_CALLBACK(notebook_motion_cb), gtkconv->win); @@ -8781,10 +9100,9 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc /* Right click was pressed. Popup the context menu. */ GtkWidget *menu = gtk_menu_new(), *sub; gboolean populated = populate_menu_with_options(menu, gtkconv, TRUE); -#if 0 /* TODO */ - sub = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to)); - if (sub && GTK_WIDGET_IS_SENSITIVE(gtkconv->win->menu.send_to)) { + sub = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to)); + if (sub && gtk_widget_is_sensitive(gtkconv->win->menu.send_to)) { GtkWidget *item = gtk_menu_item_new_with_mnemonic(_("S_end To")); if (populated) pidgin_separator(menu); @@ -8796,7 +9114,7 @@ infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkc gtk_widget_destroy(menu); return FALSE; } -#endif + gtk_widget_show_all(menu); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time); return TRUE; @@ -8811,7 +9129,6 @@ notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) int tab_clicked; GtkWidget *page; GtkWidget *tab; - GtkAllocation allocation; if (e->button == 2 && e->type == GDK_BUTTON_PRESS) { PidginConversation *gtkconv; @@ -8849,7 +9166,7 @@ notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) * Get the relative position of the press event, with regards to * the position of the notebook. */ - gdk_window_get_origin(gtk_widget_get_window(win->notebook), &nb_x, &nb_y); + gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y); /* Reset the min/max x/y */ win->drag_min_x = 0; @@ -8861,12 +9178,10 @@ notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), tab_clicked); tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(win->notebook), page); - gtk_widget_get_allocation(tab, &allocation); - - win->drag_min_x = allocation.x + nb_x; - win->drag_min_y = allocation.y + nb_y; - win->drag_max_x = allocation.width + win->drag_min_x; - win->drag_max_y = allocation.height + win->drag_min_y; + win->drag_min_x = tab->allocation.x + nb_x; + win->drag_min_y = tab->allocation.y + nb_y; + win->drag_max_x = tab->allocation.width + win->drag_min_x; + win->drag_max_y = tab->allocation.height + win->drag_min_y; /* Make sure the click occurred in the tab. */ if (e->x_root < win->drag_min_x || @@ -8874,8 +9189,8 @@ notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) e->y_root < win->drag_min_y || e->y_root >= win->drag_max_y) { - return FALSE; - } + return FALSE; + } win->in_predrag = TRUE; win->drag_tab = tab_clicked; @@ -9103,14 +9418,11 @@ static void close_tab_cb(GtkWidget *w, GObject *menu) close_conv_cb(NULL, gtkconv); } -/* TODO: I don't know if this doable in GTK+ 3.0 */ -#if 0 static gboolean right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, PidginWindow *win) { - GtkWidget *item; + GtkWidget *item, *menu; PidginConversation *gtkconv; - GtkWidget *menu = gtk_notebook_get_menu if (event->type != GDK_BUTTON_PRESS || event->button != 3) return FALSE; @@ -9157,7 +9469,6 @@ right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, PidginWindow * return FALSE; } -#endif static void remove_edit_entry(PidginConversation *gtkconv, GtkWidget *entry) @@ -9179,7 +9490,7 @@ alias_focus_cb(GtkWidget *widget, GdkEventFocus *event, gpointer user_data) static gboolean alias_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { - if (event->keyval == GDK_KEY_Escape) { + if (event->keyval == GDK_Escape) { remove_edit_entry(user_data, widget); return TRUE; } @@ -9206,7 +9517,8 @@ alias_cb(GtkEntry *entry, gpointer user_data) PurpleBuddy *buddy; buddy = purple_find_buddy(account, name); if (buddy != NULL) { - purple_blist_alias_buddy(buddy, gtk_entry_get_text(entry)); + purple_blist_alias_buddy(buddy, + gtk_entry_get_text(entry)); } serv_alias_buddy(buddy); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { @@ -9228,13 +9540,13 @@ infopane_entry_activate(PidginConversation *gtkconv) return FALSE; } - if (!purple_account_is_connected(gtkconv->active_conv->account)) { + if (!purple_account_is_connected(purple_conversation_get_account(gtkconv->active_conv))) { /* Do not allow aliasing someone on a disconnected account. */ return FALSE; } if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - PurpleBuddy *buddy = purple_find_buddy(gtkconv->active_conv->account, gtkconv->active_conv->name); + PurpleBuddy *buddy = purple_find_buddy(purple_conversation_get_account(gtkconv->active_conv), purple_conversation_get_name(gtkconv->active_conv)); if (!buddy) /* This buddy isn't in your buddy list, so we can't alias him */ return FALSE; @@ -9244,9 +9556,9 @@ infopane_entry_activate(PidginConversation *gtkconv) PurpleConnection *gc; PurplePluginProtocolInfo *prpl_info = NULL; - gc = purple_conversation_get_gc(conv); + gc = purple_conversation_get_connection(conv); if (gc != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && prpl_info->set_chat_topic == NULL) /* This protocol doesn't support setting the chat room topic */ return FALSE; @@ -9352,18 +9664,14 @@ static GList* make_status_icon_list(const char *stock, GtkWidget *w) { GList *l = NULL; - l = g_list_append(l, - gtk_widget_render_icon(w, stock, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), "GtkWindow")); - l = g_list_append(l, - gtk_widget_render_icon(w, stock, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow")); - l = g_list_append(l, - gtk_widget_render_icon(w, stock, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MEDIUM), "GtkWindow")); - l = g_list_append(l, - gtk_widget_render_icon(w, stock, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), "GtkWindow")); + l = g_list_append(l, gtk_widget_render_icon (w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), "GtkWindow")); + l = g_list_append(l, gtk_widget_render_icon (w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow")); + l = g_list_append(l, gtk_widget_render_icon (w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MEDIUM), "GtkWindow")); + l = g_list_append(l, gtk_widget_render_icon (w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), "GtkWindow")); return l; } @@ -9394,7 +9702,7 @@ static gboolean gtk_conv_configure_cb(GtkWidget *w, GdkEventConfigure *event, gp /* Workaround for GTK+ bug # 169811 - "configure_event" is fired * when the window is being maximized */ - if (gdk_window_get_state(gtk_widget_get_window(w)) & GDK_WINDOW_STATE_MAXIMIZED) + if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED) return FALSE; /* don't save off-screen positioning */ @@ -9419,8 +9727,8 @@ static void pidgin_conv_set_position_size(PidginWindow *win, int conv_x, int conv_y, int conv_width, int conv_height) { - /* if the window exists, is hidden, we're saving positions, and the - * position is sane... */ + /* if the window exists, is hidden, we're saving positions, and the + * position is sane... */ if (win && win->window && !gtk_widget_get_visible(win->window) && conv_width != 0) { @@ -9507,12 +9815,8 @@ pidgin_conv_window_new() gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); gtk_notebook_set_show_border(GTK_NOTEBOOK(win->notebook), TRUE); - /* TODO: figure out how to add custom stuff to the right-click menu in - GtkNotebook in GTK+ 3.0 */ -#if 0 g_signal_connect(G_OBJECT(win->notebook), "button-press-event", G_CALLBACK(right_click_menu_cb), win); -#endif gtk_widget_show(win->notebook); @@ -9604,7 +9908,7 @@ pidgin_conv_window_hide(PidginWindow *win) void pidgin_conv_window_raise(PidginWindow *win) { - gdk_window_raise(GDK_WINDOW(gtk_widget_get_window(win->window))); + gdk_window_raise(GDK_WINDOW(win->window->window)); } void @@ -9779,7 +10083,7 @@ pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv) g_signal_connect(G_OBJECT(ebox), "enter-notify-event", G_CALLBACK(gtkconv_tab_set_tip), gtkconv); - if (gtk_widget_get_parent(gtkconv->tab_label) == NULL) { + if (gtkconv->tab_label->parent == NULL) { /* Pack if it's a new widget */ gtk_box_pack_start(GTK_BOX(gtkconv->tabby), first, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(gtkconv->tabby), gtkconv->tab_label, TRUE, TRUE, 0); @@ -9800,7 +10104,9 @@ pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv) gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox); } - g_object_set(G_OBJECT(win->notebook), "expand", !tabs_side && !angle, NULL); + gtk_container_child_set(GTK_CONTAINER(win->notebook), gtkconv->tab_cont, + "tab-expand", !tabs_side && !angle, + "tab-fill", TRUE, NULL); if (pidgin_conv_window_get_gtkconv_count(win) == 1) gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), @@ -9824,12 +10130,7 @@ pidgin_conv_window_remove_gtkconv(PidginWindow *win, PidginConversation *gtkconv index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont); -#if GTK_CHECK_VERSION(2,10,0) g_object_ref_sink(G_OBJECT(gtkconv->tab_cont)); -#else - g_object_ref(gtkconv->tab_cont); - gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); -#endif gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index); @@ -9912,7 +10213,7 @@ pidgin_conv_window_get_at_xy(int x, int y) for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) { win = l->data; - if (gdkwin == gtk_widget_get_window(win->window)) + if (gdkwin == win->window->window) return win; } @@ -10041,7 +10342,7 @@ conv_placement_last_created_win_type_configured_cb(GtkWidget *w, /* Workaround for GTK+ bug # 169811 - "configure_event" is fired * when the window is being maximized */ - if (gdk_window_get_state(gtk_widget_get_window(w)) & GDK_WINDOW_STATE_MAXIMIZED) + if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED) return FALSE; /* don't save off-screen positioning */ diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index 700e6126d5..e573d01b7b 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -51,12 +51,12 @@ enum { CHAT_USERS_FLAGS_COLUMN, CHAT_USERS_COLOR_COLUMN, CHAT_USERS_WEIGHT_COLUMN, - CHAT_USERS_ICON_STOCK_COLUMN, /** @since 2.6.0 */ + CHAT_USERS_ICON_STOCK_COLUMN, CHAT_USERS_COLUMNS }; #define PIDGIN_CONVERSATION(conv) \ - ((PidginConversation *)(conv)->ui_data) + ((PidginConversation *)purple_conversation_get_ui_data(conv)) #define PIDGIN_IS_PIDGIN_CONVERSATION(conv) \ (purple_conversation_get_ui_ops(conv) == \ @@ -65,6 +65,7 @@ enum { #include "pidgin.h" #include "conversation.h" #include "gtkconvwin.h" +#include "gtkconv-theme.h" /************************************************************************** * @name Structures @@ -76,39 +77,6 @@ enum { * conversations. */ -/** - * A GTK+ Instant Message pane. - */ -struct _PidginImPane -{ - GtkWidget *block; - GtkWidget *send_file; - GtkWidget *sep1; - GtkWidget *sep2; - GtkWidget *check; - GtkWidget *progress; - guint32 typing_timer; - - /* Buddy icon stuff */ - GtkWidget *icon_container; - GtkWidget *icon; - gboolean show_icon; - gboolean animate; - GdkPixbufAnimation *anim; - GdkPixbufAnimationIter *iter; - guint32 icon_timer; -}; - -/** - * GTK+ Chat panes. - */ -struct _PidginChatPane -{ - GtkWidget *count; - GtkWidget *list; - GtkWidget *topic_text; -}; - /** * A GTK+ conversation pane. */ @@ -132,7 +100,9 @@ struct _PidginConversation GtkWidget *tabby; GtkWidget *menu_tabby; - GtkWidget *imhtml; + PidginConvTheme *theme; + PurpleMessageFlags last_flags; + GtkWidget *webview; GtkTextBuffer *entry_buffer; GtkWidget *entry; gboolean auto_resize; /* this is set to TRUE if the conversation @@ -178,8 +148,6 @@ struct _PidginConversation /** * Quick Find. - * - * @since 2.7.0 */ struct { GtkWidget *entry; @@ -267,8 +235,6 @@ void pidgin_conv_present_conversation(PurpleConversation *conv); * @param conv The conversation. * * @return Wheter Pidgin UI was successfully attached. - * - * @since 2.2.0 */ gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv); diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index ee42f17e61..c27f92ce8f 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -51,6 +51,7 @@ struct _PidginWindow GtkAction *view_log; GtkAction *send_file; + GtkAction *get_attention; GtkAction *add_pounce; GtkAction *get_info; GtkAction *invite; diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index dd3f5aa647..ddd82309df 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -128,7 +128,11 @@ debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) static gboolean configure_cb(GtkWidget *w, GdkEventConfigure *event, DebugWindow *win) { +#if GTK_CHECK_VERSION(2,18,0) if (gtk_widget_get_visible(w)) { +#else + if (GTK_WIDGET_VISIBLE(w)) { +#endif purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/width", event->width); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/height", event->height); } @@ -186,7 +190,9 @@ find_cb(GtkWidget *w, DebugWindow *win) gtk_container_set_border_width(GTK_CONTAINER(win->find), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(win->find), FALSE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(win->find), FALSE); +#endif gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(win->find)->vbox), PIDGIN_HIG_BORDER); gtk_container_set_border_width( GTK_CONTAINER(GTK_DIALOG(win->find)->vbox), PIDGIN_HIG_BOX_SPACE); @@ -622,8 +628,12 @@ regex_changed_cb(GtkWidget *w, DebugWindow *win) { static void regex_key_release_cb(GtkWidget *w, GdkEventKey *e, DebugWindow *win) { - if(e->keyval == GDK_KEY_Return && + if(e->keyval == GDK_Return && +#if GTK_CHECK_VERSION(2,18,0) gtk_widget_is_sensitive(win->filter) && +#else + GTK_WIDGET_IS_SENSITIVE(win->filter) && +#endif !gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter), TRUE); @@ -925,7 +935,7 @@ debug_window_new(void) gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level "))); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); - win->filterlevel = gtk_combo_box_text_new(); + win->filterlevel = gtk_combo_box_new_text(); item = gtk_tool_item_new(); #if GTK_CHECK_VERSION(2,12,0) gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level.")); @@ -935,12 +945,12 @@ debug_window_new(void) gtk_container_add(GTK_CONTAINER(item), win->filterlevel); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("All")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Misc")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Info")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Warning")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Error ")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Fatal Error")); + gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All")); + gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc")); + gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info")); + gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Warning")); + gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Error ")); + gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Fatal Error")); gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")); #ifdef USE_REGEX diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 37910e3816..18f0c5de01 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -39,10 +39,9 @@ #include "gtkblist.h" #include "gtkdialogs.h" -#include "gtkimhtml.h" -#include "gtkimhtmltoolbar.h" #include "gtklog.h" #include "gtkutils.h" +#include "gtkwebview.h" #include "pidginstock.h" static GList *dialogwindows = NULL; @@ -151,7 +150,7 @@ static const struct translator translators[] = { {N_("Assamese"), "as", "Amitakhya Phukan", "aphukan@fedoraproject.org"}, {N_("Belarusian Latin"), "be@latin", "Ihar Hrachyshka", "ihar.hrachyshka@gmail.com"}, {N_("Bulgarian"), "bg", "Vladimira Girginova", "missing@here.is"}, - {N_("Bulgarian"), "bg", "Vladimir (Kaladan) Petkov", "vpetkov@i-space.org"}, + {N_("Bulgarian"), "bg", "Vladimir (Kaladan) Petkov", "kaladan@gmail.com"}, {N_("Bengali"), "bn", "Israt Jahan", "israt@ankur.org.bd"}, {N_("Bengali"), "bn", "Jamil Ahmed", "jamil@bengalinux.org"}, {N_("Bengali"), "bn", "Samia Nimatullah", "mailsamia2001@yahoo.com"}, @@ -222,7 +221,6 @@ static const struct translator translators[] = { {N_("Oriya"), "or", "Manoj Kumar Giri", "giri.manojkr@gmail.com"}, {N_("Punjabi"), "pa", "Amanpreet Singh Alam", "aalam@users.sf.net"}, {N_("Polish"), "pl", "Piotr Drąg", "piotrdrag@gmail.com"}, - {N_("Polish"), "pl", "Piotr Makowski", "pmakowski@aviary.pl"}, {N_("Portuguese"), "pt", "Duarte Henriques", "duarte_henriques@myrealbox.com"}, {N_("Portuguese-Brazil"), "pt_BR", "Rodrigo Luiz Marques Flores", "rodrigomarquesflores@gmail.com"}, {N_("Pashto"), "ps", "Kashif Masood", "masudmails@yahoo.com"}, @@ -304,6 +302,7 @@ static const struct translator past_translators[] = { {N_("Polish"), "pl", "Emil Nowak", "emil5@go2.pl"}, {N_("Polish"), "pl", "Paweł Godlewski", "pawel@bajk.pl"}, {N_("Polish"), "pl", "Krzysztof Foltman", "krzysztof@foltman.com"}, + {N_("Polish"), "pl", "Piotr Makowski", NULL}, {N_("Polish"), "pl", "Przemysław Sułek", NULL}, {N_("Portuguese-Brazil"), "pt_BR", "Maurício de Lemos Rodrigues Collares Neto", "mauricioc@gmail.com"}, {N_("Russian"), "ru", "Dmitry Beloglazov", "dmaa@users.sf.net"}, @@ -422,9 +421,8 @@ pidgin_logo_versionize(GdkPixbuf **original, GtkWidget *widget) { static GtkWidget * pidgin_build_help_dialog(const char *title, const char *role, GString *string) { - GtkWidget *win, *vbox, *frame, *logo, *imhtml, *button; + GtkWidget *win, *vbox, *frame, *logo, *webview, *button; GdkPixbuf *pixbuf; - GtkTextIter iter; AtkObject *obj; char *filename, *tmp; @@ -451,18 +449,24 @@ pidgin_build_help_dialog(const char *title, const char *role, GString *string) g_free(tmp); gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); - frame = pidgin_create_imhtml(FALSE, &imhtml, NULL, NULL); + frame = pidgin_create_webview(FALSE, &webview, NULL, NULL); + /* TODO WEBKIT: Compile now and fix it later when we have a proper replacement for this function gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY); + */ gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); - gtk_imhtml_append_text(GTK_IMHTML(imhtml), string->str, GTK_IMHTML_NO_SCROLL); - gtk_text_buffer_get_start_iter(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter); - gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)), &iter); + gtk_webview_append_html(GTK_WEBVIEW(webview), string->str); + /* TODO WEBKIT: This doesn't seem to stay at the top. */ + webkit_web_view_move_cursor(WEBKIT_WEB_VIEW(webview), GTK_MOVEMENT_BUFFER_ENDS, -1); button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, G_CALLBACK(destroy_win), win); +#if GTK_CHECK_VERSION(2,18,0) gtk_widget_set_can_default(button, TRUE); +#else + GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); +#endif gtk_widget_grab_default(button); gtk_widget_show_all(win); @@ -947,15 +951,14 @@ pidgin_dialogs_ee(const char *ee) gtk_container_set_border_width (GTK_CONTAINER(window), PIDGIN_HIG_BOX_SPACE); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - /* TODO: figure out how to set no separator in a dialog in GTK+ 3.0 */ - /*gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE);*/ - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(window))), - PIDGIN_HIG_BORDER); - gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))), - PIDGIN_HIG_BOX_SPACE); +#if !GTK_CHECK_VERSION(2,22,0) + gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); +#endif + gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), PIDGIN_HIG_BORDER); + gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), PIDGIN_HIG_BOX_SPACE); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))), hbox); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_COOL, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); @@ -1130,10 +1133,10 @@ pidgin_dialogs_alias_buddy(PurpleBuddy *buddy) g_return_if_fail(buddy != NULL); - secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name); + secondary = g_strdup_printf(_("Enter an alias for %s."), purple_buddy_get_name(buddy)); purple_request_input(NULL, _("Alias Buddy"), NULL, - secondary, buddy->alias, FALSE, FALSE, NULL, + secondary, purple_buddy_get_local_buddy_alias(buddy), FALSE, FALSE, NULL, _("Alias"), G_CALLBACK(pidgin_dialogs_alias_buddy_cb), _("Cancel"), NULL, purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL, @@ -1158,7 +1161,7 @@ pidgin_dialogs_alias_chat(PurpleChat *chat) chat->alias, FALSE, FALSE, NULL, _("Alias"), G_CALLBACK(pidgin_dialogs_alias_chat_cb), _("Cancel"), NULL, - chat->account, NULL, NULL, + purple_chat_get_account(chat), NULL, NULL, chat); } @@ -1172,8 +1175,8 @@ pidgin_dialogs_remove_contact_cb(PurpleContact *contact) group = (PurpleGroup*)cnode->parent; for (bnode = cnode->child; bnode; bnode = bnode->next) { PurpleBuddy *buddy = (PurpleBuddy*)bnode; - if (purple_account_is_connected(buddy->account)) - purple_account_remove_buddy(buddy->account, buddy, group); + if (purple_account_is_connected(purple_buddy_get_account(buddy))) + purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group); } purple_blist_remove_contact(contact); } @@ -1198,8 +1201,8 @@ pidgin_dialogs_remove_contact(PurpleContact *contact) "want to continue?", "You are about to remove the contact containing %s " "and %d other buddies from your buddy list. Do you " - "want to continue?", contact->totalsize - 1), - buddy->name, contact->totalsize - 1); + "want to continue?", purple_contact_get_contact_size(contact, TRUE) - 1), + purple_buddy_get_name(buddy), purple_contact_get_contact_size(contact, TRUE) - 1); purple_request_action(contact, NULL, _("Remove Contact"), text, 0, NULL, purple_contact_get_alias(contact), NULL, @@ -1236,7 +1239,7 @@ pidgin_dialogs_merge_groups(PurpleGroup *source, const char *new_name) text = g_strdup_printf( _("You are about to merge the group called %s into the group " - "called %s. Do you want to continue?"), source->name, new_name); + "called %s. Do you want to continue?"), purple_group_get_name(source), new_name); ggp = g_new(struct _PidginGroupMergeObject, 1); ggp->parent = source; @@ -1267,8 +1270,8 @@ pidgin_dialogs_remove_group_cb(PurpleGroup *group) if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) { buddy = (PurpleBuddy*)bnode; bnode = bnode->next; - if (purple_account_is_connected(buddy->account)) { - purple_account_remove_buddy(buddy->account, buddy, group); + if (purple_account_is_connected(purple_buddy_get_account(buddy))) { + purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group); purple_blist_remove_buddy(buddy); } } else { @@ -1278,7 +1281,7 @@ pidgin_dialogs_remove_group_cb(PurpleGroup *group) } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { PurpleChat *chat = (PurpleChat *)cnode; cnode = cnode->next; - if (purple_account_is_connected(chat->account)) + if (purple_account_is_connected(purple_chat_get_account(chat))) purple_blist_remove_chat(chat); } else { cnode = cnode->next; @@ -1296,7 +1299,7 @@ pidgin_dialogs_remove_group(PurpleGroup *group) g_return_if_fail(group != NULL); text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"), - group->name); + purple_group_get_name(group)); purple_request_action(group, NULL, _("Remove Group"), text, 0, NULL, NULL, NULL, @@ -1316,10 +1319,10 @@ pidgin_dialogs_remove_buddy_cb(PurpleBuddy *buddy) PurpleAccount *account; group = purple_buddy_get_group(buddy); - name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */ - account = buddy->account; + name = g_strdup(purple_buddy_get_name(buddy)); /* purple_buddy_get_name() is a crasher after remove_buddy */ + account = purple_buddy_get_account(buddy); - purple_debug_info("blist", "Removing '%s' from buddy list.\n", buddy->name); + purple_debug_info("blist", "Removing '%s' from buddy list.\n", purple_buddy_get_name(buddy)); /* TODO - Should remove from blist first... then call purple_account_remove_buddy()? */ purple_account_remove_buddy(account, buddy, group); purple_blist_remove_buddy(buddy); @@ -1335,7 +1338,7 @@ pidgin_dialogs_remove_buddy(PurpleBuddy *buddy) g_return_if_fail(buddy != NULL); text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), - buddy->name); + purple_buddy_get_name(buddy)); purple_request_action(buddy, NULL, _("Remove Buddy"), text, 0, purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL, @@ -1365,7 +1368,7 @@ pidgin_dialogs_remove_chat(PurpleChat *chat) name ? name : ""); purple_request_action(chat, NULL, _("Remove Chat"), text, 0, - chat->account, NULL, NULL, + purple_chat_get_account(chat), NULL, NULL, chat, 2, _("_Remove Chat"), G_CALLBACK(pidgin_dialogs_remove_chat_cb), _("Cancel"), NULL); diff --git a/pidgin/gtkdialogs.h b/pidgin/gtkdialogs.h index 7ab7ac1357..adda62074a 100644 --- a/pidgin/gtkdialogs.h +++ b/pidgin/gtkdialogs.h @@ -51,6 +51,6 @@ void pidgin_dialogs_remove_contact(PurpleContact *); void pidgin_dialogs_merge_groups(PurpleGroup *, const char *); /* This macro should probably be moved elsewhere */ -#define PIDGIN_WINDOW_ICONIFIED(x) (gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(x))) & GDK_WINDOW_STATE_ICONIFIED) +#define PIDGIN_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED) #endif /* _PIDGINDIALOGS_H_ */ diff --git a/pidgin/gtkdnd-hints.c b/pidgin/gtkdnd-hints.c index 7304ac6eda..750d6aef4b 100644 --- a/pidgin/gtkdnd-hints.c +++ b/pidgin/gtkdnd-hints.c @@ -57,34 +57,29 @@ static HintWindowInfo hint_windows[] = { static GtkWidget * dnd_hints_init_window(const gchar *fname) { - /* TODO: this is likely very broken right now, I think this needs to be - Cairo-ified */ GdkPixbuf *pixbuf; - /*GdkPixmap *pixmap;*/ - /*GdkBitmap *bitmap;*/ + GdkPixmap *pixmap; + GdkBitmap *bitmap; GtkWidget *pix; GtkWidget *win; + GdkColormap *colormap; pixbuf = gdk_pixbuf_new_from_file(fname, NULL); g_return_val_if_fail(pixbuf, NULL); - /* - gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, &bitmap, 128); - g_object_unref(G_OBJECT(pixbuf)); - */ - - /*gtk_widget_push_colormap(gdk_rgb_get_colormap());*/ win = gtk_window_new(GTK_WINDOW_POPUP); - pix = gtk_image_new_from_pixbuf(pixbuf); + colormap = gtk_widget_get_colormap(win); + gdk_pixbuf_render_pixmap_and_mask_for_colormap(pixbuf, colormap, + &pixmap, &bitmap, 128); + g_object_unref(G_OBJECT(pixbuf)); + + pix = gtk_image_new_from_pixmap(pixmap, bitmap); gtk_container_add(GTK_CONTAINER(win), pix); - /*gtk_widget_shape_combine_mask(win, bitmap, 0, 0); - gtk_widget_pop_colormap();*/ + gtk_widget_shape_combine_mask(win, bitmap, 0, 0); - /* g_object_unref(G_OBJECT(pixmap)); g_object_unref(G_OBJECT(bitmap)); - */ - + gtk_widget_show_all(pix); return win; @@ -94,22 +89,17 @@ static void get_widget_coords(GtkWidget *w, gint *x1, gint *y1, gint *x2, gint *y2) { gint ox, oy, width, height; - GtkWidget *parent = gtk_widget_get_parent(w); - - if (parent && gtk_widget_get_window(parent) == gtk_widget_get_window(w)) - { - GtkAllocation allocation; - gtk_widget_get_allocation(w, &allocation); - get_widget_coords(parent, &ox, &oy, NULL, NULL); - height = allocation.height; - width = allocation.width; + if (w->parent && w->parent->window == w->window) + { + get_widget_coords(w->parent, &ox, &oy, NULL, NULL); + height = w->allocation.height; + width = w->allocation.width; } else { - gdk_window_get_origin(gtk_widget_get_window(w), &ox, &oy); - width = gdk_window_get_width(gtk_widget_get_window(w)); - height = gdk_window_get_height(gtk_widget_get_window(w)); + gdk_window_get_origin(w->window, &ox, &oy); + gdk_drawable_get_size(w->window, &width, &height); } if (x1) *x1 = ox; @@ -182,13 +172,10 @@ dnd_hints_show_relative(DndHintWindowId id, GtkWidget *widget, { gint x1, x2, y1, y2; gint x = 0, y = 0; - GtkAllocation allocation; - - gtk_widget_get_allocation(widget, &allocation); get_widget_coords(widget, &x1, &y1, &x2, &y2); - x1 += allocation.x; x2 += allocation.x; - y1 += allocation.y; y2 += allocation.y; + x1 += widget->allocation.x; x2 += widget->allocation.x; + y1 += widget->allocation.y; y2 += widget->allocation.y; switch (horiz) { diff --git a/pidgin/gtkdocklet-gtk.c b/pidgin/gtkdocklet-gtk.c deleted file mode 100644 index 9e011ad3cb..0000000000 --- a/pidgin/gtkdocklet-gtk.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * System tray icon (aka docklet) plugin for Purple - * - * Copyright (C) 2007 Anders Hasselqvist - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include "internal.h" -#include "pidgin.h" -#include "debug.h" -#include "prefs.h" -#include "pidginstock.h" -#include "gtkdocklet.h" - -#define SHORT_EMBED_TIMEOUT 5 -#define LONG_EMBED_TIMEOUT 15 - -/* globals */ -static GtkStatusIcon *docklet = NULL; -static guint embed_timeout = 0; - -/* protos */ -static void docklet_gtk_status_create(gboolean); - -static gboolean -docklet_gtk_recreate_cb(gpointer data) -{ - docklet_gtk_status_create(TRUE); - - return FALSE; -} - -static gboolean -docklet_gtk_embed_timeout_cb(gpointer data) -{ -#if !GTK_CHECK_VERSION(2,12,0) - if (gtk_status_icon_is_embedded(docklet)) { - /* Older GTK+ (<2.12) don't implement the embedded signal, but the - information is still accessable through the above function. */ - purple_debug_info("docklet", "embedded\n"); - - pidgin_docklet_embedded(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); - } - else -#endif - { - /* The docklet was not embedded within the timeout. - * Remove it as a visibility manager, but leave the plugin - * loaded so that it can embed automatically if/when a notification - * area becomes available. - */ - purple_debug_info("docklet", "failed to embed within timeout\n"); - pidgin_docklet_remove(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); - } - -#if GTK_CHECK_VERSION(2,12,0) - embed_timeout = 0; - return FALSE; -#else - return TRUE; -#endif -} - -#if GTK_CHECK_VERSION(2,12,0) -static gboolean -docklet_gtk_embedded_cb(GtkWidget *widget, gpointer data) -{ - if (embed_timeout) { - purple_timeout_remove(embed_timeout); - embed_timeout = 0; - } - - if (gtk_status_icon_is_embedded(docklet)) { - purple_debug_info("docklet", "embedded\n"); - - pidgin_docklet_embedded(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); - } else { - purple_debug_info("docklet", "detached\n"); - - pidgin_docklet_remove(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); - } - - return TRUE; -} -#endif - -static void -docklet_gtk_destroyed_cb(GtkWidget *widget, gpointer data) -{ - purple_debug_info("docklet", "destroyed\n"); - - pidgin_docklet_remove(); - - g_object_unref(G_OBJECT(docklet)); - docklet = NULL; - - g_idle_add(docklet_gtk_recreate_cb, NULL); -} - -static void -docklet_gtk_status_activated_cb(GtkStatusIcon *status_icon, gpointer user_data) -{ - pidgin_docklet_clicked(1); -} - -static void -docklet_gtk_status_clicked_cb(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) -{ - purple_debug_info("docklet", "The button is %u\n", button); -#ifdef GDK_WINDOWING_QUARTZ - /* You can only click left mouse button on MacOSX native GTK. Let that be the menu */ - pidgin_docklet_clicked(3); -#else - pidgin_docklet_clicked(button); -#endif -} - -static void -docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) -{ - const gchar *icon_name = NULL; - - switch (status) { - case PURPLE_STATUS_OFFLINE: - icon_name = PIDGIN_STOCK_TRAY_OFFLINE; - break; - case PURPLE_STATUS_AWAY: - icon_name = PIDGIN_STOCK_TRAY_AWAY; - break; - case PURPLE_STATUS_UNAVAILABLE: - icon_name = PIDGIN_STOCK_TRAY_BUSY; - break; - case PURPLE_STATUS_EXTENDED_AWAY: - icon_name = PIDGIN_STOCK_TRAY_XA; - break; - case PURPLE_STATUS_INVISIBLE: - icon_name = PIDGIN_STOCK_TRAY_INVISIBLE; - break; - default: - icon_name = PIDGIN_STOCK_TRAY_AVAILABLE; - break; - } - - if (pending) - icon_name = PIDGIN_STOCK_TRAY_PENDING; - if (connecting) - icon_name = PIDGIN_STOCK_TRAY_CONNECT; - - if (icon_name) { - gtk_status_icon_set_from_icon_name(docklet, icon_name); - } -} - -static void -docklet_gtk_status_set_tooltip(gchar *tooltip) -{ - gtk_status_icon_set_tooltip_text(docklet, tooltip); -} - -static void -docklet_gtk_status_position_menu(GtkMenu *menu, - int *x, int *y, gboolean *push_in, - gpointer user_data) -{ - gtk_status_icon_position_menu(menu, x, y, push_in, docklet); -} - -static void -docklet_gtk_status_destroy(void) -{ - g_return_if_fail(docklet != NULL); - - pidgin_docklet_remove(); - - if (embed_timeout) { - purple_timeout_remove(embed_timeout); - embed_timeout = 0; - } - - gtk_status_icon_set_visible(docklet, FALSE); - g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_gtk_destroyed_cb), NULL); - g_object_unref(G_OBJECT(docklet)); - docklet = NULL; - - purple_debug_info("docklet", "GTK+ destroyed\n"); -} - -static void -docklet_gtk_status_create(gboolean recreate) -{ - if (docklet) { - /* if this is being called when a tray icon exists, it's because - something messed up. try destroying it before we proceed, - although docklet_refcount may be all hosed. hopefully won't happen. */ - purple_debug_warning("docklet", "trying to create icon but it already exists?\n"); - docklet_gtk_status_destroy(); - } - - docklet = gtk_status_icon_new(); - g_return_if_fail(docklet != NULL); - - g_signal_connect(G_OBJECT(docklet), "activate", G_CALLBACK(docklet_gtk_status_activated_cb), NULL); - g_signal_connect(G_OBJECT(docklet), "popup-menu", G_CALLBACK(docklet_gtk_status_clicked_cb), NULL); -#if GTK_CHECK_VERSION(2,12,0) - g_signal_connect(G_OBJECT(docklet), "notify::embedded", G_CALLBACK(docklet_gtk_embedded_cb), NULL); -#endif - g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_gtk_destroyed_cb), NULL); - - gtk_status_icon_set_visible(docklet, TRUE); - - /* This is a hack to avoid a race condition between the docklet getting - * embedded in the notification area and the gtkblist restoring its - * previous visibility state. If the docklet does not get embedded within - * the timeout, it will be removed as a visibility manager until it does - * get embedded. Ideally, we would only call docklet_embedded() when the - * icon was actually embedded. This only happens when the docklet is first - * created, not when being recreated. - * - * The gtk docklet tracks whether it successfully embedded in a pref and - * allows for a longer timeout period if it successfully embedded the last - * time it was run. This should hopefully solve problems with the buddy - * list not properly starting hidden when Pidgin is started on login. - */ - if (!recreate) { - pidgin_docklet_embedded(); -#if GTK_CHECK_VERSION(2,12,0) - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) { - embed_timeout = purple_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); - } else { - embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); - } -#else - embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); -#endif - } - - purple_debug_info("docklet", "GTK+ created\n"); -} - -static void -docklet_gtk_status_create_ui_op(void) -{ - docklet_gtk_status_create(FALSE); -} - -static struct docklet_ui_ops ui_ops = -{ - docklet_gtk_status_create_ui_op, - docklet_gtk_status_destroy, - docklet_gtk_status_update_icon, - NULL, - docklet_gtk_status_set_tooltip, - docklet_gtk_status_position_menu -}; - -void -docklet_ui_init(void) -{ - pidgin_docklet_set_ui_ops(&ui_ops); - - purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet/gtk"); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded")) { - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); - purple_prefs_remove(PIDGIN_PREFS_ROOT "/docklet/x11/embedded"); - } else { - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); - } - - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), - DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "pidgin" G_DIR_SEPARATOR_S "tray"); -} - diff --git a/pidgin/gtkdocklet.c b/pidgin/gtkdocklet.c index 48f6c02242..88ce410d30 100644 --- a/pidgin/gtkdocklet.c +++ b/pidgin/gtkdocklet.c @@ -30,6 +30,7 @@ #include "prefs.h" #include "signals.h" #include "sound.h" +#include "status.h" #include "gtkaccount.h" #include "gtkblist.h" @@ -48,8 +49,12 @@ #define DOCKLET_TOOLTIP_LINE_LIMIT 5 #endif +#define SHORT_EMBED_TIMEOUT 5 +#define LONG_EMBED_TIMEOUT 15 + /* globals */ -static struct docklet_ui_ops *ui_ops = NULL; +static GtkStatusIcon *docklet = NULL; +static guint embed_timeout = 0; static PurpleStatusPrimitive status = PURPLE_STATUS_OFFLINE; static gboolean pending = FALSE; static gboolean connecting = FALSE; @@ -58,9 +63,55 @@ static guint docklet_blinking_timer = 0; static gboolean visible = FALSE; static gboolean visibility_manager = FALSE; +/* protos */ +static void docklet_gtk_status_create(gboolean); +static void docklet_gtk_status_destroy(void); + /************************************************************************** * docklet status and utility functions **************************************************************************/ +static void +docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) +{ + const gchar *icon_name = NULL; + + switch (status) { + case PURPLE_STATUS_OFFLINE: + icon_name = PIDGIN_STOCK_TRAY_OFFLINE; + break; + case PURPLE_STATUS_AWAY: + icon_name = PIDGIN_STOCK_TRAY_AWAY; + break; + case PURPLE_STATUS_UNAVAILABLE: + icon_name = PIDGIN_STOCK_TRAY_BUSY; + break; + case PURPLE_STATUS_EXTENDED_AWAY: + icon_name = PIDGIN_STOCK_TRAY_XA; + break; + case PURPLE_STATUS_INVISIBLE: + icon_name = PIDGIN_STOCK_TRAY_INVISIBLE; + break; + default: + icon_name = PIDGIN_STOCK_TRAY_AVAILABLE; + break; + } + + if (pending) + icon_name = PIDGIN_STOCK_TRAY_PENDING; + if (connecting) + icon_name = PIDGIN_STOCK_TRAY_CONNECT; + + if (icon_name) { + gtk_status_icon_set_from_icon_name(docklet, icon_name); + } + + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")) { + gtk_status_icon_set_blinking(docklet, (pending && !connecting)); + } else if (gtk_status_icon_get_blinking(docklet)) { + gtk_status_icon_set_blinking(docklet, FALSE); + } +} + static gboolean docklet_blink_icon(gpointer data) { @@ -70,11 +121,8 @@ docklet_blink_icon(gpointer data) blinked = !blinked; if(pending && !connecting) { - if (blinked) { - if (ui_ops && ui_ops->blank_icon) - ui_ops->blank_icon(); - } else { - pidgin_docklet_update_icon(); + if (!blinked) { + docklet_gtk_status_update_icon(status, connecting, pending); } ret = TRUE; /* keep blinking */ } else { @@ -126,12 +174,12 @@ docklet_update_status(void) convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT); if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) { - if (convs && ui_ops->create && !visible) { + if (convs && !visible) { g_list_free(convs); - ui_ops->create(); + docklet_gtk_status_create(FALSE); return FALSE; - } else if (!convs && ui_ops->destroy && visible) { - ui_ops->destroy(); + } else if (!convs && visible) { + docklet_gtk_status_destroy(); return FALSE; } } @@ -142,53 +190,49 @@ docklet_update_status(void) } if (convs != NULL) { + /* set tooltip if messages are pending */ + GString *tooltip_text = g_string_new(""); newpending = TRUE; - /* set tooltip if messages are pending */ - if (ui_ops->set_tooltip) { - GString *tooltip_text = g_string_new(""); - for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) { - PurpleConversation *conv = (PurpleConversation *)l->data; - PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - - if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) { - g_string_append(tooltip_text, _("Right-click for more unread messages...\n")); - } else if(gtkconv) { - g_string_append_printf(tooltip_text, - ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), - gtkconv->unseen_count, - purple_conversation_get_title(conv)); - } else { - g_string_append_printf(tooltip_text, - ngettext("%d unread message from %s\n", "%d unread messages from %s\n", - GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"))), - GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")), - purple_conversation_get_title(conv)); - } + for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) { + PurpleConversation *conv = (PurpleConversation *)l->data; + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); + + if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) { + g_string_append(tooltip_text, _("Right-click for more unread messages...\n")); + } else if(gtkconv) { + g_string_append_printf(tooltip_text, + ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), + gtkconv->unseen_count, + purple_conversation_get_title(conv)); + } else { + g_string_append_printf(tooltip_text, + ngettext("%d unread message from %s\n", "%d unread messages from %s\n", + GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"))), + GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")), + purple_conversation_get_title(conv)); } + } - /* get rid of the last newline */ - if (tooltip_text->len > 0) - tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); - - ui_ops->set_tooltip(tooltip_text->str); + /* get rid of the last newline */ + if (tooltip_text->len > 0) + tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); - g_string_free(tooltip_text, TRUE); - } + gtk_status_icon_set_tooltip(docklet, tooltip_text->str); + g_string_free(tooltip_text, TRUE); g_list_free(convs); - } else if (ui_ops->set_tooltip) { + } else { char *tooltip_text = g_strconcat(PIDGIN_NAME, " - ", purple_savedstatus_get_title(saved_status), NULL); - ui_ops->set_tooltip(tooltip_text); + gtk_status_icon_set_tooltip(docklet, tooltip_text); g_free(tooltip_text); } for(l = purple_accounts_get_all(); l != NULL; l = l->next) { PurpleAccount *account = (PurpleAccount*)l->data; - PurpleStatus *account_status; if (!purple_account_get_enabled(account, PIDGIN_UI)) continue; @@ -196,7 +240,6 @@ docklet_update_status(void) if (purple_account_is_disconnected(account)) continue; - account_status = purple_account_get_active_status(account); if (purple_account_is_connecting(account)) newconnecting = TRUE; } @@ -209,7 +252,13 @@ docklet_update_status(void) pending = newpending; connecting = newconnecting; - pidgin_docklet_update_icon(); + docklet_gtk_status_update_icon(status, connecting, pending); + + /* and schedule the blinker function if messages are pending */ + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink") + && pending && !connecting && docklet_blinking_timer == 0) { + docklet_blinking_timer = g_timeout_add(500, docklet_blink_icon, NULL); + } } return FALSE; /* for when we're called by the glib idle handler */ @@ -223,7 +272,7 @@ online_account_supports_chat(void) while(c != NULL) { PurpleConnection *gc = c->data; - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info != NULL && prpl_info->chat_info != NULL) return TRUE; c = c->next; @@ -260,7 +309,7 @@ static void docklet_signed_on_cb(PurpleConnection *gc) { if (!enable_join_chat) { - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) + if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info != NULL) enable_join_chat = TRUE; } docklet_update_status(); @@ -270,7 +319,7 @@ static void docklet_signed_off_cb(PurpleConnection *gc) { if (enable_join_chat) { - if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) + if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info != NULL) enable_join_chat = online_account_supports_chat(); } docklet_update_status(); @@ -282,17 +331,15 @@ docklet_show_pref_changed_cb(const char *name, PurplePrefType type, { const char *val = value; if (!strcmp(val, "always")) { - if (ui_ops->create) { - if (!visible) - ui_ops->create(); - else if (!visibility_manager) { - pidgin_blist_visibility_manager_add(); - visibility_manager = TRUE; - } + if (!visible) + docklet_gtk_status_create(FALSE); + else if (!visibility_manager) { + pidgin_blist_visibility_manager_add(); + visibility_manager = TRUE; } } else if (!strcmp(val, "never")) { - if (visible && ui_ops->destroy) - ui_ops->destroy(); + if (visible) + docklet_gtk_status_destroy(); } else { if (visibility_manager) { pidgin_blist_visibility_manager_remove(); @@ -309,14 +356,19 @@ docklet_show_pref_changed_cb(const char *name, PurplePrefType type, static void docklet_toggle_mute(GtkWidget *toggle, void *data) { - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", GTK_CHECK_MENU_ITEM(toggle)->active); +} + +static void +docklet_toggle_blink(GtkWidget *toggle, void *data) +{ + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/blink", GTK_CHECK_MENU_ITEM(toggle)->active); } static void docklet_toggle_blist(GtkWidget *toggle, void *data) { - purple_blist_set_visible(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); + purple_blist_set_visible(GTK_CHECK_MENU_ITEM(toggle)->active); } #ifdef _WIN32 @@ -582,7 +634,7 @@ docklet_status_submenu(void) static void -plugin_act(GtkWidget *widget, PurplePluginAction *pam) +plugin_act(GtkObject *obj, PurplePluginAction *pam) { if (pam && pam->callback) pam->callback(pam); @@ -663,6 +715,7 @@ docklet_menu(void) { static GtkWidget *menu = NULL; GtkWidget *menuitem; + GtkMenuPositionFunc pos_func = gtk_status_icon_position_menu; if (menu) { gtk_widget_destroy(menu); @@ -723,6 +776,11 @@ docklet_menu(void) g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + menuitem = gtk_check_menu_item_new_with_mnemonic(_("_Blink on New Message")); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")); + g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blink), NULL); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + pidgin_separator(menu); /* add plugin actions */ @@ -733,24 +791,15 @@ docklet_menu(void) #ifdef _WIN32 g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); + pos_func = NULL; #endif gtk_widget_show_all(menu); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, - ui_ops->position_menu, - NULL, 0, gtk_get_current_event_time()); -} - -/************************************************************************** - * public api for ui_ops - **************************************************************************/ -void -pidgin_docklet_update_icon() -{ - if (ui_ops && ui_ops->update_icon) - ui_ops->update_icon(status, connecting, pending); + pos_func, + docklet, 0, gtk_get_current_event_time()); } -void +static void pidgin_docklet_clicked(int button_type) { switch (button_type) { @@ -771,8 +820,8 @@ pidgin_docklet_clicked(int button_type) } } -void -pidgin_docklet_embedded() +static void +pidgin_docklet_embedded(void) { if (!visibility_manager && strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) { @@ -781,11 +830,11 @@ pidgin_docklet_embedded() } visible = TRUE; docklet_update_status(); - pidgin_docklet_update_icon(); + docklet_gtk_status_update_icon(status, connecting, pending); } -void -pidgin_docklet_remove() +static void +pidgin_docklet_remove(void) { if (visible) { if (visibility_manager) { @@ -801,12 +850,183 @@ pidgin_docklet_remove() } } -void -pidgin_docklet_set_ui_ops(struct docklet_ui_ops *ops) +static gboolean +docklet_gtk_recreate_cb(gpointer data) +{ + docklet_gtk_status_create(TRUE); + + return FALSE; +} + +#ifndef _WIN32 +static gboolean +docklet_gtk_embed_timeout_cb(gpointer data) +{ +#if !GTK_CHECK_VERSION(2,12,0) + if (gtk_status_icon_is_embedded(docklet)) { + /* Older GTK+ (<2.12) don't implement the embedded signal, but the + information is still accessible through the above function. */ + purple_debug_info("docklet", "embedded\n"); + + pidgin_docklet_embedded(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); + } + else +#endif + { + /* The docklet was not embedded within the timeout. + * Remove it as a visibility manager, but leave the plugin + * loaded so that it can embed automatically if/when a notification + * area becomes available. + */ + purple_debug_info("docklet", "failed to embed within timeout\n"); + pidgin_docklet_remove(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); + } + +#if GTK_CHECK_VERSION(2,12,0) + embed_timeout = 0; + return FALSE; +#else + return TRUE; +#endif +} +#endif + +#if GTK_CHECK_VERSION(2,12,0) +static gboolean +docklet_gtk_embedded_cb(GtkWidget *widget, gpointer data) +{ + if (embed_timeout) { + purple_timeout_remove(embed_timeout); + embed_timeout = 0; + } + + if (gtk_status_icon_is_embedded(docklet)) { + purple_debug_info("docklet", "embedded\n"); + + pidgin_docklet_embedded(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); + } else { + purple_debug_info("docklet", "detached\n"); + + pidgin_docklet_remove(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); + } + + return TRUE; +} +#endif + +static void +docklet_gtk_destroyed_cb(GtkWidget *widget, gpointer data) +{ + purple_debug_info("docklet", "destroyed\n"); + + pidgin_docklet_remove(); + + g_object_unref(G_OBJECT(docklet)); + docklet = NULL; + + g_idle_add(docklet_gtk_recreate_cb, NULL); +} + +static void +docklet_gtk_status_activated_cb(GtkStatusIcon *status_icon, gpointer user_data) +{ + pidgin_docklet_clicked(1); +} + +static void +docklet_gtk_status_clicked_cb(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) { - ui_ops = ops; + purple_debug_info("docklet", "The button is %u\n", button); +#ifdef GDK_WINDOWING_QUARTZ + /* You can only click left mouse button on MacOSX native GTK. Let that be the menu */ + pidgin_docklet_clicked(3); +#else + pidgin_docklet_clicked(button); +#endif +} + +static void +docklet_gtk_status_destroy(void) +{ + g_return_if_fail(docklet != NULL); + + pidgin_docklet_remove(); + + if (embed_timeout) { + purple_timeout_remove(embed_timeout); + embed_timeout = 0; + } + + gtk_status_icon_set_visible(docklet, FALSE); + g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_gtk_destroyed_cb), NULL); + g_object_unref(G_OBJECT(docklet)); + docklet = NULL; + + purple_debug_info("docklet", "GTK+ destroyed\n"); } +static void +docklet_gtk_status_create(gboolean recreate) +{ + if (docklet) { + /* if this is being called when a tray icon exists, it's because + something messed up. try destroying it before we proceed, + although docklet_refcount may be all hosed. hopefully won't happen. */ + purple_debug_warning("docklet", "trying to create icon but it already exists?\n"); + docklet_gtk_status_destroy(); + } + + docklet = gtk_status_icon_new(); + g_return_if_fail(docklet != NULL); + + g_signal_connect(G_OBJECT(docklet), "activate", G_CALLBACK(docklet_gtk_status_activated_cb), NULL); + g_signal_connect(G_OBJECT(docklet), "popup-menu", G_CALLBACK(docklet_gtk_status_clicked_cb), NULL); +#if GTK_CHECK_VERSION(2,12,0) + g_signal_connect(G_OBJECT(docklet), "notify::embedded", G_CALLBACK(docklet_gtk_embedded_cb), NULL); +#endif + g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_gtk_destroyed_cb), NULL); + + gtk_status_icon_set_visible(docklet, TRUE); + + /* This is a hack to avoid a race condition between the docklet getting + * embedded in the notification area and the gtkblist restoring its + * previous visibility state. If the docklet does not get embedded within + * the timeout, it will be removed as a visibility manager until it does + * get embedded. Ideally, we would only call docklet_embedded() when the + * icon was actually embedded. This only happens when the docklet is first + * created, not when being recreated. + * + * The gtk docklet tracks whether it successfully embedded in a pref and + * allows for a longer timeout period if it successfully embedded the last + * time it was run. This should hopefully solve problems with the buddy + * list not properly starting hidden when Pidgin is started on login. + */ + if (!recreate) { + pidgin_docklet_embedded(); +#ifndef _WIN32 +#if GTK_CHECK_VERSION(2,12,0) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) { + embed_timeout = purple_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); + } else { + embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); + } +#else + embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); +#endif +#endif + } + + purple_debug_info("docklet", "GTK+ created\n"); +} + +/************************************************************************** + * public api + **************************************************************************/ + void* pidgin_docklet_get_handle() { @@ -822,6 +1042,7 @@ pidgin_docklet_init() void *accounts_handle = purple_accounts_get_handle(); void *status_handle = purple_savedstatuses_get_handle(); void *docklet_handle = pidgin_docklet_get_handle(); + gchar *tmp; purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet"); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/blink", FALSE); @@ -829,9 +1050,20 @@ pidgin_docklet_init() purple_prefs_connect_callback(docklet_handle, PIDGIN_PREFS_ROOT "/docklet/show", docklet_show_pref_changed_cb, NULL); - docklet_ui_init(); - if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always") && ui_ops && ui_ops->create) - ui_ops->create(); + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet/gtk"); + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded")) { + purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); + purple_prefs_remove(PIDGIN_PREFS_ROOT "/docklet/x11/embedded"); + } else { + purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); + } + + tmp = g_build_path(G_DIR_SEPARATOR_S, DATADIR, "pixmaps", "pidgin", "tray", NULL); + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), tmp); + g_free(tmp); + + if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always")) + docklet_gtk_status_create(FALSE); purple_signal_connect(conn_handle, "signed-on", docklet_handle, PURPLE_CALLBACK(docklet_signed_on_cb), NULL); @@ -860,6 +1092,7 @@ pidgin_docklet_init() void pidgin_docklet_uninit() { - if (visible && ui_ops && ui_ops->destroy) - ui_ops->destroy(); + if (visible) + docklet_gtk_status_destroy(); } + diff --git a/pidgin/gtkdocklet.h b/pidgin/gtkdocklet.h index 34f88a14f5..af8538b7bd 100644 --- a/pidgin/gtkdocklet.h +++ b/pidgin/gtkdocklet.h @@ -25,31 +25,9 @@ #ifndef _GTKDOCKLET_H_ #define _GTKDOCKLET_H_ -#include "status.h" - -struct docklet_ui_ops -{ - void (*create)(void); - void (*destroy)(void); - void (*update_icon)(PurpleStatusPrimitive, gboolean, gboolean); - void (*blank_icon)(void); - void (*set_tooltip)(gchar *); - GtkMenuPositionFunc position_menu; -}; - - -/* functions in gtkdocklet.c */ -void pidgin_docklet_update_icon(void); -void pidgin_docklet_clicked(int); -void pidgin_docklet_embedded(void); -void pidgin_docklet_remove(void); -void pidgin_docklet_set_ui_ops(struct docklet_ui_ops *); -void pidgin_docklet_unload(void); void pidgin_docklet_init(void); void pidgin_docklet_uninit(void); void*pidgin_docklet_get_handle(void); -/* function in gtkdocklet-{gtk,x11,win32}.c */ -void docklet_ui_init(void); - #endif /* _GTKDOCKLET_H_ */ + diff --git a/pidgin/gtkft.c b/pidgin/gtkft.c index 4c1bc658ea..d8cb8855c6 100644 --- a/pidgin/gtkft.c +++ b/pidgin/gtkft.c @@ -37,9 +37,6 @@ #include "pidginstock.h" #include "gtkutils.h" -#define PIDGINXFER(xfer) \ - (PidginXferUiData *)(xfer)->ui_data - /* the maximum size of files we will try to make a thumbnail for */ #define PIDGIN_XFER_MAX_SIZE_IMAGE_THUMBNAIL 10 * 1024 * 1024 @@ -116,14 +113,17 @@ get_xfer_info_strings(PurpleXfer *xfer, char **kbsec, char **time_elapsed, double kbps = 0.0; time_t elapsed, now; - if (xfer->end_time != 0) - now = xfer->end_time; - else + now = purple_xfer_get_end_time(xfer); + if (now == 0) now = time(NULL); kb_sent = purple_xfer_get_bytes_sent(xfer) / 1024.0; kb_rem = purple_xfer_get_bytes_remaining(xfer) / 1024.0; - elapsed = (xfer->start_time > 0 ? now - xfer->start_time : 0); + elapsed = purple_xfer_get_start_time(xfer); + if (elapsed > 0) + elapsed = now - elapsed; + else + elapsed = 0; kbps = (elapsed > 0 ? (kb_sent / elapsed) : 0); if (kbsec != NULL) { @@ -135,9 +135,9 @@ get_xfer_info_strings(PurpleXfer *xfer, char **kbsec, char **time_elapsed, int h, m, s; int secs_elapsed; - if (xfer->start_time > 0) + if (purple_xfer_get_start_time(xfer) > 0) { - secs_elapsed = now - xfer->start_time; + secs_elapsed = now - purple_xfer_get_start_time(xfer); h = secs_elapsed / 3600; m = (secs_elapsed % 3600) / 60; @@ -155,7 +155,7 @@ get_xfer_info_strings(PurpleXfer *xfer, char **kbsec, char **time_elapsed, if (purple_xfer_is_completed(xfer)) { *time_remaining = g_strdup(_("Finished")); } - else if (purple_xfer_is_canceled(xfer)) { + else if (purple_xfer_is_cancelled(xfer)) { *time_remaining = g_strdup(_("Cancelled")); } else if (purple_xfer_get_size(xfer) == 0 || (kb_sent > 0 && kbps == 0)) { @@ -243,11 +243,11 @@ update_detailed_info(PidginXferDialog *dialog, PurpleXfer *xfer) if (dialog == NULL || xfer == NULL) return; - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); get_xfer_info_strings(xfer, &kbsec, &time_elapsed, &time_remaining); - status = g_strdup_printf("%d%% (%" G_GSIZE_FORMAT " of %" G_GSIZE_FORMAT " bytes)", + status = g_strdup_printf("%d%% (%" G_GOFFSET_FORMAT " of %" G_GOFFSET_FORMAT " bytes)", (int)(purple_xfer_get_progress(xfer)*100), purple_xfer_get_bytes_sent(xfer), purple_xfer_get_size(xfer)); @@ -281,10 +281,10 @@ update_detailed_info(PidginXferDialog *dialog, PurpleXfer *xfer) } gtk_label_set_text(GTK_LABEL(dialog->local_user_label), - purple_account_get_username(xfer->account)); - gtk_label_set_text(GTK_LABEL(dialog->remote_user_label), xfer->who); + purple_account_get_username(purple_xfer_get_account(xfer))); + gtk_label_set_text(GTK_LABEL(dialog->remote_user_label), purple_xfer_get_remote_user(xfer)); gtk_label_set_text(GTK_LABEL(dialog->protocol_label), - purple_account_get_protocol_name(xfer->account)); + purple_account_get_protocol_name(purple_xfer_get_account(xfer))); if (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) { gtk_label_set_text(GTK_LABEL(dialog->filename_label), @@ -357,7 +357,7 @@ update_buttons(PidginXferDialog *dialog, PurpleXfer *xfer) #endif gtk_widget_set_sensitive(dialog->remove_button, TRUE); - } else if (purple_xfer_is_canceled(xfer)) { + } else if (purple_xfer_is_cancelled(xfer)) { gtk_widget_hide(dialog->stop_button); gtk_widget_show(dialog->remove_button); @@ -732,8 +732,8 @@ pidgin_xfer_dialog_new(void) gtk_widget_show(vbox2); /* Setup the listbox */ - gtk_box_pack_start(GTK_BOX(vbox2), - pidgin_make_scrollable(setup_tree(dialog), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, 140), + gtk_box_pack_start(GTK_BOX(vbox2), + pidgin_make_scrollable(setup_tree(dialog), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, 140), TRUE, TRUE, 0); /* "Close this window when all transfers finish" */ @@ -869,7 +869,7 @@ pidgin_xfer_dialog_add_xfer(PidginXferDialog *dialog, PurpleXfer *xfer) purple_xfer_ref(xfer); - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); data->in_list = TRUE; pidgin_xfer_dialog_show(dialog); @@ -926,7 +926,7 @@ pidgin_xfer_dialog_remove_xfer(PidginXferDialog *dialog, g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data == NULL) return; @@ -957,7 +957,7 @@ pidgin_xfer_dialog_cancel_xfer(PidginXferDialog *dialog, g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data == NULL) return; @@ -970,7 +970,7 @@ pidgin_xfer_dialog_cancel_xfer(PidginXferDialog *dialog, return; } - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); update_detailed_info(dialog, xfer); update_title_progress(dialog); @@ -979,7 +979,7 @@ pidgin_xfer_dialog_cancel_xfer(PidginXferDialog *dialog, PIDGIN_STOCK_FILE_CANCELED, GTK_ICON_SIZE_MENU, NULL); - if (purple_xfer_is_canceled(xfer)) + if (purple_xfer_is_cancelled(xfer)) status = _("Cancelled"); else status = _("Failed"); @@ -1007,7 +1007,7 @@ pidgin_xfer_dialog_update_xfer(PidginXferDialog *dialog, g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); - if ((data = PIDGINXFER(xfer)) == NULL) + if ((data = purple_xfer_get_ui_data(xfer)) == NULL) return; if (data->in_list == FALSE) @@ -1095,9 +1095,9 @@ pidgin_xfer_new_xfer(PurpleXfer *xfer) { PidginXferUiData *data; - /* This is where we're setting xfer->ui_data for the first time. */ + /* This is where we're setting xfer's "ui_data" for the first time. */ data = g_new0(PidginXferUiData, 1); - xfer->ui_data = data; + purple_xfer_set_ui_data(xfer, data); } static void @@ -1105,11 +1105,11 @@ pidgin_xfer_destroy(PurpleXfer *xfer) { PidginXferUiData *data; - data = PIDGINXFER(xfer); + data = purple_xfer_get_ui_data(xfer); if (data) { g_free(data->name); g_free(data); - xfer->ui_data = NULL; + purple_xfer_set_ui_data(xfer, NULL); } } diff --git a/pidgin/gtkicon-theme.c b/pidgin/gtkicon-theme.c index feca1dd7ef..b669d93522 100644 --- a/pidgin/gtkicon-theme.c +++ b/pidgin/gtkicon-theme.c @@ -26,7 +26,7 @@ #include #define PIDGIN_ICON_THEME_GET_PRIVATE(Gobject) \ - ((PidginIconThemePrivate *) ((PIDGIN_ICON_THEME(Gobject))->priv)) + (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_ICON_THEME, PidginIconThemePrivate)) /****************************************************************************** * Structs @@ -53,8 +53,6 @@ pidgin_icon_theme_init(GTypeInstance *instance, { PidginIconThemePrivate *priv; - (PIDGIN_ICON_THEME(instance))->priv = g_new0(PidginIconThemePrivate, 1); - priv = PIDGIN_ICON_THEME_GET_PRIVATE(instance); priv->icon_files = g_hash_table_new_full(g_str_hash, @@ -69,7 +67,6 @@ pidgin_icon_theme_finalize(GObject *obj) priv = PIDGIN_ICON_THEME_GET_PRIVATE(obj); g_hash_table_destroy(priv->icon_files); - g_free(priv); parent_class->finalize(obj); } @@ -82,6 +79,8 @@ pidgin_icon_theme_class_init(PidginIconThemeClass *klass) parent_class = g_type_class_peek_parent(klass); obj_class->finalize = pidgin_icon_theme_finalize; + + g_type_class_add_private(klass, sizeof(PidginIconThemePrivate)); } GType diff --git a/pidgin/gtkicon-theme.h b/pidgin/gtkicon-theme.h index ce67048ba8..18d0d24497 100644 --- a/pidgin/gtkicon-theme.h +++ b/pidgin/gtkicon-theme.h @@ -50,7 +50,6 @@ typedef struct _PidginIconThemeClass PidginIconThemeClass; struct _PidginIconTheme { PurpleTheme parent; - gpointer priv; }; struct _PidginIconThemeClass diff --git a/pidgin/gtkidle.c b/pidgin/gtkidle.c index 51d821f66f..39862ca4fb 100644 --- a/pidgin/gtkidle.c +++ b/pidgin/gtkidle.c @@ -108,7 +108,7 @@ pidgin_get_time_idle(void) if (has_extension == -1) has_extension = XScreenSaverQueryExtension(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), - &event_base, &error_base); + &event_base, &error_base); if (has_extension) { @@ -116,7 +116,7 @@ pidgin_get_time_idle(void) mit_info = XScreenSaverAllocInfo(); XScreenSaverQueryInfo(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), - GDK_ROOT_WINDOW(), mit_info); + GDK_ROOT_WINDOW(), mit_info); return (mit_info->idle) / 1000; } else diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c index 23d9e82db5..579f1730ed 100644 --- a/pidgin/gtkimhtml.c +++ b/pidgin/gtkimhtml.c @@ -65,6 +65,16 @@ #define TOOLTIP_TIMEOUT 500 +#if !GTK_CHECK_VERSION(2,20,0) +#define gtk_widget_get_realized(x) GTK_WIDGET_REALIZED(x) + +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_has_window(x) !GTK_WIDGET_NO_WINDOW(x) +#define gtk_widget_get_state(x) GTK_WIDGET_STATE(x) +#define gtk_widget_is_drawable(x) GTK_WIDGET_DRAWABLE(x) +#endif +#endif + static GtkTextViewClass *parent_class = NULL; struct scalable_data { @@ -83,6 +93,36 @@ struct im_image_data { GtkTextMark *mark; }; +struct _GtkIMHtmlScalable { + void (*scale)(struct _GtkIMHtmlScalable *, int, int); + void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); + void (*free)(struct _GtkIMHtmlScalable *); +}; + +struct _GtkIMHtmlHr { + GtkIMHtmlScalable scalable; + GtkWidget *sep; +}; + +struct _GtkIMHtmlImage { + GtkIMHtmlScalable scalable; + GtkImage *image; /**< Contains the scaled version of this pixbuf. */ + GdkPixbuf *pixbuf; /**< The original pixbuf, before any scaling. */ + GtkTextMark *mark; + gchar *filename; + int width; + int height; + int id; + GtkWidget *filesel; +}; + +struct _GtkIMHtmlAnimation { + GtkIMHtmlImage imhtmlimage; + GdkPixbufAnimation *anim; /**< The original animation, before any scaling. */ + GdkPixbufAnimationIter *iter; + guint timer; +}; + struct _GtkIMHtmlLink { GtkIMHtml *imhtml; @@ -90,8 +130,13 @@ struct _GtkIMHtmlLink GtkTextTag *tag; }; -typedef struct _GtkIMHtmlProtocol -{ +struct _GtkSmileyTree { + GString *values; + GtkSmileyTree **children; + GtkIMHtmlSmiley *image; +}; + +typedef struct { char *name; int length; @@ -99,7 +144,8 @@ typedef struct _GtkIMHtmlProtocol gboolean (*context_menu)(GtkIMHtml *imhtml, GtkIMHtmlLink *link, GtkWidget *menu); } GtkIMHtmlProtocol; -typedef struct _GtkIMHtmlFontDetail { +/* The five elements contained in a FONT tag */ +typedef struct { gushort size; gchar *face; gchar *fore; @@ -511,20 +557,18 @@ static gint gtk_imhtml_tip_paint (GtkIMHtml *imhtml) { PangoLayout *layout; - cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(imhtml->tip_window)); g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); layout = gtk_widget_create_pango_layout(imhtml->tip_window, imhtml->tip); - gtk_paint_flat_box (gtk_widget_get_style(imhtml->tip_window), cr, - GTK_STATE_NORMAL, GTK_SHADOW_OUT, imhtml->tip_window, "tooltip", - 0, 0, -1, -1); + gtk_paint_flat_box (imhtml->tip_window->style, imhtml->tip_window->window, + GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, imhtml->tip_window, + "tooltip", 0, 0, -1, -1); - gtk_paint_layout (gtk_widget_get_style(imhtml->tip_window), cr, - GTK_STATE_NORMAL, TRUE, imhtml->tip_window, NULL, 4, 4, layout); + gtk_paint_layout (imhtml->tip_window->style, imhtml->tip_window->window, GTK_STATE_NORMAL, + FALSE, NULL, imhtml->tip_window, NULL, 4, 4, layout); - cairo_destroy(cr); g_object_unref(layout); return FALSE; } @@ -536,15 +580,12 @@ gtk_imhtml_tip (gpointer data) PangoFontMetrics *font_metrics; PangoLayout *layout; PangoFont *font; - GtkStyle *style = gtk_widget_get_style(imhtml->tip_window); - GtkAllocation allocation; + gint gap, x, y, h, w, scr_w, baseline_skip; g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); - gtk_widget_get_allocation(GTK_WIDGET(imhtml), &allocation); - - if (!imhtml->tip || !gtk_widget_is_drawable(GTK_WIDGET(imhtml))) { + if (!imhtml->tip || !gtk_widget_is_drawable (GTK_WIDGET(imhtml))) { imhtml->tip_timer = 0; return FALSE; } @@ -568,10 +609,11 @@ gtk_imhtml_tip (gpointer data) gtk_widget_ensure_style (imhtml->tip_window); layout = gtk_widget_create_pango_layout(imhtml->tip_window, imhtml->tip); font = pango_context_load_font(pango_layout_get_context(layout), - style->font_desc); + imhtml->tip_window->style->font_desc); if (font == NULL) { - char *tmp = pango_font_description_to_string(style->font_desc); + char *tmp = pango_font_description_to_string( + imhtml->tip_window->style->font_desc); purple_debug(PURPLE_DEBUG_ERROR, "gtk_imhtml_tip", "pango_context_load_font() couldn't load font: '%s'\n", @@ -596,8 +638,8 @@ gtk_imhtml_tip (gpointer data) h = 8 + baseline_skip; gdk_window_get_pointer (NULL, &x, &y, NULL); - if ((!gtk_widget_get_has_window(GTK_WIDGET(imhtml)))) - y += allocation.y; + if (!gtk_widget_get_has_window (GTK_WIDGET(imhtml))) + y += GTK_WIDGET(imhtml)->allocation.y; scr_w = gdk_screen_width(); @@ -637,7 +679,7 @@ gtk_motion_event_notify(GtkWidget *imhtml, GdkEventMotion *event, gpointer data) oldprelit_tag = GTK_IMHTML(imhtml)->prelit_tag; - gdk_window_get_pointer(gtk_widget_get_window(GTK_WIDGET(imhtml)), NULL, NULL, NULL); + gdk_window_get_pointer(GTK_WIDGET(imhtml)->window, NULL, NULL, NULL); gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(imhtml), GTK_TEXT_WINDOW_WIDGET, event->x, event->y, &x, &y); gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(imhtml), &iter, x, y); @@ -765,8 +807,6 @@ gtk_leave_event_notify(GtkWidget *imhtml, GdkEventCrossing *event, gpointer data return FALSE; } -/* TODO: I think this can be removed for GTK+ 3.0... */ -#if 0 static gint gtk_imhtml_expose_event (GtkWidget *widget, GdkEventExpose *event) @@ -794,8 +834,7 @@ gtk_imhtml_expose_event (GtkWidget *widget, gdk_color_parse(GTK_IMHTML(widget)->edit.background, &gcolor); gdk_cairo_set_source_color(cr, &gcolor); } else { - gdk_cairo_set_source_color(cr, - &(gtk_widget_get_style(widget)->base[gtk_widget_get_state(widget)])); + gdk_cairo_set_source_color(cr, &(widget->style->base[gtk_widget_get_state(widget)])); } cairo_rectangle(cr, @@ -901,7 +940,6 @@ gtk_imhtml_expose_event (GtkWidget *widget, return FALSE; } -#endif static void paste_unformatted_cb(GtkMenuItem *menu, GtkIMHtml *imhtml) @@ -1073,7 +1111,7 @@ static void gtk_imhtml_clipboard_get(GtkClipboard *clipboard, GtkSelectionData * } if (primary) /* This was allocated here */ g_free(text); -} + } static void gtk_imhtml_primary_clipboard_clear(GtkClipboard *clipboard, GtkIMHtml *imhtml) { @@ -1178,12 +1216,11 @@ static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *select { char *text; GtkIMHtml *imhtml = data; - gint length = gtk_selection_data_get_length(selection_data); if (!gtk_text_view_get_editable(GTK_TEXT_VIEW(imhtml))) return; - if (imhtml->wbfo || length <= 0) { + if (imhtml->wbfo || selection_data->length <= 0) { gtk_clipboard_request_text(clipboard, paste_plaintext_received_cb, imhtml); return; } else { @@ -1207,13 +1244,13 @@ static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *select } #endif - text = g_malloc(length + 1); - memcpy(text, gtk_selection_data_get_data(selection_data), length); + text = g_malloc(selection_data->length + 1); + memcpy(text, selection_data->data, selection_data->length); /* Make sure the paste data is null-terminated. Given that * we're passed length (but assume later that it is * null-terminated), this seems sensible to me. */ - text[length] = '\0'; + text[selection_data->length] = '\0'; } #ifdef _WIN32 @@ -1224,10 +1261,10 @@ static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *select } #endif - if (length >= 2 && + if (selection_data->length >= 2 && (*(guint16 *)text == 0xfeff || *(guint16 *)text == 0xfffe)) { /* This is UTF-16 */ - char *utf8 = utf16_to_utf8_with_bom_check(text, length); + char *utf8 = utf16_to_utf8_with_bom_check(text, selection_data->length); g_free(text); text = utf8; if (!text) { @@ -1342,7 +1379,7 @@ static gboolean gtk_imhtml_button_press_event(GtkIMHtml *imhtml, GdkEventButton paste_received_cb, imhtml); return TRUE; - } + } return FALSE; } @@ -1588,8 +1625,7 @@ static void gtk_imhtml_class_init (GtkIMHtmlClass *klass) gobject_class->finalize = gtk_imhtml_finalize; widget_class->drag_motion = gtk_text_view_drag_motion; - /* TODO: I _think_ this should be removed for GTK+ 3.0 */ - /*widget_class->expose_event = gtk_imhtml_expose_event;*/ + widget_class->expose_event = gtk_imhtml_expose_event; parent_size_allocate = widget_class->size_allocate; widget_class->size_allocate = gtk_imhtml_size_allocate; parent_style_set = widget_class->style_set; @@ -1651,20 +1687,20 @@ static void gtk_imhtml_class_init (GtkIMHtmlClass *klass) TRUE, G_PARAM_READABLE)); binding_set = gtk_binding_set_by_class (parent_class); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_b, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_BOLD); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_i, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_ITALIC); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_u, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_UNDERLINE); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_plus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_equal, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_minus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_SHRINK); + gtk_binding_entry_add_signal (binding_set, GDK_b, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_BOLD); + gtk_binding_entry_add_signal (binding_set, GDK_i, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_ITALIC); + gtk_binding_entry_add_signal (binding_set, GDK_u, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_UNDERLINE); + gtk_binding_entry_add_signal (binding_set, GDK_plus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW); + gtk_binding_entry_add_signal (binding_set, GDK_equal, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW); + gtk_binding_entry_add_signal (binding_set, GDK_minus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_SHRINK); binding_set = gtk_binding_set_by_class(klass); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_r, GDK_CONTROL_MASK, "format_function_clear", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Enter, 0, "message_send", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Return, 0, "message_send", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_z, GDK_CONTROL_MASK, "undo", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_z, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "redo", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_F14, 0, "undo", 0); - gtk_binding_entry_add_signal(binding_set, GDK_KEY_v, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "paste", 1, G_TYPE_STRING, "text"); + gtk_binding_entry_add_signal (binding_set, GDK_r, GDK_CONTROL_MASK, "format_function_clear", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "message_send", 0); + gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "message_send", 0); + gtk_binding_entry_add_signal (binding_set, GDK_z, GDK_CONTROL_MASK, "undo", 0); + gtk_binding_entry_add_signal (binding_set, GDK_z, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "redo", 0); + gtk_binding_entry_add_signal (binding_set, GDK_F14, 0, "undo", 0); + gtk_binding_entry_add_signal(binding_set, GDK_v, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "paste", 1, G_TYPE_STRING, "text"); } static void gtk_imhtml_init (GtkIMHtml *imhtml) @@ -1891,23 +1927,23 @@ gtk_text_view_drag_motion (GtkWidget *widget, /* can't accept any of the offered targets */ } else { GtkWidget *source_widget; - suggested_action = gdk_drag_context_get_suggested_action(context); + suggested_action = context->suggested_action; source_widget = gtk_drag_get_source_widget (context); if (source_widget == widget) { /* Default to MOVE, unless the user has * pressed ctrl or alt to affect available actions */ - if ((gdk_drag_context_get_actions(context) & GDK_ACTION_MOVE) != 0) + if ((context->actions & GDK_ACTION_MOVE) != 0) suggested_action = GDK_ACTION_MOVE; } } gdk_drag_status (context, suggested_action, time); - /* TRUE return means don't propagate the drag motion to parent - * widgets that may also be drop sites. - */ - return TRUE; + /* TRUE return means don't propagate the drag motion to parent + * widgets that may also be drop sites. + */ + return TRUE; } static void @@ -1929,22 +1965,21 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guin { gchar **links; gchar *link; - char *text = (char *) gtk_selection_data_get_data(sd); + char *text = (char *)sd->data; GtkTextMark *mark = gtk_text_buffer_get_insert(imhtml->text_buffer); GtkTextIter iter; gint i = 0; - gint length = gtk_selection_data_get_length(sd); gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark); - if (gtk_imhtml_get_editable(imhtml) && text) { + if(gtk_imhtml_get_editable(imhtml) && sd->data){ switch (info) { case GTK_IMHTML_DRAG_URL: /* TODO: Is it really ok to change sd->data...? */ - purple_str_strip_char(text, '\r'); + purple_str_strip_char((char *)sd->data, '\r'); - links = g_strsplit(text, "\n", 0); - while ((link = links[i]) != NULL) { + links = g_strsplit((char *)sd->data, "\n", 0); + while((link = links[i]) != NULL){ if (gtk_imhtml_is_protocol(link)) { gchar *label; @@ -1966,7 +2001,7 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guin i++; } - g_strfreev(links); + g_strfreev(links); break; case GTK_IMHTML_DRAG_HTML: { @@ -1982,8 +2017,8 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guin * See also the comment on text/html here: * http://mail.gnome.org/archives/gtk-devel-list/2001-September/msg00114.html */ - if (length >= 2 && !g_utf8_validate(text, length - 1, NULL)) { - utf8 = utf16_to_utf8_with_bom_check(text, length); + if (sd->length >= 2 && !g_utf8_validate(text, sd->length - 1, NULL)) { + utf8 = utf16_to_utf8_with_bom_check(text, sd->length); if (!utf8) { purple_debug_warning("gtkimhtml", "g_convert from UTF-16 failed in drag_rcv_cb\n"); @@ -2012,8 +2047,7 @@ gtk_imhtml_link_drag_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guin gtk_drag_finish(dc, FALSE, FALSE, t); return; } - gtk_drag_finish(dc, TRUE, - gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } else { gtk_drag_finish(dc, FALSE, FALSE, t); } @@ -2544,8 +2578,8 @@ void gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, static gboolean smooth_scroll_cb(gpointer data) { GtkIMHtml *imhtml = data; - GtkAdjustment *adj = gtk_text_view_get_vadjustment(GTK_TEXT_VIEW(imhtml)); - gdouble max_val = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj); + GtkAdjustment *adj = GTK_TEXT_VIEW(imhtml)->vadjustment; + gdouble max_val = adj->upper - adj->page_size; gdouble scroll_val = gtk_adjustment_get_value(adj) + ((max_val - gtk_adjustment_get_value(adj)) / 3); g_return_val_if_fail(imhtml->scroll_time != NULL, FALSE); @@ -2568,10 +2602,9 @@ static gboolean smooth_scroll_cb(gpointer data) static gboolean scroll_idle_cb(gpointer data) { GtkIMHtml *imhtml = data; - GtkAdjustment *adj = gtk_text_view_get_vadjustment(GTK_TEXT_VIEW(imhtml)); - if (adj) { - gtk_adjustment_set_value(adj, gtk_adjustment_get_upper(adj) - - gtk_adjustment_get_page_size(adj)); + GtkAdjustment *adj = GTK_TEXT_VIEW(imhtml)->vadjustment; + if(adj) { + gtk_adjustment_set_value(adj, adj->upper - adj->page_size); } imhtml->scroll_src = 0; return FALSE; @@ -3606,125 +3639,38 @@ void gtk_imhtml_page_down (GtkIMHtml *imhtml) gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(imhtml), &iter, 0, TRUE, 0, 0); } -/* GtkIMHtmlScalable, gtk_imhtml_image, gtk_imhtml_hr */ -GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id) -{ - GtkIMHtmlImage *im_image = g_malloc(sizeof(GtkIMHtmlImage)); - - GTK_IMHTML_SCALABLE(im_image)->scale = gtk_imhtml_image_scale; - GTK_IMHTML_SCALABLE(im_image)->add_to = gtk_imhtml_image_add_to; - GTK_IMHTML_SCALABLE(im_image)->free = gtk_imhtml_image_free; - - im_image->pixbuf = img; - im_image->image = GTK_IMAGE(gtk_image_new_from_pixbuf(im_image->pixbuf)); - im_image->width = gdk_pixbuf_get_width(img); - im_image->height = gdk_pixbuf_get_height(img); - im_image->mark = NULL; - im_image->filename = g_strdup(filename); - im_image->id = id; - im_image->filesel = NULL; - - g_object_ref(img); - return GTK_IMHTML_SCALABLE(im_image); -} - -static gboolean -animate_image_cb(gpointer data) -{ - GtkIMHtmlImage *im_image; - int width, height; - int delay; - - im_image = data; - - /* Update the pointer to this GdkPixbuf frame of the animation */ - if (gdk_pixbuf_animation_iter_advance(GTK_IMHTML_ANIMATION(im_image)->iter, NULL)) { - GdkPixbuf *pb = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); - g_object_unref(G_OBJECT(im_image->pixbuf)); - im_image->pixbuf = gdk_pixbuf_copy(pb); - - /* Update the displayed GtkImage */ - width = gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)); - height = gdk_pixbuf_get_height(gtk_image_get_pixbuf(im_image->image)); - if (width > 0 && height > 0) - { - /* Need to scale the new frame to the same size as the old frame */ - GdkPixbuf *tmp; - tmp = gdk_pixbuf_scale_simple(im_image->pixbuf, width, height, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(im_image->image, tmp); - g_object_unref(G_OBJECT(tmp)); - } else { - /* Display at full-size */ - gtk_image_set_from_pixbuf(im_image->image, im_image->pixbuf); - } - } - - delay = MIN(gdk_pixbuf_animation_iter_get_delay_time(GTK_IMHTML_ANIMATION(im_image)->iter), 100); - GTK_IMHTML_ANIMATION(im_image)->timer = g_timeout_add(delay, animate_image_cb, im_image); - - return FALSE; -} - -GtkIMHtmlScalable *gtk_imhtml_animation_new(GdkPixbufAnimation *anim, const gchar *filename, int id) +/** + * Destroys and frees a GTK+ IM/HTML scalable image. + * + * @param scale The GTK+ IM/HTML scalable. + */ +static void gtk_imhtml_image_free(GtkIMHtmlScalable *scale) { - GtkIMHtmlImage *im_image = (GtkIMHtmlImage *) g_new0(GtkIMHtmlAnimation, 1); - - GTK_IMHTML_SCALABLE(im_image)->scale = gtk_imhtml_image_scale; - GTK_IMHTML_SCALABLE(im_image)->add_to = gtk_imhtml_image_add_to; - GTK_IMHTML_SCALABLE(im_image)->free = gtk_imhtml_animation_free; - - GTK_IMHTML_ANIMATION(im_image)->anim = anim; - if (gdk_pixbuf_animation_is_static_image(anim)) { - im_image->pixbuf = gdk_pixbuf_animation_get_static_image(anim); - g_object_ref(im_image->pixbuf); - } else { - int delay; - GdkPixbuf *pb; - GTK_IMHTML_ANIMATION(im_image)->iter = gdk_pixbuf_animation_get_iter(anim, NULL); - pb = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); - im_image->pixbuf = gdk_pixbuf_copy(pb); - delay = MIN(gdk_pixbuf_animation_iter_get_delay_time(GTK_IMHTML_ANIMATION(im_image)->iter), 100); - GTK_IMHTML_ANIMATION(im_image)->timer = g_timeout_add(delay, animate_image_cb, im_image); - } - im_image->image = GTK_IMAGE(gtk_image_new_from_pixbuf(im_image->pixbuf)); - im_image->width = gdk_pixbuf_animation_get_width(anim); - im_image->height = gdk_pixbuf_animation_get_height(anim); - im_image->filename = g_strdup(filename); - im_image->id = id; - - g_object_ref(anim); + GtkIMHtmlImage *image = (GtkIMHtmlImage *)scale; - return GTK_IMHTML_SCALABLE(im_image); + g_object_unref(image->pixbuf); + g_free(image->filename); + if (image->filesel) + gtk_widget_destroy(image->filesel); + g_free(scale); } -void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height) +/** + * Destroys and frees a GTK+ IM/HTML scalable animation. + * + * @param scale The GTK+ IM/HTML scalable. + */ +static void gtk_imhtml_animation_free(GtkIMHtmlScalable *scale) { - GtkIMHtmlImage *im_image = (GtkIMHtmlImage *)scale; - - if (im_image->width > width || im_image->height > height) { - double ratio_w, ratio_h, ratio; - int new_h, new_w; - GdkPixbuf *new_image = NULL; - - ratio_w = ((double)width - 2) / im_image->width; - ratio_h = ((double)height - 2) / im_image->height; - - ratio = (ratio_w < ratio_h) ? ratio_w : ratio_h; - - new_w = (int)(im_image->width * ratio); - new_h = (int)(im_image->height * ratio); + GtkIMHtmlAnimation *animation = (GtkIMHtmlAnimation *)scale; - new_image = gdk_pixbuf_scale_simple(im_image->pixbuf, new_w, new_h, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(im_image->image, new_image); - g_object_unref(G_OBJECT(new_image)); - } else if (gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)) != im_image->width) { - /* Enough space to show the full-size of the image. */ - GdkPixbuf *new_image; + if (animation->timer > 0) + g_source_remove(animation->timer); + if (animation->iter != NULL) + g_object_unref(animation->iter); + g_object_unref(animation->anim); - new_image = gdk_pixbuf_scale_simple(im_image->pixbuf, im_image->width, im_image->height, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(im_image->image, new_image); - g_object_unref(G_OBJECT(new_image)); - } + gtk_imhtml_image_free(scale); } static void @@ -3931,55 +3877,51 @@ static gboolean gtk_imhtml_image_clicked(GtkWidget *w, GdkEvent *event, GtkIMHtm } -static gboolean gtk_imhtml_smiley_clicked(GtkWidget *w, GdkEvent *event, GtkIMHtmlSmiley *smiley) +/** + * Rescales a GTK+ IM/HTML scalable image to a given size. + * + * @param scale The GTK+ IM/HTML scalable. + * @param width The new width. + * @param height The new height. + */ +static void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height) { - GdkPixbufAnimation *anim = NULL; - GtkIMHtmlImageSave *save = NULL; - gboolean ret; - - if (event->type != GDK_BUTTON_RELEASE || ((GdkEventButton*)event)->button != 3) - return FALSE; - - anim = gtk_smiley_get_image(smiley); - if (!anim) - return FALSE; + GtkIMHtmlImage *im_image = (GtkIMHtmlImage *)scale; - save = g_new0(GtkIMHtmlImageSave, 1); - save->image = (GtkIMHtmlScalable *)gtk_imhtml_animation_new(anim, smiley->smile, 0); - save->data = smiley->data; /* Do not need to memdup here, since the smiley is not - destroyed before this GtkIMHtmlImageSave */ - save->datasize = smiley->datasize; - ret = gtk_imhtml_image_clicked(w, event, save); - g_object_set_data_full(G_OBJECT(w), "image-data", save->image, (GDestroyNotify)gtk_imhtml_animation_free); - g_object_set_data_full(G_OBJECT(w), "image-save-data", save, (GDestroyNotify)g_free); - return ret; -} + if (im_image->width > width || im_image->height > height) { + double ratio_w, ratio_h, ratio; + int new_h, new_w; + GdkPixbuf *new_image = NULL; -void gtk_imhtml_image_free(GtkIMHtmlScalable *scale) -{ - GtkIMHtmlImage *image = (GtkIMHtmlImage *)scale; + ratio_w = ((double)width - 2) / im_image->width; + ratio_h = ((double)height - 2) / im_image->height; - g_object_unref(image->pixbuf); - g_free(image->filename); - if (image->filesel) - gtk_widget_destroy(image->filesel); - g_free(scale); -} + ratio = (ratio_w < ratio_h) ? ratio_w : ratio_h; -void gtk_imhtml_animation_free(GtkIMHtmlScalable *scale) -{ - GtkIMHtmlAnimation *animation = (GtkIMHtmlAnimation *)scale; + new_w = (int)(im_image->width * ratio); + new_h = (int)(im_image->height * ratio); - if (animation->timer > 0) - g_source_remove(animation->timer); - if (animation->iter != NULL) - g_object_unref(animation->iter); - g_object_unref(animation->anim); + new_image = gdk_pixbuf_scale_simple(im_image->pixbuf, new_w, new_h, GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(im_image->image, new_image); + g_object_unref(G_OBJECT(new_image)); + } else if (gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)) != im_image->width) { + /* Enough space to show the full-size of the image. */ + GdkPixbuf *new_image; - gtk_imhtml_image_free(scale); + new_image = gdk_pixbuf_scale_simple(im_image->pixbuf, im_image->width, im_image->height, GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(im_image->image, new_image); + g_object_unref(G_OBJECT(new_image)); + } } -void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter) +/** + * Adds a GTK+ IM/HTML scalable image to a given GTK+ IM/HTML at a given iter. + * + * @param scale The GTK+ IM/HTML scalable. + * @param imhtml The GTK+ IM/HTML. + * @param iter The GtkTextIter at which to add the scalable. + */ +static void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter) { GtkIMHtmlImage *image = (GtkIMHtmlImage *)scale; GtkWidget *box = gtk_event_box_new(); @@ -4007,6 +3949,121 @@ void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTex g_object_set_data_full(G_OBJECT(box), "image-save-data", save, (GDestroyNotify)g_free); } +/** + * Creates and returns a new GTK+ IM/HTML scalable object with an image. + * + * @param img A GdkPixbuf of the image to add. + * @param filename The filename to associate with the image. + * @param id The id to associate with the image. + * + * @return A new IM/HTML Scalable object with an image. + */ +static GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id) +{ + GtkIMHtmlImage *im_image = g_malloc(sizeof(GtkIMHtmlImage)); + + GTK_IMHTML_SCALABLE(im_image)->scale = gtk_imhtml_image_scale; + GTK_IMHTML_SCALABLE(im_image)->add_to = gtk_imhtml_image_add_to; + GTK_IMHTML_SCALABLE(im_image)->free = gtk_imhtml_image_free; + + im_image->pixbuf = img; + im_image->image = GTK_IMAGE(gtk_image_new_from_pixbuf(im_image->pixbuf)); + im_image->width = gdk_pixbuf_get_width(img); + im_image->height = gdk_pixbuf_get_height(img); + im_image->mark = NULL; + im_image->filename = g_strdup(filename); + im_image->id = id; + im_image->filesel = NULL; + + g_object_ref(img); + return GTK_IMHTML_SCALABLE(im_image); +} + +static gboolean +animate_image_cb(gpointer data) +{ + GtkIMHtmlImage *im_image; + int width, height; + int delay; + + im_image = data; + + /* Update the pointer to this GdkPixbuf frame of the animation */ + if (gdk_pixbuf_animation_iter_advance(GTK_IMHTML_ANIMATION(im_image)->iter, NULL)) { + GdkPixbuf *pb = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); + g_object_unref(G_OBJECT(im_image->pixbuf)); + im_image->pixbuf = gdk_pixbuf_copy(pb); + + /* Update the displayed GtkImage */ + width = gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)); + height = gdk_pixbuf_get_height(gtk_image_get_pixbuf(im_image->image)); + if (width > 0 && height > 0) + { + /* Need to scale the new frame to the same size as the old frame */ + GdkPixbuf *tmp; + tmp = gdk_pixbuf_scale_simple(im_image->pixbuf, width, height, GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(im_image->image, tmp); + g_object_unref(G_OBJECT(tmp)); + } else { + /* Display at full-size */ + gtk_image_set_from_pixbuf(im_image->image, im_image->pixbuf); + } + } + + delay = MIN(gdk_pixbuf_animation_iter_get_delay_time(GTK_IMHTML_ANIMATION(im_image)->iter), 100); + GTK_IMHTML_ANIMATION(im_image)->timer = g_timeout_add(delay, animate_image_cb, im_image); + + return FALSE; +} + +/** + * Creates and returns a new GTK+ IM/HTML scalable object with an + * animated image. + * + * @param img A GdkPixbufAnimation of the image to add. + * @param filename The filename to associate with the image. + * @param id The id to associate with the image. + * + * @return A new IM/HTML Scalable object with an image. + */ +/* + * TODO: All this animation code could be combined much better with + * the image code. It couldn't be done when it was written + * because it requires breaking backward compatibility. It + * would be good to do it for 3.0.0. + */ +static GtkIMHtmlScalable *gtk_imhtml_animation_new(GdkPixbufAnimation *anim, const gchar *filename, int id) +{ + GtkIMHtmlImage *im_image = (GtkIMHtmlImage *) g_new0(GtkIMHtmlAnimation, 1); + + GTK_IMHTML_SCALABLE(im_image)->scale = gtk_imhtml_image_scale; + GTK_IMHTML_SCALABLE(im_image)->add_to = gtk_imhtml_image_add_to; + GTK_IMHTML_SCALABLE(im_image)->free = gtk_imhtml_animation_free; + + GTK_IMHTML_ANIMATION(im_image)->anim = anim; + if (gdk_pixbuf_animation_is_static_image(anim)) { + im_image->pixbuf = gdk_pixbuf_animation_get_static_image(anim); + g_object_ref(im_image->pixbuf); + } else { + int delay; + GdkPixbuf *pb; + GTK_IMHTML_ANIMATION(im_image)->iter = gdk_pixbuf_animation_get_iter(anim, NULL); + pb = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); + im_image->pixbuf = gdk_pixbuf_copy(pb); + delay = MIN(gdk_pixbuf_animation_iter_get_delay_time(GTK_IMHTML_ANIMATION(im_image)->iter), 100); + GTK_IMHTML_ANIMATION(im_image)->timer = g_timeout_add(delay, animate_image_cb, im_image); + } + im_image->image = GTK_IMAGE(gtk_image_new_from_pixbuf(im_image->pixbuf)); + im_image->width = gdk_pixbuf_animation_get_width(anim); + im_image->height = gdk_pixbuf_animation_get_height(anim); + im_image->filename = g_strdup(filename); + im_image->id = id; + + g_object_ref(anim); + + return GTK_IMHTML_SCALABLE(im_image); +} + GtkIMHtmlScalable *gtk_imhtml_hr_new() { GtkIMHtmlHr *hr = g_malloc(sizeof(GtkIMHtmlHr)); @@ -4229,14 +4286,9 @@ static void remove_tag_by_prefix(GtkIMHtml *imhtml, const GtkTextIter *i, const for (l = tags; l; l = l->next) { GtkTextTag *tag = l->data; - gchar *name = NULL; - g_object_get(G_OBJECT(tag), "name", &name, NULL); - - if (name && !strncmp(name, prefix, len)) + if (tag->name && !strncmp(tag->name, prefix, len)) gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, i, e); - - g_free(name); } g_slist_free(tags); @@ -4252,14 +4304,9 @@ static void remove_tag_by_prefix(GtkIMHtml *imhtml, const GtkTextIter *i, const for (l = tags; l; l = l->next) { GtkTextTag *tag = l->data; - gchar *name = NULL; - - g_object_get(G_OBJECT(tag), "name", &name, NULL); - if (name && !strncmp(name, prefix, len)) + if (tag->name && !strncmp(tag->name, prefix, len)) gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, &iter, e); - - g_free(name); } g_slist_free(tags); @@ -4380,16 +4427,11 @@ static void delete_cb(GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *en gtk_text_iter_begins_tag(start, tag) && /* the tag starts with the selection */ (!gtk_text_iter_has_tag(end, tag) || /* the tag ends within the selection */ gtk_text_iter_ends_tag(end, tag))) { - gchar *name = NULL; - - g_object_get(G_OBJECT(tag), "name", &name, NULL); gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, start, end); - - if (name && strncmp(name, "LINK ", 5) == 0 && imhtml->edit.link) { + if (tag->name && + strncmp(tag->name, "LINK ", 5) == 0 && imhtml->edit.link) { gtk_imhtml_toggle_link(imhtml, NULL); } - - g_free(name); } } g_slist_free(tags); @@ -4611,32 +4653,27 @@ static void mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *arg1, GtkTextMark *m for (l = tags; l != NULL; l = l->next) { GtkTextTag *tag = GTK_TEXT_TAG(l->data); - gchar *name = NULL; - - g_object_get(G_OBJECT(tag), "name", &name, NULL); - if (name) { - if (strcmp(name, "BOLD") == 0) + if (tag->name) { + if (strcmp(tag->name, "BOLD") == 0) imhtml->edit.bold = TRUE; - else if (strcmp(name, "ITALICS") == 0) + else if (strcmp(tag->name, "ITALICS") == 0) imhtml->edit.italic = TRUE; - else if (strcmp(name, "UNDERLINE") == 0) + else if (strcmp(tag->name, "UNDERLINE") == 0) imhtml->edit.underline = TRUE; - else if (strcmp(name, "STRIKE") == 0) + else if (strcmp(tag->name, "STRIKE") == 0) imhtml->edit.strike = TRUE; - else if (strncmp(name, "FORECOLOR ", 10) == 0) - imhtml->edit.forecolor = g_strdup(&(name)[10]); - else if (strncmp(name, "BACKCOLOR ", 10) == 0) - imhtml->edit.backcolor = g_strdup(&(name)[10]); - else if (strncmp(name, "FONT FACE ", 10) == 0) - imhtml->edit.fontface = g_strdup(&(name)[10]); - else if (strncmp(name, "FONT SIZE ", 10) == 0) - imhtml->edit.fontsize = strtol(&(name)[10], NULL, 10); - else if ((strncmp(name, "LINK ", 5) == 0) && !gtk_text_iter_is_end(&iter)) + else if (strncmp(tag->name, "FORECOLOR ", 10) == 0) + imhtml->edit.forecolor = g_strdup(&(tag->name)[10]); + else if (strncmp(tag->name, "BACKCOLOR ", 10) == 0) + imhtml->edit.backcolor = g_strdup(&(tag->name)[10]); + else if (strncmp(tag->name, "FONT FACE ", 10) == 0) + imhtml->edit.fontface = g_strdup(&(tag->name)[10]); + else if (strncmp(tag->name, "FONT SIZE ", 10) == 0) + imhtml->edit.fontsize = strtol(&(tag->name)[10], NULL, 10); + else if ((strncmp(tag->name, "LINK ", 5) == 0) && !gtk_text_iter_is_end(&iter)) imhtml->edit.link = tag; } - - g_free(name); } g_slist_free(tags); @@ -4927,8 +4964,6 @@ void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley) gtk_text_buffer_end_user_action(imhtml->text_buffer); } -/* TODO: I think this can be removed for GTK+ 3.0... */ -#if 0 static gboolean image_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { @@ -4936,10 +4971,9 @@ image_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) return TRUE; } -#endif /* In case the smiley gets removed from the imhtml before it gets removed from the queue */ -static void animated_smiley_destroy_cb(GtkWidget *widget, GtkIMHtml *imhtml) +static void animated_smiley_destroy_cb(GtkObject *widget, GtkIMHtml *imhtml) { GList *l = imhtml->animations->head; while (l) { @@ -4954,6 +4988,30 @@ static void animated_smiley_destroy_cb(GtkWidget *widget, GtkIMHtml *imhtml) } } +static gboolean gtk_imhtml_smiley_clicked(GtkWidget *w, GdkEvent *event, GtkIMHtmlSmiley *smiley) +{ + GdkPixbufAnimation *anim = NULL; + GtkIMHtmlImageSave *save = NULL; + gboolean ret; + + if (event->type != GDK_BUTTON_RELEASE || ((GdkEventButton*)event)->button != 3) + return FALSE; + + anim = gtk_smiley_get_image(smiley); + if (!anim) + return FALSE; + + save = g_new0(GtkIMHtmlImageSave, 1); + save->image = (GtkIMHtmlScalable *)gtk_imhtml_animation_new(anim, smiley->smile, 0); + save->data = smiley->data; /* Do not need to memdup here, since the smiley is not + destroyed before this GtkIMHtmlImageSave */ + save->datasize = smiley->datasize; + ret = gtk_imhtml_image_clicked(w, event, save); + g_object_set_data_full(G_OBJECT(w), "image-data", save->image, (GDestroyNotify)gtk_imhtml_animation_free); + g_object_set_data_full(G_OBJECT(w), "image-save-data", save, (GDestroyNotify)g_free); + return ret; +} + void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter) { GdkPixbuf *pixbuf = NULL; @@ -5010,7 +5068,7 @@ void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char * } } } else { - imhtml->num_animations++; + imhtml->num_animations++; } g_signal_connect(G_OBJECT(icon), "destroy", G_CALLBACK(animated_smiley_destroy_cb), imhtml); g_queue_push_tail(imhtml->animations, icon); @@ -5034,9 +5092,7 @@ void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char * * images, and ensures that they are handled by the image * itself, without propagating to the textview and causing * a complete refresh */ - /* TODO: I think this should be removed for GTK+ 3.0? g_signal_connect(G_OBJECT(icon), "expose-event", G_CALLBACK(image_expose), NULL); - */ gtk_widget_show(icon); if (ebox) @@ -5130,29 +5186,22 @@ void gtk_imhtml_insert_image_at_iter(GtkIMHtml *imhtml, int id, GtkTextIter *ite static const gchar *tag_to_html_start(GtkTextTag *tag) { + const gchar *name; static gchar buf[1024]; - gchar *name = NULL; + name = tag->name; g_return_val_if_fail(name != NULL, ""); - g_object_get(G_OBJECT(tag), "name", &name, NULL); if (strcmp(name, "BOLD") == 0) { - g_free(name); return ""; } else if (strcmp(name, "ITALICS") == 0) { - g_free(name); return ""; } else if (strcmp(name, "UNDERLINE") == 0) { - g_free(name); return ""; } else if (strcmp(name, "STRIKE") == 0) { - g_free(name); return ""; } else if (strncmp(name, "LINK ", 5) == 0) { char *tmp = g_object_get_data(G_OBJECT(tag), "link_url"); - - g_free(name); - if (tmp) { g_snprintf(buf, sizeof(buf), "", tmp); buf[sizeof(buf)-1] = '\0'; @@ -5162,29 +5211,18 @@ static const gchar *tag_to_html_start(GtkTextTag *tag) } } else if (strncmp(name, "FORECOLOR ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - - g_free(name); - return buf; } else if (strncmp(name, "BACKCOLOR ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - g_free(name); - return buf; } else if (strncmp(name, "BACKGROUND ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[11]); - g_free(name); - return buf; } else if (strncmp(name, "FONT FACE ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - g_free(name); - return buf; } else if (strncmp(name, "FONT SIZE ", 10) == 0) { g_snprintf(buf, sizeof(buf), "", &name[10]); - g_free(name); - return buf; } else { char *str = buf; @@ -5247,7 +5285,6 @@ static const gchar *tag_to_html_start(GtkTextTag *tag) } g_snprintf(str, sizeof(buf) - (str - buf), "'>"); - g_free(name); return (empty ? "" : buf); } @@ -5255,40 +5292,30 @@ static const gchar *tag_to_html_start(GtkTextTag *tag) static const gchar *tag_to_html_end(GtkTextTag *tag) { - gchar *name; + const gchar *name; + name = tag->name; g_return_val_if_fail(name != NULL, ""); - g_object_get(G_OBJECT(tag), "name", &name, NULL); if (strcmp(name, "BOLD") == 0) { - g_free(name); return ""; } else if (strcmp(name, "ITALICS") == 0) { - g_free(name); return ""; } else if (strcmp(name, "UNDERLINE") == 0) { - g_free(name); return ""; } else if (strcmp(name, "STRIKE") == 0) { - g_free(name); return ""; } else if (strncmp(name, "LINK ", 5) == 0) { - g_free(name); return ""; } else if (strncmp(name, "FORECOLOR ", 10) == 0) { - g_free(name); return ""; } else if (strncmp(name, "BACKCOLOR ", 10) == 0) { - g_free(name); return ""; } else if (strncmp(name, "BACKGROUND ", 10) == 0) { - g_free(name); return ""; } else if (strncmp(name, "FONT FACE ", 10) == 0) { - g_free(name); return ""; } else if (strncmp(name, "FONT SIZE ", 10) == 0) { - g_free(name); return ""; } else { const char *props[] = {"weight-set", "foreground-set", "background-set", @@ -5301,8 +5328,6 @@ static const gchar *tag_to_html_end(GtkTextTag *tag) return ""; } - g_free(name); - return ""; } } diff --git a/pidgin/gtkimhtml.h b/pidgin/gtkimhtml.h index 498c376fbe..4b2f2bd46b 100644 --- a/pidgin/gtkimhtml.h +++ b/pidgin/gtkimhtml.h @@ -50,9 +50,6 @@ extern "C" { typedef struct _GtkIMHtml GtkIMHtml; typedef struct _GtkIMHtmlClass GtkIMHtmlClass; -#if !(defined PIDGIN_DISABLE_DEPRECATED) && !(defined _PIDGIN_GTKIMHTML_C_) -typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ -#endif typedef struct _GtkSmileyTree GtkSmileyTree; typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; @@ -61,9 +58,6 @@ typedef struct _GtkIMHtmlAnimation GtkIMHtmlAnimation; typedef struct _GtkIMHtmlHr GtkIMHtmlHr; typedef struct _GtkIMHtmlFuncs GtkIMHtmlFuncs; -/** - * @since 2.6.0 - */ typedef struct _GtkIMHtmlLink GtkIMHtmlLink; typedef enum { @@ -81,7 +75,7 @@ typedef enum { GTK_IMHTML_SMILEY = 1 << 11, GTK_IMHTML_LINKDESC = 1 << 12, GTK_IMHTML_STRIKE = 1 << 13, - /** Show custom smileys when appropriate. @since 2.5.0 */ + /** Show custom smileys when appropriate. */ GTK_IMHTML_CUSTOM_SMILEY = 1 << 14, GTK_IMHTML_ALL = -1 } GtkIMHtmlButtons; @@ -154,12 +148,6 @@ struct _GtkIMHtmlClass { GList *protocols; /* List of GtkIMHtmlProtocol's */ }; -struct _GtkSmileyTree { - GString *values; - GtkSmileyTree **children; - GtkIMHtmlSmiley *image; -}; - struct _GtkIMHtmlSmiley { gchar *smile; gchar *file; @@ -169,38 +157,8 @@ struct _GtkIMHtmlSmiley { GSList *anchors; GtkIMHtmlSmileyFlags flags; GtkIMHtml *imhtml; - gpointer data; /** @since 2.6.0 */ - gsize datasize; /** @since 2.6.0 */ -}; - -struct _GtkIMHtmlScalable { - void (*scale)(struct _GtkIMHtmlScalable *, int, int); - void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); - void (*free)(struct _GtkIMHtmlScalable *); -}; - -struct _GtkIMHtmlImage { - GtkIMHtmlScalable scalable; - GtkImage *image; /**< Contains the scaled version of this pixbuf. */ - GdkPixbuf *pixbuf; /**< The original pixbuf, before any scaling. */ - GtkTextMark *mark; - gchar *filename; - int width; - int height; - int id; - GtkWidget *filesel; -}; - -struct _GtkIMHtmlAnimation { - GtkIMHtmlImage imhtmlimage; - GdkPixbufAnimation *anim; /**< The original animation, before any scaling. */ - GdkPixbufAnimationIter *iter; - guint timer; -}; - -struct _GtkIMHtmlHr { - GtkIMHtmlScalable scalable; - GtkWidget *sep; + gpointer data; + gsize datasize; }; typedef enum { @@ -418,73 +376,6 @@ void gtk_imhtml_page_down(GtkIMHtml *imhtml); */ GtkIMHtmlScalable *gtk_imhtml_scalable_new(void); -/** - * Creates and returns a new GTK+ IM/HTML scalable object with an image. - * - * @param img A GdkPixbuf of the image to add. - * @param filename The filename to associate with the image. - * @param id The id to associate with the image. - * - * @return A new IM/HTML Scalable object with an image. - */ -GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id); - -/** - * Creates and returns a new GTK+ IM/HTML scalable object with an - * animated image. - * - * @param img A GdkPixbufAnimation of the image to add. - * @param filename The filename to associate with the image. - * @param id The id to associate with the image. - * - * @return A new IM/HTML Scalable object with an image. - * - * @since 2.1.0 - */ -/* - * TODO: All this animation code could be combined much better with - * the image code. It couldn't be done when it was written - * because it requires breaking backward compatibility. It - * would be good to do it for 3.0.0. - */ -GtkIMHtmlScalable *gtk_imhtml_animation_new(GdkPixbufAnimation *img, const gchar *filename, int id); - -/** - * Destroys and frees a GTK+ IM/HTML scalable image. - * - * @param scale The GTK+ IM/HTML scalable. - */ -/* TODO: Is there any reason this isn't private? */ -void gtk_imhtml_image_free(GtkIMHtmlScalable *scale); - -/** - * Destroys and frees a GTK+ IM/HTML scalable animation. - * - * @param scale The GTK+ IM/HTML scalable. - */ -/* TODO: Is there any reason this isn't private? */ -void gtk_imhtml_animation_free(GtkIMHtmlScalable *scale); - -/** - * Rescales a GTK+ IM/HTML scalable image to a given size. - * - * @param scale The GTK+ IM/HTML scalable. - * @param width The new width. - * @param height The new height. - */ -/* TODO: Is there any reason this isn't private? */ -void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height); - -/** - * Adds a GTK+ IM/HTML scalable image to a given GTK+ IM/HTML at a given iter. - * - * @param scale The GTK+ IM/HTML scalable. - * @param imhtml The GTK+ IM/HTML. - * @param iter The GtkTextIter at which to add the scalable. - */ -/* TODO: Is there any reason this isn't private? */ -void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); - /** * Creates and returns an new GTK+ IM/HTML scalable with a horizontal rule. * @@ -836,8 +727,6 @@ char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *st * * @param imhtml The GTK+ IM/HTML. * @param flags The connection flag which describes the allowed types of formatting. - * - * @since 2.1.0 */ void gtk_imhtml_setup_entry(GtkIMHtml *imhtml, PurpleConnectionFlags flags); @@ -850,7 +739,6 @@ void gtk_imhtml_setup_entry(GtkIMHtml *imhtml, PurpleConnectionFlags flags); * @param flags The smiley flags * * @return The newly created smiley - * @since 2.5.0 */ GtkIMHtmlSmiley *gtk_imhtml_smiley_create(const char *file, const char *shortcut, gboolean hide, GtkIMHtmlSmileyFlags flags); @@ -859,8 +747,6 @@ GtkIMHtmlSmiley *gtk_imhtml_smiley_create(const char *file, const char *shortcut * Reload the image data for the smiley. * * @param smiley The smiley to reload - * - * @since 2.5.0 */ void gtk_imhtml_smiley_reload(GtkIMHtmlSmiley *smiley); @@ -868,8 +754,6 @@ void gtk_imhtml_smiley_reload(GtkIMHtmlSmiley *smiley); * Destroy a GtkIMHtmlSmiley. * * @param smiley The smiley to destroy - * - * @since 2.5.0 */ void gtk_imhtml_smiley_destroy(GtkIMHtmlSmiley *smiley); @@ -888,8 +772,6 @@ void gtk_imhtml_smiley_destroy(GtkIMHtmlSmiley *smiley); * successfully, @c FALSE otherwise. * * @return @c TRUE if the protocol was successfully registered (or unregistered, when \a activate is @c NULL) - * - * @since 2.6.0 */ gboolean gtk_imhtml_class_register_protocol(const char *name, gboolean (*activate)(GtkIMHtml *imhtml, GtkIMHtmlLink *link), @@ -901,8 +783,6 @@ gboolean gtk_imhtml_class_register_protocol(const char *name, * @param link The GtkIMHtmlLink object sent to the callback functions * * @return The URL - * - * @since 2.6.0 */ const char *gtk_imhtml_link_get_url(GtkIMHtmlLink *link); @@ -912,8 +792,6 @@ const char *gtk_imhtml_link_get_url(GtkIMHtmlLink *link); * @param link The GtkIMHtmlLink object sent to the callback functions * * @return The GtkTextTag object, or @c NULL - * - * @since 2.6.0 */ const GtkTextTag *gtk_imhtml_link_get_text_tag(GtkIMHtmlLink *link); @@ -924,8 +802,6 @@ const GtkTextTag *gtk_imhtml_link_get_text_tag(GtkIMHtmlLink *link); * @param link The GtkIMHtmlLink object sent to the callback functions * * @return @c TRUE if 'url-clicked' signal was emitted, @c FALSE otherwise. - * - * @since 2.6.0 */ gboolean gtk_imhtml_link_activate(GtkIMHtmlLink *link); diff --git a/pidgin/gtkimhtmltoolbar.c b/pidgin/gtkimhtmltoolbar.c index 3c6a97925f..7cde74c931 100644 --- a/pidgin/gtkimhtmltoolbar.c +++ b/pidgin/gtkimhtmltoolbar.c @@ -43,6 +43,11 @@ #include +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) +#define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE(x) +#endif + static GtkHBoxClass *parent_class = NULL; static void toggle_button_set_active_block(GtkToggleButton *button, @@ -124,15 +129,11 @@ realize_toolbar_font(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) { GtkFontSelection *sel; - sel = GTK_FONT_SELECTION( - gtk_font_selection_dialog_get_font_selection(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))); - gtk_widget_hide(gtk_widget_get_parent( - gtk_font_selection_get_size_entry(sel))); - gtk_widget_show_all(gtk_font_selection_get_family_list(sel)); - gtk_widget_show(gtk_widget_get_parent( - gtk_font_selection_get_family_list(sel))); - gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent( - gtk_font_selection_get_family_list(sel)))); + sel = GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->fontsel); + gtk_widget_hide_all(gtk_widget_get_parent(sel->size_entry)); + gtk_widget_show_all(sel->family_list); + gtk_widget_show(gtk_widget_get_parent(sel->family_list)); + gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent(sel->family_list))); } static void @@ -195,12 +196,10 @@ toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar) g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event", G_CALLBACK(destroy_toolbar_font), toolbar); - g_signal_connect(G_OBJECT( - gtk_font_selection_dialog_get_ok_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), - "clicked", G_CALLBACK(apply_font), toolbar->font_dialog); - g_signal_connect(G_OBJECT( - gtk_font_selection_dialog_get_cancel_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), - "clicked", G_CALLBACK(cancel_toolbar_font), toolbar); + g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->ok_button), "clicked", + G_CALLBACK(apply_font), toolbar->font_dialog); + g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->cancel_button), "clicked", + G_CALLBACK(cancel_toolbar_font), toolbar); g_signal_connect_after(G_OBJECT(toolbar->font_dialog), "realize", G_CALLBACK(realize_toolbar_font), toolbar); } @@ -259,12 +258,9 @@ toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) char *color = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml)); if (!toolbar->fgcolor_dialog) { - GtkWidget *ok_button; - GtkWidget *cancel_button; toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); - colorsel = - gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); + colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel; if (color) { gdk_color_parse(color, &fgcolor); gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor); @@ -273,13 +269,12 @@ toggle_fg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); - g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "ok-button", &ok_button, NULL); - g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "cancel-button", &cancel_button, NULL); g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event", G_CALLBACK(destroy_toolbar_fgcolor), toolbar); - g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(do_fgcolor), colorsel); - g_signal_connect(G_OBJECT(cancel_button), "clicked", - G_CALLBACK(cancel_toolbar_fgcolor), toolbar); + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->ok_button), "clicked", + G_CALLBACK(do_fgcolor), colorsel); + g_signal_connect(G_OBJECT (GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->cancel_button), "clicked", + G_CALLBACK(cancel_toolbar_fgcolor), toolbar); } gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog)); } else { @@ -343,13 +338,9 @@ toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) char *color = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml)); if (!toolbar->bgcolor_dialog) { - GtkWidget *ok_button; - GtkWidget *cancel_button; toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); - colorsel = - gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); - + colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel; if (color) { gdk_color_parse(color, &bgcolor); gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor); @@ -358,14 +349,11 @@ toggle_bg_color(GtkWidget *color, GtkIMHtmlToolbar *toolbar) g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); - g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "ok-button", &ok_button, NULL); - g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "cancel-button", - &cancel_button, NULL); g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event", G_CALLBACK(destroy_toolbar_bgcolor), toolbar); - g_signal_connect(G_OBJECT(ok_button), "clicked", - G_CALLBACK(do_bgcolor), colorsel); - g_signal_connect(G_OBJECT(cancel_button), "clicked", + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->ok_button), "clicked", + G_CALLBACK(do_bgcolor), colorsel); + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->cancel_button), "clicked", G_CALLBACK(cancel_toolbar_bgcolor), toolbar); } @@ -478,12 +466,12 @@ insert_link_cb(GtkWidget *w, GtkIMHtmlToolbar *toolbar) static void insert_hr_cb(GtkWidget *widget, GtkIMHtmlToolbar *toolbar) { - GtkTextIter iter; - GtkTextMark *ins; + GtkTextIter iter; + GtkTextMark *ins; GtkIMHtmlScalable *hr; - ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml))); - gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), &iter, ins); + ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml))); + gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), &iter, ins); hr = gtk_imhtml_hr_new(); gtk_imhtml_hr_add_to(hr, GTK_IMHTML(toolbar->imhtml), &iter); } @@ -739,7 +727,7 @@ smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) static gboolean smiley_dialog_input_cb(GtkWidget *dialog, GdkEvent *event, GtkIMHtmlToolbar *toolbar) { - if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Escape) || + if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_Escape) || (event->type == GDK_BUTTON_PRESS && event->button.button == 1)) { close_smiley_dialog(toolbar); @@ -929,7 +917,7 @@ static void send_attention_cb(GtkWidget *attention, GtkIMHtmlToolbar *toolbar) PurpleConversation *conv = g_object_get_data(G_OBJECT(toolbar), "active_conv"); const gchar *who = purple_conversation_get_name(conv); - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); toggle_button_set_active_block(GTK_TOGGLE_BUTTON(attention), FALSE, toolbar); purple_prpl_send_attention(gc, who, 0); @@ -1109,21 +1097,19 @@ menu_position_func (GtkMenu *menu, { GtkWidget *widget = GTK_WIDGET(data); GtkRequisition menu_req; - GtkAllocation allocation; - gint ythickness = gtk_widget_get_style(widget)->ythickness; + gint ythickness = widget->style->ythickness; int savy; - gtk_widget_get_allocation(widget, &allocation); gtk_widget_size_request(GTK_WIDGET (menu), &menu_req); - gdk_window_get_origin(gtk_widget_get_window(widget), x, y); - *x += allocation.x; - *y += allocation.y + allocation.height; + gdk_window_get_origin(widget->window, x, y); + *x += widget->allocation.x; + *y += widget->allocation.y + widget->allocation.height; savy = *y; pidgin_menu_position_func_helper(menu, x, y, push_in, data); if (savy > *y + ythickness + 1) - *y -= allocation.height; + *y -= widget->allocation.height; } static gboolean @@ -1268,6 +1254,7 @@ static void gtk_imhtmltoolbar_create_old_buttons(GtkIMHtmlToolbar *toolbar) {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, {"", NULL, NULL, NULL}, {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, + {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &toolbar->attention, _("Send Attention")}, {NULL, NULL, NULL, NULL} }; int iter; @@ -1290,18 +1277,6 @@ static void gtk_imhtmltoolbar_create_old_buttons(GtkIMHtmlToolbar *toolbar) button = gtk_vseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); } - /* create the attention button (this is a bit hacky to not break ABI) */ - button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION); - g_signal_connect(G_OBJECT(button), "button-press-event", G_CALLBACK(gtk_imhtmltoolbar_popup_menu), toolbar); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(send_attention_cb), toolbar); - g_object_set_data(G_OBJECT(toolbar), "attention", button); -#if GTK_CHECK_VERSION(2,12,0) - gtk_widget_set_tooltip_text(button, _("Send Attention")); -#else - gtk_tooltips_set_tip(toolbar->tooltips, button, _("Send Attention"), NULL); -#endif - gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox); @@ -1319,7 +1294,7 @@ button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) static void button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) { - gtk_widget_set_sensitive(item, gtk_widget_get_sensitive(button)); + gtk_widget_set_sensitive(item, gtk_widget_is_sensitive(button)); } static void @@ -1342,10 +1317,10 @@ imhtmltoolbar_view_pref_changed(const char *name, PurplePrefType type, gconstpointer value, gpointer toolbar) { if (value) { - gtk_widget_hide(g_object_get_data(G_OBJECT(toolbar), "lean-view")); + gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); } else { - gtk_widget_hide(g_object_get_data(G_OBJECT(toolbar), "wide-view")); + gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); } } @@ -1364,7 +1339,6 @@ static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar) GtkWidget *insert_menu; GtkWidget *menuitem; GtkWidget *sep; - GObject *wide_attention_button; int i; struct { const char *label; @@ -1517,8 +1491,6 @@ static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar) gtk_widget_show_all(sep); /* Attention */ - wide_attention_button = g_object_get_data(G_OBJECT(toolbar), "attention"); - attention_button = gtk_button_new(); gtk_button_set_relief(GTK_BUTTON(attention_button), GTK_RELIEF_NONE); bbox = gtk_hbox_new(FALSE, 3); @@ -1530,16 +1502,16 @@ static void gtk_imhtmltoolbar_init (GtkIMHtmlToolbar *toolbar) gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", - G_CALLBACK(gtk_button_clicked), wide_attention_button); + G_CALLBACK(gtk_button_clicked), toolbar->attention); gtk_widget_show_all(attention_button); - g_signal_connect(wide_attention_button, "notify::sensitive", + g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive", G_CALLBACK(button_sensitiveness_changed), attention_button); - g_signal_connect(wide_attention_button, "notify::visible", + g_signal_connect(G_OBJECT(toolbar->attention), "notify::visible", G_CALLBACK(button_visibility_changed), attention_button); /* set attention button to be greyed out until we get a conversation */ - gtk_widget_set_sensitive(GTK_WIDGET(wide_attention_button), FALSE); + gtk_widget_set_sensitive(toolbar->attention, FALSE); gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(hbox), "lean-view", box); @@ -1620,16 +1592,14 @@ void gtk_imhtmltoolbar_associate_smileys(GtkIMHtmlToolbar *toolbar, const char * void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, PurpleConversation *conv) { - PurpleConnection *gc = purple_conversation_get_gc(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); PurplePlugin *prpl = purple_connection_get_prpl(gc); - GtkWidget *attention = - g_object_get_data(G_OBJECT(toolbar), "attention"); g_object_set_data(G_OBJECT(toolbar), "active_conv", conv); /* gray out attention button on protocols that don't support it for the time being it is always disabled for chats */ - gtk_widget_set_sensitive(attention, + gtk_widget_set_sensitive(toolbar->attention, conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); } diff --git a/pidgin/gtkimhtmltoolbar.h b/pidgin/gtkimhtmltoolbar.h index 6a8feceb0a..4e0db0237d 100644 --- a/pidgin/gtkimhtmltoolbar.h +++ b/pidgin/gtkimhtmltoolbar.h @@ -69,6 +69,7 @@ struct _GtkIMHtmlToolbar { GtkWidget *image; GtkWidget *link; GtkWidget *smiley; + GtkWidget *attention; GtkWidget *font_dialog; GtkWidget *fgcolor_dialog; @@ -94,9 +95,6 @@ GtkWidget* gtk_imhtmltoolbar_new (void); void gtk_imhtmltoolbar_attach (GtkIMHtmlToolbar *toolbar, GtkWidget *imhtml); void gtk_imhtmltoolbar_associate_smileys (GtkIMHtmlToolbar *toolbar, const char *proto_id); -/** - * @since 2.7.0 - */ void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, PurpleConversation *conv); diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c index 59127ec791..d539c58c6e 100644 --- a/pidgin/gtklog.c +++ b/pidgin/gtklog.c @@ -35,9 +35,9 @@ #include "pidginstock.h" #include "gtkblist.h" -#include "gtkimhtml.h" #include "gtklog.h" #include "gtkutils.h" +#include "gtkwebview.h" static GHashTable *log_viewers = NULL; static void populate_log_tree(PidginLogViewer *lv); @@ -130,7 +130,7 @@ static void search_cb(GtkWidget *button, PidginLogViewer *lv) populate_log_tree(lv); g_free(lv->search); lv->search = NULL; - gtk_imhtml_search_clear(GTK_IMHTML(lv->imhtml)); + webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(lv->web_view)); select_first_log(lv); return; } @@ -138,7 +138,7 @@ static void search_cb(GtkWidget *button, PidginLogViewer *lv) if (lv->search != NULL && !strcmp(lv->search, search_term)) { /* Searching for the same term acts as "Find Next" */ - gtk_imhtml_search_find(GTK_IMHTML(lv->imhtml), lv->search); + webkit_web_view_search_text(WEBKIT_WEB_VIEW(lv->web_view), lv->search, FALSE, TRUE, TRUE); return; } @@ -148,7 +148,7 @@ static void search_cb(GtkWidget *button, PidginLogViewer *lv) lv->search = g_strdup(search_term); gtk_tree_store_clear(lv->treestore); - gtk_imhtml_clear(GTK_IMHTML(lv->imhtml)); + webkit_web_view_open(WEBKIT_WEB_VIEW(lv->web_view), "about:blank"); /* clear the view */ for (logs = lv->logs; logs != NULL; logs = logs->next) { char *read = purple_log_read((PurpleLog*)logs->data, NULL); @@ -419,8 +419,9 @@ static gboolean log_popup_menu_cb(GtkWidget *treeview, PidginLogViewer *lv) static gboolean search_find_cb(gpointer data) { PidginLogViewer *viewer = data; - gtk_imhtml_search_find(GTK_IMHTML(viewer->imhtml), viewer->search); - g_object_steal_data(G_OBJECT(viewer->entry), "search-find-cb"); + webkit_web_view_mark_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, 0); + webkit_web_view_set_highlight_text_matches(WEBKIT_WEB_VIEW(viewer->web_view), TRUE); + webkit_web_view_search_text(WEBKIT_WEB_VIEW(viewer->web_view), viewer->search, FALSE, TRUE, TRUE); return FALSE; } @@ -461,23 +462,16 @@ static void log_select_cb(GtkTreeSelection *sel, PidginLogViewer *viewer) { read = purple_log_read(log, &flags); viewer->flags = flags; - gtk_imhtml_clear(GTK_IMHTML(viewer->imhtml)); - gtk_imhtml_set_protocol_name(GTK_IMHTML(viewer->imhtml), - purple_account_get_protocol_name(log->account)); + webkit_web_view_open(WEBKIT_WEB_VIEW(viewer->web_view), "about:blank"); purple_signal_emit(pidgin_log_get_handle(), "log-displaying", viewer, log); - gtk_imhtml_append_text(GTK_IMHTML(viewer->imhtml), read, - GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL | - ((flags & PURPLE_LOG_READ_NO_NEWLINE) ? GTK_IMHTML_NO_NEWLINE : 0)); + webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(viewer->web_view), read, ""); g_free(read); if (viewer->search != NULL) { - guint source; - gtk_imhtml_search_clear(GTK_IMHTML(viewer->imhtml)); - source = g_idle_add(search_find_cb, viewer); - g_object_set_data_full(G_OBJECT(viewer->entry), "search-find-cb", - GINT_TO_POINTER(source), (GDestroyNotify)g_source_remove); + webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(viewer->web_view)); + g_idle_add(search_find_cb, viewer); } pidgin_clear_cursor(viewer->window); @@ -581,11 +575,10 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_dialog_add_button(GTK_DIALOG(lv->window), _("_Browse logs folder"), GTK_RESPONSE_HELP); #endif gtk_container_set_border_width (GTK_CONTAINER(lv->window), PIDGIN_HIG_BOX_SPACE); - /* TODO: is it possible to set this in GTK+ 3.0? */ -#if 0 +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE); #endif - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), 0); + gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(lv->window)->vbox), 0); g_signal_connect(G_OBJECT(lv->window), "response", G_CALLBACK(destroy_cb), ht); gtk_window_set_role(GTK_WINDOW(lv->window), "log_viewer"); @@ -594,12 +587,11 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * if (icon != NULL) { title_box = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); gtk_container_set_border_width(GTK_CONTAINER(title_box), PIDGIN_HIG_BOX_SPACE); - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), - title_box, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), title_box, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(title_box), icon, FALSE, FALSE, 0); } else - title_box = gtk_dialog_get_content_area(GTK_DIALOG(lv->window)); + title_box = GTK_DIALOG(lv->window)->vbox; /* Label ************/ lv->label = gtk_label_new(NULL); @@ -614,8 +606,7 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * /* Pane *************/ pane = gtk_hpaned_new(); gtk_container_set_border_width(GTK_CONTAINER(pane), PIDGIN_HIG_BOX_SPACE); - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), - pane, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), pane, TRUE, TRUE, 0); /* List *************/ lv->treestore = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); @@ -625,7 +616,7 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE); - gtk_paned_add1(GTK_PANED(pane), + gtk_paned_add1(GTK_PANED(pane), pidgin_make_scrollable(lv->treeview, GTK_POLICY_NEVER, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1)); populate_log_tree(lv); @@ -650,8 +641,7 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_label_set_markup(GTK_LABEL(size_label), text); /* gtk_paned_add1(GTK_PANED(pane), size_label); */ gtk_misc_set_alignment(GTK_MISC(size_label), 0, 0); - gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(lv->window))), - size_label, FALSE, FALSE, 0); + gtk_box_pack_end(GTK_BOX(GTK_DIALOG(lv->window)->vbox), size_label, FALSE, FALSE, 0); g_free(sz_txt); g_free(text); } @@ -661,9 +651,9 @@ static PidginLogViewer *display_log_viewer(struct log_viewer_hash_t *ht, GList * gtk_paned_add2(GTK_PANED(pane), vbox); /* Viewer ************/ - frame = pidgin_create_imhtml(FALSE, &lv->imhtml, NULL, NULL); - gtk_widget_set_name(lv->imhtml, "pidgin_log_imhtml"); - gtk_widget_set_size_request(lv->imhtml, 320, 200); + frame = pidgin_create_webview(FALSE, &lv->web_view, NULL, NULL); + gtk_widget_set_name(lv->web_view, "pidgin_log_web_view"); + gtk_widget_set_size_request(lv->web_view, 320, 200); gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); gtk_widget_show(frame); diff --git a/pidgin/gtklog.h b/pidgin/gtklog.h index 77917a8a15..3fd56484b0 100644 --- a/pidgin/gtklog.h +++ b/pidgin/gtklog.h @@ -43,7 +43,7 @@ struct _PidginLogViewer { GtkWidget *window; /**< The viewer's window */ GtkTreeStore *treestore; /**< The treestore containing said logs */ GtkWidget *treeview; /**< The treeview representing said treestore */ - GtkWidget *imhtml; /**< The imhtml to display said logs */ + GtkWidget *web_view; /**< The webkit web view to display said logs */ GtkWidget *entry; /**< The search entry, in which search terms * are entered */ PurpleLogReadFlags flags; /**< The most recently used log flags */ diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c index fccf357173..f928290658 100644 --- a/pidgin/gtkmedia.c +++ b/pidgin/gtkmedia.c @@ -40,6 +40,8 @@ #ifdef _WIN32 #include +#elif defined(GDK_WINDOWING_QUARTZ) +#include #endif #include @@ -290,14 +292,14 @@ setup_menubar(PidginMedia *window) GtkWidget *menu; action_group = gtk_action_group_new("MediaActions"); - gtk_action_group_add_actions(action_group, - menu_entries, - G_N_ELEMENTS(menu_entries), - GTK_WINDOW(window)); #ifdef ENABLE_NLS gtk_action_group_set_translation_domain(action_group, PACKAGE); #endif + gtk_action_group_add_actions(action_group, + menu_entries, + G_N_ELEMENTS(menu_entries), + GTK_WINDOW(window)); window->priv->ui = gtk_ui_manager_new(); gtk_ui_manager_insert_action_group(window->priv->ui, action_group, 0); @@ -455,7 +457,7 @@ level_message_cb(PurpleMedia *media, gchar *session_id, gchar *participant, progress = pidgin_media_get_widget(gtkmedia, session_id, participant); if (progress) - gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), level * 5); + gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), level); } @@ -559,7 +561,9 @@ realize_cb_cb(PidginMediaRealizeData *data) #ifdef _WIN32 window_id = GDK_WINDOW_HWND(window); #elif defined(HAVE_X11) - window_id = gdk_x11_window_get_xid(window); + window_id = GDK_WINDOW_XWINDOW(window); +#elif defined(GDK_WINDOWING_QUARTZ) + window_id = (gulong) gdk_quartz_window_get_nsview(window); #else # error "Unsupported windowing system" #endif @@ -789,7 +793,7 @@ pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *si /* Hold button */ gtkmedia->priv->hold = - gtk_toggle_button_new_with_mnemonic("_Hold"); + gtk_toggle_button_new_with_mnemonic(_("_Hold")); gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->hold, FALSE, FALSE, 0); gtk_widget_show(gtkmedia->priv->hold); @@ -878,7 +882,7 @@ pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *si if (type & PURPLE_MEDIA_SEND_AUDIO) { gtkmedia->priv->mute = - gtk_toggle_button_new_with_mnemonic("_Mute"); + gtk_toggle_button_new_with_mnemonic(_("_Mute")); gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->mute, FALSE, FALSE, 0); gtk_widget_show(gtkmedia->priv->mute); @@ -969,7 +973,7 @@ pidgin_media_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED); pidgin_media_emit_message(gtkmedia, _("Call in progress.")); gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar), - 0, _("Call in progress.")); + 0, _("Call in progress")); gtk_widget_show(GTK_WIDGET(gtkmedia)); } } @@ -1082,6 +1086,10 @@ create_default_video_src(PurpleMedia *media, src = gst_element_factory_make("dshowvideosrc", NULL); if (src == NULL) src = gst_element_factory_make("autovideosrc", NULL); +#elif defined(__APPLE__) + src = gst_element_factory_make("osxvideosrc", NULL); + if (src == NULL) + src = gst_element_factory_make("autovideosrc", NULL); #else src = gst_element_factory_make("gconfvideosrc", NULL); if (src == NULL) @@ -1136,6 +1144,8 @@ create_default_audio_src(PurpleMedia *media, src = gst_element_factory_make("osssrc", NULL); if (src == NULL) src = gst_element_factory_make("dshowaudiosrc", NULL); + if (src == NULL) + src = gst_element_factory_make("osxaudiosrc", NULL); if (src == NULL) { purple_debug_error("gtkmedia", "Unable to find a suitable " "element for the default audio source.\n"); diff --git a/pidgin/gtkmenutray.c b/pidgin/gtkmenutray.c index 5da4a97821..f78661ad2d 100644 --- a/pidgin/gtkmenutray.c +++ b/pidgin/gtkmenutray.c @@ -40,11 +40,15 @@ static GObjectClass *parent_class = NULL; * Internal Stuff *****************************************************************************/ +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_has_window(x) !GTK_WIDGET_NO_WINDOW(x) +#endif + /****************************************************************************** * Item Stuff *****************************************************************************/ static void -pidgin_menu_tray_select(GtkMenuItem *widget) { +pidgin_menu_tray_select(GtkItem *item) { /* this may look like nothing, but it's really overriding the * GtkMenuItem's select function so that it doesn't get highlighted like * a normal menu item would. @@ -52,7 +56,7 @@ pidgin_menu_tray_select(GtkMenuItem *widget) { } static void -pidgin_menu_tray_deselect(GtkMenuItem *widget) { +pidgin_menu_tray_deselect(GtkItem *item) { /* Probably not necessary, but I'd rather be safe than sorry. We're * overridding the select, so it makes sense to override deselect as well. */ @@ -92,7 +96,9 @@ pidgin_menu_tray_map(GtkWidget *widget) static void pidgin_menu_tray_finalize(GObject *obj) { +#if !GTK_CHECK_VERSION(2,12,0) PidginMenuTray *tray = PIDGIN_MENU_TRAY(obj); +#endif #if 0 /* This _might_ be leaking, but I have a sneaking suspicion that the widget is * getting destroyed in GtkContainer's finalize function. But if were are @@ -116,7 +122,7 @@ pidgin_menu_tray_finalize(GObject *obj) static void pidgin_menu_tray_class_init(PidginMenuTrayClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); - GtkMenuItemClass *menu_item_class = GTK_MENU_ITEM_CLASS(klass); + GtkItemClass *item_class = GTK_ITEM_CLASS(klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); GParamSpec *pspec; @@ -125,8 +131,8 @@ pidgin_menu_tray_class_init(PidginMenuTrayClass *klass) { object_class->finalize = pidgin_menu_tray_finalize; object_class->get_property = pidgin_menu_tray_get_property; - menu_item_class->select = pidgin_menu_tray_select; - menu_item_class->deselect = pidgin_menu_tray_deselect; + item_class->select = pidgin_menu_tray_select; + item_class->deselect = pidgin_menu_tray_deselect; widget_class->map = pidgin_menu_tray_map; @@ -255,7 +261,7 @@ pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const * not on the widget itself. */ if (!gtk_widget_get_has_window(widget)) - widget = gtk_widget_get_parent(widget); + widget = widget->parent; #if GTK_CHECK_VERSION(2,12,0) gtk_widget_set_tooltip_text(widget, tooltip); diff --git a/pidgin/gtkmenutray.h b/pidgin/gtkmenutray.h index 07b0ce91cb..158530a7bb 100644 --- a/pidgin/gtkmenutray.h +++ b/pidgin/gtkmenutray.h @@ -40,9 +40,7 @@ typedef struct _PidginMenuTrayClass PidginMenuTrayClass; struct _PidginMenuTray { GtkMenuItem gparent; /**< The parent instance */ GtkWidget *tray; /**< The tray */ -#if GTK_CHECK_VERSION(2,12,0) - gpointer depr1; -#else +#if !GTK_CHECK_VERSION(2,12,0) GtkTooltips *tooltips; /**< Tooltips */ #endif }; diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 6ca091e8d1..41f1f3a61e 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -36,10 +36,10 @@ #include "util.h" #include "gtkblist.h" -#include "gtkimhtml.h" #include "gtknotify.h" #include "gtkpounce.h" #include "gtkutils.h" +#include "gtkwebview.h" typedef struct { @@ -534,19 +534,14 @@ pidgin_notify_message(PurpleNotifyMsgType type, const char *title, gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - /* TODO: not sure if there is a way to do this in gtk+ 3, or - if we want to... */ -#if 0 +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); #endif - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER); - gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BOX_SPACE); + gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); + gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BOX_SPACE); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - hbox); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); if (img != NULL) gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); @@ -696,6 +691,8 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, PurpleAccount *account; PidginNotifyMailData *data = NULL, *data2; gboolean new_data = FALSE; + GtkTreeSelection *sel; + GtkTreeIter iter; /* Don't bother updating if there aren't new emails and we don't have any displayed currently */ if (count == 0 && mail_dialog == NULL) @@ -782,7 +779,18 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, } } + /* Select first item if nothing selected */ + sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(mail_dialog->treeview)); + if ((gtk_tree_selection_count_selected_rows(sel) < 1) + && gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) { + gtk_tree_selection_select_iter(sel, &iter); + } + +#if GTK_CHECK_VERSION(2,18,0) if (!gtk_widget_get_visible(mail_dialog->dialog)) { +#else + if (!GTK_WIDGET_VISIBLE(mail_dialog->dialog)) { +#endif GdkPixbuf *pixbuf = gtk_widget_render_icon(mail_dialog->dialog, PIDGIN_STOCK_DIALOG_MAIL, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), NULL); char *label_text = g_strdup_printf(ngettext("%d new email.", @@ -798,7 +806,11 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, g_free(label_text); if (pixbuf) g_object_unref(pixbuf); +#if GTK_CHECK_VERSION(2,18,0) } else if (!gtk_widget_has_focus(mail_dialog->dialog)) +#else + } else if (!GTK_WIDGET_HAS_FOCUS(mail_dialog->dialog)) +#endif pidgin_set_urgent(GTK_WINDOW(mail_dialog->dialog), TRUE); return data; @@ -807,7 +819,7 @@ pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, static gboolean formatted_input_cb(GtkWidget *win, GdkEventKey *event, gpointer data) { - if (event->keyval == GDK_KEY_Escape) + if (event->keyval == GDK_Escape) { purple_notify_close(PURPLE_NOTIFY_FORMATTED, win); @@ -817,21 +829,6 @@ formatted_input_cb(GtkWidget *win, GdkEventKey *event, gpointer data) return FALSE; } -static GtkIMHtmlOptions -notify_imhtml_options(void) -{ - GtkIMHtmlOptions options = 0; - - if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting")) - options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES; - - options |= GTK_IMHTML_NO_COMMENTS; - options |= GTK_IMHTML_NO_TITLE; - options |= GTK_IMHTML_NO_NEWLINE; - options |= GTK_IMHTML_NO_SCROLL; - return options; -} - static void * pidgin_notify_formatted(const char *title, const char *primary, const char *secondary, const char *text) @@ -840,7 +837,7 @@ pidgin_notify_formatted(const char *title, const char *primary, GtkWidget *vbox; GtkWidget *label; GtkWidget *button; - GtkWidget *imhtml; + GtkWidget *web_view; GtkWidget *frame; char label_text[2048]; char *linked_text, *primary_esc, *secondary_esc; @@ -854,7 +851,7 @@ pidgin_notify_formatted(const char *title, const char *primary, G_CALLBACK(formatted_close_cb), NULL); /* Setup the main vbox */ - vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); + vbox = GTK_DIALOG(window)->vbox; /* Setup the descriptive label */ primary_esc = g_markup_escape_text(primary, -1); @@ -876,12 +873,10 @@ pidgin_notify_formatted(const char *title, const char *primary, gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_widget_show(label); - /* Add the imhtml */ - frame = pidgin_create_imhtml(FALSE, &imhtml, NULL, NULL); - gtk_widget_set_name(imhtml, "pidgin_notify_imhtml"); - gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), - gtk_imhtml_get_format_functions(GTK_IMHTML(imhtml)) | GTK_IMHTML_IMAGE); - gtk_widget_set_size_request(imhtml, 300, 250); + /* Add the webview */ + frame = pidgin_create_webview(FALSE, &web_view, NULL, NULL); + gtk_widget_set_name(web_view, "pidgin_notify_webview"); + gtk_widget_set_size_request(web_view, 300, 250); gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); gtk_widget_show(frame); @@ -896,10 +891,10 @@ pidgin_notify_formatted(const char *title, const char *primary, /* Make sure URLs are clickable */ linked_text = purple_markup_linkify(text); - gtk_imhtml_append_text(GTK_IMHTML(imhtml), linked_text, notify_imhtml_options()); + webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(web_view), linked_text, ""); g_free(linked_text); - g_object_set_data(G_OBJECT(window), "info-widget", imhtml); + g_object_set_data(G_OBJECT(window), "webview-widget", web_view); /* Show the window */ pidgin_auto_parent_window(window); @@ -984,7 +979,7 @@ pidgin_notify_searchresults(PurpleConnection *gc, const char *title, G_CALLBACK(searchresults_close_cb), data); /* Setup the main vbox */ - vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); + vbox = GTK_DIALOG(window)->vbox; /* Setup the descriptive label */ primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; @@ -1041,7 +1036,7 @@ pidgin_notify_searchresults(PurpleConnection *gc, const char *title, renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, - column->title, renderer, "text", i, NULL); + purple_notify_searchresult_column_get_title(column), renderer, "text", i, NULL); if (!purple_notify_searchresult_column_is_visible(column)) gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i), FALSE); @@ -1055,7 +1050,7 @@ pidgin_notify_searchresults(PurpleConnection *gc, const char *title, switch (b->type) { case PURPLE_NOTIFY_BUTTON_LABELED: if(b->label) { - button = gtk_button_new_with_label(b->label); + button = gtk_dialog_add_button(GTK_DIALOG(window), b->label, GTK_RESPONSE_NONE); } else { purple_debug_warning("gtknotify", "Missing button label\n"); } @@ -1100,7 +1095,7 @@ pidgin_notify_searchresults(PurpleConnection *gc, const char *title, g_signal_connect_swapped(G_OBJECT(close_button), "clicked", G_CALLBACK(searchresults_close_cb), data); - data->account = gc->account; + data->account = purple_connection_get_account(gc); data->model = model; data->treeview = treeview; data->window = window; @@ -1154,10 +1149,9 @@ pidgin_notify_userinfo(PurpleConnection *gc, const char *who, info = purple_notify_user_info_get_text_with_newline(user_info, "
"); pinfo = g_hash_table_lookup(userinfo, key); if (pinfo != NULL) { - GtkIMHtml *imhtml = g_object_get_data(G_OBJECT(pinfo->window), "info-widget"); + GtkWidget *webview = g_object_get_data(G_OBJECT(pinfo->window), "webview-widget"); char *linked_text = purple_markup_linkify(info); - gtk_imhtml_clear(imhtml); - gtk_imhtml_append_text(imhtml, linked_text, notify_imhtml_options()); + gtk_webview_load_html_string_with_imgstore(GTK_WEBVIEW(webview), linked_text); g_free(linked_text); g_free(key); ui_handle = pinfo->window; @@ -1518,17 +1512,14 @@ pidgin_create_notification_dialog(PidginNotifyType type) /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BOX_SPACE); - gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BOX_SPACE); - /* TODO: not sure if this is possible (or necessary) in gtk+ 3 */ -#if 0 + gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BOX_SPACE); +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); #endif - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER); + gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); /* Vertical box */ - vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + vbox = GTK_DIALOG(dialog)->vbox; /* Golden ratio it up! */ gtk_widget_set_size_request(dialog, 550, 400); @@ -1560,11 +1551,13 @@ pidgin_create_notification_dialog(PidginNotifyType type) gtk_tree_view_set_search_column(GTK_TREE_VIEW(spec_dialog->treeview), PIDGIN_MAIL_TEXT); gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(spec_dialog->treeview), pidgin_tree_view_search_equal_func, NULL, NULL); + sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(spec_dialog->treeview)); + gtk_tree_selection_set_mode(sel, GTK_SELECTION_BROWSE); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(email_response_cb), spec_dialog); - g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(spec_dialog->treeview))), - "changed", G_CALLBACK(selection_changed_cb), spec_dialog); + g_signal_connect(G_OBJECT(sel), "changed", + G_CALLBACK(selection_changed_cb), spec_dialog); g_signal_connect(G_OBJECT(spec_dialog->treeview), "row-activated", G_CALLBACK(email_row_activated_cb), NULL); column = gtk_tree_view_column_new(); @@ -1662,7 +1655,7 @@ pidgin_create_notification_dialog(PidginNotifyType type) gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), + gtk_box_pack_start(GTK_BOX(vbox), pidgin_make_scrollable(spec_dialog->treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1), TRUE, TRUE, 2); diff --git a/pidgin/gtkplugin.c b/pidgin/gtkplugin.c index 35ed0a325a..afa21e0a6a 100644 --- a/pidgin/gtkplugin.c +++ b/pidgin/gtkplugin.c @@ -518,7 +518,7 @@ static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelecti break; dialog = gtk_dialog_new_with_buttons(PIDGIN_ALERT_TITLE, GTK_WINDOW(d), - GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); if (plugin_pref_dialogs == NULL) @@ -527,7 +527,7 @@ static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelecti g_hash_table_insert(plugin_pref_dialogs, plug, dialog); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(pref_dialog_response_cb), plug); - gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), box); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), box); gtk_window_set_role(GTK_WINDOW(dialog), "plugin_config"); gtk_window_set_title(GTK_WINDOW(dialog), _(purple_plugin_get_name(plug))); gtk_widget_show_all(dialog); @@ -562,12 +562,9 @@ static gboolean pidgin_plugins_paint_tooltip(GtkWidget *tipwindow, gpointer data) { PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); - cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(tipwindow)); - gtk_paint_layout(gtk_widget_get_style(tipwindow), cr, GTK_STATE_NORMAL, FALSE, - tipwindow, "tooltip", + gtk_paint_layout(tipwindow->style, tipwindow->window, GTK_STATE_NORMAL, FALSE, + NULL, tipwindow, "tooltip", 6, 6, layout); - cairo_destroy(cr); - return TRUE; } @@ -722,9 +719,8 @@ void pidgin_plugin_dialog_show() plugin_dialog = gtk_dialog_new_with_buttons(_("Plugins"), NULL, - 0, + GTK_DIALOG_NO_SEPARATOR, NULL); - pref_button = gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), _("Configure Pl_ugin"), PIDGIN_RESPONSE_CONFIGURE); gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), @@ -776,7 +772,7 @@ void pidgin_plugin_dialog_show() gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); gtk_tree_view_column_set_sort_column_id(col, 1); g_object_unref(G_OBJECT(ls)); - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(plugin_dialog))), + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), pidgin_make_scrollable(event_view, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1), TRUE, TRUE, 0); gtk_tree_view_set_search_column(GTK_TREE_VIEW(event_view), 1); @@ -792,8 +788,8 @@ void pidgin_plugin_dialog_show() gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE); gtk_widget_set_sensitive(expander, FALSE); gtk_container_add(GTK_CONTAINER(expander), create_details()); - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(plugin_dialog))), - expander, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), expander, + FALSE, FALSE, 0); g_signal_connect (G_OBJECT (sel), "changed", G_CALLBACK (prefs_plugin_sel), NULL); diff --git a/pidgin/gtkpounce.c b/pidgin/gtkpounce.c index 5b2541283c..62becb487c 100644 --- a/pidgin/gtkpounce.c +++ b/pidgin/gtkpounce.c @@ -410,15 +410,13 @@ pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *sd, guint info, guint t, gpointer data) { PidginPounceDialog *dialog; - GdkAtom target = gtk_selection_data_get_target(sd); - const guchar *sd_data = gtk_selection_data_get_data(sd); - if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) + if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { PurpleBlistNode *node = NULL; PurpleBuddy *buddy; - memcpy(&node, sd_data, sizeof(node)); + memcpy(&node, sd->data, sizeof(node)); if (PURPLE_BLIST_NODE_IS_CONTACT(node)) buddy = purple_contact_get_priority_buddy((PurpleContact *)node); @@ -429,19 +427,19 @@ pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, dialog = (PidginPounceDialog *)data; - gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), buddy->name); - dialog->account = buddy->account; - pidgin_account_option_menu_set_selected(dialog->account_menu, buddy->account); + gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), purple_buddy_get_name(buddy)); + dialog->account = purple_buddy_get_account(buddy); + pidgin_account_option_menu_set_selected(dialog->account_menu, purple_buddy_get_account(buddy)); - gtk_drag_finish(dc, TRUE, (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } - else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) + else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) { char *protocol = NULL; char *username = NULL; PurpleAccount *account; - if (pidgin_parse_x_im_contact((const char *) sd_data, FALSE, &account, + if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, &protocol, &username, NULL)) { if (account == NULL) @@ -463,7 +461,7 @@ pounce_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, g_free(username); g_free(protocol); - gtk_drag_finish(dc, TRUE, (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); + gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } } @@ -478,7 +476,7 @@ reset_send_msg_entry(PidginPounceDialog *dialog, GtkWidget *dontcare) { PurpleAccount *account = pidgin_account_option_menu_get_selected(dialog->account_menu); gtk_imhtml_setup_entry(GTK_IMHTML(dialog->send_msg_entry), - (account && account->gc) ? account->gc->flags : PURPLE_CONNECTION_HTML); + (account && purple_account_get_connection(account)) ? purple_connection_get_flags(purple_account_get_connection(account)) : PURPLE_CONNECTION_HTML); } void @@ -542,7 +540,7 @@ pidgin_pounce_editor_show(PurpleAccount *account, const char *name, G_CALLBACK(delete_win_cb), dialog); /* Create the parent vbox for everything. */ - vbox1 = gtk_dialog_get_content_area(GTK_DIALOG(window)); + vbox1 = GTK_DIALOG(window)->vbox; /* Create the vbox that will contain all the prefs stuff. */ vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -1020,7 +1018,11 @@ pidgin_pounce_editor_show(PurpleAccount *account, const char *name, static gboolean pounces_manager_configure_cb(GtkWidget *widget, GdkEventConfigure *event, PouncesManager *dialog) { +#if GTK_CHECK_VERSION(2,18,0) if (gtk_widget_get_visible(widget)) { +#else + if (GTK_WIDGET_VISIBLE(widget)) { +#endif purple_prefs_set_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width", event->width); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height", event->height); } @@ -1421,7 +1423,6 @@ pounce_cb(PurplePounce *pounce, PurplePounceEvent events, void *data) if (purple_pounce_action_is_enabled(pounce, "popup-notify")) { char *tmp; - const char *name_shown; const char *reason; reason = purple_pounce_action_get_attribute(pounce, "popup-notify", "reason"); @@ -1454,14 +1455,6 @@ pounce_cb(PurplePounce *pounce, PurplePounceEvent events, void *data) _("Unknown.... Please report this!") ); - /* - * Ok here is where I change the second argument, title, from - * NULL to the account alias if we have it or the account - * name if that's all we have - */ - if ((name_shown = purple_account_get_alias(account)) == NULL) - name_shown = purple_account_get_username(account); - pidgin_notify_pounce_add(account, pounce, alias, tmp, reason, purple_date_format_full(NULL)); @@ -1485,7 +1478,7 @@ pounce_cb(PurplePounce *pounce, PurplePounceEvent events, void *data) purple_conversation_write(conv, NULL, message, PURPLE_MESSAGE_SEND, time(NULL)); - serv_send_im(account->gc, (char *)pouncee, (char *)message, 0); + serv_send_im(purple_account_get_connection(account), (char *)pouncee, (char *)message, 0); } } diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 622f36a178..416ed70ee6 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -45,6 +45,7 @@ #include "gtkblist.h" #include "gtkconv.h" +#include "gtkconv-theme.h" #include "gtkdebug.h" #include "gtkdialogs.h" #include "gtkimhtml.h" @@ -83,6 +84,8 @@ static GtkWidget *sample_imhtml = NULL; /* Themes page */ static GtkWidget *prefs_sound_themes_combo_box; static GtkWidget *prefs_blist_themes_combo_box; +static GtkWidget *prefs_conv_themes_combo_box; +static GtkWidget *prefs_conv_variants_combo_box; static GtkWidget *prefs_status_themes_combo_box; static GtkWidget *prefs_smiley_themes_combo_box; @@ -94,6 +97,8 @@ static gboolean prefs_sound_themes_loading; /* These exist outside the lifetime of the prefs dialog */ static GtkListStore *prefs_sound_themes; static GtkListStore *prefs_blist_themes; +static GtkListStore *prefs_conv_themes; +static GtkListStore *prefs_conv_variants; static GtkListStore *prefs_status_icon_themes; static GtkListStore *prefs_smiley_themes; @@ -118,7 +123,7 @@ pidgin_prefs_labeled_spin_button(GtkWidget *box, const gchar *title, const char *key, int min, int max, GtkSizeGroup *sg) { GtkWidget *spin; - GtkAdjustment *adjust; + GtkObject *adjust; int val; val = purple_prefs_get_int(key); @@ -241,7 +246,7 @@ pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, int int_value = 0; const char *str_value = NULL; gboolean bool_value = FALSE; - GtkListStore *store; + GtkListStore *store = NULL; GtkTreeIter iter; GtkTreeIter active; GtkCellRenderer *renderer; @@ -257,6 +262,9 @@ pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, } else if (type == PURPLE_PREF_BOOLEAN) { store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_BOOLEAN); stored_bool = purple_prefs_get_bool(key); + } else { + g_warn_if_reached(); + return NULL; } dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); @@ -376,6 +384,8 @@ delete_prefs(GtkWidget *asdf, void *gdsa) prefs_sound_themes_combo_box = NULL; prefs_blist_themes_combo_box = NULL; + prefs_conv_themes_combo_box = NULL; + prefs_conv_variants_combo_box = NULL; prefs_status_themes_combo_box = NULL; prefs_smiley_themes_combo_box = NULL; @@ -527,6 +537,18 @@ prefs_themes_sort(PurpleTheme *theme) g_free(markup); if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); + + } else if (PIDGIN_IS_CONV_THEME(theme)) { + /* No image available? */ + + name = purple_theme_get_name(theme); + /* No author available */ + /* No description available */ + + markup = get_theme_markup(name, FALSE, NULL, NULL); + + gtk_list_store_append(prefs_conv_themes, &iter); + gtk_list_store_set(prefs_conv_themes, &iter, 1, markup, 2, name, -1); } } @@ -582,6 +604,17 @@ prefs_themes_refresh(void) gtk_list_store_set(prefs_blist_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); g_free(tmp); + /* conversation themes */ + gtk_list_store_clear(prefs_conv_themes); + gtk_list_store_append(prefs_conv_themes, &iter); + tmp = get_theme_markup(_("Default"), FALSE, _("Penguin Pimps"), + _("The default Pidgin conversation theme")); + gtk_list_store_set(prefs_conv_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); + g_free(tmp); + + /* conversation theme variants */ + gtk_list_store_clear(prefs_conv_variants); + /* status icon themes */ gtk_list_store_clear(prefs_status_icon_themes); gtk_list_store_append(prefs_status_icon_themes, &iter); @@ -602,6 +635,7 @@ prefs_themes_refresh(void) /* set active */ prefs_set_active_theme_combo(prefs_sound_themes_combo_box, prefs_sound_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme")); prefs_set_active_theme_combo(prefs_blist_themes_combo_box, prefs_blist_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme")); + prefs_set_active_theme_combo(prefs_conv_themes_combo_box, prefs_conv_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme")); prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); prefs_set_active_theme_combo(prefs_smiley_themes_combo_box, prefs_smiley_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme")); prefs_sound_themes_loading = FALSE; @@ -615,6 +649,10 @@ prefs_themes_init(void) prefs_blist_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); + prefs_conv_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); + + prefs_conv_variants = gtk_list_store_new(1, G_TYPE_STRING); + prefs_status_icon_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); prefs_smiley_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); @@ -864,10 +902,9 @@ static void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, guint info, guint t, gpointer user_data) { - gchar *name = g_strchomp((gchar *)gtk_selection_data_get_data(sd)); + gchar *name = g_strchomp((gchar *)sd->data); - if ((gtk_selection_data_get_length(sd) >= 0) - && (gtk_selection_data_get_format(sd) == 8)) { + if ((sd->length >= 0) && (sd->format == 8)) { /* Well, it looks like the drag event was cool. * Let's do something with it */ gchar *temp; @@ -894,7 +931,7 @@ theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, } else if (!g_ascii_strncasecmp(name, "http://", 7)) { /* Oo, a web drag and drop. This is where things * will start to get interesting */ - purple_util_fetch_url(name, TRUE, NULL, FALSE, theme_got_url, info); + purple_util_fetch_url(name, TRUE, NULL, FALSE, -1, theme_got_url, info); } else if (!g_ascii_strncasecmp(name, "https://", 8)) { /* purple_util_fetch_url() doesn't support HTTPS, but we want users * to be able to drag and drop links from the SF trackers, so @@ -905,7 +942,7 @@ theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, tmp[2] = 't'; tmp[3] = 'p'; - purple_util_fetch_url(tmp, TRUE, NULL, FALSE, theme_got_url, info); + purple_util_fetch_url(tmp, TRUE, NULL, FALSE, -1, theme_got_url, info); g_free(tmp); } else free_theme_info(info); @@ -1057,6 +1094,72 @@ prefs_set_blist_theme_cb(GtkComboBox *combo_box, gpointer user_data) } } +/* sets the current conversation theme */ +static void +prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) +{ + PidginConvTheme *theme = NULL; + GtkTreeIter iter; + gchar *name = NULL; + + if (gtk_combo_box_get_active_iter(combo_box, &iter)) { + const GList *variants; + const char *current_variant; + gboolean unset = TRUE; + + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); + if (!name || !*name) { + g_free(name); + return; + } + + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/theme", name); + + /* Update list of variants */ + gtk_list_store_clear(prefs_conv_variants); + + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + current_variant = pidgin_conversation_theme_get_variant(theme); + + variants = pidgin_conversation_theme_get_variants(theme); + for (; variants && current_variant; variants = g_list_next(variants)) { + gtk_list_store_append(prefs_conv_variants, &iter); + gtk_list_store_set(prefs_conv_variants, &iter, 0, variants->data, -1); + + if (g_str_equal(variants->data, current_variant)) { + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(prefs_conv_variants_combo_box), &iter); + unset = FALSE; + } + } + + if (unset) + gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0); + + g_free(name); + } +} + +/* sets the current conversation theme variant */ +static void +prefs_set_conv_variant_cb(GtkComboBox *combo_box, gpointer user_data) +{ + PidginConvTheme *theme = NULL; + GtkTreeIter iter; + gchar *name = NULL; + + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(prefs_conv_themes_combo_box), &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + g_free(name); + + if (gtk_combo_box_get_active_iter(combo_box, &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_variants), &iter, 0, &name, -1); + pidgin_conversation_theme_set_variant(theme, name); + g_free(name); + } + } +} + /* sets the current icon theme */ static void prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data) @@ -1109,6 +1212,40 @@ add_theme_prefs_combo(GtkWidget *vbox, return combo_box; } +static GtkWidget * +add_child_theme_prefs_combo(GtkWidget *vbox, GtkSizeGroup *combo_sg, + GtkSizeGroup *label_sg, GtkListStore *theme_store, + GCallback combo_box_cb, gpointer combo_box_cb_user_data, + const char *label_str) +{ + GtkWidget *label; + GtkWidget *combo_box; + GtkWidget *themesel_hbox; + GtkCellRenderer *cell_rend; + + themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + gtk_box_pack_start(GTK_BOX(vbox), themesel_hbox, FALSE, FALSE, 0); + + label = gtk_label_new(label_str); + gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); + gtk_size_group_add_widget(label_sg, label); + gtk_box_pack_start(GTK_BOX(themesel_hbox), label, FALSE, FALSE, 0); + + combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(theme_store)); + + cell_rend = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo_box), cell_rend, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_box), cell_rend, "text", 0, NULL); + g_object_set(cell_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); + + g_signal_connect(G_OBJECT(combo_box), "changed", + (GCallback)combo_box_cb, combo_box_cb_user_data); + gtk_size_group_add_widget(combo_sg, combo_box); + gtk_box_pack_start(GTK_BOX(themesel_hbox), combo_box, TRUE, TRUE, 0); + + return combo_box; +} + static GtkWidget * theme_page(void) { @@ -1139,6 +1276,20 @@ theme_page(void) (GCallback)prefs_set_blist_theme_cb, NULL, _("Buddy List Theme:"), PIDGIN_PREFS_ROOT "/blist/theme", "blist"); + /* Conversation Themes */ + prefs_conv_themes_combo_box = add_theme_prefs_combo( + vbox, combo_sg, label_sg, prefs_conv_themes, + (GCallback)prefs_set_conv_theme_cb, NULL, + _("Conversation Theme:"), PIDGIN_PREFS_ROOT "/conversations/theme", "conversation"); + + /* Conversation Theme Variants */ + prefs_conv_variants_combo_box = add_child_theme_prefs_combo( + vbox, combo_sg, label_sg, prefs_conv_variants, + (GCallback)prefs_set_conv_variant_cb, NULL, _("\tVariant:")); + + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(prefs_conv_variants), + 0, GTK_SORT_ASCENDING); + /* Status Icon Themes */ prefs_status_themes_combo_box = add_theme_prefs_combo( vbox, combo_sg, label_sg, prefs_status_icon_themes, @@ -2074,6 +2225,14 @@ proxy_page(void) path = g_find_program_in_path("gnome-network-properties"); if (path == NULL) path = g_find_program_in_path("gnome-network-preferences"); + if (path == NULL) { + path = g_find_program_in_path("gnome-control-center"); + if (path != NULL) { + char *tmp = g_strdup_printf("%s network", path); + g_free(path); + path = tmp; + } + } if (path == NULL) { label = gtk_label_new(NULL); @@ -2468,7 +2627,7 @@ static GtkWidget * sound_page(void) { GtkWidget *ret; - GtkWidget *vbox, *vbox2, *sw, *button, *parent, *parent_parent, *parent_parent_parent; + GtkWidget *vbox, *vbox2, *sw, *button; GtkSizeGroup *sg; GtkTreeIter iter; GtkWidget *event_view; @@ -2565,18 +2724,15 @@ sound_page(void) sound_changed2_cb, vbox); #endif vbox = pidgin_make_frame(ret, _("Sound Events")); - parent = gtk_widget_get_parent(vbox); - parent_parent = gtk_widget_get_parent(parent); - parent_parent_parent = gtk_widget_get_parent(parent_parent); /* The following is an ugly hack to make the frame expand so the * sound events list is big enough to be usable */ - gtk_box_set_child_packing(GTK_BOX(parent), vbox, TRUE, TRUE, 0, + gtk_box_set_child_packing(GTK_BOX(vbox->parent), vbox, TRUE, TRUE, 0, GTK_PACK_START); - gtk_box_set_child_packing(GTK_BOX(parent_parent), - parent, TRUE, TRUE, 0, GTK_PACK_START); - gtk_box_set_child_packing(GTK_BOX(parent_parent_parent), - parent_parent, TRUE, TRUE, 0, GTK_PACK_START); + gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent), vbox->parent, TRUE, + TRUE, 0, GTK_PACK_START); + gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent->parent), + vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START); /* SOUND SELECTION */ event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); @@ -2907,6 +3063,10 @@ pidgin_prefs_init(void) /* Themes */ prefs_themes_init(); + /* Conversation Themes */ + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); + purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/theme", "Default"); + /* Smiley Themes */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/smileys"); purple_prefs_add_string(PIDGIN_PREFS_ROOT "/smileys/theme", "Default"); @@ -2929,7 +3089,6 @@ pidgin_prefs_update_old(void) purple_prefs_rename("/purple/conversations/placement", PIDGIN_PREFS_ROOT "/conversations/placement"); - purple_prefs_rename(PIDGIN_PREFS_ROOT "/debug/timestamps", "/purple/debug/timestamps"); purple_prefs_rename(PIDGIN_PREFS_ROOT "/conversations/im/raise_on_events", "/plugins/gtk/X11/notify/method_raise"); purple_prefs_rename_boolean_toggle(PIDGIN_PREFS_ROOT "/conversations/ignore_colors", @@ -2975,6 +3134,7 @@ pidgin_prefs_update_old(void) purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/ignore_fonts"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/ignore_font_sizes"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/passthrough_unknown_commands"); + purple_prefs_remove(PIDGIN_PREFS_ROOT "/debug/timestamps"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/idle"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/logging/individual_logs"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/signon"); diff --git a/pidgin/gtkprefs.h b/pidgin/gtkprefs.h index d07c968b8a..fc7119c7a4 100644 --- a/pidgin/gtkprefs.h +++ b/pidgin/gtkprefs.h @@ -92,8 +92,6 @@ GtkWidget *pidgin_prefs_labeled_entry(GtkWidget *page, const gchar *title, * @return An hbox containing both the label and the entry. Can be used to set * the widgets to sensitive or insensitive based on the value of a * checkbox. - * - * @since 2.6.0 */ GtkWidget *pidgin_prefs_labeled_password(GtkWidget *page, const gchar *title, const char *key, GtkSizeGroup *sg); diff --git a/pidgin/gtkprivacy.c b/pidgin/gtkprivacy.c index 607dea8099..3ed3debbc2 100644 --- a/pidgin/gtkprivacy.c +++ b/pidgin/gtkprivacy.c @@ -211,7 +211,7 @@ select_account_cb(GtkWidget *dropdown, PurpleAccount *account, dialog->account = account; for (i = 0; i < menu_entry_count; i++) { - if (menu_entries[i].num == account->perm_deny) { + if (menu_entries[i].num == purple_account_get_privacy_type(account)) { gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), i); break; } @@ -230,12 +230,12 @@ type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog) { int new_type = menu_entries[gtk_combo_box_get_active(combo)].num; - dialog->account->perm_deny = new_type; + purple_account_set_privacy_type(dialog->account, new_type); serv_set_permit_deny(purple_account_get_connection(dialog->account)); gtk_widget_hide(dialog->allow_widget); gtk_widget_hide(dialog->block_widget); - gtk_widget_hide(dialog->button_box); + gtk_widget_hide_all(dialog->button_box); if (new_type == PURPLE_PRIVACY_ALLOW_USERS) { gtk_widget_show(dialog->allow_widget); @@ -363,15 +363,15 @@ privacy_dialog_new(void) dialog->account = pidgin_account_option_menu_get_selected(dropdown); /* Add the drop-down list with the allow/block types. */ - dialog->type_menu = gtk_combo_box_text_new(); + dialog->type_menu = gtk_combo_box_new_text(); gtk_box_pack_start(GTK_BOX(vbox), dialog->type_menu, FALSE, FALSE, 0); gtk_widget_show(dialog->type_menu); for (i = 0; i < menu_entry_count; i++) { - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(dialog->type_menu), + gtk_combo_box_append_text(GTK_COMBO_BOX(dialog->type_menu), _(menu_entries[i].text)); - if (menu_entries[i].num == dialog->account->perm_deny) + if (menu_entries[i].num == purple_account_get_privacy_type(dialog->account)) selected = i; } @@ -411,12 +411,12 @@ privacy_dialog_new(void) type_changed_cb(GTK_COMBO_BOX(dialog->type_menu), dialog); #if 0 - if (dialog->account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) { + if (purple_account_get_privacy_type(dialog->account) == PURPLE_PRIVACY_ALLOW_USERS) { gtk_widget_show(dialog->allow_widget); gtk_widget_show(dialog->button_box); dialog->in_allow_list = TRUE; } - else if (dialog->account->perm_deny == PURPLE_PRIVACY_DENY_USERS) { + else if (purple_account_get_privacy_type(dialog->account) == PURPLE_PRIVACY_DENY_USERS) { gtk_widget_show(dialog->block_widget); gtk_widget_show(dialog->button_box); dialog->in_allow_list = FALSE; @@ -434,7 +434,7 @@ pidgin_privacy_dialog_show(void) privacy_dialog = privacy_dialog_new(); gtk_widget_show(privacy_dialog->win); - gdk_window_raise(gtk_widget_get_window(privacy_dialog->win)); + gdk_window_raise(privacy_dialog->win->window); } void diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index aa25e0c2de..23ed979514 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -39,6 +39,21 @@ #include +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_set_can_default(x,y) do {\ + if (y) \ + GTK_WIDGET_SET_FLAGS(x, GTK_CAN_DEFAULT); \ + else \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_CAN_DEFAULT); \ +} while(0) +#define gtk_widget_set_can_focus(x,y) do {\ + if (y) \ + GTK_WIDGET_SET_FLAGS(x, GTK_CAN_FOCUS); \ + else \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_CAN_FOCUS); \ +} while(0) +#endif + static GtkWidget * create_account_field(PurpleRequestField *field); typedef struct @@ -105,10 +120,8 @@ pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account) #endif if (GTK_IS_DIALOG(cont)) { - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(cont))), - image, FALSE, TRUE, 0); - gtk_box_reorder_child(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(cont))), - image, 0); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(cont)->action_area), image, FALSE, TRUE, 0); + gtk_box_reorder_child(GTK_BOX(GTK_DIALOG(cont)->action_area), image, 0); } else if (GTK_IS_HBOX(cont)) { gtk_misc_set_alignment(GTK_MISC(image), 0, 0); gtk_box_pack_end(GTK_BOX(cont), image, FALSE, TRUE, 0); @@ -265,7 +278,11 @@ multifield_ok_cb(GtkWidget *button, PidginRequestData *data) { generic_response_start(data); +#if GTK_CHECK_VERSION(2,18,0) if (!gtk_widget_has_focus(button)) +#else + if (!GTK_WIDGET_HAS_FOCUS(button)) +#endif gtk_widget_grab_focus(button); if (data->cbs[0] != NULL) @@ -361,22 +378,18 @@ pidgin_request_input(const char *title, const char *primary, /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); - gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER / 2); + gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2); if (!multiline) gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - /* TODO: not sure how to do this with GTK+ 3 */ -#if 0 +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); #endif gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0); - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER); + gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - hbox); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); /* Dialog icon. */ img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, @@ -534,20 +547,16 @@ pidgin_request_choice(const char *title, const char *primary, /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); - gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER / 2); + gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - /* TODO: don't know if this is possible with GTK+ 3 */ -#if 0 +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); #endif - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER); + gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - hbox); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); /* Dialog icon. */ img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, @@ -662,20 +671,16 @@ pidgin_request_action_with_icon(const char *title, const char *primary, /* Setup the dialog */ gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2); - gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER / 2); + gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - /* TODO: this is probably not supported by GTK+ 3 */ -#if 0 +#if !GTK_CHECK_VERSION(2,22,0) gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); #endif - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - PIDGIN_HIG_BORDER); + gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER); /* Setup the main horizontal box */ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - hbox); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); /* Dialog icon. */ if (icon_data) { @@ -775,6 +780,7 @@ static void req_entry_field_changed_cb(GtkWidget *entry, PurpleRequestField *field) { PurpleRequestFieldGroup *group; + PurpleRequestFields *fields; PidginRequestData *req_data; if (purple_request_field_string_is_multiline(field)) @@ -797,10 +803,11 @@ req_entry_field_changed_cb(GtkWidget *entry, PurpleRequestField *field) } group = purple_request_field_get_group(field); - req_data = (PidginRequestData *)group->fields_list->ui_data; + fields = purple_request_field_group_get_fields_list(group); + req_data = purple_request_fields_get_ui_data(fields); gtk_widget_set_sensitive(req_data->ok_button, - purple_request_fields_all_required_filled(group->fields_list)); + purple_request_fields_all_required_filled(fields)); } static void @@ -822,7 +829,7 @@ setup_entry_field(GtkWidget *entry, PurpleRequestField *field) { GtkWidget *optmenu = NULL; PurpleRequestFieldGroup *group = purple_request_field_get_group(field); - GList *fields = group->fields; + GList *fields = purple_request_field_group_get_fields(group); /* Ensure the account option menu is created (if the widget hasn't * been initialized already) for username auto-completion. */ @@ -996,12 +1003,12 @@ create_choice_field(PurpleRequestField *field) if (num_labels > 5) { - widget = gtk_combo_box_text_new(); + widget = gtk_combo_box_new_text(); for (l = labels; l != NULL; l = l->next) { const char *text = l->data; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), text); + gtk_combo_box_append_text(GTK_COMBO_BOX(widget), text); } gtk_combo_box_set_active(GTK_COMBO_BOX(widget), @@ -1246,7 +1253,7 @@ pidgin_request_fields(const char *title, const char *primary, data->user_data = user_data; data->u.multifield.fields = fields; - fields->ui_data = data; + purple_request_fields_set_ui_data(fields, data); data->cb_count = 2; data->cbs = g_new0(GCallback, 2); diff --git a/pidgin/gtkroomlist.c b/pidgin/gtkroomlist.c index bdc6aa58df..21a3864483 100644 --- a/pidgin/gtkroomlist.c +++ b/pidgin/gtkroomlist.c @@ -91,7 +91,7 @@ static gint delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) purple_timeout_remove(dialog->pg_update_to); if (dialog->roomlist) { - PidginRoomlist *rl = dialog->roomlist->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(dialog->roomlist); if (dialog->pg_update_to > 0) /* yes, that's right, unref it twice. */ @@ -115,7 +115,7 @@ static void dialog_select_account_cb(GObject *w, PurpleAccount *account, dialog->account = account; if (change && dialog->roomlist) { - PidginRoomlist *rl = dialog->roomlist->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(dialog->roomlist); if (rl->tree) { gtk_widget_destroy(rl->tree); rl->tree = NULL; @@ -135,7 +135,7 @@ static void list_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) return; if (dialog->roomlist != NULL) { - rl = dialog->roomlist->ui_data; + rl = purple_roomlist_get_ui_data(dialog->roomlist); gtk_widget_destroy(rl->tree); purple_roomlist_unref(dialog->roomlist); } @@ -144,7 +144,7 @@ static void list_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) if (!dialog->roomlist) return; purple_roomlist_ref(dialog->roomlist); - rl = dialog->roomlist->ui_data; + rl = purple_roomlist_get_ui_data(dialog->roomlist); rl->dialog = dialog; if (dialog->account_widget) @@ -203,7 +203,7 @@ selection_changed_cb(GtkTreeSelection *selection, PidginRoomlist *grl) { val.g_type = 0; gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) { + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) { gtk_widget_set_sensitive(dialog->join_button, FALSE); gtk_widget_set_sensitive(dialog->add_button, FALSE); return; @@ -228,18 +228,19 @@ selection_changed_cb(GtkTreeSelection *selection, PidginRoomlist *grl) { static void do_add_room_cb(GtkWidget *w, struct _menu_cb_info *info) { char *name; - PurpleConnection *gc = purple_account_get_connection(info->list->account); + PurpleAccount *account = purple_roomlist_get_account(info->list); + PurpleConnection *gc = purple_account_get_connection(account); PurplePluginProtocolInfo *prpl_info = NULL; if(gc != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if(prpl_info != NULL && prpl_info->roomlist_room_serialize) name = prpl_info->roomlist_room_serialize(info->room); else - name = g_strdup(info->room->name); + name = g_strdup(purple_roomlist_room_get_name(info->room)); - purple_blist_request_add_chat(info->list->account, NULL, NULL, name); + purple_blist_request_add_chat(account, NULL, NULL, name); g_free(name); } @@ -247,7 +248,7 @@ static void do_add_room_cb(GtkWidget *w, struct _menu_cb_info *info) static void add_room_to_blist_cb(GtkButton *button, PidginRoomlistDialog *dialog) { PurpleRoomlist *rl = dialog->roomlist; - PidginRoomlist *grl = rl->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(rl); struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info"); if(info != NULL) @@ -262,7 +263,7 @@ static void do_join_cb(GtkWidget *w, struct _menu_cb_info *info) static void join_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) { PurpleRoomlist *rl = dialog->roomlist; - PidginRoomlist *grl = rl->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(rl); struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info"); if(info != NULL) @@ -272,7 +273,7 @@ static void join_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *arg2, PurpleRoomlist *list) { - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); GtkTreeIter iter; PurpleRoomlistRoom *room; GValue val; @@ -282,7 +283,7 @@ static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColu val.g_type = 0; gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) return; info.list = list; @@ -294,7 +295,7 @@ static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColu static gboolean room_click_cb(GtkWidget *tv, GdkEventButton *event, PurpleRoomlist *list) { GtkTreePath *path; - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); GValue val; PurpleRoomlistRoom *room; GtkTreeIter iter; @@ -313,7 +314,7 @@ static gboolean room_click_cb(GtkWidget *tv, GdkEventButton *event, PurpleRoomli gtk_tree_model_get_value (GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) return FALSE; info.list = list; @@ -341,9 +342,9 @@ static void row_expanded_cb(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePat gtk_tree_model_get_value(gtk_tree_view_get_model(treeview), arg1, ROOM_COLUMN, &val); category = g_value_get_pointer(&val); - if (!category->expanded_once) { + if (!purple_roomlist_room_get_expanded_once(category)) { purple_roomlist_expand_category(list, category); - category->expanded_once = TRUE; + purple_roomlist_room_set_expanded_once(category, TRUE); } } @@ -354,14 +355,13 @@ static gboolean pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) { PurpleRoomlist *list = user_data; - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); GtkStyle *style; int current_height, max_width; int max_text_width; GtkTextDirection dir = gtk_widget_get_direction(GTK_WIDGET(grl->tree)); - cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(grl->tipwindow)); - style = gtk_widget_get_style(grl->tipwindow); + style = grl->tipwindow->style; max_text_width = MAX(grl->tip_width, grl->tip_name_width); max_width = TOOLTIP_BORDER + SMALL_SPACE + max_text_width + TOOLTIP_BORDER; @@ -369,34 +369,32 @@ pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) current_height = 12; if (dir == GTK_TEXT_DIR_RTL) { - gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, - grl->tipwindow, "tooltip", + gtk_paint_layout(style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, + NULL, grl->tipwindow, "tooltip", max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), current_height, grl->tip_name_layout); } else { - gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, - grl->tipwindow, "tooltip", + gtk_paint_layout (style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, + NULL, grl->tipwindow, "tooltip", TOOLTIP_BORDER + SMALL_SPACE, current_height, grl->tip_name_layout); } if (dir != GTK_TEXT_DIR_RTL) { - gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, - grl->tipwindow, "tooltip", + gtk_paint_layout (style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, + NULL, grl->tipwindow, "tooltip", TOOLTIP_BORDER + SMALL_SPACE, current_height + grl->tip_name_height, grl->tip_layout); } else { - gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, - grl->tipwindow, "tooltip", + gtk_paint_layout(style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, + NULL, grl->tipwindow, "tooltip", max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), current_height + grl->tip_name_height, grl->tip_layout); } - cairo_destroy(cr); - return FALSE; } static gboolean pidgin_roomlist_create_tip(PurpleRoomlist *list, GtkTreePath *path) { - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); PurpleRoomlistRoom *room; GtkTreeIter iter; GValue val; @@ -417,19 +415,23 @@ static gboolean pidgin_roomlist_create_tip(PurpleRoomlist *list, GtkTreePath *pa gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); room = g_value_get_pointer(&val); - if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) + if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) return FALSE; tooltip_text = g_string_new(""); gtk_tree_model_get(GTK_TREE_MODEL(grl->model), &iter, NAME_COLUMN, &name, -1); - for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) { + for (j = NUM_OF_COLUMNS, + l = purple_roomlist_room_get_fields(room), + k = purple_roomlist_get_fields(list); + l && k; j++, l = l->next, k = k->next) + { PurpleRoomlistField *f = k->data; gchar *label; - if (f->hidden) + if (purple_roomlist_field_get_hidden(f)) continue; - label = g_markup_escape_text(f->label, -1); - switch (f->type) { + label = g_markup_escape_text(purple_roomlist_field_get_label(f), -1); + switch (purple_roomlist_field_get_type(f)) { case PURPLE_ROOMLIST_FIELD_BOOL: g_string_append_printf(tooltip_text, "%s%s: %s", first ? "" : "\n", label, l->data ? "True" : "False"); break; @@ -481,7 +483,7 @@ pidgin_roomlist_create_tooltip(GtkWidget *widget, GtkTreePath *path, gpointer data, int *w, int *h) { PurpleRoomlist *list = data; - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); grl->tipwindow = widget; if (!pidgin_roomlist_create_tip(data, path)) return FALSE; @@ -500,7 +502,7 @@ static gboolean account_filter_func(PurpleAccount *account) PurplePluginProtocolInfo *prpl_info = NULL; if (conn && PURPLE_CONNECTION_IS_CONNECTED(conn)) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(conn->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(conn)); return (prpl_info && prpl_info->roomlist_get_list != NULL); } @@ -625,7 +627,7 @@ static void pidgin_roomlist_new(PurpleRoomlist *list) { PidginRoomlist *rl = g_new0(PidginRoomlist, 1); - list->ui_data = rl; + purple_roomlist_set_ui_data(list, rl); rl->cats = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)gtk_tree_row_reference_free); @@ -688,7 +690,7 @@ _search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *it static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) { - PidginRoomlist *grl = list->ui_data; + PidginRoomlist *grl = purple_roomlist_get_ui_data(list); gint columns = NUM_OF_COLUMNS; int j; GtkTreeStore *model; @@ -710,7 +712,7 @@ static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { PurpleRoomlistField *f = l->data; - switch (f->type) { + switch (purple_roomlist_field_get_type(f)) { case PURPLE_ROOMLIST_FIELD_BOOL: types[j] = G_TYPE_BOOLEAN; break; @@ -752,18 +754,19 @@ static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { PurpleRoomlistField *f = l->data; - if (f->hidden) + if (purple_roomlist_field_get_hidden(f)) continue; renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(f->label, renderer, - "text", j, NULL); + column = gtk_tree_view_column_new_with_attributes( + purple_roomlist_field_get_label(f), renderer, + "text", j, NULL); gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), GTK_TREE_VIEW_COLUMN_GROW_ONLY); gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), j); gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE); - if (f->type == PURPLE_ROOMLIST_FIELD_INT) { + if (purple_roomlist_field_get_type(f) == PURPLE_ROOMLIST_FIELD_INT) { gtk_tree_view_column_set_cell_data_func(column, renderer, int_cell_data_func, GINT_TO_POINTER(j), NULL); gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model), j, int_sort_func, @@ -792,7 +795,7 @@ static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) static gboolean pidgin_progress_bar_pulse(gpointer data) { PurpleRoomlist *list = data; - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); if (!rl || !rl->dialog || !rl->dialog->pg_needs_pulse) { if (rl && rl->dialog) @@ -808,7 +811,7 @@ static gboolean pidgin_progress_bar_pulse(gpointer data) static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *room) { - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); GtkTreeRowReference *rr, *parentrr = NULL; GtkTreePath *path; GtkTreeIter iter, parent, child; @@ -817,7 +820,7 @@ static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *r gboolean append = TRUE; rl->total_rooms++; - if (room->type == PURPLE_ROOMLIST_ROOMTYPE_ROOM) + if (purple_roomlist_room_get_type(room) == PURPLE_ROOMLIST_ROOMTYPE_ROOM) rl->num_rooms++; if (rl->dialog) { @@ -829,8 +832,8 @@ static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *r rl->dialog->pg_needs_pulse = TRUE; } - if (room->parent) { - parentrr = g_hash_table_lookup(rl->cats, room->parent); + if (purple_roomlist_room_get_parent(room)) { + parentrr = g_hash_table_lookup(rl->cats, purple_roomlist_room_get_parent(room)); path = gtk_tree_row_reference_get_path(parentrr); if (path) { PurpleRoomlistRoom *tmproom = NULL; @@ -851,24 +854,28 @@ static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *r else iter = child; - if (room->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) + if (purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) gtk_tree_store_append(rl->model, &child, &iter); path = gtk_tree_model_get_path(GTK_TREE_MODEL(rl->model), &iter); - if (room->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) { + if (purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) { rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(rl->model), path); g_hash_table_insert(rl->cats, room, rr); } gtk_tree_path_free(path); - gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, room->name, -1); + gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, purple_roomlist_room_get_name(room), -1); gtk_tree_store_set(rl->model, &iter, ROOM_COLUMN, room, -1); - for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) { + for (j = NUM_OF_COLUMNS, + l = purple_roomlist_room_get_fields(room), + k = purple_roomlist_get_fields(list); + l && k; j++, l = l->next, k = k->next) + { PurpleRoomlistField *f = k->data; - if (f->hidden) + if (purple_roomlist_field_get_hidden(f)) continue; gtk_tree_store_set(rl->model, &iter, j, l->data, -1); } @@ -876,7 +883,7 @@ static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *r static void pidgin_roomlist_in_progress(PurpleRoomlist *list, gboolean in_progress) { - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); if (!rl || !rl->dialog) return; @@ -898,7 +905,7 @@ static void pidgin_roomlist_in_progress(PurpleRoomlist *list, gboolean in_progre static void pidgin_roomlist_destroy(PurpleRoomlist *list) { - PidginRoomlist *rl = list->ui_data; + PidginRoomlist *rl = purple_roomlist_get_ui_data(list); roomlists = g_list_remove(roomlists, list); @@ -906,7 +913,7 @@ static void pidgin_roomlist_destroy(PurpleRoomlist *list) g_hash_table_destroy(rl->cats); g_free(rl); - list->ui_data = NULL; + purple_roomlist_set_ui_data(list, NULL); } static PurpleRoomlistUiOps ops = { diff --git a/pidgin/gtksavedstatuses.c b/pidgin/gtksavedstatuses.c index 8c40215274..bf8d1394c1 100644 --- a/pidgin/gtksavedstatuses.c +++ b/pidgin/gtksavedstatuses.c @@ -524,7 +524,11 @@ create_saved_status_list(StatusWindow *dialog) static gboolean configure_cb(GtkWidget *widget, GdkEventConfigure *event, StatusWindow *dialog) { +#if GTK_CHECK_VERSION(2,18,0) if (gtk_widget_get_visible(widget)) +#else + if (GTK_WIDGET_VISIBLE(widget)) +#endif { purple_prefs_set_int(PIDGIN_PREFS_ROOT "/status/dialog/width", event->width); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/status/dialog/height", event->height); diff --git a/pidgin/gtkscrollbook.c b/pidgin/gtkscrollbook.c index 025c24395d..50f5748dca 100644 --- a/pidgin/gtkscrollbook.c +++ b/pidgin/gtkscrollbook.c @@ -102,7 +102,7 @@ refresh_scroll_box(PidginScrollBook *scroll_book, int index, int count) gtk_widget_show_all(GTK_WIDGET(scroll_book)); if (count < 1) - gtk_widget_hide(scroll_book->hbox); + gtk_widget_hide_all(scroll_book->hbox); else { gtk_widget_show_all(scroll_book->hbox); if (count == 1) { @@ -160,7 +160,7 @@ pidgin_scroll_book_add(GtkContainer *container, GtkWidget *widget) PidginScrollBook *scroll_book; g_return_if_fail(GTK_IS_WIDGET (widget)); - g_return_if_fail (gtk_widget_get_parent(widget) == NULL); + g_return_if_fail (widget->parent == NULL); scroll_book = PIDGIN_SCROLL_BOOK(container); scroll_book->children = g_list_append(scroll_book->children, widget); diff --git a/pidgin/gtksession.c b/pidgin/gtksession.c index adaacd0b73..a972865c76 100644 --- a/pidgin/gtksession.c +++ b/pidgin/gtksession.c @@ -349,7 +349,7 @@ pidgin_session_init(gchar *argv0, gchar *previous_id, gchar *config_dir) free(tmp); session_managed = TRUE; - gdk_x11_set_sm_client_id(client_id); + gdk_set_sm_client_id(client_id); tmp = g_get_current_dir(); session_set_string(session, SmCurrentDirectory, tmp); diff --git a/pidgin/gtksmiley.c b/pidgin/gtksmiley.c index 70e217564e..a8819db89b 100644 --- a/pidgin/gtksmiley.c +++ b/pidgin/gtksmiley.c @@ -47,9 +47,9 @@ struct _PidginSmiley GtkWidget *smiley_image; gchar *filename; GdkPixbuf *custom_pixbuf; - gpointer data; /** @since 2.6.0 */ - gsize datasize; /** @since 2.6.0 */ - gint entry_len; /** @since 2.6.0 */ + gpointer data; + gsize datasize; + gint entry_len; }; typedef struct @@ -399,7 +399,7 @@ pidgin_smiley_edit(GtkWidget *widget, PurpleSmiley *smiley) window = gtk_dialog_new_with_buttons(smiley ? _("Edit Smiley") : _("Add Smiley"), widget ? GTK_WINDOW(widget) : NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL); @@ -414,8 +414,7 @@ pidgin_smiley_edit(GtkWidget *widget, PurpleSmiley *smiley) /* The vbox */ vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))), - vbox); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), vbox); gtk_widget_show(vbox); /* The hbox */ @@ -725,10 +724,9 @@ smiley_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, guint info, guint t, gpointer user_data) { SmileyManager *dialog = user_data; - gchar *name = g_strchomp((gchar *) gtk_selection_data_get_data(sd)); - - if ((gtk_selection_data_get_length(sd) >= 0) - && (gtk_selection_data_get_format(sd) == 8)) { + gchar *name = g_strchomp((gchar *)sd->data); + + if ((sd->length >= 0) && (sd->format == 8)) { /* Well, it looks like the drag event was cool. * Let's do something with it */ @@ -752,7 +750,7 @@ smiley_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, } else if (!g_ascii_strncasecmp(name, "http://", 7)) { /* Oo, a web drag and drop. This is where things * will start to get interesting */ - purple_util_fetch_url(name, TRUE, NULL, FALSE, smiley_got_url, dialog); + purple_util_fetch_url(name, TRUE, NULL, FALSE, -1, smiley_got_url, dialog); } else if (!g_ascii_strncasecmp(name, "https://", 8)) { /* purple_util_fetch_url() doesn't support HTTPS */ char *tmp = g_strdup(name + 1); @@ -761,7 +759,7 @@ smiley_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, tmp[2] = 't'; tmp[3] = 'p'; - purple_util_fetch_url(tmp, TRUE, NULL, FALSE, smiley_got_url, dialog); + purple_util_fetch_url(tmp, TRUE, NULL, FALSE, -1, smiley_got_url, dialog); g_free(tmp); } @@ -884,8 +882,7 @@ void pidgin_smiley_manager_show(void) /* The vbox */ vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(win))), - vbox); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(win)->vbox), vbox); gtk_widget_show(vbox); /* get the scrolled window with all stuff */ diff --git a/pidgin/gtksmiley.h b/pidgin/gtksmiley.h index 8cf62a8add..fb65227db1 100644 --- a/pidgin/gtksmiley.h +++ b/pidgin/gtksmiley.h @@ -1,7 +1,6 @@ /** * @file gtksmiley.h GTK+ Custom Smiley API * @ingroup pidgin - * @since 2.5.0 */ /* pidgin @@ -106,8 +105,6 @@ void pidgin_smiley_editor_set_image(PidginSmiley *editor, GdkPixbuf *image); * @param editor A smiley editor dialog * @param data A pointer to smiley's data * @param datasize The size of smiley's data - * - * @since 2.6.0 */ void pidgin_smiley_editor_set_data(PidginSmiley *editor, gpointer data, gsize datasize); diff --git a/pidgin/gtksound.c b/pidgin/gtksound.c index e8e96d5de9..814b926c1e 100644 --- a/pidgin/gtksound.c +++ b/pidgin/gtksound.c @@ -96,8 +96,8 @@ chat_nick_matches_name(PurpleConversation *conv, const char *aname) if (chat==NULL) return ret; - nick = g_strdup(purple_normalize(conv->account, chat->nick)); - name = g_strdup(purple_normalize(conv->account, aname)); + nick = g_strdup(purple_normalize(purple_conversation_get_account(conv), purple_conv_chat_get_nick(chat))); + name = g_strdup(purple_normalize(purple_conversation_get_account(conv), aname)); if (g_utf8_collate(nick, name) == 0) ret = TRUE; @@ -212,7 +212,7 @@ chat_msg_received_cb(PurpleAccount *account, char *sender, if (chat_nick_matches_name(conv, sender)) return; - if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, chat->nick)) + if (flags & PURPLE_MESSAGE_NICK || purple_utf8_has_word(message, purple_conv_chat_get_nick(chat))) /* This isn't quite right; if you have the PURPLE_SOUND_CHAT_NICK event disabled * and the PURPLE_SOUND_CHAT_SAY event enabled, you won't get a sound at all */ play_conv_event(conv, PURPLE_SOUND_CHAT_NICK); diff --git a/pidgin/gtksound.h b/pidgin/gtksound.h index f55713907e..872b865f51 100644 --- a/pidgin/gtksound.h +++ b/pidgin/gtksound.h @@ -67,8 +67,6 @@ void *pidgin_sound_get_handle(void); * Returns true Pidgin is using customized sounds * * @return TRUE if non default sounds are used. - * - * @since 2.6.0 */ gboolean pidgin_sound_is_customized(void); diff --git a/pidgin/gtksourceundomanager.c b/pidgin/gtksourceundomanager.c index 558244627f..1368b0bbdb 100644 --- a/pidgin/gtksourceundomanager.c +++ b/pidgin/gtksourceundomanager.c @@ -532,8 +532,7 @@ gtk_source_undo_manager_undo (GtkSourceUndoManager *um) um->priv->document, undo_action->action.insert_anchor.pos, undo_action->action.insert_anchor.pos + 1); - /* TODO: is this needed in GTK+ 3? */ - /*gtk_text_child_anchor_set_segment(undo_action->action.insert_anchor.anchor, NULL); XXX: This may be a bug in GTK+ */ + undo_action->action.insert_anchor.anchor->segment = NULL; /* XXX: This may be a bug in GTK+ */ break; default: /* Unknown action type. */ diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c index 37744113ae..f1d5c422ff 100644 --- a/pidgin/gtkstatusbox.c +++ b/pidgin/gtkstatusbox.c @@ -70,6 +70,16 @@ /* Timeout for typing notifications in seconds */ #define TYPING_TIMEOUT 4 +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE(x) +#define gtk_widget_set_has_window(x, y) do { \ + if (y) \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_WIDGET_NO_WINDOW); \ + else \ + GTK_WIDGET_SET_FLAGS(x, GTK_WIDGET_NO_WINDOW); \ +} while (0) +#endif + static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data); static void remove_typing_cb(PidginStatusBox *box); @@ -82,10 +92,9 @@ static void pidgin_status_box_refresh(PidginStatusBox *status_box); static void status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed); static void pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed); static void pidgin_status_box_changed(PidginStatusBox *box); -static void pidgin_status_box_get_preferred_height (GtkWidget *widget, - gint *minimum_height, gint *natural_height); +static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static gboolean pidgin_status_box_draw (GtkWidget *widget, cairo_t *cr); +static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box); static void pidgin_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); static void pidgin_status_box_popup(PidginStatusBox *box); @@ -283,7 +292,7 @@ update_to_reflect_account_status(PidginStatusBox *status_box, PurpleAccount *acc if (!message || !*message) { - gtk_widget_hide(status_box->vbox); + gtk_widget_hide_all(status_box->vbox); status_box->imhtml_visible = FALSE; } else @@ -344,10 +353,9 @@ static void icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *sd, guint info, guint t, PidginStatusBox *box) { - gchar *name = (gchar *) gtk_selection_data_get_data(sd); + gchar *name = (gchar *)sd->data; - if ((gtk_selection_data_get_length(sd) >= 0) - && (gtk_selection_data_get_format(sd) == 8)) { + if ((sd->length >= 0) && (sd->format == 8)) { /* Well, it looks like the drag event was cool. * Let's do something with it */ if (!g_ascii_strncasecmp(name, "file://", 7)) { @@ -414,14 +422,14 @@ statusbox_uri_handler(const char *proto, const char *cmd, GHashTable *params, vo if (src == NULL) return FALSE; - purple_util_fetch_url(src, TRUE, NULL, FALSE, statusbox_got_url, data); + purple_util_fetch_url(src, TRUE, NULL, FALSE, -1, statusbox_got_url, data); return TRUE; } static gboolean icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) { - gdk_window_set_cursor(gtk_widget_get_window(widget), box->hand_cursor); + gdk_window_set_cursor(widget->window, box->hand_cursor); gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover); return FALSE; } @@ -429,7 +437,7 @@ icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *b static gboolean icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) { - gdk_window_set_cursor(gtk_widget_get_window(widget), box->arrow_cursor); + gdk_window_set_cursor(widget->window, box->arrow_cursor); gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ; return FALSE; } @@ -617,9 +625,9 @@ pidgin_status_box_class_init (PidginStatusBoxClass *klass) parent_class = g_type_class_peek_parent(klass); widget_class = (GtkWidgetClass*)klass; - widget_class->get_preferred_height = pidgin_status_box_get_preferred_height; + widget_class->size_request = pidgin_status_box_size_request; widget_class->size_allocate = pidgin_status_box_size_allocate; - widget_class->draw = pidgin_status_box_draw; + widget_class->expose_event = pidgin_status_box_expose_event; container_class->child_type = pidgin_status_box_child_type; container_class->forall = pidgin_status_box_forall; @@ -933,7 +941,7 @@ status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed) if (!purple_savedstatus_is_transient(saved_status) || !message || !*message) { status_box->imhtml_visible = FALSE; - gtk_widget_hide(status_box->vbox); + gtk_widget_hide_all(status_box->vbox); } else { @@ -1137,7 +1145,7 @@ static gboolean imhtml_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkI static gboolean imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box) { - if (event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_KP_Tab || event->keyval == GDK_KEY_ISO_Left_Tab) + if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab || event->keyval == GDK_ISO_Left_Tab) { /* If last inserted character is a tab, then remove the focus from here */ GtkWidget *top = gtk_widget_get_toplevel(w); @@ -1150,7 +1158,7 @@ static gboolean imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStat return FALSE; /* Reset the status if Escape was pressed */ - if (event->keyval == GDK_KEY_Escape) + if (event->keyval == GDK_Escape) { purple_timeout_remove(status_box->typing); status_box->typing = 0; @@ -1301,15 +1309,13 @@ pidgin_status_box_list_position (PidginStatusBox *status_box, int *x, int *y, in GdkRectangle monitor; GtkRequisition popup_req; GtkPolicyType hpolicy, vpolicy; - GtkAllocation allocation; - gtk_widget_get_allocation(GTK_WIDGET(status_box), &allocation); - gdk_window_get_origin (gtk_widget_get_window(GTK_WIDGET(status_box)), x, y); + gdk_window_get_origin (GTK_WIDGET(status_box)->window, x, y); - *x += allocation.x; - *y += allocation.y; + *x += GTK_WIDGET(status_box)->allocation.x; + *y += GTK_WIDGET(status_box)->allocation.y; - *width = allocation.width; + *width = GTK_WIDGET(status_box)->allocation.width; hpolicy = vpolicy = GTK_POLICY_NEVER; g_object_set(G_OBJECT(status_box->scrolled_window), @@ -1332,7 +1338,7 @@ pidgin_status_box_list_position (PidginStatusBox *status_box, int *x, int *y, in screen = gtk_widget_get_screen (GTK_WIDGET (status_box)); monitor_num = gdk_screen_get_monitor_at_window (screen, - gtk_widget_get_window(GTK_WIDGET (status_box))); + GTK_WIDGET (status_box)->window); gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); if (*x < monitor.x) @@ -1340,13 +1346,13 @@ pidgin_status_box_list_position (PidginStatusBox *status_box, int *x, int *y, in else if (*x + *width > monitor.x + monitor.width) *x = monitor.x + monitor.width - *width; - if (*y + allocation.height + *height <= monitor.y + monitor.height) - *y += allocation.height; + if (*y + GTK_WIDGET(status_box)->allocation.height + *height <= monitor.y + monitor.height) + *y += GTK_WIDGET(status_box)->allocation.height; else if (*y - *height >= monitor.y) *y -= *height; - else if (monitor.y + monitor.height - (*y + allocation.height) > *y - monitor.y) + else if (monitor.y + monitor.height - (*y + GTK_WIDGET(status_box)->allocation.height) > *y - monitor.y) { - *y += allocation.height; + *y += GTK_WIDGET(status_box)->allocation.height; *height = monitor.y + monitor.height - *y; } else @@ -1379,7 +1385,7 @@ popup_grab_on_window (GdkWindow *window, if (!grab_keyboard || gdk_keyboard_grab (window, TRUE, activate_time) == 0) return TRUE; else { - gdk_display_pointer_ungrab (gdk_window_get_display (window), activate_time); + gdk_display_pointer_ungrab (gdk_drawable_get_display (window), activate_time); return FALSE; } } @@ -1398,7 +1404,7 @@ pidgin_status_box_popup(PidginStatusBox *box) gtk_window_move (GTK_WINDOW (box->popup_window), x, y); gtk_widget_show(box->popup_window); gtk_widget_grab_focus (box->tree_view); - if (!popup_grab_on_window (gtk_widget_get_window(box->popup_window), + if (!popup_grab_on_window (box->popup_window->window, GDK_CURRENT_TIME, TRUE)) { gtk_widget_hide (box->popup_window); return; @@ -1429,10 +1435,10 @@ static gboolean toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box) { switch (event->keyval) { - case GDK_KEY_Return: - case GDK_KEY_KP_Enter: - case GDK_KEY_KP_Space: - case GDK_KEY_space: + case GDK_Return: + case GDK_KP_Enter: + case GDK_KP_Space: + case GDK_space: if (!box->popup_in_progress) { pidgin_status_box_popup (box); box->popup_in_progress = TRUE; @@ -1664,7 +1670,7 @@ treeview_key_press_event(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box) { if (box->popup_in_progress) { - if (event->keyval == GDK_KEY_Escape) { + if (event->keyval == GDK_Escape) { pidgin_status_box_popdown(box); return TRUE; } else { @@ -1675,9 +1681,9 @@ treeview_key_press_event(GtkWidget *widget, if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { gboolean ret = TRUE; path = gtk_tree_model_get_path(GTK_TREE_MODEL(box->dropdown_store), &iter); - if (event->keyval == GDK_KEY_Return) { + if (event->keyval == GDK_Return) { treeview_activate_current_selection(box, path); - } else if (event->keyval == GDK_KEY_Delete) { + } else if (event->keyval == GDK_Delete) { tree_view_delete_current_selection(box, path); } else ret = FALSE; @@ -1929,27 +1935,24 @@ pidgin_status_box_init (PidginStatusBox *status_box) } static void -pidgin_status_box_get_preferred_height(GtkWidget *widget, gint *minimum_height, - gint *natural_height) +pidgin_status_box_size_request(GtkWidget *widget, + GtkRequisition *requisition) { - gint box_min_height, box_nat_height; - gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); - - gtk_widget_get_preferred_height(PIDGIN_STATUS_BOX(widget)->toggle_button, - minimum_height, natural_height); + GtkRequisition box_req; + gint border_width = GTK_CONTAINER (widget)->border_width; - *minimum_height = MAX(*minimum_height, 34) + border_width * 2; - *natural_height = MAX(*natural_height, 34) + border_width * 2; + gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->toggle_button, requisition); - /* If the gtkimhtml is visible, then add some additional padding */ - gtk_widget_get_preferred_height(PIDGIN_STATUS_BOX(widget)->vbox, - &box_min_height, &box_nat_height); + /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ + requisition->height = MAX(requisition->height, 34); + requisition->height += border_width * 2; - if (box_min_height > 1) - *minimum_height += box_min_height + border_width * 2; + /* If the gtkimhtml is visible, then add some additional padding */ + gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->vbox, &box_req); + if (box_req.height > 1) + requisition->height += box_req.height + border_width * 2; - if (box_nat_height > 1) - *natural_height += box_nat_height + border_width * 2; + requisition->width = 1; } /* From gnome-panel */ @@ -1997,9 +2000,9 @@ pidgin_status_box_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); - GtkRequisition req = {0,40}; + GtkRequisition req = {0,0}; GtkAllocation parent_alc, box_alc, icon_alc; - gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); + gint border_width = GTK_CONTAINER (widget)->border_width; gtk_widget_size_request(status_box->toggle_button, &req); /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ @@ -2038,24 +2041,19 @@ pidgin_status_box_size_allocate(GtkWidget *widget, gtk_widget_size_allocate(status_box->icon_box, &icon_alc); } gtk_widget_size_allocate(status_box->toggle_button, &parent_alc); - gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation); - purple_debug_info("pidgin", "statusbox allocation: width = %d, height = %d\n", - allocation->width, allocation->height); + widget->allocation = *allocation; } static gboolean -pidgin_status_box_draw(GtkWidget *widget, cairo_t *cr) +pidgin_status_box_expose_event(GtkWidget *widget, + GdkEventExpose *event) { PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); - gtk_widget_draw(status_box->vbox, cr); - gtk_widget_draw(status_box->toggle_button, cr); - + gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->vbox, event); + gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->toggle_button, event); if (status_box->icon_box && status_box->icon_opaque) { - GtkAllocation allocation; - - gtk_widget_get_allocation(status_box->icon_box, &allocation); - gtk_paint_box(gtk_widget_get_style(widget), cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - status_box->icon_box, "button", allocation.x-1, allocation.y-1, + gtk_paint_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, + status_box->icon_box, "button", status_box->icon_box->allocation.x-1, status_box->icon_box->allocation.y-1, 34, 34); } return FALSE; @@ -2365,7 +2363,7 @@ activate_currently_selected_status(PidginStatusBox *status_box) message = pidgin_status_box_get_message(status_box); if (!message || !*message) { - gtk_widget_hide(status_box->vbox); + gtk_widget_hide_all(status_box->vbox); status_box->imhtml_visible = FALSE; if (message != NULL) { @@ -2637,7 +2635,7 @@ static void pidgin_status_box_changed(PidginStatusBox *status_box) purple_timeout_remove(status_box->typing); status_box->typing = 0; - if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) + if (gtk_widget_is_sensitive(GTK_WIDGET(status_box))) { if (type == PIDGIN_STATUS_BOX_TYPE_POPULAR || type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR) { @@ -2699,7 +2697,7 @@ static void pidgin_status_box_changed(PidginStatusBox *status_box) } g_list_free(accounts); - if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) + if (gtk_widget_is_sensitive(GTK_WIDGET(status_box))) { if (status_box->imhtml_visible) { @@ -2719,7 +2717,7 @@ static void pidgin_status_box_changed(PidginStatusBox *status_box) } else { - gtk_widget_hide(status_box->vbox); + gtk_widget_hide_all(status_box->vbox); activate_currently_selected_status(status_box); /* This is where we actually set the status */ } } @@ -2755,7 +2753,7 @@ get_statusbox_index(PidginStatusBox *box, PurpleSavedStatus *saved_status) static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) { PidginStatusBox *status_box = (PidginStatusBox*)data; - if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) + if (gtk_widget_is_sensitive(GTK_WIDGET(status_box))) { if (status_box->typing != 0) { pidgin_status_box_pulse_typing(status_box); diff --git a/pidgin/gtkthemes.c b/pidgin/gtkthemes.c index e92df94a38..d4fb77d5ba 100644 --- a/pidgin/gtkthemes.c +++ b/pidgin/gtkthemes.c @@ -122,6 +122,8 @@ void pidgin_themes_remove_smiley_theme(const char *file) static void _pidgin_themes_smiley_themeize(GtkWidget *imhtml, gboolean custom) { + /* TODO WEBKIT: move imhtml dependency to use webview. */ +#if 0 struct smiley_list *list; if (!current_smiley_theme) return; @@ -147,6 +149,7 @@ static void _pidgin_themes_smiley_themeize(GtkWidget *imhtml, gboolean custom) list = list->next; } +#endif /* if 0 */ } void pidgin_themes_smiley_themeize(GtkWidget *imhtml) @@ -278,6 +281,8 @@ void pidgin_themes_load_smiley_theme(const char *file, gboolean load) if (*i == '[' && strchr(i, ']') && load) { struct smiley_list *child = g_new0(struct smiley_list, 1); child->sml = g_strndup(i+1, strchr(i, ']') - i - 1); + child->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + if (theme->list) list->next = child; else @@ -320,6 +325,7 @@ void pidgin_themes_load_smiley_theme(const char *file, gboolean load) } else { GtkIMHtmlSmiley *smiley = gtk_imhtml_smiley_create(sfile, l, hidden, 0); list->smileys = g_slist_prepend(list->smileys, smiley); + g_hash_table_insert (list->files, g_strdup(l), g_strdup(sfile)); } while (isspace(*i)) i++; @@ -358,7 +364,6 @@ void pidgin_themes_load_smiley_theme(const char *file, gboolean load) if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { /* We want to see our custom smileys on our entry if we write the shortcut */ - pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml); pidgin_themes_smiley_themeize_custom(PIDGIN_CONVERSATION(conv)->entry); } } diff --git a/pidgin/gtkthemes.h b/pidgin/gtkthemes.h index 138edbbeb0..7d739f8e1b 100644 --- a/pidgin/gtkthemes.h +++ b/pidgin/gtkthemes.h @@ -29,6 +29,7 @@ struct smiley_list { char *sml; GSList *smileys; + GHashTable *files; /**< map from smiley shortcut to filename */ struct smiley_list *next; }; @@ -51,18 +52,12 @@ gboolean pidgin_themes_smileys_disabled(void); void pidgin_themes_smiley_themeize(GtkWidget *); -/** - * @since 2.5.0 - */ void pidgin_themes_smiley_themeize_custom(GtkWidget *); void pidgin_themes_smiley_theme_probe(void); void pidgin_themes_load_smiley_theme(const char *file, gboolean load); -/** - * @since 2.1.0 - */ void pidgin_themes_remove_smiley_theme(const char *file); GSList *pidgin_themes_get_proto_smileys(const char *id); diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 6e84b08356..1a7d6ffef9 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -67,8 +67,14 @@ #include "pidginstock.h" #include "gtkthemes.h" #include "gtkutils.h" +#include "gtkwebview.h" #include "pidgin/minidialog.h" +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) +#define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE(x) +#endif + typedef struct { GtkTreeModel *model; gint default_item; @@ -180,6 +186,7 @@ pidgin_create_dialog(const char *title, guint border_width, const char *role, gb wnd = GTK_WINDOW(gtk_dialog_new()); pidgin_window_init(wnd, title, border_width, role, resizable); + g_object_set(G_OBJECT(wnd), "has-separator", FALSE, NULL); return GTK_WIDGET(wnd); } @@ -187,7 +194,7 @@ pidgin_create_dialog(const char *title, guint border_width, const char *role, gb GtkWidget * pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing) { - GtkBox *vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); + GtkBox *vbox = GTK_BOX(GTK_DIALOG(dialog)->vbox); gtk_box_set_homogeneous(vbox, homogeneous); gtk_box_set_spacing(vbox, spacing); return GTK_WIDGET(vbox); @@ -195,12 +202,12 @@ pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog) { - return gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + return GTK_DIALOG(dialog)->vbox; } GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog) { - return gtk_dialog_get_action_area(GTK_DIALOG(dialog)); + return GTK_DIALOG(dialog)->action_area; } GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label, @@ -275,6 +282,69 @@ pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **tool return frame; } +GtkWidget * +pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret) +{ + GtkWidget *frame; + GtkWidget *webview; + GtkWidget *sep; + GtkWidget *sw; + GtkWidget *toolbar = NULL; + GtkWidget *vbox; + + frame = gtk_frame_new(NULL); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(frame), vbox); + gtk_widget_show(vbox); + + if (editable) { + toolbar = gtk_imhtmltoolbar_new(); + gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); + gtk_widget_show(toolbar); + + sep = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); + g_signal_connect_swapped(G_OBJECT(toolbar), "show", G_CALLBACK(gtk_widget_show), sep); + g_signal_connect_swapped(G_OBJECT(toolbar), "hide", G_CALLBACK(gtk_widget_hide), sep); + gtk_widget_show(sep); + } + + webview = gtk_webview_new(); +#if 0 + /* TODO WEBKIT: Don't have editable webview yet. */ + gtk_webview_set_editable(GTK_WEBVIEW(webview), editable); +#endif /* if 0 */ +#ifdef USE_GTKSPELL + if (editable && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck")) + pidgin_setup_gtkspell(GTK_TEXT_VIEW(webview)); +#endif + gtk_widget_show(webview); + + if (editable) { + gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(toolbar), webview); + gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(toolbar), "default"); + } + + sw = pidgin_make_scrollable(webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1); + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); + + gtk_webview_set_vadjustment(GTK_WEBVIEW(webview), + gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw))); + + if (webview_ret != NULL) + *webview_ret = webview; + + if (editable && (toolbar_ret != NULL)) + *toolbar_ret = toolbar; + + if (sw_ret != NULL) + *sw_ret = sw; + + return frame; +} + void pidgin_set_sensitive_if_input(GtkWidget *entry, GtkWidget *dialog) { @@ -291,7 +361,7 @@ pidgin_toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) if (to_toggle == NULL) return; - sensitivity = gtk_widget_get_sensitive(to_toggle); + sensitivity = gtk_widget_is_sensitive(to_toggle); gtk_widget_set_sensitive(to_toggle, !sensitivity); } @@ -308,7 +378,7 @@ pidgin_toggle_sensitive_array(GtkWidget *w, GPtrArray *data) if (element == NULL) continue; - sensitivity = gtk_widget_get_sensitive(element); + sensitivity = gtk_widget_is_sensitive(element); gtk_widget_set_sensitive(element, !sensitivity); } @@ -676,6 +746,7 @@ create_protocols_menu(const char *default_proto_id) if (facebook_name && strcmp(facebook_name, plugin->info->name) < 0) { char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "16", "facebook.png", NULL); + pixbuf = pidgin_pixbuf_new_from_file(filename); g_free(filename); @@ -952,7 +1023,7 @@ void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, return; } - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(conn->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(conn)); if (prpl_info != NULL && prpl_info->get_cb_real_name) who = prpl_info->get_cb_real_name(conn, chat, name); if (prpl_info == NULL || prpl_info->get_cb_info == NULL) { @@ -1078,7 +1149,7 @@ pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts, gc = (PurpleConnection *)l->data; account = purple_connection_get_account(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); } protoname = prpl_info->list_icon(account, NULL); @@ -1120,7 +1191,7 @@ pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts, gc = (PurpleConnection *)l->data; account = purple_connection_get_account(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); } protoname = prpl_info->list_icon(account, NULL); @@ -1223,8 +1294,8 @@ pidgin_menu_position_func_helper(GtkMenu *menu, widget = GTK_WIDGET(menu); screen = gtk_widget_get_screen(widget); - xthickness = gtk_widget_get_style(widget)->xthickness; - ythickness = gtk_widget_get_style(widget)->ythickness; + xthickness = widget->style->xthickness; + ythickness = widget->style->ythickness; rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL); /* @@ -1362,9 +1433,9 @@ pidgin_treeview_popup_menu_position_func(GtkMenu *menu, GtkTreePath *path; GtkTreeViewColumn *col; GdkRectangle rect; - gint ythickness = gtk_widget_get_style(GTK_WIDGET(menu))->ythickness; + gint ythickness = GTK_WIDGET(menu)->style->ythickness; - gdk_window_get_origin (gtk_widget_get_window(widget), x, y); + gdk_window_get_origin (widget->window, x, y); gtk_tree_view_get_cursor (tv, &path, &col); gtk_tree_view_get_cell_area (tv, path, col, &rect); @@ -1481,7 +1552,7 @@ void pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char *who) { GdkPixbuf *pb; - GList *files = purple_uri_list_extract_filenames((const gchar *) gtk_selection_data_get_data(sd)); + GList *files = purple_uri_list_extract_filenames((const gchar *)sd->data); PurpleConnection *gc = purple_account_get_connection(account); PurplePluginProtocolInfo *prpl_info = NULL; #ifndef _WIN32 @@ -1532,7 +1603,7 @@ pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char data->account = account; if (gc) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); if (prpl_info && prpl_info->options & OPT_PROTO_IM_IMAGE) im = TRUE; @@ -1763,21 +1834,27 @@ pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, gpointer object) { GtkWidget *menuitem; + GList *list; if (act == NULL) { return pidgin_separator(menu); } - if (act->children == NULL) { - menuitem = gtk_menu_item_new_with_mnemonic(act->label); + list = purple_menu_action_get_children(act); + menuitem = gtk_menu_item_new_with_mnemonic(purple_menu_action_get_label(act)); + + if (list == NULL) { + PurpleCallback callback; + + callback = purple_menu_action_get_callback(act); - if (act->callback != NULL) { + if (callback != NULL) { g_object_set_data(G_OBJECT(menuitem), "purplecallback", - act->callback); + callback); g_object_set_data(G_OBJECT(menuitem), "purplecallbackdata", - act->data); + purple_menu_action_get_data(act)); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menu_action_cb), object); @@ -1791,7 +1868,6 @@ pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, GtkWidget *submenu = NULL; GtkAccelGroup *group; - menuitem = gtk_menu_item_new_with_mnemonic(act->label); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); submenu = gtk_menu_new(); @@ -1799,21 +1875,20 @@ pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, group = gtk_menu_get_accel_group(GTK_MENU(menu)); if (group) { - char *path = g_strdup_printf("%s/%s", - gtk_menu_item_get_accel_path(GTK_MENU_ITEM(menuitem)), - act->label); + char *path = g_strdup_printf("%s/%s", GTK_MENU_ITEM(menuitem)->accel_path, + purple_menu_action_get_label(act)); gtk_menu_set_accel_path(GTK_MENU(submenu), path); g_free(path); gtk_menu_set_accel_group(GTK_MENU(submenu), group); } - for (l = act->children; l; l = l->next) { + for (l = list; l; l = l->next) { PurpleMenuAction *act = (PurpleMenuAction *)l->data; pidgin_append_menu_action(submenu, act, object); } - g_list_free(act->children); - act->children = NULL; + g_list_free(list); + purple_menu_action_set_children(act, NULL); } purple_menu_action_free(act); return menuitem; @@ -2013,8 +2088,8 @@ add_completion_list(PidginCompletionData *data) add_buddyname_autocomplete_entry(data->store, ((PurpleContact *)cnode)->alias, purple_buddy_get_contact_alias(entry.entry.buddy), - entry.entry.buddy->account, - entry.entry.buddy->name + purple_buddy_get_account(entry.entry.buddy), + purple_buddy_get_name(entry.entry.buddy) ); } } @@ -2106,7 +2181,7 @@ pidgin_screenname_autocomplete_default_filter(const PidginBuddyCompletionEntry * gboolean all = GPOINTER_TO_INT(all_accounts); if (completion_entry->is_buddy) { - return all || purple_account_is_connected(completion_entry->entry.buddy->account); + return all || purple_account_is_connected(purple_buddy_get_account(completion_entry->entry.buddy)); } else { return all || (completion_entry->entry.logged_buddy->account != NULL && purple_account_is_connected(completion_entry->entry.logged_buddy->account)); } @@ -2117,23 +2192,23 @@ void pidgin_set_cursor(GtkWidget *widget, GdkCursorType cursor_type) GdkCursor *cursor; g_return_if_fail(widget != NULL); - if (gtk_widget_get_window(widget) == NULL) + if (widget->window == NULL) return; cursor = gdk_cursor_new(cursor_type); - gdk_window_set_cursor(gtk_widget_get_window(widget), cursor); + gdk_window_set_cursor(widget->window, cursor); gdk_cursor_unref(cursor); - gdk_display_flush(gdk_window_get_display(gtk_widget_get_window(widget))); + gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); } void pidgin_clear_cursor(GtkWidget *widget) { g_return_if_fail(widget != NULL); - if (gtk_widget_get_window(widget) == NULL) + if (widget->window == NULL) return; - gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); + gdk_window_set_cursor(widget->window, NULL); } struct _icon_chooser { @@ -2174,7 +2249,7 @@ icon_filesel_choose_cb(GtkWidget *widget, gint response, struct _icon_chooser *d gtk_widget_destroy(dialog->icon_filesel); g_free(filename); g_free(dialog); -} + } static void @@ -2412,9 +2487,9 @@ pidgin_convert_buddy_icon(PurplePlugin *plugin, const char *path, size_t *len) the image. */ purple_debug_info("buddyicon", "Converted image from " "%dx%d to %dx%d, format=%s, quality=%u, " - "filesize=%zu\n", orig_width, orig_height, - new_width, new_height, prpl_formats[i], quality, - length); + "filesize=%" G_GSIZE_FORMAT "\n", + orig_width, orig_height, new_width, new_height, + prpl_formats[i], quality, length); if (len) *len = length; g_strfreev(prpl_formats); @@ -2793,7 +2868,7 @@ const char *pidgin_get_dim_grey_string(GtkWidget *widget) { if (!widget) return "dim grey"; - style = gtk_widget_get_style(widget); + style = gtk_widget_get_style(widget); if (!style) return "dim grey"; @@ -2805,18 +2880,18 @@ const char *pidgin_get_dim_grey_string(GtkWidget *widget) { } static void -combo_box_changed_cb(GtkComboBoxText *combo_box, GtkEntry *entry) +combo_box_changed_cb(GtkComboBox *combo_box, GtkEntry *entry) { - char *text = gtk_combo_box_text_get_active_text(combo_box); + char *text = gtk_combo_box_get_active_text(combo_box); gtk_entry_set_text(entry, text ? text : ""); g_free(text); } static gboolean -entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *key, GtkComboBoxText *combo) +entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *key, GtkComboBox *combo) { - if (key->keyval == GDK_KEY_Down || key->keyval == GDK_KEY_Up) { - gtk_combo_box_popup(GTK_COMBO_BOX(combo)); + if (key->keyval == GDK_Down || key->keyval == GDK_Up) { + gtk_combo_box_popup(combo); return TRUE; } return FALSE; @@ -2825,10 +2900,10 @@ entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *key, GtkComboBoxText *combo) GtkWidget * pidgin_text_combo_box_entry_new(const char *default_item, GList *items) { - GtkComboBoxText *ret = NULL; + GtkComboBox *ret = NULL; GtkWidget *the_entry = NULL; - ret = GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new_with_entry()); + ret = GTK_COMBO_BOX(gtk_combo_box_entry_new_text()); the_entry = gtk_entry_new(); gtk_container_add(GTK_CONTAINER(ret), the_entry); @@ -2838,7 +2913,7 @@ pidgin_text_combo_box_entry_new(const char *default_item, GList *items) for (; items != NULL ; items = items->next) { char *text = items->data; if (text && *text) - gtk_combo_box_text_append_text(ret, text); + gtk_combo_box_append_text(ret, text); } g_signal_connect(G_OBJECT(ret), "changed", (GCallback)combo_box_changed_cb, the_entry); @@ -2849,12 +2924,12 @@ pidgin_text_combo_box_entry_new(const char *default_item, GList *items) const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget) { - return gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((widget))))); + return gtk_entry_get_text(GTK_ENTRY(GTK_BIN((widget))->child)); } void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text) { - gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((widget)))), (text)); + gtk_entry_set_text(GTK_ENTRY(GTK_BIN((widget))->child), (text)); } GtkWidget * @@ -2921,7 +2996,7 @@ gboolean pidgin_auto_parent_window(GtkWidget *widget) windows = g_list_delete_link(windows, windows); if (window == widget || - !GTK_WIDGET_VISIBLE(window)) + !gtk_widget_get_visible(window)) continue; if (!gdk_property_get(window->window, _WindowTime, _Cardinal, 0, sizeof(time_t), FALSE, @@ -2980,7 +3055,7 @@ gboolean pidgin_auto_parent_window(GtkWidget *widget) } if (gtk_window_has_toplevel_focus(GTK_WINDOW(window)) || - (menu && menu == gtk_widget_get_window(window))) { + (menu && menu == window->window)) { parent = window; break; } @@ -3005,7 +3080,7 @@ static GObject *pidgin_pixbuf_from_data_helper(const guchar *buf, gsize count, g if (!gdk_pixbuf_loader_write(loader, buf, count, &error) || error) { purple_debug_warning("gtkutils", "gdk_pixbuf_loader_write() " - "failed with size=%zu: %s\n", count, + "failed with size=%" G_GSIZE_FORMAT ": %s\n", count, error ? error->message : "(no error message)"); if (error) g_error_free(error); @@ -3015,7 +3090,7 @@ static GObject *pidgin_pixbuf_from_data_helper(const guchar *buf, gsize count, g if (!gdk_pixbuf_loader_close(loader, &error) || error) { purple_debug_warning("gtkutils", "gdk_pixbuf_loader_close() " - "failed for image of size %zu: %s\n", count, + "failed for image of size %" G_GSIZE_FORMAT ": %s\n", count, error ? error->message : "(no error message)"); if (error) g_error_free(error); @@ -3029,7 +3104,7 @@ static GObject *pidgin_pixbuf_from_data_helper(const guchar *buf, gsize count, g pixbuf = G_OBJECT(gdk_pixbuf_loader_get_pixbuf(loader)); if (!pixbuf) { purple_debug_warning("gtkutils", "%s() returned NULL for image " - "of size %zu\n", + "of size %" G_GSIZE_FORMAT "\n", animated ? "gdk_pixbuf_loader_get_animation" : "gdk_pixbuf_loader_get_pixbuf", count); g_object_unref(G_OBJECT(loader)); @@ -3195,9 +3270,9 @@ file_open_uri(GtkIMHtml *imhtml, const char *uri) { gchar *escaped = g_shell_quote(uri); gchar *param = g_strconcat("/select,\"", uri, "\"", NULL); - gchar *wc_param = g_utf8_to_utf16(param, -1, NULL, NULL, NULL); + wchar_t *wc_param = g_utf8_to_utf16(param, -1, NULL, NULL, NULL); - code = (int)ShellExecuteW(NULL, "OPEN", L"explorer.exe", wc_param, NULL, SW_NORMAL); + code = (int)ShellExecuteW(NULL, L"OPEN", L"explorer.exe", wc_param, NULL, SW_NORMAL); g_free(wc_param); g_free(param); @@ -3359,7 +3434,7 @@ save_file_cb(GtkWidget *item, const char *url) return TRUE; purple_request_file(conv->active_conv, _("Save File"), NULL, TRUE, G_CALLBACK(savefile_write_cb), NULL, - conv->active_conv->account, NULL, conv->active_conv, + purple_conversation_get_account(conv->active_conv), NULL, conv->active_conv, (void *)url); return TRUE; } @@ -3541,7 +3616,7 @@ pidgin_make_scrollable(GtkWidget *child, GtkPolicyType hscrollbar_policy, GtkPol if (width != -1 || height != -1) gtk_widget_set_size_request(sw, width, height); if (child) { - if (GTK_IS_SCROLLABLE(child)) + if (GTK_WIDGET_GET_CLASS(child)->set_scroll_adjustments_signal) gtk_container_add(GTK_CONTAINER(sw), child); else gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), child); @@ -3616,4 +3691,3 @@ void pidgin_utils_uninit(void) gtk_imhtml_class_register_protocol("mailto:", NULL, NULL); gtk_imhtml_class_register_protocol("gopher://", NULL, NULL); } - diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h index 7ea8563151..84456a7ad7 100644 --- a/pidgin/gtkutils.h +++ b/pidgin/gtkutils.h @@ -108,13 +108,35 @@ void pidgin_setup_imhtml(GtkWidget *imhtml); */ GtkWidget *pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret); +/** + * Create an GtkWebView widget and associated GtkIMHtmlToolbar widget. This + * function puts both widgets in a nice GtkFrame. They're separated by an + * attractive GtkSeparator. + * TODO WEBKIT: editable isn't supported yet + * + * @param editable @c TRUE if this webview should be editable. If this is + * @c FALSE, then the toolbar will NOT be created. If this webview + * should be read-only at first, but may become editable later, then + * pass in @c TRUE here and then manually call gtk_webview_set_editable() + * later. + * @param webview_ret A pointer to a pointer to a GtkWidget. This pointer + * will be set to the webview when this function exits. + * @param toolbar_ret A pointer to a pointer to a GtkWidget. If editable is + * TRUE then this will be set to the toolbar when this function exits. + * Otherwise this will be set to @c NULL. + * @param sw_ret This will be filled with a pointer to the scrolled window + * widget which contains the webview. + * + * @return The GtkFrame containing the toolbar and webview. + */ +GtkWidget *pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret); + /** * Creates a small button * * @param image A button image. * * @return A GtkButton created from the image. - * @since 2.7.0 */ GtkWidget *pidgin_create_small_button(GtkWidget *image); @@ -125,8 +147,6 @@ GtkWidget *pidgin_create_small_button(GtkWidget *image); * @param border_width The window's desired border width * @param role A string indicating what the window is responsible for doing, or @c NULL * @param resizable Whether the window should be resizable (@c TRUE) or not (@c FALSE) - * - * @since 2.1.0 */ GtkWidget *pidgin_create_window(const char *title, guint border_width, const char *role, gboolean resizable); @@ -137,8 +157,6 @@ GtkWidget *pidgin_create_window(const char *title, guint border_width, const cha * @param border_width The window's desired border width * @param role A string indicating what the window is responsible for doing, or @c NULL * @param resizable Whether the window should be resizable (@c TRUE) or not (@c FALSE) - * - * @since 2.4.0 */ GtkWidget *pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable); @@ -148,8 +166,6 @@ GtkWidget *pidgin_create_dialog(const char *title, guint border_width, const cha * @param dialog The dialog window * @param homogeneous TRUE if all children are to be given equal space allotments. * @param spacing the number of pixels to place by default between children - * - * @since 2.4.0 */ GtkWidget *pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing); @@ -157,8 +173,6 @@ GtkWidget *pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean ho * Retrieves the main content box (vbox) from a pidgin dialog window * * @param dialog The dialog window - * - * @since 2.4.0 */ GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog); @@ -171,7 +185,6 @@ GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog); * @param callbackdata The user data for the callback function * * @return The created button. - * @since 2.4.0 */ GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label, GCallback callback, gpointer callbackdata); @@ -180,8 +193,6 @@ GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label, * Retrieves the action area (button box) from a pidgin dialog window * * @param dialog The dialog window - * - * @since 2.4.0 */ GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog); @@ -415,8 +426,6 @@ void pidgin_load_accels(void); * * @param conn The connection to get information from. * @param name The user to get information about. - * - * @since 2.1.0 */ void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name); @@ -426,8 +435,6 @@ void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name); * @param conn The connection to get information from. * @param name The user to get information about. * @param chatid The chat id. - * - * @since 2.1.0 */ void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, int chatid); @@ -466,8 +473,6 @@ void pidgin_set_accessible_label(GtkWidget *w, GtkWidget *l); * * @param w The widget that we want to label. * @param l A GtkLabel that we want to use as the label for the widget. - * - * @since 2.2.0 */ void pidgin_set_accessible_relations(GtkWidget *w, GtkWidget *l); @@ -482,8 +487,6 @@ void pidgin_set_accessible_relations(GtkWidget *w, GtkWidget *l); * where the menu shall be drawn. This is an output parameter. * @param push_in This is an output parameter? * @param data Not used by this particular position function. - * - * @since 2.1.0 */ void pidgin_menu_position_func_helper(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data); @@ -555,8 +558,6 @@ GdkPixbuf * pidgin_create_status_icon(PurpleStatusPrimitive primitive, GtkWidget * @param prim The status primitive * * @return The stock-id - * - * @since 2.6.0 */ const char *pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim); @@ -566,8 +567,6 @@ const char *pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim); * @param presence The presence. * * @return The stock-id - * - * @since 2.6.0 */ const char *pidgin_stock_id_from_presence(PurplePresence *presence); @@ -735,8 +734,6 @@ const char *pidgin_get_dim_grey_string(GtkWidget *widget); * * @return A newly created text GtkComboBox containing a GtkEntry * child. - * - * @since 2.2.0 */ GtkWidget *pidgin_text_combo_box_entry_new(const char *default_item, GList *items); @@ -746,8 +743,6 @@ GtkWidget *pidgin_text_combo_box_entry_new(const char *default_item, GList *item * @param widget The simple text GtkComboBoxEntry equivalent widget * * @return The text in the widget's entry. It must not be freed - * - * @since 2.2.0 */ const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget); @@ -756,8 +751,6 @@ const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget); * * @param widget The simple text GtkComboBoxEntry equivalent widget * @param text The text to set - * - * @since 2.2.0 */ void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text); @@ -767,8 +760,6 @@ void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text); * @param window The window to make transient. * * @return Whether the window was made transient or not. - * - * @since 2.4.0 */ gboolean pidgin_auto_parent_window(GtkWidget *window); @@ -783,7 +774,6 @@ gboolean pidgin_auto_parent_window(GtkWidget *window); * @param p_label Place to store a pointer to the GtkLabel, or @c NULL if you don't care. * * @return A GtkHBox already added to the GtkVBox containing the GtkLabel and the GtkWidget. - * @since 2.4.0 */ GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label); @@ -795,8 +785,6 @@ GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, Gtk * * @return A GdkPixbuf created from the image data, or NULL if * there was an error parsing the data. - * - * @since 2.9.0 */ GdkPixbuf *pidgin_pixbuf_from_data(const guchar *buf, gsize count); @@ -808,8 +796,6 @@ GdkPixbuf *pidgin_pixbuf_from_data(const guchar *buf, gsize count); * * @return A GdkPixbufAnimation created from the image data, or NULL if * there was an error parsing the data. - * - * @since 2.9.0 */ GdkPixbufAnimation *pidgin_pixbuf_anim_from_data(const guchar *buf, gsize count); @@ -819,8 +805,6 @@ GdkPixbufAnimation *pidgin_pixbuf_anim_from_data(const guchar *buf, gsize count) * @param image A PurpleStoredImage. * * @return A GdkPixbuf created from the stored image. - * - * @since 2.5.0 */ GdkPixbuf *pidgin_pixbuf_from_imgstore(PurpleStoredImage *image); @@ -844,8 +828,6 @@ GdkPixbuf *pidgin_pixbuf_from_imgstore(PurpleStoredImage *image); * * @return The GdkPixbuf if successful. Otherwise NULL is returned and * a warning is logged. - * - * @since 2.9.0 */ GdkPixbuf *pidgin_pixbuf_new_from_file(const char *filename); @@ -871,8 +853,6 @@ GdkPixbuf *pidgin_pixbuf_new_from_file(const char *filename); * * @return The GdkPixbuf if successful. Otherwise NULL is returned and * a warning is logged. - * - * @since 2.9.0 */ GdkPixbuf *pidgin_pixbuf_new_from_file_at_size(const char *filename, int width, int height); @@ -899,35 +879,27 @@ GdkPixbuf *pidgin_pixbuf_new_from_file_at_size(const char *filename, int width, * * @return The GdkPixbuf if successful. Otherwise NULL is returned and * a warning is logged. - * - * @since 2.9.0 */ GdkPixbuf *pidgin_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, gboolean preserve_aspect_ratio); /** * Add scrollbars to a widget - * @param widget The child widget - * @hscrollbar_policy Horizontal scrolling policy - * @vscrollbar_policy Vertical scrolling policy - * @shadow Shadow type - * @width Desired widget width, or -1 for default - * @height Desired widget height, or -1 for default - * - * @since 2.8.0 + * @param child The child widget + * @param hscrollbar_policy Horizontal scrolling policy + * @param vscrollbar_policy Vertical scrolling policy + * @param shadow_type Shadow type + * @param width Desired widget width, or -1 for default + * @param height Desired widget height, or -1 for default */ GtkWidget *pidgin_make_scrollable(GtkWidget *child, GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, GtkShadowType shadow_type, int width, int height); /** * Initialize some utility functions. - * - * @since 2.6.0 */ void pidgin_utils_init(void); /** * Uninitialize some utility functions. - * - * @since 2.6.0 */ void pidgin_utils_uninit(void); diff --git a/pidgin/gtkwhiteboard.c b/pidgin/gtkwhiteboard.c index 5f7d51404d..0975481202 100644 --- a/pidgin/gtkwhiteboard.c +++ b/pidgin/gtkwhiteboard.c @@ -125,7 +125,7 @@ static void pidgin_whiteboard_create(PurpleWhiteboard *wb) PidginWhiteboard *gtkwb = g_new0(PidginWhiteboard, 1); gtkwb->wb = wb; - wb->ui_data = gtkwb; + purple_whiteboard_set_ui_data(wb, gtkwb); /* Get dimensions (default?) for the whiteboard canvas */ if (!purple_whiteboard_get_dimensions(wb, >kwb->width, >kwb->height)) @@ -145,11 +145,11 @@ static void pidgin_whiteboard_create(PurpleWhiteboard *wb) /* Try and set window title as the name of the buddy, else just use their * username */ - buddy = purple_find_buddy(wb->account, wb->who); + buddy = purple_find_buddy(purple_whiteboard_get_account(wb), purple_whiteboard_get_who(wb)); - window = pidgin_create_window(buddy != NULL ? purple_buddy_get_contact_alias(buddy) : wb->who, 0, NULL, FALSE); + window = pidgin_create_window(buddy != NULL ? purple_buddy_get_contact_alias(buddy) : purple_whiteboard_get_who(wb), 0, NULL, FALSE); gtkwb->window = window; - gtk_widget_set_name(window, wb->who); + gtk_widget_set_name(window, purple_whiteboard_get_who(wb)); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(whiteboard_close_cb), gtkwb); @@ -274,19 +274,19 @@ static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb) GtkWidget *colour_dialog; g_return_if_fail(wb != NULL); - gtkwb = wb->ui_data; + gtkwb = purple_whiteboard_get_ui_data(wb); g_return_if_fail(gtkwb != NULL); /* TODO Ask if user wants to save picture before the session is closed */ /* Clear graphical memory */ - if(gtkwb->pixbuf) + if(gtkwb->pixmap) { - cairo_t *cr = g_object_get_data(G_OBJECT(gtkwb->pixbuf), "cairo-context"); + cairo_t *cr = g_object_get_data(G_OBJECT(gtkwb->pixmap), "cairo-context"); if (cr) cairo_destroy(cr); - g_object_unref(gtkwb->pixbuf); - gtkwb->pixbuf = NULL; + g_object_unref(gtkwb->pixmap); + gtkwb->pixmap = NULL; } colour_dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog"); @@ -301,7 +301,7 @@ static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb) gtkwb->window = NULL; } g_free(gtkwb); - wb->ui_data = NULL; + purple_whiteboard_set_ui_data(wb, NULL); } static gboolean whiteboard_close_cb(GtkWidget *widget, GdkEvent *event, PidginWhiteboard *gtkwb) @@ -356,32 +356,28 @@ static void pidginwhiteboard_button_start_press(GtkButton *button, gpointer data static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; - GdkPixbuf *pixbuf = gtkwb->pixbuf; + GdkPixmap *pixmap = gtkwb->pixmap; cairo_t *cr; - GdkWindow *window = gtk_widget_get_window(widget); - GtkAllocation allocation; - if (pixbuf) { - cr = g_object_get_data(G_OBJECT(pixbuf), "cairo-context"); + if (pixmap) { + cr = g_object_get_data(G_OBJECT(pixmap), "cairo-context"); if (cr) cairo_destroy(cr); - g_object_unref(pixbuf); + g_object_unref(pixmap); } - gtk_widget_get_allocation(widget, &allocation); + pixmap = gdk_pixmap_new(widget->window, + widget->allocation.width, + widget->allocation.height, + -1); + gtkwb->pixmap = pixmap; - pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, - FALSE, gdk_visual_get_depth(GDK_VISUAL(window)), - allocation.width, allocation.height); - - gtkwb->pixbuf = pixbuf; - - cr = gdk_cairo_create(gtk_widget_get_window(widget)); - g_object_set_data(G_OBJECT(pixbuf), "cairo-context", cr); - gdk_cairo_set_source_color(cr, >k_widget_get_style(widget)->white); + cr = gdk_cairo_create(GDK_DRAWABLE(pixmap)); + g_object_set_data(G_OBJECT(pixmap), "cairo-context", cr); + gdk_cairo_set_source_color(cr, &widget->style->white); cairo_rectangle(cr, 0, 0, - allocation.width, allocation.height); + widget->allocation.width, widget->allocation.height); cairo_fill(cr); return TRUE; @@ -390,11 +386,11 @@ static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventCon static gboolean pidgin_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); - GdkPixbuf *pixbuf = gtkwb->pixbuf; + GdkPixmap *pixmap = gtkwb->pixmap; cairo_t *cr; - cr = gdk_cairo_create(gtk_widget_get_window(widget)); - gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); + cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); + gdk_cairo_set_source_pixmap(cr, pixmap, 0, 0); cairo_rectangle(cr, event->area.x, event->area.y, event->area.width, event->area.height); @@ -407,10 +403,10 @@ static gboolean pidgin_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton *event, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; - GdkPixbuf *pixbuf = gtkwb->pixbuf; + GdkPixmap *pixmap = gtkwb->pixmap; PurpleWhiteboard *wb = gtkwb->wb; - GList *draw_list = wb->draw_list; + GList *draw_list = purple_whiteboard_get_draw_list(wb); if(BrushState != BRUSH_STATE_UP) { @@ -422,7 +418,7 @@ static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton * BrushState = BRUSH_STATE_DOWN; - if(event->button == 1 && pixbuf != NULL) + if(event->button == 1 && pixmap != NULL) { /* Check if draw_list has contents; if so, clear it */ if(draw_list) @@ -445,7 +441,7 @@ static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton * gtkwb->brush_color, gtkwb->brush_size); } - wb->draw_list = draw_list; + purple_whiteboard_set_draw_list(wb, draw_list); return TRUE; } @@ -460,10 +456,10 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion GdkModifierType state; PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; - GdkPixbuf *pixbuf = gtkwb->pixbuf; + GdkPixmap *pixmap = gtkwb->pixmap; PurpleWhiteboard *wb = gtkwb->wb; - GList *draw_list = wb->draw_list; + GList *draw_list = purple_whiteboard_get_draw_list(wb); if(event->is_hint) gdk_window_get_pointer(event->window, &x, &y, &state); @@ -474,7 +470,7 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion state = event->state; } - if(state & GDK_BUTTON1_MASK && pixbuf != NULL) + if(state & GDK_BUTTON1_MASK && pixmap != NULL) { if((BrushState != BRUSH_STATE_DOWN) && (BrushState != BRUSH_STATE_MOTION)) { @@ -532,7 +528,7 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion LastY = y; } - wb->draw_list = draw_list; + purple_whiteboard_set_draw_list(wb, draw_list); return TRUE; } @@ -540,10 +536,10 @@ static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *event, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; - GdkPixbuf *pixbuf = gtkwb->pixbuf; + GdkPixmap *pixmap = gtkwb->pixmap; PurpleWhiteboard *wb = gtkwb->wb; - GList *draw_list = wb->draw_list; + GList *draw_list = purple_whiteboard_get_draw_list(wb); if((BrushState != BRUSH_STATE_DOWN) && (BrushState != BRUSH_STATE_MOTION)) { @@ -555,7 +551,7 @@ static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *ev } BrushState = BRUSH_STATE_UP; - if(event->button == 1 && pixbuf != NULL) + if(event->button == 1 && pixmap != NULL) { /* If the brush was never moved, express two sets of two deltas That's a * 'point,' but not for Yahoo! @@ -587,7 +583,7 @@ static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *ev if(draw_list) purple_whiteboard_draw_list_destroy(draw_list); - wb->draw_list = NULL; + purple_whiteboard_set_draw_list(wb, NULL); } return TRUE; @@ -595,11 +591,11 @@ static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *ev static void pidgin_whiteboard_draw_brush_point(PurpleWhiteboard *wb, int x, int y, int color, int size) { - PidginWhiteboard *gtkwb = wb->ui_data; + PidginWhiteboard *gtkwb = purple_whiteboard_get_ui_data(wb); GtkWidget *widget = gtkwb->drawing_area; - GdkPixbuf *pixbuf = gtkwb->pixbuf; + GdkPixmap *pixmap = gtkwb->pixmap; - cairo_t *gfx_con = g_object_get_data(G_OBJECT(pixbuf), "cairo-context"); + cairo_t *gfx_con = g_object_get_data(G_OBJECT(pixmap), "cairo-context"); GdkColor col; /* Interpret and convert color */ @@ -688,7 +684,7 @@ static void pidgin_whiteboard_draw_brush_line(PurpleWhiteboard *wb, int x0, int static void pidgin_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, int height) { - PidginWhiteboard *gtkwb = wb->ui_data; + PidginWhiteboard *gtkwb = purple_whiteboard_get_ui_data(wb); gtkwb->width = width; gtkwb->height = height; @@ -696,7 +692,7 @@ static void pidgin_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, in static void pidgin_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color) { - PidginWhiteboard *gtkwb = wb->ui_data; + PidginWhiteboard *gtkwb = purple_whiteboard_get_ui_data(wb); gtkwb->brush_size = size; gtkwb->brush_color = color; @@ -704,25 +700,22 @@ static void pidgin_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int colo static void pidgin_whiteboard_clear(PurpleWhiteboard *wb) { - PidginWhiteboard *gtkwb = wb->ui_data; - GdkPixbuf *pixbuf = gtkwb->pixbuf; + PidginWhiteboard *gtkwb = purple_whiteboard_get_ui_data(wb); + GdkPixmap *pixmap = gtkwb->pixmap; GtkWidget *drawing_area = gtkwb->drawing_area; - cairo_t *cr = g_object_get_data(G_OBJECT(pixbuf), "cairo-context"); - GtkAllocation allocation; - - gtk_widget_get_allocation(drawing_area, &allocation); + cairo_t *cr = g_object_get_data(G_OBJECT(pixmap), "cairo-context"); - gdk_cairo_set_source_color(cr, >k_widget_get_style(drawing_area)->white); + gdk_cairo_set_source_color(cr, &drawing_area->style->white); cairo_rectangle(cr, 0, 0, - allocation.width, - allocation.height); + drawing_area->allocation.width, + drawing_area->allocation.height); cairo_fill(cr); gtk_widget_queue_draw_area(drawing_area, 0, 0, - allocation.width, - allocation.height); + drawing_area->allocation.width, + drawing_area->allocation.height); } static void pidgin_whiteboard_button_clear_press(GtkWidget *widget, gpointer data) @@ -788,15 +781,12 @@ static void pidgin_whiteboard_button_save_press(GtkWidget *widget, gpointer data gtk_widget_destroy(dialog); /* Makes an icon from the whiteboard's canvas 'image' */ - pixbuf = gtkwb->pixbuf; -/* pixbuf = gdk_pixbuf_get_from_drawable(NULL, (GdkDrawable*)(gtkwb->pixmap), gdk_drawable_get_colormap(gtkwb->pixmap), 0, 0, 0, 0, gtkwb->width, gtkwb->height); -*/ if(gdk_pixbuf_save(pixbuf, filename, "jpeg", NULL, "quality", "100", NULL)) purple_debug_info("gtkwhiteboard", "File Saved...\n"); @@ -817,15 +807,12 @@ static void pidgin_whiteboard_set_canvas_as_icon(PidginWhiteboard *gtkwb) GdkPixbuf *pixbuf; /* Makes an icon from the whiteboard's canvas 'image' */ - pixbuf = gtkwb->pixbuf; -/* pixbuf = gdk_pixbuf_get_from_drawable(NULL, (GdkDrawable*)(gtkwb->pixmap), gdk_drawable_get_colormap(gtkwb->pixmap), 0, 0, 0, 0, gtkwb->width, gtkwb->height); -*/ gtk_window_set_icon((GtkWindow*)(gtkwb->window), pixbuf); } @@ -866,28 +853,23 @@ static void color_select_dialog(GtkWidget *widget, PidginWhiteboard *gtkwb) { GdkColor color; GtkColorSelectionDialog *dialog; - GtkWidget *ok_button; dialog = (GtkColorSelectionDialog *)gtk_color_selection_dialog_new(_("Select color")); g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", dialog); - g_signal_connect(G_OBJECT(gtk_color_selection_dialog_get_color_selection(dialog)), - "color-changed", G_CALLBACK(change_color_cb), gtkwb); + g_signal_connect(G_OBJECT(dialog->colorsel), "color-changed", + G_CALLBACK(change_color_cb), gtkwb); -/* gtk_widget_destroy(dialog->cancel_button); gtk_widget_destroy(dialog->help_button); -*/ - g_object_get(G_OBJECT(dialog), "ok-button", &ok_button, NULL); - g_signal_connect(G_OBJECT(ok_button), "clicked", + g_signal_connect(G_OBJECT(dialog->ok_button), "clicked", G_CALLBACK(color_selection_dialog_destroy), gtkwb); - gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(dialog)), TRUE); + gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION(dialog->colorsel), TRUE); pidgin_whiteboard_rgb24_to_rgb48(gtkwb->brush_color, &color); - gtk_color_selection_set_current_color( - GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(dialog)), &color); + gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(dialog->colorsel), &color); gtk_widget_show_all(GTK_WIDGET(dialog)); } diff --git a/pidgin/gtkwhiteboard.h b/pidgin/gtkwhiteboard.h index 06c9c56d67..d5bad34a36 100644 --- a/pidgin/gtkwhiteboard.h +++ b/pidgin/gtkwhiteboard.h @@ -51,7 +51,7 @@ typedef struct _PidginWhiteboard GtkWidget *window; /**< Window for the Doodle session */ GtkWidget *drawing_area; /**< Drawing area */ - GdkPixbuf *pixbuf; /**< Memory for drawing area */ + GdkPixmap *pixmap; /**< Memory for drawing area */ int width; /**< Canvas width */ int height; /**< Canvas height */ diff --git a/pidgin/minidialog.c b/pidgin/minidialog.c index f6136cbe0c..10a4286620 100644 --- a/pidgin/minidialog.c +++ b/pidgin/minidialog.c @@ -184,7 +184,7 @@ struct _mini_dialog_button_clicked_cb_data guint pidgin_mini_dialog_get_num_children(PidginMiniDialog *mini_dialog) { - return g_list_length(gtk_container_get_children(GTK_CONTAINER(mini_dialog->contents))); + return g_list_length(mini_dialog->contents->children); } static gboolean diff --git a/pidgin/pidgin-3.pc.in b/pidgin/pidgin-3.pc.in index 6b60b53544..9464d8a6c3 100644 --- a/pidgin/pidgin-3.pc.in +++ b/pidgin/pidgin-3.pc.in @@ -1,7 +1,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@ +includedir=@includedir@/pidgin datarootdir=@datarootdir@ datadir=@datadir@ sysconfdir=@sysconfdir@ diff --git a/pidgin/pidginstock.c b/pidgin/pidginstock.c index 8e3f0be019..38d402fc15 100644 --- a/pidgin/pidginstock.c +++ b/pidgin/pidginstock.c @@ -95,7 +95,7 @@ static const GtkStockItem stock_items[] = typedef struct { const char *name; - const char *dir; + const char *dir; const char *filename; gboolean microscopic; gboolean extra_small; diff --git a/pidgin/pidgintooltip.c b/pidgin/pidgintooltip.c index 1d6e35f78f..ca66b1c46c 100644 --- a/pidgin/pidgintooltip.c +++ b/pidgin/pidgintooltip.c @@ -101,16 +101,11 @@ void pidgin_tooltip_destroy() } static gboolean -pidgin_tooltip_draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data) +pidgin_tooltip_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) { - GtkAllocation allocation; - - gtk_widget_get_allocation(widget, &allocation); - if (pidgin_tooltip.paint_tooltip) { - gtk_paint_flat_box(gtk_widget_get_style(widget), cr, - GTK_STATE_NORMAL, GTK_SHADOW_OUT, - widget, "tooltip", 0, 0, allocation.width, allocation.height); + gtk_paint_flat_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + NULL, widget, "tooltip", 0, 0, -1, -1); pidgin_tooltip.paint_tooltip(widget, data); } return FALSE; @@ -194,8 +189,8 @@ setup_tooltip_window_position(gpointer data, int w, int h) gtk_window_move(GTK_WINDOW(tipwindow), x, y); gtk_widget_show(tipwindow); - g_signal_connect(G_OBJECT(tipwindow), "draw", - G_CALLBACK(pidgin_tooltip_draw_cb), data); + g_signal_connect(G_OBJECT(tipwindow), "expose_event", + G_CALLBACK(pidgin_tooltip_expose_event), data); /* Hide the tooltip when the widget is destroyed */ sig = g_signal_connect(G_OBJECT(pidgin_tooltip.widget), "destroy", G_CALLBACK(pidgin_tooltip_destroy), NULL); diff --git a/pidgin/pidgintooltip.h b/pidgin/pidgintooltip.h index 889232341e..0d6519bcf9 100644 --- a/pidgin/pidgintooltip.h +++ b/pidgin/pidgintooltip.h @@ -36,7 +36,6 @@ * @param h The value of this should be set to the desired height of the tooltip window. * * @return @c TRUE if the tooltip was created correctly, @c FALSE otherwise. - * @since 2.4.0 */ typedef gboolean (*PidginTooltipCreateForTree)(GtkWidget *tipwindow, GtkTreePath *path, gpointer userdata, int *w, int *h); @@ -48,7 +47,6 @@ typedef gboolean (*PidginTooltipCreateForTree)(GtkWidget *tipwindow, * @param h The value of this should be set to the desired height of the tooltip window. * * @return @c TRUE if the tooltip was created correctly, @c FALSE otherwise. - * @since 2.4.0 */ typedef gboolean (*PidginTooltipCreate)(GtkWidget *tipwindow, gpointer userdata, int *w, int *h); @@ -58,7 +56,6 @@ typedef gboolean (*PidginTooltipCreate)(GtkWidget *tipwindow, * @param userdata The userdata set during pidgin_tooltip_setup_for_treeview or pidgin_tooltip_show. * * @return @c TRUE if the tooltip was painted correctly, @c FALSE otherwise. - * @since 2.4.0 */ typedef gboolean (*PidginTooltipPaint)(GtkWidget *tipwindow, gpointer userdata); @@ -71,7 +68,6 @@ typedef gboolean (*PidginTooltipPaint)(GtkWidget *tipwindow, gpointer userdata); * @param paint_cb Callback function to paint the tooltip * * @return @c TRUE if the tooltip callbacks were setup correctly. - * @since 2.4.0 */ gboolean pidgin_tooltip_setup_for_treeview(GtkWidget *tree, gpointer userdata, PidginTooltipCreateForTree create_cb, PidginTooltipPaint paint_cb); @@ -85,14 +81,12 @@ gboolean pidgin_tooltip_setup_for_treeview(GtkWidget *tree, gpointer userdata, * @param paint_cb Callback function to paint the tooltip * * @return @c TRUE if the tooltip callbacks were setup correctly. - * @since 2.4.0 */ gboolean pidgin_tooltip_setup_for_widget(GtkWidget *widget, gpointer userdata, PidginTooltipCreate create_cb, PidginTooltipPaint paint_cb); /** * Destroy the tooltip. - * @since 2.4.0 */ void pidgin_tooltip_destroy(void); @@ -103,8 +97,6 @@ void pidgin_tooltip_destroy(void); * @param userdata The userdata to send to the callback functions * @param create_cb Callback function to create the tooltip from the GtkTreePath * @param paint_cb Callback function to paint the tooltip - * - * @since 2.4.0 */ void pidgin_tooltip_show(GtkWidget *widget, gpointer userdata, PidginTooltipCreate create_cb, PidginTooltipPaint paint_cb); diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index 583dad0d32..4485e025e2 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -38,16 +38,14 @@ gtk_signals_test_la_LDFLAGS = -module -avoid-version gtkbuddynote_la_LDFLAGS = -module -avoid-version history_la_LDFLAGS = -module -avoid-version iconaway_la_LDFLAGS = -module -avoid-version -markerline_la_LDFLAGS = -module -avoid-version notify_la_LDFLAGS = -module -avoid-version pidginrc_la_LDFLAGS = -module -avoid-version relnot_la_LDFLAGS = -module -avoid-version sendbutton_la_LDFLAGS = -module -avoid-version spellchk_la_LDFLAGS = -module -avoid-version themeedit_la_LDFLAGS = -module -avoid-version -timestamp_la_LDFLAGS = -module -avoid-version -timestamp_format_la_LDFLAGS = -module -avoid-version vvconfig_la_LDFLAGS = -module -avoid-version +webkit_la_LDFLAGS = -module -avoid-version xmppconsole_la_LDFLAGS = -module -avoid-version if PLUGINS @@ -58,15 +56,13 @@ plugin_LTLIBRARIES = \ gtkbuddynote.la \ history.la \ iconaway.la \ - markerline.la \ notify.la \ pidginrc.la \ relnot.la \ sendbutton.la \ spellchk.la \ - themeedit.la \ - timestamp.la \ - timestamp_format.la \ + themeedit.la \ + webkit.la \ xmppconsole.la if USE_VV @@ -84,16 +80,13 @@ gtk_signals_test_la_SOURCES = gtk-signals-test.c gtkbuddynote_la_SOURCES = gtkbuddynote.c history_la_SOURCES = history.c iconaway_la_SOURCES = iconaway.c -markerline_la_SOURCES = markerline.c notify_la_SOURCES = notify.c pidginrc_la_SOURCES = pidginrc.c relnot_la_SOURCES = relnot.c sendbutton_la_SOURCES = sendbutton.c spellchk_la_SOURCES = spellchk.c themeedit_la_SOURCES = themeedit.c themeedit-icon.c themeedit-icon.h -timestamp_la_SOURCES = timestamp.c -timestamp_format_la_SOURCES = timestamp_format.c -vvconfig_la_SOURCES = vvconfig.c +webkit_la_SOURCES = webkit.c xmppconsole_la_SOURCES = xmppconsole.c convcolors_la_LIBADD = $(GTK_LIBS) @@ -103,16 +96,13 @@ gtk_signals_test_la_LIBADD = $(GTK_LIBS) gtkbuddynote_la_LIBADD = $(GTK_LIBS) history_la_LIBADD = $(GTK_LIBS) iconaway_la_LIBADD = $(GTK_LIBS) -markerline_la_LIBADD = $(GTK_LIBS) notify_la_LIBADD = $(GTK_LIBS) pidginrc_la_LIBADD = $(GTK_LIBS) relnot_la_LIBADD = $(GLIB_LIBS) sendbutton_la_LIBADD = $(GTK_LIBS) spellchk_la_LIBADD = $(GTK_LIBS) themeedit_la_LIBADD = $(GTK_LIBS) -timestamp_la_LIBADD = $(GTK_LIBS) -timestamp_format_la_LIBADD = $(GTK_LIBS) -vvconfig_la_LIBADD = $(GTK_LIBS) $(GSTREAMER_LIBS) +webkit_la_LIBADD = $(GTK_LIBS) $(WEBKIT_LIBS) xmppconsole_la_LIBADD = $(GTK_LIBS) endif # PLUGINS @@ -136,6 +126,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/pidgin \ $(DEBUG_CFLAGS) \ $(GTK_CFLAGS) \ + $(WEBKIT_CFLAGS) \ $(GSTREAMER_CFLAGS) \ $(PLUGIN_CFLAGS) diff --git a/pidgin/plugins/contact_priority.c b/pidgin/plugins/contact_priority.c index 5e03cd60d9..5ec79d973d 100644 --- a/pidgin/plugins/contact_priority.c +++ b/pidgin/plugins/contact_priority.c @@ -75,7 +75,7 @@ get_config_frame(PurplePlugin *plugin) GtkWidget *ret = NULL, *hbox = NULL, *frame = NULL, *vbox = NULL; GtkWidget *label = NULL, *spin = NULL, *check = NULL; GtkWidget *optmenu = NULL; - GtkAdjustment *adj = NULL; + GtkObject *adj = NULL; GtkSizeGroup *sg = NULL; PurpleAccount *account = NULL; int i; diff --git a/pidgin/plugins/convcolors.c b/pidgin/plugins/convcolors.c index 9563e24947..7e85d2683f 100644 --- a/pidgin/plugins/convcolors.c +++ b/pidgin/plugins/convcolors.c @@ -302,7 +302,7 @@ enable_toggled(const char *name, PurplePrefType type, gconstpointer val, gpointe } static void -disconnect_prefs_callbacks(GtkWidget *widget, gpointer data) +disconnect_prefs_callbacks(GtkObject *object, gpointer data) { PurplePlugin *plugin = (PurplePlugin *)data; @@ -383,7 +383,7 @@ get_config_frame(PurplePlugin *plugin) purple_prefs_connect_callback(plugin, tmp2, enable_toggled, button); } - g_signal_connect(ret, "destroy", G_CALLBACK(disconnect_prefs_callbacks), plugin); + g_signal_connect(GTK_OBJECT(ret), "destroy", G_CALLBACK(disconnect_prefs_callbacks), plugin); frame = pidgin_make_frame(ret, _("General")); pidgin_prefs_checkbox(_("Ignore incoming format"), PREF_IGNORE, frame); pidgin_prefs_checkbox(_("Apply in Chats"), PREF_CHATS, frame); diff --git a/pidgin/plugins/disco/gtkdisco.c b/pidgin/plugins/disco/gtkdisco.c index 18d26ba12f..1f7fe1eae6 100644 --- a/pidgin/plugins/disco/gtkdisco.c +++ b/pidgin/plugins/disco/gtkdisco.c @@ -429,12 +429,15 @@ static gboolean account_filter_func(PurpleAccount *account) static gboolean disco_paint_tooltip(GtkWidget *tipwindow, gpointer data) { - cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(tipwindow)); PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); +#if GTK_CHECK_VERSION(2,14,0) gtk_paint_layout(gtk_widget_get_style(tipwindow), - cr, + gtk_widget_get_window(tipwindow), GTK_STATE_NORMAL, FALSE, - tipwindow, "tooltip", +#else + gtk_paint_layout(tipwindow->style, tipwindow->window, GTK_STATE_NORMAL, FALSE, +#endif + NULL, tipwindow, "tooltip", 6, 6, layout); return TRUE; } diff --git a/pidgin/plugins/gestures/gestures.c b/pidgin/plugins/gestures/gestures.c index 4848a844b1..51c13f011e 100644 --- a/pidgin/plugins/gestures/gestures.c +++ b/pidgin/plugins/gestures/gestures.c @@ -48,7 +48,7 @@ stroke_close(GtkWidget *widget, void *data) gtkconv = PIDGIN_CONVERSATION(conv); - gstroke_cleanup(gtkconv->imhtml); + gstroke_cleanup(gtkconv->webview); purple_conversation_destroy(conv); } @@ -126,15 +126,15 @@ attach_signals(PurpleConversation *conv) gtkconv = PIDGIN_CONVERSATION(conv); - gstroke_enable(gtkconv->imhtml); - gstroke_signal_connect(gtkconv->imhtml, "14789", stroke_close, conv); - gstroke_signal_connect(gtkconv->imhtml, "1456", stroke_close, conv); - gstroke_signal_connect(gtkconv->imhtml, "1489", stroke_close, conv); - gstroke_signal_connect(gtkconv->imhtml, "74123", stroke_next_tab, conv); - gstroke_signal_connect(gtkconv->imhtml, "7456", stroke_next_tab, conv); - gstroke_signal_connect(gtkconv->imhtml, "96321", stroke_prev_tab, conv); - gstroke_signal_connect(gtkconv->imhtml, "9654", stroke_prev_tab, conv); - gstroke_signal_connect(gtkconv->imhtml, "25852", stroke_new_win, conv); + gstroke_enable(gtkconv->webview); + gstroke_signal_connect(gtkconv->webview, "14789", stroke_close, conv); + gstroke_signal_connect(gtkconv->webview, "1456", stroke_close, conv); + gstroke_signal_connect(gtkconv->webview, "1489", stroke_close, conv); + gstroke_signal_connect(gtkconv->webview, "74123", stroke_next_tab, conv); + gstroke_signal_connect(gtkconv->webview, "7456", stroke_next_tab, conv); + gstroke_signal_connect(gtkconv->webview, "96321", stroke_prev_tab, conv); + gstroke_signal_connect(gtkconv->webview, "9654", stroke_prev_tab, conv); + gstroke_signal_connect(gtkconv->webview, "25852", stroke_new_win, conv); } static void @@ -145,7 +145,6 @@ new_conv_cb(PurpleConversation *conv) } #if 0 -#if GTK_CHECK_VERSION(2,4,0) static void mouse_button_menu_cb(GtkComboBox *opt, gpointer data) { @@ -153,15 +152,6 @@ mouse_button_menu_cb(GtkComboBox *opt, gpointer data) gstroke_set_mouse_button(button + 2); } -#else -static void -mouse_button_menu_cb(GtkMenuItem *item, gpointer data) -{ - int button = (int)data; - - gstroke_set_mouse_button(button + 2); -} -#endif #endif static void @@ -215,8 +205,8 @@ plugin_unload(PurplePlugin *plugin) gtkconv = PIDGIN_CONVERSATION(conv); - gstroke_cleanup(gtkconv->imhtml); - gstroke_disable(gtkconv->imhtml); + gstroke_cleanup(gtkconv->webview); + gstroke_disable(gtkconv->webview); } return TRUE; @@ -230,9 +220,6 @@ get_config_frame(PurplePlugin *plugin) GtkWidget *toggle; #if 0 GtkWidget *opt; -#if GTK_CHECK_VERSION(2,4,0) - GtkWidget *menu, *item; -#endif #endif /* Outside container */ @@ -243,7 +230,6 @@ get_config_frame(PurplePlugin *plugin) vbox = pidgin_make_frame(ret, _("Mouse Gestures Configuration")); #if 0 -#if GTK_CHECK_VERSION(2,4,0) /* Mouse button drop-down menu */ opt = gtk_combo_box_new_text(); @@ -255,26 +241,6 @@ get_config_frame(PurplePlugin *plugin) gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); gtk_combo_box_set_active(GTK_COMBO_BOX(opt), gstroke_get_mouse_button() - 2); -#else - /* Mouse button drop-down menu */ - menu = gtk_menu_new(); - opt = gtk_option_menu_new(); - - item = gtk_menu_item_new_with_label(_("Middle mouse button")); - g_signal_connect(G_OBJECT(item), "activate", - G_CALLBACK(mouse_button_menu_cb), opt); - gtk_menu_append(menu, item); - - item = gtk_menu_item_new_with_label(_("Right mouse button")); - g_signal_connect(G_OBJECT(item), "activate", - G_CALLBACK(mouse_button_menu_cb), opt); - gtk_menu_append(menu, item); - - gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); - gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu); - gtk_option_menu_set_history(GTK_OPTION_MENU(opt), - gstroke_get_mouse_button() - 2); -#endif #endif /* "Visual gesture display" checkbox */ diff --git a/pidgin/plugins/gestures/stroke-draw.c b/pidgin/plugins/gestures/stroke-draw.c index dd74266338..023d0724ae 100644 --- a/pidgin/plugins/gestures/stroke-draw.c +++ b/pidgin/plugins/gestures/stroke-draw.c @@ -339,7 +339,7 @@ gstroke_invisible_window_init (GtkWidget *widget) unsigned int border_width; XSizeHints hints; Display *disp = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget)); - Window wind = gdk_x11_window_get_xid(gtk_widget_get_window(widget)); + Window wind = GDK_WINDOW_XWINDOW (gtk_widget_get_window(widget)); int screen = DefaultScreen (disp); if (!gstroke_draw_strokes()) diff --git a/pidgin/plugins/gevolution/gevo-util.c b/pidgin/plugins/gevolution/gevo-util.c index 8f97a7df8f..77d31a4ffe 100644 --- a/pidgin/plugins/gevolution/gevo-util.c +++ b/pidgin/plugins/gevolution/gevo-util.c @@ -49,7 +49,7 @@ gevo_add_buddy(PurpleAccount *account, const char *group_name, purple_blist_add_buddy(buddy, NULL, group, NULL); } - purple_account_add_buddy(account, buddy); + purple_account_add_buddy(account, buddy, NULL); if (conv != NULL) { diff --git a/pidgin/plugins/history.c b/pidgin/plugins/history.c index 3d2507343b..6e53097c93 100644 --- a/pidgin/plugins/history.c +++ b/pidgin/plugins/history.c @@ -16,16 +16,17 @@ #include "gtkconv.h" #include "gtkimhtml.h" #include "gtkplugin.h" +#include "gtkwebview.h" #define HISTORY_PLUGIN_ID "gtk-history" #define HISTORY_SIZE (4 * 1024) -static gboolean _scroll_imhtml_to_end(gpointer data) +static gboolean _scroll_webview_to_end(gpointer data) { - GtkIMHtml *imhtml = data; - gtk_imhtml_scroll_to_end(GTK_IMHTML(imhtml), FALSE); - g_object_unref(G_OBJECT(imhtml)); + GtkWebView *webview = data; + gtk_webview_scroll_to_end(GTK_WEBVIEW(webview), FALSE); + g_object_unref(G_OBJECT(webview)); return FALSE; } @@ -39,9 +40,15 @@ static void historize(PurpleConversation *c) guint flags; char *history; PidginConversation *gtkconv; +#if 0 + /* FIXME: WebView has no options */ GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS; +#endif char *header; +#if 0 + /* FIXME: WebView has no protocol setting */ char *protocol; +#endif char *escaped_alias; const char *header_date; @@ -116,15 +123,21 @@ static void historize(PurpleConversation *c) history = purple_log_read((PurpleLog*)logs->data, &flags); gtkconv = PIDGIN_CONVERSATION(c); +#if 0 + /* FIXME: WebView has no options */ if (flags & PURPLE_LOG_READ_NO_NEWLINE) options |= GTK_IMHTML_NO_NEWLINE; +#endif +#if 0 + /* FIXME: WebView has no protocol setting */ protocol = g_strdup(gtk_imhtml_get_protocol_name(GTK_IMHTML(gtkconv->imhtml))); gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), purple_account_get_protocol_name(((PurpleLog*)logs->data)->account)); +#endif - if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "
", options); + if (!gtk_webview_is_empty(GTK_WEBVIEW(gtkconv->webview))) + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "
"); escaped_alias = g_markup_escape_text(alias, -1); @@ -134,21 +147,24 @@ static void historize(PurpleConversation *c) header_date = purple_date_format_full(localtime(&((PurpleLog *)logs->data)->time)); header = g_strdup_printf(_("Conversation with %s on %s:
"), escaped_alias, header_date); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), header, options); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), header); g_free(header); g_free(escaped_alias); g_strchomp(history); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), history, options); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), history); g_free(history); - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "
", options); + gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "
"); +#if 0 + /* FIXME: WebView has no protocol setting */ gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol); g_free(protocol); +#endif - g_object_ref(G_OBJECT(gtkconv->imhtml)); - g_idle_add(_scroll_imhtml_to_end, gtkconv->imhtml); + g_object_ref(G_OBJECT(gtkconv->webview)); + g_idle_add(_scroll_webview_to_end, gtkconv->webview); g_list_foreach(logs, (GFunc)purple_log_free, NULL); g_list_free(logs); diff --git a/pidgin/plugins/markerline.c b/pidgin/plugins/markerline.c index 23104a4aed..7db983f3f2 100644 --- a/pidgin/plugins/markerline.c +++ b/pidgin/plugins/markerline.c @@ -42,7 +42,7 @@ #define PREF_CHATS PREF_PREFIX "/chats" static int -imhtml_expose_cb(GtkWidget *widget, cairo_t *cr, PidginConversation *gtkconv) +imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *gtkconv) { int y, last_y, offset; GdkRectangle visible_rect; @@ -51,7 +51,6 @@ imhtml_expose_cb(GtkWidget *widget, cairo_t *cr, PidginConversation *gtkconv) int pad; PurpleConversation *conv = gtkconv->active_conv; PurpleConversationType type = purple_conversation_get_type(conv); - GdkColor red = {0, 0xffff, 0, 0}; if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS))) @@ -77,12 +76,18 @@ imhtml_expose_cb(GtkWidget *widget, cairo_t *cr, PidginConversation *gtkconv) gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, 0, last_y, 0, &y); - gdk_cairo_set_source_color(cr, &red); - cairo_move_to(cr, 0.0, y + 0.5); - cairo_rel_line_to(cr, visible_rect.width, 0.0); - cairo_set_line_width(cr, 1.0); - cairo_stroke(cr); - + if (y >= event->area.y) + { + GdkColor red = {0, 0xffff, 0, 0}; + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(event->window)); + + gdk_cairo_set_source_color(cr, &red); + cairo_move_to(cr, 0.0, y + 0.5); + cairo_rel_line_to(cr, visible_rect.width, 0.0); + cairo_set_line_width(cr, 1.0); + cairo_stroke(cr); + cairo_destroy(cr); + } return FALSE; } @@ -168,7 +173,7 @@ static void attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) { detach_from_gtkconv(gtkconv, NULL); - g_signal_connect(G_OBJECT(gtkconv->imhtml), "draw", + g_signal_connect(G_OBJECT(gtkconv->imhtml), "expose_event", G_CALLBACK(imhtml_expose_cb), gtkconv); } diff --git a/pidgin/plugins/musicmessaging/musicmessaging.c b/pidgin/plugins/musicmessaging/musicmessaging.c index 1a735d7c9a..4399f19ed6 100644 --- a/pidgin/plugins/musicmessaging/musicmessaging.c +++ b/pidgin/plugins/musicmessaging/musicmessaging.c @@ -104,7 +104,7 @@ void music_messaging_change_request(const int session, const char *command, cons { if (mmconv->originator) { - char *name = (mmconv->conv)->name; + const char *name = purple_conversation_get_name(mmconv->conv); send_change_request (session, name, command, parameters); } else { @@ -376,7 +376,7 @@ intercept_received(PurpleAccount *account, char **sender, char **message, Purple if (mmconv->originator) { int session = mmconv_from_conv_loc(conv); - char *id = (mmconv->conv)->name; + const char *id = purple_conversation_get_name(mmconv->conv); char *command; char *parameters; @@ -424,7 +424,8 @@ intercept_received(PurpleAccount *account, char **sender, char **message, Purple command = strtok(NULL, " "); /* char *parameters = strtok(NULL, "#"); DONT NEED PARAMETERS */ - if ((mmconv->conv)->name == id) + // TODO: Shouldn't this be strcmp() ? + if (purple_conversation_get_name(mmconv->conv) == id) { purple_notify_message(plugin_pointer, PURPLE_NOTIFY_MSG_ERROR, _("Music Messaging"), @@ -465,14 +466,14 @@ intercept_received(PurpleAccount *account, char **sender, char **message, Purple static void send_request(MMConversation *mmconv) { - PurpleConnection *connection = purple_conversation_get_gc(mmconv->conv); + PurpleConnection *connection = purple_conversation_get_connection(mmconv->conv); const char *convName = purple_conversation_get_name(mmconv->conv); serv_send_im(connection, convName, MUSICMESSAGING_START_MSG, PURPLE_MESSAGE_SEND); } static void send_request_confirmed(MMConversation *mmconv) { - PurpleConnection *connection = purple_conversation_get_gc(mmconv->conv); + PurpleConnection *connection = purple_conversation_get_connection(mmconv->conv); const char *convName = purple_conversation_get_name(mmconv->conv); serv_send_im(connection, convName, MUSICMESSAGING_CONFIRM_MSG, PURPLE_MESSAGE_SEND); } diff --git a/pidgin/plugins/notify.c b/pidgin/plugins/notify.c index 1e0a38aa8d..fd223d06dd 100644 --- a/pidgin/plugins/notify.c +++ b/pidgin/plugins/notify.c @@ -303,7 +303,7 @@ static int attach_signals(PurpleConversation *conv) { PidginConversation *gtkconv = NULL; - GSList *imhtml_ids = NULL, *entry_ids = NULL; + GSList *webview_ids = NULL, *entry_ids = NULL; guint id; gtkconv = PIDGIN_CONVERSATION(conv); @@ -322,9 +322,9 @@ attach_signals(PurpleConversation *conv) G_CALLBACK(unnotify_cb), conv); entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); - id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "focus-in-event", + id = g_signal_connect(G_OBJECT(gtkconv->webview), "focus-in-event", G_CALLBACK(unnotify_cb), conv); - imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id)); + webview_ids = g_slist_append(webview_ids, GUINT_TO_POINTER(id)); } if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { @@ -334,9 +334,9 @@ attach_signals(PurpleConversation *conv) G_CALLBACK(unnotify_cb), conv); entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); - id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "button-press-event", + id = g_signal_connect(G_OBJECT(gtkconv->webview), "button-press-event", G_CALLBACK(unnotify_cb), conv); - imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id)); + webview_ids = g_slist_append(webview_ids, GUINT_TO_POINTER(id)); } if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) { @@ -345,7 +345,7 @@ attach_signals(PurpleConversation *conv) entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); } - purple_conversation_set_data(conv, "notify-imhtml-signals", imhtml_ids); + purple_conversation_set_data(conv, "notify-webview-signals", webview_ids); purple_conversation_set_data(conv, "notify-entry-signals", entry_ids); return 0; @@ -361,9 +361,9 @@ detach_signals(PurpleConversation *conv) if (!gtkconv) return; - ids = purple_conversation_get_data(conv, "notify-imhtml-signals"); + ids = purple_conversation_get_data(conv, "notify-webview-signals"); for (l = ids; l != NULL; l = l->next) - g_signal_handler_disconnect(gtkconv->imhtml, GPOINTER_TO_INT(l->data)); + g_signal_handler_disconnect(gtkconv->webview, GPOINTER_TO_INT(l->data)); g_slist_free(ids); ids = purple_conversation_get_data(conv, "notify-entry-signals"); @@ -373,7 +373,7 @@ detach_signals(PurpleConversation *conv) purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); - purple_conversation_set_data(conv, "notify-imhtml-signals", NULL); + purple_conversation_set_data(conv, "notify-webview-signals", NULL); purple_conversation_set_data(conv, "notify-entry-signals", NULL); } diff --git a/pidgin/plugins/perl/common/GtkIMHtml.xs b/pidgin/plugins/perl/common/GtkIMHtml.xs index 992cb6b7f2..8a76f05576 100644 --- a/pidgin/plugins/perl/common/GtkIMHtml.xs +++ b/pidgin/plugins/perl/common/GtkIMHtml.xs @@ -77,26 +77,6 @@ gtk_imhtml_get_text(imhtml, start, end) Gtk::TextIter end */ -/* This can't work at the moment since I don't have a typemap for Gdk::Pixbuf. - * I thought about using the one from libgtk2-perl but wasn't sure how to go - * about doing that. -Pidgin::IMHtml::Scalable -gtk_imhtml_image_new(img, filename, id) - Gdk::Pixbuf img - const gchar * filename - int id -*/ - -/* This can't work at the moment since I don't have a typemap for Gtk::Widget. - * I thought about using the one from libgtk2-perl but wasn't sure how to go - * about doing that. -void -gtk_imhtml_image_add_to(scale, imhtml, iter) - Pidgin::IMHtml::Scalable scale - Pidgin::IMHtml imhtml - Gtk::TextIter iter -*/ - /* This can't work at the moment since I don't have a typemap for Gtk::Widget. * I thought about using the one from libgtk2-perl but wasn't sure how to go * about doing that. @@ -323,19 +303,6 @@ PPCODE: } XPUSHs(sv_2mortal(newRV_noinc((SV *)lines))); -MODULE = Pidgin::IMHtml PACKAGE = Pidgin::IMHtml::Scalable PREFIX = gtk_imhtml_image_ -PROTOTYPES: ENABLE - -void -gtk_imhtml_image_free(scale) - Pidgin::IMHtml::Scalable scale - -void -gtk_imhtml_image_scale(scale, width, height) - Pidgin::IMHtml::Scalable scale - int width - int height - MODULE = Pidgin::IMHtml PACKAGE = Pidgin::IMHtml::Hr PREFIX = gtk_imhtml_hr_ PROTOTYPES: ENABLE diff --git a/pidgin/plugins/relnot.c b/pidgin/plugins/relnot.c index d3d1817741..2c381fe354 100644 --- a/pidgin/plugins/relnot.c +++ b/pidgin/plugins/relnot.c @@ -152,7 +152,7 @@ do_check(void) url, host); - purple_util_fetch_url_request_len(NULL, url, TRUE, NULL, FALSE, + purple_util_fetch_url_request(NULL, url, TRUE, NULL, FALSE, request, TRUE, -1, version_fetch_cb, NULL); g_free(request); diff --git a/pidgin/plugins/themeedit.c b/pidgin/plugins/themeedit.c index 9ff95f3b7b..de4a2abf90 100644 --- a/pidgin/plugins/themeedit.c +++ b/pidgin/plugins/themeedit.c @@ -306,6 +306,9 @@ pidgin_blist_theme_edit(PurplePluginAction *unused) } } +#if !GTK_CHECK_VERSION(2,22,0) + gtk_dialog_set_has_separator(GTK_DIALOG(dialog), TRUE); +#endif #ifdef NOT_SADRUL pidgin_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_SAVE, G_CALLBACK(save_blist_theme), dialog); #endif diff --git a/pidgin/plugins/ticker/gtkticker.c b/pidgin/plugins/ticker/gtkticker.c index 7423806a25..56bc388187 100644 --- a/pidgin/plugins/ticker/gtkticker.c +++ b/pidgin/plugins/ticker/gtkticker.c @@ -128,7 +128,7 @@ static void gtk_ticker_class_init (GtkTickerClass *class) widget_class->map = gtk_ticker_map; widget_class->realize = gtk_ticker_realize; - /*widget_class->size_request = gtk_ticker_size_request;*/ + widget_class->size_request = gtk_ticker_size_request; widget_class->size_allocate = gtk_ticker_size_allocate; container_class->add = gtk_ticker_add_real; @@ -178,7 +178,7 @@ static void gtk_ticker_put (GtkTicker *ticker, GtkWidget *widget) ticker->children = g_list_append (ticker->children, child_info); - if (gtk_widget_get_realized (GTK_WIDGET(ticker))) + if (gtk_widget_get_realized (GTK_WIDGET (ticker))) gtk_widget_realize (widget); if (gtk_widget_get_visible (GTK_WIDGET (ticker)) && @@ -332,11 +332,11 @@ static void gtk_ticker_realize (GtkWidget *widget) #endif attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); - /*attributes.colormap = gtk_widget_get_colormap (widget);*/ + attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK; - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL /*| GDK_WA_COLORMAP*/; + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); diff --git a/pidgin/plugins/timestamp.c b/pidgin/plugins/timestamp.c index 8540ea73be..0f46f47221 100644 --- a/pidgin/plugins/timestamp.c +++ b/pidgin/plugins/timestamp.c @@ -134,7 +134,7 @@ get_config_frame(PurplePlugin *plugin) GtkWidget *ret; GtkWidget *frame, *label; GtkWidget *vbox, *hbox; - GtkAdjustment *adj; + GtkObject *adj; GtkWidget *spinner; ret = gtk_vbox_new(FALSE, 18); diff --git a/pidgin/plugins/timestamp_format.c b/pidgin/plugins/timestamp_format.c index 49fa7432bb..03cf2f8728 100644 --- a/pidgin/plugins/timestamp_format.c +++ b/pidgin/plugins/timestamp_format.c @@ -155,9 +155,8 @@ menu_cb(GtkWidget *item, gpointer data) if (!frame) return; - /* GTK_DIALOG_NO_SEPARATOR seems to be gone in gtk+ 3.0... */ dialog = gtk_dialog_new_with_buttons(PIDGIN_ALERT_TITLE, NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); g_signal_connect_after(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), dialog); diff --git a/pidgin/plugins/vvconfig.c b/pidgin/plugins/vvconfig.c index 11cb948bca..cafdb2a823 100644 --- a/pidgin/plugins/vvconfig.c +++ b/pidgin/plugins/vvconfig.c @@ -39,6 +39,7 @@ static const gchar *AUDIO_SRC_PLUGINS[] = { /* "esdmon", "ESD", ? */ "osssrc", "OSS", "pulsesrc", "PulseAudio", + "libsndiosrc", "sndio", /* "audiotestsrc wave=silence", "Silence", */ "audiotestsrc", "Test Sound", NULL @@ -50,6 +51,7 @@ static const gchar *AUDIO_SINK_PLUGINS[] = { "esdsink", "ESD", "osssink", "OSS", "pulsesink", "PulseAudio", + "libsndiosink", "sndio", NULL }; @@ -503,14 +505,14 @@ plugin_load(PurplePlugin *plugin) } static void -config_destroy(GtkWidget *w, gpointer nul) +config_destroy(GtkObject *w, gpointer nul) { purple_debug_info("vvconfig", "closing vv configuration window\n"); window = NULL; } static void -config_close(GtkWidget *w, gpointer nul) +config_close(GtkObject *w, gpointer nul) { gtk_widget_destroy(GTK_WIDGET(window)); } @@ -610,7 +612,7 @@ gst_bus_cb(GstBus *bus, GstMessage *msg, BusCbCtx *ctx) GstElement *valve; percent = gst_msg_db_to_percent(msg, "rms"); - gtk_progress_bar_set_fraction(ctx->level, percent * 5); + gtk_progress_bar_set_fraction(ctx->level, percent); percent = gst_msg_db_to_percent(msg, "decay"); threshold = gtk_range_get_value(ctx->threshold) / 100.0; diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index fe305a2a07..e6344ea46c 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -190,7 +190,7 @@ static void message_send_cb(GtkWidget *widget, gpointer p) gc = console->gc; if (gc) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); gtk_text_buffer_get_start_iter(buffer, &start); @@ -274,7 +274,9 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - /* TODO: how to set no separator for GtkDialog in gtk+ 3.0... */ +#if !GTK_CHECK_VERSION(2,22,0) + gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); #if GTK_CHECK_VERSION(2,14,0) @@ -302,11 +304,11 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) gtk_size_group_add_widget(sg, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - type_combo = gtk_combo_box_text_new(); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "get"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "set"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "result"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); + type_combo = gtk_combo_box_new_text(); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "get"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "set"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "result"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); @@ -325,7 +327,7 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) to && *to ? to : "", to && *to ? "'" : "", g_random_int(), - gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo))); + gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo))); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); gtk_text_buffer_set_text(buffer, stanza, -1); @@ -362,9 +364,9 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - - /* TODO: find a way to specify no separator for a dialog in gtk+ 3 */ - /*gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);*/ +#if !GTK_CHECK_VERSION(2,22,0) + gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); #if GTK_CHECK_VERSION(2,14,0) @@ -391,15 +393,15 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - type_combo = gtk_combo_box_text_new(); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "default"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unavailable"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "subscribe"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unsubscribe"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "subscribed"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unsubscribed"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "probe"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); + type_combo = gtk_combo_box_new_text(); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "default"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unavailable"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "subscribe"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unsubscribe"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "subscribed"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "unsubscribed"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "probe"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); @@ -409,12 +411,12 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - show_combo = gtk_combo_box_text_new(); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "default"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "away"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "dnd"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "xa"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "chat"); + show_combo = gtk_combo_box_new_text(); + gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "default"); + gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "away"); + gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "dnd"); + gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "xa"); + gtk_combo_box_append_text(GTK_COMBO_BOX(show_combo), "chat"); gtk_combo_box_set_active(GTK_COMBO_BOX(show_combo), 0); gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); @@ -452,10 +454,10 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) } to = gtk_entry_get_text(GTK_ENTRY(to_entry)); - type = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo)); + type = gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo)); if (!strcmp(type, "default")) type = ""; - show = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(show_combo)); + show = gtk_combo_box_get_active_text(GTK_COMBO_BOX(show_combo)); if (!strcmp(show, "default")) show = ""; status = gtk_entry_get_text(GTK_ENTRY(status_entry)); @@ -522,8 +524,9 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - /* TODO: find a way to create a dialog without separtor in gtk+ 3 */ - /*gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);*/ +#if !GTK_CHECK_VERSION(2,22,0) + gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); +#endif gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); #if GTK_CHECK_VERSION(2,14,0) @@ -550,12 +553,12 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - type_combo = gtk_combo_box_text_new(); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "chat"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "headline"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "groupchat"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "normal"); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); + type_combo = gtk_combo_box_new_text(); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "chat"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "headline"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "groupchat"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "normal"); + gtk_combo_box_append_text(GTK_COMBO_BOX(type_combo), "error"); gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); @@ -616,8 +619,7 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) *to ? to : "", *to ? "'" : "", g_random_int(), - gtk_combo_box_text_get_active_text( - GTK_COMBO_BOX_TEXT(type_combo)), + gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo)), *body ? "" : "", *body ? body : "", @@ -647,8 +649,7 @@ signing_on_cb(PurpleConnection *gc) if (!console) return; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), - purple_account_get_username(gc->account)); + gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), purple_account_get_username(purple_connection_get_account(gc))); console->accounts = g_list_append(console->accounts, gc); console->count++; @@ -679,7 +680,7 @@ signed_off_cb(PurpleConnection *gc) if (l == NULL) return; - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(console->dropdown), i); + gtk_combo_box_remove_text(GTK_COMBO_BOX(console->dropdown), i); console->accounts = g_list_remove(console->accounts, gc); console->count--; @@ -721,7 +722,7 @@ plugin_unload(PurplePlugin *plugin) } static void -console_destroy(GtkWidget *window, gpointer nul) +console_destroy(GtkObject *window, gpointer nul) { g_list_free(console->accounts); g_free(console); @@ -736,13 +737,12 @@ dropdown_changed_cb(GtkComboBox *widget, gpointer nul) if (!console) return; - account = - purple_accounts_find(gtk_combo_box_text_get_active_text( - GTK_COMBO_BOX_TEXT(console->dropdown)), "prpl-jabber"); - if (!account || !account->gc) + account = purple_accounts_find(gtk_combo_box_get_active_text(GTK_COMBO_BOX(console->dropdown)), + "prpl-jabber"); + if (!account || !purple_account_get_connection(account)) return; - console->gc = account->gc; + console->gc = purple_account_get_connection(account); gtk_imhtml_clear(GTK_IMHTML(console->imhtml)); } @@ -773,13 +773,13 @@ create_console(PurplePluginAction *action) label = gtk_label_new(_("Account: ")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_box_pack_start(GTK_BOX(console->hbox), label, FALSE, FALSE, 0); - console->dropdown = gtk_combo_box_text_new(); + console->dropdown = gtk_combo_box_new_text(); for (connections = purple_connections_get_all(); connections; connections = connections->next) { PurpleConnection *gc = connections->data; if (!strcmp(purple_account_get_protocol_id(purple_connection_get_account(gc)), "prpl-jabber")) { console->count++; console->accounts = g_list_append(console->accounts, gc); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), + gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), purple_account_get_username(purple_connection_get_account(gc))); if (!console->gc) console->gc = gc; @@ -799,14 +799,17 @@ create_console(PurplePluginAction *action) toolbar = gtk_toolbar_new(); button = gtk_tool_button_new(NULL, ""); + gtk_tool_item_set_is_important(button, TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); button = gtk_tool_button_new(NULL, ""); + gtk_tool_item_set_is_important(button, TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); button = gtk_tool_button_new(NULL, ""); + gtk_tool_item_set_is_important(button, TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); diff --git a/po/ChangeLog b/po/ChangeLog index 981e75a41a..33c361efb5 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,5 +1,8 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul +version 2.10.1 + * No changes + version 2.10.0 * Afrikaans translation updated (Friedel Wolff) * Albanian translation updated (Besnik Bleta) diff --git a/po/de.po b/po/de.po index 5c16c146e5..bd9647b6af 100644 --- a/po/de.po +++ b/po/de.po @@ -11,9 +11,9 @@ msgid "" msgstr "" "Project-Id-Version: de\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-11 10:27+0200\n" -"PO-Revision-Date: 2011-08-11 10:12+0200\n" -"Last-Translator: Björn Voigt \n" +"POT-Creation-Date: 2011-12-11 10:41+0100\n" +"PO-Revision-Date: 2011-12-11 10:40+0100\n" +"Last-Translator: Jochen Kemnade \n" "Language-Team: German \n" "Language: de\n" "MIME-Version: 1.0\n" @@ -50,17 +50,6 @@ msgstr "" " -n, --nologin nicht automatisch anmelden\n" " -v, --version zeigt aktuelle Version und beendet das Programm\n" -#, c-format -msgid "" -"%s encountered errors migrating your settings from %s to %s. Please " -"investigate and complete the migration by hand. Please report this error at " -"http://developer.pidgin.im" -msgstr "" -"%s ist beim Übertragen Ihrer Einstellungen von %s nach %s auf Fehler " -"gestoßen. Bitte untersuchen Sie das Problem und vervollständigen Sie die " -"Migration per Hand. Bitte melden Sie diesen Fehler auf http://developer." -"pidgin.im" - #. the user did not fill in the captcha msgid "Error" msgstr "Fehler" @@ -213,6 +202,8 @@ msgstr "Das gewählte Konto ist nicht online." msgid "Error adding buddy" msgstr "Fehler beim Hinzufügen des Buddys" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Username" msgstr "Benutzer" @@ -346,7 +337,11 @@ msgstr "Markierung umkehren" msgid "View Log" msgstr "Mitschnitt anzeigen" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. General +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Nickname" msgstr "Spitzname" @@ -800,7 +795,11 @@ msgid "Remaining" msgstr "Verbleibend" #. XXX: Use of ggp_str_to_uin() is an ugly hack! +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext #. presence +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status" msgstr "Status" @@ -914,7 +913,7 @@ msgid "Reject" msgstr "Ablehnen" msgid "Call in progress." -msgstr "Verbindungsaufbau." +msgstr "Anruf im Gange." msgid "The call has been terminated." msgstr "Der Anruf wurde beendet." @@ -1389,6 +1388,8 @@ msgstr "Titel" msgid "Type" msgstr "Typ" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. Statuses are almost all the same. Define a macro to reduce code repetition. #. PurpleStatusPrimitive #. id - use default @@ -1397,6 +1398,8 @@ msgstr "Typ" #. user_settable #. not independent #. Attributes - each status can have a message. +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Message" msgstr "Nachricht" @@ -3025,19 +3028,29 @@ msgid "" msgstr "Keine Verbindung zum lokalen mDNS-Server. Ist er aktiviert?" # old strings +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "First name" msgstr "Vorname" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Last name" msgstr "Nachname" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. email msgid "Email" msgstr "E-Mail" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "AIM Account" msgstr "AIM-Konto" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "XMPP Account" msgstr "XMPP-Konto" @@ -3152,6 +3165,8 @@ msgstr "Registrierung eines neuen Gadu-Gadu-Kontos" msgid "Please, fill in the following fields" msgstr "Bitte füllen Sie die folgenden Felder aus" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "City" msgstr "Stadt" @@ -3159,6 +3174,8 @@ msgid "Year of birth" msgstr "Geburtsjahr" #. gender +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Gender" msgstr "Geschlecht" @@ -3181,20 +3198,26 @@ msgstr "Suche Buddys" msgid "Please, enter your search criteria below" msgstr "Bitte geben Sie Ihre Suchkriterien unten ein" -msgid "Fill in the fields." -msgstr "Füllen Sie die Felder aus." +msgid "Change password for the Gadu-Gadu account" +msgstr "Ändern des Passworts für dieses Gadu-Gadu-Konto" -msgid "Your current password is different from the one that you specified." -msgstr "Ihr aktuelles Passwort ist anders als das angegebene." +msgid "Password was changed successfully!" +msgstr "Das Passwort wurde erfolgreich geändert!" msgid "Unable to change password. Error occurred.\n" msgstr "Konnte das Passwort nicht ändern. Es trat ein Fehler auf.\n" -msgid "Change password for the Gadu-Gadu account" -msgstr "Ändern des Passworts für dieses Gadu-Gadu-Konto" +msgid "Fill in the fields." +msgstr "Füllen Sie die Felder aus." -msgid "Password was changed successfully!" -msgstr "Das Passwort wurde erfolgreich geändert!" +msgid "New password should be at most 15 characters long." +msgstr "Das neue Passwort darf maximal 15 Zeichen lang sein." + +msgid "Your current password is different from the one that you specified." +msgstr "Ihr aktuelles Passwort ist anders als das angegebene." + +msgid "Invalid email address" +msgstr "Ungültige E-Mail-Adresse" msgid "Current password" msgstr "Aktuelles Passwort" @@ -3202,6 +3225,9 @@ msgstr "Aktuelles Passwort" msgid "Password (retype)" msgstr "Passwort (nochmal)" +msgid "Email Address" +msgstr "E-Mail-Adresse" + msgid "Enter current token" msgstr "Geben Sie das aktuelle Token ein" @@ -3257,14 +3283,20 @@ msgstr "Nicht stören" msgid "Away" msgstr "Abwesend" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "UIN" msgstr "UIN" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. first name #. optional information msgid "First Name" msgstr "Vorname" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Birth Year" msgstr "Geburtsjahr" @@ -3304,6 +3336,30 @@ msgstr "Ihre Buddy-Liste wurde auf dem Server gespeichert." msgid "Connected" msgstr "Verbunden" +msgid "Unable to resolve hostname" +msgstr "Hostname konnte nicht aufgelöst werden" + +msgid "Incorrect password" +msgstr "Falsches Passwort" + +msgid "SSL Connection Failed" +msgstr "SSL-Verbindung gescheitert" + +msgid "" +"Your account has been disabled because too many incorrect passwords were " +"entered" +msgstr "" +"Ihr Konto wurde wegen zu vielen falsch eingegebenen Passworten gesperrt" + +msgid "Service temporarily unavailable" +msgstr "Dienst momentan nicht verfügbar" + +msgid "Error connecting to proxy server" +msgstr "Fehler beim Verbinden mit dem Proxy-Server" + +msgid "Error connecting to master server" +msgstr "Fehler beim Verbinden mit dem Master-Server" + msgid "Connection failed" msgstr "Verbindung fehlgeschlagen" @@ -3313,6 +3369,12 @@ msgstr "Zum Chat hinzufügen" msgid "Chat _name:" msgstr "Chat_name:" +msgid "The username specified is invalid." +msgstr "Der angegebene Benutzername ist ungültig." + +msgid "SSL support unavailable" +msgstr "SSL-Unterstützung nicht verfügbar" + #, c-format msgid "Unable to resolve hostname '%s': %s" msgstr "Hostname '%s' kann nicht aufgelöst werden: %s" @@ -3331,12 +3393,12 @@ msgstr "Dieser Chatname existiert bereits" msgid "Not connected to the server" msgstr "Nicht mit dem Server verbunden" -msgid "Find buddies..." -msgstr "Finde Buddys..." - msgid "Change password..." msgstr "Passwort ändern..." +msgid "Find buddies..." +msgstr "Finde Buddys..." + msgid "Upload buddylist to Server" msgstr "Buddy-Liste zum Server hochladen" @@ -3367,25 +3429,24 @@ msgstr "Gadu-Gadu-Protokoll-Plugin" msgid "Polish popular IM" msgstr "Beliebter polnischer IM-Dienst" -msgid "Gadu-Gadu User" -msgstr "Gadu-Gadu-Benutzer" - msgid "GG server" msgstr "GG-Server" -msgid "Don't use encryption" -msgstr "Keine Verschlüsselung benutzen" - msgid "Use encryption if available" msgstr "Verschlüsselung benutzen, wenn verfügbar" -#. TODO msgid "Require encryption" msgstr "Verschlüsselung fordern" +msgid "Don't use encryption" +msgstr "Keine Verschlüsselung benutzen" + msgid "Connection security" msgstr "Verbindungssicherheit" +msgid "Show links from strangers" +msgstr "Links von Fremden anzeigen" + #, c-format msgid "Unknown command: %s" msgstr "Unbekanntes Kommando: %s" @@ -3438,9 +3499,6 @@ msgstr "_Passwort:" msgid "IRC nick and server may not contain whitespace" msgstr "IRC-Server und -Spitzname dürfen keinen Leerraum enthalten" -msgid "SSL support unavailable" -msgstr "SSL-Unterstützung nicht verfügbar" - msgid "Unable to connect" msgstr "Verbindung nicht möglich" @@ -3474,7 +3532,9 @@ msgstr "IRC-Protokoll-Plugin" msgid "The IRC Protocol Plugin that Sucks Less" msgstr "Das IRC-Protokoll-Plugin mit weniger Problemen" -#. host to connect to +#. set up account ID as user:server +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Server" msgstr "Server" @@ -4013,6 +4073,8 @@ msgstr "Die Verbindung mit dem Server konnte nicht hergestellt werden: %s" msgid "Unable to establish SSL connection" msgstr "Kann SSL-Verbindung nicht erstellen" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Full Name" msgstr "Vollständiger Name" @@ -4083,9 +4145,13 @@ msgstr "" "Die folgenden Punkte sind optional. Geben Sie nur die Informationen an, die " "Sie angeben möchten." +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Client" msgstr "Client" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Operating System" msgstr "Betriebssystem" @@ -4095,6 +4161,8 @@ msgstr "Lokale Zeit" msgid "Priority" msgstr "Priorität" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Resource" msgstr "Ressource" @@ -4191,9 +4259,6 @@ msgstr "" "Füllen Sie ein oder mehrere Felder aus, um nach entsprechenden XMPP-" "Benutzern zu suchen." -msgid "Email Address" -msgstr "E-Mail-Adresse" - msgid "Search for XMPP users" msgstr "Suche nach XMPP-Benutzern" @@ -4404,6 +4469,8 @@ msgstr "Server unterstützt kein Blockieren" msgid "Not Authorized" msgstr "Nicht autorisiert" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Mood" msgstr "Stimmung" @@ -5253,9 +5320,6 @@ msgstr "Kann die Nachricht nicht parsen" msgid "Syntax Error (probably a client bug)" msgstr "Syntaxfehler (wahrscheinlich ein Client-Bug)" -msgid "Invalid email address" -msgstr "Ungültige E-Mail-Adresse" - msgid "User does not exist" msgstr "Benutzer existiert nicht" @@ -5323,9 +5387,6 @@ msgstr "Zu viele Treffer zu einem FND" msgid "Not logged in" msgstr "Nicht angemeldet" -msgid "Service temporarily unavailable" -msgstr "Dienst momentan nicht verfügbar" - msgid "Database server error" msgstr "Fehler des Datenbank-Servers" @@ -5673,6 +5734,8 @@ msgstr "Alter" msgid "Occupation" msgstr "Beruf" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Location" msgstr "Ort" @@ -6056,9 +6119,6 @@ msgstr "Buddy aus dem Adressbuch löschen?" msgid "Do you want to delete this buddy from your address book as well?" msgstr "Möchten Sie diesen Buddy außerdem aus Ihrem Adressbuch löschen?" -msgid "The username specified is invalid." -msgstr "Der angegebene Benutzername ist ungültig." - msgid "The Display Name you entered is invalid." msgstr "Der eingegebene Anzeigename ist ungültig." @@ -6074,6 +6134,8 @@ msgstr "Profil-Aktualisierungsfehler" #. no profile information yet, so we cannot update #. (reference: "libpurple/request.h") +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Profile" msgstr "Profil" @@ -6187,6 +6249,8 @@ msgstr "Startbildschirm anzeigen..." msgid "About..." msgstr "Über..." +#. we are trying to send a file to MXit +#. need to reserve some space for packet headers #. the file is too big msgid "The file you are trying to send is too large!" msgstr "Die Datei, die Sie senden möchten ist zu groß!" @@ -6307,16 +6371,14 @@ msgstr "Sie haben eingeladen" msgid "Loading menu..." msgstr "Lade das Menü..." +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status Message" msgstr "Status-Nachricht" msgid "Rejection Message" msgstr "Ablehnungsnachricht" -#. hidden number -msgid "Hidden Number" -msgstr "Versteckte Nummer" - msgid "No profile available" msgstr "Kein Profil verfügbar" @@ -6400,6 +6462,12 @@ msgstr "" msgid "Message Error" msgstr "Nachrichtenfehler" +#. could not be decrypted +msgid "An encrypted message was received which could not be decrypted." +msgstr "" +"Eine verschlüsselte Nachricht wurde empfangen und konnte nicht entschlüsselt " +"werden." + msgid "Cannot perform redirect using the specified protocol" msgstr "Kann die Umleitung nicht mit dem angegebenen Protokoll durchführen" @@ -6664,18 +6732,26 @@ msgstr "Bildschirmauflösung (dpi)" msgid "Base font size (points)" msgstr "Basis-Schriftgröße (Punkt)" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User" msgstr "Benutzer" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Headline" msgstr "Überschrift" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Song" msgstr "Lied" msgid "Total Friends" msgstr "Freunde insgesamt" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Client Version" msgstr "Client-Version" @@ -6879,9 +6955,6 @@ msgstr "Nicht unterstützt" msgid "Password has expired" msgstr "Passwort ist abgelaufen" -msgid "Incorrect password" -msgstr "Falsches Passwort" - msgid "Account has been disabled" msgstr "Konto wurde deaktiviert" @@ -6908,12 +6981,6 @@ msgstr "" "Konnte den Rechnernamen des Benutzers, den Sie eingegeben haben, nicht " "erkennen" -msgid "" -"Your account has been disabled because too many incorrect passwords were " -"entered" -msgstr "" -"Ihr Konto wurde wegen zu vielen falsch eingegebenen Passworten gesperrt" - msgid "You cannot add the same person twice to a conversation" msgstr "Sie können die selbe Person nicht zweimal zu einem Gespräch hinzufügen" @@ -7039,12 +7106,9 @@ msgstr "Hauspostcode" msgid "User ID" msgstr "Benutzer-ID" -#. tag = _("DN"); -#. value = nm_user_record_get_dn(user_record); -#. if (value) { -#. purple_notify_user_info_add_pair(user_info, tag, value); -#. } -#. +msgid "DN" +msgstr "DN" + msgid "Full name" msgstr "Vollständiger Name" @@ -8147,6 +8211,7 @@ msgstr "Benutzerinformation nicht verfügbar: %s" msgid "Mobile Phone" msgstr "Handynummer" +#. TODO: Is it correct to pass info->email here...? msgid "Personal Web Page" msgstr "Persönliche Webseite" @@ -8167,6 +8232,7 @@ msgstr "Abteilung" msgid "Position" msgstr "Position" +#. TODO: Is it correct to pass info->email here...? msgid "Web Page" msgstr "Webseite" @@ -8433,33 +8499,16 @@ msgstr "Sende TEST-Nachricht" msgid "Topic:" msgstr "Thema:" -msgid "No Sametime Community Server specified" -msgstr "Kein Sametime-Community Server angegeben" - -#, c-format -msgid "" -"No host or IP address has been configured for the Meanwhile account %s. " -"Please enter one below to continue logging in." -msgstr "" -"Es wurde kein Rechner für das Meanwhile-Konto %s angegeben. Bitte geben Sie " -"einen Rechner an, um die Anmeldung fortzusetzen." - -msgid "Meanwhile Connection Setup" -msgstr "Meanwhile-Verbindungseinstellungen" +msgid "A server is required to connect this account" +msgstr "Es wird ein Server benötigt um dieses Konto zu verbinden." -msgid "No Sametime Community Server Specified" -msgstr "Kein Sametime-Community Server angegeben" - -msgid "Connect" -msgstr "Verbinden" +msgid "Last Known Client" +msgstr "Letzter bekannter Client" #, c-format msgid "Unknown (0x%04x)
" msgstr "Unbekannt (0x%04x)
" -msgid "Last Known Client" -msgstr "Letzter bekannter Client" - msgid "User Name" msgstr "Benutzername" @@ -8782,21 +8831,33 @@ msgstr "Hyperaktiv" msgid "Robot" msgstr "Robot" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User Modes" msgstr "Benutzermodi" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Contact" msgstr "Bevorzugter Kontakt" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Language" msgstr "Bevorzugte Sprache" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Device" msgstr "Gerät" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Timezone" msgstr "Zeitzone" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Geolocation" msgstr "Geographische Koordinaten" @@ -9666,78 +9727,12 @@ msgstr "" msgid "Whiteboard" msgstr "Whiteboard" -msgid "No server statistics available" -msgstr "Keine Serverstatistik verfügbar" - -msgid "Error during connecting to SILC Server" -msgstr "Fehler beim Verbinden mit dem SILC-Server" - -#, c-format -msgid "Failure: Version mismatch, upgrade your client" -msgstr "Fehler: Unterschiedliche Version, aktualisieren Sie Ihren Client" - -#, c-format -msgid "Failure: Remote does not trust/support your public key" -msgstr "" -"Fehler: Die entfernte Seite vertraut Ihrem öffentlichen Schlüssel nicht" - -#, c-format -msgid "Failure: Remote does not support proposed KE group" -msgstr "" -"Fehler: Entferntes Programm unterstützt nicht die vorgeschlagen KE-Gruppe" - -#, c-format -msgid "Failure: Remote does not support proposed cipher" -msgstr "" -"Fehler: Entferntes Programm unterstützt die vorgeschlagene Chiffre nicht" - -#, c-format -msgid "Failure: Remote does not support proposed PKCS" -msgstr "Fehler: Entferntes Programm unterstützt die vorgeschlagene PKCS nicht" - -#, c-format -msgid "Failure: Remote does not support proposed hash function" -msgstr "" -"Fehler: Entferntes Programm unterstützt die vorgeschlagen Hashfunktion nicht" - -#, c-format -msgid "Failure: Remote does not support proposed HMAC" -msgstr "Fehler: Entferntes Programm unterstützt das vorgeschlagene HMAC nicht" - -#, c-format -msgid "Failure: Incorrect signature" -msgstr "Fehler: Falsche Signatur" - -#, c-format -msgid "Failure: Invalid cookie" -msgstr "Fehler: Ungültiger Cookie" - -#, c-format -msgid "Failure: Authentication failed" -msgstr "Fehler: Authentifizierung fehlgeschlagen" - -msgid "Unable to initialize SILC Client connection" -msgstr "SILC-Client-Verbindung konnte nicht hergestellt werden" - -msgid "John Noname" -msgstr "Max Mustermann" - -#, c-format -msgid "Unable to load SILC key pair: %s" -msgstr "SILC-Schlüsselpaar konnte nicht geladen werden: %s" - -msgid "Unable to create connection" -msgstr "Kann Verbindung nicht erstellen" - msgid "Unknown server response" msgstr "Unbekannte Serverantwort" msgid "Unable to create listen socket" msgstr "Lauschender Socket konnte nicht erstellt werden" -msgid "Unable to resolve hostname" -msgstr "Hostname konnte nicht aufgelöst werden" - msgid "SIP usernames may not contain whitespaces or @ symbols" msgstr "SIP-Benutzernamen dürfen keine Leerzeichen oder @-Symbole enthalten" @@ -10218,6 +10213,8 @@ msgstr "Kann nicht an den Chat %s,%s,%s senden" msgid "Hidden or not logged-in" msgstr "Versteckt oder nicht angemeldet" +#. TODO: Need to escape locs.host and locs.time? +#. TODO: Need to escape the two strings that make up tmp? #, c-format msgid "
At %s since %s" msgstr "
Bei %s seit %s" @@ -10426,9 +10423,6 @@ msgstr "Gespeichertes Bild" msgid "Stored Image. (that'll have to do for now)" msgstr "Gespeichertes Bild. (Das muss erstmal reichen)" -msgid "SSL Connection Failed" -msgstr "SSL-Verbindung gescheitert" - msgid "SSL Handshake Failed" msgstr "SSL-Verhandlung gescheitert" @@ -11394,6 +11388,21 @@ msgstr "Geben Sie einen Hostnamen für dieses Zertifikat an." msgid "SSL Servers" msgstr "SSL-Server" +msgid "Unsafe debugging is now disabled." +msgstr "Unsicheres Debugging ist nun deaktiviert." + +msgid "Unsafe debugging is now enabled." +msgstr "Unsicheres Debugging ist nun aktiviert." + +msgid "Verbose debugging is now disabled." +msgstr "Ausführliches Debugging ist nun deaktiviert." + +msgid "Verbose debugging is now enabled." +msgstr "Ausführliches Debugging ist nun aktiviert." + +msgid "Supported debug options are: plugins version unsafe verbose" +msgstr "Unterstützte Debug-Optionen sind: plugins version unsafe verbose" + msgid "Unknown command." msgstr "Unbekanntes Kommando." @@ -11428,9 +11437,6 @@ msgstr "Nicht Ignorieren" msgid "Ignore" msgstr "Ignorieren" -msgid "Get Away Message" -msgstr "Neue Abwesenheitsnachricht abholen" - msgid "Last Said" msgstr "Zuletzt gesagt" @@ -12178,12 +12184,6 @@ msgstr "" msgid "View User Log" msgstr "Benutzer-Mitschnitt anzeigen" -msgid "Alias Contact" -msgstr "Kontakt-Alias" - -msgid "Enter an alias for this contact." -msgstr "Geben Sie einen Alias für diesen Kontakt ein." - #, c-format msgid "Enter an alias for %s." msgstr "Geben Sie einen Alias %s ein." @@ -12779,9 +12779,18 @@ msgstr "%s möchte eine Video-Sitzung mit Ihnen starten." msgid "Incoming Call" msgstr "Eingehender Anruf" +msgid "_Hold" +msgstr "_Halten" + msgid "_Pause" msgstr "_Pause" +msgid "_Mute" +msgstr "Stu_mmschalten" + +msgid "Call in progress" +msgstr "Anruf im Gange" + #, c-format msgid "%s has %d new message." msgid_plural "%s has %d new messages." @@ -13004,6 +13013,9 @@ msgstr "Das Standard-Klangthema für Pidgin" msgid "The default Pidgin buddy list theme" msgstr "Das Standard-Buddy-Listen-Thema für Pidgin" +msgid "The default Pidgin conversation theme" +msgstr "Das Standard-Thema für Pidgin-Unterhaltungen" + msgid "The default Pidgin status icon theme" msgstr "Das Standard-Status-Icon-Thema für Pidgin" @@ -13031,6 +13043,13 @@ msgstr "" msgid "Buddy List Theme:" msgstr "Buddy-Listen-Thema:" +msgid "Conversation Theme:" +msgstr "Unterhaltungs-Thema:" + +#, fuzzy +msgid "\tVariant:" +msgstr "\tVariante:" + msgid "Status Icon Theme:" msgstr "Status-Icon-Thema:" -- cgit v1.2.1 From 6b54832dbb27187d0e725e69809b9c942a531fa2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 27 Dec 2011 22:00:00 +0000 Subject: Add page up/down for WebKit view. --- pidgin/gtkconv.c | 10 ++-------- pidgin/gtkwebview.c | 35 +++++++++++++++++++++++++++++++++++ pidgin/gtkwebview.h | 14 ++++++++++++++ 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index e1f1d53fb7..8f1125d721 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -2186,19 +2186,13 @@ entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) case GDK_Page_Up: case GDK_KP_Page_Up: -/* TODO WEBKIT: Write this. */ -#if 0 - gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml)); -#endif /* if 0 */ + gtk_webview_page_up(GTK_WEBVIEW(gtkconv->webview)); return TRUE; break; case GDK_Page_Down: case GDK_KP_Page_Down: -/* TODO WEBKIT: Write this. */ -#if 0 - gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); -#endif /* if 0 */ + gtk_webview_page_down(GTK_WEBVIEW(gtkconv->webview)); return TRUE; break; diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 9317045098..20fb958f3b 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -394,6 +394,41 @@ gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) } } +void gtk_webview_page_up(GtkWebView *webview) +{ + GtkAdjustment *vadj = webview->priv->vadj; + gdouble scroll_val; + +#if GTK_CHECK_VERSION(2,14,0) + scroll_val = gtk_adjustment_get_value(vadj) - gtk_adjustment_get_page_size(vadj); + scroll_val = MAX(scroll_val, gtk_adjustment_get_lower(vadj)); +#else + scroll_val = gtk_adjustment_get_value(vadj) - vadj->page_size; + scroll_val = MAX(scroll_val, vadj->lower); +#endif + + gtk_adjustment_set_value(vadj, scroll_val); +} + +void gtk_webview_page_down(GtkWebView *webview) +{ + GtkAdjustment *vadj = webview->priv->vadj; + gdouble scroll_val; + gdouble page_size; + +#if GTK_CHECK_VERSION(2,14,0) + page_size = gtk_adjustment_get_page_size(vadj); + scroll_val = gtk_adjustment_get_value(vadj) + page_size; + scroll_val = MIN(scroll_val, gtk_adjustment_get_upper(vadj) - page_size); +#else + page_size = vadj->page_size; + scroll_val = gtk_adjustment_get_value(vadj) + page_size; + scroll_val = MIN(scroll_val, vadj->upper - page_size); +#endif + + gtk_adjustment_set_value(vadj, scroll_val); +} + GType gtk_webview_get_type(void) { diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index ce0b608499..f944e260aa 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -143,5 +143,19 @@ char *gtk_webview_quote_js_string(const char *str); */ void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth); +/** + * Scrolls a GtkWebView up by one page. + * + * @param webview The GtkWebView. + */ +void gtk_webview_page_up(GtkWebView *webview); + +/** + * Scrolls a GtkWebView down by one page. + * + * @param webview The GtkWebView. + */ +void gtk_webview_page_down(GtkWebView *webview); + #endif /* _PIDGIN_WEBVIEW_H_ */ -- cgit v1.2.1 From c2aaeea4099d489f40bd3a2351f96edb8fde3d79 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 28 Dec 2011 05:07:15 +0000 Subject: JS-ify the markerline plugin. --- pidgin/plugins/Makefile.am | 4 ++ pidgin/plugins/markerline.c | 120 ++++++++++---------------------------------- 2 files changed, 30 insertions(+), 94 deletions(-) diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index 4485e025e2..1741d15670 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -38,6 +38,7 @@ gtk_signals_test_la_LDFLAGS = -module -avoid-version gtkbuddynote_la_LDFLAGS = -module -avoid-version history_la_LDFLAGS = -module -avoid-version iconaway_la_LDFLAGS = -module -avoid-version +markerline_la_LDFLAGS = -module -avoid-version notify_la_LDFLAGS = -module -avoid-version pidginrc_la_LDFLAGS = -module -avoid-version relnot_la_LDFLAGS = -module -avoid-version @@ -56,6 +57,7 @@ plugin_LTLIBRARIES = \ gtkbuddynote.la \ history.la \ iconaway.la \ + markerline.la \ notify.la \ pidginrc.la \ relnot.la \ @@ -80,6 +82,7 @@ gtk_signals_test_la_SOURCES = gtk-signals-test.c gtkbuddynote_la_SOURCES = gtkbuddynote.c history_la_SOURCES = history.c iconaway_la_SOURCES = iconaway.c +markerline_la_SOURCES = markerline.c notify_la_SOURCES = notify.c pidginrc_la_SOURCES = pidginrc.c relnot_la_SOURCES = relnot.c @@ -96,6 +99,7 @@ gtk_signals_test_la_LIBADD = $(GTK_LIBS) gtkbuddynote_la_LIBADD = $(GTK_LIBS) history_la_LIBADD = $(GTK_LIBS) iconaway_la_LIBADD = $(GTK_LIBS) +markerline_la_LIBADD = $(GTK_LIBS) $(WEBKIT_LIBS) notify_la_LIBADD = $(GTK_LIBS) pidginrc_la_LIBADD = $(GTK_LIBS) relnot_la_LIBADD = $(GLIB_LIBS) diff --git a/pidgin/plugins/markerline.c b/pidgin/plugins/markerline.c index 7db983f3f2..461da4fd61 100644 --- a/pidgin/plugins/markerline.c +++ b/pidgin/plugins/markerline.c @@ -33,81 +33,38 @@ /* Purple headers */ #include -#include #include +#include #include #define PREF_PREFIX "/plugins/gtk/" PLUGIN_ID #define PREF_IMS PREF_PREFIX "/ims" #define PREF_CHATS PREF_PREFIX "/chats" -static int -imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *gtkconv) -{ - int y, last_y, offset; - GdkRectangle visible_rect; - GtkTextIter iter; - GdkRectangle buf; - int pad; - PurpleConversation *conv = gtkconv->active_conv; - PurpleConversationType type = purple_conversation_get_type(conv); - - if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || - (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS))) - return FALSE; - - gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &visible_rect); - - offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "markerline")); - if (offset) - { - gtk_text_buffer_get_iter_at_offset(gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)), - &iter, offset); - - gtk_text_view_get_iter_location(GTK_TEXT_VIEW(widget), &iter, &buf); - last_y = buf.y + buf.height; - pad = (gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(widget)) + - gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(widget))) / 2; - last_y += pad; - } - else - last_y = 0; - - gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, - 0, last_y, 0, &y); - - if (y >= event->area.y) - { - GdkColor red = {0, 0xffff, 0, 0}; - cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(event->window)); - - gdk_cairo_set_source_color(cr, &red); - cairo_move_to(cr, 0.0, y + 0.5); - cairo_rel_line_to(cr, visible_rect.width, 0.0); - cairo_set_line_width(cr, 1.0); - cairo_stroke(cr); - cairo_destroy(cr); - } - return FALSE; -} - static void update_marker_for_gtkconv(PidginConversation *gtkconv) { - GtkTextIter iter; - GtkTextBuffer *buffer; + PurpleConversation *conv; + PurpleConversationType type; + g_return_if_fail(gtkconv != NULL); - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); + conv = gtkconv->active_conv; + type = purple_conversation_get_type(conv); - if (!gtk_text_buffer_get_char_count(buffer)) + if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || + (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS))) return; - gtk_text_buffer_get_end_iter(buffer, &iter); - - g_object_set_data(G_OBJECT(gtkconv->imhtml), "markerline", - GINT_TO_POINTER(gtk_text_iter_get_offset(&iter))); - gtk_widget_queue_draw(gtkconv->imhtml); + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), + "var mhr = document.getElementById(\"markerhr\");" + "if (!mhr) {" + "mhr = document.createElement(\"hr\");" + "mhr.setAttribute(\"id\", \"markerhr\");" + "mhr.setAttribute(\"color\", \"#ff0000\");" + "mhr.setAttribute(\"size\", \"1\");" + "}" + "document.getElementById(\"Chat\").appendChild(mhr);"); } static gboolean @@ -125,28 +82,6 @@ focus_removed(GtkWidget *widget, GdkEventVisibility *event, PidginWindow *win) return FALSE; } -#if 0 -static gboolean -window_resized(GtkWidget *w, GdkEventConfigure *event, PidginWindow *win) -{ - GList *list; - - list = pidgin_conv_window_get_gtkconvs(win); - - for (; list; list = list->next) - update_marker_for_gtkconv(list->data); - - return FALSE; -} - -static gboolean -imhtml_resize_cb(GtkWidget *w, GtkAllocation *allocation, PidginConversation *gtkconv) -{ - gtk_widget_queue_draw(w); - return FALSE; -} -#endif - static void page_switched(GtkWidget *widget, GtkWidget *page, gint num, PidginWindow *win) { @@ -156,7 +91,9 @@ page_switched(GtkWidget *widget, GtkWidget *page, gint num, PidginWindow *win) static void detach_from_gtkconv(PidginConversation *gtkconv, gpointer null) { - g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->imhtml), imhtml_expose_cb, gtkconv); + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), + "var mhr = document.getElementById(\"markerhr\");" + "if (mhr) mhr.parentNode.removeChild(mhr);"); } static void @@ -165,16 +102,13 @@ detach_from_pidgin_window(PidginWindow *win, gpointer null) g_list_foreach(pidgin_conv_window_get_gtkconvs(win), (GFunc)detach_from_gtkconv, NULL); g_signal_handlers_disconnect_by_func(G_OBJECT(win->notebook), page_switched, win); g_signal_handlers_disconnect_by_func(G_OBJECT(win->window), focus_removed, win); - - gtk_widget_queue_draw(win->window); } static void attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) { detach_from_gtkconv(gtkconv, NULL); - g_signal_connect(G_OBJECT(gtkconv->imhtml), "expose_event", - G_CALLBACK(imhtml_expose_cb), gtkconv); + update_marker_for_gtkconv(gtkconv); } static void @@ -187,8 +121,6 @@ attach_to_pidgin_window(PidginWindow *win, gpointer null) g_signal_connect(G_OBJECT(win->notebook), "switch_page", G_CALLBACK(page_switched), win); - - gtk_widget_queue_draw(win->window); } static void @@ -220,15 +152,15 @@ static void jump_to_markerline(PurpleConversation *conv, gpointer null) { PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - int offset; - GtkTextIter iter; if (!gtkconv) return; - offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkconv->imhtml), "markerline")); - gtk_text_buffer_get_iter_at_offset(GTK_IMHTML(gtkconv->imhtml)->text_buffer, &iter, offset); - gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(gtkconv->imhtml), &iter, 0, TRUE, 0, 0); + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), + "var mhr = document.getElementById(\"markerhr\");" + "if (mhr) {" + "window.scroll(0, mhr.offsetTop);" + "}"); } static void -- cgit v1.2.1 From aeb7670791b503b834ad802587b762d4c1272e63 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 28 Dec 2011 08:47:49 +0000 Subject: Since XMPP is already a split-prpl thing, make two new prpls for Facebook and Google Talk, to replace the UI hacks. This is a lazy first commit though, just copying the files. This'll make setting up the GTK+3 stuff easier. --- libpurple/protocols/jabber/Makefile.am | 10 +- libpurple/protocols/jabber/Makefile.mingw | 20 +- libpurple/protocols/jabber/libfacebook.c | 328 ++++++++++++++++++++++++++++++ libpurple/protocols/jabber/libgtalk.c | 328 ++++++++++++++++++++++++++++++ 4 files changed, 683 insertions(+), 3 deletions(-) create mode 100644 libpurple/protocols/jabber/libfacebook.c create mode 100644 libpurple/protocols/jabber/libgtalk.c diff --git a/libpurple/protocols/jabber/Makefile.am b/libpurple/protocols/jabber/Makefile.am index 9fdd3a9476..0e6d7fa790 100644 --- a/libpurple/protocols/jabber/Makefile.am +++ b/libpurple/protocols/jabber/Makefile.am @@ -103,19 +103,25 @@ if STATIC_JABBER st = -DPURPLE_STATIC_PRPL noinst_LTLIBRARIES = libjabber.la -libjabber_la_SOURCES = $(JABBERSOURCES) libxmpp.c +libjabber_la_SOURCES = $(JABBERSOURCES) libfacebook.c libgtalk.c libxmpp.c libjabber_la_CFLAGS = $(AM_CFLAGS) else st = -pkg_LTLIBRARIES = libjabber.la libxmpp.la +pkg_LTLIBRARIES = libjabber.la libfacebook.la libgtalk.la libxmpp.la libjabber_la_SOURCES = $(JABBERSOURCES) libjabber_la_LIBADD = $(GLIB_LIBS) $(SASL_LIBS) $(LIBXML_LIBS) $(IDN_LIBS)\ $(FARSIGHT_LIBS) \ $(GSTREAMER_LIBS) \ $(GSTINTERFACES_LIBS) +libfacebook_la_SOURCES = libfacebook.c +libfacebook_la_LIBADD = libjabber.la + +libgtalk_la_SOURCES = libgtalk.c +libgtalk_la_LIBADD = libjabber.la + libxmpp_la_SOURCES = libxmpp.c libxmpp_la_LIBADD = libjabber.la diff --git a/libpurple/protocols/jabber/Makefile.mingw b/libpurple/protocols/jabber/Makefile.mingw index 4e9f9f9db6..3d19d5d51b 100644 --- a/libpurple/protocols/jabber/Makefile.mingw +++ b/libpurple/protocols/jabber/Makefile.mingw @@ -8,6 +8,8 @@ PIDGIN_TREE_TOP := ../../.. include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak TARGET = libjabber +FACEBOOK_TARGET = libfacebook +GTALK_TARGET = libgtalk XMPP_TARGET = libxmpp TYPE = PLUGIN @@ -90,6 +92,12 @@ C_SRC = \ OBJECTS = $(C_SRC:%.c=%.o) +FACEBOOK_C_SRC = libfacebook.c +FACEBOOK_OBJECTS = $(FACEBOOK_C_SRC:%.c=%.o) + +GTALK_C_SRC = libgtalk.c +GTALK_OBJECTS = $(GTALK_C_SRC:%.c=%.o) + XMPP_C_SRC = libxmpp.c XMPP_OBJECTS = $(XMPP_C_SRC:%.c=%.o) @@ -129,9 +137,11 @@ include $(PIDGIN_COMMON_RULES) ## .PHONY: all install clean -all: $(TARGET).dll $(XMPP_TARGET).dll +all: $(TARGET).dll $(FACEBOOK_TARGET).dll $(GTALK_TARGET).dll $(XMPP_TARGET).dll install: all $(DLL_INSTALL_DIR) + cp $(FACEBOOK_TARGET).dll $(DLL_INSTALL_DIR) + cp $(GTALK_TARGET).dll $(DLL_INSTALL_DIR) cp $(XMPP_TARGET).dll $(DLL_INSTALL_DIR) cp $(TARGET).dll $(PURPLE_INSTALL_DIR) ifeq ($(CYRUS_SASL), 1) @@ -145,6 +155,12 @@ $(OBJECTS): $(PURPLE_CONFIG_H) $(TARGET).dll $(TARGET).dll.a: $(PURPLE_DLL).a $(OBJECTS) $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).dll.a -o $(TARGET).dll +$(FACEBOOK_TARGET).dll: $(TARGET).dll.a $(FACEBOOK_OBJECTS) + $(CC) -shared $(FACEBOOK_OBJECTS) $(LIB_PATHS) $(LIBS) -ljabber $(DLL_LD_FLAGS) -o $(FACEBOOK_TARGET).dll + +$(GTALK_TARGET).dll: $(TARGET).dll.a $(GTALK_OBJECTS) + $(CC) -shared $(GTALK_OBJECTS) $(LIB_PATHS) $(LIBS) -ljabber $(DLL_LD_FLAGS) -o $(GTALK_TARGET).dll + $(XMPP_TARGET).dll: $(TARGET).dll.a $(XMPP_OBJECTS) $(CC) -shared $(XMPP_OBJECTS) $(LIB_PATHS) $(LIBS) -ljabber $(DLL_LD_FLAGS) -o $(XMPP_TARGET).dll @@ -153,6 +169,8 @@ $(XMPP_TARGET).dll: $(TARGET).dll.a $(XMPP_OBJECTS) ## clean: rm -f $(OBJECTS) $(TARGET).dll $(TARGET).dll.a + rm -f $(FACEBOOK_OBJECTS) $(FACEBOOK_TARGET).dll + rm -f $(GTALK_OBJECTS) $(GTALK_TARGET).dll rm -f $(XMPP_OBJECTS) $(XMPP_TARGET).dll include $(PIDGIN_COMMON_TARGETS) diff --git a/libpurple/protocols/jabber/libfacebook.c b/libpurple/protocols/jabber/libfacebook.c new file mode 100644 index 0000000000..e0cc371173 --- /dev/null +++ b/libpurple/protocols/jabber/libfacebook.c @@ -0,0 +1,328 @@ +/* purple + * + * Purple is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * + */ + +/* libfacebook is the Facebook XMPP protocol plugin. It is linked against + * libjabbercommon, which may be used to support other protocols (Bonjour) + * which may need to share code. + */ + +#include "internal.h" + +#include "accountopt.h" +#include "core.h" +#include "debug.h" +#include "version.h" + +#include "iq.h" +#include "jabber.h" +#include "chat.h" +#include "disco.h" +#include "message.h" +#include "roster.h" +#include "si.h" +#include "message.h" +#include "presence.h" +#include "google/google.h" +#include "pep.h" +#include "usermood.h" +#include "usertune.h" +#include "caps.h" +#include "data.h" +#include "ibb.h" + +static PurplePlugin *my_protocol = NULL; + +static PurplePluginProtocolInfo prpl_info = +{ + sizeof(PurplePluginProtocolInfo), /* struct_size */ + OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_MAIL_CHECK | +#ifdef HAVE_CYRUS_SASL + OPT_PROTO_PASSWORD_OPTIONAL | +#endif + OPT_PROTO_SLASH_COMMANDS_NATIVE, + NULL, /* user_splits */ + NULL, /* protocol_options */ + {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ + jabber_list_icon, /* list_icon */ + jabber_list_emblem, /* list_emblems */ + jabber_status_text, /* status_text */ + jabber_tooltip_text, /* tooltip_text */ + jabber_status_types, /* status_types */ + jabber_blist_node_menu, /* blist_node_menu */ + jabber_chat_info, /* chat_info */ + jabber_chat_info_defaults, /* chat_info_defaults */ + jabber_login, /* login */ + jabber_close, /* close */ + jabber_message_send_im, /* send_im */ + jabber_set_info, /* set_info */ + jabber_send_typing, /* send_typing */ + jabber_buddy_get_info, /* get_info */ + jabber_set_status, /* set_status */ + jabber_idle_set, /* set_idle */ + NULL, /* change_passwd */ + jabber_roster_add_buddy, /* add_buddy */ + NULL, /* add_buddies */ + jabber_roster_remove_buddy, /* remove_buddy */ + NULL, /* remove_buddies */ + NULL, /* add_permit */ + jabber_add_deny, /* add_deny */ + NULL, /* rem_permit */ + jabber_rem_deny, /* rem_deny */ + NULL, /* set_permit_deny */ + jabber_chat_join, /* join_chat */ + NULL, /* reject_chat */ + jabber_get_chat_name, /* get_chat_name */ + jabber_chat_invite, /* chat_invite */ + jabber_chat_leave, /* chat_leave */ + NULL, /* chat_whisper */ + jabber_message_send_chat, /* chat_send */ + jabber_keepalive, /* keepalive */ + jabber_register_account, /* register_user */ + NULL, /* get_cb_info */ + jabber_roster_alias_change, /* alias_buddy */ + jabber_roster_group_change, /* group_buddy */ + jabber_roster_group_rename, /* rename_group */ + NULL, /* buddy_free */ + jabber_convo_closed, /* convo_closed */ + jabber_normalize, /* normalize */ + jabber_set_buddy_icon, /* set_buddy_icon */ + NULL, /* remove_group */ + jabber_chat_buddy_real_name, /* get_cb_real_name */ + jabber_chat_set_topic, /* set_chat_topic */ + jabber_find_blist_chat, /* find_blist_chat */ + jabber_roomlist_get_list, /* roomlist_get_list */ + jabber_roomlist_cancel, /* roomlist_cancel */ + NULL, /* roomlist_expand_category */ + jabber_can_receive_file, /* can_receive_file */ + jabber_si_xfer_send, /* send_file */ + jabber_si_new_xfer, /* new_xfer */ + jabber_offline_message, /* offline_message */ + NULL, /* whiteboard_prpl_ops */ + jabber_prpl_send_raw, /* send_raw */ + jabber_roomlist_room_serialize, /* roomlist_room_serialize */ + jabber_unregister_account, /* unregister_user */ + jabber_send_attention, /* send_attention */ + jabber_attention_types, /* attention_types */ + NULL, /* get_account_text_table */ + jabber_initiate_media, /* initiate_media */ + jabber_get_media_caps, /* get_media_caps */ + jabber_get_moods, /* get_moods */ + NULL, /* set_public_alias */ + NULL /* get_public_alias */ +}; + +static gboolean load_plugin(PurplePlugin *plugin) +{ + jabber_plugin_init(plugin); + + return TRUE; +} + +static gboolean unload_plugin(PurplePlugin *plugin) +{ + jabber_plugin_uninit(plugin); + + return TRUE; +} + +static PurplePluginInfo info = +{ + PURPLE_PLUGIN_MAGIC, + PURPLE_MAJOR_VERSION, + PURPLE_MINOR_VERSION, + PURPLE_PLUGIN_PROTOCOL, /**< type */ + NULL, /**< ui_requirement */ + 0, /**< flags */ + NULL, /**< dependencies */ + PURPLE_PRIORITY_DEFAULT, /**< priority */ + + "prpl-facebook-xmpp", /**< id */ + "Facebook (XMPP)", /**< name */ + DISPLAY_VERSION, /**< version */ + /** summary */ + N_("Facebook XMPP Protocol Plugin"), + /** description */ + N_("Facebook XMPP Protocol Plugin"), + NULL, /**< author */ + PURPLE_WEBSITE, /**< homepage */ + + load_plugin, /**< load */ + unload_plugin, /**< unload */ + NULL, /**< destroy */ + + NULL, /**< ui_info */ + &prpl_info, /**< extra_info */ + NULL, /**< prefs_info */ + jabber_actions, + + /* padding */ + NULL, + NULL, + NULL, + NULL +}; + +static PurpleAccount *find_acct(const char *prpl, const char *acct_id) +{ + PurpleAccount *acct = NULL; + + /* If we have a specific acct, use it */ + if (acct_id) { + acct = purple_accounts_find(acct_id, prpl); + if (acct && !purple_account_is_connected(acct)) + acct = NULL; + } else { /* Otherwise find an active account for the protocol */ + GList *l = purple_accounts_get_all(); + while (l) { + if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) + && purple_account_is_connected(l->data)) { + acct = l->data; + break; + } + l = l->next; + } + } + + return acct; +} + +static gboolean xmpp_uri_handler(const char *proto, const char *user, GHashTable *params) +{ + char *acct_id = params ? g_hash_table_lookup(params, "account") : NULL; + PurpleAccount *acct; + + if (g_ascii_strcasecmp(proto, "xmpp")) + return FALSE; + + acct = find_acct(purple_plugin_get_id(my_protocol), acct_id); + + if (!acct) + return FALSE; + + /* xmpp:romeo@montague.net?message;subject=Test%20Message;body=Here%27s%20a%20test%20message */ + /* params is NULL if the URI has no '?' (or anything after it) */ + if (!params || g_hash_table_lookup_extended(params, "message", NULL, NULL)) { + char *body = g_hash_table_lookup(params, "body"); + if (user && *user) { + PurpleConversation *conv = + purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, user); + purple_conversation_present(conv); + if (body && *body) + purple_conv_send_confirm(conv, body); + } + } else if (g_hash_table_lookup_extended(params, "roster", NULL, NULL)) { + char *name = g_hash_table_lookup(params, "name"); + if (user && *user) + purple_blist_request_add_buddy(acct, user, NULL, name); + } else if (g_hash_table_lookup_extended(params, "join", NULL, NULL)) { + PurpleConnection *gc = purple_account_get_connection(acct); + if (user && *user) { + GHashTable *params = jabber_chat_info_defaults(gc, user); + jabber_chat_join(gc, params); + } + return TRUE; + } + + return FALSE; +} + + +static void +init_plugin(PurplePlugin *plugin) +{ + PurpleAccountUserSplit *split; + PurpleAccountOption *option; + GList *encryption_values = NULL; + + /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */ + split = purple_account_user_split_new(_("Domain"), NULL, '@'); + purple_account_user_split_set_reverse(split, FALSE); + prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); + + split = purple_account_user_split_new(_("Resource"), "", '/'); + purple_account_user_split_set_reverse(split, FALSE); + prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); + +#define ADD_VALUE(list, desc, v) { \ + PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1); \ + kvp->key = g_strdup((desc)); \ + kvp->value = g_strdup((v)); \ + list = g_list_prepend(list, kvp); \ +} + + ADD_VALUE(encryption_values, _("Require encryption"), "require_tls"); + ADD_VALUE(encryption_values, _("Use encryption if available"), "opportunistic_tls"); + ADD_VALUE(encryption_values, _("Use old-style SSL"), "old_ssl"); +#if 0 + ADD_VALUE(encryption_values, "None", "none"); +#endif + encryption_values = g_list_reverse(encryption_values); + +#undef ADD_VALUE + + option = purple_account_option_list_new(_("Connection security"), "connection_security", encryption_values); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_bool_new( + _("Allow plaintext auth over unencrypted streams"), + "auth_plain_in_clear", FALSE); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_int_new(_("Connect port"), "port", 5222); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_string_new(_("Connect server"), + "connect_server", NULL); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_string_new(_("File transfer proxies"), + "ft_proxies", + /* TODO: Is this an acceptable default? + * Also, keep this in sync as they add more servers */ + JABBER_DEFAULT_FT_PROXIES); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_string_new(_("BOSH URL"), + "bosh_url", NULL); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + /* this should probably be part of global smiley theme settings later on, + shared with MSN */ + option = purple_account_option_bool_new(_("Show Custom Smileys"), + "custom_smileys", TRUE); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + my_protocol = plugin; + + purple_signal_connect(purple_get_core(), "uri-handler", plugin, + PURPLE_CALLBACK(xmpp_uri_handler), NULL); +} + +PURPLE_INIT_PLUGIN(facebookxmpp, init_plugin, info); + diff --git a/libpurple/protocols/jabber/libgtalk.c b/libpurple/protocols/jabber/libgtalk.c new file mode 100644 index 0000000000..f3bfbce2ec --- /dev/null +++ b/libpurple/protocols/jabber/libgtalk.c @@ -0,0 +1,328 @@ +/* purple + * + * Purple is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * + */ + +/* libgtalk is the Google Talk XMPP protocol plugin. It is linked against + * libjabbercommon, which may be used to support other protocols (Bonjour) which + * may need to share code. + */ + +#include "internal.h" + +#include "accountopt.h" +#include "core.h" +#include "debug.h" +#include "version.h" + +#include "iq.h" +#include "jabber.h" +#include "chat.h" +#include "disco.h" +#include "message.h" +#include "roster.h" +#include "si.h" +#include "message.h" +#include "presence.h" +#include "google/google.h" +#include "pep.h" +#include "usermood.h" +#include "usertune.h" +#include "caps.h" +#include "data.h" +#include "ibb.h" + +static PurplePlugin *my_protocol = NULL; + +static PurplePluginProtocolInfo prpl_info = +{ + sizeof(PurplePluginProtocolInfo), /* struct_size */ + OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_MAIL_CHECK | +#ifdef HAVE_CYRUS_SASL + OPT_PROTO_PASSWORD_OPTIONAL | +#endif + OPT_PROTO_SLASH_COMMANDS_NATIVE, + NULL, /* user_splits */ + NULL, /* protocol_options */ + {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ + jabber_list_icon, /* list_icon */ + jabber_list_emblem, /* list_emblems */ + jabber_status_text, /* status_text */ + jabber_tooltip_text, /* tooltip_text */ + jabber_status_types, /* status_types */ + jabber_blist_node_menu, /* blist_node_menu */ + jabber_chat_info, /* chat_info */ + jabber_chat_info_defaults, /* chat_info_defaults */ + jabber_login, /* login */ + jabber_close, /* close */ + jabber_message_send_im, /* send_im */ + jabber_set_info, /* set_info */ + jabber_send_typing, /* send_typing */ + jabber_buddy_get_info, /* get_info */ + jabber_set_status, /* set_status */ + jabber_idle_set, /* set_idle */ + NULL, /* change_passwd */ + jabber_roster_add_buddy, /* add_buddy */ + NULL, /* add_buddies */ + jabber_roster_remove_buddy, /* remove_buddy */ + NULL, /* remove_buddies */ + NULL, /* add_permit */ + jabber_add_deny, /* add_deny */ + NULL, /* rem_permit */ + jabber_rem_deny, /* rem_deny */ + NULL, /* set_permit_deny */ + jabber_chat_join, /* join_chat */ + NULL, /* reject_chat */ + jabber_get_chat_name, /* get_chat_name */ + jabber_chat_invite, /* chat_invite */ + jabber_chat_leave, /* chat_leave */ + NULL, /* chat_whisper */ + jabber_message_send_chat, /* chat_send */ + jabber_keepalive, /* keepalive */ + jabber_register_account, /* register_user */ + NULL, /* get_cb_info */ + jabber_roster_alias_change, /* alias_buddy */ + jabber_roster_group_change, /* group_buddy */ + jabber_roster_group_rename, /* rename_group */ + NULL, /* buddy_free */ + jabber_convo_closed, /* convo_closed */ + jabber_normalize, /* normalize */ + jabber_set_buddy_icon, /* set_buddy_icon */ + NULL, /* remove_group */ + jabber_chat_buddy_real_name, /* get_cb_real_name */ + jabber_chat_set_topic, /* set_chat_topic */ + jabber_find_blist_chat, /* find_blist_chat */ + jabber_roomlist_get_list, /* roomlist_get_list */ + jabber_roomlist_cancel, /* roomlist_cancel */ + NULL, /* roomlist_expand_category */ + jabber_can_receive_file, /* can_receive_file */ + jabber_si_xfer_send, /* send_file */ + jabber_si_new_xfer, /* new_xfer */ + jabber_offline_message, /* offline_message */ + NULL, /* whiteboard_prpl_ops */ + jabber_prpl_send_raw, /* send_raw */ + jabber_roomlist_room_serialize, /* roomlist_room_serialize */ + jabber_unregister_account, /* unregister_user */ + jabber_send_attention, /* send_attention */ + jabber_attention_types, /* attention_types */ + NULL, /* get_account_text_table */ + jabber_initiate_media, /* initiate_media */ + jabber_get_media_caps, /* get_media_caps */ + jabber_get_moods, /* get_moods */ + NULL, /* set_public_alias */ + NULL /* get_public_alias */ +}; + +static gboolean load_plugin(PurplePlugin *plugin) +{ + jabber_plugin_init(plugin); + + return TRUE; +} + +static gboolean unload_plugin(PurplePlugin *plugin) +{ + jabber_plugin_uninit(plugin); + + return TRUE; +} + +static PurplePluginInfo info = +{ + PURPLE_PLUGIN_MAGIC, + PURPLE_MAJOR_VERSION, + PURPLE_MINOR_VERSION, + PURPLE_PLUGIN_PROTOCOL, /**< type */ + NULL, /**< ui_requirement */ + 0, /**< flags */ + NULL, /**< dependencies */ + PURPLE_PRIORITY_DEFAULT, /**< priority */ + + "prpl-gtalk", /**< id */ + "Google Talk (XMPP)", /**< name */ + DISPLAY_VERSION, /**< version */ + /** summary */ + N_("XMPP Protocol Plugin"), + /** description */ + N_("XMPP Protocol Plugin"), + NULL, /**< author */ + PURPLE_WEBSITE, /**< homepage */ + + load_plugin, /**< load */ + unload_plugin, /**< unload */ + NULL, /**< destroy */ + + NULL, /**< ui_info */ + &prpl_info, /**< extra_info */ + NULL, /**< prefs_info */ + jabber_actions, + + /* padding */ + NULL, + NULL, + NULL, + NULL +}; + +static PurpleAccount *find_acct(const char *prpl, const char *acct_id) +{ + PurpleAccount *acct = NULL; + + /* If we have a specific acct, use it */ + if (acct_id) { + acct = purple_accounts_find(acct_id, prpl); + if (acct && !purple_account_is_connected(acct)) + acct = NULL; + } else { /* Otherwise find an active account for the protocol */ + GList *l = purple_accounts_get_all(); + while (l) { + if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) + && purple_account_is_connected(l->data)) { + acct = l->data; + break; + } + l = l->next; + } + } + + return acct; +} + +static gboolean xmpp_uri_handler(const char *proto, const char *user, GHashTable *params) +{ + char *acct_id = params ? g_hash_table_lookup(params, "account") : NULL; + PurpleAccount *acct; + + if (g_ascii_strcasecmp(proto, "xmpp")) + return FALSE; + + acct = find_acct(purple_plugin_get_id(my_protocol), acct_id); + + if (!acct) + return FALSE; + + /* xmpp:romeo@montague.net?message;subject=Test%20Message;body=Here%27s%20a%20test%20message */ + /* params is NULL if the URI has no '?' (or anything after it) */ + if (!params || g_hash_table_lookup_extended(params, "message", NULL, NULL)) { + char *body = g_hash_table_lookup(params, "body"); + if (user && *user) { + PurpleConversation *conv = + purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, user); + purple_conversation_present(conv); + if (body && *body) + purple_conv_send_confirm(conv, body); + } + } else if (g_hash_table_lookup_extended(params, "roster", NULL, NULL)) { + char *name = g_hash_table_lookup(params, "name"); + if (user && *user) + purple_blist_request_add_buddy(acct, user, NULL, name); + } else if (g_hash_table_lookup_extended(params, "join", NULL, NULL)) { + PurpleConnection *gc = purple_account_get_connection(acct); + if (user && *user) { + GHashTable *params = jabber_chat_info_defaults(gc, user); + jabber_chat_join(gc, params); + } + return TRUE; + } + + return FALSE; +} + + +static void +init_plugin(PurplePlugin *plugin) +{ + PurpleAccountUserSplit *split; + PurpleAccountOption *option; + GList *encryption_values = NULL; + + /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */ + split = purple_account_user_split_new(_("Domain"), NULL, '@'); + purple_account_user_split_set_reverse(split, FALSE); + prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); + + split = purple_account_user_split_new(_("Resource"), "", '/'); + purple_account_user_split_set_reverse(split, FALSE); + prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); + +#define ADD_VALUE(list, desc, v) { \ + PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1); \ + kvp->key = g_strdup((desc)); \ + kvp->value = g_strdup((v)); \ + list = g_list_prepend(list, kvp); \ +} + + ADD_VALUE(encryption_values, _("Require encryption"), "require_tls"); + ADD_VALUE(encryption_values, _("Use encryption if available"), "opportunistic_tls"); + ADD_VALUE(encryption_values, _("Use old-style SSL"), "old_ssl"); +#if 0 + ADD_VALUE(encryption_values, "None", "none"); +#endif + encryption_values = g_list_reverse(encryption_values); + +#undef ADD_VALUE + + option = purple_account_option_list_new(_("Connection security"), "connection_security", encryption_values); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_bool_new( + _("Allow plaintext auth over unencrypted streams"), + "auth_plain_in_clear", FALSE); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_int_new(_("Connect port"), "port", 5222); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_string_new(_("Connect server"), + "connect_server", NULL); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_string_new(_("File transfer proxies"), + "ft_proxies", + /* TODO: Is this an acceptable default? + * Also, keep this in sync as they add more servers */ + JABBER_DEFAULT_FT_PROXIES); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + option = purple_account_option_string_new(_("BOSH URL"), + "bosh_url", NULL); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + /* this should probably be part of global smiley theme settings later on, + shared with MSN */ + option = purple_account_option_bool_new(_("Show Custom Smileys"), + "custom_smileys", TRUE); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, + option); + + my_protocol = plugin; + + purple_signal_connect(purple_get_core(), "uri-handler", plugin, + PURPLE_CALLBACK(xmpp_uri_handler), NULL); +} + +PURPLE_INIT_PLUGIN(gtalk, init_plugin, info); + -- cgit v1.2.1 From 309838a849b79402e79d2e63f1e8a5be3706276b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 28 Dec 2011 09:00:48 +0000 Subject: Remove UI hack for XMPP sub-prpls. --- libpurple/protocols/jabber/libfacebook.c | 8 ++++++- libpurple/protocols/jabber/libgtalk.c | 8 ++++++- pidgin/gtkutils.c | 39 -------------------------------- 3 files changed, 14 insertions(+), 41 deletions(-) diff --git a/libpurple/protocols/jabber/libfacebook.c b/libpurple/protocols/jabber/libfacebook.c index e0cc371173..3a680af122 100644 --- a/libpurple/protocols/jabber/libfacebook.c +++ b/libpurple/protocols/jabber/libfacebook.c @@ -49,6 +49,12 @@ #include "data.h" #include "ibb.h" +static const char * +facebook_list_icon(PurpleAccount *a, PurpleBuddy *b) +{ + return "facebook"; +} + static PurplePlugin *my_protocol = NULL; static PurplePluginProtocolInfo prpl_info = @@ -62,7 +68,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* user_splits */ NULL, /* protocol_options */ {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - jabber_list_icon, /* list_icon */ + facebook_list_icon, /* list_icon */ jabber_list_emblem, /* list_emblems */ jabber_status_text, /* status_text */ jabber_tooltip_text, /* tooltip_text */ diff --git a/libpurple/protocols/jabber/libgtalk.c b/libpurple/protocols/jabber/libgtalk.c index f3bfbce2ec..030ced2333 100644 --- a/libpurple/protocols/jabber/libgtalk.c +++ b/libpurple/protocols/jabber/libgtalk.c @@ -49,6 +49,12 @@ #include "data.h" #include "ibb.h" +static const char * +gtalk_list_icon(PurpleAccount *a, PurpleBuddy *b) +{ + return "google-talk"; +} + static PurplePlugin *my_protocol = NULL; static PurplePluginProtocolInfo prpl_info = @@ -62,7 +68,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* user_splits */ NULL, /* protocol_options */ {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - jabber_list_icon, /* list_icon */ + gtalk_list_icon, /* list_icon */ jabber_list_emblem, /* list_emblems */ jabber_status_text, /* status_text */ jabber_tooltip_text, /* tooltip_text */ diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 1a7d6ffef9..b8b6ebc77e 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -707,7 +707,6 @@ create_protocols_menu(const char *default_proto_id) GtkTreeIter iter; GtkListStore *ls; GList *p; - const char *gtalk_name = NULL, *facebook_name = NULL; int i; ls = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); @@ -716,50 +715,12 @@ create_protocols_menu(const char *default_proto_id) aop_menu->default_item = -1; aop_menu->model = GTK_TREE_MODEL(ls); - if (purple_find_prpl("prpl-jabber")) { - gtalk_name = _("Google Talk"); - facebook_name = _("Facebook (XMPP)"); - } - for (p = purple_plugins_get_protocols(), i = 0; p != NULL; p = p->next, i++) { plugin = (PurplePlugin *)p->data; - if (gtalk_name && strcmp(gtalk_name, plugin->info->name) < 0) { - char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", - "16", "google-talk.png", NULL); - pixbuf = pidgin_pixbuf_new_from_file(filename); - g_free(filename); - - gtk_list_store_append(ls, &iter); - gtk_list_store_set(ls, &iter, 0, pixbuf, 1, gtalk_name, 2, "prpl-jabber", -1); - - if (pixbuf) - g_object_unref(pixbuf); - - gtalk_name = NULL; - i++; - } - - if (facebook_name && strcmp(facebook_name, plugin->info->name) < 0) { - char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", - "16", "facebook.png", NULL); - - pixbuf = pidgin_pixbuf_new_from_file(filename); - g_free(filename); - - gtk_list_store_append(ls, &iter); - gtk_list_store_set(ls, &iter, 0, pixbuf, 1, facebook_name, 2, "prpl-jabber", -1); - - if (pixbuf) - g_object_unref(pixbuf); - - facebook_name = NULL; - i++; - } - pixbuf = pidgin_create_prpl_icon_from_prpl(plugin, PIDGIN_PRPL_ICON_SMALL, NULL); gtk_list_store_append(ls, &iter); -- cgit v1.2.1 From 7e9e1f71f91db04a8882bb530b80a64e1e1179e8 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 28 Dec 2011 09:01:34 +0000 Subject: Fix a couple descriptive lines. --- libpurple/protocols/jabber/libgtalk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/protocols/jabber/libgtalk.c b/libpurple/protocols/jabber/libgtalk.c index 030ced2333..6ed4f62154 100644 --- a/libpurple/protocols/jabber/libgtalk.c +++ b/libpurple/protocols/jabber/libgtalk.c @@ -165,9 +165,9 @@ static PurplePluginInfo info = "Google Talk (XMPP)", /**< name */ DISPLAY_VERSION, /**< version */ /** summary */ - N_("XMPP Protocol Plugin"), + N_("Google Talk Protocol Plugin"), /** description */ - N_("XMPP Protocol Plugin"), + N_("Google Talk Protocol Plugin"), NULL, /**< author */ PURPLE_WEBSITE, /**< homepage */ -- cgit v1.2.1 From f7ee6059d9684a0ec84da35124fd5647c52fd413 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Dec 2011 01:43:31 +0000 Subject: Remove and replace the Default Domain UI hack. --- libpurple/protocols/jabber/libfacebook.c | 2 +- libpurple/protocols/jabber/libgtalk.c | 2 +- pidgin/gtkaccount.c | 35 -------------------------------- 3 files changed, 2 insertions(+), 37 deletions(-) diff --git a/libpurple/protocols/jabber/libfacebook.c b/libpurple/protocols/jabber/libfacebook.c index 3a680af122..357a393086 100644 --- a/libpurple/protocols/jabber/libfacebook.c +++ b/libpurple/protocols/jabber/libfacebook.c @@ -260,7 +260,7 @@ init_plugin(PurplePlugin *plugin) GList *encryption_values = NULL; /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */ - split = purple_account_user_split_new(_("Domain"), NULL, '@'); + split = purple_account_user_split_new(_("Domain"), "chat.facebook.com", '@'); purple_account_user_split_set_reverse(split, FALSE); prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); diff --git a/libpurple/protocols/jabber/libgtalk.c b/libpurple/protocols/jabber/libgtalk.c index 6ed4f62154..e30bcd73e1 100644 --- a/libpurple/protocols/jabber/libgtalk.c +++ b/libpurple/protocols/jabber/libgtalk.c @@ -260,7 +260,7 @@ init_plugin(PurplePlugin *plugin) GList *encryption_values = NULL; /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */ - split = purple_account_user_split_new(_("Domain"), NULL, '@'); + split = purple_account_user_split_new(_("Domain"), "gmail.com", '@'); purple_account_user_split_set_reverse(split, FALSE); prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 99c4a22870..81bccc0411 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -166,37 +166,6 @@ static void add_protocol_options(AccountPrefsDialog *dialog); static void add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent); static void add_voice_options(AccountPrefsDialog *dialog); -static const char * -google_talk_default_domain_hackery(GtkWidget *protocol_combo, const char *value_if_gtalk) -{ - GtkTreeModel *model; - GtkTreeIter iter; - const char *value = NULL; - - model = gtk_combo_box_get_model(GTK_COMBO_BOX(protocol_combo)); - if (model != NULL && gtk_combo_box_get_active_iter(GTK_COMBO_BOX(protocol_combo), &iter)) { - char *protocol = NULL; - - /* protocol is not stored as G_TYPE_STRING in the model so no g_free necessary */ - gtk_tree_model_get(model, &iter, 2, &protocol, -1); - if (protocol && !strcmp("prpl-jabber", protocol)) { - char *item_name = NULL; - - gtk_tree_model_get(model, &iter, 1, &item_name, -1); - if (item_name) { - if (!strcmp(item_name, _("Google Talk"))) - value = value_if_gtalk; - g_free(item_name); - } - /* If it's not GTalk, but still Jabber then the value is not NULL, it's empty */ - if (NULL == value) - value = ""; - } - } - - return value; -} - static GtkWidget * add_pref_box(AccountPrefsDialog *dialog, GtkWidget *parent, const char *text, GtkWidget *widget) @@ -591,10 +560,6 @@ add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) if (value == NULL) value = purple_account_user_split_get_default_value(split); - /* Google Talk default domain hackery! */ - if (!strcmp(_("Domain"), purple_account_user_split_get_text(split)) && !value) - value = google_talk_default_domain_hackery(dialog->protocol_menu, "gmail.com"); - if (value != NULL) gtk_entry_set_text(GTK_ENTRY(entry), value); } -- cgit v1.2.1 From debbf099a67d393e78de7a24ae297424778c5161 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Dec 2011 01:46:39 +0000 Subject: "Fake" account types couldn't be registered before, so make sure that they can't now. --- libpurple/protocols/jabber/libfacebook.c | 4 ++-- libpurple/protocols/jabber/libgtalk.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/jabber/libfacebook.c b/libpurple/protocols/jabber/libfacebook.c index 357a393086..abf231711c 100644 --- a/libpurple/protocols/jabber/libfacebook.c +++ b/libpurple/protocols/jabber/libfacebook.c @@ -102,7 +102,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* chat_whisper */ jabber_message_send_chat, /* chat_send */ jabber_keepalive, /* keepalive */ - jabber_register_account, /* register_user */ + NULL, /* register_user */ NULL, /* get_cb_info */ jabber_roster_alias_change, /* alias_buddy */ jabber_roster_group_change, /* group_buddy */ @@ -125,7 +125,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* whiteboard_prpl_ops */ jabber_prpl_send_raw, /* send_raw */ jabber_roomlist_room_serialize, /* roomlist_room_serialize */ - jabber_unregister_account, /* unregister_user */ + NULL, /* unregister_user */ jabber_send_attention, /* send_attention */ jabber_attention_types, /* attention_types */ NULL, /* get_account_text_table */ diff --git a/libpurple/protocols/jabber/libgtalk.c b/libpurple/protocols/jabber/libgtalk.c index e30bcd73e1..d52d1842c2 100644 --- a/libpurple/protocols/jabber/libgtalk.c +++ b/libpurple/protocols/jabber/libgtalk.c @@ -102,7 +102,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* chat_whisper */ jabber_message_send_chat, /* chat_send */ jabber_keepalive, /* keepalive */ - jabber_register_account, /* register_user */ + NULL, /* register_user */ NULL, /* get_cb_info */ jabber_roster_alias_change, /* alias_buddy */ jabber_roster_group_change, /* group_buddy */ @@ -125,7 +125,7 @@ static PurplePluginProtocolInfo prpl_info = NULL, /* whiteboard_prpl_ops */ jabber_prpl_send_raw, /* send_raw */ jabber_roomlist_room_serialize, /* roomlist_room_serialize */ - jabber_unregister_account, /* unregister_user */ + NULL, /* unregister_user */ jabber_send_attention, /* send_attention */ jabber_attention_types, /* attention_types */ NULL, /* get_account_text_table */ -- cgit v1.2.1 From b8432dc9481abb6a8e52461ba22247da1ad9b296 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Dec 2011 01:49:46 +0000 Subject: Use a reasonable default in VV prefs if the account isn't created yet. --- pidgin/gtkaccount.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 81bccc0411..99e1e853b5 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -1205,8 +1205,12 @@ add_voice_options(AccountPrefsDialog *dialog) gtk_widget_show_all(dialog->voice_frame); } - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->suppression_check), - purple_account_get_silence_suppression(dialog->account)); + if (dialog->account) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->suppression_check), + purple_account_get_silence_suppression(dialog->account)); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->suppression_check), FALSE); + } #endif } -- cgit v1.2.1 From 123a676b4cf5ea0f635d8e1bacc9e47058d56f34 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Dec 2011 01:58:43 +0000 Subject: Replace Facebook's UI hack for default connection security. --- libpurple/protocols/jabber/libfacebook.c | 2 +- pidgin/gtkaccount.c | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/libpurple/protocols/jabber/libfacebook.c b/libpurple/protocols/jabber/libfacebook.c index abf231711c..9da4e0162b 100644 --- a/libpurple/protocols/jabber/libfacebook.c +++ b/libpurple/protocols/jabber/libfacebook.c @@ -275,8 +275,8 @@ init_plugin(PurplePlugin *plugin) list = g_list_prepend(list, kvp); \ } - ADD_VALUE(encryption_values, _("Require encryption"), "require_tls"); ADD_VALUE(encryption_values, _("Use encryption if available"), "opportunistic_tls"); + ADD_VALUE(encryption_values, _("Require encryption"), "require_tls"); ADD_VALUE(encryption_values, _("Use old-style SSL"), "old_ssl"); #if 0 ADD_VALUE(encryption_values, "None", "none"); diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 99e1e853b5..a3d1062598 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -755,7 +755,7 @@ add_protocol_options(AccountPrefsDialog *dialog) { PurpleAccountOption *option; PurpleAccount *account; - GtkWidget *vbox, *check, *entry, *combo, *menu, *item; + GtkWidget *vbox, *check, *entry, *combo; GList *list, *node; gint i, idx, int_value; GtkListStore *model; @@ -794,12 +794,6 @@ add_protocol_options(AccountPrefsDialog *dialog) gtk_label_new_with_mnemonic(_("Ad_vanced")), 1); gtk_widget_show(vbox); -/* FIXME: Facebook forced-options hack */ -#if 0 - menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->protocol_menu)); - item = gtk_menu_get_active(GTK_MENU(menu)); -#endif - for (l = dialog->prpl_info->protocol_options; l != NULL; l = l->next) { option = (PurpleAccountOption *)l->data; @@ -914,13 +908,6 @@ add_protocol_options(AccountPrefsDialog *dialog) model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); opt_entry->widget = combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model)); -/* FIXME: Facebook forced-options hack */ -#if 0 - if (g_object_get_data(G_OBJECT(item), "fakefacebook") && - !strcmp(opt_entry->setting, "connection_security")) - str_value = "opportunistic_tls"; -#endif - /* Loop through list of PurpleKeyValuePair items */ for (node = list; node != NULL; node = node->next) { if (node->data != NULL) { -- cgit v1.2.1 From 9f02e843f4e695bf8e3410deea636f776dc9ddbd Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Dec 2011 04:47:14 +0000 Subject: Make code a bit more verbose, and remove some "magic numbers". --- pidgin/gtkutils.c | 88 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 30 deletions(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index b8b6ebc77e..400edb9176 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -75,6 +75,13 @@ #define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE(x) #endif +enum { + AOP_ICON_COLUMN, + AOP_NAME_COLUMN, + AOP_DATA_COLUMN, + AOP_COLUMN_COUNT +}; + typedef struct { GtkTreeModel *model; gint default_item; @@ -599,7 +606,8 @@ aop_option_menu_get_selected(GtkWidget *optmenu) g_return_val_if_fail(optmenu != NULL, NULL); if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(optmenu), &iter)) - gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu)), &iter, 2, &data, -1); + gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu)), + &iter, AOP_DATA_COLUMN, &data, -1); return data; } @@ -666,9 +674,9 @@ aop_option_menu_new(AopMenu *aop_menu, GCallback cb, gpointer user_data) optmenu = gtk_combo_box_new(); gtk_widget_show(optmenu); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(optmenu), cr = gtk_cell_renderer_pixbuf_new(), FALSE); - gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "pixbuf", 0); + gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "pixbuf", AOP_ICON_COLUMN); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(optmenu), cr = gtk_cell_renderer_text_new(), TRUE); - gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "text", 1); + gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "text", AOP_NAME_COLUMN); aop_option_menu_replace_menu(optmenu, aop_menu); if (aop_menu->default_item == -1) @@ -709,7 +717,7 @@ create_protocols_menu(const char *default_proto_id) GList *p; int i; - ls = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); + ls = gtk_list_store_new(AOP_COLUMN_COUNT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); aop_menu = g_malloc0(sizeof(AopMenu)); aop_menu->default_item = -1; @@ -724,7 +732,11 @@ create_protocols_menu(const char *default_proto_id) pixbuf = pidgin_create_prpl_icon_from_prpl(plugin, PIDGIN_PRPL_ICON_SMALL, NULL); gtk_list_store_append(ls, &iter); - gtk_list_store_set(ls, &iter, 0, pixbuf, 1, plugin->info->name, 2, plugin->info->id, -1); + gtk_list_store_set(ls, &iter, + AOP_ICON_COLUMN, pixbuf, + AOP_NAME_COLUMN, plugin->info->name, + AOP_DATA_COLUMN, plugin->info->id, + -1); if (pixbuf) g_object_unref(pixbuf); @@ -773,7 +785,7 @@ create_account_menu(PurpleAccount *default_account, else list = purple_connections_get_all(); - ls = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); + ls = gtk_list_store_new(AOP_COLUMN_COUNT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); aop_menu = g_malloc0(sizeof(AopMenu)); aop_menu->default_item = -1; @@ -813,7 +825,11 @@ create_account_menu(PurpleAccount *default_account, } gtk_list_store_append(ls, &iter); - gtk_list_store_set(ls, &iter, 0, pixbuf, 1, buf, 2, account, -1); + gtk_list_store_set(ls, &iter, + AOP_ICON_COLUMN, pixbuf, + AOP_NAME_COLUMN, buf, + AOP_DATA_COLUMN, account, + -1); if (pixbuf) g_object_unref(pixbuf); @@ -1855,6 +1871,15 @@ pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, return menuitem; } +enum { + COMPLETION_DISPLAYED_COLUMN, /* displayed completion value */ + COMPLETION_BUDDY_COLUMN, /* buddy name */ + COMPLETION_NORMALIZED_COLUMN, /* UTF-8 normalized & casefolded buddy name */ + COMPLETION_COMPARISON_COLUMN, /* UTF-8 normalized & casefolded value for comparison */ + COMPLETION_ACCOUNT_COLUMN, /* account */ + COMPLETION_COLUMN_COUNT +}; + typedef struct { GtkWidget *entry; @@ -1874,10 +1899,10 @@ static gboolean buddyname_completion_match_func(GtkEntryCompletion *completion, GValue val2; const char *tmp; - model = gtk_entry_completion_get_model (completion); + model = gtk_entry_completion_get_model(completion); val1.g_type = 0; - gtk_tree_model_get_value(model, iter, 2, &val1); + gtk_tree_model_get_value(model, iter, COMPLETION_NORMALIZED_COLUMN, &val1); tmp = g_value_get_string(&val1); if (tmp != NULL && purple_str_has_prefix(tmp, key)) { @@ -1887,7 +1912,7 @@ static gboolean buddyname_completion_match_func(GtkEntryCompletion *completion, g_value_unset(&val1); val2.g_type = 0; - gtk_tree_model_get_value(model, iter, 3, &val2); + gtk_tree_model_get_value(model, iter, COMPLETION_COMPARISON_COLUMN, &val2); tmp = g_value_get_string(&val2); if (tmp != NULL && purple_str_has_prefix(tmp, key)) { @@ -1907,11 +1932,11 @@ static gboolean buddyname_completion_match_selected_cb(GtkEntryCompletion *compl PurpleAccount *account; val.g_type = 0; - gtk_tree_model_get_value(model, iter, 1, &val); + gtk_tree_model_get_value(model, iter, COMPLETION_BUDDY_COLUMN, &val); gtk_entry_set_text(GTK_ENTRY(data->entry), g_value_get_string(&val)); g_value_unset(&val); - gtk_tree_model_get_value(model, iter, 4, &val); + gtk_tree_model_get_value(model, iter, COMPLETION_ACCOUNT_COLUMN, &val); account = g_value_get_pointer(&val); g_value_unset(&val); @@ -1948,11 +1973,11 @@ add_buddyname_autocomplete_entry(GtkListStore *store, const char *buddy_alias, c gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, - 0, completion_entry, - 1, buddyname, - 2, normalized_buddyname, - 3, tmp, - 4, account, + COMPLETION_DISPLAYED_COLUMN, completion_entry, + COMPLETION_BUDDY_COLUMN, buddyname, + COMPLETION_NORMALIZED_COLUMN, normalized_buddyname, + COMPLETION_COMPARISON_COLUMN, tmp, + COMPLETION_ACCOUNT_COLUMN, account, -1); g_free(completion_entry); g_free(tmp); @@ -1973,11 +1998,11 @@ add_buddyname_autocomplete_entry(GtkListStore *store, const char *buddy_alias, c gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, - 0, completion_entry, - 1, buddyname, - 2, normalized_buddyname, - 3, tmp, - 4, account, + COMPLETION_DISPLAYED_COLUMN, completion_entry, + COMPLETION_BUDDY_COLUMN, buddyname, + COMPLETION_NORMALIZED_COLUMN, normalized_buddyname, + COMPLETION_COMPARISON_COLUMN, tmp, + COMPLETION_ACCOUNT_COLUMN, account, -1); g_free(completion_entry); g_free(tmp); @@ -1989,11 +2014,11 @@ add_buddyname_autocomplete_entry(GtkListStore *store, const char *buddy_alias, c /* Add the buddy's name. */ gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, - 0, buddyname, - 1, buddyname, - 2, normalized_buddyname, - 3, NULL, - 4, account, + COMPLETION_DISPLAYED_COLUMN, buddyname, + COMPLETION_BUDDY_COLUMN, buddyname, + COMPLETION_NORMALIZED_COLUMN, normalized_buddyname, + COMPLETION_COMPARISON_COLUMN, NULL, + COMPLETION_ACCOUNT_COLUMN, account, -1); } @@ -2091,7 +2116,9 @@ pidgin_setup_screenname_autocomplete_with_filter(GtkWidget *entry, GtkWidget *ac GtkEntryCompletion *completion; data = g_new0(PidginCompletionData, 1); - store = gtk_list_store_new(5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); + store = gtk_list_store_new(COMPLETION_COLUMN_COUNT, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_POINTER); data->entry = entry; data->accountopt = accountopt; @@ -2108,7 +2135,8 @@ pidgin_setup_screenname_autocomplete_with_filter(GtkWidget *entry, GtkWidget *ac /* Sort the completion list by buddy name */ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), - 1, GTK_SORT_ASCENDING); + COMPLETION_BUDDY_COLUMN, + GTK_SORT_ASCENDING); completion = gtk_entry_completion_new(); gtk_entry_completion_set_match_func(completion, buddyname_completion_match_func, NULL, NULL); @@ -2122,7 +2150,7 @@ pidgin_setup_screenname_autocomplete_with_filter(GtkWidget *entry, GtkWidget *ac gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store)); g_object_unref(store); - gtk_entry_completion_set_text_column(completion, 0); + gtk_entry_completion_set_text_column(completion, COMPLETION_DISPLAYED_COLUMN); purple_signal_connect(purple_connections_get_handle(), "signed-on", entry, PURPLE_CALLBACK(repopulate_autocomplete), data); -- cgit v1.2.1 From 9cd312eaedb32b681eb95ba3e658ef3ac6b7295f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Dec 2011 05:36:32 +0000 Subject: Avoid calling gtk_combo_box_set_active twice in some cases. --- pidgin/gtkutils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 400edb9176..1cce8870f3 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -679,8 +679,6 @@ aop_option_menu_new(AopMenu *aop_menu, GCallback cb, gpointer user_data) gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "text", AOP_NAME_COLUMN); aop_option_menu_replace_menu(optmenu, aop_menu); - if (aop_menu->default_item == -1) - gtk_combo_box_set_active(GTK_COMBO_BOX(optmenu), 0); g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); g_signal_connect(G_OBJECT(optmenu), "changed", G_CALLBACK(aop_menu_cb), cb); @@ -720,7 +718,7 @@ create_protocols_menu(const char *default_proto_id) ls = gtk_list_store_new(AOP_COLUMN_COUNT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); aop_menu = g_malloc0(sizeof(AopMenu)); - aop_menu->default_item = -1; + aop_menu->default_item = 0; aop_menu->model = GTK_TREE_MODEL(ls); for (p = purple_plugins_get_protocols(), i = 0; @@ -744,6 +742,7 @@ create_protocols_menu(const char *default_proto_id) if (default_proto_id != NULL && !strcmp(plugin->info->id, default_proto_id)) aop_menu->default_item = i; } + return aop_menu; } @@ -788,7 +787,7 @@ create_account_menu(PurpleAccount *default_account, ls = gtk_list_store_new(AOP_COLUMN_COUNT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); aop_menu = g_malloc0(sizeof(AopMenu)); - aop_menu->default_item = -1; + aop_menu->default_item = 0; aop_menu->model = GTK_TREE_MODEL(ls); for (p = list, i = 0; p != NULL; p = p->next, i++) { @@ -837,6 +836,7 @@ create_account_menu(PurpleAccount *default_account, if (default_account && account == default_account) aop_menu->default_item = i; } + return aop_menu; } -- cgit v1.2.1 From 15b7f6b63e7f5e8555b3543bf0f8cfd44cd7c3f4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Dec 2011 05:40:11 +0000 Subject: It appears that no-one needs this AopMenu struct after the combo box is updated. --- pidgin/gtkutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 1cce8870f3..2d510bb627 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -627,7 +627,7 @@ aop_option_menu_replace_menu(GtkWidget *optmenu, AopMenu *new_aop_menu) { gtk_combo_box_set_model(GTK_COMBO_BOX(optmenu), new_aop_menu->model); gtk_combo_box_set_active(GTK_COMBO_BOX(optmenu), new_aop_menu->default_item); - g_object_set_data_full(G_OBJECT(optmenu), "aop_menu", new_aop_menu, (GDestroyNotify)g_free); + g_free(new_aop_menu); } static GdkPixbuf * -- cgit v1.2.1 From 84d82a197ea9980a21578c13a37e7f075be8b634 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Dec 2011 05:42:01 +0000 Subject: Looks like I missed a number. --- pidgin/gtkutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 2d510bb627..e88ec6a6f4 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -695,7 +695,7 @@ aop_option_menu_select_by_data(GtkWidget *optmenu, gpointer data) model = gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu)); if (gtk_tree_model_get_iter_first(model, &iter)) { do { - gtk_tree_model_get(model, &iter, 2, &iter_data, -1); + gtk_tree_model_get(model, &iter, AOP_DATA_COLUMN, &iter_data, -1); if (iter_data == data) { gtk_combo_box_set_active_iter(GTK_COMBO_BOX(optmenu), &iter); return; -- cgit v1.2.1 From 669b95c40b4ed25e4f854288ebf551451d814d69 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 29 Dec 2011 07:33:57 +0000 Subject: Facebook does not support various XMPP extensions that we do. Disable roster changes, FT, attention, and VV. --- libpurple/protocols/jabber/libfacebook.c | 38 +++++++++++++------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/libpurple/protocols/jabber/libfacebook.c b/libpurple/protocols/jabber/libfacebook.c index 9da4e0162b..b426eac356 100644 --- a/libpurple/protocols/jabber/libfacebook.c +++ b/libpurple/protocols/jabber/libfacebook.c @@ -85,14 +85,14 @@ static PurplePluginProtocolInfo prpl_info = jabber_set_status, /* set_status */ jabber_idle_set, /* set_idle */ NULL, /* change_passwd */ - jabber_roster_add_buddy, /* add_buddy */ + NULL, /* add_buddy */ NULL, /* add_buddies */ - jabber_roster_remove_buddy, /* remove_buddy */ + NULL, /* remove_buddy */ NULL, /* remove_buddies */ NULL, /* add_permit */ - jabber_add_deny, /* add_deny */ + NULL, /* add_deny */ NULL, /* rem_permit */ - jabber_rem_deny, /* rem_deny */ + NULL, /* rem_deny */ NULL, /* set_permit_deny */ jabber_chat_join, /* join_chat */ NULL, /* reject_chat */ @@ -104,9 +104,9 @@ static PurplePluginProtocolInfo prpl_info = jabber_keepalive, /* keepalive */ NULL, /* register_user */ NULL, /* get_cb_info */ - jabber_roster_alias_change, /* alias_buddy */ - jabber_roster_group_change, /* group_buddy */ - jabber_roster_group_rename, /* rename_group */ + NULL, /* alias_buddy */ + NULL, /* group_buddy */ + NULL, /* rename_group */ NULL, /* buddy_free */ jabber_convo_closed, /* convo_closed */ jabber_normalize, /* normalize */ @@ -118,20 +118,20 @@ static PurplePluginProtocolInfo prpl_info = jabber_roomlist_get_list, /* roomlist_get_list */ jabber_roomlist_cancel, /* roomlist_cancel */ NULL, /* roomlist_expand_category */ - jabber_can_receive_file, /* can_receive_file */ - jabber_si_xfer_send, /* send_file */ - jabber_si_new_xfer, /* new_xfer */ + NULL, /* can_receive_file */ + NULL, /* send_file */ + NULL, /* new_xfer */ jabber_offline_message, /* offline_message */ NULL, /* whiteboard_prpl_ops */ jabber_prpl_send_raw, /* send_raw */ jabber_roomlist_room_serialize, /* roomlist_room_serialize */ NULL, /* unregister_user */ - jabber_send_attention, /* send_attention */ - jabber_attention_types, /* attention_types */ + NULL, /* send_attention */ + NULL, /* attention_types */ NULL, /* get_account_text_table */ - jabber_initiate_media, /* initiate_media */ - jabber_get_media_caps, /* get_media_caps */ - jabber_get_moods, /* get_moods */ + NULL, /* initiate_media */ + NULL, /* get_media_caps */ + NULL, /* get_moods */ NULL, /* set_public_alias */ NULL /* get_public_alias */ }; @@ -304,14 +304,6 @@ init_plugin(PurplePlugin *plugin) prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_string_new(_("File transfer proxies"), - "ft_proxies", - /* TODO: Is this an acceptable default? - * Also, keep this in sync as they add more servers */ - JABBER_DEFAULT_FT_PROXIES); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - option = purple_account_option_string_new(_("BOSH URL"), "bosh_url", NULL); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, -- cgit v1.2.1 From 4e657083d74e3921e32ecbac1b8d4b85a0af80ca Mon Sep 17 00:00:00 2001 From: Daniel Atallah Date: Sat, 31 Dec 2011 04:30:57 +0000 Subject: webkit_web_view_load_html_string is superceded by webkit_web_view_load_string as of 1.1.1 (which we require) --- pidgin/gtkwebview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 20fb958f3b..2d0420b239 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -271,7 +271,7 @@ gtk_webview_load_html_string_with_imgstore(GtkWebView *view, const char *html) clear_images(view); html_imged = replace_img_id_with_src(view, html); - webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(view), html_imged, "file:///"); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(view), html_imged, NULL, NULL, "file:///"); g_free(html_imged); } -- cgit v1.2.1 From 12cbb467876b50c5e4cf4746af763a80f82a201d Mon Sep 17 00:00:00 2001 From: Daniel Atallah Date: Sat, 31 Dec 2011 15:11:14 +0000 Subject: internal.h is needed to compile on win32 --- pidgin/gtkconv-theme.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index d306594ee1..7a7a3a8150 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -28,6 +28,7 @@ #include "xmlnode.h" #include "pidgin.h" +#include "internal.h" #include "gtkconv.h" #include "gtkwebview.h" -- cgit v1.2.1 From 41226e37b9f3a8f8cd613bb461ca76f8d59001bb Mon Sep 17 00:00:00 2001 From: Daniel Atallah Date: Sat, 31 Dec 2011 15:48:20 +0000 Subject: Fix some webkit related leaks and an unnecessary allocation. --- pidgin/gtkconv.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 8f1125d721..9331c091a2 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5195,11 +5195,11 @@ static void conv_variant_changed_cb(GObject *gobject, GParamSpec *pspec, gpointer user_data) { PidginConversation *gtkconv = user_data; - const char *path; - char *js; + char *path, *js; path = pidgin_conversation_theme_get_css_path(PIDGIN_CONV_THEME(gobject)); js = g_strdup_printf("setStylesheet(\"mainStyle\", \"file://%s\");", path); + g_free(path); gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), js); g_free(js); } @@ -6097,13 +6097,14 @@ replace_message_tokens( const char *cur = text; const char *prev = cur; - if (text == NULL) - return g_strdup(""); + if (text == NULL || *text == '\0') + return NULL; str = g_string_new(NULL); while ((cur = strchr(cur, '%'))) { const char *replace = NULL; const char *fin = NULL; + gpointer freeval = NULL; if (g_str_has_prefix(cur, "%message%")) { replace = message; @@ -6139,14 +6140,14 @@ replace_message_tokens( replace = purple_imgstore_get_filename(img); } if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { - replace = g_build_filename("Outgoing", "buddy_icon.png", NULL); + replace = freeval = g_build_filename("Outgoing", "buddy_icon.png", NULL); } } else if (flags & PURPLE_MESSAGE_RECV) { PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); if (icon) replace = purple_buddy_icon_get_full_path(icon); if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { - replace = g_build_filename("Incoming", "buddy_icon.png", NULL); + replace = freeval = g_build_filename("Incoming", "buddy_icon.png", NULL); } } @@ -6171,6 +6172,8 @@ replace_message_tokens( g_string_append_len(str, prev, cur - prev); if (replace) g_string_append(str, replace); + g_free(freeval); + freeval = replace = NULL; /* And update the pointers */ if (fin) { @@ -6294,7 +6297,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a smileyed = smiley_parse_markup(message, purple_account_get_protocol_id(account)); msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime); - escape = gtk_webview_quote_js_string(msg); + escape = gtk_webview_quote_js_string(msg ? msg : ""); script = g_strdup_printf("%s(%s)", func, escape); purple_debug_info("webkit", "JS: %s\n", script); -- cgit v1.2.1 From 9c00feb550a6420d4318f1bf8fd842df089169e1 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Mon, 2 Jan 2012 06:53:19 +0000 Subject: This should fix the everyone-is-the-same problem in chats. committer: Elliott Sales de Andrade --- pidgin/gtkconv.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 9331c091a2..0658397472 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6286,8 +6286,16 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a } else if (flags & PURPLE_MESSAGE_SEND) { message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT); } else if ((flags & PURPLE_MESSAGE_RECV) && (old_flags & PURPLE_MESSAGE_RECV)) { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT); - func = "appendNextMessage"; + GList *history = purple_conversation_get_message_history(conv); + PurpleConvMessage *last_msg = (PurpleConvMessage *)history->data; + + /* If the senders are the same, use appendNextMessage */ + if (purple_strequal(purple_conversation_message_get_sender(last_msg), name)) { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT); + func = "appendNextMessage"; + } else { + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); + } } else if (flags & PURPLE_MESSAGE_RECV) { message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); } else { -- cgit v1.2.1 From 52f411afa376a943945e216202a6d1aca8b2eca5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 2 Jan 2012 07:10:34 +0000 Subject: Ensure all timestamps in a message are the same. Based on something pointed out by dvpdiner2. --- pidgin/gtkconv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 0658397472..3c74293bbe 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6096,6 +6096,7 @@ replace_message_tokens( GString *str; const char *cur = text; const char *prev = cur; + struct tm *tm = NULL; if (text == NULL || *text == '\0') return NULL; @@ -6116,6 +6117,7 @@ replace_message_tokens( } else if (g_str_has_prefix(cur, "%time")) { const char *tmp = cur + strlen("%time"); char *format = NULL; + if (*tmp == '{') { char *end; tmp++; @@ -6125,11 +6127,18 @@ replace_message_tokens( format = g_strndup(tmp, end - tmp); fin = end + 1; } - replace = purple_utf8_strftime(format ? format : "%X", NULL); + + if (!tm) + tm = localtime(&mtime); + + replace = purple_utf8_strftime(format ? format : "%X", tm); g_free(format); } else if (g_str_has_prefix(cur, "%shortTime%")) { - replace = purple_utf8_strftime("%H:%M", NULL); + if (!tm) + tm = localtime(&mtime); + + replace = purple_utf8_strftime("%H:%M", tm); } else if (g_str_has_prefix(cur, "%userIconPath%")) { if (flags & PURPLE_MESSAGE_SEND) { -- cgit v1.2.1 From ca72e54e0c8aa0abd4376102910e41be54dd74df Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 2 Jan 2012 07:17:23 +0000 Subject: Fix a little warning. --- pidgin/gtkconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 3c74293bbe..fb053d7d46 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6182,7 +6182,7 @@ replace_message_tokens( if (replace) g_string_append(str, replace); g_free(freeval); - freeval = replace = NULL; + replace = freeval = NULL; /* And update the pointers */ if (fin) { -- cgit v1.2.1 From 32e91838dcba7f9dc9305eb0a856b85e2284c9e5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 2 Jan 2012 07:24:55 +0000 Subject: Wrap a few lines. --- pidgin/gtkconv.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index fb053d7d46..ba36e15de1 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6290,25 +6290,34 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a old_flags = gtkconv->last_flags; if ((flags & PURPLE_MESSAGE_SEND) && (old_flags & PURPLE_MESSAGE_SEND)) { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT); + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT); func = "appendNextMessage"; + } else if (flags & PURPLE_MESSAGE_SEND) { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT); + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT); + } else if ((flags & PURPLE_MESSAGE_RECV) && (old_flags & PURPLE_MESSAGE_RECV)) { GList *history = purple_conversation_get_message_history(conv); PurpleConvMessage *last_msg = (PurpleConvMessage *)history->data; /* If the senders are the same, use appendNextMessage */ if (purple_strequal(purple_conversation_message_get_sender(last_msg), name)) { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT); + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT); func = "appendNextMessage"; } else { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); } } else if (flags & PURPLE_MESSAGE_RECV) { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT); + } else { - message_html = pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS); + message_html = pidgin_conversation_theme_get_template(gtkconv->theme, + PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS); } gtkconv->last_flags = flags; -- cgit v1.2.1 From 45a2ff332c0dec271c3a69f89eeb833b9e888e1e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 2 Jan 2012 07:58:32 +0000 Subject: Fix "Clear Scrollback" to actually reload the theme. --- pidgin/gtkconv.c | 81 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index ba36e15de1..758c5b2a6c 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -187,6 +187,7 @@ static gboolean update_send_to_selection(PidginWindow *win); static void generate_send_to_items(PidginWindow *win); /* Prototypes. <-- because Paco-Paco hates this comment. */ +static void load_conv_theme(PidginConversation *gtkconv); static gboolean infopane_entry_activate(PidginConversation *gtkconv); static void got_typing_keypress(PidginConversation *gtkconv, gboolean first); static void gray_stuff_out(PidginConversation *gtkconv); @@ -440,12 +441,12 @@ debug_command_cb(PurpleConversation *conv, static void clear_conversation_scrollback_cb(PurpleConversation *conv, void *data) { - PidginConversation *gtkconv = NULL; - - gtkconv = PIDGIN_CONVERSATION(conv); + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - if (PIDGIN_CONVERSATION(conv)) - webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(gtkconv->webview), "", ""); + if (PIDGIN_CONVERSATION(conv)) { + load_conv_theme(gtkconv); + gtkconv->last_flags = 0; + } } static PurpleCmdRet @@ -5204,6 +5205,43 @@ conv_variant_changed_cb(GObject *gobject, GParamSpec *pspec, gpointer user_data) g_free(js); } +static void +load_conv_theme(PidginConversation *gtkconv) +{ + char *header, *footer; + char *template; + char *basedir, *baseuri; + + header = replace_header_tokens(gtkconv->active_conv, + pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER)); + footer = replace_header_tokens(gtkconv->active_conv, + pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER)); + template = replace_template_tokens(gtkconv->theme, header, footer); + g_free(header); + g_free(footer); + + if (template == NULL) + return; + + set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), gtkconv->theme); + + basedir = pidgin_conversation_theme_get_template_path(gtkconv->theme); + baseuri = g_strdup_printf("file://%s", basedir); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(gtkconv->webview), template, + "text/html", "UTF-8", baseuri); + + if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_CHAT) + gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), + "document.getElementById('Chat').className = 'groupchat'"); + + g_signal_connect(G_OBJECT(gtkconv->theme), "notify::variant", + G_CALLBACK(conv_variant_changed_cb), gtkconv); + + g_free(basedir); + g_free(baseuri); + g_free(template); +} + static GtkWidget * setup_common_pane(PidginConversation *gtkconv) { @@ -5214,8 +5252,6 @@ setup_common_pane(PidginConversation *gtkconv) PurpleBuddy *buddy; gboolean chat = (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT); int buddyicon_size = 0; - char *header, *footer; - char *template; /* Setup the top part of the pane */ vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -5309,36 +5345,7 @@ setup_common_pane(PidginConversation *gtkconv) frame = pidgin_create_webview(FALSE, >kconv->webview, NULL, &webview_sw); gtk_widget_set_size_request(gtkconv->webview, -1, 0); - header = replace_header_tokens(conv, - pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER)); - footer = replace_header_tokens(conv, - pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER)); - template = replace_template_tokens(gtkconv->theme, header, footer); - g_free(header); - g_free(footer); - - if (template != NULL) { - char *basedir; - char *baseuri; - - purple_debug_info("webkit", "template: %s\n", template); - - set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), gtkconv->theme); - - basedir = pidgin_conversation_theme_get_template_path(gtkconv->theme); - baseuri = g_strdup_printf("file://%s", basedir); - webkit_web_view_load_string(WEBKIT_WEB_VIEW(gtkconv->webview), template, "text/html", "UTF-8", baseuri); - - if (chat) - gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), "document.getElementById('Chat').className = 'groupchat'"); - - g_signal_connect(G_OBJECT(gtkconv->theme), "notify::variant", - G_CALLBACK(conv_variant_changed_cb), gtkconv); - - g_free(basedir); - g_free(baseuri); - g_free(template); - } + load_conv_theme(gtkconv); if (chat) { GtkWidget *hpaned; -- cgit v1.2.1 From 817c30f7d8ba4581e20125e2312714a0c99dccfb Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 2 Jan 2012 09:13:39 +0000 Subject: Ensure timestamps in header all all the same. --- pidgin/gtkconv.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 758c5b2a6c..2480887ad8 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5045,6 +5045,8 @@ replace_header_tokens(PurpleConversation *conv, const char *text) GString *str; const char *cur = text; const char *prev = cur; + time_t mtime; + struct tm *tm = NULL; if (text == NULL || *text == '\0') return NULL; @@ -5081,6 +5083,7 @@ replace_header_tokens(PurpleConversation *conv, const char *text) } else if (g_str_has_prefix(cur, "%timeOpened")) { const char *tmp = cur + strlen("%timeOpened"); char *format = NULL; + if (*tmp == '{') { const char *end; tmp++; @@ -5090,11 +5093,22 @@ replace_header_tokens(PurpleConversation *conv, const char *text) format = g_strndup(tmp, end - tmp); fin = end + 1; } - replace = purple_utf8_strftime(format ? format : "%X", NULL); + + if (!tm) { + mtime = time(NULL); + tm = localtime(&mtime); + } + + replace = purple_utf8_strftime(format ? format : "%X", tm); g_free(format); } else if (g_str_has_prefix(cur, "%dateOpened%")) { - replace = purple_date_format_short(NULL); + if (!tm) { + mtime = time(NULL); + tm = localtime(&mtime); + } + + replace = purple_date_format_short(tm); } else { cur++; -- cgit v1.2.1 From 72cc203dbf9d978555ad7e979f9c9f14a93f98a6 Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Tue, 3 Jan 2012 06:32:26 +0000 Subject: jabber: Fix some compile warnings in auth_cyrus.c --- libpurple/protocols/jabber/auth_cyrus.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libpurple/protocols/jabber/auth_cyrus.c b/libpurple/protocols/jabber/auth_cyrus.c index 26a4cfdb32..f52e94bb86 100644 --- a/libpurple/protocols/jabber/auth_cyrus.c +++ b/libpurple/protocols/jabber/auth_cyrus.c @@ -167,7 +167,6 @@ static void auth_no_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) { PurpleAccount *account; - JabberStream *js; /* The password prompt dialog doesn't get disposed if the account disconnects */ if (!PURPLE_CONNECTION_IS_VALID(gc)) @@ -361,30 +360,30 @@ jabber_sasl_build_callbacks(JabberStream *js) id = 0; js->sasl_cb[id].id = SASL_CB_GETREALM; - js->sasl_cb[id].proc = jabber_sasl_cb_realm; + js->sasl_cb[id].proc = (void *)jabber_sasl_cb_realm; js->sasl_cb[id].context = (void *)js; id++; js->sasl_cb[id].id = SASL_CB_AUTHNAME; - js->sasl_cb[id].proc = jabber_sasl_cb_simple; + js->sasl_cb[id].proc = (void *)jabber_sasl_cb_simple; js->sasl_cb[id].context = (void *)js; id++; js->sasl_cb[id].id = SASL_CB_USER; - js->sasl_cb[id].proc = jabber_sasl_cb_simple; + js->sasl_cb[id].proc = (void *)jabber_sasl_cb_simple; js->sasl_cb[id].context = (void *)js; id++; account = purple_connection_get_account(js->gc); if (purple_account_get_password(account) != NULL ) { js->sasl_cb[id].id = SASL_CB_PASS; - js->sasl_cb[id].proc = jabber_sasl_cb_secret; + js->sasl_cb[id].proc = (void *)jabber_sasl_cb_secret; js->sasl_cb[id].context = (void *)js; id++; } js->sasl_cb[id].id = SASL_CB_LOG; - js->sasl_cb[id].proc = jabber_sasl_cb_log; + js->sasl_cb[id].proc = (void *)jabber_sasl_cb_log; js->sasl_cb[id].context = (void*)js; id++; -- cgit v1.2.1 From 6b42d70d7c3459f800ede90fabece98ebb8b47db Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Tue, 3 Jan 2012 19:29:20 +0000 Subject: pidgin/finch: Make relative paths absolute with -c With a relative path (-c .purple-test), the WebKit message view rendering wasn't loading my theme code nor icons properly (which suggests that the webkit has a different base file URI). --- finch/finch.c | 12 +++++++++++- pidgin/gtkmain.c | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/finch/finch.c b/finch/finch.c index 5157e8016c..1af4e87694 100644 --- a/finch/finch.c +++ b/finch/finch.c @@ -339,7 +339,17 @@ init_libpurple(int argc, char **argv) /* set a user-specified config directory */ if (opt_config_dir_arg != NULL) { - purple_util_set_user_dir(opt_config_dir_arg); + if (g_path_is_absolute(opt_config_dir_arg)) { + purple_util_set_user_dir(opt_config_dir_arg); + } else { + /* Make an absolute (if not canonical) path */ + char *cwd = g_get_current_dir(); + char *path = g_build_path(G_DIR_SEPARATOR_S, cwd, opt_config_dir_arg, NULL); + purple_util_set_user_dir(path); + g_free(path); + g_free(cwd); + } + g_free(opt_config_dir_arg); } diff --git a/pidgin/gtkmain.c b/pidgin/gtkmain.c index 622da25b4a..feaabb6819 100644 --- a/pidgin/gtkmain.c +++ b/pidgin/gtkmain.c @@ -719,7 +719,16 @@ int main(int argc, char *argv[]) /* set a user-specified config directory */ if (opt_config_dir_arg != NULL) { - purple_util_set_user_dir(opt_config_dir_arg); + if (g_path_is_absolute(opt_config_dir_arg)) { + purple_util_set_user_dir(opt_config_dir_arg); + } else { + /* Make an absolute (if not canonical) path */ + char *cwd = g_get_current_dir(); + char *path = g_build_path(G_DIR_SEPARATOR_S, cwd, opt_config_dir_arg, NULL); + purple_util_set_user_dir(path); + g_free(path); + g_free(cwd); + } } /* -- cgit v1.2.1 From 1d7d489a65aa6485a0a47942334e0a498ba0ec3e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 3 Jan 2012 23:32:59 +0000 Subject: Use G_BEGIN/END_DECLS in public libpurple files. This was previously inconsistent. Sometimes there was even both the GLib macros and an extern "C" line. --- libpurple/account.h | 8 ++------ libpurple/accountopt.h | 9 ++------- libpurple/blist.h | 8 ++------ libpurple/buddyicon.h | 9 ++------- libpurple/certificate.h | 11 +++-------- libpurple/circbuffer.h | 10 +++------- libpurple/cmds.h | 8 ++------ libpurple/connection.h | 8 ++------ libpurple/conversation.h | 8 ++------ libpurple/core.h | 8 ++------ libpurple/dbus-bindings.h | 8 ++------ libpurple/dbus-useful.h | 6 +++--- libpurple/debug.h | 8 ++------ libpurple/dnsquery.h | 8 ++------ libpurple/dnssrv.h | 10 +++------- libpurple/eventloop.h | 10 +++------- libpurple/ft.h | 8 ++------ libpurple/idle.h | 8 ++------ libpurple/imgstore.h | 8 ++------ libpurple/log.h | 8 ++------ libpurple/media-gst.h | 10 +--------- libpurple/media.h | 16 ++++------------ libpurple/mediamanager.h | 10 +--------- libpurple/mime.h | 10 +++------- libpurple/nat-pmp.h | 4 ++++ libpurple/network.h | 10 ++++------ libpurple/notify.h | 8 ++------ libpurple/ntlm.h | 8 ++------ libpurple/plugin.h | 8 ++------ libpurple/pluginpref.h | 8 ++------ libpurple/pounce.h | 8 ++------ libpurple/prefs.h | 8 ++------ libpurple/privacy.h | 10 +++------- libpurple/proxy.h | 8 ++------ libpurple/prpl.h | 8 ++------ libpurple/request.h | 8 ++------ libpurple/roomlist.h | 8 ++------ libpurple/savedstatuses.h | 9 +++------ libpurple/server.h | 9 +++------ libpurple/signals.h | 9 +++------ libpurple/smiley.h | 8 ++------ libpurple/sound.h | 8 ++------ libpurple/sslconn.h | 8 ++------ libpurple/status.h | 9 +++------ libpurple/stringref.h | 10 +++------- libpurple/stun.h | 10 +++------- libpurple/upnp.h | 8 ++------ libpurple/util.h | 10 +++------- libpurple/value.h | 8 ++------ libpurple/whiteboard.h | 8 ++------ libpurple/xmlnode.h | 10 +++------- 51 files changed, 121 insertions(+), 322 deletions(-) diff --git a/libpurple/account.h b/libpurple/account.h index 69fd16cbe9..70296b82d9 100644 --- a/libpurple/account.h +++ b/libpurple/account.h @@ -171,9 +171,7 @@ struct _PurpleAccount PurpleConnectionErrorInfo *current_error; /**< Errors */ }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Account API */ @@ -1191,8 +1189,6 @@ void purple_accounts_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_ACCOUNT_H_ */ diff --git a/libpurple/accountopt.h b/libpurple/accountopt.h index b0b7d392ea..eed7b4f657 100644 --- a/libpurple/accountopt.h +++ b/libpurple/accountopt.h @@ -37,10 +37,7 @@ typedef struct _PurpleAccountOption PurpleAccountOption; /** @copydoc _PurpleAccountUserSplit */ typedef struct _PurpleAccountUserSplit PurpleAccountUserSplit; - -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Account Option API */ @@ -353,8 +350,6 @@ void purple_account_user_split_set_reverse(PurpleAccountUserSplit *split, gboole /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_ACCOUNTOPT_H_ */ diff --git a/libpurple/blist.h b/libpurple/blist.h index c7f9b636c5..881c3fa1b7 100644 --- a/libpurple/blist.h +++ b/libpurple/blist.h @@ -244,9 +244,7 @@ struct _PurpleBlistUiOps void (*_purple_reserved1)(void); }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Buddy List API */ @@ -1202,8 +1200,6 @@ void purple_blist_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_BLIST_H_ */ diff --git a/libpurple/buddyicon.h b/libpurple/buddyicon.h index 193277e3ed..873f828304 100644 --- a/libpurple/buddyicon.h +++ b/libpurple/buddyicon.h @@ -39,10 +39,7 @@ typedef struct _PurpleBuddyIcon PurpleBuddyIcon; #include "prpl.h" #include "util.h" -#ifdef __cplusplus -extern "C" { -#endif - +G_BEGIN_DECLS /**************************************************************************/ /** @name Buddy Icon API */ @@ -397,8 +394,6 @@ void purple_buddy_icon_get_scale_size(PurpleBuddyIconSpec *spec, int *width, int /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_BUDDYICON_H_ */ diff --git a/libpurple/certificate.h b/libpurple/certificate.h index c13b38696d..bee2a0ffca 100644 --- a/libpurple/certificate.h +++ b/libpurple/certificate.h @@ -34,11 +34,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - typedef enum { PURPLE_CERTIFICATE_INVALID = 0, @@ -357,6 +352,8 @@ struct _PurpleCertificateVerificationRequest gpointer cb_data; }; +G_BEGIN_DECLS + /*****************************************************************************/ /** @name Certificate Verification Functions */ /*****************************************************************************/ @@ -833,8 +830,6 @@ purple_certificate_display_x509(PurpleCertificate *crt); */ void purple_certificate_add_ca_search_path(const char *path); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* _PURPLE_CERTIFICATE_H */ diff --git a/libpurple/circbuffer.h b/libpurple/circbuffer.h index 77e7724161..7e9283404c 100644 --- a/libpurple/circbuffer.h +++ b/libpurple/circbuffer.h @@ -26,10 +26,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - typedef struct _PurpleCircBuffer { /** A pointer to the starting address of our chunk of memory. */ @@ -55,6 +51,8 @@ typedef struct _PurpleCircBuffer { } PurpleCircBuffer; +G_BEGIN_DECLS + /** * Creates a new circular buffer. This will not allocate any memory for the * actual buffer until data is appended to it. @@ -111,8 +109,6 @@ gsize purple_circ_buffer_get_max_read(const PurpleCircBuffer *buf); */ gboolean purple_circ_buffer_mark_read(PurpleCircBuffer *buf, gsize len); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _CIRCBUFFER_H */ diff --git a/libpurple/cmds.h b/libpurple/cmds.h index 87fce8090d..80549afdf1 100644 --- a/libpurple/cmds.h +++ b/libpurple/cmds.h @@ -99,9 +99,7 @@ typedef enum { /*@}*/ -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Commands API */ @@ -240,8 +238,6 @@ void purple_cmds_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_CMDS_H_ */ diff --git a/libpurple/connection.h b/libpurple/connection.h index 9ff72d4ed3..65c88d61b1 100644 --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -258,9 +258,7 @@ struct _PurpleConnection prpl to avoid sending unneeded keepalives */ }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Connection API */ @@ -543,8 +541,6 @@ void *purple_connections_get_handle(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_CONNECTION_H_ */ diff --git a/libpurple/conversation.h b/libpurple/conversation.h index 32e992f352..80262ef809 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -249,9 +249,7 @@ struct _PurpleConversationUiOps void (*_purple_reserved4)(void); }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Conversation API */ @@ -1402,8 +1400,6 @@ void purple_conversations_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_CONVERSATION_H_ */ diff --git a/libpurple/core.h b/libpurple/core.h index 5c67e35dd6..19447b159f 100644 --- a/libpurple/core.h +++ b/libpurple/core.h @@ -76,9 +76,7 @@ typedef struct void (*_purple_reserved3)(void); } PurpleCoreUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Initializes the core of purple. @@ -197,9 +195,7 @@ gboolean purple_core_ensure_single_instance(void); */ GHashTable* purple_core_get_ui_info(void); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_CORE_H_ */ diff --git a/libpurple/dbus-bindings.h b/libpurple/dbus-bindings.h index 1d6f95875e..4bd7fa6f96 100644 --- a/libpurple/dbus-bindings.h +++ b/libpurple/dbus-bindings.h @@ -32,9 +32,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS gint purple_dbus_pointer_to_id(gconstpointer node); gpointer purple_dbus_id_to_pointer(gint id, PurpleDBusType *type); @@ -103,8 +101,6 @@ void purple_dbus_register_bindings(void *handle, PurpleDBusBinding *bindings); DBusConnection *purple_dbus_get_connection(void); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif diff --git a/libpurple/dbus-useful.h b/libpurple/dbus-useful.h index 663c4c7a10..9d7b34dc5a 100644 --- a/libpurple/dbus-useful.h +++ b/libpurple/dbus-useful.h @@ -1,5 +1,7 @@ #include "conversation.h" +G_BEGIN_DECLS + PurpleAccount *purple_accounts_find_ext(const char *name, const char *protocol_id, gboolean (*account_test)(const PurpleAccount *account)); @@ -7,7 +9,5 @@ PurpleAccount *purple_accounts_find_any(const char *name, const char *protocol); PurpleAccount *purple_accounts_find_connected(const char *name, const char *protocol); - - - +G_END_DECLS diff --git a/libpurple/debug.h b/libpurple/debug.h index 475df9f335..ba7cc92ef3 100644 --- a/libpurple/debug.h +++ b/libpurple/debug.h @@ -59,9 +59,7 @@ typedef struct void (*_purple_reserved4)(void); } PurpleDebugUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Debug API */ @@ -228,8 +226,6 @@ void purple_debug_init(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_DEBUG_H_ */ diff --git a/libpurple/dnsquery.h b/libpurple/dnsquery.h index 84183f4383..9c811b684f 100644 --- a/libpurple/dnsquery.h +++ b/libpurple/dnsquery.h @@ -76,9 +76,7 @@ typedef struct void (*_purple_reserved4)(void); } PurpleDnsQueryUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name DNS query API */ @@ -154,8 +152,6 @@ void purple_dnsquery_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_DNSQUERY_H_ */ diff --git a/libpurple/dnssrv.h b/libpurple/dnssrv.h index c0eb194c41..747d8bda17 100644 --- a/libpurple/dnssrv.h +++ b/libpurple/dnssrv.h @@ -24,10 +24,6 @@ #ifndef _PURPLE_DNSSRV_H #define _PURPLE_DNSSRV_H -#ifdef __cplusplus -extern "C" { -#endif - typedef struct _PurpleSrvTxtQueryData PurpleSrvTxtQueryData; typedef struct _PurpleSrvResponse PurpleSrvResponse; typedef struct _PurpleTxtResponse PurpleTxtResponse; @@ -96,6 +92,8 @@ typedef void (*PurpleSrvCallback)(PurpleSrvResponse *resp, int results, gpointer */ typedef void (*PurpleTxtCallback)(GList *responses, gpointer data); +G_BEGIN_DECLS + /** * Queries an SRV record. * @@ -184,9 +182,7 @@ char *purple_srv_txt_query_get_query(PurpleSrvTxtQueryData *query_data); */ int purple_srv_txt_query_get_type(PurpleSrvTxtQueryData *query_data); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_DNSSRV_H */ diff --git a/libpurple/eventloop.h b/libpurple/eventloop.h index 76448492ce..01465a150a 100644 --- a/libpurple/eventloop.h +++ b/libpurple/eventloop.h @@ -28,10 +28,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /** * An input condition. */ @@ -154,6 +150,8 @@ struct _PurpleEventLoopUiOps void (*_purple_reserved4)(void); }; +G_BEGIN_DECLS + /**************************************************************************/ /** @name Event Loop API */ /**************************************************************************/ @@ -266,8 +264,6 @@ PurpleEventLoopUiOps *purple_eventloop_get_ui_ops(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_EVENTLOOP_H_ */ diff --git a/libpurple/ft.h b/libpurple/ft.h index 8f18877d5c..0505db5841 100644 --- a/libpurple/ft.h +++ b/libpurple/ft.h @@ -184,9 +184,7 @@ struct _PurpleXfer void *proto_data; /**< prpl-specific data. */ }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name File Transfer API */ @@ -843,9 +841,7 @@ PurpleXferUiOps *purple_xfers_get_ui_ops(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_FT_H_ */ diff --git a/libpurple/idle.h b/libpurple/idle.h index f01c75bc60..76c78d1258 100644 --- a/libpurple/idle.h +++ b/libpurple/idle.h @@ -41,9 +41,7 @@ typedef struct void (*_purple_reserved4)(void); } PurpleIdleUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Idle API */ @@ -97,8 +95,6 @@ void purple_idle_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_IDLE_H_ */ diff --git a/libpurple/imgstore.h b/libpurple/imgstore.h index f647bf32e8..75e5fdb358 100644 --- a/libpurple/imgstore.h +++ b/libpurple/imgstore.h @@ -34,9 +34,7 @@ */ typedef struct _PurpleStoredImage PurpleStoredImage; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Add an image to the store. @@ -206,8 +204,6 @@ void purple_imgstore_init(void); */ void purple_imgstore_uninit(void); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_IMGSTORE_H_ */ diff --git a/libpurple/log.h b/libpurple/log.h index e57e9f7487..1e12844d5a 100644 --- a/libpurple/log.h +++ b/libpurple/log.h @@ -181,9 +181,7 @@ struct _PurpleLogSet { * IMPORTANT: Update that code if you add members here. */ }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /***************************************/ /** @name Log Functions */ @@ -574,8 +572,6 @@ void purple_log_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_LOG_H_ */ diff --git a/libpurple/media-gst.h b/libpurple/media-gst.h index 32d2b3c9d2..37581ec4f9 100644 --- a/libpurple/media-gst.h +++ b/libpurple/media-gst.h @@ -32,8 +32,6 @@ #include -G_BEGIN_DECLS - #define PURPLE_TYPE_MEDIA_ELEMENT_TYPE (purple_media_element_type_get_type()) #define PURPLE_TYPE_MEDIA_ELEMENT_INFO (purple_media_element_info_get_type()) #define PURPLE_MEDIA_ELEMENT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo)) @@ -73,9 +71,7 @@ typedef enum { PURPLE_MEDIA_ELEMENT_SINK = 1 << 10, /** can be set as an active sink */ } PurpleMediaElementType; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Gets the element type's GType. @@ -176,10 +172,6 @@ GstElement *purple_media_element_info_call_create( PurpleMediaElementInfo *info, PurpleMedia *media, const gchar *session_id, const gchar *participant); -#ifdef __cplusplus -} -#endif - G_END_DECLS #endif /* _PURPLE_MEDIA_GST_H_ */ diff --git a/libpurple/media.h b/libpurple/media.h index ce23a98587..b55ed14f69 100644 --- a/libpurple/media.h +++ b/libpurple/media.h @@ -27,14 +27,12 @@ #ifndef _PURPLE_MEDIA_H_ #define _PURPLE_MEDIA_H_ -#include "media/candidate.h" -#include "media/codec.h" -#include "media/enum-types.h" - #include #include -G_BEGIN_DECLS +#include "media/candidate.h" +#include "media/codec.h" +#include "media/enum-types.h" #define PURPLE_TYPE_MEDIA (purple_media_get_type()) #define PURPLE_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA, PurpleMedia)) @@ -49,9 +47,7 @@ typedef struct _PurpleMedia PurpleMedia; #include "signals.h" #include "util.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Gets the media class's GType @@ -379,10 +375,6 @@ gulong purple_media_set_output_window(PurpleMedia *media, */ void purple_media_remove_output_windows(PurpleMedia *media); -#ifdef __cplusplus -} -#endif - G_END_DECLS #endif /* _PURPLE_MEDIA_H_ */ diff --git a/libpurple/mediamanager.h b/libpurple/mediamanager.h index 099972a4ac..b3d8f315d6 100644 --- a/libpurple/mediamanager.h +++ b/libpurple/mediamanager.h @@ -38,8 +38,6 @@ typedef struct _PurpleMediaManagerClass PurpleMediaManagerClass; #include "account.h" #include "media.h" -G_BEGIN_DECLS - #define PURPLE_TYPE_MEDIA_MANAGER (purple_media_manager_get_type()) #define PURPLE_MEDIA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManager)) #define PURPLE_MEDIA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerClass)) @@ -47,9 +45,7 @@ G_BEGIN_DECLS #define PURPLE_IS_MEDIA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_MANAGER)) #define PURPLE_MEDIA_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerClass)) -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Media Manager API */ @@ -209,10 +205,6 @@ GType purple_media_manager_get_backend_type(PurpleMediaManager *manager); /*}@*/ -#ifdef __cplusplus -} -#endif - G_END_DECLS #endif /* _PURPLE_MEDIA_MANAGER_H_ */ diff --git a/libpurple/mime.h b/libpurple/mime.h index b568a49288..abf25d36b1 100644 --- a/libpurple/mime.h +++ b/libpurple/mime.h @@ -26,10 +26,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /** * @file mime.h * @ingroup core @@ -48,6 +44,8 @@ typedef struct _PurpleMimeDocument PurpleMimeDocument; */ typedef struct _PurpleMimePart PurpleMimePart; +G_BEGIN_DECLS + /** * Allocate an empty MIME document. */ @@ -211,8 +209,6 @@ gsize purple_mime_part_get_length(PurpleMimePart *part); void purple_mime_part_set_data(PurpleMimePart *part, const char *data); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif diff --git a/libpurple/nat-pmp.h b/libpurple/nat-pmp.h index 077c74c30c..1c2aa47ba2 100644 --- a/libpurple/nat-pmp.h +++ b/libpurple/nat-pmp.h @@ -41,6 +41,8 @@ typedef enum { PURPLE_PMP_TYPE_TCP } PurplePmpType; +G_BEGIN_DECLS + /** * Initialize nat-pmp */ @@ -73,5 +75,7 @@ gboolean purple_pmp_create_map(PurplePmpType type, unsigned short privateport, u */ gboolean purple_pmp_destroy_map(PurplePmpType type, unsigned short privateport); +G_END_DECLS + #endif diff --git a/libpurple/network.h b/libpurple/network.h index 7686214906..788c487865 100644 --- a/libpurple/network.h +++ b/libpurple/network.h @@ -26,9 +26,9 @@ #ifndef _PURPLE_NETWORK_H_ #define _PURPLE_NETWORK_H_ -#ifdef __cplusplus -extern "C" { -#endif +#include + +G_BEGIN_DECLS /**************************************************************************/ /** @name Network API */ @@ -316,8 +316,6 @@ void purple_network_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_NETWORK_H_ */ diff --git a/libpurple/notify.h b/libpurple/notify.h index ec4d34968f..ea7ab2b7c5 100644 --- a/libpurple/notify.h +++ b/libpurple/notify.h @@ -175,9 +175,7 @@ typedef struct } PurpleNotifyUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ @@ -734,8 +732,6 @@ void purple_notify_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_NOTIFY_H_ */ diff --git a/libpurple/ntlm.h b/libpurple/ntlm.h index e61a4f5f07..e67df3f828 100644 --- a/libpurple/ntlm.h +++ b/libpurple/ntlm.h @@ -27,9 +27,7 @@ #ifndef _PURPLE_NTLM_H #define _PURPLE_NTLM_H -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Generates the base64 encoded type 1 message needed for NTLM authentication @@ -66,8 +64,6 @@ guint8 *purple_ntlm_parse_type2(const gchar *type2, guint32 *flags); */ gchar *purple_ntlm_gen_type3(const gchar *username, const gchar *passw, const gchar *hostname, const gchar *domain, const guint8 *nonce, guint32 *flags); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_NTLM_H */ diff --git a/libpurple/plugin.h b/libpurple/plugin.h index 5d6b48b663..c4ae3b889f 100644 --- a/libpurple/plugin.h +++ b/libpurple/plugin.h @@ -239,9 +239,7 @@ struct _PurplePluginAction { #endif -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Plugin API */ @@ -663,8 +661,6 @@ PurplePluginAction *purple_plugin_action_new(const char* label, void (*callback) */ void purple_plugin_action_free(PurplePluginAction *action); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_PLUGIN_H_ */ diff --git a/libpurple/pluginpref.h b/libpurple/pluginpref.h index 6ce04ad9ab..85112321b7 100644 --- a/libpurple/pluginpref.h +++ b/libpurple/pluginpref.h @@ -50,9 +50,7 @@ typedef enum { #include #include "prefs.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Plugin Preference API */ @@ -262,8 +260,6 @@ PurpleStringFormatType purple_plugin_pref_get_format_type(PurplePluginPref *pref /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_PLUGINPREF_H_ */ diff --git a/libpurple/pounce.h b/libpurple/pounce.h index 1b3a30cdc7..68a607876f 100644 --- a/libpurple/pounce.h +++ b/libpurple/pounce.h @@ -59,9 +59,7 @@ typedef enum /** A pounce callback. */ typedef void (*PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *); -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Buddy Pounce API */ @@ -354,8 +352,6 @@ void purple_pounces_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_POUNCE_H_ */ diff --git a/libpurple/prefs.h b/libpurple/prefs.h index 42fc7687bb..ad8cdd5fc1 100644 --- a/libpurple/prefs.h +++ b/libpurple/prefs.h @@ -62,9 +62,7 @@ typedef enum typedef void (*PurplePrefCallback) (const char *name, PurplePrefType type, gconstpointer val, gpointer data); -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Prefs API @@ -362,8 +360,6 @@ void purple_prefs_update_old(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_PREFS_H_ */ diff --git a/libpurple/privacy.h b/libpurple/privacy.h index 7da35d4902..19ef9d6494 100644 --- a/libpurple/privacy.h +++ b/libpurple/privacy.h @@ -40,10 +40,6 @@ typedef enum #include "account.h" -#ifdef __cplusplus -extern "C" { -#endif - /** * Privacy core/UI operations. */ @@ -60,6 +56,8 @@ typedef struct void (*_purple_reserved4)(void); } PurplePrivacyUiOps; +G_BEGIN_DECLS + /** * Adds a user to the account's permit list. * @@ -187,8 +185,6 @@ PurplePrivacyUiOps *purple_privacy_get_ui_ops(void); */ void purple_privacy_init(void); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_PRIVACY_H_ */ diff --git a/libpurple/proxy.h b/libpurple/proxy.h index e12e328bc2..fad49f3c50 100644 --- a/libpurple/proxy.h +++ b/libpurple/proxy.h @@ -56,9 +56,7 @@ typedef void (*PurpleProxyConnectFunction)(gpointer data, gint source, const gch #include "account.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Proxy structure API */ @@ -326,8 +324,6 @@ void purple_proxy_connect_cancel_with_handle(void *handle); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_PROXY_H_ */ diff --git a/libpurple/prpl.h b/libpurple/prpl.h index f20cfb2a25..635fcb47cb 100644 --- a/libpurple/prpl.h +++ b/libpurple/prpl.h @@ -621,9 +621,7 @@ struct _PurplePluginProtocolInfo #define PURPLE_PLUGIN_PROTOCOL_INFO(plugin) \ ((PurplePluginProtocolInfo *)(plugin)->info->extra_info) -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Attention Type API */ @@ -951,8 +949,6 @@ PurplePlugin *purple_find_prpl(const char *id); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PRPL_H_ */ diff --git a/libpurple/request.h b/libpurple/request.h index 009c32bedb..b3fc852fe2 100644 --- a/libpurple/request.h +++ b/libpurple/request.h @@ -158,9 +158,7 @@ typedef void (*PurpleRequestChoiceCb)(void *, int); typedef void (*PurpleRequestFieldsCb)(void *, PurpleRequestFields *fields); typedef void (*PurpleRequestFileCb)(void *, const char *filename); -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Field List API */ @@ -1527,8 +1525,6 @@ PurpleRequestUiOps *purple_request_get_ui_ops(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_REQUEST_H_ */ diff --git a/libpurple/roomlist.h b/libpurple/roomlist.h index b85933b76b..83161b8360 100644 --- a/libpurple/roomlist.h +++ b/libpurple/roomlist.h @@ -81,9 +81,7 @@ struct _PurpleRoomlistUiOps { }; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Room List API */ @@ -412,8 +410,6 @@ PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_ROOMLIST_H_ */ diff --git a/libpurple/savedstatuses.h b/libpurple/savedstatuses.h index bd5b091343..53be07cd55 100644 --- a/libpurple/savedstatuses.h +++ b/libpurple/savedstatuses.h @@ -60,9 +60,7 @@ typedef struct _PurpleSavedStatusSub PurpleSavedStatusSub; #include "status.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Saved status subsystem */ @@ -418,8 +416,7 @@ void purple_savedstatuses_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SAVEDSTATUSES_H_ */ + diff --git a/libpurple/server.h b/libpurple/server.h index 3ddff92036..d80b05d224 100644 --- a/libpurple/server.h +++ b/libpurple/server.h @@ -30,9 +30,7 @@ #include "conversation.h" #include "prpl.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Send a typing message to a given user over a given connection. @@ -185,8 +183,7 @@ void serv_got_chat_in(PurpleConnection *g, int id, const char *who, PurpleMessageFlags flags, const char *message, time_t mtime); void serv_send_file(PurpleConnection *gc, const char *who, const char *file); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SERVER_H_ */ + diff --git a/libpurple/signals.h b/libpurple/signals.h index 8499cebe5f..aa732050ef 100644 --- a/libpurple/signals.h +++ b/libpurple/signals.h @@ -35,9 +35,7 @@ typedef void (*PurpleCallback)(void); typedef void (*PurpleSignalMarshalFunc)(PurpleCallback cb, va_list args, void *data, void **return_val); -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Signal API */ @@ -373,8 +371,7 @@ void purple_marshal_POINTER__POINTER_POINTER( PurpleCallback cb, va_list args, void *data, void **return_val); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SIGNALS_H_ */ + diff --git a/libpurple/smiley.h b/libpurple/smiley.h index 9721c228da..c297d1daf0 100644 --- a/libpurple/smiley.h +++ b/libpurple/smiley.h @@ -50,9 +50,7 @@ typedef struct _PurpleSmileyClass PurpleSmileyClass; #define PURPLE_IS_SMILEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_SMILEY)) #define PURPLE_SMILEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_SMILEY, PurpleSmileyClass)) -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Custom Smiley API */ @@ -253,9 +251,7 @@ void purple_smileys_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SMILEY_H_ */ diff --git a/libpurple/sound.h b/libpurple/sound.h index 352ab43efb..cd46ed137c 100644 --- a/libpurple/sound.h +++ b/libpurple/sound.h @@ -72,9 +72,7 @@ typedef struct _PurpleSoundUiOps void (*_purple_reserved4)(void); } PurpleSoundUiOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name Sound API */ @@ -136,8 +134,6 @@ void *purple_sounds_get_handle(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SOUND_H_ */ diff --git a/libpurple/sslconn.h b/libpurple/sslconn.h index bb176505df..6987fb0e91 100644 --- a/libpurple/sslconn.h +++ b/libpurple/sslconn.h @@ -140,9 +140,7 @@ typedef struct void (*_purple_reserved4)(void); } PurpleSslOps; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name SSL API */ @@ -311,8 +309,6 @@ void purple_ssl_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_SSLCONN_H_ */ diff --git a/libpurple/status.h b/libpurple/status.h index a0bed2eb6a..6c7e525776 100644 --- a/libpurple/status.h +++ b/libpurple/status.h @@ -148,9 +148,7 @@ typedef enum #define PURPLE_MOOD_NAME "mood" #define PURPLE_MOOD_COMMENT "moodtext" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name PurpleStatusPrimitive API */ @@ -945,8 +943,7 @@ void purple_status_uninit(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_STATUS_H_ */ + diff --git a/libpurple/stringref.h b/libpurple/stringref.h index cbb9eecb19..debbe1fd5c 100644 --- a/libpurple/stringref.h +++ b/libpurple/stringref.h @@ -29,12 +29,10 @@ #ifndef _PURPLE_STRINGREF_H_ #define _PURPLE_STRINGREF_H_ -#ifdef __cplusplus -extern "C" { -#endif - typedef struct _PurpleStringref PurpleStringref; +G_BEGIN_DECLS + /** * Creates an immutable reference-counted string object. The newly * created object will have a reference count of 1. @@ -131,8 +129,6 @@ int purple_stringref_cmp(const PurpleStringref *s1, const PurpleStringref *s2); */ size_t purple_stringref_len(const PurpleStringref *stringref); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_STRINGREF_H_ */ diff --git a/libpurple/stun.h b/libpurple/stun.h index b51a61c7e5..003f19f0cd 100644 --- a/libpurple/stun.h +++ b/libpurple/stun.h @@ -26,10 +26,6 @@ #ifndef _PURPLE_STUN_H_ #define _PURPLE_STUN_H_ -#ifdef __cplusplus -extern "C" { -#endif - /**************************************************************************/ /** @name STUN API */ /**************************************************************************/ @@ -63,6 +59,8 @@ struct _PurpleStunNatDiscovery { typedef void (*StunCallback) (PurpleStunNatDiscovery *); +G_BEGIN_DECLS + /** * Starts a NAT discovery. It returns a PurpleStunNatDiscovery if the discovery * is already done. Otherwise the callback is called when the discovery is over @@ -81,8 +79,6 @@ void purple_stun_init(void); /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_STUN_H_ */ diff --git a/libpurple/upnp.h b/libpurple/upnp.h index b0e4ab4e47..d47c583527 100644 --- a/libpurple/upnp.h +++ b/libpurple/upnp.h @@ -29,9 +29,7 @@ typedef struct _UPnPMappingAddRemove UPnPMappingAddRemove; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /**************************************************************************/ /** @name UPnP API */ @@ -125,8 +123,6 @@ UPnPMappingAddRemove *purple_upnp_remove_port_mapping(unsigned short portmap, /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_UPNP_H_ */ diff --git a/libpurple/util.h b/libpurple/util.h index 36d06ff165..cb39e6529a 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -58,10 +58,6 @@ typedef struct _PurpleKeyValuePair PurpleKeyValuePair; #include "notify.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef char *(*PurpleInfoFieldFormatCallback)(const char *field, size_t len); struct _PurpleKeyValuePair @@ -71,6 +67,8 @@ struct _PurpleKeyValuePair }; +G_BEGIN_DECLS + /** * Creates a new PurpleMenuAction. * @@ -1459,8 +1457,6 @@ const gchar *purple_get_host_name(void); */ gchar *purple_uuid_random(void); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_UTIL_H_ */ diff --git a/libpurple/value.h b/libpurple/value.h index b8724ac40f..5cd26afbc9 100644 --- a/libpurple/value.h +++ b/libpurple/value.h @@ -88,9 +88,7 @@ typedef enum */ typedef struct _PurpleValue PurpleValue; -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Creates a new PurpleValue. @@ -464,8 +462,6 @@ int purple_value_get_enum(const PurpleValue *value); */ void *purple_value_get_boxed(const PurpleValue *value); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_VALUE_H_ */ diff --git a/libpurple/whiteboard.h b/libpurple/whiteboard.h index bd2d4fdfad..3fa491095a 100644 --- a/libpurple/whiteboard.h +++ b/libpurple/whiteboard.h @@ -79,9 +79,7 @@ struct _PurpleWhiteboardPrplOps void (*_purple_reserved4)(void); }; -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS /******************************************************************************/ /** @name PurpleWhiteboard API */ @@ -330,8 +328,6 @@ gpointer purple_whiteboard_get_ui_data(const PurpleWhiteboard *wb); /*@}*/ -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* _PURPLE_WHITEBOARD_H_ */ diff --git a/libpurple/xmlnode.h b/libpurple/xmlnode.h index 359eef0e03..8bbf0b1a7d 100644 --- a/libpurple/xmlnode.h +++ b/libpurple/xmlnode.h @@ -28,10 +28,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - /** * The valid types for an xmlnode */ @@ -61,6 +57,8 @@ struct _xmlnode GHashTable *namespace_map; /**< The namespace map. */ }; +G_BEGIN_DECLS + /** * Creates a new xmlnode. * @@ -360,9 +358,7 @@ void xmlnode_free(xmlnode *node); xmlnode *xmlnode_from_file(const char *dir, const char *filename, const char *description, const char *process); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PURPLE_XMLNODE_H_ */ -- cgit v1.2.1 From 5ceffd8c0be65f3d7d98d5700444b04ad3e33e7c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 3 Jan 2012 23:36:11 +0000 Subject: Fix some spelling. --- libpurple/nat-pmp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/nat-pmp.h b/libpurple/nat-pmp.h index 1c2aa47ba2..ae6fb784dc 100644 --- a/libpurple/nat-pmp.h +++ b/libpurple/nat-pmp.h @@ -61,7 +61,7 @@ char *purple_pmp_get_public_ip(void); * @param publicport The public port on which we are expecting a response * @param lifetime The lifetime of the mapping. It is recommended that this be PURPLE_PMP_LIFETIME. * - * @returns TRUE if succesful; FALSE if unsuccessful + * @returns TRUE if successful; FALSE if unsuccessful */ gboolean purple_pmp_create_map(PurplePmpType type, unsigned short privateport, unsigned short publicport, int lifetime); @@ -71,7 +71,7 @@ gboolean purple_pmp_create_map(PurplePmpType type, unsigned short privateport, u * @param type The PurplePmpType * @param privateport The private port on which the mapping was previously made * - * @returns TRUE if succesful; FALSE if unsuccessful + * @returns TRUE if successful; FALSE if unsuccessful */ gboolean purple_pmp_destroy_map(PurplePmpType type, unsigned short privateport); -- cgit v1.2.1 From bf61ec7d10a30de3fb7d5f18b6579148d6bfd3c0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 3 Jan 2012 23:37:11 +0000 Subject: Re-align stuff. --- libpurple/nat-pmp.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libpurple/nat-pmp.h b/libpurple/nat-pmp.h index ae6fb784dc..44470c689b 100644 --- a/libpurple/nat-pmp.h +++ b/libpurple/nat-pmp.h @@ -56,19 +56,21 @@ char *purple_pmp_get_public_ip(void); /** * Remove the NAT-PMP mapping for a specified type on a specified port * - * @param type The PurplePmpType + * @param type The PurplePmpType * @param privateport The private port on which we are listening locally - * @param publicport The public port on which we are expecting a response - * @param lifetime The lifetime of the mapping. It is recommended that this be PURPLE_PMP_LIFETIME. + * @param publicport The public port on which we are expecting a response + * @param lifetime The lifetime of the mapping. It is recommended that this + * be PURPLE_PMP_LIFETIME. * * @returns TRUE if successful; FALSE if unsuccessful */ -gboolean purple_pmp_create_map(PurplePmpType type, unsigned short privateport, unsigned short publicport, int lifetime); +gboolean purple_pmp_create_map(PurplePmpType type, unsigned short privateport, + unsigned short publicport, int lifetime); /** * Remove the NAT-PMP mapping for a specified type on a specified port * - * @param type The PurplePmpType + * @param type The PurplePmpType * @param privateport The private port on which the mapping was previously made * * @returns TRUE if successful; FALSE if unsuccessful -- cgit v1.2.1 From 17490d05fc802c8732c02936195a46af85b79dee Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 00:00:42 +0000 Subject: Add G_BEGIN/END_DECLS to Pidgin public headers, most of which did not have these checks. --- pidgin/gtkaccount.h | 4 ++++ pidgin/gtkblist-theme.h | 4 +++- pidgin/gtkblist.h | 3 +++ pidgin/gtkcellrendererexpander.h | 12 +++--------- pidgin/gtkcertmgr.h | 4 ++++ pidgin/gtkconn.h | 4 ++++ pidgin/gtkconv.h | 4 ++++ pidgin/gtkconvwin.h | 4 ++++ pidgin/gtkdebug.h | 4 ++++ pidgin/gtkdialogs.h | 4 ++++ pidgin/gtkdnd-hints.h | 4 ++++ pidgin/gtkdocklet.h | 4 ++++ pidgin/gtkeventloop.h | 4 ++++ pidgin/gtkft.h | 4 ++++ pidgin/gtkidle.h | 4 ++++ pidgin/gtkimhtml.h | 8 ++------ pidgin/gtkimhtmltoolbar.h | 8 ++------ pidgin/gtklog.h | 3 +++ pidgin/gtknotify.h | 4 ++++ pidgin/gtkplugin.h | 4 ++++ pidgin/gtkpluginpref.h | 8 ++------ pidgin/gtkpounce.h | 4 ++++ pidgin/gtkprefs.h | 4 ++++ pidgin/gtkprivacy.h | 4 ++++ pidgin/gtkrequest.h | 4 ++++ pidgin/gtkroomlist.h | 4 ++++ pidgin/gtksavedstatuses.h | 4 ++++ pidgin/gtksession.h | 4 ++++ pidgin/gtksmiley.h | 4 ++++ pidgin/gtksound.h | 4 ++++ pidgin/gtksourceundomanager.h | 4 ++++ pidgin/gtkthemes.h | 4 ++++ pidgin/gtkutils.h | 8 ++++---- pidgin/gtkwebview.h | 3 +++ pidgin/gtkwhiteboard.h | 8 ++------ pidgin/pidgintooltip.h | 4 ++++ pidgin/smileyparser.h | 4 ++++ 37 files changed, 135 insertions(+), 38 deletions(-) diff --git a/pidgin/gtkaccount.h b/pidgin/gtkaccount.h index e9a5a5319b..8410d8817d 100644 --- a/pidgin/gtkaccount.h +++ b/pidgin/gtkaccount.h @@ -37,6 +37,8 @@ typedef enum } PidginAccountDialogType; +G_BEGIN_DECLS + /** * Shows the accounts window. */ @@ -80,4 +82,6 @@ void pidgin_account_init(void); */ void pidgin_account_uninit(void); +G_END_DECLS + #endif /* _PIDGINACCOUNT_H_ */ diff --git a/pidgin/gtkblist-theme.h b/pidgin/gtkblist-theme.h index db5c6fb9be..adcf65c1d6 100644 --- a/pidgin/gtkblist-theme.h +++ b/pidgin/gtkblist-theme.h @@ -79,6 +79,8 @@ typedef struct } PidginBlistLayout; +G_BEGIN_DECLS + /**************************************************************************/ /** @name PidginThemeFont API */ /**************************************************************************/ @@ -146,7 +148,6 @@ const gchar * pidgin_theme_font_get_color_describe(PidginThemeFont *font); /**************************************************************************/ /** @name Purple Buddy List Theme API */ /**************************************************************************/ -G_BEGIN_DECLS /** * GObject foo. @@ -434,4 +435,5 @@ void pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme void pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair); G_END_DECLS + #endif /* PIDGIN_BLIST_THEME_H */ diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index 37e79a4029..36ad62af43 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -127,6 +127,8 @@ struct _PidginBuddyList { #define PIDGIN_IS_PIDGIN_BLIST(list) \ (purple_blist_get_ui_ops() == pidgin_blist_get_ui_ops()) +G_BEGIN_DECLS + /************************************************************************** * @name GTK+ Buddy List API **************************************************************************/ @@ -397,5 +399,6 @@ void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget); */ void pidgin_blist_tooltip_destroy(void); +G_END_DECLS #endif /* _PIDGINBLIST_H_ */ diff --git a/pidgin/gtkcellrendererexpander.h b/pidgin/gtkcellrendererexpander.h index 983a9bd84a..d95b9bdaee 100644 --- a/pidgin/gtkcellrendererexpander.h +++ b/pidgin/gtkcellrendererexpander.h @@ -23,11 +23,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - #define PIDGIN_TYPE_GTK_CELL_RENDERER_EXPANDER (pidgin_cell_renderer_expander_get_type()) #define PIDGIN_CELL_RENDERER_EXPANDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PIDGIN_TYPE_GTK_CELL_RENDERER_EXPANDER, PidginCellRendererExpander)) #define PIDGIN_CELL_RENDERER_EXPANDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_GTK_CELL_RENDERER_EXPANDER, PidginCellRendererExpanderClass)) @@ -48,12 +43,11 @@ struct _PidginCellRendererExpanderClass { GtkCellRendererClass parent_class; }; +G_BEGIN_DECLS + GType pidgin_cell_renderer_expander_get_type (void); GtkCellRenderer *pidgin_cell_renderer_expander_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* _PIDGINCELLRENDEREREXPANDER_H_ */ diff --git a/pidgin/gtkcertmgr.h b/pidgin/gtkcertmgr.h index 8971be41e1..f64968ce2e 100644 --- a/pidgin/gtkcertmgr.h +++ b/pidgin/gtkcertmgr.h @@ -43,6 +43,8 @@ struct _PidginCertificateManager { gchar *label; }; +G_BEGIN_DECLS + /**************************************************************************/ /** @name Certificate Manager API */ /**************************************************************************/ @@ -59,4 +61,6 @@ void pidgin_certmgr_hide(void); /*@}*/ +G_END_DECLS + #endif /* _PIDGINCERTMGR_H_ */ diff --git a/pidgin/gtkconn.h b/pidgin/gtkconn.h index 9fda617259..27408b2039 100644 --- a/pidgin/gtkconn.h +++ b/pidgin/gtkconn.h @@ -25,6 +25,8 @@ #ifndef _PIDGINCONN_H_ #define _PIDGINCONN_H_ +G_BEGIN_DECLS + /**************************************************************************/ /** @name GTK+ Connection API */ /**************************************************************************/ @@ -56,4 +58,6 @@ void pidgin_connection_init(void); */ void pidgin_connection_uninit(void); +G_END_DECLS + #endif /* _PIDGINCONN_H_ */ diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index 154da253be..fa29b2b466 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -153,6 +153,8 @@ struct _PidginConversation /*@}*/ +G_BEGIN_DECLS + /************************************************************************** * @name GTK+ Conversation API **************************************************************************/ @@ -265,4 +267,6 @@ void pidgin_conversations_uninit(void); /*@}*/ +G_END_DECLS + #endif /* _PIDGIN_CONVERSATION_H_ */ diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index 54b1306848..97f1afea07 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -106,6 +106,8 @@ struct _PidginWindow /*@}*/ +G_BEGIN_DECLS + /************************************************************************** * @name GTK+ Conversation Window API **************************************************************************/ @@ -152,4 +154,6 @@ void pidgin_conv_placement_place(PidginConversation *gtkconv); /*@}*/ +G_END_DECLS + #endif /* _PIDGIN_CONVERSATION_WINDOW_H_ */ diff --git a/pidgin/gtkdebug.h b/pidgin/gtkdebug.h index 75f0a8535e..853bec56d6 100644 --- a/pidgin/gtkdebug.h +++ b/pidgin/gtkdebug.h @@ -28,6 +28,8 @@ #include "debug.h" +G_BEGIN_DECLS + /** * Initializes the GTK+ debug system. */ @@ -62,4 +64,6 @@ void pidgin_debug_window_hide(void); */ PurpleDebugUiOps *pidgin_debug_get_ui_ops(void); +G_END_DECLS + #endif /* _PIDGINDEBUG_H_ */ diff --git a/pidgin/gtkdialogs.h b/pidgin/gtkdialogs.h index adda62074a..19419d607b 100644 --- a/pidgin/gtkdialogs.h +++ b/pidgin/gtkdialogs.h @@ -30,6 +30,8 @@ #include "account.h" #include "conversation.h" +G_BEGIN_DECLS + /* Functions in gtkdialogs.c (these should actually stay in this file) */ void pidgin_dialogs_destroy_all(void); void pidgin_dialogs_about(void); @@ -53,4 +55,6 @@ void pidgin_dialogs_merge_groups(PurpleGroup *, const char *); /* This macro should probably be moved elsewhere */ #define PIDGIN_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED) +G_END_DECLS + #endif /* _PIDGINDIALOGS_H_ */ diff --git a/pidgin/gtkdnd-hints.h b/pidgin/gtkdnd-hints.h index a53b9b5835..ed2f4c37ef 100644 --- a/pidgin/gtkdnd-hints.h +++ b/pidgin/gtkdnd-hints.h @@ -52,6 +52,8 @@ typedef enum { } DndHintPosition; +G_BEGIN_DECLS + /** * Shows a drag-and-drop hint at the specified location. * @@ -84,4 +86,6 @@ void dnd_hints_hide_all(void); void dnd_hints_show_relative(DndHintWindowId id, GtkWidget *widget, DndHintPosition horiz, DndHintPosition vert); +G_END_DECLS + #endif /* _PIDGIN_DND_HINTS_H_ */ diff --git a/pidgin/gtkdocklet.h b/pidgin/gtkdocklet.h index af8538b7bd..94e6a66b4d 100644 --- a/pidgin/gtkdocklet.h +++ b/pidgin/gtkdocklet.h @@ -25,9 +25,13 @@ #ifndef _GTKDOCKLET_H_ #define _GTKDOCKLET_H_ +G_BEGIN_DECLS + void pidgin_docklet_init(void); void pidgin_docklet_uninit(void); void*pidgin_docklet_get_handle(void); +G_END_DECLS + #endif /* _GTKDOCKLET_H_ */ diff --git a/pidgin/gtkeventloop.h b/pidgin/gtkeventloop.h index 0593a0f9e2..937f211bd2 100644 --- a/pidgin/gtkeventloop.h +++ b/pidgin/gtkeventloop.h @@ -28,6 +28,8 @@ #include "eventloop.h" +G_BEGIN_DECLS + /** * Returns the GTK+ event loop UI operations structure. * @@ -35,4 +37,6 @@ */ PurpleEventLoopUiOps *pidgin_eventloop_get_ui_ops(void); +G_END_DECLS + #endif /* _PIDGINEVENTLOOP_H_ */ diff --git a/pidgin/gtkft.h b/pidgin/gtkft.h index 12f8b380ff..3863188d02 100644 --- a/pidgin/gtkft.h +++ b/pidgin/gtkft.h @@ -36,6 +36,8 @@ */ typedef struct _PidginXferDialog PidginXferDialog; +G_BEGIN_DECLS + /**************************************************************************/ /** @name GTK+ File Transfer Dialog API */ /**************************************************************************/ @@ -145,4 +147,6 @@ PurpleXferUiOps *pidgin_xfers_get_ui_ops(void); /*@}*/ +G_END_DECLS + #endif /* _PIDGINFT_H_ */ diff --git a/pidgin/gtkidle.h b/pidgin/gtkidle.h index d869584d28..aee04ccf23 100644 --- a/pidgin/gtkidle.h +++ b/pidgin/gtkidle.h @@ -28,6 +28,8 @@ #include "idle.h" +G_BEGIN_DECLS + /**************************************************************************/ /** @name GTK+ Idle API */ /**************************************************************************/ @@ -42,4 +44,6 @@ PurpleIdleUiOps *pidgin_idle_get_ui_ops(void); /*@}*/ +G_END_DECLS + #endif /* _PIDGIN_IDLE_H_ */ diff --git a/pidgin/gtkimhtml.h b/pidgin/gtkimhtml.h index 4b2f2bd46b..3ba49731c2 100644 --- a/pidgin/gtkimhtml.h +++ b/pidgin/gtkimhtml.h @@ -31,9 +31,7 @@ #include "connection.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /************************************************************************** * @name Structures @@ -828,8 +826,6 @@ void gtk_imhtml_set_populate_primary_clipboard(GtkIMHtml *imhtml, gboolean popul /*@}*/ -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PIDGINIMHTML_H_ */ diff --git a/pidgin/gtkimhtmltoolbar.h b/pidgin/gtkimhtmltoolbar.h index 1b0af60ec2..a7394170a9 100644 --- a/pidgin/gtkimhtmltoolbar.h +++ b/pidgin/gtkimhtmltoolbar.h @@ -26,9 +26,7 @@ #include #include "gtkimhtml.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS #define DEFAULT_FONT_FACE "Helvetica 12" @@ -94,8 +92,6 @@ void gtk_imhtmltoolbar_associate_smileys (GtkIMHtmlToolbar *toolbar, const char void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar, PurpleConversation *conv); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PIDGINIMHTMLTOOLBAR_H_ */ diff --git a/pidgin/gtklog.h b/pidgin/gtklog.h index 3fd56484b0..0797a76bf9 100644 --- a/pidgin/gtklog.h +++ b/pidgin/gtklog.h @@ -52,6 +52,7 @@ struct _PidginLogViewer { }; +G_BEGIN_DECLS void pidgin_log_show(PurpleLogType type, const char *buddyname, PurpleAccount *account); void pidgin_log_show_contact(PurpleContact *contact); @@ -82,4 +83,6 @@ void pidgin_log_uninit(void); /*@}*/ +G_END_DECLS + #endif diff --git a/pidgin/gtknotify.h b/pidgin/gtknotify.h index b5973a4995..d1e6561645 100644 --- a/pidgin/gtknotify.h +++ b/pidgin/gtknotify.h @@ -29,6 +29,8 @@ #include "notify.h" #include "pounce.h" +G_BEGIN_DECLS + /** * Adds a buddy pounce to the buddy pounce dialog * @@ -59,4 +61,6 @@ void pidgin_notify_init(void); */ void pidgin_notify_uninit(void); +G_END_DECLS + #endif /* _PIDGINNOTIFY_H_ */ diff --git a/pidgin/gtkplugin.h b/pidgin/gtkplugin.h index 8b07be4f12..817c03592e 100644 --- a/pidgin/gtkplugin.h +++ b/pidgin/gtkplugin.h @@ -56,6 +56,8 @@ struct _PidginPluginUiInfo #define PIDGIN_PLUGIN_UI_INFO(plugin) \ ((PidginPluginUiInfo *)(plugin)->info->ui_info) +G_BEGIN_DECLS + /** * Returns the configuration frame widget for a GTK+ plugin, if one * exists. @@ -77,4 +79,6 @@ void pidgin_plugins_save(void); */ void pidgin_plugin_dialog_show(void); +G_END_DECLS + #endif /* _PIDGINPLUGIN_H_ */ diff --git a/pidgin/gtkpluginpref.h b/pidgin/gtkpluginpref.h index d0f9add1c4..1a433d2178 100644 --- a/pidgin/gtkpluginpref.h +++ b/pidgin/gtkpluginpref.h @@ -31,9 +31,7 @@ #include "pidgin.h" -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /** * Creates a Gtk Preference frame for a PurplePluginPrefFrame @@ -43,8 +41,6 @@ extern "C" { */ GtkWidget *pidgin_plugin_pref_create_frame(PurplePluginPrefFrame *frame); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* _PIDGINPLUGINPREF_H_ */ diff --git a/pidgin/gtkpounce.h b/pidgin/gtkpounce.h index ce5bbc6505..224d319d16 100644 --- a/pidgin/gtkpounce.h +++ b/pidgin/gtkpounce.h @@ -28,6 +28,8 @@ #include "pounce.h" +G_BEGIN_DECLS + /** * Displays a New Buddy Pounce or Edit Buddy Pounce dialog. * @@ -60,4 +62,6 @@ void *pidgin_pounces_get_handle(void); */ void pidgin_pounces_init(void); +G_END_DECLS + #endif /* _PIDGINPOUNCE_H_ */ diff --git a/pidgin/gtkprefs.h b/pidgin/gtkprefs.h index fc7119c7a4..bc19210ab7 100644 --- a/pidgin/gtkprefs.h +++ b/pidgin/gtkprefs.h @@ -29,6 +29,8 @@ #include "prefs.h" +G_BEGIN_DECLS + /** * Initializes all UI-specific preferences. */ @@ -128,4 +130,6 @@ GtkWidget *pidgin_prefs_dropdown_from_list(GtkWidget *page, */ void pidgin_prefs_update_old(void); +G_END_DECLS + #endif /* _PIDGINPREFS_H_ */ diff --git a/pidgin/gtkprivacy.h b/pidgin/gtkprivacy.h index 0be6a05483..6ee81a4745 100644 --- a/pidgin/gtkprivacy.h +++ b/pidgin/gtkprivacy.h @@ -28,6 +28,8 @@ #include "privacy.h" +G_BEGIN_DECLS + /** * Initializes the GTK+ privacy subsystem. */ @@ -72,4 +74,6 @@ void pidgin_request_add_block(PurpleAccount *account, const char *name); */ PurplePrivacyUiOps *pidgin_privacy_get_ui_ops(void); +G_END_DECLS + #endif /* _PIDGINPRIVACY_H_ */ diff --git a/pidgin/gtkrequest.h b/pidgin/gtkrequest.h index 83e466f6aa..77aca7c830 100644 --- a/pidgin/gtkrequest.h +++ b/pidgin/gtkrequest.h @@ -28,6 +28,8 @@ #include "request.h" +G_BEGIN_DECLS + /** * Returns the UI operations structure for GTK+ request functions. * @@ -35,4 +37,6 @@ */ PurpleRequestUiOps *pidgin_request_get_ui_ops(void); +G_END_DECLS + #endif /* _PIDGINREQUEST_H_ */ diff --git a/pidgin/gtkroomlist.h b/pidgin/gtkroomlist.h index ed905e5c6b..1851132d18 100644 --- a/pidgin/gtkroomlist.h +++ b/pidgin/gtkroomlist.h @@ -28,6 +28,8 @@ #include "roomlist.h" +G_BEGIN_DECLS + /** * Initializes the room list subsystem. */ @@ -53,4 +55,6 @@ void pidgin_roomlist_dialog_show(void); */ void pidgin_roomlist_dialog_show_with_account(PurpleAccount *account); +G_END_DECLS + #endif /* _PIDGINROOMLIST_H_ */ diff --git a/pidgin/gtksavedstatuses.h b/pidgin/gtksavedstatuses.h index 144fd052c7..e582de8eb2 100644 --- a/pidgin/gtksavedstatuses.h +++ b/pidgin/gtksavedstatuses.h @@ -29,6 +29,8 @@ #include "savedstatuses.h" #include "status.h" +G_BEGIN_DECLS + /** * Shows the status window. */ @@ -85,4 +87,6 @@ void pidgin_status_init(void); */ void pidgin_status_uninit(void); +G_END_DECLS + #endif /* _PIDGINSAVEDSTATUSES_H_ */ diff --git a/pidgin/gtksession.h b/pidgin/gtksession.h index fb7711329e..ad0909453b 100644 --- a/pidgin/gtksession.h +++ b/pidgin/gtksession.h @@ -26,6 +26,8 @@ #ifndef _PIDGINSESSION_H_ #define _PIDGINSESSION_H_ +G_BEGIN_DECLS + /**************************************************************************/ /** @name X Windows session subsystem */ /**************************************************************************/ @@ -51,4 +53,6 @@ void pidgin_session_end(void); /*@}*/ +G_END_DECLS + #endif /* _PIDGINSESSION_H_ */ diff --git a/pidgin/gtksmiley.h b/pidgin/gtksmiley.h index fb65227db1..2d7b5e381d 100644 --- a/pidgin/gtksmiley.h +++ b/pidgin/gtksmiley.h @@ -31,6 +31,8 @@ typedef struct _PidginSmiley PidginSmiley; +G_BEGIN_DECLS + /** * Add a PurpleSmiley to the GtkIMHtmlSmiley's list to be able to use it * in pidgin @@ -108,4 +110,6 @@ void pidgin_smiley_editor_set_image(PidginSmiley *editor, GdkPixbuf *image); */ void pidgin_smiley_editor_set_data(PidginSmiley *editor, gpointer data, gsize datasize); +G_END_DECLS + #endif /* PIDGIN_GTKSMILEY_H */ diff --git a/pidgin/gtksound.h b/pidgin/gtksound.h index 872b865f51..147cd9409d 100644 --- a/pidgin/gtksound.h +++ b/pidgin/gtksound.h @@ -28,6 +28,8 @@ #include "sound.h" +G_BEGIN_DECLS + /**************************************************************************/ /** @name GTK+ Sound API */ /**************************************************************************/ @@ -72,4 +74,6 @@ gboolean pidgin_sound_is_customized(void); /*@}*/ +G_END_DECLS + #endif /* _PIDGINSOUND_H_ */ diff --git a/pidgin/gtksourceundomanager.h b/pidgin/gtksourceundomanager.h index 0148455476..931486512d 100644 --- a/pidgin/gtksourceundomanager.h +++ b/pidgin/gtksourceundomanager.h @@ -57,6 +57,8 @@ struct _GtkSourceUndoManagerClass void (*can_redo) (GtkSourceUndoManager *um, gboolean can_redo); }; +G_BEGIN_DECLS + GType gtk_source_undo_manager_get_type (void) G_GNUC_CONST; GtkSourceUndoManager* gtk_source_undo_manager_new (GtkTextBuffer *buffer); @@ -78,6 +80,8 @@ void gtk_source_undo_manager_set_max_undo_levels (GtkSourceUndoManager *um, gint undo_levels); +G_END_DECLS + #endif /* __GTK_SOURCE_UNDO_MANAGER_H__ */ diff --git a/pidgin/gtkthemes.h b/pidgin/gtkthemes.h index 7d739f8e1b..8343a99d63 100644 --- a/pidgin/gtkthemes.h +++ b/pidgin/gtkthemes.h @@ -46,6 +46,8 @@ struct smiley_theme { extern struct smiley_theme *current_smiley_theme; extern GSList *smiley_themes; +G_BEGIN_DECLS + void pidgin_themes_init(void); gboolean pidgin_themes_smileys_disabled(void); @@ -62,4 +64,6 @@ void pidgin_themes_remove_smiley_theme(const char *file); GSList *pidgin_themes_get_proto_smileys(const char *id); +G_END_DECLS + #endif /* _PIDGINTHEMES_H_ */ diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h index 84456a7ad7..2999d5fa37 100644 --- a/pidgin/gtkutils.h +++ b/pidgin/gtkutils.h @@ -31,10 +31,6 @@ #include "prpl.h" #include "util.h" - - - - typedef enum { PIDGIN_BUTTON_HORIZONTAL, @@ -80,6 +76,8 @@ typedef struct { typedef gboolean (*PidginFilterBuddyCompletionEntryFunc) (const PidginBuddyCompletionEntry *completion_entry, gpointer user_data); +G_BEGIN_DECLS + /** * Sets up a gtkimhtml widget, loads it with smileys, and sets the * default signal handlers. @@ -903,5 +901,7 @@ void pidgin_utils_init(void); */ void pidgin_utils_uninit(void); +G_END_DECLS + #endif /* _PIDGINUTILS_H_ */ diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index f944e260aa..6ba2d3738c 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -60,6 +60,7 @@ struct _GtkWebViewClass typedef struct _GtkWebViewClass GtkWebViewClass; +G_BEGIN_DECLS /** * Returns the GType for a GtkWebView widget @@ -157,5 +158,7 @@ void gtk_webview_page_up(GtkWebView *webview); */ void gtk_webview_page_down(GtkWebView *webview); +G_END_DECLS + #endif /* _PIDGIN_WEBVIEW_H_ */ diff --git a/pidgin/gtkwhiteboard.h b/pidgin/gtkwhiteboard.h index d5bad34a36..e6469adef0 100644 --- a/pidgin/gtkwhiteboard.h +++ b/pidgin/gtkwhiteboard.h @@ -59,9 +59,7 @@ typedef struct _PidginWhiteboard int brush_size; /**< Brush size */ } PidginWhiteboard; -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS /*****************************************************************************/ /** @name PidginWhiteboard API */ @@ -77,8 +75,6 @@ PurpleWhiteboardUiOps *pidgin_whiteboard_get_ui_ops( void ); /*@}*/ -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* _PIDGINWHITEBOARD_H_ */ diff --git a/pidgin/pidgintooltip.h b/pidgin/pidgintooltip.h index 0d6519bcf9..22b97173f5 100644 --- a/pidgin/pidgintooltip.h +++ b/pidgin/pidgintooltip.h @@ -59,6 +59,8 @@ typedef gboolean (*PidginTooltipCreate)(GtkWidget *tipwindow, */ typedef gboolean (*PidginTooltipPaint)(GtkWidget *tipwindow, gpointer userdata); +G_BEGIN_DECLS + /** * Setup tooltip drawing functions for a treeview. * @@ -101,4 +103,6 @@ void pidgin_tooltip_destroy(void); void pidgin_tooltip_show(GtkWidget *widget, gpointer userdata, PidginTooltipCreate create_cb, PidginTooltipPaint paint_cb); +G_END_DECLS + #endif diff --git a/pidgin/smileyparser.h b/pidgin/smileyparser.h index a8dc349eb3..a1c1e550b7 100644 --- a/pidgin/smileyparser.h +++ b/pidgin/smileyparser.h @@ -20,6 +20,10 @@ * */ +G_BEGIN_DECLS + char * smiley_parse_markup(const char *markup, const char *sml); +G_END_DECLS + -- cgit v1.2.1 From 0077d7c16ce254c1cbf432a81d9f6d1d56eb483d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 00:14:51 +0000 Subject: Use internal.h for less (conditional) #includes. --- pidgin/gtkwebview.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 2d0420b239..b6ce98ac0e 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -25,19 +25,10 @@ * */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include +#include "internal.h" +#include "pidgin.h" -#include "util.h" #include "gtkwebview.h" -#include "imgstore.h" static WebKitWebViewClass *parent_class = NULL; -- cgit v1.2.1 From cbb011ebc8a3dc3bdc95e96e5e1678e1291acea4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 00:44:36 +0000 Subject: Update Template.html from Adium's hg repo. --- pidgin/themes/Template.html | 367 ++++++++++++++++++++++++++++++++------------ 1 file changed, 273 insertions(+), 94 deletions(-) diff --git a/pidgin/themes/Template.html b/pidgin/themes/Template.html index 0a7f9d6662..e3c80eb39b 100644 --- a/pidgin/themes/Template.html +++ b/pidgin/themes/Template.html @@ -3,66 +3,215 @@ - - + - + - - + - - + %@
-- cgit v1.2.1 From 3d780c62d2267425a7d2d2eebb05b1dc185311ca Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 01:18:01 +0000 Subject: Avoid creating temporary files for images in a webview. If we have a PurpleStoredImg, then get the filename from there. If that doesn't exist, use a data: URI instead. --- pidgin/gtkwebview.c | 70 ++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index b6ce98ac0e..3fff1f9312 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -51,44 +51,39 @@ gtk_webview_new(void) return GTK_WIDGET(ret); } -static char * -get_image_filename_from_id(GtkWebView* view, int id) +static const char * +get_image_src_from_id(GtkWebView* view, int id) { - char *filename = NULL; - FILE *file; - PurpleStoredImage* img; - - if (!view->priv->images) - view->priv->images = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); - - filename = (char *)g_hash_table_lookup(view->priv->images, GINT_TO_POINTER(id)); - if (filename) - return filename; - - /* else get from img store */ - file = purple_mkstemp(&filename, TRUE); + char *src; + PurpleStoredImage *img; + + if (view->priv->images) { + /* Check for already loaded image */ + src = (char *)g_hash_table_lookup(view->priv->images, GINT_TO_POINTER(id)); + if (src) + return src; + } else { + view->priv->images = g_hash_table_new_full(g_direct_hash, g_direct_equal, + NULL, g_free); + } + /* Find image in store */ img = purple_imgstore_find_by_id(id); - fwrite(purple_imgstore_get_data(img), purple_imgstore_get_size(img), 1, file); - g_hash_table_insert(view->priv->images, GINT_TO_POINTER(id), filename); - fclose(file); - return filename; -} + src = (char *)purple_imgstore_get_filename(img); + if (src) { + src = g_strdup_printf("file://%s", src); + } else { + char *tmp; + tmp = purple_base64_encode(purple_imgstore_get_data(img), + purple_imgstore_get_size(img)); + src = g_strdup_printf("data:base64,%s", tmp); + g_free(tmp); + } -static void -clear_single_image(gpointer key, gpointer value, gpointer userdata) -{ - g_unlink((char *)value); -} + g_hash_table_insert(view->priv->images, GINT_TO_POINTER(id), src); -static void -clear_images(GtkWebView *view) -{ - if (!view->priv->images) - return; - g_hash_table_foreach(view->priv->images, clear_single_image, NULL); - g_hash_table_unref(view->priv->images); + return src; } /* @@ -143,7 +138,7 @@ replace_img_id_with_src(GtkWebView *view, const char *html) /* let's dump this, tag and then dump the src information */ g_string_append_len(buffer, img, cur - img); - g_string_append_printf(buffer, " src='file://%s' ", get_image_filename_from_id(view, nid)); + g_string_append_printf(buffer, " src='%s' ", get_image_src_from_id(view, nid)); } return g_string_free(buffer, FALSE); @@ -158,7 +153,8 @@ gtk_webview_finalize(GObject *view) g_free(temp); g_queue_free(GTK_WEBVIEW(view)->priv->js_queue); - clear_images(GTK_WEBVIEW(view)); + if (GTK_WEBVIEW(view)->priv->images) + g_hash_table_unref(GTK_WEBVIEW(view)->priv->images); g_free(GTK_WEBVIEW(view)->priv); G_OBJECT_CLASS(parent_class)->finalize(G_OBJECT(view)); } @@ -260,7 +256,11 @@ gtk_webview_load_html_string_with_imgstore(GtkWebView *view, const char *html) { char *html_imged; - clear_images(view); + if (view->priv->images) { + g_hash_table_unref(view->priv->images); + view->priv->images = NULL; + } + html_imged = replace_img_id_with_src(view, html); webkit_web_view_load_string(WEBKIT_WEB_VIEW(view), html_imged, NULL, NULL, "file:///"); g_free(html_imged); -- cgit v1.2.1 From ec4d9a2986e069f5dfed2015522a9b57e93b3545 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 01:21:28 +0000 Subject: This strlen seems redundant. --- pidgin/gtkwebview.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 3fff1f9312..eb8d0bfbc0 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -94,8 +94,8 @@ get_image_src_from_id(GtkWebView* view, int id) static char * replace_img_id_with_src(GtkWebView *view, const char *html) { - GString *buffer = g_string_sized_new(strlen(html)); - const char* cur = html; + GString *buffer = g_string_new(NULL); + const char *cur = html; char *id; int nid; -- cgit v1.2.1 From 65647a9e3715516b2648940364b236237a194302 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 01:30:38 +0000 Subject: I don't know why these lines are indented. --- pidgin/gtkblist-theme.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pidgin/gtkblist-theme.h b/pidgin/gtkblist-theme.h index adcf65c1d6..2a29137de8 100644 --- a/pidgin/gtkblist-theme.h +++ b/pidgin/gtkblist-theme.h @@ -183,7 +183,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns The buddy list layout. */ - PidginBlistLayout *pidgin_blist_theme_get_layout(PidginBlistTheme *theme); +PidginBlistLayout *pidgin_blist_theme_get_layout(PidginBlistTheme *theme); /** * Returns the background color to be used with expanded groups. @@ -192,7 +192,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A gdk color. */ - GdkColor *pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme); +GdkColor *pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme); /** * Returns the text font and color to be used with expanded groups. @@ -201,7 +201,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme); /** * Returns the background color to be used with collapsed groups. @@ -210,7 +210,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A gdk color. */ - GdkColor *pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme); +GdkColor *pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme); /** * Returns the text font and color to be used with collapsed groups. @@ -219,7 +219,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme); /** * Returns the colors to be used for contacts and chats. @@ -228,7 +228,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A gdkcolor for contacts and chats. */ - GdkColor *pidgin_blist_theme_get_contact_color(PidginBlistTheme *theme); +GdkColor *pidgin_blist_theme_get_contact_color(PidginBlistTheme *theme); /** * Returns the text font and color to be used for expanded contacts. @@ -237,7 +237,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for online buddies. @@ -246,7 +246,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for away and idle buddies. @@ -255,7 +255,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for offline buddies. @@ -264,7 +264,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for idle buddies. @@ -273,7 +273,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for buddies with unread messages. @@ -282,7 +282,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for chats with unread messages @@ -292,7 +292,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme *theme); /** * Returns the text font and color to be used for a buddy's status message. @@ -301,7 +301,7 @@ gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme); * * @returns A font and color pair. */ - PidginThemeFont *pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme); +PidginThemeFont *pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme); /* Set Methods */ -- cgit v1.2.1 From 9428e22699f99938a184b0ca309dbd085c3683da Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 02:30:11 +0000 Subject: Rearrange these files a bit to group common functions together. Use a variable to store the pointer to the private GObject data which avoids extra casting. Also, use the GObject way of allocating a private data structure. --- pidgin/gtkwebview.c | 376 +++++++++++++++++++++++++++++----------------------- pidgin/gtkwebview.h | 46 +++---- 2 files changed, 232 insertions(+), 190 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index eb8d0bfbc0..e24c19d427 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -30,41 +30,54 @@ #include "gtkwebview.h" -static WebKitWebViewClass *parent_class = NULL; +#define MAX_SCROLL_TIME 0.4 /* seconds */ +#define SCROLL_DELAY 33 /* milliseconds */ -struct GtkWebViewPriv { +#define GTK_WEBVIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_WEBVIEW, GtkWebViewPriv)) + +/****************************************************************************** + * Structs + *****************************************************************************/ + +typedef struct _GtkWebViewPriv { GHashTable *images; /**< a map from id to temporary file for the image */ - gboolean empty; /**< whether anything has been appended **/ + gboolean empty; /**< whether anything has been appended **/ /* JS execute queue */ GQueue *js_queue; gboolean is_loading; + + /* Scroll adjustments */ GtkAdjustment *vadj; guint scroll_src; GTimer *scroll_time; -}; +} GtkWebViewPriv; -GtkWidget * -gtk_webview_new(void) -{ - GtkWebView* ret = GTK_WEBVIEW(g_object_new(gtk_webview_get_type(), NULL)); - return GTK_WIDGET(ret); -} +/****************************************************************************** + * Globals + *****************************************************************************/ + +static WebKitWebViewClass *parent_class = NULL; + +/****************************************************************************** + * Helpers + *****************************************************************************/ static const char * -get_image_src_from_id(GtkWebView* view, int id) +get_image_src_from_id(GtkWebViewPriv *priv, int id) { char *src; PurpleStoredImage *img; - if (view->priv->images) { + if (priv->images) { /* Check for already loaded image */ - src = (char *)g_hash_table_lookup(view->priv->images, GINT_TO_POINTER(id)); + src = (char *)g_hash_table_lookup(priv->images, GINT_TO_POINTER(id)); if (src) return src; } else { - view->priv->images = g_hash_table_new_full(g_direct_hash, g_direct_equal, - NULL, g_free); + priv->images = g_hash_table_new_full(g_direct_hash, g_direct_equal, + NULL, g_free); } /* Find image in store */ @@ -81,7 +94,7 @@ get_image_src_from_id(GtkWebView* view, int id) g_free(tmp); } - g_hash_table_insert(view->priv->images, GINT_TO_POINTER(id), src); + g_hash_table_insert(priv->images, GINT_TO_POINTER(id), src); return src; } @@ -92,7 +105,7 @@ get_image_src_from_id(GtkWebView* view, int id) * purple changes the way it works. */ static char * -replace_img_id_with_src(GtkWebView *view, const char *html) +replace_img_id_with_src(GtkWebViewPriv *priv, const char *html) { GString *buffer = g_string_new(NULL); const char *cur = html; @@ -138,40 +151,57 @@ replace_img_id_with_src(GtkWebView *view, const char *html) /* let's dump this, tag and then dump the src information */ g_string_append_len(buffer, img, cur - img); - g_string_append_printf(buffer, " src='%s' ", get_image_src_from_id(view, nid)); + g_string_append_printf(buffer, " src='%s' ", get_image_src_from_id(priv, nid)); } return g_string_free(buffer, FALSE); } -static void -gtk_webview_finalize(GObject *view) +static gboolean +process_js_script_queue(GtkWebView *webview) { - gpointer temp; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + char *script; - while ((temp = g_queue_pop_head(GTK_WEBVIEW(view)->priv->js_queue))) - g_free(temp); - g_queue_free(GTK_WEBVIEW(view)->priv->js_queue); + if (priv->is_loading) + return FALSE; /* we will be called when loaded */ + if (!priv->js_queue || g_queue_is_empty(priv->js_queue)) + return FALSE; /* nothing to do! */ + + script = g_queue_pop_head(priv->js_queue); + webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script); + g_free(script); - if (GTK_WEBVIEW(view)->priv->images) - g_hash_table_unref(GTK_WEBVIEW(view)->priv->images); - g_free(GTK_WEBVIEW(view)->priv); - G_OBJECT_CLASS(parent_class)->finalize(G_OBJECT(view)); + return TRUE; /* there may be more for now */ } static void -gtk_webview_class_init(GtkWebViewClass *klass, gpointer userdata) +webview_load_started(WebKitWebView *webview, WebKitWebFrame *frame, + gpointer userdata) { - parent_class = g_type_class_ref(webkit_web_view_get_type()); - G_OBJECT_CLASS(klass)->finalize = gtk_webview_finalize; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + /* is there a better way to test for is_loading? */ + priv->is_loading = TRUE; +} + +static void +webview_load_finished(WebKitWebView *webview, WebKitWebFrame *frame, + gpointer userdata) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + priv->is_loading = FALSE; + g_idle_add((GSourceFunc)process_js_script_queue, webview); } static gboolean -webview_link_clicked(WebKitWebView *view, - WebKitWebFrame *frame, - WebKitNetworkRequest *request, - WebKitWebNavigationAction *navigation_action, - WebKitWebPolicyDecision *policy_decision) +webview_link_clicked(WebKitWebView *webview, + WebKitWebFrame *frame, + WebKitNetworkRequest *request, + WebKitWebNavigationAction *navigation_action, + WebKitWebPolicyDecision *policy_decision, + gpointer userdata) { const gchar *uri; WebKitWebNavigationReason reason; @@ -189,81 +219,143 @@ webview_link_clicked(WebKitWebView *view, return TRUE; } +/* + * Smoothly scroll a WebView. + * + * @return TRUE if the window needs to be scrolled further, FALSE if we're at the bottom. + */ static gboolean -process_js_script_queue(GtkWebView *view) +smooth_scroll_cb(gpointer data) { - char *script; - if (view->priv->is_loading) - return FALSE; /* we will be called when loaded */ - if (!view->priv->js_queue || g_queue_is_empty(view->priv->js_queue)) - return FALSE; /* nothing to do! */ + GtkWebViewPriv *priv = data; + GtkAdjustment *adj; + gdouble max_val; + gdouble scroll_val; - script = g_queue_pop_head(view->priv->js_queue); - webkit_web_view_execute_script(WEBKIT_WEB_VIEW(view), script); - g_free(script); + g_return_val_if_fail(priv->scroll_time != NULL, FALSE); - return TRUE; /* there may be more for now */ + adj = priv->vadj; + max_val = adj->upper - adj->page_size; + scroll_val = gtk_adjustment_get_value(adj) + + ((max_val - gtk_adjustment_get_value(adj)) / 3); + + if (g_timer_elapsed(priv->scroll_time, NULL) > MAX_SCROLL_TIME + || scroll_val >= max_val) { + /* time's up. jump to the end and kill the timer */ + gtk_adjustment_set_value(adj, max_val); + g_timer_destroy(priv->scroll_time); + priv->scroll_time = NULL; + g_source_remove(priv->scroll_src); + priv->scroll_src = 0; + return FALSE; + } + + /* scroll by 1/3rd the remaining distance */ + gtk_adjustment_set_value(adj, scroll_val); + return TRUE; } -static void -webview_load_started(WebKitWebView *view, - WebKitWebFrame *frame, - gpointer userdata) +static gboolean +scroll_idle_cb(gpointer data) { - /* is there a better way to test for is_loading? */ - GTK_WEBVIEW(view)->priv->is_loading = TRUE; + GtkWebViewPriv *priv = data; + GtkAdjustment *adj = priv->vadj; + if (adj) { + gtk_adjustment_set_value(adj, adj->upper - adj->page_size); + } + priv->scroll_src = 0; + return FALSE; +} + +/****************************************************************************** + * GObject Stuff + *****************************************************************************/ + +GtkWidget * +gtk_webview_new(void) +{ + return GTK_WIDGET(g_object_new(gtk_webview_get_type(), NULL)); } static void -webview_load_finished(WebKitWebView *view, - WebKitWebFrame *frame, - gpointer userdata) +gtk_webview_finalize(GObject *webview) { - GTK_WEBVIEW(view)->priv->is_loading = FALSE; - g_idle_add((GSourceFunc)process_js_script_queue, view); + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + gpointer temp; + + while ((temp = g_queue_pop_head(priv->js_queue))) + g_free(temp); + g_queue_free(priv->js_queue); + + if (priv->images) + g_hash_table_unref(priv->images); + + G_OBJECT_CLASS(parent_class)->finalize(G_OBJECT(webview)); } -void -gtk_webview_safe_execute_script(GtkWebView *view, const char *script) +static void +gtk_webview_class_init(GtkWebViewClass *klass, gpointer userdata) { - g_queue_push_tail(view->priv->js_queue, g_strdup(script)); - g_idle_add((GSourceFunc)process_js_script_queue, view); + parent_class = g_type_class_ref(webkit_web_view_get_type()); + + g_type_class_add_private(klass, sizeof(GtkWebViewPriv)); + + G_OBJECT_CLASS(klass)->finalize = gtk_webview_finalize; } static void -gtk_webview_init(GtkWebView *view, gpointer userdata) +gtk_webview_init(GtkWebView *webview, gpointer userdata) { - view->priv = g_new0(struct GtkWebViewPriv, 1); - g_signal_connect(view, "navigation-policy-decision-requested", + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + priv->empty = TRUE; + priv->js_queue = g_queue_new(); + + g_signal_connect(webview, "navigation-policy-decision-requested", G_CALLBACK(webview_link_clicked), - view); + webview); - g_signal_connect(view, "load-started", + g_signal_connect(webview, "load-started", G_CALLBACK(webview_load_started), - view); + webview); - g_signal_connect(view, "load-finished", + g_signal_connect(webview, "load-finished", G_CALLBACK(webview_load_finished), - view); - - view->priv->empty = TRUE; - view->priv->js_queue = g_queue_new(); + webview); } - -void -gtk_webview_load_html_string_with_imgstore(GtkWebView *view, const char *html) +GType +gtk_webview_get_type(void) { - char *html_imged; - - if (view->priv->images) { - g_hash_table_unref(view->priv->images); - view->priv->images = NULL; + static GType mview_type = 0; + if (G_UNLIKELY(mview_type == 0)) { + static const GTypeInfo mview_info = { + sizeof(GtkWebViewClass), + NULL, + NULL, + (GClassInitFunc)gtk_webview_class_init, + NULL, + NULL, + sizeof(GtkWebView), + 0, + (GInstanceInitFunc)gtk_webview_init, + NULL + }; + mview_type = g_type_register_static(webkit_web_view_get_type(), + "GtkWebView", &mview_info, 0); } + return mview_type; +} - html_imged = replace_img_id_with_src(view, html); - webkit_web_view_load_string(WEBKIT_WEB_VIEW(view), html_imged, NULL, NULL, "file:///"); - g_free(html_imged); +/***************************************************************************** + * Public API functions + *****************************************************************************/ + +gboolean +gtk_webview_is_empty(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + return priv->empty; } char * @@ -290,14 +382,34 @@ gtk_webview_quote_js_string(const char *text) } cur++; } + g_string_append_c(str, '"'); + return g_string_free(str, FALSE); } +void +gtk_webview_safe_execute_script(GtkWebView *webview, const char *script) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + g_queue_push_tail(priv->js_queue, g_strdup(script)); + g_idle_add((GSourceFunc)process_js_script_queue, webview); +} void -gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) +gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html) { - webview->priv->vadj = vadj; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + char *html_imged; + + if (priv->images) { + g_hash_table_unref(priv->images); + priv->images = NULL; + } + + html_imged = replace_img_id_with_src(priv, html); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), html_imged, NULL, + NULL, "file:///"); + g_free(html_imged); } /* this is a "hack", my plan is to eventually handle this @@ -306,77 +418,34 @@ gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) * wrong to hardcode that here. */ void -gtk_webview_append_html(GtkWebView *view, const char *html) +gtk_webview_append_html(GtkWebView *webview, const char *html) { + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); char *escaped = gtk_webview_quote_js_string(html); char *script = g_strdup_printf("document.write(%s)", escaped); - webkit_web_view_execute_script(WEBKIT_WEB_VIEW(view), script); - view->priv->empty = FALSE; - gtk_webview_scroll_to_end(view, TRUE); + webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script); + priv->empty = FALSE; + gtk_webview_scroll_to_end(webview, TRUE); g_free(script); g_free(escaped); } -gboolean -gtk_webview_is_empty(GtkWebView *view) -{ - return view->priv->empty; -} - -#define MAX_SCROLL_TIME 0.4 /* seconds */ -#define SCROLL_DELAY 33 /* milliseconds */ - -/* - * Smoothly scroll a WebView. - * - * @return TRUE if the window needs to be scrolled further, FALSE if we're at the bottom. - */ -static gboolean -smooth_scroll_cb(gpointer data) -{ - struct GtkWebViewPriv *priv = data; - GtkAdjustment *adj = priv->vadj; - gdouble max_val = adj->upper - adj->page_size; - gdouble scroll_val = gtk_adjustment_get_value(adj) + ((max_val - gtk_adjustment_get_value(adj)) / 3); - - g_return_val_if_fail(priv->scroll_time != NULL, FALSE); - - if (g_timer_elapsed(priv->scroll_time, NULL) > MAX_SCROLL_TIME || scroll_val >= max_val) { - /* time's up. jump to the end and kill the timer */ - gtk_adjustment_set_value(adj, max_val); - g_timer_destroy(priv->scroll_time); - priv->scroll_time = NULL; - g_source_remove(priv->scroll_src); - priv->scroll_src = 0; - return FALSE; - } - - /* scroll by 1/3rd the remaining distance */ - gtk_adjustment_set_value(adj, scroll_val); - return TRUE; -} - -static gboolean -scroll_idle_cb(gpointer data) +void +gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) { - struct GtkWebViewPriv *priv = data; - GtkAdjustment *adj = priv->vadj; - if (adj) { - gtk_adjustment_set_value(adj, adj->upper - adj->page_size); - } - priv->scroll_src = 0; - return FALSE; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->vadj = vadj; } void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) { - struct GtkWebViewPriv *priv = webview->priv; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); if (priv->scroll_time) g_timer_destroy(priv->scroll_time); if (priv->scroll_src) g_source_remove(priv->scroll_src); - if(smooth) { + if (smooth) { priv->scroll_time = g_timer_new(); priv->scroll_src = g_timeout_add_full(G_PRIORITY_LOW, SCROLL_DELAY, smooth_scroll_cb, priv, NULL); } else { @@ -387,7 +456,8 @@ gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) void gtk_webview_page_up(GtkWebView *webview) { - GtkAdjustment *vadj = webview->priv->vadj; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkAdjustment *vadj = priv->vadj; gdouble scroll_val; #if GTK_CHECK_VERSION(2,14,0) @@ -403,7 +473,8 @@ void gtk_webview_page_up(GtkWebView *webview) void gtk_webview_page_down(GtkWebView *webview) { - GtkAdjustment *vadj = webview->priv->vadj; + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkAdjustment *vadj = priv->vadj; gdouble scroll_val; gdouble page_size; @@ -420,26 +491,3 @@ void gtk_webview_page_down(GtkWebView *webview) gtk_adjustment_set_value(vadj, scroll_val); } -GType -gtk_webview_get_type(void) -{ - static GType mview_type = 0; - if (G_UNLIKELY(mview_type == 0)) { - static const GTypeInfo mview_info = { - sizeof(GtkWebViewClass), - NULL, - NULL, - (GClassInitFunc) gtk_webview_class_init, - NULL, - NULL, - sizeof(GtkWebView), - 0, - (GInstanceInitFunc) gtk_webview_init, - NULL - }; - mview_type = g_type_register_static(webkit_web_view_get_type(), - "GtkWebView", &mview_info, 0); - } - return mview_type; -} - diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 6ba2d3738c..14a4a893c5 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -38,28 +38,22 @@ #define GTK_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_WEBVIEW, GtkWebView)) #define GTK_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_WEBVIEW, GtkWebViewClass)) #define GTK_IS_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_WEBVIEW)) -#define GTK_IS_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEW)) +#define GTK_IS_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEW)) +#define GTK_WEBVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_WEBVIEW, GtkWebViewClass)) - -struct GtkWebViewPriv; +typedef struct _GtkWebView GtkWebView; +typedef struct _GtkWebViewClass GtkWebViewClass; struct _GtkWebView { - WebKitWebView webkit_web_view; - - /*< private >*/ - struct GtkWebViewPriv *priv; + WebKitWebView parent; }; -typedef struct _GtkWebView GtkWebView; - struct _GtkWebViewClass { WebKitWebViewClass parent; }; -typedef struct _GtkWebViewClass GtkWebViewClass; - G_BEGIN_DECLS /** @@ -77,12 +71,15 @@ GType gtk_webview_get_type(void); GtkWidget *gtk_webview_new(void); /** - * Set the vertical adjustment for the GtkWebView. + * TODO WEBKIT: Right now this just tests whether an append has been called + * since the last clear or since the Widget was created. So it does not + * test for load_string's called in between. * - * @param webview The GtkWebView object - * @param vadj The GtkAdjustment that control the webview + * @param webview The GtkWebView object + * + * @return gboolean indicating whether the webview is empty */ -void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj); +gboolean gtk_webview_is_empty(GtkWebView *webview); /** * A very basic routine to append html, which can be considered @@ -103,17 +100,6 @@ void gtk_webview_append_html(GtkWebView *webview, const char *markup); */ void gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html); -/** - * TODO WEBKIT: Right now this just tests whether an append has been called - * since the last clear or since the Widget was created. So it does not - * test for load_string's called in between. - * - * @param webview The GtkWebView object - * - * @return gboolean indicating whether the webview is empty - */ -gboolean gtk_webview_is_empty(GtkWebView *webview); - /** * Execute the JavaScript only after the webkit_webview_load_string * loads completely. We also guarantee that the scripts are executed @@ -136,6 +122,14 @@ void gtk_webview_safe_execute_script(GtkWebView *webview, const char *script); */ char *gtk_webview_quote_js_string(const char *str); +/** + * Set the vertical adjustment for the GtkWebView. + * + * @param webview The GtkWebView object + * @param vadj The GtkAdjustment that control the webview + */ +void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj); + /** * Scrolls the Webview to the end of its contents. * -- cgit v1.2.1 From 65de308c5bce4e04931b53ceea967e578ace4273 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 02:34:24 +0000 Subject: Use accessor functions where available. --- pidgin/gtkwebview.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index e24c19d427..7664fd84e6 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -235,7 +235,11 @@ smooth_scroll_cb(gpointer data) g_return_val_if_fail(priv->scroll_time != NULL, FALSE); adj = priv->vadj; +#if GTK_CHECK_VERSION(2,14,0) + max_val = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj); +#else max_val = adj->upper - adj->page_size; +#endif scroll_val = gtk_adjustment_get_value(adj) + ((max_val - gtk_adjustment_get_value(adj)) / 3); @@ -260,9 +264,17 @@ scroll_idle_cb(gpointer data) { GtkWebViewPriv *priv = data; GtkAdjustment *adj = priv->vadj; + gdouble max_val; + if (adj) { - gtk_adjustment_set_value(adj, adj->upper - adj->page_size); +#if GTK_CHECK_VERSION(2,14,0) + max_val = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj); +#else + max_val = adj->upper - adj->page_size; +#endif + gtk_adjustment_set_value(adj, max_val); } + priv->scroll_src = 0; return FALSE; } -- cgit v1.2.1 From 6b02f78c6b5a13b9df1d49244d42b567497afd13 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 02:35:22 +0000 Subject: This #include doesn't seem necessary. --- pidgin/gtkwebview.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 14a4a893c5..398bb66b53 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -32,8 +32,6 @@ #include #include -#include "notify.h" - #define GTK_TYPE_WEBVIEW (gtk_webview_get_type()) #define GTK_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_WEBVIEW, GtkWebView)) #define GTK_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_WEBVIEW, GtkWebViewClass)) -- cgit v1.2.1 From 70c59351d88d3c201692a18ee7046fc57bdeaf52 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 02:48:04 +0000 Subject: Passing the webview as userdata when the webview is the object emitting the signal seems a bit redundant to me. --- pidgin/gtkwebview.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 7664fd84e6..13eee4eae2 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -324,16 +324,13 @@ gtk_webview_init(GtkWebView *webview, gpointer userdata) priv->js_queue = g_queue_new(); g_signal_connect(webview, "navigation-policy-decision-requested", - G_CALLBACK(webview_link_clicked), - webview); + G_CALLBACK(webview_link_clicked), NULL); g_signal_connect(webview, "load-started", - G_CALLBACK(webview_load_started), - webview); + G_CALLBACK(webview_load_started), NULL); g_signal_connect(webview, "load-finished", - G_CALLBACK(webview_load_finished), - webview); + G_CALLBACK(webview_load_finished), NULL); } GType -- cgit v1.2.1 From 84e8c56d7432ba9c16190135b72578fd39c2fb7d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 02:49:34 +0000 Subject: If we handle a navigation request, then we should tell WebKit to ignore it. --- pidgin/gtkwebview.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 13eee4eae2..7a12b43b20 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -213,6 +213,7 @@ webview_link_clicked(WebKitWebView *webview, /* the gtk imhtml way was to create an idle cb, not sure * why, so right now just using purple_notify_uri directly */ purple_notify_uri(NULL, uri); + webkit_web_policy_decision_ignore(policy_decision); } else webkit_web_policy_decision_use(policy_decision); -- cgit v1.2.1 From 509b5fd87b7c4bbc71b436b2cd7685b8adc54685 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 03:35:36 +0000 Subject: Add some more messageClasses. --- pidgin/gtkconv.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 2480887ad8..ef15afcb29 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6132,8 +6132,19 @@ replace_message_tokens( replace = message; } else if (g_str_has_prefix(cur, "%messageClasses%")) { - replace = flags & PURPLE_MESSAGE_SEND ? "outgoing" : - flags & PURPLE_MESSAGE_RECV ? "incoming" : "event"; + GString *classes = g_string_new(NULL); +#define ADD_CLASS(f, class) \ + if (flags & f) \ + g_string_append(classes, class); + ADD_CLASS(PURPLE_MESSAGE_SEND, "outgoing "); + ADD_CLASS(PURPLE_MESSAGE_RECV, "incoming "); + ADD_CLASS(PURPLE_MESSAGE_SYSTEM, "event "); + ADD_CLASS(PURPLE_MESSAGE_AUTO_RESP, "autoreply "); + ADD_CLASS(PURPLE_MESSAGE_DELAYED, "history "); + ADD_CLASS(PURPLE_MESSAGE_NICK, "mention "); +#undef ADD_CLASS + + replace = freeval = g_string_free(classes, FALSE); } else if (g_str_has_prefix(cur, "%time")) { const char *tmp = cur + strlen("%time"); -- cgit v1.2.1 From d80c52dad2a29c8cc56134c5a15e782be9b82b58 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 03:37:59 +0000 Subject: This #include is unnecessary when internal.h is used. --- pidgin/plugins/webkit.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pidgin/plugins/webkit.c b/pidgin/plugins/webkit.c index d9f3fedf3e..d80c481732 100644 --- a/pidgin/plugins/webkit.c +++ b/pidgin/plugins/webkit.c @@ -17,10 +17,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. */ -#ifdef HAVE_CONFIG_H -#include -#endif - #include "internal.h" #include "version.h" -- cgit v1.2.1 From 005e1f243ab3a001c783cd3533634ef27d276e62 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 06:30:51 +0000 Subject: We don't want WebKit to process a Refresh, or Back/Forward request either. --- pidgin/gtkwebview.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 7a12b43b20..ce2952bde6 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -214,8 +214,10 @@ webview_link_clicked(WebKitWebView *webview, * why, so right now just using purple_notify_uri directly */ purple_notify_uri(NULL, uri); webkit_web_policy_decision_ignore(policy_decision); - } else + } else if (reason == WEBKIT_WEB_NAVIGATION_REASON_OTHER) webkit_web_policy_decision_use(policy_decision); + else + webkit_web_policy_decision_ignore(policy_decision); return TRUE; } -- cgit v1.2.1 From 4b23120074bf1c24a7010622810cae57f0add0fe Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 09:20:44 +0000 Subject: Copy some editing functions from GtkIMHtml. These are incomplete. They are mostly just stubs that change private variables, but don't actually modify the WebView. --- pidgin/gtkwebview.c | 205 ++++++++++++++++++++++++++++++++++++++++++++++ pidgin/gtkwebview.h | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 437 insertions(+) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index ce2952bde6..c4bda69b74 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -30,6 +30,7 @@ #include "gtkwebview.h" +#define MAX_FONT_SIZE 7 #define MAX_SCROLL_TIME 0.4 /* seconds */ #define SCROLL_DELAY 33 /* milliseconds */ @@ -52,6 +53,23 @@ typedef struct _GtkWebViewPriv { GtkAdjustment *vadj; guint scroll_src; GTimer *scroll_time; + + /* Format options */ + GtkWebViewButtons format_functions; + struct { + gboolean wbfo:1; /* Whole buffer formatting only. */ + gboolean bold:1; + gboolean italic:1; + gboolean underline:1; + gboolean strike:1; + gchar *forecolor; + gchar *backcolor; + gchar *background; + gchar *fontface; + int fontsize; + /*GtkTextTag *link;*/ + } edit; + } GtkWebViewPriv; /****************************************************************************** @@ -503,3 +521,190 @@ void gtk_webview_page_down(GtkWebView *webview) gtk_adjustment_set_value(vadj, scroll_val); } +void +gtk_webview_set_editable(GtkWebView *webview, gboolean editable) +{ + webkit_web_view_set_editable(WEBKIT_WEB_VIEW(webview), editable); +} + +void +gtk_webview_set_whole_buffer_formatting_only(GtkWebView *webview, gboolean wbfo) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->edit.wbfo = wbfo; +} + +void +gtk_webview_set_format_functions(GtkWebView *webview, GtkWebViewButtons buttons) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->format_functions = buttons; +} + +GtkWebViewButtons +gtk_webview_get_format_functions(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + return priv->format_functions; +} + +void +gtk_webview_get_current_format(GtkWebView *webview, gboolean *bold, + gboolean *italic, gboolean *underline, + gboolean *strike) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + if (bold) + *bold = priv->edit.bold; + if (italic) + *italic = priv->edit.italic; + if (underline) + *underline = priv->edit.underline; + if (strike) + *strike = priv->edit.strike; +} + +const char * +gtk_webview_get_current_fontface(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + return priv->edit.fontface; +} + +const char * +gtk_webview_get_current_forecolor(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + return priv->edit.forecolor; +} + +const char * +gtk_webview_get_current_backcolor(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + return priv->edit.backcolor; +} + +const char * +gtk_webview_get_current_background(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + return priv->edit.background; +} + +gint +gtk_webview_get_current_fontsize(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + return priv->edit.fontsize; +} + +gboolean +gtk_webview_get_editable(GtkWebView *webview) +{ + return webkit_web_view_get_editable(WEBKIT_WEB_VIEW(webview)); +} + +void +gtk_webview_clear_formatting(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->edit.bold = FALSE; + priv->edit.italic = FALSE; + priv->edit.underline = FALSE; + priv->edit.strike = FALSE; +} + +void +gtk_webview_toggle_bold(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->edit.bold = !priv->edit.bold; +} + +void +gtk_webview_toggle_italic(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->edit.italic = !priv->edit.italic; +} + +void +gtk_webview_toggle_underline(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->edit.underline = !priv->edit.underline; +} + +void +gtk_webview_toggle_strike(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->edit.strike = !priv->edit.strike; +} + +gboolean +gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + g_free(priv->edit.forecolor); + priv->edit.forecolor = g_strdup(color); + + return FALSE; +} + +gboolean +gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + g_free(priv->edit.backcolor); + priv->edit.backcolor = g_strdup(color); + + return FALSE; +} + +gboolean +gtk_webview_toggle_background(GtkWebView *webview, const char *color) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + g_free(priv->edit.background); + priv->edit.background = g_strdup(color); + + return FALSE; +} + +gboolean +gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + g_free(priv->edit.fontface); + priv->edit.fontface = g_strdup(face); + + return FALSE; +} + +void +gtk_webview_font_set_size(GtkWebView *webview, gint size) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->edit.fontsize = size; +} + +void +gtk_webview_font_shrink(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->edit.fontsize = MAX(priv->edit.fontsize - 1, 1); +} + +void +gtk_webview_font_grow(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + priv->edit.fontsize = MIN(priv->edit.fontsize + 1, MAX_FONT_SIZE); +} + diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 398bb66b53..4642609176 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -39,6 +39,26 @@ #define GTK_IS_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEW)) #define GTK_WEBVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_WEBVIEW, GtkWebViewClass)) +typedef enum { + GTK_WEBVIEW_BOLD = 1 << 0, + GTK_WEBVIEW_ITALIC = 1 << 1, + GTK_WEBVIEW_UNDERLINE = 1 << 2, + GTK_WEBVIEW_GROW = 1 << 3, + GTK_WEBVIEW_SHRINK = 1 << 4, + GTK_WEBVIEW_FACE = 1 << 5, + GTK_WEBVIEW_FORECOLOR = 1 << 6, + GTK_WEBVIEW_BACKCOLOR = 1 << 7, + GTK_WEBVIEW_BACKGROUND = 1 << 8, + GTK_WEBVIEW_LINK = 1 << 9, + GTK_WEBVIEW_IMAGE = 1 << 10, + GTK_WEBVIEW_SMILEY = 1 << 11, + GTK_WEBVIEW_LINKDESC = 1 << 12, + GTK_WEBVIEW_STRIKE = 1 << 13, + /** Show custom smileys when appropriate. */ + GTK_WEBVIEW_CUSTOM_SMILEY = 1 << 14, + GTK_WEBVIEW_ALL = -1 +} GtkWebViewButtons; + typedef struct _GtkWebView GtkWebView; typedef struct _GtkWebViewClass GtkWebViewClass; @@ -150,6 +170,218 @@ void gtk_webview_page_up(GtkWebView *webview); */ void gtk_webview_page_down(GtkWebView *webview); +/** + * Enables or disables editing in a GtkWebView. + * + * @param webview The GtkWebView + * @param editable @c TRUE to make the widget editable, or @c FALSE otherwise. + */ +void gtk_webview_set_editable(GtkWebView *webview, gboolean editable); + +/** + * Enables or disables whole buffer formatting only (wbfo) in a GtkWebView. + * In this mode formatting options to the buffer take effect for the entire + * buffer instead of specific text. + * + * @param webview The GtkWebView + * @param wbfo @c TRUE to enable the mode, or @c FALSE otherwise. + */ +void gtk_webview_set_whole_buffer_formatting_only(GtkWebView *webview, + gboolean wbfo); + +/** + * Indicates which formatting functions to enable and disable in a GtkWebView. + * + * @param webview The GtkWebView + * @param buttons A GtkWebViewButtons bitmask indicating which functions to use + */ +void gtk_webview_set_format_functions(GtkWebView *webview, + GtkWebViewButtons buttons); + +/** + * Returns which formatting functions are enabled in a GtkWebView. + * + * @param webview The GtkWebView + * + * @return A GtkWebViewButtons bitmask indicating which functions to are enabled + */ +GtkWebViewButtons gtk_webview_get_format_functions(GtkWebView *webview); + +/** + * Sets each boolean to @c TRUE or @c FALSE to indicate if that formatting + * option is enabled at the current position in a GtkWebView. + * + * @param webview The GtkWebView + * @param bold The boolean to set for bold or @c NULL. + * @param italic The boolean to set for italic or @c NULL. + * @param underline The boolean to set for underline or @c NULL. + * @param strikethrough The boolean to set for strikethrough or @c NULL. + */ +void gtk_webview_get_current_format(GtkWebView *webview, gboolean *bold, + gboolean *italic, gboolean *underline, + gboolean *strike); + +/** + * Returns a string containing the selected font face at the current position + * in a GtkWebView. + * + * @param webview The GtkWebView + * + * @return A string containing the font face or @c NULL if none is set. + */ +const char *gtk_webview_get_current_fontface(GtkWebView *webview); + +/** + * Returns a string containing the selected foreground color at the current + * position in a GtkWebView. + * + * @param webview The GtkWebView + * + * @return A string containing the foreground color or @c NULL if none is set. + */ +const char *gtk_webview_get_current_forecolor(GtkWebView *webview); + +/** + * Returns a string containing the selected font background color at the current + * position in a GtkWebView. + * + * @param webview The GtkWebView + * + * @return A string containing the background color or @c NULL if none is set. + */ +const char *gtk_webview_get_current_backcolor(GtkWebView *webview); + +/** + * Returns a string containing the selected background color at the current + * position in a GtkWebView. + * + * @param webview The GtkWebView + * + * @return A string containg the background color or @c NULL if none is set. + */ +const char *gtk_webview_get_current_background(GtkWebView *webview); + +/** + * Returns a integer containing the selected HTML font size at the current + * position in a GtkWebView. + * + * @param webview The GtkWebView + * + * @return The HTML font size. + */ +gint gtk_webview_get_current_fontsize(GtkWebView *webview); + +/** + * Checks whether a GtkWebView is marked as editable. + * + * @param webview The GtkWebView + * + * @return @c TRUE if the IM/HTML is editable, or @c FALSE otherwise. + */ +gboolean gtk_webview_get_editable(GtkWebView *webview); + +/** + * Clear all the formatting on a GtkWebView. + * + * @param webview The GtkWebView + */ +void gtk_webview_clear_formatting(GtkWebView *webview); + +/** + * Toggles bold at the cursor location or selection in a GtkWebView. + * + * @param webview The GtkWebView + */ +void gtk_webview_toggle_bold(GtkWebView *webview); + +/** + * Toggles italic at the cursor location or selection in a GtkWebView. + * + * @param webview The GtkWebView + */ +void gtk_webview_toggle_italic(GtkWebView *webview); + +/** + * Toggles underline at the cursor location or selection in a GtkWebView. + * + * @param webview The GtkWebView + */ +void gtk_webview_toggle_underline(GtkWebView *webview); + +/** + * Toggles strikethrough at the cursor location or selection in a GtkWebView. + * + * @param webview The GtkWebView + */ +void gtk_webview_toggle_strike(GtkWebView *webview); + +/** + * Toggles a foreground color at the current location or selection in a + * GtkWebView. + * + * @param webview The GtkWebView + * @param color The HTML-style color, or @c NULL or "" to clear the color. + * + * @return @c TRUE if a color was set, or @c FALSE if it was cleared. + */ +gboolean gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color); + +/** + * Toggles a background color at the current location or selection in a + * GtkWebView. + * + * @param webview The GtkWebView + * @param color The HTML-style color, or @c NULL or "" to clear the color. + * + * @return @c TRUE if a color was set, or @c FALSE if it was cleared. + */ +gboolean gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color); + +/** + * Toggles a background color at the current location or selection in a + * GtkWebView. + * + * @param webview The GtkWebView + * @param color The HTML-style color, or @c NULL or "" to clear the color. + * + * @return @c TRUE if a color was set, or @c FALSE if it was cleared. + */ +gboolean gtk_webview_toggle_background(GtkWebView *webview, const char *color); + +/** + * Toggles a font face at the current location or selection in a GtkWebView. + * + * @param webview The GtkWebView + * @param face The font face name, or @c NULL or "" to clear the font. + * + * @return @c TRUE if a font name was set, or @c FALSE if it was cleared. + */ +gboolean gtk_webview_toggle_fontface(GtkWebView *webview, const char *face); + +/** + * Sets the font size at the current location or selection in a GtkWebView. + * + * @param webview The GtkWebView + * @param size The HTML font size to use. + */ +void gtk_webview_font_set_size(GtkWebView *webview, gint size); + +/** + * Decreases the font size by 1 at the current location or selection in a + * GtkWebView. + * + * @param webview The GtkWebView + */ +void gtk_webview_font_shrink(GtkWebView *webview); + +/** + * Increases the font size by 1 at the current location or selection in a + * GtkWebView. + * + * @param webview The GtkWebView + */ +void gtk_webview_font_grow(GtkWebView *webview); + G_END_DECLS #endif /* _PIDGIN_WEBVIEW_H_ */ -- cgit v1.2.1 From 269d152d256bc39c1b8a68d1172c1c2d51e51c56 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 09:44:06 +0000 Subject: Add a GtkWebViewToolbar. This is basically a copy of the GtkIMHtml toolbar, but with a name change. Additionally, the code that isn't available yet for a WebView is commented out. --- pidgin/gtkwebviewtoolbar.c | 1627 ++++++++++++++++++++++++++++++++++++++++++++ pidgin/gtkwebviewtoolbar.h | 128 ++++ 2 files changed, 1755 insertions(+) create mode 100644 pidgin/gtkwebviewtoolbar.c create mode 100644 pidgin/gtkwebviewtoolbar.h diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c new file mode 100644 index 0000000000..29c523012a --- /dev/null +++ b/pidgin/gtkwebviewtoolbar.c @@ -0,0 +1,1627 @@ +/* + * @file gtkwebviewtoolbar.c GTK+ WebView Toolbar + * @ingroup pidgin + */ + +/* pidgin + * + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * + */ +#include "internal.h" +#include "pidgin.h" + +#include "imgstore.h" +#include "notify.h" +#include "prefs.h" +#include "request.h" +#include "pidginstock.h" +#include "util.h" +#include "debug.h" + +#include "gtkdialogs.h" +#include "gtkwebviewtoolbar.h" +#include "gtksmiley.h" +#include "gtkthemes.h" +#include "gtkutils.h" + +#include + +static GtkHBoxClass *parent_class = NULL; + +static void +toggle_button_set_active_block(GtkToggleButton *button, gboolean is_active, + GtkWebViewToolbar *toolbar); + +static gboolean +gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, + GtkWebViewToolbar *toolbar); + +static void +do_bold(GtkWidget *bold, GtkWebViewToolbar *toolbar) +{ + g_return_if_fail(toolbar != NULL); + gtk_webview_toggle_bold(GTK_WEBVIEW(toolbar->webview)); + gtk_widget_grab_focus(toolbar->webview); +} + +static void +do_italic(GtkWidget *italic, GtkWebViewToolbar *toolbar) +{ + g_return_if_fail(toolbar != NULL); + gtk_webview_toggle_italic(GTK_WEBVIEW(toolbar->webview)); + gtk_widget_grab_focus(toolbar->webview); +} + +static void +do_underline(GtkWidget *underline, GtkWebViewToolbar *toolbar) +{ + g_return_if_fail(toolbar != NULL); + gtk_webview_toggle_underline(GTK_WEBVIEW(toolbar->webview)); + gtk_widget_grab_focus(toolbar->webview); +} + +static void +do_strikethrough(GtkWidget *strikethrough, GtkWebViewToolbar *toolbar) +{ + g_return_if_fail(toolbar != NULL); + gtk_webview_toggle_strike(GTK_WEBVIEW(toolbar->webview)); + gtk_widget_grab_focus(toolbar->webview); +} + +static void +do_small(GtkWidget *smalltb, GtkWebViewToolbar *toolbar) +{ + g_return_if_fail(toolbar != NULL); + /* Only shrink the font on activation, not deactivation as well */ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smalltb))) + gtk_webview_font_shrink(GTK_WEBVIEW(toolbar->webview)); + gtk_widget_grab_focus(toolbar->webview); +} + +static void +do_big(GtkWidget *large, GtkWebViewToolbar *toolbar) +{ + g_return_if_fail(toolbar); + /* Only grow the font on activation, not deactivation as well */ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(large))) + gtk_webview_font_grow(GTK_WEBVIEW(toolbar->webview)); + gtk_widget_grab_focus(toolbar->webview); +} + +static gboolean +destroy_toolbar_font(GtkWidget *widget, GdkEvent *event, + GtkWebViewToolbar *toolbar) +{ + if (widget != NULL) + gtk_webview_toggle_fontface(GTK_WEBVIEW(toolbar->webview), ""); + + if (toolbar->font_dialog != NULL) + { + gtk_widget_destroy(toolbar->font_dialog); + toolbar->font_dialog = NULL; + } + return FALSE; +} + +static void +realize_toolbar_font(GtkWidget *widget, GtkWebViewToolbar *toolbar) +{ + GtkFontSelection *sel; + + sel = GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->fontsel); + gtk_widget_hide_all(gtk_widget_get_parent(sel->size_entry)); + gtk_widget_show_all(sel->family_list); + gtk_widget_show(gtk_widget_get_parent(sel->family_list)); + gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent(sel->family_list))); +} + +static void +cancel_toolbar_font(GtkWidget *widget, GtkWebViewToolbar *toolbar) +{ + destroy_toolbar_font(widget, NULL, toolbar); +} + +static void +apply_font(GtkWidget *widget, GtkFontSelectionDialog *fontsel) +{ + /* this could be expanded to include font size, weight, etc. + but for now only works with font face */ + gchar *fontname = gtk_font_selection_dialog_get_font_name(fontsel); + GtkWebViewToolbar *toolbar = g_object_get_data(G_OBJECT(fontsel), + "purple_toolbar"); + + if (fontname) { + const gchar *family_name = NULL; + PangoFontDescription *desc = NULL; + + desc = pango_font_description_from_string(fontname); + family_name = pango_font_description_get_family(desc); + + if (family_name) { + gtk_webview_toggle_fontface(GTK_WEBVIEW(toolbar->webview), + family_name); + } + + pango_font_description_free(desc); + g_free(fontname); + } + + cancel_toolbar_font(NULL, toolbar); +} + +static void +toggle_font(GtkWidget *font, GtkWebViewToolbar *toolbar) +{ + g_return_if_fail(toolbar); + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) { + const char *fontname = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); + + if (!toolbar->font_dialog) { + toolbar->font_dialog = gtk_font_selection_dialog_new(_("Select Font")); + + g_object_set_data(G_OBJECT(toolbar->font_dialog), "purple_toolbar", toolbar); + + if (fontname) { + char *fonttif = g_strdup_printf("%s 12", fontname); + gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog), + fonttif); + g_free(fonttif); + } else { + gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog), + DEFAULT_FONT_FACE); + } + + g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event", + G_CALLBACK(destroy_toolbar_font), toolbar); + g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->ok_button), "clicked", + G_CALLBACK(apply_font), toolbar->font_dialog); + g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->cancel_button), "clicked", + G_CALLBACK(cancel_toolbar_font), toolbar); + g_signal_connect_after(G_OBJECT(toolbar->font_dialog), "realize", + G_CALLBACK(realize_toolbar_font), toolbar); + } + gtk_window_present(GTK_WINDOW(toolbar->font_dialog)); + } else { + cancel_toolbar_font(font, toolbar); + } + gtk_widget_grab_focus(toolbar->webview); +} + +static gboolean +destroy_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event, + GtkWebViewToolbar *toolbar) +{ + if (widget != NULL) + gtk_webview_toggle_forecolor(GTK_WEBVIEW(toolbar->webview), ""); + + if (toolbar->fgcolor_dialog != NULL) + { + gtk_widget_destroy(toolbar->fgcolor_dialog); + toolbar->fgcolor_dialog = NULL; + } + return FALSE; +} + +static void +cancel_toolbar_fgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar) +{ + destroy_toolbar_fgcolor(widget, NULL, toolbar); +} + +static void +do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) +{ + GdkColor text_color; + GtkWebViewToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "purple_toolbar"); + char *open_tag; + + open_tag = g_malloc(30); + gtk_color_selection_get_current_color(colorsel, &text_color); + g_snprintf(open_tag, 23, "#%02X%02X%02X", + text_color.red / 256, + text_color.green / 256, + text_color.blue / 256); + gtk_webview_toggle_forecolor(GTK_WEBVIEW(toolbar->webview), open_tag); + g_free(open_tag); + + cancel_toolbar_fgcolor(NULL, toolbar); +} + +static void +toggle_fg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) +{ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { + GtkWidget *colorsel; + GdkColor fgcolor; + const char *color = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); + + if (!toolbar->fgcolor_dialog) { + + toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); + colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel; + if (color) { + gdk_color_parse(color, &fgcolor); + gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor); + } + + g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); + + g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event", + G_CALLBACK(destroy_toolbar_fgcolor), toolbar); + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->ok_button), "clicked", + G_CALLBACK(do_fgcolor), colorsel); + g_signal_connect(G_OBJECT (GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->cancel_button), "clicked", + G_CALLBACK(cancel_toolbar_fgcolor), toolbar); + } + gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog)); + } else { + cancel_toolbar_fgcolor(color, toolbar); + } + gtk_widget_grab_focus(toolbar->webview); +} + +static gboolean +destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event, + GtkWebViewToolbar *toolbar) +{ + if (widget != NULL) { +#if 0 + if (gtk_text_buffer_get_selection_bounds(GTK_WEBVIEW(toolbar->webview)->text_buffer, NULL, NULL)) + gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), ""); + else +#endif + gtk_webview_toggle_background(GTK_WEBVIEW(toolbar->webview), ""); + } + + if (toolbar->bgcolor_dialog != NULL) + { + gtk_widget_destroy(toolbar->bgcolor_dialog); + toolbar->bgcolor_dialog = NULL; + } + return FALSE; +} + +static void +cancel_toolbar_bgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar) +{ + destroy_toolbar_bgcolor(widget, NULL, toolbar); +} + +static void +do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) +{ + GdkColor text_color; + GtkWebViewToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "purple_toolbar"); + char *open_tag; + + open_tag = g_malloc(30); + gtk_color_selection_get_current_color(colorsel, &text_color); + g_snprintf(open_tag, 23, "#%02X%02X%02X", + text_color.red / 256, + text_color.green / 256, + text_color.blue / 256); +#if 0 + if (gtk_text_buffer_get_selection_bounds(GTK_WEBVIEW(toolbar->webview)->text_buffer, NULL, NULL)) + gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), open_tag); + else +#endif + gtk_webview_toggle_background(GTK_WEBVIEW(toolbar->webview), open_tag); + g_free(open_tag); + + cancel_toolbar_bgcolor(NULL, toolbar); +} + +static void +toggle_bg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) +{ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { + GtkWidget *colorsel; + GdkColor bgcolor; + const char *color = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); + + if (!toolbar->bgcolor_dialog) { + + toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); + colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel; + if (color) { + gdk_color_parse(color, &bgcolor); + gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor); + } + + g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); + + g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event", + G_CALLBACK(destroy_toolbar_bgcolor), toolbar); + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->ok_button), "clicked", + G_CALLBACK(do_bgcolor), colorsel); + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->cancel_button), "clicked", + G_CALLBACK(cancel_toolbar_bgcolor), toolbar); + + } + gtk_window_present(GTK_WINDOW(toolbar->bgcolor_dialog)); + } else { + cancel_toolbar_bgcolor(color, toolbar); + } + gtk_widget_grab_focus(toolbar->webview); +} + +static void +clear_formatting_cb(GtkWidget *clear, GtkWebViewToolbar *toolbar) +{ + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->clear), FALSE, toolbar); + gtk_webview_clear_formatting(GTK_WEBVIEW(toolbar->webview)); +} + +static void +cancel_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields) +{ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE); + + toolbar->link_dialog = NULL; +} + +static void +close_link_dialog(GtkWebViewToolbar *toolbar) +{ + if (toolbar->link_dialog != NULL) + { + purple_request_close(PURPLE_REQUEST_FIELDS, toolbar->link_dialog); + toolbar->link_dialog = NULL; + } +} + +static void +do_insert_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields) +{ + const char *url, *description; + + url = purple_request_fields_get_string(fields, "url"); + if (gtk_webview_get_format_functions(GTK_WEBVIEW(toolbar->webview)) & GTK_WEBVIEW_LINKDESC) + description = purple_request_fields_get_string(fields, "description"); + else + description = NULL; + + if (description == NULL) + description = url; + +#if 0 + gtk_webview_insert_link(GTK_WEBVIEW(toolbar->webview), + gtk_text_buffer_get_insert(GTK_WEBVIEW(toolbar->webview)->text_buffer), + url, description); +#endif + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE); + + toolbar->link_dialog = NULL; +} + +static void +insert_link_cb(GtkWidget *w, GtkWebViewToolbar *toolbar) +{ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))) { + PurpleRequestFields *fields; + PurpleRequestFieldGroup *group; + PurpleRequestField *field; +#if 0 + GtkTextIter start, end; +#endif + char *msg; + char *desc = NULL; + + fields = purple_request_fields_new(); + + group = purple_request_field_group_new(NULL); + purple_request_fields_add_group(fields, group); + + field = purple_request_field_string_new("url", _("_URL"), NULL, FALSE); + purple_request_field_set_required(field, TRUE); + purple_request_field_group_add_field(group, field); + + if (gtk_webview_get_format_functions(GTK_WEBVIEW(toolbar->webview)) & GTK_WEBVIEW_LINKDESC) { +#if 0 + if (gtk_text_buffer_get_selection_bounds(GTK_WEBVIEW(toolbar->webview)->text_buffer, &start, &end)) { + desc = gtk_webview_get_text(GTK_WEBVIEW(toolbar->webview), &start, &end); + } +#endif + field = purple_request_field_string_new("description", _("_Description"), + desc, FALSE); + purple_request_field_group_add_field(group, field); + msg = g_strdup(_("Please enter the URL and description of the " + "link that you want to insert. The description " + "is optional.")); + } else { + msg = g_strdup(_("Please enter the URL of the " + "link that you want to insert.")); + } + + toolbar->link_dialog = + purple_request_fields(toolbar, _("Insert Link"), + NULL, + msg, + fields, + _("_Insert"), G_CALLBACK(do_insert_link_cb), + _("Cancel"), G_CALLBACK(cancel_link_cb), + NULL, NULL, NULL, + toolbar); + g_free(msg); + g_free(desc); + } else { + close_link_dialog(toolbar); + } + gtk_widget_grab_focus(toolbar->webview); +} + +static void +insert_hr_cb(GtkWidget *widget, GtkWebViewToolbar *toolbar) +{ +#if 0 + GtkTextIter iter; + GtkTextMark *ins; + GtkIMHtmlScalable *hr; + + ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview))); + gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview)), &iter, ins); + hr = gtk_webview_hr_new(); + gtk_webview_hr_add_to(hr, GTK_WEBVIEW(toolbar->webview), &iter); +#endif +} + +static void +do_insert_image_cb(GtkWidget *widget, int response, GtkWebViewToolbar *toolbar) +{ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); +#if 0 + gchar *filename, *name, *buf; + char *filedata; + size_t size; + GError *error = NULL; + int id; + GtkTextIter iter; + GtkTextMark *ins; + + if (response != GTK_RESPONSE_ACCEPT) + { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); + return; + } + + filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); + + if (filename == NULL) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); + return; + } + + /* The following triggers a callback that closes the widget */ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); + + if (!g_file_get_contents(filename, &filedata, &size, &error)) { + purple_notify_error(NULL, NULL, error->message, NULL); + + g_error_free(error); + g_free(filename); + + return; + } + + name = strrchr(filename, G_DIR_SEPARATOR) + 1; + + id = purple_imgstore_add_with_id(filedata, size, name); + + if (id == 0) { + buf = g_strdup_printf(_("Failed to store image: %s\n"), filename); + purple_notify_error(NULL, NULL, buf, NULL); + + g_free(buf); + g_free(filename); + + return; + } + + g_free(filename); + + ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview))); + gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview)), + &iter, ins); + gtk_webview_insert_image_at_iter(GTK_WEBVIEW(toolbar->webview), id, &iter); + purple_imgstore_unref_by_id(id); +#endif +} + +static void +insert_image_cb(GtkWidget *save, GtkWebViewToolbar *toolbar) +{ + GtkWidget *window; + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))) { + window = gtk_file_chooser_dialog_new(_("Insert Image"), + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT); + g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(window)), + "response", G_CALLBACK(do_insert_image_cb), toolbar); + + gtk_widget_show(window); + toolbar->image_dialog = window; + } else { + gtk_widget_destroy(toolbar->image_dialog); + toolbar->image_dialog = NULL; + } + + gtk_widget_grab_focus(toolbar->webview); +} + +#if 0 +static void +destroy_smiley_dialog(GtkWebViewToolbar *toolbar) +{ + if (toolbar->smiley_dialog != NULL) + { + gtk_widget_destroy(toolbar->smiley_dialog); + toolbar->smiley_dialog = NULL; + } +} + +static gboolean +close_smiley_dialog(GtkWebViewToolbar *toolbar) +{ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smiley), FALSE); + return FALSE; +} + + +static void +insert_smiley_text(GtkWidget *widget, GtkWebViewToolbar *toolbar) +{ + char *smiley_text, *escaped_smiley; + + smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text"); + escaped_smiley = g_markup_escape_text(smiley_text, -1); + + gtk_webview_insert_smiley(GTK_WEBVIEW(toolbar->webview), + GTK_WEBVIEW(toolbar->webview)->protocol_name, + escaped_smiley); + + g_free(escaped_smiley); + + close_smiley_dialog(toolbar); +} + +/* smiley buttons list */ +struct smiley_button_list { + int width, height; + GtkWidget *button; + const GtkIMHtmlSmiley *smiley; + struct smiley_button_list *next; +}; + +static struct smiley_button_list * +sort_smileys(struct smiley_button_list *ls, GtkWebViewToolbar *toolbar, + int *width, const GtkIMHtmlSmiley *smiley) +{ + GtkWidget *image; + GtkWidget *button; + GtkRequisition size; + struct smiley_button_list *cur; + struct smiley_button_list *it, *it_last; + const gchar *filename = smiley->file; + gchar *face = smiley->smile; + PurpleSmiley *psmiley = NULL; + gboolean supports_custom = (gtk_webview_get_format_functions(GTK_WEBVIEW(toolbar->webview)) & GTK_WEBVIEW_CUSTOM_SMILEY); + + cur = g_new0(struct smiley_button_list, 1); + it = ls; + it_last = ls; /* list iterators*/ + image = gtk_image_new_from_file(filename); + + gtk_widget_size_request(image, &size); + + if (size.width > 24 && + smiley->flags & GTK_WEBVIEW_SMILEY_CUSTOM) { /* This is a custom smiley, let's scale it */ + GdkPixbuf *pixbuf = NULL; + GtkImageType type; + + type = gtk_image_get_storage_type(GTK_IMAGE(image)); + + if (type == GTK_IMAGE_PIXBUF) { + pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image)); + } else if (type == GTK_IMAGE_ANIMATION) { + GdkPixbufAnimation *animation; + + animation = gtk_image_get_animation(GTK_IMAGE(image)); + + pixbuf = gdk_pixbuf_animation_get_static_image(animation); + } + + if (pixbuf != NULL) { + GdkPixbuf *resized; + resized = gdk_pixbuf_scale_simple(pixbuf, 24, 24, + GDK_INTERP_HYPER); + + gtk_image_set_from_pixbuf(GTK_IMAGE(image), resized); /* This unrefs pixbuf */ + gtk_widget_size_request(image, &size); + g_object_unref(G_OBJECT(resized)); + } + } + + (*width) += size.width; + + button = gtk_button_new(); + gtk_container_add(GTK_CONTAINER(button), image); + + g_object_set_data(G_OBJECT(button), "smiley_text", face); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar); + + gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL); + + /* these look really weird with borders */ + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + + psmiley = purple_smileys_find_by_shortcut(smiley->smile); + /* If this is a "non-custom" smiley, check to see if its shortcut is + "shadowed" by any custom smiley. This can only happen if the connection + is custom smiley-enabled */ + if (supports_custom && psmiley && !(smiley->flags & GTK_WEBVIEW_SMILEY_CUSTOM)) { + gchar tip[128]; + g_snprintf(tip, sizeof(tip), + _("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"), + face); + gtk_tooltips_set_tip(toolbar->tooltips, button, tip, NULL); + gtk_widget_set_sensitive(button, FALSE); + } else if (psmiley) { + /* Remove the button if the smiley is destroyed */ + g_signal_connect_object(G_OBJECT(psmiley), "destroy", G_CALLBACK(gtk_widget_destroy), + button, G_CONNECT_SWAPPED); + } + + /* set current element to add */ + cur->height = size.height; + cur->width = size.width; + cur->button = button; + cur->smiley = smiley; + cur->next = ls; + + /* check where to insert by height */ + if (ls == NULL) + return cur; + while (it != NULL) { + it_last = it; + it = it->next; + } + cur->next = it; + it_last->next = cur; + return ls; +} + +static gboolean +smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) +{ + while (list) { + GtkIMHtmlSmiley *cur = (GtkIMHtmlSmiley *) list->data; + if (!strcmp(cur->file, smiley->file)) + return FALSE; + list = list->next; + } + return TRUE; +} + +static gboolean +smiley_dialog_input_cb(GtkWidget *dialog, GdkEvent *event, + GtkWebViewToolbar *toolbar) +{ + if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_Escape) || + (event->type == GDK_BUTTON_PRESS && event->button.button == 1)) + { + close_smiley_dialog(toolbar); + return TRUE; + } + + return FALSE; +} + +static void +add_smiley_list(GtkWidget *container, struct smiley_button_list *list, + int max_width, gboolean custom) +{ + GtkWidget *line; + int line_width = 0; + + if (!list) + return; + + line = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); + for (; list; list = list->next) { + if (custom != !!(list->smiley->flags & GTK_WEBVIEW_SMILEY_CUSTOM)) + continue; + gtk_box_pack_start(GTK_BOX(line), list->button, FALSE, FALSE, 0); + gtk_widget_show(list->button); + line_width += list->width; + if (line_width >= max_width) { + if (list->next) { + line = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(container), line, FALSE, FALSE, 0); + } + line_width = 0; + } + } +} +#endif + +static void +insert_smiley_cb(GtkWidget *smiley, GtkWebViewToolbar *toolbar) +{ +#if 0 + GtkWidget *dialog, *vbox; + GtkWidget *smiley_table = NULL; + GSList *smileys, *unique_smileys = NULL; + const GSList *custom_smileys = NULL; + gboolean supports_custom = FALSE; + GtkRequisition req; + GtkWidget *scrolled, *viewport; + + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) { + destroy_smiley_dialog(toolbar); + gtk_widget_grab_focus(toolbar->webview); + return; + } + + if (toolbar->sml) + smileys = pidgin_themes_get_proto_smileys(toolbar->sml); + else + smileys = pidgin_themes_get_proto_smileys(NULL); + + /* Note: prepend smileys to list to avoid O(n^2) overhead when there is + a large number of smileys... need to revers the list after for the dialog + work... */ + while(smileys) { + GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) smileys->data; + if(!smiley->hidden) { + if(smiley_is_unique(unique_smileys, smiley)) { + unique_smileys = g_slist_prepend(unique_smileys, smiley); + } + } + smileys = smileys->next; + } + supports_custom = (gtk_webview_get_format_functions(GTK_WEBVIEW(toolbar->webview)) & GTK_WEBVIEW_CUSTOM_SMILEY); + if (toolbar->webview && supports_custom) { + const GSList *iterator = NULL; + custom_smileys = pidgin_smileys_get_all(); + + for (iterator = custom_smileys ; iterator ; + iterator = g_slist_next(iterator)) { + GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) iterator->data; + unique_smileys = g_slist_prepend(unique_smileys, smiley); + } + } + + /* we need to reverse the list to get the smileys in the correct order */ + unique_smileys = g_slist_reverse(unique_smileys); + + dialog = pidgin_create_dialog(_("Smile!"), 0, "smiley_dialog", FALSE); + gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); + vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(dialog), FALSE, 0); + + if (unique_smileys != NULL) { + struct smiley_button_list *ls; + int max_line_width, num_lines, button_width = 0; + + /* We use hboxes packed in a vbox */ + ls = NULL; + max_line_width = 0; + num_lines = floor(sqrt(g_slist_length(unique_smileys))); + smiley_table = gtk_vbox_new(FALSE, 0); + + if (supports_custom) { + GtkWidget *manage = gtk_button_new_with_mnemonic(_("_Manage custom smileys")); + GtkRequisition req; + g_signal_connect(G_OBJECT(manage), "clicked", + G_CALLBACK(pidgin_smiley_manager_show), NULL); + g_signal_connect_swapped(G_OBJECT(manage), "clicked", + G_CALLBACK(gtk_widget_destroy), dialog); + gtk_box_pack_end(GTK_BOX(vbox), manage, FALSE, TRUE, 0); + gtk_widget_size_request(manage, &req); + button_width = req.width; + } + + /* create list of smileys sorted by height */ + while (unique_smileys) { + GtkIMHtmlSmiley *smiley = (GtkIMHtmlSmiley *) unique_smileys->data; + if (!smiley->hidden) { + ls = sort_smileys(ls, toolbar, &max_line_width, smiley); + } + unique_smileys = g_slist_delete_link(unique_smileys, unique_smileys); + } + /* The window will be at least as wide as the 'Manage ..' button */ + max_line_width = MAX(button_width, max_line_width / num_lines); + + /* pack buttons of the list */ + add_smiley_list(smiley_table, ls, max_line_width, FALSE); + if (supports_custom) { + gtk_box_pack_start(GTK_BOX(smiley_table), gtk_hseparator_new(), TRUE, FALSE, 0); + add_smiley_list(smiley_table, ls, max_line_width, TRUE); + } + while (ls) { + struct smiley_button_list *tmp = ls->next; + g_free(ls); + ls = tmp; + } + + gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK); + } + else { + smiley_table = gtk_label_new(_("This theme has no available smileys.")); + gtk_widget_add_events(dialog, GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK); + g_signal_connect(G_OBJECT(dialog), "button-press-event", (GCallback)smiley_dialog_input_cb, toolbar); + } + + + scrolled = pidgin_make_scrollable(smiley_table, GTK_POLICY_NEVER, GTK_POLICY_NEVER, GTK_SHADOW_NONE, -1, -1); + gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0); + gtk_widget_show(smiley_table); + + viewport = gtk_widget_get_parent(smiley_table); + gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE); + + /* connect signals */ + g_signal_connect_swapped(G_OBJECT(dialog), "destroy", G_CALLBACK(close_smiley_dialog), toolbar); + g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(smiley_dialog_input_cb), toolbar); + + gtk_window_set_transient_for(GTK_WINDOW(dialog), + GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(toolbar)))); + + /* show everything */ + gtk_widget_show_all(dialog); + + gtk_widget_size_request(viewport, &req); + gtk_widget_set_size_request(scrolled, MIN(300, req.width), MIN(290, req.height)); + + /* The window has to be made resizable, and the scrollbars in the scrolled window + * enabled only after setting the desired size of the window. If we do either of + * these tasks before now, GTK+ miscalculates the required size, and erronously + * makes one or both scrollbars visible (sometimes). + * I too think this hack is gross. But I couldn't find a better way -- sadrul */ + gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE); + g_object_set(G_OBJECT(scrolled), + "hscrollbar-policy", GTK_POLICY_AUTOMATIC, + "vscrollbar-policy", GTK_POLICY_AUTOMATIC, + NULL); + +#ifdef _WIN32 + winpidgin_ensure_onscreen(dialog); +#endif + + toolbar->smiley_dialog = dialog; + + gtk_widget_grab_focus(toolbar->webview); +#endif +} + +static void +send_attention_cb(GtkWidget *attention, GtkWebViewToolbar *toolbar) +{ + PurpleConversation *conv = + g_object_get_data(G_OBJECT(toolbar), "active_conv"); + const gchar *who = purple_conversation_get_name(conv); + PurpleConnection *gc = purple_conversation_get_connection(conv); + + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(attention), FALSE, toolbar); + purple_prpl_send_attention(gc, who, 0); + gtk_widget_grab_focus(toolbar->webview); +} + +static void +update_buttons_cb(GtkWebView *webview, GtkWebViewButtons buttons, + GtkWebViewToolbar *toolbar) +{ + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bold), buttons & GTK_WEBVIEW_BOLD); + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->italic), buttons & GTK_WEBVIEW_ITALIC); + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->underline), buttons & GTK_WEBVIEW_UNDERLINE); + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->strikethrough), buttons & GTK_WEBVIEW_STRIKE); + + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->larger_size), buttons & GTK_WEBVIEW_GROW); + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->smaller_size), buttons & GTK_WEBVIEW_SHRINK); + + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->font), buttons & GTK_WEBVIEW_FACE); + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->fgcolor), buttons & GTK_WEBVIEW_FORECOLOR); + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bgcolor), buttons & GTK_WEBVIEW_BACKCOLOR); + + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->clear), + (buttons & GTK_WEBVIEW_BOLD || + buttons & GTK_WEBVIEW_ITALIC || + buttons & GTK_WEBVIEW_UNDERLINE || + buttons & GTK_WEBVIEW_STRIKE || + buttons & GTK_WEBVIEW_GROW || + buttons & GTK_WEBVIEW_SHRINK || + buttons & GTK_WEBVIEW_FACE || + buttons & GTK_WEBVIEW_FORECOLOR || + buttons & GTK_WEBVIEW_BACKCOLOR)); + + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->image), buttons & GTK_WEBVIEW_IMAGE); + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->link), buttons & GTK_WEBVIEW_LINK); + gtk_widget_set_sensitive(GTK_WIDGET(toolbar->smiley), buttons & GTK_WEBVIEW_SMILEY); +} + +/* we call this when we want to _set_active the toggle button, it'll + * block the callback thats connected to the button so we don't have to + * do the double toggling hack + */ +static void +toggle_button_set_active_block(GtkToggleButton *button, gboolean is_active, + GtkWebViewToolbar *toolbar) +{ + GObject *object; + g_return_if_fail(toolbar); + + object = g_object_ref(button); + g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, toolbar); + gtk_toggle_button_set_active(button, is_active); + g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, toolbar); + g_object_unref(object); +} + +static void +update_buttons(GtkWebViewToolbar *toolbar) +{ + gboolean bold, italic, underline, strike; + const char *tmp; + const char *tmp2; + GtkLabel *label = g_object_get_data(G_OBJECT(toolbar), "font_label"); + + gtk_label_set_label(label, _("_Font")); + + gtk_webview_get_current_format(GTK_WEBVIEW(toolbar->webview), + &bold, &italic, &underline, &strike); + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->bold)) != bold) + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bold), bold, + toolbar); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->italic)) != italic) + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->italic), italic, + toolbar); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->underline)) != underline) + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->underline), + underline, toolbar); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->strikethrough)) != strike) + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->strikethrough), + strike, toolbar); + + /* These buttons aren't ever "active". */ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smaller_size), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->larger_size), FALSE); + + if (bold) { + gchar *markup = g_strdup_printf("%s", + gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + if (italic) { + gchar *markup = g_strdup_printf("%s", + gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + if (underline) { + gchar *markup = g_strdup_printf("%s", + gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + if (strike) { + gchar *markup = g_strdup_printf("%s", + gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + + tmp = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->font), + (tmp != NULL), toolbar); + if (tmp != NULL) { + gchar *markup = g_strdup_printf("%s", + tmp, gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + + tmp = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->fgcolor), + (tmp != NULL), toolbar); + if (tmp != NULL) { + gchar *markup = g_strdup_printf("%s", + tmp, gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } + + tmp = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); + tmp2 = gtk_webview_get_current_background(GTK_WEBVIEW(toolbar->webview)); + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bgcolor), + (tmp != NULL || tmp2 != NULL), toolbar); + if (tmp != NULL) { + gchar *markup = g_strdup_printf("%s", + tmp, gtk_label_get_label(label)); + gtk_label_set_markup_with_mnemonic(label, markup); + g_free(markup); + } +} + +static void +toggle_button_cb(GtkWebView *webview, GtkWebViewButtons buttons, + GtkWebViewToolbar *toolbar) +{ + update_buttons(toolbar); +} + +static void +update_format_cb(GtkWebView *webview, GtkWebViewToolbar *toolbar) +{ + update_buttons(toolbar); +} + +#if 0 +static void +mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *location, GtkTextMark *mark, + GtkWebViewToolbar *toolbar) +{ + if(mark != gtk_text_buffer_get_insert(buffer)) + return; + + update_buttons(toolbar); +} +#endif + +/* This comes from gtkmenutoolbutton.c from gtk+ + * Copyright (C) 2003 Ricardo Fernandez Pascual + * Copyright (C) 2004 Paolo Borelli + */ +static void +menu_position_func(GtkMenu *menu, + int *x, + int *y, + gboolean *push_in, + gpointer data) +{ + GtkWidget *widget = GTK_WIDGET(data); + GtkRequisition menu_req; + gint ythickness = widget->style->ythickness; + int savy; + + gtk_widget_size_request(GTK_WIDGET (menu), &menu_req); + gdk_window_get_origin(widget->window, x, y); + *x += widget->allocation.x; + *y += widget->allocation.y + widget->allocation.height; + savy = *y; + + pidgin_menu_position_func_helper(menu, x, y, push_in, data); + + if (savy > *y + ythickness + 1) + *y -= widget->allocation.height; +} + +static gboolean +button_activate_on_click(GtkWidget *button, GdkEventButton *event, + GtkWebViewToolbar *toolbar) +{ + if (event->button == 1 && GTK_IS_TOGGLE_BUTTON(button)) + gtk_widget_activate(button); + else if (event->button == 3) + return gtk_webviewtoolbar_popup_menu(button, event, toolbar); + return FALSE; +} + +static void +pidgin_menu_clicked(GtkWidget *button, GtkMenu *menu) +{ + gtk_widget_show_all(GTK_WIDGET(menu)); + gtk_menu_popup(menu, NULL, NULL, menu_position_func, button, 0, gtk_get_current_event_time()); +} + +static void +pidgin_menu_deactivate(GtkWidget *menu, GtkToggleButton *button) +{ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); +} + +enum { + LAST_SIGNAL +}; +/* static guint signals [LAST_SIGNAL] = { 0 }; */ + +static void +gtk_webviewtoolbar_finalize(GObject *object) +{ + GtkWebViewToolbar *toolbar = GTK_WEBVIEWTOOLBAR(object); + GtkWidget *menu; + + if (toolbar->image_dialog != NULL) + { + gtk_widget_destroy(toolbar->image_dialog); + toolbar->image_dialog = NULL; + } + + destroy_toolbar_font(NULL, NULL, toolbar); + if (toolbar->smiley_dialog != NULL) { +#if 0 + g_signal_handlers_disconnect_by_func(G_OBJECT(toolbar->smiley_dialog), close_smiley_dialog, toolbar); + destroy_smiley_dialog(toolbar); +#endif + } + destroy_toolbar_bgcolor(NULL, NULL, toolbar); + destroy_toolbar_fgcolor(NULL, NULL, toolbar); + close_link_dialog(toolbar); + if (toolbar->webview) { + g_signal_handlers_disconnect_matched(toolbar->webview, + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, + toolbar); +#if 0 + g_signal_handlers_disconnect_matched(GTK_WEBVIEW(toolbar->webview)->text_buffer, + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, + toolbar); +#endif + } + + g_free(toolbar->sml); + gtk_object_sink(GTK_OBJECT(toolbar->tooltips)); + + menu = g_object_get_data(object, "font_menu"); + if (menu) + gtk_widget_destroy(menu); + menu = g_object_get_data(object, "insert_menu"); + if (menu) + gtk_widget_destroy(menu); + + purple_prefs_disconnect_by_handle(object); + + G_OBJECT_CLASS(parent_class)->finalize (object); +} + +static void +switch_toolbar_view(GtkWidget *item, GtkWebViewToolbar *toolbar) +{ + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", + !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide")); +} + +static gboolean +gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, + GtkWebViewToolbar *toolbar) +{ + GtkWidget *menu; + GtkWidget *item; + gboolean wide; + + if (event->button != 3) + return FALSE; + + wide = GTK_WIDGET_VISIBLE(toolbar->bold); + + menu = gtk_menu_new(); + item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items")); + g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(switch_toolbar_view), toolbar); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + gtk_widget_show(item); + + gtk_menu_popup(GTK_MENU(menu), NULL, NULL, pidgin_menu_position_func_helper, + widget, event->button, event->time); + return TRUE; +} + +/* Boring GTK+ stuff */ +static void +gtk_webviewtoolbar_class_init(GtkWebViewToolbarClass *class) +{ + GObjectClass *gobject_class; + gobject_class = (GObjectClass *)class; + parent_class = g_type_class_ref(GTK_TYPE_HBOX); + gobject_class->finalize = gtk_webviewtoolbar_finalize; + + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/toolbar"); + purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", FALSE); +} + +static void +gtk_webviewtoolbar_create_old_buttons(GtkWebViewToolbar *toolbar) +{ + GtkWidget *hbox; + GtkWidget *button; + struct { + char *stock; + gpointer callback; + GtkWidget **button; + const char *tooltip; + } buttons[] = { + {GTK_STOCK_BOLD, G_CALLBACK(do_bold), &toolbar->bold, _("Bold")}, + {GTK_STOCK_ITALIC, do_italic, &toolbar->italic, _("Italic")}, + {GTK_STOCK_UNDERLINE, do_underline, &toolbar->underline, _("Underline")}, + {GTK_STOCK_STRIKETHROUGH, do_strikethrough, &toolbar->strikethrough, _("Strikethrough")}, + {"", NULL, NULL, NULL}, + {PIDGIN_STOCK_TOOLBAR_TEXT_LARGER, do_big, &toolbar->larger_size, _("Increase Font Size")}, + {PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, do_small, &toolbar->smaller_size, _("Decrease Font Size")}, + {"", NULL, NULL, NULL}, + {PIDGIN_STOCK_TOOLBAR_FONT_FACE, toggle_font, &toolbar->font, _("Font Face")}, + {PIDGIN_STOCK_TOOLBAR_FGCOLOR, toggle_fg_color, &toolbar->fgcolor, _("Foreground Color")}, + {PIDGIN_STOCK_TOOLBAR_BGCOLOR, toggle_bg_color, &toolbar->bgcolor, _("Background Color")}, + {"", NULL, NULL, NULL}, + {PIDGIN_STOCK_CLEAR, clear_formatting_cb, &toolbar->clear, _("Reset Formatting")}, + {"", NULL, NULL, NULL}, + {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, + {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, + {"", NULL, NULL, NULL}, + {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, + {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &toolbar->attention, _("Send Attention")}, + {NULL, NULL, NULL, NULL} + }; + int iter; + + hbox = gtk_hbox_new(FALSE, 0); + + for (iter = 0; buttons[iter].stock; iter++) { + if (buttons[iter].stock[0]) { + button = pidgin_pixbuf_toolbar_button_from_stock(buttons[iter].stock); + g_signal_connect(G_OBJECT(button), "button-press-event", G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(buttons[iter].callback), toolbar); + *(buttons[iter].button) = button; + gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL); + } else + button = gtk_vseparator_new(); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + } + + gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); + g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox); +} + +static void +button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) +{ + if (GTK_WIDGET_VISIBLE(button)) + gtk_widget_hide(item); + else + gtk_widget_show(item); +} + +static void +button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) +{ + gtk_widget_set_sensitive(item, GTK_WIDGET_IS_SENSITIVE(button)); +} + +static void +update_menuitem(GtkToggleButton *button, GtkCheckMenuItem *item) +{ + g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button); + gtk_check_menu_item_set_active(item, gtk_toggle_button_get_active(button)); + g_signal_handlers_unblock_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button); +} + +static void +enable_markup(GtkWidget *widget, gpointer null) +{ + if (GTK_IS_LABEL(widget)) + g_object_set(G_OBJECT(widget), "use-markup", TRUE, NULL); +} + +static void +webviewtoolbar_view_pref_changed(const char *name, PurplePrefType type, + gconstpointer value, gpointer toolbar) +{ + if (value) { + gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); + gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); + } else { + gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); + gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); + } +} + +static void +gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) +{ + GtkWidget *hbox = GTK_WIDGET(toolbar), *event = gtk_event_box_new(); + GtkWidget *bbox, *box = gtk_hbox_new(FALSE, 0); + GtkWidget *image; + GtkWidget *label; + GtkWidget *insert_button; + GtkWidget *font_button; + GtkWidget *smiley_button; + GtkWidget *attention_button; + GtkWidget *font_menu; + GtkWidget *insert_menu; + GtkWidget *menuitem; + GtkWidget *sep; + int i; + struct { + const char *label; + GtkWidget **button; + gboolean check; + } buttons[] = { + {_("_Bold"), &toolbar->bold, TRUE}, + {_("_Italic"), &toolbar->italic, TRUE}, + {_("_Underline"), &toolbar->underline, TRUE}, + {_("Strikethrough"), &toolbar->strikethrough, TRUE}, + {_("_Larger"), &toolbar->larger_size, TRUE}, +#if 0 + {_("_Normal"), &toolbar->normal_size, TRUE}, +#endif + {_("_Smaller"), &toolbar->smaller_size, TRUE}, + /* If we want to show the formatting for the following items, we would + * need to update them when formatting changes. The above items don't need + * no updating nor nothin' */ + {_("_Font face"), &toolbar->font, TRUE}, + {_("Foreground _color"), &toolbar->fgcolor, TRUE}, + {_("Bac_kground color"), &toolbar->bgcolor, TRUE}, + {_("_Reset formatting"), &toolbar->clear, FALSE}, + {NULL, NULL, FALSE} + }; + + toolbar->webview = NULL; + toolbar->font_dialog = NULL; + toolbar->fgcolor_dialog = NULL; + toolbar->bgcolor_dialog = NULL; + toolbar->link_dialog = NULL; + toolbar->smiley_dialog = NULL; + toolbar->image_dialog = NULL; + + toolbar->tooltips = gtk_tooltips_new(); + + gtk_box_set_spacing(GTK_BOX(toolbar), 3); + + gtk_webviewtoolbar_create_old_buttons(toolbar); + + /* Fonts */ + font_button = gtk_toggle_button_new(); + gtk_button_set_relief(GTK_BUTTON(font_button), GTK_RELIEF_NONE); + bbox = gtk_hbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(font_button), bbox); + image = gtk_image_new_from_stock(GTK_STOCK_BOLD, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); + gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); + label = gtk_label_new_with_mnemonic(_("_Font")); + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + g_object_set_data(G_OBJECT(hbox), "font_label", label); + gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(box), font_button, FALSE, FALSE, 0); + gtk_widget_show_all(font_button); + + font_menu = gtk_menu_new(); + g_object_set_data(G_OBJECT(toolbar), "font_menu", font_menu); + + for (i = 0; buttons[i].label; i++) { + GtkWidget *old = *buttons[i].button; + if (buttons[i].check) { + menuitem = gtk_check_menu_item_new_with_mnemonic(buttons[i].label); + g_signal_connect_after(G_OBJECT(old), "toggled", + G_CALLBACK(update_menuitem), menuitem); + } else { + menuitem = gtk_menu_item_new_with_mnemonic(buttons[i].label); + } + g_signal_connect_swapped(G_OBJECT(menuitem), "activate", + G_CALLBACK(gtk_button_clicked), old); + gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), menuitem); + g_signal_connect(G_OBJECT(old), "notify::sensitive", + G_CALLBACK(button_sensitiveness_changed), menuitem); + g_signal_connect(G_OBJECT(old), "notify::visible", + G_CALLBACK(button_visibility_changed), menuitem); + gtk_container_foreach(GTK_CONTAINER(menuitem), (GtkCallback)enable_markup, NULL); + } + + g_signal_connect(G_OBJECT(font_button), "button-press-event", G_CALLBACK(button_activate_on_click), toolbar); + g_signal_connect(G_OBJECT(font_button), "activate", G_CALLBACK(pidgin_menu_clicked), font_menu); + g_signal_connect(G_OBJECT(font_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), font_button); + + /* Sep */ + sep = gtk_vseparator_new(); + gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); + gtk_widget_show_all(sep); + + /* Insert */ + insert_button = gtk_toggle_button_new(); + gtk_button_set_relief(GTK_BUTTON(insert_button), GTK_RELIEF_NONE); + bbox = gtk_hbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(insert_button), bbox); + image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_INSERT, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); + gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); + label = gtk_label_new_with_mnemonic(_("_Insert")); + gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(box), insert_button, FALSE, FALSE, 0); + gtk_widget_show_all(insert_button); + + insert_menu = gtk_menu_new(); + g_object_set_data(G_OBJECT(toolbar), "insert_menu", insert_menu); + + menuitem = gtk_menu_item_new_with_mnemonic(_("_Image")); + g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->image); + gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); + g_signal_connect(G_OBJECT(toolbar->image), "notify::sensitive", + G_CALLBACK(button_sensitiveness_changed), menuitem); + g_signal_connect(G_OBJECT(toolbar->image), "notify::visible", + G_CALLBACK(button_visibility_changed), menuitem); + + menuitem = gtk_menu_item_new_with_mnemonic(_("_Link")); + g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->link); + gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); + g_signal_connect(G_OBJECT(toolbar->link), "notify::sensitive", + G_CALLBACK(button_sensitiveness_changed), menuitem); + g_signal_connect(G_OBJECT(toolbar->link), "notify::visible", + G_CALLBACK(button_visibility_changed), menuitem); + + menuitem = gtk_menu_item_new_with_mnemonic(_("_Horizontal rule")); + g_signal_connect(G_OBJECT(menuitem), "activate" , G_CALLBACK(insert_hr_cb), toolbar); + gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); + toolbar->insert_hr = menuitem; + + g_signal_connect(G_OBJECT(insert_button), "button-press-event", G_CALLBACK(button_activate_on_click), toolbar); + g_signal_connect(G_OBJECT(insert_button), "activate", G_CALLBACK(pidgin_menu_clicked), insert_menu); + g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button); + toolbar->sml = NULL; + + /* Sep */ + sep = gtk_vseparator_new(); + gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); + gtk_widget_show_all(sep); + + /* Smiley */ + smiley_button = gtk_button_new(); + gtk_button_set_relief(GTK_BUTTON(smiley_button), GTK_RELIEF_NONE); + bbox = gtk_hbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(smiley_button), bbox); + image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SMILEY, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); + gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); + label = gtk_label_new_with_mnemonic(_("_Smile!")); + gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(box), smiley_button, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(smiley_button), "button-press-event", G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar); + g_signal_connect_swapped(G_OBJECT(smiley_button), "clicked", G_CALLBACK(gtk_button_clicked), toolbar->smiley); + gtk_widget_show_all(smiley_button); + + /* Sep */ + sep = gtk_vseparator_new(); + gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); + gtk_widget_show_all(sep); + + /* Attention */ + attention_button = gtk_button_new(); + gtk_button_set_relief(GTK_BUTTON(attention_button), GTK_RELIEF_NONE); + bbox = gtk_hbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(attention_button), bbox); + image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); + gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); + label = gtk_label_new_with_mnemonic(_("_Attention!")); + gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); + g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", + G_CALLBACK(gtk_button_clicked), toolbar->attention); + gtk_widget_show_all(attention_button); + + g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive", + G_CALLBACK(button_sensitiveness_changed), attention_button); + g_signal_connect(G_OBJECT(toolbar->attention), "notify::visible", + G_CALLBACK(button_visibility_changed), attention_button); + + /* set attention button to be greyed out until we get a conversation */ + gtk_widget_set_sensitive(toolbar->attention, FALSE); + + gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); + g_object_set_data(G_OBJECT(hbox), "lean-view", box); + gtk_widget_show(box); + + purple_prefs_connect_callback(toolbar, PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", + webviewtoolbar_view_pref_changed, toolbar); + g_signal_connect_data(G_OBJECT(toolbar), "realize", + G_CALLBACK(purple_prefs_trigger_callback), PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", + NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED); + + gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), FALSE); + + gtk_widget_add_events(event, GDK_BUTTON_PRESS_MASK); + gtk_box_pack_start(GTK_BOX(hbox), event, TRUE, TRUE, 0); + g_signal_connect(G_OBJECT(event), "button-press-event", G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar); + gtk_widget_show(event); +} + +GtkWidget * +gtk_webviewtoolbar_new(void) +{ + return GTK_WIDGET(g_object_new(gtk_webviewtoolbar_get_type(), NULL)); +} + +GType +gtk_webviewtoolbar_get_type(void) +{ + static GType webviewtoolbar_type = 0; + + if (!webviewtoolbar_type) { + static const GTypeInfo webviewtoolbar_info = { + sizeof(GtkWebViewToolbarClass), + NULL, + NULL, + (GClassInitFunc)gtk_webviewtoolbar_class_init, + NULL, + NULL, + sizeof(GtkWebViewToolbar), + 0, + (GInstanceInitFunc)gtk_webviewtoolbar_init, + NULL + }; + + webviewtoolbar_type = g_type_register_static(GTK_TYPE_HBOX, + "GtkWebViewToolbar", &webviewtoolbar_info, 0); + } + + return webviewtoolbar_type; +} + +void +gtk_webviewtoolbar_attach(GtkWebViewToolbar *toolbar, GtkWidget *webview) +{ + GtkWebViewButtons buttons; + + g_return_if_fail(toolbar != NULL); + g_return_if_fail(GTK_IS_WEBVIEWTOOLBAR(toolbar)); + g_return_if_fail(webview != NULL); + g_return_if_fail(GTK_IS_WEBVIEW(webview)); + + toolbar->webview = webview; + g_signal_connect(G_OBJECT(webview), "format_buttons_update", G_CALLBACK(update_buttons_cb), toolbar); + g_signal_connect_after(G_OBJECT(webview), "format_function_toggle", G_CALLBACK(toggle_button_cb), toolbar); + g_signal_connect_after(G_OBJECT(webview), "format_function_clear", G_CALLBACK(update_format_cb), toolbar); + g_signal_connect(G_OBJECT(webview), "format_function_update", G_CALLBACK(update_format_cb), toolbar); +#if 0 + g_signal_connect_after(G_OBJECT(GTK_WEBVIEW(webview)->text_buffer), "mark-set", G_CALLBACK(mark_set_cb), toolbar); +#endif + + buttons = gtk_webview_get_format_functions(GTK_WEBVIEW(webview)); + update_buttons_cb(GTK_WEBVIEW(webview), buttons, toolbar); + update_buttons(toolbar); +} + +void +gtk_webviewtoolbar_associate_smileys(GtkWebViewToolbar *toolbar, + const char *proto_id) +{ + g_free(toolbar->sml); + toolbar->sml = g_strdup(proto_id); +} + +void +gtk_webviewtoolbar_switch_active_conversation(GtkWebViewToolbar *toolbar, + PurpleConversation *conv) +{ + PurpleConnection *gc = purple_conversation_get_connection(conv); + PurplePlugin *prpl = purple_connection_get_prpl(gc); + + g_object_set_data(G_OBJECT(toolbar), "active_conv", conv); + + /* gray out attention button on protocols that don't support it + for the time being it is always disabled for chats */ + gtk_widget_set_sensitive(toolbar->attention, + conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && + PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); +} + diff --git a/pidgin/gtkwebviewtoolbar.h b/pidgin/gtkwebviewtoolbar.h new file mode 100644 index 0000000000..4eb73c71d6 --- /dev/null +++ b/pidgin/gtkwebviewtoolbar.h @@ -0,0 +1,128 @@ +/* + * GtkWebViewToolbar + * + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * + */ +#ifndef _PIDGINWEBVIEWTOOLBAR_H_ +#define _PIDGINWEBVIEWTOOLBAR_H_ + +#include +#include "gtkwebview.h" + +#define DEFAULT_FONT_FACE "Helvetica 12" + +#define GTK_TYPE_WEBVIEWTOOLBAR (gtk_webviewtoolbar_get_type()) +#define GTK_WEBVIEWTOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_WEBVIEWTOOLBAR, GtkWebViewToolbar)) +#define GTK_WEBVIEWTOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_WEBVIEWTOOLBAR, GtkWebViewToolbarClass)) +#define GTK_IS_WEBVIEWTOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_WEBVIEWTOOLBAR)) +#define GTK_IS_WEBVIEWTOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEWTOOLBAR)) + +typedef struct _GtkWebViewToolbar GtkWebViewToolbar; +typedef struct _GtkWebViewToolbarClass GtkWebViewToolbarClass; + +struct _GtkWebViewToolbar { + GtkHBox box; + + GtkWidget *webview; + + GtkTooltips *tooltips; + + GtkWidget *bold; + GtkWidget *italic; + GtkWidget *underline; + GtkWidget *strikethrough; + GtkWidget *insert_hr; + GtkWidget *call; + + GtkWidget *larger_size; + GtkWidget *normal_size; + GtkWidget *smaller_size; + + GtkWidget *font; + GtkWidget *fgcolor; + GtkWidget *bgcolor; + + GtkWidget *clear; + + GtkWidget *image; + GtkWidget *link; + GtkWidget *smiley; + GtkWidget *attention; + + GtkWidget *font_dialog; + GtkWidget *fgcolor_dialog; + GtkWidget *bgcolor_dialog; + GtkWidget *link_dialog; + GtkWidget *smiley_dialog; + GtkWidget *image_dialog; + + char *sml; +}; + +struct _GtkWebViewToolbarClass { + GtkHBoxClass parent_class; +}; + +G_BEGIN_DECLS + +/** + * Returns the GType for a GtkWebViewToolbar widget + * + * @return The GType for GtkWebViewToolbar widget + */ +GType gtk_webviewtoolbar_get_type(void); + +/** + * Create a new GtkWebViewToolbar object + * + * @return A GtkWidget corresponding to the GtkWebViewToolbar object + */ +GtkWidget *gtk_webviewtoolbar_new(void); + +/** + * Attach a GtkWebViewToolbar object to a GtkWebView + * + * @param toolbar The GtkWebViewToolbar object + * @param webview The GtkWebView object + */ +void gtk_webviewtoolbar_attach(GtkWebViewToolbar *toolbar, GtkWidget *webview); + +/** + * Associate the smileys from a protocol to a GtkWebViewToolbar object + * + * @param toolbar The GtkWebViewToolbar object + * @param proto_id The ID of the protocol from which smileys are associated + */ +void gtk_webviewtoolbar_associate_smileys(GtkWebViewToolbar *toolbar, + const char *proto_id); + +/** + * Switch the active conversation for a GtkWebViewToolbar object + * + * @param toolbar The GtkWebViewToolbar object + * @param conv The new conversation + */ +void gtk_webviewtoolbar_switch_active_conversation(GtkWebViewToolbar *toolbar, + PurpleConversation *conv); + +G_END_DECLS + +#endif /* _PIDGINWEBVIEWTOOLBAR_H_ */ + -- cgit v1.2.1 From e6fe23ec299ec5e12f6c18aa9d5548f470c17cf4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 09:45:10 +0000 Subject: Use a GtkWebViewToolbar when creating an editable GtkWebView. --- pidgin/gtkutils.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index eb2574e51d..81ea812f1b 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -68,6 +68,7 @@ #include "gtkthemes.h" #include "gtkutils.h" #include "gtkwebview.h" +#include "gtkwebviewtoolbar.h" #include "pidgin/minidialog.h" typedef struct { @@ -295,7 +296,7 @@ pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **to gtk_widget_show(vbox); if (editable) { - toolbar = gtk_imhtmltoolbar_new(); + toolbar = gtk_webviewtoolbar_new(); gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); gtk_widget_show(toolbar); @@ -307,10 +308,7 @@ pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **to } webview = gtk_webview_new(); -#if 0 - /* TODO WEBKIT: Don't have editable webview yet. */ gtk_webview_set_editable(GTK_WEBVIEW(webview), editable); -#endif /* if 0 */ #ifdef USE_GTKSPELL if (editable && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck")) pidgin_setup_gtkspell(GTK_TEXT_VIEW(webview)); @@ -318,8 +316,8 @@ pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **to gtk_widget_show(webview); if (editable) { - gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(toolbar), webview); - gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(toolbar), "default"); + gtk_webviewtoolbar_attach(GTK_WEBVIEWTOOLBAR(toolbar), webview); + gtk_webviewtoolbar_associate_smileys(GTK_WEBVIEWTOOLBAR(toolbar), "default"); } sw = pidgin_make_scrollable(webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1); -- cgit v1.2.1 From 23f42b9d585d3ea81d63c1602aca41000b484f45 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 09:46:23 +0000 Subject: Add GtkWebViewToolbar to makefiles. --- pidgin/Makefile.am | 2 ++ pidgin/Makefile.mingw | 1 + 2 files changed, 3 insertions(+) diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am index 043c8196a2..ec1706d967 100644 --- a/pidgin/Makefile.am +++ b/pidgin/Makefile.am @@ -86,6 +86,7 @@ pidgin_SOURCES = \ gtkthemes.c \ gtkutils.c \ gtkwebview.c \ + gtkwebviewtoolbar.c \ gtkwhiteboard.c \ minidialog.c \ pidgintooltip.c \ @@ -140,6 +141,7 @@ pidgin_headers = \ gtkthemes.h \ gtkutils.h \ gtkwebview.h \ + gtkwebviewtoolbar.h \ gtkwhiteboard.h \ minidialog.h \ pidgintooltip.h \ diff --git a/pidgin/Makefile.mingw b/pidgin/Makefile.mingw index 8d407b08e6..fd19ed9a5d 100644 --- a/pidgin/Makefile.mingw +++ b/pidgin/Makefile.mingw @@ -94,6 +94,7 @@ PIDGIN_C_SRC = \ gtkthemes.c \ gtkutils.c \ gtkwebview.c \ + gtkwebviewtoolbar.c \ gtkwhiteboard.c \ minidialog.c \ pidginstock.c \ -- cgit v1.2.1 From 721456e39002d42061ddb88c3e50ad2508880375 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 4 Jan 2012 23:56:07 +0000 Subject: Add a WebView setup function. --- pidgin/gtkutils.c | 27 +++++++++++++++++++++++++++ pidgin/gtkutils.h | 8 ++++++++ 2 files changed, 35 insertions(+) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 81ea812f1b..0dc161521a 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -128,6 +128,32 @@ pidgin_setup_imhtml(GtkWidget *imhtml) } +void +pidgin_setup_webview(GtkWidget *webview) +{ + g_return_if_fail(webview != NULL); + g_return_if_fail(GTK_IS_WEBVIEW(webview)); + +#if 0 +/* TODO: WebKit this stuff... */ + pidgin_themes_smiley_themeize(webview); +#endif + +#ifdef _WIN32 + if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font")) { + WebKitWebSettings *settings = webkit_web_settings_new(); + g_object_set(G_OBJECT(settings), "default-font-size", + purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/font_size"), + NULL); + g_object_set(G_OBJECT(settings), "default-font-family", + purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/custom_font"), + NULL); + + webkit_web_view_set_settings(WEBKIT_WEB_VIEW(webview), settings); + } +#endif +} + static void pidgin_window_init(GtkWindow *wnd, const char *title, guint border_width, const char *role, gboolean resizable) { @@ -319,6 +345,7 @@ pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **to gtk_webviewtoolbar_attach(GTK_WEBVIEWTOOLBAR(toolbar), webview); gtk_webviewtoolbar_associate_smileys(GTK_WEBVIEWTOOLBAR(toolbar), "default"); } + pidgin_setup_webview(webview); sw = pidgin_make_scrollable(webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1); gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); diff --git a/pidgin/gtkutils.h b/pidgin/gtkutils.h index 2999d5fa37..946d5f595a 100644 --- a/pidgin/gtkutils.h +++ b/pidgin/gtkutils.h @@ -106,6 +106,14 @@ void pidgin_setup_imhtml(GtkWidget *imhtml); */ GtkWidget *pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret); +/** + * Sets up a gtkwebview widget, loads it with smileys, and sets the + * default signal handlers. + * + * @param webview The gtkwebview widget to setup. + */ +void pidgin_setup_webview(GtkWidget *webview); + /** * Create an GtkWebView widget and associated GtkIMHtmlToolbar widget. This * function puts both widgets in a nice GtkFrame. They're separated by an -- cgit v1.2.1 From 22d99708206ee5494690da94c4f4a7699e81ac5b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 01:10:12 +0000 Subject: Add a function for setting a WebView entry based on the connection flags. --- pidgin/gtkwebview.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++ pidgin/gtkwebview.h | 8 ++++ 2 files changed, 129 insertions(+) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index c4bda69b74..729e1c7119 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -300,6 +300,33 @@ scroll_idle_cb(gpointer data) return FALSE; } +static void +webview_clear_formatting(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + + if (!webkit_web_view_get_editable(WEBKIT_WEB_VIEW(webview))) + return; + + priv->edit.bold = FALSE; + priv->edit.italic = FALSE; + priv->edit.underline = FALSE; + priv->edit.strike = FALSE; + priv->edit.fontsize = 0; + + g_free(priv->edit.fontface); + priv->edit.fontface = NULL; + + g_free(priv->edit.forecolor); + priv->edit.forecolor = NULL; + + g_free(priv->edit.backcolor); + priv->edit.backcolor = NULL; + + g_free(priv->edit.background); + priv->edit.background = NULL; +} + /****************************************************************************** * GObject Stuff *****************************************************************************/ @@ -527,6 +554,100 @@ gtk_webview_set_editable(GtkWebView *webview, gboolean editable) webkit_web_view_set_editable(WEBKIT_WEB_VIEW(webview), editable); } +void +gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewButtons buttons; + + if (flags & PURPLE_CONNECTION_HTML) { + char color[8]; + GdkColor fg_color, bg_color; + + buttons = GTK_WEBVIEW_ALL; + + if (flags & PURPLE_CONNECTION_NO_BGCOLOR) + buttons &= ~GTK_WEBVIEW_BACKCOLOR; + if (flags & PURPLE_CONNECTION_NO_FONTSIZE) + { + buttons &= ~GTK_WEBVIEW_GROW; + buttons &= ~GTK_WEBVIEW_SHRINK; + } + if (flags & PURPLE_CONNECTION_NO_URLDESC) + buttons &= ~GTK_WEBVIEW_LINKDESC; + + gtk_webview_set_format_functions(webview, GTK_WEBVIEW_ALL); + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold") != priv->edit.bold) + gtk_webview_toggle_bold(webview); + + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic") != priv->edit.italic) + gtk_webview_toggle_italic(webview); + + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline") != priv->edit.underline) + gtk_webview_toggle_underline(webview); + + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_strike") != priv->edit.strike) + gtk_webview_toggle_strike(webview); + + gtk_webview_toggle_fontface(webview, + purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/font_face")); + + if (!(flags & PURPLE_CONNECTION_NO_FONTSIZE)) + { + int size = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/font_size"); + + /* 3 is the default. */ + if (size != 3) + gtk_webview_font_set_size(webview, size); + } + + if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor"), "") != 0) + { + gdk_color_parse(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor"), + &fg_color); + g_snprintf(color, sizeof(color), "#%02x%02x%02x", + fg_color.red / 256, + fg_color.green / 256, + fg_color.blue / 256); + } else + strcpy(color, ""); + + gtk_webview_toggle_forecolor(webview, color); + + if(!(flags & PURPLE_CONNECTION_NO_BGCOLOR) && + strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), "") != 0) + { + gdk_color_parse(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), + &bg_color); + g_snprintf(color, sizeof(color), "#%02x%02x%02x", + bg_color.red / 256, + bg_color.green / 256, + bg_color.blue / 256); + } else + strcpy(color, ""); + + gtk_webview_toggle_background(webview, color); + + if (flags & PURPLE_CONNECTION_FORMATTING_WBFO) + gtk_webview_set_whole_buffer_formatting_only(webview, TRUE); + else + gtk_webview_set_whole_buffer_formatting_only(webview, FALSE); + } else { + buttons = GTK_WEBVIEW_SMILEY | GTK_WEBVIEW_IMAGE; + webview_clear_formatting(webview); + } + + if (flags & PURPLE_CONNECTION_NO_IMAGES) + buttons &= ~GTK_WEBVIEW_IMAGE; + + if (flags & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) + buttons |= GTK_WEBVIEW_CUSTOM_SMILEY; + else + buttons &= ~GTK_WEBVIEW_CUSTOM_SMILEY; + + gtk_webview_set_format_functions(webview, buttons); +} + void gtk_webview_set_whole_buffer_formatting_only(GtkWebView *webview, gboolean wbfo) { diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 4642609176..84b90f74f5 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -178,6 +178,14 @@ void gtk_webview_page_down(GtkWebView *webview); */ void gtk_webview_set_editable(GtkWebView *webview, gboolean editable); +/** + * Setup formatting for a GtkWebView depending on the flags specified. + * + * @param webview The GtkWebView. + * @param flags The connection flags describing the allowed formatting. + */ +void gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags); + /** * Enables or disables whole buffer formatting only (wbfo) in a GtkWebView. * In this mode formatting options to the buffer take effect for the entire -- cgit v1.2.1 From f93acf467e169c2d899db87d8b64086c126479c0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 05:59:21 +0000 Subject: Add some formatting signals to webview from imhtml. --- pidgin/gtkwebview.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++- pidgin/gtkwebview.h | 5 +++ 2 files changed, 103 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 729e1c7119..66ea78430f 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -28,6 +28,7 @@ #include "internal.h" #include "pidgin.h" +#include #include "gtkwebview.h" #define MAX_FONT_SIZE 7 @@ -37,6 +38,15 @@ #define GTK_WEBVIEW_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_WEBVIEW, GtkWebViewPriv)) +enum { + BUTTONS_UPDATE, + TOGGLE_FORMAT, + CLEAR_FORMAT, + UPDATE_FORMAT, + LAST_SIGNAL +}; +static guint signals[LAST_SIGNAL] = { 0 }; + /****************************************************************************** * Structs *****************************************************************************/ @@ -327,6 +337,37 @@ webview_clear_formatting(GtkWebView *webview) priv->edit.background = NULL; } +static void +webview_toggle_format(GtkWebView *webview, GtkWebViewButtons buttons) +{ + /* since this function is the handler for the formatting keystrokes, + we need to check here that the formatting attempted is permitted */ + buttons &= gtk_webview_get_format_functions(webview); + + switch (buttons) { + case GTK_WEBVIEW_BOLD: + gtk_webview_toggle_bold(webview); + break; + case GTK_WEBVIEW_ITALIC: + gtk_webview_toggle_italic(webview); + break; + case GTK_WEBVIEW_UNDERLINE: + gtk_webview_toggle_underline(webview); + break; + case GTK_WEBVIEW_STRIKE: + gtk_webview_toggle_strike(webview); + break; + case GTK_WEBVIEW_SHRINK: + gtk_webview_font_shrink(webview); + break; + case GTK_WEBVIEW_GROW: + gtk_webview_font_grow(webview); + break; + default: + break; + } +} + /****************************************************************************** * GObject Stuff *****************************************************************************/ @@ -356,11 +397,67 @@ gtk_webview_finalize(GObject *webview) static void gtk_webview_class_init(GtkWebViewClass *klass, gpointer userdata) { + GObjectClass *gobject_class; + GtkBindingSet *binding_set; + parent_class = g_type_class_ref(webkit_web_view_get_type()); + gobject_class = G_OBJECT_CLASS(klass); g_type_class_add_private(klass, sizeof(GtkWebViewPriv)); - G_OBJECT_CLASS(klass)->finalize = gtk_webview_finalize; + signals[BUTTONS_UPDATE] = g_signal_new("allowed-formats-updated", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(GtkWebViewClass, buttons_update), + NULL, 0, g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, G_TYPE_INT); + signals[TOGGLE_FORMAT] = g_signal_new("format-toggled", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET(GtkWebViewClass, toggle_format), + NULL, 0, g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, G_TYPE_INT); + signals[CLEAR_FORMAT] = g_signal_new("format-cleared", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET(GtkWebViewClass, clear_format), + NULL, 0, g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + signals[UPDATE_FORMAT] = g_signal_new("format-updated", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(GtkWebViewClass, update_format), + NULL, 0, g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + klass->toggle_format = webview_toggle_format; + klass->clear_format = webview_clear_formatting; + + gobject_class->finalize = gtk_webview_finalize; + + binding_set = gtk_binding_set_by_class(parent_class); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_b, GDK_CONTROL_MASK, + "format-toggled", 1, G_TYPE_INT, + GTK_WEBVIEW_BOLD); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_i, GDK_CONTROL_MASK, + "format-toggled", 1, G_TYPE_INT, + GTK_WEBVIEW_ITALIC); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_u, GDK_CONTROL_MASK, + "format-toggled", 1, G_TYPE_INT, + GTK_WEBVIEW_UNDERLINE); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_plus, GDK_CONTROL_MASK, + "format-toggled", 1, G_TYPE_INT, + GTK_WEBVIEW_GROW); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_equal, GDK_CONTROL_MASK, + "format-toggled", 1, G_TYPE_INT, + GTK_WEBVIEW_GROW); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_minus, GDK_CONTROL_MASK, + "format-toggled", 1, G_TYPE_INT, + GTK_WEBVIEW_SHRINK); + + binding_set = gtk_binding_set_by_class(klass); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_r, GDK_CONTROL_MASK, + "format-cleared", 0); } static void diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 84b90f74f5..bcfafa68db 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -70,6 +70,11 @@ struct _GtkWebView struct _GtkWebViewClass { WebKitWebViewClass parent; + + void (*buttons_update)(GtkWebView *, GtkWebViewButtons); + void (*toggle_format)(GtkWebView *, GtkWebViewButtons); + void (*clear_format)(GtkWebView *); + void (*update_format)(GtkWebView *); }; G_BEGIN_DECLS -- cgit v1.2.1 From a21b78eb05076ec8df8ccbcf8c89e4a806b1c742 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 06:11:04 +0000 Subject: Emit the allowed-formats-updated signal when the set_format_functions function is called. --- pidgin/gtkwebview.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 66ea78430f..4bf262581e 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -756,7 +756,10 @@ void gtk_webview_set_format_functions(GtkWebView *webview, GtkWebViewButtons buttons) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GObject *object = g_object_ref(G_OBJECT(webview)); priv->format_functions = buttons; + g_signal_emit(object, signals[BUTTONS_UPDATE], 0, buttons); + g_object_unref(object); } GtkWebViewButtons -- cgit v1.2.1 From 1335b9f0600de2163efb26ae6a3155eb1b00be66 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 06:30:29 +0000 Subject: Emit the format-cleared signal when the webview format is cleared. --- pidgin/gtkwebview.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 4bf262581e..e65fec232c 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -829,11 +829,14 @@ gtk_webview_get_editable(GtkWebView *webview) void gtk_webview_clear_formatting(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - priv->edit.bold = FALSE; - priv->edit.italic = FALSE; - priv->edit.underline = FALSE; - priv->edit.strike = FALSE; + GObject *object; + + object = g_object_ref(G_OBJECT(webview)); + g_signal_emit(object, signals[CLEAR_FORMAT], 0); + + gtk_widget_grab_focus(GTK_WIDGET(webview)); + + g_object_unref(object); } void -- cgit v1.2.1 From c73eea0f53a72e24d1fb7352808f22e6bc476337 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 08:04:26 +0000 Subject: Update the signals in the GtkWebViewToolbar. --- pidgin/gtkwebviewtoolbar.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index 29c523012a..4b9b34f978 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -1588,10 +1588,14 @@ gtk_webviewtoolbar_attach(GtkWebViewToolbar *toolbar, GtkWidget *webview) g_return_if_fail(GTK_IS_WEBVIEW(webview)); toolbar->webview = webview; - g_signal_connect(G_OBJECT(webview), "format_buttons_update", G_CALLBACK(update_buttons_cb), toolbar); - g_signal_connect_after(G_OBJECT(webview), "format_function_toggle", G_CALLBACK(toggle_button_cb), toolbar); - g_signal_connect_after(G_OBJECT(webview), "format_function_clear", G_CALLBACK(update_format_cb), toolbar); - g_signal_connect(G_OBJECT(webview), "format_function_update", G_CALLBACK(update_format_cb), toolbar); + g_signal_connect(G_OBJECT(webview), "allowed-formats-updated", + G_CALLBACK(update_buttons_cb), toolbar); + g_signal_connect_after(G_OBJECT(webview), "format-toggled", + G_CALLBACK(toggle_button_cb), toolbar); + g_signal_connect_after(G_OBJECT(webview), "format-cleared", + G_CALLBACK(update_format_cb), toolbar); + g_signal_connect(G_OBJECT(webview), "format-updated", + G_CALLBACK(update_format_cb), toolbar); #if 0 g_signal_connect_after(G_OBJECT(GTK_WEBVIEW(webview)->text_buffer), "mark-set", G_CALLBACK(mark_set_cb), toolbar); #endif -- cgit v1.2.1 From f384d3329fc496ae45d0f58919dbc530df5fe804 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 08:14:09 +0000 Subject: Re-arrange things a bit. --- pidgin/gtkwebviewtoolbar.c | 172 ++++++++++++++++++++++++--------------------- 1 file changed, 93 insertions(+), 79 deletions(-) diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index 4b9b34f978..e7a92f7a2f 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -43,8 +43,16 @@ #include +/****************************************************************************** + * Globals + *****************************************************************************/ + static GtkHBoxClass *parent_class = NULL; +/****************************************************************************** + * Prototypes + *****************************************************************************/ + static void toggle_button_set_active_block(GtkToggleButton *button, gboolean is_active, GtkWebViewToolbar *toolbar); @@ -53,6 +61,10 @@ static gboolean gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, GtkWebViewToolbar *toolbar); +/****************************************************************************** + * Helpers + *****************************************************************************/ + static void do_bold(GtkWidget *bold, GtkWebViewToolbar *toolbar) { @@ -1147,10 +1159,83 @@ pidgin_menu_deactivate(GtkWidget *menu, GtkToggleButton *button) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); } -enum { - LAST_SIGNAL -}; -/* static guint signals [LAST_SIGNAL] = { 0 }; */ +static void +switch_toolbar_view(GtkWidget *item, GtkWebViewToolbar *toolbar) +{ + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", + !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide")); +} + +static gboolean +gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, + GtkWebViewToolbar *toolbar) +{ + GtkWidget *menu; + GtkWidget *item; + gboolean wide; + + if (event->button != 3) + return FALSE; + + wide = GTK_WIDGET_VISIBLE(toolbar->bold); + + menu = gtk_menu_new(); + item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items")); + g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(switch_toolbar_view), toolbar); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + gtk_widget_show(item); + + gtk_menu_popup(GTK_MENU(menu), NULL, NULL, pidgin_menu_position_func_helper, + widget, event->button, event->time); + return TRUE; +} + +static void +button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) +{ + if (GTK_WIDGET_VISIBLE(button)) + gtk_widget_hide(item); + else + gtk_widget_show(item); +} + +static void +button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) +{ + gtk_widget_set_sensitive(item, GTK_WIDGET_IS_SENSITIVE(button)); +} + +static void +update_menuitem(GtkToggleButton *button, GtkCheckMenuItem *item) +{ + g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button); + gtk_check_menu_item_set_active(item, gtk_toggle_button_get_active(button)); + g_signal_handlers_unblock_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button); +} + +static void +enable_markup(GtkWidget *widget, gpointer null) +{ + if (GTK_IS_LABEL(widget)) + g_object_set(G_OBJECT(widget), "use-markup", TRUE, NULL); +} + +static void +webviewtoolbar_view_pref_changed(const char *name, PurplePrefType type, + gconstpointer value, gpointer toolbar) +{ + if (value) { + gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); + gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); + } else { + gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); + gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); + } +} + +/****************************************************************************** + * GObject stuff + *****************************************************************************/ static void gtk_webviewtoolbar_finalize(GObject *object) @@ -1200,38 +1285,6 @@ gtk_webviewtoolbar_finalize(GObject *object) G_OBJECT_CLASS(parent_class)->finalize (object); } -static void -switch_toolbar_view(GtkWidget *item, GtkWebViewToolbar *toolbar) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", - !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide")); -} - -static gboolean -gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, - GtkWebViewToolbar *toolbar) -{ - GtkWidget *menu; - GtkWidget *item; - gboolean wide; - - if (event->button != 3) - return FALSE; - - wide = GTK_WIDGET_VISIBLE(toolbar->bold); - - menu = gtk_menu_new(); - item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items")); - g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(switch_toolbar_view), toolbar); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show(item); - - gtk_menu_popup(GTK_MENU(menu), NULL, NULL, pidgin_menu_position_func_helper, - widget, event->button, event->time); - return TRUE; -} - -/* Boring GTK+ stuff */ static void gtk_webviewtoolbar_class_init(GtkWebViewToolbarClass *class) { @@ -1297,49 +1350,6 @@ gtk_webviewtoolbar_create_old_buttons(GtkWebViewToolbar *toolbar) g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox); } -static void -button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) -{ - if (GTK_WIDGET_VISIBLE(button)) - gtk_widget_hide(item); - else - gtk_widget_show(item); -} - -static void -button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) -{ - gtk_widget_set_sensitive(item, GTK_WIDGET_IS_SENSITIVE(button)); -} - -static void -update_menuitem(GtkToggleButton *button, GtkCheckMenuItem *item) -{ - g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button); - gtk_check_menu_item_set_active(item, gtk_toggle_button_get_active(button)); - g_signal_handlers_unblock_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button); -} - -static void -enable_markup(GtkWidget *widget, gpointer null) -{ - if (GTK_IS_LABEL(widget)) - g_object_set(G_OBJECT(widget), "use-markup", TRUE, NULL); -} - -static void -webviewtoolbar_view_pref_changed(const char *name, PurplePrefType type, - gconstpointer value, gpointer toolbar) -{ - if (value) { - gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); - gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); - } else { - gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); - gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); - } -} - static void gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) { @@ -1545,6 +1555,10 @@ gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) gtk_widget_show(event); } +/****************************************************************************** + * Public API + *****************************************************************************/ + GtkWidget * gtk_webviewtoolbar_new(void) { -- cgit v1.2.1 From 7a660a443f690af3b2118a799dea2cf76e22df18 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 08:26:15 +0000 Subject: Add missing macro. --- pidgin/gtkwebviewtoolbar.h | 1 + 1 file changed, 1 insertion(+) diff --git a/pidgin/gtkwebviewtoolbar.h b/pidgin/gtkwebviewtoolbar.h index 4eb73c71d6..783653b584 100644 --- a/pidgin/gtkwebviewtoolbar.h +++ b/pidgin/gtkwebviewtoolbar.h @@ -33,6 +33,7 @@ #define GTK_WEBVIEWTOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_WEBVIEWTOOLBAR, GtkWebViewToolbarClass)) #define GTK_IS_WEBVIEWTOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_WEBVIEWTOOLBAR)) #define GTK_IS_WEBVIEWTOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEWTOOLBAR)) +#define GTK_WEBVIEWTOOLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_WEBVIEWTOOLBAR, GtkWebViewToolbarClass)) typedef struct _GtkWebViewToolbar GtkWebViewToolbar; typedef struct _GtkWebViewToolbarClass GtkWebViewToolbarClass; -- cgit v1.2.1 From c18f2d9a9d869c12405ab66ff7e76fbd783686d5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 08:55:56 +0000 Subject: Move all internal toolbar pointers into a private struct. --- pidgin/gtkwebviewtoolbar.c | 372 +++++++++++++++++++++++++++------------------ pidgin/gtkwebviewtoolbar.h | 33 ---- 2 files changed, 227 insertions(+), 178 deletions(-) diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index e7a92f7a2f..b3f4603196 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -43,6 +43,48 @@ #include +#define GTK_WEBVIEWTOOLBAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_WEBVIEWTOOLBAR, GtkWebViewToolbarPriv)) + +/****************************************************************************** + * Structs + *****************************************************************************/ + +typedef struct _GtkWebViewToolbarPriv { + GtkTooltips *tooltips; + + GtkWidget *bold; + GtkWidget *italic; + GtkWidget *underline; + GtkWidget *strike; + GtkWidget *insert_hr; + GtkWidget *call; + + GtkWidget *larger_size; + GtkWidget *normal_size; + GtkWidget *smaller_size; + + GtkWidget *font; + GtkWidget *fgcolor; + GtkWidget *bgcolor; + + GtkWidget *clear; + + GtkWidget *image; + GtkWidget *link; + GtkWidget *smiley; + GtkWidget *attention; + + GtkWidget *font_dialog; + GtkWidget *fgcolor_dialog; + GtkWidget *bgcolor_dialog; + GtkWidget *link_dialog; + GtkWidget *smiley_dialog; + GtkWidget *image_dialog; + + char *sml; +} GtkWebViewToolbarPriv; + /****************************************************************************** * Globals *****************************************************************************/ @@ -121,23 +163,27 @@ static gboolean destroy_toolbar_font(GtkWidget *widget, GdkEvent *event, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + if (widget != NULL) gtk_webview_toggle_fontface(GTK_WEBVIEW(toolbar->webview), ""); - if (toolbar->font_dialog != NULL) + if (priv->font_dialog != NULL) { - gtk_widget_destroy(toolbar->font_dialog); - toolbar->font_dialog = NULL; + gtk_widget_destroy(priv->font_dialog); + priv->font_dialog = NULL; } + return FALSE; } static void realize_toolbar_font(GtkWidget *widget, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); GtkFontSelection *sel; - sel = GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->fontsel); + sel = GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(priv->font_dialog)->fontsel); gtk_widget_hide_all(gtk_widget_get_parent(sel->size_entry)); gtk_widget_show_all(sel->family_list); gtk_widget_show(gtk_widget_get_parent(sel->family_list)); @@ -181,39 +227,42 @@ apply_font(GtkWidget *widget, GtkFontSelectionDialog *fontsel) static void toggle_font(GtkWidget *font, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv; g_return_if_fail(toolbar); + priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) { const char *fontname = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); - if (!toolbar->font_dialog) { - toolbar->font_dialog = gtk_font_selection_dialog_new(_("Select Font")); + if (!priv->font_dialog) { + priv->font_dialog = gtk_font_selection_dialog_new(_("Select Font")); - g_object_set_data(G_OBJECT(toolbar->font_dialog), "purple_toolbar", toolbar); + g_object_set_data(G_OBJECT(priv->font_dialog), "purple_toolbar", toolbar); if (fontname) { char *fonttif = g_strdup_printf("%s 12", fontname); - gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog), + gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(priv->font_dialog), fonttif); g_free(fonttif); } else { - gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog), + gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(priv->font_dialog), DEFAULT_FONT_FACE); } - g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event", + g_signal_connect(G_OBJECT(priv->font_dialog), "delete_event", G_CALLBACK(destroy_toolbar_font), toolbar); - g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->ok_button), "clicked", - G_CALLBACK(apply_font), toolbar->font_dialog); - g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->cancel_button), "clicked", + g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(priv->font_dialog)->ok_button), "clicked", + G_CALLBACK(apply_font), priv->font_dialog); + g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(priv->font_dialog)->cancel_button), "clicked", G_CALLBACK(cancel_toolbar_font), toolbar); - g_signal_connect_after(G_OBJECT(toolbar->font_dialog), "realize", + g_signal_connect_after(G_OBJECT(priv->font_dialog), "realize", G_CALLBACK(realize_toolbar_font), toolbar); } - gtk_window_present(GTK_WINDOW(toolbar->font_dialog)); + gtk_window_present(GTK_WINDOW(priv->font_dialog)); } else { cancel_toolbar_font(font, toolbar); } + gtk_widget_grab_focus(toolbar->webview); } @@ -221,14 +270,17 @@ static gboolean destroy_toolbar_fgcolor(GtkWidget *widget, GdkEvent *event, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + if (widget != NULL) gtk_webview_toggle_forecolor(GTK_WEBVIEW(toolbar->webview), ""); - if (toolbar->fgcolor_dialog != NULL) + if (priv->fgcolor_dialog != NULL) { - gtk_widget_destroy(toolbar->fgcolor_dialog); - toolbar->fgcolor_dialog = NULL; + gtk_widget_destroy(priv->fgcolor_dialog); + priv->fgcolor_dialog = NULL; } + return FALSE; } @@ -260,15 +312,16 @@ do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) static void toggle_fg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { GtkWidget *colorsel; GdkColor fgcolor; const char *color = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); - if (!toolbar->fgcolor_dialog) { + if (!priv->fgcolor_dialog) { - toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); - colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel; + priv->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); + colorsel = GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog)->colorsel; if (color) { gdk_color_parse(color, &fgcolor); gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor); @@ -276,17 +329,18 @@ toggle_fg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); - g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event", + g_signal_connect(G_OBJECT(priv->fgcolor_dialog), "delete_event", G_CALLBACK(destroy_toolbar_fgcolor), toolbar); - g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->ok_button), "clicked", + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog)->ok_button), "clicked", G_CALLBACK(do_fgcolor), colorsel); - g_signal_connect(G_OBJECT (GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->cancel_button), "clicked", + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog)->cancel_button), "clicked", G_CALLBACK(cancel_toolbar_fgcolor), toolbar); } - gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog)); + gtk_window_present(GTK_WINDOW(priv->fgcolor_dialog)); } else { cancel_toolbar_fgcolor(color, toolbar); } + gtk_widget_grab_focus(toolbar->webview); } @@ -294,6 +348,7 @@ static gboolean destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); if (widget != NULL) { #if 0 if (gtk_text_buffer_get_selection_bounds(GTK_WEBVIEW(toolbar->webview)->text_buffer, NULL, NULL)) @@ -303,11 +358,12 @@ destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event, gtk_webview_toggle_background(GTK_WEBVIEW(toolbar->webview), ""); } - if (toolbar->bgcolor_dialog != NULL) + if (priv->bgcolor_dialog != NULL) { - gtk_widget_destroy(toolbar->bgcolor_dialog); - toolbar->bgcolor_dialog = NULL; + gtk_widget_destroy(priv->bgcolor_dialog); + priv->bgcolor_dialog = NULL; } + return FALSE; } @@ -344,15 +400,16 @@ do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) static void toggle_bg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { GtkWidget *colorsel; GdkColor bgcolor; const char *color = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); - if (!toolbar->bgcolor_dialog) { + if (!priv->bgcolor_dialog) { - toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); - colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel; + priv->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); + colorsel = GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog)->colorsel; if (color) { gdk_color_parse(color, &bgcolor); gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor); @@ -360,49 +417,54 @@ toggle_bg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); - g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event", + g_signal_connect(G_OBJECT(priv->bgcolor_dialog), "delete_event", G_CALLBACK(destroy_toolbar_bgcolor), toolbar); - g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->ok_button), "clicked", + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog)->ok_button), "clicked", G_CALLBACK(do_bgcolor), colorsel); - g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->cancel_button), "clicked", + g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog)->cancel_button), "clicked", G_CALLBACK(cancel_toolbar_bgcolor), toolbar); } - gtk_window_present(GTK_WINDOW(toolbar->bgcolor_dialog)); + gtk_window_present(GTK_WINDOW(priv->bgcolor_dialog)); } else { cancel_toolbar_bgcolor(color, toolbar); } + gtk_widget_grab_focus(toolbar->webview); } static void clear_formatting_cb(GtkWidget *clear, GtkWebViewToolbar *toolbar) { - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->clear), FALSE, toolbar); + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->clear), FALSE, toolbar); gtk_webview_clear_formatting(GTK_WEBVIEW(toolbar->webview)); } static void cancel_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE); + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->link), FALSE); - toolbar->link_dialog = NULL; + priv->link_dialog = NULL; } static void close_link_dialog(GtkWebViewToolbar *toolbar) { - if (toolbar->link_dialog != NULL) + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + if (priv->link_dialog != NULL) { - purple_request_close(PURPLE_REQUEST_FIELDS, toolbar->link_dialog); - toolbar->link_dialog = NULL; + purple_request_close(PURPLE_REQUEST_FIELDS, priv->link_dialog); + priv->link_dialog = NULL; } } static void do_insert_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); const char *url, *description; url = purple_request_fields_get_string(fields, "url"); @@ -420,15 +482,16 @@ do_insert_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields) url, description); #endif - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->link), FALSE); - toolbar->link_dialog = NULL; + priv->link_dialog = NULL; } static void insert_link_cb(GtkWidget *w, GtkWebViewToolbar *toolbar) { - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->link))) { PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field; @@ -464,7 +527,7 @@ insert_link_cb(GtkWidget *w, GtkWebViewToolbar *toolbar) "link that you want to insert.")); } - toolbar->link_dialog = + priv->link_dialog = purple_request_fields(toolbar, _("Insert Link"), NULL, msg, @@ -478,6 +541,7 @@ insert_link_cb(GtkWidget *w, GtkWebViewToolbar *toolbar) } else { close_link_dialog(toolbar); } + gtk_widget_grab_focus(toolbar->webview); } @@ -499,7 +563,8 @@ insert_hr_cb(GtkWidget *widget, GtkWebViewToolbar *toolbar) static void do_insert_image_cb(GtkWidget *widget, int response, GtkWebViewToolbar *toolbar) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE); #if 0 gchar *filename, *name, *buf; char *filedata; @@ -511,19 +576,19 @@ do_insert_image_cb(GtkWidget *widget, int response, GtkWebViewToolbar *toolbar) if (response != GTK_RESPONSE_ACCEPT) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE); return; } filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); if (filename == NULL) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE); return; } /* The following triggers a callback that closes the widget */ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE); if (!g_file_get_contents(filename, &filedata, &size, &error)) { purple_notify_error(NULL, NULL, error->message, NULL); @@ -561,9 +626,10 @@ do_insert_image_cb(GtkWidget *widget, int response, GtkWebViewToolbar *toolbar) static void insert_image_cb(GtkWidget *save, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); GtkWidget *window; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->image))) { + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->image))) { window = gtk_file_chooser_dialog_new(_("Insert Image"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN, @@ -575,10 +641,10 @@ insert_image_cb(GtkWidget *save, GtkWebViewToolbar *toolbar) "response", G_CALLBACK(do_insert_image_cb), toolbar); gtk_widget_show(window); - toolbar->image_dialog = window; + priv->image_dialog = window; } else { - gtk_widget_destroy(toolbar->image_dialog); - toolbar->image_dialog = NULL; + gtk_widget_destroy(priv->image_dialog); + priv->image_dialog = NULL; } gtk_widget_grab_focus(toolbar->webview); @@ -588,17 +654,19 @@ insert_image_cb(GtkWidget *save, GtkWebViewToolbar *toolbar) static void destroy_smiley_dialog(GtkWebViewToolbar *toolbar) { - if (toolbar->smiley_dialog != NULL) + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + if (priv->smiley_dialog != NULL) { - gtk_widget_destroy(toolbar->smiley_dialog); - toolbar->smiley_dialog = NULL; + gtk_widget_destroy(priv->smiley_dialog); + priv->smiley_dialog = NULL; } } static gboolean close_smiley_dialog(GtkWebViewToolbar *toolbar) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smiley), FALSE); + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->smiley), FALSE); return FALSE; } @@ -606,6 +674,7 @@ close_smiley_dialog(GtkWebViewToolbar *toolbar) static void insert_smiley_text(GtkWidget *widget, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); char *smiley_text, *escaped_smiley; smiley_text = g_object_get_data(G_OBJECT(widget), "smiley_text"); @@ -632,6 +701,7 @@ static struct smiley_button_list * sort_smileys(struct smiley_button_list *ls, GtkWebViewToolbar *toolbar, int *width, const GtkIMHtmlSmiley *smiley) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); GtkWidget *image; GtkWidget *button; GtkRequisition size; @@ -685,7 +755,7 @@ sort_smileys(struct smiley_button_list *ls, GtkWebViewToolbar *toolbar, g_object_set_data(G_OBJECT(button), "smiley_text", face); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar); - gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL); + gtk_tooltips_set_tip(priv->tooltips, button, face, NULL); /* these look really weird with borders */ gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); @@ -699,7 +769,7 @@ sort_smileys(struct smiley_button_list *ls, GtkWebViewToolbar *toolbar, g_snprintf(tip, sizeof(tip), _("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"), face); - gtk_tooltips_set_tip(toolbar->tooltips, button, tip, NULL); + gtk_tooltips_set_tip(priv->tooltips, button, tip, NULL); gtk_widget_set_sensitive(button, FALSE); } else if (psmiley) { /* Remove the button if the smiley is destroyed */ @@ -729,6 +799,7 @@ sort_smileys(struct smiley_button_list *ls, GtkWebViewToolbar *toolbar, static gboolean smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); while (list) { GtkIMHtmlSmiley *cur = (GtkIMHtmlSmiley *) list->data; if (!strcmp(cur->file, smiley->file)) @@ -785,6 +856,7 @@ static void insert_smiley_cb(GtkWidget *smiley, GtkWebViewToolbar *toolbar) { #if 0 + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); GtkWidget *dialog, *vbox; GtkWidget *smiley_table = NULL; GSList *smileys, *unique_smileys = NULL; @@ -799,8 +871,8 @@ insert_smiley_cb(GtkWidget *smiley, GtkWebViewToolbar *toolbar) return; } - if (toolbar->sml) - smileys = pidgin_themes_get_proto_smileys(toolbar->sml); + if (priv->sml) + smileys = pidgin_themes_get_proto_smileys(priv->sml); else smileys = pidgin_themes_get_proto_smileys(NULL); @@ -924,7 +996,7 @@ insert_smiley_cb(GtkWidget *smiley, GtkWebViewToolbar *toolbar) winpidgin_ensure_onscreen(dialog); #endif - toolbar->smiley_dialog = dialog; + priv->smiley_dialog = dialog; gtk_widget_grab_focus(toolbar->webview); #endif @@ -947,19 +1019,20 @@ static void update_buttons_cb(GtkWebView *webview, GtkWebViewButtons buttons, GtkWebViewToolbar *toolbar) { - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bold), buttons & GTK_WEBVIEW_BOLD); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->italic), buttons & GTK_WEBVIEW_ITALIC); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->underline), buttons & GTK_WEBVIEW_UNDERLINE); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->strikethrough), buttons & GTK_WEBVIEW_STRIKE); + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + gtk_widget_set_sensitive(GTK_WIDGET(priv->bold), buttons & GTK_WEBVIEW_BOLD); + gtk_widget_set_sensitive(GTK_WIDGET(priv->italic), buttons & GTK_WEBVIEW_ITALIC); + gtk_widget_set_sensitive(GTK_WIDGET(priv->underline), buttons & GTK_WEBVIEW_UNDERLINE); + gtk_widget_set_sensitive(GTK_WIDGET(priv->strike), buttons & GTK_WEBVIEW_STRIKE); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->larger_size), buttons & GTK_WEBVIEW_GROW); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->smaller_size), buttons & GTK_WEBVIEW_SHRINK); + gtk_widget_set_sensitive(GTK_WIDGET(priv->larger_size), buttons & GTK_WEBVIEW_GROW); + gtk_widget_set_sensitive(GTK_WIDGET(priv->smaller_size), buttons & GTK_WEBVIEW_SHRINK); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->font), buttons & GTK_WEBVIEW_FACE); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->fgcolor), buttons & GTK_WEBVIEW_FORECOLOR); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->bgcolor), buttons & GTK_WEBVIEW_BACKCOLOR); + gtk_widget_set_sensitive(GTK_WIDGET(priv->font), buttons & GTK_WEBVIEW_FACE); + gtk_widget_set_sensitive(GTK_WIDGET(priv->fgcolor), buttons & GTK_WEBVIEW_FORECOLOR); + gtk_widget_set_sensitive(GTK_WIDGET(priv->bgcolor), buttons & GTK_WEBVIEW_BACKCOLOR); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->clear), + gtk_widget_set_sensitive(GTK_WIDGET(priv->clear), (buttons & GTK_WEBVIEW_BOLD || buttons & GTK_WEBVIEW_ITALIC || buttons & GTK_WEBVIEW_UNDERLINE || @@ -970,9 +1043,9 @@ update_buttons_cb(GtkWebView *webview, GtkWebViewButtons buttons, buttons & GTK_WEBVIEW_FORECOLOR || buttons & GTK_WEBVIEW_BACKCOLOR)); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->image), buttons & GTK_WEBVIEW_IMAGE); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->link), buttons & GTK_WEBVIEW_LINK); - gtk_widget_set_sensitive(GTK_WIDGET(toolbar->smiley), buttons & GTK_WEBVIEW_SMILEY); + gtk_widget_set_sensitive(GTK_WIDGET(priv->image), buttons & GTK_WEBVIEW_IMAGE); + gtk_widget_set_sensitive(GTK_WIDGET(priv->link), buttons & GTK_WEBVIEW_LINK); + gtk_widget_set_sensitive(GTK_WIDGET(priv->smiley), buttons & GTK_WEBVIEW_SMILEY); } /* we call this when we want to _set_active the toggle button, it'll @@ -998,6 +1071,7 @@ toggle_button_set_active_block(GtkToggleButton *button, gboolean is_active, static void update_buttons(GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); gboolean bold, italic, underline, strike; const char *tmp; const char *tmp2; @@ -1008,22 +1082,22 @@ update_buttons(GtkWebViewToolbar *toolbar) gtk_webview_get_current_format(GTK_WEBVIEW(toolbar->webview), &bold, &italic, &underline, &strike); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->bold)) != bold) - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bold), bold, + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->bold)) != bold) + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->bold), bold, toolbar); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->italic)) != italic) - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->italic), italic, + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->italic)) != italic) + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->italic), italic, toolbar); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->underline)) != underline) - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->underline), + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->underline)) != underline) + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->underline), underline, toolbar); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->strikethrough)) != strike) - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->strikethrough), + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->strike)) != strike) + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->strike), strike, toolbar); /* These buttons aren't ever "active". */ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smaller_size), FALSE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->larger_size), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->smaller_size), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->larger_size), FALSE); if (bold) { gchar *markup = g_strdup_printf("%s", @@ -1051,7 +1125,7 @@ update_buttons(GtkWebViewToolbar *toolbar) } tmp = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->font), + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->font), (tmp != NULL), toolbar); if (tmp != NULL) { gchar *markup = g_strdup_printf("%s", @@ -1061,7 +1135,7 @@ update_buttons(GtkWebViewToolbar *toolbar) } tmp = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->fgcolor), + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->fgcolor), (tmp != NULL), toolbar); if (tmp != NULL) { gchar *markup = g_strdup_printf("%s", @@ -1072,7 +1146,7 @@ update_buttons(GtkWebViewToolbar *toolbar) tmp = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); tmp2 = gtk_webview_get_current_background(GTK_WEBVIEW(toolbar->webview)); - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->bgcolor), + toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->bgcolor), (tmp != NULL || tmp2 != NULL), toolbar); if (tmp != NULL) { gchar *markup = g_strdup_printf("%s", @@ -1170,6 +1244,7 @@ static gboolean gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); GtkWidget *menu; GtkWidget *item; gboolean wide; @@ -1177,7 +1252,7 @@ gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, if (event->button != 3) return FALSE; - wide = GTK_WIDGET_VISIBLE(toolbar->bold); + wide = GTK_WIDGET_VISIBLE(priv->bold); menu = gtk_menu_new(); item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items")); @@ -1241,18 +1316,19 @@ static void gtk_webviewtoolbar_finalize(GObject *object) { GtkWebViewToolbar *toolbar = GTK_WEBVIEWTOOLBAR(object); + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); GtkWidget *menu; - if (toolbar->image_dialog != NULL) + if (priv->image_dialog != NULL) { - gtk_widget_destroy(toolbar->image_dialog); - toolbar->image_dialog = NULL; + gtk_widget_destroy(priv->image_dialog); + priv->image_dialog = NULL; } destroy_toolbar_font(NULL, NULL, toolbar); - if (toolbar->smiley_dialog != NULL) { + if (priv->smiley_dialog != NULL) { #if 0 - g_signal_handlers_disconnect_by_func(G_OBJECT(toolbar->smiley_dialog), close_smiley_dialog, toolbar); + g_signal_handlers_disconnect_by_func(G_OBJECT(priv->smiley_dialog), close_smiley_dialog, toolbar); destroy_smiley_dialog(toolbar); #endif } @@ -1270,8 +1346,8 @@ gtk_webviewtoolbar_finalize(GObject *object) #endif } - g_free(toolbar->sml); - gtk_object_sink(GTK_OBJECT(toolbar->tooltips)); + g_free(priv->sml); + gtk_object_sink(GTK_OBJECT(priv->tooltips)); menu = g_object_get_data(object, "font_menu"); if (menu) @@ -1293,6 +1369,8 @@ gtk_webviewtoolbar_class_init(GtkWebViewToolbarClass *class) parent_class = g_type_class_ref(GTK_TYPE_HBOX); gobject_class->finalize = gtk_webviewtoolbar_finalize; + g_type_class_add_private(class, sizeof(GtkWebViewToolbarPriv)); + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/toolbar"); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", FALSE); } @@ -1300,6 +1378,7 @@ gtk_webviewtoolbar_class_init(GtkWebViewToolbarClass *class) static void gtk_webviewtoolbar_create_old_buttons(GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); GtkWidget *hbox; GtkWidget *button; struct { @@ -1308,25 +1387,25 @@ gtk_webviewtoolbar_create_old_buttons(GtkWebViewToolbar *toolbar) GtkWidget **button; const char *tooltip; } buttons[] = { - {GTK_STOCK_BOLD, G_CALLBACK(do_bold), &toolbar->bold, _("Bold")}, - {GTK_STOCK_ITALIC, do_italic, &toolbar->italic, _("Italic")}, - {GTK_STOCK_UNDERLINE, do_underline, &toolbar->underline, _("Underline")}, - {GTK_STOCK_STRIKETHROUGH, do_strikethrough, &toolbar->strikethrough, _("Strikethrough")}, + {GTK_STOCK_BOLD, G_CALLBACK(do_bold), &priv->bold, _("Bold")}, + {GTK_STOCK_ITALIC, do_italic, &priv->italic, _("Italic")}, + {GTK_STOCK_UNDERLINE, do_underline, &priv->underline, _("Underline")}, + {GTK_STOCK_STRIKETHROUGH, do_strikethrough, &priv->strike, _("Strikethrough")}, {"", NULL, NULL, NULL}, - {PIDGIN_STOCK_TOOLBAR_TEXT_LARGER, do_big, &toolbar->larger_size, _("Increase Font Size")}, - {PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, do_small, &toolbar->smaller_size, _("Decrease Font Size")}, + {PIDGIN_STOCK_TOOLBAR_TEXT_LARGER, do_big, &priv->larger_size, _("Increase Font Size")}, + {PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, do_small, &priv->smaller_size, _("Decrease Font Size")}, {"", NULL, NULL, NULL}, - {PIDGIN_STOCK_TOOLBAR_FONT_FACE, toggle_font, &toolbar->font, _("Font Face")}, - {PIDGIN_STOCK_TOOLBAR_FGCOLOR, toggle_fg_color, &toolbar->fgcolor, _("Foreground Color")}, - {PIDGIN_STOCK_TOOLBAR_BGCOLOR, toggle_bg_color, &toolbar->bgcolor, _("Background Color")}, + {PIDGIN_STOCK_TOOLBAR_FONT_FACE, toggle_font, &priv->font, _("Font Face")}, + {PIDGIN_STOCK_TOOLBAR_FGCOLOR, toggle_fg_color, &priv->fgcolor, _("Foreground Color")}, + {PIDGIN_STOCK_TOOLBAR_BGCOLOR, toggle_bg_color, &priv->bgcolor, _("Background Color")}, {"", NULL, NULL, NULL}, - {PIDGIN_STOCK_CLEAR, clear_formatting_cb, &toolbar->clear, _("Reset Formatting")}, + {PIDGIN_STOCK_CLEAR, clear_formatting_cb, &priv->clear, _("Reset Formatting")}, {"", NULL, NULL, NULL}, - {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &toolbar->image, _("Insert IM Image")}, - {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")}, + {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &priv->image, _("Insert IM Image")}, + {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &priv->link, _("Insert Link")}, {"", NULL, NULL, NULL}, - {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")}, - {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &toolbar->attention, _("Send Attention")}, + {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &priv->smiley, _("Insert Smiley")}, + {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &priv->attention, _("Send Attention")}, {NULL, NULL, NULL, NULL} }; int iter; @@ -1340,7 +1419,7 @@ gtk_webviewtoolbar_create_old_buttons(GtkWebViewToolbar *toolbar) g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(buttons[iter].callback), toolbar); *(buttons[iter].button) = button; - gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL); + gtk_tooltips_set_tip(priv->tooltips, button, buttons[iter].tooltip, NULL); } else button = gtk_vseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); @@ -1353,6 +1432,7 @@ gtk_webviewtoolbar_create_old_buttons(GtkWebViewToolbar *toolbar) static void gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); GtkWidget *hbox = GTK_WIDGET(toolbar), *event = gtk_event_box_new(); GtkWidget *bbox, *box = gtk_hbox_new(FALSE, 0); GtkWidget *image; @@ -1371,34 +1451,34 @@ gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) GtkWidget **button; gboolean check; } buttons[] = { - {_("_Bold"), &toolbar->bold, TRUE}, - {_("_Italic"), &toolbar->italic, TRUE}, - {_("_Underline"), &toolbar->underline, TRUE}, - {_("Strikethrough"), &toolbar->strikethrough, TRUE}, - {_("_Larger"), &toolbar->larger_size, TRUE}, + {_("_Bold"), &priv->bold, TRUE}, + {_("_Italic"), &priv->italic, TRUE}, + {_("_Underline"), &priv->underline, TRUE}, + {_("Strikethrough"), &priv->strike, TRUE}, + {_("_Larger"), &priv->larger_size, TRUE}, #if 0 - {_("_Normal"), &toolbar->normal_size, TRUE}, + {_("_Normal"), &priv->normal_size, TRUE}, #endif - {_("_Smaller"), &toolbar->smaller_size, TRUE}, + {_("_Smaller"), &priv->smaller_size, TRUE}, /* If we want to show the formatting for the following items, we would * need to update them when formatting changes. The above items don't need * no updating nor nothin' */ - {_("_Font face"), &toolbar->font, TRUE}, - {_("Foreground _color"), &toolbar->fgcolor, TRUE}, - {_("Bac_kground color"), &toolbar->bgcolor, TRUE}, - {_("_Reset formatting"), &toolbar->clear, FALSE}, + {_("_Font face"), &priv->font, TRUE}, + {_("Foreground _color"), &priv->fgcolor, TRUE}, + {_("Bac_kground color"), &priv->bgcolor, TRUE}, + {_("_Reset formatting"), &priv->clear, FALSE}, {NULL, NULL, FALSE} }; toolbar->webview = NULL; - toolbar->font_dialog = NULL; - toolbar->fgcolor_dialog = NULL; - toolbar->bgcolor_dialog = NULL; - toolbar->link_dialog = NULL; - toolbar->smiley_dialog = NULL; - toolbar->image_dialog = NULL; + priv->font_dialog = NULL; + priv->fgcolor_dialog = NULL; + priv->bgcolor_dialog = NULL; + priv->link_dialog = NULL; + priv->smiley_dialog = NULL; + priv->image_dialog = NULL; - toolbar->tooltips = gtk_tooltips_new(); + priv->tooltips = gtk_tooltips_new(); gtk_box_set_spacing(GTK_BOX(toolbar), 3); @@ -1465,30 +1545,30 @@ gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) g_object_set_data(G_OBJECT(toolbar), "insert_menu", insert_menu); menuitem = gtk_menu_item_new_with_mnemonic(_("_Image")); - g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->image); + g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), priv->image); gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); - g_signal_connect(G_OBJECT(toolbar->image), "notify::sensitive", + g_signal_connect(G_OBJECT(priv->image), "notify::sensitive", G_CALLBACK(button_sensitiveness_changed), menuitem); - g_signal_connect(G_OBJECT(toolbar->image), "notify::visible", + g_signal_connect(G_OBJECT(priv->image), "notify::visible", G_CALLBACK(button_visibility_changed), menuitem); menuitem = gtk_menu_item_new_with_mnemonic(_("_Link")); - g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), toolbar->link); + g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), priv->link); gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); - g_signal_connect(G_OBJECT(toolbar->link), "notify::sensitive", + g_signal_connect(G_OBJECT(priv->link), "notify::sensitive", G_CALLBACK(button_sensitiveness_changed), menuitem); - g_signal_connect(G_OBJECT(toolbar->link), "notify::visible", + g_signal_connect(G_OBJECT(priv->link), "notify::visible", G_CALLBACK(button_visibility_changed), menuitem); menuitem = gtk_menu_item_new_with_mnemonic(_("_Horizontal rule")); g_signal_connect(G_OBJECT(menuitem), "activate" , G_CALLBACK(insert_hr_cb), toolbar); gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); - toolbar->insert_hr = menuitem; + priv->insert_hr = menuitem; g_signal_connect(G_OBJECT(insert_button), "button-press-event", G_CALLBACK(button_activate_on_click), toolbar); g_signal_connect(G_OBJECT(insert_button), "activate", G_CALLBACK(pidgin_menu_clicked), insert_menu); g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button); - toolbar->sml = NULL; + priv->sml = NULL; /* Sep */ sep = gtk_vseparator_new(); @@ -1506,7 +1586,7 @@ gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), smiley_button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(smiley_button), "button-press-event", G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar); - g_signal_connect_swapped(G_OBJECT(smiley_button), "clicked", G_CALLBACK(gtk_button_clicked), toolbar->smiley); + g_signal_connect_swapped(G_OBJECT(smiley_button), "clicked", G_CALLBACK(gtk_button_clicked), priv->smiley); gtk_widget_show_all(smiley_button); /* Sep */ @@ -1526,16 +1606,16 @@ gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", - G_CALLBACK(gtk_button_clicked), toolbar->attention); + G_CALLBACK(gtk_button_clicked), priv->attention); gtk_widget_show_all(attention_button); - g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive", + g_signal_connect(G_OBJECT(priv->attention), "notify::sensitive", G_CALLBACK(button_sensitiveness_changed), attention_button); - g_signal_connect(G_OBJECT(toolbar->attention), "notify::visible", + g_signal_connect(G_OBJECT(priv->attention), "notify::visible", G_CALLBACK(button_visibility_changed), attention_button); /* set attention button to be greyed out until we get a conversation */ - gtk_widget_set_sensitive(toolbar->attention, FALSE); + gtk_widget_set_sensitive(priv->attention, FALSE); gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(hbox), "lean-view", box); @@ -1623,14 +1703,16 @@ void gtk_webviewtoolbar_associate_smileys(GtkWebViewToolbar *toolbar, const char *proto_id) { - g_free(toolbar->sml); - toolbar->sml = g_strdup(proto_id); + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + g_free(priv->sml); + priv->sml = g_strdup(proto_id); } void gtk_webviewtoolbar_switch_active_conversation(GtkWebViewToolbar *toolbar, PurpleConversation *conv) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); PurpleConnection *gc = purple_conversation_get_connection(conv); PurplePlugin *prpl = purple_connection_get_prpl(gc); @@ -1638,7 +1720,7 @@ gtk_webviewtoolbar_switch_active_conversation(GtkWebViewToolbar *toolbar, /* gray out attention button on protocols that don't support it for the time being it is always disabled for chats */ - gtk_widget_set_sensitive(toolbar->attention, + gtk_widget_set_sensitive(priv->attention, conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); } diff --git a/pidgin/gtkwebviewtoolbar.h b/pidgin/gtkwebviewtoolbar.h index 783653b584..fc4df9a951 100644 --- a/pidgin/gtkwebviewtoolbar.h +++ b/pidgin/gtkwebviewtoolbar.h @@ -42,39 +42,6 @@ struct _GtkWebViewToolbar { GtkHBox box; GtkWidget *webview; - - GtkTooltips *tooltips; - - GtkWidget *bold; - GtkWidget *italic; - GtkWidget *underline; - GtkWidget *strikethrough; - GtkWidget *insert_hr; - GtkWidget *call; - - GtkWidget *larger_size; - GtkWidget *normal_size; - GtkWidget *smaller_size; - - GtkWidget *font; - GtkWidget *fgcolor; - GtkWidget *bgcolor; - - GtkWidget *clear; - - GtkWidget *image; - GtkWidget *link; - GtkWidget *smiley; - GtkWidget *attention; - - GtkWidget *font_dialog; - GtkWidget *fgcolor_dialog; - GtkWidget *bgcolor_dialog; - GtkWidget *link_dialog; - GtkWidget *smiley_dialog; - GtkWidget *image_dialog; - - char *sml; }; struct _GtkWebViewToolbarClass { -- cgit v1.2.1 From ac4e3a189d535b0a61f61811b12d3bcfb36851d0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 09:16:22 +0000 Subject: Use the toolbar as the userdat to avoid g_object_[gs]et_data. --- pidgin/gtkwebviewtoolbar.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index b3f4603196..39fe68c836 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -197,13 +197,13 @@ cancel_toolbar_font(GtkWidget *widget, GtkWebViewToolbar *toolbar) } static void -apply_font(GtkWidget *widget, GtkFontSelectionDialog *fontsel) +apply_font(GtkWidget *widget, GtkWebViewToolbar *toolbar) { /* this could be expanded to include font size, weight, etc. but for now only works with font face */ + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + GtkFontSelectionDialog *fontsel = GTK_FONT_SELECTION_DIALOG(priv->font_dialog); gchar *fontname = gtk_font_selection_dialog_get_font_name(fontsel); - GtkWebViewToolbar *toolbar = g_object_get_data(G_OBJECT(fontsel), - "purple_toolbar"); if (fontname) { const gchar *family_name = NULL; @@ -237,8 +237,6 @@ toggle_font(GtkWidget *font, GtkWebViewToolbar *toolbar) if (!priv->font_dialog) { priv->font_dialog = gtk_font_selection_dialog_new(_("Select Font")); - g_object_set_data(G_OBJECT(priv->font_dialog), "purple_toolbar", toolbar); - if (fontname) { char *fonttif = g_strdup_printf("%s 12", fontname); gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(priv->font_dialog), @@ -252,12 +250,13 @@ toggle_font(GtkWidget *font, GtkWebViewToolbar *toolbar) g_signal_connect(G_OBJECT(priv->font_dialog), "delete_event", G_CALLBACK(destroy_toolbar_font), toolbar); g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(priv->font_dialog)->ok_button), "clicked", - G_CALLBACK(apply_font), priv->font_dialog); + G_CALLBACK(apply_font), toolbar); g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(priv->font_dialog)->cancel_button), "clicked", G_CALLBACK(cancel_toolbar_font), toolbar); g_signal_connect_after(G_OBJECT(priv->font_dialog), "realize", G_CALLBACK(realize_toolbar_font), toolbar); } + gtk_window_present(GTK_WINDOW(priv->font_dialog)); } else { cancel_toolbar_font(font, toolbar); @@ -291,12 +290,17 @@ cancel_toolbar_fgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar) } static void -do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) +do_fgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + GtkColorSelectionDialog *dialog; + GtkColorSelection *colorsel; GdkColor text_color; - GtkWebViewToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "purple_toolbar"); char *open_tag; + dialog = GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog); + colorsel = GTK_COLOR_SELECTION(dialog->colorsel); + open_tag = g_malloc(30); gtk_color_selection_get_current_color(colorsel, &text_color); g_snprintf(open_tag, 23, "#%02X%02X%02X", @@ -319,7 +323,6 @@ toggle_fg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) const char *color = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); if (!priv->fgcolor_dialog) { - priv->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); colorsel = GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog)->colorsel; if (color) { @@ -327,15 +330,14 @@ toggle_fg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor); } - g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); - g_signal_connect(G_OBJECT(priv->fgcolor_dialog), "delete_event", G_CALLBACK(destroy_toolbar_fgcolor), toolbar); g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog)->ok_button), "clicked", - G_CALLBACK(do_fgcolor), colorsel); + G_CALLBACK(do_fgcolor), toolbar); g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->fgcolor_dialog)->cancel_button), "clicked", G_CALLBACK(cancel_toolbar_fgcolor), toolbar); } + gtk_window_present(GTK_WINDOW(priv->fgcolor_dialog)); } else { cancel_toolbar_fgcolor(color, toolbar); @@ -374,12 +376,17 @@ cancel_toolbar_bgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar) } static void -do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) +do_bgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + GtkColorSelectionDialog *dialog; + GtkColorSelection *colorsel; GdkColor text_color; - GtkWebViewToolbar *toolbar = g_object_get_data(G_OBJECT(colorsel), "purple_toolbar"); char *open_tag; + dialog = GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog); + colorsel = GTK_COLOR_SELECTION(dialog->colorsel); + open_tag = g_malloc(30); gtk_color_selection_get_current_color(colorsel, &text_color); g_snprintf(open_tag, 23, "#%02X%02X%02X", @@ -407,7 +414,6 @@ toggle_bg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) const char *color = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); if (!priv->bgcolor_dialog) { - priv->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); colorsel = GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog)->colorsel; if (color) { @@ -415,16 +421,14 @@ toggle_bg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor); } - g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar); - g_signal_connect(G_OBJECT(priv->bgcolor_dialog), "delete_event", G_CALLBACK(destroy_toolbar_bgcolor), toolbar); g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog)->ok_button), "clicked", - G_CALLBACK(do_bgcolor), colorsel); + G_CALLBACK(do_bgcolor), toolbar); g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(priv->bgcolor_dialog)->cancel_button), "clicked", G_CALLBACK(cancel_toolbar_bgcolor), toolbar); - } + gtk_window_present(GTK_WINDOW(priv->bgcolor_dialog)); } else { cancel_toolbar_bgcolor(color, toolbar); -- cgit v1.2.1 From 09d7532d96b477e6eecbf787c0ae1b7fb8e6d54e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 09:40:32 +0000 Subject: Use pointers in the private struct instead of g_object_[gs]et_data. --- pidgin/gtkwebviewtoolbar.c | 55 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index 39fe68c836..d228102359 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -51,14 +51,20 @@ *****************************************************************************/ typedef struct _GtkWebViewToolbarPriv { + PurpleConversation *active_conv; + + GtkWidget *wide_view; + GtkWidget *lean_view; + GtkTooltips *tooltips; + GtkWidget *font_label; + GtkWidget *font_menu; + GtkWidget *bold; GtkWidget *italic; GtkWidget *underline; GtkWidget *strike; - GtkWidget *insert_hr; - GtkWidget *call; GtkWidget *larger_size; GtkWidget *normal_size; @@ -70,10 +76,14 @@ typedef struct _GtkWebViewToolbarPriv { GtkWidget *clear; + GtkWidget *insert_menu; GtkWidget *image; GtkWidget *link; + GtkWidget *insert_hr; + GtkWidget *smiley; GtkWidget *attention; + GtkWidget *call; GtkWidget *font_dialog; GtkWidget *fgcolor_dialog; @@ -1009,8 +1019,8 @@ insert_smiley_cb(GtkWidget *smiley, GtkWebViewToolbar *toolbar) static void send_attention_cb(GtkWidget *attention, GtkWebViewToolbar *toolbar) { - PurpleConversation *conv = - g_object_get_data(G_OBJECT(toolbar), "active_conv"); + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + PurpleConversation *conv = priv->active_conv; const gchar *who = purple_conversation_get_name(conv); PurpleConnection *gc = purple_conversation_get_connection(conv); @@ -1079,7 +1089,7 @@ update_buttons(GtkWebViewToolbar *toolbar) gboolean bold, italic, underline, strike; const char *tmp; const char *tmp2; - GtkLabel *label = g_object_get_data(G_OBJECT(toolbar), "font_label"); + GtkLabel *label = GTK_LABEL(priv->font_label); gtk_label_set_label(label, _("_Font")); @@ -1303,12 +1313,13 @@ static void webviewtoolbar_view_pref_changed(const char *name, PurplePrefType type, gconstpointer value, gpointer toolbar) { + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); if (value) { - gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); - gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); + gtk_widget_hide_all(priv->lean_view); + gtk_widget_show_all(priv->wide_view); } else { - gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "wide-view")); - gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "lean-view")); + gtk_widget_hide_all(priv->wide_view); + gtk_widget_show_all(priv->lean_view); } } @@ -1321,7 +1332,6 @@ gtk_webviewtoolbar_finalize(GObject *object) { GtkWebViewToolbar *toolbar = GTK_WEBVIEWTOOLBAR(object); GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - GtkWidget *menu; if (priv->image_dialog != NULL) { @@ -1353,12 +1363,10 @@ gtk_webviewtoolbar_finalize(GObject *object) g_free(priv->sml); gtk_object_sink(GTK_OBJECT(priv->tooltips)); - menu = g_object_get_data(object, "font_menu"); - if (menu) - gtk_widget_destroy(menu); - menu = g_object_get_data(object, "insert_menu"); - if (menu) - gtk_widget_destroy(menu); + if (priv->font_menu) + gtk_widget_destroy(priv->font_menu); + if (priv->insert_menu) + gtk_widget_destroy(priv->insert_menu); purple_prefs_disconnect_by_handle(object); @@ -1430,7 +1438,7 @@ gtk_webviewtoolbar_create_old_buttons(GtkWebViewToolbar *toolbar) } gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); - g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox); + priv->wide_view = hbox; } static void @@ -1495,15 +1503,13 @@ gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) gtk_container_add(GTK_CONTAINER(font_button), bbox); image = gtk_image_new_from_stock(GTK_STOCK_BOLD, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); - label = gtk_label_new_with_mnemonic(_("_Font")); + priv->font_label = label = gtk_label_new_with_mnemonic(_("_Font")); gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - g_object_set_data(G_OBJECT(hbox), "font_label", label); gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), font_button, FALSE, FALSE, 0); gtk_widget_show_all(font_button); - font_menu = gtk_menu_new(); - g_object_set_data(G_OBJECT(toolbar), "font_menu", font_menu); + priv->font_menu = font_menu = gtk_menu_new(); for (i = 0; buttons[i].label; i++) { GtkWidget *old = *buttons[i].button; @@ -1545,8 +1551,7 @@ gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) gtk_box_pack_start(GTK_BOX(box), insert_button, FALSE, FALSE, 0); gtk_widget_show_all(insert_button); - insert_menu = gtk_menu_new(); - g_object_set_data(G_OBJECT(toolbar), "insert_menu", insert_menu); + priv->insert_menu = insert_menu = gtk_menu_new(); menuitem = gtk_menu_item_new_with_mnemonic(_("_Image")); g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), priv->image); @@ -1622,7 +1627,7 @@ gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) gtk_widget_set_sensitive(priv->attention, FALSE); gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); - g_object_set_data(G_OBJECT(hbox), "lean-view", box); + priv->lean_view = box; gtk_widget_show(box); purple_prefs_connect_callback(toolbar, PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", @@ -1720,7 +1725,7 @@ gtk_webviewtoolbar_switch_active_conversation(GtkWebViewToolbar *toolbar, PurpleConnection *gc = purple_conversation_get_connection(conv); PurplePlugin *prpl = purple_connection_get_prpl(gc); - g_object_set_data(G_OBJECT(toolbar), "active_conv", conv); + priv->active_conv = conv; /* gray out attention button on protocols that don't support it for the time being it is always disabled for chats */ -- cgit v1.2.1 From 899a3a27512d6bc21991800484e71a07d27a6b82 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 09:50:46 +0000 Subject: Add some GTK+3 compatible updates. --- pidgin/gtkwebviewtoolbar.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index d228102359..dac68476c0 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -43,6 +43,15 @@ #include +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE((x)) +#define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE((x)) +#if !GTK_CHECK_VERSION(2,12,0) +#define gtk_widget_set_tooltip_text(w, t) \ + gtk_tooltips_set_tip(priv->tooltips, (w), (t), NULL) +#endif +#endif + #define GTK_WEBVIEWTOOLBAR_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_WEBVIEWTOOLBAR, GtkWebViewToolbarPriv)) @@ -56,7 +65,9 @@ typedef struct _GtkWebViewToolbarPriv { GtkWidget *wide_view; GtkWidget *lean_view; +#if !GTK_CHECK_VERSION(2,12,0) GtkTooltips *tooltips; +#endif GtkWidget *font_label; GtkWidget *font_menu; @@ -769,7 +780,7 @@ sort_smileys(struct smiley_button_list *ls, GtkWebViewToolbar *toolbar, g_object_set_data(G_OBJECT(button), "smiley_text", face); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar); - gtk_tooltips_set_tip(priv->tooltips, button, face, NULL); + gtk_widget_set_tooltip_text(button, face); /* these look really weird with borders */ gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); @@ -783,7 +794,7 @@ sort_smileys(struct smiley_button_list *ls, GtkWebViewToolbar *toolbar, g_snprintf(tip, sizeof(tip), _("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"), face); - gtk_tooltips_set_tip(priv->tooltips, button, tip, NULL); + gtk_widget_set_tooltip_text(button, tip); gtk_widget_set_sensitive(button, FALSE); } else if (psmiley) { /* Remove the button if the smiley is destroyed */ @@ -1266,7 +1277,7 @@ gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, if (event->button != 3) return FALSE; - wide = GTK_WIDGET_VISIBLE(priv->bold); + wide = gtk_widget_get_visible(priv->bold); menu = gtk_menu_new(); item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items")); @@ -1282,7 +1293,7 @@ gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, static void button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) { - if (GTK_WIDGET_VISIBLE(button)) + if (gtk_widget_get_visible(button)) gtk_widget_hide(item); else gtk_widget_show(item); @@ -1291,7 +1302,7 @@ button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) static void button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) { - gtk_widget_set_sensitive(item, GTK_WIDGET_IS_SENSITIVE(button)); + gtk_widget_set_sensitive(item, gtk_widget_is_sensitive(button)); } static void @@ -1361,7 +1372,10 @@ gtk_webviewtoolbar_finalize(GObject *object) } g_free(priv->sml); + +#if !GTK_CHECK_VERSION(2,12,0) gtk_object_sink(GTK_OBJECT(priv->tooltips)); +#endif if (priv->font_menu) gtk_widget_destroy(priv->font_menu); @@ -1431,7 +1445,7 @@ gtk_webviewtoolbar_create_old_buttons(GtkWebViewToolbar *toolbar) g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(buttons[iter].callback), toolbar); *(buttons[iter].button) = button; - gtk_tooltips_set_tip(priv->tooltips, button, buttons[iter].tooltip, NULL); + gtk_widget_set_tooltip_text(button, buttons[iter].tooltip); } else button = gtk_vseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); @@ -1490,7 +1504,9 @@ gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) priv->smiley_dialog = NULL; priv->image_dialog = NULL; +#if !GTK_CHECK_VERSION(2,12,0) priv->tooltips = gtk_tooltips_new(); +#endif gtk_box_set_spacing(GTK_BOX(toolbar), 3); -- cgit v1.2.1 From a82d83cf8c08ea71d234034d0c5fe266fe2600b3 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 10:02:18 +0000 Subject: Replace the sample imhtml in the prefs panel with a webview widget. This is much easier to test than a real conversation. --- pidgin/gtkprefs.c | 148 +++++++++++++++++++++++++++++------------------------- 1 file changed, 79 insertions(+), 69 deletions(-) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index e518412418..35e53c7dbd 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -48,14 +48,14 @@ #include "gtkconv-theme.h" #include "gtkdebug.h" #include "gtkdialogs.h" -#include "gtkimhtml.h" -#include "gtkimhtmltoolbar.h" #include "gtkprefs.h" #include "gtksavedstatuses.h" #include "gtksound.h" #include "gtkstatus-icon-theme.h" #include "gtkthemes.h" #include "gtkutils.h" +#include "gtkwebview.h" +#include "gtkwebviewtoolbar.h" #include "pidginstock.h" #define PROXYHOST 0 @@ -79,7 +79,7 @@ static GtkWidget *prefsnotebook = NULL; static int notebook_page = 0; /* Conversations page */ -static GtkWidget *sample_imhtml = NULL; +static GtkWidget *sample_webview = NULL; /* Themes page */ static GtkWidget *prefs_sound_themes_combo_box; @@ -349,7 +349,7 @@ delete_prefs(GtkWidget *asdf, void *gdsa) prefs_status_themes_combo_box = NULL; prefs_smiley_themes_combo_box = NULL; - sample_imhtml = NULL; + sample_webview = NULL; notebook_page = 0; prefsnotebook = NULL; @@ -991,7 +991,10 @@ prefs_set_smiley_theme_cb(GtkComboBox *combo_box, gpointer user_data) gtk_tree_model_get(GTK_TREE_MODEL(prefs_smiley_themes), &new_iter, 2, &new_theme, -1); purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", new_theme); - pidgin_themes_smiley_themeize(sample_imhtml); +#if 0 +/* TODO: WebKit-ify smileys */ + pidgin_themes_smiley_themeize(sample_webview); +#endif g_free(new_theme); } @@ -1280,82 +1283,83 @@ theme_page(void) } static void -formatting_toggle_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *toolbar) -{ - gboolean bold, italic, uline; - - gtk_imhtml_get_current_format(GTK_IMHTML(imhtml), - &bold, &italic, &uline); - - if (buttons & GTK_IMHTML_BOLD) - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", bold); - if (buttons & GTK_IMHTML_ITALIC) - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", italic); - if (buttons & GTK_IMHTML_UNDERLINE) - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", uline); - - if (buttons & GTK_IMHTML_GROW || buttons & GTK_IMHTML_SHRINK) +formatting_toggle_cb(GtkWebView *webview, GtkWebViewButtons buttons, void *toolbar) +{ + gboolean bold, italic, uline, strike; + + gtk_webview_get_current_format(webview, &bold, &italic, &uline, &strike); + + if (buttons & GTK_WEBVIEW_BOLD) + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", + bold); + if (buttons & GTK_WEBVIEW_ITALIC) + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", + italic); + if (buttons & GTK_WEBVIEW_UNDERLINE) + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", + uline); + if (buttons & GTK_WEBVIEW_STRIKE) + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_strike", + strike); + + if (buttons & GTK_WEBVIEW_GROW || buttons & GTK_WEBVIEW_SHRINK) purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/font_size", - gtk_imhtml_get_current_fontsize(GTK_IMHTML(imhtml))); - if (buttons & GTK_IMHTML_FACE) { - char *face = gtk_imhtml_get_current_fontface(GTK_IMHTML(imhtml)); + gtk_webview_get_current_fontsize(webview)); + if (buttons & GTK_WEBVIEW_FACE) { + const char *face = gtk_webview_get_current_fontface(webview); if (!face) - face = g_strdup(""); + face = ""; purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/font_face", face); - g_free(face); } - if (buttons & GTK_IMHTML_FORECOLOR) { - char *color = gtk_imhtml_get_current_forecolor(GTK_IMHTML(imhtml)); + if (buttons & GTK_WEBVIEW_FORECOLOR) { + const char *color = gtk_webview_get_current_forecolor(webview); if (!color) - color = g_strdup(""); + color = ""; purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor", color); - g_free(color); } - if (buttons & GTK_IMHTML_BACKCOLOR) { - char *color; + if (buttons & GTK_WEBVIEW_BACKCOLOR) { + const char *color; GObject *object; - color = gtk_imhtml_get_current_backcolor(GTK_IMHTML(imhtml)); + color = gtk_webview_get_current_backcolor(webview); if (!color) - color = g_strdup(""); + color = ""; /* Block the signal to prevent a loop. */ - object = g_object_ref(G_OBJECT(imhtml)); + object = g_object_ref(G_OBJECT(webview)); g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL, - NULL, toolbar); + NULL, toolbar); /* Clear the backcolor. */ - gtk_imhtml_toggle_backcolor(GTK_IMHTML(imhtml), ""); + gtk_webview_toggle_backcolor(webview, ""); /* Unblock the signal. */ - g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL, - NULL, toolbar); + g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, + NULL, NULL, toolbar); g_object_unref(object); /* This will fire a toggle signal and get saved below. */ - gtk_imhtml_toggle_background(GTK_IMHTML(imhtml), color); - - g_free(color); + gtk_webview_toggle_background(webview, color); } - if (buttons & GTK_IMHTML_BACKGROUND) { - char *color = gtk_imhtml_get_current_background(GTK_IMHTML(imhtml)); + if (buttons & GTK_WEBVIEW_BACKGROUND) { + const char *color = gtk_webview_get_current_background(webview); if (!color) - color = g_strdup(""); + color = ""; purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor", color); - g_free(color); } } static void -formatting_clear_cb(GtkIMHtml *imhtml, void *data) +formatting_clear_cb(GtkWebView *webview, void *data) { purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE); purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/send_strike", FALSE); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/font_size", 3); @@ -1571,7 +1575,7 @@ apply_custom_font(void) desc = pango_font_description_from_string(font); } - gtk_widget_modify_font(sample_imhtml, desc); + gtk_widget_modify_font(sample_webview, desc); if (desc) pango_font_description_free(desc); @@ -1595,7 +1599,7 @@ conv_page(void) GtkWidget *toolbar; GtkWidget *iconpref1; GtkWidget *iconpref2; - GtkWidget *imhtml; + GtkWidget *webview; GtkWidget *frame; GtkWidget *hbox; GtkWidget *checkbox; @@ -1685,33 +1689,39 @@ conv_page(void) vbox = pidgin_make_frame(ret, _("Default Formatting")); - frame = pidgin_create_imhtml(TRUE, &imhtml, &toolbar, NULL); + frame = pidgin_create_webview(TRUE, &webview, &toolbar, NULL); gtk_widget_show(frame); - gtk_widget_set_name(imhtml, "pidgin_prefs_font_imhtml"); + gtk_widget_set_name(webview, "pidgin_prefs_font_webview"); gtk_widget_set_size_request(frame, 450, -1); - gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(imhtml), TRUE); - gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), - GTK_IMHTML_BOLD | - GTK_IMHTML_ITALIC | - GTK_IMHTML_UNDERLINE | - GTK_IMHTML_GROW | - GTK_IMHTML_SHRINK | - GTK_IMHTML_FACE | - GTK_IMHTML_FORECOLOR | - GTK_IMHTML_BACKCOLOR | - GTK_IMHTML_BACKGROUND); - - gtk_imhtml_append_text(GTK_IMHTML(imhtml), _("This is how your outgoing message text will appear when you use protocols that support formatting."), 0); + gtk_webview_set_whole_buffer_formatting_only(GTK_WEBVIEW(webview), TRUE); + gtk_webview_set_format_functions(GTK_WEBVIEW(webview), + GTK_WEBVIEW_BOLD | + GTK_WEBVIEW_ITALIC | + GTK_WEBVIEW_UNDERLINE | + GTK_WEBVIEW_STRIKE | + GTK_WEBVIEW_GROW | + GTK_WEBVIEW_SHRINK | + GTK_WEBVIEW_FACE | + GTK_WEBVIEW_FORECOLOR | + GTK_WEBVIEW_BACKCOLOR | + GTK_WEBVIEW_BACKGROUND); + + gtk_webview_append_html(GTK_WEBVIEW(webview), + _("This is how your outgoing message text will " + "appear when you use protocols that support " + "formatting.")); gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); - gtk_imhtml_setup_entry(GTK_IMHTML(imhtml), PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO); + gtk_webview_setup_entry(GTK_WEBVIEW(webview), + PURPLE_CONNECTION_HTML | + PURPLE_CONNECTION_FORMATTING_WBFO); - g_signal_connect_after(G_OBJECT(imhtml), "format_function_toggle", - G_CALLBACK(formatting_toggle_cb), toolbar); - g_signal_connect_after(G_OBJECT(imhtml), "format_function_clear", - G_CALLBACK(formatting_clear_cb), NULL); - sample_imhtml = imhtml; + g_signal_connect_after(G_OBJECT(webview), "format-toggled", + G_CALLBACK(formatting_toggle_cb), toolbar); + g_signal_connect_after(G_OBJECT(webview), "format-cleared", + G_CALLBACK(formatting_clear_cb), NULL); + sample_webview = webview; gtk_widget_show(ret); -- cgit v1.2.1 From 65fde59aa07b3baa4ee83f214284a843e2253eca Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Jan 2012 10:03:51 +0000 Subject: The switch to the webview also allowed strikethrough-by-default. This commit just ensures that the pref exists for it. Fixes #13011. --- pidgin/gtkconv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index ef15afcb29..11687c2fa7 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -8381,6 +8381,7 @@ pidgin_conversations_init(void) purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold", FALSE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic", FALSE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE); + purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_strike", FALSE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/resize_custom_smileys", TRUE); -- cgit v1.2.1 From 9ba6fba1b23482c9bcb77eb5adcd91dde8e44aee Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 6 Jan 2012 02:37:42 +0000 Subject: Add some code for manipulating the WebView in edit-mode. Thanks to an Ars Technica article [1] for some ideas here. [1] http://arstechnica.com/open-source/guides/2009/07/how-to-build-a-desktop-wysiwyg-editor-with-webkit-and-html-5.ars --- pidgin/gtkwebview.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index e65fec232c..8e41fbc3f8 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -843,38 +843,62 @@ void gtk_webview_toggle_bold(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + priv->edit.bold = !priv->edit.bold; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + webkit_dom_document_exec_command(dom, "bold", FALSE, ""); } void gtk_webview_toggle_italic(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + priv->edit.italic = !priv->edit.italic; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + webkit_dom_document_exec_command(dom, "italic", FALSE, ""); } void gtk_webview_toggle_underline(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + priv->edit.underline = !priv->edit.underline; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + webkit_dom_document_exec_command(dom, "underline", FALSE, ""); } void gtk_webview_toggle_strike(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + priv->edit.strike = !priv->edit.strike; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + webkit_dom_document_exec_command(dom, "strikethrough", FALSE, ""); } gboolean gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; g_free(priv->edit.forecolor); priv->edit.forecolor = g_strdup(color); + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + webkit_dom_document_exec_command(dom, "forecolor", FALSE, color); + return FALSE; } @@ -882,10 +906,14 @@ gboolean gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; g_free(priv->edit.backcolor); priv->edit.backcolor = g_strdup(color); + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + webkit_dom_document_exec_command(dom, "backcolor", FALSE, color); + return FALSE; } @@ -904,10 +932,14 @@ gboolean gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; g_free(priv->edit.fontface); priv->edit.fontface = g_strdup(face); + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + webkit_dom_document_exec_command(dom, "fontname", FALSE, face); + return FALSE; } @@ -915,20 +947,44 @@ void gtk_webview_font_set_size(GtkWebView *webview, gint size) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + char *tmp; + priv->edit.fontsize = size; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + tmp = g_strdup_printf("%d", size); + webkit_dom_document_exec_command(dom, "fontsize", FALSE, tmp); + g_free(tmp); } void gtk_webview_font_shrink(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + char *tmp; + priv->edit.fontsize = MAX(priv->edit.fontsize - 1, 1); + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + tmp = g_strdup_printf("%d", priv->edit.fontsize); + webkit_dom_document_exec_command(dom, "fontsize", FALSE, tmp); + g_free(tmp); } void gtk_webview_font_grow(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + char *tmp; + priv->edit.fontsize = MIN(priv->edit.fontsize + 1, MAX_FONT_SIZE); + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + tmp = g_strdup_printf("%d", priv->edit.fontsize); + webkit_dom_document_exec_command(dom, "fontsize", FALSE, tmp); + g_free(tmp); } -- cgit v1.2.1 From 8c2b8f15255f795fa6ad4c83a5c82a3e4aadabcd Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 6 Jan 2012 06:44:05 +0000 Subject: Remove commented code. --- pidgin/gtkblist.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 4d7fc2b1bf..af7b7c7a1f 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -4548,21 +4548,12 @@ static void pidgin_blist_hide_node(PurpleBuddyList *list, PurpleBlistNode *node, static const char *require_connection[] = { -#if 1 "/BList/BuddiesMenu/NewInstantMessage", "/BList/BuddiesMenu/JoinAChat", "/BList/BuddiesMenu/GetUserInfo", "/BList/BuddiesMenu/AddBuddy", "/BList/BuddiesMenu/AddChat", "/BList/BuddiesMenu/AddGroup", -#else - N_("/Buddies/New Instant Message..."), - N_("/Buddies/Join a Chat..."), - N_("/Buddies/Get User Info..."), - N_("/Buddies/Add Buddy..."), - N_("/Buddies/Add Chat..."), - N_("/Buddies/Add Group..."), -#endif }; static const int require_connection_size = sizeof(require_connection) -- cgit v1.2.1 From d9ad34fa6feb7a2d05a2af99753a92e9d04dc8a6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 6 Jan 2012 06:46:54 +0000 Subject: These lines would never be true, due to the outer check. --- pidgin/gtkblist.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index af7b7c7a1f..d10d9d10d1 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -5563,9 +5563,6 @@ headline_style_set (GtkWidget *widget, g_object_ref_sink (tooltips); gtk_tooltips_force_window (tooltips); -#if GTK_CHECK_VERSION(2, 12, 0) - gtk_widget_set_name (tooltips->tip_window, "gtk-tooltips"); -#endif gtk_widget_ensure_style (tooltips->tip_window); style = gtk_widget_get_style (tooltips->tip_window); -- cgit v1.2.1 From afa62fd0856804bead5a0ccc4a77bb7ea23cba2e Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 9 Jan 2012 10:58:37 +0000 Subject: Allow signing on with usernames containing periods and underscores. Allow adding buddies containing periods and underscores. Fixes #13500. --- ChangeLog | 5 ++++- libpurple/protocols/oscar/util.c | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 481278887f..f1971e1d6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,9 +6,12 @@ version 3.0.0 (??/??/????): (Dan Williams) (#13859) AIM and ICQ: - * Make buddy list management code more efficient. (Oliver) (#4816) + * Allow signing on with usernames containing periods and + underscores. (#13500) + * Allow adding buddies containing periods and underscores. (#13500) * Don't try to format ICQ usernames entered as email addresses. Gets rid of an "Unable to format username" error at login. (#13883) + * Make buddy list management code more efficient. (Oliver) (#4816) Bonjour: * Support file transfers up to ~9 EiB. diff --git a/libpurple/protocols/oscar/util.c b/libpurple/protocols/oscar/util.c index 81211824eb..ec55c1291e 100644 --- a/libpurple/protocols/oscar/util.c +++ b/libpurple/protocols/oscar/util.c @@ -141,12 +141,12 @@ oscar_util_valid_name_aim(const char *name) if (purple_email_is_valid(name)) return TRUE; - /* Normal AIM usernames can't start with a number */ - if (isdigit(name[0])) + /* Normal AIM usernames can't start with a number, period or underscore */ + if (isalnum(name[0])) return FALSE; for (i = 0; name[i] != '\0'; i++) { - if (!isalnum(name[i]) && (name[i] != ' ')) + if (!isalnum(name[i]) && name[i] != ' ' && name[i] != '.' && name[i] != '_') return FALSE; } -- cgit v1.2.1 From d70c2dfd70f231141f96b3d37129270a0d120e70 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 9 Jan 2012 11:30:40 +0000 Subject: Our minimum version of GLib does not have a g_list_free_full(). --- libpurple/protocols/jabber/caps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libpurple/protocols/jabber/caps.c b/libpurple/protocols/jabber/caps.c index b03623af6f..c9f5922cca 100644 --- a/libpurple/protocols/jabber/caps.c +++ b/libpurple/protocols/jabber/caps.c @@ -888,7 +888,8 @@ gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash) field->values); } } else { - g_list_free_full(field->values, g_free); + g_list_foreach(field->values, (GFunc) g_free, NULL); + g_list_free(field->values); } g_free(field->var); -- cgit v1.2.1 From a16f4ad4a3b755ed080771319f3145e9e09d811f Mon Sep 17 00:00:00 2001 From: Gary Kramlich Date: Wed, 11 Jan 2012 01:03:31 +0000 Subject: Fix mark's commit and allow aim accounts to work again --- libpurple/protocols/oscar/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/oscar/util.c b/libpurple/protocols/oscar/util.c index ec55c1291e..1fa176e382 100644 --- a/libpurple/protocols/oscar/util.c +++ b/libpurple/protocols/oscar/util.c @@ -142,7 +142,7 @@ oscar_util_valid_name_aim(const char *name) return TRUE; /* Normal AIM usernames can't start with a number, period or underscore */ - if (isalnum(name[0])) + if (isalnum(name[0]) == 0) return FALSE; for (i = 0; name[i] != '\0'; i++) { -- cgit v1.2.1 From bf405faf19914fae046a746c5df47d4b1ed57800 Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Sun, 15 Jan 2012 05:50:58 +0000 Subject: pidgin: Fix so that logging works again This was broken in a6775a796e956d6f7528ea53d21f833044434118. The semantics are that the global setting is used if a per-blist-node doesn't exist. This requires we know whether one exists or not (value being non-NULL previously), hence the new API. I was going to add this as _get_type(), but I thought I remembered we were trying to move away from PurpleValue. Anyway, feel free to fix this another way before 3.0.0. Thanks to dvpdiner2 for narrowing down the offending commit. --- libpurple/blist.c | 11 +++++++++++ libpurple/blist.h | 10 ++++++++++ pidgin/gtkconv.c | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libpurple/blist.c b/libpurple/blist.c index e751febfc1..2d335b885a 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -2908,6 +2908,17 @@ purple_blist_node_get_type(PurpleBlistNode *node) return node->type; } +gboolean +purple_blist_node_has_setting(PurpleBlistNode* node, const char *key) +{ + g_return_val_if_fail(node != NULL, FALSE); + g_return_val_if_fail(node->settings != NULL, FALSE); + g_return_val_if_fail(key != NULL, FALSE); + + /* Boxed type, so it won't ever be NULL, so no need for _extended */ + return (g_hash_table_lookup(node->settings, key) != NULL); +} + void purple_blist_node_set_bool(PurpleBlistNode* node, const char *key, gboolean data) { diff --git a/libpurple/blist.h b/libpurple/blist.h index 881c3fa1b7..85809421c3 100644 --- a/libpurple/blist.h +++ b/libpurple/blist.h @@ -1051,6 +1051,16 @@ void purple_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, */ void purple_blist_request_add_group(void); +/** + * Checks whether a named setting exists for a node in the buddy list + * + * @param node The node to check from which to check settings + * @param key The identifier of the data + * + * @return TRUE if a value exists, or FALSE if there is no setting + */ +gboolean purple_blist_node_has_setting(PurpleBlistNode *node, const char *key); + /** * Associates a boolean with a node in the buddy list * diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 11687c2fa7..8beae73de7 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5759,7 +5759,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) if (convnode == NULL || !purple_blist_node_get_bool(convnode, "gtk-mute-sound")) gtkconv->make_sound = TRUE; - if (convnode != NULL) { + if (convnode != NULL && purple_blist_node_has_setting(convnode, "enable-logging")) { gboolean logging = purple_blist_node_get_bool(convnode, "enable-logging"); purple_conversation_set_logging(conv, logging); } -- cgit v1.2.1 From c6f82e7737ed82038a848a9dce8972196c936dfe Mon Sep 17 00:00:00 2001 From: Richard Laager Date: Thu, 19 Jan 2012 03:38:33 +0000 Subject: Line wrap a line in ChangeLog.API --- ChangeLog.API | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index c26857477d..65feabbdef 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -201,8 +201,8 @@ version 3.0.0 (??/??/????): * purple_txt_cancel * purple_txt_resolve_account * purple_util_fetch_url_len. Use purple_util_fetch_url, instead. - * purple_util_fetch_url_request_len. Use purple_util_fetch_url_request, - instead. + * purple_util_fetch_url_request_len. Use + * purple_util_fetch_url_request, instead. * purple_util_fetch_url_request_len_with_account. Use purple_util_fetch_url_request, instead. * PurpleConnectionUiOps.report_disconnect_reason -- cgit v1.2.1 From bbb7d2fc316ad8feed15626dc5acb09767ce3e04 Mon Sep 17 00:00:00 2001 From: Thijs Alkemade Date: Fri, 20 Jan 2012 05:15:22 +0000 Subject: MSN Patch from Thijs (xnyhps) Alkemade which do verify/convert to UTF-8 incoming OIM. Fixes #14884 committer: Jorge Villase?or --- libpurple/protocols/msn/oim.c | 48 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/libpurple/protocols/msn/oim.c b/libpurple/protocols/msn/oim.c index e294244302..2833d20525 100644 --- a/libpurple/protocols/msn/oim.c +++ b/libpurple/protocols/msn/oim.c @@ -606,11 +606,12 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) const char *date; const char *from; const char *boundary; - char *decode_msg = NULL; + char *decode_msg = NULL, *clean_msg = NULL; gsize body_len; char **tokens; char *passport = NULL; time_t stamp; + const char *charset = NULL; message = msn_message_new(MSN_MSG_UNKNOWN); @@ -638,6 +639,8 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) type = msn_message_get_content_type(multipart); if (type && !strcmp(type, "text/plain")) { decode_msg = (char *)purple_base64_decode(multipart->body, &body_len); + charset = msn_message_get_charset(multipart); + msn_message_unref(multipart); break; } @@ -654,6 +657,45 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) } } else { decode_msg = (char *)purple_base64_decode(message->body, &body_len); + charset = msn_message_get_charset(message); + } + + + if (charset && !(purple_utf8_strcasecmp(charset, "UTF-8") || purple_utf8_strcasecmp(charset, "UTF8"))) { + clean_msg = g_convert(decode_msg, strlen(decode_msg), "UTF-8", charset, NULL, NULL, NULL); + + if (!clean_msg) { + char *clean = purple_utf8_salvage(decode_msg); + + purple_debug_error("msn", "Failed to convert charset from %s to UTF-8 for OIM message: %s", charset, clean); + + msn_oim_post_delete_msg(rdata); + msn_message_unref(message); + + g_free(decode_msg); + g_free(clean); + + return; + } + + g_free(decode_msg); + + } else { + if (!g_utf8_validate(decode_msg, -1, NULL)) { + char *clean = purple_utf8_salvage(decode_msg); + + purple_debug_error("msn", "Received an OIM message that is not UTF-8, and no encoding specified: %s", clean); + + msn_oim_post_delete_msg(rdata); + msn_message_unref(message); + + g_free(decode_msg); + g_free(clean); + + return; + } + + clean_msg = decode_msg; } from = msn_message_get_header_value(message, "X-OIM-originatingSource"); @@ -695,7 +737,7 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) purple_debug_info("msn", "oim Date:{%s},passport{%s}\n", date, passport); - serv_got_im(purple_account_get_connection(rdata->oim->session->account), passport, decode_msg, 0, + serv_got_im(purple_account_get_connection(rdata->oim->session->account), passport, clean_msg, 0, stamp); /*Now get the oim message ID from the oim_list. @@ -704,7 +746,7 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) msn_oim_post_delete_msg(rdata); g_free(passport); - g_free(decode_msg); + g_free(clean_msg); msn_message_unref(message); } -- cgit v1.2.1 From a5ab93c09d4555a64221a98f88282740fa2fbc2a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 21 Jan 2012 12:02:41 +0000 Subject: Go back to the old way of creating the accounts menu. There doesn't seem to be a way to set the pixbuf through an action, so we've had to go back to this way. Also, using actions would always attempt to set a mnemonic which would mess up usernames with underscores. --- pidgin/gtkblist.c | 244 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 160 insertions(+), 84 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index d10d9d10d1..afa4a51fe1 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -129,8 +129,7 @@ typedef struct #define gtk_widget_has_focus(x) GTK_WIDGET_HAS_FOCUS(x) #endif -static guint accounts_merge_id; -static GtkActionGroup *accounts_action_group = NULL; +static GtkWidget *accountmenu = NULL; static guint visibility_manager_count = 0; static GdkVisibilityState gtk_blist_visibility = GDK_VISIBILITY_UNOBSCURED; @@ -3640,7 +3639,6 @@ static const GtkActionEntry blist_menu_entries[] = { /* Accounts menu */ { "AccountsMenu", NULL, N_("_Accounts"), NULL, NULL, NULL }, { "ManageAccounts", NULL, N_("Manage Accounts"), "A", NULL, pidgin_accounts_window_show }, - { "EnableAccountMenu", NULL, N_("Enable Account"), NULL, NULL, NULL }, /* Tools */ { "ToolsMenu", NULL, N_("_Tools"), NULL, NULL, NULL }, @@ -3705,9 +3703,6 @@ static const char *blist_menu = "
" "" "" - "" - "" - "" "" "" "" @@ -5894,6 +5889,9 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtk_widget_show(menu); gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), menu, FALSE, FALSE, 0); + menu = gtk_ui_manager_get_widget(gtkblist->ui, "/BList/AccountsMenu"); + accountmenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menu)); + /****************************** Notebook *************************************/ gtkblist->notebook = gtk_notebook_new(); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkblist->notebook), FALSE); @@ -6989,6 +6987,7 @@ static void pidgin_blist_destroy(PurpleBuddyList *list) g_free(priv); g_free(gtkblist); + accountmenu = NULL; gtkblist = NULL; purple_prefs_disconnect_by_handle(pidgin_blist_get_handle()); } @@ -8077,114 +8076,191 @@ disable_account_cb(GtkCheckMenuItem *widget, gpointer data) purple_account_set_enabled(account, PIDGIN_UI, FALSE); } - - void pidgin_blist_update_accounts_menu(void) { - GList *accounts = NULL; - - GtkAction *action; - GString *accounts_ui; - GString *enable_ui; - gchar *ui_string; - int count = 0; + GtkWidget *menuitem, *submenu; + GtkAccelGroup *accel_group; + GList *l, *accounts; + gboolean disabled_accounts = FALSE; + gboolean enabled_accounts = FALSE; - if ((gtkblist == NULL) || (gtkblist->ui == NULL)) + if (accountmenu == NULL) return; - /* Clear the old menu */ - if (accounts_action_group) { - gtk_ui_manager_remove_ui(gtkblist->ui, accounts_merge_id); - gtk_ui_manager_remove_action_group(gtkblist->ui, accounts_action_group); - g_object_unref(G_OBJECT(accounts_action_group)); - } + /* Clear the old Accounts menu */ + for (l = gtk_container_get_children(GTK_CONTAINER(accountmenu)); l; l = g_list_delete_link(l, l)) { + menuitem = l->data; - accounts_action_group = gtk_action_group_new("Accounts"); -#ifdef ENABLE_NLS - gtk_action_group_set_translation_domain(accounts_action_group, PACKAGE); -#endif - accounts_ui = g_string_new(NULL); - enable_ui = g_string_new(NULL); + if (menuitem != gtk_ui_manager_get_widget(gtkblist->ui, "/BList/AccountsMenu/ManageAccounts")) + gtk_widget_destroy(menuitem); + } - action = gtk_action_new("none-available", N_("No actions available"), NULL, NULL); - gtk_action_group_add_action(accounts_action_group, action); - gtk_action_set_sensitive(action, FALSE); + accel_group = gtk_menu_get_accel_group(GTK_MENU(accountmenu)); for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) { - char *label; - char *base; - char *name; + char *buf = NULL; + GtkWidget *image = NULL; PurpleAccount *account = NULL; + GdkPixbuf *pixbuf = NULL; account = accounts->data; - base = name = g_strdup_printf("account%d", count); - label = g_strconcat(purple_account_get_username(account), " (", + if (!purple_account_get_enabled(account, PIDGIN_UI)) { + if (!disabled_accounts) { + menuitem = gtk_menu_item_new_with_label(_("Enable Account")); + gtk_menu_shell_append(GTK_MENU_SHELL(accountmenu), menuitem); + + submenu = gtk_menu_new(); + gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); + gtk_menu_set_accel_path(GTK_MENU(submenu), N_("
/AccountsMenu/EnableAccount")); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); + + disabled_accounts = TRUE; + } + + buf = g_strconcat(purple_account_get_username(account), " (", purple_account_get_protocol_name(account), ")", NULL); - action = gtk_action_new(name, label, NULL, NULL); - g_free(label); - gtk_action_group_add_action(accounts_action_group, action); + menuitem = gtk_image_menu_item_new_with_label(buf); + g_free(buf); + + pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); + if (pixbuf != NULL) { + if (!purple_account_is_connected(account)) + gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); + image = gtk_image_new_from_pixbuf(pixbuf); + g_object_unref(G_OBJECT(pixbuf)); + gtk_widget_show(image); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); + } - if (!purple_account_get_enabled(account, PIDGIN_UI)) { - g_string_append_printf(enable_ui, "", name); - g_signal_connect(G_OBJECT(action), "activate", - G_CALLBACK(enable_account_cb), account); + g_signal_connect(G_OBJECT(menuitem), "activate", + G_CALLBACK(enable_account_cb), account); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); } else { - PurpleConnection *gc = NULL; - PurplePlugin *plugin = NULL; + enabled_accounts = TRUE; + } + } - g_string_append_printf(accounts_ui, "", name); + if (!enabled_accounts) { + gtk_widget_show_all(accountmenu); + return; + } - name = g_strconcat(base, "-edit", NULL); - action = gtk_action_new(name, N_("_Edit Account"), NULL, NULL); - gtk_action_group_add_action(accounts_action_group, action); - g_signal_connect(G_OBJECT(action), "activate", - G_CALLBACK(modify_account_cb), account); - g_string_append_printf(accounts_ui, "", name); - g_free(name); + pidgin_separator(accountmenu); - g_string_append(accounts_ui, ""); + for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) { + char *buf = NULL; + char *accel_path_buf = NULL; + GtkWidget *image = NULL; + PurpleConnection *gc = NULL; + PurpleAccount *account = NULL; + GdkPixbuf *pixbuf = NULL; + PurplePlugin *plugin = NULL; + PurplePluginProtocolInfo *prpl_info; - gc = purple_account_get_connection(account); - plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? purple_connection_get_prpl(gc) : NULL; - if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { - build_plugin_actions(accounts_action_group, accounts_ui, base, plugin, gc); - } else { - g_string_append(accounts_ui, ""); + account = accounts->data; + + if (!purple_account_get_enabled(account, PIDGIN_UI)) + continue; + + buf = g_strconcat(purple_account_get_username(account), " (", + purple_account_get_protocol_name(account), ")", NULL); + menuitem = gtk_image_menu_item_new_with_label(buf); + accel_path_buf = g_strconcat(N_("
/AccountsMenu/"), buf, NULL); + g_free(buf); + + pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); + if (pixbuf != NULL) { + if (!purple_account_is_connected(account)) + gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, + 0.0, FALSE); + image = gtk_image_new_from_pixbuf(pixbuf); + g_object_unref(G_OBJECT(pixbuf)); + gtk_widget_show(image); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); + } + + gtk_menu_shell_append(GTK_MENU_SHELL(accountmenu), menuitem); + + submenu = gtk_menu_new(); + gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); + gtk_menu_set_accel_path(GTK_MENU(submenu), accel_path_buf); + g_free(accel_path_buf); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); + + menuitem = gtk_menu_item_new_with_mnemonic(_("_Edit Account")); + g_signal_connect(G_OBJECT(menuitem), "activate", + G_CALLBACK(modify_account_cb), account); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); + + pidgin_separator(submenu); + + gc = purple_account_get_connection(account); + plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? purple_connection_get_prpl(gc) : NULL; + prpl_info = plugin ? PURPLE_PLUGIN_PROTOCOL_INFO(plugin) : NULL; + + if (prpl_info && + (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) || + PURPLE_PLUGIN_HAS_ACTIONS(plugin))) { + if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) && + (purple_connection_get_flags(gc) & PURPLE_CONNECTION_SUPPORT_MOODS)) { + + if (purple_account_get_status(account, "mood")) { + menuitem = gtk_menu_item_new_with_mnemonic(_("Set _Mood...")); + g_signal_connect(G_OBJECT(menuitem), "activate", + G_CALLBACK(set_mood_cb), account); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); + } } - g_string_append(accounts_ui, ""); + if (PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { + GtkWidget *menuitem; + PurplePluginAction *action = NULL; + GList *actions, *l; - name = g_strconcat(base, "-disable", NULL); - action = gtk_action_new(name, N_("_Disable"), NULL, NULL); - gtk_action_group_add_action(accounts_action_group, action); - g_signal_connect(G_OBJECT(action), "activate", - G_CALLBACK(disable_account_cb), account); - g_string_append_printf(accounts_ui, "", name); - g_free(name); + actions = PURPLE_PLUGIN_ACTIONS(plugin, gc); + + for (l = actions; l != NULL; l = l->next) + { + if (l->data) + { + action = (PurplePluginAction *) l->data; + action->plugin = plugin; + action->context = gc; + + menuitem = gtk_menu_item_new_with_label(action->label); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); + + g_signal_connect(G_OBJECT(menuitem), "activate", + G_CALLBACK(plugin_act), action); + g_object_set_data_full(G_OBJECT(menuitem), "plugin_action", + action, + (GDestroyNotify)purple_plugin_action_free); + gtk_widget_show(menuitem); + } + else + pidgin_separator(submenu); + } - g_string_append(accounts_ui, "
"); + g_list_free(actions); + } + } else { + menuitem = gtk_menu_item_new_with_label(_("No actions available")); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); + gtk_widget_set_sensitive(menuitem, FALSE); } - g_free(base); - count++; - } + pidgin_separator(submenu); - ui_string = g_strconcat("", - enable_ui->str, - "", - accounts_ui->str, - "", - NULL); - gtk_ui_manager_insert_action_group(gtkblist->ui, accounts_action_group, 1); - accounts_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string, -1, NULL); -purple_debug_info("blist", "The account menu is {%s}\n", ui_string); + menuitem = gtk_menu_item_new_with_mnemonic(_("_Disable")); + g_signal_connect(G_OBJECT(menuitem), "activate", + G_CALLBACK(disable_account_cb), account); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); + } - g_string_free(enable_ui, TRUE); - g_string_free(accounts_ui, TRUE); - g_free(ui_string); + gtk_widget_show_all(accountmenu); } static guint plugins_merge_id; -- cgit v1.2.1 From 85f9ab7006981611f945ba5a85b1520d2174dda7 Mon Sep 17 00:00:00 2001 From: Jorge Villase?or Date: Thu, 26 Jan 2012 03:00:33 +0000 Subject: Apply second patch from xnyhps this time to show the message salvaged to user. Refs #14884 --- libpurple/protocols/msn/oim.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/libpurple/protocols/msn/oim.c b/libpurple/protocols/msn/oim.c index 2833d20525..b091c5fc8e 100644 --- a/libpurple/protocols/msn/oim.c +++ b/libpurple/protocols/msn/oim.c @@ -661,7 +661,7 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) } - if (charset && !(purple_utf8_strcasecmp(charset, "UTF-8") || purple_utf8_strcasecmp(charset, "UTF8"))) { + if (charset && !((strncasecmp(charset, "UTF-8", 5) == 0) || (strncasecmp(charset, "UTF8", 4) == 0))) { clean_msg = g_convert(decode_msg, strlen(decode_msg), "UTF-8", charset, NULL, NULL, NULL); if (!clean_msg) { @@ -669,13 +669,8 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) purple_debug_error("msn", "Failed to convert charset from %s to UTF-8 for OIM message: %s", charset, clean); - msn_oim_post_delete_msg(rdata); - msn_message_unref(message); - - g_free(decode_msg); + clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. Converting the encoding from %s to UTF-8 failed.)"), clean, charset); g_free(clean); - - return; } g_free(decode_msg); @@ -686,16 +681,18 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) purple_debug_error("msn", "Received an OIM message that is not UTF-8, and no encoding specified: %s", clean); - msn_oim_post_delete_msg(rdata); - msn_message_unref(message); + if (charset) { + clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. The charset was %s, but it was not valid UTF-8.)"), clean, charset); + } else { + clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. The charset was missing, but it was not valid UTF-8.)"), clean); + } - g_free(decode_msg); g_free(clean); + g_free(decode_msg); - return; + } else { + clean_msg = decode_msg; } - - clean_msg = decode_msg; } from = msn_message_get_header_value(message, "X-OIM-originatingSource"); -- cgit v1.2.1 From 9eefaa50c688a2a74a015cbb6a49483c293a31be Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 28 Jan 2012 06:05:48 +0000 Subject: Add newlines to debug messages, and word-wrap lines. --- libpurple/protocols/msn/oim.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libpurple/protocols/msn/oim.c b/libpurple/protocols/msn/oim.c index b091c5fc8e..c2919d746e 100644 --- a/libpurple/protocols/msn/oim.c +++ b/libpurple/protocols/msn/oim.c @@ -660,16 +660,17 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) charset = msn_message_get_charset(message); } - if (charset && !((strncasecmp(charset, "UTF-8", 5) == 0) || (strncasecmp(charset, "UTF8", 4) == 0))) { clean_msg = g_convert(decode_msg, strlen(decode_msg), "UTF-8", charset, NULL, NULL, NULL); if (!clean_msg) { char *clean = purple_utf8_salvage(decode_msg); - purple_debug_error("msn", "Failed to convert charset from %s to UTF-8 for OIM message: %s", charset, clean); + purple_debug_error("msn", "Failed to convert charset from %s to UTF-8 for OIM message: %s\n", charset, clean); - clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. Converting the encoding from %s to UTF-8 failed.)"), clean, charset); + clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. " + "Converting the encoding from %s to UTF-8 failed.)"), + clean, charset); g_free(clean); } @@ -679,12 +680,17 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) if (!g_utf8_validate(decode_msg, -1, NULL)) { char *clean = purple_utf8_salvage(decode_msg); - purple_debug_error("msn", "Received an OIM message that is not UTF-8, and no encoding specified: %s", clean); + purple_debug_error("msn", "Received an OIM message that is not UTF-8," + " and no encoding specified: %s\n", clean); if (charset) { - clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. The charset was %s, but it was not valid UTF-8.)"), clean, charset); + clean_msg = g_strdup_printf(_("%s (There was an error receiving this message." + " The charset was %s, but it was not valid UTF-8.)"), + clean, charset); } else { - clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. The charset was missing, but it was not valid UTF-8.)"), clean); + clean_msg = g_strdup_printf(_("%s (There was an error receiving this message." + " The charset was missing, but it was not valid UTF-8.)"), + clean); } g_free(clean); -- cgit v1.2.1 From 5e9569ff8309b94567cecbb0c6fd57be48ae38f1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 28 Jan 2012 06:19:17 +0000 Subject: We know the length of decode_msg here. --- libpurple/protocols/msn/oim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpurple/protocols/msn/oim.c b/libpurple/protocols/msn/oim.c index c2919d746e..9d98283ac1 100644 --- a/libpurple/protocols/msn/oim.c +++ b/libpurple/protocols/msn/oim.c @@ -661,7 +661,7 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) } if (charset && !((strncasecmp(charset, "UTF-8", 5) == 0) || (strncasecmp(charset, "UTF8", 4) == 0))) { - clean_msg = g_convert(decode_msg, strlen(decode_msg), "UTF-8", charset, NULL, NULL, NULL); + clean_msg = g_convert(decode_msg, body_len, "UTF-8", charset, NULL, NULL, NULL); if (!clean_msg) { char *clean = purple_utf8_salvage(decode_msg); @@ -677,7 +677,7 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) g_free(decode_msg); } else { - if (!g_utf8_validate(decode_msg, -1, NULL)) { + if (!g_utf8_validate(decode_msg, body_len, NULL)) { char *clean = purple_utf8_salvage(decode_msg); purple_debug_error("msn", "Received an OIM message that is not UTF-8," -- cgit v1.2.1 From a9a2eddb0b534e07f2ee9405fc2c35b1056ff887 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 28 Jan 2012 06:20:21 +0000 Subject: This extra if-level can be dropped. --- libpurple/protocols/msn/oim.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/libpurple/protocols/msn/oim.c b/libpurple/protocols/msn/oim.c index 9d98283ac1..474ec4c3b9 100644 --- a/libpurple/protocols/msn/oim.c +++ b/libpurple/protocols/msn/oim.c @@ -676,29 +676,27 @@ msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) g_free(decode_msg); - } else { - if (!g_utf8_validate(decode_msg, body_len, NULL)) { - char *clean = purple_utf8_salvage(decode_msg); + } else if (!g_utf8_validate(decode_msg, body_len, NULL)) { + char *clean = purple_utf8_salvage(decode_msg); - purple_debug_error("msn", "Received an OIM message that is not UTF-8," - " and no encoding specified: %s\n", clean); - - if (charset) { - clean_msg = g_strdup_printf(_("%s (There was an error receiving this message." - " The charset was %s, but it was not valid UTF-8.)"), - clean, charset); - } else { - clean_msg = g_strdup_printf(_("%s (There was an error receiving this message." - " The charset was missing, but it was not valid UTF-8.)"), - clean); - } - - g_free(clean); - g_free(decode_msg); + purple_debug_error("msn", "Received an OIM message that is not UTF-8," + " and no encoding specified: %s\n", clean); + if (charset) { + clean_msg = g_strdup_printf(_("%s (There was an error receiving this message." + " The charset was %s, but it was not valid UTF-8.)"), + clean, charset); } else { - clean_msg = decode_msg; + clean_msg = g_strdup_printf(_("%s (There was an error receiving this message." + " The charset was missing, but it was not valid UTF-8.)"), + clean); } + + g_free(clean); + g_free(decode_msg); + + } else { + clean_msg = decode_msg; } from = msn_message_get_header_value(message, "X-OIM-originatingSource"); -- cgit v1.2.1 From 62e1c2a782ebb9f23d69288628f74d7ff4181678 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 28 Jan 2012 06:29:38 +0000 Subject: I keep seeing a 301 Moved Permanently for omega.contacts.msn.com, so I think we do need to change this to local-bay.contacts.msn.com. --- libpurple/protocols/msn/contact.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/msn/contact.h b/libpurple/protocols/msn/contact.h index 27fbf8a46b..d4485562b0 100644 --- a/libpurple/protocols/msn/contact.h +++ b/libpurple/protocols/msn/contact.h @@ -62,7 +62,7 @@ typedef enum #define MSN_APPLICATION_ID "CFE80F9D-180F-4399-82AB-413F33A1FA11" -#define MSN_CONTACT_SERVER "omega.contacts.msn.com" +#define MSN_CONTACT_SERVER "local-bay.contacts.msn.com" /* Get Contact List */ -- cgit v1.2.1 From 7efa011d506f28190b9bde8e87569a4f00a2beaf Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 28 Jan 2012 07:48:53 +0000 Subject: Windows Live Spaces do not exist anymore. --- libpurple/protocols/msn/nexus.c | 1 - libpurple/protocols/msn/nexus.h | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/msn/nexus.c b/libpurple/protocols/msn/nexus.c index 7985f66def..53772be4b7 100644 --- a/libpurple/protocols/msn/nexus.c +++ b/libpurple/protocols/msn/nexus.c @@ -44,7 +44,6 @@ static char *ticket_domains[][2] = { {"messenger.msn.com", "?id=507"}, /* Authentication for receiving OIMs. */ {"contacts.msn.com", "MBI"}, /* Authentication for the Contact server. */ {"messengersecure.live.com", "MBI_SSL"}, /* Authentication for sending OIMs. */ - {"spaces.live.com", "MBI"}, /* Authentication for the Windows Live Spaces */ {"livecontacts.live.com", "MBI"}, /* Live Contacts API, a simplified version of the Contacts SOAP service */ {"storage.live.com", "MBI"}, /* Storage REST API */ }; diff --git a/libpurple/protocols/msn/nexus.h b/libpurple/protocols/msn/nexus.h index 4c86eab2cb..e9c688515e 100644 --- a/libpurple/protocols/msn/nexus.h +++ b/libpurple/protocols/msn/nexus.h @@ -36,9 +36,8 @@ typedef enum MSN_AUTH_MESSENGER_WEB = 1, MSN_AUTH_CONTACTS = 2, MSN_AUTH_LIVE_SECURE = 3, - MSN_AUTH_SPACES = 4, - MSN_AUTH_LIVE_CONTACTS = 5, - MSN_AUTH_STORAGE = 6 + MSN_AUTH_LIVE_CONTACTS = 4, + MSN_AUTH_STORAGE = 5 } MsnAuthDomains; #define MSN_SSO_SERVER "login.live.com" -- cgit v1.2.1 From 278ec5342060cf5a7f0c6657abe08553232a4178 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 28 Jan 2012 07:56:14 +0000 Subject: The official client doesn't seem to use Live Contacts, but there is a "What's New?" service. --- libpurple/protocols/msn/nexus.c | 2 +- libpurple/protocols/msn/nexus.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libpurple/protocols/msn/nexus.c b/libpurple/protocols/msn/nexus.c index 53772be4b7..e99a19e452 100644 --- a/libpurple/protocols/msn/nexus.c +++ b/libpurple/protocols/msn/nexus.c @@ -44,8 +44,8 @@ static char *ticket_domains[][2] = { {"messenger.msn.com", "?id=507"}, /* Authentication for receiving OIMs. */ {"contacts.msn.com", "MBI"}, /* Authentication for the Contact server. */ {"messengersecure.live.com", "MBI_SSL"}, /* Authentication for sending OIMs. */ - {"livecontacts.live.com", "MBI"}, /* Live Contacts API, a simplified version of the Contacts SOAP service */ {"storage.live.com", "MBI"}, /* Storage REST API */ + {"sup.live.com", "MBI"}, /* What's New service */ }; /************************************************************************** diff --git a/libpurple/protocols/msn/nexus.h b/libpurple/protocols/msn/nexus.h index e9c688515e..d824b8f624 100644 --- a/libpurple/protocols/msn/nexus.h +++ b/libpurple/protocols/msn/nexus.h @@ -36,8 +36,8 @@ typedef enum MSN_AUTH_MESSENGER_WEB = 1, MSN_AUTH_CONTACTS = 2, MSN_AUTH_LIVE_SECURE = 3, - MSN_AUTH_LIVE_CONTACTS = 4, - MSN_AUTH_STORAGE = 5 + MSN_AUTH_STORAGE = 4, + MSN_AUTH_WHATSNEW = 5 } MsnAuthDomains; #define MSN_SSO_SERVER "login.live.com" -- cgit v1.2.1 From 1952979d812c9e2b42c38c571fcb1259a7e23cc5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Feb 2012 01:14:41 +0000 Subject: Add a function for parsing a network:username for MSNP18. --- libpurple/protocols/msn/msnutils.c | 15 +++++++++++++++ libpurple/protocols/msn/msnutils.h | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/libpurple/protocols/msn/msnutils.c b/libpurple/protocols/msn/msnutils.c index 51f1ced08b..377edec35d 100644 --- a/libpurple/protocols/msn/msnutils.c +++ b/libpurple/protocols/msn/msnutils.c @@ -490,6 +490,21 @@ msn_parse_socket(const char *str, char **ret_host, int *ret_port) *ret_port = port; } +void +msn_parse_user(const char *str, char **ret_user, int *ret_network) +{ + char **tokens; + + tokens = g_strsplit(str, ":", 2); + + *ret_network = atoi(tokens[0]); + *ret_user = tokens[1]; + + g_free(tokens[0]); + /* tokens[1] is returned */ + g_free(tokens); +} + gboolean msn_email_is_valid(const char *passport) { diff --git a/libpurple/protocols/msn/msnutils.h b/libpurple/protocols/msn/msnutils.h index f4858c60f2..c4ed8fcbdf 100644 --- a/libpurple/protocols/msn/msnutils.h +++ b/libpurple/protocols/msn/msnutils.h @@ -75,6 +75,15 @@ void msn_import_html(const char *html, char **attributes, char **message); */ void msn_parse_socket(const char *str, char **ret_host, int *ret_port); +/** + * Parses a user name + * + * @param str A network:username string. + * @param ret_user Return of the user's passport. + * @param ret_network Return of the user's network. + */ +void msn_parse_user(const char *str, char **ret_user, int *ret_network); + /** * Verify if the email is a vaild passport. * -- cgit v1.2.1 From daa6d07b8666a98758f5119cae79e6743b5939d8 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Feb 2012 01:26:14 +0000 Subject: Fix UBX on MSNP18. --- libpurple/protocols/msn/notification.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index 0acc084cd0..ea60d577aa 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -1705,13 +1705,19 @@ ubx_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, { MsnSession *session; MsnUser *user; - const char *passport; + char *passport; + int network; xmlnode *payloadNode; char *psm_str, *str; session = cmdproc->session; - passport = cmd->params[0]; + if (session->protocol_ver >= 18) { + str = cmd->params[0]; + msn_parse_user(str, &passport, &network); + } else { + passport = cmd->params[0]; + } user = msn_userlist_find_user(session->userlist, passport); if (user == NULL) { char *str = g_strndup(payload, len); @@ -1721,6 +1727,9 @@ ubx_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, return; } + if (session->protocol_ver >= 18) + g_free(passport); + /* Free any existing media info for this user */ if (user->extinfo) { g_free(user->extinfo->media_album); @@ -1767,7 +1776,10 @@ ubx_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { purple_debug_misc("msn", "UBX received.\n"); cmdproc->last_cmd->payload_cb = ubx_cmd_post; - cmd->payload_len = atoi(cmd->params[2]); + if (cmdproc->session->protocol_ver >= 18) + cmd->payload_len = atoi(cmd->params[1]); + else + cmd->payload_len = atoi(cmd->params[2]); } static void -- cgit v1.2.1 From 808b9878c7b68d7c1e3d7568a0f5f05e33ed9050 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Feb 2012 01:29:43 +0000 Subject: Fix NLN on MSNP18. --- libpurple/protocols/msn/notification.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index ea60d577aa..b8d456c955 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -1250,15 +1250,22 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) MsnObject *msnobj; unsigned long clientid, extcaps; char *extcap_str; + char *passport; int networkid; - const char *state, *passport, *friendly; + const char *state, *friendly; session = cmdproc->session; state = cmd->params[0]; - passport = cmd->params[1]; - networkid = atoi(cmd->params[2]); - friendly = purple_url_decode(cmd->params[3]); + if (session->protocol_ver >= 18) { + const char *tmp = cmd->params[1]; + msn_parse_user(tmp, &passport, &networkid); + friendly = purple_url_decode(cmd->params[2]); + } else { + passport = cmd->params[1]; + networkid = atoi(cmd->params[2]); + friendly = purple_url_decode(cmd->params[3]); + } user = msn_userlist_find_user(session->userlist, passport); if (user == NULL) return; @@ -1292,6 +1299,9 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) msn_user_set_state(user, state); msn_user_update(user); + + if (session->protocol_ver >= 18) + g_free(passport); } #if 0 -- cgit v1.2.1 From 1bcbc0ac6dc7506a321334e4de97002df6283299 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Feb 2012 04:57:18 +0000 Subject: Switch to ABFindContactsPaged instead of ABFindAll. --- libpurple/protocols/msn/contact.c | 8 ++++---- libpurple/protocols/msn/contact.h | 14 ++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/libpurple/protocols/msn/contact.c b/libpurple/protocols/msn/contact.c index 3349d37864..5acb58ec10 100644 --- a/libpurple/protocols/msn/contact.c +++ b/libpurple/protocols/msn/contact.c @@ -897,7 +897,7 @@ msn_parse_addressbook(MsnSession *session, xmlnode *node) return FALSE; } - result = xmlnode_get_child(node, "Body/ABFindAllResponse/ABFindAllResult"); + result = xmlnode_get_child(node, "Body/ABFindContactsPagedResponse/ABFindContactsPagedResult"); if (result == NULL) { purple_debug_misc("msn", "Received no address book update\n"); return TRUE; @@ -906,7 +906,7 @@ msn_parse_addressbook(MsnSession *session, xmlnode *node) /* I don't see this "groups" tag documented on msnpiki, need to find out if they are really there, and update msnpiki */ /*Process Group List*/ - groups = xmlnode_get_child(result, "groups"); + groups = xmlnode_get_child(result, "Groups"); if (groups != NULL) { msn_parse_addressbook_groups(session, groups); } @@ -931,12 +931,12 @@ msn_parse_addressbook(MsnSession *session, xmlnode *node) /*Process contact List*/ purple_debug_info("msn", "Process contact list...\n"); - contacts = xmlnode_get_child(result, "contacts"); + contacts = xmlnode_get_child(result, "Contacts"); if (contacts != NULL) { msn_parse_addressbook_contacts(session, contacts); } - abNode = xmlnode_get_child(result, "ab"); + abNode = xmlnode_get_child(result, "Ab"); if (abNode != NULL) { xmlnode *node2; char *tmp = NULL; diff --git a/libpurple/protocols/msn/contact.h b/libpurple/protocols/msn/contact.h index d4485562b0..33985281a4 100644 --- a/libpurple/protocols/msn/contact.h +++ b/libpurple/protocols/msn/contact.h @@ -142,11 +142,13 @@ typedef enum "" /* Get AddressBook */ -#define MSN_GET_ADDRESS_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll" +#define MSN_GET_ADDRESS_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABFindContactsPaged" #define MSN_GET_ADDRESS_FULL_TIME "0001-01-01T00:00:00.0000000-08:00" #define MSN_GET_ADDRESS_UPDATE_XML \ - "true"\ - "%s" + ""\ + "true"\ + "%s"\ + "" #define MSN_GET_GLEAM_UPDATE_XML \ "%s"\ @@ -171,11 +173,11 @@ typedef enum ""\ ""\ ""\ - ""\ - "00000000-0000-0000-0000-000000000000"\ + ""\ "Full"\ + "AB AllGroups CircleResult"\ "%s"\ - ""\ + ""\ ""\ "" -- cgit v1.2.1 From f6ed25f99bcc6f1a8cc9adf274bad6ecd9a5a4f0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Feb 2012 06:04:05 +0000 Subject: Send circle authentication on the notification server on MSNP18. --- libpurple/protocols/msn/contact.c | 10 ++++++++++ libpurple/protocols/msn/notification.c | 16 ++++++++++++++++ libpurple/protocols/msn/notification.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/libpurple/protocols/msn/contact.c b/libpurple/protocols/msn/contact.c index 5acb58ec10..f85ba37c56 100644 --- a/libpurple/protocols/msn/contact.c +++ b/libpurple/protocols/msn/contact.c @@ -871,6 +871,7 @@ msn_parse_addressbook(MsnSession *session, xmlnode *node) xmlnode *groups; xmlnode *contacts; xmlnode *abNode; + xmlnode *circleNode; xmlnode *fault; if ((fault = xmlnode_get_child(node, "Body/Fault"))) { @@ -954,6 +955,15 @@ msn_parse_addressbook(MsnSession *session, xmlnode *node) g_free(tmp); } + circleNode = xmlnode_get_child(result, "CircleResult/CircleTicket"); + if (circleNode != NULL && session->protocol_ver >= 18) { + char *data; + + data = xmlnode_get_data(circleNode); + msn_notification_send_circle_auth(session, data); + g_free(data); + } + return TRUE; } diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index b8d456c955..3e1139ce0e 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -1964,6 +1964,22 @@ msn_notification_send_uun(MsnSession *session, const char *user, msn_cmdproc_send_trans(cmdproc, trans); } +void +msn_notification_send_circle_auth(MsnSession *session, const char *ticket) +{ + MsnTransaction *trans; + MsnCmdProc *cmdproc; + char *encoded; + + cmdproc = session->notification->cmdproc; + + encoded = purple_base64_encode((guchar *)ticket, strlen(ticket)); + trans = msn_transaction_new(cmdproc, "USR", "SHA A %s", encoded); + msn_cmdproc_send_trans(cmdproc, trans); + + g_free(encoded); +} + /************************************************************************** * Message Types **************************************************************************/ diff --git a/libpurple/protocols/msn/notification.h b/libpurple/protocols/msn/notification.h index b74cf4b8ce..e9706afdca 100644 --- a/libpurple/protocols/msn/notification.h +++ b/libpurple/protocols/msn/notification.h @@ -108,6 +108,8 @@ void msn_notification_send_uun(MsnSession *session, MsnUnifiedNotificationType type, const char *payload); +void msn_notification_send_circle_auth(MsnSession *session, const char *ticket); + /** * Closes a notification. * -- cgit v1.2.1 From a2368754279e69587f954dfc2be6da1ad15e3d3e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Feb 2012 06:25:52 +0000 Subject: Make a small name change. --- libpurple/protocols/msn/msn.c | 2 +- libpurple/protocols/msn/notification.c | 2 +- libpurple/protocols/msn/notification.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 4f9e9d7a4a..8191b45616 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -1601,7 +1601,7 @@ msn_send_im(PurpleConnection *gc, const char *who, const char *message, if (msn_user_is_yahoo(account, who)) { /*we send the online and offline Message to Yahoo User via UBM*/ purple_debug_info("msn", "send to Yahoo User\n"); - uum_send_msg(session, msg); + msn_notification_send_uum(session, msg); } else { purple_debug_info("msn", "send via switchboard\n"); msn_send_im_message(session, msg); diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index 3e1139ce0e..44a709cb28 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -359,7 +359,7 @@ msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) /*send Message to Yahoo Messenger*/ void -uum_send_msg(MsnSession *session,MsnMessage *msg) +msn_notification_send_uum(MsnSession *session,MsnMessage *msg) { MsnCmdProc *cmdproc; MsnTransaction *trans; diff --git a/libpurple/protocols/msn/notification.h b/libpurple/protocols/msn/notification.h index e9706afdca..4e9798dc6b 100644 --- a/libpurple/protocols/msn/notification.h +++ b/libpurple/protocols/msn/notification.h @@ -76,8 +76,6 @@ typedef enum { } MsnUnifiedNotificationType; -void uum_send_msg(MsnSession *session, MsnMessage *msg); - void msn_notification_end(void); void msn_notification_init(void); @@ -97,6 +95,8 @@ gboolean msn_notification_connect(MsnNotification *notification, void msn_notification_disconnect(MsnNotification *notification); void msn_notification_dump_contact(MsnSession *session); +void msn_notification_send_uum(MsnSession *session, MsnMessage *msg); + void msn_notification_send_uux(MsnSession *session, const char *payload); void msn_notification_send_uux_endpointdata(MsnSession *session); -- cgit v1.2.1 From cd88f4ffff97860cec6aba9d8cae9b34ba154b0e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Feb 2012 06:40:25 +0000 Subject: Add a missing function. --- libpurple/protocols/msn/user.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libpurple/protocols/msn/user.c b/libpurple/protocols/msn/user.c index afb0988445..d8290e8a43 100644 --- a/libpurple/protocols/msn/user.c +++ b/libpurple/protocols/msn/user.c @@ -699,6 +699,14 @@ msn_user_get_endpoint_data(MsnUser *user, const char *input) return NULL; } +MsnNetwork +msn_user_get_network(const MsnUser *user) +{ + g_return_val_if_fail(user != NULL, MSN_NETWORK_UNKNOWN); + + return user->networkid; +} + MsnObject * msn_user_get_object(const MsnUser *user) { -- cgit v1.2.1 From e76e9ea39dd19283fb245202352b46aebbf18025 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Feb 2012 06:48:16 +0000 Subject: Update UUM to allow sending to users on any network. --- libpurple/protocols/msn/notification.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index 44a709cb28..5f543bb695 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -359,23 +359,34 @@ msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) /*send Message to Yahoo Messenger*/ void -msn_notification_send_uum(MsnSession *session,MsnMessage *msg) +msn_notification_send_uum(MsnSession *session, MsnMessage *msg) { MsnCmdProc *cmdproc; MsnTransaction *trans; char *payload; gsize payload_len; int type; + MsnUser *user; + int network; + + g_return_if_fail(msg != NULL); cmdproc = session->notification->cmdproc; - g_return_if_fail(msg != NULL); + payload = msn_message_gen_payload(msg, &payload_len); + type = msg->type; + user = msn_userlist_find_user(session->userlist, msg->remote_user); + if (user) + network = msn_user_get_network(user); + else + network = MSN_NETWORK_PASSPORT; + purple_debug_info("msn", "send UUM, payload{%s}, strlen:%" G_GSIZE_FORMAT ", len:%" G_GSIZE_FORMAT "\n", payload, strlen(payload), payload_len); - type = msg->type; - trans = msn_transaction_new(cmdproc, "UUM", "%s 32 %d %" G_GSIZE_FORMAT, - msg->remote_user, type, payload_len); + + trans = msn_transaction_new(cmdproc, "UUM", "%s %d %d %" G_GSIZE_FORMAT, + msg->remote_user, network, type, payload_len); msn_transaction_set_payload(trans, payload, strlen(payload)); msn_cmdproc_send_trans(cmdproc, trans); } -- cgit v1.2.1 From 30c895aec4a0248b013951307446e06c6524c0c8 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Feb 2012 06:49:03 +0000 Subject: Switch to MSNP18. --- libpurple/protocols/msn/msn.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libpurple/protocols/msn/msn.h b/libpurple/protocols/msn/msn.h index 2e6f70261b..7af87eceb2 100644 --- a/libpurple/protocols/msn/msn.h +++ b/libpurple/protocols/msn/msn.h @@ -115,10 +115,10 @@ typedef enum #define MSN_SERVER "messenger.hotmail.com" #define MSN_HTTPCONN_SERVER "gateway.messenger.hotmail.com" #define MSN_PORT 1863 -#define WLM_PROT_VER 16 +#define WLM_PROT_VER 18 -#define WLM_MAX_PROTOCOL 16 -#define WLM_MIN_PROTOCOL 15 +#define WLM_MAX_PROTOCOL 18 +#define WLM_MIN_PROTOCOL 18 #define MSN_TYPING_RECV_TIMEOUT 6 #define MSN_TYPING_SEND_TIMEOUT 4 -- cgit v1.2.1 From 1c3b0d4513e322e06fccb1e6d44efed8ba9bd4e4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 3 Feb 2012 06:49:22 +0000 Subject: Send offline messages using UUM. --- libpurple/protocols/msn/msn.c | 129 ++++++++++++++++++------------------------ 1 file changed, 54 insertions(+), 75 deletions(-) diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 8191b45616..176e8870e0 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -1571,90 +1571,69 @@ msn_send_im(PurpleConnection *gc, const char *who, const char *message, return 0; } - if (msn_user_is_online(account, who) || - msn_user_is_yahoo(account, who) || - swboard != NULL) { - /*User online or have a swboard open because it's invisible - * and sent us a message,then send Online Instant Message*/ - - if (msglen + strlen(msgformat) + strlen(VERSION) > 1564) - { - g_free(msgformat); - g_free(msgtext); - - return -E2BIG; - } - - msg = msn_message_new_plain(msgtext); - msg->remote_user = g_strdup(who); - msn_message_set_header(msg, "X-MMS-IM-Format", msgformat); - + if (msglen + strlen(msgformat) + strlen(VERSION) > 1564) + { g_free(msgformat); g_free(msgtext); - purple_debug_info("msn", "prepare to send online Message\n"); - if (g_ascii_strcasecmp(who, username)) - { - if (flags & PURPLE_MESSAGE_AUTO_RESP) { - msn_message_set_flag(msg, 'U'); - } - if (msn_user_is_yahoo(account, who)) { - /*we send the online and offline Message to Yahoo User via UBM*/ - purple_debug_info("msn", "send to Yahoo User\n"); - msn_notification_send_uum(session, msg); - } else { - purple_debug_info("msn", "send via switchboard\n"); - msn_send_im_message(session, msg); - } - } - else - { - char *body_str, *body_enc, *pre, *post; - const char *format; - MsnIMData *imdata = g_new0(MsnIMData, 1); - /* - * In MSN, you can't send messages to yourself, so - * we'll fake like we received it ;) - */ - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - format = msn_message_get_header_value(msg, "X-MMS-IM-Format"); - msn_parse_format(format, &pre, &post); - body_str = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(body_enc); - g_free(pre); - g_free(post); - - serv_got_typing_stopped(gc, who); - imdata->gc = gc; - imdata->who = who; - imdata->msg = body_str; - imdata->flags = flags & ~PURPLE_MESSAGE_SEND; - imdata->when = time(NULL); - purple_timeout_add(0, msn_send_me_im, imdata); - } + return -E2BIG; + } - msn_message_unref(msg); - } else { - /*send Offline Instant Message,only to MSN Passport User*/ - char *friendname; + msg = msn_message_new_plain(msgtext); + msg->remote_user = g_strdup(who); + msn_message_set_header(msg, "X-MMS-IM-Format", msgformat); - purple_debug_info("msn", "prepare to send offline Message\n"); + g_free(msgformat); + g_free(msgtext); - friendname = msn_encode_mime(purple_account_get_username(account)); - msn_oim_prep_send_msg_info(session->oim, - purple_account_get_username(account), - friendname, who, msgtext); - msn_oim_send_msg(session->oim); + purple_debug_info("msn", "prepare to send online Message\n"); + if (g_ascii_strcasecmp(who, username)) + { + if (flags & PURPLE_MESSAGE_AUTO_RESP) { + msn_message_set_flag(msg, 'U'); + } - g_free(msgformat); - g_free(msgtext); - g_free(friendname); + if (msn_user_is_yahoo(account, who) || !(msn_user_is_online(account, who) || swboard != NULL)) { + /*we send the online and offline Message to Yahoo User via UBM*/ + purple_debug_info("msn", "send to Yahoo User\n"); + msn_notification_send_uum(session, msg); + } else { + purple_debug_info("msn", "send via switchboard\n"); + msn_send_im_message(session, msg); + } + } + else + { + char *body_str, *body_enc, *pre, *post; + const char *format; + MsnIMData *imdata = g_new0(MsnIMData, 1); + /* + * In MSN, you can't send messages to yourself, so + * we'll fake like we received it ;) + */ + body_str = msn_message_to_string(msg); + body_enc = g_markup_escape_text(body_str, -1); + g_free(body_str); + + format = msn_message_get_header_value(msg, "X-MMS-IM-Format"); + msn_parse_format(format, &pre, &post); + body_str = g_strdup_printf("%s%s%s", pre ? pre : "", + body_enc ? body_enc : "", post ? post : ""); + g_free(body_enc); + g_free(pre); + g_free(post); + + serv_got_typing_stopped(gc, who); + imdata->gc = gc; + imdata->who = who; + imdata->msg = body_str; + imdata->flags = flags & ~PURPLE_MESSAGE_SEND; + imdata->when = time(NULL); + purple_timeout_add(0, msn_send_me_im, imdata); } + msn_message_unref(msg); + return 1; } -- cgit v1.2.1 From 5ec9a6ce9c9aa4cf9f23669c541257fd9b60a3ec Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 5 Feb 2012 21:53:01 +0000 Subject: Correctly fallback to a federated contact if a contact also has a passport address but that address is not messenger enabled. Fixes #14641. --- libpurple/protocols/msn/contact.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/libpurple/protocols/msn/contact.c b/libpurple/protocols/msn/contact.c index f85ba37c56..0f98b080a5 100644 --- a/libpurple/protocols/msn/contact.c +++ b/libpurple/protocols/msn/contact.c @@ -740,6 +740,20 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) } passportName = xmlnode_get_child(contactInfo, "passportName"); + if (passportName != NULL) { + xmlnode *messenger_user; + /* ignore non-messenger contacts */ + if ((messenger_user = xmlnode_get_child(contactInfo, "isMessengerUser"))) { + char *is_messenger_user = xmlnode_get_data(messenger_user); + + if (is_messenger_user && !strcmp(is_messenger_user, "false")) { + passportName = NULL; + } + + g_free(is_messenger_user); + } + } + if (passportName == NULL) { xmlnode *emailsNode, *contactEmailNode, *emailNode; xmlnode *messengerEnabledNode; @@ -773,19 +787,6 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) } } } else { - xmlnode *messenger_user; - /* ignore non-messenger contacts */ - if ((messenger_user = xmlnode_get_child(contactInfo, "isMessengerUser"))) { - char *is_messenger_user = xmlnode_get_data(messenger_user); - - if (is_messenger_user && !strcmp(is_messenger_user, "false")) { - g_free(is_messenger_user); - continue; - } - - g_free(is_messenger_user); - } - passport = xmlnode_get_data(passportName); } -- cgit v1.2.1 From c476dda810c8743d86e574919c96fb72d2277e64 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 6 Feb 2012 00:52:44 +0000 Subject: ChangeLog those last two changes. Fixes #14302. Refs #14753. --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index f1971e1d6b..64d5fae6d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,8 @@ version 3.0.0 (??/??/????): MSN: * Fix file transfer with older Mac MSN clients. * Support file transfers up to ~9 EiB. + * Support new protocol version MSNP18. (#14753) + * Fix messages to offline contacts. (#14302) MXit: * Remove all reference to Hidden Number. -- cgit v1.2.1 From b8e009590a6036145bffc345ab6e936c1c95b373 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 6 Feb 2012 02:45:16 +0000 Subject: Add support for conversation-extended signals in Finch. Fixes #14818. --- finch/Makefile.am | 2 ++ finch/gntblist.c | 51 +++------------------------------------------------ finch/gntconv.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ finch/gntconv.h | 1 + 4 files changed, 50 insertions(+), 48 deletions(-) diff --git a/finch/Makefile.am b/finch/Makefile.am index 85502d3015..be23168ad1 100644 --- a/finch/Makefile.am +++ b/finch/Makefile.am @@ -27,6 +27,7 @@ finch_SOURCES = \ gntidle.c \ gntlog.c \ gntmedia.c \ + gntmenuutil.c \ gntnotify.c \ gntplugin.c \ gntpounce.c \ @@ -49,6 +50,7 @@ finch_headers = \ gntidle.h \ gntlog.h \ gntmedia.h \ + gntmenuutil.h \ gntnotify.h \ gntplugin.h \ gntpounce.h \ diff --git a/finch/gntblist.c b/finch/gntblist.c index 31612b6f79..1f5a9fd66b 100644 --- a/finch/gntblist.c +++ b/finch/gntblist.c @@ -50,6 +50,7 @@ #include "gntmenu.h" #include "gntmenuitem.h" #include "gntmenuitemcheck.h" +#include "gntmenuutil.h" #include "gntpounce.h" #include "gntstyle.h" #include "gnttree.h" @@ -1071,46 +1072,6 @@ selection_activate(GntWidget *widget, FinchBlist *ggblist) } } -static void -context_menu_callback(GntMenuItem *item, gpointer data) -{ - PurpleMenuAction *action = data; - PurpleBlistNode *node = ggblist->cnode; - if (action) { - void (*callback)(PurpleBlistNode *, gpointer); - callback = (void (*)(PurpleBlistNode *, gpointer)) - purple_menu_action_get_callback(action); - if (callback) - callback(node, purple_menu_action_get_data(action)); - else - return; - } -} - -static void -gnt_append_menu_action(GntMenu *menu, PurpleMenuAction *action, gpointer parent) -{ - GList *list; - GntMenuItem *item; - - if (action == NULL) - return; - - item = gnt_menuitem_new(purple_menu_action_get_label(action)); - if (purple_menu_action_get_callback(action)) - gnt_menuitem_set_callback(GNT_MENU_ITEM(item), context_menu_callback, action); - gnt_menu_add_item(menu, GNT_MENU_ITEM(item)); - - list = purple_menu_action_get_children(action); - - if (list) { - GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); - gnt_menuitem_set_submenu(item, GNT_MENU(sub)); - for (; list; list = list->next) - gnt_append_menu_action(GNT_MENU(sub), list->data, action); - } -} - static void append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) { @@ -1127,9 +1088,7 @@ append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) if (!act) continue; purple_menu_action_set_data(act, node); - gnt_append_menu_action(menu, act, NULL); - g_signal_connect_swapped(G_OBJECT(menu), "destroy", - G_CALLBACK(purple_menu_action_free), act); + gnt_append_menu_action(menu, act, node); } } @@ -1139,8 +1098,6 @@ add_custom_action(GntMenu *menu, const char *label, PurpleCallback callback, { PurpleMenuAction *action = purple_menu_action_new(label, callback, data, NULL); gnt_append_menu_action(menu, action, NULL); - g_signal_connect_swapped(G_OBJECT(menu), "destroy", - G_CALLBACK(purple_menu_action_free), action); } static void @@ -1379,9 +1336,7 @@ append_extended_menu(GntMenu *menu, PurpleBlistNode *node) for (iter = purple_blist_node_get_extended_menu(node); iter; iter = g_list_delete_link(iter, iter)) { - gnt_append_menu_action(menu, iter->data, NULL); - g_signal_connect_swapped(G_OBJECT(menu), "destroy", - G_CALLBACK(purple_menu_action_free), iter->data); + gnt_append_menu_action(menu, iter->data, node); } } diff --git a/finch/gntconv.c b/finch/gntconv.c index 4d194c0e47..368719d123 100644 --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -52,6 +52,7 @@ #include "gntmenu.h" #include "gntmenuitem.h" #include "gntmenuitemcheck.h" +#include "gntmenuutil.h" #include "gntstyle.h" #include "gnttextview.h" #include "gnttree.h" @@ -403,6 +404,30 @@ cleared_message_history_cb(PurpleConversation *conv, gpointer data) gnt_text_view_clear(GNT_TEXT_VIEW(ggc->tv)); } +static void +gg_extended_menu(FinchConv *ggc) +{ + GntWidget *sub; + GList *list; + + sub = gnt_menu_new(GNT_MENU_POPUP); + gnt_menuitem_set_submenu(ggc->plugins, GNT_MENU(sub)); + + for (list = purple_conversation_get_extended_menu(ggc->active_conv); + list; list = g_list_delete_link(list, list)) + { + gnt_append_menu_action(GNT_MENU(sub), list->data, ggc->active_conv); + } +} + +static void +conv_updated(PurpleConversation *conv, PurpleConvUpdateType type) +{ + if (type == PURPLE_CONV_UPDATE_FEATURES) { + gg_extended_menu(purple_conversation_get_ui_data(conv)); + } +} + static void clear_scrollback_cb(GntMenuItem *item, gpointer ggconv) { @@ -594,6 +619,12 @@ invite_cb(GntMenuItem *item, gpointer ggconv) purple_conv_chat_invite_user(PURPLE_CONV_CHAT(conv), NULL, NULL, TRUE); } +static void +plugin_changed_cb(PurplePlugin *p, gpointer data) +{ + gg_extended_menu(data); +} + static void gg_create_menu(FinchConv *ggc) { @@ -665,6 +696,12 @@ gg_create_menu(FinchConv *ggc) !(ggc->flags & FINCH_CONV_NO_SOUND)); gnt_menu_add_item(GNT_MENU(sub), item); gnt_menuitem_set_callback(item, toggle_sound_cb, ggc); + + item = gnt_menuitem_new(_("Plugins")); + gnt_menu_add_item(GNT_MENU(menu), item); + ggc->plugins = item; + + gg_extended_menu(ggc); } static void @@ -876,6 +913,11 @@ finch_create_conversation(PurpleConversation *conv) purple_signal_connect(purple_cmds_get_handle(), "cmd-removed", ggc, G_CALLBACK(cmd_removed_cb), ggc); + purple_signal_connect(purple_plugins_get_handle(), "plugin-load", ggc, + PURPLE_CALLBACK(plugin_changed_cb), ggc); + purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", ggc, + PURPLE_CALLBACK(plugin_changed_cb), ggc); + g_free(title); gnt_box_give_focus_to_child(GNT_BOX(ggc->window), ggc->entry); g_signal_connect(G_OBJECT(ggc->window), "gained-focus", G_CALLBACK(gained_focus_cb), ggc); @@ -1475,6 +1517,8 @@ void finch_conversation_init() PURPLE_CALLBACK(chat_left_cb), NULL); purple_signal_connect(purple_conversations_get_handle(), "cleared-message-history", finch_conv_get_handle(), PURPLE_CALLBACK(cleared_message_history_cb), NULL); + purple_signal_connect(purple_conversations_get_handle(), "conversation-updated", finch_conv_get_handle(), + PURPLE_CALLBACK(conv_updated), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", finch_conv_get_handle(), PURPLE_CALLBACK(buddy_signed_on_off), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", finch_conv_get_handle(), diff --git a/finch/gntconv.h b/finch/gntconv.h index 6fb9f34d47..3f512a9a80 100644 --- a/finch/gntconv.h +++ b/finch/gntconv.h @@ -59,6 +59,7 @@ struct _FinchConv GntWidget *tv; /* text-view */ GntWidget *menu; GntWidget *info; + GntMenuItem *plugins; FinchConversationFlag flags; union -- cgit v1.2.1 From 0309bbc51b8beead60c720595857a4c55a54d586 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 6 Feb 2012 21:44:41 +0000 Subject: I should probably add these files, too... Refs #14818. --- finch/gntmenuutil.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++ finch/gntmenuutil.h | 49 +++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 finch/gntmenuutil.c create mode 100644 finch/gntmenuutil.h diff --git a/finch/gntmenuutil.c b/finch/gntmenuutil.c new file mode 100644 index 0000000000..6be90ff0c7 --- /dev/null +++ b/finch/gntmenuutil.c @@ -0,0 +1,79 @@ +/** + * @file gntmenuutil.c GNT Menu Utility Functions + * @ingroup finch + */ + +/* finch + * + * Finch is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include +#include "finch.h" + +#include "gnt.h" +#include "gntmenu.h" +#include "gntmenuitem.h" +#include "gntmenuutil.h" + +static void +context_menu_callback(GntMenuItem *item, gpointer data) +{ + PurpleMenuAction *action = data; + if (action) { + void (*callback)(gpointer, gpointer); + callback = (void (*)(gpointer, gpointer)) + purple_menu_action_get_callback(action); + if (callback) { + gpointer ctx = g_object_get_data(G_OBJECT(item), "menuctx"); + callback(ctx, purple_menu_action_get_data(action)); + } + } +} + +void +gnt_append_menu_action(GntMenu *menu, PurpleMenuAction *action, gpointer ctx) +{ + GList *list; + GntMenuItem *item; + + if (action == NULL) + return; + + item = gnt_menuitem_new(purple_menu_action_get_label(action)); + if (purple_menu_action_get_callback(action)) { + gnt_menuitem_set_callback(item, context_menu_callback, action); + g_object_set_data(G_OBJECT(item), "menuctx", ctx); + } + gnt_menu_add_item(menu, item); + + list = purple_menu_action_get_children(action); + + if (list) { + GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); + gnt_menuitem_set_submenu(item, GNT_MENU(sub)); + for (; list; list = g_list_delete_link(list, list)) + gnt_append_menu_action(GNT_MENU(sub), list->data, action); + purple_menu_action_set_children(action, NULL); + } + + g_signal_connect_swapped(G_OBJECT(menu), "destroy", + G_CALLBACK(purple_menu_action_free), action); +} + diff --git a/finch/gntmenuutil.h b/finch/gntmenuutil.h new file mode 100644 index 0000000000..e5c38bf70d --- /dev/null +++ b/finch/gntmenuutil.h @@ -0,0 +1,49 @@ +/** + * @file gntmenuutil.h GNT Menu Utility Functions + * @ingroup finch + */ + +/* finch + * + * Finch is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +#ifndef _GNT_MENUUTIL_H +#define _GNT_MENUUTIL_H + +#include +#include + +/*************************************************************************** + * @name GNT Menu Utility Functions + ***************************************************************************/ +/*@{*/ + +/** + * Add a PurpleMenuAction to a GntMenu. + * + * @param menu the GntMenu to add to + * @param action the PurpleMenuAction to add + * @param ctx the callback context, passed as the first argument to + * the PurpleMenuAction's PurpleCallback function. + */ +void gnt_append_menu_action(GntMenu *menu, PurpleMenuAction *action, gpointer ctx); + +/*@}*/ + +#endif -- cgit v1.2.1 From cb7f2032890dad82191fd1d385d4459790a7259c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 6 Feb 2012 22:24:04 +0000 Subject: Drop support for protocols below 18. --- libpurple/protocols/msn/contact.c | 25 ++++++++++---- libpurple/protocols/msn/msn.c | 2 +- libpurple/protocols/msn/notification.c | 62 +++++++++++----------------------- libpurple/protocols/msn/session.c | 9 +++-- libpurple/protocols/msn/state.c | 17 ++++------ libpurple/protocols/msn/switchboard.c | 14 +++----- 6 files changed, 52 insertions(+), 77 deletions(-) diff --git a/libpurple/protocols/msn/contact.c b/libpurple/protocols/msn/contact.c index 0f98b080a5..669c9d0a0c 100644 --- a/libpurple/protocols/msn/contact.c +++ b/libpurple/protocols/msn/contact.c @@ -865,6 +865,21 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) g_free(alias); } +static void +msn_parse_addressbook_circles(MsnSession *session, xmlnode *node) +{ + xmlnode *ticket; + + /* TODO: Parse groups */ + + ticket = xmlnode_get_child(node, "CircleTicket"); + if (ticket) { + char *data = xmlnode_get_data(ticket); + msn_notification_send_circle_auth(session, data); + g_free(data); + } +} + static gboolean msn_parse_addressbook(MsnSession *session, xmlnode *node) { @@ -956,13 +971,9 @@ msn_parse_addressbook(MsnSession *session, xmlnode *node) g_free(tmp); } - circleNode = xmlnode_get_child(result, "CircleResult/CircleTicket"); - if (circleNode != NULL && session->protocol_ver >= 18) { - char *data; - - data = xmlnode_get_data(circleNode); - msn_notification_send_circle_auth(session, data); - g_free(data); + circleNode = xmlnode_get_child(result, "CircleResult"); + if (circleNode != NULL) { + msn_parse_addressbook_circles(session, circleNode); } return TRUE; diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index 176e8870e0..17e3362c00 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -1223,7 +1223,7 @@ msn_actions(PurplePlugin *plugin, gpointer context) m = g_list_append(m, act); m = g_list_append(m, NULL); - if (session->enable_mpop && session->protocol_ver >= 16) + if (session->enable_mpop) { act = purple_plugin_action_new(_("View Locations..."), msn_show_locations); diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index 5f543bb695..7fb565595a 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -164,10 +164,7 @@ msn_got_login_params(MsnSession *session, const char *ticket, const char *respon msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_END); - if (session->protocol_ver >= 16) - trans = msn_transaction_new(cmdproc, "USR", "SSO S %s %s %s", ticket, response, session->guid); - else - trans = msn_transaction_new(cmdproc, "USR", "SSO S %s %s", ticket, response); + trans = msn_transaction_new(cmdproc, "USR", "SSO S %s %s %s", ticket, response, session->guid); msn_cmdproc_send_trans(cmdproc, trans); } @@ -401,10 +398,7 @@ ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) * command and we are processing it */ if (cmd->payload == NULL) { cmdproc->last_cmd->payload_cb = msg_cmd_post; - if (cmdproc->session->protocol_ver >= 16) - cmd->payload_len = atoi(cmd->params[5]); - else - cmd->payload_len = atoi(cmd->params[3]); + cmd->payload_len = atoi(cmd->params[5]); } else { g_return_if_fail(cmd->payload_cb != NULL); @@ -1053,7 +1047,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) networkid = atoi(cmd->params[3]); friendly = g_strdup(purple_url_decode(cmd->params[4])); clientid = strtoul(cmd->params[5], &extcap_str, 10); - if (session->protocol_ver >= 16 && extcap_str && *extcap_str) + if (extcap_str && *extcap_str) extcaps = strtoul(extcap_str+1, NULL, 10); else extcaps = 0; @@ -1067,7 +1061,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) networkid = atoi(cmd->params[3]); friendly = g_strdup(purple_url_decode(cmd->params[4])); clientid = strtoul(cmd->params[5], &extcap_str, 10); - if (session->protocol_ver >= 16 && extcap_str && *extcap_str) + if (extcap_str && *extcap_str) extcaps = strtoul(extcap_str+1, NULL, 10); else extcaps = 0; @@ -1080,7 +1074,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) networkid = atoi(cmd->params[3]); friendly = g_strdup(purple_url_decode(cmd->params[4])); clientid = strtoul(cmd->params[5], &extcap_str, 10); - if (session->protocol_ver >= 16 && extcap_str && *extcap_str) + if (extcap_str && *extcap_str) extcaps = strtoul(extcap_str+1, NULL, 10); else extcaps = 0; @@ -1088,7 +1082,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) /* MSNP8+ with Display Picture object */ friendly = g_strdup(purple_url_decode(cmd->params[3])); clientid = strtoul(cmd->params[4], &extcap_str, 10); - if (session->protocol_ver >= 16 && extcap_str && *extcap_str) + if (extcap_str && *extcap_str) extcaps = strtoul(extcap_str+1, NULL, 10); else extcaps = 0; @@ -1098,7 +1092,7 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) /* MSNP8+ without Display Picture object */ friendly = g_strdup(purple_url_decode(cmd->params[3])); clientid = strtoul(cmd->params[4], &extcap_str, 10); - if (session->protocol_ver >= 16 && extcap_str && *extcap_str) + if (extcap_str && *extcap_str) extcaps = strtoul(extcap_str+1, NULL, 10); else extcaps = 0; @@ -1267,16 +1261,9 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) session = cmdproc->session; - state = cmd->params[0]; - if (session->protocol_ver >= 18) { - const char *tmp = cmd->params[1]; - msn_parse_user(tmp, &passport, &networkid); - friendly = purple_url_decode(cmd->params[2]); - } else { - passport = cmd->params[1]; - networkid = atoi(cmd->params[2]); - friendly = purple_url_decode(cmd->params[3]); - } + state = cmd->params[0]; + msn_parse_user(cmd->params[1], &passport, &networkid); + friendly = purple_url_decode(cmd->params[2]); user = msn_userlist_find_user(session->userlist, passport); if (user == NULL) return; @@ -1297,7 +1284,7 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) } clientid = strtoul(cmd->params[4], &extcap_str, 10); - if (session->protocol_ver >= 16 && extcap_str && *extcap_str) + if (extcap_str && *extcap_str) extcaps = strtoul(extcap_str+1, NULL, 10); else extcaps = 0; @@ -1311,8 +1298,7 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) msn_user_set_state(user, state); msn_user_update(user); - if (session->protocol_ver >= 18) - g_free(passport); + g_free(passport); } #if 0 @@ -1733,23 +1719,19 @@ ubx_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, session = cmdproc->session; - if (session->protocol_ver >= 18) { - str = cmd->params[0]; - msn_parse_user(str, &passport, &network); - } else { - passport = cmd->params[0]; - } + msn_parse_user(cmd->params[0], &passport, &network); user = msn_userlist_find_user(session->userlist, passport); + if (user == NULL) { - char *str = g_strndup(payload, len); + str = g_strndup(payload, len); purple_debug_info("msn", "unknown user %s, payload is %s\n", passport, str); + g_free(passport); g_free(str); return; } - if (session->protocol_ver >= 18) - g_free(passport); + g_free(passport); /* Free any existing media info for this user */ if (user->extinfo) { @@ -1797,10 +1779,7 @@ ubx_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { purple_debug_misc("msn", "UBX received.\n"); cmdproc->last_cmd->payload_cb = ubx_cmd_post; - if (cmdproc->session->protocol_ver >= 18) - cmd->payload_len = atoi(cmd->params[1]); - else - cmd->payload_len = atoi(cmd->params[2]); + cmd->payload_len = atoi(cmd->params[1]); } static void @@ -1845,10 +1824,7 @@ void msn_notification_send_uux_endpointdata(MsnSession *session) epDataNode = xmlnode_new("EndpointData"); capNode = xmlnode_new_child(epDataNode, "Capabilities"); - if (session->protocol_ver >= 16) - caps = g_strdup_printf("%d:%02d", MSN_CLIENT_ID_CAPABILITIES, MSN_CLIENT_ID_EXT_CAPS); - else - caps = g_strdup_printf("%d", MSN_CLIENT_ID_CAPABILITIES); + caps = g_strdup_printf("%d:%02d", MSN_CLIENT_ID_CAPABILITIES, MSN_CLIENT_ID_EXT_CAPS); xmlnode_insert_data(capNode, caps, -1); g_free(caps); diff --git a/libpurple/protocols/msn/session.c b/libpurple/protocols/msn/session.c index d177e453d9..bcd684f036 100644 --- a/libpurple/protocols/msn/session.c +++ b/libpurple/protocols/msn/session.c @@ -491,11 +491,10 @@ msn_session_finish_login(MsnSession *session) msn_session_sync_users(session); } - if (session->protocol_ver >= 16) { - /* TODO: Send this when updating status instead? */ - msn_notification_send_uux_endpointdata(session); - msn_notification_send_uux_private_endpointdata(session); - } + /* TODO: Send this when updating status instead? */ + msn_notification_send_uux_endpointdata(session); + msn_notification_send_uux_private_endpointdata(session); + msn_change_status(session); } diff --git a/libpurple/protocols/msn/state.c b/libpurple/protocols/msn/state.c index b82d75b986..7157cfcd13 100644 --- a/libpurple/protocols/msn/state.c +++ b/libpurple/protocols/msn/state.c @@ -186,7 +186,7 @@ msn_set_psm(MsnSession *session) statusline_stripped = purple_markup_strip_html(statusline); media = create_media_string(presence); g_free(session->psm); - session->psm = msn_build_psm(statusline_stripped, media, session->protocol_ver >= 16 ? session->guid : NULL, session->protocol_ver); + session->psm = msn_build_psm(statusline_stripped, media, session->guid, session->protocol_ver); payload = session->psm; @@ -245,10 +245,8 @@ msn_change_status(MsnSession *session) if (msnobj == NULL) { - if (session->protocol_ver >= 16) - trans = msn_transaction_new(cmdproc, "CHG", "%s %u:%02u 0", state_text, caps, MSN_CLIENT_ID_EXT_CAPS); - else - trans = msn_transaction_new(cmdproc, "CHG", "%s %u", state_text, caps); + trans = msn_transaction_new(cmdproc, "CHG", "%s %u:%02u 0", state_text, + caps, MSN_CLIENT_ID_EXT_CAPS); } else { @@ -256,12 +254,9 @@ msn_change_status(MsnSession *session) msnobj_str = msn_object_to_string(msnobj); - if (session->protocol_ver >= 16) - trans = msn_transaction_new(cmdproc, "CHG", "%s %u:%02u %s", state_text, - caps, MSN_CLIENT_ID_EXT_CAPS, purple_url_encode(msnobj_str)); - else - trans = msn_transaction_new(cmdproc, "CHG", "%s %u %s", state_text, - caps, purple_url_encode(msnobj_str)); + trans = msn_transaction_new(cmdproc, "CHG", "%s %u:%02u %s", state_text, + caps, MSN_CLIENT_ID_EXT_CAPS, + purple_url_encode(msnobj_str)); g_free(msnobj_str); } diff --git a/libpurple/protocols/msn/switchboard.c b/libpurple/protocols/msn/switchboard.c index b459797613..2cd3388466 100644 --- a/libpurple/protocols/msn/switchboard.c +++ b/libpurple/protocols/msn/switchboard.c @@ -707,10 +707,7 @@ static void ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { purple_debug_misc("msn", "get UBM...\n"); - if (cmdproc->session->protocol_ver >= 16) - cmd->payload_len = atoi(cmd->params[5]); - else - cmd->payload_len = atoi(cmd->params[3]); + cmd->payload_len = atoi(cmd->params[5]); cmdproc->last_cmd->payload_cb = msg_cmd_post; } @@ -867,12 +864,9 @@ connect_cb(MsnServConn *servconn) swboard = cmdproc->data; g_return_if_fail(swboard != NULL); - if (servconn->session->protocol_ver >= 16) - username = g_strdup_printf("%s;{%s}", - purple_account_get_username(account), - servconn->session->guid); - else - username = g_strdup(purple_account_get_username(account)); + username = g_strdup_printf("%s;{%s}", + purple_account_get_username(account), + servconn->session->guid); if (msn_switchboard_is_invited(swboard)) { -- cgit v1.2.1 From a33b58a8b934f27ac0ede942552dda2b266078b1 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 6 Feb 2012 22:28:41 +0000 Subject: ChangeLog conversation-extended patch. Refs #14818. committer: Elliott Sales de Andrade --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 64d5fae6d9..0a365733f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 3.0.0 (??/??/????): + Finch: + * Support the conversation-extended signal for extending the + conversation menu. (Howard Chu) (#14818) + libpurple: * Support new connection states and signals for NetworkManager 0.9+. (Dan Williams) (#13859) -- cgit v1.2.1 From 12a505ca5672d5f87e3ab1f96cf7ded3770cc3eb Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 6 Feb 2012 23:08:34 +0000 Subject: Fix indices for client capabilities and display pics. --- libpurple/protocols/msn/notification.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index 7fb565595a..cff0147691 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -1273,9 +1273,9 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly); } - if (cmd->param_count == 6) + if (cmd->param_count == 5) { - msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5])); + msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[4])); msn_user_set_object(user, msnobj); } else @@ -1283,7 +1283,7 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) msn_user_set_object(user, NULL); } - clientid = strtoul(cmd->params[4], &extcap_str, 10); + clientid = strtoul(cmd->params[3], &extcap_str, 10); if (extcap_str && *extcap_str) extcaps = strtoul(extcap_str+1, NULL, 10); else -- cgit v1.2.1 From 59a91794ec7830c49a2b174ea21c086fd75b61ea Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 13 Feb 2012 03:05:53 +0000 Subject: Adjust this debug statement. listener_ip is based off of the bos connection fd, not the listener_fd, so it's more useful to log info about the bos conn fd. --- libpurple/protocols/oscar/peer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/oscar/peer.c b/libpurple/protocols/oscar/peer.c index 36cd573fda..686c4dc90c 100644 --- a/libpurple/protocols/oscar/peer.c +++ b/libpurple/protocols/oscar/peer.c @@ -708,10 +708,12 @@ peer_connection_establish_listener_cb(int listenerfd, gpointer data) { const guchar *ip_atoi = purple_network_ip_atoi(listener_ip); if (ip_atoi == NULL) { - purple_debug_error("oscar", "Cannot send file. atoi(%s) failed.\n" - "Other possibly useful information: fd = %d, port = %d\n", - listener_ip ? listener_ip : "(null!)", conn->listenerfd, - listener_port); + purple_debug_error("oscar", "Cannot send file. " + "purple_network_ip_atoi(%s) returned NULL. " + "fd=%d. is_ssl=%d\n", + listener_ip ? listener_ip : "(null!)", + bos_conn->gsc ? bos_conn->gsc->fd : bos_conn->fd, + bos_conn->gsc ? 1 : 0); purple_xfer_cancel_local(conn->xfer); return; } -- cgit v1.2.1 From c02c0710ddc83b07e8637f3ec25feae8917168dc Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 13 Feb 2012 03:11:11 +0000 Subject: We don't need to abort the file transfer attempt entirely when this happens. We can just try the next connection method (both users connect to a 3rd party proxy) --- libpurple/protocols/oscar/peer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libpurple/protocols/oscar/peer.c b/libpurple/protocols/oscar/peer.c index 686c4dc90c..fab9ddaff8 100644 --- a/libpurple/protocols/oscar/peer.c +++ b/libpurple/protocols/oscar/peer.c @@ -708,13 +708,13 @@ peer_connection_establish_listener_cb(int listenerfd, gpointer data) { const guchar *ip_atoi = purple_network_ip_atoi(listener_ip); if (ip_atoi == NULL) { - purple_debug_error("oscar", "Cannot send file. " - "purple_network_ip_atoi(%s) returned NULL. " + purple_debug_error("oscar", "Can't ask peer to connect to us " + "because purple_network_ip_atoi(%s) returned NULL. " "fd=%d. is_ssl=%d\n", - listener_ip ? listener_ip : "(null!)", + listener_ip ? listener_ip : "(null)", bos_conn->gsc ? bos_conn->gsc->fd : bos_conn->fd, bos_conn->gsc ? 1 : 0); - purple_xfer_cancel_local(conn->xfer); + peer_connection_trynext(conn); return; } aim_im_sendch2_sendfile_requestdirect(od, -- cgit v1.2.1 From b413b32d6135855117941a07f32435ea5a6460cc Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 13 Feb 2012 03:19:08 +0000 Subject: Move this check up a level so that it affects direct connections, too. I think this will fix the crash reported in http://trac.adium.im/ticket/15839 Still not sure why ip_atoi fails here. --- libpurple/protocols/oscar/peer.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/libpurple/protocols/oscar/peer.c b/libpurple/protocols/oscar/peer.c index fab9ddaff8..6dd51ce4e7 100644 --- a/libpurple/protocols/oscar/peer.c +++ b/libpurple/protocols/oscar/peer.c @@ -656,6 +656,7 @@ peer_connection_establish_listener_cb(int listenerfd, gpointer data) char *tmp; FlapConnection *bos_conn; const char *listener_ip; + const guchar *ip_atoi; unsigned short listener_port; conn = data; @@ -690,11 +691,28 @@ peer_connection_establish_listener_cb(int listenerfd, gpointer data) listener_ip = purple_network_get_my_ip(bos_conn->gsc->fd); else listener_ip = purple_network_get_my_ip(bos_conn->fd); + + ip_atoi = purple_network_ip_atoi(listener_ip); + if (ip_atoi == NULL) { + /* Could not convert IP to 4 byte array--weird, but this does + happen for some users (#4829, Adium #15839). Maybe they're + connecting with IPv6...? Maybe through a proxy? */ + purple_debug_error("oscar", "Can't ask peer to connect to us " + "because purple_network_ip_atoi(%s) returned NULL. " + "fd=%d. is_ssl=%d\n", + listener_ip ? listener_ip : "(null)", + bos_conn->gsc ? bos_conn->gsc->fd : bos_conn->fd, + bos_conn->gsc ? 1 : 0); + peer_connection_trynext(conn); + return; + } + listener_port = purple_network_get_port_from_fd(conn->listenerfd); + if (conn->type == OSCAR_CAPABILITY_DIRECTIM) { aim_im_sendch2_odc_requestdirect(od, - conn->cookie, conn->bn, purple_network_ip_atoi(listener_ip), + conn->cookie, conn->bn, ip_atoi, listener_port, ++conn->lastrequestnumber); /* Print a message to a local conversation window */ @@ -706,17 +724,6 @@ peer_connection_establish_listener_cb(int listenerfd, gpointer data) } else if (conn->type == OSCAR_CAPABILITY_SENDFILE) { - const guchar *ip_atoi = purple_network_ip_atoi(listener_ip); - if (ip_atoi == NULL) { - purple_debug_error("oscar", "Can't ask peer to connect to us " - "because purple_network_ip_atoi(%s) returned NULL. " - "fd=%d. is_ssl=%d\n", - listener_ip ? listener_ip : "(null)", - bos_conn->gsc ? bos_conn->gsc->fd : bos_conn->fd, - bos_conn->gsc ? 1 : 0); - peer_connection_trynext(conn); - return; - } aim_im_sendch2_sendfile_requestdirect(od, conn->cookie, conn->bn, ip_atoi, -- cgit v1.2.1 From de10f49af8f31a6e7cd64f6e99be313cf7692d52 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Wed, 15 Feb 2012 09:49:00 +0000 Subject: If there are no objections, these changes will get released in 2.10.2 --- ChangeLog | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a365733f5..76fe924d92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,14 +5,7 @@ version 3.0.0 (??/??/????): * Support the conversation-extended signal for extending the conversation menu. (Howard Chu) (#14818) - libpurple: - * Support new connection states and signals for NetworkManager 0.9+. - (Dan Williams) (#13859) - AIM and ICQ: - * Allow signing on with usernames containing periods and - underscores. (#13500) - * Allow adding buddies containing periods and underscores. (#13500) * Don't try to format ICQ usernames entered as email addresses. Gets rid of an "Unable to format username" error at login. (#13883) * Make buddy list management code more efficient. (Oliver) (#4816) -- cgit v1.2.1 From 67e9a19a170ce5d1d906af1eb6c7a56a09f80607 Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Wed, 15 Feb 2012 22:29:29 +0000 Subject: *** Plucked rev 49f0be55b564a30f6c390ddce33a4a56a01f0984 (darkrain42@pidgin.im): gtkdisco: Prevent a NULL dereference crash --- pidgin/plugins/disco/gtkdisco.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pidgin/plugins/disco/gtkdisco.c b/pidgin/plugins/disco/gtkdisco.c index 1f7fe1eae6..5cdcd5c757 100644 --- a/pidgin/plugins/disco/gtkdisco.c +++ b/pidgin/plugins/disco/gtkdisco.c @@ -462,6 +462,8 @@ disco_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path, gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), &iter, SERVICE_COLUMN, &val); service = g_value_get_pointer(&val); + if (!service) + return FALSE; switch (service->type) { case XMPP_DISCO_SERVICE_TYPE_UNSET: -- cgit v1.2.1 From f8552a9244236e619db49c95e9e4958ea0fbefd6 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sat, 18 Feb 2012 23:43:13 +0000 Subject: This change will be in 2.10.2 --- ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e72e00baf..76c8e3de0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,8 +6,6 @@ version 3.0.0 (??/??/????): conversation menu. (Howard Chu) (#14818) AIM and ICQ: - * Don't try to format ICQ usernames entered as email addresses. - Gets rid of an "Unable to format username" error at login. (#13883) * Make buddy list management code more efficient. (Oliver) (#4816) Bonjour: @@ -64,6 +62,8 @@ version 2.10.2 (02/22/2012): * Allow signing on with usernames containing periods and underscores. (#13500) * Allow adding buddies containing periods and underscores. (#13500) + * Don't try to format ICQ usernames entered as email addresses. + Gets rid of an "Unable to format username" error at login. (#13883) MSN: * Fix possible crashes caused by not validating incoming messages as -- cgit v1.2.1 From 593a538647e3f1f0887a9eb8ee476e2fdf9a3e0d Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sat, 18 Feb 2012 23:46:04 +0000 Subject: Add two friendly little checks --- libpurple/protocols/oscar/family_icbm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libpurple/protocols/oscar/family_icbm.c b/libpurple/protocols/oscar/family_icbm.c index 4f748c2679..a9ca23671f 100644 --- a/libpurple/protocols/oscar/family_icbm.c +++ b/libpurple/protocols/oscar/family_icbm.c @@ -650,6 +650,9 @@ aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *bn, GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; ByteStream hdrbs; + g_return_if_fail(bn != NULL); + g_return_if_fail(ip != NULL); + conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); if (conn == NULL) return; -- cgit v1.2.1 From 4fea95629c3a41bc21211fa4df25b7a51fc8653a Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sun, 19 Feb 2012 01:27:00 +0000 Subject: Call aim_ssi_cleanlist from within the feedbag code. Just want to make this function call more required, because I want the liboscar buddy list code to be able to assume that the list is "clean" --- libpurple/protocols/oscar/family_feedbag.c | 5 ++++- libpurple/protocols/oscar/oscar.c | 3 --- libpurple/protocols/oscar/oscar.h | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c index bf4bfd1e9a..36cebe4efe 100644 --- a/libpurple/protocols/oscar/family_feedbag.c +++ b/libpurple/protocols/oscar/family_feedbag.c @@ -769,7 +769,7 @@ static void cleanlist_ensure_utf8_data(struct aim_ssi_item *item, guint16 tlvtyp * @param od The oscar odion. * @return Return 0 if no errors, otherwise return the error number. */ -int aim_ssi_cleanlist(OscarData *od) +static int aim_ssi_cleanlist(OscarData *od) { struct aim_ssi_item *cur, *next; @@ -1336,6 +1336,9 @@ static int parsedata(OscarData *od, FlapConnection *conn, aim_module_t *mod, Fla for (cur=od->ssi.official.data; cur; cur=cur->next) aim_ssi_itemlist_add(&od->ssi.local, cur->name, cur->gid, cur->bid, cur->type, cur->data); + /* Clean the buddy list */ + aim_ssi_cleanlist(od); + od->ssi.received_data = TRUE; if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 96b0c71384..7696583026 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -3924,9 +3924,6 @@ static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame * purple_debug_info("oscar", "ssi: syncing local list and server list\n"); - /* Clean the buddy list */ - aim_ssi_cleanlist(od); - /*** Begin code for pruning buddies from local list if they're not in server list ***/ /* Buddies */ diff --git a/libpurple/protocols/oscar/oscar.h b/libpurple/protocols/oscar/oscar.h index 42e8a939a3..56f09255c5 100644 --- a/libpurple/protocols/oscar/oscar.h +++ b/libpurple/protocols/oscar/oscar.h @@ -940,7 +940,6 @@ int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *bn, const char *alias); int aim_ssi_editcomment(OscarData *od, const char *gn, const char *bn, const char *alias); int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn); -int aim_ssi_cleanlist(OscarData *od); int aim_ssi_deletelist(OscarData *od); int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny); int aim_ssi_setpresence(OscarData *od, guint32 presence); -- cgit v1.2.1 From 1ca2670bc353f9d71ad3333bfca5660f8fd2e920 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 20 Feb 2012 23:18:00 +0000 Subject: When deleting a group from the server stored buddy list, rebuild the list of group IDs in the master group (not in the group we just deleted--that doesn't make sense). This was a bug, but it seems like it probably didn't cause any harm. --- libpurple/protocols/oscar/family_feedbag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/oscar/family_feedbag.c b/libpurple/protocols/oscar/family_feedbag.c index 36cebe4efe..c1ef2c32f3 100644 --- a/libpurple/protocols/oscar/family_feedbag.c +++ b/libpurple/protocols/oscar/family_feedbag.c @@ -971,7 +971,7 @@ int aim_ssi_delgroup(OscarData *od, const char *group) aim_ssi_itemlist_del(&od->ssi.local, del); /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(&od->ssi.local, group); + aim_ssi_itemlist_rebuildgroup(&od->ssi.local, NULL); /* Sync our local list with the server list */ return aim_ssi_sync(od); -- cgit v1.2.1 From fc82b6683d4180a99de5457bebc9eb7411aad466 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 20 Feb 2012 23:52:41 +0000 Subject: Can I mark Casey and Ivan as retired? As always, any retried developers/transltors/crazy patch writers are more than welcome to return triumphantly. --- pidgin/gtkdialogs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index c24a3c1c05..4d4ae88b45 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -78,8 +78,6 @@ static const struct developer developers[] = { {"Hylke Bons", N_("artist"), "hylkebons@gmail.com"}, {"Sadrul Habib Chowdhury", NULL, NULL}, {"Mark 'KingAnt' Doliner", NULL, "mark@kingant.net"}, - {"Casey Harkins", NULL, NULL}, - {"Ivan Komarov", NULL, "ivan.komarov@pidgin.im"}, {"Gary 'grim' Kramlich", NULL, "grim@pidgin.im"}, {"Richard 'rlaager' Laager", NULL, "rlaager@pidgin.im"}, {"Marcus 'malu' Lundblad", NULL, NULL}, @@ -112,12 +110,14 @@ static const struct developer retired_developers[] = { {"Herman Bloggs", N_("win32 port"), "herman@bluedigits.com"}, {"Thomas Butter", NULL, NULL}, /* feel free to not translate this */ - {N_("Ka-Hing Cheung"), NULL, NULL}, + {N_("Ka-Hing Cheung"), NULL, NULL}, {"Jim Duchek", N_("maintainer"), "jim@linuxpimps.com"}, {"Sean Egan", NULL, "sean.egan@gmail.com"}, {"Rob Flynn", N_("maintainer"), NULL}, {"Adam Fritzler", N_("libfaim maintainer"), NULL}, {"Christian 'ChipX86' Hammond", N_("webmaster"), NULL}, + {"Casey Harkins", NULL, NULL}, + {"Ivan Komarov", NULL, "ivan.komarov@pidgin.im"}, /* If "lazy bum" translates literally into a serious insult, use something else or omit it. */ {"Syd Logan", N_("hacker and designated driver [lazy bum]"), NULL}, {"Christopher 'siege' O'Brien", NULL, "taliesein@users.sf.net"}, -- cgit v1.2.1 From 77e8edfa2134809002c7fad87e23d3c0a1d0b5aa Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 04:05:51 +0000 Subject: Fix a leak in the Plugin Information window. These variables are set in the loop and should be freed there as well. --- pidgin/gtkdialogs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 4d4ae88b45..9dd2ec256a 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -824,14 +824,15 @@ void pidgin_dialogs_plugins_info(void) pver, pwebsite, pid, punloadable ? "No" : "Yes", ploaded ? "Yes" : "No"); + + g_free(pname); + g_free(pauthor); } plugins_info = pidgin_build_help_dialog(title, "plugins_info", str); g_signal_connect(G_OBJECT(plugins_info), "destroy", G_CALLBACK(gtk_widget_destroyed), &plugins_info); g_free(title); - g_free(pname); - g_free(pauthor); } static void -- cgit v1.2.1 From 00294acbbb6735ac3c4468cf2757b0b60dc80d3b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 04:07:32 +0000 Subject: Fix a minor GLib assert thing. --- pidgin/gtkdialogs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 9dd2ec256a..6181be049a 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -808,7 +808,8 @@ void pidgin_dialogs_plugins_info(void) plugin = (PurplePlugin *)l->data; pname = g_markup_escape_text(purple_plugin_get_name(plugin), -1); - pauthor = g_markup_escape_text(purple_plugin_get_author(plugin), -1); + if ((pauthor = (char *)purple_plugin_get_author(plugin)) != NULL) + pauthor = g_markup_escape_text(pauthor, -1); pver = purple_plugin_get_version(plugin); pwebsite = purple_plugin_get_homepage(plugin); pid = purple_plugin_get_id(plugin); -- cgit v1.2.1 From d28eb230206676a6635505b2cf5b8d874ef2fe78 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 04:41:29 +0000 Subject: Remove the automatic scroll-to-end when appending HTML to a webview. Conversations already do this using JS in the theme, and this only messes with the Help dialogs. --- pidgin/gtkconv.c | 7 +++++-- pidgin/gtkdialogs.c | 2 -- pidgin/gtkwebview.c | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 8beae73de7..5235921823 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -8212,6 +8212,7 @@ static gboolean add_message_history_to_gtkconv(gpointer data) { PidginConversation *gtkconv = data; + GtkWebView *webview = GTK_WEBVIEW(gtkconv->webview); int count = 0; int timer = gtkconv->attach.timer; time_t when = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkconv->entry), "attach-start-time")); @@ -8221,7 +8222,8 @@ add_message_history_to_gtkconv(gpointer data) while (gtkconv->attach.current && count < 100) { /* XXX: 100 is a random value here */ PurpleConvMessage *msg = gtkconv->attach.current->data; if (!im && when && when < purple_conversation_message_get_timestamp(msg)) { - gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "

"); + gtk_webview_append_html(webview, "

"); + gtk_webview_scroll_to_end(webview, TRUE); g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL); } pidgin_conv_write_conv( @@ -8268,7 +8270,8 @@ add_message_history_to_gtkconv(gpointer data) purple_conversation_message_get_flags(msg), purple_conversation_message_get_timestamp(msg)); } - gtk_webview_append_html(GTK_WEBVIEW(gtkconv->webview), "

"); + gtk_webview_append_html(webview, "

"); + gtk_webview_scroll_to_end(webview, TRUE); g_object_set_data(G_OBJECT(gtkconv->entry), "attach-start-time", NULL); } diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 6181be049a..d5530d75ce 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -456,8 +456,6 @@ pidgin_build_help_dialog(const char *title, const char *role, GString *string) gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); gtk_webview_append_html(GTK_WEBVIEW(webview), string->str); - /* TODO WEBKIT: This doesn't seem to stay at the top. */ - webkit_web_view_move_cursor(WEBKIT_WEB_VIEW(webview), GTK_MOVEMENT_BUFFER_ENDS, -1); button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, G_CALLBACK(destroy_win), win); diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 8e41fbc3f8..7c185d411e 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -579,7 +579,6 @@ gtk_webview_append_html(GtkWebView *webview, const char *html) char *script = g_strdup_printf("document.write(%s)", escaped); webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script); priv->empty = FALSE; - gtk_webview_scroll_to_end(webview, TRUE); g_free(script); g_free(escaped); } -- cgit v1.2.1 From 4de1821dd882ae7cd07c92d4aafce50bad3c2a57 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 04:57:16 +0000 Subject: Use better HTML in the About dialog. Since WebKit is rendering this now, we can use a few more descriptive tags. --- pidgin/gtkdialogs.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index d5530d75ce..e3aa634368 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -485,37 +485,42 @@ void pidgin_dialogs_about(void) str = g_string_sized_new(4096); g_string_append_printf(str, - "
%s %s
(libpurple %s)" - "
%s

", PIDGIN_NAME, DISPLAY_VERSION, + "

%s %s

" + "(libpurple %s)
%s
", + PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION); g_string_append_printf(str, - _("%s is a messaging client based on libpurple which is capable of " + _("

%s is a messaging client based on libpurple which is capable of " "connecting to multiple messaging services at once. %s is written " "in C using GTK+. %s is released, and may be modified and " "redistributed, under the terms of the GPL version 2 (or later). " "A copy of the GPL is distributed with %s. %s is copyrighted by " "its contributors, a list of whom is also distributed with %s. " - "There is no warranty for %s.

"), PIDGIN_NAME, PIDGIN_NAME, + "There is no warranty for %s.

"), PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME, PIDGIN_NAME); g_string_append_printf(str, - _("Helpful Resources
\tWebsite
\tFrequently Asked " - "Questions
\tIRC Channel: #pidgin on irc.freenode.net
" - "\tXMPP MUC: devel@conference.pidgin.im

"), PURPLE_WEBSITE, + _("

Helpful Resources

" + ""), + PURPLE_WEBSITE, "http://developer.pidgin.im/wiki/FAQ"); g_string_append_printf(str, - _("Help from other Pidgin users is " - "available by e-mailing support@pidgin.im
" - "This is a public mailing list! " + _("

Help from other Pidgin users is available " + "by e-mailing support@pidgin.im.
" + "This is a public mailing list! " "(archive)
" "We can't help with third-party protocols or plugins!
" - "This list's primary language is English. You are " - "welcome to post in another language, but the responses may " - "be less helpful.
")); + "This list's primary language is English. You " + "are welcome to post in another language, but the responses may " + "be less helpful.

")); tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME); about = pidgin_build_help_dialog(tmp, "about", str); -- cgit v1.2.1 From 3cacd6287edab4154dafad6a0a844416274846e7 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 05:28:50 +0000 Subject: Update the HTML in the Build Information dialog. I'm not sure whether I like the definition-list formatting, but WebKit was ignoring the indent-spacing we had before, anyway. --- pidgin/gtkdialogs.c | 124 +++++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 60 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index e3aa634368..bf3b4eb0db 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -542,175 +542,179 @@ void pidgin_dialogs_buildinfo(void) str = g_string_sized_new(4096); g_string_append_printf(str, - "%s %s (libpurple %s)
%s

", PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION); + "

%s %s

" + "(libpurple %s)
%s
", + PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION); - g_string_append_printf(str, "%s
", _("Build Information")); + g_string_append_printf(str, "

%s

", _("Build Information")); - /* The following primarly intented for user/developer interaction and thus - ought not be translated */ + /* The following is primarily intended for user/developer interaction and + thus ought not be translated */ #ifdef CONFIG_ARGS /* win32 build doesn't use configure */ - g_string_append(str, " Arguments to ./configure: " CONFIG_ARGS "
"); + g_string_append(str, "
Arguments to ./configure:
" CONFIG_ARGS "
"); #endif #ifndef _WIN32 #ifdef DEBUG - g_string_append(str, " Print debugging messages: Yes
"); + g_string_append(str, "
Print debugging messages:
Yes
"); #else - g_string_append(str, " Print debugging messages: No
"); + g_string_append(str, "
Print debugging messages:
No
"); #endif #endif #ifdef PURPLE_PLUGINS - g_string_append(str, " Plugins: Enabled
"); + g_string_append(str, "
Plugins:
Enabled
"); #else - g_string_append(str, " Plugins: Disabled
"); + g_string_append(str, "
Plugins:
Disabled
"); #endif #ifdef HAVE_SSL - g_string_append(str, " SSL: SSL support is present.
"); + g_string_append(str, "
SSL:
SSL support is present.
"); #else - g_string_append(str, " SSL: SSL support was NOT compiled!
"); + g_string_append(str, "
SSL:
SSL support was NOT compiled!
"); #endif /* This might be useful elsewhere too, but it is particularly useful for - * debugging stuff known to be GTK+/Glib bugs on Windows */ + * debugging stuff known to be GTK+/GLib bugs on Windows */ #ifdef _WIN32 - g_string_append_printf(str, " GTK+ Runtime: %u.%u.%u
" - " Glib Runtime: %u.%u.%u
", + g_string_append_printf(str, "
GTK+ Runtime:
%u.%u.%u
" + "
GLib Runtime:
%u.%u.%u
", gtk_major_version, gtk_minor_version, gtk_micro_version, glib_major_version, glib_minor_version, glib_micro_version); #endif -g_string_append(str, "
Library Support
"); + g_string_append(str, "

Library Support

"); #ifdef HAVE_CYRUS_SASL - g_string_append_printf(str, " Cyrus SASL: Enabled
"); + g_string_append_printf(str, "
Cyrus SASL:
Enabled
"); #else - g_string_append_printf(str, " Cyrus SASL: Disabled
"); + g_string_append_printf(str, "
Cyrus SASL:
Disabled
"); #endif #ifndef _WIN32 #ifdef HAVE_DBUS - g_string_append_printf(str, " D-Bus: Enabled
"); + g_string_append_printf(str, "
D-Bus:
Enabled
"); #else - g_string_append_printf(str, " D-Bus: Disabled
"); + g_string_append_printf(str, "
D-Bus:
Disabled
"); #endif #ifdef HAVE_EVOLUTION_ADDRESSBOOK - g_string_append_printf(str, " Evolution Addressbook: Enabled
"); + g_string_append_printf(str, "
Evolution Addressbook:
Enabled
"); #else - g_string_append_printf(str, " Evolution Addressbook: Disabled
"); + g_string_append_printf(str, "
Evolution Addressbook:
Disabled
"); #endif #endif #if defined(_WIN32) || defined(USE_INTERNAL_LIBGADU) - g_string_append(str, " Gadu-Gadu library (libgadu): Internal
"); + g_string_append(str, "
Gadu-Gadu library (libgadu):
Internal
"); #else #ifdef HAVE_LIBGADU - g_string_append(str, " Gadu-Gadu library (libgadu): Enabled
"); + g_string_append(str, "
Gadu-Gadu library (libgadu):
Enabled
"); #else - g_string_append(str, " Gadu-Gadu library (libgadu): Disabled
"); + g_string_append(str, "
Gadu-Gadu library (libgadu):
Disabled
"); #endif #endif #ifdef USE_GTKSPELL - g_string_append(str, " GtkSpell: Enabled
"); + g_string_append(str, "
GtkSpell:
Enabled
"); #else - g_string_append(str, " GtkSpell: Disabled
"); + g_string_append(str, "
GtkSpell:
Disabled
"); #endif #ifdef HAVE_GNUTLS - g_string_append(str, " GnuTLS: Enabled
"); + g_string_append(str, "
GnuTLS:
Enabled
"); #else - g_string_append(str, " GnuTLS: Disabled
"); + g_string_append(str, "
GnuTLS:
Disabled
"); #endif #ifndef _WIN32 #ifdef USE_GSTREAMER - g_string_append(str, " GStreamer: Enabled
"); + g_string_append(str, "
GStreamer:
Enabled
"); #else - g_string_append(str, " GStreamer: Disabled
"); + g_string_append(str, "
GStreamer:
Disabled
"); #endif #endif #ifndef _WIN32 #ifdef ENABLE_MONO - g_string_append(str, " Mono: Enabled
"); + g_string_append(str, "
Mono:
Enabled
"); #else - g_string_append(str, " Mono: Disabled
"); + g_string_append(str, "
Mono:
Disabled
"); #endif #endif #ifndef _WIN32 #ifdef HAVE_NETWORKMANAGER - g_string_append(str, " NetworkManager: Enabled
"); + g_string_append(str, "
NetworkManager:
Enabled
"); #else - g_string_append(str, " NetworkManager: Disabled
"); + g_string_append(str, "
NetworkManager:
Disabled
"); #endif #endif #ifdef HAVE_NSS - g_string_append(str, " Network Security Services (NSS): Enabled
"); + g_string_append(str, "
Network Security Services (NSS):
Enabled
"); #else - g_string_append(str, " Network Security Services (NSS): Disabled
"); + g_string_append(str, "
Network Security Services (NSS):
Disabled
"); #endif -if (purple_plugins_find_with_id("core-perl") != NULL) - g_string_append(str, " Perl: Enabled
"); -else - g_string_append(str, " Perl: Disabled
"); + if (purple_plugins_find_with_id("core-perl") != NULL) + g_string_append(str, "
Perl:
Enabled
"); + else + g_string_append(str, "
Perl:
Disabled
"); -if (purple_plugins_find_with_id("core-tcl") != NULL) { - g_string_append(str, " Tcl: Enabled
"); + if (purple_plugins_find_with_id("core-tcl") != NULL) { + g_string_append(str, "
Tcl:
Enabled
"); #ifdef HAVE_TK - g_string_append(str, " Tk: Enabled
"); + g_string_append(str, "
Tk:
Enabled
"); #else - g_string_append(str, " Tk: Disabled
"); + g_string_append(str, "
Tk:
Disabled
"); #endif -} else { - g_string_append(str, " Tcl: Disabled
"); - g_string_append(str, " Tk: Disabled
"); -} + } else { + g_string_append(str, "
Tcl:
Disabled
"); + g_string_append(str, "
Tk:
Disabled
"); + } #ifdef USE_IDN - g_string_append(str, " UTF-8 DNS (IDN): Enabled
"); + g_string_append(str, "
UTF-8 DNS (IDN):
Enabled
"); #else - g_string_append(str, " UTF-8 DNS (IDN): Disabled
"); + g_string_append(str, "
UTF-8 DNS (IDN):
Disabled
"); #endif #ifdef USE_VV - g_string_append(str, " Voice and Video: Enabled
"); + g_string_append(str, "
Voice and Video:
Enabled
"); #else - g_string_append(str, " Voice and Video: Disabled
"); + g_string_append(str, "
Voice and Video:
Disabled
"); #endif #ifndef _WIN32 #ifdef USE_SM - g_string_append(str, " X Session Management: Enabled
"); + g_string_append(str, "
X Session Management:
Enabled
"); #else - g_string_append(str, " X Session Management: Disabled
"); + g_string_append(str, "
X Session Management:
Disabled
"); #endif #ifdef USE_SCREENSAVER - g_string_append(str, " XScreenSaver: Enabled
"); + g_string_append(str, "
XScreenSaver:
Enabled
"); #else - g_string_append(str, " XScreenSaver: Disabled
"); + g_string_append(str, "
XScreenSaver:
Disabled
"); #endif #ifdef LIBZEPHYR_EXT - g_string_append(str, " Zephyr library (libzephyr): External
"); + g_string_append(str, "
Zephyr library (libzephyr):
External
"); #else - g_string_append(str, " Zephyr library (libzephyr): Internal
"); + g_string_append(str, "
Zephyr library (libzephyr):
Internal
"); #endif #ifdef ZEPHYR_USES_KERBEROS - g_string_append(str, " Zephyr uses Kerberos: Yes
"); + g_string_append(str, "
Zephyr uses Kerberos:
Yes
"); #else - g_string_append(str, " Zephyr uses Kerberos: No
"); + g_string_append(str, "
Zephyr uses Kerberos:
No
"); #endif #endif + g_string_append(str, "
"); + /* End of not to be translated section */ tmp = g_strdup_printf(_("%s Build Information"), PIDGIN_NAME); -- cgit v1.2.1 From 37229ed2f03d041a0a5b214624d36cd243bd90a9 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 05:35:11 +0000 Subject: Update HTML in the Developer Information dialog. --- pidgin/gtkdialogs.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index bf3b4eb0db..8b6636983f 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -329,13 +329,13 @@ add_developers(GString *str, const struct developer *list) { for (; list->name != NULL; list++) { if (list->email != NULL) { - g_string_append_printf(str, " %s%s%s%s
", + g_string_append_printf(str, "
  • %s%s%s%s
  • ", list->email, _(list->name), list->role ? " (" : "", list->role ? _(list->role) : "", list->role ? ")" : ""); } else { - g_string_append_printf(str, " %s%s%s%s
    ", + g_string_append_printf(str, "
  • %s%s%s%s
  • ", _(list->name), list->role ? " (" : "", list->role ? _(list->role) : "", @@ -737,27 +737,28 @@ void pidgin_dialogs_developers(void) str = g_string_sized_new(4096); /* Current Developers */ - g_string_append_printf(str, "%s:
    ", + g_string_append_printf(str, "

    %s

      ", _("Current Developers")); add_developers(str, developers); - g_string_append(str, "
      "); + g_string_append(str, "
    "); /* Crazy Patch Writers */ - g_string_append_printf(str, "%s:
    ", + g_string_append_printf(str, "

    %s

      ", _("Crazy Patch Writers")); add_developers(str, patch_writers); - g_string_append(str, "
      "); + g_string_append(str, "
    "); /* Retired Developers */ - g_string_append_printf(str, "%s:
    ", + g_string_append_printf(str, "

    %s

      ", _("Retired Developers")); add_developers(str, retired_developers); - g_string_append(str, "
      "); + g_string_append(str, "
    "); /* Retired Crazy Patch Writers */ - g_string_append_printf(str, "%s:
    ", + g_string_append_printf(str, "

    %s

      ", _("Retired Crazy Patch Writers")); add_developers(str, retired_patch_writers); + g_string_append(str, "
    "); tmp = g_strdup_printf(_("%s Developer Information"), PIDGIN_NAME); developer_info = pidgin_build_help_dialog(tmp, "developer_info", str); -- cgit v1.2.1 From 8cd49d1faf2cd60f4f6668b26cf43f2f083b39c6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 05:41:16 +0000 Subject: Update HTML in Translator Information dialog. --- pidgin/gtkdialogs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 8b6636983f..c7a145b819 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -349,13 +349,13 @@ add_translators(GString *str, const struct translator *list) { for (; list->language != NULL; list++) { if (list->email != NULL) { - g_string_append_printf(str, " %s (%s) - %s
    ", + g_string_append_printf(str, "
    %s (%s)
    %s
    ", _(list->language), list->abbr, list->email, _(list->name)); } else { - g_string_append_printf(str, " %s (%s) - %s
    ", + g_string_append_printf(str, "
    %s (%s)
    %s
    ", _(list->language), list->abbr, _(list->name)); @@ -780,15 +780,16 @@ void pidgin_dialogs_translators(void) str = g_string_sized_new(4096); /* Current Translators */ - g_string_append_printf(str, "%s:
    ", + g_string_append_printf(str, "

    %s

    ", _("Current Translators")); add_translators(str, translators); - g_string_append(str, "
    "); + g_string_append(str, "
    "); /* Past Translators */ - g_string_append_printf(str, "%s:
    ", + g_string_append_printf(str, "

    %s:

    ", _("Past Translators")); add_translators(str, past_translators); + g_string_append(str, "
    "); tmp = g_strdup_printf(_("%s Translator Information"), PIDGIN_NAME); translator_info = pidgin_build_help_dialog(tmp, "translator_info", str); -- cgit v1.2.1 From 2edb7c5c3645114ae53a81beaaea61f0aac0e575 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 06:16:46 +0000 Subject: This locale code appears to have changed. Also, differentiate the names. --- pidgin/gtkdialogs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index c7a145b819..fba50448cf 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -232,7 +232,7 @@ static const struct translator translators[] = { {N_("Slovenian"), "sl", "Martin Srebotnjak", "miles@filmsi.net"}, {N_("Albanian"), "sq", "Besnik Bleta", "besnik@programeshqip.org"}, {N_("Serbian"), "sr", "Miloš Popović", "gpopac@gmail.com"}, - {N_("Serbian"), "sr@Latn", "Miloš Popović", "gpopac@gmail.com"}, + {N_("Serbian Latin"), "sr@latin", "Miloš Popović", "gpopac@gmail.com"}, {N_("Sinhala"), "si", "Danishka Navin", "snavin@redhat.com"}, {N_("Sinhala"), "si", "Yajith Ajantha Dayarathna", "yajith@gmail.com"}, {N_("Swedish"), "sv", "Peter Hjalmarsson", "xake@telia.com"}, -- cgit v1.2.1 From 7dbb08e99dd8621738fa452e136946f77364654d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 06:23:50 +0000 Subject: Show multiple translators under the same language entry. --- pidgin/gtkdialogs.c | 144 +++++++++++++++++++++++++++------------------------- 1 file changed, 74 insertions(+), 70 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index fba50448cf..459c7f5bad 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -142,33 +142,34 @@ static const struct developer retired_patch_writers[] = { {NULL, NULL, NULL} }; -/* Order: Code, then Alphabetical by Last Name */ +/* Order: Code, then Alphabetical by Last Name + Use NULL language and code for secondary translators. */ static const struct translator translators[] = { {N_("Afrikaans"), "af", "Samuel Murray", "afrikaans@gmail.com"}, - {N_("Afrikaans"), "af", "Friedel Wolff", "friedel@translate.org.za"}, + {NULL, NULL, "Friedel Wolff", "friedel@translate.org.za"}, {N_("Arabic"), "ar", "Khaled Hosny", "khaledhosny@eglug.org"}, {N_("Assamese"), "as", "Amitakhya Phukan", "aphukan@fedoraproject.org"}, {N_("Belarusian Latin"), "be@latin", "Ihar Hrachyshka", "ihar.hrachyshka@gmail.com"}, {N_("Bulgarian"), "bg", "Vladimira Girginova", "missing@here.is"}, - {N_("Bulgarian"), "bg", "Vladimir (Kaladan) Petkov", "kaladan@gmail.com"}, + {NULL, NULL, "Vladimir (Kaladan) Petkov", "kaladan@gmail.com"}, {N_("Bengali"), "bn", "Israt Jahan", "israt@ankur.org.bd"}, - {N_("Bengali"), "bn", "Jamil Ahmed", "jamil@bengalinux.org"}, - {N_("Bengali"), "bn", "Samia Nimatullah", "mailsamia2001@yahoo.com"}, + {NULL, NULL, "Jamil Ahmed", "jamil@bengalinux.org"}, + {NULL, NULL, "Samia Nimatullah", "mailsamia2001@yahoo.com"}, {N_("Bengali-India"), "bn_IN", "Runa Bhattacharjee", "runab@fedoraproject.org"}, {N_("Bosnian"), "bs", "Lejla Hadzialic", "lejlah@gmail.com"}, {N_("Catalan"), "ca", "Josep Puigdemont", "josep.puigdemont@gmail.com"}, {N_("Valencian-Catalan"), "ca@valencia", "Toni Hermoso", "toniher@softcatala.org"}, - {N_("Valencian-Catalan"), "ca@valencia", "Josep Puigdemont", "tradgnome@softcatala.org"}, + {NULL, NULL, "Josep Puigdemont", "tradgnome@softcatala.org"}, {N_("Czech"), "cs", "David Vachulka", "david@konstrukce-cad.com"}, {N_("Danish"), "da", "Morten Brix Pedersen", "morten@wtf.dk"}, - {N_("Danish"), "da", "Peter Bach", "bach.peter@gmail.com"}, + {NULL, NULL, "Peter Bach", "bach.peter@gmail.com"}, {N_("German"), "de", "Björn Voigt", "bjoern@cs.tu-berlin.de"}, - {N_("German"), "de", "Jochen Kemnade", "jochenkemnade@web.de"}, + {NULL, NULL, "Jochen Kemnade", "jochenkemnade@web.de"}, {N_("Dzongkha"), "dz", "Norbu", "nor_den@hotmail.com"}, - {N_("Dzongkha"), "dz", "Jurmey Rabgay", "jur_gay@yahoo.com"}, - {N_("Dzongkha"), "dz", "Wangmo Sherpa", "rinwanshe@yahoo.com"}, + {NULL, NULL, "Jurmey Rabgay", "jur_gay@yahoo.com"}, + {NULL, NULL, "Wangmo Sherpa", "rinwanshe@yahoo.com"}, {N_("Greek"), "el", "Katsaloulis Panayotis", "panayotis@panayotis.com"}, - {N_("Greek"), "el", "Bouklis Panos", "panos@echidna-band.com"}, + {NULL, NULL, "Bouklis Panos", "panos@echidna-band.com"}, {N_("Australian English"), "en_AU", "Peter Lawler", "trans@six-by-nine.com.au"}, {N_("British English"), "en_GB", "Phil Hannent", "phil@hannent.co.uk"}, {N_("Canadian English"), "en_CA", "Adam Weinberger", "adamw@gnome.org"}, @@ -177,18 +178,18 @@ static const struct translator translators[] = { {N_("Estonian"), "et", "Ivar Smolin", "okul@linux.ee"}, {N_("Basque"), "eu", "Mikel Pascual Aldabaldetreku", "mikel.paskual@gmail.com"}, {N_("Persian"), "fa", "Elnaz Sarbar", "elnaz@farsiweb.info"}, - {N_("Persian"), "fa", "Meelad Zakaria", "meelad@farsiweb.info"}, - {N_("Persian"), "fa", "Roozbeh Pournader ", "roozbeh@farsiweb.info"}, + {NULL, NULL, "Meelad Zakaria", "meelad@farsiweb.info"}, + {NULL, NULL, "Roozbeh Pournader ", "roozbeh@farsiweb.info"}, {N_("Finnish"), "fi", "Timo Jyrinki", "timo.jyrinki@iki.fi"}, {N_("French"), "fr", "Éric Boumaour", "zongo_fr@users.sourceforge.net"}, {N_("Irish"), "ga", "Aaron Kearns", "ajkearns6@gmail.com"}, {N_("Galician"), "gl", "Mar Castro", "mariamarcp@gmail.com"}, - {N_("Galician"), "gl", "Frco. Javier Rial", "fjrial@cesga.es"}, + {NULL, NULL, "Frco. Javier Rial", "fjrial@cesga.es"}, {N_("Gujarati"), "gu", "Ankit Patel", "ankit_patel@users.sf.net"}, - {N_("Gujarati"), "gu", N_("Gujarati Language Team"), "indianoss-gujarati@lists.sourceforge.net"}, + {NULL, NULL, N_("Gujarati Language Team"), "indianoss-gujarati@lists.sourceforge.net"}, {N_("Hebrew"), "he", "Shalom Craimer", "scraimer@gmail.com"}, {N_("Hindi"), "hi", "Sangeeta Kumari", "sangeeta_0975@yahoo.com"}, - {N_("Hindi"), "hi", "Rajesh Ranjan", "rajeshkajha@yahoo.com"}, + {NULL, NULL, "Rajesh Ranjan", "rajeshkajha@yahoo.com"}, {N_("Croatian"), "hr", "Sabina Drempetić", "bina91991@googlemail.com"}, {N_("Hungarian"), "hu", "Kelemen Gábor", "kelemeng@gnome.hu"}, {N_("Armenian"), "hy", "David Avsharyan", "avsharyan@gmail.com"}, @@ -200,15 +201,15 @@ static const struct translator translators[] = { {N_("Kannada"), "kn", N_("Kannada Translation team"), "translation@sampada.info"}, {N_("Korean"), "ko", "Sushizang", "sushizang@empal.com"}, {N_("Kurdish"), "ku", "Erdal Ronahi", "erdal.ronahi@gmail.com"}, - {N_("Kurdish"), "ku", "Amed Ç. Jiyan", "amedcj@hotmail.com"}, - {N_("Kurdish"), "ku", "Rizoyê Xerzî", "rizoxerzi@hotmail.com"}, + {NULL, NULL, "Amed Ç. Jiyan", "amedcj@hotmail.com"}, + {NULL, NULL, "Rizoyê Xerzî", "rizoxerzi@hotmail.com"}, {N_("Lao"), "lo", "Anousak Souphavah", "anousak@gmail.com"}, {N_("Maithili"), "mai", "Sangeeta Kumari", "sangeeta_0975@yahoo.com"}, - {N_("Maithili"), "mai", "Rajesh Ranjan", "rajeshkajha@yahoo.com"}, + {NULL, NULL, "Rajesh Ranjan", "rajeshkajha@yahoo.com"}, {N_("Meadow Mari"), "mhr", "David Preece", "davidpreece1@gmail.com"}, {N_("Macedonian"), "mk", "Arangel Angov ", "arangel@linux.net.mk"}, - {N_("Macedonian"), "mk", "Ivana Kirkovska", "ivana.kirkovska@gmail.com"}, - {N_("Macedonian"), "mk", "Jovan Naumovski", "jovan@lugola.net"}, + {NULL, NULL, "Ivana Kirkovska", "ivana.kirkovska@gmail.com"}, + {NULL, NULL, "Jovan Naumovski", "jovan@lugola.net"}, {N_("Malayalam"), "ml", "Ani Peter", "apeter@redhat.com"}, {N_("Mongolian"), "mn", "gooyo", NULL}, {N_("Marathi"), "mr", "Sandeep Shedmake", "sandeep.shedmake@gmail.com"}, @@ -225,20 +226,20 @@ static const struct translator translators[] = { {N_("Portuguese-Brazil"), "pt_BR", "Rodrigo Luiz Marques Flores", "rodrigomarquesflores@gmail.com"}, {N_("Pashto"), "ps", "Kashif Masood", "masudmails@yahoo.com"}, {N_("Romanian"), "ro", "Mișu Moldovan", "dumol@gnome.org"}, - {N_("Romanian"), "ro", "Andrei Popescu", "andreimpopescu@gmail.com"}, + {NULL, NULL, "Andrei Popescu", "andreimpopescu@gmail.com"}, {N_("Russian"), "ru", "Антон Самохвалов", "samant.ua@mail.ru"}, {N_("Slovak"), "sk", "Jozef Káčer", "quickparser@gmail.com"}, - {N_("Slovak"), "sk", "loptosko", "loptosko@gmail.com"}, + {NULL, NULL, "loptosko", "loptosko@gmail.com"}, {N_("Slovenian"), "sl", "Martin Srebotnjak", "miles@filmsi.net"}, {N_("Albanian"), "sq", "Besnik Bleta", "besnik@programeshqip.org"}, {N_("Serbian"), "sr", "Miloš Popović", "gpopac@gmail.com"}, {N_("Serbian Latin"), "sr@latin", "Miloš Popović", "gpopac@gmail.com"}, {N_("Sinhala"), "si", "Danishka Navin", "snavin@redhat.com"}, - {N_("Sinhala"), "si", "Yajith Ajantha Dayarathna", "yajith@gmail.com"}, + {NULL, NULL, "Yajith Ajantha Dayarathna", "yajith@gmail.com"}, {N_("Swedish"), "sv", "Peter Hjalmarsson", "xake@telia.com"}, {N_("Swahili"), "sw", "Paul Msegeya", "msegeya@gmail.com"}, {N_("Tamil"), "ta", "I. Felix", "ifelix25@gmail.com"}, - {N_("Tamil"), "ta", "Viveka Nathan K", "vivekanathan@users.sourceforge.net"}, + {NULL, NULL, "Viveka Nathan K", "vivekanathan@users.sourceforge.net"}, {N_("Telugu"), "te", "Krishnababu Krottapalli", "krottapalli@ymail.com"}, {N_("Thai"), "th", "Isriya Paireepairit", "markpeak@gmail.com"}, {N_("Turkish"), "tr", "Serdar Soytetir", "tulliana@gmail.com"}, @@ -247,10 +248,10 @@ static const struct translator translators[] = { {N_("Vietnamese"), "vi", N_("T.M.Thanh and the Gnome-Vi Team"), "gnomevi-list@lists.sf.net"}, {N_("Simplified Chinese"), "zh_CN", "Aron Xu", "happyaron.xu@gmail.com"}, {N_("Hong Kong Chinese"), "zh_HK", "Abel Cheung", "abelindsay@gmail.com"}, - {N_("Hong Kong Chinese"), "zh_HK", "Ambrose C. Li", "acli@ada.dhs.org"}, - {N_("Hong Kong Chinese"), "zh_HK", "Paladin R. Liu", "paladin@ms1.hinet.net"}, + {NULL, NULL, "Ambrose C. Li", "acli@ada.dhs.org"}, + {NULL, NULL, "Paladin R. Liu", "paladin@ms1.hinet.net"}, {N_("Traditional Chinese"), "zh_TW", "Ambrose C. Li", "acli@ada.dhs.org"}, - {N_("Traditional Chinese"), "zh_TW", "Paladin R. Liu", "paladin@ms1.hinet.net"}, + {NULL, NULL, "Paladin R. Liu", "paladin@ms1.hinet.net"}, {NULL, NULL, NULL, NULL} }; @@ -260,67 +261,71 @@ static const struct translator past_translators[] = { {N_("Arabic"), "ar", "Mohamed Magdy", "alnokta@yahoo.com"}, {N_("Bulgarian"), "bg", "Hristo Todorov", NULL}, {N_("Bengali"), "bn", "INDRANIL DAS GUPTA", "indradg@l2c2.org"}, - {N_("Bengali"), "bn", "Tisa Nafisa", "tisa_nafisa@yahoo.com"}, + {NULL, NULL, "Tisa Nafisa", "tisa_nafisa@yahoo.com"}, {N_("Catalan"), "ca", "JM Pérez Cáncer", NULL}, - {N_("Catalan"), "ca", "Robert Millan", NULL}, + {NULL, NULL, "Robert Millan", NULL}, {N_("Czech"), "cs", "Honza Král", NULL}, - {N_("Czech"), "cs", "Miloslav Trmac", "mitr@volny.cz"}, - {N_("German"), "de", "Daniel Seifert, Karsten Weiss", NULL}, + {NULL, NULL, "Miloslav Trmac", "mitr@volny.cz"}, + {N_("German"), "de", "Daniel Seifert", NULL}, + {NULL, NULL, "Karsten Weiss", NULL}, {N_("British English"), "en_GB", "Luke Ross", "luke@lukeross.name"}, {N_("Spanish"), "es", "JM Pérez Cáncer", NULL}, - {N_("Spanish"), "es", "Nicolás Lichtmaier", NULL}, - {N_("Spanish"), "es", "Amaya Rodrigo", NULL}, - {N_("Spanish"), "es", "Alejandro G Villar", NULL}, + {NULL, NULL, "Nicolás Lichtmaier", NULL}, + {NULL, NULL, "Amaya Rodrigo", NULL}, + {NULL, NULL, "Alejandro G Villar", NULL}, {N_("Basque"), "eu", "Iñaki Larrañaga Murgoitio", "dooteo@zundan.com"}, - {N_("Basque"), "eu", "Hizkuntza Politikarako Sailburuordetza", "hizkpol@ej-gv.es"}, + {NULL, NULL, "Hizkuntza Politikarako Sailburuordetza", "hizkpol@ej-gv.es"}, {N_("Finnish"), "fi", "Arto Alakulju", NULL}, - {N_("Finnish"), "fi", "Tero Kuusela", NULL}, + {NULL, NULL, "Tero Kuusela", NULL}, {N_("French"), "fr", "Sébastien François", NULL}, - {N_("French"), "fr", "Stéphane Pontier", NULL}, - {N_("French"), "fr", "Stéphane Wirtel", NULL}, - {N_("French"), "fr", "Loïc Jeannin", NULL}, + {NULL, NULL, "Stéphane Pontier", NULL}, + {NULL, NULL, "Stéphane Wirtel", NULL}, + {NULL, NULL, "Loïc Jeannin", NULL}, {N_("Galician"), "gl", "Ignacio Casal Quinteiro", NULL}, {N_("Hebrew"), "he", "Pavel Bibergal", NULL}, {N_("Hindi"), "hi", "Ravishankar Shrivastava", NULL}, {N_("Hungarian"), "hu", "Zoltan Sutto", NULL}, {N_("Italian"), "it", "Salvatore di Maggio", NULL}, {N_("Japanese"), "ja", "Takashi Aihana", NULL}, - {N_("Japanese"), "ja", "Ryosuke Kutsuna", NULL}, - {N_("Japanese"), "ja", "Taku Yasui", NULL}, - {N_("Japanese"), "ja", "Junichi Uekawa", NULL}, + {NULL, NULL, "Ryosuke Kutsuna", NULL}, + {NULL, NULL, "Taku Yasui", NULL}, + {NULL, NULL, "Junichi Uekawa", NULL}, {N_("Georgian"), "ka", "Temuri Doghonadze", NULL}, - {N_("Korean"), "ko", "Sang-hyun S, A Ho-seok Lee", NULL}, - {N_("Korean"), "ko", "Kyeong-uk Son", NULL}, + {N_("Korean"), "ko", "Sang-hyun S", NULL}, + {NULL, NULL, "A Ho-seok Lee", NULL}, + {NULL, NULL, "Kyeong-uk Son", NULL}, {N_("Lithuanian"), "lt", "Laurynas Biveinis", "laurynas.biveinis@gmail.com"}, - {N_("Lithuanian"), "lt", "Gediminas Čičinskas", NULL}, - {N_("Lithuanian"), "lt", "Andrius Štikonas", NULL}, + {NULL, NULL, "Gediminas Čičinskas", NULL}, + {NULL, NULL, "Andrius Štikonas", NULL}, {N_("Macedonian"), "mk", "Tomislav Markovski", NULL}, {N_("Bokmål Norwegian"), "nb", "Hallvard Glad", "hallvard.glad@gmail.com"}, - {N_("Bokmål Norwegian"), "nb", "Petter Johan Olsen", NULL}, - {N_("Bokmål Norwegian"), "nb", "Espen Stefansen", "espenas@gmail.com"}, + {NULL, NULL, "Petter Johan Olsen", NULL}, + {NULL, NULL, "Espen Stefansen", "espenas@gmail.com"}, {N_("Dutch, Flemish"), "nl", "Vincent van Adrighem", "V.vanAdrighem@dirck.mine.nu"}, {N_("Polish"), "pl", "Emil Nowak", "emil5@go2.pl"}, - {N_("Polish"), "pl", "Paweł Godlewski", "pawel@bajk.pl"}, - {N_("Polish"), "pl", "Krzysztof Foltman", "krzysztof@foltman.com"}, - {N_("Polish"), "pl", "Piotr Makowski", NULL}, - {N_("Polish"), "pl", "Przemysław Sułek", NULL}, + {NULL, NULL, "Paweł Godlewski", "pawel@bajk.pl"}, + {NULL, NULL, "Krzysztof Foltman", "krzysztof@foltman.com"}, + {NULL, NULL, "Piotr Makowski", NULL}, + {NULL, NULL, "Przemysław Sułek", NULL}, {N_("Portuguese-Brazil"), "pt_BR", "Maurício de Lemos Rodrigues Collares Neto", "mauricioc@gmail.com"}, {N_("Russian"), "ru", "Dmitry Beloglazov", "dmaa@users.sf.net"}, - {N_("Russian"), "ru", "Alexandre Prokoudine", NULL}, - {N_("Russian"), "ru", "Sergey Volozhanin", NULL}, + {NULL, NULL, "Alexandre Prokoudine", NULL}, + {NULL, NULL, "Sergey Volozhanin", NULL}, {N_("Slovak"), "sk", "Daniel Režný", NULL}, - {N_("Slovak"), "sk", "helix84", NULL}, - {N_("Slovak"), "sk", "Richard Golier", NULL}, + {NULL, NULL, "helix84", NULL}, + {NULL, NULL, "Richard Golier", NULL}, {N_("Slovenian"), "sl", "Matjaz Horvat", NULL}, {N_("Serbian"), "sr", "Danilo Šegan", "dsegan@gmx.net"}, - {N_("Serbian"), "sr", "Aleksandar Urosevic", "urke@users.sourceforge.net"}, + {NULL, NULL, "Aleksandar Urosevic", "urke@users.sourceforge.net"}, {N_("Swedish"), "sv", "Tore Lundqvist", NULL}, - {N_("Swedish"), "sv", "Christian Rose", NULL}, + {NULL, NULL, "Christian Rose", NULL}, {N_("Telugu"), "te", "Mr. Subbaramaih", "info.gist@cdac.in"}, {N_("Turkish"), "tr", "Ahmet Alp BALKAN", NULL}, - {N_("Simplified Chinese"), "zh_CN", "Hashao, Rocky S. Lee", NULL}, - {N_("Simplified Chinese"), "zh_CN", "Funda Wang", "fundawang@linux.net.cn"}, - {N_("Traditional Chinese"), "zh_TW", "Hashao, Rocky S. Lee", NULL}, + {N_("Simplified Chinese"), "zh_CN", "Hashao", NULL}, + {NULL, NULL, "Rocky S. Lee", NULL}, + {NULL, NULL, "Funda Wang", "fundawang@linux.net.cn"}, + {N_("Traditional Chinese"), "zh_TW", "Hashao", NULL}, + {NULL, NULL, "Rocky S. Lee", NULL}, {NULL, NULL, NULL, NULL} }; @@ -347,18 +352,17 @@ add_developers(GString *str, const struct developer *list) static void add_translators(GString *str, const struct translator *list) { - for (; list->language != NULL; list++) { + for (; list->name != NULL; list++) { + if (list->language && list->abbr) { + g_string_append_printf(str, "
    %s (%s)
    ", + _(list->language), list->abbr); + } if (list->email != NULL) { - g_string_append_printf(str, "
    %s (%s)
    %s
    ", - _(list->language), - list->abbr, + g_string_append_printf(str, "
    %s
    ", list->email, _(list->name)); } else { - g_string_append_printf(str, "
    %s (%s)
    %s
    ", - _(list->language), - list->abbr, - _(list->name)); + g_string_append_printf(str, "
    %s
    ", _(list->name)); } } } -- cgit v1.2.1 From 04fa6524eda291c1db8493daa73ebcee26853749 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 06:47:57 +0000 Subject: Update the HTML in the Plugin Information dialog. --- pidgin/gtkdialogs.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 459c7f5bad..4fa7aba2e3 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -814,8 +814,7 @@ void pidgin_dialogs_plugins_info(void) str = g_string_sized_new(4096); - g_string_append_printf(str, "%s
    ", - _("Plugin Information")); + g_string_append_printf(str, "

    %s

    ", _("Plugin Information")); for(l = purple_plugins_get_all(); l; l = l->next) { plugin = (PurplePlugin *)l->data; @@ -830,19 +829,25 @@ void pidgin_dialogs_plugins_info(void) ploaded = purple_plugin_is_loaded(plugin); g_string_append_printf(str, - "%s
    " - "\tAuthor: %s
    \tVersion: %s
    " - "\tWebsite: %s
    \tID String: %s
    " - "\tLoadable: %s
    \tLoaded: %s
    " - "
    ", pname, pauthor ? pauthor : "(null)", + "
    %s
    " + "Author: %s
    " + "Version: %s
    " + "Website: %s
    " + "ID String: %s
    " + "Loadable: %s
    " + "Loaded: %s" + "

    ", + pname, pauthor ? pauthor : "(null)", pver, pwebsite, pid, - punloadable ? "No" : "Yes", + punloadable ? "No" : "Yes", ploaded ? "Yes" : "No"); g_free(pname); g_free(pauthor); } + g_string_append(str, "
    "); + plugins_info = pidgin_build_help_dialog(title, "plugins_info", str); g_signal_connect(G_OBJECT(plugins_info), "destroy", G_CALLBACK(gtk_widget_destroyed), &plugins_info); -- cgit v1.2.1 From 0e67e6d7aecc215d1caae3bf6e9cf74cbe3ff62f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 06:48:22 +0000 Subject: Remove an extra colon. --- pidgin/gtkdialogs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 4fa7aba2e3..bf1c84fe0c 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -790,7 +790,7 @@ void pidgin_dialogs_translators(void) g_string_append(str, ""); /* Past Translators */ - g_string_append_printf(str, "

    %s:

    ", + g_string_append_printf(str, "

    %s

    ", _("Past Translators")); add_translators(str, past_translators); g_string_append(str, "
    "); -- cgit v1.2.1 From e4aef0554b45c07a690f176872a99ac17f9c794d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 07:21:16 +0000 Subject: Add a title attribute to links so that they'll show a tooltip. --- pidgin/gtkdialogs.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index bf1c84fe0c..1796aa3434 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -334,8 +334,9 @@ add_developers(GString *str, const struct developer *list) { for (; list->name != NULL; list++) { if (list->email != NULL) { - g_string_append_printf(str, "
  • %s%s%s%s
  • ", - list->email, _(list->name), + g_string_append_printf(str, + "
  • %s%s%s%s
  • ", + list->email, list->email, _(list->name), list->role ? " (" : "", list->role ? _(list->role) : "", list->role ? ")" : ""); @@ -358,8 +359,9 @@ add_translators(GString *str, const struct translator *list) _(list->language), list->abbr); } if (list->email != NULL) { - g_string_append_printf(str, "
    %s
    ", - list->email, + g_string_append_printf(str, + "
    %s
    ", + list->email, list->email, _(list->name)); } else { g_string_append_printf(str, "
    %s
    ", _(list->name)); @@ -507,24 +509,27 @@ void pidgin_dialogs_about(void) g_string_append_printf(str, _("

    Helpful Resources

    " ""), - PURPLE_WEBSITE, + PURPLE_WEBSITE, PURPLE_WEBSITE, + "http://developer.pidgin.im/wiki/FAQ", "http://developer.pidgin.im/wiki/FAQ"); g_string_append_printf(str, _("

    Help from other Pidgin users is available " - "by e-mailing support@pidgin.im.
    " + "by e-mailing %s.
    " "This is a public mailing list! " - "(archive)
    " + "(archive)
    " "We can't help with third-party protocols or plugins!
    " "This list's primary language is English. You " "are welcome to post in another language, but the responses may " - "be less helpful.

    ")); + "be less helpful.

    "), + "support@pidgin.im", "support@pidgin.im", + "http://pidgin.im/pipermail/support/", + "http://pidgin.im/pipermail/support/"); tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME); about = pidgin_build_help_dialog(tmp, "about", str); -- cgit v1.2.1 From 7a7d1ef4e9658760899e45b3c64f8f2f30770049 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 08:12:03 +0000 Subject: Fix the Browser prefs on GNOME3. Unfortunately, there doesn't seem to be a way to go directly to the Default Applications screen, but we'll have to settle for the System Information panel. --- ChangeLog | 2 ++ pidgin/gtkprefs.c | 25 +++++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76c8e3de0e..b4f657a5e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,6 +53,8 @@ version 2.10.2 (02/22/2012): Pidgin: * Add support for the GNOME3 Network dialog. (#13882) * Fix rare crash. (#14392) + * Add support for the GNOME3 Default Application dialog for configuring + the Browser. libpurple: * Support new connection states and signals for NetworkManager 0.9+. diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 35e53c7dbd..a89fa9a989 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -1819,11 +1819,11 @@ proxy_button_clicked_cb(GtkWidget *button, gchar *program) #ifndef _WIN32 static void -browser_button_clicked_cb(GtkWidget *button, gpointer null) +browser_button_clicked_cb(GtkWidget *button, gchar *path) { GError *err = NULL; - if (g_spawn_command_line_async ("gnome-default-applications-properties", &err)) + if (g_spawn_command_line_async(path, &err)) return; purple_notify_error(NULL, NULL, _("Cannot start browser configuration program."), err->message); @@ -2094,8 +2094,8 @@ browser_page(void) vbox = pidgin_make_frame (ret, _("Browser Selection")); - if(purple_running_gnome()) { - gchar *path = g_find_program_in_path("gnome-default-applications-properties"); + if (purple_running_gnome()) { + gchar *path; hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); label = gtk_label_new(_("Browser preferences are configured in GNOME preferences")); @@ -2105,19 +2105,28 @@ browser_page(void) hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); gtk_container_add(GTK_CONTAINER(vbox), hbox); - if(path == NULL) { + path = g_find_program_in_path("gnome-control-center"); + if (path != NULL) { + gchar *tmp = g_strdup_printf("%s info", path); + g_free(path); + path = tmp; + } else { + path = g_find_program_in_path("gnome-default-applications-properties"); + } + + if (path == NULL) { label = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(label), _("Browser configuration program was not found.")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); } else { browser_button = gtk_button_new_with_mnemonic(_("Configure _Browser")); - g_signal_connect(G_OBJECT(browser_button), "clicked", - G_CALLBACK(browser_button_clicked_cb), NULL); + g_signal_connect_data(G_OBJECT(browser_button), "clicked", + G_CALLBACK(browser_button_clicked_cb), path, + (GClosureNotify)g_free, 0); gtk_box_pack_start(GTK_BOX(hbox), browser_button, FALSE, FALSE, 0); } - g_free(path); gtk_widget_show_all(ret); } else { sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); -- cgit v1.2.1 From fe623ae91168cda9e72160c18aea584479a6c48a Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Thu, 23 Feb 2012 08:32:05 +0000 Subject: These two items are listed under the 2.10.2 section --- ChangeLog | 2 -- 1 file changed, 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 432537c73c..07bfa98871 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,8 +24,6 @@ version 3.0.0 (??/??/????): MSN: * Fix file transfer with older Mac MSN clients. * Support file transfers up to ~9 EiB. - * Support new protocol version MSNP18. (#14753) - * Fix messages to offline contacts. (#14302) MXit: * Remove all reference to Hidden Number. -- cgit v1.2.1 From 7a8b90fdcb9d315014015899e94b1f27eac8f904 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 23 Feb 2012 09:00:17 +0000 Subject: Use the GtkWidget for a menu instead of its GtkAction. --- pidgin/gtkconv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 1a9ff016cf..8ca0eaf468 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3392,6 +3392,7 @@ regenerate_media_items(PidginWindow *win) static void regenerate_attention_items(PidginWindow *win) { + GtkWidget *attention; GtkWidget *menu; PurpleConversation *conv; PurpleConnection *pc; @@ -3403,8 +3404,11 @@ regenerate_attention_items(PidginWindow *win) if (!conv) return; + attention = gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/GetAttention"); + /* Remove the previous entries */ - gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.get_attention), NULL); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(attention), NULL); pc = purple_conversation_get_connection(conv); if (pc != NULL) @@ -3437,7 +3441,7 @@ regenerate_attention_items(PidginWindow *win) list = g_list_delete_link(list, list); } - gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.get_attention), menu); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(attention), menu); gtk_widget_show_all(menu); } } -- cgit v1.2.1 From 87ac976158b8f9dbb495e5b860566c195392df2b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 02:59:09 +0000 Subject: Add certificate function to ChangeLog.API. --- ChangeLog.API | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.API b/ChangeLog.API index 65feabbdef..daaec22e9e 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -8,6 +8,7 @@ version 3.0.0 (??/??/????): * purple_account_get_ui_data * purple_account_set_ui_data * purple_account_register_completed + * purple_certificate_get_der_data * purple_conv_chat_cb_get_alias * purple_conv_chat_cb_get_flags * purple_conv_chat_cb_is_buddy -- cgit v1.2.1 From 2bb5192bae59abe933540a40b618ac76e1023481 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 03:01:41 +0000 Subject: Add a function for converting a PurpleCertificate to a string suitable for display to the user. This is basically just a copy of purple_certificate_display_x509 right now, but it will eventually lead somewhere... --- ChangeLog.API | 1 + libpurple/certificate.c | 58 +++++++++++++------------------------- libpurple/certificate.h | 21 +++++++++++++- libpurple/plugins/ssl/ssl-gnutls.c | 51 ++++++++++++++++++++++++++++++++- libpurple/plugins/ssl/ssl-nss.c | 51 ++++++++++++++++++++++++++++++++- 5 files changed, 140 insertions(+), 42 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index daaec22e9e..b017f5be1c 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -9,6 +9,7 @@ version 3.0.0 (??/??/????): * purple_account_set_ui_data * purple_account_register_completed * purple_certificate_get_der_data + * purple_certificate_get_display_string * purple_conv_chat_cb_get_alias * purple_conv_chat_cb_get_flags * purple_conv_chat_cb_is_buddy diff --git a/libpurple/certificate.c b/libpurple/certificate.c index f92a207e48..8e36cdf77f 100644 --- a/libpurple/certificate.c +++ b/libpurple/certificate.c @@ -517,6 +517,24 @@ purple_certificate_get_der_data(PurpleCertificate *crt) return data; } +gchar * +purple_certificate_get_display_string(PurpleCertificate *crt) +{ + PurpleCertificateScheme *scheme; + gchar *str; + + g_return_val_if_fail(crt, NULL); + g_return_val_if_fail(crt->scheme, NULL); + + scheme = crt->scheme; + + g_return_val_if_fail(scheme->get_display_string, NULL); + + str = (scheme->get_display_string)(crt); + + return str; +} + gchar * purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id) { @@ -2168,43 +2186,10 @@ purple_certificate_unregister_pool(PurpleCertificatePool *pool) void purple_certificate_display_x509(PurpleCertificate *crt) { - gchar *sha_asc; - GByteArray *sha_bin; - gchar *cn; - time_t activation, expiration; - gchar *activ_str, *expir_str; gchar *secondary; - /* Pull out the SHA1 checksum */ - sha_bin = purple_certificate_get_fingerprint_sha1(crt); - /* Now decode it for display */ - sha_asc = purple_base16_encode_chunked(sha_bin->data, - sha_bin->len); - - /* Get the cert Common Name */ - /* TODO: Will break on CA certs */ - cn = purple_certificate_get_subject_name(crt); - - /* Get the certificate times */ - /* TODO: Check the times against localtime */ - /* TODO: errorcheck? */ - if (!purple_certificate_get_times(crt, &activation, &expiration)) { - purple_debug_error("certificate", - "Failed to get certificate times!\n"); - activation = expiration = 0; - } - activ_str = g_strdup(ctime(&activation)); - expir_str = g_strdup(ctime(&expiration)); - /* Make messages */ - secondary = g_strdup_printf(_("Common name: %s\n\n" - "Fingerprint (SHA1): %s\n\n" - "Activation date: %s\n" - "Expiration date: %s\n"), - cn ? cn : "(null)", - sha_asc ? sha_asc : "(null)", - activ_str ? activ_str : "(null)", - expir_str ? expir_str : "(null)"); + secondary = purple_certificate_get_display_string(crt); /* Make a semi-pretty display */ purple_notify_info( @@ -2214,12 +2199,7 @@ purple_certificate_display_x509(PurpleCertificate *crt) secondary); /* Cleanup */ - g_free(cn); g_free(secondary); - g_free(sha_asc); - g_free(activ_str); - g_free(expir_str); - g_byte_array_free(sha_bin, TRUE); } void purple_certificate_add_ca_search_path(const char *path) diff --git a/libpurple/certificate.h b/libpurple/certificate.h index bee2a0ffca..5c1f1cb27b 100644 --- a/libpurple/certificate.h +++ b/libpurple/certificate.h @@ -261,8 +261,16 @@ struct _PurpleCertificateScheme */ GByteArray * (* get_der_data)(PurpleCertificate *crt); + /** + * Retrieves a string representation of the certificate suitable for display + * + * @param crt Certificate instance + * @return User-displayable string representation of certificate - must be + * freed using g_free(). + */ + gchar * (* get_display_string)(PurpleCertificate *crt); + void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); }; /** A set of operations used to provide logic for verifying a Certificate's @@ -577,6 +585,17 @@ purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t GByteArray * purple_certificate_get_der_data(PurpleCertificate *crt); +/** + * Retrieves a string suitable for displaying a certificate to the user. + * + * @param crt Certificate instance + * + * @return String representing the certificate that may be displayed to the user + * - must be freed using g_free(). + */ +char * +purple_certificate_get_display_string(PurpleCertificate *crt); + /*@}*/ /*****************************************************************************/ diff --git a/libpurple/plugins/ssl/ssl-gnutls.c b/libpurple/plugins/ssl/ssl-gnutls.c index 8ae0fa0aa7..19393fa2f6 100644 --- a/libpurple/plugins/ssl/ssl-gnutls.c +++ b/libpurple/plugins/ssl/ssl-gnutls.c @@ -1173,6 +1173,55 @@ x509_get_der_data(PurpleCertificate *crt) return data; } +static gchar * +x509_display_string(PurpleCertificate *crt) +{ + gchar *sha_asc; + GByteArray *sha_bin; + gchar *cn; + time_t activation, expiration; + gchar *activ_str, *expir_str; + gchar *text; + + /* Pull out the SHA1 checksum */ + sha_bin = x509_sha1sum(crt); + sha_asc = purple_base16_encode_chunked(sha_bin->data, sha_bin->len); + + /* Get the cert Common Name */ + /* TODO: Will break on CA certs */ + cn = x509_common_name(crt); + + /* Get the certificate times */ + /* TODO: Check the times against localtime */ + /* TODO: errorcheck? */ + if (!x509_times(crt, &activation, &expiration)) { + purple_debug_error("certificate", + "Failed to get certificate times!\n"); + activation = expiration = 0; + } + activ_str = g_strdup(ctime(&activation)); + expir_str = g_strdup(ctime(&expiration)); + + /* Make messages */ + text = g_strdup_printf(_("Common name: %s\n\n" + "Fingerprint (SHA1): %s\n\n" + "Activation date: %s\n" + "Expiration date: %s\n"), + cn ? cn : "(null)", + sha_asc ? sha_asc : "(null)", + activ_str ? activ_str : "(null)", + expir_str ? expir_str : "(null)"); + + /* Cleanup */ + g_free(cn); + g_free(sha_asc); + g_free(activ_str); + g_free(expir_str); + g_byte_array_free(sha_bin, TRUE); + + return text; +} + /* X.509 certificate operations provided by this plugin */ static PurpleCertificateScheme x509_gnutls = { "x509", /* Scheme name */ @@ -1190,8 +1239,8 @@ static PurpleCertificateScheme x509_gnutls = { x509_times, /* Activation/Expiration time */ x509_importcerts_from_file, /* Multiple certificates import function */ x509_get_der_data, /* Binary DER data */ + x509_display_string, /* Display representation */ - NULL, NULL }; diff --git a/libpurple/plugins/ssl/ssl-nss.c b/libpurple/plugins/ssl/ssl-nss.c index 82121989e4..6dc6f00071 100644 --- a/libpurple/plugins/ssl/ssl-nss.c +++ b/libpurple/plugins/ssl/ssl-nss.c @@ -953,6 +953,55 @@ x509_get_der_data(PurpleCertificate *crt) return data; } +static gchar * +x509_display_string(PurpleCertificate *crt) +{ + gchar *sha_asc; + GByteArray *sha_bin; + gchar *cn; + time_t activation, expiration; + gchar *activ_str, *expir_str; + gchar *text; + + /* Pull out the SHA1 checksum */ + sha_bin = x509_sha1sum(crt); + sha_asc = purple_base16_encode_chunked(sha_bin->data, sha_bin->len); + + /* Get the cert Common Name */ + /* TODO: Will break on CA certs */ + cn = x509_common_name(crt); + + /* Get the certificate times */ + /* TODO: Check the times against localtime */ + /* TODO: errorcheck? */ + if (!x509_times(crt, &activation, &expiration)) { + purple_debug_error("certificate", + "Failed to get certificate times!\n"); + activation = expiration = 0; + } + activ_str = g_strdup(ctime(&activation)); + expir_str = g_strdup(ctime(&expiration)); + + /* Make messages */ + text = g_strdup_printf(_("Common name: %s\n\n" + "Fingerprint (SHA1): %s\n\n" + "Activation date: %s\n" + "Expiration date: %s\n"), + cn ? cn : "(null)", + sha_asc ? sha_asc : "(null)", + activ_str ? activ_str : "(null)", + expir_str ? expir_str : "(null)"); + + /* Cleanup */ + g_free(cn); + g_free(sha_asc); + g_free(activ_str); + g_free(expir_str); + g_byte_array_free(sha_bin, TRUE); + + return text; +} + static PurpleCertificateScheme x509_nss = { "x509", /* Scheme name */ N_("X.509 Certificates"), /* User-visible scheme name */ @@ -969,8 +1018,8 @@ static PurpleCertificateScheme x509_nss = { x509_times, /* Activation/Expiration time */ x509_importcerts_from_file, /* Multiple certificate import function */ x509_get_der_data, /* Binary DER data */ + x509_display_string, /* Display representation */ - NULL, NULL }; -- cgit v1.2.1 From 6626937b27d6241775656908d20e7182e8505ae5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 03:38:28 +0000 Subject: Add PurpleCertificate request field API. --- ChangeLog.API | 2 ++ libpurple/request.c | 30 ++++++++++++++++++++++++++++++ libpurple/request.h | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/ChangeLog.API b/ChangeLog.API index b017f5be1c..2f5ae0cfa1 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -34,6 +34,8 @@ version 3.0.0 (??/??/????): * purple_menu_action_set_data * purple_menu_action_set_callback * purple_menu_action_set_children + * purple_request_field_certificate_new + * purple_request_field_certificate_get_value * purple_request_field_get_tooltip * purple_request_field_group_get_fields_list * purple_request_field_set_tooltip diff --git a/libpurple/request.c b/libpurple/request.c index 985008f7ab..3db4d59a38 100644 --- a/libpurple/request.c +++ b/libpurple/request.c @@ -119,6 +119,11 @@ struct _PurpleRequestField gsize size; } image; + struct + { + PurpleCertificate *cert; + } certificate; + } u; void *ui_data; @@ -1329,6 +1334,31 @@ purple_request_field_account_get_filter(const PurpleRequestField *field) return field->u.account.filter_func; } +PurpleRequestField * +purple_request_field_certificate_new(const char *id, const char *text, PurpleCertificate *cert) +{ + PurpleRequestField *field; + + g_return_val_if_fail(id != NULL, NULL); + g_return_val_if_fail(text != NULL, NULL); + g_return_val_if_fail(cert != NULL, NULL); + + field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_CERTIFICATE); + + field->u.certificate.cert = cert; + + return field; +} + +PurpleCertificate * +purple_request_field_certificate_get_value(const PurpleRequestField *field) +{ + g_return_val_if_fail(field != NULL, NULL); + g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_CERTIFICATE, NULL); + + return field->u.certificate.cert; +} + /* -- */ void * diff --git a/libpurple/request.h b/libpurple/request.h index b3fc852fe2..e7e3aa2f85 100644 --- a/libpurple/request.h +++ b/libpurple/request.h @@ -76,7 +76,8 @@ typedef enum PURPLE_REQUEST_FIELD_LIST, PURPLE_REQUEST_FIELD_LABEL, PURPLE_REQUEST_FIELD_IMAGE, - PURPLE_REQUEST_FIELD_ACCOUNT + PURPLE_REQUEST_FIELD_ACCOUNT, + PURPLE_REQUEST_FIELD_CERTIFICATE } PurpleRequestFieldType; @@ -1169,6 +1170,36 @@ PurpleFilterAccountFunc purple_request_field_account_get_filter( /*@}*/ +/**************************************************************************/ +/** @name Certificate Field API */ +/**************************************************************************/ +/*@{*/ + +/** + * Creates a certificate field. + * + * @param id The field ID. + * @param text The label of the field. + * @param cert The certificate of the field. + * + * @return The new field. + */ +PurpleRequestField *purple_request_field_certificate_new(const char *id, + const char *text, + PurpleCertificate *cert); + +/** + * Returns the certificate in a certificate field. + * + * @param field The field. + * + * @return The certificate. + */ +PurpleCertificate *purple_request_field_certificate_get_value( + const PurpleRequestField *field); + +/*@}*/ + /**************************************************************************/ /** @name Request API */ /**************************************************************************/ -- cgit v1.2.1 From ffbc8c50a256d4d0a9cf3f1630478d19ead22cd0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 03:54:26 +0000 Subject: Display a certificate request field in Pidgin and Finch by just using the display string of the certificate in a label. --- finch/gntrequest.c | 20 ++++++++++++++++++++ pidgin/gtkrequest.c | 25 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/finch/gntrequest.c b/finch/gntrequest.c index 42c9877e14..e9bd209b54 100644 --- a/finch/gntrequest.c +++ b/finch/gntrequest.c @@ -571,6 +571,22 @@ create_account_field(PurpleRequestField *field) return combo; } +static GntWidget* +create_certificate_field(PurpleRequestField *field) +{ + GntWidget *w; + PurpleCertificate *cert; + char *str; + + cert = purple_request_field_certificate_get_value(field); + str = purple_certificate_get_display_string(cert); + w = gnt_label_new(str); + + g_free(str); + + return w; +} + static void * finch_request_fields(const char *title, const char *primary, const char *secondary, PurpleRequestFields *allfields, @@ -650,6 +666,10 @@ finch_request_fields(const char *title, const char *primary, accountlist = create_account_field(field); purple_request_field_set_ui_data(field, accountlist); } + else if (type == PURPLE_REQUEST_FIELD_CERTIFICATE) + { + purple_request_field_set_ui_data(field, create_certificate_field(field)); + } else { purple_request_field_set_ui_data(field, gnt_label_new_with_format(_("Not implemented yet."), diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index cac7e8f8a6..83085e4ce3 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -1191,6 +1191,29 @@ create_list_field(PurpleRequestField *field) return pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1); } +static GtkWidget * +create_certificate_field(PurpleRequestField *field) +{ + GtkWidget *cert_label; + PurpleCertificate *cert; + char *str; + char *escaped; + + cert = purple_request_field_certificate_get_value(field); + str = purple_certificate_get_display_string(cert); + escaped = g_markup_escape_text(str, -1); + + cert_label = gtk_label_new(NULL); + gtk_label_set_markup(GTK_LABEL(cert_label), escaped); + gtk_label_set_line_wrap(GTK_LABEL(cert_label), TRUE); + gtk_misc_set_alignment(GTK_MISC(cert_label), 0, 0); + + g_free(str); + g_free(escaped); + + return cert_label; +} + static void * pidgin_request_fields(const char *title, const char *primary, const char *secondary, PurpleRequestFields *fields, @@ -1478,6 +1501,8 @@ pidgin_request_fields(const char *title, const char *primary, widget = create_image_field(field); else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) widget = create_account_field(field); + else if (type == PURPLE_REQUEST_FIELD_CERTIFICATE) + widget = create_certificate_field(field); else continue; } -- cgit v1.2.1 From e897178fb20e930daf3b23327d25e588136a5e13 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 04:37:10 +0000 Subject: Add a function for prompting about a certificate. This is basically a small wrapper around the request field API. --- ChangeLog.API | 1 + libpurple/request.c | 23 +++++++++++++++++++++++ libpurple/request.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/ChangeLog.API b/ChangeLog.API index 2f5ae0cfa1..87e9a9d7f1 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -34,6 +34,7 @@ version 3.0.0 (??/??/????): * purple_menu_action_set_data * purple_menu_action_set_callback * purple_menu_action_set_children + * purple_request_certificate * purple_request_field_certificate_new * purple_request_field_certificate_get_value * purple_request_field_get_tooltip diff --git a/libpurple/request.c b/libpurple/request.c index 3db4d59a38..c872e06020 100644 --- a/libpurple/request.c +++ b/libpurple/request.c @@ -1666,6 +1666,29 @@ purple_request_folder(void *handle, const char *title, const char *dirname, return NULL; } +void * +purple_request_certificate(void *handle, const char *title, + const char *primary, const char *secondary, + PurpleCertificate *cert, + const char *ok_text, GCallback ok_cb, + const char *cancel_text, GCallback cancel_cb, + void *user_data) +{ + PurpleRequestFields *fields; + PurpleRequestFieldGroup *group; + PurpleRequestField *field; + + fields = purple_request_fields_new(); + group = purple_request_field_group_new(NULL); + purple_request_fields_add_group(fields, group); + field = purple_request_field_certificate_new("certificate", "Certificate", cert); + purple_request_field_group_add_field(group, field); + + return purple_request_fields(handle, title, primary, secondary, fields, + ok_text, ok_cb, cancel_text, cancel_cb, + NULL, NULL, NULL, user_data); +} + static void purple_request_close_info(PurpleRequestInfo *info) { diff --git a/libpurple/request.h b/libpurple/request.h index e7e3aa2f85..0920df7bd0 100644 --- a/libpurple/request.h +++ b/libpurple/request.h @@ -1531,6 +1531,37 @@ void *purple_request_folder(void *handle, const char *title, const char *dirname PurpleAccount *account, const char *who, PurpleConversation *conv, void *user_data); +/** + * Prompts the user for action over a certificate. + * + * This is often represented as a dialog with a button for each action. + * + * @param handle The plugin or connection handle. For some things this + * is extremely important. See the comments on + * purple_request_input(). + * @param title The title of the message, or @c NULL if it should have + * no title. + * @param primary The main point of the message, or @c NULL if you're + * feeling enigmatic. + * @param secondary Secondary information, or @c NULL if there is none. + * @param cert The #PurpleCertificate associated with this request. + * @param ok_text The text for the @c OK button, which may not be @c NULL. + * @param ok_cb The callback for the @c OK button, which may not be + * @c NULL. + * @param cancel_text The text for the @c Cancel button, which may not be + * @c NULL. + * @param cancel_cb The callback for the @c Cancel button, which may be + * @c NULL. + * @param user_data The data to pass to the callback. + * + * @return A UI-specific handle. + */ +void *purple_request_certificate(void *handle, const char *title, + const char *primary, const char *secondary, PurpleCertificate *cert, + const char *ok_text, GCallback ok_cb, + const char *cancel_text, GCallback cancel_cb, + void *user_data); + /*@}*/ /**************************************************************************/ -- cgit v1.2.1 From 02cd4d401f1e21dc07d96c62f99103909ff2cfed Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 05:11:02 +0000 Subject: Use new certificate request API when prompting the user to accept certs. --- libpurple/certificate.c | 175 ++++++++++++------------------------------------ 1 file changed, 42 insertions(+), 133 deletions(-) diff --git a/libpurple/certificate.c b/libpurple/certificate.c index 8e36cdf77f..0c64017186 100644 --- a/libpurple/certificate.c +++ b/libpurple/certificate.c @@ -680,77 +680,62 @@ purple_certificate_pool_destroy_idlist(GList *idlist) /****************************************************************************/ static void -x509_singleuse_verify_cb (PurpleCertificateVerificationRequest *vrq, gint id) +x509_singleuse_verify_accept_cb(PurpleCertificateVerificationRequest *vrq) { g_return_if_fail(vrq); purple_debug_info("certificate/x509_singleuse", - "VRQ on cert from %s gave %d\n", - vrq->subject_name, id); - - /* Signal what happened back to the caller */ - if (1 == id) { - /* Accepted! */ - purple_certificate_verify_complete(vrq, - PURPLE_CERTIFICATE_VALID); - } else { - /* Not accepted */ - purple_certificate_verify_complete(vrq, - PURPLE_CERTIFICATE_INVALID); + "VRQ on cert from %s accepted\n", + vrq->subject_name); - } + purple_certificate_verify_complete(vrq, PURPLE_CERTIFICATE_VALID); +} + +static void +x509_singleuse_verify_reject_cb(PurpleCertificateVerificationRequest *vrq) +{ + g_return_if_fail(vrq); + + purple_debug_info("certificate/x509_singleuse", + "VRQ on cert from %s rejected\n", + vrq->subject_name); + + purple_certificate_verify_complete(vrq, PURPLE_CERTIFICATE_INVALID); } static void x509_singleuse_start_verify (PurpleCertificateVerificationRequest *vrq) { - gchar *sha_asc; - GByteArray *sha_bin; gchar *cn; const gchar *cn_match; gchar *primary, *secondary; - PurpleCertificate *crt = (PurpleCertificate *) vrq->cert_chain->data; - - /* Pull out the SHA1 checksum */ - sha_bin = purple_certificate_get_fingerprint_sha1(crt); - /* Now decode it for display */ - sha_asc = purple_base16_encode_chunked(sha_bin->data, - sha_bin->len); + PurpleCertificate *crt = (PurpleCertificate *)vrq->cert_chain->data; - /* Get the cert Common Name */ cn = purple_certificate_get_subject_name(crt); - /* Determine whether the name matches */ if (purple_certificate_check_subject_name(crt, vrq->subject_name)) { - cn_match = ""; + cn_match = _("(MATCH)"); } else { cn_match = _("(DOES NOT MATCH)"); } - /* Make messages */ primary = g_strdup_printf(_("%s has presented the following certificate for just-this-once use:"), vrq->subject_name); - secondary = g_strdup_printf(_("Common name: %s %s\nFingerprint (SHA1): %s"), cn, cn_match, sha_asc); + secondary = g_strdup_printf(_("Common name: %s %s"), cn, cn_match); /* Make a semi-pretty display */ - purple_request_accept_cancel( + purple_request_certificate( vrq->cb_data, /* TODO: Find what the handle ought to be */ _("Single-use Certificate Verification"), primary, secondary, - 0, /* Accept by default */ - NULL, /* No account */ - NULL, /* No other user */ - NULL, /* No associated conversation */ - vrq, - x509_singleuse_verify_cb, - x509_singleuse_verify_cb ); + crt, + _("Accept"), G_CALLBACK(x509_singleuse_verify_accept_cb), + _("Reject"), G_CALLBACK(x509_singleuse_verify_reject_cb), + vrq); - /* Cleanup */ g_free(cn); g_free(primary); g_free(secondary); - g_free(sha_asc); - g_byte_array_free(sha_bin, TRUE); } static void @@ -1307,102 +1292,34 @@ static PurpleCertificatePool x509_tls_peers = { static PurpleCertificateVerifier x509_tls_cached; -/* The following is several hacks piled together and needs to be fixed. - * It exists because show_cert (see its comments) needs the original reason - * given to user_auth in order to rebuild the dialog. - */ -/* TODO: This will cause a ua_ctx to become memleaked if the request(s) get - closed by handle or otherwise abnormally. */ -typedef struct { - PurpleCertificateVerificationRequest *vrq; - gchar *reason; -} x509_tls_cached_ua_ctx; - -static x509_tls_cached_ua_ctx * -x509_tls_cached_ua_ctx_new(PurpleCertificateVerificationRequest *vrq, - const gchar *reason) -{ - x509_tls_cached_ua_ctx *c; - - c = g_new0(x509_tls_cached_ua_ctx, 1); - c->vrq = vrq; - c->reason = g_strdup(reason); - - return c; -} - - -static void -x509_tls_cached_ua_ctx_free(x509_tls_cached_ua_ctx *c) -{ - g_return_if_fail(c); - g_free(c->reason); - g_free(c); -} - -static void -x509_tls_cached_user_auth(PurpleCertificateVerificationRequest *vrq, - const gchar *reason); - static void -x509_tls_cached_show_cert(x509_tls_cached_ua_ctx *c, gint id) +x509_tls_cached_user_auth_accept_cb(PurpleCertificateVerificationRequest *vrq) { - PurpleCertificate *disp_crt = c->vrq->cert_chain->data; - - /* Since clicking a button closes the request, show it again */ - x509_tls_cached_user_auth(c->vrq, c->reason); - - /* Show the certificate AFTER re-opening the dialog so that this - appears above the other */ - purple_certificate_display_x509(disp_crt); - - x509_tls_cached_ua_ctx_free(c); -} - -static void -x509_tls_cached_user_auth_cb (x509_tls_cached_ua_ctx *c, gint id) -{ - PurpleCertificateVerificationRequest *vrq; PurpleCertificatePool *tls_peers; + gchar *cache_id; - g_return_if_fail(c); - g_return_if_fail(c->vrq); - - vrq = c->vrq; - - x509_tls_cached_ua_ctx_free(c); + g_return_if_fail(vrq); - tls_peers = purple_certificate_find_pool("x509","tls_peers"); + tls_peers = purple_certificate_find_pool("x509", "tls_peers"); - if (2 == id) { - gchar *cache_id = vrq->subject_name; - purple_debug_info("certificate/x509/tls_cached", + cache_id = vrq->subject_name; + purple_debug_info("certificate/x509/tls_cached", "User ACCEPTED cert\nCaching first in chain for future use as %s...\n", cache_id); - purple_certificate_pool_store(tls_peers, cache_id, - vrq->cert_chain->data); + purple_certificate_pool_store(tls_peers, cache_id, vrq->cert_chain->data); - purple_certificate_verify_complete(vrq, - PURPLE_CERTIFICATE_VALID); - } else { - purple_debug_warning("certificate/x509/tls_cached", - "User REJECTED cert\n"); - purple_certificate_verify_complete(vrq, - PURPLE_CERTIFICATE_INVALID); - } + purple_certificate_verify_complete(vrq, PURPLE_CERTIFICATE_VALID); } static void -x509_tls_cached_user_auth_accept_cb(x509_tls_cached_ua_ctx *c, gint ignore) +x509_tls_cached_user_auth_reject_cb(PurpleCertificateVerificationRequest *vrq) { - x509_tls_cached_user_auth_cb(c, 2); -} + g_return_if_fail(vrq); -static void -x509_tls_cached_user_auth_reject_cb(x509_tls_cached_ua_ctx *c, gint ignore) -{ - x509_tls_cached_user_auth_cb(c, 1); + purple_debug_warning("certificate/x509/tls_cached", "User REJECTED cert\n"); + + purple_certificate_verify_complete(vrq, PURPLE_CERTIFICATE_INVALID); } /** Validates a certificate by asking the user @@ -1416,27 +1333,19 @@ x509_tls_cached_user_auth(PurpleCertificateVerificationRequest *vrq, { gchar *primary; - /* Make messages */ primary = g_strdup_printf(_("Accept certificate for %s?"), vrq->subject_name); - /* Make a semi-pretty display */ - purple_request_action( + purple_request_certificate( vrq->cb_data, /* TODO: Find what the handle ought to be */ _("SSL Certificate Verification"), primary, reason, - 0, /* Accept by default */ - NULL, /* No account */ - NULL, /* No other user */ - NULL, /* No associated conversation */ - x509_tls_cached_ua_ctx_new(vrq, reason), - 3, /* Number of actions */ - _("Accept"), x509_tls_cached_user_auth_accept_cb, - _("Reject"), x509_tls_cached_user_auth_reject_cb, - _("_View Certificate..."), x509_tls_cached_show_cert); + vrq->cert_chain->data, + _("Accept"), G_CALLBACK(x509_tls_cached_user_auth_accept_cb), + _("Reject"), G_CALLBACK(x509_tls_cached_user_auth_reject_cb), + vrq); - /* Cleanup */ g_free(primary); } -- cgit v1.2.1 From 7db76cdce05b3cc72630907c3544a7d88c399984 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 05:23:21 +0000 Subject: Use GCR widgets for the certificate request field when available. --- pidgin/gtkrequest.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index 83085e4ce3..2928eca698 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -39,6 +39,12 @@ #include +#ifdef ENABLE_GCR +#define GCR_API_SUBJECT_TO_CHANGE +#include +#include +#endif + static GtkWidget * create_account_field(PurpleRequestField *field); typedef struct @@ -1194,12 +1200,33 @@ create_list_field(PurpleRequestField *field) static GtkWidget * create_certificate_field(PurpleRequestField *field) { - GtkWidget *cert_label; PurpleCertificate *cert; +#ifdef ENABLE_GCR + GcrCertificateBasicsWidget *cert_widget; + GByteArray *der; + GcrCertificate *gcrt; +#else + GtkWidget *cert_label; char *str; char *escaped; +#endif cert = purple_request_field_certificate_get_value(field); + +#ifdef ENABLE_GCR + der = purple_certificate_get_der_data(crt); + g_return_val_if_fail(der, NULL); + + gcrt = gcr_simple_certificate_new(der->data, der->len); + g_return_val_if_fail(gcrt, NULL); + + cert_widget = gcr_certificate_basics_widget_new(gcrt); + + g_byte_array_free(der, TRUE); + g_object_unref(G_OBJECT(gcrt)); + + return cert_widget; +#else str = purple_certificate_get_display_string(cert); escaped = g_markup_escape_text(str, -1); @@ -1212,6 +1239,7 @@ create_certificate_field(PurpleRequestField *field) g_free(escaped); return cert_label; +#endif } static void * -- cgit v1.2.1 From f4bb4b1297e893308c983aabeec68a065d57fb73 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 05:33:00 +0000 Subject: Use the new certificate request API in the certificate manager. I think I also fixed a few leaks from my previous changes. --- pidgin/gtkcertmgr.c | 45 +++++---------------------------------------- 1 file changed, 5 insertions(+), 40 deletions(-) diff --git a/pidgin/gtkcertmgr.c b/pidgin/gtkcertmgr.c index daf999ccc2..bfac2752d1 100644 --- a/pidgin/gtkcertmgr.c +++ b/pidgin/gtkcertmgr.c @@ -40,12 +40,6 @@ #include "gtkcertmgr.h" -#ifdef ENABLE_GCR -#define GCR_API_SUBJECT_TO_CHANGE -#include -#include -#endif - /***************************************************************************** * X.509 tls_peers management interface * *****************************************************************************/ @@ -316,13 +310,7 @@ tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data) GtkTreeModel *model; gchar *id; PurpleCertificate *crt; -#ifdef ENABLE_GCR - GByteArray *der; - GcrCertificate *gcrt; char *title; - GtkWidget *dialog; - GcrCertificateBasicsWidget *cert_widget; -#endif /* See if things are selected */ if (!gtk_tree_selection_get_selected(select, &model, &iter)) { @@ -338,38 +326,15 @@ tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data) crt = purple_certificate_pool_retrieve(tpm_dat->tls_peers, id); g_return_if_fail(crt); -#ifdef ENABLE_GCR - der = purple_certificate_get_der_data(crt); - g_return_if_fail(der); - - gcrt = gcr_simple_certificate_new(der->data, der->len); - g_return_if_fail(gcrt); - /* Fire the notification */ title = g_strdup_printf(_("Certificate Information for %s"), id); - dialog = gtk_dialog_new_with_buttons(title, - NULL, - 0, - GTK_STOCK_OK, - GTK_RESPONSE_ACCEPT, - NULL); - cert_widget = gcr_certificate_basics_widget_new(gcrt); - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - GTK_WIDGET(cert_widget), TRUE, TRUE, 0); - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - gtk_widget_show_all(dialog); - - g_byte_array_free(der, TRUE); - g_object_unref(G_OBJECT(gcrt)); -#else - /* Fire the notification */ - purple_certificate_display_x509(crt); + purple_request_certificate(tpm_dat, title, NULL, NULL, crt, + _("OK"), G_CALLBACK(purple_certificate_destroy), + _("Cancel"), G_CALLBACK(purple_certificate_destroy), + crt); g_free(id); - purple_certificate_destroy(crt); -#endif + g_free(title); } static void -- cgit v1.2.1 From 40efc1f2b9a4c88c7bd6c5254017f72b7d2fc75d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 05:34:08 +0000 Subject: Get rid of purple_certificate_display_x509, now that there's a request API for it. --- ChangeLog.API | 2 ++ libpurple/certificate.c | 19 ------------------- libpurple/certificate.h | 9 --------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/ChangeLog.API b/ChangeLog.API index 87e9a9d7f1..503b7a1859 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -164,6 +164,8 @@ version 3.0.0 (??/??/????): * purple_buddy_icons_set_custom_icon * purple_certificate_check_signature_chain_with_failing. Use purple_certificate_check_signature_chain, instead + * purple_certificate_display_x509. Use purple_request_certificate, + instead * purple_connection_error_reason * purple_connection_new * purple_connection_new_unregister diff --git a/libpurple/certificate.c b/libpurple/certificate.c index 0c64017186..f714ee3408 100644 --- a/libpurple/certificate.c +++ b/libpurple/certificate.c @@ -2092,25 +2092,6 @@ purple_certificate_unregister_pool(PurpleCertificatePool *pool) /* Scheme-specific functions */ /****************************************************************************/ -void -purple_certificate_display_x509(PurpleCertificate *crt) -{ - gchar *secondary; - - /* Make messages */ - secondary = purple_certificate_get_display_string(crt); - - /* Make a semi-pretty display */ - purple_notify_info( - NULL, /* TODO: Find what the handle ought to be */ - _("Certificate Information"), - "", - secondary); - - /* Cleanup */ - g_free(secondary); -} - void purple_certificate_add_ca_search_path(const char *path) { if (g_list_find_custom(x509_ca_paths, path, (GCompareFunc)strcmp)) diff --git a/libpurple/certificate.h b/libpurple/certificate.h index 5c1f1cb27b..96b1da5280 100644 --- a/libpurple/certificate.h +++ b/libpurple/certificate.h @@ -833,15 +833,6 @@ purple_certificate_unregister_pool(PurpleCertificatePool *pool); /*@}*/ -/** - * Displays a window showing X.509 certificate information - * - * @param crt Certificate under an "x509" Scheme - * @todo Will break on CA certs, as they have no Common Name - */ -void -purple_certificate_display_x509(PurpleCertificate *crt); - /** * Add a search path for certificates. * -- cgit v1.2.1 From 9602adb91cf385d0f16d7cf720d077eb7b3c1d28 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 05:49:17 +0000 Subject: Fix a small typo and add a cast. --- pidgin/gtkrequest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index 2928eca698..5ac8c20fb9 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -1214,7 +1214,7 @@ create_certificate_field(PurpleRequestField *field) cert = purple_request_field_certificate_get_value(field); #ifdef ENABLE_GCR - der = purple_certificate_get_der_data(crt); + der = purple_certificate_get_der_data(cert); g_return_val_if_fail(der, NULL); gcrt = gcr_simple_certificate_new(der->data, der->len); @@ -1225,7 +1225,7 @@ create_certificate_field(PurpleRequestField *field) g_byte_array_free(der, TRUE); g_object_unref(G_OBJECT(gcrt)); - return cert_widget; + return GTK_WIDGET(cert_widget); #else str = purple_certificate_get_display_string(cert); escaped = g_markup_escape_text(str, -1); -- cgit v1.2.1 From 41ff357d3473b91b9d3149a4b257188aeae6037b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 06:40:05 +0000 Subject: Remove an old debug line. --- pidgin/gtkblist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index afa4a51fe1..a330be8009 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -8324,7 +8324,6 @@ pidgin_blist_update_plugin_actions(void) NULL); gtk_ui_manager_insert_action_group(gtkblist->ui, plugins_action_group, 1); plugins_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string, -1, NULL); -purple_debug_info("blist", "The plugins menu is {%s}\n", ui_string); g_string_free(plugins_ui, TRUE); g_free(ui_string); -- cgit v1.2.1 From 13b16f345bb5516c2d3f1942195652387058be1a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 06:40:46 +0000 Subject: This Privacy senstivity-toggle can be rolled in with the others. --- pidgin/gtkblist.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index a330be8009..c400b14784 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -4549,6 +4549,7 @@ static const char *require_connection[] = "/BList/BuddiesMenu/AddBuddy", "/BList/BuddiesMenu/AddChat", "/BList/BuddiesMenu/AddGroup", + "/BList/ToolsMenu/Privacy", }; static const int require_connection_size = sizeof(require_connection) @@ -4583,9 +4584,6 @@ update_menu_bar(PidginBuddyList *gtkblist) action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/AddChat"); gtk_action_set_sensitive(action, pidgin_blist_joinchat_is_showable()); - action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/Privacy"); - gtk_action_set_sensitive(action, sensitive); - action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/RoomList"); gtk_action_set_sensitive(action, pidgin_roomlist_is_showable()); } -- cgit v1.2.1 From 0ee40dbd17c90272d197a16fa1a19e39444dcd8b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 07:40:21 +0000 Subject: Restore loading and saving of accels, which was lost at some point. --- pidgin/gtkblist.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index c400b14784..b9ccd0a35e 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -5871,6 +5871,8 @@ static void pidgin_blist_show(PurpleBuddyList *list) accel_group = gtk_ui_manager_get_accel_group(gtkblist->ui); gtk_window_add_accel_group(GTK_WINDOW(gtkblist->window), accel_group); + pidgin_load_accels(); + g_signal_connect(G_OBJECT(accel_group), "accel-changed", G_CALLBACK(pidgin_save_accels_cb), NULL); error = NULL; if (!gtk_ui_manager_add_ui_from_string(gtkblist->ui, blist_menu, -1, &error)) -- cgit v1.2.1 From 8bf4697f24abe2f4f5bfcb290e07f313dc1494a9 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 07:55:12 +0000 Subject: Change these accel paths to match what's automatically generated. --- pidgin/gtkblist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index b9ccd0a35e..597dc58adb 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -8113,7 +8113,7 @@ pidgin_blist_update_accounts_menu(void) submenu = gtk_menu_new(); gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); - gtk_menu_set_accel_path(GTK_MENU(submenu), N_("
    /AccountsMenu/EnableAccount")); + gtk_menu_set_accel_path(GTK_MENU(submenu), "/BListActions/EnableAccount"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); disabled_accounts = TRUE; @@ -8168,7 +8168,7 @@ pidgin_blist_update_accounts_menu(void) buf = g_strconcat(purple_account_get_username(account), " (", purple_account_get_protocol_name(account), ")", NULL); menuitem = gtk_image_menu_item_new_with_label(buf); - accel_path_buf = g_strconcat(N_("
    /AccountsMenu/"), buf, NULL); + accel_path_buf = g_strconcat("/AccountActions/", buf, NULL); g_free(buf); pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); -- cgit v1.2.1 From a3ac772e11ada35091a20a57c1c5e69200f1bc3e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 08:21:37 +0000 Subject: Restore a minor comment. --- pidgin/gtkconv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 8ca0eaf468..d9331763a9 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3372,7 +3372,7 @@ regenerate_media_items(PidginWindow *win) gtk_action_set_sensitive(win->video_call, caps & PURPLE_MEDIA_CAPS_VIDEO ? TRUE : FALSE); - gtk_action_set_sensitive(win->audio_video_call, + gtk_action_set_sensitive(win->audio_video_call, caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO ? TRUE : FALSE); } else if (purple_conversation_get_type(conv) @@ -3601,6 +3601,9 @@ setup_menubar(PidginWindow *win) win->menu.menubar = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation"); + /* Make sure the 'Conversation -> More' menuitems are regenerated whenever + * the 'Conversation' menu pops up because the entries can change after the + * conversation is created. */ menuitem = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/ConversationMenu"); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menubar_activated), win); -- cgit v1.2.1 From d13c1329c818f1be84e946791a2119a17f1d0f1d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 26 Feb 2012 08:26:11 +0000 Subject: This struct member seems to be unused now. --- pidgin/gtkconv.c | 1 - pidgin/gtkconvwin.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index d9331763a9..4391514e3f 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -3703,7 +3703,6 @@ setup_menubar(PidginWindow *win) win->menu.show_timestamps = gtk_ui_manager_get_action(win->menu.ui, "/Conversation/OptionsMenu/ShowTimestamps"); - win->menu.show_icon = NULL; win->menu.tray = pidgin_menu_tray_new(); gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index 6914fb248a..a51a2908b2 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -70,8 +70,6 @@ struct _PidginWindow GtkAction *show_formatting_toolbar; GtkAction *show_timestamps; - GtkWidget *show_icon; - GtkWidget *send_to; GtkWidget *tray; -- cgit v1.2.1 From a2e8ec35b19224f85e3164e46c7f00642c82c337 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 27 Feb 2012 03:15:42 +0000 Subject: Implement webview formatting clearing. --- pidgin/gtkwebview.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 7c185d411e..46b64ab16b 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -314,6 +314,7 @@ static void webview_clear_formatting(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; if (!webkit_web_view_get_editable(WEBKIT_WEB_VIEW(webview))) return; @@ -335,6 +336,9 @@ webview_clear_formatting(GtkWebView *webview) g_free(priv->edit.background); priv->edit.background = NULL; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + webkit_dom_document_exec_command(dom, "removeFormat", FALSE, ""); } static void -- cgit v1.2.1 From 7939f5b4e3f0bf3b01867bde11e100148558ba81 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 27 Feb 2012 06:35:27 +0000 Subject: WebKit knows the current formatting of the selection better than we do, so don't bother saving it ourselves. --- pidgin/gtkwebview.c | 165 +++++++++++++++++++-------------------------- pidgin/gtkwebview.h | 8 +-- pidgin/gtkwebviewtoolbar.c | 19 ++++-- 3 files changed, 87 insertions(+), 105 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 46b64ab16b..4ff7ec78ee 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -68,16 +68,7 @@ typedef struct _GtkWebViewPriv { GtkWebViewButtons format_functions; struct { gboolean wbfo:1; /* Whole buffer formatting only. */ - gboolean bold:1; - gboolean italic:1; - gboolean underline:1; - gboolean strike:1; - gchar *forecolor; - gchar *backcolor; gchar *background; - gchar *fontface; - int fontsize; - /*GtkTextTag *link;*/ } edit; } GtkWebViewPriv; @@ -319,21 +310,6 @@ webview_clear_formatting(GtkWebView *webview) if (!webkit_web_view_get_editable(WEBKIT_WEB_VIEW(webview))) return; - priv->edit.bold = FALSE; - priv->edit.italic = FALSE; - priv->edit.underline = FALSE; - priv->edit.strike = FALSE; - priv->edit.fontsize = 0; - - g_free(priv->edit.fontface); - priv->edit.fontface = NULL; - - g_free(priv->edit.forecolor); - priv->edit.forecolor = NULL; - - g_free(priv->edit.backcolor); - priv->edit.backcolor = NULL; - g_free(priv->edit.background); priv->edit.background = NULL; @@ -545,6 +521,7 @@ gtk_webview_quote_js_string(const char *text) return g_string_free(str, FALSE); } + void gtk_webview_safe_execute_script(GtkWebView *webview, const char *script) { @@ -611,7 +588,8 @@ gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) } } -void gtk_webview_page_up(GtkWebView *webview) +void +gtk_webview_page_up(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); GtkAdjustment *vadj = priv->vadj; @@ -628,7 +606,8 @@ void gtk_webview_page_up(GtkWebView *webview) gtk_adjustment_set_value(vadj, scroll_val); } -void gtk_webview_page_down(GtkWebView *webview) +void +gtk_webview_page_down(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); GtkAdjustment *vadj = priv->vadj; @@ -657,12 +636,12 @@ gtk_webview_set_editable(GtkWebView *webview, gboolean editable) void gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); GtkWebViewButtons buttons; if (flags & PURPLE_CONNECTION_HTML) { char color[8]; GdkColor fg_color, bg_color; + gboolean bold, italic, underline, strike; buttons = GTK_WEBVIEW_ALL; @@ -676,17 +655,19 @@ gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) if (flags & PURPLE_CONNECTION_NO_URLDESC) buttons &= ~GTK_WEBVIEW_LINKDESC; + gtk_webview_get_current_format(webview, &bold, &italic, &underline, &strike); + gtk_webview_set_format_functions(webview, GTK_WEBVIEW_ALL); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold") != priv->edit.bold) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold") != bold) gtk_webview_toggle_bold(webview); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic") != priv->edit.italic) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic") != italic) gtk_webview_toggle_italic(webview); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline") != priv->edit.underline) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline") != underline) gtk_webview_toggle_underline(webview); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_strike") != priv->edit.strike) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_strike") != strike) gtk_webview_toggle_strike(webview); gtk_webview_toggle_fontface(webview, @@ -705,24 +686,26 @@ gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) { gdk_color_parse(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor"), &fg_color); - g_snprintf(color, sizeof(color), "#%02x%02x%02x", - fg_color.red / 256, - fg_color.green / 256, - fg_color.blue / 256); + g_snprintf(color, sizeof(color), + "#%02x%02x%02x", + fg_color.red / 256, + fg_color.green / 256, + fg_color.blue / 256); } else strcpy(color, ""); gtk_webview_toggle_forecolor(webview, color); - if(!(flags & PURPLE_CONNECTION_NO_BGCOLOR) && - strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), "") != 0) + if (!(flags & PURPLE_CONNECTION_NO_BGCOLOR) && + strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), "") != 0) { gdk_color_parse(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), &bg_color); - g_snprintf(color, sizeof(color), "#%02x%02x%02x", - bg_color.red / 256, - bg_color.green / 256, - bg_color.blue / 256); + g_snprintf(color, sizeof(color), + "#%02x%02x%02x", + bg_color.red / 256, + bg_color.green / 256, + bg_color.blue / 256); } else strcpy(color, ""); @@ -777,50 +760,63 @@ gtk_webview_get_current_format(GtkWebView *webview, gboolean *bold, gboolean *italic, gboolean *underline, gboolean *strike) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + if (bold) - *bold = priv->edit.bold; + *bold = webkit_dom_document_query_command_state(dom, "bold"); if (italic) - *italic = priv->edit.italic; + *italic = webkit_dom_document_query_command_state(dom, "italic"); if (underline) - *underline = priv->edit.underline; + *underline = webkit_dom_document_query_command_state(dom, "underline"); if (strike) - *strike = priv->edit.strike; + *strike = webkit_dom_document_query_command_state(dom, "strikethrough"); } -const char * +char * gtk_webview_get_current_fontface(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return priv->edit.fontface; + WebKitDOMDocument *dom; + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + return webkit_dom_document_query_command_value(dom, "fontName"); } -const char * +char * gtk_webview_get_current_forecolor(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return priv->edit.forecolor; + WebKitDOMDocument *dom; + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + return webkit_dom_document_query_command_value(dom, "foreColor"); } -const char * +char * gtk_webview_get_current_backcolor(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return priv->edit.backcolor; + WebKitDOMDocument *dom; + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + return webkit_dom_document_query_command_value(dom, "backColor"); } -const char * +char * gtk_webview_get_current_background(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return priv->edit.background; + return g_strdup(priv->edit.background); } gint gtk_webview_get_current_fontsize(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return priv->edit.fontsize; + WebKitDOMDocument *dom; + gchar *text; + gint size; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + text = webkit_dom_document_query_command_value(dom, "fontSize"); + size = atoi(text); + g_free(text); + + return size; } gboolean @@ -845,11 +841,8 @@ gtk_webview_clear_formatting(GtkWebView *webview) void gtk_webview_toggle_bold(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - priv->edit.bold = !priv->edit.bold; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); webkit_dom_document_exec_command(dom, "bold", FALSE, ""); } @@ -857,11 +850,8 @@ gtk_webview_toggle_bold(GtkWebView *webview) void gtk_webview_toggle_italic(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - priv->edit.italic = !priv->edit.italic; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); webkit_dom_document_exec_command(dom, "italic", FALSE, ""); } @@ -869,11 +859,8 @@ gtk_webview_toggle_italic(GtkWebView *webview) void gtk_webview_toggle_underline(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - priv->edit.underline = !priv->edit.underline; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); webkit_dom_document_exec_command(dom, "underline", FALSE, ""); } @@ -881,11 +868,8 @@ gtk_webview_toggle_underline(GtkWebView *webview) void gtk_webview_toggle_strike(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - priv->edit.strike = !priv->edit.strike; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); webkit_dom_document_exec_command(dom, "strikethrough", FALSE, ""); } @@ -893,14 +877,10 @@ gtk_webview_toggle_strike(GtkWebView *webview) gboolean gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - g_free(priv->edit.forecolor); - priv->edit.forecolor = g_strdup(color); - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "forecolor", FALSE, color); + webkit_dom_document_exec_command(dom, "foreColor", FALSE, color); return FALSE; } @@ -908,14 +888,10 @@ gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) gboolean gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - g_free(priv->edit.backcolor); - priv->edit.backcolor = g_strdup(color); - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "backcolor", FALSE, color); + webkit_dom_document_exec_command(dom, "backColor", FALSE, color); return FALSE; } @@ -934,14 +910,10 @@ gtk_webview_toggle_background(GtkWebView *webview, const char *color) gboolean gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - g_free(priv->edit.fontface); - priv->edit.fontface = g_strdup(face); - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "fontname", FALSE, face); + webkit_dom_document_exec_command(dom, "fontName", FALSE, face); return FALSE; } @@ -949,15 +921,12 @@ gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) void gtk_webview_font_set_size(GtkWebView *webview, gint size) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; char *tmp; - priv->edit.fontsize = size; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); tmp = g_strdup_printf("%d", size); - webkit_dom_document_exec_command(dom, "fontsize", FALSE, tmp); + webkit_dom_document_exec_command(dom, "fontSize", FALSE, tmp); g_free(tmp); } @@ -966,13 +935,15 @@ gtk_webview_font_shrink(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; + gint fontsize; char *tmp; - priv->edit.fontsize = MAX(priv->edit.fontsize - 1, 1); + fontsize = gtk_webview_get_current_fontsize(webview); + fontsize = MAX(fontsize - 1, 1); dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - tmp = g_strdup_printf("%d", priv->edit.fontsize); - webkit_dom_document_exec_command(dom, "fontsize", FALSE, tmp); + tmp = g_strdup_printf("%d", fontsize); + webkit_dom_document_exec_command(dom, "fontSize", FALSE, tmp); g_free(tmp); } @@ -981,13 +952,15 @@ gtk_webview_font_grow(GtkWebView *webview) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; + gint fontsize; char *tmp; - priv->edit.fontsize = MIN(priv->edit.fontsize + 1, MAX_FONT_SIZE); + fontsize = gtk_webview_get_current_fontsize(webview); + fontsize = MIN(fontsize + 1, MAX_FONT_SIZE); dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - tmp = g_strdup_printf("%d", priv->edit.fontsize); - webkit_dom_document_exec_command(dom, "fontsize", FALSE, tmp); + tmp = g_strdup_printf("%d", fontsize); + webkit_dom_document_exec_command(dom, "fontSize", FALSE, tmp); g_free(tmp); } diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index bcfafa68db..09b5be0743 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -242,7 +242,7 @@ void gtk_webview_get_current_format(GtkWebView *webview, gboolean *bold, * * @return A string containing the font face or @c NULL if none is set. */ -const char *gtk_webview_get_current_fontface(GtkWebView *webview); +char *gtk_webview_get_current_fontface(GtkWebView *webview); /** * Returns a string containing the selected foreground color at the current @@ -252,7 +252,7 @@ const char *gtk_webview_get_current_fontface(GtkWebView *webview); * * @return A string containing the foreground color or @c NULL if none is set. */ -const char *gtk_webview_get_current_forecolor(GtkWebView *webview); +char *gtk_webview_get_current_forecolor(GtkWebView *webview); /** * Returns a string containing the selected font background color at the current @@ -262,7 +262,7 @@ const char *gtk_webview_get_current_forecolor(GtkWebView *webview); * * @return A string containing the background color or @c NULL if none is set. */ -const char *gtk_webview_get_current_backcolor(GtkWebView *webview); +char *gtk_webview_get_current_backcolor(GtkWebView *webview); /** * Returns a string containing the selected background color at the current @@ -272,7 +272,7 @@ const char *gtk_webview_get_current_backcolor(GtkWebView *webview); * * @return A string containg the background color or @c NULL if none is set. */ -const char *gtk_webview_get_current_background(GtkWebView *webview); +char *gtk_webview_get_current_background(GtkWebView *webview); /** * Returns a integer containing the selected HTML font size at the current diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index dac68476c0..7fec471157 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -253,7 +253,7 @@ toggle_font(GtkWidget *font, GtkWebViewToolbar *toolbar) priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) { - const char *fontname = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); + char *fontname = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); if (!priv->font_dialog) { priv->font_dialog = gtk_font_selection_dialog_new(_("Select Font")); @@ -279,6 +279,8 @@ toggle_font(GtkWidget *font, GtkWebViewToolbar *toolbar) } gtk_window_present(GTK_WINDOW(priv->font_dialog)); + + g_free(fontname); } else { cancel_toolbar_font(font, toolbar); } @@ -341,7 +343,7 @@ toggle_fg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { GtkWidget *colorsel; GdkColor fgcolor; - const char *color = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); + char *color = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); if (!priv->fgcolor_dialog) { priv->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); @@ -360,6 +362,8 @@ toggle_fg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) } gtk_window_present(GTK_WINDOW(priv->fgcolor_dialog)); + + g_free(color); } else { cancel_toolbar_fgcolor(color, toolbar); } @@ -432,7 +436,7 @@ toggle_bg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { GtkWidget *colorsel; GdkColor bgcolor; - const char *color = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); + char *color = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); if (!priv->bgcolor_dialog) { priv->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); @@ -451,6 +455,8 @@ toggle_bg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) } gtk_window_present(GTK_WINDOW(priv->bgcolor_dialog)); + + g_free(color); } else { cancel_toolbar_bgcolor(color, toolbar); } @@ -1098,8 +1104,7 @@ update_buttons(GtkWebViewToolbar *toolbar) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); gboolean bold, italic, underline, strike; - const char *tmp; - const char *tmp2; + char *tmp, *tmp2; GtkLabel *label = GTK_LABEL(priv->font_label); gtk_label_set_label(label, _("_Font")); @@ -1158,6 +1163,7 @@ update_buttons(GtkWebViewToolbar *toolbar) gtk_label_set_markup_with_mnemonic(label, markup); g_free(markup); } + g_free(tmp); tmp = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->fgcolor), @@ -1168,6 +1174,7 @@ update_buttons(GtkWebViewToolbar *toolbar) gtk_label_set_markup_with_mnemonic(label, markup); g_free(markup); } + g_free(tmp); tmp = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); tmp2 = gtk_webview_get_current_background(GTK_WEBVIEW(toolbar->webview)); @@ -1179,6 +1186,8 @@ update_buttons(GtkWebViewToolbar *toolbar) gtk_label_set_markup_with_mnemonic(label, markup); g_free(markup); } + g_free(tmp); + g_free(tmp2); } static void -- cgit v1.2.1 From a09f3ec17e8cba08208715667947be861278e470 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 27 Feb 2012 06:41:57 +0000 Subject: Having a backcolor and a background seems a bit redundant. And we just set one to the other anyway. Might as well keep things simple. --- pidgin/gtkwebview.c | 25 +------------------------ pidgin/gtkwebview.h | 34 ++++++---------------------------- pidgin/gtkwebviewtoolbar.c | 20 ++++---------------- 3 files changed, 11 insertions(+), 68 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 4ff7ec78ee..507ddc2882 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -68,7 +68,6 @@ typedef struct _GtkWebViewPriv { GtkWebViewButtons format_functions; struct { gboolean wbfo:1; /* Whole buffer formatting only. */ - gchar *background; } edit; } GtkWebViewPriv; @@ -304,15 +303,11 @@ scroll_idle_cb(gpointer data) static void webview_clear_formatting(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; if (!webkit_web_view_get_editable(WEBKIT_WEB_VIEW(webview))) return; - g_free(priv->edit.background); - priv->edit.background = NULL; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); webkit_dom_document_exec_command(dom, "removeFormat", FALSE, ""); } @@ -709,7 +704,7 @@ gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) } else strcpy(color, ""); - gtk_webview_toggle_background(webview, color); + gtk_webview_toggle_backcolor(webview, color); if (flags & PURPLE_CONNECTION_FORMATTING_WBFO) gtk_webview_set_whole_buffer_formatting_only(webview, TRUE); @@ -797,13 +792,6 @@ gtk_webview_get_current_backcolor(GtkWebView *webview) return webkit_dom_document_query_command_value(dom, "backColor"); } -char * -gtk_webview_get_current_background(GtkWebView *webview) -{ - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - return g_strdup(priv->edit.background); -} - gint gtk_webview_get_current_fontsize(GtkWebView *webview) { @@ -896,17 +884,6 @@ gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) return FALSE; } -gboolean -gtk_webview_toggle_background(GtkWebView *webview, const char *color) -{ - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - - g_free(priv->edit.background); - priv->edit.background = g_strdup(color); - - return FALSE; -} - gboolean gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) { diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 09b5be0743..ec6ce22f4a 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -48,14 +48,13 @@ typedef enum { GTK_WEBVIEW_FACE = 1 << 5, GTK_WEBVIEW_FORECOLOR = 1 << 6, GTK_WEBVIEW_BACKCOLOR = 1 << 7, - GTK_WEBVIEW_BACKGROUND = 1 << 8, - GTK_WEBVIEW_LINK = 1 << 9, - GTK_WEBVIEW_IMAGE = 1 << 10, - GTK_WEBVIEW_SMILEY = 1 << 11, - GTK_WEBVIEW_LINKDESC = 1 << 12, - GTK_WEBVIEW_STRIKE = 1 << 13, + GTK_WEBVIEW_LINK = 1 << 8, + GTK_WEBVIEW_IMAGE = 1 << 9, + GTK_WEBVIEW_SMILEY = 1 << 10, + GTK_WEBVIEW_LINKDESC = 1 << 11, + GTK_WEBVIEW_STRIKE = 1 << 12, /** Show custom smileys when appropriate. */ - GTK_WEBVIEW_CUSTOM_SMILEY = 1 << 14, + GTK_WEBVIEW_CUSTOM_SMILEY = 1 << 13, GTK_WEBVIEW_ALL = -1 } GtkWebViewButtons; @@ -264,16 +263,6 @@ char *gtk_webview_get_current_forecolor(GtkWebView *webview); */ char *gtk_webview_get_current_backcolor(GtkWebView *webview); -/** - * Returns a string containing the selected background color at the current - * position in a GtkWebView. - * - * @param webview The GtkWebView - * - * @return A string containg the background color or @c NULL if none is set. - */ -char *gtk_webview_get_current_background(GtkWebView *webview); - /** * Returns a integer containing the selected HTML font size at the current * position in a GtkWebView. @@ -350,17 +339,6 @@ gboolean gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color); */ gboolean gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color); -/** - * Toggles a background color at the current location or selection in a - * GtkWebView. - * - * @param webview The GtkWebView - * @param color The HTML-style color, or @c NULL or "" to clear the color. - * - * @return @c TRUE if a color was set, or @c FALSE if it was cleared. - */ -gboolean gtk_webview_toggle_background(GtkWebView *webview, const char *color); - /** * Toggles a font face at the current location or selection in a GtkWebView. * diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index 7fec471157..dec473fe15 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -377,12 +377,7 @@ destroy_toolbar_bgcolor(GtkWidget *widget, GdkEvent *event, { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); if (widget != NULL) { -#if 0 - if (gtk_text_buffer_get_selection_bounds(GTK_WEBVIEW(toolbar->webview)->text_buffer, NULL, NULL)) - gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), ""); - else -#endif - gtk_webview_toggle_background(GTK_WEBVIEW(toolbar->webview), ""); + gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), ""); } if (priv->bgcolor_dialog != NULL) @@ -418,12 +413,7 @@ do_bgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar) text_color.red / 256, text_color.green / 256, text_color.blue / 256); -#if 0 - if (gtk_text_buffer_get_selection_bounds(GTK_WEBVIEW(toolbar->webview)->text_buffer, NULL, NULL)) - gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), open_tag); - else -#endif - gtk_webview_toggle_background(GTK_WEBVIEW(toolbar->webview), open_tag); + gtk_webview_toggle_backcolor(GTK_WEBVIEW(toolbar->webview), open_tag); g_free(open_tag); cancel_toolbar_bgcolor(NULL, toolbar); @@ -1104,7 +1094,7 @@ update_buttons(GtkWebViewToolbar *toolbar) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); gboolean bold, italic, underline, strike; - char *tmp, *tmp2; + char *tmp; GtkLabel *label = GTK_LABEL(priv->font_label); gtk_label_set_label(label, _("_Font")); @@ -1177,9 +1167,8 @@ update_buttons(GtkWebViewToolbar *toolbar) g_free(tmp); tmp = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); - tmp2 = gtk_webview_get_current_background(GTK_WEBVIEW(toolbar->webview)); toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->bgcolor), - (tmp != NULL || tmp2 != NULL), toolbar); + (tmp != NULL), toolbar); if (tmp != NULL) { gchar *markup = g_strdup_printf("%s", tmp, gtk_label_get_label(label)); @@ -1187,7 +1176,6 @@ update_buttons(GtkWebViewToolbar *toolbar) g_free(markup); } g_free(tmp); - g_free(tmp2); } static void -- cgit v1.2.1 From c0da86a9e0f81486458b378b8c9fdd2ad2404678 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 27 Feb 2012 06:42:29 +0000 Subject: Update prefs usage of the webview for previous changes. --- pidgin/gtkprefs.c | 57 ++++++++++++++++++++----------------------------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index a89fa9a989..57ae52c514 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -1306,50 +1306,36 @@ formatting_toggle_cb(GtkWebView *webview, GtkWebViewButtons buttons, void *toolb purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/font_size", gtk_webview_get_current_fontsize(webview)); if (buttons & GTK_WEBVIEW_FACE) { - const char *face = gtk_webview_get_current_fontface(webview); - if (!face) - face = ""; + char *face = gtk_webview_get_current_fontface(webview); - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/font_face", face); + if (face) + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/font_face", face); + else + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/font_face", ""); + + g_free(face); } if (buttons & GTK_WEBVIEW_FORECOLOR) { - const char *color = gtk_webview_get_current_forecolor(webview); - if (!color) - color = ""; + char *color = gtk_webview_get_current_forecolor(webview); + + if (color) + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor", color); + else + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor", ""); - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor", color); + g_free(color); } if (buttons & GTK_WEBVIEW_BACKCOLOR) { - const char *color; - GObject *object; - - color = gtk_webview_get_current_backcolor(webview); - if (!color) - color = ""; - - /* Block the signal to prevent a loop. */ - object = g_object_ref(G_OBJECT(webview)); - g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, NULL, - NULL, toolbar); - /* Clear the backcolor. */ - gtk_webview_toggle_backcolor(webview, ""); - /* Unblock the signal. */ - g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, 0, 0, - NULL, NULL, toolbar); - g_object_unref(object); - - /* This will fire a toggle signal and get saved below. */ - gtk_webview_toggle_background(webview, color); - } + char *color = gtk_webview_get_current_backcolor(webview); - if (buttons & GTK_WEBVIEW_BACKGROUND) { - const char *color = gtk_webview_get_current_background(webview); - if (!color) - color = ""; + if (color) + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor", color); + else + purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor", ""); - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor", color); + g_free(color); } } @@ -1703,8 +1689,7 @@ conv_page(void) GTK_WEBVIEW_SHRINK | GTK_WEBVIEW_FACE | GTK_WEBVIEW_FORECOLOR | - GTK_WEBVIEW_BACKCOLOR | - GTK_WEBVIEW_BACKGROUND); + GTK_WEBVIEW_BACKCOLOR); gtk_webview_append_html(GTK_WEBVIEW(webview), _("This is how your outgoing message text will " -- cgit v1.2.1 From 63c1909f5e65e2ba79030113a190cbdb9a4ae047 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 27 Feb 2012 06:44:05 +0000 Subject: Remove some unused variables. --- pidgin/gtkwebview.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 507ddc2882..912ad808cf 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -910,7 +910,6 @@ gtk_webview_font_set_size(GtkWebView *webview, gint size) void gtk_webview_font_shrink(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; gint fontsize; char *tmp; @@ -927,7 +926,6 @@ gtk_webview_font_shrink(GtkWebView *webview) void gtk_webview_font_grow(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; gint fontsize; char *tmp; -- cgit v1.2.1 From 371317f07e11bc2a1fda0ed47a48cfcad4e69e81 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 27 Feb 2012 23:07:49 +0000 Subject: Don't migrate the old autoaccept pref if the new one already exists. Otherwise, we would clobber the existing pref if it doesn't match the old pref. Fixes #14964. --- ChangeLog | 4 ++++ libpurple/plugins/autoaccept.c | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79239bd4d0..07ff91f5a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -74,6 +74,10 @@ version 2.10.2 (02/22/2012): Windows-Specific Changes: * Fix compilation of the Bonjour protocol plugin. (#14802) + Plugins: + * The autoaccept plugin will no longer reset the preference for unknown + buddies to "Auto Reject" in certain cases. (#14964) + version 2.10.1 (12/06/2011): Finch: * Fix compilation on OpenBSD. diff --git a/libpurple/plugins/autoaccept.c b/libpurple/plugins/autoaccept.c index 0f965fc541..280cc537cb 100644 --- a/libpurple/plugins/autoaccept.c +++ b/libpurple/plugins/autoaccept.c @@ -238,8 +238,12 @@ plugin_load(PurplePlugin *plugin) * between old libpurple clients and new libpurple clients. * --Mark Doliner, 2011-01-03 */ - if(purple_prefs_get_bool(PREF_STRANGER_OLD)) - purple_prefs_set_int(PREF_STRANGER, FT_REJECT); + if (!purple_prefs_exists(PREF_STRANGER)) { + if (purple_prefs_get_bool(PREF_STRANGER_OLD)) + purple_prefs_add_int(PREF_STRANGER, FT_REJECT); + else + purple_prefs_set_int(PREF_STRANGER, FT_ASK); + } purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", plugin, PURPLE_CALLBACK(file_recv_request_cb), plugin); @@ -345,7 +349,6 @@ init_plugin(PurplePlugin *plugin) { dirname = g_build_filename(purple_user_dir(), "autoaccept", NULL); purple_prefs_add_none(PREF_PREFIX); purple_prefs_add_string(PREF_PATH, dirname); - purple_prefs_add_int(PREF_STRANGER, FT_ASK); purple_prefs_add_bool(PREF_NOTIFY, TRUE); purple_prefs_add_bool(PREF_NEWDIR, TRUE); purple_prefs_add_bool(PREF_ESCAPE, TRUE); -- cgit v1.2.1 From 4a5023f27929fce34ad642f9032adb5524fec863 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Feb 2012 07:10:15 +0000 Subject: Remove purple_certificate_display_x509 from Perl wrappers. --- libpurple/plugins/perl/common/Certificate.xs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libpurple/plugins/perl/common/Certificate.xs b/libpurple/plugins/perl/common/Certificate.xs index 92fa36c8e2..3209d81af5 100644 --- a/libpurple/plugins/perl/common/Certificate.xs +++ b/libpurple/plugins/perl/common/Certificate.xs @@ -68,10 +68,6 @@ void purple_certificate_destroy(crt) Purple::Certificate crt -void -purple_certificate_display_x509(crt) - Purple::Certificate crt - ## changed order of arguments, so that $cert->export($file) could be used gboolean purple_certificate_export(crt, filename) -- cgit v1.2.1 From f63cea6fe40260163967aa043d39724788ea9b60 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 3 Mar 2012 06:39:49 +0000 Subject: Add a directory probe to theme loaders. The default just checks for $dir/purple/$type as the theme manager currently does. --- libpurple/theme-loader.c | 25 +++++++++++++++++++++++++ libpurple/theme-loader.h | 15 +++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/libpurple/theme-loader.c b/libpurple/theme-loader.c index 466ee90998..fd8a570253 100644 --- a/libpurple/theme-loader.c +++ b/libpurple/theme-loader.c @@ -85,6 +85,21 @@ purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *val } } +static gboolean +purple_theme_loader_probe_directory(PurpleThemeLoader *loader, const gchar *dir) +{ + const gchar *type = purple_theme_loader_get_type_string(loader); + char *themedir; + gboolean result; + + /* Checks for directory as $root/purple/$type */ + themedir = g_build_filename(dir, "purple", type, NULL); + result = g_file_test(themedir, G_FILE_TEST_IS_DIR); + g_free(themedir); + + return result; +} + static void purple_theme_loader_finalize(GObject *obj) { @@ -175,3 +190,13 @@ purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir) { return PURPLE_THEME_LOADER_GET_CLASS(loader)->purple_theme_loader_build(dir); } + +gboolean +purple_theme_loader_probe(PurpleThemeLoader *loader, const gchar *dir) +{ + if (PURPLE_THEME_LOADER_GET_CLASS(loader)->probe_directory != NULL) + return PURPLE_THEME_LOADER_GET_CLASS(loader)->probe_directory(dir); + else + return purple_theme_loader_probe_directory(loader, dir); +} + diff --git a/libpurple/theme-loader.h b/libpurple/theme-loader.h index 6dfa39dc90..dedef39d9f 100644 --- a/libpurple/theme-loader.h +++ b/libpurple/theme-loader.h @@ -56,6 +56,7 @@ struct _PurpleThemeLoaderClass { GObjectClass parent_class; PurpleTheme *((*purple_theme_loader_build)(const gchar*)); + gboolean (*probe_directory)(const gchar *); }; /**************************************************************************/ @@ -88,5 +89,19 @@ const gchar *purple_theme_loader_get_type_string(PurpleThemeLoader *self); */ PurpleTheme *purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir); +/** + * Probes a directory to see if it might possibly contain a theme + * + * This function might only check for obvious files or directory structure. + * Loading of a theme may fail for other reasons. + * The default prober checks for $dir/purple/$type. + * + * @param loader The theme loader + * @param dir The directory that may contain the theme + * + * @returns TRUE if the directory appears to contain a theme, FALSE otherwise. + */ +gboolean purple_theme_loader_probe(PurpleThemeLoader *loader, const gchar *dir); + G_END_DECLS #endif /* PURPLE_THEME_LOADER_H */ -- cgit v1.2.1 From 136659c47dbda256e2dac8aa9100055216e0870c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 3 Mar 2012 07:47:07 +0000 Subject: Use the theme loader probing function when searching directories. --- libpurple/theme-manager.c | 64 +++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/libpurple/theme-manager.c b/libpurple/theme-manager.c index 7b8e3506f8..25d7c42657 100644 --- a/libpurple/theme-manager.c +++ b/libpurple/theme-manager.c @@ -80,11 +80,14 @@ purple_theme_manager_is_theme_type(gchar *key, } static gboolean -purple_theme_manager_is_theme(gchar *key, - gpointer value, - gchar *user_data) +check_if_theme_or_loader(gchar *key, gpointer value, GSList **loaders) { - return PURPLE_IS_THEME(value); + if (PURPLE_IS_THEME(value)) + return TRUE; + else if (PURPLE_IS_THEME_LOADER(value)) + *loaders = g_slist_prepend(*loaders, value); + + return FALSE; } static void @@ -97,11 +100,12 @@ purple_theme_manager_function_wrapper(gchar *key, } static void -purple_theme_manager_build_dir(const gchar *root) +purple_theme_manager_build_dir(GSList *loaders, const gchar *root) { - gchar *purple_dir, *theme_dir; - const gchar *name = NULL, *type = NULL; - GDir *rdir, *tdir; + gchar *theme_dir; + const gchar *name; + GDir *rdir; + GSList *tmp; PurpleThemeLoader *loader; rdir = g_dir_open(root, 0, NULL); @@ -109,33 +113,20 @@ purple_theme_manager_build_dir(const gchar *root) if (!rdir) return; - /* Parses directory by root/name/purple/type */ while ((name = g_dir_read_name(rdir))) { - purple_dir = g_build_filename(root, name, "purple", NULL); - tdir = g_dir_open(purple_dir, 0, NULL); - - if (!tdir) { - g_free(purple_dir); + theme_dir = g_build_filename(root, name, NULL); - continue; - } - - while ((type = g_dir_read_name(tdir))) { - if ((loader = g_hash_table_lookup(theme_table, type))) { - PurpleTheme *theme = NULL; - - theme_dir = g_build_filename(purple_dir, type, NULL); - - theme = purple_theme_loader_build(loader, theme_dir); - g_free(theme_dir); + for (tmp = loaders; tmp; tmp = g_slist_next(tmp)) { + loader = PURPLE_THEME_LOADER(tmp->data); + if (purple_theme_loader_probe(loader, theme_dir)) { + PurpleTheme *theme = purple_theme_loader_build(loader, theme_dir); if (PURPLE_IS_THEME(theme)) purple_theme_manager_add_theme(theme); } } - g_dir_close(tdir); - g_free(purple_dir); + g_free(theme_dir); } g_dir_close(rdir); @@ -155,16 +146,17 @@ purple_theme_manager_init(void) void purple_theme_manager_refresh(void) { - gchar *path = NULL; - const gchar *xdg = NULL; - gint i = 0; + gchar *path; + const gchar *xdg; + gint i; + GSList *loaders = NULL; - g_hash_table_foreach_remove(theme_table, - (GHRFunc) purple_theme_manager_is_theme, NULL); + g_hash_table_foreach_remove(theme_table, (GHRFunc)check_if_theme_or_loader, + &loaders); /* Add themes from ~/.purple */ path = g_build_filename(purple_user_dir(), "themes", NULL); - purple_theme_manager_build_dir(path); + purple_theme_manager_build_dir(loaders, path); g_free(path); /* look for XDG_DATA_HOME. If we don't have it use ~/.local, and add it */ @@ -173,7 +165,7 @@ purple_theme_manager_refresh(void) else path = g_build_filename(purple_home_dir(), ".local", "themes", NULL); - purple_theme_manager_build_dir(path); + purple_theme_manager_build_dir(loaders, path); g_free(path); /* now dig through XDG_DATA_DIRS and add those too */ @@ -183,12 +175,14 @@ purple_theme_manager_refresh(void) for (i = 0; xdg_dirs[i]; i++) { path = g_build_filename(xdg_dirs[i], "themes", NULL); - purple_theme_manager_build_dir(path); + purple_theme_manager_build_dir(loaders, path); g_free(path); } g_strfreev(xdg_dirs); } + + g_slist_free(loaders); } void -- cgit v1.2.1 From a9e084a17dbd6800d54e57a0f67bcc06ae34b6d3 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 3 Mar 2012 08:19:33 +0000 Subject: Change theme loaders to use the correct subdirectory now that the theme manager only gives them the root directory. --- libpurple/sound-theme-loader.c | 12 ++++++++---- pidgin/gtkblist-theme-loader.c | 12 ++++++++---- pidgin/gtkicon-theme-loader.c | 11 +++++++---- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/libpurple/sound-theme-loader.c b/libpurple/sound-theme-loader.c index ea85881053..2f2203bffc 100644 --- a/libpurple/sound-theme-loader.c +++ b/libpurple/sound-theme-loader.c @@ -32,23 +32,26 @@ *****************************************************************************/ static PurpleTheme * -purple_sound_loader_build(const gchar *dir) +purple_sound_loader_build(const gchar *theme_dir) { xmlnode *root_node = NULL, *sub_node; - gchar *filename_full, *data = NULL; + gchar *dir, *filename_full, *data = NULL; PurpleSoundTheme *theme = NULL; const gchar *name; /* Find the theme file */ - g_return_val_if_fail(dir != NULL, NULL); + g_return_val_if_fail(theme_dir != NULL, NULL); + dir = g_build_filename(theme_dir, "purple", "sound", NULL); filename_full = g_build_filename(dir, "theme.xml", NULL); if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader"); g_free(filename_full); - if (root_node == NULL) + if (root_node == NULL) { + g_free(dir); return NULL; + } name = xmlnode_get_attrib(root_node, "name"); @@ -79,6 +82,7 @@ purple_sound_loader_build(const gchar *dir) xmlnode_free(root_node); g_free(data); + g_free(dir); return PURPLE_THEME(theme); } diff --git a/pidgin/gtkblist-theme-loader.c b/pidgin/gtkblist-theme-loader.c index b5936f3916..ad395e6229 100644 --- a/pidgin/gtkblist-theme-loader.c +++ b/pidgin/gtkblist-theme-loader.c @@ -73,10 +73,10 @@ parse_color(xmlnode *node, const char *tag) } static PurpleTheme * -pidgin_blist_loader_build(const gchar *dir) +pidgin_blist_loader_build(const gchar *theme_dir) { xmlnode *root_node = NULL, *sub_node, *sub_sub_node; - gchar *filename_full, *data = NULL; + gchar *dir, *filename_full, *data = NULL; const gchar *temp, *name; gboolean success = TRUE; GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color; @@ -112,15 +112,18 @@ pidgin_blist_loader_build(const gchar *dir) status = NULL; /* Find the theme file */ - g_return_val_if_fail(dir != NULL, NULL); + g_return_val_if_fail(theme_dir != NULL, NULL); + dir = g_build_filename(theme_dir, "purple", "blist", NULL); filename_full = g_build_filename(dir, "theme.xml", NULL); if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) root_node = xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader"); g_free(filename_full); - if (root_node == NULL) + if (root_node == NULL) { + g_free(dir); return NULL; + } sub_node = xmlnode_get_child(root_node, "description"); data = xmlnode_get_data(sub_node); @@ -227,6 +230,7 @@ pidgin_blist_loader_build(const gchar *dir) xmlnode_free(root_node); g_free(data); + g_free(dir); /* malformed xml file - also frees all partial data*/ if (!success) { diff --git a/pidgin/gtkicon-theme-loader.c b/pidgin/gtkicon-theme-loader.c index e5818da667..d488ade28b 100644 --- a/pidgin/gtkicon-theme-loader.c +++ b/pidgin/gtkicon-theme-loader.c @@ -31,23 +31,26 @@ *****************************************************************************/ static PurpleTheme * -pidgin_icon_loader_build(const gchar *dir) +pidgin_icon_loader_build(const gchar *theme_dir) { xmlnode *root_node = NULL, *sub_node; - gchar *filename_full, *data = NULL; + gchar *dir, *filename_full, *data = NULL; PidginIconTheme *theme = NULL; const gchar *name; /* Find the theme file */ - g_return_val_if_fail(dir != NULL, NULL); + g_return_val_if_fail(theme_dir != NULL, NULL); + dir = g_build_filename(theme_dir, "purple", "status-icon", NULL); filename_full = g_build_filename(dir, "theme.xml", NULL); if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) root_node = xmlnode_from_file(dir, "theme.xml", "icon themes", "icon-theme-loader"); g_free(filename_full); - if (root_node == NULL) + if (root_node == NULL) { + g_free(dir); return NULL; + } name = xmlnode_get_attrib(root_node, "name"); -- cgit v1.2.1 From a2eda4e3fd3611fb337cceafbece19e2693aac53 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 3 Mar 2012 08:39:34 +0000 Subject: Override the probe function in the conversation theme loader. --- pidgin/gtkconv-theme-loader.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pidgin/gtkconv-theme-loader.c b/pidgin/gtkconv-theme-loader.c index 9ca6cec937..c2f8c02204 100644 --- a/pidgin/gtkconv-theme-loader.c +++ b/pidgin/gtkconv-theme-loader.c @@ -99,6 +99,19 @@ read_info_plist(xmlnode *plist) return info; } +static gboolean +pidgin_conv_loader_probe(const gchar *dir) +{ + gboolean result; + gchar *plist_file; + + plist_file = g_build_filename(dir, "Contents", "Info.plist", NULL); + result = g_file_test(plist_file, G_FILE_TEST_IS_REGULAR); + g_free(plist_file); + + return result; +} + static PurpleTheme * pidgin_conv_loader_build(const gchar *dir) { @@ -252,6 +265,7 @@ pidgin_conv_theme_loader_class_init(PidginConvThemeLoaderClass *klass) PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); loader_klass->purple_theme_loader_build = pidgin_conv_loader_build; + loader_klass->probe_directory = pidgin_conv_loader_probe; } -- cgit v1.2.1 From f2566d24ed7b836d4b26390612161e20ec6fda93 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Mar 2012 00:48:20 +0000 Subject: Use proper newlines in /help output. --- pidgin/gtkconv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 4391514e3f..70432bc012 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -494,8 +494,8 @@ help_command_cb(PurpleConversation *conv, g_string_append(s, _("No such command (in this context).")); } } else { - s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" - "The following commands are available in this context:\n")); + s = g_string_new(_("Use \"/help <command>\" for help on a specific command.
    " + "The following commands are available in this context:
    ")); text = purple_cmd_list(conv); for (l = text; l; l = l->next) -- cgit v1.2.1 From c42a82abcaccffa16618e608fac4b09ecc5e0e20 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Mar 2012 01:32:16 +0000 Subject: Add a simple theme that replicates our current look. --- pidgin/gtkconv-theme.c | 2 +- pidgin/themes/Contents/Info.plist | 16 +++++++ pidgin/themes/Contents/Resources/Content.html | 6 +++ pidgin/themes/Contents/Resources/Status.html | 5 +++ pidgin/themes/Contents/Resources/main.css | 61 +++++++++++++++++++++++++++ pidgin/themes/Makefile.am | 16 ++++++- 6 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 pidgin/themes/Contents/Info.plist create mode 100644 pidgin/themes/Contents/Resources/Content.html create mode 100644 pidgin/themes/Contents/Resources/Status.html create mode 100644 pidgin/themes/Contents/Resources/main.css diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 7a7a3a8150..0c5d08fc94 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -123,7 +123,7 @@ get_template_path(const char *dir) if (!g_file_test(file, G_FILE_TEST_EXISTS)) { g_free(file); - file = g_build_filename(DATADIR, "pidgin", "theme", "conversation", "Template.html", NULL); + file = g_build_filename(DATADIR, "pidgin", "theme", "Template.html", NULL); } return file; diff --git a/pidgin/themes/Contents/Info.plist b/pidgin/themes/Contents/Info.plist new file mode 100644 index 0000000000..f2891d3d11 --- /dev/null +++ b/pidgin/themes/Contents/Info.plist @@ -0,0 +1,16 @@ + + + + + MessageViewVersion + 4 + CFBundleName + Default + CFBundleIdentifier + im.pidgin.Default.style + DefaultFontFamily + sans-serif + DefaultFontSize + 11 + + diff --git a/pidgin/themes/Contents/Resources/Content.html b/pidgin/themes/Contents/Resources/Content.html new file mode 100644 index 0000000000..37eddcd7e3 --- /dev/null +++ b/pidgin/themes/Contents/Resources/Content.html @@ -0,0 +1,6 @@ +
    + (%time%) +
    %sender%:
    +
    %message%
    +
    +
    diff --git a/pidgin/themes/Contents/Resources/Status.html b/pidgin/themes/Contents/Resources/Status.html new file mode 100644 index 0000000000..ea773d2b79 --- /dev/null +++ b/pidgin/themes/Contents/Resources/Status.html @@ -0,0 +1,5 @@ +
    + %time% +
    %message%
    +
    +
    diff --git a/pidgin/themes/Contents/Resources/main.css b/pidgin/themes/Contents/Resources/main.css new file mode 100644 index 0000000000..4dc00e3063 --- /dev/null +++ b/pidgin/themes/Contents/Resources/main.css @@ -0,0 +1,61 @@ +body { + word-wrap: break-word; + word-break: break-word; +} + +.x-container, +.x-status_container +{ + line-height: 1.3em; + margin-bottom: 6px; +} + +.x-container .x-time, +.x-status_container .x-time +{ + display: inline; +} + +.x-container .x-sender +{ + display: inline; + font-weight: bold; +} + +.x-container .x-message, +.x-status_container .x-message +{ + display: inline; +} + +/* Colour-ify things */ + +.x-container.incoming .x-time, +.x-container.incoming .x-sender +{ + color: #cc0000; +} + +.x-container.outgoing .x-time, +.x-container.outgoing .x-sender +{ + color: #204a87; +} + +.x-container.mention .x-time, +.x-container.mention .x-sender +{ + color: #AF7F00; +} + +.x-status_container +{ + color: #777777; +} + +.x-status_container.error +{ + color: #ff0000; + font-weight: bold; +} + diff --git a/pidgin/themes/Makefile.am b/pidgin/themes/Makefile.am index 5ad5c18b55..2e2c1b5ecc 100644 --- a/pidgin/themes/Makefile.am +++ b/pidgin/themes/Makefile.am @@ -1,6 +1,18 @@ -themetemplatedir = $(datadir)/pidgin/theme/conversation +themetemplatedir = $(datadir)/pidgin/theme themetemplate_DATA = Template.html +themecontentsdir = $(themetemplatedir)/Contents +themecontents_DATA = Contents/Info.plist +themeresourcesdir = $(themecontentsdir)/Resources +themeresources_DATA = Contents/Resources/Content.html \ + Contents/Resources/Status.html \ + Contents/Resources/main.css +themevariantsdir = $(themeresourcesdir)/Variants +themevariants_DATA = -EXTRA_DIST = $(themetemplate_DATA) +EXTRA_DIST = \ + $(themetemplate_DATA) \ + $(themecontents_DATA) \ + $(themeresources_DATA) \ + $(themevariants_DATA) -- cgit v1.2.1 From 837961b739c90c9269c9cf11938133c04b3733fe Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Mar 2012 01:34:03 +0000 Subject: Replace the "%status%" variable in themes, though this only supports errors right now. --- pidgin/gtkconv.c | 8 ++++++++ pidgin/themes/Contents/Resources/Status.html | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 70432bc012..bba3b6d249 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6250,6 +6250,14 @@ replace_message_tokens( } else if (g_str_has_prefix(cur, "%messageDirection%")) { replace = purple_markup_is_rtl(message) ? "rtl" : "ltr"; + } else if (g_str_has_prefix(cur, "%status%")) { + GString *classes = g_string_new(NULL); + + if (flags & PURPLE_MESSAGE_ERROR) + g_string_append(classes, "error "); + + replace = freeval = g_string_free(classes, FALSE); + } else { cur++; continue; diff --git a/pidgin/themes/Contents/Resources/Status.html b/pidgin/themes/Contents/Resources/Status.html index ea773d2b79..b8447eb765 100644 --- a/pidgin/themes/Contents/Resources/Status.html +++ b/pidgin/themes/Contents/Resources/Status.html @@ -1,4 +1,4 @@ -
    +
    %time%
    %message%
    -- cgit v1.2.1 From 1977d853ef2cd630811220d1ae620b6bf2a4dc20 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Mar 2012 02:16:12 +0000 Subject: Automatically load the Default conversation theme and use it if a theme can't be found. --- pidgin/gtkconv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index bba3b6d249..b9b6c68710 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -192,6 +192,8 @@ static GList *xa_list = NULL; static GList *offline_list = NULL; static GHashTable *prpl_lists = NULL; +static PurpleTheme *default_conv_theme = NULL; + static gboolean update_send_to_selection(PidginWindow *win); static void generate_send_to_items(PidginWindow *win); @@ -5740,7 +5742,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) gtkconv->unseen_count = 0; theme = purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme"), "conversation"); if (!theme) - theme = purple_theme_manager_find_theme("Default", "conversation"); + theme = default_conv_theme; gtkconv->theme = PIDGIN_CONV_THEME(g_object_ref(theme)); gtkconv->last_flags = 0; @@ -8434,6 +8436,7 @@ pidgin_conversations_init(void) { void *handle = pidgin_conversations_get_handle(); void *blist_handle = purple_blist_get_handle(); + char *theme_dir; /* Conversations */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations"); @@ -8723,6 +8726,9 @@ pidgin_conversations_init(void) PURPLE_CALLBACK(wrote_msg_update_unseen_cb), NULL); purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_CONV_THEME_LOADER, "type", "conversation", NULL)); + theme_dir = g_build_filename(DATADIR, "pidgin", "theme", NULL); + default_conv_theme = purple_theme_manager_load_theme(theme_dir, "conversation"); + g_free(theme_dir); { /* Set default tab colors */ -- cgit v1.2.1 From 273f9acf03f5bfe7b1e1a0391a816b50a43cee44 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Mar 2012 03:32:07 +0000 Subject: Correctly save the conversation theme pref when re-choosing the Default. --- pidgin/gtkprefs.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index b905ffb1ce..461bf139e5 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -1101,42 +1101,41 @@ prefs_set_blist_theme_cb(GtkComboBox *combo_box, gpointer user_data) static void prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) { - PidginConvTheme *theme = NULL; GtkTreeIter iter; - gchar *name = NULL; if (gtk_combo_box_get_active_iter(combo_box, &iter)) { - const GList *variants; - const char *current_variant; - gboolean unset = TRUE; + gchar *name = NULL; gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); - if (!name || !*name) { - g_free(name); - return; - } purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/theme", name); /* Update list of variants */ gtk_list_store_clear(prefs_conv_variants); - theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); - current_variant = pidgin_conversation_theme_get_variant(theme); - - variants = pidgin_conversation_theme_get_variants(theme); - for (; variants && current_variant; variants = g_list_next(variants)) { - gtk_list_store_append(prefs_conv_variants, &iter); - gtk_list_store_set(prefs_conv_variants, &iter, 0, variants->data, -1); - - if (g_str_equal(variants->data, current_variant)) { - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(prefs_conv_variants_combo_box), &iter); - unset = FALSE; + if (name && *name) { + PidginConvTheme *theme; + const char *current_variant; + const GList *variants; + gboolean unset = TRUE; + + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + current_variant = pidgin_conversation_theme_get_variant(theme); + + variants = pidgin_conversation_theme_get_variants(theme); + for (; variants && current_variant; variants = g_list_next(variants)) { + gtk_list_store_append(prefs_conv_variants, &iter); + gtk_list_store_set(prefs_conv_variants, &iter, 0, variants->data, -1); + + if (g_str_equal(variants->data, current_variant)) { + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(prefs_conv_variants_combo_box), &iter); + unset = FALSE; + } } - } - if (unset) - gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0); + if (unset) + gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0); + } g_free(name); } -- cgit v1.2.1 From ad9be0e1b318f37bbaced8c9d47d9877f87ee08b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Mar 2012 03:49:49 +0000 Subject: Fix some boring asserts when using the Default conversation theme. --- pidgin/gtkconv.c | 7 +++++-- pidgin/gtkprefs.c | 47 ++++++++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index b9b6c68710..00914aa7d9 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5714,7 +5714,8 @@ static void private_gtkconv_new(PurpleConversation *conv, gboolean hidden) { PidginConversation *gtkconv; - PurpleTheme *theme; + const char *theme_name; + PurpleTheme *theme = NULL; PurpleConversationType conv_type = purple_conversation_get_type(conv); GtkWidget *pane = NULL; GtkWidget *tab_cont; @@ -5740,7 +5741,9 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) #endif gtkconv->unseen_state = PIDGIN_UNSEEN_NONE; gtkconv->unseen_count = 0; - theme = purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme"), "conversation"); + theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/theme"); + if (theme_name && *theme_name) + theme = purple_theme_manager_find_theme(theme_name, "conversation"); if (!theme) theme = default_conv_theme; gtkconv->theme = PIDGIN_CONV_THEME(g_object_ref(theme)); diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 461bf139e5..078c226267 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -1097,6 +1097,27 @@ prefs_set_blist_theme_cb(GtkComboBox *combo_box, gpointer user_data) } } +/* sets the current conversation theme variant */ +static void +prefs_set_conv_variant_cb(GtkComboBox *combo_box, gpointer user_data) +{ + PidginConvTheme *theme = NULL; + GtkTreeIter iter; + gchar *name = NULL; + + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(prefs_conv_themes_combo_box), &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + g_free(name); + + if (gtk_combo_box_get_active_iter(combo_box, &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_variants), &iter, 0, &name, -1); + pidgin_conversation_theme_set_variant(theme, name); + g_free(name); + } + } +} + /* sets the current conversation theme */ static void prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) @@ -1110,6 +1131,9 @@ prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/theme", name); + g_signal_handlers_block_by_func(prefs_conv_variants_combo_box, + prefs_set_conv_variant_cb, NULL); + /* Update list of variants */ gtk_list_store_clear(prefs_conv_variants); @@ -1137,31 +1161,12 @@ prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0); } + g_signal_handlers_unblock_by_func(prefs_conv_variants_combo_box, + prefs_set_conv_variant_cb, NULL); g_free(name); } } -/* sets the current conversation theme variant */ -static void -prefs_set_conv_variant_cb(GtkComboBox *combo_box, gpointer user_data) -{ - PidginConvTheme *theme = NULL; - GtkTreeIter iter; - gchar *name = NULL; - - if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(prefs_conv_themes_combo_box), &iter)) { - gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); - theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); - g_free(name); - - if (gtk_combo_box_get_active_iter(combo_box, &iter)) { - gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_variants), &iter, 0, &name, -1); - pidgin_conversation_theme_set_variant(theme, name); - g_free(name); - } - } -} - /* sets the current icon theme */ static void prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data) -- cgit v1.2.1 From 34b7219855f0e9676ccfb27e4737a534ad4032f7 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 12 Mar 2012 08:47:36 +0000 Subject: Slovenian translation updated (Martin Srebotnjak) --- po/ChangeLog | 3 + po/sl.po | 3482 ++++++++++++++-------------------------------------------- 2 files changed, 856 insertions(+), 2629 deletions(-) diff --git a/po/ChangeLog b/po/ChangeLog index 33c361efb5..fc3c45526e 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,5 +1,8 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul +version 3.0.0 + * Slovenian translation updated (Martin Srebotnjak) + version 2.10.1 * No changes diff --git a/po/sl.po b/po/sl.po index 6e8ad8fdfe..0693387e78 100644 --- a/po/sl.po +++ b/po/sl.po @@ -8,19 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Pidgin 2.7.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-18 00:02-0700\n" -"PO-Revision-Date: 2011-02-20 13:27+0100\n" -"Last-Translator: Martin Srebotnjak \n" +"POT-Creation-Date: 2012-02-17 09:57-0500\n" +"PO-Revision-Date: 2012-02-17 23:15+0100\n" +"Last-Translator: filmsi\n" "Language-Team: Martin Srebotnjak \n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n" -"%100==4 ? 3 : 0);\n" +"Language: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0);\n" "X-Poedit-Language: Slovenian\n" "X-Poedit-Country: SLOVENIA\n" -"X-Poedit-SourceCharset: iso-8859-1\n" +"X-Poedit-SourceCharset: utf-8\n" #. Translators may want to transliterate the name. #. It is not to be translated. @@ -51,16 +50,6 @@ msgstr "" " -n, --nologin brez samodejne prijave\n" " -v, --version izpiši trenutno različico in končaj program\n" -#, c-format -msgid "" -"%s encountered errors migrating your settings from %s to %s. Please " -"investigate and complete the migration by hand. Please report this error at " -"http://developer.pidgin.im" -msgstr "" -"%s je naletel na napake pri migraciji vaših nastavitev iz %s v %s. Prosimo, " -"raziščite in dokončajte migracijo ročno (s kopiranjem ustreznih datotek). " -"Prosimo, da to napako javite na naslov http://developer.pidgin.im." - #. the user did not fill in the captcha msgid "Error" msgstr "Napaka" @@ -74,16 +63,11 @@ msgstr "Račun ni bil dodan" msgid "Username of an account must be non-empty." msgstr "Uporabniško ime računa ne sme biti prazno." -msgid "" -"The account's protocol cannot be changed while it is connected to the server." -msgstr "" -"Protokola računa ni mogoče spremeniti, medtem ko je povezan s strežnikom." +msgid "The account's protocol cannot be changed while it is connected to the server." +msgstr "Protokola računa ni mogoče spremeniti, medtem ko je povezan s strežnikom." -msgid "" -"The account's username cannot be changed while it is connected to the server." -msgstr "" -"Uporabniškega imena računa ni mogoče spremeniti, medtem ko je povezan s " -"strežnikom." +msgid "The account's username cannot be changed while it is connected to the server." +msgstr "Uporabniškega imena računa ni mogoče spremeniti, medtem ko je povezan s strežnikom." msgid "New mail notifications" msgstr "Obveščanje o prispeli pošti" @@ -212,15 +196,16 @@ msgstr "Izbrani račun ni povezan." msgid "Error adding buddy" msgstr "Napaka pri dodajanju prijatelja" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Username" msgstr "Uporabniško ime" msgid "Alias (optional)" msgstr "Psevdonim (neobvezno)" -#, fuzzy msgid "Invite message (optional)" -msgstr "Sporočilo (neobvezno)" +msgstr "Sporočilo vabila (neobvezno)" msgid "Add in group" msgstr "Dodaj v skupino" @@ -315,12 +300,10 @@ msgid "Enter empty string to reset the name." msgstr "Vnesite prazen niz, da ponastavite ime." msgid "Removing this contact will also remove all the buddies in the contact" -msgstr "" -"Z odstranitvijo tega stika boste odstranili tudi vse prijatelje iz stika" +msgstr "Z odstranitvijo tega stika boste odstranili tudi vse prijatelje iz stika" msgid "Removing this group will also remove all the buddies in the group" -msgstr "" -"Z odstranitvijo te skupine boste odstranili tudi vse prijatelje iz skupine" +msgstr "Z odstranitvijo te skupine boste odstranili tudi vse prijatelje iz skupine" #, c-format msgid "Are you sure you want to remove %s?" @@ -346,7 +329,11 @@ msgstr "Pokaži/skrij oznako" msgid "View Log" msgstr "Pokaži dnevnik" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. General +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Nickname" msgstr "Vzdevek" @@ -376,12 +363,8 @@ msgstr "Zavrni" msgid "Unblock" msgstr "Prekliči zavrnitev" -msgid "" -"Please enter the username or alias of the person you would like to Block/" -"Unblock." -msgstr "" -"Vnesite uporabniško ime ali psevdonim osebe, ki jo želite zavrniti/" -"preklicati njeno zavrnitev." +msgid "Please enter the username or alias of the person you would like to Block/Unblock." +msgstr "Vnesite uporabniško ime ali psevdonim osebe, ki jo želite zavrniti/preklicati njeno zavrnitev." #. Not multiline #. Not masked? @@ -393,9 +376,7 @@ msgid "New Instant Message" msgstr "Novo neposredno sporočilo" msgid "Please enter the username or alias of the person you would like to IM." -msgstr "" -"Vnesite uporabniško ime ali psevdonim osebe, ki ji želite poslati neposredno " -"sporočilo." +msgstr "Vnesite uporabniško ime ali psevdonim osebe, ki ji želite poslati neposredno sporočilo." msgid "Channel" msgstr "Kanal" @@ -409,12 +390,8 @@ msgstr "Vnesite ime klepeta, ki se mu želite pridružiti." msgid "Join" msgstr "Pridruži se" -msgid "" -"Please enter the username or alias of the person whose log you would like to " -"view." -msgstr "" -"Vnesite uporabniško ime ali psevdonim osebe, o kateri želite pridobiti " -"dnevnik." +msgid "Please enter the username or alias of the person whose log you would like to view." +msgstr "Vnesite uporabniško ime ali psevdonim osebe, o kateri želite pridobiti dnevnik." #. Create the "Options" frame. msgid "Options" @@ -559,13 +536,11 @@ msgstr "%s se je odjavil." msgid "" "%s\n" "\n" -"Finch will not attempt to reconnect the account until you correct the error " -"and re-enable the account." +"Finch will not attempt to reconnect the account until you correct the error and re-enable the account." msgstr "" "%s\n" "\n" -"Finch se ne bo poskušal ponovno prijaviti, dokler ne odpravite napake in " -"ponovno omogočite povezovanje računa." +"Finch se ne bo poskušal ponovno prijaviti, dokler ne odpravite napake in ponovno omogočite povezovanje računa." msgid "Re-enable Account" msgstr "Ponovno omogoči račun" @@ -574,8 +549,7 @@ msgid "No such command." msgstr "Ta ukaz ne obstaja." msgid "Syntax Error: You typed the wrong number of arguments to that command." -msgstr "" -"Skladenjska napaka: vtipkali ste napačno število argumentov za ta ukaz." +msgstr "Skladenjska napaka: vtipkali ste napačno število argumentov za ta ukaz." msgid "Your command failed for an unknown reason." msgstr "Vaš ukaz iz neznanega razloga ni uspel." @@ -611,23 +585,14 @@ msgstr "" msgid "You have left this chat." msgstr "Ta klepet ste zapustili." -msgid "" -"The account has disconnected and you are no longer in this chat. You will be " -"automatically rejoined in the chat when the account reconnects." -msgstr "" -"Ta račun je bil prekinjen in nič več niste v tem klepetu. Samodejno boste " -"pridruženi klepetu, ko se račun ponovno poveže." +msgid "The account has disconnected and you are no longer in this chat. You will be automatically rejoined in the chat when the account reconnects." +msgstr "Ta račun je bil prekinjen in nič več niste v tem klepetu. Samodejno boste pridruženi klepetu, ko se račun ponovno poveže." msgid "Logging started. Future messages in this conversation will be logged." -msgstr "" -"Začelo se je beleženje v dnevnik. Vsa nadaljna sporočila pogovora bodo " -"zabeležena." +msgstr "Začelo se je beleženje v dnevnik. Vsa nadaljna sporočila pogovora bodo zabeležena." -msgid "" -"Logging stopped. Future messages in this conversation will not be logged." -msgstr "" -"Beleženje v dnevnik ustavljeno. Nadaljna sporočila pogovora ne bodo " -"zabeležena." +msgid "Logging stopped. Future messages in this conversation will not be logged." +msgstr "Beleženje v dnevnik ustavljeno. Nadaljna sporočila pogovora ne bodo zabeležena." msgid "Send To" msgstr "Pošlji k" @@ -681,36 +646,21 @@ msgstr "" "V tem sklopu so na voljo naslednji ukazi:\n" #, c-format -msgid "" -"%s is not a valid message class. See '/help msgcolor' for valid message " -"classes." -msgstr "" -"%s ni veljaven razred sporočil. Oglejte si '/help msgcolor', kjer so " -"navedeni veljavni razredi sporočil." +msgid "%s is not a valid message class. See '/help msgcolor' for valid message classes." +msgstr "%s ni veljaven razred sporočil. Oglejte si '/help msgcolor', kjer so navedeni veljavni razredi sporočil." #, c-format msgid "%s is not a valid color. See '/help msgcolor' for valid colors." -msgstr "" -"%s ni veljavna barva. Oglejte si '/help msgcolor', kjer so opisane veljavne " -"barve." +msgstr "%s ni veljavna barva. Oglejte si '/help msgcolor', kjer so opisane veljavne barve." -msgid "" -"say <message>: Send a message normally as if you weren't using a " -"command." -msgstr "" -"say <sporočilo>: Pošlji sporočilo kot ponavadi, kot če ne bi " -"uporabljal ukaza." +msgid "say <message>: Send a message normally as if you weren't using a command." +msgstr "say <sporočilo>: Pošlji sporočilo kot ponavadi, kot če ne bi uporabljal ukaza." msgid "me <action>: Send an IRC style action to a buddy or chat." -msgstr "" -"me <dejanje>: Pošlji prijatelju ali klepetu dejanje v slogu IRC-a." +msgstr "me <dejanje>: Pošlji prijatelju ali klepetu dejanje v slogu IRC-a." -msgid "" -"debug <option>: Send various debug information to the current " -"conversation." -msgstr "" -"debug <možnost>: Trenutnim pomenkom pošlji različne informacije o " -"razhroščevanju." +msgid "debug <option>: Send various debug information to the current conversation." +msgstr "debug <možnost>: Trenutnim pomenkom pošlji različne informacije o razhroščevanju." msgid "clear: Clears the conversation scrollback." msgstr "clear: Počisti izpisane replike pomenka." @@ -739,18 +689,8 @@ msgstr "prefs: Pokaži okno nastavitev." msgid "statuses: Show the savedstatuses window." msgstr "statuses: Pokaži okno savedstatuses." -msgid "" -"msgcolor <class> <foreground> <background>: Set the color " -"for different classes of messages in the conversation window.
    <" -"class>: receive, send, highlight, action, timestamp
    <foreground/" -"background>: black, red, green, blue, white, gray, darkgray, magenta, " -"cyan, default

    EXAMPLE:
    msgcolor send cyan default" -msgstr "" -"msgcolor <razred> <ospredje> <ozadje>: Nastavite barvo " -"različnim razredom sporočil v oknu pogovora.
    <razred>: receive, " -"send, highlight, action, timestamp
    <ospredje/ozadje>: black, " -"red, green, blue, white, gray, darkgray, magenta, cyan, " -"default

    PRIMER:
    msgcolor send cyan default" +msgid "msgcolor <class> <foreground> <background>: Set the color for different classes of messages in the conversation window.
    <class>: receive, send, highlight, action, timestamp
    <foreground/background>: black, red, green, blue, white, gray, darkgray, magenta, cyan, default

    EXAMPLE:
    msgcolor send cyan default" +msgstr "msgcolor <razred> <ospredje> <ozadje>: Nastavite barvo različnim razredom sporočil v oknu pogovora.
    <razred>: receive, send, highlight, action, timestamp
    <ospredje/ozadje>: black, red, green, blue, white, gray, darkgray, magenta, cyan, default

    PRIMER:
    msgcolor send cyan default" msgid "Unable to open file." msgstr "Datoteke ni bilo mogoče odprti." @@ -799,7 +739,11 @@ msgid "Remaining" msgstr "Preostanek" #. XXX: Use of ggp_str_to_uin() is an ugly hack! +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext #. presence +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status" msgstr "Stanje" @@ -855,25 +799,14 @@ msgstr "Pomenek z %s o %s" msgid "%B %Y" msgstr "%B %Y" -msgid "" -"System events will only be logged if the \"Log all status changes to system " -"log\" preference is enabled." -msgstr "" -"Sistemski dogodki bodo shranjeni, le če bo nastavljena možnost \"Omogoči " -"sistemski dnevnik\"." +msgid "System events will only be logged if the \"Log all status changes to system log\" preference is enabled." +msgstr "Sistemski dogodki bodo shranjeni, le če bo nastavljena možnost \"Omogoči sistemski dnevnik\"." -msgid "" -"Instant messages will only be logged if the \"Log all instant messages\" " -"preference is enabled." -msgstr "" -"Neposredna sporočila se bodo shranila, le če bo okljukana možnost \"Shranjuj " -"vsa neposredna sporočila\"." +msgid "Instant messages will only be logged if the \"Log all instant messages\" preference is enabled." +msgstr "Neposredna sporočila se bodo shranila, le če bo okljukana možnost \"Shranjuj vsa neposredna sporočila\"." -msgid "" -"Chats will only be logged if the \"Log all chats\" preference is enabled." -msgstr "" -"Pomenki bodo shranjeni v dnevnik, ko je okljukana možnost \"Shranjuj vse " -"pomenke\"." +msgid "Chats will only be logged if the \"Log all chats\" preference is enabled." +msgstr "Pomenki bodo shranjeni v dnevnik, ko je okljukana možnost \"Shranjuj vse pomenke\"." msgid "No logs were found" msgstr "Ni najdenih dnevnikov." @@ -1017,11 +950,8 @@ msgstr "Napaka pri nalaganju vtičnika" msgid "The selected file is not a valid plugin." msgstr "Izbrana datoteka ni veljaven vtičnik." -msgid "" -"Please open the debug window and try again to see the exact error message." -msgstr "" -"Prosim, odprite okno razhroščevanja in poskusite znova, da vidite dejansko " -"sporočilo o napaki." +msgid "Please open the debug window and try again to see the exact error message." +msgstr "Prosim, odprite okno razhroščevanja in poskusite znova, da vidite dejansko sporočilo o napaki." msgid "Select plugin to install" msgstr "Izberite vtičnik za namestitev" @@ -1388,6 +1318,8 @@ msgstr "Naziv" msgid "Type" msgstr "Vrsta" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. Statuses are almost all the same. Define a macro to reduce code repetition. #. PurpleStatusPrimitive #. id - use default @@ -1396,6 +1328,8 @@ msgstr "Vrsta" #. user_settable #. not independent #. Attributes - each status can have a message. +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Message" msgstr "Sporočilo" @@ -1461,12 +1395,8 @@ msgstr "GntOdložišče" msgid "Clipboard plugin" msgstr "Vtičnik za odložišče" -msgid "" -"When the gnt clipboard contents change, the contents are made available to " -"X, if possible." -msgstr "" -"Ko se spremeni vsebina odložišča gnt, je vsebina na voljo X-u, če je to le " -"mogoče." +msgid "When the gnt clipboard contents change, the contents are made available to X, if possible." +msgstr "Ko se spremeni vsebina odložišča gnt, je vsebina na voljo X-u, če je to le mogoče." #, c-format msgid "%s just signed on" @@ -1525,14 +1455,11 @@ msgstr "Vtičnik za zgodovino zahteva beleženje v dnevnik" msgid "" "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)." +"Enabling logs for instant messages and/or chats will activate history for the same conversation type(s)." msgstr "" -"Beleženje v dnevnik lahko omogočite v Orodja -> Nastavitve -> Beleženje v " -"dnevnik.\n" +"Beleženje v dnevnik lahko omogočite v Orodja -> Nastavitve -> Beleženje v dnevnik.\n" "\n" -"Omogočanje beleženja v dnevnik za neposredna sporočila in/ali klepete " -"aktivira zgodovino za istovrstne pogovore." +"Omogočanje beleženja v dnevnik za neposredna sporočila in/ali klepete aktivira zgodovino za istovrstne pogovore." msgid "GntHistory" msgstr "GntHistory" @@ -1540,11 +1467,8 @@ msgstr "GntHistory" msgid "Shows recently logged conversations in new conversations." msgstr "Prikaže nedavno zabeležene pogovore v novih pogovorih." -msgid "" -"When a new conversation is opened this plugin will insert the last " -"conversation into the current conversation." -msgstr "" -"Ko je odprt nov pogovor, ta vtičnik vstavi zadnji pogovor v trenuten pogovor." +msgid "When a new conversation is opened this plugin will insert the last conversation into the current conversation." +msgstr "Ko je odprt nov pogovor, ta vtičnik vstavi zadnji pogovor v trenuten pogovor." #, c-format msgid "" @@ -1689,41 +1613,23 @@ msgid "buddy list" msgstr "Seznam prijateljev" msgid "The certificate is self-signed and cannot be automatically checked." -msgstr "" -"Predstavljeno digitalno potrdilo je samo-podpisano in ga samodejno ni mogoče " -"preveriti." +msgstr "Predstavljeno digitalno potrdilo je samo-podpisano in ga samodejno ni mogoče preveriti." -msgid "" -"The certificate is not trusted because no certificate that can verify it is " -"currently trusted." -msgstr "" -"Njihovo potrdilo ni zaupanja vredno, ker ni nobeno potrdilo, ki ga potrjuje, " -"zaupanja vredno." +msgid "The certificate is not trusted because no certificate that can verify it is currently trusted." +msgstr "Njihovo potrdilo ni zaupanja vredno, ker ni nobeno potrdilo, ki ga potrjuje, zaupanja vredno." -msgid "" -"The certificate is not valid yet. Check that your computer's date and time " -"are accurate." -msgstr "" -"Potrdilo še ni veljavno. Preverite, da sta datum in čas vašega sistema " -"pravilno nastavljena." +msgid "The certificate is not valid yet. Check that your computer's date and time are accurate." +msgstr "Potrdilo še ni veljavno. Preverite, da sta datum in čas vašega sistema pravilno nastavljena." -msgid "" -"The certificate has expired and should not be considered valid. Check that " -"your computer's date and time are accurate." -msgstr "" -"Potrdilo je poteklo in ne sme biti upoštevano kot veljavno. Preverite, da " -"sta datum in čas vašega sistema pravilno nastavljena." +msgid "The certificate has expired and should not be considered valid. Check that your computer's date and time are accurate." +msgstr "Potrdilo je poteklo in ne sme biti upoštevano kot veljavno. Preverite, da sta datum in čas vašega sistema pravilno nastavljena." #. Translators: "domain" refers to a DNS domain (e.g. talk.google.com) msgid "The certificate presented is not issued to this domain." msgstr "Ponujeno digitalno potrdilo ni izdano za to domeno." -msgid "" -"You have no database of root certificates, so this certificate cannot be " -"validated." -msgstr "" -"Nimate zbirke podatkov korenskih digitalnih potrdil, zato tega digitalnega " -"potrdila ni mogoče preveriti." +msgid "You have no database of root certificates, so this certificate cannot be validated." +msgstr "Nimate zbirke podatkov korenskih digitalnih potrdil, zato tega digitalnega potrdila ni mogoče preveriti." msgid "The certificate chain presented is invalid." msgstr "Ponujena veriga digitalnih potrdil ni veljavna." @@ -1789,12 +1695,8 @@ msgid "Unable to validate certificate" msgstr "Ni možno overiti digitalnega potrdila" #, c-format -msgid "" -"The certificate claims to be from \"%s\" instead. This could mean that you " -"are not connecting to the service you believe you are." -msgstr "" -"Predstavljeno digitalno potrdilo priča, da dejansko pripada \"%s\". To " -"pomeni, da se ne povezujete s storitvijo, s katero mislite, da se." +msgid "The certificate claims to be from \"%s\" instead. This could mean that you are not connecting to the service you believe you are." +msgstr "Predstavljeno digitalno potrdilo priča, da dejansko pripada \"%s\". To pomeni, da se ne povezujete s storitvijo, s katero mislite, da se." #. Make messages #, c-format @@ -1884,12 +1786,8 @@ msgid "Invite to chat" msgstr "Povabi na klepet" #. Put our happy label in it. -msgid "" -"Please enter the name of the user you wish to invite, along with an optional " -"invite message." -msgstr "" -"Prosim vnesite ime uporabnika, ki ga želite povabiti, dodate pa lahko še " -"povabilo." +msgid "Please enter the name of the user you wish to invite, along with an optional invite message." +msgstr "Prosim vnesite ime uporabnika, ki ga želite povabiti, dodate pa lahko še povabilo." #, c-format msgid "Failed to get connection: %s" @@ -1950,8 +1848,9 @@ msgstr "Napaka pri ustvarjanju niti: %s" msgid "Unknown reason" msgstr "Neznan razlog" +#, fuzzy msgid "Aborting DNS lookup in Tor Proxy mode." -msgstr "" +msgstr "Opuščanje iskanja DNS v načinu posrednega strežnika Tor." #, c-format msgid "" @@ -2116,67 +2015,32 @@ msgstr "Upravljač za URL-je \"xmpp" msgid "The handler for \"ymsgr\" URLs" msgstr "Upravljač za URL-je \"ymsgr" -msgid "" -"True if the command specified in the \"command\" key should handle \"aim\" " -"URLs." -msgstr "" -"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" -"ji \"aim\"" +msgid "True if the command specified in the \"command\" key should handle \"aim\" URLs." +msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"aim\"" -msgid "" -"True if the command specified in the \"command\" key should handle \"gg\" " -"URLs." -msgstr "" -"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" -"ji \"gg\"" +msgid "True if the command specified in the \"command\" key should handle \"gg\" URLs." +msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"gg\"" -msgid "" -"True if the command specified in the \"command\" key should handle \"icq\" " -"URLs." -msgstr "" -"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" -"ji \"icq\"" +msgid "True if the command specified in the \"command\" key should handle \"icq\" URLs." +msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"icq\"" -msgid "" -"True if the command specified in the \"command\" key should handle \"irc\" " -"URLs." -msgstr "" -"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" -"ji \"irc\"" +msgid "True if the command specified in the \"command\" key should handle \"irc\" URLs." +msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"irc\"" -msgid "" -"True if the command specified in the \"command\" key should handle \"msnim\" " -"URLs." -msgstr "" -"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" -"ji \"msnim\"" +msgid "True if the command specified in the \"command\" key should handle \"msnim\" URLs." +msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"msnim\"" -msgid "" -"True if the command specified in the \"command\" key should handle \"sip\" " -"URLs." -msgstr "" -"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" -"ji \"sip\"" +msgid "True if the command specified in the \"command\" key should handle \"sip\" URLs." +msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"sip\"" -msgid "" -"True if the command specified in the \"command\" key should handle \"xmpp\" " -"URLs." -msgstr "" -"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" -"ji \"xmpp\"" +msgid "True if the command specified in the \"command\" key should handle \"xmpp\" URLs." +msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"xmpp\"" -msgid "" -"True if the command specified in the \"command\" key should handle \"ymsgr\" " -"URLs." -msgstr "" -"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" -"ji \"ymsgr\"" +msgid "True if the command specified in the \"command\" key should handle \"ymsgr\" URLs." +msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"ymsgr\"" -msgid "" -"True if the command used to handle this type of URL should be run in a " -"terminal." -msgstr "" -"Resnično, če naj bo ukaz, ki naj ravna s to vrsto URL-ja, zagnan v konzoli." +msgid "True if the command used to handle this type of URL should be run in a terminal." +msgstr "Resnično, če naj bo ukaz, ki naj ravna s to vrsto URL-ja, zagnan v konzoli." msgid "Whether the specified command should handle \"aim\" URLs" msgstr "Ali naj navedeni ukaz upravlja z URL-ji \"aim\"" @@ -2221,20 +2085,12 @@ msgid "XML" msgstr "XML" #, c-format -msgid "" -"(%s) %s <AUTO-" -"REPLY>: %s
    \n" -msgstr "" -"(%s) %s <SAMODEJNI " -"ODGOVOR>: %s
    \n" +msgid "(%s) %s <AUTO-REPLY>: %s
    \n" +msgstr "(%s) %s <SAMODEJNI ODGOVOR>: %s
    \n" #, c-format -msgid "" -"(%s) %s <AUTO-" -"REPLY>: %s
    \n" -msgstr "" -"(%s) %s <SAMODEJNI " -"ODGOVOR>: %s
    \n" +msgid "(%s) %s <AUTO-REPLY>: %s
    \n" +msgstr "(%s) %s <SAMODEJNI ODGOVOR>: %s
    \n" msgid "Unable to find log path!" msgstr "Ni mogoče najti poti do dnevnika!" @@ -2247,17 +2103,11 @@ msgstr "Ni mogoče brati datoteke: %s" msgid "(%s) %s : %s\n" msgstr "(%s) %s : %s\n" -msgid "" -"No codecs found. Install some GStreamer codecs found in GStreamer plugins " -"packages." -msgstr "" -"Ni najdenih kodekov. Namestite nekaj kodekov GStreamer iz paketov vtičnikov " -"GStreamer." +msgid "No codecs found. Install some GStreamer codecs found in GStreamer plugins packages." +msgstr "Ni najdenih kodekov. Namestite nekaj kodekov GStreamer iz paketov vtičnikov GStreamer." -msgid "" -"No codecs left. Your codec preferences in fs-codecs.conf are too strict." -msgstr "" -"Ni preostalih kodekov. Vaše nastavitve kodekov v fs-codecs.conf so prestroge." +msgid "No codecs left. Your codec preferences in fs-codecs.conf are too strict." +msgstr "Ni preostalih kodekov. Vaše nastavitve kodekov v fs-codecs.conf so prestroge." msgid "A non-recoverable Farsight2 error has occurred." msgstr "Prišlo je do napake Farsight2, od katere si ni mogoče opomoči." @@ -2290,19 +2140,12 @@ msgstr "Neustrezna %d vtičnika (potrebuje %d)" msgid "ABI version mismatch %d.%d.x (need %d.%d.x)" msgstr "Neustrezna različica ABI %d.%d.x (potrebna je %d.%d.x)" -msgid "" -"Plugin does not implement all required functions (list_icon, login and close)" -msgstr "" -"Vtičnik ne vsebuje implementacije vseh potrebnih funkcij (list_icon, login " -"in close)" +msgid "Plugin does not implement all required functions (list_icon, login and close)" +msgstr "Vtičnik ne vsebuje implementacije vseh potrebnih funkcij (list_icon, login in close)" #, c-format -msgid "" -"The required plugin %s was not found. Please install this plugin and try " -"again." -msgstr "" -"Zahtevani dodatek %s ni bil najden. Prosim, namestite vtičnik in poskusite " -"znova." +msgid "The required plugin %s was not found. Please install this plugin and try again." +msgstr "Zahtevani dodatek %s ni bil najden. Prosim, namestite vtičnik in poskusite znova." msgid "Unable to load the plugin" msgstr "Vtičnika ni mogoče naložiti" @@ -2326,8 +2169,7 @@ msgstr "Samodejno sprejmi zahtevo po prenosu datotek od izbranih uporabnikov." #, c-format msgid "Autoaccepted file transfer of \"%s\" from \"%s\" completed." -msgstr "" -"Samodejno sprejeta zahteva po prenosu datoteke \"%s\" od \"%s\" zaključena." +msgstr "Samodejno sprejeta zahteva po prenosu datoteke \"%s\" od \"%s\" zaključena." msgid "Autoaccept complete" msgstr "Samodejni sprejem dokončan" @@ -2376,8 +2218,7 @@ msgid "" "Notify with a popup when an autoaccepted file transfer is complete\n" "(only when there's no conversation with the sender)" msgstr "" -"Obvesti s pojavnim oknom, ko je zaključen samodejno sprejeti prenos " -"datoteke\n" +"Obvesti s pojavnim oknom, ko je zaključen samodejno sprejeti prenos datoteke\n" "(le če ni pomenka s pošiljateljem)" msgid "Create a new directory for each user" @@ -2413,8 +2254,7 @@ msgstr "Shrani opombe o določenih prijateljih." #. *< summary msgid "Adds the option to store notes for buddies on your buddy list." -msgstr "" -"Doda možnost za shranjevanje zapiskov o prijateljih na seznamu prijateljev." +msgstr "Doda možnost za shranjevanje zapiskov o prijateljih na seznamu prijateljev." #. *< type #. *< ui_requirement @@ -2522,12 +2362,8 @@ msgid "Test plugin IPC support, as a client." msgstr "Preskusite vtičnik s podporo IPC, kot odjemalec." #. * description -msgid "" -"Test plugin IPC support, as a client. This locates the server plugin and " -"calls the commands registered." -msgstr "" -"Preskusite vtičnik s podporo IPC, kot odjemalec. Poišče strežniški vtičnik " -"in kliče registrirane ukaze." +msgid "Test plugin IPC support, as a client. This locates the server plugin and calls the commands registered." +msgstr "Preskusite vtičnik s podporo IPC, kot odjemalec. Poišče strežniški vtičnik in kliče registrirane ukaze." # *< api_version # *< type @@ -2556,8 +2392,7 @@ msgstr "Preskusite vtičnik s podporo IPC, kot strežnik." #. * description msgid "Test plugin IPC support, as a server. This registers the IPC commands." -msgstr "" -"Preskusite vtičnik s podporo IPC, kot strežnik. Ukazi IPC bodo registrirani." +msgstr "Preskusite vtičnik s podporo IPC, kot strežnik. Ukazi IPC bodo registrirani." msgid "Hide Joins/Parts" msgstr "Skrij spoje/dele" @@ -2588,12 +2423,8 @@ msgid "Hides extraneous join/part messages." msgstr "Skrije odvečna sporočila o pridružitvi ali odhodu." #. * description -msgid "" -"This plugin hides join/part messages in large rooms, except for those users " -"actively taking part in a conversation." -msgstr "" -"Ta vtičnik skrije sporočila o pridruževanju in odhajanju v velikih sobah, " -"razen za tiste uporabnike, ki aktivno sodelujejo v klepetu." +msgid "This plugin hides join/part messages in large rooms, except for those users actively taking part in a conversation." +msgstr "Ta vtičnik skrije sporočila o pridruževanju in odhajanju v velikih sobah, razen za tiste uporabnike, ki aktivno sodelujejo v klepetu." #. This is used in the place of a timezone abbreviation if the #. * offset is way off. The user should never really see it, but @@ -2618,12 +2449,8 @@ msgstr "Eno ali več sporočil ni mogoče dostaviti." msgid "You were disconnected from the server." msgstr "Povezava s strežnikom je bila prekinjena." -msgid "" -"You are currently disconnected. Messages will not be received unless you are " -"logged in." -msgstr "" -"Trenutno niste povezani. Sporočil ne boste mogli prejemati, dokler se ne " -"povežete." +msgid "You are currently disconnected. Messages will not be received unless you are logged in." +msgstr "Trenutno niste povezani. Sporočil ne boste mogli prejemati, dokler se ne povežete." msgid "Message could not be sent because the maximum length was exceeded." msgstr "Sporočila ni mogoče poslati, saj je presežena največja dolžina." @@ -2700,24 +2527,17 @@ msgstr "Ogledovalnik dnevnika" #. *< version #. * summary msgid "Includes other IM clients' logs in the log viewer." -msgstr "" -"Vključi dnevnike drugih odjemalcev neposrednih sporočil v ogledovalnik " -"dnevnika." +msgstr "Vključi dnevnike drugih odjemalcev neposrednih sporočil v ogledovalnik dnevnika." #. * description msgid "" -"When viewing logs, this plugin will include logs from other IM clients. " -"Currently, this includes Adium, MSN Messenger, aMSN, and Trillian.\n" +"When viewing logs, this plugin will include logs from other IM clients. Currently, this includes Adium, MSN Messenger, aMSN, and Trillian.\n" "\n" -"WARNING: This plugin is still alpha code and may crash frequently. Use it " -"at your own risk!" +"WARNING: This plugin is still alpha code and may crash frequently. Use it at your own risk!" msgstr "" -"Pri ogledovanju dnevnikov bo ta vtičnik vključil dnevnike drugih odjemalcev " -"neposrednih sporočil. To trenutno obsega Adium, MSN Messenger, aMSN in " -"Trillian.\n" +"Pri ogledovanju dnevnikov bo ta vtičnik vključil dnevnike drugih odjemalcev neposrednih sporočil. To trenutno obsega Adium, MSN Messenger, aMSN in Trillian.\n" "\n" -"OPOZORILO: Ta vtičnik je še vedno v fazi alfa in se lahko pogosto sesuje. " -"Uporaba na lastno odgovornost!" +"OPOZORILO: Ta vtičnik je še vedno v fazi alfa in se lahko pogosto sesuje. Uporaba na lastno odgovornost!" msgid "Mono Plugin Loader" msgstr "Nalaganje vtičnikov Mono" @@ -2749,12 +2569,8 @@ msgid "Prepends a newline to displayed message." msgstr "Prikazanemu sporočilu na začetek pripne prazno vrstico." #. *< summary -msgid "" -"Prepends a newline to messages so that the rest of the message appears below " -"the username in the conversation window." -msgstr "" -"Sporočilom na začetek doda prazno vrstico, tako da se preostanek sporočila v " -"oknu pogovora izpiše pod uporabniškim imenom." +msgid "Prepends a newline to messages so that the rest of the message appears below the username in the conversation window." +msgstr "Sporočilom na začetek doda prazno vrstico, tako da se preostanek sporočila v oknu pogovora izpiše pod uporabniškim imenom." msgid "Offline Message Emulation" msgstr "Emulacija nepovezovalnega sporočila" @@ -2762,27 +2578,18 @@ msgstr "Emulacija nepovezovalnega sporočila" msgid "Save messages sent to an offline user as pounce." msgstr "Shrani sporočila, poslana neprijavljenemu uporabniku, kot opozorilo." -msgid "" -"The rest of the messages will be saved as pounces. You can edit/delete the " -"pounce from the `Buddy Pounce' dialog." -msgstr "" -"Preostanek sporočil bo shranjen kot opozorila. Opozorilo lahko uredite/" -"izbrišete s pogovornim oknom `Opozorilo prijatelja'." +msgid "The rest of the messages will be saved as pounces. You can edit/delete the pounce from the `Buddy Pounce' dialog." +msgstr "Preostanek sporočil bo shranjen kot opozorila. Opozorilo lahko uredite/izbrišete s pogovornim oknom `Opozorilo prijatelja'." #, c-format -msgid "" -"\"%s\" is currently offline. Do you want to save the rest of the messages in " -"a pounce and automatically send them when \"%s\" logs back in?" -msgstr "" -"\"%s\" trenutno ni povezan. Želite shraniti preostanek sporočil v opozorilo " -"in jih samodejno poslati, ko se \"%s\" znova prijavi?" +msgid "\"%s\" is currently offline. Do you want to save the rest of the messages in a pounce and automatically send them when \"%s\" logs back in?" +msgstr "\"%s\" trenutno ni povezan. Želite shraniti preostanek sporočil v opozorilo in jih samodejno poslati, ko se \"%s\" znova prijavi?" msgid "Offline Message" msgstr "Brezpovezavno sporočilo" msgid "You can edit/delete the pounce from the `Buddy Pounces' dialog" -msgstr "" -"Opozorilo lahko uredite/izbrišete v pogovornem oknu `Opozorila prijateljev'" +msgstr "Opozorilo lahko uredite/izbrišete v pogovornem oknu `Opozorila prijateljev'" msgid "Yes" msgstr "Da" @@ -2816,12 +2623,10 @@ msgstr "Vsilite, da se gesla uporabijo le enkrat." #. * description msgid "" -"Allows you to enforce on a per-account basis that passwords not being saved " -"are only used in a single successful connection.\n" +"Allows you to enforce on a per-account basis that passwords not being saved are only used in a single successful connection.\n" "Note: The account password must not be saved for this to work." msgstr "" -"Omogoča, da vsilite (posebej za vsak račun), da so neshranjena gesla " -"uporabljena le za posamezno uspešno povezavo.\n" +"Omogoča, da vsilite (posebej za vsak račun), da so neshranjena gesla uporabljena le za posamezno uspešno povezavo.\n" "Opomba: Geslo računa ni potrebno shraniti, da bi to delovalo." #. *< type @@ -2845,12 +2650,8 @@ msgstr "Telepatski način" msgid "Psychic mode for incoming conversation" msgstr "Telepatski način za dohodne pogovore" -msgid "" -"Causes conversation windows to appear as other users begin to message you. " -"This works for AIM, ICQ, XMPP, Sametime, and Yahoo!" -msgstr "" -"Povzroči pojavitev pogovornih oken, ko vam začnejo drugi uporabniki " -"sporočati. To deluje za AIM, ICQ, XMPP, Sametime in Yahoo!" +msgid "Causes conversation windows to appear as other users begin to message you. This works for AIM, ICQ, XMPP, Sametime, and Yahoo!" +msgstr "Povzroči pojavitev pogovornih oken, ko vam začnejo drugi uporabniki sporočati. To deluje za AIM, ICQ, XMPP, Sametime in Yahoo!" msgid "You feel a disturbance in the force..." msgstr "Občutite motnjo v Sili (saj veste, Vojna zvezd) ..." @@ -2996,9 +2797,7 @@ msgstr "Obvestila o stanjih prijateljev" #. *< version #. * summary #. * description -msgid "" -"Notifies in a conversation window when a buddy goes or returns from away or " -"idle." +msgid "Notifies in a conversation window when a buddy goes or returns from away or idle." msgstr "V pogovornem oknu obvešča o spremembah stanja vaših prijateljev." msgid "Tcl Plugin Loader" @@ -3007,43 +2806,41 @@ msgstr "Nalaganje vtičnikov Tcl" msgid "Provides support for loading Tcl plugins" msgstr "Omogoča podporo nalaganja vtičnikov Tcl" -msgid "" -"Unable to detect ActiveTCL installation. If you wish to use TCL plugins, " -"install ActiveTCL from http://www.activestate.com\n" -msgstr "" -"Namestitve ActiveTCL ni mogoče najti. Če želite uporabljati vtičnike TCL, " -"namestite ActiveTCL z naslova http://www.activestate.com\n" +msgid "Unable to detect ActiveTCL installation. If you wish to use TCL plugins, install ActiveTCL from http://www.activestate.com\n" +msgstr "Namestitve ActiveTCL ni mogoče najti. Če želite uporabljati vtičnike TCL, namestite ActiveTCL z naslova http://www.activestate.com\n" -msgid "" -"Unable to find Apple's \"Bonjour for Windows\" toolkit, see http://d.pidgin." -"im/BonjourWindows for more information." -msgstr "" -"Paketa orodij podjetja Apple \"Bonjour for Windows\" ni mogoče najti, " -"oglejte si zapis na naslovu http://d.pidgin.im/BonjourWindows - kjer najdete " -"več podrobnosti." +msgid "Unable to find Apple's \"Bonjour for Windows\" toolkit, see http://d.pidgin.im/BonjourWindows for more information." +msgstr "Paketa orodij podjetja Apple \"Bonjour for Windows\" ni mogoče najti, oglejte si zapis na naslovu http://d.pidgin.im/BonjourWindows - kjer najdete več podrobnosti." msgid "Unable to listen for incoming IM connections" msgstr "Dohodnim povezavam IM ni mogoče prisluhniti" -msgid "" -"Unable to establish connection with the local mDNS server. Is it running?" -msgstr "" -"Povezave s krajevnim strežnikom mDNS ni mogoče vzpostaviti. Ali je strežnik " -"sploh zagnan?" +msgid "Unable to establish connection with the local mDNS server. Is it running?" +msgstr "Povezave s krajevnim strežnikom mDNS ni mogoče vzpostaviti. Ali je strežnik sploh zagnan?" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "First name" msgstr "Ime" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Last name" msgstr "Priimek" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. email msgid "Email" msgstr "E-pošta" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "AIM Account" msgstr "Račun AIM" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "XMPP Account" msgstr "Račun XMPP" @@ -3083,12 +2880,8 @@ msgstr "Napaka pri komunikaciji s krajevnim mDNSReponderjem." msgid "Invalid proxy settings" msgstr "Neveljavne nastavitve posredovalnega strežnika" -msgid "" -"Either the host name or port number specified for your given proxy type is " -"invalid." -msgstr "" -"Bodisi ime strežnika bodisi vrata, ki ste ju navedli za posredovalni " -"strežnik, so neveljavna." +msgid "Either the host name or port number specified for your given proxy type is invalid." +msgstr "Bodisi ime strežnika bodisi vrata, ki ste ju navedli za posredovalni strežnik, so neveljavna." msgid "Token Error" msgstr "Napaka žetona" @@ -3131,8 +2924,7 @@ msgid "Passwords do not match" msgstr "Gesli se ne ujemata" msgid "Unable to register new account. An unknown error occurred." -msgstr "" -"Novega računa ni bilo mogoče registrirati. Prišlo je do neznane napake." +msgstr "Novega računa ni bilo mogoče registrirati. Prišlo je do neznane napake." msgid "New Gadu-Gadu Account Registered" msgstr "Nov račun Gadu-Gadu je registriran" @@ -3158,6 +2950,8 @@ msgstr "Registrirajte nov račun za Gadu-Gadu" msgid "Please, fill in the following fields" msgstr "Prosimo, izpolnite naslednja polja" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "City" msgstr "Kraj" @@ -3165,6 +2959,8 @@ msgid "Year of birth" msgstr "Leto rojstva" #. gender +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Gender" msgstr "Spol" @@ -3187,20 +2983,26 @@ msgstr "Poišči prijatelje" msgid "Please, enter your search criteria below" msgstr "Spodaj vnesite svoje iskalne pogoje" -msgid "Fill in the fields." -msgstr "Izpolnite polja." +msgid "Change password for the Gadu-Gadu account" +msgstr "Spremeni geslo za račun Gadu-Gadu" -msgid "Your current password is different from the one that you specified." -msgstr "Vaše veljavno geslo se razlikuje od navedenega." +msgid "Password was changed successfully!" +msgstr "Geslo je bilo uspešno spremenjeno!" msgid "Unable to change password. Error occurred.\n" msgstr "Gesla ni bilo mogoče spremeniti. Prišlo je do napake.\n" -msgid "Change password for the Gadu-Gadu account" -msgstr "Spremeni geslo za račun Gadu-Gadu" +msgid "Fill in the fields." +msgstr "Izpolnite polja." -msgid "Password was changed successfully!" -msgstr "Geslo je bilo uspešno spremenjeno!" +msgid "New password should be at most 15 characters long." +msgstr "Novo geslo mora imeti najmanj 15 znakov." + +msgid "Your current password is different from the one that you specified." +msgstr "Vaše veljavno geslo se razlikuje od navedenega." + +msgid "Invalid email address" +msgstr "Neveljaven naslov e-pošte" msgid "Current password" msgstr "Trenutno geslo" @@ -3208,6 +3010,9 @@ msgstr "Trenutno geslo" msgid "Password (retype)" msgstr "Geslo (ponovno vtipkajte)" +msgid "Email Address" +msgstr "E-naslov" + msgid "Enter current token" msgstr "Vnesite trenutni žeton" @@ -3220,23 +3025,20 @@ msgstr "Vnesite svoje obstoječe in novo geslo za UIN:" msgid "Change Gadu-Gadu Password" msgstr "Spremeni geslo Gadu-Gadu" -#, fuzzy msgid "Show status to:" -msgstr "Spremeni stanje v" +msgstr "Stanje pokaži:" msgid "All people" -msgstr "" +msgstr "vsem" -#, fuzzy msgid "Only buddies" -msgstr "Povezani prijatelji" +msgstr "samo prijateljem" -#, fuzzy msgid "Change status broadcasting" -msgstr "Spremeni stanje v" +msgstr "Spremeni oddajanje stanja" msgid "Please, select who can see your status" -msgstr "" +msgstr "Izberite, kdo lahko vidi vaše stanje" #, c-format msgid "Select a chat for buddy: %s" @@ -3265,14 +3067,20 @@ msgstr "Ne moti" msgid "Away" msgstr "Odsoten" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "UIN" msgstr "UIN" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. first name #. optional information msgid "First Name" msgstr "Ime" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Birth Year" msgstr "Leto rojstva" @@ -3312,6 +3120,27 @@ msgstr "Seznam prijateljev je bil shranjen na strežniku." msgid "Connected" msgstr "Povezano" +msgid "Unable to resolve hostname" +msgstr "Imena strežnika ni mogoče razločiti" + +msgid "Incorrect password" +msgstr "Neveljavno geslo" + +msgid "SSL Connection Failed" +msgstr "Povezava SSL ni uspela" + +msgid "Your account has been disabled because too many incorrect passwords were entered" +msgstr "Vaš račun je bil onemogočen, ker ste vnesli preveč napačnih gesel" + +msgid "Service temporarily unavailable" +msgstr "Storitev trenutno ni na voljo" + +msgid "Error connecting to proxy server" +msgstr "Napaka pri povezovanju s posredovalnim strežnikom" + +msgid "Error connecting to master server" +msgstr "Napaka pri povezovanju z glavnim strežnikom" + msgid "Connection failed" msgstr "Povezava ni uspela" @@ -3321,6 +3150,12 @@ msgstr "Dodaj k pomenku" msgid "Chat _name:" msgstr "_Ime za klepet:" +msgid "The username specified is invalid." +msgstr "Navedeno uporabniško ime ni veljavno." + +msgid "SSL support unavailable" +msgstr "Podpora SSL ni na voljo" + #, c-format msgid "Unable to resolve hostname '%s': %s" msgstr "Imena strežnika '%s' ni mogoče razločiti: %s" @@ -3339,12 +3174,12 @@ msgstr "Ime za pomenek že obstaja" msgid "Not connected to the server" msgstr "S strežnikom niste povezani" -msgid "Find buddies..." -msgstr "Poišči prijatelje ..." - msgid "Change password..." msgstr "Spremeni geslo ..." +msgid "Find buddies..." +msgstr "Poišči prijatelje ..." + msgid "Upload buddylist to Server" msgstr "Izvozi seznam prijateljev na strežnik" @@ -3375,25 +3210,24 @@ msgstr "Vtičnik za protokol Gadu-Gadu" msgid "Polish popular IM" msgstr "Olepšaj priljubljen program za neposredno sporočanje" -msgid "Gadu-Gadu User" -msgstr "Uporabnik Gadu-Gadu" - msgid "GG server" msgstr "Strežnik GG" -msgid "Don't use encryption" -msgstr "Ne uporabi šifriranja" - msgid "Use encryption if available" msgstr "Uporabi šifriranje, če je na voljo" -#. TODO msgid "Require encryption" msgstr "Zahtevaj šifriranje" +msgid "Don't use encryption" +msgstr "Ne uporabi šifriranja" + msgid "Connection security" msgstr "Varnost povezave" +msgid "Show links from strangers" +msgstr "Pokaži povezave neznancev" + #, c-format msgid "Unknown command: %s" msgstr "Neznan ukaz: %s" @@ -3446,9 +3280,6 @@ msgstr "_Geslo:" msgid "IRC nick and server may not contain whitespace" msgstr "IRC vzdevek in strežnik ne smejo vsebovati presledka" -msgid "SSL support unavailable" -msgstr "Podpora SSL ni na voljo" - msgid "Unable to connect" msgstr "Ni se mogoče povezati" @@ -3482,7 +3313,9 @@ msgstr "Vtičnik za protokol IRC" msgid "The IRC Protocol Plugin that Sucks Less" msgstr "Vtičnik za protokol IRC, ki je manj beden" -#. host to connect to +#. set up account ID as user:server +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Server" msgstr "Strežnik" @@ -3626,19 +3459,11 @@ msgstr "način (%s %s) nastavil %s" msgid "Invalid nickname" msgstr "Neveljaven vzdevek" -msgid "" -"Your selected nickname was rejected by the server. It probably contains " -"invalid characters." -msgstr "" -"Vaš izbrani vzdevek je strežnik zavrnil. Najverjetneje vsebuje neveljavne " -"znake." +msgid "Your selected nickname was rejected by the server. It probably contains invalid characters." +msgstr "Vaš izbrani vzdevek je strežnik zavrnil. Najverjetneje vsebuje neveljavne znake." -msgid "" -"Your selected account name was rejected by the server. It probably contains " -"invalid characters." -msgstr "" -"Vaše izbrano ime računa je strežnik zavrnil. Najverjetneje vsebuje " -"neveljavne znake." +msgid "Your selected account name was rejected by the server. It probably contains invalid characters." +msgstr "Vaše izbrano ime računa je strežnik zavrnil. Najverjetneje vsebuje neveljavne znake." #. We only want to do the following dance if the connection #. has not been successfully completed. If it has, just @@ -3684,16 +3509,11 @@ msgstr "Močni udarci od %s" msgid "action <action to perform>: Perform an action." msgstr "action <dejanje za izvedbo>: Izvedi dejanje." -#, fuzzy msgid "authserv: Send a command to authserv" -msgstr "chanserv: pošlji ukaz chanservu" +msgstr "authserv: pošlji ukaz authserv-u" -msgid "" -"away [message]: Set an away message, or use no message to return from being " -"away." -msgstr "" -"odsoten [sporočilo]: Nastavite sporočilo za odsotnost ali ne uporabite " -"sporočila za vrnitev iz odsotnosti." +msgid "away [message]: Set an away message, or use no message to return from being away." +msgstr "odsoten [sporočilo]: Nastavite sporočilo za odsotnost ali ne uporabite sporočila za vrnitev iz odsotnosti." msgid "ctcp : sends ctcp msg to nick." msgstr "ctcp : pošlje sporočilo ctcp vzdevku." @@ -3701,56 +3521,26 @@ msgstr "ctcp : pošlje sporočilo ctcp vzdevku." msgid "chanserv: Send a command to chanserv" msgstr "chanserv: pošlji ukaz chanservu" -msgid "" -"deop <nick1> [nick2] ...: Remove channel operator status from " -"someone. You must be a channel operator to do this." -msgstr "" -"deop <vzdevek1> [vzdevek2] ...: Odstrani status operaterja kanala " -"nekomu. Za to dejanje morate biti operater kanala." +msgid "deop <nick1> [nick2] ...: Remove channel operator status from someone. You must be a channel operator to do this." +msgstr "deop <vzdevek1> [vzdevek2] ...: Odstrani status operaterja kanala nekomu. Za to dejanje morate biti operater kanala." -msgid "" -"devoice <nick1> [nick2] ...: Remove channel voice status from " -"someone, preventing them from speaking if the channel is moderated (+m). You " -"must be a channel operator to do this." -msgstr "" -"devoice <nick1> [nick2] ...: Odstrani glasovni status kanala nekomu, " -"kar mu bo preprečilo oglašanje, ko je kanal moderiran (+m). Za to dejanje " -"morate biti operater kanala." +msgid "devoice <nick1> [nick2] ...: Remove channel voice status from someone, preventing them from speaking if the channel is moderated (+m). You must be a channel operator to do this." +msgstr "devoice <nick1> [nick2] ...: Odstrani glasovni status kanala nekomu, kar mu bo preprečilo oglašanje, ko je kanal moderiran (+m). Za to dejanje morate biti operater kanala." -msgid "" -"invite <nick> [room]: Invite someone to join you in the specified " -"channel, or the current channel." -msgstr "" -"invite <vzdevek> [soba]: Povabite nekoga, da se vam pridruži v " -"navedenem ali trenutnem kanalu." +msgid "invite <nick> [room]: Invite someone to join you in the specified channel, or the current channel." +msgstr "invite <vzdevek> [soba]: Povabite nekoga, da se vam pridruži v navedenem ali trenutnem kanalu." -msgid "" -"j <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more " -"channels, optionally providing a channel key for each if needed." -msgstr "" -"j <soba1>[,soba2][,...] [ključ1[,ključ2][,...]]: Vnesite enega ali " -"več kanalov, za ketere lahko po želji navedete tudi ključe." +msgid "j <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more channels, optionally providing a channel key for each if needed." +msgstr "j <soba1>[,soba2][,...] [ključ1[,ključ2][,...]]: Vnesite enega ali več kanalov, za ketere lahko po želji navedete tudi ključe." -msgid "" -"join <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more " -"channels, optionally providing a channel key for each if needed." -msgstr "" -"join <soba1>[,soba2][,...] [ključ1[,ključ2][,...]]: Vnesite enega ali " -"več kanalov, za ketere lahko po želji navedete tudi ključe." +msgid "join <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more channels, optionally providing a channel key for each if needed." +msgstr "join <soba1>[,soba2][,...] [ključ1[,ključ2][,...]]: Vnesite enega ali več kanalov, za ketere lahko po želji navedete tudi ključe." -msgid "" -"kick <nick> [message]: Remove someone from a channel. You must be a " -"channel operator to do this." -msgstr "" -"kick <vzdevek> [sporočilo]: Odstranite nekoga iz kanala. Za to " -"dejanje morate biti operater kanala." +msgid "kick <nick> [message]: Remove someone from a channel. You must be a channel operator to do this." +msgstr "kick <vzdevek> [sporočilo]: Odstranite nekoga iz kanala. Za to dejanje morate biti operater kanala." -msgid "" -"list: Display a list of chat rooms on the network. Warning, some servers " -"may disconnect you upon doing this." -msgstr "" -"list: Prikaži seznam pogovornih sob v omrežju. Opozorilo: nekateri " -"strežniki vas lahko med tem odklopijo." +msgid "list: Display a list of chat rooms on the network. Warning, some servers may disconnect you upon doing this." +msgstr "list: Prikaži seznam pogovornih sob v omrežju. Opozorilo: nekateri strežniki vas lahko med tem odklopijo." msgid "me <action to perform>: Perform an action." msgstr "me <dejanje za izvedbo>: Izvedi dejanje." @@ -3758,19 +3548,11 @@ msgstr "me <dejanje za izvedbo>: Izvedi dejanje." msgid "memoserv: Send a command to memoserv" msgstr "memoserv: Pošlji ukaz memoservu" -msgid "" -"mode <+|-><A-Za-z> <nick|channel>: Set or unset a channel " -"or user mode." -msgstr "" -"mode <+|-><A-Za-z> <vzdevek|kanal>: Nastavi ali " -"razveljavi način uporabnika ali kanala." +msgid "mode <+|-><A-Za-z> <nick|channel>: Set or unset a channel or user mode." +msgstr "mode <+|-><A-Za-z> <vzdevek|kanal>: Nastavi ali razveljavi način uporabnika ali kanala." -msgid "" -"msg <nick> <message>: Send a private message to a user (as " -"opposed to a channel)." -msgstr "" -"msg <vzdevek> <sporočilo>: Pošlji zasebno sporočilo uporabniku " -"(za razliko od kanala)." +msgid "msg <nick> <message>: Send a private message to a user (as opposed to a channel)." +msgstr "msg <vzdevek> <sporočilo>: Pošlji zasebno sporočilo uporabniku (za razliko od kanala)." msgid "names [channel]: List the users currently in a channel." msgstr "names [kanal]: Seznam uporabnikov, ki so trenutno na kanalu." @@ -3784,57 +3566,32 @@ msgstr "nickserv: pošlji ukaz nickservu" msgid "notice <target<: Send a notice to a user or channel." msgstr "notice <cilj>: Pošlji uporabniku ali kanalu opozorilo." -msgid "" -"op <nick1> [nick2] ...: Grant channel operator status to someone. You " -"must be a channel operator to do this." -msgstr "" -"op <vzdevek1> [vzdevek2] ...: Podelite status operaterja kanala " -"nekomu. Za to dejanje morate biti operater kanala." +msgid "op <nick1> [nick2] ...: Grant channel operator status to someone. You must be a channel operator to do this." +msgstr "op <vzdevek1> [vzdevek2] ...: Podelite status operaterja kanala nekomu. Za to dejanje morate biti operater kanala." -msgid "" -"operwall <message>: If you don't know what this is, you probably " -"can't use it." -msgstr "" -"operwall <sporočilo>: Če ne veste, kaj je to, tega verjetno ne morete " -"uporabiti." +msgid "operwall <message>: If you don't know what this is, you probably can't use it." +msgstr "operwall <sporočilo>: Če ne veste, kaj je to, tega verjetno ne morete uporabiti." msgid "operserv: Send a command to operserv" msgstr "operserv: pošlji ukaz operservu" -msgid "" -"part [room] [message]: Leave the current channel, or a specified channel, " -"with an optional message." -msgstr "" -"part [soba] [sporočilo]: Zapusti trenutni ali določen kanal z možnostjo " -"sporočila." +msgid "part [room] [message]: Leave the current channel, or a specified channel, with an optional message." +msgstr "part [soba] [sporočilo]: Zapusti trenutni ali določen kanal z možnostjo sporočila." -msgid "" -"ping [nick]: Asks how much lag a user (or the server if no user specified) " -"has." -msgstr "" -"ping [vzdevek]: Vpraša koliko zaostanka ima uporabnik (ali strežnik, če " -"uporabnik ni naveden)." +msgid "ping [nick]: Asks how much lag a user (or the server if no user specified) has." +msgstr "ping [vzdevek]: Vpraša koliko zaostanka ima uporabnik (ali strežnik, če uporabnik ni naveden)." -msgid "" -"query <nick> <message>: Send a private message to a user (as " -"opposed to a channel)." -msgstr "" -"query <vzdevek> <sporočilo>: Pošlji zasebno sporočilo " -"uporabniku (za razliko od kanala)." +msgid "query <nick> <message>: Send a private message to a user (as opposed to a channel)." +msgstr "query <vzdevek> <sporočilo>: Pošlji zasebno sporočilo uporabniku (za razliko od kanala)." msgid "quit [message]: Disconnect from the server, with an optional message." -msgstr "" -"quit [sporočilo]: Prekinitev povezave s strežnikom z možnostjo sporočila." +msgstr "quit [sporočilo]: Prekinitev povezave s strežnikom z možnostjo sporočila." msgid "quote [...]: Send a raw command to the server." msgstr "quote [...]: Pošlji surov ukaz strežniku." -msgid "" -"remove <nick> [message]: Remove someone from a room. You must be a " -"channel operator to do this." -msgstr "" -"remove <vzdevek> [sporočilo]: Odstrani nekoga iz sobe. Za to dejanje " -"morate biti operater kanala." +msgid "remove <nick> [message]: Remove someone from a room. You must be a channel operator to do this." +msgstr "remove <vzdevek> [sporočilo]: Odstrani nekoga iz sobe. Za to dejanje morate biti operater kanala." msgid "time: Displays the current local time at the IRC server." msgstr "time: Prikaže trenutni krajevni čas na strežniku IRC." @@ -3843,32 +3600,22 @@ msgid "topic [new topic]: View or change the channel topic." msgstr "topic [nova tema]: Oglejte si ali zamenjajte temo kanala." msgid "umode <+|-><A-Za-z>: Set or unset a user mode." -msgstr "" -"umode <+|-><A-Za-z>: Nastavi ali odvzemi način uporabnika." +msgstr "umode <+|-><A-Za-z>: Nastavi ali odvzemi način uporabnika." msgid "version [nick]: send CTCP VERSION request to a user" msgstr "version [vzdevek]: pošlji zahtevo CTCP VERSION uporabniku" -msgid "" -"voice <nick1> [nick2] ...: Grant channel voice status to someone. You " -"must be a channel operator to do this." -msgstr "" -"voice <vzdevek1> [vzdevek2] ...: Podelite status operaterja kanala " -"nekomu. Za to dejanje morate biti operater kanala." +msgid "voice <nick1> [nick2] ...: Grant channel voice status to someone. You must be a channel operator to do this." +msgstr "voice <vzdevek1> [vzdevek2] ...: Podelite status operaterja kanala nekomu. Za to dejanje morate biti operater kanala." -msgid "" -"wallops <message>: If you don't know what this is, you probably can't " -"use it." -msgstr "" -"wallops <sporočilo>: Če ne veste, kaj je to, tega verjetno ne morete " -"uporabiti." +msgid "wallops <message>: If you don't know what this is, you probably can't use it." +msgstr "wallops <sporočilo>: Če ne veste, kaj je to, tega verjetno ne morete uporabiti." msgid "whois [server] <nick>: Get information on a user." msgstr "whois [strežnik] <vzdevek>: Dobi več informacij o uporabniku." msgid "whowas <nick>: Get information on a user that has logged off." -msgstr "" -"whois <vzdevek>: Dobi več informacij o uporabniku, ki se je odjavil." +msgstr "whois <vzdevek>: Dobi več informacij o uporabniku, ki se je odjavil." #, c-format msgid "Reply time from %s: %lu seconds" @@ -3893,8 +3640,7 @@ msgid "execute" msgstr "izvedi" msgid "Server requires plaintext authentication over an unencrypted stream" -msgstr "" -"Strežnik zahteva overovitev z navadnim besedilom preko nešifriranega toka" +msgstr "Strežnik zahteva overovitev z navadnim besedilom preko nešifriranega toka" #. This happens when the server sends back jibberish #. * in the "additional data with success" case. @@ -3907,12 +3653,8 @@ msgid "Server does not use any supported authentication method" msgstr "Strežnik ne uporablja nobene podprte metode overovitve" #, c-format -msgid "" -"%s requires plaintext authentication over an unencrypted connection. Allow " -"this and continue authentication?" -msgstr "" -"%s zahteva overovitev z navadnim besedilom preko nešifrirane povezave. Se " -"strinjate s tem in želite nadaljevati z overovitvijo?" +msgid "%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?" +msgstr "%s zahteva overovitev z navadnim besedilom preko nešifrirane povezave. Se strinjate s tem in želite nadaljevati z overovitvijo?" msgid "Plaintext Authentication" msgstr "Overovitev z navadnim besedilom" @@ -3927,17 +3669,11 @@ msgid "Server thinks authentication is complete, but client does not" msgstr "Strežnik meni, da je overovitev dokončana, odjemalec pa ne" msgid "Server may require plaintext authentication over an unencrypted stream" -msgstr "" -"Strežnik lahko zahteva overovitev z navadnim besedilom preko nešifriranega " -"toka" +msgstr "Strežnik lahko zahteva overovitev z navadnim besedilom preko nešifriranega toka" #, c-format -msgid "" -"%s may require plaintext authentication over an unencrypted connection. " -"Allow this and continue authentication?" -msgstr "" -"%s lahko zahteva overovitev z navadnim besedilom preko nešifrirane povezave. " -"Se strinjate s tem in želite nadaljevati z overovitvijo?" +msgid "%s may require plaintext authentication over an unencrypted connection. Allow this and continue authentication?" +msgstr "%s lahko zahteva overovitev z navadnim besedilom preko nešifrirane povezave. Se strinjate s tem in želite nadaljevati z overovitvijo?" msgid "SASL authentication failed" msgstr "Overovitev SASL ni uspela" @@ -3952,17 +3688,11 @@ msgstr "Neveljavno kodiranje" msgid "Unsupported Extension" msgstr "Nepodprta razširitev" -msgid "" -"Unexpected response from the server. This may indicate a possible MITM " -"attack" +msgid "Unexpected response from the server. This may indicate a possible MITM attack" msgstr "Nepričakovan odgovor strežnika. To nakazuje možen napad MITM." -msgid "" -"The server does support channel binding, but did not appear to advertise " -"it. This indicates a likely MITM attack" -msgstr "" -"Strežnik podpira spajanje kanalov, vendar se ni zdelo, da ga oglašuje. To " -"nakazuje možen napad MITM." +msgid "The server does support channel binding, but did not appear to advertise it. This indicates a likely MITM attack" +msgstr "Strežnik podpira spajanje kanalov, vendar se ni zdelo, da ga oglašuje. To nakazuje možen napad MITM." msgid "Server does not support channel binding" msgstr "Strežnik ne podpira spajanja kanalov" @@ -4010,6 +3740,8 @@ msgstr "Povezave s strežnikom ni mogoče vzpostaviti: %s" msgid "Unable to establish SSL connection" msgstr "Povezave SSL ni mogoče vzpostaviti" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Full Name" msgstr "Polno ime" @@ -4073,14 +3805,16 @@ msgstr "Opis" msgid "Edit XMPP vCard" msgstr "Uredi vCard za XMPP" -msgid "" -"All items below are optional. Enter only the information with which you feel " -"comfortable." +msgid "All items below are optional. Enter only the information with which you feel comfortable." msgstr "Vsa spodnja polja so izbirna. Vnesite samo informacije, ki jih želite." +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Client" msgstr "Odjemalec" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Operating System" msgstr "Operacijski sistem" @@ -4090,6 +3824,8 @@ msgstr "Krajevni čas" msgid "Priority" msgstr "Prednost stika" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Resource" msgstr "Vir" @@ -4119,12 +3855,8 @@ msgid "Logo" msgstr "Logotip" #, c-format -msgid "" -"%s will no longer be able to see your status updates. Do you want to " -"continue?" -msgstr "" -"Oseba %s ne bo več mogla videti posodobitev vašega stanja. Ali želite " -"nadaljevati?" +msgid "%s will no longer be able to see your status updates. Do you want to continue?" +msgstr "Oseba %s ne bo več mogla videti posodobitev vašega stanja. Ali želite nadaljevati?" msgid "Cancel Presence Notification" msgstr "Prekliči obvestilo o prisotnosti" @@ -4163,12 +3895,8 @@ msgid "The following are the results of your search" msgstr "To so rezultati vašega iskanja" #. current comment from Jabber User Directory users.jabber.org -msgid "" -"Find a contact by entering the search criteria in the given fields. Note: " -"Each field supports wild card searches (%)" -msgstr "" -"Najdi stik z vnosom iskalnih kriterijev v dana polja. Opomba: vsa polja " -"dovoljujejo iskanje z nadomestnimi znaki (%)." +msgid "Find a contact by entering the search criteria in the given fields. Note: Each field supports wild card searches (%)" +msgstr "Najdi stik z vnosom iskalnih kriterijev v dana polja. Opomba: vsa polja dovoljujejo iskanje z nadomestnimi znaki (%)." msgid "Directory Query Failed" msgstr "Povpraševanje po imeniku ni uspelo" @@ -4185,9 +3913,6 @@ msgstr "Ukazi strežniku: %s" msgid "Fill in one or more fields to search for any matching XMPP users." msgstr "Izpolnite eno ali več polj za iskanje uporabnikov XMPP." -msgid "Email Address" -msgstr "E-naslov" - msgid "Search for XMPP users" msgstr "Poišči uporabnike XMPP" @@ -4280,9 +4005,7 @@ msgid "Roles:" msgstr "Vloge:" msgid "Server requires TLS/SSL, but no TLS/SSL support was found." -msgstr "" -"Strežnik zahteva TLS/SSL za prijavo, vendar odpore za TLS/SSL ni mogoče " -"najti." +msgstr "Strežnik zahteva TLS/SSL za prijavo, vendar odpore za TLS/SSL ni mogoče najti." msgid "You require encryption, but no TLS/SSL support was found." msgstr "Vi zahtevate šifriranje, podpore za TLS/SSL pa ni mogoče najti." @@ -4344,10 +4067,8 @@ msgstr "Že registriran" msgid "Unregister" msgstr "Odregistriraj se" -msgid "" -"Please fill out the information below to change your account registration." -msgstr "" -"Za spremembo registracije svojega računa morate izpolniti spodnja polja." +msgid "Please fill out the information below to change your account registration." +msgstr "Za spremembo registracije svojega računa morate izpolniti spodnja polja." msgid "Please fill out the information below to register your new account." msgstr "Za registracijo novega računa morate izpolniti spodnja polja." @@ -4393,6 +4114,8 @@ msgstr "Strežnik ne podpira blokiranja" msgid "Not Authorized" msgstr "Nepooblaščeno" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Mood" msgstr "Razpoloženje" @@ -4674,12 +4397,8 @@ msgid "Unable to buzz, because %s might be offline." msgstr "Ni mogoče stresti, saj je oseba %s morda nepovezana." #, c-format -msgid "" -"Unable to buzz, because %s does not support it or does not wish to receive " -"buzzes now." -msgstr "" -"Osebe %s ni mogoče stresti, ker tega dejanja ne podpira ali zdaj ne želi " -"prejemati tresenja." +msgid "Unable to buzz, because %s does not support it or does not wish to receive buzzes now." +msgstr "Osebe %s ni mogoče stresti, ker tega dejanja ne podpira ali zdaj ne želi prejemati tresenja." #. Yahoo only supports one attention command: the 'buzz'. #. This is index number YAHOO_BUZZ. @@ -4704,16 +4423,13 @@ msgstr "Medija z %s ni mogoče iniciirati: uporabnik ni povezan" #, c-format msgid "Unable to initiate media with %s: not subscribed to user presence" -msgstr "" -"Medija %s ni mogoče iniciirati: niste naročeni na stanja prisotnosti osebe" +msgstr "Medija %s ni mogoče iniciirati: niste naročeni na stanja prisotnosti osebe" msgid "Media Initiation Failed" msgstr "Iniciacija medija ni uspela" #, c-format -msgid "" -"Please select the resource of %s with which you would like to start a media " -"session." +msgid "Please select the resource of %s with which you would like to start a media session." msgstr "Izberite vir %s, s katerim bi radi začeli medijsko sejo." msgid "Select a Resource" @@ -4743,35 +4459,23 @@ msgstr "topic [nova tema]: Oglej si ali spremeni temo." msgid "ban <user> [reason]: Ban a user from the room." msgstr "ban <uporabnik> [razlog]: Prepovej uporabnika v sobi." -msgid "" -"affiliate <owner|admin|member|outcast|none> [nick1] [nick2] ...: Get " -"the users with an affiliation or set users' affiliation with the room." -msgstr "" -"affiliate <owner|admin|member|outcast|none> [vzdevek1] [vzdevek2] ...: " -"Pridobi navezavo uporabnikov ali nastavi navezavo uporabnikov na sobo." +msgid "affiliate <owner|admin|member|outcast|none> [nick1] [nick2] ...: Get the users with an affiliation or set users' affiliation with the room." +msgstr "affiliate <owner|admin|member|outcast|none> [vzdevek1] [vzdevek2] ...: Pridobi navezavo uporabnikov ali nastavi navezavo uporabnikov na sobo." -msgid "" -"role <moderator|participant|visitor|none> [nick1] [nick2] ...: Get the " -"users with a role or set users' role with the room." -msgstr "" -"role <moderator|participant|visitor|none> [vzdevek1] [vzdevek2] ...: " -"Pridobi uporabnike z vlogo ali nastavi vlogo uporabnikov v sobi." +msgid "role <moderator|participant|visitor|none> [nick1] [nick2] ...: Get the users with a role or set users' role with the room." +msgstr "role <moderator|participant|visitor|none> [vzdevek1] [vzdevek2] ...: Pridobi uporabnike z vlogo ali nastavi vlogo uporabnikov v sobi." msgid "invite <user> [message]: Invite a user to the room." msgstr "invite <uporabnik> [sporočilo]: Povabite uporabnika v sobo." -#, fuzzy msgid "join: <room[@server]> [password]: Join a chat." -msgstr "join: <soba> [geslo]: Pridruži se pomenku na tem strežniku." +msgstr "join: <soba[@strežnik]> [geslo]: Pridruži se pomenku." msgid "kick <user> [reason]: Kick a user from the room." msgstr "kick <uporabnik> [razlog]: Brcni uporabnika iz sobe." -msgid "" -"msg <user> <message>: Send a private message to another user." -msgstr "" -"msg <uporabnik> <sporočilo>: Pošljite zasebno sporočilo drugemu " -"uporabniku." +msgid "msg <user> <message>: Send a private message to another user." +msgstr "msg <uporabnik> <sporočilo>: Pošljite zasebno sporočilo drugemu uporabniku." msgid "ping <jid>:\tPing a user/component/server." msgstr "ping <jid>:\tPingni uporabnika/komponento/strežnik." @@ -4881,12 +4585,8 @@ msgstr "Napaka v pomenku %s" msgid "Create New Room" msgstr "Ustvari novo sobo" -msgid "" -"You are creating a new room. Would you like to configure it, or accept the " -"default settings?" -msgstr "" -"Ustvarili boste novo sobo. Jo želite najprej nastaviti ali boste sprejeli " -"privzete nastavitve?" +msgid "You are creating a new room. Would you like to configure it, or accept the default settings?" +msgstr "Ustvarili boste novo sobo. Jo želite najprej nastaviti ali boste sprejeli privzete nastavitve?" msgid "_Configure Room" msgstr "_Nastavi sobo" @@ -4910,8 +4610,7 @@ msgstr "Prišlo je do neznane napake" #, c-format msgid "Unable to send file to %s, user does not support file transfers" -msgstr "" -"Ni mogoče poslati datoteke %s, ker uporabnik ne podpira prenosov datotek" +msgstr "Ni mogoče poslati datoteke %s, ker uporabnik ne podpira prenosov datotek" #. not success msgid "File Send Failed" @@ -4927,9 +4626,7 @@ msgstr "Datoteke %s ni mogoče poslati, ker uporabnik ni povezan" #, c-format msgid "Unable to send file to %s, not subscribed to user presence" -msgstr "" -"Datoteke %s ni mogoče poslati, ker nimate dostopa do stanja uporabnikove " -"prisotnosti" +msgstr "Datoteke %s ni mogoče poslati, ker nimate dostopa do stanja uporabnikove prisotnosti" #, c-format msgid "Please select the resource of %s to which you would like to send a file" @@ -5194,12 +4891,8 @@ msgstr "Nastavi uporabniški vzdevek" msgid "Please specify a new nickname for you." msgstr "Prosimo, vnesite svoj nov vzdevek." -msgid "" -"This information is visible to all contacts on your contact list, so choose " -"something appropriate." -msgstr "" -"Ti podatki so vidni vsem stikom s seznama prijateljev, zato izberite nekaj " -"primernega." +msgid "This information is visible to all contacts on your contact list, so choose something appropriate." +msgstr "Ti podatki so vidni vsem stikom s seznama prijateljev, zato izberite nekaj primernega." msgid "Set" msgstr "Nastavi" @@ -5232,9 +4925,6 @@ msgstr "Ni mogoče razčleniti sporočila" msgid "Syntax Error (probably a client bug)" msgstr "Skladenjska napaka (verjetno hrošč v odjemalcu)" -msgid "Invalid email address" -msgstr "Neveljaven naslov e-pošte" - msgid "User does not exist" msgstr "Uporabnik ne obstaja" @@ -5301,9 +4991,6 @@ msgstr "Preveč zadetkov za FND" msgid "Not logged in" msgstr "Neprijavljen" -msgid "Service temporarily unavailable" -msgstr "Storitev trenutno ni na voljo" - msgid "Database server error" msgstr "Napaka v podatkovni bazi strežnika" @@ -5401,20 +5088,12 @@ msgid "Buddy list synchronization issue in %s (%s)" msgstr "Težava ujemanja (sinhronizacije) seznama prijateljev pri %s (%s)" #, c-format -msgid "" -"%s on the local list is inside the group \"%s\" but not on the server list. " -"Do you want this buddy to be added?" -msgstr "" -"%s z lokalnega seznama je v skupini \"%s\", ne pa tudi na seznamu strežnika. " -"Želite dodati tega prijatelja v skupino?" +msgid "%s on the local list is inside the group \"%s\" but not on the server list. Do you want this buddy to be added?" +msgstr "%s z lokalnega seznama je v skupini \"%s\", ne pa tudi na seznamu strežnika. Želite dodati tega prijatelja v skupino?" #, c-format -msgid "" -"%s is on the local list but not on the server list. Do you want this buddy " -"to be added?" -msgstr "" -"%s je na lokalnem seznamu, ne pa tudi na seznamu strežnika. Želite dodati " -"tega prijatelja?" +msgid "%s is on the local list but not on the server list. Do you want this buddy to be added?" +msgstr "%s je na lokalnem seznamu, ne pa tudi na seznamu strežnika. Želite dodati tega prijatelja?" msgid "Other Contacts" msgstr "Drugi stiki" @@ -5424,9 +5103,7 @@ msgstr "Stiki, s katerimi ne klepetate" #, c-format msgid "%s sent a wink. Click here to play it" -msgstr "" -"%s vam je poslal mežik. Kliknite tukaj za " -"predvajanje" +msgstr "%s vam je poslal mežik. Kliknite tukaj za predvajanje" #, c-format msgid "%s sent a wink, but it could not be saved" @@ -5434,9 +5111,7 @@ msgstr "%s vam je poslal mežik, ki pa ga ni mogoče shraniti." #, c-format msgid "%s sent a voice clip. Click here to play it" -msgstr "" -"%s vam je poslal zvočni posnetek. Kliknite tukaj za " -"predvajanje" +msgstr "%s vam je poslal zvočni posnetek. Kliknite tukaj za predvajanje" #, c-format msgid "%s sent a voice clip, but it could not be saved" @@ -5497,9 +5172,7 @@ msgstr "Niste prijavljeni še z nobenega drugega mesta" msgid "Allow multiple logins?" msgstr "Želite dovoliti več hkratnih prijav?" -msgid "" -"Do you want to allow or disallow connecting from multiple locations " -"simultaneously?" +msgid "Do you want to allow or disallow connecting from multiple locations simultaneously?" msgstr "Želite dovoliti ali prepovedati hkratno povezovanje z več mest?" msgid "Allow" @@ -5520,12 +5193,8 @@ msgstr "Nastavite številko vašega mobilnega telefona." msgid "Allow MSN Mobile pages?" msgstr "Dovoli MSN strani za mobilnike?" -msgid "" -"Do you want to allow or disallow people on your buddy list to send you MSN " -"Mobile pages to your cell phone or other mobile device?" -msgstr "" -"Ali želite dovoliti oz. prepovedati prijateljem na vašem seznamu, da vam " -"pošiljajo MSN strani za mobilnike na vaš mobilni telefon?" +msgid "Do you want to allow or disallow people on your buddy list to send you MSN Mobile pages to your cell phone or other mobile device?" +msgstr "Ali želite dovoliti oz. prepovedati prijateljem na vašem seznamu, da vam pošiljajo MSN strani za mobilnike na vaš mobilni telefon?" #, c-format msgid "Blocked Text for %s" @@ -5535,8 +5204,7 @@ msgid "No text is blocked for this account." msgstr "Za ta račun ni blokiranega besedila." #, c-format -msgid "" -"MSN servers are currently blocking the following regular expressions:
    %s" +msgid "MSN servers are currently blocking the following regular expressions:
    %s" msgstr "Strežniki MSN trenutno blokirajo naslednje regularne izraze:
    %s" msgid "This account does not have email enabled." @@ -5618,16 +5286,11 @@ msgid "Send to Mobile" msgstr "Pošlji na mobilca" msgid "SSL support is needed for MSN. Please install a supported SSL library." -msgstr "" -"Za MSN potrebujete podporo SSL, zato morate namestiti podprto knjižnico SSL." +msgstr "Za MSN potrebujete podporo SSL, zato morate namestiti podprto knjižnico SSL." #, c-format -msgid "" -"Unable to add the buddy %s because the username is invalid. Usernames must " -"be valid email addresses." -msgstr "" -"Ni mogoče dodati prijatelja %s, ker uporabniško ime ni veljavno. Imena so " -"lahko le veljavni e-poštni naslovi." +msgid "Unable to add the buddy %s because the username is invalid. Usernames must be valid email addresses." +msgstr "Ni mogoče dodati prijatelja %s, ker uporabniško ime ni veljavno. Imena so lahko le veljavni e-poštni naslovi." msgid "Unable to Add" msgstr "Nemogoče dodati" @@ -5644,6 +5307,8 @@ msgstr "Starost" msgid "Occupation" msgstr "Zaposlitev" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Location" msgstr "Lokacija" @@ -5768,20 +5433,11 @@ msgstr "Domača stran" msgid "The user has not created a public profile." msgstr "Uporabnik ni ustvaril javnega profila." -msgid "" -"MSN reported not being able to find the user's profile. This either means " -"that the user does not exist, or that the user exists but has not created a " -"public profile." -msgstr "" -"MSN ne more najti uporabnikovega profila. To lahko pomeni, da uporabnik ne " -"obstaja, ali pa še ni ustvaril javnega profila." +msgid "MSN reported not being able to find the user's profile. This either means that the user does not exist, or that the user exists but has not created a public profile." +msgstr "MSN ne more najti uporabnikovega profila. To lahko pomeni, da uporabnik ne obstaja, ali pa še ni ustvaril javnega profila." -msgid "" -"Could not find any information in the user's profile. The user most likely " -"does not exist." -msgstr "" -"V uporabnikovem profilu ni mogoče najti nobenih informacij. Uporabnik " -"verjetno ne obstaja." +msgid "Could not find any information in the user's profile. The user most likely does not exist." +msgstr "V uporabnikovem profilu ni mogoče najti nobenih informacij. Uporabnik verjetno ne obstaja." msgid "View web profile" msgstr "Pokaži spletni profil" @@ -5850,52 +5506,37 @@ msgstr "Ni mogoče odstraniti uporabnika" msgid "Mobile message was not sent because it was too long." msgstr "Mobilnega sporočila ni mogoče poslati, ker je predolgo." -#, fuzzy msgid "Mobile message was not sent because an unknown error occurred." -msgstr "Sporočila ni bilo poslano, ker je prišlo do neznane napake." +msgstr "Mobilno sporočilo ni bilo poslano, ker je prišlo do neznane napake." #, c-format msgid "" -"The MSN server will shut down for maintenance in %d minute. You will " -"automatically be signed out at that time. Please finish any conversations " -"in progress.\n" +"The MSN server will shut down for maintenance in %d minute. You will automatically be signed out at that time. Please finish any conversations in progress.\n" "\n" -"After the maintenance has been completed, you will be able to successfully " -"sign in." +"After the maintenance has been completed, you will be able to successfully sign in." msgid_plural "" -"The MSN server will shut down for maintenance in %d minutes. You will " -"automatically be signed out at that time. Please finish any conversations " -"in progress.\n" +"The MSN server will shut down for maintenance in %d minutes. You will automatically be signed out at that time. Please finish any conversations in progress.\n" "\n" -"After the maintenance has been completed, you will be able to successfully " -"sign in." +"After the maintenance has been completed, you will be able to successfully sign in." msgstr[0] "" -"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem " -"boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" +"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" "\n" "Po zaključenih vzdrževalnih delih se boste lahko uspešno prijavili." msgstr[1] "" -"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minuti. Ob tem " -"boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" +"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minuti. Ob tem boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" "\n" "Po zaključenih vzdrževalnih delih se boste lahko uspešno prijavili." msgstr[2] "" -"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem " -"boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" +"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" "\n" "Po zaključenih vzdrževalnih delih se boste lahko uspešno prijavili." msgstr[3] "" -"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem " -"boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" +"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" "\n" "Po zaključenih vzdrževalnih delih se boste lahko uspešno prijavili." -msgid "" -"Message was not sent because the system is unavailable. This normally " -"happens when the user is blocked or does not exist." -msgstr "" -"Sporočilo ni bilo poslano, ker sistem ni na voljo. To se ponavadi zgodi, ko " -"je uporabnik blokiran ali ne obstaja." +msgid "Message was not sent because the system is unavailable. This normally happens when the user is blocked or does not exist." +msgstr "Sporočilo ni bilo poslano, ker sistem ni na voljo. To se ponavadi zgodi, ko je uporabnik blokiran ali ne obstaja." msgid "Message was not sent because messages are being sent too quickly." msgstr "Sporočila ni bilo poslano, saj je sporočila pošiljajo prehitro." @@ -5906,6 +5547,18 @@ msgstr "Sporočila ni bilo poslano, ker je prišlo do neznane napake kodiranja." msgid "Message was not sent because an unknown error occurred." msgstr "Sporočila ni bilo poslano, ker je prišlo do neznane napake." +#, c-format +msgid "%s (There was an error receiving this message. Converting the encoding from %s to UTF-8 failed.)" +msgstr "%s (Prišlo je do napake pri prejemanju tega sporočila. Pretvorba kodnega nabora %s v UTF-8 ni uspela.)" + +#, c-format +msgid "%s (There was an error receiving this message. The charset was %s, but it was not valid UTF-8.)" +msgstr "%s (Prišlo je do napake pri prejemanju tega sporočila. Nabor znakov je bil %s, ni pa bil veljaven UTF-8.)" + +#, c-format +msgid "%s (There was an error receiving this message. The charset was missing, but it was not valid UTF-8.)" +msgstr "%s (Prišlo je do napake pri prejemanju tega sporočila. Nabor znakov je manjkal, ni pa bil veljaven UTF-8.)" + msgid "Writing error" msgstr "Napaka pri pisanju" @@ -5930,8 +5583,7 @@ msgid "You have signed on from another location" msgstr "Prijavili ste se z drugega mesta" msgid "The MSN servers are temporarily unavailable. Please wait and try again." -msgstr "" -"Strežniki MSN so trenutno nedostopni. Prosimo počakajte in poskusite znova." +msgstr "Strežniki MSN so trenutno nedostopni. Prosimo počakajte in poskusite znova." msgid "The MSN servers are going down temporarily" msgstr "Strežniki MSN se bodo začasno zaustavili" @@ -5941,11 +5593,8 @@ msgstr "Strežniki MSN se bodo začasno zaustavili" msgid "Unable to authenticate: %s" msgstr "Ni možno overoviti: %s" -msgid "" -"Your MSN buddy list is temporarily unavailable. Please wait and try again." -msgstr "" -"Vaš seznam prijateljev MSN je trenutno nedostopen. Prosimo počakajte in " -"poskusite znova." +msgid "Your MSN buddy list is temporarily unavailable. Please wait and try again." +msgstr "Vaš seznam prijateljev MSN je trenutno nedostopen. Prosimo počakajte in poskusite znova." msgid "Handshaking" msgstr "Rokovanje" @@ -5983,8 +5632,7 @@ msgid "Out To Lunch" msgstr "Na kosilu" msgid "Message may have not been sent because a timeout occurred:" -msgstr "" -"Sporočila morda ni bilo poslano, ker je prišlo do časovne prekoračitve:" +msgstr "Sporočila morda ni bilo poslano, ker je prišlo do časovne prekoračitve:" msgid "Message could not be sent, not allowed while invisible:" msgstr "Sporočila ni mogoče poslati, saj ni dovoljeno v nevidnem stanju:" @@ -5998,16 +5646,10 @@ msgstr "Sporočilo ni bilo poslano, ker je prišlo do napake v povezavi:" msgid "Message could not be sent because we are sending too quickly:" msgstr "Sporočila ni mogoče poslati, saj je poslano prehitro:" -msgid "" -"Message could not be sent because we were unable to establish a session with " -"the server. This is likely a server problem, try again in a few minutes:" -msgstr "" -"Sporočila ni mogoče poslati, ker ni bilo mogoče vzpostaviti seje s " -"strežnikom. To je najverjetneje težava strežnika, poskusite znova v nekaj " -"minutah:" +msgid "Message could not be sent because we were unable to establish a session with the server. This is likely a server problem, try again in a few minutes:" +msgstr "Sporočila ni mogoče poslati, ker ni bilo mogoče vzpostaviti seje s strežnikom. To je najverjetneje težava strežnika, poskusite znova v nekaj minutah:" -msgid "" -"Message could not be sent because an error with the switchboard occurred:" +msgid "Message could not be sent because an error with the switchboard occurred:" msgstr "Sporočila ni bilo poslano, ker je prišlo do napake v stikalni plošči:" msgid "Message may have not been sent because an unknown error occurred:" @@ -6019,14 +5661,10 @@ msgstr "Želite izbrisati prijatelja iz adresarja?" msgid "Do you want to delete this buddy from your address book as well?" msgstr "Ali želite izbrisati tega prijatelja tudi iz adresarja?" -msgid "The username specified is invalid." -msgstr "Navedeno uporabniško ime ni veljavno." - msgid "The Display Name you entered is invalid." msgstr "Vneseno pojavno ime ni veljavno." -msgid "" -"The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'." +msgid "The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'." msgstr "Vneseni rojstni datum ni veljaven. Pravilna oblika je: 'LLLL-MM-DD'." #. show error to user @@ -6035,6 +5673,8 @@ msgstr "Napaka pri posodobitvi profila" #. no profile information yet, so we cannot update #. (reference: "libpurple/request.h") +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Profile" msgstr "Profil" @@ -6047,13 +5687,12 @@ msgid "Display Name" msgstr "Pojavno ime" #. about me -#, fuzzy msgid "About Me" msgstr "O meni" #. where I live msgid "Where I Live" -msgstr "" +msgstr "Kje živim" #. mobile number msgid "Mobile Number" @@ -6061,15 +5700,14 @@ msgstr "Št. mobilnega telefona" #. is searchable msgid "Can be searched" -msgstr "" +msgstr "Dovoljeno iskati" #. is suggestable msgid "Can be suggested" -msgstr "" +msgstr "Dovoljeno predlagati" -#, fuzzy msgid "Update your MXit Profile" -msgstr "Posodobite svoj profil" +msgstr "Posodobite svoj profil MXit" msgid "The PIN you entered is invalid." msgstr "Vneseni PIN ni veljaven." @@ -6084,9 +5722,8 @@ msgid "The two PINs you entered do not match." msgstr "Vnesena PIN-a se ne ujemata." #. show error to user -#, fuzzy msgid "PIN Update Error" -msgstr "Napaka pri posodobitvi profila" +msgstr "Napaka pri posodobitvi PIN-a" #. pin #. pin (required) @@ -6098,13 +5735,11 @@ msgid "Verify PIN" msgstr "Preveri PIN" #. (reference: "libpurple/request.h") -#, fuzzy msgid "Change PIN" -msgstr "Spremeni ikono" +msgstr "Spremeni PIN" -#, fuzzy msgid "Change MXit PIN" -msgstr "Spremeni ikono" +msgstr "Spremeni PIN MXit" msgid "View Splash" msgstr "Pokaži pozdravno okno" @@ -6115,17 +5750,14 @@ msgstr "Trenutno ni na voljo nobenega pozdravnega okna" msgid "About" msgstr "O programu" -#, fuzzy msgid "Search for user" -msgstr "Išči uporabnike" +msgstr "Poišči uporabnika" -#, fuzzy msgid "Search for a MXit contact" -msgstr "Išči uporabnike" +msgstr "Poišči stik MXit" -#, fuzzy msgid "Type search information" -msgstr "Informacije o uporabniku" +msgstr "Vnesite podatke za iskanje" msgid "_Search" msgstr "_Najdi" @@ -6135,19 +5767,16 @@ msgid "Change Profile..." msgstr "Spremeni profil ..." #. change PIN -#, fuzzy msgid "Change PIN..." -msgstr "Spremeni profil ..." +msgstr "Spremeni PIN ..." #. suggested friends -#, fuzzy msgid "Suggested friends..." -msgstr "Nastavi poimenovanje ..." +msgstr "Predlagani prijatelji ..." #. search for contacts -#, fuzzy msgid "Search for contacts..." -msgstr "Najdi uporabnike ..." +msgstr "Najdi stike ..." #. display splash-screen msgid "View Splash..." @@ -6157,31 +5786,26 @@ msgstr "Pokaži pozdravno okno ..." msgid "About..." msgstr "O razširitvi ..." +#. we are trying to send a file to MXit +#. need to reserve some space for packet headers #. the file is too big msgid "The file you are trying to send is too large!" msgstr "Datoteka, ki jo želite poslati, je prevelika!" -msgid "" -"Unable to connect to the MXit HTTP server. Please check your server settings." -msgstr "" -"Povezava s strežnikom MXit HTTP ni možna. Preverite svoje nastavitve " -"strežnika." +msgid "Unable to connect to the MXit HTTP server. Please check your server settings." +msgstr "Povezava s strežnikom MXit HTTP ni možna. Preverite svoje nastavitve strežnika." msgid "Logging In..." msgstr "Prijavljanje ..." -msgid "" -"Unable to connect to the MXit server. Please check your server settings." -msgstr "" -"S strežnikom MXit se ni mogoče povezati. Preverite nastavitve svojega " -"strežnika." +msgid "Unable to connect to the MXit server. Please check your server settings." +msgstr "S strežnikom MXit se ni mogoče povezati. Preverite nastavitve svojega strežnika." msgid "Connecting..." msgstr "Povezovanje ..." -#, fuzzy msgid "The Display Name you entered is too short." -msgstr "Vneseno pojavno ime ni veljavno." +msgstr "Vneseno pojavno ime je prekratko." msgid "The PIN you entered has an invalid length [7-10]." msgstr "Vneseni PIN ni veljavne dolžine [7-10]." @@ -6199,13 +5823,11 @@ msgstr "Izpolnite naslednja polja:" #. no reply from the WAP site msgid "Error contacting the MXit WAP site. Please try again later." -msgstr "" -"Napaka pri navezovanju stika z mestom MXit WAP. Poskusite znova kasneje." +msgstr "Napaka pri navezovanju stika z mestom MXit WAP. Poskusite znova kasneje." #. wapserver error #. server could not find the user -msgid "" -"MXit is currently unable to process the request. Please try again later." +msgid "MXit is currently unable to process the request. Please try again later." msgstr "MXit trenutno ne more obdelati zahteve. Poskusite znova kasneje." msgid "Wrong security code entered. Please try again later." @@ -6218,8 +5840,7 @@ msgid "Invalid country selected. Please try again." msgstr "Izbrana neveljavna država. Poskusite znova kasneje." msgid "The MXit ID you entered is not registered. Please register first." -msgstr "" -"ID za MXit, ki ste ga vnesli, ni registriran. Najprej se registrirajte." +msgstr "ID za MXit, ki ste ga vnesli, ni registriran. Najprej se registrirajte." msgid "The MXit ID you entered is already registered. Please choose another." msgstr "ID za MXit, ki ste ga vnesli, je že registriran. Izberite drugo ime." @@ -6269,31 +5890,26 @@ msgstr "Povabili ste uporabnika" msgid "Loading menu..." msgstr "Nalaganje menija ..." +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status Message" msgstr "Sporočilo stanja" msgid "Rejection Message" msgstr "Sporočilo zavrnitve" -#. hidden number -msgid "Hidden Number" -msgstr "Skrita številka" - -#, fuzzy msgid "No profile available" -msgstr "Ni na voljo" +msgstr "Profil ni na voljo" -#, fuzzy msgid "This contact does not have a profile." -msgstr "Ta račun nima omogočenega e-poštnega naslova." +msgstr "Ta stik nima profila." msgid "Your MXit ID..." msgstr "Vaš MXit ID ..." #. contact is in Deleted, Rejected or None state -#, fuzzy msgid "Re-Invite" -msgstr "Povabi" +msgstr "Znova povabi" #. Configuration options #. WAP server (reference: "libpurple/accountopt.h") @@ -6309,17 +5925,14 @@ msgstr "Omogoči pozdravno okno ob zagonu" msgid "Last Online" msgstr "Nazadnje povezan" -#, fuzzy msgid "Invite Message" -msgstr "Poslana sporočila" +msgstr "Povabilo" -#, fuzzy msgid "No results" -msgstr "Rezultati iskanja" +msgstr "Ni zadetkov" -#, fuzzy msgid "No contacts found." -msgstr "Ni najdenih uporabnikov" +msgstr "Ni najdenih stikov." #. define columns #, fuzzy @@ -6327,23 +5940,23 @@ msgid "UserId" msgstr "Uporabnik" msgid "Where I live" -msgstr "" +msgstr "Kje živim" #, c-format msgid "You have %i suggested friend." msgid_plural "You have %i suggested friends." -msgstr[0] "" -msgstr[1] "" -msgstr[2] "" -msgstr[3] "" +msgstr[0] "Imate %i predlaganih prijateljev." +msgstr[1] "Imate %i predlaganega prijatelja." +msgstr[2] "Imate %i predlagana prijatelja." +msgstr[3] "Imate %i predlagane prijatelje." #, c-format msgid "We found %i contact that matches your search." msgid_plural "We found %i contacts that match your search." -msgstr[0] "" -msgstr[1] "" -msgstr[2] "" -msgstr[3] "" +msgstr[0] "Najdenih %i stikov, ki se ujemajo z vašim iskanjem." +msgstr[1] "Najden %i stik, ki se ujema z vašim iskanjem." +msgstr[2] "Najdena %i stika, ki se ujemata z vašim iskanjem." +msgstr[3] "Najdeni %i stiki, ki se ujemajo z vašim iskanjem." #. we must have lost the connection, so terminate it so that we can reconnect msgid "We have lost the connection to MXit. Please reconnect." @@ -6363,13 +5976,16 @@ msgid "Successfully Logged In..." msgstr "Uspešno prijavljeni ..." #, c-format -msgid "" -"%s sent you an encrypted message, but it is not supported on this client." +msgid "%s sent you an encrypted message, but it is not supported on this client." msgstr "%s vam je poslal šifrirano sporočilo, kar še ni podprto v odjemalcu." msgid "Message Error" msgstr "Napaka sporočila" +#. could not be decrypted +msgid "An encrypted message was received which could not be decrypted." +msgstr "Prejeto je bilo šifrirano sporočilo, ki ga ni mogoče dešifrirati." + msgid "Cannot perform redirect using the specified protocol" msgstr "Preusmeritve ni mogoče izvršiti z navedenim protokolom" @@ -6521,24 +6137,12 @@ msgid "IM Friends" msgstr "Prijatelji za klepet" #, c-format -msgid "" -"%d buddy was added or updated from the server (including buddies already on " -"the server-side list)" -msgid_plural "" -"%d buddies were added or updated from the server (including buddies already " -"on the server-side list)" -msgstr[0] "" -"%d prijateljev je bilo dodanih ali posodobljenih s strežnika (vključno s " -"prijatelji, ki so že strežniškem seznamu)" -msgstr[1] "" -"%d prijatelj je bil dodan ali posodobljen s strežnika (vključno s " -"prijatelji, ki so že strežniškem seznamu)" -msgstr[2] "" -"%d prijatelja sta bila dodana ali posodobljena s strežnika (vključno s " -"prijatelji, ki so že strežniškem seznamu)" -msgstr[3] "" -"%d prijatelji so bili dodani ali posodobljeni s strežnika (vključno s " -"prijatelji, ki so že strežniškem seznamu)" +msgid "%d buddy was added or updated from the server (including buddies already on the server-side list)" +msgid_plural "%d buddies were added or updated from the server (including buddies already on the server-side list)" +msgstr[0] "%d prijateljev je bilo dodanih ali posodobljenih s strežnika (vključno s prijatelji, ki so že strežniškem seznamu)" +msgstr[1] "%d prijatelj je bil dodan ali posodobljen s strežnika (vključno s prijatelji, ki so že strežniškem seznamu)" +msgstr[2] "%d prijatelja sta bila dodana ali posodobljena s strežnika (vključno s prijatelji, ki so že strežniškem seznamu)" +msgstr[3] "%d prijatelji so bili dodani ali posodobljeni s strežnika (vključno s prijatelji, ki so že strežniškem seznamu)" msgid "Add contacts from server" msgstr "Dodaj stike s strežnika" @@ -6548,14 +6152,8 @@ msgid "Protocol error, code %d: %s" msgstr "Napaka protokola, koda %d: %s" #, c-format -msgid "" -"%s Your password is %zu characters, which is longer than the maximum length " -"of %d. Please shorten your password at http://profileedit.myspace.com/index." -"cfm?fuseaction=accountSettings.changePassword and try again." -msgstr "" -"%s Vaše geslo ima %zu znakov, več kot je dovoljenih %d znakov. Skrajšajte " -"svoje geslo na naslovu http://profileedit.myspace.com/index.cfm?" -"fuseaction=accountSettings.changePassword in poskusite znova." +msgid "%s Your password is %zu characters, which is longer than the maximum length of %d. Please shorten your password at http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword and try again." +msgstr "%s Vaše geslo ima %zu znakov, več kot je dovoljenih %d znakov. Skrajšajte svoje geslo na naslovu http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword in poskusite znova." msgid "Incorrect username or password" msgstr "Neveljavno uporabniško ime ali geslo" @@ -6590,12 +6188,8 @@ msgstr "Cifra manjka" msgid "The RC4 cipher could not be found" msgstr "Cifre RC4 ni mogoče najti" -msgid "" -"Upgrade to a libpurple with RC4 support (>= 2.0.1). MySpaceIM plugin will " -"not be loaded." -msgstr "" -"Nadgradite libpurple za podporo RC4 (>= 2.0.1). Vtičnik MySpaceIM se ne bo " -"naložil." +msgid "Upgrade to a libpurple with RC4 support (>= 2.0.1). MySpaceIM plugin will not be loaded." +msgstr "Nadgradite libpurple za podporo RC4 (>= 2.0.1). Vtičnik MySpaceIM se ne bo naložil." msgid "Add friends from MySpace.com" msgstr "Dodaj prijatelje z MySpace.com" @@ -6614,8 +6208,7 @@ msgid "myim URL handler" msgstr "Upravljač za URL-je \"myim\"" msgid "No suitable MySpaceIM account could be found to open this myim URL." -msgstr "" -"Za odpiranje tega URL-ja myim ni mogoče najti ustreznega računa MySpaceIM." +msgstr "Za odpiranje tega URL-ja myim ni mogoče najti ustreznega računa MySpaceIM." msgid "Enable the proper MySpaceIM account and try again." msgstr "Omogoči pravi račun MySpaceIM in poskusi znova." @@ -6635,29 +6228,31 @@ msgstr "Ločljivost zaslona (točk na palec)" msgid "Base font size (points)" msgstr "Osnovna velikost pisave (točke)" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User" msgstr "Uporabnik" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Headline" msgstr "Naslov" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Song" msgstr "Skladba" msgid "Total Friends" msgstr "Skupno prijateljev" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Client Version" msgstr "Različica odjemalca" -msgid "" -"An error occurred while trying to set the username. Please try again, or " -"visit http://editprofile.myspace.com/index.cfm?fuseaction=profile.username " -"to set your username." -msgstr "" -"Pri nastavljanju uporabniškega imena je prišlo do napake. Poskusite znova " -"ali obiščite http://editprofile.myspace.com/index.cfm?fuseaction=profile." -"username in nastavite svoje uporabniško ime." +msgid "An error occurred while trying to set the username. Please try again, or visit http://editprofile.myspace.com/index.cfm?fuseaction=profile.username to set your username." +msgstr "Pri nastavljanju uporabniškega imena je prišlo do napake. Poskusite znova ali obiščite http://editprofile.myspace.com/index.cfm?fuseaction=profile.username in nastavite svoje uporabniško ime." msgid "MySpaceIM - Username Available" msgstr "MySpaceIM - Uporabniško ime je na voljo" @@ -6848,9 +6443,6 @@ msgstr "Ni podprto" msgid "Password has expired" msgstr "Geslo je poteklo" -msgid "Incorrect password" -msgstr "Neveljavno geslo" - msgid "Account has been disabled" msgstr "Račun je bil onemogočen" @@ -6875,11 +6467,6 @@ msgstr "Glavni arhiv je narobe nastavljen" msgid "Could not recognize the host of the username you entered" msgstr "Gostitelja uporabniškega imena, ki ste ga vnesli, ni mogoče prepoznati" -msgid "" -"Your account has been disabled because too many incorrect passwords were " -"entered" -msgstr "Vaš račun je bil onemogočen, ker ste vnesli preveč napačnih gesel" - msgid "You cannot add the same person twice to a conversation" msgstr "Iste osebe ne morete dvakrat dodati pomenku" @@ -6898,12 +6485,8 @@ msgstr "Nezdružljiva različica protokola" msgid "The user has blocked you" msgstr "Uporabnik vas je zavrnil" -msgid "" -"This evaluation version does not allow more than ten users to log in at one " -"time" -msgstr "" -"Ta preskusna različica ne dovoljuje prijave več kot desetim uporabnikom " -"hkrati" +msgid "This evaluation version does not allow more than ten users to log in at one time" +msgstr "Ta preskusna različica ne dovoljuje prijave več kot desetim uporabnikom hkrati" msgid "The user is either offline or you are blocked" msgstr "Uporabnike ni na zvezi ali pa ste zavrnjeni" @@ -6918,8 +6501,7 @@ msgstr "Prijava ni uspela: %s" #, c-format msgid "Unable to send message. Could not get details for user (%s)." -msgstr "" -"Sporočila ni mogoče poslati. Ni mogoče dobiti podrobnosti za uporabnika (%s)." +msgstr "Sporočila ni mogoče poslati. Ni mogoče dobiti podrobnosti za uporabnika (%s)." #, c-format msgid "Unable to add %s to your buddy list (%s)." @@ -6943,20 +6525,12 @@ msgid "Unable to send message. Could not create the conference (%s)." msgstr "Sporočila ni bilo moč poslati. Ni mogoče ustvariti konference (%s)." #, c-format -msgid "" -"Unable to move user %s to folder %s in the server side list. Error while " -"creating folder (%s)." -msgstr "" -"Uporabnika %s ni mogoče premakniti v mapo %s na seznamu nedejavnih na " -"strežniku. Napaka pri usvarjanju mape (%s)." +msgid "Unable to move user %s to folder %s in the server side list. Error while creating folder (%s)." +msgstr "Uporabnika %s ni mogoče premakniti v mapo %s na seznamu nedejavnih na strežniku. Napaka pri usvarjanju mape (%s)." #, c-format -msgid "" -"Unable to add %s to your buddy list. Error creating folder in server side " -"list (%s)." -msgstr "" -"Ni bilo moč dodati %s na vaš seznam prijateljev. Napaka pri ustvarjanju mape " -"na strežniku (%s)." +msgid "Unable to add %s to your buddy list. Error creating folder in server side list (%s)." +msgstr "Ni bilo moč dodati %s na vaš seznam prijateljev. Napaka pri ustvarjanju mape na strežniku (%s)." #, c-format msgid "Could not get details for user %s (%s)." @@ -7001,12 +6575,10 @@ msgstr "StojPošta" msgid "User ID" msgstr "Uporabniška št." -#. tag = _("DN"); -#. value = nm_user_record_get_dn(user_record); -#. if (value) { -#. purple_notify_user_info_add_pair(user_info, tag, value); -#. } -#. +#, fuzzy +msgid "DN" +msgstr "DN" + msgid "Full name" msgstr "Polno ime" @@ -7041,16 +6613,11 @@ msgid "Would you like to join the conversation?" msgstr "Se želite pridružiti pomenku?" #, c-format -msgid "" -"%s appears to be offline and did not receive the message that you just sent." +msgid "%s appears to be offline and did not receive the message that you just sent." msgstr "%s ni na zvezi in ni sprejel sporočila, ki ste ga pravkar poslali." -msgid "" -"Unable to connect to server. Please enter the address of the server to which " -"you wish to connect." -msgstr "" -"Ni se mogoče povezati na strežnik. Vnesite naslov strežnika, na katerega se " -"želite povezati." +msgid "Unable to connect to server. Please enter the address of the server to which you wish to connect." +msgstr "Ni se mogoče povezati na strežnik. Vnesite naslov strežnika, na katerega se želite povezati." msgid "This conference has been closed. No more messages can be sent." msgstr "Ta konferenca je bila zaprta. Spročil se ne da pošiljati več.več." @@ -7097,19 +6664,11 @@ msgstr "Prejet nepričakovan odgovor s strani osebe %s: %s" msgid "Received unexpected response from %s" msgstr "Prejet nepričakovan odgovor s strani osebe %s" -msgid "" -"You have been connecting and disconnecting too frequently. Wait ten minutes " -"and try again. If you continue to try, you will need to wait even longer." -msgstr "" -"Povezava ste prevečkrat vzpostavili in prekinili. Počakajte deset minut in " -"poskusite ponovno. Če ne počakate sedaj, boste čakali še dalj." +msgid "You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer." +msgstr "Povezava ste prevečkrat vzpostavili in prekinili. Počakajte deset minut in poskusite ponovno. Če ne počakate sedaj, boste čakali še dalj." -msgid "" -"You required encryption in your account settings, but one of the servers " -"doesn't support it." -msgstr "" -"Zahtevali ste šifriranje za nastavitve svojih računov, vendar eden od " -"strežnikov šifriranja ne podpira." +msgid "You required encryption in your account settings, but one of the servers doesn't support it." +msgstr "Zahtevali ste šifriranje za nastavitve svojih računov, vendar eden od strežnikov šifriranja ne podpira." #. Note to translators: The first %s is a URL, the second is an #. error message. @@ -7120,36 +6679,18 @@ msgstr "Napaka pri zahtevanju %s: %s" msgid "The server returned an empty response" msgstr "Strežnik je vrnil prazen odgovor" -msgid "" -"Server requested that you fill out a CAPTCHA in order to sign in, but this " -"client does not currently support CAPTCHAs." -msgstr "" -"Strežnik zahteva, da za vpis prepišete besedilo s slike, vendar ta odjemalec " -"trenutno le-tega še ne podpira." +msgid "Server requested that you fill out a CAPTCHA in order to sign in, but this client does not currently support CAPTCHAs." +msgstr "Strežnik zahteva, da za vpis prepišete besedilo s slike, vendar ta odjemalec trenutno le-tega še ne podpira." msgid "AOL does not allow your screen name to authenticate here" -msgstr "" -"AOL ne dovoljuje, da bi se vaše pojavno ime overjalo prek tega spletnega " -"mesta" +msgstr "AOL ne dovoljuje, da bi se vaše pojavno ime overjalo prek tega spletnega mesta" -msgid "" -"(There was an error receiving this message. The buddy you are speaking with " -"is probably using a different encoding than expected. If you know what " -"encoding he is using, you can specify it in the advanced account options for " -"your AIM/ICQ account.)" -msgstr "" -"(Pri sprejemu tega sporočila je prišlo do napake. Prijatelj, s katerim se " -"pogovarjate, je najbrž uporabil drugo kodiranje od pričakovanega. Če veste, " -"za katero kodiranje gre, ga lahko navedete v naprednih možnostih nastavitev " -"svojega računa AIM/ICQ.)" +msgid "(There was an error receiving this message. The buddy you are speaking with is probably using a different encoding than expected. If you know what encoding he is using, you can specify it in the advanced account options for your AIM/ICQ account.)" +msgstr "(Pri sprejemu tega sporočila je prišlo do napake. Prijatelj, s katerim se pogovarjate, je najbrž uporabil drugo kodiranje od pričakovanega. Če veste, za katero kodiranje gre, ga lahko navedete v naprednih možnostih nastavitev svojega računa AIM/ICQ.)" #, c-format -msgid "" -"(There was an error receiving this message. Either you and %s have " -"different encodings selected, or %s has a buggy client.)" -msgstr "" -"(Pri prejemu tega sporočila je prišlo do napake. Vi in %s imata izbrane " -"različni kodni strani ali pa ima %s hroščavega odjemalca.)" +msgid "(There was an error receiving this message. Either you and %s have different encodings selected, or %s has a buggy client.)" +msgstr "(Pri prejemu tega sporočila je prišlo do napake. Vi in %s imata izbrane različni kodni strani ali pa ima %s hroščavega odjemalca.)" msgid "Could not join chat room" msgstr "Pogovorni sobi se ni mogoče pridružiti" @@ -7354,13 +6895,8 @@ msgid "Direct IM established" msgstr "Vzpostavljeno neposredno sporočanje" #, c-format -msgid "" -"%s tried to send you a %s file, but we only allow files up to %s over Direct " -"IM. Try using file transfer instead.\n" -msgstr "" -"Uporabnik %s vam je želel poslati datoteko %s, vendar dovoljujemo le prenos " -"datotek do velikosti %s prek neposrednih sporočil. Poskusite raje s " -"funkcijo prenosa datotek.\n" +msgid "%s tried to send you a %s file, but we only allow files up to %s over Direct IM. Try using file transfer instead.\n" +msgstr "Uporabnik %s vam je želel poslati datoteko %s, vendar dovoljujemo le prenos datotek do velikosti %s prek neposrednih sporočil. Poskusite raje s funkcijo prenosa datotek.\n" #, c-format msgid "File %s is %s, which is larger than the maximum size of %s." @@ -7415,28 +6951,15 @@ msgid "Finalizing connection" msgstr "Dokončujem povezavo" #, c-format -msgid "" -"Unable to sign on as %s because the username is invalid. Usernames must be " -"a valid email address, or start with a letter and contain only letters, " -"numbers and spaces, or contain only numbers." -msgstr "" -"Prijava ni mogoča: ni se mogoče prijaviti kot %s, ker je uporabniško ime " -"neveljavno. Imena morajo biti veljaven e-poštni naslov ali se morajo začeti " -"s črko in lahko vsebujejo le črke, številke in presledke ali pa so " -"sestavljena zgolj iz števil." +msgid "Unable to sign on as %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers." +msgstr "Prijava ni mogoča: ni se mogoče prijaviti kot %s, ker je uporabniško ime neveljavno. Imena morajo biti veljaven e-poštni naslov ali se morajo začeti s črko in lahko vsebujejo le črke, številke in presledke ali pa so sestavljena zgolj iz števil." -msgid "" -"You required encryption in your account settings, but encryption is not " -"supported by your system." -msgstr "" -"Zahtevali ste šifriranje za nastavitve svojih računov, vendar vaš sistem " -"šifriranja ne podpira." +msgid "You required encryption in your account settings, but encryption is not supported by your system." +msgstr "Zahtevali ste šifriranje za nastavitve svojih računov, vendar vaš sistem šifriranja ne podpira." #, c-format msgid "You may be disconnected shortly. If so, check %s for updates." -msgstr "" -"Morda bo povezava v kratkem prekinjena. V tem primeru preverite %s za " -"posodobitve." +msgstr "Morda bo povezava v kratkem prekinjena. V tem primeru preverite %s za posodobitve." msgid "Unable to get a valid AIM login hash." msgstr "Veljavnega prijavnega izvlečka za AIM ni mogoče pridobiti." @@ -7461,29 +6984,17 @@ msgid "The AOL Instant Messenger service is temporarily unavailable." msgstr "Storitev AOL neposrednih sporočil je trenuno nedosegljiva." #. username connecting too frequently -msgid "" -"Your username has been connecting and disconnecting too frequently. Wait ten " -"minutes and try again. If you continue to try, you will need to wait even " -"longer." -msgstr "" -"Povezava ste prevečkrat vzpostavili in prekinili. Počakajte deset minut in " -"poskusite znova. Če ne počakate sedaj, boste čakali še dlje." +msgid "Your username has been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer." +msgstr "Povezava ste prevečkrat vzpostavili in prekinili. Počakajte deset minut in poskusite znova. Če ne počakate sedaj, boste čakali še dlje." #. client too old #, c-format msgid "The client version you are using is too old. Please upgrade at %s" -msgstr "" -"Različica odjemalca, ki ga uporabljate, je prestara. Prosim posodobite ga " -"pri %s" +msgstr "Različica odjemalca, ki ga uporabljate, je prestara. Prosim posodobite ga pri %s" #. IP address connecting too frequently -msgid "" -"Your IP address has been connecting and disconnecting too frequently. Wait a " -"minute and try again. If you continue to try, you will need to wait even " -"longer." -msgstr "" -"Povezava ste prevečkrat vzpostavili in prekinili. Počakajte minutko in " -"poskusite znova. Če ne počakate sedaj, boste čakali še dlje." +msgid "Your IP address has been connecting and disconnecting too frequently. Wait a minute and try again. If you continue to try, you will need to wait even longer." +msgstr "Povezava ste prevečkrat vzpostavili in prekinili. Počakajte minutko in poskusite znova. Če ne počakate sedaj, boste čakali še dlje." msgid "The SecurID key entered is invalid" msgstr "Vneseni ključ SecurID ni veljaven" @@ -7502,12 +7013,10 @@ msgstr "Povezave ni mogoče inicializirati" #, c-format msgid "" -"The user %u has denied your request to add them to your buddy list for the " -"following reason:\n" +"The user %u has denied your request to add them to your buddy list for the following reason:\n" "%s" msgstr "" -"Uporabnik %u je zavrnil zahtevo, da bi ga dodali na svoj seznam prijateljev " -"z naslednjim razlogom:\n" +"Uporabnik %u je zavrnil zahtevo, da bi ga dodali na svoj seznam prijateljev z naslednjim razlogom:\n" "%s" msgid "ICQ authorization denied." @@ -7584,45 +7093,28 @@ msgstr[2] "Spregledali ste %hu sporočili od %s, ker sta bili neveljavni." msgstr[3] "Spregledali ste %hu sporočila od %s, ker so bila neveljavna." #, c-format -msgid "" -"You missed %hu message from %s because the rate limit has been exceeded." -msgid_plural "" -"You missed %hu messages from %s because the rate limit has been exceeded." +msgid "You missed %hu message from %s because the rate limit has been exceeded." +msgid_plural "You missed %hu messages from %s because the rate limit has been exceeded." msgstr[0] "Spregledali ste %hu sporočil od %s, ker so bila neveljavna." msgstr[1] "Spregledali ste %hu sporočilo od %s, ker je bilo neveljavno." msgstr[2] "Spregledali ste %hu sporočili od %s, ker sta bili neveljavni." msgstr[3] "Spregledali ste %hu sporočila od %s, ker so bila neveljavna." #, c-format -msgid "" -"You missed %hu message from %s because his/her warning level is too high." -msgid_plural "" -"You missed %hu messages from %s because his/her warning level is too high." -msgstr[0] "" -"Spregledali ste %hu sporočil od %s, ker je njegova/njena raven opozoril " -"previsoka." -msgstr[1] "" -"Spregledali ste %hu sporočilo od %s, ker je njegova/njena raven opozoril " -"previsoka." -msgstr[2] "" -"Spregledali ste %hu sporočili od %s, ker je njegova/njena raven opozoril " -"previsoka." -msgstr[3] "" -"Spregledali ste %hu sporočila od %s, ker je njegova/njena raven opozoril " -"previsoka." +msgid "You missed %hu message from %s because his/her warning level is too high." +msgid_plural "You missed %hu messages from %s because his/her warning level is too high." +msgstr[0] "Spregledali ste %hu sporočil od %s, ker je njegova/njena raven opozoril previsoka." +msgstr[1] "Spregledali ste %hu sporočilo od %s, ker je njegova/njena raven opozoril previsoka." +msgstr[2] "Spregledali ste %hu sporočili od %s, ker je njegova/njena raven opozoril previsoka." +msgstr[3] "Spregledali ste %hu sporočila od %s, ker je njegova/njena raven opozoril previsoka." #, c-format msgid "You missed %hu message from %s because your warning level is too high." -msgid_plural "" -"You missed %hu messages from %s because your warning level is too high." -msgstr[0] "" -"Spregledali ste %hu sporočil od %s, ker je vaša raven opozoril previsoka." -msgstr[1] "" -"Spregledali ste %hu sporočilo od %s, ker je vaša raven opozoril previsoka." -msgstr[2] "" -"Spregledali ste %hu sporočili od %s, ker je vaša raven opozoril previsoka." -msgstr[3] "" -"Spregledali ste %hu sporočila od %s, ker je vaša raven opozoril previsoka." +msgid_plural "You missed %hu messages from %s because your warning level is too high." +msgstr[0] "Spregledali ste %hu sporočil od %s, ker je vaša raven opozoril previsoka." +msgstr[1] "Spregledali ste %hu sporočilo od %s, ker je vaša raven opozoril previsoka." +msgstr[2] "Spregledali ste %hu sporočili od %s, ker je vaša raven opozoril previsoka." +msgstr[3] "Spregledali ste %hu sporočila od %s, ker je vaša raven opozoril previsoka." #, c-format msgid "You missed %hu message from %s for an unknown reason." @@ -7643,9 +7135,7 @@ msgid "The new formatting is invalid." msgstr "Oblika novega zapisa je neveljavna." msgid "Username formatting can change only capitalization and whitespace." -msgstr "" -"Z oblikovanjem uporabniškega imena lahko spreminjate samo velike črke in " -"presledke." +msgstr "Z oblikovanjem uporabniškega imena lahko spreminjate samo velike črke in presledke." msgid "Pop-Up Message" msgstr "Pojavno sporočilo" @@ -7670,50 +7160,28 @@ msgid "Account Confirmation Requested" msgstr "Potrditev računa je bila zahtevana" #, c-format -msgid "" -"Error 0x%04x: Unable to format username because the requested name differs " -"from the original." -msgstr "" -"Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker se " -"zahtevano ime razlikuje od izvirnega." +msgid "Error 0x%04x: Unable to format username because the requested name differs from the original." +msgstr "Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker se zahtevano ime razlikuje od izvirnega." #, c-format msgid "Error 0x%04x: Unable to format username because it is invalid." -msgstr "" -"Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker je " -"neveljavno." +msgstr "Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker je neveljavno." #, c-format -msgid "" -"Error 0x%04x: Unable to format username because the requested name is too " -"long." -msgstr "" -"Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker je " -"zahtevano ime predolgo." +msgid "Error 0x%04x: Unable to format username because the requested name is too long." +msgstr "Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker je zahtevano ime predolgo." #, c-format -msgid "" -"Error 0x%04x: Unable to change email address because there is already a " -"request pending for this username." -msgstr "" -"Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker je na čakanju za to " -"uporabniško ime že en zahtevek." +msgid "Error 0x%04x: Unable to change email address because there is already a request pending for this username." +msgstr "Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker je na čakanju za to uporabniško ime že en zahtevek." #, c-format -msgid "" -"Error 0x%04x: Unable to change email address because the given address has " -"too many usernames associated with it." -msgstr "" -"Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker ima podani naslov že " -"preveč računov." +msgid "Error 0x%04x: Unable to change email address because the given address has too many usernames associated with it." +msgstr "Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker ima podani naslov že preveč računov." #, c-format -msgid "" -"Error 0x%04x: Unable to change email address because the given address is " -"invalid." -msgstr "" -"Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker je podani naslov " -"neveljaven." +msgid "Error 0x%04x: Unable to change email address because the given address is invalid." +msgstr "Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker je podani naslov neveljaven." #, c-format msgid "Error 0x%04x: Unknown error." @@ -7729,98 +7197,50 @@ msgstr "Elektronski naslov za %s je %s" msgid "Account Info" msgstr "Podatki o računu" -msgid "" -"Your IM Image was not sent. You must be Direct Connected to send IM Images." -msgstr "" -"Vaša slika IM ni bila poslana. Za pošiljanje slik IM morate biti " -"\"neposredno povezani\"." +msgid "Your IM Image was not sent. You must be Direct Connected to send IM Images." +msgstr "Vaša slika IM ni bila poslana. Za pošiljanje slik IM morate biti \"neposredno povezani\"." msgid "Unable to set AIM profile." msgstr "Ni mogoče nastaviti AIM profila." -msgid "" -"You have probably requested to set your profile before the login procedure " -"completed. Your profile remains unset; try setting it again when you are " -"fully connected." -msgstr "" -"Verjetno ste zahtevali, da spremenite svoj profil preden je bila prijava " -"dokončana. Za zdaj je vaš profil nespremenjen; poskusite ponovno, ko boste " -"zagotovo prijavljeni." +msgid "You have probably requested to set your profile before the login procedure completed. Your profile remains unset; try setting it again when you are fully connected." +msgstr "Verjetno ste zahtevali, da spremenite svoj profil preden je bila prijava dokončana. Za zdaj je vaš profil nespremenjen; poskusite ponovno, ko boste zagotovo prijavljeni." #, c-format -msgid "" -"The maximum profile length of %d byte has been exceeded. It has been " -"truncated for you." -msgid_plural "" -"The maximum profile length of %d bytes has been exceeded. It has been " -"truncated for you." -msgstr[0] "" -"Največja dolžina profila %d bajtov je bila presežena, zato je bil skrajšan." -msgstr[1] "" -"Največja dolžina profila %d bajt je bila presežena, zato je bil skrajšan." -msgstr[2] "" -"Največja dolžina profila %d bajta je bila presežena, zato je bil skrajšan." -msgstr[3] "" -"Največja dolžina profila %d bajte je bila presežena, zato je bil skrajšan." +msgid "The maximum profile length of %d byte has been exceeded. It has been truncated for you." +msgid_plural "The maximum profile length of %d bytes has been exceeded. It has been truncated for you." +msgstr[0] "Največja dolžina profila %d bajtov je bila presežena, zato je bil skrajšan." +msgstr[1] "Največja dolžina profila %d bajt je bila presežena, zato je bil skrajšan." +msgstr[2] "Največja dolžina profila %d bajta je bila presežena, zato je bil skrajšan." +msgstr[3] "Največja dolžina profila %d bajte je bila presežena, zato je bil skrajšan." msgid "Profile too long." msgstr "Profil je predolg." #, c-format -msgid "" -"The maximum away message length of %d byte has been exceeded. It has been " -"truncated for you." -msgid_plural "" -"The maximum away message length of %d bytes has been exceeded. It has been " -"truncated for you." -msgstr[0] "" -"Največja dolžina sporočila odsotnosti %d bajtov je bila presežena, zato je " -"bilo sporočilo skrajšano." -msgstr[1] "" -"Največja dolžina sporočila odsotnosti %d bajt je bila presežena, zato je " -"bilo sporočilo skrajšano." -msgstr[2] "" -"Največja dolžina sporočila odsotnosti %d bajta je bila presežena, zato je " -"bilo sporočilo skrajšano." -msgstr[3] "" -"Največja dolžina sporočila odsotnosti %d bajte je bila presežena, zato je " -"bilo sporočilo skrajšano." +msgid "The maximum away message length of %d byte has been exceeded. It has been truncated for you." +msgid_plural "The maximum away message length of %d bytes has been exceeded. It has been truncated for you." +msgstr[0] "Največja dolžina sporočila odsotnosti %d bajtov je bila presežena, zato je bilo sporočilo skrajšano." +msgstr[1] "Največja dolžina sporočila odsotnosti %d bajt je bila presežena, zato je bilo sporočilo skrajšano." +msgstr[2] "Največja dolžina sporočila odsotnosti %d bajta je bila presežena, zato je bilo sporočilo skrajšano." +msgstr[3] "Največja dolžina sporočila odsotnosti %d bajte je bila presežena, zato je bilo sporočilo skrajšano." msgid "Away message too long." msgstr "Spo_ročilo o odsotnosti:" #, c-format -msgid "" -"Unable to add the buddy %s because the username is invalid. Usernames must " -"be a valid email address, or start with a letter and contain only letters, " -"numbers and spaces, or contain only numbers." -msgstr "" -"Ni mogoče dodati prijatelja %s, ker uporabniško ime ni veljavno. Imena so " -"lahko veljavni e-poštni naslovi ali pa se morajo začeti s črko, vsebujejo " -"lahko le črke, številke in presledke, lahko pa so tudi sestavljena iz samih " -"števil." +msgid "Unable to add the buddy %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers." +msgstr "Ni mogoče dodati prijatelja %s, ker uporabniško ime ni veljavno. Imena so lahko veljavni e-poštni naslovi ali pa se morajo začeti s črko, vsebujejo lahko le črke, številke in presledke, lahko pa so tudi sestavljena iz samih števil." msgid "Unable to Retrieve Buddy List" msgstr "Seznama prijateljev ni bilo mogoče pridobiti" -msgid "" -"The AIM servers were temporarily unable to send your buddy list. Your buddy " -"list is not lost, and will probably become available in a few minutes." -msgstr "" -"Strežniki AIM trenutno niso bili zmožni poslati seznama vaših prijateljev. " -"Vaš seznam prijateljev ni izgubljen, verjetno pa bo postal dosegljiv v nekaj " -"urah." - -msgid "Orphans" -msgstr "Sirote" +msgid "The AIM servers were temporarily unable to send your buddy list. Your buddy list is not lost, and will probably become available in a few minutes." +msgstr "Strežniki AIM trenutno niso bili zmožni poslati seznama vaših prijateljev. Vaš seznam prijateljev ni izgubljen, verjetno pa bo postal dosegljiv v nekaj urah." #, c-format -msgid "" -"Unable to add the buddy %s because you have too many buddies in your buddy " -"list. Please remove one and try again." -msgstr "" -"Prijatelja %s ni bilo mogoče dodati, ker imate na seznamu preveč " -"prijateljev. Prosimo, odstranite enega in poskusite ponovno." +msgid "Unable to add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again." +msgstr "Prijatelja %s ni bilo mogoče dodati, ker imate na seznamu preveč prijateljev. Prosimo, odstranite enega in poskusite ponovno." msgid "(no name)" msgstr "(brez imena)" @@ -7830,12 +7250,8 @@ msgid "Unable to add the buddy %s for an unknown reason." msgstr "Iz neznanega razloga prijatelja %s ni mogoče dodati." #, c-format -msgid "" -"The user %s has given you permission to add him or her to your buddy list. " -"Do you want to add this user?" -msgstr "" -"Uporabnik %s vam je dovolil, da ga dodate na svoj seznam prijateljev. Ali ga " -"želite dodati?" +msgid "The user %s has given you permission to add him or her to your buddy list. Do you want to add this user?" +msgstr "Uporabnik %s vam je dovolil, da ga dodate na svoj seznam prijateljev. Ali ga želite dodati?" msgid "Authorization Given" msgstr "Pooblastilo odobreno" @@ -7843,8 +7259,7 @@ msgstr "Pooblastilo odobreno" #. Granted #, c-format msgid "The user %s has granted your request to add them to your buddy list." -msgstr "" -"Uporabnik %s je odobril zahtevo, da ga dodate na svoj seznam prijateljev." +msgstr "Uporabnik %s je odobril zahtevo, da ga dodate na svoj seznam prijateljev." msgid "Authorization Granted" msgstr "Pooblastilo odobreno" @@ -7852,12 +7267,10 @@ msgstr "Pooblastilo odobreno" #. Denied #, c-format msgid "" -"The user %s has denied your request to add them to your buddy list for the " -"following reason:\n" +"The user %s has denied your request to add them to your buddy list for the following reason:\n" "%s" msgstr "" -"Uporabnik %s je zavrnil vašo zahtevo, da ga dodate na svoj seznam " -"prijateljev, ker:\n" +"Uporabnik %s je zavrnil vašo zahtevo, da ga dodate na svoj seznam prijateljev, ker:\n" "%s" msgid "Authorization Denied" @@ -7867,8 +7280,7 @@ msgid "_Exchange:" msgstr "_Izmenjaj:" msgid "Your IM Image was not sent. You cannot send IM Images in AIM chats." -msgstr "" -"Vaša slika IM ni bila poslana. Slik IM ne morete pošiljati v klepetih AIM." +msgstr "Vaša slika IM ni bila poslana. Slik IM ne morete pošiljati v klepetih AIM." msgid "iTunes Music Store Link" msgstr "Povezava na glasbeno trgovino iTunes" @@ -7887,12 +7299,8 @@ msgstr "Komentar prijatelja:" msgid "You have selected to open a Direct IM connection with %s." msgstr "Izbrali ste neposredno povezovanje z %s." -msgid "" -"Because this reveals your IP address, it may be considered a security risk. " -"Do you wish to continue?" -msgstr "" -"Ker razkrije vaš naslov IP, lahko velja za kršitev zasebnosti. Želite " -"nadaljevati?" +msgid "Because this reveals your IP address, it may be considered a security risk. Do you wish to continue?" +msgstr "Ker razkrije vaš naslov IP, lahko velja za kršitev zasebnosti. Želite nadaljevati?" msgid "C_onnect" msgstr "Po_veži se" @@ -7937,12 +7345,8 @@ msgstr "ne čakate na pooblastilo" msgid "You are awaiting authorization from the following buddies" msgstr "Pričakujete pooblastila od naslednjih prijateljev" -msgid "" -"You can re-request authorization from these buddies by right-clicking on " -"them and selecting \"Re-request Authorization.\"" -msgstr "" -"Če želite, lahko ponovno zahtevate pooblastilo od teh prijateljev, tako da " -"desno kliknete na njih in izberete \"Ponovno zahtevaj pooblastilo.\"" +msgid "You can re-request authorization from these buddies by right-clicking on them and selecting \"Re-request Authorization.\"" +msgstr "Če želite, lahko ponovno zahtevate pooblastilo od teh prijateljev, tako da desno kliknete na njih in izberete \"Ponovno zahtevaj pooblastilo.\"" msgid "Find Buddy by Email" msgstr "Najdi prijatelja po e-pošti" @@ -8019,14 +7423,8 @@ msgstr "Poskus povezave prek strežnika-prehoda." msgid "%s has just asked to directly connect to %s" msgstr "%s vas je ravnokar prosil za neposredno povezavo na %s" -msgid "" -"This requires a direct connection between the two computers and is necessary " -"for IM Images. Because your IP address will be revealed, this may be " -"considered a privacy risk." -msgstr "" -"To zahteva neposredno povezavo med dvema računalnikoma in je nujno potrebno " -"za sporočanje s slikami. Ker bo razkrit naslov IP, sodi ta povezava med " -"tveganja zasebnosti." +msgid "This requires a direct connection between the two computers and is necessary for IM Images. Because your IP address will be revealed, this may be considered a privacy risk." +msgstr "To zahteva neposredno povezavo med dvema računalnikoma in je nujno potrebno za sporočanje s slikami. Ker bo razkrit naslov IP, sodi ta povezava med tveganja zasebnosti." #. Label msgid "Buddy Icon" @@ -8114,6 +7512,7 @@ msgstr "Podatki o uporabniku niso dostopni: %s" msgid "Mobile Phone" msgstr "Mobilni telefon" +#. TODO: Is it correct to pass info->email here...? msgid "Personal Web Page" msgstr "Osebna spletna stran" @@ -8134,6 +7533,7 @@ msgstr "Oddelek" msgid "Position" msgstr "Delovno mesto" +#. TODO: Is it correct to pass info->email here...? msgid "Web Page" msgstr "Spletna stran" @@ -8244,19 +7644,14 @@ msgid "you have no buddies on this list" msgstr "na tem seznamu nimate prijateljev" #, c-format -msgid "" -"You can add a buddy to this list by right-clicking on them and selecting \"%s" -"\"" -msgstr "" -"Na ta seznam lahko dodate prijatelja, tako da desno kliknete nanj in " -"izberete \"%s\"" +msgid "You can add a buddy to this list by right-clicking on them and selecting \"%s\"" +msgstr "Na ta seznam lahko dodate prijatelja, tako da desno kliknete nanj in izberete \"%s\"" msgid "Visible List" msgstr "Seznam vidnih" msgid "These buddies will see your status when you switch to \"Invisible\"" -msgstr "" -"Ti prijatelji bodo vedno videli vaše stanje, ko preklopite na \"Neviden\"" +msgstr "Ti prijatelji bodo vedno videli vaše stanje, ko preklopite na \"Neviden\"" msgid "Invisible List" msgstr "Seznam nevidnih" @@ -8310,10 +7705,8 @@ msgid "Starting Services" msgstr "Zagon storitev" #, c-format -msgid "" -"A Sametime administrator has issued the following announcement on server %s" -msgstr "" -"Upravljalec omrežja Sametime je izdal naslednje obvestilo na strežniku %s" +msgid "A Sametime administrator has issued the following announcement on server %s" +msgstr "Upravljalec omrežja Sametime je izdal naslednje obvestilo na strežniku %s" msgid "Sametime Administrator Announcement" msgstr "Upravljalsko obvestilo Sametime" @@ -8358,9 +7751,7 @@ msgid "Create conference with user" msgstr "Ustvari konferenčni pogovor z uporabnikom" #, c-format -msgid "" -"Please enter a topic for the new conference, and an invitation message to be " -"sent to %s" +msgid "Please enter a topic for the new conference, and an invitation message to be sent to %s" msgstr "Vnesite temo za nov konferenčni pogovor in sporočilo vabila za %s" msgid "New Conference" @@ -8379,14 +7770,8 @@ msgid "Invite user to a conference" msgstr "Povabi uporabnika na konferenčni pogovor" #, c-format -msgid "" -"Select a conference from the list below to send an invite to user %s. Select " -"\"Create New Conference\" if you'd like to create a new conference to invite " -"this user to." -msgstr "" -"Iz spodnjega seznama izberite konferenco in pošljite povabilo uporabniku %s. " -"Izberite \"Ustvari novo konferenco\", če bi želeli ustvariti novo konferenco " -"in k njej povabili uporabnika." +msgid "Select a conference from the list below to send an invite to user %s. Select \"Create New Conference\" if you'd like to create a new conference to invite this user to." +msgstr "Iz spodnjega seznama izberite konferenco in pošljite povabilo uporabniku %s. Izberite \"Ustvari novo konferenco\", če bi želeli ustvariti novo konferenco in k njej povabili uporabnika." msgid "Invite to Conference" msgstr "Povabi na konferenčni pogovor" @@ -8400,33 +7785,16 @@ msgstr "Pošlji obvestilo TEST" msgid "Topic:" msgstr "Tema:" -msgid "No Sametime Community Server specified" -msgstr "Strežnik Sametime Community ni naveden" - -#, c-format -msgid "" -"No host or IP address has been configured for the Meanwhile account %s. " -"Please enter one below to continue logging in." -msgstr "" -"Za račun Meanwhile %s ni bil nastavljen noben gostitelj ali naslov IP. Za " -"nadaljevanje prijave vnesite spodaj potrebne podatke. " - -msgid "Meanwhile Connection Setup" -msgstr "Namestitev povezave Meanwhile" - -msgid "No Sametime Community Server Specified" -msgstr "Strežnik Sametime Community ni naveden" +msgid "A server is required to connect this account" +msgstr "Za povezavo tega računa je potreben strežnik" -msgid "Connect" -msgstr "Poveži se" +msgid "Last Known Client" +msgstr "Nazadnje znani odjemalec" #, c-format msgid "Unknown (0x%04x)
    " msgstr "Neznano (0x%04x)
    " -msgid "Last Known Client" -msgstr "Nazadnje znani odjemalec" - msgid "User Name" msgstr "Uporabniško ime" @@ -8437,12 +7805,8 @@ msgid "An ambiguous user ID was entered" msgstr "Vnesli ste dvoumen uporabniški ID" #, c-format -msgid "" -"The identifier '%s' may possibly refer to any of the following users. Please " -"select the correct user from the list below to add them to your buddy list." -msgstr "" -"Imenovalec '%s' se morda nanaša na vse naštete uporabnike. Izberite " -"ustreznega in ga dodajte na seznam prijateljev." +msgid "The identifier '%s' may possibly refer to any of the following users. Please select the correct user from the list below to add them to your buddy list." +msgstr "Imenovalec '%s' se morda nanaša na vse naštete uporabnike. Izberite ustreznega in ga dodajte na seznam prijateljev." msgid "Select User" msgstr "Izberite uporabnika" @@ -8451,12 +7815,8 @@ msgid "Unable to add user: user not found" msgstr "Ni moč dodati uporabnika: ni ga mogoče najti" #, c-format -msgid "" -"The identifier '%s' did not match any users in your Sametime community. This " -"entry has been removed from your buddy list." -msgstr "" -"Imenovalec '%s' se ne ujema z nobenim uporabnikom v vaši skupnosti Sametime. " -"Ta vnos je bil odstranjen iz vašega seznama prijateljev." +msgid "The identifier '%s' did not match any users in your Sametime community. This entry has been removed from your buddy list." +msgstr "Imenovalec '%s' se ne ujema z nobenim uporabnikom v vaši skupnosti Sametime. Ta vnos je bil odstranjen iz vašega seznama prijateljev." #, c-format msgid "" @@ -8509,14 +7869,8 @@ msgid "Notes Address Book group results" msgstr "Skupinski rezultati adresarjev zapiskov" #, c-format -msgid "" -"The identifier '%s' may possibly refer to any of the following Notes Address " -"Book groups. Please select the correct group from the list below to add it " -"to your buddy list." -msgstr "" -"Imenovalec '%s' se morda nanaša na eno od naslednjih skupin adresarjev " -"zapiskov. Izberite pravo skupino s spodnjega seznama in ga dodajte v svoj " -"seznam prijateljev." +msgid "The identifier '%s' may possibly refer to any of the following Notes Address Book groups. Please select the correct group from the list below to add it to your buddy list." +msgstr "Imenovalec '%s' se morda nanaša na eno od naslednjih skupin adresarjev zapiskov. Izberite pravo skupino s spodnjega seznama in ga dodajte v svoj seznam prijateljev." msgid "Select Notes Address Book" msgstr "Izberite adresar zapiskov" @@ -8525,36 +7879,22 @@ msgid "Unable to add group: group not found" msgstr "Dodajanje skupine ni uspelo: skupina ne obstaja" #, c-format -msgid "" -"The identifier '%s' did not match any Notes Address Book groups in your " -"Sametime community." -msgstr "" -"Imenovalec '%s' se ne ujema z nobeno skupino adresarjev zapiskov v vaši " -"skupnosti Sametime." +msgid "The identifier '%s' did not match any Notes Address Book groups in your Sametime community." +msgstr "Imenovalec '%s' se ne ujema z nobeno skupino adresarjev zapiskov v vaši skupnosti Sametime." msgid "Notes Address Book Group" msgstr "Skupina adresarja zapiskov" -msgid "" -"Enter the name of a Notes Address Book group in the field below to add the " -"group and its members to your buddy list." -msgstr "" -"Vnesite ime skupine opomb adresarja v spodnje polje, s čimer boste lahko v " -"seznam prijateljev vnesli skupino in njene člane." +msgid "Enter the name of a Notes Address Book group in the field below to add the group and its members to your buddy list." +msgstr "Vnesite ime skupine opomb adresarja v spodnje polje, s čimer boste lahko v seznam prijateljev vnesli skupino in njene člane." #, c-format msgid "Search results for '%s'" msgstr "Rezultati iskanja za '%s'" #, c-format -msgid "" -"The identifier '%s' may possibly refer to any of the following users. You " -"may add these users to your buddy list or send them messages with the action " -"buttons below." -msgstr "" -"Imenovalec '%s' se lahko nanaša na katerega koli od naštetih uporabnikov. " -"Izberite ustreznega in ga dodajte na seznam prijateljev ali pa jim pošljite " -"sporočila s spodnjimi gumbi." +msgid "The identifier '%s' may possibly refer to any of the following users. You may add these users to your buddy list or send them messages with the action buttons below." +msgstr "Imenovalec '%s' se lahko nanaša na katerega koli od naštetih uporabnikov. Izberite ustreznega in ga dodajte na seznam prijateljev ali pa jim pošljite sporočila s spodnjimi gumbi." msgid "Search Results" msgstr "Rezultati iskanja" @@ -8564,8 +7904,7 @@ msgstr "Ni zadetkov" #, c-format msgid "The identifier '%s' did not match any users in your Sametime community." -msgstr "" -"Imenovalec '%s' se ne ujema z nobenim uporabnikom vaše skupnosti Sametime." +msgstr "Imenovalec '%s' se ne ujema z nobenim uporabnikom vaše skupnosti Sametime." msgid "No Matches" msgstr "Ni zadetkov" @@ -8573,12 +7912,8 @@ msgstr "Ni zadetkov" msgid "Search for a user" msgstr "Išči uporabnike" -msgid "" -"Enter a name or partial ID in the field below to search for matching users " -"in your Sametime community." -msgstr "" -"Vnesite ime ali delni ID v spodnje polje za iskanje zadetkov v svoji " -"skupnosti Sametime." +msgid "Enter a name or partial ID in the field below to search for matching users in your Sametime community." +msgstr "Vnesite ime ali delni ID v spodnje polje za iskanje zadetkov v svoji skupnosti Sametime." msgid "User Search" msgstr "Iskanje uporabnikov" @@ -8634,9 +7969,7 @@ msgid "The remote user is not present in the network any more" msgstr "Oddaljen uporabnik ni več prisoten v omrežju" #, c-format -msgid "" -"Key agreement request received from %s. Would you like to perform the key " -"agreement?" +msgid "Key agreement request received from %s. Would you like to perform the key agreement?" msgstr "Zahteva po pogodbi sprejeta od %s. Želite izvesti pogodbo?" #, c-format @@ -8683,12 +8016,8 @@ msgstr "Ni mogoče dobiti informacij o uporabniku" msgid "The %s buddy is not trusted" msgstr "Prijatelj %s ni zaupljiv" -msgid "" -"You cannot receive buddy notifications until you import his/her public key. " -"You can use the Get Public Key command to get the public key." -msgstr "" -"Opozoril prijatelja ne morete sprejeti, dokler ne uvozite njegovega javnega " -"ključa. Uporabite lahko ukaz Dobi javni ključ." +msgid "You cannot receive buddy notifications until you import his/her public key. You can use the Get Public Key command to get the public key." +msgstr "Opozoril prijatelja ne morete sprejeti, dokler ne uvozite njegovega javnega ključa. Uporabite lahko ukaz Dobi javni ključ." #. Open file selector to select the public key. msgid "Open..." @@ -8698,12 +8027,8 @@ msgstr "Odpri ..." msgid "The %s buddy is not present in the network" msgstr "Prijatelj %s ni prisoten v omrežju" -msgid "" -"To add the buddy you must import his/her public key. Press Import to import " -"a public key." -msgstr "" -"Če želite dodati prijatelja, morate uvoziti njegov javni ključ. Kliknite " -"Uvozi za uvoz javnega ključa." +msgid "To add the buddy you must import his/her public key. Press Import to import a public key." +msgstr "Če želite dodati prijatelja, morate uvoziti njegov javni ključ. Kliknite Uvozi za uvoz javnega ključa." msgid "_Import..." msgstr "_Uvozi ..." @@ -8711,19 +8036,11 @@ msgstr "_Uvozi ..." msgid "Select correct user" msgstr "Izberite ustreznega uporabnika" -msgid "" -"More than one user was found with the same public key. Select the correct " -"user from the list to add to the buddy list." -msgstr "" -"Najden je bil več kot en uporabnik z enakim javnim ključem. Izberite " -"ustreznega in ga dodajte na seznam prijateljev." +msgid "More than one user was found with the same public key. Select the correct user from the list to add to the buddy list." +msgstr "Najden je bil več kot en uporabnik z enakim javnim ključem. Izberite ustreznega in ga dodajte na seznam prijateljev." -msgid "" -"More than one user was found with the same name. Select the correct user " -"from the list to add to the buddy list." -msgstr "" -"Najden je bil več kot en uporabnik z enakim vzdevkom. Izberite ustreznega in " -"ga dodajte na seznam prijateljev." +msgid "More than one user was found with the same name. Select the correct user from the list to add to the buddy list." +msgstr "Najden je bil več kot en uporabnik z enakim vzdevkom. Izberite ustreznega in ga dodajte na seznam prijateljev." msgid "Detached" msgstr "Odpeto" @@ -8740,21 +8057,33 @@ msgstr "Hiperaktiven" msgid "Robot" msgstr "Robot" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User Modes" msgstr "Načini uporabnika" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Contact" msgstr "Priljubljen stik" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Language" msgstr "Priljubljen jezik" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Device" msgstr "Naprava" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Timezone" msgstr "Časovni pas" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Geolocation" msgstr "Lokacija" @@ -8840,17 +8169,8 @@ msgid "Channel Public Keys List" msgstr "Seznam javnih ključev kanala" #, c-format -msgid "" -"Channel authentication is used to secure the channel from unauthorized " -"access. The authentication may be based on passphrase and digital " -"signatures. If passphrase is set, it is required to be able to join. If " -"channel public keys are set then only users whose public keys are listed are " -"able to join." -msgstr "" -"Overovitev kanala služi obrambi kanala pred neavtoriziranim dostopom. " -"Overovitev lahko temelji na geslih in digitalnih podpisih. Če je geslo " -"nastavljeno, je potrebno za pridružitev. Če so nastavljeni javni ključi " -"kanala, se mu lahko pridružijo le uporabniki, katerih ključi so na seznamu." +msgid "Channel authentication is used to secure the channel from unauthorized access. The authentication may be based on passphrase and digital signatures. If passphrase is set, it is required to be able to join. If channel public keys are set then only users whose public keys are listed are able to join." +msgstr "Overovitev kanala služi obrambi kanala pred neavtoriziranim dostopom. Overovitev lahko temelji na geslih in digitalnih podpisih. Če je geslo nastavljeno, je potrebno za pridružitev. Če so nastavljeni javni ključi kanala, se mu lahko pridružijo le uporabniki, katerih ključi so na seznamu." msgid "Channel Authentication" msgstr "Overovitev kanala" @@ -8914,8 +8234,7 @@ msgid "Set Secret Channel" msgstr "Nastavi skrivni kanal" #, c-format -msgid "" -"You have to join the %s channel before you are able to join the private group" +msgid "You have to join the %s channel before you are able to join the private group" msgstr "Preden se pridružite zasebni skupini, se morate pridružiti kanalu %s" msgid "Join Private Group" @@ -9158,12 +8477,8 @@ msgid "Passphrase required" msgstr "Zahtevano geslo" #, c-format -msgid "" -"Received %s's public key. Your local copy does not match this key. Would you " -"still like to accept this public key?" -msgstr "" -"Sprejet javni ključ uporabnika %s. Vaša lokalna kopija ne ustreza temu " -"ključu. Želite kljub temu sprejeti ta javni ključ?" +msgid "Received %s's public key. Your local copy does not match this key. Would you still like to accept this public key?" +msgstr "Sprejet javni ključ uporabnika %s. Vaša lokalna kopija ne ustreza temu ključu. Želite kljub temu sprejeti ta javni ključ?" #, c-format msgid "Received %s's public key. Would you like to accept this public key?" @@ -9199,11 +8514,8 @@ msgstr "Napaka pri povezovanju s strežnikom SILC" msgid "Key Exchange failed" msgstr "Izmenjava ključa ni uspela" -msgid "" -"Resuming detached session failed. Press Reconnect to create new connection." -msgstr "" -"Nadaljevanje odpete seje ni uspelo. Pritisnite Ponovna povezava za tvorbo " -"nove povezave." +msgid "Resuming detached session failed. Press Reconnect to create new connection." +msgstr "Nadaljevanje odpete seje ni uspelo. Pritisnite Ponovna povezava za tvorbo nove povezave." msgid "Performing key exchange" msgstr "Izvajanje izmenjave ključev" @@ -9272,14 +8584,8 @@ msgstr "Časovni pas (UTC)" msgid "User Online Status Attributes" msgstr "Atributi stanja uporabnika na zvezi" -msgid "" -"You can let other users see your online status information and your personal " -"information. Please fill the information you would like other users to see " -"about yourself." -msgstr "" -"Ostalim uporabnikom lahko dovolite ogled informacij o vašem stanju na zvezi " -"in osebnih informacij. Izpolnite informacije, ki jih želite pokazati ostalim " -"uporabnikom." +msgid "You can let other users see your online status information and your personal information. Please fill the information you would like other users to see about yourself." +msgstr "Ostalim uporabnikom lahko dovolite ogled informacij o vašem stanju na zvezi in osebnih informacij. Izpolnite informacije, ki jih želite pokazati ostalim uporabnikom." msgid "Message of the Day" msgstr "Sporočilo dneva" @@ -9363,8 +8669,7 @@ msgid "topic [<new topic>]: View or change the topic" msgstr "topic [<nova tema>]: Ogled ali sprememba teme" msgid "join <channel> [<password>]: Join a chat on this network" -msgstr "" -"join <kanal> [<geslo>]: Pridruži se klepetu na tem omrežju" +msgstr "join <kanal> [<geslo>]: Pridruži se klepetu na tem omrežju" msgid "list: List channels on this network" msgstr "list: Seznam kanalov na tem omrežju" @@ -9373,13 +8678,10 @@ msgid "whois <nick>: View nick's information" msgstr "whois <vzdevek>: Oglej si informacije vzdevka" msgid "msg <nick> <message>: Send a private message to a user" -msgstr "" -"msg <vzdevek> <sporočilo>: Pošlji zasebno sporočilo uporabniku" +msgstr "msg <vzdevek> <sporočilo>: Pošlji zasebno sporočilo uporabniku" msgid "query <nick> [<message>]: Send a private message to a user" -msgstr "" -"query <vzdevek> [<sporočilo>]: Pošlji zasebno sporočilo " -"uporabniku" +msgstr "query <vzdevek> [<sporočilo>]: Pošlji zasebno sporočilo uporabniku" msgid "motd: View the server's Message Of The Day" msgstr "motd: Ogled sporočila dneva na strežniku" @@ -9402,37 +8704,23 @@ msgstr "nick <novvzdevek>: Spremenite vaš vzdevek" msgid "whowas <nick>: View nick's information" msgstr "whowas <vzdevek>: Ogled informacij o vzdevku" -msgid "" -"cmode <channel> [+|-<modes>] [arguments]: Change or display " -"channel modes" -msgstr "" -"cmode <kanall> [+|-<načini>] [argumenti]: Spremeni ali prikaži " -"načine kanala" +msgid "cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes" +msgstr "cmode <kanall> [+|-<načini>] [argumenti]: Spremeni ali prikaži načine kanala" -msgid "" -"cumode <channel> +|-<modes> <nick>: Change nick's modes " -"on channel" -msgstr "" -"cumode <kanal> +|-<načini> <vzdevek>: Spremeni načine " -"vzdevka na kanalu" +msgid "cumode <channel> +|-<modes> <nick>: Change nick's modes on channel" +msgstr "cumode <kanal> +|-<načini> <vzdevek>: Spremeni načine vzdevka na kanalu" msgid "umode <usermodes>: Set your modes in the network" msgstr "umode <načiniuporabnika>: Nastavite vaše načine v omrežju" msgid "oper <nick> [-pubkey]: Get server operator privileges" -msgstr "" -"oper <vzdevek> [-javniključ]: Dodeli pravice operaterju strežnika" +msgstr "oper <vzdevek> [-javniključ]: Dodeli pravice operaterju strežnika" -msgid "" -"invite <channel> [-|+]<nick>: invite nick or add/remove from " -"channel invite list" -msgstr "" -"invite <kanal> [-|+]<vzdevek>: povabi vzdevek ali dodaj/" -"odstrani iz seznama povabljenih na kanal" +msgid "invite <channel> [-|+]<nick>: invite nick or add/remove from channel invite list" +msgstr "invite <kanal> [-|+]<vzdevek>: povabi vzdevek ali dodaj/odstrani iz seznama povabljenih na kanal" msgid "kick <channel> <nick> [comment]: Kick client from channel" -msgstr "" -"kick <kanal> <vzdevek> [komentar]: Brcni odjemalca s kanala" +msgstr "kick <kanal> <vzdevek> [komentar]: Brcni odjemalca s kanala" msgid "info [server]: View server administrative details" msgstr "info [strežnik]: Ogled skrbniških podrobnosti strežnika" @@ -9441,8 +8729,7 @@ msgid "ban [<channel> +|-<nick>]: Ban client from channel" msgstr "ban [<kanal> +|-<vzdevek>]: Prepovaj odjemalca na kanalu" msgid "getkey <nick|server>: Retrieve client's or server's public key" -msgstr "" -"getkey <vzdevek|strežnik>: Pridobi javni ključ odjemalca ali strežnika" +msgstr "getkey <vzdevek|strežnik>: Pridobi javni ključ odjemalca ali strežnika" msgid "stats: View server and network statistics" msgstr "stats: Ogled statistike omrežja in strežnika" @@ -9453,12 +8740,8 @@ msgstr "ping: Pošlji PING povezanemu strežniku" msgid "users <channel>: List users in channel" msgstr "users <kanal>: Navedi uporabnike v kanalu" -msgid "" -"names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List " -"specific users in channel(s)" -msgstr "" -"names [-št|-op|-polop|-glas|-navadni] <kanal(i)>: Seznam določenih " -"uporabnikov na kanalu(ih)" +msgid "names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)" +msgstr "names [-št|-op|-polop|-glas|-navadni] <kanal(i)>: Seznam določenih uporabnikov na kanalu(ih)" #. *< type #. *< ui_requirement @@ -9595,82 +8878,18 @@ msgid "%s sent message to whiteboard. Would you like to open the whiteboard?" msgstr "%s je poslal sporočilo na tablo. Želite odpreti tablo?" #, c-format -msgid "" -"%s sent message to whiteboard on %s channel. Would you like to open the " -"whiteboard?" +msgid "%s sent message to whiteboard on %s channel. Would you like to open the whiteboard?" msgstr "%s je poslal sporočilo na tablo v kanalu %s. Želite odpreti tablo?" msgid "Whiteboard" msgstr "Tabla" -msgid "No server statistics available" -msgstr "Statistika strežnika ni na voljo." - -msgid "Error during connecting to SILC Server" -msgstr "Napaka pri povezovanju s strežnikom SILC" - -#, c-format -msgid "Failure: Version mismatch, upgrade your client" -msgstr "Napaka: Neustrezna različica, nadgradite svojega odjemalca" - -#, c-format -msgid "Failure: Remote does not trust/support your public key" -msgstr "Napaka: Oddaljeni ne podpira vašega ključa ali mu ne zaupa" - -#, c-format -msgid "Failure: Remote does not support proposed KE group" -msgstr "Napaka: Oddaljeni ne podpira predlagane skupine KE" - -#, c-format -msgid "Failure: Remote does not support proposed cipher" -msgstr "Napaka: Oddaljeni ne podpira predlagane cifre" - -#, c-format -msgid "Failure: Remote does not support proposed PKCS" -msgstr "Napaka: Oddaljeni ne podpira predlaganega PKCS" - -#, c-format -msgid "Failure: Remote does not support proposed hash function" -msgstr "Napaka: Oddaljeni ne podpira predlagane razpršene možnosti" - -#, c-format -msgid "Failure: Remote does not support proposed HMAC" -msgstr "Napaka: Oddaljeni ne podpira predlaganega HMAC" - -#, c-format -msgid "Failure: Incorrect signature" -msgstr "Napaka: Napačen podpis" - -#, c-format -msgid "Failure: Invalid cookie" -msgstr "Napaka: Napačen piškot" - -#, c-format -msgid "Failure: Authentication failed" -msgstr "Napaka: Overovitev ni uspela" - -msgid "Unable to initialize SILC Client connection" -msgstr "Povezave odjemalca SILC ni mogoče inicializirati" - -msgid "John Noname" -msgstr "Janez Neimenovani" - -#, c-format -msgid "Unable to load SILC key pair: %s" -msgstr "Para ključev SILC ni mogoče naložiti: %s" - -msgid "Unable to create connection" -msgstr "Ni bilo mogoče ustvariti povezave" - msgid "Unknown server response" msgstr "Neznan odgovor strežnika" msgid "Unable to create listen socket" msgstr "Ni mogoče ustvariti vtičnice za poslušanje" -msgid "Unable to resolve hostname" -msgstr "Imena strežnika ni mogoče razločiti" - msgid "SIP usernames may not contain whitespaces or @ symbols" msgstr "Uporabniška imena SIP ne smejo vsebovati presledka ali simbola @" @@ -9790,17 +9009,12 @@ msgid "Authorization denied message:" msgstr "Zavrnjeno sporočilo pooblaščanja:" #, c-format -msgid "" -"%s has (retroactively) denied your request to add them to your list for the " -"following reason: %s." -msgstr "" -"%s je (že prej) zavrnil vašo zahtevo, da bi ga dodali na svoj seznam " -"prijateljev zaradi naslednjega razloga: %s." +msgid "%s has (retroactively) denied your request to add them to your list for the following reason: %s." +msgstr "%s je (že prej) zavrnil vašo zahtevo, da bi ga dodali na svoj seznam prijateljev zaradi naslednjega razloga: %s." #, c-format msgid "%s has (retroactively) denied your request to add them to your list." -msgstr "" -"%s je (že prej) zavrnil vašo zahtevo, da ga smete dodati na svoj seznam." +msgstr "%s je (že prej) zavrnil vašo zahtevo, da ga smete dodati na svoj seznam." msgid "Add buddy rejected" msgstr "Dodajanje prijatelja zavrnjeno" @@ -9810,52 +9024,31 @@ msgid "Received invalid data" msgstr "Prejeti neveljavni podatki" #. security lock from too many failed login attempts -msgid "" -"Account locked: Too many failed login attempts. Logging into the Yahoo! " -"website may fix this." -msgstr "" -"Račun zaklenjen: Preveč neuspelih poskusov prijave. Prijavljanje v spletno " -"stran Yahoo! lahko to odpravi." +msgid "Account locked: Too many failed login attempts. Logging into the Yahoo! website may fix this." +msgstr "Račun zaklenjen: Preveč neuspelih poskusov prijave. Prijavljanje v spletno stran Yahoo! lahko to odpravi." #. indicates a lock of some description -msgid "" -"Account locked: Unknown reason. Logging into the Yahoo! website may fix " -"this." -msgstr "" -"Račun zaklenjen: Razlog ni znan. Prijavljanje v spletno stran Yahoo! lahko " -"to odpravi." +msgid "Account locked: Unknown reason. Logging into the Yahoo! website may fix this." +msgstr "Račun zaklenjen: Razlog ni znan. Prijavljanje v spletno stran Yahoo! lahko to odpravi." #. indicates a lock due to logging in too frequently -msgid "" -"Account locked: You have been logging in too frequently. Wait a few minutes " -"before trying to connect again. Logging into the Yahoo! website may help." -msgstr "" -"Račun zaklenjen: Prepogosto ste se prijavljali. Počakajte nekaj minut, " -"preden se znova prijavite. Prijavljanje v spletno stran Yahoo! lahko pomaga." +msgid "Account locked: You have been logging in too frequently. Wait a few minutes before trying to connect again. Logging into the Yahoo! website may help." +msgstr "Račun zaklenjen: Prepogosto ste se prijavljali. Počakajte nekaj minut, preden se znova prijavite. Prijavljanje v spletno stran Yahoo! lahko pomaga." #. username or password missing msgid "Username or password missing" msgstr "Manjka uporabniško ime ali geslo" #, c-format -msgid "" -"The Yahoo server has requested the use of an unrecognized authentication " -"method. You will probably not be able to successfully sign on to Yahoo. " -"Check %s for updates." -msgstr "" -"Strežnik Yahoo je zahteval uporabo neprepoznane metode overovitve. Verjetno " -"se ne boste mogli uspešno prijaviti v Yahoo. Preverite %s za posodobitve." +msgid "The Yahoo server has requested the use of an unrecognized authentication method. You will probably not be able to successfully sign on to Yahoo. Check %s for updates." +msgstr "Strežnik Yahoo je zahteval uporabo neprepoznane metode overovitve. Verjetno se ne boste mogli uspešno prijaviti v Yahoo. Preverite %s za posodobitve." msgid "Failed Yahoo! Authentication" msgstr "Napaka pri overovitvi Yahoo!" #, c-format -msgid "" -"You have tried to ignore %s, but the user is on your buddy list. Clicking " -"\"Yes\" will remove and ignore the buddy." -msgstr "" -"Poskusili ste prezreti uporabnika %s, ki je na vašem seznamu prijateljev. Če " -"kliknete \"Da\" boste odstranili prijatelja in ga prezrli." +msgid "You have tried to ignore %s, but the user is on your buddy list. Clicking \"Yes\" will remove and ignore the buddy." +msgstr "Poskusili ste prezreti uporabnika %s, ki je na vašem seznamu prijateljev. Če kliknete \"Da\" boste odstranili prijatelja in ga prezrli." msgid "Ignore buddy?" msgstr "Prezrem prijatelja?" @@ -9863,35 +9056,23 @@ msgstr "Prezrem prijatelja?" msgid "Invalid username or password" msgstr "Neveljavno uporabniško ime ali geslo" -msgid "" -"Your account has been locked due to too many failed login attempts. Please " -"try logging into the Yahoo! website." -msgstr "" -"Račun je bil zaklenjen zaradi prevelikega števila neuspelih poskusov " -"prijave. Prijavite se na spletno stran Yahoo!." +msgid "Your account has been locked due to too many failed login attempts. Please try logging into the Yahoo! website." +msgstr "Račun je bil zaklenjen zaradi prevelikega števila neuspelih poskusov prijave. Prijavite se na spletno stran Yahoo!." #, c-format msgid "Unknown error 52. Reconnecting should fix this." msgstr "Neznana napaka 52. Ponovno povezovanje jo bo najbrž odpravilo." -msgid "" -"Error 1013: The username you have entered is invalid. The most common cause " -"of this error is entering your email address instead of your Yahoo! ID." -msgstr "" -"Napaka 1013: Uporabniško ime, ki ste ga vnesli, ni veljavno. Najpogostejši " -"vzrok za to napako je vnos e-poštnega naslova namesto dejanskega Yahoo! ID." +msgid "Error 1013: The username you have entered is invalid. The most common cause of this error is entering your email address instead of your Yahoo! ID." +msgstr "Napaka 1013: Uporabniško ime, ki ste ga vnesli, ni veljavno. Najpogostejši vzrok za to napako je vnos e-poštnega naslova namesto dejanskega Yahoo! ID." #, c-format msgid "Unknown error number %d. Logging into the Yahoo! website may fix this." -msgstr "" -"Neznana številka napake %d. Prijavljanje v spletno stran Yahoo! lahko to " -"odpravi." +msgstr "Neznana številka napake %d. Prijavljanje v spletno stran Yahoo! lahko to odpravi." #, c-format msgid "Unable to add buddy %s to group %s to the server list on account %s." -msgstr "" -"Prijatelja %s ni mogoče dodati v skupino %s na seznamu strežnikov za račun " -"%s." +msgstr "Prijatelja %s ni mogoče dodati v skupino %s na seznamu strežnikov za račun %s." msgid "Unable to add buddy to server list" msgstr "Prijatelja ni mogoče dodati ne seznam strežnikov" @@ -9914,11 +9095,8 @@ msgstr "Povezave s strežnikom %s ni mogoče vzpostaviti: %s" msgid "Unable to connect: The server returned an empty response." msgstr "Ni se mogoče povezati: Strežnik je vrnil prazen odgovor." -msgid "" -"Unable to connect: The server's response did not contain the necessary " -"information" -msgstr "" -"Ni se mogoče povezati: Odgovor strežnika ne vsebuje potrebnih informacij." +msgid "Unable to connect: The server's response did not contain the necessary information" +msgstr "Ni se mogoče povezati: Odgovor strežnika ne vsebuje potrebnih informacij." msgid "Not at Home" msgstr "Nisem doma" @@ -10008,18 +9186,11 @@ msgstr "Profil Yahoo!-Japonska" msgid "Yahoo! Profile" msgstr "Profil Yahoo!" -msgid "" -"Sorry, profiles marked as containing adult content are not supported at this " -"time." -msgstr "" -"Oprostite, profili označeni z vsebino za odrasle trenutno niso podprti." +msgid "Sorry, profiles marked as containing adult content are not supported at this time." +msgstr "Oprostite, profili označeni z vsebino za odrasle trenutno niso podprti." -msgid "" -"If you wish to view this profile, you will need to visit this link in your " -"web browser:" -msgstr "" -"Če si želite ogledati ta profil, morate s spletnim brskalnikom obiskati " -"naslednjo povezavo:" +msgid "If you wish to view this profile, you will need to visit this link in your web browser:" +msgstr "Če si želite ogledati ta profil, morate s spletnim brskalnikom obiskati naslednjo povezavo:" msgid "Yahoo! ID" msgstr "Yahoo ID" @@ -10045,25 +9216,14 @@ msgstr "Zanimiva povezava št. 3" msgid "Last Update" msgstr "Nazadnje osveženo" -msgid "" -"This profile is in a language or format that is not supported at this time." +msgid "This profile is in a language or format that is not supported at this time." msgstr "Oprostite, profil je v jeziku ali obliki, ki trenutno ni podprta." -msgid "" -"Could not retrieve the user's profile. This most likely is a temporary " -"server-side problem. Please try again later." -msgstr "" -"Ni mogoče pridobiti uporabnikovega profila. Ponavadi gre za začasno težavo " -"na strežniku. Poskusite pozneje." +msgid "Could not retrieve the user's profile. This most likely is a temporary server-side problem. Please try again later." +msgstr "Ni mogoče pridobiti uporabnikovega profila. Ponavadi gre za začasno težavo na strežniku. Poskusite pozneje." -msgid "" -"Could not retrieve the user's profile. This most likely means that the user " -"does not exist; however, Yahoo! sometimes does fail to find a user's " -"profile. If you know that the user exists, please try again later." -msgstr "" -"Ni mogoče pridobiti uporabnikovega profila. To ponavadi pomeni, da uporabnik " -"ne obstaja. Kljub temu Yahoo! občasno ne uspe najti uporabnikovega profila. " -"Če veste, da uporabnik obstaja, poskusite pozneje." +msgid "Could not retrieve the user's profile. This most likely means that the user does not exist; however, Yahoo! sometimes does fail to find a user's profile. If you know that the user exists, please try again later." +msgstr "Ni mogoče pridobiti uporabnikovega profila. To ponavadi pomeni, da uporabnik ne obstaja. Kljub temu Yahoo! občasno ne uspe najti uporabnikovega profila. Če veste, da uporabnik obstaja, poskusite pozneje." msgid "The user's profile is empty." msgstr "Uporabnikov profil je prazen." @@ -10087,12 +9247,8 @@ msgstr "Morda je soba polna" msgid "Not available" msgstr "Ni na voljo" -msgid "" -"Unknown error. You may need to logout and wait five minutes before being " -"able to rejoin a chatroom" -msgstr "" -"Neznana napaka. Morda se boste morali odjaviti in počakati pet minut, preden " -"se boste lahko ponovno pridružili klepetalnici" +msgid "Unknown error. You may need to logout and wait five minutes before being able to rejoin a chatroom" +msgstr "Neznana napaka. Morda se boste morali odjaviti in počakati pet minut, preden se boste lahko ponovno pridružili klepetalnici" #, c-format msgid "You are now chatting in %s." @@ -10125,12 +9281,8 @@ msgstr "Sobe uporabnikov" msgid "Connection problem with the YCHT server" msgstr "Težava s povezavo s strežnikom YCHT" -msgid "" -"(There was an error converting this message.\t Check the 'Encoding' option " -"in the Account Editor)" -msgstr "" -"(Prišlo je do napake pri pretvorbi tega sporočila. \t Preverite izbiro " -"kodnega nabora v Upravitelju računov)" +msgid "(There was an error converting this message.\t Check the 'Encoding' option in the Account Editor)" +msgstr "(Prišlo je do napake pri pretvorbi tega sporočila. \t Preverite izbiro kodnega nabora v Upravitelju računov)" #, c-format msgid "Unable to send to chat %s,%s,%s" @@ -10139,6 +9291,8 @@ msgstr "Ni mogoče poslati klepetu %s,%s,%s" msgid "Hidden or not logged-in" msgstr "Skrit ali neprijavljen" +#. TODO: Need to escape locs.host and locs.time? +#. TODO: Need to escape the two strings that make up tmp? #, c-format msgid "
    At %s since %s" msgstr "
    Pri %s od %s" @@ -10166,54 +9320,31 @@ msgid "zl <nick>: Locate user" msgstr "zl <vzdevek>: Najdi uporabnika" msgid "instance <instance>: Set the instance to be used on this class" -msgstr "" -"instance <instanca>: Nastavi instanco, ki naj bo uporabljena na tem " -"razredu" +msgstr "instance <instanca>: Nastavi instanco, ki naj bo uporabljena na tem razredu" msgid "inst <instance>: Set the instance to be used on this class" -msgstr "" -"inst <instanca>: Nastavi instanco, ki naj bo uporabljena na tem razredu" +msgstr "inst <instanca>: Nastavi instanco, ki naj bo uporabljena na tem razredu" msgid "topic <instance>: Set the instance to be used on this class" -msgstr "" -"topic <instanca>: Nastavi instanco, ki naj bo uporabljena na tem " -"razredu" +msgstr "topic <instanca>: Nastavi instanco, ki naj bo uporabljena na tem razredu" msgid "sub <class> <instance> <recipient>: Join a new chat" -msgstr "" -"sub <razred> <instanca> <prejemnik>: Pridruži se novemu " -"klepetu" +msgstr "sub <razred> <instanca> <prejemnik>: Pridruži se novemu klepetu" -msgid "" -"zi <instance>: Send a message to <message,instance,*>" -msgstr "" -"zi <instanca>: Pošlji sporočilo uporabniku <sporočilo,instanca,*>" +msgid "zi <instance>: Send a message to <message,instance,*>" +msgstr "zi <instanca>: Pošlji sporočilo uporabniku <sporočilo,instanca,*>" -msgid "" -"zci <class> <instance>: Send a message to <class," -"instance,*>" -msgstr "" -"zci <razred> <instanca>: Pošlji sporočilo uporabniku <" -"razred,instanca,*>" +msgid "zci <class> <instance>: Send a message to <class,instance,*>" +msgstr "zci <razred> <instanca>: Pošlji sporočilo uporabniku <razred,instanca,*>" -msgid "" -"zcir <class> <instance> <recipient>: Send a message to <" -"class,instance,recipient>" -msgstr "" -"zcir <razred> <instanca> <prejemnik>: Pošlji sporočilo " -"uporabniku <razred,instanca,prejemnik>" +msgid "zcir <class> <instance> <recipient>: Send a message to <class,instance,recipient>" +msgstr "zcir <razred> <instanca> <prejemnik>: Pošlji sporočilo uporabniku <razred,instanca,prejemnik>" -msgid "" -"zir <instance> <recipient>: Send a message to <MESSAGE," -"instance,recipient>" -msgstr "" -"zir <instanca> <prejemnikt>: Pošlji sporočilo uporabniku <" -"SPOROČILO,instanca,prejemnik>" +msgid "zir <instance> <recipient>: Send a message to <MESSAGE,instance,recipient>" +msgstr "zir <instanca> <prejemnikt>: Pošlji sporočilo uporabniku <SPOROČILO,instanca,prejemnik>" msgid "zc <class>: Send a message to <class,PERSONAL,*>" -msgstr "" -"zc <razred>: Pošlji sporočilo uporabniku <razred,OSEBNO,*>" +msgstr "zc <razred>: Pošlji sporočilo uporabniku <razred,OSEBNO,*>" msgid "Resubscribe" msgstr "Ponovna prijava" @@ -10273,9 +9404,7 @@ msgstr "Napaka pri povezavi na posredovalni strežnik HTTP %d" #, c-format msgid "Access denied: HTTP proxy server forbids port %d tunneling" -msgstr "" -"Dostop zavrnjen: posredovalni strežnik HTTP ne dovoljuje preusmerjanja vrat " -"%d" +msgstr "Dostop zavrnjen: posredovalni strežnik HTTP ne dovoljuje preusmerjanja vrat %d" #, c-format msgid "Error resolving %s" @@ -10350,9 +9479,6 @@ msgstr "Shranjena slika" msgid "Stored Image. (that'll have to do for now)" msgstr "Shranjena slika." -msgid "SSL Connection Failed" -msgstr "Povezava SSL ni uspela" - msgid "SSL Handshake Failed" msgstr "Rokovanje SSL ni uspelo" @@ -10479,12 +9605,8 @@ msgid "Error reading from %s: response too long (%d bytes limit)" msgstr "Napaka pri branju iz %s: odziv predolg (omejeno na %d bajtov)" #, c-format -msgid "" -"Unable to allocate enough memory to hold the contents from %s. The web " -"server may be trying something malicious." -msgstr "" -"Za hrambo vsebine %s ni mogoče pridobiti zadostnega prostora. Spletni " -"strežnik morda poskuša storiti nekaj sovražnega." +msgid "Unable to allocate enough memory to hold the contents from %s. The web server may be trying something malicious." +msgstr "Za hrambo vsebine %s ni mogoče pridobiti zadostnega prostora. Spletni strežnik morda poskuša storiti nekaj sovražnega." #, c-format msgid "Error reading from %s: %s" @@ -10531,18 +9653,11 @@ msgid "Error Reading %s" msgstr "Napaka pri branju %s" #, c-format -msgid "" -"An error was encountered reading your %s. The file has not been loaded, and " -"the old file has been renamed to %s~." -msgstr "" -"Pri branju vašega %s je prišlo do napake. Datoteka ni bial naložena, stara " -"datoteka pa je bila preimenovana v %s~." +msgid "An error was encountered reading your %s. The file has not been loaded, and the old file has been renamed to %s~." +msgstr "Pri branju vašega %s je prišlo do napake. Datoteka ni bial naložena, stara datoteka pa je bila preimenovana v %s~." -msgid "" -"Chat over IM. Supports AIM, Google Talk, Jabber/XMPP, MSN, Yahoo and more" -msgstr "" -"Klepetajte s svetom. Podpira AIM, Google Talk, Jabber/XMPP, MSN, Yahoo in " -"druge." +msgid "Chat over IM. Supports AIM, Google Talk, Jabber/XMPP, MSN, Yahoo and more" +msgstr "Klepetajte s svetom. Podpira AIM, Google Talk, Jabber/XMPP, MSN, Yahoo in druge." msgid "Internet Messenger" msgstr "Spletni sel" @@ -10596,7 +9711,7 @@ msgid "SOCKS 5" msgstr "SOCKS5" msgid "Tor/Privacy (SOCKS5)" -msgstr "" +msgstr "Tor/zasebnost (SOCKS5)" msgid "HTTP" msgstr "HTTP" @@ -10630,11 +9745,10 @@ msgstr "Ge_slo:" #, fuzzy msgid "Use _silence suppression" -msgstr "Nadaljevalna seja" +msgstr "Uporabi _zatiranje tišin" -#, fuzzy msgid "_Voice and Video" -msgstr "glas in video" +msgstr "_Glas in video" msgid "Unable to save new account" msgstr "Novega računa ni mogoče shraniti" @@ -10664,39 +9778,26 @@ msgstr "Protokol" msgid "" "Welcome to %s!\n" "\n" -"You have no IM accounts configured. To start connecting with %s press the " -"Add... button below and configure your first account. If you want %s " -"to connect to multiple IM accounts, press Add... again to configure " -"them all.\n" +"You have no IM accounts configured. To start connecting with %s press the Add... button below and configure your first account. If you want %s to connect to multiple IM accounts, press Add... again to configure them all.\n" "\n" -"You can come back to this window to add, edit, or remove accounts from " -"Accounts->Manage Accounts in the Buddy List window" +"You can come back to this window to add, edit, or remove accounts from Accounts->Manage Accounts in the Buddy List window" msgstr "" "Dobrodošli v programu %s!\n" "\n" -"Nimate nastavljenih računov za neposredno sporočanje. Da bi omogočili " -"povezovanje s %s, pritisnite na spodnji gumb Dodaj ... in nastavite " -"svoj prvi račun. Če želite, da se %s poveže z več računi, pritisnite znova " -"Dodaj ..., da jih vse nastavite.\n" +"Nimate nastavljenih računov za neposredno sporočanje. Da bi omogočili povezovanje s %s, pritisnite na spodnji gumb Dodaj ... in nastavite svoj prvi račun. Če želite, da se %s poveže z več računi, pritisnite znova Dodaj ..., da jih vse nastavite.\n" "\n" -"Vedno se k temu oknu lahko vrnete in dodate, uredite ali odstranite račune z " -"Računi->Upravljaj z računi v oknu seznama prijateljev." +"Vedno se k temu oknu lahko vrnete in dodate, uredite ali odstranite račune z Računi->Upravljaj z računi v oknu seznama prijateljev." -#, fuzzy, c-format -msgid "" -"%s%s%s%s wants to add you (%s) to his or her buddy " -"list%s%s" -msgstr "" -"Uporabnik %s%s%s%s vas (%s) želi dodati na svoj seznam prijateljev%s%s." +#, c-format +msgid "%s%s%s%s wants to add you (%s) to his or her buddy list%s%s" +msgstr "Uporabnik %s%s%s%s vas (%s) želi dodati na svoj seznam prijateljev%s%s." #, c-format msgid "%s%s%s%s wants to add you (%s) to his or her buddy list%s%s" -msgstr "" -"Uporabnik %s%s%s%s vas (%s) želi dodati na svoj seznam prijateljev%s%s." +msgstr "Uporabnik %s%s%s%s vas (%s) želi dodati na svoj seznam prijateljev%s%s." -#, fuzzy msgid "Send Instant Message" -msgstr "Novo neposredno sporočilo" +msgstr "Pošlji neposredno sporočilo" #. Buddy List msgid "Background Color" @@ -10806,33 +9907,22 @@ msgstr "Besedilna informacija, ko ima prijatelj neprebrano sporočilo" msgid "Message (Nick Said) Text" msgstr "Besedilo sporočila (je rekel vzdevek)" -msgid "" -"The text information for when a chat has an unread message that mentions " -"your nickname" -msgstr "" -"Besedilna informacija, ko je v pomenku neprebrano sporočilo, ki omenja vaš " -"vzdevek" +msgid "The text information for when a chat has an unread message that mentions your nickname" +msgstr "Besedilna informacija, ko je v pomenku neprebrano sporočilo, ki omenja vaš vzdevek" msgid "The text information for a buddy's status" msgstr "Besedilni podatki o stanju uporabika" #, c-format msgid "You have %d contact named %s. Would you like to merge them?" -msgid_plural "" -"You currently have %d contacts named %s. Would you like to merge them?" +msgid_plural "You currently have %d contacts named %s. Would you like to merge them?" msgstr[0] "Imate %d stikov z imenom %s. Jih želite spojiti v enega?" msgstr[1] "Imate %d stik z imenom %s. Ga želite spojiti v enega?" msgstr[2] "Imate %d stika z imenom %s. Ju želite spojiti v enega?" msgstr[3] "Imate %d stike z imenom %s. Jih želite spojiti v enega?" -msgid "" -"Merging these contacts will cause them to share a single entry on the buddy " -"list and use a single conversation window. You can separate them again by " -"choosing 'Expand' from the contact's context menu" -msgstr "" -"Spajanje teh stikov bo povzročilo, da si bodo delili en sam vnos na seznamu " -"prijateljev in eno samo pogovorno okno. Znova jih lahko ločite z izbiro " -"'Razširi' v kontekstnem meniju stika." +msgid "Merging these contacts will cause them to share a single entry on the buddy list and use a single conversation window. You can separate them again by choosing 'Expand' from the contact's context menu" +msgstr "Spajanje teh stikov bo povzročilo, da si bodo delili en sam vnos na seznamu prijateljev in eno samo pogovorno okno. Znova jih lahko ločite z izbiro 'Razširi' v kontekstnem meniju stika." msgid "Please update the necessary fields." msgstr "Prosimo, posodobite potrebna polja." @@ -10840,9 +9930,7 @@ msgstr "Prosimo, posodobite potrebna polja." msgid "A_ccount" msgstr "Ra_čun" -msgid "" -"Please enter the appropriate information about the chat you would like to " -"join.\n" +msgid "Please enter the appropriate information about the chat you would like to join.\n" msgstr "Vnesite ustrezne informacije o pomenku, ki se mu želite pridružiti.\n" msgid "Room _List" @@ -10933,10 +10021,8 @@ msgstr "_Razširi" msgid "/Tools/Mute Sounds" msgstr "/Orodja/Utišaj zvoke" -msgid "" -"You are not currently signed on with an account that can add that buddy." -msgstr "" -"Trenutno niste prijavljeni z nobenim računom, ki lahko doda tega prijatelja." +msgid "You are not currently signed on with an account that can add that buddy." +msgstr "Trenutno niste prijavljeni z nobenim računom, ki lahko doda tega prijatelja." #. I don't believe this can happen currently, I think #. * everything that calls this function checks for one of the @@ -11064,9 +10150,8 @@ msgstr "/Pomoč/Raz_hroščevalno okno" msgid "/Help/De_veloper Information" msgstr "/Pomoč/Podatki o _razvijalcih" -#, fuzzy msgid "/Help/_Plugin Information" -msgstr "/Pomoč/Podatki o _gradnji" +msgstr "/Pomoč/Podatki o v_tičniku" msgid "/Help/_Translator Information" msgstr "/Pomoč/Podatki o _prevajalcih" @@ -11193,15 +10278,11 @@ msgstr "Dobrodošli nazaj!" #, c-format msgid "%d account was disabled because you signed on from another location:" -msgid_plural "" -"%d accounts were disabled because you signed on from another location:" -msgstr[0] "" -"Ker ste se prijavili z druge lokacije, je bilo onemogočenih %d računov." +msgid_plural "%d accounts were disabled because you signed on from another location:" +msgstr[0] "Ker ste se prijavili z druge lokacije, je bilo onemogočenih %d računov." msgstr[1] "Ker ste se prijavili z druge lokacije, je bil onemogočen %d račun." -msgstr[2] "" -"Ker ste se prijavili z druge lokacije, sta bila onemogočena %d računa." -msgstr[3] "" -"Ker ste se prijavili z druge lokacije, so bili onemogočeni %d računi." +msgstr[2] "Ker ste se prijavili z druge lokacije, sta bila onemogočena %d računa." +msgstr[3] "Ker ste se prijavili z druge lokacije, so bili onemogočeni %d računi." msgid "Username:" msgstr "Uporabniško ime:" @@ -11220,16 +10301,11 @@ msgstr "/Računi" msgid "" "Welcome to %s!\n" "\n" -"You have no accounts enabled. Enable your IM accounts from the Accounts window at Accounts->Manage Accounts. Once you enable accounts, " -"you'll be able to sign on, set your status, and talk to your friends." +"You have no accounts enabled. Enable your IM accounts from the Accounts window at Accounts->Manage Accounts. Once you enable accounts, you'll be able to sign on, set your status, and talk to your friends." msgstr "" "Dobrodošli v %s!\n" "\n" -"Nimate aktiviranih računov. Vključite svoje račune za neposredno sporočanje " -"(IM) prek okna Računi z ukazom Računi->Upravljaj z računi. Ko " -"račune omogočite, se boste lahko prijavili, nastavili svoje stanje in " -"klepetali s svojimi prijatelji." +"Nimate aktiviranih računov. Vključite svoje račune za neposredno sporočanje (IM) prek okna Računi z ukazom Računi->Upravljaj z računi. Ko račune omogočite, se boste lahko prijavili, nastavili svoje stanje in klepetali s svojimi prijatelji." #. set the Show Offline Buddies option. must be done #. * after the treeview or faceprint gets mad. -Robot101 @@ -11256,11 +10332,10 @@ msgid "Buddy's _username:" msgstr "_Uporabniško ime prijatelja:" msgid "(Optional) A_lias:" -msgstr "(Dodatni) _psevdonimi:" +msgstr "(Neobvezno) _Psevdonim:" -#, fuzzy msgid "(Optional) _Invite message:" -msgstr "(Dodatni) _psevdonimi:" +msgstr "(Neobvezno) Po_vabilo:" msgid "Add buddy to _group:" msgstr "Doda_j prijatelja v skupino:" @@ -11268,18 +10343,11 @@ msgstr "Doda_j prijatelja v skupino:" msgid "This protocol does not support chat rooms." msgstr "Ta protokol ne podpira klepetalnic." -msgid "" -"You are not currently signed on with any protocols that have the ability to " -"chat." -msgstr "" -"Trenutno niste prijavljeni na nobenem izmed protokolov, ki podpirajo pomenke." +msgid "You are not currently signed on with any protocols that have the ability to chat." +msgstr "Trenutno niste prijavljeni na nobenem izmed protokolov, ki podpirajo pomenke." -msgid "" -"Please enter an alias, and the appropriate information about the chat you " -"would like to add to your buddy list.\n" -msgstr "" -"Prosim, vnesite psevdonim in ostale informacije za pomenek, ki ga želite " -"dodati na seznam prijateljev.\n" +msgid "Please enter an alias, and the appropriate information about the chat you would like to add to your buddy list.\n" +msgstr "Prosim, vnesite psevdonim in ostale informacije za pomenek, ki ga želite dodati na seznam prijateljev.\n" msgid "A_lias:" msgstr "Psev_donim:" @@ -11326,20 +10394,38 @@ msgstr "/Prijatelji/Razvrsti prijatelje" msgid "Type the host name for this certificate." msgstr "Vnesite ime gostitelja za to digitalno potrdilo." +#. Fire the notification +#, c-format +msgid "Certificate Information for %s" +msgstr "Podatki o digitalnem potrdilu %s" + #. Widget creation function msgid "SSL Servers" msgstr "Strežniki SSL" +msgid "Unsafe debugging is now disabled." +msgstr "Nezaščiteno razhroščevanje je zdaj onemogočeno." + +msgid "Unsafe debugging is now enabled." +msgstr "Nezaščiteno razhroščevanje je zdaj omogočeno." + +msgid "Verbose debugging is now disabled." +msgstr "Gostobesedno razhroščevanje je zdaj onemogočeno." + +msgid "Verbose debugging is now enabled." +msgstr "Gostobesedno razhroščevanje je zdaj omogočeno." + +msgid "Supported debug options are: plugins version unsafe verbose" +msgstr "Podprte možnosti razhroščevanja: plugins version unsafe verbose" + msgid "Unknown command." msgstr "Neznan ukaz." msgid "That buddy is not on the same protocol as this chat." msgstr "Tisti prijatelj ne uporablja enakega protokola kot ta pogovor." -msgid "" -"You are not currently signed on with an account that can invite that buddy." -msgstr "" -"Trenutno niste prijavljeni z nobenim računom, ki lahko doda tega prijatelja." +msgid "You are not currently signed on with an account that can invite that buddy." +msgstr "Trenutno niste prijavljeni z nobenim računom, ki lahko doda tega prijatelja." msgid "Invite Buddy Into Chat Room" msgstr "Povabi prijatelja v pogovorno sobo" @@ -11363,9 +10449,6 @@ msgstr "Ne prezri" msgid "Ignore" msgstr "Prezri" -msgid "Get Away Message" -msgstr "Sporočilo o odsotnosti" - msgid "Last Said" msgstr "Nazadnje rečeno" @@ -11835,7 +10918,7 @@ msgid "Hindi" msgstr "hindujsko" msgid "Croatian" -msgstr "" +msgstr "hrvaško" msgid "Hungarian" msgstr "madžarsko" @@ -11997,50 +11080,16 @@ msgid "Lithuanian" msgstr "litvansko" #, c-format -msgid "" -"%s is a messaging client based on libpurple which is capable of connecting " -"to multiple messaging services at once. %s is written in C using GTK+. %s " -"is released, and may be modified and redistributed, under the terms of the " -"GPL version 2 (or later). A copy of the GPL is distributed with %s. %s is " -"copyrighted by its contributors, a list of whom is also distributed with " -"%s. There is no warranty for %s.

    " -msgstr "" -"%s je odjemalec za neposredno sporočanje, ki se lahko hkrati povezuje z več " -"storitvami sporočanja. %s je napisan v jeziku C s pomočjo Gtk+. %s je izdan " -"in ga lahko spreminjate in razširjate pod pogoji licence GPL različice 2 " -"(ali novejše). Kopija licence GPL se razširja s programom %s. %s je " -"zaščitena znamka svojih avtorjev, njihov seznam se prav tako razširja s " -"programom %s. Za %s ni na voljo nikakršna garancija.

    " +msgid "%s is a messaging client based on libpurple which is capable of connecting to multiple messaging services at once. %s is written in C using GTK+. %s is released, and may be modified and redistributed, under the terms of the GPL version 2 (or later). A copy of the GPL is distributed with %s. %s is copyrighted by its contributors, a list of whom is also distributed with %s. There is no warranty for %s.

    " +msgstr "%s je odjemalec za neposredno sporočanje, ki se lahko hkrati povezuje z več storitvami sporočanja. %s je napisan v jeziku C s pomočjo Gtk+. %s je izdan in ga lahko spreminjate in razširjate pod pogoji licence GPL različice 2 (ali novejše). Kopija licence GPL se razširja s programom %s. %s je zaščitena znamka svojih avtorjev, njihov seznam se prav tako razširja s programom %s. Za %s ni na voljo nikakršna garancija.

    " #, c-format -msgid "" -"Helpful Resources
    \tWebsite
    \tFrequently Asked Questions
    \tIRC " -"Channel: #pidgin on irc.freenode.net
    \tXMPP MUC: devel@conference.pidgin." -"im

    " -msgstr "" -"Viri pomoči
    \tSpletno " -"mesto
    \tPogosto zastavljena vprašanja
    " -"\tKanal IRC: #pidgin na irc.freenode.net
    \tMUC XMPP: devel@conference." -"pidgin.im

    " +msgid "Helpful Resources
    \tWebsite
    \tFrequently Asked Questions
    \tIRC Channel: #pidgin on irc.freenode.net
    \tXMPP MUC: devel@conference.pidgin.im

    " +msgstr "Viri pomoči
    \tSpletno mesto
    \tPogosto zastavljena vprašanja
    \tKanal IRC: #pidgin na irc.freenode.net
    \tMUC XMPP: devel@conference.pidgin.im

    " #, c-format -msgid "" -"Help from other Pidgin users is available by " -"e-mailing support@pidgin.im
    This is a public mailing list! (archive)
    We can't help with third-party protocols or " -"plugins!
    This list's primary language is English. You are " -"welcome to post in another language, but the responses may be less helpful." -"
    " -msgstr "" -"Pomoč drugih uporabnikov Pidgina je na voljo " -"po e-pošti na support@pidgin.im
    To je javen dopisni seznam! (arhiv)
    Glede protokolov in vtičnikov drugih ne moremo " -"pomagati!
    Glavni jezik tega seznama je angleščina. Vabimo vas, da " -"objavite tudi v drugih jezikih, vendar bodo odgovori najbrž manj v pomoč.
    " +msgid "Help from other Pidgin users is available by e-mailing support@pidgin.im
    This is a public mailing list! (archive)
    We can't help with third-party protocols or plugins!
    This list's primary language is English. You are welcome to post in another language, but the responses may be less helpful.
    " +msgstr "Pomoč drugih uporabnikov Pidgina je na voljo po e-pošti na support@pidgin.im
    To je javen dopisni seznam! (arhiv)
    Glede protokolov in vtičnikov drugih ne moremo pomagati!
    Glavni jezik tega seznama je angleščina. Vabimo vas, da objavite tudi v drugih jezikih, vendar bodo odgovori najbrž manj v pomoč.
    " #, c-format msgid "About %s" @@ -12080,13 +11129,12 @@ msgstr "Nekdanji prevajalci" msgid "%s Translator Information" msgstr "Podatki o prevajalcih %s" -#, fuzzy, c-format +#, c-format msgid "%s Plugin Information" -msgstr "Podatki o gradnji %s" +msgstr "Podatki o vtičniku %s" -#, fuzzy msgid "Plugin Information" -msgstr "Prijavni podatki" +msgstr "Podatki o vtičniku" msgid "_Name" msgstr "_Ime" @@ -12097,22 +11145,12 @@ msgstr "_Račun" msgid "Get User Info" msgstr "Informacije o uporabniku" -msgid "" -"Please enter the username or alias of the person whose info you would like " -"to view." -msgstr "" -"Vnesite uporabniško ime ali psevdonim osebe, o kateri si želite ogledati " -"podatke." +msgid "Please enter the username or alias of the person whose info you would like to view." +msgstr "Vnesite uporabniško ime ali psevdonim osebe, o kateri si želite ogledati podatke." msgid "View User Log" msgstr "Prikaži uporabniški dnevnik" -msgid "Alias Contact" -msgstr "Psevdonim stika" - -msgid "Enter an alias for this contact." -msgstr "Vnesite psevdonim za ta pomenek." - #, c-format msgid "Enter an alias for %s." msgstr "Vnesite psevdonim za %s." @@ -12127,24 +11165,12 @@ msgid "Enter an alias for this chat." msgstr "Vnesite psevdonim za ta pomenek." #, c-format -msgid "" -"You are about to remove the contact containing %s and %d other buddy from " -"your buddy list. Do you want to continue?" -msgid_plural "" -"You are about to remove the contact containing %s and %d other buddies from " -"your buddy list. Do you want to continue?" -msgstr[0] "" -"S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d drugih " -"prijateljev. Ali želite nadaljevati?" -msgstr[1] "" -"S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d drugega " -"prijatelja. Ali želite nadaljevati?" -msgstr[2] "" -"S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d druga " -"prijatelja. Ali želite nadaljevati?" -msgstr[3] "" -"S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d druge " -"prijatelje. Ali želite nadaljevati?" +msgid "You are about to remove the contact containing %s and %d other buddy from your buddy list. Do you want to continue?" +msgid_plural "You are about to remove the contact containing %s and %d other buddies from your buddy list. Do you want to continue?" +msgstr[0] "S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d drugih prijateljev. Ali želite nadaljevati?" +msgstr[1] "S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d drugega prijatelja. Ali želite nadaljevati?" +msgstr[2] "S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d druga prijatelja. Ali želite nadaljevati?" +msgstr[3] "S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d druge prijatelje. Ali želite nadaljevati?" msgid "Remove Contact" msgstr "Odstrani stik" @@ -12153,9 +11179,7 @@ msgid "_Remove Contact" msgstr "_Odstrani stik" #, c-format -msgid "" -"You are about to merge the group called %s into the group called %s. Do you " -"want to continue?" +msgid "You are about to merge the group called %s into the group called %s. Do you want to continue?" msgstr "Skupino %s boste spojili v skupino %s. Ali želite nadaljevati?" msgid "Merge Groups" @@ -12165,11 +11189,8 @@ msgid "_Merge Groups" msgstr "_Spoji skupine" #, c-format -msgid "" -"You are about to remove the group %s and all its members from your buddy " -"list. Do you want to continue?" -msgstr "" -"S seznama prijateljev boste odstranili skupino %s. Ali želite nadaljevati?" +msgid "You are about to remove the group %s and all its members from your buddy list. Do you want to continue?" +msgstr "S seznama prijateljev boste odstranili skupino %s. Ali želite nadaljevati?" msgid "Remove Group" msgstr "Odstrani skupino" @@ -12178,8 +11199,7 @@ msgid "_Remove Group" msgstr "_Odstrani skupino" #, c-format -msgid "" -"You are about to remove %s from your buddy list. Do you want to continue?" +msgid "You are about to remove %s from your buddy list. Do you want to continue?" msgstr "Odstranili boste %s s seznama prijateljev. Ali želite nadaljevati?" msgid "Remove Buddy" @@ -12189,11 +11209,8 @@ msgid "_Remove Buddy" msgstr "_Odstrani prijatelja" #, c-format -msgid "" -"You are about to remove the chat %s from your buddy list. Do you want to " -"continue?" -msgstr "" -"S seznama prijateljev boste odstranili pomenek %s. Ali želite nadaljevati?" +msgid "You are about to remove the chat %s from your buddy list. Do you want to continue?" +msgstr "S seznama prijateljev boste odstranili pomenek %s. Ali želite nadaljevati?" msgid "Remove Chat" msgstr "Odstrani pomenek" @@ -12335,8 +11352,7 @@ msgid "\"Attention\" Name Color" msgstr "Ime barve \"Pozor\"" msgid "Color to draw the name of a message you received containing your name." -msgstr "" -"Barva za izris imena sporočila, ki ste ga prejeli in ki vsebuje vaše ime." +msgstr "Barva za izris imena sporočila, ki ste ga prejeli in ki vsebuje vaše ime." msgid "Action Message Name Color" msgstr "Ime barve sporočila dejanja" @@ -12414,9 +11430,7 @@ msgstr "_URL" msgid "_Description" msgstr "_Opis" -msgid "" -"Please enter the URL and description of the link that you want to insert. " -"The description is optional." +msgid "Please enter the URL and description of the link that you want to insert. The description is optional." msgstr "Vnesite URL in opis povezave, ki jo želite vstaviti. Opis ni obvezen." msgid "Please enter the URL of the link that you want to insert." @@ -12440,8 +11454,7 @@ msgid "" "This smiley is disabled because a custom smiley exists for this shortcut:\n" " %s" msgstr "" -"Ta smejček je onemogočen, ker za to kombinacijo tipk obstaja smejček po " -"meri:\n" +"Ta smejček je onemogočen, ker za to kombinacijo tipk obstaja smejček po meri:\n" " %s" msgid "Smile!" @@ -12553,28 +11566,16 @@ msgid "Check permissions and try again." msgstr "Preveri dovoljenja in poskusi znova." #, c-format -msgid "" -"Are you sure you want to permanently delete the log of the conversation with " -"%s which started at %s?" -msgstr "" -"Ste prepričani, da želite povsem izbrisati dnevnik klepeta z %s, ki se je " -"pričel ob %s?" +msgid "Are you sure you want to permanently delete the log of the conversation with %s which started at %s?" +msgstr "Ste prepričani, da želite povsem izbrisati dnevnik klepeta z %s, ki se je pričel ob %s?" #, c-format -msgid "" -"Are you sure you want to permanently delete the log of the conversation in " -"%s which started at %s?" -msgstr "" -"Ste prepričani, da želite povsem izbrisati dnevnik klepeta v %s, ki se je " -"pričel ob %s?" +msgid "Are you sure you want to permanently delete the log of the conversation in %s which started at %s?" +msgstr "Ste prepričani, da želite povsem izbrisati dnevnik klepeta v %s, ki se je pričel ob %s?" #, c-format -msgid "" -"Are you sure you want to permanently delete the system log which started at " -"%s?" -msgstr "" -"Ste prepričani, da želite povsem izbrisati sistemski dnevnik, ki se je " -"pričel ob %s?" +msgid "Are you sure you want to permanently delete the system log which started at %s?" +msgstr "Ste prepričani, da želite povsem izbrisati sistemski dnevnik, ki se je pričel ob %s?" msgid "Delete Log?" msgstr "Želite izbrisati dnevnik?" @@ -12636,8 +11637,7 @@ msgid "" " Without this only the first account will be enabled)." msgstr "" "omogoči naveden(e) račun(e) (neobvezen argument IME\n" -" določa račune, ki naj bodo uporabljeni, ločene z " -"vejicami;\n" +" določa račune, ki naj bodo uporabljeni, ločene z vejicami;\n" " brez tega bo omogočen le prvi račun)" msgid "X display to use" @@ -12694,9 +11694,18 @@ msgstr "%s želi z vami začeti video sejo." msgid "Incoming Call" msgstr "Dohodni klic" +msgid "_Hold" +msgstr "_Zadrži" + msgid "_Pause" msgstr "_Premor" +msgid "_Mute" +msgstr "_Nemo" + +msgid "Call in progress" +msgstr "Klic je v teku" + #, c-format msgid "%s has %d new message." msgid_plural "%s has %d new messages." @@ -12724,11 +11733,8 @@ msgstr "Ni bilo mogoče odprti URL" msgid "Error launching \"%s\": %s" msgstr "Napaka pri zagonu \"%s\": %s" -msgid "" -"The 'Manual' browser command has been chosen, but no command has been set." -msgstr "" -"Vašega brskalnika ni bilo mogoče zagnati, ker ste v nastavitvah izbrali " -"poljuben brskalnik, a niste nastavili ukaza." +msgid "The 'Manual' browser command has been chosen, but no command has been set." +msgstr "Vašega brskalnika ni bilo mogoče zagnati, ker ste v nastavitvah izbrali poljuben brskalnik, a niste nastavili ukaza." msgid "No message" msgstr "Ni sporočil" @@ -12753,8 +11759,7 @@ msgid "Dismiss" msgstr "Opusti" msgid "You have pounced!" -msgstr "" -"Dobili ste opozorilo prijatelja!" +msgstr "Dobili ste opozorilo prijatelja!" msgid "The following plugins will be unloaded." msgstr "Odloženi bodo naslednji vtičniki." @@ -12768,12 +11773,8 @@ msgstr "Odloži vtičnike" msgid "Could not unload plugin" msgstr "Vtičnika ni mogoče odložiti" -msgid "" -"The plugin could not be unloaded now, but will be disabled at the next " -"startup." -msgstr "" -"Vtičnika zdaj ni mogoče odložiti, vendar bo ob naslednjem zagonu programa " -"onemogočen." +msgid "The plugin could not be unloaded now, but will be disabled at the next startup." +msgstr "Vtičnika zdaj ni mogoče odložiti, vendar bo ob naslednjem zagonu programa onemogočen." #, c-format msgid "" @@ -12925,6 +11926,9 @@ msgstr "Privzeta zvočna tema za Pidgin" msgid "The default Pidgin buddy list theme" msgstr "Privzeta tema seznama prijateljev Pidgin" +msgid "The default Pidgin conversation theme" +msgstr "Privzeta tema pomenkov za Pidgin" + msgid "The default Pidgin status icon theme" msgstr "Privzeta tema ikon stanja za Pidgin" @@ -12943,8 +11947,7 @@ msgstr "Izbire tem" #. Instructions msgid "" "Select a theme that you would like to use from the lists below.\n" -"New themes can be installed by dragging and dropping them onto the theme " -"list." +"New themes can be installed by dragging and dropping them onto the theme list." msgstr "" "S spodnjega seznama izberite temo, ki jih želite uporabljati.\n" "Nove teme lahko namestite, če jih povlečete in spustite na seznam tem." @@ -12952,6 +11955,12 @@ msgstr "" msgid "Buddy List Theme:" msgstr "Tema seznama prijateljev:" +msgid "Conversation Theme:" +msgstr "Tema pomenkov:" + +msgid "\tVariant:" +msgstr "\tRazličica:" + msgid "Status Icon Theme:" msgstr "Tema ikon stanja:" @@ -13047,13 +12056,11 @@ msgstr "Uporabi animirano drsenje" msgid "F_lash window when IMs are received" msgstr "Utripaj z _oknom, ko prispe novo sporočilo" -#, fuzzy msgid "Resize incoming custom smileys" -msgstr "_Upravljaj s smejčki po meri" +msgstr "Spremeni velikost dohodnih smejčkov po meri" -#, fuzzy msgid "Maximum size:" -msgstr "Največji časovni zamik odziva:" +msgstr "Največja velikost:" msgid "Minimum input area height in lines:" msgstr "Najmanjša višina vnosne površine v vrsticah:" @@ -13070,12 +12077,8 @@ msgstr "_Pisava pogovora:" msgid "Default Formatting" msgstr "Privzeto oblikovanje" -msgid "" -"This is how your outgoing message text will appear when you use protocols " -"that support formatting." -msgstr "" -"Tako bo videti besedilo vašega odhodnega sporočila, če uporabljate " -"protokole, ki podpirajo oblikovanje." +msgid "This is how your outgoing message text will appear when you use protocols that support formatting." +msgstr "Tako bo videti besedilo vašega odhodnega sporočila, če uporabljate protokole, ki podpirajo oblikovanje." msgid "Cannot start proxy configuration program." msgstr "Konfiguracijskega programa za posredovalni strežnik ni mogoče zagnati." @@ -13124,9 +12127,8 @@ msgstr "Strežnik _TURN:" msgid "_UDP Port:" msgstr "Vrata _UDP:" -#, fuzzy msgid "T_CP Port:" -msgstr "Vrata _UDP:" +msgstr "Vrata T_CP:" msgid "Use_rname:" msgstr "Upo_rabniško ime:" @@ -13225,8 +12227,7 @@ msgid "Proxy preferences are configured in GNOME preferences" msgstr "Nastavitve posredovalnega strežnika določite v nastavitvah GNOME" msgid "Proxy configuration program was not found." -msgstr "" -"Konfiguracijskega programa posredovalnega strežnika ni mogoče najti." +msgstr "Konfiguracijskega programa posredovalnega strežnika ni mogoče najti." msgid "Configure _Proxy" msgstr "Prilagodi po_sredovalni strežnik" @@ -13400,8 +12401,7 @@ msgid "Type a user you permit to contact you." msgstr "Vpišite uporabnika, ki mu želiš dovoliti, da stopi v stik z vami." msgid "Please enter the name of the user you wish to be able to contact you." -msgstr "" -"Prosim vnesite ime uporabnika, ki mu želite omogočiti, da stopi v stik z vami" +msgstr "Prosim vnesite ime uporabnika, ki mu želite omogočiti, da stopi v stik z vami" msgid "_Permit" msgstr "_Dovoli" @@ -13489,8 +12489,7 @@ msgid "Status for %s" msgstr "Stanje za %s" #, c-format -msgid "" -"A custom smiley for '%s' already exists. Please use a different shortcut." +msgid "A custom smiley for '%s' already exists. Please use a different shortcut." msgstr "Smejček po meri za '%s' že obstaja. Navedite druge tipke za bližnjico." msgid "Custom Smiley" @@ -13560,20 +12559,14 @@ msgid "Cannot send folder %s." msgstr "Ni mogoče poslati mape %s." #, c-format -msgid "" -"%s cannot transfer a folder. You will need to send the files within " -"individually." +msgid "%s cannot transfer a folder. You will need to send the files within individually." msgstr "Mape %s ni mogoče prenesti. Datoteke boste morali poslati posamično." msgid "You have dragged an image" msgstr "Povlekli ste sliko" -msgid "" -"You can send this image as a file transfer, embed it into this message, or " -"use it as the buddy icon for this user." -msgstr "" -"To sliko lahko pošljete kot datoteko, jo vključite v to sporočilo ali " -"uporabite kot ikono za tega uporabnika." +msgid "You can send this image as a file transfer, embed it into this message, or use it as the buddy icon for this user." +msgstr "To sliko lahko pošljete kot datoteko, jo vključite v to sporočilo ali uporabite kot ikono za tega uporabnika." msgid "Set as buddy icon" msgstr "Nastavi kot ikono prijatelja" @@ -13587,19 +12580,11 @@ msgstr "Vstavi v sporočilo" msgid "Would you like to set it as the buddy icon for this user?" msgstr "Jo želite nastaviti za ikono prijatelja?" -msgid "" -"You can send this image as a file transfer, or use it as the buddy icon for " -"this user." -msgstr "" -"To sliko lahko pošljete kot datoteko ali uporabite kot ikono za tega " -"uporabnika." +msgid "You can send this image as a file transfer, or use it as the buddy icon for this user." +msgstr "To sliko lahko pošljete kot datoteko ali uporabite kot ikono za tega uporabnika." -msgid "" -"You can insert this image into this message, or use it as the buddy icon for " -"this user" -msgstr "" -"To sliko lahko vstavite v to sporočilo ali pa jo uporabite kot ikono " -"prijatelja za tega prijatelja" +msgid "You can insert this image into this message, or use it as the buddy icon for this user" +msgstr "To sliko lahko vstavite v to sporočilo ali pa jo uporabite kot ikono prijatelja za tega prijatelja" #. I don't know if we really want to do anything here. Most of #. * the desktop item types are crap like "MIME Type" (I have no @@ -13612,12 +12597,8 @@ msgstr "" msgid "Cannot send launcher" msgstr "Ni mogoče poslati zaganjalnika" -msgid "" -"You dragged a desktop launcher. Most likely you wanted to send the target of " -"this launcher instead of this launcher itself." -msgstr "" -"Povlekli ste namizni zaganjalnik. Najverjetneje ste želeli namesto samega " -"zaganjalnika poslati tisto, na kar ta zaganjalnik kaže." +msgid "You dragged a desktop launcher. Most likely you wanted to send the target of this launcher instead of this launcher itself." +msgstr "Povlekli ste namizni zaganjalnik. Najverjetneje ste želeli namesto samega zaganjalnika poslati tisto, na kar ta zaganjalnik kaže." #, c-format msgid "" @@ -13631,8 +12612,7 @@ msgstr "" #, c-format msgid "The file '%s' is too large for %s. Please try a smaller image.\n" -msgstr "" -"Datoteka '%s' je prevelika za %s. Prosimo, poskusite z manjšo sliko.\n" +msgstr "Datoteka '%s' je prevelika za %s. Prosimo, poskusite z manjšo sliko.\n" msgid "Icon Error" msgstr "Napaka ikone" @@ -13775,12 +12755,8 @@ msgstr "Prijatelj ni na zvezi" msgid "Point values to use when..." msgstr "Vrednosti točk, ko ..." -msgid "" -"The buddy with the largest score is the buddy who will have priority " -"in the contact.\n" -msgstr "" -"Prijatelj z največjim rezultatom je tisti, ki bo imel prioriteto pri " -"stiku.\n" +msgid "The buddy with the largest score is the buddy who will have priority in the contact.\n" +msgstr "Prijatelj z največjim rezultatom je tisti, ki bo imel prioriteto pri stiku.\n" msgid "Use last buddy when scores are equal" msgstr "Uporabi zadnjega prijatelja, ko so rezultati poravnani" @@ -13800,18 +12776,12 @@ msgstr "Prednost stika" #. *< name #. *< version #. *< summary -msgid "" -"Allows for controlling the values associated with different buddy states." -msgstr "" -"Omogoča nastavljanje vrednosti, povezanih z različnimi stanji prijateljev." +msgid "Allows for controlling the values associated with different buddy states." +msgstr "Omogoča nastavljanje vrednosti, povezanih z različnimi stanji prijateljev." #. *< description -msgid "" -"Allows for changing the point values of idle/away/offline states for buddies " -"in contact priority computations." -msgstr "" -"Omogoča nastavljanje vrednosti točk pri računanju prednosti stikov za stanja " -"prijateljev nedejaven/odsoten/ni na zvezi." +msgid "Allows for changing the point values of idle/away/offline states for buddies in contact priority computations." +msgstr "Omogoča nastavljanje vrednosti točk pri računanju prednosti stikov za stanja prijateljev nedejaven/odsoten/ni na zvezi." msgid "Conversation Colors" msgstr "Barve pogovora" @@ -13905,12 +12875,8 @@ msgstr "Odkrivanje storitev XMPP" msgid "Allows browsing and registering services." msgstr "Dovoljuje brskanje in registracijo storitev." -msgid "" -"This plugin is useful for registering with legacy transports or other XMPP " -"services." -msgstr "" -"Ta vtičnik je uporaben za registriranje z opuščenimi prenosi ali drugimi " -"storitvami XMPP." +msgid "This plugin is useful for registering with legacy transports or other XMPP services." +msgstr "Ta vtičnik je uporaben za registriranje z opuščenimi prenosi ali drugimi storitvami XMPP." msgid "By conversation count" msgstr "Po številu pomenkov" @@ -13919,12 +12885,8 @@ msgid "Conversation Placement" msgstr "Postavitev pomenkov" #. Translators: "New conversations" should match the text in the preferences dialog and "By conversation count" should be the same text used above -msgid "" -"Note: The preference for \"New conversations\" must be set to \"By " -"conversation count\"." -msgstr "" -"Opomba: Nastavitev za \"Nove pomenke\" mora biti nastavljena na \"Po številu " -"pomenkov\"." +msgid "Note: The preference for \"New conversations\" must be set to \"By conversation count\"." +msgstr "Opomba: Nastavitev za \"Nove pomenke\" mora biti nastavljena na \"Po številu pomenkov\"." msgid "Number of conversations per window" msgstr "Število pomenkov v oknu" @@ -13948,12 +12910,8 @@ msgstr "Dodatne možnosti postavitve pomenka." #. *< summary #. * description -msgid "" -"Restrict the number of conversations per windows, optionally separating IMs " -"and Chats" -msgstr "" -"Omeji število pomenkov po oknih z možnostjo ločitve oken za klepet in " -"zasebni pomenek" +msgid "Restrict the number of conversations per windows, optionally separating IMs and Chats" +msgstr "Omeji število pomenkov po oknih z možnostjo ločitve oken za klepet in zasebni pomenek" #. Configuration frame msgid "Mouse Gestures Configuration" @@ -13986,14 +12944,12 @@ msgstr "Omogoča podporo za geste miške" #. * description msgid "" -"Allows support for mouse gestures in conversation windows. Drag the middle " -"mouse button to perform certain actions:\n" +"Allows support for mouse gestures in conversation windows. Drag the middle mouse button to perform certain actions:\n" " • Drag down and then to the right to close a conversation.\n" " • Drag up and then to the left to switch to the previous conversation.\n" " • Drag up and then to the right to switch to the next conversation." msgstr "" -"Omogoča podporo za geste miške v pogovornih oknih. Povlecite s srednjo " -"miškino tipko, da storite naslednje:\n" +"Omogoča podporo za geste miške v pogovornih oknih. Povlecite s srednjo miškino tipko, da storite naslednje:\n" " • Povlecite navzdol in zatem desno, da končate pogovor.\n" " • Povlecite navzgor in zatem levo, da se vrnete k prejšnjemu pogovoru.\n" " Povlecite navzgor in zatem desno, da se premaknete k naslednjemu pogovoru." @@ -14017,12 +12973,8 @@ msgid "Select Buddy" msgstr "Izberi prijatelja" #. Add the label. -msgid "" -"Select a person from your address book to add this buddy to, or create a new " -"person." -msgstr "" -"Izberite osebo iz vašega adresarja, ki ji želite dodati tega prijatelja, ali " -"ustvarite novo osebo." +msgid "Select a person from your address book to add this buddy to, or create a new person." +msgstr "Izberite osebo iz vašega adresarja, ki ji želite dodati tega prijatelja, ali ustvarite novo osebo." #. Add the expander msgid "User _details" @@ -14143,8 +13095,7 @@ msgid "Checks for new local mail." msgstr "Preveri morebitno novoprispelo pošto." msgid "Adds a small box to the buddy list that shows if you have new mail." -msgstr "" -"Doda majhno škatlo na seznam prijateljev, ki prikazuje, ali imate novo pošto." +msgstr "Doda majhno škatlo na seznam prijateljev, ki prikazuje, ali imate novo pošto." msgid "Markerline" msgstr "Označevalna črta" @@ -14164,12 +13115,8 @@ msgstr "oknih _neposrednih pogovorov" msgid "C_hat windows" msgstr "_pogovornih oknih" -msgid "" -"A music messaging session has been requested. Please click the MM icon to " -"accept." -msgstr "" -"Zahtevana je seja glasbenega sporočanja. Prosimo, kliknite ikono MM za " -"sprejem." +msgid "A music messaging session has been requested. Please click the MM icon to accept." +msgstr "Zahtevana je seja glasbenega sporočanja. Prosimo, kliknite ikono MM za sprejem." msgid "Music messaging session confirmed." msgstr "Seja glasbenega sporočanja potrjena." @@ -14208,12 +13155,8 @@ msgid "Music Messaging Plugin for collaborative composition." msgstr "Vtičnik za glasbeno sporočanje - za skupinsko skladanje." #. * summary -msgid "" -"The Music Messaging Plugin allows a number of users to simultaneously work " -"on a piece of music by editing a common score in real-time." -msgstr "" -"Vtičnik za glasbeno sporočanje omogoča več uporabnikom hkratno sodelovanje " -"pri glasbenem ustvarjanju kompozicije v resničnem času." +msgid "The Music Messaging Plugin allows a number of users to simultaneously work on a piece of music by editing a common score in real-time." +msgstr "Vtičnik za glasbeno sporočanje omogoča več uporabnikom hkratno sodelovanje pri glasbenem ustvarjanju kompozicije v resničnem času." #. ---------- "Notify For" ---------- msgid "Notify For" @@ -14411,13 +13354,8 @@ msgstr "Direktno" msgid "Lets you send raw input to text-based protocols." msgstr "Omogoča neposreden vnos v protokole." -msgid "" -"Lets you send raw input to text-based protocols (XMPP, MSN, IRC, TOC). Hit " -"'Enter' in the entry box to send. Watch the debug window." -msgstr "" -"Omogoča pošiljanje golih ukazov za protokole, ki temeljijo na besedilu " -"(XMPP, MSN, IRC, TOC). Pritisnite 'Enter' za pošiljanje in opazujte " -"razhroščevalno okno." +msgid "Lets you send raw input to text-based protocols (XMPP, MSN, IRC, TOC). Hit 'Enter' in the entry box to send. Watch the debug window." +msgstr "Omogoča pošiljanje golih ukazov za protokole, ki temeljijo na besedilu (XMPP, MSN, IRC, TOC). Pritisnite 'Enter' za pošiljanje in opazujte razhroščevalno okno." #, c-format msgid "You can upgrade to %s %s today." @@ -14448,12 +13386,8 @@ msgid "Checks periodically for new releases." msgstr "Preverjaj, ali je na voljo nova različica." #. * description -msgid "" -"Checks periodically for new releases and notifies the user with the " -"ChangeLog." -msgstr "" -"Preverja, ali je na voljo nova različica in uporabika seznanja z dnevnikom " -"sprememb." +msgid "Checks periodically for new releases and notifies the user with the ChangeLog." +msgstr "Preverja, ali je na voljo nova različica in uporabika seznanja z dnevnikom sprememb." #. *< major version #. *< minor version @@ -14472,12 +13406,8 @@ msgid "Conversation Window Send Button." msgstr "Gumb Pošlji okna pogovora" #. *< summary -msgid "" -"Adds a Send button to the entry area of the conversation window. Intended " -"for use when no physical keyboard is present." -msgstr "" -"Doda gumb Pošlji v vnosno območje pogovornega okna. Namenjeno za primere, ko " -"tipkovnica ni fizično prisotna." +msgid "Adds a Send button to the entry area of the conversation window. Intended for use when no physical keyboard is present." +msgstr "Doda gumb Pošlji v vnosno območje pogovornega okna. Namenjeno za primere, ko tipkovnica ni fizično prisotna." msgid "Duplicate Correction" msgstr "Popravek dvojnikov" @@ -14511,8 +13441,7 @@ msgstr "Jaz _pošljem:" #. Created here so it can be passed to whole_words_button_toggled. msgid "_Exact case match (uncheck for automatic case handling)" -msgstr "" -"_Natanko ujemanje velikih in malih črk (ne označi za samodejno ravnanje)" +msgstr "_Natanko ujemanje velikih in malih črk (ne označi za samodejno ravnanje)" msgid "Only replace _whole words" msgstr "Zamenjaj le _cele besede" @@ -14527,8 +13456,7 @@ msgid "Text replacement" msgstr "Zamenjava besedila" msgid "Replaces text in outgoing messages according to user-defined rules." -msgstr "" -"Zamenja besedilo v odhodnih sporočilih po uporabniško določenih pravilih." +msgstr "Zamenja besedilo v odhodnih sporočilih po uporabniško določenih pravilih." msgid "Just logged in" msgstr "Ravnokar prijavljen" @@ -14707,12 +13635,8 @@ msgid "Customizes the message timestamp formats." msgstr "Prilagodi oblike časovnega žiga sporočil po meri." #. * description -msgid "" -"This plugin allows the user to customize conversation and logging message " -"timestamp formats." -msgstr "" -"Ta vtičnik omogoča uporabniku prilagajati zapis časovnega žiga pogovorov in " -"dnevniških sporočil." +msgid "This plugin allows the user to customize conversation and logging message timestamp formats." +msgstr "Ta vtičnik omogoča uporabniku prilagajati zapis časovnega žiga pogovorov in dnevniških sporočil." msgid "Audio" msgstr "Zvok" @@ -14738,23 +13662,21 @@ msgstr "V_tičnik" msgid "D_evice" msgstr "N_aprava" +#, fuzzy msgid "DROP" -msgstr "" +msgstr "PREKINI / VRZI DOL" -#, fuzzy msgid "Volume:" -msgstr "_Glasnost:" +msgstr "Glasnost:" -#, fuzzy msgid "Silence threshold:" -msgstr "Prag:" +msgstr "Prag tišine:" msgid "Input and Output Settings" -msgstr "" +msgstr "Vhodne in izhodne nastavitve" -#, fuzzy msgid "Microphone Test" -msgstr "Mikrofon" +msgstr "Preizkus mikrofona" #. *< magic #. *< major version @@ -14775,9 +13697,7 @@ msgstr "Prilagodite svoj mikrofon in spletno kamero." #. *< summary msgid "Configure microphone and webcam settings for voice/video calls." -msgstr "" -"Prilagodite nastavitve za mikrofon in spletno kamero za zvočne oz. video " -"klice." +msgstr "Prilagodite nastavitve za mikrofon in spletno kamero za zvočne oz. video klice." msgid "Opacity:" msgstr "Neprosojnost:" @@ -14825,13 +13745,11 @@ msgstr "Poljubna prosojnost seznama prijateljev in pomenkov." #. * description msgid "" -"This plugin enables variable alpha transparency on conversation windows and " -"the buddy list.\n" +"This plugin enables variable alpha transparency on conversation windows and the buddy list.\n" "\n" "* Note: This plugin requires Win2000 or greater." msgstr "" -"Ta vtičnik omogoči poljubno nastavitev prosojnosti pogovornih oken in " -"seznama prijateljev.\n" +"Ta vtičnik omogoči poljubno nastavitev prosojnosti pogovornih oken in seznama prijateljev.\n" "\n" "* Pozor: Ta vtičnik zahteva Win2000 ali novejše." @@ -14863,11 +13781,8 @@ msgstr "Možnosti Pidgin za okolje Windows" msgid "Options specific to Pidgin for Windows." msgstr "Nastavitve, specifične za %s v okolju Windows." -msgid "" -"Provides options specific to Pidgin for Windows, such as buddy list docking." -msgstr "" -"Ponuja nastavitve, specifične za Pidgin v okolju Windows, kot je sidranje " -"seznama prijateljev." +msgid "Provides options specific to Pidgin for Windows, such as buddy list docking." +msgstr "Ponuja nastavitve, specifične za Pidgin v okolju Windows, kot je sidranje seznama prijateljev." msgid "Logged out." msgstr "Odjavljeni." @@ -14895,27 +13810,18 @@ msgstr "Pošlijaj in sprejemaj surove vrstice XMPP." #. * description msgid "This plugin is useful for debugging XMPP servers or clients." -msgstr "" -"Ta vtičnik je uporaben za razhroščevanje strežnikov ali odjemalcev XMPP." +msgstr "Ta vtičnik je uporaben za razhroščevanje strežnikov ali odjemalcev XMPP." #. $(^Name) is the current Version name (e.g. Pidgin 2.7.0). $_CLICK will become a translated version of "Click Next to continue." DO NOT translate the CLICK in $_CLICK. It will break the installer. -msgid "" -"$(^Name) is released under the GNU General Public License (GPL). The license " -"is provided here for information purposes only. $_CLICK" -msgstr "" -"$(^Name) je izdan pod licenco GPL. Ta licenca je tu na voljo le v " -"informativne namene. $_CLICK" +msgid "$(^Name) is released under the GNU General Public License (GPL). The license is provided here for information purposes only. $_CLICK" +msgstr "$(^Name) je izdan pod licenco GPL. Ta licenca je tu na voljo le v informativne namene. $_CLICK" #. Installer Subsection Detailed Description msgid "A multi-platform GUI toolkit, used by Pidgin" msgstr "Več-platformsko orodje za vmesnike, ki ga uporablja Pidgin" -msgid "" -"An instance of Pidgin is currently running. Please exit Pidgin and try " -"again." -msgstr "" -"Trenutno že teče ena različica Pidgina. Prosimo, zaprite aplikacijo in " -"poskusite znova." +msgid "An instance of Pidgin is currently running. Please exit Pidgin and try again." +msgstr "Trenutno že teče ena različica Pidgina. Prosimo, zaprite aplikacijo in poskusite znova." #. Installer Subsection Detailed Description msgid "Core Pidgin files and dlls" @@ -14938,34 +13844,17 @@ msgid "Desktop" msgstr "Namizje" #. $R2 will display the URL that the GTK+ Runtime failed to download from -msgid "" -"Error Downloading the GTK+ Runtime ($R2).$\\rThis is required for Pidgin to " -"function; if retrying fails, you may need to use the 'Offline Installer' " -"from http://pidgin.im/download/windows/ ." -msgstr "" -"Napaka pri prenašanju izvajalnega okolja GTK+ ($R2).$\\rTa je potreben za " -"delovanje Pidgina; če ponoven poskus ne uspe, boste morali uporabiti 'polni " -"namestitveni paket' z naslova http://pidgin.im/download/windows/" +msgid "Error Downloading the GTK+ Runtime ($R2).$\\rThis is required for Pidgin to function; if retrying fails, you may need to use the 'Offline Installer' from http://pidgin.im/download/windows/ ." +msgstr "Napaka pri prenašanju izvajalnega okolja GTK+ ($R2).$\\rTa je potreben za delovanje Pidgina; če ponoven poskus ne uspe, boste morali uporabiti 'polni namestitveni paket' z naslova http://pidgin.im/download/windows/" #. $R2 will display the URL that the Debug Symbols failed to download from -msgid "" -"Error Installing Debug Symbols ($R2).$\\rIf retrying fails, you may need to " -"use the 'Offline Installer' from http://pidgin.im/download/windows/ ." -msgstr "" -"Napaka pri nameščanju simbolov razhroščevanja ($R2).$\\rČe ponoven poskus ne " -"uspe, boste morali uporabiti 'polni namestitveni paket' z naslova http://" -"pidgin.im/download/windows/" +msgid "Error Installing Debug Symbols ($R2).$\\rIf retrying fails, you may need to use the 'Offline Installer' from http://pidgin.im/download/windows/ ." +msgstr "Napaka pri nameščanju simbolov razhroščevanja ($R2).$\\rČe ponoven poskus ne uspe, boste morali uporabiti 'polni namestitveni paket' z naslova http://pidgin.im/download/windows/" #. $R3 will display the URL that the Dictionary failed to download from #, no-c-format -msgid "" -"Error Installing Spellchecking ($R3).$\\rIf retrying fails, manual " -"installation instructions are at: http://developer.pidgin.im/wiki/Installing" -"%20Pidgin#manual_win32_spellcheck_installation" -msgstr "" -"Napaka pri nameščanju preverjanja črkovanja ($R3).$\\rČe ponovni poskus ne " -"uspe, najdete navodila za ročno namestitev na naslovu: http://developer." -"pidgin.im/wiki/Installing%20Pidgin#manual_win32_spellcheck_installation" +msgid "Error Installing Spellchecking ($R3).$\\rIf retrying fails, manual installation instructions are at: http://developer.pidgin.im/wiki/Installing%20Pidgin#manual_win32_spellcheck_installation" +msgstr "Napaka pri nameščanju preverjanja črkovanja ($R3).$\\rČe ponovni poskus ne uspe, najdete navodila za ročno namestitev na naslovu: http://developer.pidgin.im/wiki/Installing%20Pidgin#manual_win32_spellcheck_installation" #. Installer Subsection Text msgid "GTK+ Runtime (required if not present)" @@ -14983,13 +13872,8 @@ msgstr "Naprej >" msgid "Pidgin Instant Messaging Client (required)" msgstr "Pidgin - odjemalec za klepet (zahtevano)" -msgid "" -"Pidgin requires a compatible GTK+ Runtime (which doesn't appear to be " -"already present).$\\rAre you sure you want to skip installing the GTK+ " -"Runtime?" -msgstr "" -"Pidgin potrebuje združljivo izvajalno okolje GTK+ (ki očitno ni na voljo).$" -"\\rSte prepričani, da želite preskočiti nameščanje izvajalnega okolja GTK+?" +msgid "Pidgin requires a compatible GTK+ Runtime (which doesn't appear to be already present).$\\rAre you sure you want to skip installing the GTK+ Runtime?" +msgstr "Pidgin potrebuje združljivo izvajalno okolje GTK+ (ki očitno ni na voljo).$\\rSte prepričani, da želite preskočiti nameščanje izvajalnega okolja GTK+?" #. Installer Subsection Text msgid "Shortcuts" @@ -15008,31 +13892,21 @@ msgid "Start Menu" msgstr "Začetni meni" #. Installer Subsection Detailed Description -msgid "" -"Support for Spellchecking. (Internet connection required for installation)" -msgstr "" -"Podpora preverjanja črkovanja. (Za namestitev je potrebna spletna povezava)" +msgid "Support for Spellchecking. (Internet connection required for installation)" +msgstr "Podpora preverjanja črkovanja. (Za namestitev je potrebna spletna povezava)" msgid "The installer is already running." msgstr "Nameščanje že poteka." -msgid "" -"The uninstaller could not find registry entries for Pidgin.$\\rIt is likely " -"that another user installed this application." -msgstr "" -"Vnosov za Pidgin v registru ni mogoče najti.$\\rNajverjetneje je ta program " -"namestil drug uporabnik." +msgid "The uninstaller could not find registry entries for Pidgin.$\\rIt is likely that another user installed this application." +msgstr "Vnosov za Pidgin v registru ni mogoče najti.$\\rNajverjetneje je ta program namestil drug uporabnik." #. Installer Subsection Text msgid "URI Handlers" msgstr "Upravljalnik URI" -msgid "" -"Unable to uninstall the currently installed version of Pidgin. The new " -"version will be installed without removing the currently installed version." -msgstr "" -"Trenutno nameščene različice Pidgina ni mogoče odstraniti. Nova različica bo " -"nameščena brez odstranitve trenutno nameščene različice." +msgid "Unable to uninstall the currently installed version of Pidgin. The new version will be installed without removing the currently installed version." +msgstr "Trenutno nameščene različice Pidgina ni mogoče odstraniti. Nova različica bo nameščena brez odstranitve trenutno nameščene različice." #. Text displayed on Installer Finish Page msgid "Visit the Pidgin Web Page" @@ -15041,653 +13915,3 @@ msgstr "Obiščite spletno stran Pidgin" msgid "You do not have permission to uninstall this application." msgstr "Za odstranitev programa nimate ustreznih pravic." -#~ msgid "Authorization Request Message:" -#~ msgstr "Sporočilo o zahtevi po pooblastilu:" - -#~ msgid "Please authorize me!" -#~ msgstr "Prosim za pooblastilo!" - -#~ msgid "Your UID" -#~ msgstr "Vaš UID" - -#~ msgid "Hide my number" -#~ msgstr "Skrij mojo številko" - -#~ msgid "Here you can update your MXit profile" -#~ msgstr "Tukaj lahko posodobite svoj profil MXit" - -#~ msgid "Aquarius" -#~ msgstr "Vodnar" - -#~ msgid "Pisces" -#~ msgstr "Ribi" - -#~ msgid "Aries" -#~ msgstr "Oven" - -#~ msgid "Taurus" -#~ msgstr "Bik" - -#~ msgid "Gemini" -#~ msgstr "Dvojčka" - -#~ msgid "Cancer" -#~ msgstr "Rak" - -#~ msgid "Leo" -#~ msgstr "Lev" - -#~ msgid "Virgo" -#~ msgstr "Devica" - -#~ msgid "Libra" -#~ msgstr "Tehtnica" - -#~ msgid "Scorpio" -#~ msgstr "Škorpijon" - -#~ msgid "Sagittarius" -#~ msgstr "Strelec" - -#~ msgid "Capricorn" -#~ msgstr "Kozorog" - -#~ msgid "Rat" -#~ msgstr "Podgana" - -#~ msgid "Ox" -#~ msgstr "Govedo" - -#~ msgid "Tiger" -#~ msgstr "Tiger" - -#~ msgid "Rabbit" -#~ msgstr "Zajec" - -#~ msgid "Dragon" -#~ msgstr "Zmaj" - -#~ msgid "Snake" -#~ msgstr "Kača" - -#~ msgid "Horse" -#~ msgstr "Konj" - -#~ msgid "Goat" -#~ msgstr "Koza" - -#~ msgid "Monkey" -#~ msgstr "Opica" - -#~ msgid "Rooster" -#~ msgstr "Petelin" - -#~ msgid "Dog" -#~ msgstr "Pes" - -#~ msgid "Pig" -#~ msgstr "Prašič" - -#~ msgid "Visible" -#~ msgstr "Viden" - -#~ msgid "Friend Only" -#~ msgstr "Samo za prijatelje" - -#~ msgid "Private" -#~ msgstr "Zasebno" - -#~ msgid "QQ Number" -#~ msgstr "Številka QQ" - -#~ msgid "Country/Region" -#~ msgstr "Država/Regija" - -#~ msgid "Province/State" -#~ msgstr "Pokrajina/Zv. država" - -#~ msgid "Zipcode" -#~ msgstr "Poštna številka" - -#~ msgid "Phone Number" -#~ msgstr "Telefonska št." - -#~ msgid "Authorize adding" -#~ msgstr "Overi dodajanje" - -#~ msgid "Cellphone Number" -#~ msgstr "Mobilna št." - -#~ msgid "Personal Introduction" -#~ msgstr "Osebna predstavitev" - -#~ msgid "City/Area" -#~ msgstr "Kraj/območje" - -#~ msgid "Publish Mobile" -#~ msgstr "Objavi mobilni tel." - -#~ msgid "Publish Contact" -#~ msgstr "Objavi stik" - -#~ msgid "College" -#~ msgstr "Srednja šola" - -#~ msgid "Horoscope" -#~ msgstr "Horoskop" - -#~ msgid "Zodiac" -#~ msgstr "Znamenje horoskopa" - -#~ msgid "Blood" -#~ msgstr "Krvna skupina" - -#~ msgid "True" -#~ msgstr "Drži" - -#~ msgid "False" -#~ msgstr "Ne drži" - -#~ msgid "Modify Contact" -#~ msgstr "Spremeni stik" - -#~ msgid "Modify Address" -#~ msgstr "Spremeni naslov" - -#~ msgid "Modify Extended Information" -#~ msgstr "Spremeni razširjene podatke" - -#~ msgid "Modify Information" -#~ msgstr "Spremeni podatke" - -#~ msgid "Update" -#~ msgstr "Posodobi" - -#~ msgid "Could not change buddy information." -#~ msgstr "Podatkov o prijatelju ni mogoče spremeniti." - -#~ msgid "Buddy Memo" -#~ msgstr "Zapisek prijatelja" - -#~ msgid "Change his/her memo as you like" -#~ msgstr "Spremenite njegov/njen zapisek, kakor vam je drago" - -#~ msgid "_Modify" -#~ msgstr "_Spremeni" - -#~ msgid "Memo Modify" -#~ msgstr "Spremeni zapisek" - -#~ msgid "Server says:" -#~ msgstr "Strežnik pravi:" - -#~ msgid "Your request was accepted." -#~ msgstr "Vaša zahteva je bila sprejeta." - -#~ msgid "Your request was rejected." -#~ msgstr "Vaša zahteva je bila zavrnjena." - -#~ msgid "%u requires verification: %s" -#~ msgstr "%u zahteva preverjanje: %s" - -#~ msgid "Add buddy question" -#~ msgstr "Dodaj vprašanje za prijatelja" - -#~ msgid "Enter answer here" -#~ msgstr "Vnesite odgovor tukaj" - -#~ msgid "Send" -#~ msgstr "Pošlji" - -#~ msgid "Invalid answer." -#~ msgstr "Neveljaven odgovor." - -#~ msgid "Sorry, you're not my style." -#~ msgstr "Oprosti, nisi moj tip." - -#~ msgid "%u needs authorization" -#~ msgstr "%u potrebuje overitev" - -#~ msgid "Add buddy authorize" -#~ msgstr "Dodaj overitev prijatelja" - -#~ msgid "Enter request here" -#~ msgstr "Vnesite zahtevo tukaj" - -#~ msgid "Would you be my friend?" -#~ msgstr "Bi bil moj prijatelj?" - -#~ msgid "QQ Buddy" -#~ msgstr "Prijatelj QQ" - -#~ msgid "Add buddy" -#~ msgstr "Dodaj prijatelja" - -#~ msgid "Invalid QQ Number" -#~ msgstr "Neveljavna številka QQ" - -#~ msgid "Failed sending authorize" -#~ msgstr "Neuspelo pošiljanje overitve" - -#~ msgid "Failed removing buddy %u" -#~ msgstr "Prijatelja %u ni bilo mogoče odstraniti" - -#~ msgid "Failed removing me from %d's buddy list" -#~ msgstr "%d vas ni uspel odstraniti s svojega seznama prijateljev" - -#~ msgid "No reason given" -#~ msgstr "Ni podanega razloga" - -#~ msgid "You have been added by %s" -#~ msgstr "Uporabnik %s vas je dodal" - -#~ msgid "Would you like to add him?" -#~ msgstr "Ga želite dodati?" - -#~ msgid "Rejected by %s" -#~ msgstr "Zavrnil vas je %s" - -#~ msgid "Message: %s" -#~ msgstr "Sporočilo: %s" - -#~ msgid "ID: " -#~ msgstr "ID:" - -#~ msgid "Group ID" -#~ msgstr "ID skupine" - -#~ msgid "QQ Qun" -#~ msgstr "QQ Qun" - -#~ msgid "Please enter Qun number" -#~ msgstr "Prosimo, vnesite številko Qun" - -#~ msgid "You can only search for permanent Qun\n" -#~ msgstr "Iščete lahko samo stalne Qune\n" - -#~ msgid "(Invalid UTF-8 string)" -#~ msgstr "(neveljaven niz UTF-8)" - -#~ msgid "Not member" -#~ msgstr "Nisem član(-ica)" - -#~ msgid "Member" -#~ msgstr "Član(ica)" - -#~ msgid "Requesting" -#~ msgstr "Zahteva v teku" - -#~ msgid "Admin" -#~ msgstr "Upravitelj" - -#~ msgid "Room Title" -#~ msgstr "Ime sobe" - -#~ msgid "Notice" -#~ msgstr "Obvestilo" - -#~ msgid "Detail" -#~ msgstr "Podrobno" - -#~ msgid "Creator" -#~ msgstr "Avtor" - -#~ msgid "Category" -#~ msgstr "Kategorija" - -#~ msgid "The Qun does not allow others to join" -#~ msgstr "Ta Qun ne dovoljuje novih članov" - -#~ msgid "Join QQ Qun" -#~ msgstr "Pridruži se QQ Qun" - -#~ msgid "Input request here" -#~ msgstr "Vnesite zahtevo tukaj" - -#~ msgid "Successfully joined Qun %s (%u)" -#~ msgstr "Uspešno ste se pridružili Qunu %s (%u)" - -#~ msgid "Successfully joined Qun" -#~ msgstr "Uspešno ste se pridružili Qunu" - -#~ msgid "Qun %u denied from joining" -#~ msgstr "Qun %u - zavrnjeno pridruževanje" - -#~ msgid "QQ Qun Operation" -#~ msgstr "Operacija QQ Qun" - -#~ msgid "Failed:" -#~ msgstr "Neuspeh:" - -#~ msgid "Join Qun, Unknown Reply" -#~ msgstr "Pridruževanje Qun, neznan odgovor" - -#~ msgid "Quit Qun" -#~ msgstr "Zapusti Qun" - -#~ msgid "" -#~ "Note, if you are the creator, \n" -#~ "this operation will eventually remove this Qun." -#~ msgstr "" -#~ "Če ste ustvarjalec, upoštevajte: \n" -#~ "ta operacija bo spotoma odstranila ta Qun." - -#~ msgid "Sorry, you are not our style" -#~ msgstr "Oprosti, nisi naš tip ..." - -#~ msgid "Successfully changed Qun members" -#~ msgstr "Uspešno ste spremenili člane Qun" - -#~ msgid "Successfully changed Qun information" -#~ msgstr "Uspešno ste spremenili podatke Qun" - -#~ msgid "You have successfully created a Qun" -#~ msgstr "Uspešno ste ustvarili Qun" - -#~ msgid "Would you like to set up detailed information now?" -#~ msgstr "Želite zdaj nastaviti podrobnosti?" - -#~ msgid "Setup" -#~ msgstr "Namestitev" - -#~ msgid "%u requested to join Qun %u for %s" -#~ msgstr "Uporabnik %u se želi pridružiti Qun %u za %s" - -#~ msgid "%u request to join Qun %u" -#~ msgstr "Uporabnik %u se želi pridružiti Qunu %u" - -#~ msgid "Failed to join Qun %u, operated by admin %u" -#~ msgstr "Qunu %u se ni bilo mogoče pridružiti, z njim upravlja %u" - -#~ msgid "Joining Qun %u is approved by admin %u for %s" -#~ msgstr "Upravitelj %u je odobril pridruževanje Qunu %u za %s" - -#~ msgid "Removed buddy %u." -#~ msgstr "Prijatelj %u odstranjen." - -#~ msgid "New buddy %u joined." -#~ msgstr "Pridružil se nam je nov prijatelj %u." - -#~ msgid "Unknown-%d" -#~ msgstr "Neznano-%d" - -#~ msgid "Level" -#~ msgstr "Raven" - -#~ msgid " VIP" -#~ msgstr " VIP" - -#~ msgid " TCP" -#~ msgstr " TCP" - -#~ msgid " FromMobile" -#~ msgstr " zMobilca" - -#~ msgid " BindMobile" -#~ msgstr " vezaniMobilec" - -#~ msgid " Video" -#~ msgstr " Video" - -#~ msgid " Zone" -#~ msgstr " Območje" - -#~ msgid "Flag" -#~ msgstr "Zastavica" - -#~ msgid "Ver" -#~ msgstr "Razl" - -#~ msgid "Invalid name" -#~ msgstr "Neveljavno ime" - -#~ msgid "Select icon..." -#~ msgstr "Izberite ikono ..." - -#~ msgid "Login time: %d-%d-%d, %d:%d:%d
    \n" -#~ msgstr "Čas prijave: %d-%d-%d, %d:%d:%d
    \n" - -#~ msgid "Total Online Buddies: %d
    \n" -#~ msgstr "Skupaj povezanih prijateljev: %d
    \n" - -#~ msgid "Last Refresh: %d-%d-%d, %d:%d:%d
    \n" -#~ msgstr "Zadnja osvežitev: %d-%d-%d, %d:%d:%d
    \n" - -#~ msgid "Server: %s
    \n" -#~ msgstr "Strežnik: %s
    \n" - -#~ msgid "Client Tag: %s
    \n" -#~ msgstr "Značka odjemalca: %s
    \n" - -#~ msgid "Connection Mode: %s
    \n" -#~ msgstr "Način povezovanja: %s
    \n" - -#~ msgid "My Internet IP: %s:%d
    \n" -#~ msgstr "Moj internetni IP: %s:%d
    \n" - -#~ msgid "Sent: %lu
    \n" -#~ msgstr "Poslano: %lu
    \n" - -#~ msgid "Resend: %lu
    \n" -#~ msgstr "Ponovno pošlji: %lu
    \n" - -#~ msgid "Lost: %lu
    \n" -#~ msgstr "Izgubljeno: %lu
    \n" - -#~ msgid "Received: %lu
    \n" -#~ msgstr "Prejeto: %lu
    \n" - -#~ msgid "Received Duplicate: %lu
    \n" -#~ msgstr "Prejeti dvojnik: %lu
    \n" - -#~ msgid "Time: %d-%d-%d, %d:%d:%d
    \n" -#~ msgstr "Čas: %d-%d-%d, %d:%d:%d
    \n" - -#~ msgid "IP: %s
    \n" -#~ msgstr "IP: %s
    \n" - -#~ msgid "

    Original Author:
    \n" -#~ msgstr "

    Prvotni avtor:
    \n" - -#~ msgid "

    Code Contributors:
    \n" -#~ msgstr "

    Kodo so prispevali:
    \n" - -#~ msgid "

    Lovely Patch Writers:
    \n" -#~ msgstr "

    Nori razvijalci obližev:
    \n" - -#~ msgid "

    Acknowledgement:
    \n" -#~ msgstr "Zahvale:
    \n" - -#~ msgid "

    Scrupulous Testers:
    \n" -#~ msgstr "

    Tankovestni preizkuševalci:
    \n" - -#~ msgid "and more, please let me know... thank you!))" -#~ msgstr "in drugi, prosim, javite se ... hvala!))" - -#~ msgid "

    And, all the boys in the backroom...
    \n" -#~ msgstr "

    In vsi fantje iz ozadja ...
    \n" - -#~ msgid "Feel free to join us! :)" -#~ msgstr "Pridružite se nam! :)" - -#~ msgid "About OpenQ %s" -#~ msgstr "O OpenQ %s" - -#~ msgid "Change Password" -#~ msgstr "Spremeni geslo" - -#~ msgid "Account Information" -#~ msgstr "Podatki o računu" - -#~ msgid "Update all QQ Quns" -#~ msgstr "Posodobi vse QQ Qune" - -#~ msgid "About OpenQ" -#~ msgstr "O OpenQ" - -#~ msgid "Modify Buddy Memo" -#~ msgstr "Spremeni zapisek prijatelja" - -#~ msgid "QQ Protocol Plugin" -#~ msgstr "Vtičnik za protokol QQ" - -#~ msgid "Auto" -#~ msgstr "Samodejno" - -#~ msgid "Select Server" -#~ msgstr "Izberite strežnik" - -#~ msgid "QQ2008" -#~ msgstr "QQ2008" - -#~ msgid "QQ2007" -#~ msgstr "QQ2007" - -#~ msgid "QQ2005" -#~ msgstr "QQ2005" - -#~ msgid "Connect by TCP" -#~ msgstr "Poveži prek TCP" - -#~ msgid "Show server notice" -#~ msgstr "Pokaži obvestilo strežnika" - -#~ msgid "Show server news" -#~ msgstr "Pokaži novice strežnika" - -#~ msgid "Show chat room when msg comes" -#~ msgstr "Pokaži klepetalnico, ko pride sporočilo" - -#~ msgid "Use default font" -#~ msgstr "Uporabi privzeto pisavo" - -#~ msgid "Keep alive interval (seconds)" -#~ msgstr "Interval ohranjanja povezave (s)" - -#~ msgid "Update interval (seconds)" -#~ msgstr "Interval posodabljanja (s)" - -#~ msgid "Unable to decrypt server reply" -#~ msgstr "Odgovora strežnika ni mogoče dešifrirati" - -#~ msgid "Failed requesting token, 0x%02X" -#~ msgstr "Neuspešno zahtevanje žetona, 0x%02X" - -#~ msgid "Invalid token len, %d" -#~ msgstr "Neveljavna dolžina žetona, %d" - -#~ msgid "Redirect_EX is not currently supported" -#~ msgstr "Redirect_EX trenutno ni podprt" - -#~ msgid "Activation required" -#~ msgstr "Zahtevana aktivacija" - -#~ msgid "Unknown reply code when logging in (0x%02X)" -#~ msgstr "Neznana koda odgovora pri prijavljanju v (0x%02X)" - -#~ msgid "Requesting captcha" -#~ msgstr "Zahtevanje slike z napisom ..." - -#~ msgid "Checking captcha" -#~ msgstr "Preverjanje napisa s slike ..." - -#~ msgid "Failed captcha verification" -#~ msgstr "Napaka pri overjanju napisa s slike" - -#~ msgid "Captcha Image" -#~ msgstr "Slika z napisom" - -#~ msgid "Enter code" -#~ msgstr "Vnesite kodo" - -#~ msgid "QQ Captcha Verification" -#~ msgstr "Preverjanje napisa s slike QQ" - -#~ msgid "Enter the text from the image" -#~ msgstr "Vnesite besedilo s slike" - -#~ msgid "Unknown reply when checking password (0x%02X)" -#~ msgstr "Neznan odgovor pri preverjanju gesla (0x%02X)" - -#~ msgid "" -#~ "Unknown reply code when logging in (0x%02X):\n" -#~ "%s" -#~ msgstr "" -#~ "Neznana koda odgovora pri prijavljanju (0x%02X):\n" -#~ "%s" - -#~ msgid "Socket error" -#~ msgstr "Napaka vtičnice" - -#~ msgid "Getting server" -#~ msgstr "Pridobivanje strežnika" - -#~ msgid "Requesting token" -#~ msgstr "Zahtevanje žetona" - -#~ msgid "Invalid server or port" -#~ msgstr "Neveljaven strežnik ali vrata" - -#~ msgid "Connecting to server" -#~ msgstr "Povezovanje s strežnikom" - -#~ msgid "QQ Error" -#~ msgstr "Napaka QQ" - -#~ msgid "" -#~ "Server News:\n" -#~ "%s\n" -#~ "%s\n" -#~ "%s" -#~ msgstr "" -#~ "Novice strežnika:\n" -#~ "%s\n" -#~ "%s\n" -#~ "%s" - -#~ msgid "%s:%s" -#~ msgstr "%s:%s" - -#~ msgid "From %s:" -#~ msgstr "Od %s:" - -#~ msgid "" -#~ "Server notice From %s: \n" -#~ "%s" -#~ msgstr "" -#~ "Obvestilo strežnika od %s: \n" -#~ "%s" - -#~ msgid "Unknown SERVER CMD" -#~ msgstr "Neznan ukaz strežnika (SERVER CMD)" - -#~ msgid "" -#~ "Error reply of %s(0x%02X)\n" -#~ "Room %u, reply 0x%02X" -#~ msgstr "" -#~ "Odgovor napake od %s(0x%02X )\n" -#~ "Soba %u, odgovor 0x%02X" - -#~ msgid "QQ Qun Command" -#~ msgstr "Ukaz QQ Qun" - -#~ msgid "Unable to decrypt login reply" -#~ msgstr "Odgovora na prijavo ni mogoče dešifrirati" - -#~ msgid "Unknown LOGIN CMD" -#~ msgstr "Neznan ukaz prijave (LOGIN CMD)" - -#~ msgid "Unknown CLIENT CMD" -#~ msgstr "Neznan ukaz odjemalca (CLIENT CMD)" - -#~ msgid "%d has declined the file %s" -#~ msgstr "Uporabnik %d je zavrnil datoteko %s" - -#~ msgid "File Send" -#~ msgstr "Datoteka poslana" - -#~ msgid "%d cancelled the transfer of %s" -#~ msgstr "Oseba %d je prekinila prenos %s" - -#~ msgid "Voice and Video Settings" -#~ msgstr "Glasovne in video nastavitve" -- cgit v1.2.1 From bc075124850947c4543794c5d0293b45a00c948f Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 12 Mar 2012 09:21:23 +0000 Subject: Russian translation updated (????? ??????????) Fixes #14814 --- po/ChangeLog | 1 + po/ru.po | 1158 ++++++++++++++++++++++++++-------------------------------- 2 files changed, 524 insertions(+), 635 deletions(-) diff --git a/po/ChangeLog b/po/ChangeLog index fc3c45526e..10d6d31cdf 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,6 +1,7 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 3.0.0 + * Russian translation updated (Антон Самохвалов) * Slovenian translation updated (Martin Srebotnjak) version 2.10.1 diff --git a/po/ru.po b/po/ru.po index 5417ceb3af..5c7eea4a57 100644 --- a/po/ru.po +++ b/po/ru.po @@ -10,16 +10,16 @@ msgid "" msgstr "" "Project-Id-Version: ru\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-18 00:02-0700\n" +"POT-Creation-Date: 2011-12-11 09:57-0500\n" "PO-Revision-Date: 2008-05-14 15:00+0400\n" "Last-Translator: Антон Самохвалов \n" "Language-Team: \n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Language: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" +"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" #. Translators may want to transliterate the name. #. It is not to be translated. @@ -50,16 +50,6 @@ msgstr "" " -n, --nologin не входить автоматически\n" " -v, --version показать текущую версию и выйти\n" -#, c-format -msgid "" -"%s encountered errors migrating your settings from %s to %s. Please " -"investigate and complete the migration by hand. Please report this error at " -"http://developer.pidgin.im" -msgstr "" -"%s столкнулся с ошибками при переносе ваших настроек из %s в %s. Пожалуйста " -"разберитесь в чём дело и завершите перенос вручную. Пожалуйста уведомите об " -"этой ошибке на http://developer.pidgin.im" - #. the user did not fill in the captcha msgid "Error" msgstr "Ошибка" @@ -210,6 +200,8 @@ msgstr "Выбранная учётная запись не в сети." msgid "Error adding buddy" msgstr "Ошибка добавления собеседника" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Username" msgstr "Имя пользователя" @@ -343,7 +335,11 @@ msgstr "Обратить пометку" msgid "View Log" msgstr "Просмотреть журнал" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. General +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Nickname" msgstr "Псевдоним" @@ -793,7 +789,11 @@ msgid "Remaining" msgstr "Осталось" #. XXX: Use of ggp_str_to_uin() is an ugly hack! +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext #. presence +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status" msgstr "Состояние" @@ -1382,6 +1382,8 @@ msgstr "Название" msgid "Type" msgstr "Тип" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. Statuses are almost all the same. Define a macro to reduce code repetition. #. PurpleStatusPrimitive #. id - use default @@ -1390,6 +1392,8 @@ msgstr "Тип" #. user_settable #. not independent #. Attributes - each status can have a message. +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Message" msgstr "Сообщение" @@ -1946,7 +1950,7 @@ msgid "Unknown reason" msgstr "Причина неизвестна" msgid "Aborting DNS lookup in Tor Proxy mode." -msgstr "" +msgstr "Прекращаю поиск DNS в режиме Tor Proxy." #, c-format msgid "" @@ -3013,19 +3017,29 @@ msgid "" msgstr "" "Не удаётся установить соединение с локальным mDNS-сервером. Он работает?" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "First name" msgstr "Имя" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Last name" msgstr "Фамилия" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. email msgid "Email" msgstr "Email" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "AIM Account" msgstr "Учётная запись AIM" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "XMPP Account" msgstr "Учётная запись XMPP" @@ -3139,6 +3153,8 @@ msgstr "Зарегистрировать новую учётную запись msgid "Please, fill in the following fields" msgstr "Заполните следующие поля" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "City" msgstr "Город" @@ -3146,6 +3162,8 @@ msgid "Year of birth" msgstr "Год рождения" #. gender +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Gender" msgstr "Пол" @@ -3168,20 +3186,26 @@ msgstr "Найти собеседников" msgid "Please, enter your search criteria below" msgstr "Пожалуйста, введите ваш критерий поиска ниже" -msgid "Fill in the fields." -msgstr "Заполните поля." +msgid "Change password for the Gadu-Gadu account" +msgstr "Изменить пароль для учётной записи Gadu-Gadu" -msgid "Your current password is different from the one that you specified." -msgstr "Ваш текущий пароль отличается от того, что вы указали." +msgid "Password was changed successfully!" +msgstr "Пароль был успешно изменён!" msgid "Unable to change password. Error occurred.\n" msgstr "Не удаётся изменить пароль. Произошла ошибка.\n" -msgid "Change password for the Gadu-Gadu account" -msgstr "Изменить пароль для учётной записи Gadu-Gadu" +msgid "Fill in the fields." +msgstr "Заполните поля." -msgid "Password was changed successfully!" -msgstr "Пароль был успешно изменён!" +msgid "New password should be at most 15 characters long." +msgstr "Новый пароль не может быть длиннее 15 символов." + +msgid "Your current password is different from the one that you specified." +msgstr "Ваш текущий пароль отличается от того, что вы указали." + +msgid "Invalid email address" +msgstr "Неверный адрес email" msgid "Current password" msgstr "Текущий пароль" @@ -3189,6 +3213,9 @@ msgstr "Текущий пароль" msgid "Password (retype)" msgstr "Пароль (наберите ещё раз)" +msgid "Email Address" +msgstr "Адрес email" + msgid "Enter current token" msgstr "Введите текущий маркер" @@ -3243,14 +3270,20 @@ msgstr "Не беспокоить" msgid "Away" msgstr "Отошёл" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "UIN" msgstr "UIN" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. first name #. optional information msgid "First Name" msgstr "Имя" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Birth Year" msgstr "Год рождения" @@ -3290,6 +3323,31 @@ msgstr "Список собеседников был сохранён на се msgid "Connected" msgstr "Соединение установлено" +msgid "Unable to resolve hostname" +msgstr "Не удаётся получить имя узла" + +msgid "Incorrect password" +msgstr "Неправильный пароль" + +msgid "SSL Connection Failed" +msgstr "Не удалось установить SSL-соединение" + +msgid "" +"Your account has been disabled because too many incorrect passwords were " +"entered" +msgstr "" +"Ваша учётная запись была отключена, так как было введено слишком много " +"неправильных паролей" + +msgid "Service temporarily unavailable" +msgstr "Служба временно недоступна" + +msgid "Error connecting to proxy server" +msgstr "Ошибка соединения с прокси-сервером" + +msgid "Error connecting to master server" +msgstr "Ошибка соединения с главным сервером" + msgid "Connection failed" msgstr "Не удалось установить соединение" @@ -3299,6 +3357,12 @@ msgstr "Добавить к чату" msgid "Chat _name:" msgstr "_Имя чата:" +msgid "The username specified is invalid." +msgstr "Указанное имя пользователя некорректно." + +msgid "SSL support unavailable" +msgstr "Поддержка SSL недоступна" + #, c-format msgid "Unable to resolve hostname '%s': %s" msgstr "Не удаётся установить имя хоста '%s': %s" @@ -3317,12 +3381,12 @@ msgstr "Это имя чата уже используется" msgid "Not connected to the server" msgstr "Не подсоединён к серверу" -msgid "Find buddies..." -msgstr "Найти собеседников..." - msgid "Change password..." msgstr "Изменить пароль..." +msgid "Find buddies..." +msgstr "Найти собеседников..." + msgid "Upload buddylist to Server" msgstr "Сохранить список собеседников на сервере" @@ -3353,26 +3417,24 @@ msgstr "Модуль протокола Gadu-Gadu" msgid "Polish popular IM" msgstr "Популярный польский IM" -msgid "Gadu-Gadu User" -msgstr "Пользователь Gadu-Gadu" - msgid "GG server" msgstr "GG сервер" -#, fuzzy -msgid "Don't use encryption" -msgstr "Требовать авторизацию" - msgid "Use encryption if available" msgstr "Если доступно, использовать шифрование" -#. TODO msgid "Require encryption" msgstr "Требовать шифрование" +msgid "Don't use encryption" +msgstr "Не использовать шифрование" + msgid "Connection security" msgstr "Безопасность соединения" +msgid "Show links from strangers" +msgstr "Показывать ссылки от незнакомцев" + #, c-format msgid "Unknown command: %s" msgstr "Неизвестная команда: %s" @@ -3425,9 +3487,6 @@ msgstr "_Пароль:" msgid "IRC nick and server may not contain whitespace" msgstr "Псевдоним и сервер IRC могут не содержать пробелов" -msgid "SSL support unavailable" -msgstr "Поддержка SSL недоступна" - msgid "Unable to connect" msgstr "Не удаётся установить соединение" @@ -3461,7 +3520,9 @@ msgstr "Модуль протокола IRC" msgid "The IRC Protocol Plugin that Sucks Less" msgstr "Наименее плохой модуль протокола IRC" -#. host to connect to +#. set up account ID as user:server +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Server" msgstr "Сервер" @@ -3991,6 +4052,8 @@ msgstr "Не удалось установить соединение с сер msgid "Unable to establish SSL connection" msgstr "Не удаётся установить SSL соединение" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Full Name" msgstr "Полное имя" @@ -4060,9 +4123,13 @@ msgid "" msgstr "" "Все нижеследующие пункты не обязательны. Заполняйте по своему усмотрению." +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Client" msgstr "Клиент" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Operating System" msgstr "Операционная система" @@ -4072,6 +4139,8 @@ msgstr "Местное время" msgid "Priority" msgstr "Приоритет" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Resource" msgstr "Ресурс" @@ -4168,9 +4237,6 @@ msgstr "" "Заполните одно или более полей для поиска любых совпадающих пользователей " "XMPP" -msgid "Email Address" -msgstr "Адрес email" - msgid "Search for XMPP users" msgstr "Искать пользователей XMPP" @@ -4374,6 +4440,8 @@ msgstr "Сервер не поддерживает блокировку" msgid "Not Authorized" msgstr "Не авторизован" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Mood" msgstr "Настроение" @@ -4734,7 +4802,7 @@ msgid "" "role <moderator|participant|visitor|none> [nick1] [nick2] ...: Get the " "users with a role or set users' role with the room." msgstr "" -"роль <moderator|participant|visitor|none> [псевдоним1] " +"role <moderator|participant|visitor|none> [псевдоним1] " "[псевдоним2] ...: Возьмите пользователей с ролью или установите роль " "пользователей в комнате." @@ -4742,10 +4810,8 @@ msgid "invite <user> [message]: Invite a user to the room." msgstr "" "invite <пользователь> [сообщение]: Пригласить пользователя в комнату." -#, fuzzy msgid "join: <room[@server]> [password]: Join a chat." -msgstr "" -"join: <комната> [пароль]: Присоединиться к чату на этом сервере." +msgstr "join: <room[@server]> [пароль]: Присоединиться к чату." msgid "kick <user> [reason]: Kick a user from the room." msgstr "kick <пользователь> [причина]: Удалить пользователя из комнаты." @@ -5214,9 +5280,6 @@ msgstr "Не удаётся сделать разбор сообщения" msgid "Syntax Error (probably a client bug)" msgstr "Синтаксическая ошибка (вероятно, ошибка в клиенте)" -msgid "Invalid email address" -msgstr "Неверный адрес email" - msgid "User does not exist" msgstr "Пользователь не существует" @@ -5283,9 +5346,6 @@ msgstr "Слишком много попаданий в FND" msgid "Not logged in" msgstr "Не в сети" -msgid "Service temporarily unavailable" -msgstr "Служба временно недоступна" - msgid "Database server error" msgstr "Ошибка сервера базы данных" @@ -5450,24 +5510,20 @@ msgstr "Ваше новое дружеское имя MSN слишком вел msgid "Set friendly name for %s." msgstr "Установите дружеское имя для %s." -#, fuzzy msgid "Set Friendly Name" -msgstr "Ввести дружеское имя..." +msgstr "Установить дружеское имя" msgid "This is the name that other MSN buddies will see you as." msgstr "Это имя, под которым вас будут видеть другие пользователи MSN." -#, fuzzy msgid "This Location" -msgstr "Местоположение пользователя" +msgstr "Это место" -#, fuzzy msgid "This is the name that identifies this location" -msgstr "Это имя, под которым вас будут видеть другие пользователи MSN." +msgstr "Это имя, отождествляющееся с этим местом" -#, fuzzy msgid "Other Locations" -msgstr "Местоположение пользователя" +msgstr "Другие места" msgid "You can sign out from other locations here" msgstr "Здесь Вы можете отключиться из других мест" @@ -5574,9 +5630,8 @@ msgstr "Название офиса" msgid "Set Friendly Name..." msgstr "Ввести дружеское имя..." -#, fuzzy msgid "View Locations..." -msgstr "Выбрать местоположение..." +msgstr "Просмотреть места..." msgid "Set Home Phone Number..." msgstr "Ввести номер домашнего телефона..." @@ -5590,9 +5645,8 @@ msgstr "Ввести номер мобильного телефона..." msgid "Enable/Disable Mobile Devices..." msgstr "Разрешить/запретить мобильные устройства..." -#, fuzzy msgid "Allow/Disallow Multiple Logins..." -msgstr "Разрешить/запретить мобильные страницы..." +msgstr "Разрешить/запретить множественные входы..." msgid "Allow/Disallow Mobile Pages..." msgstr "Разрешить/запретить мобильные страницы..." @@ -5633,6 +5687,8 @@ msgstr "Возраст" msgid "Occupation" msgstr "Занятость" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Location" msgstr "Местоположение" @@ -5834,9 +5890,8 @@ msgid "Mobile message was not sent because it was too long." msgstr "" "Мобильное сообщение не было отправлено, потому что оно слишком длинное." -#, fuzzy msgid "Mobile message was not sent because an unknown error occurred." -msgstr "Сообщение не было отправлено, потому как произошла неизвестная ошибка." +msgstr "Мобильное сообщение не отправлено - произошла неизвестная ошибка." #, c-format msgid "" @@ -5879,20 +5934,15 @@ msgstr "" "Сообщение не было отправлено, потому что система недоступна. Это обычно " "происходит, когда пользователь заблокирован или не существует." -#, fuzzy msgid "Message was not sent because messages are being sent too quickly." msgstr "" -"Сообщение не было отправлено, потому что вы отправляли их слишком быстро." +"Сообщение не отправлено, потому что вы отправляли их слишком быстро." -#, fuzzy msgid "Message was not sent because an unknown encoding error occurred." -msgstr "" -"Сообщение не было отправлено, потому как произошла неизвестная ошибка " -"кодирования." +msgstr "Сообщение не отправлено - произошла неизвестная ошибка кодирования." -#, fuzzy msgid "Message was not sent because an unknown error occurred." -msgstr "Сообщение не было отправлено, потому как произошла неизвестная ошибка." +msgstr "Сообщение не отправлено - произошла неизвестная ошибка." msgid "Writing error" msgstr "Ошибка записи" @@ -5908,24 +5958,20 @@ msgstr "" "Ошибка соединения от сервера %s:\n" "%s" -#, fuzzy msgid "Our protocol is not supported by the server" msgstr "Наш протокол не поддерживается сервером" -#, fuzzy msgid "Error parsing HTTP" msgstr "Ошибка разбора HTTP" -#, fuzzy msgid "You have signed on from another location" -msgstr "Вы уже откуда-то подключены" +msgstr "Вы уже откуда-то зарегистрированы" msgid "The MSN servers are temporarily unavailable. Please wait and try again." msgstr "Серверы MSN временно недоступны. Повторите попытку позже." -#, fuzzy msgid "The MSN servers are going down temporarily" -msgstr "Серверы MSN временно выключаются." +msgstr "Серверы MSN временно будут выключены" #, c-format msgid "Unable to authenticate: %s" @@ -5954,13 +6000,13 @@ msgstr "Отправка данных" msgid "Retrieving buddy list" msgstr "Загрузка списка собеседников" -#, fuzzy, c-format +#, c-format msgid "%s requests to view your webcam, but this request is not yet supported." -msgstr "%s послал вам приглашение к веб-камере, которое ещё не поддерживается." +msgstr "%s просит увидеть вашу веб-камеру, но это ещё не поддерживается." -#, fuzzy, c-format +#, c-format msgid "%s invited you to view his/her webcam, but this is not yet supported." -msgstr "%s послал вам приглашение к веб-камере, которое ещё не поддерживается." +msgstr "%s пригласил вас увидеть свою веб-камеру, но это ещё не поддерживается." msgid "Away From Computer" msgstr "Отошёл от компьютера" @@ -6014,9 +6060,6 @@ msgstr "Удалить собеседника из адресной книги?" msgid "Do you want to delete this buddy from your address book as well?" msgstr "Вы хотите удалить также и этого собеседника из вашей адресной книги?" -msgid "The username specified is invalid." -msgstr "Указанное имя пользователя некорректно." - msgid "The Display Name you entered is invalid." msgstr "Введённое Вами имя отображения некорректно." @@ -6030,6 +6073,8 @@ msgstr "Ошибка Обновления Профиля" #. no profile information yet, so we cannot update #. (reference: "libpurple/request.h") +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Profile" msgstr "Профиль" @@ -6043,13 +6088,12 @@ msgid "Display Name" msgstr "Показать имя" #. about me -#, fuzzy msgid "About Me" msgstr "Обо мне" #. where I live msgid "Where I Live" -msgstr "" +msgstr "Где я живу" #. mobile number msgid "Mobile Number" @@ -6057,15 +6101,14 @@ msgstr "Номер мобильного" #. is searchable msgid "Can be searched" -msgstr "" +msgstr "Можно искать" #. is suggestable msgid "Can be suggested" -msgstr "" +msgstr "Можно рекомендовать" -#, fuzzy msgid "Update your MXit Profile" -msgstr "Обновить ваш профиль" +msgstr "Обновить ваш MXit профиль" msgid "The PIN you entered is invalid." msgstr "Введённый PIN-код неправильный." @@ -6080,9 +6123,8 @@ msgid "The two PINs you entered do not match." msgstr "Два введённых PIN-кода не совпадают." #. show error to user -#, fuzzy msgid "PIN Update Error" -msgstr "Ошибка Обновления Профиля" +msgstr "Ошибка обновления PIN" #. pin #. pin (required) @@ -6094,13 +6136,11 @@ msgid "Verify PIN" msgstr "Проверьте PIN" #. (reference: "libpurple/request.h") -#, fuzzy msgid "Change PIN" -msgstr "Изменить иконку" +msgstr "Изменить PIN" -#, fuzzy msgid "Change MXit PIN" -msgstr "Изменить иконку" +msgstr "Изменить MXit PIN" msgid "View Splash" msgstr "Показать заставку" @@ -6111,17 +6151,14 @@ msgstr "Сейчас нет доступных экранов-заставок" msgid "About" msgstr "Про" -#, fuzzy msgid "Search for user" msgstr "Искать пользователя" -#, fuzzy msgid "Search for a MXit contact" -msgstr "Искать пользователя" +msgstr "Искать MXit контакт" -#, fuzzy msgid "Type search information" -msgstr "Пользовательская информация" +msgstr "Ввести информацию поиска" msgid "_Search" msgstr "_Искать" @@ -6131,19 +6168,16 @@ msgid "Change Profile..." msgstr "Изменить профиль..." #. change PIN -#, fuzzy msgid "Change PIN..." -msgstr "Изменить настроение..." +msgstr "Изменить PIN..." #. suggested friends -#, fuzzy msgid "Suggested friends..." -msgstr "Ввести дружеское имя..." +msgstr "Предлагаемые друзья..." #. search for contacts -#, fuzzy msgid "Search for contacts..." -msgstr "Искать пользователей..." +msgstr "Поиск контактов..." #. display splash-screen msgid "View Splash..." @@ -6153,6 +6187,8 @@ msgstr "Показать заставку..." msgid "About..." msgstr "О модуле..." +#. we are trying to send a file to MXit +#. need to reserve some space for packet headers #. the file is too big msgid "The file you are trying to send is too large!" msgstr "Файл, которые вы пытаетесь отправить слишком велик!" @@ -6175,9 +6211,8 @@ msgstr "" msgid "Connecting..." msgstr "Соединение..." -#, fuzzy msgid "The Display Name you entered is too short." -msgstr "Введённое Вами имя отображения некорректно." +msgstr "Введённое Вами имя отображения очень короткое." msgid "The PIN you entered has an invalid length [7-10]." msgstr "Введённый Вами PIN-код неправильной длины [7-10]." @@ -6212,15 +6247,12 @@ msgstr "Ваш сеанс истёк. Пожалуйста, попробуйте msgid "Invalid country selected. Please try again." msgstr "Выбрана неправильная страна. Пожалуйста, попробуйте ещё раз." -#, fuzzy msgid "The MXit ID you entered is not registered. Please register first." msgstr "" -"Имя пользователя не зарегистрировано. Пожалуйста, сначала зарегистрируйтесь." +"Введённый MXit ID не зарегистрирован. Пожалуйста, сначала зарегистрируйтесь." -#, fuzzy msgid "The MXit ID you entered is already registered. Please choose another." -msgstr "" -"Имя пользователя уже зарегистрировано. Пожалуйста, выберите другое имя." +msgstr "Введённый MXit ID не зарегистрирован. Пожалуйста, выберите другой." msgid "Internal error. Please try again later." msgstr "Внутренняя ошибка. Пожалуйста, попробуйте позже." @@ -6251,53 +6283,42 @@ msgstr "Подтверждение учётной записи MXit" msgid "Retrieving User Information..." msgstr "Получение информации о пользователе..." -#, fuzzy msgid "was kicked" -msgstr "Неверный билет" +msgstr "выгнали" -#, fuzzy msgid "You have been kicked from this MultiMX." -msgstr "Вас выгнали: (%s)" +msgstr "Вас выгнали из этого MultiMX." -#, fuzzy msgid "_Room Name:" -msgstr "_Комната:" +msgstr "_Имя комнаты:" #. Display system message in chat window -#, fuzzy msgid "You have invited" -msgstr "Вам пришла почта!" +msgstr "Вы приглашены" msgid "Loading menu..." msgstr "Загрузка меню..." +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status Message" msgstr "Сообщения состояния" -#, fuzzy msgid "Rejection Message" -msgstr "Полученные сообщения" +msgstr "Сообщения отказа" -#. hidden number -msgid "Hidden Number" -msgstr "Скрытый номер" - -#, fuzzy msgid "No profile available" -msgstr "Недоступен" +msgstr "Нет доступных профилей" -#, fuzzy msgid "This contact does not have a profile." -msgstr "Эл.почта для этой учётной записи не включена." +msgstr "У этого контакта нет профиля." -#, fuzzy msgid "Your MXit ID..." -msgstr "Yahoo ID..." +msgstr "Ваш MXit ID..." #. contact is in Deleted, Rejected or None state -#, fuzzy msgid "Re-Invite" -msgstr "Пригласить" +msgstr "Пригласить повторно" #. Configuration options #. WAP server (reference: "libpurple/accountopt.h") @@ -6310,43 +6331,38 @@ msgstr "Соединение через HTTP" msgid "Enable splash-screen popup" msgstr "Включить контекстное меню экрана-заставки" -#, fuzzy msgid "Last Online" -msgstr "В сети" +msgstr "Последний раз в сети" -#, fuzzy msgid "Invite Message" -msgstr "Отправленные сообщения" +msgstr "Пригласительное" -#, fuzzy msgid "No results" -msgstr "Результаты поиска" +msgstr "Нет результатов" -#, fuzzy msgid "No contacts found." -msgstr "Пользователей не найдено" +msgstr "Контактов не найдено." #. define columns -#, fuzzy msgid "UserId" -msgstr "Пользователь" +msgstr "№ пользователя" msgid "Where I live" -msgstr "" +msgstr "Где я живу" -#, fuzzy, c-format +#, c-format msgid "You have %i suggested friend." msgid_plural "You have %i suggested friends." -msgstr[0] "Ввести дружеское имя..." -msgstr[1] "Ввести дружеское имя..." -msgstr[2] "Ввести дружеское имя..." +msgstr[0] "Вам предложен %i друг." +msgstr[1] "Вам предложено %i друга." +msgstr[2] "Вам предложено %i друзей." #, c-format msgid "We found %i contact that matches your search." msgid_plural "We found %i contacts that match your search." -msgstr[0] "" -msgstr[1] "" -msgstr[2] "" +msgstr[0] "Мы нашли %i контакт, отвечающий условиям вашего поиска." +msgstr[1] "Мы нашли %i контакта, отвечающих условиям вашего поиска." +msgstr[2] "Мы нашли %i контактов, отвечающих условиям вашего поиска." #. we must have lost the connection, so terminate it so that we can reconnect msgid "We have lost the connection to MXit. Please reconnect." @@ -6365,74 +6381,66 @@ msgstr "Истекло время во время ожидания ответа msgid "Successfully Logged In..." msgstr "Успешно вошёл в сеть..." -#, fuzzy, c-format +#, c-format msgid "" "%s sent you an encrypted message, but it is not supported on this client." -msgstr "%s послал вам приглашение к веб-камере, которое ещё не поддерживается." +msgstr "" +"%s послал вам зашифрованное сообщение, но данный клиент это не поддерживает." msgid "Message Error" msgstr "Сообщение об ошибке" +#. could not be decrypted +msgid "An encrypted message was received which could not be decrypted." +msgstr "Получено зашифрованное сообщение, которое нельзя расшифровать." + msgid "Cannot perform redirect using the specified protocol" msgstr "Не могу осуществить перенаправление используя указанный протокол" -#, fuzzy msgid "An internal MXit server error occurred." -msgstr "Произошла неизвестная ошибка подключения: %s." +msgstr "Произошла внутренняя ошибка сервера MXit." -#, fuzzy, c-format +#, c-format msgid "Login error: %s (%i)" msgstr "Ошибка входа: %s (%i)" -#, fuzzy, c-format +#, c-format msgid "Logout error: %s (%i)" msgstr "Ошибка выхода: %s (%i)" -#, fuzzy msgid "Contact Error" msgstr "Ошибка контакта" -#, fuzzy msgid "Message Sending Error" msgstr "Ошибка отправки сообщения" -#, fuzzy msgid "Status Error" msgstr "Ошибка состояния" -#, fuzzy msgid "Mood Error" msgstr "Ошибка настроения" -#, fuzzy msgid "Invitation Error" msgstr "Ошибка приглашения" -#, fuzzy msgid "Contact Removal Error" msgstr "Ошибка удаления контакта" -#, fuzzy msgid "Subscription Error" -msgstr "Подписка" +msgstr "Ошибка подписки" -#, fuzzy msgid "Contact Update Error" -msgstr "Ошибка соединения" +msgstr "Ошибка обновления контакта" -#, fuzzy msgid "File Transfer Error" -msgstr "Ошибка передачи файлов" +msgstr "Ошибка передачи файла" -#, fuzzy msgid "Cannot create MultiMx room" -msgstr "Не удаётся создать правило" +msgstr "Не удаётся создать комнату MultiMx" -#, fuzzy msgid "MultiMx Invitation Error" -msgstr "Ошибка отмены регистрации" +msgstr "Ошибка приглашения MultiMx" -#, fuzzy msgid "Profile Error" msgstr "Ошибка профиля" @@ -6466,19 +6474,15 @@ msgstr "Возникла ошибка соединения с MXit. (этап ч msgid "In Love" msgstr "Влюблённый" -#, fuzzy msgid "Pending" -msgstr "Рассмотрение" +msgstr "На рассмотрении" -#, fuzzy msgid "Invited" -msgstr "Приглашено" +msgstr "Приглашены" -#, fuzzy msgid "Rejected" msgstr "Отклонено" -#, fuzzy msgid "Deleted" msgstr "Удалено" @@ -6653,18 +6657,26 @@ msgstr "Разрешение экрана (точек на дюйм)" msgid "Base font size (points)" msgstr "Основной размер шрифта (единиц)" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User" msgstr "Пользователь" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Headline" msgstr "Заголовок" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Song" msgstr "Песня" msgid "Total Friends" msgstr "Всего друзей" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Client Version" msgstr "Версия клиента" @@ -6866,9 +6878,6 @@ msgstr "Не поддерживается" msgid "Password has expired" msgstr "Срок действия пароля истёк" -msgid "Incorrect password" -msgstr "Неправильный пароль" - msgid "Account has been disabled" msgstr "Учётная запись была отключена" @@ -6893,13 +6902,6 @@ msgstr "Главный архив не настроен" msgid "Could not recognize the host of the username you entered" msgstr "Не удалось узнать узел введённого имени пользователя" -msgid "" -"Your account has been disabled because too many incorrect passwords were " -"entered" -msgstr "" -"Ваша учётная запись была отключена, так как было введено слишком много " -"неправильных паролей" - msgid "You cannot add the same person twice to a conversation" msgstr "Вы не можете добавить одну и ту же персону в беседу дважды" @@ -7024,12 +7026,9 @@ msgstr "Стоп почты" msgid "User ID" msgstr "Пользовательский ID" -#. tag = _("DN"); -#. value = nm_user_record_get_dn(user_record); -#. if (value) { -#. purple_notify_user_info_add_pair(user_info, tag, value); -#. } -#. +msgid "DN" +msgstr "DN" + msgid "Full name" msgstr "Полное имя" @@ -7621,34 +7620,34 @@ msgstr[1] "" msgstr[2] "" "Вы не получили %hu сообщений от %s, так как был превышен предел оценки." -#, fuzzy, c-format +#, c-format msgid "" "You missed %hu message from %s because his/her warning level is too high." msgid_plural "" "You missed %hu messages from %s because his/her warning level is too high." msgstr[0] "" -"Вы не получили %hu сообщение от %s, потому что у него/неё слишком много " -"предупреждений." +"Вы не получили %hu сообщение от %s потому, что у него/неё слишком высокий " +"уровень предупреждений." msgstr[1] "" -"Вы не получили %hu сообщений от %s, потому что у него/неё слишком много " -"предупреждений." +"Вы не получили %hu сообщения от %s потому, что у него/неё слишком высокий " +"уровень предупреждений." msgstr[2] "" -"Вы не получили %hu сообщения от %s, потому что у него/неё слишком много " -"предупреждений." +"Вы не получили %hu сообщений от %s потому, что у него/неё слишком высокий " +"уровень предупреждений." -#, fuzzy, c-format +#, c-format msgid "You missed %hu message from %s because your warning level is too high." msgid_plural "" "You missed %hu messages from %s because your warning level is too high." msgstr[0] "" -"Вы не получили %hu сообщение от %s, потому что у вас слишком много " -"предупреждений." +"Вы не получили %hu сообщение от %s, потому что у вас слишком высокий " +"уровень предупреждений." msgstr[1] "" -"Вы не получили %hu сообщений от %s, потому что у вас слишком много " -"предупреждений." +"Вы не получили %hu сообщения от %s, потому что у вас слишком высокий " +"уровень предупреждений." msgstr[2] "" -"Вы не получили %hu сообщения от %s, потому что у вас слишком много " -"предупреждений." +"Вы не получили %hu сообщений от %s, потому что у вас слишком высокий " +"уровень предупреждений." #, c-format msgid "You missed %hu message from %s for an unknown reason." @@ -7808,20 +7807,19 @@ msgstr[2] "" msgid "Away message too long." msgstr "Сообщение об отсутствии слишком велико." -#, fuzzy, c-format +#, c-format msgid "" "Unable to add the buddy %s because the username is invalid. Usernames must " "be a valid email address, or start with a letter and contain only letters, " "numbers and spaces, or contain only numbers." msgstr "" -"Не могу добавить собеседника %s, потому что имя пользователя неверное. " +"Не могу добавить собеседника %s потому, что имя пользователя некорректное. " "Имена пользователей должны быть правильными адресами эл.почты или начинаться " "с буквы и содержать только буквы, цифры и пробелы, или содержать только " "цифры." -#, fuzzy msgid "Unable to Retrieve Buddy List" -msgstr "Не удаётся загрузить список собеседников" +msgstr "Не удаётся получить список собеседников" msgid "" "The AIM servers were temporarily unable to send your buddy list. Your buddy " @@ -7834,22 +7832,22 @@ msgstr "" msgid "Orphans" msgstr "Сироты" -#, fuzzy, c-format +#, c-format msgid "" "Unable to add the buddy %s because you have too many buddies in your buddy " "list. Please remove one and try again." msgstr "" -"Не удалось добавить собеседника %s, так как в списке собеседников слишком " -"много собеседников. Удалите одного и попытайтесь снова." +"Не удалось добавить собеседника %s потому, что у вас слишком много людей " +"в списке собеседников. Пожалуйста, удалите одного и попробуйте снова." msgid "(no name)" msgstr "(нет имени)" -#, fuzzy, c-format +#, c-format msgid "Unable to add the buddy %s for an unknown reason." msgstr "Не удалось добавить собеседника %s по неизвестной причине." -#, fuzzy, c-format +#, c-format msgid "" "The user %s has given you permission to add him or her to your buddy list. " "Do you want to add this user?" @@ -7917,7 +7915,6 @@ msgstr "" msgid "C_onnect" msgstr "_Установить соединение" -#, fuzzy msgid "You closed the connection." msgstr "Вы закрыли соединение." @@ -7928,13 +7925,11 @@ msgstr "Получить информацию AIM" msgid "Edit Buddy Comment" msgstr "Изменить комментарий собеседника" -#, fuzzy msgid "Get X-Status Msg" -msgstr "Получить сообщение о статусе" +msgstr "Получить сообщение X-Status" -#, fuzzy msgid "End Direct IM Session" -msgstr "Прямое соединение установлено" +msgstr "Закончить прямое соединение общения" msgid "Direct IM" msgstr "Прямое соединение" @@ -7954,9 +7949,8 @@ msgstr "Параметры конфиденциальности ICQ" msgid "Change Address To:" msgstr "Изменить адрес на:" -#, fuzzy msgid "you are not waiting for authorization" -msgstr "вы не ожидаете авторизацию" +msgstr "вы не ожидаете авторизации" msgid "You are awaiting authorization from the following buddies" msgstr "Вы ожидаете авторизацию от следующих собеседников" @@ -7991,13 +7985,11 @@ msgstr "Настроить переадресацию мгновенных со msgid "Set Privacy Options..." msgstr "Установить параметры конфиденциальности..." -#, fuzzy msgid "Show Visible List" -msgstr "Показать список _собеседников" +msgstr "Показать видимый список" -#, fuzzy msgid "Show Invisible List" -msgstr "Список приглашённых" +msgstr "Показать невидимый список" #. AIM actions msgid "Confirm Account" @@ -8015,7 +8007,6 @@ msgstr "Показать собеседников без авторизации" msgid "Search for Buddy by Email Address..." msgstr "Искать собеседника по адресу email..." -#, fuzzy msgid "Use clientLogin" msgstr "Использовать clientLogin" @@ -8141,6 +8132,7 @@ msgstr "Пользовательская информация недоступн msgid "Mobile Phone" msgstr "Мобильный телефон" +#. TODO: Is it correct to pass info->email here...? msgid "Personal Web Page" msgstr "Персональная web-страница" @@ -8161,6 +8153,7 @@ msgstr "Отдел" msgid "Position" msgstr "Должность" +#. TODO: Is it correct to pass info->email here...? msgid "Web Page" msgstr "Web-страница" @@ -8410,8 +8403,8 @@ msgid "" "\"Create New Conference\" if you'd like to create a new conference to invite " "this user to." msgstr "" -"Выберите конференцию из списка ниже, чтобы послать приглашение пользователю " -"%s. Выберите \"Создать новую конференцию\" если вы хотите пригасить этого " +"Выберите конференцию из списка ниже, чтобы послать приглашение пользователю %" +"s. Выберите \"Создать новую конференцию\" если вы хотите пригасить этого " "пользователя в новую конференцию." msgid "Invite to Conference" @@ -8426,33 +8419,16 @@ msgstr "Послать ТЕСТОВОЕ извещение" msgid "Topic:" msgstr "Тема:" -msgid "No Sametime Community Server specified" -msgstr "Не указан текущий сервер общества" +msgid "A server is required to connect this account" +msgstr "Сервер требует присоединить эту учётную запись" -#, c-format -msgid "" -"No host or IP address has been configured for the Meanwhile account %s. " -"Please enter one below to continue logging in." -msgstr "" -"Для временной учётной записи %s не был настроен ни узел, ни IP-адрес. " -"Пожалуйста, введите что-то снизу для продолжение входа." - -msgid "Meanwhile Connection Setup" -msgstr "Настройка временного соединения" - -msgid "No Sametime Community Server Specified" -msgstr "Не указан текущий сервер общества" - -msgid "Connect" -msgstr "Установить соединение" +msgid "Last Known Client" +msgstr "Последний известный клиент" #, c-format msgid "Unknown (0x%04x)
    " msgstr "Неизвестно (0x%04x)
    " -msgid "Last Known Client" -msgstr "Последний известный клиент" - msgid "User Name" msgstr "Имя пользователя" @@ -8771,21 +8747,33 @@ msgstr "Гиперактивный" msgid "Robot" msgstr "Робот" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User Modes" msgstr "Режимы пользователя" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Contact" msgstr "Предпочитаемый контакт" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Language" msgstr "Предпочитаемый язык" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Device" msgstr "Устройство" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Timezone" msgstr "Часовой пояс" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Geolocation" msgstr "Географическое положение" @@ -9227,7 +9215,6 @@ msgstr "Неподдерживаемый тип публичного ключа" msgid "Disconnected by server" msgstr "Соединение разорвано сервером" -#, fuzzy msgid "Error connecting to SILC Server" msgstr "Ошибка соединения с сервером SILC" @@ -9243,7 +9230,6 @@ msgstr "" msgid "Performing key exchange" msgstr "Выполнение обмена ключами" -#, fuzzy msgid "Unable to load SILC key pair" msgstr "Не удалось загрузить пару ключей SILC" @@ -9254,14 +9240,13 @@ msgstr "Соединение с сервером SILC" msgid "Out of memory" msgstr "Недостаточно памяти" -#, fuzzy msgid "Unable to initialize SILC protocol" msgstr "Не удаётся инициализировать протокол SILC" msgid "Error loading SILC key pair" msgstr "Ошибка загрузки пары ключей SILC" -#, fuzzy, c-format +#, c-format msgid "Download %s: %s" msgstr "Загрузка %s: %s" @@ -9557,7 +9542,6 @@ msgstr "Делать цифровую подпись и проверку все msgid "Creating SILC key pair..." msgstr "Создание пары ключей SILC..." -#, fuzzy msgid "Unable to create SILC key pair" msgstr "Не удаётся создать пару ключей SILC" @@ -9650,75 +9634,12 @@ msgstr "" msgid "Whiteboard" msgstr "Белая доска" -msgid "No server statistics available" -msgstr "Нет доступной статистики сервера" - -msgid "Error during connecting to SILC Server" -msgstr "Ошибка во время соединения с сервером SILC" - -#, c-format -msgid "Failure: Version mismatch, upgrade your client" -msgstr "Ошибка: Несоответствие версии, обновите свой клиент" - -#, c-format -msgid "Failure: Remote does not trust/support your public key" -msgstr "Ошибка: Удалённая система не признаёт/поддерживает ваш публичный ключ" - -#, c-format -msgid "Failure: Remote does not support proposed KE group" -msgstr "Ошибка: Удалённая система не поддерживает предложенную группу KE" - -#, c-format -msgid "Failure: Remote does not support proposed cipher" -msgstr "Ошибка: Удалённая система не поддерживает предложенный шифр" - -#, c-format -msgid "Failure: Remote does not support proposed PKCS" -msgstr "Ошибка: Удалённая система не поддерживает предложенный PKCS" - -#, c-format -msgid "Failure: Remote does not support proposed hash function" -msgstr "Ошибка: Удалённая система не поддерживает предложенную хэш-функцию" - -#, c-format -msgid "Failure: Remote does not support proposed HMAC" -msgstr "Ошибка: Удалённая система не поддерживает предложенный HMAC" - -#, c-format -msgid "Failure: Incorrect signature" -msgstr "Ошибка: Неправильная подпись" - -#, c-format -msgid "Failure: Invalid cookie" -msgstr "Ошибка: Неверные данные" - -#, c-format -msgid "Failure: Authentication failed" -msgstr "Ошибка: Аутентификация завершилась неудачно" - -msgid "Unable to initialize SILC Client connection" -msgstr "Не удаётся инициализировать соединение SILC-клиента" - -msgid "John Noname" -msgstr "Иван Безымянный" - -#, c-format -msgid "Unable to load SILC key pair: %s" -msgstr "Не удалось загрузить пару ключей SILC: %s" - -msgid "Unable to create connection" -msgstr "Не удаётся создать соединение" - msgid "Unknown server response" msgstr "Неизвестный ответ сервера" msgid "Unable to create listen socket" msgstr "Не удаётся создать прослушку сокета" -#, fuzzy -msgid "Unable to resolve hostname" -msgstr "Не удаётся получить имя узла" - msgid "SIP usernames may not contain whitespaces or @ symbols" msgstr "Имена пользователей SIP не могут содержать пробелы или символы @" @@ -9798,14 +9719,12 @@ msgstr "Языковой формат чата" msgid "Ignore conference and chatroom invitations" msgstr "Игнорировать приглашения в конференции и чаты" -#, fuzzy msgid "Use account proxy for HTTP and HTTPS connections" -msgstr "Используйте прокси учётной записи для SSL-соединений" +msgstr "Используйте прокси учётной записи для HTTP и HTTPS соединений" msgid "Chat room list URL" msgstr "URL списка чатов" -#, fuzzy msgid "Yahoo JAPAN ID..." msgstr "Yahoo JAPAN ID..." @@ -9819,9 +9738,8 @@ msgstr "Yahoo JAPAN ID..." #. *< version #. * summary #. * description -#, fuzzy msgid "Yahoo! JAPAN Protocol Plugin" -msgstr "Модуль протокола Yahoo" +msgstr "Модуль протокола Yahoo! JAPAN" #, c-format msgid "%s has sent you a webcam invite, which is not yet supported." @@ -9855,41 +9773,36 @@ msgid "Add buddy rejected" msgstr "В добавлении собеседника отказано" #. Some error in the received stream -#, fuzzy msgid "Received invalid data" msgstr "Получены некорректные данные" #. security lock from too many failed login attempts -#, fuzzy msgid "" "Account locked: Too many failed login attempts. Logging into the Yahoo! " "website may fix this." msgstr "" "Учётная запись заблокирована: слишком много неудачных попыток входа. Вход " -"на веб-сайт Yahoo! может исправить это." +"на веб-сайт Yahoo!, возможно, исправит это." #. indicates a lock of some description -#, fuzzy msgid "" "Account locked: Unknown reason. Logging into the Yahoo! website may fix " "this." msgstr "" -"Учётная запись заблокирована: неизвестная причина. Вход на веб-сайт Yahoo! " -"может исправить это." +"Учётная запись заблокирована: неизвестная причина. Вход на веб-сайт Yahoo!, " +"возможно, исправит это." #. indicates a lock due to logging in too frequently -#, fuzzy msgid "" "Account locked: You have been logging in too frequently. Wait a few minutes " "before trying to connect again. Logging into the Yahoo! website may help." msgstr "" -"Учётная запись заблокирована: слишком много неудачных попыток входа. Вход " -"на веб-сайт Yahoo! может исправить это." +"Учётная запись заблокирована: вы слишком часто входили. Подождите пару минут " +"и попробуйте снова. Вход на веб-сайт Yahoo!, возможно, исправит это." #. username or password missing -#, fuzzy msgid "Username or password missing" -msgstr "Отсутствует имя пользователя или пароль" +msgstr "Нет имени пользователя или пароля" #, c-format msgid "" @@ -9915,17 +9828,15 @@ msgstr "" msgid "Ignore buddy?" msgstr "Игнорировать собеседника?" -#, fuzzy msgid "Invalid username or password" -msgstr "Неправильное имя пользователя или пароль" +msgstr "Некорректное имя пользователя или пароль" -#, fuzzy msgid "" "Your account has been locked due to too many failed login attempts. Please " "try logging into the Yahoo! website." msgstr "" "Ваша учётная запись была заблокирована из-за слишком большого количества " -"неверных попыток авторизации. Пожалуйста, попробуйте войти на веб-сайт " +"неверных попыток входа. Пожалуйста, попробуйте войти на веб-сайт " "Yahoo!." #, c-format @@ -9944,13 +9855,12 @@ msgid "Unknown error number %d. Logging into the Yahoo! website may fix this." msgstr "" "Неизвестная ошибка номер %d. Вход с web-сайта Yahoo! может исправить это." -#, fuzzy, c-format +#, c-format msgid "Unable to add buddy %s to group %s to the server list on account %s." msgstr "" "Не удалось добавить собеседника %s в группу %s в список на сервере учётной " "записи %s." -#, fuzzy msgid "Unable to add buddy to server list" msgstr "Не удалось добавить собеседника в список на сервере" @@ -10183,9 +10093,8 @@ msgstr "Не удаётся загрузить список комнат." msgid "User Rooms" msgstr "Комнаты пользователя" -#, fuzzy msgid "Connection problem with the YCHT server" -msgstr "Проблема с соединением с сервером YCHT." +msgstr "Проблема соединения с сервером YCHT" msgid "" "(There was an error converting this message.\t Check the 'Encoding' option " @@ -10201,6 +10110,8 @@ msgstr "Не удаётся отправить в чат %s,%s,%s" msgid "Hidden or not logged-in" msgstr "Скрыт или не в сети" +#. TODO: Need to escape locs.host and locs.time? +#. TODO: Need to escape the two strings that make up tmp? #, c-format msgid "
    At %s since %s" msgstr "
    В %s с %s" @@ -10407,9 +10318,6 @@ msgstr "Сохранённое изображение" msgid "Stored Image. (that'll have to do for now)" msgstr "Сохранённое изображение. (это предстоит сделать)" -msgid "SSL Connection Failed" -msgstr "Не удалось установить SSL-соединение" - msgid "SSL Handshake Failed" msgstr "SSL-рукопожатие не удалось" @@ -10428,9 +10336,8 @@ msgstr "Не беспокоить" msgid "Extended away" msgstr "Расширенный \"Отошёл\"" -#, fuzzy msgid "Feeling" -msgstr "Получение" +msgstr "Чувство" #, c-format msgid "%s (%s) changed status from %s to %s" @@ -10526,9 +10433,9 @@ msgstr "Не могу открыть %s: Перенаправлено слишк msgid "Unable to connect to %s" msgstr "Не удаётся соединиться с %s" -#, fuzzy, c-format +#, c-format msgid "Error reading from %s: response too long (%d bytes limit)" -msgstr "Ошибка чтения из %s: ответ слишком длинный (ограничение %d байт)" +msgstr "Ошибка чтения из %s: ответ слишком длинный (ограничение в %d байт)" #, c-format msgid "" @@ -10575,7 +10482,6 @@ msgid "Connection refused." msgstr "Соединение отвергнуто." #. 10048 -#, fuzzy msgid "Address already in use." msgstr "Адрес уже используется." @@ -10583,12 +10489,12 @@ msgstr "Адрес уже используется." msgid "Error Reading %s" msgstr "Ошибка чтения %s" -#, fuzzy, c-format +#, c-format msgid "" "An error was encountered reading your %s. The file has not been loaded, and " "the old file has been renamed to %s~." msgstr "" -"Произошла ошибка при чтении %s. Файл не был загружен, а старый файл был " +"Произошла ошибка при чтении вашего %s. Файл не был загружен, а старый файл был " "переименован в %s~." msgid "" @@ -10608,7 +10514,7 @@ msgid "Login Options" msgstr "Параметры входа" msgid "Pro_tocol:" -msgstr "П_ротокол:" +msgstr "_Протокол:" msgid "_Username:" msgstr "_Имя пользователя:" @@ -10624,13 +10530,12 @@ msgid "_Local alias:" msgstr "_Локальный псевдоним:" msgid "New _mail notifications" -msgstr "Уведомления о новой по_чте" +msgstr "_Уведомления о новой почте" #. Buddy icon msgid "Use this buddy _icon for this account:" msgstr "Использовать этот _значок собеседника для этой учётной записи:" -#, fuzzy msgid "Ad_vanced" msgstr "_Дополнительно" @@ -10650,7 +10555,7 @@ msgid "SOCKS 5" msgstr "SOCKS 5" msgid "Tor/Privacy (SOCKS5)" -msgstr "" +msgstr "Tor/Конфиденциальность (SOCKS5)" msgid "HTTP" msgstr "HTTP" @@ -10671,24 +10576,22 @@ msgid "you can see the butterflies mating" msgstr "вы можете увидеть спаривающихся бабочек" msgid "Proxy _type:" -msgstr "Т_ип прокси:" +msgstr "_Тип прокси:" msgid "_Host:" msgstr "_Узел:" msgid "_Port:" -msgstr "П_орт:" +msgstr "По_рт:" msgid "Pa_ssword:" -msgstr "Па_роль:" +msgstr "_Пароль:" -#, fuzzy msgid "Use _silence suppression" -msgstr "Возобновление сессии" +msgstr "Использовать ти_хое подавление" -#, fuzzy msgid "_Voice and Video" -msgstr "голос и видео" +msgstr "_Голос и видео" msgid "Unable to save new account" msgstr "Не удаётся сохранить новую учётную запись" @@ -10706,7 +10609,7 @@ msgid "Create _this new account on the server" msgstr "Создать _эту новую учётную запись на сервере" msgid "P_roxy" -msgstr "П_рокси" +msgstr "Про_кси" msgid "Enabled" msgstr "Включено" @@ -10737,19 +10640,20 @@ msgstr "" "учётных записей позже через меню Уч.записи->Управление учётными записями в окне списка собеседников." -#, fuzzy, c-format +#, c-format msgid "" "%s%s%s%s wants to add you (%s) to his or her buddy " "list%s%s" -msgstr "%s%s%s%s хочет добавить %s в свой список собеседников%s%s" +msgstr "" +"%s%s%s%s хочет добавить вас (%s) в свой список " +"собеседников%s%s" -#, fuzzy, c-format +#, c-format msgid "%s%s%s%s wants to add you (%s) to his or her buddy list%s%s" -msgstr "%s%s%s%s хочет добавить %s в свой список собеседников%s%s" +msgstr "%s%s%s%s хочет добавить вас (%s) в свой список собеседников%s%s" -#, fuzzy msgid "Send Instant Message" -msgstr "Новое мгновенное сообщение" +msgstr "Послать мгновенное сообщение" #. Buddy List msgid "Background Color" @@ -10775,27 +10679,24 @@ msgstr "Цвет фона развёрнутой группы" #. Note to translators: These two strings refer to the font and color #. of a buddy list group when in its expanded state -#, fuzzy msgid "Expanded Text" -msgstr "Текст развёрнутой группы" +msgstr "Шрифт и цвет текста развёрнутой группы" msgid "The text information for when a group is expanded" msgstr "Текстовая информация, когда группа развёрнута" #. Note to translators: These two strings refer to the background color #. of a buddy list group when in its collapsed state -#, fuzzy msgid "Collapsed Background Color" msgstr "Цвет фона свёрнутой группы" msgid "The background color of a collapsed group" -msgstr "Цвет фона свёрнутой группы" +msgstr "Цвет фона для свёрнутой группы" #. Note to translators: These two strings refer to the font and color #. of a buddy list group when in its collapsed state -#, fuzzy msgid "Collapsed Text" -msgstr "Текст свёрнутой группы" +msgstr "Шрифт и цвет текста свёрнутой группы" msgid "The text information for when a group is collapsed" msgstr "Текстовая информация, когда группа свёрнута" @@ -10803,55 +10704,48 @@ msgstr "Текстовая информация, когда группа свё #. Buddy #. Note to translators: These two strings refer to the background color #. of a buddy list contact or chat room -#, fuzzy msgid "Contact/Chat Background Color" -msgstr "Цвет фона контактов/переписки" +msgstr "Цвет фона контакта/переписки" msgid "The background color of a contact or chat" msgstr "Цвет фона контакта или переписки" #. Note to translators: These two strings refer to the font and color #. of a buddy list contact when in its expanded state -#, fuzzy msgid "Contact Text" -msgstr "Текст контактов" +msgstr "Шрифт и цвет текста развёрнутого контакта" msgid "The text information for when a contact is expanded" msgstr "Текстовая информация, когда контакт развёрнут" #. Note to translators: These two strings refer to the font and color #. of a buddy list buddy when it is online -#, fuzzy msgid "Online Text" -msgstr "В сети" +msgstr "Шрифт и цвет собеседника в сети" msgid "The text information for when a buddy is online" msgstr "Текстовая информация, когда собеседник в сети" #. Note to translators: These two strings refer to the font and color #. of a buddy list buddy when it is away -#, fuzzy msgid "Away Text" -msgstr "Отошёл" +msgstr "Шрифт и цвет собеседника, который отошёл" msgid "The text information for when a buddy is away" msgstr "Текстовая информация, когда собеседник отошёл" #. Note to translators: These two strings refer to the font and color #. of a buddy list buddy when it is offline -#, fuzzy msgid "Offline Text" -msgstr "Не в сети" +msgstr "Шрифт и цвет собеседника не в сети" -#, fuzzy msgid "The text information for when a buddy is offline" -msgstr "Текстовая информация, когд собеседник не в сети" +msgstr "Текстовая информация, когда собеседник не в сети" #. Note to translators: These two strings refer to the font and color #. of a buddy list buddy when it is idle -#, fuzzy msgid "Idle Text" -msgstr "Текст бездействия" +msgstr "Шрифт и цвет собеседника, который простаивает" msgid "The text information for when a buddy is idle" msgstr "Текстовая информация, когда собеседник бездействует" @@ -10859,7 +10753,7 @@ msgstr "Текстовая информация, когда собеседник #. Note to translators: These two strings refer to the font and color #. of a buddy list buddy when they have sent you a new message msgid "Message Text" -msgstr "Текст сообщения" +msgstr "Шрифт и цвет собеседника, который прислал вам новое сообщение" msgid "The text information for when a buddy has an unread message" msgstr "Текстовая информация, когда у собеседника есть непрочитанные сообщения" @@ -10867,7 +10761,9 @@ msgstr "Текстовая информация, когда у собеседн #. Note to translators: These two strings refer to the font and color #. of a buddy list buddy when they have sent you a new message msgid "Message (Nick Said) Text" -msgstr "Текст (кто-то сказал) сообщения" +msgstr "" +"Шрифт и цвет собеседника, который прислал вам новое сообщение (с указанием " +"имени)" msgid "" "The text information for when a chat has an unread message that mentions " @@ -11117,26 +11013,25 @@ msgid "/_Help" msgstr "/_Помощь" msgid "/Help/Online _Help" -msgstr "/Помощь/Помощь в _сети" +msgstr "/Помощь/Помо_щь в сети" msgid "/Help/_Build Information" -msgstr "/Помощь/Информация о с_борке" +msgstr "/Помощь/Информация о _сборке" msgid "/Help/_Debug Window" -msgstr "/Помощь/Окно _отладки" +msgstr "/Помощь/_Окно отладки" msgid "/Help/De_veloper Information" -msgstr "/Помощь/Информация о разработ_чике" +msgstr "/Помощь/Информация о _разработчике" -#, fuzzy msgid "/Help/_Plugin Information" -msgstr "/Помощь/Информация о с_борке" +msgstr "/Помощь/Информация о _модуле" msgid "/Help/_Translator Information" -msgstr "/Помощь/Информация о перево_дчике" +msgstr "/Помощь/Информация о _переводчике" msgid "/Help/_About" -msgstr "/Помощь/О _программе" +msgstr "/Помощь/О программ_е" #, c-format msgid "Account: %s" @@ -11278,7 +11173,7 @@ msgid "/Accounts" msgstr "/Учётные записи" #. Translators: Please maintain the use of -> and <- to refer to menu heirarchy -#, fuzzy, c-format +#, c-format msgid "" "Welcome to %s!\n" "\n" @@ -11289,7 +11184,7 @@ msgstr "" "Добро пожаловать в %s!\n" "\n" "У вас нет включённых учётных записей. Включите их из окна Учётные записи через меню Учётные записи->Управление учётными записями. Сделав " +"b> через меню Уч.записи->Управление учётными записями. Сделав " "это, вы сможете войти в сеть, установить свой статус и начать общение с " "друзьями." @@ -11320,9 +11215,8 @@ msgstr "_Имя пользователя собеседника:" msgid "(Optional) A_lias:" msgstr "_Псевдоним (не обязателен):" -#, fuzzy msgid "(Optional) _Invite message:" -msgstr "Пригласительное сообщение" +msgstr "(необязательно) Пригласительное _сообщение:" msgid "Add buddy to _group:" msgstr "Добавить собеседника в _группу:" @@ -11391,6 +11285,21 @@ msgstr "Укажите имя узла для этого сертификата. msgid "SSL Servers" msgstr "SSL-серверы" +msgid "Unsafe debugging is now disabled." +msgstr "Небезопасная отладка сейчас запрещена." + +msgid "Unsafe debugging is now enabled." +msgstr "Небезопасная отладка сейчас разрешена." + +msgid "Verbose debugging is now disabled." +msgstr "Подробная отладка сейчас отключена" + +msgid "Verbose debugging is now enabled." +msgstr "Подробная отладка сейчас включена." + +msgid "Supported debug options are: plugins version unsafe verbose" +msgstr "Поддерживаемые параметры отладки: модули версия небезопасная подробная" + msgid "Unknown command." msgstr "Неизвестная команда." @@ -11424,9 +11333,6 @@ msgstr "Не игнорировать" msgid "Ignore" msgstr "Игнорировать" -msgid "Get Away Message" -msgstr "Получить сообщение об отсутствии" - msgid "Last Said" msgstr "Последнее сказанное" @@ -11642,13 +11548,11 @@ msgstr "_Отправить" msgid "0 people in room" msgstr "0 пользователей в комнате" -#, fuzzy msgid "Close Find bar" -msgstr "Закрыть эту вкладку" +msgstr "Закрыть строку поиска" -#, fuzzy msgid "Find:" -msgstr "Найти" +msgstr "Найти:" #, c-format msgid "%d person in room" @@ -11809,9 +11713,8 @@ msgstr "Африкаанс" msgid "Arabic" msgstr "Арабский" -#, fuzzy msgid "Assamese" -msgstr "Стыдящийся" +msgstr "Ассамский" msgid "Belarusian Latin" msgstr "Белорусская латиница" @@ -11822,9 +11725,8 @@ msgstr "Болгарский" msgid "Bengali" msgstr "Бенгальский" -#, fuzzy msgid "Bengali-India" -msgstr "Бенгальский" +msgstr "Бенгальский-индийский" msgid "Bosnian" msgstr "Боснийский" @@ -11899,7 +11801,7 @@ msgid "Hindi" msgstr "Хинди" msgid "Croatian" -msgstr "" +msgstr "Хорватский" msgid "Hungarian" msgstr "Венгерский" @@ -11940,20 +11842,17 @@ msgstr "Курдский" msgid "Lao" msgstr "Лаосский" -#, fuzzy msgid "Maithili" -msgstr "Суахили" +msgstr "Майтхили" -#, fuzzy msgid "Meadow Mari" -msgstr "Новая почта" +msgstr "Луговомарийский" msgid "Macedonian" msgstr "Македонский" -#, fuzzy msgid "Malayalam" -msgstr "Малайский" +msgstr "Малаялам" msgid "Mongolian" msgstr "Монгольский" @@ -11979,9 +11878,8 @@ msgstr "Норвежский нюнорск" msgid "Occitan" msgstr "Осетинский" -#, fuzzy msgid "Oriya" -msgstr "Opera" +msgstr "Ория" msgid "Punjabi" msgstr "Панджаби" @@ -12070,8 +11968,8 @@ msgid "" "to multiple messaging services at once. %s is written in C using GTK+. %s " "is released, and may be modified and redistributed, under the terms of the " "GPL version 2 (or later). A copy of the GPL is distributed with %s. %s is " -"copyrighted by its contributors, a list of whom is also distributed with " -"%s. There is no warranty for %s.

    " +"copyrighted by its contributors, a list of whom is also distributed with %" +"s. There is no warranty for %s.

    " msgstr "" "%s - клиент обмена сообщениями, основанный на библиотеке libpurple, которая " "позволяет одновременно подключаться по нескольким службам. %s написан на С с " @@ -12133,9 +12031,9 @@ msgstr "Разработчики, отошедшие от дел" msgid "Retired Crazy Patch Writers" msgstr "Одержимые писатели заплаток, отошедшие от дел" -#, fuzzy, c-format +#, c-format msgid "%s Developer Information" -msgstr "Информация о сервере" +msgstr "Информация разработчика %s" msgid "Current Translators" msgstr "Текущие переводчики" @@ -12143,17 +12041,16 @@ msgstr "Текущие переводчики" msgid "Past Translators" msgstr "Предыдущие переводчики" -#, fuzzy, c-format +#, c-format msgid "%s Translator Information" -msgstr "Больше информации" +msgstr "Информация переводчика %s" -#, fuzzy, c-format +#, c-format msgid "%s Plugin Information" -msgstr "Информация о сборке %s" +msgstr "Информация модуля %s" -#, fuzzy msgid "Plugin Information" -msgstr "Информация входа" +msgstr "Информация модуля" msgid "_Name" msgstr "_Имя" @@ -12174,12 +12071,6 @@ msgstr "" msgid "View User Log" msgstr "Просмотреть журнал пользователя" -msgid "Alias Contact" -msgstr "Псевдоним контакта" - -msgid "Enter an alias for this contact." -msgstr "Введите псевдоним для этого контакта." - #, c-format msgid "Enter an alias for %s." msgstr "Введите псевдоним для %s." @@ -12376,9 +12267,8 @@ msgstr "Цвет для отображения гиперссылок." msgid "Hyperlink visited color" msgstr "Цвет посещённой гиперссылки" -#, fuzzy msgid "Color to draw hyperlink after it has been visited (or activated)." -msgstr "Цвет для отображения гиперссылок после их посещения (или активации)." +msgstr "Цвет посещённой (или активированной) гиперссылки." msgid "Hyperlink prelight color" msgstr "Цвет подсветки гиперссылки" @@ -12386,16 +12276,14 @@ msgstr "Цвет подсветки гиперссылки" msgid "Color to draw hyperlinks when mouse is over them." msgstr "Цвет для отображения гиперссылок при наведении на них курсора мыши." -#, fuzzy msgid "Sent Message Name Color" -msgstr "Цвет заголовка отправленного сообщения" +msgstr "Цвет имени отправленного сообщения" msgid "Color to draw the name of a message you sent." msgstr "Цвет для отображения имени сообщения, отправленного вами." -#, fuzzy msgid "Received Message Name Color" -msgstr "Цвет заголовка полученного сообщения" +msgstr "Цвет имени полученного сообщения" msgid "Color to draw the name of a message you received." msgstr "Цвет для отображения имени сообщения, полученного вами." @@ -12417,17 +12305,14 @@ msgstr "Цвет для отображения имени сообщения д msgid "Action Message Name Color for Whispered Message" msgstr "Цвет имени сообщения действия для прошепченного сообщения" -#, fuzzy msgid "Color to draw the name of a whispered action message." -msgstr "Цвет для отображения имени сообщения действия." +msgstr "Цвет имени сообщения тихого действия." -#, fuzzy msgid "Whisper Message Name Color" -msgstr "Цвет имени прошепченного сообщения" +msgstr "Цвет имени тихого сообщения" -#, fuzzy msgid "Color to draw the name of a whispered message." -msgstr "Цвет для отображения имени сообщения действия." +msgstr "Цвет имени тихого сообщения." msgid "Typing notification color" msgstr "Цвет уведомления о наборе" @@ -12631,21 +12516,21 @@ msgid "" "Are you sure you want to permanently delete the log of the conversation with " "%s which started at %s?" msgstr "" -"Вы действительно хотите безвозвратно удалить журнал беседы с %s, начатый в " -"%s?" +"Вы действительно хотите безвозвратно удалить журнал беседы с %s, начатый в %" +"s?" #, c-format msgid "" -"Are you sure you want to permanently delete the log of the conversation in " -"%s which started at %s?" +"Are you sure you want to permanently delete the log of the conversation in %" +"s which started at %s?" msgstr "" -"Вы действительно хотите безвозвратно удалить журнал беседы в %s, начатый в " -"%s?" +"Вы действительно хотите безвозвратно удалить журнал беседы в %s, начатый в %" +"s?" #, c-format msgid "" -"Are you sure you want to permanently delete the system log which started at " -"%s?" +"Are you sure you want to permanently delete the system log which started at %" +"s?" msgstr "" "Вы действительно хотите безвозвратно удалить системный журнал, начатый в %s?" @@ -12766,9 +12651,18 @@ msgstr "%s желает начать видеосеанс с вами." msgid "Incoming Call" msgstr "Входящий звонок" +msgid "_Hold" +msgstr "_Удерживать" + msgid "_Pause" msgstr "_Пауза" +msgid "_Mute" +msgstr "_Без звука" + +msgid "Call in progress" +msgstr "Разговор идёт" + #, c-format msgid "%s has %d new message." msgid_plural "%s has %d new messages." @@ -12992,6 +12886,9 @@ msgstr "Звуковая тема Pidgin по умолчанию" msgid "The default Pidgin buddy list theme" msgstr "Тема списка собеседников Pidgin по умолчанию" +msgid "The default Pidgin conversation theme" +msgstr "Тема беседы Pidgin по умолчанию" + msgid "The default Pidgin status icon theme" msgstr "Тема значков состояния Pidgin по умолчанию" @@ -13019,6 +12916,12 @@ msgstr "" msgid "Buddy List Theme:" msgstr "Тема Списка собеседников:" +msgid "Conversation Theme:" +msgstr "Тема разговора:" + +msgid "\tVariant:" +msgstr "\tВариант:" + msgid "Status Icon Theme:" msgstr "Тема значков состояния:" @@ -13114,13 +13017,11 @@ msgstr "Использовать плавную прокрутку" msgid "F_lash window when IMs are received" msgstr "_Мерцать окном при получении мгновенных сообщений" -#, fuzzy msgid "Resize incoming custom smileys" -msgstr "_Управлять своими смайликами" +msgstr "_Изменить размер неродных смайликов" -#, fuzzy msgid "Maximum size:" -msgstr "Максимальное время ожидания отклика:" +msgstr "Максимальный размер:" msgid "Minimum input area height in lines:" msgstr "Минимальная высота области ввода (в строках):" @@ -13191,9 +13092,8 @@ msgstr "_TURN сервер:" msgid "_UDP Port:" msgstr "_UDP порт:" -#, fuzzy msgid "T_CP Port:" -msgstr "_UDP порт:" +msgstr "T_CP порт:" msgid "Use_rname:" msgstr "Им_я пользователя:" @@ -13959,7 +13859,7 @@ msgstr "" #. Create the window. msgid "Service Discovery" -msgstr "Открытие служб" +msgstr "Просмотр служб" msgid "_Browse" msgstr "О_бзор" @@ -13968,10 +13868,10 @@ msgid "Server does not exist" msgstr "Сервер не существует" msgid "Server does not support service discovery" -msgstr "Сервер не поддерживает открытие служб" +msgstr "Сервер не поддерживает просмотр служб" msgid "XMPP Service Discovery" -msgstr "Открытие XMPP службы" +msgstr "Просмотр службы XMPP" msgid "Allows browsing and registering services." msgstr "Позволяет просматривать и регистрировать службы." @@ -14746,7 +14646,6 @@ msgstr "Использовать системный по умолчанию" msgid "12 hour time format" msgstr "12-часовой формат времени" -#, fuzzy msgid "24 hour time format" msgstr "24-часовой формат времени" @@ -15026,8 +14925,8 @@ msgstr "" #, no-c-format msgid "" "Error Installing Spellchecking ($R3).$\\rIf retrying fails, manual " -"installation instructions are at: http://developer.pidgin.im/wiki/Installing" -"%20Pidgin#manual_win32_spellcheck_installation" +"installation instructions are at: http://developer.pidgin.im/wiki/Installing%" +"20Pidgin#manual_win32_spellcheck_installation" msgstr "" "Ошибка при установке проверки орфографии ($R3).$\\rЕсли снова не будет " "получаться, инструкции по ручной установке здесь: http://developer.pidgin.im/" @@ -15107,6 +15006,98 @@ msgstr "Посетите веб-страницу Pidgin" msgid "You do not have permission to uninstall this application." msgstr "У Вас нет прав на удаление этого приложения." +#~ msgid "" +#~ "%s encountered errors migrating your settings from %s to %s. Please " +#~ "investigate and complete the migration by hand. Please report this error " +#~ "at http://developer.pidgin.im" +#~ msgstr "" +#~ "%s столкнулся с ошибками при переносе ваших настроек из %s в %s. " +#~ "Пожалуйста разберитесь в чём дело и завершите перенос вручную. Пожалуйста " +#~ "уведомите об этой ошибке на http://developer.pidgin.im" + +#~ msgid "Gadu-Gadu User" +#~ msgstr "Пользователь Gadu-Gadu" + +#~ msgid "Hidden Number" +#~ msgstr "Скрытый номер" + +#~ msgid "No Sametime Community Server specified" +#~ msgstr "Не указан текущий сервер общества" + +#~ msgid "" +#~ "No host or IP address has been configured for the Meanwhile account %s. " +#~ "Please enter one below to continue logging in." +#~ msgstr "" +#~ "Для временной учётной записи %s не был настроен ни узел, ни IP-адрес. " +#~ "Пожалуйста, введите что-то снизу для продолжение входа." + +#~ msgid "Meanwhile Connection Setup" +#~ msgstr "Настройка временного соединения" + +#~ msgid "No Sametime Community Server Specified" +#~ msgstr "Не указан текущий сервер общества" + +#~ msgid "Connect" +#~ msgstr "Установить соединение" + +#~ msgid "No server statistics available" +#~ msgstr "Нет доступной статистики сервера" + +#~ msgid "Error during connecting to SILC Server" +#~ msgstr "Ошибка во время соединения с сервером SILC" + +#~ msgid "Failure: Version mismatch, upgrade your client" +#~ msgstr "Ошибка: Несоответствие версии, обновите свой клиент" + +#~ msgid "Failure: Remote does not trust/support your public key" +#~ msgstr "" +#~ "Ошибка: Удалённая система не признаёт/поддерживает ваш публичный ключ" + +#~ msgid "Failure: Remote does not support proposed KE group" +#~ msgstr "Ошибка: Удалённая система не поддерживает предложенную группу KE" + +#~ msgid "Failure: Remote does not support proposed cipher" +#~ msgstr "Ошибка: Удалённая система не поддерживает предложенный шифр" + +#~ msgid "Failure: Remote does not support proposed PKCS" +#~ msgstr "Ошибка: Удалённая система не поддерживает предложенный PKCS" + +#~ msgid "Failure: Remote does not support proposed hash function" +#~ msgstr "Ошибка: Удалённая система не поддерживает предложенную хэш-функцию" + +#~ msgid "Failure: Remote does not support proposed HMAC" +#~ msgstr "Ошибка: Удалённая система не поддерживает предложенный HMAC" + +#~ msgid "Failure: Incorrect signature" +#~ msgstr "Ошибка: Неправильная подпись" + +#~ msgid "Failure: Invalid cookie" +#~ msgstr "Ошибка: Неверные данные" + +#~ msgid "Failure: Authentication failed" +#~ msgstr "Ошибка: Аутентификация завершилась неудачно" + +#~ msgid "Unable to initialize SILC Client connection" +#~ msgstr "Не удаётся инициализировать соединение SILC-клиента" + +#~ msgid "John Noname" +#~ msgstr "Иван Безымянный" + +#~ msgid "Unable to load SILC key pair: %s" +#~ msgstr "Не удалось загрузить пару ключей SILC: %s" + +#~ msgid "Unable to create connection" +#~ msgstr "Не удаётся создать соединение" + +#~ msgid "Get Away Message" +#~ msgstr "Получить сообщение об отсутствии" + +#~ msgid "Alias Contact" +#~ msgstr "Псевдоним контакта" + +#~ msgid "Enter an alias for this contact." +#~ msgstr "Введите псевдоним для этого контакта." + #~ msgid "Your UID" #~ msgstr "Ваш UID" @@ -15188,14 +15179,12 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Pig" #~ msgstr "Свинья" -#, fuzzy #~ msgid "Visible" #~ msgstr "Видимый" #~ msgid "Friend Only" #~ msgstr "Только друг" -#, fuzzy #~ msgid "Private" #~ msgstr "Личный" @@ -15214,9 +15203,8 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Phone Number" #~ msgstr "Номер телефона" -#, fuzzy #~ msgid "Authorize adding" -#~ msgstr "Авторизированное добавление" +#~ msgstr "Авторизировать добавление" #~ msgid "Cellphone Number" #~ msgstr "Номер сотового телефона" @@ -15224,62 +15212,48 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Personal Introduction" #~ msgstr "Личное представление" -#, fuzzy #~ msgid "City/Area" #~ msgstr "Город/Область" -#, fuzzy #~ msgid "Publish Mobile" -#~ msgstr "Огласить мобильный телефон" +#~ msgstr "Опубликовать мобильный телефон" -#, fuzzy #~ msgid "Publish Contact" -#~ msgstr "Огласить контакт" +#~ msgstr "Опубликовать контакт" #~ msgid "College" #~ msgstr "Колледж" -#, fuzzy #~ msgid "Horoscope" #~ msgstr "Гороскоп" -#, fuzzy #~ msgid "Zodiac" #~ msgstr "Знак зодиака" -#, fuzzy #~ msgid "Blood" -#~ msgstr "Кровь" +#~ msgstr "Группа крови" -#, fuzzy #~ msgid "True" #~ msgstr "Правда" -#, fuzzy #~ msgid "False" #~ msgstr "Ложь" -#, fuzzy #~ msgid "Modify Contact" #~ msgstr "Изменить контакт" -#, fuzzy #~ msgid "Modify Address" #~ msgstr "Изменить адрес" -#, fuzzy #~ msgid "Modify Extended Information" #~ msgstr "Изменить расширенную информацию" -#, fuzzy #~ msgid "Modify Information" #~ msgstr "Изменить информацию" -#, fuzzy #~ msgid "Update" #~ msgstr "Обновить" -#, fuzzy #~ msgid "Could not change buddy information." #~ msgstr "Не могу изменить информацию о собеседнике." @@ -15295,7 +15269,6 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Memo Modify" #~ msgstr "Изменить заметку" -#, fuzzy #~ msgid "Server says:" #~ msgstr "Сервер говорит:" @@ -15305,69 +15278,54 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Your request was rejected." #~ msgstr "Ваш запрос был отклонён." -#, fuzzy #~ msgid "%u requires verification: %s" -#~ msgstr "%u требует подтверждения" +#~ msgstr "%u требует подтверждения: %s" -#, fuzzy #~ msgid "Add buddy question" #~ msgstr "Добавить вопрос собеседника" -#, fuzzy #~ msgid "Enter answer here" #~ msgstr "Введите ответ здесь" #~ msgid "Send" #~ msgstr "Отправить" -#, fuzzy #~ msgid "Invalid answer." #~ msgstr "Неверный ответ." -#, fuzzy #~ msgid "Sorry, you're not my style." -#~ msgstr "Извините, вы не в моём вкусе..." +#~ msgstr "Извините, вы не в моём вкусе." -#, fuzzy #~ msgid "%u needs authorization" #~ msgstr "%u требует авторизации" -#, fuzzy #~ msgid "Add buddy authorize" #~ msgstr "Добавить авторизацию собеседника" -#, fuzzy #~ msgid "Enter request here" #~ msgstr "Введите запрос здесь" #~ msgid "Would you be my friend?" #~ msgstr "Будешь моим другом?" -#, fuzzy #~ msgid "QQ Buddy" #~ msgstr "Собеседник QQ" -#, fuzzy #~ msgid "Add buddy" #~ msgstr "Добавить собеседника" -#, fuzzy #~ msgid "Invalid QQ Number" #~ msgstr "Неверный номер QQ" -#, fuzzy #~ msgid "Failed sending authorize" #~ msgstr "Отправка авторизации не удалась" -#, fuzzy #~ msgid "Failed removing buddy %u" #~ msgstr "Не удалось удалить собеседника %u" -#, fuzzy #~ msgid "Failed removing me from %d's buddy list" #~ msgstr "Удаление меня из списка контактов %d не удалось" -#, fuzzy #~ msgid "No reason given" #~ msgstr "Причина не указана" @@ -15377,9 +15335,8 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Would you like to add him?" #~ msgstr "Хотите добавить его?" -#, fuzzy #~ msgid "Rejected by %s" -#~ msgstr "Отвергнуто %s" +#~ msgstr "%s отклонил" #~ msgid "Message: %s" #~ msgstr "Сообщение: %s" @@ -15393,63 +15350,51 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "QQ Qun" #~ msgstr "QQ Qun" -#, fuzzy #~ msgid "Please enter Qun number" #~ msgstr "Пожалуйста, введите номер Qun" #~ msgid "You can only search for permanent Qun\n" #~ msgstr "Вы можете искать только для постоянного Qun\n" -#, fuzzy #~ msgid "(Invalid UTF-8 string)" #~ msgstr "(Неверная UTF-8 строка)" -#, fuzzy #~ msgid "Not member" #~ msgstr "Не член" -#, fuzzy #~ msgid "Member" #~ msgstr "Член" -#, fuzzy #~ msgid "Requesting" -#~ msgstr "Запрос" +#~ msgstr "Запрашиваю" -#, fuzzy #~ msgid "Admin" #~ msgstr "Админ" -#, fuzzy #~ msgid "Room Title" -#~ msgstr "Список комнат" +#~ msgstr "Заголовок комнаты" -#, fuzzy #~ msgid "Notice" #~ msgstr "Заметка" -#, fuzzy #~ msgid "Detail" -#~ msgstr "Подробности" +#~ msgstr "Подробность" #~ msgid "Creator" #~ msgstr "Создатель" -#, fuzzy #~ msgid "Category" #~ msgstr "Категория" #~ msgid "The Qun does not allow others to join" #~ msgstr "Qun не позволяет другим подсоединяться" -#, fuzzy #~ msgid "Join QQ Qun" #~ msgstr "Присоединиться к QQ Qun" #~ msgid "Input request here" #~ msgstr "Введите запрос здесь" -#, fuzzy #~ msgid "Successfully joined Qun %s (%u)" #~ msgstr "Успешно подсоединились к Qun %s (%u)" @@ -15462,14 +15407,12 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "QQ Qun Operation" #~ msgstr "Операция QQ Qun" -#, fuzzy #~ msgid "Failed:" #~ msgstr "Не удалось:" #~ msgid "Join Qun, Unknown Reply" #~ msgstr "Подсоединить Qun, Неизвестный ответ" -#, fuzzy #~ msgid "Quit Qun" #~ msgstr "Выйти из Qun" @@ -15480,24 +15423,20 @@ msgstr "У Вас нет прав на удаление этого прилож #~ "Заметьте, что если вы создатель, \n" #~ "эта операция в конечном счёте удалит этот Qun." -#, fuzzy #~ msgid "Sorry, you are not our style" -#~ msgstr "Извините, вы не в нашем вкусе..." +#~ msgstr "Извините, вы не в нашем вкусе" -#, fuzzy #~ msgid "Successfully changed Qun members" #~ msgstr "Члены Qun успешно изменены" -#, fuzzy #~ msgid "Successfully changed Qun information" #~ msgstr "Информация Qun успешно изменена" #~ msgid "You have successfully created a Qun" #~ msgstr "Вы успешно создали Qun" -#, fuzzy #~ msgid "Would you like to set up detailed information now?" -#~ msgstr "Вы хотите указать сейчас подробную информацию?" +#~ msgstr "Хотите указать подробную информацию сейчас?" #~ msgid "Setup" #~ msgstr "Указать" @@ -15508,20 +15447,17 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "%u request to join Qun %u" #~ msgstr "%u запрос на подсоединение Qun %u" -#, fuzzy #~ msgid "Failed to join Qun %u, operated by admin %u" -#~ msgstr "Не удалось присоединить Qun %u, производимое админом %u" +#~ msgstr "Не удалось присоединиться к Qun %u, производимое админом %u" #~ msgid "Joining Qun %u is approved by admin %u for %s" #~ msgstr "Подсоединение Qun %u принято админом %u для %s" -#, fuzzy #~ msgid "Removed buddy %u." -#~ msgstr "Удалён собеседник %u." +#~ msgstr "Собеседник %u удалён." -#, fuzzy #~ msgid "New buddy %u joined." -#~ msgstr "Подсоединён новый собеседник: %u." +#~ msgstr "Подсоединён новый собеседник %u." #~ msgid "Unknown-%d" #~ msgstr "Неизвестно-%d" @@ -15568,18 +15504,15 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Last Refresh: %d-%d-%d, %d:%d:%d
    \n" #~ msgstr "Последнее обновление: %d-%d-%d, %d:%d:%d
    \n" -#, fuzzy #~ msgid "Server: %s
    \n" #~ msgstr "Сервер: %s
    \n" -#, fuzzy #~ msgid "Client Tag: %s
    \n" -#~ msgstr "Значок клиента: %s
    \n" +#~ msgstr "Ярлычок клиента: %s
    \n" #~ msgid "Connection Mode: %s
    \n" #~ msgstr "Режим соединения: %s
    \n" -#, fuzzy #~ msgid "My Internet IP: %s:%d
    \n" #~ msgstr "Мой интернет-IP: %s:%d
    \n" @@ -15589,7 +15522,6 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Resend: %lu
    \n" #~ msgstr "Переотправить: %lu
    \n" -#, fuzzy #~ msgid "Lost: %lu
    \n" #~ msgstr "Потеряно: %lu
    \n" @@ -15602,7 +15534,6 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Time: %d-%d-%d, %d:%d:%d
    \n" #~ msgstr "Время: %d-%d-%d, %d:%d:%d
    \n" -#, fuzzy #~ msgid "IP: %s
    \n" #~ msgstr "IP: %s
    \n" @@ -15618,9 +15549,8 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "

    Acknowledgement:
    \n" #~ msgstr "

    Подтверждение:
    \n" -#, fuzzy #~ msgid "

    Scrupulous Testers:
    \n" -#~ msgstr "

    Исходный автор:
    \n" +#~ msgstr "

    Скрупулёзные тестеры:
    \n" #~ msgid "and more, please let me know... thank you!))" #~ msgstr "и ещё, пожалуйста, дайте мне знать... спасибо!))" @@ -15631,37 +15561,30 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Feel free to join us! :)" #~ msgstr "Чувствуйте себя свободным, присоединяясь к нам! :)" -#, fuzzy #~ msgid "About OpenQ %s" #~ msgstr "Об OpenQ %s" #~ msgid "Change Password" #~ msgstr "Изменить пароль" -#, fuzzy #~ msgid "Account Information" #~ msgstr "Информация об учётной записи" #~ msgid "Update all QQ Quns" #~ msgstr "Обновить все QQ Quns" -#, fuzzy #~ msgid "About OpenQ" #~ msgstr "Об OpenQ" -#, fuzzy #~ msgid "Modify Buddy Memo" #~ msgstr "Изменить заметку собеседника" -#, fuzzy #~ msgid "QQ Protocol Plugin" #~ msgstr "Модуль протокола QQ" -#, fuzzy #~ msgid "Auto" #~ msgstr "Авто" -#, fuzzy #~ msgid "Select Server" #~ msgstr "Выберите сервер" @@ -15686,9 +15609,8 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Show chat room when msg comes" #~ msgstr "Показать комнату чата, когда приходит сообщение" -#, fuzzy #~ msgid "Use default font" -#~ msgstr "Использовать системный по умолчанию" +#~ msgstr "Использовать стандартный шрифт" #~ msgid "Keep alive interval (seconds)" #~ msgstr "Удерживать интервал жизни (секунды)" @@ -15702,44 +15624,36 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Failed requesting token, 0x%02X" #~ msgstr "Получена неудача запроса, 0x%02X" -#, fuzzy #~ msgid "Invalid token len, %d" -#~ msgstr "Принята неверная длина, %d" +#~ msgstr "Неверная длина знака, %d" #~ msgid "Redirect_EX is not currently supported" #~ msgstr "Redirect_EX сейчас не поддерживается" -#, fuzzy #~ msgid "Activation required" #~ msgstr "Требуется активация" #~ msgid "Unknown reply code when logging in (0x%02X)" #~ msgstr "Неизвестный код ответа при входе (0x%02X)" -#, fuzzy #~ msgid "Requesting captcha" -#~ msgstr "Запрос кода подтверждения" +#~ msgstr "Запрашиваю код подтверждения" #~ msgid "Checking captcha" -#~ msgstr "Проверка кода подтверждения" +#~ msgstr "Проверяю код подтверждения" -#, fuzzy #~ msgid "Failed captcha verification" #~ msgstr "Проверка кода подтверждения не удалась" -#, fuzzy #~ msgid "Captcha Image" #~ msgstr "Картинка подтверждения" -#, fuzzy #~ msgid "Enter code" #~ msgstr "Введите код" -#, fuzzy #~ msgid "QQ Captcha Verification" #~ msgstr "Проверка кода подтверждения QQ" -#, fuzzy #~ msgid "Enter the text from the image" #~ msgstr "Введите текст с картинки" @@ -15756,27 +15670,21 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Socket error" #~ msgstr "Ошибка сокета" -#, fuzzy #~ msgid "Getting server" #~ msgstr "Получение сервера" -#, fuzzy #~ msgid "Requesting token" -#~ msgstr "Запрос опознавательного знака" +#~ msgstr "Запрашиваю опознавательный знак" -#, fuzzy #~ msgid "Invalid server or port" #~ msgstr "Некорректный сервер или порт" -#, fuzzy #~ msgid "Connecting to server" #~ msgstr "Соединение с сервером" -#, fuzzy #~ msgid "QQ Error" #~ msgstr "Ошибка QQ" -#, fuzzy #~ msgid "" #~ "Server News:\n" #~ "%s\n" @@ -16204,7 +16112,6 @@ msgstr "У Вас нет прав на удаление этого прилож #~ " --display=ЭКРАН использующийся X-экран\n" #~ " -v, --version показать текущую версию и выйти\n" -#, fuzzy #~ msgid "" #~ "%s %s\n" #~ "Usage: %s [OPTION]...\n" @@ -16225,10 +16132,11 @@ msgstr "У Вас нет прав на удаление этого прилож #~ "%s %s\n" #~ "Использование: %s [КЛЮЧ]...\n" #~ "\n" -#~ " -c, --config=КАТ использовать каталог КАТ для файлов конфигурации\n" +#~ " -c, --config=ДИР использовать директорию ДИР для файлов конфигурации\n" #~ " -d, --debug выводить отладочную информацию в стандартный вывод\n" +#~ " -f, --force-online работать он-лайн, несмотря на состояние сети\n" #~ " -h, --help показать эту справку и выйти\n" -#~ " -m, --multiple не ограничиваться единственной копией программы\n" +#~ " -m, --multiple не ограничиваться запуском только одного экземпляра программы\n" #~ " -n, --nologin не входить автоматически\n" #~ " -l, --login[=ИМЯ] включить указанную(-ые) учётную(-ые) запись(-и) \n" #~ " (необязательный аргумент ИМЯ задаёт одну или \n" @@ -16236,19 +16144,17 @@ msgstr "У Вас нет прав на удаление этого прилож #~ " без этого, только первая запись будет включена).\n" #~ " -v, --version показать текущую версию и выйти\n" -#, fuzzy #~ msgid "Malformed BOSH Connect Server" -#~ msgstr "Не удалось соединиться с сервером." +#~ msgstr "Сервер соединения BOSH плохо сформирован" -#, fuzzy #~ msgid "Unable to not load SILC key pair" -#~ msgstr "Не удалось загрузить пару ключей SILC" +#~ msgstr "Не удалось не загружать пару ключей SILC" #~ msgid "" #~ "%s declined your conference invitation to room \"%s\" because \"%s\"." #~ msgstr "" -#~ "%s отклонил ваше приглашение к конференции в комнату \"%s\" потому что " -#~ "\"%s\"." +#~ "%s отклонил ваше приглашение к конференции в комнату \"%s\" потому что \"%" +#~ "s\"." #~ msgid "Invitation Rejected" #~ msgstr "Приглашение отвергнуто" @@ -16256,9 +16162,8 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "_Resume" #~ msgstr "_Возобновить" -#, fuzzy #~ msgid "_Proxy" -#~ msgstr "Прокси" +#~ msgstr "_Прокси" #~ msgid "Cannot open socket" #~ msgstr "Не удаётся открыть сокет" @@ -16303,16 +16208,14 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Service Discovery Items" #~ msgstr "Элементы службы Разъяснения" -#, fuzzy #~ msgid "Extended Stanza Addressing" #~ msgstr "Расширенная строфная адресация" #~ msgid "Multi-User Chat" #~ msgstr "Многопользовательский чат" -#, fuzzy #~ msgid "Multi-User Chat Extended Presence Information" -#~ msgstr "Информация о расширенном присутствии многопользовательского чата." +#~ msgstr "Расширенная информация о присутствии во многопользовательском чате" #~ msgid "In-Band Bytestreams" #~ msgstr "Внутриполосные потоки информации" @@ -16350,9 +16253,8 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "User Activity" #~ msgstr "Активность пользователя" -#, fuzzy #~ msgid "Entity Capabilities" -#~ msgstr "Возможности существования" +#~ msgstr "Возможности объекта" #~ msgid "Encrypted Session Negotiations" #~ msgstr "Зашифрованный сеанс переговоров" @@ -16367,35 +16269,34 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgstr "Доступность адреса" #~ msgid "Jingle" -#~ msgstr "Звон" +#~ msgstr "Jingle" #~ msgid "Jingle Audio" -#~ msgstr "Звенящий звук" +#~ msgstr "Звук Jingle" #~ msgid "User Nickname" #~ msgstr "Псевдоним пользователя" #~ msgid "Jingle ICE UDP" -#~ msgstr "Звон ICE UDP" +#~ msgstr "Jingle ICE UDP" #~ msgid "Jingle ICE TCP" -#~ msgstr "Звон ICE TCP" +#~ msgstr "Jingle ICE TCP" #~ msgid "Jingle Raw UDP" -#~ msgstr "Звон Raw UDP" +#~ msgstr "Jingle Raw UDP" #~ msgid "Jingle Video" -#~ msgstr "Звенящее видео" +#~ msgstr "Видео Jingle" #~ msgid "Jingle DTMF" -#~ msgstr "Звон DTMF" +#~ msgstr "Jingle DTMF" #~ msgid "Message Receipts" #~ msgstr "Получение сообщений" -#, fuzzy #~ msgid "Public Key Publishing" -#~ msgstr "Файл публичного ключа" +#~ msgstr "Публикование публичного ключа" #~ msgid "User Chatting" #~ msgstr "Переписка пользователя" @@ -16406,7 +16307,6 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "User Viewing" #~ msgstr "Просмотр пользователя" -#, fuzzy #~ msgid "Stanza Encryption" #~ msgstr "Строфное шифрование" @@ -16423,7 +16323,7 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgstr "Хранилище файлов и совместное пользование" #~ msgid "STUN Service Discovery for Jingle" -#~ msgstr "Служба Разъяснения STUN для Звона" +#~ msgstr "Просмотр службы STUN для Jingle" #~ msgid "Simplified Encrypted Session Negotiation" #~ msgstr "Упрощённо зашифрованный сеанс переговоров" @@ -16476,7 +16376,6 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Invalid username." #~ msgstr "Неверное имя пользователя." -#, fuzzy #~ msgid "Could not decrypt server reply" #~ msgstr "Не могу расшифровать ответ сервера" @@ -16504,9 +16403,8 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Could not resolve hostname" #~ msgstr "Не удалось разрешить имя узла" -#, fuzzy #~ msgid "Incorrect Password" -#~ msgstr "Неправильный пароль" +#~ msgstr "Некорректный пароль" #~ msgid "" #~ "Could not establish a connection with %s:\n" @@ -16534,11 +16432,12 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Could not resolve host name" #~ msgstr "Не удалось разрешить имя узла" -#, fuzzy #~ msgid "" #~ "Unable to connect to %s: Server requires TLS/SSL, but no TLS/SSL support " #~ "was found." -#~ msgstr "Сервер требует TLS/SSL для входа. Поддержка TLS/SSL не найдена." +#~ msgstr "" +#~ "Не удалось соединиться с %s: Сервер требует TLS/SSL, но поддержка TLS/SSL " +#~ "не была найдена." #~ msgid "Conversation Window Hiding" #~ msgstr "Скрытие окон бесед" @@ -16564,13 +16463,12 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Widget Sizes" #~ msgstr "Размер виджетов" -#, fuzzy #~ msgid "" #~ "Please enter the name of the user you wish to invite,\n" #~ "along with an optional invite message." #~ msgstr "" -#~ "Введите имя пользователя, которого вы хотите пригласить,\n" -#~ "а также, по желанию, пригласительное сообщение." +#~ "Пожалуйста, введите имя пользователя, которого вы хотите пригласить,\n" +#~ "и, если хотите, пригласительное сообщение." #~ msgid "Looking up %s" #~ msgstr "Поиск %s" @@ -16747,9 +16645,8 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Add buddy Q&A" #~ msgstr "Добавить собеседника Q&A" -#, fuzzy #~ msgid "Can not decrypt get server reply" -#~ msgstr "Не удаётся получить информацию о сервере" +#~ msgstr "Не удаётся расшифровать полученный ответ сервера" #~ msgid "" #~ "Lost connection with server:\n" @@ -16818,44 +16715,35 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Failed to connect all servers" #~ msgstr "Не удалось соединиться со всеми серверами" -#, fuzzy #~ msgid "Connecting server %s, retries %d" #~ msgstr "Соединение с сервером %s, попыток %d" -#, fuzzy #~ msgid "Do you approve the requestion?" #~ msgstr "Подтверждаете запрос?" -#, fuzzy #~ msgid "Do you add the buddy?" -#~ msgstr "Хотите добавить собеседника?" +#~ msgstr "Добавляете собеседника?" -#, fuzzy #~ msgid "%s added you [%s] to buddy list" -#~ msgstr "%s добавил вас [%s] в свой список собеседников" +#~ msgstr "%s добавил вас [%s] в список собеседников" -#, fuzzy #~ msgid "QQ Budy" #~ msgstr "Собеседник QQ" #~ msgid "%s wants to add you [%s] as a friend" #~ msgstr "%s хочет добавить вас [%s] в качестве друга" -#, fuzzy #~ msgid "%s is not in buddy list" #~ msgstr "%s отсутствует в списке собеседников" -#, fuzzy #~ msgid "Would you add?" #~ msgstr "Хотите добавить?" -#, fuzzy #~ msgid "QQ Server Notice" #~ msgstr "Уведомление сервера QQ" -#, fuzzy #~ msgid "Network disconnected" -#~ msgstr "Соединение разорвано" +#~ msgstr "Сеть отключена" #~ msgid "developer" #~ msgstr "разработчик" -- cgit v1.2.1 From 6183f3e01f96e7f8eb8c09c74a362c7eeef872c7 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 12 Mar 2012 09:44:59 +0000 Subject: Grab es.po, ru.po and sl.po from 2.x.y and commit them here. This seems like a reasonable thing to do... these versions have fewer fuzzy and untranslated strings than the previous versions. --- po/ChangeLog | 3 +- po/es.po | 1607 +++++++++++++++++------------ po/ru.po | 1029 +++++++++++-------- po/sl.po | 3224 +++++++++++++++++++++++++++++++++++++++++----------------- 4 files changed, 3877 insertions(+), 1986 deletions(-) diff --git a/po/ChangeLog b/po/ChangeLog index 10d6d31cdf..440e24150d 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,8 +1,9 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul -version 3.0.0 +version 2.10.2 * Russian translation updated (Антон Самохвалов) * Slovenian translation updated (Martin Srebotnjak) + * Spanish translation updated (Javier Fernández-Sanguino Peña) version 2.10.1 * No changes diff --git a/po/es.po b/po/es.po index 8b2cac9ea7..72ba6f286e 100644 --- a/po/es.po +++ b/po/es.po @@ -8,6 +8,7 @@ # Copyright (C) February 2010, Francisco Javier F. Serrador # Copyright (C) June 2002, April 2003, January 2004, March 2004, September 2004, # January 2005, 2006-2008, July 2009, July 2010, August 2010, January 2011 +# February 2012 # Javier Fernández-Sanguino Peña # # Agradecemos la ayuda de revisión realizada por: @@ -53,8 +54,8 @@ msgid "" msgstr "" "Project-Id-Version: Pidgin\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-18 00:02-0700\n" -"PO-Revision-Date: 2011-01-30 21:28+0100\n" +"POT-Creation-Date: 2012-03-12 02:28-0700\n" +"PO-Revision-Date: 2012-02-16 01:08+0100\n" "Last-Translator: Javier Fernández-Sanguino \n" "Language-Team: Spanish team \n" "Language: \n" @@ -118,7 +119,17 @@ msgstr "" "X-POFile-SpellExtra: count prefs default gstreamer Vídeollamada GntFg\n" "X-POFile-SpellExtra: mDNSResponder RedirectEX GroupWise MSN Hing chat\n" "X-POFile-SpellExtra: nologin PINes nick Proxy Man users AP memoserv AV ICQ\n" -"X-POFile-SpellExtra: roleando HMAC clientLogin vCard GetABacktrace\n" +"X-POFile-SpellExtra: roleando HMAC clientLogin vCard GetABacktrace DN\n" +"X-POFile-SpellExtra: indisponible verbose Tor delbuddy GUI unsafe Mari\n" +"X-POFile-SpellExtra: operserv Win sgtkrc accountSettings download zu\n" +"X-POFile-SpellExtra: chromium desinstalador Redimensionar GtkTreeView Core\n" +"X-POFile-SpellExtra: rEs rSi manualwin chrome rPuede Maithili Chrome\n" +"X-POFile-SpellExtra: Facebook persist ymsgr addbudy CLICK GPL\n" +"X-POFile-SpellExtra: authserv TOC RC Installing Punjabí Indentar apilable\n" +"X-POFile-SpellExtra: Evolution Maratí MultiMX Gtkrc kannada win debugwin\n" +"X-POFile-SpellExtra: profileedit sobreescribirá blocklist STUN Comprobador\n" +"X-POFile-SpellExtra: windows dlls IdUsuario gtkrc Name listicon Chromium\n" +"X-POFile-SpellExtra: Pidgwin browser\n" #. Translators may want to transliterate the name. #. It is not to be translated. @@ -151,16 +162,6 @@ msgstr "" " -n, --nologin no conectarse de forma automática\n" " -v, --version mostrar la versión actual y salir\n" -#, c-format -msgid "" -"%s encountered errors migrating your settings from %s to %s. Please " -"investigate and complete the migration by hand. Please report this error at " -"http://developer.pidgin.im" -msgstr "" -"%s se encontró con errores al migrar su configuración de %s a %s. Investigue " -"el problema y complete la migración de forma manual. Por favor, informe de " -"este error en http://developer.pidgin.im" - #. the user did not fill in the captcha msgid "Error" msgstr "Error" @@ -313,15 +314,16 @@ msgstr "La cuenta seleccionada no está conectada." msgid "Error adding buddy" msgstr "Error al añadir al amigo" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Username" msgstr "Nombre de usuario" msgid "Alias (optional)" msgstr "Apodo (opcional)" -#, fuzzy msgid "Invite message (optional)" -msgstr "Mensaje (opcional)" +msgstr "Mensaje de invitación (opcional)" msgid "Add in group" msgstr "Añadir a un grupo" @@ -449,7 +451,11 @@ msgstr "Cambiar marca" msgid "View Log" msgstr "Ver registro" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. General +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Nickname" msgstr "Apodo" @@ -903,7 +909,11 @@ msgid "Remaining" msgstr "Restante" #. XXX: Use of ggp_str_to_uin() is an ugly hack! +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext #. presence +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status" msgstr "Estado" @@ -1009,7 +1019,6 @@ msgstr "Llamando..." msgid "Hangup" msgstr "Colgar" -#. Number of actions msgid "Accept" msgstr "Aceptar" @@ -1492,6 +1501,8 @@ msgstr "Título" msgid "Type" msgstr "Tipo" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. Statuses are almost all the same. Define a macro to reduce code repetition. #. PurpleStatusPrimitive #. id - use default @@ -1500,6 +1511,8 @@ msgstr "Tipo" #. user_settable #. not independent #. Attributes - each status can have a message. +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Message" msgstr "Mensaje" @@ -1840,23 +1853,26 @@ msgstr "El certificado ha sido revocado." msgid "An unknown certificate error occurred." msgstr "Ocurrió un error desconocido de gestión de certificados." +#, fuzzy +msgid "(MATCH)" +msgstr "AÑADIR" + msgid "(DOES NOT MATCH)" msgstr "(NO COINCIDE)" -#. Make messages #, c-format msgid "%s has presented the following certificate for just-this-once use:" msgstr "" "%s ha presentado el certificado mostrado a continuación para este uso de una " "sola vez:" -#, c-format -msgid "" -"Common name: %s %s\n" -"Fingerprint (SHA1): %s" +#, fuzzy, c-format +msgid "Common name: %s %s" msgstr "" -"Nombre común: %s %s\n" -"Huella (SHA1): %s" +"Nombre común: %s\n" +"\n" +"Huella SHA1:\n" +"%s" #. TODO: Find what the handle ought to be msgid "Single-use Certificate Verification" @@ -1872,7 +1888,6 @@ msgstr "Autoridades de Certificación" msgid "SSL Peers Cache" msgstr "Caché de servidores SSL" -#. Make messages #, c-format msgid "Accept certificate for %s?" msgstr "¿Desea aceptar el certificado para %s?" @@ -1881,9 +1896,6 @@ msgstr "¿Desea aceptar el certificado para %s?" msgid "SSL Certificate Verification" msgstr "Verificación de certificado SSL" -msgid "_View Certificate..." -msgstr "_Ver certificado..." - #, c-format msgid "The certificate for %s could not be validated." msgstr "El certificado por %s no pudo ser validado." @@ -1903,27 +1915,6 @@ msgstr "" "El certificado expresa ser en vez de «%s». Esto podría significar que usted " "no está conectado con el servicio que realmente quiere." -#. Make messages -#, c-format -msgid "" -"Common name: %s\n" -"\n" -"Fingerprint (SHA1): %s\n" -"\n" -"Activation date: %s\n" -"Expiration date: %s\n" -msgstr "" -"Nombre común: %s\n" -"\n" -"Huella (SHA1): %s\n" -"\n" -"Fecha de activación: %s\n" -"Fecha de expiración: %s\n" - -#. TODO: Find what the handle ought to be -msgid "Certificate Information" -msgstr "Información del certificado" - #. show error to user msgid "Registration Error" msgstr "Error de registro" @@ -2060,7 +2051,7 @@ msgid "Unknown reason" msgstr "Razón desconocida" msgid "Aborting DNS lookup in Tor Proxy mode." -msgstr "" +msgstr "Interrumpiendo la resolución DNS en modo proxy Tor." #, c-format msgid "" @@ -2998,6 +2989,23 @@ msgstr "Complemento sencillo" msgid "Tests to see that most things are working." msgstr "Hace pruebas para determinar si la mayor parte de las cosas funcionan." +#. Make messages +#, c-format +msgid "" +"Common name: %s\n" +"\n" +"Fingerprint (SHA1): %s\n" +"\n" +"Activation date: %s\n" +"Expiration date: %s\n" +msgstr "" +"Nombre común: %s\n" +"\n" +"Huella (SHA1): %s\n" +"\n" +"Fecha de activación: %s\n" +"Fecha de expiración: %s\n" + #. Scheme name msgid "X.509 Certificates" msgstr "Certificados X.509" @@ -3132,19 +3140,29 @@ msgstr "" "No se pudo establecer una conexión con el servidor mDNS local. ¿Está " "arrancado?" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "First name" msgstr "Nombre:" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Last name" msgstr "Apellidos:" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. email msgid "Email" msgstr "Correo-e" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "AIM Account" msgstr "Cuenta AIM" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "XMPP Account" msgstr "Cuenta XMPP" @@ -3259,6 +3277,8 @@ msgstr "Registrando cuenta nueva de Gadu-Gadu" msgid "Please, fill in the following fields" msgstr "Por favor, rellene los siguientes campos" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "City" msgstr "Ciudad" @@ -3266,6 +3286,8 @@ msgid "Year of birth" msgstr "Año de nacimiento" #. gender +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Gender" msgstr "Sexo" @@ -3288,20 +3310,27 @@ msgstr "Encontrar amigos" msgid "Please, enter your search criteria below" msgstr "Por favor, introduzca su criterio de búsqueda" -msgid "Fill in the fields." -msgstr "Rellene los campos." +msgid "Change password for the Gadu-Gadu account" +msgstr "Cambiar la contraseña de la cuenta Gadu-Gadu" -msgid "Your current password is different from the one that you specified." -msgstr "Su contraseña actual es diferente de la que ha especificado." +msgid "Password was changed successfully!" +msgstr "¡Se cambió con éxito la contraseña!" msgid "Unable to change password. Error occurred.\n" msgstr "No se pudo cambiar la contraseña. Se produjo un error.\n" -msgid "Change password for the Gadu-Gadu account" -msgstr "Cambiar la contraseña de la cuenta Gadu-Gadu" +msgid "Fill in the fields." +msgstr "Rellene los campos." -msgid "Password was changed successfully!" -msgstr "¡Se cambió con éxito la contraseña!" +msgid "New password should be at most 15 characters long." +msgstr "" +"La nueva contraseña debería tener una longitud de al menos 15 caracteres." + +msgid "Your current password is different from the one that you specified." +msgstr "Su contraseña actual es diferente de la que ha especificado." + +msgid "Invalid email address" +msgstr "Dirección de correo electrónico inválida" msgid "Current password" msgstr "Contraseña actual" @@ -3309,6 +3338,9 @@ msgstr "Contraseña actual" msgid "Password (retype)" msgstr "Contraseña (escribir de nuevo)" +msgid "Email Address" +msgstr "Dirección de correo electrónico" + msgid "Enter current token" msgstr "Introduzca el token actual" @@ -3321,23 +3353,20 @@ msgstr "Introduzca su contraseña actual y la contraseña nueva para UIN: " msgid "Change Gadu-Gadu Password" msgstr "Cambiar la contraseña Gadu-Gadu" -#, fuzzy msgid "Show status to:" -msgstr "Cambiar estado a" +msgstr "Mostrar el estado a:" msgid "All people" -msgstr "" +msgstr "Todo el mundo" -#, fuzzy msgid "Only buddies" -msgstr "Amigos conectados" +msgstr "Sólo amigos" -#, fuzzy msgid "Change status broadcasting" -msgstr "Cambiar estado a" +msgstr "Cambiar la difusión de estado" msgid "Please, select who can see your status" -msgstr "" +msgstr "Por favor, seleccione quién debería poder ver su estado" #, c-format msgid "Select a chat for buddy: %s" @@ -3366,14 +3395,20 @@ msgstr "No molestar" msgid "Away" msgstr "Ausente" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "UIN" msgstr "UIN" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. first name #. optional information msgid "First Name" msgstr "Nombre" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Birth Year" msgstr "Año de nacimiento" @@ -3413,6 +3448,31 @@ msgstr "Su lista de amigos fue almacenada en el servidor." msgid "Connected" msgstr "Conectado" +msgid "Unable to resolve hostname" +msgstr "No se pudo resolver el nombre del sistema" + +msgid "Incorrect password" +msgstr "Contraseña incorrecta" + +msgid "SSL Connection Failed" +msgstr "Falló la conexión SSL" + +msgid "" +"Your account has been disabled because too many incorrect passwords were " +"entered" +msgstr "" +"Su cuenta ha sido deshabilitada porque se han introducido demasiadas " +"contraseña inválidas" + +msgid "Service temporarily unavailable" +msgstr "Servicio no disponible temporalmente" + +msgid "Error connecting to proxy server" +msgstr "Error al conectarse al servidor proxy" + +msgid "Error connecting to master server" +msgstr "Error al conectarse al servidor maestro" + msgid "Connection failed" msgstr "Falló la conexión" @@ -3422,6 +3482,12 @@ msgstr "Añadir al chat" msgid "Chat _name:" msgstr "_Nombre de chat:" +msgid "The username specified is invalid." +msgstr "El nombre de usuario especificado no es válido." + +msgid "SSL support unavailable" +msgstr "Soporte SSL no disponible" + #, c-format msgid "Unable to resolve hostname '%s': %s" msgstr "No se pudo resolver el nombre del servidor '%s': %s" @@ -3440,12 +3506,12 @@ msgstr "Ya existe un chat con ese nombre" msgid "Not connected to the server" msgstr "No está conectado al servidor" -msgid "Find buddies..." -msgstr "Encontrar amigos..." - msgid "Change password..." msgstr "Cambiar su contraseña..." +msgid "Find buddies..." +msgstr "Encontrar amigos..." + msgid "Upload buddylist to Server" msgstr "Subir la lista de amigos al servidor" @@ -3476,25 +3542,24 @@ msgstr "Complemento de protocolo Gadu-Gadu" msgid "Polish popular IM" msgstr "Mensajería instantánea polaca muy popular" -msgid "Gadu-Gadu User" -msgstr "Usuario de Gadu-Gadu" - msgid "GG server" msgstr "Servidor GG" -msgid "Don't use encryption" -msgstr "No utilizar cifrado" - msgid "Use encryption if available" msgstr "Utilizar cifrado si es posible" -#. TODO msgid "Require encryption" msgstr "Solicitar cifrado" +msgid "Don't use encryption" +msgstr "No utilizar cifrado" + msgid "Connection security" msgstr "Seguridad de la conexión" +msgid "Show links from strangers" +msgstr "Mostrar enlaces de desconocidos" + #, c-format msgid "Unknown command: %s" msgstr "Orden desconocida: %s" @@ -3547,9 +3612,6 @@ msgstr "Contra_seña:" msgid "IRC nick and server may not contain whitespace" msgstr "Los apodos y servidores de IRC no pueden tener espacios en blanco" -msgid "SSL support unavailable" -msgstr "Soporte SSL no disponible" - msgid "Unable to connect" msgstr "No se pudo conectar" @@ -3583,7 +3645,9 @@ msgstr "Complemento de protocolo IRC" msgid "The IRC Protocol Plugin that Sucks Less" msgstr "Complemento de protocolo IRC menos malo" -#. host to connect to +#. set up account ID as user:server +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Server" msgstr "Servidor" @@ -3786,9 +3850,8 @@ msgstr "Mensajes globales de %s" msgid "action <action to perform>: Perform an action." msgstr "action <acción a realizar>: Realiza una acción." -#, fuzzy msgid "authserv: Send a command to authserv" -msgstr "chanserv: Enviar un comando al servidor" +msgstr "authserv: Enviar una orden a authserv" msgid "" "away [message]: Set an away message, or use no message to return from being " @@ -3801,7 +3864,7 @@ msgid "ctcp : sends ctcp msg to nick." msgstr "ctcp : envía un mensaje ctcp al alias." msgid "chanserv: Send a command to chanserv" -msgstr "chanserv: Enviar un comando al servidor" +msgstr "chanserv: Enviar una orden a chanserv" msgid "" "deop <nick1> [nick2] ...: Remove channel operator status from " @@ -3858,7 +3921,7 @@ msgid "me <action to perform>: Perform an action." msgstr "me <acción a realizar>: Realizar una acción." msgid "memoserv: Send a command to memoserv" -msgstr "memoserv: Enviar un comando al servidor" +msgstr "memoserv: Enviar una orden a memoserv" msgid "" "mode <+|-><A-Za-z> <nick|channel>: Set or unset a channel " @@ -3882,7 +3945,7 @@ msgid "nick <new nickname>: Change your nickname." msgstr "nick <nuevo apodo>: Cambia su apodo." msgid "nickserv: Send a command to nickserv" -msgstr "nickserv: Enviar un comando al servidor." +msgstr "nickserv: Enviar una orden a nickserv" msgid "notice <target<: Send a notice to a user or channel." msgstr "notice <objetivo>: enviar un aviso a un usuario o a un canal." @@ -3902,7 +3965,7 @@ msgstr "" "utilizarlo." msgid "operserv: Send a command to operserv" -msgstr "openserv: Enviar un comando al servidor" +msgstr "openserv: Enviar una orden a operserv" msgid "" "part [room] [message]: Leave the current channel, or a specified channel, " @@ -3931,7 +3994,7 @@ msgstr "" "(opcional)." msgid "quote [...]: Send a raw command to the server." -msgstr "quote [...]: Enviar un comando en crudo al servidor." +msgstr "quote [...]: Enviar una orden en crudo al servidor." msgid "" "remove <nick> [message]: Remove someone from a room. You must be a " @@ -4118,6 +4181,8 @@ msgstr "No se pudo establecer una conexión con el servidor: %s" msgid "Unable to establish SSL connection" msgstr "No se pudo establecer una conexión SSL" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Full Name" msgstr "Nombre completo" @@ -4189,9 +4254,13 @@ msgstr "" "Todos los campos siguientes son opcionales. Introduzca sólo la información " "con la que se sienta cómodo." +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Client" msgstr "Cliente" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Operating System" msgstr "Sistema operativo" @@ -4201,6 +4270,8 @@ msgstr "Hora local:" msgid "Priority" msgstr "Prioridad" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Resource" msgstr "Recurso" @@ -4296,9 +4367,6 @@ msgstr "" "Rellene uno o más de los campos mostrados a continuación para buscar a un " "usuario XMPP cuyos datos coincidan." -msgid "Email Address" -msgstr "Dirección de correo electrónico" - msgid "Search for XMPP users" msgstr "Buscar un usuario XMPP" @@ -4506,6 +4574,8 @@ msgstr "El servidor no soporta bloqueos" msgid "Not Authorized" msgstr "No autorizado" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Mood" msgstr "Estado de ánimo" @@ -4874,10 +4944,8 @@ msgstr "" msgid "invite <user> [message]: Invite a user to the room." msgstr "invite <usuario> [mensaje]: Invitar a un usuario a la sala." -#, fuzzy msgid "join: <room[@server]> [password]: Join a chat." -msgstr "" -"join: <sala> [contraseña]: Unirse a una sala en el servidor indicado." +msgstr "join: <sala[@servidor]> [contraseña]: Unirse a una sala." msgid "kick <user> [reason]: Kick a user from the room." msgstr "kick <usuario> [razón]: Echar a un usuario de la sala." @@ -5350,9 +5418,6 @@ msgstr "No se pudo interpretar el mensaje" msgid "Syntax Error (probably a client bug)" msgstr "Error de sintaxis (probablemente un error del cliente)" -msgid "Invalid email address" -msgstr "Dirección de correo electrónico inválida" - msgid "User does not exist" msgstr "El usuario no existe" @@ -5419,9 +5484,6 @@ msgstr "Demasiados resultados de un FND" msgid "Not logged in" msgstr "No ha iniciado sesión" -msgid "Service temporarily unavailable" -msgstr "Servicio no disponible temporalmente" - msgid "Database server error" msgstr "Error del servidor de base de datos" @@ -5773,6 +5835,8 @@ msgstr "Edad" msgid "Occupation" msgstr "Ocupación" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Location" msgstr "Ubicación" @@ -5974,9 +6038,9 @@ msgstr "No puede eliminar el usuario" msgid "Mobile message was not sent because it was too long." msgstr "No se pudo enviar el mensaje al móvil porque es demasiado largo." -#, fuzzy msgid "Mobile message was not sent because an unknown error occurred." -msgstr "No se pudo enviar el mensaje porque se produjo un error desconocido." +msgstr "" +"No se pudo enviar el mensaje móvil porque se produjo un error desconocido." #, c-format msgid "" @@ -6027,6 +6091,30 @@ msgstr "" msgid "Message was not sent because an unknown error occurred." msgstr "No se pudo enviar el mensaje porque se produjo un error desconocido." +#, c-format +msgid "" +"%s (There was an error receiving this message. Converting the encoding from " +"%s to UTF-8 failed.)" +msgstr "" +"%s (Se produjo un error al recibir este mensaje. Falló la conversión de la " +"codificación de %s a UTF-8.)" + +#, c-format +msgid "" +"%s (There was an error receiving this message. The charset was %s, but it " +"was not valid UTF-8.)" +msgstr "" +"%s (Se produjo un error al recibir este mensaje. El código de caracteres era " +"%s, pero no es un conjunto UTF-8 válido.)" + +#, c-format +msgid "" +"%s (There was an error receiving this message. The charset was missing, but " +"it was not valid UTF-8.)" +msgstr "" +"%s (Se produjo un error al recibir este mensaje. Se omitió el código de " +"caracteres, pero no es un conjunto UTF-8 válido.)" + msgid "Writing error" msgstr "Error de escritura" @@ -6145,9 +6233,6 @@ msgstr "¿Desea borrar al amigo de su agenda?" msgid "Do you want to delete this buddy from your address book as well?" msgstr "¿Desea también borrar este amigo de su agenda?" -msgid "The username specified is invalid." -msgstr "El nombre de usuario especificado no es válido." - msgid "The Display Name you entered is invalid." msgstr "El nombre que introdujo es inválido." @@ -6163,6 +6248,8 @@ msgstr "Error de actualización de perfil" #. no profile information yet, so we cannot update #. (reference: "libpurple/request.h") +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Profile" msgstr "Perfil" @@ -6176,13 +6263,12 @@ msgid "Display Name" msgstr "Mostrar nombre" #. about me -#, fuzzy msgid "About Me" msgstr "Sobre mí" #. where I live msgid "Where I Live" -msgstr "" +msgstr "Dónde vivo" #. mobile number msgid "Mobile Number" @@ -6190,15 +6276,14 @@ msgstr "Número de teléfono móvil" #. is searchable msgid "Can be searched" -msgstr "" +msgstr "Puede buscarse" #. is suggestable msgid "Can be suggested" -msgstr "" +msgstr "Puede sugerirse" -#, fuzzy msgid "Update your MXit Profile" -msgstr "Actualizar su perfil" +msgstr "Actualizar su perfil MXit" msgid "The PIN you entered is invalid." msgstr "La clave PIN introducida es inválida." @@ -6213,9 +6298,8 @@ msgid "The two PINs you entered do not match." msgstr "Las dos PINes que introdujo no coinciden." #. show error to user -#, fuzzy msgid "PIN Update Error" -msgstr "Error de actualización de perfil" +msgstr "Error de actualización de PIN" #. pin #. pin (required) @@ -6227,13 +6311,11 @@ msgid "Verify PIN" msgstr "Verifique el PIN" #. (reference: "libpurple/request.h") -#, fuzzy msgid "Change PIN" -msgstr "Cambiar icono" +msgstr "Cambiar PIN" -#, fuzzy msgid "Change MXit PIN" -msgstr "Cambiar icono" +msgstr "Cambiar PIN MXit" msgid "View Splash" msgstr "Mostrar pantalla de bienvenida" @@ -6244,17 +6326,14 @@ msgstr "No hay ninguna pantalla de bienvenida disponible" msgid "About" msgstr "Sobre" -#, fuzzy msgid "Search for user" -msgstr "Buscar un usuario" +msgstr "Buscar por usuario" -#, fuzzy msgid "Search for a MXit contact" -msgstr "Buscar un usuario" +msgstr "Buscar por contacto MXit" -#, fuzzy msgid "Type search information" -msgstr "Información de usuario" +msgstr "Introduzca la información de búsqueda" msgid "_Search" msgstr "_Buscar" @@ -6264,19 +6343,16 @@ msgid "Change Profile..." msgstr "Cambiar perfil..." #. change PIN -#, fuzzy msgid "Change PIN..." -msgstr "Cambiar su estado de ánimo..." +msgstr "Cambiar PIN..." #. suggested friends -#, fuzzy msgid "Suggested friends..." -msgstr "Establecer su nombre de amigo..." +msgstr "Amigos sugeridos..." #. search for contacts -#, fuzzy msgid "Search for contacts..." -msgstr "Buscar usuarios..." +msgstr "Buscar por contactos..." #. display splash-screen msgid "View Splash..." @@ -6286,6 +6362,8 @@ msgstr "Ver pantalla..." msgid "About..." msgstr "Sobre..." +#. we are trying to send a file to MXit +#. need to reserve some space for packet headers #. the file is too big msgid "The file you are trying to send is too large!" msgstr "¡El fichero que intenta enviar es demasiado grande!" @@ -6308,9 +6386,8 @@ msgstr "" msgid "Connecting..." msgstr "Conectando..." -#, fuzzy msgid "The Display Name you entered is too short." -msgstr "El nombre que introdujo es inválido." +msgstr "El nombre que introdujo es demasiado corto." msgid "The PIN you entered has an invalid length [7-10]." msgstr "El PIN que ha introducido no tiene una longitud válida [7-10]." @@ -6403,31 +6480,26 @@ msgstr "Ha sido invitado" msgid "Loading menu..." msgstr "Cargando el menú..." +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status Message" msgstr "Mensaje de estado" msgid "Rejection Message" msgstr "Mensajes de rechazo" -#. hidden number -msgid "Hidden Number" -msgstr "Número oculto" - -#, fuzzy msgid "No profile available" -msgstr "No disponible" +msgstr "No hay un perfil disponible" -#, fuzzy msgid "This contact does not have a profile." -msgstr "Esta cuenta no tiene correo activado." +msgstr "Esta cuenta no tiene un perfil." msgid "Your MXit ID..." msgstr "Su MXit ID..." #. contact is in Deleted, Rejected or None state -#, fuzzy msgid "Re-Invite" -msgstr "Invitar" +msgstr "Re-invitar" #. Configuration options #. WAP server (reference: "libpurple/accountopt.h") @@ -6443,37 +6515,33 @@ msgstr "Activar la pantalla de bienvenida" msgid "Last Online" msgstr "Última conexión" -#, fuzzy msgid "Invite Message" -msgstr "Mensajes enviados" +msgstr "Mensajes de invitación" -#, fuzzy msgid "No results" -msgstr "Resultados de la búsqueda" +msgstr "No hay resultados" -#, fuzzy msgid "No contacts found." -msgstr "No se encontraron usuarios" +msgstr "No se encontraron contactos." #. define columns -#, fuzzy msgid "UserId" -msgstr "Usuario" +msgstr "IdUsuario" msgid "Where I live" -msgstr "" +msgstr "Donde yo vivo" #, c-format msgid "You have %i suggested friend." msgid_plural "You have %i suggested friends." -msgstr[0] "" -msgstr[1] "" +msgstr[0] "Tienes %i amigo sugerido." +msgstr[1] "Tienes %i amigos sugeridos." #, c-format msgid "We found %i contact that matches your search." msgid_plural "We found %i contacts that match your search." -msgstr[0] "" -msgstr[1] "" +msgstr[0] "Hemos encontrado %i contacto que se ajusta a tu búsqueda." +msgstr[1] "Hemos encontrado %i contactos que se ajustan a tu búsqueda." #. we must have lost the connection, so terminate it so that we can reconnect msgid "We have lost the connection to MXit. Please reconnect." @@ -6502,6 +6570,10 @@ msgstr "" msgid "Message Error" msgstr "Error de mensaje" +#. could not be decrypted +msgid "An encrypted message was received which could not be decrypted." +msgstr "Se recibió un mensaje cifrado que no pudo descifrarse." + msgid "Cannot perform redirect using the specified protocol" msgstr "No se puede hacer la redirección con el protocolo especificado." @@ -6763,18 +6835,26 @@ msgstr "Resolución de pantalla (puntos por pulgada)" msgid "Base font size (points)" msgstr "Tamaño de tipografía base (puntos)" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User" msgstr "Usuario" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Headline" msgstr "Titular" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Song" msgstr "Canción" msgid "Total Friends" msgstr "Amigos en total" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Client Version" msgstr "Versión del cliente" @@ -6976,9 +7056,6 @@ msgstr "No soportado" msgid "Password has expired" msgstr "La contraseña ha expirado" -msgid "Incorrect password" -msgstr "Contraseña incorrecta" - msgid "Account has been disabled" msgstr "La cuenta ha sido deshabilitada" @@ -7003,13 +7080,6 @@ msgstr "El archivo maestro no está bien configurado" msgid "Could not recognize the host of the username you entered" msgstr "No se reconoció el servidor del nombre de usuario que introdujo" -msgid "" -"Your account has been disabled because too many incorrect passwords were " -"entered" -msgstr "" -"Su cuenta ha sido deshabilitada porque se han introducido demasiadas " -"contraseña inválidas" - msgid "You cannot add the same person twice to a conversation" msgstr "No puede añadir la misma persona dos veces a una conversación" @@ -7133,12 +7203,9 @@ msgstr "Buzón de correo" msgid "User ID" msgstr "ID de usuario" -#. tag = _("DN"); -#. value = nm_user_record_get_dn(user_record); -#. if (value) { -#. purple_notify_user_info_add_pair(user_info, tag, value); -#. } -#. +msgid "DN" +msgstr "DN" + msgid "Full name" msgstr "Nombre completo" @@ -7919,9 +7986,6 @@ msgstr "" "perdido la lista de amigos, seguramente volverá a estar disponible en unos " "minutos." -msgid "Orphans" -msgstr "Huérfanos" - #, c-format msgid "" "Unable to add the buddy %s because you have too many buddies in your buddy " @@ -8225,6 +8289,7 @@ msgstr "Información de usuario de no disponible: %s" msgid "Mobile Phone" msgstr "Teléfono móvil" +#. TODO: Is it correct to pass info->email here...? msgid "Personal Web Page" msgstr "Página web personal" @@ -8245,6 +8310,7 @@ msgstr "Sección" msgid "Position" msgstr "Cargo" +#. TODO: Is it correct to pass info->email here...? msgid "Web Page" msgstr "Página web" @@ -8512,33 +8578,16 @@ msgstr "Enviar anuncio de prueba" msgid "Topic:" msgstr "Tema:" -msgid "No Sametime Community Server specified" -msgstr "No se ha especificado el servidor de comunidad «Sametime»" - -#, c-format -msgid "" -"No host or IP address has been configured for the Meanwhile account %s. " -"Please enter one below to continue logging in." -msgstr "" -"No se ha configurado ninguna dirección IP o nombre de equipo para la cuenta " -"«Meanwhile» %s. Introduzca uno más abajo para continuar el registro." - -msgid "Meanwhile Connection Setup" -msgstr "Configuración de la conexión «Meanwhile»" +msgid "A server is required to connect this account" +msgstr "Se necesita un servidor para conectarse a esta cuenta" -msgid "No Sametime Community Server Specified" -msgstr "No se ha especificado un servidor de comunidad «Sametime»" - -msgid "Connect" -msgstr "Conectar" +msgid "Last Known Client" +msgstr "Último cliente conocido:" #, c-format msgid "Unknown (0x%04x)
    " msgstr "(0x%04x) desconocido
    " -msgid "Last Known Client" -msgstr "Último cliente conocido:" - msgid "User Name" msgstr "Nombre de usuario" @@ -8859,21 +8908,33 @@ msgstr "Hiper-activo" msgid "Robot" msgstr "Robot" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User Modes" msgstr "Modos de usuario" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Contact" msgstr "Contacto preferido" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Language" msgstr "Idioma preferido" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Device" msgstr "Dispositivo" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Timezone" msgstr "Zona horaria" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Geolocation" msgstr "Localización" @@ -9734,94 +9795,29 @@ msgstr "" msgid "Whiteboard" msgstr "Pizarra" -msgid "No server statistics available" -msgstr "No se disponen de estadísticas del servidor" +msgid "Unknown server response" +msgstr "Respuesta desconocida del servidor" -msgid "Error during connecting to SILC Server" -msgstr "Se produjo un error durante la conexión al servidor SILC" +msgid "Unable to create listen socket" +msgstr "No se pudo crear el puerto para escuchar peticiones" -#, c-format -msgid "Failure: Version mismatch, upgrade your client" +msgid "SIP usernames may not contain whitespaces or @ symbols" msgstr "" -"Fallo: Existe una diferencia en las versiones, por favor, actualice su " -"cliente" - -#, c-format -msgid "Failure: Remote does not trust/support your public key" -msgstr "Fallo: El servidor remoto no soporta/confía en su clave pública" +"Los nombres de usuario SIP no pueden tener espacios en blanco ni el símbolo @" -#, c-format -msgid "Failure: Remote does not support proposed KE group" -msgstr "Fallo: El servidor remoto no soporta el grupo de IC propuesto" +msgid "SIP connect server not specified" +msgstr "No se ha especifico un servidor SIP al que conectarse" -#, c-format -msgid "Failure: Remote does not support proposed cipher" -msgstr "" -"Fallo: El servidor remoto no soporta los sistemas de cifrado propuestos" - -#, c-format -msgid "Failure: Remote does not support proposed PKCS" -msgstr "Fallo: El servidor remoto no soporta los PKCS propuestos" - -#, c-format -msgid "Failure: Remote does not support proposed hash function" -msgstr "Fallo: El servidor remoto no soporta la función de hash propuesta" - -#, c-format -msgid "Failure: Remote does not support proposed HMAC" -msgstr "Fallo: El servidor remoto no soporta el HMAC propuesto" - -#, c-format -msgid "Failure: Incorrect signature" -msgstr "Fallo: Firma incorrecta" - -#, c-format -msgid "Failure: Invalid cookie" -msgstr "Fallo: Cookie inválida" - -#, c-format -msgid "Failure: Authentication failed" -msgstr "Fallo: Falló la autenticación" - -msgid "Unable to initialize SILC Client connection" -msgstr "No se pudo inicializar la conexión del cliente SILC" - -msgid "John Noname" -msgstr "Pepe sin nombre" - -#, c-format -msgid "Unable to load SILC key pair: %s" -msgstr "No se pudo cargar el par de claves SILC: %s" - -msgid "Unable to create connection" -msgstr "No se pudo crear la conexión" - -msgid "Unknown server response" -msgstr "Respuesta desconocida del servidor" - -msgid "Unable to create listen socket" -msgstr "No se pudo crear el puerto para escuchar peticiones" - -msgid "Unable to resolve hostname" -msgstr "No se pudo resolver el nombre del sistema" - -msgid "SIP usernames may not contain whitespaces or @ symbols" -msgstr "" -"Los nombres de usuario SIP no pueden tener espacios en blanco ni el símbolo @" - -msgid "SIP connect server not specified" -msgstr "No se ha especifico un servidor SIP al que conectarse" - -#. *< type -#. *< ui_requirement -#. *< flags -#. *< dependencies -#. *< priority -#. *< id -#. *< name -#. *< version -msgid "SIP/SIMPLE Protocol Plugin" -msgstr "Complemento de protocolo SIP/SIMPLE" +#. *< type +#. *< ui_requirement +#. *< flags +#. *< dependencies +#. *< priority +#. *< id +#. *< name +#. *< version +msgid "SIP/SIMPLE Protocol Plugin" +msgstr "Complemento de protocolo SIP/SIMPLE" #. * summary msgid "The SIP/SIMPLE Protocol Plugin" @@ -10284,6 +10280,8 @@ msgstr "No se pudo enviar al chat %s,%s,%s" msgid "Hidden or not logged-in" msgstr "Oculto o no conectado" +#. TODO: Need to escape locs.host and locs.time? +#. TODO: Need to escape the two strings that make up tmp? #, c-format msgid "
    At %s since %s" msgstr "
    En %s desde %s" @@ -10486,9 +10484,6 @@ msgstr "Imagen almacenada" msgid "Stored Image. (that'll have to do for now)" msgstr "Imagen almacenada (esto tendrá que ser suficiente por ahora)" -msgid "SSL Connection Failed" -msgstr "Falló la conexión SSL" - msgid "SSL Handshake Failed" msgstr "Se produjo un fallo en la negociación SSL" @@ -10721,7 +10716,7 @@ msgid "SOCKS 5" msgstr "SOCKS 5" msgid "Tor/Privacy (SOCKS5)" -msgstr "" +msgstr "Tor/Privacidad (SOCKS5)" msgid "HTTP" msgstr "HTTP" @@ -10753,13 +10748,11 @@ msgstr "_Puerto:" msgid "Pa_ssword:" msgstr "_Contraseña:" -#, fuzzy msgid "Use _silence suppression" -msgstr "Reanudando la sesión" +msgstr "Utilizar supresión de _silencio" -#, fuzzy msgid "_Voice and Video" -msgstr "voz y vídeo" +msgstr "_Voz y vídeo" msgid "Unable to save new account" msgstr "No se pudo guardar la nueva cuenta" @@ -10807,19 +10800,20 @@ msgstr "" "Puede volver a esta ventana para añadir, editar o eliminar cuentas desde la " "ventana de lista de amigos seleccionando Cuentas->Gestionar Cuentas" -#, fuzzy, c-format +#, c-format msgid "" "%s%s%s%s wants to add you (%s) to his or her buddy " "list%s%s" -msgstr "%s%s%s%s quiere añadirle (%s) a su lista de amigos%s%s." +msgstr "" +"%s%s%s%s quiere añadirle (%s) a su lista de amigos%s" +"%s." #, c-format msgid "%s%s%s%s wants to add you (%s) to his or her buddy list%s%s" msgstr "%s%s%s%s quiere añadirle (%s) a su lista de amigos%s%s." -#, fuzzy msgid "Send Instant Message" -msgstr "Mensaje instantáneo nuevo" +msgstr "Mandar mensaje instantáneo" #. Buddy List msgid "Background Color" @@ -11051,9 +11045,6 @@ msgstr "_Contraer" msgid "_Expand" msgstr "_Expandir" -msgid "/Tools/Mute Sounds" -msgstr "/Herramientas/Sin sonido" - msgid "" "You are not currently signed on with an account that can add that buddy." msgstr "No está conectado con ninguna cuenta que pueda añadir a ese amigo." @@ -11076,123 +11067,153 @@ msgstr "Editar estados de ánimo del usuario" #. NOTE: Do not set any accelerator to Control+O. It is mapped by #. gtk_blist_key_press_cb to "Get User Info" on the selected buddy. #. Buddies menu -msgid "/_Buddies" +#, fuzzy +msgid "_Buddies" msgstr "/A_migos" -msgid "/Buddies/New Instant _Message..." -msgstr "/Amigos/Mensaje _instantáneo nuevo..." - -msgid "/Buddies/Join a _Chat..." -msgstr "/Amigos/Unirse a un _chat..." - -msgid "/Buddies/Get User _Info..." -msgstr "/Amigos/Obtener _información del usuario..." - -msgid "/Buddies/View User _Log..." -msgstr "/Amigos/Ver _registro del usuario..." - -msgid "/Buddies/Sh_ow" -msgstr "/Amigos/M_ostrar" - -msgid "/Buddies/Show/_Offline Buddies" -msgstr "/Amigos/Mostrar/Amigos desc_onectados" - -msgid "/Buddies/Show/_Empty Groups" -msgstr "/Amigos/Mostrar/Grupos _vacíos" +#, fuzzy +msgid "New Instant _Message..." +msgstr "Mensaje instantáneo nuevo" -msgid "/Buddies/Show/Buddy _Details" -msgstr "/Amigos/Mostrar/_Detalles de amigo" +#, fuzzy +msgid "Join a _Chat..." +msgstr "Unirse a un chat..." -msgid "/Buddies/Show/Idle _Times" -msgstr "/Amigos/Mostrar/_Tiempo de inactividad" +#, fuzzy +msgid "Get User _Info..." +msgstr "Establecer su información de usuario..." -msgid "/Buddies/Show/_Protocol Icons" -msgstr "/Amigos/Mostrar/Iconos de _protocolo" +#, fuzzy +msgid "View User _Log..." +msgstr "Ver registro de usuario" -msgid "/Buddies/_Sort Buddies" -msgstr "/Amigos/_Ordenar amigos" +msgid "Sh_ow" +msgstr "" -msgid "/Buddies/_Add Buddy..." -msgstr "/Amigos/_Añadir un amigo..." +#, fuzzy +msgid "_Sort Buddies" +msgstr "Amigos en total" -msgid "/Buddies/Add C_hat..." -msgstr "/Amigos/Añadir un _chat..." +#, fuzzy +msgid "_Add Buddy..." +msgstr "Añadir _amigo..." -msgid "/Buddies/Add _Group..." -msgstr "/Amigos/Añadir _grupo..." +#, fuzzy +msgid "Add _Group..." +msgstr "Añadir grupo" -msgid "/Buddies/_Quit" -msgstr "/Amigos/_Salir" +msgid "_Quit" +msgstr "_Salir" #. Accounts menu -msgid "/_Accounts" -msgstr "/_Cuentas" +msgid "_Accounts" +msgstr "Cuent_as" -msgid "/Accounts/Manage Accounts" -msgstr "/Cuentas/Gestionar cuentas" +#, fuzzy +msgid "Manage Accounts" +msgstr "Habilitar cuenta" #. Tools -msgid "/_Tools" +#, fuzzy +msgid "_Tools" msgstr "/_Herramientas" -msgid "/Tools/Buddy _Pounces" -msgstr "/Herramientas/_Aviso de amigo" - -msgid "/Tools/_Certificates" -msgstr "/Herramientas/_Certificados" +#, fuzzy +msgid "Buddy _Pounces" +msgstr "Avisos de amigos" -msgid "/Tools/Custom Smile_ys" -msgstr "/Herramientas/Emot_iconos personalizados" +#, fuzzy +msgid "_Certificates" +msgstr "Certificados" -msgid "/Tools/Plu_gins" -msgstr "/Herramientas/Com_plementos" +# No estoy muy seguro de usar emoticono, quizás «smiley» sería más apropiado +#, fuzzy +msgid "Custom Smile_ys" +msgstr "Emoticono a medida" -msgid "/Tools/Pr_eferences" -msgstr "/Herramientas/_Preferencias" +msgid "Plu_gins" +msgstr "Co_mplementos" -msgid "/Tools/Pr_ivacy" -msgstr "/Herramientas/Pri_vacidad" +msgid "Pr_eferences" +msgstr "Pr_eferencias" -msgid "/Tools/Set _Mood" -msgstr "/Herramientas/Fijar estado de á_nimo" +#, fuzzy +msgid "Pr_ivacy" +msgstr "Privacidad" -msgid "/Tools/_File Transfers" -msgstr "/Herramientas/_Transferencias de archivos" +#, fuzzy +msgid "Set _Mood" +msgstr "Fijar estado de áni_mo..." -msgid "/Tools/R_oom List" -msgstr "/Herramientas/_Lista de salas" +#, fuzzy +msgid "_File Transfers" +msgstr "Transferencia de archivos" -msgid "/Tools/System _Log" -msgstr "/Herramientas/_Registro del sistema" +#, fuzzy +msgid "R_oom List" +msgstr "Lista de salas" -msgid "/Tools/Mute _Sounds" -msgstr "/Herramientas/_Sin sonido" +#, fuzzy +msgid "System _Log" +msgstr "Registro del Sistema" #. Help -msgid "/_Help" +#, fuzzy +msgid "_Help" msgstr "/_Ayuda" -msgid "/Help/Online _Help" +#, fuzzy +msgid "Online _Help" msgstr "/Ayuda/Ayuda en _línea" -msgid "/Help/_Build Information" -msgstr "/Ayuda/Información de _compilación" +#, fuzzy +msgid "_Build Information" +msgstr "Información de compilación" + +#, fuzzy +msgid "_Debug Window" +msgstr "Ventana de depuración" + +#, fuzzy +msgid "De_veloper Information" +msgstr "Información de desarrollo de %s" + +#, fuzzy +msgid "_Plugin Information" +msgstr "Información del complemento" + +#, fuzzy +msgid "_Translator Information" +msgstr "Información de traducción de %s" + +#, fuzzy +msgid "_About" +msgstr "Sobre" -msgid "/Help/_Debug Window" -msgstr "/Ayuda/Ventana de _depuración" +#. Buddies->Show menu +#, fuzzy +msgid "_Offline Buddies" +msgstr "Amigos desconectados" -msgid "/Help/De_veloper Information" -msgstr "/Ayuda/Información de desa_rrollador" +#, fuzzy +msgid "_Empty Groups" +msgstr "Grupos vacíos" + +#, fuzzy +msgid "Buddy _Details" +msgstr "/Amigos/Mostrar/_Detalles de amigo" #, fuzzy -msgid "/Help/_Plugin Information" -msgstr "/Ayuda/Información de _compilación" +msgid "Idle _Times" +msgstr "Mostrar tiempos de inactividad" -msgid "/Help/_Translator Information" -msgstr "/Ayuda/Información de _traducción" +#, fuzzy +msgid "_Protocol Icons" +msgstr "Protocolo" -msgid "/Help/_About" -msgstr "/Ayuda/_Acerca de" +#. Tools menu +msgid "Mute _Sounds" +msgstr "Sin s_onidos" #, c-format msgid "Account: %s" @@ -11250,30 +11271,6 @@ msgstr "Inactivo %dh %02dm" msgid "Idle %dm" msgstr "Inactivo %dm" -msgid "/Buddies/New Instant Message..." -msgstr "/Amigos/Nuevo mensaje instantáneo..." - -msgid "/Buddies/Join a Chat..." -msgstr "/Amigos/Unirse a un chat..." - -msgid "/Buddies/Get User Info..." -msgstr "/Amigos/Obtener información del usuario..." - -msgid "/Buddies/Add Buddy..." -msgstr "/Amigos/Añadir un amigo..." - -msgid "/Buddies/Add Chat..." -msgstr "/Amigos/Añadir un chat..." - -msgid "/Buddies/Add Group..." -msgstr "/Amigos/Añadir un grupo..." - -msgid "/Tools/Privacy" -msgstr "/Herramientas/Privacidad" - -msgid "/Tools/Room List" -msgstr "/Herramientas/Lista de salas" - #, c-format msgid "%d unread message from %s\n" msgid_plural "%d unread messages from %s\n" @@ -11327,9 +11324,6 @@ msgstr "Contraseña:" msgid "_Login" msgstr "_Entrada" -msgid "/Accounts" -msgstr "/Cuentas" - #. Translators: Please maintain the use of -> and <- to refer to menu heirarchy #, c-format msgid "" @@ -11346,24 +11340,6 @@ msgstr "" "conectarse, fijar su estado y hablar con sus amigos una vez active sus " "cuentas." -#. set the Show Offline Buddies option. must be done -#. * after the treeview or faceprint gets mad. -Robot101 -#. -msgid "/Buddies/Show/Offline Buddies" -msgstr "/Amigos/Mostrar/Amigos desconectados" - -msgid "/Buddies/Show/Empty Groups" -msgstr "/Amigos/Mostrar/Grupos vacíos" - -msgid "/Buddies/Show/Buddy Details" -msgstr "/Amigos/Mostrar/Detalles de amigo" - -msgid "/Buddies/Show/Idle Times" -msgstr "/Amigos/Mostrar/Tiempos de inactividad" - -msgid "/Buddies/Show/Protocol Icons" -msgstr "/Amigos/Mostrar/Iconos de protocolo" - msgid "Add a buddy.\n" msgstr "Añadir un amigo.\n" @@ -11373,9 +11349,8 @@ msgstr "Nombre de _usuario del amigo:" msgid "(Optional) A_lias:" msgstr "(Opcional) A_podo:" -#, fuzzy msgid "(Optional) _Invite message:" -msgstr "(Opcional) A_podo:" +msgstr "(Opcional) Mensaje de _invitación:" msgid "Add buddy to _group:" msgstr "Añadir el amigo a un _grupo:" @@ -11415,12 +11390,6 @@ msgstr "Introduzca el nombre del grupo a añadir." msgid "Enable Account" msgstr "Habilitar cuenta" -msgid "/Accounts/Enable Account" -msgstr "/Cuentas/Activar cuenta" - -msgid "/Accounts/" -msgstr "/Cuentas/" - msgid "_Edit Account" msgstr "_Editar cuenta" @@ -11433,19 +11402,43 @@ msgstr "No hay acciones disponibles" msgid "_Disable" msgstr "_Deshabilitar" -msgid "/Tools" -msgstr "/Herramientas" - -msgid "/Buddies/Sort Buddies" -msgstr "/Amigos/Ordenar amigos" - msgid "Type the host name for this certificate." msgstr "Especifique el nombre de sistema para este certificado." +#. Fire the notification +#, c-format +msgid "Certificate Information for %s" +msgstr "Información de certificado para %s" + #. Widget creation function msgid "SSL Servers" msgstr "Servidores SSL" +msgid "Unsafe debugging is now disabled." +msgstr "Se ha deshabilitado la depuración insegura." + +msgid "Unsafe debugging is now enabled." +msgstr "Se ha habilitado la depuración insegura." + +msgid "Verbose debugging is now disabled." +msgstr "Se ha deshabilitado la depuración detallada." + +msgid "Verbose debugging is now enabled." +msgstr "Se ha habilitado la depuración detallada." + +msgid "Supported debug options are: plugins version unsafe verbose" +msgstr "" +"Las opciones de depuración soportadas son: «plugins» «version» «unsafe» " +"«verbose»" + +#, fuzzy +msgid "" +"Use \"/help <command>\" for help on a specific command.
    The " +"following commands are available in this context:
    " +msgstr "" +"Utilice \"/help <orden>\" para obtener ayuda de una orden concreta.\n" +"Las siguientes órdenes están disponibles en este contexto:\n" + msgid "Unknown command." msgstr "Orden desconocida." @@ -11479,9 +11472,6 @@ msgstr "No ignorar" msgid "Ignore" msgstr "Ignorar" -msgid "Get Away Message" -msgstr "Mensaje de ausencia" - msgid "Last Said" msgstr "Dicho la última vez" @@ -11510,170 +11500,99 @@ msgid "Show All" msgstr "Mostrar todo" #. Conversation menu -msgid "/_Conversation" +#, fuzzy +msgid "_Conversation" msgstr "/_Conversación" -msgid "/Conversation/New Instant _Message..." -msgstr "/Conversación/Mensaje _instantáneo nuevo..." - -msgid "/Conversation/Join a _Chat..." -msgstr "/Conversación/Unirse a _Chat..." - -msgid "/Conversation/_Find..." -msgstr "/Conversación/_Buscar..." - -msgid "/Conversation/View _Log" -msgstr "/Conversación/Ver _historial" - -msgid "/Conversation/_Save As..." -msgstr "/Conversación/_Guardar como..." - -msgid "/Conversation/Clea_r Scrollback" -msgstr "/Conversación/Limpia_r deslizable" - -msgid "/Conversation/M_edia" -msgstr "/Conversación/_Medio" +#, fuzzy +msgid "_Find..." +msgstr "Buscar" -msgid "/Conversation/Media/_Audio Call" -msgstr "/Conversación/Medio/_Audiollamada" +#, fuzzy +msgid "_Save As..." +msgstr "Guardar icono como..." -msgid "/Conversation/Media/_Video Call" -msgstr "/Conversación/Medio/_Vídeollamada" +#, fuzzy +msgid "Clea_r Scrollback" +msgstr "Limpiar histórico" -msgid "/Conversation/Media/Audio\\/Video _Call" -msgstr "/Conversación/Medio/_Llamada audio\\/vídeo" +#, fuzzy +msgid "M_edia" +msgstr "_Media" -msgid "/Conversation/Se_nd File..." -msgstr "/Conversación/E_nviar archivo..." +#, fuzzy +msgid "Audio/Video _Call" +msgstr "Audio/_Vídeollamada" -msgid "/Conversation/Get _Attention" -msgstr "/Conversación/Obtener _atención" +#, fuzzy +msgid "Se_nd File..." +msgstr "_Enviar archivo..." -msgid "/Conversation/Add Buddy _Pounce..." -msgstr "/Conversación/Añadir a_viso de amigo..." +#, fuzzy +msgid "Get _Attention" +msgstr "_Atención!" -msgid "/Conversation/_Get Info" -msgstr "/Conversación/_Obtener información" +msgid "_Get Info" +msgstr "Obtener _información" -msgid "/Conversation/In_vite..." -msgstr "/Conversación/In_vitar..." +#, fuzzy +msgid "In_vite..." +msgstr "Invitar..." -msgid "/Conversation/M_ore" -msgstr "/Conversación/Má_s" +msgid "M_ore" +msgstr "" -msgid "/Conversation/Al_ias..." -msgstr "/Conversación/A_podo..." +#, fuzzy +msgid "Al_ias..." +msgstr "_Apodo..." -msgid "/Conversation/_Block..." -msgstr "/Conversación/_Bloquear..." +#, fuzzy +msgid "_Block..." +msgstr "_Bloquear" -msgid "/Conversation/_Unblock..." -msgstr "/Conversación/_Desbloquear..." +#, fuzzy +msgid "_Unblock..." +msgstr "Desbloquear" -msgid "/Conversation/_Add..." -msgstr "/Conversación/_Añadir..." +msgid "_Add..." +msgstr "_Añadir..." -msgid "/Conversation/_Remove..." -msgstr "/Conversación/Elimina_r..." +#, fuzzy +msgid "_Remove..." +msgstr "Elimina_r" -msgid "/Conversation/Insert Lin_k..." -msgstr "/Conversación/Insertar en_lace..." +#, fuzzy +msgid "Insert Lin_k..." +msgstr "Insertar enlace" -msgid "/Conversation/Insert Imag_e..." -msgstr "/Conversación/Insertar imag_en..." +#, fuzzy +msgid "Insert Imag_e..." +msgstr "Insertar imagen" -msgid "/Conversation/_Close" -msgstr "/Conversación/_Cerrar" +#, fuzzy +msgid "_Close" +msgstr "Cerrar" #. Options -msgid "/_Options" +#, fuzzy +msgid "_Options" msgstr "/_Opciones" -msgid "/Options/Enable _Logging" -msgstr "/Opciones/_Habilitar registro" +#, fuzzy +msgid "Enable _Logging" +msgstr "Habilitar registro" -msgid "/Options/Enable _Sounds" -msgstr "/Opciones/Habilitar _sonidos" +#, fuzzy +msgid "Enable _Sounds" +msgstr "Habilitar sonidos" -msgid "/Options/Show Formatting _Toolbars" +#, fuzzy +msgid "Show Formatting _Toolbars" msgstr "/Opciones/Mostrar _barras de formato" -msgid "/Options/Show Ti_mestamps" -msgstr "/Opciones/Mostrar _marcas de tiempo" - -msgid "/Conversation/More" -msgstr "/Conversación/Más" - -msgid "/Options" -msgstr "/Opciones" - -#. The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time -#. * the 'Conversation' menu pops up. -#. Make sure the 'Conversation -> More' menuitems are regenerated whenever -#. * the 'Conversation' menu pops up because the entries can change after the -#. * conversation is created. -msgid "/Conversation" -msgstr "/Conversación" - -msgid "/Conversation/View Log" -msgstr "/Conversación/Ver registro" - -msgid "/Conversation/Media/Audio Call" -msgstr "/Conversación/Medio/Audiollamada" - -msgid "/Conversation/Media/Video Call" -msgstr "/Conversación/Medio/Vídeollamada" - -msgid "/Conversation/Media/Audio\\/Video Call" -msgstr "/Conversación/Llamada audio\\/vídeo" - -msgid "/Conversation/Send File..." -msgstr "/Conversación/Enviar archivo..." - -msgid "/Conversation/Get Attention" -msgstr "/Conversación/Obtener atención" - -msgid "/Conversation/Add Buddy Pounce..." -msgstr "/Conversación/Añadir aviso de amigo..." - -msgid "/Conversation/Get Info" -msgstr "/Conversación/Obtener información" - -msgid "/Conversation/Invite..." -msgstr "/Conversación/Invitar..." - -msgid "/Conversation/Alias..." -msgstr "/Conversación/Apodo..." - -msgid "/Conversation/Block..." -msgstr "/Conversación/Bloquear..." - -msgid "/Conversation/Unblock..." -msgstr "/Conversación/Desbloquear..." - -msgid "/Conversation/Add..." -msgstr "/Conversación/Añadir..." - -msgid "/Conversation/Remove..." -msgstr "/Conversación/Eliminar..." - -msgid "/Conversation/Insert Link..." -msgstr "/Opciones/Insertar enlace..." - -msgid "/Conversation/Insert Image..." -msgstr "/Opciones/Insertar imagen..." - -msgid "/Options/Enable Logging" -msgstr "/Opciones/_Habilitar registro" - -msgid "/Options/Enable Sounds" -msgstr "/Opciones/Habilitar _sonidos" - -msgid "/Options/Show Formatting Toolbars" -msgstr "/Opciones/Mostrar barras de formato" - -msgid "/Options/Show Timestamps" -msgstr "/Opciones/Mostrar marcas de tiempo" +#, fuzzy +msgid "Show Ti_mestamps" +msgstr "Mostrar marcas de tiempo" msgid "User is typing..." msgstr "El usuario está escribiendo..." @@ -11950,7 +11869,7 @@ msgid "Hindi" msgstr "Hindú" msgid "Croatian" -msgstr "" +msgstr "Croata" msgid "Hungarian" msgstr "Húngaro" @@ -12063,6 +11982,10 @@ msgstr "Albanés" msgid "Serbian" msgstr "Serbio" +#, fuzzy +msgid "Serbian Latin" +msgstr "Latín bieloruso" + msgid "Sinhala" msgstr "Sinhala" @@ -12112,14 +12035,14 @@ msgstr "Amhárico" msgid "Lithuanian" msgstr "Lituano" -#, c-format +#, fuzzy, c-format msgid "" -"%s is a messaging client based on libpurple which is capable of connecting " -"to multiple messaging services at once. %s is written in C using GTK+. %s " -"is released, and may be modified and redistributed, under the terms of the " -"GPL version 2 (or later). A copy of the GPL is distributed with %s. %s is " -"copyrighted by its contributors, a list of whom is also distributed with " -"%s. There is no warranty for %s.

    " +"

    %s is a messaging client based on libpurple which is capable of " +"connecting to multiple messaging services at once. %s is written in C using " +"GTK+. %s is released, and may be modified and redistributed, under the " +"terms of the GPL version 2 (or later). A copy of the GPL is distributed " +"with %s. %s is copyrighted by its contributors, a list of whom is also " +"distributed with %s. There is no warranty for %s.

    " msgstr "" "%s es un cliente de mensajería basado en libpurple capaz de conectarse a " "múltiples sistemas de mensajería al mismo tiempo. %s está programado en C " @@ -12129,26 +12052,25 @@ msgstr "" "derechos de copia. Se incluye también una lista de los que han contribuido " "en %s. %s se distribuye sin ninguna garantía.

    " -#, c-format +#, fuzzy, c-format msgid "" -"Helpful Resources
    \tWebsite
    \tFrequently Asked Questions
    \tIRC " -"Channel: #pidgin on irc.freenode.net
    \tXMPP MUC: devel@conference.pidgin." -"im

    " +"

    Helpful Resources

    " msgstr "" "Recursos útiles
    \tSitio " "web
    \tPreguntas frecuentes
    \tCanal IRC: #pidgin " "en irc.freenode.net
    \tXMPP MUC: devel@conference.pidgin.im

    " -#, c-format +#, fuzzy, c-format msgid "" -"Help from other Pidgin users is available by " -"e-mailing support@pidgin.im
    This is a public mailing list! (archive)
    We can't help with third-party protocols or " -"plugins!
    This list's primary language is English. You are " -"welcome to post in another language, but the responses may be less helpful." -"
    " +"

    Help from other Pidgin users is available by e-mailing " +"%s.
    This is a public mailing " +"list! (archive)
    We can't help with third-" +"party protocols or plugins!
    This list's primary language is " +"English. You are welcome to post in another language, but " +"the responses may be less helpful.

    " msgstr "" "Puede obtener ayuda de otros usuarios de Pidgin enviando un correo a /Accounts/Enable Account" +#~ msgstr "/Cuentas/Activar cuenta" + +#~ msgid "/Accounts/" +#~ msgstr "/Cuentas/" + +#~ msgid "/Tools" +#~ msgstr "/Herramientas" + +#~ msgid "/Buddies/Sort Buddies" +#~ msgstr "/Amigos/Ordenar amigos" + +#~ msgid "Get Away Message" +#~ msgstr "Mensaje de ausencia" + +#~ msgid "/Conversation/New Instant _Message..." +#~ msgstr "/Conversación/Mensaje _instantáneo nuevo..." + +#~ msgid "/Conversation/Join a _Chat..." +#~ msgstr "/Conversación/Unirse a _Chat..." + +#~ msgid "/Conversation/_Find..." +#~ msgstr "/Conversación/_Buscar..." + +#~ msgid "/Conversation/View _Log" +#~ msgstr "/Conversación/Ver _historial" + +#~ msgid "/Conversation/_Save As..." +#~ msgstr "/Conversación/_Guardar como..." + +#~ msgid "/Conversation/Clea_r Scrollback" +#~ msgstr "/Conversación/Limpia_r deslizable" + +#~ msgid "/Conversation/M_edia" +#~ msgstr "/Conversación/_Medio" + +#~ msgid "/Conversation/Media/_Audio Call" +#~ msgstr "/Conversación/Medio/_Audiollamada" + +#~ msgid "/Conversation/Media/_Video Call" +#~ msgstr "/Conversación/Medio/_Vídeollamada" + +#~ msgid "/Conversation/Media/Audio\\/Video _Call" +#~ msgstr "/Conversación/Medio/_Llamada audio\\/vídeo" + +#~ msgid "/Conversation/Se_nd File..." +#~ msgstr "/Conversación/E_nviar archivo..." + +#~ msgid "/Conversation/Get _Attention" +#~ msgstr "/Conversación/Obtener _atención" + +#~ msgid "/Conversation/Add Buddy _Pounce..." +#~ msgstr "/Conversación/Añadir a_viso de amigo..." + +#~ msgid "/Conversation/_Get Info" +#~ msgstr "/Conversación/_Obtener información" + +#~ msgid "/Conversation/In_vite..." +#~ msgstr "/Conversación/In_vitar..." + +#~ msgid "/Conversation/M_ore" +#~ msgstr "/Conversación/Má_s" + +#~ msgid "/Conversation/Al_ias..." +#~ msgstr "/Conversación/A_podo..." + +#~ msgid "/Conversation/_Block..." +#~ msgstr "/Conversación/_Bloquear..." + +#~ msgid "/Conversation/_Unblock..." +#~ msgstr "/Conversación/_Desbloquear..." + +#~ msgid "/Conversation/_Add..." +#~ msgstr "/Conversación/_Añadir..." + +#~ msgid "/Conversation/_Remove..." +#~ msgstr "/Conversación/Elimina_r..." + +#~ msgid "/Conversation/Insert Lin_k..." +#~ msgstr "/Conversación/Insertar en_lace..." + +#~ msgid "/Conversation/Insert Imag_e..." +#~ msgstr "/Conversación/Insertar imag_en..." + +#~ msgid "/Conversation/_Close" +#~ msgstr "/Conversación/_Cerrar" + +#~ msgid "/Options/Enable _Logging" +#~ msgstr "/Opciones/_Habilitar registro" + +#~ msgid "/Options/Enable _Sounds" +#~ msgstr "/Opciones/Habilitar _sonidos" + +#~ msgid "/Options/Show Ti_mestamps" +#~ msgstr "/Opciones/Mostrar _marcas de tiempo" + +#~ msgid "/Conversation/More" +#~ msgstr "/Conversación/Más" + +#~ msgid "/Options" +#~ msgstr "/Opciones" + +#~ msgid "/Conversation" +#~ msgstr "/Conversación" + +#~ msgid "/Conversation/View Log" +#~ msgstr "/Conversación/Ver registro" + +#~ msgid "/Conversation/Media/Audio Call" +#~ msgstr "/Conversación/Medio/Audiollamada" + +#~ msgid "/Conversation/Media/Video Call" +#~ msgstr "/Conversación/Medio/Vídeollamada" + +#~ msgid "/Conversation/Media/Audio\\/Video Call" +#~ msgstr "/Conversación/Llamada audio\\/vídeo" + +#~ msgid "/Conversation/Send File..." +#~ msgstr "/Conversación/Enviar archivo..." + +#~ msgid "/Conversation/Get Attention" +#~ msgstr "/Conversación/Obtener atención" + +#~ msgid "/Conversation/Add Buddy Pounce..." +#~ msgstr "/Conversación/Añadir aviso de amigo..." + +#~ msgid "/Conversation/Get Info" +#~ msgstr "/Conversación/Obtener información" + +#~ msgid "/Conversation/Invite..." +#~ msgstr "/Conversación/Invitar..." + +#~ msgid "/Conversation/Alias..." +#~ msgstr "/Conversación/Apodo..." + +#~ msgid "/Conversation/Block..." +#~ msgstr "/Conversación/Bloquear..." + +#~ msgid "/Conversation/Unblock..." +#~ msgstr "/Conversación/Desbloquear..." + +#~ msgid "/Conversation/Add..." +#~ msgstr "/Conversación/Añadir..." + +#~ msgid "/Conversation/Remove..." +#~ msgstr "/Conversación/Eliminar..." + +#~ msgid "/Conversation/Insert Link..." +#~ msgstr "/Opciones/Insertar enlace..." + +#~ msgid "/Conversation/Insert Image..." +#~ msgstr "/Opciones/Insertar imagen..." + +#~ msgid "/Options/Enable Logging" +#~ msgstr "/Opciones/_Habilitar registro" + +#~ msgid "/Options/Enable Sounds" +#~ msgstr "/Opciones/Habilitar _sonidos" + +#~ msgid "/Options/Show Formatting Toolbars" +#~ msgstr "/Opciones/Mostrar barras de formato" + +#~ msgid "/Options/Show Timestamps" +#~ msgstr "/Opciones/Mostrar marcas de tiempo" + +#~ msgid "Alias Contact" +#~ msgstr "Apodo para contacto" + +#~ msgid "Enter an alias for this contact." +#~ msgstr "Introduzca un apodo para este contacto." + +#~ msgid "Google Talk" +#~ msgstr "Google Talk" + +#~ msgid "Facebook (XMPP)" +#~ msgstr "Facebook (XMPP)" + +#~ msgid "No Sametime Community Server specified" +#~ msgstr "No se ha especificado el servidor de comunidad «Sametime»" + +#~ msgid "" +#~ "No host or IP address has been configured for the Meanwhile account %s. " +#~ "Please enter one below to continue logging in." +#~ msgstr "" +#~ "No se ha configurado ninguna dirección IP o nombre de equipo para la " +#~ "cuenta «Meanwhile» %s. Introduzca uno más abajo para continuar el " +#~ "registro." + +#~ msgid "Meanwhile Connection Setup" +#~ msgstr "Configuración de la conexión «Meanwhile»" + +#~ msgid "No Sametime Community Server Specified" +#~ msgstr "No se ha especificado un servidor de comunidad «Sametime»" + +#~ msgid "Connect" +#~ msgstr "Conectar" + #~ msgid "Authorization Request Message:" #~ msgstr "Mensaje de solicitud de autorización:" diff --git a/po/ru.po b/po/ru.po index 5c7eea4a57..f9fef5ab32 100644 --- a/po/ru.po +++ b/po/ru.po @@ -10,16 +10,16 @@ msgid "" msgstr "" "Project-Id-Version: ru\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-12-11 09:57-0500\n" +"POT-Creation-Date: 2012-03-12 02:28-0700\n" "PO-Revision-Date: 2008-05-14 15:00+0400\n" "Last-Translator: Антон Самохвалов \n" "Language-Team: \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: \n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" -"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" #. Translators may want to transliterate the name. #. It is not to be translated. @@ -898,7 +898,6 @@ msgstr "Звоню..." msgid "Hangup" msgstr "Приостановить разговор" -#. Number of actions msgid "Accept" msgstr "Принять" @@ -1734,21 +1733,24 @@ msgstr "Сертификат был аннулирован." msgid "An unknown certificate error occurred." msgstr "Произошла неизвестная ошибка сертификата." +#, fuzzy +msgid "(MATCH)" +msgstr "НАБЛЮДАТЬ" + msgid "(DOES NOT MATCH)" msgstr "(НЕ СОВПАДАЕТ)" -#. Make messages #, c-format msgid "%s has presented the following certificate for just-this-once use:" msgstr "%s представил следующий сертификат для одноразового использования:" -#, c-format -msgid "" -"Common name: %s %s\n" -"Fingerprint (SHA1): %s" +#, fuzzy, c-format +msgid "Common name: %s %s" msgstr "" -"Общее имя: %s %s\n" -"Отпечаток (SHA1): %s" +"Общее имя: %s\n" +"\n" +"Отпечаток SHA1:\n" +"%s" #. TODO: Find what the handle ought to be msgid "Single-use Certificate Verification" @@ -1764,7 +1766,6 @@ msgstr "Органы сертификации" msgid "SSL Peers Cache" msgstr "Временное хранилище приоритетов SSL" -#. Make messages #, c-format msgid "Accept certificate for %s?" msgstr "Принять сертификат для %s?" @@ -1773,9 +1774,6 @@ msgstr "Принять сертификат для %s?" msgid "SSL Certificate Verification" msgstr "Проверка SSL-сертификата" -msgid "_View Certificate..." -msgstr "_Просмотреть сертификат..." - #, c-format msgid "The certificate for %s could not be validated." msgstr "Сертификат для %s не может быть подтверждён." @@ -1795,27 +1793,6 @@ msgstr "" "Вместо этого сертификат утверждает, что он от \"%s\". Это может означать, " "что вы подключены не к той услуге, к которой думаете." -#. Make messages -#, c-format -msgid "" -"Common name: %s\n" -"\n" -"Fingerprint (SHA1): %s\n" -"\n" -"Activation date: %s\n" -"Expiration date: %s\n" -msgstr "" -"Общее имя: %s\n" -"\n" -"Отпечаток (SHA1): %s\n" -"\n" -"Дата активации: %s\n" -"Дата истечения срока действия: %s\n" - -#. TODO: Find what the handle ought to be -msgid "Certificate Information" -msgstr "Информация о сертификате" - #. show error to user msgid "Registration Error" msgstr "Ошибка регистрации" @@ -2885,6 +2862,23 @@ msgstr "Простой модуль" msgid "Tests to see that most things are working." msgstr "Проверяет, всё ли работает." +#. Make messages +#, c-format +msgid "" +"Common name: %s\n" +"\n" +"Fingerprint (SHA1): %s\n" +"\n" +"Activation date: %s\n" +"Expiration date: %s\n" +msgstr "" +"Общее имя: %s\n" +"\n" +"Отпечаток (SHA1): %s\n" +"\n" +"Дата активации: %s\n" +"Дата истечения срока действия: %s\n" + #. Scheme name msgid "X.509 Certificates" msgstr "Сертификаты X.509" @@ -5935,8 +5929,7 @@ msgstr "" "происходит, когда пользователь заблокирован или не существует." msgid "Message was not sent because messages are being sent too quickly." -msgstr "" -"Сообщение не отправлено, потому что вы отправляли их слишком быстро." +msgstr "Сообщение не отправлено, потому что вы отправляли их слишком быстро." msgid "Message was not sent because an unknown encoding error occurred." msgstr "Сообщение не отправлено - произошла неизвестная ошибка кодирования." @@ -5944,6 +5937,30 @@ msgstr "Сообщение не отправлено - произошла неи msgid "Message was not sent because an unknown error occurred." msgstr "Сообщение не отправлено - произошла неизвестная ошибка." +#, fuzzy, c-format +msgid "" +"%s (There was an error receiving this message. Converting the encoding from " +"%s to UTF-8 failed.)" +msgstr "" +"(Произошла ошибка при преобразовании этого сообщения.\t Проверьте параметр " +"\"Кодировка\" в редакторе учётных записей)" + +#, fuzzy, c-format +msgid "" +"%s (There was an error receiving this message. The charset was %s, but it " +"was not valid UTF-8.)" +msgstr "" +"(Произошла ошибка при получении этого сообщения. Либо у вас и %s выбраны " +"разные кодировки, либо клиент %s содержит ошибки.)" + +#, fuzzy, c-format +msgid "" +"%s (There was an error receiving this message. The charset was missing, but " +"it was not valid UTF-8.)" +msgstr "" +"(Произошла ошибка при преобразовании этого сообщения.\t Проверьте параметр " +"\"Кодировка\" в редакторе учётных записей)" + msgid "Writing error" msgstr "Ошибка записи" @@ -6006,7 +6023,8 @@ msgstr "%s просит увидеть вашу веб-камеру, но это #, c-format msgid "%s invited you to view his/her webcam, but this is not yet supported." -msgstr "%s пригласил вас увидеть свою веб-камеру, но это ещё не поддерживается." +msgstr "" +"%s пригласил вас увидеть свою веб-камеру, но это ещё не поддерживается." msgid "Away From Computer" msgstr "Отошёл от компьютера" @@ -7640,14 +7658,14 @@ msgid "You missed %hu message from %s because your warning level is too high." msgid_plural "" "You missed %hu messages from %s because your warning level is too high." msgstr[0] "" -"Вы не получили %hu сообщение от %s, потому что у вас слишком высокий " -"уровень предупреждений." +"Вы не получили %hu сообщение от %s, потому что у вас слишком высокий уровень " +"предупреждений." msgstr[1] "" -"Вы не получили %hu сообщения от %s, потому что у вас слишком высокий " -"уровень предупреждений." +"Вы не получили %hu сообщения от %s, потому что у вас слишком высокий уровень " +"предупреждений." msgstr[2] "" -"Вы не получили %hu сообщений от %s, потому что у вас слишком высокий " -"уровень предупреждений." +"Вы не получили %hu сообщений от %s, потому что у вас слишком высокий уровень " +"предупреждений." #, c-format msgid "You missed %hu message from %s for an unknown reason." @@ -7829,16 +7847,13 @@ msgstr "" "собеседников не потерян и, вероятно, станет доступен в течение нескольких " "минут." -msgid "Orphans" -msgstr "Сироты" - #, c-format msgid "" "Unable to add the buddy %s because you have too many buddies in your buddy " "list. Please remove one and try again." msgstr "" -"Не удалось добавить собеседника %s потому, что у вас слишком много людей " -"в списке собеседников. Пожалуйста, удалите одного и попробуйте снова." +"Не удалось добавить собеседника %s потому, что у вас слишком много людей в " +"списке собеседников. Пожалуйста, удалите одного и попробуйте снова." msgid "(no name)" msgstr "(нет имени)" @@ -8403,8 +8418,8 @@ msgid "" "\"Create New Conference\" if you'd like to create a new conference to invite " "this user to." msgstr "" -"Выберите конференцию из списка ниже, чтобы послать приглашение пользователю %" -"s. Выберите \"Создать новую конференцию\" если вы хотите пригасить этого " +"Выберите конференцию из списка ниже, чтобы послать приглашение пользователю " +"%s. Выберите \"Создать новую конференцию\" если вы хотите пригасить этого " "пользователя в новую конференцию." msgid "Invite to Conference" @@ -9797,8 +9812,8 @@ msgid "" "Account locked: You have been logging in too frequently. Wait a few minutes " "before trying to connect again. Logging into the Yahoo! website may help." msgstr "" -"Учётная запись заблокирована: вы слишком часто входили. Подождите пару минут " -"и попробуйте снова. Вход на веб-сайт Yahoo!, возможно, исправит это." +"Учётная запись заблокирована: вы слишком часто входили. Подождите пару " +"минут и попробуйте снова. Вход на веб-сайт Yahoo!, возможно, исправит это." #. username or password missing msgid "Username or password missing" @@ -9836,8 +9851,7 @@ msgid "" "try logging into the Yahoo! website." msgstr "" "Ваша учётная запись была заблокирована из-за слишком большого количества " -"неверных попыток входа. Пожалуйста, попробуйте войти на веб-сайт " -"Yahoo!." +"неверных попыток входа. Пожалуйста, попробуйте войти на веб-сайт Yahoo!." #, c-format msgid "Unknown error 52. Reconnecting should fix this." @@ -10494,8 +10508,8 @@ msgid "" "An error was encountered reading your %s. The file has not been loaded, and " "the old file has been renamed to %s~." msgstr "" -"Произошла ошибка при чтении вашего %s. Файл не был загружен, а старый файл был " -"переименован в %s~." +"Произошла ошибка при чтении вашего %s. Файл не был загружен, а старый файл " +"был переименован в %s~." msgid "" "Chat over IM. Supports AIM, Google Talk, Jabber/XMPP, MSN, Yahoo and more" @@ -10890,9 +10904,6 @@ msgstr "_Свернуть" msgid "_Expand" msgstr "Р_азвернуть" -msgid "/Tools/Mute Sounds" -msgstr "/Средства/Отключить звуки" - msgid "" "You are not currently signed on with an account that can add that buddy." msgstr "" @@ -10916,122 +10927,152 @@ msgstr "Изменить настроение пользователя" #. NOTE: Do not set any accelerator to Control+O. It is mapped by #. gtk_blist_key_press_cb to "Get User Info" on the selected buddy. #. Buddies menu -msgid "/_Buddies" +#, fuzzy +msgid "_Buddies" msgstr "/_Собеседники" -msgid "/Buddies/New Instant _Message..." -msgstr "/Собеседники/Новое мгновенное сооб_щение..." - -msgid "/Buddies/Join a _Chat..." -msgstr "/Собеседники/Присоединиться к _чату..." - -msgid "/Buddies/Get User _Info..." -msgstr "/Собеседники/Получить пользовательскую _информацию..." - -msgid "/Buddies/View User _Log..." -msgstr "/Собеседники/Просмотреть _журнал пользователя..." - -msgid "/Buddies/Sh_ow" -msgstr "/Собеседники/_Показывать" - -msgid "/Buddies/Show/_Offline Buddies" -msgstr "/Собеседники/Показывать/Собеседников _не в сети" - -msgid "/Buddies/Show/_Empty Groups" -msgstr "/Собеседники/Показывать/П_устые группы" +#, fuzzy +msgid "New Instant _Message..." +msgstr "Новое мгновенное сообщение" -msgid "/Buddies/Show/Buddy _Details" -msgstr "/Собеседники/Показывать/_Подробности о собеседниках" +#, fuzzy +msgid "Join a _Chat..." +msgstr "Присоединиться к чату..." -msgid "/Buddies/Show/Idle _Times" -msgstr "/Собеседники/Показывать/_Время бездействия" +#, fuzzy +msgid "Get User _Info..." +msgstr "Установить пользовательскую информацию..." -msgid "/Buddies/Show/_Protocol Icons" -msgstr "/Собеседники/Показывать/_Значки протоколов" +#, fuzzy +msgid "View User _Log..." +msgstr "Просмотреть журнал пользователя" -msgid "/Buddies/_Sort Buddies" -msgstr "/Собеседники/_Сортировать собеседников" +msgid "Sh_ow" +msgstr "" -msgid "/Buddies/_Add Buddy..." -msgstr "/Собеседники/_Добавить собеседника..." +#, fuzzy +msgid "_Sort Buddies" +msgstr "Всего собеседников" -msgid "/Buddies/Add C_hat..." -msgstr "/Собеседники/Добавить ч_ат..." +#, fuzzy +msgid "_Add Buddy..." +msgstr "Добавить _собеседника..." -msgid "/Buddies/Add _Group..." -msgstr "/Собеседники/Добавить _группу..." +#, fuzzy +msgid "Add _Group..." +msgstr "Добавить группу" -msgid "/Buddies/_Quit" -msgstr "/Собеседники/В_ыйти" +msgid "_Quit" +msgstr "Вы_йти" #. Accounts menu -msgid "/_Accounts" -msgstr "/_Уч.записи" +msgid "_Accounts" +msgstr "_Учётные записи" -msgid "/Accounts/Manage Accounts" -msgstr "/Уч.записи/Управление учётными записями" +#, fuzzy +msgid "Manage Accounts" +msgstr "Включить учётную запись" #. Tools -msgid "/_Tools" +#, fuzzy +msgid "_Tools" msgstr "/Сре_дства" -msgid "/Tools/Buddy _Pounces" -msgstr "/Средства/_Слежение за собеседниками" - -msgid "/Tools/_Certificates" -msgstr "/Средства/С_ертификаты" +#, fuzzy +msgid "Buddy _Pounces" +msgstr "Правила для собеседников" -msgid "/Tools/Custom Smile_ys" -msgstr "/Средства/Свои сма_йлики" +#, fuzzy +msgid "_Certificates" +msgstr "Сертификаты" -msgid "/Tools/Plu_gins" -msgstr "/Средства/_Модули" +#, fuzzy +msgid "Custom Smile_ys" +msgstr "Свой смайлик" -msgid "/Tools/Pr_eferences" -msgstr "/Средства/_Настройки" +msgid "Plu_gins" +msgstr "_Модули" -msgid "/Tools/Pr_ivacy" -msgstr "/Средства/К_онфиденциальность" +msgid "Pr_eferences" +msgstr "На_стройки" -msgid "/Tools/Set _Mood" -msgstr "/Средства/Установить н_астроение" +#, fuzzy +msgid "Pr_ivacy" +msgstr "Конфиденциальность" -msgid "/Tools/_File Transfers" -msgstr "/Средства/Передача _файлов" +#, fuzzy +msgid "Set _Mood" +msgstr "Выставить _настроение..." -msgid "/Tools/R_oom List" -msgstr "/Средства/Список _комнат" +#, fuzzy +msgid "_File Transfers" +msgstr "Передача файлов" -msgid "/Tools/System _Log" -msgstr "/Средства/Системный _журнал" +#, fuzzy +msgid "R_oom List" +msgstr "Список комнат" -msgid "/Tools/Mute _Sounds" -msgstr "/Средства/Отключить _звуки" +#, fuzzy +msgid "System _Log" +msgstr "Системный журнал" #. Help -msgid "/_Help" +#, fuzzy +msgid "_Help" msgstr "/_Помощь" -msgid "/Help/Online _Help" +#, fuzzy +msgid "Online _Help" msgstr "/Помощь/Помо_щь в сети" -msgid "/Help/_Build Information" -msgstr "/Помощь/Информация о _сборке" +#, fuzzy +msgid "_Build Information" +msgstr "Информация о сборке" -msgid "/Help/_Debug Window" -msgstr "/Помощь/_Окно отладки" +#, fuzzy +msgid "_Debug Window" +msgstr "Окно отладки" -msgid "/Help/De_veloper Information" -msgstr "/Помощь/Информация о _разработчике" +#, fuzzy +msgid "De_veloper Information" +msgstr "Информация разработчика %s" -msgid "/Help/_Plugin Information" -msgstr "/Помощь/Информация о _модуле" +#, fuzzy +msgid "_Plugin Information" +msgstr "Информация модуля" + +#, fuzzy +msgid "_Translator Information" +msgstr "Информация переводчика %s" -msgid "/Help/_Translator Information" -msgstr "/Помощь/Информация о _переводчике" +#, fuzzy +msgid "_About" +msgstr "Про" + +#. Buddies->Show menu +#, fuzzy +msgid "_Offline Buddies" +msgstr "Собеседников не в сети" -msgid "/Help/_About" -msgstr "/Помощь/О программ_е" +#, fuzzy +msgid "_Empty Groups" +msgstr "Пустые группы" + +#, fuzzy +msgid "Buddy _Details" +msgstr "/Собеседники/Показывать/_Подробности о собеседниках" + +#, fuzzy +msgid "Idle _Times" +msgstr "Показывать время бездействия" + +#, fuzzy +msgid "_Protocol Icons" +msgstr "Протокол" + +#. Tools menu +msgid "Mute _Sounds" +msgstr "Отключить _звуки" #, c-format msgid "Account: %s" @@ -11089,30 +11130,6 @@ msgstr "Бездействует %dч %02dм" msgid "Idle %dm" msgstr "Бездействует %dм" -msgid "/Buddies/New Instant Message..." -msgstr "/Собеседники/Новое мгновенное сообщение..." - -msgid "/Buddies/Join a Chat..." -msgstr "/Собеседники/Присоединиться к чату..." - -msgid "/Buddies/Get User Info..." -msgstr "/Собеседники/Получить пользовательскую информацию..." - -msgid "/Buddies/Add Buddy..." -msgstr "/Собеседники/Добавить собеседника..." - -msgid "/Buddies/Add Chat..." -msgstr "/Собеседники/Добавить чат..." - -msgid "/Buddies/Add Group..." -msgstr "/Собеседники/Добавить группу..." - -msgid "/Tools/Privacy" -msgstr "/Собеседники/Конфиденциальность" - -msgid "/Tools/Room List" -msgstr "/Собеседники/Список комнат" - #, c-format msgid "%d unread message from %s\n" msgid_plural "%d unread messages from %s\n" @@ -11169,9 +11186,6 @@ msgstr "Пароль:" msgid "_Login" msgstr "_Вход" -msgid "/Accounts" -msgstr "/Учётные записи" - #. Translators: Please maintain the use of -> and <- to refer to menu heirarchy #, c-format msgid "" @@ -11184,27 +11198,8 @@ msgstr "" "Добро пожаловать в %s!\n" "\n" "У вас нет включённых учётных записей. Включите их из окна Учётные записи через меню Уч.записи->Управление учётными записями. Сделав " -"это, вы сможете войти в сеть, установить свой статус и начать общение с " -"друзьями." - -#. set the Show Offline Buddies option. must be done -#. * after the treeview or faceprint gets mad. -Robot101 -#. -msgid "/Buddies/Show/Offline Buddies" -msgstr "/Собеседники/Показывать/Собеседников не в сети" - -msgid "/Buddies/Show/Empty Groups" -msgstr "/Собеседники/Показывать/Пустые группы" - -msgid "/Buddies/Show/Buddy Details" -msgstr "/Собеседники/Показывать/Подробности о собеседниках" - -msgid "/Buddies/Show/Idle Times" -msgstr "/Собеседники/Показывать/Время бездействия" - -msgid "/Buddies/Show/Protocol Icons" -msgstr "/Собеседники/Показывать/Значки протоколов" +"b> через меню Уч.записи->Управление учётными записями. Сделав это, вы " +"сможете войти в сеть, установить свой статус и начать общение с друзьями." msgid "Add a buddy.\n" msgstr "Добавить собеседника.\n" @@ -11254,12 +11249,6 @@ msgstr "Введите имя добавляемой группы." msgid "Enable Account" msgstr "Включить учётную запись" -msgid "/Accounts/Enable Account" -msgstr "/Уч.записи/Включить запись" - -msgid "/Accounts/" -msgstr "/Уч.записи/" - msgid "_Edit Account" msgstr "_Изменить учётную запись" @@ -11272,15 +11261,14 @@ msgstr "Нет доступных действий" msgid "_Disable" msgstr "_Выключить" -msgid "/Tools" -msgstr "/Средства" - -msgid "/Buddies/Sort Buddies" -msgstr "/Собеседники/Сортировать собеседников" - msgid "Type the host name for this certificate." msgstr "Укажите имя узла для этого сертификата." +#. Fire the notification +#, fuzzy, c-format +msgid "Certificate Information for %s" +msgstr "Информация о сертификате" + #. Widget creation function msgid "SSL Servers" msgstr "SSL-серверы" @@ -11300,6 +11288,14 @@ msgstr "Подробная отладка сейчас включена." msgid "Supported debug options are: plugins version unsafe verbose" msgstr "Поддерживаемые параметры отладки: модули версия небезопасная подробная" +#, fuzzy +msgid "" +"Use \"/help <command>\" for help on a specific command.
    The " +"following commands are available in this context:
    " +msgstr "" +"Используйте \"/help <команда>\" для помощи по конкретной команде.\n" +"Следующие команды доступны в этом контексте:\n" + msgid "Unknown command." msgstr "Неизвестная команда." @@ -11361,170 +11357,99 @@ msgid "Show All" msgstr "Показать всё" #. Conversation menu -msgid "/_Conversation" +#, fuzzy +msgid "_Conversation" msgstr "/_Беседа" -msgid "/Conversation/New Instant _Message..." -msgstr "/Беседа/Новое мгновенное сооб_щение..." - -msgid "/Conversation/Join a _Chat..." -msgstr "/Беседа/Присоединиться к _чату..." - -msgid "/Conversation/_Find..." -msgstr "/Беседа/_Найти..." - -msgid "/Conversation/View _Log" -msgstr "/Беседа/Просмотреть _журнал" - -msgid "/Conversation/_Save As..." -msgstr "/Беседа/Со_хранить как..." - -msgid "/Conversation/Clea_r Scrollback" -msgstr "/Беседа/О_чистить" - -msgid "/Conversation/M_edia" -msgstr "/Беседа/М_едиа" +#, fuzzy +msgid "_Find..." +msgstr "Найти" -msgid "/Conversation/Media/_Audio Call" -msgstr "/Беседа/Медиа/_Аудиозвонок" +#, fuzzy +msgid "_Save As..." +msgstr "Сохранить как..." -msgid "/Conversation/Media/_Video Call" -msgstr "/Беседа/Медиа/_Видеозвонок" +#, fuzzy +msgid "Clea_r Scrollback" +msgstr "Очистить" -msgid "/Conversation/Media/Audio\\/Video _Call" -msgstr "/Беседа/Медиа/Аудио\\/Видео_звонок" +#, fuzzy +msgid "M_edia" +msgstr "/_Медиа" -msgid "/Conversation/Se_nd File..." -msgstr "/Беседа/Отправить _файл..." +#, fuzzy +msgid "Audio/Video _Call" +msgstr "Аудио/Видео _звонок" -msgid "/Conversation/Get _Attention" -msgstr "/Беседа/Привлечь _внимание" +#, fuzzy +msgid "Se_nd File..." +msgstr "_Отправить файл..." -msgid "/Conversation/Add Buddy _Pounce..." -msgstr "/Беседа/Добавить п_равило..." +#, fuzzy +msgid "Get _Attention" +msgstr "_Внимание!" -msgid "/Conversation/_Get Info" -msgstr "/Беседа/Получить _информацию" +msgid "_Get Info" +msgstr "Получить _информацию" -msgid "/Conversation/In_vite..." -msgstr "/Беседа/Приг_ласить..." +#, fuzzy +msgid "In_vite..." +msgstr "Пригласить..." -msgid "/Conversation/M_ore" -msgstr "/Беседа/_Ещё" +msgid "M_ore" +msgstr "" -msgid "/Conversation/Al_ias..." -msgstr "/Беседа/_Псевдоним..." +#, fuzzy +msgid "Al_ias..." +msgstr "_Псевдоним..." -msgid "/Conversation/_Block..." -msgstr "/Беседа/_Блокировать..." +#, fuzzy +msgid "_Block..." +msgstr "_Блокировать" -msgid "/Conversation/_Unblock..." -msgstr "/Беседа/Раз_блокировать..." +#, fuzzy +msgid "_Unblock..." +msgstr "Разблокировать" -msgid "/Conversation/_Add..." -msgstr "/Беседа/_Добавить..." +msgid "_Add..." +msgstr "_Добавить..." -msgid "/Conversation/_Remove..." -msgstr "/Беседа/_Удалить..." +#, fuzzy +msgid "_Remove..." +msgstr "_Удалить" -msgid "/Conversation/Insert Lin_k..." -msgstr "/Беседа/Вставить _ссылку..." +#, fuzzy +msgid "Insert Lin_k..." +msgstr "Вставить ссылку" -msgid "/Conversation/Insert Imag_e..." -msgstr "/Беседа/Вставить из_ображение..." +#, fuzzy +msgid "Insert Imag_e..." +msgstr "Вставить изображение" -msgid "/Conversation/_Close" -msgstr "/Беседа/_Закрыть" +#, fuzzy +msgid "_Close" +msgstr "Закрыть" #. Options -msgid "/_Options" +#, fuzzy +msgid "_Options" msgstr "/_Параметры" -msgid "/Options/Enable _Logging" -msgstr "/Параметры/Вести _журнал" +#, fuzzy +msgid "Enable _Logging" +msgstr "Вести журнал" -msgid "/Options/Enable _Sounds" -msgstr "/Параметры/Воспроизводить _звуки" +#, fuzzy +msgid "Enable _Sounds" +msgstr "Включить звуки" -msgid "/Options/Show Formatting _Toolbars" +#, fuzzy +msgid "Show Formatting _Toolbars" msgstr "/Параметры/Показывать _панели форматирования" -msgid "/Options/Show Ti_mestamps" -msgstr "/Параметры/Показывать _время сообщений" - -msgid "/Conversation/More" -msgstr "/Беседа/Ещё" - -msgid "/Options" -msgstr "/Параметры" - -#. The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time -#. * the 'Conversation' menu pops up. -#. Make sure the 'Conversation -> More' menuitems are regenerated whenever -#. * the 'Conversation' menu pops up because the entries can change after the -#. * conversation is created. -msgid "/Conversation" -msgstr "/Беседа" - -msgid "/Conversation/View Log" -msgstr "/Беседа/Просмотреть журнал" - -msgid "/Conversation/Media/Audio Call" -msgstr "/Беседа/Медиа/Аудиозвонок" - -msgid "/Conversation/Media/Video Call" -msgstr "/Беседа/Медиа/Видеозвонок" - -msgid "/Conversation/Media/Audio\\/Video Call" -msgstr "/Беседа/Медиа/Аудио\\/Видеозвонок" - -msgid "/Conversation/Send File..." -msgstr "/Беседа/Отправить файл..." - -msgid "/Conversation/Get Attention" -msgstr "/Беседа/Привлечь внимание" - -msgid "/Conversation/Add Buddy Pounce..." -msgstr "/Беседа/Добавить правило..." - -msgid "/Conversation/Get Info" -msgstr "/Беседа/Получить информацию" - -msgid "/Conversation/Invite..." -msgstr "/Беседа/Пригласить..." - -msgid "/Conversation/Alias..." -msgstr "/Беседа/Псевдоним..." - -msgid "/Conversation/Block..." -msgstr "/Беседа/Блокировать..." - -msgid "/Conversation/Unblock..." -msgstr "/Беседа/Разблокировать..." - -msgid "/Conversation/Add..." -msgstr "/Беседа/Добавить..." - -msgid "/Conversation/Remove..." -msgstr "/Беседа/Удалить..." - -msgid "/Conversation/Insert Link..." -msgstr "/Беседа/Вставить ссылку..." - -msgid "/Conversation/Insert Image..." -msgstr "/Беседа/Вставить изображение..." - -msgid "/Options/Enable Logging" -msgstr "/Параметры/Вести журнал" - -msgid "/Options/Enable Sounds" -msgstr "/Параметры/Воспроизводить звуки" - -msgid "/Options/Show Formatting Toolbars" -msgstr "/Параметры/Показывать панели форматирования" - -msgid "/Options/Show Timestamps" -msgstr "/Параметры/Показывать время сообщений" +#, fuzzy +msgid "Show Ti_mestamps" +msgstr "Показывать время сообщений" msgid "User is typing..." msgstr "Пользователь набирает сообщение..." @@ -11914,6 +11839,10 @@ msgstr "Албанский" msgid "Serbian" msgstr "Сербский" +#, fuzzy +msgid "Serbian Latin" +msgstr "Белорусская латиница" + msgid "Sinhala" msgstr "Сингальский" @@ -11962,14 +11891,14 @@ msgstr "Амхарский" msgid "Lithuanian" msgstr "Литовский" -#, c-format +#, fuzzy, c-format msgid "" -"%s is a messaging client based on libpurple which is capable of connecting " -"to multiple messaging services at once. %s is written in C using GTK+. %s " -"is released, and may be modified and redistributed, under the terms of the " -"GPL version 2 (or later). A copy of the GPL is distributed with %s. %s is " -"copyrighted by its contributors, a list of whom is also distributed with %" -"s. There is no warranty for %s.

    " +"

    %s is a messaging client based on libpurple which is capable of " +"connecting to multiple messaging services at once. %s is written in C using " +"GTK+. %s is released, and may be modified and redistributed, under the " +"terms of the GPL version 2 (or later). A copy of the GPL is distributed " +"with %s. %s is copyrighted by its contributors, a list of whom is also " +"distributed with %s. There is no warranty for %s.

    " msgstr "" "%s - клиент обмена сообщениями, основанный на библиотеке libpurple, которая " "позволяет одновременно подключаться по нескольким службам. %s написан на С с " @@ -11978,26 +11907,25 @@ msgstr "" "%s. Права на %s защищены его участниками, список которых также " "распространяется с %s. Гарантия на %s не предоставляется.

    " -#, c-format +#, fuzzy, c-format msgid "" -"Helpful Resources
    \t
    Website
    \tFrequently Asked Questions
    \tIRC " -"Channel: #pidgin on irc.freenode.net
    \tXMPP MUC: devel@conference.pidgin." -"im

    " +"

    Helpful Resources

    " msgstr "" "Полезные ресурсы
    \tВеб-" "сайт
    \tЧасто задаваемые вопросы
    \tIRC канал: " "#pidgin на irc.freenode.net
    \tXMPP MUC: devel@conference.pidgin.im

    " -#, c-format +#, fuzzy, c-format msgid "" -"Help from other Pidgin users is available by " -"e-mailing support@pidgin.im
    This is a public mailing list! (archive)
    We can't help with third-party protocols or " -"plugins!
    This list's primary language is English. You are " -"welcome to post in another language, but the responses may be less helpful." -"
    " +"

    Help from other Pidgin users is available by e-mailing " +"%s.
    This is a public mailing " +"list! (archive)
    We can't help with third-" +"party protocols or plugins!
    This list's primary language is " +"English. You are welcome to post in another language, but " +"the responses may be less helpful.

    " msgstr "" "Помощь от других пользователей Pidgin " "доступна по эл.почте support@pidgin.im/Accounts/Enable Account" +#~ msgstr "/Уч.записи/Включить запись" + +#~ msgid "/Accounts/" +#~ msgstr "/Уч.записи/" + +#~ msgid "/Tools" +#~ msgstr "/Средства" + +#~ msgid "/Buddies/Sort Buddies" +#~ msgstr "/Собеседники/Сортировать собеседников" + +#~ msgid "/Conversation/New Instant _Message..." +#~ msgstr "/Беседа/Новое мгновенное сооб_щение..." + +#~ msgid "/Conversation/Join a _Chat..." +#~ msgstr "/Беседа/Присоединиться к _чату..." + +#~ msgid "/Conversation/_Find..." +#~ msgstr "/Беседа/_Найти..." + +#~ msgid "/Conversation/View _Log" +#~ msgstr "/Беседа/Просмотреть _журнал" + +#~ msgid "/Conversation/_Save As..." +#~ msgstr "/Беседа/Со_хранить как..." + +#~ msgid "/Conversation/Clea_r Scrollback" +#~ msgstr "/Беседа/О_чистить" + +#~ msgid "/Conversation/M_edia" +#~ msgstr "/Беседа/М_едиа" + +#~ msgid "/Conversation/Media/_Audio Call" +#~ msgstr "/Беседа/Медиа/_Аудиозвонок" + +#~ msgid "/Conversation/Media/_Video Call" +#~ msgstr "/Беседа/Медиа/_Видеозвонок" + +#~ msgid "/Conversation/Media/Audio\\/Video _Call" +#~ msgstr "/Беседа/Медиа/Аудио\\/Видео_звонок" + +#~ msgid "/Conversation/Se_nd File..." +#~ msgstr "/Беседа/Отправить _файл..." + +#~ msgid "/Conversation/Get _Attention" +#~ msgstr "/Беседа/Привлечь _внимание" + +#~ msgid "/Conversation/Add Buddy _Pounce..." +#~ msgstr "/Беседа/Добавить п_равило..." + +#~ msgid "/Conversation/_Get Info" +#~ msgstr "/Беседа/Получить _информацию" + +#~ msgid "/Conversation/In_vite..." +#~ msgstr "/Беседа/Приг_ласить..." + +#~ msgid "/Conversation/M_ore" +#~ msgstr "/Беседа/_Ещё" + +#~ msgid "/Conversation/Al_ias..." +#~ msgstr "/Беседа/_Псевдоним..." + +#~ msgid "/Conversation/_Block..." +#~ msgstr "/Беседа/_Блокировать..." + +#~ msgid "/Conversation/_Unblock..." +#~ msgstr "/Беседа/Раз_блокировать..." + +#~ msgid "/Conversation/_Add..." +#~ msgstr "/Беседа/_Добавить..." + +#~ msgid "/Conversation/_Remove..." +#~ msgstr "/Беседа/_Удалить..." + +#~ msgid "/Conversation/Insert Lin_k..." +#~ msgstr "/Беседа/Вставить _ссылку..." + +#~ msgid "/Conversation/Insert Imag_e..." +#~ msgstr "/Беседа/Вставить из_ображение..." + +#~ msgid "/Conversation/_Close" +#~ msgstr "/Беседа/_Закрыть" + +#~ msgid "/Options/Enable _Logging" +#~ msgstr "/Параметры/Вести _журнал" + +#~ msgid "/Options/Enable _Sounds" +#~ msgstr "/Параметры/Воспроизводить _звуки" + +#~ msgid "/Options/Show Ti_mestamps" +#~ msgstr "/Параметры/Показывать _время сообщений" + +#~ msgid "/Conversation/More" +#~ msgstr "/Беседа/Ещё" + +#~ msgid "/Options" +#~ msgstr "/Параметры" + +#~ msgid "/Conversation" +#~ msgstr "/Беседа" + +#~ msgid "/Conversation/View Log" +#~ msgstr "/Беседа/Просмотреть журнал" + +#~ msgid "/Conversation/Media/Audio Call" +#~ msgstr "/Беседа/Медиа/Аудиозвонок" + +#~ msgid "/Conversation/Media/Video Call" +#~ msgstr "/Беседа/Медиа/Видеозвонок" + +#~ msgid "/Conversation/Media/Audio\\/Video Call" +#~ msgstr "/Беседа/Медиа/Аудио\\/Видеозвонок" + +#~ msgid "/Conversation/Send File..." +#~ msgstr "/Беседа/Отправить файл..." + +#~ msgid "/Conversation/Get Attention" +#~ msgstr "/Беседа/Привлечь внимание" + +#~ msgid "/Conversation/Add Buddy Pounce..." +#~ msgstr "/Беседа/Добавить правило..." + +#~ msgid "/Conversation/Get Info" +#~ msgstr "/Беседа/Получить информацию" + +#~ msgid "/Conversation/Invite..." +#~ msgstr "/Беседа/Пригласить..." + +#~ msgid "/Conversation/Alias..." +#~ msgstr "/Беседа/Псевдоним..." + +#~ msgid "/Conversation/Block..." +#~ msgstr "/Беседа/Блокировать..." + +#~ msgid "/Conversation/Unblock..." +#~ msgstr "/Беседа/Разблокировать..." + +#~ msgid "/Conversation/Add..." +#~ msgstr "/Беседа/Добавить..." + +#~ msgid "/Conversation/Remove..." +#~ msgstr "/Беседа/Удалить..." + +#~ msgid "/Conversation/Insert Link..." +#~ msgstr "/Беседа/Вставить ссылку..." + +#~ msgid "/Conversation/Insert Image..." +#~ msgstr "/Беседа/Вставить изображение..." + +#~ msgid "/Options/Enable Logging" +#~ msgstr "/Параметры/Вести журнал" + +#~ msgid "/Options/Enable Sounds" +#~ msgstr "/Параметры/Воспроизводить звуки" + +#~ msgid "/Options/Show Formatting Toolbars" +#~ msgstr "/Параметры/Показывать панели форматирования" + +#~ msgid "/Options/Show Timestamps" +#~ msgstr "/Параметры/Показывать время сообщений" + +#~ msgid "Google Talk" +#~ msgstr "Google-общение" + +#~ msgid "Facebook (XMPP)" +#~ msgstr "Facebook (XMPP)" + #~ msgid "" #~ "%s encountered errors migrating your settings from %s to %s. Please " #~ "investigate and complete the migration by hand. Please report this error " @@ -16132,11 +16358,13 @@ msgstr "У Вас нет прав на удаление этого прилож #~ "%s %s\n" #~ "Использование: %s [КЛЮЧ]...\n" #~ "\n" -#~ " -c, --config=ДИР использовать директорию ДИР для файлов конфигурации\n" +#~ " -c, --config=ДИР использовать директорию ДИР для файлов " +#~ "конфигурации\n" #~ " -d, --debug выводить отладочную информацию в стандартный вывод\n" #~ " -f, --force-online работать он-лайн, несмотря на состояние сети\n" #~ " -h, --help показать эту справку и выйти\n" -#~ " -m, --multiple не ограничиваться запуском только одного экземпляра программы\n" +#~ " -m, --multiple не ограничиваться запуском только одного экземпляра " +#~ "программы\n" #~ " -n, --nologin не входить автоматически\n" #~ " -l, --login[=ИМЯ] включить указанную(-ые) учётную(-ые) запись(-и) \n" #~ " (необязательный аргумент ИМЯ задаёт одну или \n" @@ -16153,8 +16381,8 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "" #~ "%s declined your conference invitation to room \"%s\" because \"%s\"." #~ msgstr "" -#~ "%s отклонил ваше приглашение к конференции в комнату \"%s\" потому что \"%" -#~ "s\"." +#~ "%s отклонил ваше приглашение к конференции в комнату \"%s\" потому что " +#~ "\"%s\"." #~ msgid "Invitation Rejected" #~ msgstr "Приглашение отвергнуто" @@ -16596,9 +16824,6 @@ msgstr "У Вас нет прав на удаление этого прилож #~ msgid "Could not write file header. The file will not be transferred." #~ msgstr "Не удалось записать заголовок файла. Файл не будет передан." -#~ msgid "Save As..." -#~ msgstr "Сохранить как..." - #~ msgid "%s requests %s to accept %d file: %s (%.2f %s)%s%s" #~ msgid_plural "%s requests %s to accept %d files: %s (%.2f %s)%s%s" #~ msgstr[0] "%s запросов %s на принятие %d файла: %s (%.2f %s)%s%s" diff --git a/po/sl.po b/po/sl.po index 0693387e78..efb2043409 100644 --- a/po/sl.po +++ b/po/sl.po @@ -8,15 +8,16 @@ msgid "" msgstr "" "Project-Id-Version: Pidgin 2.7.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-17 09:57-0500\n" +"POT-Creation-Date: 2012-03-12 02:28-0700\n" "PO-Revision-Date: 2012-02-17 23:15+0100\n" "Last-Translator: filmsi\n" "Language-Team: Martin Srebotnjak \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: \n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0);\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n" +"%100==4 ? 3 : 0);\n" "X-Poedit-Language: Slovenian\n" "X-Poedit-Country: SLOVENIA\n" "X-Poedit-SourceCharset: utf-8\n" @@ -63,11 +64,16 @@ msgstr "Račun ni bil dodan" msgid "Username of an account must be non-empty." msgstr "Uporabniško ime računa ne sme biti prazno." -msgid "The account's protocol cannot be changed while it is connected to the server." -msgstr "Protokola računa ni mogoče spremeniti, medtem ko je povezan s strežnikom." +msgid "" +"The account's protocol cannot be changed while it is connected to the server." +msgstr "" +"Protokola računa ni mogoče spremeniti, medtem ko je povezan s strežnikom." -msgid "The account's username cannot be changed while it is connected to the server." -msgstr "Uporabniškega imena računa ni mogoče spremeniti, medtem ko je povezan s strežnikom." +msgid "" +"The account's username cannot be changed while it is connected to the server." +msgstr "" +"Uporabniškega imena računa ni mogoče spremeniti, medtem ko je povezan s " +"strežnikom." msgid "New mail notifications" msgstr "Obveščanje o prispeli pošti" @@ -300,10 +306,12 @@ msgid "Enter empty string to reset the name." msgstr "Vnesite prazen niz, da ponastavite ime." msgid "Removing this contact will also remove all the buddies in the contact" -msgstr "Z odstranitvijo tega stika boste odstranili tudi vse prijatelje iz stika" +msgstr "" +"Z odstranitvijo tega stika boste odstranili tudi vse prijatelje iz stika" msgid "Removing this group will also remove all the buddies in the group" -msgstr "Z odstranitvijo te skupine boste odstranili tudi vse prijatelje iz skupine" +msgstr "" +"Z odstranitvijo te skupine boste odstranili tudi vse prijatelje iz skupine" #, c-format msgid "Are you sure you want to remove %s?" @@ -363,8 +371,12 @@ msgstr "Zavrni" msgid "Unblock" msgstr "Prekliči zavrnitev" -msgid "Please enter the username or alias of the person you would like to Block/Unblock." -msgstr "Vnesite uporabniško ime ali psevdonim osebe, ki jo želite zavrniti/preklicati njeno zavrnitev." +msgid "" +"Please enter the username or alias of the person you would like to Block/" +"Unblock." +msgstr "" +"Vnesite uporabniško ime ali psevdonim osebe, ki jo želite zavrniti/" +"preklicati njeno zavrnitev." #. Not multiline #. Not masked? @@ -376,7 +388,9 @@ msgid "New Instant Message" msgstr "Novo neposredno sporočilo" msgid "Please enter the username or alias of the person you would like to IM." -msgstr "Vnesite uporabniško ime ali psevdonim osebe, ki ji želite poslati neposredno sporočilo." +msgstr "" +"Vnesite uporabniško ime ali psevdonim osebe, ki ji želite poslati neposredno " +"sporočilo." msgid "Channel" msgstr "Kanal" @@ -390,8 +404,12 @@ msgstr "Vnesite ime klepeta, ki se mu želite pridružiti." msgid "Join" msgstr "Pridruži se" -msgid "Please enter the username or alias of the person whose log you would like to view." -msgstr "Vnesite uporabniško ime ali psevdonim osebe, o kateri želite pridobiti dnevnik." +msgid "" +"Please enter the username or alias of the person whose log you would like to " +"view." +msgstr "" +"Vnesite uporabniško ime ali psevdonim osebe, o kateri želite pridobiti " +"dnevnik." #. Create the "Options" frame. msgid "Options" @@ -536,11 +554,13 @@ msgstr "%s se je odjavil." msgid "" "%s\n" "\n" -"Finch will not attempt to reconnect the account until you correct the error and re-enable the account." +"Finch will not attempt to reconnect the account until you correct the error " +"and re-enable the account." msgstr "" "%s\n" "\n" -"Finch se ne bo poskušal ponovno prijaviti, dokler ne odpravite napake in ponovno omogočite povezovanje računa." +"Finch se ne bo poskušal ponovno prijaviti, dokler ne odpravite napake in " +"ponovno omogočite povezovanje računa." msgid "Re-enable Account" msgstr "Ponovno omogoči račun" @@ -549,7 +569,8 @@ msgid "No such command." msgstr "Ta ukaz ne obstaja." msgid "Syntax Error: You typed the wrong number of arguments to that command." -msgstr "Skladenjska napaka: vtipkali ste napačno število argumentov za ta ukaz." +msgstr "" +"Skladenjska napaka: vtipkali ste napačno število argumentov za ta ukaz." msgid "Your command failed for an unknown reason." msgstr "Vaš ukaz iz neznanega razloga ni uspel." @@ -585,14 +606,23 @@ msgstr "" msgid "You have left this chat." msgstr "Ta klepet ste zapustili." -msgid "The account has disconnected and you are no longer in this chat. You will be automatically rejoined in the chat when the account reconnects." -msgstr "Ta račun je bil prekinjen in nič več niste v tem klepetu. Samodejno boste pridruženi klepetu, ko se račun ponovno poveže." +msgid "" +"The account has disconnected and you are no longer in this chat. You will be " +"automatically rejoined in the chat when the account reconnects." +msgstr "" +"Ta račun je bil prekinjen in nič več niste v tem klepetu. Samodejno boste " +"pridruženi klepetu, ko se račun ponovno poveže." msgid "Logging started. Future messages in this conversation will be logged." -msgstr "Začelo se je beleženje v dnevnik. Vsa nadaljna sporočila pogovora bodo zabeležena." +msgstr "" +"Začelo se je beleženje v dnevnik. Vsa nadaljna sporočila pogovora bodo " +"zabeležena." -msgid "Logging stopped. Future messages in this conversation will not be logged." -msgstr "Beleženje v dnevnik ustavljeno. Nadaljna sporočila pogovora ne bodo zabeležena." +msgid "" +"Logging stopped. Future messages in this conversation will not be logged." +msgstr "" +"Beleženje v dnevnik ustavljeno. Nadaljna sporočila pogovora ne bodo " +"zabeležena." msgid "Send To" msgstr "Pošlji k" @@ -646,21 +676,36 @@ msgstr "" "V tem sklopu so na voljo naslednji ukazi:\n" #, c-format -msgid "%s is not a valid message class. See '/help msgcolor' for valid message classes." -msgstr "%s ni veljaven razred sporočil. Oglejte si '/help msgcolor', kjer so navedeni veljavni razredi sporočil." +msgid "" +"%s is not a valid message class. See '/help msgcolor' for valid message " +"classes." +msgstr "" +"%s ni veljaven razred sporočil. Oglejte si '/help msgcolor', kjer so " +"navedeni veljavni razredi sporočil." #, c-format msgid "%s is not a valid color. See '/help msgcolor' for valid colors." -msgstr "%s ni veljavna barva. Oglejte si '/help msgcolor', kjer so opisane veljavne barve." +msgstr "" +"%s ni veljavna barva. Oglejte si '/help msgcolor', kjer so opisane veljavne " +"barve." -msgid "say <message>: Send a message normally as if you weren't using a command." -msgstr "say <sporočilo>: Pošlji sporočilo kot ponavadi, kot če ne bi uporabljal ukaza." +msgid "" +"say <message>: Send a message normally as if you weren't using a " +"command." +msgstr "" +"say <sporočilo>: Pošlji sporočilo kot ponavadi, kot če ne bi " +"uporabljal ukaza." msgid "me <action>: Send an IRC style action to a buddy or chat." -msgstr "me <dejanje>: Pošlji prijatelju ali klepetu dejanje v slogu IRC-a." +msgstr "" +"me <dejanje>: Pošlji prijatelju ali klepetu dejanje v slogu IRC-a." -msgid "debug <option>: Send various debug information to the current conversation." -msgstr "debug <možnost>: Trenutnim pomenkom pošlji različne informacije o razhroščevanju." +msgid "" +"debug <option>: Send various debug information to the current " +"conversation." +msgstr "" +"debug <možnost>: Trenutnim pomenkom pošlji različne informacije o " +"razhroščevanju." msgid "clear: Clears the conversation scrollback." msgstr "clear: Počisti izpisane replike pomenka." @@ -689,8 +734,18 @@ msgstr "prefs: Pokaži okno nastavitev." msgid "statuses: Show the savedstatuses window." msgstr "statuses: Pokaži okno savedstatuses." -msgid "msgcolor <class> <foreground> <background>: Set the color for different classes of messages in the conversation window.
    <class>: receive, send, highlight, action, timestamp
    <foreground/background>: black, red, green, blue, white, gray, darkgray, magenta, cyan, default

    EXAMPLE:
    msgcolor send cyan default" -msgstr "msgcolor <razred> <ospredje> <ozadje>: Nastavite barvo različnim razredom sporočil v oknu pogovora.
    <razred>: receive, send, highlight, action, timestamp
    <ospredje/ozadje>: black, red, green, blue, white, gray, darkgray, magenta, cyan, default

    PRIMER:
    msgcolor send cyan default" +msgid "" +"msgcolor <class> <foreground> <background>: Set the color " +"for different classes of messages in the conversation window.
    <" +"class>: receive, send, highlight, action, timestamp
    <foreground/" +"background>: black, red, green, blue, white, gray, darkgray, magenta, " +"cyan, default

    EXAMPLE:
    msgcolor send cyan default" +msgstr "" +"msgcolor <razred> <ospredje> <ozadje>: Nastavite barvo " +"različnim razredom sporočil v oknu pogovora.
    <razred>: receive, " +"send, highlight, action, timestamp
    <ospredje/ozadje>: black, " +"red, green, blue, white, gray, darkgray, magenta, cyan, " +"default

    PRIMER:
    msgcolor send cyan default" msgid "Unable to open file." msgstr "Datoteke ni bilo mogoče odprti." @@ -799,14 +854,25 @@ msgstr "Pomenek z %s o %s" msgid "%B %Y" msgstr "%B %Y" -msgid "System events will only be logged if the \"Log all status changes to system log\" preference is enabled." -msgstr "Sistemski dogodki bodo shranjeni, le če bo nastavljena možnost \"Omogoči sistemski dnevnik\"." +msgid "" +"System events will only be logged if the \"Log all status changes to system " +"log\" preference is enabled." +msgstr "" +"Sistemski dogodki bodo shranjeni, le če bo nastavljena možnost \"Omogoči " +"sistemski dnevnik\"." -msgid "Instant messages will only be logged if the \"Log all instant messages\" preference is enabled." -msgstr "Neposredna sporočila se bodo shranila, le če bo okljukana možnost \"Shranjuj vsa neposredna sporočila\"." +msgid "" +"Instant messages will only be logged if the \"Log all instant messages\" " +"preference is enabled." +msgstr "" +"Neposredna sporočila se bodo shranila, le če bo okljukana možnost \"Shranjuj " +"vsa neposredna sporočila\"." -msgid "Chats will only be logged if the \"Log all chats\" preference is enabled." -msgstr "Pomenki bodo shranjeni v dnevnik, ko je okljukana možnost \"Shranjuj vse pomenke\"." +msgid "" +"Chats will only be logged if the \"Log all chats\" preference is enabled." +msgstr "" +"Pomenki bodo shranjeni v dnevnik, ko je okljukana možnost \"Shranjuj vse " +"pomenke\"." msgid "No logs were found" msgstr "Ni najdenih dnevnikov." @@ -838,7 +904,6 @@ msgstr "Klicanje ..." msgid "Hangup" msgstr "Odloži" -#. Number of actions msgid "Accept" msgstr "Sprejmi" @@ -950,8 +1015,11 @@ msgstr "Napaka pri nalaganju vtičnika" msgid "The selected file is not a valid plugin." msgstr "Izbrana datoteka ni veljaven vtičnik." -msgid "Please open the debug window and try again to see the exact error message." -msgstr "Prosim, odprite okno razhroščevanja in poskusite znova, da vidite dejansko sporočilo o napaki." +msgid "" +"Please open the debug window and try again to see the exact error message." +msgstr "" +"Prosim, odprite okno razhroščevanja in poskusite znova, da vidite dejansko " +"sporočilo o napaki." msgid "Select plugin to install" msgstr "Izberite vtičnik za namestitev" @@ -1395,8 +1463,12 @@ msgstr "GntOdložišče" msgid "Clipboard plugin" msgstr "Vtičnik za odložišče" -msgid "When the gnt clipboard contents change, the contents are made available to X, if possible." -msgstr "Ko se spremeni vsebina odložišča gnt, je vsebina na voljo X-u, če je to le mogoče." +msgid "" +"When the gnt clipboard contents change, the contents are made available to " +"X, if possible." +msgstr "" +"Ko se spremeni vsebina odložišča gnt, je vsebina na voljo X-u, če je to le " +"mogoče." #, c-format msgid "%s just signed on" @@ -1455,11 +1527,14 @@ msgstr "Vtičnik za zgodovino zahteva beleženje v dnevnik" msgid "" "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)." +"Enabling logs for instant messages and/or chats will activate history for " +"the same conversation type(s)." msgstr "" -"Beleženje v dnevnik lahko omogočite v Orodja -> Nastavitve -> Beleženje v dnevnik.\n" +"Beleženje v dnevnik lahko omogočite v Orodja -> Nastavitve -> Beleženje v " +"dnevnik.\n" "\n" -"Omogočanje beleženja v dnevnik za neposredna sporočila in/ali klepete aktivira zgodovino za istovrstne pogovore." +"Omogočanje beleženja v dnevnik za neposredna sporočila in/ali klepete " +"aktivira zgodovino za istovrstne pogovore." msgid "GntHistory" msgstr "GntHistory" @@ -1467,8 +1542,11 @@ msgstr "GntHistory" msgid "Shows recently logged conversations in new conversations." msgstr "Prikaže nedavno zabeležene pogovore v novih pogovorih." -msgid "When a new conversation is opened this plugin will insert the last conversation into the current conversation." -msgstr "Ko je odprt nov pogovor, ta vtičnik vstavi zadnji pogovor v trenuten pogovor." +msgid "" +"When a new conversation is opened this plugin will insert the last " +"conversation into the current conversation." +msgstr "" +"Ko je odprt nov pogovor, ta vtičnik vstavi zadnji pogovor v trenuten pogovor." #, c-format msgid "" @@ -1613,23 +1691,41 @@ msgid "buddy list" msgstr "Seznam prijateljev" msgid "The certificate is self-signed and cannot be automatically checked." -msgstr "Predstavljeno digitalno potrdilo je samo-podpisano in ga samodejno ni mogoče preveriti." +msgstr "" +"Predstavljeno digitalno potrdilo je samo-podpisano in ga samodejno ni mogoče " +"preveriti." -msgid "The certificate is not trusted because no certificate that can verify it is currently trusted." -msgstr "Njihovo potrdilo ni zaupanja vredno, ker ni nobeno potrdilo, ki ga potrjuje, zaupanja vredno." +msgid "" +"The certificate is not trusted because no certificate that can verify it is " +"currently trusted." +msgstr "" +"Njihovo potrdilo ni zaupanja vredno, ker ni nobeno potrdilo, ki ga potrjuje, " +"zaupanja vredno." -msgid "The certificate is not valid yet. Check that your computer's date and time are accurate." -msgstr "Potrdilo še ni veljavno. Preverite, da sta datum in čas vašega sistema pravilno nastavljena." +msgid "" +"The certificate is not valid yet. Check that your computer's date and time " +"are accurate." +msgstr "" +"Potrdilo še ni veljavno. Preverite, da sta datum in čas vašega sistema " +"pravilno nastavljena." -msgid "The certificate has expired and should not be considered valid. Check that your computer's date and time are accurate." -msgstr "Potrdilo je poteklo in ne sme biti upoštevano kot veljavno. Preverite, da sta datum in čas vašega sistema pravilno nastavljena." +msgid "" +"The certificate has expired and should not be considered valid. Check that " +"your computer's date and time are accurate." +msgstr "" +"Potrdilo je poteklo in ne sme biti upoštevano kot veljavno. Preverite, da " +"sta datum in čas vašega sistema pravilno nastavljena." #. Translators: "domain" refers to a DNS domain (e.g. talk.google.com) msgid "The certificate presented is not issued to this domain." msgstr "Ponujeno digitalno potrdilo ni izdano za to domeno." -msgid "You have no database of root certificates, so this certificate cannot be validated." -msgstr "Nimate zbirke podatkov korenskih digitalnih potrdil, zato tega digitalnega potrdila ni mogoče preveriti." +msgid "" +"You have no database of root certificates, so this certificate cannot be " +"validated." +msgstr "" +"Nimate zbirke podatkov korenskih digitalnih potrdil, zato tega digitalnega " +"potrdila ni mogoče preveriti." msgid "The certificate chain presented is invalid." msgstr "Ponujena veriga digitalnih potrdil ni veljavna." @@ -1640,21 +1736,24 @@ msgstr "Digitalno potrdilo je bilo preklicano." msgid "An unknown certificate error occurred." msgstr "Prišlo je do neznane napake digitalnega potrdila." +#, fuzzy +msgid "(MATCH)" +msgstr "OPAZUJ" + msgid "(DOES NOT MATCH)" msgstr "(SE NE UJEMA)" -#. Make messages #, c-format msgid "%s has presented the following certificate for just-this-once use:" msgstr "%s je predstavil(a) naslednje digitalno potrdilo za enkratno uporabo:" -#, c-format -msgid "" -"Common name: %s %s\n" -"Fingerprint (SHA1): %s" +#, fuzzy, c-format +msgid "Common name: %s %s" msgstr "" -"Pogovorno ime: %s %s\n" -"Prstni odtis (SHA1): %s" +"Skupno ime: %s\n" +"\n" +"Prstni odtis SHA1:\n" +"%s" #. TODO: Find what the handle ought to be msgid "Single-use Certificate Verification" @@ -1670,7 +1769,6 @@ msgstr "Izdajatelji digitalnih potrdil" msgid "SSL Peers Cache" msgstr "Medpomnilnik vrstnikov SSL" -#. Make messages #, c-format msgid "Accept certificate for %s?" msgstr "Želite sprejeti digitalno potrdilo za %s?" @@ -1679,9 +1777,6 @@ msgstr "Želite sprejeti digitalno potrdilo za %s?" msgid "SSL Certificate Verification" msgstr "Preverjanje verodostojnosti digitalnega potrdila SSL" -msgid "_View Certificate..." -msgstr "_Pokaži digitalno potrdilo ..." - #, c-format msgid "The certificate for %s could not be validated." msgstr "Digitalnega potrdila za %s ni mogoče overiti." @@ -1694,30 +1789,13 @@ msgstr "Napaka digitalnega potrdila SSL" msgid "Unable to validate certificate" msgstr "Ni možno overiti digitalnega potrdila" -#, c-format -msgid "The certificate claims to be from \"%s\" instead. This could mean that you are not connecting to the service you believe you are." -msgstr "Predstavljeno digitalno potrdilo priča, da dejansko pripada \"%s\". To pomeni, da se ne povezujete s storitvijo, s katero mislite, da se." - -#. Make messages #, c-format msgid "" -"Common name: %s\n" -"\n" -"Fingerprint (SHA1): %s\n" -"\n" -"Activation date: %s\n" -"Expiration date: %s\n" +"The certificate claims to be from \"%s\" instead. This could mean that you " +"are not connecting to the service you believe you are." msgstr "" -"Splošno ime: %s\n" -"\n" -"Prstni odtis (SHA1): %s\n" -"\n" -"Datum aktivacije: %s\n" -"Rok veljavnosti: %s\n" - -#. TODO: Find what the handle ought to be -msgid "Certificate Information" -msgstr "Podatki o digitalnem potrdilu" +"Predstavljeno digitalno potrdilo priča, da dejansko pripada \"%s\". To " +"pomeni, da se ne povezujete s storitvijo, s katero mislite, da se." #. show error to user msgid "Registration Error" @@ -1786,8 +1864,12 @@ msgid "Invite to chat" msgstr "Povabi na klepet" #. Put our happy label in it. -msgid "Please enter the name of the user you wish to invite, along with an optional invite message." -msgstr "Prosim vnesite ime uporabnika, ki ga želite povabiti, dodate pa lahko še povabilo." +msgid "" +"Please enter the name of the user you wish to invite, along with an optional " +"invite message." +msgstr "" +"Prosim vnesite ime uporabnika, ki ga želite povabiti, dodate pa lahko še " +"povabilo." #, c-format msgid "Failed to get connection: %s" @@ -2015,32 +2097,67 @@ msgstr "Upravljač za URL-je \"xmpp" msgid "The handler for \"ymsgr\" URLs" msgstr "Upravljač za URL-je \"ymsgr" -msgid "True if the command specified in the \"command\" key should handle \"aim\" URLs." -msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"aim\"" +msgid "" +"True if the command specified in the \"command\" key should handle \"aim\" " +"URLs." +msgstr "" +"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" +"ji \"aim\"" -msgid "True if the command specified in the \"command\" key should handle \"gg\" URLs." -msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"gg\"" +msgid "" +"True if the command specified in the \"command\" key should handle \"gg\" " +"URLs." +msgstr "" +"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" +"ji \"gg\"" -msgid "True if the command specified in the \"command\" key should handle \"icq\" URLs." -msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"icq\"" +msgid "" +"True if the command specified in the \"command\" key should handle \"icq\" " +"URLs." +msgstr "" +"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" +"ji \"icq\"" -msgid "True if the command specified in the \"command\" key should handle \"irc\" URLs." -msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"irc\"" +msgid "" +"True if the command specified in the \"command\" key should handle \"irc\" " +"URLs." +msgstr "" +"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" +"ji \"irc\"" -msgid "True if the command specified in the \"command\" key should handle \"msnim\" URLs." -msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"msnim\"" +msgid "" +"True if the command specified in the \"command\" key should handle \"msnim\" " +"URLs." +msgstr "" +"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" +"ji \"msnim\"" -msgid "True if the command specified in the \"command\" key should handle \"sip\" URLs." -msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"sip\"" +msgid "" +"True if the command specified in the \"command\" key should handle \"sip\" " +"URLs." +msgstr "" +"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" +"ji \"sip\"" -msgid "True if the command specified in the \"command\" key should handle \"xmpp\" URLs." -msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"xmpp\"" +msgid "" +"True if the command specified in the \"command\" key should handle \"xmpp\" " +"URLs." +msgstr "" +"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" +"ji \"xmpp\"" -msgid "True if the command specified in the \"command\" key should handle \"ymsgr\" URLs." -msgstr "Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-ji \"ymsgr\"" +msgid "" +"True if the command specified in the \"command\" key should handle \"ymsgr\" " +"URLs." +msgstr "" +"Resnično, če naj navedeni ukaz v polju \"ukaz\" (\"command\") upravlja z URL-" +"ji \"ymsgr\"" -msgid "True if the command used to handle this type of URL should be run in a terminal." -msgstr "Resnično, če naj bo ukaz, ki naj ravna s to vrsto URL-ja, zagnan v konzoli." +msgid "" +"True if the command used to handle this type of URL should be run in a " +"terminal." +msgstr "" +"Resnično, če naj bo ukaz, ki naj ravna s to vrsto URL-ja, zagnan v konzoli." msgid "Whether the specified command should handle \"aim\" URLs" msgstr "Ali naj navedeni ukaz upravlja z URL-ji \"aim\"" @@ -2085,12 +2202,20 @@ msgid "XML" msgstr "XML" #, c-format -msgid "(%s) %s <AUTO-REPLY>: %s
    \n" -msgstr "(%s) %s <SAMODEJNI ODGOVOR>: %s
    \n" +msgid "" +"(%s) %s <AUTO-" +"REPLY>: %s
    \n" +msgstr "" +"(%s) %s <SAMODEJNI " +"ODGOVOR>: %s
    \n" #, c-format -msgid "(%s) %s <AUTO-REPLY>: %s
    \n" -msgstr "(%s) %s <SAMODEJNI ODGOVOR>: %s
    \n" +msgid "" +"(%s) %s <AUTO-" +"REPLY>: %s
    \n" +msgstr "" +"(%s) %s <SAMODEJNI " +"ODGOVOR>: %s
    \n" msgid "Unable to find log path!" msgstr "Ni mogoče najti poti do dnevnika!" @@ -2103,11 +2228,17 @@ msgstr "Ni mogoče brati datoteke: %s" msgid "(%s) %s : %s\n" msgstr "(%s) %s : %s\n" -msgid "No codecs found. Install some GStreamer codecs found in GStreamer plugins packages." -msgstr "Ni najdenih kodekov. Namestite nekaj kodekov GStreamer iz paketov vtičnikov GStreamer." +msgid "" +"No codecs found. Install some GStreamer codecs found in GStreamer plugins " +"packages." +msgstr "" +"Ni najdenih kodekov. Namestite nekaj kodekov GStreamer iz paketov vtičnikov " +"GStreamer." -msgid "No codecs left. Your codec preferences in fs-codecs.conf are too strict." -msgstr "Ni preostalih kodekov. Vaše nastavitve kodekov v fs-codecs.conf so prestroge." +msgid "" +"No codecs left. Your codec preferences in fs-codecs.conf are too strict." +msgstr "" +"Ni preostalih kodekov. Vaše nastavitve kodekov v fs-codecs.conf so prestroge." msgid "A non-recoverable Farsight2 error has occurred." msgstr "Prišlo je do napake Farsight2, od katere si ni mogoče opomoči." @@ -2140,12 +2271,19 @@ msgstr "Neustrezna %d vtičnika (potrebuje %d)" msgid "ABI version mismatch %d.%d.x (need %d.%d.x)" msgstr "Neustrezna različica ABI %d.%d.x (potrebna je %d.%d.x)" -msgid "Plugin does not implement all required functions (list_icon, login and close)" -msgstr "Vtičnik ne vsebuje implementacije vseh potrebnih funkcij (list_icon, login in close)" +msgid "" +"Plugin does not implement all required functions (list_icon, login and close)" +msgstr "" +"Vtičnik ne vsebuje implementacije vseh potrebnih funkcij (list_icon, login " +"in close)" #, c-format -msgid "The required plugin %s was not found. Please install this plugin and try again." -msgstr "Zahtevani dodatek %s ni bil najden. Prosim, namestite vtičnik in poskusite znova." +msgid "" +"The required plugin %s was not found. Please install this plugin and try " +"again." +msgstr "" +"Zahtevani dodatek %s ni bil najden. Prosim, namestite vtičnik in poskusite " +"znova." msgid "Unable to load the plugin" msgstr "Vtičnika ni mogoče naložiti" @@ -2169,7 +2307,8 @@ msgstr "Samodejno sprejmi zahtevo po prenosu datotek od izbranih uporabnikov." #, c-format msgid "Autoaccepted file transfer of \"%s\" from \"%s\" completed." -msgstr "Samodejno sprejeta zahteva po prenosu datoteke \"%s\" od \"%s\" zaključena." +msgstr "" +"Samodejno sprejeta zahteva po prenosu datoteke \"%s\" od \"%s\" zaključena." msgid "Autoaccept complete" msgstr "Samodejni sprejem dokončan" @@ -2218,7 +2357,8 @@ msgid "" "Notify with a popup when an autoaccepted file transfer is complete\n" "(only when there's no conversation with the sender)" msgstr "" -"Obvesti s pojavnim oknom, ko je zaključen samodejno sprejeti prenos datoteke\n" +"Obvesti s pojavnim oknom, ko je zaključen samodejno sprejeti prenos " +"datoteke\n" "(le če ni pomenka s pošiljateljem)" msgid "Create a new directory for each user" @@ -2254,7 +2394,8 @@ msgstr "Shrani opombe o določenih prijateljih." #. *< summary msgid "Adds the option to store notes for buddies on your buddy list." -msgstr "Doda možnost za shranjevanje zapiskov o prijateljih na seznamu prijateljev." +msgstr "" +"Doda možnost za shranjevanje zapiskov o prijateljih na seznamu prijateljev." #. *< type #. *< ui_requirement @@ -2362,8 +2503,12 @@ msgid "Test plugin IPC support, as a client." msgstr "Preskusite vtičnik s podporo IPC, kot odjemalec." #. * description -msgid "Test plugin IPC support, as a client. This locates the server plugin and calls the commands registered." -msgstr "Preskusite vtičnik s podporo IPC, kot odjemalec. Poišče strežniški vtičnik in kliče registrirane ukaze." +msgid "" +"Test plugin IPC support, as a client. This locates the server plugin and " +"calls the commands registered." +msgstr "" +"Preskusite vtičnik s podporo IPC, kot odjemalec. Poišče strežniški vtičnik " +"in kliče registrirane ukaze." # *< api_version # *< type @@ -2392,7 +2537,8 @@ msgstr "Preskusite vtičnik s podporo IPC, kot strežnik." #. * description msgid "Test plugin IPC support, as a server. This registers the IPC commands." -msgstr "Preskusite vtičnik s podporo IPC, kot strežnik. Ukazi IPC bodo registrirani." +msgstr "" +"Preskusite vtičnik s podporo IPC, kot strežnik. Ukazi IPC bodo registrirani." msgid "Hide Joins/Parts" msgstr "Skrij spoje/dele" @@ -2423,8 +2569,12 @@ msgid "Hides extraneous join/part messages." msgstr "Skrije odvečna sporočila o pridružitvi ali odhodu." #. * description -msgid "This plugin hides join/part messages in large rooms, except for those users actively taking part in a conversation." -msgstr "Ta vtičnik skrije sporočila o pridruževanju in odhajanju v velikih sobah, razen za tiste uporabnike, ki aktivno sodelujejo v klepetu." +msgid "" +"This plugin hides join/part messages in large rooms, except for those users " +"actively taking part in a conversation." +msgstr "" +"Ta vtičnik skrije sporočila o pridruževanju in odhajanju v velikih sobah, " +"razen za tiste uporabnike, ki aktivno sodelujejo v klepetu." #. This is used in the place of a timezone abbreviation if the #. * offset is way off. The user should never really see it, but @@ -2449,8 +2599,12 @@ msgstr "Eno ali več sporočil ni mogoče dostaviti." msgid "You were disconnected from the server." msgstr "Povezava s strežnikom je bila prekinjena." -msgid "You are currently disconnected. Messages will not be received unless you are logged in." -msgstr "Trenutno niste povezani. Sporočil ne boste mogli prejemati, dokler se ne povežete." +msgid "" +"You are currently disconnected. Messages will not be received unless you are " +"logged in." +msgstr "" +"Trenutno niste povezani. Sporočil ne boste mogli prejemati, dokler se ne " +"povežete." msgid "Message could not be sent because the maximum length was exceeded." msgstr "Sporočila ni mogoče poslati, saj je presežena največja dolžina." @@ -2527,17 +2681,24 @@ msgstr "Ogledovalnik dnevnika" #. *< version #. * summary msgid "Includes other IM clients' logs in the log viewer." -msgstr "Vključi dnevnike drugih odjemalcev neposrednih sporočil v ogledovalnik dnevnika." +msgstr "" +"Vključi dnevnike drugih odjemalcev neposrednih sporočil v ogledovalnik " +"dnevnika." #. * description msgid "" -"When viewing logs, this plugin will include logs from other IM clients. Currently, this includes Adium, MSN Messenger, aMSN, and Trillian.\n" +"When viewing logs, this plugin will include logs from other IM clients. " +"Currently, this includes Adium, MSN Messenger, aMSN, and Trillian.\n" "\n" -"WARNING: This plugin is still alpha code and may crash frequently. Use it at your own risk!" +"WARNING: This plugin is still alpha code and may crash frequently. Use it " +"at your own risk!" msgstr "" -"Pri ogledovanju dnevnikov bo ta vtičnik vključil dnevnike drugih odjemalcev neposrednih sporočil. To trenutno obsega Adium, MSN Messenger, aMSN in Trillian.\n" +"Pri ogledovanju dnevnikov bo ta vtičnik vključil dnevnike drugih odjemalcev " +"neposrednih sporočil. To trenutno obsega Adium, MSN Messenger, aMSN in " +"Trillian.\n" "\n" -"OPOZORILO: Ta vtičnik je še vedno v fazi alfa in se lahko pogosto sesuje. Uporaba na lastno odgovornost!" +"OPOZORILO: Ta vtičnik je še vedno v fazi alfa in se lahko pogosto sesuje. " +"Uporaba na lastno odgovornost!" msgid "Mono Plugin Loader" msgstr "Nalaganje vtičnikov Mono" @@ -2569,8 +2730,12 @@ msgid "Prepends a newline to displayed message." msgstr "Prikazanemu sporočilu na začetek pripne prazno vrstico." #. *< summary -msgid "Prepends a newline to messages so that the rest of the message appears below the username in the conversation window." -msgstr "Sporočilom na začetek doda prazno vrstico, tako da se preostanek sporočila v oknu pogovora izpiše pod uporabniškim imenom." +msgid "" +"Prepends a newline to messages so that the rest of the message appears below " +"the username in the conversation window." +msgstr "" +"Sporočilom na začetek doda prazno vrstico, tako da se preostanek sporočila v " +"oknu pogovora izpiše pod uporabniškim imenom." msgid "Offline Message Emulation" msgstr "Emulacija nepovezovalnega sporočila" @@ -2578,18 +2743,27 @@ msgstr "Emulacija nepovezovalnega sporočila" msgid "Save messages sent to an offline user as pounce." msgstr "Shrani sporočila, poslana neprijavljenemu uporabniku, kot opozorilo." -msgid "The rest of the messages will be saved as pounces. You can edit/delete the pounce from the `Buddy Pounce' dialog." -msgstr "Preostanek sporočil bo shranjen kot opozorila. Opozorilo lahko uredite/izbrišete s pogovornim oknom `Opozorilo prijatelja'." +msgid "" +"The rest of the messages will be saved as pounces. You can edit/delete the " +"pounce from the `Buddy Pounce' dialog." +msgstr "" +"Preostanek sporočil bo shranjen kot opozorila. Opozorilo lahko uredite/" +"izbrišete s pogovornim oknom `Opozorilo prijatelja'." #, c-format -msgid "\"%s\" is currently offline. Do you want to save the rest of the messages in a pounce and automatically send them when \"%s\" logs back in?" -msgstr "\"%s\" trenutno ni povezan. Želite shraniti preostanek sporočil v opozorilo in jih samodejno poslati, ko se \"%s\" znova prijavi?" +msgid "" +"\"%s\" is currently offline. Do you want to save the rest of the messages in " +"a pounce and automatically send them when \"%s\" logs back in?" +msgstr "" +"\"%s\" trenutno ni povezan. Želite shraniti preostanek sporočil v opozorilo " +"in jih samodejno poslati, ko se \"%s\" znova prijavi?" msgid "Offline Message" msgstr "Brezpovezavno sporočilo" msgid "You can edit/delete the pounce from the `Buddy Pounces' dialog" -msgstr "Opozorilo lahko uredite/izbrišete v pogovornem oknu `Opozorila prijateljev'" +msgstr "" +"Opozorilo lahko uredite/izbrišete v pogovornem oknu `Opozorila prijateljev'" msgid "Yes" msgstr "Da" @@ -2623,10 +2797,12 @@ msgstr "Vsilite, da se gesla uporabijo le enkrat." #. * description msgid "" -"Allows you to enforce on a per-account basis that passwords not being saved are only used in a single successful connection.\n" +"Allows you to enforce on a per-account basis that passwords not being saved " +"are only used in a single successful connection.\n" "Note: The account password must not be saved for this to work." msgstr "" -"Omogoča, da vsilite (posebej za vsak račun), da so neshranjena gesla uporabljena le za posamezno uspešno povezavo.\n" +"Omogoča, da vsilite (posebej za vsak račun), da so neshranjena gesla " +"uporabljena le za posamezno uspešno povezavo.\n" "Opomba: Geslo računa ni potrebno shraniti, da bi to delovalo." #. *< type @@ -2650,8 +2826,12 @@ msgstr "Telepatski način" msgid "Psychic mode for incoming conversation" msgstr "Telepatski način za dohodne pogovore" -msgid "Causes conversation windows to appear as other users begin to message you. This works for AIM, ICQ, XMPP, Sametime, and Yahoo!" -msgstr "Povzroči pojavitev pogovornih oken, ko vam začnejo drugi uporabniki sporočati. To deluje za AIM, ICQ, XMPP, Sametime in Yahoo!" +msgid "" +"Causes conversation windows to appear as other users begin to message you. " +"This works for AIM, ICQ, XMPP, Sametime, and Yahoo!" +msgstr "" +"Povzroči pojavitev pogovornih oken, ko vam začnejo drugi uporabniki " +"sporočati. To deluje za AIM, ICQ, XMPP, Sametime in Yahoo!" msgid "You feel a disturbance in the force..." msgstr "Občutite motnjo v Sili (saj veste, Vojna zvezd) ..." @@ -2700,6 +2880,23 @@ msgstr "Enostavni vtičnik" msgid "Tests to see that most things are working." msgstr "Preveri večino stvari, če delujejo." +#. Make messages +#, c-format +msgid "" +"Common name: %s\n" +"\n" +"Fingerprint (SHA1): %s\n" +"\n" +"Activation date: %s\n" +"Expiration date: %s\n" +msgstr "" +"Splošno ime: %s\n" +"\n" +"Prstni odtis (SHA1): %s\n" +"\n" +"Datum aktivacije: %s\n" +"Rok veljavnosti: %s\n" + #. Scheme name msgid "X.509 Certificates" msgstr "Digitalna potrdila X.509" @@ -2797,7 +2994,9 @@ msgstr "Obvestila o stanjih prijateljev" #. *< version #. * summary #. * description -msgid "Notifies in a conversation window when a buddy goes or returns from away or idle." +msgid "" +"Notifies in a conversation window when a buddy goes or returns from away or " +"idle." msgstr "V pogovornem oknu obvešča o spremembah stanja vaših prijateljev." msgid "Tcl Plugin Loader" @@ -2806,17 +3005,29 @@ msgstr "Nalaganje vtičnikov Tcl" msgid "Provides support for loading Tcl plugins" msgstr "Omogoča podporo nalaganja vtičnikov Tcl" -msgid "Unable to detect ActiveTCL installation. If you wish to use TCL plugins, install ActiveTCL from http://www.activestate.com\n" -msgstr "Namestitve ActiveTCL ni mogoče najti. Če želite uporabljati vtičnike TCL, namestite ActiveTCL z naslova http://www.activestate.com\n" +msgid "" +"Unable to detect ActiveTCL installation. If you wish to use TCL plugins, " +"install ActiveTCL from http://www.activestate.com\n" +msgstr "" +"Namestitve ActiveTCL ni mogoče najti. Če želite uporabljati vtičnike TCL, " +"namestite ActiveTCL z naslova http://www.activestate.com\n" -msgid "Unable to find Apple's \"Bonjour for Windows\" toolkit, see http://d.pidgin.im/BonjourWindows for more information." -msgstr "Paketa orodij podjetja Apple \"Bonjour for Windows\" ni mogoče najti, oglejte si zapis na naslovu http://d.pidgin.im/BonjourWindows - kjer najdete več podrobnosti." +msgid "" +"Unable to find Apple's \"Bonjour for Windows\" toolkit, see http://d.pidgin." +"im/BonjourWindows for more information." +msgstr "" +"Paketa orodij podjetja Apple \"Bonjour for Windows\" ni mogoče najti, " +"oglejte si zapis na naslovu http://d.pidgin.im/BonjourWindows - kjer najdete " +"več podrobnosti." msgid "Unable to listen for incoming IM connections" msgstr "Dohodnim povezavam IM ni mogoče prisluhniti" -msgid "Unable to establish connection with the local mDNS server. Is it running?" -msgstr "Povezave s krajevnim strežnikom mDNS ni mogoče vzpostaviti. Ali je strežnik sploh zagnan?" +msgid "" +"Unable to establish connection with the local mDNS server. Is it running?" +msgstr "" +"Povezave s krajevnim strežnikom mDNS ni mogoče vzpostaviti. Ali je strežnik " +"sploh zagnan?" #. TODO: Check whether it's correct to call add_pair_html, #. or if we should be using add_pair_plaintext @@ -2880,8 +3091,12 @@ msgstr "Napaka pri komunikaciji s krajevnim mDNSReponderjem." msgid "Invalid proxy settings" msgstr "Neveljavne nastavitve posredovalnega strežnika" -msgid "Either the host name or port number specified for your given proxy type is invalid." -msgstr "Bodisi ime strežnika bodisi vrata, ki ste ju navedli za posredovalni strežnik, so neveljavna." +msgid "" +"Either the host name or port number specified for your given proxy type is " +"invalid." +msgstr "" +"Bodisi ime strežnika bodisi vrata, ki ste ju navedli za posredovalni " +"strežnik, so neveljavna." msgid "Token Error" msgstr "Napaka žetona" @@ -2924,7 +3139,8 @@ msgid "Passwords do not match" msgstr "Gesli se ne ujemata" msgid "Unable to register new account. An unknown error occurred." -msgstr "Novega računa ni bilo mogoče registrirati. Prišlo je do neznane napake." +msgstr "" +"Novega računa ni bilo mogoče registrirati. Prišlo je do neznane napake." msgid "New Gadu-Gadu Account Registered" msgstr "Nov račun Gadu-Gadu je registriran" @@ -3129,7 +3345,9 @@ msgstr "Neveljavno geslo" msgid "SSL Connection Failed" msgstr "Povezava SSL ni uspela" -msgid "Your account has been disabled because too many incorrect passwords were entered" +msgid "" +"Your account has been disabled because too many incorrect passwords were " +"entered" msgstr "Vaš račun je bil onemogočen, ker ste vnesli preveč napačnih gesel" msgid "Service temporarily unavailable" @@ -3459,11 +3677,19 @@ msgstr "način (%s %s) nastavil %s" msgid "Invalid nickname" msgstr "Neveljaven vzdevek" -msgid "Your selected nickname was rejected by the server. It probably contains invalid characters." -msgstr "Vaš izbrani vzdevek je strežnik zavrnil. Najverjetneje vsebuje neveljavne znake." +msgid "" +"Your selected nickname was rejected by the server. It probably contains " +"invalid characters." +msgstr "" +"Vaš izbrani vzdevek je strežnik zavrnil. Najverjetneje vsebuje neveljavne " +"znake." -msgid "Your selected account name was rejected by the server. It probably contains invalid characters." -msgstr "Vaše izbrano ime računa je strežnik zavrnil. Najverjetneje vsebuje neveljavne znake." +msgid "" +"Your selected account name was rejected by the server. It probably contains " +"invalid characters." +msgstr "" +"Vaše izbrano ime računa je strežnik zavrnil. Najverjetneje vsebuje " +"neveljavne znake." #. We only want to do the following dance if the connection #. has not been successfully completed. If it has, just @@ -3512,8 +3738,12 @@ msgstr "action <dejanje za izvedbo>: Izvedi dejanje." msgid "authserv: Send a command to authserv" msgstr "authserv: pošlji ukaz authserv-u" -msgid "away [message]: Set an away message, or use no message to return from being away." -msgstr "odsoten [sporočilo]: Nastavite sporočilo za odsotnost ali ne uporabite sporočila za vrnitev iz odsotnosti." +msgid "" +"away [message]: Set an away message, or use no message to return from being " +"away." +msgstr "" +"odsoten [sporočilo]: Nastavite sporočilo za odsotnost ali ne uporabite " +"sporočila za vrnitev iz odsotnosti." msgid "ctcp : sends ctcp msg to nick." msgstr "ctcp : pošlje sporočilo ctcp vzdevku." @@ -3521,26 +3751,56 @@ msgstr "ctcp : pošlje sporočilo ctcp vzdevku." msgid "chanserv: Send a command to chanserv" msgstr "chanserv: pošlji ukaz chanservu" -msgid "deop <nick1> [nick2] ...: Remove channel operator status from someone. You must be a channel operator to do this." -msgstr "deop <vzdevek1> [vzdevek2] ...: Odstrani status operaterja kanala nekomu. Za to dejanje morate biti operater kanala." +msgid "" +"deop <nick1> [nick2] ...: Remove channel operator status from " +"someone. You must be a channel operator to do this." +msgstr "" +"deop <vzdevek1> [vzdevek2] ...: Odstrani status operaterja kanala " +"nekomu. Za to dejanje morate biti operater kanala." -msgid "devoice <nick1> [nick2] ...: Remove channel voice status from someone, preventing them from speaking if the channel is moderated (+m). You must be a channel operator to do this." -msgstr "devoice <nick1> [nick2] ...: Odstrani glasovni status kanala nekomu, kar mu bo preprečilo oglašanje, ko je kanal moderiran (+m). Za to dejanje morate biti operater kanala." +msgid "" +"devoice <nick1> [nick2] ...: Remove channel voice status from " +"someone, preventing them from speaking if the channel is moderated (+m). You " +"must be a channel operator to do this." +msgstr "" +"devoice <nick1> [nick2] ...: Odstrani glasovni status kanala nekomu, " +"kar mu bo preprečilo oglašanje, ko je kanal moderiran (+m). Za to dejanje " +"morate biti operater kanala." -msgid "invite <nick> [room]: Invite someone to join you in the specified channel, or the current channel." -msgstr "invite <vzdevek> [soba]: Povabite nekoga, da se vam pridruži v navedenem ali trenutnem kanalu." +msgid "" +"invite <nick> [room]: Invite someone to join you in the specified " +"channel, or the current channel." +msgstr "" +"invite <vzdevek> [soba]: Povabite nekoga, da se vam pridruži v " +"navedenem ali trenutnem kanalu." -msgid "j <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more channels, optionally providing a channel key for each if needed." -msgstr "j <soba1>[,soba2][,...] [ključ1[,ključ2][,...]]: Vnesite enega ali več kanalov, za ketere lahko po želji navedete tudi ključe." +msgid "" +"j <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more " +"channels, optionally providing a channel key for each if needed." +msgstr "" +"j <soba1>[,soba2][,...] [ključ1[,ključ2][,...]]: Vnesite enega ali " +"več kanalov, za ketere lahko po želji navedete tudi ključe." -msgid "join <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more channels, optionally providing a channel key for each if needed." -msgstr "join <soba1>[,soba2][,...] [ključ1[,ključ2][,...]]: Vnesite enega ali več kanalov, za ketere lahko po želji navedete tudi ključe." +msgid "" +"join <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more " +"channels, optionally providing a channel key for each if needed." +msgstr "" +"join <soba1>[,soba2][,...] [ključ1[,ključ2][,...]]: Vnesite enega ali " +"več kanalov, za ketere lahko po želji navedete tudi ključe." -msgid "kick <nick> [message]: Remove someone from a channel. You must be a channel operator to do this." -msgstr "kick <vzdevek> [sporočilo]: Odstranite nekoga iz kanala. Za to dejanje morate biti operater kanala." +msgid "" +"kick <nick> [message]: Remove someone from a channel. You must be a " +"channel operator to do this." +msgstr "" +"kick <vzdevek> [sporočilo]: Odstranite nekoga iz kanala. Za to " +"dejanje morate biti operater kanala." -msgid "list: Display a list of chat rooms on the network. Warning, some servers may disconnect you upon doing this." -msgstr "list: Prikaži seznam pogovornih sob v omrežju. Opozorilo: nekateri strežniki vas lahko med tem odklopijo." +msgid "" +"list: Display a list of chat rooms on the network. Warning, some servers " +"may disconnect you upon doing this." +msgstr "" +"list: Prikaži seznam pogovornih sob v omrežju. Opozorilo: nekateri " +"strežniki vas lahko med tem odklopijo." msgid "me <action to perform>: Perform an action." msgstr "me <dejanje za izvedbo>: Izvedi dejanje." @@ -3548,11 +3808,19 @@ msgstr "me <dejanje za izvedbo>: Izvedi dejanje." msgid "memoserv: Send a command to memoserv" msgstr "memoserv: Pošlji ukaz memoservu" -msgid "mode <+|-><A-Za-z> <nick|channel>: Set or unset a channel or user mode." -msgstr "mode <+|-><A-Za-z> <vzdevek|kanal>: Nastavi ali razveljavi način uporabnika ali kanala." +msgid "" +"mode <+|-><A-Za-z> <nick|channel>: Set or unset a channel " +"or user mode." +msgstr "" +"mode <+|-><A-Za-z> <vzdevek|kanal>: Nastavi ali " +"razveljavi način uporabnika ali kanala." -msgid "msg <nick> <message>: Send a private message to a user (as opposed to a channel)." -msgstr "msg <vzdevek> <sporočilo>: Pošlji zasebno sporočilo uporabniku (za razliko od kanala)." +msgid "" +"msg <nick> <message>: Send a private message to a user (as " +"opposed to a channel)." +msgstr "" +"msg <vzdevek> <sporočilo>: Pošlji zasebno sporočilo uporabniku " +"(za razliko od kanala)." msgid "names [channel]: List the users currently in a channel." msgstr "names [kanal]: Seznam uporabnikov, ki so trenutno na kanalu." @@ -3566,32 +3834,57 @@ msgstr "nickserv: pošlji ukaz nickservu" msgid "notice <target<: Send a notice to a user or channel." msgstr "notice <cilj>: Pošlji uporabniku ali kanalu opozorilo." -msgid "op <nick1> [nick2] ...: Grant channel operator status to someone. You must be a channel operator to do this." -msgstr "op <vzdevek1> [vzdevek2] ...: Podelite status operaterja kanala nekomu. Za to dejanje morate biti operater kanala." +msgid "" +"op <nick1> [nick2] ...: Grant channel operator status to someone. You " +"must be a channel operator to do this." +msgstr "" +"op <vzdevek1> [vzdevek2] ...: Podelite status operaterja kanala " +"nekomu. Za to dejanje morate biti operater kanala." -msgid "operwall <message>: If you don't know what this is, you probably can't use it." -msgstr "operwall <sporočilo>: Če ne veste, kaj je to, tega verjetno ne morete uporabiti." +msgid "" +"operwall <message>: If you don't know what this is, you probably " +"can't use it." +msgstr "" +"operwall <sporočilo>: Če ne veste, kaj je to, tega verjetno ne morete " +"uporabiti." msgid "operserv: Send a command to operserv" msgstr "operserv: pošlji ukaz operservu" -msgid "part [room] [message]: Leave the current channel, or a specified channel, with an optional message." -msgstr "part [soba] [sporočilo]: Zapusti trenutni ali določen kanal z možnostjo sporočila." +msgid "" +"part [room] [message]: Leave the current channel, or a specified channel, " +"with an optional message." +msgstr "" +"part [soba] [sporočilo]: Zapusti trenutni ali določen kanal z možnostjo " +"sporočila." -msgid "ping [nick]: Asks how much lag a user (or the server if no user specified) has." -msgstr "ping [vzdevek]: Vpraša koliko zaostanka ima uporabnik (ali strežnik, če uporabnik ni naveden)." +msgid "" +"ping [nick]: Asks how much lag a user (or the server if no user specified) " +"has." +msgstr "" +"ping [vzdevek]: Vpraša koliko zaostanka ima uporabnik (ali strežnik, če " +"uporabnik ni naveden)." -msgid "query <nick> <message>: Send a private message to a user (as opposed to a channel)." -msgstr "query <vzdevek> <sporočilo>: Pošlji zasebno sporočilo uporabniku (za razliko od kanala)." +msgid "" +"query <nick> <message>: Send a private message to a user (as " +"opposed to a channel)." +msgstr "" +"query <vzdevek> <sporočilo>: Pošlji zasebno sporočilo " +"uporabniku (za razliko od kanala)." msgid "quit [message]: Disconnect from the server, with an optional message." -msgstr "quit [sporočilo]: Prekinitev povezave s strežnikom z možnostjo sporočila." +msgstr "" +"quit [sporočilo]: Prekinitev povezave s strežnikom z možnostjo sporočila." msgid "quote [...]: Send a raw command to the server." msgstr "quote [...]: Pošlji surov ukaz strežniku." -msgid "remove <nick> [message]: Remove someone from a room. You must be a channel operator to do this." -msgstr "remove <vzdevek> [sporočilo]: Odstrani nekoga iz sobe. Za to dejanje morate biti operater kanala." +msgid "" +"remove <nick> [message]: Remove someone from a room. You must be a " +"channel operator to do this." +msgstr "" +"remove <vzdevek> [sporočilo]: Odstrani nekoga iz sobe. Za to dejanje " +"morate biti operater kanala." msgid "time: Displays the current local time at the IRC server." msgstr "time: Prikaže trenutni krajevni čas na strežniku IRC." @@ -3600,22 +3893,32 @@ msgid "topic [new topic]: View or change the channel topic." msgstr "topic [nova tema]: Oglejte si ali zamenjajte temo kanala." msgid "umode <+|-><A-Za-z>: Set or unset a user mode." -msgstr "umode <+|-><A-Za-z>: Nastavi ali odvzemi način uporabnika." +msgstr "" +"umode <+|-><A-Za-z>: Nastavi ali odvzemi način uporabnika." msgid "version [nick]: send CTCP VERSION request to a user" msgstr "version [vzdevek]: pošlji zahtevo CTCP VERSION uporabniku" -msgid "voice <nick1> [nick2] ...: Grant channel voice status to someone. You must be a channel operator to do this." -msgstr "voice <vzdevek1> [vzdevek2] ...: Podelite status operaterja kanala nekomu. Za to dejanje morate biti operater kanala." +msgid "" +"voice <nick1> [nick2] ...: Grant channel voice status to someone. You " +"must be a channel operator to do this." +msgstr "" +"voice <vzdevek1> [vzdevek2] ...: Podelite status operaterja kanala " +"nekomu. Za to dejanje morate biti operater kanala." -msgid "wallops <message>: If you don't know what this is, you probably can't use it." -msgstr "wallops <sporočilo>: Če ne veste, kaj je to, tega verjetno ne morete uporabiti." +msgid "" +"wallops <message>: If you don't know what this is, you probably can't " +"use it." +msgstr "" +"wallops <sporočilo>: Če ne veste, kaj je to, tega verjetno ne morete " +"uporabiti." msgid "whois [server] <nick>: Get information on a user." msgstr "whois [strežnik] <vzdevek>: Dobi več informacij o uporabniku." msgid "whowas <nick>: Get information on a user that has logged off." -msgstr "whois <vzdevek>: Dobi več informacij o uporabniku, ki se je odjavil." +msgstr "" +"whois <vzdevek>: Dobi več informacij o uporabniku, ki se je odjavil." #, c-format msgid "Reply time from %s: %lu seconds" @@ -3640,7 +3943,8 @@ msgid "execute" msgstr "izvedi" msgid "Server requires plaintext authentication over an unencrypted stream" -msgstr "Strežnik zahteva overovitev z navadnim besedilom preko nešifriranega toka" +msgstr "" +"Strežnik zahteva overovitev z navadnim besedilom preko nešifriranega toka" #. This happens when the server sends back jibberish #. * in the "additional data with success" case. @@ -3653,8 +3957,12 @@ msgid "Server does not use any supported authentication method" msgstr "Strežnik ne uporablja nobene podprte metode overovitve" #, c-format -msgid "%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?" -msgstr "%s zahteva overovitev z navadnim besedilom preko nešifrirane povezave. Se strinjate s tem in želite nadaljevati z overovitvijo?" +msgid "" +"%s requires plaintext authentication over an unencrypted connection. Allow " +"this and continue authentication?" +msgstr "" +"%s zahteva overovitev z navadnim besedilom preko nešifrirane povezave. Se " +"strinjate s tem in želite nadaljevati z overovitvijo?" msgid "Plaintext Authentication" msgstr "Overovitev z navadnim besedilom" @@ -3669,11 +3977,17 @@ msgid "Server thinks authentication is complete, but client does not" msgstr "Strežnik meni, da je overovitev dokončana, odjemalec pa ne" msgid "Server may require plaintext authentication over an unencrypted stream" -msgstr "Strežnik lahko zahteva overovitev z navadnim besedilom preko nešifriranega toka" +msgstr "" +"Strežnik lahko zahteva overovitev z navadnim besedilom preko nešifriranega " +"toka" #, c-format -msgid "%s may require plaintext authentication over an unencrypted connection. Allow this and continue authentication?" -msgstr "%s lahko zahteva overovitev z navadnim besedilom preko nešifrirane povezave. Se strinjate s tem in želite nadaljevati z overovitvijo?" +msgid "" +"%s may require plaintext authentication over an unencrypted connection. " +"Allow this and continue authentication?" +msgstr "" +"%s lahko zahteva overovitev z navadnim besedilom preko nešifrirane povezave. " +"Se strinjate s tem in želite nadaljevati z overovitvijo?" msgid "SASL authentication failed" msgstr "Overovitev SASL ni uspela" @@ -3688,11 +4002,17 @@ msgstr "Neveljavno kodiranje" msgid "Unsupported Extension" msgstr "Nepodprta razširitev" -msgid "Unexpected response from the server. This may indicate a possible MITM attack" +msgid "" +"Unexpected response from the server. This may indicate a possible MITM " +"attack" msgstr "Nepričakovan odgovor strežnika. To nakazuje možen napad MITM." -msgid "The server does support channel binding, but did not appear to advertise it. This indicates a likely MITM attack" -msgstr "Strežnik podpira spajanje kanalov, vendar se ni zdelo, da ga oglašuje. To nakazuje možen napad MITM." +msgid "" +"The server does support channel binding, but did not appear to advertise " +"it. This indicates a likely MITM attack" +msgstr "" +"Strežnik podpira spajanje kanalov, vendar se ni zdelo, da ga oglašuje. To " +"nakazuje možen napad MITM." msgid "Server does not support channel binding" msgstr "Strežnik ne podpira spajanja kanalov" @@ -3805,7 +4125,9 @@ msgstr "Opis" msgid "Edit XMPP vCard" msgstr "Uredi vCard za XMPP" -msgid "All items below are optional. Enter only the information with which you feel comfortable." +msgid "" +"All items below are optional. Enter only the information with which you feel " +"comfortable." msgstr "Vsa spodnja polja so izbirna. Vnesite samo informacije, ki jih želite." #. TODO: Check whether it's correct to call prepend_pair_html, @@ -3855,8 +4177,12 @@ msgid "Logo" msgstr "Logotip" #, c-format -msgid "%s will no longer be able to see your status updates. Do you want to continue?" -msgstr "Oseba %s ne bo več mogla videti posodobitev vašega stanja. Ali želite nadaljevati?" +msgid "" +"%s will no longer be able to see your status updates. Do you want to " +"continue?" +msgstr "" +"Oseba %s ne bo več mogla videti posodobitev vašega stanja. Ali želite " +"nadaljevati?" msgid "Cancel Presence Notification" msgstr "Prekliči obvestilo o prisotnosti" @@ -3895,8 +4221,12 @@ msgid "The following are the results of your search" msgstr "To so rezultati vašega iskanja" #. current comment from Jabber User Directory users.jabber.org -msgid "Find a contact by entering the search criteria in the given fields. Note: Each field supports wild card searches (%)" -msgstr "Najdi stik z vnosom iskalnih kriterijev v dana polja. Opomba: vsa polja dovoljujejo iskanje z nadomestnimi znaki (%)." +msgid "" +"Find a contact by entering the search criteria in the given fields. Note: " +"Each field supports wild card searches (%)" +msgstr "" +"Najdi stik z vnosom iskalnih kriterijev v dana polja. Opomba: vsa polja " +"dovoljujejo iskanje z nadomestnimi znaki (%)." msgid "Directory Query Failed" msgstr "Povpraševanje po imeniku ni uspelo" @@ -4005,7 +4335,9 @@ msgid "Roles:" msgstr "Vloge:" msgid "Server requires TLS/SSL, but no TLS/SSL support was found." -msgstr "Strežnik zahteva TLS/SSL za prijavo, vendar odpore za TLS/SSL ni mogoče najti." +msgstr "" +"Strežnik zahteva TLS/SSL za prijavo, vendar odpore za TLS/SSL ni mogoče " +"najti." msgid "You require encryption, but no TLS/SSL support was found." msgstr "Vi zahtevate šifriranje, podpore za TLS/SSL pa ni mogoče najti." @@ -4067,8 +4399,10 @@ msgstr "Že registriran" msgid "Unregister" msgstr "Odregistriraj se" -msgid "Please fill out the information below to change your account registration." -msgstr "Za spremembo registracije svojega računa morate izpolniti spodnja polja." +msgid "" +"Please fill out the information below to change your account registration." +msgstr "" +"Za spremembo registracije svojega računa morate izpolniti spodnja polja." msgid "Please fill out the information below to register your new account." msgstr "Za registracijo novega računa morate izpolniti spodnja polja." @@ -4397,8 +4731,12 @@ msgid "Unable to buzz, because %s might be offline." msgstr "Ni mogoče stresti, saj je oseba %s morda nepovezana." #, c-format -msgid "Unable to buzz, because %s does not support it or does not wish to receive buzzes now." -msgstr "Osebe %s ni mogoče stresti, ker tega dejanja ne podpira ali zdaj ne želi prejemati tresenja." +msgid "" +"Unable to buzz, because %s does not support it or does not wish to receive " +"buzzes now." +msgstr "" +"Osebe %s ni mogoče stresti, ker tega dejanja ne podpira ali zdaj ne želi " +"prejemati tresenja." #. Yahoo only supports one attention command: the 'buzz'. #. This is index number YAHOO_BUZZ. @@ -4423,13 +4761,16 @@ msgstr "Medija z %s ni mogoče iniciirati: uporabnik ni povezan" #, c-format msgid "Unable to initiate media with %s: not subscribed to user presence" -msgstr "Medija %s ni mogoče iniciirati: niste naročeni na stanja prisotnosti osebe" +msgstr "" +"Medija %s ni mogoče iniciirati: niste naročeni na stanja prisotnosti osebe" msgid "Media Initiation Failed" msgstr "Iniciacija medija ni uspela" #, c-format -msgid "Please select the resource of %s with which you would like to start a media session." +msgid "" +"Please select the resource of %s with which you would like to start a media " +"session." msgstr "Izberite vir %s, s katerim bi radi začeli medijsko sejo." msgid "Select a Resource" @@ -4459,11 +4800,19 @@ msgstr "topic [nova tema]: Oglej si ali spremeni temo." msgid "ban <user> [reason]: Ban a user from the room." msgstr "ban <uporabnik> [razlog]: Prepovej uporabnika v sobi." -msgid "affiliate <owner|admin|member|outcast|none> [nick1] [nick2] ...: Get the users with an affiliation or set users' affiliation with the room." -msgstr "affiliate <owner|admin|member|outcast|none> [vzdevek1] [vzdevek2] ...: Pridobi navezavo uporabnikov ali nastavi navezavo uporabnikov na sobo." +msgid "" +"affiliate <owner|admin|member|outcast|none> [nick1] [nick2] ...: Get " +"the users with an affiliation or set users' affiliation with the room." +msgstr "" +"affiliate <owner|admin|member|outcast|none> [vzdevek1] [vzdevek2] ...: " +"Pridobi navezavo uporabnikov ali nastavi navezavo uporabnikov na sobo." -msgid "role <moderator|participant|visitor|none> [nick1] [nick2] ...: Get the users with a role or set users' role with the room." -msgstr "role <moderator|participant|visitor|none> [vzdevek1] [vzdevek2] ...: Pridobi uporabnike z vlogo ali nastavi vlogo uporabnikov v sobi." +msgid "" +"role <moderator|participant|visitor|none> [nick1] [nick2] ...: Get the " +"users with a role or set users' role with the room." +msgstr "" +"role <moderator|participant|visitor|none> [vzdevek1] [vzdevek2] ...: " +"Pridobi uporabnike z vlogo ali nastavi vlogo uporabnikov v sobi." msgid "invite <user> [message]: Invite a user to the room." msgstr "invite <uporabnik> [sporočilo]: Povabite uporabnika v sobo." @@ -4474,8 +4823,11 @@ msgstr "join: <soba[@strežnik]> [geslo]: Pridruži se pomenku." msgid "kick <user> [reason]: Kick a user from the room." msgstr "kick <uporabnik> [razlog]: Brcni uporabnika iz sobe." -msgid "msg <user> <message>: Send a private message to another user." -msgstr "msg <uporabnik> <sporočilo>: Pošljite zasebno sporočilo drugemu uporabniku." +msgid "" +"msg <user> <message>: Send a private message to another user." +msgstr "" +"msg <uporabnik> <sporočilo>: Pošljite zasebno sporočilo drugemu " +"uporabniku." msgid "ping <jid>:\tPing a user/component/server." msgstr "ping <jid>:\tPingni uporabnika/komponento/strežnik." @@ -4585,8 +4937,12 @@ msgstr "Napaka v pomenku %s" msgid "Create New Room" msgstr "Ustvari novo sobo" -msgid "You are creating a new room. Would you like to configure it, or accept the default settings?" -msgstr "Ustvarili boste novo sobo. Jo želite najprej nastaviti ali boste sprejeli privzete nastavitve?" +msgid "" +"You are creating a new room. Would you like to configure it, or accept the " +"default settings?" +msgstr "" +"Ustvarili boste novo sobo. Jo želite najprej nastaviti ali boste sprejeli " +"privzete nastavitve?" msgid "_Configure Room" msgstr "_Nastavi sobo" @@ -4610,7 +4966,8 @@ msgstr "Prišlo je do neznane napake" #, c-format msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Ni mogoče poslati datoteke %s, ker uporabnik ne podpira prenosov datotek" +msgstr "" +"Ni mogoče poslati datoteke %s, ker uporabnik ne podpira prenosov datotek" #. not success msgid "File Send Failed" @@ -4626,7 +4983,9 @@ msgstr "Datoteke %s ni mogoče poslati, ker uporabnik ni povezan" #, c-format msgid "Unable to send file to %s, not subscribed to user presence" -msgstr "Datoteke %s ni mogoče poslati, ker nimate dostopa do stanja uporabnikove prisotnosti" +msgstr "" +"Datoteke %s ni mogoče poslati, ker nimate dostopa do stanja uporabnikove " +"prisotnosti" #, c-format msgid "Please select the resource of %s to which you would like to send a file" @@ -4891,8 +5250,12 @@ msgstr "Nastavi uporabniški vzdevek" msgid "Please specify a new nickname for you." msgstr "Prosimo, vnesite svoj nov vzdevek." -msgid "This information is visible to all contacts on your contact list, so choose something appropriate." -msgstr "Ti podatki so vidni vsem stikom s seznama prijateljev, zato izberite nekaj primernega." +msgid "" +"This information is visible to all contacts on your contact list, so choose " +"something appropriate." +msgstr "" +"Ti podatki so vidni vsem stikom s seznama prijateljev, zato izberite nekaj " +"primernega." msgid "Set" msgstr "Nastavi" @@ -5088,12 +5451,20 @@ msgid "Buddy list synchronization issue in %s (%s)" msgstr "Težava ujemanja (sinhronizacije) seznama prijateljev pri %s (%s)" #, c-format -msgid "%s on the local list is inside the group \"%s\" but not on the server list. Do you want this buddy to be added?" -msgstr "%s z lokalnega seznama je v skupini \"%s\", ne pa tudi na seznamu strežnika. Želite dodati tega prijatelja v skupino?" +msgid "" +"%s on the local list is inside the group \"%s\" but not on the server list. " +"Do you want this buddy to be added?" +msgstr "" +"%s z lokalnega seznama je v skupini \"%s\", ne pa tudi na seznamu strežnika. " +"Želite dodati tega prijatelja v skupino?" #, c-format -msgid "%s is on the local list but not on the server list. Do you want this buddy to be added?" -msgstr "%s je na lokalnem seznamu, ne pa tudi na seznamu strežnika. Želite dodati tega prijatelja?" +msgid "" +"%s is on the local list but not on the server list. Do you want this buddy " +"to be added?" +msgstr "" +"%s je na lokalnem seznamu, ne pa tudi na seznamu strežnika. Želite dodati " +"tega prijatelja?" msgid "Other Contacts" msgstr "Drugi stiki" @@ -5103,7 +5474,9 @@ msgstr "Stiki, s katerimi ne klepetate" #, c-format msgid "%s sent a wink.
    Click here to play it" -msgstr "%s vam je poslal mežik. Kliknite tukaj za predvajanje" +msgstr "" +"%s vam je poslal mežik. Kliknite tukaj za " +"predvajanje" #, c-format msgid "%s sent a wink, but it could not be saved" @@ -5111,7 +5484,9 @@ msgstr "%s vam je poslal mežik, ki pa ga ni mogoče shraniti." #, c-format msgid "%s sent a voice clip. Click here to play it" -msgstr "%s vam je poslal zvočni posnetek. Kliknite tukaj za predvajanje" +msgstr "" +"%s vam je poslal zvočni posnetek. Kliknite tukaj za " +"predvajanje" #, c-format msgid "%s sent a voice clip, but it could not be saved" @@ -5172,7 +5547,9 @@ msgstr "Niste prijavljeni še z nobenega drugega mesta" msgid "Allow multiple logins?" msgstr "Želite dovoliti več hkratnih prijav?" -msgid "Do you want to allow or disallow connecting from multiple locations simultaneously?" +msgid "" +"Do you want to allow or disallow connecting from multiple locations " +"simultaneously?" msgstr "Želite dovoliti ali prepovedati hkratno povezovanje z več mest?" msgid "Allow" @@ -5193,8 +5570,12 @@ msgstr "Nastavite številko vašega mobilnega telefona." msgid "Allow MSN Mobile pages?" msgstr "Dovoli MSN strani za mobilnike?" -msgid "Do you want to allow or disallow people on your buddy list to send you MSN Mobile pages to your cell phone or other mobile device?" -msgstr "Ali želite dovoliti oz. prepovedati prijateljem na vašem seznamu, da vam pošiljajo MSN strani za mobilnike na vaš mobilni telefon?" +msgid "" +"Do you want to allow or disallow people on your buddy list to send you MSN " +"Mobile pages to your cell phone or other mobile device?" +msgstr "" +"Ali želite dovoliti oz. prepovedati prijateljem na vašem seznamu, da vam " +"pošiljajo MSN strani za mobilnike na vaš mobilni telefon?" #, c-format msgid "Blocked Text for %s" @@ -5204,7 +5585,8 @@ msgid "No text is blocked for this account." msgstr "Za ta račun ni blokiranega besedila." #, c-format -msgid "MSN servers are currently blocking the following regular expressions:
    %s" +msgid "" +"MSN servers are currently blocking the following regular expressions:
    %s" msgstr "Strežniki MSN trenutno blokirajo naslednje regularne izraze:
    %s" msgid "This account does not have email enabled." @@ -5286,11 +5668,16 @@ msgid "Send to Mobile" msgstr "Pošlji na mobilca" msgid "SSL support is needed for MSN. Please install a supported SSL library." -msgstr "Za MSN potrebujete podporo SSL, zato morate namestiti podprto knjižnico SSL." +msgstr "" +"Za MSN potrebujete podporo SSL, zato morate namestiti podprto knjižnico SSL." #, c-format -msgid "Unable to add the buddy %s because the username is invalid. Usernames must be valid email addresses." -msgstr "Ni mogoče dodati prijatelja %s, ker uporabniško ime ni veljavno. Imena so lahko le veljavni e-poštni naslovi." +msgid "" +"Unable to add the buddy %s because the username is invalid. Usernames must " +"be valid email addresses." +msgstr "" +"Ni mogoče dodati prijatelja %s, ker uporabniško ime ni veljavno. Imena so " +"lahko le veljavni e-poštni naslovi." msgid "Unable to Add" msgstr "Nemogoče dodati" @@ -5433,11 +5820,20 @@ msgstr "Domača stran" msgid "The user has not created a public profile." msgstr "Uporabnik ni ustvaril javnega profila." -msgid "MSN reported not being able to find the user's profile. This either means that the user does not exist, or that the user exists but has not created a public profile." -msgstr "MSN ne more najti uporabnikovega profila. To lahko pomeni, da uporabnik ne obstaja, ali pa še ni ustvaril javnega profila." +msgid "" +"MSN reported not being able to find the user's profile. This either means " +"that the user does not exist, or that the user exists but has not created a " +"public profile." +msgstr "" +"MSN ne more najti uporabnikovega profila. To lahko pomeni, da uporabnik ne " +"obstaja, ali pa še ni ustvaril javnega profila." -msgid "Could not find any information in the user's profile. The user most likely does not exist." -msgstr "V uporabnikovem profilu ni mogoče najti nobenih informacij. Uporabnik verjetno ne obstaja." +msgid "" +"Could not find any information in the user's profile. The user most likely " +"does not exist." +msgstr "" +"V uporabnikovem profilu ni mogoče najti nobenih informacij. Uporabnik " +"verjetno ne obstaja." msgid "View web profile" msgstr "Pokaži spletni profil" @@ -5511,32 +5907,46 @@ msgstr "Mobilno sporočilo ni bilo poslano, ker je prišlo do neznane napake." #, c-format msgid "" -"The MSN server will shut down for maintenance in %d minute. You will automatically be signed out at that time. Please finish any conversations in progress.\n" +"The MSN server will shut down for maintenance in %d minute. You will " +"automatically be signed out at that time. Please finish any conversations " +"in progress.\n" "\n" -"After the maintenance has been completed, you will be able to successfully sign in." +"After the maintenance has been completed, you will be able to successfully " +"sign in." msgid_plural "" -"The MSN server will shut down for maintenance in %d minutes. You will automatically be signed out at that time. Please finish any conversations in progress.\n" +"The MSN server will shut down for maintenance in %d minutes. You will " +"automatically be signed out at that time. Please finish any conversations " +"in progress.\n" "\n" -"After the maintenance has been completed, you will be able to successfully sign in." +"After the maintenance has been completed, you will be able to successfully " +"sign in." msgstr[0] "" -"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" +"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem " +"boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" "\n" "Po zaključenih vzdrževalnih delih se boste lahko uspešno prijavili." msgstr[1] "" -"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minuti. Ob tem boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" +"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minuti. Ob tem " +"boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" "\n" "Po zaključenih vzdrževalnih delih se boste lahko uspešno prijavili." msgstr[2] "" -"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" +"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem " +"boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" "\n" "Po zaključenih vzdrževalnih delih se boste lahko uspešno prijavili." msgstr[3] "" -"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" +"Strežnik MSN se bo izključil zaradi vzdrževalnih del v %d minutah. Ob tem " +"boste samodejno odjavljeni. Prosimo zaključite vse pogovore, ki so v teku.\n" "\n" "Po zaključenih vzdrževalnih delih se boste lahko uspešno prijavili." -msgid "Message was not sent because the system is unavailable. This normally happens when the user is blocked or does not exist." -msgstr "Sporočilo ni bilo poslano, ker sistem ni na voljo. To se ponavadi zgodi, ko je uporabnik blokiran ali ne obstaja." +msgid "" +"Message was not sent because the system is unavailable. This normally " +"happens when the user is blocked or does not exist." +msgstr "" +"Sporočilo ni bilo poslano, ker sistem ni na voljo. To se ponavadi zgodi, ko " +"je uporabnik blokiran ali ne obstaja." msgid "Message was not sent because messages are being sent too quickly." msgstr "Sporočila ni bilo poslano, saj je sporočila pošiljajo prehitro." @@ -5548,16 +5958,28 @@ msgid "Message was not sent because an unknown error occurred." msgstr "Sporočila ni bilo poslano, ker je prišlo do neznane napake." #, c-format -msgid "%s (There was an error receiving this message. Converting the encoding from %s to UTF-8 failed.)" -msgstr "%s (Prišlo je do napake pri prejemanju tega sporočila. Pretvorba kodnega nabora %s v UTF-8 ni uspela.)" +msgid "" +"%s (There was an error receiving this message. Converting the encoding from " +"%s to UTF-8 failed.)" +msgstr "" +"%s (Prišlo je do napake pri prejemanju tega sporočila. Pretvorba kodnega " +"nabora %s v UTF-8 ni uspela.)" #, c-format -msgid "%s (There was an error receiving this message. The charset was %s, but it was not valid UTF-8.)" -msgstr "%s (Prišlo je do napake pri prejemanju tega sporočila. Nabor znakov je bil %s, ni pa bil veljaven UTF-8.)" - +msgid "" +"%s (There was an error receiving this message. The charset was %s, but it " +"was not valid UTF-8.)" +msgstr "" +"%s (Prišlo je do napake pri prejemanju tega sporočila. Nabor znakov je bil " +"%s, ni pa bil veljaven UTF-8.)" + #, c-format -msgid "%s (There was an error receiving this message. The charset was missing, but it was not valid UTF-8.)" -msgstr "%s (Prišlo je do napake pri prejemanju tega sporočila. Nabor znakov je manjkal, ni pa bil veljaven UTF-8.)" +msgid "" +"%s (There was an error receiving this message. The charset was missing, but " +"it was not valid UTF-8.)" +msgstr "" +"%s (Prišlo je do napake pri prejemanju tega sporočila. Nabor znakov je " +"manjkal, ni pa bil veljaven UTF-8.)" msgid "Writing error" msgstr "Napaka pri pisanju" @@ -5583,7 +6005,8 @@ msgid "You have signed on from another location" msgstr "Prijavili ste se z drugega mesta" msgid "The MSN servers are temporarily unavailable. Please wait and try again." -msgstr "Strežniki MSN so trenutno nedostopni. Prosimo počakajte in poskusite znova." +msgstr "" +"Strežniki MSN so trenutno nedostopni. Prosimo počakajte in poskusite znova." msgid "The MSN servers are going down temporarily" msgstr "Strežniki MSN se bodo začasno zaustavili" @@ -5593,8 +6016,11 @@ msgstr "Strežniki MSN se bodo začasno zaustavili" msgid "Unable to authenticate: %s" msgstr "Ni možno overoviti: %s" -msgid "Your MSN buddy list is temporarily unavailable. Please wait and try again." -msgstr "Vaš seznam prijateljev MSN je trenutno nedostopen. Prosimo počakajte in poskusite znova." +msgid "" +"Your MSN buddy list is temporarily unavailable. Please wait and try again." +msgstr "" +"Vaš seznam prijateljev MSN je trenutno nedostopen. Prosimo počakajte in " +"poskusite znova." msgid "Handshaking" msgstr "Rokovanje" @@ -5632,7 +6058,8 @@ msgid "Out To Lunch" msgstr "Na kosilu" msgid "Message may have not been sent because a timeout occurred:" -msgstr "Sporočila morda ni bilo poslano, ker je prišlo do časovne prekoračitve:" +msgstr "" +"Sporočila morda ni bilo poslano, ker je prišlo do časovne prekoračitve:" msgid "Message could not be sent, not allowed while invisible:" msgstr "Sporočila ni mogoče poslati, saj ni dovoljeno v nevidnem stanju:" @@ -5646,10 +6073,16 @@ msgstr "Sporočilo ni bilo poslano, ker je prišlo do napake v povezavi:" msgid "Message could not be sent because we are sending too quickly:" msgstr "Sporočila ni mogoče poslati, saj je poslano prehitro:" -msgid "Message could not be sent because we were unable to establish a session with the server. This is likely a server problem, try again in a few minutes:" -msgstr "Sporočila ni mogoče poslati, ker ni bilo mogoče vzpostaviti seje s strežnikom. To je najverjetneje težava strežnika, poskusite znova v nekaj minutah:" +msgid "" +"Message could not be sent because we were unable to establish a session with " +"the server. This is likely a server problem, try again in a few minutes:" +msgstr "" +"Sporočila ni mogoče poslati, ker ni bilo mogoče vzpostaviti seje s " +"strežnikom. To je najverjetneje težava strežnika, poskusite znova v nekaj " +"minutah:" -msgid "Message could not be sent because an error with the switchboard occurred:" +msgid "" +"Message could not be sent because an error with the switchboard occurred:" msgstr "Sporočila ni bilo poslano, ker je prišlo do napake v stikalni plošči:" msgid "Message may have not been sent because an unknown error occurred:" @@ -5664,7 +6097,8 @@ msgstr "Ali želite izbrisati tega prijatelja tudi iz adresarja?" msgid "The Display Name you entered is invalid." msgstr "Vneseno pojavno ime ni veljavno." -msgid "The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'." +msgid "" +"The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'." msgstr "Vneseni rojstni datum ni veljaven. Pravilna oblika je: 'LLLL-MM-DD'." #. show error to user @@ -5792,14 +6226,20 @@ msgstr "O razširitvi ..." msgid "The file you are trying to send is too large!" msgstr "Datoteka, ki jo želite poslati, je prevelika!" -msgid "Unable to connect to the MXit HTTP server. Please check your server settings." -msgstr "Povezava s strežnikom MXit HTTP ni možna. Preverite svoje nastavitve strežnika." +msgid "" +"Unable to connect to the MXit HTTP server. Please check your server settings." +msgstr "" +"Povezava s strežnikom MXit HTTP ni možna. Preverite svoje nastavitve " +"strežnika." msgid "Logging In..." msgstr "Prijavljanje ..." -msgid "Unable to connect to the MXit server. Please check your server settings." -msgstr "S strežnikom MXit se ni mogoče povezati. Preverite nastavitve svojega strežnika." +msgid "" +"Unable to connect to the MXit server. Please check your server settings." +msgstr "" +"S strežnikom MXit se ni mogoče povezati. Preverite nastavitve svojega " +"strežnika." msgid "Connecting..." msgstr "Povezovanje ..." @@ -5823,11 +6263,13 @@ msgstr "Izpolnite naslednja polja:" #. no reply from the WAP site msgid "Error contacting the MXit WAP site. Please try again later." -msgstr "Napaka pri navezovanju stika z mestom MXit WAP. Poskusite znova kasneje." +msgstr "" +"Napaka pri navezovanju stika z mestom MXit WAP. Poskusite znova kasneje." #. wapserver error #. server could not find the user -msgid "MXit is currently unable to process the request. Please try again later." +msgid "" +"MXit is currently unable to process the request. Please try again later." msgstr "MXit trenutno ne more obdelati zahteve. Poskusite znova kasneje." msgid "Wrong security code entered. Please try again later." @@ -5840,7 +6282,8 @@ msgid "Invalid country selected. Please try again." msgstr "Izbrana neveljavna država. Poskusite znova kasneje." msgid "The MXit ID you entered is not registered. Please register first." -msgstr "ID za MXit, ki ste ga vnesli, ni registriran. Najprej se registrirajte." +msgstr "" +"ID za MXit, ki ste ga vnesli, ni registriran. Najprej se registrirajte." msgid "The MXit ID you entered is already registered. Please choose another." msgstr "ID za MXit, ki ste ga vnesli, je že registriran. Izberite drugo ime." @@ -5976,7 +6419,8 @@ msgid "Successfully Logged In..." msgstr "Uspešno prijavljeni ..." #, c-format -msgid "%s sent you an encrypted message, but it is not supported on this client." +msgid "" +"%s sent you an encrypted message, but it is not supported on this client." msgstr "%s vam je poslal šifrirano sporočilo, kar še ni podprto v odjemalcu." msgid "Message Error" @@ -6137,12 +6581,24 @@ msgid "IM Friends" msgstr "Prijatelji za klepet" #, c-format -msgid "%d buddy was added or updated from the server (including buddies already on the server-side list)" -msgid_plural "%d buddies were added or updated from the server (including buddies already on the server-side list)" -msgstr[0] "%d prijateljev je bilo dodanih ali posodobljenih s strežnika (vključno s prijatelji, ki so že strežniškem seznamu)" -msgstr[1] "%d prijatelj je bil dodan ali posodobljen s strežnika (vključno s prijatelji, ki so že strežniškem seznamu)" -msgstr[2] "%d prijatelja sta bila dodana ali posodobljena s strežnika (vključno s prijatelji, ki so že strežniškem seznamu)" -msgstr[3] "%d prijatelji so bili dodani ali posodobljeni s strežnika (vključno s prijatelji, ki so že strežniškem seznamu)" +msgid "" +"%d buddy was added or updated from the server (including buddies already on " +"the server-side list)" +msgid_plural "" +"%d buddies were added or updated from the server (including buddies already " +"on the server-side list)" +msgstr[0] "" +"%d prijateljev je bilo dodanih ali posodobljenih s strežnika (vključno s " +"prijatelji, ki so že strežniškem seznamu)" +msgstr[1] "" +"%d prijatelj je bil dodan ali posodobljen s strežnika (vključno s " +"prijatelji, ki so že strežniškem seznamu)" +msgstr[2] "" +"%d prijatelja sta bila dodana ali posodobljena s strežnika (vključno s " +"prijatelji, ki so že strežniškem seznamu)" +msgstr[3] "" +"%d prijatelji so bili dodani ali posodobljeni s strežnika (vključno s " +"prijatelji, ki so že strežniškem seznamu)" msgid "Add contacts from server" msgstr "Dodaj stike s strežnika" @@ -6152,8 +6608,14 @@ msgid "Protocol error, code %d: %s" msgstr "Napaka protokola, koda %d: %s" #, c-format -msgid "%s Your password is %zu characters, which is longer than the maximum length of %d. Please shorten your password at http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword and try again." -msgstr "%s Vaše geslo ima %zu znakov, več kot je dovoljenih %d znakov. Skrajšajte svoje geslo na naslovu http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword in poskusite znova." +msgid "" +"%s Your password is %zu characters, which is longer than the maximum length " +"of %d. Please shorten your password at http://profileedit.myspace.com/index." +"cfm?fuseaction=accountSettings.changePassword and try again." +msgstr "" +"%s Vaše geslo ima %zu znakov, več kot je dovoljenih %d znakov. Skrajšajte " +"svoje geslo na naslovu http://profileedit.myspace.com/index.cfm?" +"fuseaction=accountSettings.changePassword in poskusite znova." msgid "Incorrect username or password" msgstr "Neveljavno uporabniško ime ali geslo" @@ -6188,8 +6650,12 @@ msgstr "Cifra manjka" msgid "The RC4 cipher could not be found" msgstr "Cifre RC4 ni mogoče najti" -msgid "Upgrade to a libpurple with RC4 support (>= 2.0.1). MySpaceIM plugin will not be loaded." -msgstr "Nadgradite libpurple za podporo RC4 (>= 2.0.1). Vtičnik MySpaceIM se ne bo naložil." +msgid "" +"Upgrade to a libpurple with RC4 support (>= 2.0.1). MySpaceIM plugin will " +"not be loaded." +msgstr "" +"Nadgradite libpurple za podporo RC4 (>= 2.0.1). Vtičnik MySpaceIM se ne bo " +"naložil." msgid "Add friends from MySpace.com" msgstr "Dodaj prijatelje z MySpace.com" @@ -6208,7 +6674,8 @@ msgid "myim URL handler" msgstr "Upravljač za URL-je \"myim\"" msgid "No suitable MySpaceIM account could be found to open this myim URL." -msgstr "Za odpiranje tega URL-ja myim ni mogoče najti ustreznega računa MySpaceIM." +msgstr "" +"Za odpiranje tega URL-ja myim ni mogoče najti ustreznega računa MySpaceIM." msgid "Enable the proper MySpaceIM account and try again." msgstr "Omogoči pravi račun MySpaceIM in poskusi znova." @@ -6251,8 +6718,14 @@ msgstr "Skupno prijateljev" msgid "Client Version" msgstr "Različica odjemalca" -msgid "An error occurred while trying to set the username. Please try again, or visit http://editprofile.myspace.com/index.cfm?fuseaction=profile.username to set your username." -msgstr "Pri nastavljanju uporabniškega imena je prišlo do napake. Poskusite znova ali obiščite http://editprofile.myspace.com/index.cfm?fuseaction=profile.username in nastavite svoje uporabniško ime." +msgid "" +"An error occurred while trying to set the username. Please try again, or " +"visit http://editprofile.myspace.com/index.cfm?fuseaction=profile.username " +"to set your username." +msgstr "" +"Pri nastavljanju uporabniškega imena je prišlo do napake. Poskusite znova " +"ali obiščite http://editprofile.myspace.com/index.cfm?fuseaction=profile." +"username in nastavite svoje uporabniško ime." msgid "MySpaceIM - Username Available" msgstr "MySpaceIM - Uporabniško ime je na voljo" @@ -6485,8 +6958,12 @@ msgstr "Nezdružljiva različica protokola" msgid "The user has blocked you" msgstr "Uporabnik vas je zavrnil" -msgid "This evaluation version does not allow more than ten users to log in at one time" -msgstr "Ta preskusna različica ne dovoljuje prijave več kot desetim uporabnikom hkrati" +msgid "" +"This evaluation version does not allow more than ten users to log in at one " +"time" +msgstr "" +"Ta preskusna različica ne dovoljuje prijave več kot desetim uporabnikom " +"hkrati" msgid "The user is either offline or you are blocked" msgstr "Uporabnike ni na zvezi ali pa ste zavrnjeni" @@ -6501,7 +6978,8 @@ msgstr "Prijava ni uspela: %s" #, c-format msgid "Unable to send message. Could not get details for user (%s)." -msgstr "Sporočila ni mogoče poslati. Ni mogoče dobiti podrobnosti za uporabnika (%s)." +msgstr "" +"Sporočila ni mogoče poslati. Ni mogoče dobiti podrobnosti za uporabnika (%s)." #, c-format msgid "Unable to add %s to your buddy list (%s)." @@ -6525,12 +7003,20 @@ msgid "Unable to send message. Could not create the conference (%s)." msgstr "Sporočila ni bilo moč poslati. Ni mogoče ustvariti konference (%s)." #, c-format -msgid "Unable to move user %s to folder %s in the server side list. Error while creating folder (%s)." -msgstr "Uporabnika %s ni mogoče premakniti v mapo %s na seznamu nedejavnih na strežniku. Napaka pri usvarjanju mape (%s)." +msgid "" +"Unable to move user %s to folder %s in the server side list. Error while " +"creating folder (%s)." +msgstr "" +"Uporabnika %s ni mogoče premakniti v mapo %s na seznamu nedejavnih na " +"strežniku. Napaka pri usvarjanju mape (%s)." #, c-format -msgid "Unable to add %s to your buddy list. Error creating folder in server side list (%s)." -msgstr "Ni bilo moč dodati %s na vaš seznam prijateljev. Napaka pri ustvarjanju mape na strežniku (%s)." +msgid "" +"Unable to add %s to your buddy list. Error creating folder in server side " +"list (%s)." +msgstr "" +"Ni bilo moč dodati %s na vaš seznam prijateljev. Napaka pri ustvarjanju mape " +"na strežniku (%s)." #, c-format msgid "Could not get details for user %s (%s)." @@ -6613,11 +7099,16 @@ msgid "Would you like to join the conversation?" msgstr "Se želite pridružiti pomenku?" #, c-format -msgid "%s appears to be offline and did not receive the message that you just sent." +msgid "" +"%s appears to be offline and did not receive the message that you just sent." msgstr "%s ni na zvezi in ni sprejel sporočila, ki ste ga pravkar poslali." -msgid "Unable to connect to server. Please enter the address of the server to which you wish to connect." -msgstr "Ni se mogoče povezati na strežnik. Vnesite naslov strežnika, na katerega se želite povezati." +msgid "" +"Unable to connect to server. Please enter the address of the server to which " +"you wish to connect." +msgstr "" +"Ni se mogoče povezati na strežnik. Vnesite naslov strežnika, na katerega se " +"želite povezati." msgid "This conference has been closed. No more messages can be sent." msgstr "Ta konferenca je bila zaprta. Spročil se ne da pošiljati več.več." @@ -6664,11 +7155,19 @@ msgstr "Prejet nepričakovan odgovor s strani osebe %s: %s" msgid "Received unexpected response from %s" msgstr "Prejet nepričakovan odgovor s strani osebe %s" -msgid "You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer." -msgstr "Povezava ste prevečkrat vzpostavili in prekinili. Počakajte deset minut in poskusite ponovno. Če ne počakate sedaj, boste čakali še dalj." +msgid "" +"You have been connecting and disconnecting too frequently. Wait ten minutes " +"and try again. If you continue to try, you will need to wait even longer." +msgstr "" +"Povezava ste prevečkrat vzpostavili in prekinili. Počakajte deset minut in " +"poskusite ponovno. Če ne počakate sedaj, boste čakali še dalj." -msgid "You required encryption in your account settings, but one of the servers doesn't support it." -msgstr "Zahtevali ste šifriranje za nastavitve svojih računov, vendar eden od strežnikov šifriranja ne podpira." +msgid "" +"You required encryption in your account settings, but one of the servers " +"doesn't support it." +msgstr "" +"Zahtevali ste šifriranje za nastavitve svojih računov, vendar eden od " +"strežnikov šifriranja ne podpira." #. Note to translators: The first %s is a URL, the second is an #. error message. @@ -6679,18 +7178,36 @@ msgstr "Napaka pri zahtevanju %s: %s" msgid "The server returned an empty response" msgstr "Strežnik je vrnil prazen odgovor" -msgid "Server requested that you fill out a CAPTCHA in order to sign in, but this client does not currently support CAPTCHAs." -msgstr "Strežnik zahteva, da za vpis prepišete besedilo s slike, vendar ta odjemalec trenutno le-tega še ne podpira." +msgid "" +"Server requested that you fill out a CAPTCHA in order to sign in, but this " +"client does not currently support CAPTCHAs." +msgstr "" +"Strežnik zahteva, da za vpis prepišete besedilo s slike, vendar ta odjemalec " +"trenutno le-tega še ne podpira." msgid "AOL does not allow your screen name to authenticate here" -msgstr "AOL ne dovoljuje, da bi se vaše pojavno ime overjalo prek tega spletnega mesta" +msgstr "" +"AOL ne dovoljuje, da bi se vaše pojavno ime overjalo prek tega spletnega " +"mesta" -msgid "(There was an error receiving this message. The buddy you are speaking with is probably using a different encoding than expected. If you know what encoding he is using, you can specify it in the advanced account options for your AIM/ICQ account.)" -msgstr "(Pri sprejemu tega sporočila je prišlo do napake. Prijatelj, s katerim se pogovarjate, je najbrž uporabil drugo kodiranje od pričakovanega. Če veste, za katero kodiranje gre, ga lahko navedete v naprednih možnostih nastavitev svojega računa AIM/ICQ.)" +msgid "" +"(There was an error receiving this message. The buddy you are speaking with " +"is probably using a different encoding than expected. If you know what " +"encoding he is using, you can specify it in the advanced account options for " +"your AIM/ICQ account.)" +msgstr "" +"(Pri sprejemu tega sporočila je prišlo do napake. Prijatelj, s katerim se " +"pogovarjate, je najbrž uporabil drugo kodiranje od pričakovanega. Če veste, " +"za katero kodiranje gre, ga lahko navedete v naprednih možnostih nastavitev " +"svojega računa AIM/ICQ.)" #, c-format -msgid "(There was an error receiving this message. Either you and %s have different encodings selected, or %s has a buggy client.)" -msgstr "(Pri prejemu tega sporočila je prišlo do napake. Vi in %s imata izbrane različni kodni strani ali pa ima %s hroščavega odjemalca.)" +msgid "" +"(There was an error receiving this message. Either you and %s have " +"different encodings selected, or %s has a buggy client.)" +msgstr "" +"(Pri prejemu tega sporočila je prišlo do napake. Vi in %s imata izbrane " +"različni kodni strani ali pa ima %s hroščavega odjemalca.)" msgid "Could not join chat room" msgstr "Pogovorni sobi se ni mogoče pridružiti" @@ -6895,8 +7412,13 @@ msgid "Direct IM established" msgstr "Vzpostavljeno neposredno sporočanje" #, c-format -msgid "%s tried to send you a %s file, but we only allow files up to %s over Direct IM. Try using file transfer instead.\n" -msgstr "Uporabnik %s vam je želel poslati datoteko %s, vendar dovoljujemo le prenos datotek do velikosti %s prek neposrednih sporočil. Poskusite raje s funkcijo prenosa datotek.\n" +msgid "" +"%s tried to send you a %s file, but we only allow files up to %s over Direct " +"IM. Try using file transfer instead.\n" +msgstr "" +"Uporabnik %s vam je želel poslati datoteko %s, vendar dovoljujemo le prenos " +"datotek do velikosti %s prek neposrednih sporočil. Poskusite raje s " +"funkcijo prenosa datotek.\n" #, c-format msgid "File %s is %s, which is larger than the maximum size of %s." @@ -6951,15 +7473,28 @@ msgid "Finalizing connection" msgstr "Dokončujem povezavo" #, c-format -msgid "Unable to sign on as %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers." -msgstr "Prijava ni mogoča: ni se mogoče prijaviti kot %s, ker je uporabniško ime neveljavno. Imena morajo biti veljaven e-poštni naslov ali se morajo začeti s črko in lahko vsebujejo le črke, številke in presledke ali pa so sestavljena zgolj iz števil." +msgid "" +"Unable to sign on as %s because the username is invalid. Usernames must be " +"a valid email address, or start with a letter and contain only letters, " +"numbers and spaces, or contain only numbers." +msgstr "" +"Prijava ni mogoča: ni se mogoče prijaviti kot %s, ker je uporabniško ime " +"neveljavno. Imena morajo biti veljaven e-poštni naslov ali se morajo začeti " +"s črko in lahko vsebujejo le črke, številke in presledke ali pa so " +"sestavljena zgolj iz števil." -msgid "You required encryption in your account settings, but encryption is not supported by your system." -msgstr "Zahtevali ste šifriranje za nastavitve svojih računov, vendar vaš sistem šifriranja ne podpira." +msgid "" +"You required encryption in your account settings, but encryption is not " +"supported by your system." +msgstr "" +"Zahtevali ste šifriranje za nastavitve svojih računov, vendar vaš sistem " +"šifriranja ne podpira." #, c-format msgid "You may be disconnected shortly. If so, check %s for updates." -msgstr "Morda bo povezava v kratkem prekinjena. V tem primeru preverite %s za posodobitve." +msgstr "" +"Morda bo povezava v kratkem prekinjena. V tem primeru preverite %s za " +"posodobitve." msgid "Unable to get a valid AIM login hash." msgstr "Veljavnega prijavnega izvlečka za AIM ni mogoče pridobiti." @@ -6984,17 +7519,29 @@ msgid "The AOL Instant Messenger service is temporarily unavailable." msgstr "Storitev AOL neposrednih sporočil je trenuno nedosegljiva." #. username connecting too frequently -msgid "Your username has been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer." -msgstr "Povezava ste prevečkrat vzpostavili in prekinili. Počakajte deset minut in poskusite znova. Če ne počakate sedaj, boste čakali še dlje." +msgid "" +"Your username has been connecting and disconnecting too frequently. Wait ten " +"minutes and try again. If you continue to try, you will need to wait even " +"longer." +msgstr "" +"Povezava ste prevečkrat vzpostavili in prekinili. Počakajte deset minut in " +"poskusite znova. Če ne počakate sedaj, boste čakali še dlje." #. client too old #, c-format msgid "The client version you are using is too old. Please upgrade at %s" -msgstr "Različica odjemalca, ki ga uporabljate, je prestara. Prosim posodobite ga pri %s" +msgstr "" +"Različica odjemalca, ki ga uporabljate, je prestara. Prosim posodobite ga " +"pri %s" #. IP address connecting too frequently -msgid "Your IP address has been connecting and disconnecting too frequently. Wait a minute and try again. If you continue to try, you will need to wait even longer." -msgstr "Povezava ste prevečkrat vzpostavili in prekinili. Počakajte minutko in poskusite znova. Če ne počakate sedaj, boste čakali še dlje." +msgid "" +"Your IP address has been connecting and disconnecting too frequently. Wait a " +"minute and try again. If you continue to try, you will need to wait even " +"longer." +msgstr "" +"Povezava ste prevečkrat vzpostavili in prekinili. Počakajte minutko in " +"poskusite znova. Če ne počakate sedaj, boste čakali še dlje." msgid "The SecurID key entered is invalid" msgstr "Vneseni ključ SecurID ni veljaven" @@ -7013,10 +7560,12 @@ msgstr "Povezave ni mogoče inicializirati" #, c-format msgid "" -"The user %u has denied your request to add them to your buddy list for the following reason:\n" +"The user %u has denied your request to add them to your buddy list for the " +"following reason:\n" "%s" msgstr "" -"Uporabnik %u je zavrnil zahtevo, da bi ga dodali na svoj seznam prijateljev z naslednjim razlogom:\n" +"Uporabnik %u je zavrnil zahtevo, da bi ga dodali na svoj seznam prijateljev " +"z naslednjim razlogom:\n" "%s" msgid "ICQ authorization denied." @@ -7093,28 +7642,45 @@ msgstr[2] "Spregledali ste %hu sporočili od %s, ker sta bili neveljavni." msgstr[3] "Spregledali ste %hu sporočila od %s, ker so bila neveljavna." #, c-format -msgid "You missed %hu message from %s because the rate limit has been exceeded." -msgid_plural "You missed %hu messages from %s because the rate limit has been exceeded." +msgid "" +"You missed %hu message from %s because the rate limit has been exceeded." +msgid_plural "" +"You missed %hu messages from %s because the rate limit has been exceeded." msgstr[0] "Spregledali ste %hu sporočil od %s, ker so bila neveljavna." msgstr[1] "Spregledali ste %hu sporočilo od %s, ker je bilo neveljavno." msgstr[2] "Spregledali ste %hu sporočili od %s, ker sta bili neveljavni." msgstr[3] "Spregledali ste %hu sporočila od %s, ker so bila neveljavna." #, c-format -msgid "You missed %hu message from %s because his/her warning level is too high." -msgid_plural "You missed %hu messages from %s because his/her warning level is too high." -msgstr[0] "Spregledali ste %hu sporočil od %s, ker je njegova/njena raven opozoril previsoka." -msgstr[1] "Spregledali ste %hu sporočilo od %s, ker je njegova/njena raven opozoril previsoka." -msgstr[2] "Spregledali ste %hu sporočili od %s, ker je njegova/njena raven opozoril previsoka." -msgstr[3] "Spregledali ste %hu sporočila od %s, ker je njegova/njena raven opozoril previsoka." +msgid "" +"You missed %hu message from %s because his/her warning level is too high." +msgid_plural "" +"You missed %hu messages from %s because his/her warning level is too high." +msgstr[0] "" +"Spregledali ste %hu sporočil od %s, ker je njegova/njena raven opozoril " +"previsoka." +msgstr[1] "" +"Spregledali ste %hu sporočilo od %s, ker je njegova/njena raven opozoril " +"previsoka." +msgstr[2] "" +"Spregledali ste %hu sporočili od %s, ker je njegova/njena raven opozoril " +"previsoka." +msgstr[3] "" +"Spregledali ste %hu sporočila od %s, ker je njegova/njena raven opozoril " +"previsoka." #, c-format msgid "You missed %hu message from %s because your warning level is too high." -msgid_plural "You missed %hu messages from %s because your warning level is too high." -msgstr[0] "Spregledali ste %hu sporočil od %s, ker je vaša raven opozoril previsoka." -msgstr[1] "Spregledali ste %hu sporočilo od %s, ker je vaša raven opozoril previsoka." -msgstr[2] "Spregledali ste %hu sporočili od %s, ker je vaša raven opozoril previsoka." -msgstr[3] "Spregledali ste %hu sporočila od %s, ker je vaša raven opozoril previsoka." +msgid_plural "" +"You missed %hu messages from %s because your warning level is too high." +msgstr[0] "" +"Spregledali ste %hu sporočil od %s, ker je vaša raven opozoril previsoka." +msgstr[1] "" +"Spregledali ste %hu sporočilo od %s, ker je vaša raven opozoril previsoka." +msgstr[2] "" +"Spregledali ste %hu sporočili od %s, ker je vaša raven opozoril previsoka." +msgstr[3] "" +"Spregledali ste %hu sporočila od %s, ker je vaša raven opozoril previsoka." #, c-format msgid "You missed %hu message from %s for an unknown reason." @@ -7135,7 +7701,9 @@ msgid "The new formatting is invalid." msgstr "Oblika novega zapisa je neveljavna." msgid "Username formatting can change only capitalization and whitespace." -msgstr "Z oblikovanjem uporabniškega imena lahko spreminjate samo velike črke in presledke." +msgstr "" +"Z oblikovanjem uporabniškega imena lahko spreminjate samo velike črke in " +"presledke." msgid "Pop-Up Message" msgstr "Pojavno sporočilo" @@ -7160,28 +7728,50 @@ msgid "Account Confirmation Requested" msgstr "Potrditev računa je bila zahtevana" #, c-format -msgid "Error 0x%04x: Unable to format username because the requested name differs from the original." -msgstr "Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker se zahtevano ime razlikuje od izvirnega." +msgid "" +"Error 0x%04x: Unable to format username because the requested name differs " +"from the original." +msgstr "" +"Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker se " +"zahtevano ime razlikuje od izvirnega." #, c-format msgid "Error 0x%04x: Unable to format username because it is invalid." -msgstr "Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker je neveljavno." +msgstr "" +"Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker je " +"neveljavno." #, c-format -msgid "Error 0x%04x: Unable to format username because the requested name is too long." -msgstr "Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker je zahtevano ime predolgo." +msgid "" +"Error 0x%04x: Unable to format username because the requested name is too " +"long." +msgstr "" +"Napaka 0x%04x: Uporabniškega imena ni bilo mogoče oblikovati, ker je " +"zahtevano ime predolgo." #, c-format -msgid "Error 0x%04x: Unable to change email address because there is already a request pending for this username." -msgstr "Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker je na čakanju za to uporabniško ime že en zahtevek." +msgid "" +"Error 0x%04x: Unable to change email address because there is already a " +"request pending for this username." +msgstr "" +"Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker je na čakanju za to " +"uporabniško ime že en zahtevek." #, c-format -msgid "Error 0x%04x: Unable to change email address because the given address has too many usernames associated with it." -msgstr "Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker ima podani naslov že preveč računov." +msgid "" +"Error 0x%04x: Unable to change email address because the given address has " +"too many usernames associated with it." +msgstr "" +"Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker ima podani naslov že " +"preveč računov." #, c-format -msgid "Error 0x%04x: Unable to change email address because the given address is invalid." -msgstr "Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker je podani naslov neveljaven." +msgid "" +"Error 0x%04x: Unable to change email address because the given address is " +"invalid." +msgstr "" +"Napaka 0x%04x: E-naslova ni mogoče spremeniti, ker je podani naslov " +"neveljaven." #, c-format msgid "Error 0x%04x: Unknown error." @@ -7197,50 +7787,95 @@ msgstr "Elektronski naslov za %s je %s" msgid "Account Info" msgstr "Podatki o računu" -msgid "Your IM Image was not sent. You must be Direct Connected to send IM Images." -msgstr "Vaša slika IM ni bila poslana. Za pošiljanje slik IM morate biti \"neposredno povezani\"." +msgid "" +"Your IM Image was not sent. You must be Direct Connected to send IM Images." +msgstr "" +"Vaša slika IM ni bila poslana. Za pošiljanje slik IM morate biti " +"\"neposredno povezani\"." msgid "Unable to set AIM profile." msgstr "Ni mogoče nastaviti AIM profila." -msgid "You have probably requested to set your profile before the login procedure completed. Your profile remains unset; try setting it again when you are fully connected." -msgstr "Verjetno ste zahtevali, da spremenite svoj profil preden je bila prijava dokončana. Za zdaj je vaš profil nespremenjen; poskusite ponovno, ko boste zagotovo prijavljeni." +msgid "" +"You have probably requested to set your profile before the login procedure " +"completed. Your profile remains unset; try setting it again when you are " +"fully connected." +msgstr "" +"Verjetno ste zahtevali, da spremenite svoj profil preden je bila prijava " +"dokončana. Za zdaj je vaš profil nespremenjen; poskusite ponovno, ko boste " +"zagotovo prijavljeni." #, c-format -msgid "The maximum profile length of %d byte has been exceeded. It has been truncated for you." -msgid_plural "The maximum profile length of %d bytes has been exceeded. It has been truncated for you." -msgstr[0] "Največja dolžina profila %d bajtov je bila presežena, zato je bil skrajšan." -msgstr[1] "Največja dolžina profila %d bajt je bila presežena, zato je bil skrajšan." -msgstr[2] "Največja dolžina profila %d bajta je bila presežena, zato je bil skrajšan." -msgstr[3] "Največja dolžina profila %d bajte je bila presežena, zato je bil skrajšan." +msgid "" +"The maximum profile length of %d byte has been exceeded. It has been " +"truncated for you." +msgid_plural "" +"The maximum profile length of %d bytes has been exceeded. It has been " +"truncated for you." +msgstr[0] "" +"Največja dolžina profila %d bajtov je bila presežena, zato je bil skrajšan." +msgstr[1] "" +"Največja dolžina profila %d bajt je bila presežena, zato je bil skrajšan." +msgstr[2] "" +"Največja dolžina profila %d bajta je bila presežena, zato je bil skrajšan." +msgstr[3] "" +"Največja dolžina profila %d bajte je bila presežena, zato je bil skrajšan." msgid "Profile too long." msgstr "Profil je predolg." #, c-format -msgid "The maximum away message length of %d byte has been exceeded. It has been truncated for you." -msgid_plural "The maximum away message length of %d bytes has been exceeded. It has been truncated for you." -msgstr[0] "Največja dolžina sporočila odsotnosti %d bajtov je bila presežena, zato je bilo sporočilo skrajšano." -msgstr[1] "Največja dolžina sporočila odsotnosti %d bajt je bila presežena, zato je bilo sporočilo skrajšano." -msgstr[2] "Največja dolžina sporočila odsotnosti %d bajta je bila presežena, zato je bilo sporočilo skrajšano." -msgstr[3] "Največja dolžina sporočila odsotnosti %d bajte je bila presežena, zato je bilo sporočilo skrajšano." +msgid "" +"The maximum away message length of %d byte has been exceeded. It has been " +"truncated for you." +msgid_plural "" +"The maximum away message length of %d bytes has been exceeded. It has been " +"truncated for you." +msgstr[0] "" +"Največja dolžina sporočila odsotnosti %d bajtov je bila presežena, zato je " +"bilo sporočilo skrajšano." +msgstr[1] "" +"Največja dolžina sporočila odsotnosti %d bajt je bila presežena, zato je " +"bilo sporočilo skrajšano." +msgstr[2] "" +"Največja dolžina sporočila odsotnosti %d bajta je bila presežena, zato je " +"bilo sporočilo skrajšano." +msgstr[3] "" +"Največja dolžina sporočila odsotnosti %d bajte je bila presežena, zato je " +"bilo sporočilo skrajšano." msgid "Away message too long." msgstr "Spo_ročilo o odsotnosti:" #, c-format -msgid "Unable to add the buddy %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers." -msgstr "Ni mogoče dodati prijatelja %s, ker uporabniško ime ni veljavno. Imena so lahko veljavni e-poštni naslovi ali pa se morajo začeti s črko, vsebujejo lahko le črke, številke in presledke, lahko pa so tudi sestavljena iz samih števil." +msgid "" +"Unable to add the buddy %s because the username is invalid. Usernames must " +"be a valid email address, or start with a letter and contain only letters, " +"numbers and spaces, or contain only numbers." +msgstr "" +"Ni mogoče dodati prijatelja %s, ker uporabniško ime ni veljavno. Imena so " +"lahko veljavni e-poštni naslovi ali pa se morajo začeti s črko, vsebujejo " +"lahko le črke, številke in presledke, lahko pa so tudi sestavljena iz samih " +"števil." msgid "Unable to Retrieve Buddy List" msgstr "Seznama prijateljev ni bilo mogoče pridobiti" -msgid "The AIM servers were temporarily unable to send your buddy list. Your buddy list is not lost, and will probably become available in a few minutes." -msgstr "Strežniki AIM trenutno niso bili zmožni poslati seznama vaših prijateljev. Vaš seznam prijateljev ni izgubljen, verjetno pa bo postal dosegljiv v nekaj urah." +msgid "" +"The AIM servers were temporarily unable to send your buddy list. Your buddy " +"list is not lost, and will probably become available in a few minutes." +msgstr "" +"Strežniki AIM trenutno niso bili zmožni poslati seznama vaših prijateljev. " +"Vaš seznam prijateljev ni izgubljen, verjetno pa bo postal dosegljiv v nekaj " +"urah." #, c-format -msgid "Unable to add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again." -msgstr "Prijatelja %s ni bilo mogoče dodati, ker imate na seznamu preveč prijateljev. Prosimo, odstranite enega in poskusite ponovno." +msgid "" +"Unable to add the buddy %s because you have too many buddies in your buddy " +"list. Please remove one and try again." +msgstr "" +"Prijatelja %s ni bilo mogoče dodati, ker imate na seznamu preveč " +"prijateljev. Prosimo, odstranite enega in poskusite ponovno." msgid "(no name)" msgstr "(brez imena)" @@ -7250,8 +7885,12 @@ msgid "Unable to add the buddy %s for an unknown reason." msgstr "Iz neznanega razloga prijatelja %s ni mogoče dodati." #, c-format -msgid "The user %s has given you permission to add him or her to your buddy list. Do you want to add this user?" -msgstr "Uporabnik %s vam je dovolil, da ga dodate na svoj seznam prijateljev. Ali ga želite dodati?" +msgid "" +"The user %s has given you permission to add him or her to your buddy list. " +"Do you want to add this user?" +msgstr "" +"Uporabnik %s vam je dovolil, da ga dodate na svoj seznam prijateljev. Ali ga " +"želite dodati?" msgid "Authorization Given" msgstr "Pooblastilo odobreno" @@ -7259,7 +7898,8 @@ msgstr "Pooblastilo odobreno" #. Granted #, c-format msgid "The user %s has granted your request to add them to your buddy list." -msgstr "Uporabnik %s je odobril zahtevo, da ga dodate na svoj seznam prijateljev." +msgstr "" +"Uporabnik %s je odobril zahtevo, da ga dodate na svoj seznam prijateljev." msgid "Authorization Granted" msgstr "Pooblastilo odobreno" @@ -7267,10 +7907,12 @@ msgstr "Pooblastilo odobreno" #. Denied #, c-format msgid "" -"The user %s has denied your request to add them to your buddy list for the following reason:\n" +"The user %s has denied your request to add them to your buddy list for the " +"following reason:\n" "%s" msgstr "" -"Uporabnik %s je zavrnil vašo zahtevo, da ga dodate na svoj seznam prijateljev, ker:\n" +"Uporabnik %s je zavrnil vašo zahtevo, da ga dodate na svoj seznam " +"prijateljev, ker:\n" "%s" msgid "Authorization Denied" @@ -7280,7 +7922,8 @@ msgid "_Exchange:" msgstr "_Izmenjaj:" msgid "Your IM Image was not sent. You cannot send IM Images in AIM chats." -msgstr "Vaša slika IM ni bila poslana. Slik IM ne morete pošiljati v klepetih AIM." +msgstr "" +"Vaša slika IM ni bila poslana. Slik IM ne morete pošiljati v klepetih AIM." msgid "iTunes Music Store Link" msgstr "Povezava na glasbeno trgovino iTunes" @@ -7299,8 +7942,12 @@ msgstr "Komentar prijatelja:" msgid "You have selected to open a Direct IM connection with %s." msgstr "Izbrali ste neposredno povezovanje z %s." -msgid "Because this reveals your IP address, it may be considered a security risk. Do you wish to continue?" -msgstr "Ker razkrije vaš naslov IP, lahko velja za kršitev zasebnosti. Želite nadaljevati?" +msgid "" +"Because this reveals your IP address, it may be considered a security risk. " +"Do you wish to continue?" +msgstr "" +"Ker razkrije vaš naslov IP, lahko velja za kršitev zasebnosti. Želite " +"nadaljevati?" msgid "C_onnect" msgstr "Po_veži se" @@ -7345,8 +7992,12 @@ msgstr "ne čakate na pooblastilo" msgid "You are awaiting authorization from the following buddies" msgstr "Pričakujete pooblastila od naslednjih prijateljev" -msgid "You can re-request authorization from these buddies by right-clicking on them and selecting \"Re-request Authorization.\"" -msgstr "Če želite, lahko ponovno zahtevate pooblastilo od teh prijateljev, tako da desno kliknete na njih in izberete \"Ponovno zahtevaj pooblastilo.\"" +msgid "" +"You can re-request authorization from these buddies by right-clicking on " +"them and selecting \"Re-request Authorization.\"" +msgstr "" +"Če želite, lahko ponovno zahtevate pooblastilo od teh prijateljev, tako da " +"desno kliknete na njih in izberete \"Ponovno zahtevaj pooblastilo.\"" msgid "Find Buddy by Email" msgstr "Najdi prijatelja po e-pošti" @@ -7423,8 +8074,14 @@ msgstr "Poskus povezave prek strežnika-prehoda." msgid "%s has just asked to directly connect to %s" msgstr "%s vas je ravnokar prosil za neposredno povezavo na %s" -msgid "This requires a direct connection between the two computers and is necessary for IM Images. Because your IP address will be revealed, this may be considered a privacy risk." -msgstr "To zahteva neposredno povezavo med dvema računalnikoma in je nujno potrebno za sporočanje s slikami. Ker bo razkrit naslov IP, sodi ta povezava med tveganja zasebnosti." +msgid "" +"This requires a direct connection between the two computers and is necessary " +"for IM Images. Because your IP address will be revealed, this may be " +"considered a privacy risk." +msgstr "" +"To zahteva neposredno povezavo med dvema računalnikoma in je nujno potrebno " +"za sporočanje s slikami. Ker bo razkrit naslov IP, sodi ta povezava med " +"tveganja zasebnosti." #. Label msgid "Buddy Icon" @@ -7644,14 +8301,19 @@ msgid "you have no buddies on this list" msgstr "na tem seznamu nimate prijateljev" #, c-format -msgid "You can add a buddy to this list by right-clicking on them and selecting \"%s\"" -msgstr "Na ta seznam lahko dodate prijatelja, tako da desno kliknete nanj in izberete \"%s\"" +msgid "" +"You can add a buddy to this list by right-clicking on them and selecting \"%s" +"\"" +msgstr "" +"Na ta seznam lahko dodate prijatelja, tako da desno kliknete nanj in " +"izberete \"%s\"" msgid "Visible List" msgstr "Seznam vidnih" msgid "These buddies will see your status when you switch to \"Invisible\"" -msgstr "Ti prijatelji bodo vedno videli vaše stanje, ko preklopite na \"Neviden\"" +msgstr "" +"Ti prijatelji bodo vedno videli vaše stanje, ko preklopite na \"Neviden\"" msgid "Invisible List" msgstr "Seznam nevidnih" @@ -7705,8 +8367,10 @@ msgid "Starting Services" msgstr "Zagon storitev" #, c-format -msgid "A Sametime administrator has issued the following announcement on server %s" -msgstr "Upravljalec omrežja Sametime je izdal naslednje obvestilo na strežniku %s" +msgid "" +"A Sametime administrator has issued the following announcement on server %s" +msgstr "" +"Upravljalec omrežja Sametime je izdal naslednje obvestilo na strežniku %s" msgid "Sametime Administrator Announcement" msgstr "Upravljalsko obvestilo Sametime" @@ -7751,7 +8415,9 @@ msgid "Create conference with user" msgstr "Ustvari konferenčni pogovor z uporabnikom" #, c-format -msgid "Please enter a topic for the new conference, and an invitation message to be sent to %s" +msgid "" +"Please enter a topic for the new conference, and an invitation message to be " +"sent to %s" msgstr "Vnesite temo za nov konferenčni pogovor in sporočilo vabila za %s" msgid "New Conference" @@ -7770,8 +8436,14 @@ msgid "Invite user to a conference" msgstr "Povabi uporabnika na konferenčni pogovor" #, c-format -msgid "Select a conference from the list below to send an invite to user %s. Select \"Create New Conference\" if you'd like to create a new conference to invite this user to." -msgstr "Iz spodnjega seznama izberite konferenco in pošljite povabilo uporabniku %s. Izberite \"Ustvari novo konferenco\", če bi želeli ustvariti novo konferenco in k njej povabili uporabnika." +msgid "" +"Select a conference from the list below to send an invite to user %s. Select " +"\"Create New Conference\" if you'd like to create a new conference to invite " +"this user to." +msgstr "" +"Iz spodnjega seznama izberite konferenco in pošljite povabilo uporabniku %s. " +"Izberite \"Ustvari novo konferenco\", če bi želeli ustvariti novo konferenco " +"in k njej povabili uporabnika." msgid "Invite to Conference" msgstr "Povabi na konferenčni pogovor" @@ -7805,8 +8477,12 @@ msgid "An ambiguous user ID was entered" msgstr "Vnesli ste dvoumen uporabniški ID" #, c-format -msgid "The identifier '%s' may possibly refer to any of the following users. Please select the correct user from the list below to add them to your buddy list." -msgstr "Imenovalec '%s' se morda nanaša na vse naštete uporabnike. Izberite ustreznega in ga dodajte na seznam prijateljev." +msgid "" +"The identifier '%s' may possibly refer to any of the following users. Please " +"select the correct user from the list below to add them to your buddy list." +msgstr "" +"Imenovalec '%s' se morda nanaša na vse naštete uporabnike. Izberite " +"ustreznega in ga dodajte na seznam prijateljev." msgid "Select User" msgstr "Izberite uporabnika" @@ -7815,8 +8491,12 @@ msgid "Unable to add user: user not found" msgstr "Ni moč dodati uporabnika: ni ga mogoče najti" #, c-format -msgid "The identifier '%s' did not match any users in your Sametime community. This entry has been removed from your buddy list." -msgstr "Imenovalec '%s' se ne ujema z nobenim uporabnikom v vaši skupnosti Sametime. Ta vnos je bil odstranjen iz vašega seznama prijateljev." +msgid "" +"The identifier '%s' did not match any users in your Sametime community. This " +"entry has been removed from your buddy list." +msgstr "" +"Imenovalec '%s' se ne ujema z nobenim uporabnikom v vaši skupnosti Sametime. " +"Ta vnos je bil odstranjen iz vašega seznama prijateljev." #, c-format msgid "" @@ -7869,8 +8549,14 @@ msgid "Notes Address Book group results" msgstr "Skupinski rezultati adresarjev zapiskov" #, c-format -msgid "The identifier '%s' may possibly refer to any of the following Notes Address Book groups. Please select the correct group from the list below to add it to your buddy list." -msgstr "Imenovalec '%s' se morda nanaša na eno od naslednjih skupin adresarjev zapiskov. Izberite pravo skupino s spodnjega seznama in ga dodajte v svoj seznam prijateljev." +msgid "" +"The identifier '%s' may possibly refer to any of the following Notes Address " +"Book groups. Please select the correct group from the list below to add it " +"to your buddy list." +msgstr "" +"Imenovalec '%s' se morda nanaša na eno od naslednjih skupin adresarjev " +"zapiskov. Izberite pravo skupino s spodnjega seznama in ga dodajte v svoj " +"seznam prijateljev." msgid "Select Notes Address Book" msgstr "Izberite adresar zapiskov" @@ -7879,22 +8565,36 @@ msgid "Unable to add group: group not found" msgstr "Dodajanje skupine ni uspelo: skupina ne obstaja" #, c-format -msgid "The identifier '%s' did not match any Notes Address Book groups in your Sametime community." -msgstr "Imenovalec '%s' se ne ujema z nobeno skupino adresarjev zapiskov v vaši skupnosti Sametime." +msgid "" +"The identifier '%s' did not match any Notes Address Book groups in your " +"Sametime community." +msgstr "" +"Imenovalec '%s' se ne ujema z nobeno skupino adresarjev zapiskov v vaši " +"skupnosti Sametime." msgid "Notes Address Book Group" msgstr "Skupina adresarja zapiskov" -msgid "Enter the name of a Notes Address Book group in the field below to add the group and its members to your buddy list." -msgstr "Vnesite ime skupine opomb adresarja v spodnje polje, s čimer boste lahko v seznam prijateljev vnesli skupino in njene člane." +msgid "" +"Enter the name of a Notes Address Book group in the field below to add the " +"group and its members to your buddy list." +msgstr "" +"Vnesite ime skupine opomb adresarja v spodnje polje, s čimer boste lahko v " +"seznam prijateljev vnesli skupino in njene člane." #, c-format msgid "Search results for '%s'" msgstr "Rezultati iskanja za '%s'" #, c-format -msgid "The identifier '%s' may possibly refer to any of the following users. You may add these users to your buddy list or send them messages with the action buttons below." -msgstr "Imenovalec '%s' se lahko nanaša na katerega koli od naštetih uporabnikov. Izberite ustreznega in ga dodajte na seznam prijateljev ali pa jim pošljite sporočila s spodnjimi gumbi." +msgid "" +"The identifier '%s' may possibly refer to any of the following users. You " +"may add these users to your buddy list or send them messages with the action " +"buttons below." +msgstr "" +"Imenovalec '%s' se lahko nanaša na katerega koli od naštetih uporabnikov. " +"Izberite ustreznega in ga dodajte na seznam prijateljev ali pa jim pošljite " +"sporočila s spodnjimi gumbi." msgid "Search Results" msgstr "Rezultati iskanja" @@ -7904,7 +8604,8 @@ msgstr "Ni zadetkov" #, c-format msgid "The identifier '%s' did not match any users in your Sametime community." -msgstr "Imenovalec '%s' se ne ujema z nobenim uporabnikom vaše skupnosti Sametime." +msgstr "" +"Imenovalec '%s' se ne ujema z nobenim uporabnikom vaše skupnosti Sametime." msgid "No Matches" msgstr "Ni zadetkov" @@ -7912,8 +8613,12 @@ msgstr "Ni zadetkov" msgid "Search for a user" msgstr "Išči uporabnike" -msgid "Enter a name or partial ID in the field below to search for matching users in your Sametime community." -msgstr "Vnesite ime ali delni ID v spodnje polje za iskanje zadetkov v svoji skupnosti Sametime." +msgid "" +"Enter a name or partial ID in the field below to search for matching users " +"in your Sametime community." +msgstr "" +"Vnesite ime ali delni ID v spodnje polje za iskanje zadetkov v svoji " +"skupnosti Sametime." msgid "User Search" msgstr "Iskanje uporabnikov" @@ -7969,7 +8674,9 @@ msgid "The remote user is not present in the network any more" msgstr "Oddaljen uporabnik ni več prisoten v omrežju" #, c-format -msgid "Key agreement request received from %s. Would you like to perform the key agreement?" +msgid "" +"Key agreement request received from %s. Would you like to perform the key " +"agreement?" msgstr "Zahteva po pogodbi sprejeta od %s. Želite izvesti pogodbo?" #, c-format @@ -8016,8 +8723,12 @@ msgstr "Ni mogoče dobiti informacij o uporabniku" msgid "The %s buddy is not trusted" msgstr "Prijatelj %s ni zaupljiv" -msgid "You cannot receive buddy notifications until you import his/her public key. You can use the Get Public Key command to get the public key." -msgstr "Opozoril prijatelja ne morete sprejeti, dokler ne uvozite njegovega javnega ključa. Uporabite lahko ukaz Dobi javni ključ." +msgid "" +"You cannot receive buddy notifications until you import his/her public key. " +"You can use the Get Public Key command to get the public key." +msgstr "" +"Opozoril prijatelja ne morete sprejeti, dokler ne uvozite njegovega javnega " +"ključa. Uporabite lahko ukaz Dobi javni ključ." #. Open file selector to select the public key. msgid "Open..." @@ -8027,8 +8738,12 @@ msgstr "Odpri ..." msgid "The %s buddy is not present in the network" msgstr "Prijatelj %s ni prisoten v omrežju" -msgid "To add the buddy you must import his/her public key. Press Import to import a public key." -msgstr "Če želite dodati prijatelja, morate uvoziti njegov javni ključ. Kliknite Uvozi za uvoz javnega ključa." +msgid "" +"To add the buddy you must import his/her public key. Press Import to import " +"a public key." +msgstr "" +"Če želite dodati prijatelja, morate uvoziti njegov javni ključ. Kliknite " +"Uvozi za uvoz javnega ključa." msgid "_Import..." msgstr "_Uvozi ..." @@ -8036,11 +8751,19 @@ msgstr "_Uvozi ..." msgid "Select correct user" msgstr "Izberite ustreznega uporabnika" -msgid "More than one user was found with the same public key. Select the correct user from the list to add to the buddy list." -msgstr "Najden je bil več kot en uporabnik z enakim javnim ključem. Izberite ustreznega in ga dodajte na seznam prijateljev." +msgid "" +"More than one user was found with the same public key. Select the correct " +"user from the list to add to the buddy list." +msgstr "" +"Najden je bil več kot en uporabnik z enakim javnim ključem. Izberite " +"ustreznega in ga dodajte na seznam prijateljev." -msgid "More than one user was found with the same name. Select the correct user from the list to add to the buddy list." -msgstr "Najden je bil več kot en uporabnik z enakim vzdevkom. Izberite ustreznega in ga dodajte na seznam prijateljev." +msgid "" +"More than one user was found with the same name. Select the correct user " +"from the list to add to the buddy list." +msgstr "" +"Najden je bil več kot en uporabnik z enakim vzdevkom. Izberite ustreznega in " +"ga dodajte na seznam prijateljev." msgid "Detached" msgstr "Odpeto" @@ -8169,8 +8892,17 @@ msgid "Channel Public Keys List" msgstr "Seznam javnih ključev kanala" #, c-format -msgid "Channel authentication is used to secure the channel from unauthorized access. The authentication may be based on passphrase and digital signatures. If passphrase is set, it is required to be able to join. If channel public keys are set then only users whose public keys are listed are able to join." -msgstr "Overovitev kanala služi obrambi kanala pred neavtoriziranim dostopom. Overovitev lahko temelji na geslih in digitalnih podpisih. Če je geslo nastavljeno, je potrebno za pridružitev. Če so nastavljeni javni ključi kanala, se mu lahko pridružijo le uporabniki, katerih ključi so na seznamu." +msgid "" +"Channel authentication is used to secure the channel from unauthorized " +"access. The authentication may be based on passphrase and digital " +"signatures. If passphrase is set, it is required to be able to join. If " +"channel public keys are set then only users whose public keys are listed are " +"able to join." +msgstr "" +"Overovitev kanala služi obrambi kanala pred neavtoriziranim dostopom. " +"Overovitev lahko temelji na geslih in digitalnih podpisih. Če je geslo " +"nastavljeno, je potrebno za pridružitev. Če so nastavljeni javni ključi " +"kanala, se mu lahko pridružijo le uporabniki, katerih ključi so na seznamu." msgid "Channel Authentication" msgstr "Overovitev kanala" @@ -8234,7 +8966,8 @@ msgid "Set Secret Channel" msgstr "Nastavi skrivni kanal" #, c-format -msgid "You have to join the %s channel before you are able to join the private group" +msgid "" +"You have to join the %s channel before you are able to join the private group" msgstr "Preden se pridružite zasebni skupini, se morate pridružiti kanalu %s" msgid "Join Private Group" @@ -8477,8 +9210,12 @@ msgid "Passphrase required" msgstr "Zahtevano geslo" #, c-format -msgid "Received %s's public key. Your local copy does not match this key. Would you still like to accept this public key?" -msgstr "Sprejet javni ključ uporabnika %s. Vaša lokalna kopija ne ustreza temu ključu. Želite kljub temu sprejeti ta javni ključ?" +msgid "" +"Received %s's public key. Your local copy does not match this key. Would you " +"still like to accept this public key?" +msgstr "" +"Sprejet javni ključ uporabnika %s. Vaša lokalna kopija ne ustreza temu " +"ključu. Želite kljub temu sprejeti ta javni ključ?" #, c-format msgid "Received %s's public key. Would you like to accept this public key?" @@ -8514,8 +9251,11 @@ msgstr "Napaka pri povezovanju s strežnikom SILC" msgid "Key Exchange failed" msgstr "Izmenjava ključa ni uspela" -msgid "Resuming detached session failed. Press Reconnect to create new connection." -msgstr "Nadaljevanje odpete seje ni uspelo. Pritisnite Ponovna povezava za tvorbo nove povezave." +msgid "" +"Resuming detached session failed. Press Reconnect to create new connection." +msgstr "" +"Nadaljevanje odpete seje ni uspelo. Pritisnite Ponovna povezava za tvorbo " +"nove povezave." msgid "Performing key exchange" msgstr "Izvajanje izmenjave ključev" @@ -8584,8 +9324,14 @@ msgstr "Časovni pas (UTC)" msgid "User Online Status Attributes" msgstr "Atributi stanja uporabnika na zvezi" -msgid "You can let other users see your online status information and your personal information. Please fill the information you would like other users to see about yourself." -msgstr "Ostalim uporabnikom lahko dovolite ogled informacij o vašem stanju na zvezi in osebnih informacij. Izpolnite informacije, ki jih želite pokazati ostalim uporabnikom." +msgid "" +"You can let other users see your online status information and your personal " +"information. Please fill the information you would like other users to see " +"about yourself." +msgstr "" +"Ostalim uporabnikom lahko dovolite ogled informacij o vašem stanju na zvezi " +"in osebnih informacij. Izpolnite informacije, ki jih želite pokazati ostalim " +"uporabnikom." msgid "Message of the Day" msgstr "Sporočilo dneva" @@ -8669,7 +9415,8 @@ msgid "topic [<new topic>]: View or change the topic" msgstr "topic [<nova tema>]: Ogled ali sprememba teme" msgid "join <channel> [<password>]: Join a chat on this network" -msgstr "join <kanal> [<geslo>]: Pridruži se klepetu na tem omrežju" +msgstr "" +"join <kanal> [<geslo>]: Pridruži se klepetu na tem omrežju" msgid "list: List channels on this network" msgstr "list: Seznam kanalov na tem omrežju" @@ -8678,10 +9425,13 @@ msgid "whois <nick>: View nick's information" msgstr "whois <vzdevek>: Oglej si informacije vzdevka" msgid "msg <nick> <message>: Send a private message to a user" -msgstr "msg <vzdevek> <sporočilo>: Pošlji zasebno sporočilo uporabniku" +msgstr "" +"msg <vzdevek> <sporočilo>: Pošlji zasebno sporočilo uporabniku" msgid "query <nick> [<message>]: Send a private message to a user" -msgstr "query <vzdevek> [<sporočilo>]: Pošlji zasebno sporočilo uporabniku" +msgstr "" +"query <vzdevek> [<sporočilo>]: Pošlji zasebno sporočilo " +"uporabniku" msgid "motd: View the server's Message Of The Day" msgstr "motd: Ogled sporočila dneva na strežniku" @@ -8704,23 +9454,37 @@ msgstr "nick <novvzdevek>: Spremenite vaš vzdevek" msgid "whowas <nick>: View nick's information" msgstr "whowas <vzdevek>: Ogled informacij o vzdevku" -msgid "cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes" -msgstr "cmode <kanall> [+|-<načini>] [argumenti]: Spremeni ali prikaži načine kanala" +msgid "" +"cmode <channel> [+|-<modes>] [arguments]: Change or display " +"channel modes" +msgstr "" +"cmode <kanall> [+|-<načini>] [argumenti]: Spremeni ali prikaži " +"načine kanala" -msgid "cumode <channel> +|-<modes> <nick>: Change nick's modes on channel" -msgstr "cumode <kanal> +|-<načini> <vzdevek>: Spremeni načine vzdevka na kanalu" +msgid "" +"cumode <channel> +|-<modes> <nick>: Change nick's modes " +"on channel" +msgstr "" +"cumode <kanal> +|-<načini> <vzdevek>: Spremeni načine " +"vzdevka na kanalu" msgid "umode <usermodes>: Set your modes in the network" msgstr "umode <načiniuporabnika>: Nastavite vaše načine v omrežju" msgid "oper <nick> [-pubkey]: Get server operator privileges" -msgstr "oper <vzdevek> [-javniključ]: Dodeli pravice operaterju strežnika" +msgstr "" +"oper <vzdevek> [-javniključ]: Dodeli pravice operaterju strežnika" -msgid "invite <channel> [-|+]<nick>: invite nick or add/remove from channel invite list" -msgstr "invite <kanal> [-|+]<vzdevek>: povabi vzdevek ali dodaj/odstrani iz seznama povabljenih na kanal" +msgid "" +"invite <channel> [-|+]<nick>: invite nick or add/remove from " +"channel invite list" +msgstr "" +"invite <kanal> [-|+]<vzdevek>: povabi vzdevek ali dodaj/" +"odstrani iz seznama povabljenih na kanal" msgid "kick <channel> <nick> [comment]: Kick client from channel" -msgstr "kick <kanal> <vzdevek> [komentar]: Brcni odjemalca s kanala" +msgstr "" +"kick <kanal> <vzdevek> [komentar]: Brcni odjemalca s kanala" msgid "info [server]: View server administrative details" msgstr "info [strežnik]: Ogled skrbniških podrobnosti strežnika" @@ -8729,7 +9493,8 @@ msgid "ban [<channel> +|-<nick>]: Ban client from channel" msgstr "ban [<kanal> +|-<vzdevek>]: Prepovaj odjemalca na kanalu" msgid "getkey <nick|server>: Retrieve client's or server's public key" -msgstr "getkey <vzdevek|strežnik>: Pridobi javni ključ odjemalca ali strežnika" +msgstr "" +"getkey <vzdevek|strežnik>: Pridobi javni ključ odjemalca ali strežnika" msgid "stats: View server and network statistics" msgstr "stats: Ogled statistike omrežja in strežnika" @@ -8740,8 +9505,12 @@ msgstr "ping: Pošlji PING povezanemu strežniku" msgid "users <channel>: List users in channel" msgstr "users <kanal>: Navedi uporabnike v kanalu" -msgid "names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)" -msgstr "names [-št|-op|-polop|-glas|-navadni] <kanal(i)>: Seznam določenih uporabnikov na kanalu(ih)" +msgid "" +"names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List " +"specific users in channel(s)" +msgstr "" +"names [-št|-op|-polop|-glas|-navadni] <kanal(i)>: Seznam določenih " +"uporabnikov na kanalu(ih)" #. *< type #. *< ui_requirement @@ -8878,7 +9647,9 @@ msgid "%s sent message to whiteboard. Would you like to open the whiteboard?" msgstr "%s je poslal sporočilo na tablo. Želite odpreti tablo?" #, c-format -msgid "%s sent message to whiteboard on %s channel. Would you like to open the whiteboard?" +msgid "" +"%s sent message to whiteboard on %s channel. Would you like to open the " +"whiteboard?" msgstr "%s je poslal sporočilo na tablo v kanalu %s. Želite odpreti tablo?" msgid "Whiteboard" @@ -9009,12 +9780,17 @@ msgid "Authorization denied message:" msgstr "Zavrnjeno sporočilo pooblaščanja:" #, c-format -msgid "%s has (retroactively) denied your request to add them to your list for the following reason: %s." -msgstr "%s je (že prej) zavrnil vašo zahtevo, da bi ga dodali na svoj seznam prijateljev zaradi naslednjega razloga: %s." +msgid "" +"%s has (retroactively) denied your request to add them to your list for the " +"following reason: %s." +msgstr "" +"%s je (že prej) zavrnil vašo zahtevo, da bi ga dodali na svoj seznam " +"prijateljev zaradi naslednjega razloga: %s." #, c-format msgid "%s has (retroactively) denied your request to add them to your list." -msgstr "%s je (že prej) zavrnil vašo zahtevo, da ga smete dodati na svoj seznam." +msgstr "" +"%s je (že prej) zavrnil vašo zahtevo, da ga smete dodati na svoj seznam." msgid "Add buddy rejected" msgstr "Dodajanje prijatelja zavrnjeno" @@ -9024,31 +9800,52 @@ msgid "Received invalid data" msgstr "Prejeti neveljavni podatki" #. security lock from too many failed login attempts -msgid "Account locked: Too many failed login attempts. Logging into the Yahoo! website may fix this." -msgstr "Račun zaklenjen: Preveč neuspelih poskusov prijave. Prijavljanje v spletno stran Yahoo! lahko to odpravi." +msgid "" +"Account locked: Too many failed login attempts. Logging into the Yahoo! " +"website may fix this." +msgstr "" +"Račun zaklenjen: Preveč neuspelih poskusov prijave. Prijavljanje v spletno " +"stran Yahoo! lahko to odpravi." #. indicates a lock of some description -msgid "Account locked: Unknown reason. Logging into the Yahoo! website may fix this." -msgstr "Račun zaklenjen: Razlog ni znan. Prijavljanje v spletno stran Yahoo! lahko to odpravi." +msgid "" +"Account locked: Unknown reason. Logging into the Yahoo! website may fix " +"this." +msgstr "" +"Račun zaklenjen: Razlog ni znan. Prijavljanje v spletno stran Yahoo! lahko " +"to odpravi." #. indicates a lock due to logging in too frequently -msgid "Account locked: You have been logging in too frequently. Wait a few minutes before trying to connect again. Logging into the Yahoo! website may help." -msgstr "Račun zaklenjen: Prepogosto ste se prijavljali. Počakajte nekaj minut, preden se znova prijavite. Prijavljanje v spletno stran Yahoo! lahko pomaga." +msgid "" +"Account locked: You have been logging in too frequently. Wait a few minutes " +"before trying to connect again. Logging into the Yahoo! website may help." +msgstr "" +"Račun zaklenjen: Prepogosto ste se prijavljali. Počakajte nekaj minut, " +"preden se znova prijavite. Prijavljanje v spletno stran Yahoo! lahko pomaga." #. username or password missing msgid "Username or password missing" msgstr "Manjka uporabniško ime ali geslo" #, c-format -msgid "The Yahoo server has requested the use of an unrecognized authentication method. You will probably not be able to successfully sign on to Yahoo. Check %s for updates." -msgstr "Strežnik Yahoo je zahteval uporabo neprepoznane metode overovitve. Verjetno se ne boste mogli uspešno prijaviti v Yahoo. Preverite %s za posodobitve." +msgid "" +"The Yahoo server has requested the use of an unrecognized authentication " +"method. You will probably not be able to successfully sign on to Yahoo. " +"Check %s for updates." +msgstr "" +"Strežnik Yahoo je zahteval uporabo neprepoznane metode overovitve. Verjetno " +"se ne boste mogli uspešno prijaviti v Yahoo. Preverite %s za posodobitve." msgid "Failed Yahoo! Authentication" msgstr "Napaka pri overovitvi Yahoo!" #, c-format -msgid "You have tried to ignore %s, but the user is on your buddy list. Clicking \"Yes\" will remove and ignore the buddy." -msgstr "Poskusili ste prezreti uporabnika %s, ki je na vašem seznamu prijateljev. Če kliknete \"Da\" boste odstranili prijatelja in ga prezrli." +msgid "" +"You have tried to ignore %s, but the user is on your buddy list. Clicking " +"\"Yes\" will remove and ignore the buddy." +msgstr "" +"Poskusili ste prezreti uporabnika %s, ki je na vašem seznamu prijateljev. Če " +"kliknete \"Da\" boste odstranili prijatelja in ga prezrli." msgid "Ignore buddy?" msgstr "Prezrem prijatelja?" @@ -9056,23 +9853,35 @@ msgstr "Prezrem prijatelja?" msgid "Invalid username or password" msgstr "Neveljavno uporabniško ime ali geslo" -msgid "Your account has been locked due to too many failed login attempts. Please try logging into the Yahoo! website." -msgstr "Račun je bil zaklenjen zaradi prevelikega števila neuspelih poskusov prijave. Prijavite se na spletno stran Yahoo!." +msgid "" +"Your account has been locked due to too many failed login attempts. Please " +"try logging into the Yahoo! website." +msgstr "" +"Račun je bil zaklenjen zaradi prevelikega števila neuspelih poskusov " +"prijave. Prijavite se na spletno stran Yahoo!." #, c-format msgid "Unknown error 52. Reconnecting should fix this." msgstr "Neznana napaka 52. Ponovno povezovanje jo bo najbrž odpravilo." -msgid "Error 1013: The username you have entered is invalid. The most common cause of this error is entering your email address instead of your Yahoo! ID." -msgstr "Napaka 1013: Uporabniško ime, ki ste ga vnesli, ni veljavno. Najpogostejši vzrok za to napako je vnos e-poštnega naslova namesto dejanskega Yahoo! ID." +msgid "" +"Error 1013: The username you have entered is invalid. The most common cause " +"of this error is entering your email address instead of your Yahoo! ID." +msgstr "" +"Napaka 1013: Uporabniško ime, ki ste ga vnesli, ni veljavno. Najpogostejši " +"vzrok za to napako je vnos e-poštnega naslova namesto dejanskega Yahoo! ID." #, c-format msgid "Unknown error number %d. Logging into the Yahoo! website may fix this." -msgstr "Neznana številka napake %d. Prijavljanje v spletno stran Yahoo! lahko to odpravi." +msgstr "" +"Neznana številka napake %d. Prijavljanje v spletno stran Yahoo! lahko to " +"odpravi." #, c-format msgid "Unable to add buddy %s to group %s to the server list on account %s." -msgstr "Prijatelja %s ni mogoče dodati v skupino %s na seznamu strežnikov za račun %s." +msgstr "" +"Prijatelja %s ni mogoče dodati v skupino %s na seznamu strežnikov za račun " +"%s." msgid "Unable to add buddy to server list" msgstr "Prijatelja ni mogoče dodati ne seznam strežnikov" @@ -9095,8 +9904,11 @@ msgstr "Povezave s strežnikom %s ni mogoče vzpostaviti: %s" msgid "Unable to connect: The server returned an empty response." msgstr "Ni se mogoče povezati: Strežnik je vrnil prazen odgovor." -msgid "Unable to connect: The server's response did not contain the necessary information" -msgstr "Ni se mogoče povezati: Odgovor strežnika ne vsebuje potrebnih informacij." +msgid "" +"Unable to connect: The server's response did not contain the necessary " +"information" +msgstr "" +"Ni se mogoče povezati: Odgovor strežnika ne vsebuje potrebnih informacij." msgid "Not at Home" msgstr "Nisem doma" @@ -9186,11 +9998,18 @@ msgstr "Profil Yahoo!-Japonska" msgid "Yahoo! Profile" msgstr "Profil Yahoo!" -msgid "Sorry, profiles marked as containing adult content are not supported at this time." -msgstr "Oprostite, profili označeni z vsebino za odrasle trenutno niso podprti." +msgid "" +"Sorry, profiles marked as containing adult content are not supported at this " +"time." +msgstr "" +"Oprostite, profili označeni z vsebino za odrasle trenutno niso podprti." -msgid "If you wish to view this profile, you will need to visit this link in your web browser:" -msgstr "Če si želite ogledati ta profil, morate s spletnim brskalnikom obiskati naslednjo povezavo:" +msgid "" +"If you wish to view this profile, you will need to visit this link in your " +"web browser:" +msgstr "" +"Če si želite ogledati ta profil, morate s spletnim brskalnikom obiskati " +"naslednjo povezavo:" msgid "Yahoo! ID" msgstr "Yahoo ID" @@ -9216,14 +10035,25 @@ msgstr "Zanimiva povezava št. 3" msgid "Last Update" msgstr "Nazadnje osveženo" -msgid "This profile is in a language or format that is not supported at this time." +msgid "" +"This profile is in a language or format that is not supported at this time." msgstr "Oprostite, profil je v jeziku ali obliki, ki trenutno ni podprta." -msgid "Could not retrieve the user's profile. This most likely is a temporary server-side problem. Please try again later." -msgstr "Ni mogoče pridobiti uporabnikovega profila. Ponavadi gre za začasno težavo na strežniku. Poskusite pozneje." +msgid "" +"Could not retrieve the user's profile. This most likely is a temporary " +"server-side problem. Please try again later." +msgstr "" +"Ni mogoče pridobiti uporabnikovega profila. Ponavadi gre za začasno težavo " +"na strežniku. Poskusite pozneje." -msgid "Could not retrieve the user's profile. This most likely means that the user does not exist; however, Yahoo! sometimes does fail to find a user's profile. If you know that the user exists, please try again later." -msgstr "Ni mogoče pridobiti uporabnikovega profila. To ponavadi pomeni, da uporabnik ne obstaja. Kljub temu Yahoo! občasno ne uspe najti uporabnikovega profila. Če veste, da uporabnik obstaja, poskusite pozneje." +msgid "" +"Could not retrieve the user's profile. This most likely means that the user " +"does not exist; however, Yahoo! sometimes does fail to find a user's " +"profile. If you know that the user exists, please try again later." +msgstr "" +"Ni mogoče pridobiti uporabnikovega profila. To ponavadi pomeni, da uporabnik " +"ne obstaja. Kljub temu Yahoo! občasno ne uspe najti uporabnikovega profila. " +"Če veste, da uporabnik obstaja, poskusite pozneje." msgid "The user's profile is empty." msgstr "Uporabnikov profil je prazen." @@ -9247,8 +10077,12 @@ msgstr "Morda je soba polna" msgid "Not available" msgstr "Ni na voljo" -msgid "Unknown error. You may need to logout and wait five minutes before being able to rejoin a chatroom" -msgstr "Neznana napaka. Morda se boste morali odjaviti in počakati pet minut, preden se boste lahko ponovno pridružili klepetalnici" +msgid "" +"Unknown error. You may need to logout and wait five minutes before being " +"able to rejoin a chatroom" +msgstr "" +"Neznana napaka. Morda se boste morali odjaviti in počakati pet minut, preden " +"se boste lahko ponovno pridružili klepetalnici" #, c-format msgid "You are now chatting in %s." @@ -9281,8 +10115,12 @@ msgstr "Sobe uporabnikov" msgid "Connection problem with the YCHT server" msgstr "Težava s povezavo s strežnikom YCHT" -msgid "(There was an error converting this message.\t Check the 'Encoding' option in the Account Editor)" -msgstr "(Prišlo je do napake pri pretvorbi tega sporočila. \t Preverite izbiro kodnega nabora v Upravitelju računov)" +msgid "" +"(There was an error converting this message.\t Check the 'Encoding' option " +"in the Account Editor)" +msgstr "" +"(Prišlo je do napake pri pretvorbi tega sporočila. \t Preverite izbiro " +"kodnega nabora v Upravitelju računov)" #, c-format msgid "Unable to send to chat %s,%s,%s" @@ -9320,31 +10158,54 @@ msgid "zl <nick>: Locate user" msgstr "zl <vzdevek>: Najdi uporabnika" msgid "instance <instance>: Set the instance to be used on this class" -msgstr "instance <instanca>: Nastavi instanco, ki naj bo uporabljena na tem razredu" +msgstr "" +"instance <instanca>: Nastavi instanco, ki naj bo uporabljena na tem " +"razredu" msgid "inst <instance>: Set the instance to be used on this class" -msgstr "inst <instanca>: Nastavi instanco, ki naj bo uporabljena na tem razredu" +msgstr "" +"inst <instanca>: Nastavi instanco, ki naj bo uporabljena na tem razredu" msgid "topic <instance>: Set the instance to be used on this class" -msgstr "topic <instanca>: Nastavi instanco, ki naj bo uporabljena na tem razredu" +msgstr "" +"topic <instanca>: Nastavi instanco, ki naj bo uporabljena na tem " +"razredu" msgid "sub <class> <instance> <recipient>: Join a new chat" -msgstr "sub <razred> <instanca> <prejemnik>: Pridruži se novemu klepetu" +msgstr "" +"sub <razred> <instanca> <prejemnik>: Pridruži se novemu " +"klepetu" -msgid "zi <instance>: Send a message to <message,instance,*>" -msgstr "zi <instanca>: Pošlji sporočilo uporabniku <sporočilo,instanca,*>" +msgid "" +"zi <instance>: Send a message to <message,instance,*>" +msgstr "" +"zi <instanca>: Pošlji sporočilo uporabniku <sporočilo,instanca,*>" -msgid "zci <class> <instance>: Send a message to <class,instance,*>" -msgstr "zci <razred> <instanca>: Pošlji sporočilo uporabniku <razred,instanca,*>" +msgid "" +"zci <class> <instance>: Send a message to <class," +"instance,*>" +msgstr "" +"zci <razred> <instanca>: Pošlji sporočilo uporabniku <" +"razred,instanca,*>" -msgid "zcir <class> <instance> <recipient>: Send a message to <class,instance,recipient>" -msgstr "zcir <razred> <instanca> <prejemnik>: Pošlji sporočilo uporabniku <razred,instanca,prejemnik>" +msgid "" +"zcir <class> <instance> <recipient>: Send a message to <" +"class,instance,recipient>" +msgstr "" +"zcir <razred> <instanca> <prejemnik>: Pošlji sporočilo " +"uporabniku <razred,instanca,prejemnik>" -msgid "zir <instance> <recipient>: Send a message to <MESSAGE,instance,recipient>" -msgstr "zir <instanca> <prejemnikt>: Pošlji sporočilo uporabniku <SPOROČILO,instanca,prejemnik>" +msgid "" +"zir <instance> <recipient>: Send a message to <MESSAGE," +"instance,recipient>" +msgstr "" +"zir <instanca> <prejemnikt>: Pošlji sporočilo uporabniku <" +"SPOROČILO,instanca,prejemnik>" msgid "zc <class>: Send a message to <class,PERSONAL,*>" -msgstr "zc <razred>: Pošlji sporočilo uporabniku <razred,OSEBNO,*>" +msgstr "" +"zc <razred>: Pošlji sporočilo uporabniku <razred,OSEBNO,*>" msgid "Resubscribe" msgstr "Ponovna prijava" @@ -9404,7 +10265,9 @@ msgstr "Napaka pri povezavi na posredovalni strežnik HTTP %d" #, c-format msgid "Access denied: HTTP proxy server forbids port %d tunneling" -msgstr "Dostop zavrnjen: posredovalni strežnik HTTP ne dovoljuje preusmerjanja vrat %d" +msgstr "" +"Dostop zavrnjen: posredovalni strežnik HTTP ne dovoljuje preusmerjanja vrat " +"%d" #, c-format msgid "Error resolving %s" @@ -9605,8 +10468,12 @@ msgid "Error reading from %s: response too long (%d bytes limit)" msgstr "Napaka pri branju iz %s: odziv predolg (omejeno na %d bajtov)" #, c-format -msgid "Unable to allocate enough memory to hold the contents from %s. The web server may be trying something malicious." -msgstr "Za hrambo vsebine %s ni mogoče pridobiti zadostnega prostora. Spletni strežnik morda poskuša storiti nekaj sovražnega." +msgid "" +"Unable to allocate enough memory to hold the contents from %s. The web " +"server may be trying something malicious." +msgstr "" +"Za hrambo vsebine %s ni mogoče pridobiti zadostnega prostora. Spletni " +"strežnik morda poskuša storiti nekaj sovražnega." #, c-format msgid "Error reading from %s: %s" @@ -9653,11 +10520,18 @@ msgid "Error Reading %s" msgstr "Napaka pri branju %s" #, c-format -msgid "An error was encountered reading your %s. The file has not been loaded, and the old file has been renamed to %s~." -msgstr "Pri branju vašega %s je prišlo do napake. Datoteka ni bial naložena, stara datoteka pa je bila preimenovana v %s~." +msgid "" +"An error was encountered reading your %s. The file has not been loaded, and " +"the old file has been renamed to %s~." +msgstr "" +"Pri branju vašega %s je prišlo do napake. Datoteka ni bial naložena, stara " +"datoteka pa je bila preimenovana v %s~." -msgid "Chat over IM. Supports AIM, Google Talk, Jabber/XMPP, MSN, Yahoo and more" -msgstr "Klepetajte s svetom. Podpira AIM, Google Talk, Jabber/XMPP, MSN, Yahoo in druge." +msgid "" +"Chat over IM. Supports AIM, Google Talk, Jabber/XMPP, MSN, Yahoo and more" +msgstr "" +"Klepetajte s svetom. Podpira AIM, Google Talk, Jabber/XMPP, MSN, Yahoo in " +"druge." msgid "Internet Messenger" msgstr "Spletni sel" @@ -9778,23 +10652,36 @@ msgstr "Protokol" msgid "" "Welcome to %s!\n" "\n" -"You have no IM accounts configured. To start connecting with %s press the Add... button below and configure your first account. If you want %s to connect to multiple IM accounts, press Add... again to configure them all.\n" +"You have no IM accounts configured. To start connecting with %s press the " +"Add... button below and configure your first account. If you want %s " +"to connect to multiple IM accounts, press Add... again to configure " +"them all.\n" "\n" -"You can come back to this window to add, edit, or remove accounts from Accounts->Manage Accounts in the Buddy List window" +"You can come back to this window to add, edit, or remove accounts from " +"Accounts->Manage Accounts in the Buddy List window" msgstr "" "Dobrodošli v programu %s!\n" "\n" -"Nimate nastavljenih računov za neposredno sporočanje. Da bi omogočili povezovanje s %s, pritisnite na spodnji gumb Dodaj ... in nastavite svoj prvi račun. Če želite, da se %s poveže z več računi, pritisnite znova Dodaj ..., da jih vse nastavite.\n" +"Nimate nastavljenih računov za neposredno sporočanje. Da bi omogočili " +"povezovanje s %s, pritisnite na spodnji gumb Dodaj ... in nastavite " +"svoj prvi račun. Če želite, da se %s poveže z več računi, pritisnite znova " +"Dodaj ..., da jih vse nastavite.\n" "\n" -"Vedno se k temu oknu lahko vrnete in dodate, uredite ali odstranite račune z Računi->Upravljaj z računi v oknu seznama prijateljev." +"Vedno se k temu oknu lahko vrnete in dodate, uredite ali odstranite račune z " +"Računi->Upravljaj z računi v oknu seznama prijateljev." #, c-format -msgid "%s%s%s%s wants to add you (%s) to his or her buddy list%s%s" -msgstr "Uporabnik %s%s%s%s vas (%s) želi dodati na svoj seznam prijateljev%s%s." +msgid "" +"%s%s%s%s wants to add you (%s) to his or her buddy " +"list%s%s" +msgstr "" +"Uporabnik %s%s%s%s vas (%s) želi dodati na svoj " +"seznam prijateljev%s%s." #, c-format msgid "%s%s%s%s wants to add you (%s) to his or her buddy list%s%s" -msgstr "Uporabnik %s%s%s%s vas (%s) želi dodati na svoj seznam prijateljev%s%s." +msgstr "" +"Uporabnik %s%s%s%s vas (%s) želi dodati na svoj seznam prijateljev%s%s." msgid "Send Instant Message" msgstr "Pošlji neposredno sporočilo" @@ -9907,22 +10794,33 @@ msgstr "Besedilna informacija, ko ima prijatelj neprebrano sporočilo" msgid "Message (Nick Said) Text" msgstr "Besedilo sporočila (je rekel vzdevek)" -msgid "The text information for when a chat has an unread message that mentions your nickname" -msgstr "Besedilna informacija, ko je v pomenku neprebrano sporočilo, ki omenja vaš vzdevek" +msgid "" +"The text information for when a chat has an unread message that mentions " +"your nickname" +msgstr "" +"Besedilna informacija, ko je v pomenku neprebrano sporočilo, ki omenja vaš " +"vzdevek" msgid "The text information for a buddy's status" msgstr "Besedilni podatki o stanju uporabika" #, c-format msgid "You have %d contact named %s. Would you like to merge them?" -msgid_plural "You currently have %d contacts named %s. Would you like to merge them?" +msgid_plural "" +"You currently have %d contacts named %s. Would you like to merge them?" msgstr[0] "Imate %d stikov z imenom %s. Jih želite spojiti v enega?" msgstr[1] "Imate %d stik z imenom %s. Ga želite spojiti v enega?" msgstr[2] "Imate %d stika z imenom %s. Ju želite spojiti v enega?" msgstr[3] "Imate %d stike z imenom %s. Jih želite spojiti v enega?" -msgid "Merging these contacts will cause them to share a single entry on the buddy list and use a single conversation window. You can separate them again by choosing 'Expand' from the contact's context menu" -msgstr "Spajanje teh stikov bo povzročilo, da si bodo delili en sam vnos na seznamu prijateljev in eno samo pogovorno okno. Znova jih lahko ločite z izbiro 'Razširi' v kontekstnem meniju stika." +msgid "" +"Merging these contacts will cause them to share a single entry on the buddy " +"list and use a single conversation window. You can separate them again by " +"choosing 'Expand' from the contact's context menu" +msgstr "" +"Spajanje teh stikov bo povzročilo, da si bodo delili en sam vnos na seznamu " +"prijateljev in eno samo pogovorno okno. Znova jih lahko ločite z izbiro " +"'Razširi' v kontekstnem meniju stika." msgid "Please update the necessary fields." msgstr "Prosimo, posodobite potrebna polja." @@ -9930,7 +10828,9 @@ msgstr "Prosimo, posodobite potrebna polja." msgid "A_ccount" msgstr "Ra_čun" -msgid "Please enter the appropriate information about the chat you would like to join.\n" +msgid "" +"Please enter the appropriate information about the chat you would like to " +"join.\n" msgstr "Vnesite ustrezne informacije o pomenku, ki se mu želite pridružiti.\n" msgid "Room _List" @@ -10018,11 +10918,10 @@ msgstr "_Strni" msgid "_Expand" msgstr "_Razširi" -msgid "/Tools/Mute Sounds" -msgstr "/Orodja/Utišaj zvoke" - -msgid "You are not currently signed on with an account that can add that buddy." -msgstr "Trenutno niste prijavljeni z nobenim računom, ki lahko doda tega prijatelja." +msgid "" +"You are not currently signed on with an account that can add that buddy." +msgstr "" +"Trenutno niste prijavljeni z nobenim računom, ki lahko doda tega prijatelja." #. I don't believe this can happen currently, I think #. * everything that calls this function checks for one of the @@ -10042,122 +10941,152 @@ msgstr "Uredi razpoloženje uporabnika" #. NOTE: Do not set any accelerator to Control+O. It is mapped by #. gtk_blist_key_press_cb to "Get User Info" on the selected buddy. #. Buddies menu -msgid "/_Buddies" +#, fuzzy +msgid "_Buddies" msgstr "/_Prijatelji" -msgid "/Buddies/New Instant _Message..." -msgstr "/Prijatelji/Novo _neposredno sporočilo ..." +#, fuzzy +msgid "New Instant _Message..." +msgstr "Novo neposredno sporočilo" -msgid "/Buddies/Join a _Chat..." -msgstr "/Prijatelji/Pridruži se _pomenku ..." +#, fuzzy +msgid "Join a _Chat..." +msgstr "Pridruži se klepetu ..." -msgid "/Buddies/Get User _Info..." -msgstr "/Prijatelji/Informacije o _uporabniku ..." +#, fuzzy +msgid "Get User _Info..." +msgstr "Nastavi informacije o uporabniku ..." -msgid "/Buddies/View User _Log..." -msgstr "/Prijatelji/Po_kaži uporabnikov dnevnik ..." +#, fuzzy +msgid "View User _Log..." +msgstr "Prikaži uporabniški dnevnik" -msgid "/Buddies/Sh_ow" -msgstr "/Prijatelji/Poka_ži" +msgid "Sh_ow" +msgstr "" -msgid "/Buddies/Show/_Offline Buddies" -msgstr "/Prijatelji/Pokaži/Prijatelji, ki niso na _zvezi" - -msgid "/Buddies/Show/_Empty Groups" -msgstr "/Prijatelji/Pokaži/Prazne _skupine" - -msgid "/Buddies/Show/Buddy _Details" -msgstr "/Prijatelji/Pokaži/P_odrobnosti prijateljev" - -msgid "/Buddies/Show/Idle _Times" -msgstr "/Prijatelji/Pokaži/_Časi nedejavnosti" - -msgid "/Buddies/Show/_Protocol Icons" -msgstr "/Prijatelji/Pokaži/_Ikone protokolov" - -msgid "/Buddies/_Sort Buddies" -msgstr "/Prijatelji/Razvrs_ti prijatelje" - -msgid "/Buddies/_Add Buddy..." -msgstr "/Prijatelji/Dodaj p_rijatelja ..." +#, fuzzy +msgid "_Sort Buddies" +msgstr "Skupaj prijateljev" -msgid "/Buddies/Add C_hat..." -msgstr "/Prijatelji/Dodaj p_omenek ..." +#, fuzzy +msgid "_Add Buddy..." +msgstr "Dodaj _prijatelja ..." -msgid "/Buddies/Add _Group..." -msgstr "/Prijatelji/Dodaj _skupino ..." +#, fuzzy +msgid "Add _Group..." +msgstr "Dodaj skupino" -msgid "/Buddies/_Quit" -msgstr "/Prijatelji/Iz_hod" +msgid "_Quit" +msgstr "I_zhod" #. Accounts menu -msgid "/_Accounts" -msgstr "/_Računi" +msgid "_Accounts" +msgstr "_Računi" -msgid "/Accounts/Manage Accounts" -msgstr "/Računi/Upravljaj z računi" +#, fuzzy +msgid "Manage Accounts" +msgstr "Omogoči račun" #. Tools -msgid "/_Tools" +#, fuzzy +msgid "_Tools" msgstr "/_Orodja" -msgid "/Tools/Buddy _Pounces" -msgstr "/Orodja/_Opozorila prijateljev" - -msgid "/Tools/_Certificates" -msgstr "/Orodja/_Digitalna potrdila" +#, fuzzy +msgid "Buddy _Pounces" +msgstr "Opozorila prijatelja" -msgid "/Tools/Custom Smile_ys" -msgstr "/Orodja/Smejč_ki po meri" +#, fuzzy +msgid "_Certificates" +msgstr "Digitalna potrdila" -msgid "/Tools/Plu_gins" -msgstr "/Orodja/Vtični_ki" +#, fuzzy +msgid "Custom Smile_ys" +msgstr "Smejček po meri" -msgid "/Tools/Pr_eferences" -msgstr "/Orodja/_Nastavitve" +msgid "Plu_gins" +msgstr "Vti_čniki" -msgid "/Tools/Pr_ivacy" -msgstr "/Orodja/_Zasebnost" +msgid "Pr_eferences" +msgstr "_Nastavitve" -msgid "/Tools/Set _Mood" -msgstr "/Orodja/Nastavi _razpoloženje" +#, fuzzy +msgid "Pr_ivacy" +msgstr "Zasebnost" -msgid "/Tools/_File Transfers" -msgstr "/Orodja/_Prenosi datotek" +#, fuzzy +msgid "Set _Mood" +msgstr "Nastavi _razpoloženje ..." -msgid "/Tools/R_oom List" -msgstr "/Orodja/_Seznam sob" +#, fuzzy +msgid "_File Transfers" +msgstr "Prenosi datotek" -msgid "/Tools/System _Log" -msgstr "/Orodja/Siste_mski dnevnik" +#, fuzzy +msgid "R_oom List" +msgstr "Seznam sob" -msgid "/Tools/Mute _Sounds" -msgstr "/Orodja/_Utišaj zvoke" +#, fuzzy +msgid "System _Log" +msgstr "Sistemski dnevnik" #. Help -msgid "/_Help" +#, fuzzy +msgid "_Help" msgstr "/Po_moč" -msgid "/Help/Online _Help" +#, fuzzy +msgid "Online _Help" msgstr "/Pomoč/Pomoč _na spletu" -msgid "/Help/_Build Information" -msgstr "/Pomoč/Podatki o _gradnji" +#, fuzzy +msgid "_Build Information" +msgstr "Informacije o gradnji" + +#, fuzzy +msgid "_Debug Window" +msgstr "Razhroščevalno okno" + +#, fuzzy +msgid "De_veloper Information" +msgstr "Podatki o razvijalcih %s" + +#, fuzzy +msgid "_Plugin Information" +msgstr "Podatki o vtičniku" -msgid "/Help/_Debug Window" -msgstr "/Pomoč/Raz_hroščevalno okno" +#, fuzzy +msgid "_Translator Information" +msgstr "Podatki o prevajalcih %s" + +#, fuzzy +msgid "_About" +msgstr "O programu" + +#. Buddies->Show menu +#, fuzzy +msgid "_Offline Buddies" +msgstr "Nepovezani prijatelji" + +#, fuzzy +msgid "_Empty Groups" +msgstr "prazne skupine" -msgid "/Help/De_veloper Information" -msgstr "/Pomoč/Podatki o _razvijalcih" +#, fuzzy +msgid "Buddy _Details" +msgstr "/Prijatelji/Pokaži/P_odrobnosti prijateljev" -msgid "/Help/_Plugin Information" -msgstr "/Pomoč/Podatki o v_tičniku" +#, fuzzy +msgid "Idle _Times" +msgstr "Pokaži čas nedejavnosti" -msgid "/Help/_Translator Information" -msgstr "/Pomoč/Podatki o _prevajalcih" +#, fuzzy +msgid "_Protocol Icons" +msgstr "Protokol" -msgid "/Help/_About" -msgstr "/Pomoč/_O programu" +#. Tools menu +msgid "Mute _Sounds" +msgstr "_Utišaj zvoke" #, c-format msgid "Account: %s" @@ -10215,30 +11144,6 @@ msgstr "Nedejaven %dh %02dm" msgid "Idle %dm" msgstr "Nedejaven %dm" -msgid "/Buddies/New Instant Message..." -msgstr "/Prijatelji/Novo neposredno sporočilo ..." - -msgid "/Buddies/Join a Chat..." -msgstr "/Prijatelji/Pridruži se pomenku ..." - -msgid "/Buddies/Get User Info..." -msgstr "/Prijatelji/Informacije o uporabniku ..." - -msgid "/Buddies/Add Buddy..." -msgstr "/Prijatelji/Dodaj prijatelja ..." - -msgid "/Buddies/Add Chat..." -msgstr "/Prijatelji/Dodaj pomenek ..." - -msgid "/Buddies/Add Group..." -msgstr "/Prijatelji/Dodaj skupino ..." - -msgid "/Tools/Privacy" -msgstr "/Orodja/Zasebnost" - -msgid "/Tools/Room List" -msgstr "/Orodja/Seznam sob" - #, c-format msgid "%d unread message from %s\n" msgid_plural "%d unread messages from %s\n" @@ -10278,11 +11183,15 @@ msgstr "Dobrodošli nazaj!" #, c-format msgid "%d account was disabled because you signed on from another location:" -msgid_plural "%d accounts were disabled because you signed on from another location:" -msgstr[0] "Ker ste se prijavili z druge lokacije, je bilo onemogočenih %d računov." +msgid_plural "" +"%d accounts were disabled because you signed on from another location:" +msgstr[0] "" +"Ker ste se prijavili z druge lokacije, je bilo onemogočenih %d računov." msgstr[1] "Ker ste se prijavili z druge lokacije, je bil onemogočen %d račun." -msgstr[2] "Ker ste se prijavili z druge lokacije, sta bila onemogočena %d računa." -msgstr[3] "Ker ste se prijavili z druge lokacije, so bili onemogočeni %d računi." +msgstr[2] "" +"Ker ste se prijavili z druge lokacije, sta bila onemogočena %d računa." +msgstr[3] "" +"Ker ste se prijavili z druge lokacije, so bili onemogočeni %d računi." msgid "Username:" msgstr "Uporabniško ime:" @@ -10293,37 +11202,21 @@ msgstr "Geslo:" msgid "_Login" msgstr "_Prijavi" -msgid "/Accounts" -msgstr "/Računi" - #. Translators: Please maintain the use of -> and <- to refer to menu heirarchy #, c-format msgid "" "Welcome to %s!\n" "\n" -"You have no accounts enabled. Enable your IM accounts from the Accounts window at Accounts->Manage Accounts. Once you enable accounts, you'll be able to sign on, set your status, and talk to your friends." +"You have no accounts enabled. Enable your IM accounts from the Accounts window at Accounts->Manage Accounts. Once you enable accounts, " +"you'll be able to sign on, set your status, and talk to your friends." msgstr "" "Dobrodošli v %s!\n" "\n" -"Nimate aktiviranih računov. Vključite svoje račune za neposredno sporočanje (IM) prek okna Računi z ukazom Računi->Upravljaj z računi. Ko račune omogočite, se boste lahko prijavili, nastavili svoje stanje in klepetali s svojimi prijatelji." - -#. set the Show Offline Buddies option. must be done -#. * after the treeview or faceprint gets mad. -Robot101 -#. -msgid "/Buddies/Show/Offline Buddies" -msgstr "/Prijatelji/Pokaži/Prijatelji, ki niso na zvezi" - -msgid "/Buddies/Show/Empty Groups" -msgstr "/Prijatelji/Pokaži/Prazne skupine" - -msgid "/Buddies/Show/Buddy Details" -msgstr "/Prijatelji/Pokaži/Podrobnosti prijateljev" - -msgid "/Buddies/Show/Idle Times" -msgstr "/Prijatelji/Pokaži/Časi nedejavnosti" - -msgid "/Buddies/Show/Protocol Icons" -msgstr "/Prijatelji/Pokaži/Ikone protokolov" +"Nimate aktiviranih računov. Vključite svoje račune za neposredno sporočanje " +"(IM) prek okna Računi z ukazom Računi->Upravljaj z računi. Ko " +"račune omogočite, se boste lahko prijavili, nastavili svoje stanje in " +"klepetali s svojimi prijatelji." msgid "Add a buddy.\n" msgstr "Dodaj prijatelja.\n" @@ -10343,11 +11236,18 @@ msgstr "Doda_j prijatelja v skupino:" msgid "This protocol does not support chat rooms." msgstr "Ta protokol ne podpira klepetalnic." -msgid "You are not currently signed on with any protocols that have the ability to chat." -msgstr "Trenutno niste prijavljeni na nobenem izmed protokolov, ki podpirajo pomenke." +msgid "" +"You are not currently signed on with any protocols that have the ability to " +"chat." +msgstr "" +"Trenutno niste prijavljeni na nobenem izmed protokolov, ki podpirajo pomenke." -msgid "Please enter an alias, and the appropriate information about the chat you would like to add to your buddy list.\n" -msgstr "Prosim, vnesite psevdonim in ostale informacije za pomenek, ki ga želite dodati na seznam prijateljev.\n" +msgid "" +"Please enter an alias, and the appropriate information about the chat you " +"would like to add to your buddy list.\n" +msgstr "" +"Prosim, vnesite psevdonim in ostale informacije za pomenek, ki ga želite " +"dodati na seznam prijateljev.\n" msgid "A_lias:" msgstr "Psev_donim:" @@ -10367,12 +11267,6 @@ msgstr "Prosimo vnesite ime skupine, ki jo želite dodati." msgid "Enable Account" msgstr "Omogoči račun" -msgid "/Accounts/Enable Account" -msgstr "/Računi/Omogoči račun" - -msgid "/Accounts/" -msgstr "/Računi/" - msgid "_Edit Account" msgstr "_Uredi račun" @@ -10385,12 +11279,6 @@ msgstr "Na voljo ni nobenega ukaza" msgid "_Disable" msgstr "_Onemogoči" -msgid "/Tools" -msgstr "/Orodja" - -msgid "/Buddies/Sort Buddies" -msgstr "/Prijatelji/Razvrsti prijatelje" - msgid "Type the host name for this certificate." msgstr "Vnesite ime gostitelja za to digitalno potrdilo." @@ -10418,14 +11306,24 @@ msgstr "Gostobesedno razhroščevanje je zdaj omogočeno." msgid "Supported debug options are: plugins version unsafe verbose" msgstr "Podprte možnosti razhroščevanja: plugins version unsafe verbose" +#, fuzzy +msgid "" +"Use \"/help <command>\" for help on a specific command.
    The " +"following commands are available in this context:
    " +msgstr "" +"Uporabite \"/help <ukaz>\" za pomoč o določenem ukazu.\n" +"V tem sklopu so na voljo naslednji ukazi:\n" + msgid "Unknown command." msgstr "Neznan ukaz." msgid "That buddy is not on the same protocol as this chat." msgstr "Tisti prijatelj ne uporablja enakega protokola kot ta pogovor." -msgid "You are not currently signed on with an account that can invite that buddy." -msgstr "Trenutno niste prijavljeni z nobenim računom, ki lahko doda tega prijatelja." +msgid "" +"You are not currently signed on with an account that can invite that buddy." +msgstr "" +"Trenutno niste prijavljeni z nobenim računom, ki lahko doda tega prijatelja." msgid "Invite Buddy Into Chat Room" msgstr "Povabi prijatelja v pogovorno sobo" @@ -10477,170 +11375,99 @@ msgid "Show All" msgstr "Pokaži vse" #. Conversation menu -msgid "/_Conversation" +#, fuzzy +msgid "_Conversation" msgstr "/_Pogovor" -msgid "/Conversation/New Instant _Message..." -msgstr "/Pogovor/N_ovo neposredno sporočilo ..." - -msgid "/Conversation/Join a _Chat..." -msgstr "/Pogovor/Pridruži se klepetu ..." - -msgid "/Conversation/_Find..." -msgstr "/Pogovor/_Najdi ..." - -msgid "/Conversation/View _Log" -msgstr "/Pogovor/Pokaži _dnevnik ..." - -msgid "/Conversation/_Save As..." -msgstr "/Pogovor/_Shrani kot ..." - -msgid "/Conversation/Clea_r Scrollback" -msgstr "/Pogovor/Po_čisti pogovor" - -msgid "/Conversation/M_edia" -msgstr "/Pogovor/M_ediji" +#, fuzzy +msgid "_Find..." +msgstr "Najdi" -msgid "/Conversation/Media/_Audio Call" -msgstr "/Pogovor/Mediji/_Zvočni klic" +#, fuzzy +msgid "_Save As..." +msgstr "Shrani ikono kot ..." -msgid "/Conversation/Media/_Video Call" -msgstr "/Pogovor/Mediji/_Video klic" +#, fuzzy +msgid "Clea_r Scrollback" +msgstr "Počisti pretekle izjave" -msgid "/Conversation/Media/Audio\\/Video _Call" -msgstr "/Pogovor/Mediji/Zvočni\\/Video _klic" +#, fuzzy +msgid "M_edia" +msgstr "_Mediji" -msgid "/Conversation/Se_nd File..." -msgstr "/Pogovor/_Pošlji datoteko ..." +#, fuzzy +msgid "Audio/Video _Call" +msgstr "Zvočni/_video klic" -msgid "/Conversation/Get _Attention" -msgstr "/Pogovor/Pridobi _pozornost" +#, fuzzy +msgid "Se_nd File..." +msgstr "_Pošlji datoteko ..." -msgid "/Conversation/Add Buddy _Pounce..." -msgstr "/Pogovor/Dodaj _opozorilo prijatelja ..." +#, fuzzy +msgid "Get _Attention" +msgstr "_Pozor!" -msgid "/Conversation/_Get Info" -msgstr "/Pogovor/_Informacije" +msgid "_Get Info" +msgstr "_Informacije" -msgid "/Conversation/In_vite..." -msgstr "/Pogovor/Pova_bi ..." +#, fuzzy +msgid "In_vite..." +msgstr "Povabi ..." -msgid "/Conversation/M_ore" -msgstr "/Pogovor/_Več" +msgid "M_ore" +msgstr "" -msgid "/Conversation/Al_ias..." -msgstr "/Pogovor/_Vzdevek ..." +#, fuzzy +msgid "Al_ias..." +msgstr "Psevdo_nim ..." -msgid "/Conversation/_Block..." -msgstr "/Pogovor/Zavr_ni ..." +#, fuzzy +msgid "_Block..." +msgstr "_Zavrni" -msgid "/Conversation/_Unblock..." -msgstr "/Pogovor/Pre_kliči zavrnitev ..." +#, fuzzy +msgid "_Unblock..." +msgstr "Prekliči zavrnitev" -msgid "/Conversation/_Add..." -msgstr "/Pogovor/Dod_aj ..." +msgid "_Add..." +msgstr "_Dodaj ..." -msgid "/Conversation/_Remove..." -msgstr "/Pogovor/Odst_rani ..." +#, fuzzy +msgid "_Remove..." +msgstr "Odst_rani" -msgid "/Conversation/Insert Lin_k..." -msgstr "/Pogovor/Vstavi pove_zavo ..." +#, fuzzy +msgid "Insert Lin_k..." +msgstr "Vstavi povezavo" -msgid "/Conversation/Insert Imag_e..." -msgstr "/Pogovor/Vstavi _sliko ..." +#, fuzzy +msgid "Insert Imag_e..." +msgstr "Vstavi sliko" -msgid "/Conversation/_Close" -msgstr "/Pogovor/_Zapri" +#, fuzzy +msgid "_Close" +msgstr "Zapri" #. Options -msgid "/_Options" +#, fuzzy +msgid "_Options" msgstr "/M_ožnosti" -msgid "/Options/Enable _Logging" -msgstr "/Možnosti/Vk_ljuči dnevnik" +#, fuzzy +msgid "Enable _Logging" +msgstr "Vključi dnevnik" -msgid "/Options/Enable _Sounds" -msgstr "/Možnosti/Vključi _zvoke" +#, fuzzy +msgid "Enable _Sounds" +msgstr "Vključi zvoke" -msgid "/Options/Show Formatting _Toolbars" +#, fuzzy +msgid "Show Formatting _Toolbars" msgstr "/Možnosti/Pokaži orodno vrstico za _oblikovanje" -msgid "/Options/Show Ti_mestamps" -msgstr "/Možnosti/Pokaži _časovne žige" - -msgid "/Conversation/More" -msgstr "/Pogovor/Več" - -msgid "/Options" -msgstr "/Možnosti" - -#. The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time -#. * the 'Conversation' menu pops up. -#. Make sure the 'Conversation -> More' menuitems are regenerated whenever -#. * the 'Conversation' menu pops up because the entries can change after the -#. * conversation is created. -msgid "/Conversation" -msgstr "/Pogovor" - -msgid "/Conversation/View Log" -msgstr "/Pogovor/Pokaži dnevnik" - -msgid "/Conversation/Media/Audio Call" -msgstr "/Pogovor/Mediji/Zvočni klic" - -msgid "/Conversation/Media/Video Call" -msgstr "/Pogovor/Mediji/Video klic" - -msgid "/Conversation/Media/Audio\\/Video Call" -msgstr "/Pogovor/Mediji/Zvočni\\/Video klic" - -msgid "/Conversation/Send File..." -msgstr "/Pogovor/Pošlji datoteko ..." - -msgid "/Conversation/Get Attention" -msgstr "/Pogovor/Pridobi pozornost" - -msgid "/Conversation/Add Buddy Pounce..." -msgstr "/Pogovor/Dodaj opozorilo prijatelja ..." - -msgid "/Conversation/Get Info" -msgstr "/Pogovor/Informacije" - -msgid "/Conversation/Invite..." -msgstr "/Pogovor/Povabi ..." - -msgid "/Conversation/Alias..." -msgstr "/Pogovor/Psevdonim ..." - -msgid "/Conversation/Block..." -msgstr "/Pogovor/Zavrni ..." - -msgid "/Conversation/Unblock..." -msgstr "/Pogovor/Prekliči zavrnitev ..." - -msgid "/Conversation/Add..." -msgstr "/Pogovor/Dodaj ..." - -msgid "/Conversation/Remove..." -msgstr "/Pogovor/Odstrani ..." - -msgid "/Conversation/Insert Link..." -msgstr "/Pogovor/Vstavi povezavo ..." - -msgid "/Conversation/Insert Image..." -msgstr "/Pogovor/Vstavi sliko ..." - -msgid "/Options/Enable Logging" -msgstr "/Možnosti/Vključi dnevnik" - -msgid "/Options/Enable Sounds" -msgstr "/Možnosti/Vključi zvoke" - -msgid "/Options/Show Formatting Toolbars" -msgstr "/Možnosti/Pokaži orodno vrstico za oblikovanje" - -msgid "/Options/Show Timestamps" -msgstr "/Možnosti/Pokaži časovne žige" +#, fuzzy +msgid "Show Ti_mestamps" +msgstr "Pokaži časovne žige" msgid "User is typing..." msgstr "Uporabnik tipka ..." @@ -11031,6 +11858,10 @@ msgstr "albansko" msgid "Serbian" msgstr "srbsko" +#, fuzzy +msgid "Serbian Latin" +msgstr "belorusko (latinica)" + msgid "Sinhala" msgstr "sinhalsko" @@ -11079,17 +11910,50 @@ msgstr "amharsko" msgid "Lithuanian" msgstr "litvansko" -#, c-format -msgid "%s is a messaging client based on libpurple which is capable of connecting to multiple messaging services at once. %s is written in C using GTK+. %s is released, and may be modified and redistributed, under the terms of the GPL version 2 (or later). A copy of the GPL is distributed with %s. %s is copyrighted by its contributors, a list of whom is also distributed with %s. There is no warranty for %s.

    " -msgstr "%s je odjemalec za neposredno sporočanje, ki se lahko hkrati povezuje z več storitvami sporočanja. %s je napisan v jeziku C s pomočjo Gtk+. %s je izdan in ga lahko spreminjate in razširjate pod pogoji licence GPL različice 2 (ali novejše). Kopija licence GPL se razširja s programom %s. %s je zaščitena znamka svojih avtorjev, njihov seznam se prav tako razširja s programom %s. Za %s ni na voljo nikakršna garancija.

    " - -#, c-format -msgid "Helpful Resources
    \tWebsite
    \tFrequently Asked Questions
    \tIRC Channel: #pidgin on irc.freenode.net
    \tXMPP MUC: devel@conference.pidgin.im

    " -msgstr "Viri pomoči
    \tSpletno mesto
    \tPogosto zastavljena vprašanja
    \tKanal IRC: #pidgin na irc.freenode.net
    \tMUC XMPP: devel@conference.pidgin.im

    " +#, fuzzy, c-format +msgid "" +"

    %s is a messaging client based on libpurple which is capable of " +"connecting to multiple messaging services at once. %s is written in C using " +"GTK+. %s is released, and may be modified and redistributed, under the " +"terms of the GPL version 2 (or later). A copy of the GPL is distributed " +"with %s. %s is copyrighted by its contributors, a list of whom is also " +"distributed with %s. There is no warranty for %s.

    " +msgstr "" +"%s je odjemalec za neposredno sporočanje, ki se lahko hkrati povezuje z več " +"storitvami sporočanja. %s je napisan v jeziku C s pomočjo Gtk+. %s je izdan " +"in ga lahko spreminjate in razširjate pod pogoji licence GPL različice 2 " +"(ali novejše). Kopija licence GPL se razširja s programom %s. %s je " +"zaščitena znamka svojih avtorjev, njihov seznam se prav tako razširja s " +"programom %s. Za %s ni na voljo nikakršna garancija.

    " + +#, fuzzy, c-format +msgid "" +"

    Helpful Resources

    " +msgstr "" +"Viri pomoči
    \tSpletno " +"mesto
    \tPogosto zastavljena vprašanja
    " +"\tKanal IRC: #pidgin na irc.freenode.net
    \tMUC XMPP: devel@conference." +"pidgin.im

    " -#, c-format -msgid "Help from other Pidgin users is available by e-mailing support@pidgin.im
    This is a public mailing list! (archive)
    We can't help with third-party protocols or plugins!
    This list's primary language is English. You are welcome to post in another language, but the responses may be less helpful.
    " -msgstr "Pomoč drugih uporabnikov Pidgina je na voljo po e-pošti na support@pidgin.im
    To je javen dopisni seznam! (arhiv)
    Glede protokolov in vtičnikov drugih ne moremo pomagati!
    Glavni jezik tega seznama je angleščina. Vabimo vas, da objavite tudi v drugih jezikih, vendar bodo odgovori najbrž manj v pomoč.
    " +#, fuzzy, c-format +msgid "" +"

    Help from other Pidgin users is available by e-mailing " +"%s.
    This is a public mailing " +"list! (archive)
    We can't help with third-" +"party protocols or plugins!
    This list's primary language is " +"English. You are welcome to post in another language, but " +"the responses may be less helpful.

    " +msgstr "" +"Pomoč drugih uporabnikov Pidgina je na voljo " +"po e-pošti na support@pidgin.im
    To je javen dopisni seznam! (arhiv)
    Glede protokolov in vtičnikov drugih ne moremo " +"pomagati!
    Glavni jezik tega seznama je angleščina. Vabimo vas, da " +"objavite tudi v drugih jezikih, vendar bodo odgovori najbrž manj v pomoč.
    " #, c-format msgid "About %s" @@ -11145,8 +12009,12 @@ msgstr "_Račun" msgid "Get User Info" msgstr "Informacije o uporabniku" -msgid "Please enter the username or alias of the person whose info you would like to view." -msgstr "Vnesite uporabniško ime ali psevdonim osebe, o kateri si želite ogledati podatke." +msgid "" +"Please enter the username or alias of the person whose info you would like " +"to view." +msgstr "" +"Vnesite uporabniško ime ali psevdonim osebe, o kateri si želite ogledati " +"podatke." msgid "View User Log" msgstr "Prikaži uporabniški dnevnik" @@ -11165,12 +12033,24 @@ msgid "Enter an alias for this chat." msgstr "Vnesite psevdonim za ta pomenek." #, c-format -msgid "You are about to remove the contact containing %s and %d other buddy from your buddy list. Do you want to continue?" -msgid_plural "You are about to remove the contact containing %s and %d other buddies from your buddy list. Do you want to continue?" -msgstr[0] "S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d drugih prijateljev. Ali želite nadaljevati?" -msgstr[1] "S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d drugega prijatelja. Ali želite nadaljevati?" -msgstr[2] "S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d druga prijatelja. Ali želite nadaljevati?" -msgstr[3] "S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d druge prijatelje. Ali želite nadaljevati?" +msgid "" +"You are about to remove the contact containing %s and %d other buddy from " +"your buddy list. Do you want to continue?" +msgid_plural "" +"You are about to remove the contact containing %s and %d other buddies from " +"your buddy list. Do you want to continue?" +msgstr[0] "" +"S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d drugih " +"prijateljev. Ali želite nadaljevati?" +msgstr[1] "" +"S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d drugega " +"prijatelja. Ali želite nadaljevati?" +msgstr[2] "" +"S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d druga " +"prijatelja. Ali želite nadaljevati?" +msgstr[3] "" +"S seznama prijateljev boste odstranili stik, ki vsebuje %s in %d druge " +"prijatelje. Ali želite nadaljevati?" msgid "Remove Contact" msgstr "Odstrani stik" @@ -11179,7 +12059,9 @@ msgid "_Remove Contact" msgstr "_Odstrani stik" #, c-format -msgid "You are about to merge the group called %s into the group called %s. Do you want to continue?" +msgid "" +"You are about to merge the group called %s into the group called %s. Do you " +"want to continue?" msgstr "Skupino %s boste spojili v skupino %s. Ali želite nadaljevati?" msgid "Merge Groups" @@ -11189,8 +12071,11 @@ msgid "_Merge Groups" msgstr "_Spoji skupine" #, c-format -msgid "You are about to remove the group %s and all its members from your buddy list. Do you want to continue?" -msgstr "S seznama prijateljev boste odstranili skupino %s. Ali želite nadaljevati?" +msgid "" +"You are about to remove the group %s and all its members from your buddy " +"list. Do you want to continue?" +msgstr "" +"S seznama prijateljev boste odstranili skupino %s. Ali želite nadaljevati?" msgid "Remove Group" msgstr "Odstrani skupino" @@ -11199,7 +12084,8 @@ msgid "_Remove Group" msgstr "_Odstrani skupino" #, c-format -msgid "You are about to remove %s from your buddy list. Do you want to continue?" +msgid "" +"You are about to remove %s from your buddy list. Do you want to continue?" msgstr "Odstranili boste %s s seznama prijateljev. Ali želite nadaljevati?" msgid "Remove Buddy" @@ -11209,8 +12095,11 @@ msgid "_Remove Buddy" msgstr "_Odstrani prijatelja" #, c-format -msgid "You are about to remove the chat %s from your buddy list. Do you want to continue?" -msgstr "S seznama prijateljev boste odstranili pomenek %s. Ali želite nadaljevati?" +msgid "" +"You are about to remove the chat %s from your buddy list. Do you want to " +"continue?" +msgstr "" +"S seznama prijateljev boste odstranili pomenek %s. Ali želite nadaljevati?" msgid "Remove Chat" msgstr "Odstrani pomenek" @@ -11233,24 +12122,9 @@ msgstr "_Neprebrana sporočila" msgid "New _Message..." msgstr "Novo s_poročilo ..." -msgid "_Accounts" -msgstr "_Računi" - -msgid "Plu_gins" -msgstr "Vti_čniki" - -msgid "Pr_eferences" -msgstr "_Nastavitve" - -msgid "Mute _Sounds" -msgstr "_Utišaj zvoke" - msgid "_Blink on New Message" msgstr "_Utripaj ob novem sporočilu" -msgid "_Quit" -msgstr "I_zhod" - msgid "Not started" msgstr "Ni zagnano" @@ -11352,7 +12226,8 @@ msgid "\"Attention\" Name Color" msgstr "Ime barve \"Pozor\"" msgid "Color to draw the name of a message you received containing your name." -msgstr "Barva za izris imena sporočila, ki ste ga prejeli in ki vsebuje vaše ime." +msgstr "" +"Barva za izris imena sporočila, ki ste ga prejeli in ki vsebuje vaše ime." msgid "Action Message Name Color" msgstr "Ime barve sporočila dejanja" @@ -11430,7 +12305,9 @@ msgstr "_URL" msgid "_Description" msgstr "_Opis" -msgid "Please enter the URL and description of the link that you want to insert. The description is optional." +msgid "" +"Please enter the URL and description of the link that you want to insert. " +"The description is optional." msgstr "Vnesite URL in opis povezave, ki jo želite vstaviti. Opis ni obvezen." msgid "Please enter the URL of the link that you want to insert." @@ -11454,7 +12331,8 @@ msgid "" "This smiley is disabled because a custom smiley exists for this shortcut:\n" " %s" msgstr "" -"Ta smejček je onemogočen, ker za to kombinacijo tipk obstaja smejček po meri:\n" +"Ta smejček je onemogočen, ker za to kombinacijo tipk obstaja smejček po " +"meri:\n" " %s" msgid "Smile!" @@ -11566,16 +12444,28 @@ msgid "Check permissions and try again." msgstr "Preveri dovoljenja in poskusi znova." #, c-format -msgid "Are you sure you want to permanently delete the log of the conversation with %s which started at %s?" -msgstr "Ste prepričani, da želite povsem izbrisati dnevnik klepeta z %s, ki se je pričel ob %s?" +msgid "" +"Are you sure you want to permanently delete the log of the conversation with " +"%s which started at %s?" +msgstr "" +"Ste prepričani, da želite povsem izbrisati dnevnik klepeta z %s, ki se je " +"pričel ob %s?" #, c-format -msgid "Are you sure you want to permanently delete the log of the conversation in %s which started at %s?" -msgstr "Ste prepričani, da želite povsem izbrisati dnevnik klepeta v %s, ki se je pričel ob %s?" +msgid "" +"Are you sure you want to permanently delete the log of the conversation in " +"%s which started at %s?" +msgstr "" +"Ste prepričani, da želite povsem izbrisati dnevnik klepeta v %s, ki se je " +"pričel ob %s?" #, c-format -msgid "Are you sure you want to permanently delete the system log which started at %s?" -msgstr "Ste prepričani, da želite povsem izbrisati sistemski dnevnik, ki se je pričel ob %s?" +msgid "" +"Are you sure you want to permanently delete the system log which started at " +"%s?" +msgstr "" +"Ste prepričani, da želite povsem izbrisati sistemski dnevnik, ki se je " +"pričel ob %s?" msgid "Delete Log?" msgstr "Želite izbrisati dnevnik?" @@ -11637,7 +12527,8 @@ msgid "" " Without this only the first account will be enabled)." msgstr "" "omogoči naveden(e) račun(e) (neobvezen argument IME\n" -" določa račune, ki naj bodo uporabljeni, ločene z vejicami;\n" +" določa račune, ki naj bodo uporabljeni, ločene z " +"vejicami;\n" " brez tega bo omogočen le prvi račun)" msgid "X display to use" @@ -11733,8 +12624,11 @@ msgstr "Ni bilo mogoče odprti URL" msgid "Error launching \"%s\": %s" msgstr "Napaka pri zagonu \"%s\": %s" -msgid "The 'Manual' browser command has been chosen, but no command has been set." -msgstr "Vašega brskalnika ni bilo mogoče zagnati, ker ste v nastavitvah izbrali poljuben brskalnik, a niste nastavili ukaza." +msgid "" +"The 'Manual' browser command has been chosen, but no command has been set." +msgstr "" +"Vašega brskalnika ni bilo mogoče zagnati, ker ste v nastavitvah izbrali " +"poljuben brskalnik, a niste nastavili ukaza." msgid "No message" msgstr "Ni sporočil" @@ -11759,7 +12653,8 @@ msgid "Dismiss" msgstr "Opusti" msgid "You have pounced!" -msgstr "Dobili ste opozorilo prijatelja!" +msgstr "" +"Dobili ste opozorilo prijatelja!" msgid "The following plugins will be unloaded." msgstr "Odloženi bodo naslednji vtičniki." @@ -11773,8 +12668,12 @@ msgstr "Odloži vtičnike" msgid "Could not unload plugin" msgstr "Vtičnika ni mogoče odložiti" -msgid "The plugin could not be unloaded now, but will be disabled at the next startup." -msgstr "Vtičnika zdaj ni mogoče odložiti, vendar bo ob naslednjem zagonu programa onemogočen." +msgid "" +"The plugin could not be unloaded now, but will be disabled at the next " +"startup." +msgstr "" +"Vtičnika zdaj ni mogoče odložiti, vendar bo ob naslednjem zagonu programa " +"onemogočen." #, c-format msgid "" @@ -11947,7 +12846,8 @@ msgstr "Izbire tem" #. Instructions msgid "" "Select a theme that you would like to use from the lists below.\n" -"New themes can be installed by dragging and dropping them onto the theme list." +"New themes can be installed by dragging and dropping them onto the theme " +"list." msgstr "" "S spodnjega seznama izberite temo, ki jih želite uporabljati.\n" "Nove teme lahko namestite, če jih povlečete in spustite na seznam tem." @@ -12077,8 +12977,12 @@ msgstr "_Pisava pogovora:" msgid "Default Formatting" msgstr "Privzeto oblikovanje" -msgid "This is how your outgoing message text will appear when you use protocols that support formatting." -msgstr "Tako bo videti besedilo vašega odhodnega sporočila, če uporabljate protokole, ki podpirajo oblikovanje." +msgid "" +"This is how your outgoing message text will appear when you use protocols " +"that support formatting." +msgstr "" +"Tako bo videti besedilo vašega odhodnega sporočila, če uporabljate " +"protokole, ki podpirajo oblikovanje." msgid "Cannot start proxy configuration program." msgstr "Konfiguracijskega programa za posredovalni strežnik ni mogoče zagnati." @@ -12227,7 +13131,8 @@ msgid "Proxy preferences are configured in GNOME preferences" msgstr "Nastavitve posredovalnega strežnika določite v nastavitvah GNOME" msgid "Proxy configuration program was not found." -msgstr "Konfiguracijskega programa posredovalnega strežnika ni mogoče najti." +msgstr "" +"Konfiguracijskega programa posredovalnega strežnika ni mogoče najti." msgid "Configure _Proxy" msgstr "Prilagodi po_sredovalni strežnik" @@ -12401,7 +13306,8 @@ msgid "Type a user you permit to contact you." msgstr "Vpišite uporabnika, ki mu želiš dovoliti, da stopi v stik z vami." msgid "Please enter the name of the user you wish to be able to contact you." -msgstr "Prosim vnesite ime uporabnika, ki mu želite omogočiti, da stopi v stik z vami" +msgstr "" +"Prosim vnesite ime uporabnika, ki mu želite omogočiti, da stopi v stik z vami" msgid "_Permit" msgstr "_Dovoli" @@ -12489,7 +13395,8 @@ msgid "Status for %s" msgstr "Stanje za %s" #, c-format -msgid "A custom smiley for '%s' already exists. Please use a different shortcut." +msgid "" +"A custom smiley for '%s' already exists. Please use a different shortcut." msgstr "Smejček po meri za '%s' že obstaja. Navedite druge tipke za bližnjico." msgid "Custom Smiley" @@ -12541,12 +13448,6 @@ msgstr "Shranjena stanja ..." msgid "Status Selector" msgstr "Izbirnik stanja" -msgid "Google Talk" -msgstr "Google Talk" - -msgid "Facebook (XMPP)" -msgstr "Facebook (XMPP)" - #, c-format msgid "The following error has occurred loading %s: %s" msgstr "Pri odpiranju %s je prišlo do neznane napake: %s" @@ -12559,14 +13460,20 @@ msgid "Cannot send folder %s." msgstr "Ni mogoče poslati mape %s." #, c-format -msgid "%s cannot transfer a folder. You will need to send the files within individually." +msgid "" +"%s cannot transfer a folder. You will need to send the files within " +"individually." msgstr "Mape %s ni mogoče prenesti. Datoteke boste morali poslati posamično." msgid "You have dragged an image" msgstr "Povlekli ste sliko" -msgid "You can send this image as a file transfer, embed it into this message, or use it as the buddy icon for this user." -msgstr "To sliko lahko pošljete kot datoteko, jo vključite v to sporočilo ali uporabite kot ikono za tega uporabnika." +msgid "" +"You can send this image as a file transfer, embed it into this message, or " +"use it as the buddy icon for this user." +msgstr "" +"To sliko lahko pošljete kot datoteko, jo vključite v to sporočilo ali " +"uporabite kot ikono za tega uporabnika." msgid "Set as buddy icon" msgstr "Nastavi kot ikono prijatelja" @@ -12580,11 +13487,19 @@ msgstr "Vstavi v sporočilo" msgid "Would you like to set it as the buddy icon for this user?" msgstr "Jo želite nastaviti za ikono prijatelja?" -msgid "You can send this image as a file transfer, or use it as the buddy icon for this user." -msgstr "To sliko lahko pošljete kot datoteko ali uporabite kot ikono za tega uporabnika." +msgid "" +"You can send this image as a file transfer, or use it as the buddy icon for " +"this user." +msgstr "" +"To sliko lahko pošljete kot datoteko ali uporabite kot ikono za tega " +"uporabnika." -msgid "You can insert this image into this message, or use it as the buddy icon for this user" -msgstr "To sliko lahko vstavite v to sporočilo ali pa jo uporabite kot ikono prijatelja za tega prijatelja" +msgid "" +"You can insert this image into this message, or use it as the buddy icon for " +"this user" +msgstr "" +"To sliko lahko vstavite v to sporočilo ali pa jo uporabite kot ikono " +"prijatelja za tega prijatelja" #. I don't know if we really want to do anything here. Most of #. * the desktop item types are crap like "MIME Type" (I have no @@ -12597,8 +13512,12 @@ msgstr "To sliko lahko vstavite v to sporočilo ali pa jo uporabite kot ikono pr msgid "Cannot send launcher" msgstr "Ni mogoče poslati zaganjalnika" -msgid "You dragged a desktop launcher. Most likely you wanted to send the target of this launcher instead of this launcher itself." -msgstr "Povlekli ste namizni zaganjalnik. Najverjetneje ste želeli namesto samega zaganjalnika poslati tisto, na kar ta zaganjalnik kaže." +msgid "" +"You dragged a desktop launcher. Most likely you wanted to send the target of " +"this launcher instead of this launcher itself." +msgstr "" +"Povlekli ste namizni zaganjalnik. Najverjetneje ste želeli namesto samega " +"zaganjalnika poslati tisto, na kar ta zaganjalnik kaže." #, c-format msgid "" @@ -12612,7 +13531,8 @@ msgstr "" #, c-format msgid "The file '%s' is too large for %s. Please try a smaller image.\n" -msgstr "Datoteka '%s' je prevelika za %s. Prosimo, poskusite z manjšo sliko.\n" +msgstr "" +"Datoteka '%s' je prevelika za %s. Prosimo, poskusite z manjšo sliko.\n" msgid "Icon Error" msgstr "Napaka ikone" @@ -12661,18 +13581,12 @@ msgstr "Psev_donim" msgid "Close _tabs" msgstr "Zapri _zavihke" -msgid "_Get Info" -msgstr "_Informacije" - msgid "_Invite" msgstr "Povab_i" msgid "_Modify..." msgstr "_Spremeni ..." -msgid "_Add..." -msgstr "_Dodaj ..." - msgid "_Open Mail" msgstr "_Odpri pošto" @@ -12755,8 +13669,12 @@ msgstr "Prijatelj ni na zvezi" msgid "Point values to use when..." msgstr "Vrednosti točk, ko ..." -msgid "The buddy with the largest score is the buddy who will have priority in the contact.\n" -msgstr "Prijatelj z največjim rezultatom je tisti, ki bo imel prioriteto pri stiku.\n" +msgid "" +"The buddy with the largest score is the buddy who will have priority " +"in the contact.\n" +msgstr "" +"Prijatelj z največjim rezultatom je tisti, ki bo imel prioriteto pri " +"stiku.\n" msgid "Use last buddy when scores are equal" msgstr "Uporabi zadnjega prijatelja, ko so rezultati poravnani" @@ -12776,12 +13694,18 @@ msgstr "Prednost stika" #. *< name #. *< version #. *< summary -msgid "Allows for controlling the values associated with different buddy states." -msgstr "Omogoča nastavljanje vrednosti, povezanih z različnimi stanji prijateljev." +msgid "" +"Allows for controlling the values associated with different buddy states." +msgstr "" +"Omogoča nastavljanje vrednosti, povezanih z različnimi stanji prijateljev." #. *< description -msgid "Allows for changing the point values of idle/away/offline states for buddies in contact priority computations." -msgstr "Omogoča nastavljanje vrednosti točk pri računanju prednosti stikov za stanja prijateljev nedejaven/odsoten/ni na zvezi." +msgid "" +"Allows for changing the point values of idle/away/offline states for buddies " +"in contact priority computations." +msgstr "" +"Omogoča nastavljanje vrednosti točk pri računanju prednosti stikov za stanja " +"prijateljev nedejaven/odsoten/ni na zvezi." msgid "Conversation Colors" msgstr "Barve pogovora" @@ -12875,8 +13799,12 @@ msgstr "Odkrivanje storitev XMPP" msgid "Allows browsing and registering services." msgstr "Dovoljuje brskanje in registracijo storitev." -msgid "This plugin is useful for registering with legacy transports or other XMPP services." -msgstr "Ta vtičnik je uporaben za registriranje z opuščenimi prenosi ali drugimi storitvami XMPP." +msgid "" +"This plugin is useful for registering with legacy transports or other XMPP " +"services." +msgstr "" +"Ta vtičnik je uporaben za registriranje z opuščenimi prenosi ali drugimi " +"storitvami XMPP." msgid "By conversation count" msgstr "Po številu pomenkov" @@ -12885,8 +13813,12 @@ msgid "Conversation Placement" msgstr "Postavitev pomenkov" #. Translators: "New conversations" should match the text in the preferences dialog and "By conversation count" should be the same text used above -msgid "Note: The preference for \"New conversations\" must be set to \"By conversation count\"." -msgstr "Opomba: Nastavitev za \"Nove pomenke\" mora biti nastavljena na \"Po številu pomenkov\"." +msgid "" +"Note: The preference for \"New conversations\" must be set to \"By " +"conversation count\"." +msgstr "" +"Opomba: Nastavitev za \"Nove pomenke\" mora biti nastavljena na \"Po številu " +"pomenkov\"." msgid "Number of conversations per window" msgstr "Število pomenkov v oknu" @@ -12910,8 +13842,12 @@ msgstr "Dodatne možnosti postavitve pomenka." #. *< summary #. * description -msgid "Restrict the number of conversations per windows, optionally separating IMs and Chats" -msgstr "Omeji število pomenkov po oknih z možnostjo ločitve oken za klepet in zasebni pomenek" +msgid "" +"Restrict the number of conversations per windows, optionally separating IMs " +"and Chats" +msgstr "" +"Omeji število pomenkov po oknih z možnostjo ločitve oken za klepet in " +"zasebni pomenek" #. Configuration frame msgid "Mouse Gestures Configuration" @@ -12944,12 +13880,14 @@ msgstr "Omogoča podporo za geste miške" #. * description msgid "" -"Allows support for mouse gestures in conversation windows. Drag the middle mouse button to perform certain actions:\n" +"Allows support for mouse gestures in conversation windows. Drag the middle " +"mouse button to perform certain actions:\n" " • Drag down and then to the right to close a conversation.\n" " • Drag up and then to the left to switch to the previous conversation.\n" " • Drag up and then to the right to switch to the next conversation." msgstr "" -"Omogoča podporo za geste miške v pogovornih oknih. Povlecite s srednjo miškino tipko, da storite naslednje:\n" +"Omogoča podporo za geste miške v pogovornih oknih. Povlecite s srednjo " +"miškino tipko, da storite naslednje:\n" " • Povlecite navzdol in zatem desno, da končate pogovor.\n" " • Povlecite navzgor in zatem levo, da se vrnete k prejšnjemu pogovoru.\n" " Povlecite navzgor in zatem desno, da se premaknete k naslednjemu pogovoru." @@ -12973,8 +13911,12 @@ msgid "Select Buddy" msgstr "Izberi prijatelja" #. Add the label. -msgid "Select a person from your address book to add this buddy to, or create a new person." -msgstr "Izberite osebo iz vašega adresarja, ki ji želite dodati tega prijatelja, ali ustvarite novo osebo." +msgid "" +"Select a person from your address book to add this buddy to, or create a new " +"person." +msgstr "" +"Izberite osebo iz vašega adresarja, ki ji želite dodati tega prijatelja, ali " +"ustvarite novo osebo." #. Add the expander msgid "User _details" @@ -13095,7 +14037,8 @@ msgid "Checks for new local mail." msgstr "Preveri morebitno novoprispelo pošto." msgid "Adds a small box to the buddy list that shows if you have new mail." -msgstr "Doda majhno škatlo na seznam prijateljev, ki prikazuje, ali imate novo pošto." +msgstr "" +"Doda majhno škatlo na seznam prijateljev, ki prikazuje, ali imate novo pošto." msgid "Markerline" msgstr "Označevalna črta" @@ -13115,8 +14058,12 @@ msgstr "oknih _neposrednih pogovorov" msgid "C_hat windows" msgstr "_pogovornih oknih" -msgid "A music messaging session has been requested. Please click the MM icon to accept." -msgstr "Zahtevana je seja glasbenega sporočanja. Prosimo, kliknite ikono MM za sprejem." +msgid "" +"A music messaging session has been requested. Please click the MM icon to " +"accept." +msgstr "" +"Zahtevana je seja glasbenega sporočanja. Prosimo, kliknite ikono MM za " +"sprejem." msgid "Music messaging session confirmed." msgstr "Seja glasbenega sporočanja potrjena." @@ -13155,8 +14102,12 @@ msgid "Music Messaging Plugin for collaborative composition." msgstr "Vtičnik za glasbeno sporočanje - za skupinsko skladanje." #. * summary -msgid "The Music Messaging Plugin allows a number of users to simultaneously work on a piece of music by editing a common score in real-time." -msgstr "Vtičnik za glasbeno sporočanje omogoča več uporabnikom hkratno sodelovanje pri glasbenem ustvarjanju kompozicije v resničnem času." +msgid "" +"The Music Messaging Plugin allows a number of users to simultaneously work " +"on a piece of music by editing a common score in real-time." +msgstr "" +"Vtičnik za glasbeno sporočanje omogoča več uporabnikom hkratno sodelovanje " +"pri glasbenem ustvarjanju kompozicije v resničnem času." #. ---------- "Notify For" ---------- msgid "Notify For" @@ -13354,8 +14305,13 @@ msgstr "Direktno" msgid "Lets you send raw input to text-based protocols." msgstr "Omogoča neposreden vnos v protokole." -msgid "Lets you send raw input to text-based protocols (XMPP, MSN, IRC, TOC). Hit 'Enter' in the entry box to send. Watch the debug window." -msgstr "Omogoča pošiljanje golih ukazov za protokole, ki temeljijo na besedilu (XMPP, MSN, IRC, TOC). Pritisnite 'Enter' za pošiljanje in opazujte razhroščevalno okno." +msgid "" +"Lets you send raw input to text-based protocols (XMPP, MSN, IRC, TOC). Hit " +"'Enter' in the entry box to send. Watch the debug window." +msgstr "" +"Omogoča pošiljanje golih ukazov za protokole, ki temeljijo na besedilu " +"(XMPP, MSN, IRC, TOC). Pritisnite 'Enter' za pošiljanje in opazujte " +"razhroščevalno okno." #, c-format msgid "You can upgrade to %s %s today." @@ -13386,8 +14342,12 @@ msgid "Checks periodically for new releases." msgstr "Preverjaj, ali je na voljo nova različica." #. * description -msgid "Checks periodically for new releases and notifies the user with the ChangeLog." -msgstr "Preverja, ali je na voljo nova različica in uporabika seznanja z dnevnikom sprememb." +msgid "" +"Checks periodically for new releases and notifies the user with the " +"ChangeLog." +msgstr "" +"Preverja, ali je na voljo nova različica in uporabika seznanja z dnevnikom " +"sprememb." #. *< major version #. *< minor version @@ -13406,8 +14366,12 @@ msgid "Conversation Window Send Button." msgstr "Gumb Pošlji okna pogovora" #. *< summary -msgid "Adds a Send button to the entry area of the conversation window. Intended for use when no physical keyboard is present." -msgstr "Doda gumb Pošlji v vnosno območje pogovornega okna. Namenjeno za primere, ko tipkovnica ni fizično prisotna." +msgid "" +"Adds a Send button to the entry area of the conversation window. Intended " +"for use when no physical keyboard is present." +msgstr "" +"Doda gumb Pošlji v vnosno območje pogovornega okna. Namenjeno za primere, ko " +"tipkovnica ni fizično prisotna." msgid "Duplicate Correction" msgstr "Popravek dvojnikov" @@ -13441,7 +14405,8 @@ msgstr "Jaz _pošljem:" #. Created here so it can be passed to whole_words_button_toggled. msgid "_Exact case match (uncheck for automatic case handling)" -msgstr "_Natanko ujemanje velikih in malih črk (ne označi za samodejno ravnanje)" +msgstr "" +"_Natanko ujemanje velikih in malih črk (ne označi za samodejno ravnanje)" msgid "Only replace _whole words" msgstr "Zamenjaj le _cele besede" @@ -13456,7 +14421,8 @@ msgid "Text replacement" msgstr "Zamenjava besedila" msgid "Replaces text in outgoing messages according to user-defined rules." -msgstr "Zamenja besedilo v odhodnih sporočilih po uporabniško določenih pravilih." +msgstr "" +"Zamenja besedilo v odhodnih sporočilih po uporabniško določenih pravilih." msgid "Just logged in" msgstr "Ravnokar prijavljen" @@ -13635,8 +14601,12 @@ msgid "Customizes the message timestamp formats." msgstr "Prilagodi oblike časovnega žiga sporočil po meri." #. * description -msgid "This plugin allows the user to customize conversation and logging message timestamp formats." -msgstr "Ta vtičnik omogoča uporabniku prilagajati zapis časovnega žiga pogovorov in dnevniških sporočil." +msgid "" +"This plugin allows the user to customize conversation and logging message " +"timestamp formats." +msgstr "" +"Ta vtičnik omogoča uporabniku prilagajati zapis časovnega žiga pogovorov in " +"dnevniških sporočil." msgid "Audio" msgstr "Zvok" @@ -13697,7 +14667,9 @@ msgstr "Prilagodite svoj mikrofon in spletno kamero." #. *< summary msgid "Configure microphone and webcam settings for voice/video calls." -msgstr "Prilagodite nastavitve za mikrofon in spletno kamero za zvočne oz. video klice." +msgstr "" +"Prilagodite nastavitve za mikrofon in spletno kamero za zvočne oz. video " +"klice." msgid "Opacity:" msgstr "Neprosojnost:" @@ -13745,11 +14717,13 @@ msgstr "Poljubna prosojnost seznama prijateljev in pomenkov." #. * description msgid "" -"This plugin enables variable alpha transparency on conversation windows and the buddy list.\n" +"This plugin enables variable alpha transparency on conversation windows and " +"the buddy list.\n" "\n" "* Note: This plugin requires Win2000 or greater." msgstr "" -"Ta vtičnik omogoči poljubno nastavitev prosojnosti pogovornih oken in seznama prijateljev.\n" +"Ta vtičnik omogoči poljubno nastavitev prosojnosti pogovornih oken in " +"seznama prijateljev.\n" "\n" "* Pozor: Ta vtičnik zahteva Win2000 ali novejše." @@ -13781,8 +14755,11 @@ msgstr "Možnosti Pidgin za okolje Windows" msgid "Options specific to Pidgin for Windows." msgstr "Nastavitve, specifične za %s v okolju Windows." -msgid "Provides options specific to Pidgin for Windows, such as buddy list docking." -msgstr "Ponuja nastavitve, specifične za Pidgin v okolju Windows, kot je sidranje seznama prijateljev." +msgid "" +"Provides options specific to Pidgin for Windows, such as buddy list docking." +msgstr "" +"Ponuja nastavitve, specifične za Pidgin v okolju Windows, kot je sidranje " +"seznama prijateljev." msgid "Logged out." msgstr "Odjavljeni." @@ -13810,18 +14787,27 @@ msgstr "Pošlijaj in sprejemaj surove vrstice XMPP." #. * description msgid "This plugin is useful for debugging XMPP servers or clients." -msgstr "Ta vtičnik je uporaben za razhroščevanje strežnikov ali odjemalcev XMPP." +msgstr "" +"Ta vtičnik je uporaben za razhroščevanje strežnikov ali odjemalcev XMPP." #. $(^Name) is the current Version name (e.g. Pidgin 2.7.0). $_CLICK will become a translated version of "Click Next to continue." DO NOT translate the CLICK in $_CLICK. It will break the installer. -msgid "$(^Name) is released under the GNU General Public License (GPL). The license is provided here for information purposes only. $_CLICK" -msgstr "$(^Name) je izdan pod licenco GPL. Ta licenca je tu na voljo le v informativne namene. $_CLICK" +msgid "" +"$(^Name) is released under the GNU General Public License (GPL). The license " +"is provided here for information purposes only. $_CLICK" +msgstr "" +"$(^Name) je izdan pod licenco GPL. Ta licenca je tu na voljo le v " +"informativne namene. $_CLICK" #. Installer Subsection Detailed Description msgid "A multi-platform GUI toolkit, used by Pidgin" msgstr "Več-platformsko orodje za vmesnike, ki ga uporablja Pidgin" -msgid "An instance of Pidgin is currently running. Please exit Pidgin and try again." -msgstr "Trenutno že teče ena različica Pidgina. Prosimo, zaprite aplikacijo in poskusite znova." +msgid "" +"An instance of Pidgin is currently running. Please exit Pidgin and try " +"again." +msgstr "" +"Trenutno že teče ena različica Pidgina. Prosimo, zaprite aplikacijo in " +"poskusite znova." #. Installer Subsection Detailed Description msgid "Core Pidgin files and dlls" @@ -13844,17 +14830,34 @@ msgid "Desktop" msgstr "Namizje" #. $R2 will display the URL that the GTK+ Runtime failed to download from -msgid "Error Downloading the GTK+ Runtime ($R2).$\\rThis is required for Pidgin to function; if retrying fails, you may need to use the 'Offline Installer' from http://pidgin.im/download/windows/ ." -msgstr "Napaka pri prenašanju izvajalnega okolja GTK+ ($R2).$\\rTa je potreben za delovanje Pidgina; če ponoven poskus ne uspe, boste morali uporabiti 'polni namestitveni paket' z naslova http://pidgin.im/download/windows/" +msgid "" +"Error Downloading the GTK+ Runtime ($R2).$\\rThis is required for Pidgin to " +"function; if retrying fails, you may need to use the 'Offline Installer' " +"from http://pidgin.im/download/windows/ ." +msgstr "" +"Napaka pri prenašanju izvajalnega okolja GTK+ ($R2).$\\rTa je potreben za " +"delovanje Pidgina; če ponoven poskus ne uspe, boste morali uporabiti 'polni " +"namestitveni paket' z naslova http://pidgin.im/download/windows/" #. $R2 will display the URL that the Debug Symbols failed to download from -msgid "Error Installing Debug Symbols ($R2).$\\rIf retrying fails, you may need to use the 'Offline Installer' from http://pidgin.im/download/windows/ ." -msgstr "Napaka pri nameščanju simbolov razhroščevanja ($R2).$\\rČe ponoven poskus ne uspe, boste morali uporabiti 'polni namestitveni paket' z naslova http://pidgin.im/download/windows/" +msgid "" +"Error Installing Debug Symbols ($R2).$\\rIf retrying fails, you may need to " +"use the 'Offline Installer' from http://pidgin.im/download/windows/ ." +msgstr "" +"Napaka pri nameščanju simbolov razhroščevanja ($R2).$\\rČe ponoven poskus ne " +"uspe, boste morali uporabiti 'polni namestitveni paket' z naslova http://" +"pidgin.im/download/windows/" #. $R3 will display the URL that the Dictionary failed to download from #, no-c-format -msgid "Error Installing Spellchecking ($R3).$\\rIf retrying fails, manual installation instructions are at: http://developer.pidgin.im/wiki/Installing%20Pidgin#manual_win32_spellcheck_installation" -msgstr "Napaka pri nameščanju preverjanja črkovanja ($R3).$\\rČe ponovni poskus ne uspe, najdete navodila za ročno namestitev na naslovu: http://developer.pidgin.im/wiki/Installing%20Pidgin#manual_win32_spellcheck_installation" +msgid "" +"Error Installing Spellchecking ($R3).$\\rIf retrying fails, manual " +"installation instructions are at: http://developer.pidgin.im/wiki/Installing" +"%20Pidgin#manual_win32_spellcheck_installation" +msgstr "" +"Napaka pri nameščanju preverjanja črkovanja ($R3).$\\rČe ponovni poskus ne " +"uspe, najdete navodila za ročno namestitev na naslovu: http://developer." +"pidgin.im/wiki/Installing%20Pidgin#manual_win32_spellcheck_installation" #. Installer Subsection Text msgid "GTK+ Runtime (required if not present)" @@ -13872,8 +14875,13 @@ msgstr "Naprej >" msgid "Pidgin Instant Messaging Client (required)" msgstr "Pidgin - odjemalec za klepet (zahtevano)" -msgid "Pidgin requires a compatible GTK+ Runtime (which doesn't appear to be already present).$\\rAre you sure you want to skip installing the GTK+ Runtime?" -msgstr "Pidgin potrebuje združljivo izvajalno okolje GTK+ (ki očitno ni na voljo).$\\rSte prepričani, da želite preskočiti nameščanje izvajalnega okolja GTK+?" +msgid "" +"Pidgin requires a compatible GTK+ Runtime (which doesn't appear to be " +"already present).$\\rAre you sure you want to skip installing the GTK+ " +"Runtime?" +msgstr "" +"Pidgin potrebuje združljivo izvajalno okolje GTK+ (ki očitno ni na voljo).$" +"\\rSte prepričani, da želite preskočiti nameščanje izvajalnega okolja GTK+?" #. Installer Subsection Text msgid "Shortcuts" @@ -13892,21 +14900,31 @@ msgid "Start Menu" msgstr "Začetni meni" #. Installer Subsection Detailed Description -msgid "Support for Spellchecking. (Internet connection required for installation)" -msgstr "Podpora preverjanja črkovanja. (Za namestitev je potrebna spletna povezava)" +msgid "" +"Support for Spellchecking. (Internet connection required for installation)" +msgstr "" +"Podpora preverjanja črkovanja. (Za namestitev je potrebna spletna povezava)" msgid "The installer is already running." msgstr "Nameščanje že poteka." -msgid "The uninstaller could not find registry entries for Pidgin.$\\rIt is likely that another user installed this application." -msgstr "Vnosov za Pidgin v registru ni mogoče najti.$\\rNajverjetneje je ta program namestil drug uporabnik." +msgid "" +"The uninstaller could not find registry entries for Pidgin.$\\rIt is likely " +"that another user installed this application." +msgstr "" +"Vnosov za Pidgin v registru ni mogoče najti.$\\rNajverjetneje je ta program " +"namestil drug uporabnik." #. Installer Subsection Text msgid "URI Handlers" msgstr "Upravljalnik URI" -msgid "Unable to uninstall the currently installed version of Pidgin. The new version will be installed without removing the currently installed version." -msgstr "Trenutno nameščene različice Pidgina ni mogoče odstraniti. Nova različica bo nameščena brez odstranitve trenutno nameščene različice." +msgid "" +"Unable to uninstall the currently installed version of Pidgin. The new " +"version will be installed without removing the currently installed version." +msgstr "" +"Trenutno nameščene različice Pidgina ni mogoče odstraniti. Nova različica bo " +"nameščena brez odstranitve trenutno nameščene različice." #. Text displayed on Installer Finish Page msgid "Visit the Pidgin Web Page" @@ -13915,3 +14933,327 @@ msgstr "Obiščite spletno stran Pidgin" msgid "You do not have permission to uninstall this application." msgstr "Za odstranitev programa nimate ustreznih pravic." +#~ msgid "" +#~ "Common name: %s %s\n" +#~ "Fingerprint (SHA1): %s" +#~ msgstr "" +#~ "Pogovorno ime: %s %s\n" +#~ "Prstni odtis (SHA1): %s" + +#~ msgid "_View Certificate..." +#~ msgstr "_Pokaži digitalno potrdilo ..." + +#~ msgid "Certificate Information" +#~ msgstr "Podatki o digitalnem potrdilu" + +#~ msgid "/Tools/Mute Sounds" +#~ msgstr "/Orodja/Utišaj zvoke" + +#~ msgid "/Buddies/New Instant _Message..." +#~ msgstr "/Prijatelji/Novo _neposredno sporočilo ..." + +#~ msgid "/Buddies/Join a _Chat..." +#~ msgstr "/Prijatelji/Pridruži se _pomenku ..." + +#~ msgid "/Buddies/Get User _Info..." +#~ msgstr "/Prijatelji/Informacije o _uporabniku ..." + +#~ msgid "/Buddies/View User _Log..." +#~ msgstr "/Prijatelji/Po_kaži uporabnikov dnevnik ..." + +#~ msgid "/Buddies/Sh_ow" +#~ msgstr "/Prijatelji/Poka_ži" + +#~ msgid "/Buddies/Show/_Offline Buddies" +#~ msgstr "/Prijatelji/Pokaži/Prijatelji, ki niso na _zvezi" + +#~ msgid "/Buddies/Show/_Empty Groups" +#~ msgstr "/Prijatelji/Pokaži/Prazne _skupine" + +#~ msgid "/Buddies/Show/Idle _Times" +#~ msgstr "/Prijatelji/Pokaži/_Časi nedejavnosti" + +#~ msgid "/Buddies/Show/_Protocol Icons" +#~ msgstr "/Prijatelji/Pokaži/_Ikone protokolov" + +#~ msgid "/Buddies/_Sort Buddies" +#~ msgstr "/Prijatelji/Razvrs_ti prijatelje" + +#~ msgid "/Buddies/_Add Buddy..." +#~ msgstr "/Prijatelji/Dodaj p_rijatelja ..." + +#~ msgid "/Buddies/Add C_hat..." +#~ msgstr "/Prijatelji/Dodaj p_omenek ..." + +#~ msgid "/Buddies/Add _Group..." +#~ msgstr "/Prijatelji/Dodaj _skupino ..." + +#~ msgid "/Buddies/_Quit" +#~ msgstr "/Prijatelji/Iz_hod" + +#~ msgid "/_Accounts" +#~ msgstr "/_Računi" + +#~ msgid "/Accounts/Manage Accounts" +#~ msgstr "/Računi/Upravljaj z računi" + +#~ msgid "/Tools/Buddy _Pounces" +#~ msgstr "/Orodja/_Opozorila prijateljev" + +#~ msgid "/Tools/_Certificates" +#~ msgstr "/Orodja/_Digitalna potrdila" + +#~ msgid "/Tools/Custom Smile_ys" +#~ msgstr "/Orodja/Smejč_ki po meri" + +#~ msgid "/Tools/Plu_gins" +#~ msgstr "/Orodja/Vtični_ki" + +#~ msgid "/Tools/Pr_eferences" +#~ msgstr "/Orodja/_Nastavitve" + +#~ msgid "/Tools/Pr_ivacy" +#~ msgstr "/Orodja/_Zasebnost" + +#~ msgid "/Tools/Set _Mood" +#~ msgstr "/Orodja/Nastavi _razpoloženje" + +#~ msgid "/Tools/_File Transfers" +#~ msgstr "/Orodja/_Prenosi datotek" + +#~ msgid "/Tools/R_oom List" +#~ msgstr "/Orodja/_Seznam sob" + +#~ msgid "/Tools/System _Log" +#~ msgstr "/Orodja/Siste_mski dnevnik" + +#~ msgid "/Tools/Mute _Sounds" +#~ msgstr "/Orodja/_Utišaj zvoke" + +#~ msgid "/Help/_Build Information" +#~ msgstr "/Pomoč/Podatki o _gradnji" + +#~ msgid "/Help/_Debug Window" +#~ msgstr "/Pomoč/Raz_hroščevalno okno" + +#~ msgid "/Help/De_veloper Information" +#~ msgstr "/Pomoč/Podatki o _razvijalcih" + +#~ msgid "/Help/_Plugin Information" +#~ msgstr "/Pomoč/Podatki o v_tičniku" + +#~ msgid "/Help/_Translator Information" +#~ msgstr "/Pomoč/Podatki o _prevajalcih" + +#~ msgid "/Help/_About" +#~ msgstr "/Pomoč/_O programu" + +#~ msgid "/Buddies/New Instant Message..." +#~ msgstr "/Prijatelji/Novo neposredno sporočilo ..." + +#~ msgid "/Buddies/Join a Chat..." +#~ msgstr "/Prijatelji/Pridruži se pomenku ..." + +#~ msgid "/Buddies/Get User Info..." +#~ msgstr "/Prijatelji/Informacije o uporabniku ..." + +#~ msgid "/Buddies/Add Buddy..." +#~ msgstr "/Prijatelji/Dodaj prijatelja ..." + +#~ msgid "/Buddies/Add Chat..." +#~ msgstr "/Prijatelji/Dodaj pomenek ..." + +#~ msgid "/Buddies/Add Group..." +#~ msgstr "/Prijatelji/Dodaj skupino ..." + +#~ msgid "/Tools/Privacy" +#~ msgstr "/Orodja/Zasebnost" + +#~ msgid "/Tools/Room List" +#~ msgstr "/Orodja/Seznam sob" + +#~ msgid "/Accounts" +#~ msgstr "/Računi" + +#~ msgid "/Buddies/Show/Offline Buddies" +#~ msgstr "/Prijatelji/Pokaži/Prijatelji, ki niso na zvezi" + +#~ msgid "/Buddies/Show/Empty Groups" +#~ msgstr "/Prijatelji/Pokaži/Prazne skupine" + +#~ msgid "/Buddies/Show/Buddy Details" +#~ msgstr "/Prijatelji/Pokaži/Podrobnosti prijateljev" + +#~ msgid "/Buddies/Show/Idle Times" +#~ msgstr "/Prijatelji/Pokaži/Časi nedejavnosti" + +#~ msgid "/Buddies/Show/Protocol Icons" +#~ msgstr "/Prijatelji/Pokaži/Ikone protokolov" + +#~ msgid "/Accounts/Enable Account" +#~ msgstr "/Računi/Omogoči račun" + +#~ msgid "/Accounts/" +#~ msgstr "/Računi/" + +#~ msgid "/Tools" +#~ msgstr "/Orodja" + +#~ msgid "/Buddies/Sort Buddies" +#~ msgstr "/Prijatelji/Razvrsti prijatelje" + +#~ msgid "/Conversation/New Instant _Message..." +#~ msgstr "/Pogovor/N_ovo neposredno sporočilo ..." + +#~ msgid "/Conversation/Join a _Chat..." +#~ msgstr "/Pogovor/Pridruži se klepetu ..." + +#~ msgid "/Conversation/_Find..." +#~ msgstr "/Pogovor/_Najdi ..." + +#~ msgid "/Conversation/View _Log" +#~ msgstr "/Pogovor/Pokaži _dnevnik ..." + +#~ msgid "/Conversation/_Save As..." +#~ msgstr "/Pogovor/_Shrani kot ..." + +#~ msgid "/Conversation/Clea_r Scrollback" +#~ msgstr "/Pogovor/Po_čisti pogovor" + +#~ msgid "/Conversation/M_edia" +#~ msgstr "/Pogovor/M_ediji" + +#~ msgid "/Conversation/Media/_Audio Call" +#~ msgstr "/Pogovor/Mediji/_Zvočni klic" + +#~ msgid "/Conversation/Media/_Video Call" +#~ msgstr "/Pogovor/Mediji/_Video klic" + +#~ msgid "/Conversation/Media/Audio\\/Video _Call" +#~ msgstr "/Pogovor/Mediji/Zvočni\\/Video _klic" + +#~ msgid "/Conversation/Se_nd File..." +#~ msgstr "/Pogovor/_Pošlji datoteko ..." + +#~ msgid "/Conversation/Get _Attention" +#~ msgstr "/Pogovor/Pridobi _pozornost" + +#~ msgid "/Conversation/Add Buddy _Pounce..." +#~ msgstr "/Pogovor/Dodaj _opozorilo prijatelja ..." + +#~ msgid "/Conversation/_Get Info" +#~ msgstr "/Pogovor/_Informacije" + +#~ msgid "/Conversation/In_vite..." +#~ msgstr "/Pogovor/Pova_bi ..." + +#~ msgid "/Conversation/M_ore" +#~ msgstr "/Pogovor/_Več" + +#~ msgid "/Conversation/Al_ias..." +#~ msgstr "/Pogovor/_Vzdevek ..." + +#~ msgid "/Conversation/_Block..." +#~ msgstr "/Pogovor/Zavr_ni ..." + +#~ msgid "/Conversation/_Unblock..." +#~ msgstr "/Pogovor/Pre_kliči zavrnitev ..." + +#~ msgid "/Conversation/_Add..." +#~ msgstr "/Pogovor/Dod_aj ..." + +#~ msgid "/Conversation/_Remove..." +#~ msgstr "/Pogovor/Odst_rani ..." + +#~ msgid "/Conversation/Insert Lin_k..." +#~ msgstr "/Pogovor/Vstavi pove_zavo ..." + +#~ msgid "/Conversation/Insert Imag_e..." +#~ msgstr "/Pogovor/Vstavi _sliko ..." + +#~ msgid "/Conversation/_Close" +#~ msgstr "/Pogovor/_Zapri" + +#~ msgid "/Options/Enable _Logging" +#~ msgstr "/Možnosti/Vk_ljuči dnevnik" + +#~ msgid "/Options/Enable _Sounds" +#~ msgstr "/Možnosti/Vključi _zvoke" + +#~ msgid "/Options/Show Ti_mestamps" +#~ msgstr "/Možnosti/Pokaži _časovne žige" + +#~ msgid "/Conversation/More" +#~ msgstr "/Pogovor/Več" + +#~ msgid "/Options" +#~ msgstr "/Možnosti" + +#~ msgid "/Conversation" +#~ msgstr "/Pogovor" + +#~ msgid "/Conversation/View Log" +#~ msgstr "/Pogovor/Pokaži dnevnik" + +#~ msgid "/Conversation/Media/Audio Call" +#~ msgstr "/Pogovor/Mediji/Zvočni klic" + +#~ msgid "/Conversation/Media/Video Call" +#~ msgstr "/Pogovor/Mediji/Video klic" + +#~ msgid "/Conversation/Media/Audio\\/Video Call" +#~ msgstr "/Pogovor/Mediji/Zvočni\\/Video klic" + +#~ msgid "/Conversation/Send File..." +#~ msgstr "/Pogovor/Pošlji datoteko ..." + +#~ msgid "/Conversation/Get Attention" +#~ msgstr "/Pogovor/Pridobi pozornost" + +#~ msgid "/Conversation/Add Buddy Pounce..." +#~ msgstr "/Pogovor/Dodaj opozorilo prijatelja ..." + +#~ msgid "/Conversation/Get Info" +#~ msgstr "/Pogovor/Informacije" + +#~ msgid "/Conversation/Invite..." +#~ msgstr "/Pogovor/Povabi ..." + +#~ msgid "/Conversation/Alias..." +#~ msgstr "/Pogovor/Psevdonim ..." + +#~ msgid "/Conversation/Block..." +#~ msgstr "/Pogovor/Zavrni ..." + +#~ msgid "/Conversation/Unblock..." +#~ msgstr "/Pogovor/Prekliči zavrnitev ..." + +#~ msgid "/Conversation/Add..." +#~ msgstr "/Pogovor/Dodaj ..." + +#~ msgid "/Conversation/Remove..." +#~ msgstr "/Pogovor/Odstrani ..." + +#~ msgid "/Conversation/Insert Link..." +#~ msgstr "/Pogovor/Vstavi povezavo ..." + +#~ msgid "/Conversation/Insert Image..." +#~ msgstr "/Pogovor/Vstavi sliko ..." + +#~ msgid "/Options/Enable Logging" +#~ msgstr "/Možnosti/Vključi dnevnik" + +#~ msgid "/Options/Enable Sounds" +#~ msgstr "/Možnosti/Vključi zvoke" + +#~ msgid "/Options/Show Formatting Toolbars" +#~ msgstr "/Možnosti/Pokaži orodno vrstico za oblikovanje" + +#~ msgid "/Options/Show Timestamps" +#~ msgstr "/Možnosti/Pokaži časovne žige" + +#~ msgid "Google Talk" +#~ msgstr "Google Talk" + +#~ msgid "Facebook (XMPP)" +#~ msgstr "Facebook (XMPP)" -- cgit v1.2.1 From 2a3f631106bb234769e63ea8a19a5718222e126b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 15 Mar 2012 04:25:32 +0000 Subject: Fix buddies not going offline. Fixes #14997. --- ChangeLog | 1 + libpurple/protocols/msn/notification.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 05d8259030..71c150e423 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ version 3.0.0 (??/??/????): MSN: * Fix file transfer with older Mac MSN clients. * Support file transfers up to ~9 EiB. + * Fix buddies not going offline. MXit: * Remove all reference to Hidden Number. diff --git a/libpurple/protocols/msn/notification.c b/libpurple/protocols/msn/notification.c index cff0147691..ebc6eee977 100644 --- a/libpurple/protocols/msn/notification.c +++ b/libpurple/protocols/msn/notification.c @@ -1013,11 +1013,16 @@ static void fln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { MsnUser *user; + char *passport; + int networkid; /* Tell libpurple that the user has signed off */ - user = msn_userlist_find_user(cmdproc->session->userlist, cmd->params[0]); + msn_parse_user(cmd->params[0], &passport, &networkid); + user = msn_userlist_find_user(cmdproc->session->userlist, passport); msn_user_set_state(user, NULL); msn_user_update(user); + + g_free(passport); } static void -- cgit v1.2.1 From 14ac8445d7cbf0fafda18e7e33c8bc5faa241e32 Mon Sep 17 00:00:00 2001 From: Bj?rn Voigt Date: Mon, 26 Mar 2012 18:20:20 +0000 Subject: German translation update --- po/de.po | 936 +++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 549 insertions(+), 387 deletions(-) diff --git a/po/de.po b/po/de.po index bd9647b6af..730cad75c1 100644 --- a/po/de.po +++ b/po/de.po @@ -11,8 +11,8 @@ msgid "" msgstr "" "Project-Id-Version: de\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-12-11 10:41+0100\n" -"PO-Revision-Date: 2011-12-11 10:40+0100\n" +"POT-Creation-Date: 2012-03-26 20:19+0200\n" +"PO-Revision-Date: 2012-03-26 19:31+0200\n" "Last-Translator: Jochen Kemnade \n" "Language-Team: German \n" "Language: de\n" @@ -905,7 +905,6 @@ msgstr "Anrufen..." msgid "Hangup" msgstr "Auflegen" -#. Number of actions msgid "Accept" msgstr "Akzeptieren" @@ -1744,22 +1743,20 @@ msgstr "Das Zertifikat wurde widerrufen." msgid "An unknown certificate error occurred." msgstr "Es ist ein unbekannter Zertifikatfehler aufgetreten." +msgid "(MATCH)" +msgstr "(ÜBEREINSTIMMUNG)" + msgid "(DOES NOT MATCH)" -msgstr "(stimmt nicht überein)" +msgstr "(KEINE ÜBEREINSTIMMUNG)" -#. Make messages #, c-format msgid "%s has presented the following certificate for just-this-once use:" msgstr "" "%s hat das folgende Zertifikat für den einmaligen Gebrauch präsentiert:" #, c-format -msgid "" -"Common name: %s %s\n" -"Fingerprint (SHA1): %s" -msgstr "" -"Allgemeiner Name (Common name:) %s %s\n" -"Fingerabdruck (SHA1): %s" +msgid "Common name: %s %s" +msgstr "Allgemeiner Name (Common name): %s %s" #. TODO: Find what the handle ought to be msgid "Single-use Certificate Verification" @@ -1775,7 +1772,6 @@ msgstr "Zertifizierungsstelle" msgid "SSL Peers Cache" msgstr "SSL-Peers-Zwischenspeicher" -#. Make messages #, c-format msgid "Accept certificate for %s?" msgstr "Akzeptieren Sie das Zertifikat für %s?" @@ -1784,9 +1780,6 @@ msgstr "Akzeptieren Sie das Zertifikat für %s?" msgid "SSL Certificate Verification" msgstr "SSL-Zertifikatsüberprüfung" -msgid "_View Certificate..." -msgstr "Ze_rtifikat ansehen..." - #, c-format msgid "The certificate for %s could not be validated." msgstr "Das Zertifikat für %s konnte nicht validiert werden." @@ -1807,27 +1800,6 @@ msgstr "" "dass Sie tatsächlich nicht mit dem Dienst verbunden sind, mit dem Sie " "glauben verbunden zu sein." -#. Make messages -#, c-format -msgid "" -"Common name: %s\n" -"\n" -"Fingerprint (SHA1): %s\n" -"\n" -"Activation date: %s\n" -"Expiration date: %s\n" -msgstr "" -"Allgemeiner Name (Common name): %s\n" -"\n" -"Fingerabdruck (SHA1): %s\n" -"\n" -"Aktivierungsdatum: %s\n" -"Ablaufdatum: %s\n" - -#. TODO: Find what the handle ought to be -msgid "Certificate Information" -msgstr "Zertifikat-Information" - #. show error to user msgid "Registration Error" msgstr "Registrierungsfehler" @@ -2896,6 +2868,23 @@ msgstr "Einfaches Plugin" msgid "Tests to see that most things are working." msgstr "Tests, um zu sehen, ob das meiste funktioniert." +#. Make messages +#, c-format +msgid "" +"Common name: %s\n" +"\n" +"Fingerprint (SHA1): %s\n" +"\n" +"Activation date: %s\n" +"Expiration date: %s\n" +msgstr "" +"Allgemeiner Name (Common name): %s\n" +"\n" +"Fingerabdruck (SHA1): %s\n" +"\n" +"Aktivierungsdatum: %s\n" +"Ablaufdatum: %s\n" + #. Scheme name msgid "X.509 Certificates" msgstr "X.509-Zertifikate" @@ -5993,6 +5982,30 @@ msgstr "" "Nachricht konnte nicht gesendet werden, da ein unbekannter Fehler " "aufgetreten ist." +#, c-format +msgid "" +"%s (There was an error receiving this message. Converting the encoding from " +"%s to UTF-8 failed.)" +msgstr "" +"%s (Es gab einen Fehler beim Empfang dieser Nachricht. Die Konvertierung von " +"%s zu UTF-8 ist gescheitert.)" + +#, c-format +msgid "" +"%s (There was an error receiving this message. The charset was %s, but it " +"was not valid UTF-8.)" +msgstr "" +"%s (Es gab einen Fehler beim Empfang dieser Nachricht. Der Zeichensatz war " +"%s, aber es war kein gültiges UTF-8.)" + +#, c-format +msgid "" +"%s (There was an error receiving this message. The charset was missing, but " +"it was not valid UTF-8.)" +msgstr "" +"%s (Es gab einen Fehler beim Konvertieren dieser Nachricht. Der Zeichensatz " +"fehlte und es war kein gültiges UTF-8.)" + msgid "Writing error" msgstr "Schreibfehler" @@ -7905,9 +7918,6 @@ msgstr "" "senden. Ihre Buddy-Liste ist nicht verloren und wird wahrscheinlich in ein " "paar Minuten wieder verfügbar sein." -msgid "Orphans" -msgstr "Waisen" - #, c-format msgid "" "Unable to add the buddy %s because you have too many buddies in your buddy " @@ -8500,7 +8510,7 @@ msgid "Topic:" msgstr "Thema:" msgid "A server is required to connect this account" -msgstr "Es wird ein Server benötigt um dieses Konto zu verbinden." +msgstr "Es wird ein Server benötigt um dieses Konto zu verbinden" msgid "Last Known Client" msgstr "Letzter bekannter Client" @@ -10993,9 +11003,6 @@ msgstr "_Zusammenklappen" msgid "_Expand" msgstr "A_usklappen" -msgid "/Tools/Mute Sounds" -msgstr "/Werkzeuge/Stummschalten" - msgid "" "You are not currently signed on with an account that can add that buddy." msgstr "" @@ -11020,122 +11027,121 @@ msgstr "Benutzerstimmung ändern" #. NOTE: Do not set any accelerator to Control+O. It is mapped by #. gtk_blist_key_press_cb to "Get User Info" on the selected buddy. #. Buddies menu -msgid "/_Buddies" -msgstr "/_Buddys" +msgid "_Buddies" +msgstr "_Buddys" -msgid "/Buddies/New Instant _Message..." -msgstr "/Buddys/_Neue Sofortnachricht..." +msgid "New Instant _Message..." +msgstr "Neue Sofortnachricht..." -msgid "/Buddies/Join a _Chat..." -msgstr "/Buddys/Einen _Chat betreten..." +msgid "Join a _Chat..." +msgstr "_Chat betreten..." -msgid "/Buddies/Get User _Info..." -msgstr "/Buddys/Benu_tzer-Info abrufen..." +msgid "Get User _Info..." +msgstr "Benu_tzer-Info abrufen..." -msgid "/Buddies/View User _Log..." -msgstr "/Buddys/Benutzer-_Mitschnitt ansehen..." +msgid "View User _Log..." +msgstr "Benutzer-_Mitschnitt ansehen..." -msgid "/Buddies/Sh_ow" -msgstr "/Buddys/_Anzeigen" +msgid "Sh_ow" +msgstr "_Anzeigen" -msgid "/Buddies/Show/_Offline Buddies" -msgstr "/Buddys/Anzeigen/_Offline-Buddys" +msgid "_Sort Buddies" +msgstr "Buddys _sortieren" -msgid "/Buddies/Show/_Empty Groups" -msgstr "/Buddys/Anzeigen/_Leere Gruppen" - -msgid "/Buddies/Show/Buddy _Details" -msgstr "/Buddys/Anzeigen/Buddy-_Details" +msgid "_Add Buddy..." +msgstr "_Buddy hinzufügen..." -msgid "/Buddies/Show/Idle _Times" -msgstr "/Buddys/Anzeigen/Untätigkeitszei_ten" +msgid "Add _Group..." +msgstr "_Gruppe hinzufügen..." -msgid "/Buddies/Show/_Protocol Icons" -msgstr "/Buddys/Anzeigen/_Protokoll-Icons" +msgid "_Quit" +msgstr "_Beenden" -msgid "/Buddies/_Sort Buddies" -msgstr "/Buddys/Buddys _sortieren" +#. Accounts menu +msgid "_Accounts" +msgstr "_Konten" -msgid "/Buddies/_Add Buddy..." -msgstr "/Buddys/B_uddy hinzufügen..." +msgid "Manage Accounts" +msgstr "Konten verwalten" -msgid "/Buddies/Add C_hat..." -msgstr "/Buddys/C_hat hinzufügen..." +#. Tools +msgid "_Tools" +msgstr "_Werkzeuge" -msgid "/Buddies/Add _Group..." -msgstr "/Buddys/_Gruppe hinzufügen..." +msgid "Buddy _Pounces" +msgstr "Buddy-_Alarm" -msgid "/Buddies/_Quit" -msgstr "/Buddys/_Beenden" +msgid "_Certificates" +msgstr "_Zertifikate" -#. Accounts menu -msgid "/_Accounts" -msgstr "/_Konten" +msgid "Custom Smile_ys" +msgstr "Benutzerdefinierte Smile_ys" -msgid "/Accounts/Manage Accounts" -msgstr "/Konten/Konten verwalten" +msgid "Plu_gins" +msgstr "_Plugins" -#. Tools -msgid "/_Tools" -msgstr "/_Werkzeuge" +msgid "Pr_eferences" +msgstr "_Einstellungen" -msgid "/Tools/Buddy _Pounces" -msgstr "/Werkzeuge/Buddy-_Alarm" +msgid "Pr_ivacy" +msgstr "Pri_vatsphäre" -msgid "/Tools/_Certificates" -msgstr "/Werkzeuge/_Zertifikate" +msgid "Set _Mood" +msgstr "Setze Sti_mmung" -msgid "/Tools/Custom Smile_ys" -msgstr "/Werkzeuge/Benutzerdefinierte Smile_ys" +msgid "_File Transfers" +msgstr "Dateiübertragungen" -msgid "/Tools/Plu_gins" -msgstr "/Werkzeuge/Plu_gins" +msgid "R_oom List" +msgstr "_Chaträume" -msgid "/Tools/Pr_eferences" -msgstr "/Werkzeuge/_Einstellungen" +msgid "System _Log" +msgstr "_Systemmitschnitt" -msgid "/Tools/Pr_ivacy" -msgstr "/Werkzeuge/Pri_vatsphäre" +#. Help +msgid "_Help" +msgstr "_Hilfe" -msgid "/Tools/Set _Mood" -msgstr "/Werkzeuge/Setze Sti_mmung" +msgid "Online _Help" +msgstr "Online-_Hilfe" -msgid "/Tools/_File Transfers" -msgstr "/Werkzeuge/_Dateiübertragungen" +msgid "_Build Information" +msgstr "_Build-Informationen" -msgid "/Tools/R_oom List" -msgstr "/Werkzeuge/Chat_räume" +msgid "_Debug Window" +msgstr "_Debug-Fenster" -msgid "/Tools/System _Log" -msgstr "/Werkzeuge/_Systemmitschnitt" +msgid "De_veloper Information" +msgstr "_Entwickler-Informationen" -msgid "/Tools/Mute _Sounds" -msgstr "/Werkzeuge/S_tummschalten" +msgid "_Plugin Information" +msgstr "_Plugin-Informationen" -#. Help -msgid "/_Help" -msgstr "/_Hilfe" +msgid "_Translator Information" +msgstr "Über_setzer-Informationen" -msgid "/Help/Online _Help" -msgstr "/Hilfe/Online-_Hilfe" +msgid "_About" +msgstr "Übe_r" -msgid "/Help/_Build Information" -msgstr "/Hilfe/_Build-Informationen" +#. Buddies->Show menu +msgid "_Offline Buddies" +msgstr "_Offline-Buddys" -msgid "/Help/_Debug Window" -msgstr "/Hilfe/_Debug-Fenster" +msgid "_Empty Groups" +msgstr "_Leere Gruppen" -msgid "/Help/De_veloper Information" -msgstr "/Hilfe/_Entwickler-Informationen" +msgid "Buddy _Details" +msgstr "Buddy-_Details" -msgid "/Help/_Plugin Information" -msgstr "/Hilfe/_Plugin-Informationen" +msgid "Idle _Times" +msgstr "Untätigkeitszei_ten" -msgid "/Help/_Translator Information" -msgstr "/Hilfe/Über_setzer-Informationen" +msgid "_Protocol Icons" +msgstr "_Protokoll-Icons" -msgid "/Help/_About" -msgstr "/Hilfe/Übe_r" +#. Tools menu +msgid "Mute _Sounds" +msgstr "Stu_mmschalten" #, c-format msgid "Account: %s" @@ -11193,30 +11199,6 @@ msgstr "Untätig %dh %02dm" msgid "Idle %dm" msgstr "Untätig seit %dm" -msgid "/Buddies/New Instant Message..." -msgstr "/Buddys/Neue Sofortnachricht..." - -msgid "/Buddies/Join a Chat..." -msgstr "/Buddys/Chat betreten..." - -msgid "/Buddies/Get User Info..." -msgstr "/Buddys/Benutzer-Info abrufen..." - -msgid "/Buddies/Add Buddy..." -msgstr "/Buddys/Buddy hinzufügen..." - -msgid "/Buddies/Add Chat..." -msgstr "/Buddys/Chat hinzufügen..." - -msgid "/Buddies/Add Group..." -msgstr "/Buddys/Gruppe hinzufügen..." - -msgid "/Tools/Privacy" -msgstr "/Werkzeuge/Privatsphäre" - -msgid "/Tools/Room List" -msgstr "/Werkzeuge/Chaträume" - #, c-format msgid "%d unread message from %s\n" msgid_plural "%d unread messages from %s\n" @@ -11272,9 +11254,6 @@ msgstr "Passwort:" msgid "_Login" msgstr "_Anmelden" -msgid "/Accounts" -msgstr "/Konten" - #. Translators: Please maintain the use of -> and <- to refer to menu heirarchy #, c-format msgid "" @@ -11291,24 +11270,6 @@ msgstr "" "aktiviert haben, können Sie sich anmelden, Ihren Status setzen und mit Ihren " "Freunden reden." -#. set the Show Offline Buddies option. must be done -#. * after the treeview or faceprint gets mad. -Robot101 -#. -msgid "/Buddies/Show/Offline Buddies" -msgstr "/Buddys/Anzeigen/Offline-Buddys" - -msgid "/Buddies/Show/Empty Groups" -msgstr "/Buddys/Anzeigen/Leere Gruppen" - -msgid "/Buddies/Show/Buddy Details" -msgstr "/Buddys/Anzeigen/Buddy-Details" - -msgid "/Buddies/Show/Idle Times" -msgstr "/Buddys/Anzeigen/Untätigkeitszeiten" - -msgid "/Buddies/Show/Protocol Icons" -msgstr "/Buddys/Anzeigen/Protokoll-Icons" - msgid "Add a buddy.\n" msgstr "Einen Buddy hinzufügen.\n" @@ -11357,12 +11318,6 @@ msgstr "Bitte geben Sie den Namen der Gruppe ein, die hinzugefügt werden soll." msgid "Enable Account" msgstr "Konten aktivieren" -msgid "/Accounts/Enable Account" -msgstr "/Konten/Konto aktivieren" - -msgid "/Accounts/" -msgstr "/Konten/" - msgid "_Edit Account" msgstr "Konto _bearbeiten" @@ -11375,15 +11330,14 @@ msgstr "Keine Aktionen verfügbar" msgid "_Disable" msgstr "_Deaktivieren" -msgid "/Tools" -msgstr "/Werkzeuge" - -msgid "/Buddies/Sort Buddies" -msgstr "/Buddys/Buddys sortieren" - msgid "Type the host name for this certificate." msgstr "Geben Sie einen Hostnamen für dieses Zertifikat an." +#. Fire the notification +#, c-format +msgid "Certificate Information for %s" +msgstr "Zertifikat-Information für %s" + #. Widget creation function msgid "SSL Servers" msgstr "SSL-Server" @@ -11403,6 +11357,13 @@ msgstr "Ausführliches Debugging ist nun aktiviert." msgid "Supported debug options are: plugins version unsafe verbose" msgstr "Unterstützte Debug-Optionen sind: plugins version unsafe verbose" +msgid "" +"Use \"/help <command>\" for help on a specific command.
    The " +"following commands are available in this context:
    " +msgstr "" +"Benutzen Sie „/help <kommando>“, um Hilfe für ein bestimmtes Kommando " +"zu erhalten. Die folgenden Kommandos sind in diesem Kontext verfügbar:
    " + msgid "Unknown command." msgstr "Unbekanntes Kommando." @@ -11465,170 +11426,78 @@ msgid "Show All" msgstr "Alle anzeigen" #. Conversation menu -msgid "/_Conversation" -msgstr "/_Unterhaltung" - -msgid "/Conversation/New Instant _Message..." -msgstr "/Unterhaltung/_Neue Sofortnachricht..." - -msgid "/Conversation/Join a _Chat..." -msgstr "/Unterhaltung/Einen Cha_t betreten..." - -msgid "/Conversation/_Find..." -msgstr "/Unterhaltung/_Finden..." - -msgid "/Conversation/View _Log" -msgstr "/Unterhaltung/_Mitschnitt anzeigen" +msgid "_Conversation" +msgstr "_Unterhaltung" -msgid "/Conversation/_Save As..." -msgstr "/Unterhaltung/S_peichern als..." +msgid "_Find..." +msgstr "_Finden..." -msgid "/Conversation/Clea_r Scrollback" -msgstr "/Unterhaltung/_Leeren" +msgid "_Save As..." +msgstr "S_peichern als..." -msgid "/Conversation/M_edia" -msgstr "/Unterhaltung/M_edien" +msgid "Clea_r Scrollback" +msgstr "_Leeren..." -msgid "/Conversation/Media/_Audio Call" -msgstr "/Unterhaltung/Medien/_Audio-Anruf" +msgid "M_edia" +msgstr "M_edien" -msgid "/Conversation/Media/_Video Call" -msgstr "/Unterhaltung/Medien/_Video-Anruf" +msgid "Audio/Video _Call" +msgstr "A_udio/Video-Anruf" -msgid "/Conversation/Media/Audio\\/Video _Call" -msgstr "/Unterhaltung/Medien/A_udio-\\/Video-Anruf" +msgid "Se_nd File..." +msgstr "Datei _senden..." -msgid "/Conversation/Se_nd File..." -msgstr "/Unterhaltung/Datei _senden..." +msgid "Get _Attention" +msgstr "_Aufmerksamkeit erregen" -msgid "/Conversation/Get _Attention" -msgstr "/Unterhaltung/_Aufmerksamkeit erregen" - -msgid "/Conversation/Add Buddy _Pounce..." -msgstr "/Unterhaltung/_Buddy-Alarm hinzufügen..." - -msgid "/Conversation/_Get Info" -msgstr "/Unterhaltung/_Info abrufen" +msgid "_Get Info" +msgstr "_Info abrufen" -msgid "/Conversation/In_vite..." -msgstr "/Unterhaltung/_Einladen..." +msgid "In_vite..." +msgstr "_Einladen..." -msgid "/Conversation/M_ore" -msgstr "/Unterhaltung/Me_hr" +msgid "M_ore" +msgstr "Me_hr" -msgid "/Conversation/Al_ias..." -msgstr "/Unterhaltung/Al_ias..." +msgid "Al_ias..." +msgstr "Al_ias..." -msgid "/Conversation/_Block..." -msgstr "/Unterhaltung/_Blockieren..." +msgid "_Block..." +msgstr "_Blockieren..." -msgid "/Conversation/_Unblock..." -msgstr "/Unterhaltung/_Entsperren..." +msgid "_Unblock..." +msgstr "_Entsperren..." -msgid "/Conversation/_Add..." -msgstr "/Unterhaltung/_Hinzufügen..." +msgid "_Add..." +msgstr "_Hinzufügen..." -msgid "/Conversation/_Remove..." -msgstr "/Unterhaltung/_Entfernen..." +msgid "_Remove..." +msgstr "_Entfernen..." -msgid "/Conversation/Insert Lin_k..." -msgstr "/Unterhaltung/Lin_k einfügen..." +msgid "Insert Lin_k..." +msgstr "_Entfernen..." -msgid "/Conversation/Insert Imag_e..." -msgstr "/Unterhaltung/Bil_d einfügen..." +msgid "Insert Imag_e..." +msgstr "Bil_d einfügen..." -msgid "/Conversation/_Close" -msgstr "/Unterhaltung/S_chließen" +msgid "_Close" +msgstr "S_chließen" #. Options -msgid "/_Options" -msgstr "/_Optionen" - -msgid "/Options/Enable _Logging" -msgstr "/Optionen/Schalte _Mitschnitt ein" - -msgid "/Options/Enable _Sounds" -msgstr "/Optionen/Schalte _Klänge ein" - -msgid "/Options/Show Formatting _Toolbars" -msgstr "/Optionen/Zeige _Werkzeugleisten für Formatierung" - -msgid "/Options/Show Ti_mestamps" -msgstr "/Optionen/Zeige _Zeitstempel" - -msgid "/Conversation/More" -msgstr "/Unterhaltung/Mehr" - -msgid "/Options" -msgstr "/Optionen" - -#. The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time -#. * the 'Conversation' menu pops up. -#. Make sure the 'Conversation -> More' menuitems are regenerated whenever -#. * the 'Conversation' menu pops up because the entries can change after the -#. * conversation is created. -msgid "/Conversation" -msgstr "/Unterhaltung" - -msgid "/Conversation/View Log" -msgstr "/Unterhaltung/Mitschnitt anzeigen" - -msgid "/Conversation/Media/Audio Call" -msgstr "/Unterhaltung/Medien/Audio-Anruf" - -msgid "/Conversation/Media/Video Call" -msgstr "/Unterhaltung/Medien/Video-Anruf" - -msgid "/Conversation/Media/Audio\\/Video Call" -msgstr "/Unterhaltung/Medien/Audio-\\/Video-Anruf" - -msgid "/Conversation/Send File..." -msgstr "/Unterhaltung/Datei senden ..." - -msgid "/Conversation/Get Attention" -msgstr "/Unterhaltung/Aufmerksamkeit erregen" - -msgid "/Conversation/Add Buddy Pounce..." -msgstr "/Unterhaltung/Buddy-Alarm hinzufügen..." - -msgid "/Conversation/Get Info" -msgstr "/Unterhaltung/Info abrufen" - -msgid "/Conversation/Invite..." -msgstr "/Unterhaltung/Einladen ..." - -msgid "/Conversation/Alias..." -msgstr "/Unterhaltung/Alias..." - -msgid "/Conversation/Block..." -msgstr "/Unterhaltung/Blockieren..." - -msgid "/Conversation/Unblock..." -msgstr "/Unterhaltung/Entsperren..." - -msgid "/Conversation/Add..." -msgstr "/Unterhaltung/Hinzufügen..." - -msgid "/Conversation/Remove..." -msgstr "/Unterhaltung/Entfernen..." - -msgid "/Conversation/Insert Link..." -msgstr "/Unterhaltung/Link einfügen..." +msgid "_Options" +msgstr "_Optionen" -msgid "/Conversation/Insert Image..." -msgstr "/Unterhaltung/Bild einfügen..." +msgid "Enable _Logging" +msgstr "Schalte _Mitschnitt ein" -msgid "/Options/Enable Logging" -msgstr "/Optionen/Schalte Mitschnitt ein" +msgid "Enable _Sounds" +msgstr "Schalte _Klänge ein" -msgid "/Options/Enable Sounds" -msgstr "/Optionen/Schalte Klänge ein" +msgid "Show Formatting _Toolbars" +msgstr "Zeige _Werkzeugleisten für Formatierung" -msgid "/Options/Show Formatting Toolbars" -msgstr "/Optionen/Zeige Werkzeugleisten für Formatierung" - -msgid "/Options/Show Timestamps" -msgstr "/Optionen/Zeige Zeitstempel" +msgid "Show Ti_mestamps" +msgstr "Zeige _Zeitstempel" msgid "User is typing..." msgstr "Benutzer tippt gerade..." @@ -12018,6 +11887,9 @@ msgstr "Albanisch" msgid "Serbian" msgstr "Serbisch" +msgid "Serbian Latin" +msgstr "Serbisch (Latin)" + msgid "Sinhala" msgstr "Singhalesisch" @@ -12068,57 +11940,50 @@ msgstr "Litauisch" #, c-format msgid "" -"%s is a messaging client based on libpurple which is capable of connecting " -"to multiple messaging services at once. %s is written in C using GTK+. %s " -"is released, and may be modified and redistributed, under the terms of the " -"GPL version 2 (or later). A copy of the GPL is distributed with %s. %s is " -"copyrighted by its contributors, a list of whom is also distributed with " -"%s. There is no warranty for %s.

    " +"

    %s is a messaging client based on libpurple which is capable of " +"connecting to multiple messaging services at once. %s is written in C using " +"GTK+. %s is released, and may be modified and redistributed, under the " +"terms of the GPL version 2 (or later). A copy of the GPL is distributed " +"with %s. %s is copyrighted by its contributors, a list of whom is also " +"distributed with %s. There is no warranty for %s.

    " msgstr "" -"%s ist ein Nachrichtendienst, basierend auf libpurple, der die Verbindung zu " -"mehreren Nachrichtendiensten gleichzeitig unterstützt. %s wird in C " +"

    %s ist ein Nachrichtendienst, basierend auf libpurple, der die Verbindung " +"zu mehreren Nachrichtendiensten gleichzeitig unterstützt. %s wird in C " "programmiert und nutzt GTK+. %s ist nach den Bedingungen der GPL (Version 2 " "oder später) freigegeben und darf gemäß dieser bearbeitet und weiter " "verbreitet werden. Eine Kopie der GPL wird mit %s ausgeliefert. %s wird " -"von seinen Mitwirkenden urheberrechtlich geschützt. Eine komplette Liste " -"der Mitwirkenden wird mit %s ausgeliefert. Wir übernehmen keine Haftung für " -"%s.

    " +"von seinen Mitwirkenden urheberrechtlich geschützt. Eine Liste der " +"Mitwirkenden wird auch mit %s ausgeliefert. Wir übernehmen keine Haftung " +"für %s.

    " #, c-format msgid "" -"Helpful Resources
    \tWebsite
    \tFrequently Asked Questions
    \tIRC " -"Channel: #pidgin on irc.freenode.net
    \tXMPP MUC: devel@conference.pidgin." -"im

    " +"

    Helpful Resources

    " msgstr "" -"Hilfreiche Quellen
    \tWebseite
    \tHäufig gestellte Fragen (FAQ)
    " -"\tIRC-Channel: #pidgin auf irc.freenode.net
    \tXMPP-MUC: devel@conference." -"pidgin.im

    " +"

    Hilfreiche Quellen

    " #, c-format msgid "" -"Help from other Pidgin users is available by " -"e-mailing support@pidgin.im
    This is a public mailing list! (archive)
    We can't help with third-party protocols or " -"plugins!
    This list's primary language is English. You are " -"welcome to post in another language, but the responses may be less helpful." -"
    " +"

    Help from other Pidgin users is available by e-mailing " +"%s.
    This is a public mailing " +"list! (archive)
    We can't help with third-" +"party protocols or plugins!
    This list's primary language is " +"English. You are welcome to post in another language, but " +"the responses may be less helpful.

    " msgstr "" -"Hilfe von anderen Pidgin-Benutzern erhält man " -"per E-Mail an support@pidgin.im
    Dies ist eine öffentliche Mailing-Liste! (Archiv)
    Wir können nicht bei Problemen mit " -"Drittanbieter-Protokollen oder Plugins helfen!
    Die Hauptsprache dieser " -"Liste ist Englisch. Sie können gern in einer anderen Sprache " -"schreiben, aber die Antworten könnten weniger hilfreich sein.
    Deutschsprachige Benutzer können auch das Portal Pidgin-IM.de nutzen. Dort finden Sie aktuelle " -"Informationen zu Pidgin, können mit anderen Benutzern im Forum diskutieren und Hilfe zu Problemen finden. " -"Beachten Sie, dass dieses Portal unabhängig vom offiziellen Pidgin-Projekt " -"ist.

    " +"

    Hilfe von anderen Pidgin-Benutzern erhält man per E-Mail " +"an %s
    Dies ist eine öffentliche Mailing-Liste! (Archiv)
    Wir " +"können nicht bei Problemen mit Drittanbieter-Protokollen oder Plugins helfen!" +"
    Die Hauptsprache dieser Liste ist Englisch. Sie " +"können gern in einer anderen Sprache schreiben, aber die Antworten könnten " +"weniger hilfreich sein.

    " #, c-format msgid "About %s" @@ -12287,24 +12152,9 @@ msgstr "_Ungelesene Nachrichten" msgid "New _Message..." msgstr "_Neue Nachricht..." -msgid "_Accounts" -msgstr "_Konten" - -msgid "Plu_gins" -msgstr "_Plugins" - -msgid "Pr_eferences" -msgstr "_Einstellungen" - -msgid "Mute _Sounds" -msgstr "Stu_mmschalten" - msgid "_Blink on New Message" msgstr "Be_i neuen Nachrichten blinken" -msgid "_Quit" -msgstr "_Beenden" - msgid "Not started" msgstr "Nicht gestartet" @@ -13046,7 +12896,6 @@ msgstr "Buddy-Listen-Thema:" msgid "Conversation Theme:" msgstr "Unterhaltungs-Thema:" -#, fuzzy msgid "\tVariant:" msgstr "\tVariante:" @@ -13646,12 +13495,6 @@ msgstr "Gespeicherter Status..." msgid "Status Selector" msgstr "Statusauswahl" -msgid "Google Talk" -msgstr "Google Talk" - -msgid "Facebook (XMPP)" -msgstr "Facebook (XMPP)" - #, c-format msgid "The following error has occurred loading %s: %s" msgstr "Beim Laden von %s ist folgender Fehler aufgetreten: %s" @@ -13786,18 +13629,12 @@ msgstr "Alia_s" msgid "Close _tabs" msgstr "_Reiter schließen" -msgid "_Get Info" -msgstr "_Info abrufen" - msgid "_Invite" msgstr "_Einladen" msgid "_Modify..." msgstr "_Bearbeiten..." -msgid "_Add..." -msgstr "_Hinzufügen..." - msgid "_Open Mail" msgstr "Mail ö_ffnen" @@ -15154,3 +14991,328 @@ msgstr "Besuchen Sie die Pidgin-Webseite" msgid "You do not have permission to uninstall this application." msgstr "Sie haben keine Berechtigung, diese Anwendung zu deinstallieren." + +#~ msgid "" +#~ "Common name: %s %s\n" +#~ "Fingerprint (SHA1): %s" +#~ msgstr "" +#~ "Allgemeiner Name (Common name:) %s %s\n" +#~ "Fingerabdruck (SHA1): %s" + +#~ msgid "_View Certificate..." +#~ msgstr "Ze_rtifikat ansehen..." + +#~ msgid "Orphans" +#~ msgstr "Waisen" + +#~ msgid "/Tools/Mute Sounds" +#~ msgstr "/Werkzeuge/Stummschalten" + +#~ msgid "/Buddies/New Instant _Message..." +#~ msgstr "/Buddys/_Neue Sofortnachricht..." + +#~ msgid "/Buddies/Join a _Chat..." +#~ msgstr "/Buddys/Einen _Chat betreten..." + +#~ msgid "/Buddies/Get User _Info..." +#~ msgstr "/Buddys/Benu_tzer-Info abrufen..." + +#~ msgid "/Buddies/View User _Log..." +#~ msgstr "/Buddys/Benutzer-_Mitschnitt ansehen..." + +#~ msgid "/Buddies/Sh_ow" +#~ msgstr "/Buddys/_Anzeigen" + +#~ msgid "/Buddies/Show/_Offline Buddies" +#~ msgstr "/Buddys/Anzeigen/_Offline-Buddys" + +#~ msgid "/Buddies/Show/_Empty Groups" +#~ msgstr "/Buddys/Anzeigen/_Leere Gruppen" + +#~ msgid "/Buddies/Show/Idle _Times" +#~ msgstr "/Buddys/Anzeigen/Untätigkeitszei_ten" + +#~ msgid "/Buddies/Show/_Protocol Icons" +#~ msgstr "/Buddys/Anzeigen/_Protokoll-Icons" + +#~ msgid "/Buddies/_Sort Buddies" +#~ msgstr "/Buddys/Buddys _sortieren" + +#~ msgid "/Buddies/_Add Buddy..." +#~ msgstr "/Buddys/B_uddy hinzufügen..." + +#~ msgid "/Buddies/Add C_hat..." +#~ msgstr "/Buddys/C_hat hinzufügen..." + +#~ msgid "/Buddies/Add _Group..." +#~ msgstr "/Buddys/_Gruppe hinzufügen..." + +#~ msgid "/Buddies/_Quit" +#~ msgstr "/Buddys/_Beenden" + +#~ msgid "/_Accounts" +#~ msgstr "/_Konten" + +#~ msgid "/Accounts/Manage Accounts" +#~ msgstr "/Konten/Konten verwalten" + +#~ msgid "/Tools/Buddy _Pounces" +#~ msgstr "/Werkzeuge/Buddy-_Alarm" + +#~ msgid "/Tools/_Certificates" +#~ msgstr "/Werkzeuge/_Zertifikate" + +#~ msgid "/Tools/Custom Smile_ys" +#~ msgstr "/Werkzeuge/Benutzerdefinierte Smile_ys" + +#~ msgid "/Tools/Plu_gins" +#~ msgstr "/Werkzeuge/Plu_gins" + +#~ msgid "/Tools/Pr_eferences" +#~ msgstr "/Werkzeuge/_Einstellungen" + +#~ msgid "/Tools/Pr_ivacy" +#~ msgstr "/Werkzeuge/Pri_vatsphäre" + +#~ msgid "/Tools/Set _Mood" +#~ msgstr "/Werkzeuge/Setze Sti_mmung" + +#~ msgid "/Tools/_File Transfers" +#~ msgstr "/Werkzeuge/_Dateiübertragungen" + +#~ msgid "/Tools/R_oom List" +#~ msgstr "/Werkzeuge/Chat_räume" + +#~ msgid "/Tools/System _Log" +#~ msgstr "/Werkzeuge/_Systemmitschnitt" + +#~ msgid "/Tools/Mute _Sounds" +#~ msgstr "/Werkzeuge/S_tummschalten" + +#~ msgid "/Help/_Build Information" +#~ msgstr "/Hilfe/_Build-Informationen" + +#~ msgid "/Help/_Debug Window" +#~ msgstr "/Hilfe/_Debug-Fenster" + +#~ msgid "/Help/De_veloper Information" +#~ msgstr "/Hilfe/_Entwickler-Informationen" + +#~ msgid "/Help/_Plugin Information" +#~ msgstr "/Hilfe/_Plugin-Informationen" + +#~ msgid "/Help/_Translator Information" +#~ msgstr "/Hilfe/Über_setzer-Informationen" + +#~ msgid "/Help/_About" +#~ msgstr "/Hilfe/Übe_r" + +#~ msgid "/Buddies/New Instant Message..." +#~ msgstr "/Buddys/Neue Sofortnachricht..." + +#~ msgid "/Buddies/Join a Chat..." +#~ msgstr "/Buddys/Chat betreten..." + +#~ msgid "/Buddies/Get User Info..." +#~ msgstr "/Buddys/Benutzer-Info abrufen..." + +#~ msgid "/Buddies/Add Buddy..." +#~ msgstr "/Buddys/Buddy hinzufügen..." + +#~ msgid "/Buddies/Add Chat..." +#~ msgstr "/Buddys/Chat hinzufügen..." + +#~ msgid "/Buddies/Add Group..." +#~ msgstr "/Buddys/Gruppe hinzufügen..." + +#~ msgid "/Tools/Privacy" +#~ msgstr "/Werkzeuge/Privatsphäre" + +#~ msgid "/Tools/Room List" +#~ msgstr "/Werkzeuge/Chaträume" + +#~ msgid "/Accounts" +#~ msgstr "/Konten" + +#~ msgid "/Buddies/Show/Offline Buddies" +#~ msgstr "/Buddys/Anzeigen/Offline-Buddys" + +#~ msgid "/Buddies/Show/Empty Groups" +#~ msgstr "/Buddys/Anzeigen/Leere Gruppen" + +#~ msgid "/Buddies/Show/Buddy Details" +#~ msgstr "/Buddys/Anzeigen/Buddy-Details" + +#~ msgid "/Buddies/Show/Idle Times" +#~ msgstr "/Buddys/Anzeigen/Untätigkeitszeiten" + +#~ msgid "/Buddies/Show/Protocol Icons" +#~ msgstr "/Buddys/Anzeigen/Protokoll-Icons" + +#~ msgid "/Accounts/Enable Account" +#~ msgstr "/Konten/Konto aktivieren" + +#~ msgid "/Accounts/" +#~ msgstr "/Konten/" + +#~ msgid "/Tools" +#~ msgstr "/Werkzeuge" + +#~ msgid "/Buddies/Sort Buddies" +#~ msgstr "/Buddys/Buddys sortieren" + +#~ msgid "/Conversation/New Instant _Message..." +#~ msgstr "/Unterhaltung/_Neue Sofortnachricht..." + +#~ msgid "/Conversation/Join a _Chat..." +#~ msgstr "/Unterhaltung/Einen Cha_t betreten..." + +#~ msgid "/Conversation/_Find..." +#~ msgstr "/Unterhaltung/_Finden..." + +#~ msgid "/Conversation/View _Log" +#~ msgstr "/Unterhaltung/_Mitschnitt anzeigen" + +#~ msgid "/Conversation/_Save As..." +#~ msgstr "/Unterhaltung/S_peichern als..." + +#~ msgid "/Conversation/Clea_r Scrollback" +#~ msgstr "/Unterhaltung/_Leeren" + +#~ msgid "/Conversation/M_edia" +#~ msgstr "/Unterhaltung/M_edien" + +#~ msgid "/Conversation/Media/_Audio Call" +#~ msgstr "/Unterhaltung/Medien/_Audio-Anruf" + +#~ msgid "/Conversation/Media/_Video Call" +#~ msgstr "/Unterhaltung/Medien/_Video-Anruf" + +#~ msgid "/Conversation/Media/Audio\\/Video _Call" +#~ msgstr "/Unterhaltung/Medien/A_udio-\\/Video-Anruf" + +#~ msgid "/Conversation/Se_nd File..." +#~ msgstr "/Unterhaltung/Datei _senden..." + +#~ msgid "/Conversation/Get _Attention" +#~ msgstr "/Unterhaltung/_Aufmerksamkeit erregen" + +#~ msgid "/Conversation/Add Buddy _Pounce..." +#~ msgstr "/Unterhaltung/_Buddy-Alarm hinzufügen..." + +#~ msgid "/Conversation/_Get Info" +#~ msgstr "/Unterhaltung/_Info abrufen" + +#~ msgid "/Conversation/In_vite..." +#~ msgstr "/Unterhaltung/_Einladen..." + +#~ msgid "/Conversation/M_ore" +#~ msgstr "/Unterhaltung/Me_hr" + +#~ msgid "/Conversation/Al_ias..." +#~ msgstr "/Unterhaltung/Al_ias..." + +#~ msgid "/Conversation/_Block..." +#~ msgstr "/Unterhaltung/_Blockieren..." + +#~ msgid "/Conversation/_Unblock..." +#~ msgstr "/Unterhaltung/_Entsperren..." + +#~ msgid "/Conversation/_Add..." +#~ msgstr "/Unterhaltung/_Hinzufügen..." + +#~ msgid "/Conversation/_Remove..." +#~ msgstr "/Unterhaltung/_Entfernen..." + +#~ msgid "/Conversation/Insert Lin_k..." +#~ msgstr "/Unterhaltung/Lin_k einfügen..." + +#~ msgid "/Conversation/Insert Imag_e..." +#~ msgstr "/Unterhaltung/Bil_d einfügen..." + +#~ msgid "/Conversation/_Close" +#~ msgstr "/Unterhaltung/S_chließen" + +#~ msgid "/Options/Enable _Logging" +#~ msgstr "/Optionen/Schalte _Mitschnitt ein" + +#~ msgid "/Options/Enable _Sounds" +#~ msgstr "/Optionen/Schalte _Klänge ein" + +#~ msgid "/Options/Show Ti_mestamps" +#~ msgstr "/Optionen/Zeige _Zeitstempel" + +#~ msgid "/Conversation/More" +#~ msgstr "/Unterhaltung/Mehr" + +#~ msgid "/Options" +#~ msgstr "/Optionen" + +#~ msgid "/Conversation" +#~ msgstr "/Unterhaltung" + +#~ msgid "/Conversation/View Log" +#~ msgstr "/Unterhaltung/Mitschnitt anzeigen" + +#~ msgid "/Conversation/Media/Audio Call" +#~ msgstr "/Unterhaltung/Medien/Audio-Anruf" + +#~ msgid "/Conversation/Media/Video Call" +#~ msgstr "/Unterhaltung/Medien/Video-Anruf" + +#~ msgid "/Conversation/Media/Audio\\/Video Call" +#~ msgstr "/Unterhaltung/Medien/Audio-\\/Video-Anruf" + +#~ msgid "/Conversation/Send File..." +#~ msgstr "/Unterhaltung/Datei senden ..." + +#~ msgid "/Conversation/Get Attention" +#~ msgstr "/Unterhaltung/Aufmerksamkeit erregen" + +#~ msgid "/Conversation/Add Buddy Pounce..." +#~ msgstr "/Unterhaltung/Buddy-Alarm hinzufügen..." + +#~ msgid "/Conversation/Get Info" +#~ msgstr "/Unterhaltung/Info abrufen" + +#~ msgid "/Conversation/Invite..." +#~ msgstr "/Unterhaltung/Einladen ..." + +#~ msgid "/Conversation/Alias..." +#~ msgstr "/Unterhaltung/Alias..." + +#~ msgid "/Conversation/Block..." +#~ msgstr "/Unterhaltung/Blockieren..." + +#~ msgid "/Conversation/Unblock..." +#~ msgstr "/Unterhaltung/Entsperren..." + +#~ msgid "/Conversation/Add..." +#~ msgstr "/Unterhaltung/Hinzufügen..." + +#~ msgid "/Conversation/Remove..." +#~ msgstr "/Unterhaltung/Entfernen..." + +#~ msgid "/Conversation/Insert Link..." +#~ msgstr "/Unterhaltung/Link einfügen..." + +#~ msgid "/Conversation/Insert Image..." +#~ msgstr "/Unterhaltung/Bild einfügen..." + +#~ msgid "/Options/Enable Logging" +#~ msgstr "/Optionen/Schalte Mitschnitt ein" + +#~ msgid "/Options/Enable Sounds" +#~ msgstr "/Optionen/Schalte Klänge ein" + +#~ msgid "/Options/Show Formatting Toolbars" +#~ msgstr "/Optionen/Zeige Werkzeugleisten für Formatierung" + +#~ msgid "/Options/Show Timestamps" +#~ msgstr "/Optionen/Zeige Zeitstempel" + +#~ msgid "Google Talk" +#~ msgstr "Google Talk" + +#~ msgid "Facebook (XMPP)" +#~ msgstr "Facebook (XMPP)" -- cgit v1.2.1 From ce460d8bd7582fe65d4588998b81e4134a36acbc Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Sat, 31 Mar 2012 21:28:53 +0000 Subject: The Offline Message Emulation plugin now adds a note that the message was an offline message. (Flavius Anton) (fixes #2497) --- COPYRIGHT | 1 + ChangeLog | 4 +++- libpurple/plugins/offlinemsg.c | 8 +++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index df76c15727..d708e2c02a 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -24,6 +24,7 @@ Thijs Alkemade Manuel Amador Matt Amato Josef Andrysek +Flavius Anton Geoffrey Antos Daniel Atallah Paul Aurich diff --git a/ChangeLog b/ChangeLog index 71c150e423..62be08e0a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,7 +42,9 @@ version 3.0.0 (??/??/????): Plugins: * The Voice/Video Settings plugin supports using the sndio GStreamer - backends. (Brad Smith) (#14414) + backends. (Brad Smith) (#14414) + * The Offline Message Emulation plugin now adds a note that the message + was an offline message. (Flavius Anton) (#2497) version 2.10.2 (02/22/2012): General: diff --git a/libpurple/plugins/offlinemsg.c b/libpurple/plugins/offlinemsg.c index b58da95a8b..1803f82430 100644 --- a/libpurple/plugins/offlinemsg.c +++ b/libpurple/plugins/offlinemsg.c @@ -80,6 +80,7 @@ record_pounce(OfflineMsg *offline) PurplePounceEvent event; PurplePounceOption option; PurpleConversation *conv; + char *temp; event = PURPLE_POUNCE_SIGNON; option = PURPLE_POUNCE_OPTION_NONE; @@ -88,7 +89,12 @@ record_pounce(OfflineMsg *offline) event, option); purple_pounce_action_set_enabled(pounce, "send-message", TRUE); - purple_pounce_action_set_attribute(pounce, "send-message", "message", offline->message); + + temp = g_strdup_printf("(%s) %s", _("Offline message"), + offline->message); + purple_pounce_action_set_attribute(pounce, "send-message", "message", + temp); + g_free(temp); conv = offline->conv; if (!purple_conversation_get_data(conv, "plugin_pack:offlinemsg")) -- cgit v1.2.1 From 77f93648552bda155c48ff3a476ff6c326017dc1 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Mon, 16 Apr 2012 06:53:05 +0000 Subject: Remove unnecessary check --- libpurple/protocols/oscar/family_locate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpurple/protocols/oscar/family_locate.c b/libpurple/protocols/oscar/family_locate.c index e399fe09f7..34628c252d 100644 --- a/libpurple/protocols/oscar/family_locate.c +++ b/libpurple/protocols/oscar/family_locate.c @@ -1355,7 +1355,7 @@ aim_locate_setcaps(OscarData *od, guint64 caps) aim_snacid_t snacid; GSList *tlvlist = NULL; - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) + if (!(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) return -EINVAL; aim_tlvlist_add_caps(&tlvlist, 0x0005, caps, mood); -- cgit v1.2.1 From ec0229bf2c63f9f109823435a4fdfd0855d31557 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Thu, 3 May 2012 08:36:47 +0000 Subject: Remove unnecessary check for null --- libpurple/protocols/silc/ft.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libpurple/protocols/silc/ft.c b/libpurple/protocols/silc/ft.c index fabae1c0a2..a2c2d30f25 100644 --- a/libpurple/protocols/silc/ft.c +++ b/libpurple/protocols/silc/ft.c @@ -221,8 +221,6 @@ silcpurple_ftp_request_result(PurpleXfer *x) if (purple_xfer_get_status(x) != PURPLE_XFER_STATUS_ACCEPTED) return; - if (!xfer) - return; silc_socket_stream_get_info(silc_packet_stream_get_stream(xfer->sg->conn->stream), &sock, NULL, NULL, NULL); -- cgit v1.2.1 From 7ed9d3fcc21733b00b1f09e3bafccf3ed00c1518 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Thu, 3 May 2012 09:28:11 +0000 Subject: Validate utf8 for a few random strings that we read, in case AOL or ICQ decide to start sending us non-utf8 --- libpurple/protocols/oscar/family_auth.c | 31 +++++++++++++++++++++++----- libpurple/protocols/oscar/family_bart.c | 6 ++++++ libpurple/protocols/oscar/family_icbm.c | 6 ++++++ libpurple/protocols/oscar/oscar.c | 36 --------------------------------- libpurple/protocols/oscar/oscar.h | 2 ++ 5 files changed, 40 insertions(+), 41 deletions(-) diff --git a/libpurple/protocols/oscar/family_auth.c b/libpurple/protocols/oscar/family_auth.c index ac011df63d..eb7e7b9738 100644 --- a/libpurple/protocols/oscar/family_auth.c +++ b/libpurple/protocols/oscar/family_auth.c @@ -27,6 +27,7 @@ */ #include "oscar.h" +#include "oscarcommon.h" #include @@ -506,14 +507,29 @@ aim_request_login(OscarData *od, FlapConnection *conn, const char *sn) static int keyparse(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) { - int keylen, ret = 1; - aim_rxcallback_t userfunc; + int keylen; char *keystr; GSList *tlvlist; gboolean truncate_pass; + PurpleConnection *gc; + PurpleAccount *account; + ClientInfo aiminfo = CLIENTINFO_PURPLE_AIM; + ClientInfo icqinfo = CLIENTINFO_PURPLE_ICQ; + + gc = od->gc; + account = purple_connection_get_account(gc); keylen = byte_stream_get16(bs); keystr = byte_stream_getstr(bs, keylen); + if (!g_utf8_validate(keystr, -1, NULL)) { + purple_debug_warning("oscar", "Received SNAC %04hx/%04hx with " + "invalid UTF-8 keystr.\n", snac->family, snac->subtype); + purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + _("Received unexpected response from server")); + g_free(keystr); + return 1; + } + tlvlist = aim_tlvlist_read(bs); /* @@ -527,13 +543,18 @@ keyparse(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *fram * for the netscape network. This SNAC had a type 0x0058 TLV with length 10. * Data is 0x0007 0004 3e19 ae1e 0006 0004 0000 0005 */ - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, keystr, (int)truncate_pass); + aim_send_login(od, conn, purple_account_get_username(account), + purple_connection_get_password(gc), truncate_pass, + od->icq ? &icqinfo : &aiminfo, keystr, + purple_account_get_bool(account, "allow_multiple_logins", OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS)); + + purple_connection_update_progress(gc, + _("Password sent"), 2, OSCAR_CONNECT_STEPS); g_free(keystr); aim_tlvlist_free(tlvlist); - return ret; + return 1; } /** diff --git a/libpurple/protocols/oscar/family_bart.c b/libpurple/protocols/oscar/family_bart.c index cd7ca43839..cc5f1f2033 100644 --- a/libpurple/protocols/oscar/family_bart.c +++ b/libpurple/protocols/oscar/family_bart.c @@ -143,6 +143,12 @@ parseicon(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *fra guint8 iconcsumtype, iconcsumlen, *iconcsum, *icon; bn = byte_stream_getstr(bs, byte_stream_get8(bs)); + if (!g_utf8_validate(bn, -1, NULL)) { + purple_debug_warning("oscar", "Received SNAC %04hx/%04hx with " + "invalid UTF-8 buddy name.\n", snac->family, snac->subtype); + g_free(bn); + return 1; + } flags = byte_stream_get16(bs); iconcsumtype = byte_stream_get8(bs); iconcsumlen = byte_stream_get8(bs); diff --git a/libpurple/protocols/oscar/family_icbm.c b/libpurple/protocols/oscar/family_icbm.c index a9ca23671f..dac757431c 100644 --- a/libpurple/protocols/oscar/family_icbm.c +++ b/libpurple/protocols/oscar/family_icbm.c @@ -2095,6 +2095,12 @@ static int mtn_receive(OscarData *od, FlapConnection *conn, aim_module_t *mod, F channel = byte_stream_get16(bs); bnlen = byte_stream_get8(bs); bn = byte_stream_getstr(bs, bnlen); + if (!g_utf8_validate(bn, -1, NULL)) { + purple_debug_warning("oscar", "Received SNAC %04hx/%04hx with " + "invalid UTF-8 buddy name.\n", snac->family, snac->subtype); + g_free(bn); + return 1; + } event = byte_stream_get16(bs); if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 7696583026..3777a546db 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -55,8 +55,6 @@ #define AIMHASHDATA "http://pidgin.im/aim_data.php3" -#define OSCAR_CONNECT_STEPS 6 - static guint64 purple_caps = OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON @@ -89,7 +87,6 @@ struct oscar_ask_directim_data /* Only used when connecting with the old-style BUCP login */ static int purple_parse_auth_resp (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_login (OscarData *, FlapConnection *, FlapFrame *, ...); static int purple_parse_auth_securid_request(OscarData *, FlapConnection *, FlapFrame *, ...); static int purple_handle_redirect (OscarData *, FlapConnection *, FlapFrame *, ...); @@ -673,7 +670,6 @@ oscar_login(PurpleAccount *account) /* These are only needed when connecting with the old-style BUCP login */ oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0003, purple_parse_auth_resp, 0); - oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0007, purple_parse_login, 0); oscar_data_addhandler(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_REQUEST, purple_parse_auth_securid_request, 0); oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_RESPONSE, purple_icon_parseicon, 0); @@ -1232,38 +1228,6 @@ purple_parse_auth_securid_request(OscarData *od, FlapConnection *conn, FlapFrame return 1; } -/** - * Only used when connecting with the old-style BUCP login. - */ -static int -purple_parse_login(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - ClientInfo aiminfo = CLIENTINFO_PURPLE_AIM; - ClientInfo icqinfo = CLIENTINFO_PURPLE_ICQ; - va_list ap; - char *key; - gboolean truncate_pass; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - key = va_arg(ap, char *); - truncate_pass = va_arg(ap, int); - va_end(ap); - - aim_send_login(od, conn, purple_account_get_username(account), - purple_connection_get_password(gc), truncate_pass, - od->icq ? &icqinfo : &aiminfo, key, - purple_account_get_bool(account, "allow_multiple_logins", OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS)); - - purple_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); - - return 1; -} - static int purple_handle_redirect(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { diff --git a/libpurple/protocols/oscar/oscar.h b/libpurple/protocols/oscar/oscar.h index 56f09255c5..399efdc364 100644 --- a/libpurple/protocols/oscar/oscar.h +++ b/libpurple/protocols/oscar/oscar.h @@ -114,6 +114,8 @@ extern "C" { #define AIM_MD5_STRING "AOL Instant Messenger (SM)" +#define OSCAR_CONNECT_STEPS 6 + /* * Client info. Filled in by the client and passed in to * aim_send_login(). The information ends up getting passed to OSCAR -- cgit v1.2.1 From b5e99adacbbe38d02dfbb55cf93022fd8b959890 Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Fri, 4 May 2012 07:33:51 +0000 Subject: Remove redundant check (g_free does this for us) --- libpurple/protocols/msn/msg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libpurple/protocols/msn/msg.c b/libpurple/protocols/msn/msg.c index 2b09225393..938049e203 100644 --- a/libpurple/protocols/msn/msg.c +++ b/libpurple/protocols/msn/msg.c @@ -379,8 +379,7 @@ msn_message_set_bin_data(MsnMessage *msg, const void *data, size_t len) if (len > 1664) len = 1664; - if (msg->body != NULL) - g_free(msg->body); + g_free(msg->body); if (data != NULL && len > 0) { -- cgit v1.2.1 From a3021e03c200fc5ef67aa84a543fa7e53a19fa59 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sat, 19 May 2012 16:38:38 +0000 Subject: New branch for GSoC2012 project: Gadu-Gadu protocol plugin improvements. This commit makes trunk usable again - tunning default theme to match legacy Pidgin look&feel. --- pidgin/themes/Contents/Resources/main.css | 7 ++++++- pidgin/themes/Template.html | 20 ++++---------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/pidgin/themes/Contents/Resources/main.css b/pidgin/themes/Contents/Resources/main.css index 4dc00e3063..06f8bf7e06 100644 --- a/pidgin/themes/Contents/Resources/main.css +++ b/pidgin/themes/Contents/Resources/main.css @@ -1,19 +1,24 @@ body { word-wrap: break-word; word-break: break-word; + + font-size: 13px; + margin: 2px; + overflow-y: scroll; } .x-container, .x-status_container { line-height: 1.3em; - margin-bottom: 6px; + margin-bottom: 4px; } .x-container .x-time, .x-status_container .x-time { display: inline; + font-size: 12px; } .x-container .x-sender diff --git a/pidgin/themes/Template.html b/pidgin/themes/Template.html index e3c80eb39b..aca283da2a 100644 --- a/pidgin/themes/Template.html +++ b/pidgin/themes/Template.html @@ -286,22 +286,10 @@ node.parentNode.replaceChild(a, node); } - //Align our chat to the bottom of the window. If true is passed, view will also be scrolled down + //If true is passed, view will be scrolled down function alignChat(shouldScroll) { - var windowHeight = window.innerHeight; - - if (windowHeight > 0) { - var contentElement = document.getElementById('Chat'); - var heightDifference = (windowHeight - contentElement.offsetHeight); - if (heightDifference > 0) { - contentElement.style.position = 'relative'; - contentElement.style.top = heightDifference + 'px'; - } else { - contentElement.style.position = 'static'; - } - } - - if (shouldScroll) scrollToBottom(); + if (shouldScroll) + scrollToBottom(); } window.onresize = function windowDidResize(){ @@ -319,7 +307,7 @@ .actionMessageUserName { display:none; } .actionMessageBody:before { content:"*"; } .actionMessageBody:after { content:"*"; } - * { word-wrap:break-word; text-rendering: optimizelegibility; } + * { word-wrap:break-word } img.scaledToFitImage { height: auto; max-width: 100%%; } -- cgit v1.2.1 From e1ef67248388ebf8d5ee33a6e15c22c546785577 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sun, 20 May 2012 19:08:37 +0000 Subject: Still making trunk usable again: correctly display plaintext logs --- pidgin/gtklog.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pidgin/gtklog.c b/pidgin/gtklog.c index d539c58c6e..d4f18cf07b 100644 --- a/pidgin/gtklog.c +++ b/pidgin/gtklog.c @@ -465,6 +465,14 @@ static void log_select_cb(GtkTreeSelection *sel, PidginLogViewer *viewer) { webkit_web_view_open(WEBKIT_WEB_VIEW(viewer->web_view), "about:blank"); purple_signal_emit(pidgin_log_get_handle(), "log-displaying", viewer, log); + + /* plaintext log (html one starts with tag) */ + if (read[0] != '<') + { + char *newRead = purple_strreplace(read, "\n", "
    "); + g_free(read); + read = newRead; + } webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(viewer->web_view), read, ""); g_free(read); -- cgit v1.2.1 From 7f06be97c9eb0e5308771b0669f036d342c15aa4 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sun, 20 May 2012 19:27:17 +0000 Subject: Making trunk usable: linkify incoming messages --- pidgin/gtkconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 00914aa7d9..487633a5ed 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6412,7 +6412,7 @@ pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *a } gtkconv->last_flags = flags; - smileyed = smiley_parse_markup(message, purple_account_get_protocol_id(account)); + smileyed = smiley_parse_markup(displaying, purple_account_get_protocol_id(account)); msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime); escape = gtk_webview_quote_js_string(msg ? msg : ""); script = g_strdup_printf("%s(%s)", func, escape); -- cgit v1.2.1 From 9c3521c835bcc6519b875204df2a8e8fe74649f4 Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Wed, 23 May 2012 03:25:01 +0000 Subject: stun: Initialize 'in', silence compiler. --- libpurple/stun.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libpurple/stun.c b/libpurple/stun.c index 8f1d47a5ce..2308d80677 100644 --- a/libpurple/stun.c +++ b/libpurple/stun.c @@ -174,6 +174,8 @@ static void reply_cb(gpointer data, gint source, PurpleInputCondition cond) { struct ifreq *ifr; struct sockaddr_in *sinptr; + memset(&in, 0, sizeof(in)); + len = recv(source, buffer, sizeof(buffer) - 1, 0); if (!len) { purple_debug_warning("stun", "unable to read stun response\n"); -- cgit v1.2.1 From 7891383f05963ee409f185c8730bcc6c359eec27 Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Wed, 23 May 2012 05:01:14 +0000 Subject: jabber: Validate user moods, and make the /mood cmd behave flexibly. A user in Pidgin running "/mood ?" or "/mood -" would result in invalid XML being sent to the server (similar to #14342, except '<-/>' or ''). Prevent this by ensuring the user is specifying something from the list. The /mood command will also now try to treat its entire arguments as a single string, and set that as the mood -- I figure this is what a user would expect? --- ChangeLog | 1 + libpurple/protocols/jabber/jabber.c | 30 ++++++++++++---- libpurple/protocols/jabber/usermood.c | 65 +++++++++++++++++++++++++---------- libpurple/protocols/jabber/usermood.h | 17 +++++++-- 4 files changed, 85 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e0cbdc3c1..d17ece5ec2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -39,6 +39,7 @@ version 3.0.0 (??/??/????): to the core (and UIs) as incoming messages (Thijs Alkemade). (#14529) * Support file transfers up to ~9 EiB. + * Invalid user moods can no longer be sent to the server. Plugins: * The Voice/Video Settings plugin supports using the sndio GStreamer diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 690e2a5b2d..59344f2f29 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -3575,16 +3575,32 @@ jabber_cmd_mood(PurpleConversation *conv, JabberStream *js = purple_connection_get_protocol_data(purple_account_get_connection(account)); if (js->pep) { - /* if no argument was given, unset mood */ + gboolean ret; + if (!args || !args[0]) { - jabber_mood_set(js, NULL, NULL); - } else if (!args[1]) { - jabber_mood_set(js, args[0], NULL); + /* No arguments; unset mood */ + ret = jabber_mood_set(js, NULL, NULL); } else { - jabber_mood_set(js, args[0], args[1]); + /* At least one argument. Relying on the list of arguments + * being NULL-terminated. + */ + ret = jabber_mood_set(js, args[0], args[1]); + if (!ret) { + /* Let's try again */ + char *tmp = g_strjoin(" ", args[0], args[1], NULL); + ret = jabber_mood_set(js, "undefined", tmp); + g_free(tmp); + } } - return PURPLE_CMD_RET_OK; + if (ret) { + return PURPLE_CMD_RET_OK; + } else { + purple_conversation_write(conv, NULL, + _("Failed to specify mood"), + PURPLE_MESSAGE_ERROR, time(NULL)); + return PURPLE_CMD_RET_FAILED; + } } else { /* account does not support PEP, can't set a mood */ purple_conversation_write(conv, NULL, @@ -3713,7 +3729,7 @@ static void jabber_register_commands(PurplePlugin *plugin) PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", jabber_cmd_mood, - _("mood: Set current user mood"), NULL); + _("mood <mood> [text]: Set current user mood"), NULL); commands = g_slist_prepend(commands, GUINT_TO_POINTER(id)); g_hash_table_insert(jabber_cmds, plugin, commands); diff --git a/libpurple/protocols/jabber/usermood.c b/libpurple/protocols/jabber/usermood.c index 545ce60ec9..2968093767 100644 --- a/libpurple/protocols/jabber/usermood.c +++ b/libpurple/protocols/jabber/usermood.c @@ -115,10 +115,26 @@ static PurpleMood moods[] = { {"undefined", N_("Undefined"), NULL}, {"weak", N_("Weak"), NULL}, {"worried", N_("Worried"), NULL}, - /* Mark the last record. */ + /* Mar last record. */ {NULL, NULL, NULL} }; +static const PurpleMood* +find_mood_by_name(const gchar *name) +{ + int i; + + g_return_val_if_fail(name && *name, NULL); + + for (i = 0; moods[i].mood != NULL; ++i) { + if (g_str_equal(name, moods[i].mood)) { + return &moods[i]; + } + } + + return NULL; +} + static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) { /* it doesn't make sense to have more than one item here, so let's just pick the first one */ xmlnode *item = xmlnode_get_child(items, "item"); @@ -139,15 +155,13 @@ static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) { if (!moodtext) /* only pick the first one */ moodtext = xmlnode_get_data(moodinfo); } else { - int i; - for (i = 0; moods[i].mood; ++i) { - /* verify that the mood is known (valid) */ - if (!strcmp(moodinfo->name, moods[i].mood)) { - newmood = moods[i].mood; - break; - } - } + const PurpleMood *target_mood; + + /* verify that the mood is known (valid) */ + target_mood = find_mood_by_name(moodinfo->name); + newmood = target_mood ? target_mood->mood : NULL; } + if (newmood != NULL && moodtext != NULL) break; } @@ -170,26 +184,41 @@ void jabber_mood_init(void) { jabber_pep_register_handler("http://jabber.org/protocol/mood", jabber_mood_cb); } -void jabber_mood_set(JabberStream *js, const char *mood, const char *text) { +gboolean +jabber_mood_set(JabberStream *js, const char *mood, const char *text) +{ + const PurpleMood *target_mood = NULL; xmlnode *publish, *moodnode; + if (mood && *mood) { + target_mood = find_mood_by_name(mood); + /* Mood specified, but is invalid -- + * fail so that the command can handle this. + */ + if (!target_mood) + return FALSE; + } + publish = xmlnode_new("publish"); xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood"); moodnode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "mood"); xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood"); - if (mood && *mood) { - /* if mood is NULL, set an empty mood node, meaning: unset mood */ + + if (target_mood) { + /* If target_mood is not NULL, then + * target_mood->mood == mood, and is a valid element name. + */ xmlnode_new_child(moodnode, mood); - } - if (text && *text) { - xmlnode *textnode = xmlnode_new_child(moodnode, "text"); - xmlnode_insert_data(textnode, text, -1); + /* Only set text when setting a mood */ + if (text && *text) { + xmlnode *textnode = xmlnode_new_child(moodnode, "text"); + xmlnode_insert_data(textnode, text, -1); + } } jabber_pep_publish(js, publish); - /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free - (yay for well-defined memory management rules) */ + return TRUE; } PurpleMood *jabber_get_moods(PurpleAccount *account) diff --git a/libpurple/protocols/jabber/usermood.h b/libpurple/protocols/jabber/usermood.h index ad90ce3b1d..eced59f116 100644 --- a/libpurple/protocols/jabber/usermood.h +++ b/libpurple/protocols/jabber/usermood.h @@ -30,9 +30,20 @@ void jabber_mood_init(void); -void jabber_mood_set(JabberStream *js, - const char *mood, /* must be one of the valid strings defined in the XEP */ - const char *text /* might be NULL */); +/** + * Sets / unsets the mood for the specified account. The mood passed in + * must either be NULL, "", or one of the moods returned by + * jabber_get_moods(). + * + * @param js The JabberStream object. + * @param mood The mood to set, NULL, or "" + * @param text Optional text that goes along with a mood. Only used when + * setting a mood (not when unsetting a mood). + * + * @return FALSE if an invalid mood was specified, or TRUE otherwise. + */ +gboolean +jabber_mood_set(JabberStream *js, const char *mood, const char *text); PurpleMood *jabber_get_moods(PurpleAccount *account); -- cgit v1.2.1 From 3426af29a646706c105c6e319a5f726af913e766 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 25 May 2012 19:28:41 +0000 Subject: Apparently, some random servers have decided to send us an annotation with no name, and the value isn't really self-describing either. Anyway, this empty name could cause a crash. Fixes #15126. --- libpurple/protocols/msn/contact.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libpurple/protocols/msn/contact.c b/libpurple/protocols/msn/contact.c index 669c9d0a0c..274eb6b4e2 100644 --- a/libpurple/protocols/msn/contact.c +++ b/libpurple/protocols/msn/contact.c @@ -726,7 +726,7 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) char *name, *value; name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); value = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); - if (!strcmp(name, "MSN.IM.MPOP")) { + if (name && g_str_equal(name, "MSN.IM.MPOP")) { if (!value || atoi(value) != 0) session->enable_mpop = TRUE; else @@ -803,9 +803,12 @@ msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) Name = g_strdup(passport); for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation"); - annotation; annotation = xmlnode_get_next_twin(annotation)) { + annotation; + annotation = xmlnode_get_next_twin(annotation)) { char *name; name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); + if (!name) + continue; if (!strcmp(name, "AB.NickName")) alias = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); else if (!strcmp(name, "MSN.IM.HasSharedFolder")) -- cgit v1.2.1 From 4d3171eee68992bc542d5bf01c7b76731da368ff Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 27 May 2012 03:55:52 +0000 Subject: Remove backwards-compatibility vbox. --- pidgin/gtkblist.c | 11 +---------- pidgin/gtkblist.h | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index e1771bb93d..5d62f6ac85 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -6059,19 +6059,10 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtkblist->scrollbook = pidgin_scroll_book_new(); gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->scrollbook, FALSE, FALSE, 0); - /* Create an vbox which holds the scrollbook which is actually used to - * display connection errors. The vbox needs to still exist for - * backwards compatibility. - */ - gtkblist->error_buttons = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->error_buttons, FALSE, FALSE, 0); - gtk_container_set_border_width(GTK_CONTAINER(gtkblist->error_buttons), 0); - priv->error_scrollbook = PIDGIN_SCROLL_BOOK(pidgin_scroll_book_new()); - gtk_box_pack_start(GTK_BOX(gtkblist->error_buttons), + gtk_box_pack_start(GTK_BOX(gtkblist->vbox), GTK_WIDGET(priv->error_scrollbook), FALSE, FALSE, 0); - /* Add the statusbox */ gtkblist->statusbox = pidgin_status_box_new(); gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->statusbox, FALSE, TRUE, 0); diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index 2a41402874..e8859f0362 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -116,7 +116,6 @@ struct _PidginBuddyList { GDestroyNotify headline_destroy; /**< Callback to use for destroying the headline-data */ gboolean changing_style; /**< True when changing GTK+ theme style */ - GtkWidget *error_buttons; /**< Box containing the connection error buttons */ GtkWidget *statusbox; /**< The status selector dropdown */ GdkPixbuf *empty_avatar; /**< A 32x32 transparent pixbuf */ -- cgit v1.2.1 From 32dbf3fea87b72d9d1c7686ea5ff3c06359dd0e2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 27 May 2012 04:03:53 +0000 Subject: Remove deprecated headline close image. --- pidgin/gtkblist.c | 5 ----- pidgin/gtkblist.h | 1 - 2 files changed, 6 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 5d62f6ac85..8ef3dade5f 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -5951,8 +5951,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) NULL); gtk_widget_set_name(gtkblist->headline_hbox, "gtk-tooltips"); - gtkblist->headline_close = gtk_widget_render_icon(ebox, GTK_STOCK_CLOSE, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC), NULL); gtkblist->hand_cursor = gdk_cursor_new (GDK_HAND2); gtkblist->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); @@ -6948,9 +6946,6 @@ static void pidgin_blist_destroy(PurpleBuddyList *list) purple_signals_disconnect_by_handle(gtkblist); - if (gtkblist->headline_close) - g_object_unref(G_OBJECT(gtkblist->headline_close)); - gtk_widget_destroy(gtkblist->window); pidgin_blist_tooltip_destroy(); diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index e8859f0362..8777180b39 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -110,7 +110,6 @@ struct _PidginBuddyList { GtkWidget *headline_hbox; /**< Hbox for headline notification */ GtkWidget *headline_label; /**< Label for headline notifications */ GtkWidget *headline_image; /**< Image for headline notifications */ - GdkPixbuf *headline_close; /**< @deprecated: Close image for closing the headline without triggering the callback */ GCallback headline_callback; /**< Callback for headline notifications */ gpointer headline_data; /**< User data for headline notifications */ GDestroyNotify headline_destroy; /**< Callback to use for destroying the headline-data */ -- cgit v1.2.1 From 9937eed5091ef9c13be2786b2480da1338d5684c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 28 May 2012 22:13:56 +0000 Subject: Remove the timestamps toggle. This can be done with themes. --- pidgin/gtkconv.c | 49 ------------------------------------------------- pidgin/gtkconvwin.h | 1 - 2 files changed, 50 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 487633a5ed..2fbb8be345 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1507,13 +1507,6 @@ menu_sounds_cb(GtkAction *action, gpointer data) purple_blist_node_set_bool(node, "gtk-mute-sound", !gtkconv->make_sound); } -static void -menu_timestamps_cb(GtkAction *action, gpointer data) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", - gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); -} - static void chat_do_im(PidginConversation *gtkconv, const char *who) { @@ -3168,7 +3161,6 @@ static const GtkToggleActionEntry menu_toggle_entries[] = { { "EnableLogging", NULL, N_("Enable _Logging"), NULL, NULL, G_CALLBACK(menu_logging_cb), FALSE }, { "EnableSounds", NULL, N_("Enable _Sounds"), NULL, NULL, G_CALLBACK(menu_sounds_cb), FALSE }, { "ShowFormattingToolbars", NULL, N_("Show Formatting _Toolbars"), NULL, NULL, G_CALLBACK(menu_toolbar_cb), FALSE }, - { "ShowTimestamps", NULL, N_("Show Ti_mestamps"), NULL, NULL, G_CALLBACK(menu_timestamps_cb), FALSE }, }; static const char *conversation_menu = @@ -3213,7 +3205,6 @@ static const char *conversation_menu = "" "" "" - "" "
    " "" ""; @@ -3702,9 +3693,6 @@ setup_menubar(PidginWindow *win) win->menu.show_formatting_toolbar = gtk_ui_manager_get_action(win->menu.ui, "/Conversation/OptionsMenu/ShowFormattingToolbars"); - win->menu.show_timestamps = - gtk_ui_manager_get_action(win->menu.ui, - "/Conversation/OptionsMenu/ShowTimestamps"); win->menu.tray = pidgin_menu_tray_new(); gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), @@ -7855,37 +7843,6 @@ tab_side_pref_cb(const char *name, PurplePrefType type, } } -static void -show_timestamps_pref_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - GList *l; - PurpleConversation *conv; - PidginConversation *gtkconv; - PidginWindow *win; - - for (l = purple_get_conversations(); l != NULL; l = l->next) - { - conv = (PurpleConversation *)l->data; - - if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) - continue; - - gtkconv = PIDGIN_CONVERSATION(conv); - win = gtkconv->win; - - gtk_toggle_action_set_active( - GTK_TOGGLE_ACTION(win->menu.show_timestamps), - (gboolean)GPOINTER_TO_INT(value)); - -/* TODO WEBKIT: Use WebKit version of this. */ -#if 0 - gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), - (gboolean)GPOINTER_TO_INT(value)); -#endif /* if 0 */ - } -} - static void show_formatting_toolbar_pref_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data) @@ -8456,7 +8413,6 @@ pidgin_conversations_init(void) purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/custom_smileys_size", 96); purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines", 2); - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", TRUE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", TRUE); purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/placement", "last"); @@ -8505,8 +8461,6 @@ pidgin_conversations_init(void) /* Connect callbacks. */ purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", close_on_tabs_pref_cb, NULL); - purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_timestamps", - show_timestamps_pref_cb, NULL); purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", show_formatting_toolbar_pref_cb, NULL); purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/spellcheck", @@ -9718,9 +9672,6 @@ switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.show_formatting_toolbar), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar")); - gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.show_timestamps), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); - /* * We pause icons when they are not visible. If this icon should * be animated then start it back up again. diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index a51a2908b2..90049f1273 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -68,7 +68,6 @@ struct _PidginWindow GtkAction *logging; GtkAction *sounds; GtkAction *show_formatting_toolbar; - GtkAction *show_timestamps; GtkWidget *send_to; -- cgit v1.2.1 From 455f32a367c35f19d5e97f62accafe48fbf8650e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 28 May 2012 22:33:46 +0000 Subject: Add API for getting default conversation theme. --- pidgin/gtkconv.c | 6 ++++++ pidgin/gtkconv.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 2fbb8be345..fd553eee88 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -8383,6 +8383,12 @@ gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv) return TRUE; } +PurpleTheme * +pidgin_conversations_get_default_theme(void) +{ + return default_conv_theme; +} + void * pidgin_conversations_get_handle(void) { diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index 416a2810cf..9f32af3dd3 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -171,6 +171,13 @@ G_BEGIN_DECLS */ PurpleConversationUiOps *pidgin_conversations_get_conv_ui_ops(void); +/** + * Returns the default theme for GTK+ conversations. + * + * @return The default GTK+ conversation theme. + */ +PurpleTheme *pidgin_conversations_get_default_theme(void); + /** * Updates the buddy icon on a conversation. * -- cgit v1.2.1 From 267e56d84070014436f4087a1f54c1c337c4f35f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 28 May 2012 22:34:59 +0000 Subject: Add a conversation theme with no timestamps. --- pidgin/gtkprefs.c | 42 ++++++++++++---------- .../themes/Contents/Resources/Variants/Default.css | 2 ++ .../Contents/Resources/Variants/No-Timestamps.css | 8 +++++ pidgin/themes/Makefile.am | 3 +- 4 files changed, 35 insertions(+), 20 deletions(-) create mode 100644 pidgin/themes/Contents/Resources/Variants/Default.css create mode 100644 pidgin/themes/Contents/Resources/Variants/No-Timestamps.css diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c index 078c226267..7f05851992 100644 --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -1107,7 +1107,10 @@ prefs_set_conv_variant_cb(GtkComboBox *combo_box, gpointer user_data) if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(prefs_conv_themes_combo_box), &iter)) { gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); - theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + if (name && *name) + theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); + else + theme = PIDGIN_CONV_THEME(pidgin_conversations_get_default_theme()); g_free(name); if (gtk_combo_box_get_active_iter(combo_box, &iter)) { @@ -1126,6 +1129,10 @@ prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) if (gtk_combo_box_get_active_iter(combo_box, &iter)) { gchar *name = NULL; + PidginConvTheme *theme; + const char *current_variant; + const GList *variants; + gboolean unset = TRUE; gtk_tree_model_get(GTK_TREE_MODEL(prefs_conv_themes), &iter, 2, &name, -1); @@ -1137,30 +1144,27 @@ prefs_set_conv_theme_cb(GtkComboBox *combo_box, gpointer user_data) /* Update list of variants */ gtk_list_store_clear(prefs_conv_variants); - if (name && *name) { - PidginConvTheme *theme; - const char *current_variant; - const GList *variants; - gboolean unset = TRUE; - + if (name && *name) theme = PIDGIN_CONV_THEME(purple_theme_manager_find_theme(name, "conversation")); - current_variant = pidgin_conversation_theme_get_variant(theme); + else + theme = PIDGIN_CONV_THEME(pidgin_conversations_get_default_theme()); + + current_variant = pidgin_conversation_theme_get_variant(theme); - variants = pidgin_conversation_theme_get_variants(theme); - for (; variants && current_variant; variants = g_list_next(variants)) { - gtk_list_store_append(prefs_conv_variants, &iter); - gtk_list_store_set(prefs_conv_variants, &iter, 0, variants->data, -1); + variants = pidgin_conversation_theme_get_variants(theme); + for (; variants && current_variant; variants = g_list_next(variants)) { + gtk_list_store_append(prefs_conv_variants, &iter); + gtk_list_store_set(prefs_conv_variants, &iter, 0, variants->data, -1); - if (g_str_equal(variants->data, current_variant)) { - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(prefs_conv_variants_combo_box), &iter); - unset = FALSE; - } + if (g_str_equal(variants->data, current_variant)) { + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(prefs_conv_variants_combo_box), &iter); + unset = FALSE; } - - if (unset) - gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0); } + if (unset) + gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_conv_variants_combo_box), 0); + g_signal_handlers_unblock_by_func(prefs_conv_variants_combo_box, prefs_set_conv_variant_cb, NULL); g_free(name); diff --git a/pidgin/themes/Contents/Resources/Variants/Default.css b/pidgin/themes/Contents/Resources/Variants/Default.css new file mode 100644 index 0000000000..d1c6352610 --- /dev/null +++ b/pidgin/themes/Contents/Resources/Variants/Default.css @@ -0,0 +1,2 @@ +@import ../main.css; + diff --git a/pidgin/themes/Contents/Resources/Variants/No-Timestamps.css b/pidgin/themes/Contents/Resources/Variants/No-Timestamps.css new file mode 100644 index 0000000000..155fe8aa15 --- /dev/null +++ b/pidgin/themes/Contents/Resources/Variants/No-Timestamps.css @@ -0,0 +1,8 @@ +@import ../main.css; + +.x-container .x-time, +.x-status_container .x-time +{ + display: none; +} + diff --git a/pidgin/themes/Makefile.am b/pidgin/themes/Makefile.am index 2e2c1b5ecc..e06e723663 100644 --- a/pidgin/themes/Makefile.am +++ b/pidgin/themes/Makefile.am @@ -8,7 +8,8 @@ themeresources_DATA = Contents/Resources/Content.html \ Contents/Resources/Status.html \ Contents/Resources/main.css themevariantsdir = $(themeresourcesdir)/Variants -themevariants_DATA = +themevariants_DATA = Contents/Resources/Variants/Default.css \ + Contents/Resources/Variants/No-Timestamps.css EXTRA_DIST = \ $(themetemplate_DATA) \ -- cgit v1.2.1 From 4006022578a1fc58dac34f0aa0b9996afaf59643 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 31 May 2012 00:36:55 +0000 Subject: Remove _with_imgstore suffix on this function. There isn't a version without it anyway. --- pidgin/gtknotify.c | 4 ++-- pidgin/gtkwebview.c | 2 +- pidgin/gtkwebview.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c index 41f1f3a61e..02ed54e04a 100644 --- a/pidgin/gtknotify.c +++ b/pidgin/gtknotify.c @@ -891,7 +891,7 @@ pidgin_notify_formatted(const char *title, const char *primary, /* Make sure URLs are clickable */ linked_text = purple_markup_linkify(text); - webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(web_view), linked_text, ""); + gtk_webview_load_html_string(GTK_WEBVIEW(web_view), linked_text); g_free(linked_text); g_object_set_data(G_OBJECT(window), "webview-widget", web_view); @@ -1151,7 +1151,7 @@ pidgin_notify_userinfo(PurpleConnection *gc, const char *who, if (pinfo != NULL) { GtkWidget *webview = g_object_get_data(G_OBJECT(pinfo->window), "webview-widget"); char *linked_text = purple_markup_linkify(info); - gtk_webview_load_html_string_with_imgstore(GTK_WEBVIEW(webview), linked_text); + gtk_webview_load_html_string(GTK_WEBVIEW(webview), linked_text); g_free(linked_text); g_free(key); ui_handle = pinfo->window; diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 912ad808cf..e11fa59973 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -526,7 +526,7 @@ gtk_webview_safe_execute_script(GtkWebView *webview, const char *script) } void -gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html) +gtk_webview_load_html_string(GtkWebView *webview, const char *html) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); char *html_imged; diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index ec6ce22f4a..21ca5f1e99 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -120,7 +120,7 @@ void gtk_webview_append_html(GtkWebView *webview, const char *markup); * @param webview The GtkWebView object * @param html The HTML content to load */ -void gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html); +void gtk_webview_load_html_string(GtkWebView *webview, const char *html); /** * Execute the JavaScript only after the webkit_webview_load_string -- cgit v1.2.1 From fef1231d87df9c0b466b9c22cd03b5cf93fee2a3 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 31 May 2012 03:42:49 +0000 Subject: Use insertAdjacentHtml instead of document.write. This seems a lot better since it correctly applies styles and adds elements to the DOM, which then show up in the inspector. --- pidgin/gtkwebview.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index e11fa59973..a613f1a593 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -551,12 +551,12 @@ void gtk_webview_append_html(GtkWebView *webview, const char *html) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - char *escaped = gtk_webview_quote_js_string(html); - char *script = g_strdup_printf("document.write(%s)", escaped); - webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script); + WebKitDOMDocument *doc; + WebKitDOMHTMLElement *body; + doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + body = webkit_dom_document_get_body(doc); + webkit_dom_html_element_insert_adjacent_html(body, "beforeend", html, NULL); priv->empty = FALSE; - g_free(script); - g_free(escaped); } void -- cgit v1.2.1 From 67d90f22220983c6d1069768dd8dcfd0123621ae Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 31 May 2012 05:32:47 +0000 Subject: Use a webview instead of an imhtml in the XMPP Console viewer. --- pidgin/plugins/xmppconsole.c | 81 ++++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 33 deletions(-) diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index e6344ea46c..39c1b5133a 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -26,6 +26,7 @@ #include "xmlnode.h" #include "gtkimhtml.h" +#include "gtkwebview.h" #include "gtkutils.h" typedef struct { @@ -33,7 +34,7 @@ typedef struct { GtkWidget *window; GtkWidget *hbox; GtkWidget *dropdown; - GtkWidget *imhtml; + GtkWidget *webview; GtkWidget *entry; GtkWidget *sw; int count; @@ -43,11 +44,18 @@ typedef struct { XmppConsole *console = NULL; static void *xmpp_console_handle = NULL; -#define BRACKET_COLOR "#940f8c" -#define TAG_COLOR "#8b1dab" -#define ATTR_NAME_COLOR "#a02961" -#define ATTR_VALUE_COLOR "#324aa4" -#define XMLNS_COLOR "#2cb12f" +#define EMPTY_HTML \ +"" static char * xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) @@ -66,8 +74,8 @@ xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) node_name = g_markup_escape_text(node->name, -1); g_string_append_printf(text, - "<" - "%s", + "<" + "%s", node_name); if (node->xmlns) { @@ -78,8 +86,8 @@ xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) { char *xmlns = g_markup_escape_text(node->xmlns, -1); g_string_append_printf(text, - " xmlns=" - "'%s'", + " xmlns=" + "'%s'", xmlns); g_free(xmlns); } @@ -90,8 +98,8 @@ xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) esc = g_markup_escape_text(c->name, -1); esc2 = g_markup_escape_text(c->data, -1); g_string_append_printf(text, - " %s=" - "'%s'", + " %s=" + "'%s'", esc, esc2); g_free(esc); g_free(esc2); @@ -104,7 +112,7 @@ xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) if (need_end) { g_string_append_printf(text, - ">%s", + ">%s", pretty ? "
    " : ""); for (c = node->child; c; c = c->next) @@ -124,20 +132,20 @@ xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) if(tab && pretty) text = g_string_append(text, tab); g_string_append_printf(text, - "</" - "%s" - ">
    ", + "</" + "%s" + ">
    ", node_name); } else { g_string_append_printf(text, - "/>
    "); + "/>
    "); } g_free(node_name); g_free(tab); - if(len) + if (len) *len = text->len; return g_string_free(text, FALSE); @@ -151,8 +159,8 @@ xmlnode_received_cb(PurpleConnection *gc, xmlnode **packet, gpointer null) if (!console || console->gc != gc) return; str = xmlnode_to_pretty_str(*packet, NULL, 0); - formatted = g_strdup_printf("
    %s
    ", str); - gtk_imhtml_append_text(GTK_IMHTML(console->imhtml), formatted, 0); + formatted = g_strdup_printf("
    %s
    ", str); + gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); g_free(formatted); g_free(str); } @@ -172,8 +180,8 @@ xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) return; str = xmlnode_to_pretty_str(node, NULL, 0); - formatted = g_strdup_printf("
    %s
    ", str); - gtk_imhtml_append_text(GTK_IMHTML(console->imhtml), formatted, 0); + formatted = g_strdup_printf("
    %s
    ", str); + gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); g_free(formatted); g_free(str); xmlnode_free(node); @@ -653,9 +661,10 @@ signing_on_cb(PurpleConnection *gc) console->accounts = g_list_append(console->accounts, gc); console->count++; - if (console->count == 1) + if (console->count == 1) { console->gc = gc; - else + gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); + } else gtk_widget_show_all(console->hbox); } @@ -685,9 +694,11 @@ signed_off_cb(PurpleConnection *gc) console->count--; if (gc == console->gc) { + char *tmp = g_strdup_printf("
    %s
    ", + _("Logged out.")); + gtk_webview_append_html(GTK_WEBVIEW(console->webview), tmp); + g_free(tmp); console->gc = NULL; - gtk_imhtml_append_text(GTK_IMHTML(console->imhtml), - _("Logged out."), 0); } } @@ -743,7 +754,7 @@ dropdown_changed_cb(GtkComboBox *widget, gpointer nul) return; console->gc = purple_account_get_connection(account); - gtk_imhtml_clear(GTK_IMHTML(console->imhtml)); + gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); } static void @@ -785,16 +796,20 @@ create_console(PurplePluginAction *action) console->gc = gc; } } - gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown),0); + gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL); - console->imhtml = gtk_imhtml_new(NULL, NULL); - if (console->count == 0) - gtk_imhtml_append_text(GTK_IMHTML(console->imhtml), - _("Not connected to XMPP"), 0); + console->webview = gtk_webview_new(); + gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); + if (console->count == 0) { + char *tmp = g_strdup_printf("
    %s
    ", + _("Not connected to XMPP")); + gtk_webview_append_html(GTK_WEBVIEW(console->webview), tmp); + g_free(tmp); + } gtk_box_pack_start(GTK_BOX(vbox), - pidgin_make_scrollable(console->imhtml, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1), + pidgin_make_scrollable(console->webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1), TRUE, TRUE, 0); toolbar = gtk_toolbar_new(); -- cgit v1.2.1 From 9882d5a48c408c4d8975c45669833ce4787f393d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 31 May 2012 05:38:31 +0000 Subject: The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening. --- pidgin/plugins/xmppconsole.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index 39c1b5133a..c1b3544ac6 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -654,16 +654,23 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) static void signing_on_cb(PurpleConnection *gc) { + PurpleAccount *account; + if (!console) return; - gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), purple_account_get_username(purple_connection_get_account(gc))); + account = purple_connection_get_account(gc); + if (strcmp(purple_account_get_protocol_id(account), "prpl-jabber")) + return; + + gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), purple_account_get_username(account)); console->accounts = g_list_append(console->accounts, gc); console->count++; if (console->count == 1) { console->gc = gc; gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); + gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); } else gtk_widget_show_all(console->hbox); } -- cgit v1.2.1 From 7eeec71c02c01c3e361371dacfd65d81bfa24e0c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 31 May 2012 05:45:28 +0000 Subject: No need to search for accounts when we already have a list of them. --- pidgin/plugins/xmppconsole.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index c1b3544ac6..ec415f5eb2 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -755,12 +755,7 @@ dropdown_changed_cb(GtkComboBox *widget, gpointer nul) if (!console) return; - account = purple_accounts_find(gtk_combo_box_get_active_text(GTK_COMBO_BOX(console->dropdown)), - "prpl-jabber"); - if (!account || !purple_account_get_connection(account)) - return; - - console->gc = purple_account_get_connection(account); + console->gc = g_list_nth_data(console->accounts, gtk_combo_box_get_active(GTK_COMBO_BOX(console->dropdown))); gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); } -- cgit v1.2.1 From 4e525427779edc4470b47f381cd1d564f9346dc4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 31 May 2012 06:09:59 +0000 Subject: Use 'div's for indent which allows WebKit to do better word-wrapping. --- pidgin/plugins/xmppconsole.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index ec415f5eb2..ae61942589 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -46,7 +46,8 @@ static void *xmpp_console_handle = NULL; #define EMPTY_HTML \ "" static char * -xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) +xmlnode_to_pretty_str(xmlnode *node, int *len) { GString *text = g_string_new(""); xmlnode *c; - char *node_name, *esc, *esc2, *tab = NULL; + char *node_name, *esc, *esc2; gboolean need_end = FALSE, pretty = TRUE; g_return_val_if_fail(node != NULL, NULL); - if (pretty && depth) { - tab = g_strnfill(depth, '\t'); - text = g_string_append(text, tab); - } - node_name = g_markup_escape_text(node->name, -1); g_string_append_printf(text, "<" @@ -115,11 +111,16 @@ xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) ">%s", pretty ? "
    " : ""); + need_end = FALSE; for (c = node->child; c; c = c->next) { if (c->type == XMLNODE_TYPE_TAG) { int esc_len; - esc = xmlnode_to_pretty_str(c, &esc_len, depth+1); + esc = xmlnode_to_pretty_str(c, &esc_len); + if (!need_end) { + g_string_append(text, "
    "); + need_end = TRUE; + } text = g_string_append_len(text, esc, esc_len); g_free(esc); } else if (c->type == XMLNODE_TYPE_DATA && c->data_sz > 0) { @@ -129,8 +130,9 @@ xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) } } - if(tab && pretty) - text = g_string_append(text, tab); + if (need_end) + g_string_append(text, "
    "); + g_string_append_printf(text, "</" "%s" @@ -143,8 +145,6 @@ xmlnode_to_pretty_str(xmlnode *node, int *len, int depth) g_free(node_name); - g_free(tab); - if (len) *len = text->len; @@ -158,7 +158,7 @@ xmlnode_received_cb(PurpleConnection *gc, xmlnode **packet, gpointer null) if (!console || console->gc != gc) return; - str = xmlnode_to_pretty_str(*packet, NULL, 0); + str = xmlnode_to_pretty_str(*packet, NULL); formatted = g_strdup_printf("
    %s
    ", str); gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); g_free(formatted); @@ -179,7 +179,7 @@ xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) if (!node) return; - str = xmlnode_to_pretty_str(node, NULL, 0); + str = xmlnode_to_pretty_str(node, NULL); formatted = g_strdup_printf("
    %s
    ", str); gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); g_free(formatted); @@ -750,8 +750,6 @@ console_destroy(GtkObject *window, gpointer nul) static void dropdown_changed_cb(GtkComboBox *widget, gpointer nul) { - PurpleAccount *account; - if (!console) return; -- cgit v1.2.1 -- cgit v1.2.1 From 662c657eb2e1f1534aa65519414897ffa6808550 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 2 Jun 2012 19:01:44 +0000 Subject: Add some convenience functions to get the contents of a GtkWebView. --- pidgin/gtkwebview.c | 42 ++++++++++++++++++++++++++++++++++++++++++ pidgin/gtkwebview.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index a613f1a593..ac7a8a2487 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -743,6 +743,48 @@ gtk_webview_set_format_functions(GtkWebView *webview, GtkWebViewButtons buttons) g_object_unref(object); } +gchar * +gtk_webview_get_head_html(GtkWebView *webview) +{ + WebKitDOMDocument *doc; + WebKitDOMHTMLHeadElement *head; + gchar *html; + + doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + head = webkit_dom_document_get_head(doc); + html = webkit_dom_html_element_get_inner_html(WEBKIT_DOM_HTML_ELEMENT(head)); + + return html; +} + +gchar * +gtk_webview_get_body_html(GtkWebView *webview) +{ + WebKitDOMDocument *doc; + WebKitDOMHTMLElement *body; + gchar *html; + + doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + body = webkit_dom_document_get_body(doc); + html = webkit_dom_html_element_get_inner_html(body); + + return html; +} + +gchar * +gtk_webview_get_body_text(GtkWebView *webview) +{ + WebKitDOMDocument *doc; + WebKitDOMHTMLElement *body; + gchar *text; + + doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + body = webkit_dom_document_get_body(doc); + text = webkit_dom_html_element_get_inner_text(body); + + return text; +} + GtkWebViewButtons gtk_webview_get_format_functions(GtkWebView *webview) { diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 21ca5f1e99..af3ef03f49 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -282,6 +282,34 @@ gint gtk_webview_get_current_fontsize(GtkWebView *webview); */ gboolean gtk_webview_get_editable(GtkWebView *webview); +/** + * Gets the content of the head element of a GtkWebView as HTML. + * + * @param webview The GtkWebView + * + * @return The HTML from the head element. + */ +gchar *gtk_webview_get_head_html(GtkWebView *webview); + +/** + * Gets the HTML content of a GtkWebView. + * + * @param webview The GtkWebView + * + * @return The HTML that is currently displayed. + */ +gchar *gtk_webview_get_body_html(GtkWebView *webview); + +/** + * Gets the text content of a GtkWebView. + * + * @param webview The GtkWebView + * + * @return The HTML-free text that is currently displayed. + */ +gchar *gtk_webview_get_body_text(GtkWebView *webview); +gchar *gtk_webview_get_head_text(GtkWebView *webview); + /** * Clear all the formatting on a GtkWebView. * -- cgit v1.2.1 From 73a5e6b61e6cb5d6101fb6c9abf1cc06014bd0ec Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 2 Jun 2012 19:08:43 +0000 Subject: Restore the conversation SaveAs functionality. --- pidgin/gtkconv.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index d1ae0664dd..2d31103555 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1066,12 +1066,10 @@ menu_join_chat_cb(GtkAction *action, gpointer data) static void savelog_writefile_cb(void *user_data, const char *filename) { - /* TODO WEBKIT: I don't know how to support this using webkit yet. */ -#if 0 PurpleConversation *conv = (PurpleConversation *)user_data; + GtkWebView *webview; FILE *fp; const char *name; - char **lines; gchar *text; if ((fp = g_fopen(filename, "w+")) == NULL) { @@ -1079,22 +1077,27 @@ savelog_writefile_cb(void *user_data, const char *filename) return; } + webview = GTK_WEBVIEW(PIDGIN_CONVERSATION(conv)->webview); name = purple_conversation_get_name(conv); - fprintf(fp, "\n\n"); + fprintf(fp, "\n"); + + fprintf(fp, "\n"); fprintf(fp, "\n"); - fprintf(fp, "%s\n\n\n", name); - fprintf(fp, _("

    Conversation with %s

    \n"), name); + fprintf(fp, "%s\n", name); + text = gtk_webview_get_head_html(webview); + fprintf(fp, "%s", text); + g_free(text); + fprintf(fp, "\n"); - lines = gtk_imhtml_get_markup_lines( - GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml)); - text = g_strjoinv("
    \n", lines); + fprintf(fp, "\n"); + fprintf(fp, _("

    Conversation with %s

    \n"), name); + text = gtk_webview_get_body_html(webview); fprintf(fp, "%s", text); g_free(text); - g_strfreev(lines); + fprintf(fp, "\n\n"); - fprintf(fp, "\n\n\n"); + fprintf(fp, "\n"); fclose(fp); -#endif /* if 0 */ } /* -- cgit v1.2.1 From 60964c45872e70e134fff7694b48258c99ca5136 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Jun 2012 07:40:47 +0000 Subject: Setup WBFO in a WebView. Though, really, I wish execCommand could work on arbitrary ranges instead of needed to save and restore the selection. --- pidgin/gtkwebview.c | 76 ++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index ac7a8a2487..56c9b5fbd5 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -868,49 +868,61 @@ gtk_webview_clear_formatting(GtkWebView *webview) g_object_unref(object); } -void -gtk_webview_toggle_bold(GtkWebView *webview) +static void +do_formatting(GtkWebView *webview, const char *name, const char *value) { + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; + WebKitDOMDOMWindow *win = NULL; + WebKitDOMDOMSelection *sel; + WebKitDOMRange *range = NULL; dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "bold", FALSE, ""); + + if (priv->edit.wbfo) { + win = webkit_dom_document_get_default_view(dom); + sel = webkit_dom_dom_window_get_selection(win); + range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL); + webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview)); + } + + webkit_dom_document_exec_command(dom, name, FALSE, value); + + if (priv->edit.wbfo) { + sel = webkit_dom_dom_window_get_selection(win); + webkit_dom_dom_selection_remove_all_ranges(sel); + webkit_dom_dom_selection_add_range(sel, range); + } } void -gtk_webview_toggle_italic(GtkWebView *webview) +gtk_webview_toggle_bold(GtkWebView *webview) { - WebKitDOMDocument *dom; + do_formatting(webview, "bold", ""); +} - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "italic", FALSE, ""); +void +gtk_webview_toggle_italic(GtkWebView *webview) +{ + do_formatting(webview, "italic", ""); } void gtk_webview_toggle_underline(GtkWebView *webview) { - WebKitDOMDocument *dom; - - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "underline", FALSE, ""); + do_formatting(webview, "underline", ""); } void gtk_webview_toggle_strike(GtkWebView *webview) { - WebKitDOMDocument *dom; - - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "strikethrough", FALSE, ""); + do_formatting(webview, "strikethrough", ""); } gboolean gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) { - WebKitDOMDocument *dom; - - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "foreColor", FALSE, color); + do_formatting(webview, "foreColor", color); return FALSE; } @@ -918,10 +930,7 @@ gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) gboolean gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) { - WebKitDOMDocument *dom; - - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "backColor", FALSE, color); + do_formatting(webview, "backColor", color); return FALSE; } @@ -929,10 +938,7 @@ gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) gboolean gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) { - WebKitDOMDocument *dom; - - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "fontName", FALSE, face); + do_formatting(webview, "fontName", face); return FALSE; } @@ -940,44 +946,36 @@ gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) void gtk_webview_font_set_size(GtkWebView *webview, gint size) { - WebKitDOMDocument *dom; - char *tmp; - - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - tmp = g_strdup_printf("%d", size); - webkit_dom_document_exec_command(dom, "fontSize", FALSE, tmp); + char *tmp = g_strdup_printf("%d", size); + do_formatting(webview, "fontSize", tmp); g_free(tmp); } void gtk_webview_font_shrink(GtkWebView *webview) { - WebKitDOMDocument *dom; gint fontsize; char *tmp; fontsize = gtk_webview_get_current_fontsize(webview); fontsize = MAX(fontsize - 1, 1); - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); tmp = g_strdup_printf("%d", fontsize); - webkit_dom_document_exec_command(dom, "fontSize", FALSE, tmp); + do_formatting(webview, "fontSize", tmp); g_free(tmp); } void gtk_webview_font_grow(GtkWebView *webview) { - WebKitDOMDocument *dom; gint fontsize; char *tmp; fontsize = gtk_webview_get_current_fontsize(webview); fontsize = MIN(fontsize + 1, MAX_FONT_SIZE); - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); tmp = g_strdup_printf("%d", fontsize); - webkit_dom_document_exec_command(dom, "fontSize", FALSE, tmp); + do_formatting(webview, "fontSize", tmp); g_free(tmp); } -- cgit v1.2.1 From 35c6d823ad19a665623509aaf8a7e2e01b19e187 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Jun 2012 19:40:55 +0000 Subject: Add a changed signal shortcut for editable webview changes. --- pidgin/gtkwebview.c | 26 ++++++++++++++++++++++++++ pidgin/gtkwebview.h | 1 + 2 files changed, 27 insertions(+) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 56c9b5fbd5..991dd40a4e 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -43,6 +43,7 @@ enum { TOGGLE_FORMAT, CLEAR_FORMAT, UPDATE_FORMAT, + CHANGED, LAST_SIGNAL }; static guint signals[LAST_SIGNAL] = { 0 }; @@ -343,6 +344,12 @@ webview_toggle_format(GtkWebView *webview, GtkWebViewButtons buttons) } } +static void +editable_input_cb(GtkWebView *webview, WebKitDOMEvent *event, void *data) +{ + g_signal_emit(webview, signals[CHANGED], 0); +} + /****************************************************************************** * GObject Stuff *****************************************************************************/ @@ -404,6 +411,12 @@ gtk_webview_class_init(GtkWebViewClass *klass, gpointer userdata) G_STRUCT_OFFSET(GtkWebViewClass, update_format), NULL, 0, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + signals[CHANGED] = g_signal_new("changed", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(GtkWebViewClass, changed), + NULL, NULL, g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); klass->toggle_format = webview_toggle_format; klass->clear_format = webview_clear_formatting; @@ -625,7 +638,20 @@ gtk_webview_page_down(GtkWebView *webview) void gtk_webview_set_editable(GtkWebView *webview, gboolean editable) { + WebKitDOMDocument *doc; + webkit_web_view_set_editable(WEBKIT_WEB_VIEW(webview), editable); + + doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + if (editable) { + webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(doc), + "input", G_CALLBACK(editable_input_cb), + FALSE, NULL); + } else { + webkit_dom_event_target_remove_event_listener(WEBKIT_DOM_EVENT_TARGET(doc), + "input", G_CALLBACK(editable_input_cb), + FALSE); + } } void diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index af3ef03f49..662a6fbc88 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -74,6 +74,7 @@ struct _GtkWebViewClass void (*toggle_format)(GtkWebView *, GtkWebViewButtons); void (*clear_format)(GtkWebView *); void (*update_format)(GtkWebView *); + void (*changed)(GtkWebView *); }; G_BEGIN_DECLS -- cgit v1.2.1 From 855472b7e020544dcb8ddfcdc8103b35dea24d68 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Jun 2012 19:58:23 +0000 Subject: Fix parameters to input signal handler. --- pidgin/gtkwebview.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 991dd40a4e..32ed405f38 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -345,7 +345,7 @@ webview_toggle_format(GtkWebView *webview, GtkWebViewButtons buttons) } static void -editable_input_cb(GtkWebView *webview, WebKitDOMEvent *event, void *data) +editable_input_cb(GObject *target, WebKitDOMEvent *event, GtkWebView *webview) { g_signal_emit(webview, signals[CHANGED], 0); } @@ -646,7 +646,7 @@ gtk_webview_set_editable(GtkWebView *webview, gboolean editable) if (editable) { webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(doc), "input", G_CALLBACK(editable_input_cb), - FALSE, NULL); + FALSE, webview); } else { webkit_dom_event_target_remove_event_listener(WEBKIT_DOM_EVENT_TARGET(doc), "input", G_CALLBACK(editable_input_cb), -- cgit v1.2.1 From 0e3610ebc68f7a6518e9244a923077ef51755c9f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Jun 2012 20:01:56 +0000 Subject: Clear formatting should also obey WBFO. --- pidgin/gtkwebview.c | 57 +++++++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 32ed405f38..27be810a58 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -302,15 +302,39 @@ scroll_idle_cb(gpointer data) } static void -webview_clear_formatting(GtkWebView *webview) +do_formatting(GtkWebView *webview, const char *name, const char *value) { + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; + WebKitDOMDOMWindow *win = NULL; + WebKitDOMDOMSelection *sel; + WebKitDOMRange *range = NULL; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + + if (priv->edit.wbfo) { + win = webkit_dom_document_get_default_view(dom); + sel = webkit_dom_dom_window_get_selection(win); + range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL); + webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview)); + } + + webkit_dom_document_exec_command(dom, name, FALSE, value); + + if (priv->edit.wbfo) { + sel = webkit_dom_dom_window_get_selection(win); + webkit_dom_dom_selection_remove_all_ranges(sel); + webkit_dom_dom_selection_add_range(sel, range); + } +} +static void +webview_clear_formatting(GtkWebView *webview) +{ if (!webkit_web_view_get_editable(WEBKIT_WEB_VIEW(webview))) return; - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - webkit_dom_document_exec_command(dom, "removeFormat", FALSE, ""); + do_formatting(webview, "removeFormat", ""); } static void @@ -894,33 +918,6 @@ gtk_webview_clear_formatting(GtkWebView *webview) g_object_unref(object); } -static void -do_formatting(GtkWebView *webview, const char *name, const char *value) -{ - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - WebKitDOMDocument *dom; - WebKitDOMDOMWindow *win = NULL; - WebKitDOMDOMSelection *sel; - WebKitDOMRange *range = NULL; - - dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - - if (priv->edit.wbfo) { - win = webkit_dom_document_get_default_view(dom); - sel = webkit_dom_dom_window_get_selection(win); - range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL); - webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview)); - } - - webkit_dom_document_exec_command(dom, name, FALSE, value); - - if (priv->edit.wbfo) { - sel = webkit_dom_dom_window_get_selection(win); - webkit_dom_dom_selection_remove_all_ranges(sel); - webkit_dom_dom_selection_add_range(sel, range); - } -} - void gtk_webview_toggle_bold(GtkWebView *webview) { -- cgit v1.2.1 From 075a0ec45b352a8d423c8ee16a55cb56a1779bb3 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Jun 2012 20:03:35 +0000 Subject: Don't emit the changed signal when modifying the webview ourselves. --- pidgin/gtkwebview.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 27be810a58..2ad3f79164 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -69,6 +69,7 @@ typedef struct _GtkWebViewPriv { GtkWebViewButtons format_functions; struct { gboolean wbfo:1; /* Whole buffer formatting only. */ + gboolean block_changed:1; } edit; } GtkWebViewPriv; @@ -319,7 +320,9 @@ do_formatting(GtkWebView *webview, const char *name, const char *value) webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview)); } + priv->edit.block_changed = TRUE; webkit_dom_document_exec_command(dom, name, FALSE, value); + priv->edit.block_changed = FALSE; if (priv->edit.wbfo) { sel = webkit_dom_dom_window_get_selection(win); @@ -371,7 +374,9 @@ webview_toggle_format(GtkWebView *webview, GtkWebViewButtons buttons) static void editable_input_cb(GObject *target, WebKitDOMEvent *event, GtkWebView *webview) { - g_signal_emit(webview, signals[CHANGED], 0); + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + if (!priv->edit.block_changed) + g_signal_emit(webview, signals[CHANGED], 0); } /****************************************************************************** -- cgit v1.2.1 From 2b6eb961a2438969f06c38623b8e282728112237 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Jun 2012 20:23:23 +0000 Subject: Convert the XMPP Console entry to WebKit. Only thing it doesn't do is auto-sizing the entry widget. --- pidgin/plugins/xmppconsole.c | 54 +++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index ae61942589..df6f04c2c5 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -29,6 +29,8 @@ #include "gtkwebview.h" #include "gtkutils.h" +#include + typedef struct { PurpleConnection *gc; GtkWidget *window; @@ -187,44 +189,47 @@ xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) xmlnode_free(node); } -static void message_send_cb(GtkWidget *widget, gpointer p) +static gboolean +message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p) { - GtkTextIter start, end; PurplePluginProtocolInfo *prpl_info = NULL; PurpleConnection *gc; - GtkTextBuffer *buffer; - char *text; + gchar *text; + + if (event->keyval != GDK_KEY_KP_Enter && event->keyval != GDK_KEY_Return) + return FALSE; gc = console->gc; if (gc) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); - gtk_text_buffer_get_start_iter(buffer, &start); - gtk_text_buffer_get_end_iter(buffer, &end); - - text = gtk_imhtml_get_text(GTK_IMHTML(console->entry), &start, &end); + text = gtk_webview_get_body_text(GTK_WEBVIEW(widget)); if (prpl_info && prpl_info->send_raw != NULL) prpl_info->send_raw(gc, text, strlen(text)); g_free(text); - gtk_imhtml_clear(GTK_IMHTML(console->entry)); + gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), ""); + + return TRUE; } -static void entry_changed_cb(GtkTextBuffer *buffer, void *data) +static void +entry_changed_cb(GtkWidget *webview, void *data) { char *xmlstr, *str; - GtkTextIter iter; +#if 0 int wrapped_lines; int lines; GdkRectangle oneline; int height; int pad_top, pad_inside, pad_bottom; - GtkTextIter start, end; +#endif xmlnode *node; +#if 0 + /* TODO WebKit: Do entry auto-sizing... */ wrapped_lines = 1; gtk_text_buffer_get_start_iter(buffer, &iter); gtk_text_view_get_iter_location(GTK_TEXT_VIEW(console->entry), &iter, &oneline); @@ -245,18 +250,17 @@ static void entry_changed_cb(GtkTextBuffer *buffer, void *data) height += (oneline.height + pad_inside) * (wrapped_lines - lines); gtk_widget_set_size_request(console->sw, -1, height + 6); +#endif - gtk_text_buffer_get_start_iter(buffer, &start); - gtk_text_buffer_get_end_iter(buffer, &end); - str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); + str = gtk_webview_get_body_text(GTK_WEBVIEW(webview)); if (!str) return; xmlstr = g_strdup_printf("%s", str); node = xmlnode_from_str(xmlstr, -1); if (node) { - gtk_imhtml_clear_formatting(GTK_IMHTML(console->entry)); + gtk_webview_clear_formatting(GTK_WEBVIEW(console->entry)); } else { - gtk_imhtml_toggle_background(GTK_IMHTML(console->entry), "#ffcece"); + gtk_webview_toggle_backcolor(GTK_WEBVIEW(console->entry), "#ffcece"); } g_free(str); g_free(xmlstr); @@ -762,7 +766,6 @@ create_console(PurplePluginAction *action) { GtkWidget *vbox = gtk_vbox_new(FALSE, 6); GtkWidget *label; - GtkTextBuffer *buffer; GtkWidget *toolbar; GList *connections; GtkToolItem *button; @@ -830,17 +833,16 @@ create_console(PurplePluginAction *action) gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); - console->entry = gtk_imhtml_new(NULL, NULL); - gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(console->entry), TRUE); - g_signal_connect(G_OBJECT(console->entry),"message_send", G_CALLBACK(message_send_cb), console); + console->entry = gtk_webview_new(); + gtk_webview_set_whole_buffer_formatting_only(GTK_WEBVIEW(console->entry), TRUE); + g_signal_connect(G_OBJECT(console->entry),"key-press-event", G_CALLBACK(message_send_cb), console); console->sw = pidgin_make_scrollable(console->entry, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1); gtk_box_pack_start(GTK_BOX(vbox), console->sw, FALSE, FALSE, 0); - gtk_imhtml_set_editable(GTK_IMHTML(console->entry), TRUE); - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); - g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(entry_changed_cb), NULL); + gtk_webview_set_editable(GTK_WEBVIEW(console->entry), TRUE); + g_signal_connect(G_OBJECT(console->entry), "changed", G_CALLBACK(entry_changed_cb), NULL); - entry_changed_cb(buffer, NULL); + entry_changed_cb(console->entry, NULL); gtk_widget_show_all(console->window); if (console->count < 2) -- cgit v1.2.1 From c4210a369ea45d872ee41fcbe87f53aa07cf4a05 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Jun 2012 20:50:42 +0000 Subject: Restore Insert Horizontal Rule functionality. --- pidgin/gtkwebview.c | 13 +++++++++++++ pidgin/gtkwebview.h | 8 ++++++++ pidgin/gtkwebviewtoolbar.c | 11 +---------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 2ad3f79164..734d372e3c 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -1007,3 +1007,16 @@ gtk_webview_font_grow(GtkWebView *webview) g_free(tmp); } +void +gtk_webview_insert_hr(GtkWebView *webview) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + + priv->edit.block_changed = TRUE; + webkit_dom_document_exec_command(dom, "insertHorizontalRule", FALSE, ""); + priv->edit.block_changed = FALSE; +} + diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 662a6fbc88..de43b80dfd 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -402,6 +402,14 @@ void gtk_webview_font_shrink(GtkWebView *webview); */ void gtk_webview_font_grow(GtkWebView *webview); +/** + * Inserts a horizontal rule at the current location or selection in a + * GtkWebView. + * + * @param webview The GtkWebView + */ +void gtk_webview_insert_hr(GtkWebView *webview); + G_END_DECLS #endif /* _PIDGIN_WEBVIEW_H_ */ diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index dec473fe15..8d4ce9f551 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -569,16 +569,7 @@ insert_link_cb(GtkWidget *w, GtkWebViewToolbar *toolbar) static void insert_hr_cb(GtkWidget *widget, GtkWebViewToolbar *toolbar) { -#if 0 - GtkTextIter iter; - GtkTextMark *ins; - GtkIMHtmlScalable *hr; - - ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview))); - gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview)), &iter, ins); - hr = gtk_webview_hr_new(); - gtk_webview_hr_add_to(hr, GTK_WEBVIEW(toolbar->webview), &iter); -#endif + gtk_webview_insert_hr(GTK_WEBVIEW(toolbar->webview)); } static void -- cgit v1.2.1 From 9e0c1546881061b7d602c9687030e6a4b799c23c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Jun 2012 21:00:43 +0000 Subject: Restore "Insert Link" functionality. --- pidgin/gtkwebview.c | 16 ++++++++++++++++ pidgin/gtkwebview.h | 10 ++++++++++ pidgin/gtkwebviewtoolbar.c | 9 +-------- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 734d372e3c..cc6e261129 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -1020,3 +1020,19 @@ gtk_webview_insert_hr(GtkWebView *webview) priv->edit.block_changed = FALSE; } +void +gtk_webview_insert_link(GtkWebView *webview, const char *url, const char *desc) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + char *link; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + link = g_strdup_printf("%s", url, desc ? desc : url); + + priv->edit.block_changed = TRUE; + webkit_dom_document_exec_command(dom, "insertHTML", FALSE, link); + priv->edit.block_changed = FALSE; + g_free(link); +} + diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index de43b80dfd..aaeb3db602 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -410,6 +410,16 @@ void gtk_webview_font_grow(GtkWebView *webview); */ void gtk_webview_insert_hr(GtkWebView *webview); +/** + * Inserts a link at the current location or selection in a GtkWebView. + * + * @param webview The GtkWebView + * @param url The URL of the link + * @param desc The text description of the link. If not supplied, the URL is + * used instead. + */ +void gtk_webview_insert_link(GtkWebView *webview, const char *url, const char *desc); + G_END_DECLS #endif /* _PIDGIN_WEBVIEW_H_ */ diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index 8d4ce9f551..a528ad5e05 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -494,14 +494,7 @@ do_insert_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields) else description = NULL; - if (description == NULL) - description = url; - -#if 0 - gtk_webview_insert_link(GTK_WEBVIEW(toolbar->webview), - gtk_text_buffer_get_insert(GTK_WEBVIEW(toolbar->webview)->text_buffer), - url, description); -#endif + gtk_webview_insert_link(GTK_WEBVIEW(toolbar->webview), url, description); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->link), FALSE); -- cgit v1.2.1 From d0a49ebff61fb1a767050750a436fd8b50681b46 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 3 Jun 2012 21:13:19 +0000 Subject: Set up the link description from the already selected text. --- pidgin/gtkwebview.c | 16 ++++++++++++++++ pidgin/gtkwebview.h | 11 ++++++++++- pidgin/gtkwebviewtoolbar.c | 9 +-------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index cc6e261129..5e505fcf7e 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -840,6 +840,22 @@ gtk_webview_get_body_text(GtkWebView *webview) return text; } +gchar * +gtk_webview_get_selected_text(GtkWebView *webview) +{ + WebKitDOMDocument *dom; + WebKitDOMDOMWindow *win; + WebKitDOMDOMSelection *sel; + WebKitDOMRange *range; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + win = webkit_dom_document_get_default_view(dom); + sel = webkit_dom_dom_window_get_selection(win); + range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL); + + return webkit_dom_range_get_text(range); +} + GtkWebViewButtons gtk_webview_get_format_functions(GtkWebView *webview) { diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index aaeb3db602..ee194e16e8 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -309,7 +309,16 @@ gchar *gtk_webview_get_body_html(GtkWebView *webview); * @return The HTML-free text that is currently displayed. */ gchar *gtk_webview_get_body_text(GtkWebView *webview); -gchar *gtk_webview_get_head_text(GtkWebView *webview); + +/** + * Gets the selected text of a GtkWebView. + * + * @param webview The GtkWebView + * + * @return The HTML-free text that is currently selected, or NULL if nothing is + * currently selected. + */ +gchar *gtk_webview_get_selected_text(GtkWebView *webview); /** * Clear all the formatting on a GtkWebView. diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index a528ad5e05..87bc192035 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -509,9 +509,6 @@ insert_link_cb(GtkWidget *w, GtkWebViewToolbar *toolbar) PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field; -#if 0 - GtkTextIter start, end; -#endif char *msg; char *desc = NULL; @@ -525,11 +522,7 @@ insert_link_cb(GtkWidget *w, GtkWebViewToolbar *toolbar) purple_request_field_group_add_field(group, field); if (gtk_webview_get_format_functions(GTK_WEBVIEW(toolbar->webview)) & GTK_WEBVIEW_LINKDESC) { -#if 0 - if (gtk_text_buffer_get_selection_bounds(GTK_WEBVIEW(toolbar->webview)->text_buffer, &start, &end)) { - desc = gtk_webview_get_text(GTK_WEBVIEW(toolbar->webview), &start, &end); - } -#endif + desc = gtk_webview_get_selected_text(GTK_WEBVIEW(toolbar->webview)); field = purple_request_field_string_new("description", _("_Description"), desc, FALSE); purple_request_field_group_add_field(group, field); -- cgit v1.2.1 From 16c891a9393cf46331b32ab7e0db4527c8337ff7 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 5 Jun 2012 05:35:29 +0000 Subject: Convert the Webview toolbar to a real GtkToolbar with GtkActions. With GtkActions, we can let GTK take care of keeping sensitivity in sync. And hopefully, a real toolbar will look better in GTK3. --- pidgin/gtkwebviewtoolbar.c | 778 ++++++++++++++++++++------------------------- 1 file changed, 342 insertions(+), 436 deletions(-) diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index 87bc192035..7e1e39e7fa 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -43,15 +43,6 @@ #include -#if !GTK_CHECK_VERSION(2,18,0) -#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE((x)) -#define gtk_widget_is_sensitive(x) GTK_WIDGET_IS_SENSITIVE((x)) -#if !GTK_CHECK_VERSION(2,12,0) -#define gtk_widget_set_tooltip_text(w, t) \ - gtk_tooltips_set_tip(priv->tooltips, (w), (t), NULL) -#endif -#endif - #define GTK_WEBVIEWTOOLBAR_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_WEBVIEWTOOLBAR, GtkWebViewToolbarPriv)) @@ -65,36 +56,33 @@ typedef struct _GtkWebViewToolbarPriv { GtkWidget *wide_view; GtkWidget *lean_view; -#if !GTK_CHECK_VERSION(2,12,0) - GtkTooltips *tooltips; -#endif - GtkWidget *font_label; GtkWidget *font_menu; - GtkWidget *bold; - GtkWidget *italic; - GtkWidget *underline; - GtkWidget *strike; + GtkAction *bold; + GtkAction *italic; + GtkAction *underline; + GtkAction *strike; - GtkWidget *larger_size; - GtkWidget *normal_size; - GtkWidget *smaller_size; + GtkAction *larger_size; +#if 0 + GtkAction *normal_size; +#endif + GtkAction *smaller_size; - GtkWidget *font; - GtkWidget *fgcolor; - GtkWidget *bgcolor; + GtkAction *font; + GtkAction *fgcolor; + GtkAction *bgcolor; - GtkWidget *clear; + GtkAction *clear; GtkWidget *insert_menu; - GtkWidget *image; - GtkWidget *link; - GtkWidget *insert_hr; + GtkAction *image; + GtkAction *link; + GtkAction *hr; - GtkWidget *smiley; - GtkWidget *attention; - GtkWidget *call; + GtkAction *smiley; + GtkAction *attention; GtkWidget *font_dialog; GtkWidget *fgcolor_dialog; @@ -117,19 +105,15 @@ static GtkHBoxClass *parent_class = NULL; *****************************************************************************/ static void -toggle_button_set_active_block(GtkToggleButton *button, gboolean is_active, +toggle_action_set_active_block(GtkToggleAction *action, gboolean is_active, GtkWebViewToolbar *toolbar); -static gboolean -gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, - GtkWebViewToolbar *toolbar); - /****************************************************************************** * Helpers *****************************************************************************/ static void -do_bold(GtkWidget *bold, GtkWebViewToolbar *toolbar) +do_bold(GtkAction *bold, GtkWebViewToolbar *toolbar) { g_return_if_fail(toolbar != NULL); gtk_webview_toggle_bold(GTK_WEBVIEW(toolbar->webview)); @@ -137,7 +121,7 @@ do_bold(GtkWidget *bold, GtkWebViewToolbar *toolbar) } static void -do_italic(GtkWidget *italic, GtkWebViewToolbar *toolbar) +do_italic(GtkAction *italic, GtkWebViewToolbar *toolbar) { g_return_if_fail(toolbar != NULL); gtk_webview_toggle_italic(GTK_WEBVIEW(toolbar->webview)); @@ -145,7 +129,7 @@ do_italic(GtkWidget *italic, GtkWebViewToolbar *toolbar) } static void -do_underline(GtkWidget *underline, GtkWebViewToolbar *toolbar) +do_underline(GtkAction *underline, GtkWebViewToolbar *toolbar) { g_return_if_fail(toolbar != NULL); gtk_webview_toggle_underline(GTK_WEBVIEW(toolbar->webview)); @@ -153,7 +137,7 @@ do_underline(GtkWidget *underline, GtkWebViewToolbar *toolbar) } static void -do_strikethrough(GtkWidget *strikethrough, GtkWebViewToolbar *toolbar) +do_strikethrough(GtkAction *strikethrough, GtkWebViewToolbar *toolbar) { g_return_if_fail(toolbar != NULL); gtk_webview_toggle_strike(GTK_WEBVIEW(toolbar->webview)); @@ -161,22 +145,18 @@ do_strikethrough(GtkWidget *strikethrough, GtkWebViewToolbar *toolbar) } static void -do_small(GtkWidget *smalltb, GtkWebViewToolbar *toolbar) +do_small(GtkAction *small, GtkWebViewToolbar *toolbar) { g_return_if_fail(toolbar != NULL); - /* Only shrink the font on activation, not deactivation as well */ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smalltb))) - gtk_webview_font_shrink(GTK_WEBVIEW(toolbar->webview)); + gtk_webview_font_shrink(GTK_WEBVIEW(toolbar->webview)); gtk_widget_grab_focus(toolbar->webview); } static void -do_big(GtkWidget *large, GtkWebViewToolbar *toolbar) +do_big(GtkAction *large, GtkWebViewToolbar *toolbar) { g_return_if_fail(toolbar); - /* Only grow the font on activation, not deactivation as well */ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(large))) - gtk_webview_font_grow(GTK_WEBVIEW(toolbar->webview)); + gtk_webview_font_grow(GTK_WEBVIEW(toolbar->webview)); gtk_widget_grab_focus(toolbar->webview); } @@ -246,13 +226,11 @@ apply_font(GtkWidget *widget, GtkWebViewToolbar *toolbar) } static void -toggle_font(GtkWidget *font, GtkWebViewToolbar *toolbar) +toggle_font(GtkAction *font, GtkWebViewToolbar *toolbar) { - GtkWebViewToolbarPriv *priv; - g_return_if_fail(toolbar); - priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font))) { + if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(font))) { char *fontname = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); if (!priv->font_dialog) { @@ -282,7 +260,7 @@ toggle_font(GtkWidget *font, GtkWebViewToolbar *toolbar) g_free(fontname); } else { - cancel_toolbar_font(font, toolbar); + cancel_toolbar_font(GTK_WIDGET(toolbar), toolbar); } gtk_widget_grab_focus(toolbar->webview); @@ -337,10 +315,11 @@ do_fgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar) } static void -toggle_fg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) +toggle_fg_color(GtkAction *color, GtkWebViewToolbar *toolbar) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { + + if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(color))) { GtkWidget *colorsel; GdkColor fgcolor; char *color = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); @@ -365,7 +344,7 @@ toggle_fg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) g_free(color); } else { - cancel_toolbar_fgcolor(color, toolbar); + cancel_toolbar_fgcolor(GTK_WIDGET(toolbar), toolbar); } gtk_widget_grab_focus(toolbar->webview); @@ -420,10 +399,11 @@ do_bgcolor(GtkWidget *widget, GtkWebViewToolbar *toolbar) } static void -toggle_bg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) +toggle_bg_color(GtkAction *color, GtkWebViewToolbar *toolbar) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) { + + if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(color))) { GtkWidget *colorsel; GdkColor bgcolor; char *color = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); @@ -448,17 +428,15 @@ toggle_bg_color(GtkWidget *color, GtkWebViewToolbar *toolbar) g_free(color); } else { - cancel_toolbar_bgcolor(color, toolbar); + cancel_toolbar_bgcolor(GTK_WIDGET(toolbar), toolbar); } gtk_widget_grab_focus(toolbar->webview); } static void -clear_formatting_cb(GtkWidget *clear, GtkWebViewToolbar *toolbar) +clear_formatting_cb(GtkAction *clear, GtkWebViewToolbar *toolbar) { - GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->clear), FALSE, toolbar); gtk_webview_clear_formatting(GTK_WEBVIEW(toolbar->webview)); } @@ -466,7 +444,7 @@ static void cancel_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->link), FALSE); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(priv->link), FALSE); priv->link_dialog = NULL; } @@ -502,10 +480,11 @@ do_insert_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields) } static void -insert_link_cb(GtkWidget *w, GtkWebViewToolbar *toolbar) +insert_link_cb(GtkAction *action, GtkWebViewToolbar *toolbar) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->link))) { + + if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->link))) { PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field; @@ -553,7 +532,7 @@ insert_link_cb(GtkWidget *w, GtkWebViewToolbar *toolbar) } static void -insert_hr_cb(GtkWidget *widget, GtkWebViewToolbar *toolbar) +insert_hr_cb(GtkAction *action, GtkWebViewToolbar *toolbar) { gtk_webview_insert_hr(GTK_WEBVIEW(toolbar->webview)); } @@ -561,9 +540,8 @@ insert_hr_cb(GtkWidget *widget, GtkWebViewToolbar *toolbar) static void do_insert_image_cb(GtkWidget *widget, int response, GtkWebViewToolbar *toolbar) { - GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE); #if 0 + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); gchar *filename, *name, *buf; char *filedata; size_t size; @@ -573,20 +551,15 @@ do_insert_image_cb(GtkWidget *widget, int response, GtkWebViewToolbar *toolbar) GtkTextMark *ins; if (response != GTK_RESPONSE_ACCEPT) - { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE); return; - } filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); - if (filename == NULL) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE); + if (filename == NULL) return; - } /* The following triggers a callback that closes the widget */ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->image), FALSE); + gtk_action_activate(priv->image); if (!g_file_get_contents(filename, &filedata, &size, &error)) { purple_notify_error(NULL, NULL, error->message, NULL); @@ -622,21 +595,20 @@ do_insert_image_cb(GtkWidget *widget, int response, GtkWebViewToolbar *toolbar) } static void -insert_image_cb(GtkWidget *save, GtkWebViewToolbar *toolbar) +insert_image_cb(GtkAction *action, GtkWebViewToolbar *toolbar) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); GtkWidget *window; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->image))) { - window = gtk_file_chooser_dialog_new(_("Insert Image"), - NULL, - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, - NULL); + if (priv->image_dialog) { + window = gtk_file_chooser_dialog_new(_("Insert Image"), NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT); - g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(window)), - "response", G_CALLBACK(do_insert_image_cb), toolbar); + g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(window)), "response", + G_CALLBACK(do_insert_image_cb), toolbar); gtk_widget_show(window); priv->image_dialog = window; @@ -851,7 +823,7 @@ add_smiley_list(GtkWidget *container, struct smiley_button_list *list, #endif static void -insert_smiley_cb(GtkWidget *smiley, GtkWebViewToolbar *toolbar) +insert_smiley_cb(GtkAction *smiley, GtkWebViewToolbar *toolbar) { #if 0 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); @@ -863,7 +835,7 @@ insert_smiley_cb(GtkWidget *smiley, GtkWebViewToolbar *toolbar) GtkRequisition req; GtkWidget *scrolled, *viewport; - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) { + if (!gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(smiley))) { destroy_smiley_dialog(toolbar); gtk_widget_grab_focus(toolbar->webview); return; @@ -1001,14 +973,13 @@ insert_smiley_cb(GtkWidget *smiley, GtkWebViewToolbar *toolbar) } static void -send_attention_cb(GtkWidget *attention, GtkWebViewToolbar *toolbar) +send_attention_cb(GtkAction *attention, GtkWebViewToolbar *toolbar) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); PurpleConversation *conv = priv->active_conv; const gchar *who = purple_conversation_get_name(conv); PurpleConnection *gc = purple_conversation_get_connection(conv); - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(attention), FALSE, toolbar); purple_prpl_send_attention(gc, who, 0); gtk_widget_grab_focus(toolbar->webview); } @@ -1018,51 +989,52 @@ update_buttons_cb(GtkWebView *webview, GtkWebViewButtons buttons, GtkWebViewToolbar *toolbar) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - gtk_widget_set_sensitive(GTK_WIDGET(priv->bold), buttons & GTK_WEBVIEW_BOLD); - gtk_widget_set_sensitive(GTK_WIDGET(priv->italic), buttons & GTK_WEBVIEW_ITALIC); - gtk_widget_set_sensitive(GTK_WIDGET(priv->underline), buttons & GTK_WEBVIEW_UNDERLINE); - gtk_widget_set_sensitive(GTK_WIDGET(priv->strike), buttons & GTK_WEBVIEW_STRIKE); - - gtk_widget_set_sensitive(GTK_WIDGET(priv->larger_size), buttons & GTK_WEBVIEW_GROW); - gtk_widget_set_sensitive(GTK_WIDGET(priv->smaller_size), buttons & GTK_WEBVIEW_SHRINK); - - gtk_widget_set_sensitive(GTK_WIDGET(priv->font), buttons & GTK_WEBVIEW_FACE); - gtk_widget_set_sensitive(GTK_WIDGET(priv->fgcolor), buttons & GTK_WEBVIEW_FORECOLOR); - gtk_widget_set_sensitive(GTK_WIDGET(priv->bgcolor), buttons & GTK_WEBVIEW_BACKCOLOR); - - gtk_widget_set_sensitive(GTK_WIDGET(priv->clear), - (buttons & GTK_WEBVIEW_BOLD || - buttons & GTK_WEBVIEW_ITALIC || - buttons & GTK_WEBVIEW_UNDERLINE || - buttons & GTK_WEBVIEW_STRIKE || - buttons & GTK_WEBVIEW_GROW || - buttons & GTK_WEBVIEW_SHRINK || - buttons & GTK_WEBVIEW_FACE || - buttons & GTK_WEBVIEW_FORECOLOR || - buttons & GTK_WEBVIEW_BACKCOLOR)); - - gtk_widget_set_sensitive(GTK_WIDGET(priv->image), buttons & GTK_WEBVIEW_IMAGE); - gtk_widget_set_sensitive(GTK_WIDGET(priv->link), buttons & GTK_WEBVIEW_LINK); - gtk_widget_set_sensitive(GTK_WIDGET(priv->smiley), buttons & GTK_WEBVIEW_SMILEY); + + gtk_action_set_sensitive(priv->bold, buttons & GTK_WEBVIEW_BOLD); + gtk_action_set_sensitive(priv->italic, buttons & GTK_WEBVIEW_ITALIC); + gtk_action_set_sensitive(priv->underline, buttons & GTK_WEBVIEW_UNDERLINE); + gtk_action_set_sensitive(priv->strike, buttons & GTK_WEBVIEW_STRIKE); + + gtk_action_set_sensitive(priv->larger_size, buttons & GTK_WEBVIEW_GROW); + gtk_action_set_sensitive(priv->smaller_size, buttons & GTK_WEBVIEW_SHRINK); + + gtk_action_set_sensitive(priv->font, buttons & GTK_WEBVIEW_FACE); + gtk_action_set_sensitive(priv->fgcolor, buttons & GTK_WEBVIEW_FORECOLOR); + gtk_action_set_sensitive(priv->bgcolor, buttons & GTK_WEBVIEW_BACKCOLOR); + + gtk_action_set_sensitive(priv->clear, + (buttons & GTK_WEBVIEW_BOLD || + buttons & GTK_WEBVIEW_ITALIC || + buttons & GTK_WEBVIEW_UNDERLINE || + buttons & GTK_WEBVIEW_STRIKE || + buttons & GTK_WEBVIEW_GROW || + buttons & GTK_WEBVIEW_SHRINK || + buttons & GTK_WEBVIEW_FACE || + buttons & GTK_WEBVIEW_FORECOLOR || + buttons & GTK_WEBVIEW_BACKCOLOR)); + + gtk_action_set_sensitive(priv->image, buttons & GTK_WEBVIEW_IMAGE); + gtk_action_set_sensitive(priv->link, buttons & GTK_WEBVIEW_LINK); + gtk_action_set_sensitive(priv->smiley, buttons & GTK_WEBVIEW_SMILEY); } /* we call this when we want to _set_active the toggle button, it'll - * block the callback thats connected to the button so we don't have to + * block the callback that's connected to the button so we don't have to * do the double toggling hack */ static void -toggle_button_set_active_block(GtkToggleButton *button, gboolean is_active, +toggle_action_set_active_block(GtkToggleAction *action, gboolean is_active, GtkWebViewToolbar *toolbar) { GObject *object; g_return_if_fail(toolbar); - object = g_object_ref(button); + object = g_object_ref(action); g_signal_handlers_block_matched(object, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, toolbar); - gtk_toggle_button_set_active(button, is_active); + 0, 0, NULL, NULL, toolbar); + gtk_toggle_action_set_active(action, is_active); g_signal_handlers_unblock_matched(object, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, toolbar); + 0, 0, NULL, NULL, toolbar); g_object_unref(object); } @@ -1072,87 +1044,81 @@ update_buttons(GtkWebViewToolbar *toolbar) GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); gboolean bold, italic, underline, strike; char *tmp; - GtkLabel *label = GTK_LABEL(priv->font_label); + char *label; - gtk_label_set_label(label, _("_Font")); + label = g_strdup(_("_Font")); gtk_webview_get_current_format(GTK_WEBVIEW(toolbar->webview), &bold, &italic, &underline, &strike); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->bold)) != bold) - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->bold), bold, - toolbar); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->italic)) != italic) - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->italic), italic, - toolbar); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->underline)) != underline) - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->underline), - underline, toolbar); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->strike)) != strike) - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->strike), - strike, toolbar); - - /* These buttons aren't ever "active". */ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->smaller_size), FALSE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->larger_size), FALSE); + if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->bold)) != bold) + toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->bold), bold, + toolbar); + if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->italic)) != italic) + toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->italic), italic, + toolbar); + if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->underline)) != underline) + toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->underline), + underline, toolbar); + if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(priv->strike)) != strike) + toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->strike), strike, + toolbar); if (bold) { - gchar *markup = g_strdup_printf("%s", - gtk_label_get_label(label)); - gtk_label_set_markup_with_mnemonic(label, markup); - g_free(markup); + gchar *markup = g_strdup_printf("%s", label); + g_free(label); + label = markup; } if (italic) { - gchar *markup = g_strdup_printf("%s", - gtk_label_get_label(label)); - gtk_label_set_markup_with_mnemonic(label, markup); - g_free(markup); + gchar *markup = g_strdup_printf("%s", label); + g_free(label); + label = markup; } if (underline) { - gchar *markup = g_strdup_printf("%s", - gtk_label_get_label(label)); - gtk_label_set_markup_with_mnemonic(label, markup); - g_free(markup); + gchar *markup = g_strdup_printf("%s", label); + g_free(label); + label = markup; } if (strike) { - gchar *markup = g_strdup_printf("%s", - gtk_label_get_label(label)); - gtk_label_set_markup_with_mnemonic(label, markup); - g_free(markup); + gchar *markup = g_strdup_printf("%s", label); + g_free(label); + label = markup; } tmp = gtk_webview_get_current_fontface(GTK_WEBVIEW(toolbar->webview)); - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->font), - (tmp != NULL), toolbar); - if (tmp != NULL) { + toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->font), + (tmp && *tmp), toolbar); + if (tmp && *tmp) { gchar *markup = g_strdup_printf("%s", - tmp, gtk_label_get_label(label)); - gtk_label_set_markup_with_mnemonic(label, markup); - g_free(markup); + tmp, label); + g_free(label); + label = markup; } g_free(tmp); tmp = gtk_webview_get_current_forecolor(GTK_WEBVIEW(toolbar->webview)); - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->fgcolor), - (tmp != NULL), toolbar); - if (tmp != NULL) { + toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->fgcolor), + (tmp && *tmp), toolbar); + if (tmp && *tmp) { gchar *markup = g_strdup_printf("%s", - tmp, gtk_label_get_label(label)); - gtk_label_set_markup_with_mnemonic(label, markup); - g_free(markup); + tmp, label); + g_free(label); + label = markup; } g_free(tmp); tmp = gtk_webview_get_current_backcolor(GTK_WEBVIEW(toolbar->webview)); - toggle_button_set_active_block(GTK_TOGGLE_BUTTON(priv->bgcolor), - (tmp != NULL), toolbar); - if (tmp != NULL) { + toggle_action_set_active_block(GTK_TOGGLE_ACTION(priv->bgcolor), + (tmp && *tmp), toolbar); + if (tmp && *tmp) { gchar *markup = g_strdup_printf("%s", - tmp, gtk_label_get_label(label)); - gtk_label_set_markup_with_mnemonic(label, markup); - g_free(markup); + tmp, label); + g_free(label); + label = markup; } g_free(tmp); + + gtk_label_set_markup_with_mnemonic(GTK_LABEL(priv->font_label), label); } static void @@ -1185,18 +1151,18 @@ mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *location, GtkTextMark *mark, * Copyright (C) 2004 Paolo Borelli */ static void -menu_position_func(GtkMenu *menu, - int *x, - int *y, - gboolean *push_in, - gpointer data) +menu_position_func(GtkMenu *menu, + int *x, + int *y, + gboolean *push_in, + gpointer data) { GtkWidget *widget = GTK_WIDGET(data); GtkRequisition menu_req; gint ythickness = widget->style->ythickness; int savy; - gtk_widget_size_request(GTK_WIDGET (menu), &menu_req); + gtk_widget_size_request(GTK_WIDGET(menu), &menu_req); gdk_window_get_origin(widget->window, x, y); *x += widget->allocation.x; *y += widget->allocation.y + widget->allocation.height; @@ -1208,28 +1174,19 @@ menu_position_func(GtkMenu *menu, *y -= widget->allocation.height; } -static gboolean -button_activate_on_click(GtkWidget *button, GdkEventButton *event, - GtkWebViewToolbar *toolbar) -{ - if (event->button == 1 && GTK_IS_TOGGLE_BUTTON(button)) - gtk_widget_activate(button); - else if (event->button == 3) - return gtk_webviewtoolbar_popup_menu(button, event, toolbar); - return FALSE; -} - static void pidgin_menu_clicked(GtkWidget *button, GtkMenu *menu) { - gtk_widget_show_all(GTK_WIDGET(menu)); - gtk_menu_popup(menu, NULL, NULL, menu_position_func, button, 0, gtk_get_current_event_time()); + if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(button))) { + gtk_widget_show_all(GTK_WIDGET(menu)); + gtk_menu_popup(menu, NULL, NULL, menu_position_func, button, 0, gtk_get_current_event_time()); + } } static void pidgin_menu_deactivate(GtkWidget *menu, GtkToggleButton *button) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(button), FALSE); } static void @@ -1251,7 +1208,7 @@ gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, if (event->button != 3) return FALSE; - wide = gtk_widget_get_visible(priv->bold); + wide = gtk_widget_get_visible(priv->wide_view); menu = gtk_menu_new(); item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items")); @@ -1260,38 +1217,18 @@ gtk_webviewtoolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, gtk_widget_show(item); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, pidgin_menu_position_func_helper, - widget, event->button, event->time); - return TRUE; -} + widget, event->button, event->time); -static void -button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) -{ - if (gtk_widget_get_visible(button)) - gtk_widget_hide(item); - else - gtk_widget_show(item); -} - -static void -button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item) -{ - gtk_widget_set_sensitive(item, gtk_widget_is_sensitive(button)); -} - -static void -update_menuitem(GtkToggleButton *button, GtkCheckMenuItem *item) -{ - g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button); - gtk_check_menu_item_set_active(item, gtk_toggle_button_get_active(button)); - g_signal_handlers_unblock_by_func(G_OBJECT(item), G_CALLBACK(gtk_button_clicked), button); + return TRUE; } static void enable_markup(GtkWidget *widget, gpointer null) { - if (GTK_IS_LABEL(widget)) - g_object_set(G_OBJECT(widget), "use-markup", TRUE, NULL); + GtkWidget *label; + label = gtk_bin_get_child(GTK_BIN(widget)); + if (GTK_IS_LABEL(label)) + g_object_set(G_OBJECT(label), "use-markup", TRUE, NULL); } static void @@ -1347,10 +1284,6 @@ gtk_webviewtoolbar_finalize(GObject *object) g_free(priv->sml); -#if !GTK_CHECK_VERSION(2,12,0) - gtk_object_sink(GTK_OBJECT(priv->tooltips)); -#endif - if (priv->font_menu) gtk_widget_destroy(priv->font_menu); if (priv->insert_menu) @@ -1358,7 +1291,7 @@ gtk_webviewtoolbar_finalize(GObject *object) purple_prefs_disconnect_by_handle(object); - G_OBJECT_CLASS(parent_class)->finalize (object); + G_OBJECT_CLASS(parent_class)->finalize(object); } static void @@ -1376,262 +1309,235 @@ gtk_webviewtoolbar_class_init(GtkWebViewToolbarClass *class) } static void -gtk_webviewtoolbar_create_old_buttons(GtkWebViewToolbar *toolbar) +gtk_webviewtoolbar_create_actions(GtkWebViewToolbar *toolbar) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - GtkWidget *hbox; - GtkWidget *button; + GtkActionGroup *action_group; + int i; struct { + GtkAction **action; + char *name; char *stock; - gpointer callback; - GtkWidget **button; - const char *tooltip; - } buttons[] = { - {GTK_STOCK_BOLD, G_CALLBACK(do_bold), &priv->bold, _("Bold")}, - {GTK_STOCK_ITALIC, do_italic, &priv->italic, _("Italic")}, - {GTK_STOCK_UNDERLINE, do_underline, &priv->underline, _("Underline")}, - {GTK_STOCK_STRIKETHROUGH, do_strikethrough, &priv->strike, _("Strikethrough")}, - {"", NULL, NULL, NULL}, - {PIDGIN_STOCK_TOOLBAR_TEXT_LARGER, do_big, &priv->larger_size, _("Increase Font Size")}, - {PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, do_small, &priv->smaller_size, _("Decrease Font Size")}, - {"", NULL, NULL, NULL}, - {PIDGIN_STOCK_TOOLBAR_FONT_FACE, toggle_font, &priv->font, _("Font Face")}, - {PIDGIN_STOCK_TOOLBAR_FGCOLOR, toggle_fg_color, &priv->fgcolor, _("Foreground Color")}, - {PIDGIN_STOCK_TOOLBAR_BGCOLOR, toggle_bg_color, &priv->bgcolor, _("Background Color")}, - {"", NULL, NULL, NULL}, - {PIDGIN_STOCK_CLEAR, clear_formatting_cb, &priv->clear, _("Reset Formatting")}, - {"", NULL, NULL, NULL}, - {PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, insert_image_cb, &priv->image, _("Insert IM Image")}, - {PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &priv->link, _("Insert Link")}, - {"", NULL, NULL, NULL}, - {PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &priv->smiley, _("Insert Smiley")}, - {PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &priv->attention, _("Send Attention")}, - {NULL, NULL, NULL, NULL} + char *label; + char *tooltip; + void (*cb)(); + gboolean toggle; + } actions[] = { + {&priv->bold, "ToggleBold", GTK_STOCK_BOLD, N_("_Bold"), N_("Bold"), do_bold, TRUE}, + {&priv->italic, "ToggleItalic", GTK_STOCK_ITALIC, N_("_Italic"), N_("Italic"), do_italic, TRUE}, + {&priv->underline, "ToggleUnderline", GTK_STOCK_UNDERLINE, N_("_Underline"), N_("Underline"), do_underline, TRUE}, + {&priv->strike, "ToggleStrike", GTK_STOCK_STRIKETHROUGH, N_("Strikethrough"), N_("Strikethrough"), do_strikethrough, TRUE}, + {&priv->larger_size, "ToggleLarger", PIDGIN_STOCK_TOOLBAR_TEXT_LARGER, N_("Larger"), N_("Increase Font Size"), do_big, FALSE}, +#if 0 + {&priv->normal_size, "ToggleNormal", NULL, N_("Normal"), N_("Normal Font Size"), NULL, FALSE}, +#endif + {&priv->smaller_size, "ToggleSmaller", PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, N_("Smaller"), N_("Decrease Font Size"), do_small, FALSE}, + {&priv->font, "ToggleFontFace", PIDGIN_STOCK_TOOLBAR_FONT_FACE, N_("_Font face"), N_("Font Face"), toggle_font, TRUE}, + {&priv->fgcolor, "ToggleFG", PIDGIN_STOCK_TOOLBAR_FGCOLOR, N_("Foreground _color"), N_("Foreground Color"), toggle_fg_color, TRUE}, + {&priv->bgcolor, "ToggleBG", PIDGIN_STOCK_TOOLBAR_BGCOLOR, N_("Bac_kground color"), N_("Background Color"), toggle_bg_color, TRUE}, + {&priv->clear, "ResetFormat", PIDGIN_STOCK_CLEAR, N_("_Reset formatting"), N_("Reset Formatting"), clear_formatting_cb, FALSE}, + {&priv->image, "InsertImage", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, N_("_Image"), N_("Insert IM Image"), insert_image_cb, FALSE}, + {&priv->link, "InsertLink", PIDGIN_STOCK_TOOLBAR_INSERT_LINK, N_("_Link"), N_("Insert Link"), insert_link_cb, TRUE}, + {&priv->hr, "InsertHR", NULL, N_("_Horizontal rule"), N_("Insert Horizontal rule"), insert_hr_cb, FALSE}, + {&priv->smiley, "InsertSmiley", PIDGIN_STOCK_TOOLBAR_SMILEY, N_("_Smile!"), N_("Insert Smiley"), insert_smiley_cb, FALSE}, + {&priv->attention, "SendAttention", PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, N_("_Attention!"), N_("Send Attention"), send_attention_cb, FALSE}, }; - int iter; - - hbox = gtk_hbox_new(FALSE, 0); - - for (iter = 0; buttons[iter].stock; iter++) { - if (buttons[iter].stock[0]) { - button = pidgin_pixbuf_toolbar_button_from_stock(buttons[iter].stock); - g_signal_connect(G_OBJECT(button), "button-press-event", G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(buttons[iter].callback), toolbar); - *(buttons[iter].button) = button; - gtk_widget_set_tooltip_text(button, buttons[iter].tooltip); - } else - button = gtk_vseparator_new(); - gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - } - gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0); - priv->wide_view = hbox; + action_group = gtk_action_group_new("GtkWebViewToolbar"); +#ifdef ENABLE_NLS + gtk_action_group_set_translation_domain(action_group, PACKAGE); +#endif + + for (i = 0; i < G_N_ELEMENTS(actions); i++) { + GtkAction *action; + if (actions[i].toggle) + action = GTK_ACTION(gtk_toggle_action_new(actions[i].name, + actions[i].label, + actions[i].tooltip, + actions[i].stock)); + else + action = gtk_action_new(actions[i].name, actions[i].label, + actions[i].tooltip, actions[i].stock); + gtk_action_set_is_important(action, TRUE); + gtk_action_group_add_action(action_group, action); + g_signal_connect(G_OBJECT(action), "activate", actions[i].cb, toolbar); + *(actions[i].action) = action; + } } static void -gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) +gtk_webviewtoolbar_create_wide_view(GtkWebViewToolbar *toolbar) { GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - GtkWidget *hbox = GTK_WIDGET(toolbar), *event = gtk_event_box_new(); - GtkWidget *bbox, *box = gtk_hbox_new(FALSE, 0); - GtkWidget *image; - GtkWidget *label; - GtkWidget *insert_button; - GtkWidget *font_button; - GtkWidget *smiley_button; - GtkWidget *attention_button; - GtkWidget *font_menu; - GtkWidget *insert_menu; - GtkWidget *menuitem; - GtkWidget *sep; - int i; - struct { - const char *label; - GtkWidget **button; - gboolean check; - } buttons[] = { - {_("_Bold"), &priv->bold, TRUE}, - {_("_Italic"), &priv->italic, TRUE}, - {_("_Underline"), &priv->underline, TRUE}, - {_("Strikethrough"), &priv->strike, TRUE}, - {_("_Larger"), &priv->larger_size, TRUE}, + GtkAction *layout[] = { + priv->bold, + priv->italic, + priv->underline, + priv->strike, + NULL, + priv->larger_size, #if 0 - {_("_Normal"), &priv->normal_size, TRUE}, + priv->normal_size, #endif - {_("_Smaller"), &priv->smaller_size, TRUE}, - /* If we want to show the formatting for the following items, we would - * need to update them when formatting changes. The above items don't need - * no updating nor nothin' */ - {_("_Font face"), &priv->font, TRUE}, - {_("Foreground _color"), &priv->fgcolor, TRUE}, - {_("Bac_kground color"), &priv->bgcolor, TRUE}, - {_("_Reset formatting"), &priv->clear, FALSE}, - {NULL, NULL, FALSE} + priv->smaller_size, + NULL, + priv->font, + priv->fgcolor, + priv->bgcolor, + NULL, + priv->clear, + NULL, + priv->image, + priv->link, + NULL, + priv->smiley, + priv->attention }; + int i; + GtkToolItem *item; + + priv->wide_view = gtk_toolbar_new(); + gtk_toolbar_set_icon_size(GTK_TOOLBAR(priv->wide_view), + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); + gtk_toolbar_set_style(GTK_TOOLBAR(priv->wide_view), GTK_TOOLBAR_ICONS); + + for (i = 0; i < G_N_ELEMENTS(layout); i++) { + if (layout[i]) + item = GTK_TOOL_ITEM(gtk_action_create_tool_item(layout[i])); + else + item = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(priv->wide_view), item, -1); + } +} - toolbar->webview = NULL; - priv->font_dialog = NULL; - priv->fgcolor_dialog = NULL; - priv->bgcolor_dialog = NULL; - priv->link_dialog = NULL; - priv->smiley_dialog = NULL; - priv->image_dialog = NULL; - -#if !GTK_CHECK_VERSION(2,12,0) - priv->tooltips = gtk_tooltips_new(); -#endif +static void +gtk_webviewtoolbar_create_lean_view(GtkWebViewToolbar *toolbar) +{ + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + GtkWidget *label; + GtkWidget *menuitem; + GtkToolItem *sep; + GtkToolItem *font_button; + GtkWidget *font_menu; + GtkToolItem *insert_button; + GtkWidget *insert_menu; + GtkWidget *smiley_button; + GtkWidget *attention_button; - gtk_box_set_spacing(GTK_BOX(toolbar), 3); + priv->lean_view = gtk_toolbar_new(); + gtk_toolbar_set_icon_size(GTK_TOOLBAR(priv->lean_view), + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); + gtk_toolbar_set_style(GTK_TOOLBAR(priv->lean_view), GTK_TOOLBAR_BOTH_HORIZ); - gtk_webviewtoolbar_create_old_buttons(toolbar); +#define ADD_MENU_ITEM(menu, item) \ + menuitem = gtk_action_create_menu_item((item)); \ + gtk_menu_shell_append(GTK_MENU_SHELL((menu)), menuitem); /* Fonts */ - font_button = gtk_toggle_button_new(); - gtk_button_set_relief(GTK_BUTTON(font_button), GTK_RELIEF_NONE); - bbox = gtk_hbox_new(FALSE, 3); - gtk_container_add(GTK_CONTAINER(font_button), bbox); - image = gtk_image_new_from_stock(GTK_STOCK_BOLD, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); - gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); + font_button = gtk_toggle_tool_button_new(); + gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), font_button, -1); + gtk_tool_item_set_is_important(font_button, TRUE); + gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(font_button), GTK_STOCK_BOLD); priv->font_label = label = gtk_label_new_with_mnemonic(_("_Font")); gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(box), font_button, FALSE, FALSE, 0); - gtk_widget_show_all(font_button); + gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON(font_button), label); priv->font_menu = font_menu = gtk_menu_new(); - for (i = 0; buttons[i].label; i++) { - GtkWidget *old = *buttons[i].button; - if (buttons[i].check) { - menuitem = gtk_check_menu_item_new_with_mnemonic(buttons[i].label); - g_signal_connect_after(G_OBJECT(old), "toggled", - G_CALLBACK(update_menuitem), menuitem); - } else { - menuitem = gtk_menu_item_new_with_mnemonic(buttons[i].label); - } - g_signal_connect_swapped(G_OBJECT(menuitem), "activate", - G_CALLBACK(gtk_button_clicked), old); - gtk_menu_shell_append(GTK_MENU_SHELL(font_menu), menuitem); - g_signal_connect(G_OBJECT(old), "notify::sensitive", - G_CALLBACK(button_sensitiveness_changed), menuitem); - g_signal_connect(G_OBJECT(old), "notify::visible", - G_CALLBACK(button_visibility_changed), menuitem); - gtk_container_foreach(GTK_CONTAINER(menuitem), (GtkCallback)enable_markup, NULL); - } + ADD_MENU_ITEM(font_menu, priv->bold); + ADD_MENU_ITEM(font_menu, priv->italic); + ADD_MENU_ITEM(font_menu, priv->underline); + ADD_MENU_ITEM(font_menu, priv->strike); + ADD_MENU_ITEM(font_menu, priv->larger_size); +#if 0 + ADD_MENU_ITEM(font_menu, priv->normal_size); +#endif + ADD_MENU_ITEM(font_menu, priv->smaller_size); + ADD_MENU_ITEM(font_menu, priv->font); + ADD_MENU_ITEM(font_menu, priv->fgcolor); + ADD_MENU_ITEM(font_menu, priv->bgcolor); + ADD_MENU_ITEM(font_menu, priv->clear); + + g_signal_connect(G_OBJECT(font_button), "toggled", + G_CALLBACK(pidgin_menu_clicked), font_menu); + g_signal_connect(G_OBJECT(font_menu), "deactivate", + G_CALLBACK(pidgin_menu_deactivate), font_button); - g_signal_connect(G_OBJECT(font_button), "button-press-event", G_CALLBACK(button_activate_on_click), toolbar); - g_signal_connect(G_OBJECT(font_button), "activate", G_CALLBACK(pidgin_menu_clicked), font_menu); - g_signal_connect(G_OBJECT(font_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), font_button); + gtk_container_foreach(GTK_CONTAINER(font_menu), enable_markup, NULL); /* Sep */ - sep = gtk_vseparator_new(); - gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); - gtk_widget_show_all(sep); + sep = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), sep, -1); /* Insert */ - insert_button = gtk_toggle_button_new(); - gtk_button_set_relief(GTK_BUTTON(insert_button), GTK_RELIEF_NONE); - bbox = gtk_hbox_new(FALSE, 3); - gtk_container_add(GTK_CONTAINER(insert_button), bbox); - image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_INSERT, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); - gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); + insert_button = gtk_toggle_tool_button_new(); + gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), insert_button, -1); + gtk_tool_item_set_is_important(insert_button, TRUE); + gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(insert_button), + PIDGIN_STOCK_TOOLBAR_INSERT); label = gtk_label_new_with_mnemonic(_("_Insert")); - gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(box), insert_button, FALSE, FALSE, 0); - gtk_widget_show_all(insert_button); + gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON(insert_button), label); priv->insert_menu = insert_menu = gtk_menu_new(); - menuitem = gtk_menu_item_new_with_mnemonic(_("_Image")); - g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), priv->image); - gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); - g_signal_connect(G_OBJECT(priv->image), "notify::sensitive", - G_CALLBACK(button_sensitiveness_changed), menuitem); - g_signal_connect(G_OBJECT(priv->image), "notify::visible", - G_CALLBACK(button_visibility_changed), menuitem); - - menuitem = gtk_menu_item_new_with_mnemonic(_("_Link")); - g_signal_connect_swapped(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_button_clicked), priv->link); - gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); - g_signal_connect(G_OBJECT(priv->link), "notify::sensitive", - G_CALLBACK(button_sensitiveness_changed), menuitem); - g_signal_connect(G_OBJECT(priv->link), "notify::visible", - G_CALLBACK(button_visibility_changed), menuitem); - - menuitem = gtk_menu_item_new_with_mnemonic(_("_Horizontal rule")); - g_signal_connect(G_OBJECT(menuitem), "activate" , G_CALLBACK(insert_hr_cb), toolbar); - gtk_menu_shell_append(GTK_MENU_SHELL(insert_menu), menuitem); - priv->insert_hr = menuitem; - - g_signal_connect(G_OBJECT(insert_button), "button-press-event", G_CALLBACK(button_activate_on_click), toolbar); - g_signal_connect(G_OBJECT(insert_button), "activate", G_CALLBACK(pidgin_menu_clicked), insert_menu); - g_signal_connect(G_OBJECT(insert_menu), "deactivate", G_CALLBACK(pidgin_menu_deactivate), insert_button); - priv->sml = NULL; + ADD_MENU_ITEM(insert_menu, priv->image); + ADD_MENU_ITEM(insert_menu, priv->link); + ADD_MENU_ITEM(insert_menu, priv->hr); + + g_signal_connect(G_OBJECT(insert_button), "toggled", + G_CALLBACK(pidgin_menu_clicked), insert_menu); + g_signal_connect(G_OBJECT(insert_menu), "deactivate", + G_CALLBACK(pidgin_menu_deactivate), insert_button); /* Sep */ - sep = gtk_vseparator_new(); - gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); - gtk_widget_show_all(sep); + sep = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), sep, -1); /* Smiley */ - smiley_button = gtk_button_new(); - gtk_button_set_relief(GTK_BUTTON(smiley_button), GTK_RELIEF_NONE); - bbox = gtk_hbox_new(FALSE, 3); - gtk_container_add(GTK_CONTAINER(smiley_button), bbox); - image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SMILEY, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); - gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); - label = gtk_label_new_with_mnemonic(_("_Smile!")); - gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(box), smiley_button, FALSE, FALSE, 0); - g_signal_connect(G_OBJECT(smiley_button), "button-press-event", G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar); - g_signal_connect_swapped(G_OBJECT(smiley_button), "clicked", G_CALLBACK(gtk_button_clicked), priv->smiley); - gtk_widget_show_all(smiley_button); + smiley_button = gtk_action_create_tool_item(priv->smiley); + gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), + GTK_TOOL_ITEM(smiley_button), -1); /* Sep */ - sep = gtk_vseparator_new(); - gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 0); - gtk_widget_show_all(sep); + sep = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), sep, -1); /* Attention */ - attention_button = gtk_button_new(); - gtk_button_set_relief(GTK_BUTTON(attention_button), GTK_RELIEF_NONE); - bbox = gtk_hbox_new(FALSE, 3); - gtk_container_add(GTK_CONTAINER(attention_button), bbox); - image = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); - gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); - label = gtk_label_new_with_mnemonic(_("_Attention!")); - gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0); - g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", - G_CALLBACK(gtk_button_clicked), priv->attention); - gtk_widget_show_all(attention_button); - - g_signal_connect(G_OBJECT(priv->attention), "notify::sensitive", - G_CALLBACK(button_sensitiveness_changed), attention_button); - g_signal_connect(G_OBJECT(priv->attention), "notify::visible", - G_CALLBACK(button_visibility_changed), attention_button); + attention_button = gtk_action_create_tool_item(priv->attention); + gtk_toolbar_insert(GTK_TOOLBAR(priv->lean_view), + GTK_TOOL_ITEM(attention_button), -1); - /* set attention button to be greyed out until we get a conversation */ - gtk_widget_set_sensitive(priv->attention, FALSE); +#undef ADD_MENU_ITEM +} - gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0); - priv->lean_view = box; - gtk_widget_show(box); +static void +gtk_webviewtoolbar_init(GtkWebViewToolbar *toolbar) +{ + GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); + GtkWidget *hbox = GTK_WIDGET(toolbar); - purple_prefs_connect_callback(toolbar, PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", - webviewtoolbar_view_pref_changed, toolbar); - g_signal_connect_data(G_OBJECT(toolbar), "realize", - G_CALLBACK(purple_prefs_trigger_callback), PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", - NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED); + gtk_webviewtoolbar_create_actions(toolbar); + gtk_webviewtoolbar_create_wide_view(toolbar); + gtk_webviewtoolbar_create_lean_view(toolbar); - gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), FALSE); + gtk_box_pack_start(GTK_BOX(hbox), priv->wide_view, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), priv->lean_view, TRUE, TRUE, 0); + + priv->sml = NULL; + + /* set attention button to be greyed out until we get a conversation */ + gtk_action_set_sensitive(priv->attention, FALSE); + + purple_prefs_connect_callback(toolbar, + PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", + webviewtoolbar_view_pref_changed, toolbar); + g_signal_connect_data(G_OBJECT(toolbar), "realize", + G_CALLBACK(purple_prefs_trigger_callback), + PIDGIN_PREFS_ROOT "/conversations/toolbar/wide", + NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED); - gtk_widget_add_events(event, GDK_BUTTON_PRESS_MASK); - gtk_box_pack_start(GTK_BOX(hbox), event, TRUE, TRUE, 0); - g_signal_connect(G_OBJECT(event), "button-press-event", G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar); - gtk_widget_show(event); + g_signal_connect(G_OBJECT(hbox), "button-press-event", + G_CALLBACK(gtk_webviewtoolbar_popup_menu), toolbar); } /****************************************************************************** @@ -1719,7 +1625,7 @@ gtk_webviewtoolbar_switch_active_conversation(GtkWebViewToolbar *toolbar, /* gray out attention button on protocols that don't support it for the time being it is always disabled for chats */ - gtk_widget_set_sensitive(priv->attention, + gtk_action_set_sensitive(priv->attention, conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL); } -- cgit v1.2.1 From 327d2e6e9eb977ff1aeb94a92c90ba63bc579b30 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 5 Jun 2012 06:15:26 +0000 Subject: The URL probably needs to be quoted. --- pidgin/gtkwebview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 5e505fcf7e..3c7d605f57 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -1044,7 +1044,7 @@ gtk_webview_insert_link(GtkWebView *webview, const char *url, const char *desc) char *link; dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - link = g_strdup_printf("%s", url, desc ? desc : url); + link = g_strdup_printf("%s", url, desc ? desc : url); priv->edit.block_changed = TRUE; webkit_dom_document_exec_command(dom, "insertHTML", FALSE, link); -- cgit v1.2.1 From f9b9d16e1deb2e51a728a2fcf709eae17b545aa6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 5 Jun 2012 06:17:48 +0000 Subject: Fixup Insert Image functionality. --- pidgin/gtkwebview.c | 16 ++++++++++++++++ pidgin/gtkwebview.h | 8 ++++++++ pidgin/gtkwebviewtoolbar.c | 25 ++++++++----------------- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 3c7d605f57..b2daa62c0c 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -1052,3 +1052,19 @@ gtk_webview_insert_link(GtkWebView *webview, const char *url, const char *desc) g_free(link); } +void +gtk_webview_insert_image(GtkWebView *webview, int id) +{ + GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + WebKitDOMDocument *dom; + char *img; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); + img = g_strdup_printf("", get_image_src_from_id(priv, id)); + + priv->edit.block_changed = TRUE; + webkit_dom_document_exec_command(dom, "insertHTML", FALSE, img); + priv->edit.block_changed = FALSE; + g_free(img); +} + diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index ee194e16e8..926a869e2c 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -429,6 +429,14 @@ void gtk_webview_insert_hr(GtkWebView *webview); */ void gtk_webview_insert_link(GtkWebView *webview, const char *url, const char *desc); +/** + * Inserts an image at the current location or selection in a GtkWebView. + * + * @param webview The GtkWebView + * @param id The PurpleStoredImage id + */ +void gtk_webview_insert_image(GtkWebView *webview, int id); + G_END_DECLS #endif /* _PIDGIN_WEBVIEW_H_ */ diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index 7e1e39e7fa..8c74844c2d 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -540,27 +540,22 @@ insert_hr_cb(GtkAction *action, GtkWebViewToolbar *toolbar) static void do_insert_image_cb(GtkWidget *widget, int response, GtkWebViewToolbar *toolbar) { -#if 0 GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); - gchar *filename, *name, *buf; + gchar *filename = NULL, *name, *buf; char *filedata; size_t size; GError *error = NULL; int id; - GtkTextIter iter; - GtkTextMark *ins; - if (response != GTK_RESPONSE_ACCEPT) - return; + if (response == GTK_RESPONSE_ACCEPT) + filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); - filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); + /* The following triggers a callback that closes the widget */ + gtk_action_activate(priv->image); if (filename == NULL) return; - /* The following triggers a callback that closes the widget */ - gtk_action_activate(priv->image); - if (!g_file_get_contents(filename, &filedata, &size, &error)) { purple_notify_error(NULL, NULL, error->message, NULL); @@ -586,12 +581,8 @@ do_insert_image_cb(GtkWidget *widget, int response, GtkWebViewToolbar *toolbar) g_free(filename); - ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview))); - gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->webview)), - &iter, ins); - gtk_webview_insert_image_at_iter(GTK_WEBVIEW(toolbar->webview), id, &iter); + gtk_webview_insert_image(GTK_WEBVIEW(toolbar->webview), id); purple_imgstore_unref_by_id(id); -#endif } static void @@ -600,14 +591,14 @@ insert_image_cb(GtkAction *action, GtkWebViewToolbar *toolbar) GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar); GtkWidget *window; - if (priv->image_dialog) { + if (!priv->image_dialog) { window = gtk_file_chooser_dialog_new(_("Insert Image"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT); - g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(window)), "response", + g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(do_insert_image_cb), toolbar); gtk_widget_show(window); -- cgit v1.2.1 From 41839c068ef2ae607501040177f236849235526a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 5 Jun 2012 07:14:40 +0000 Subject: Emit formatting toggle signals. --- pidgin/gtkwebview.c | 83 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 30 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index b2daa62c0c..d964e04408 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -302,6 +302,14 @@ scroll_idle_cb(gpointer data) return FALSE; } +static void +emit_format_signal(GtkWebView *webview, GtkWebViewButtons buttons) +{ + g_object_ref(webview); + g_signal_emit(webview, signals[TOGGLE_FORMAT], 0, buttons); + g_object_unref(webview); +} + static void do_formatting(GtkWebView *webview, const char *name, const char *value) { @@ -331,6 +339,34 @@ do_formatting(GtkWebView *webview, const char *name, const char *value) } } +static void +webview_font_shrink(GtkWebView *webview) +{ + gint fontsize; + char *tmp; + + fontsize = gtk_webview_get_current_fontsize(webview); + fontsize = MAX(fontsize - 1, 1); + + tmp = g_strdup_printf("%d", fontsize); + do_formatting(webview, "fontSize", tmp); + g_free(tmp); +} + +static void +webview_font_grow(GtkWebView *webview) +{ + gint fontsize; + char *tmp; + + fontsize = gtk_webview_get_current_fontsize(webview); + fontsize = MIN(fontsize + 1, MAX_FONT_SIZE); + + tmp = g_strdup_printf("%d", fontsize); + do_formatting(webview, "fontSize", tmp); + g_free(tmp); +} + static void webview_clear_formatting(GtkWebView *webview) { @@ -349,22 +385,22 @@ webview_toggle_format(GtkWebView *webview, GtkWebViewButtons buttons) switch (buttons) { case GTK_WEBVIEW_BOLD: - gtk_webview_toggle_bold(webview); + do_formatting(webview, "bold", ""); break; case GTK_WEBVIEW_ITALIC: - gtk_webview_toggle_italic(webview); + do_formatting(webview, "italic", ""); break; case GTK_WEBVIEW_UNDERLINE: - gtk_webview_toggle_underline(webview); + do_formatting(webview, "underline", ""); break; case GTK_WEBVIEW_STRIKE: - gtk_webview_toggle_strike(webview); + do_formatting(webview, "strikethrough", ""); break; case GTK_WEBVIEW_SHRINK: - gtk_webview_font_shrink(webview); + webview_font_shrink(webview); break; case GTK_WEBVIEW_GROW: - gtk_webview_font_grow(webview); + webview_font_grow(webview); break; default: break; @@ -933,40 +969,40 @@ gtk_webview_clear_formatting(GtkWebView *webview) object = g_object_ref(G_OBJECT(webview)); g_signal_emit(object, signals[CLEAR_FORMAT], 0); + g_object_unref(object); gtk_widget_grab_focus(GTK_WIDGET(webview)); - - g_object_unref(object); } void gtk_webview_toggle_bold(GtkWebView *webview) { - do_formatting(webview, "bold", ""); + emit_format_signal(webview, GTK_WEBVIEW_BOLD); } void gtk_webview_toggle_italic(GtkWebView *webview) { - do_formatting(webview, "italic", ""); + emit_format_signal(webview, GTK_WEBVIEW_ITALIC); } void gtk_webview_toggle_underline(GtkWebView *webview) { - do_formatting(webview, "underline", ""); + emit_format_signal(webview, GTK_WEBVIEW_UNDERLINE); } void gtk_webview_toggle_strike(GtkWebView *webview) { - do_formatting(webview, "strikethrough", ""); + emit_format_signal(webview, GTK_WEBVIEW_STRIKE); } gboolean gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) { do_formatting(webview, "foreColor", color); + emit_format_signal(webview, GTK_WEBVIEW_FORECOLOR); return FALSE; } @@ -975,6 +1011,7 @@ gboolean gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) { do_formatting(webview, "backColor", color); + emit_format_signal(webview, GTK_WEBVIEW_BACKCOLOR); return FALSE; } @@ -983,6 +1020,7 @@ gboolean gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) { do_formatting(webview, "fontName", face); + emit_format_signal(webview, GTK_WEBVIEW_FACE); return FALSE; } @@ -992,35 +1030,20 @@ gtk_webview_font_set_size(GtkWebView *webview, gint size) { char *tmp = g_strdup_printf("%d", size); do_formatting(webview, "fontSize", tmp); + emit_format_signal(webview, GTK_WEBVIEW_SHRINK|GTK_WEBVIEW_GROW); g_free(tmp); } void gtk_webview_font_shrink(GtkWebView *webview) { - gint fontsize; - char *tmp; - - fontsize = gtk_webview_get_current_fontsize(webview); - fontsize = MAX(fontsize - 1, 1); - - tmp = g_strdup_printf("%d", fontsize); - do_formatting(webview, "fontSize", tmp); - g_free(tmp); + emit_format_signal(webview, GTK_WEBVIEW_SHRINK); } void gtk_webview_font_grow(GtkWebView *webview) { - gint fontsize; - char *tmp; - - fontsize = gtk_webview_get_current_fontsize(webview); - fontsize = MIN(fontsize + 1, MAX_FONT_SIZE); - - tmp = g_strdup_printf("%d", fontsize); - do_formatting(webview, "fontSize", tmp); - g_free(tmp); + emit_format_signal(webview, GTK_WEBVIEW_GROW); } void -- cgit v1.2.1 From 5961a57a0941d8e648ce85df0087cd42b6af9312 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 5 Jun 2012 07:37:08 +0000 Subject: Fix a widget type. --- pidgin/gtkwebviewtoolbar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index 8c74844c2d..7d5387446f 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -474,7 +474,7 @@ do_insert_link_cb(GtkWebViewToolbar *toolbar, PurpleRequestFields *fields) gtk_webview_insert_link(GTK_WEBVIEW(toolbar->webview), url, description); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->link), FALSE); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(priv->link), FALSE); priv->link_dialog = NULL; } -- cgit v1.2.1 From 14d7f959e871436c6a0487f6f7c3512b72149329 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 5 Jun 2012 07:39:12 +0000 Subject: Remove links and background colours on format-clear. --- pidgin/gtkwebview.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index d964e04408..95d8af77d0 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -374,6 +374,8 @@ webview_clear_formatting(GtkWebView *webview) return; do_formatting(webview, "removeFormat", ""); + do_formatting(webview, "unlink", ""); + do_formatting(webview, "backColor", "inherit"); } static void -- cgit v1.2.1 From 3ded04567459eea45e2f0cdf756228b02f9db4f1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 5 Jun 2012 23:59:36 +0000 Subject: Enable spell checking in an editable webview. --- pidgin/gtkutils.c | 4 +--- pidgin/gtkwebview.c | 10 ++++++++++ pidgin/gtkwebview.h | 8 ++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c index 09695818c9..5c8ac3b975 100644 --- a/pidgin/gtkutils.c +++ b/pidgin/gtkutils.c @@ -347,10 +347,8 @@ pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **to webview = gtk_webview_new(); gtk_webview_set_editable(GTK_WEBVIEW(webview), editable); -#ifdef USE_GTKSPELL if (editable && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck")) - pidgin_setup_gtkspell(GTK_TEXT_VIEW(webview)); -#endif + pidgin_webview_set_spellcheck(GTK_WEBVIEW(webview), TRUE); gtk_widget_show(webview); if (editable) { diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 95d8af77d0..84d5844227 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -819,6 +819,16 @@ gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) gtk_webview_set_format_functions(webview, buttons); } +void +pidgin_webview_set_spellcheck(GtkWebView *webview, gboolean enable) +{ + WebKitWebSettings *settings; + + settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(webview)); + g_object_set(G_OBJECT(settings), "enable-spell-checking", enable, NULL); + webkit_web_view_set_settings(WEBKIT_WEB_VIEW(webview), settings); +} + void gtk_webview_set_whole_buffer_formatting_only(GtkWebView *webview, gboolean wbfo) { diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index 926a869e2c..b05c4cbfb4 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -191,6 +191,14 @@ void gtk_webview_set_editable(GtkWebView *webview, gboolean editable); */ void gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags); +/** + * Setup spell-checking on a GtkWebView. + * + * @param webview The GtkWebView. + * @param enable Whether to enable or disable spell-checking. + */ +void pidgin_webview_set_spellcheck(GtkWebView *webview, gboolean enable); + /** * Enables or disables whole buffer formatting only (wbfo) in a GtkWebView. * In this mode formatting options to the buffer take effect for the entire -- cgit v1.2.1 From 0db06f572f41e3e6bfab755b844c861f95c2127e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 6 Jun 2012 01:55:02 +0000 Subject: Avoid some asserts with WBFO. --- pidgin/gtkwebview.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 84d5844227..bda7f7a80b 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -315,8 +315,8 @@ do_formatting(GtkWebView *webview, const char *name, const char *value) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); WebKitDOMDocument *dom; - WebKitDOMDOMWindow *win = NULL; - WebKitDOMDOMSelection *sel; + WebKitDOMDOMWindow *win; + WebKitDOMDOMSelection *sel = NULL; WebKitDOMRange *range = NULL; dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); @@ -324,7 +324,8 @@ do_formatting(GtkWebView *webview, const char *name, const char *value) if (priv->edit.wbfo) { win = webkit_dom_document_get_default_view(dom); sel = webkit_dom_dom_window_get_selection(win); - range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL); + if (webkit_dom_dom_selection_get_range_count(sel) > 0) + range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL); webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview)); } @@ -333,9 +334,12 @@ do_formatting(GtkWebView *webview, const char *name, const char *value) priv->edit.block_changed = FALSE; if (priv->edit.wbfo) { - sel = webkit_dom_dom_window_get_selection(win); - webkit_dom_dom_selection_remove_all_ranges(sel); - webkit_dom_dom_selection_add_range(sel, range); + if (range) { + webkit_dom_dom_selection_remove_all_ranges(sel); + webkit_dom_dom_selection_add_range(sel, range); + } else { + webkit_dom_dom_selection_collapse_to_end(sel, NULL); + } } } -- cgit v1.2.1 From 7097b633d528393f6593552f7228e1696b6bfbb1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 6 Jun 2012 02:56:53 +0000 Subject: This focus grab seems to be in the wrong place. --- pidgin/gtkwebview.c | 2 -- pidgin/gtkwebviewtoolbar.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index bda7f7a80b..0a21ed0467 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -986,8 +986,6 @@ gtk_webview_clear_formatting(GtkWebView *webview) object = g_object_ref(G_OBJECT(webview)); g_signal_emit(object, signals[CLEAR_FORMAT], 0); g_object_unref(object); - - gtk_widget_grab_focus(GTK_WIDGET(webview)); } void diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index 7d5387446f..3ab9d6f079 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -438,6 +438,7 @@ static void clear_formatting_cb(GtkAction *clear, GtkWebViewToolbar *toolbar) { gtk_webview_clear_formatting(GTK_WEBVIEW(toolbar->webview)); + gtk_widget_grab_focus(toolbar->webview); } static void -- cgit v1.2.1 From 62e3dcf35b953c2cd4ee58b827bcc0f60ca8fa16 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 6 Jun 2012 02:57:20 +0000 Subject: I disagree with this comment. --- pidgin/gtkwebview.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 0a21ed0467..2106f020b7 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -626,11 +626,6 @@ gtk_webview_load_html_string(GtkWebView *webview, const char *html) g_free(html_imged); } -/* this is a "hack", my plan is to eventually handle this - * correctly using a signals and a plugin: the plugin will have - * the information as to what javascript function to call. It seems - * wrong to hardcode that here. - */ void gtk_webview_append_html(GtkWebView *webview, const char *html) { -- cgit v1.2.1 From 18b8d43734b673a01167706119bd4e18c7e95c81 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 6 Jun 2012 03:39:36 +0000 Subject: This colour parsing seems unnecessary now. --- pidgin/gtkwebview.c | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 2106f020b7..b27354eca0 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -726,8 +726,6 @@ gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) GtkWebViewButtons buttons; if (flags & PURPLE_CONNECTION_HTML) { - char color[8]; - GdkColor fg_color, bg_color; gboolean bold, italic, underline, strike; buttons = GTK_WEBVIEW_ALL; @@ -769,34 +767,15 @@ gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) gtk_webview_font_set_size(webview, size); } - if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor"), "") != 0) - { - gdk_color_parse(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor"), - &fg_color); - g_snprintf(color, sizeof(color), - "#%02x%02x%02x", - fg_color.red / 256, - fg_color.green / 256, - fg_color.blue / 256); - } else - strcpy(color, ""); + gtk_webview_toggle_forecolor(webview, + purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor")); - gtk_webview_toggle_forecolor(webview, color); - - if (!(flags & PURPLE_CONNECTION_NO_BGCOLOR) && - strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), "") != 0) - { - gdk_color_parse(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), - &bg_color); - g_snprintf(color, sizeof(color), - "#%02x%02x%02x", - bg_color.red / 256, - bg_color.green / 256, - bg_color.blue / 256); - } else - strcpy(color, ""); - - gtk_webview_toggle_backcolor(webview, color); + if (!(flags & PURPLE_CONNECTION_NO_BGCOLOR)) { + gtk_webview_toggle_backcolor(webview, + purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor")); + } else { + gtk_webview_toggle_backcolor(webview, ""); + } if (flags & PURPLE_CONNECTION_FORMATTING_WBFO) gtk_webview_set_whole_buffer_formatting_only(webview, TRUE); -- cgit v1.2.1 From 4be1031098530a3cb61482a79ad0ffcd2ec361a9 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 6 Jun 2012 03:43:32 +0000 Subject: Fix indenting. --- pidgin/gtkstatusbox.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkstatusbox.h b/pidgin/gtkstatusbox.h index 37b536788f..b2daea34f8 100644 --- a/pidgin/gtkstatusbox.h +++ b/pidgin/gtkstatusbox.h @@ -98,8 +98,8 @@ struct _PidginStatusBox GtkWidget *icon_box_menu; GdkCursor *hand_cursor; GdkCursor *arrow_cursor; - int icon_size; - gboolean icon_opaque; + int icon_size; + gboolean icon_opaque; gboolean imhtml_visible; -- cgit v1.2.1 From ac67f98d799ff0ea4ce094c94e0d5167fcc60dfd Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 6 Jun 2012 04:10:12 +0000 Subject: gtkblist.c calls an imhtml function without #include'ing it. --- pidgin/gtkblist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 8ef3dade5f..71777ead8c 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -50,6 +50,7 @@ #include "gtkdebug.h" #include "gtkdialogs.h" #include "gtkft.h" +#include "gtkimhtml.h" #include "gtklog.h" #include "gtkmenutray.h" #include "gtkpounce.h" -- cgit v1.2.1 From 77f0a4ccd275ffeb4be6c0b60bd80874fbe3973e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 8 Jun 2012 01:18:55 +0000 Subject: Apparently, there's an object signal for this. Unfortunately, this signal is also called when we do programmatic changes, which could be trouble. --- pidgin/gtkwebview.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index b27354eca0..8727569ec9 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -414,7 +414,7 @@ webview_toggle_format(GtkWebView *webview, GtkWebViewButtons buttons) } static void -editable_input_cb(GObject *target, WebKitDOMEvent *event, GtkWebView *webview) +editable_input_cb(GtkWebView *webview, gpointer data) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); if (!priv->edit.block_changed) @@ -704,19 +704,15 @@ gtk_webview_page_down(GtkWebView *webview) void gtk_webview_set_editable(GtkWebView *webview, gboolean editable) { - WebKitDOMDocument *doc; - webkit_web_view_set_editable(WEBKIT_WEB_VIEW(webview), editable); - doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); if (editable) { - webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(doc), - "input", G_CALLBACK(editable_input_cb), - FALSE, webview); + g_signal_connect(G_OBJECT(webview), "user-changed-contents", + G_CALLBACK(editable_input_cb), NULL); } else { - webkit_dom_event_target_remove_event_listener(WEBKIT_DOM_EVENT_TARGET(doc), - "input", G_CALLBACK(editable_input_cb), - FALSE); + g_signal_handlers_disconnect_by_func(G_OBJECT(webview), + G_CALLBACK(editable_input_cb), + NULL); } } -- cgit v1.2.1 From a7dd0a5959bb5047d262024a73c99524450b34cd Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 8 Jun 2012 05:22:19 +0000 Subject: Update the toolbar when the caret moves. I'm not sure what that check was that I ended up removing, though. --- pidgin/gtkwebviewtoolbar.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c index 3ab9d6f079..12f648bddf 100644 --- a/pidgin/gtkwebviewtoolbar.c +++ b/pidgin/gtkwebviewtoolbar.c @@ -1126,17 +1126,11 @@ update_format_cb(GtkWebView *webview, GtkWebViewToolbar *toolbar) update_buttons(toolbar); } -#if 0 static void -mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *location, GtkTextMark *mark, - GtkWebViewToolbar *toolbar) +mark_set_cb(GtkWebView *webview, GtkWebViewToolbar *toolbar) { - if(mark != gtk_text_buffer_get_insert(buffer)) - return; - update_buttons(toolbar); } -#endif /* This comes from gtkmenutoolbutton.c from gtk+ * Copyright (C) 2003 Ricardo Fernandez Pascual @@ -1587,9 +1581,8 @@ gtk_webviewtoolbar_attach(GtkWebViewToolbar *toolbar, GtkWidget *webview) G_CALLBACK(update_format_cb), toolbar); g_signal_connect(G_OBJECT(webview), "format-updated", G_CALLBACK(update_format_cb), toolbar); -#if 0 - g_signal_connect_after(G_OBJECT(GTK_WEBVIEW(webview)->text_buffer), "mark-set", G_CALLBACK(mark_set_cb), toolbar); -#endif + g_signal_connect_after(G_OBJECT(webview), "selection-changed", + G_CALLBACK(mark_set_cb), toolbar); buttons = gtk_webview_get_format_functions(GTK_WEBVIEW(webview)); update_buttons_cb(GTK_WEBVIEW(webview), buttons, toolbar); -- cgit v1.2.1 From e592913c7448f2cfb95f9926d456f3e126be7c2c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 8 Jun 2012 06:26:35 +0000 Subject: Don't emit changed signal when a webview is insensitive. Apparently, this is what happens with a GtkTextView, so that we can do programmatic changes without the signal. --- pidgin/gtkwebview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 8727569ec9..cbf847f460 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -417,7 +417,7 @@ static void editable_input_cb(GtkWebView *webview, gpointer data) { GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - if (!priv->edit.block_changed) + if (!priv->edit.block_changed && gtk_widget_is_sensitive(GTK_WIDGET(webview))) g_signal_emit(webview, signals[CHANGED], 0); } -- cgit v1.2.1 From e88b2125999d39c8a45f2e099b19f338d8cbb21b Mon Sep 17 00:00:00 2001 From: Jochen Kemnade Date: Mon, 11 Jun 2012 17:49:35 +0000 Subject: work on the German translation --- po/de.po | 1677 ++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 986 insertions(+), 691 deletions(-) diff --git a/po/de.po b/po/de.po index d6f5487b3a..c04f165398 100644 --- a/po/de.po +++ b/po/de.po @@ -11,9 +11,9 @@ msgid "" msgstr "" "Project-Id-Version: de\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-20 10:02+0200\n" -"PO-Revision-Date: 2012-04-20 10:02+0200\n" -"Last-Translator: Björn Voigt \n" +"POT-Creation-Date: 2012-06-11 19:37+0200\n" +"PO-Revision-Date: 2012-06-11 19:36+0200\n" +"Last-Translator: Jochen Kemnade \n" "Language-Team: German \n" "Language: de\n" "MIME-Version: 1.0\n" @@ -50,17 +50,6 @@ msgstr "" " -n, --nologin nicht automatisch anmelden\n" " -v, --version zeigt aktuelle Version und beendet das Programm\n" -#, c-format -msgid "" -"%s encountered errors migrating your settings from %s to %s. Please " -"investigate and complete the migration by hand. Please report this error at " -"http://developer.pidgin.im" -msgstr "" -"%s ist beim Übertragen Ihrer Einstellungen von %s nach %s auf Fehler " -"gestoßen. Bitte untersuchen Sie das Problem und vervollständigen Sie die " -"Migration per Hand. Bitte melden Sie diesen Fehler auf http://developer." -"pidgin.im" - #. the user did not fill in the captcha msgid "Error" msgstr "Fehler" @@ -213,6 +202,8 @@ msgstr "Das gewählte Konto ist nicht online." msgid "Error adding buddy" msgstr "Fehler beim Hinzufügen des Buddys" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Username" msgstr "Benutzer" @@ -346,7 +337,11 @@ msgstr "Markierung umkehren" msgid "View Log" msgstr "Mitschnitt anzeigen" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. General +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Nickname" msgstr "Spitzname" @@ -800,7 +795,11 @@ msgid "Remaining" msgstr "Verbleibend" #. XXX: Use of ggp_str_to_uin() is an ugly hack! +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext #. presence +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status" msgstr "Status" @@ -906,7 +905,6 @@ msgstr "Anrufen..." msgid "Hangup" msgstr "Auflegen" -#. Number of actions msgid "Accept" msgstr "Akzeptieren" @@ -1389,6 +1387,8 @@ msgstr "Titel" msgid "Type" msgstr "Typ" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. Statuses are almost all the same. Define a macro to reduce code repetition. #. PurpleStatusPrimitive #. id - use default @@ -1397,6 +1397,8 @@ msgstr "Typ" #. user_settable #. not independent #. Attributes - each status can have a message. +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Message" msgstr "Nachricht" @@ -1741,22 +1743,25 @@ msgstr "Das Zertifikat wurde widerrufen." msgid "An unknown certificate error occurred." msgstr "Es ist ein unbekannter Zertifikatfehler aufgetreten." +#, fuzzy +msgid "(MATCH)" +msgstr "Beobachten" + msgid "(DOES NOT MATCH)" msgstr "(stimmt nicht überein)" -#. Make messages #, c-format msgid "%s has presented the following certificate for just-this-once use:" msgstr "" "%s hat das folgende Zertifikat für den einmaligen Gebrauch präsentiert:" -#, c-format -msgid "" -"Common name: %s %s\n" -"Fingerprint (SHA1): %s" +#, fuzzy, c-format +msgid "Common name: %s %s" msgstr "" -"Allgemeiner Name (Common name:) %s %s\n" -"Fingerabdruck (SHA1): %s" +"Allgemeiner Name (Common name): %s\n" +"\n" +"Fingerabdruck (SHA1):\n" +"%s" #. TODO: Find what the handle ought to be msgid "Single-use Certificate Verification" @@ -1772,7 +1777,6 @@ msgstr "Zertifizierungsstelle" msgid "SSL Peers Cache" msgstr "SSL-Peers-Zwischenspeicher" -#. Make messages #, c-format msgid "Accept certificate for %s?" msgstr "Akzeptieren Sie das Zertifikat für %s?" @@ -1781,9 +1785,6 @@ msgstr "Akzeptieren Sie das Zertifikat für %s?" msgid "SSL Certificate Verification" msgstr "SSL-Zertifikatsüberprüfung" -msgid "_View Certificate..." -msgstr "Ze_rtifikat ansehen..." - #, c-format msgid "The certificate for %s could not be validated." msgstr "Das Zertifikat für %s konnte nicht validiert werden." @@ -1804,27 +1805,6 @@ msgstr "" "dass Sie tatsächlich nicht mit dem Dienst verbunden sind, mit dem Sie " "glauben verbunden zu sein." -#. Make messages -#, c-format -msgid "" -"Common name: %s\n" -"\n" -"Fingerprint (SHA1): %s\n" -"\n" -"Activation date: %s\n" -"Expiration date: %s\n" -msgstr "" -"Allgemeiner Name (Common name): %s\n" -"\n" -"Fingerabdruck (SHA1): %s\n" -"\n" -"Aktivierungsdatum: %s\n" -"Ablaufdatum: %s\n" - -#. TODO: Find what the handle ought to be -msgid "Certificate Information" -msgstr "Zertifikat-Information" - #. show error to user msgid "Registration Error" msgstr "Registrierungsfehler" @@ -2074,63 +2054,34 @@ msgstr "Dateiübertragung an %s wurde abgebrochen." msgid "File transfer from %s failed." msgstr "Dateiübertragung von %s wurde abgebrochen." -msgid "Run the command in a terminal" -msgstr "Befehl in einem Terminal ausführen" - -msgid "The command used to handle \"aim\" URLs, if enabled." -msgstr "Der Befehl, der „aim“-URLs verarbeitet, wenn aktiviert." - -msgid "The command used to handle \"gg\" URLs, if enabled." -msgstr "Der Befehl, der „gg“-URLs verarbeitet, wenn aktiviert." - -msgid "The command used to handle \"icq\" URLs, if enabled." -msgstr "Der Befehl, der „icq“-URLs verarbeitet, wenn aktiviert." - -msgid "The command used to handle \"irc\" URLs, if enabled." -msgstr "Der Befehl, der „irc“-URLs verarbeitet, wenn aktiviert." - -msgid "The command used to handle \"msnim\" URLs, if enabled." -msgstr "Der Befehl, der „msnim“-URLs verarbeitet, wenn aktiviert." - -msgid "The command used to handle \"sip\" URLs, if enabled." -msgstr "Der Befehl, der „sip“-URLs verarbeitet, wenn aktiviert." - -msgid "The command used to handle \"xmpp\" URLs, if enabled." -msgstr "Der Befehl, der „xmpp“-URLs verarbeitet, wenn aktiviert." +msgid "Whether the specified command should handle \"aim\" URLs" +msgstr "Legt fest, ob das angegebene Kommando „aim“-URLs verarbeiten soll" -msgid "The command used to handle \"ymsgr\" URLs, if enabled." -msgstr "Der Befehl, der „ymsgr“-URLs verarbeitet, wenn aktiviert." +msgid "" +"True if the command specified in the \"command\" key should handle \"aim\" " +"URLs." +msgstr "" +"Aktivieren, wenn der Befehl, der im „command“-Schlüssel angegeben ist, „aim“-" +"URLs verarbeiten soll." msgid "The handler for \"aim\" URLs" msgstr "Behandlungsroutine für „aim“-URLs" -msgid "The handler for \"gg\" URLs" -msgstr "Behandlungsroutine für „gg“-URLs" - -msgid "The handler for \"icq\" URLs" -msgstr "Behandlungsroutine für „icq“-URLs" - -msgid "The handler for \"irc\" URLs" -msgstr "Behandlungsroutine für „irc“-URLs" - -msgid "The handler for \"msnim\" URLs" -msgstr "Behandlungsroutine für „msnim“-URLs" - -msgid "The handler for \"sip\" URLs" -msgstr "Behandlungsroutine für „sip“-URLs" - -msgid "The handler for \"xmpp\" URLs" -msgstr "Behandlungsroutine für „xmpp“-URLs" +msgid "The command used to handle \"aim\" URLs, if enabled." +msgstr "Der Befehl, der „aim“-URLs verarbeitet, wenn aktiviert." -msgid "The handler for \"ymsgr\" URLs" -msgstr "Behandlungsroutine für „ymsrg“-URLs" +msgid "Run the command in a terminal" +msgstr "Befehl in einem Terminal ausführen" msgid "" -"True if the command specified in the \"command\" key should handle \"aim\" " -"URLs." +"True if the command used to handle this type of URL should be run in a " +"terminal." msgstr "" -"Aktivieren, wenn der Befehl, der im „command“-Schlüssel angegeben ist, „aim“-" -"URLs verarbeiten soll." +"Aktivieren, wenn der Befehl, der benutzt wird um diese Art von URL zu " +"verarbeiten, in einem Terminal ausgeführt werden soll." + +msgid "Whether the specified command should handle \"gg\" URLs" +msgstr "Legt fest, ob das angegebene Kommando „gg“-URLs verarbeiten soll" msgid "" "True if the command specified in the \"command\" key should handle \"gg\" " @@ -2139,6 +2090,15 @@ msgstr "" "Aktivieren, wenn der Befehl, der im „command“-Schlüssel angegeben ist, „gg“-" "URLs verarbeiten soll." +msgid "The handler for \"gg\" URLs" +msgstr "Behandlungsroutine für „gg“-URLs" + +msgid "The command used to handle \"gg\" URLs, if enabled." +msgstr "Der Befehl, der „gg“-URLs verarbeitet, wenn aktiviert." + +msgid "Whether the specified command should handle \"icq\" URLs" +msgstr "Legt fest, ob das angegebene Kommando „icq“-URLs verarbeiten soll" + msgid "" "True if the command specified in the \"command\" key should handle \"icq\" " "URLs." @@ -2146,6 +2106,15 @@ msgstr "" "Aktivieren, wenn der Befehl, der im „command“-Schlüssel angegeben ist, „icq“-" "URLs verarbeiten soll." +msgid "The handler for \"icq\" URLs" +msgstr "Behandlungsroutine für „icq“-URLs" + +msgid "The command used to handle \"icq\" URLs, if enabled." +msgstr "Der Befehl, der „icq“-URLs verarbeitet, wenn aktiviert." + +msgid "Whether the specified command should handle \"irc\" URLs" +msgstr "Legt fest, ob das angegebene Kommando „irc“-URLs verarbeiten soll" + msgid "" "True if the command specified in the \"command\" key should handle \"irc\" " "URLs." @@ -2153,6 +2122,15 @@ msgstr "" "Aktivieren, wenn der Befehl, der im „command“-Schlüssel angegeben ist, „irc“-" "URLs verarbeiten soll." +msgid "The handler for \"irc\" URLs" +msgstr "Behandlungsroutine für „irc“-URLs" + +msgid "The command used to handle \"irc\" URLs, if enabled." +msgstr "Der Befehl, der „irc“-URLs verarbeitet, wenn aktiviert." + +msgid "Whether the specified command should handle \"msnim\" URLs" +msgstr "Legt fest, ob das angegebene Kommando „msnim“-URLs verarbeiten soll" + msgid "" "True if the command specified in the \"command\" key should handle \"msnim\" " "URLs." @@ -2160,6 +2138,15 @@ msgstr "" "Aktivieren, wenn der Befehl, der im „command“-Schlüssel angegeben ist, " "„msnim“-URLs verarbeiten soll." +msgid "The handler for \"msnim\" URLs" +msgstr "Behandlungsroutine für „msnim“-URLs" + +msgid "The command used to handle \"msnim\" URLs, if enabled." +msgstr "Der Befehl, der „msnim“-URLs verarbeitet, wenn aktiviert." + +msgid "Whether the specified command should handle \"sip\" URLs" +msgstr "Legt fest, ob das angegebene Kommando „sip“-URLs verarbeiten soll" + msgid "" "True if the command specified in the \"command\" key should handle \"sip\" " "URLs." @@ -2167,6 +2154,15 @@ msgstr "" "Aktivieren, wenn der Befehl, der im „command“-Schlüssel angegeben ist, „sip“-" "URLs verarbeiten soll." +msgid "The handler for \"sip\" URLs" +msgstr "Behandlungsroutine für „sip“-URLs" + +msgid "The command used to handle \"sip\" URLs, if enabled." +msgstr "Der Befehl, der „sip“-URLs verarbeitet, wenn aktiviert." + +msgid "Whether the specified command should handle \"xmpp\" URLs" +msgstr "Legt fest, ob das angegebene Kommando „xmpp“-URLs verarbeiten soll" + msgid "" "True if the command specified in the \"command\" key should handle \"xmpp\" " "URLs." @@ -2174,6 +2170,15 @@ msgstr "" "Aktivieren, wenn der Befehl, der im „command“-Schlüssel angegeben ist, " "„xmpp“-URLs verarbeiten soll." +msgid "The handler for \"xmpp\" URLs" +msgstr "Behandlungsroutine für „xmpp“-URLs" + +msgid "The command used to handle \"xmpp\" URLs, if enabled." +msgstr "Der Befehl, der „xmpp“-URLs verarbeitet, wenn aktiviert." + +msgid "Whether the specified command should handle \"ymsgr\" URLs" +msgstr "Legt fest, ob das angegebene Kommando „ymsrg“-URLs verarbeiten soll" + msgid "" "True if the command specified in the \"command\" key should handle \"ymsgr\" " "URLs." @@ -2181,36 +2186,11 @@ msgstr "" "Aktivieren, wenn der Befehl, der im „command“-Schlüssel angegeben ist, " "„ymsgr“-URLs verarbeiten soll." -msgid "" -"True if the command used to handle this type of URL should be run in a " -"terminal." -msgstr "" -"Aktivieren, wenn der Befehl, der benutzt wird um diese Art von URL zu " -"verarbeiten, in einem Terminal ausgeführt werden soll." - -msgid "Whether the specified command should handle \"aim\" URLs" -msgstr "Legt fest, ob das angegebene Kommando „aim“-URLs verarbeiten soll" - -msgid "Whether the specified command should handle \"gg\" URLs" -msgstr "Legt fest, ob das angegebene Kommando „gg“-URLs verarbeiten soll" - -msgid "Whether the specified command should handle \"icq\" URLs" -msgstr "Legt fest, ob das angegebene Kommando „icq“-URLs verarbeiten soll" - -msgid "Whether the specified command should handle \"irc\" URLs" -msgstr "Legt fest, ob das angegebene Kommando „irc“-URLs verarbeiten soll" - -msgid "Whether the specified command should handle \"msnim\" URLs" -msgstr "Legt fest, ob das angegebene Kommando „msnim“-URLs verarbeiten soll" - -msgid "Whether the specified command should handle \"sip\" URLs" -msgstr "Legt fest, ob das angegebene Kommando „sip“-URLs verarbeiten soll" - -msgid "Whether the specified command should handle \"xmpp\" URLs" -msgstr "Legt fest, ob das angegebene Kommando „xmpp“-URLs verarbeiten soll" +msgid "The handler for \"ymsgr\" URLs" +msgstr "Behandlungsroutine für „ymsrg“-URLs" -msgid "Whether the specified command should handle \"ymsgr\" URLs" -msgstr "Legt fest, ob das angegebene Kommando „ymsrg“-URLs verarbeiten soll" +msgid "The command used to handle \"ymsgr\" URLs, if enabled." +msgstr "Der Befehl, der „ymsgr“-URLs verarbeitet, wenn aktiviert." msgid "The logger has no read function" msgstr "Der Logger hat keine Lesefunktion" @@ -2759,6 +2739,10 @@ msgstr "Offline-Nachrichten-Emulation" msgid "Save messages sent to an offline user as pounce." msgstr "Sichert Nachrichten an einen Offline-Benutzer als Alarm." +#, fuzzy +msgid "Offline message" +msgstr "Offline-Nachrichten" + msgid "" "The rest of the messages will be saved as pounces. You can edit/delete the " "pounce from the `Buddy Pounce' dialog." @@ -2896,6 +2880,23 @@ msgstr "Einfaches Plugin" msgid "Tests to see that most things are working." msgstr "Tests, um zu sehen, ob das meiste funktioniert." +#. Make messages +#, c-format +msgid "" +"Common name: %s\n" +"\n" +"Fingerprint (SHA1): %s\n" +"\n" +"Activation date: %s\n" +"Expiration date: %s\n" +msgstr "" +"Allgemeiner Name (Common name): %s\n" +"\n" +"Fingerabdruck (SHA1): %s\n" +"\n" +"Aktivierungsdatum: %s\n" +"Ablaufdatum: %s\n" + #. Scheme name msgid "X.509 Certificates" msgstr "X.509-Zertifikate" @@ -3028,19 +3029,29 @@ msgid "" msgstr "Keine Verbindung zum lokalen mDNS-Server. Ist er aktiviert?" # old strings +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "First name" msgstr "Vorname" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Last name" msgstr "Nachname" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. email msgid "Email" msgstr "E-Mail" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "AIM Account" msgstr "AIM-Konto" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "XMPP Account" msgstr "XMPP-Konto" @@ -3155,6 +3166,8 @@ msgstr "Registrierung eines neuen Gadu-Gadu-Kontos" msgid "Please, fill in the following fields" msgstr "Bitte füllen Sie die folgenden Felder aus" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "City" msgstr "Stadt" @@ -3162,6 +3175,8 @@ msgid "Year of birth" msgstr "Geburtsjahr" #. gender +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Gender" msgstr "Geschlecht" @@ -3184,20 +3199,26 @@ msgstr "Suche Buddys" msgid "Please, enter your search criteria below" msgstr "Bitte geben Sie Ihre Suchkriterien unten ein" -msgid "Fill in the fields." -msgstr "Füllen Sie die Felder aus." +msgid "Change password for the Gadu-Gadu account" +msgstr "Ändern des Passworts für dieses Gadu-Gadu-Konto" -msgid "Your current password is different from the one that you specified." -msgstr "Ihr aktuelles Passwort ist anders als das angegebene." +msgid "Password was changed successfully!" +msgstr "Das Passwort wurde erfolgreich geändert!" msgid "Unable to change password. Error occurred.\n" msgstr "Konnte das Passwort nicht ändern. Es trat ein Fehler auf.\n" -msgid "Change password for the Gadu-Gadu account" -msgstr "Ändern des Passworts für dieses Gadu-Gadu-Konto" +msgid "Fill in the fields." +msgstr "Füllen Sie die Felder aus." -msgid "Password was changed successfully!" -msgstr "Das Passwort wurde erfolgreich geändert!" +msgid "New password should be at most 15 characters long." +msgstr "" + +msgid "Your current password is different from the one that you specified." +msgstr "Ihr aktuelles Passwort ist anders als das angegebene." + +msgid "Invalid email address" +msgstr "Ungültige E-Mail-Adresse" msgid "Current password" msgstr "Aktuelles Passwort" @@ -3205,6 +3226,9 @@ msgstr "Aktuelles Passwort" msgid "Password (retype)" msgstr "Passwort (nochmal)" +msgid "Email Address" +msgstr "E-Mail-Adresse" + msgid "Enter current token" msgstr "Geben Sie das aktuelle Token ein" @@ -3260,14 +3284,20 @@ msgstr "Nicht stören" msgid "Away" msgstr "Abwesend" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "UIN" msgstr "UIN" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext #. first name #. optional information msgid "First Name" msgstr "Vorname" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Birth Year" msgstr "Geburtsjahr" @@ -3307,6 +3337,30 @@ msgstr "Ihre Buddy-Liste wurde auf dem Server gespeichert." msgid "Connected" msgstr "Verbunden" +msgid "Unable to resolve hostname" +msgstr "Hostname konnte nicht aufgelöst werden" + +msgid "Incorrect password" +msgstr "Falsches Passwort" + +msgid "SSL Connection Failed" +msgstr "SSL-Verbindung gescheitert" + +msgid "" +"Your account has been disabled because too many incorrect passwords were " +"entered" +msgstr "" +"Ihr Konto wurde wegen zu vielen falsch eingegebenen Passworten gesperrt" + +msgid "Service temporarily unavailable" +msgstr "Dienst momentan nicht verfügbar" + +msgid "Error connecting to proxy server" +msgstr "Fehler beim Verbinden mit dem Proxy-Server" + +msgid "Error connecting to master server" +msgstr "Fehler beim Verbinden mit dem Master-Server" + msgid "Connection failed" msgstr "Verbindung fehlgeschlagen" @@ -3316,9 +3370,15 @@ msgstr "Zum Chat hinzufügen" msgid "Chat _name:" msgstr "Chat_name:" -#, c-format -msgid "Unable to resolve hostname '%s': %s" -msgstr "Hostname '%s' kann nicht aufgelöst werden: %s" +msgid "The username specified is invalid." +msgstr "Der angegebene Benutzername ist ungültig." + +msgid "SSL support unavailable" +msgstr "SSL-Unterstützung nicht verfügbar" + +#, c-format +msgid "Unable to resolve hostname '%s': %s" +msgstr "Hostname '%s' kann nicht aufgelöst werden: %s" #. 1. connect to server #. connect to the server @@ -3334,12 +3394,12 @@ msgstr "Dieser Chatname existiert bereits" msgid "Not connected to the server" msgstr "Nicht mit dem Server verbunden" -msgid "Find buddies..." -msgstr "Finde Buddys..." - msgid "Change password..." msgstr "Passwort ändern..." +msgid "Find buddies..." +msgstr "Finde Buddys..." + msgid "Upload buddylist to Server" msgstr "Buddy-Liste zum Server hochladen" @@ -3370,25 +3430,24 @@ msgstr "Gadu-Gadu-Protokoll-Plugin" msgid "Polish popular IM" msgstr "Beliebter polnischer IM-Dienst" -msgid "Gadu-Gadu User" -msgstr "Gadu-Gadu-Benutzer" - msgid "GG server" msgstr "GG-Server" -msgid "Don't use encryption" -msgstr "Keine Verschlüsselung benutzen" - msgid "Use encryption if available" msgstr "Verschlüsselung benutzen, wenn verfügbar" -#. TODO msgid "Require encryption" msgstr "Verschlüsselung fordern" +msgid "Don't use encryption" +msgstr "Keine Verschlüsselung benutzen" + msgid "Connection security" msgstr "Verbindungssicherheit" +msgid "Show links from strangers" +msgstr "" + #, c-format msgid "Unknown command: %s" msgstr "Unbekanntes Kommando: %s" @@ -3441,9 +3500,6 @@ msgstr "_Passwort:" msgid "IRC nick and server may not contain whitespace" msgstr "IRC-Server und -Spitzname dürfen keinen Leerraum enthalten" -msgid "SSL support unavailable" -msgstr "SSL-Unterstützung nicht verfügbar" - msgid "Unable to connect" msgstr "Verbindung nicht möglich" @@ -3478,6 +3534,8 @@ msgid "The IRC Protocol Plugin that Sucks Less" msgstr "Das IRC-Protokoll-Plugin mit weniger Problemen" #. set up account ID as user:server +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Server" msgstr "Server" @@ -4016,6 +4074,8 @@ msgstr "Die Verbindung mit dem Server konnte nicht hergestellt werden: %s" msgid "Unable to establish SSL connection" msgstr "Kann SSL-Verbindung nicht erstellen" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Full Name" msgstr "Vollständiger Name" @@ -4086,9 +4146,13 @@ msgstr "" "Die folgenden Punkte sind optional. Geben Sie nur die Informationen an, die " "Sie angeben möchten." +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Client" msgstr "Client" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Operating System" msgstr "Betriebssystem" @@ -4098,6 +4162,8 @@ msgstr "Lokale Zeit" msgid "Priority" msgstr "Priorität" +#. TODO: Check whether it's correct to call prepend_pair_html, +#. or if we should be using prepend_pair_plaintext msgid "Resource" msgstr "Ressource" @@ -4194,9 +4260,6 @@ msgstr "" "Füllen Sie ein oder mehrere Felder aus, um nach entsprechenden XMPP-" "Benutzern zu suchen." -msgid "Email Address" -msgstr "E-Mail-Adresse" - msgid "Search for XMPP users" msgstr "Suche nach XMPP-Benutzern" @@ -4407,6 +4470,8 @@ msgstr "Server unterstützt kein Blockieren" msgid "Not Authorized" msgstr "Nicht autorisiert" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Mood" msgstr "Stimmung" @@ -4740,6 +4805,10 @@ msgstr "Wählen Sie eine Ressource" msgid "Initiate Media" msgstr "Initiiere Medien" +#, fuzzy +msgid "Failed to specify mood" +msgstr "Setzen der cmodes für %s gescheitert" + msgid "Account does not support PEP, can't set mood" msgstr "Konto unterstützt kein PEP, kann die Stimmung nicht setzen" @@ -4799,7 +4868,8 @@ msgstr "ping <jid>:\tBenutzer/Komponente/Server anpingen." msgid "buzz: Buzz a user to get their attention" msgstr "buzz: Einen Kontakt anrufen, um seine Aufmerksamkeit zu erhalten" -msgid "mood: Set current user mood" +#, fuzzy +msgid "mood <mood> [text]: Set current user mood" msgstr "mood: Setze die aktuelle Benutzerstimmung" msgid "Extended Away" @@ -5256,9 +5326,6 @@ msgstr "Kann die Nachricht nicht parsen" msgid "Syntax Error (probably a client bug)" msgstr "Syntaxfehler (wahrscheinlich ein Client-Bug)" -msgid "Invalid email address" -msgstr "Ungültige E-Mail-Adresse" - msgid "User does not exist" msgstr "Benutzer existiert nicht" @@ -5326,9 +5393,6 @@ msgstr "Zu viele Treffer zu einem FND" msgid "Not logged in" msgstr "Nicht angemeldet" -msgid "Service temporarily unavailable" -msgstr "Dienst momentan nicht verfügbar" - msgid "Database server error" msgstr "Fehler des Datenbank-Servers" @@ -5676,6 +5740,8 @@ msgstr "Alter" msgid "Occupation" msgstr "Beruf" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Location" msgstr "Ort" @@ -6083,9 +6149,6 @@ msgstr "Buddy aus dem Adressbuch löschen?" msgid "Do you want to delete this buddy from your address book as well?" msgstr "Möchten Sie diesen Buddy außerdem aus Ihrem Adressbuch löschen?" -msgid "The username specified is invalid." -msgstr "Der angegebene Benutzername ist ungültig." - msgid "The Display Name you entered is invalid." msgstr "Der eingegebene Anzeigename ist ungültig." @@ -6101,6 +6164,8 @@ msgstr "Profil-Aktualisierungsfehler" #. no profile information yet, so we cannot update #. (reference: "libpurple/request.h") +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Profile" msgstr "Profil" @@ -6214,6 +6279,8 @@ msgstr "Startbildschirm anzeigen..." msgid "About..." msgstr "Über..." +#. we are trying to send a file to MXit +#. need to reserve some space for packet headers #. the file is too big msgid "The file you are trying to send is too large!" msgstr "Die Datei, die Sie senden möchten ist zu groß!" @@ -6334,16 +6401,14 @@ msgstr "Sie haben eingeladen" msgid "Loading menu..." msgstr "Lade das Menü..." +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Status Message" msgstr "Status-Nachricht" msgid "Rejection Message" msgstr "Ablehnungsnachricht" -#. hidden number -msgid "Hidden Number" -msgstr "Versteckte Nummer" - msgid "No profile available" msgstr "Kein Profil verfügbar" @@ -6427,6 +6492,10 @@ msgstr "" msgid "Message Error" msgstr "Nachrichtenfehler" +#. could not be decrypted +msgid "An encrypted message was received which could not be decrypted." +msgstr "" + msgid "Cannot perform redirect using the specified protocol" msgstr "Kann die Umleitung nicht mit dem angegebenen Protokoll durchführen" @@ -6691,18 +6760,26 @@ msgstr "Bildschirmauflösung (dpi)" msgid "Base font size (points)" msgstr "Basis-Schriftgröße (Punkt)" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User" msgstr "Benutzer" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Headline" msgstr "Überschrift" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Song" msgstr "Lied" msgid "Total Friends" msgstr "Freunde insgesamt" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Client Version" msgstr "Client-Version" @@ -6906,9 +6983,6 @@ msgstr "Nicht unterstützt" msgid "Password has expired" msgstr "Passwort ist abgelaufen" -msgid "Incorrect password" -msgstr "Falsches Passwort" - msgid "Account has been disabled" msgstr "Konto wurde deaktiviert" @@ -6935,12 +7009,6 @@ msgstr "" "Konnte den Rechnernamen des Benutzers, den Sie eingegeben haben, nicht " "erkennen" -msgid "" -"Your account has been disabled because too many incorrect passwords were " -"entered" -msgstr "" -"Ihr Konto wurde wegen zu vielen falsch eingegebenen Passworten gesperrt" - msgid "You cannot add the same person twice to a conversation" msgstr "Sie können die selbe Person nicht zweimal zu einem Gespräch hinzufügen" @@ -7066,12 +7134,9 @@ msgstr "Hauspostcode" msgid "User ID" msgstr "Benutzer-ID" -#. tag = _("DN"); -#. value = nm_user_record_get_dn(user_record); -#. if (value) { -#. purple_notify_user_info_add_pair(user_info, tag, value); -#. } -#. +msgid "DN" +msgstr "" + msgid "Full name" msgstr "Vollständiger Name" @@ -7566,9 +7631,6 @@ msgstr "SecurID-Eingabe" msgid "Enter the 6 digit number from the digital display." msgstr "Geben Sie die 6-stellige Nummer vom Digital-Display ein." -msgid "Password sent" -msgstr "Passwort gesendet" - msgid "Unable to initialize connection" msgstr "Kann Verbindung nicht erstellen" @@ -7868,9 +7930,6 @@ msgstr "" "senden. Ihre Buddy-Liste ist nicht verloren und wird wahrscheinlich in ein " "paar Minuten wieder verfügbar sein." -msgid "Orphans" -msgstr "Waisen" - #, c-format msgid "" "Unable to add the buddy %s because you have too many buddies in your buddy " @@ -8174,6 +8233,7 @@ msgstr "Benutzerinformation nicht verfügbar: %s" msgid "Mobile Phone" msgstr "Handynummer" +#. TODO: Is it correct to pass info->email here...? msgid "Personal Web Page" msgstr "Persönliche Webseite" @@ -8194,6 +8254,7 @@ msgstr "Abteilung" msgid "Position" msgstr "Position" +#. TODO: Is it correct to pass info->email here...? msgid "Web Page" msgstr "Webseite" @@ -8463,13 +8524,13 @@ msgstr "Thema:" msgid "A server is required to connect this account" msgstr "Es wird ein Server benötigt um dieses Konto zu verbinden" +msgid "Last Known Client" +msgstr "Letzter bekannter Client" + #, c-format msgid "Unknown (0x%04x)
    " msgstr "Unbekannt (0x%04x)
    " -msgid "Last Known Client" -msgstr "Letzter bekannter Client" - msgid "User Name" msgstr "Benutzername" @@ -8792,21 +8853,33 @@ msgstr "Hyperaktiv" msgid "Robot" msgstr "Robot" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "User Modes" msgstr "Benutzermodi" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Contact" msgstr "Bevorzugter Kontakt" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Preferred Language" msgstr "Bevorzugte Sprache" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Device" msgstr "Gerät" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Timezone" msgstr "Zeitzone" +#. TODO: Check whether it's correct to call add_pair_html, +#. or if we should be using add_pair_plaintext msgid "Geolocation" msgstr "Geographische Koordinaten" @@ -9676,78 +9749,12 @@ msgstr "" msgid "Whiteboard" msgstr "Whiteboard" -msgid "No server statistics available" -msgstr "Keine Serverstatistik verfügbar" - -msgid "Error during connecting to SILC Server" -msgstr "Fehler beim Verbinden mit dem SILC-Server" - -#, c-format -msgid "Failure: Version mismatch, upgrade your client" -msgstr "Fehler: Unterschiedliche Version, aktualisieren Sie Ihren Client" - -#, c-format -msgid "Failure: Remote does not trust/support your public key" -msgstr "" -"Fehler: Die entfernte Seite vertraut Ihrem öffentlichen Schlüssel nicht" - -#, c-format -msgid "Failure: Remote does not support proposed KE group" -msgstr "" -"Fehler: Entferntes Programm unterstützt nicht die vorgeschlagen KE-Gruppe" - -#, c-format -msgid "Failure: Remote does not support proposed cipher" -msgstr "" -"Fehler: Entferntes Programm unterstützt die vorgeschlagene Chiffre nicht" - -#, c-format -msgid "Failure: Remote does not support proposed PKCS" -msgstr "Fehler: Entferntes Programm unterstützt die vorgeschlagene PKCS nicht" - -#, c-format -msgid "Failure: Remote does not support proposed hash function" -msgstr "" -"Fehler: Entferntes Programm unterstützt die vorgeschlagen Hashfunktion nicht" - -#, c-format -msgid "Failure: Remote does not support proposed HMAC" -msgstr "Fehler: Entferntes Programm unterstützt das vorgeschlagene HMAC nicht" - -#, c-format -msgid "Failure: Incorrect signature" -msgstr "Fehler: Falsche Signatur" - -#, c-format -msgid "Failure: Invalid cookie" -msgstr "Fehler: Ungültiger Cookie" - -#, c-format -msgid "Failure: Authentication failed" -msgstr "Fehler: Authentifizierung fehlgeschlagen" - -msgid "Unable to initialize SILC Client connection" -msgstr "SILC-Client-Verbindung konnte nicht hergestellt werden" - -msgid "John Noname" -msgstr "Max Mustermann" - -#, c-format -msgid "Unable to load SILC key pair: %s" -msgstr "SILC-Schlüsselpaar konnte nicht geladen werden: %s" - -msgid "Unable to create connection" -msgstr "Kann Verbindung nicht erstellen" - msgid "Unknown server response" msgstr "Unbekannte Serverantwort" msgid "Unable to create listen socket" msgstr "Lauschender Socket konnte nicht erstellt werden" -msgid "Unable to resolve hostname" -msgstr "Hostname konnte nicht aufgelöst werden" - msgid "SIP usernames may not contain whitespaces or @ symbols" msgstr "SIP-Benutzernamen dürfen keine Leerzeichen oder @-Symbole enthalten" @@ -10228,6 +10235,8 @@ msgstr "Kann nicht an den Chat %s,%s,%s senden" msgid "Hidden or not logged-in" msgstr "Versteckt oder nicht angemeldet" +#. TODO: Need to escape locs.host and locs.time? +#. TODO: Need to escape the two strings that make up tmp? #, c-format msgid "
    At %s since %s" msgstr "
    Bei %s seit %s" @@ -10436,9 +10445,6 @@ msgstr "Gespeichertes Bild" msgid "Stored Image. (that'll have to do for now)" msgstr "Gespeichertes Bild. (Das muss erstmal reichen)" -msgid "SSL Connection Failed" -msgstr "SSL-Verbindung gescheitert" - msgid "SSL Handshake Failed" msgstr "SSL-Verhandlung gescheitert" @@ -10614,18 +10620,18 @@ msgstr "" "Beim Einlesen Ihrer %s trat ein Fehler auf. Die Datei wurde nicht geladen " "und die alte Datei wurde in %s~ umbenannt." +msgid "Pidgin Internet Messenger" +msgstr "Pidgin Internet-Sofortnachrichtendienst" + +msgid "Internet Messenger" +msgstr "Internet-Sofortnachrichtendienst" + msgid "" "Chat over IM. Supports AIM, Google Talk, Jabber/XMPP, MSN, Yahoo and more" msgstr "" "Chatten mit Kurznachrichten. Unterstützt AIM, Google Talk, Jabber/XMPP, " "MSN, Yahoo und weitere" -msgid "Internet Messenger" -msgstr "Internet-Sofortnachrichtendienst" - -msgid "Pidgin Internet Messenger" -msgstr "Pidgin Internet-Sofortnachrichtendienst" - #. Build the login options frame. msgid "Login Options" msgstr "Anmeldeoptionen" @@ -11009,9 +11015,6 @@ msgstr "_Zusammenklappen" msgid "_Expand" msgstr "A_usklappen" -msgid "/Tools/Mute Sounds" -msgstr "/Werkzeuge/Stummschalten" - msgid "" "You are not currently signed on with an account that can add that buddy." msgstr "" @@ -11036,122 +11039,123 @@ msgstr "Benutzerstimmung ändern" #. NOTE: Do not set any accelerator to Control+O. It is mapped by #. gtk_blist_key_press_cb to "Get User Info" on the selected buddy. #. Buddies menu -msgid "/_Buddies" -msgstr "/_Buddys" - -msgid "/Buddies/New Instant _Message..." -msgstr "/Buddys/_Neue Sofortnachricht..." +msgid "_Buddies" +msgstr "_Buddys" -msgid "/Buddies/Join a _Chat..." -msgstr "/Buddys/Einen _Chat betreten..." +msgid "New Instant _Message..." +msgstr "_Neue Sofortnachricht..." -msgid "/Buddies/Get User _Info..." -msgstr "/Buddys/Benu_tzer-Info abrufen..." +msgid "Join a _Chat..." +msgstr "_Chat betreten..." -msgid "/Buddies/View User _Log..." -msgstr "/Buddys/Benutzer-_Mitschnitt ansehen..." +msgid "Get User _Info..." +msgstr "Benutzer-_Info abrufen..." -msgid "/Buddies/Sh_ow" -msgstr "/Buddys/_Anzeigen" +msgid "View User _Log..." +msgstr "Benutzer-_Mitschnitt anzeigen..." -msgid "/Buddies/Show/_Offline Buddies" -msgstr "/Buddys/Anzeigen/_Offline-Buddys" +msgid "Sh_ow" +msgstr "_Anzeigen" -msgid "/Buddies/Show/_Empty Groups" -msgstr "/Buddys/Anzeigen/_Leere Gruppen" +msgid "_Sort Buddies" +msgstr "Buddys _sortieren" -msgid "/Buddies/Show/Buddy _Details" -msgstr "/Buddys/Anzeigen/Buddy-_Details" +msgid "_Add Buddy..." +msgstr "_Buddy hinzufügen..." -msgid "/Buddies/Show/Idle _Times" -msgstr "/Buddys/Anzeigen/Untätigkeitszei_ten" +msgid "Add _Group..." +msgstr "_Gruppe hinzufügen..." -msgid "/Buddies/Show/_Protocol Icons" -msgstr "/Buddys/Anzeigen/_Protokoll-Icons" +msgid "_Quit" +msgstr "_Beenden" -msgid "/Buddies/_Sort Buddies" -msgstr "/Buddys/Buddys _sortieren" +#. Accounts menu +msgid "_Accounts" +msgstr "_Konten" -msgid "/Buddies/_Add Buddy..." -msgstr "/Buddys/B_uddy hinzufügen..." +msgid "Manage Accounts" +msgstr "Konten verwalten" -msgid "/Buddies/Add C_hat..." -msgstr "/Buddys/C_hat hinzufügen..." +#. Tools +msgid "_Tools" +msgstr "_Werkzeuge" -msgid "/Buddies/Add _Group..." -msgstr "/Buddys/_Gruppe hinzufügen..." +msgid "Buddy _Pounces" +msgstr "Buddy-_Alarm" -msgid "/Buddies/_Quit" -msgstr "/Buddys/_Beenden" +msgid "_Certificates" +msgstr "_Zertifikate" -#. Accounts menu -msgid "/_Accounts" -msgstr "/_Konten" +msgid "Custom Smile_ys" +msgstr "Benutzerdefinierte Smile_ys" -msgid "/Accounts/Manage Accounts" -msgstr "/Konten/Konten verwalten" +msgid "Plu_gins" +msgstr "_Plugins" -#. Tools -msgid "/_Tools" -msgstr "/_Werkzeuge" +msgid "Pr_eferences" +msgstr "_Einstellungen" -msgid "/Tools/Buddy _Pounces" -msgstr "/Werkzeuge/Buddy-_Alarm" +msgid "Pr_ivacy" +msgstr "Pri_vatsphäre" -msgid "/Tools/_Certificates" -msgstr "/Werkzeuge/_Zertifikate" +msgid "Set _Mood" +msgstr "Setze Sti_mmung" -msgid "/Tools/Custom Smile_ys" -msgstr "/Werkzeuge/Benutzerdefinierte Smile_ys" +msgid "_File Transfers" +msgstr "_Dateiübertragungen" -msgid "/Tools/Plu_gins" -msgstr "/Werkzeuge/Plu_gins" +#, fuzzy +msgid "R_oom List" +msgstr "Raumliste" -msgid "/Tools/Pr_eferences" -msgstr "/Werkzeuge/_Einstellungen" +#, fuzzy +msgid "System _Log" +msgstr "Systemmitschnitt" -msgid "/Tools/Pr_ivacy" -msgstr "/Werkzeuge/Pri_vatsphäre" +#. Help +msgid "_Help" +msgstr "_Hilfe" -msgid "/Tools/Set _Mood" -msgstr "/Werkzeuge/Setze Sti_mmung" +msgid "Online _Help" +msgstr "Online-_Hilfe" -msgid "/Tools/_File Transfers" -msgstr "/Werkzeuge/_Dateiübertragungen" +msgid "_Build Information" +msgstr "_Build-Informationen" -msgid "/Tools/R_oom List" -msgstr "/Werkzeuge/Chat_räume" +msgid "_Debug Window" +msgstr "_Debug-Fenster" -msgid "/Tools/System _Log" -msgstr "/Werkzeuge/_Systemmitschnitt" +msgid "De_veloper Information" +msgstr "_Entwickler-Informationen" -msgid "/Tools/Mute _Sounds" -msgstr "/Werkzeuge/S_tummschalten" +msgid "_Plugin Information" +msgstr "_Plugin-Informationen" -#. Help -msgid "/_Help" -msgstr "/_Hilfe" +msgid "_Translator Information" +msgstr "Ü_bersetzer-Informationen" -msgid "/Help/Online _Help" -msgstr "/Hilfe/Online-_Hilfe" +msgid "_About" +msgstr "Übe_r" -msgid "/Help/_Build Information" -msgstr "/Hilfe/_Build-Informationen" +#. Buddies->Show menu +msgid "_Offline Buddies" +msgstr "_Offline-Buddys" -msgid "/Help/_Debug Window" -msgstr "/Hilfe/_Debug-Fenster" +msgid "_Empty Groups" +msgstr "_Leere Gruppen" -msgid "/Help/De_veloper Information" -msgstr "/Hilfe/_Entwickler-Informationen" +msgid "Buddy _Details" +msgstr "Buddy-_Details" -msgid "/Help/_Plugin Information" -msgstr "/Hilfe/_Plugin-Informationen" +msgid "Idle _Times" +msgstr "Un_tätigkeitszeiten" -msgid "/Help/_Translator Information" -msgstr "/Hilfe/Über_setzer-Informationen" +msgid "_Protocol Icons" +msgstr "_Protokoll-Icons" -msgid "/Help/_About" -msgstr "/Hilfe/Übe_r" +#. Tools menu +msgid "Mute _Sounds" +msgstr "Stu_mmschalten" #, c-format msgid "Account: %s" @@ -11209,30 +11213,6 @@ msgstr "Untätig %dh %02dm" msgid "Idle %dm" msgstr "Untätig seit %dm" -msgid "/Buddies/New Instant Message..." -msgstr "/Buddys/Neue Sofortnachricht..." - -msgid "/Buddies/Join a Chat..." -msgstr "/Buddys/Chat betreten..." - -msgid "/Buddies/Get User Info..." -msgstr "/Buddys/Benutzer-Info abrufen..." - -msgid "/Buddies/Add Buddy..." -msgstr "/Buddys/Buddy hinzufügen..." - -msgid "/Buddies/Add Chat..." -msgstr "/Buddys/Chat hinzufügen..." - -msgid "/Buddies/Add Group..." -msgstr "/Buddys/Gruppe hinzufügen..." - -msgid "/Tools/Privacy" -msgstr "/Werkzeuge/Privatsphäre" - -msgid "/Tools/Room List" -msgstr "/Werkzeuge/Chaträume" - #, c-format msgid "%d unread message from %s\n" msgid_plural "%d unread messages from %s\n" @@ -11288,9 +11268,6 @@ msgstr "Passwort:" msgid "_Login" msgstr "_Anmelden" -msgid "/Accounts" -msgstr "/Konten" - #. Translators: Please maintain the use of -> and <- to refer to menu heirarchy #, c-format msgid "" @@ -11307,24 +11284,6 @@ msgstr "" "aktiviert haben, können Sie sich anmelden, Ihren Status setzen und mit Ihren " "Freunden reden." -#. set the Show Offline Buddies option. must be done -#. * after the treeview or faceprint gets mad. -Robot101 -#. -msgid "/Buddies/Show/Offline Buddies" -msgstr "/Buddys/Anzeigen/Offline-Buddys" - -msgid "/Buddies/Show/Empty Groups" -msgstr "/Buddys/Anzeigen/Leere Gruppen" - -msgid "/Buddies/Show/Buddy Details" -msgstr "/Buddys/Anzeigen/Buddy-Details" - -msgid "/Buddies/Show/Idle Times" -msgstr "/Buddys/Anzeigen/Untätigkeitszeiten" - -msgid "/Buddies/Show/Protocol Icons" -msgstr "/Buddys/Anzeigen/Protokoll-Icons" - msgid "Add a buddy.\n" msgstr "Einen Buddy hinzufügen.\n" @@ -11373,12 +11332,6 @@ msgstr "Bitte geben Sie den Namen der Gruppe ein, die hinzugefügt werden soll." msgid "Enable Account" msgstr "Konten aktivieren" -msgid "/Accounts/Enable Account" -msgstr "/Konten/Konto aktivieren" - -msgid "/Accounts/" -msgstr "/Konten/" - msgid "_Edit Account" msgstr "Konto _bearbeiten" @@ -11391,19 +11344,41 @@ msgstr "Keine Aktionen verfügbar" msgid "_Disable" msgstr "_Deaktivieren" -msgid "/Tools" -msgstr "/Werkzeuge" - -msgid "/Buddies/Sort Buddies" -msgstr "/Buddys/Buddys sortieren" - msgid "Type the host name for this certificate." msgstr "Geben Sie einen Hostnamen für dieses Zertifikat an." +#. Fire the notification +#, c-format +msgid "Certificate Information for %s" +msgstr "Zertifikat-Informationen für %s" + #. Widget creation function msgid "SSL Servers" msgstr "SSL-Server" +msgid "Unsafe debugging is now disabled." +msgstr "" + +msgid "Unsafe debugging is now enabled." +msgstr "" + +msgid "Verbose debugging is now disabled." +msgstr "" + +msgid "Verbose debugging is now enabled." +msgstr "" + +msgid "Supported debug options are: plugins version unsafe verbose" +msgstr "Unterstützte Debug-Optionen sind: plugins version unsafe verbose" + +msgid "" +"Use \"/help <command>\" for help on a specific command.
    The " +"following commands are available in this context:
    " +msgstr "" +"Benutzen Sie „/help <kommando>“, um Hilfe für ein bestimmtes Kommando " +"zu erhalten.
    Die folgenden Kommandos sind in diesem Kontext verfügbar:" +"
    " + msgid "Unknown command." msgstr "Unbekanntes Kommando." @@ -11438,9 +11413,6 @@ msgstr "Nicht Ignorieren" msgid "Ignore" msgstr "Ignorieren" -msgid "Get Away Message" -msgstr "Neue Abwesenheitsnachricht abholen" - msgid "Last Said" msgstr "Zuletzt gesagt" @@ -11469,171 +11441,93 @@ msgid "Show All" msgstr "Alle anzeigen" #. Conversation menu -msgid "/_Conversation" -msgstr "/_Unterhaltung" - -msgid "/Conversation/New Instant _Message..." -msgstr "/Unterhaltung/_Neue Sofortnachricht..." - -msgid "/Conversation/Join a _Chat..." -msgstr "/Unterhaltung/Einen Cha_t betreten..." - -msgid "/Conversation/_Find..." -msgstr "/Unterhaltung/_Finden..." - -msgid "/Conversation/View _Log" -msgstr "/Unterhaltung/_Mitschnitt anzeigen" - -msgid "/Conversation/_Save As..." -msgstr "/Unterhaltung/S_peichern als..." +msgid "_Conversation" +msgstr "_Unterhaltung" -msgid "/Conversation/Clea_r Scrollback" -msgstr "/Unterhaltung/_Leeren" - -msgid "/Conversation/M_edia" -msgstr "/Unterhaltung/M_edien" +#, fuzzy +msgid "_Find..." +msgstr "Suchen" -msgid "/Conversation/Media/_Audio Call" -msgstr "/Unterhaltung/Medien/_Audio-Anruf" +msgid "_Save As..." +msgstr "S_peichern unter..." -msgid "/Conversation/Media/_Video Call" -msgstr "/Unterhaltung/Medien/_Video-Anruf" +#, fuzzy +msgid "Clea_r Scrollback" +msgstr "Gesprächsfenster leeren" -msgid "/Conversation/Media/Audio\\/Video _Call" -msgstr "/Unterhaltung/Medien/A_udio-\\/Video-Anruf" +#, fuzzy +msgid "M_edia" +msgstr "_Medien" -msgid "/Conversation/Se_nd File..." -msgstr "/Unterhaltung/Datei _senden..." +#, fuzzy +msgid "Audio/Video _Call" +msgstr "Audio/_Video-Anruf" -msgid "/Conversation/Get _Attention" -msgstr "/Unterhaltung/_Aufmerksamkeit erregen" +#, fuzzy +msgid "Se_nd File..." +msgstr "_Datei versenden..." -msgid "/Conversation/Add Buddy _Pounce..." -msgstr "/Unterhaltung/_Buddy-Alarm hinzufügen..." +msgid "Get _Attention" +msgstr "_Aufmerksamkeit erregen" -msgid "/Conversation/_Get Info" -msgstr "/Unterhaltung/_Info abrufen" +msgid "_Get Info" +msgstr "_Info abrufen" -msgid "/Conversation/In_vite..." -msgstr "/Unterhaltung/_Einladen..." +#, fuzzy +msgid "In_vite..." +msgstr "Einladen..." -msgid "/Conversation/M_ore" -msgstr "/Unterhaltung/Me_hr" +msgid "M_ore" +msgstr "" -msgid "/Conversation/Al_ias..." -msgstr "/Unterhaltung/Al_ias..." +#, fuzzy +msgid "Al_ias..." +msgstr "_Alias..." -msgid "/Conversation/_Block..." -msgstr "/Unterhaltung/_Blockieren..." +#, fuzzy +msgid "_Block..." +msgstr "_Sperren" -msgid "/Conversation/_Unblock..." -msgstr "/Unterhaltung/_Entsperren..." +#, fuzzy +msgid "_Unblock..." +msgstr "Sperrung aufheben" -msgid "/Conversation/_Add..." -msgstr "/Unterhaltung/_Hinzufügen..." +msgid "_Add..." +msgstr "_Hinzufügen..." -msgid "/Conversation/_Remove..." -msgstr "/Unterhaltung/_Entfernen..." +#, fuzzy +msgid "_Remove..." +msgstr "E_ntfernen" -msgid "/Conversation/Insert Lin_k..." -msgstr "/Unterhaltung/Lin_k einfügen..." +#, fuzzy +msgid "Insert Lin_k..." +msgstr "Link einfügen" -msgid "/Conversation/Insert Imag_e..." -msgstr "/Unterhaltung/Bil_d einfügen..." +#, fuzzy +msgid "Insert Imag_e..." +msgstr "Bild einfügen" -msgid "/Conversation/_Close" -msgstr "/Unterhaltung/S_chließen" +#, fuzzy +msgid "_Close" +msgstr "Schließen" #. Options -msgid "/_Options" +#, fuzzy +msgid "_Options" msgstr "/_Optionen" -msgid "/Options/Enable _Logging" -msgstr "/Optionen/Schalte _Mitschnitt ein" +#, fuzzy +msgid "Enable _Logging" +msgstr "Mitschnitt aktivieren" -msgid "/Options/Enable _Sounds" -msgstr "/Optionen/Schalte _Klänge ein" +#, fuzzy +msgid "Enable _Sounds" +msgstr "Klänge aktivieren" -msgid "/Options/Show Formatting _Toolbars" +#, fuzzy +msgid "Show Formatting _Toolbars" msgstr "/Optionen/Zeige _Werkzeugleisten für Formatierung" -msgid "/Options/Show Ti_mestamps" -msgstr "/Optionen/Zeige _Zeitstempel" - -msgid "/Conversation/More" -msgstr "/Unterhaltung/Mehr" - -msgid "/Options" -msgstr "/Optionen" - -#. The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time -#. * the 'Conversation' menu pops up. -#. Make sure the 'Conversation -> More' menuitems are regenerated whenever -#. * the 'Conversation' menu pops up because the entries can change after the -#. * conversation is created. -msgid "/Conversation" -msgstr "/Unterhaltung" - -msgid "/Conversation/View Log" -msgstr "/Unterhaltung/Mitschnitt anzeigen" - -msgid "/Conversation/Media/Audio Call" -msgstr "/Unterhaltung/Medien/Audio-Anruf" - -msgid "/Conversation/Media/Video Call" -msgstr "/Unterhaltung/Medien/Video-Anruf" - -msgid "/Conversation/Media/Audio\\/Video Call" -msgstr "/Unterhaltung/Medien/Audio-\\/Video-Anruf" - -msgid "/Conversation/Send File..." -msgstr "/Unterhaltung/Datei senden ..." - -msgid "/Conversation/Get Attention" -msgstr "/Unterhaltung/Aufmerksamkeit erregen" - -msgid "/Conversation/Add Buddy Pounce..." -msgstr "/Unterhaltung/Buddy-Alarm hinzufügen..." - -msgid "/Conversation/Get Info" -msgstr "/Unterhaltung/Info abrufen" - -msgid "/Conversation/Invite..." -msgstr "/Unterhaltung/Einladen ..." - -msgid "/Conversation/Alias..." -msgstr "/Unterhaltung/Alias..." - -msgid "/Conversation/Block..." -msgstr "/Unterhaltung/Blockieren..." - -msgid "/Conversation/Unblock..." -msgstr "/Unterhaltung/Entsperren..." - -msgid "/Conversation/Add..." -msgstr "/Unterhaltung/Hinzufügen..." - -msgid "/Conversation/Remove..." -msgstr "/Unterhaltung/Entfernen..." - -msgid "/Conversation/Insert Link..." -msgstr "/Unterhaltung/Link einfügen..." - -msgid "/Conversation/Insert Image..." -msgstr "/Unterhaltung/Bild einfügen..." - -msgid "/Options/Enable Logging" -msgstr "/Optionen/Schalte Mitschnitt ein" - -msgid "/Options/Enable Sounds" -msgstr "/Optionen/Schalte Klänge ein" - -msgid "/Options/Show Formatting Toolbars" -msgstr "/Optionen/Zeige Werkzeugleisten für Formatierung" - -msgid "/Options/Show Timestamps" -msgstr "/Optionen/Zeige Zeitstempel" - msgid "User is typing..." msgstr "Benutzer tippt gerade..." @@ -12022,6 +11916,10 @@ msgstr "Albanisch" msgid "Serbian" msgstr "Serbisch" +#, fuzzy +msgid "Serbian Latin" +msgstr "Weißrussisch (Latin)" + msgid "Sinhala" msgstr "Singhalesisch" @@ -12070,14 +11968,14 @@ msgstr "Litauisch" msgid "T.M.Thanh and the Gnome-Vi Team" msgstr "T.M.Thanh und das Gnome-Vi Team" -#, c-format +#, fuzzy, c-format msgid "" -"%s is a messaging client based on libpurple which is capable of connecting " -"to multiple messaging services at once. %s is written in C using GTK+. %s " -"is released, and may be modified and redistributed, under the terms of the " -"GPL version 2 (or later). A copy of the GPL is distributed with %s. %s is " -"copyrighted by its contributors, a list of whom is also distributed with " -"%s. There is no warranty for %s.

    " +"

    %s is a messaging client based on libpurple which is capable of " +"connecting to multiple messaging services at once. %s is written in C using " +"GTK+. %s is released, and may be modified and redistributed, under the " +"terms of the GPL version 2 (or later). A copy of the GPL is distributed " +"with %s. %s is copyrighted by its contributors, a list of whom is also " +"distributed with %s. There is no warranty for %s.

    " msgstr "" "%s ist ein Nachrichtendienst, basierend auf libpurple, der die Verbindung zu " "mehreren Nachrichtendiensten gleichzeitig unterstützt. %s wird in C " @@ -12088,27 +11986,26 @@ msgstr "" "der Mitwirkenden wird mit %s ausgeliefert. Wir übernehmen keine Haftung für " "%s.

    " -#, c-format +#, fuzzy, c-format msgid "" -"Helpful Resources
    \tWebsite
    \tFrequently Asked Questions
    \tIRC " -"Channel: #pidgin on irc.freenode.net
    \tXMPP MUC: devel@conference.pidgin." -"im

    " +"

    Helpful Resources

    " msgstr "" "Hilfreiche Quellen
    \tWebseite
    \tHäufig gestellte Fragen (FAQ)
    " "\tIRC-Channel: #pidgin auf irc.freenode.net
    \tXMPP-MUC: devel@conference." "pidgin.im

    " -#, c-format +#, fuzzy, c-format msgid "" -"Help from other Pidgin users is available by " -"e-mailing support@pidgin.im
    This is a public mailing list! (archive)
    We can't help with third-party protocols or " -"plugins!
    This list's primary language is English. You are " -"welcome to post in another language, but the responses may be less helpful." -"
    " +"

    Help from other Pidgin users is available by e-mailing " +"%s.
    This is a public mailing " +"list! (archive)
    We can't help with third-" +"party protocols or plugins!
    This list's primary language is " +"English. You are welcome to post in another language, but " +"the responses may be less helpful.

    " msgstr "" "Hilfe von anderen Pidgin-Benutzern erhält man " "per E-Mail an support@pidgin.im
    Logged out.
    " -msgstr "Abgemeldet." +#, fuzzy +msgid "Logged out." +msgstr "Angemeldet" #. *< type #. *< ui_requirement @@ -14989,8 +14869,9 @@ msgstr "XMPP-Konsole" msgid "Account: " msgstr "Konto: " -msgid "Not connected to XMPP" -msgstr "Nicht mit XMPP verbunden" +#, fuzzy +msgid "Not connected to XMPP" +msgstr "Nicht mit dem Server verbunden" #. *< name #. *< version @@ -15003,6 +14884,20 @@ msgid "This plugin is useful for debugging XMPP servers or clients." msgstr "" "Dieses Plugin ist nützlich zur Fehlersuche in XMPP-Servern oder -Clients." +msgid "The installer is already running." +msgstr "Der Installer läuft schon." + +msgid "" +"An instance of Pidgin is currently running. Please exit Pidgin and try " +"again." +msgstr "" +"Eine Instanz von Pidgin läuft momentan schon. Beenden Sie Pidgin und " +"versuchen Sie es nochmal." + +#. "Next >" appears on a button on the License Page of the Installer +msgid "Next >" +msgstr "Weiter >" + #. $(^Name) is the current Version name (e.g. Pidgin 2.7.0). $_CLICK will become a translated version of "Click Next to continue." DO NOT translate the CLICK in $_CLICK. It will break the installer. msgid "" "$(^Name) is released under the GNU General Public License (GPL). The license " @@ -15011,84 +14906,65 @@ msgstr "" "$(^Name) wird unter der GNU General Public License (GPL) veröffentlicht. Die " "Lizenz dient hier nur der Information. $_CLICK" -#. Installer Subsection Detailed Description -msgid "A multi-platform GUI toolkit, used by Pidgin" -msgstr "Ein Multi-Plattform-GUI-Toolkit, verwendet von Pidgin" +#. Installer Subsection Text +msgid "Pidgin Instant Messaging Client (required)" +msgstr "Pidgin Instant Messaging Client (erforderlich)" -msgid "" -"An instance of Pidgin is currently running. Please exit Pidgin and try " -"again." -msgstr "" -"Eine Instanz von Pidgin läuft momentan schon. Beenden Sie Pidgin und " -"versuchen Sie es nochmal." +#. Installer Subsection Text +msgid "GTK+ Runtime (required if not present)" +msgstr "GTK+ Runtime-Umgebung (erforderlich, falls nicht vorhanden)" + +#. Installer Subsection Text +msgid "Shortcuts" +msgstr "Verknüpfungen" + +#. Installer Subsection Text +msgid "Desktop" +msgstr "Desktop" + +#. Installer Subsection Text +msgid "Start Menu" +msgstr "Startmenü" + +#. Installer Subsection Text +msgid "Localizations" +msgstr "Lokalisierungen" #. Installer Subsection Detailed Description msgid "Core Pidgin files and dlls" msgstr "Pidgin-Basisdateien und -DLLs" #. Installer Subsection Detailed Description -msgid "Create a Start Menu entry for Pidgin" -msgstr "Erstellt einen Eintrag für Pidgin im Startmenü" +msgid "Shortcuts for starting Pidgin" +msgstr "Verknüpfungen zum Starten von Pidgin" #. Installer Subsection Detailed Description msgid "Create a shortcut to Pidgin on the Desktop" msgstr "Erstellt eine Verknüpfung zu Pidgin auf dem Desktop" +#. Installer Subsection Detailed Description +msgid "Create a Start Menu entry for Pidgin" +msgstr "Erstellt einen Eintrag für Pidgin im Startmenü" + +#. Installer Subsection Detailed Description +msgid "A multi-platform GUI toolkit, used by Pidgin" +msgstr "Ein Multi-Plattform-GUI-Toolkit, verwendet von Pidgin" + #. Installer Subsection Text msgid "Debug Symbols (for reporting crashes)" msgstr "Debug-Symbole (zum Melden von Abstürzen)" -#. Installer Subsection Text -msgid "Desktop" -msgstr "Desktop" - -#. $R2 will display the URL that the GTK+ Runtime failed to download from -msgid "" -"Error Downloading the GTK+ Runtime ($R2).$\\rThis is required for Pidgin to " -"function; if retrying fails, you may need to use the 'Offline Installer' " -"from http://pidgin.im/download/windows/ ." -msgstr "" -"Fehler beim Herunterladen der GTK+ Runtime ($R2).$\\rDiese wird benötigt " -"damit Pidgin funktioniert; falls ein erneuter Versuch fehlschlägt, müssen " -"Sie vielleicht den 'Offline Installer' von http://pidgin.im/download/" -"windows/ benutzen." - -#. $R2 will display the URL that the Debug Symbols failed to download from -msgid "" -"Error Installing Debug Symbols ($R2).$\\rIf retrying fails, you may need to " -"use the 'Offline Installer' from http://pidgin.im/download/windows/ ." -msgstr "" -"Fehler beim Installieren der Debug-Symbole ($R2).$\\rFalls ein erneuter " -"Versuch fehlschlägt, müssen Sie vielleicht den 'Offline Installer' von " -"http://pidgin.im/download/windows/ benutzen." +#. Text displayed on Installer Finish Page +msgid "Visit the Pidgin Web Page" +msgstr "Besuchen Sie die Pidgin-Webseite" -#. $R3 will display the URL that the Dictionary failed to download from -#, no-c-format msgid "" -"Error Installing Spellchecking ($R3).$\\rIf retrying fails, manual " -"installation instructions are at: http://developer.pidgin.im/wiki/Installing" -"%20Pidgin#manual_win32_spellcheck_installation" +"Unable to uninstall the currently installed version of Pidgin. The new " +"version will be installed without removing the currently installed version." msgstr "" -"Fehler beim Installieren der Rechtschreibkontrolle ($R3).$\\rFalls ein " -"erneuter Versuch fehlschlägt, finden Sie Anweisungen zur manuellen " -"Installation unter: http://developer.pidgin.im/wiki/Installing" -"%20Pidgin#manual_win32_spellcheck_installation" - -#. Installer Subsection Text -msgid "GTK+ Runtime (required if not present)" -msgstr "GTK+ Runtime-Umgebung (erforderlich, falls nicht vorhanden)" - -#. Installer Subsection Text -msgid "Localizations" -msgstr "Lokalisierungen" - -#. "Next >" appears on a button on the License Page of the Installer -msgid "Next >" -msgstr "Weiter >" - -#. Installer Subsection Text -msgid "Pidgin Instant Messaging Client (required)" -msgstr "Pidgin Instant Messaging Client (erforderlich)" +"Die aktuell installierte Version von Pidgin kann nicht deinstalliert werden. " +"Die neue Version wird installiert, ohne dass die aktuell installierte " +"Version gelöscht wird." msgid "" "Pidgin requires a compatible GTK+ Runtime (which doesn't appear to be " @@ -15100,20 +14976,24 @@ msgstr "" "Runtime überspringen wollen?" #. Installer Subsection Text -msgid "Shortcuts" -msgstr "Verknüpfungen" - -#. Installer Subsection Detailed Description -msgid "Shortcuts for starting Pidgin" -msgstr "Verknüpfungen zum Starten von Pidgin" +msgid "URI Handlers" +msgstr "URI-Behandlung" #. Installer Subsection Text msgid "Spellchecking Support" msgstr "Unterstützung für Rechtschreibkontrolle" -#. Installer Subsection Text -msgid "Start Menu" -msgstr "Startmenü" +#. $R3 will display the URL that the Dictionary failed to download from +#, no-c-format +msgid "" +"Error Installing Spellchecking ($R3).$\\rIf retrying fails, manual " +"installation instructions are at: http://developer.pidgin.im/wiki/Installing" +"%20Pidgin#manual_win32_spellcheck_installation" +msgstr "" +"Fehler beim Installieren der Rechtschreibkontrolle ($R3).$\\rFalls ein " +"erneuter Versuch fehlschlägt, finden Sie Anweisungen zur manuellen " +"Installation unter: http://developer.pidgin.im/wiki/Installing" +"%20Pidgin#manual_win32_spellcheck_installation" #. Installer Subsection Detailed Description msgid "" @@ -15122,8 +15002,25 @@ msgstr "" "Unterstützung für Rechtschreibkontrolle. (Für die Installation ist eine " "Internet-Verbindung nötig)" -msgid "The installer is already running." -msgstr "Der Installer läuft schon." +#. $R2 will display the URL that the Debug Symbols failed to download from +msgid "" +"Error Installing Debug Symbols ($R2).$\\rIf retrying fails, you may need to " +"use the 'Offline Installer' from http://pidgin.im/download/windows/ ." +msgstr "" +"Fehler beim Installieren der Debug-Symbole ($R2).$\\rFalls ein erneuter " +"Versuch fehlschlägt, müssen Sie vielleicht den 'Offline Installer' von " +"http://pidgin.im/download/windows/ benutzen." + +#. $R2 will display the URL that the GTK+ Runtime failed to download from +msgid "" +"Error Downloading the GTK+ Runtime ($R2).$\\rThis is required for Pidgin to " +"function; if retrying fails, you may need to use the 'Offline Installer' " +"from http://pidgin.im/download/windows/ ." +msgstr "" +"Fehler beim Herunterladen der GTK+ Runtime ($R2).$\\rDiese wird benötigt " +"damit Pidgin funktioniert; falls ein erneuter Versuch fehlschlägt, müssen " +"Sie vielleicht den 'Offline Installer' von http://pidgin.im/download/" +"windows/ benutzen." msgid "" "The uninstaller could not find registry entries for Pidgin.$\\rIt is likely " @@ -15133,24 +15030,422 @@ msgstr "" "\\rEs ist wahrscheinlich, daß ein anderer Benutzer diese Anwendung " "installiert hat." -#. Installer Subsection Text -msgid "URI Handlers" -msgstr "URI-Behandlung" +msgid "You do not have permission to uninstall this application." +msgstr "Sie haben keine Berechtigung, diese Anwendung zu deinstallieren." -msgid "" -"Unable to uninstall the currently installed version of Pidgin. The new " -"version will be installed without removing the currently installed version." -msgstr "" -"Die aktuell installierte Version von Pidgin kann nicht deinstalliert werden. " -"Die neue Version wird installiert, ohne dass die aktuell installierte " -"Version gelöscht wird." +#~ msgid "" +#~ "%s encountered errors migrating your settings from %s to %s. Please " +#~ "investigate and complete the migration by hand. Please report this error " +#~ "at http://developer.pidgin.im" +#~ msgstr "" +#~ "%s ist beim Übertragen Ihrer Einstellungen von %s nach %s auf Fehler " +#~ "gestoßen. Bitte untersuchen Sie das Problem und vervollständigen Sie die " +#~ "Migration per Hand. Bitte melden Sie diesen Fehler auf http://developer." +#~ "pidgin.im" -#. Text displayed on Installer Finish Page -msgid "Visit the Pidgin Web Page" -msgstr "Besuchen Sie die Pidgin-Webseite" +#~ msgid "" +#~ "Common name: %s %s\n" +#~ "Fingerprint (SHA1): %s" +#~ msgstr "" +#~ "Allgemeiner Name (Common name:) %s %s\n" +#~ "Fingerabdruck (SHA1): %s" -msgid "You do not have permission to uninstall this application." -msgstr "Sie haben keine Berechtigung, diese Anwendung zu deinstallieren." +#~ msgid "_View Certificate..." +#~ msgstr "Ze_rtifikat ansehen..." + +#~ msgid "Gadu-Gadu User" +#~ msgstr "Gadu-Gadu-Benutzer" + +#~ msgid "Hidden Number" +#~ msgstr "Versteckte Nummer" + +#~ msgid "Password sent" +#~ msgstr "Passwort gesendet" + +#~ msgid "Orphans" +#~ msgstr "Waisen" + +#~ msgid "No server statistics available" +#~ msgstr "Keine Serverstatistik verfügbar" + +#~ msgid "Error during connecting to SILC Server" +#~ msgstr "Fehler beim Verbinden mit dem SILC-Server" + +#~ msgid "Failure: Version mismatch, upgrade your client" +#~ msgstr "Fehler: Unterschiedliche Version, aktualisieren Sie Ihren Client" + +#~ msgid "Failure: Remote does not trust/support your public key" +#~ msgstr "" +#~ "Fehler: Die entfernte Seite vertraut Ihrem öffentlichen Schlüssel nicht" + +#~ msgid "Failure: Remote does not support proposed KE group" +#~ msgstr "" +#~ "Fehler: Entferntes Programm unterstützt nicht die vorgeschlagen KE-Gruppe" + +#~ msgid "Failure: Remote does not support proposed cipher" +#~ msgstr "" +#~ "Fehler: Entferntes Programm unterstützt die vorgeschlagene Chiffre nicht" + +#~ msgid "Failure: Remote does not support proposed PKCS" +#~ msgstr "" +#~ "Fehler: Entferntes Programm unterstützt die vorgeschlagene PKCS nicht" + +#~ msgid "Failure: Remote does not support proposed hash function" +#~ msgstr "" +#~ "Fehler: Entferntes Programm unterstützt die vorgeschlagen Hashfunktion " +#~ "nicht" + +#~ msgid "Failure: Remote does not support proposed HMAC" +#~ msgstr "" +#~ "Fehler: Entferntes Programm unterstützt das vorgeschlagene HMAC nicht" + +#~ msgid "Failure: Incorrect signature" +#~ msgstr "Fehler: Falsche Signatur" + +#~ msgid "Failure: Invalid cookie" +#~ msgstr "Fehler: Ungültiger Cookie" + +#~ msgid "Failure: Authentication failed" +#~ msgstr "Fehler: Authentifizierung fehlgeschlagen" + +#~ msgid "Unable to initialize SILC Client connection" +#~ msgstr "SILC-Client-Verbindung konnte nicht hergestellt werden" + +#~ msgid "John Noname" +#~ msgstr "Max Mustermann" + +#~ msgid "Unable to load SILC key pair: %s" +#~ msgstr "SILC-Schlüsselpaar konnte nicht geladen werden: %s" + +#~ msgid "Unable to create connection" +#~ msgstr "Kann Verbindung nicht erstellen" + +#~ msgid "/Tools/Mute Sounds" +#~ msgstr "/Werkzeuge/Stummschalten" + +#~ msgid "/Buddies/New Instant _Message..." +#~ msgstr "/Buddys/_Neue Sofortnachricht..." + +#~ msgid "/Buddies/Join a _Chat..." +#~ msgstr "/Buddys/Einen _Chat betreten..." + +#~ msgid "/Buddies/Get User _Info..." +#~ msgstr "/Buddys/Benu_tzer-Info abrufen..." + +#~ msgid "/Buddies/View User _Log..." +#~ msgstr "/Buddys/Benutzer-_Mitschnitt ansehen..." + +#~ msgid "/Buddies/Sh_ow" +#~ msgstr "/Buddys/_Anzeigen" + +#~ msgid "/Buddies/Show/_Offline Buddies" +#~ msgstr "/Buddys/Anzeigen/_Offline-Buddys" + +#~ msgid "/Buddies/Show/_Empty Groups" +#~ msgstr "/Buddys/Anzeigen/_Leere Gruppen" + +#~ msgid "/Buddies/Show/Idle _Times" +#~ msgstr "/Buddys/Anzeigen/Untätigkeitszei_ten" + +#~ msgid "/Buddies/Show/_Protocol Icons" +#~ msgstr "/Buddys/Anzeigen/_Protokoll-Icons" + +#~ msgid "/Buddies/_Sort Buddies" +#~ msgstr "/Buddys/Buddys _sortieren" + +#~ msgid "/Buddies/_Add Buddy..." +#~ msgstr "/Buddys/B_uddy hinzufügen..." + +#~ msgid "/Buddies/Add C_hat..." +#~ msgstr "/Buddys/C_hat hinzufügen..." + +#~ msgid "/Buddies/Add _Group..." +#~ msgstr "/Buddys/_Gruppe hinzufügen..." + +#~ msgid "/Buddies/_Quit" +#~ msgstr "/Buddys/_Beenden" + +#~ msgid "/_Accounts" +#~ msgstr "/_Konten" + +#~ msgid "/Accounts/Manage Accounts" +#~ msgstr "/Konten/Konten verwalten" + +#~ msgid "/Tools/Buddy _Pounces" +#~ msgstr "/Werkzeuge/Buddy-_Alarm" + +#~ msgid "/Tools/_Certificates" +#~ msgstr "/Werkzeuge/_Zertifikate" + +#~ msgid "/Tools/Custom Smile_ys" +#~ msgstr "/Werkzeuge/Benutzerdefinierte Smile_ys" + +#~ msgid "/Tools/Plu_gins" +#~ msgstr "/Werkzeuge/Plu_gins" + +#~ msgid "/Tools/Pr_eferences" +#~ msgstr "/Werkzeuge/_Einstellungen" + +#~ msgid "/Tools/Pr_ivacy" +#~ msgstr "/Werkzeuge/Pri_vatsphäre" + +#~ msgid "/Tools/Set _Mood" +#~ msgstr "/Werkzeuge/Setze Sti_mmung" + +#~ msgid "/Tools/_File Transfers" +#~ msgstr "/Werkzeuge/_Dateiübertragungen" + +#~ msgid "/Tools/R_oom List" +#~ msgstr "/Werkzeuge/Chat_räume" + +#~ msgid "/Tools/System _Log" +#~ msgstr "/Werkzeuge/_Systemmitschnitt" + +#~ msgid "/Tools/Mute _Sounds" +#~ msgstr "/Werkzeuge/S_tummschalten" + +#~ msgid "/Help/_Build Information" +#~ msgstr "/Hilfe/_Build-Informationen" + +#~ msgid "/Help/_Debug Window" +#~ msgstr "/Hilfe/_Debug-Fenster" + +#~ msgid "/Help/De_veloper Information" +#~ msgstr "/Hilfe/_Entwickler-Informationen" + +#~ msgid "/Help/_Plugin Information" +#~ msgstr "/Hilfe/_Plugin-Informationen" + +#~ msgid "/Help/_Translator Information" +#~ msgstr "/Hilfe/Über_setzer-Informationen" + +#~ msgid "/Help/_About" +#~ msgstr "/Hilfe/Übe_r" + +#~ msgid "/Buddies/New Instant Message..." +#~ msgstr "/Buddys/Neue Sofortnachricht..." + +#~ msgid "/Buddies/Join a Chat..." +#~ msgstr "/Buddys/Chat betreten..." + +#~ msgid "/Buddies/Get User Info..." +#~ msgstr "/Buddys/Benutzer-Info abrufen..." + +#~ msgid "/Buddies/Add Buddy..." +#~ msgstr "/Buddys/Buddy hinzufügen..." + +#~ msgid "/Buddies/Add Chat..." +#~ msgstr "/Buddys/Chat hinzufügen..." + +#~ msgid "/Buddies/Add Group..." +#~ msgstr "/Buddys/Gruppe hinzufügen..." + +#~ msgid "/Tools/Privacy" +#~ msgstr "/Werkzeuge/Privatsphäre" + +#~ msgid "/Tools/Room List" +#~ msgstr "/Werkzeuge/Chaträume" + +#~ msgid "/Accounts" +#~ msgstr "/Konten" + +#~ msgid "/Buddies/Show/Offline Buddies" +#~ msgstr "/Buddys/Anzeigen/Offline-Buddys" + +#~ msgid "/Buddies/Show/Empty Groups" +#~ msgstr "/Buddys/Anzeigen/Leere Gruppen" + +#~ msgid "/Buddies/Show/Buddy Details" +#~ msgstr "/Buddys/Anzeigen/Buddy-Details" + +#~ msgid "/Buddies/Show/Idle Times" +#~ msgstr "/Buddys/Anzeigen/Untätigkeitszeiten" + +#~ msgid "/Buddies/Show/Protocol Icons" +#~ msgstr "/Buddys/Anzeigen/Protokoll-Icons" + +#~ msgid "/Accounts/Enable Account" +#~ msgstr "/Konten/Konto aktivieren" + +#~ msgid "/Accounts/" +#~ msgstr "/Konten/" + +#~ msgid "/Tools" +#~ msgstr "/Werkzeuge" + +#~ msgid "/Buddies/Sort Buddies" +#~ msgstr "/Buddys/Buddys sortieren" + +#~ msgid "Get Away Message" +#~ msgstr "Neue Abwesenheitsnachricht abholen" + +#~ msgid "/Conversation/New Instant _Message..." +#~ msgstr "/Unterhaltung/_Neue Sofortnachricht..." + +#~ msgid "/Conversation/Join a _Chat..." +#~ msgstr "/Unterhaltung/Einen Cha_t betreten..." + +#~ msgid "/Conversation/_Find..." +#~ msgstr "/Unterhaltung/_Finden..." + +#~ msgid "/Conversation/View _Log" +#~ msgstr "/Unterhaltung/_Mitschnitt anzeigen" + +#~ msgid "/Conversation/_Save As..." +#~ msgstr "/Unterhaltung/S_peichern als..." + +#~ msgid "/Conversation/Clea_r Scrollback" +#~ msgstr "/Unterhaltung/_Leeren" + +#~ msgid "/Conversation/M_edia" +#~ msgstr "/Unterhaltung/M_edien" + +#~ msgid "/Conversation/Media/_Audio Call" +#~ msgstr "/Unterhaltung/Medien/_Audio-Anruf" + +#~ msgid "/Conversation/Media/_Video Call" +#~ msgstr "/Unterhaltung/Medien/_Video-Anruf" + +#~ msgid "/Conversation/Media/Audio\\/Video _Call" +#~ msgstr "/Unterhaltung/Medien/A_udio-\\/Video-Anruf" + +#~ msgid "/Conversation/Se_nd File..." +#~ msgstr "/Unterhaltung/Datei _senden..." + +#~ msgid "/Conversation/Get _Attention" +#~ msgstr "/Unterhaltung/_Aufmerksamkeit erregen" + +#~ msgid "/Conversation/Add Buddy _Pounce..." +#~ msgstr "/Unterhaltung/_Buddy-Alarm hinzufügen..." + +#~ msgid "/Conversation/_Get Info" +#~ msgstr "/Unterhaltung/_Info abrufen" + +#~ msgid "/Conversation/In_vite..." +#~ msgstr "/Unterhaltung/_Einladen..." + +#~ msgid "/Conversation/M_ore" +#~ msgstr "/Unterhaltung/Me_hr" + +#~ msgid "/Conversation/Al_ias..." +#~ msgstr "/Unterhaltung/Al_ias..." + +#~ msgid "/Conversation/_Block..." +#~ msgstr "/Unterhaltung/_Blockieren..." + +#~ msgid "/Conversation/_Unblock..." +#~ msgstr "/Unterhaltung/_Entsperren..." + +#~ msgid "/Conversation/_Add..." +#~ msgstr "/Unterhaltung/_Hinzufügen..." + +#~ msgid "/Conversation/_Remove..." +#~ msgstr "/Unterhaltung/_Entfernen..." + +#~ msgid "/Conversation/Insert Lin_k..." +#~ msgstr "/Unterhaltung/Lin_k einfügen..." + +#~ msgid "/Conversation/Insert Imag_e..." +#~ msgstr "/Unterhaltung/Bil_d einfügen..." + +#~ msgid "/Conversation/_Close" +#~ msgstr "/Unterhaltung/S_chließen" + +#~ msgid "/Options/Enable _Logging" +#~ msgstr "/Optionen/Schalte _Mitschnitt ein" + +#~ msgid "/Options/Enable _Sounds" +#~ msgstr "/Optionen/Schalte _Klänge ein" + +#~ msgid "/Options/Show Ti_mestamps" +#~ msgstr "/Optionen/Zeige _Zeitstempel" + +#~ msgid "/Conversation/More" +#~ msgstr "/Unterhaltung/Mehr" + +#~ msgid "/Options" +#~ msgstr "/Optionen" + +#~ msgid "/Conversation" +#~ msgstr "/Unterhaltung" + +#~ msgid "/Conversation/View Log" +#~ msgstr "/Unterhaltung/Mitschnitt anzeigen" + +#~ msgid "/Conversation/Media/Audio Call" +#~ msgstr "/Unterhaltung/Medien/Audio-Anruf" + +#~ msgid "/Conversation/Media/Video Call" +#~ msgstr "/Unterhaltung/Medien/Video-Anruf" + +#~ msgid "/Conversation/Media/Audio\\/Video Call" +#~ msgstr "/Unterhaltung/Medien/Audio-\\/Video-Anruf" + +#~ msgid "/Conversation/Send File..." +#~ msgstr "/Unterhaltung/Datei senden ..." + +#~ msgid "/Conversation/Get Attention" +#~ msgstr "/Unterhaltung/Aufmerksamkeit erregen" + +#~ msgid "/Conversation/Add Buddy Pounce..." +#~ msgstr "/Unterhaltung/Buddy-Alarm hinzufügen..." + +#~ msgid "/Conversation/Get Info" +#~ msgstr "/Unterhaltung/Info abrufen" + +#~ msgid "/Conversation/Invite..." +#~ msgstr "/Unterhaltung/Einladen ..." + +#~ msgid "/Conversation/Alias..." +#~ msgstr "/Unterhaltung/Alias..." + +#~ msgid "/Conversation/Block..." +#~ msgstr "/Unterhaltung/Blockieren..." + +#~ msgid "/Conversation/Unblock..." +#~ msgstr "/Unterhaltung/Entsperren..." + +#~ msgid "/Conversation/Add..." +#~ msgstr "/Unterhaltung/Hinzufügen..." + +#~ msgid "/Conversation/Remove..." +#~ msgstr "/Unterhaltung/Entfernen..." + +#~ msgid "/Conversation/Insert Link..." +#~ msgstr "/Unterhaltung/Link einfügen..." + +#~ msgid "/Conversation/Insert Image..." +#~ msgstr "/Unterhaltung/Bild einfügen..." + +#~ msgid "/Options/Enable Logging" +#~ msgstr "/Optionen/Schalte Mitschnitt ein" + +#~ msgid "/Options/Enable Sounds" +#~ msgstr "/Optionen/Schalte Klänge ein" + +#~ msgid "/Options/Show Formatting Toolbars" +#~ msgstr "/Optionen/Zeige Werkzeugleisten für Formatierung" + +#~ msgid "/Options/Show Timestamps" +#~ msgstr "/Optionen/Zeige Zeitstempel" + +#~ msgid "Alias Contact" +#~ msgstr "Kontakt-Alias" + +#~ msgid "Enter an alias for this contact." +#~ msgstr "Geben Sie einen Alias für diesen Kontakt ein." + +#~ msgid "Google Talk" +#~ msgstr "Google Talk" + +#~ msgid "Facebook (XMPP)" +#~ msgstr "Facebook (XMPP)" + +#~ msgid "Logged out." +#~ msgstr "Abgemeldet." + +#~ msgid "Not connected to XMPP" +#~ msgstr "Nicht mit XMPP verbunden" #~ msgid "No Sametime Community Server specified" #~ msgstr "Kein Sametime-Community Server angegeben" -- cgit v1.2.1 -- cgit v1.2.1 From d5f51cae05f10f0b91b381d922d64c50fa42035a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 14 Jun 2012 18:31:26 -0400 Subject: Update list of ignored files. Monotone apparently ignores quite a few files by default, that Mercurial does not. --- .hgignore | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.hgignore b/.hgignore index f74dbe05a3..c5d3979e0e 100644 --- a/.hgignore +++ b/.hgignore @@ -7,15 +7,30 @@ syntax: regexp .*/perl/common/[^/]+\.c$ .*/perl/common/blib.* .*/perl/common/pm_to_blib$ +.*~$ +.*\.a$ +.*\.bak$ .*\.bs$ .*\.def$ +\.deps .*\.dll$ .*\.exe$ +.*\.g?mo$ +.*\.la$ +\.libs +.*\.lo$ .*\.loT$ +.*\.o$ +.*\.orig$ +.*\.pyc$ +.*\.pyo$ +.*\.rej$ +.*\.so$ Doxyfile(\.mingw)?$ VERSION$ aclocal.m4 autogen.args +autom4te.*\.cache compile config.cache config.guess -- cgit v1.2.1 From 2f8bf46a2cb373ca29af7be8ae178248f4b9f7ef Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 15 Jun 2012 00:23:44 -0400 Subject: Do some proper parsing of UTS-35 date formats. This doesn't totally replace everything yet, but it should at least parse everything. --- libpurple/util.c | 359 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ libpurple/util.h | 13 ++ pidgin/gtkconv.c | 39 +++--- 3 files changed, 394 insertions(+), 17 deletions(-) diff --git a/libpurple/util.c b/libpurple/util.c index f513f6790b..600f57d173 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -929,6 +929,365 @@ purple_str_to_time(const char *timestamp, gboolean utc, return retval; } +char * +purple_uts35_to_str(const char *format, size_t len, struct tm *tm) +{ + GString *string; + int i, count; + + if (tm == NULL) { + time_t now = time(NULL); + tm = localtime(&now); + } + + string = g_string_sized_new(len); + i = 0; + while (i < len) { + count = 1; + while ((i + count) < len && format[i] == format[i+count]) + count++; + + switch (format[i]) { + /* Era Designator */ + case 'G': + if (count <= 3) { + /* Abbreviated */ + } else if (count == 4) { + /* Full */ + } else if (count >= 5) { + /* Narrow */ + count = 5; + } + break; + + + /* Year */ + case 'y': + if (count == 2) { + /* Two-digits only */ + g_string_append(string, purple_utf8_strftime("%y", tm)); + } else { + /* Zero-padding */ + char *tmp = g_strdup_printf("%%0%dY", count); + g_string_append(string, purple_utf8_strftime(tmp, tm)); + g_free(tmp); + } + break; + + /* Year (in "Week of Year" based calendars) */ + case 'Y': + if (count == 2) { + /* Two-digits only */ + } else { + /* Zero-padding */ + } + break; + + /* Extended Year */ + case 'u': + break; + + /* Cyclic Year Name */ + case 'U': + if (count <= 3) { + /* Abbreviated */ + } else if (count == 4) { + /* Full */ + } else if (count >= 5) { + /* Narrow */ + count = 5; + } + break; + + + /* Quarter */ + case 'Q': + if (count <= 2) { + /* Numerical */ + } else if (count == 3) { + /* Abbreviation */ + } else if (count >= 4) { + /* Full */ + count = 4; + } + break; + + /* Stand-alone Quarter */ + case 'q': + if (count <= 2) { + /* Numerical */ + } else if (count == 3) { + /* Abbreviation */ + } else if (count >= 4) { + /* Full */ + count = 4; + } + break; + + /* Month */ + case 'M': + if (count <= 2) { + /* Numerical */ + g_string_append(string, purple_utf8_strftime("%m", tm)); + } else if (count == 3) { + /* Abbreviation */ + g_string_append(string, purple_utf8_strftime("%b", tm)); + } else if (count == 4) { + /* Full */ + g_string_append(string, purple_utf8_strftime("%B", tm)); + } else if (count >= 5) { + g_string_append_len(string, purple_utf8_strftime("%b", tm), 1); + count = 5; + } + break; + + /* Stand-alone Month */ + case 'L': + if (count <= 2) { + /* Numerical */ + g_string_append(string, purple_utf8_strftime("%m", tm)); + } else if (count == 3) { + /* Abbreviation */ + g_string_append(string, purple_utf8_strftime("%b", tm)); + } else if (count == 4) { + /* Full */ + g_string_append(string, purple_utf8_strftime("%B", tm)); + } else if (count >= 5) { + g_string_append_len(string, purple_utf8_strftime("%b", tm), 1); + count = 5; + } + break; + + /* Ignored */ + case 'l': + break; + + + /* Week of Year */ + case 'w': + g_string_append(string, purple_utf8_strftime("%W", tm)); + count = MIN(count, 2); + break; + + /* Week of Month */ + case 'W': + count = 1; + break; + + + /* Day of Month */ + case 'd': + g_string_append(string, purple_utf8_strftime("%d", tm)); + count = MIN(count, 2); + break; + + /* Day of Year */ + case 'D': + g_string_append(string, purple_utf8_strftime("%j", tm)); + count = MIN(count, 3); + break; + + /* Day of Year in Month */ + case 'F': + count = 1; + break; + + /* Modified Julian Day */ + case 'g': + break; + + + /* Day of Week */ + case 'E': + if (count <= 3) { + /* Short */ + g_string_append(string, purple_utf8_strftime("%a", tm)); + } else if (count == 4) { + /* Full */ + g_string_append(string, purple_utf8_strftime("%A", tm)); + } else if (count >= 5) { + /* Narrow */ + g_string_append_len(string, purple_utf8_strftime("%a", tm), 1); + count = 5; + } + break; + + /* Local Day of Week */ + case 'e': + if (count <= 2) { + /* Numeric */ + g_string_append(string, purple_utf8_strftime("%u", tm)); + } else if (count == 3) { + /* Short */ + g_string_append(string, purple_utf8_strftime("%a", tm)); + } else if (count == 4) { + /* Full */ + g_string_append(string, purple_utf8_strftime("%A", tm)); + } else if (count >= 5) { + /* Narrow */ + g_string_append_len(string, purple_utf8_strftime("%a", tm), 1); + count = 5; + } + break; + + /* Stand-alone Local Day of Week */ + case 'c': + if (count <= 2) { + /* Numeric */ + g_string_append(string, purple_utf8_strftime("%u", tm)); + count = 1; + } else if (count == 3) { + /* Short */ + g_string_append(string, purple_utf8_strftime("%a", tm)); + } else if (count == 4) { + /* Full */ + g_string_append(string, purple_utf8_strftime("%A", tm)); + } else if (count >= 5) { + /* Narrow */ + g_string_append_len(string, purple_utf8_strftime("%a", tm), 1); + count = 5; + } + break; + + + /* AM/PM */ + case 'a': + g_string_append(string, purple_utf8_strftime("%p", tm)); + break; + + + /* Hour (1-12) */ + case 'h': + if (count == 1) { + /* No padding */ + g_string_append(string, purple_utf8_strftime("%I", tm)); + } else if (count >= 2) { + /* Zero-padded */ + g_string_append(string, purple_utf8_strftime("%I", tm)); + count = 2; + } + break; + + /* Hour (0-23) */ + case 'H': + if (count == 1) { + /* No padding */ + g_string_append(string, purple_utf8_strftime("%H", tm)); + } else if (count >= 2) { + /* Zero-padded */ + g_string_append(string, purple_utf8_strftime("%H", tm)); + count = 2; + } + break; + + /* Hour (0-11) */ + case 'K': + if (count == 1) { + /* No padding */ + } else if (count >= 2) { + /* Zero-padded */ + count = 2; + } + break; + + /* Hour (1-24) */ + case 'k': + if (count == 1) { + /* No padding */ + } else if (count >= 2) { + /* Zero-padded */ + count = 2; + } + break; + + /* Hour (hHkK by locale) */ + case 'j': + break; + + + /* Minute */ + case 'm': + g_string_append(string, purple_utf8_strftime("%M", tm)); + count = MIN(count, 2); + break; + + + /* Second */ + case 's': + g_string_append(string, purple_utf8_strftime("%S", tm)); + count = MIN(count, 2); + break; + + /* Fractional Sub-second */ + case 'S': + break; + + /* Millisecond */ + case 'A': + break; + + + /* Time Zone (specific non-location format) */ + case 'z': + if (count <= 3) { + /* Short */ + } else if (count >= 4) { + /* Full */ + count = 4; + } + break; + + /* Time Zone */ + case 'Z': + if (count <= 3) { + /* RFC822 */ + g_string_append(string, purple_utf8_strftime("%z", tm)); + } else if (count == 4) { + /* Localized GMT */ + } else if (count >= 5) { + /* ISO8601 */ + g_string_append(string, purple_utf8_strftime("%z", tm)); + count = 5; + } + break; + + /* Time Zone (generic non-location format) */ + case 'v': + if (count <= 3) { + /* Short */ + g_string_append(string, purple_utf8_strftime("%Z", tm)); + count = 1; + } else if (count >= 4) { + /* Long */ + g_string_append(string, purple_utf8_strftime("%Z", tm)); + count = 4; + } + break; + + /* Time Zone */ + case 'V': + if (count <= 3) { + /* Same as z */ + count = 1; + } else if (count >= 4) { + /* Generic Location Format) */ + g_string_append(string, purple_utf8_strftime("%Z", tm)); + count = 4; + } + break; + + + default: + g_string_append_len(string, format + i, count); + break; + } + + i += count; + } + + return g_string_free(string, FALSE); +} + /************************************************************************** * Markup Functions **************************************************************************/ diff --git a/libpurple/util.h b/libpurple/util.h index cb39e6529a..e092d62369 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -470,6 +470,19 @@ time_t purple_time_build(int year, int month, int day, int hour, time_t purple_str_to_time(const char *timestamp, gboolean utc, struct tm *tm, long *tz_off, const char **rest); +/** + * Formats a datetime according to a UTS-35 Date Format Pattern. + * + * @param format The formatting string, according to UTS #35 + * See http://unicode.org/reports/tr35/ + * (NOTE: not all formats are supported) + * @param len The length of the formatting string + * @param tm The time to format, or @c NULL to use the current local time + * + * @return The time, formatted as per the user's settings. + */ +char *purple_uts35_to_str(const char *format, size_t len, struct tm *tm); + /*@}*/ diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 2d31103555..5b23ffd50f 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -5088,6 +5088,7 @@ replace_header_tokens(PurpleConversation *conv, const char *text) str = g_string_new(NULL); while ((cur = strchr(cur, '%'))) { + char *freeval = NULL; const char *replace = NULL; const char *fin = NULL; @@ -5117,7 +5118,6 @@ replace_header_tokens(PurpleConversation *conv, const char *text) } else if (g_str_has_prefix(cur, "%timeOpened")) { const char *tmp = cur + strlen("%timeOpened"); - char *format = NULL; if (*tmp == '{') { const char *end; @@ -5125,18 +5125,21 @@ replace_header_tokens(PurpleConversation *conv, const char *text) end = strstr(tmp, "}%"); if (!end) /* Invalid string */ continue; - format = g_strndup(tmp, end - tmp); + if (!tm) { + mtime = time(NULL); + tm = localtime(&mtime); + } + replace = freeval = purple_uts35_to_str(tmp, end - tmp, tm); fin = end + 1; - } + } else { + if (!tm) { + mtime = time(NULL); + tm = localtime(&mtime); + } - if (!tm) { - mtime = time(NULL); - tm = localtime(&mtime); + replace = purple_utf8_strftime("%X", tm); } - replace = purple_utf8_strftime(format ? format : "%X", tm); - g_free(format); - } else if (g_str_has_prefix(cur, "%dateOpened%")) { if (!tm) { mtime = time(NULL); @@ -5161,6 +5164,8 @@ replace_header_tokens(PurpleConversation *conv, const char *text) } else { prev = cur = strchr(cur + 1, '%') + 1; } + g_free(freeval); + freeval = NULL; } /* And wrap it up */ @@ -6190,7 +6195,6 @@ replace_message_tokens( } else if (g_str_has_prefix(cur, "%time")) { const char *tmp = cur + strlen("%time"); - char *format = NULL; if (*tmp == '{') { char *end; @@ -6198,15 +6202,16 @@ replace_message_tokens( end = strstr(tmp, "}%"); if (!end) /* Invalid string */ continue; - format = g_strndup(tmp, end - tmp); + if (!tm) + tm = localtime(&mtime); + replace = freeval = purple_uts35_to_str(tmp, end - tmp, tm); fin = end + 1; - } - - if (!tm) - tm = localtime(&mtime); + } else { + if (!tm) + tm = localtime(&mtime); - replace = purple_utf8_strftime(format ? format : "%X", tm); - g_free(format); + replace = purple_utf8_strftime("%X", tm); + } } else if (g_str_has_prefix(cur, "%shortTime%")) { if (!tm) -- cgit v1.2.1 From 56fdb1b3a949750cffb3f240b4c7d7923e3d1610 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 15 Jun 2012 00:59:46 -0400 Subject: From now on, prpls must specify images using SRC instead of ID. This only fixes libpurple, the UI side doesn't follow this change just yet. --- libpurple/ft.c | 3 ++- libpurple/imgstore.h | 2 ++ libpurple/protocols/jabber/buddy.c | 3 ++- libpurple/protocols/msn/switchboard.c | 3 ++- libpurple/protocols/mxit/formcmds.c | 6 +++--- libpurple/protocols/mxit/markup.c | 10 ++++++---- libpurple/protocols/mxit/profile.c | 3 ++- libpurple/protocols/mxit/splashscreen.c | 3 ++- libpurple/protocols/oscar/odc.c | 4 +++- libpurple/protocols/oscar/oscar.c | 6 ++++-- libpurple/protocols/sametime/sametime.c | 2 +- libpurple/protocols/silc/ops.c | 4 +++- libpurple/protocols/yahoo/yahoo_profile.c | 3 ++- 13 files changed, 34 insertions(+), 18 deletions(-) diff --git a/libpurple/ft.c b/libpurple/ft.c index a7a3e09967..f7f90c214f 100644 --- a/libpurple/ft.c +++ b/libpurple/ft.c @@ -306,7 +306,8 @@ purple_xfer_conversation_write_internal(PurpleXfer *xfer, int id = purple_imgstore_add_with_id(data, size, NULL); message_with_img = - g_strdup_printf(" %s", id, escaped); + g_strdup_printf(" %s", + id, escaped); purple_conversation_write(conv, NULL, message_with_img, flags, time(NULL)); purple_imgstore_unref_by_id(id); diff --git a/libpurple/imgstore.h b/libpurple/imgstore.h index 75e5fdb358..4c0aabbafd 100644 --- a/libpurple/imgstore.h +++ b/libpurple/imgstore.h @@ -29,6 +29,8 @@ #include +#define PURPLE_STORED_IMAGE_PROTOCOL "purple-image:" + /** A reference-counted immutable wrapper around an image's data and its * filename. */ diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c index 374eba2eb2..1aa5cb4702 100644 --- a/libpurple/protocols/jabber/buddy.c +++ b/libpurple/protocols/jabber/buddy.c @@ -1204,7 +1204,8 @@ static void jabber_vcard_parse(JabberStream *js, const char *from, char *hash; jbi->vcard_imgids = g_slist_prepend(jbi->vcard_imgids, GINT_TO_POINTER(purple_imgstore_add_with_id(g_memdup(data, size), size, "logo.png"))); - img_text = g_strdup_printf("", GPOINTER_TO_INT(jbi->vcard_imgids->data)); + img_text = g_strdup_printf("", + GPOINTER_TO_INT(jbi->vcard_imgids->data)); purple_notify_user_info_add_pair_html(user_info, (photo ? _("Photo") : _("Logo")), img_text); diff --git a/libpurple/protocols/msn/switchboard.c b/libpurple/protocols/msn/switchboard.c index 2cd3388466..96cb269889 100644 --- a/libpurple/protocols/msn/switchboard.c +++ b/libpurple/protocols/msn/switchboard.c @@ -828,7 +828,8 @@ msn_switchboard_show_ink(MsnSwitchBoard *swboard, const char *passport, } imgid = purple_imgstore_add_with_id(image_data, image_len, NULL); - image_msg = g_strdup_printf("", imgid); + image_msg = g_strdup_printf("", + imgid); if (swboard->current_users > 1 || ((swboard->conv != NULL) && diff --git a/libpurple/protocols/mxit/formcmds.c b/libpurple/protocols/mxit/formcmds.c index f14dbbd2b5..d387313988 100644 --- a/libpurple/protocols/mxit/formcmds.c +++ b/libpurple/protocols/mxit/formcmds.c @@ -327,7 +327,6 @@ static void command_image(struct RXMsgData* mx, GHashTable* hash, GString* msg) const char* img; const char* reply; guchar* rawimg; - char link[256]; gsize rawimglen; int imgid; @@ -336,8 +335,9 @@ static void command_image(struct RXMsgData* mx, GHashTable* hash, GString* msg) rawimg = purple_base64_decode(img, &rawimglen); //purple_util_write_data_to_file_absolute("/tmp/mxitinline.png", (char*) rawimg, rawimglen); imgid = purple_imgstore_add_with_id(rawimg, rawimglen, NULL); - g_snprintf(link, sizeof(link), "", imgid); - g_string_append_printf(msg, "%s", link); + g_string_append_printf(msg, + "", + imgid); mx->flags |= PURPLE_MESSAGE_IMAGES; } else { diff --git a/libpurple/protocols/mxit/markup.c b/libpurple/protocols/mxit/markup.c index f209b42a14..908b5a43e3 100644 --- a/libpurple/protocols/mxit/markup.c +++ b/libpurple/protocols/mxit/markup.c @@ -403,7 +403,9 @@ void mxit_show_message( struct RXMsgData* mx ) } else { /* insert img tag */ - g_snprintf( tag, sizeof( tag ), "", *img_id ); + g_snprintf( tag, sizeof( tag ), + "", + *img_id ); g_string_insert( mx->msg, start, tag ); } } @@ -1066,7 +1068,7 @@ char* mxit_convert_markup_tx( const char* message, int* msgtype ) * Font colour: ... * Links: ... * Newline:
    - * Inline image: + * Inline image: * The following characters are also encoded: * & " < > */ @@ -1133,11 +1135,11 @@ char* mxit_convert_markup_tx( const char* message, int* msgtype ) g_free( tag ); } } - else if ( purple_str_has_prefix( &message[i], "imgid ) { /* this invite has a avatar */ char* img_text; - img_text = g_strdup_printf( "", contact->imgid ); + img_text = g_strdup_printf( "", + contact->imgid ); purple_notify_user_info_add_pair_html( info, _( "Photo" ), img_text ); g_free(img_text); } diff --git a/libpurple/protocols/mxit/splashscreen.c b/libpurple/protocols/mxit/splashscreen.c index d7e9c04fb6..4a49ad20f7 100644 --- a/libpurple/protocols/mxit/splashscreen.c +++ b/libpurple/protocols/mxit/splashscreen.c @@ -187,7 +187,8 @@ void splash_display(struct MXitSession* session) imgid = purple_imgstore_add_with_id(g_memdup(imgdata, imglen), imglen, NULL); /* Generate and display message */ - g_snprintf(buf, sizeof(buf), "", imgid); + g_snprintf(buf, sizeof(buf), + "", imgid); /* Open a request-type popup to display the image */ { diff --git a/libpurple/protocols/oscar/odc.c b/libpurple/protocols/oscar/odc.c index b62de581d9..77bae6acec 100644 --- a/libpurple/protocols/oscar/odc.c +++ b/libpurple/protocols/oscar/odc.c @@ -376,7 +376,9 @@ peer_odc_handle_payload(PeerConnection *conn, const char *msg, size_t len, int e if (imgid != 0) { /* Write the new image tag */ - g_string_append_printf(newmsg, "", imgid); + g_string_append_printf(newmsg, + "", + imgid); } /* Continue from the end of the tag */ diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index 3777a546db..61facc8aea 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -3186,10 +3186,12 @@ purple_odc_send_im(PeerConnection *conn, const char *message, PurpleMessageFlags g_string_append_len(msg, last, start - last); } - id = g_datalist_get_data(&attribs, "id"); + id = g_datalist_get_data(&attribs, "src"); /* ... if it refers to a valid purple image ... */ - if (id && (image = purple_imgstore_find_by_id(atoi(id)))) { + if (id + && strlen(id) > (sizeof(PURPLE_STORED_IMAGE_PROTOCOL) - 1) + && (image = purple_imgstore_find_by_id(atoi(id + sizeof(PURPLE_STORED_IMAGE_PROTOCOL) - 1)))) { /* ... append the message from start to the tag ... */ unsigned long size = purple_imgstore_get_size(image); const char *filename = purple_imgstore_get_filename(image); diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c index 8d1841ebe3..938184ec31 100644 --- a/libpurple/protocols/sametime/sametime.c +++ b/libpurple/protocols/sametime/sametime.c @@ -2833,7 +2833,7 @@ static void im_recv_mime(struct mwConversation *conv, if(align) g_string_append_printf(atstr, " align=\"%s\"", align); if(border) g_string_append_printf(atstr, " border=\"%s\"", border); - mov = g_snprintf(start, len, "str, img); + mov = g_snprintf(start, len, "str, img); while(mov < len) start[mov++] = ' '; g_string_free(atstr, TRUE); diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c index 11d062e26c..dc53279150 100644 --- a/libpurple/protocols/silc/ops.c +++ b/libpurple/protocols/silc/ops.c @@ -210,7 +210,9 @@ silcpurple_mime_message(SilcClient client, SilcClientConnection conn, imgid = purple_imgstore_add_with_id(g_memdup(data, data_len), data_len, ""); if (imgid) { cflags |= PURPLE_MESSAGE_IMAGES | PURPLE_MESSAGE_RECV; - g_snprintf(tmp, sizeof(tmp), "", imgid); + g_snprintf(tmp, sizeof(tmp), + "", + imgid); if (channel) serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), diff --git a/libpurple/protocols/yahoo/yahoo_profile.c b/libpurple/protocols/yahoo/yahoo_profile.c index b7c173367e..aa1baa2943 100644 --- a/libpurple/protocols/yahoo/yahoo_profile.c +++ b/libpurple/protocols/yahoo/yahoo_profile.c @@ -1047,7 +1047,8 @@ yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, " bytes\n", photo_url_text, len); id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); - tmp = g_strdup_printf("
    ", id); + tmp = g_strdup_printf("
    ", + id); purple_notify_user_info_add_pair_html(user_info, NULL, tmp); g_free(tmp); } -- cgit v1.2.1 From 2d9ed17382bb23a53e0de322281f53820350bc6d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 15 Jun 2012 02:55:02 -0400 Subject: Fix the buttons in the XMPP Console plugin. They were still using the old GtkTextBuffer stuff that doesn't work with WebKit. --- pidgin/plugins/xmppconsole.c | 106 ++++++++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 47 deletions(-) diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index df6f04c2c5..4f31ec2978 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -59,6 +59,14 @@ static void *xmpp_console_handle = NULL; "span.value { color: #324aa4; }" \ "span.xmlns { color: #2cb12f; font-weight: bold;}" \ "" +#define SET_CURSOR \ + "var s = window.getSelection();" \ + "var r = document.createRange();" \ + "var n = document.getElementById('caret');" \ + "r.setStartBefore(n);" \ + "r.setEndBefore(n);" \ + "s.removeAllRanges();" \ + "s.addRange(r);" static char * xmlnode_to_pretty_str(xmlnode *node, int *len) @@ -272,9 +280,7 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) { GtkWidget *vbox, *hbox, *to_entry, *label, *type_combo; GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - GtkTextIter iter; - GtkTextBuffer *buffer; - const char *to; + char *to; int result; char *stanza; @@ -332,19 +338,21 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) return; } - to = gtk_entry_get_text(GTK_ENTRY(to_entry)); + to = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(to_entry)), -1); - stanza = g_strdup_printf("", + stanza = g_strdup_printf("<iq %s%s%s id='console%x' type='%s'>" + "" + "</iq>", to && *to ? "to='" : "", to && *to ? to : "", to && *to ? "'" : "", g_random_int(), gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo))); - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); - gtk_text_buffer_set_text(buffer, stanza, -1); - gtk_text_buffer_get_iter_at_offset(buffer, &iter, strstr(stanza, "") - stanza); - gtk_text_buffer_place_cursor(buffer, &iter); + gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), stanza); + gtk_widget_grab_focus(console->entry); + gtk_webview_safe_execute_script(GTK_WEBVIEW(console->entry), SET_CURSOR); + g_free(to); g_free(stanza); gtk_widget_destroy(dialog); @@ -362,9 +370,8 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) GtkWidget *show_combo; GtkWidget *type_combo; GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - GtkTextIter iter; - GtkTextBuffer *buffer; - const char *to, *type, *status, *show, *priority; + char *to, *status, *priority; + const char *type, *show; int result; char *stanza; @@ -465,21 +472,22 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) return; } - to = gtk_entry_get_text(GTK_ENTRY(to_entry)); + to = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(to_entry)), -1); type = gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo)); if (!strcmp(type, "default")) type = ""; show = gtk_combo_box_get_active_text(GTK_COMBO_BOX(show_combo)); if (!strcmp(show, "default")) show = ""; - status = gtk_entry_get_text(GTK_ENTRY(status_entry)); - priority = gtk_entry_get_text(GTK_ENTRY(priority_entry)); + status = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(status_entry)), -1); + priority = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(priority_entry)), -1); if (!strcmp(priority, "0")) - priority = ""; + *priority = '\0'; - stanza = g_strdup_printf("" + stanza = g_strdup_printf("<presence %s%s%s id='console%x' %s%s%s>" "%s%s%s%s%s%s%s%s%s" - "", + "" + "</presence>", *to ? "to='" : "", *to ? to : "", *to ? "'" : "", @@ -489,23 +497,25 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) *type ? type : "", *type ? "'" : "", - *show ? "" : "", + *show ? "<show>" : "", *show ? show : "", - *show ? "" : "", + *show ? "</show>" : "", - *status ? "" : "", + *status ? "<status>" : "", *status ? status : "", - *status ? "" : "", + *status ? "</status>" : "", - *priority ? "" : "", + *priority ? "<priority>" : "", *priority ? priority : "", - *priority ? "" : ""); + *priority ? "</priority>" : ""); - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); - gtk_text_buffer_set_text(buffer, stanza, -1); - gtk_text_buffer_get_iter_at_offset(buffer, &iter, strstr(stanza, "") - stanza); - gtk_text_buffer_place_cursor(buffer, &iter); + gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), stanza); + gtk_widget_grab_focus(console->entry); + gtk_webview_safe_execute_script(GTK_WEBVIEW(console->entry), SET_CURSOR); g_free(stanza); + g_free(to); + g_free(status); + g_free(priority); gtk_widget_destroy(dialog); g_object_unref(sg); @@ -522,9 +532,7 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) GtkWidget *label; GtkWidget *type_combo; GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - GtkTextIter iter; - GtkTextBuffer *buffer; - const char *to, *body, *thread, *subject; + char *to, *body, *thread, *subject; char *stanza; int result; @@ -618,14 +626,15 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) return; } - to = gtk_entry_get_text(GTK_ENTRY(to_entry)); - body = gtk_entry_get_text(GTK_ENTRY(body_entry)); - thread = gtk_entry_get_text(GTK_ENTRY(thread_entry)); - subject = gtk_entry_get_text(GTK_ENTRY(subject_entry)); + to = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(to_entry)), -1); + body = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(body_entry)), -1); + thread = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(thread_entry)), -1); + subject = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(subject_entry)), -1); - stanza = g_strdup_printf("" + stanza = g_strdup_printf("<message %s%s%s id='console%x' type='%s'>" "%s%s%s%s%s%s%s%s%s" - "", + "" + "</message>", *to ? "to='" : "", *to ? to : "", @@ -633,23 +642,26 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) g_random_int(), gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo)), - *body ? "" : "", + *body ? "<body>" : "", *body ? body : "", - *body ? "" : "", + *body ? "</body>" : "", - *subject ? "" : "", + *subject ? "<subject>" : "", *subject ? subject : "", - *subject ? "" : "", + *subject ? "</subject>" : "", - *thread ? "" : "", + *thread ? "<thread>" : "", *thread ? thread : "", - *thread ? "" : ""); + *thread ? "</thread>" : ""); - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); - gtk_text_buffer_set_text(buffer, stanza, -1); - gtk_text_buffer_get_iter_at_offset(buffer, &iter, strstr(stanza, "") - stanza); - gtk_text_buffer_place_cursor(buffer, &iter); + gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), stanza); + gtk_widget_grab_focus(console->entry); + gtk_webview_safe_execute_script(GTK_WEBVIEW(console->entry), SET_CURSOR); g_free(stanza); + g_free(to); + g_free(body); + g_free(thread); + g_free(subject); gtk_widget_destroy(dialog); g_object_unref(sg); -- cgit v1.2.1 From ee5e8a6425a112fdd2d351821c70914a8eceab9e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 15 Jun 2012 03:06:35 -0400 Subject: Update the webview to use the new image sources. Instead of doing ugly HTML parsing, just let WebKit do it. Since the prpls now use src attributes, it correctly searches for things, which we can capture and override when it's from the imgstore. --- pidgin/gtkwebview.c | 145 +++++++++++++++------------------------------------- pidgin/gtkwebview.h | 4 +- 2 files changed, 42 insertions(+), 107 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index cbf847f460..499360dcf8 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -53,7 +53,6 @@ static guint signals[LAST_SIGNAL] = { 0 }; *****************************************************************************/ typedef struct _GtkWebViewPriv { - GHashTable *images; /**< a map from id to temporary file for the image */ gboolean empty; /**< whether anything has been appended **/ /* JS execute queue */ @@ -84,97 +83,44 @@ static WebKitWebViewClass *parent_class = NULL; * Helpers *****************************************************************************/ -static const char * -get_image_src_from_id(GtkWebViewPriv *priv, int id) -{ - char *src; - PurpleStoredImage *img; - - if (priv->images) { - /* Check for already loaded image */ - src = (char *)g_hash_table_lookup(priv->images, GINT_TO_POINTER(id)); - if (src) - return src; - } else { - priv->images = g_hash_table_new_full(g_direct_hash, g_direct_equal, - NULL, g_free); - } - - /* Find image in store */ - img = purple_imgstore_find_by_id(id); - - src = (char *)purple_imgstore_get_filename(img); - if (src) { - src = g_strdup_printf("file://%s", src); - } else { - char *tmp; - tmp = purple_base64_encode(purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - src = g_strdup_printf("data:base64,%s", tmp); - g_free(tmp); - } - - g_hash_table_insert(priv->images, GINT_TO_POINTER(id), src); - - return src; -} - -/* - * Replace all tags with . I hoped to never - * write any HTML parsing code, but I'm forced to do this, until - * purple changes the way it works. - */ -static char * -replace_img_id_with_src(GtkWebViewPriv *priv, const char *html) +static void +webview_resource_loading(WebKitWebView *webview, + WebKitWebFrame *frame, + WebKitWebResource *resource, + WebKitNetworkRequest *request, + WebKitNetworkResponse *response, + gpointer user_data) { - GString *buffer = g_string_new(NULL); - const char *cur = html; - char *id; - int nid; - - while (*cur) { - const char *img = strstr(cur, ""); - if (!cur) - cur = strstr(img, ">"); - - if (!cur) { /* invalid html? */ - g_string_printf(buffer, "%s", html); - break; - } + const gchar *uri; - if (strstr(img, "src=") || !strstr(img, "id=")) { - g_string_printf(buffer, "%s", html); - break; + uri = webkit_network_request_get_uri(request); + if (purple_str_has_prefix(uri, PURPLE_STORED_IMAGE_PROTOCOL)) { + int id; + PurpleStoredImage *img; + const char *filename; + + uri += sizeof(PURPLE_STORED_IMAGE_PROTOCOL) - 1; + id = strtoul(uri, NULL, 10); + + img = purple_imgstore_find_by_id(id); + if (!img) + return; + + filename = purple_imgstore_get_filename(img); + if (filename && g_path_is_absolute(filename)) { + char *tmp = g_strdup_printf("file://%s", filename); + webkit_network_request_set_uri(request, tmp); + g_free(tmp); + } else { + char *b64 = purple_base64_encode(purple_imgstore_get_data(img), + purple_imgstore_get_size(img)); + const char *type = purple_imgstore_get_extension(img); + char *tmp = g_strdup_printf("data:image/%s;base64,%s", type, b64); + webkit_network_request_set_uri(request, tmp); + g_free(b64); + g_free(tmp); } - - /* - * if this is valid HTML, then I can be sure that it - * has an id= and does not have an src=, since - * '=' cannot appear in parameters. - */ - - id = strstr(img, "id=") + 3; - - /* *id can't be \0, since a ">" appears after this */ - if (isdigit(*id)) - nid = atoi(id); - else - nid = atoi(id + 1); - - /* let's dump this, tag and then dump the src information */ - g_string_append_len(buffer, img, cur - img); - - g_string_append_printf(buffer, " src='%s' ", get_image_src_from_id(priv, nid)); } - - return g_string_free(buffer, FALSE); } static gboolean @@ -441,9 +387,6 @@ gtk_webview_finalize(GObject *webview) g_free(temp); g_queue_free(priv->js_queue); - if (priv->images) - g_hash_table_unref(priv->images); - G_OBJECT_CLASS(parent_class)->finalize(G_OBJECT(webview)); } @@ -535,6 +478,9 @@ gtk_webview_init(GtkWebView *webview, gpointer userdata) g_signal_connect(webview, "load-finished", G_CALLBACK(webview_load_finished), NULL); + + g_signal_connect(G_OBJECT(webview), "resource-request-starting", + G_CALLBACK(webview_resource_loading), NULL); } GType @@ -612,18 +558,8 @@ gtk_webview_safe_execute_script(GtkWebView *webview, const char *script) void gtk_webview_load_html_string(GtkWebView *webview, const char *html) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - char *html_imged; - - if (priv->images) { - g_hash_table_unref(priv->images); - priv->images = NULL; - } - - html_imged = replace_img_id_with_src(priv, html); - webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), html_imged, NULL, - NULL, "file:///"); - g_free(html_imged); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), html, NULL, NULL, + "file:///"); } void @@ -1067,7 +1003,8 @@ gtk_webview_insert_image(GtkWebView *webview, int id) char *img; dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); - img = g_strdup_printf("", get_image_src_from_id(priv, id)); + img = g_strdup_printf("", + id); priv->edit.block_changed = TRUE; webkit_dom_document_exec_command(dom, "insertHTML", FALSE, img); diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index b05c4cbfb4..d902812568 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -114,9 +114,7 @@ gboolean gtk_webview_is_empty(GtkWebView *webview); void gtk_webview_append_html(GtkWebView *webview, const char *markup); /** - * Rather than use webkit_webview_load_string, this routine - * parses and displays the \ tags that make use of the - * Pidgin imgstore. + * Requests loading of the given content. * * @param webview The GtkWebView object * @param html The HTML content to load -- cgit v1.2.1 From 7d91a0c316b113bbdc10a866ed87acf360f8734e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 26 Jun 2012 00:03:13 -0400 Subject: This function exists now. --- pidgin/gtkdialogs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pidgin/gtkdialogs.c b/pidgin/gtkdialogs.c index 86c39157ef..8c824f0819 100644 --- a/pidgin/gtkdialogs.c +++ b/pidgin/gtkdialogs.c @@ -458,9 +458,7 @@ pidgin_build_help_dialog(const char *title, const char *role, GString *string) gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); frame = pidgin_create_webview(FALSE, &webview, NULL, NULL); - /* TODO WEBKIT: Compile now and fix it later when we have a proper replacement for this function - gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY); - */ + gtk_webview_set_format_functions(GTK_WEBVIEW(webview), GTK_WEBVIEW_ALL ^ GTK_WEBVIEW_SMILEY); gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); gtk_webview_append_html(GTK_WEBVIEW(webview), string->str); -- cgit v1.2.1 From c76573ae913959db256760d95ef71b567a12976b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 26 Jun 2012 00:04:09 -0400 Subject: This Find dialog shortcut is not needed now. --- pidgin/gtkconv.c | 4 ---- pidgin/gtkconvwin.h | 6 ------ 2 files changed, 10 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 5b23ffd50f..ee1fb21819 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -9923,10 +9923,6 @@ pidgin_conv_window_destroy(PidginWindow *win) purple_prefs_disconnect_by_handle(win); window_list = g_list_remove(window_list, win); - /* Close the "Find" dialog if it's open */ - if (win->dialogs.search) - gtk_widget_destroy(win->dialogs.search); - if (win->gtkconvs) { while (win->gtkconvs) { gboolean last = (win->gtkconvs->next == NULL); diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index 90049f1273..fd05f5c3ad 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -79,12 +79,6 @@ struct _PidginWindow } menu; - struct - { - GtkWidget *search; - - } dialogs; - /* Tab dragging stuff. */ gboolean in_drag; gboolean in_predrag; -- cgit v1.2.1 From 84b3252bdc31c22adc0001504fd7f911829e91d0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 26 Jun 2012 00:18:16 -0400 Subject: Move actions into the menu. --- pidgin/gtkconv.c | 30 +++++++++++++++--------------- pidgin/gtkconvwin.h | 12 +++++------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index ee1fb21819..de50cdb5ce 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -1217,9 +1217,9 @@ menu_initiate_media_call_cb(GtkAction *action, gpointer data) purple_prpl_initiate_media(account, purple_conversation_get_name(conv), - action == win->audio_call ? PURPLE_MEDIA_AUDIO : - action == win->video_call ? PURPLE_MEDIA_VIDEO : - action == win->audio_video_call ? PURPLE_MEDIA_AUDIO | + action == win->menu.audio_call ? PURPLE_MEDIA_AUDIO : + action == win->menu.video_call ? PURPLE_MEDIA_VIDEO : + action == win->menu.audio_video_call ? PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE); } #endif @@ -3362,25 +3362,25 @@ regenerate_media_items(PidginWindow *win) purple_prpl_get_media_caps(account, purple_conversation_get_name(conv)); - gtk_action_set_sensitive(win->audio_call, + gtk_action_set_sensitive(win->menu.audio_call, caps & PURPLE_MEDIA_CAPS_AUDIO ? TRUE : FALSE); - gtk_action_set_sensitive(win->video_call, + gtk_action_set_sensitive(win->menu.video_call, caps & PURPLE_MEDIA_CAPS_VIDEO ? TRUE : FALSE); - gtk_action_set_sensitive(win->audio_video_call, + gtk_action_set_sensitive(win->menu.audio_video_call, caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO ? TRUE : FALSE); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { /* for now, don't care about chats... */ - gtk_action_set_sensitive(win->audio_call, FALSE); - gtk_action_set_sensitive(win->video_call, FALSE); - gtk_action_set_sensitive(win->audio_video_call, FALSE); + gtk_action_set_sensitive(win->menu.audio_call, FALSE); + gtk_action_set_sensitive(win->menu.video_call, FALSE); + gtk_action_set_sensitive(win->menu.audio_video_call, FALSE); } else { - gtk_action_set_sensitive(win->audio_call, FALSE); - gtk_action_set_sensitive(win->video_call, FALSE); - gtk_action_set_sensitive(win->audio_video_call, FALSE); + gtk_action_set_sensitive(win->menu.audio_call, FALSE); + gtk_action_set_sensitive(win->menu.video_call, FALSE); + gtk_action_set_sensitive(win->menu.audio_video_call, FALSE); } #endif } @@ -3608,13 +3608,13 @@ setup_menubar(PidginWindow *win) "/Conversation/ConversationMenu/ViewLog"); #ifdef USE_VV - win->audio_call = + win->menu.audio_call = gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/MediaMenu/AudioCall"); - win->video_call = + win->menu.video_call = gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/MediaMenu/VideoCall"); - win->audio_video_call = + win->menu.audio_video_call = gtk_ui_manager_get_action(win->menu.ui, "/Conversation/ConversationMenu/MediaMenu/AudioVideoCall"); #endif diff --git a/pidgin/gtkconvwin.h b/pidgin/gtkconvwin.h index fd05f5c3ad..c2a5268704 100644 --- a/pidgin/gtkconvwin.h +++ b/pidgin/gtkconvwin.h @@ -46,10 +46,15 @@ struct _PidginWindow struct { + GtkUIManager *ui; GtkWidget *menubar; GtkAction *view_log; + GtkAction *audio_call; + GtkAction *video_call; + GtkAction *audio_video_call; + GtkAction *send_file; GtkAction *get_attention; GtkAction *add_pounce; @@ -75,8 +80,6 @@ struct _PidginWindow GtkWidget *typing_icon; - GtkUIManager *ui; - } menu; /* Tab dragging stuff. */ @@ -89,11 +92,6 @@ struct _PidginWindow gint drag_motion_signal; gint drag_leave_signal; - - /* Media menu options. */ - GtkAction *audio_call; - GtkAction *video_call; - GtkAction *audio_video_call; }; /*@}*/ -- cgit v1.2.1 From 485eda299bc7752425815c4120f74ff89baa0e98 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Fri, 29 Jun 2012 16:31:57 +0200 Subject: Fix registration dialog for protocols with REGISTER_NOSCREENNAME option --- pidgin/gtkaccount.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index a3d1062598..b63150479e 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -248,12 +248,16 @@ set_account_protocol_cb(GtkWidget *widget, const char *id, gtk_widget_grab_focus(dialog->protocol_menu); if (!dialog->prpl_info || !dialog->prpl_info->register_user) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( + dialog->register_button), FALSE); gtk_widget_hide(dialog->register_button); } else { if (dialog->prpl_info != NULL && (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)) { gtk_widget_set_sensitive(dialog->register_button, TRUE); } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( + dialog->register_button), FALSE); gtk_widget_set_sensitive(dialog->register_button, FALSE); } gtk_widget_show(dialog->register_button); @@ -282,11 +286,20 @@ username_focus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *d static void username_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) { - if (dialog->ok_button) - gtk_widget_set_sensitive(dialog->ok_button, + int opt_noscreenname = (dialog->prpl_info != NULL && + (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)); + + if (dialog->ok_button) { + if (opt_noscreenname && dialog->register_button && + gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(dialog->register_button))) + gtk_widget_set_sensitive(dialog->ok_button, TRUE); + else + gtk_widget_set_sensitive(dialog->ok_button, *gtk_entry_get_text(entry) != '\0'); + } if (dialog->register_button) { - if (dialog->prpl_info != NULL && (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)) + if (opt_noscreenname) gtk_widget_set_sensitive(dialog->register_button, TRUE); else gtk_widget_set_sensitive(dialog->register_button, @@ -294,6 +307,32 @@ username_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) } } +static void +register_button_cb(GtkWidget *checkbox, AccountPrefsDialog *dialog) +{ + int register_checked = gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(dialog->register_button)); + int opt_noscreenname = (dialog->prpl_info != NULL && + (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)); + int register_noscreenname = (opt_noscreenname && register_checked); + + if (register_noscreenname) { + gtk_entry_set_text(GTK_ENTRY(dialog->username_entry), ""); + gtk_entry_set_text(GTK_ENTRY(dialog->password_entry), ""); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check), FALSE); + } + gtk_widget_set_sensitive(dialog->username_entry, !register_noscreenname); + gtk_widget_set_sensitive(dialog->password_entry, !register_noscreenname); + gtk_widget_set_sensitive(dialog->remember_pass_check, !register_noscreenname); + + if (dialog->ok_button) { + gtk_widget_set_sensitive(dialog->ok_button, + (opt_noscreenname && register_checked) || + *gtk_entry_get_text(GTK_ENTRY(dialog->username_entry)) + != '\0'); + } +} + static gboolean username_nofocus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog) { @@ -1236,6 +1275,23 @@ cancel_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog) account_win_destroy_cb(NULL, NULL, dialog); } +static void +account_register_cb(PurpleAccount *account, gboolean succeeded, void *user_data) +{ + if (succeeded) + { + const PurpleSavedStatus *saved_status = purple_savedstatus_get_current(); + purple_signal_emit(pidgin_account_get_handle(), "account-modified", account); + + if (saved_status != NULL && purple_account_get_remember_password(account)) { + purple_savedstatus_activate_for_account(saved_status, account); + purple_account_set_enabled(account, PIDGIN_UI, TRUE); + } + } + else + purple_accounts_delete(account); +} + static void ok_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog) { @@ -1489,6 +1545,7 @@ ok_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog) /* If this is a new account, then sign on! */ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->register_button))) { + purple_account_set_register_callback(account, account_register_cb, NULL); purple_account_register(account); } else if (new_acct) { const PurpleSavedStatus *saved_status; @@ -1585,6 +1642,7 @@ pidgin_account_dialog_show(PidginAccountDialogType type, gtk_box_pack_start(GTK_BOX(main_vbox), button, FALSE, FALSE, 0); gtk_widget_show(button); dialog->register_button = button; + g_signal_connect(G_OBJECT(dialog->register_button), "toggled", G_CALLBACK(register_button_cb), dialog); if (dialog->account == NULL) gtk_widget_set_sensitive(button, FALSE); -- cgit v1.2.1 From 1e66024a125d043862490dba49b4c27761aea6a9 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Fri, 29 Jun 2012 16:35:07 +0200 Subject: pidgin_request_action: don't allow to close dialog window with Escape key --- pidgin/gtkrequest.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index ecd5870123..3d1a13d0ad 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -341,6 +341,11 @@ text_to_stock(const char *text) return text; } +static void stop_emission_cb(GtkDialog *dialog, const gchar *signal_name) +{ + gtk_signal_emit_stop_by_name(GTK_OBJECT(dialog), signal_name); +} + static void * pidgin_request_input(const char *title, const char *primary, const char *secondary, const char *default_value, @@ -655,6 +660,8 @@ pidgin_request_action_with_icon(const char *title, const char *primary, data->dialog = dialog = gtk_dialog_new(); gtk_window_set_deletable(GTK_WINDOW(data->dialog), FALSE); + g_signal_connect(G_OBJECT(dialog), "close", + G_CALLBACK(stop_emission_cb), "close"); if (title != NULL) gtk_window_set_title(GTK_WINDOW(dialog), title); -- cgit v1.2.1 From db96cb30cb2b85d51fd9dc0841bb4a6affa4bb95 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Tue, 3 Jul 2012 12:53:43 +0200 Subject: Fix handling of login_label connected with OPT_PROTO_REGISTER_NOSCREENNAME in account setup dialog --- pidgin/gtkaccount.c | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index b63150479e..2d80708a4f 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -307,32 +307,6 @@ username_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) } } -static void -register_button_cb(GtkWidget *checkbox, AccountPrefsDialog *dialog) -{ - int register_checked = gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(dialog->register_button)); - int opt_noscreenname = (dialog->prpl_info != NULL && - (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)); - int register_noscreenname = (opt_noscreenname && register_checked); - - if (register_noscreenname) { - gtk_entry_set_text(GTK_ENTRY(dialog->username_entry), ""); - gtk_entry_set_text(GTK_ENTRY(dialog->password_entry), ""); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check), FALSE); - } - gtk_widget_set_sensitive(dialog->username_entry, !register_noscreenname); - gtk_widget_set_sensitive(dialog->password_entry, !register_noscreenname); - gtk_widget_set_sensitive(dialog->remember_pass_check, !register_noscreenname); - - if (dialog->ok_button) { - gtk_widget_set_sensitive(dialog->ok_button, - (opt_noscreenname && register_checked) || - *gtk_entry_get_text(GTK_ENTRY(dialog->username_entry)) - != '\0'); - } -} - static gboolean username_nofocus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog) { @@ -361,6 +335,33 @@ username_nofocus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog return FALSE; } +static void +register_button_cb(GtkWidget *checkbox, AccountPrefsDialog *dialog) +{ + int register_checked = gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(dialog->register_button)); + int opt_noscreenname = (dialog->prpl_info != NULL && + (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)); + int register_noscreenname = (opt_noscreenname && register_checked); + + if (register_noscreenname) { + gtk_entry_set_text(GTK_ENTRY(dialog->username_entry), ""); + username_nofocus_cb(dialog->username_entry, NULL, dialog); + gtk_entry_set_text(GTK_ENTRY(dialog->password_entry), ""); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check), FALSE); + } + gtk_widget_set_sensitive(dialog->username_entry, !register_noscreenname); + gtk_widget_set_sensitive(dialog->password_entry, !register_noscreenname); + gtk_widget_set_sensitive(dialog->remember_pass_check, !register_noscreenname); + + if (dialog->ok_button) { + gtk_widget_set_sensitive(dialog->ok_button, + (opt_noscreenname && register_checked) || + *gtk_entry_get_text(GTK_ENTRY(dialog->username_entry)) + != '\0'); + } +} + static void icon_filesel_choose_cb(const char *filename, gpointer data) { -- cgit v1.2.1 From b8a5146e98e7c8c8a66daab7e94c26703e1fd023 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Thu, 5 Jul 2012 19:25:53 +0200 Subject: purple_url_parse: comma is valid character too --- libpurple/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libpurple/util.c b/libpurple/util.c index 600f57d173..3136300a87 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -3896,9 +3896,9 @@ purple_url_parse(const char *url, char **ret_host, int *ret_port, #define ADDR_CTRL "A-Za-z0-9.-" #define PORT_CTRL "0-9" -#define PAGE_CTRL "A-Za-z0-9.~_/:*!@&%%?=+^-" -#define USER_CTRL "A-Za-z0-9.~_/*!&%%?=+^-" -#define PASSWD_CTRL "A-Za-z0-9.~_/*!&%%?=+^-" +#define PAGE_CTRL "A-Za-z0-9.,~_/:*!@&%%?=+^-" +#define USER_CTRL "A-Za-z0-9.,~_/*!&%%?=+^-" +#define PASSWD_CTRL "A-Za-z0-9.,~_/*!&%%?=+^-" g_return_val_if_fail(url != NULL, FALSE); -- cgit v1.2.1 From 38a64a6238b5fc7b61b7e6b2639de1c80a95ae48 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sun, 8 Jul 2012 12:36:02 +0200 Subject: Bugfix: after checking and un-checking registration box in account setup dialog with username empty and login_label active, OK button was still active --- pidgin/gtkaccount.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 2d80708a4f..1df3cb72fa 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -344,9 +344,11 @@ register_button_cb(GtkWidget *checkbox, AccountPrefsDialog *dialog) (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)); int register_noscreenname = (opt_noscreenname && register_checked); + // get rid of login_label in username field + username_focus_cb(dialog->username_entry, NULL, dialog); + if (register_noscreenname) { gtk_entry_set_text(GTK_ENTRY(dialog->username_entry), ""); - username_nofocus_cb(dialog->username_entry, NULL, dialog); gtk_entry_set_text(GTK_ENTRY(dialog->password_entry), ""); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->remember_pass_check), FALSE); } @@ -360,6 +362,8 @@ register_button_cb(GtkWidget *checkbox, AccountPrefsDialog *dialog) *gtk_entry_get_text(GTK_ENTRY(dialog->username_entry)) != '\0'); } + + username_nofocus_cb(dialog->username_entry, NULL, dialog); } static void -- cgit v1.2.1 From 41fc7cb5b5a5e58ff6078de1929204bc13fe6e73 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 8 Jul 2012 23:41:47 -0400 Subject: Move caret selection into GtkWebView code. --- pidgin/gtkwebview.c | 14 ++++++++++++++ pidgin/gtkwebview.h | 11 +++++++++++ pidgin/plugins/xmppconsole.c | 17 +++-------------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 499360dcf8..d3d72bbe68 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -562,6 +562,20 @@ gtk_webview_load_html_string(GtkWebView *webview, const char *html) "file:///"); } +void +gtk_webview_load_html_string_with_selection(GtkWebView *webview, const char *html) +{ + gtk_webview_load_html_string(webview, html); + gtk_webview_safe_execute_script(webview, + "var s = window.getSelection();" + "var r = document.createRange();" + "var n = document.getElementById('caret');" + "r.setStartBefore(n);" + "r.setEndBefore(n);" + "s.removeAllRanges();" + "s.addRange(r);"); +} + void gtk_webview_append_html(GtkWebView *webview, const char *html) { diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h index d902812568..a3d472363b 100644 --- a/pidgin/gtkwebview.h +++ b/pidgin/gtkwebview.h @@ -121,6 +121,17 @@ void gtk_webview_append_html(GtkWebView *webview, const char *markup); */ void gtk_webview_load_html_string(GtkWebView *webview, const char *html); +/** + * Requests loading of the given content and sets the selection. You must + * include an anchor tag with id='caret' in the HTML string, which will be + * used to set the selection. This tag is then removed so that querying the + * WebView's HTML contents will no longer return it. + * + * @param webview The GtkWebView object + * @param html The HTML content to load + */ +void gtk_webview_load_html_string_with_selection(GtkWebView *webview, const char *html); + /** * Execute the JavaScript only after the webkit_webview_load_string * loads completely. We also guarantee that the scripts are executed diff --git a/pidgin/plugins/xmppconsole.c b/pidgin/plugins/xmppconsole.c index 4f31ec2978..78da0e135e 100644 --- a/pidgin/plugins/xmppconsole.c +++ b/pidgin/plugins/xmppconsole.c @@ -59,14 +59,6 @@ static void *xmpp_console_handle = NULL; "span.value { color: #324aa4; }" \ "span.xmlns { color: #2cb12f; font-weight: bold;}" \ "" -#define SET_CURSOR \ - "var s = window.getSelection();" \ - "var r = document.createRange();" \ - "var n = document.getElementById('caret');" \ - "r.setStartBefore(n);" \ - "r.setEndBefore(n);" \ - "s.removeAllRanges();" \ - "s.addRange(r);" static char * xmlnode_to_pretty_str(xmlnode *node, int *len) @@ -349,9 +341,8 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) g_random_int(), gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo))); - gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), stanza); + gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); gtk_widget_grab_focus(console->entry); - gtk_webview_safe_execute_script(GTK_WEBVIEW(console->entry), SET_CURSOR); g_free(to); g_free(stanza); @@ -509,9 +500,8 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) *priority ? priority : "", *priority ? "</priority>" : ""); - gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), stanza); + gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); gtk_widget_grab_focus(console->entry); - gtk_webview_safe_execute_script(GTK_WEBVIEW(console->entry), SET_CURSOR); g_free(stanza); g_free(to); g_free(status); @@ -654,9 +644,8 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) *thread ? thread : "", *thread ? "</thread>" : ""); - gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), stanza); + gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); gtk_widget_grab_focus(console->entry); - gtk_webview_safe_execute_script(GTK_WEBVIEW(console->entry), SET_CURSOR); g_free(stanza); g_free(to); g_free(body); -- cgit v1.2.1 From de45fca025b9f0829643702935b35493fe3599b5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 8 Jul 2012 23:49:44 -0400 Subject: Make sure the selection anchor is removed. --- pidgin/gtkwebview.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index d3d72bbe68..5d0003781a 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -570,8 +570,11 @@ gtk_webview_load_html_string_with_selection(GtkWebView *webview, const char *htm "var s = window.getSelection();" "var r = document.createRange();" "var n = document.getElementById('caret');" - "r.setStartBefore(n);" - "r.setEndBefore(n);" + "r.selectNodeContents(n);" + "var f = r.extractContents();" + "r.selectNode(n);" + "r.insertNode(f);" + "n.parentNode.removeChild(n);" "s.removeAllRanges();" "s.addRange(r);"); } -- cgit v1.2.1 From 9de3f0b891ee83f5dac6a3317ddd4af536960e95 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sat, 14 Jul 2012 16:26:32 +0200 Subject: Bugfix: update group size, when removing contact --- libpurple/blist.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libpurple/blist.c b/libpurple/blist.c index 2d335b885a..ca64ff5d5c 100644 --- a/libpurple/blist.c +++ b/libpurple/blist.c @@ -2068,11 +2068,13 @@ void purple_blist_remove_contact(PurpleContact *contact) { PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); PurpleBlistNode *node, *gnode; + PurpleGroup *group; g_return_if_fail(contact != NULL); node = (PurpleBlistNode *)contact; gnode = node->parent; + group = PURPLE_GROUP(gnode); if (node->child) { /* @@ -2097,6 +2099,7 @@ void purple_blist_remove_contact(PurpleContact *contact) node->prev->next = node->next; if (node->next) node->next->prev = node->prev; + group->totalsize--; /* Update the UI */ if (ops && ops->remove) -- cgit v1.2.1 From 82ba19ea9be5c0ca847e488eda68689cf56f378b Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sun, 15 Jul 2012 13:05:08 +0200 Subject: Libpurple: username validation support; Pidgin: use it in account setup dialog --- libpurple/prpl.h | 17 +++++++++++++---- libpurple/util.c | 22 ++++++++++++++++++++++ libpurple/util.h | 11 +++++++++++ pidgin/gtkaccount.c | 8 +++++--- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/libpurple/prpl.h b/libpurple/prpl.h index 635fcb47cb..0d39d87a33 100644 --- a/libpurple/prpl.h +++ b/libpurple/prpl.h @@ -467,11 +467,20 @@ struct _PurplePluginProtocolInfo void (*convo_closed)(PurpleConnection *, const char *who); /** - * Convert the username @a who to its canonical form. (For example, - * AIM treats "fOo BaR" and "foobar" as the same user; this function - * should return the same normalized string for both of those.) + * Convert the username @a who to its canonical form. Also checks for + * validity. + * + * For example, AIM treats "fOo BaR" and "foobar" as the same user; this + * function should return the same normalized string for both of those. + * On the other hand, both of these are invalid for protocols with + * number-based usernames, so function should return NULL in such case. + * + * @param account The account, that username is related with. Can + * be NULL. + * @param who The username to convert. + * @return Normalized username, or NULL, if it's invalid. */ - const char *(*normalize)(const PurpleAccount *, const char *who); + const char *(*normalize)(const PurpleAccount *account, const char *who); /** * Set the buddy icon for the given connection to @a img. The prpl diff --git a/libpurple/util.c b/libpurple/util.c index 3136300a87..96d7095362 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -3487,6 +3487,28 @@ purple_normalize_nocase(const PurpleAccount *account, const char *str) return buf; } +gboolean +purple_validate(const PurplePlugin *prpl, const char *str) +{ + PurplePluginProtocolInfo *prpl_info; + const char *normalized; + + g_return_val_if_fail(prpl != NULL, FALSE); + g_return_val_if_fail(str != NULL, FALSE); + + if (str[0] == '\0') + return FALSE; + + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + + if (!prpl_info->normalize) + return TRUE; + + normalized = prpl_info->normalize(NULL, str); + + return (NULL != normalized); +} + gchar * purple_strdup_withhtml(const gchar *src) { diff --git a/libpurple/util.h b/libpurple/util.h index e092d62369..f5a73c45f1 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -56,6 +56,7 @@ typedef struct _PurpleKeyValuePair PurpleKeyValuePair; #include "signals.h" #include "xmlnode.h" #include "notify.h" +#include "plugin.h" typedef char *(*PurpleInfoFieldFormatCallback)(const char *field, size_t len); @@ -959,6 +960,16 @@ const char *purple_normalize(const PurpleAccount *account, const char *str); */ const char *purple_normalize_nocase(const PurpleAccount *account, const char *str); +/** + * Checks, if a string is valid. + * + * @param prpl The protocol plugin the string belongs to. + * @param str The string to validate. + * + * @return TRUE, if string is valid, otherwise FALSE. + */ +gboolean purple_validate(const PurplePlugin *prpl, const char *str); + /** * Compares two strings to see if the first contains the second as * a proper prefix. diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 1df3cb72fa..7e0cc9fb14 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -286,8 +286,10 @@ username_focus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *d static void username_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) { - int opt_noscreenname = (dialog->prpl_info != NULL && + gboolean opt_noscreenname = (dialog->prpl_info != NULL && (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)); + gboolean username_valid = purple_validate(dialog->plugin, + gtk_entry_get_text(entry)); if (dialog->ok_button) { if (opt_noscreenname && dialog->register_button && @@ -296,14 +298,14 @@ username_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) gtk_widget_set_sensitive(dialog->ok_button, TRUE); else gtk_widget_set_sensitive(dialog->ok_button, - *gtk_entry_get_text(entry) != '\0'); + username_valid); } if (dialog->register_button) { if (opt_noscreenname) gtk_widget_set_sensitive(dialog->register_button, TRUE); else gtk_widget_set_sensitive(dialog->register_button, - *gtk_entry_get_text(entry) != '\0'); + username_valid); } } -- cgit v1.2.1 From f1fef7d2a3efa1c1c1d8c1affed78e24a705f99d Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sun, 15 Jul 2012 13:14:08 +0200 Subject: Fix a crash in account setup dialog --- pidgin/gtkaccount.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 7e0cc9fb14..92b9f7bba5 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -270,6 +270,11 @@ username_focus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *d GHashTable *table; const char *label; + if (!dialog->prpl_info || ! PURPLE_PROTOCOL_PLUGIN_HAS_FUNC( + dialog->prpl_info, get_account_text_table)) { + return FALSE; + } + table = dialog->prpl_info->get_account_text_table(NULL); label = g_hash_table_lookup(table, "login_label"); -- cgit v1.2.1 From 87ee7b0adc829dbdd82398955d388041d624ad03 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Sun, 15 Jul 2012 18:40:35 +0200 Subject: Pidgin: validate username in buddy adding dialog --- pidgin/gtkblist.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index bf0662ff20..89d4d7bdfc 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -898,7 +898,7 @@ do_joinchat(GtkWidget *dialog, int id, PidginChatData *info) * strings are empty then don't allow the user to click on "OK." */ static void -set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data) +set_sensitive_if_input_chat_cb(GtkWidget *entry, gpointer user_data) { PurplePluginProtocolInfo *prpl_info; PurpleConnection *gc; @@ -930,6 +930,21 @@ set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data) gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), 1, sensitive); } +static void +set_sensitive_if_input_buddy_cb(GtkWidget *entry, gpointer user_data) +{ + PurplePlugin *prpl; + PidginAddBuddyData *data = user_data; + const char *text; + + prpl = purple_find_prpl(purple_account_get_protocol_id( + data->rq_data.account)); + text = gtk_entry_get_text(GTK_ENTRY(entry)); + + gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), + GTK_RESPONSE_OK, purple_validate(prpl, text)); +} + static void pidgin_blist_update_privacy_cb(PurpleBuddy *buddy) { @@ -1093,7 +1108,7 @@ rebuild_chat_entries(PidginChatData *data, const char *default_chat_name) } pidgin_add_widget_to_vbox(data->rq_data.vbox, pce->label, data->rq_data.sg, input, TRUE, NULL); g_signal_connect(G_OBJECT(input), "changed", - G_CALLBACK(set_sensitive_if_input_cb), data); + G_CALLBACK(set_sensitive_if_input_chat_cb), data); } /* Do the following for any type of input widget */ @@ -1114,7 +1129,7 @@ rebuild_chat_entries(PidginChatData *data, const char *default_chat_name) g_hash_table_destroy(defaults); /* Set whether the "OK" button should be clickable initially */ - set_sensitive_if_input_cb(NULL, data); + set_sensitive_if_input_chat_cb(NULL, data); gtk_widget_show_all(GTK_WIDGET(data->rq_data.vbox)); } @@ -7054,6 +7069,7 @@ add_buddy_select_account_cb(GObject *w, PurpleAccount *account, invite_enabled = FALSE; gtk_widget_set_sensitive(data->entry_for_invite, invite_enabled); + set_sensitive_if_input_buddy_cb(data->entry, data); } static void @@ -7179,8 +7195,8 @@ pidgin_blist_request_add_buddy(PurpleAccount *account, const char *username, gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE); g_signal_connect(G_OBJECT(data->entry), "changed", - G_CALLBACK(pidgin_set_sensitive_if_input), - data->rq_data.window); + G_CALLBACK(set_sensitive_if_input_buddy_cb), + data); data->entry_for_alias = gtk_entry_new(); pidgin_add_widget_to_vbox(data->rq_data.vbox, _("(Optional) A_lias:"), -- cgit v1.2.1 From 9b06f567fd8b4620efced63e6063c4ec46b81d17 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 18 Jul 2012 03:37:08 -0400 Subject: Remove extra trailing whitespace. --- libpurple/util.c | 12 ++++++------ pidgin/gtkaccount.c | 15 ++++++++------- pidgin/gtkblist.c | 4 ++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/libpurple/util.c b/libpurple/util.c index 96d7095362..4f17031506 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -3492,20 +3492,20 @@ purple_validate(const PurplePlugin *prpl, const char *str) { PurplePluginProtocolInfo *prpl_info; const char *normalized; - + g_return_val_if_fail(prpl != NULL, FALSE); g_return_val_if_fail(str != NULL, FALSE); - + if (str[0] == '\0') return FALSE; - + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - + if (!prpl_info->normalize) return TRUE; - + normalized = prpl_info->normalize(NULL, str); - + return (NULL != normalized); } diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c index 92b9f7bba5..c63c6b89fd 100644 --- a/pidgin/gtkaccount.c +++ b/pidgin/gtkaccount.c @@ -295,7 +295,7 @@ username_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)); gboolean username_valid = purple_validate(dialog->plugin, gtk_entry_get_text(entry)); - + if (dialog->ok_button) { if (opt_noscreenname && dialog->register_button && gtk_toggle_button_get_active( @@ -305,6 +305,7 @@ username_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) gtk_widget_set_sensitive(dialog->ok_button, username_valid); } + if (dialog->register_button) { if (opt_noscreenname) gtk_widget_set_sensitive(dialog->register_button, TRUE); @@ -350,10 +351,10 @@ register_button_cb(GtkWidget *checkbox, AccountPrefsDialog *dialog) int opt_noscreenname = (dialog->prpl_info != NULL && (dialog->prpl_info->options & OPT_PROTO_REGISTER_NOSCREENNAME)); int register_noscreenname = (opt_noscreenname && register_checked); - - // get rid of login_label in username field + + /* get rid of login_label in username field */ username_focus_cb(dialog->username_entry, NULL, dialog); - + if (register_noscreenname) { gtk_entry_set_text(GTK_ENTRY(dialog->username_entry), ""); gtk_entry_set_text(GTK_ENTRY(dialog->password_entry), ""); @@ -362,14 +363,14 @@ register_button_cb(GtkWidget *checkbox, AccountPrefsDialog *dialog) gtk_widget_set_sensitive(dialog->username_entry, !register_noscreenname); gtk_widget_set_sensitive(dialog->password_entry, !register_noscreenname); gtk_widget_set_sensitive(dialog->remember_pass_check, !register_noscreenname); - + if (dialog->ok_button) { gtk_widget_set_sensitive(dialog->ok_button, (opt_noscreenname && register_checked) || *gtk_entry_get_text(GTK_ENTRY(dialog->username_entry)) != '\0'); } - + username_nofocus_cb(dialog->username_entry, NULL, dialog); } @@ -1294,7 +1295,7 @@ account_register_cb(PurpleAccount *account, gboolean succeeded, void *user_data) { const PurpleSavedStatus *saved_status = purple_savedstatus_get_current(); purple_signal_emit(pidgin_account_get_handle(), "account-modified", account); - + if (saved_status != NULL && purple_account_get_remember_password(account)) { purple_savedstatus_activate_for_account(saved_status, account); purple_account_set_enabled(account, PIDGIN_UI, TRUE); diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 89d4d7bdfc..c1b204b443 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -936,11 +936,11 @@ set_sensitive_if_input_buddy_cb(GtkWidget *entry, gpointer user_data) PurplePlugin *prpl; PidginAddBuddyData *data = user_data; const char *text; - + prpl = purple_find_prpl(purple_account_get_protocol_id( data->rq_data.account)); text = gtk_entry_get_text(GTK_ENTRY(entry)); - + gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), GTK_RESPONSE_OK, purple_validate(prpl, text)); } -- cgit v1.2.1 From accdf62409092b20c7327a73b886f9eac391c1b3 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 19 Jul 2012 21:15:30 -0400 Subject: I think we should verify UTF8 before using a function wanting it. --- pidgin/gtkdebug.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index ddd82309df..ff001a3de8 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -1165,7 +1165,8 @@ pidgin_debug_print(PurpleDebugLevel level, const char *category, else cat_s = g_strdup_printf("%s: ", category); - esc_s = g_markup_escape_text(arg_s, -1); + tmp = purple_utf8_try_convert(arg_s); + esc_s = g_markup_escape_text(tmp, -1); s = g_strdup_printf("%s%s%s", debug_fg_colors[level], ts_s, cat_s, esc_s); @@ -1173,10 +1174,7 @@ pidgin_debug_print(PurpleDebugLevel level, const char *category, g_free(ts_s); g_free(cat_s); g_free(esc_s); - - tmp = purple_utf8_try_convert(s); - g_free(s); - s = tmp; + g_free(tmp); if (level == PURPLE_DEBUG_FATAL) { tmp = g_strdup_printf("%s", s); -- cgit v1.2.1 From 03a4c4d3ba09a8418191db3b0189446867ee0b83 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 20 Jul 2012 01:06:34 -0400 Subject: Always use GRegex in the Debug Window. Available on Windows, and we require a newer version of GLib than when this was added, anyway. --- config.h.mingw | 3 - configure.ac | 2 +- pidgin/gtkdebug.c | 200 ++---------------------------------------------------- 3 files changed, 5 insertions(+), 200 deletions(-) diff --git a/config.h.mingw b/config.h.mingw index 5576d1e899..5458ce3d3b 100644 --- a/config.h.mingw +++ b/config.h.mingw @@ -180,9 +180,6 @@ /* Define to 1 if you have the `random' function. */ /* #define HAVE_RANDOM 1 */ -/* Define to 1 if you have the header file. */ -/* #define HAVE_REGEX_H 1 */ - /* Define to 1 if you have the `setlocale' function. */ #define HAVE_SETLOCALE 1 diff --git a/configure.ac b/configure.ac index 10e92e7307..86cb1b1558 100644 --- a/configure.ac +++ b/configure.ac @@ -123,7 +123,7 @@ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(arpa/nameser_compat.h fcntl.h sys/time.h unistd.h locale.h signal.h stdint.h regex.h) +AC_CHECK_HEADERS(arpa/nameser_compat.h fcntl.h sys/time.h unistd.h locale.h signal.h stdint.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index ff001a3de8..1469d573b5 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -37,43 +37,24 @@ #include "gtkutils.h" #include "pidginstock.h" -#ifdef HAVE_REGEX_H -# include -# define USE_REGEX 1 -#else -#if GLIB_CHECK_VERSION(2,14,0) -# define USE_REGEX 1 -#endif -#endif /* HAVE_REGEX_H */ - #include typedef struct { GtkWidget *window; GtkWidget *text; + GtkWidget *filter; + GtkWidget *expression; + GtkWidget *filterlevel; GtkListStore *store; gboolean paused; -#ifdef USE_REGEX - GtkWidget *filter; - GtkWidget *expression; - gboolean invert; gboolean highlight; - guint timer; -# ifdef HAVE_REGEX_H - regex_t regex; -# else GRegex *regex; -# endif /* HAVE_REGEX_H */ -#else - GtkWidget *find; -#endif /* USE_REGEX */ - GtkWidget *filterlevel; } DebugWindow; static const char debug_fg_colors[][8] = { @@ -88,17 +69,14 @@ static const char debug_fg_colors[][8] = { static DebugWindow *debug_win = NULL; static guint debug_enabled_timer = 0; -#ifdef USE_REGEX static void regex_filter_all(DebugWindow *win); static void regex_show_all(DebugWindow *win); -#endif /* USE_REGEX */ static gint debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) { purple_prefs_disconnect_by_handle(pidgin_debug_get_handle()); -#ifdef USE_REGEX if(debug_win->timer != 0) { const gchar *text; @@ -107,12 +85,7 @@ debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) text = gtk_entry_get_text(GTK_ENTRY(debug_win->expression)); purple_prefs_set_string(PIDGIN_PREFS_ROOT "/debug/regex", text); } -#ifdef HAVE_REGEX_H - regfree(&debug_win->regex); -#else g_regex_unref(debug_win->regex); -#endif /* HAVE_REGEX_H */ -#endif /* USE_REGEX */ /* If the "Save Log" dialog is open then close it */ purple_request_close_with_handle(debug_win); @@ -140,91 +113,6 @@ configure_cb(GtkWidget *w, GdkEventConfigure *event, DebugWindow *win) return FALSE; } -#ifndef USE_REGEX -struct _find { - DebugWindow *window; - GtkWidget *entry; -}; - -static void -do_find_cb(GtkWidget *widget, gint response, struct _find *f) -{ - switch (response) { - case GTK_RESPONSE_OK: - gtk_imhtml_search_find(GTK_IMHTML(f->window->text), - gtk_entry_get_text(GTK_ENTRY(f->entry))); - break; - - case GTK_RESPONSE_DELETE_EVENT: - case GTK_RESPONSE_CLOSE: - gtk_imhtml_search_clear(GTK_IMHTML(f->window->text)); - gtk_widget_destroy(f->window->find); - f->window->find = NULL; - g_free(f); - break; - } -} - -static void -find_cb(GtkWidget *w, DebugWindow *win) -{ - GtkWidget *hbox, *img, *label; - struct _find *f; - - if(win->find) - { - gtk_window_present(GTK_WINDOW(win->find)); - return; - } - - f = g_malloc(sizeof(struct _find)); - f->window = win; - win->find = gtk_dialog_new_with_buttons(_("Find"), - GTK_WINDOW(win->window), GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); - gtk_dialog_set_default_response(GTK_DIALOG(win->find), - GTK_RESPONSE_OK); - g_signal_connect(G_OBJECT(win->find), "response", - G_CALLBACK(do_find_cb), f); - - gtk_container_set_border_width(GTK_CONTAINER(win->find), PIDGIN_HIG_BOX_SPACE); - gtk_window_set_resizable(GTK_WINDOW(win->find), FALSE); -#if !GTK_CHECK_VERSION(2,22,0) - gtk_dialog_set_has_separator(GTK_DIALOG(win->find), FALSE); -#endif - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(win->find)->vbox), PIDGIN_HIG_BORDER); - gtk_container_set_border_width( - GTK_CONTAINER(GTK_DIALOG(win->find)->vbox), PIDGIN_HIG_BOX_SPACE); - - hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(win->find)->vbox), - hbox); - img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, - gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); - gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); - - gtk_misc_set_alignment(GTK_MISC(img), 0, 0); - gtk_dialog_set_response_sensitive(GTK_DIALOG(win->find), - GTK_RESPONSE_OK, FALSE); - - label = gtk_label_new(NULL); - gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - - f->entry = gtk_entry_new(); - gtk_entry_set_activates_default(GTK_ENTRY(f->entry), TRUE); - gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(f->entry)); - g_signal_connect(G_OBJECT(f->entry), "changed", - G_CALLBACK(pidgin_set_sensitive_if_input), - win->find); - gtk_box_pack_start(GTK_BOX(hbox), f->entry, FALSE, FALSE, 0); - - gtk_widget_show_all(win->find); - gtk_widget_grab_focus(f->entry); -} -#endif /* USE_REGEX */ - static void save_writefile_cb(void *user_data, const char *filename) { @@ -259,9 +147,7 @@ clear_cb(GtkWidget *w, DebugWindow *win) { gtk_imhtml_clear(GTK_IMHTML(win->text)); -#ifdef USE_REGEX gtk_list_store_clear(win->store); -#endif /* USE_REGEX */ } static void @@ -269,20 +155,17 @@ pause_cb(GtkWidget *w, DebugWindow *win) { win->paused = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w)); -#ifdef USE_REGEX if(!win->paused) { if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) regex_filter_all(win); else regex_show_all(win); } -#endif /* USE_REGEX */ } /****************************************************************************** * regex stuff *****************************************************************************/ -#ifdef USE_REGEX static void regex_clear_color(GtkWidget *w) { gtk_widget_modify_base(w, GTK_STATE_NORMAL, NULL); @@ -312,13 +195,7 @@ regex_highlight_clear(DebugWindow *win) { static void regex_match(DebugWindow *win, const gchar *text) { GtkIMHtml *imhtml = GTK_IMHTML(win->text); -#ifdef HAVE_REGEX_H - regmatch_t matches[4]; /* adjust if necessary */ - size_t n_matches = sizeof(matches) / sizeof(matches[0]); - gint inverted; -#else GMatchInfo *match_info; -#endif /* HAVE_REGEX_H */ gchar *plaintext; if(!text) @@ -332,12 +209,7 @@ regex_match(DebugWindow *win, const gchar *text) { /* we do a first pass to see if it matches at all. If it does we append * it, and work out the offsets to highlight. */ -#ifdef HAVE_REGEX_H - inverted = (win->invert) ? REG_NOMATCH : 0; - if(regexec(&win->regex, plaintext, n_matches, matches, 0) == inverted) { -#else if(g_regex_match(win->regex, plaintext, 0, &match_info) != win->invert) { -#endif /* HAVE_REGEX_H */ gchar *p = plaintext; GtkTextIter ins; gint i, offset = 0; @@ -353,39 +225,13 @@ regex_match(DebugWindow *win, const gchar *text) { */ if(!win->highlight || win->invert) { g_free(plaintext); -#ifndef HAVE_REGEX_H g_match_info_free(match_info); -#endif return; } /* we use a do-while to highlight the first match, and then continue * if necessary... */ -#ifdef HAVE_REGEX_H - do { - size_t m; - - for(m = 0; m < n_matches; m++) { - GtkTextIter ms, me; - - if(matches[m].rm_eo == -1) - break; - - i += offset; - - gtk_text_buffer_get_iter_at_offset(imhtml->text_buffer, &ms, - i + matches[m].rm_so); - gtk_text_buffer_get_iter_at_offset(imhtml->text_buffer, &me, - i + matches[m].rm_eo); - gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "regex", - &ms, &me); - offset = matches[m].rm_eo; - } - - p += offset; - } while(regexec(&win->regex, p, n_matches, matches, REG_NOTBOL) == inverted); -#else do { gint m; @@ -419,7 +265,6 @@ regex_match(DebugWindow *win, const gchar *text) { i += offset; } while (g_regex_match(win->regex, p, G_REGEX_MATCH_NOTBOL, &match_info) != win->invert); g_match_info_free(match_info); -#endif /* HAVE_REGEX_H */ } g_free(plaintext); @@ -493,15 +338,10 @@ regex_compile(DebugWindow *win) { return; } -#ifdef HAVE_REGEX_H - regfree(&win->regex); - if(regcomp(&win->regex, text, REG_EXTENDED | REG_ICASE) != 0) { -#else if (win->regex) g_regex_unref(win->regex); win->regex = g_regex_new(text, G_REGEX_EXTENDED | G_REGEX_CASELESS, 0, NULL); if(win->regex == NULL) { -#endif /* failed to compile */ regex_change_color(win->expression, 0xFFFF, 0xAFFF, 0xAFFF); gtk_widget_set_sensitive(win->filter, FALSE); @@ -689,7 +529,6 @@ filter_level_pref_changed(const char *name, PurplePrefType type, gconstpointer v else regex_show_all(win); } -#endif /* USE_REGEX */ static void filter_level_changed_cb(GtkWidget *combo, gpointer null) @@ -775,7 +614,6 @@ debug_window_new(void) handle = pidgin_debug_get_handle(); -#ifdef USE_REGEX /* the list store for all the messages */ win->store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); @@ -787,8 +625,6 @@ debug_window_new(void) g_signal_connect(G_OBJECT(win->store), "row-changed", G_CALLBACK(regex_row_changed_cb), win); -#endif /* USE_REGEX */ - /* Setup the vbox */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(win->window), vbox); @@ -814,19 +650,6 @@ debug_window_new(void) gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); -#ifndef USE_REGEX - /* Find button */ - item = gtk_tool_button_new_from_stock(GTK_STOCK_FIND); - gtk_tool_item_set_is_important(item, TRUE); -#if GTK_CHECK_VERSION(2,12,0) - gtk_tool_item_set_tooltip_text(item, _("Find")); -#else - gtk_tool_item_set_tooltip(item, tooltips, _("Find"), NULL); -#endif - g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(find_cb), win); - gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); -#endif /* USE_REGEX */ - /* Save */ item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); gtk_tool_item_set_is_important(item, TRUE); @@ -863,7 +686,6 @@ debug_window_new(void) g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(pause_cb), win); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); -#ifdef USE_REGEX /* regex stuff */ item = gtk_separator_tool_item_new(); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); @@ -926,8 +748,6 @@ debug_window_new(void) purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/highlight", regex_pref_highlight_cb, win); -#endif /* USE_REGEX */ - item = gtk_separator_tool_item_new(); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); @@ -953,10 +773,9 @@ debug_window_new(void) gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Fatal Error")); gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")); -#ifdef USE_REGEX + purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filterlevel", filter_level_pref_changed, win); -#endif g_signal_connect(G_OBJECT(win->filterlevel), "changed", G_CALLBACK(filter_level_changed_cb), NULL); } @@ -968,13 +787,11 @@ debug_window_new(void) gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); gtk_widget_show(frame); -#ifdef USE_REGEX /* add the tag for regex highlighting */ gtk_text_buffer_create_tag(GTK_IMHTML(win->text)->text_buffer, "regex", "background", "#FFAFAF", "weight", "bold", NULL); -#endif /* USE_REGEX */ gtk_widget_show_all(win->window); @@ -1075,13 +892,11 @@ pidgin_debug_init(void) purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/width", 450); purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/height", 250); -#ifdef USE_REGEX purple_prefs_add_string(PIDGIN_PREFS_ROOT "/debug/regex", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/filter", FALSE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/invert", FALSE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/case_insensitive", FALSE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/highlight", FALSE); -#endif /* USE_REGEX */ purple_prefs_connect_callback(NULL, PIDGIN_PREFS_ROOT "/debug/enabled", debug_enabled_cb, NULL); @@ -1143,9 +958,7 @@ static void pidgin_debug_print(PurpleDebugLevel level, const char *category, const char *arg_s) { -#ifdef USE_REGEX GtkTreeIter iter; -#endif /* USE_REGEX */ gchar *ts_s; gchar *esc_s, *cat_s, *tmp, *s; const char *mdate; @@ -1182,14 +995,9 @@ pidgin_debug_print(PurpleDebugLevel level, const char *category, s = tmp; } -#ifdef USE_REGEX /* add the text to the list store */ gtk_list_store_append(debug_win->store, &iter); gtk_list_store_set(debug_win->store, &iter, 0, s, 1, level, -1); -#else /* USE_REGEX */ - if(!debug_win->paused && level >= purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) - gtk_imhtml_append_text(GTK_IMHTML(debug_win->text), s, 0); -#endif /* !USE_REGEX */ g_free(s); } -- cgit v1.2.1 From 28b13576f46110474992fa58739a3865a9d24c9e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 21 Jul 2012 03:02:07 -0400 Subject: Don't compile Debug Window regex with G_REGEX_EXTENDED. That flag causes whitespace to be ignored, and I don't think a user typing stuff in the entry would expect that. --- pidgin/gtkdebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index 1469d573b5..367b8c0352 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -340,7 +340,7 @@ regex_compile(DebugWindow *win) { if (win->regex) g_regex_unref(win->regex); - win->regex = g_regex_new(text, G_REGEX_EXTENDED | G_REGEX_CASELESS, 0, NULL); + win->regex = g_regex_new(text, G_REGEX_CASELESS, 0, NULL); if(win->regex == NULL) { /* failed to compile */ regex_change_color(win->expression, 0xFFFF, 0xAFFF, 0xAFFF); -- cgit v1.2.1 From 7537521880b6ceb09084cac2cd40ff65772c4413 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 21 Jul 2012 03:16:36 -0400 Subject: Better handling of parenthesized searches. Previously, the entire matched text was highlighted (match 0), and all parenthesized matches were also highlighted, except for the first (match 1). However, highlighting the first match hid any of the parentheized matches. Now, if there are parenthesized matches, those are the only ones highlighted, instead of the whole thing. --- pidgin/gtkdebug.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index 367b8c0352..6f82ef6e29 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -234,18 +234,21 @@ regex_match(DebugWindow *win, const gchar *text) { */ do { - gint m; + gint m, count; gint start_pos, end_pos; GtkTextIter ms, me; if (!g_match_info_matches(match_info)) break; - for (m = 0; m < g_match_info_get_match_count(match_info); m++) - { - if (m == 1) - continue; + count = g_match_info_get_match_count(match_info); + if (count == 1) + m = 0; + else + m = 1; + for (; m < count; m++) + { g_match_info_fetch_pos(match_info, m, &start_pos, &end_pos); if (end_pos == -1) -- cgit v1.2.1 From f918b3765c96f5168d4e108b7cca3937371d242c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 22 Jul 2012 01:01:28 -0400 Subject: Convert the Debug Window to a GtkWebView. --- pidgin/gtkdebug.c | 476 +++++++++++++++++++++++++++++------------------------- 1 file changed, 252 insertions(+), 224 deletions(-) diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c index 6f82ef6e29..da51277b50 100644 --- a/pidgin/gtkdebug.c +++ b/pidgin/gtkdebug.c @@ -33,8 +33,8 @@ #include "gtkdebug.h" #include "gtkdialogs.h" -#include "gtkimhtml.h" #include "gtkutils.h" +#include "gtkwebview.h" #include "pidginstock.h" #include @@ -47,8 +47,6 @@ typedef struct GtkWidget *expression; GtkWidget *filterlevel; - GtkListStore *store; - gboolean paused; gboolean invert; @@ -57,21 +55,30 @@ typedef struct GRegex *regex; } DebugWindow; -static const char debug_fg_colors[][8] = { - "#000000", /**< All debug levels. */ - "#666666", /**< Misc. */ - "#000000", /**< Information. */ - "#660000", /**< Warnings. */ - "#FF0000", /**< Errors. */ - "#FF0000", /**< Fatal errors. */ -}; +#define EMPTY_HTML \ + "" static DebugWindow *debug_win = NULL; static guint debug_enabled_timer = 0; -static void regex_filter_all(DebugWindow *win); -static void regex_show_all(DebugWindow *win); - static gint debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) { @@ -125,7 +132,7 @@ save_writefile_cb(void *user_data, const char *filename) return; } - tmp = gtk_imhtml_get_text(GTK_IMHTML(win->text), NULL, NULL); + tmp = gtk_webview_get_body_text(GTK_WEBVIEW(win->text)); fprintf(fp, "Pidgin Debug Log : %s\n", purple_date_format_full(NULL)); fprintf(fp, "%s", tmp); g_free(tmp); @@ -145,9 +152,7 @@ save_cb(GtkWidget *w, DebugWindow *win) static void clear_cb(GtkWidget *w, DebugWindow *win) { - gtk_imhtml_clear(GTK_IMHTML(win->text)); - - gtk_list_store_clear(win->store); + gtk_webview_load_html_string(GTK_WEBVIEW(win->text), EMPTY_HTML); } static void @@ -155,11 +160,19 @@ pause_cb(GtkWidget *w, DebugWindow *win) { win->paused = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w)); - if(!win->paused) { - if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) - regex_filter_all(win); - else - regex_show_all(win); + if (win->paused) { + gtk_webview_append_html(GTK_WEBVIEW(win->text), "
    "); + } else { + WebKitDOMDocument *dom; + WebKitDOMElement *pause; + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(win->text)); + pause = webkit_dom_document_get_element_by_id(dom, "pause"); + if (pause) { + WebKitDOMNode *parent; + parent = webkit_dom_node_get_parent_node(WEBKIT_DOM_NODE(pause)); + webkit_dom_node_remove_child(parent, WEBKIT_DOM_NODE(pause), NULL); + } } } @@ -183,22 +196,133 @@ regex_change_color(GtkWidget *w, guint16 r, guint16 g, guint16 b) { } static void -regex_highlight_clear(DebugWindow *win) { - GtkIMHtml *imhtml = GTK_IMHTML(win->text); - GtkTextIter s, e; +regex_toggle_div(WebKitDOMNode *div) +{ + WebKitDOMDOMTokenList *classes; + + if (!WEBKIT_DOM_IS_HTML_ELEMENT(div)) + return; - gtk_text_buffer_get_start_iter(imhtml->text_buffer, &s); - gtk_text_buffer_get_end_iter(imhtml->text_buffer, &e); - gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "regex", &s, &e); + classes = webkit_dom_html_element_get_class_list(WEBKIT_DOM_HTML_ELEMENT(div)); + webkit_dom_dom_token_list_toggle(classes, "hide", NULL); } static void -regex_match(DebugWindow *win, const gchar *text) { - GtkIMHtml *imhtml = GTK_IMHTML(win->text); +regex_highlight_clear(WebKitDOMDocument *dom) +{ + WebKitDOMNodeList *nodes; + gulong i; + + /* Remove highlighting SPANs */ + nodes = webkit_dom_document_get_elements_by_class_name(dom, "regex"); + i = webkit_dom_node_list_get_length(nodes); + while (i--) { + WebKitDOMNode *span, *parent; + char *content; + WebKitDOMText *text; + GError *err = NULL; + + span = webkit_dom_node_list_item(nodes, i); + parent = webkit_dom_node_get_parent_node(span); + + content = webkit_dom_node_get_text_content(span); + text = webkit_dom_document_create_text_node(dom, content); + g_free(content); + + webkit_dom_node_replace_child(parent, WEBKIT_DOM_NODE(text), span, &err); + } +} + +static void +regex_highlight_text_nodes(WebKitDOMDocument *dom, WebKitDOMNode *div, + gint start_pos, gint end_pos) +{ + GSList *data = NULL; + WebKitDOMNode *node; + WebKitDOMRange *range; + WebKitDOMElement *span; + gint ind, end_ind; + gint this_start, this_end; + + ind = 0; + webkit_dom_node_normalize(div); + node = div; + + /* First, find the container nodes and offsets to apply highlighting. */ + do { + if (webkit_dom_node_get_node_type(node) == 3/*TEXT_NODE*/) { + /* The GObject model does not correctly reflect the type, hence the + regular cast. */ + end_ind = ind + webkit_dom_character_data_get_length((WebKitDOMCharacterData*)node); + + if (start_pos <= ind) + this_start = 0; + else if (start_pos < end_ind) + this_start = start_pos - ind; + else + this_start = -1; + + if (end_pos < end_ind) + this_end = end_pos - ind; + else + this_end = end_ind - ind; + + if (this_start != -1 && this_start < this_end) { + data = g_slist_prepend(data, GINT_TO_POINTER(this_end)); + data = g_slist_prepend(data, GINT_TO_POINTER(this_start)); + data = g_slist_prepend(data, node); + } + + ind = end_ind; + } + + if (webkit_dom_node_has_child_nodes(node)) { + node = webkit_dom_node_get_first_child(node); + } else { + while (node != div) { + WebKitDOMNode *next; + + next = webkit_dom_node_get_next_sibling(node); + if (next) { + node = next; + break; + } else { + node = webkit_dom_node_get_parent_node(node); + } + } + } + } while (node != div); + + /* Second, apply highlighting to saved sections. Changing the DOM is + automatically reflected in all WebKit API, so we have to do this after + finding the offsets, or things could get complicated. */ + while (data) { + node = WEBKIT_DOM_NODE(data->data); + data = g_slist_delete_link(data, data); + this_start = GPOINTER_TO_INT(data->data); + data = g_slist_delete_link(data, data); + this_end = GPOINTER_TO_INT(data->data); + data = g_slist_delete_link(data, data); + + range = webkit_dom_document_create_range(dom); + webkit_dom_range_set_start(range, node, this_start, NULL); + webkit_dom_range_set_end(range, node, this_end, NULL); + span = webkit_dom_document_create_element(dom, "span", NULL); + webkit_dom_html_element_set_class_name(WEBKIT_DOM_HTML_ELEMENT(span), + "regex"); + webkit_dom_range_surround_contents(range, WEBKIT_DOM_NODE(span), NULL); + } +} + +static void +regex_match(DebugWindow *win, WebKitDOMDocument *dom, WebKitDOMNode *div) +{ GMatchInfo *match_info; + gchar *text; gchar *plaintext; - if(!text) + text = webkit_dom_node_get_text_content(div); + if (!text) return; /* I don't like having to do this, but we need it for highlighting. Plus @@ -206,37 +330,22 @@ regex_match(DebugWindow *win, const gchar *text) { */ plaintext = purple_markup_strip_html(text); - /* we do a first pass to see if it matches at all. If it does we append - * it, and work out the offsets to highlight. + /* We do a first pass to see if it matches at all. If it does we work out + * the offsets to highlight. */ - if(g_regex_match(win->regex, plaintext, 0, &match_info) != win->invert) { - gchar *p = plaintext; - GtkTextIter ins; - gint i, offset = 0; - - gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &ins, - gtk_text_buffer_get_insert(imhtml->text_buffer)); - i = gtk_text_iter_get_offset(&ins); - - gtk_imhtml_append_text(imhtml, text, 0); - + if (g_regex_match(win->regex, plaintext, 0, &match_info) != win->invert) { /* If we're not highlighting or the expression is inverted, we're * done and move on. */ - if(!win->highlight || win->invert) { + if (!win->highlight || win->invert) { g_free(plaintext); g_match_info_free(match_info); return; } - /* we use a do-while to highlight the first match, and then continue - * if necessary... - */ - do - { + do { gint m, count; gint start_pos, end_pos; - GtkTextIter ms, me; if (!g_match_info_matches(match_info)) break; @@ -254,111 +363,47 @@ regex_match(DebugWindow *win, const gchar *text) { if (end_pos == -1) break; - gtk_text_buffer_get_iter_at_offset(imhtml->text_buffer, &ms, - i + start_pos); - gtk_text_buffer_get_iter_at_offset(imhtml->text_buffer, &me, - i + end_pos); - gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "regex", - &ms, &me); - offset = end_pos; + regex_highlight_text_nodes(dom, div, start_pos, end_pos); } + } while (g_match_info_next(match_info, NULL)); - g_match_info_free(match_info); - p += offset; - i += offset; - } while (g_regex_match(win->regex, p, G_REGEX_MATCH_NOTBOL, &match_info) != win->invert); g_match_info_free(match_info); + } else { + regex_toggle_div(div); } g_free(plaintext); -} - -static gboolean -regex_filter_all_cb(GtkTreeModel *m, GtkTreePath *p, GtkTreeIter *iter, - gpointer data) -{ - DebugWindow *win = (DebugWindow *)data; - gchar *text; - PurpleDebugLevel level; - - gtk_tree_model_get(m, iter, 0, &text, 1, &level, -1); - - if (level >= purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) - regex_match(win, text); - g_free(text); - - return FALSE; } static void -regex_filter_all(DebugWindow *win) { - gtk_imhtml_clear(GTK_IMHTML(win->text)); - - if(win->highlight) - regex_highlight_clear(win); - - gtk_tree_model_foreach(GTK_TREE_MODEL(win->store), regex_filter_all_cb, - win); -} - -static gboolean -regex_show_all_cb(GtkTreeModel *m, GtkTreePath *p, GtkTreeIter *iter, - gpointer data) +regex_toggle_filter(DebugWindow *win, gboolean filter) { - DebugWindow *win = (DebugWindow *)data; - gchar *text; - PurpleDebugLevel level; + WebKitDOMDocument *dom; + WebKitDOMNodeList *list; + gulong i; - gtk_tree_model_get(m, iter, 0, &text, 1, &level, -1); - if (level >= purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) - gtk_imhtml_append_text(GTK_IMHTML(win->text), text, 0); - g_free(text); + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(win->text)); - return FALSE; -} - -static void -regex_show_all(DebugWindow *win) { - gtk_imhtml_clear(GTK_IMHTML(win->text)); - - if(win->highlight) - regex_highlight_clear(win); + if (win->highlight) + regex_highlight_clear(dom); - gtk_tree_model_foreach(GTK_TREE_MODEL(win->store), regex_show_all_cb, - win); -} - -static void -regex_compile(DebugWindow *win) { - const gchar *text; - - text = gtk_entry_get_text(GTK_ENTRY(win->expression)); - - if(text == NULL || *text == '\0') { - regex_clear_color(win->expression); - gtk_widget_set_sensitive(win->filter, FALSE); - return; + /* Re-show debug lines that didn't match regex */ + list = webkit_dom_document_get_elements_by_class_name(dom, "hide"); + i = webkit_dom_node_list_get_length(list); + while (i--) { + WebKitDOMNode *div = webkit_dom_node_list_item(list, i); + regex_toggle_div(div); } - if (win->regex) - g_regex_unref(win->regex); - win->regex = g_regex_new(text, G_REGEX_CASELESS, 0, NULL); - if(win->regex == NULL) { - /* failed to compile */ - regex_change_color(win->expression, 0xFFFF, 0xAFFF, 0xAFFF); - gtk_widget_set_sensitive(win->filter, FALSE); - } else { - /* compiled successfully */ - regex_change_color(win->expression, 0xAFFF, 0xFFFF, 0xAFFF); - gtk_widget_set_sensitive(win->filter, TRUE); - } + if (filter) { + list = webkit_dom_document_get_elements_by_tag_name(dom, "div"); - /* we check if the filter is on in case it was only of the options that - * got changed, and not the expression. - */ - if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) - regex_filter_all(win); + for (i = 0; i < webkit_dom_node_list_get_length(list); i++) { + WebKitDOMNode *div = webkit_dom_node_list_item(list, i); + regex_match(win, dom, div); + } + } } static void @@ -368,11 +413,11 @@ regex_pref_filter_cb(const gchar *name, PurplePrefType type, DebugWindow *win = (DebugWindow *)data; gboolean active = GPOINTER_TO_INT(val), current; - if(!win || !win->window) + if (!win || !win->window) return; current = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)); - if(active != current) + if (active != current) gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter), active); } @@ -395,8 +440,8 @@ regex_pref_invert_cb(const gchar *name, PurplePrefType type, win->invert = active; - if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) - regex_filter_all(win); + if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) + regex_toggle_filter(win, TRUE); } static void @@ -408,40 +453,8 @@ regex_pref_highlight_cb(const gchar *name, PurplePrefType type, win->highlight = active; - if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) - regex_filter_all(win); -} - -static void -regex_row_changed_cb(GtkTreeModel *model, GtkTreePath *path, - GtkTreeIter *iter, DebugWindow *win) -{ - gchar *text; - PurpleDebugLevel level; - - if(!win || !win->window) - return; - - /* If the debug window is paused, we just return since it's in the store. - * We don't call regex_match because it doesn't make sense to check the - * string if it's paused. When we unpause we clear the imhtml and - * reiterate over the store to handle matches that were outputted when - * we were paused. - */ - if(win->paused) - return; - - gtk_tree_model_get(model, iter, 0, &text, 1, &level, -1); - - if (level >= purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) { - if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) { - regex_match(win, text); - } else { - gtk_imhtml_append_text(GTK_IMHTML(win->text), text, 0); - } - } - - g_free(text); + if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) + regex_toggle_filter(win, TRUE); } static gboolean @@ -458,15 +471,36 @@ regex_timer_cb(DebugWindow *win) { static void regex_changed_cb(GtkWidget *w, DebugWindow *win) { - if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) { + const gchar *text; + + if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter), FALSE); } - if(win->timer == 0) + if (win->timer == 0) win->timer = purple_timeout_add_seconds(5, (GSourceFunc)regex_timer_cb, win); - regex_compile(win); + text = gtk_entry_get_text(GTK_ENTRY(win->expression)); + + if (text == NULL || *text == '\0') { + regex_clear_color(win->expression); + gtk_widget_set_sensitive(win->filter, FALSE); + return; + } + + if (win->regex) + g_regex_unref(win->regex); + win->regex = g_regex_new(text, G_REGEX_CASELESS, 0, NULL); + if (win->regex == NULL) { + /* failed to compile */ + regex_change_color(win->expression, 0xFFFF, 0xAFFF, 0xAFFF); + gtk_widget_set_sensitive(win->filter, FALSE); + } else { + /* compiled successfully */ + regex_change_color(win->expression, 0xAFFF, 0xFFFF, 0xAFFF); + gtk_widget_set_sensitive(win->filter, TRUE); + } } static void @@ -504,33 +538,37 @@ regex_popup_cb(GtkEntry *entry, GtkWidget *menu, DebugWindow *win) { } static void -regex_filter_toggled_cb(GtkToggleToolButton *button, DebugWindow *win) { +regex_filter_toggled_cb(GtkToggleToolButton *button, DebugWindow *win) +{ gboolean active; active = gtk_toggle_tool_button_get_active(button); purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/filter", active); - if(!GTK_IS_IMHTML(win->text)) + if (!GTK_IS_WEBVIEW(win->text)) return; - if(active) - regex_filter_all(win); - else - regex_show_all(win); + regex_toggle_filter(win, active); } static void filter_level_pref_changed(const char *name, PurplePrefType type, gconstpointer value, gpointer data) { DebugWindow *win = data; + WebKitDOMDocument *dom; + WebKitDOMHTMLElement *body; + int level = GPOINTER_TO_INT(value); + char *tmp; - if (GPOINTER_TO_INT(value) != gtk_combo_box_get_active(GTK_COMBO_BOX(win->filterlevel))) - gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), GPOINTER_TO_INT(value)); - if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) - regex_filter_all(win); - else - regex_show_all(win); + if (level != gtk_combo_box_get_active(GTK_COMBO_BOX(win->filterlevel))) + gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), level); + + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(win->text)); + body = webkit_dom_document_get_body(dom); + tmp = g_strdup_printf("l%d", level); + webkit_dom_html_element_set_class_name(body, tmp); + g_free(tmp); } static void @@ -617,17 +655,6 @@ debug_window_new(void) handle = pidgin_debug_get_handle(); - /* the list store for all the messages */ - win->store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); - - /* row-changed gets called when we do gtk_list_store_set, and row-inserted - * gets called with gtk_list_store_append, which is a - * completely empty row. So we just ignore row-inserted, and deal with row - * changed. -Gary - */ - g_signal_connect(G_OBJECT(win->store), "row-changed", - G_CALLBACK(regex_row_changed_cb), win); - /* Setup the vbox */ vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(win->window), vbox); @@ -783,18 +810,14 @@ debug_window_new(void) G_CALLBACK(filter_level_changed_cb), NULL); } - /* Add the gtkimhtml */ - frame = pidgin_create_imhtml(FALSE, &win->text, NULL, NULL); - gtk_imhtml_set_format_functions(GTK_IMHTML(win->text), - GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY ^ GTK_IMHTML_IMAGE); + /* Add the gtkwebview */ + frame = pidgin_create_webview(FALSE, &win->text, NULL, NULL); + gtk_webview_set_format_functions(GTK_WEBVIEW(win->text), + GTK_WEBVIEW_ALL ^ GTK_WEBVIEW_SMILEY ^ GTK_WEBVIEW_IMAGE); gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); gtk_widget_show(frame); - /* add the tag for regex highlighting */ - gtk_text_buffer_create_tag(GTK_IMHTML(win->text)->text_buffer, "regex", - "background", "#FFAFAF", - "weight", "bold", - NULL); + gtk_webview_load_html_string(GTK_WEBVIEW(win->text), EMPTY_HTML); gtk_widget_show_all(win->window); @@ -961,7 +984,6 @@ static void pidgin_debug_print(PurpleDebugLevel level, const char *category, const char *arg_s) { - GtkTreeIter iter; gchar *ts_s; gchar *esc_s, *cat_s, *tmp, *s; const char *mdate; @@ -984,24 +1006,29 @@ pidgin_debug_print(PurpleDebugLevel level, const char *category, tmp = purple_utf8_try_convert(arg_s); esc_s = g_markup_escape_text(tmp, -1); - s = g_strdup_printf("%s%s%s", - debug_fg_colors[level], ts_s, cat_s, esc_s); + s = g_strdup_printf("
    %s%s%s
    ", + level, ts_s, cat_s, esc_s); g_free(ts_s); g_free(cat_s); g_free(esc_s); g_free(tmp); - if (level == PURPLE_DEBUG_FATAL) { - tmp = g_strdup_printf("%s", s); - g_free(s); - s = tmp; + gtk_webview_append_html(GTK_WEBVIEW(debug_win->text), s); + + if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(debug_win->filter))) { + WebKitDOMDocument *dom = NULL; + WebKitDOMHTMLElement *body = NULL; + WebKitDOMNode *div = NULL; + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(debug_win->text)); + if (dom) + body = webkit_dom_document_get_body(dom); + if (body) + div = webkit_dom_node_get_last_child(WEBKIT_DOM_NODE(body)); + if (div) + regex_match(debug_win, dom, div); } - /* add the text to the list store */ - gtk_list_store_append(debug_win->store, &iter); - gtk_list_store_set(debug_win->store, &iter, 0, s, 1, level, -1); - g_free(s); } @@ -1034,3 +1061,4 @@ pidgin_debug_get_handle() { return &handle; } + -- cgit v1.2.1 From e9251ed86874e023604d70ff840c59d0aa618e37 Mon Sep 17 00:00:00 2001 From: Mark Barfield Date: Sun, 22 Jul 2012 02:03:36 -0400 Subject: Fix a crash when a MSN user is removed before its icon is loaded. Fixes #15217. Committer: Elliott Sales de Andrade --- libpurple/protocols/msn/userlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libpurple/protocols/msn/userlist.c b/libpurple/protocols/msn/userlist.c index 6ad7d670bc..32ea5c818b 100644 --- a/libpurple/protocols/msn/userlist.c +++ b/libpurple/protocols/msn/userlist.c @@ -263,6 +263,7 @@ void msn_userlist_remove_user(MsnUserList *userlist, MsnUser *user) { userlist->users = g_list_remove(userlist->users, user); + g_queue_remove(userlist->buddy_icon_requests, user); msn_user_unref(user); } -- cgit v1.2.1 From fb33654b9c630c47afa891778ec51eba6916de3f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 22 Jul 2012 02:55:18 -0400 Subject: Prevent crashing and stuff. --- pidgin/gtkwebview.c | 134 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 117 insertions(+), 17 deletions(-) diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c index 5d0003781a..7b26a11d21 100644 --- a/pidgin/gtkwebview.c +++ b/pidgin/gtkwebview.c @@ -513,7 +513,11 @@ gtk_webview_get_type(void) gboolean gtk_webview_is_empty(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewPriv *priv; + + g_return_val_if_fail(webview != NULL, TRUE); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); return priv->empty; } @@ -550,7 +554,11 @@ gtk_webview_quote_js_string(const char *text) void gtk_webview_safe_execute_script(GtkWebView *webview, const char *script) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewPriv *priv; + + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); g_queue_push_tail(priv->js_queue, g_strdup(script)); g_idle_add((GSourceFunc)process_js_script_queue, webview); } @@ -558,6 +566,8 @@ gtk_webview_safe_execute_script(GtkWebView *webview, const char *script) void gtk_webview_load_html_string(GtkWebView *webview, const char *html) { + g_return_if_fail(webview != NULL); + webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), html, NULL, NULL, "file:///"); } @@ -565,6 +575,8 @@ gtk_webview_load_html_string(GtkWebView *webview, const char *html) void gtk_webview_load_html_string_with_selection(GtkWebView *webview, const char *html) { + g_return_if_fail(webview != NULL); + gtk_webview_load_html_string(webview, html); gtk_webview_safe_execute_script(webview, "var s = window.getSelection();" @@ -582,9 +594,13 @@ gtk_webview_load_html_string_with_selection(GtkWebView *webview, const char *htm void gtk_webview_append_html(GtkWebView *webview, const char *html) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewPriv *priv; WebKitDOMDocument *doc; WebKitDOMHTMLElement *body; + + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); body = webkit_dom_document_get_body(doc); webkit_dom_html_element_insert_adjacent_html(body, "beforeend", html, NULL); @@ -594,14 +610,22 @@ gtk_webview_append_html(GtkWebView *webview, const char *html) void gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewPriv *priv; + + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); priv->vadj = vadj; } void gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewPriv *priv; + + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); if (priv->scroll_time) g_timer_destroy(priv->scroll_time); if (priv->scroll_src) @@ -618,10 +642,14 @@ gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) void gtk_webview_page_up(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - GtkAdjustment *vadj = priv->vadj; + GtkWebViewPriv *priv; + GtkAdjustment *vadj; gdouble scroll_val; + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); + vadj = priv->vadj; #if GTK_CHECK_VERSION(2,14,0) scroll_val = gtk_adjustment_get_value(vadj) - gtk_adjustment_get_page_size(vadj); scroll_val = MAX(scroll_val, gtk_adjustment_get_lower(vadj)); @@ -636,11 +664,15 @@ gtk_webview_page_up(GtkWebView *webview) void gtk_webview_page_down(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - GtkAdjustment *vadj = priv->vadj; + GtkWebViewPriv *priv; + GtkAdjustment *vadj; gdouble scroll_val; gdouble page_size; + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); + vadj = priv->vadj; #if GTK_CHECK_VERSION(2,14,0) page_size = gtk_adjustment_get_page_size(vadj); scroll_val = gtk_adjustment_get_value(vadj) + page_size; @@ -657,6 +689,8 @@ gtk_webview_page_down(GtkWebView *webview) void gtk_webview_set_editable(GtkWebView *webview, gboolean editable) { + g_return_if_fail(webview != NULL); + webkit_web_view_set_editable(WEBKIT_WEB_VIEW(webview), editable); if (editable) { @@ -674,6 +708,8 @@ gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) { GtkWebViewButtons buttons; + g_return_if_fail(webview != NULL); + if (flags & PURPLE_CONNECTION_HTML) { gboolean bold, italic, underline, strike; @@ -750,6 +786,8 @@ void pidgin_webview_set_spellcheck(GtkWebView *webview, gboolean enable) { WebKitWebSettings *settings; + + g_return_if_fail(webview != NULL); settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(webview)); g_object_set(G_OBJECT(settings), "enable-spell-checking", enable, NULL); @@ -759,15 +797,24 @@ pidgin_webview_set_spellcheck(GtkWebView *webview, gboolean enable) void gtk_webview_set_whole_buffer_formatting_only(GtkWebView *webview, gboolean wbfo) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewPriv *priv; + + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); priv->edit.wbfo = wbfo; } void gtk_webview_set_format_functions(GtkWebView *webview, GtkWebViewButtons buttons) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); - GObject *object = g_object_ref(G_OBJECT(webview)); + GtkWebViewPriv *priv; + GObject *object; + + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); + object = g_object_ref(G_OBJECT(webview)); priv->format_functions = buttons; g_signal_emit(object, signals[BUTTONS_UPDATE], 0, buttons); g_object_unref(object); @@ -780,6 +827,8 @@ gtk_webview_get_head_html(GtkWebView *webview) WebKitDOMHTMLHeadElement *head; gchar *html; + g_return_val_if_fail(webview != NULL, NULL); + doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); head = webkit_dom_document_get_head(doc); html = webkit_dom_html_element_get_inner_html(WEBKIT_DOM_HTML_ELEMENT(head)); @@ -794,6 +843,8 @@ gtk_webview_get_body_html(GtkWebView *webview) WebKitDOMHTMLElement *body; gchar *html; + g_return_val_if_fail(webview != NULL, NULL); + doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); body = webkit_dom_document_get_body(doc); html = webkit_dom_html_element_get_inner_html(body); @@ -808,6 +859,8 @@ gtk_webview_get_body_text(GtkWebView *webview) WebKitDOMHTMLElement *body; gchar *text; + g_return_val_if_fail(webview != NULL, NULL); + doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); body = webkit_dom_document_get_body(doc); text = webkit_dom_html_element_get_inner_text(body); @@ -823,6 +876,8 @@ gtk_webview_get_selected_text(GtkWebView *webview) WebKitDOMDOMSelection *sel; WebKitDOMRange *range; + g_return_val_if_fail(webview != NULL, NULL); + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); win = webkit_dom_document_get_default_view(dom); sel = webkit_dom_dom_window_get_selection(win); @@ -834,7 +889,11 @@ gtk_webview_get_selected_text(GtkWebView *webview) GtkWebViewButtons gtk_webview_get_format_functions(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewPriv *priv; + + g_return_val_if_fail(webview != NULL, 0); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); return priv->format_functions; } @@ -844,6 +903,9 @@ gtk_webview_get_current_format(GtkWebView *webview, gboolean *bold, gboolean *strike) { WebKitDOMDocument *dom; + + g_return_if_fail(webview != NULL); + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); if (bold) @@ -860,6 +922,9 @@ char * gtk_webview_get_current_fontface(GtkWebView *webview) { WebKitDOMDocument *dom; + + g_return_val_if_fail(webview != NULL, NULL); + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); return webkit_dom_document_query_command_value(dom, "fontName"); } @@ -868,6 +933,9 @@ char * gtk_webview_get_current_forecolor(GtkWebView *webview) { WebKitDOMDocument *dom; + + g_return_val_if_fail(webview != NULL, NULL); + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); return webkit_dom_document_query_command_value(dom, "foreColor"); } @@ -876,6 +944,9 @@ char * gtk_webview_get_current_backcolor(GtkWebView *webview) { WebKitDOMDocument *dom; + + g_return_val_if_fail(webview != NULL, NULL); + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); return webkit_dom_document_query_command_value(dom, "backColor"); } @@ -887,6 +958,8 @@ gtk_webview_get_current_fontsize(GtkWebView *webview) gchar *text; gint size; + g_return_val_if_fail(webview != NULL, 0); + dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); text = webkit_dom_document_query_command_value(dom, "fontSize"); size = atoi(text); @@ -906,6 +979,8 @@ gtk_webview_clear_formatting(GtkWebView *webview) { GObject *object; + g_return_if_fail(webview != NULL); + object = g_object_ref(G_OBJECT(webview)); g_signal_emit(object, signals[CLEAR_FORMAT], 0); g_object_unref(object); @@ -914,30 +989,36 @@ gtk_webview_clear_formatting(GtkWebView *webview) void gtk_webview_toggle_bold(GtkWebView *webview) { + g_return_if_fail(webview != NULL); emit_format_signal(webview, GTK_WEBVIEW_BOLD); } void gtk_webview_toggle_italic(GtkWebView *webview) { + g_return_if_fail(webview != NULL); emit_format_signal(webview, GTK_WEBVIEW_ITALIC); } void gtk_webview_toggle_underline(GtkWebView *webview) { + g_return_if_fail(webview != NULL); emit_format_signal(webview, GTK_WEBVIEW_UNDERLINE); } void gtk_webview_toggle_strike(GtkWebView *webview) { + g_return_if_fail(webview != NULL); emit_format_signal(webview, GTK_WEBVIEW_STRIKE); } gboolean gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) { + g_return_val_if_fail(webview != NULL, FALSE); + do_formatting(webview, "foreColor", color); emit_format_signal(webview, GTK_WEBVIEW_FORECOLOR); @@ -947,6 +1028,8 @@ gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) gboolean gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) { + g_return_val_if_fail(webview != NULL, FALSE); + do_formatting(webview, "backColor", color); emit_format_signal(webview, GTK_WEBVIEW_BACKCOLOR); @@ -956,6 +1039,8 @@ gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) gboolean gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) { + g_return_val_if_fail(webview != NULL, FALSE); + do_formatting(webview, "fontName", face); emit_format_signal(webview, GTK_WEBVIEW_FACE); @@ -965,7 +1050,11 @@ gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) void gtk_webview_font_set_size(GtkWebView *webview, gint size) { - char *tmp = g_strdup_printf("%d", size); + char *tmp; + + g_return_if_fail(webview != NULL); + + tmp = g_strdup_printf("%d", size); do_formatting(webview, "fontSize", tmp); emit_format_signal(webview, GTK_WEBVIEW_SHRINK|GTK_WEBVIEW_GROW); g_free(tmp); @@ -974,21 +1063,26 @@ gtk_webview_font_set_size(GtkWebView *webview, gint size) void gtk_webview_font_shrink(GtkWebView *webview) { + g_return_if_fail(webview != NULL); emit_format_signal(webview, GTK_WEBVIEW_SHRINK); } void gtk_webview_font_grow(GtkWebView *webview) { + g_return_if_fail(webview != NULL); emit_format_signal(webview, GTK_WEBVIEW_GROW); } void gtk_webview_insert_hr(GtkWebView *webview) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewPriv *priv; WebKitDOMDocument *dom; + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); priv->edit.block_changed = TRUE; @@ -999,10 +1093,13 @@ gtk_webview_insert_hr(GtkWebView *webview) void gtk_webview_insert_link(GtkWebView *webview, const char *url, const char *desc) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewPriv *priv; WebKitDOMDocument *dom; char *link; + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); link = g_strdup_printf("%s", url, desc ? desc : url); @@ -1015,10 +1112,13 @@ gtk_webview_insert_link(GtkWebView *webview, const char *url, const char *desc) void gtk_webview_insert_image(GtkWebView *webview, int id) { - GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); + GtkWebViewPriv *priv; WebKitDOMDocument *dom; char *img; + g_return_if_fail(webview != NULL); + + priv = GTK_WEBVIEW_GET_PRIVATE(webview); dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); img = g_strdup_printf("", id); -- cgit v1.2.1 From cdad2bebb66875fab523151b5966f630518a0213 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 22 Jul 2012 03:51:06 -0400 Subject: Add previous patch author to COPYRIGHT. --- COPYRIGHT | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT b/COPYRIGHT index 6fbc5d9b5b..f99b2ca41e 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -40,6 +40,7 @@ R. Tyler Ballance Chris Banal Luca Barbato Levi Bard +Mark Barfield Ryan Barrett Kevin Barry Lukas Barth -- cgit v1.2.1 From eb0d4428d67defa42955ffb800992a329a44365c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 22 Jul 2012 03:52:16 -0400 Subject: It's 2012 now. --- COPYRIGHT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COPYRIGHT b/COPYRIGHT index f99b2ca41e..bdd2b4a4ea 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -15,7 +15,7 @@ If concerns are raised as to the copyright holder of a particular piece of code, then that code should be traced through our version control system to see from where it came and who has modified it. -Copyright (C) 1998-2011 by the following: +Copyright (C) 1998-2012 by the following: Saleem Abdulrasool Jakub Adam -- cgit v1.2.1 From c18b226f56707f269977747909a3590a51694985 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 22 Jul 2012 04:02:53 -0400 Subject: Fixup READMEs a bit. --- README | 4 ++-- README.MTN | 33 --------------------------------- README.hg | 33 +++++++++++++++++++++++++++++++++ README.mingw | 2 +- 4 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 README.MTN create mode 100644 README.hg diff --git a/README b/README index c7ca60de7f..196300ac2f 100644 --- a/README +++ b/README @@ -6,7 +6,7 @@ libpurple is a library intended to be used by programmers seeking to write an IM client that connects to many IM networks. It supports AIM, ICQ, XMPP, MSN and Yahoo!, among others. -Pidgin is an graphical IM client written in C which uses the GTK+ +Pidgin is a graphical IM client written in C which uses the GTK+ toolkit. Finch is a text-based IM client written in C which uses the ncurses @@ -43,7 +43,7 @@ you only need to run 'pidgin' or 'finch'. To get started, simply add a new account. -If you come across a bug, please report it at: http://pidgin.im +If you come across a bug, please report it at: http://developer.pidgin.im PLUGINS ======= diff --git a/README.MTN b/README.MTN deleted file mode 100644 index 8dd78687ac..0000000000 --- a/README.MTN +++ /dev/null @@ -1,33 +0,0 @@ -If you plan to use Pidgin, Finch and libpurple from our Monotone repository, -PLEASE read this message in its entirety! - -Pidgin, Finch, and libpurple are a fast-moving project with a somewhat regular -release schedule. Due to the rate of development, the code in our Monotone -repository undergoes frequent bursts of massive changes, often leaving behind -brokenness and partial functionality while the responsible developers rewrite -some portion of code or seek to add new features. - -What this all boils down to is that the code in our Monotone repository _WILL_ -sometimes be broken. Because of this, we ask that users who are not interested -in personally tracking down bugs and fixing them (without a lot of -assistance from the developers!) use only released versions. Since releases -will be made often, this should not prevent anyone from using the newest, -shiniest features -- but it will prevent users from having to deal with ugly -development bugs that we already know about but haven't gotten around to fixing. - -If you are interested in hacking on Pidgin, Finch, and/or libpurple, please -check out the information available at: http://developer.pidgin.im - -By far the best documentation, however, is the documented code. If you have -doxygen, you can run "make docs" in the toplevel directory to generate pretty -documentation. Otherwise (or even if you do!), the header files for each -subsystem contain documentation for the functions they contain. For instance, -conversation.h contains documentation for the entire purple_conversation_* -API, and account.h contains documentation for the purple_account_* API. - -If you have questions, please feel free to contact the Pidgin, Finch, and -libpurple developers by email at devel@pidgin.im or on IRC at irc.freenode.net -in #pidgin. Please do as much homework as you can before contacting us; the -more you know about your question, the faster and more effectively we can help! - -Patches should be posted as Trac tickets at: http://developer.pidgin.im diff --git a/README.hg b/README.hg new file mode 100644 index 0000000000..3240314e86 --- /dev/null +++ b/README.hg @@ -0,0 +1,33 @@ +If you plan to use Pidgin, Finch and libpurple from our Mercurial repository, +PLEASE read this message in its entirety! + +Pidgin, Finch, and libpurple are a fast-moving project with a somewhat regular +release schedule. Due to the rate of development, the code in our Mercurial +repository undergoes frequent bursts of massive changes, often leaving behind +brokenness and partial functionality while the responsible developers rewrite +some portion of code or seek to add new features. + +What this all boils down to is that the code in our Mercurial repository _WILL_ +sometimes be broken. Because of this, we ask that users who are not interested +in personally tracking down bugs and fixing them (without a lot of +assistance from the developers!) use only released versions. Since releases +will be made often, this should not prevent anyone from using the newest, +shiniest features -- but it will prevent users from having to deal with ugly +development bugs that we already know about but haven't gotten around to fixing. + +If you are interested in hacking on Pidgin, Finch, and/or libpurple, please +check out the information available at: http://developer.pidgin.im + +By far the best documentation, however, is the documented code. If you have +doxygen, you can run "make docs" in the toplevel directory to generate pretty +documentation. Otherwise (or even if you do!), the header files for each +subsystem contain documentation for the functions they contain. For instance, +conversation.h contains documentation for the entire purple_conversation_* +API, and account.h contains documentation for the purple_account_* API. + +If you have questions, please feel free to contact the Pidgin, Finch, and +libpurple developers by email at devel@pidgin.im or on IRC at irc.freenode.net +in #pidgin. Please do as much homework as you can before contacting us; the +more you know about your question, the faster and more effectively we can help! + +Patches should be posted as Trac tickets at: http://developer.pidgin.im diff --git a/README.mingw b/README.mingw index fe557f755f..21a2026146 100644 --- a/README.mingw +++ b/README.mingw @@ -1,5 +1,5 @@ How to build Pidgin for Windows using MinGW -============================= +=========================================== For the latest build instructions, please refer to: -- cgit v1.2.1 From ca4fd42d3b6aa5c0943b10088d9002f32ccee7d3 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 22 Jul 2012 19:45:03 -0400 Subject: I don't know why this is necessary. --- pidgin/gtkrequest.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c index 3d1a13d0ad..ecd5870123 100644 --- a/pidgin/gtkrequest.c +++ b/pidgin/gtkrequest.c @@ -341,11 +341,6 @@ text_to_stock(const char *text) return text; } -static void stop_emission_cb(GtkDialog *dialog, const gchar *signal_name) -{ - gtk_signal_emit_stop_by_name(GTK_OBJECT(dialog), signal_name); -} - static void * pidgin_request_input(const char *title, const char *primary, const char *secondary, const char *default_value, @@ -660,8 +655,6 @@ pidgin_request_action_with_icon(const char *title, const char *primary, data->dialog = dialog = gtk_dialog_new(); gtk_window_set_deletable(GTK_WINDOW(data->dialog), FALSE); - g_signal_connect(G_OBJECT(dialog), "close", - G_CALLBACK(stop_emission_cb), "close"); if (title != NULL) gtk_window_set_title(GTK_WINDOW(dialog), title); -- cgit v1.2.1