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: <mar...@us...> - 2006-07-25 04:31:43
|
Revision: 16570 Author: markhuetsch Date: 2006-07-24 21:31:36 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16570&view=rev Log Message: ----------- *Fixed an off-by-one blood_types bug. *Made it so that only one modify info dialog can be open at a time. *Fixed a bug where the user wasn't always notified when his info had been modified. *Eliminated the ability to send empty strings as info fields as these were making the official client unhappy. Modified Paths: -------------- trunk/src/protocols/qq/buddy_info.c trunk/src/protocols/qq/qq.h Modified: trunk/src/protocols/qq/buddy_info.c =================================================================== --- trunk/src/protocols/qq/buddy_info.c 2006-07-25 04:26:31 UTC (rev 16569) +++ trunk/src/protocols/qq/buddy_info.c 2006-07-25 04:31:36 UTC (rev 16570) @@ -107,7 +107,7 @@ }; static const gchar *blood_types[] = { - "其它", "A型", "B型", "O型", "AB型", NULL + "-", N_("A"), N_("B"), N_("O"), N_("AB"), N_("Other"), NULL }; static const gchar *genders[] = { @@ -138,7 +138,7 @@ "销售/广告/市场", NULL }; -static const gint choice_sizes[] = { 0, 13, 13, 5, 2, 7, 34, 15 }; +static const gint choice_sizes[] = { 0, 13, 13, 6, 2, 7, 34, 15 }; static const gchar *info_group_headers[] = { @@ -221,7 +221,7 @@ if (choice == 0) return FALSE; len = strlen(value); - // the server sends us an ascii index and none of arrays has more than 99 + // the server sends us an ascii index and none of the arrays has more than 99 // elements if (len > 3 || len == 0) return FALSE; for (i = 0; i < len; i++) @@ -357,6 +357,11 @@ static void modify_info_cancel_cb(modify_info_data *mid) { + qq_data *qd; + + qd = (qq_data *) mid->gc->proto_data; + qd->modifying_info = FALSE; + g_list_free(mid->misc); g_free(mid); } @@ -378,7 +383,7 @@ value = g_strdup_printf("%d", gaim_request_field_choice_get_value(f)); else { value = (gchar *) gaim_request_field_string_get_value(f); - if (value == NULL) value = g_strdup(""); + if (value == NULL) value = g_strdup("-"); else value = utf8_to_qq(value, QQ_CHARSET_DEFAULT); } segments[ft->pos] = value; @@ -401,12 +406,15 @@ static void modify_info_ok_cb(modify_info_data *mid, GaimRequestFields *fields) { GaimConnection *gc; + qq_data *qd; GList *list, *groups, *group_node; gchar *info_field[QQ_CONTACT_FIELDS]; contact_info *info; gint i; gc = mid->gc; + qd = (qq_data *) gc->proto_data; + qd->modifying_info = FALSE; list = mid->misc; g_list_foreach(list, parse_misc_field, info_field); g_list_free(list); @@ -469,6 +477,7 @@ // a form using those values and the info_template. static void create_modify_info_dialogue(GaimConnection *gc, const gchar **info) { + qq_data *qd; GaimRequestFields *fields; GaimRequestFieldGroup *group; GaimRequestField *field; @@ -476,32 +485,38 @@ modify_info_data *mid; gint i; - fields = gaim_request_fields_new(); + // so we only have one dialog open at a time + qd = (qq_data *) gc->proto_data; + if (!qd->modifying_info) { + qd->modifying_info = TRUE; + + fields = gaim_request_fields_new(); - // we only care about the first 3 groups, not the miscellaneous stuff - for (i = 0; i < 3; i++) { - group = gaim_request_field_group_new(info_group_headers[i]); - gaim_request_fields_add_group(fields, group); - group_list = info_get_group(info, info_group_headers[i]); - g_list_foreach(group_list, setup_group, group); - g_list_free(group_list); - } + // we only care about the first 3 groups, not the miscellaneous stuff + for (i = 0; i < 3; i++) { + group = gaim_request_field_group_new(info_group_headers[i]); + gaim_request_fields_add_group(fields, group); + group_list = info_get_group(info, info_group_headers[i]); + g_list_foreach(group_list, setup_group, group); + g_list_free(group_list); + } - //set this manually here instead of generating a new template column - field = gaim_request_fields_get_field(fields, "uid"); - gaim_request_field_string_set_editable(field, FALSE); + //set this manually here instead of generating a new template column + field = gaim_request_fields_get_field(fields, "uid"); + gaim_request_field_string_set_editable(field, FALSE); - //we need to pass the info that doesn't get modified as aux data - //because we'll still need it when we send the modify_info packet - mid = g_new0(modify_info_data, 1); - mid->gc = gc; - mid->misc = info_get_group(info, info_group_headers[3]); + //we need to pass the info that doesn't get modified as aux data + //because we'll still need it when we send the modify_info packet + mid = g_new0(modify_info_data, 1); + mid->gc = gc; + mid->misc = info_get_group(info, info_group_headers[3]); - gaim_request_fields(gc, _("Modify my information"), + gaim_request_fields(gc, _("Modify my information"), _("Modify my information"), NULL, fields, _("Update my information"), G_CALLBACK(modify_info_ok_cb), _("Cancel"), G_CALLBACK(modify_info_cancel_cb), mid); + } } // process the reply of modify_info packet @@ -519,6 +534,7 @@ data = g_newa(guint8, len); if (qq_crypt(DECRYPT, buf, buf_len, qd->session_key, data, &len)) { + data[len] = '\0'; if (qd->uid == atoi((gchar *) data)) { // return should be my uid gaim_debug(GAIM_DEBUG_INFO, "QQ", "Update info ACK OK\n"); gaim_notify_info(gc, NULL, _("Your information has been updated"), NULL); @@ -559,10 +575,6 @@ g_free(alias_utf8); } -// XXX When we don't have any immediate response, we send duplicate get info packets -// to the server. If the server ends up responding to multiple packets, we get multiple -// modify info dialogues, which is annoying. Fix this. - // process reply to get_info packet void qq_process_get_info_reply(guint8 *buf, gint buf_len, GaimConnection *gc) { Modified: trunk/src/protocols/qq/qq.h =================================================================== --- trunk/src/protocols/qq/qq.h 2006-07-25 04:26:31 UTC (rev 16569) +++ trunk/src/protocols/qq/qq.h 2006-07-25 04:31:36 UTC (rev 16570) @@ -102,6 +102,8 @@ GList *info_query; GList *add_buddy_request; GQueue *before_login_packets; + + gboolean modifying_info; }; void qq_function_not_implemented(GaimConnection * gc); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2006-07-25 04:26:41
|
Revision: 16569 Author: roast Date: 2006-07-24 21:26:31 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16569&view=rev Log Message: ----------- accountformatted written. senderformatted in place, not done. Modified Paths: -------------- branches/soc-2006-file-loggers/src/log.c Modified: branches/soc-2006-file-loggers/src/log.c =================================================================== --- branches/soc-2006-file-loggers/src/log.c 2006-07-25 04:08:19 UTC (rev 16568) +++ branches/soc-2006-file-loggers/src/log.c 2006-07-25 04:26:31 UTC (rev 16569) @@ -1018,6 +1018,10 @@ GIOStatus iostat; GError *gerror = NULL; + char *from_normed = g_strdup(gaim_normalize(log->account, from)); + gboolean from_is_normed = (g_ascii_strcasecmp(from, from_normed) == 0); + char *from_suffix = g_strconcat(from_normed, "\" senderformatted=\"", NULL); + writebuf = g_string_new(""); /* This log is new. We could use the loggers 'new' function, but @@ -1027,6 +1031,11 @@ if (!log->logger_data) { const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO(plugin)->list_icon(log->account, NULL); + /* this is not thread-safe at all */ + char *account_normed = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account))); + gboolean account_is_normed = (g_ascii_strcasecmp(gaim_account_get_username(log->account), account_normed)); + char *account_suffix = g_strconcat(account_suffix, "\" accountformatted=\"", NULL); + gaim_log_common_writer(log, ".chatlog"); data = log->logger_data; @@ -1037,10 +1046,11 @@ g_string_printf(writebuf, "%c%c%c" "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" - "<chat service=\"%s\" account=\"%s\" version=\"0.3.1-04\"%s>\n" + "<chat xmlns=\"http://purl.org/net/ulf/ns/0.4-02\" service=\"%s\" account=\"%s%s\"%s>\n" "\t<event time=\"%s\" type=\"logStart\" />\n", - 0xEF, 0xBB, 0xBF, - prpl, gaim_account_get_username(log->account), + 0xEF, 0xBB, 0xBF, prpl, + account_is_normed ? "" : account_suffix, + gaim_account_get_username(log->account), log->type == GAIM_LOG_SYSTEM ? "gaim:logtype=\"system\"" : "", date); iostat = g_io_channel_write_chars(data->channel, writebuf->str, -1, &written_buf, &gerror); @@ -1050,6 +1060,9 @@ gerror = NULL; } else written += written_buf; + + g_free(account_normed); + g_free(account_suffix); } /* if we can't write to the file, give up before we hurt ourselves */ @@ -1076,12 +1089,10 @@ else if (type & GAIM_MESSAGE_AUTO_RESP && (type & GAIM_MESSAGE_SEND || type & GAIM_MESSAGE_RECV)) { gboolean recv_from_self = FALSE; if (type & GAIM_MESSAGE_RECV) { - char *from_normed = g_strdup(gaim_normalize(log->account, from)); if (g_ascii_strncasecmp(from_normed, gaim_normalize(log->account, gaim_account_get_username(log->account)), strlen(from)) == 0) { recv_from_self = TRUE; - g_free(from_normed); } } @@ -1092,12 +1103,10 @@ else if (type & GAIM_MESSAGE_SEND || type & GAIM_MESSAGE_RECV) { gboolean recv_from_self = FALSE; if (type & GAIM_MESSAGE_RECV) { - char *from_normed = g_strdup(gaim_normalize(log->account, from)); if (g_ascii_strncasecmp(from_normed, gaim_normalize(log->account, gaim_account_get_username(log->account)), strlen(from)) == 0) { recv_from_self = TRUE; - g_free(from_normed); } } @@ -1148,6 +1157,8 @@ gerror = NULL; } + g_free(from_normed); + g_free(from_suffix); g_string_free(writebuf, TRUE); return written; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aar...@us...> - 2006-07-25 04:08:32
|
Revision: 16568 Author: aaronsheldon Date: 2006-07-24 21:08:19 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16568&view=rev Log Message: ----------- Fixes bugs with gtkblist and privacy settings. Privacy.c changes in this commit are a more efficient and accurate way to handle blocking/unblocking buddies, and is mostly thanks to Sadrul. Modified Paths: -------------- branches/soc-2006-blist-efficiency/src/gtkblist.c branches/soc-2006-blist-efficiency/src/privacy.c Modified: branches/soc-2006-blist-efficiency/src/gtkblist.c =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-25 02:46:26 UTC (rev 16567) +++ branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-25 04:08:19 UTC (rev 16568) @@ -128,7 +128,7 @@ static char *gaim_get_tooltip_text(GaimBlistNode *node, gboolean full); static const char *item_factory_translate_func (const char *path, gpointer func_data); static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter); -static void redo_buddy_list(GaimBuddyList *list, gboolean remove); +static void redo_buddy_list(GaimBuddyList *list, gboolean remove, gboolean rerender); static void gaim_gtk_blist_collapse_contact_cb(GtkWidget *w, GaimBlistNode *node); static void gaim_gtk_blist_tooltip_destroy(void); @@ -3582,7 +3582,7 @@ gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); } - redo_buddy_list(gaim_get_blist(), FALSE); + redo_buddy_list(gaim_get_blist(), FALSE, FALSE); #if GTK_CHECK_VERSION(2,6,0) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview)); #endif @@ -4122,7 +4122,7 @@ gaim_signal_emit(handle, "gtkblist-created", list); } -static void redo_buddy_list(GaimBuddyList *list, gboolean remove) +static void redo_buddy_list(GaimBuddyList *list, gboolean remove, gboolean rerender) { GaimBlistNode *node = list->root; @@ -4135,7 +4135,7 @@ gaim_gtk_blist_hide_node(list, node, FALSE); if (GAIM_BLIST_NODE_IS_BUDDY(node)) - gaim_gtk_blist_update_buddy(list, node, FALSE); + gaim_gtk_blist_update_buddy(list, node, rerender); else if (GAIM_BLIST_NODE_IS_CHAT(node)) gaim_gtk_blist_update(list, node); node = gaim_blist_node_next(node, FALSE); @@ -4151,7 +4151,7 @@ void gaim_gtk_blist_refresh(GaimBuddyList *list) { - redo_buddy_list(list, FALSE); + redo_buddy_list(list, FALSE, TRUE); } void @@ -5498,9 +5498,9 @@ return; } if (!strcmp(id, "none")) { - redo_buddy_list(gaim_get_blist(), TRUE); + redo_buddy_list(gaim_get_blist(), TRUE, FALSE); } else { - redo_buddy_list(gaim_get_blist(), FALSE); + redo_buddy_list(gaim_get_blist(), FALSE, FALSE); } } Modified: branches/soc-2006-blist-efficiency/src/privacy.c =================================================================== --- branches/soc-2006-blist-efficiency/src/privacy.c 2006-07-25 02:46:26 UTC (rev 16567) +++ branches/soc-2006-blist-efficiency/src/privacy.c 2006-07-25 04:08:19 UTC (rev 16568) @@ -42,18 +42,18 @@ name = g_strdup(gaim_normalize(account, who)); for (l = account->permit; l != NULL; l = l->next) { - if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data))) + if (!gaim_utf8_strcasecmp(name, (char *)l->data)) break; } - buddy = gaim_find_buddy(account, name); - g_free(name); + if (l != NULL) + { + g_free(name); + return FALSE; + } - if (l != NULL) - return FALSE; + account->permit = g_slist_append(account->permit, name); - account->permit = g_slist_append(account->permit, g_strdup(who)); - if (!local_only && gaim_account_is_connected(account)) serv_add_permit(gaim_account_get_connection(account), who); @@ -63,6 +63,7 @@ gaim_blist_schedule_save(); /* This lets the UI know a buddy has had its privacy setting changed */ + buddy = gaim_find_buddy(account, name); if (buddy != NULL) { gaim_signal_emit(gaim_blist_get_handle(), "buddy-privacy-changed", buddy); @@ -81,17 +82,13 @@ g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); - name = g_strdup(gaim_normalize(account, who)); + name = gaim_normalize(account, who); for (l = account->permit; l != NULL; l = l->next) { - if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data))) + if (!gaim_utf8_strcasecmp(name, (char *)l->data)) break; } - buddy = gaim_find_buddy(account, name); - - g_free(name); - if (l == NULL) return FALSE; @@ -106,6 +103,7 @@ gaim_blist_schedule_save(); + buddy = gaim_find_buddy(account, name); if (buddy != NULL) { gaim_signal_emit(gaim_blist_get_handle(), "buddy-privacy-changed", buddy); @@ -119,7 +117,7 @@ { GSList *l; char *name; - GaimBuddy *buddy = NULL; + GaimBuddy *buddy; g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); @@ -131,14 +129,13 @@ break; } - buddy = gaim_find_buddy(account, name); - - g_free(name); - if (l != NULL) + { + g_free(name); return FALSE; + } - account->deny = g_slist_append(account->deny, g_strdup(who)); + account->deny = g_slist_append(account->deny, name); if (!local_only && gaim_account_is_connected(account)) serv_add_deny(gaim_account_get_connection(account), who); @@ -148,6 +145,7 @@ gaim_blist_schedule_save(); + buddy = gaim_find_buddy(account, name); if (buddy != NULL) { gaim_signal_emit(gaim_blist_get_handle(), "buddy-privacy-changed", buddy); @@ -161,22 +159,20 @@ { GSList *l; char *name; - GaimBuddy *buddy = NULL; + GaimBuddy *buddy; g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); - name = g_strdup(gaim_normalize(account, who)); + name = gaim_normalize(account, who); for (l = account->deny; l != NULL; l = l->next) { - if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data))) + if (!gaim_utf8_strcasecmp(name, (char *)l->data)) break; } buddy = gaim_find_buddy(account, name); - g_free(name); - if (l == NULL) return FALSE; @@ -187,12 +183,13 @@ serv_rem_deny(gaim_account_get_connection(account), name); if (privacy_ops != NULL && privacy_ops->deny_removed != NULL) - privacy_ops->deny_removed(account, name); + privacy_ops->deny_removed(account, who); if (buddy != NULL) { gaim_signal_emit(gaim_blist_get_handle(), "buddy-privacy-changed", buddy); } + g_free(name); gaim_blist_schedule_save(); @@ -212,15 +209,17 @@ return FALSE; case GAIM_PRIVACY_ALLOW_USERS: + who = gaim_normalize(account, who); for (list=account->permit; list!=NULL; list=list->next) { - if (!gaim_utf8_strcasecmp(who, gaim_normalize(account, (char *)list->data))) + if (!gaim_utf8_strcasecmp(who, (char *)list->data)) return TRUE; } return FALSE; case GAIM_PRIVACY_DENY_USERS: + who = gaim_normalize(account, who); for (list=account->deny; list!=NULL; list=list->next) { - if (!gaim_utf8_strcasecmp(who, gaim_normalize( account, (char *)list->data ))) + if (!gaim_utf8_strcasecmp(who, (char *)list->data )) return FALSE; } return TRUE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2006-07-25 02:46:37
|
Revision: 16567 Author: roast Date: 2006-07-24 19:46:26 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16567&view=rev Log Message: ----------- gaim_message_is_meify() renamed to gaim_message_is_action() Modified Paths: -------------- branches/soc-2006-file-loggers/src/log.c branches/soc-2006-file-loggers/src/util.c branches/soc-2006-file-loggers/src/util.h Modified: branches/soc-2006-file-loggers/src/log.c =================================================================== --- branches/soc-2006-file-loggers/src/log.c 2006-07-25 01:25:04 UTC (rev 16566) +++ branches/soc-2006-file-loggers/src/log.c 2006-07-25 02:46:26 UTC (rev 16567) @@ -1087,7 +1087,7 @@ g_string_printf(writebuf, "\t<message time=\"%s\" sender=\"%s\"%s%s auto=\"true\">%s</message>\n", date, from, recv_from_self ? " self=\"true\"" : "", - gaim_message_is_meify(msg_fixed, -1) ? " type=\"action\"": "", msg_fixed); + gaim_message_is_action(msg_fixed, -1) ? " type=\"action\"": "", msg_fixed); } else if (type & GAIM_MESSAGE_SEND || type & GAIM_MESSAGE_RECV) { gboolean recv_from_self = FALSE; @@ -1103,7 +1103,7 @@ g_string_printf(writebuf, "\t<message time=\"%s\" sender=\"%s\"%s%s>%s</message>\n", date, from, recv_from_self ? " self=\"true\"" : "", - gaim_message_is_meify(msg_fixed, -1) ? " type=\"action\"": "", msg_fixed); + gaim_message_is_action(msg_fixed, -1) ? " type=\"action\"": "", msg_fixed); } else { gaim_debug_error("log", "Unhandled message type."); Modified: branches/soc-2006-file-loggers/src/util.c =================================================================== --- branches/soc-2006-file-loggers/src/util.c 2006-07-25 01:25:04 UTC (rev 16566) +++ branches/soc-2006-file-loggers/src/util.c 2006-07-25 02:46:26 UTC (rev 16567) @@ -4183,7 +4183,7 @@ } } -gboolean gaim_message_is_meify(char *message, size_t len) +gboolean gaim_message_is_action(char *message, size_t len) { char *c; gboolean inside_html = FALSE; @@ -4222,7 +4222,7 @@ else length = len; - is_action = gaim_message_is_meify(message, length); + is_action = gaim_message_is_action(message, length); if (is_action) { memmove(message, message+4, length-3); Modified: branches/soc-2006-file-loggers/src/util.h =================================================================== --- branches/soc-2006-file-loggers/src/util.h 2006-07-25 01:25:04 UTC (rev 16566) +++ branches/soc-2006-file-loggers/src/util.h 2006-07-25 02:46:26 UTC (rev 16567) @@ -994,9 +994,9 @@ * @param message The message to check * @param len The message length, or -1 * - * @return TRUE if it starts with /me, otherwise FALSE + * @return TRUE if it starts with "/me ", otherwise FALSE */ -gboolean gaim_message_is_meify(char *message, size_t len); +gboolean gaim_message_is_action(char *message, size_t len); /** * Trims the leading "/me " off of the message if it's there. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rl...@us...> - 2006-07-25 01:25:10
|
Revision: 16566 Author: rlaager Date: 2006-07-24 18:25:04 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16566&view=rev Log Message: ----------- Having value.h include config.h is bad. It caused plenty of warnings building my plugins, for example. Modified Paths: -------------- trunk/src/gtkconv.c trunk/src/log.c trunk/src/value.h Modified: trunk/src/gtkconv.c =================================================================== --- trunk/src/gtkconv.c 2006-07-24 23:57:11 UTC (rev 16565) +++ trunk/src/gtkconv.c 2006-07-25 01:25:04 UTC (rev 16566) @@ -6585,7 +6585,13 @@ gaim_value_new(GAIM_TYPE_POINTER), 2, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_LOG), - gaim_value_new(GAIM_TYPE_TIME_T)); +#if SIZEOF_TIME_T == 4 + gaim_value_new(GAIM_TYPE_INT)); +#elif SIZE_OF_TIME_T == 8 + gaim_value_new(GAIM_TYPE_INT64)); +#else +# error Unknown size of time_t +#endif gaim_signal_register(handle, "displaying-im-msg", gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, Modified: trunk/src/log.c =================================================================== --- trunk/src/log.c 2006-07-24 23:57:11 UTC (rev 16565) +++ trunk/src/log.c 2006-07-25 01:25:04 UTC (rev 16566) @@ -604,7 +604,13 @@ gaim_value_new(GAIM_TYPE_POINTER), 2, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_LOG), - gaim_value_new(GAIM_TYPE_TIME_T)); +#if SIZEOF_TIME_T == 4 + gaim_value_new(GAIM_TYPE_INT)); +#elif SIZE_OF_TIME_T == 8 + gaim_value_new(GAIM_TYPE_INT64)); +#else +# error Unknown size of time_t +#endif gaim_prefs_connect_callback(NULL, "/core/logging/format", logger_pref_cb, NULL); Modified: trunk/src/value.h =================================================================== --- trunk/src/value.h 2006-07-24 23:57:11 UTC (rev 16565) +++ trunk/src/value.h 2006-07-25 01:25:04 UTC (rev 16566) @@ -26,7 +26,6 @@ #define _GAIM_VALUE_H_ #include <glib.h> -#include "config.h" /** * Specific value types. @@ -54,16 +53,7 @@ } GaimType; -/* time_t is normally either an int or a uint; this is a little ugly - * and probably deserves revisiting. */ -#if SIZEOF_TIME_T == 8 -# define GAIM_TYPE_TIME_T GAIM_TYPE_INT64 -#else -# define GAIM_TYPE_TIME_T GAIM_TYPE_INT -#endif /* sizeof(time_t) == 8 */ - - /** * Gaim-specific subtype values. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sea...@us...> - 2006-07-24 23:57:18
|
Revision: 16565 Author: seanegan Date: 2006-07-24 16:57:11 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16565&view=rev Log Message: ----------- Randomize initial reconnect delay as not to DoS servers Modified Paths: -------------- trunk/src/gtkconn.c Modified: trunk/src/gtkconn.c =================================================================== --- trunk/src/gtkconn.c 2006-07-24 23:19:55 UTC (rev 16564) +++ trunk/src/gtkconn.c 2006-07-24 23:57:11 UTC (rev 16565) @@ -37,7 +37,9 @@ #include "gtkutils.h" #include "util.h" -#define INITIAL_RECON_DELAY 8000 +#define INITIAL_RECON_DELAY_MIN 8000 +#define INITIAL_RECON_DELAY_MAX 60000 + #define MAX_RECON_DELAY 600000 typedef struct { @@ -155,7 +157,7 @@ if (info == NULL) { info = g_new0(GaimAutoRecon, 1); g_hash_table_insert(hash, account, info); - info->delay = INITIAL_RECON_DELAY; + info->delay = g_random_int_range(INITIAL_RECON_DELAY_MIN, INITIAL_RECON_DELAY_MAX); } else { info->delay = MIN(2 * info->delay, MAX_RECON_DELAY); if (info->timeout != 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aar...@us...> - 2006-07-24 23:20:01
|
Revision: 16564 Author: aaronsheldon Date: 2006-07-24 16:19:55 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16564&view=rev Log Message: ----------- Adds a buddy-privacy-changed signal so the UI can tell a buddy has been blocked even when the buddy's online/offline state does not change as a result of it. This bug still exists in trunk, and it requires fairly extensive changes to work properly. Corrects all other known bugs with the gtkblist that I caused. Modified Paths: -------------- branches/soc-2006-blist-efficiency/src/blist.c branches/soc-2006-blist-efficiency/src/gtkblist.c branches/soc-2006-blist-efficiency/src/gtkconv.c branches/soc-2006-blist-efficiency/src/privacy.c Modified: branches/soc-2006-blist-efficiency/src/blist.c =================================================================== --- branches/soc-2006-blist-efficiency/src/blist.c 2006-07-24 16:19:16 UTC (rev 16563) +++ branches/soc-2006-blist-efficiency/src/blist.c 2006-07-24 23:19:55 UTC (rev 16564) @@ -2637,6 +2637,11 @@ GAIM_SUBTYPE_STATUS), gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_STATUS)); + gaim_signal_register(handle, "buddy-privacy-changed", + gaim_marshal_VOID__POINTER, NULL, + 1, + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_BLIST_BUDDY)); gaim_signal_register(handle, "buddy-idle-changed", gaim_marshal_VOID__POINTER_INT_INT, NULL, Modified: branches/soc-2006-blist-efficiency/src/gtkblist.c =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-24 16:19:16 UTC (rev 16563) +++ branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-24 23:19:55 UTC (rev 16564) @@ -538,6 +538,12 @@ } static void +gaim_gtk_blist_update_privacy_cb(GaimBuddy *buddy) +{ + gaim_gtk_blist_update_buddy(gaim_get_blist(), (GaimBlistNode*)(buddy), TRUE); +} + +static void rebuild_joinchat_entries(GaimGtkJoinChatData *data) { GaimConnection *gc; @@ -2711,43 +2717,30 @@ static void gaim_gtk_blist_update_buddy_status_icon_key(GaimBlistNode *node, GaimStatusIconSize size) { - int i; - GaimAccount *account; - GaimPlugin *prpl; - GaimPluginProtocolInfo *prpl_info; - GString *key = g_string_sized_new(16); - GaimBuddy *buddy; - const char *protoname = NULL; - struct _gaim_gtk_blist_node *gtknode = node->ui_data; - struct _gaim_gtk_blist_node *gtkbuddynode = NULL; - struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15}, - {NULL, 0, 0}, {NULL, 15, 0}}; + int i; + GaimAccount *account; + GaimPlugin *prpl; + GaimPluginProtocolInfo *prpl_info; + GString *key = g_string_sized_new(16); + GaimBuddy *buddy; + const char *protoname = NULL; + struct _gaim_gtk_blist_node *gtknode = node->ui_data; + struct _gaim_gtk_blist_node *gtkbuddynode = NULL; + struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15}, + {NULL, 0, 0}, {NULL, 15, 0}}; - buddy = (GaimBuddy*)node; - gtkbuddynode = node->ui_data; + buddy = (GaimBuddy*)node; + gtkbuddynode = node->ui_data; if (gtkbuddynode && gtkbuddynode->recent_signonoff) { if (GAIM_BUDDY_IS_ONLINE(buddy)) - g_string_printf(key, "%s/login", protoname); + g_string_printf(key, "login"); else - g_string_printf(key, "%s/logout", protoname); + g_string_printf(key, "logout"); } else { GaimConversation *conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, gaim_buddy_get_name(buddy), gaim_buddy_get_account(buddy)); - if(conv != NULL) { - GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); - if(gtkconv != NULL && gaim_gtkconv_is_hidden(gtkconv)) { - /* add pending emblem */ - if(size == GAIM_STATUS_ICON_SMALL) { - emblems[0].filename="pending"; - } - else { - emblems[3].filename=emblems[2].filename; - emblems[2].filename="pending"; - } - } - } account = buddy->account; prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); @@ -2760,20 +2753,34 @@ if(prpl_info && prpl_info->list_icon) { protoname = prpl_info->list_icon(account, buddy); } - if(prpl_info && prpl_info->list_emblems && buddy) { - if(gtknode && !gtknode->recent_signonoff) + if(prpl_info && prpl_info->list_emblems) { + if(gtknode) prpl_info->list_emblems(buddy, &emblems[0].filename, &emblems[1].filename, &emblems[2].filename, &emblems[3].filename); } + g_string_assign(key, protoname); + + if(conv != NULL) { + GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); + if(gtkconv != NULL && gaim_gtkconv_is_hidden(gtkconv)) { + /* add pending emblem */ + if(size == GAIM_STATUS_ICON_SMALL) { + emblems[0].filename="pending"; + } + else { + emblems[3].filename=emblems[2].filename; + emblems[2].filename="pending"; + } + } + } + if(size == GAIM_STATUS_ICON_SMALL) { /* So that only the se icon will composite */ emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL; } - g_string_assign(key, protoname); - for(i=0; i<4; i++) { if(emblems[i].filename) { g_string_append_printf(key, "/%s", emblems[i].filename); @@ -2934,19 +2941,6 @@ gaim_buddy_get_name(buddy), gaim_buddy_get_account(buddy)); - if(conv != NULL) { - GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); - if(gtkconv != NULL && gaim_gtkconv_is_hidden(gtkconv)) { - /* add pending emblem */ - if(size == GAIM_STATUS_ICON_SMALL) { - emblems[0].filename="pending"; - } - else { - emblems[3].filename=emblems[2].filename; - emblems[2].filename="pending"; - } - } - } account = buddy->account; prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); @@ -2964,6 +2958,20 @@ &emblems[1].filename, &emblems[2].filename, &emblems[3].filename); } + + if(conv != NULL) { + GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); + if(gtkconv != NULL && gaim_gtkconv_is_hidden(gtkconv)) { + /* add pending emblem */ + if(size == GAIM_STATUS_ICON_SMALL) { + emblems[0].filename="pending"; + } + else { + emblems[3].filename=emblems[2].filename; + emblems[2].filename="pending"; + } + } + } } if(size == GAIM_STATUS_ICON_SMALL) { @@ -5431,6 +5439,7 @@ gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", gtk_blist_handle, GAIM_CALLBACK(buddy_signonoff_cb), NULL); gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off", gtk_blist_handle, GAIM_CALLBACK(buddy_signonoff_cb), NULL); + gaim_signal_connect(gaim_blist_get_handle(), "buddy-privacy-changed", gtk_blist_handle, GAIM_CALLBACK(gaim_gtk_blist_update_privacy_cb), NULL); } void Modified: branches/soc-2006-blist-efficiency/src/gtkconv.c =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkconv.c 2006-07-24 16:19:16 UTC (rev 16563) +++ branches/soc-2006-blist-efficiency/src/gtkconv.c 2006-07-24 23:19:55 UTC (rev 16564) @@ -2189,6 +2189,8 @@ GaimAccount *account = NULL; const char *name = NULL; GdkPixbuf *status = NULL; + GaimBlistUiOps *ops = gaim_blist_get_ui_ops(); + g_return_val_if_fail(conv != NULL, NULL); @@ -2202,6 +2204,12 @@ if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { GaimBuddy *b = gaim_find_buddy(account, name); if (b != NULL) { + /* I hate this hack. It fixes a bug where the pending message icon + * displays in the conv tab even though it shouldn't. + * A better solution would be great. */ + if (ops && ops->update) + ops->update(NULL, (GaimBlistNode*)b); + status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); } @@ -6339,6 +6347,20 @@ } static void +update_buddy_privacy_changed(GaimBuddy *buddy) +{ + GaimGtkConversation *gtkconv; + GaimConversation *conv; + + gtkconv = get_gtkconv_with_contact(gaim_buddy_get_contact(buddy)); + if (gtkconv) + { + conv = gtkconv->active_conv; + gaim_gtkconv_update_fields(conv, GAIM_GTKCONV_TAB_ICON); + } +} + +static void update_buddy_idle_changed(GaimBuddy *buddy, gboolean old, gboolean newidle) { GaimConversation *conv; @@ -6614,6 +6636,8 @@ handle, GAIM_CALLBACK(update_buddy_sign), "off"); gaim_signal_connect(blist_handle, "buddy-status-changed", handle, GAIM_CALLBACK(update_buddy_status_changed), NULL); + gaim_signal_connect(blist_handle, "buddy-privacy-changed", + handle, GAIM_CALLBACK(update_buddy_privacy_changed), NULL); gaim_signal_connect(blist_handle, "buddy-idle-changed", handle, GAIM_CALLBACK(update_buddy_idle_changed), NULL); gaim_signal_connect(blist_handle, "buddy-icon-changed", Modified: branches/soc-2006-blist-efficiency/src/privacy.c =================================================================== --- branches/soc-2006-blist-efficiency/src/privacy.c 2006-07-24 16:19:16 UTC (rev 16563) +++ branches/soc-2006-blist-efficiency/src/privacy.c 2006-07-24 23:19:55 UTC (rev 16564) @@ -34,6 +34,7 @@ { GSList *l; char *name; + GaimBuddy *buddy; g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); @@ -44,6 +45,7 @@ if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data))) break; } + buddy = gaim_find_buddy(account, name); g_free(name); @@ -60,6 +62,11 @@ gaim_blist_schedule_save(); + /* This lets the UI know a buddy has had its privacy setting changed */ + if (buddy != NULL) { + gaim_signal_emit(gaim_blist_get_handle(), + "buddy-privacy-changed", buddy); + } return TRUE; } @@ -69,6 +76,7 @@ { GSList *l; char *name; + GaimBuddy *buddy; g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); @@ -80,6 +88,8 @@ break; } + buddy = gaim_find_buddy(account, name); + g_free(name); if (l == NULL) @@ -96,6 +106,10 @@ gaim_blist_schedule_save(); + if (buddy != NULL) { + gaim_signal_emit(gaim_blist_get_handle(), + "buddy-privacy-changed", buddy); + } return TRUE; } @@ -105,6 +119,7 @@ { GSList *l; char *name; + GaimBuddy *buddy = NULL; g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); @@ -116,6 +131,8 @@ break; } + buddy = gaim_find_buddy(account, name); + g_free(name); if (l != NULL) @@ -131,6 +148,10 @@ gaim_blist_schedule_save(); + if (buddy != NULL) { + gaim_signal_emit(gaim_blist_get_handle(), + "buddy-privacy-changed", buddy); + } return TRUE; } @@ -140,6 +161,7 @@ { GSList *l; char *name; + GaimBuddy *buddy = NULL; g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); @@ -151,6 +173,8 @@ break; } + buddy = gaim_find_buddy(account, name); + g_free(name); if (l == NULL) @@ -165,6 +189,10 @@ if (privacy_ops != NULL && privacy_ops->deny_removed != NULL) privacy_ops->deny_removed(account, name); + if (buddy != NULL) { + gaim_signal_emit(gaim_blist_get_handle(), + "buddy-privacy-changed", buddy); + } g_free(name); gaim_blist_schedule_save(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2006-07-24 16:19:20
|
Revision: 16563 Author: evands Date: 2006-07-24 09:19:16 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16563&view=rev Log Message: ----------- Reverted [16528] as per gaim-devel discussion Modified Paths: -------------- trunk/src/protocols/sametime/sametime.c Modified: trunk/src/protocols/sametime/sametime.c =================================================================== --- trunk/src/protocols/sametime/sametime.c 2006-07-24 13:39:12 UTC (rev 16562) +++ trunk/src/protocols/sametime/sametime.c 2006-07-24 16:19:16 UTC (rev 16563) @@ -75,7 +75,7 @@ I don't know why I even bother providing these. Oh valiant reader, I do it all for you. */ /* scratch that, I just added it to the prpl options panel */ -#define PLUGIN_ID "prpl-sametime" +#define PLUGIN_ID "prpl-meanwhile" #define PLUGIN_NAME "Sametime" #define PLUGIN_SUMMARY "Sametime Protocol Plugin" #define PLUGIN_DESC "Open implementation of a Lotus Sametime client" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-07-24 13:39:39
|
Revision: 16562 Author: markhuetsch Date: 2006-07-24 06:39:12 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16562&view=rev Log Message: ----------- *Eliminated all Gtk-related code from the prpl. Notably, this included the group ("Qun") administrative dialog and a dialog for setting and viewing personal information. Code for the latter now uses the gaim UI, while the former is currently disabled. *Disabled a few non-functional/non-essential menu actions. These included: IP lookup, system logging, about dialog, and qq_buddy_menu. Modified Paths: -------------- trunk/src/protocols/qq/Makefile.am trunk/src/protocols/qq/Makefile.mingw trunk/src/protocols/qq/buddy_info.c trunk/src/protocols/qq/buddy_info.h trunk/src/protocols/qq/buddy_list.c trunk/src/protocols/qq/buddy_status.c trunk/src/protocols/qq/buddy_status.h trunk/src/protocols/qq/group_opt.c trunk/src/protocols/qq/qq.c trunk/src/protocols/qq/qq_proxy.c trunk/src/protocols/qq/qq_proxy.h trunk/src/protocols/qq/utils.c trunk/src/protocols/qq/utils.h Removed Paths: ------------- trunk/src/protocols/qq/TODO trunk/src/protocols/qq/group_admindlg.c trunk/src/protocols/qq/group_admindlg.h trunk/src/protocols/qq/infodlg.c trunk/src/protocols/qq/infodlg.h trunk/src/protocols/qq/show.c trunk/src/protocols/qq/show.h Modified: trunk/src/protocols/qq/Makefile.am =================================================================== --- trunk/src/protocols/qq/Makefile.am 2006-07-24 09:25:48 UTC (rev 16561) +++ trunk/src/protocols/qq/Makefile.am 2006-07-24 13:39:12 UTC (rev 16562) @@ -21,8 +21,6 @@ char_conv.h \ crypt.c \ crypt.h \ - group_admindlg.c \ - group_admindlg.h \ group.c \ group_conv.c \ group_conv.h \ @@ -52,8 +50,6 @@ header_info.h \ im.c \ im.h \ - infodlg.c \ - infodlg.h \ ip_location.c \ ip_location.h \ keep_alive.c \ @@ -68,8 +64,6 @@ send_core.h \ sendqueue.c \ sendqueue.h \ - show.c \ - show.h \ sys_msg.c \ sys_msg.h \ udp_proxy_s5.c \ @@ -104,6 +98,5 @@ -DLOCALEDIR=\"${datadir}/locale\" \ -DVERSION=\"$(VERSION)\" \ $(DEBUG_CFLAGS) \ - $(GTK_CFLAGS) \ $(GLIB_CFLAGS) \ $(GAIM_CFLAGS) Modified: trunk/src/protocols/qq/Makefile.mingw =================================================================== --- trunk/src/protocols/qq/Makefile.mingw 2006-07-24 09:25:48 UTC (rev 16561) +++ trunk/src/protocols/qq/Makefile.mingw 2006-07-24 13:39:12 UTC (rev 16562) @@ -82,7 +82,6 @@ crypt.c \ file_trans.c \ group.c \ - group_admindlg.c \ group_conv.c \ group_find.c \ group_free.c \ @@ -96,7 +95,6 @@ group_search.c \ header_info.c \ im.c \ - infodlg.c \ ip_location.c \ keep_alive.c \ login_logout.c \ Deleted: trunk/src/protocols/qq/TODO =================================================================== --- trunk/src/protocols/qq/TODO 2006-07-24 09:25:48 UTC (rev 16561) +++ trunk/src/protocols/qq/TODO 2006-07-24 13:39:12 UTC (rev 16562) @@ -1,18 +0,0 @@ -* Decide how to handle QQ status icons, which are customizable and legion. -* Give "Online Offline" and "My Offline" statuses appropriate titles. -* Handle emoticon at beginning of message via passthrough_unknown_commands. -* Fix file transfer. -* QQ protocol currently breaks Chinese localization of Gaim. Fix this. -* Fix ability to insert images into a conversation via the menubar. -* Fix _qq_menu_block_buddy in qq.c -* Eliminate all references to QQWry.dat and the geolocation lookup feature previously present OpenQ. -* Give smileys verbal instead of numerical titles. -* Clean up signedness warnings. -* Clean up mixed declaration and code warnings. -* Better decomposition: -** some of these functions are _really_ long -** buddy_status.c has a helper function which seems to belong in buddy_status.c -** consider cleaning up qq_encrypt (nested function declarations) -** eliminate group_misc.c -** investigate whether all of these externs are appropriate -* Check for memory leaks. Modified: trunk/src/protocols/qq/buddy_info.c =================================================================== --- trunk/src/protocols/qq/buddy_info.c 2006-07-24 09:25:48 UTC (rev 16561) +++ trunk/src/protocols/qq/buddy_info.c 2006-07-24 13:39:12 UTC (rev 16562) @@ -20,11 +20,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// START OF FILE -/*****************************************************************************/ #include "internal.h" // strlen, _("get_text) #include "debug.h" // gaim_debug #include "notify.h" // gaim_notify +#include "request.h" // gaim_request_fields_new #include "utils.h" // uid_to_gaim_name #include "packet_parse.h" // MAX_PACKET_SIZE @@ -32,68 +31,295 @@ #include "char_conv.h" // qq_to_utf8 #include "crypt.h" // qq_crypt #include "header_info.h" // cmd alias -#include "infodlg.h" // info_window #include "keep_alive.h" // qq_update_buddy_contact #include "send_core.h" // qq_send_cmd -// amount of fiedls in user info -#define QQ_CONTACT_FIELDS 37 +// Below is all of the information necessary to reconstruct the various +// information fields that one can set in the official client. When we need +// to know about a specific field (e.g., should "city" be a choice +// or text field?), we can simply look it up from the template. Note that +// there are a number of unidentified fields. -// There is no user id stored in the reply packet for information query -// we have to manually store the query, so that we know the query source -typedef struct _qq_info_query { - guint32 uid; - gboolean show_window; - contact_info *ret_info; -} qq_info_query; +typedef struct _info_field { + gchar *title; + gchar *id; // used by gaim_request fields + gint pos; + gchar *group; + gint group_pos; // for display order in the UI + gint choice; // indicates which character array contains the choices + gboolean customizable; // whether a user can enter any text as a value, regardless of choice arrays + gchar *value; +} info_field; -/*****************************************************************************/ -// send a packet to get detailed information of uid, -// if show_window, a info window will be display upon receiving a reply +static const info_field info_template_data[] = { + { N_("User ID"), "uid", 0, QQ_MAIN_INFO, 0, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Nickname"), "nick", 1, QQ_MAIN_INFO, 1, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Country/Region"), "country", 2, QQ_MAIN_INFO, 5, QQ_COUNTRY, TRUE, NULL }, + { N_("Province/State"), "province", 3, QQ_MAIN_INFO, 6, QQ_PROVINCE, TRUE, NULL }, + { N_("Zipcode"), "zipcode", 4, QQ_EXTRA_INFO, 7, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Address"), "address", 5, QQ_EXTRA_INFO, 6, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Phone Number"), "tel", 6, QQ_EXTRA_INFO, 9, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Age"), "age", 7, QQ_MAIN_INFO, 3, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Gender"), "gender", 8, QQ_MAIN_INFO, 4, QQ_GENDER, FALSE, NULL }, + { N_("Name"), "name", 9, QQ_MAIN_INFO, 2, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Email"), "email", 10, QQ_EXTRA_INFO, 5, QQ_NO_CHOICE, TRUE, NULL }, + { "pager_sn", "pager_sn", 11, QQ_MISC, 0, QQ_NO_CHOICE, TRUE, NULL }, + { "pager_num", "pager_num", 12, QQ_MISC, 1, QQ_NO_CHOICE, TRUE, NULL }, + { "pager_sp", "pager_sp", 13, QQ_MISC, 2, QQ_NO_CHOICE, TRUE, NULL }, + { "pager_base_num", "pager_base_num", 14, QQ_MISC, 3, QQ_NO_CHOICE, TRUE, NULL }, + { "pager_type", "pager_type", 15, QQ_MISC, 4, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Occupation"), "occupation", 16, QQ_EXTRA_INFO, 1, QQ_OCCUPATION, TRUE, NULL }, + { N_("Homepage"), "homepage", 17, QQ_EXTRA_INFO, 10, QQ_NO_CHOICE, TRUE, NULL }, + { "auth_type", "auth_type", 18, QQ_MISC, 5, QQ_NO_CHOICE, TRUE, NULL }, + { "unknown1", "unknown1", 19, QQ_MISC, 6, QQ_NO_CHOICE, TRUE, NULL }, + { "unknown2", "unknown2", 20, QQ_MISC, 7, QQ_NO_CHOICE, TRUE, NULL }, + { "face", "face", 21, QQ_MISC, 8, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Cellphone Number"), "hp_num", 22, QQ_EXTRA_INFO, 8, QQ_NO_CHOICE, TRUE, NULL }, + { "hp_type", "hp_type", 23, QQ_MISC, 9, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Personal Introduction"), "intro", 24, QQ_PERSONAL_INTRO, 0, QQ_NO_CHOICE, TRUE, NULL }, + { N_("City"), "city", 25, QQ_MAIN_INFO, 7, QQ_NO_CHOICE, TRUE, NULL }, + { "unknown3", "unknown3", 26, QQ_MISC, 10, QQ_NO_CHOICE, TRUE, NULL }, + { "unknown4", "unknown4", 27, QQ_MISC, 11, QQ_NO_CHOICE, TRUE, NULL }, + { "unknown5", "unknown5", 28, QQ_MISC, 12, QQ_NO_CHOICE, TRUE, NULL }, + { "is_open_hp", "is_open_hp", 29, QQ_MISC, 13, QQ_NO_CHOICE, TRUE, NULL }, + { "is_open_contact", "is_open_contact", 30, QQ_MISC, 14, QQ_NO_CHOICE, TRUE, NULL }, + { N_("College"), "college", 31, QQ_EXTRA_INFO, 4, QQ_NO_CHOICE, TRUE, NULL }, + { N_("Horoscope Symbol"), "horoscope", 32, QQ_EXTRA_INFO, 0, QQ_HOROSCOPE, FALSE, NULL }, + { N_("Zodiac Symbol"), "zodiac", 33, QQ_EXTRA_INFO, 2, QQ_ZODIAC, FALSE, NULL }, + { N_("Blood Type"), "blood", 34, QQ_EXTRA_INFO, 3, QQ_BLOOD, FALSE, NULL }, + { "qq_show", "qq_show", 35, QQ_MISC, 15, QQ_NO_CHOICE, TRUE, NULL }, + { "unknown6", "unknown6", 36, QQ_MISC, 16, QQ_NO_CHOICE, TRUE, NULL }, + { NULL, NULL, 0, NULL, 0, 0, 0, NULL } //NULL termination +}; + +//TODO: translate these arrays to their English equivalents +// and move these characters to the zh_CN po file +static const gchar *horoscope_names[] = { + "-", "水瓶座", "双鱼座", "牡羊座", "金牛座", + "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", + "天蝎座", "射手座", "魔羯座", NULL +}; + +static const gchar *zodiac_names[] = { + "-", "鼠", "牛", "虎", "兔", + "龙", "蛇", "马", "羊", "猴", + "鸡", "狗", "猪", NULL +}; + +static const gchar *blood_types[] = { + "其它", "A型", "B型", "O型", "AB型", NULL +}; + +static const gchar *genders[] = { + N_("Male"), + N_("Female"), + NULL +}; + +static const gchar *country_names[] = { + "中国", "中国香港", "中国澳门", "中国台湾", + "新加坡", "马来西亚", "美国", NULL +}; + +static const gchar *province_names[] = { + "北京", "天津", "上海", "重庆", "香港", + "河北", "山西", "内蒙古", "辽宁", "吉林", + "黑龙江", "江西", "浙江", "江苏", "安徽", + "福建", "山东", "河南", "湖北", "湖南", + "广东", "广西", "海南", "四川", "贵州", + "云南", "西藏", "陕西", "甘肃", "宁夏", + "青海", "新疆", "台湾", "澳门", NULL +}; + +static const gchar *occupation_names[] = { + "全职", "兼职", "制造业", "商业", "失业中", + "学生", "工程师", "政府部门", "教育业", "服务行业", + "老板", "计算机业", "退休", "金融业", + "销售/广告/市场", NULL +}; + +static const gint choice_sizes[] = { 0, 13, 13, 5, 2, 7, 34, 15 }; + + +static const gchar *info_group_headers[] = { + QQ_MAIN_INFO, + QQ_EXTRA_INFO, + QQ_PERSONAL_INTRO, + QQ_MISC +}; + +static const gchar **choices[] = { + NULL, + horoscope_names, + zodiac_names, + blood_types, + genders, + country_names, + province_names, + occupation_names +}; + +/*************** info and info_field methods *****************/ + +// Given an id, return the template for that field. +// Returns NULL if the id is not found. +static const info_field *info_field_get_template(const gchar *id) +{ + const info_field *cur_field; + const gchar *cur_id; + + cur_field = info_template_data; + cur_id = cur_field->id; + while(cur_id != NULL) { + if (g_ascii_strcasecmp(cur_id, id) == 0) return cur_field; + cur_field++; + cur_id = cur_field->id; + } + gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Info field with id %s not found!", id); + return NULL; +} + +// info_fields are compared by their group positions +static gint info_field_compare(gconstpointer a, gconstpointer b, gpointer unused) +{ + return ((info_field *) a)->group_pos - ((info_field *) b)->group_pos; +} + +static void info_field_free(info_field *i) +{ + g_free(i->value); + g_free(i); +} + +// Parses the info_template_data above and returns a newly-allocated list +// containing the desired fields from segments. This list is ordered by +// group_pos. +static GList *info_get_group(const gchar **info, const gchar *group_name) +{ + const info_field *cur; + info_field *entry; + GList *group = NULL; + + cur = info_template_data; + while (cur->id != NULL) { + if (g_ascii_strcasecmp(group_name, cur->group) == 0) { + entry = g_memdup(cur, sizeof(info_field)); + entry->value = g_strdup(info[entry->pos]); + group = g_list_insert_sorted_with_data(group, entry, info_field_compare, NULL); + } + cur++; + } + + return group; +} + +// determines if the given text value and choice group require +// a lookup from the choice arrays +static gboolean is_valid_index(gchar *value, gint choice) +{ + gint len, i; + + if (choice == 0) return FALSE; + len = strlen(value); + // the server sends us an ascii index and none of arrays has more than 99 + // elements + if (len > 3 || len == 0) return FALSE; + for (i = 0; i < len; i++) + if (!g_ascii_isdigit(value[i])) return FALSE; + i = atoi(value); + if (i < 0 || i >= choice_sizes[choice]) return FALSE; + return TRUE; +} + +// formats a field for printing +static void append_field_to_str(gpointer field, gpointer str) +{ + info_field *f; + gint choice; + gboolean valid_index; + gchar *value; + + f = (info_field *) field; + choice = f->choice; + valid_index = is_valid_index(f->value, choice); + if (choice && valid_index) value = g_strdup(choices[choice][atoi(f->value)]); + else value = qq_to_utf8(f->value, QQ_CHARSET_DEFAULT); + g_string_append_printf((GString *) str, "<b>%s:</b> %s<br />", + f->title, value); + g_free(value); + info_field_free(f); +} + +// formats a group of information for printing +static void append_group_to_str(GString *str, const gchar *group_name, const gchar **info) +{ + GList *group; + + group = info_get_group(info, group_name); + g_string_append_printf(str, "<b>%s</b><br /><br />", (*(info_field *) group->data).group); + g_list_foreach(group, append_field_to_str, str); + g_list_free(group); + g_string_append_printf(str, "<br />"); +} + +// takes a contact_info struct and outputs the appropriate fields in +// a printable format for our upcoming call to gaim_notify_userinfo +static GString *info_to_str(const gchar **info) +{ + GString *info_text; + + info_text = g_string_new(""); + append_group_to_str(info_text, QQ_MAIN_INFO, info); + append_group_to_str(info_text, QQ_EXTRA_INFO, info); + append_group_to_str(info_text, QQ_PERSONAL_INTRO, info); + //if (QQ_DEBUG) append_group_to_str(info_text, QQ_MISC, info); + + return info_text; +} + +/*************** packets and UI management *****************/ + +// send a packet to get detailed information of uid void qq_send_packet_get_info(GaimConnection * gc, guint32 uid, gboolean show_window) { qq_data *qd; gchar *uid_str; - GList *list; qq_info_query *query; - gboolean is_exist; - contact_info_window *info_window; g_return_if_fail(gc != NULL && gc->proto_data != NULL && uid != 0); qd = (qq_data *) gc->proto_data; uid_str = g_strdup_printf("%d", uid); - qq_send_cmd(gc, QQ_CMD_GET_USER_INFO, TRUE, 0, TRUE, uid_str, strlen(uid_str)); + qq_send_cmd(gc, QQ_CMD_GET_USER_INFO, TRUE, 0, TRUE, (guint8 *) uid_str, strlen(uid_str)); - if (show_window) { // prepare the window - is_exist = FALSE; // see if there is already a window for this uid - list = qd->contact_info_window; - while (list != NULL) { - info_window = (contact_info_window *) list->data; - if (uid == info_window->uid) { - is_exist = TRUE; - break; - } else - list = list->next; - } // while list - if (!is_exist) { // create a new one - info_window = g_new0(contact_info_window, 1); - info_window->uid = uid; - qd->contact_info_window = g_list_append(qd->contact_info_window, info_window); - } // if !is_exist - } // if show_window - query = g_new0(qq_info_query, 1); query->uid = uid; query->show_window = show_window; + query->modify_info = FALSE; qd->info_query = g_list_append(qd->info_query, query); g_free(uid_str); -} // qq_send_packet_get_info +} -/*****************************************************************************/ +// set up the fields requesting personal information and send a get_info packet +// for myself +void qq_prepare_modify_info(GaimConnection *gc) +{ + qq_data *qd; + GList *ql; + qq_info_query *query; + + qd = (qq_data *) gc->proto_data; + qq_send_packet_get_info(gc, qd->uid, FALSE); + // traverse backwards so we get the most recent info_query + for (ql = g_list_last(qd->info_query); ql != NULL; ql = g_list_previous(ql)) { + query = ql->data; + if (query->uid == qd->uid) query->modify_info = TRUE; + } +} + // send packet to modify personal information, and/or change password -void qq_send_packet_modify_info(GaimConnection * gc, contact_info * info, gchar * new_passwd) +void qq_send_packet_modify_info(GaimConnection *gc, contact_info *info, gchar *new_passwd) { GaimAccount *a; gchar *old_passwd, *info_field[QQ_CONTACT_FIELDS]; @@ -112,27 +338,175 @@ if (new_passwd == NULL || strlen(new_passwd) == 0) create_packet_b(raw_data, &cursor, bar); - else { // we gonna change passwd - create_packet_data(raw_data, &cursor, old_passwd, strlen(old_passwd)); + else { // we're gonna change passwd + create_packet_data(raw_data, &cursor, (guint8 *) old_passwd, strlen(old_passwd)); create_packet_b(raw_data, &cursor, bar); - create_packet_data(raw_data, &cursor, new_passwd, strlen(new_passwd)); + create_packet_data(raw_data, &cursor, (guint8 *) new_passwd, strlen(new_passwd)); } // important!, skip the first uid entry for (i = 1; i < QQ_CONTACT_FIELDS; i++) { create_packet_b(raw_data, &cursor, bar); - create_packet_data(raw_data, &cursor, info_field[i], strlen(info_field[i])); + create_packet_data(raw_data, &cursor, (guint8 *) info_field[i], strlen(info_field[i])); } create_packet_b(raw_data, &cursor, bar); qq_send_cmd(gc, QQ_CMD_UPDATE_INFO, TRUE, 0, TRUE, raw_data, cursor - raw_data); -} // qq_send_packet_modify_info +} -/*****************************************************************************/ -// process the reply of modidy_info packet -void qq_process_modify_info_reply(guint8 * buf, gint buf_len, GaimConnection * gc) +static void modify_info_cancel_cb(modify_info_data *mid) { + g_list_free(mid->misc); + g_free(mid); +} + +// runs through all of the fields in the modify info UI and put +// their values into the outgoing packet +static void parse_field(gpointer field, gpointer outgoing_info) +{ + GaimRequestField *f; + gchar **segments, *value; + const info_field *ft; + const gchar *id; + + f = (GaimRequestField *) field; + segments = (gchar **) outgoing_info; + id = gaim_request_field_get_id(f); + ft = info_field_get_template(id); + if (ft->choice && !ft->customizable) + value = g_strdup_printf("%d", gaim_request_field_choice_get_value(f)); + else { + value = (gchar *) gaim_request_field_string_get_value(f); + if (value == NULL) value = g_strdup(""); + else value = utf8_to_qq(value, QQ_CHARSET_DEFAULT); + } + segments[ft->pos] = value; +} + +// dumps the uneditable information straight into the outgoing packet +static void parse_misc_field(gpointer field, gpointer outgoing_info) +{ + info_field *f; + gchar **segments; + + f = (info_field *) field; + segments = (gchar **) outgoing_info; + segments[f->pos] = g_strdup(f->value); + info_field_free(f); +} + +// runs through all of the information fields and copies them into an +// outgoing packet, then sends that packet +static void modify_info_ok_cb(modify_info_data *mid, GaimRequestFields *fields) +{ + GaimConnection *gc; + GList *list, *groups, *group_node; + gchar *info_field[QQ_CONTACT_FIELDS]; + contact_info *info; + gint i; + + gc = mid->gc; + list = mid->misc; + g_list_foreach(list, parse_misc_field, info_field); + g_list_free(list); + groups = gaim_request_fields_get_groups(fields); + while(groups) { + group_node = groups; + list = gaim_request_field_group_get_fields(group_node->data); + g_list_foreach(list, parse_field, info_field); + groups = g_list_remove_link(groups, group_node); + } + info = (contact_info *) info_field; + + qq_send_packet_modify_info(gc, info, NULL); + g_free(mid); + for (i = 0; i < QQ_CONTACT_FIELDS; i++) + g_free(info_field[i]); +} + +// Sets up the display for one group of information. This includes +// managing which fields in the UI should be textfields and +// which choices, and also mapping ints to choice values when appropriate. +static void setup_group(gpointer field, gpointer group) +{ + info_field *f; + GaimRequestFieldGroup *g; + GaimRequestField *rf; + gint choice, index, j; + gboolean customizable, valid_index, multiline; + gchar *id, *value; + + f = (info_field *) field; + g = (GaimRequestFieldGroup *) group; + choice = f->choice; + customizable = f->customizable; + id = f->id; + valid_index = TRUE; + + if (!choice || customizable) { + valid_index = is_valid_index(f->value, choice); + multiline = id == "intro"; + if (valid_index) { + index = atoi(f->value); + value = (gchar *) choices[choice][index]; + } else value = qq_to_utf8(f->value, QQ_CHARSET_DEFAULT); + rf = gaim_request_field_string_new(id, f->title, value, multiline); + } else { + index = atoi(f->value); + value = (gchar *) choices[choice][index]; + rf = gaim_request_field_choice_new(id, f->title, index); + j = 0; + while(choices[choice][j] != NULL) + gaim_request_field_choice_add(rf, choices[choice][j++]); + } + gaim_request_field_group_add_field(g, rf); + if (!valid_index) g_free(value); + info_field_free(f); +} + +// Takes the info returned by a get_info packet for the user and sets up +// a form using those values and the info_template. +static void create_modify_info_dialogue(GaimConnection *gc, const gchar **info) +{ + GaimRequestFields *fields; + GaimRequestFieldGroup *group; + GaimRequestField *field; + GList *group_list; + modify_info_data *mid; + gint i; + + fields = gaim_request_fields_new(); + + // we only care about the first 3 groups, not the miscellaneous stuff + for (i = 0; i < 3; i++) { + group = gaim_request_field_group_new(info_group_headers[i]); + gaim_request_fields_add_group(fields, group); + group_list = info_get_group(info, info_group_headers[i]); + g_list_foreach(group_list, setup_group, group); + g_list_free(group_list); + } + + //set this manually here instead of generating a new template column + field = gaim_request_fields_get_field(fields, "uid"); + gaim_request_field_string_set_editable(field, FALSE); + + //we need to pass the info that doesn't get modified as aux data + //because we'll still need it when we send the modify_info packet + mid = g_new0(modify_info_data, 1); + mid->gc = gc; + mid->misc = info_get_group(info, info_group_headers[3]); + + gaim_request_fields(gc, _("Modify my information"), + _("Modify my information"), NULL, fields, + _("Update my information"), G_CALLBACK(modify_info_ok_cb), + _("Cancel"), G_CALLBACK(modify_info_cancel_cb), + mid); +} + +// process the reply of modify_info packet +void qq_process_modify_info_reply(guint8 *buf, gint buf_len, GaimConnection *gc) +{ qq_data *qd; gint len; guint8 *data; @@ -145,18 +519,17 @@ data = g_newa(guint8, len); if (qq_crypt(DECRYPT, buf, buf_len, qd->session_key, data, &len)) { - if (qd->uid == atoi(data)) { // return should be my uid + if (qd->uid == atoi((gchar *) data)) { // return should be my uid gaim_debug(GAIM_DEBUG_INFO, "QQ", "Update info ACK OK\n"); - gaim_notify_info(gc, NULL, _("You information have been updated"), NULL); + gaim_notify_info(gc, NULL, _("Your information has been updated"), NULL); } } else gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt modify info reply\n"); -} // qq_process_modify_info_reply +} -/*****************************************************************************/ // after getting info or modify myself, refresh the buddy list accordingly -void qq_refresh_buddy_and_myself(contact_info * info, GaimConnection * gc) +void qq_refresh_buddy_and_myself(contact_info *info, GaimConnection *gc) { GaimBuddy *b; qq_data *qd; @@ -182,13 +555,16 @@ if (alias_utf8 != NULL) q_bud->nickname = g_strdup(alias_utf8); qq_update_buddy_contact(gc, q_bud); - } // if q_bud + } g_free(alias_utf8); -} // qq_refresh_buddy_and_myself +} -/*****************************************************************************/ +// XXX When we don't have any immediate response, we send duplicate get info packets +// to the server. If the server ends up responding to multiple packets, we get multiple +// modify info dialogues, which is annoying. Fix this. + // process reply to get_info packet -void qq_process_get_info_reply(guint8 * buf, gint buf_len, GaimConnection * gc) +void qq_process_get_info_reply(guint8 *buf, gint buf_len, GaimConnection *gc) { gint len; guint8 *data; @@ -196,9 +572,8 @@ qq_info_query *query; qq_data *qd; contact_info *info; - contact_info_window *info_window; - gboolean show_window; GList *list, *query_list; + GString *info_text; g_return_if_fail(gc != NULL && gc->proto_data != NULL); g_return_if_fail(buf != NULL && buf_len != 0); @@ -217,42 +592,30 @@ qq_refresh_buddy_and_myself(info, gc); query_list = qd->info_query; - show_window = FALSE; - while (query_list != NULL) { + // ensure we're processing the right query + while (query_list) { query = (qq_info_query *) query_list->data; if (query->uid == atoi(info->uid)) { - show_window = query->show_window; + if (query->show_window) { + info_text = info_to_str((const gchar **) segments); + gaim_notify_userinfo(gc, info->uid, info_text->str, NULL, NULL); + g_string_free(info_text, TRUE); + } else if (query->modify_info) { + create_modify_info_dialogue(gc, (const gchar **) segments); + } qd->info_query = g_list_remove(qd->info_query, qd->info_query->data); g_free(query); break; } query_list = query_list->next; - } // while query_list + } - if (!show_window) { - g_strfreev(segments); - return; - } - // if not show_window, we can not find the window here either - list = qd->contact_info_window; - while (list != NULL) { - info_window = (contact_info_window *) (list->data); - if (info_window->uid == atoi(info->uid)) { - if (info_window->window) - qq_refresh_contact_info_dialog(info, gc, info_window); - else - qq_show_contact_info_dialog(info, gc, info_window); - break; - } else - list = list->next; - } // while list g_strfreev(segments); } else gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt get info reply\n"); -} // qq_process_get_info_reply +} -/*****************************************************************************/ void qq_info_query_free(qq_data * qd) { gint i; @@ -268,7 +631,4 @@ i++; } gaim_debug(GAIM_DEBUG_INFO, "QQ", "%d info queries are freed!\n", i); -} // qq_add_buddy_request_free - -/*****************************************************************************/ -// END OF FILE +} Modified: trunk/src/protocols/qq/buddy_info.h =================================================================== --- trunk/src/protocols/qq/buddy_info.h 2006-07-24 09:25:48 UTC (rev 16561) +++ trunk/src/protocols/qq/buddy_info.h 2006-07-24 13:39:12 UTC (rev 16562) @@ -40,9 +40,7 @@ #define QQ_BUDDY_GENDER_MM 0x01 #define QQ_BUDDY_GENDER_UNKNOWN 0xff -typedef struct _contact_info contact_info; - -struct _contact_info { +typedef struct _contact_info { gchar *uid; //0 gchar *nick; //1 gchar *country; //2 @@ -80,15 +78,46 @@ gchar *blood; //34 gchar *qq_show; //35 gchar *unknown6; //36, always 0x2D -}; +} contact_info; -void qq_refresh_buddy_and_myself(contact_info * info, GaimConnection * gc); -void qq_send_packet_get_info(GaimConnection * gc, guint32 uid, gboolean show_window); -void qq_send_packet_modify_info(GaimConnection * gc, contact_info * info, gchar * new_passwd); -void qq_process_modify_info_reply(guint8 * buf, gint buf_len, GaimConnection * gc); -void qq_process_get_info_reply(guint8 * buf, gint buf_len, GaimConnection * gc); -void qq_info_query_free(qq_data * qd); +// There is no user id stored in the reply packet for information query +// we have to manually store the query, so that we know the query source +typedef struct _qq_info_query { + guint32 uid; + gboolean show_window; + gboolean modify_info; +} qq_info_query; +// We get an info packet on ourselves before we modify our information. +// Even though not all of the information is currently modifiable, it still +// all needs to be there when we send out the modify info packet +typedef struct _modify_info_data { + GaimConnection *gc; + GList *misc, *node; +} modify_info_data; + +#define QQ_CONTACT_FIELDS 37 + +#define QQ_MAIN_INFO "Primary Information" +#define QQ_EXTRA_INFO "Detailed Information" +#define QQ_PERSONAL_INTRO "Personal Introduction" +#define QQ_MISC "Miscellaneous" + +#define QQ_NO_CHOICE 0 +#define QQ_HOROSCOPE 1 +#define QQ_ZODIAC 2 +#define QQ_BLOOD 3 +#define QQ_GENDER 4 +#define QQ_COUNTRY 5 +#define QQ_PROVINCE 6 +#define QQ_OCCUPATION 7 + +void qq_refresh_buddy_and_myself(contact_info *info, GaimConnection *gc); +void qq_send_packet_get_info(GaimConnection *gc, guint32 uid, gboolean show_window); +void qq_send_packet_modify_info(GaimConnection *gc, contact_info *info, gchar *new_passwd); +void qq_prepare_modify_info(GaimConnection *gc); +void qq_process_modify_info_reply(guint8 *buf, gint buf_len, GaimConnection *gc); +void qq_process_get_info_reply(guint8 *buf, gint buf_len, GaimConnection *gc); +void qq_info_query_free(qq_data *qd); + #endif -/*****************************************************************************/ -// END OF FILE Modified: trunk/src/protocols/qq/buddy_list.c =================================================================== --- trunk/src/protocols/qq/buddy_list.c 2006-07-24 09:25:48 UTC (rev 16561) +++ trunk/src/protocols/qq/buddy_list.c 2006-07-24 13:39:12 UTC (rev 16562) @@ -42,6 +42,8 @@ #include "group_hash.h" //qq_group_create_by_id #include "group_info.h" //qq_send_cmd_group_get_group_info +#include "qq_proxy.h" + #define QQ_GET_ONLINE_BUDDY_02 0x02 #define QQ_GET_ONLINE_BUDDY_03 0x03 // unknown function @@ -56,13 +58,6 @@ guint8 ending; //0x00 } qq_friends_online_entry; -//TODO: defined in qq_buddy_status.c, but only used here. Check decomposition. -extern void // defined in qq_buddy_status.c - _qq_buddy_status_dump_unclear(qq_buddy_status * s); - -extern gint // defined in qq_buddy_status.c - _qq_buddy_status_read(guint8 * data, guint8 ** cursor, gint len, qq_buddy_status * s); - /*****************************************************************************/ // get a list of online_buddies void qq_send_packet_get_buddies_online(GaimConnection * gc, guint8 position) @@ -148,7 +143,7 @@ g_return_if_fail(fe != NULL); - _qq_buddy_status_dump_unclear(fe->s); + qq_buddy_status_dump_unclear(fe->s); dump = g_string_new(""); g_string_append_printf(dump, "unclear fields for [%d]:\n", fe->s->uid); @@ -180,9 +175,14 @@ data = g_newa(guint8, len); cursor = data; + gaim_debug(GAIM_DEBUG_INFO, "QQ", "processing get_buddies_online_reply\n"); + if (qq_crypt(DECRYPT, buf, buf_len, qd->session_key, data, &len)) { + _qq_show_packet("Get buddies online reply packet", data, len); + read_packet_b(data, &cursor, len, &position); + fe = g_newa(qq_friends_online_entry, 1); fe->s = g_newa(qq_buddy_status, 1); @@ -190,7 +190,7 @@ // based on one online buddy entry bytes = 0; // 000-030 qq_buddy_status - bytes += _qq_buddy_status_read(data, &cursor, len, fe->s); + bytes += qq_buddy_status_read(data, &cursor, len, fe->s); // 031-032: unknown4 bytes += read_packet_w(data, &cursor, len, &fe->unknown1); // 033-033: flag1 @@ -209,8 +209,8 @@ continue; } // check if it is a valid entry -// if (QQ_DEBUG) -// _qq_buddies_online_reply_dump_unclear(fe); + if (QQ_DEBUG) + _qq_buddies_online_reply_dump_unclear(fe); // update buddy information b = gaim_find_buddy(gaim_connection_get_account(gc), uid_to_gaim_name(fe->s->uid)); @@ -219,10 +219,10 @@ if (q_bud != NULL) { // we find one and update qq_buddy if(0 != fe->s->client_version) q_bud->client_version = fe->s->client_version; //by gfhuang - if(0 != *((guint32 *)fe->s->ip)) { // by gfhuang + // if(0 != *((guint32 *)fe->s->ip)) { // by gfhuang g_memmove(q_bud->ip, fe->s->ip, 4); q_bud->port = fe->s->port; - } + // } q_bud->status = fe->s->status; q_bud->flag1 = fe->flag1; q_bud->comm_flag = fe->comm_flag; Modified: trunk/src/protocols/qq/buddy_status.c =================================================================== --- trunk/src/protocols/qq/buddy_status.c 2006-07-24 09:25:48 UTC (rev 16561) +++ trunk/src/protocols/qq/buddy_status.c 2006-07-24 13:39:12 UTC (rev 16562) @@ -34,6 +34,8 @@ #include "keep_alive.h" // qq_update_buddy_contact #include "send_core.h" // qq_send_cmd +#include "qq_proxy.h" + #define QQ_MISC_STATUS_HAVING_VIIDEO 0x00000001 #define QQ_ICON_SUFFIX_DEFAULT QQ_ICON_SUFFIX_OFFLINE @@ -46,7 +48,7 @@ }; /*****************************************************************************/ -static void _qq_buddy_status_dump_unclear(qq_buddy_status * s) +void qq_buddy_status_dump_unclear(qq_buddy_status * s) { GString *dump; @@ -55,14 +57,23 @@ dump = g_string_new(""); g_string_append_printf(dump, "unclear fields for [%d]:\n", s->uid); g_string_append_printf(dump, "004: %02x (unknown)\n", s->unknown1); + //g_string_append_printf(dump, "005-008: %09x (ip)\n", *(s->ip)); + g_string_append_printf(dump, "009-010: %04x (port)\n", s->port); g_string_append_printf(dump, "011: %02x (unknown)\n", s->unknown2); + g_string_append_printf(dump, "012: %02x (status)\n", s->status); + g_string_append_printf(dump, "013-014: %04x (client_version)\n", s->client_version); + //g_string_append_printf(dump, "015-030: %s (unknown key)\n", s->unknown_key); gaim_debug(GAIM_DEBUG_INFO, "QQ", "Buddy status entry, %s", dump->str); + _qq_show_packet("Unknown key", s->unknown_key, QQ_KEY_LENGTH); g_string_free(dump, TRUE); -} // _qq_buddy_status_dump_unclear +} /*****************************************************************************/ +// TODO: figure out what's going on with the IP region. Sometimes I get things which +// may be valid IP addresses, but the port number's weird, other times I get 0s. +// Note: I get these simultaneously on the same buddy, using different accounts to get info. // parse the data into qq_buddy_status -gint _qq_buddy_status_read(guint8 * data, guint8 ** cursor, gint len, qq_buddy_status * s) { +gint qq_buddy_status_read(guint8 * data, guint8 ** cursor, gint len, qq_buddy_status * s) { gint bytes; g_return_val_if_fail(data != NULL && *cursor != NULL && s != NULL, -1); @@ -73,9 +84,12 @@ bytes += read_packet_dw(data, cursor, len, &s->uid); // 004-004: 0x01 bytes += read_packet_b(data, cursor, len, &s->unknown1); + // this is no longer the IP, it seems QQ (as of 2006) no longer sends + // the buddy's IP in this packet. all 0s // 005-008: ip s->ip = g_new0(guint8, 4); bytes += read_packet_data(data, cursor, len, s->ip, 4); + // port info is no longer here either // 009-010: port bytes += read_packet_w(data, cursor, len, &s->port); // 011-011: 0x00 @@ -93,7 +107,7 @@ return bytes; -} // _qq_buddy_status_read +} /*****************************************************************************/ // check if status means online or offline @@ -159,7 +173,7 @@ break; default: away_cmd = QQ_BUDDY_ONLINE_NORMAL; - } // switch + } raw_data = g_new0(guint8, 5); cursor = raw_data; @@ -175,7 +189,7 @@ qq_send_cmd(gc, QQ_CMD_CHANGE_ONLINE_STATUS, TRUE, 0, TRUE, raw_data, 5); g_free(raw_data); -} // qq_send_packet_change_status +} /*****************************************************************************/ // parse the reply packet for change_status @@ -201,7 +215,7 @@ } else gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt chg status reply\n"); -} // qq_process_change_status_reply +} /*****************************************************************************/ // it is a server message @@ -228,7 +242,7 @@ s = g_new0(qq_buddy_status, 1); bytes = 0; // 000-030: qq_buddy_status; - bytes += _qq_buddy_status_read(data, &cursor, len, s); + bytes += qq_buddy_status_read(data, &cursor, len, s); // 031-034: my uid bytes += read_packet_dw(data, &cursor, len, &my_uid); @@ -242,19 +256,19 @@ // if (QQ_DEBUG) gfhuang // _qq_buddy_status_dump_unclear(s); - name = uid_to_gaim_name(s->uid); //by gfhuang + name = uid_to_gaim_name(s->uid); b = gaim_find_buddy(gc->account, name); g_free(name); q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data; if (q_bud) { gaim_debug(GAIM_DEBUG_INFO, "QQ", "s->uid = %d, q_bud->uid = %d\n", s->uid , q_bud->uid); - if(0 != *((guint32 *)s->ip)) { //by gfhuang + if(0 != *((guint32 *)s->ip)) { g_memmove(q_bud->ip, s->ip, 4); q_bud->port = s->port; } q_bud->status = s->status; if(0 != s->client_version) - q_bud->client_version = s->client_version; //gfhuang + q_bud->client_version = s->client_version; qq_update_buddy_contact(gc, q_bud); } else @@ -265,8 +279,7 @@ g_free(s); } else gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt buddy status change packet\n"); +} -} // qq_process_friend_change_status - /*****************************************************************************/ // END OF FILE Modified: trunk/src/protocols/qq/buddy_status.h =================================================================== --- trunk/src/protocols/qq/buddy_status.h 2006-07-24 09:25:48 UTC (rev 16561) +++ trunk/src/protocols/qq/buddy_status.h 2006-07-24 13:39:12 UTC (rev 16562) @@ -56,9 +56,11 @@ QQ_SELF_STATUS_CUSTOM = 0x14, QQ_SELF_STATUS_IDLE = 0x15, }; - + +void qq_buddy_status_dump_unclear(qq_buddy_status * s); gboolean is_online(guint8 status); +gint qq_buddy_status_read(guint8 * data, guint8 ** cursor, gint len, qq_buddy_status * s); gchar get_suffix_from_status(guint8 status); void qq_send_packet_change_status(GaimConnection * gc); Deleted: trunk/src/protocols/qq/group_admindlg.c =================================================================== --- trunk/src/protocols/qq/group_admindlg.c 2006-07-24 09:25:48 UTC (rev 16561) +++ trunk/src/protocols/qq/group_admindlg.c 2006-07-24 13:39:12 UTC (rev 16562) @@ -1,659 +0,0 @@ -/** -* The QQ2003C protocol plugin - * - * for gaim - * - * Copyright (C) 2004 Puzzlebird - * - * 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 - */ - -// START OF FILE -/*****************************************************************************/ -#include "debug.h" // gaim_debug -#include "blist.h" // GAIM_BLIST_NODE_IS_BUDDY -#include "notify.h" // gaim_notify_warning - -#include "utils.h" // gaim_name_to_uid -#include "group_admindlg.h" -#include "group_find.h" // qq_group_find_by_internal_group_id -#include "group_join.h" // auth_type -#include "group_opt.h" // QQ_GROUP_TYPE_PERMANENT - -enum { - COLUMN_SELECTED = 0, - COLUMN_UID, - COLUMN_NICKNAME, - NUM_COLUMNS -}; - -enum { - PAGE_INFO = 0, - PAGE_MEMBER, -}; - -typedef struct _qun_info_window { - guint32 internal_group_id; - GaimConnection *gc; - GtkWidget *window; - GtkWidget *notebook; - GtkWidget *lbl_external_group_id; - GtkWidget *lbl_admin_uid; - GtkWidget *ent_group_name; - GtkWidget *cmb_group_category; - GtkWidget *txt_group_desc; - GtkWidget *txt_group_notice; - GtkWidget *rad_auth[3]; - GtkWidget *btn_mod; - GtkWidget *btn_close; - GtkWidget *tre_members; -} qun_info_window; - -const gchar *qq_group_category[] = { - "同学", "朋友", "同事", "其他", -}; // qq_group_category - -const gchar *qq_group_auth_type_desc[] = { - "无须认证", "需要认证", "不可添加", -}; // qq_group_auth_type_desc - -/*****************************************************************************/ -static void _qq_group_info_window_deleteevent(GtkWidget * widget, GdkEvent * event, gpointer data) { - gtk_widget_destroy(widget); // this will call _window_destroy -} // _window_deleteevent - -/*****************************************************************************/ -static void _qq_group_info_window_close(GtkWidget * widget, gpointer data) -{ - // this will call _info_window_destroy if it is info-window - gtk_widget_destroy(GTK_WIDGET(data)); -} // _window_close - -/*****************************************************************************/ -static void _qq_group_info_window_destroy(GtkWidget * widget, gpointer data) -{ - GaimConnection *gc; - GList *list; - qq_data *qd; - qun_info_window *info_window; - - gc = (GaimConnection *) data; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - gaim_debug(GAIM_DEBUG_INFO, "QQ", "Group info is destoryed\n"); - - qd = (qq_data *) gc->proto_data; - list = qd->qun_info_window; - - while (list) { - info_window = (qun_info_window *) (list->data); - if (info_window->window != widget) - list = list->next; - else { - qd->qun_info_window = g_list_remove(qd->qun_info_window, info_window); - g_free(info_window); - break; - } // if info_window - } // while -} // _window_destroy - -/*****************************************************************************/ -void qq_qun_info_window_free(qq_data * qd) -{ - gint i; - qun_info_window *info_window; - - i = 0; - while (qd->qun_info_window) { - info_window = (qun_info_window *) qd->qun_info_window->data; - qd->qun_info_window = g_list_remove(qd->qun_info_window, info_window); - if (info_window->window) - gtk_widget_destroy(info_window->window); - g_free(info_window); - i++; - } // while - - gaim_debug(GAIM_DEBUG_INFO, "QQ", "%d Qun info windows are freed\n", i); -} // qq_qun_info_window_free - -/*****************************************************************************/ -static void _qq_group_info_window_modify(GtkWidget * widget, gpointer data) -{ - GaimConnection *gc; - qun_info_window *info_window; - - g_return_if_fail(data != NULL); - info_window = (qun_info_window *) data; - - gc = info_window->gc; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - - //henry: This function contains some codes only supported by gtk-2.4 or later -//#if !GTK_CHECK_VERSION(2,4,0) -// gaim_notify_info(gc, _("QQ Qun Operation"), -// _("This version of GTK-2 does not support this function"), NULL); -// return; -//#else - gint page, group_category, i = 0; - qq_group *group; - qq_data *qd; - GtkTextIter start, end; - GtkTreeModel *model; - GtkTreeIter iter; - GValue value = { 0, }; - guint32 *new_members; - guint32 uid; - gboolean selected; - - qd = (qq_data *) gc->proto_data; - - // we assume the modification can succeed - // maybe it needs some tweak here - group = qq_group_find_by_internal_group_id(gc, info_window->internal_group_id); - g_return_if_fail(group != NULL); - - new_members = g_newa(guint32, QQ_QUN_MEMBER_MAX); - - page = gtk_notebook_get_current_page(GTK_NOTEBOOK(info_window->notebook)); - switch (page) { - case PAGE_INFO: - gaim_debug(GAIM_DEBUG_INFO, "QQ", "Gonna change Qun detailed information\n"); - // get the group_category -#if GTK_CHECK_VERSION(2,4,0) - group_category = gtk_combo_box_get_active(GTK_COMBO_BOX(info_window->cmb_group_category)); -#else - group_category = gtk_option_menu_get_history(GTK_OPTION_MENU(info_window->cmb_group_category)); -#endif - - if (group_category >= 0) - group->group_category = group_category; - else { - g_free(group); - gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Invalid group_category: %d\n", group_category); - return; - } // if group_category - // get auth_type - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info_window->rad_auth[0]))) - group->auth_type = QQ_GROUP_AUTH_TYPE_NO_AUTH; - else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info_window->rad_auth[1]))) - group->auth_type = QQ_GROUP_AUTH_TYPE_NEED_AUTH; - else - group->auth_type = QQ_GROUP_AUTH_TYPE_NO_ADD; - // MUST use g_strdup, otherwise core dump after info_window is closed - group->group_name_utf8 = g_strdup(gtk_entry_get_text(GTK_ENTRY(info_window->ent_group_name))); - gtk_text_buffer_get_bounds(gtk_text_view_get_buffer - (GTK_TEXT_VIEW(info_window->txt_group_desc)), &start, &end); - group->group_desc_utf8 = - g_strdup(gtk_text_buffer_get_text - (gtk_text_view_get_buffer - (GTK_TEXT_VIEW(info_window->txt_group_desc)), &start, &end, FALSE)); - gtk_text_buffer_get_bounds(gtk_text_view_get_buffer - (GTK_TEXT_VIEW(info_window->txt_group_notice)), &start, &end); - group->notice_utf8 = - g_strdup(gtk_text_buffer_get_text - (gtk_text_view_get_buffer - (GTK_TEXT_VIEW(info_window->txt_group_notice)), &start, &end, FALSE)); - // finally we can modify it with new information - qq_group_modify_info(gc, group); - break; - case PAGE_MEMBER: - if (info_window->tre_members == NULL) { - gaim_debug(GAIM_DEBUG_INFO, "QQ", "Member list is not ready, cannot modify!\n"); - } else { - gaim_debug(GAIM_DEBUG_INFO, "QQ", "Gonna change Qun member list\n"); - model = gtk_tree_view_get_model(GTK_TREE_VIEW(info_window->tre_members)); - if (gtk_tree_model_get_iter_first(model, &iter)) { - gtk_tree_model_get_value(model, &iter, COLUMN_UID, &value); - uid = g_value_get_uint(&value); - g_value_unset(&value); - gtk_tree_model_get_value(model, &iter, COLUMN_SELECTED, &value); - selected = g_value_get_boolean(&value); - g_value_unset(&value); - if (!selected) - new_members[i++] = uid; - while (gtk_tree_model_iter_next(model, &iter)) { - gtk_tree_model_get_value(model, &iter, COLUMN_UID, &value); - uid = g_value_get_uint(&value); - g_value_unset(&value); - gtk_tree_model_get_value(model, &iter, COLUMN_SELECTED, &value); - selected = g_value_get_boolean(&value); - g_value_unset(&value); - if (!selected) - new_members[i++] = uid; - } // while - new_members[i] = 0xffffffff; // this labels the end - } else - new_members[0] = 0xffffffff; - qq_group_modify_members(gc, group, new_members); - } // if info_window->tre_members - break; - default: - gaim_debug(GAIM_DEBUG_INFO, "QQ", "Invalid page number: %d\n", page); - } // switch - - _qq_group_info_window_close(NULL, info_window->window); - -//#endif /* GTK_CHECK_VERSION */ -} // _qq_group_info_window_modify - -/*****************************************************************************/ -static void _qq_group_member_list_deleted_toggled(GtkCellRendererToggle * cell, gchar * path_str, gpointer data) { - qun_info_window *info_window; - GaimConnection *gc; - qq_group *group; - - info_window = (qun_info_window *) data; - g_return_if_fail(info_window != NULL); - - gc = info_window->gc; - g_return_if_fail(gc != NULL); - - group = qq_group_find_by_internal_group_id(gc, info_window->internal_group_id); - g_return_if_fail(group != NULL); - - GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(info_window->tre_members)); - GtkTreeIter iter; - GtkTreePath *path = gtk_tree_path_new_from_string(path_str); - gboolean selected; - guint32 uid; - - gtk_tree_model_get_iter(model, &iter, path); - gtk_tree_model_get(model, &iter, COLUMN_SELECTED, &selected, -1); - gtk_tree_model_get(model, &iter, COLUMN_UID, &uid, -1); - - if (uid != group->creator_uid) { // do not allow delete admin - selected ^= 1; - gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_SELECTED, selected, -1); - gtk_tree_path_free(path); - } else - gaim_notify_error(gc, NULL, _("Qun creator cannot be removed"), NULL); -} // _qq_group_member_list_deleted_toggled - -/*****************************************************************************/ -static void _qq_group_member_list_drag_data_rcv_cb - (GtkWidget * widget, GdkDragContext * dc, guint x, guint y, - GtkSelectionData * sd, guint info, guint t, gpointer data) { - - GaimConnection *gc; - GaimAccount *account; - GaimBlistNode *n = NULL; - GaimContact *c = NULL; - GaimBuddy *b = NULL; - GtkWidget *treeview; - GtkTreeModel *model; - GtkListStore *store; - GtkTreeIter iter; - GValue value = { 0, }; - guint32 uid, input_uid; - - treeview = widget; - gc = (GaimConnection *) data; - g_return_if_fail(gc != NULL); - account = gaim_connection_get_account(gc); - - if (sd->target != gdk_atom_intern("GAIM_BLIST_NODE", FALSE) || sd->data == NULL) { - gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Invalid drag data received, discard...\n"); - return; - } // if (sd->target - - memcpy(&n, sd->data, sizeof(n)); - - // we expect GAIM_BLIST_CONTACT_NODE and GAIM_BLIST_BUDDY_NODE - if (GAIM_BLIST_NODE_IS_CONTACT(n)) { - c = (GaimContact *) n; - b = c->priority; // we get the first buddy only - } else if (GAIM_BLIST_NODE_IS_BUDDY(n)) - b = (GaimBuddy *) n; - - if (b == NULL) { - gaim_debug(GAIM_DEBUG_ERROR, "QQ", "No valid GaimBuddy is passed from DnD\n"); - return; - } // if b == NULL - - gaim_debug(GAIM_DEBUG_INFO, "QQ", "We get a GaimBuddy: %s\n", b->name); - input_uid = gaim_name_to_uid(b->name); - g_return_if_fail(input_uid > 0); - - model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); - // we need to check if the user id in the member list is unique - // possibly a tree transverse is necessary to achieve this - if (gtk_tree_model_get_iter_first(model, &iter)) { - gtk_tree_model_get_value(model, &iter, COLUMN_UID, &value); - uid = g_value_get_uint(&value); - g_value_unset(&value); - while (uid != input_uid && gtk_tree_model_iter_next(model, &iter)) { - gtk_tree_model_get_value(model, &iter, COLUMN_UID, &value); - uid = g_value_get_uint(&value); - g_value_unset(&value); - } // while - } else - uid = 0; // if gtk_tree_model_get_iter_first - - if (uid == input_uid) { - gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Qun already has this buddy %s\n", b->name); - return; - } else { // we add it to list - store = GTK_LIST_STORE(model); - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, - COLUMN_SELECTED, FALSE, COLUMN_UID, input_uid, COLUMN_NICKNAME, b->alias, -1); - // re-sort the list - gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), COLUMN_UID, GTK_SORT_ASCENDING); - } // if uid - -} // _qq_group_member_list_drag_data_rcv_cb - -/*****************************************************************************/ -static GtkWidget *_create_page_info(GaimConnection * gc, qq_group * group, gboolean do_manage, qun_info_window * info_window) { - GtkWidget *vbox, *hbox; - GtkWidget *frame_info, *frame_auth; - GtkWidget *tbl_info; - GtkWidget *label, *entry, *combo, *text, *scrolled_window; - gint i; - - g_return_val_if_fail(gc != NULL && group != NULL, NULL); - - vbox = gtk_vbox_new(FALSE, 5); - - frame_info = gtk_frame_new(NULL); - gtk_box_pack_start(GTK_BOX(vbox), frame_info, TRUE, TRUE, 0); - - tbl_info = gtk_table_new(6, 4, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(tbl_info), 4); - gtk_table_set_col_spacing(GTK_TABLE(tbl_info), 1, 10); - gtk_container_add(GTK_CONTAINER(frame_info), tbl_info); - - label = gtk_label_new(_("Group ID: ")); - gtk_table_attach(GTK_TABLE(tbl_info), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); - label = gtk_label_new(g_strdup_printf("%d", group->external_group_id)); - gtk_table_attach(GTK_TABLE(tbl_info), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); - info_window->lbl_external_group_id = label; - - label = gtk_label_new(_("Group Name")); - gtk_table_attach(GTK_TABLE(tbl_info), label, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0); - entry = gtk_entry_new(); - gtk_widget_set_size_request(entry, 100, -1); - if (group->group_name_utf8 != NULL) - gtk_entry_set_text(GTK_ENTRY(entry), group->group_name_utf8); - gtk_table_attach(GTK_TABLE(tbl_info), entry, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0); - info_window->ent_group_name = entry; - - label = gtk_label_new(_("Admin: ")); - gtk_table_attach(GTK_TABLE(tbl_info), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); - label = gtk_label_new(g_strdup_printf("%d", group->creator_uid)); - gtk_table_attach(GTK_TABLE(tbl_info), label, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0); - info_window->lbl_admin_uid = label; - - label = gtk_label_new(_("Category")); - gtk_table_attach(GTK_TABLE(tbl_info), label, 2, 3, 1, 2, GTK_FILL, GTK_FILL, 0, 0); - - //henry: these codes are supported only in GTK-2.4 or later -#if GTK_CHECK_VERSION(2, 4, 0) - combo = gtk_combo_box_new_text(); - for (i = 0; i < 4; i++) - gtk_combo_box_append_text(GTK_COMBO_BOX(combo), qq_group_category[i]); - gtk_combo_box_set_active(GTK_COMBO_BOX(combo), group->group_category); -#else - GtkWidget *menu; - GtkWidget *item; - - combo = gtk_option_menu_new(); - menu = gtk_menu_new(); - for (i = 0; i < 4; i++) { - item = gtk_menu_item_new_with_label(qq_group_category[i]); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show(item); - } - gtk_option_menu_set_menu(GTK_OPTION_MENU(combo), menu); - gtk_option_menu_set_history(GTK_OPTION_MENU(combo), group->group_category); -#endif /* GTK_CHECK_VERSION */ - - gtk_table_attach(GTK_TABLE(tbl_info), combo, 3, 4, 1, 2, GTK_FILL, GTK_FILL, 0, 0); - info_window->cmb_group_category = combo; - - label = gtk_label_new(_("Description")); - gtk_table_attach(GTK_TABLE(tbl_info), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0); - text = gtk_text_view_new(); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD); - gtk_widget_set_size_request(text, -1, 50); - if (group->group_desc_utf8 != NULL) - gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), group->group_desc_utf8, -1); - info_window->txt_group_desc = text; - - scrolled_window = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_container_add(GTK_CONTAINER(scrolled_window), text); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN); - gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 2); - gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 2); - gtk_table_attach(GTK_TABLE(tbl_info), scrolled_window, 0, 4, 3, 4, GTK_FILL, GTK_FILL, 0, 0); - - label = gtk_label_new(_("Group Notice")); - gtk_table_attach(GTK_TABLE(tbl_info), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0); - text = gtk_text_view_new(); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD); - gtk_widget_set_size_request(text, -1, 50); - if (group->notice_utf8 != NULL) - gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), group->notice_utf8, -1); - info_window->txt_group_notice = text; - - scrolled_window = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_container_add(GTK_CONTAINER(scrolled_window), text); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN); - gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 2); - gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 2); - gtk_table_attach(GTK_TABLE(tbl_info), scrolled_window, 0, 4, 5, 6, GTK_FILL, GTK_FILL, 0, 0); - - frame_auth = gtk_frame_new(_("Authentication")); - hbox = gtk_hbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame_auth), hbox); - info_window->rad_auth[0] = gtk_radio_button_new_with_label(NULL, qq_group_auth_type_desc[0]); - info_window->rad_auth[1] = - gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON - (info_window->rad_auth[0]), qq_group_auth_type_desc[1]); - info_window->rad_auth[2] = - gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON - (info_window->rad_auth[0]), qq_group_auth_type_desc[2]); - for (i = 0; i < 3; i++) - gtk_box_pack_start(GTK_BOX(hbox), info_window->rad_auth[i], FALSE, FALSE, 0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(info_window->rad_auth[group->auth_type - 1]), TRUE); - gtk_box_pack_start(GTK_BOX(vbox), frame_auth, FALSE, FALSE, 0); - - if (!do_manage) { - gtk_widget_set_sensitive(frame_info, FALSE); - gtk_widget_set_sensitive(frame_auth, FALSE); - } // if ! do_manage - - return vbox; -} // _create_info_page - -/*****************************************************************************/ -static GtkWidget *_create_page_members - (GaimConnection * gc, qq_group * group, gboolean do_manage, qun_info_window * info_window) { - GtkWidget *vbox, *sw, *treeview; - GtkTreeModel *model; - GtkListStore *store; - GtkTreeIter iter; - GtkCellRenderer *renderer; - GtkTreeViewColumn *column; - GList *list; - qq_buddy *q_bud; - GtkTargetEntry gte = { "GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0 }; - - g_return_val_if_fail(gc != NULL && group != NULL, NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - if (group->members == NULL) { // if NULL, not ready - sw = gtk_label_new(_ - ("OpenQ is collecting member information.\nPlease close this window and open again")); - gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); - return vbox; - } // if group->members - - sw = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_ETCHED_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); - - store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_UINT, G_TYPE_STRING); - - list = group->members; - while (list != NULL) { - q_bud = (qq_buddy *) list->data; - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, - COLUMN_SELECTED, FALSE, - COLUMN_UID, q_bud->uid, COLUMN_NICKNAME, q_bud->nickname, -1); - list = list->next; - } // for - - model = GTK_TREE_MODEL(store); - treeview = gtk_tree_view_new_with_model(model); - info_window->tre_members = treeview; - - gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); - gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), COLUMN_UID); - g_object_unref(model); - - // set up drag & drop ONLY for managable Qun - if (do_manage) { - gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(treeview), >e, 1, GDK_ACTION_COPY); - g_signal_connect(G_OBJECT(treeview), "drag-data-received", - G_CALLBACK(_qq_group_member_list_drag_data_rcv_cb), gc); - } // if do manage - - gtk_container_add(GTK_CONTAINER(sw), treeview); - - model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); - renderer = gtk_cell_renderer_toggle_new(); - - // it seems this signal has to be handled - // otherwise, the checkbox in the column does not reponse to user action - if (do_manage) - g_signal_connect(renderer, "toggled", G_CALLBACK(_qq_group_member_list_deleted_toggled), info_window); - - column = gtk_tree_view_column_new_with_attributes(_("Del"), renderer, "active", COLUMN_SELECTED, NULL); - - gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), GTK_TREE_VIEW_COLUMN_FIXED); - gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column), 30); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("UID"), renderer, "text", COLUMN_UID, NULL); - gtk_tree_view_column_set_sort_column_id(column, COLUMN_UID); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - // default sort by UID - gtk_tree_view_column_set_sort_order(column, GTK_SORT_ASCENDING); - gtk_tree_view_column_set_sort_indicator(column, TRUE); - - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("Nickname"), renderer, "text", COLUMN_NICKNAME, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - - return vbox; -} // _create_page_members - -/**************************************************************... [truncated message content] |
From: <sa...@us...> - 2006-07-24 09:25:54
|
Revision: 16561 Author: sadrul Date: 2006-07-24 02:25:48 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16561&view=rev Log Message: ----------- Appropriately handle the notify dialogs when they close to prevent crashes. Modified Paths: -------------- trunk/console/gntconv.c trunk/console/gntnotify.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-07-24 05:12:57 UTC (rev 16560) +++ trunk/console/gntconv.c 2006-07-24 09:25:48 UTC (rev 16561) @@ -200,7 +200,7 @@ gg_write_common(GaimConversation *conv, const char *who, const char *message, GaimMessageFlags flags, time_t mtime) { - GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); + GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); /* XXX: ggconv = conv->ui_data; should do */ char *strip; GntTextFormatFlags fl = 0; Modified: trunk/console/gntnotify.c =================================================================== --- trunk/console/gntnotify.c 2006-07-24 05:12:57 UTC (rev 16560) +++ trunk/console/gntnotify.c 2006-07-24 09:25:48 UTC (rev 16561) @@ -15,6 +15,12 @@ GntWidget *tree; } emaildialog; +static void +notify_msg_window_destroy_cb(GntWidget *window, GaimNotifyMsgType type) +{ + gaim_notify_close(type, window); +} + static void * gg_notify_message(GaimNotifyMsgType type, const char *title, const char *primary, const char *secondary) @@ -48,7 +54,10 @@ button = gnt_button_new(_("OK")); gnt_box_add_widget(GNT_BOX(window), button); - g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), window); + g_signal_connect_swapped(G_OBJECT(button), "activate", + G_CALLBACK(gnt_widget_destroy), window); + g_signal_connect(G_OBJECT(window), "destroy", + G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(type)); gnt_widget_show(window); return window; @@ -58,11 +67,20 @@ static void gg_close_notify(GaimNotifyType type, void *handle) { GntWidget *widget = handle; + + if (!widget) + return; + while (widget->parent) widget = widget->parent; if (type == GAIM_NOTIFY_SEARCHRESULTS) gaim_notify_searchresults_free(g_object_get_data(handle, "notify-results")); +#if 0 + /* This does not seem to be necessary */ + g_signal_handlers_disconnect_by_func(G_OBJECT(widget), + G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(type)); +#endif gnt_widget_destroy(widget); } @@ -77,7 +95,7 @@ secondary ? "\n" : "", unformat ? unformat : ""); - void *ret = gg_notify_message(GAIM_NOTIFY_MSG_INFO, title, primary, t); + void *ret = gg_notify_message(GAIM_NOTIFY_FORMATTED, title, primary, t); g_free(t); g_free(unformat); @@ -157,7 +175,7 @@ return NULL; } - ret = gg_notify_message(GAIM_NOTIFY_MSG_INFO, _("New Mail"), _("You have mail!"), message->str); + ret = gg_notify_message(GAIM_NOTIFY_EMAIL, _("New Mail"), _("You have mail!"), message->str); g_string_free(message, TRUE); return ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-24 05:13:06
|
Revision: 16560 Author: thekingant Date: 2006-07-23 22:12:57 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16560&view=rev Log Message: ----------- That was a bit of a pain in the ass... Modified Paths: -------------- web/htdocs/index.php web/htdocs/summerofcode/adam/posts/head.html web/htdocs/summerofcode/andrewd/posts/head.html web/htdocs/summerofcode/andrews/posts/head.html web/htdocs/summerofcode/bartosz/posts/head.html web/htdocs/summerofcode/charlie/posts/head.html web/htdocs/summerofcode/christian/posts/head.html web/htdocs/summerofcode/cristhian/posts/head.html web/htdocs/summerofcode/erin/posts/head.html web/htdocs/summerofcode/john/posts/head.html web/htdocs/summerofcode/jonathan/posts/head.html web/htdocs/summerofcode/juanjo/posts/head.html web/htdocs/summerofcode/mel/posts/head.html web/htdocs/summerofcode/piotr/posts/head.html web/htdocs/summerofcode/thomas/posts/head.html Modified: web/htdocs/index.php =================================================================== --- web/htdocs/index.php 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/index.php 2006-07-24 05:12:57 UTC (rev 16560) @@ -6,7 +6,7 @@ <div id="rss"> Get the news in RSS - <a href="/rss.php/news"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/rss.php/news"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <?php Modified: web/htdocs/summerofcode/adam/posts/head.html =================================================================== --- web/htdocs/summerofcode/adam/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/adam/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/adam/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/adam/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/andrewd/posts/head.html =================================================================== --- web/htdocs/summerofcode/andrewd/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/andrewd/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/andrewd/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/andrewd/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/andrews/posts/head.html =================================================================== --- web/htdocs/summerofcode/andrews/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/andrews/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/andrews/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/andrews/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/bartosz/posts/head.html =================================================================== --- web/htdocs/summerofcode/bartosz/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/bartosz/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/bartosz/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/bartosz/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/charlie/posts/head.html =================================================================== --- web/htdocs/summerofcode/charlie/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/charlie/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/charlie/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/charlie/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/christian/posts/head.html =================================================================== --- web/htdocs/summerofcode/christian/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/christian/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/christian/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/christian/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/cristhian/posts/head.html =================================================================== --- web/htdocs/summerofcode/cristhian/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/cristhian/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/cristhian/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/cristhian/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/erin/posts/head.html =================================================================== --- web/htdocs/summerofcode/erin/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/erin/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/erin/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/erin/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/john/posts/head.html =================================================================== --- web/htdocs/summerofcode/john/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/john/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/john/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/john/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/jonathan/posts/head.html =================================================================== --- web/htdocs/summerofcode/jonathan/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/jonathan/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/jonathan/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/jonathan/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/juanjo/posts/head.html =================================================================== --- web/htdocs/summerofcode/juanjo/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/juanjo/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/juanjo/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/juanjo/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/mel/posts/head.html =================================================================== --- web/htdocs/summerofcode/mel/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/mel/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/mel/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/mel/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/piotr/posts/head.html =================================================================== --- web/htdocs/summerofcode/piotr/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/piotr/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/piotr/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/piotr/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> Modified: web/htdocs/summerofcode/thomas/posts/head.html =================================================================== --- web/htdocs/summerofcode/thomas/posts/head.html 2006-07-24 05:08:30 UTC (rev 16559) +++ web/htdocs/summerofcode/thomas/posts/head.html 2006-07-24 05:12:57 UTC (rev 16560) @@ -120,7 +120,7 @@ <div id="content"> <div id="rss"> Get this weblog in RSS - <a href="/summerofcode/thomas/blog/index.rss"><img src="/images/feed-icon.png" width="24" height="24" border="0" alt="XML" /></a> + <a href="/summerofcode/thomas/blog/index.rss"><img src="/images/feed-icon.png" border="0" alt="XML" /></a> </div> <br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rl...@us...> - 2006-07-24 05:08:39
|
Revision: 16559 Author: rlaager Date: 2006-07-23 22:08:30 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16559&view=rev Log Message: ----------- Change the log-timestamp and conversation-timestamp signals to pass around a time_t instead of a struct tm. Most of this changeset is Ethan's work. Modified Paths: -------------- trunk/configure.ac trunk/doc/gtkconv-signals.dox trunk/doc/log-signals.dox trunk/plugins/timestamp_format.c trunk/src/gtkconv.c trunk/src/log.c trunk/src/signals.c trunk/src/signals.h trunk/src/value.h Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2006-07-24 05:07:59 UTC (rev 16558) +++ trunk/configure.ac 2006-07-24 05:08:30 UTC (rev 16559) @@ -60,6 +60,9 @@ dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_STRUCT_TM +AC_CHECK_SIZEOF(time_t, ,[ +#include <stdio.h> +#include <time.h>]) AC_C_BIGENDIAN Modified: trunk/doc/gtkconv-signals.dox =================================================================== --- trunk/doc/gtkconv-signals.dox 2006-07-24 05:07:59 UTC (rev 16558) +++ trunk/doc/gtkconv-signals.dox 2006-07-24 05:08:30 UTC (rev 16559) @@ -24,12 +24,12 @@ @signaldef conversation-timestamp @signalproto -char *(*conversation_timestamp)(GaimConversation *conv, struct tm *tm); +char *(*conversation_timestamp)(GaimConversation *conv, time_t when); @endsignalproto @signaldesc Emitted to allow plugins to customize the timestamp on a message. @param conv The conversation the message belongs to. - @param tm The time to be converted to a string. + @param when The time to be converted to a string. @return A textual representation of the time, or @c NULL to use a default format. @endsignaldef Modified: trunk/doc/log-signals.dox =================================================================== --- trunk/doc/log-signals.dox 2006-07-24 05:07:59 UTC (rev 16558) +++ trunk/doc/log-signals.dox 2006-07-24 05:08:30 UTC (rev 16559) @@ -8,13 +8,13 @@ @signaldef log-timestamp @signalproto -char *(*log_timestamp)(GaimConversation *conv, struct tm *tm); +char *(*log_timestamp)(GaimConversation *conv, time_t when); @endsignalproto @signaldesc Emitted to allow plugins to customize the timestamp on a message being logged. @param log The log the message belongs to. - @param tm The time to be converted to a string. + @param when The time to be converted to a string. @return A textual representation of the time, or @c NULL to use a default format. @note Plugins must be careful of logs with a type of GAIM_LOG_SYSTEM. Modified: trunk/plugins/timestamp_format.c =================================================================== --- trunk/plugins/timestamp_format.c 2006-07-24 05:07:59 UTC (rev 16558) +++ trunk/plugins/timestamp_format.c 2006-07-24 05:08:30 UTC (rev 16559) @@ -52,18 +52,18 @@ } static char *timestamp_cb_common(GaimConversation *conv, - const struct tm *tm, + time_t t, gboolean force, const char *dates) { + struct tm *tm = localtime(&t); g_return_val_if_fail(conv != NULL, NULL); - g_return_val_if_fail(tm != NULL, NULL); g_return_val_if_fail(dates != NULL, NULL); if (!strcmp(dates, "always") || (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT && !strcmp(dates, "chats")) || - (time(NULL) > (mktime((struct tm *)tm) + 20*60))) + (time(NULL) > (mktime(tm) + 20*60))) { if (force) return g_strdup(gaim_utf8_strftime("%Y-%m-%d %H:%M:%S", tm)); @@ -78,7 +78,7 @@ } static char *conversation_timestamp_cb(GaimConversation *conv, - const struct tm *tm, gpointer data) + time_t t, gpointer data) { gboolean force = gaim_prefs_get_bool( "/plugins/gtk/timestamp_format/force_24hr"); @@ -86,13 +86,11 @@ "/plugins/gtk/timestamp_format/use_dates/conversation"); g_return_val_if_fail(conv != NULL, NULL); - g_return_val_if_fail(tm != NULL, NULL); - return timestamp_cb_common(conv, tm, force, dates); + return timestamp_cb_common(conv, t, force, dates); } -static char *log_timestamp_cb(GaimLog *log, - const struct tm *tm, gpointer data) +static char *log_timestamp_cb(GaimLog *log, time_t t, gpointer data) { gboolean force = gaim_prefs_get_bool( "/plugins/gtk/timestamp_format/force_24hr"); @@ -100,17 +98,18 @@ "/plugins/gtk/timestamp_format/use_dates/log"); g_return_val_if_fail(log != NULL, NULL); - g_return_val_if_fail(tm != NULL, NULL); if (log->type == GAIM_LOG_SYSTEM) { - if (force) + if (force) { + struct tm *tm = localtime(&t); return g_strdup(gaim_utf8_strftime("%Y-%m-%d %H:%M:%S", tm)); - else + } else { return NULL; + } } - return timestamp_cb_common(log->conv, tm, force, dates); + return timestamp_cb_common(log->conv, t, force, dates); } static gboolean Modified: trunk/src/gtkconv.c =================================================================== --- trunk/src/gtkconv.c 2006-07-24 05:07:59 UTC (rev 16558) +++ trunk/src/gtkconv.c 2006-07-24 05:08:30 UTC (rev 16559) @@ -4691,7 +4691,6 @@ GaimConversationType type; char *displaying; gboolean plugin_return; - struct tm tm; g_return_if_fail(conv != NULL); gtkconv = GAIM_GTK_CONVERSATION(conv); @@ -4776,16 +4775,16 @@ if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", gtk_font_options_all); - tm = *(localtime(&mtime)); mdate = gaim_signal_emit_return_1(gaim_gtk_conversations_get_handle(), "conversation-timestamp", - conv, &tm); + conv, mtime); if (mdate == NULL) { + struct tm *tm = localtime(&mtime); if (time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ - mdate = g_strdup(gaim_date_format_long(&tm)); + mdate = g_strdup(gaim_date_format_long(tm)); else - mdate = g_strdup(gaim_time_format(&tm)); + mdate = g_strdup(gaim_time_format(tm)); } sml_attrib = g_strdup_printf("sml=\"%s\"", gaim_account_get_protocol_name(account)); @@ -6576,11 +6575,17 @@ "GaimGtkWindow *")); gaim_signal_register(handle, "conversation-timestamp", - gaim_marshal_POINTER__POINTER_POINTER, +#if SIZEOF_TIME_T == 4 + gaim_marshal_POINTER__POINTER_INT, +#elif SIZEOF_TIME_T == 8 + gaim_marshal_POINTER__POINTER_INT64, +#else +# error Unknown size of time_t +#endif gaim_value_new(GAIM_TYPE_POINTER), 2, gaim_value_new(GAIM_TYPE_SUBTYPE, - GAIM_SUBTYPE_CONVERSATION), - gaim_value_new(GAIM_TYPE_POINTER)); + GAIM_SUBTYPE_LOG), + gaim_value_new(GAIM_TYPE_TIME_T)); gaim_signal_register(handle, "displaying-im-msg", gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, Modified: trunk/src/log.c =================================================================== --- trunk/src/log.c 2006-07-24 05:07:59 UTC (rev 16558) +++ trunk/src/log.c 2006-07-24 05:08:30 UTC (rev 16559) @@ -594,12 +594,17 @@ gaim_log_logger_add(old_logger); gaim_signal_register(handle, "log-timestamp", - gaim_marshal_POINTER__POINTER_POINTER, +#if SIZEOF_TIME_T == 4 + gaim_marshal_POINTER__POINTER_INT, +#elif SIZEOF_TIME_T == 8 + gaim_marshal_POINTER__POINTER_INT64, +#else +# error Unknown size of time_t +#endif gaim_value_new(GAIM_TYPE_POINTER), 2, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_LOG), - gaim_value_new(GAIM_TYPE_BOXED, - "struct tm *")); + gaim_value_new(GAIM_TYPE_TIME_T)); gaim_prefs_connect_callback(NULL, "/core/logging/format", logger_pref_cb, NULL); @@ -623,14 +628,15 @@ static char *log_get_timestamp(GaimLog *log, time_t when) { char *date; - struct tm tm = *(localtime(&when)); + struct tm tm; date = gaim_signal_emit_return_1(gaim_log_get_handle(), "log-timestamp", - log, &tm); + log, when); if (date != NULL) return date; + tm = *(localtime(&when)); if (log->type == GAIM_LOG_SYSTEM || time(NULL) > when + 20*60) return g_strdup(gaim_date_format_long(&tm)); else Modified: trunk/src/signals.c =================================================================== --- trunk/src/signals.c 2006-07-24 05:07:59 UTC (rev 16558) +++ trunk/src/signals.c 2006-07-24 05:08:30 UTC (rev 16559) @@ -955,6 +955,36 @@ } void +gaim_marshal_POINTER__POINTER_INT( + GaimCallback cb, va_list args, void *data, + void **return_val) +{ + gpointer ret_val; + void *arg1 = va_arg(args, void *); + gint arg2 = va_arg(args, gint); + + ret_val = ((gpointer(*)(void *, gint, void *))cb)(arg1, arg2, data); + + if (return_val != NULL) + *return_val = ret_val; +} + +void +gaim_marshal_POINTER__POINTER_INT64( + GaimCallback cb, va_list args, void *data, + void **return_val) +{ + gpointer ret_val; + void *arg1 = va_arg(args, void *); + gint64 arg2 = va_arg(args, gint64); + + ret_val = ((gpointer(*)(void *, gint64, void *))cb)(arg1, arg2, data); + + if (return_val != NULL) + *return_val = ret_val; +} + +void gaim_marshal_POINTER__POINTER_POINTER(GaimCallback cb, va_list args, void *data, void **return_val) { Modified: trunk/src/signals.h =================================================================== --- trunk/src/signals.h 2006-07-24 05:07:59 UTC (rev 16558) +++ trunk/src/signals.h 2006-07-24 05:08:30 UTC (rev 16559) @@ -327,6 +327,10 @@ void gaim_marshal_BOOLEAN__INT_POINTER( GaimCallback cb, va_list args, void *data, void **return_val); +void gaim_marshal_POINTER__POINTER_INT( + GaimCallback cb, va_list args, void *data, void **return_val); +void gaim_marshal_POINTER__POINTER_INT64( + GaimCallback cb, va_list args, void *data, void **return_val); void gaim_marshal_POINTER__POINTER_POINTER( GaimCallback cb, va_list args, void *data, void **return_val); /*@}*/ Modified: trunk/src/value.h =================================================================== --- trunk/src/value.h 2006-07-24 05:07:59 UTC (rev 16558) +++ trunk/src/value.h 2006-07-24 05:08:30 UTC (rev 16559) @@ -26,6 +26,7 @@ #define _GAIM_VALUE_H_ #include <glib.h> +#include "config.h" /** * Specific value types. @@ -53,6 +54,16 @@ } GaimType; +/* time_t is normally either an int or a uint; this is a little ugly + * and probably deserves revisiting. */ +#if SIZEOF_TIME_T == 8 +# define GAIM_TYPE_TIME_T GAIM_TYPE_INT64 +#else +# define GAIM_TYPE_TIME_T GAIM_TYPE_INT +#endif /* sizeof(time_t) == 8 */ + + + /** * Gaim-specific subtype values. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-24 05:08:03
|
Revision: 16558 Author: thekingant Date: 2006-07-23 22:07:59 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16558&view=rev Log Message: ----------- Smaller feed icon (16x16 instead of 24x24) Modified Paths: -------------- web/htdocs/images/feed-icon.png Property Changed: ---------------- web/htdocs/images/feed-icon.png Modified: web/htdocs/images/feed-icon.png =================================================================== (Binary files differ) Property changes on: web/htdocs/images/feed-icon.png ___________________________________________________________________ Name: svn:mime-type - application/octet-stream + image/png This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-24 04:31:28
|
Revision: 16557 Author: thekingant Date: 2006-07-23 21:31:25 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16557&view=rev Log Message: ----------- Backport SVN revision #16556 from HEAD to v2_0_0 Original commit message: Fix a minor case of accessing something that had been free'd in oscar, and some other minor cleanup. FYI "0" is a valid file descriptor, but it will pretty much always be STDOUT, STDERR or STDIN. But I like to check for -1 anyway, because I'm weird. ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16556&view=rev Modified Paths: -------------- branches/v2_0_0/src/protocols/oscar/flap_connection.c branches/v2_0_0/src/protocols/oscar/odc.c branches/v2_0_0/src/protocols/oscar/oscar.h branches/v2_0_0/src/sslconn.c Modified: branches/v2_0_0/src/protocols/oscar/flap_connection.c =================================================================== --- branches/v2_0_0/src/protocols/oscar/flap_connection.c 2006-07-24 04:27:42 UTC (rev 16556) +++ branches/v2_0_0/src/protocols/oscar/flap_connection.c 2006-07-24 04:31:25 UTC (rev 16557) @@ -205,7 +205,6 @@ flap_connection_destroy_rates(conn->rates); od->oscar_connections = g_list_remove(od->oscar_connections, conn); - g_free(conn); account = gaim_connection_get_account(od->gc); @@ -227,12 +226,18 @@ else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) tmp = _("Could not establish a connection with the server."); else + /* + * We shouldn't print a message for some disconnect_reasons. + * Like OSCAR_DISCONNECT_LOCAL_CLOSED. + */ tmp = NULL; if (tmp != NULL) gaim_connection_error(od->gc, tmp); } + g_free(conn); + return FALSE; } Modified: branches/v2_0_0/src/protocols/oscar/odc.c =================================================================== --- branches/v2_0_0/src/protocols/oscar/odc.c 2006-07-24 04:27:42 UTC (rev 16556) +++ branches/v2_0_0/src/protocols/oscar/odc.c 2006-07-24 04:31:25 UTC (rev 16557) @@ -37,25 +37,15 @@ const gchar *tmp; if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) - { tmp = _("The remote user has closed the connection."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED) - { tmp = _("The remote user has declined your request."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) - { tmp = _("Lost connection with the remote user for an unknown reason."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) - { tmp = _("Received invalid data on connection with remote user."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) - { tmp = _("Could not establish a connection with the remote user."); - } else /* * We shouldn't print a message for some disconnect_reasons. Modified: branches/v2_0_0/src/protocols/oscar/oscar.h =================================================================== --- branches/v2_0_0/src/protocols/oscar/oscar.h 2006-07-24 04:27:42 UTC (rev 16556) +++ branches/v2_0_0/src/protocols/oscar/oscar.h 2006-07-24 04:31:25 UTC (rev 16557) @@ -287,14 +287,14 @@ typedef enum { - OSCAR_DISCONNECT_DONE, - OSCAR_DISCONNECT_LOCAL_CLOSED, + OSCAR_DISCONNECT_DONE, /* not considered an error */ + OSCAR_DISCONNECT_LOCAL_CLOSED, /* peer connections only, not considered an error */ OSCAR_DISCONNECT_REMOTE_CLOSED, - OSCAR_DISCONNECT_REMOTE_REFUSED, + OSCAR_DISCONNECT_REMOTE_REFUSED, /* peer connections only */ OSCAR_DISCONNECT_LOST_CONNECTION, OSCAR_DISCONNECT_INVALID_DATA, OSCAR_DISCONNECT_COULD_NOT_CONNECT, - OSCAR_DISCONNECT_RETRYING + OSCAR_DISCONNECT_RETRYING /* peer connections only */ } OscarDisconnectReason; typedef enum Modified: branches/v2_0_0/src/sslconn.c =================================================================== --- branches/v2_0_0/src/sslconn.c 2006-07-24 04:27:42 UTC (rev 16556) +++ branches/v2_0_0/src/sslconn.c 2006-07-24 04:31:25 UTC (rev 16557) @@ -137,7 +137,7 @@ GaimSslConnection *gsc; GaimSslOps *ops; - g_return_val_if_fail(fd > 0, NULL); + g_return_val_if_fail(fd != -1, NULL); g_return_val_if_fail(func != NULL, NULL); g_return_val_if_fail(gaim_ssl_is_supported(), NULL); @@ -178,12 +178,10 @@ if (ops != NULL && ops->close != NULL) (ops->close)(gsc); - if (gsc->fd) + if (gsc->fd != -1) close(gsc->fd); - if (gsc->host != NULL) - g_free(gsc->host); - + g_free(gsc->host); g_free(gsc); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-24 04:27:53
|
Revision: 16556 Author: thekingant Date: 2006-07-23 21:27:42 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16556&view=rev Log Message: ----------- Fix a minor case of accessing something that had been free'd in oscar, and some other minor cleanup. FYI "0" is a valid file descriptor, but it will pretty much always be STDOUT, STDERR or STDIN. But I like to check for -1 anyway, because I'm weird. Modified Paths: -------------- trunk/src/protocols/oscar/flap_connection.c trunk/src/protocols/oscar/odc.c trunk/src/protocols/oscar/oscar.h trunk/src/sslconn.c Modified: trunk/src/protocols/oscar/flap_connection.c =================================================================== --- trunk/src/protocols/oscar/flap_connection.c 2006-07-24 01:03:07 UTC (rev 16555) +++ trunk/src/protocols/oscar/flap_connection.c 2006-07-24 04:27:42 UTC (rev 16556) @@ -205,7 +205,6 @@ flap_connection_destroy_rates(conn->rates); od->oscar_connections = g_list_remove(od->oscar_connections, conn); - g_free(conn); account = gaim_connection_get_account(od->gc); @@ -227,12 +226,18 @@ else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) tmp = _("Could not establish a connection with the server."); else + /* + * We shouldn't print a message for some disconnect_reasons. + * Like OSCAR_DISCONNECT_LOCAL_CLOSED. + */ tmp = NULL; if (tmp != NULL) gaim_connection_error(od->gc, tmp); } + g_free(conn); + return FALSE; } Modified: trunk/src/protocols/oscar/odc.c =================================================================== --- trunk/src/protocols/oscar/odc.c 2006-07-24 01:03:07 UTC (rev 16555) +++ trunk/src/protocols/oscar/odc.c 2006-07-24 04:27:42 UTC (rev 16556) @@ -37,25 +37,15 @@ const gchar *tmp; if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) - { tmp = _("The remote user has closed the connection."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED) - { tmp = _("The remote user has declined your request."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) - { tmp = _("Lost connection with the remote user for an unknown reason."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) - { tmp = _("Received invalid data on connection with remote user."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) - { tmp = _("Could not establish a connection with the remote user."); - } else /* * We shouldn't print a message for some disconnect_reasons. Modified: trunk/src/protocols/oscar/oscar.h =================================================================== --- trunk/src/protocols/oscar/oscar.h 2006-07-24 01:03:07 UTC (rev 16555) +++ trunk/src/protocols/oscar/oscar.h 2006-07-24 04:27:42 UTC (rev 16556) @@ -287,14 +287,14 @@ typedef enum { - OSCAR_DISCONNECT_DONE, - OSCAR_DISCONNECT_LOCAL_CLOSED, + OSCAR_DISCONNECT_DONE, /* not considered an error */ + OSCAR_DISCONNECT_LOCAL_CLOSED, /* peer connections only, not considered an error */ OSCAR_DISCONNECT_REMOTE_CLOSED, - OSCAR_DISCONNECT_REMOTE_REFUSED, + OSCAR_DISCONNECT_REMOTE_REFUSED, /* peer connections only */ OSCAR_DISCONNECT_LOST_CONNECTION, OSCAR_DISCONNECT_INVALID_DATA, OSCAR_DISCONNECT_COULD_NOT_CONNECT, - OSCAR_DISCONNECT_RETRYING + OSCAR_DISCONNECT_RETRYING /* peer connections only */ } OscarDisconnectReason; typedef enum Modified: trunk/src/sslconn.c =================================================================== --- trunk/src/sslconn.c 2006-07-24 01:03:07 UTC (rev 16555) +++ trunk/src/sslconn.c 2006-07-24 04:27:42 UTC (rev 16556) @@ -137,7 +137,7 @@ GaimSslConnection *gsc; GaimSslOps *ops; - g_return_val_if_fail(fd > 0, NULL); + g_return_val_if_fail(fd != -1, NULL); g_return_val_if_fail(func != NULL, NULL); g_return_val_if_fail(gaim_ssl_is_supported(), NULL); @@ -178,12 +178,10 @@ if (ops != NULL && ops->close != NULL) (ops->close)(gsc); - if (gsc->fd) + if (gsc->fd != -1) close(gsc->fd); - if (gsc->host != NULL) - g_free(gsc->host); - + g_free(gsc->host); g_free(gsc); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-07-24 01:03:11
|
Revision: 16555 Author: sadrul Date: 2006-07-23 18:03:07 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16555&view=rev Log Message: ----------- Do not crash when you close the debug window, or use the "/clear" command. Enable the stuff in gntaccount.c that were waiting on the request-ui. Modified Paths: -------------- trunk/console/gntaccount.c trunk/console/gntconv.c trunk/console/gntdebug.c Modified: trunk/console/gntaccount.c =================================================================== --- trunk/console/gntaccount.c 2006-07-24 00:52:01 UTC (rev 16554) +++ trunk/console/gntaccount.c 2006-07-24 01:03:07 UTC (rev 16555) @@ -644,9 +644,7 @@ gnt_widget_destroy(accounts.window); } -#if 0 /* The following uiops stuff are copied from gtkaccount.c */ -/* Need to do some work on notify- and request-ui before this works */ typedef struct { GaimAccount *account; @@ -693,6 +691,31 @@ } static void +free_add_user_data(AddUserData *data) +{ + g_free(data->username); + + if (data->alias != NULL) + g_free(data->alias); + + g_free(data); +} + +static void +add_user_cb(AddUserData *data) +{ + GaimConnection *gc = gaim_account_get_connection(data->account); + + if (g_list_find(gaim_connections_get_all(), gc)) + { + gaim_blist_request_add_buddy(data->account, data->username, + NULL, data->alias); + } + + free_add_user_data(data); +} + +static void request_add(GaimAccount *account, const char *remote_user, const char *id, const char *alias, const char *msg) @@ -709,12 +732,10 @@ data->alias = (alias != NULL ? g_strdup(alias) : NULL); buffer = make_info(account, gc, remote_user, id, alias, msg); -#if 0 gaim_request_action(NULL, NULL, _("Add buddy to your list?"), buffer, GAIM_DEFAULT_ACTION_NONE, data, 2, _("Add"), G_CALLBACK(add_user_cb), _("Cancel"), G_CALLBACK(free_add_user_data)); -#endif g_free(buffer); } @@ -724,17 +745,7 @@ .status_changed = NULL, .request_add = request_add }; -#else -static GaimAccountUiOps ui_ops = -{ - .notify_added = NULL, - .status_changed = NULL, - .request_add = NULL -}; - -#endif - GaimAccountUiOps *gg_accounts_get_ui_ops() { return &ui_ops; Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-07-24 00:52:01 UTC (rev 16554) +++ trunk/console/gntconv.c 2006-07-24 01:03:07 UTC (rev 16555) @@ -159,6 +159,7 @@ g_hash_table_insert(ggconvs, conv, ggc); ggc->conv = conv; + conv->ui_data = ggc; type = gaim_conversation_get_type(conv); title = g_strdup_printf(_("%s"), gaim_conversation_get_name(conv)); Modified: trunk/console/gntdebug.c =================================================================== --- trunk/console/gntdebug.c 2006-07-24 00:52:01 UTC (rev 16554) +++ trunk/console/gntdebug.c 2006-07-24 01:03:07 UTC (rev 16555) @@ -80,6 +80,12 @@ return &uiops; } +static void +reset_debug_win(GntWidget *w, gpointer null) +{ + debug.window = debug.tview = NULL; +} + void gg_debug_window_show() { if (debug.window == NULL) @@ -90,6 +96,8 @@ debug.tview = gnt_text_view_new(); gnt_box_add_widget(GNT_BOX(debug.window), debug.tview); + + g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); } gnt_widget_show(debug.window); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aar...@us...> - 2006-07-24 00:52:05
|
Revision: 16554 Author: aaronsheldon Date: 2006-07-23 17:52:01 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16554&view=rev Log Message: ----------- Updating the API changelog to reflect the chat-speed merge changes. Modified Paths: -------------- trunk/plugins/ChangeLog.API Modified: trunk/plugins/ChangeLog.API =================================================================== --- trunk/plugins/ChangeLog.API 2006-07-23 21:25:09 UTC (rev 16553) +++ trunk/plugins/ChangeLog.API 2006-07-24 00:52:01 UTC (rev 16554) @@ -43,9 +43,11 @@ const char *name, const char *alias * gaim_conv_chat_add_users(), added extra_msgs and new_arrivals (pass NULL and FALSE respectively, to get the same behavior as before) - * chat_add_users in GaimConversationUiOps, added flags, aliases, - and new_arrivals + * chat_add_users in GaimConversationUiOps, added cbuddies and + new_arrivals and removed buddies. * chat_rename_user in GaimConversationUiOps, added new_alias + * gaim_conv_chat_cb_new(), added alias. (pass NULL to get the same + behavior as before). * GaimConversation.log became GList * GaimConversation.logs, so that a conversation can have multiple logs at once * gaim_conv_chat_add_user, added extra_msgs This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aar...@us...> - 2006-07-23 21:25:19
|
Revision: 16553 Author: aaronsheldon Date: 2006-07-23 14:25:09 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16553&view=rev Log Message: ----------- Caching lookup keys until something changes. Still has some bugs though. Modified Paths: -------------- branches/soc-2006-blist-efficiency/src/gtkblist.c branches/soc-2006-blist-efficiency/src/gtkblist.h Modified: branches/soc-2006-blist-efficiency/src/gtkblist.c =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-23 20:38:07 UTC (rev 16552) +++ branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-07-23 21:25:09 UTC (rev 16553) @@ -120,7 +120,8 @@ static GaimGtkBuddyList *gtkblist = NULL; static gboolean gaim_gtk_blist_refresh_timer(GaimBuddyList *list); -static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node); +static void gaim_gtk_blist_update_buddy_status_icon_key(GaimBlistNode *node, GaimStatusIconSize size); +static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node, gboolean statusChange); static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data); static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node); static void gaim_gtk_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node); @@ -137,6 +138,7 @@ gboolean contact_expanded; gboolean recent_signonoff; gint recent_signonoff_timer; + GString *status_icon_key; }; @@ -2706,6 +2708,98 @@ return; } +static void +gaim_gtk_blist_update_buddy_status_icon_key(GaimBlistNode *node, GaimStatusIconSize size) +{ + int i; + GaimAccount *account; + GaimPlugin *prpl; + GaimPluginProtocolInfo *prpl_info; + GString *key = g_string_sized_new(16); + GaimBuddy *buddy; + const char *protoname = NULL; + struct _gaim_gtk_blist_node *gtknode = node->ui_data; + struct _gaim_gtk_blist_node *gtkbuddynode = NULL; + struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15}, + {NULL, 0, 0}, {NULL, 15, 0}}; + + buddy = (GaimBuddy*)node; + gtkbuddynode = node->ui_data; + + if (gtkbuddynode && gtkbuddynode->recent_signonoff) { + if (GAIM_BUDDY_IS_ONLINE(buddy)) + g_string_printf(key, "%s/login", protoname); + else + g_string_printf(key, "%s/logout", protoname); + } else { + GaimConversation *conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, + gaim_buddy_get_name(buddy), + gaim_buddy_get_account(buddy)); + if(conv != NULL) { + GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); + if(gtkconv != NULL && gaim_gtkconv_is_hidden(gtkconv)) { + /* add pending emblem */ + if(size == GAIM_STATUS_ICON_SMALL) { + emblems[0].filename="pending"; + } + else { + emblems[3].filename=emblems[2].filename; + emblems[2].filename="pending"; + } + } + } + + account = buddy->account; + prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); + + if(!prpl) + return; + + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); + + if(prpl_info && prpl_info->list_icon) { + protoname = prpl_info->list_icon(account, buddy); + } + if(prpl_info && prpl_info->list_emblems && buddy) { + if(gtknode && !gtknode->recent_signonoff) + prpl_info->list_emblems(buddy, &emblems[0].filename, + &emblems[1].filename, &emblems[2].filename, + &emblems[3].filename); + } + + if(size == GAIM_STATUS_ICON_SMALL) { + /* So that only the se icon will composite */ + emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL; + } + + g_string_assign(key, protoname); + + for(i=0; i<4; i++) { + if(emblems[i].filename) { + g_string_append_printf(key, "/%s", emblems[i].filename); + } + } + } + + if (!GAIM_BUDDY_IS_ONLINE(buddy)) { + key = g_string_append(key, "/off"); + } else if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) { + key = g_string_append(key, "/idle"); + } + if (!gaim_privacy_check(buddy->account, gaim_buddy_get_name(buddy))) { + key = g_string_append(key, "/priv"); + } + + if (gtkbuddynode) { + if (gtkbuddynode->status_icon_key) + g_string_free(gtkbuddynode->status_icon_key, TRUE); + gtkbuddynode->status_icon_key = g_string_new(key->str); + } + + g_string_free(key, TRUE); + return; +} + GdkPixbuf * gaim_gtk_blist_get_status_icon(GaimBlistNode *node, GaimStatusIconSize size) { @@ -2722,12 +2816,6 @@ GaimBuddy *buddy = NULL; GaimChat *chat = NULL; - if (!status_icon_hash_table) - 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) { buddy = gaim_contact_get_priority_buddy((GaimContact*)node); @@ -2742,6 +2830,28 @@ return NULL; } + if (!status_icon_hash_table) { + 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); + + } else if (buddy && gtkbuddynode->status_icon_key && gtkbuddynode->status_icon_key->str) { + key = g_string_new(gtkbuddynode->status_icon_key->str); + + /* Respect the size request given */ + if (size == GAIM_STATUS_ICON_SMALL) { + key = g_string_append(key, "/tiny"); + } + + scale = g_hash_table_lookup(status_icon_hash_table, key); + if (scale) { + gdk_pixbuf_ref(scale); + g_string_free(key, TRUE); + return scale; + } + } + if(buddy || chat) { GaimAccount *account; GaimPlugin *prpl; @@ -2769,75 +2879,43 @@ } } - if(buddy) { - GaimConversation *conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, - gaim_buddy_get_name(buddy), - gaim_buddy_get_account(buddy)); - if(conv != NULL) { - GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); - if(gtkconv != NULL && gaim_gtkconv_is_hidden(gtkconv)) { - /* add pending emblem */ - if(size == GAIM_STATUS_ICON_SMALL) { - emblems[0].filename="pending"; - } - else { - emblems[3].filename=emblems[2].filename; - emblems[2].filename="pending"; - } - } - } - } - - if(size == GAIM_STATUS_ICON_SMALL) { - scalesize = 15; - /* So that only the se icon will composite */ - emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL; - } - /* Begin Generating Lookup Key */ if (buddy) { + gaim_gtk_blist_update_buddy_status_icon_key(node, size); + g_string_printf(key, "%s", strdup(gtkbuddynode->status_icon_key->str)); + } + /* There are only two options for chat or gaimdude - big or small */ + else if (chat) { + GaimAccount *account; + GaimPlugin *prpl; + GaimPluginProtocolInfo *prpl_info; - if (GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) - g_string_append_printf(key, "%s/login", protoname); - else if (!GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) - g_string_append_printf(key, "%s/logout", protoname); - else - key = g_string_append(key, protoname); + account = chat->account; - presence = gaim_buddy_get_presence(buddy); - if (!GAIM_BUDDY_IS_ONLINE(buddy)) { - key = g_string_append(key, "/off"); - } else if (gaim_presence_is_idle(presence)) { - key = g_string_append(key, "/idle"); - } + prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); + if(!prpl) + return NULL; - if (!gaim_privacy_check(buddy->account, gaim_buddy_get_name(buddy))) { - key = g_string_append(key, "/priv"); - } + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); - if (size == GAIM_STATUS_ICON_SMALL) { - key = g_string_append(key, "/tiny"); + if(prpl_info && prpl_info->list_icon) { + protoname = prpl_info->list_icon(account, NULL); } - - for(i=0; i<4; i++) { - if(emblems[i].filename) { - g_string_append_printf(key, "/%s", emblems[i].filename); - } - } + g_string_append_printf(key, "%s-chat", protoname); } - /* There are only two options for chat or gaimdude - big or small */ - else if (chat && size == GAIM_STATUS_ICON_SMALL) - g_string_append_printf(key, "%s-chat-s", protoname); - else if (chat) - g_string_append_printf(key, "%s-chat", protoname); - else if (size == GAIM_STATUS_ICON_SMALL) - key = g_string_append(key, "gaimdude-s"); else key = g_string_append(key, "gaimdude"); + /* If the icon is small, we do not store this into the status_icon_key + * in the gtkbuddynode. This way we can respect the size value on cache + * lookup. Otherwise, different sized icons could not be stored easily. + */ + if (size == GAIM_STATUS_ICON_SMALL) { + key = g_string_append(key, "/tiny"); + } + /* 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) { @@ -2848,6 +2926,54 @@ /* Create a new composite icon */ + if(buddy) { + GaimAccount *account; + GaimPlugin *prpl; + GaimPluginProtocolInfo *prpl_info; + GaimConversation *conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, + gaim_buddy_get_name(buddy), + gaim_buddy_get_account(buddy)); + + if(conv != NULL) { + GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); + if(gtkconv != NULL && gaim_gtkconv_is_hidden(gtkconv)) { + /* add pending emblem */ + if(size == GAIM_STATUS_ICON_SMALL) { + emblems[0].filename="pending"; + } + else { + emblems[3].filename=emblems[2].filename; + emblems[2].filename="pending"; + } + } + } + account = buddy->account; + + prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); + if(!prpl) + return NULL; + + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); + + if(prpl_info && prpl_info->list_icon) { + protoname = prpl_info->list_icon(account, buddy); + } + if(prpl_info && prpl_info->list_emblems) { + if(gtknode && !gtknode->recent_signonoff) + prpl_info->list_emblems(buddy, &emblems[0].filename, + &emblems[1].filename, &emblems[2].filename, + &emblems[3].filename); + } + } + + if(size == GAIM_STATUS_ICON_SMALL) { + scalesize = 15; + /* So that only the se icon will composite */ + emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL; + } + + + 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) { @@ -2903,7 +3029,7 @@ } if(buddy) { - + presence = gaim_buddy_get_presence(buddy); if (!GAIM_BUDDY_IS_ONLINE(buddy)) gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); else if (gaim_presence_is_idle(presence)) @@ -3309,7 +3435,7 @@ if(conv->account != NULL && conv->name != NULL) { GaimBuddy *buddy = gaim_find_buddy(conv->account, conv->name); if(buddy != NULL) - gaim_gtk_blist_update_buddy(NULL, (GaimBlistNode *)buddy); + gaim_gtk_blist_update_buddy(NULL, (GaimBlistNode *)buddy, TRUE); } if (gtkblist->menutrayicon) { @@ -3997,12 +4123,11 @@ /* 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, FALSE); if (GAIM_BLIST_NODE_IS_BUDDY(node)) - gaim_gtk_blist_update_buddy(list, node); + gaim_gtk_blist_update_buddy(list, node, FALSE); else if (GAIM_BLIST_NODE_IS_CHAT(node)) gaim_gtk_blist_update(list, node); node = gaim_blist_node_next(node, FALSE); @@ -4363,7 +4488,7 @@ -static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node) +static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node, gboolean statusChange) { GaimBuddy *buddy; struct _gaim_gtk_blist_node *gtkparentnode; @@ -4374,7 +4499,10 @@ return; buddy = (GaimBuddy*)node; - + if (statusChange) + gaim_gtk_blist_update_buddy_status_icon_key(node, (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") + ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL)); + /* First things first, update the contact */ gaim_gtk_blist_update_contact(list, node); @@ -4450,7 +4578,7 @@ gaim_gtk_blist_update_contact(list, node); break; case GAIM_BLIST_BUDDY_NODE: - gaim_gtk_blist_update_buddy(list, node); + gaim_gtk_blist_update_buddy(list, node, TRUE); break; case GAIM_BLIST_CHAT_NODE: gaim_gtk_blist_update_chat(list, node); Modified: branches/soc-2006-blist-efficiency/src/gtkblist.h =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkblist.h 2006-07-23 20:38:07 UTC (rev 16552) +++ branches/soc-2006-blist-efficiency/src/gtkblist.h 2006-07-23 21:25:09 UTC (rev 16553) @@ -143,7 +143,7 @@ * Populates a menu with the items shown on the buddy list for a buddy. * * @param menu The menu to populate - * @param buddy The buddy who's menu to get + * @param buddy The buddy whose menu to get * @param sub TRUE if this is a sub-menu, FALSE otherwise */ void gaim_gtk_blist_make_buddy_menu(GtkWidget *menu, GaimBuddy *buddy, gboolean sub); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-07-23 20:38:23
|
Revision: 16552 Author: sadrul Date: 2006-07-23 13:38:07 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16552&view=rev Log Message: ----------- Add a debug window. The scrolling doesn't seem to work properly. I will try to figure out what's wrong with it. Start the request-ui. The ui for request input, choice and action are mostly done. I am not handling multiline input requests yet. It's not too high in my todo-list either. Modified Paths: -------------- trunk/console/Makefile trunk/console/gntgaim.c trunk/console/gntui.c trunk/console/libgnt/gntmain.c Added Paths: ----------- trunk/console/gntdebug.c trunk/console/gntdebug.h trunk/console/gntprefs.c trunk/console/gntprefs.h trunk/console/gntrequest.c trunk/console/gntrequest.h Modified: trunk/console/Makefile =================================================================== --- trunk/console/Makefile 2006-07-23 18:59:17 UTC (rev 16551) +++ trunk/console/Makefile 2006-07-23 20:38:07 UTC (rev 16552) @@ -8,7 +8,10 @@ gntblist.c \ gntconn.c \ gntconv.c \ + gntdebug.c \ gntnotify.c \ + gntprefs.c \ + gntrequest.c \ gntui.c GG_HEADERS = \ @@ -16,7 +19,10 @@ gntblist.h \ gntconn.h \ gntconv.h \ + gntdebug.h \ gntnotify.h \ + gntprefs.h \ + gntrequest.h \ gntui.h GG_OBJECTS = \ @@ -24,7 +30,10 @@ gntblist.o \ gntconn.o \ gntconv.o \ + gntdebug.o \ gntnotify.o \ + gntprefs.o \ + gntrequest.o \ gntui.o all: gntgaim Added: trunk/console/gntdebug.c =================================================================== --- trunk/console/gntdebug.c (rev 0) +++ trunk/console/gntdebug.c 2006-07-23 20:38:07 UTC (rev 16552) @@ -0,0 +1,106 @@ +#include <gnt.h> +#include <gntbox.h> +#include <gnttextview.h> + +#include "gntdebug.h" +#include "gntgaim.h" + +#include <stdio.h> +#include <string.h> + +static struct +{ + GntWidget *window; + GntWidget *tview; +} debug; + +static gboolean +debug_window_kpress_cb(GntWidget *wid, const char *key, GntTextView *view) +{ + if (key[0] == 27) + { + /* XXX: This doesn't seem to always work */ + if (strcmp(key+1, GNT_KEY_DOWN) == 0) + gnt_text_view_scroll(view, 1); + else if (strcmp(key+1, GNT_KEY_UP) == 0) + gnt_text_view_scroll(view, -1); + else if (strcmp(key+1, GNT_KEY_PGDOWN) == 0) + gnt_text_view_scroll(view, wid->priv.height - 2); + else if (strcmp(key+1, GNT_KEY_PGUP) == 0) + gnt_text_view_scroll(view, -(wid->priv.height - 2)); + else + return FALSE; + return TRUE; + } + return FALSE; +} + +static void +gg_debug_print(GaimDebugLevel level, const char *category, + const char *args) +{ + if (debug.window == NULL) + fprintf(stderr, "%s: %s\n", category, args); + else + { + GntTextFormatFlags flag = GNT_TEXT_FLAG_NORMAL; + + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), + category, GNT_TEXT_FLAG_BOLD); + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), + ": ", GNT_TEXT_FLAG_BOLD); + + switch (level) + { + case GAIM_DEBUG_WARNING: + flag |= GNT_TEXT_FLAG_UNDERLINE; + case GAIM_DEBUG_ERROR: + case GAIM_DEBUG_FATAL: + flag |= GNT_TEXT_FLAG_BOLD; + break; + default: + break; + } + + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), args, flag); + gnt_text_view_next_line(GNT_TEXT_VIEW(debug.tview)); + gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0); + + g_signal_connect(G_OBJECT(debug.window), "key_pressed", G_CALLBACK(debug_window_kpress_cb), debug.tview); + } +} + +static GaimDebugUiOps uiops = +{ + gg_debug_print, +}; + +GaimDebugUiOps *gg_debug_get_ui_ops() +{ + return &uiops; +} + +void gg_debug_window_show() +{ + if (debug.window == NULL) + { + debug.window = gnt_vbox_new(FALSE); + gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE); + gnt_box_set_title(GNT_BOX(debug.window), _("Debug Window")); + + debug.tview = gnt_text_view_new(); + gnt_box_add_widget(GNT_BOX(debug.window), debug.tview); + } + + gnt_widget_show(debug.window); +} + +void gg_debug_init() +{ + gg_debug_window_show(); +} + +void gg_debug_uninit() +{ +} + Property changes on: trunk/console/gntdebug.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntdebug.h =================================================================== --- trunk/console/gntdebug.h (rev 0) +++ trunk/console/gntdebug.h 2006-07-23 20:38:07 UTC (rev 16552) @@ -0,0 +1,8 @@ +#include "debug.h" + +GaimDebugUiOps *gg_debug_get_ui_ops(); + +void gg_debug_init(); + +void gg_debug_uninit(); + Property changes on: trunk/console/gntdebug.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-07-23 18:59:17 UTC (rev 16551) +++ trunk/console/gntgaim.c 2006-07-23 20:38:07 UTC (rev 16552) @@ -15,18 +15,25 @@ #include "util.h" #include "whiteboard.h" +#include "gntdebug.h" #include "gntgaim.h" +#include "gntprefs.h" #include "gntui.h" #define _GNU_SOURCE #include <getopt.h> -/* Anything IO-related is directly copied from gtkgaim's source tree */ +static void +debug_init() +{ + gg_debug_init(); + gaim_debug_set_ui_ops(gg_debug_get_ui_ops()); +} static GaimCoreUiOps core_ops = { - NULL, /*gaim_gtk_prefs_init,*/ - NULL, /*debug_init,*/ + gg_prefs_init, + debug_init, NULL, /*gaim_gtk_ui_init,*/ NULL, /*gaim_gtk_quit*/ }; @@ -37,6 +44,8 @@ return &core_ops; } +/* Anything IO-related is directly copied from gtkgaim's source tree */ + #define GAIM_GTK_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) #define GAIM_GTK_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) @@ -293,6 +302,8 @@ /* XXX: Don't puke */ freopen(".error", "w", stderr); + gnt_init(); + /* Initialize the libgaim stuff */ if (!init_libgaim(argc, argv)) return 0; Added: trunk/console/gntprefs.c =================================================================== --- trunk/console/gntprefs.c (rev 0) +++ trunk/console/gntprefs.c 2006-07-23 20:38:07 UTC (rev 16552) @@ -0,0 +1,14 @@ +#include <prefs.h> + +#include "gntprefs.h" +#include "gntgaim.h" + +void gg_prefs_init() +{ + gaim_prefs_add_none("/gaim"); + gaim_prefs_add_none("/gaim/gnt"); + + gaim_prefs_add_none("/gaim/gnt/plugins"); + gaim_prefs_add_string_list("/gaim/gnt/plugins/loaded", NULL); +} + Property changes on: trunk/console/gntprefs.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntprefs.h =================================================================== --- trunk/console/gntprefs.h (rev 0) +++ trunk/console/gntprefs.h 2006-07-23 20:38:07 UTC (rev 16552) @@ -0,0 +1,2 @@ +void gg_prefs_init(); + Property changes on: trunk/console/gntprefs.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntrequest.c =================================================================== --- trunk/console/gntrequest.c (rev 0) +++ trunk/console/gntrequest.c 2006-07-23 20:38:07 UTC (rev 16552) @@ -0,0 +1,218 @@ +#include <gnt.h> +#include <gntbox.h> +#include <gntbutton.h> +#include <gntcombobox.h> +#include <gntentry.h> +#include <gntlabel.h> + +#include "gntrequest.h" + +static GntWidget * +setup_request_window(const char *title, const char *primary, + const char *secondary) +{ + GntWidget *window; + + window = gnt_vbox_new(FALSE); + gnt_box_set_toplevel(GNT_BOX(window), TRUE); + gnt_box_set_title(GNT_BOX(window), title); + gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); + + if (primary) + gnt_box_add_widget(GNT_BOX(window), + gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); + if (secondary) + gnt_box_add_widget(GNT_BOX(window), gnt_label_new(secondary)); + + return window; +} + +static GntWidget * +setup_button_box(gpointer userdata, gpointer cb, gpointer data, ...) +{ + GntWidget *box, *button; + va_list list; + const char *text; + gpointer callback; + + box = gnt_hbox_new(TRUE); + + va_start(list, data); + + while ((text = va_arg(list, const char *))) + { + callback = va_arg(list, gpointer); + button = gnt_button_new(text); + gnt_box_add_widget(GNT_BOX(box), button); + g_object_set_data(G_OBJECT(button), "activate-callback", callback); + g_object_set_data(G_OBJECT(button), "activate-userdata", userdata); + g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); + } + + va_end(list); + return box; +} + +static void +notify_input_cb(GntWidget *button, GntWidget *entry) +{ + GaimRequestInputCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); + gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); + const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); + + if (callback) + callback(data, text); + + while (button->parent) + button = button->parent; + + gaim_request_close(GAIM_REQUEST_INPUT, button); +} + +static void * +gg_request_input(const char *title, const char *primary, + const char *secondary, const char *default_value, + gboolean multiline, gboolean masked, gchar *hint, + const char *ok_text, GCallback ok_cb, + const char *cancel_text, GCallback cancel_cb, + void *user_data) +{ + GntWidget *window, *box, *entry; + + window = setup_request_window(title, primary, secondary); + + entry = gnt_entry_new(default_value); + if (masked) + gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); + gnt_box_add_widget(GNT_BOX(window), entry); + + box = setup_button_box(user_data, notify_input_cb, entry, + ok_text, ok_cb, cancel_text, cancel_cb, NULL); + gnt_box_add_widget(GNT_BOX(window), box); + + gnt_widget_show(window); + + return window; +} + +static void +gg_close_request(GaimRequestType type, gpointer ui_handle) +{ + GntWidget *widget = GNT_WIDGET(ui_handle); + while (widget->parent) + widget = widget->parent; + gnt_widget_destroy(widget); +} + +static void +request_choice_cb(GntWidget *button, GntComboBox *combo) +{ + GaimRequestChoiceCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); + gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); + int choice = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))) - 1; + + if (callback) + callback(data, choice); + + while (button->parent) + button = button->parent; + + gaim_request_close(GAIM_REQUEST_INPUT, button); +} + +static void * +gg_request_choice(const char *title, const char *primary, + const char *secondary, unsigned int default_value, + const char *ok_text, GCallback ok_cb, + const char *cancel_text, GCallback cancel_cb, + void *user_data, va_list choices) +{ + GntWidget *window, *combo, *box; + const char *text; + int val; + + window = setup_request_window(title, primary, secondary); + + combo = gnt_combo_box_new(); + gnt_box_add_widget(GNT_BOX(window), combo); + while ((text = va_arg(choices, const char *))) + { + val = va_arg(choices, int); + gnt_combo_box_add_data(GNT_COMBO_BOX(combo), GINT_TO_POINTER(val + 1), text); + } + gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), GINT_TO_POINTER(default_value + 1)); + + box = setup_button_box(user_data, request_choice_cb, combo, + ok_text, ok_cb, cancel_text, cancel_cb, NULL); + gnt_box_add_widget(GNT_BOX(window), box); + + gnt_widget_show(window); + + return window; +} + +static void +request_action_cb(GntWidget *button, GntWidget *window) +{ + GaimRequestActionCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); + gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); + int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "activate-id")); + + callback(data, id); + + gaim_request_close(GAIM_REQUEST_ACTION, window); +} + +static void* +gg_request_action(const char *title, const char *primary, + const char *secondary, unsigned int default_value, + void *user_data, size_t actioncount, + va_list actions) +{ + GntWidget *window, *box, *button; + int i; + + window = setup_request_window(title, primary, secondary); + + box = gnt_hbox_new(TRUE); + gnt_box_add_widget(GNT_BOX(window), box); + for (i = 0; i < actioncount; i++) + { + const char *text = va_arg(actions, const char *); + GaimRequestActionCb callback = va_arg(actions, GaimRequestActionCb); + + button = gnt_button_new(text); + gnt_box_add_widget(GNT_BOX(box), button); + + g_object_set_data(G_OBJECT(button), "activate-callback", callback); + g_object_set_data(G_OBJECT(button), "activate-userdata", user_data); + g_object_set_data(G_OBJECT(button), "activate-id", GINT_TO_POINTER(i)); + g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(request_action_cb), window); + } + + gnt_widget_show(window); + + return window; +} + +static GaimRequestUiOps uiops = +{ + .request_input = gg_request_input, + .close_request = gg_close_request, + .request_choice = gg_request_choice, + .request_action = gg_request_action, +}; + +GaimRequestUiOps *gg_request_get_ui_ops() +{ + return &uiops; +} + +void gg_request_init() +{ +} + +void gg_request_uninit() +{ +} + Property changes on: trunk/console/gntrequest.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntrequest.h =================================================================== --- trunk/console/gntrequest.h (rev 0) +++ trunk/console/gntrequest.h 2006-07-23 20:38:07 UTC (rev 16552) @@ -0,0 +1,8 @@ +#include "request.h" + +GaimRequestUiOps *gg_request_get_ui_ops(); + +void gg_request_init(); + +void gg_request_uninit(); + Property changes on: trunk/console/gntrequest.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/console/gntui.c =================================================================== --- trunk/console/gntui.c 2006-07-23 18:59:17 UTC (rev 16551) +++ trunk/console/gntui.c 2006-07-23 20:38:07 UTC (rev 16552) @@ -5,6 +5,7 @@ #include "gntconn.h" #include "gntconv.h" #include "gntnotify.h" +#include "gntrequest.h" void init_gnt_ui() { @@ -31,6 +32,9 @@ gg_notify_init(); gaim_notify_set_ui_ops(gg_notify_get_ui_ops()); + gg_request_init(); + gaim_request_set_ui_ops(gg_request_get_ui_ops()); + #ifdef STANDALONE gnt_main(); @@ -49,6 +53,9 @@ gaim_notify_set_ui_ops(NULL); gg_notify_uninit(); + gaim_request_set_ui_ops(NULL); + gg_request_uninit(); + gnt_quit(); #endif } Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-07-23 18:59:17 UTC (rev 16551) +++ trunk/console/libgnt/gntmain.c 2006-07-23 20:38:07 UTC (rev 16552) @@ -524,7 +524,12 @@ void gnt_init() { - GIOChannel *channel = g_io_channel_unix_new(0); + static GIOChannel *channel = NULL; + + if (channel) + return; + + channel = g_io_channel_unix_new(0); g_io_channel_set_encoding(channel, NULL, NULL); g_io_channel_set_buffered(channel, FALSE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-23 18:59:19
|
Revision: 16551 Author: thekingant Date: 2006-07-23 11:59:17 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16551&view=rev Log Message: ----------- Backport SVN revision #16550 from HEAD to v2_0_0 Original commit message: Only set an account's status to the default status when enabling it, not when disabling it. Fixes a very minor weirdness. ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16550&view=rev Modified Paths: -------------- branches/v2_0_0/src/gtkaccount.c Modified: branches/v2_0_0/src/gtkaccount.c =================================================================== --- branches/v2_0_0/src/gtkaccount.c 2006-07-23 18:58:59 UTC (rev 16550) +++ branches/v2_0_0/src/gtkaccount.c 2006-07-23 18:59:17 UTC (rev 16551) @@ -2221,9 +2221,15 @@ COLUMN_ENABLED, &enabled, -1); - /* Set the statuses for this account to the current status */ - saved_status = gaim_savedstatus_get_current(); - gaim_savedstatus_activate_for_account(saved_status, account); + /* + * If we just enabled the account, then set the statuses + * to the current status. + */ + if (!enabled) + { + saved_status = gaim_savedstatus_get_current(); + gaim_savedstatus_activate_for_account(saved_status, account); + } gaim_account_set_enabled(account, GAIM_GTK_UI, !enabled); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-23 18:59:02
|
Revision: 16550 Author: thekingant Date: 2006-07-23 11:58:59 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16550&view=rev Log Message: ----------- Only set an account's status to the default status when enabling it, not when disabling it. Fixes a very minor weirdness. Modified Paths: -------------- trunk/src/gtkaccount.c Modified: trunk/src/gtkaccount.c =================================================================== --- trunk/src/gtkaccount.c 2006-07-23 18:57:28 UTC (rev 16549) +++ trunk/src/gtkaccount.c 2006-07-23 18:58:59 UTC (rev 16550) @@ -2221,9 +2221,15 @@ COLUMN_ENABLED, &enabled, -1); - /* Set the statuses for this account to the current status */ - saved_status = gaim_savedstatus_get_current(); - gaim_savedstatus_activate_for_account(saved_status, account); + /* + * If we just enabled the account, then set the statuses + * to the current status. + */ + if (!enabled) + { + saved_status = gaim_savedstatus_get_current(); + gaim_savedstatus_activate_for_account(saved_status, account); + } gaim_account_set_enabled(account, GAIM_GTK_UI, !enabled); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-23 18:57:34
|
Revision: 16549 Author: thekingant Date: 2006-07-23 11:57:28 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16549&view=rev Log Message: ----------- Backport SVN revision #16548 from HEAD to v2_0_0 Original commit message: Minor cleanup ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16548&view=rev Modified Paths: -------------- branches/v2_0_0/src/protocols/jabber/jabber.c branches/v2_0_0/src/protocols/jabber/message.c branches/v2_0_0/src/protocols/simple/simple.c Modified: branches/v2_0_0/src/protocols/jabber/jabber.c =================================================================== --- branches/v2_0_0/src/protocols/jabber/jabber.c 2006-07-23 18:57:08 UTC (rev 16548) +++ branches/v2_0_0/src/protocols/jabber/jabber.c 2006-07-23 18:57:28 UTC (rev 16549) @@ -370,7 +370,7 @@ int len; static char buf[4096]; - if(!g_list_find(gaim_connections_get_all(), gc)) + if(!GAIM_CONNECTION_IS_VALID(gc)) return; if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { @@ -486,7 +486,7 @@ JabberStream *js; gc = data; - if (!g_list_find(gaim_connections_get_all(), gc)) + if (!GAIM_CONNECTION_IS_VALID(gc)) { /* This connection has been closed */ g_free(resp); @@ -500,7 +500,7 @@ g_free(resp); } else { jabber_login_connect(js, js->user->domain, - gaim_account_get_int(js->gc->account, "port", 0)); + gaim_account_get_int(js->gc->account, "port", 5222)); } } Modified: branches/v2_0_0/src/protocols/jabber/message.c =================================================================== --- branches/v2_0_0/src/protocols/jabber/message.c 2006-07-23 18:57:08 UTC (rev 16548) +++ branches/v2_0_0/src/protocols/jabber/message.c 2006-07-23 18:57:28 UTC (rev 16549) @@ -245,9 +245,6 @@ const char *type; xmlnode *child; - if(strcmp(packet->name, "message")) - return; - jm = g_new0(JabberMessage, 1); jm->js = js; jm->sent = time(NULL); Modified: branches/v2_0_0/src/protocols/simple/simple.c =================================================================== --- branches/v2_0_0/src/protocols/simple/simple.c 2006-07-23 18:57:08 UTC (rev 16548) +++ branches/v2_0_0/src/protocols/simple/simple.c 2006-07-23 18:57:28 UTC (rev 16549) @@ -1535,7 +1535,7 @@ int port; gc = data; - if (!g_list_find(gaim_connections_get_all(), gc)) + if (!GAIM_CONNECTION_IS_VALID(gc)) { /* This connection has been closed */ g_free(resp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-23 18:57:12
|
Revision: 16548 Author: thekingant Date: 2006-07-23 11:57:08 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16548&view=rev Log Message: ----------- Minor cleanup Modified Paths: -------------- trunk/src/conversation.c trunk/src/protocols/jabber/jabber.c trunk/src/protocols/jabber/message.c trunk/src/protocols/simple/simple.c Modified: trunk/src/conversation.c =================================================================== --- trunk/src/conversation.c 2006-07-23 12:19:10 UTC (rev 16547) +++ trunk/src/conversation.c 2006-07-23 18:57:08 UTC (rev 16548) @@ -1440,7 +1440,7 @@ g_list_free(flags2); } -int +static int gaim_conv_chat_cb_compare(GaimConvChatBuddy *a, GaimConvChatBuddy *b) { GaimConvChatBuddyFlags f1 = 0, f2 = 0; Modified: trunk/src/protocols/jabber/jabber.c =================================================================== --- trunk/src/protocols/jabber/jabber.c 2006-07-23 12:19:10 UTC (rev 16547) +++ trunk/src/protocols/jabber/jabber.c 2006-07-23 18:57:08 UTC (rev 16548) @@ -370,7 +370,7 @@ int len; static char buf[4096]; - if(!g_list_find(gaim_connections_get_all(), gc)) + if(!GAIM_CONNECTION_IS_VALID(gc)) return; if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { @@ -486,7 +486,7 @@ JabberStream *js; gc = data; - if (!g_list_find(gaim_connections_get_all(), gc)) + if (!GAIM_CONNECTION_IS_VALID(gc)) { /* This connection has been closed */ g_free(resp); @@ -500,7 +500,7 @@ g_free(resp); } else { jabber_login_connect(js, js->user->domain, - gaim_account_get_int(js->gc->account, "port", 0)); + gaim_account_get_int(js->gc->account, "port", 5222)); } } Modified: trunk/src/protocols/jabber/message.c =================================================================== --- trunk/src/protocols/jabber/message.c 2006-07-23 12:19:10 UTC (rev 16547) +++ trunk/src/protocols/jabber/message.c 2006-07-23 18:57:08 UTC (rev 16548) @@ -245,9 +245,6 @@ const char *type; xmlnode *child; - if(strcmp(packet->name, "message")) - return; - jm = g_new0(JabberMessage, 1); jm->js = js; jm->sent = time(NULL); Modified: trunk/src/protocols/simple/simple.c =================================================================== --- trunk/src/protocols/simple/simple.c 2006-07-23 12:19:10 UTC (rev 16547) +++ trunk/src/protocols/simple/simple.c 2006-07-23 18:57:08 UTC (rev 16548) @@ -1535,7 +1535,7 @@ int port; gc = data; - if (!g_list_find(gaim_connections_get_all(), gc)) + if (!GAIM_CONNECTION_IS_VALID(gc)) { /* This connection has been closed */ g_free(resp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <may...@us...> - 2006-07-23 12:19:21
|
Revision: 16547 Author: mayuan2006 Date: 2006-07-23 05:19:10 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16547&view=rev Log Message: ----------- initial Good version, Can see others' online and offline status. Can chat. Some bug exist! Committed by MaYuan<may...@gm...> Modified Paths: -------------- branches/soc-2006-msnp13/src/protocols/msn/contact.c branches/soc-2006-msnp13/src/protocols/msn/group.h branches/soc-2006-msnp13/src/protocols/msn/notification.c branches/soc-2006-msnp13/src/protocols/msn/session.c branches/soc-2006-msnp13/src/protocols/msn/user.c branches/soc-2006-msnp13/src/protocols/msn/userlist.c Modified: branches/soc-2006-msnp13/src/protocols/msn/contact.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-07-23 09:19:12 UTC (rev 16546) +++ branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-07-23 12:19:10 UTC (rev 16547) @@ -28,6 +28,7 @@ #include "soap.h" #include "contact.h" #include "xmlnode.h" +#include "group.h" /*new a contact*/ MsnContact * @@ -220,6 +221,7 @@ xmlnode *groups,*group,*groupname,*groupId,*groupInfo; xmlnode *contacts,*contactNode,*contactId,*contactInfo,*contactType,*passportName,*displayName,*groupIds,*guid; xmlnode *ab; + char *group_name,*group_id; session = contact->session; gaim_debug_misc("xml","parse addressbook:{%s}\nsize:%d\n",contact->soapconn->body,contact->soapconn->body_len); @@ -236,44 +238,65 @@ gaim_debug_misc("xml","response{%p},name:%s\n",response,response->name); result =xmlnode_get_child(response,"ABFindAllResult"); gaim_debug_misc("xml","result{%p},name:%s\n",result,result->name); + + /*Process Group List*/ groups =xmlnode_get_child(result,"groups"); for(group = xmlnode_get_child(groups, "Group"); group; group = xmlnode_get_next_twin(group)){ - char * name,*group_id; - groupId = xmlnode_get_child(group,"groupId"); - group_id = xmlnode_get_data(groupId); - groupInfo = xmlnode_get_child(group,"groupInfo"); - groupname = xmlnode_get_child(groupInfo,"name"); - name = xmlnode_get_data(groupname); + groupId = xmlnode_get_child(group,"groupId"); + group_id = xmlnode_get_data(groupId); + groupInfo = xmlnode_get_child(group,"groupInfo"); + groupname = xmlnode_get_child(groupInfo,"name"); + group_name = xmlnode_get_data(groupname); - msn_group_new(session->userlist, group_id, name); + msn_group_new(session->userlist, group_id, group_name); - if (group_id == NULL) - /* Group of ungroupped buddies */ - continue; + if (group_id == NULL){ + /* Group of ungroupped buddies */ + continue; + } - if ((gaim_find_group(name)) == NULL){ - GaimGroup *g = gaim_group_new(name); - gaim_blist_add_group(g, NULL); - } + gaim_debug_misc("MsnContact","group_id:%s name:%s\n",group_id,group_name); + if ((gaim_find_group(group_name)) == NULL){ + GaimGroup *g = gaim_group_new(group_name); + gaim_blist_add_group(g, NULL); + } + } + /*add a default No group to set up the no group Membership*/ + group_id = g_strdup(MSN_INDIVIDUALS_GROUP_ID); + group_name = g_strdup(MSN_INDIVIDUALS_GROUP_NAME); + msn_group_new(session->userlist,group_id , group_name); + if (group_id != NULL){ + gaim_debug_misc("MsnContact","group_id:%s name:%s,value:%d\n",group_id,group_name,*group_name=='\0'); + if ((gaim_find_group(group_name)) == NULL){ + GaimGroup *g = gaim_group_new(group_name); + gaim_blist_add_group(g, NULL); + } + } + g_free(group_name); + g_free(group_id); - gaim_debug_misc("group","name:%s,Id:{%s}\n",name,group_id); + /*add a default No group to set up the no group Membership*/ + group_id = g_strdup(MSN_NON_IM_GROUP_ID); + group_name = g_strdup(MSN_NON_IM_GROUP_NAME); + msn_group_new(session->userlist,group_id , group_name); + if (group_id != NULL){ + gaim_debug_misc("MsnContact","group_id:%s name:%s,value:%d\n",group_id,group_name,*group_name=='\0'); + if ((gaim_find_group(group_name)) == NULL){ + GaimGroup *g = gaim_group_new(group_name); + gaim_blist_add_group(g, NULL); + } } + g_free(group_name); + g_free(group_id); + /*Process contact List*/ contacts =xmlnode_get_child(result,"contacts"); for(contactNode = xmlnode_get_child(contacts, "Contact"); contactNode; contactNode = xmlnode_get_next_twin(contactNode)){ MsnUser *user; - xmlnode *messengerEnableNode; char *passport,*Name,*uid,*type; - char *messengerEnable; - messengerEnableNode = xmlnode_get_child(contactNode,"isMessengerEnabled"); - messengerEnable = xmlnode_get_data(messengerEnableNode); - if(!g_strcasecmp(messengerEnable,"false")){ - continue; - } - contactId= xmlnode_get_child(contactNode,"contactId"); uid = xmlnode_get_data(contactId); @@ -305,38 +328,42 @@ msn_user_set_type(user,msn_get_user_type(type)); user->list_op |= 1; + gaim_debug_misc("MsnContact","\n"); groupIds = xmlnode_get_child(contactInfo,"groupIds"); if(groupIds){ for(guid = xmlnode_get_child(groupIds, "guid");guid; guid = xmlnode_get_next_twin(guid)){ - char *group_id; - group_id = xmlnode_get_data(guid); msn_user_add_group_id(user,group_id); gaim_debug_misc("contact","guid:%s\n",group_id); } }else{ + group_id = g_strdup(MSN_INDIVIDUALS_GROUP_ID); + msn_user_add_group_id(user,group_id); + g_free(group_id); +#if 0 + /*not in any group,Then set default group*/ char *name,*group_id; name = g_strdup(MSN_INDIVIDUALS_GROUP_NAME); group_id = g_strdup(MSN_INDIVIDUALS_GROUP_ID); + gaim_debug_misc("MsnContact","group_id:%s name:%s\n",group_id,name); msn_user_add_group_id(user,group_id); msn_group_new(session->userlist, group_id, name); - if (group_id == NULL) - /* Group of ungroupped buddies */ - continue; - - if ((gaim_find_group(name)) == NULL){ + if (group_id != NULL){ + gaim_debug_misc("MsnContact","group_id:%s name:%s,value:%d\n",group_id,name,*name=='\0'); + if ((gaim_find_group(name)) == NULL){ GaimGroup *g = gaim_group_new(name); gaim_blist_add_group(g, NULL); + } } gaim_debug_misc("contact","guid is NULL\n"); g_free(name); g_free(group_id); - +#endif } } Modified: branches/soc-2006-msnp13/src/protocols/msn/group.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/group.h 2006-07-23 09:19:12 UTC (rev 16546) +++ branches/soc-2006-msnp13/src/protocols/msn/group.h 2006-07-23 12:19:10 UTC (rev 16547) @@ -40,9 +40,12 @@ #define MSN_GROUP_IDS "<guid>9e57e654-59f0-44d1-aedc-0a7500b7e51f</guid>" #define MSN_DELETE_GROUP_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>Timer</PartnerScenario></ABApplicationHeader><ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ManagedGroupRequest>false</ManagedGroupRequest></ABAuthHeader></soap:Header><soap:Body><ABGroupDelete xmlns=\"http://www.msn.com/webservices/AddressBook\"><abId>00000000-0000-0000-0000-000000000000</abId><groupFilter><groupIds>%s</groupIds></groupFilter></ABGroupDelete></soap:Body></soap:Envelope>" -#define MSN_INDIVIDUALS_GROUP_ID "0" +#define MSN_INDIVIDUALS_GROUP_ID "123" #define MSN_INDIVIDUALS_GROUP_NAME "Other Contacts" +#define MSN_NON_IM_GROUP_ID "email" +#define MSN_NON_IM_GROUP_NAME "Non-IM Contacts" + /** * A group. */ Modified: branches/soc-2006-msnp13/src/protocols/msn/notification.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-07-23 09:19:12 UTC (rev 16546) +++ branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-07-23 12:19:10 UTC (rev 16547) @@ -713,6 +713,7 @@ GaimConnection *gc; MsnUser *user; MsnObject *msnobj; + int wlmclient; const char *state, *passport, *friendly; session = cmdproc->session; @@ -721,7 +722,8 @@ state = cmd->params[1]; passport = cmd->params[2]; - friendly = gaim_url_decode(cmd->params[3]); + wlmclient = atoi(cmd->params[3]); + friendly = gaim_url_decode(cmd->params[4]); user = msn_userlist_find_user(session->userlist, passport); @@ -729,8 +731,8 @@ msn_user_set_friendly_name(user, friendly); - if (session->protocol_ver >= 9 && cmd->param_count == 6){ - msnobj = msn_object_new_from_string(gaim_url_decode(cmd->params[5])); + if (session->protocol_ver >= 9 && cmd->param_count == 7){ + msnobj = msn_object_new_from_string(gaim_url_decode(cmd->params[6])); msn_user_set_object(user, msnobj); } @@ -762,6 +764,7 @@ MsnUser *user; MsnObject *msnobj; int clientid; + int wlmclient; const char *state, *passport, *friendly; session = cmdproc->session; @@ -770,7 +773,8 @@ state = cmd->params[0]; passport = cmd->params[1]; - friendly = gaim_url_decode(cmd->params[2]); + wlmclient = atoi(cmd->params[2]); + friendly = gaim_url_decode(cmd->params[3]); user = msn_userlist_find_user(session->userlist, passport); @@ -779,15 +783,15 @@ msn_user_set_friendly_name(user, friendly); if (session->protocol_ver >= 9){ - if (cmd->param_count == 5){ - msnobj = msn_object_new_from_string(gaim_url_decode(cmd->params[4])); + if (cmd->param_count == 6){ + msnobj = msn_object_new_from_string(gaim_url_decode(cmd->params[5])); msn_user_set_object(user, msnobj); }else{ msn_user_set_object(user, NULL); } } - clientid = atoi(cmd->params[3]); + clientid = atoi(cmd->params[4]); user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE); msn_user_set_state(user, state); Modified: branches/soc-2006-msnp13/src/protocols/msn/session.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/session.c 2006-07-23 09:19:12 UTC (rev 16546) +++ branches/soc-2006-msnp13/src/protocols/msn/session.c 2006-07-23 12:19:10 UTC (rev 16547) @@ -234,12 +234,15 @@ /* The core used to use msn_add_buddy to add all buddies before * being logged in. This no longer happens, so we manually iterate * over the whole buddy list to identify sync issues. */ - - for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { + for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next){ GaimGroup *group = (GaimGroup *)gnode; const char *group_name = group->name; if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) continue; + if(!g_strcasecmp(group_name, MSN_INDIVIDUALS_GROUP_NAME) + || !g_strcasecmp(group_name,MSN_NON_IM_GROUP_NAME)){ + continue; + } for(cnode = gnode->child; cnode; cnode = cnode->next) { if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) continue; @@ -248,7 +251,7 @@ if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (GaimBuddy *)bnode; - if(b->account == gc->account) { + if(b->account == gc->account){ MsnUser *remote_user; gboolean found = FALSE; @@ -256,11 +259,14 @@ remote_user = msn_userlist_find_user(session->userlist, b->name); if ((remote_user != NULL) && (remote_user->list_op & MSN_LIST_FL_OP)){ - char *group_id; + const char *group_id; GList *l; group_id = msn_userlist_find_group_id(remote_user->userlist, group_name); + if(group_id == NULL){ + continue; + } for (l = remote_user->group_ids; l != NULL; l = l->next){ if (!g_strcasecmp(group_id ,l->data)){ Modified: branches/soc-2006-msnp13/src/protocols/msn/user.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/user.c 2006-07-23 09:19:12 UTC (rev 16546) +++ branches/soc-2006-msnp13/src/protocols/msn/user.c 2006-07-23 12:19:10 UTC (rev 16547) @@ -261,9 +261,11 @@ group_name = msn_userlist_find_group_name(userlist, id); + gaim_debug_info("User","group id:%s,name:%s,user:%s\n",id,group_name,passport); + g = gaim_find_group(group_name); - if ((id == 0) && (g == NULL)){ + if ((id == NULL) && (g == NULL)){ g = gaim_group_new(group_name); gaim_blist_add_group(g, NULL); } Modified: branches/soc-2006-msnp13/src/protocols/msn/userlist.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/userlist.c 2006-07-23 09:19:12 UTC (rev 16546) +++ branches/soc-2006-msnp13/src/protocols/msn/userlist.c 2006-07-23 12:19:10 UTC (rev 16547) @@ -468,11 +468,13 @@ for (l = userlist->users; l != NULL; l = l->next){ MsnUser *user = (MsnUser *)l->data; - +// gaim_debug_info("MsnUserList","user passport:%s,passport:%s\n",user->passport,passport); g_return_val_if_fail(user->passport != NULL, NULL); - if (!g_strcasecmp(passport, user->passport)) + if (!g_strcasecmp(passport, user->passport)){ +// gaim_debug_info("MsnUserList","return:%p\n",user); return user; + } } return NULL; @@ -516,11 +518,10 @@ g_return_val_if_fail(userlist != NULL, NULL); g_return_val_if_fail(name != NULL, NULL); - for (l = userlist->groups; l != NULL; l = l->next) - { + for (l = userlist->groups; l != NULL; l = l->next){ MsnGroup *group = l->data; - if ((group->name != NULL) && !g_ascii_strcasecmp(name, group->name)) + if ((group->name != NULL) && !g_strcasecmp(name, group->name)) return group; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <may...@us...> - 2006-07-23 09:19:29
|
Revision: 16546 Author: mayuan2006 Date: 2006-07-23 02:19:12 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16546&view=rev Log Message: ----------- can login sucessfully Other's can see the online status Can chat with gaim. Some bug exist! will crash Some Problem existed on group management committed by MaYuan<may...@gm...> Modified Paths: -------------- 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/contact.c branches/soc-2006-msnp13/src/protocols/msn/group.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/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/state.c branches/soc-2006-msnp13/src/protocols/msn/state.h branches/soc-2006-msnp13/src/protocols/msn/userlist.c Modified: branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c 2006-07-23 09:19:12 UTC (rev 16546) @@ -89,8 +89,7 @@ tmp = (incoming) ? 'S' : 'C'; - if ((show[len - 1] == '\n') && (show[len - 2] == '\r')) - { + if ((show[len - 1] == '\n') && (show[len - 2] == '\r')){ show[len - 2] = '\0'; } @@ -134,7 +133,7 @@ } msn_servconn_write(servconn, data, len); - gaim_debug_info("<<","%s",data); + gaim_debug_info("<<","%s\n",data); g_free(data); } Modified: branches/soc-2006-msnp13/src/protocols/msn/command.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/command.c 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/command.c 2006-07-23 09:19:12 UTC (rev 16546) @@ -46,6 +46,7 @@ { if( (!strcmp(str,"ADL")) || (!strcmp(str,"GCF")) || + (!strcmp(str,"SG")) || (!strcmp(str,"MSG")) || (!strcmp(str,"RML")) || (!strcmp(str,"UBX")) || @@ -62,11 +63,13 @@ int msn_get_payload_position(char *str) { /*because MSG has "MSG hotmail hotmail [payload length]"*/ - if(!(strcmp(str,"MSG"))){ + if(!(strcmp(str,"MSG"))|| (!strcmp(str,"UBX")) ){ return 2; } + return 1; } + /* * set command Payload length */ @@ -76,11 +79,14 @@ char * param; if(msn_check_payload_cmd(cmd->command)){ + param = cmd->params[msn_get_payload_position(cmd->command)]; +#if 0 if(!(strcmp(cmd->command,"MSG"))){ param = cmd->params[2]; }else{ param = cmd->params[1]; } +#endif cmd->payload_len = is_num(param) ? atoi(param) : 0; }else{ cmd->payload_len = 0; Modified: branches/soc-2006-msnp13/src/protocols/msn/contact.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-07-23 09:19:12 UTC (rev 16546) @@ -90,10 +90,8 @@ return MSN_LIST_AL_OP; }else if(!strcmp(role,"Block")){ return MSN_LIST_BL_OP; - }else if(!strcmp(role,"Reverse")){ - return MSN_LIST_RL_OP; - }else if(!strcmp(role,"Forward")){ - return MSN_LIST_FL_OP; +// }else if(!strcmp(role,"Reverse")){ +// return MSN_LIST_RL_OP; } return 0; } @@ -120,7 +118,7 @@ xmlnode *membershipnode,*members,*member,*passportNode,*role; session = contact->session; - gaim_debug_misc("xml","parse contact list:{%s}\nsize:%d\n",contact->soapconn->body,contact->soapconn->body_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); @@ -144,22 +142,33 @@ 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)); list_op = msn_get_memberrole(xmlnode_get_data(role)); gaim_debug_misc("memberrole","role:%s,list_op:%d\n",xmlnode_get_data(role),list_op); members = xmlnode_get_child(membershipnode,"Members"); for(member = xmlnode_get_child(members, "Member"); member; member = xmlnode_get_next_twin(member)){ - passportNode = xmlnode_get_child(member,"PassportName"); - passport = xmlnode_get_data(passportNode); - gaim_debug_misc("Passport","name:%s\n",passport); - user = msn_userlist_find_user(session->userlist, passport); - if (user == NULL){ - user = msn_user_new(session->userlist, passport, ""); - msn_userlist_add_user(session->userlist, user); + xmlnode * typeNode; + char * type; + + gaim_debug_misc("MaYuan","type:%s\n",xmlnode_get_attrib(member,"type")); + if(!g_strcasecmp(xmlnode_get_attrib(member,"type"),"PassportMember")){ + passportNode = xmlnode_get_child(member,"PassportName"); + passport = xmlnode_get_data(passportNode); + typeNode = xmlnode_get_child(member,"Type"); + type = xmlnode_get_data(typeNode); + gaim_debug_misc("Passport","name:%s,type:%s\n",passport,type); + user = msn_userlist_find_user(session->userlist, passport); + if (user == NULL){ + user = msn_user_new(session->userlist, passport, ""); + msn_userlist_add_user(session->userlist, user); + } +// user->list_op |= list_op; + msn_got_lst_user(session, user, list_op, NULL); } -// user->list_op |= list_op; - msn_got_lst_user(session, user, list_op, NULL); + if(!g_strcasecmp(xmlnode_get_attrib(member,"type"),"PhoneMember")){ + } + if(!g_strcasecmp(xmlnode_get_attrib(member,"type"),"EmailMember")){ + } } } @@ -255,8 +264,16 @@ for(contactNode = xmlnode_get_child(contacts, "Contact"); contactNode; contactNode = xmlnode_get_next_twin(contactNode)){ MsnUser *user; + xmlnode *messengerEnableNode; char *passport,*Name,*uid,*type; + char *messengerEnable; + messengerEnableNode = xmlnode_get_child(contactNode,"isMessengerEnabled"); + messengerEnable = xmlnode_get_data(messengerEnableNode); + if(!g_strcasecmp(messengerEnable,"false")){ + continue; + } + contactId= xmlnode_get_child(contactNode,"contactId"); uid = xmlnode_get_data(contactId); @@ -265,6 +282,10 @@ type = xmlnode_get_data(contactType); passportName = xmlnode_get_child(contactInfo,"passportName"); + if(passportName == NULL){ + /*TODO: add it to the none-instant Messenger group and recognize as email Membership*/ + continue; + } passport = xmlnode_get_data(passportName); displayName = xmlnode_get_child(contactInfo,"displayName"); @@ -282,19 +303,40 @@ } msn_user_set_uid(user,uid); msn_user_set_type(user,msn_get_user_type(type)); + user->list_op |= 1; groupIds = xmlnode_get_child(contactInfo,"groupIds"); if(groupIds){ for(guid = xmlnode_get_child(groupIds, "guid");guid; guid = xmlnode_get_next_twin(guid)){ - char * group_id; + char *group_id; group_id = xmlnode_get_data(guid); msn_user_add_group_id(user,group_id); gaim_debug_misc("contact","guid:%s\n",group_id); } }else{ + char *name,*group_id; + + name = g_strdup(MSN_INDIVIDUALS_GROUP_NAME); + group_id = g_strdup(MSN_INDIVIDUALS_GROUP_ID); + + msn_user_add_group_id(user,group_id); + msn_group_new(session->userlist, group_id, name); + + if (group_id == NULL) + /* Group of ungroupped buddies */ + continue; + + if ((gaim_find_group(name)) == NULL){ + GaimGroup *g = gaim_group_new(name); + gaim_blist_add_group(g, NULL); + } + gaim_debug_misc("contact","guid is NULL\n"); + g_free(name); + g_free(group_id); + } } @@ -304,6 +346,7 @@ msn_soap_free_read_buf(contact->soapconn); dump_adl_cmd(session); + msn_set_psm(session); msn_session_finish_login(session); } Modified: branches/soc-2006-msnp13/src/protocols/msn/group.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/group.h 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/group.h 2006-07-23 09:19:12 UTC (rev 16546) @@ -40,6 +40,9 @@ #define MSN_GROUP_IDS "<guid>9e57e654-59f0-44d1-aedc-0a7500b7e51f</guid>" #define MSN_DELETE_GROUP_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>Timer</PartnerScenario></ABApplicationHeader><ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ManagedGroupRequest>false</ManagedGroupRequest></ABAuthHeader></soap:Header><soap:Body><ABGroupDelete xmlns=\"http://www.msn.com/webservices/AddressBook\"><abId>00000000-0000-0000-0000-000000000000</abId><groupFilter><groupIds>%s</groupIds></groupFilter></ABGroupDelete></soap:Body></soap:Envelope>" +#define MSN_INDIVIDUALS_GROUP_ID "0" +#define MSN_INDIVIDUALS_GROUP_NAME "Other Contacts" + /** * A group. */ Modified: branches/soc-2006-msnp13/src/protocols/msn/msn.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/msn.c 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/msn.c 2006-07-23 09:19:12 UTC (rev 16546) @@ -1116,12 +1116,9 @@ cmdproc = session->notification->cmdproc; if (account->perm_deny == GAIM_PRIVACY_ALLOW_ALL || - account->perm_deny == GAIM_PRIVACY_DENY_USERS) - { + account->perm_deny == GAIM_PRIVACY_DENY_USERS){ msn_cmdproc_send(cmdproc, "BLP", "%s", "AL"); - } - else - { + }else{ msn_cmdproc_send(cmdproc, "BLP", "%s", "BL"); } } @@ -1261,7 +1258,7 @@ { MsnSession *session; MsnCmdProc *cmdproc; - int old_gid; + const char *old_gid; const char *enc_new_group_name; session = gc->proto_data; @@ -1270,13 +1267,12 @@ old_gid = msn_userlist_find_group_id(session->userlist, old_name); - if (old_gid >= 0) - { + if (old_gid != NULL){ + /*find a Group*/ msn_cmdproc_send(cmdproc, "REG", "%d %s 0", old_gid, enc_new_group_name); - } - else - { + }else{ + /*not found*/ msn_cmdproc_send(cmdproc, "ADG", "%s 0", enc_new_group_name); } } @@ -1332,13 +1328,13 @@ { MsnSession *session; MsnCmdProc *cmdproc; - int group_id; + const char *group_id; session = gc->proto_data; cmdproc = session->notification->cmdproc; - if ((group_id = msn_userlist_find_group_id(session->userlist, group->name)) >= 0) - { + group_id = msn_userlist_find_group_id(session->userlist, group->name); + if (group_id != NULL){ msn_cmdproc_send(cmdproc, "RMG", "%d", group_id); } } @@ -1354,20 +1350,17 @@ b = gaim_find_buddy(gaim_connection_get_account(info_data->gc), info_data->name); - if (b) - { + if (b){ GString *str = g_string_new(""); char *tmp; - if (b->alias && b->alias[0]) - { + if (b->alias && b->alias[0]){ char *aliastext = g_markup_escape_text(b->alias, -1); g_string_append_printf(s, _("<b>Alias:</b> %s<br>"), aliastext); g_free(aliastext); } - if (b->server_alias) - { + if (b->server_alias){ char *nicktext = g_markup_escape_text(b->server_alias, -1); g_string_append_printf(s, _("<b>%s:</b> "), _("Nickname")); g_string_append_printf(s, "<font sml=\"msn\">%s</font><br>", @@ -1976,7 +1969,7 @@ msn_add_deny, /* add_deny */ msn_rem_permit, /* rem_permit */ msn_rem_deny, /* rem_deny */ - msn_set_permit_deny, /* set_permit_deny */ + msn_set_permit_deny, /* set_permit_deny */ NULL, /* join_chat */ NULL, /* reject chat invite */ NULL, /* get_chat_name */ Modified: branches/soc-2006-msnp13/src/protocols/msn/msn.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/msn.h 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/msn.h 2006-07-23 09:19:12 UTC (rev 16546) @@ -66,6 +66,9 @@ #define WLM_SERVER "muser.messenger.hotmail.com" #define WLM_PORT 1863 #define WLM_PROT_VER 13 +/*This MSNP14 Support chat with Yahoo Messenger*/ +#define WLM_YAHOO_PROT_VER 14 + #define WLM_MAX_PROTOCOL 14 #define WLM_MIN_PROTOCOL 13 Modified: branches/soc-2006-msnp13/src/protocols/msn/nexus.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/nexus.c 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/nexus.c 2006-07-23 09:19:12 UTC (rev 16546) @@ -90,7 +90,7 @@ session = nexus->session; g_return_if_fail(session != NULL); - gaim_debug_misc("msn", "TWN Server Reply: {%s}\n", soapconn->read_buf); +// gaim_debug_misc("msn", "TWN Server Reply: {%s}\n", soapconn->read_buf); if (strstr(soapconn->read_buf, "HTTP/1.1 302") != NULL){ /* Redirect. */ @@ -263,7 +263,7 @@ 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(head); g_free(tail); Modified: branches/soc-2006-msnp13/src/protocols/msn/notification.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-07-23 09:19:12 UTC (rev 16546) @@ -113,10 +113,11 @@ vers = g_strjoinv(" ", a); - if (session->login_step == MSN_LOGIN_STEP_START) + if (session->login_step == MSN_LOGIN_STEP_START){ msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE); - else + }else{ msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE2); + } msn_cmdproc_send(cmdproc, "VER", "%s", vers); @@ -244,10 +245,13 @@ elems = g_strsplit(cmd->params[3], ",", 0); for (cur = elems; *cur != NULL; cur++){ - tokens = g_strsplit(*cur, "=", 2); + tokens = g_strsplit(*cur, "=", 2); +// gaim_debug_info("MaYuan","challenge %p,key:%s,value:%s\n", +// session->nexus->challenge_data,tokens[0],tokens[1]); + if(tokens[0]&&tokens[1]) g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]); - /* Don't free each of the tokens, only the array. */ - g_free(tokens); + /* Don't free each of the tokens, only the array. */ + g_free(tokens); } g_strfreev(elems); @@ -296,9 +300,9 @@ g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver); - for (i = 1; i < cmd->param_count; i++){ -// gaim_debug_info("MaYuan","%s\,proto_str:%s\n",cmd->params[i],proto_str); - if (!strcmp(cmd->params[i], proto_str)) { + for (i = 1; i < cmd->param_count -1; i++){ + gaim_debug_info("MaYuan","%s\,proto_str:%s\n",cmd->params[i],proto_str); + if (strcmp(cmd->params[i], proto_str) >= 0) { protocol_supported = TRUE; break; } @@ -313,6 +317,8 @@ /* * Windows Live Messenger 8.0 * Notice :CVR String discriminate! + * reference of http://www.microsoft.com/globaldev/reference/oslocversion.mspx + * to see the Local ID */ msn_cmdproc_send(cmdproc, "CVR", // "0x0409 winnt 5.1 i386 MSG80BETA 8.0.0689 msmsgs %s", @@ -416,7 +422,7 @@ #else msn_handle_chl(cmd->params[1], buf); #endif - gaim_debug_info("MaYuan","<<challenge:{%s}:{%s}\n",cmd->params[1],buf); +// gaim_debug_info("MaYuan","<<challenge:{%s}:{%s}\n",cmd->params[1],buf); trans = msn_transaction_new(cmdproc, "QRY", "%s 32", MSNP13_WLM_PRODUCT_ID); msn_transaction_set_payload(trans, buf, 32); @@ -438,7 +444,7 @@ xmlnode *adl_node,*d_node,*c_node; char **tokens; char *email,*domain; - char * payload,*attr; + char *payload; char *list_op,*type; int payload_len; @@ -459,6 +465,7 @@ /*find a domain node*/ for(d_node = xmlnode_get_child(adl_node,"d"); d_node; d_node = xmlnode_get_next_twin(d_node)){ + const char * attr = NULL; gaim_debug_info("MaYuan","d_node:%s\n",d_node->name); attr = xmlnode_get_attrib(d_node,"n"); if(attr == NULL){ @@ -482,11 +489,12 @@ list_op = g_strdup_printf("%d",user->list_op); gaim_debug_info("MaYuan","list_op:%d\n",user->list_op); xmlnode_set_attrib(c_node,"l",list_op); -#if 1 +#if 0 type = g_strdup_printf("%d",user->type); xmlnode_set_attrib(c_node,"t",type); #else - xmlnode_set_attrib(c_node,"t","1"); + type = g_strdup_printf("1"); + xmlnode_set_attrib(c_node,"t",type); #endif xmlnode_insert_child(d_node, c_node); @@ -494,7 +502,7 @@ g_free(type); } - payload = xmlnode_to_str(adl_node,payload_len); + payload = xmlnode_to_str(adl_node,&payload_len); gaim_debug_info("MaYuan","ADL{%s}\n",payload); trans = msn_transaction_new(cmdproc, "ADL","%d",strlen(payload)); @@ -505,9 +513,15 @@ } static void +blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) +{ + gaim_debug_info("MaYuan","Process BLP\n"); +} + +static void adl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { - + gaim_debug_info("MaYuan","Process ADL\n"); } static void @@ -766,8 +780,7 @@ if (session->protocol_ver >= 9){ if (cmd->param_count == 5){ - msnobj = - msn_object_new_from_string(gaim_url_decode(cmd->params[4])); + msnobj = msn_object_new_from_string(gaim_url_decode(cmd->params[4])); msn_user_set_object(user, msnobj); }else{ msn_user_set_object(user, NULL); @@ -1203,6 +1216,7 @@ return; } /*get the payload content*/ + gaim_debug_info("MaYuan","GCF{%s}\n",cmd->payload); } static void @@ -1215,6 +1229,18 @@ /*get the payload content*/ } +static void +ubx_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) +{ + gaim_debug_info("MaYuan","UBX... \n"); +} + +static void +uux_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) +{ + gaim_debug_info("MaYuan","UUX... \n"); +} + /************************************************************************** * Message Types **************************************************************************/ @@ -1438,38 +1464,31 @@ void msn_notification_add_buddy(MsnNotification *notification, const char *list, const char *who, const char *store_name, - int group_id) + const char *group_id) { MsnCmdProc *cmdproc; cmdproc = notification->servconn->cmdproc; - if (group_id < 0 && !strcmp(list, "FL")) - group_id = 0; + if (group_id != NULL && !strcmp(list, "FL")) - if (group_id >= 0) - { + if (group_id >= 0){ msn_cmdproc_send(cmdproc, "ADD", "%s %s %s %d", list, who, store_name, group_id); - } - else - { + }else{ msn_cmdproc_send(cmdproc, "ADD", "%s %s %s", list, who, store_name); } } void msn_notification_rem_buddy(MsnNotification *notification, const char *list, - const char *who, int group_id) + const char *who, const char *group_id) { MsnCmdProc *cmdproc; cmdproc = notification->servconn->cmdproc; - if (group_id >= 0) - { + if (group_id != NULL){ msn_cmdproc_send(cmdproc, "REM", "%s %s %d", list, who, group_id); - } - else - { + }else{ msn_cmdproc_send(cmdproc, "REM", "%s %s", list, who); } } @@ -1489,7 +1508,7 @@ msn_table_add_cmd(cbs_table, "CHG", "CHG", NULL); msn_table_add_cmd(cbs_table, "CHG", "ILN", iln_cmd); msn_table_add_cmd(cbs_table, "ADD", "ADD", add_cmd); - msn_table_add_cmd(cbs_table, "ADD", "ILN", iln_cmd); + msn_table_add_cmd(cbs_table, "ADL", "ILN", iln_cmd); msn_table_add_cmd(cbs_table, "REM", "REM", rem_cmd); msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd); @@ -1499,8 +1518,8 @@ msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd); msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd); msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); - /* msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd); */ - msn_table_add_cmd(cbs_table, "BLP", "BLP", NULL); + msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd); +// msn_table_add_cmd(cbs_table, "BLP", "BLP", NULL); msn_table_add_cmd(cbs_table, "REG", "REG", reg_cmd); msn_table_add_cmd(cbs_table, "ADG", "ADG", adg_cmd); msn_table_add_cmd(cbs_table, "RMG", "RMG", rmg_cmd); @@ -1515,7 +1534,7 @@ msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd); msn_table_add_cmd(cbs_table, NULL, "REM", rem_cmd); - msn_table_add_cmd(cbs_table, NULL, "ADD", add_cmd); + msn_table_add_cmd(cbs_table, NULL, "ADL", adl_cmd); msn_table_add_cmd(cbs_table, NULL, "QRY", NULL); msn_table_add_cmd(cbs_table, NULL, "QNG", NULL); @@ -1525,6 +1544,9 @@ msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); msn_table_add_cmd(cbs_table, NULL, "RNG", rng_cmd); + msn_table_add_cmd(cbs_table, NULL, "UBX", ubx_cmd); + msn_table_add_cmd(cbs_table, NULL, "UUX", uux_cmd); + msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd); msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd); Modified: branches/soc-2006-msnp13/src/protocols/msn/notification.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/notification.h 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/notification.h 2006-07-23 09:19:12 UTC (rev 16546) @@ -54,10 +54,10 @@ void msn_notification_add_buddy(MsnNotification *notification, const char *list, const char *who, - const char *store_name, int group_id); + const char *store_name, const char *group_id); void msn_notification_rem_buddy(MsnNotification *notification, const char *list, const char *who, - int group_id); + const char *group_id); MsnNotification *msn_notification_new(MsnSession *session); void msn_notification_destroy(MsnNotification *notification); gboolean msn_notification_connect(MsnNotification *notification, Modified: branches/soc-2006-msnp13/src/protocols/msn/session.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/session.c 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/session.c 2006-07-23 09:19:12 UTC (rev 16546) @@ -43,6 +43,8 @@ session->user = msn_user_new(session->userlist, gaim_account_get_username(account), NULL); + /*if you want to chat with Yahoo Messenger*/ + //session->protocol_ver = WLM_YAHOO_PROT_VER; session->protocol_ver = WLM_PROT_VER; session->conv_seq = 1; @@ -250,22 +252,22 @@ MsnUser *remote_user; gboolean found = FALSE; + gaim_debug_info("MaYuan","buddy name:%s,group name:%s\n",b->name,group_name); remote_user = msn_userlist_find_user(session->userlist, b->name); if ((remote_user != NULL) && (remote_user->list_op & MSN_LIST_FL_OP)){ - int group_id; + char *group_id; GList *l; group_id = msn_userlist_find_group_id(remote_user->userlist, group_name); for (l = remote_user->group_ids; l != NULL; l = l->next){ - if (group_id == GPOINTER_TO_INT(l->data)){ + if (!g_strcasecmp(group_id ,l->data)){ found = TRUE; break; } } - } if (!found){ Modified: branches/soc-2006-msnp13/src/protocols/msn/session.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/session.h 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/session.h 2006-07-23 09:19:12 UTC (rev 16546) @@ -107,6 +107,9 @@ int conv_seq; /**< The current conversation sequence number. */ + /*psm info*/ + char *psm; + struct { /*t and p, get via USR TWN*/ Modified: branches/soc-2006-msnp13/src/protocols/msn/state.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/state.c 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/state.c 2006-07-23 09:19:12 UTC (rev 16546) @@ -38,7 +38,63 @@ N_("Available") }; +char * +msn_build_psm(char * psmstr,char *mediastr,char * guidstr) +{ + xmlnode *dataNode,*psmNode,*mediaNode,*guidNode; + char *result; + int length; + + dataNode = xmlnode_new("Data"); + + psmNode = xmlnode_new("PSM"); + if(psmstr != NULL){ + xmlnode_insert_data(psmNode,psmstr,strlen(psmstr)); + } + xmlnode_insert_child(dataNode,psmNode); + +//"<CurrentMedia>\0Music\01\0{0} - {1}\0 Song Title\0Song Artist\0Song Album\0\0</CurrentMedia>\ +<CurrentMedia>\0Games\01\0Playing {0}\0Game Name\0</CurrentMedia>\ +<CurrentMedia>\0Office\01\0Office Message\0Office App Name\0</CurrentMedia>" + + mediaNode = xmlnode_new("CurrentMedia"); + if(mediastr != NULL){ + xmlnode_insert_data(psmNode,mediastr,strlen(mediastr)); + } + xmlnode_insert_child(dataNode,mediaNode); + + guidNode = xmlnode_new("MachineGuid"); + if(guidstr != NULL){ + xmlnode_insert_data(guidNode,guidstr,strlen(guidstr)); + } + xmlnode_insert_child(dataNode,guidNode); + + result = xmlnode_to_str(dataNode,&length); + return result; +} + void +msn_set_psm(MsnSession *session) +{ + MsnCmdProc *cmdproc; + MsnTransaction *trans; + char *payload; + + cmdproc = session->notification->cmdproc; + /*prepare PSM info*/ + if(session->psm){ + g_free(session->psm); + } + session ->psm = g_strdup(msn_build_psm("Hello",NULL,NULL)); + payload = session->psm; + + gaim_debug_info("MaYuan","UUX{%s}\n",payload); + trans = msn_transaction_new(cmdproc, "UUX","%d",strlen(payload)); + msn_transaction_set_payload(trans, payload, strlen(payload)); + msn_cmdproc_send_trans(cmdproc, trans); +} + +void msn_change_status(MsnSession *session) { GaimAccount *account = session->account; @@ -62,13 +118,10 @@ msnobj = msn_user_get_object(user); - if (msnobj == NULL) - { + if (msnobj == NULL){ msn_cmdproc_send(cmdproc, "CHG", "%s %d", state_text, MSN_CLIENT_ID); - } - else - { + }else{ char *msnobj_str; msnobj_str = msn_object_to_string(msnobj); Modified: branches/soc-2006-msnp13/src/protocols/msn/state.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/state.h 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/state.h 2006-07-23 09:19:12 UTC (rev 16546) @@ -59,6 +59,8 @@ const char *msn_state_get_text(MsnAwayType state); +void msn_set_psm(MsnSession *session); + MsnAwayType msn_state_from_account(GaimAccount *account); #endif /* _MSN_STATE_H_ */ Modified: branches/soc-2006-msnp13/src/protocols/msn/userlist.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/userlist.c 2006-07-23 04:11:21 UTC (rev 16545) +++ branches/soc-2006-msnp13/src/protocols/msn/userlist.c 2006-07-23 09:19:12 UTC (rev 16546) @@ -187,7 +187,7 @@ const char *old_group_name, const char *new_group_name) { MsnCmdProc *cmdproc; - MsnTransaction *trans; +// MsnTransaction *trans; MsnMoveBuddy *data; cmdproc = userlist->session->notification->cmdproc; @@ -300,29 +300,19 @@ passport = msn_user_get_passport(user); - if (list_id == MSN_LIST_FL) - { + if (list_id == MSN_LIST_FL){ /* TODO: When is the user totally removed? */ - if (group_id >= 0) - { + if (group_id != NULL){ msn_user_remove_group_id(user, group_id); return; - } - else - { + }else{ /* session->sync->fl_users_count--; */ } - } - else if (list_id == MSN_LIST_AL) - { + }else if (list_id == MSN_LIST_AL){ gaim_privacy_permit_remove(account, passport, TRUE); - } - else if (list_id == MSN_LIST_BL) - { + }else if (list_id == MSN_LIST_BL){ gaim_privacy_deny_remove(account, passport, TRUE); - } - else if (list_id == MSN_LIST_RL) - { + }else if (list_id == MSN_LIST_RL){ GaimConversation *convo; gaim_debug_info("msn", @@ -347,11 +337,9 @@ user->list_op &= ~(1 << list_id); /* gaim_user_remove_list_id (user, list_id); */ - if (user->list_op == 0) - { + if (user->list_op == 0){ gaim_debug_info("msn", "Buddy '%s' shall be deleted?.\n", passport); - } } @@ -370,13 +358,11 @@ passport = msn_user_get_passport(user); store = msn_user_get_store_name(user); - if (list_op & MSN_LIST_FL_OP) - { + if (list_op & MSN_LIST_FL_OP){ GSList *c; - for (c = group_ids; c != NULL; c = g_slist_next(c)) - { - int group_id; - group_id = GPOINTER_TO_INT(c->data); + for (c = group_ids; c != NULL; c = g_slist_next(c)) { + char *group_id; + group_id = c->data; msn_user_add_group_id(user, group_id); } @@ -485,7 +471,7 @@ g_return_val_if_fail(user->passport != NULL, NULL); - if (!strcmp(passport, user->passport)) + if (!g_strcasecmp(passport, user->passport)) return user; } @@ -515,7 +501,7 @@ for (l = userlist->groups; l != NULL; l = l->next){ MsnGroup *group = l->data; - if (!strcmp(group->id,id)) + if (!g_strcasecmp(group->id,id)) return group; } @@ -548,10 +534,11 @@ group = msn_userlist_find_group_with_name(userlist, group_name); - if (group != NULL) + if (group != NULL){ return msn_group_get_id(group); - else + }else{ return NULL; + } } const char * @@ -599,7 +586,7 @@ const char *who, int list_id, const char *group_name) { MsnUser *user; - char *group_id; + const char *group_id; const char *list; user = msn_userlist_find_user(userlist, who); @@ -635,11 +622,11 @@ const char *group_name) { MsnUser *user; - int group_id; + const char *group_id; const char *list; const char *store_name; - group_id = -1; + group_id = NULL; if (!gaim_email_is_valid(who)){ /* only notify the user about problems adding to the friends list @@ -658,7 +645,7 @@ if (group_name != NULL){ group_id = msn_userlist_find_group_id(userlist, group_name); - if (group_id < 0){ + if (group_id == NULL){ /* Whoa, we must add that group first. */ msn_request_add_group(userlist, who, NULL, group_name); return; @@ -687,11 +674,11 @@ msn_userlist_move_buddy(MsnUserList *userlist, const char *who, const char *old_group_name, const char *new_group_name) { - int new_group_id; + const char *new_group_id; new_group_id = msn_userlist_find_group_id(userlist, new_group_name); - if (new_group_id < 0){ + if (new_group_id == NULL){ msn_request_add_group(userlist, who, old_group_name, new_group_name); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |