Mercurial > pidgin
changeset 21679:a312781708e8
merge of '37d10660345bc1f2092492296caa8deaf84744b4'
and '727439d778b7d7f40aa0230cb9be26765e8d50a9'
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Wed, 28 Nov 2007 02:54:31 +0000 |
parents | a890a1574703 (current diff) bd36fdd36e92 (diff) |
children | 65f2a29617a2 |
files | |
diffstat | 6 files changed, 126 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c Wed Nov 28 02:52:30 2007 +0000 +++ b/libpurple/protocols/msn/notification.c Wed Nov 28 02:54:31 2007 +0000 @@ -1181,14 +1181,27 @@ static void rea_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { - /* TODO: This might be for us too */ - MsnSession *session; + PurpleAccount *account; PurpleConnection *gc; const char *friendly; + char *username; session = cmdproc->session; - gc = session->account->gc; + account = session->account; + username = g_strdup(purple_normalize(account, + purple_account_get_username(account))); + + /* Only set display name if our *own* friendly name changed! */ + if (strcmp(username, purple_normalize(account, cmd->params[2]))) + { + g_free(username); + return; + } + + g_free(username); + + gc = account->gc; friendly = purple_url_decode(cmd->params[3]); purple_connection_set_display_name(gc, friendly);
--- a/libpurple/protocols/msnp9/msn.c Wed Nov 28 02:52:30 2007 +0000 +++ b/libpurple/protocols/msnp9/msn.c Wed Nov 28 02:54:31 2007 +0000 @@ -1920,7 +1920,7 @@ purple_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n"); g_free(stripped); g_free(url_buffer); - g_free(user_info); + purple_notify_user_info_destroy(user_info); g_free(info_data->name); g_free(info_data); g_free(photo_url_text);
--- a/libpurple/protocols/msnp9/user.c Wed Nov 28 02:52:30 2007 +0000 +++ b/libpurple/protocols/msnp9/user.c Wed Nov 28 02:54:31 2007 +0000 @@ -126,16 +126,19 @@ msn_user_set_friendly_name(MsnUser *user, const char *name) { MsnCmdProc *cmdproc; + const char *encoded; g_return_if_fail(user != NULL); - if (user->friendly_name && strcmp(user->friendly_name, name)) { + encoded = purple_url_encode(name); + + if (user->friendly_name && strcmp(user->friendly_name, name) && (strlen(encoded) < 387)) { /* copy the new name to the server list, but only when new */ /* should we check this more thoroughly? */ cmdproc = user->userlist->session->notification->cmdproc; msn_cmdproc_send(cmdproc, "REA", "%s %s", user->passport, - purple_url_encode(name)); + encoded); } g_free(user->friendly_name);
--- a/pidgin/gtkblist.c Wed Nov 28 02:52:30 2007 +0000 +++ b/pidgin/gtkblist.c Wed Nov 28 02:54:31 2007 +0000 @@ -753,6 +753,11 @@ { case GTK_RESPONSE_OK: do_join_chat(info); + break; + + case 1: + pidgin_roomlist_dialog_show_with_account(info->account); + return; break; } @@ -769,6 +774,8 @@ static void joinchat_set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data) { + PurplePluginProtocolInfo *prpl_info; + PurpleConnection *gc; PidginJoinChatData *data; GList *tmp; const char *text; @@ -789,6 +796,12 @@ } gtk_dialog_set_response_sensitive(GTK_DIALOG(data->window), GTK_RESPONSE_OK, sensitive); + + gc = purple_account_get_connection(data->account); + prpl_info = (gc != NULL) ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; + sensitive = (prpl_info != NULL && prpl_info->roomlist_get_list != NULL); + + gtk_dialog_set_response_sensitive(GTK_DIALOG(data->window), 1, sensitive); } static void @@ -944,6 +957,7 @@ data->window = gtk_dialog_new_with_buttons(_("Join a Chat"), NULL, GTK_DIALOG_NO_SEPARATOR, + _("Room _List"), 1, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, PIDGIN_STOCK_CHAT, GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK); @@ -6392,6 +6406,10 @@ { add_chat_cb(NULL, data); } + else if (resp == 1) + { + pidgin_roomlist_dialog_show_with_account(data->account); + } else { gtk_widget_destroy(data->window); @@ -6408,6 +6426,8 @@ static void addchat_set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data) { + PurplePluginProtocolInfo *prpl_info; + PurpleConnection *gc; PidginAddChatData *data; GList *tmp; const char *text; @@ -6428,6 +6448,12 @@ } gtk_dialog_set_response_sensitive(GTK_DIALOG(data->window), GTK_RESPONSE_OK, sensitive); + + gc = purple_account_get_connection(data->account); + prpl_info = (gc != NULL) ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; + sensitive = (prpl_info != NULL && prpl_info->roomlist_get_list != NULL); + + gtk_dialog_set_response_sensitive(GTK_DIALOG(data->window), 1, sensitive); } static void @@ -6593,6 +6619,7 @@ data->window = gtk_dialog_new_with_buttons(_("Add Chat"), gtkblist ? GTK_WINDOW(gtkblist->window) : NULL, GTK_DIALOG_NO_SEPARATOR, + _("Room _List"), 1, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL); @@ -6676,8 +6703,8 @@ pidgin_set_accessible_label (data->group_combo, label); gtk_box_pack_end(GTK_BOX(rowbox), data->group_combo, TRUE, TRUE, 0); - data->autojoin = gtk_check_button_new_with_mnemonic(_("Autojoin when account becomes online.")); - data->persistent = gtk_check_button_new_with_mnemonic(_("Hide chat when the window is closed.")); + data->autojoin = gtk_check_button_new_with_mnemonic(_("Auto_join when account becomes online.")); + data->persistent = gtk_check_button_new_with_mnemonic(_("_Hide chat when the window is closed.")); gtk_box_pack_start(GTK_BOX(vbox), data->autojoin, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), data->persistent, FALSE, FALSE, 0);
--- a/pidgin/plugins/convcolors.c Wed Nov 28 02:52:30 2007 +0000 +++ b/pidgin/plugins/convcolors.c Wed Nov 28 02:54:31 2007 +0000 @@ -48,22 +48,27 @@ #define PREF_SEND PREF_PREFIX "/send" #define PREF_SEND_C PREF_SEND "/color" #define PREF_SEND_F PREF_SEND "/format" +#define PREF_SEND_E PREF_SEND "/enabled" #define PREF_RECV PREF_PREFIX "/recv" #define PREF_RECV_C PREF_RECV "/color" #define PREF_RECV_F PREF_RECV "/format" +#define PREF_RECV_E PREF_RECV "/enabled" #define PREF_SYSTEM PREF_PREFIX "/system" #define PREF_SYSTEM_C PREF_SYSTEM "/color" #define PREF_SYSTEM_F PREF_SYSTEM "/format" +#define PREF_SYSTEM_E PREF_SYSTEM "/enabled" #define PREF_ERROR PREF_PREFIX "/error" #define PREF_ERROR_C PREF_ERROR "/color" #define PREF_ERROR_F PREF_ERROR "/format" +#define PREF_ERROR_E PREF_ERROR "/enabled" #define PREF_NICK PREF_PREFIX "/nick" #define PREF_NICK_C PREF_NICK "/color" #define PREF_NICK_F PREF_NICK "/format" +#define PREF_NICK_E PREF_NICK "/enabled" enum { @@ -104,7 +109,10 @@ if (!formats[i].prefix) return FALSE; - if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && + g_snprintf(tmp, sizeof(tmp), "%s/enabled", formats[i].prefix); + + if (!purple_prefs_get_bool(tmp) || + (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS)) || (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS))) @@ -223,17 +231,29 @@ } static void +toggle_enabled(GtkWidget *widget, gpointer data) +{ + const char *prefix = (char *)data; + gboolean e; + char tmp[128]; + + g_snprintf(tmp, sizeof(tmp), "%s/enabled", prefix); + e = purple_prefs_get_bool(tmp); + purple_prefs_set_bool(tmp, !e); +} + +static void toggle_something(const char *prefix, int format) { int f; char tmp[128]; - + g_snprintf(tmp, sizeof(tmp), "%s/format", prefix); f = purple_prefs_get_int(tmp); f ^= format; purple_prefs_set_int(tmp, f); } - + static void toggle_bold(GtkWidget *widget, gpointer data) { @@ -252,6 +272,22 @@ toggle_something(data, FONT_UNDERLINE); } +static void +enable_toggled(const char *name, PurplePrefType type, gconstpointer val, gpointer data) +{ + GtkWidget *widget = (GtkWidget *)data; + + gtk_widget_set_sensitive(widget, GPOINTER_TO_INT(val)); +} + +static void +disconnect_prefs_callbacks(GtkObject *object, gpointer data) +{ + PurplePlugin *plugin = (PurplePlugin *)data; + + purple_prefs_disconnect_by_handle(plugin); +} + static GtkWidget * get_config_frame(PurplePlugin *plugin) { @@ -265,9 +301,14 @@ for (i = 0; formats[i].prefix; i++) { char tmp[128]; + char tmp2[128]; int f; + gboolean e; GtkWidget *vbox, *hbox, *button; + g_snprintf(tmp2, sizeof(tmp2), "%s/enabled", formats[i].prefix); + e = purple_prefs_get_bool(tmp2); + g_snprintf(tmp, sizeof(tmp), "%s/format", formats[i].prefix); f = purple_prefs_get_int(tmp); @@ -278,11 +319,20 @@ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + button = gtk_check_button_new_with_label(_("Enabled")); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + if (e) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(toggle_enabled), + formats[i].prefix); + button = pidgin_pixbuf_button_from_stock(" Color", GTK_STOCK_SELECT_COLOR, PIDGIN_BUTTON_HORIZONTAL); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_color), formats[i].prefix); + gtk_widget_set_sensitive(button, e); + purple_prefs_connect_callback(plugin, tmp2, enable_toggled, button); button = gtk_check_button_new_with_label(_("Bold")); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); @@ -290,22 +340,29 @@ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(toggle_bold), formats[i].prefix); - + gtk_widget_set_sensitive(button, e); + purple_prefs_connect_callback(plugin, tmp2, enable_toggled, button); + button = gtk_check_button_new_with_label(_("Italic")); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); if (f & FONT_ITALIC) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(toggle_italic), formats[i].prefix); - + gtk_widget_set_sensitive(button, e); + purple_prefs_connect_callback(plugin, tmp2, enable_toggled, button); + button = gtk_check_button_new_with_label(_("Underline")); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); if (f & FONT_UNDERLINE) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(toggle_underline), formats[i].prefix); + gtk_widget_set_sensitive(button, e); + purple_prefs_connect_callback(plugin, tmp2, enable_toggled, button); } + 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); @@ -388,6 +445,12 @@ purple_prefs_add_int(PREF_SYSTEM_F, FONT_ITALIC); purple_prefs_add_int(PREF_ERROR_F, FONT_BOLD | FONT_UNDERLINE); purple_prefs_add_int(PREF_NICK_F, FONT_BOLD); + + purple_prefs_add_bool(PREF_SEND_E, TRUE); + purple_prefs_add_bool(PREF_RECV_E, TRUE); + purple_prefs_add_bool(PREF_SYSTEM_E, TRUE); + purple_prefs_add_bool(PREF_ERROR_E, TRUE); + purple_prefs_add_bool(PREF_NICK_E, TRUE); } PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info)
--- a/pidgin/plugins/timestamp.c Wed Nov 28 02:52:30 2007 +0000 +++ b/pidgin/plugins/timestamp.c Wed Nov 28 02:54:31 2007 +0000 @@ -49,11 +49,17 @@ const char *mdate; int y, height; GdkRectangle rect; - + /* display timestamp */ mdate = purple_utf8_strftime(then == 0 ? "%H:%M" : "\n%H:%M", localtime(&now)); gtk_text_buffer_get_end_iter(buffer, &iter); + + if (gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), "TIMESTAMP") == NULL) + gtk_text_buffer_create_tag(buffer, "TIMESTAMP", + "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, + "weight", PANGO_WEIGHT_BOLD, NULL); + gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mdate, strlen(mdate), "TIMESTAMP", NULL); @@ -95,17 +101,9 @@ static void timestamp_new_convo(PurpleConversation *conv) { - PidginConversation *gtk_conv = PIDGIN_CONVERSATION(conv); - GtkTextBuffer *buffer; - if (!g_list_find(purple_get_conversations(), conv)) return; - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtk_conv->imhtml)); - gtk_text_buffer_create_tag(buffer, "TIMESTAMP", - "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, - "weight", PANGO_WEIGHT_BOLD, NULL); - purple_conversation_set_data(conv, "timestamp-last", GINT_TO_POINTER(0)); }