You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(106) |
Oct
(334) |
Nov
(246) |
Dec
(145) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(42) |
Feb
(53) |
Mar
(232) |
Apr
(109) |
May
(137) |
Jun
(63) |
Jul
(26) |
Aug
(263) |
Sep
(193) |
Oct
(507) |
Nov
(440) |
Dec
(241) |
2003 |
Jan
(567) |
Feb
(195) |
Mar
(504) |
Apr
(481) |
May
(524) |
Jun
(522) |
Jul
(594) |
Aug
(502) |
Sep
(643) |
Oct
(508) |
Nov
(430) |
Dec
(377) |
2004 |
Jan
(361) |
Feb
(251) |
Mar
(219) |
Apr
(499) |
May
(461) |
Jun
(419) |
Jul
(314) |
Aug
(519) |
Sep
(416) |
Oct
(247) |
Nov
(305) |
Dec
(382) |
2005 |
Jan
(267) |
Feb
(282) |
Mar
(327) |
Apr
(338) |
May
(189) |
Jun
(400) |
Jul
(462) |
Aug
(530) |
Sep
(316) |
Oct
(523) |
Nov
(481) |
Dec
(650) |
2006 |
Jan
(536) |
Feb
(361) |
Mar
(287) |
Apr
(146) |
May
(101) |
Jun
(169) |
Jul
(221) |
Aug
(498) |
Sep
(300) |
Oct
(236) |
Nov
(209) |
Dec
(205) |
2007 |
Jan
(30) |
Feb
(23) |
Mar
(26) |
Apr
(15) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <the...@us...> - 2006-08-02 16:48:01
|
Revision: 16620 Author: thekingant Date: 2006-08-02 09:47:58 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16620&view=rev Log Message: ----------- Revert SVN revision #16537, which should fix bug #1527828 ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16537&view=rev Modified Paths: -------------- branches/v2_0_0/src/protocols/msn/servconn.c Modified: branches/v2_0_0/src/protocols/msn/servconn.c =================================================================== --- branches/v2_0_0/src/protocols/msn/servconn.c 2006-08-02 16:47:55 UTC (rev 16619) +++ branches/v2_0_0/src/protocols/msn/servconn.c 2006-08-02 16:47:58 UTC (rev 16620) @@ -125,8 +125,6 @@ const char *names[] = { "Notification", "Switchboard" }; const char *name; - msn_servconn_disconnect(servconn); - name = names[servconn->type]; switch (error) @@ -158,6 +156,8 @@ swboard->error = MSN_SB_ERROR_CONNECTION; } + msn_servconn_disconnect(servconn); + g_free(tmp); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-02 16:47:59
|
Revision: 16619 Author: thekingant Date: 2006-08-02 09:47:55 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16619&view=rev Log Message: ----------- Revert SVN revision #16537, which should fix bug #1527828 ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16537&view=rev Modified Paths: -------------- trunk/src/protocols/msn/servconn.c Modified: trunk/src/protocols/msn/servconn.c =================================================================== --- trunk/src/protocols/msn/servconn.c 2006-08-02 15:35:36 UTC (rev 16618) +++ trunk/src/protocols/msn/servconn.c 2006-08-02 16:47:55 UTC (rev 16619) @@ -125,8 +125,6 @@ const char *names[] = { "Notification", "Switchboard" }; const char *name; - msn_servconn_disconnect(servconn); - name = names[servconn->type]; switch (error) @@ -158,6 +156,8 @@ swboard->error = MSN_SB_ERROR_CONNECTION; } + msn_servconn_disconnect(servconn); + g_free(tmp); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-02 15:39:51
|
Revision: 16618 Author: markhuetsch Date: 2006-08-02 08:35:36 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16618&view=rev Log Message: ----------- Replaced all C++-style comments with C-style ones. Cleaned up some comments and implemented a more consistent formatting scheme. Modified Paths: -------------- 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_list.h trunk/src/protocols/qq/buddy_opt.c trunk/src/protocols/qq/buddy_opt.h trunk/src/protocols/qq/buddy_status.c trunk/src/protocols/qq/buddy_status.h trunk/src/protocols/qq/char_conv.c trunk/src/protocols/qq/char_conv.h trunk/src/protocols/qq/crypt.c trunk/src/protocols/qq/crypt.h trunk/src/protocols/qq/file_trans.c trunk/src/protocols/qq/file_trans.h trunk/src/protocols/qq/group.c trunk/src/protocols/qq/group.h trunk/src/protocols/qq/group_conv.c trunk/src/protocols/qq/group_conv.h trunk/src/protocols/qq/group_find.c trunk/src/protocols/qq/group_find.h trunk/src/protocols/qq/group_free.c trunk/src/protocols/qq/group_free.h trunk/src/protocols/qq/group_hash.c trunk/src/protocols/qq/group_hash.h trunk/src/protocols/qq/group_im.c trunk/src/protocols/qq/group_im.h trunk/src/protocols/qq/group_info.c trunk/src/protocols/qq/group_info.h trunk/src/protocols/qq/group_join.c trunk/src/protocols/qq/group_join.h trunk/src/protocols/qq/group_misc.c trunk/src/protocols/qq/group_misc.h trunk/src/protocols/qq/group_network.c trunk/src/protocols/qq/group_network.h trunk/src/protocols/qq/group_opt.c trunk/src/protocols/qq/group_opt.h trunk/src/protocols/qq/group_search.c trunk/src/protocols/qq/group_search.h trunk/src/protocols/qq/header_info.c trunk/src/protocols/qq/header_info.h trunk/src/protocols/qq/im.c trunk/src/protocols/qq/im.h trunk/src/protocols/qq/ip_location.c trunk/src/protocols/qq/ip_location.h trunk/src/protocols/qq/keep_alive.c trunk/src/protocols/qq/keep_alive.h trunk/src/protocols/qq/login_logout.c trunk/src/protocols/qq/login_logout.h trunk/src/protocols/qq/packet_parse.c trunk/src/protocols/qq/packet_parse.h trunk/src/protocols/qq/qq.c trunk/src/protocols/qq/qq.h trunk/src/protocols/qq/qq_proxy.c trunk/src/protocols/qq/qq_proxy.h trunk/src/protocols/qq/recv_core.c trunk/src/protocols/qq/recv_core.h trunk/src/protocols/qq/send_core.c trunk/src/protocols/qq/send_core.h trunk/src/protocols/qq/send_file.c trunk/src/protocols/qq/send_file.h trunk/src/protocols/qq/sendqueue.c trunk/src/protocols/qq/sendqueue.h trunk/src/protocols/qq/sys_msg.c trunk/src/protocols/qq/sys_msg.h trunk/src/protocols/qq/udp_proxy_s5.c trunk/src/protocols/qq/udp_proxy_s5.h trunk/src/protocols/qq/utils.c Modified: trunk/src/protocols/qq/buddy_info.c =================================================================== --- trunk/src/protocols/qq/buddy_info.c 2006-08-02 13:37:13 UTC (rev 16617) +++ trunk/src/protocols/qq/buddy_info.c 2006-08-02 15:35:36 UTC (rev 16618) @@ -20,34 +20,33 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "internal.h" // strlen, _("get_text) -#include "debug.h" // gaim_debug -#include "notify.h" // gaim_notify -#include "request.h" // gaim_request_fields_new +#include "internal.h" +#include "debug.h" +#include "notify.h" +#include "request.h" -#include "utils.h" // uid_to_gaim_name -#include "packet_parse.h" // MAX_PACKET_SIZE -#include "buddy_info.h" // -#include "char_conv.h" // qq_to_utf8 -#include "crypt.h" // qq_crypt -#include "header_info.h" // cmd alias -#include "keep_alive.h" // qq_update_buddy_contact -#include "send_core.h" // qq_send_cmd +#include "utils.h" +#include "packet_parse.h" +#include "buddy_info.h" +#include "char_conv.h" +#include "crypt.h" +#include "header_info.h" +#include "keep_alive.h" +#include "send_core.h" -// 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. - +/* 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. */ typedef struct _info_field { gchar *title; - gchar *id; // used by gaim_request fields + 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 + 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; @@ -89,11 +88,11 @@ { 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 + { NULL, NULL, 0, NULL, 0, 0, 0, NULL } }; -//TODO: translate these arrays to their English equivalents -// and move these characters to the zh_CN po file +/* TODO: translate these arrays to their English equivalents + * and move these characters to the zh_CN po file */ static const gchar *horoscope_names[] = { "-", "水瓶座", "双鱼座", "牡羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", @@ -159,10 +158,10 @@ occupation_names }; -/*************** info and info_field methods *****************/ +/************************ info and info_field methods ************************/ -// Given an id, return the template for that field. -// Returns NULL if the id is not found. +/* 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; @@ -171,7 +170,8 @@ 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; + if (g_ascii_strcasecmp(cur_id, id) == 0) + return cur_field; cur_field++; cur_id = cur_field->id; } @@ -179,7 +179,7 @@ return NULL; } -// info_fields are compared by their group positions +/* info_fields are compared by their group positions */ static gint info_field_compare(gconstpointer a, gconstpointer b) { return ((info_field *) a)->group_pos - ((info_field *) b)->group_pos; @@ -191,9 +191,9 @@ 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. +/* 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; @@ -213,25 +213,27 @@ return group; } -// determines if the given text value and choice group require -// a lookup from the choice arrays +/* 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 the arrays has more than 99 - // elements + /* 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++) - if (!g_ascii_isdigit(value[i])) return FALSE; + if (!g_ascii_isdigit(value[i])) + return FALSE; i = atoi(value); - if (i < 0 || i >= choice_sizes[choice]) return FALSE; + if (i < 0 || i >= choice_sizes[choice]) + return FALSE; return TRUE; } -// formats a field for printing +/* formats a field for printing */ static void append_field_to_str(gpointer field, gpointer str) { info_field *f; @@ -250,7 +252,7 @@ info_field_free(f); } -// formats a group of information for printing +/* formats a group of information for printing */ static void append_group_to_str(GString *str, const gchar *group_name, const gchar **info) { GList *group; @@ -262,8 +264,8 @@ 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 +/* 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; @@ -272,14 +274,14 @@ 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); + /* append_group_to_str(info_text, QQ_MISC, info); */ return info_text; } -/*************** packets and UI management *****************/ +/************************ packets and UI management **************************/ -// send a packet to get detailed information of uid +/* 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; @@ -301,8 +303,8 @@ g_free(uid_str); } -// set up the fields requesting personal information and send a get_info packet -// for myself +/* 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; @@ -311,14 +313,15 @@ 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 + /* 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; + if (query->uid == qd->uid) + query->modify_info = TRUE; } } -// send packet to modify personal information +/* send packet to modify personal information */ void qq_send_packet_modify_info(GaimConnection *gc, contact_info *info) { gchar *info_field[QQ_CONTACT_FIELDS]; @@ -335,7 +338,7 @@ create_packet_b(raw_data, &cursor, bar); - // important!, skip the first uid entry + /* 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, (guint8 *) info_field[i], strlen(info_field[i])); @@ -357,8 +360,8 @@ g_free(mid); } -// runs through all of the fields in the modify info UI and put -// their values into the outgoing packet +/* Runs through all of the fields in the modify info UI and puts + * their values into the outgoing packet. */ static void parse_field(gpointer field, gpointer outgoing_info) { GaimRequestField *f; @@ -370,17 +373,19 @@ segments = (gchar **) outgoing_info; id = gaim_request_field_get_id(f); ft = info_field_get_template(id); - if (ft->choice && !ft->customizable) + if (ft->choice && !ft->customizable) { value = g_strdup_printf("%d", gaim_request_field_choice_get_value(f)); - else { + } 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); + 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 +/* dumps the uneditable information straight into the outgoing packet */ static void parse_misc_field(gpointer field, gpointer outgoing_info) { info_field *f; @@ -392,8 +397,8 @@ info_field_free(f); } -// runs through all of the information fields and copies them into an -// outgoing packet, then sends that packet +/* 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; @@ -424,9 +429,9 @@ 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. +/* 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; @@ -449,7 +454,9 @@ if (valid_index) { index = atoi(f->value); value = (gchar *) choices[choice][index]; - } else value = qq_to_utf8(f->value, QQ_CHARSET_DEFAULT); + } 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); @@ -460,12 +467,13 @@ gaim_request_field_choice_add(rf, choices[choice][j++]); } gaim_request_field_group_add_field(g, rf); - if (!valid_index) g_free(value); + 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. +/* 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) { qq_data *qd; @@ -476,14 +484,14 @@ modify_info_data *mid; gint i; - // so we only have one dialog open at a time + /* 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 + /* 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); @@ -492,12 +500,9 @@ 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]); @@ -510,7 +515,7 @@ } } -// process the reply of modify_info packet +/* process the reply of modify_info packet */ void qq_process_modify_info_reply(guint8 *buf, gint buf_len, GaimConnection *gc) { qq_data *qd; @@ -526,16 +531,16 @@ 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 + 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); } - } else + } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt modify info reply\n"); - + } } -// after getting info or modify myself, refresh the buddy list accordingly +/* after getting info or modify myself, refresh the buddy list accordingly */ void qq_refresh_buddy_and_myself(contact_info *info, GaimConnection *gc) { GaimBuddy *b; @@ -547,15 +552,15 @@ qd = (qq_data *) gc->proto_data; alias_utf8 = qq_to_utf8(info->nick, QQ_CHARSET_DEFAULT); - if (qd->uid == strtol(info->uid, NULL, 10)) { // it is me + if (qd->uid == strtol(info->uid, NULL, 10)) { /* it is me */ qd->my_icon = strtol(info->face, NULL, 10); if (alias_utf8 != NULL) gaim_account_set_alias(gc->account, alias_utf8); } - // update buddy list (including myself, if myself is the buddy) + /* update buddy list (including myself, if myself is the buddy) */ b = gaim_find_buddy(gc->account, uid_to_gaim_name(strtol(info->uid, NULL, 10))); q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data; - if (q_bud != NULL) { // I have this buddy + if (q_bud != NULL) { /* I have this buddy */ q_bud->age = strtol(info->age, NULL, 10); q_bud->gender = strtol(info->gender, NULL, 10); q_bud->icon = strtol(info->face, NULL, 10); @@ -566,7 +571,7 @@ g_free(alias_utf8); } -// process reply to get_info packet +/* process reply to get_info packet */ void qq_process_get_info_reply(guint8 *buf, gint buf_len, GaimConnection *gc) { gint len; @@ -595,7 +600,7 @@ qq_refresh_buddy_and_myself(info, gc); query_list = qd->info_query; - // ensure we're processing the right query + /* ensure we're processing the right query */ while (query_list) { query = (qq_info_query *) query_list->data; if (query->uid == atoi(info->uid)) { @@ -614,12 +619,12 @@ } g_strfreev(segments); - } else + } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt get info reply\n"); - + } } -void qq_info_query_free(qq_data * qd) +void qq_info_query_free(qq_data *qd) { gint i; qq_info_query *p; Modified: trunk/src/protocols/qq/buddy_info.h =================================================================== --- trunk/src/protocols/qq/buddy_info.h 2006-08-02 13:37:13 UTC (rev 16617) +++ trunk/src/protocols/qq/buddy_info.h 2006-08-02 15:35:36 UTC (rev 16618) @@ -20,15 +20,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// START OF FILE -/*****************************************************************************/ #ifndef _QQ_BUDDY_INFO_H_ #define _QQ_BUDDY_INFO_H_ #include <glib.h> -#include "connection.h" // GaimConnection -#include "buddy_opt.h" // gc_and_uid -#include "qq.h" // qq_data +#include "connection.h" +#include "buddy_opt.h" +#include "qq.h" #define QQ_COMM_FLAG_QQ_MEMBER 0x02 #define QQ_COMM_FLAG_TCP_MODE 0x10 @@ -41,56 +39,56 @@ #define QQ_BUDDY_GENDER_UNKNOWN 0xff typedef struct _contact_info { - gchar *uid; //0 - gchar *nick; //1 - gchar *country; //2 - gchar *province; //3 - gchar *zipcode; //4 - gchar *address; //5 - gchar *tel; //6 - gchar *age; //7 - gchar *gender; //8 - gchar *name; //9 - gchar *email; //10 - gchar *pager_sn; //11 - gchar *pager_num; //12 - gchar *pager_sp; //13 - gchar *pager_base_num; //14 - gchar *pager_type; //15 - gchar *occupation; //16 - gchar *homepage; //17 - gchar *auth_type; //18 - gchar *unknown1; //19 - gchar *unknown2; //20 - gchar *face; //21 - gchar *hp_num; //22 - gchar *hp_type; //23 - gchar *intro; //24 - gchar *city; //25 - gchar *unknown3; //26 - gchar *unknown4; //27 - gchar *unknown5; //28 - gchar *is_open_hp; //29 - gchar *is_open_contact; //30 - gchar *college; //31 - gchar *horoscope; //32 - gchar *zodiac; //33 sheng xiao - gchar *blood; //34 - gchar *qq_show; //35 - gchar *unknown6; //36, always 0x2D + gchar *uid; + gchar *nick; + gchar *country; + gchar *province; + gchar *zipcode; + gchar *address; + gchar *tel; + gchar *age; + gchar *gender; + gchar *name; + gchar *email; + gchar *pager_sn; + gchar *pager_num; + gchar *pager_sp; + gchar *pager_base_num; + gchar *pager_type; + gchar *occupation; + gchar *homepage; + gchar *auth_type; + gchar *unknown1; + gchar *unknown2; + gchar *face; + gchar *hp_num; + gchar *hp_type; + gchar *intro; + gchar *city; + gchar *unknown3; + gchar *unknown4; + gchar *unknown5; + gchar *is_open_hp; + gchar *is_open_contact; + gchar *college; + gchar *horoscope; + gchar *zodiac; + gchar *blood; + gchar *qq_show; + gchar *unknown6; /* always 0x2D */ } contact_info; -// 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 +/* 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 +/* 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; Modified: trunk/src/protocols/qq/buddy_list.c =================================================================== --- trunk/src/protocols/qq/buddy_list.c 2006-08-02 13:37:13 UTC (rev 16617) +++ trunk/src/protocols/qq/buddy_list.c 2006-08-02 15:35:36 UTC (rev 16618) @@ -20,32 +20,30 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// START OF FILE -/*****************************************************************************/ -#include <string.h> // g_memmove, memmove -#include "debug.h" // gaim_debug +#include <string.h> +#include "debug.h" -#include "notify.h" // gaim_notify -#include "utils.h" // get_ip_str -#include "packet_parse.h" // create_packet, read_packet +#include "notify.h" +#include "utils.h" +#include "packet_parse.h" #include "buddy_list.h" -#include "buddy_status.h" // qq_buddy_status -#include "buddy_opt.h" // qq_add_buddy_by_recv_packet -#include "char_conv.h" // qq_to_utf8 -#include "crypt.h" // qq_crypt -#include "header_info.h" // cmd alias -#include "keep_alive.h" // qq_refresh_all_buddy_status -#include "send_core.h" // qq_send_cmd -#include "qq.h" // qq_data -#include "group.h" // qq_group, by gfhuang -#include "group_find.h" // qq_group_find -#include "group_hash.h" //qq_group_create_by_id -#include "group_info.h" //qq_send_cmd_group_get_group_info +#include "buddy_status.h" +#include "buddy_opt.h" +#include "char_conv.h" +#include "crypt.h" +#include "header_info.h" +#include "keep_alive.h" +#include "send_core.h" +#include "qq.h" +#include "group.h" +#include "group_find.h" +#include "group_hash.h" +#include "group_info.h" #include "qq_proxy.h" #define QQ_GET_ONLINE_BUDDY_02 0x02 -#define QQ_GET_ONLINE_BUDDY_03 0x03 // unknown function +#define QQ_GET_ONLINE_BUDDY_03 0x03 /* unknown function */ #define QQ_ONLINE_BUDDY_ENTRY_LEN 38 @@ -55,12 +53,11 @@ guint8 flag1; guint8 comm_flag; guint16 unknown2; - guint8 ending; //0x00 + guint8 ending; /* 0x00 */ } qq_friends_online_entry; -/*****************************************************************************/ -// get a list of online_buddies -void qq_send_packet_get_buddies_online(GaimConnection * gc, guint8 position) +/* get a list of online_buddies */ +void qq_send_packet_get_buddies_online(GaimConnection *gc, guint8 position) { qq_data *qd; guint8 *raw_data, *cursor; @@ -71,27 +68,25 @@ raw_data = g_newa(guint8, 5); cursor = raw_data; - // 000-000 get online friends cmd - // only 0x02 and 0x03 returns info from server, other valuse all return 0xff - // I can also only send the first byte (0x02, or 0x03) - // and the result is the same + /* 000-000 get online friends cmd + * only 0x02 and 0x03 returns info from server, other valuse all return 0xff + * I can also only send the first byte (0x02, or 0x03) + * and the result is the same */ create_packet_b(raw_data, &cursor, QQ_GET_ONLINE_BUDDY_02); - // 001-001 seems it supports 255 online buddies at most + /* 001-001 seems it supports 255 online buddies at most */ create_packet_b(raw_data, &cursor, position); - // 002-002 + /* 002-002 */ create_packet_b(raw_data, &cursor, 0x00); - // 003-004 + /* 003-004 */ create_packet_w(raw_data, &cursor, 0x0000); qq_send_cmd(gc, QQ_CMD_GET_FRIENDS_ONLINE, TRUE, 0, TRUE, raw_data, 5); qd->last_get_online = time(NULL); +} -} // qq_send_packet_get_buddies_online - -/*****************************************************************************/ -// position starts with 0x0000, -// server may return a position tag if list is too long for one packet -void qq_send_packet_get_buddies_list(GaimConnection * gc, guint16 position) +/* position starts with 0x0000, + * server may return a position tag if list is too long for one packet */ +void qq_send_packet_get_buddies_list(GaimConnection *gc, guint16 position) { guint8 *raw_data, *cursor; gint data_len; @@ -101,20 +96,19 @@ data_len = 3; raw_data = g_newa(guint8, data_len); cursor = raw_data; - // 000-001 starting position, can manually specify + /* 000-001 starting position, can manually specify */ create_packet_w(raw_data, &cursor, position); - // before Mar 18, 2004, any value can work, and we sent 00 - // I do not know what data QQ server is expecting, as QQ2003iii 0304 itself - // even can sending packets 00 and get no response. - // Now I tested that 00,00,00,00,00,01 work perfectly - // March 22, fount the 00,00,00 starts to work as well + /* before Mar 18, 2004, any value can work, and we sent 00 + * I do not know what data QQ server is expecting, as QQ2003iii 0304 itself + * even can sending packets 00 and get no response. + * Now I tested that 00,00,00,00,00,01 work perfectly + * March 22, found the 00,00,00 starts to work as well */ create_packet_b(raw_data, &cursor, 0x00); qq_send_cmd(gc, QQ_CMD_GET_FRIENDS_LIST, TRUE, 0, TRUE, raw_data, data_len); +} -} // qq_send_packet_get_buddies_list - -// get all list, buddies & Quns with groupsid support, written by gfhuang +/* get all list, buddies & Quns with groupsid support */ void qq_send_packet_get_all_list_with_group(GaimConnection *gc, guint32 position) { guint8 *raw_data, *cursor; @@ -125,19 +119,18 @@ data_len = 10; raw_data = g_newa(guint8, data_len); cursor = raw_data; - // 0x01 download, 0x02, upload + /* 0x01 download, 0x02, upload */ create_packet_b(raw_data, &cursor, 0x01); - //unknown 0x02 + /* unknown 0x02 */ create_packet_b(raw_data, &cursor, 0x02); - //unknown 00 00 00 00 + /* unknown 00 00 00 00 */ create_packet_dw(raw_data, &cursor, 0x00000000); create_packet_dw(raw_data, &cursor, position); qq_send_cmd(gc, QQ_CMD_GET_ALL_LIST_WITH_GROUP, TRUE, 0, TRUE, raw_data, data_len); } -/*****************************************************************************/ -static void _qq_buddies_online_reply_dump_unclear(qq_friends_online_entry * fe) +static void _qq_buddies_online_reply_dump_unclear(qq_friends_online_entry *fe) { GString *dump; @@ -154,12 +147,11 @@ gaim_debug(GAIM_DEBUG_INFO, "QQ", "Online buddy entry, %s", dump->str); g_string_free(dump, TRUE); -} // _qq_buddies_online_reply_dump_unknown +} -/*****************************************************************************/ -// process the reply packet for get_buddies_online packet -void qq_process_get_buddies_online_reply(guint8 * buf, gint buf_len, GaimConnection * gc) { - +/* process the reply packet for get_buddies_online packet */ +void qq_process_get_buddies_online_reply(guint8 *buf, gint buf_len, GaimConnection *gc) +{ qq_data *qd; gint len, bytes; guint8 *data, *cursor, position; @@ -187,57 +179,59 @@ fe->s = g_newa(qq_buddy_status, 1); while (cursor < (data + len)) { - // based on one online buddy entry + /* based on one online buddy entry */ bytes = 0; - // 000-030 qq_buddy_status + /* 000-030 qq_buddy_status */ bytes += qq_buddy_status_read(data, &cursor, len, fe->s); - // 031-032: unknown4 + /* 031-032: unknown4 */ bytes += read_packet_w(data, &cursor, len, &fe->unknown1); - // 033-033: flag1 + /* 033-033: flag1 */ bytes += read_packet_b(data, &cursor, len, &fe->flag1); - // 034-034: comm_flag + /* 034-034: comm_flag */ bytes += read_packet_b(data, &cursor, len, &fe->comm_flag); - // 035-036: + /* 035-036: */ bytes += read_packet_w(data, &cursor, len, &fe->unknown2); - // 037-037: - bytes += read_packet_b(data, &cursor, len, &fe->ending); // 0x00 + /* 037-037: */ + bytes += read_packet_b(data, &cursor, len, &fe->ending); /* 0x00 */ if (fe->s->uid == 0 || bytes != QQ_ONLINE_BUDDY_ENTRY_LEN) { - gaim_debug(GAIM_DEBUG_ERROR, "QQ", "uid=0 or entry complete len(%d) != %d", bytes, QQ_ONLINE_BUDDY_ENTRY_LEN); + gaim_debug(GAIM_DEBUG_ERROR, "QQ", + "uid=0 or entry complete len(%d) != %d", + bytes, QQ_ONLINE_BUDDY_ENTRY_LEN); g_free(fe->s->ip); g_free(fe->s->unknown_key); continue; - } // check if it is a valid entry + } /* check if it is a valid entry */ if (QQ_DEBUG) _qq_buddies_online_reply_dump_unclear(fe); - // update buddy information + /* update buddy information */ b = gaim_find_buddy(gaim_connection_get_account(gc), uid_to_gaim_name(fe->s->uid)); q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data; - if (q_bud != NULL) { // we find one and update qq_buddy + 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 - g_memmove(q_bud->ip, fe->s->ip, 4); - q_bud->port = fe->s->port; - // } + q_bud->client_version = fe->s->client_version; + 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; qq_update_buddy_contact(gc, q_bud); - } // if q_bud + } else { - gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Got an online buddy %d, but not in my buddy list", fe->s->uid); + gaim_debug(GAIM_DEBUG_ERROR, "QQ", + "Got an online buddy %d, but not in my buddy list", fe->s->uid); } g_free(fe->s->ip); g_free(fe->s->unknown_key); - } // while cursor + } if(cursor > (data + len)) { - gaim_debug(GAIM_DEBUG_ERROR, "QQ", "qq_process_get_buddies_online_reply: Dangerous error! maybe protocal changed, notify me!"); + gaim_debug(GAIM_DEBUG_ERROR, "QQ", + "qq_process_get_buddies_online_reply: Dangerous error! maybe protocol changed, notify developers!"); } if (position != QQ_FRIENDS_ONLINE_POSITION_END) { @@ -245,17 +239,18 @@ qq_send_packet_get_buddies_online(gc, position); } - else + else { qq_refresh_all_buddy_status(gc); + } - } else + } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt buddies online"); + } +} -} // qq_process_get_buddies_online_reply - -/*****************************************************************************/ -// process reply for get_buddies_list -void qq_process_get_buddies_list_reply(guint8 * buf, gint buf_len, GaimConnection * gc) { +/* process reply for get_buddies_list */ +void qq_process_get_buddies_list_reply(guint8 *buf, gint buf_len, GaimConnection *gc) +{ qq_data *qd; qq_buddy *q_bud; gint len, bytes, bytes_expected, i; @@ -274,20 +269,20 @@ if (qq_crypt(DECRYPT, buf, buf_len, qd->session_key, data, &len)) { read_packet_w(data, &cursor, len, &position); - // the following data is buddy list in this packet + /* the following data is buddy list in this packet */ i = 0; while (cursor < (data + len)) { q_bud = g_new0(qq_buddy, 1); bytes = 0; - // 000-003: uid + /* 000-003: uid */ bytes += read_packet_dw(data, &cursor, len, &q_bud->uid); - // 004-004: 0xff if buddy is self, 0x00 otherwise + /* 004-004: 0xff if buddy is self, 0x00 otherwise */ bytes += read_packet_b(data, &cursor, len, &bar); - // 005-005: icon index (1-255) + /* 005-005: icon index (1-255) */ bytes += read_packet_b(data, &cursor, len, &q_bud->icon); - // 006-006: age + /* 006-006: age */ bytes += read_packet_b(data, &cursor, len, &q_bud->age); - // 007-007: gender + /* 007-007: gender */ bytes += read_packet_b(data, &cursor, len, &q_bud->gender); pascal_len = convert_as_pascal_string(cursor, &q_bud->nickname, QQ_CHARSET_DEFAULT); cursor += pascal_len; @@ -313,13 +308,15 @@ g_free(q_bud->nickname); g_free(q_bud); continue; - } else + } else { i++; + } - if (QQ_DEBUG) + if (QQ_DEBUG) { gaim_debug(GAIM_DEBUG_INFO, "QQ", "buddy [%09d]: flag1=0x%02x, comm_flag=0x%02x\n", q_bud->uid, q_bud->flag1, q_bud->comm_flag); + } name = uid_to_gaim_name(q_bud->uid); b = gaim_find_buddy(gc->account, name); @@ -331,25 +328,24 @@ b->proto_data = q_bud; qd->buddies = g_list_append(qd->buddies, q_bud); qq_update_buddy_contact(gc, q_bud); - } // while cursor + } if(cursor > (data + len)) { - gaim_debug(GAIM_DEBUG_ERROR, "QQ", "qq_process_get_buddies_list_reply: Dangerous error! maybe protocal changed, notify me!"); + gaim_debug(GAIM_DEBUG_ERROR, "QQ", + "qq_process_get_buddies_list_reply: Dangerous error! maybe protocol changed, notify developers!"); } if (position == QQ_FRIENDS_LIST_POSITION_END) { gaim_debug(GAIM_DEBUG_INFO, "QQ", "Get friends list done, %d buddies\n", i); qq_send_packet_get_buddies_online(gc, QQ_FRIENDS_ONLINE_POSITION_START); - } else + } else { qq_send_packet_get_buddies_list(gc, position); - - } else + } + } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt buddies list"); + } +} -} // qq_process_get_buddies_list_reply - - -// written by gfhuang -void qq_process_get_all_list_with_group_reply(guint8 * buf, gint buf_len, GaimConnection * gc) +void qq_process_get_all_list_with_group_reply(guint8 *buf, gint buf_len, GaimConnection *gc) { qq_data *qd; gint len, i, j; @@ -377,27 +373,28 @@ g_return_if_fail(sub_cmd == 0x01); read_packet_b(data, &cursor, len, &reply_code); if(0 != reply_code) { - gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Get all list with group reply, reply_code(%d) is not zero", reply_code); + gaim_debug(GAIM_DEBUG_WARNING, "QQ", + "Get all list with group reply, reply_code(%d) is not zero", reply_code); } read_packet_dw(data, &cursor, len, &unknown); read_packet_dw(data, &cursor, len, &position); - // the following data is all list in this packet + /* the following data is all list in this packet */ i = 0; j = 0; while (cursor < (data + len)) { - // 00-03: uid + /* 00-03: uid */ read_packet_dw(data, &cursor, len, &uid); - // 04: type 0x1:buddy 0x4:Qun + /* 04: type 0x1:buddy 0x4:Qun */ read_packet_b(data, &cursor, len, &type); - // 05: groupid*4 + /* 05: groupid*4 */ read_packet_b(data, &cursor, len, &groupid); - groupid >>= 2; // these 2 bits might not be 0, faint! + groupid >>= 2; /* these 2 bits might not be 0, faint! */ if (uid == 0 || (type != 0x1 && type != 0x4)) { gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Buddy entry, uid=%d, type=%d", uid, type); continue; } - if(0x1 == type) { // a buddy + if(0x1 == type) { /* a buddy */ name = uid_to_gaim_name(uid); b = gaim_find_buddy(gc->account, name); g_free(name); @@ -408,23 +405,23 @@ } else { q_bud = NULL; - b->proto_data = q_bud; //wrong !!!! + b->proto_data = q_bud; /* wrong !!!! */ } qd->buddies = g_list_append(qd->buddies, q_bud); qq_update_buddy_contact(gc, q_bud); ++i; - } - else { //a group - group = qq_group_find_by_internal_group_id(gc, uid); + } else { /* a group */ + group = qq_group_find_by_internal_group_id(gc, uid); if(group == NULL) { - /* not working, gfhuang + /* not working group = qq_group_create_by_id(gc, uid, 0); qq_send_cmd_group_get_group_info(gc, group); */ - gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Get a Qun with internel group %d\n", uid); - gaim_notify_info(gc, _("QQ Qun Operation"), _("Find one Qun in the server list, but i don't know its external id, please re-rejoin it manually"), NULL); - } - else { + gaim_debug(GAIM_DEBUG_ERROR, "QQ", + "Get a Qun with internal group %d\n", uid); + gaim_notify_info(gc, _("QQ Qun Operation"), + _("Find one Qun in the server list, but i don't know its external id, please re-rejoin it manually"), NULL); + } else { group->my_status = QQ_GROUP_MEMBER_STATUS_IS_MEMBER; qq_group_refresh(gc, group); qq_send_cmd_group_get_group_info(gc, group); @@ -433,12 +430,11 @@ } } if(cursor > (data + len)) { - gaim_debug(GAIM_DEBUG_ERROR, "QQ", "qq_process_get_all_list_with_group_reply: Dangerous error! maybe protocal changed, notify me!"); + gaim_debug(GAIM_DEBUG_ERROR, "QQ", + "qq_process_get_all_list_with_group_reply: Dangerous error! maybe protocol changed, notify developers!"); } - gaim_debug(GAIM_DEBUG_INFO, "QQ", "Get all list done, %d buddies and %d Quns\n", i, j); - } else + gaim_debug(GAIM_DEBUG_INFO, "QQ", "Get all list done, %d buddies and %d Quns\n", i, j); + } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt all list with group"); - + } } -/*****************************************************************************/ -// END OF FILE Modified: trunk/src/protocols/qq/buddy_list.h =================================================================== --- trunk/src/protocols/qq/buddy_list.h 2006-08-02 13:37:13 UTC (rev 16617) +++ trunk/src/protocols/qq/buddy_list.h 2006-08-02 15:35:36 UTC (rev 16618) @@ -20,28 +20,22 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// START OF FILE -/*****************************************************************************/ #ifndef _QQ_BUDDY_LIST_H_ #define _QQ_BUDDY_LIST_H_ #include <glib.h> -#include "connection.h" // GaimConnection +#include "connection.h" #define QQ_FRIENDS_LIST_POSITION_START 0x0000 #define QQ_FRIENDS_LIST_POSITION_END 0xffff #define QQ_FRIENDS_ONLINE_POSITION_START 0x00 #define QQ_FRIENDS_ONLINE_POSITION_END 0xff -void qq_send_packet_get_buddies_online(GaimConnection * gc, guint8 position); -void qq_process_get_buddies_online_reply(guint8 * buf, gint buf_len, GaimConnection * gc); -void qq_send_packet_get_buddies_list(GaimConnection * gc, guint16 position); -void qq_process_get_buddies_list_reply(guint8 * buf, gint buf_len, GaimConnection * gc); +void qq_send_packet_get_buddies_online(GaimConnection *gc, guint8 position); +void qq_process_get_buddies_online_reply(guint8 *buf, gint buf_len, GaimConnection *gc); +void qq_send_packet_get_buddies_list(GaimConnection *gc, guint16 position); +void qq_process_get_buddies_list_reply(guint8 *buf, gint buf_len, GaimConnection *gc); +void qq_send_packet_get_all_list_with_group(GaimConnection *gc, guint32 position); +void qq_process_get_all_list_with_group_reply(guint8 *buf, gint buf_len, GaimConnection *gc); -//added by gfhuang -void qq_send_packet_get_all_list_with_group(GaimConnection * gc, guint32 position); -void qq_process_get_all_list_with_group_reply(guint8 * buf, gint buf_len, GaimConnection * gc); - #endif -/*****************************************************************************/ -// END OF FILE Modified: trunk/src/protocols/qq/buddy_opt.c =================================================================== --- trunk/src/protocols/qq/buddy_opt.c 2006-08-02 13:37:13 UTC (rev 16617) +++ trunk/src/protocols/qq/buddy_opt.c 2006-08-02 15:35:36 UTC (rev 16618) @@ -20,24 +20,22 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// START OF FILE -/*****************************************************************************/ -#include "debug.h" // gaim_debug -#include "internal.h" // strlen, _("get_text") -#include "notify.h" // gaim_notify -#include "request.h" // gaim_request_input +#include "debug.h" +#include "internal.h" +#include "notify.h" +#include "request.h" -#include "utils.h" // uid_to_gaim_name, gaim_name_to_uid -#include "packet_parse.h" // create_packet, read_packet -#include "buddy_info.h" // qq_send_packet_get_info -#include "buddy_list.h" // qq_send_packet_get_buddies_online +#include "buddy_info.h" +#include "buddy_list.h" #include "buddy_opt.h" -#include "char_conv.h" // qq_to_utf8 -#include "crypt.h" // qq_crypt -#include "header_info.h" // cmd alias -#include "keep_alive.h" // qq_update_buddy_contact -#include "im.h" // QQ_MSG_IM_MAX -#include "send_core.h" // qq_send_cmd +#include "char_conv.h" +#include "crypt.h" +#include "header_info.h" +#include "im.h" +#include "keep_alive.h" +#include "packet_parse.h" +#include "send_core.h" +#include "utils.h" #define GAIM_GROUP_QQ_FORMAT "QQ (%s)" #define GAIM_GROUP_QQ_UNKNOWN "QQ Unknown" @@ -45,12 +43,12 @@ #define QQ_REMOVE_BUDDY_REPLY_OK 0x00 #define QQ_REMOVE_SELF_REPLY_OK 0x00 -#define QQ_ADD_BUDDY_AUTH_REPLY_OK 0x30 // ASCii value of "0" +#define QQ_ADD_BUDDY_AUTH_REPLY_OK 0x30 /* ASCII value of "0" */ enum { - QQ_MY_AUTH_APPROVE = 0x30, // ASCii value of "0" - QQ_MY_AUTH_REJECT = 0x31, // ASCii value of "1" - QQ_MY_AUTH_REQUEST = 0x32, // ASCii value of "2" + QQ_MY_AUTH_APPROVE = 0x30, /* ASCII value of "0" */ + QQ_MY_AUTH_REJECT = 0x31, /* ASCII value of "1" */ + QQ_MY_AUTH_REQUEST = 0x32, /* ASCII value of "2" */ }; typedef struct _qq_add_buddy_request { @@ -58,9 +56,8 @@ guint16 seq; } qq_add_buddy_request; -/*****************************************************************************/ -// send packet to remove a buddy from my buddy list -static void _qq_send_packet_remove_buddy(GaimConnection * gc, guint32 uid) +/* send packet to remove a buddy from my buddy list */ +static void _qq_send_packet_remove_buddy(GaimConnection *gc, guint32 uid) { gchar *uid_str; @@ -70,11 +67,10 @@ qq_send_cmd(gc, QQ_CMD_DEL_FRIEND, TRUE, 0, TRUE, uid_str, strlen(uid_str)); g_free(uid_str); -} // _qq_send_packet_remove_buddy +} -/*****************************************************************************/ -// try to remove myself from someone's buddy list -static void _qq_send_packet_remove_self_from(GaimConnection * gc, guint32 uid) +/* try to remove myself from someone's buddy list */ +static void _qq_send_packet_remove_self_from(GaimConnection *gc, guint32 uid) { guint8 *raw_data, *cursor; @@ -85,12 +81,10 @@ create_packet_dw(raw_data, &cursor, uid); qq_send_cmd(gc, QQ_CMD_REMOVE_SELF, TRUE, 0, TRUE, raw_data, 4); +} -} // _qq_send_packet_add_buddy - -/*****************************************************************************/ -// try to add a buddy without authentication -static void _qq_send_packet_add_buddy(GaimConnection * gc, guint32 uid) +/* try to add a buddy without authentication */ +static void _qq_send_packet_add_buddy(GaimConnection *gc, guint32 uid) { qq_data *qd; qq_add_buddy_request *req; @@ -98,22 +92,21 @@ g_return_if_fail(gc != NULL && gc->proto_data != NULL && uid > 0); - // we need to send the ascii code of this uid to qq server + /* we need to send the ascii code of this uid to qq server */ uid_str = g_strdup_printf("%d", uid); qq_send_cmd(gc, QQ_CMD_ADD_FRIEND_WO_AUTH, TRUE, 0, TRUE, uid_str, strlen(uid_str)); g_free(uid_str); - // must be set after sending packet to get the correct send_seq + /* must be set after sending packet to get the correct send_seq */ qd = (qq_data *) gc->proto_data; req = g_new0(qq_add_buddy_request, 1); req->seq = qd->send_seq; req->uid = uid; qd->add_buddy_request = g_list_append(qd->add_buddy_request, req); -} // _qq_send_packet_add_buddy +} -/*****************************************************************************/ -// this buddy needs authentication, text conversion is done at lowest level -static void _qq_send_packet_buddy_auth(GaimConnection * gc, guint32 uid, const gchar response, const gchar * text) +/* this buddy needs authentication, text conversion is done at lowest level */ +static void _qq_send_packet_buddy_auth(GaimConnection *gc, guint32 uid, const gchar response, const gchar *text) { gchar *text_qq, *uid_str; guint8 bar, *cursor, *raw_data; @@ -138,11 +131,10 @@ qq_send_cmd(gc, QQ_CMD_BUDDY_AUTH, TRUE, 0, TRUE, raw_data, cursor - raw_data); g_free(uid_str); -} // _qq_send_packet_buddy_auth +} - -/*****************************************************************************/ -static void _qq_send_packet_add_buddy_auth_with_gc_and_uid(gc_and_uid * g, const gchar * text) { +static void _qq_send_packet_add_buddy_auth_with_gc_and_uid(gc_and_uid *g, const gchar *text) +{ GaimConnection *gc; guint32 uid; g_return_if_fail(g != NULL); @@ -153,11 +145,10 @@ _qq_send_packet_buddy_auth(gc, uid, QQ_MY_AUTH_REQUEST, text); g_free(g); -} // qq_send_packet_add_buddy_auth +} -/*****************************************************************************/ -// the real packet to reject and request is sent from here -static void _qq_reject_add_request_real(gc_and_uid * g, const gchar * reason) +/* the real packet to reject and request is sent from here */ +static void _qq_reject_add_request_real(gc_and_uid *g, const gchar *reason) { gint uid; GaimConnection *gc; @@ -170,11 +161,10 @@ _qq_send_packet_buddy_auth(gc, uid, QQ_MY_AUTH_REJECT, reason); g_free(g); -} // _qq_reject_add_request_real +} -/*****************************************************************************/ -// we approve other's request of adding me as friend -void qq_approve_add_request_with_gc_and_uid(gc_and_uid * g) +/* we approve other's request of adding me as friend */ +void qq_approve_add_request_with_gc_and_uid(gc_and_uid *g) { gint uid; GaimConnection *gc; @@ -187,17 +177,15 @@ _qq_send_packet_buddy_auth(gc, uid, QQ_MY_AUTH_APPROVE, NULL); g_free(g); -} // qq_approve_add_request_with_gc_and_uid +} -/*****************************************************************************/ -void qq_do_nothing_with_gc_and_uid(gc_and_uid * g, const gchar * msg) +void qq_do_nothing_with_gc_and_uid(gc_and_uid *g, const gchar *msg) { g_free(g); -} // qq_do_nothing_with_gc_and_uid +} -/*****************************************************************************/ -// we reject other's request of adding me as friend -void qq_reject_add_request_with_gc_and_uid(gc_and_uid * g) +/* we reject other's request of adding me as friend */ +void qq_reject_add_request_with_gc_and_uid(gc_and_uid *g) { gint uid; gchar *msg1, *msg2; @@ -222,11 +210,9 @@ gaim_request_input(gc, _("Reject request"), msg1, msg2, _("Sorry, you are not my type..."), TRUE, FALSE, NULL, _("Reject"), G_CALLBACK(_qq_reject_add_request_real), _("Cancel"), NULL, g2); +} -} // qq_reject_add_request_with_gc_and_uid - -/*****************************************************************************/ -void qq_add_buddy_with_gc_and_uid(gc_and_uid * g) +void qq_add_buddy_with_gc_and_uid(gc_and_uid *g) { gint uid; GaimConnection *gc; @@ -239,10 +225,9 @@ _qq_send_packet_add_buddy(gc, uid); g_free(g); -} // qq_add_buddy_with_gc_and_uid +} -/*****************************************************************************/ -void qq_block_buddy_with_gc_and_uid(gc_and_uid * g) +void qq_block_buddy_with_gc_and_uid(gc_and_uid *g) { guint32 uid; GaimConnection *gc; @@ -260,12 +245,11 @@ qq_remove_buddy(gc, &buddy, &group); _qq_send_packet_remove_self_from(gc, uid); +} -} // qq_block_buddy_with_gc_and_uid - -/*****************************************************************************/ -// process reply to add_buddy_auth request -void qq_process_add_buddy_auth_reply(guint8 * buf, gint buf_len, GaimConnection * gc) { +/* process reply to add_buddy_auth request */ +void qq_process_add_buddy_auth_reply(guint8 *buf, gint buf_len, GaimConnection *gc) +{ qq_data *qd; gint len; guint8 *data, *cursor, reply; @@ -288,16 +272,17 @@ msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT); gaim_notify_error(gc, NULL, _("Add buddy with auth request fails"), msg_utf8); g_free(msg_utf8); - } else + } else { gaim_debug(GAIM_DEBUG_INFO, "QQ", "Add buddy with auth request OK\n"); - } else + } + } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt add buddy with auth reply\n"); + } +} -} // qq_process_add_buddy_auth_reply - -/*****************************************************************************/ -// process the server reply for my request to remove a buddy -void qq_process_remove_buddy_reply(guint8 * buf, gint buf_len, GaimConnection * gc) { +/* process the server reply for my request to remove a buddy */ +void qq_process_remove_buddy_reply(guint8 *buf, gint buf_len, GaimConnection *gc) +{ qq_data *qd; gint len; guint8 *data, *cursor, reply; @@ -312,22 +297,21 @@ if (qq_crypt(DECRYPT, buf, buf_len, qd->session_key, data, &len)) { cursor = data; read_packet_b(data, &cursor, len, &reply); - if (reply != QQ_REMOVE_BUDDY_REPLY_OK) - // there is no reason return from server + if (reply != QQ_REMOVE_BUDDY_REPLY_OK) { + /* there is no reason return from server */ gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Remove buddy fails\n"); - else { // if reply + } else { /* if reply */ gaim_debug(GAIM_DEBUG_INFO, "QQ", "Remove buddy OK\n"); gaim_notify_info(gc, NULL, _("You have successfully removed a buddy"), NULL); } - } else + } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt remove buddy reply\n"); + } +} -} // qq_process_remove_buddy_reply - - -/*****************************************************************************/ -// process the server reply for my request to remove myself from a buddy -void qq_process_remove_self_reply(guint8 * buf, gint buf_len, GaimConnection * gc) { +/* process the server reply for my request to remove myself from a buddy */ +void qq_process_remove_self_reply(guint8 *buf, gint buf_len, GaimConnection *gc) +{ qq_data *qd; gint len; guint8 *data, *cursor, reply; @@ -343,19 +327,19 @@ cursor = data; read_packet_b(data, &cursor, len, &reply); if (reply != QQ_REMOVE_SELF_REPLY_OK) - // there is no reason return from server + /* there is no reason return from server */ gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Remove self fails\n"); - else { // if reply + else { /* if reply */ gaim_debug(GAIM_DEBUG_INFO, "QQ", "Remove self from a buddy OK\n"); gaim_notify_info(gc, NULL, _("You have successfully removed yourself from a buddy"), NULL); } - } else + } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt remove self reply\n"); + } +} -} // qq_process_remove_buddy_reply - -/*****************************************************************************/ -void qq_process_add_buddy_reply(guint8 * buf, gint buf_len, guint16 seq, GaimConnection * gc) { +void qq_process_add_buddy_reply(guint8 *buf, gint buf_len, guint16 seq, GaimConnection *gc) +{ qq_data *qd; gint len, for_uid; gchar *msg, *data, **segments, *uid, *reply; @@ -374,20 +358,21 @@ list = qd->add_buddy_request; while (list != NULL) { req = (qq_add_buddy_request *) list->data; - if (req->seq == seq) { // reply to this + if (req->seq == seq) { /* reply to this */ for_uid = req->uid; qd->add_buddy_request = g_list_remove(qd->add_buddy_request, qd->add_buddy_request->data); g_free(req); break; } list = list->next; - } // while list + } - if (for_uid == 0) { // we have no record for this + if (for_uid == 0) { /* we have no record for this */ gaim_debug(GAIM_DEBUG_ERROR, "QQ", "We have no record for add buddy reply [%d], discard\n", seq); return; - } else + } else { gaim_debug(GAIM_DEBUG_INFO, "QQ", "Add buddy reply [%d] is for id [%d]\n", seq, for_uid); + } data = g_newa(guint8, len); @@ -396,13 +381,13 @@ return; uid = segments[0]; reply = segments[1]; - if (strtol(uid, NULL, 10) != qd->uid) { // should not happen + if (strtol(uid, NULL, 10) != qd->uid) { /* should not happen */ gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Add buddy reply is to [%s], not me!", uid); g_strfreev(segments); return; - } // if uid + } - if (strtol(reply, NULL, 10) > 0) { // need auth + if (strtol(reply, NULL, 10) > 0) { /* need auth */ gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Add buddy attempt fails, need authentication\n"); b = gaim_find_buddy(gc->account, uid_to_gaim_name(for_uid)); if (b != NULL) @@ -419,20 +404,19 @@ (_qq_send_packet_add_buddy_auth_with_gc_and_uid), _("Cancel"), G_CALLBACK(qq_do_nothing_with_gc_and_uid), g); g_free(msg); - } else { // add OK + } else { /* add OK */ qq_add_buddy_by_recv_packet(gc, for_uid, TRUE, TRUE); msg = g_strdup_printf(_("You have added %d in buddy list"), for_uid); gaim_notify_info(gc, NULL, msg, NULL); g_free(msg); - } // if reply + } g_strfreev(segments); - } else + } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Error decrypt add buddy reply\n"); + } +} -} // qq_process_add_buddy_reply - -/*****************************************************************************/ -GaimGroup *qq_get_gaim_group(const gchar * group_name) +GaimGroup *qq_get_gaim_group(const gchar *group_name) { GaimGroup *g; @@ -443,15 +427,15 @@ g = gaim_group_new(group_name); gaim_blist_add_group(g, NULL); gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Add new group: %s\n", group_name); - } // if (g == NULL) + } return g; -} // qq_get_gaim_group +} -/*****************************************************************************/ -// we add new buddy, if the received packet is from someone not in my list -// return the GaimBuddy that is just created -GaimBuddy *qq_add_buddy_by_recv_packet(GaimConnection * gc, guint32 uid, gboolean is_known, gboolean create) { +/* we add new buddy, if the received packet is from someone not in my list + * return the GaimBuddy that is just created */ +GaimBuddy *qq_add_buddy_by_recv_packet(GaimConnection *gc, guint32 uid, gboolean is_known, gboolean create) +{ GaimAccount *a; GaimBuddy *b; GaimGroup *g; @@ -472,8 +456,8 @@ name = uid_to_gaim_name(uid); b = gaim_find_buddy(gc->account, name); - // remove old, we can not simply return here - // because there might be old local copy of this buddy + /* remove old, we can not simply return here + * because there might be old local copy of this buddy */ if (b != NULL) gaim_blist_remove_buddy(b); @@ -488,7 +472,7 @@ qd->buddies = g_list_append(qd->buddies, q_bud); qq_send_packet_get_info(gc, q_bud->uid, FALSE); qq_send_packet_get_buddies_online(gc, QQ_FRIENDS_ONLINE_POSITION_START); - } // if !create + } gaim_blist_add_buddy(b, NULL, g, NULL); gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Add new buddy: [%s]\n", name); @@ -497,14 +481,14 @@ g_free(group_name); return b; -} // qq_add_buddy_by_recv_packet +} -/*****************************************************************************/ -// add a buddy and send packet to QQ server -// note that when gaim load local cached buddy list into its blist -// it also calls this funtion, so we have to -// define qd->logged_in=TRUE AFTER serv_finish_login(gc) -void qq_add_buddy(GaimConnection * gc, GaimBuddy * buddy, GaimGroup * group) { +/* add a buddy and send packet to QQ server + * note that when gaim load local cached buddy list into its blist + * it also calls this funtion, so we have to + * define qd->logged_in=TRUE AFTER serv_finish_login(gc) */ +void qq_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) +{ qq_data *qd; guint32 uid; GaimBuddy *b; @@ -513,7 +497,7 @@ qd = (qq_data *) gc->proto_data; if (!qd->logged_in) - return; // IMPORTANT ! + return; /* IMPORTANT ! */ uid = gaim_name_to_uid(buddy->name); if (uid > 0) @@ -526,11 +510,11 @@ _("QQid Error"), _("Invalid QQid, to add buddy 1234567, \nyou should input qq-1234567")); } -} // _qq_add_buddy +} -/*****************************************************************************/ -// remove a buddy and send packet to QQ server accordingly -void qq_remove_buddy(GaimConnection * gc, GaimBuddy * buddy, GaimGroup * group) { +/* remove a buddy and send packet to QQ server accordingly */ +void qq_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) +{ qq_data *qd; GaimBuddy *b; qq_buddy *q_bud; @@ -554,18 +538,16 @@ qd->buddies = g_list_remove(qd->buddies, q_bud); else gaim_debug(GAIM_DEBUG_WARNING, "QQ", "We have no qq_buddy record for %s\n", buddy->name); - // remove buddy on blist, this does not trigger qq_remove_buddy again - // do this only if the request comes from block request, - // otherwise gaim segmentation fault - if (g_ascii_strcasecmp(group->name, GAIM_GROUP_QQ_BLOCKED) - == 0) + /* remove buddy on blist, this does not trigger qq_remove_buddy again + * do this only if the request comes from block request, + * otherwise gaim segmentation fault */ + if (g_ascii_strcasecmp(group->name, GAIM_GROUP_QQ_BLOCKED) == 0) gaim_blist_remove_buddy(b); - } // if b != NULL -} // _qq_remove_buddy + } +} -/*****************************************************************************/ -// free add buddy request queue -void qq_add_buddy_request_free(qq_data * qd) +/* free add buddy request queue */ +void qq_add_buddy_request_free(qq_data *qd) { gint i; qq_add_buddy_request *p; @@ -580,11 +562,10 @@ i++; } gaim_debug(GAIM_DEBUG_INFO, "QQ", "%d add buddy requests are freed!\n", i); -} // qq_add_buddy_request_free +} -/*****************************************************************************/ -// free up all qq_buddy -void qq_buddies_list_free(GaimAccount *account, qq_data * qd) +/* free up all qq_buddy */ +void qq_buddies_list_free(GaimAccount *account, qq_data *qd) { gint i; qq_buddy *p; @@ -597,21 +578,16 @@ while (qd->buddies) { p = (qq_buddy *) (qd->buddies->data); qd->buddies = g_list_remove(qd->buddies, p); - // added by gfhuang, for relogin crash bug name = uid_to_gaim_name(p->uid); b = gaim_find_buddy(account, name); - if(b != NULL) b->proto_data = NULL; - else { + if(b != NULL) + b->proto_data = NULL; + else gaim_debug(GAIM_DEBUG_INFO, "QQ", "qq_buddy %s not found in gaim proto_data\n", name); - } g_free(name); g_free(p); i++; } gaim_debug(GAIM_DEBUG_INFO, "QQ", "%d qq_buddy structures are freed!\n", i); - -} // qq_buddies_list_free - -/*****************************************************************************/ -// END OF FILE +} Modified: trunk/src/protocols/qq/buddy_opt.h =================================================================== --- trunk/src/protocols/qq/buddy_opt.h 2006-08-02 13:37:13 UTC (rev 16617) +++ trunk/src/protocols/qq/buddy_opt.h 2006-08-02 15:35:36 UTC (rev 16618) @@ -20,15 +20,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// START OF FILE -/*****************************************************************************/ #ifndef _QQ_BUDDY_OPT_H_ #define _QQ_BUDDY_OPT_H_ #include <glib.h> -#include "connection.h" // GaimConnection +#include "connection.h" -#include "qq.h" // qq_buddy +#include "qq.h" typedef struct _gc_and_uid gc_and_uid; @@ -37,29 +35,26 @@ GaimConnection *gc; }; -void qq_approve_add_request_with_gc_and_uid(gc_and_uid * g); +void qq_approve_add_request_with_gc_and_uid(gc_and_uid *g); +void qq_reject_add_request_with_gc_and_uid(gc_and_uid *g); -void qq_reject_add_request_with_gc_and_uid(gc_and_uid * g); +void qq_add_buddy_with_gc_and_uid(gc_and_uid *g); +void qq_block_buddy_with_gc_and_uid(gc_and_uid *g); -void qq_add_buddy_wi... [truncated message content] |
From: <sa...@us...> - 2006-08-02 13:37:16
|
Revision: 16617 Author: sadrul Date: 2006-08-02 06:37:13 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16617&view=rev Log Message: ----------- Minor tweaks to the context-menu in the buddylist. Modified Paths: -------------- trunk/console/gntblist.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-02 08:12:04 UTC (rev 16616) +++ trunk/console/gntblist.c 2006-08-02 13:37:13 UTC (rev 16617) @@ -393,7 +393,10 @@ { void (*callback)(GaimBlistNode *, gpointer); callback = (void (*)(GaimBlistNode *, gpointer))action->callback; - callback(node, action->data); + if (callback) + callback(node, action->data); + else + return; } remove_context_menu(ggblist); @@ -521,7 +524,8 @@ window = gnt_vbox_new(FALSE); gnt_box_set_toplevel(GNT_BOX(window), TRUE); gnt_box_set_title(GNT_BOX(window), title); - + + gnt_widget_set_size(context, 0, g_list_length(GNT_TREE(context)->list)); gnt_box_add_widget(GNT_BOX(window), context); /* Set the position for the popup */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-02 08:12:07
|
Revision: 16616 Author: thekingant Date: 2006-08-02 01:12:04 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16616&view=rev Log Message: ----------- The Gaim project has lost a lot of momentum. Do you think it's because we haven't released in a while? Modified Paths: -------------- web/htdocs/summerofcode/2005.html Modified: web/htdocs/summerofcode/2005.html =================================================================== --- web/htdocs/summerofcode/2005.html 2006-08-02 06:24:38 UTC (rev 16615) +++ web/htdocs/summerofcode/2005.html 2006-08-02 08:12:04 UTC (rev 16616) @@ -64,7 +64,7 @@ </li> <li> -Collaborative Code Editor (Chisthian Kim) - TODO +Collaborative Code Editor (Chisthian Kim) - Incomplete. </li> </ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-02 06:24:42
|
Revision: 16615 Author: sadrul Date: 2006-08-01 23:24:38 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16615&view=rev Log Message: ----------- Fix a crash. Modified Paths: -------------- trunk/console/gntrequest.c Modified: trunk/console/gntrequest.c =================================================================== --- trunk/console/gntrequest.c 2006-08-02 06:22:33 UTC (rev 16614) +++ trunk/console/gntrequest.c 2006-08-02 06:24:38 UTC (rev 16615) @@ -158,7 +158,8 @@ 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); + if (callback) + callback(data, id); gaim_request_close(GAIM_REQUEST_ACTION, window); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-02 06:22:41
|
Revision: 16614 Author: sadrul Date: 2006-08-01 23:22:33 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16614&view=rev Log Message: ----------- Allow setting aliases for buddies/chats/groups. Modified Paths: -------------- trunk/console/gntblist.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-02 05:44:42 UTC (rev 16613) +++ trunk/console/gntblist.c 2006-08-02 06:22:33 UTC (rev 16614) @@ -35,6 +35,7 @@ static void add_node(GaimBlistNode *node, GGBlist *ggblist); static void draw_tooltip(GGBlist *ggblist); static void remove_peripherals(GGBlist *ggblist); +static const char * get_display_name(GaimBlistNode *node); static void new_node(GaimBlistNode *node) @@ -84,6 +85,12 @@ static void node_update(GaimBuddyList *list, GaimBlistNode *node) { + if (node->ui_data != NULL) + { + gnt_tree_change_text(GNT_TREE(ggblist->tree), node, + 0, get_display_name(node)); + } + if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimBuddy *buddy = (GaimBuddy*)node; @@ -133,7 +140,7 @@ return; gnt_tree_remove(GNT_TREE(ggblist->tree), group); node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, - gnt_tree_create_row(GNT_TREE(ggblist->tree), group->name), NULL, NULL); + gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), NULL, NULL); } static const char * @@ -177,6 +184,8 @@ strncpy(status, "~", sizeof(status) - 1); } + else if (GAIM_BLIST_NODE_IS_GROUP(node)) + return ((GaimGroup*)node)->name; snprintf(text, sizeof(text) - 1, "%s %s", status, name); @@ -391,8 +400,44 @@ } static void +rename_blist_node(GaimBlistNode *node, const char *newname) +{ + const char *name = newname; + if (name && !*name) + name = NULL; + + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + gaim_blist_alias_buddy((GaimBuddy*)node, name); + else if (GAIM_BLIST_NODE_IS_CHAT(node)) + gaim_blist_alias_chat((GaimChat*)node, name); + else if (GAIM_BLIST_NODE_IS_GROUP(node)) + gaim_blist_rename_group((GaimGroup*)node, name); + else + g_return_if_reached(); +} + +static void gg_blist_rename_node_cb(GaimBlistNode *node, GaimBlistNode *null) { + const char *name = NULL; + char *prompt; + + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + name = gaim_buddy_get_contact_alias((GaimBuddy*)node); + else if (GAIM_BLIST_NODE_IS_CHAT(node)) + name = gaim_chat_get_name((GaimChat*)node); + else if (GAIM_BLIST_NODE_IS_GROUP(node)) + name = ((GaimGroup*)node)->name; + else + g_return_if_reached(); + + prompt = g_strdup_printf(_("Please enter the new name for %s"), name); + + gaim_request_input(node, _("Rename"), prompt, _("Enter empty string to reset the name."), + name, FALSE, FALSE, NULL, _("Rename"), G_CALLBACK(rename_blist_node), + _("Cancel"), NULL, node); + + g_free(prompt); } /* XXX: This still doesn't do anything, because request doesn't have a ui yet */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <may...@us...> - 2006-08-02 05:44:50
|
Revision: 16613 Author: mayuan2006 Date: 2006-08-01 22:44:42 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16613&view=rev Log Message: ----------- add oim retrieve,can get oim message write the framework of oim send Committed by MaYuan <may...@gm...> Modified Paths: -------------- branches/soc-2006-msnp13/src/protocols/msn/contact.c branches/soc-2006-msnp13/src/protocols/msn/contact.h branches/soc-2006-msnp13/src/protocols/msn/oim.c branches/soc-2006-msnp13/src/protocols/msn/oim.h branches/soc-2006-msnp13/src/protocols/msn/soap.c Modified: branches/soc-2006-msnp13/src/protocols/msn/contact.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-08-02 02:42:14 UTC (rev 16612) +++ branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-08-02 05:44:42 UTC (rev 16613) @@ -419,35 +419,39 @@ void msn_add_contact(MsnContact *contact) { - + gaim_debug_info("MaYuan","msn add a contact...\n"); } /*delete a Contact*/ void msn_delete_contact(MsnContact *contact) { - + gaim_debug_info("MaYuan","msn delete a contact...\n"); } /*block a Contact*/ void msn_block_contact(MsnContact *contact) { - + gaim_debug_info("MaYuan","msn block a contact...\n"); } /*unblock a contact*/ void msn_unblock_contact(MsnContact *contact) { - + gaim_debug_info("MaYuan","msn unblock a contact...\n"); } /*get the gleams info*/ void msn_get_gleams(MsnContact *contact) { - + gaim_debug_info("MaYuan","msn get gleams info...\n"); + /*build SOAP and POST it*/ + contact->soapconn->login_path = g_strdup(MSN_GET_ADDRESS_POST_URL); + contact->soapconn->soap_action = g_strdup(MSN_GET_ADDRESS_SOAP_ACTION); + msn_soap_post(contact->soapconn,MSN_GLEAMS_TEMPLATE,msn_address_written_cb); } void Modified: branches/soc-2006-msnp13/src/protocols/msn/contact.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/contact.h 2006-08-02 02:42:14 UTC (rev 16612) +++ branches/soc-2006-msnp13/src/protocols/msn/contact.h 2006-08-02 05:44:42 UTC (rev 16613) @@ -81,7 +81,7 @@ "</soap:Envelope>" /*Gleams SOAP request template*/ -#define MSN_GLEAMS_TEMPLATE = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ +#define MSN_GLEAMS_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ "<soap:Header>"\ "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ Modified: branches/soc-2006-msnp13/src/protocols/msn/oim.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/oim.c 2006-08-02 02:42:14 UTC (rev 16612) +++ branches/soc-2006-msnp13/src/protocols/msn/oim.c 2006-08-02 05:44:42 UTC (rev 16613) @@ -27,6 +27,9 @@ #include "soap.h" #include "oim.h" +/*Local Function Prototype*/ +static void msn_oim_post_single_get_msg(MsnOim *oim,const char *msgid); + /*new a OIM object*/ MsnOim * msn_oim_new(MsnSession *session) @@ -36,6 +39,7 @@ oim = g_new0(MsnOim, 1); oim->session = session; oim->retrieveconn = msn_soap_new(session,oim,1); + oim->oim_list = NULL; oim->sendconn = msn_soap_new(session,oim,1); return oim; @@ -82,12 +86,54 @@ g_return_if_fail(session != NULL); } +static void +msn_oim_send_read_cb(gpointer data, GaimSslConnection *gsc, + GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + MsnOim * msnoim; + + gaim_debug_info("MaYuan","read buffer:{%s}\n",soapconn->body); +} + +static void +msn_oim_send_written_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + + soapconn->read_cb = msn_oim_send_read_cb; + msn_soap_read_cb(data,source,cond); +} + +/*pose single message to oim server*/ +void msn_oim_send_single_msg(MsnOim *oim,char * msg) +{ + const char *oimsoapbody,*t,*p; + + gaim_debug_info("MaYuan","send single OIM Message\n"); + oim->sendconn->login_path = g_strdup(MSN_OIM_SEND_URL); + oim->sendconn->soap_action = g_strdup(MSN_OIM_SEND_SOAP_ACTION); + t = oim->session->passport_info.t; + p = oim->session->passport_info.p; +#if 0 + oimsoapbody = g_strdup_printf(MSN_OIM_SEND_TEMPLATE, + membername, + friendname, + tomember, + mspauth, + prod_id, + lock_key, + msg_num, + msg + ); +#endif + msn_soap_post(oim->retrieveconn, oimsoapbody, msn_oim_send_written_cb); + +} + void msn_oim_send_msg(MsnOim *oim,char *msg) { if(msn_soap_connected(oim->sendconn) == -1){ - msn_soap_init(oim->sendconn,MSN_OIM_SEND_HOST,1, - msn_oim_send_connect_cb, - msn_oim_send_error_cb); } } @@ -122,6 +168,10 @@ session = oim->session; g_return_if_fail(session != NULL); + + gaim_debug_info("MaYuan","oim get SOAP Server connected!\n"); + /*call to get the message*/ + msn_oim_get_msg(oim); } static void @@ -145,7 +195,7 @@ /*get the conversation*/ static GaimConversation * -msn_oim_get_conv(MsnOim *oim,char *passport) +msn_oim_get_conv(MsnOim *oim,const char *passport) { GaimAccount *account; GaimConversation * conv; @@ -193,21 +243,21 @@ nickname = xmlnode_get_data(nNode); gaim_debug_info("MaYuan","E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); // msn_oim_report_user(oim,passport,"hello"); - msn_oim_get_msg(oim,msgid); + oim->oim_list = g_list_append(oim->oim_list,msgid); } + if(msn_soap_connected(oim->retrieveconn) == -1){ + gaim_debug_info("MaYuan","retreive OIM server not connected! We need to connect it first\n"); + msn_oim_connect(oim); + return; + } + msn_oim_get_msg(oim); } -/*MSN OIM get SOAP request*/ -void msn_oim_get_msg(MsnOim *oim,char *msgid) +static void msn_oim_post_single_get_msg(MsnOim *oim,const char *msgid) { - const char *oimid ,*oimsoapbody,*t,*p; + const char *oimsoapbody,*t,*p; - if(msn_soap_connected(oim->retrieveconn) == -1){ - gaim_debug_info("MaYuan","retreive OIM server not connected!\n"); - return; - } - - gaim_debug_info("MaYuan","Get OIM with SOAP \n"); + gaim_debug_info("MaYuan","Get single OIM Message\n"); oim->retrieveconn->login_path = g_strdup(MSN_OIM_RETRIEVE__URL); oim->retrieveconn->soap_action = g_strdup(MSN_OIM_GET_SOAP_ACTION); t = oim->session->passport_info.t; @@ -219,20 +269,39 @@ msgid ); msn_soap_post(oim->retrieveconn, oimsoapbody, msn_oim_get_written_cb); + } +/*MSN OIM get SOAP request*/ +void msn_oim_get_msg(MsnOim *oim) +{ + GList *list; + + gaim_debug_info("MaYuan","Get OIM with SOAP \n"); +// gaim_debug_info("MaYuan","oim->oim_list:%p,data:%s \n",oim->oim_list,oim->oim_list->data); + for(list = oim->oim_list; list!= NULL;list = g_list_next(list)){ + msn_oim_post_single_get_msg(oim,list->data); + oim->oim_list = g_list_remove(oim->oim_list, list->data); + } +} + /*msn oim server connect*/ void msn_oim_connect(MsnOim *oim) { gaim_debug_info("MaYuan","msn_oim_connect...\n"); - msn_soap_init(oim->retrieveconn,MSN_OIM_RETRIEVE_HOST,1, + if(msn_soap_connected(oim->retrieveconn) == -1){ + msn_soap_init(oim->retrieveconn,MSN_OIM_RETRIEVE_HOST,1, msn_oim_get_connect_cb, msn_oim_get_error_cb); - msn_soap_init(oim->sendconn,MSN_OIM_SEND_HOST,1, + } + + if(msn_soap_connected(oim->sendconn) == -1){ + msn_soap_init(oim->sendconn,MSN_OIM_SEND_HOST,1, msn_oim_send_connect_cb, msn_oim_send_error_cb); + } } /*endof oim.c*/ Modified: branches/soc-2006-msnp13/src/protocols/msn/oim.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/oim.h 2006-08-02 02:42:14 UTC (rev 16612) +++ branches/soc-2006-msnp13/src/protocols/msn/oim.h 2006-08-02 05:44:42 UTC (rev 16613) @@ -90,18 +90,26 @@ MsnSession *session; MsnSoapConn *retrieveconn; + GList * oim_list; MsnSoapConn *sendconn; gint LockKeyChallenge; }; -/*function prototype*/ +/**************************************************** + * function prototype + * **************************************************/ MsnOim * msn_oim_new(MsnSession *session); void msn_oim_destroy(MsnOim *oim); void msn_oim_connect(MsnOim *oim); void msn_parse_oim_msg(MsnOim *oim,char *xmlmsg); -void msn_oim_get_msg(MsnOim *oim,char *msgid); +/*get the OIM message*/ +void msn_oim_get_msg(MsnOim *oim); + +/*report the oim message to the conversation*/ +void msn_oim_report_user(MsnOim *oim,const char *passport,char *msg); + #endif/* _MSN_OIM_H_*/ /*endof oim.h*/ Modified: branches/soc-2006-msnp13/src/protocols/msn/soap.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/soap.c 2006-08-02 02:42:14 UTC (rev 16612) +++ branches/soc-2006-msnp13/src/protocols/msn/soap.c 2006-08-02 05:44:42 UTC (rev 16613) @@ -399,7 +399,7 @@ char * soap_body = NULL; char * request_str = NULL; - gaim_debug_info("MaYuan","msn_get_address_book()...\n"); + gaim_debug_info("MaYuan","msn_soap_post()...\n"); soap_body = g_strdup_printf(body); soap_head = g_strdup_printf( "POST %s HTTP/1.1\r\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2006-08-02 02:42:19
|
Revision: 16612 Author: roast Date: 2006-08-01 19:42:14 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16612&view=rev Log Message: ----------- log_reader: trillian_logger_read() now uses giochannels Modified Paths: -------------- branches/soc-2006-file-loggers/plugins/log_reader.c Modified: branches/soc-2006-file-loggers/plugins/log_reader.c =================================================================== --- branches/soc-2006-file-loggers/plugins/log_reader.c 2006-08-02 02:23:04 UTC (rev 16611) +++ branches/soc-2006-file-loggers/plugins/log_reader.c 2006-08-02 02:42:14 UTC (rev 16612) @@ -1279,7 +1279,9 @@ { struct trillian_logger_data *data; char *read; - FILE *file; + int filedes = 0; + GIOChannel *channel; + GIOStatus iostat; GaimBuddy *buddy; char *escaped; GString *formatted; @@ -1299,10 +1301,33 @@ read = g_malloc(data->length + 2); - file = g_fopen(data->path, "rb"); - fseek(file, data->offset, SEEK_SET); - fread(read, data->length, 1, file); - fclose(file); + // try to open the file + if (!(filedes = open(data->path, O_RDONLY))) { + return g_strdup_printf(_("<font color=\"red\"><b>Could not read file: %s</b></font>"), data->path); + } + // create the giochannel + channel = g_io_channel_unix_new(filedes); + // read from it + if (g_io_channel_read_to_end(channel, &read, NULL, NULL) != G_IO_STATUS_NORMAL) { + // if reading the file wasn't successful... + close(filedes); + return g_strdup("Trillian Log Failed to read the file"); + } + // seek to the right position + iostat = g_io_channel_seek_position(channel, data->offset, G_SEEK_SET, NULL); + if (iostat == G_IO_STATUS_ERROR) { + gaim_debug_info("log_reader", "trillian_logger_read could not seek to the right place to read data from\n"); + return g_strdup_printf(_("<font color=\"red\"><b>Could not read file: %s</b></font>"), data->path); + } + // read data->length long + iostat = g_io_channel_read_chars(channel, read, data->length, NULL, NULL); + if (iostat == G_IO_STATUS_ERROR) { + gaim_debug_info("log_reader", "trillian_logger_read could not read data from the logfile\n"); + return g_strdup_printf(_("<font color=\"red\"><b>Could not read file: %s</b></font>"), data->path); + } + // we're done reading + g_io_channel_shutdown(channel, FALSE, NULL); + close(filedes); if (read[data->length-1] == '\n') { read[data->length] = '\0'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2006-08-02 02:23:10
|
Revision: 16611 Author: roast Date: 2006-08-01 19:23:04 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16611&view=rev Log Message: ----------- log_reader: adium_logger_read() now uses giochannels Modified Paths: -------------- branches/soc-2006-file-loggers/plugins/log_reader.c Modified: branches/soc-2006-file-loggers/plugins/log_reader.c =================================================================== --- branches/soc-2006-file-loggers/plugins/log_reader.c 2006-08-01 19:52:51 UTC (rev 16610) +++ branches/soc-2006-file-loggers/plugins/log_reader.c 2006-08-02 02:23:04 UTC (rev 16611) @@ -238,51 +238,57 @@ static char *adium_logger_read (GaimLog *log, GaimLogReadFlags *flags) { struct adium_logger_data *data; - GError *error = NULL; gchar *read = NULL; - gsize length; + int filedes = 0; + GIOChannel *channel; + + // covered by gaim_log_read g_return_val_if_fail(log != NULL, g_strdup("")); data = log->logger_data; - g_return_val_if_fail(data->path != NULL, g_strdup("")); + g_return_val_if_fail(data->path != NULL, g_strdup(_("<font color=\"red\"><b>Unable to find log path!</b></font>"))); - gaim_debug(GAIM_DEBUG_INFO, "Adium log read", - "Reading %s\n", data->path); - if (!g_file_get_contents(data->path, &read, &length, &error)) { - gaim_debug(GAIM_DEBUG_ERROR, "Adium log read", - "Error reading log\n"); - if (error) - g_error_free(error); - return g_strdup(""); - } + gaim_debug(GAIM_DEBUG_INFO, "Adium log read", "Reading %s\n", data->path); - if (data->type != ADIUM_HTML) { - char *escaped = g_markup_escape_text(read, -1); - g_free(read); - read = escaped; - } + if ((filedes = open(data->path, O_RDONLY))) { + channel = g_io_channel_unix_new(filedes); + if (g_io_channel_read_to_end(channel, &read, NULL, NULL) == G_IO_STATUS_NORMAL) { + if (data->type != ADIUM_HTML) { + char *escaped = g_markup_escape_text(read, -1); + g_free(read); + read = escaped; + } + #ifdef WIN32 - /* This problem only seems to show up on Windows. - * The BOM is displaying as a space at the beginning of the log. - */ - if (gaim_str_has_prefix(read, "\xef\xbb\xbf")) - { - /* FIXME: This feels so wrong... */ - char *temp = g_strdup(&(read[3])); - g_free(read); - read = temp; - } + /* This problem only seems to show up on Windows. + * The BOM is displaying as a space at the beginning of the log. + */ + if (gaim_str_has_prefix(read, "\xef\xbb\xbf")) { + /* FIXME: This feels so wrong... */ + char *temp = g_strdup(&(read[3])); + g_free(read); + read = temp; + } #endif - /* TODO: Apply formatting. - * Replace the above hack with something better, since we'll - * be looping over the entire log file contents anyway. - */ + /* TODO: Apply formatting. + * Replace the above hack with something better, since we'll + * be looping over the entire log file contents anyway. + */ - return read; + g_io_channel_shutdown(channel, FALSE, NULL); + close(filedes); + return read; + } + + close(filedes); // closed when g_io_channel_unix_new fails + } + + gaim_debug(GAIM_DEBUG_ERROR, "Adium log read", "Error reading log\n"); + return g_strdup_printf(_("<font color=\"red\"><b>Could not read Adium log file: %s</b></font>"), data->path); } static int adium_logger_size (GaimLog *log) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-01 19:53:05
|
Revision: 16610 Author: markhuetsch Date: 2006-08-01 12:52:51 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16610&view=rev Log Message: ----------- Silenced a few warnings. Modified Paths: -------------- trunk/src/protocols/qq/qq.c trunk/src/protocols/qq/utils.c Modified: trunk/src/protocols/qq/qq.c =================================================================== --- trunk/src/protocols/qq/qq.c 2006-08-01 19:52:48 UTC (rev 16609) +++ trunk/src/protocols/qq/qq.c 2006-08-01 19:52:51 UTC (rev 16610) @@ -444,7 +444,6 @@ g_return_if_fail(gc != NULL && gc->proto_data != NULL); qd = (qq_data *) gc->proto_data; - //_qq_get_info(gc, uid_to_gaim_name(qd->uid)); qq_prepare_modify_info(gc); } Modified: trunk/src/protocols/qq/utils.c =================================================================== --- trunk/src/protocols/qq/utils.c 2006-08-01 19:52:48 UTC (rev 16609) +++ trunk/src/protocols/qq/utils.c 2006-08-01 19:52:51 UTC (rev 16610) @@ -92,7 +92,7 @@ g_memmove(input, data, len); input[len] = 0x00; - segments = g_strsplit(input, delimit, 0); + segments = g_strsplit((gchar *) input, delimit, 0); if (expected_fields <= 0) return segments; @@ -123,9 +123,12 @@ // the return needs to be freed gchar *gen_ip_str(guint8 *ip) { - if (ip == NULL || ip[0] == 0) - return g_strdup_printf(""); - else + gchar *ret; + if (ip == NULL || ip[0] == 0) { + ret = g_new(gchar, 1); + *ret = '\0'; + return ret; + } else return g_strdup_printf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); } @@ -189,7 +192,7 @@ if (incoming[i] >= 0x81) break; - msg_utf8 = i < len ? qq_to_utf8(&incoming[i], QQ_CHARSET_DEFAULT) : NULL; + msg_utf8 = i < len ? qq_to_utf8((gchar *) &incoming[i], QQ_CHARSET_DEFAULT) : NULL; if (msg_utf8 != NULL) { gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Try extract GB msg: %s\n", msg_utf8); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-01 19:52:55
|
Revision: 16609 Author: sadrul Date: 2006-08-01 12:52:48 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16609&view=rev Log Message: ----------- Let's behave properly when someone's asking for help, ai? Modified Paths: -------------- trunk/console/gntgaim.c Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-08-01 19:34:43 UTC (rev 16608) +++ trunk/console/gntgaim.c 2006-08-01 19:52:48 UTC (rev 16609) @@ -140,9 +140,9 @@ char *text; if (terse) { - text = g_strdup_printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name); + text = g_strdup_printf(_("%s. Try `%s -h' for more information.\n"), VERSION, name); } else { - text = g_strdup_printf(_("Gaim %s\n" + text = g_strdup_printf(_("%s\n" "Usage: %s [OPTION]...\n\n" " -c, --config=DIR use DIR for config files\n" " -d, --debug print debugging messages to stdout\n" @@ -151,6 +151,7 @@ " -v, --version display the current version and exit\n"), VERSION, name); } + gnt_quit(); gaim_print_utf8_to_console(stdout, text); g_free(text); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dat...@us...> - 2006-08-01 19:34:53
|
Revision: 16608 Author: datallah Date: 2006-08-01 12:34:43 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16608&view=rev Log Message: ----------- Updated instructions for using spell-checking when running gaim from a USB drive. Modified Paths: -------------- web/htdocs/win32/index.php Modified: web/htdocs/win32/index.php =================================================================== --- web/htdocs/win32/index.php 2006-08-01 17:39:47 UTC (rev 16607) +++ web/htdocs/win32/index.php 2006-08-01 19:34:43 UTC (rev 16608) @@ -21,7 +21,7 @@ <li><a href="#bugs">Major Windows Gaim Bugs & Workarounds</a></li> <li><a href="#wingtk">Standalone GTK+ Installer</a></li> <li><a href="#autoinst">Unattended Installations</a></li> -<li><a href="#spelling">Windows Gaim Spell Checking</a></li> +<li><a href="#spelling">Windows Gaim Spell-checking</a></li> <li><a href="#perl">Perl Plugin Support</a></li> <li><a href="#tcl">TCL Plugin Support</a></li> <li><a href="#debug">Windows Gaim Crash Reporting - Howto</a></li> @@ -138,10 +138,10 @@ gaim-<?php print $current_win32_version; ?>-no-gtk.exe /L=1033 /S /D=C:\Gaim</code></pre> <p>The GTK+ installer has two silent states. One with message boxes: <code>/S</code>, and one without: <code>/S /NOUI</code>. The reason for this is that the installer was made to run from within the Gaim installer where you would expect to see message boxes for errors.</p> -<h2 id="spelling">Gaim Spell Checking</h2> +<h2 id="spelling">Gaim Spell-checking</h2> <h3>Aspell and Aspell dictionary installers</h3> -<p>I will no longer support the aspell and aspell dict installers that I had previously posted here. From now on, Gaim will use the win32 aspell distribution from <a href="http://aspell.net/win32">aspell.net/win32</a>. To make use of Win Gaim's spell check feature you will need to download and install the aspell installer and at least one language dictionary. If you choose not to install Aspell, Gaim will still work. Gaim will also work with Aspell from previous Gaim installations.</p> -<p>Note: Don't forget to turn on spell checking in preferences.</p> +<p>I will no longer support the aspell and aspell dict installers that I had previously posted here. From now on, Gaim will use the win32 aspell distribution from <a href="http://aspell.net/win32">aspell.net/win32</a>. To make use of Win Gaim's spell-checking feature you will need to download and install the aspell installer and at least one language dictionary. If you choose not to install Aspell, Gaim will still work. Gaim will also work with Aspell from previous Gaim installations.</p> +<p>Note: Don't forget to turn on "Highlight misspelled words" in the preferences.</p> <h2 id="perl">Perl Plugin Support</h2> <p>To enable Perl Plugins in Win Gaim, you need to download and install <a href="http://www.activestate.com/Products/Language_Distributions/">ActivePerl</a> 5.8, before installing Gaim (v0.69 and higher). If Gaim complains about not finding <code>perl58.dll</code>, add the Perl bin dirctory to your <code>PATH</code>.</p> @@ -157,7 +157,7 @@ <p>The way that this is set up, other GTK+ applications can use the same GTK+ runtime.</p> <p>Caveats</p> <ul> - <li>SpellChecking doesn't work yet, it requires some minor changes that aren't in a released version of Gaim yet.</li> + <li>Spell-checking requires 2.0.0 beta3 or newer.</li> </ul> <h3>How to setup your USB-Drive Gaim</h3> <ul> @@ -173,7 +173,7 @@ <li>Copy the whole <code>pixmaps</code> and <code>sounds</code> directories.</li> <li>Create a <code>U:\Programs\Gaim\plugins</code> directory and copy the contents of the installed <code>Gaim\plugins</code> directory into it excluding <code>perl.dll</code>, <code>tcl.dll</code>.</li> <li>If you want to use a language other than en_US, create a <code>U:\Programs\Gaim\locale</code> directory and copy any language directories that you want from your installed <code>Gaim\locale</code> directory.</li> - <li>Copy the contents of your root installed Gaim directory except <code>gaim.exe</code>, <code>gaim-uninst.exe</code>, and if you don't want spellchecking support, <code>libgtkspell.dll</code>.</li> + <li>Copy the contents of your root installed Gaim directory except <code>gaim.exe</code>, <code>gaim-uninst.exe</code>, and if you don't want spell-checking support, <code>libgtkspell.dll</code>.</li> <li>Download <a href="gaim-portable.exe">gaim-portable.exe</a> and put it in <code>U:\Programs\Gaim</code>. The file uses the same source as the standard <code>gaim.exe</code> from versions 2.0.0 and newer, the difference being that when it was compiled <code>PORTABLE</code> was defined which causes some of the initialization to be done differently.</li> </ul> </li> @@ -184,5 +184,12 @@ <li>If you want to use a language other than en_US, create a <code>U:\Programs\GTK\lib\locale</code> directory and copy any language directories that you want from your installed GTK+ runtime's <code>lib\locale</code> directory.</li> </ul> </li> + <li>If you want spell-checking support, you will also need to create a minimal ASpell runtime installation from your ASpell installation. + <ul> + <li>Create a <code>U:\Programs\Aspell</code> directory with a <code>bin</code> subdirectory.</li> + <li>Copy <code>aspell-15.dll</code> into your ASpell <code>bin</code> directory.</li> + <li>Copy the <code>data</code> and <code>dict</code> subdirectories into <code>U:\Programs\Aspell</code>.</li> + </ul> + </li> <li>You are done! Running <code>U:\Programs\Gaim\gaim-portable.exe</code> will cause gaim to run off the USB Drive, saving the settings, logs and etc. to <code>U:\Programs\.gaim</code>.</li> </ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-01 17:40:13
|
Revision: 16607 Author: markhuetsch Date: 2006-08-01 10:39:47 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16607&view=rev Log Message: ----------- Added a debugging tool for firing custom packets at the QQ server. Modified Paths: -------------- trunk/src/protocols/qq/qq.c trunk/src/protocols/qq/utils.c trunk/src/protocols/qq/utils.h Modified: trunk/src/protocols/qq/qq.c =================================================================== --- trunk/src/protocols/qq/qq.c 2006-08-01 16:15:39 UTC (rev 16606) +++ trunk/src/protocols/qq/qq.c 2006-08-01 17:39:47 UTC (rev 16607) @@ -51,6 +51,7 @@ #include "keep_alive.h" #include "ip_location.h" /* qq_ip_get_location */ #include "login_logout.h" +#include "packet_parse.h" /* MAX_PACKET_SIZE */ #include "qq_proxy.h" /* qq_connect, qq_disconnect */ #include "send_core.h" #include "qq.h" @@ -447,10 +448,9 @@ qq_prepare_modify_info(gc); } - static void _qq_menu_change_password(GaimPluginAction * action) { - gaim_notify_uri(NULL, "https://password.qq.com"); + gaim_notify_uri(NULL, "https://password.qq.com"); } /* remove a buddy from my list and remove myself from his list */ @@ -663,7 +663,58 @@ // } } */ +/* +static void _qq_send_custom_packet(GaimConnection *gc, const gchar *packet) +{ + guint16 cmd; + guint8 *buffer; + gint len; + if (!packet) { + gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Null packet inputted!\n"); + return; + } + if (strlen(packet) > MAX_PACKET_SIZE * 2) { + gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Packet inputted is too large!\n"); + return; + } + if (strlen(packet) < 4) { + gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Packet is impossibly short!\n"); + return; + } + + buffer = hex_str_to_bytes(packet); + if (!buffer) { + gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Invalid packet inputted!\n"); + return; + } + // big endian + cmd = 256 * buffer[0] + buffer[1]; + gaim_debug(GAIM_DEBUG_INFO, "QQ", "Inputted CMD: %d\n", cmd); + + len = strlen(buffer) - 2; + packet = buffer + 2; + + qq_send_cmd(gc, cmd, TRUE, 0, TRUE, packet, len); + + g_free(buffer); +} +*/ + +/* send a custom packet to the server - for protocol testing */ +/* +static void _qq_menu_send_custom_packet(GaimPluginAction *action) +{ + GaimConnection *gc = (GaimConnection *) action->context; + g_return_if_fail(gc != NULL); + gaim_request_input(gc, _("Send Custom Packet"), + _("Enter the packet in hex here"), + _("Include the command and everything following"), + NULL, FALSE, FALSE, NULL, + _("Send"), G_CALLBACK(_qq_send_custom_packet), _("Cancel"), NULL, gc); +} +*/ + /* protocol related menus */ static GList *_qq_actions(GaimPlugin * plugin, gpointer context) { @@ -680,6 +731,11 @@ act = gaim_plugin_action_new(_("Show Login Information"), _qq_menu_show_login_info); m = g_list_append(m, act); + /* + act = gaim_plugin_action_new(_("Send Custom Packet"), _qq_menu_send_custom_packet); + m = g_list_append(m, act); + */ + /* XXX consider re-enabling this act = gaim_plugin_action_new(_("Show System Message"), _qq_menu_show_system_message); m = g_list_append(m, act); Modified: trunk/src/protocols/qq/utils.c =================================================================== --- trunk/src/protocols/qq/utils.c 2006-08-01 16:15:39 UTC (rev 16606) +++ trunk/src/protocols/qq/utils.c 2006-08-01 17:39:47 UTC (rev 16607) @@ -20,8 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// START OF FILE -/*****************************************************************************/ #include "stdlib.h" // strtol #include "limits.h" #include "string.h" // strlen @@ -46,7 +44,7 @@ #endif /*****************************************************************************/ -gchar *get_name_by_index_str(gchar ** array, const gchar * index_str, gint amount) { +gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount) { gint index; index = atoi(index_str); @@ -57,7 +55,7 @@ } // get_name_by_index_str /*****************************************************************************/ -gchar *get_index_str_by_name(gchar ** array, const gchar * name, gint amount) { +gchar *get_index_str_by_name(gchar **array, const gchar *name, gint amount) { gint index; for (index = 0; index <= amount; index++) @@ -70,7 +68,7 @@ } // get_index_str_by_name /*****************************************************************************/ -gint qq_string_to_dec_value(const gchar * str) +gint qq_string_to_dec_value(const gchar *str) { g_return_val_if_fail(str != NULL, 0); return strtol(str, NULL, 10); @@ -80,7 +78,7 @@ // split the given data(len) with delimit, // check the number of field matches the expected_fields (<=0 means all) // return gchar* array (needs to be freed by g_strfreev later), or NULL -gchar **split_data(guint8 * data, gint len, const gchar * delimit, gint expected_fields) { +gchar **split_data(guint8 *data, gint len, const gchar *delimit, gint expected_fields) { guint8 *input; gchar **segments; @@ -111,19 +109,19 @@ // free up those not used for (j = expected_fields; j < i; j++) { gaim_debug(GAIM_DEBUG_WARNING, "QQ", "field[%d] is %s\n", j, segments[j]); - g_free(segments[j]); // bug found by gfhuang ! i -> j + g_free(segments[j]); } segments[expected_fields] = NULL; - } // if i + } return segments; -} // split_data +} /*****************************************************************************/ // given a four-byte ip data, convert it into a human readable ip string // the return needs to be freed -gchar *gen_ip_str(guint8 * ip) +gchar *gen_ip_str(guint8 *ip) { if (ip == NULL || ip[0] == 0) return g_strdup_printf(""); @@ -131,7 +129,6 @@ return g_strdup_printf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); } -// by gfhuang guint8 *str_ip_gen(gchar *str) { guint8 *ip = g_new(guint8, 4); int a, b, c, d; @@ -161,7 +158,7 @@ /*****************************************************************************/ // convert GAIM name to original QQ UID -guint32 gaim_name_to_uid(const gchar * name) +guint32 gaim_name_to_uid(const gchar *name) { gchar *p; @@ -175,7 +172,7 @@ /*****************************************************************************/ // try to dump the data as GBK -void try_dump_as_gbk(guint8 * data, gint len) +void try_dump_as_gbk(guint8 *data, gint len) { gint i; guint8 *incoming; @@ -201,11 +198,76 @@ } // try_dump_gbk /*****************************************************************************/ +// strips whitespace +static gchar *strstrip(const gchar *buffer) +{ + GString *stripped; + gchar *ret; + int i; -// dump a chunk of raw data into hex string -// the return should be freed later -gchar *hex_dump_to_str(const guint8 * buffer, gint bytes) + stripped = g_string_new(""); + for (i=0; i<strlen(buffer); i++) { + if ((int) buffer[i] != 32) { + g_string_append_c(stripped, buffer[i]); + } + } + ret = stripped->str; + g_string_free(stripped, FALSE); + + return ret; +} + +/*****************************************************************************/ +// Dumps an ASCII hex string to a string of bytes. The return should be freed later. +// Returns NULL if a string with an odd number of nibbles is passed in or if buffer +// isn't a valid hex string +guint8 *hex_str_to_bytes(const gchar *buffer) { + gchar *hex_str, *hex_buffer, *cursor, tmp; + guint8 *bytes, nibble1, nibble2; + gint index, len; + + hex_buffer = strstrip(buffer); + + if (strlen(hex_buffer) % 2 != 0) { + gaim_debug(GAIM_DEBUG_WARNING, "QQ", + "Unable to convert an odd number of nibbles to a string of bytes!\n"); + g_free(hex_buffer); + return NULL; + } + bytes = g_newa(guint8, strlen(hex_buffer) / 2); + hex_str = g_ascii_strdown(hex_buffer, -1); + g_free(hex_buffer); + index = 0; + for (cursor = hex_str; cursor < hex_str + sizeof(gchar) * (strlen(hex_str)) - 1; cursor++) { + if (g_ascii_isdigit(*cursor)) {tmp = *cursor; nibble1 = atoi(&tmp); } + else if (g_ascii_isalpha(*cursor) && (gint) *cursor - 87 < 16) + nibble1 = (gint) *cursor - 87; + else { + gaim_debug(GAIM_DEBUG_WARNING, "QQ", + "Invalid char found in hex string!\n"); + g_free(hex_str); + return NULL; + } + nibble1 = nibble1 << 4; + cursor++; + if (g_ascii_isdigit(*cursor)) {tmp = *cursor; nibble2 = atoi(&tmp); } + else if (g_ascii_isalpha(*cursor) && (gint) (*cursor - 87) < 16) + nibble2 = (gint) *cursor - 87; + else { + g_free(hex_str); + return NULL; + } + bytes[index++] = nibble1 + nibble2; + } + len = strlen(hex_str) / 2; + g_free(hex_str); + return g_memdup(bytes, len); +} + +// Dumps a chunk of raw data into an ASCII hex string. The return should be freed later. +gchar *hex_dump_to_str(const guint8 *buffer, gint bytes) +{ GString *str; gchar *ret; gint i, j, ch; @@ -240,6 +302,3 @@ return ret; } - -/*****************************************************************************/ -// ENF OF FILE Modified: trunk/src/protocols/qq/utils.h =================================================================== --- trunk/src/protocols/qq/utils.h 2006-08-01 16:15:39 UTC (rev 16606) +++ trunk/src/protocols/qq/utils.h 2006-08-01 17:39:47 UTC (rev 16607) @@ -28,21 +28,22 @@ #define QQ_NAME_PREFIX "qq-" -gchar *get_name_by_index_str(gchar ** array, const gchar * index_str, gint amount); -gchar *get_index_str_by_name(gchar ** array, const gchar * name, gint amount); -gint qq_string_to_dec_value(const gchar * str); +gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount); +gchar *get_index_str_by_name(gchar **array, const gchar *name, gint amount); +gint qq_string_to_dec_value(const gchar *str); -gchar **split_data(guint8 * data, gint len, const gchar * delimit, gint expected_fields); -gchar *gen_ip_str(guint8 * ip); +gchar **split_data(guint8 *data, gint len, const gchar *delimit, gint expected_fields); +gchar *gen_ip_str(guint8 *ip); guint8 *str_ip_gen(gchar *str); gchar *uid_to_gaim_name(guint32 uid); -guint32 gaim_name_to_uid(const gchar * name); +guint32 gaim_name_to_uid(const gchar *name); gchar *get_icon_name(gint set, gint suffix); -void try_dump_as_gbk(guint8 * data, gint len); +void try_dump_as_gbk(guint8 *data, gint len); -gchar *hex_dump_to_str(const guint8 * buf, gint buf_len); +guint8 *hex_str_to_bytes(const gchar *buf); +gchar *hex_dump_to_str(const guint8 *buf, gint buf_len); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-01 16:16:16
|
Revision: 16606 Author: markhuetsch Date: 2006-08-01 09:15:39 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16606&view=rev Log Message: ----------- QQ no longer supports changing one's password through the client. Users must go to password.qq.com instead. I also squashed a compiler warning. Modified Paths: -------------- trunk/src/protocols/qq/buddy_info.c trunk/src/protocols/qq/buddy_info.h trunk/src/protocols/qq/qq.c Modified: trunk/src/protocols/qq/buddy_info.c =================================================================== --- trunk/src/protocols/qq/buddy_info.c 2006-08-01 13:08:03 UTC (rev 16605) +++ trunk/src/protocols/qq/buddy_info.c 2006-08-01 16:15:39 UTC (rev 16606) @@ -180,7 +180,7 @@ } // info_fields are compared by their group positions -static gint info_field_compare(gconstpointer a, gconstpointer b, gpointer unused) +static gint info_field_compare(gconstpointer a, gconstpointer b) { return ((info_field *) a)->group_pos - ((info_field *) b)->group_pos; } @@ -318,31 +318,22 @@ } } -// send packet to modify personal information, and/or change password -void qq_send_packet_modify_info(GaimConnection *gc, contact_info *info, gchar *new_passwd) +// send packet to modify personal information +void qq_send_packet_modify_info(GaimConnection *gc, contact_info *info) { - GaimAccount *a; - gchar *old_passwd, *info_field[QQ_CONTACT_FIELDS]; + gchar *info_field[QQ_CONTACT_FIELDS]; gint i; guint8 *raw_data, *cursor, bar; g_return_if_fail(gc != NULL && info != NULL); - a = gc->account; - old_passwd = a->password; bar = 0x1f; raw_data = g_newa(guint8, MAX_PACKET_SIZE - 128); cursor = raw_data; g_memmove(info_field, info, sizeof(gchar *) * QQ_CONTACT_FIELDS); - if (new_passwd == NULL || strlen(new_passwd) == 0) - create_packet_b(raw_data, &cursor, bar); - 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, (guint8 *) new_passwd, strlen(new_passwd)); - } + create_packet_b(raw_data, &cursor, bar); // important!, skip the first uid entry for (i = 1; i < QQ_CONTACT_FIELDS; i++) { @@ -427,7 +418,7 @@ } info = (contact_info *) info_field; - qq_send_packet_modify_info(gc, info, NULL); + qq_send_packet_modify_info(gc, info); g_free(mid); for (i = 0; i < QQ_CONTACT_FIELDS; i++) g_free(info_field[i]); Modified: trunk/src/protocols/qq/buddy_info.h =================================================================== --- trunk/src/protocols/qq/buddy_info.h 2006-08-01 13:08:03 UTC (rev 16605) +++ trunk/src/protocols/qq/buddy_info.h 2006-08-01 16:15:39 UTC (rev 16606) @@ -114,7 +114,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_send_packet_modify_info(GaimConnection *gc, contact_info *info); 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); Modified: trunk/src/protocols/qq/qq.c =================================================================== --- trunk/src/protocols/qq/qq.c 2006-08-01 13:08:03 UTC (rev 16605) +++ trunk/src/protocols/qq/qq.c 2006-08-01 16:15:39 UTC (rev 16606) @@ -447,6 +447,12 @@ qq_prepare_modify_info(gc); } + +static void _qq_menu_change_password(GaimPluginAction * action) +{ + gaim_notify_uri(NULL, "https://password.qq.com"); +} + /* remove a buddy from my list and remove myself from his list */ /* TODO: re-enable this static void _qq_menu_block_buddy(GaimBlistNode * node) @@ -668,6 +674,9 @@ act = gaim_plugin_action_new(_("Modify My Information"), _qq_menu_modify_my_info); m = g_list_append(m, act); + act = gaim_plugin_action_new(_("Change Password"), _qq_menu_change_password); + m = g_list_append(m, act); + act = gaim_plugin_action_new(_("Show Login Information"), _qq_menu_show_login_info); m = g_list_append(m, act); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-01 13:08:40
|
Revision: 16605 Author: markhuetsch Date: 2006-08-01 06:08:03 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16605&view=rev Log Message: ----------- *Safeguarded against a possible memory violation upon receiving a malformed login token reply packet. *Eliminated a couple of compiler warnings. Modified Paths: -------------- trunk/src/protocols/qq/login_logout.c trunk/src/protocols/qq/login_logout.h Modified: trunk/src/protocols/qq/login_logout.c =================================================================== --- trunk/src/protocols/qq/login_logout.c 2006-08-01 00:05:14 UTC (rev 16604) +++ trunk/src/protocols/qq/login_logout.c 2006-08-01 13:08:03 UTC (rev 16605) @@ -20,8 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// START OF FILE -/*****************************************************************************/ #include "debug.h" // gaim_debug #include "internal.h" // memcpy, _("get_text") #include "server.h" // serv_finish_login @@ -40,16 +38,14 @@ #include "send_core.h" // qq_send_cmd #include "qq.h" // qq_data -//#define QQ_LOGIN_DATA_LENGTH 69 //length of plain login packet -#define QQ_LOGIN_DATA_LENGTH 416 //new length from eva, by gfhuang +#define QQ_LOGIN_DATA_LENGTH 416 #define QQ_LOGIN_REPLY_OK_PACKET_LEN 139 #define QQ_LOGIN_REPLY_REDIRECT_PACKET_LEN 11 -#define QQ_REQUEST_LOGIN_TOKEN_REPLY_OK 0x00 //added by gfhuang +#define QQ_REQUEST_LOGIN_TOKEN_REPLY_OK 0x00 #define QQ_LOGIN_REPLY_OK 0x00 #define QQ_LOGIN_REPLY_REDIRECT 0x01 -//#define QQ_LOGIN_REPLY_PWD_ERROR 0x02 #define QQ_LOGIN_REPLY_PWD_ERROR 0x05 #define QQ_LOGIN_REPLY_MISC_ERROR 0xff // defined by myself @@ -71,7 +67,7 @@ }; */ -//for QQ 2005? copy from lumqq +//for QQ 2005? copy from lumaqq static const gint8 login_23_51[29] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -122, @@ -149,12 +145,11 @@ /*****************************************************************************/ // It is fixed to 16 bytes 0x01 for QQ2003, // Any value works (or a random 16 bytes string) -static gchar *_gen_login_key(void) +static guint8 *_gen_login_key(void) { - return g_strnfill(QQ_KEY_LENGTH, 0x01); -} // _gen_login_key + return (guint8 *) g_strnfill(QQ_KEY_LENGTH, 0x01); +} -/*****************************************************************************/ // process login reply which says OK static gint _qq_process_login_ok(GaimConnection * gc, guint8 * data, gint len) { @@ -217,7 +212,7 @@ gaim_debug(GAIM_DEBUG_WARNING, "QQ", "Fail parsing login info, expect %d bytes, read %d bytes\n", QQ_LOGIN_REPLY_OK_PACKET_LEN, bytes); - } // but we still goes on as login OK + } // but we still go on as login OK qd->session_key = g_memdup(lrop.session_key, QQ_KEY_LENGTH); qd->my_ip = gen_ip_str(lrop.client_ip); @@ -229,7 +224,6 @@ g_free(lrop.session_key); gaim_connection_set_state(gc, GAIM_CONNECTED); -// serv_finish_login(gc); //by gfhuang qd->logged_in = TRUE; // must be defined after sev_finish_login // now initiate QQ Qun, do it first as it may take longer to finish @@ -247,9 +241,8 @@ //qq_send_packet_get_all_list_with_group(gc, QQ_FRIENDS_LIST_POSITION_START); return QQ_LOGIN_REPLY_OK; -} // _qq_process_login_ok +} -/*****************************************************************************/ // process login reply packet which includes redirected new server address static gint _qq_process_login_redirect(GaimConnection * gc, guint8 * data, gint len) { @@ -285,12 +278,11 @@ qq_connect(gc->account, new_server_str, lrrp.new_server_port, qd->use_tcp, TRUE); g_free(new_server_str); ret = QQ_LOGIN_REPLY_REDIRECT; - } // if bytes != QQ_LOGIN_REPLY_MISC_ERROR + } return ret; -} // _qq_process_login_redirect +} -/*****************************************************************************/ // process login reply which says wrong password static gint _qq_process_login_wrong_pwd(GaimConnection * gc, guint8 * data, gint len) { @@ -303,10 +295,9 @@ g_free(server_reply_utf8); return QQ_LOGIN_REPLY_PWD_ERROR; -} // _qq_process_login_wrong_pwd +} - -// request before login, new protocal, by gfhuang +// request before login void qq_send_packet_request_login_token(GaimConnection *gc) { qq_data *qd; @@ -332,9 +323,12 @@ gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Fail create request login token packet\n"); } -/*****************************************************************************/ +// TODO: The login packet and its response have changed by QQ2006 Beta2. In that version, +// the login OK response packet does not appear to be decryptable with qd->pwkey or qd->inikey. +// Fortunately, this older system still works. + // send login packet to QQ server -void qq_send_packet_login(GaimConnection * gc, guint8 token_length, guint8 *token) +static void qq_send_packet_login(GaimConnection * gc, guint8 token_length, guint8 *token) { qq_data *qd; guint8 *buf, *cursor, *raw_data, *encrypted_data; @@ -352,7 +346,7 @@ // now generate the encrypted data // 000-015 use pwkey as key to encrypt empty string - qq_crypt(ENCRYPT, "", 0, qd->pwkey, raw_data, &encrypted_len); + qq_crypt(ENCRYPT, (guint8 *) "", 0, qd->pwkey, raw_data, &encrypted_len); // 016-016 raw_data[16] = 0x00; // 017-020, used to be IP, now zero @@ -366,7 +360,7 @@ // 053-068, fixed value, maybe related to per machine g_memmove(raw_data + 53, login_53_68, 16); - // 069 , login token length, by gfhuang + // 069, login token length raw_data[69] = token_length; pos = 70; // 070-093, login token //normally 24 bytes @@ -392,10 +386,8 @@ _qq_send_packet(gc, buf, bytes, QQ_CMD_LOGIN); else gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Fail create login packet\n"); -} // qq_send_packet_login +} - -//added by gfhuang void qq_process_request_login_token_reply(guint8 * buf, gint buf_len, GaimConnection * gc) { qq_data *qd; @@ -406,9 +398,15 @@ qd = (qq_data *) gc->proto_data; if (buf[0] == QQ_REQUEST_LOGIN_TOKEN_REPLY_OK) { + if (buf[1] != buf_len-2) { + gaim_debug(GAIM_DEBUG_INFO, "QQ", + "Malformed login token reply packet. Packet specifies length of %d, actual length is %d\n", buf[1], buf_len-2); + gaim_debug(GAIM_DEBUG_INFO, "QQ", + "Attempting to proceed with the actual packet length.\n"); + } gaim_debug(GAIM_DEBUG_INFO, "QQ", - "<<< got a token with %d bytes -> [default] decrypt and dump\n%s",buf[1], hex_dump_to_str(buf+2, buf[1])); - qq_send_packet_login(gc, buf[1], buf + 2); + "<<< got a token with %d bytes -> [default] decrypt and dump\n%s",buf_len-2, hex_dump_to_str(buf+2, buf_len-2)); + qq_send_packet_login(gc, buf_len-2, buf+2); } else { gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Unknown request login token reply code : %d\n", buf[0]); gaim_debug(GAIM_DEBUG_WARNING, "QQ", @@ -419,7 +417,6 @@ } } -/*****************************************************************************/ // send logout packets to QQ server void qq_send_packet_logout(GaimConnection * gc) { @@ -435,7 +432,6 @@ qd->logged_in = FALSE; // update login status AFTER sending logout packets } // qq_send_packet_logout -/*****************************************************************************/ // process the login reply packet void qq_process_login_reply(guint8 * buf, gint buf_len, GaimConnection * gc) { @@ -474,7 +470,6 @@ break; default: gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Unknown reply code: %d\n", data[0]); - // dump by gfhuang gaim_debug(GAIM_DEBUG_WARNING, "QQ", ">>> %d bytes -> [default] decrypt and dump\n%s", buf_len, hex_dump_to_str(data, len)); @@ -504,8 +499,5 @@ break; default:{; } - } // switch ret -} // qq_process_login_reply - -/*****************************************************************************/ -// END OF FILE + } +} Modified: trunk/src/protocols/qq/login_logout.h =================================================================== --- trunk/src/protocols/qq/login_logout.h 2006-08-01 00:05:14 UTC (rev 16604) +++ trunk/src/protocols/qq/login_logout.h 2006-08-01 13:08:03 UTC (rev 16605) @@ -20,8 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// START OF FILE -/*****************************************************************************/ #ifndef _QQ_LOGIN_LOGOUT_H_ #define _QQ_LOGIN_LOGOUT_H_ @@ -31,14 +29,9 @@ #define QQ_LOGIN_MODE_NORMAL 0x0a #define QQ_LOGIN_MODE_HIDDEN 0x28 -//void qq_send_packet_login(GaimConnection * gc); //for internal usage, by gfhuang -void qq_send_packet_request_login_token(GaimConnection *gc); //by gfhuang - +void qq_send_packet_request_login_token(GaimConnection *gc); +void qq_process_request_login_token_reply(guint8 *buf, gint buf_len, GaimConnection *gc); +void qq_process_login_reply(guint8 * buf, gint buf_len, GaimConnection * gc); void qq_send_packet_logout(GaimConnection * gc); -void qq_process_login_reply(guint8 * buf, gint buf_len, GaimConnection * gc); -void qq_process_request_login_token_reply(guint8 *buf, gint buf_len, GaimConnection *gc); // by gfhuang - #endif -/*****************************************************************************/ -// END OF FILE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-01 00:05:28
|
Revision: 16604 Author: sadrul Date: 2006-07-31 17:05:14 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16604&view=rev Log Message: ----------- Let's have a man-page for gntgaim. Modified Paths: -------------- trunk/configure.ac trunk/doc/Makefile.am Added Paths: ----------- trunk/doc/gntgaim.1.in Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2006-07-31 23:56:35 UTC (rev 16603) +++ trunk/configure.ac 2006-08-01 00:05:14 UTC (rev 16604) @@ -1747,6 +1747,7 @@ gaim.service doc/Makefile doc/gaim.1 + doc/gntgaim.1 m4macros/Makefile pixmaps/Makefile pixmaps/smileys/Makefile Modified: trunk/doc/Makefile.am =================================================================== --- trunk/doc/Makefile.am 2006-07-31 23:56:35 UTC (rev 16603) +++ trunk/doc/Makefile.am 2006-08-01 00:05:14 UTC (rev 16604) @@ -1,4 +1,4 @@ -man_MANS = gaim.1 +man_MANS = gaim.1 gntgaim.1 EXTRA_DIST = \ C-HOWTO.dox \ @@ -15,6 +15,7 @@ dbus-server-signals.dox \ gaim.1.in \ gaims_funniest_home_convos.txt \ + gntgaim.1.in \ gtkaccount-signals.dox \ gtkblist-signals.dox \ gtkconv-signals.dox \ Added: trunk/doc/gntgaim.1.in =================================================================== --- trunk/doc/gntgaim.1.in (rev 0) +++ trunk/doc/gntgaim.1.in 2006-08-01 00:05:14 UTC (rev 16604) @@ -0,0 +1,177 @@ +.\" Copyright (c) 2006, Sadrul Habib Chowdhury <sa...@us...> +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, +.\" USA. +.TH gntgaim 1 +.SH NAME +GntGaim \- Console frontend for Instant Messaging client Gaim. +.SH SYNOPSIS +.TP 5 +\fBgntgaim \fI[options]\fR + +.SH DESCRIPTION +.PP +\fBgntgaim\fR is a console-based frontend for Instant Messaging (IM) +application Gaim. It supports multiple protocols via modules, including AIM, +ICQ, Yahoo!, MSN, Jabber, IRC, Napster, Gadu-Gadu and Zephyr. It has many +common features found in other clients, as well as many unique features. Gaim +is not endorsed by or affiliated with America Online, ICQ, Microsoft, or Yahoo. + +.SH OPTIONS +The following options are provided by \fBgntgaim\fR using the standard GNU +command line syntax: +.TP +.B \-d, \-\-debug +Print debugging messages to stdout. These are the same debugging messages +that are displayed in the \fBDebug\fR window. +.TP +.B \-c, \-\-config=\fIDIR\fB +Use \fIDIR\fR as the directory for config files instead of \fI~/.gaim\fR. +.TP +.B \-h, \-\-help +Print this help and exit. +.TP +.B \-n, \-\-nologin +Don't automatically login when \fBgntgaim\fR starts. Sets all accounts to +Offline. +.TP +.B \-v, \-\-version +Display the version information window. + +.SH GNT Shortcuts +You can use the following shortcuts: +.TP +.B Alt \+ n +Go to the next window. +.TP +.B Alt \+ p +Go to the previous window. +.TP +.B Alt \+ w +Show the list of windows. You can select and jump to any window from the list. +.TP +.B Alt \+ c +Close the current window. +.TP +.B Alt \+ q +Quit. +.TP +.B Alt \+ m +Start moving a window. Press the cursor keys to move the window. When you are +done, press \fBEnter\fR or \fBEscape\fR. +.TP +.B Alt \+ r +Start resizing a window. Press the cursor keys to resize the window. When you +are done, press \fBEnter\fR or \fBEscape\fR. + +.SH FILES +\fI~/.gntrc\fR: configuration file for gnt applications. +.br +.TP +A sample file looks like: +.br +[general] +.br +shadow = 0 +.br + +.br +[colors] +.br +# The RGB values range in [0, 1000] +.br +black = 0; 0; 0 +.br +red = 1000; 0; 0 +.br +green = 0; 1000; 0 +.br +blue = 250; 250; 700 +.br +white = 1000; 1000; 1000 +.br +gray = 700; 700; 700 +.br +darkgray = 256; 256; 256 +.br + +.br +[colorpairs] +.br +normal = white; black +.br +highlight = white; blue +.br +highlightd = black; gray +.br +shadow = black; darkgray +.br +title = white; blue +.br +titled = white; gray +.br +text = white; blue +.br +disabled = gray; black +.br + +.SH BUGS +Known bugs are listed at +.br +\fIhttp://sourceforge.net/tracker/?group_id=235&atid=100235\fR + +.SH PATCHES +If you fix a bug in \fBgntgaim\fR (or otherwise enhance it), please submit a +patch (using \fIcvs diff -up > my.diff\fR against the latest CVS version) +at +.br +\fIhttp://sourceforge.net/tracker/?func=add&group_id=235&atid=300235\fR + +Before sending a bug report, please verify that you have the latest +version of \fBgntgaim\fR. Many bugs (major and minor) are fixed +at each release, and if yours is out of date, the problem may already +have been solved. + +.SH SEE ALSO +\fIhttp://gaim.sourceforge.net/\fR +.br +\fIhttp://www.sourceforge.net/projects/gaim/\fR + +.SH LICENSE +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 +\fBWITHOUT ANY WARRANTY\fR; 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 + +.SH AUTHORS +Sadrul Habib Chowdhury <\fIs...@us...\fR> +.br + +This manpage was written by Sadrul Habib Chowdhury <\fIs...@us...\fR>. + Property changes on: trunk/doc/gntgaim.1.in ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-07-31 23:57:53
|
Revision: 16603 Author: sadrul Date: 2006-07-31 16:56:35 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16603&view=rev Log Message: ----------- wabz says: "gaim_strdup_withhtml in util.c is purely for converting linebreaks to <br> - some protocols use it for various reasons, but not msn - not sure where it's done for that (might not be? gtkconv doesnt use gaim_markup_strip_html). i reckon since you're using gaim_markup_strip_html, you may as well play it safe and just use gaim_strdup_withhtml before the strip?" So let's do it until GntTextView can parse html. (after all, that's 20% of the users ;) ) Modified Paths: -------------- trunk/console/gntconv.c trunk/console/libgnt/gntwidget.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-07-31 23:19:12 UTC (rev 16602) +++ trunk/console/gntconv.c 2006-07-31 23:56:35 UTC (rev 16603) @@ -216,7 +216,7 @@ GaimMessageFlags flags, time_t mtime) { GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); /* XXX: ggconv = conv->ui_data; should do */ - char *strip; + char *strip, *newline; GntTextFormatFlags fl = 0; g_return_if_fail(ggconv != NULL); @@ -236,12 +236,15 @@ if (flags & GAIM_MESSAGE_NICK) fl |= GNT_TEXT_FLAG_UNDERLINE; - strip = gaim_markup_strip_html(message); + /* XXX: Remove this workaround when textview can parse messages. */ + newline = gaim_strdup_withhtml(message); + strip = gaim_markup_strip_html(newline); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), strip, fl); gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); + g_free(newline); g_free(strip); if (flags & (GAIM_MESSAGE_RECV | GAIM_MESSAGE_NICK | GAIM_MESSAGE_ERROR)) Modified: trunk/console/libgnt/gntwidget.c =================================================================== --- trunk/console/libgnt/gntwidget.c 2006-07-31 23:19:12 UTC (rev 16602) +++ trunk/console/libgnt/gntwidget.c 2006-07-31 23:56:35 UTC (rev 16603) @@ -387,14 +387,19 @@ { /* - This is ugly. */ /* - What's your point? */ - mvwvline(widget->window, 0, 0, ACS_VLINE, widget->priv.height); - mvwvline(widget->window, 0, widget->priv.width - 1, ACS_VLINE, widget->priv.height); - mvwhline(widget->window, widget->priv.height - 1, 0, ACS_HLINE, widget->priv.width); - mvwhline(widget->window, 0, 0, ACS_HLINE, widget->priv.width); - mvwaddch(widget->window, 0, 0, ACS_ULCORNER); - mvwaddch(widget->window, 0, widget->priv.width - 1, ACS_URCORNER); - mvwaddch(widget->window, widget->priv.height - 1, 0, ACS_LLCORNER); - mvwaddch(widget->window, widget->priv.height - 1, widget->priv.width - 1, ACS_LRCORNER); + mvwvline(widget->window, 0, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.height); + mvwvline(widget->window, 0, widget->priv.width - 1, + ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.height); + mvwhline(widget->window, widget->priv.height - 1, 0, + ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width); + mvwhline(widget->window, 0, 0, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width); + mvwaddch(widget->window, 0, 0, ACS_ULCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); + mvwaddch(widget->window, 0, widget->priv.width - 1, + ACS_URCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); + mvwaddch(widget->window, widget->priv.height - 1, 0, + ACS_LLCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); + mvwaddch(widget->window, widget->priv.height - 1, widget->priv.width - 1, + ACS_LRCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); } if (shadow) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-07-31 23:19:28
|
Revision: 16602 Author: sadrul Date: 2006-07-31 16:19:12 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16602&view=rev Log Message: ----------- Allow plugins to be loaded and unloaded. Remember the window positions and sizes. All turning on/off shadow from ~/.gntrc (off by default). Modified Paths: -------------- trunk/console/Makefile trunk/console/gntblist.c trunk/console/gntconv.c trunk/console/gntdebug.c trunk/console/gntui.c trunk/console/libgnt/gntbox.c trunk/console/libgnt/gntbutton.c trunk/console/libgnt/gntline.c trunk/console/libgnt/gntmain.c trunk/console/libgnt/gntstyle.c trunk/console/libgnt/gntstyle.h trunk/console/libgnt/gnttextview.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/gntwidget.c trunk/console/libgnt/gntwidget.h trunk/console/libgnt/test/multiwin.c Added Paths: ----------- trunk/console/gntplugin.c trunk/console/gntplugin.h Modified: trunk/console/Makefile =================================================================== --- trunk/console/Makefile 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/Makefile 2006-07-31 23:19:12 UTC (rev 16602) @@ -1,7 +1,7 @@ VERSION=gntgaim-0.0.0dev CC=gcc CFLAGS=`pkg-config --cflags gaim gobject-2.0 gnt` -g -Wall -DVERSION=\"$(VERSION)\" -DSTANDALONE -LDFLAGS=`pkg-config --libs gaim gobject-2.0 libxml-2.0 gnt` -pg +LDFLAGS=`pkg-config --libs gaim gobject-2.0 libxml-2.0 gnt` -pg -lgaim GG_SOURCES = \ gntaccount.c \ @@ -10,6 +10,7 @@ gntconv.c \ gntdebug.c \ gntnotify.c \ + gntplugin.c \ gntprefs.c \ gntrequest.c \ gntui.c @@ -22,6 +23,7 @@ gntdebug.h \ gntnotify.h \ gntprefs.h \ + gntplugin.h \ gntrequest.h \ gntui.h @@ -32,6 +34,7 @@ gntconv.o \ gntdebug.o \ gntnotify.o \ + gntplugin.o \ gntprefs.o \ gntrequest.o \ gntui.o Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/gntblist.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -13,6 +13,8 @@ #include "gntblist.h" #include <string.h> +#define PREF_ROOT "/gaim/gnt/blist" + typedef struct { GntWidget *window; @@ -274,6 +276,8 @@ gnt_append_menu_action(GntTree *tree, GaimMenuAction *action, gpointer parent) { GList *list; + if (action == NULL) + return; gnt_tree_add_row_after(tree, action, gnt_tree_create_row(tree, action->label), parent, NULL); @@ -677,8 +681,30 @@ remove_context_menu(ggblist); } +static void +size_changed_cb(GntWidget *w, int width, int height) +{ + gaim_prefs_set_int(PREF_ROOT "/size/width", width); + gaim_prefs_set_int(PREF_ROOT "/size/height", height); +} + +static void +save_position_cb(GntWidget *w, int x, int y) +{ + gaim_prefs_set_int(PREF_ROOT "/position/x", x); + gaim_prefs_set_int(PREF_ROOT "/position/y", y); +} + void gg_blist_init() { + gaim_prefs_add_none(PREF_ROOT); + gaim_prefs_add_none(PREF_ROOT "/size"); + gaim_prefs_add_int(PREF_ROOT "/size/width", 20); + gaim_prefs_add_int(PREF_ROOT "/size/height", 20); + gaim_prefs_add_none(PREF_ROOT "/position"); + gaim_prefs_add_int(PREF_ROOT "/position/x", 0); + gaim_prefs_add_int(PREF_ROOT "/position/y", 0); + ggblist = g_new0(GGBlist, 1); gaim_get_blist()->ui_data = ggblist; @@ -692,7 +718,10 @@ ggblist->tree = gnt_tree_new(); GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER); gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, 25); - gnt_widget_set_size(ggblist->tree, 0, getmaxy(stdscr) - 4); + gnt_widget_set_size(ggblist->tree, gaim_prefs_get_int(PREF_ROOT "/size/width"), + gaim_prefs_get_int(PREF_ROOT "/size/height")); + gnt_widget_set_position(ggblist->window, gaim_prefs_get_int(PREF_ROOT "/position/x"), + gaim_prefs_get_int(PREF_ROOT "/position/y")); gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); gnt_widget_show(ggblist->window); @@ -725,6 +754,9 @@ ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); g_signal_connect_data(G_OBJECT(ggblist->tree), "lost-focus", G_CALLBACK(remove_peripherals), ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); + g_signal_connect(G_OBJECT(ggblist->tree), "size_changed", G_CALLBACK(size_changed_cb), NULL); + g_signal_connect(G_OBJECT(ggblist->window), "position_set", G_CALLBACK(save_position_cb), NULL); + } void gg_blist_uninit() Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/gntconv.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -1,6 +1,7 @@ #include <string.h> #include <cmds.h> +#include <prefs.h> #include <util.h> #include "gntgaim.h" @@ -12,6 +13,8 @@ #include "gntentry.h" #include "gnttextview.h" +#define PREF_ROOT "/gaim/gnt/conversations" + GHashTable *ggconvs; typedef struct _GGConv GGConv; @@ -142,19 +145,29 @@ } static void +size_changed_cb(GntWidget *w, int width, int height) +{ + gaim_prefs_set_int(PREF_ROOT "/size/width", width); + gaim_prefs_set_int(PREF_ROOT "/size/height", height); +} + +static void +save_position_cb(GntWidget *w, int x, int y) +{ + gaim_prefs_set_int(PREF_ROOT "/position/x", x); + gaim_prefs_set_int(PREF_ROOT "/position/y", y); +} + +static void gg_create_conversation(GaimConversation *conv) { GGConv *ggc = g_hash_table_lookup(ggconvs, conv); char *title; GaimConversationType type; - int x, width; if (ggc) return; - gg_blist_get_position(&x, NULL); - gg_blist_get_size(&width, NULL); - ggc = g_new0(GGConv, 1); g_hash_table_insert(ggconvs, conv, ggc); @@ -172,7 +185,8 @@ ggc->tv = gnt_text_view_new(); gnt_box_add_widget(GNT_BOX(ggc->window), ggc->tv); gnt_widget_set_name(ggc->tv, "conversation-window-textview"); - gnt_widget_set_size(ggc->tv, getmaxx(stdscr) - 3 - x - width, getmaxy(stdscr) - 5); + gnt_widget_set_size(ggc->tv, gaim_prefs_get_int(PREF_ROOT "/size/width"), + gaim_prefs_get_int(PREF_ROOT "/size/height")); ggc->entry = gnt_entry_new(NULL); gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry); @@ -181,12 +195,13 @@ g_signal_connect(G_OBJECT(ggc->entry), "key_pressed", G_CALLBACK(entry_key_pressed), ggc); g_signal_connect(G_OBJECT(ggc->window), "destroy", G_CALLBACK(closing_window), ggc); - /* XXX: I am assuming the buddylist is on the leftmost corner. - * That may not always be correct, since the windows can be moved. - * It might be an option to remember the position of conv. windows. */ - gnt_widget_set_position(ggc->window, x + width, 0); + gnt_widget_set_position(ggc->window, gaim_prefs_get_int(PREF_ROOT "/position/x"), + gaim_prefs_get_int(PREF_ROOT "/position/y")); gnt_widget_show(ggc->window); + g_signal_connect(G_OBJECT(ggc->tv), "size_changed", G_CALLBACK(size_changed_cb), NULL); + g_signal_connect(G_OBJECT(ggc->window), "position_set", G_CALLBACK(save_position_cb), NULL); + g_free(title); } @@ -465,7 +480,15 @@ { ggconvs = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, destroy_ggconv); - /* Xerox */ + gaim_prefs_add_none(PREF_ROOT); + gaim_prefs_add_none(PREF_ROOT "/size"); + gaim_prefs_add_int(PREF_ROOT "/size/width", 70); + gaim_prefs_add_int(PREF_ROOT "/size/height", 20); + gaim_prefs_add_none(PREF_ROOT "/position"); + gaim_prefs_add_int(PREF_ROOT "/position/x", 0); + gaim_prefs_add_int(PREF_ROOT "/position/y", 0); + + /* Xerox the commands */ gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); Modified: trunk/console/gntdebug.c =================================================================== --- trunk/console/gntdebug.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/gntdebug.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -39,9 +39,7 @@ gg_debug_print(GaimDebugLevel level, const char *category, const char *args) { - if (debug.window == NULL) - fprintf(stderr, "%s: %s\n", category, args); - else + if (debug.window) { GntTextFormatFlags flag = GNT_TEXT_FLAG_NORMAL; @@ -105,7 +103,8 @@ void gg_debug_init() { - gg_debug_window_show(); + if (gaim_debug_is_enabled()) + gg_debug_window_show(); } void gg_debug_uninit() Added: trunk/console/gntplugin.c =================================================================== --- trunk/console/gntplugin.c (rev 0) +++ trunk/console/gntplugin.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -0,0 +1,124 @@ +#include <gnt.h> +#include <gntbox.h> +#include <gntlabel.h> +#include <gntline.h> +#include <gnttree.h> + +#include "notify.h" + +#include "gntgaim.h" +#include "gntplugin.h" + +static struct +{ + GntWidget *tree; + GntWidget *window; + GntWidget *aboot; +} plugins; + +static void +plugin_toggled_cb(GntWidget *tree, GaimPlugin *plugin, gpointer null) +{ + if (gnt_tree_get_choice(GNT_TREE(tree), plugin)) + { + if(!gaim_plugin_load(plugin)) + gaim_notify_error(NULL, "ERROR", "loading plugin failed", NULL); + } + else + { + if (!gaim_plugin_unload(plugin)) + gaim_notify_error(NULL, "ERROR", "unloading plugin failed", NULL); + } + gg_plugins_save_loaded(); +} + +/* Xerox */ +void +gg_plugins_save_loaded(void) +{ + GList *pl; + GList *files = NULL; + GaimPlugin *p; + + for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) { + p = pl->data; + + if (p->info->type != GAIM_PLUGIN_PROTOCOL && + p->info->type != GAIM_PLUGIN_LOADER) { + + files = g_list_append(files, p->path); + } + } + + gaim_prefs_set_string_list("/gaim/gnt/plugins/loaded", files); + g_list_free(files); +} + +static void +selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) +{ + GaimPlugin *plugin = current; + char *text; + + /* XXX: Use formatting and stuff */ + gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); + text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"), + plugin->info->name, plugin->info->version, plugin->info->description, + plugin->info->author, plugin->info->homepage, plugin->path); + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot), + text, GNT_TEXT_FLAG_NORMAL); + gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0); +} + +void gg_plugins_show_all() +{ + GntWidget *window, *tree, *box, *aboot; + GList *iter; + if (plugins.window) + return; + + gaim_plugins_probe(G_MODULE_SUFFIX); + + plugins.window = window = gnt_vbox_new(FALSE); + gnt_box_set_toplevel(GNT_BOX(window), TRUE); + gnt_box_set_title(GNT_BOX(window), _("Plugins")); + gnt_box_set_pad(GNT_BOX(window), 0); + + gnt_box_add_widget(GNT_BOX(window), + gnt_label_new(_("You can (un)load plugins from the following list."))); + gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); + + box = gnt_hbox_new(FALSE); + gnt_box_add_widget(GNT_BOX(window), box); + gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); + + gnt_box_set_pad(GNT_BOX(box), 0); + plugins.tree = tree = gnt_tree_new(); + GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); + gnt_box_add_widget(GNT_BOX(box), tree); + gnt_box_add_widget(GNT_BOX(box), gnt_vline_new()); + + plugins.aboot = aboot = gnt_text_view_new(); + gnt_widget_set_size(aboot, 40, 20); + gnt_box_add_widget(GNT_BOX(box), aboot); + + for (iter = gaim_plugins_get_all(); iter; iter = iter->next) + { + GaimPlugin *plug = iter->data; + + if (plug->info->type != GAIM_PLUGIN_STANDARD || + (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE) || + plug->error) + continue; + + gnt_tree_add_choice(GNT_TREE(tree), plug, + gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL); + gnt_tree_set_choice(GNT_TREE(tree), plug, gaim_plugin_is_loaded(plug)); + } + gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); + g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL); + g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL); + + gnt_widget_show(window); +} + Property changes on: trunk/console/gntplugin.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntplugin.h =================================================================== --- trunk/console/gntplugin.h (rev 0) +++ trunk/console/gntplugin.h 2006-07-31 23:19:12 UTC (rev 16602) @@ -0,0 +1,6 @@ +#include <plugin.h> + +void gg_plugins_show_all(); + +void gg_plugins_save_loaded(); + Property changes on: trunk/console/gntplugin.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/console/gntui.c =================================================================== --- trunk/console/gntui.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/gntui.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -5,13 +5,19 @@ #include "gntconn.h" #include "gntconv.h" #include "gntnotify.h" +#include "gntplugin.h" #include "gntrequest.h" +#include <prefs.h> + void init_gnt_ui() { #ifdef STANDALONE gnt_init(); #endif + + gaim_prefs_add_none("/gaim/gnt"); + /* Accounts */ gg_accounts_init(); gaim_accounts_set_ui_ops(gg_accounts_get_ui_ops()); @@ -35,7 +41,12 @@ gg_request_init(); gaim_request_set_ui_ops(gg_request_get_ui_ops()); + gg_plugins_show_all(); + #ifdef STANDALONE + + gg_plugins_save_loaded(); + gnt_main(); gaim_accounts_set_ui_ops(NULL); Modified: trunk/console/libgnt/gntbox.c =================================================================== --- trunk/console/libgnt/gntbox.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/gntbox.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -430,8 +430,11 @@ for (i = box->list; i; i = i->next) { - gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); - gnt_widget_set_size(i->data, tw + wchange, th + hchange); + if (wid != i->data) + { + gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th); + gnt_widget_set_size(i->data, tw + wchange, th + hchange); + } } reposition_children(widget); Modified: trunk/console/libgnt/gntbutton.c =================================================================== --- trunk/console/libgnt/gntbutton.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/gntbutton.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -33,7 +33,7 @@ GntButton *button = GNT_BUTTON(widget); widget->priv.width = g_utf8_strlen(button->priv->text, -1) + 4; widget->priv.height = 1; - if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) + if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) widget->priv.height += 2; } Modified: trunk/console/libgnt/gntline.c =================================================================== --- trunk/console/libgnt/gntline.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/gntline.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -14,10 +14,10 @@ GntLine *line = GNT_LINE(widget); if (line->vertical) mvwvline(widget->window, 1, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), - widget->priv.height - 3); + widget->priv.height - 2); else mvwhline(widget->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), - widget->priv.width - 3); + widget->priv.width - 2); } static void Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/gntmain.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -551,6 +551,7 @@ initscr(); gnt_init_colors(); + gnt_init_styles(); filename = g_build_filename(g_get_home_dir(), ".gntrc", NULL); gnt_style_read_configure_file(filename); @@ -708,6 +709,7 @@ void gnt_quit() { gnt_uninit_colors(); + gnt_uninit_styles(); endwin(); } Modified: trunk/console/libgnt/gntstyle.c =================================================================== --- trunk/console/libgnt/gntstyle.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/gntstyle.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -1,6 +1,76 @@ #include "gntstyle.h" #include "gntcolors.h" +#include <string.h> + +static char * str_styles[GNT_STYLES]; +static int int_styles[GNT_STYLES]; +static int bool_styles[GNT_STYLES]; + +const char *gnt_style_get(GntStyle style) +{ + return str_styles[style]; +} + +gboolean gnt_style_get_bool(GntStyle style, gboolean def) +{ + int i; + const char * str; + + if (bool_styles[style] != -1) + return bool_styles[style]; + + str = gnt_style_get(style); + + if (str) + { + if (strcmp(str, "false") == 0) + def = FALSE; + else if (strcmp(str, "true") == 0) + def = TRUE; + else if (sscanf(str, "%d", &i) == 1) + { + if (i) + def = TRUE; + else + def = FALSE; + } + } + + bool_styles[style] = def; + return bool_styles[style]; +} + +static void +read_general_style(GKeyFile *kfile) +{ + GError *error = NULL; + gsize nkeys; + char **keys = g_key_file_get_keys(kfile, "general", &nkeys, &error); + int i; + struct + { + const char *style; + GntStyle en; + } styles[] = {{"shadow", GNT_STYLE_SHADOW}, + {NULL, 0}}; + + if (error) + { + /* XXX: some error happened. */ + g_error_free(error); + } + else + { + for (i = 0; styles[i].style; i++) + { + error = NULL; + str_styles[styles[i].en] = + g_key_file_get_string(kfile, "general", styles[i].style, &error); + } + } +} + void gnt_style_read_configure_file(const char *filename) { #if GLIB_CHECK_VERSION(2,6,0) @@ -14,8 +84,27 @@ return; } gnt_colors_parse(kfile); + read_general_style(kfile); g_key_file_free(kfile); #endif } +void gnt_init_styles() +{ + int i; + for (i = 0; i < GNT_STYLES; i++) + { + str_styles[i] = NULL; + int_styles[i] = -1; + bool_styles[i] = -1; + } +} + +void gnt_uninit_styles() +{ + int i; + for (i = 0; i < GNT_STYLES; i++) + g_free(str_styles[i]); +} + Modified: trunk/console/libgnt/gntstyle.h =================================================================== --- trunk/console/libgnt/gntstyle.h 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/gntstyle.h 2006-07-31 23:19:12 UTC (rev 16602) @@ -1,4 +1,19 @@ #include "gnt.h" +typedef enum +{ + GNT_STYLE_SHADOW = 0, + GNT_STYLES +} GntStyle; + void gnt_style_read_configure_file(const char *filename); +/* Returned strings are all lowercase */ +const char *gnt_style_get(GntStyle style); + +gboolean gnt_style_get_bool(GntStyle style, gboolean def); + +void gnt_init_styles(); + +void gnt_uninit_styles(); + Modified: trunk/console/libgnt/gnttextview.c =================================================================== --- trunk/console/libgnt/gnttextview.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/gnttextview.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -182,14 +182,22 @@ view->list = g_list_first(view->list); - split = g_strsplit(text, "\n", 0); + split = g_strsplit(text, "\n", -1); for (i = 0; split[i]; i++) { - GntTextLine *line = view->list->data; + GntTextLine *line; int len = g_utf8_strlen(split[i], -1); char *iter = split[i]; int prev = 0; + if (i) + { + line = g_new0(GntTextLine, 1); + view->list = g_list_prepend(g_list_first(view->list), line); + } + + line = view->list->data; + while (iter && *iter) { GntTextSegment *seg = g_new0(GntTextSegment, 1); Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/gnttree.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -387,7 +387,7 @@ static void tree_selection_changed(GntTree *tree, GntTreeRow *old, GntTreeRow *current) { - g_signal_emit(tree, signals[SIG_SELECTION_CHANGED], 0, old, current); + g_signal_emit(tree, signals[SIG_SELECTION_CHANGED], 0, old->key, current->key); } static GntTreeRow * Modified: trunk/console/libgnt/gntwidget.c =================================================================== --- trunk/console/libgnt/gntwidget.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/gntwidget.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -1,6 +1,7 @@ /* Stuff brutally ripped from Gflib */ #include "gntwidget.h" +#include "gntstyle.h" #include "gntmarshal.h" #include "gnt.h" @@ -290,7 +291,7 @@ { gboolean shadow = TRUE; - if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) + if (!gnt_widget_has_shadow(widget)) shadow = FALSE; widget->window = newwin(widget->priv.height + shadow, widget->priv.width + shadow, @@ -325,7 +326,7 @@ wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); #if 1 /* XXX: I have no clue why, but this seems to be necessary. */ - if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) + if (gnt_widget_has_shadow(widget)) mvwvline(widget->window, 1, widget->priv.width, ' ', widget->priv.height); #endif gnt_screen_release(widget); @@ -361,7 +362,7 @@ gnt_widget_get_size(GntWidget *wid, int *width, int *height) { gboolean shadow = TRUE; - if (GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_NO_SHADOW)) + if (!gnt_widget_has_shadow(wid)) shadow = FALSE; if (width) @@ -376,7 +377,7 @@ { gboolean shadow = TRUE; - if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) + if (!gnt_widget_has_shadow(widget)) shadow = FALSE; wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL)); @@ -384,9 +385,16 @@ if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER)) { - WINDOW *tmp = derwin(widget->window, widget->priv.height, widget->priv.width, 0, 0); - box(tmp, 0, 0); - delwin(tmp); + /* - This is ugly. */ + /* - What's your point? */ + mvwvline(widget->window, 0, 0, ACS_VLINE, widget->priv.height); + mvwvline(widget->window, 0, widget->priv.width - 1, ACS_VLINE, widget->priv.height); + mvwhline(widget->window, widget->priv.height - 1, 0, ACS_HLINE, widget->priv.width); + mvwhline(widget->window, 0, 0, ACS_HLINE, widget->priv.width); + mvwaddch(widget->window, 0, 0, ACS_ULCORNER); + mvwaddch(widget->window, 0, widget->priv.width - 1, ACS_URCORNER); + mvwaddch(widget->window, widget->priv.height - 1, 0, ACS_LLCORNER); + mvwaddch(widget->window, widget->priv.height - 1, widget->priv.width - 1, ACS_LRCORNER); } if (shadow) @@ -402,7 +410,7 @@ { gboolean ret = TRUE; - if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) + if (gnt_widget_has_shadow(widget)) { width--; height--; @@ -418,7 +426,7 @@ gboolean shadow = TRUE; int oldw, oldh; - if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) + if (!gnt_widget_has_shadow(widget)) shadow = FALSE; oldw = widget->priv.width; @@ -518,3 +526,9 @@ GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_INVISIBLE); } +gboolean gnt_widget_has_shadow(GntWidget *widget) +{ + return (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW) && + gnt_style_get_bool(GNT_STYLE_SHADOW, FALSE)); +} + Modified: trunk/console/libgnt/gntwidget.h =================================================================== --- trunk/console/libgnt/gntwidget.h 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/gntwidget.h 2006-07-31 23:19:12 UTC (rev 16602) @@ -129,6 +129,8 @@ void gnt_widget_set_visible(GntWidget *widget, gboolean set); +gboolean gnt_widget_has_shadow(GntWidget *widget); + G_END_DECLS #endif /* GNT_WIDGET_H */ Modified: trunk/console/libgnt/test/multiwin.c =================================================================== --- trunk/console/libgnt/test/multiwin.c 2006-07-30 15:55:30 UTC (rev 16601) +++ trunk/console/libgnt/test/multiwin.c 2006-07-31 23:19:12 UTC (rev 16602) @@ -27,6 +27,7 @@ gnt_widget_set_name(box2, "box2"); tree = gnt_tree_new_with_columns(3); + GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); gnt_tree_set_column_titles(GNT_TREE(tree), "12345678901234567890", "column 2", "column3"); gnt_tree_set_show_title(GNT_TREE(tree), TRUE); gnt_widget_set_name(tree, "tree"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <may...@us...> - 2006-07-30 15:55:40
|
Revision: 16601 Author: mayuan2006 Date: 2006-07-30 08:55:30 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16601&view=rev Log Message: ----------- change Windows Live ID authentication code style to simplify the code. add some comments committed by Ma Yuan<may...@gm...> Modified Paths: -------------- branches/soc-2006-msnp13/src/protocols/msn/contact.c 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/oim.c branches/soc-2006-msnp13/src/protocols/msn/oim.h Modified: branches/soc-2006-msnp13/src/protocols/msn/contact.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-07-30 13:44:34 UTC (rev 16600) +++ branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-07-30 15:55:30 UTC (rev 16601) @@ -415,30 +415,35 @@ msn_soap_post(contact->soapconn,MSN_GET_ADDRESS_TEMPLATE,msn_address_written_cb); } +/*add a Contact */ void msn_add_contact(MsnContact *contact) { } +/*delete a Contact*/ void msn_delete_contact(MsnContact *contact) { } +/*block a Contact*/ void msn_block_contact(MsnContact *contact) { } +/*unblock a contact*/ void msn_unblock_contact(MsnContact *contact) { } +/*get the gleams info*/ void msn_get_gleams(MsnContact *contact) { Modified: branches/soc-2006-msnp13/src/protocols/msn/nexus.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/nexus.c 2006-07-30 13:44:34 UTC (rev 16600) +++ branches/soc-2006-msnp13/src/protocols/msn/nexus.c 2006-07-30 15:55:30 UTC (rev 16601) @@ -26,6 +26,9 @@ #include "nexus.h" #include "notification.h" +/*Local Function Prototype*/ +static void nexus_login_connect_cb(gpointer data, GaimSslConnection *gsc,GaimInputCondition cond); + /************************************************************************** * Main **************************************************************************/ @@ -59,13 +62,8 @@ /************************************************************************** * Login **************************************************************************/ - static void -login_connect_cb(gpointer data, GaimSslConnection *gsc, - GaimInputCondition cond); - -static void -login_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data) +nexus_login_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data) { MsnSoapConn * soapconn = data; MsnSession *session; @@ -78,6 +76,7 @@ * to destroy it here, or we'd crash */ } +/*process the SOAP reply, get the Authentication Info*/ static void nexus_login_read_cb(gpointer data, gint source, GaimInputCondition cond) { @@ -85,6 +84,12 @@ MsnNexus *nexus; MsnSession *session; + char *base, *c; + char *msn_twn_t,*msn_twn_p; + char *login_params; + char **elems, **cur, **tokens; + char * cert_str; + nexus = soapconn->parent; g_return_if_fail(nexus != NULL); session = nexus->session; @@ -92,107 +97,52 @@ // gaim_debug_misc("msn", "TWN Server Reply: {%s}\n", soapconn->read_buf); - if (strstr(soapconn->read_buf, "HTTP/1.1 302") != NULL){ - /* Redirect. */ - char *location, *c; + /*reply OK, we should process the SOAP body*/ + gaim_debug_info("MaYuan","Windows Live ID Reply OK!\n"); - location = strstr(soapconn->read_buf, "Location: "); - if (location == NULL){ - msn_soap_free_read_buf(soapconn); - return; - } - location = strchr(location, ' ') + 1; + //TODO: we should parse it using XML + base = g_strstr_len(soapconn->read_buf, soapconn->read_len, TWN_START_TOKEN); + base += strlen(TWN_START_TOKEN); + c = g_strstr_len(soapconn->read_buf, soapconn->read_len, TWN_END_TOKEN); + login_params = g_strndup(base, c - base); - if ((c = strchr(location, '\r')) != NULL) - *c = '\0'; + // gaim_debug_info("msn", "TWN Cert: {%s}\n", login_params); - /* Skip the http:// */ - if ((c = strchr(location, '/')) != NULL) - location = c + 2; + /* Parse the challenge data. */ + elems = g_strsplit(login_params, "&", 0); - if ((c = strchr(location, '/')) != NULL){ - g_free(soapconn->login_path); - soapconn->login_path = g_strdup(c); + for (cur = elems; *cur != NULL; cur++){ + tokens = g_strsplit(*cur, "=", 2); + g_hash_table_insert(nexus->challenge_data, tokens[0], tokens[1]); + /* Don't free each of the tokens, only the array. */ + g_free(tokens); + } - *c = '\0'; - } - g_free(soapconn->login_host); + g_strfreev(elems); - msn_soap_init(soapconn,location,1,login_connect_cb,login_error_cb); - }else if (strstr(soapconn->read_buf, "HTTP/1.1 401 Unauthorized") != NULL){ - const char *error; + msn_twn_t = (char *)g_hash_table_lookup(nexus->challenge_data, "t"); + msn_twn_p = (char *)g_hash_table_lookup(nexus->challenge_data, "p"); - if ((error = strstr(soapconn->read_buf, "WWW-Authenticate")) != NULL) { - if ((error = strstr(error, "cbtxt=")) != NULL){ - const char *c; - char *temp; - - error += strlen("cbtxt="); - - if ((c = strchr(error, '\n')) == NULL) - c = error + strlen(error); - - temp = g_strndup(error, c - error); - error = gaim_url_decode(temp); - g_free(temp); - } - } - msn_session_set_error(session, MSN_ERROR_AUTH, error); - }else if (strstr(soapconn->read_buf, "HTTP/1.1 200 OK")){ - /*reply OK, we should process the SOAP body*/ - char *base, *c; - char *msn_twn_t,*msn_twn_p; - char *login_params; - - char **elems, **cur, **tokens; - char * cert_str; - - gaim_debug_info("MaYuan","Windows Live ID Reply OK!\n"); - - //TODO: we should parse it using XML - base = g_strstr_len(soapconn->read_buf, soapconn->read_len, TWN_START_TOKEN); - base += strlen(TWN_START_TOKEN); - c = g_strstr_len(soapconn->read_buf, soapconn->read_len, TWN_END_TOKEN); - login_params = g_strndup(base, c - base); - -// gaim_debug_info("msn", "TWN Cert: {%s}\n", login_params); - - /* Parse the challenge data. */ - elems = g_strsplit(login_params, "&", 0); - - for (cur = elems; *cur != NULL; cur++){ - tokens = g_strsplit(*cur, "=", 2); - g_hash_table_insert(nexus->challenge_data, tokens[0], tokens[1]); - /* Don't free each of the tokens, only the array. */ - g_free(tokens); - } - - g_strfreev(elems); - - msn_twn_t = (char *)g_hash_table_lookup(nexus->challenge_data, "t"); - msn_twn_p = (char *)g_hash_table_lookup(nexus->challenge_data, "p"); - - /*setup the t and p parameter for session*/ - if (session->passport_info.t != NULL){ + /*setup the t and p parameter for session*/ + if (session->passport_info.t != NULL){ g_free(session->passport_info.t); - } - session->passport_info.t = g_strdup(msn_twn_t); + } + session->passport_info.t = g_strdup(msn_twn_t); - if (session->passport_info.p != NULL) + if (session->passport_info.p != NULL) g_free(session->passport_info.p); - session->passport_info.p = g_strdup(msn_twn_p); + session->passport_info.p = g_strdup(msn_twn_p); - cert_str = g_strdup_printf("t=%s&p=%s",msn_twn_t,msn_twn_p); - msn_got_login_params(session, cert_str); + cert_str = g_strdup_printf("t=%s&p=%s",msn_twn_t,msn_twn_p); + msn_got_login_params(session, cert_str); - gaim_debug_info("MaYuan","close nexus connection! \n"); - g_free(cert_str); - g_free(login_params); - msn_nexus_destroy(nexus); - session->nexus = NULL; - return; - } - msn_soap_free_read_buf(soapconn); + gaim_debug_info("MaYuan","close nexus connection! \n"); + g_free(cert_str); + g_free(login_params); + msn_nexus_destroy(nexus); + session->nexus = NULL; + + return; } static void @@ -205,8 +155,9 @@ } +/*when connect, do the SOAP Style windows Live ID authentication */ void -login_connect_cb(gpointer data, GaimSslConnection *gsc, +nexus_login_connect_cb(gpointer data, GaimSslConnection *gsc, GaimInputCondition cond) { MsnSoapConn *soapconn; @@ -285,6 +236,6 @@ /* Authenticate via Windows Live ID. */ gaim_debug_info("MaYuan","msn_nexus_connect...\n"); - msn_soap_init(nexus->soapconn,MSN_TWN_SERVER,1,login_connect_cb,login_error_cb); + msn_soap_init(nexus->soapconn,MSN_TWN_SERVER,1,nexus_login_connect_cb,nexus_login_error_cb); } Modified: branches/soc-2006-msnp13/src/protocols/msn/notification.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-07-30 13:44:34 UTC (rev 16600) +++ branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-07-30 15:55:30 UTC (rev 16601) @@ -1370,6 +1370,7 @@ /*new a oim session*/ session = cmdproc->session; session->oim = msn_oim_new(session); +// msn_oim_connect(session->oim); /*parse offline message data*/ elems = g_strsplit(msg->body, "\r\n", 0); Modified: branches/soc-2006-msnp13/src/protocols/msn/oim.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/oim.c 2006-07-30 13:44:34 UTC (rev 16600) +++ branches/soc-2006-msnp13/src/protocols/msn/oim.c 2006-07-30 15:55:30 UTC (rev 16601) @@ -50,9 +50,12 @@ g_free(oim); } +/**************************************** + * OIM send SOAP request + * **************************************/ /*oim SOAP server login error*/ static void -msn_oim_login_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data) +msn_oim_send_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data) { MsnSoapConn *soapconn = data; MsnSession *session; @@ -65,7 +68,7 @@ /*msn oim SOAP server connect process*/ static void -msn_oim_login_connect_cb(gpointer data, GaimSslConnection *gsc, +msn_oim_send_connect_cb(gpointer data, GaimSslConnection *gsc, GaimInputCondition cond) { MsnSoapConn *soapconn = data; @@ -83,13 +86,45 @@ { if(msn_soap_connected(oim->sendconn) == -1){ msn_soap_init(oim->sendconn,MSN_OIM_SEND_HOST,1, - msn_oim_login_connect_cb, - msn_oim_login_error_cb); + msn_oim_send_connect_cb, + msn_oim_send_error_cb); } } +/**************************************** + * OIM get SOAP request + * **************************************/ +/*oim SOAP server login error*/ static void +msn_oim_get_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data) +{ + MsnSoapConn *soapconn = data; + MsnSession *session; + + session = soapconn->session; + g_return_if_fail(session != NULL); + + msn_session_set_error(session, MSN_ERROR_SERV_DOWN, _("Unable to connect to OIM server")); +} + +/*msn oim SOAP server connect process*/ +static void +msn_oim_get_connect_cb(gpointer data, GaimSslConnection *gsc, + GaimInputCondition cond) +{ + MsnSoapConn *soapconn = data; + MsnSession * session; + MsnOim *oim; + + oim = soapconn->parent; + g_return_if_fail(oim != NULL); + + session = oim->session; + g_return_if_fail(session != NULL); +} + +static void msn_oim_get_read_cb(gpointer data, GaimSslConnection *gsc, GaimInputCondition cond) { @@ -107,14 +142,8 @@ soapconn->read_cb = msn_oim_get_read_cb; msn_soap_read_cb(data,source,cond); } -/* -static void -msn_oim_login_connect_cb(gpointer data, GaimSslConnection *gsc, - GaimInputCondition cond) -{ - -}*/ +/*get the conversation*/ static GaimConversation * msn_oim_get_conv(MsnOim *oim,char *passport) { @@ -132,6 +161,7 @@ return conv; } +/*put the OIM Message to User Conversation*/ void msn_oim_report_user(MsnOim *oim,const char *passport,char *msg) { @@ -143,6 +173,7 @@ } +/*parse the oim XML data*/ void msn_parse_oim_msg(MsnOim *oim,char *xmlmsg) { @@ -161,25 +192,24 @@ nNode = xmlnode_get_child(mNode,"N"); nickname = xmlnode_get_data(nNode); gaim_debug_info("MaYuan","E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); - msn_oim_report_user(oim,passport,"hello"); -// msn_oim_get_msg(oim,msgid); +// msn_oim_report_user(oim,passport,"hello"); + msn_oim_get_msg(oim,msgid); } } +/*MSN OIM get SOAP request*/ void msn_oim_get_msg(MsnOim *oim,char *msgid) { const char *oimid ,*oimsoapbody,*t,*p; if(msn_soap_connected(oim->retrieveconn) == -1){ gaim_debug_info("MaYuan","retreive OIM server not connected!\n"); - msn_soap_init(oim->retrieveconn,MSN_OIM_RETRIEVE_HOST,1, - msn_oim_login_connect_cb, - msn_oim_login_error_cb); return; } + gaim_debug_info("MaYuan","Get OIM with SOAP \n"); oim->retrieveconn->login_path = g_strdup(MSN_OIM_RETRIEVE__URL); - oim->retrieveconn->soap_action = g_strdup(MSN_OIM_DEL_SOAP_ACTION); + oim->retrieveconn->soap_action = g_strdup(MSN_OIM_GET_SOAP_ACTION); t = oim->session->passport_info.t; p = oim->session->passport_info.p; @@ -198,8 +228,11 @@ gaim_debug_info("MaYuan","msn_oim_connect...\n"); msn_soap_init(oim->retrieveconn,MSN_OIM_RETRIEVE_HOST,1, - msn_oim_login_connect_cb, - msn_oim_login_error_cb); + msn_oim_get_connect_cb, + msn_oim_get_error_cb); + msn_soap_init(oim->sendconn,MSN_OIM_SEND_HOST,1, + msn_oim_send_connect_cb, + msn_oim_send_error_cb); } /*endof oim.c*/ Modified: branches/soc-2006-msnp13/src/protocols/msn/oim.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/oim.h 2006-07-30 13:44:34 UTC (rev 16600) +++ branches/soc-2006-msnp13/src/protocols/msn/oim.h 2006-07-30 15:55:30 UTC (rev 16601) @@ -98,6 +98,8 @@ /*function prototype*/ MsnOim * msn_oim_new(MsnSession *session); void msn_oim_destroy(MsnOim *oim); +void msn_oim_connect(MsnOim *oim); + void msn_parse_oim_msg(MsnOim *oim,char *xmlmsg); void msn_oim_get_msg(MsnOim *oim,char *msgid); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <may...@us...> - 2006-07-30 13:51:03
|
Revision: 16600 Author: mayuan2006 Date: 2006-07-30 06:44:34 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16600&view=rev Log Message: ----------- change to add SOAP HTTP header retrieve Now Can do the OIM Message XML process submitted by Ma Yuan<may...@gm...> Modified Paths: -------------- branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c branches/soc-2006-msnp13/src/protocols/msn/contact.h branches/soc-2006-msnp13/src/protocols/msn/msg.c branches/soc-2006-msnp13/src/protocols/msn/msn-utils.c branches/soc-2006-msnp13/src/protocols/msn/notification.c branches/soc-2006-msnp13/src/protocols/msn/oim.c branches/soc-2006-msnp13/src/protocols/msn/oim.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/soap.c Modified: branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c 2006-07-29 22:03:25 UTC (rev 16599) +++ branches/soc-2006-msnp13/src/protocols/msn/cmdproc.c 2006-07-30 13:44:34 UTC (rev 16600) @@ -133,7 +133,7 @@ } msn_servconn_write(servconn, data, len); - gaim_debug_info("<<","%s\n",data); +// gaim_debug_info("<<","%s\n",data); g_free(data); } Modified: branches/soc-2006-msnp13/src/protocols/msn/contact.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/contact.h 2006-07-29 22:03:25 UTC (rev 16599) +++ branches/soc-2006-msnp13/src/protocols/msn/contact.h 2006-07-30 13:44:34 UTC (rev 16600) @@ -27,6 +27,7 @@ #define MSN_CONTACT_SERVER "contacts.msn.com" +/*get contact list soap request template*/ #define MSN_GET_CONTACT_POST_URL "/abservice/SharingService.asmx" #define MSN_GET_CONTACT_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership" #define MSN_GET_CONTACT_TEMPLATE "<?xml version='1.0' encoding='utf-8'?>"\ @@ -56,6 +57,7 @@ "</soap:Body>"\ "</soap:Envelope>" +/*get addressbook soap request template*/ #define MSN_GET_ADDRESS_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll" #define MSN_GET_ADDRESS_POST_URL "/abservice/abservice.asmx" #define MSN_GET_ADDRESS_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ @@ -78,6 +80,7 @@ "</soap:Body>"\ "</soap:Envelope>" +/*Gleams SOAP request template*/ #define MSN_GLEAMS_TEMPLATE = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ "<soap:Header>"\ @@ -100,11 +103,13 @@ "</soap:Body>"\ "</soap:Envelope>" +/*add conatct soap request*/ #define MSN_CONTACT_ADD_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABContactAdd" #define MSN_CONTACT_XML "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\"><contactInfo><contactType>LivePending</contactType><passportName>%s</passportName><isMessengerUser>true</isMessengerUser></contactInfo></Contact>" #define MSN_ADD_CONTACT_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>ContactSave</PartnerScenario></ABApplicationHeader><ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\"><ManagedGroupRequest>false</ManagedGroupRequest></ABAuthHeader></soap:Header><soap:Body><ABContactAdd xmlns=\"http://www.msn.com/webservices/AddressBook\"><abId>00000000-0000-0000-0000-000000000000</abId><contacts>%s</contacts><options><EnableAllowListManagement>true</EnableAllowListManagement></options></ABContactAdd></soap:Body></soap:Envelope>" +/*delete contact from contact list soap request template*/ #define MSN_CONTACT_DEL_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABContactDelete" #define MSN_CONTACTS_DEL "<Contact><contactId>5e8a2e64-c271-443f-ac86-2429f3ffd18a</contactId></Contact>" #define MSN_DEL_CONTACT_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><ABContactDelete xmlns=\"http://www.msn.com/webservices/AddressBook\"><abId>00000000-0000-0000-0000-000000000000</abId><contacts>%s</contacts></ABContactDelete></soap:Body></soap:Envelope>" Modified: branches/soc-2006-msnp13/src/protocols/msn/msg.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/msg.c 2006-07-29 22:03:25 UTC (rev 16599) +++ branches/soc-2006-msnp13/src/protocols/msn/msg.c 2006-07-30 13:44:34 UTC (rev 16600) @@ -214,7 +214,7 @@ char **elems, **cur, **tokens; g_return_if_fail(payload != NULL); - + gaim_debug_info("MaYuan","payload:{%s}\n",payload); tmp_base = tmp = g_malloc0(payload_len + 1); memcpy(tmp_base, payload, payload_len); Modified: branches/soc-2006-msnp13/src/protocols/msn/msn-utils.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/msn-utils.c 2006-07-29 22:03:25 UTC (rev 16599) +++ branches/soc-2006-msnp13/src/protocols/msn/msn-utils.c 2006-07-30 13:44:34 UTC (rev 16600) @@ -386,7 +386,7 @@ } /* - * handle MSN Chanllege computation + * Handle MSN Chanllege computation *This algorithm reference with http://msnpiki.msnfanatic.com/index.php/MSNP11:Challenges */ #define BUFSIZE 256 Modified: branches/soc-2006-msnp13/src/protocols/msn/notification.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-07-29 22:03:25 UTC (rev 16599) +++ branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-07-30 13:44:34 UTC (rev 16600) @@ -390,6 +390,7 @@ }else{ g_return_if_fail(cmd->payload_cb != NULL); + gaim_debug_info("MaYuan","MSG payload:{%s}\n",cmd->payload); cmd->payload_cb(cmdproc, cmd, cmd->payload, cmd->payload_len); } } @@ -1359,7 +1360,40 @@ static void initial_mdata_msg(MsnCmdProc *cmdproc, MsnMessage *msg) { - gaim_debug_info("MaYuan","mdata...{%s} \n",msg->body); + MsnSession *session; + xmlnode *mdNode; + char *end; + char **elems, **cur, **tokens; + +// gaim_debug_info("MaYuan","mdata...{%s} \n",msg->body); + + /*new a oim session*/ + session = cmdproc->session; + session->oim = msn_oim_new(session); + + /*parse offline message data*/ + elems = g_strsplit(msg->body, "\r\n", 0); + for (cur = elems; *cur != NULL; cur++){ + const char *key, *value; + +// gaim_debug_info("MaYuan","cur:{%s}\n",*cur); + tokens = g_strsplit(*cur, ": ", 2); + + key = tokens[0]; + value = tokens[1]; + + /*if not MIME content ,then return*/ + if ((key != NULL) && (!strcmp(key, "Mail-Data")) ){ +// gaim_debug_info("MaYuan","data:{%s}\n",value); + msn_parse_oim_msg(session->oim,value); + g_strfreev(tokens); + break; + } + + g_strfreev(tokens); + } + + g_strfreev(elems); } static void Modified: branches/soc-2006-msnp13/src/protocols/msn/oim.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/oim.c 2006-07-29 22:03:25 UTC (rev 16599) +++ branches/soc-2006-msnp13/src/protocols/msn/oim.c 2006-07-30 13:44:34 UTC (rev 16600) @@ -79,7 +79,7 @@ g_return_if_fail(session != NULL); } -void msn_oim_send_msg(MsnOim *oim,char * msg) +void msn_oim_send_msg(MsnOim *oim,char *msg) { if(msn_soap_connected(oim->sendconn) == -1){ msn_soap_init(oim->sendconn,MSN_OIM_SEND_HOST,1, @@ -89,6 +89,108 @@ } +static void +msn_oim_get_read_cb(gpointer data, GaimSslConnection *gsc, + GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + MsnOim * msnoim; + + gaim_debug_info("MaYuan","read buffer:{%s}\n",soapconn->body); +} + +static void +msn_oim_get_written_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + + soapconn->read_cb = msn_oim_get_read_cb; + msn_soap_read_cb(data,source,cond); +} +/* +static void +msn_oim_login_connect_cb(gpointer data, GaimSslConnection *gsc, + GaimInputCondition cond) +{ + +}*/ + +static GaimConversation * +msn_oim_get_conv(MsnOim *oim,char *passport) +{ + GaimAccount *account; + GaimConversation * conv; + + g_return_val_if_fail(oim != NULL, NULL); + account = oim->session->account; + + conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, + passport, account); + if(conv == NULL){ + conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, passport); + } + return conv; +} + +void +msn_oim_report_user(MsnOim *oim,const char *passport,char *msg) +{ + GaimConversation * conv; + + if ((conv = msn_oim_get_conv(oim,passport)) != NULL){ + gaim_conversation_write(conv, NULL, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); + } + +} + +void +msn_parse_oim_msg(MsnOim *oim,char *xmlmsg) +{ + xmlnode *mdNode,*mNode,*INode,*nNode,*ENode,*rtNode; + char *passport,*rTime,*msgid,*nickname; + + mdNode = xmlnode_from_str(xmlmsg, strlen(xmlmsg)); + for(mNode = xmlnode_get_child(mdNode, "M"); mNode; + mNode = xmlnode_get_next_twin(mNode)){ + INode = xmlnode_get_child(mNode,"E"); + passport = xmlnode_get_data(INode); + INode = xmlnode_get_child(mNode,"I"); + msgid = xmlnode_get_data(INode); + rtNode = xmlnode_get_child(mNode,"RT"); + rTime = xmlnode_get_data(rtNode); + nNode = xmlnode_get_child(mNode,"N"); + nickname = xmlnode_get_data(nNode); + gaim_debug_info("MaYuan","E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); + msn_oim_report_user(oim,passport,"hello"); +// msn_oim_get_msg(oim,msgid); + } +} + +void msn_oim_get_msg(MsnOim *oim,char *msgid) +{ + const char *oimid ,*oimsoapbody,*t,*p; + + if(msn_soap_connected(oim->retrieveconn) == -1){ + gaim_debug_info("MaYuan","retreive OIM server not connected!\n"); + msn_soap_init(oim->retrieveconn,MSN_OIM_RETRIEVE_HOST,1, + msn_oim_login_connect_cb, + msn_oim_login_error_cb); + return; + } + + oim->retrieveconn->login_path = g_strdup(MSN_OIM_RETRIEVE__URL); + oim->retrieveconn->soap_action = g_strdup(MSN_OIM_DEL_SOAP_ACTION); + t = oim->session->passport_info.t; + p = oim->session->passport_info.p; + + oimsoapbody = g_strdup_printf(MSN_OIM_GET_TEMPLATE, + t, + p, + msgid + ); + msn_soap_post(oim->retrieveconn, oimsoapbody, msn_oim_get_written_cb); +} + /*msn oim server connect*/ void msn_oim_connect(MsnOim *oim) Modified: branches/soc-2006-msnp13/src/protocols/msn/oim.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/oim.h 2006-07-29 22:03:25 UTC (rev 16599) +++ branches/soc-2006-msnp13/src/protocols/msn/oim.h 2006-07-30 13:44:34 UTC (rev 16600) @@ -98,6 +98,8 @@ /*function prototype*/ MsnOim * msn_oim_new(MsnSession *session); void msn_oim_destroy(MsnOim *oim); +void msn_parse_oim_msg(MsnOim *oim,char *xmlmsg); +void msn_oim_get_msg(MsnOim *oim,char *msgid); #endif/* _MSN_OIM_H_*/ /*endof oim.h*/ Modified: branches/soc-2006-msnp13/src/protocols/msn/session.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/session.c 2006-07-29 22:03:25 UTC (rev 16599) +++ branches/soc-2006-msnp13/src/protocols/msn/session.c 2006-07-30 13:44:34 UTC (rev 16600) @@ -91,6 +91,11 @@ if (session->nexus != NULL) msn_nexus_destroy(session->nexus); + if (session->contact != NULL) + msn_contact_destroy(session->contact); + if (session->oim != NULL) + msn_oim_destroy(session->oim); + if (session->user != NULL) msn_user_destroy(session->user); Modified: branches/soc-2006-msnp13/src/protocols/msn/session.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/session.h 2006-07-29 22:03:25 UTC (rev 16599) +++ branches/soc-2006-msnp13/src/protocols/msn/session.h 2006-07-30 13:44:34 UTC (rev 16600) @@ -39,6 +39,7 @@ #include "nexus.h" #include "httpconn.h" #include "contact.h" +#include "oim.h" #include "userlist.h" #include "sync.h" @@ -96,6 +97,7 @@ MsnNotification *notification; MsnNexus *nexus; MsnContact *contact; + MsnOim *oim; MsnSync *sync; MsnUserList *userlist; Modified: branches/soc-2006-msnp13/src/protocols/msn/soap.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/soap.c 2006-07-29 22:03:25 UTC (rev 16599) +++ branches/soc-2006-msnp13/src/protocols/msn/soap.c 2006-07-30 13:44:34 UTC (rev 16600) @@ -117,7 +117,9 @@ msn_soap_free_write_buf(soapconn); /*close ssl connection*/ - gaim_ssl_close(soapconn->gsc); + if(soapconn->gsc != NULL){ + gaim_ssl_close(soapconn->gsc); + } soapconn->gsc = NULL; g_free(soapconn); @@ -199,41 +201,104 @@ return; } - body_start = (char *)g_strstr_len(soapconn->read_buf, soapconn->read_len,"\r\n\r\n"); - if(!body_start){ - return; + if (strstr(soapconn->read_buf, "HTTP/1.1 302") != NULL) + { + /* Redirect. */ + char *location, *c; + + location = strstr(soapconn->read_buf, "Location: "); + if (location == NULL) + { + msn_soap_free_read_buf(soapconn); + + return; + } + location = strchr(location, ' ') + 1; + + if ((c = strchr(location, '\r')) != NULL) + *c = '\0'; + + /* Skip the http:// */ + if ((c = strchr(location, '/')) != NULL) + location = c + 2; + + if ((c = strchr(location, '/')) != NULL) + { + g_free(soapconn->login_path); + soapconn->login_path = g_strdup(c); + + *c = '\0'; + } + + g_free(soapconn->login_host); + soapconn->login_host = g_strdup(location); + + gaim_ssl_connect(session->account, soapconn->login_host, + GAIM_SSL_DEFAULT_PORT, msn_soap_connect_cb, + msn_soap_error_cb, soapconn); } - body_start += 4; + else if (strstr(soapconn->read_buf, "HTTP/1.1 401 Unauthorized") != NULL) + { + const char *error; -// gaim_debug_misc("msn", "Soap Read: {%s}\n", soapconn->read_buf); + if ((error = strstr(soapconn->read_buf, "WWW-Authenticate")) != NULL) + { + if ((error = strstr(error, "cbtxt=")) != NULL) + { + const char *c; + char *temp; - /* we read the content-length*/ - length_start = strstr(soapconn->read_buf, "Content-Length: "); - length_start += strlen("Content-Length: "); - length_end = strstr(length_start, "\r\n"); - body_len = g_strndup(length_start,length_end - length_start); + error += strlen("cbtxt="); - /*setup the conn body */ - soapconn->body = body_start; - soapconn->body_len = atoi(body_len); -// gaim_debug_misc("MaYuan","content length :%d",soapconn->body_len); + if ((c = strchr(error, '\n')) == NULL) + c = error + strlen(error); - if(soapconn->read_len < body_start - soapconn->read_buf + atoi(body_len)){ - return; + temp = g_strndup(error, c - error); + error = gaim_url_decode(temp); + g_free(temp); + } + } + + msn_session_set_error(session, MSN_ERROR_SERV_UNAVAILABLE, error); } + else if (strstr(soapconn->read_buf, "HTTP/1.1 200 OK")) + { + /*OK! process the SOAP body*/ + body_start = (char *)g_strstr_len(soapconn->read_buf, soapconn->read_len,"\r\n\r\n"); + if(!body_start){ + return; + } + body_start += 4; - g_free(body_len); + // gaim_debug_misc("msn", "Soap Read: {%s}\n", soapconn->read_buf); + /* we read the content-length*/ + length_start = strstr(soapconn->read_buf, "Content-Length: "); + length_start += strlen("Content-Length: "); + length_end = strstr(length_start, "\r\n"); + body_len = g_strndup(length_start,length_end - length_start); + + /*setup the conn body */ + soapconn->body = body_start; + soapconn->body_len = atoi(body_len); + // gaim_debug_misc("MaYuan","content length :%d",soapconn->body_len); + + if(soapconn->read_len < body_start - soapconn->read_buf + atoi(body_len)){ + return; + } + + g_free(body_len); + #if 1 - /*remove the read handler*/ - gaim_input_remove(soapconn->input_handler); - soapconn->input_handler = -1; + /*remove the read handler*/ + gaim_input_remove(soapconn->input_handler); + soapconn->input_handler = -1; #endif - /*call the read callback*/ - if(soapconn->read_cb != NULL){ - soapconn->read_cb(soapconn,source,0); - } + /*call the read callback*/ + if(soapconn->read_cb != NULL){ + soapconn->read_cb(soapconn,source,0); + } #if 0 /*clear the read buffer*/ msn_soap_free_read_buf(soapconn); @@ -241,9 +306,10 @@ /*remove the read handler*/ gaim_input_remove(soapconn->input_handler); soapconn->input_handler = -1; -// gaim_ssl_close(soapconn->gsc); -// soapconn->gsc = NULL; + // gaim_ssl_close(soapconn->gsc); + // soapconn->gsc = NULL; #endif + } } void @@ -360,7 +426,7 @@ /*free read buffer*/ msn_soap_free_read_buf(soapconn); -// gaim_debug_info("MaYuan","send to contact server{%s}\n",request_str); + gaim_debug_info("MaYuan","send to server{%s}\n",request_str); msn_soap_write(soapconn,request_str,written_cb); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <amc...@us...> - 2006-07-29 22:04:19
|
Revision: 16599 Author: amc_grim Date: 2006-07-29 15:03:25 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16599&view=rev Log Message: ----------- Using this as a playground... Added Paths: ----------- branches/restructure/ Copied: branches/restructure (from rev 16598, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2006-07-29 21:39:13
|
Revision: 16598 Author: roast Date: 2006-07-29 14:38:18 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16598&view=rev Log Message: ----------- merged with svn trunk. 16534:16597. Modified Paths: -------------- branches/soc-2006-file-loggers/COPYRIGHT branches/soc-2006-file-loggers/config.h.mingw branches/soc-2006-file-loggers/configure.ac branches/soc-2006-file-loggers/console/Makefile branches/soc-2006-file-loggers/console/gntaccount.c branches/soc-2006-file-loggers/console/gntaccount.h branches/soc-2006-file-loggers/console/gntconv.c branches/soc-2006-file-loggers/console/gntgaim.c branches/soc-2006-file-loggers/console/gntnotify.c branches/soc-2006-file-loggers/console/gntui.c branches/soc-2006-file-loggers/console/libgnt/Makefile.am branches/soc-2006-file-loggers/console/libgnt/gntbox.c branches/soc-2006-file-loggers/console/libgnt/gntbutton.c branches/soc-2006-file-loggers/console/libgnt/gntcolors.c branches/soc-2006-file-loggers/console/libgnt/gntcolors.h branches/soc-2006-file-loggers/console/libgnt/gntcombobox.c branches/soc-2006-file-loggers/console/libgnt/gntcombobox.h branches/soc-2006-file-loggers/console/libgnt/gntentry.c branches/soc-2006-file-loggers/console/libgnt/gntentry.h branches/soc-2006-file-loggers/console/libgnt/gntmain.c branches/soc-2006-file-loggers/console/libgnt/gnttree.c branches/soc-2006-file-loggers/console/libgnt/gnttree.h branches/soc-2006-file-loggers/console/libgnt/gntwidget.c branches/soc-2006-file-loggers/console/libgnt/gntwidget.h branches/soc-2006-file-loggers/console/libgnt/test/combo.c branches/soc-2006-file-loggers/doc/gtkconv-signals.dox branches/soc-2006-file-loggers/doc/log-signals.dox branches/soc-2006-file-loggers/plugins/ChangeLog.API branches/soc-2006-file-loggers/plugins/timestamp_format.c branches/soc-2006-file-loggers/src/conversation.c branches/soc-2006-file-loggers/src/gtkaccount.c branches/soc-2006-file-loggers/src/gtkconn.c branches/soc-2006-file-loggers/src/gtkconv.c branches/soc-2006-file-loggers/src/gtkconv.h branches/soc-2006-file-loggers/src/log.c branches/soc-2006-file-loggers/src/notify.c branches/soc-2006-file-loggers/src/protocols/gg/gg.c branches/soc-2006-file-loggers/src/protocols/jabber/jabber.c branches/soc-2006-file-loggers/src/protocols/jabber/jabber.h branches/soc-2006-file-loggers/src/protocols/jabber/message.c branches/soc-2006-file-loggers/src/protocols/msn/servconn.c branches/soc-2006-file-loggers/src/protocols/oscar/flap_connection.c branches/soc-2006-file-loggers/src/protocols/oscar/odc.c branches/soc-2006-file-loggers/src/protocols/oscar/oscar.h branches/soc-2006-file-loggers/src/protocols/qq/Makefile.am branches/soc-2006-file-loggers/src/protocols/qq/Makefile.mingw branches/soc-2006-file-loggers/src/protocols/qq/buddy_info.c branches/soc-2006-file-loggers/src/protocols/qq/buddy_info.h branches/soc-2006-file-loggers/src/protocols/qq/buddy_list.c branches/soc-2006-file-loggers/src/protocols/qq/buddy_status.c branches/soc-2006-file-loggers/src/protocols/qq/buddy_status.h branches/soc-2006-file-loggers/src/protocols/qq/crypt.c branches/soc-2006-file-loggers/src/protocols/qq/group_opt.c branches/soc-2006-file-loggers/src/protocols/qq/qq.c branches/soc-2006-file-loggers/src/protocols/qq/qq.h branches/soc-2006-file-loggers/src/protocols/qq/qq_proxy.c branches/soc-2006-file-loggers/src/protocols/qq/qq_proxy.h branches/soc-2006-file-loggers/src/protocols/qq/utils.c branches/soc-2006-file-loggers/src/protocols/qq/utils.h branches/soc-2006-file-loggers/src/protocols/sametime/sametime.c branches/soc-2006-file-loggers/src/protocols/simple/simple.c branches/soc-2006-file-loggers/src/signals.c branches/soc-2006-file-loggers/src/signals.h branches/soc-2006-file-loggers/src/sslconn.c branches/soc-2006-file-loggers/src/value.h branches/soc-2006-file-loggers/src/win32/win32dep.c Added Paths: ----------- branches/soc-2006-file-loggers/console/gntdebug.c branches/soc-2006-file-loggers/console/gntdebug.h branches/soc-2006-file-loggers/console/gntprefs.c branches/soc-2006-file-loggers/console/gntprefs.h branches/soc-2006-file-loggers/console/gntrequest.c branches/soc-2006-file-loggers/console/gntrequest.h branches/soc-2006-file-loggers/console/libgnt/gntcheckbox.c branches/soc-2006-file-loggers/console/libgnt/gntcheckbox.h branches/soc-2006-file-loggers/console/libgnt/gntrc.sample branches/soc-2006-file-loggers/console/libgnt/gntstyle.c branches/soc-2006-file-loggers/console/libgnt/gntstyle.h Removed Paths: ------------- branches/soc-2006-file-loggers/src/protocols/qq/TODO branches/soc-2006-file-loggers/src/protocols/qq/group_admindlg.c branches/soc-2006-file-loggers/src/protocols/qq/group_admindlg.h branches/soc-2006-file-loggers/src/protocols/qq/infodlg.c branches/soc-2006-file-loggers/src/protocols/qq/infodlg.h branches/soc-2006-file-loggers/src/protocols/qq/show.c branches/soc-2006-file-loggers/src/protocols/qq/show.h Modified: branches/soc-2006-file-loggers/COPYRIGHT =================================================================== --- branches/soc-2006-file-loggers/COPYRIGHT 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/COPYRIGHT 2006-07-29 21:38:18 UTC (rev 16598) @@ -195,6 +195,7 @@ Richard Nelson Dennis Nezic Matthew A. Nicholson +Henning Norén Szilard Novaki Novell Padraig O'Briain Modified: branches/soc-2006-file-loggers/config.h.mingw =================================================================== --- branches/soc-2006-file-loggers/config.h.mingw 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/config.h.mingw 2006-07-29 21:38:18 UTC (rev 16598) @@ -641,3 +641,5 @@ * Following are added for Win32 version of Gaim */ #define HAVE_VSNPRINTF 1 + +#define SIZEOF_TIME_T 4 Modified: branches/soc-2006-file-loggers/configure.ac =================================================================== --- branches/soc-2006-file-loggers/configure.ac 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/configure.ac 2006-07-29 21:38:18 UTC (rev 16598) @@ -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: branches/soc-2006-file-loggers/console/Makefile =================================================================== --- branches/soc-2006-file-loggers/console/Makefile 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/Makefile 2006-07-29 21:38:18 UTC (rev 16598) @@ -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 Modified: branches/soc-2006-file-loggers/console/gntaccount.c =================================================================== --- branches/soc-2006-file-loggers/console/gntaccount.c 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/gntaccount.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -1,6 +1,7 @@ #include <gnt.h> #include <gntbox.h> #include <gntbutton.h> +#include <gntcheckbox.h> #include <gntcombobox.h> #include <gntentry.h> #include <gntlabel.h> @@ -17,6 +18,8 @@ #include "gntaccount.h" #include "gntgaim.h" +#include <string.h> + typedef struct { GntWidget *window; @@ -38,17 +41,157 @@ GntWidget *splits; GList *split_entries; + + GList *prpl_entries; + GntWidget *prpls; + + GntWidget *newmail; + GntWidget *remember; } AccountEditDialog; static void +account_add(GaimAccount *account) +{ + gnt_tree_add_choice(GNT_TREE(accounts.tree), account, + gnt_tree_create_row(GNT_TREE(accounts.tree), + gaim_account_get_username(account), + gaim_account_get_protocol_name(account)), + NULL, NULL); + gnt_tree_set_choice(GNT_TREE(accounts.tree), account, + gaim_account_get_enabled(account, GAIM_GNT_UI)); +} + +static void edit_dialog_destroy(AccountEditDialog *dialog) { + g_list_free(dialog->prpl_entries); + g_list_free(dialog->split_entries); g_free(dialog); } static void save_account_cb(AccountEditDialog *dialog) { + GaimAccount *account; + GaimPlugin *plugin; + GaimPluginProtocolInfo *prplinfo; + const char *value; + GString *username; + + /* XXX: Do some error checking first. */ + + plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); + prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); + + /* Screenname && user-splits */ + value = gnt_entry_get_text(GNT_ENTRY(dialog->screenname)); + + if (value == NULL || *value == '\0') + { + gaim_notify_error(NULL, _("Error"), _("Account was not added"), + _("Screenname of an account must be non-empty.")); + return; + } + + username = g_string_new(value); + + if (prplinfo != NULL) + { + GList *iter, *entries; + for (iter = prplinfo->user_splits, entries = dialog->split_entries; + iter && entries; iter = iter->next, entries = entries->next) + { + GaimAccountUserSplit *split = iter->data; + GntWidget *entry = entries->data; + + value = gnt_entry_get_text(GNT_ENTRY(entry)); + if (value == NULL || *value == '\0') + value = gaim_account_user_split_get_default_value(split); + g_string_append_printf(username, "%c%s", + gaim_account_user_split_get_separator(split), + value); + } + } + + if (dialog->account == NULL) + { + account = gaim_account_new(username->str, gaim_plugin_get_id(plugin)); + gaim_accounts_add(account); + } + else + { + account = dialog->account; + + /* Protocol */ + gaim_account_set_protocol_id(account, gaim_plugin_get_id(plugin)); + gaim_account_set_username(account, username->str); + } + g_string_free(username, TRUE); + + /* Alias */ + value = gnt_entry_get_text(GNT_ENTRY(dialog->alias)); + if (value && *value) + gaim_account_set_alias(account, value); + + /* Remember password and password */ + gaim_account_set_remember_password(account, + gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->remember))); + value = gnt_entry_get_text(GNT_ENTRY(dialog->password)); + if (value && *value && gaim_account_get_remember_password(account)) + gaim_account_set_password(account, value); + else + gaim_account_set_password(account, NULL); + + /* Mail notification */ + /* XXX: Only if the protocol has anything to do with emails */ + gaim_account_set_check_mail(account, + gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->newmail))); + + /* Protocol options */ + if (prplinfo) + { + GList *iter, *entries; + + for (iter = prplinfo->protocol_options, entries = dialog->prpl_entries; + iter && entries; iter = iter->next, entries = entries->next) + { + GaimAccountOption *option = iter->data; + GntWidget *entry = entries->data; + GaimPrefType type = gaim_account_option_get_type(option); + const char *setting = gaim_account_option_get_setting(option); + + if (type == GAIM_PREF_STRING) + { + const char *value = gnt_entry_get_text(GNT_ENTRY(entry)); + gaim_account_set_string(account, setting, value); + } + else if (type == GAIM_PREF_INT) + { + const char *str = gnt_entry_get_text(GNT_ENTRY(entry)); + int value = 0; + if (str) + value = atoi(str); + gaim_account_set_int(account, setting, value); + } + else if (type == GAIM_PREF_BOOLEAN) + { + gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(entry)); + gaim_account_set_bool(account, setting, value); + } + else if (type == GAIM_PREF_STRING_LIST) + { + /* TODO: */ + } + else + { + g_assert_not_reached(); + } + } + } + + /* XXX: Proxy options */ + + gnt_widget_destroy(dialog->window); } static void @@ -57,7 +200,7 @@ GntWidget *hbox; GaimPlugin *plugin; GaimPluginProtocolInfo *prplinfo; - GList *iter; + GList *iter, *entries; char *username = NULL; if (dialog->splits) @@ -99,20 +242,184 @@ g_free(buf); } - /* XXX: Add default/custom values to the splits */ + for (iter = g_list_last(prplinfo->user_splits), entries = g_list_last(dialog->split_entries); + iter && entries; iter = iter->prev, entries = entries->prev) + { + GntWidget *entry = entries->data; + GaimAccountUserSplit *split = iter->data; + const char *value = NULL; + char *s; + + if (dialog->account) + { + s = strrchr(username, gaim_account_user_split_get_separator(split)); + if (s != NULL) + { + *s = '\0'; + s++; + value = s; + } + } + if (value == NULL) + value = gaim_account_user_split_get_default_value(split); + + if (value != NULL) + gnt_entry_set_text(GNT_ENTRY(entry), value); + } + + if (username != NULL) + gnt_entry_set_text(GNT_ENTRY(dialog->screenname), username); + g_free(username); } static void +add_protocol_options(AccountEditDialog *dialog) +{ + GaimPlugin *plugin; + GaimPluginProtocolInfo *prplinfo; + GList *iter; + GntWidget *vbox, *box; + GaimAccount *account; + + if (dialog->prpls) + gnt_box_remove_all(GNT_BOX(dialog->prpls)); + else + { + dialog->prpls = vbox = gnt_vbox_new(FALSE); + gnt_box_set_pad(GNT_BOX(vbox), 0); + gnt_box_set_alignment(GNT_BOX(vbox), GNT_ALIGN_LEFT); + gnt_box_set_fill(GNT_BOX(vbox), TRUE); + } + + if (dialog->prpl_entries) + { + g_list_free(dialog->prpl_entries); + dialog->prpl_entries = NULL; + } + + vbox = dialog->prpls; + + plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); + if (!plugin) + return; + + prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); + + account = dialog->account; + + for (iter = prplinfo->protocol_options; iter; iter = iter->next) + { + GaimAccountOption *option = iter->data; + GaimPrefType type = gaim_account_option_get_type(option); + + box = gnt_hbox_new(TRUE); + gnt_box_set_pad(GNT_BOX(box), 0); + gnt_box_add_widget(GNT_BOX(vbox), box); + + if (type == GAIM_PREF_BOOLEAN) + { + GntWidget *widget = gnt_check_box_new(gaim_account_option_get_text(option)); + gnt_box_add_widget(GNT_BOX(box), widget); + dialog->prpl_entries = g_list_append(dialog->prpl_entries, widget); + + if (account) + gnt_check_box_set_checked(GNT_CHECK_BOX(widget), + gaim_account_get_bool(account, + gaim_account_option_get_setting(option), + gaim_account_option_get_default_bool(option))); + else + gnt_check_box_set_checked(GNT_CHECK_BOX(widget), + gaim_account_option_get_default_bool(option)); + } + else + { + gnt_box_add_widget(GNT_BOX(box), + gnt_label_new(gaim_account_option_get_text(option))); + + if (type == GAIM_PREF_STRING_LIST) + { + /* TODO: Use a combobox */ + /* Don't forget to append the widget to prpl_entries */ + } + else + { + GntWidget *entry = gnt_entry_new(NULL); + gnt_box_add_widget(GNT_BOX(box), entry); + dialog->prpl_entries = g_list_append(dialog->prpl_entries, entry); + + if (type == GAIM_PREF_STRING) + { + const char *dv = gaim_account_option_get_default_string(option); + + if (account) + gnt_entry_set_text(GNT_ENTRY(entry), + gaim_account_get_string(account, + gaim_account_option_get_setting(option), dv)); + else + gnt_entry_set_text(GNT_ENTRY(entry), dv); + } + else if (type == GAIM_PREF_INT) + { + char str[32]; + int value = gaim_account_option_get_default_int(option); + if (account) + value = gaim_account_get_int(account, + gaim_account_option_get_setting(option), value); + snprintf(str, sizeof(str), "%d", value); + gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); + gnt_entry_set_text(GNT_ENTRY(entry), str); + } + else + { + g_assert_not_reached(); + } + } + } + } +} + +static void +update_user_options(AccountEditDialog *dialog) +{ + GaimPlugin *plugin; + GaimPluginProtocolInfo *prplinfo; + + plugin = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); + if (!plugin) + return; + + prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plugin); + + if (dialog->newmail == NULL) + dialog->newmail = gnt_check_box_new(_("New mail notifications")); + if (dialog->account) + gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->newmail), + gaim_account_get_check_mail(dialog->account)); + if (!prplinfo || !(prplinfo->options & OPT_PROTO_MAIL_CHECK)) + gnt_widget_set_visible(dialog->newmail, FALSE); + else + gnt_widget_set_visible(dialog->newmail, TRUE); + + if (dialog->remember == NULL) + dialog->remember = gnt_check_box_new(_("Remember password")); + if (dialog->account) + gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->remember), + gaim_account_get_remember_password(dialog->account)); +} + +static void prpl_changed_cb(GntWidget *combo, GaimPlugin *old, GaimPlugin *new, AccountEditDialog *dialog) { update_user_splits(dialog); + add_protocol_options(dialog); + update_user_options(dialog); /* This may not be necessary here */ gnt_box_readjust(GNT_BOX(dialog->window)); gnt_widget_draw(dialog->window); } static void -add_account(GntWidget *b, gpointer null) +edit_account(GaimAccount *account) { GntWidget *window, *hbox; GntWidget *combo, *button, *entry; @@ -122,8 +429,9 @@ dialog = g_new0(AccountEditDialog, 1); dialog->window = window = gnt_box_new(FALSE, TRUE); + dialog->account = account; gnt_box_set_toplevel(GNT_BOX(window), TRUE); - gnt_box_set_title(GNT_BOX(window), _("New Account")); + gnt_box_set_title(GNT_BOX(window), account ? _("Modify Account") : _("New Account")); gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); gnt_box_set_pad(GNT_BOX(window), 0); @@ -138,6 +446,12 @@ gnt_combo_box_add_data(GNT_COMBO_BOX(combo), iter->data, ((GaimPlugin*)iter->data)->info->name); } + if (account) + gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), + gaim_plugins_find_with_id(gaim_account_get_protocol_id(account))); + else + gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), list->data); + g_signal_connect(G_OBJECT(combo), "selection-changed", G_CALLBACK(prpl_changed_cb), dialog); gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Protocol:"))); gnt_box_add_widget(GNT_BOX(hbox), combo); @@ -157,8 +471,11 @@ gnt_box_add_widget(GNT_BOX(window), hbox); dialog->password = entry = gnt_entry_new(NULL); + gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Password:"))); gnt_box_add_widget(GNT_BOX(hbox), entry); + if (account) + gnt_entry_set_text(GNT_ENTRY(entry), gaim_account_get_password(account)); hbox = gnt_box_new(TRUE, FALSE); gnt_box_add_widget(GNT_BOX(window), hbox); @@ -166,9 +483,23 @@ dialog->alias = entry = gnt_entry_new(NULL); gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Alias:"))); gnt_box_add_widget(GNT_BOX(hbox), entry); + if (account) + gnt_entry_set_text(GNT_ENTRY(entry), gaim_account_get_alias(account)); + /* User options */ + update_user_options(dialog); + gnt_box_add_widget(GNT_BOX(window), dialog->remember); + gnt_box_add_widget(GNT_BOX(window), dialog->newmail); + gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); - + + /* The advanced box */ + add_protocol_options(dialog); + gnt_box_add_widget(GNT_BOX(window), dialog->prpls); + + /* TODO: Add proxy options */ + + /* The button box */ hbox = gnt_box_new(FALSE, FALSE); gnt_box_add_widget(GNT_BOX(window), hbox); @@ -183,9 +514,33 @@ g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(edit_dialog_destroy), dialog); gnt_widget_show(window); + gnt_box_readjust(GNT_BOX(window)); + gnt_widget_draw(window); } static void +add_account_cb(GntWidget *widget, gpointer null) +{ + edit_account(NULL); +} + +static void +modify_account_cb(GntWidget *widget, GntTree *tree) +{ + GaimAccount *account = gnt_tree_get_selection_data(tree); + if (!account) + return; + edit_account(account); +} + +static void +delete_account_cb(GntWidget *widget, GntTree *tree) +{ + /* XXX: After the request-api is complete */ + /* Note: remove the modify-dialog for the account */ +} + +static void account_toggled(GntWidget *widget, void *key, gpointer null) { GaimAccount *account = key; @@ -193,7 +548,7 @@ gaim_account_set_enabled(account, GAIM_GNT_UI, gnt_tree_get_choice(GNT_TREE(widget), key)); } -void gg_accounts_init() +void gg_accounts_show_all() { GList *iter; GntWidget *box, *button; @@ -216,14 +571,7 @@ for (iter = gaim_accounts_get_all(); iter; iter = iter->next) { GaimAccount *account = iter->data; - - gnt_tree_add_choice(GNT_TREE(accounts.tree), account, - gnt_tree_create_row(GNT_TREE(accounts.tree), - gaim_account_get_username(account), - gaim_account_get_protocol_name(account)), - NULL, NULL); - gnt_tree_set_choice(GNT_TREE(accounts.tree), account, - gaim_account_get_enabled(account, GAIM_GNT_UI)); + account_add(account); } g_signal_connect(G_OBJECT(accounts.tree), "toggled", G_CALLBACK(account_toggled), NULL); @@ -238,27 +586,65 @@ button = gnt_button_new(_("Add")); gnt_box_add_widget(GNT_BOX(box), button); - g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(add_account), NULL); + g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(add_account_cb), NULL); button = gnt_button_new(_("Modify")); gnt_box_add_widget(GNT_BOX(box), button); + g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(modify_account_cb), accounts.tree); button = gnt_button_new(_("Delete")); gnt_box_add_widget(GNT_BOX(box), button); + g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(delete_account_cb), accounts.tree); gnt_box_add_widget(GNT_BOX(accounts.window), box); gnt_widget_show(accounts.window); } +static gpointer +gg_accounts_get_handle() +{ + static int handle; + + return &handle; +} + +static void +account_added_callback(GaimAccount *account) +{ + if (accounts.window == NULL) + return; + account_add(account); + gnt_widget_draw(accounts.tree); +} + +static void +account_removed_callback(GaimAccount *account) +{ + if (accounts.window == NULL) + return; + + gnt_tree_remove(GNT_TREE(accounts.tree), account); +} + +void gg_accounts_init() +{ + gaim_signal_connect(gaim_accounts_get_handle(), "account-added", + gg_accounts_get_handle(), GAIM_CALLBACK(account_added_callback), + NULL); + gaim_signal_connect(gaim_accounts_get_handle(), "account-removed", + gg_accounts_get_handle(), GAIM_CALLBACK(account_removed_callback), + NULL); + + gg_accounts_show_all(); +} + void gg_accounts_uninit() { 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; @@ -305,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) @@ -321,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); } @@ -336,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: branches/soc-2006-file-loggers/console/gntaccount.h =================================================================== --- branches/soc-2006-file-loggers/console/gntaccount.h 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/gntaccount.h 2006-07-29 21:38:18 UTC (rev 16598) @@ -5,3 +5,6 @@ void gg_accounts_init(); void gg_accounts_uninit(); + +void gg_accounts_show_all(); + Modified: branches/soc-2006-file-loggers/console/gntconv.c =================================================================== --- branches/soc-2006-file-loggers/console/gntconv.c 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/gntconv.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -159,9 +159,10 @@ 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)); + title = g_strdup_printf(_("%s"), gaim_conversation_get_title(conv)); ggc->window = gnt_box_new(FALSE, TRUE); gnt_box_set_title(GNT_BOX(ggc->window), title); gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE); @@ -199,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; @@ -243,9 +244,9 @@ gg_write_im(GaimConversation *conv, const char *who, const char *message, GaimMessageFlags flags, time_t mtime) { + GaimAccount *account = gaim_conversation_get_account(conv); if (flags & GAIM_MESSAGE_SEND) { - GaimAccount *account = gaim_conversation_get_account(conv); who = gaim_connection_get_display_name(gaim_account_get_connection(account)); if (!who) who = gaim_account_get_alias(account); @@ -253,7 +254,13 @@ who = gaim_account_get_username(account); } else if (flags & GAIM_MESSAGE_RECV) + { + GaimBuddy *buddy; who = gaim_conversation_get_name(conv); + buddy = gaim_find_buddy(account, who); + if (buddy) + who = gaim_buddy_get_contact_alias(buddy); + } gg_write_common(conv, who, message, flags, mtime); } Copied: branches/soc-2006-file-loggers/console/gntdebug.c (from rev 16597, trunk/console/gntdebug.c) =================================================================== --- branches/soc-2006-file-loggers/console/gntdebug.c (rev 0) +++ branches/soc-2006-file-loggers/console/gntdebug.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -0,0 +1,114 @@ +#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; +} + +static void +reset_debug_win(GntWidget *w, gpointer null) +{ + debug.window = debug.tview = NULL; +} + +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); + + g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); + } + + gnt_widget_show(debug.window); +} + +void gg_debug_init() +{ + gg_debug_window_show(); +} + +void gg_debug_uninit() +{ +} + Copied: branches/soc-2006-file-loggers/console/gntdebug.h (from rev 16597, trunk/console/gntdebug.h) =================================================================== --- branches/soc-2006-file-loggers/console/gntdebug.h (rev 0) +++ branches/soc-2006-file-loggers/console/gntdebug.h 2006-07-29 21:38:18 UTC (rev 16598) @@ -0,0 +1,8 @@ +#include "debug.h" + +GaimDebugUiOps *gg_debug_get_ui_ops(); + +void gg_debug_init(); + +void gg_debug_uninit(); + Modified: branches/soc-2006-file-loggers/console/gntgaim.c =================================================================== --- branches/soc-2006-file-loggers/console/gntgaim.c 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/gntgaim.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -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) @@ -237,7 +246,11 @@ gaim_plugins_add_search_path(path); g_free(path); - gaim_plugins_add_search_path("/usr/local/lib/gaim"); /* XXX: */ +#ifdef LIBDIR + gaim_plugins_add_search_path(LIBDIR); +#else + gaim_plugins_add_search_path("/usr/local/lib/gaim"); /* XXX: Remove this after the restructure */ +#endif if (!gaim_core_init(GAIM_GNT_UI)) { @@ -293,6 +306,8 @@ /* XXX: Don't puke */ freopen(".error", "w", stderr); + gnt_init(); + /* Initialize the libgaim stuff */ if (!init_libgaim(argc, argv)) return 0; Modified: branches/soc-2006-file-loggers/console/gntnotify.c =================================================================== --- branches/soc-2006-file-loggers/console/gntnotify.c 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/gntnotify.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -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; @@ -57,7 +66,22 @@ /* handle is, in all/most occasions, a GntWidget * */ static void gg_close_notify(GaimNotifyType type, void *handle) { - gnt_widget_destroy(GNT_WIDGET(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); } static void *gg_notify_formatted(const char *title, const char *primary, @@ -71,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); @@ -151,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; } @@ -180,6 +204,112 @@ return ui_handle; } +static void +notify_button_activated(GntWidget *widget, GaimNotifySearchButton *b) +{ + GList *list = NULL; + GaimAccount *account = g_object_get_data(G_OBJECT(widget), "notify-account"); + gpointer data = g_object_get_data(G_OBJECT(widget), "notify-data"); + + list = gnt_tree_get_selection_text_list(GNT_TREE(widget)); + + b->callback(gaim_account_get_connection(account), list, data); + g_list_foreach(list, (GFunc)g_free, NULL); + g_list_free(list); +} + +static void +gg_notify_sr_new_rows(GaimConnection *gc, + GaimNotifySearchResults *results, void *data) +{ + GntTree *tree = GNT_TREE(data); + GList *o; + + /* XXX: Do I need to empty the tree here? */ + + for (o = results->rows; o; o = o->next) + { + gnt_tree_add_row_after(GNT_TREE(tree), o->data, + gnt_tree_create_row_from_list(GNT_TREE(tree), o->data), + NULL, NULL); + } +} + +static void * +gg_notify_searchresults(GaimConnection *gc, const char *title, + const char *primary, const char *secondary, + GaimNotifySearchResults *results, gpointer data) +{ + GntWidget *window, *tree, *box, *button; + GList *iter; + + window = gnt_vbox_new(FALSE); + gnt_box_set_toplevel(GNT_BOX(window), TRUE); + gnt_box_set_title(GNT_BOX(window), title); + gnt_box_set_fill(GNT_BOX(window), FALSE); + gnt_box_set_pad(GNT_BOX(window), 0); + gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); + + gnt_box_add_widget(GNT_BOX(window), + gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); + gnt_box_add_widget(GNT_BOX(window), + gnt_label_new_with_format(secondary, GNT_TEXT_FLAG_NORMAL)); + + tree = gnt_tree_new_with_columns(g_list_length(results->columns)); + gnt_tree_set_show_title(GNT_TREE(tree), TRUE); + gnt_box_add_widget(GNT_BOX(window), tree); + + box = gnt_hbox_new(TRUE); + + for (iter = results->buttons; iter; iter = iter->next) + { + GaimNotifySearchButton *b = iter->data; + const char *text; + + switch (b->type) + { + case GAIM_NOTIFY_BUTTON_LABELED: + text = b->label; + break; + case GAIM_NOTIFY_BUTTON_CONTINUE: + text = _("Continue"); + break; + case GAIM_NOTIFY_BUTTON_ADD: + text = _("Add"); + break; + case GAIM_NOTIFY_BUTTON_INFO: + text = _("Info"); + break; + case GAIM_NOTIFY_BUTTON_IM: + text = _("IM"); + break; + case GAIM_NOTIFY_BUTTON_JOIN: + text = _("Join"); + break; + case GAIM_NOTIFY_BUTTON_INVITE: + text = _("Invite"); + break; + } + + button = gnt_button_new(text); + g_object_set_data(G_OBJECT(button), "notify-account", gaim_connection_get_account(gc)); + g_object_set_data(G_OBJECT(button), "notify-data", data); + g_signal_connect_swapped(G_OBJECT(button), "activate", + G_CALLBACK(notify_button_activated), b); + + gnt_box_add_widget(GNT_BOX(box), button); + } + + gnt_box_add_widget(GNT_BOX(window), box); + + gg_notify_sr_new_rows(gc, results, tree); + + gnt_widget_show(window); + g_object_set_data(G_OBJECT(window), "notify-results", results); + + return tree; +} + static GaimNotifyUiOps ops = { .notify_message = gg_notify_message, @@ -190,8 +320,8 @@ .notify_emails = gg_notify_emails, .notify_userinfo = gg_notify_userinfo, - .notify_searchresults = NULL, /* We are going to need multi-column GntTree's for this */ - .notify_searchresults_new_rows = NULL, + .notify_searchresults = gg_notify_searchresults, + .notify_searchresults_new_rows = gg_notify_sr_new_rows, .notify_uri = NULL /* This is of low-priority to me */ }; Copied: branches/soc-2006-file-loggers/console/gntprefs.c (from rev 16597, trunk/console/gntprefs.c) =================================================================== --- branches/soc-2006-file-loggers/console/gntprefs.c (rev 0) +++ branches/soc-2006-file-loggers/console/gntprefs.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -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); +} + Copied: branches/soc-2006-file-loggers/console/gntprefs.h (from rev 16597, trunk/console/gntprefs.h) =================================================================== --- branches/soc-2006-file-loggers/console/gntprefs.h (rev 0) +++ branches/soc-2006-file-loggers/console/gntprefs.h 2006-07-29 21:38:18 UTC (rev 16598) @@ -0,0 +1,2 @@ +void gg_prefs_init(); + Copied: branches/soc-2006-file-loggers/console/gntrequest.c (from rev 16597, trunk/console/gntrequest.c) =================================================================== --- branches/soc-2006-file-loggers/console/gntrequest.c (rev 0) +++ branches/soc-2006-file-loggers/console/gntrequest.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -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() +{ +} + Copied: branches/soc-2006-file-loggers/console/gntrequest.h (from rev 16597, trunk/console/gntrequest.h) =================================================================== --- branches/soc-2006-file-loggers/console/gntrequest.h (rev 0) +++ branches/soc-2006-file-loggers/console/gntrequest.h 2006-07-29 21:38:18 UTC (rev 16598) @@ -0,0 +1,8 @@ +#include "request.h" + +GaimRequestUiOps *gg_request_get_ui_ops(); + +void gg_request_init(); + +void gg_request_uninit(); + Modified: branches/soc-2006-file-loggers/console/gntui.c =================================================================== --- branches/soc-2006-file-loggers/console/gntui.c 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/gntui.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -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: branches/soc-2006-file-loggers/console/libgnt/Makefile.am =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/Makefile.am 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/libgnt/Makefile.am 2006-07-29 21:38:18 UTC (rev 16598) @@ -7,12 +7,14 @@ gntwidget.c \ gntbox.c \ gntbutton.c \ + gntcheckbox.c \ gntcolors.c \ gntcombobox.c \ gntentry.c \ gntlabel.c \ gntline.c \ gntmarshal.c \ + gntstyle.c \ gnttextview.c \ gnttree.c \ gntmain.c @@ -21,6 +23,7 @@ gntwidget.h \ gntbox.h \ gntbutton.h \ + gntcheckbox.h \ gntcolors.h \ gntcombobox.h \ gntentry.h \ @@ -28,6 +31,7 @@ gntlabel.h \ gntline.h \ gntmarshal.h \ + gntstyle.h \ gnttextview.h \ gnttree.h \ gnt.h Modified: branches/soc-2006-file-loggers/console/libgnt/gntbox.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntbox.c 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/libgnt/gntbox.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -89,6 +89,8 @@ for (iter = box->list; iter; iter = iter->next) { + if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(iter->data), GNT_WIDGET_INVISIBLE)) + continue; gnt_widget_set_position(GNT_WIDGET(iter->data), curx, cury); gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h); if (box->vertical) @@ -217,6 +219,7 @@ static GntWidget * find_focusable_widget(GntBox *box) { + /* XXX: Make sure the widget is visible? */ if (box->focus == NULL && GNT_WIDGET(box)->parent == NULL) g_list_foreach(box->list, add_to_focus, box); @@ -229,11 +232,17 @@ static void find_next_focus(GntBox *box) { - GList *iter = g_list_find(box->focus, box->active); - if (iter && iter->next) - box->active = iter->next->data; - else if (box->focus) - box->active = box->focus->data; + gpointer last = box->active; + do + { + GList *iter = g_list_find(box->focus, box->active); + if (iter && iter->next) + box->active = iter->next->data; + else if (box->focus) + box->active = box->focus->data; + if (!GNT_WIDGET_IS_FLAG_SET(box->active, GNT_WIDGET_INVISIBLE)) + break; + } while (box->active != last); } static gboolean @@ -564,6 +573,9 @@ int height, width; int x, y; + if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_INVISIBLE)) + continue; + if (GNT_IS_BOX(w)) gnt_box_sync_children(GNT_BOX(w)); Modified: branches/soc-2006-file-loggers/console/libgnt/gntbutton.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntbutton.c 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/libgnt/gntbutton.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -22,7 +22,7 @@ type = GNT_COLOR_NORMAL; wbkgdset(widget->window, '\0' | COLOR_PAIR(type)); - mvwprintw(widget->window, 1, 1, button->priv->text); + mvwprintw(widget->window, 1, 2, button->priv->text); DEBUG; } @@ -31,8 +31,10 @@ gnt_button_size_request(GntWidget *widget) { GntButton *button = GNT_BUTTON(widget); - widget->priv.width = g_utf8_strlen(button->priv->text, -1) + 2; - widget->priv.height = 3; + widget->priv.width = g_utf8_strlen(button->priv->text, -1) + 4; + widget->priv.height = 1; + if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW)) + widget->priv.height += 2; } static void Copied: branches/soc-2006-file-loggers/console/libgnt/gntcheckbox.c (from rev 16597, trunk/console/libgnt/gntcheckbox.c) =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntcheckbox.c (rev 0) +++ branches/soc-2006-file-loggers/console/libgnt/gntcheckbox.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -0,0 +1,153 @@ +#include "gntcheckbox.h" + +enum +{ + SIG_TOGGLED = 1, + SIGS, +}; + +static GntButtonClass *parent_class = NULL; +static guint signals[SIGS] = { 0 }; + +static void +gnt_check_box_draw(GntWidget *widget) +{ + GntCheckBox *cb = GNT_CHECK_BOX(widget); + GntColorType type; + char *text; + + if (gnt_widget_has_focus(widget)) + type = GNT_COLOR_HIGHLIGHT; + else + type = GNT_COLOR_NORMAL; + + wbkgdset(widget->window, '\0' | COLOR_PAIR(type)); + + text = g_strdup_printf("[%c]", cb->checked ? 'X' : ' '); + mvwprintw(widget->window, 0, 0, text); + g_free(text); + + wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + mvwprintw(widget->window, 0, 4, GNT_BUTTON(cb)->priv->text); + + DEBUG; +} + +static void +gnt_check_box_size_request(GntWidget *widget) +{ +} + +static void +gnt_check_box_map(GntWidget *widget) +{ + if (widget->priv.width == 0 || widget->priv.height == 0) + gnt_widget_size_request(widget); + DEBUG; +} + +static gboolean +gnt_check_box_key_pressed(GntWidget *widget, const char *text) +{ + if (text[0] == ' ' && text[1] == '\0') + { + GNT_CHECK_BOX(widget)->checked = !GNT_CHECK_BOX(widget)->checked; + g_signal_emit(widget, signals[SIG_TOGGLED], 0); + gnt_widget_draw(widget); + return TRUE; + } + + return FALSE; +} + +static void +gnt_check_box_destroy(GntWidget *widget) +{ +} + +static void +gnt_check_box_class_init(GntCheckBoxClass *klass) +{ + GntWidgetClass *wclass = GNT_WIDGET_CLASS(klass); + + parent_class = GNT_BUTTON_CLASS(klass); + /*parent_class->destroy = gnt_check_box_destroy;*/ + wclass->draw = gnt_check_box_draw; + /*parent_class->map = gnt_check_box_map;*/ + /*parent_class->size_request = gnt_check_box_size_request;*/ + wclass->key_pressed = gnt_check_box_key_pressed; + + signals[SIG_TOGGLED] = + g_signal_new("toggled", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GntCheckBoxClass, toggled), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + DEBUG; +} + +static void +gnt_check_box_init(GTypeInstance *instance, gpointer class) +{ + GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); + DEBUG; +} + +/****************************************************************************** + * GntCheckBox API + *****************************************************************************/ +GType +gnt_check_box_get_gtype(void) +{ + static GType type = 0; + + if(type == 0) + { + static const GTypeInfo info = { + sizeof(GntCheckBoxClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)gnt_check_box_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GntCheckBox), + 0, /* n_preallocs */ + gnt_check_box_init, /* instance_init */ + }; + + type = g_type_register_static(GNT_TYPE_BUTTON, + "GntCheckBox", + &info, 0); + } + + return type; +} + +GntWidget *gnt_check_box_new(const char *text) +{ + GntWidget *widget = g_object_new(GNT_TYPE_CHECK_BOX, NULL); + + GNT_BUTTON(widget)->priv->text = g_strdup(text); + gnt_widget_set_take_focus(widget, TRUE); + + return widget; +} + +void gnt_check_box_set_checked(GntCheckBox *box, gboolean set) +{ + if (set != box->checked) + { + box->checked = set; + g_signal_emit(box, signals[SIG_TOGGLED], 0); + } +} + +gboolean gnt_check_box_get_checked(GntCheckBox *box) +{ + return box->checked; +} + + + Copied: branches/soc-2006-file-loggers/console/libgnt/gntcheckbox.h (from rev 16597, trunk/console/libgnt/gntcheckbox.h) =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntcheckbox.h (rev 0) +++ branches/soc-2006-file-loggers/console/libgnt/gntcheckbox.h 2006-07-29 21:38:18 UTC (rev 16598) @@ -0,0 +1,54 @@ +#ifndef GNT_CHECK_BOX_H +#define GNT_CHECK_BOX_H + +#include "gntbutton.h" +#include "gnt.h" +#include "gntcolors.h" +#include "gntkeys.h" + +#define GNT_TYPE_CHECK_BOX (gnt_check_box_get_gtype()) +#define GNT_CHECK_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_CHECK_BOX, GntCheckBox)) +#define GNT_CHECK_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_CHECK_BOX, GntCheckBoxClass)) +#define GNT_IS_CHECK_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_CHECK_BOX)) +#define GNT_IS_CHECK_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_CHECK_BOX)) +#define GNT_CHECK_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_CHECK_BOX, GntCheckBoxClass)) + +#define GNT_CHECK_BOX_FLAGS(obj) (GNT_CHECK_BOX(obj)->priv.flags) +#define GNT_CHECK_BOX_SET_FLAGS(obj, flags) (GNT_CHECK_BOX_FLAGS(obj) |= flags) +#define GNT_CHECK_BOX_UNSET_FLAGS(obj, flags) (GNT_CHECK_BOX_FLAGS(obj) &= ~(flags)) + +typedef struct _GnCheckBox GntCheckBox; +typedef struct _GnCheckBoxPriv GntCheckBoxPriv; +typedef struct _GnCheckBoxClass GntCheckBoxClass; + +struct _GnCheckBox +{ + GntButton parent; + gboolean checked; +}; + +struct _GnCheckBoxClass +{ + GntButtonClass parent; + + void (*toggled)(void); + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +G_BEGIN_DECLS + +GType gnt_check_box_get_gtype(void); + +GntWidget *gnt_check_box_new(const char *text); + +void gnt_check_box_set_checked(GntCheckBox *box, gboolean set); + +gboolean gnt_check_box_get_checked(GntCheckBox *box); + +G_END_DECLS + +#endif /* GNT_CHECK_BOX_H */ Modified: branches/soc-2006-file-loggers/console/libgnt/gntcolors.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntcolors.c 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/libgnt/gntcolors.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -1,6 +1,11 @@ #include <ncursesw/ncurses.h> #include "gntcolors.h" +#include <glib.h> + +#include <stdlib.h> +#include <string.h> + static struct { short r, g, b; @@ -75,3 +80,125 @@ restore_colors(); } +static int +get_color(char *key) +{ + int color; + + key = g_strstrip(key); + + if (strcmp(key, "black") == 0) + color = GNT_COLOR_BLACK; + else if (strcmp(key, "red") == 0) + color = GNT_COLOR_RED; + else if (strcmp(key, "green") == 0) + color = GNT_COLOR_GREEN; + else if (strcmp(key, "blue") == 0) + color = GNT_COLOR_BLUE; + else if (strcmp(key, "white") == 0) + color = GNT_COLOR_WHITE; + else if (strcmp(key, "gray") == 0) + color = GNT_COLOR_GRAY; + else if (strcmp(key, "darkgray") == 0) + color = GNT_COLOR_DARK_GRAY; + else + color = -1; + return color; +} + +void gnt_colors_parse(GKeyFile *kfile) +{ + GError *error = NULL; + gsize nkeys; + char **keys = g_key_file_get_keys(kfile, "colors", &nkeys, &error); + + if (error) + { + /* XXX: some error happened. */ + g_error_free(error); + } + else + { + while (nkeys--) + { + gsize len; + char *key = keys[nkeys]; + char **list = g_key_file_get_string_list(kfile, "colors", key, &len, NULL); + if (len == 3) + { + int r = atoi(list[0]); + int g = atoi(list[1]); + int b = atoi(list[2]); + int color = -1; + + g_ascii_strdown(key, -1); + color = get_color(key); + if (color == -1) + continue; + + init_color(color, r, g, b); + } + g_strfreev(list); + } + + g_strfreev(keys); + } + + gnt_color_pairs_parse(kfile); +} + +void gnt_color_pairs_parse(GKeyFile *kfile) +{ + GError *error = NULL; + gsize nkeys; + char **keys = g_key_file_get_keys(kfile, "colorpairs", &nkeys, &error); + + if (error) + { + /* XXX: some error happened. */ + g_error_free(error); + return; + } + + while (nkeys--) + { + gsize len; + char *key = keys[nkeys]; + char **list = g_key_file_get_string_list(kfile, "colorpairs", key, &len, NULL); + if (len == 2) + { + GntColorType type = 0; + int fg = get_color(g_ascii_strdown(list[0], -1)); + int bg = get_color(g_ascii_strdown(list[1], -1)); + if (fg == -1 || bg == -1) + continue; + + g_ascii_strdown(key, -1); + + if (strcmp(key, "normal") == 0) + type = GNT_COLOR_NORMAL; + else if (strcmp(key, "highlight") == 0) + type = GNT_COLOR_HIGHLIGHT; + else if (strcmp(key, "highlightd") == 0) + type = GNT_COLOR_HIGHLIGHT_D; + else if (strcmp(key, "shadow") == 0) + type = GNT_COLOR_SHADOW; + else if (strcmp(key, "title") == 0) + type = GNT_COLOR_TITLE; + else if (strcmp(key, "titled") == 0) + type = GNT_COLOR_TITLE_D; + else if (strcmp(key, "text") == 0) + type = GNT_COLOR_TEXT_NORMAL; + else if (strcmp(key, "disabled") == 0) + type = GNT_COLOR_DISABLED; + else + continue; + + init_pair(type, fg, bg); + } + g_strfreev(list); + } + + g_strfreev(keys); +} + Modified: branches/soc-2006-file-loggers/console/libgnt/gntcolors.h =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntcolors.h 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/libgnt/gntcolors.h 2006-07-29 21:38:18 UTC (rev 16598) @@ -1,6 +1,8 @@ #ifndef GNT_COLORS_H #define GNT_COLORS_H +#include <glib.h> + typedef enum { GNT_COLOR_NORMAL = 1, @@ -34,4 +36,8 @@ void gnt_uninit_colors(); +void gnt_colors_parse(GKeyFile *kfile); + +void gnt_color_pairs_parse(GKeyFile *kfile); + #endif Modified: branches/soc-2006-file-loggers/console/libgnt/gntcombobox.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntcombobox.c 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/libgnt/gntcombobox.c 2006-07-29 21:38:18 UTC (rev 16598) @@ -20,10 +20,14 @@ { if (box->selected != key) { + /* XXX: make sure the key actually does exist */ gpointer old = box->selected; box->selected = key; g_signal_emit(box, signals[SIG_SELECTION_CHANGED], 0, old, key); - gnt_widget_draw(GNT_WIDGET(box)); + if (GNT_WIDGET(box)->window) + gnt_widget_draw(GNT_WIDGET(box)); + if (box->dropdown) + gnt_tree_set_selected(GNT_TREE(box->dropdown), key); } } @@ -246,3 +250,8 @@ return box->selected; } +void gnt_combo_box_set_selected(GntComboBox *box, gpointer key) +{ + set_selection(box, key); +} + Modified: branches/soc-2006-file-loggers/console/libgnt/gntcombobox.h =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntcombobox.h 2006-07-29 20:26:50 UTC (rev 16597) +++ branches/soc-2006-file-loggers/console/libgnt/gntcombobox.h 2006-07-29 21:38:18 UTC (rev 16598) @@ -50,6 +50,8 @@ gpointer gnt_combo_box_get... [truncated message content] |
From: <rl...@us...> - 2006-07-29 20:26:55
|
Revision: 16597 Author: rlaager Date: 2006-07-29 13:26:50 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16597&view=rev Log Message: ----------- Merge datallah's change from trunk: "define SIZEOF_TIME_T as 4 for win32" Modified Paths: -------------- branches/v2_0_0/config.h.mingw Modified: branches/v2_0_0/config.h.mingw =================================================================== --- branches/v2_0_0/config.h.mingw 2006-07-29 20:22:39 UTC (rev 16596) +++ branches/v2_0_0/config.h.mingw 2006-07-29 20:26:50 UTC (rev 16597) @@ -641,3 +641,5 @@ * Following are added for Win32 version of Gaim */ #define HAVE_VSNPRINTF 1 + +#define SIZEOF_TIME_T 4 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dat...@us...> - 2006-07-29 20:22:44
|
Revision: 16596 Author: datallah Date: 2006-07-29 13:22:39 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16596&view=rev Log Message: ----------- define SIZEOF_TIME_T as 4 for win32 Modified Paths: -------------- trunk/config.h.mingw Modified: trunk/config.h.mingw =================================================================== --- trunk/config.h.mingw 2006-07-29 15:42:32 UTC (rev 16595) +++ trunk/config.h.mingw 2006-07-29 20:22:39 UTC (rev 16596) @@ -641,3 +641,5 @@ * Following are added for Win32 version of Gaim */ #define HAVE_VSNPRINTF 1 + +#define SIZEOF_TIME_T 4 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |