You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(106) |
Oct
(334) |
Nov
(246) |
Dec
(145) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(42) |
Feb
(53) |
Mar
(232) |
Apr
(109) |
May
(137) |
Jun
(63) |
Jul
(26) |
Aug
(263) |
Sep
(193) |
Oct
(507) |
Nov
(440) |
Dec
(241) |
2003 |
Jan
(567) |
Feb
(195) |
Mar
(504) |
Apr
(481) |
May
(524) |
Jun
(522) |
Jul
(594) |
Aug
(502) |
Sep
(643) |
Oct
(508) |
Nov
(430) |
Dec
(377) |
2004 |
Jan
(361) |
Feb
(251) |
Mar
(219) |
Apr
(499) |
May
(461) |
Jun
(419) |
Jul
(314) |
Aug
(519) |
Sep
(416) |
Oct
(247) |
Nov
(305) |
Dec
(382) |
2005 |
Jan
(267) |
Feb
(282) |
Mar
(327) |
Apr
(338) |
May
(189) |
Jun
(400) |
Jul
(462) |
Aug
(530) |
Sep
(316) |
Oct
(523) |
Nov
(481) |
Dec
(650) |
2006 |
Jan
(536) |
Feb
(361) |
Mar
(287) |
Apr
(146) |
May
(101) |
Jun
(169) |
Jul
(221) |
Aug
(498) |
Sep
(300) |
Oct
(236) |
Nov
(209) |
Dec
(205) |
2007 |
Jan
(30) |
Feb
(23) |
Mar
(26) |
Apr
(15) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <the...@us...> - 2006-07-16 16:59:44
|
Revision: 16495 Author: thekingant Date: 2006-07-16 09:59:27 -0700 (Sun, 16 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16495&view=rev Log Message: ----------- Backport SVN revision #16494 from HEAD to v2_0_0 Original commit message: Only do something about formatted screen names for AIM, not ICQ ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16494&view=rev Modified Paths: -------------- branches/v2_0_0/src/protocols/oscar/oscar.c Modified: branches/v2_0_0/src/protocols/oscar/oscar.c =================================================================== --- branches/v2_0_0/src/protocols/oscar/oscar.c 2006-07-16 16:59:10 UTC (rev 16494) +++ branches/v2_0_0/src/protocols/oscar/oscar.c 2006-07-16 16:59:27 UTC (rev 16495) @@ -2915,10 +2915,13 @@ if (b == NULL) return 1; - if (strcmp(gaim_buddy_get_name(b), userinfo->sn)) - serv_got_alias(gc, gaim_buddy_get_name(b), userinfo->sn); - else - serv_got_alias(gc, gaim_buddy_get_name(b), NULL); + if (!aim_sn_is_icq(userinfo->sn)) + { + if (strcmp(gaim_buddy_get_name(b), userinfo->sn)) + serv_got_alias(gc, gaim_buddy_get_name(b), userinfo->sn); + else + serv_got_alias(gc, gaim_buddy_get_name(b), NULL); + } presence = gaim_buddy_get_presence(b); status = gaim_presence_get_active_status(presence); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-16 16:59:44
|
Revision: 16494 Author: thekingant Date: 2006-07-16 09:59:10 -0700 (Sun, 16 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16494&view=rev Log Message: ----------- Only do something about formatted screen names for AIM, not ICQ Modified Paths: -------------- trunk/src/protocols/oscar/oscar.c Modified: trunk/src/protocols/oscar/oscar.c =================================================================== --- trunk/src/protocols/oscar/oscar.c 2006-07-16 16:47:44 UTC (rev 16493) +++ trunk/src/protocols/oscar/oscar.c 2006-07-16 16:59:10 UTC (rev 16494) @@ -2916,10 +2916,13 @@ if (b == NULL) return 1; - if (strcmp(gaim_buddy_get_name(b), userinfo->sn)) - serv_got_alias(gc, gaim_buddy_get_name(b), userinfo->sn); - else - serv_got_alias(gc, gaim_buddy_get_name(b), NULL); + if (!aim_sn_is_icq(userinfo->sn)) + { + if (strcmp(gaim_buddy_get_name(b), userinfo->sn)) + serv_got_alias(gc, gaim_buddy_get_name(b), userinfo->sn); + else + serv_got_alias(gc, gaim_buddy_get_name(b), NULL); + } presence = gaim_buddy_get_presence(b); status = gaim_presence_get_active_status(presence); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-16 16:48:23
|
Revision: 16493 Author: thekingant Date: 2006-07-16 09:47:44 -0700 (Sun, 16 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16493&view=rev Log Message: ----------- Backport SVN revision 16492 from HEAD to v2_0_0 Original commit message: Fix a casting warning on 64-bit machines ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16492&view=rev Modified Paths: -------------- branches/v2_0_0/src/protocols/oscar/oscar.c Modified: branches/v2_0_0/src/protocols/oscar/oscar.c =================================================================== --- branches/v2_0_0/src/protocols/oscar/oscar.c 2006-07-16 16:46:31 UTC (rev 16492) +++ branches/v2_0_0/src/protocols/oscar/oscar.c 2006-07-16 16:47:44 UTC (rev 16493) @@ -1629,7 +1629,7 @@ separator = strchr(redir->ip, ':'); if (separator != NULL) { - host = g_strndup(redir->ip, (int)separator - (int)redir->ip); + host = g_strndup(redir->ip, separator - redir->ip); port = atoi(separator + 1); } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-16 16:46:43
|
Revision: 16492 Author: thekingant Date: 2006-07-16 09:46:31 -0700 (Sun, 16 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16492&view=rev Log Message: ----------- Fix a casting warning on 64-bit machines Modified Paths: -------------- trunk/src/protocols/oscar/oscar.c Modified: trunk/src/protocols/oscar/oscar.c =================================================================== --- trunk/src/protocols/oscar/oscar.c 2006-07-13 19:43:37 UTC (rev 16491) +++ trunk/src/protocols/oscar/oscar.c 2006-07-16 16:46:31 UTC (rev 16492) @@ -1629,7 +1629,7 @@ separator = strchr(redir->ip, ':'); if (separator != NULL) { - host = g_strndup(redir->ip, (int)separator - (int)redir->ip); + host = g_strndup(redir->ip, separator - redir->ip); port = atoi(separator + 1); } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aar...@us...> - 2006-07-13 19:43:41
|
Revision: 16491 Author: aaronsheldon Date: 2006-07-13 12:43:37 -0700 (Thu, 13 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16491&view=rev Log Message: ----------- Bugfix for resorting list with an expanded buddy, now ought to be about twice as fast for resorts since we don't do it twice anymore, no longer does some unncessary updates on buddys. Every call to gaim_gtk_blist_node(...., TRUE) is unchecked to see if FALSE (faster) will work. TRUE matches the old behavior. Modified Paths: -------------- branches/soc-2006-blist-efficiency/src/gtkblist.c Modified: branches/soc-2006-blist-efficiency/src/gtkblist.c =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-12 23:53:29 UTC (rev 16490) +++ branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-13 19:43:37 UTC (rev 16491) @@ -3164,7 +3164,7 @@ return TRUE; } -static void gaim_gtk_blist_hide_node(GaimBuddyList *list, GaimBlistNode *node) +static void gaim_gtk_blist_hide_node(GaimBuddyList *list, GaimBlistNode *node, gboolean update) { struct _gaim_gtk_blist_node *gtknode = (struct _gaim_gtk_blist_node *)node->ui_data; GtkTreeIter iter; @@ -3176,8 +3176,8 @@ gtkblist->selected_node = NULL; if (get_iter_from_node(node, &iter)) { gtk_tree_store_remove(gtkblist->treemodel, &iter); - if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node) - || GAIM_BLIST_NODE_IS_CHAT(node)) { + if(update && (GAIM_BLIST_NODE_IS_CONTACT(node) || + GAIM_BLIST_NODE_IS_BUDDY(node) || GAIM_BLIST_NODE_IS_CHAT(node))) { gaim_gtk_blist_update(list, node->parent); } } @@ -3448,7 +3448,7 @@ gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); } - redo_buddy_list(gaim_get_blist(), TRUE); + redo_buddy_list(gaim_get_blist(), FALSE); #if GTK_CHECK_VERSION(2,6,0) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview)); #endif @@ -3994,11 +3994,15 @@ while (node) { + /* This is only needed when we're reverting to a non-GTK+ sorted + * status. We shouldn't need to remove otherwise. + */ + if (remove && !GAIM_BLIST_NODE_IS_GROUP(node)) - gaim_gtk_blist_hide_node(list, node); + gaim_gtk_blist_hide_node(list, node, FALSE); if (GAIM_BLIST_NODE_IS_BUDDY(node)) - gaim_gtk_blist_update_contact(list, node); + gaim_gtk_blist_update_buddy(list, node); else if (GAIM_BLIST_NODE_IS_CHAT(node)) gaim_gtk_blist_update(list, node); node = gaim_blist_node_next(node, FALSE); @@ -4060,7 +4064,7 @@ gaim_request_close_with_handle(node); - gaim_gtk_blist_hide_node(list, node); + gaim_gtk_blist_hide_node(list, node, TRUE); if(node->parent) gaim_gtk_blist_update(list, node->parent); @@ -4228,7 +4232,7 @@ -1); g_free(mark); } else { - gaim_gtk_blist_hide_node(list, gnode); + gaim_gtk_blist_hide_node(list, gnode, TRUE); } } @@ -4350,7 +4354,7 @@ buddy_node(buddy, &iter, cnode); } } else { - gaim_gtk_blist_hide_node(list, cnode); + gaim_gtk_blist_hide_node(list, cnode, TRUE); } } @@ -4383,7 +4387,7 @@ buddy_node(buddy, &iter, node); } else { - gaim_gtk_blist_hide_node(list, node); + gaim_gtk_blist_hide_node(list, node, TRUE); } } @@ -4423,7 +4427,7 @@ if(status) g_object_unref(status); } else { - gaim_gtk_blist_hide_node(list, node); + gaim_gtk_blist_hide_node(list, node, TRUE); } } @@ -5353,8 +5357,11 @@ gaim_gtk_blist_sort_method_set("none"); return; } - redo_buddy_list(gaim_get_blist(), TRUE); - + if (!strcmp(id, "none")) { + redo_buddy_list(gaim_get_blist(), TRUE); + } else { + redo_buddy_list(gaim_get_blist(), FALSE); + } } /****************************************** @@ -5919,8 +5926,8 @@ if (gtk_check_menu_item_get_active(checkmenuitem)) { gaim_gtk_set_cursor(gtkblist->window, GDK_WATCH); - - gaim_gtk_blist_sort_method_set(id); + /* This is redundant. I think. */ + /* gaim_gtk_blist_sort_method_set(id); */ gaim_prefs_set_string("/gaim/gtk/blist/sort_type", id); gaim_gtk_clear_cursor(gtkblist->window); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <amc...@us...> - 2006-07-12 23:53:32
|
Revision: 16490 Author: amc_grim Date: 2006-07-12 16:53:29 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16490&view=rev Log Message: ----------- Patch from sadrul for: If you have a markup "abc </i> def", then the "def" part of the message shows up in italic. The same error happens for broken markup for underline/bold attributes. This patch is a fix that. Compile fine here... Modified Paths: -------------- branches/v2_0_0/src/gtkimhtml.c Modified: branches/v2_0_0/src/gtkimhtml.c =================================================================== --- branches/v2_0_0/src/gtkimhtml.c 2006-07-12 23:52:56 UTC (rev 16489) +++ branches/v2_0_0/src/gtkimhtml.c 2006-07-12 23:53:29 UTC (rev 16490) @@ -2461,10 +2461,11 @@ gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); ws[0] = '\0'; wpos = 0; - if (bold) + if (bold) { bold--; - if ((bold == 0) && (imhtml->format_functions & GTK_IMHTML_BOLD) && !imhtml->wbfo) - gtk_imhtml_toggle_bold(imhtml); + if ((bold == 0) && (imhtml->format_functions & GTK_IMHTML_BOLD) && !imhtml->wbfo) + gtk_imhtml_toggle_bold(imhtml); + } } break; case 5: /* I */ @@ -2484,10 +2485,11 @@ if (!(options & GTK_IMHTML_NO_FORMATTING)) { gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); ws[0] = '\0'; wpos = 0; - if (italics) + if (italics) { italics--; - if ((italics == 0) && (imhtml->format_functions & GTK_IMHTML_ITALIC) && !imhtml->wbfo) - gtk_imhtml_toggle_italic(imhtml); + if ((italics == 0) && (imhtml->format_functions & GTK_IMHTML_ITALIC) && !imhtml->wbfo) + gtk_imhtml_toggle_italic(imhtml); + } } break; case 9: /* U */ @@ -2505,10 +2507,11 @@ if (!(options & GTK_IMHTML_NO_FORMATTING)) { gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); ws[0] = '\0'; wpos = 0; - if (underline) + if (underline) { underline--; - if ((underline == 0) && (imhtml->format_functions & GTK_IMHTML_UNDERLINE) && !imhtml->wbfo) - gtk_imhtml_toggle_underline(imhtml); + if ((underline == 0) && (imhtml->format_functions & GTK_IMHTML_UNDERLINE) && !imhtml->wbfo) + gtk_imhtml_toggle_underline(imhtml); + } } break; case 13: /* S */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <amc...@us...> - 2006-07-12 23:53:00
|
Revision: 16489 Author: amc_grim Date: 2006-07-12 16:52:56 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16489&view=rev Log Message: ----------- Patch from sadrul for: If you have a markup "abc </i> def", then the "def" part of the message shows up in italic. The same error happens for broken markup for underline/bold attributes. This patch is a fix that. Compiles fine here... Modified Paths: -------------- trunk/src/gtkimhtml.c Modified: trunk/src/gtkimhtml.c =================================================================== --- trunk/src/gtkimhtml.c 2006-07-11 20:49:41 UTC (rev 16488) +++ trunk/src/gtkimhtml.c 2006-07-12 23:52:56 UTC (rev 16489) @@ -2461,10 +2461,11 @@ gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); ws[0] = '\0'; wpos = 0; - if (bold) + if (bold) { bold--; - if ((bold == 0) && (imhtml->format_functions & GTK_IMHTML_BOLD) && !imhtml->wbfo) - gtk_imhtml_toggle_bold(imhtml); + if ((bold == 0) && (imhtml->format_functions & GTK_IMHTML_BOLD) && !imhtml->wbfo) + gtk_imhtml_toggle_bold(imhtml); + } } break; case 5: /* I */ @@ -2484,10 +2485,11 @@ if (!(options & GTK_IMHTML_NO_FORMATTING)) { gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); ws[0] = '\0'; wpos = 0; - if (italics) + if (italics) { italics--; - if ((italics == 0) && (imhtml->format_functions & GTK_IMHTML_ITALIC) && !imhtml->wbfo) - gtk_imhtml_toggle_italic(imhtml); + if ((italics == 0) && (imhtml->format_functions & GTK_IMHTML_ITALIC) && !imhtml->wbfo) + gtk_imhtml_toggle_italic(imhtml); + } } break; case 9: /* U */ @@ -2505,10 +2507,11 @@ if (!(options & GTK_IMHTML_NO_FORMATTING)) { gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); ws[0] = '\0'; wpos = 0; - if (underline) + if (underline) { underline--; - if ((underline == 0) && (imhtml->format_functions & GTK_IMHTML_UNDERLINE) && !imhtml->wbfo) - gtk_imhtml_toggle_underline(imhtml); + if ((underline == 0) && (imhtml->format_functions & GTK_IMHTML_UNDERLINE) && !imhtml->wbfo) + gtk_imhtml_toggle_underline(imhtml); + } } break; case 13: /* S */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rl...@us...> - 2006-07-11 20:49:44
|
Revision: 16488 Author: rlaager Date: 2006-07-11 13:49:41 -0700 (Tue, 11 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16488&view=rev Log Message: ----------- Backport revision 16487 from trunk Fix SF Bug #1517875 "The text replacement plugin is finally a good thing to use. Unfortunately, it advertises case sensitivity falsely. Try, for example, adding 'h' and 'H' as two separate text replacements. ;-)" ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16487&view=rev Modified Paths: -------------- branches/v2_0_0/plugins/spellchk.c Modified: branches/v2_0_0/plugins/spellchk.c =================================================================== --- branches/v2_0_0/plugins/spellchk.c 2006-07-11 20:47:11 UTC (rev 16487) +++ branches/v2_0_0/plugins/spellchk.c 2006-07-11 20:49:41 UTC (rev 16488) @@ -1898,21 +1898,48 @@ static void list_add_new() { GtkTreeIter iter; + const char *word = gtk_entry_get_text(GTK_ENTRY(bad_entry)); + gboolean case_sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(case_toggle)); if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) { - char *tmpword = g_utf8_casefold(gtk_entry_get_text(GTK_ENTRY(bad_entry)), -1); + char *tmpword = g_utf8_casefold(word, -1); do { - GValue val0; - char *bad; + GValue bad_val; + gboolean match; - val0.g_type = 0; - gtk_tree_model_get_value(GTK_TREE_MODEL(model), &iter, BAD_COLUMN, &val0); - bad = g_utf8_casefold(g_value_get_string(&val0), -1); + bad_val.g_type = 0; + gtk_tree_model_get_value(GTK_TREE_MODEL(model), &iter, BAD_COLUMN, &bad_val); - if (!strcmp(bad, tmpword)) { - g_value_unset(&val0); + if (case_sensitive) + { + GValue case_sensitive_val; + case_sensitive_val.g_type = 0; + gtk_tree_model_get_value(GTK_TREE_MODEL(model), &iter, CASE_SENSITIVE_COLUMN, &case_sensitive_val); + + /* If they're both case-sensitive, then compare directly. + * Otherwise, they overlap. */ + if (g_value_get_boolean(&case_sensitive_val)) + { + match = !strcmp(g_value_get_string(&bad_val), word); + } + else + { + char *bad = g_utf8_casefold(g_value_get_string(&bad_val), -1); + match = !strcmp(bad, tmpword); + g_free(bad); + } + g_value_unset(&case_sensitive_val); + } + else + { + char *bad = g_utf8_casefold(g_value_get_string(&bad_val), -1); + match = !strcmp(bad, tmpword); g_free(bad); + } + + if (match) { + g_value_unset(&bad_val); g_free(tmpword); gaim_notify_error(NULL, _("Duplicate Correction"), @@ -1921,8 +1948,7 @@ return; } - g_value_unset(&val0); - g_free(bad); + g_value_unset(&bad_val); } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter)); @@ -1932,10 +1958,10 @@ gtk_list_store_append(model, &iter); gtk_list_store_set(model, &iter, - BAD_COLUMN, gtk_entry_get_text(GTK_ENTRY(bad_entry)), + BAD_COLUMN, word, GOOD_COLUMN, gtk_entry_get_text(GTK_ENTRY(good_entry)), WORD_ONLY_COLUMN, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(complete_toggle)), - CASE_SENSITIVE_COLUMN, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(case_toggle)), + CASE_SENSITIVE_COLUMN, case_sensitive, -1); gtk_editable_delete_text(GTK_EDITABLE(bad_entry), 0, -1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rl...@us...> - 2006-07-11 20:47:15
|
Revision: 16487 Author: rlaager Date: 2006-07-11 13:47:11 -0700 (Tue, 11 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16487&view=rev Log Message: ----------- Fix SF Bug #1517875 "The text replacement plugin is finally a good thing to use. Unfortunately, it advertises case sensitivity falsely. Try, for example, adding 'h' and 'H' as two separate text replacements. ;-)" Modified Paths: -------------- trunk/plugins/spellchk.c Modified: trunk/plugins/spellchk.c =================================================================== --- trunk/plugins/spellchk.c 2006-07-11 16:22:28 UTC (rev 16486) +++ trunk/plugins/spellchk.c 2006-07-11 20:47:11 UTC (rev 16487) @@ -1898,21 +1898,48 @@ static void list_add_new() { GtkTreeIter iter; + const char *word = gtk_entry_get_text(GTK_ENTRY(bad_entry)); + gboolean case_sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(case_toggle)); if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) { - char *tmpword = g_utf8_casefold(gtk_entry_get_text(GTK_ENTRY(bad_entry)), -1); + char *tmpword = g_utf8_casefold(word, -1); do { - GValue val0; - char *bad; + GValue bad_val; + gboolean match; - val0.g_type = 0; - gtk_tree_model_get_value(GTK_TREE_MODEL(model), &iter, BAD_COLUMN, &val0); - bad = g_utf8_casefold(g_value_get_string(&val0), -1); + bad_val.g_type = 0; + gtk_tree_model_get_value(GTK_TREE_MODEL(model), &iter, BAD_COLUMN, &bad_val); - if (!strcmp(bad, tmpword)) { - g_value_unset(&val0); + if (case_sensitive) + { + GValue case_sensitive_val; + case_sensitive_val.g_type = 0; + gtk_tree_model_get_value(GTK_TREE_MODEL(model), &iter, CASE_SENSITIVE_COLUMN, &case_sensitive_val); + + /* If they're both case-sensitive, then compare directly. + * Otherwise, they overlap. */ + if (g_value_get_boolean(&case_sensitive_val)) + { + match = !strcmp(g_value_get_string(&bad_val), word); + } + else + { + char *bad = g_utf8_casefold(g_value_get_string(&bad_val), -1); + match = !strcmp(bad, tmpword); + g_free(bad); + } + g_value_unset(&case_sensitive_val); + } + else + { + char *bad = g_utf8_casefold(g_value_get_string(&bad_val), -1); + match = !strcmp(bad, tmpword); g_free(bad); + } + + if (match) { + g_value_unset(&bad_val); g_free(tmpword); gaim_notify_error(NULL, _("Duplicate Correction"), @@ -1921,8 +1948,7 @@ return; } - g_value_unset(&val0); - g_free(bad); + g_value_unset(&bad_val); } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter)); @@ -1932,10 +1958,10 @@ gtk_list_store_append(model, &iter); gtk_list_store_set(model, &iter, - BAD_COLUMN, gtk_entry_get_text(GTK_ENTRY(bad_entry)), + BAD_COLUMN, word, GOOD_COLUMN, gtk_entry_get_text(GTK_ENTRY(good_entry)), WORD_ONLY_COLUMN, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(complete_toggle)), - CASE_SENSITIVE_COLUMN, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(case_toggle)), + CASE_SENSITIVE_COLUMN, case_sensitive, -1); gtk_editable_delete_text(GTK_EDITABLE(bad_entry), 0, -1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ebl...@us...> - 2006-07-11 16:22:33
|
Revision: 16486 Author: eblanton Date: 2006-07-11 09:22:28 -0700 (Tue, 11 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16486&view=rev Log Message: ----------- Fix some more 64-bit warnings. The "handle" warnings remain, because they're real problems on 64-bit systems and they still need fixin'. I'm not sure how to best fix them just yet. Modified Paths: -------------- trunk/plugins/tcl/tcl.c trunk/plugins/tcl/tcl_gaim.h trunk/plugins/tcl/tcl_signals.c Modified: trunk/plugins/tcl/tcl.c =================================================================== --- trunk/plugins/tcl/tcl.c 2006-07-11 16:11:30 UTC (rev 16485) +++ trunk/plugins/tcl/tcl.c 2006-07-11 16:22:28 UTC (rev 16486) @@ -54,10 +54,12 @@ GaimStringref *GaimTclRefConnection; GaimStringref *GaimTclRefConversation; GaimStringref *GaimTclRefPointer; +GaimStringref *GaimTclRefPlugin; GaimStringref *GaimTclRefPresence; GaimStringref *GaimTclRefStatus; GaimStringref *GaimTclRefStatusAttr; GaimStringref *GaimTclRefStatusType; +GaimStringref *GaimTclRefXfer; static GHashTable *tcl_plugins = NULL; @@ -186,7 +188,7 @@ buf = g_malloc(len + 1); cur = buf; - while (fgets(cur, (int) buf - (buf - cur), fp)) { + while (fgets(cur, GPOINTER_TO_INT(buf) - (buf - cur), fp)) { cur += strlen(cur); if (feof(fp)) break; @@ -353,10 +355,12 @@ GaimTclRefConnection = gaim_stringref_new("Connection"); GaimTclRefConversation = gaim_stringref_new("Conversation"); GaimTclRefPointer = gaim_stringref_new("Pointer"); + GaimTclRefPlugin = gaim_stringref_new("Plugin"); GaimTclRefPresence = gaim_stringref_new("Presence"); GaimTclRefStatus = gaim_stringref_new("Status"); GaimTclRefStatusAttr = gaim_stringref_new("StatusAttr"); GaimTclRefStatusType = gaim_stringref_new("StatusType"); + GaimTclRefXfer = gaim_stringref_new("Xfer"); tcl_plugins = g_hash_table_new(g_direct_hash, g_direct_equal); Modified: trunk/plugins/tcl/tcl_gaim.h =================================================================== --- trunk/plugins/tcl/tcl_gaim.h 2006-07-11 16:11:30 UTC (rev 16485) +++ trunk/plugins/tcl/tcl_gaim.h 2006-07-11 16:22:28 UTC (rev 16486) @@ -70,10 +70,12 @@ extern GaimStringref *GaimTclRefConnection; extern GaimStringref *GaimTclRefConversation; extern GaimStringref *GaimTclRefPointer; +extern GaimStringref *GaimTclRefPlugin; extern GaimStringref *GaimTclRefPresence; extern GaimStringref *GaimTclRefStatus; extern GaimStringref *GaimTclRefStatusAttr; extern GaimStringref *GaimTclRefStatusType; +extern GaimStringref *GaimTclRefXfer; GaimPlugin *tcl_interp_get_plugin(Tcl_Interp *interp); Modified: trunk/plugins/tcl/tcl_signals.c =================================================================== --- trunk/plugins/tcl/tcl_signals.c 2006-07-11 16:11:30 UTC (rev 16485) +++ trunk/plugins/tcl/tcl_signals.c 2006-07-11 16:22:28 UTC (rev 16486) @@ -143,8 +143,12 @@ return GaimTclRefConnection; case GAIM_SUBTYPE_CONVERSATION: return GaimTclRefConversation; + case GAIM_SUBTYPE_PLUGIN: + return GaimTclRefPlugin; case GAIM_SUBTYPE_STATUS: return GaimTclRefStatus; + case GAIM_SUBTYPE_XFER: + return GaimTclRefXfer; default: return NULL; } @@ -270,22 +274,12 @@ case GAIM_SUBTYPE_CONNECTION: case GAIM_SUBTYPE_CONVERSATION: case GAIM_SUBTYPE_STATUS: + case GAIM_SUBTYPE_PLUGIN: + case GAIM_SUBTYPE_XFER: if (gaim_value_is_outgoing(handler->argtypes[i])) gaim_debug_error("tcl", "pointer subtypes do not currently support outgoing arguments\n"); arg = gaim_tcl_ref_new(ref_type(gaim_value_get_subtype(handler->argtypes[i])), va_arg(args, void *)); break; - case GAIM_SUBTYPE_PLUGIN: - case GAIM_SUBTYPE_XFER: - /* pointers again */ - if (gaim_value_is_outgoing(handler->argtypes[i])) { - vals[i] = va_arg(args, void **); - Tcl_LinkVar(handler->interp, name->str, - vals[i], TCL_LINK_INT); - arg = Tcl_NewStringObj(name->str, -1); - } else { - arg = Tcl_NewIntObj((int)va_arg(args, void *)); - } - break; case GAIM_SUBTYPE_BLIST: case GAIM_SUBTYPE_BLIST_BUDDY: case GAIM_SUBTYPE_BLIST_GROUP: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ebl...@us...> - 2006-07-11 16:11:37
|
Revision: 16485 Author: eblanton Date: 2006-07-11 09:11:30 -0700 (Tue, 11 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16485&view=rev Log Message: ----------- Fix a 64-bit casting problem in tcl_glib Modified Paths: -------------- trunk/plugins/tcl/tcl_glib.c Modified: trunk/plugins/tcl/tcl_glib.c =================================================================== --- trunk/plugins/tcl/tcl_glib.c 2006-07-11 06:54:27 UTC (rev 16484) +++ trunk/plugins/tcl/tcl_glib.c 2006-07-11 16:11:30 UTC (rev 16485) @@ -183,7 +183,7 @@ static void tcl_delete_file_handler(int fd) { - struct tcl_file_handler *tfh = g_hash_table_lookup(tcl_file_handlers, (gpointer)fd); + struct tcl_file_handler *tfh = g_hash_table_lookup(tcl_file_handlers, GINT_TO_POINTER(fd)); if (tfh == NULL) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-11 06:54:37
|
Revision: 16484 Author: thekingant Date: 2006-07-10 23:54:27 -0700 (Mon, 10 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16484&view=rev Log Message: ----------- Backport SVN revision #16483 from HEAD to v2_0_0 Get rid of the "has you" overlay icon for MSN buddies. I don't think it's clear what this icon means, and I think it's more likely to confuse users than to help them. Having two cryptic red symbols on top of my buddies is just a bit too much for me. ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16483&view=rev Modified Paths: -------------- branches/v2_0_0/pixmaps/status/default/Makefile.am branches/v2_0_0/src/protocols/msn/msn.c Removed Paths: ------------- branches/v2_0_0/pixmaps/status/default/nr.png Modified: branches/v2_0_0/pixmaps/status/default/Makefile.am =================================================================== --- branches/v2_0_0/pixmaps/status/default/Makefile.am 2006-07-11 06:54:07 UTC (rev 16483) +++ branches/v2_0_0/pixmaps/status/default/Makefile.am 2006-07-11 06:54:27 UTC (rev 16484) @@ -29,7 +29,6 @@ napster.png \ notauthorized.png \ novell.png \ - nr.png \ occupied.png \ offline.png \ op.png \ Deleted: branches/v2_0_0/pixmaps/status/default/nr.png =================================================================== (Binary files differ) Modified: branches/v2_0_0/src/protocols/msn/msn.c =================================================================== --- branches/v2_0_0/src/protocols/msn/msn.c 2006-07-11 06:54:07 UTC (rev 16483) +++ branches/v2_0_0/src/protocols/msn/msn.c 2006-07-11 06:54:27 UTC (rev 16484) @@ -507,8 +507,6 @@ { if (user->mobile) emblems[i++] = "wireless"; - if (!(user->list_op & (1 << MSN_LIST_RL))) - emblems[i++] = "nr"; } *se = emblems[0]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-11 06:54:13
|
Revision: 16483 Author: thekingant Date: 2006-07-10 23:54:07 -0700 (Mon, 10 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16483&view=rev Log Message: ----------- Get rid of the "has you" overlay icon for MSN buddies. I don't think it's clear what this icon means, and I think it's more likely to confuse users than to help them. Having two cryptic red symbols on top of my buddies is just a bit too much for me. Modified Paths: -------------- trunk/pixmaps/status/default/Makefile.am trunk/src/protocols/msn/msn.c Removed Paths: ------------- trunk/pixmaps/status/default/nr.png Modified: trunk/pixmaps/status/default/Makefile.am =================================================================== --- trunk/pixmaps/status/default/Makefile.am 2006-07-11 01:12:35 UTC (rev 16482) +++ trunk/pixmaps/status/default/Makefile.am 2006-07-11 06:54:07 UTC (rev 16483) @@ -29,7 +29,6 @@ napster.png \ notauthorized.png \ novell.png \ - nr.png \ occupied.png \ offline.png \ op.png \ Deleted: trunk/pixmaps/status/default/nr.png =================================================================== (Binary files differ) Modified: trunk/src/protocols/msn/msn.c =================================================================== --- trunk/src/protocols/msn/msn.c 2006-07-11 01:12:35 UTC (rev 16482) +++ trunk/src/protocols/msn/msn.c 2006-07-11 06:54:07 UTC (rev 16483) @@ -507,8 +507,6 @@ { if (user->mobile) emblems[i++] = "wireless"; - if (!(user->list_op & (1 << MSN_LIST_RL))) - emblems[i++] = "nr"; } *se = emblems[0]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aar...@us...> - 2006-07-11 01:13:00
|
Revision: 16482 Author: aaronsheldon Date: 2006-07-10 18:12:35 -0700 (Mon, 10 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16482&view=rev Log Message: ----------- The previous change broke going offline. Oops. Modified Paths: -------------- branches/soc-2006-blist-efficiency/src/gtkblist.c Modified: branches/soc-2006-blist-efficiency/src/gtkblist.c =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-11 00:43:51 UTC (rev 16481) +++ branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-11 01:12:35 UTC (rev 16482) @@ -3174,18 +3174,13 @@ if(gtkblist->selected_node == node) gtkblist->selected_node = NULL; - /* This code seems to be irrelevant. We should not need to update the - * gtkblist before a node is removed and it takes a lot of time to do that. - */ -#if 0 if (get_iter_from_node(node, &iter)) { gtk_tree_store_remove(gtkblist->treemodel, &iter); if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node) || GAIM_BLIST_NODE_IS_CHAT(node)) { gaim_gtk_blist_update(list, node->parent); - } - } -#endif + } + } gtk_tree_row_reference_free(gtknode->row); gtknode->row = NULL; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aar...@us...> - 2006-07-11 00:43:56
|
Revision: 16481 Author: aaronsheldon Date: 2006-07-10 17:43:51 -0700 (Mon, 10 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16481&view=rev Log Message: ----------- Adds the ability to destroy the status_icon_hash_table after a re-do buddy list and reclaim memory. Uses gstrings instead of *chars in get_status_icon. Adds a / delimiter for hash strings. Disables updating the buddy list each and every time a single node is hidden. Modified Paths: -------------- branches/soc-2006-blist-efficiency/src/gtkblist.c Modified: branches/soc-2006-blist-efficiency/src/gtkblist.c =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-10 23:55:24 UTC (rev 16480) +++ branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-11 00:43:51 UTC (rev 16481) @@ -2700,12 +2700,19 @@ int y; }; +static void g_string_destroy(GString *destroyable) +{ + g_string_free(destroyable, TRUE); + return; +} + GdkPixbuf * gaim_gtk_blist_get_status_icon(GaimBlistNode *node, GaimStatusIconSize size) { GdkPixbuf *scale, *status = NULL; int i, scalesize = 30; - char *filename, *key, *tmp; + char *filename; + GString *key = g_string_sized_new(16); const char *protoname = NULL; struct _gaim_gtk_blist_node *gtknode = node->ui_data; struct _gaim_gtk_blist_node *gtkbuddynode = NULL; @@ -2716,7 +2723,10 @@ GaimChat *chat = NULL; if (!status_icon_hash_table) - status_icon_hash_table = g_hash_table_new (g_str_hash,g_str_equal); + status_icon_hash_table = g_hash_table_new_full((GHashFunc)g_string_hash, + (GEqualFunc)g_string_equal, + (GDestroyNotify)g_string_destroy, + (GDestroyNotify)gdk_pixbuf_unref); if(GAIM_BLIST_NODE_IS_CONTACT(node)) { if(!gtknode->contact_expanded) { @@ -2788,61 +2798,51 @@ if (buddy) { if (GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) - key = g_strconcat(protoname, "login", NULL); + g_string_append_printf(key, "%s/login", protoname); else if (!GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) - key = g_strconcat(protoname, "logout", NULL); + g_string_append_printf(key, "%s/logout", protoname); else - key = g_strdup(protoname); + key = g_string_append(key, protoname); presence = gaim_buddy_get_presence(buddy); if (!GAIM_BUDDY_IS_ONLINE(buddy)) { - tmp = key; - key = g_strconcat(key, "off", NULL); - g_free(tmp); + key = g_string_append(key, "/off"); } else if (gaim_presence_is_idle(presence)) { - tmp = key; - key = g_strconcat(key, "idle", NULL); - g_free(tmp); + key = g_string_append(key, "/idle"); } if (!gaim_privacy_check(buddy->account, gaim_buddy_get_name(buddy))) { - tmp = key; - key = g_strconcat(key, "blocked", NULL); - g_free(tmp); + key = g_string_append(key, "/priv"); } if (size == GAIM_STATUS_ICON_SMALL) { - tmp = key; - key = g_strconcat(key, "small", NULL); - g_free(tmp); + key = g_string_append(key, "/tiny"); } for(i=0; i<4; i++) { if(emblems[i].filename) { - tmp = key; - key = g_strconcat(key, emblems[i].filename, NULL); - g_free(tmp); + g_string_append_printf(key, "/%s", emblems[i].filename); } } } /* There are only two options for chat or gaimdude - big or small */ else if (chat && size == GAIM_STATUS_ICON_SMALL) - key = g_strconcat(protoname, "chat-s", NULL); + g_string_append_printf(key, "%s-chat-s", protoname); else if (chat) - key = g_strconcat(protoname, "chat", NULL); + g_string_append_printf(key, "%s-chat", protoname); else if (size == GAIM_STATUS_ICON_SMALL) - key = g_strdup("gaimdude-s"); + key = g_string_append(key, "gaimdude-s"); else - key = g_strdup("gaimdude"); + key = g_string_append(key, "gaimdude"); /* End Generating Lookup Key */ /* If we already know this icon, just return it */ - scale = g_hash_table_lookup (status_icon_hash_table, key); + scale = g_hash_table_lookup(status_icon_hash_table, key); if (scale) { gdk_pixbuf_ref(scale); - g_free(key); + g_string_free(key, TRUE); return scale; } @@ -3174,14 +3174,18 @@ if(gtkblist->selected_node == node) gtkblist->selected_node = NULL; - + /* This code seems to be irrelevant. We should not need to update the + * gtkblist before a node is removed and it takes a lot of time to do that. + */ +#if 0 if (get_iter_from_node(node, &iter)) { gtk_tree_store_remove(gtkblist->treemodel, &iter); if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node) || GAIM_BLIST_NODE_IS_CHAT(node)) { gaim_gtk_blist_update(list, node->parent); - } - } + } + } +#endif gtk_tree_row_reference_free(gtknode->row); gtknode->row = NULL; } @@ -4004,6 +4008,10 @@ gaim_gtk_blist_update(list, node); node = gaim_blist_node_next(node, FALSE); } + + g_hash_table_destroy(status_icon_hash_table); + status_icon_hash_table = NULL; + } void gaim_gtk_blist_refresh(GaimBuddyList *list) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-07-10 23:55:49
|
Revision: 16480 Author: sadrul Date: 2006-07-10 16:55:24 -0700 (Mon, 10 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16480&view=rev Log Message: ----------- New widget GntLine to use as a separator. A partial dialog for add-account callback. Updating the dialog as a result of selection-change in the prpl dropdown is way ickier than I had expected it to be. It 'works' now, but quite a bit quirky. I will try to smooth things up later, perhaps next week. Modified Paths: -------------- trunk/console/gntaccount.c trunk/console/gntblist.c trunk/console/gntconv.c trunk/console/libgnt/Makefile.am trunk/console/libgnt/gnt.h trunk/console/libgnt/gntbox.c trunk/console/libgnt/gntbox.h trunk/console/libgnt/gntbutton.c trunk/console/libgnt/gntcombobox.c trunk/console/libgnt/gntentry.c trunk/console/libgnt/gntlabel.c trunk/console/libgnt/gntmain.c trunk/console/libgnt/gnttextview.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/gntwidget.c trunk/console/libgnt/gntwidget.h trunk/console/libgnt/test/combo.c trunk/console/libgnt/test/focus.c trunk/console/libgnt/test/multiwin.c Added Paths: ----------- trunk/console/libgnt/gntline.c trunk/console/libgnt/gntline.h Modified: trunk/console/gntaccount.c =================================================================== --- trunk/console/gntaccount.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/gntaccount.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -1,11 +1,17 @@ #include <gnt.h> #include <gntbox.h> #include <gntbutton.h> +#include <gntcombobox.h> +#include <gntentry.h> #include <gntlabel.h> +#include <gntline.h> #include <gnttree.h> +#include <account.h> +#include <accountopt.h> #include <connection.h> #include <notify.h> +#include <plugin.h> #include <request.h> #include "gntaccount.h" @@ -19,7 +25,167 @@ static GGAccountList accounts; +typedef struct +{ + GaimAccount *account; /* NULL for a new account */ + + GntWidget *window; + + GntWidget *protocol; + GntWidget *screenname; + GntWidget *password; + GntWidget *alias; + + GntWidget *splits; + GList *split_entries; +} AccountEditDialog; + static void +edit_dialog_destroy(AccountEditDialog *dialog) +{ + g_free(dialog); +} + +static void +save_account_cb(AccountEditDialog *dialog) +{ +} + +static void +update_user_splits(AccountEditDialog *dialog) +{ + GntWidget *hbox; + GaimPlugin *plugin; + GaimPluginProtocolInfo *prplinfo; + GList *iter; + char *username = NULL; + + if (dialog->splits) + { + gnt_box_remove_all(GNT_BOX(dialog->splits)); + g_list_free(dialog->split_entries); + } + else + { + dialog->splits = gnt_box_new(FALSE, TRUE); + gnt_box_set_pad(GNT_BOX(dialog->splits), 0); + } + + dialog->split_entries = NULL; + + plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); + if (!plugin) + return; + prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); + + username = g_strdup(gaim_account_get_username(dialog->account)); + + for (iter = prplinfo->user_splits; iter; iter = iter->next) + { + GaimAccountUserSplit *split = iter->data; + GntWidget *entry; + char *buf; + + hbox = gnt_box_new(TRUE, FALSE); + gnt_box_add_widget(GNT_BOX(dialog->splits), hbox); + + buf = g_strdup_printf("%s:", gaim_account_user_split_get_text(split)); + gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(buf)); + + entry = gnt_entry_new(NULL); + gnt_box_add_widget(GNT_BOX(hbox), entry); + + dialog->split_entries = g_list_append(dialog->split_entries, entry); + g_free(buf); + } + + /* XXX: Add default/custom values to the splits */ + g_free(username); +} + +static void +prpl_changed_cb(GntWidget *combo, GaimPlugin *old, GaimPlugin *new, AccountEditDialog *dialog) +{ + update_user_splits(dialog); + gnt_box_readjust(GNT_BOX(dialog->window)); + gnt_widget_draw(dialog->window); +} + +static void +add_account(GntWidget *b, gpointer null) +{ + GntWidget *window, *hbox; + GntWidget *combo, *button, *entry; + GList *list, *iter; + AccountEditDialog *dialog; + + dialog = g_new0(AccountEditDialog, 1); + + dialog->window = window = gnt_box_new(FALSE, TRUE); + gnt_box_set_toplevel(GNT_BOX(window), TRUE); + gnt_box_set_title(GNT_BOX(window), _("New Account")); + gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); + gnt_box_set_pad(GNT_BOX(window), 0); + + hbox = gnt_box_new(TRUE, FALSE); + gnt_box_add_widget(GNT_BOX(window), hbox); + gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); + + dialog->protocol = combo = gnt_combo_box_new(); + list = gaim_plugins_get_protocols(); + for (iter = list; iter; iter = iter->next) + { + gnt_combo_box_add_data(GNT_COMBO_BOX(combo), iter->data, + ((GaimPlugin*)iter->data)->info->name); + } + g_signal_connect(G_OBJECT(combo), "selection-changed", G_CALLBACK(prpl_changed_cb), dialog); + gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Protocol:"))); + gnt_box_add_widget(GNT_BOX(hbox), combo); + + hbox = gnt_box_new(TRUE, FALSE); + gnt_box_add_widget(GNT_BOX(window), hbox); + + dialog->screenname = entry = gnt_entry_new(NULL); + gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Screen name:"))); + gnt_box_add_widget(GNT_BOX(hbox), entry); + + /* User splits */ + update_user_splits(dialog); + gnt_box_add_widget(GNT_BOX(window), dialog->splits); + + hbox = gnt_box_new(TRUE, FALSE); + gnt_box_add_widget(GNT_BOX(window), hbox); + + dialog->password = entry = gnt_entry_new(NULL); + gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Password:"))); + gnt_box_add_widget(GNT_BOX(hbox), entry); + + hbox = gnt_box_new(TRUE, FALSE); + gnt_box_add_widget(GNT_BOX(window), hbox); + + dialog->alias = entry = gnt_entry_new(NULL); + gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Alias:"))); + gnt_box_add_widget(GNT_BOX(hbox), entry); + + gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); + + hbox = gnt_box_new(FALSE, FALSE); + gnt_box_add_widget(GNT_BOX(window), hbox); + + button = gnt_button_new(_("Cancel")); + gnt_box_add_widget(GNT_BOX(hbox), button); + g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), window); + + button = gnt_button_new(_("Save")); + gnt_box_add_widget(GNT_BOX(hbox), button); + g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(save_account_cb), dialog); + + g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(edit_dialog_destroy), dialog); + + gnt_widget_show(window); +} + +static void account_toggled(GntWidget *widget, void *key, gpointer null) { GaimAccount *account = key; @@ -32,15 +198,18 @@ GList *iter; GntWidget *box, *button; - accounts.window = gnt_box_new(TRUE, TRUE); + accounts.window = gnt_box_new(FALSE, TRUE); gnt_box_set_toplevel(GNT_BOX(accounts.window), TRUE); gnt_box_set_title(GNT_BOX(accounts.window), _("Accounts")); gnt_box_set_pad(GNT_BOX(accounts.window), 0); + gnt_box_set_alignment(GNT_BOX(accounts.window), GNT_ALIGN_MID); gnt_widget_set_name(accounts.window, "accounts"); gnt_box_add_widget(GNT_BOX(accounts.window), gnt_label_new(_("You can enable/disable accounts from the following list."))); + gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); + accounts.tree = gnt_tree_new(); GNT_WIDGET_SET_FLAGS(accounts.tree, GNT_WIDGET_NO_BORDER); @@ -62,10 +231,13 @@ gnt_widget_set_size(accounts.tree, 40, 10); gnt_box_add_widget(GNT_BOX(accounts.window), accounts.tree); + gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); + box = gnt_box_new(FALSE, FALSE); button = gnt_button_new(_("Add")); gnt_box_add_widget(GNT_BOX(box), button); + g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(add_account), NULL); button = gnt_button_new(_("Modify")); gnt_box_add_widget(GNT_BOX(box), button); Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/gntblist.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -234,6 +234,9 @@ GntTree *tree = GNT_TREE(ggblist->tree); GaimBlistNode *node = gnt_tree_get_selection_data(tree); + if (!node) + return; + if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimBuddy *buddy = (GaimBuddy *)node; Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/gntconv.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -119,7 +119,7 @@ type = gaim_conversation_get_type(conv); title = g_strdup_printf(_("%s"), gaim_conversation_get_name(conv)); - ggc->window = gnt_box_new(TRUE, TRUE); + ggc->window = gnt_box_new(FALSE, TRUE); gnt_box_set_title(GNT_BOX(ggc->window), title); gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE); gnt_box_set_pad(GNT_BOX(ggc->window), 0); Modified: trunk/console/libgnt/Makefile.am =================================================================== --- trunk/console/libgnt/Makefile.am 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/Makefile.am 2006-07-10 23:55:24 UTC (rev 16480) @@ -11,6 +11,7 @@ gntcombobox.c \ gntentry.c \ gntlabel.c \ + gntline.c \ gntmarshal.c \ gnttextview.c \ gnttree.c \ @@ -25,6 +26,7 @@ gntentry.h \ gntkeys.h \ gntlabel.h \ + gntline.h \ gntmarshal.h \ gnttextview.h \ gnttree.h \ Modified: trunk/console/libgnt/gnt.h =================================================================== --- trunk/console/libgnt/gnt.h 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gnt.h 2006-07-10 23:55:24 UTC (rev 16480) @@ -17,6 +17,8 @@ void gnt_screen_take_focus(GntWidget *widget); +void gnt_screen_resize_widget(GntWidget *widget, int width, int height); + gboolean gnt_widget_has_focus(GntWidget *widget); void gnt_widget_set_urgent(GntWidget *widget); Modified: trunk/console/libgnt/gntbox.c =================================================================== --- trunk/console/libgnt/gntbox.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gntbox.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -77,7 +77,7 @@ gboolean has_border = FALSE; w = h = 0; - max = -1; + max = 0; curx = widget->priv.x; cury = widget->priv.y; if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER)) @@ -93,15 +93,21 @@ gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h); if (box->vertical) { - cury += h + box->pad; - if (max < w) - max = w; + if (h) + { + cury += h + box->pad; + if (max < w) + max = w; + } } else { - curx += w + box->pad; - if (max < h) - max = h; + if (w) + { + curx += w + box->pad; + if (max < h) + max = h; + } } } @@ -112,6 +118,14 @@ max += 2; } + if (box->list) + { + if (box->vertical) + cury -= box->pad; + else + curx -= box->pad; + } + if (box->vertical) { widget->priv.width = max; @@ -127,8 +141,18 @@ static void gnt_box_set_position(GntWidget *widget, int x, int y) { - gnt_widget_size_request(widget); - reposition_children(widget); + GList *iter; + int changex, changey; + + changex = widget->priv.x - x; + changey = widget->priv.y - y; + + for (iter = GNT_BOX(widget)->list; iter; iter = iter->next) + { + GntWidget *w = GNT_WIDGET(iter->data); + gnt_widget_set_position(w, w->priv.x - changex, + w->priv.y - changey); + } } static void @@ -136,25 +160,43 @@ { GntBox *box = GNT_BOX(widget); GList *iter; + int maxw = 0, maxh = 0; g_list_foreach(box->list, (GFunc)gnt_widget_size_request, NULL); + for (iter = box->list; iter; iter = iter->next) + { + int w, h; + gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h); + if (maxh < h) + maxh = h; + if (maxw < w) + maxw = w; + } + if (box->homogeneous) { - int max = -1, w, h; - - /* XXX: should probably be changed based on vertical-ness */ for (iter = box->list; iter; iter = iter->next) { - gnt_widget_get_size(GNT_WIDGET(iter->data), &w, NULL); - if (max < w) - max = w; + gnt_widget_set_size(GNT_WIDGET(iter->data), maxw, maxh); } - + } + else + { for (iter = box->list; iter; iter = iter->next) { - gnt_widget_get_size(GNT_WIDGET(iter->data), NULL, &h); - gnt_widget_set_size(GNT_WIDGET(iter->data), max, h); + if (box->vertical) + { + int h; + gnt_widget_get_size(GNT_WIDGET(iter->data), NULL, &h); + gnt_widget_set_size(GNT_WIDGET(iter->data), maxw, h); + } + else + { + int w; + gnt_widget_get_size(GNT_WIDGET(iter->data), &w, NULL); + gnt_widget_set_size(GNT_WIDGET(iter->data), w, maxh); + } } } @@ -185,10 +227,21 @@ return box->active; } +static void +find_next_focus(GntBox *box) +{ + GList *iter = g_list_find(box->focus, box->active); + if (iter && iter->next) + box->active = iter->next->data; + else if (box->focus) + box->active = box->focus->data; +} + static gboolean gnt_box_key_pressed(GntWidget *widget, const char *text) { GntBox *box = GNT_BOX(widget); + GntWidget *now; if (box->active == NULL && !find_focusable_widget(box)) return FALSE; @@ -196,9 +249,10 @@ if (gnt_widget_key_pressed(box->active, text)) return TRUE; + now = box->active; + if (text[0] == 27) { - GntWidget *now = box->active; if (strcmp(text+1, GNT_KEY_LEFT) == 0) { GList *iter = g_list_find(box->focus, box->active); @@ -213,23 +267,19 @@ } else if (strcmp(text+1, GNT_KEY_RIGHT) == 0) { - GList *iter = g_list_find(box->focus, box->active); - if (iter && iter->next) - { - box->active = iter->next->data; - } - else if (box->focus) - { - box->active = box->focus->data; - } + find_next_focus(box); } + } + else if (text[0] == '\t') + { + find_next_focus(box); + } - if (now && now != box->active) - { - gnt_widget_set_focus(now, FALSE); - gnt_widget_set_focus(box->active, TRUE); - return TRUE; - } + if (now && now != box->active) + { + gnt_widget_set_focus(now, FALSE); + gnt_widget_set_focus(box->active, TRUE); + return TRUE; } return FALSE; @@ -257,16 +307,9 @@ gnt_box_destroy(GntWidget *w) { GntBox *box = GNT_BOX(w); - GList *iter; - for (iter = box->list; iter; iter = iter->next) - { - gnt_widget_destroy(iter->data); - } - + gnt_box_remove_all(box); gnt_screen_release(w); - - g_list_free(box->list); } static void @@ -285,9 +328,20 @@ GntBox *box = GNT_BOX(widget); int wchange, hchange; + if (widget->priv.width != width && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_X)) + return FALSE; + if (widget->priv.height != height && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_Y)) + return FALSE; + + if (!box->list) + return TRUE; + wchange = widget->priv.width - width; hchange = widget->priv.height - height; + if (wchange == 0 && hchange == 0) + return TRUE; /* Quit playing games */ + /* XXX: Right now, I am trying to just apply all the changes to * just one widget. It should be possible to distribute the * changes to all the widgets in the box. */ @@ -298,14 +352,84 @@ gnt_widget_get_size(wid, &w, &h); - if (gnt_widget_set_size(wid, w - wchange, h - hchange)) + if (gnt_widget_confirm_size(wid, w - wchange, h - hchange)) + { + GList *i; + + for (i = box->list; i; i = i->next) + { + int tw, th; + if (i == iter) continue; + gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); + if (box->vertical) + { + if (!gnt_widget_confirm_size(i->data, tw - wchange, th)) + return FALSE; + } + else + { + if (!gnt_widget_confirm_size(i->data, tw, th - hchange)) + return FALSE; + } + } +#if 0 + gnt_widget_set_size(wid, w - wchange, h - hchange); + if (box->vertical) + hchange = 0; + else + wchange = 0; + + for (i = box->list; i; i = i->next) + { + int tw, th; + if (i == iter) continue; + gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); + gnt_widget_set_size(i->data, tw - wchange, th - hchange); + } +#endif + g_object_set_data(G_OBJECT(box), "size-queued", wid); return TRUE; + } } return FALSE; } static void +gnt_box_size_changed(GntWidget *widget, int oldw, int oldh) +{ + int wchange, hchange; + GList *i; + GntBox *box = GNT_BOX(widget); + GntWidget *wid; + int tw, th; + + wchange = widget->priv.width - oldw; + hchange = widget->priv.height - oldh; + + wid = g_object_get_data(G_OBJECT(box), "size-queued"); + if (wid) + { + gnt_widget_get_size(wid, &tw, &th); + gnt_widget_set_size(wid, tw + wchange, th + hchange); + g_object_set_data(G_OBJECT(box), "size-queued", NULL); + } + + if (box->vertical) + hchange = 0; + else + wchange = 0; + + for (i = box->list; i; i = i->next) + { + gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); + gnt_widget_set_size(i->data, tw + wchange, th + hchange); + } + + reposition_children(widget); +} + +static void gnt_box_class_init(GntBoxClass *klass) { parent_class = GNT_WIDGET_CLASS(klass); @@ -319,6 +443,7 @@ parent_class->lost_focus = gnt_box_lost_focus; parent_class->gained_focus = gnt_box_gained_focus; parent_class->confirm_size = gnt_box_confirm_size; + parent_class->size_changed = gnt_box_size_changed; DEBUG; } @@ -428,8 +553,10 @@ { GList *iter; GntWidget *widget = GNT_WIDGET(box); + int pos = 1; - /* XXX: werase first? */ + if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) + pos = 0; for (iter = box->list; iter; iter = iter->next) { @@ -451,8 +578,8 @@ x += widget->priv.width - width; else if (box->alignment == GNT_ALIGN_MID) x += (widget->priv.width - width)/2; - if (x + width > widget->priv.width - 1) - x -= x + width - (widget->priv.width - 1); + if (x + width > widget->priv.width - pos) + x -= x + width - (widget->priv.width - pos); } else { @@ -460,8 +587,8 @@ y += widget->priv.height - height; else if (box->alignment == GNT_ALIGN_MID) y += (widget->priv.height - height)/2; - if (y + height > widget->priv.height - 1) - y -= y + height - (widget->priv.height - 1); + if (y + height >= widget->priv.height - pos) + y = widget->priv.height - height - pos; } copywin(w->window, widget->window, 0, 0, @@ -474,3 +601,71 @@ box->alignment = alignment; } +void gnt_box_remove(GntBox *box, GntWidget *widget) +{ + box->list = g_list_remove(box->list, widget); + if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS) + && GNT_WIDGET(box)->parent == NULL && box->focus) + { + if (widget == box->active) + { + find_next_focus(box); + if (box->active == widget) /* There's only one widget */ + box->active = NULL; + } + box->focus = g_list_remove(box->focus, widget); + } + + if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(box), GNT_WIDGET_MAPPED)) + gnt_widget_draw(GNT_WIDGET(box)); +} + +void gnt_box_remove_all(GntBox *box) +{ + g_list_foreach(box->list, (GFunc)gnt_widget_destroy, NULL); + g_list_free(box->list); + g_list_free(box->focus); + box->list = NULL; + box->focus = NULL; + GNT_WIDGET(box)->priv.width = 0; + GNT_WIDGET(box)->priv.height = 0; +} + +void gnt_box_readjust(GntBox *box) +{ + GList *iter; + GntWidget *wid; + int width, height; + + g_return_if_fail(GNT_WIDGET(box)->parent == NULL); + + for (iter = box->list; iter; iter = iter->next) + { + GntWidget *w = iter->data; + if (GNT_IS_BOX(w)) + gnt_box_readjust(GNT_BOX(w)); + else + { + GNT_WIDGET_UNSET_FLAGS(w, GNT_WIDGET_MAPPED); + w->priv.width = 0; + w->priv.height = 0; + } + } + + wid = GNT_WIDGET(box); + GNT_WIDGET_UNSET_FLAGS(wid, GNT_WIDGET_MAPPED); + wid->priv.width = 0; + wid->priv.height = 0; + + if (wid->parent == NULL) + { + g_list_free(box->focus); + box->focus = NULL; + box->active = NULL; + gnt_widget_size_request(wid); + gnt_widget_get_size(wid, &width, &height); + gnt_screen_resize_widget(wid, width, height); + find_focusable_widget(box); + } +} + Modified: trunk/console/libgnt/gntbox.h =================================================================== --- trunk/console/libgnt/gntbox.h 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gntbox.h 2006-07-10 23:55:24 UTC (rev 16480) @@ -62,6 +62,9 @@ GType gnt_box_get_gtype(void); +#define gnt_vbox_new(homo) gnt_box_new(homo, TRUE) +#define gnt_hbox_new(homo) gnt_box_new(homo, FALSE) + GntWidget *gnt_box_new(gboolean homo, gboolean vert); void gnt_box_add_widget(GntBox *box, GntWidget *widget); @@ -76,6 +79,12 @@ void gnt_box_set_alignment(GntBox *box, GntAlignment alignment); +void gnt_box_remove(GntBox *box, GntWidget *widget); /* XXX: does NOT destroy widget */ + +void gnt_box_remove_all(GntBox *box); /* Removes AND destroys all the widgets in it */ + +void gnt_box_readjust(GntBox *box); + G_END_DECLS #endif /* GNT_BOX_H */ Modified: trunk/console/libgnt/gntbutton.c =================================================================== --- trunk/console/libgnt/gntbutton.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gntbutton.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -69,10 +69,14 @@ static void gnt_button_init(GTypeInstance *instance, gpointer class) { + GntWidget *widget = GNT_WIDGET(instance); GntButton *button = GNT_BUTTON(instance); button->priv = g_new0(GntButtonPriv, 1); - GNT_WIDGET_SET_FLAGS(GNT_WIDGET(button), GNT_WIDGET_GROW_X); /* Can be resized sideways */ + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_X); + + widget->priv.minw = 4; + widget->priv.minh = 3; DEBUG; } Modified: trunk/console/libgnt/gntcombobox.c =================================================================== --- trunk/console/libgnt/gntcombobox.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gntcombobox.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -31,13 +31,13 @@ gnt_combo_box_draw(GntWidget *widget) { GntComboBox *box = GNT_COMBO_BOX(widget); - const char *text = NULL; + char *text = NULL; GntColorType type; int len; if (box->dropdown) { - text = gnt_tree_get_selection_text(GNT_TREE(box->dropdown)); + text = (char *)gnt_tree_get_selection_text(GNT_TREE(box->dropdown)); box->selected = gnt_tree_get_selection_data(GNT_TREE(box->dropdown)); } @@ -96,7 +96,6 @@ { case '\r': case '\t': - /* XXX: Get the selction */ set_selection(box, gnt_tree_get_selection_data(GNT_TREE(box->dropdown))); case 27: gnt_widget_hide(box->dropdown->parent); @@ -114,10 +113,19 @@ if (strcmp(text + 1, GNT_KEY_UP) == 0 || strcmp(text + 1, GNT_KEY_DOWN) == 0) { + GntWidget *parent = box->dropdown->parent; gnt_widget_set_size(box->dropdown, widget->priv.width, 9); - gnt_widget_set_position(box->dropdown->parent, + gnt_widget_set_position(parent, widget->priv.x, widget->priv.y + widget->priv.height - 1); - gnt_widget_draw(box->dropdown->parent); + if (parent->window) + { + if (mvwin(parent->window, widget->priv.y + widget->priv.height - 1, + widget->priv.x) == ERR) + mvwin(parent->window, + widget->priv.y - 9 + 1, widget->priv.x); + } + + gnt_widget_draw(parent); return TRUE; } } @@ -171,6 +179,7 @@ gnt_combo_box_init(GTypeInstance *instance, gpointer class) { GntWidget *box; + GntWidget *widget = GNT_WIDGET(instance); GntComboBox *combo = GNT_COMBO_BOX(instance); GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), @@ -182,6 +191,8 @@ gnt_box_set_pad(GNT_BOX(box), 0); gnt_box_add_widget(GNT_BOX(box), combo->dropdown); + widget->priv.minw = 4; + widget->priv.minh = 3; DEBUG; } Modified: trunk/console/libgnt/gntentry.c =================================================================== --- trunk/console/libgnt/gntentry.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gntentry.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -83,6 +83,10 @@ entry_redraw(widget); } /* XXX: handle other keys, like home/end, and ctrl+ goodness */ + else + return FALSE; + + return TRUE; } else { @@ -136,6 +140,7 @@ entry->scroll--; entry_redraw(widget); + return TRUE; } } } @@ -166,6 +171,7 @@ static void gnt_entry_init(GTypeInstance *instance, gpointer class) { + GntWidget *widget = GNT_WIDGET(instance); GntEntry *entry = GNT_ENTRY(instance); entry->flag = GNT_ENTRY_FLAG_ALL; @@ -174,6 +180,9 @@ GNT_WIDGET_SET_FLAGS(GNT_WIDGET(entry), GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW | GNT_WIDGET_CAN_TAKE_FOCUS); GNT_WIDGET_SET_FLAGS(GNT_WIDGET(entry), GNT_WIDGET_GROW_X); + + widget->priv.minw = 3; + widget->priv.minh = 1; DEBUG; } Modified: trunk/console/libgnt/gntlabel.c =================================================================== --- trunk/console/libgnt/gntlabel.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gntlabel.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -70,7 +70,10 @@ static void gnt_label_init(GTypeInstance *instance, gpointer class) { - GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), GNT_WIDGET_GROW_X | GNT_WIDGET_GROW_Y); + GntWidget *widget = GNT_WIDGET(instance); + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_X); + widget->priv.minw = 3; + widget->priv.minh = 1; DEBUG; } Added: trunk/console/libgnt/gntline.c =================================================================== --- trunk/console/libgnt/gntline.c (rev 0) +++ trunk/console/libgnt/gntline.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -0,0 +1,115 @@ +#include "gntline.h" + +enum +{ + SIGS = 1, +}; + +static GntWidgetClass *parent_class = NULL; +static guint signals[SIGS] = { 0 }; + +static void +gnt_line_draw(GntWidget *widget) +{ + GntLine *line = GNT_LINE(widget); + if (line->vertical) + mvwvline(widget->window, 1, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + widget->priv.height - 3); + else + mvwhline(widget->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + widget->priv.width - 3); +} + +static void +gnt_line_size_request(GntWidget *widget) +{ + if (GNT_LINE(widget)->vertical) + { + widget->priv.width = 1; + widget->priv.height = 5; + } + else + { + widget->priv.width = 5; + widget->priv.height = 1; + } +} + +static void +gnt_line_map(GntWidget *widget) +{ + if (widget->priv.width == 0 || widget->priv.height == 0) + gnt_widget_size_request(widget); + DEBUG; +} + +static void +gnt_line_class_init(GntLineClass *klass) +{ + parent_class = GNT_WIDGET_CLASS(klass); + parent_class->draw = gnt_line_draw; + parent_class->map = gnt_line_map; + parent_class->size_request = gnt_line_size_request; + + DEBUG; +} + +static void +gnt_line_init(GTypeInstance *instance, gpointer class) +{ + GntWidget *widget = GNT_WIDGET(instance); + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_SHADOW | GNT_WIDGET_NO_BORDER); + widget->priv.minw = 1; + widget->priv.minh = 1; + DEBUG; +} + +/****************************************************************************** + * GntLine API + *****************************************************************************/ +GType +gnt_line_get_gtype(void) +{ + static GType type = 0; + + if(type == 0) + { + static const GTypeInfo info = { + sizeof(GntLineClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)gnt_line_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GntLine), + 0, /* n_preallocs */ + gnt_line_init, /* instance_init */ + }; + + type = g_type_register_static(GNT_TYPE_WIDGET, + "GntLine", + &info, 0); + } + + return type; +} + +GntWidget *gnt_line_new(gboolean vertical) +{ + GntWidget *widget = g_object_new(GNT_TYPE_LINE, NULL); + GntLine *line = GNT_LINE(widget); + + line->vertical = vertical; + + if (vertical) + { + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_Y); + } + else + { + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_X); + } + + return widget; +} + Property changes on: trunk/console/libgnt/gntline.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntline.h =================================================================== --- trunk/console/libgnt/gntline.h (rev 0) +++ trunk/console/libgnt/gntline.h 2006-07-10 23:55:24 UTC (rev 16480) @@ -0,0 +1,49 @@ +#ifndef GNT_LINE_H +#define GNT_LINE_H + +#include "gntwidget.h" +#include "gnt.h" +#include "gntcolors.h" +#include "gntkeys.h" + +#define GNT_TYPE_LINE (gnt_line_get_gtype()) +#define GNT_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_LINE, GntLine)) +#define GNT_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_LINE, GntLineClass)) +#define GNT_IS_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_LINE)) +#define GNT_IS_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_LINE)) +#define GNT_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_LINE, GntLineClass)) + +#define GNT_LINE_FLAGS(obj) (GNT_LINE(obj)->priv.flags) +#define GNT_LINE_SET_FLAGS(obj, flags) (GNT_LINE_FLAGS(obj) |= flags) +#define GNT_LINE_UNSET_FLAGS(obj, flags) (GNT_LINE_FLAGS(obj) &= ~(flags)) + +typedef struct _GnLine GntLine; +typedef struct _GnLinePriv GntLinePriv; +typedef struct _GnLineClass GntLineClass; + +struct _GnLine +{ + GntWidget parent; + + gboolean vertical; +}; + +struct _GnLineClass +{ + GntWidgetClass parent; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +G_BEGIN_DECLS + +GType gnt_line_get_gtype(void); + +GntWidget *gnt_line_new(gboolean vertical); + +G_END_DECLS + +#endif /* GNT_LINE_H */ Property changes on: trunk/console/libgnt/gntline.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gntmain.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -400,6 +400,7 @@ { mode = GNT_KP_MODE_NORMAL; changed = TRUE; + gnt_widget_draw(widget); } if (changed) @@ -471,19 +472,7 @@ if (changed) { - GntNode *node = g_hash_table_lookup(nodes, widget); - int x, y; - - gnt_widget_get_position(widget, &x, &y); - - hide_panel(node->panel); - gnt_widget_set_size(widget, width, height); - gnt_widget_set_position(widget, x, y); - gnt_widget_draw(widget); - replace_panel(node->panel, widget->window); - show_panel(node->panel); - update_panels(); - doupdate(); + gnt_screen_resize_widget(widget, width, height); } } } @@ -673,3 +662,21 @@ return ascii_only; } +void gnt_screen_resize_widget(GntWidget *widget, int width, int height) +{ + if (widget->parent == NULL) + { + GntNode *node = g_hash_table_lookup(nodes, widget); + if (!node) + return; + + hide_panel(node->panel); + gnt_widget_set_size(widget, width, height); + gnt_widget_draw(widget); + replace_panel(node->panel, widget->window); + show_panel(node->panel); + update_panels(); + doupdate(); + } +} + Modified: trunk/console/libgnt/gnttextview.c =================================================================== --- trunk/console/libgnt/gnttextview.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gnttextview.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -113,9 +113,14 @@ static void gnt_text_view_init(GTypeInstance *instance, gpointer class) { + GntWidget *widget = GNT_WIDGET(instance); + /* XXX: For now, resizing the width is not permitted. This is because * of the way I am handling wrapped lines. */ GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), GNT_WIDGET_GROW_Y); + + widget->priv.minw = 5; + widget->priv.minh = 1; DEBUG; } Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gnttree.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -399,7 +399,10 @@ static void gnt_tree_init(GTypeInstance *instance, gpointer class) { - GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), GNT_WIDGET_GROW_X | GNT_WIDGET_GROW_Y); + GntWidget *widget = GNT_WIDGET(instance); + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_X | GNT_WIDGET_GROW_Y); + widget->priv.minw = 4; + widget->priv.minh = 3; DEBUG; } Modified: trunk/console/libgnt/gntwidget.c =================================================================== --- trunk/console/libgnt/gntwidget.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gntwidget.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -4,8 +4,6 @@ #include "gntmarshal.h" #include "gnt.h" -#define MIN_SIZE 5 - enum { SIG_DESTROY, @@ -18,6 +16,7 @@ SIG_EXPOSE, SIG_SIZE_REQUEST, SIG_CONFIRM_SIZE, + SIG_SIZE_CHANGED, SIG_POSITION, SIGS }; @@ -71,7 +70,7 @@ static gboolean gnt_widget_dummy_confirm_size(GntWidget *widget, int width, int height) { - if (width < MIN_SIZE || height < MIN_SIZE) + if (width < widget->priv.minw || height < widget->priv.minh) return FALSE; if (widget->priv.width != width && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_X)) return FALSE; @@ -173,6 +172,14 @@ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + signals[SIG_SIZE_CHANGED] = + g_signal_new("size_changed", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GntWidgetClass, size_changed), + NULL, NULL, + gnt_closure_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); signals[SIG_CONFIRM_SIZE] = g_signal_new("confirm_size", G_TYPE_FROM_CLASS(klass), @@ -245,15 +252,8 @@ void gnt_widget_destroy(GntWidget *obj) { - int id; g_return_if_fail(GNT_IS_WIDGET(obj)); - if ((id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(obj), "gnt:queue_update")))) - { - g_source_remove(id); - g_object_set_data(G_OBJECT(obj), "gnt:queue_update", NULL); - } - gnt_widget_hide(obj); delwin(obj->window); if(!(GNT_WIDGET_FLAGS(obj) & GNT_WIDGET_DESTROYING)) @@ -276,7 +276,6 @@ gnt_widget_draw(GntWidget *widget) { /* Draw the widget */ - DEBUG; if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_DRAWING)) return; @@ -293,10 +292,9 @@ if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) shadow = FALSE; - + widget->window = newwin(widget->priv.height + shadow, widget->priv.width + shadow, widget->priv.y, widget->priv.x); - init_widget(widget); } @@ -337,11 +335,10 @@ void gnt_widget_set_position(GntWidget *wid, int x, int y) { + g_signal_emit(wid, signals[SIG_POSITION], 0, x, y); /* XXX: Need to install properties for these and g_object_notify */ wid->priv.x = x; wid->priv.y = y; - - g_signal_emit(wid, signals[SIG_POSITION], 0, x, y); } void @@ -404,27 +401,38 @@ { gboolean ret = TRUE; + if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) + { + width--; + height--; + } + if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED)) { - if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) - { - width--; - height--; - } - g_signal_emit(widget, signals[SIG_CONFIRM_SIZE], 0, width, height, &ret); + ret = gnt_widget_confirm_size(widget, width, height); } if (ret) { gboolean shadow = TRUE; + int oldw, oldh; if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) shadow = FALSE; + oldw = widget->priv.width; + oldh = widget->priv.height; + widget->priv.width = width; widget->priv.height = height; + + g_signal_emit(widget, signals[SIG_SIZE_CHANGED], 0, oldw, oldh); + if (widget->window) + { wresize(widget->window, height + shadow, width + shadow); + init_widget(widget); + } if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED)) init_widget(widget); else @@ -475,7 +483,7 @@ if (!g_object_get_data(G_OBJECT(widget), "gnt:queue_update")) return FALSE; gnt_screen_update(widget); - g_object_set_data(G_OBJECT(widget), "gnt:queue_update", GINT_TO_POINTER(FALSE)); + g_object_set_data(G_OBJECT(widget), "gnt:queue_update", NULL); return FALSE; } @@ -487,7 +495,15 @@ if (!g_object_get_data(G_OBJECT(widget), "gnt:queue_update")) { int id = g_timeout_add(0, update_queue_callback, widget); - g_object_set_data(G_OBJECT(widget), "gnt:queue_update", GINT_TO_POINTER(id)); + g_object_set_data_full(G_OBJECT(widget), "gnt:queue_update", GINT_TO_POINTER(id), + (GDestroyNotify)g_source_remove); } } +gboolean gnt_widget_confirm_size(GntWidget *widget, int width, int height) +{ + gboolean ret = FALSE; + g_signal_emit(widget, signals[SIG_CONFIRM_SIZE], 0, width, height, &ret); + return ret; +} + Modified: trunk/console/libgnt/gntwidget.h =================================================================== --- trunk/console/libgnt/gntwidget.h 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/gntwidget.h 2006-07-10 23:55:24 UTC (rev 16480) @@ -53,6 +53,8 @@ int width, height; GntWidgetFlags flags; char *name; + + int minw, minh; /* Minimum size for the widget */ }; struct _GnWidget @@ -84,6 +86,7 @@ void (*size_request)(GntWidget *widget); gboolean (*confirm_size)(GntWidget *widget, int x, int y); + void (*size_changed)(GntWidget *widget, int w, int h); void (*set_position)(GntWidget *widget, int x, int y); gboolean (*key_pressed)(GntWidget *widget, const char *key); void (*activate)(GntWidget *widget); @@ -108,6 +111,7 @@ void gnt_widget_size_request(GntWidget *widget); void gnt_widget_get_size(GntWidget *widget, int *width, int *height); gboolean gnt_widget_set_size(GntWidget *widget, int width, int height); +gboolean gnt_widget_confirm_size(GntWidget *widget, int width, int height); gboolean gnt_widget_key_pressed(GntWidget *widget, const char *keys); Modified: trunk/console/libgnt/test/combo.c =================================================================== --- trunk/console/libgnt/test/combo.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/test/combo.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -4,11 +4,23 @@ #include <gntcombobox.h> #include <gntlabel.h> +static void +button_activated(GntWidget *b, GntComboBox *combo) +{ + GntWidget *w = b->parent; + + gnt_box_add_widget(GNT_BOX(w), + gnt_label_new(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)))); + fprintf(stderr, "%s\n", gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); + gnt_box_readjust(GNT_BOX(w->parent)); +} + int main() { GntWidget *box, *combo, *button; GntWidget *hbox; + freopen(".error", "w", stderr); gnt_init(); box = gnt_box_new(FALSE, TRUE); @@ -43,6 +55,7 @@ button = gnt_button_new("OK"); gnt_box_add_widget(GNT_BOX(hbox), button); + g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(button_activated), combo); gnt_box_add_widget(GNT_BOX(box), hbox); Modified: trunk/console/libgnt/test/focus.c =================================================================== --- trunk/console/libgnt/test/focus.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/test/focus.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -20,6 +20,7 @@ int main() { + freopen(".error", "w", stderr); gnt_init(); GntWidget *label = gnt_label_new("So wassup dudes and dudettes!!\nSo this is, like,\nthe third line!! \\o/"); @@ -30,7 +31,7 @@ wrefresh(stdscr); vbox = gnt_box_new(FALSE, FALSE); - hbox = gnt_box_new(TRUE, TRUE); + hbox = gnt_box_new(FALSE, TRUE); gnt_widget_set_name(vbox, "vbox"); gnt_widget_set_name(hbox, "hbox"); Modified: trunk/console/libgnt/test/multiwin.c =================================================================== --- trunk/console/libgnt/test/multiwin.c 2006-07-10 18:12:11 UTC (rev 16479) +++ trunk/console/libgnt/test/multiwin.c 2006-07-10 23:55:24 UTC (rev 16480) @@ -60,7 +60,7 @@ gnt_tree_set_row_flags(GNT_TREE(tree), "e", GNT_TEXT_FLAG_DIM); - g_timeout_add(5000, show, box2); + g_timeout_add(5000, (GSourceFunc)show, box2); gnt_main(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sea...@us...> - 2006-07-10 18:12:17
|
Revision: 16479 Author: seanegan Date: 2006-07-10 11:12:11 -0700 (Mon, 10 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16479&view=rev Log Message: ----------- Backport from 2.0.0 Modified Paths: -------------- branches/v2_0_0/src/protocols/jabber/jabber.c Modified: branches/v2_0_0/src/protocols/jabber/jabber.c =================================================================== --- branches/v2_0_0/src/protocols/jabber/jabber.c 2006-07-10 18:08:11 UTC (rev 16478) +++ branches/v2_0_0/src/protocols/jabber/jabber.c 2006-07-10 18:12:11 UTC (rev 16479) @@ -919,15 +919,12 @@ { JabberStream *js = gc->proto_data; -/* This is for Adium. Gaim never uses OpenSSL, because of licensing issues, - * and our configure doesn't check for it. -- rlaager */ -#ifdef HAVE_OPENSSL - /* If using OpenSSL, don't perform any actions on the ssl connection - * if we were forcibly disconnected because it will crash. -- evands + /* Don't perform any actions on the ssl connection + * if we were forcibly disconnected because it will crash + * on some SSL backends. */ if (!gc->disconnect_timeout) -#endif - jabber_send_raw(js, "</stream:stream>", -1); + jabber_send_raw(js, "</stream:stream>", -1); if(js->gsc) { #ifdef HAVE_OPENSSL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sea...@us...> - 2006-07-10 18:08:16
|
Revision: 16478 Author: seanegan Date: 2006-07-10 11:08:11 -0700 (Mon, 10 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16478&view=rev Log Message: ----------- It would be wise to fix the comments Modified Paths: -------------- trunk/src/protocols/jabber/jabber.c Modified: trunk/src/protocols/jabber/jabber.c =================================================================== --- trunk/src/protocols/jabber/jabber.c 2006-07-10 18:02:48 UTC (rev 16477) +++ trunk/src/protocols/jabber/jabber.c 2006-07-10 18:08:11 UTC (rev 16478) @@ -919,8 +919,9 @@ { JabberStream *js = gc->proto_data; - /* If using OpenSSL, don't perform any actions on the ssl connection - * if we were forcibly disconnected because it will crash. -- evands + /* Don't perform any actions on the ssl connection + * if we were forcibly disconnected because it will crash + * on some SSL backends. */ if (!gc->disconnect_timeout) jabber_send_raw(js, "</stream:stream>", -1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sea...@us...> - 2006-07-10 18:02:52
|
Revision: 16477 Author: seanegan Date: 2006-07-10 11:02:48 -0700 (Mon, 10 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16477&view=rev Log Message: ----------- This problem seems to exist on gnutls too; there's really no need ever to try to send data after getting forcably disconnected anyway. Modified Paths: -------------- trunk/src/protocols/jabber/jabber.c Modified: trunk/src/protocols/jabber/jabber.c =================================================================== --- trunk/src/protocols/jabber/jabber.c 2006-07-10 06:59:51 UTC (rev 16476) +++ trunk/src/protocols/jabber/jabber.c 2006-07-10 18:02:48 UTC (rev 16477) @@ -919,15 +919,11 @@ { JabberStream *js = gc->proto_data; -/* This is for Adium. Gaim never uses OpenSSL, because of licensing issues, - * and our configure doesn't check for it. -- rlaager */ -#ifdef HAVE_OPENSSL /* If using OpenSSL, don't perform any actions on the ssl connection * if we were forcibly disconnected because it will crash. -- evands */ if (!gc->disconnect_timeout) -#endif - jabber_send_raw(js, "</stream:stream>", -1); + jabber_send_raw(js, "</stream:stream>", -1); if(js->gsc) { #ifdef HAVE_OPENSSL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-10 06:59:54
|
Revision: 16476 Author: thekingant Date: 2006-07-09 23:59:51 -0700 (Sun, 09 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16476&view=rev Log Message: ----------- Backport SVN revision #16475 from HEAD to v2_0_0 Original commit message: Fix a bug where the last character of the value returned by gaim_strdup_withhtml would be cut off. I accidentally introduced this bug in my change a day or two ago. My bad! ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16475&view=rev Modified Paths: -------------- branches/v2_0_0/src/util.c Modified: branches/v2_0_0/src/util.c =================================================================== --- branches/v2_0_0/src/util.c 2006-07-10 06:59:27 UTC (rev 16475) +++ branches/v2_0_0/src/util.c 2006-07-10 06:59:51 UTC (rev 16476) @@ -2684,8 +2684,8 @@ g_return_val_if_fail(src != NULL, NULL); /* New length is (length of src) + (number of \n's * 3) - (number of \r's) + 1 */ - destsize = 0; - for (i = 0, j = 0; src[i] != '\0'; i++) + destsize = 1; + for (i = 0; src[i] != '\0'; i++) { if (src[i] == '\n') destsize += 4; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-10 06:59:30
|
Revision: 16475 Author: thekingant Date: 2006-07-09 23:59:27 -0700 (Sun, 09 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16475&view=rev Log Message: ----------- Fix a bug where the last character of the value returned by gaim_strdup_withhtml would be cut off. I accidentally introduced this bug in my change a day or two ago. My bad! Modified Paths: -------------- trunk/src/util.c Modified: trunk/src/util.c =================================================================== --- trunk/src/util.c 2006-07-09 21:40:17 UTC (rev 16474) +++ trunk/src/util.c 2006-07-10 06:59:27 UTC (rev 16475) @@ -2684,8 +2684,8 @@ g_return_val_if_fail(src != NULL, NULL); /* New length is (length of src) + (number of \n's * 3) - (number of \r's) + 1 */ - destsize = 0; - for (i = 0, j = 0; src[i] != '\0'; i++) + destsize = 1; + for (i = 0; src[i] != '\0'; i++) { if (src[i] == '\n') destsize += 4; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aar...@us...> - 2006-07-09 21:40:31
|
Revision: 16474 Author: aaronsheldon Date: 2006-07-09 14:40:17 -0700 (Sun, 09 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16474&view=rev Log Message: ----------- Compositing icons takes time. Instead of compositing the same icons over and over again, let's store them in a hash table and retrieve them when we need them. This saves a lot of time when we redo the entire buddy list, such as in a "View Offline Buddies" click, or any other preference change. This way we can reuse them instead of constantly regenerating them. This is especially saving when you have many buddies. Modified Paths: -------------- branches/soc-2006-blist-efficiency/src/gtkblist.c Modified: branches/soc-2006-blist-efficiency/src/gtkblist.c =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-09 16:48:25 UTC (rev 16473) +++ branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-09 21:40:17 UTC (rev 16474) @@ -104,6 +104,7 @@ static guint visibility_manager_count = 0; static gboolean gtk_blist_obscured = FALSE; +GHashTable* status_icon_hash_table = NULL; static GList *gaim_gtk_blist_sort_methods = NULL; static struct gaim_gtk_blist_sort_method *current_sort_method = NULL; @@ -2704,7 +2705,7 @@ { GdkPixbuf *scale, *status = NULL; int i, scalesize = 30; - char *filename; + char *filename, *key, *tmp; const char *protoname = NULL; struct _gaim_gtk_blist_node *gtknode = node->ui_data; struct _gaim_gtk_blist_node *gtkbuddynode = NULL; @@ -2714,6 +2715,9 @@ GaimBuddy *buddy = NULL; GaimChat *chat = NULL; + if (!status_icon_hash_table) + status_icon_hash_table = g_hash_table_new (g_str_hash,g_str_equal); + if(GAIM_BLIST_NODE_IS_CONTACT(node)) { if(!gtknode->contact_expanded) { buddy = gaim_contact_get_priority_buddy((GaimContact*)node); @@ -2780,6 +2784,70 @@ emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL; } +/* Begin Generating Lookup Key */ + if (buddy) { + + if (GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) + key = g_strconcat(protoname, "login", NULL); + else if (!GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) + key = g_strconcat(protoname, "logout", NULL); + else + key = g_strdup(protoname); + + presence = gaim_buddy_get_presence(buddy); + if (!GAIM_BUDDY_IS_ONLINE(buddy)) { + tmp = key; + key = g_strconcat(key, "off", NULL); + g_free(tmp); + } else if (gaim_presence_is_idle(presence)) { + tmp = key; + key = g_strconcat(key, "idle", NULL); + g_free(tmp); + } + + if (!gaim_privacy_check(buddy->account, gaim_buddy_get_name(buddy))) { + tmp = key; + key = g_strconcat(key, "blocked", NULL); + g_free(tmp); + } + + if (size == GAIM_STATUS_ICON_SMALL) { + tmp = key; + key = g_strconcat(key, "small", NULL); + g_free(tmp); + } + + for(i=0; i<4; i++) { + if(emblems[i].filename) { + tmp = key; + key = g_strconcat(key, emblems[i].filename, NULL); + g_free(tmp); + } + } + } + /* There are only two options for chat or gaimdude - big or small */ + else if (chat && size == GAIM_STATUS_ICON_SMALL) + key = g_strconcat(protoname, "chat-s", NULL); + else if (chat) + key = g_strconcat(protoname, "chat", NULL); + else if (size == GAIM_STATUS_ICON_SMALL) + key = g_strdup("gaimdude-s"); + else + key = g_strdup("gaimdude"); + +/* End Generating Lookup Key */ + + +/* If we already know this icon, just return it */ + scale = g_hash_table_lookup (status_icon_hash_table, key); + if (scale) { + gdk_pixbuf_ref(scale); + g_free(key); + return scale; + } + +/* Create a new composite icon */ + if(buddy && GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) { filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "login.png", NULL); } else if(buddy && !GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) { @@ -2835,7 +2903,6 @@ } if(buddy) { - presence = gaim_buddy_get_presence(buddy); if (!GAIM_BUDDY_IS_ONLINE(buddy)) gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); @@ -2866,6 +2933,10 @@ } } + /* Insert the new icon into the status icon hash table */ + g_hash_table_insert (status_icon_hash_table, key, scale); + gdk_pixbuf_ref(scale); + return scale; } @@ -3927,7 +3998,10 @@ if (remove && !GAIM_BLIST_NODE_IS_GROUP(node)) gaim_gtk_blist_hide_node(list, node); - gaim_gtk_blist_update(list, node); + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + gaim_gtk_blist_update_contact(list, node); + else if (GAIM_BLIST_NODE_IS_CHAT(node)) + gaim_gtk_blist_update(list, node); node = gaim_blist_node_next(node, FALSE); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <may...@us...> - 2006-07-09 16:50:34
|
Revision: 16473 Author: mayuan2006 Date: 2006-07-09 09:48:25 -0700 (Sun, 09 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16473&view=rev Log Message: ----------- add the Framework of SOAP request Now can retrieve the Contact via SOAP Request. so many bug still exist! commited by MaYuan<may...@gm...> Modified Paths: -------------- branches/soc-2006-msnp13/src/protocols/msn/Makefile.am branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c branches/soc-2006-msnp13/src/protocols/msn/command.c branches/soc-2006-msnp13/src/protocols/msn/msg.c branches/soc-2006-msnp13/src/protocols/msn/msn-utils.c branches/soc-2006-msnp13/src/protocols/msn/msn.c branches/soc-2006-msnp13/src/protocols/msn/nexus.c branches/soc-2006-msnp13/src/protocols/msn/nexus.h branches/soc-2006-msnp13/src/protocols/msn/notification.c branches/soc-2006-msnp13/src/protocols/msn/notification.h branches/soc-2006-msnp13/src/protocols/msn/session.c branches/soc-2006-msnp13/src/protocols/msn/session.h branches/soc-2006-msnp13/src/protocols/msn/table.c Added Paths: ----------- branches/soc-2006-msnp13/src/protocols/msn/contact.c branches/soc-2006-msnp13/src/protocols/msn/contact.h branches/soc-2006-msnp13/src/protocols/msn/soap.c branches/soc-2006-msnp13/src/protocols/msn/soap.h Property Changed: ---------------- branches/soc-2006-msnp13/src/protocols/msn/Makefile.am branches/soc-2006-msnp13/src/protocols/msn/Makefile.mingw branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c branches/soc-2006-msnp13/src/protocols/msn/cmdproc.h branches/soc-2006-msnp13/src/protocols/msn/command.c branches/soc-2006-msnp13/src/protocols/msn/command.h branches/soc-2006-msnp13/src/protocols/msn/dialog.c branches/soc-2006-msnp13/src/protocols/msn/dialog.h branches/soc-2006-msnp13/src/protocols/msn/directconn.c branches/soc-2006-msnp13/src/protocols/msn/directconn.h branches/soc-2006-msnp13/src/protocols/msn/error.c branches/soc-2006-msnp13/src/protocols/msn/error.h branches/soc-2006-msnp13/src/protocols/msn/group.c branches/soc-2006-msnp13/src/protocols/msn/group.h branches/soc-2006-msnp13/src/protocols/msn/history.c branches/soc-2006-msnp13/src/protocols/msn/history.h branches/soc-2006-msnp13/src/protocols/msn/httpconn.c branches/soc-2006-msnp13/src/protocols/msn/httpconn.h branches/soc-2006-msnp13/src/protocols/msn/msg.c branches/soc-2006-msnp13/src/protocols/msn/msg.h branches/soc-2006-msnp13/src/protocols/msn/msn.c branches/soc-2006-msnp13/src/protocols/msn/msn.h branches/soc-2006-msnp13/src/protocols/msn/nexus.c branches/soc-2006-msnp13/src/protocols/msn/nexus.h branches/soc-2006-msnp13/src/protocols/msn/notification.c branches/soc-2006-msnp13/src/protocols/msn/notification.h branches/soc-2006-msnp13/src/protocols/msn/object.c branches/soc-2006-msnp13/src/protocols/msn/object.h branches/soc-2006-msnp13/src/protocols/msn/page.c branches/soc-2006-msnp13/src/protocols/msn/page.h branches/soc-2006-msnp13/src/protocols/msn/servconn.c branches/soc-2006-msnp13/src/protocols/msn/servconn.h branches/soc-2006-msnp13/src/protocols/msn/session.c branches/soc-2006-msnp13/src/protocols/msn/session.h branches/soc-2006-msnp13/src/protocols/msn/slp.c branches/soc-2006-msnp13/src/protocols/msn/slp.h branches/soc-2006-msnp13/src/protocols/msn/slpcall.c branches/soc-2006-msnp13/src/protocols/msn/slpcall.h branches/soc-2006-msnp13/src/protocols/msn/slplink.c branches/soc-2006-msnp13/src/protocols/msn/slplink.h branches/soc-2006-msnp13/src/protocols/msn/slpmsg.c branches/soc-2006-msnp13/src/protocols/msn/slpmsg.h branches/soc-2006-msnp13/src/protocols/msn/slpsession.c branches/soc-2006-msnp13/src/protocols/msn/slpsession.h branches/soc-2006-msnp13/src/protocols/msn/state.c branches/soc-2006-msnp13/src/protocols/msn/state.h branches/soc-2006-msnp13/src/protocols/msn/switchboard.c branches/soc-2006-msnp13/src/protocols/msn/switchboard.h branches/soc-2006-msnp13/src/protocols/msn/sync.c branches/soc-2006-msnp13/src/protocols/msn/sync.h branches/soc-2006-msnp13/src/protocols/msn/table.c branches/soc-2006-msnp13/src/protocols/msn/table.h branches/soc-2006-msnp13/src/protocols/msn/transaction.c branches/soc-2006-msnp13/src/protocols/msn/transaction.h branches/soc-2006-msnp13/src/protocols/msn/user.c branches/soc-2006-msnp13/src/protocols/msn/user.h branches/soc-2006-msnp13/src/protocols/msn/userlist.c branches/soc-2006-msnp13/src/protocols/msn/userlist.h Modified: branches/soc-2006-msnp13/src/protocols/msn/Makefile.am =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/Makefile.am 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/Makefile.am 2006-07-09 16:48:25 UTC (rev 16473) @@ -8,6 +8,8 @@ cmdproc.h \ command.c \ command.h \ + contact.c\ + contact.h\ dialog.c \ dialog.h \ directconn.c \ @@ -46,6 +48,8 @@ slpmsg.h \ slpsession.c \ slpsession.h \ + soap.c\ + soap.h\ state.c \ state.h \ switchboard.c \ Property changes on: branches/soc-2006-msnp13/src/protocols/msn/Makefile.am ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/Makefile.mingw ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c 2006-07-09 16:48:25 UTC (rev 16473) @@ -127,8 +127,7 @@ trans->callbacks = g_hash_table_lookup(cmdproc->cbs_table->cmds, trans->command); - if (trans->payload != NULL) - { + if (trans->payload != NULL){ data = g_realloc(data, len + trans->payload_len); memcpy(data + len, trans->payload, trans->payload_len); len += trans->payload_len; Property changes on: branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/cmdproc.h ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: branches/soc-2006-msnp13/src/protocols/msn/command.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/command.c 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/command.c 2006-07-09 16:48:25 UTC (rev 16473) @@ -42,7 +42,7 @@ * else return FALSE */ static gboolean -isPayloadCmd(char *str) +msn_check_payload_cmd(char *str) { if( (!strcmp(str,"ADL")) || (!strcmp(str,"GCF")) || @@ -60,7 +60,7 @@ } /*get the payload positon*/ -int getPayloadPosition(char *str) +int msn_get_payload_position(char *str) { /*because MSG has "MSG hotmail hotmail [payload length]"*/ if(!(strcmp(str,"MSG"))){ @@ -72,11 +72,11 @@ * set command Payload length */ int -setPayloadLen(MsnCommand *cmd) +msn_set_payload_len(MsnCommand *cmd) { char * param; - if(isPayloadCmd(cmd->command)){ + if(msn_check_payload_cmd(cmd->command)){ if(!(strcmp(cmd->command,"MSG"))){ param = cmd->params[2]; }else{ @@ -121,7 +121,7 @@ } /*add payload Length checking*/ - setPayloadLen(cmd); + msn_set_payload_len(cmd); gaim_debug_info("MaYuan","get payload len:%d\n",cmd->payload_len); msn_command_ref(cmd); Property changes on: branches/soc-2006-msnp13/src/protocols/msn/command.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/command.h ___________________________________________________________________ Name: svn:mime-type + text/plain Added: branches/soc-2006-msnp13/src/protocols/msn/contact.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/contact.c (rev 0) +++ branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-07-09 16:48:25 UTC (rev 16473) @@ -0,0 +1,220 @@ +/** + * @file contact.c + * get MSN contacts via SOAP request + * created by MaYuan<may...@gm...> + * + * gaim + * + * Gaim 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "msn.h" +#include "soap.h" +#include "contact.h" +#include "xmlnode.h" + +/*new a contact*/ +MsnContact * +msn_contact_new(MsnSession *session) +{ + MsnContact *contact; + + contact = g_new0(MsnContact, 1); + contact->session = session; + contact->soapconn = msn_soap_new(session); + contact->soapconn->parent = contact; + contact->soapconn->ssl_conn = 1; + + return contact; +} + +/*destroy the contact*/ +void +msn_contact_destroy(MsnContact *contact) +{ + msn_soap_destroy(contact->soapconn); + g_free(contact); +} + +/*contact SOAP server login error*/ +static void +msn_contact_login_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data) +{ + MsnSoapConn *soapconn = data; + MsnSession *session; + + session = soapconn->session; + g_return_if_fail(session != NULL); + + msn_session_set_error(session, MSN_ERROR_SERV_DOWN, _("Unable to connect to contact server")); +} + +/*msn contact SOAP server connect process*/ +static void +msn_contact_login_connect_cb(gpointer data, GaimSslConnection *gsc, + GaimInputCondition cond) +{ + MsnSoapConn *soapconn = data; + MsnSession * session; + MsnContact *contact; + + contact = soapconn->parent; + g_return_if_fail(contact != NULL); + + session = contact->session; + g_return_if_fail(session != NULL); + + /*login ok!We can retrieve the contact list*/ + msn_get_contact_list(contact); +} + +static void +msn_parse_contact_list(MsnContact * contact) +{ + xmlnode * node,*envelop,*body,*response,*result,*services,*service,*memberships; + xmlnode *membershipnode,*members,*member,*passport,*role; + int len; + + gaim_debug_misc("xml","parse contact list:{%s}\nsize:%d\n",contact->soapconn->body,contact->soapconn->body_len); + node = xmlnode_from_str(contact->soapconn->body, contact->soapconn->body_len); +// node = xmlnode_from_str(contact->soapconn->body, -1); + + if(node == NULL){ + gaim_debug_misc("xml","parse from str err!\n"); + return; + } + gaim_debug_misc("xml","node{%p},name:%s,child:%s,last:%s\n",node,node->name,node->child->name,node->lastchild->name); + body = xmlnode_get_child(node,"Body"); + gaim_debug_misc("xml","body{%p},name:%s\n",body,body->name); + response = xmlnode_get_child(body,"FindMembershipResponse"); + gaim_debug_misc("xml","response{%p},name:%s\n",response,response->name); + result =xmlnode_get_child(response,"FindMembershipResult"); + gaim_debug_misc("xml","result{%p},name:%s\n",result,result->name); + services =xmlnode_get_child(result,"Services"); + gaim_debug_misc("xml","services{%p},name:%s\n",services,services->name); + service =xmlnode_get_child(services,"Service"); + gaim_debug_misc("xml","service{%p},name:%s\n",service,service->name); + memberships =xmlnode_get_child(service,"Memberships"); + gaim_debug_misc("xml","memberships{%p},name:%s\n",memberships,memberships->name); + for(membershipnode = xmlnode_get_child(memberships, "Membership"); membershipnode; + membershipnode = xmlnode_get_next_twin(membershipnode)){ + role = xmlnode_get_child(membershipnode,"MemberRole"); + gaim_debug_misc("memberrole","role:%s\n",xmlnode_get_data(role)); + members = xmlnode_get_child(membershipnode,"Members"); + for(member = xmlnode_get_child(members, "Member"); member; + member = xmlnode_get_next_twin(member)){ + passport = xmlnode_get_child(member,"PassportName"); + gaim_debug_misc("Passport","name:%s\n",xmlnode_get_data(passport)); + } + } + + xmlnode_free(node); +} + +static void +msn_get_contact_list_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + MsnContact *contact; + MsnSession *session; + + contact = soapconn->parent; + g_return_if_fail(contact != NULL); + session = soapconn->session; + g_return_if_fail(session != NULL); + +// gaim_debug_misc("msn", "soap contact server Reply: {%s}\n", soapconn->read_buf); + msn_parse_contact_list(contact); +} + +static void +msn_contact_written_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + + gaim_debug_info("MaYuan","finish contact written\n"); + soapconn->read_cb = msn_get_contact_list_cb; + msn_soap_read_cb(data,source,cond); +} + +void +msn_get_contact_list(MsnContact * contact) +{ + char * soap_head = NULL; + char * soap_body = NULL; + char * request_str = NULL; + + gaim_debug_info("MaYuan","msn_get_contact_list()...\n"); + contact->soapconn->login_path = g_strdup(MSN_GET_CONTACT_POST_URL); + soap_body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE); + soap_head = g_strdup_printf( + "POST %s HTTP/1.1\r\n" + "SOAPAction: http://www.msn.com/webservices/AddressBook/FindMembership\r\n" + "Content-Type:text/xml; charset=utf-8\r\n" + "Cookie: MSPAuth=%s\r\n" + "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" + "Accept: text/*\r\n" + "Host: %s\r\n" + "Content-Length: %d\r\n" + "Connection: Keep-Alive\r\n" + "Cache-Control: no-cache\r\n\r\n", + contact->soapconn->login_path, + contact->session->passport_info.mspauth, + contact->soapconn->login_host, + strlen(soap_body) + ); + request_str = g_strdup_printf("%s%s", soap_head,soap_body); + g_free(soap_head); + g_free(soap_body); + +// gaim_debug_info("MaYuan","send to contact server{%s}\n",request_str); + msn_soap_write(contact->soapconn,request_str,msn_contact_written_cb); +} + +msn_add_contact() +{ +} + +msn_delete_contact() +{ +} + +msn_block_contact() +{ +} + +msn_unblock_contact() +{ +} + +msn_get_gleams() +{ +} + +void +msn_contact_connect(MsnContact *contact) +{ + /* Authenticate via Windows Live ID. */ + gaim_debug_info("MaYuan","msn_contact_connect...\n"); + + msn_soap_init(contact->soapconn,MSN_CONTACT_SERVER,1, + msn_contact_login_connect_cb, + msn_contact_login_error_cb); +} + Property changes on: branches/soc-2006-msnp13/src/protocols/msn/contact.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: branches/soc-2006-msnp13/src/protocols/msn/contact.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/contact.h (rev 0) +++ branches/soc-2006-msnp13/src/protocols/msn/contact.h 2006-07-09 16:48:25 UTC (rev 16473) @@ -0,0 +1,118 @@ +/** + * @file contact.h Header file for contact.c + * Author + * MaYuan<may...@gm...> + * gaim + * + * Gaim 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef _MSN_CONTACT_H_ +#define _MSN_CONTACT_H_ + +#define MSN_CONTACT_SERVER "contacts.msn.com" + +#define MSN_GET_CONTACT_POST_URL "/abservice/SharingService.asmx" +#define MSN_GET_CONTACT_TEMPLATE "<?xml version='1.0' encoding='utf-8'?>"\ +"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\ + "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\ + "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">09607671-1C32-421F-A6A6-CBFAA51AB5F4</ApplicationId>"\ + "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>"\ + "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">Initial</PartnerScenario>"\ + "</ABApplicationHeader>"\ + "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>"\ + "</ABAuthHeader>"\ + "</soap:Header>"\ + "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\ + "<FindMembership xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<serviceFilter xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<Types xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Messenger</ServiceType>"\ + "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Invitation</ServiceType>"\ + "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">SocialNetwork</ServiceType>"\ + "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Space</ServiceType>"\ + "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Profile</ServiceType>"\ + "</Types>"\ + "</serviceFilter>"\ + "</FindMembership>"\ + "</soap:Body>"\ +"</soap:Envelope>" + +#define MSN_ADDRESS_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ +"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ + "<soap:Header>"\ + "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<ApplicationId>09607671-1C32-421F-A6A6-CBFAA51AB5F4</ApplicationId>"\ + "<IsMigration>false</IsMigration>"\ + "<PartnerScenario>Initial</PartnerScenario>"\ + "</ABApplicationHeader>"\ + "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<ManagedGroupRequest>false</ManagedGroupRequest>"\ + "</ABAuthHeader>"\ + "</soap:Header>"\ + "<soap:Body>"\ + "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<abId>00000000-0000-0000-0000-000000000000</abId>"\ + "<abView>Full</abView>"\ + "</ABFindAll>"\ + "</soap:Body>"\ +"</soap:Envelope>" + +#define MSN_GLEAMS_TEMPLATE = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ +"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ + "<soap:Header>"\ + "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<ApplicationId>09607671-1C32-421F-A6A6-CBFAA51AB5F4</ApplicationId>"\ + "<IsMigration>false</IsMigration>"\ + "<PartnerScenario>Initial</PartnerScenario>"\ + "</ABApplicationHeader>"\ + "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<ManagedGroupRequest>false</ManagedGroupRequest>"\ + "</ABAuthHeader>"\ + "</soap:Header>"\ + "<soap:Body>"\ + "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ + "<abId>00000000-0000-0000-0000-000000000000</abId>"\ + "<abView>Full</abView>"\ + "<dynamicItemView>Gleam</dynamicItemView>"\ + "<dynamicItemLastChange>0001-01-01T00:00:00.0000000-08:00</dynamicItemLastChange>"\ + "</ABFindAll>"\ + "</soap:Body>"\ +"</soap:Envelope>" + +typedef struct _MsnContact MsnContact; + +struct _MsnContact +{ + MsnSession *session; + + MsnSoapConn *soapconn; +}; + +/*function prototype*/ +MsnContact * msn_contact_new(MsnSession *session); +void msn_get_contact_list(MsnContact * contact); +void msn_contact_connect(MsnContact *contact); + +void msn_contact_destroy(MsnContact *contact); +void msn_get_contact_list(MsnContact * contact); + +#endif/* _MSN_CMDPROC_H_*/ + Property changes on: branches/soc-2006-msnp13/src/protocols/msn/contact.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Property changes on: branches/soc-2006-msnp13/src/protocols/msn/dialog.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/dialog.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/directconn.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/directconn.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/error.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/error.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/group.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/group.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/history.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/history.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/httpconn.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/httpconn.h ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: branches/soc-2006-msnp13/src/protocols/msn/msg.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/msg.c 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/msg.c 2006-07-09 16:48:25 UTC (rev 16473) @@ -231,8 +231,7 @@ elems = g_strsplit(tmp, "\r\n", 0); - for (cur = elems; *cur != NULL; cur++) - { + for (cur = elems; *cur != NULL; cur++){ const char *key, *value; tokens = g_strsplit(*cur, ": ", 2); @@ -240,20 +239,17 @@ key = tokens[0]; value = tokens[1]; - if (!strcmp(key, "MIME-Version")) - { + /*if not MIME content ,then return*/ + if (!strcmp(key, "MIME-Version")){ g_strfreev(tokens); continue; } - if (!strcmp(key, "Content-Type")) - { + if (!strcmp(key, "Content-Type")){ char *charset, *c; - if ((c = strchr(value, ';')) != NULL) - { - if ((charset = strchr(c, '=')) != NULL) - { + if ((c = strchr(value, ';')) != NULL){ + if ((charset = strchr(c, '=')) != NULL) { charset++; msn_message_set_charset(msg, charset); } @@ -262,9 +258,7 @@ } msn_message_set_content_type(msg, value); - } - else - { + }else{ msn_message_set_attr(msg, key, value); } @@ -280,8 +274,7 @@ content_type = msn_message_get_content_type(msg); if (content_type != NULL && - !strcmp(content_type, "application/x-msnmsgrp2p")) - { + !strcmp(content_type, "application/x-msnmsgrp2p")){ MsnSlpHeader header; MsnSlpFooter footer; int body_len; @@ -323,9 +316,7 @@ tmp += sizeof(footer); msg->msnslp_footer.value = GUINT32_FROM_BE(footer.value); } - } - else - { + }else{ if (payload_len - (tmp - tmp_base) > 0) { msg->body_len = payload_len - (tmp - tmp_base); msg->body = g_malloc0(msg->body_len + 1); @@ -785,3 +776,4 @@ g_string_free(str, TRUE); } + Property changes on: branches/soc-2006-msnp13/src/protocols/msn/msg.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/msg.h ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: branches/soc-2006-msnp13/src/protocols/msn/msn-utils.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/msn-utils.c 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/msn-utils.c 2006-07-09 16:48:25 UTC (rev 16473) @@ -351,14 +351,14 @@ host = g_strdup(str); - if ((c = strchr(host, ':')) != NULL) - { + if ((c = strchr(host, ':')) != NULL){ *c = '\0'; port = atoi(c + 1); + }else{ + port = 1863; } - else - port = 1863; *ret_host = host; *ret_port = port; } + Modified: branches/soc-2006-msnp13/src/protocols/msn/msn.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/msn.c 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/msn.c 2006-07-09 16:48:25 UTC (rev 16473) @@ -892,8 +892,7 @@ gc = gaim_account_get_connection(account); - if (gc != NULL) - { + if (gc != NULL){ session = gc->proto_data; msn_change_status(session); } Property changes on: branches/soc-2006-msnp13/src/protocols/msn/msn.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/msn.h ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: branches/soc-2006-msnp13/src/protocols/msn/nexus.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/nexus.c 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/nexus.c 2006-07-09 16:48:25 UTC (rev 16473) @@ -22,6 +22,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "msn.h" +#include "soap.h" #include "nexus.h" #include "notification.h" @@ -36,6 +37,10 @@ nexus = g_new0(MsnNexus, 1); nexus->session = session; + nexus->soapconn = msn_soap_new(session); + nexus->soapconn->parent = nexus; + /*we must use SSL connection to do Windows Live ID authentication*/ + nexus->soapconn->ssl_conn = 1; nexus->challenge_data = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); @@ -45,90 +50,14 @@ void msn_nexus_destroy(MsnNexus *nexus) { - g_free(nexus->login_host); - - g_free(nexus->login_path); - if (nexus->challenge_data != NULL) g_hash_table_destroy(nexus->challenge_data); - if (nexus->input_handler > 0) - gaim_input_remove(nexus->input_handler); - g_free(nexus->write_buf); - g_free(nexus->read_buf); - + msn_soap_destroy(nexus->soapconn); g_free(nexus); } /************************************************************************** - * Util - **************************************************************************/ - -static gssize -msn_ssl_read(MsnNexus *nexus) -{ - gssize len; - gssize total_len = 0; - char temp_buf[4096]; - - if((len = gaim_ssl_read(nexus->gsc, temp_buf, - sizeof(temp_buf))) > 0) - { -#if 0 - g_string_append(nexus->read_buf,temp_buf); -#else - total_len += len; - nexus->read_buf = g_realloc(nexus->read_buf, - nexus->read_len + len + 1); - strncpy(nexus->read_buf + nexus->read_len, temp_buf, len); - nexus->read_len += len; - nexus->read_buf[nexus->read_len] = '\0'; -#endif - } -// gaim_debug_info("MaYuan","nexus ssl read:{%s}\n",nexus->read_buf); - return total_len; -} - -static void -nexus_write_cb(gpointer data, gint source, GaimInputCondition cond) -{ - MsnNexus *nexus = data; - int len, total_len; - - total_len = strlen(nexus->write_buf); - - /* - * write the content to SSL server, - * We use SOAP to request Windows Live ID authentication - */ - len = gaim_ssl_write(nexus->gsc, - nexus->write_buf + nexus->written_len, - total_len - nexus->written_len); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) { - gaim_input_remove(nexus->input_handler); - nexus->input_handler = -1; - /* TODO: notify of the error */ - return; - } - nexus->written_len += len; - - if (nexus->written_len < total_len) - return; - - gaim_input_remove(nexus->input_handler); - nexus->input_handler = -1; - - g_free(nexus->write_buf); - nexus->write_buf = NULL; - nexus->written_len = 0; - - nexus->written_cb(nexus, source, 0); -} - -/************************************************************************** * Login **************************************************************************/ @@ -139,74 +68,38 @@ static void login_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data) { - MsnNexus *nexus; + MsnSoapConn * soapconn = data; MsnSession *session; - nexus = data; - g_return_if_fail(nexus != NULL); - - session = nexus->session; + session = soapconn->session; g_return_if_fail(session != NULL); - msn_session_set_error(session, MSN_ERROR_AUTH, _("Unable to connect")); + msn_session_set_error(session, MSN_ERROR_AUTH, _("Windows Live ID authentication:Unable to connect")); /* the above line will result in nexus being destroyed, so we don't want * to destroy it here, or we'd crash */ } static void -nexus_login_written_cb(gpointer data, gint source, GaimInputCondition cond) +nexus_login_read_cb(gpointer data, gint source, GaimInputCondition cond) { - MsnNexus *nexus = data; + MsnSoapConn * soapconn = data; + MsnNexus *nexus; MsnSession *session; - int len; + nexus = soapconn->parent; + g_return_if_fail(nexus != NULL); session = nexus->session; g_return_if_fail(session != NULL); - if (nexus->input_handler == -1) - nexus->input_handler = gaim_input_add(nexus->gsc->fd, - GAIM_INPUT_READ, nexus_login_written_cb, nexus); + gaim_debug_misc("msn", "TWN Server Reply: {%s}\n", soapconn->read_buf); - /*read the request header*/ - len = msn_ssl_read(nexus); - if (len < 0 && errno == EAGAIN){ - return; - }else if (len < 0) { - gaim_input_remove(nexus->input_handler); - nexus->input_handler = -1; - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - /* TODO: error handling */ - return; - } - - if(nexus->read_buf == NULL){ - return; - } - if (g_strstr_len(nexus->read_buf, nexus->read_len, - "</S:Envelope>") == NULL){ - return; - } - - gaim_input_remove(nexus->input_handler); - nexus->input_handler = -1; - gaim_ssl_close(nexus->gsc); - nexus->gsc = NULL; - -// gaim_debug_misc("msn", "TWN Server Reply: {%s}", nexus->read_buf); - - if (strstr(nexus->read_buf, "HTTP/1.1 302") != NULL){ + if (strstr(soapconn->read_buf, "HTTP/1.1 302") != NULL){ /* Redirect. */ char *location, *c; - location = strstr(nexus->read_buf, "Location: "); - if (location == NULL) - { - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - + location = strstr(soapconn->read_buf, "Location: "); + if (location == NULL){ + msn_soap_free_read_buf(soapconn); return; } location = strchr(location, ' ') + 1; @@ -218,24 +111,19 @@ if ((c = strchr(location, '/')) != NULL) location = c + 2; - if ((c = strchr(location, '/')) != NULL) - { - g_free(nexus->login_path); - nexus->login_path = g_strdup(c); + if ((c = strchr(location, '/')) != NULL){ + g_free(soapconn->login_path); + soapconn->login_path = g_strdup(c); *c = '\0'; } + g_free(soapconn->login_host); - g_free(nexus->login_host); - nexus->login_host = g_strdup(location); - - gaim_ssl_connect(session->account, nexus->login_host, - GAIM_SSL_DEFAULT_PORT, login_connect_cb, - login_error_cb, nexus); - }else if (strstr(nexus->read_buf, "HTTP/1.1 401 Unauthorized") != NULL){ + msn_soap_init(soapconn,location,1,login_connect_cb,login_error_cb); + }else if (strstr(soapconn->read_buf, "HTTP/1.1 401 Unauthorized") != NULL){ const char *error; - if ((error = strstr(nexus->read_buf, "WWW-Authenticate")) != NULL) { + if ((error = strstr(soapconn->read_buf, "WWW-Authenticate")) != NULL) { if ((error = strstr(error, "cbtxt=")) != NULL){ const char *c; char *temp; @@ -251,67 +139,70 @@ } } msn_session_set_error(session, MSN_ERROR_AUTH, error); - }else if (strstr(nexus->read_buf, "HTTP/1.1 200 OK")){ + }else if (strstr(soapconn->read_buf, "HTTP/1.1 200 OK")){ /*reply OK, we should process the SOAP body*/ char *base, *c; + char *msn_twn_t,*msn_twn_p; char *login_params; - char *length_start,*length_end,*body_len; char **elems, **cur, **tokens; - const char * cert_str; + char * cert_str; - gaim_debug_info("MaYuan","Receive 200\n"); -#if 0 - length_start = strstr(nexus->read_buf, "Content-Length: "); - length_start += strlen("Content-Length: "); - length_end = strstr(length_start, "\r\n"); - body_len = g_strndup(length_start,length_end - length_start); -// gaim_debug_info("MaYuan","body length is :%s\n",body_len); + gaim_debug_info("MaYuan","Windows Live ID Reply OK!\n"); - g_free(body_len); -// g_return_if_fail(body_len != NULL); -#endif //TODO: we should parse it using XML - base = strstr(base, TWN_START_TOKEN); + base = g_strstr_len(soapconn->read_buf, soapconn->read_len, TWN_START_TOKEN); base += strlen(TWN_START_TOKEN); -// gaim_debug_info("MaYuan","base is :%s\n",base); - c = strstr(base, TWN_END_TOKEN); -// gaim_debug_info("MaYuan","c is :%s\n",c); -// gaim_debug_info("MaYuan","len is :%d\n",c-base); + c = g_strstr_len(soapconn->read_buf, soapconn->read_len, TWN_END_TOKEN); login_params = g_strndup(base, c - base); - gaim_debug_info("msn", "TWN Cert: {%s}\n", login_params); +// gaim_debug_info("msn", "TWN Cert: {%s}\n", login_params); /* Parse the challenge data. */ elems = g_strsplit(login_params, "&", 0); for (cur = elems; *cur != NULL; cur++){ tokens = g_strsplit(*cur, "=", 2); - g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]); + g_hash_table_insert(nexus->challenge_data, tokens[0], tokens[1]); /* Don't free each of the tokens, only the array. */ g_free(tokens); } g_strfreev(elems); - cert_str = g_strdup_printf("t=%s&p=%s", - (char *)g_hash_table_lookup(nexus->challenge_data, "t"), - (char *)g_hash_table_lookup(nexus->challenge_data, "p") - ); + msn_twn_t = (char *)g_hash_table_lookup(nexus->challenge_data, "t"); + msn_twn_p = (char *)g_hash_table_lookup(nexus->challenge_data, "p"); + + /*setup the t and p parameter for session*/ + if (session->passport_info.t != NULL){ + g_free(session->passport_info.t); + } + session->passport_info.t = g_strdup(msn_twn_t); + + if (session->passport_info.p != NULL) + g_free(session->passport_info.p); + session->passport_info.p = g_strdup(msn_twn_p); + + cert_str = g_strdup_printf("t=%s&p=%s",msn_twn_t,msn_twn_p); msn_got_login_params(session, cert_str); + gaim_debug_info("MaYuan","close nexus connection! \n"); g_free(cert_str); -// g_free(body_len); g_free(login_params); -// return; msn_nexus_destroy(nexus); session->nexus = NULL; return; } + msn_soap_free_read_buf(soapconn); +} - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; +static void +nexus_login_written_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + + soapconn->read_cb = nexus_login_read_cb; + msn_soap_read_cb(data,source,cond); } @@ -319,26 +210,27 @@ login_connect_cb(gpointer data, GaimSslConnection *gsc, GaimInputCondition cond) { - MsnNexus *nexus; + MsnSoapConn *soapconn; + MsnNexus * nexus; MsnSession *session; char *username, *password; char *request_str, *head, *tail,*challenge_str; - char *buffer = NULL; - guint32 ctint; gaim_debug_info("MaYuan","starting Windows Live ID authentication\n"); - nexus = data; + + soapconn = data; + g_return_if_fail(soapconn != NULL); + + nexus = soapconn->parent; g_return_if_fail(nexus != NULL); - session = nexus->session; + session = soapconn->session; g_return_if_fail(session != NULL); - nexus->gsc = gsc; - msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); + /*prepare the Windows Live ID authentication token*/ username = g_strdup(gaim_account_get_username(session->account)); - password = g_strdup(gaim_connection_get_password(session->account->gc)); // g_strdup(gaim_url_encode(gaim_connection_get_password(session->account->gc))); @@ -360,7 +252,7 @@ /*build the SOAP windows Live ID XML body */ tail = g_strdup_printf(TWN_ENVELOP_TEMPLATE,username,password,challenge_str ); - nexus->login_path = g_strdup(TWN_POST_URL); + soapconn->login_path = g_strdup(TWN_POST_URL); head = g_strdup_printf( "POST %s HTTP/1.1\r\n" "Accept: text/*\r\n" @@ -369,30 +261,19 @@ "Content-Length: %d\r\n" "Connection: Keep-Alive\r\n" "Cache-Control: no-cache\r\n\r\n", - nexus->login_path,nexus->login_host,strlen(tail)); + soapconn->login_path,soapconn->login_host,strlen(tail)); request_str = g_strdup_printf("%s%s", head,tail); -// gaim_debug_misc("msn", "TWN Sending: {%s}\n", request_str); + gaim_debug_misc("msn", "TWN Sending: {%s}\n", request_str); -// g_free(nexus->login_path); - g_free(buffer); g_free(head); g_free(tail); g_free(username); g_free(password); - nexus->write_buf = request_str; - nexus->written_len = 0; + /*prepare to send the SOAP request*/ + msn_soap_write(soapconn,request_str,nexus_login_written_cb); - nexus->read_len = 0; - - nexus->written_cb = nexus_login_written_cb; - - nexus->input_handler = gaim_input_add(gsc->fd, GAIM_INPUT_WRITE, - nexus_write_cb, nexus); - - nexus_write_cb(nexus, gsc->fd, GAIM_INPUT_WRITE); - return; } @@ -404,8 +285,7 @@ { /* Authenticate via Windows Live ID. */ gaim_debug_info("MaYuan","msn_nexus_connect...\n"); - nexus->login_host = g_strdup(TWN_SERVER); - gaim_ssl_connect(nexus->session->account, nexus->login_host, - GAIM_SSL_DEFAULT_PORT, login_connect_cb, login_error_cb, - nexus); + + msn_soap_init(nexus->soapconn,MSN_TWN_SERVER,1,login_connect_cb,login_error_cb); } + Property changes on: branches/soc-2006-msnp13/src/protocols/msn/nexus.c ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: branches/soc-2006-msnp13/src/protocols/msn/nexus.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/nexus.h 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/nexus.h 2006-07-09 16:48:25 UTC (rev 16473) @@ -24,8 +24,10 @@ #ifndef _MSN_NEXUS_H_ #define _MSN_NEXUS_H_ -#define TWN_SERVER "loginnet.passport.com" +#include "soap.h" +#define MSN_TWN_SERVER "loginnet.passport.com" + #define TWN_START_TOKEN "<wsse:BinarySecurityToken Id=\"PPToken1\">" #define TWN_END_TOKEN "</wsse:BinarySecurityToken>" @@ -75,20 +77,8 @@ struct _MsnNexus { MsnSession *session; - - char *login_host; - char *login_path; + MsnSoapConn *soapconn; GHashTable *challenge_data; - GaimSslConnection *gsc; - - guint input_handler; - - char *write_buf; - gsize written_len; - GaimInputFunction written_cb; - - char *read_buf; - gsize read_len; }; void msn_nexus_connect(MsnNexus *nexus); Property changes on: branches/soc-2006-msnp13/src/protocols/msn/nexus.h ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: branches/soc-2006-msnp13/src/protocols/msn/notification.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-07-09 16:48:25 UTC (rev 16473) @@ -238,7 +238,8 @@ msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); - msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); +// msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); + //TODO we should use SOAP contact to fetch contact list }else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")){ /* Passport authentication */ char **elems, **cur, **tokens; @@ -397,8 +398,8 @@ /************************************************************************** * Challenges + * we use MD5 to caculate the Chanllenges **************************************************************************/ - static void chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { @@ -416,7 +417,7 @@ gaim_cipher_context_append(context, (const guchar *)cmd->params[1], strlen(cmd->params[1])); - challenge_resp = "VT6PX?UQTM4WM%YR"; + challenge_resp = MSNP13_WLM_PRODUCT_KEY; gaim_cipher_context_append(context, (const guchar *)challenge_resp, strlen(challenge_resp)); @@ -426,7 +427,7 @@ for (i = 0; i < 16; i++) g_snprintf(buf + (i*2), 3, "%02x", digest[i]); - trans = msn_transaction_new(cmdproc, "QRY", "%s 32", "PROD0038W!61ZTF9"); + trans = msn_transaction_new(cmdproc, "QRY", "%s 32", MSNP13_WLM_PRODUCT_ID); msn_transaction_set_payload(trans, buf, 32); @@ -436,7 +437,6 @@ /************************************************************************** * Buddy Lists **************************************************************************/ - static void add_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { @@ -554,6 +554,10 @@ g_strfreev(params); } +static void adl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) +{ +} + static void adg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { @@ -1100,12 +1104,9 @@ msn_parse_socket(cmd->params[2], &host, &port); - if (!strcmp(cmd->params[1], "SB")) - { + if (!strcmp(cmd->params[1], "SB")){ gaim_debug_error("msn", "This shouldn't be handled here.\n"); - } - else if (!strcmp(cmd->params[1], "NS")) - { + }else if (!strcmp(cmd->params[1], "NS")){ MsnSession *session; session = cmdproc->session; @@ -1123,7 +1124,6 @@ { gaim_debug_info("MaYuan","Processing GCF... \n"); if(cmd->payload_len == 0){ -// cmd->payload_len = is_num(cmd->params[1]) ? atoi(cmd->params[1]) : 0; return; } /*get the payload content*/ @@ -1149,49 +1149,53 @@ MsnSession *session; const char *value; + gaim_debug_info("MaYuan","profile_msg... \n"); session = cmdproc->session; if (strcmp(msg->remote_user, "Hotmail")) /* This isn't an official message. */ return; - if ((value = msn_message_get_attr(msg, "kv")) != NULL) - { + if ((value = msn_message_get_attr(msg, "kv")) != NULL){ if (session->passport_info.kv != NULL) g_free(session->passport_info.kv); session->passport_info.kv = g_strdup(value); } - if ((value = msn_message_get_attr(msg, "sid")) != NULL) - { + if ((value = msn_message_get_attr(msg, "sid")) != NULL){ if (session->passport_info.sid != NULL) g_free(session->passport_info.sid); session->passport_info.sid = g_strdup(value); } - if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) - { + if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL){ if (session->passport_info.mspauth != NULL) g_free(session->passport_info.mspauth); + gaim_debug_info("MaYuan","MSPAuth:%s\n",value); session->passport_info.mspauth = g_strdup(value); } - if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL) - { + if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL){ if (session->passport_info.client_ip != NULL) g_free(session->passport_info.client_ip); session->passport_info.client_ip = g_strdup(value); } - if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL) + if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL){ session->passport_info.client_port = ntohs(atoi(value)); + } if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL) session->passport_info.sl = atol(value); + + /*starting retrieve the contact list*/ + session->contact = msn_contact_new(session); + msn_contact_connect(session->contact); + } static void Property changes on: branches/soc-2006-msnp13/src/protocols/msn/notification.c ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: branches/soc-2006-msnp13/src/protocols/msn/notification.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/notification.h 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/notification.h 2006-07-09 16:48:25 UTC (rev 16473) @@ -24,6 +24,14 @@ #ifndef _MSN_NOTIFICATION_H_ #define _MSN_NOTIFICATION_H_ +/*MSN protocol challenge info*/ +/*MSNP13 challenge*/ +#define MSNP13_WLM_PRODUCT_KEY "O4BG@C7BWLYQX?5G" +#define MSNP13_WLM_PRODUCT_ID "PROD01065C%ZFN6F" + +#define MSNP10_PRODUCT_KEY "VT6PX?UQTM4WM%YR" +#define MSNP10_PRODUCT_ID "PROD0038W!61ZTF9" + typedef struct _MsnNotification MsnNotification; #include "session.h" Property changes on: branches/soc-2006-msnp13/src/protocols/msn/notification.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/object.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/object.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/page.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/page.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/servconn.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/servconn.h ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: branches/soc-2006-msnp13/src/protocols/msn/session.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/session.c 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/session.c 2006-07-09 16:48:25 UTC (rev 16473) @@ -70,6 +70,8 @@ msn_userlist_destroy(session->userlist); + g_free(session->passport_info.t); + g_free(session->passport_info.p); g_free(session->passport_info.kv); g_free(session->passport_info.sid); g_free(session->passport_info.mspauth); Property changes on: branches/soc-2006-msnp13/src/protocols/msn/session.c ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: branches/soc-2006-msnp13/src/protocols/msn/session.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/session.h 2006-07-09 07:24:14 UTC (rev 16472) +++ branches/soc-2006-msnp13/src/protocols/msn/session.h 2006-07-09 16:48:25 UTC (rev 16473) @@ -38,6 +38,7 @@ #include "cmdproc.h" #include "nexus.h" #include "httpconn.h" +#include "contact.h" #include "userlist.h" #include "sync.h" @@ -94,6 +95,7 @@ MsnNotification *notification; MsnNexus *nexus; + MsnContact *contact; MsnSync *sync; MsnUserList *userlist; @@ -107,6 +109,10 @@ struct { + /*t and p, get via USR TWN*/ + char *t; + char *p; + char *kv; char *sid; char *mspauth; @@ -114,7 +120,6 @@ char *file; char *client_ip; int client_port; - } passport_info; }; Property changes on: branches/soc-2006-msnp13/src/protocols/msn/session.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/slp.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/slp.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/slpcall.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/slpcall.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/slplink.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/slplink.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/slpmsg.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/slpmsg.h ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/slpsession.c ___________________________________________________________________ Name: svn:mime-type + text/plain Property changes on: branches/soc-2006-msnp13/src/protocols/msn/slpsession.h ___________________________________________________________________ Name: svn:mime-type + text/plain Added: branches/soc-2006-msnp13/src/protocols/msn/soap.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/soap.c (rev 0) +++ branches/soc-2006-msnp13/src/protocols/msn/soap.c 2006-07-09 16:48:25 UTC (rev 16473) @@ -0,0 +1,302 @@ +/** + * @file soap.c + * SOAP connection related process + * Author + * MaYuan<may...@gm...> + * gaim + * + * Gaim 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "msn.h" +#include "soap.h" + +/*new a soap connection*/ +MsnSoapConn * +msn_soap_new(MsnSession *session) +{ + MsnSoapConn *soapconn; + + soapconn = g_new0(MsnSoapConn, 1); + soapconn->session = session; + soapconn->input_handler = -1; + soapconn->output_handler = -1; + return soapconn; +} + +/*ssl soap connect callback*/ +void +msn_soap_connect_cb(gpointer data, GaimSslConnection *gsc, + GaimInputCondition cond) +{ + MsnSoapConn * soapconn; + MsnSession *session; + + gaim_debug_info("MaYuan","Soap connection connected!\n"); + soapconn = data; + g_return_if_fail(soapconn != NULL); + + session = soapconn->session; + g_return_if_fail(session != NULL); + + soapconn->gsc = gsc; + + /*connection callback*/ + if(soapconn->connect_cb != NULL){ + soapconn->connect_cb(data,gsc,cond); + } +} + +/*ssl soap error callback*/ +static void +msn_soap_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data) +{ + MsnSoapConn * soapconn = data; + g_return_if_fail(data != NULL); + gaim_debug_info("MaYuan","Soap connection error!\n"); + /*error callback*/ + if(soapconn->error_cb != NULL){ + soapconn->error_cb(gsc,error,data); + } +} + +/*init the soap connection*/ +void +msn_soap_init(MsnSoapConn *soapconn,char * host,int ssl, + GaimSslInputFunction connect_cb, + GaimSslErrorFunction error_cb) +{ + soapconn->login_host = g_strdup(host); + soapconn->ssl_conn = ssl; + soapconn->connect_cb = connect_cb; + soapconn->error_cb = error_cb; + if(soapconn->ssl_conn){ + gaim_ssl_connect(soapconn->session->account, soapconn->login_host, + GAIM_SSL_DEFAULT_PORT, msn_soap_connect_cb, msn_soap_error_cb, + soapconn); + }else{ + } +} + +/*destroy the soap connection*/ +void +msn_soap_destroy(MsnSoapConn *soapconn) +{ + g_free(soapconn->login_host); + g_free(soapconn->login_path); + + /*remove the write handler*/ + if (soapconn->output_handler > 0){ + gaim_input_remove(soapconn->output_handler); + } + /*remove the read handler*/ + if (soapconn->input_handler > 0){ + gaim_input_remove(soapconn->input_handler); + } + msn_soap_free_read_buf(soapconn); + msn_soap_free_write_buf(soapconn); + + /*close ssl connection*/ + gaim_ssl_close(soapconn->gsc); + soapconn->gsc = NULL; + + g_free(soapconn); +} + +/*read and append the content to the buffer*/ +static gssize +msn_soap_read(MsnSoapConn *soapconn) +{ + gssize len; + gssize total_len = 0; + char temp_buf[10240]; + + if(soapconn->ssl_conn){ + len = gaim_ssl_read(soapconn->gsc, temp_buf,sizeof(temp_buf)); + }else{ + len = read(soapconn->fd, temp_buf,sizeof(temp_buf)); + } + if(len >0){ + total_len += len; + soapconn->read_buf = g_realloc(soapconn->read_buf, + soapconn->read_len + len + 1); +// strncpy(soapconn->read_buf + soapconn->read_len, temp_buf, len); + memcpy(soapconn->read_buf + soapconn->read_len, temp_buf, len); + soapconn->read_len += len; + soapconn->read_buf[soapconn->read_len] = '\0'; + } +// gaim_debug_info("MaYuan","nexus ssl read:{%s}\n",soapconn->read_buf); + return total_len; +} + +/*read the whole SOAP server response*/ +void +msn_soap_read_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn *soapconn = data; + MsnSession *session; + int len; + char * body_start,*body_len; + char *length_start,*length_end; + + gaim_debug_misc("MaYuan", "soap read cb\n"); + session = soapconn->session; + g_return_if_fail(session != NULL); + + if (soapconn->input_handler == -1){ + soapconn->input_handler = gaim_input_add(soapconn->gsc->fd, + GAIM_INPUT_READ, msn_soap_read_cb, soapconn); + } + + /*read the request header*/ + len = msn_soap_read(soapconn); + if (len < 0 && errno == EAGAIN){ + return; + }else if (len < 0) { + gaim_debug_error("msn", "read Error!len:%d\n",len); + gaim_input_remove(soapconn->input_handler); + soapconn->input_handler = -1; + g_free(soapconn->read_buf); + soapconn->read_buf = NULL; + soapconn->read_len = 0; + /* TODO: error handling */ + return; + } + + if(soapconn->read_buf == NULL){ + return; + } + + body_start = (char *)g_strstr_len(soapconn->read_buf, soapconn->read_len,"\r\n\r\n"); + if(!body_start){ + return; + } + body_start += 4; + +// gaim_debug_misc("msn", "Soap Read: {%s}\n", soapconn->read_buf); + + /* we read the content-length*/ + length_start = strstr(soapconn->read_buf, "Content-Length: "); + length_start += strlen("Content-Length: "); + length_end = strstr(length_start, "\r\n"); + body_len = g_strndup(length_start,length_end - length_start); + + /*setup the conn body */ + soapconn->body = body_start; + soapconn->body_len = atoi(body_len); +// gaim_debug_misc("MaYuan","content length :%d",soapconn->body_len); + + if(soapconn->read_len < body_start - soapconn->read_buf + atoi(body_len)){ + return; + } + + g_free(body_len); + + /*call the read callback*/ + if(soapconn->read_cb != NULL){ + soapconn->read_cb(soapconn,source,0); + } +#if 0 + /*clear the read buffer*/ + msn_soap_free_read_buf(soapconn); + + /*remove the read handler*/ + gaim_input_remove(soapconn->input_handler); + soapconn->input_handler = -1; + gaim_ssl_close(soapconn->gsc); + soapconn->gsc = NULL; +#endif +} + +void +msn_soap_free_read_buf(MsnSoapConn *soapconn) +{ + if(soapconn->read_buf){ + g_free(soapconn->read_buf); + } + soapconn->read_buf = NULL; + soapconn->read_len = 0; +} + +void +msn_soap_free_write_buf(MsnSoapConn *soapconn) +{ + if(soapconn->write_buf){ + g_free(soapconn->write_buf); + } + soapconn->write_buf = NULL; + soapconn->written_len = 0; +} + +/*Soap write process func*/ +static void +msn_soap_write_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn *soapconn = data; + int len, total_len; + + total_len = strlen(soapconn->write_buf); + + /* + * write the content to SSL server, + */ + len = gaim_ssl_write(soapconn->gsc, + soapconn->write_buf + soapconn->written_len, + total_len - soapconn->written_len); + + if (len < 0 && errno == EAGAIN) + return; + else if (len <= 0){ + /*SSL write error!*/ + gaim_input_remove(soapconn->output_handler); + soapconn->output_handler = -1; + /* TODO: notify of the error */ + return; + } + soapconn->written_len += len; + + if (soapconn->written_len < total_len) + return; + + gaim_input_remove(soapconn->output_handler); + soapconn->output_handler = -1; + + /*clear the write buff*/ + msn_soap_free_write_buf(soapconn); + + /* Write finish! + * callback for write done + */ + if(soapconn->written_cb != NULL){ + soapconn->written_cb(soapconn, source, 0); + } +} + +/*write the buffer to SOAP connection*/ +void +msn_soap_write(MsnSoapConn * soapconn, char *write_buf, GaimInputFunction written_cb) +{ + soapconn->write_buf = write_buf; + soapconn->written_len = 0; + soapconn->written_cb = written_cb; + /*start the write*/ + soapconn->output_handler = gaim_input_add(soapconn->gsc->fd, GAIM_INPUT_WRITE, + msn_soap_write_cb, soapconn); + msn_soap_write_cb(soapconn, soapconn->gsc->fd, GAIM_INPUT_WRITE); +} + Property changes on: branches/soc-2006-msnp13/src/protocols/msn/soap.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: branches/soc-2006-msnp13/src/protocols/msn/soap.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/soap.h (rev 0) +++ branches/soc-2006-msnp13/src/protocols/msn/soap.h 2006-07-09 16:48:25 UTC (rev 16473) @@ -0,0 +1,87 @@ +/** + * @file soap.h + * header file for SOAP connection related process + * Author + * MaYuan<may...@gm...> + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COP... [truncated message content] |
From: <aar...@us...> - 2006-07-09 07:24:27
|
Revision: 16472 Author: aaronsheldon Date: 2006-07-09 00:24:14 -0700 (Sun, 09 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16472&view=rev Log Message: ----------- Growing a new branch in its place from the trunk. (I couldn't seem to just overwrite it directly for some reason) Added Paths: ----------- branches/soc-2006-blist-efficiency/ Copied: branches/soc-2006-blist-efficiency (from rev 16471, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aar...@us...> - 2006-07-09 07:23:25
|
Revision: 16471 Author: aaronsheldon Date: 2006-07-09 00:23:15 -0700 (Sun, 09 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16471&view=rev Log Message: ----------- Pruning a dead branch. Removed Paths: ------------- branches/soc-2006-blist-efficiency/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |