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: <sa...@us...> - 2006-08-28 23:31:21
|
Revision: 17072 Author: sadrul Date: 2006-08-28 16:31:12 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17072&view=rev Log Message: ----------- Apparently wcwidth isn't there everywhere. Thanks to Bleeter for this. Modified Paths: -------------- trunk/console/libgnt/gntutils.c Modified: trunk/console/libgnt/gntutils.c =================================================================== --- trunk/console/libgnt/gntutils.c 2006-08-28 20:43:12 UTC (rev 17071) +++ trunk/console/libgnt/gntutils.c 2006-08-28 23:31:12 UTC (rev 17072) @@ -4,6 +4,10 @@ #include <string.h> #include <wchar.h> +#ifndef __USE_XOPEN +#define wcwidth(X) 1 +#endif + void gnt_util_get_text_bound(const char *text, int *width, int *height) { const char *s = text, *last; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-28 20:43:17
|
Revision: 17071 Author: sadrul Date: 2006-08-28 13:43:12 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17071&view=rev Log Message: ----------- meify Modified Paths: -------------- trunk/console/gntconv.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-28 20:27:03 UTC (rev 17070) +++ trunk/console/gntconv.c 2006-08-28 20:43:12 UTC (rev 17071) @@ -245,9 +245,16 @@ gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), gaim_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM); + if (who && *who && (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))) { - char * name = g_strdup_printf("%s: ", who); + char * name = NULL; + + if (gaim_message_meify((char*)message, -1)) + name = g_strdup_printf("*** %s ", who); + else + name = g_strdup_printf("%s: ", who); + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), name, GNT_TEXT_FLAG_BOLD); g_free(name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dat...@us...> - 2006-08-28 20:27:10
|
Revision: 17070 Author: datallah Date: 2006-08-28 13:27:03 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17070&view=rev Log Message: ----------- Disabled GTK+ components of the Perl plugin (we'll no longer support gtk-perl prefs frames until this is refactored into a gtkgaim plugin somehow). Fix gaim_util_fetch_url and plug some leaks. I haven't successfully tested gaim_util_fetch_url from perl yet - it doesn't seem to actually pass the retrieved text to the plugin sub correctly yet. The syntax for calling gaim_util_fetch_url() from perl is also funky and should be made more consistent to the C function. Modified Paths: -------------- trunk/libgaim/plugins/perl/common/Request.xs trunk/libgaim/plugins/perl/common/Util.xs trunk/libgaim/plugins/perl/common/module.h trunk/libgaim/plugins/perl/perl-common.h trunk/libgaim/plugins/perl/perl-handlers.c trunk/libgaim/plugins/perl/perl.c Modified: trunk/libgaim/plugins/perl/common/Request.xs =================================================================== --- trunk/libgaim/plugins/perl/common/Request.xs 2006-08-28 06:15:21 UTC (rev 17069) +++ trunk/libgaim/plugins/perl/common/Request.xs 2006-08-28 20:27:03 UTC (rev 17070) @@ -46,6 +46,10 @@ PUTBACK; FREETMPS; LEAVE; + + g_free(gpr->ok_cb); + g_free(gpr->cancel_cb); + g_free(gpr); } static void @@ -67,6 +71,10 @@ PUTBACK; FREETMPS; LEAVE; + + g_free(gpr->ok_cb); + g_free(gpr->cancel_cb); + g_free(gpr); } MODULE = Gaim::Request PACKAGE = Gaim::Request PREFIX = gaim_request_ @@ -89,14 +97,14 @@ CODE: GaimPerlRequestData *gpr; STRLEN len; - char *basename, *package; + char *basename; basename = g_path_get_basename(handle->path); gaim_perl_normalize_script_name(basename); - package = g_strdup_printf("Gaim::Script::%s", basename); gpr = g_new(GaimPerlRequestData, 1); - gpr->ok_cb = g_strdup_printf("%s::%s", package, SvPV(ok_cb, len)); - gpr->cancel_cb = g_strdup_printf("%s::%s", package, SvPV(cancel_cb, len)); + gpr->ok_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(ok_cb, len)); + gpr->cancel_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(cancel_cb, len)); + g_free(basename); RETVAL = gaim_request_input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, G_CALLBACK(gaim_perl_request_ok_cb), cancel_text, G_CALLBACK(gaim_perl_request_cancel_cb), gpr); OUTPUT: @@ -113,14 +121,14 @@ CODE: GaimPerlRequestData *gpr; STRLEN len; - char *basename, *package; + char *basename; basename = g_path_get_basename(handle->path); gaim_perl_normalize_script_name(basename); - package = g_strdup_printf("Gaim::Script::%s", basename); gpr = g_new(GaimPerlRequestData, 1); - gpr->ok_cb = g_strdup_printf("%s::%s", package, SvPV(ok_cb, len)); - gpr->cancel_cb = g_strdup_printf("%s::%s", package, SvPV(cancel_cb, len)); + gpr->ok_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(ok_cb, len)); + gpr->cancel_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(cancel_cb, len)); + g_free(basename); RETVAL = gaim_request_file(handle, title, filename, savedialog, G_CALLBACK(gaim_perl_request_ok_cb), G_CALLBACK(gaim_perl_request_cancel_cb), gpr); OUTPUT: @@ -140,14 +148,14 @@ CODE: GaimPerlRequestData *gpr; STRLEN len; - char *basename, *package; + char *basename; basename = g_path_get_basename(handle->path); gaim_perl_normalize_script_name(basename); - package = g_strdup_printf("Gaim::Script::%s", basename); gpr = g_new(GaimPerlRequestData, 1); - gpr->ok_cb = g_strdup_printf("%s::%s", package, SvPV(ok_cb, len)); - gpr->cancel_cb = g_strdup_printf("%s::%s", package, SvPV(cancel_cb, len)); + gpr->ok_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(ok_cb, len)); + gpr->cancel_cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(cancel_cb, len)); + g_free(basename); RETVAL = gaim_request_fields(handle, title, primary, secondary, fields, ok_text, G_CALLBACK(gaim_perl_request_ok_cb), cancel_text, G_CALLBACK(gaim_perl_request_cancel_cb), gpr); OUTPUT: Modified: trunk/libgaim/plugins/perl/common/Util.xs =================================================================== --- trunk/libgaim/plugins/perl/common/Util.xs 2006-08-28 06:15:21 UTC (rev 17069) +++ trunk/libgaim/plugins/perl/common/Util.xs 2006-08-28 20:27:03 UTC (rev 17070) @@ -4,19 +4,22 @@ char *cb; } GaimPerlUrlData; -static void gaim_perl_util_url_cb(Gaim::Util::FetchUrlData *url_data, void *user_data, const gchar *url_data, size_t size, const gchar *error_message) { +static void gaim_perl_util_url_cb(GaimUtilFetchUrlData *url_data, void *user_data, const gchar *url_text, size_t size, const gchar *error_message) { GaimPerlUrlData *gpr = (GaimPerlUrlData *)user_data; dSP; ENTER; SAVETMPS; - PUSHMARK(sp); + PUSHMARK(SP); - XPUSHs(sv_2mortal(newSVpv(url_data, 0))); + XPUSHs(sv_2mortal(newSVpvn(url_text, size))); PUTBACK; call_pv(gpr->cb, G_EVAL | G_SCALAR); SPAGAIN; + g_free(gpr->cb); + g_free(gpr); + PUTBACK; FREETMPS; LEAVE; @@ -36,14 +39,14 @@ CODE: GaimPerlUrlData *gpr; STRLEN len; - char *basename, *package; + char *basename; basename = g_path_get_basename(handle->path); gaim_perl_normalize_script_name(basename); - package = g_strdup_printf("Gaim::Script::%s", basename); gpr = g_new(GaimPerlUrlData, 1); - gpr->cb = g_strdup_printf("%s::%s", package, SvPV(cb, len)); + gpr->cb = g_strdup_printf("Gaim::Script::%s::%s", basename, SvPV(cb, len)); + g_free(basename); gaim_util_fetch_url(url, full, user_agent, http11, gaim_perl_util_url_cb, gpr); int Modified: trunk/libgaim/plugins/perl/common/module.h =================================================================== --- trunk/libgaim/plugins/perl/common/module.h 2006-08-28 06:15:21 UTC (rev 17069) +++ trunk/libgaim/plugins/perl/common/module.h 2006-08-28 20:27:03 UTC (rev 17070) @@ -248,6 +248,7 @@ typedef GaimStringref * Gaim__Stringref; /* util.h */ +typedef GaimInfoFieldFormatCallback Gaim__Util__InfoFieldFormatCallback; typedef GaimUtilFetchUrlData Gaim__Util__FetchUrlData; typedef GaimMenuAction * Gaim__Menu__Action; Modified: trunk/libgaim/plugins/perl/perl-common.h =================================================================== --- trunk/libgaim/plugins/perl/perl-common.h 2006-08-28 06:15:21 UTC (rev 17069) +++ trunk/libgaim/plugins/perl/perl-common.h 2006-08-28 20:27:03 UTC (rev 17070) @@ -31,7 +31,9 @@ char *load_sub; char *unload_sub; char *prefs_sub; +#ifdef GAIM_GTKPERL char *gtk_prefs_sub; +#endif char *plugin_action_sub; } GaimPerlScript; Modified: trunk/libgaim/plugins/perl/perl-handlers.c =================================================================== --- trunk/libgaim/plugins/perl/perl-handlers.c 2006-08-28 06:15:21 UTC (rev 17069) +++ trunk/libgaim/plugins/perl/perl-handlers.c 2006-08-28 20:27:03 UTC (rev 17070) @@ -103,6 +103,7 @@ return l; } +#ifdef GAIM_GTKPERL GtkWidget * gaim_perl_gtk_get_plugin_frame(GaimPlugin *plugin) { @@ -138,6 +139,7 @@ return ret; } +#endif GaimPluginPrefFrame * gaim_perl_get_plugin_frame(GaimPlugin *plugin) Modified: trunk/libgaim/plugins/perl/perl.c =================================================================== --- trunk/libgaim/plugins/perl/perl.c 2006-08-28 06:15:21 UTC (rev 17069) +++ trunk/libgaim/plugins/perl/perl.c 2006-08-28 20:27:03 UTC (rev 17070) @@ -104,11 +104,13 @@ NULL /* frame (Reserved) */ }; +#ifdef GAIM_GTKPERL static GaimGtkPluginUiInfo gtk_ui_info = { gaim_perl_gtk_get_plugin_frame, 0 /* page_num (Reserved) */ }; +#endif static void #ifdef OLD_PERL @@ -366,6 +368,7 @@ info->prefs_info = &ui_info; } +#ifdef GAIM_GTKPERL if ((key = hv_fetch(plugin_info, "gtk_prefs_info", strlen("gtk_prefs_info"), 0))) { /* key now is the name of the Perl sub that @@ -375,6 +378,7 @@ SvPV(*key, len)); info->ui_info = >k_ui_info; } +#endif if ((key = hv_fetch(plugin_info, "plugin_action_sub", strlen("plugin_action_sub"), 0))) { @@ -538,7 +542,9 @@ g_free(gps->unload_sub); g_free(gps->package); g_free(gps->prefs_sub); +#ifdef GAIM_GTKPERL g_free(gps->gtk_prefs_sub); +#endif g_free(gps); plugin->info->extra_info = NULL; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2006-08-28 06:15:27
|
Revision: 17069 Author: deryni9 Date: 2006-08-27 23:15:21 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17069&view=rev Log Message: ----------- Add ::gaim::conversation send. tcl already had ::gaim::send_im but that didn't use an existing conversation and didn't print it into the conversation window, this does both of those. Modified Paths: -------------- trunk/libgaim/plugins/tcl/tcl_cmds.c Modified: trunk/libgaim/plugins/tcl/tcl_cmds.c =================================================================== --- trunk/libgaim/plugins/tcl/tcl_cmds.c 2006-08-28 05:39:42 UTC (rev 17068) +++ trunk/libgaim/plugins/tcl/tcl_cmds.c 2006-08-28 06:15:21 UTC (rev 17069) @@ -670,8 +670,8 @@ int tcl_cmd_conversation(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj *list, *elem, *result = Tcl_GetObjResult(interp); - const char *cmds[] = { "find", "handle", "list", "new", "write", "name", "title", NULL }; - enum { CMD_CONV_FIND, CMD_CONV_HANDLE, CMD_CONV_LIST, CMD_CONV_NEW, CMD_CONV_WRITE , CMD_CONV_NAME, CMD_CONV_TITLE } cmd; + const char *cmds[] = { "find", "handle", "list", "new", "write", "name", "title", "send", NULL }; + enum { CMD_CONV_FIND, CMD_CONV_HANDLE, CMD_CONV_LIST, CMD_CONV_NEW, CMD_CONV_WRITE , CMD_CONV_NAME, CMD_CONV_TITLE, CMD_CONV_SEND } cmd; const char *styles[] = { "send", "recv", "system", NULL }; enum { CMD_CONV_WRITE_SEND, CMD_CONV_WRITE_RECV, CMD_CONV_WRITE_SYSTEM } style; const char *newopts[] = { "-chat", "-im" }; @@ -803,6 +803,19 @@ return TCL_ERROR; Tcl_SetStringObj(result, (char *)gaim_conversation_get_title(convo), -1); break; + case CMD_CONV_SEND: + if (objc != 4) { + Tcl_WrongNumArgs(interp, 2, objv, "conversation message"); + return TCL_ERROR; + } + if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) + return TCL_ERROR; + what = Tcl_GetString(objv[3]); + if (gaim_conversation_get_type(convo) == GAIM_CONV_TYPE_CHAT) + gaim_conv_chat_send(GAIM_CONV_CHAT(convo), what); + else + gaim_conv_im_send(GAIM_CONV_IM(convo), what); + break; } return TCL_OK; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-28 05:40:19
|
Revision: 17068 Author: sadrul Date: 2006-08-27 22:39:42 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17068&view=rev Log Message: ----------- Fix the wm to give focus to the buddylist after you toggle it on with alt+b. Draw a line on the right of the buddylist. this should also show how to add other window-decorations. Draw a [X] at the corner of the windows, clicking which closes the windows. Modified Paths: -------------- trunk/console/libgnt/gntmain.c trunk/console/libgnt/gntwm.h trunk/console/libgnt/wms/s.c Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-27 23:04:55 UTC (rev 17067) +++ trunk/console/libgnt/gntmain.c 2006-08-28 05:39:42 UTC (rev 17068) @@ -77,6 +77,7 @@ { NULL, /* new_window */ NULL, /* close_window */ + NULL, /* window_resized */ NULL, /* key_pressed */ NULL, /* mouse clicked */ bring_on_top, /* give_focus */ @@ -516,12 +517,10 @@ * - bring a window on top if you click on its taskbar * - click on the top-bar of the active window and drag+drop to move a window * - click on a window to bring it to focus + * - allow scrolling in tree/textview on wheel-scroll event + * - click to activate button or select a row in tree * wishlist: * - have a little [X] on the windows, and clicking it will close that window. - * - allow scrolling in tree/textview on wheel-scroll event - * - click to activate button or select a row in tree - * - all these can be fulfilled by adding a "clicked" event for GntWidget - * which will send the (x,y) to the widget. (look at "key_pressed" for hints) */ static gboolean detect_mouse_action(const char *buffer) @@ -536,6 +535,8 @@ static GntWidget *remember = NULL; static int offset = 0; GntMouseEvent event; + GntWidget *widget = NULL; + GList *iter; if (!ordered || buffer[0] != 27) return FALSE; @@ -551,30 +552,19 @@ x -= 33; y -= 33; + for (iter = ordered; iter; iter = iter->next) { + GntWidget *wid = iter->data; + if (x >= wid->priv.x && x < wid->priv.x + wid->priv.width) { + if (y >= wid->priv.y && y < wid->priv.y + wid->priv.height) { + widget = wid; + break; + } + } + } if (strncmp(buffer, "[M ", 3) == 0) { /* left button down */ /* Bring the window you clicked on to front */ /* If you click on the topbar, then you can drag to move the window */ - GList *iter; - for (iter = ordered; iter; iter = iter->next) { - GntWidget *wid = iter->data; - if (x >= wid->priv.x && x < wid->priv.x + wid->priv.width) { - if (y >= wid->priv.y && y < wid->priv.y + wid->priv.height) { - if (iter != ordered) { - GntWidget *w = ordered->data; - ordered = g_list_bring_to_front(ordered, iter->data); - wm.give_focus(ordered->data); - gnt_widget_set_focus(w, FALSE); - } - if (y == wid->priv.y) { - offset = x - wid->priv.x; - remember = wid; - button = MOUSE_LEFT; - } - break; - } - } - } event = GNT_LEFT_MOUSE_DOWN; } else if (strncmp(buffer, "[M\"", 3) == 0) { /* right button down */ @@ -590,7 +580,28 @@ event = GNT_MOUSE_SCROLL_DOWN; } else if (strncmp(buffer, "[M#", 3) == 0) { /* button up */ + event = GNT_MOUSE_UP; + } else + return FALSE; + + if (wm.mouse_clicked && wm.mouse_clicked(event, x, y, widget)) + return TRUE; + + if (event == GNT_LEFT_MOUSE_DOWN && widget) { + if (widget != ordered->data) { + GntWidget *w = ordered->data; + ordered = g_list_bring_to_front(ordered, widget); + wm.give_focus(ordered->data); + gnt_widget_set_focus(w, FALSE); + } + if (y == widget->priv.y) { + offset = x - widget->priv.x; + remember = widget; + button = MOUSE_LEFT; + } + } else if (event == GNT_MOUSE_UP) { if (button == MOUSE_NONE && y == getmaxy(stdscr) - 1) { + /* Clicked on the taskbar */ int n = g_list_length(focus_list); if (n) { int width = getmaxx(stdscr) / n; @@ -606,9 +617,7 @@ button = MOUSE_NONE; remember = NULL; offset = 0; - event = GNT_MOUSE_UP; - } else - return FALSE; + } gnt_widget_clicked(ordered->data, event, x, y); return FALSE; /* XXX: this should be TRUE */ @@ -1141,7 +1150,10 @@ hide_panel(node->panel); gnt_widget_set_size(widget, width, height); gnt_widget_draw(widget); - replace_panel(node->panel, widget->window); + if (wm.window_resized) + node->panel = wm.window_resized(node->panel, widget); + else + replace_panel(node->panel, widget->window); show_panel(node->panel); update_screen(NULL); } Modified: trunk/console/libgnt/gntwm.h =================================================================== --- trunk/console/libgnt/gntwm.h 2006-08-27 23:04:55 UTC (rev 17067) +++ trunk/console/libgnt/gntwm.h 2006-08-28 05:39:42 UTC (rev 17068) @@ -16,6 +16,10 @@ /* This is called when a window is being closed */ gboolean (*close_window)(GntWidget *win); + /* Can del_panel the old panel and return a new_panel. + * Otherwise, this should at least do a replace_panel. */ + PANEL *(*window_resized)(PANEL *pan, GntWidget *win); + /* This should usually return NULL if the keys were processed by the WM. * If not, the WM can simply return the original string, which will be * processed by the default WM. The custom WM can also return a different @@ -23,8 +27,7 @@ */ const char *(*key_pressed)(const char *key); - /* Not decided yet */ - gboolean (*mouse_clicked)(void); + gboolean (*mouse_clicked)(GntMouseEvent event, int x, int y, GntWidget *widget); /* Whatever the WM wants to do when a window is given focus */ void (*give_focus)(GntWidget *widget); Modified: trunk/console/libgnt/wms/s.c =================================================================== --- trunk/console/libgnt/wms/s.c 2006-08-27 23:04:55 UTC (rev 17067) +++ trunk/console/libgnt/wms/s.c 2006-08-28 05:39:42 UTC (rev 17068) @@ -7,7 +7,44 @@ static GntWM *gwm; +static void +envelope_buddylist(GntWidget *win) +{ + int w, h; + gnt_widget_get_size(win, &w, &h); + wresize(win->window, h, w + 1); + mvwvline(win->window, 0, w, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), h); +} + +static void +envelope_normal_window(GntWidget *win) +{ + int w, h; + + if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER)) + return; + + gnt_widget_get_size(win, &w, &h); + wbkgdset(win->window, ' ' | COLOR_PAIR(GNT_COLOR_NORMAL)); + mvwprintw(win->window, 0, w - 4, "[X]"); +} + static PANEL * +s_resize_window(PANEL *panel, GntWidget *win) +{ + const char *name; + + name = gnt_widget_get_name(win); + if (name && strcmp(name, "buddylist") == 0) { + envelope_buddylist(win); + } else { + envelope_normal_window(win); + } + replace_panel(panel, win->window); + return panel; +} + +static PANEL * s_new_window(GntWidget *win) { int x, y, w, h; @@ -36,6 +73,7 @@ gnt_widget_set_size(win, w, h); gnt_widget_draw(win); + envelope_buddylist(win); } else if (name && strcmp(name, "conversation-window") == 0) { /* Put the conversation windows to the far-right */ x = maxx - w; @@ -43,6 +81,7 @@ gnt_widget_set_position(win, x, y); mvwin(win->window, y, x); gnt_widget_draw(win); + envelope_normal_window(win); } else if (!GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_TRANSIENT)) { /* In the middle of the screen */ x = (maxx - w) / 2; @@ -50,6 +89,7 @@ gnt_widget_set_position(win, x, y); mvwin(win->window, y, x); + envelope_normal_window(win); } return new_panel(win->window); @@ -69,6 +109,13 @@ return NULL; } +static gboolean +give_the_darned_focus(gpointer w) +{ + gwm->give_focus(w); + return FALSE; +} + static const char* s_key_pressed(const char *key) { @@ -78,7 +125,7 @@ if (w == NULL) { gg_blist_show(); w = find_widget("buddylist"); - gwm->give_focus(w); + g_timeout_add(0, give_the_darned_focus, w); } else { gnt_widget_destroy(w); } @@ -87,10 +134,34 @@ return key; } +static gboolean +s_mouse_clicked(GntMouseEvent event, int cx, int cy, GntWidget *widget) +{ + int x, y, w, h; + + if (!widget) + return FALSE; /* This might a place to bring up a context menu */ + + if (event != GNT_LEFT_MOUSE_DOWN || + GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) + return FALSE; /* For now, just the left-button to close a window */ + + gnt_widget_get_position(widget, &x, &y); + gnt_widget_get_size(widget, &w, &h); + + if (cy == y && cx == x + w - 3) { + gnt_widget_destroy(widget); + return TRUE; + } + return FALSE; +} + void gntwm_init(GntWM *wm) { gwm = wm; wm->new_window = s_new_window; + wm->window_resized = s_resize_window; wm->key_pressed = s_key_pressed; + wm->mouse_clicked = s_mouse_clicked; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-27 23:05:02
|
Revision: 17067 Author: thekingant Date: 2006-08-27 16:04:55 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17067&view=rev Log Message: ----------- If the status box is "away" when we go idle-away, then do nothing Modified Paths: -------------- trunk/libgaim/savedstatuses.c trunk/libgaim/upnp.h Modified: trunk/libgaim/savedstatuses.c =================================================================== --- trunk/libgaim/savedstatuses.c 2006-08-27 22:51:40 UTC (rev 17066) +++ trunk/libgaim/savedstatuses.c 2006-08-27 23:04:55 UTC (rev 17067) @@ -812,8 +812,13 @@ old = gaim_savedstatus_get_current(); gaim_prefs_set_bool("/core/savedstatus/isidleaway", idleaway); - saved_status = gaim_savedstatus_get_current(); + saved_status = idleaway ? gaim_savedstatus_get_idleaway() + : gaim_savedstatus_get_default(); + if (idleaway && (gaim_savedstatus_get_type(old) != GAIM_STATUS_AVAILABLE)) + /* Our global status is already "away," so don't change anything */ + return; + accounts = gaim_accounts_get_all_active(); for (node = accounts; node != NULL; node = node->next) { Modified: trunk/libgaim/upnp.h =================================================================== --- trunk/libgaim/upnp.h 2006-08-27 22:51:40 UTC (rev 17066) +++ trunk/libgaim/upnp.h 2006-08-27 23:04:55 UTC (rev 17067) @@ -36,6 +36,7 @@ /**************************************************************************/ /*@{*/ +/* typedef struct _GaimUPnPRequestData GaimUPnPRequestData; */ typedef void (*GaimUPnPCallback) (gboolean success, gpointer data); @@ -56,13 +57,12 @@ * Retrieve the current UPnP control info, if there is any available. * This will only be filled in if gaim_upnp_discover() had been called, * and finished discovering. - * + * * @return The control URL for the IGD we'll use to use the IGD services */ const GaimUPnPControlInfo* gaim_upnp_get_control_info(void); #endif - /** * Gets the IP address from a UPnP enabled IGD that sits on the local * network, so when getting the network IP, instead of returning the @@ -73,7 +73,6 @@ */ const gchar* gaim_upnp_get_public_ip(void); - /** * Maps Ports in a UPnP enabled IGD that sits on the local network to * this gaim client. Essentially, this function takes care of the port @@ -90,7 +89,7 @@ /** * Deletes a port mapping in a UPnP enabled IGD that sits on the local network - * to this gaim client. Essentially, this function takes care of deleting the + * to this gaim client. Essentially, this function takes care of deleting the * port forwarding after they have completed a connection so another client on * the local network can take advantage of the port forwarding * @@ -102,6 +101,7 @@ */ void gaim_upnp_remove_port_mapping(unsigned short portmap, const gchar* protocol, GaimUPnPCallback cb, gpointer cb_data); + /*@}*/ #ifdef __cplusplus This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-27 22:51:46
|
Revision: 17066 Author: thekingant Date: 2006-08-27 15:51:40 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17066&view=rev Log Message: ----------- Kevin pointed out that this wasn't allowing Windows 6.0 (only 6.1) Modified Paths: -------------- trunk/gtk/plugins/docklet/docklet-win32.c Modified: trunk/gtk/plugins/docklet/docklet-win32.c =================================================================== --- trunk/gtk/plugins/docklet/docklet-win32.c 2006-08-27 22:47:32 UTC (rev 17065) +++ trunk/gtk/plugins/docklet/docklet-win32.c 2006-08-27 22:51:40 UTC (rev 17066) @@ -212,7 +212,9 @@ * 2K and ME will use the highest color depth that the desktop will support, * but will scale it back to 4-bits for display. * That is why we use custom 4-bit icons for pre XP Windowses */ - if (osinfo.dwMajorVersion >= 5 && osinfo.dwMinorVersion > 0) { + if ((osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion > 0) || + (osinfo.dwMajorVersion >= 6)) + { sysicon_disconn = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_OFFLINE_TRAY_ICON), IMAGE_ICON, 16, 16, 0); sysicon_conn = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_TRAY_ICON), IMAGE_ICON, 16, 16, 0); sysicon_away = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAY_TRAY_ICON), IMAGE_ICON, 16, 16, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-27 22:47:39
|
Revision: 17065 Author: thekingant Date: 2006-08-27 15:47:32 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17065&view=rev Log Message: ----------- TiCPU pointed out that our code should check if the major version of windows >= 5 instead of == 5, so that we support 16 bit icons on Vista Modified Paths: -------------- trunk/gtk/plugins/docklet/docklet-win32.c Modified: trunk/gtk/plugins/docklet/docklet-win32.c =================================================================== --- trunk/gtk/plugins/docklet/docklet-win32.c 2006-08-27 22:04:09 UTC (rev 17064) +++ trunk/gtk/plugins/docklet/docklet-win32.c 2006-08-27 22:47:32 UTC (rev 17065) @@ -212,7 +212,7 @@ * 2K and ME will use the highest color depth that the desktop will support, * but will scale it back to 4-bits for display. * That is why we use custom 4-bit icons for pre XP Windowses */ - if (osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion > 0) { + if (osinfo.dwMajorVersion >= 5 && osinfo.dwMinorVersion > 0) { sysicon_disconn = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_OFFLINE_TRAY_ICON), IMAGE_ICON, 16, 16, 0); sysicon_conn = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_TRAY_ICON), IMAGE_ICON, 16, 16, 0); sysicon_away = (HICON)LoadImage(gtkwgaim_hinstance(), MAKEINTRESOURCE(GAIM_AWAY_TRAY_ICON), IMAGE_ICON, 16, 16, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-27 22:04:12
|
Revision: 17064 Author: thekingant Date: 2006-08-27 15:04:09 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17064&view=rev Log Message: ----------- Fix a small memleak Modified Paths: -------------- trunk/libgaim/dnsquery.c Modified: trunk/libgaim/dnsquery.c =================================================================== --- trunk/libgaim/dnsquery.c 2006-08-27 21:36:52 UTC (rev 17063) +++ trunk/libgaim/dnsquery.c 2006-08-27 22:04:09 UTC (rev 17064) @@ -87,6 +87,21 @@ gaim_debug_info("dnsquery", "IP resolved for %s\n", query_data->hostname); if (query_data->callback != NULL) query_data->callback(hosts, query_data->data, NULL); + else + { + /* + * Callback is a required parameter, but it can get set to + * NULL if we cancel a thread-based DNS lookup. So we need + * to free hosts. + */ + while (hosts != NULL) + { + hosts = g_slist_remove(hosts, hosts->data); + g_free(hosts->data); + hosts = g_slist_remove(hosts, hosts->data); + } + } + gaim_dnsquery_destroy(query_data); } @@ -566,6 +581,7 @@ g_return_val_if_fail(hostname != NULL, NULL); g_return_val_if_fail(port != 0, NULL); + g_return_val_if_fail(callback != NULL, NULL); query_data = g_new(GaimDnsQueryData, 1); query_data->hostname = g_strdup(hostname); @@ -728,6 +744,7 @@ g_return_val_if_fail(hostname != NULL, NULL); g_return_val_if_fail(port != 0, NULL); + g_return_val_if_fail(callback != NULL, NULL); gaim_debug_info("dnsquery", "Performing DNS lookup for %s\n", hostname); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-27 21:36:59
|
Revision: 17063 Author: thekingant Date: 2006-08-27 14:36:52 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17063&view=rev Log Message: ----------- Fix an assertion that fails for me about half the time when I try to sign onto MSN. Here's a backtrace, in case someone wants to look at this more in depth: #4 0x00002aaab203d857 in msn_object_new_from_string (str=0x2aaaac4f0860 "0") at object.c:79 obj = (MsnObject *) 0x7fff2bc6efe0 tag = 0x2aaaac4f0861 "" c = 0x100000001 <Address 0x100000001 out of bounds> __PRETTY_FUNCTION__ = "msn_object_new_from_string" #5 0x00002aaab203bf37 in nln_cmd (cmdproc=0xd84f30, cmd=0xcb1e10) at notification.c:687 session = (MsnSession *) 0xd72e70 account = (GaimAccount *) 0x63c020 gc = (GaimConnection *) 0xd5d9b0 user = (MsnUser *) 0xcb1d90 msnobj = (MsnObject *) 0x2aaaacc127d9 clientid = 32767 state = 0xc97820 "NLN" passport = 0xd65310 "lb...@ya..." friendly = 0x2aaaac4f0860 "0" #6 0x00002aaab202ff18 in msn_cmdproc_process_cmd (cmdproc=0xd84f30, cmd=0xcb1e10) at cmdproc.c:313 cb = 0x2aaab203be63 <nln_cmd> trans = (MsnTransaction *) 0x0 #7 0x00002aaab202ffbe in msn_cmdproc_process_cmd_text (cmdproc=0xd84f30, command=0xe082b0 "NLN NLN lb...@ya... lb...@ya... 1073741856 0") at cmdproc.c:335 No locals. #8 0x00002aaab2032c06 in read_cb (data=0xd4e600, source=7, cond=GAIM_INPUT_READ) at httpconn.c:380 httpconn = (MsnHttpConn *) 0xd4e600 servconn = (MsnServConn *) 0xd65360 session = (MsnSession *) 0xd72e70 buf = "HTTP/1.1 200 OK\r\nDate: Sun, 27 Aug 2006 21:29:58 GMT\r\nServer: Microsoft-IIS/6.0\r\nX-Powered-By: ASP.N ET\r\nX-MSN-Messenger: SessionID=26246177.8760; GW-IP=207.46.7.4\r\nContent-Length: 56\r\nContent-type: ap"... cur = 0xe082b0 "NLN NLN lb...@ya... lb...@ya... 1073741856 0" end = 0xe082e8 "" old_rx_buf = 0xe082b0 "NLN NLN lb...@ya... lb...@ya... 1073741856 0" len = 285 cur_len = 56 result_msg = 0xe082b0 "NLN NLN lb...@ya... lb...@ya... 1073741856 0" result_len = 56 error = 0 Modified Paths: -------------- trunk/libgaim/protocols/msn/object.c Modified: trunk/libgaim/protocols/msn/object.c =================================================================== --- trunk/libgaim/protocols/msn/object.c 2006-08-27 21:26:33 UTC (rev 17062) +++ trunk/libgaim/protocols/msn/object.c 2006-08-27 21:36:52 UTC (rev 17063) @@ -76,8 +76,10 @@ char *tag, *c; g_return_val_if_fail(str != NULL, NULL); - g_return_val_if_fail(!strncmp(str, "<msnobj ", 8), NULL); + if (strncmp(str, "<msnobj ", 8)) + return NULL; + obj = msn_object_new(); GET_STRING_TAG(creator, "Creator"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-27 21:26:41
|
Revision: 17062 Author: thekingant Date: 2006-08-27 14:26:33 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17062&view=rev Log Message: ----------- Change gaim_proxy_connect_data_error() to accept a format string and variable argument list, like printf, instead of an full error message Modified Paths: -------------- trunk/libgaim/proxy.c Modified: trunk/libgaim/proxy.c =================================================================== --- trunk/libgaim/proxy.c 2006-08-27 21:18:20 UTC (rev 17061) +++ trunk/libgaim/proxy.c 2006-08-27 21:26:33 UTC (rev 17062) @@ -350,9 +350,18 @@ * good error_message. */ static void -gaim_proxy_connect_data_error(GaimProxyConnectData *connect_data, const gchar *error_message) +gaim_proxy_connect_data_error(GaimProxyConnectData *connect_data, const char *format, ...) { + gchar *error_message; + va_list args; + + va_start(args, format); + error_message = g_strdup_vprintf(format, args); + va_end(args); + connect_data->connect_cb(connect_data->data, -1, error_message); + g_free(error_message); + gaim_proxy_connect_data_destroy(connect_data); } @@ -509,7 +518,6 @@ GaimProxyConnectData *connect_data = data; guchar *p; gsize max_read; - gchar *msg; if(connect_data->read_buffer == NULL) { connect_data->read_buf_len = 8192; @@ -587,10 +595,9 @@ if (error) { - msg = g_strdup_printf("Unable to parse response from HTTP proxy: %s\n", + gaim_proxy_connect_data_error(connect_data, + _("Unable to parse response from HTTP proxy: %s\n"), connect_data->read_buffer); - gaim_proxy_connect_data_error(connect_data, msg); - g_free(msg); return; } else if (status != 200) @@ -612,9 +619,8 @@ username = strchr(domain, '\\'); if (username == NULL) { - msg = g_strdup_printf(_("HTTP proxy connection error %d"), status); - gaim_proxy_connect_data_error(connect_data, msg); - g_free(msg); + gaim_proxy_connect_data_error(connect_data, + _("HTTP proxy connection error %d"), status); return; } *username = '\0'; @@ -661,9 +667,8 @@ username = strchr(domain, '\\'); if (username == NULL) { - msg = g_strdup_printf(_("HTTP proxy connection error %d"), status); - gaim_proxy_connect_data_error(connect_data, msg); - g_free(msg); + gaim_proxy_connect_data_error(connect_data, + _("HTTP proxy connection error %d"), status); return; } *username = '\0'; @@ -700,20 +705,18 @@ proxy_do_write(connect_data, connect_data->fd, cond); return; } else { - msg = g_strdup_printf(_("HTTP proxy connection error %d"), status); - gaim_proxy_connect_data_error(connect_data, msg); - g_free(msg); + gaim_proxy_connect_data_error(connect_data, + _("HTTP proxy connection error %d"), status); return; } } if(status == 403 /* Forbidden */ ) { - msg = g_strdup_printf(_("Access denied: HTTP proxy server forbids port %d tunnelling."), connect_data->port); - gaim_proxy_connect_data_error(connect_data, msg); - g_free(msg); + gaim_proxy_connect_data_error(connect_data, + _("Access denied: HTTP proxy server forbids port %d tunnelling."), + connect_data->port); } else { - msg = g_strdup_printf(_("HTTP proxy connection error %d"), status); - gaim_proxy_connect_data_error(connect_data, msg); - g_free(msg); + gaim_proxy_connect_data_error(connect_data, + _("HTTP proxy connection error %d"), status); } } else { gaim_input_remove(connect_data->inpa); @@ -1579,10 +1582,8 @@ if (error_message != NULL) { - gchar *tmp; - tmp = g_strdup_printf("Error while resolving hostname: %s\n", error_message); - gaim_proxy_connect_data_error(connect_data, tmp); - g_free(tmp); + gaim_proxy_connect_data_error(connect_data, + _("Error while resolving hostname: %s\n"), error_message); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-27 21:18:25
|
Revision: 17061 Author: thekingant Date: 2006-08-27 14:18:20 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17061&view=rev Log Message: ----------- Update perl to reflect the changes to gaim_util_fetch_url(). I hope this compiles. Modified Paths: -------------- trunk/libgaim/plugins/perl/common/Util.xs trunk/libgaim/plugins/perl/common/module.h trunk/libgaim/plugins/perl/common/typemap Modified: trunk/libgaim/plugins/perl/common/Util.xs =================================================================== --- trunk/libgaim/plugins/perl/common/Util.xs 2006-08-27 21:13:30 UTC (rev 17060) +++ trunk/libgaim/plugins/perl/common/Util.xs 2006-08-27 21:18:20 UTC (rev 17061) @@ -4,8 +4,8 @@ char *cb; } GaimPerlUrlData; -static void gaim_perl_util_url_cb(void *data, const char *url_data, size_t size) { - GaimPerlUrlData *gpr = (GaimPerlUrlData *)data; +static void gaim_perl_util_url_cb(Gaim::Util::FetchUrlData *url_data, void *user_data, const gchar *url_data, size_t size, const gchar *error_message) { + GaimPerlUrlData *gpr = (GaimPerlUrlData *)user_data; dSP; ENTER; SAVETMPS; @@ -26,7 +26,7 @@ PROTOTYPES: ENABLE void -gaim_url_fetch(handle, url, full, user_agent, http11, cb) +gaim_util_fetch_url(handle, url, full, user_agent, http11, cb) Gaim::Plugin handle const char *url gboolean full @@ -44,7 +44,7 @@ gpr = g_new(GaimPerlUrlData, 1); gpr->cb = g_strdup_printf("%s::%s", package, SvPV(cb, len)); - gaim_url_fetch(url, full, user_agent, http11, gaim_perl_util_url_cb, gpr); + gaim_util_fetch_url(url, full, user_agent, http11, gaim_perl_util_url_cb, gpr); int gaim_build_dir(path, mode) Modified: trunk/libgaim/plugins/perl/common/module.h =================================================================== --- trunk/libgaim/plugins/perl/common/module.h 2006-08-27 21:13:30 UTC (rev 17060) +++ trunk/libgaim/plugins/perl/common/module.h 2006-08-27 21:18:20 UTC (rev 17061) @@ -248,7 +248,7 @@ typedef GaimStringref * Gaim__Stringref; /* util.h */ -typedef GaimInfoFieldFormatCallback Gaim__Util__InfoFieldFormatCallback; +typedef GaimUtilFetchUrlData Gaim__Util__FetchUrlData; typedef GaimMenuAction * Gaim__Menu__Action; /* value.h */ Modified: trunk/libgaim/plugins/perl/common/typemap =================================================================== --- trunk/libgaim/plugins/perl/common/typemap 2006-08-27 21:13:30 UTC (rev 17060) +++ trunk/libgaim/plugins/perl/common/typemap 2006-08-27 21:18:20 UTC (rev 17061) @@ -157,6 +157,7 @@ Gaim::StoredImage T_GaimObj Gaim::Stringref T_GaimObj +Gaim::Util::FetchUrlData T_PTR Gaim::Util::InfoFieldFormatCallback T_PTR Gaim::Value T_GaimObj This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-27 21:14:05
|
Revision: 17060 Author: thekingant Date: 2006-08-27 14:13:30 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17060&view=rev Log Message: ----------- Make gaim_url_fetch() cancelable and change Yahoo! to take advantage of the changes. Other stuff can be changed later, the important thing is that the API is there. Modified Paths: -------------- trunk/doc/ChangeLog.API trunk/gtk/gtkprefs.c trunk/gtk/plugins/relnot.c trunk/libgaim/protocols/msn/msn.c trunk/libgaim/protocols/oscar/oscar.c trunk/libgaim/protocols/yahoo/yahoo.c trunk/libgaim/protocols/yahoo/yahoo.h trunk/libgaim/protocols/yahoo/yahoo_picture.c trunk/libgaim/protocols/yahoo/yahoo_profile.c trunk/libgaim/upnp.c trunk/libgaim/util.c trunk/libgaim/util.h Modified: trunk/doc/ChangeLog.API =================================================================== --- trunk/doc/ChangeLog.API 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/doc/ChangeLog.API 2006-08-27 21:13:30 UTC (rev 17060) @@ -122,6 +122,9 @@ * gaim_gethostbyname_async(): Renamed to gaim_dnsquery_a() and changed to return a pointer to a data structure that can be used to cancel the pending DNS query using gaim_dnsquery_destroy() + * gaim_url_fetch(): Renamed to gaim_util_fetch_url() and changed + to return a pointer to a data structer that can be used to cancel + the pending HTTP request using gaim_util_fetch_url_cancel(). * gaim_gtk_create_imhtml(): Added sw_ret() parameter * gaim_account_get_log(): Added create parameter * GAIM_CMD_P_VERYHIGH is now GAIM_CMD_P_VERY_HIGH @@ -283,7 +286,7 @@ * gaim_gtk_log_init() * gaim_gtk_log_get_handle() * gaim_gtk_log_uninit() - * gaim_url_fetch_request() + * gaim_util_fetch_url_request() * GaimMenuAction * gaim_menu_action_new() * gaim_menu_action_free() @@ -310,6 +313,8 @@ gaim_proxy_connect() request * gaim_dnsquery_destroy(): Can be used to cancel a pending DNS query. + * gaim_util_fetch_url_cancel(): Can be used to cancel a pending + call to gaim_util_fetch_url() or gaim_util_fetch_url_request(). Signals - Changed: (See the Doxygen docs for details on all signals.) * Signal propagation now stops after a handler returns a non-NULL value. Modified: trunk/gtk/gtkprefs.c =================================================================== --- trunk/gtk/gtkprefs.c 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/gtk/gtkprefs.c 2006-08-27 21:13:30 UTC (rev 17060) @@ -526,26 +526,29 @@ } static void -theme_got_url(void *data, const char *themedata, size_t len) +theme_got_url(GaimUtilFetchUrlData *url_data, gpointer user_data, + const gchar *themedata, size_t len, const gchar *error_message) { FILE *f; gchar *path; - if (len == 0) + if ((error_message != NULL) || (len == 0)) return; f = gaim_mkstemp(&path, TRUE); fwrite(themedata, len, 1, f); fclose(f); - theme_install_theme(path, data); + theme_install_theme(path, user_data); g_unlink(path); g_free(path); } -static void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, - guint info, guint t, gpointer data) { +static void +theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, + GtkSelectionData *sd, guint info, guint t, gpointer data) +{ gchar *name = (gchar *)sd->data; if ((sd->length >= 0) && (sd->format == 8)) { @@ -568,9 +571,9 @@ } else if (!g_ascii_strncasecmp(name, "http://", 7)) { /* Oo, a web drag and drop. This is where things * will start to get interesting */ - gaim_url_fetch(name, TRUE, NULL, FALSE, theme_got_url, ".tgz"); + gaim_util_fetch_url(name, TRUE, NULL, FALSE, theme_got_url, ".tgz"); } else if (!g_ascii_strncasecmp(name, "https://", 8)) { - /* gaim_url_fetch() doesn't support HTTPS, but we want users + /* gaim_util_fetch_url() doesn't support HTTPS, but we want users * to be able to drag and drop links from the SF trackers, so * we'll try it as an HTTP URL. */ char *tmp = g_strdup(name + 1); @@ -578,7 +581,7 @@ tmp[1] = 't'; tmp[2] = 't'; tmp[3] = 'p'; - gaim_url_fetch(tmp, TRUE, NULL, FALSE, theme_got_url, ".tgz"); + gaim_util_fetch_url(tmp, TRUE, NULL, FALSE, theme_got_url, ".tgz"); g_free(tmp); } Modified: trunk/gtk/plugins/relnot.c =================================================================== --- trunk/gtk/plugins/relnot.c 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/gtk/plugins/relnot.c 2006-08-27 21:13:30 UTC (rev 17060) @@ -42,14 +42,14 @@ #define MIN_CHECK_INTERVAL 60 * 60 * 24 static void -version_fetch_cb(void *ud, const char *data, size_t len) +version_fetch_cb(GaimUtilFetchUrlData *url_data, gpointer user_data, + const gchar *changelog, size_t len, const gchar *error_message) { - const char *changelog = data; char *cur_ver, *formatted; GString *message; int i=0; - if(!changelog || !len) + if(error_message || !changelog || !len) return; while(changelog[i] && changelog[i] != '\n') i++; @@ -101,7 +101,7 @@ "gaim" #endif ); - gaim_url_fetch(url, TRUE, NULL, FALSE, version_fetch_cb, NULL); + gaim_util_fetch_url(url, TRUE, NULL, FALSE, version_fetch_cb, NULL); gaim_prefs_set_int("/plugins/gtk/relnot/last_check", time(NULL)); g_free(url); } Modified: trunk/libgaim/protocols/msn/msn.c =================================================================== --- trunk/libgaim/protocols/msn/msn.c 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/libgaim/protocols/msn/msn.c 2006-08-27 21:13:30 UTC (rev 17060) @@ -1402,7 +1402,8 @@ return NULL; } -static void msn_got_photo(void *data, const char *url_text, size_t len); +static void msn_got_photo(GaimUtilFetchUrlData *url_data, gpointer data, + const gchar *url_text, size_t len, const gchar *error_message); #endif @@ -1424,7 +1425,8 @@ sect_info = TRUE; static void -msn_got_info(void *data, const char *url_text, size_t len) +msn_got_info(GaimUtilFetchUrlData *url_data, gpointer data, + const gchar *url_text, size_t len, const gchar *error_message) { MsnGetInfoData *info_data = (MsnGetInfoData *)data; char *stripped, *p, *q; @@ -1459,7 +1461,7 @@ tooltip_text = msn_tooltip_info_text(info_data); title = _("MSN Profile"); - if (url_text == NULL || strcmp(url_text, "") == 0) + if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) { g_snprintf(buf, 1024, "<html><body>%s<b>%s</b></body></html>", tooltip_text, _("Error retrieving profile")); @@ -1824,20 +1826,22 @@ /* Try to put the photo in there too, if there's one */ if (photo_url_text) { - gaim_url_fetch(photo_url_text, FALSE, NULL, FALSE, msn_got_photo, + gaim_util_fetch_url(photo_url_text, FALSE, NULL, FALSE, msn_got_photo, info2_data); } else { /* Emulate a callback */ - msn_got_photo(info2_data, NULL, 0); + /* TODO: Huh? */ + msn_got_photo(NULL, info2_data, NULL, 0, NULL); } } static void -msn_got_photo(void *data, const char *url_text, size_t len) +msn_got_photo(GaimUtilFetchUrlData *url_data, gpointer user_data, + const gchar *url_text, size_t len, const gchar *error_message) { - MsnGetInfoStepTwoData *info2_data = (MsnGetInfoStepTwoData *)data; + MsnGetInfoStepTwoData *info2_data = (MsnGetInfoStepTwoData *)user_data; int id = -1; /* Unmarshall the saved state */ @@ -1849,7 +1853,7 @@ char *tooltip_text = info2_data->tooltip_text; /* Make sure the connection is still valid if we got here by fetching a photo url */ - if (url_text && + if (error_message == NULL || url_text != NULL || g_list_find(gaim_connections_get_all(), info_data->gc) == NULL) { gaim_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n"); @@ -1866,7 +1870,7 @@ } /* Try to put the photo in there too, if there's one and is readable */ - if (data && url_text && len != 0) + if (user_data && url_text && len != 0) { if (strstr(url_text, "400 Bad Request") || strstr(url_text, "403 Forbidden") @@ -1918,7 +1922,7 @@ url = g_strdup_printf("%s%s", PROFILE_URL, name); - gaim_url_fetch(url, FALSE, + gaim_util_fetch_url(url, FALSE, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", TRUE, msn_got_info, data); Modified: trunk/libgaim/protocols/oscar/oscar.c =================================================================== --- trunk/libgaim/protocols/oscar/oscar.c 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/libgaim/protocols/oscar/oscar.c 2006-08-27 21:13:30 UTC (rev 17060) @@ -1372,7 +1372,7 @@ return 1; } -/* XXX - Should use gaim_url_fetch for the below stuff */ +/* XXX - Should use gaim_util_fetch_url for the below stuff */ struct pieceofcrap { GaimConnection *gc; unsigned long offset; Modified: trunk/libgaim/protocols/yahoo/yahoo.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo.c 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/libgaim/protocols/yahoo/yahoo.c 2006-08-27 21:13:30 UTC (rev 17060) @@ -52,7 +52,7 @@ /* #define YAHOO_DEBUG */ static void yahoo_add_buddy(GaimConnection *gc, GaimBuddy *, GaimGroup *); -static void yahoo_login_page_cb(void *user_data, const char *buf, size_t len); +static void yahoo_login_page_cb(GaimUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); static void yahoo_set_status(GaimAccount *account, GaimStatus *status); static void @@ -1885,13 +1885,16 @@ break; case 13: if (!yd->wm) { + GaimUtilFetchUrlData *url_data; yd->wm = TRUE; if (yd->fd >= 0) close(yd->fd); if (gc->inpa) gaim_input_remove(gc->inpa); - gaim_url_fetch(WEBMESSENGER_URL, TRUE, "Gaim/" VERSION, FALSE, - yahoo_login_page_cb, gc); + url_data = gaim_util_fetch_url(WEBMESSENGER_URL, TRUE, + "Gaim/" VERSION, FALSE, yahoo_login_page_cb, gc); + if (url_data != NULL) + yd->url_datas = g_slist_prepend(yd->url_datas, url_data); gaim_notify_warning(gc, NULL, _("Normal authentication failed!"), _("The normal authentication method has failed. " "This means either your password is incorrect, " @@ -2523,14 +2526,16 @@ return hash; } -static void yahoo_login_page_cb(void *user_data, const char *buf, size_t len) +static void +yahoo_login_page_cb(GaimUtilFetchUrlData *url_data, gpointer user_data, + const gchar *url_text, size_t len, const gchar *error_message) { GaimConnection *gc = (GaimConnection *)user_data; GaimAccount *account = gaim_connection_get_account(gc); struct yahoo_data *yd = gc->proto_data; const char *sn = gaim_account_get_username(account); const char *pass = gaim_connection_get_password(gc); - GHashTable *hash = yahoo_login_page_hash(buf, len); + GHashTable *hash = yahoo_login_page_hash(url_text, len); GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); char md5[33], *hashp = md5, *chal; int i; @@ -2538,6 +2543,8 @@ GaimCipherContext *context; guchar digest[16]; + yd->url_datas = g_slist_remove(yd->url_datas, url_data); + url = g_string_append(url, sn); url = g_string_append(url, "&passwd="); @@ -2709,6 +2716,11 @@ if (gc->inpa) gaim_input_remove(gc->inpa); + while (yd->url_datas) { + gaim_util_fetch_url_cancel(yd->url_datas->data); + yd->url_datas = g_slist_delete_link(yd->url_datas, yd->url_datas); + } + for (l = yd->confs; l; l = l->next) { GaimConversation *conv = l->data; Modified: trunk/libgaim/protocols/yahoo/yahoo.h =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo.h 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/libgaim/protocols/yahoo/yahoo.h 2006-08-27 21:13:30 UTC (rev 17060) @@ -139,6 +139,12 @@ struct yahoo_buddy_icon_upload_data *picture_upload_todo; struct _YchtConn *ycht; + + /** + * This linked list contains GaimUtilFetchUrlData structs + * for when we lookup people profile or photo information. + */ + GSList *url_datas; }; #define YAHOO_MAX_STATUS_MESSAGE_LENGTH (255) Modified: trunk/libgaim/protocols/yahoo/yahoo_picture.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_picture.c 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/libgaim/protocols/yahoo/yahoo_picture.c 2006-08-27 21:13:30 UTC (rev 17060) @@ -43,18 +43,27 @@ int checksum; }; -static void yahoo_fetch_picture_cb(void *user_data, const char *pic_data, size_t len) +static void +yahoo_fetch_picture_cb(GaimUtilFetchUrlData *url_data, gpointer user_data, + const gchar *pic_data, size_t len, const gchar *error_message) { - struct yahoo_fetch_picture_data *d = user_data; + struct yahoo_fetch_picture_data *d; + struct yahoo_data *yd; GaimBuddy *b; - if (GAIM_CONNECTION_IS_VALID(d->gc) && len) { + d = user_data; + yd = d->gc->proto_data; + yd->url_datas = g_slist_remove(yd->url_datas, url_data); + + if (error_message != NULL) { + gaim_debug_error("yahoo", "Fetching buddy icon failed: %s\n", error_message); + } else if (len == 0) { + gaim_debug_error("yahoo", "Fetched an icon with length 0. Strange.\n"); + } else { gaim_buddy_icons_set_for_user(gaim_connection_get_account(d->gc), d->who, (void *)pic_data, len); b = gaim_find_buddy(gaim_connection_get_account(d->gc), d->who); if (b) gaim_blist_node_set_int((GaimBlistNode*)b, YAHOO_ICON_CHECKSUM_KEY, d->checksum); - } else { - gaim_debug_error("yahoo", "Fetching buddy icon failed.\n"); } g_free(d->who); @@ -63,6 +72,7 @@ void yahoo_process_picture(GaimConnection *gc, struct yahoo_packet *pkt) { + struct yahoo_data *yd; GSList *l = pkt->hash; char *who = NULL, *us = NULL; gboolean got_icon_info = FALSE, send_icon_info = FALSE; @@ -104,6 +114,7 @@ /* Yahoo IM 6 spits out 0.png as the URL if the buddy icon is not set */ if (who && got_icon_info && url && !strncasecmp(url, "http://", 7)) { /* TODO: make this work p2p, try p2p before the url */ + GaimUtilFetchUrlData *url_data; struct yahoo_fetch_picture_data *data; GaimBuddy *b = gaim_find_buddy(gc->account, who); if (b && (checksum == gaim_blist_node_get_int((GaimBlistNode*)b, YAHOO_ICON_CHECKSUM_KEY))) @@ -113,8 +124,16 @@ data->gc = gc; data->who = g_strdup(who); data->checksum = checksum; - gaim_url_fetch(url, FALSE, "Mozilla/4.0 (compatible; MSIE 5.0)", FALSE, - yahoo_fetch_picture_cb, data); + url_data = gaim_util_fetch_url(url, FALSE, + "Mozilla/4.0 (compatible; MSIE 5.0)", FALSE, + yahoo_fetch_picture_cb, data); + if (url_data != NULL) { + yd = gc->proto_data; + yd->url_datas = g_slist_prepend(yd->url_datas, url_data); + } else { + g_free(data->who); + g_free(data); + } } else if (who && send_icon_info) { yahoo_send_picture_info(gc, who); } Modified: trunk/libgaim/protocols/yahoo/yahoo_profile.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_profile.c 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/libgaim/protocols/yahoo/yahoo_profile.c 2006-08-27 21:13:30 UTC (rev 17060) @@ -742,13 +742,16 @@ return it; } -static void yahoo_got_photo(void *data, const char *url_text, size_t len); +static void +yahoo_got_photo(GaimUtilFetchUrlData *url_data, gpointer data, + const gchar *url_text, size_t len, const gchar *error_message); #endif /* PHOTO_SUPPORT */ -static void yahoo_got_info(void *data, const char *url_text, size_t len) +static void yahoo_got_info(GaimUtilFetchUrlData *url_data, gpointer user_data, + const gchar *url_text, size_t len, const gchar *error_message) { - YahooGetInfoData *info_data = (YahooGetInfoData *)data; + YahooGetInfoData *info_data = (YahooGetInfoData *)user_data; char *p; char buf[1024]; #if PHOTO_SUPPORT @@ -771,26 +774,22 @@ const char *title; profile_state_t profile_state = PROFILE_STATE_DEFAULT; - if (!GAIM_CONNECTION_IS_VALID(info_data->gc)) { - g_free(info_data->name); - g_free(info_data); - return; - } - gaim_debug_info("yahoo", "In yahoo_got_info\n"); yd = info_data->gc->proto_data; - title = (yd->jp? _("Yahoo! Japan Profile") : - _("Yahoo! Profile")); + yd->url_datas = g_slist_remove(yd->url_datas, url_data); + title = yd->jp ? _("Yahoo! Japan Profile") : + _("Yahoo! Profile"); + /* Get the tooltip info string */ tooltip_text = yahoo_tooltip_info_text(info_data); - + /* We failed to grab the profile URL. This is not expected to actually * happen except under unusual error conditions, as Yahoo is observed * to send back HTML, with a 200 status code. */ - if (url_text == NULL || strcmp(url_text, "") == 0) { + if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) { g_snprintf(buf, 1024, "<html><body>%s<b>%s</b></body></html>", tooltip_text, _("Error retrieving profile")); @@ -920,21 +919,32 @@ /* Try to put the photo in there too, if there's one */ if (photo_url_text) { + GaimUtilFetchUrlData *url_data; /* User-uploaded photos use a different server that requires the Host * header, but Yahoo Japan will use the "chunked" content encoding if - * we specify HTTP 1.1. So we have to specify 1.0 & fix gaim_url_fetch + * we specify HTTP 1.1. So we have to specify 1.0 & fix gaim_util_fetch_url */ - gaim_url_fetch(photo_url_text, FALSE, NULL, FALSE, yahoo_got_photo, - info2_data); + url_data = gaim_util_fetch_url(photo_url_text, FALSE, NULL, + FALSE, yahoo_got_photo, info2_data); + if (url_data != NULL) + yd->url_datas = g_slist_prepend(yd->url_datas, url_data); + else { + g_free(info2_data->info_data->name); + g_free(info2_data->info_data); + g_free(info2_data); + } } else { /* Emulate a callback */ - yahoo_got_photo(info2_data, NULL, 0); + yahoo_got_photo(NULL, info2_data, NULL, 0, NULL); } } -static void yahoo_got_photo(void *data, const char *url_text, size_t len) +static void +yahoo_got_photo(GaimUtilFetchUrlData *url_data, gpointer data, + const gchar *url_text, size_t len, const gchar *error_message) { YahooGetInfoStepTwoData *info2_data = (YahooGetInfoStepTwoData *)data; + struct yahoo_data *yd; gboolean found = FALSE; int id = -1; @@ -962,6 +972,10 @@ /* </dd> and not \n. The prpl's need to be audited before it can be moved */ /* in to gaim_markup_strip_html*/ char *fudged_buffer; + + yd = info_data->gc->proto_data; + yd->url_datas = g_slist_remove(yd->url_datas, url_data); + fudged_buffer = gaim_strcasereplace(url_buffer, "</dd>", "</dd><br>"); /* nuke the html, it's easier than trying to parse the horrid stuff */ stripped = gaim_markup_strip_html(fudged_buffer); @@ -1197,7 +1211,6 @@ "however, Yahoo! sometimes does fail to find a user's " "profile. If you know that the user exists, " "please try again later.")); - } else { g_string_append_printf(s, "%s<br><br>", _("The user's profile is empty.")); @@ -1245,15 +1258,22 @@ struct yahoo_data *yd = gc->proto_data; YahooGetInfoData *data; char *url; + GaimUtilFetchUrlData *url_data; data = g_new0(YahooGetInfoData, 1); data->gc = gc; data->name = g_strdup(name); url = g_strdup_printf("%s%s", - (yd->jp? YAHOOJP_PROFILE_URL: YAHOO_PROFILE_URL), name); + (yd->jp ? YAHOOJP_PROFILE_URL : YAHOO_PROFILE_URL), name); - gaim_url_fetch(url, TRUE, NULL, FALSE, yahoo_got_info, data); + url_data = gaim_util_fetch_url(url, TRUE, NULL, FALSE, yahoo_got_info, data); + if (url_data != NULL) + yd->url_datas = g_slist_prepend(yd->url_datas, url_data); + else { + g_free(data->name); + g_free(data); + } g_free(url); } Modified: trunk/libgaim/upnp.c =================================================================== --- trunk/libgaim/upnp.c 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/libgaim/upnp.c 2006-08-27 21:13:30 UTC (rev 17060) @@ -150,7 +150,6 @@ static void lookup_public_ip(void); static void lookup_internal_ip(void); - static void fire_discovery_callbacks(gboolean success) { @@ -164,7 +163,6 @@ } } - static gboolean gaim_upnp_compare_device(const xmlnode* device, const gchar* deviceType) { @@ -183,7 +181,6 @@ return ret; } - static gboolean gaim_upnp_compare_service(const xmlnode* service, const gchar* serviceType) { @@ -208,7 +205,6 @@ return ret; } - static gchar* gaim_upnp_parse_description_response(const gchar* httpResponse, gsize len, const gchar* httpURL, const gchar* serviceType) @@ -358,9 +354,10 @@ } static void -upnp_parse_description_cb(void *data, const char *httpResponse, gsize len) +upnp_parse_description_cb(GaimUtilFetchUrlData *url_data, gpointer user_data, + const gchar *httpResponse, gsize len, const gchar *error_message) { - UPnPDiscoveryData *dd = data; + UPnPDiscoveryData *dd = user_data; gchar *control_url = NULL; if (len > 0) @@ -431,7 +428,7 @@ gaim_timeout_remove(dd->tima); dd->tima = 0; - gaim_url_fetch_request(descriptionURL, TRUE, NULL, TRUE, httpRequest, + gaim_util_fetch_url_request(descriptionURL, TRUE, NULL, TRUE, httpRequest, TRUE, upnp_parse_description_cb, dd); g_free(httpRequest); @@ -548,7 +545,7 @@ /* We'll either time out or continue successfully */ } -void +static void gaim_upnp_discover_send_broadcast(UPnPDiscoveryData *dd) { gchar *sendMessage = NULL; @@ -598,7 +595,6 @@ gaim_timeout_add(10, gaim_upnp_discover_timeout, dd); } - void gaim_upnp_discover(GaimUPnPCallback cb, gpointer cb_data) { @@ -661,7 +657,7 @@ static void gaim_upnp_generate_action_message_and_send(const gchar* actionName, - const gchar* actionParams, GaimURLFetchCallback cb, + const gchar* actionParams, GaimUtilFetchUrlCallback cb, gpointer cb_data) { @@ -678,7 +674,7 @@ "generate_action_message_and_send(): Failed In Parse URL\n\n"); /* XXX: This should probably be async */ if(cb) - cb(cb_data, NULL, 0); + cb(NULL, cb_data, NULL, 0, NULL); } if(port == 0 || port == -1) { port = DEFAULT_HTTP_PORT; @@ -696,14 +692,13 @@ g_free(pathOfControl); g_free(soapMessage); - gaim_url_fetch_request(control_info.control_url, FALSE, NULL, TRUE, + gaim_util_fetch_url_request(control_info.control_url, FALSE, NULL, TRUE, totalSendMessage, TRUE, cb, cb_data); g_free(totalSendMessage); g_free(addressOfControl); } - const gchar * gaim_upnp_get_public_ip() { @@ -722,11 +717,12 @@ } static void -looked_up_public_ip_cb(gpointer data, const char *httpResponse, gsize len) +looked_up_public_ip_cb(GaimUtilFetchUrlData *url_data, gpointer user_data, + const gchar *httpResponse, gsize len, const gchar *error_message) { gchar* temp, *temp2; - if(!httpResponse) + if ((error_message != NULL) || (httpResponse == NULL)) return; /* extract the ip, or see if there is an error */ @@ -754,7 +750,7 @@ gaim_debug_info("upnp", "NAT Returned IP: %s\n", control_info.publicip); } -void +static void lookup_public_ip() { gaim_upnp_generate_action_message_and_send("GetExternalIPAddress", "", @@ -794,7 +790,7 @@ } -void +static void lookup_internal_ip() { gchar* addressOfControl; @@ -821,14 +817,17 @@ } static void -done_port_mapping_cb(gpointer data, const gchar *httpResponse, gsize len) +done_port_mapping_cb(GaimUtilFetchUrlData *url_data, gpointer user_data, + const gchar *httpResponse, gsize len, const gchar *error_message) { - UPnPMappingAddRemove *ar = data; + UPnPMappingAddRemove *ar = user_data; gboolean success = TRUE; /* determine if port mapping was a success */ - if(!httpResponse || g_strstr_len(httpResponse, len, HTTP_OK) == NULL) { + if ((error_message != NULL) || (httpResponse == NULL) || + (g_strstr_len(httpResponse, len, HTTP_OK) == NULL)) + { gaim_debug_error("upnp", "gaim_upnp_set_port_mapping(): Failed HTTP_OK\n\n%s\n\n", httpResponse ? httpResponse : "(null)"); Modified: trunk/libgaim/util.c =================================================================== --- trunk/libgaim/util.c 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/libgaim/util.c 2006-08-27 21:13:30 UTC (rev 17060) @@ -29,9 +29,9 @@ #include "prefs.h" #include "util.h" -typedef struct +struct _GaimUtilFetchUrlData { - void (*callback)(void *, const char *, size_t); + GaimUtilFetchUrlCallback callback; void *user_data; struct @@ -52,16 +52,17 @@ gsize request_written; gboolean include_headers; - int inpa; + GaimProxyConnectData *connect_data; + int fd; + guint inpa; gboolean got_headers; gboolean has_explicit_data_len; char *webdata; unsigned long len; unsigned long data_len; +}; -} GaimFetchUrlData; - static char custom_home_dir[MAXPATHLEN]; static char home_dir[MAXPATHLEN]; @@ -3059,24 +3060,28 @@ return TRUE; } +/** + * The arguments to this function are similar to printf. + */ static void -destroy_fetch_url_data(GaimFetchUrlData *gfud) +gaim_util_fetch_url_error(GaimUtilFetchUrlData *gfud, const char *format, ...) { - g_free(gfud->webdata); - g_free(gfud->url); - g_free(gfud->user_agent); - g_free(gfud->website.address); - g_free(gfud->website.page); - g_free(gfud->website.user); - g_free(gfud->website.passwd); - g_free(gfud->request); + gchar *error_message; + va_list args; - g_free(gfud); + va_start(args, format); + error_message = g_strdup_vprintf(format, args); + va_end(args); + + gfud->callback(gfud, gfud->user_data, NULL, 0, error_message); + g_free(error_message); + gaim_util_fetch_url_cancel(gfud); } +/* TODO: This totally destroys cancelability. */ static gboolean parse_redirect(const char *data, size_t data_len, gint sock, - GaimFetchUrlData *gfud) + GaimUtilFetchUrlData *gfud) { gchar *s; @@ -3116,20 +3121,16 @@ full = FALSE; } - /* Close the existing stuff. */ - gaim_input_remove(gfud->inpa); - close(sock); + gaim_debug_info("util", "Redirecting to %s\n", new_url); - gaim_debug_info("gaim_url_fetch", "Redirecting to %s\n", new_url); - /* Try again, with this new location. */ - gaim_url_fetch_request(new_url, full, gfud->user_agent, + gaim_util_fetch_url_request(new_url, full, gfud->user_agent, gfud->http11, NULL, gfud->include_headers, gfud->callback, gfud->user_data); - /* Free up. */ + /* Free the old connection */ g_free(new_url); - destroy_fetch_url_data(gfud); + gaim_util_fetch_url_cancel(gfud); return TRUE; } @@ -3173,7 +3174,7 @@ */ if (p && g_strstr_len(p, data_len - (p - data), "\n")) { sscanf(p, "%" G_GSIZE_FORMAT, &content_len); - gaim_debug_misc("parse_content_len", "parsed %u\n", content_len); + gaim_debug_misc("util", "parsed %u\n", content_len); } return content_len; @@ -3183,14 +3184,14 @@ static void url_fetch_recv_cb(gpointer url_data, gint source, GaimInputCondition cond) { - GaimFetchUrlData *gfud = url_data; + GaimUtilFetchUrlData *gfud = url_data; int len; char buf[4096]; char *data_cursor; gboolean got_eof = FALSE; while((len = read(source, buf, sizeof(buf))) > 0) { - /* If we've filled up our butfer, make it bigger */ + /* If we've filled up our buffer, make it bigger */ if((gfud->len + len) >= gfud->data_len) { while((gfud->len + len) >= gfud->data_len) gfud->data_len += sizeof(buf); @@ -3209,13 +3210,13 @@ if(!gfud->got_headers) { char *tmp; - /** See if we've reached the end of the headers yet */ + /* See if we've reached the end of the headers yet */ if((tmp = strstr(gfud->webdata, "\r\n\r\n"))) { char * new_data; guint header_len = (tmp + 4 - gfud->webdata); size_t content_len; - gaim_debug_misc("gaim_url_fetch", "Response headers: '%.*s'\n", + gaim_debug_misc("util", "Response headers: '%.*s'\n", header_len, gfud->webdata); /* See if we can find a redirect. */ @@ -3249,12 +3250,14 @@ new_data = g_try_malloc(content_len); if(new_data == NULL) { - gaim_debug_error("gaim_url_fetch", "Failed to allocate %u bytes: %s\n", - content_len, strerror(errno)); - gaim_input_remove(gfud->inpa); - close(source); - gfud->callback(gfud->user_data, NULL, 0); - destroy_fetch_url_data(gfud); + gaim_debug_error("util", + "Failed to allocate %u bytes: %s\n", + content_len, strerror(errno)); + gaim_util_fetch_url_error(gfud, + _("Unable to allocate enough memory to hold " + "the contents from %s. The web server may " + "be trying something malicious."), + gfud->website.address); return; } @@ -3288,12 +3291,8 @@ } else if(errno != ETIMEDOUT) { got_eof = TRUE; } else { - gaim_input_remove(gfud->inpa); - close(source); - - gfud->callback(gfud->user_data, NULL, 0); - - destroy_fetch_url_data(gfud); + gaim_util_fetch_url_error(gfud, _("Error reading from %s: %s"), + gfud->website.address, strerror(errno)); return; } } @@ -3302,63 +3301,59 @@ gfud->webdata = g_realloc(gfud->webdata, gfud->len + 1); gfud->webdata[gfud->len] = '\0'; - /* gaim_debug_misc("gaim_url_fetch", "Received: '%s'\n", gfud->webdata); */ - - gaim_input_remove(gfud->inpa); - close(source); - gfud->callback(gfud->user_data, gfud->webdata, gfud->len); - - destroy_fetch_url_data(gfud); + gfud->callback(gfud, gfud->user_data, gfud->webdata, gfud->len, NULL); + gaim_util_fetch_url_cancel(gfud); } } static void url_fetch_send_cb(gpointer data, gint source, GaimInputCondition cond) { - GaimFetchUrlData *gfud; + GaimUtilFetchUrlData *gfud; int len, total_len; gfud = data; total_len = strlen(gfud->request); - len = write(source, gfud->request + gfud->request_written, + len = write(gfud->fd, gfud->request + gfud->request_written, total_len - gfud->request_written); - if(len < 0 && errno == EAGAIN) + if (len < 0 && errno == EAGAIN) return; - else if(len < 0) { - gaim_input_remove(gfud->inpa); - close(source); - gfud->callback(gfud->user_data, NULL, 0); - destroy_fetch_url_data(gfud); + else if (len < 0) { + gaim_util_fetch_url_error(gfud, _("Error writing to %s: %s"), + gfud->website.address, strerror(errno)); return; } gfud->request_written += len; - if(gfud->request_written != total_len) + if (gfud->request_written != total_len) return; - /* We're done writing, now start reading */ + /* We're done writing our request, now start reading the response */ gaim_input_remove(gfud->inpa); - gfud->inpa = gaim_input_add(source, GAIM_INPUT_READ, url_fetch_recv_cb, + gfud->inpa = gaim_input_add(gfud->fd, GAIM_INPUT_READ, url_fetch_recv_cb, gfud); } static void url_fetch_connect_cb(gpointer url_data, gint source, const gchar *error_message) { - GaimFetchUrlData *gfud; + GaimUtilFetchUrlData *gfud; gfud = url_data; + gfud->connect_data = NULL; if (source == -1) { - gfud->callback(gfud->user_data, NULL, 0); - destroy_fetch_url_data(gfud); + gaim_util_fetch_url_error(gfud, _("Unable to connect to %s: %s"), + gfud->website.address, error_message); return; } + gfud->fd = source; + if (!gfud->request) { if (gfud->user_agent) { @@ -3390,31 +3385,31 @@ } } - gaim_debug_misc("gaim_url_fetch", "Request: '%s'\n", gfud->request); + gaim_debug_misc("util", "Request: '%s'\n", gfud->request); gfud->inpa = gaim_input_add(source, GAIM_INPUT_WRITE, url_fetch_send_cb, gfud); url_fetch_send_cb(gfud, source, GAIM_INPUT_WRITE); } -void -gaim_url_fetch_request(const char *url, gboolean full, +GaimUtilFetchUrlData * +gaim_util_fetch_url_request(const char *url, gboolean full, const char *user_agent, gboolean http11, const char *request, gboolean include_headers, - GaimURLFetchCallback cb, void *user_data) + GaimUtilFetchUrlCallback callback, void *user_data) { - GaimFetchUrlData *gfud; + GaimUtilFetchUrlData *gfud; - g_return_if_fail(url != NULL); - g_return_if_fail(cb != NULL); + g_return_val_if_fail(url != NULL, NULL); + g_return_val_if_fail(callback != NULL, NULL); - gaim_debug_info("gaim_url_fetch", + gaim_debug_info("util", "requested to fetch (%s), full=%d, user_agent=(%s), http11=%d\n", url, full, user_agent?user_agent:"(null)", http11); - gfud = g_new0(GaimFetchUrlData, 1); + gfud = g_new0(GaimUtilFetchUrlData, 1); - gfud->callback = cb; + gfud->callback = callback; gfud->user_data = user_data; gfud->url = g_strdup(url); gfud->user_agent = g_strdup(user_agent); @@ -3426,15 +3421,44 @@ gaim_url_parse(url, &gfud->website.address, &gfud->website.port, &gfud->website.page, &gfud->website.user, &gfud->website.passwd); - if (gaim_proxy_connect(NULL, gfud->website.address, - gfud->website.port, url_fetch_connect_cb, gfud) == NULL) + gfud->connect_data = gaim_proxy_connect(NULL, + gfud->website.address, gfud->website.port, + url_fetch_connect_cb, gfud); + + if (gfud->connect_data == NULL) { - destroy_fetch_url_data(gfud); + gaim_util_fetch_url_error(gfud, _("Unable to connect to %s"), + gfud->website.address); + return NULL; + } - cb(user_data, g_strdup(_("g003: Error opening connection.\n")), 0); - } + return gfud; } +void +gaim_util_fetch_url_cancel(GaimUtilFetchUrlData *gfud) +{ + if (gfud->connect_data != NULL) + gaim_proxy_connect_cancel(gfud->connect_data); + + if (gfud->inpa > 0) + gaim_input_remove(gfud->inpa); + + if (gfud->fd >= 0) + close(gfud->fd); + + g_free(gfud->website.user); + g_free(gfud->website.passwd); + g_free(gfud->website.address); + g_free(gfud->website.page); + g_free(gfud->url); + g_free(gfud->user_agent); + g_free(gfud->request); + g_free(gfud->webdata); + + g_free(gfud); +} + const char * gaim_url_decode(const char *str) { Modified: trunk/libgaim/util.h =================================================================== --- trunk/libgaim/util.h 2006-08-27 19:47:41 UTC (rev 17059) +++ trunk/libgaim/util.h 2006-08-27 21:13:30 UTC (rev 17060) @@ -37,6 +37,8 @@ extern "C" { #endif +typedef struct _GaimUtilFetchUrlData GaimUtilFetchUrlData; + typedef struct _GaimMenuAction { char *label; @@ -823,7 +825,22 @@ gboolean gaim_url_parse(const char *url, char **ret_host, int *ret_port, char **ret_path, char **ret_user, char **ret_passwd); -typedef void (*GaimURLFetchCallback) (gpointer data, const char *buf, gsize len); +/** + * This is the signature used for functions that act as the callback + * to gaim_util_fetch_url() or gaim_util_fetch_url_request(). + * + * @param url_data The same value that was returned when you called + * gaim_fetch_url() or gaim_fetch_url_request(). + * @param user_data The user data that your code passed into either + * gaim_util_fetch_url() or gaim_util_fetch_url_request(). + * @param url_text This will be NULL on error. Otherwise this + * will contain the contents of the URL. + * @param len 0 on error, otherwise this is the length of buf. + * @param error_message If something went wrong then this will contain + * a descriptive error message, and buf will be + * NULL and len will be 0. + */ +typedef void (*GaimUtilFetchUrlCallback)(GaimUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message); /** * Fetches the data from a URL, and passes it to a callback function. @@ -836,8 +853,8 @@ * @param cb The callback function. * @param data The user data to pass to the callback function. */ -#define gaim_url_fetch(url, full, user_agent, http11, cb, data) \ - gaim_url_fetch_request(url, full, user_agent, http11, NULL, \ +#define gaim_util_fetch_url(url, full, user_agent, http11, cb, data) \ + gaim_util_fetch_url_request(url, full, user_agent, http11, NULL, \ FALSE, cb, data); /** @@ -850,17 +867,25 @@ * @param http11 TRUE if HTTP/1.1 should be used to download the file. * @param request A HTTP request to send to the server instead of the * standard GET - * @param include_headers if TRUE, include the HTTP headers in the - * response - * @param cb The callback function. + * @param include_headers + * If TRUE, include the HTTP headers in the response. + * @param callback The callback function. * @param data The user data to pass to the callback function. */ -void gaim_url_fetch_request(const char *url, gboolean full, - const char *user_agent, gboolean http11, - const char *request, gboolean include_headers, - GaimURLFetchCallback cb, void *data); +GaimUtilFetchUrlData *gaim_util_fetch_url_request(const gchar *url, + gboolean full, const gchar *user_agent, gboolean http11, + const gchar *request, gboolean include_headers, + GaimUtilFetchUrlCallback callback, gpointer data); /** + * Cancel a pending URL request started with either + * gaim_util_fetch_url_request() or gaim_util_fetch_url(). + * + * @param url_data The data returned when you initiated the URL fetch. + */ +void gaim_util_fetch_url_cancel(GaimUtilFetchUrlData *url_data); + +/** * Decodes a URL into a plain string. * * This will change hex codes and such to their ascii equivalents. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rl...@us...> - 2006-08-27 19:47:50
|
Revision: 17059 Author: rlaager Date: 2006-08-27 12:47:41 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17059&view=rev Log Message: ----------- Fix SF Bug #1547486 Adding missing files to POTFILES.in: libgaim/dbus-server.c libgaim/dnsquery.c ... and lots of libgaim/protocols/qq/ files Modified Paths: -------------- trunk/po/POTFILES.in Modified: trunk/po/POTFILES.in =================================================================== --- trunk/po/POTFILES.in 2006-08-27 15:24:13 UTC (rev 17058) +++ trunk/po/POTFILES.in 2006-08-27 19:47:41 UTC (rev 17059) @@ -90,6 +90,8 @@ libgaim/connection.c libgaim/conversation.c libgaim/desktopitem.c +libgaim/dbus-server.c +libgaim/dnsquery.c libgaim/ft.c libgaim/log.c libgaim/plugin.c @@ -145,6 +147,25 @@ libgaim/protocols/oscar/odc.c libgaim/protocols/oscar/oscar.c libgaim/protocols/oscar/peer.c +libgaim/protocols/qq/buddy_info.c +libgaim/protocols/qq/buddy_list.c +libgaim/protocols/qq/buddy_opt.c +libgaim/protocols/qq/group.c +libgaim/protocols/qq/group_hash.c +libgaim/protocols/qq/group_im.c +libgaim/protocols/qq/group_join.c +libgaim/protocols/qq/group_network.c +libgaim/protocols/qq/group_opt.c +libgaim/protocols/qq/im.c +libgaim/protocols/qq/keep_alive.c +libgaim/protocols/qq/login_logout.c +libgaim/protocols/qq/qq.c +libgaim/protocols/qq/qq_proxy.c +libgaim/protocols/qq/recv_core.c +libgaim/protocols/qq/send_file.c +libgaim/protocols/qq/sendqueue.c +libgaim/protocols/qq/sys_msg.c +libgaim/protocols/qq/udp_proxy_s5.c libgaim/protocols/sametime/sametime.c libgaim/protocols/silc/buddy.c libgaim/protocols/silc/chat.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-27 15:24:20
|
Revision: 17058 Author: sadrul Date: 2006-08-27 08:24:13 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17058&view=rev Log Message: ----------- This should give a better accessiblity of xmlnodes over dbus. Modified Paths: -------------- trunk/libgaim/Makefile.am trunk/libgaim/dbus-analyze-functions.py trunk/libgaim/dbus-server.c Modified: trunk/libgaim/Makefile.am =================================================================== --- trunk/libgaim/Makefile.am 2006-08-27 11:45:02 UTC (rev 17057) +++ trunk/libgaim/Makefile.am 2006-08-27 15:24:13 UTC (rev 17058) @@ -175,7 +175,7 @@ dbus_sources = dbus-server.c dbus-useful.c dbus_headers = dbus-bindings.h dbus-gaim.h dbus-server.h dbus-useful.h dbus-define-api.h -dbus_exported = dbus-useful.h dbus-define-api.h account.h blist.h buddyicon.h connection.h conversation.h core.h log.h roomlist.h savedstatuses.h status.h server.h +dbus_exported = dbus-useful.h dbus-define-api.h account.h blist.h buddyicon.h connection.h conversation.h core.h log.h roomlist.h savedstatuses.h status.h server.h xmlnode.h gaim_build_coreheaders = $(addprefix $(srcdir)/, $(gaim_coreheaders)) dbus_build_exported = $(addprefix $(srcdir)/, $(dbus_exported)) Modified: trunk/libgaim/dbus-analyze-functions.py =================================================================== --- trunk/libgaim/dbus-analyze-functions.py 2006-08-27 11:45:02 UTC (rev 17057) +++ trunk/libgaim/dbus-analyze-functions.py 2006-08-27 15:24:13 UTC (rev 17058) @@ -117,7 +117,7 @@ return self.inputhash(type, name) # known object types are transformed to integer handles - elif type[0].startswith("Gaim"): + elif type[0].startswith("Gaim") or type[0] == "xmlnode": return self.inputgaimstructure(type, name) # unknown pointers are always replaced with NULL Modified: trunk/libgaim/dbus-server.c =================================================================== --- trunk/libgaim/dbus-server.c 2006-08-27 11:45:02 UTC (rev 17057) +++ trunk/libgaim/dbus-server.c 2006-08-27 15:24:13 UTC (rev 17058) @@ -39,6 +39,7 @@ #include "internal.h" #include "savedstatuses.h" #include "value.h" +#include "xmlnode.h" /**************************************************************************/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <may...@us...> - 2006-08-27 11:45:16
|
Revision: 17057 Author: mayuan2006 Date: 2006-08-27 04:45:02 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17057&view=rev Log Message: ----------- fix contact delete bug: when Send ADL,NS disconnect.<fix the add/delte XML format> committed by MaYuan<may...@gm...> Modified Paths: -------------- branches/soc-2006-msnp13/src/protocols/msn/README branches/soc-2006-msnp13/src/protocols/msn/contact.c branches/soc-2006-msnp13/src/protocols/msn/notification.c branches/soc-2006-msnp13/src/protocols/msn/userlist.c Modified: branches/soc-2006-msnp13/src/protocols/msn/README =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/README 2006-08-27 10:34:17 UTC (rev 17056) +++ branches/soc-2006-msnp13/src/protocols/msn/README 2006-08-27 11:45:02 UTC (rev 17057) @@ -30,8 +30,12 @@ * Windows Live ID authentication. * Offline Instant Message -Now can send and receive the Offline Instant Message. +Now can send and receive the Offline Instant Message to MSN user and Yahoo User. +*contact management +Can add/delete Contact +Can add/delete Group + * Communicate with Yahoo User Can send/receive Message/Nudge to Yahoo User. Modified: branches/soc-2006-msnp13/src/protocols/msn/contact.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-08-27 10:34:17 UTC (rev 17056) +++ branches/soc-2006-msnp13/src/protocols/msn/contact.c 2006-08-27 11:45:02 UTC (rev 17057) @@ -554,7 +554,7 @@ char *contact_xml = NULL ; MsnSoapReq *soap_request; - g_return_if_fail(contactId == NULL); + g_return_if_fail(contactId != NULL); gaim_debug_info("MaYuan","msn delete a contact,contactId:{%s}...\n",contactId); contact_xml = g_strdup_printf(MSN_CONTACTS_DEL_XML,contactId); body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE,contact_xml); Modified: branches/soc-2006-msnp13/src/protocols/msn/notification.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-08-27 10:34:17 UTC (rev 17056) +++ branches/soc-2006-msnp13/src/protocols/msn/notification.c 2006-08-27 11:45:02 UTC (rev 17057) @@ -1739,15 +1739,17 @@ adl_node = xmlnode_new("ml"); adl_node->child = NULL; - xmlnode_set_attrib(adl_node, "l", "1"); - msn_add_contact_xml(adl_node,who,3,1); + msn_add_contact_xml(adl_node,who,1,1); payload = xmlnode_to_str(adl_node,&payload_len); xmlnode_free(adl_node); - - msn_notification_post_adl(notification->servconn->cmdproc, + if(msn_user_is_yahoo(notification->session->account,who)){ + msn_notification_fqy_yahoo(notification->session, who); + }else{ + msn_notification_post_adl(notification->servconn->cmdproc, payload,payload_len); + } } void @@ -1764,9 +1766,8 @@ rml_node = xmlnode_new("ml"); rml_node->child = NULL; - xmlnode_set_attrib(rml_node, "l", "1"); - msn_add_contact_xml(rml_node,who,3,1); + msn_add_contact_xml(rml_node,who,1,1); payload = xmlnode_to_str(rml_node,&payload_len); xmlnode_free(rml_node); Modified: branches/soc-2006-msnp13/src/protocols/msn/userlist.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/userlist.c 2006-08-27 10:34:17 UTC (rev 17056) +++ branches/soc-2006-msnp13/src/protocols/msn/userlist.c 2006-08-27 11:45:02 UTC (rev 17057) @@ -610,6 +610,8 @@ user = msn_userlist_find_user(userlist, who); + g_return_if_fail(user != NULL); + /*delete the contact from address book via soap action*/ msn_delete_contact(userlist->session->contact,user->uid); @@ -636,7 +638,7 @@ /* Then request the rem to the server. */ list = lists[list_id]; -// msn_notification_rem_buddy(userlist->session->notification, list, who, group_id); + msn_notification_rem_buddy(userlist->session->notification, list, who, group_id); } /*add buddy*/ @@ -693,7 +695,7 @@ gaim_debug_info("MaYuan", "add user:{%s} to group id {%s}\n",store_name ,group_id); msn_add_contact(userlist->session->contact,who,group_id); -#if 0 +#if 1 msn_notification_add_buddy(userlist->session->notification, list, who, store_name, group_id); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <may...@us...> - 2006-08-27 10:34:28
|
Revision: 17056 Author: mayuan2006 Date: 2006-08-27 03:34:17 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17056&view=rev Log Message: ----------- fix the bug to send Yahoo User offline Message committed by MaYuan<may...@gm...> Modified Paths: -------------- branches/soc-2006-msnp13/src/protocols/msn/msn.c branches/soc-2006-msnp13/src/protocols/msn/user.c branches/soc-2006-msnp13/src/protocols/msn/user.h Modified: branches/soc-2006-msnp13/src/protocols/msn/msn.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/msn.c 2006-08-27 08:03:32 UTC (rev 17055) +++ branches/soc-2006-msnp13/src/protocols/msn/msn.c 2006-08-27 10:34:17 UTC (rev 17056) @@ -824,7 +824,8 @@ account = gaim_connection_get_account(gc); msn_import_html(message, &msgformat, &msgtext); - if(msn_user_is_online(account, who)){ + if(msn_user_is_online(account, who)|| + msn_user_is_yahoo(account, who)){ /*User online,then send Online Instant Message*/ if (strlen(msgtext) + strlen(msgformat) + strlen(VERSION) > 1564) @@ -849,8 +850,9 @@ MsnSwitchBoard *swboard; session = gc->proto_data; - if(strstr(who,"yahoo") != NULL){ - gaim_debug_info("MaYuan","send to Yahoo!\n"); + if(msn_user_is_yahoo(account,who)){ + /*we send the online and offline Message to Yahoo User via UBM*/ + gaim_debug_info("MaYuan","send to Yahoo User\n"); uum_send_msg(session,msg); }else{ gaim_debug_info("MaYuan","send via switchboard\n"); @@ -885,7 +887,7 @@ msn_message_destroy(msg); }else { - /*send Offline Instant Message*/ + /*send Offline Instant Message,only to MSN Passport User*/ MsnSession *session; MsnOim *oim; char *friendname; Modified: branches/soc-2006-msnp13/src/protocols/msn/user.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/user.c 2006-08-27 08:03:32 UTC (rev 17055) +++ branches/soc-2006-msnp13/src/protocols/msn/user.c 2006-08-27 10:34:17 UTC (rev 17056) @@ -315,6 +315,15 @@ return GAIM_BUDDY_IS_ONLINE(buddy); } +/*check to see if user is yahoo user? + * TODO: we need to identify it via contact parse + */ +gboolean +msn_user_is_yahoo(GaimAccount *account ,const char *name) +{ + return (strstr(name,"yahoo") != NULL); +} + void msn_user_remove_group_id(MsnUser *user, const char * id) { Modified: branches/soc-2006-msnp13/src/protocols/msn/user.h =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/user.h 2006-08-27 08:03:32 UTC (rev 17055) +++ branches/soc-2006-msnp13/src/protocols/msn/user.h 2006-08-27 10:34:17 UTC (rev 17056) @@ -301,6 +301,11 @@ gboolean msn_user_is_online(GaimAccount *account, const char *name); +/** + * check to see if user is Yahoo User + */ +gboolean +msn_user_is_yahoo(GaimAccount *account ,const char *name); /*@}*/ #endif /* _MSN_USER_H_ */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <may...@us...> - 2006-08-27 08:03:44
|
Revision: 17055 Author: mayuan2006 Date: 2006-08-27 01:03:32 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17055&view=rev Log Message: ----------- fix bug on group management committed by MaYuan<may...@gm...> Modified Paths: -------------- branches/soc-2006-msnp13/src/protocols/msn/dialog.c branches/soc-2006-msnp13/src/protocols/msn/session.c branches/soc-2006-msnp13/src/protocols/msn/user.c Modified: branches/soc-2006-msnp13/src/protocols/msn/dialog.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/dialog.c 2006-08-27 06:14:12 UTC (rev 17054) +++ branches/soc-2006-msnp13/src/protocols/msn/dialog.c 2006-08-27 08:03:32 UTC (rev 17055) @@ -114,10 +114,11 @@ if (group_name != NULL) group = gaim_find_group(group_name); - if (group != NULL) + if (group != NULL){ buddy = gaim_find_buddy_in_group(account, passport, group); - else + }else{ buddy = gaim_find_buddy(account, passport); + } if (buddy != NULL) gaim_blist_remove_buddy(buddy); Modified: branches/soc-2006-msnp13/src/protocols/msn/session.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/session.c 2006-08-27 06:14:12 UTC (rev 17054) +++ branches/soc-2006-msnp13/src/protocols/msn/session.c 2006-08-27 08:03:32 UTC (rev 17055) @@ -270,7 +270,8 @@ /* The core used to use msn_add_buddy to add all buddies before * being logged in. This no longer happens, so we manually iterate - * over the whole buddy list to identify sync issues. */ + * over the whole buddy list to identify sync issues. + */ for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next){ GaimGroup *group = (GaimGroup *)gnode; const char *group_name = group->name; @@ -299,13 +300,16 @@ const char *group_id; GList *l; + gaim_debug_info("MaYuan","remote user:{%s}\n",b->name); group_id = msn_userlist_find_group_id(remote_user->userlist, group_name); if(group_id == NULL){ continue; } + gaim_debug_info("MaYuan","group_id:{%s}\n",group_id); for (l = remote_user->group_ids; l != NULL; l = l->next){ + gaim_debug_info("MaYuan","l->data:{%s}\n",l->data); if (!g_strcasecmp(group_id ,l->data)){ found = TRUE; break; Modified: branches/soc-2006-msnp13/src/protocols/msn/user.c =================================================================== --- branches/soc-2006-msnp13/src/protocols/msn/user.c 2006-08-27 06:14:12 UTC (rev 17054) +++ branches/soc-2006-msnp13/src/protocols/msn/user.c 2006-08-27 08:03:32 UTC (rev 17055) @@ -60,8 +60,13 @@ if (user->clientcaps != NULL) g_hash_table_destroy(user->clientcaps); - if (user->group_ids != NULL) + if (user->group_ids != NULL){ + GList *l; + for (l = user->group_ids; l != NULL; l = l->next){ + g_free(l->data); + } g_list_free(user->group_ids); + } if (user->msnobj != NULL) msn_object_destroy(user->msnobj); @@ -265,20 +270,22 @@ GaimBuddy *b; GaimGroup *g; const char *passport; + const char *group_id; const char *group_name; g_return_if_fail(user != NULL); g_return_if_fail(id != NULL); - user->group_ids = g_list_append(user->group_ids,id); + group_id = g_strdup(id); + user->group_ids = g_list_append(user->group_ids,group_id); userlist = user->userlist; account = userlist->session->account; passport = msn_user_get_passport(user); - group_name = msn_userlist_find_group_name(userlist, id); + group_name = msn_userlist_find_group_name(userlist, group_id); - gaim_debug_info("User","group id:%s,name:%s,user:%s\n",id,group_name,passport); + gaim_debug_info("User","group id:%s,name:%s,user:%s\n",group_id,group_name,passport); g = gaim_find_group(group_name); @@ -315,6 +322,7 @@ g_return_if_fail(id != NULL); user->group_ids = g_list_remove(user->group_ids, id); + g_free(id); } void This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-27 06:14:48
|
Revision: 17054 Author: sadrul Date: 2006-08-26 23:14:12 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17054&view=rev Log Message: ----------- Allow adding chats in the buddylist. And fix a few bugs along the way. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/gntblist.h trunk/console/gntconv.c trunk/console/gntgaim.c trunk/console/gntrequest.c trunk/console/libgnt/gntentry.c trunk/console/libgnt/gnttree.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/gntblist.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -210,6 +210,72 @@ } static void +add_chat_cb(void *data, GaimRequestFields *allfields) +{ + GaimAccount *account; + const char *alias, *name, *group; + GaimChat *chat; + GaimGroup *grp; + GHashTable *hash = NULL; + GaimConnection *gc; + + account = gaim_request_fields_get_account(allfields, "account"); + name = gaim_request_fields_get_string(allfields, "name"); + alias = gaim_request_fields_get_string(allfields, "alias"); + group = gaim_request_fields_get_string(allfields, "group"); + + if (!gaim_account_is_connected(account) || !name || !*name) + return; + + if (!group || !*group) + group = _("Chats"); + + gc = gaim_account_get_connection(account); + + if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) + hash = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, name); + + chat = gaim_chat_new(account, name, hash); + + if (chat != NULL) { + if ((grp = gaim_find_group(group)) == NULL) { + grp = gaim_group_new(group); + gaim_blist_add_group(grp, NULL); + } + gaim_blist_add_chat(chat, grp, NULL); + } +} + +static void +gg_request_add_chat(GaimAccount *account, GaimGroup *grp, const char *alias, const char *name) +{ + GaimRequestFields *fields = gaim_request_fields_new(); + GaimRequestFieldGroup *group = gaim_request_field_group_new(NULL); + GaimRequestField *field; + + gaim_request_fields_add_group(fields, group); + + field = gaim_request_field_account_new("account", _("Account"), NULL); + gaim_request_field_account_set_show_all(field, FALSE); + if (account) + gaim_request_field_account_set_value(field, account); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_string_new("name", _("Name"), name, FALSE); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_string_new("alias", _("Alias"), alias, FALSE); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_string_new("group", _("Group"), grp->name, FALSE); + gaim_request_field_group_add_field(group, field); + + gaim_request_fields(NULL, _("Add Chat"), NULL, + _("You can edit more information from the context menu later."), + fields, _("Add"), G_CALLBACK(add_chat_cb), _("Cancel"), NULL, NULL); +} + +static void add_group_cb(gpointer null, const char *group) { GaimGroup *grp; @@ -252,7 +318,7 @@ NULL, NULL, .request_add_buddy = gg_request_add_buddy, - NULL, + .request_add_chat = gg_request_add_chat, .request_add_group = gg_request_add_group }; @@ -466,15 +532,77 @@ } static void +chat_components_edit_ok(GaimChat *chat, GaimRequestFields *allfields) +{ + GList *groups, *fields; + + for (groups = gaim_request_fields_get_groups(allfields); groups; groups = groups->next) { + fields = gaim_request_field_group_get_fields(groups->data); + for (; fields; fields = fields->next) { + GaimRequestField *field = fields->data; + const char *id; + char *val; + + id = gaim_request_field_get_id(field); + if (gaim_request_field_get_type(field) == GAIM_REQUEST_FIELD_INTEGER) + val = g_strdup_printf("%d", gaim_request_field_int_get_value(field)); + else + val = g_strdup(gaim_request_field_string_get_value(field)); + + g_hash_table_replace(chat->components, g_strdup(id), val); /* val should not be free'd */ + } + } +} + +static void +chat_components_edit(GaimChat *chat, GaimBlistNode *null) +{ + GaimRequestFields *fields = gaim_request_fields_new(); + GaimRequestFieldGroup *group = gaim_request_field_group_new(NULL); + GaimRequestField *field; + GList *parts, *iter; + struct proto_chat_entry *pce; + + gaim_request_fields_add_group(fields, group); + + parts = GAIM_PLUGIN_PROTOCOL_INFO(chat->account->gc->prpl)->chat_info(chat->account->gc); + + for (iter = parts; iter; iter = iter->next) { + pce = iter->data; + if (pce->is_int) { + int val; + const char *str = g_hash_table_lookup(chat->components, pce->identifier); + if (!str || sscanf(str, "%d", &val) != 1) + val = pce->min; + field = gaim_request_field_int_new(pce->identifier, pce->label, val); + } else { + field = gaim_request_field_string_new(pce->identifier, pce->label, + g_hash_table_lookup(chat->components, pce->identifier), FALSE); + } + + gaim_request_field_group_add_field(group, field); + g_free(pce); + } + + g_list_free(parts); + + gaim_request_fields(NULL, _("Edit Chat"), NULL, _("Please Update the necessary fields."), + fields, _("Edit"), G_CALLBACK(chat_components_edit_ok), _("Cancel"), NULL, chat); +} + +static void create_chat_menu(GntTree *tree, GaimChat *chat) { GaimMenuAction *action = gaim_menu_action_new(_("Auto-join"), NULL, chat, NULL); gnt_tree_add_choice(tree, action, gnt_tree_create_row(tree, action->label), NULL, NULL); gnt_tree_set_choice(tree, action, gaim_blist_node_get_bool((GaimBlistNode*)chat, "gnt-autojoin")); - + g_signal_connect_swapped(G_OBJECT(tree), "destroy", G_CALLBACK(gaim_menu_action_free), action); + + add_custom_action(tree, _("Edit Settings"), (GaimCallback)chat_components_edit, chat); + g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(context_menu_toggle), NULL); } @@ -491,10 +619,18 @@ } static void +gg_add_chat(GaimGroup *grp, GaimBlistNode *node) +{ + gaim_blist_request_add_chat(NULL, grp, NULL, NULL); +} + +static void create_group_menu(GntTree *tree, GaimGroup *group) { add_custom_action(tree, _("Add Buddy"), GAIM_CALLBACK(gg_add_buddy), group); + add_custom_action(tree, _("Add Chat"), + GAIM_CALLBACK(gg_add_chat), group); add_custom_action(tree, _("Add Group"), GAIM_CALLBACK(gg_add_group), group); } @@ -1005,7 +1141,8 @@ node = gaim_blist_node_next(node, TRUE); } - remove_typing_cb(NULL); + if (ggblist->typing) + g_source_remove(ggblist->typing); remove_peripherals(ggblist); g_free(ggblist); ggblist = NULL; @@ -1359,9 +1496,12 @@ ggblist = NULL; } -void gg_blist_get_position(int *x, int *y) +gboolean gg_blist_get_position(int *x, int *y) { + if (!ggblist || !ggblist->window) + return FALSE; gnt_widget_get_position(ggblist->window, x, y); + return TRUE; } void gg_blist_set_position(int x, int y) @@ -1369,9 +1509,12 @@ gnt_widget_set_position(ggblist->window, x, y); } -void gg_blist_get_size(int *width, int *height) +gboolean gg_blist_get_size(int *width, int *height) { + if (!ggblist || !ggblist->window) + return FALSE; gnt_widget_get_size(ggblist->window, width, height); + return TRUE; } void gg_blist_set_size(int width, int height) Modified: trunk/console/gntblist.h =================================================================== --- trunk/console/gntblist.h 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/gntblist.h 2006-08-27 06:14:12 UTC (rev 17054) @@ -11,11 +11,11 @@ void gg_blist_show(void); -void gg_blist_get_position(int *x, int *y); +gboolean gg_blist_get_position(int *x, int *y); void gg_blist_set_position(int x, int y); -void gg_blist_get_size(int *width, int *height); +gboolean gg_blist_get_size(int *width, int *height); void gg_blist_set_size(int width, int height); Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/gntconv.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -191,7 +191,7 @@ gnt_box_set_title(GNT_BOX(ggc->window), title); gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE); gnt_box_set_pad(GNT_BOX(ggc->window), 0); - gnt_widget_set_name(ggc->window, title); + gnt_widget_set_name(ggc->window, "conversation-window"); ggc->tv = gnt_text_view_new(); gnt_box_add_widget(GNT_BOX(ggc->window), ggc->tv); Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/gntgaim.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -224,7 +224,7 @@ } /* show version message */ if (opt_version) { - printf("Gaim %s\n", VERSION); + printf("gntgaim %s\n", VERSION); return 0; } Modified: trunk/console/gntrequest.c =================================================================== --- trunk/console/gntrequest.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/gntrequest.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -361,8 +361,12 @@ } else if (type == GAIM_REQUEST_FIELD_INTEGER) { - GntWidget *entry = gnt_entry_new( - gaim_request_field_string_get_default_value(field)); + char str[256]; + int val = gaim_request_field_int_get_default_value(field); + GntWidget *entry; + + snprintf(str, sizeof(str), "%d", val); + entry = gnt_entry_new(str); gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); gnt_box_add_widget(GNT_BOX(hbox), entry); field->ui_data = entry; Modified: trunk/console/libgnt/gntentry.c =================================================================== --- trunk/console/libgnt/gntentry.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/libgnt/gntentry.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -349,7 +349,7 @@ { const char *str, *next; - for (str = text; *str;) + for (str = text; *str; str = next) { int len; next = g_utf8_find_next_char(str, NULL); Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/libgnt/gnttree.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -633,10 +633,14 @@ tree->current = row; redraw_tree(tree); tree_selection_changed(tree, old, tree->current); - } else if (row == tree->current && row->choice) { - row->isselected = !row->isselected; - g_signal_emit(tree, signals[SIG_TOGGLED], 0, row->key); - redraw_tree(tree); + } else if (row && row == tree->current) { + if (row->choice) { + row->isselected = !row->isselected; + g_signal_emit(tree, signals[SIG_TOGGLED], 0, row->key); + redraw_tree(tree); + } else { + gnt_widget_activate(widget); + } } } else { return FALSE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <g-...@us...> - 2006-08-27 02:44:58
|
Revision: 17053 Author: g-off_ Date: 2006-08-26 19:44:52 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17053&view=rev Log Message: ----------- * Fixed stupid plugin loading decision that prevented user from being able to change the dbi drivers path in preferences if it was wrong. * Prefs UI improved greatly. Modified Paths: -------------- trunk/gtk/plugins/cap/README trunk/gtk/plugins/cap/cap.c trunk/gtk/plugins/cap/cap.h Modified: trunk/gtk/plugins/cap/README =================================================================== --- trunk/gtk/plugins/cap/README 2006-08-26 20:24:04 UTC (rev 17052) +++ trunk/gtk/plugins/cap/README 2006-08-27 02:44:52 UTC (rev 17053) @@ -21,7 +21,5 @@ * Threshold This is how many minutes before and after the current time should be looked at when computing a buddies response probability. The larger the value the more data that is available but the larger the timeframe it will encompass and thus the less accurate the prediction will be. As data collection increases this value can be reduced for more fine tuned statistics. - -Note: I realize the preferences UI sucks and needs to be straightened up. Bugs and Feedback are appreciated and may be sent to g-off_ at users.sourceforge.net. Modified: trunk/gtk/plugins/cap/cap.c =================================================================== --- trunk/gtk/plugins/cap/cap.c 2006-08-26 20:24:04 UTC (rev 17052) +++ trunk/gtk/plugins/cap/cap.c 2006-08-27 02:44:52 UTC (rev 17053) @@ -79,12 +79,10 @@ if(!dbi_result_field_is_null(result, "failed_count")) failures += dbi_result_get_int(result, "failed_count"); } - gaim_debug_info("cap", "Successes = %d; Failures = %d\n", successes, failures); if(failures + successes > 0) { prediction *= ((double)successes/((double)(successes + failures))); generated = TRUE; } - gaim_debug_info("cap", "After message value prediction is %0.4f.\n", prediction); dbi_result_free(result); } @@ -126,12 +124,10 @@ if(!dbi_result_field_is_null(result, "failed_count")) failures = dbi_result_get_int(result, "failed_count"); - gaim_debug_info("cap", "Successes = %d; Failures = %d\n", successes, failures); if(successes + failures > 0) { prediction *= ((double)successes/(double)(successes + failures)); generated = TRUE; } - gaim_debug_info("cap", "After status value prediction is %0.4f.\n", prediction); dbi_result_free(result); } @@ -142,7 +138,6 @@ if(strcmp(gaim_status_get_id(get_status_for(buddy)), "offline") == 0) { //This is kind of stupid, change it. - gaim_debug_info("cap", "Buddy is offline.\n"); if(prediction == 1.0f) prediction = 0.0f; } @@ -161,7 +156,6 @@ stats = g_hash_table_lookup(_buddy_stats, buddy_name); if(!stats) { dbi_result result; - gaim_debug_info("cap", "Creating stats for %s\n", buddy->name); stats = g_malloc(sizeof(CapStatistics)); stats->last_message = -1; stats->last_message_status_id = NULL; @@ -432,9 +426,7 @@ dbi_result result; result = dbi_conn_queryf(_conn, "insert into cap_my_usage values(%s, %s, %d, now());", account_id, protocol_id, 1); - if(!result) - gaim_debug_error("cap", "Could not insert sign on into cap_my_usage\n"); - else + if(result) dbi_result_free(result); if(last_offline) { @@ -461,9 +453,7 @@ dbi_result result; result = dbi_conn_queryf(_conn, "insert into cap_my_usage values(%s, %s, %d, now());", account_id, protocol_id, 0); - if(!result) - gaim_debug_error("cap", "Could not insert sign off into cap_my_usage\n"); - else + if(result) dbi_result_free(result); time(offline_time); @@ -508,16 +498,15 @@ static gboolean create_database_connection() { int rc; int driver_type; + + if(_conn) + return TRUE; + //make database connection here - /* - * conn = dbi_conn_new("mysql"); - * dbi_conn_set_option(conn, "host", "localhost"); - * dbi_conn_set_option(conn, "username", "root"); - * dbi_conn_set_option(conn, "password", "b1qywm96"); - * dbi_conn_set_option(conn, "dbname", "mysql"); - * dbi_conn_set_option(conn, "encoding", "auto"); - */ _conn = dbi_conn_new(gaim_prefs_get_string("/plugins/gtk/cap/db_driver")); + if(!_conn) + return FALSE; + _driver = dbi_conn_get_driver(_conn); gaim_debug_info("cap", "Using driver: %s\n", gaim_prefs_get_string("/plugins/gtk/cap/db_driver")); if(strcmp(gaim_prefs_get_string("/plugins/gtk/cap/db_driver"), "mysql") == 0) { @@ -536,6 +525,7 @@ gaim_debug_error("cap", "CAP could not create database connection. %d\n", rc); //set_error_msg(_("Could not create database connection. Reason: ")); //append_error_msg(err_msg); + _conn = NULL; return FALSE; } else { //Add tables here @@ -544,7 +534,13 @@ gaim_debug_info("cap", "Database connection successfully made.\n"); return TRUE; } +static void destroy_database_connection() { + if(_conn) + dbi_conn_close(_conn); + _conn = NULL; +} + static guint word_count(const gchar *string) { //TODO: doesn't really work, should use regex instead (#include <regex.h>) gchar **result = g_strsplit_set(string, " ", -1); @@ -598,11 +594,22 @@ static void insert_status_change_from_gaim_status(CapStatistics *statistics, GaimStatus *status) { dbi_result result; - gchar *status_id = quote_string(gaim_status_get_id(status)); - gchar *buddy_name = quote_string(statistics->buddy->name); - gchar *protocol_id = quote_string(gaim_account_get_protocol_id(statistics->buddy->account)); - gchar *account_id = quote_string(gaim_account_get_username(statistics->buddy->account)); + gchar *status_id; + gchar *buddy_name; + gchar *protocol_id; + gchar *account_id; + /* It would seem that some protocols receive periodic updates of the buddies status. + * Check to make sure the last status is not the same as current status to prevent + * to many duplicated useless database entries. */ + if(strcmp(statistics->last_status_id, gaim_status_get_id(status)) == 0) + return; + + status_id = quote_string(gaim_status_get_id(status)); + buddy_name = quote_string(statistics->buddy->name); + protocol_id = quote_string(gaim_account_get_protocol_id(statistics->buddy->account)); + account_id = quote_string(gaim_account_get_username(statistics->buddy->account)); + statistics->last_status_id = gaim_status_get_id(status); gaim_debug_info("cap", "Executing: insert into cap_status (buddy, account, protocol, status, event_time) values(%s, %s, %s, %s, now());\n", buddy_name, account_id, protocol_id, status_id); @@ -639,62 +646,46 @@ /* Gaim plugin specific code */ static gboolean plugin_load(GaimPlugin *plugin) { - dbi_driver driver = dbi_driver_list(NULL); - gboolean drivers_available = FALSE; - int rc = dbi_initialize(gaim_prefs_get_string("/plugins/gtk/cap/libdbi_drivers")); - - if(rc == -1) { - gaim_debug_error("cap", "Error initializing dbi.\n"); - set_error_msg(_("Error initializing libdbi.")); - return FALSE; - } - _plugin_pointer = plugin; _signals_connected = FALSE; - while(driver != NULL) { - gaim_debug_info("cap", "Located driver: %s\n", dbi_driver_get_name(driver)); - if(strcmp("mysql", dbi_driver_get_name(driver)) == 0) - drivers_available = TRUE; + /* buddy_stats is a hashtable where strings are keys + * and the keys are a buddies account id (GaimBuddy.name). + * keys/values are automatically deleted */ + _buddy_stats = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, destroy_stats); - driver = dbi_driver_list(driver); + /* ? - Can't remember at the moment + */ + _my_offline_times = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + + if(gaim_prefs_exists("/plugins/gtk/cap/libdbi_drivers")) + _num_drivers = dbi_initialize(gaim_prefs_get_string("/plugins/gtk/cap/libdbi_drivers")); + else + _num_drivers = dbi_initialize(NULL); + + if(_num_drivers == -1) { + gaim_debug_error("cap", "Error initializing dbi.\n"); + gaim_prefs_set_bool("/plugins/gtk/cap/configured", FALSE); + _dbi_initialized = FALSE; + } else { + _dbi_initialized = TRUE; } - if(!drivers_available) - return FALSE; - if(gaim_prefs_get_bool("/plugins/gtk/cap/configured")) { - if(!add_plugin_functionality(plugin)) { - return FALSE; + if(gaim_prefs_get_bool("/plugins/gtk/cap/configured") && gaim_prefs_get_bool("/plugins/gtk/cap/connected")) { + if(create_database_connection()) { + add_plugin_functionality(plugin); } } return TRUE; } -static gboolean add_plugin_functionality(GaimPlugin *plugin) { +static void add_plugin_functionality(GaimPlugin *plugin) { if(_signals_connected) - return TRUE; + return; + + gaim_debug_info("cap", "Adding plugin functionality.\n"); - if(!create_database_connection()) { - /* - GtkWidget *dialog = gtk_message_dialog_new("title", - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - get_error_msg()); - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - */ - return FALSE; - } - - /* buddy_stats is a hashtable where strings are keys - * and the keys are a buddies account id (GaimBuddy.name). - * keys/values are automatically deleted */ - _buddy_stats = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, destroy_stats); - - _my_offline_times = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - /* Connect all the signals */ gaim_signal_connect(gaim_conversations_get_handle(), "sent-im-msg", plugin, GAIM_CALLBACK(sent_im_msg), NULL); @@ -727,13 +718,61 @@ GAIM_CALLBACK(buddy_idle), NULL); _signals_connected = TRUE; +} - return TRUE; +static void cancel_conversation_timeouts(gpointer key, gpointer value, gpointer user_data) { + CapStatistics *stats = value; + if(stats->timeout_source_id != 0) { + g_source_remove(stats->timeout_source_id); + stats->timeout_source_id = 0; + } } +static void remove_plugin_functionality(GaimPlugin *plugin) { + if(!_signals_connected) + return; + + gaim_debug_info("cap", "Removing plugin functionality.\n"); + + /* If there are any timeouts waiting to be processed then cancel them */ + g_hash_table_foreach(_buddy_stats, cancel_conversation_timeouts, NULL); + + /* Connect all the signals */ + gaim_signal_disconnect(gaim_conversations_get_handle(), "sent-im-msg", plugin, + GAIM_CALLBACK(sent_im_msg)); + + gaim_signal_disconnect(gaim_conversations_get_handle(), "received-im-msg", plugin, + GAIM_CALLBACK(received_im_msg)); + + gaim_signal_disconnect(gaim_blist_get_handle(), "buddy-status-changed", plugin, + GAIM_CALLBACK(buddy_status_changed)); + + gaim_signal_disconnect(gaim_blist_get_handle(), "buddy-signed-on", plugin, + GAIM_CALLBACK(buddy_signed_on)); + + gaim_signal_disconnect(gaim_blist_get_handle(), "buddy-signed-off", plugin, + GAIM_CALLBACK(buddy_signed_off)); + + //gaim_signal_disconnect(gaim_blist_get_handle(), "blist-node-extended-menu", plugin, + // GAIM_CALLBACK(blist_node_extended_menu)); + + gaim_signal_disconnect(gaim_gtk_blist_get_handle(), "drawing-tooltip", plugin, + GAIM_CALLBACK(drawing_tooltip)); + + gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on", plugin, + GAIM_CALLBACK(signed_on)); + + gaim_signal_disconnect(gaim_connections_get_handle(), "signed-off", plugin, + GAIM_CALLBACK(signed_off)); + + gaim_signal_disconnect(gaim_blist_get_handle(), "buddy-idle-changed", plugin, + GAIM_CALLBACK(buddy_idle)); + + _signals_connected = FALSE; +} + static void write_stats_on_unload(gpointer key, gpointer value, gpointer user_data) { CapStatistics *stats = value; - gaim_debug_info("cap", "Unloading, last message time %d\n", stats->last_message); if(stats->last_message != -1 && stats->buddy != NULL) { insert_cap_failure(stats); } @@ -741,194 +780,320 @@ static gboolean plugin_unload(GaimPlugin *plugin) { gaim_debug_info("cap", "CAP plugin unloading\n"); - //TODO: foreach stats object in hashtable: - // if stats->last_message != -1 then update for that time the failed counter...maybe? - g_hash_table_foreach(_buddy_stats, write_stats_on_unload, NULL); + //clean up memory allocations - if(_buddy_stats) + if(_buddy_stats) { + g_hash_table_foreach(_buddy_stats, write_stats_on_unload, NULL); g_hash_table_destroy(_buddy_stats); - /*while(g_list_length(plugin_actions) > 0) { - GaimPluginAction *action = g_list_first(plugin_actions)->data; - gaim_plugin_action_free(action); - } - _plugin_pointer = NULL;*/ + } //close database connection dbi_conn_close(_conn); + _conn = NULL; dbi_shutdown(); return TRUE; } static GtkWidget * get_config_frame(GaimPlugin *plugin) { - GtkWidget *ret; - GtkWidget *vbox; + CapPrefsUI *ui = create_cap_prefs_ui(); - GtkWidget *driver_vbox; - GtkWidget *driver_select_hbox; - GtkWidget *driver_choice; - GtkWidget *driver_label; - GtkWidget *driver_config_hbox; - GtkWidget *driver_config; + /* Since we are editing the database setup we will disable the plugin. + * This will prevent database updates from occuring while there is potentially + * no connection to the database. + */ + remove_plugin_functionality(_plugin_pointer); - GtkWidget *threshold_label; - GtkWidget *threshold_input; - GtkWidget *threshold_hbox; - GtkWidget *threshold_minutes_label; + return ui->ret; +} - GtkWidget *msg_difference_label; - GtkWidget *msg_difference_input; - GtkWidget *msg_difference_hbox; - GtkWidget *msg_difference_minutes_label; +static void cap_prefs_ui_destroy_cb(GtkObject *object, gpointer user_data) { + CapPrefsUI *ui = user_data; + if(_conn) { + add_plugin_functionality(_plugin_pointer); + } + g_free(ui); +} - GtkWidget *last_seen_label; - GtkWidget *last_seen_input; - GtkWidget *last_seen_hbox; - GtkWidget *last_seen_minutes_label; +static CapPrefsUI * create_cap_prefs_ui() { + CapPrefsUI *ui = g_malloc(sizeof(CapPrefsUI)); - GtkWidget *dbd_label; - GtkWidget *dbd_input; - GtkWidget *dbd_hbox; + ui->ret = gtk_vbox_new(FALSE, 18); + gtk_container_set_border_width(GTK_CONTAINER(ui->ret), 10); + ui->db_vbox = gaim_gtk_make_frame(ui->ret, _("Database Configuration")); + ui->cap_vbox = gaim_gtk_make_frame(ui->ret, _("Statistics Configuration")); + + /* dbd path input folder selector button */ + ui->dbd_label = gtk_label_new(_("libdbi driver path:")); + gtk_misc_set_alignment(GTK_MISC(ui->dbd_label), 0, 0.5); + ui->dbd_input = gtk_file_chooser_button_new(_("libdbi Drivers Path"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); + ui->dbd_button = gtk_button_new_with_label(_("Verify")); + ui->dbd_hbox = gtk_hbox_new(FALSE, 18); + gtk_box_pack_start(GTK_BOX(ui->dbd_hbox), ui->dbd_label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ui->dbd_hbox), ui->dbd_input, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ui->dbd_hbox), ui->dbd_button, FALSE, FALSE, 0); + + /* Setup the driver selection widget */ + ui->driver_choice = gtk_combo_box_new_text(); - ret = gtk_vbox_new(FALSE, 18); - g_signal_connect(G_OBJECT(ret), "destroy", - G_CALLBACK(prefs_closed_cb), "/plugins/gtk/cap/configured"); - gtk_container_set_border_width(GTK_CONTAINER(ret), 10); - vbox = gaim_gtk_make_frame(ret, _("Contact Availability Prediction Configuration")); + ui->driver_vbox = gtk_vbox_new(FALSE, 18); + ui->driver_label = gtk_label_new(_("Driver:")); + gtk_misc_set_alignment(GTK_MISC(ui->driver_label), 0, 0.5); + ui->driver_select_hbox = gtk_hbox_new(FALSE, 18); + ui->driver_connect_button = gtk_toggle_button_new_with_label(_("Connected")); - driver_vbox = gtk_vbox_new(FALSE, 18); - //Driver selection and configuration - driver_choice = gtk_combo_box_new_text(); - g_signal_connect(G_OBJECT(driver_choice), "changed", - G_CALLBACK(combobox_prefs_cb), "/plugins/gtk/cap/db_driver"); - gtk_combo_box_append_text(GTK_COMBO_BOX(driver_choice), _("mysql")); - gtk_combo_box_set_active(GTK_COMBO_BOX(driver_choice), 0); - //gtk_combo_box_append_text(GTK_COMBO_BOX(driver_choice), _("pgsql")); - //gtk_combo_box_append_text(GTK_COMBO_BOX(driver_choice), _("sqlite")); - driver_label = gtk_label_new(_("Driver:")); - driver_select_hbox = gtk_hbox_new(FALSE, 18); - if(gaim_prefs_exists("/plugins/gtk/cap/db_driver")) { - const char *driver_string = gaim_prefs_get_string("/plugins/gtk/cap/db_driver"); - if(g_ascii_strcasecmp(driver_string, "mysql") == 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(driver_choice), 0); - } - } - gtk_box_pack_start(GTK_BOX(driver_select_hbox), driver_label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(driver_select_hbox), driver_choice, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ui->driver_select_hbox), ui->driver_label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ui->driver_select_hbox), ui->driver_choice, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ui->driver_select_hbox), ui->driver_connect_button, FALSE, FALSE, 0); - driver_config = gtk_expander_new_with_mnemonic(_("_Configure")); - g_signal_connect(driver_config, "notify::expanded", - G_CALLBACK(driver_config_expanded), gtk_combo_box_get_active_text(GTK_COMBO_BOX(driver_choice))); - driver_config_hbox = gtk_hbox_new(FALSE, 18); - gtk_box_pack_start(GTK_BOX(driver_config_hbox), driver_config, FALSE, FALSE, 0); + ui->driver_config = gtk_expander_new_with_mnemonic(_("Configure")); + ui->driver_config_hbox = gtk_hbox_new(FALSE, 18); + gtk_box_pack_start(GTK_BOX(ui->driver_config_hbox), ui->driver_config, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(driver_vbox), driver_select_hbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(driver_vbox), driver_config_hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ui->driver_vbox), ui->driver_select_hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ui->driver_vbox), ui->driver_config_hbox, FALSE, FALSE, 0); - //msg_difference - msg_difference_label = gtk_label_new(_("Maximum response timeout:")); - //FIXME: better maximum value - msg_difference_input = gtk_spin_button_new_with_range(1, 1440, 1); - msg_difference_hbox = gtk_hbox_new(FALSE, 18); - msg_difference_minutes_label = gtk_label_new(_("minutes")); + /* msg_difference spinner */ + ui->msg_difference_label = gtk_label_new(_("Maximum response timeout:")); + gtk_misc_set_alignment(GTK_MISC(ui->msg_difference_label), 0, 0.5); + ui->msg_difference_input = gtk_spin_button_new_with_range(1, 1440, 1); + ui->msg_difference_minutes_label = gtk_label_new(_("minutes")); + gtk_misc_set_alignment(GTK_MISC(ui->msg_difference_minutes_label), 0, 0.5); + + /* last_seen spinner */ + ui->last_seen_label = gtk_label_new(_("Maximum last-seen difference:")); + gtk_misc_set_alignment(GTK_MISC(ui->last_seen_label), 0, 0.5); + ui->last_seen_input = gtk_spin_button_new_with_range(1, 1440, 1); + ui->last_seen_minutes_label = gtk_label_new(_("minutes")); + gtk_misc_set_alignment(GTK_MISC(ui->last_seen_minutes_label), 0, 0.5); + + /* threshold spinner */ + ui->threshold_label = gtk_label_new(_("Threshold:")); + gtk_misc_set_alignment(GTK_MISC(ui->threshold_label), 0, 0.5); + ui->threshold_input = gtk_spin_button_new_with_range(1, 1440, 1); + ui->threshold_minutes_label = gtk_label_new(_("minutes")); + gtk_misc_set_alignment(GTK_MISC(ui->threshold_minutes_label), 0, 0.5); + + /* Layout threshold/last-seen/response-timeout input items */ + ui->table_layout = gtk_table_new(3, 3, FALSE); + gtk_table_attach(GTK_TABLE(ui->table_layout), ui->threshold_label, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + gtk_table_attach(GTK_TABLE(ui->table_layout), ui->threshold_input, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + gtk_table_attach(GTK_TABLE(ui->table_layout), ui->threshold_minutes_label, 2, 3, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + gtk_table_attach(GTK_TABLE(ui->table_layout), ui->msg_difference_label, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + gtk_table_attach(GTK_TABLE(ui->table_layout), ui->msg_difference_input, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + gtk_table_attach(GTK_TABLE(ui->table_layout), ui->msg_difference_minutes_label, 2, 3, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + gtk_table_attach(GTK_TABLE(ui->table_layout), ui->last_seen_label, 0, 1, 2,3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + gtk_table_attach(GTK_TABLE(ui->table_layout), ui->last_seen_input, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + gtk_table_attach(GTK_TABLE(ui->table_layout), ui->last_seen_minutes_label, 2, 3, 2, 3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + + /* Config window - lay it out */ + gtk_box_pack_start(GTK_BOX(ui->db_vbox), ui->dbd_hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ui->db_vbox), ui->driver_vbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(ui->cap_vbox), ui->table_layout, FALSE, FALSE, 0); + + /* Set the input areas to contain the configuration values from + * gaim prefs. + */ + if(gaim_prefs_exists("/plugins/gtk/cap/libdbi_drivers")) { + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(ui->dbd_input), gaim_prefs_get_string("/plugins/gtk/cap/libdbi_drivers")); + } if(gaim_prefs_exists("/plugins/gtk/cap/max_msg_difference")) { int max_msg_diff = gaim_prefs_get_int("/plugins/gtk/cap/max_msg_difference"); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(msg_difference_input), max_msg_diff); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(ui->msg_difference_input), max_msg_diff); } - g_signal_connect(G_OBJECT(msg_difference_input), "value-changed", - G_CALLBACK(numeric_spinner_prefs_cb), "/plugins/gtk/cap/max_msg_difference"); - gtk_box_pack_start(GTK_BOX(msg_difference_hbox), msg_difference_label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(msg_difference_hbox), msg_difference_input, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(msg_difference_hbox), msg_difference_minutes_label, FALSE, FALSE, 0); - - //last_seen - last_seen_label = gtk_label_new(_("Maximum last-seen difference:")); - last_seen_input = gtk_spin_button_new_with_range(1, 1440, 1); - last_seen_hbox = gtk_hbox_new(FALSE, 18); - last_seen_minutes_label = gtk_label_new(_("minutes")); if(gaim_prefs_exists("/plugins/gtk/cap/max_seen_difference")) { int max_seen_diff = gaim_prefs_get_int("/plugins/gtk/cap/max_seen_difference"); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(last_seen_input), max_seen_diff); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(ui->last_seen_input), max_seen_diff); } - g_signal_connect(G_OBJECT(last_seen_input), "value-changed", - G_CALLBACK(numeric_spinner_prefs_cb), "/plugins/gtk/cap/max_seen_difference"); - gtk_box_pack_start(GTK_BOX(last_seen_hbox), last_seen_label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(last_seen_hbox), last_seen_input, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(last_seen_hbox), last_seen_minutes_label, FALSE, FALSE, 0); - - //threshold - threshold_label = gtk_label_new(_("Threshold:")); - threshold_input = gtk_spin_button_new_with_range(1, 1440, 1); - threshold_hbox = gtk_hbox_new(FALSE, 18); - threshold_minutes_label = gtk_label_new(_("minutes")); if(gaim_prefs_exists("/plugins/gtk/cap/threshold")) { int threshold = gaim_prefs_get_int("/plugins/gtk/cap/threshold"); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(threshold_input), threshold); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(ui->threshold_input), threshold); } - g_signal_connect(G_OBJECT(threshold_input), "value-changed", + + /* Add the signals */ + g_signal_connect(G_OBJECT(ui->ret), "destroy", + G_CALLBACK(cap_prefs_ui_destroy_cb), ui); + + g_signal_connect(G_OBJECT(ui->driver_choice), "changed", + G_CALLBACK(driver_choice_changed_cb), ui); + + g_signal_connect(G_OBJECT(ui->driver_config), "notify::expanded", + G_CALLBACK(driver_config_expanded_cb), ui); + + g_signal_connect(G_OBJECT(ui->driver_connect_button), "toggled", + G_CALLBACK(connect_toggled_cb), ui); + + g_signal_connect(G_OBJECT(ui->msg_difference_input), "value-changed", + G_CALLBACK(numeric_spinner_prefs_cb), "/plugins/gtk/cap/max_msg_difference"); + + g_signal_connect(G_OBJECT(ui->last_seen_input), "value-changed", + G_CALLBACK(numeric_spinner_prefs_cb), "/plugins/gtk/cap/max_seen_difference"); + + g_signal_connect(G_OBJECT(ui->threshold_input), "value-changed", G_CALLBACK(numeric_spinner_prefs_cb), "/plugins/gtk/cap/threshold"); - gtk_box_pack_start(GTK_BOX(threshold_hbox), threshold_label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(threshold_hbox), threshold_input, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(threshold_hbox), threshold_minutes_label, FALSE, FALSE, 0); + + g_signal_connect(G_OBJECT(ui->dbd_button), "clicked", + G_CALLBACK(driver_location_verify_cb), ui); + + /* libdbi was not successfully initialized so disable the driver selection. + * Also disable the configuration for the database. + */ + if(!_dbi_initialized || _num_drivers <= 0) { + /* Since DBI is not available disable database configuration */ + gtk_widget_set_sensitive(ui->driver_choice, FALSE); + gtk_widget_set_sensitive(ui->driver_config, FALSE); + gtk_widget_set_sensitive(ui->driver_connect_button, FALSE); + } else { + set_driver_choice_options(GTK_COMBO_BOX(ui->driver_choice)); + } + + if(_conn) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ui->driver_connect_button), TRUE); + gtk_widget_set_sensitive(ui->driver_choice, FALSE); + gtk_widget_set_sensitive(ui->driver_config, FALSE); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ui->driver_connect_button), FALSE); + } - //dbd path input - dbd_label = gtk_label_new(_("libdbi driver path:")); - dbd_input = gtk_entry_new(); - if(gaim_prefs_exists("/plugins/gtk/cap/libdbi_drivers")) { - gtk_entry_set_text(GTK_ENTRY(dbd_input), gaim_prefs_get_string("/plugins/gtk/cap/libdbi_drivers")); + return ui; +} + +static void driver_choice_changed_cb(GtkComboBox *widget, gpointer user_data) { + CapPrefsUI *ui = user_data; + if(strcmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(ui->driver_choice)), "mysql") == 0) { + gtk_widget_set_sensitive(ui->driver_config, TRUE); + gtk_widget_set_sensitive(ui->driver_connect_button, TRUE); + } else { + gtk_widget_set_sensitive(ui->driver_config, FALSE); + gtk_widget_set_sensitive(ui->driver_connect_button, FALSE); } - dbd_hbox = gtk_hbox_new(FALSE, 18); - g_signal_connect(G_OBJECT(dbd_input), "focus-out-event", - G_CALLBACK(text_entry_prefs_cb), "/plugins/gtk/cap/libdbi_drivers"); - gtk_box_pack_start(GTK_BOX(dbd_hbox), dbd_label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(dbd_hbox), dbd_input, FALSE, FALSE, 0); +} - //Config window - gtk_box_pack_start(GTK_BOX(vbox), driver_vbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), msg_difference_hbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), last_seen_hbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), threshold_hbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), dbd_hbox, FALSE, FALSE, 0); +static void driver_config_expanded_cb(GObject *object, GParamSpec *param_spec, gpointer user_data) { + CapPrefsUI *ui = user_data; + GtkExpander *expander; + gchar *driver = gtk_combo_box_get_active_text(GTK_COMBO_BOX(ui->driver_choice)); + expander = GTK_EXPANDER(object); + if(gtk_expander_get_expanded(expander)) { + if(strcmp(driver, "mysql") == 0) { + gtk_container_add(GTK_CONTAINER(expander), get_mysql_config()); + } + } else { + gtk_container_remove(GTK_CONTAINER(expander), gtk_bin_get_child(GTK_BIN(expander))); + } +} - return ret; +static void connect_toggled_cb(GtkToggleButton *togglebutton, gpointer user_data) { + CapPrefsUI *ui = user_data; + if(gtk_toggle_button_get_active(togglebutton)) { + //connect + if(create_database_connection()) { + gtk_widget_set_sensitive(GTK_WIDGET(ui->driver_choice), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(ui->driver_config), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(ui->dbd_input), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(ui->dbd_button), FALSE); + gaim_prefs_set_bool("/plugins/gtk/cap/connected", TRUE); + } else { + gtk_toggle_button_set_active(togglebutton, FALSE); + } + } else { + //disconnect + destroy_database_connection(); + gtk_widget_set_sensitive(GTK_WIDGET(ui->driver_choice), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(ui->driver_config), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(ui->dbd_input), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(ui->dbd_button), TRUE); + gaim_prefs_set_bool("/plugins/gtk/cap/connected", FALSE); + } } static void numeric_spinner_prefs_cb(GtkSpinButton *spinbutton, gpointer user_data) { gaim_prefs_set_int(user_data, gtk_spin_button_get_value_as_int(spinbutton)); } +static void driver_location_verify_cb(GtkButton *button, gpointer user_data) { + CapPrefsUI *ui = user_data; + gchar *path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(ui->dbd_input)); + + if(_dbi_initialized) + dbi_shutdown(); + + gaim_prefs_set_string("/plugins/gtk/cap/libdbi_drivers", path); + _num_drivers = dbi_initialize(path); + if(_num_drivers == -1) { + _dbi_initialized = FALSE; + } else { + _dbi_initialized = TRUE; + } + if(_num_drivers > 0) { + gtk_widget_set_sensitive(GTK_WIDGET(ui->driver_choice), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(ui->driver_config), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(ui->driver_connect_button), TRUE); + set_driver_choice_options(GTK_COMBO_BOX(ui->driver_choice)); + } else { + gtk_widget_set_sensitive(GTK_WIDGET(ui->driver_choice), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(ui->driver_config), FALSE); + gtk_expander_set_expanded(GTK_EXPANDER(ui->driver_config), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(ui->driver_connect_button), FALSE); + } +} + static gboolean text_entry_prefs_cb(GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { gaim_prefs_set_string(user_data, gtk_entry_get_text(GTK_ENTRY(widget))); return FALSE; } -static void combobox_prefs_cb(GtkComboBox *widget, gpointer user_data) { - gaim_prefs_set_string(user_data, gtk_combo_box_get_active_text(widget)); -} +void set_driver_choice_options(GtkComboBox *chooser) { + dbi_driver driver = NULL; + GtkListStore *list_store; + gint index = 0; + gint selected = 0; -static void prefs_closed_cb(GtkObject *widget, gpointer user_data) { - gboolean successfully_configured = FALSE; - successfully_configured = add_plugin_functionality(_plugin_pointer); - gaim_debug_info("cap", "Configured? %s\n", ((successfully_configured) ? "yes" : "no")); - if(!successfully_configured) { - if(error_msg) { - GtkWidget *error_dialog = gtk_message_dialog_new( - NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "%s\n%s", - _("Contact Availability Prediction configuration error."), get_error_msg()); - gtk_dialog_run(GTK_DIALOG(error_dialog)); - gtk_widget_destroy(error_dialog); + list_store = GTK_LIST_STORE(gtk_combo_box_get_model(chooser)); + gtk_list_store_clear(list_store); + + if(!_dbi_initialized) + return; + + while((driver = dbi_driver_list(driver)) != NULL) { + gtk_combo_box_append_text(chooser, dbi_driver_get_name(driver)); + if(strcmp(dbi_driver_get_name(driver), gaim_prefs_get_string("/plugins/gtk/cap/db_driver")) == 0) { + selected = index; } + ++index; } - - gaim_prefs_set_bool(user_data, successfully_configured); + gtk_combo_box_set_active(chooser, selected); } static GtkWidget * get_mysql_config() { - GtkWidget *config_area = gtk_table_new(5, 2, TRUE); + GtkWidget *config_area = gtk_table_new(5, 2, FALSE); GtkWidget *username_label = gtk_label_new(_("Username:")); GtkWidget *username_input = gtk_entry_new(); GtkWidget *password_label = gtk_label_new(_("Password:")); @@ -942,17 +1107,52 @@ gtk_entry_set_visibility(GTK_ENTRY(password_input), FALSE); - gtk_table_attach_defaults(GTK_TABLE(config_area), host_label, 0, 1, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(config_area), host_input, 1, 2, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(config_area), port_label, 0, 1, 1, 2); - gtk_table_attach_defaults(GTK_TABLE(config_area), port_input, 1, 2, 1, 2); - gtk_table_attach_defaults(GTK_TABLE(config_area), db_label, 0, 1, 2, 3); - gtk_table_attach_defaults(GTK_TABLE(config_area), db_input, 1, 2, 2, 3); - gtk_table_attach_defaults(GTK_TABLE(config_area), username_label, 0, 1, 3, 4); - gtk_table_attach_defaults(GTK_TABLE(config_area), username_input, 1, 2, 3, 4); - gtk_table_attach_defaults(GTK_TABLE(config_area), password_label, 0, 1, 4, 5); - gtk_table_attach_defaults(GTK_TABLE(config_area), password_input, 1, 2, 4, 5); + gtk_misc_set_alignment(GTK_MISC(username_label), 0, 0.5); + gtk_misc_set_padding(GTK_MISC(username_label), 10, 0); + gtk_misc_set_alignment(GTK_MISC(password_label), 0, 0.5); + gtk_misc_set_padding(GTK_MISC(password_label), 10, 0); + + gtk_misc_set_alignment(GTK_MISC(host_label), 0, 0.5); + gtk_misc_set_padding(GTK_MISC(host_label), 10, 0); + + gtk_misc_set_alignment(GTK_MISC(db_label), 0, 0.5); + gtk_misc_set_padding(GTK_MISC(db_label), 10, 0); + + gtk_misc_set_alignment(GTK_MISC(port_label), 0, 0.5); + gtk_misc_set_padding(GTK_MISC(port_label), 10, 0); + + gtk_table_attach(GTK_TABLE(config_area), host_label, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach(GTK_TABLE(config_area), host_input, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach(GTK_TABLE(config_area), port_label, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach(GTK_TABLE(config_area), port_input, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach(GTK_TABLE(config_area), db_label, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach(GTK_TABLE(config_area), db_input, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach(GTK_TABLE(config_area), username_label, 0, 1, 3, 4, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach(GTK_TABLE(config_area), username_input, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach(GTK_TABLE(config_area), password_label, 0, 1, 4, 5, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach(GTK_TABLE(config_area), password_input, 1, 2, 4, 5, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + //Initialize with data if(gaim_prefs_exists("/plugins/gtk/cap/mysql/db_host")) { gtk_entry_set_text(GTK_ENTRY(host_input), gaim_prefs_get_string("/plugins/gtk/cap/mysql/db_host")); @@ -997,19 +1197,6 @@ return config_area; } -static void driver_config_expanded(GObject *object, GParamSpec *param_spec, gpointer user_data) { - GtkExpander *expander; - gchar *driver = user_data; - expander = GTK_EXPANDER(object); - if(gtk_expander_get_expanded(expander)) { - if(g_ascii_strcasecmp(driver, "mysql") == 0) { - gtk_container_add(GTK_CONTAINER(expander), get_mysql_config()); - } - } else { - gtk_container_remove(GTK_CONTAINER(expander), gtk_bin_get_child(GTK_BIN(expander))); - } -} - static GaimGtkPluginUiInfo ui_info = { get_config_frame, 0 /* page_num (reserved) */ @@ -1042,12 +1229,10 @@ }; static void init_plugin(GaimPlugin *plugin) { - /* TODO: change this before distributing */ gaim_prefs_add_none("/plugins/gtk/cap"); gaim_prefs_add_int("/plugins/gtk/cap/max_seen_difference", 1); gaim_prefs_add_int("/plugins/gtk/cap/max_msg_difference", 10); gaim_prefs_add_int("/plugins/gtk/cap/threshold", 5); - gaim_prefs_add_string("/plugins/gtk/cap/libdbi_drivers", "/usr/lib/dbd"); gaim_prefs_add_bool("/plugins/gtk/cap/configured", FALSE); gaim_prefs_add_string("/plugins/gtk/cap/db_driver", "mysql"); gaim_prefs_add_none("/plugins/gtk/cap/mysql"); Modified: trunk/gtk/plugins/cap/cap.h =================================================================== --- trunk/gtk/plugins/cap/cap.h 2006-08-26 20:24:04 UTC (rev 17052) +++ trunk/gtk/plugins/cap/cap.h 2006-08-27 02:44:52 UTC (rev 17053) @@ -48,27 +48,24 @@ /* Variables used throughout lifetime of the plugin */ GaimPlugin *_plugin_pointer; -dbi_conn _conn; /**< The database connection */ -dbi_driver _driver; /**< The database driver */ +dbi_conn _conn = NULL; /**< The database connection */ +dbi_driver _driver = NULL; /**< The database driver */ GHashTable *_buddy_stats = NULL; GHashTable *_my_offline_times = NULL; GString *error_msg = NULL; gboolean _signals_connected; +gboolean _dbi_initialized; +int _num_drivers; enum driver_types {MYSQL}; /* Function definitions */ static char * quote_string(const char *str); static gboolean plugin_load(GaimPlugin *plugin); -static gboolean add_plugin_functionality(GaimPlugin *plugin); +static void add_plugin_functionality(GaimPlugin *plugin); +static void cancel_conversation_timeouts(gpointer key, gpointer value, gpointer user_data); +static void remove_plugin_functionality(GaimPlugin *plugin); static gboolean plugin_unload(GaimPlugin *plugin); -static GtkWidget * get_config_frame(GaimPlugin *plugin); -static void numeric_spinner_prefs_cb(GtkSpinButton *spinbutton, gpointer user_data); -static gboolean text_entry_prefs_cb(GtkWidget *widget, GdkEventFocus *event, gpointer user_data); -static void combobox_prefs_cb(GtkComboBox *widget, gpointer user_data); -static void prefs_closed_cb(GtkObject *widget, gpointer user_data); -static GtkWidget * get_mysql_config(); -static void driver_config_expanded(GObject *object, GParamSpec *param_spec, gpointer user_data); static void init_plugin(GaimPlugin *plugin); static void generate_prediction(CapStatistics *statistics); static double generate_prediction_for(GaimBuddy *buddy); @@ -84,12 +81,13 @@ static gboolean max_message_difference_cb(gpointer data); /* Various CAP helper functions */ -static const gchar * get_error_msg(); +static const gchar * get_error_msg(void); static void set_error_msg(const gchar *msg); static void reset_all_last_message_times(gpointer key, gpointer value, gpointer user_data); static GaimStatus * get_status_for(GaimBuddy *buddy); -static void create_tables(); -static gboolean create_database_connection(); +static void create_tables(void); +static gboolean create_database_connection(void); +static void destroy_database_connection(void); static guint word_count(const gchar *string); static gboolean last_message_time_in_range(CapStatistics *statistics, gdouble max_difference); static gboolean last_seen_time_in_range(CapStatistics *statistics, gdouble max_difference); @@ -113,4 +111,53 @@ /* Call backs */ void display_statistics_action_cb(GaimBlistNode *node, gpointer data); +/* Prefs UI */ +typedef struct _CapPrefsUI CapPrefsUI; + +struct _CapPrefsUI { + GtkWidget *ret; + GtkWidget *db_vbox; + GtkWidget *cap_vbox; + GtkWidget *table_layout; + + GtkWidget *driver_vbox; + GtkWidget *driver_select_hbox; + GtkWidget *driver_choice; + GtkWidget *driver_label; + GtkWidget *driver_config_hbox; + GtkWidget *driver_config; + GtkWidget *driver_connect_button; + + GtkWidget *dbd_label; + GtkWidget *dbd_input; + GtkWidget *dbd_hbox; + GtkWidget *dbd_button; + + GtkWidget *threshold_label; + GtkWidget *threshold_input; + GtkWidget *threshold_minutes_label; + + GtkWidget *msg_difference_label; + GtkWidget *msg_difference_input; + GtkWidget *msg_difference_minutes_label; + + GtkWidget *last_seen_label; + GtkWidget *last_seen_input; + GtkWidget *last_seen_minutes_label; +}; + +static GtkWidget * get_config_frame(GaimPlugin *plugin); +static void cap_prefs_ui_destroy_cb(GtkObject *object, gpointer user_data); +static CapPrefsUI * create_cap_prefs_ui(void); + +static void driver_choice_changed_cb(GtkComboBox *widget, gpointer user_data); +static void driver_config_expanded_cb(GObject *object, GParamSpec *param_spec, gpointer user_data); +static void connect_toggled_cb(GtkToggleButton *togglebutton, gpointer user_data); +static void numeric_spinner_prefs_cb(GtkSpinButton *spinbutton, gpointer user_data); +static void driver_location_verify_cb(GtkButton *button, gpointer user_data); +static gboolean text_entry_prefs_cb(GtkWidget *widget, GdkEventFocus *event, gpointer user_data); + +static void set_driver_choice_options(GtkComboBox *chooser); +static GtkWidget * get_mysql_config(void); + #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-26 20:24:10
|
Revision: 17052 Author: thekingant Date: 2006-08-26 13:24:04 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17052&view=rev Log Message: ----------- Change our invisible character to something a little smaller. I'm changing it from the character used by Ubuntu to the character used by Red Hat/Fedora. The Ubuntu character looks ridiculously huge on my FC5 system. Modified Paths: -------------- trunk/gtk/gtkgaim.h Modified: trunk/gtk/gtkgaim.h =================================================================== --- trunk/gtk/gtkgaim.h 2006-08-26 19:15:34 UTC (rev 17051) +++ trunk/gtk/gtkgaim.h 2006-08-26 20:24:04 UTC (rev 17052) @@ -78,7 +78,11 @@ #define GAIM_HIG_BORDER 12 #define GAIM_HIG_BOX_SPACE 6 -#define GAIM_INVISIBLE_CHAR (gunichar)0x25cf +/* + * See GNOME bug #307304 for some discussion about the invisible + * character. 0x25cf is a good choice, too. + */ +#define GAIM_INVISIBLE_CHAR (gunichar)0x2022 #endif /* _GAIM_GTKGAIM_H_ */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-26 19:15:41
|
Revision: 17051 Author: thekingant Date: 2006-08-26 12:15:34 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17051&view=rev Log Message: ----------- Add some stuff to svn:ignore Property Changed: ---------------- trunk/console/libgnt/wms/ trunk/gtk/plugins/cap/ trunk/libgaim/plugins/perl/ Property changes on: trunk/console/libgnt/wms ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in *.dll *.la *.lo *.loT Property changes on: trunk/gtk/plugins/cap ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in *.dll *.la *.lo *.loT Property changes on: trunk/libgaim/plugins/perl ___________________________________________________________________ Name: svn:ignore - Makefile Makefile.in .deps .libs *.dll *.lib *.la *.lo *.a + Makefile Makefile.in .deps .libs *.dll *.lib *.la *.lo *.loT *.a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-26 19:12:12
|
Revision: 17050 Author: thekingant Date: 2006-08-26 12:12:05 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17050&view=rev Log Message: ----------- Use GSList in a few places instead of GList, and use g_list_prepend and then g_list_reverse in a few places instead of g_list_append Modified Paths: -------------- trunk/libgaim/protocols/oscar/family_chat.c trunk/libgaim/protocols/oscar/family_oservice.c trunk/libgaim/protocols/oscar/flap_connection.c trunk/libgaim/protocols/oscar/oscar.c trunk/libgaim/protocols/oscar/oscar.h trunk/libgaim/protocols/oscar/oscar_data.c trunk/libgaim/protocols/oscar/peer.c Modified: trunk/libgaim/protocols/oscar/family_chat.c =================================================================== --- trunk/libgaim/protocols/oscar/family_chat.c 2006-08-26 17:28:30 UTC (rev 17049) +++ trunk/libgaim/protocols/oscar/family_chat.c 2006-08-26 19:12:05 UTC (rev 17050) @@ -67,7 +67,7 @@ FlapConnection * aim_chat_getconn(OscarData *od, const char *name) { - GList *cur; + GSList *cur; for (cur = od->oscar_connections; cur; cur = cur->next) { Modified: trunk/libgaim/protocols/oscar/family_oservice.c =================================================================== --- trunk/libgaim/protocols/oscar/family_oservice.c 2006-08-26 17:28:30 UTC (rev 17049) +++ trunk/libgaim/protocols/oscar/family_oservice.c 2006-08-26 19:12:05 UTC (rev 17050) @@ -33,7 +33,7 @@ { FlapFrame *frame; aim_snacid_t snacid; - GList *cur; + GSList *cur; frame = flap_frame_new(od, 0x02, 1152); @@ -82,7 +82,7 @@ while (byte_stream_empty(bs)) { group = byte_stream_get16(bs); - conn->groups = g_list_prepend(conn->groups, GUINT_TO_POINTER(group)); + conn->groups = g_slist_prepend(conn->groups, GUINT_TO_POINTER(group)); } /* @@ -500,7 +500,7 @@ { FlapFrame *frame; aim_snacid_t snacid; - GList *cur; + GSList *cur; frame = flap_frame_new(od, 0x02, 1024); @@ -742,7 +742,7 @@ { FlapFrame *frame; aim_snacid_t snacid; - GList *cur; + GSList *cur; frame = flap_frame_new(od, 0x02, 1152); Modified: trunk/libgaim/protocols/oscar/flap_connection.c =================================================================== --- trunk/libgaim/protocols/oscar/flap_connection.c 2006-08-26 17:28:30 UTC (rev 17049) +++ trunk/libgaim/protocols/oscar/flap_connection.c 2006-08-26 19:12:05 UTC (rev 17050) @@ -124,7 +124,7 @@ conn->subtype = -1; conn->type = type; - od->oscar_connections = g_list_prepend(od->oscar_connections, conn); + od->oscar_connections = g_slist_prepend(od->oscar_connections, conn); return conn; } @@ -220,10 +220,10 @@ if (conn->type == SNAC_FAMILY_CHAT) flap_connection_destroy_chat(od, conn); - g_list_free(conn->groups); + g_slist_free(conn->groups); flap_connection_destroy_rates(conn->rates); - od->oscar_connections = g_list_remove(od->oscar_connections, conn); + od->oscar_connections = g_slist_remove(od->oscar_connections, conn); account = gaim_connection_get_account(od->gc); @@ -351,12 +351,12 @@ FlapConnection * flap_connection_findbygroup(OscarData *od, guint16 group) { - GList *cur; + GSList *cur; for (cur = od->oscar_connections; cur != NULL; cur = cur->next) { FlapConnection *conn; - GList *l; + GSList *l; conn = cur->data; @@ -385,7 +385,7 @@ FlapConnection * flap_connection_getbytype(OscarData *od, int type) { - GList *cur; + GSList *cur; for (cur = od->oscar_connections; cur != NULL; cur = cur->next) { @@ -401,7 +401,7 @@ FlapConnection * flap_connection_getbytype_all(OscarData *od, int type) { - GList *cur; + GSList *cur; for (cur = od->oscar_connections; cur; cur = cur->next) { Modified: trunk/libgaim/protocols/oscar/oscar.c =================================================================== --- trunk/libgaim/protocols/oscar/oscar.c 2006-08-26 17:28:30 UTC (rev 17049) +++ trunk/libgaim/protocols/oscar/oscar.c 2006-08-26 19:12:05 UTC (rev 17050) @@ -972,7 +972,7 @@ } else if (conn->type == SNAC_FAMILY_CHAT) { - od->oscar_chats = g_slist_append(od->oscar_chats, conn->new_conn_data); + od->oscar_chats = g_slist_prepend(od->oscar_chats, conn->new_conn_data); conn->new_conn_data = NULL; } } @@ -5174,7 +5174,7 @@ gaim_debug_info("oscar", "chatnav does not exist, opening chatnav\n"); cr->exchange = atoi(exchange); cr->name = g_strdup(name); - od->create_rooms = g_slist_append(od->create_rooms, cr); + od->create_rooms = g_slist_prepend(od->create_rooms, cr); aim_reqservice(od, SNAC_FAMILY_CHATNAV); } } @@ -5600,24 +5600,24 @@ NULL, TRUE, TRUE, FALSE, "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), NULL); - status_types = g_list_append(status_types, type); + status_types = g_list_prepend(status_types, type); type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, OSCAR_STATUS_ID_FREE4CHAT, _("Free For Chat"), TRUE, is_icq, FALSE); - status_types = g_list_append(status_types, type); + status_types = g_list_prepend(status_types, type); type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY, OSCAR_STATUS_ID_AWAY, NULL, TRUE, TRUE, FALSE, "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), NULL); - status_types = g_list_append(status_types, type); + status_types = g_list_prepend(status_types, type); type = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE, OSCAR_STATUS_ID_INVISIBLE, NULL, TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); + status_types = g_list_prepend(status_types, type); /* ICQ-specific status types */ type = gaim_status_type_new_with_attrs(GAIM_STATUS_UNAVAILABLE, @@ -5625,27 +5625,29 @@ _("Occupied"), TRUE, is_icq, FALSE, "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), NULL); - status_types = g_list_append(status_types, type); + status_types = g_list_prepend(status_types, type); type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY, OSCAR_STATUS_ID_DND, _("Do Not Disturb"), TRUE, is_icq, FALSE, "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), NULL); - status_types = g_list_append(status_types, type); + status_types = g_list_prepend(status_types, type); type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY, OSCAR_STATUS_ID_NA, _("Not Available"), TRUE, is_icq, FALSE, "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), NULL); - status_types = g_list_append(status_types, type); + status_types = g_list_prepend(status_types, type); type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, OSCAR_STATUS_ID_OFFLINE, NULL, TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); + status_types = g_list_prepend(status_types, type); + status_types = g_list_reverse(status_types); + return status_types; } @@ -5779,27 +5781,27 @@ GaimConnection *gc; OscarData *od; - GList *m; + GList *menu; GaimMenuAction *act; aim_userinfo_t *userinfo; gc = gaim_account_get_connection(buddy->account); od = gc->proto_data; userinfo = aim_locate_finduserinfo(od, buddy->name); - m = NULL; + menu = NULL; if (od->icq && aim_sn_is_icq(gaim_buddy_get_name(buddy))) { act = gaim_menu_action_new(_("Get AIM Info"), GAIM_CALLBACK(oscar_get_aim_info_cb), NULL, NULL); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); } act = gaim_menu_action_new(_("Edit Buddy Comment"), GAIM_CALLBACK(oscar_buddycb_edit_comment), NULL, NULL); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); #if 0 if (od->icq) @@ -5807,7 +5809,7 @@ act = gaim_menu_action_new(_("Get Status Msg"), GAIM_CALLBACK(oscar_get_icqstatusmsg), NULL, NULL); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); } #endif @@ -5820,7 +5822,7 @@ act = gaim_menu_action_new(_("Direct IM"), GAIM_CALLBACK(oscar_ask_directim), NULL, NULL); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); } #if 0 /* TODO: This menu item should be added by the core */ @@ -5828,7 +5830,7 @@ act = gaim_menu_action_new(_("Get File"), GAIM_CALLBACK(oscar_ask_getfile), NULL, NULL); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); } #endif } @@ -5842,11 +5844,13 @@ act = gaim_menu_action_new(_("Re-request Authorization"), GAIM_CALLBACK(gaim_auth_sendrequest_menu), NULL, NULL); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); } } - return m; + menu = g_list_reverse(menu); + + return menu; } @@ -6213,83 +6217,85 @@ { GaimConnection *gc = (GaimConnection *) context; OscarData *od = gc->proto_data; - GList *m = NULL; + GList *menu = NULL; GaimPluginAction *act; act = gaim_plugin_action_new(_("Set User Info..."), oscar_show_set_info); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); if (od->icq) { act = gaim_plugin_action_new(_("Set User Info (URL)..."), oscar_show_set_info_icqurl); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); } act = gaim_plugin_action_new(_("Change Password..."), oscar_change_pass); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); if (od->authinfo->chpassurl != NULL) { act = gaim_plugin_action_new(_("Change Password (URL)"), oscar_show_chpassurl); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); act = gaim_plugin_action_new(_("Configure IM Forwarding (URL)"), oscar_show_imforwardingurl); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); } - m = g_list_append(m, NULL); + menu = g_list_prepend(menu, NULL); if (od->icq) { /* ICQ actions */ act = gaim_plugin_action_new(_("Set Privacy Options..."), oscar_show_icq_privacy_opts); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); } else { /* AIM actions */ act = gaim_plugin_action_new(_("Format Screen Name..."), oscar_show_format_screenname); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); act = gaim_plugin_action_new(_("Confirm Account"), oscar_confirm_account); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); act = gaim_plugin_action_new(_("Display Currently Registered E-Mail Address"), oscar_show_email); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); act = gaim_plugin_action_new(_("Change Currently Registered E-Mail Address..."), oscar_show_change_email); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); } - m = g_list_append(m, NULL); + menu = g_list_prepend(menu, NULL); act = gaim_plugin_action_new(_("Show Buddies Awaiting Authorization"), oscar_show_awaitingauth); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); - m = g_list_append(m, NULL); + menu = g_list_prepend(menu, NULL); act = gaim_plugin_action_new(_("Search for Buddy by E-Mail Address..."), oscar_show_find_email); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); #if 0 act = gaim_plugin_action_new(_("Search for Buddy by Information"), show_find_info); - m = g_list_append(m, act); + menu = g_list_prepend(menu, act); #endif - return m; + menu = g_list_reverse(menu); + + return menu; } static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) Modified: trunk/libgaim/protocols/oscar/oscar.h =================================================================== --- trunk/libgaim/protocols/oscar/oscar.h 2006-08-26 17:28:30 UTC (rev 17049) +++ trunk/libgaim/protocols/oscar/oscar.h 2006-08-26 19:12:05 UTC (rev 17050) @@ -383,7 +383,7 @@ guint16 subtype; flap_seqnum_t seqnum; guint32 status; - GList *groups; + GSList *groups; struct rateclass *rates; void *internal; /* internal conn-specific libfaim data */ @@ -492,13 +492,13 @@ } ssi; /* TODO: Implement this as a HashTable for HUGE speed improvement! */ - GList *handlerlist; + GSList *handlerlist; /** A linked list containing FlapConnections. */ - GList *oscar_connections; + GSList *oscar_connections; /** A linked list containing PeerConnections. */ - GList *peer_connections; + GSList *peer_connections; }; /* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */ Modified: trunk/libgaim/protocols/oscar/oscar_data.c =================================================================== --- trunk/libgaim/protocols/oscar/oscar_data.c 2006-08-26 17:28:30 UTC (rev 17049) +++ trunk/libgaim/protocols/oscar/oscar_data.c 2006-08-26 19:12:05 UTC (rev 17050) @@ -139,7 +139,7 @@ snac_handler->flags = flags; snac_handler->handler = newhandler; - od->handlerlist = g_list_prepend(od->handlerlist, snac_handler); + od->handlerlist = g_slist_prepend(od->handlerlist, snac_handler); return 0; } @@ -152,7 +152,7 @@ while (od->handlerlist != NULL) { snac_handler = od->handlerlist->data; - od->handlerlist = g_list_remove(od->handlerlist, snac_handler); + od->handlerlist = g_slist_remove(od->handlerlist, snac_handler); g_free(snac_handler); } od->handlerlist = NULL; @@ -161,7 +161,7 @@ aim_rxcallback_t aim_callhandler(OscarData *od, guint16 family, guint16 type) { - GList *cur; + GSList *cur; SnacHandler *snac_handler; for (cur = od->handlerlist; cur != NULL; cur = cur->next) Modified: trunk/libgaim/protocols/oscar/peer.c =================================================================== --- trunk/libgaim/protocols/oscar/peer.c 2006-08-26 17:28:30 UTC (rev 17049) +++ trunk/libgaim/protocols/oscar/peer.c 2006-08-26 19:12:05 UTC (rev 17050) @@ -71,7 +71,7 @@ PeerConnection * peer_connection_find_by_type(OscarData *od, const char *sn, OscarCapability type) { - GList *cur; + GSList *cur; PeerConnection *conn; for (cur = od->peer_connections; cur != NULL; cur = cur->next) @@ -90,7 +90,7 @@ PeerConnection * peer_connection_find_by_cookie(OscarData *od, const char *sn, const guchar *cookie) { - GList *cur; + GSList *cur; PeerConnection *conn; for (cur = od->peer_connections; cur != NULL; cur = cur->next) @@ -126,7 +126,7 @@ else if (type == OSCAR_CAPABILITY_SENDFILE) memcpy(conn->magic, "OFT2", 4); - od->peer_connections = g_list_prepend(od->peer_connections, conn); + od->peer_connections = g_slist_prepend(od->peer_connections, conn); return conn; } @@ -224,7 +224,7 @@ g_free(conn->verifiedip); gaim_circ_buffer_destroy(conn->buffer_outgoing); - conn->od->peer_connections = g_list_remove(conn->od->peer_connections, conn); + conn->od->peer_connections = g_slist_remove(conn->od->peer_connections, conn); g_free(conn); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-26 17:28:34
|
Revision: 17049 Author: markhuetsch Date: 2006-08-26 10:28:30 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17049&view=rev Log Message: ----------- Convert the font name to UTF-8 when receiving a message. This should fix a bug where users couldn't receive certain IMs in Adium. Modified Paths: -------------- trunk/libgaim/protocols/qq/char_conv.c Modified: trunk/libgaim/protocols/qq/char_conv.c =================================================================== --- trunk/libgaim/protocols/qq/char_conv.c 2006-08-26 17:24:10 UTC (rev 17048) +++ trunk/libgaim/protocols/qq/char_conv.c 2006-08-26 17:28:30 UTC (rev 17049) @@ -136,14 +136,14 @@ return len + 1; } -/* convert QQ formatted msg to GAIM formatted msg (and UTF-8) */ +/* convert QQ formatted msg to Gaim formatted msg (and UTF-8) */ gchar *qq_encode_to_gaim(guint8 *data, gint len, const gchar *msg) { GString *encoded; guint8 font_attr, font_size, color[3], bar, *cursor; gboolean is_bold, is_italic, is_underline; guint16 charset_code; - gchar *font_name, *color_code, *msg_utf8, *ret; + gchar *font_name, *color_code, *msg_utf8, *tmp, *ret; cursor = data; _qq_show_packet("QQ_MESG recv for font style", data, len); @@ -155,7 +155,9 @@ read_packet_b(data, &cursor, len, &bar); /* skip, not sure of its use */ read_packet_w(data, &cursor, len, &charset_code); - font_name = g_strndup((gchar *) cursor, data + len - cursor); + tmp = g_strndup((gchar *) cursor, data + len - cursor); + font_name = qq_to_utf8(tmp, QQ_CHARSET_DEFAULT); + g_free(tmp); font_size = _get_size(font_attr); is_bold = _check_bold(font_attr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2006-08-26 17:24:14
|
Revision: 17048 Author: markhuetsch Date: 2006-08-26 10:24:10 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17048&view=rev Log Message: ----------- Fixed an incorrect instance of error handling. Modified Paths: -------------- trunk/libgaim/protocols/qq/udp_proxy_s5.c Modified: trunk/libgaim/protocols/qq/udp_proxy_s5.c =================================================================== --- trunk/libgaim/protocols/qq/udp_proxy_s5.c 2006-08-26 17:22:24 UTC (rev 17047) +++ trunk/libgaim/protocols/qq/udp_proxy_s5.c 2006-08-26 17:24:10 UTC (rev 17048) @@ -225,7 +225,7 @@ if (phb->account == NULL || gaim_account_get_connection(phb->account) != NULL) { - phb->func(phb->data, source, NULL); + phb->func(phb->data, -1, _("Unable to connect")); } g_free(phb->host); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |