From: <sa...@us...> - 2006-08-15 06:22:03
|
Revision: 16764 Author: sadrul Date: 2006-08-14 23:21:39 -0700 (Mon, 14 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16764&view=rev Log Message: ----------- Add a savedstatus dialog, and a "status" command to bring it up. You an also select "Saved..." from the dropdown in the buddylist. The 'Add' and 'Edit' buttons don't do anything yet. They will probably get to work some time tomorrow. Modified Paths: -------------- trunk/console/Makefile trunk/console/gntblist.c trunk/console/gntconv.c trunk/console/libgnt/gnttree.c trunk/doc/gntgaim.1.in Added Paths: ----------- trunk/console/gntstatus.c trunk/console/gntstatus.h Modified: trunk/console/Makefile =================================================================== --- trunk/console/Makefile 2006-08-15 04:07:38 UTC (rev 16763) +++ trunk/console/Makefile 2006-08-15 06:21:39 UTC (rev 16764) @@ -13,6 +13,7 @@ gntplugin.c \ gntprefs.c \ gntrequest.c \ + gntstatus.c \ gntui.c GG_HEADERS = \ @@ -25,6 +26,7 @@ gntprefs.h \ gntplugin.h \ gntrequest.h \ + gntstatus.h \ gntui.h GG_OBJECTS = \ @@ -37,6 +39,7 @@ gntplugin.o \ gntprefs.o \ gntrequest.o \ + gntstatus.o \ gntui.o all: gntgaim Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-15 04:07:38 UTC (rev 16763) +++ trunk/console/gntblist.c 2006-08-15 06:21:39 UTC (rev 16764) @@ -17,6 +17,7 @@ #include "gnttree.h" #include "gntblist.h" +#include "gntstatus.h" #include <string.h> #define PREF_ROOT "/gaim/gnt/blist" @@ -42,7 +43,8 @@ typedef enum { STATUS_PRIMITIVE = 0, - STATUS_SAVED + STATUS_SAVED_POPULAR, + STATUS_SAVED_ALL, } StatusType; typedef struct @@ -1035,6 +1037,7 @@ int i; GList *iter; GList *items = NULL; + StatusBoxItem *item = NULL; /* First the primitives */ GaimStatusPrimitive prims[] = {GAIM_STATUS_AVAILABLE, GAIM_STATUS_AWAY, @@ -1042,7 +1045,7 @@ for (i = 0; prims[i] != GAIM_STATUS_UNSET; i++) { - StatusBoxItem *item = g_new0(StatusBoxItem, 1); + item = g_new0(StatusBoxItem, 1); item->type = STATUS_PRIMITIVE; item->u.prim = prims[i]; items = g_list_prepend(items, item); @@ -1053,18 +1056,26 @@ /* Now the popular statuses */ for (iter = gaim_savedstatuses_get_popular(6); iter; iter = iter->next) { - StatusBoxItem *item = g_new0(StatusBoxItem, 1); - item->type = STATUS_SAVED; + item = g_new0(StatusBoxItem, 1); + item->type = STATUS_SAVED_POPULAR; item->u.saved = iter->data; items = g_list_prepend(items, item); gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, gaim_savedstatus_get_title(iter->data)); } + /* More savedstatuses */ + item = g_new0(StatusBoxItem, 1); + item->type = STATUS_SAVED_ALL; + items = g_list_prepend(items, item); + gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, + _("Saved...")); + /* The keys for the combobox are created here, and never used * anywhere else. So make sure the keys are freed when the widget * is destroyed. */ - g_object_set_data_full(G_OBJECT(ggblist->status), "list of statuses", items, (GDestroyNotify)destroy_status_list); + g_object_set_data_full(G_OBJECT(ggblist->status), "list of statuses", + items, (GDestroyNotify)destroy_status_list); } void gg_blist_init() @@ -1125,7 +1136,7 @@ status_selection_changed(GntComboBox *box, StatusBoxItem *old, StatusBoxItem *now, gpointer null) { gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), NULL); - if (now->type == STATUS_SAVED) + if (now->type == STATUS_SAVED_POPULAR) { /* Set the status immediately */ gaim_savedstatus_activate(now->u.saved); @@ -1137,6 +1148,10 @@ gnt_box_move_focus(GNT_BOX(ggblist->window), 1); ggblist->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, NULL); } + else if (now->type == STATUS_SAVED_ALL) + { + gg_savedstatus_show_all(); + } else g_return_if_reached(); } Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-15 04:07:38 UTC (rev 16763) +++ trunk/console/gntconv.c 2006-08-15 06:21:39 UTC (rev 16764) @@ -11,6 +11,7 @@ #include "gntdebug.h" #include "gntplugin.h" #include "gntprefs.h" +#include "gntstatus.h" #include "gnt.h" #include "gntbox.h" @@ -566,6 +567,9 @@ gaim_cmd_register("prefs", "", GAIM_CMD_P_DEFAULT, GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, cmd_show_window, _("prefs: Show the preference window."), gg_prefs_show_all); + gaim_cmd_register("status", "", GAIM_CMD_P_DEFAULT, + GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, + cmd_show_window, _("statuses: Show the savedstatuses window."), gg_savedstatus_show_all); } void gg_conversation_uninit() Added: trunk/console/gntstatus.c =================================================================== --- trunk/console/gntstatus.c (rev 0) +++ trunk/console/gntstatus.c 2006-08-15 06:21:39 UTC (rev 16764) @@ -0,0 +1,139 @@ +#include <gnt.h> +#include <gntbox.h> +#include <gntbutton.h> +#include <gntentry.h> +#include <gntlabel.h> +#include <gnttree.h> + +#include <request.h> + +#include "gntgaim.h" +#include "gntstatus.h" + +static struct +{ + GntWidget *window; + GntWidget *tree; +} statuses; + +static void +reset_status_window(GntWidget *widget, gpointer null) +{ + statuses.window = NULL; + statuses.tree = NULL; +} + +static void +populate_statuses(GntTree *tree) +{ + const GList *list; + + for (list = gaim_savedstatuses_get_all(); list; list = list->next) + { + GaimSavedStatus *saved = list->data; + const char *title, *type, *message; + + if (gaim_savedstatus_is_transient(saved)) + continue; + + title = gaim_savedstatus_get_title(saved); + type = gaim_primitive_get_name_from_type(gaim_savedstatus_get_type(saved)); + message = gaim_savedstatus_get_message(saved); /* XXX: Strip possible markups */ + + gnt_tree_add_row_last(tree, saved, + gnt_tree_create_row(tree, title, type, message), NULL); + } +} + +static void +really_delete_status(GaimSavedStatus *saved) +{ + /* XXX: Close any modify dialog opened for the savedstatus */ + if (statuses.tree) + gnt_tree_remove(GNT_TREE(statuses.tree), saved); + + gaim_savedstatus_delete(gaim_savedstatus_get_title(saved)); +} + +static void +ask_before_delete(GntWidget *button, gpointer null) +{ + char *ask; + GaimSavedStatus *saved; + + g_return_if_fail(statuses.tree != NULL); + + saved = gnt_tree_get_selection_data(GNT_TREE(statuses.tree)); + ask = g_strdup_printf(_("Are you sure you want to delete \"%s\""), + gaim_savedstatus_get_title(saved)); + + gaim_request_action(saved, _("Delete Status"), ask, NULL, 0, saved, 2, + _("Delete"), really_delete_status, _("Cancel"), NULL); + g_free(ask); +} + +static void +use_savedstatus_cb(GntWidget *widget, gpointer null) +{ + g_return_if_fail(statuses.tree != NULL); + + gaim_savedstatus_activate(gnt_tree_get_selection_data(GNT_TREE(statuses.tree))); +} + +void gg_savedstatus_show_all() +{ + GntWidget *window, *tree, *box, *button; + if (statuses.window) + return; + + statuses.window = window = gnt_vbox_new(FALSE); + gnt_box_set_toplevel(GNT_BOX(window), TRUE); + gnt_box_set_title(GNT_BOX(window), _("Saved Statuses")); + gnt_box_set_fill(GNT_BOX(window), FALSE); + gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); + gnt_box_set_pad(GNT_BOX(window), 0); + + /* XXX: Add some sorting function to sort alphabetically, perhaps */ + statuses.tree = tree = gnt_tree_new_with_columns(3); + gnt_tree_set_column_titles(GNT_TREE(tree), _("Title"), _("Type"), _("Message")); + gnt_tree_set_show_title(GNT_TREE(tree), TRUE); + gnt_tree_set_col_width(GNT_TREE(tree), 0, 25); + gnt_tree_set_col_width(GNT_TREE(tree), 1, 12); + gnt_tree_set_col_width(GNT_TREE(tree), 2, 35); + gnt_box_add_widget(GNT_BOX(window), tree); + + populate_statuses(GNT_TREE(tree)); + + box = gnt_hbox_new(FALSE); + gnt_box_add_widget(GNT_BOX(window), box); + + button = gnt_button_new(_("Use")); + gnt_box_add_widget(GNT_BOX(box), button); + g_signal_connect(G_OBJECT(button), "activate", + G_CALLBACK(use_savedstatus_cb), NULL); + + button = gnt_button_new(_("Add")); + gnt_box_add_widget(GNT_BOX(box), button); + + button = gnt_button_new(_("Edit")); + gnt_box_add_widget(GNT_BOX(box), button); + + button = gnt_button_new(_("Delete")); + gnt_box_add_widget(GNT_BOX(box), button); + g_signal_connect(G_OBJECT(button), "activate", + G_CALLBACK(ask_before_delete), NULL); + + button = gnt_button_new(_("Close")); + gnt_box_add_widget(GNT_BOX(box), button); + g_signal_connect_swapped(G_OBJECT(button), "activate", + G_CALLBACK(gnt_widget_destroy), window); + + g_signal_connect(G_OBJECT(window), "destroy", + G_CALLBACK(reset_status_window), NULL); + gnt_widget_show(window); +} + +void gg_savedstatus_edit(GaimSavedStatus *saved) +{ +} + Property changes on: trunk/console/gntstatus.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntstatus.h =================================================================== --- trunk/console/gntstatus.h (rev 0) +++ trunk/console/gntstatus.h 2006-08-15 06:21:39 UTC (rev 16764) @@ -0,0 +1,7 @@ +#include <status.h> +#include <savedstatuses.h> + +void gg_savedstatus_show_all(); + +void gg_savedstatus_edit(GaimSavedStatus *saved); + Property changes on: trunk/console/gntstatus.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-08-15 04:07:38 UTC (rev 16763) +++ trunk/console/libgnt/gnttree.c 2006-08-15 06:21:39 UTC (rev 16764) @@ -274,7 +274,7 @@ int x = pos; mvwhline(widget->window, pos + 1, pos, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), - widget->priv.width - pos); + widget->priv.width - pos - 1); for (i = 0; i < tree->ncol; i++) { Modified: trunk/doc/gntgaim.1.in =================================================================== --- trunk/doc/gntgaim.1.in 2006-08-15 04:07:38 UTC (rev 16763) +++ trunk/doc/gntgaim.1.in 2006-08-15 06:21:39 UTC (rev 16764) @@ -169,6 +169,10 @@ .B prefs for the preferences window. +.TP +.B status +for the status window. + .SH BUGS Known bugs are listed at .br This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-21 07:47:14
|
Revision: 16949 Author: thekingant Date: 2006-08-21 00:47:03 -0700 (Mon, 21 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16949&view=rev Log Message: ----------- Change gaim_network_listen() and gaim_network_listen_range() to be cancelable. This doesn't actually help anything yet, since the gaim_upnp_functions() are not yet cancelable. But the framework is there, and the PRPLs shouldn't need any additional changes. Still to go: gaim_upnp_everything() gaim_url_fetch() gaim_srv_resolve() Let me know if there are others Modified Paths: -------------- trunk/doc/ChangeLog.API trunk/libgaim/network.c trunk/libgaim/network.h trunk/libgaim/plugins/perl/common/Network.xs trunk/libgaim/plugins/perl/common/module.h trunk/libgaim/protocols/irc/dcc_send.c trunk/libgaim/protocols/jabber/si.c trunk/libgaim/protocols/oscar/peer.c trunk/libgaim/protocols/oscar/peer.h trunk/libgaim/protocols/simple/simple.c trunk/libgaim/protocols/simple/simple.h Modified: trunk/doc/ChangeLog.API =================================================================== --- trunk/doc/ChangeLog.API 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/doc/ChangeLog.API 2006-08-21 07:47:03 UTC (rev 16949) @@ -91,6 +91,8 @@ * gaim_network_listen() and gaim_network_listen_range(): Added socket_type parameter to allow creation of UDP listening. Modified to be asynchronous with a callback to allow for UPnP operation. + Returns a data structure that can be used to cancel the listen + attempt using gaim_network_listen_cancel() * GaimPrefCallback: val is now a gconstpointer instead of a gpointer * gtk_imhtml_get_current_format(): the arguments are now set to TRUE or FALSE. Previously they were set to TRUE or left alone. Also, you @@ -117,6 +119,9 @@ * gaim_proxy_connect(): changed to return NULL on error and a pointer to a GaimProxyConnectInfo object which can be used to cancel connection attempts using gaim_proxy_connect_cancel(). + * 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_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 @@ -296,6 +301,12 @@ * gaim_proxy_get_setup() * GaimNotifySearchResultsCallback: Added user_data. * gaim_notify_searchresults: Added user_data. + * gaim_network_listen_cancel(): Can be used to cancel a previous + call to gaim_network_listen() or gaim_network_listen_range() + * gaim_proxy_connect_cancel(): Can be used to cancel a pending + gaim_proxy_connect() request + * gaim_dnsquery_destroy(): Can be used to cancel a pending DNS + query. 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/libgaim/network.c =================================================================== --- trunk/libgaim/network.c 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/libgaim/network.c 2006-08-21 07:47:03 UTC (rev 16949) @@ -42,14 +42,14 @@ #include "stun.h" #include "upnp.h" -typedef struct { +struct _GaimNetworkListenData { int listenfd; int socket_type; gboolean retry; gboolean adding; GaimNetworkListenCallback cb; gpointer cb_data; -} ListenUPnPData; +}; const unsigned char * gaim_network_ip_atoi(const char *ip) @@ -169,43 +169,49 @@ static void gaim_network_set_upnp_port_mapping_cb(gboolean success, gpointer data) { - ListenUPnPData *ldata = data; + GaimNetworkListenData *listen_data; + listen_data = data; + /* TODO: Once we're keeping track of upnp requests... */ + /* listen_data->pnp_data = NULL; */ + if (!success) { gaim_debug_info("network", "Couldn't create UPnP mapping\n"); - if (ldata->retry) { - ldata->retry = FALSE; - ldata->adding = FALSE; + if (listen_data->retry) { + listen_data->retry = FALSE; + listen_data->adding = FALSE; + /* TODO: Need to keep track of this return value! */ gaim_upnp_remove_port_mapping( - gaim_network_get_port_from_fd(ldata->listenfd), - (ldata->socket_type == SOCK_STREAM) ? "TCP" : "UDP", - gaim_network_set_upnp_port_mapping_cb, ldata); + gaim_network_get_port_from_fd(listen_data->listenfd), + (listen_data->socket_type == SOCK_STREAM) ? "TCP" : "UDP", + gaim_network_set_upnp_port_mapping_cb, listen_data); return; } - } else if (!ldata->adding) { + } else if (!listen_data->adding) { /* We've tried successfully to remove the port mapping. * Try to add it again */ - ldata->adding = TRUE; + listen_data->adding = TRUE; + /* TODO: Need to keep track of this return value! */ gaim_upnp_set_port_mapping( - gaim_network_get_port_from_fd(ldata->listenfd), - (ldata->socket_type == SOCK_STREAM) ? "TCP" : "UDP", - gaim_network_set_upnp_port_mapping_cb, ldata); + gaim_network_get_port_from_fd(listen_data->listenfd), + (listen_data->socket_type == SOCK_STREAM) ? "TCP" : "UDP", + gaim_network_set_upnp_port_mapping_cb, listen_data); return; } - if (ldata->cb) - ldata->cb(ldata->listenfd, ldata->cb_data); + if (listen_data->cb) + listen_data->cb(listen_data->listenfd, listen_data->cb_data); - g_free(ldata); + gaim_network_listen_cancel(listen_data); } -static gboolean +static GaimNetworkListenData * gaim_network_do_listen(unsigned short port, int socket_type, GaimNetworkListenCallback cb, gpointer cb_data) { int listenfd = -1; const int on = 1; - ListenUPnPData *ld; + GaimNetworkListenData *listen_data; #ifdef HAVE_GETADDRINFO int errnum; struct addrinfo hints, *res, *next; @@ -228,7 +234,7 @@ #else gaim_debug_warning("network", "getaddrinfo: Error Code = %d\n", errnum); #endif - return FALSE; + return NULL; } /* @@ -252,13 +258,13 @@ freeaddrinfo(res); if (next == NULL) - return FALSE; + return NULL; #else struct sockaddr_in sockin; if ((listenfd = socket(AF_INET, socket_type, 0)) < 0) { gaim_debug_warning("network", "socket: %s\n", strerror(errno)); - return FALSE; + return NULL; } if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) != 0) @@ -271,48 +277,49 @@ if (bind(listenfd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) { gaim_debug_warning("network", "bind: %s\n", strerror(errno)); close(listenfd); - return FALSE; + return NULL; } #endif if (socket_type == SOCK_STREAM && listen(listenfd, 4) != 0) { gaim_debug_warning("network", "listen: %s\n", strerror(errno)); close(listenfd); - return FALSE; + return NULL; } fcntl(listenfd, F_SETFL, O_NONBLOCK); gaim_debug_info("network", "Listening on port: %hu\n", gaim_network_get_port_from_fd(listenfd)); - ld = g_new0(ListenUPnPData, 1); - ld->listenfd = listenfd; - ld->adding = TRUE; - ld->retry = TRUE; - ld->cb = cb; - ld->cb_data = cb_data; + listen_data = g_new0(GaimNetworkListenData, 1); + listen_data->listenfd = listenfd; + listen_data->adding = TRUE; + listen_data->retry = TRUE; + listen_data->cb = cb; + listen_data->cb_data = cb_data; + /* TODO: Need to keep track of this return value! */ gaim_upnp_set_port_mapping( gaim_network_get_port_from_fd(listenfd), (socket_type == SOCK_STREAM) ? "TCP" : "UDP", - gaim_network_set_upnp_port_mapping_cb, ld); + gaim_network_set_upnp_port_mapping_cb, listen_data); - return TRUE; + return listen_data; } -gboolean +GaimNetworkListenData * gaim_network_listen(unsigned short port, int socket_type, GaimNetworkListenCallback cb, gpointer cb_data) { - g_return_val_if_fail(port != 0, -1); + g_return_val_if_fail(port != 0, NULL); return gaim_network_do_listen(port, socket_type, cb, cb_data); } -gboolean +GaimNetworkListenData * gaim_network_listen_range(unsigned short start, unsigned short end, int socket_type, GaimNetworkListenCallback cb, gpointer cb_data) { - gboolean ret = FALSE; + GaimNetworkListenData *ret = NULL; if (gaim_prefs_get_bool("/core/network/ports_range_use")) { start = gaim_prefs_get_int("/core/network/ports_range_start"); @@ -324,13 +331,18 @@ for (; start <= end; start++) { ret = gaim_network_do_listen(start, socket_type, cb, cb_data); - if (ret) + if (ret != NULL) break; } return ret; } +void gaim_network_listen_cancel(GaimNetworkListenData *listen_data) +{ + g_free(listen_data); +} + unsigned short gaim_network_get_port_from_fd(int fd) { Modified: trunk/libgaim/network.h =================================================================== --- trunk/libgaim/network.h 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/libgaim/network.h 2006-08-21 07:47:03 UTC (rev 16949) @@ -25,11 +25,6 @@ #ifndef _GAIM_NETWORK_H_ #define _GAIM_NETWORK_H_ -/* - * TODO: This API needs a way to cancel pending calls to - * gaim_network_listen_range() and company. - */ - #ifdef __cplusplus extern "C" { #endif @@ -39,6 +34,8 @@ /**************************************************************************/ /*@{*/ +typedef struct _GaimNetworkListenData GaimNetworkListenData; + typedef void (*GaimNetworkListenCallback) (int listenfd, gpointer data); /** @@ -129,11 +126,12 @@ * this callback, or -1 if no socket could be established. * @param cb_data extra data to be returned when cb is called * - * @return TRUE if the callback will be invoked, or FALSE if unable to obtain - * a local socket to listen on. + * @return A pointer to a data structure that can be used to cancel + * the pending listener, or NULL if unable to obtain a local + * socket to listen on. */ -gboolean gaim_network_listen(unsigned short port, int socket_type, - GaimNetworkListenCallback cb, gpointer cb_data); +GaimNetworkListenData *gaim_network_listen(unsigned short port, + int socket_type, GaimNetworkListenCallback cb, gpointer cb_data); /** * Opens a listening port selected from a range of ports. The range of @@ -161,13 +159,25 @@ * this callback, or -1 if no socket could be established. * @param cb_data extra data to be returned when cb is called * - * @return TRUE if the callback will be invoked, or FALSE if unable to obtain - * a local socket to listen on. + * @return A pointer to a data structure that can be used to cancel + * the pending listener, or NULL if unable to obtain a local + * socket to listen on. */ -gboolean gaim_network_listen_range(unsigned short start, unsigned short end, - int socket_type, GaimNetworkListenCallback cb, gpointer cb_data); +GaimNetworkListenData *gaim_network_listen_range(unsigned short start, + unsigned short end, int socket_type, + GaimNetworkListenCallback cb, gpointer cb_data); /** + * This can be used to cancel any in-progress listener connection + * by passing in the return value from either gaim_network_listen() + * or gaim_network_listen_range(). + * + * @param listen_data This listener attempt will be canceled and + * the struct will be freed. + */ +void gaim_network_listen_cancel(GaimNetworkListenData *listen_data); + +/** * Gets a port number from a file descriptor. * * @param fd The file descriptor. This should be a tcp socket. The current Modified: trunk/libgaim/plugins/perl/common/Network.xs =================================================================== --- trunk/libgaim/plugins/perl/common/Network.xs 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/libgaim/plugins/perl/common/Network.xs 2006-08-21 07:47:03 UTC (rev 16949) @@ -25,14 +25,14 @@ gaim_network_ip_atoi(ip) const char *ip -int +Gaim::NetworkListenData * gaim_network_listen(port, socket_type, cb, cb_data) unsigned short port int socket_type Gaim::NetworkListenCallback cb gpointer cb_data -int +Gaim::NetworkListenData * gaim_network_listen_range(start, end, socket_type, cb, cb_data) unsigned short start unsigned short end Modified: trunk/libgaim/plugins/perl/common/module.h =================================================================== --- trunk/libgaim/plugins/perl/common/module.h 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/libgaim/plugins/perl/common/module.h 2006-08-21 07:47:03 UTC (rev 16949) @@ -159,6 +159,7 @@ typedef GaimLogType Gaim__LogType; /* network.h */ +typedef GaimNetworkListenData Gaim__NetworkListenData; typedef GaimNetworkListenCallback Gaim__NetworkListenCallback; /* notify.h */ Modified: trunk/libgaim/protocols/irc/dcc_send.c =================================================================== --- trunk/libgaim/protocols/irc/dcc_send.c 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/libgaim/protocols/irc/dcc_send.c 2006-08-21 07:47:03 UTC (rev 16949) @@ -142,6 +142,7 @@ *******************************************************************/ struct irc_xfer_send_data { + GaimNetworkListenData *listen_data; gint inpa; int fd; guchar *rxqueue; @@ -155,6 +156,8 @@ if (xd == NULL) return; + if (xd->listen_data != NULL) + gaim_network_listen_cancel(xd->listen_data); if (xd->inpa > 0) gaim_input_remove(xd->inpa); if (xd->fd != -1) @@ -271,6 +274,9 @@ struct in_addr addr; unsigned short int port; + xd = xfer->data; + xd->listen_data = NULL; + if (gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL || gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_REMOTE) { gaim_xfer_unref(xfer); @@ -314,14 +320,16 @@ */ static void irc_dccsend_send_init(GaimXfer *xfer) { GaimConnection *gc = gaim_account_get_connection(gaim_xfer_get_account(xfer)); + struct irc_xfer_send_data *xd = xfer->data; xfer->filename = g_path_get_basename(xfer->local_filename); gaim_xfer_ref(xfer); /* Create a listening socket */ - if (!gaim_network_listen_range(0, 0, SOCK_STREAM, - irc_dccsend_network_listen_cb, xfer)) { + xd->listen_data = gaim_network_listen_range(0, 0, SOCK_STREAM, + irc_dccsend_network_listen_cb, xfer); + if (xd->listen_data == NULL) { gaim_xfer_unref(xfer); gaim_notify_error(gc, NULL, _("File Transfer Failed"), _("Gaim could not open a listening port.")); Modified: trunk/libgaim/protocols/jabber/si.c =================================================================== --- trunk/libgaim/protocols/jabber/si.c 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/libgaim/protocols/jabber/si.c 2006-08-21 07:47:03 UTC (rev 16949) @@ -47,6 +47,7 @@ JabberStream *js; GaimProxyConnectData *connect_data; + GaimNetworkListenData *listen_data; gboolean accepted; @@ -539,13 +540,14 @@ xmlnode *query, *streamhost; char *jid, *port; + jsx = xfer->data; + jsx->listen_data = NULL; + if (gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL) { gaim_xfer_unref(xfer); return; } - jsx = xfer->data; - gaim_xfer_unref(xfer); if (sock < 0) { @@ -588,10 +590,14 @@ static void jabber_si_xfer_bytestreams_send_init(GaimXfer *xfer) { + JabberSIXfer *jsx; + gaim_xfer_ref(xfer); - if(!gaim_network_listen_range(0, 0, SOCK_STREAM, - jabber_si_xfer_bytestreams_listen_cb, xfer)) { + jsx = xfer->data; + jsx->listen_data = gaim_network_listen_range(0, 0, SOCK_STREAM, + jabber_si_xfer_bytestreams_listen_cb, xfer); + if (jsx->listen_data == NULL) { gaim_xfer_unref(xfer); /* XXX: couldn't open a port, we're fscked */ gaim_xfer_cancel_local(xfer); @@ -698,6 +704,8 @@ if (jsx->connect_data != NULL) gaim_proxy_connect_cancel(jsx->connect_data); + if (jsx->listen_data != NULL) + gaim_network_listen_cancel(jsx->listen_data); g_free(jsx->stream_id); g_free(jsx->iq_id); Modified: trunk/libgaim/protocols/oscar/peer.c =================================================================== --- trunk/libgaim/protocols/oscar/peer.c 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/libgaim/protocols/oscar/peer.c 2006-08-21 07:47:03 UTC (rev 16949) @@ -145,6 +145,12 @@ conn->connect_data = NULL; } + if (conn->listen_data != NULL) + { + gaim_network_listen_cancel(conn->listen_data); + conn->listen_data = NULL; + } + if (conn->connect_timeout_timer != 0) { gaim_timeout_remove(conn->connect_timeout_timer); @@ -561,7 +567,6 @@ static void peer_connection_establish_listener_cb(int listenerfd, gpointer data) { - NewPeerConnectionData *new_conn_data; PeerConnection *conn; OscarData *od; GaimConnection *gc; @@ -572,18 +577,9 @@ const char *listener_ip; unsigned short listener_port; - new_conn_data = data; - gc = new_conn_data->gc; - conn = new_conn_data->conn; - g_free(new_conn_data); + conn = data; + conn->listen_data = NULL; - if (!GAIM_CONNECTION_IS_VALID(gc)) - { - if (listenerfd != -1) - close(listenerfd); - return; - } - if (listenerfd == -1) { /* Could not open listener socket */ @@ -592,6 +588,7 @@ } od = conn->od; + gc = od->gc; account = gaim_connection_get_account(gc); conn->listenerfd = listenerfd; @@ -757,12 +754,6 @@ if (!(conn->flags & PEER_CONNECTION_FLAG_TRIED_INCOMING) && (!conn->use_proxy)) { - NewPeerConnectionData *new_conn_data; - - new_conn_data = g_new(NewPeerConnectionData, 1); - new_conn_data->gc = conn->od->gc; - new_conn_data->conn = conn; - conn->flags |= PEER_CONNECTION_FLAG_TRIED_INCOMING; /* @@ -771,14 +762,13 @@ */ conn->flags |= PEER_CONNECTION_FLAG_IS_INCOMING; - if (gaim_network_listen_range(5190, 5290, SOCK_STREAM, - peer_connection_establish_listener_cb, new_conn_data)) + conn->listen_data = gaim_network_listen_range(5190, 5290, SOCK_STREAM, + peer_connection_establish_listener_cb, conn); + if (conn->listen_data != NULL) { /* Opening listener socket... */ return; } - - g_free(new_conn_data); } /* Modified: trunk/libgaim/protocols/oscar/peer.h =================================================================== --- trunk/libgaim/protocols/oscar/peer.h 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/libgaim/protocols/oscar/peer.h 2006-08-21 07:47:03 UTC (rev 16949) @@ -26,11 +26,12 @@ #define _PEER_H_ #include "ft.h" +#include "network.h" +#include "proxy.h" typedef struct _OdcFrame OdcFrame; typedef struct _OftFrame OftFrame; typedef struct _ProxyFrame ProxyFrame; -typedef struct _NewPeerConnectionData NewPeerConnectionData; typedef struct _PeerConnection PeerConnection; #define PEER_CONNECTION_FLAG_INITIATED_BY_ME 0x0001 @@ -132,12 +133,6 @@ ByteStream payload; /* 12 */ }; -struct _NewPeerConnectionData -{ - GaimConnection *gc; - PeerConnection *conn; -}; - struct _PeerConnection { OscarData *od; @@ -166,6 +161,12 @@ /** * This is only used when the peer connection is being established. */ + GaimNetworkListenData *listen_data; + + + /** + * This is only used when the peer connection is being established. + */ guint connect_timeout_timer; /** Modified: trunk/libgaim/protocols/simple/simple.c =================================================================== --- trunk/libgaim/protocols/simple/simple.c 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/libgaim/protocols/simple/simple.c 2006-08-21 07:47:03 UTC (rev 16949) @@ -1506,6 +1506,8 @@ static void simple_udp_host_resolved_listen_cb(int listenfd, gpointer data) { struct simple_account_data *sip = (struct simple_account_data*) data; + sip->listen_data = NULL; + if(listenfd == -1) { gaim_connection_error(sip->gc, _("Could not create listen socket")); return; @@ -1546,8 +1548,9 @@ } /* create socket for incoming connections */ - if(!gaim_network_listen_range(5060, 5160, SOCK_DGRAM, - simple_udp_host_resolved_listen_cb, sip)) { + sip->listen_data = gaim_network_listen_range(5060, 5160, SOCK_DGRAM, + simple_udp_host_resolved_listen_cb, sip); + if (sip->listen_data == NULL) { gaim_connection_error(sip->gc, _("Could not create listen socket")); return; } @@ -1558,6 +1561,8 @@ struct simple_account_data *sip = (struct simple_account_data*) data; GaimProxyConnectData *connect_data; + sip->listen_data = NULL; + sip->listenfd = listenfd; if(sip->listenfd == -1) { gaim_connection_error(sip->gc, _("Could not create listen socket")); @@ -1616,8 +1621,9 @@ /* TCP case */ if(!sip->udp) { /* create socket for incoming connections */ - if(!gaim_network_listen_range(5060, 5160, SOCK_STREAM, - simple_tcp_connect_listen_cb, sip)) { + sip->listen_data = gaim_network_listen_range(5060, 5160, SOCK_STREAM, + simple_tcp_connect_listen_cb, sip); + if (sip->listen_data == NULL) { gaim_connection_error(sip->gc, _("Could not create listen socket")); return; } @@ -1697,6 +1703,9 @@ if (sip->query_data != NULL) gaim_dnsquery_destroy(sip->query_data); + if (sip->listen_data != NULL) + gaim_network_listen_cancel(sip->listen_data); + g_free(sip->servername); g_free(sip->username); g_free(sip->password); Modified: trunk/libgaim/protocols/simple/simple.h =================================================================== --- trunk/libgaim/protocols/simple/simple.h 2006-08-21 07:44:31 UTC (rev 16948) +++ trunk/libgaim/protocols/simple/simple.h 2006-08-21 07:47:03 UTC (rev 16949) @@ -1,10 +1,10 @@ /** * @file simple.h - * + * * gaim * * Copyright (C) 2005, Thomas Butter <bu...@un...> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +29,8 @@ #include "cipher.h" #include "circbuffer.h" #include "dnsquery.h" +#include "network.h" +#include "proxy.h" #include "prpl.h" #include "sipmsg.h" @@ -71,6 +73,7 @@ gchar *username; gchar *password; GaimDnsQueryData *query_data; + GaimNetworkListenData *listen_data; int fd; int cseq; time_t reregister; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rl...@us...> - 2006-08-30 06:26:46
|
Revision: 17086 Author: rlaager Date: 2006-08-29 23:26:40 -0700 (Tue, 29 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17086&view=rev Log Message: ----------- I noticed the gntgaim man page didn't list all the protocols... I've synced the man page summaries with the gtkgaim about box. Maybe that sucks, but at least everything is consistent now. Modified Paths: -------------- trunk/doc/gaim.1.in trunk/doc/gntgaim.1.in Modified: trunk/doc/gaim.1.in =================================================================== --- trunk/doc/gaim.1.in 2006-08-30 05:07:43 UTC (rev 17085) +++ trunk/doc/gaim.1.in 2006-08-30 06:26:40 UTC (rev 17086) @@ -28,9 +28,9 @@ .SH DESCRIPTION .PP -\fBgaim\fR is a GTK2-based Instant Messaging (IM) application. It supports -multiple protocols via modules, including AIM, ICQ, Yahoo!, MSN, Jabber, -IRC, Gadu-Gadu and Zephyr. It has many common features found in +\fBgaim\fR is a gtk2-based modular messaging client capable of using +AIM, MSN, Yahoo!, Jabber, ICQ, IRC, SILC, Novell GroupWise, Lotus Sametime, +Zephyr, Gadu-Gadu, and QQ all at once. It has many common features found in other clients, as well as many unique features. Gaim is not endorsed by or affiliated with America Online, ICQ, Microsoft, or Yahoo. Modified: trunk/doc/gntgaim.1.in =================================================================== --- trunk/doc/gntgaim.1.in 2006-08-30 05:07:43 UTC (rev 17085) +++ trunk/doc/gntgaim.1.in 2006-08-30 06:26:40 UTC (rev 17086) @@ -28,11 +28,11 @@ .SH DESCRIPTION .PP -\fBgntgaim\fR is a console-based frontend for Instant Messaging (IM) -application Gaim. It supports multiple protocols via modules, including AIM, -ICQ, Yahoo!, MSN, Jabber, IRC, Gadu-Gadu and Zephyr. It has many -common features found in other clients, as well as many unique features. Gaim -is not endorsed by or affiliated with America Online, ICQ, Microsoft, or Yahoo. +\fBgntgaim\fR is a console-based modular messaging client capable of using +AIM, MSN, Yahoo!, Jabber, ICQ, IRC, SILC, Novell GroupWise, Lotus Sametime, +Zephyr, Gadu-Gadu, and QQ all at once. It has many common features found in +other clients, as well as many unique features. Gaim is not endorsed by or +affiliated with America Online, ICQ, Microsoft, or Yahoo. .SH OPTIONS The following options are provided by \fBgntgaim\fR using the standard GNU This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |