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: <rl...@us...> - 2006-06-23 14:30:39
|
Revision: 16318 Author: rlaager Date: 2006-06-23 07:30:27 -0700 (Fri, 23 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16318&view=rev Log Message: ----------- SF Patch #1510916 from alverino "Just a faq update for the irix entry, and a new entry for hpux." Modified Paths: -------------- web/htdocs/faq2.txt Modified: web/htdocs/faq2.txt =================================================================== --- web/htdocs/faq2.txt 2006-06-23 10:25:47 UTC (rev 16317) +++ web/htdocs/faq2.txt 2006-06-23 14:30:27 UTC (rev 16318) @@ -124,10 +124,40 @@ Q: Can I run Gaim on IRIX? -A: It has been done before. Please see -<a href="http://sourceforge.net/forum/forum.php?thread_id=725839&forum_id=665">this thread</a> -at our SourceForge Forum. +A: Sure you can - the amount of effort involved depends on which compiler you use; +there is however no official support. +<p> +GCC (tested with 3.4 on IRIX 6.5.29): +All but one necessary changes were included in the official sources. +You will notice GnuTLS will not be included by default, even if the necessary +includes and libraries are available; to add SSL support, open the configure script +in your favourite editor and replace all instances of "-lnsl" by "-lnsl -lgnutls". +Ask no questions :-) it Just Works. Mozilla-NSS wasn't tested. +</p> +<p> +MIPSPro CC (tested with 7.4.4m on IRIX 6.5.29): +Less trivial for obvious ANSI-tightness reasons. There's an unofficial patch for +2.0.0 beta3 available +<a href="http://jesuschrist.be/gaim/gaim-2.0.0beta3_irix.patch">here</a>, which +applies (amongst others) the SSL hack described above. You will need to configure +WITHOUT the Zephyr protocol plugin. +</p> +<p> +NOTE: Jabber crashed gaim when using TLS. This is a bug inside GnuTLS that might +or might not be fixed by the time you read this. +</p> +Q: Can I run Gaim on HPUX? + +A: Yes, you can; with GCC 4.1.1 on HPUX 11.11 at least it worked fine. +There is however no official support. +<p> +The build scripts that are shipped with the "official" releases +are unfortunately incompatible with the HPUX linker; fetching the svn version and +running autogen.sh however gives you a healthy build dir. Configure gaim WITHOUT +the X screensaver extension and disable the gtk- and glibtests; no source hacks are needed. +</p> + Q: Can I run Gaim on MacOSX? A: Yes you can, but we do not provide a package for it. The reason This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-06-23 10:25:54
|
Revision: 16317 Author: sadrul Date: 2006-06-23 03:25:47 -0700 (Fri, 23 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16317&view=rev Log Message: ----------- Do the indentation in GntTree properly. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/gntwidget.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-06-23 09:38:48 UTC (rev 16316) +++ trunk/console/gntblist.c 2006-06-23 10:25:47 UTC (rev 16317) @@ -10,8 +10,6 @@ #include "gntblist.h" -#define TAB_SIZE 3 - typedef struct { GntWidget *window; @@ -100,7 +98,6 @@ static void add_buddy(GaimBuddy *buddy, GGBlist *ggblist) { - char *text; GaimGroup *group; GaimBlistNode *node = (GaimBlistNode *)buddy; if (node->ui_data) @@ -110,9 +107,7 @@ group = gaim_buddy_get_group(buddy); add_group(group, ggblist); - text = g_strdup_printf("%*s%s", TAB_SIZE, "", gaim_buddy_get_alias(buddy)); - gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, text, group, NULL); - g_free(text); + gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, gaim_buddy_get_alias(buddy), group, NULL); } static void Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-06-23 09:38:48 UTC (rev 16316) +++ trunk/console/libgnt/gnttree.c 2006-06-23 10:25:47 UTC (rev 16317) @@ -5,6 +5,8 @@ SIGS = 1, }; +#define TAB_SIZE 3 + /* XXX: Make this one into a GObject? * ... Probably not */ struct _GnTreeRow @@ -202,12 +204,21 @@ return type; } +static void +free_tree_row(gpointer data) +{ + GntTreeRow *row = data; + + g_free(row->text); + g_free(row); +} + GntWidget *gnt_tree_new() { GntWidget *widget = g_object_new(GNT_TYPE_TREE, NULL); GntTree *tree = GNT_TREE(widget); - tree->hash = g_hash_table_new(g_direct_hash, g_direct_equal); + tree->hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_tree_row); GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_SHADOW); gnt_widget_set_take_focus(widget, TRUE); @@ -246,14 +257,24 @@ redraw_tree(tree); } +static int +find_depth(GntTreeRow *row) +{ + int dep = -1; + + while (row) + { + dep++; + row = row->parent; + } + + return dep; +} + void gnt_tree_add_row_after(GntTree *tree, void *key, const char *text, void *parent, void *bigbro) { GntTreeRow *row = g_new0(GntTreeRow, 1), *pr = NULL; - row->key = key; - row->text = g_strdup(text); - row->data = NULL; - g_hash_table_insert(tree->hash, key, row); if (tree->root == NULL) @@ -308,6 +329,10 @@ } } + row->key = key; + row->text = g_strdup_printf("%*s%s", TAB_SIZE * find_depth(row), "", text); + row->data = NULL; + if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_MAPPED)) redraw_tree(tree); } Modified: trunk/console/libgnt/gntwidget.c =================================================================== --- trunk/console/libgnt/gntwidget.c 2006-06-23 09:38:48 UTC (rev 16316) +++ trunk/console/libgnt/gntwidget.c 2006-06-23 10:25:47 UTC (rev 16317) @@ -224,6 +224,7 @@ delwin(obj->window); if(!(GNT_WIDGET_FLAGS(obj) & GNT_WIDGET_DESTROYING)) g_object_run_dispose(G_OBJECT(obj)); + /* XXX: This may be the wrong place */ gnt_screen_remove_widget(obj); DEBUG; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-06-23 09:38:57
|
Revision: 16316 Author: sadrul Date: 2006-06-23 02:38:48 -0700 (Fri, 23 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16316&view=rev Log Message: ----------- Minor tweaks to the buddy-list. The list now updates if some account gets disconnected due to a connection error. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/gntblist.h trunk/console/gntgaim.c trunk/console/gntui.c trunk/console/libgnt/gnttree.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-06-23 08:42:07 UTC (rev 16315) +++ trunk/console/gntblist.c 2006-06-23 09:38:48 UTC (rev 16316) @@ -16,31 +16,52 @@ { GntWidget *window; GntWidget *tree; + + GaimBuddyList *list; } GGBlist; GGBlist *ggblist; +static void add_buddy(GaimBuddy *buddy, GGBlist *ggblist); +static void add_group(GaimGroup *group, GGBlist *ggblist); + static void new_node(GaimBlistNode *node) { } static void -node_update(GaimBuddyList *list, GaimBlistNode *node) +node_remove(GaimBuddyList *list, GaimBlistNode *node) { + GGBlist *ggblist = list->ui_data; + + if (node->ui_data == NULL) + return; + + gnt_tree_remove(GNT_TREE(ggblist->tree), node); + node->ui_data = NULL; + + /* XXX: Depending on the node, we may want to remove the group/contact node if necessary */ + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + { + GaimGroup *group = gaim_buddy_get_group((GaimBuddy*)node); + if (gaim_blist_get_group_online_count(group) == 0) + node_remove(list, (GaimBlistNode*)group); + } } static void -node_remove(GaimBuddyList *list, GaimBlistNode *node) +node_update(GaimBuddyList *list, GaimBlistNode *node) { + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + { + GaimBuddy *buddy = (GaimBuddy*)node; + } } static void new_list(GaimBuddyList *list) { - if (ggblist == NULL) - gg_blist_init(); - list->ui_data = ggblist; } static GaimBlistUiOps blist_ui_ops = @@ -85,6 +106,7 @@ if (node->ui_data) return; + node->ui_data = GINT_TO_POINTER(TRUE); group = gaim_buddy_get_group(buddy); add_group(group, ggblist); @@ -102,10 +124,10 @@ static void buddy_signed_off(GaimBuddy *buddy, GGBlist *ggblist) { - gnt_tree_remove(GNT_TREE(ggblist->tree), buddy); + node_remove(ggblist->list, (GaimBlistNode*)buddy); } -GaimBlistUiOps *gg_get_blist_ui_ops() +GaimBlistUiOps *gg_blist_get_ui_ops() { return &blist_ui_ops; } @@ -118,9 +140,10 @@ void gg_blist_init() { - if (ggblist == NULL) - ggblist = g_new0(GGBlist, 1); + ggblist = g_new0(GGBlist, 1); + gaim_get_blist()->ui_data = ggblist; + ggblist->window = gnt_box_new(FALSE, FALSE); GNT_WIDGET_UNSET_FLAGS(ggblist->window, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List")); @@ -139,7 +162,7 @@ GAIM_CALLBACK(buddy_signed_off), ggblist); g_signal_connect(G_OBJECT(ggblist->tree), "activate", G_CALLBACK(selection_activate), ggblist); - + /*gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg", gg_blist_get_handle(),*/ /*GAIM_CALLBACK(received_im_msg), list);*/ /*gaim_signal_connect(gaim_conversations_get_handle(), "sent-im-msg", gg_blist_get_handle(),*/ Modified: trunk/console/gntblist.h =================================================================== --- trunk/console/gntblist.h 2006-06-23 08:42:07 UTC (rev 16315) +++ trunk/console/gntblist.h 2006-06-23 09:38:48 UTC (rev 16316) @@ -1,5 +1,5 @@ #include "blist.h" -GaimBlistUiOps * gg_get_blist_ui_ops(); +GaimBlistUiOps * gg_blist_get_ui_ops(); void gg_blist_init(); Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-06-23 08:42:07 UTC (rev 16315) +++ trunk/console/gntgaim.c 2006-06-23 09:38:48 UTC (rev 16316) @@ -171,8 +171,6 @@ /* Initialize the libgaim stuff */ init_libgaim(); - /* Connect to the signals */ - /* Enable the accounts and restore the status */ gaim_accounts_restore_current_statuses(); Modified: trunk/console/gntui.c =================================================================== --- trunk/console/gntui.c 2006-06-23 08:42:07 UTC (rev 16315) +++ trunk/console/gntui.c 2006-06-23 09:38:48 UTC (rev 16316) @@ -6,12 +6,11 @@ wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); werase(stdscr); - /*box(stdscr, ACS_VLINE, ACS_HLINE);*/ wrefresh(stdscr); /* Initialize the buddy list */ gg_blist_init(); - gaim_blist_set_ui_ops(gg_get_blist_ui_ops()); + gaim_blist_set_ui_ops(gg_blist_get_ui_ops()); gnt_main(); } Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-06-23 08:42:07 UTC (rev 16315) +++ trunk/console/libgnt/gnttree.c 2006-06-23 09:38:48 UTC (rev 16316) @@ -13,9 +13,11 @@ char *text; void *data; /* XXX: unused */ + /* XXX: These are also unused */ GntTreeRow *parent; GntTreeRow *child; GntTreeRow *next; + GntTreeRow *prev; }; static GntWidgetClass *parent_class = NULL; @@ -268,7 +270,9 @@ pr = g_hash_table_lookup(tree->hash, bigbro); if (pr) { + if (pr->next) pr->next->prev = row; row->next = pr->next; + row->prev = pr; pr->next = row; row->parent = pr->parent; @@ -281,6 +285,7 @@ pr = g_hash_table_lookup(tree->hash, parent); if (pr) { + if (pr->child) pr->child->prev = row; row->next = pr->child; pr->child = row; row->parent = pr; @@ -291,6 +296,7 @@ if (pr == NULL) { + if (tree->root) tree->root->prev = row; row->next = tree->root; tree->root = row; @@ -316,6 +322,7 @@ return tree->current; } +/* XXX: Should this also remove all the children of the row being removed? */ void gnt_tree_remove(GntTree *tree, gpointer key) { GntTreeRow *row = g_hash_table_lookup(tree->hash, key); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-06-23 08:42:11
|
Revision: 16315 Author: sadrul Date: 2006-06-23 01:42:07 -0700 (Fri, 23 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16315&view=rev Log Message: ----------- A GntTree can take focus. Modified Paths: -------------- trunk/console/libgnt/gnttree.c Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-06-23 06:24:25 UTC (rev 16314) +++ trunk/console/libgnt/gnttree.c 2006-06-23 08:42:07 UTC (rev 16315) @@ -207,6 +207,7 @@ tree->hash = g_hash_table_new(g_direct_hash, g_direct_equal); GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_SHADOW); + gnt_widget_set_take_focus(widget, TRUE); return widget; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-06-23 06:24:36
|
Revision: 16314 Author: sadrul Date: 2006-06-22 23:24:25 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16314&view=rev Log Message: ----------- New widget GntEntry. It's mostly functional. Some minor improvements to the box-packing code. Minor improvements to the skeleton code for gnt, and completely change the name from my initial choice of GN (Glib and Ncurses) to GNT (Gaim Ncurses Toolkit). Modified Paths: -------------- trunk/console/libgnt/Makefile trunk/console/libgnt/gnt-skel.c trunk/console/libgnt/gnt-skel.h trunk/console/libgnt/gntbox.c trunk/console/libgnt/gntcolors.c trunk/console/libgnt/gntkeys.h trunk/console/libgnt/gnttree.c trunk/console/libgnt/gntwidget.c trunk/console/libgnt/test.c Added Paths: ----------- trunk/console/libgnt/gntentry.c trunk/console/libgnt/gntentry.h Modified: trunk/console/libgnt/Makefile =================================================================== --- trunk/console/libgnt/Makefile 2006-06-23 00:57:30 UTC (rev 16313) +++ trunk/console/libgnt/Makefile 2006-06-23 06:24:25 UTC (rev 16314) @@ -6,6 +6,7 @@ gntbox.h \ gntbutton.h \ gntcolors.h \ + gntentry.h \ gntlabel.h \ gnttree.h \ gntutils.h \ @@ -16,6 +17,7 @@ gntbox.c \ gntbutton.c \ gntcolors.c \ + gntentry.c \ gntlabel.c \ gnttree.c \ gntutils.c \ @@ -26,6 +28,7 @@ gntbox.o \ gntbutton.o \ gntcolors.o \ + gntentry.o \ gntlabel.o \ gnttree.o \ gntutils.o \ @@ -34,11 +37,13 @@ all: libgnt test: $(OBJECTS) +key: $(OBJECTS) gntwidget.o: gntwidget.c $(HEADERS) gntbox.o: gntbox.c $(HEADERS) gntbutton.o: gntbutton.c $(HEADERS) gntcolors.o: gntcolors.c $(HEADERS) +gntentry.o: gntentry.c $(HEADERS) gntlabel.o: gntlabel.c $(HEADERS) gnttree.o: gnttree.c $(HEADERS) gntutils.o: gntutils.c $(HEADERS) Modified: trunk/console/libgnt/gnt-skel.c =================================================================== --- trunk/console/libgnt/gnt-skel.c 2006-06-23 00:57:30 UTC (rev 16313) +++ trunk/console/libgnt/gnt-skel.c 2006-06-23 06:24:25 UTC (rev 16314) @@ -1,4 +1,4 @@ -#include "gn-skel.h" +#include "gnt-skel.h" enum { @@ -34,11 +34,17 @@ } static void +gnt_skel_destroy(GntWidget *widget) +{ +} + +static void gnt_skel_class_init(GntWidgetClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS(klass); parent_class = GNT_WIDGET_CLASS(klass); + parent_class->destroy = gnt_skel_destroy; parent_class->draw = gnt_skel_draw; parent_class->map = gnt_skel_map; parent_class->size_request = gnt_skel_size_request; Modified: trunk/console/libgnt/gnt-skel.h =================================================================== --- trunk/console/libgnt/gnt-skel.h 2006-06-23 00:57:30 UTC (rev 16313) +++ trunk/console/libgnt/gnt-skel.h 2006-06-23 06:24:25 UTC (rev 16314) @@ -1,10 +1,10 @@ #ifndef GNT_SKEL_H #define GNT_SKEL_H -#include "gnwidget.h" -#include "gn.h" -#include "gncolors.h" -#include "gnkeys.h" +#include "gntwidget.h" +#include "gnt.h" +#include "gntcolors.h" +#include "gntkeys.h" #define GNT_TYPE_SKEL (gnt_skel_get_gtype()) #define GNT_SKEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_SKEL, GntSkel)) Modified: trunk/console/libgnt/gntbox.c =================================================================== --- trunk/console/libgnt/gntbox.c 2006-06-23 00:57:30 UTC (rev 16313) +++ trunk/console/libgnt/gntbox.c 2006-06-23 06:24:25 UTC (rev 16314) @@ -53,15 +53,13 @@ w = h = 0; max = -1; - curx = widget->priv.x + 1; - cury = widget->priv.y + 1; + curx = widget->priv.x; + cury = widget->priv.y; if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER)) { has_border = TRUE; - curx += box->pad; - cury += box->pad; - if (!box->vertical) - curx++; + curx += 1; + cury += 1; } for (iter = box->list; iter; iter = iter->next) @@ -84,7 +82,7 @@ if (has_border) { - curx += 2; + curx += 1; cury += 1; max += 2; } @@ -146,16 +144,44 @@ DEBUG; } +/* Ensures that the current widget can take focus */ +static void +ensure_active(GntBox *box) +{ + int investigated = 0; + int total; + + if (box->active == NULL) + box->active = box->list; + + total = g_list_length(box->list); + + while (box->active && !GNT_WIDGET_IS_FLAG_SET(box->active->data, GNT_WIDGET_CAN_TAKE_FOCUS)) + { + box->active = box->active->next; + investigated++; + } + + /* Rotate if necessary */ + if (!box->active && investigated < total) + { + box->active = box->list; + while (investigated < total && !GNT_WIDGET_IS_FLAG_SET(box->active->data, GNT_WIDGET_CAN_TAKE_FOCUS)) + { + box->active = box->active->next; + investigated++; + } + } +} + static gboolean gnt_box_key_pressed(GntWidget *widget, const char *text) { GntBox *box = GNT_BOX(widget); - /*if (box->list == NULL)*/ - /*return FALSE;*/ - + ensure_active(box); if (box->active == NULL) - box->active = box->list; + return FALSE; if (gnt_widget_key_pressed(box->active->data, text)) return TRUE; Modified: trunk/console/libgnt/gntcolors.c =================================================================== --- trunk/console/libgnt/gntcolors.c 2006-06-23 00:57:30 UTC (rev 16313) +++ trunk/console/libgnt/gntcolors.c 2006-06-23 06:24:25 UTC (rev 16314) @@ -19,6 +19,7 @@ init_pair(GNT_COLOR_HIGHLIGHT, GNT_COLOR_BLUE, GNT_COLOR_GRAY); init_pair(GNT_COLOR_SHADOW, GNT_COLOR_BLACK, GNT_COLOR_DARK_GRAY); init_pair(GNT_COLOR_TITLE, GNT_COLOR_WHITE, GNT_COLOR_DARK_GRAY); + init_pair(GNT_COLOR_TEXT_NORMAL, GNT_COLOR_BLACK, GNT_COLOR_GRAY); } else { @@ -26,6 +27,7 @@ init_pair(GNT_COLOR_HIGHLIGHT, COLOR_CYAN, COLOR_BLACK); init_pair(GNT_COLOR_SHADOW, COLOR_BLACK, COLOR_BLACK); init_pair(GNT_COLOR_TITLE, COLOR_WHITE, COLOR_BLACK); + init_pair(GNT_COLOR_TEXT_NORMAL, COLOR_BLACK, COLOR_WHITE); } } Added: trunk/console/libgnt/gntentry.c =================================================================== --- trunk/console/libgnt/gntentry.c (rev 0) +++ trunk/console/libgnt/gntentry.c 2006-06-23 06:24:25 UTC (rev 16314) @@ -0,0 +1,251 @@ +#include <string.h> +#include "gntentry.h" + +enum +{ + SIGS = 1, +}; + +static GntWidgetClass *parent_class = NULL; +static guint signals[SIGS] = { 0 }; + +static void +gnt_entry_draw(GntWidget *widget) +{ + GntEntry *entry = GNT_ENTRY(widget); + int stop; + + wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TEXT_NORMAL)); + mvwprintw(widget->window, 0, 0, entry->scroll); + + stop = entry->end - entry->scroll; + if (stop < widget->priv.width) + mvwhline(widget->window, 0, stop, ENTRY_CHAR, widget->priv.width - stop); + + wrefresh(widget->window); + + DEBUG; +} + +static void +gnt_entry_size_request(GntWidget *widget) +{ + GntEntry *entry = GNT_ENTRY(widget); + widget->priv.height = 1; + widget->priv.width = 20; +} + +static void +gnt_entry_map(GntWidget *widget) +{ + if (widget->priv.width == 0 || widget->priv.height == 0) + gnt_widget_size_request(widget); + DEBUG; +} + +static gboolean +gnt_entry_key_pressed(GntWidget *widget, const char *text) +{ + GntEntry *entry = GNT_ENTRY(widget); + + if (text[0] == 27) + { + if (strcmp(text + 1, GNT_KEY_DEL) == 0 && entry->cursor < entry->end) + { + memmove(entry->cursor, entry->cursor + 1, entry->end - entry->cursor + 1); + entry->end--; + gnt_entry_draw(widget); + } + else if (strcmp(text + 1, GNT_KEY_LEFT) == 0 && entry->cursor > entry->start) + { + entry->cursor--; + if (entry->cursor < entry->scroll) + entry->scroll--; + gnt_entry_draw(widget); + } + else if (strcmp(text + 1, GNT_KEY_RIGHT) == 0 && entry->cursor < entry->end) + { + entry->cursor++; + if (entry->cursor - entry->scroll > widget->priv.width) + entry->scroll++; + gnt_entry_draw(widget); + } + /* XXX: handle other keys, like home/end, and ctrl+ goodness */ + } + else + { + if (!iscntrl(text[0])) + { + int i; + + for (i = 0; text[i]; i++) + { + /* Valid input? */ + if (ispunct(text[i]) && (entry->flag & GNT_ENTRY_FLAG_NO_PUNCT)) + continue; + if (isspace(text[i]) && (entry->flag & GNT_ENTRY_FLAG_NO_SPACE)) + continue; + if (isalpha(text[i]) && !(entry->flag & GNT_ENTRY_FLAG_ALPHA)) + continue; + if (isdigit(text[i]) && !(entry->flag & GNT_ENTRY_FLAG_INT)) + continue; + + /* Reached the max? */ + if (entry->max && entry->end - entry->start >= entry->max) + continue; + + if (entry->end - entry->start >= entry->buffer) + { + char *tmp = g_strdup_printf(entry->start); + gnt_entry_set_text(entry, tmp); + g_free(tmp); + } + + *(entry->cursor) = text[i]; + entry->cursor++; + + entry->end++; + if (entry->cursor - entry->scroll > widget->priv.width) + entry->scroll++; + } + gnt_entry_draw(widget); + } + else + { + /* Backspace is here */ + if (strcmp(text, GNT_KEY_BACKSPACE) == 0 && entry->cursor > entry->start) + { + entry->cursor--; + memmove(entry->cursor, entry->cursor + 1, entry->end - entry->cursor); + entry->end--; + + if (entry->scroll > entry->start) + entry->scroll--; + + gnt_entry_draw(widget); + } + } + } + + return FALSE; +} + +static void +gnt_entry_destroy(GntWidget *widget) +{ + GntEntry *entry = GNT_ENTRY(widget); + g_free(entry->start); +} + +static void +gnt_entry_class_init(GntWidgetClass *klass) +{ + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + + parent_class = GNT_WIDGET_CLASS(klass); + parent_class->destroy = gnt_entry_destroy; + parent_class->draw = gnt_entry_draw; + parent_class->map = gnt_entry_map; + parent_class->size_request = gnt_entry_size_request; + parent_class->key_pressed = gnt_entry_key_pressed; + + DEBUG; +} + +static void +gnt_entry_init(GTypeInstance *instance, gpointer class) +{ + GntEntry *entry = GNT_ENTRY(instance); + + entry->flag = GNT_ENTRY_FLAG_ALL; + entry->max = 0; + + GNT_WIDGET_SET_FLAGS(GNT_WIDGET(entry), + GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW | GNT_WIDGET_CAN_TAKE_FOCUS); + + DEBUG; +} + +/****************************************************************************** + * GntEntry API + *****************************************************************************/ +GType +gnt_entry_get_gtype(void) +{ + static GType type = 0; + + if(type == 0) + { + static const GTypeInfo info = { + sizeof(GntEntryClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)gnt_entry_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GntEntry), + 0, /* n_preallocs */ + gnt_entry_init, /* instance_init */ + }; + + type = g_type_register_static(GNT_TYPE_WIDGET, + "GntEntry", + &info, 0); + } + + return type; +} + +GntWidget *gnt_entry_new(const char *text) +{ + GntWidget *widget = g_object_new(GNT_TYPE_ENTRY, NULL); + GntEntry *entry = GNT_ENTRY(widget); + + gnt_entry_set_text(entry, text); + + return widget; +} + +void gnt_entry_set_text(GntEntry *entry, const char *text) +{ + int len; + int scroll, cursor; + + g_free(entry->start); + + if (text && text[0]) + { + len = g_utf8_strlen(text, -1); + entry->buffer = len * 2; + } + else + { + entry->buffer = 128; + len = 0; + } + + scroll = entry->scroll - entry->start; + cursor = entry->end - entry->cursor; + + entry->start = g_new0(char, entry->buffer); + if (text) + snprintf(entry->start, len + 1, "%s", text); + entry->end = entry->start + len; + + entry->scroll = entry->start + scroll; + entry->cursor = entry->end - cursor; + + /* XXX: redraw if necessary? */ +} + +void gnt_entry_set_max(GntEntry *entry, int max) +{ + entry->max = max; +} + +void gnt_entry_set_flag(GntEntry *entry, GntEntryFlag flag) +{ + entry->flag = flag; + /* XXX: Check the existing string to make sure the flags are respected? */ +} + Property changes on: trunk/console/libgnt/gntentry.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntentry.h =================================================================== --- trunk/console/libgnt/gntentry.h (rev 0) +++ trunk/console/libgnt/gntentry.h 2006-06-23 06:24:25 UTC (rev 16314) @@ -0,0 +1,78 @@ +#ifndef GNT_ENTRY_H +#define GNT_ENTRY_H + +#include "gntwidget.h" +#include "gnt.h" +#include "gntcolors.h" +#include "gntkeys.h" + +#define GNT_TYPE_ENTRY (gnt_entry_get_gtype()) +#define GNT_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_ENTRY, GntEntry)) +#define GNT_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_ENTRY, GntEntryClass)) +#define GNT_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_ENTRY)) +#define GNT_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_ENTRY)) +#define GNT_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_ENTRY, GntEntryClass)) + +#define GNT_ENTRY_FLAGS(obj) (GNT_ENTRY(obj)->priv.flags) +#define GNT_ENTRY_SET_FLAGS(obj, flags) (GNT_ENTRY_FLAGS(obj) |= flags) +#define GNT_ENTRY_UNSET_FLAGS(obj, flags) (GNT_ENTRY_FLAGS(obj) &= ~(flags)) + +#define ENTRY_CHAR '_' /* The character to use to fill in the blank places */ + +typedef struct _GnEntry GntEntry; +typedef struct _GnEntryPriv GntEntryPriv; +typedef struct _GnEntryClass GntEntryClass; + +typedef enum +{ + GNT_ENTRY_FLAG_ALPHA = 1 << 0, /* Only alpha */ + GNT_ENTRY_FLAG_INT = 1 << 1, /* Only integer */ + GNT_ENTRY_FLAG_NO_SPACE = 1 << 2, /* No blank space is allowed */ + GNT_ENTRY_FLAG_NO_PUNCT = 1 << 3, /* No punctuations */ + GNT_ENTRY_FLAG_MASK = 1 << 4, /* Mask the inputs */ +} GntEntryFlag; + +#define GNT_ENTRY_FLAG_ALL (GNT_ENTRY_FLAG_ALPHA | GNT_ENTRY_FLAG_INT) + +struct _GnEntry +{ + GntWidget parent; + + GntEntryFlag flag; + + char *start; + char *end; + char *scroll; /* Current scrolling position */ + char *cursor; /* Cursor location */ + /* 0 <= cursor - scroll < widget-width */ + + size_t buffer; /* Size of the buffer */ + + int max; /* 0 means infinite */ +}; + +struct _GnEntryClass +{ + GntWidgetClass parent; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +G_BEGIN_DECLS + +GType gnt_entry_get_gtype(void); + +GntWidget *gnt_entry_new(const char *text); + +void gnt_entry_set_max(GntEntry *entry, int max); + +void gnt_entry_set_text(GntEntry *entry, const char *text); + +void gnt_entry_set_flag(GntEntry *entry, GntEntryFlag flag); + +G_END_DECLS + +#endif /* GNT_ENTRY_H */ Property changes on: trunk/console/libgnt/gntentry.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/console/libgnt/gntkeys.h =================================================================== --- trunk/console/libgnt/gntkeys.h 2006-06-23 00:57:30 UTC (rev 16313) +++ trunk/console/libgnt/gntkeys.h 2006-06-23 06:24:25 UTC (rev 16314) @@ -1,14 +1,17 @@ #ifndef GNT_KEYS_H #define GNT_KEYS_H -#define GNT_KEY_POPUP "[29~" +#define GNT_KEY_POPUP "[29~" /* Arrow keys */ -#define GNT_KEY_LEFT "[D" -#define GNT_KEY_RIGHT "[C" -#define GNT_KEY_UP "[A" -#define GNT_KEY_DOWN "[B" +#define GNT_KEY_LEFT "[D" +#define GNT_KEY_RIGHT "[C" +#define GNT_KEY_UP "[A" +#define GNT_KEY_DOWN "[B" -#define GNT_KEY_ENTER "\r" +#define GNT_KEY_ENTER "\r" +#define GNT_KEY_BACKSPACE "\177" +#define GNT_KEY_DEL "[3~" + #endif Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-06-23 00:57:30 UTC (rev 16313) +++ trunk/console/libgnt/gnttree.c 2006-06-23 06:24:25 UTC (rev 16314) @@ -46,11 +46,11 @@ if ((wr = snprintf(str, widget->priv.width, "%s", row->text)) >= widget->priv.width) { /* XXX: ellipsize */ - str[widget->priv.width - 1] = 0; + str[widget->priv.width - 1 - pos] = 0; } else { - while (wr < widget->priv.width - 1) + while (wr < widget->priv.width - 1 - pos) str[wr++] = ' '; str[wr] = 0; } @@ -67,8 +67,8 @@ while (start < tree->bottom) { - wmove(widget->window, start - tree->top + pos, pos); - wclrtoeol(widget->window); + mvwhline(widget->window, start - tree->top + pos, pos, ' ', + widget->priv.width - pos * 2); start++; } Modified: trunk/console/libgnt/gntwidget.c =================================================================== --- trunk/console/libgnt/gntwidget.c 2006-06-23 00:57:30 UTC (rev 16313) +++ trunk/console/libgnt/gntwidget.c 2006-06-23 06:24:25 UTC (rev 16314) @@ -286,6 +286,8 @@ gnt_widget_key_pressed(GntWidget *widget, const char *keys) { gboolean ret; + if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS)) + return FALSE; g_signal_emit(widget, signals[SIG_KEY_PRESSED], 0, keys, &ret); return ret; } Modified: trunk/console/libgnt/test.c =================================================================== --- trunk/console/libgnt/test.c 2006-06-23 00:57:30 UTC (rev 16313) +++ trunk/console/libgnt/test.c 2006-06-23 06:24:25 UTC (rev 16314) @@ -90,8 +90,10 @@ gnt_box_add_widget(GNT_BOX(vbox), widget2); gnt_box_add_widget(GNT_BOX(hbox), label); - gnt_box_add_widget(GNT_BOX(hbox), vbox); + /*gnt_box_add_widget(GNT_BOX(hbox), vbox);*/ + gnt_box_add_widget(GNT_BOX(hbox), gnt_entry_new("a")); + tree = gnt_tree_new(); gnt_box_add_widget(GNT_BOX(hbox), tree); @@ -106,11 +108,11 @@ /*gnt_widget_set_take_focus(vbox, TRUE);*/ /*gnt_widget_set_take_focus(hbox, TRUE);*/ - gnt_widget_set_position(hbox, 10, 10); + /*gnt_widget_set_position(hbox, 10, 10);*/ gnt_widget_show(hbox); - g_signal_connect(hbox, "key_pressed", G_CALLBACK(key_pressed), widget); + /*g_signal_connect(hbox, "key_pressed", G_CALLBACK(key_pressed), widget);*/ g_signal_connect(widget, "activate", G_CALLBACK(button1), hbox); g_signal_connect(widget2, "activate", G_CALLBACK(button2), hbox); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-06-23 00:57:36
|
Revision: 16313 Author: sadrul Date: 2006-06-22 17:57:30 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16313&view=rev Log Message: ----------- Unnecessary variables are bad, mmkay. Modified Paths: -------------- trunk/console/libgnt/gntbox.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/gnttree.h Modified: trunk/console/libgnt/gntbox.c =================================================================== --- trunk/console/libgnt/gntbox.c 2006-06-23 00:45:45 UTC (rev 16312) +++ trunk/console/libgnt/gntbox.c 2006-06-23 00:57:30 UTC (rev 16313) @@ -50,7 +50,6 @@ GntBox *box = GNT_BOX(widget); int w, h, curx, cury, max; gboolean has_border = FALSE; - int x, y; w = h = 0; max = -1; Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-06-23 00:45:45 UTC (rev 16312) +++ trunk/console/libgnt/gnttree.c 2006-06-23 00:57:30 UTC (rev 16313) @@ -34,7 +34,7 @@ else pos = 1; - wbkgd(tree->scroll, COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL)); for (start = tree->top, iter = g_list_nth(tree->list, tree->top); iter && start < tree->bottom; start++, iter = iter->next) @@ -57,18 +57,18 @@ if (start == tree->current) { - wbkgdset(tree->scroll, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); - mvwprintw(tree->scroll, start - tree->top + pos, pos, str); - wbkgdset(tree->scroll, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); + mvwprintw(widget->window, start - tree->top + pos, pos, str); + wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); } else - mvwprintw(tree->scroll, start - tree->top + pos, pos, str); + mvwprintw(widget->window, start - tree->top + pos, pos, str); } while (start < tree->bottom) { - wmove(tree->scroll, start - tree->top + pos, pos); - wclrtoeol(tree->scroll); + wmove(widget->window, start - tree->top + pos, pos); + wclrtoeol(widget->window); start++; } @@ -80,22 +80,13 @@ { GntTree *tree = GNT_TREE(widget); - /* For the Tree (or anything that scrolls), we will create a 'hidden' window - * of 'large enough' size. We never wrefresh that hidden-window, instead we - * just copy stuff from it into the visible window */ + scrollok(widget->window, TRUE); + wsetscrreg(widget->window, 0, widget->priv.height - 1); - if (tree->scroll == NULL) - { - tree->scroll = widget->window; /* newwin(SCROLL_HEIGHT, widget->priv.width, 0, 0); */ - scrollok(tree->scroll, TRUE); - /*wsetscrreg(tree->scroll, 0, SCROLL_HEIGHT - 1);*/ - wsetscrreg(tree->scroll, 0, widget->priv.height - 1); + tree->top = 0; + tree->bottom = widget->priv.height - + (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER) ? 0 : 2); - tree->top = 0; - tree->bottom = widget->priv.height - - (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER) ? 0 : 2); - } - redraw_tree(tree); DEBUG; Modified: trunk/console/libgnt/gnttree.h =================================================================== --- trunk/console/libgnt/gnttree.h 2006-06-23 00:45:45 UTC (rev 16312) +++ trunk/console/libgnt/gnttree.h 2006-06-23 00:57:30 UTC (rev 16313) @@ -27,8 +27,6 @@ { GntWidget parent; - WINDOW *scroll; - int current; /* current selection */ int top; /* The index in 'list' of the topmost visible item */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-06-23 00:45:52
|
Revision: 16312 Author: sadrul Date: 2006-06-22 17:45:45 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16312&view=rev Log Message: ----------- Improvement/fixing of GntTree. Do the scrolling and stuff without 'reliably'. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/libgnt/gntbox.c trunk/console/libgnt/gntbox.h trunk/console/libgnt/gnttree.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-06-22 23:08:05 UTC (rev 16311) +++ trunk/console/gntblist.c 2006-06-23 00:45:45 UTC (rev 16312) @@ -8,39 +8,55 @@ #include "gntbox.h" #include "gnttree.h" +#include "gntblist.h" + #define TAB_SIZE 3 -/** - * NOTES: - * - * 1. signal-callbacks should check for module_in_focus() before redrawing anything. - * 2. call module_lost_focus() before opening a new window, and module_gained_focus() when - * the new window is closed. This is to make sure the signal callbacks don't screw up - * the display. - */ +typedef struct +{ + GntWidget *window; + GntWidget *tree; +} GGBlist; +GGBlist *ggblist; + +static void +new_node(GaimBlistNode *node) +{ +} + +static void +node_update(GaimBuddyList *list, GaimBlistNode *node) +{ +} + +static void +node_remove(GaimBuddyList *list, GaimBlistNode *node) +{ +} + +static void +new_list(GaimBuddyList *list) +{ + if (ggblist == NULL) + gg_blist_init(); + list->ui_data = ggblist; +} + static GaimBlistUiOps blist_ui_ops = { + new_list, + new_node, NULL, + node_update, /* This doesn't do crap */ + node_remove, NULL, NULL, - NULL, /* This doesn't do crap */ NULL, NULL, - NULL, - NULL, - NULL, NULL }; -typedef struct -{ - GntWidget *window; - GntWidget *tree; -} GGBlist; - -GGBlist *ggblist; - static gpointer gg_blist_get_handle() { @@ -61,11 +77,15 @@ } static void -buddy_signed_on(GaimBuddy *buddy, GGBlist *ggblist) +add_buddy(GaimBuddy *buddy, GGBlist *ggblist) { - GaimGroup *group = gaim_buddy_get_group(buddy); char *text; + GaimGroup *group; + GaimBlistNode *node = (GaimBlistNode *)buddy; + if (node->ui_data) + return; + group = gaim_buddy_get_group(buddy); add_group(group, ggblist); text = g_strdup_printf("%*s%s", TAB_SIZE, "", gaim_buddy_get_alias(buddy)); @@ -74,6 +94,12 @@ } static void +buddy_signed_on(GaimBuddy *buddy, GGBlist *ggblist) +{ + add_buddy(buddy, ggblist); +} + +static void buddy_signed_off(GaimBuddy *buddy, GGBlist *ggblist) { gnt_tree_remove(GNT_TREE(ggblist->tree), buddy); @@ -92,13 +118,17 @@ void gg_blist_init() { - ggblist = g_new0(GGBlist, 1); + if (ggblist == NULL) + ggblist = g_new0(GGBlist, 1); ggblist->window = gnt_box_new(FALSE, FALSE); + GNT_WIDGET_UNSET_FLAGS(ggblist->window, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List")); + gnt_box_set_pad(GNT_BOX(ggblist->window), 0); ggblist->tree = gnt_tree_new(); - gnt_widget_set_size(ggblist->tree, 25, getmaxy(stdscr)); + GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER); + gnt_widget_set_size(ggblist->tree, 25, getmaxy(stdscr) - 2); gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); gnt_widget_show(ggblist->window); Modified: trunk/console/libgnt/gntbox.c =================================================================== --- trunk/console/libgnt/gntbox.c 2006-06-22 23:08:05 UTC (rev 16311) +++ trunk/console/libgnt/gntbox.c 2006-06-23 00:45:45 UTC (rev 16312) @@ -31,8 +31,8 @@ } else { + /* XXX: Position of the title might be configurable */ pos = (widget->priv.width - pos - 2) / 2; - /*pos = 2;*/ } wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TITLE)); mvwprintw(widget->window, 0, pos, title); @@ -52,17 +52,15 @@ gboolean has_border = FALSE; int x, y; - x = widget->priv.x; - y = widget->priv.y; w = h = 0; max = -1; - curx = widget->priv.x; - cury = widget->priv.y; + curx = widget->priv.x + 1; + cury = widget->priv.y + 1; if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER)) { has_border = TRUE; - curx += 1; - cury += 1; + curx += box->pad; + cury += box->pad; if (!box->vertical) curx++; } @@ -73,13 +71,13 @@ gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h); if (box->vertical) { - cury += h + 1; + cury += h + box->pad; if (max < w) max = w; } else { - curx += w + 2; + curx += w + box->pad; if (max < h) max = h; } @@ -303,6 +301,7 @@ box->homogeneous = homo; box->vertical = vert; + box->pad = 1; gnt_widget_set_take_focus(widget, TRUE); GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); @@ -321,3 +320,9 @@ b->title = g_strdup(title); } +void gnt_box_set_pad(GntBox *box, int pad) +{ + box->pad = pad; + /* XXX: Perhaps redraw if already showing? */ +} + Modified: trunk/console/libgnt/gntbox.h =================================================================== --- trunk/console/libgnt/gntbox.h 2006-06-22 23:08:05 UTC (rev 16311) +++ trunk/console/libgnt/gntbox.h 2006-06-23 00:45:45 UTC (rev 16312) @@ -23,6 +23,7 @@ GList *list; /* List of widgets */ GList *active; + int pad; /* Number of spaces to use between widgets */ char *title; @@ -52,6 +53,8 @@ void gnt_box_set_title(GntBox *box, const char *title); +void gnt_box_set_pad(GntBox *box, int pad); + G_END_DECLS #endif /* GNT_BOX_H */ Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-06-22 23:08:05 UTC (rev 16311) +++ trunk/console/libgnt/gnttree.c 2006-06-23 00:45:45 UTC (rev 16312) @@ -21,11 +21,12 @@ static GntWidgetClass *parent_class = NULL; static guint signals[SIGS] = { 0 }; -/* XXX: This is ugly, but what can you do ... */ static void -gnt_tree_refresh(GntTree *tree) +redraw_tree(GntTree *tree) { + int start; GntWidget *widget = GNT_WIDGET(tree); + GList *iter; int pos; if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) @@ -33,50 +34,45 @@ else pos = 1; - copywin(tree->scroll, widget->window, tree->top, 0, - pos, pos, widget->priv.height - pos - 1, widget->priv.width - pos - 1, FALSE); - wrefresh(widget->window); -} - -static void -redraw_tree(GntTree *tree) -{ - int start; - GntWidget *widget = GNT_WIDGET(tree); - GList *iter; - wbkgd(tree->scroll, COLOR_PAIR(GNT_COLOR_NORMAL)); for (start = tree->top, iter = g_list_nth(tree->list, tree->top); iter && start < tree->bottom; start++, iter = iter->next) { char str[2096]; /* XXX: This should be safe for any terminal */ + int wr; GntTreeRow *row = g_hash_table_lookup(tree->hash, iter->data); - if (snprintf(str, widget->priv.width, "%s\n", row->text) >= widget->priv.width) + if ((wr = snprintf(str, widget->priv.width, "%s", row->text)) >= widget->priv.width) { /* XXX: ellipsize */ str[widget->priv.width - 1] = 0; } + else + { + while (wr < widget->priv.width - 1) + str[wr++] = ' '; + str[wr] = 0; + } if (start == tree->current) { wbkgdset(tree->scroll, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); - mvwprintw(tree->scroll, start, 0, str); + mvwprintw(tree->scroll, start - tree->top + pos, pos, str); wbkgdset(tree->scroll, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); } else - mvwprintw(tree->scroll, start, 0, str); + mvwprintw(tree->scroll, start - tree->top + pos, pos, str); } while (start < tree->bottom) { - wmove(tree->scroll, start, 0); + wmove(tree->scroll, start - tree->top + pos, pos); wclrtoeol(tree->scroll); start++; } - gnt_tree_refresh(tree); + wrefresh(widget->window); } static void @@ -90,9 +86,10 @@ if (tree->scroll == NULL) { - tree->scroll = newwin(SCROLL_HEIGHT, widget->priv.width, widget->priv.y, widget->priv.x); + tree->scroll = widget->window; /* newwin(SCROLL_HEIGHT, widget->priv.width, 0, 0); */ scrollok(tree->scroll, TRUE); - wsetscrreg(tree->scroll, 0, SCROLL_HEIGHT - 1); + /*wsetscrreg(tree->scroll, 0, SCROLL_HEIGHT - 1);*/ + wsetscrreg(tree->scroll, 0, widget->priv.height - 1); tree->top = 0; tree->bottom = widget->priv.height - @@ -132,14 +129,16 @@ tree->current++; if (tree->current >= tree->bottom) gnt_tree_scroll(tree, 1 + tree->current - tree->bottom); - redraw_tree(tree); + else + redraw_tree(tree); } else if (strcmp(text+1, GNT_KEY_UP) == 0 && tree->current > 0) { tree->current--; if (tree->current < tree->top) gnt_tree_scroll(tree, tree->current - tree->top); - redraw_tree(tree); + else + redraw_tree(tree); } } else if (text[0] == '\r') @@ -216,6 +215,7 @@ GntTree *tree = GNT_TREE(widget); tree->hash = g_hash_table_new(g_direct_hash, g_direct_equal); + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_SHADOW); return widget; } @@ -249,8 +249,7 @@ tree->top += count; tree->bottom += count; - /*wscrl(tree->scroll, count);*/ - gnt_tree_refresh(tree); + redraw_tree(tree); } void gnt_tree_add_row_after(GntTree *tree, void *key, const char *text, void *parent, void *bigbro) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-06-22 23:08:09
|
Revision: 16311 Author: sadrul Date: 2006-06-22 16:08:05 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16311&view=rev Log Message: ----------- We don't want threads. Modified Paths: -------------- trunk/console/Makefile trunk/console/gntgaim.c Modified: trunk/console/Makefile =================================================================== --- trunk/console/Makefile 2006-06-22 22:38:03 UTC (rev 16310) +++ trunk/console/Makefile 2006-06-22 23:08:05 UTC (rev 16311) @@ -1,5 +1,5 @@ CFLAGS=`pkg-config --cflags gaim gobject-2.0` -g -I./libgnt/ -LDFLAGS=`pkg-config --libs gaim gobject-2.0 gthread-2.0 libxml-2.0` -lncursesw -L./libgnt/ -lgnt +LDFLAGS=`pkg-config --libs gaim gobject-2.0 libxml-2.0` -lncursesw -L./libgnt/ -lgnt GG_SOURCES = \ gntblist.c \ Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-06-22 22:38:03 UTC (rev 16310) +++ trunk/console/gntgaim.c 2006-06-22 23:08:05 UTC (rev 16311) @@ -168,8 +168,6 @@ int main(int argc, char **argv) { - GMainLoop *loop; - /* Initialize the libgaim stuff */ init_libgaim(); @@ -178,11 +176,6 @@ /* Enable the accounts and restore the status */ gaim_accounts_restore_current_statuses(); - /* Main loop */ - g_thread_init(NULL); - loop = g_main_loop_new(NULL, TRUE); - g_thread_create((GThreadFunc)g_main_loop_run, loop, FALSE, NULL); - /* Initialize the UI */ init_gnt_ui(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-06-22 22:38:09
|
Revision: 16310 Author: sadrul Date: 2006-06-22 15:38:03 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16310&view=rev Log Message: ----------- The colors should now look 'better' in terminals that don't apparently allow changing colors. Modified Paths: -------------- trunk/console/libgnt/gntcolors.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/test.c Modified: trunk/console/libgnt/gntcolors.c =================================================================== --- trunk/console/libgnt/gntcolors.c 2006-06-22 11:12:40 UTC (rev 16309) +++ trunk/console/libgnt/gntcolors.c 2006-06-22 22:38:03 UTC (rev 16310) @@ -3,19 +3,29 @@ void gnt_init_colors() { - /* XXX: Do some init_color()s */ - init_color(GNT_COLOR_BLACK, 0, 0, 0); - init_color(GNT_COLOR_RED, 1000, 0, 0); - init_color(GNT_COLOR_GREEN, 0, 1000, 0); - init_color(GNT_COLOR_BLUE, 0, 0, 1000); - init_color(GNT_COLOR_WHITE, 1000, 1000, 1000); - init_color(GNT_COLOR_GRAY, 799, 799, 799); - init_color(GNT_COLOR_DARK_GRAY, 256, 256, 256); + if (can_change_color()) + { + /* XXX: Do some init_color()s */ + init_color(GNT_COLOR_BLACK, 0, 0, 0); + init_color(GNT_COLOR_RED, 1000, 0, 0); + init_color(GNT_COLOR_GREEN, 0, 1000, 0); + init_color(GNT_COLOR_BLUE, 0, 0, 1000); + init_color(GNT_COLOR_WHITE, 1000, 1000, 1000); + init_color(GNT_COLOR_GRAY, 799, 799, 799); + init_color(GNT_COLOR_DARK_GRAY, 256, 256, 256); - /* Now some init_pair()s */ - init_pair(GNT_COLOR_NORMAL, GNT_COLOR_BLACK, GNT_COLOR_WHITE); - init_pair(GNT_COLOR_HIGHLIGHT, GNT_COLOR_BLUE, GNT_COLOR_GRAY); - init_pair(GNT_COLOR_SHADOW, GNT_COLOR_BLACK, GNT_COLOR_DARK_GRAY); - init_pair(GNT_COLOR_TITLE, GNT_COLOR_WHITE, GNT_COLOR_DARK_GRAY); + /* Now some init_pair()s */ + init_pair(GNT_COLOR_NORMAL, GNT_COLOR_BLACK, GNT_COLOR_WHITE); + init_pair(GNT_COLOR_HIGHLIGHT, GNT_COLOR_BLUE, GNT_COLOR_GRAY); + init_pair(GNT_COLOR_SHADOW, GNT_COLOR_BLACK, GNT_COLOR_DARK_GRAY); + init_pair(GNT_COLOR_TITLE, GNT_COLOR_WHITE, GNT_COLOR_DARK_GRAY); + } + else + { + init_pair(GNT_COLOR_NORMAL, COLOR_BLACK, COLOR_WHITE); + init_pair(GNT_COLOR_HIGHLIGHT, COLOR_CYAN, COLOR_BLACK); + init_pair(GNT_COLOR_SHADOW, COLOR_BLACK, COLOR_BLACK); + init_pair(GNT_COLOR_TITLE, COLOR_WHITE, COLOR_BLACK); + } } Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-06-22 11:12:40 UTC (rev 16309) +++ trunk/console/libgnt/gnttree.c 2006-06-22 22:38:03 UTC (rev 16310) @@ -47,14 +47,17 @@ wbkgd(tree->scroll, COLOR_PAIR(GNT_COLOR_NORMAL)); - /* XXX: Add the rows */ for (start = tree->top, iter = g_list_nth(tree->list, tree->top); iter && start < tree->bottom; start++, iter = iter->next) { char str[2096]; /* XXX: This should be safe for any terminal */ GntTreeRow *row = g_hash_table_lookup(tree->hash, iter->data); - snprintf(str, widget->priv.width - 2, "%s\n", row->text); + if (snprintf(str, widget->priv.width, "%s\n", row->text) >= widget->priv.width) + { + /* XXX: ellipsize */ + str[widget->priv.width - 1] = 0; + } if (start == tree->current) { @@ -83,7 +86,7 @@ /* For the Tree (or anything that scrolls), we will create a 'hidden' window * of 'large enough' size. We never wrefresh that hidden-window, instead we - * just 'scroll' it, and wrefresh the subwindow */ + * just copy stuff from it into the visible window */ if (tree->scroll == NULL) { Modified: trunk/console/libgnt/test.c =================================================================== --- trunk/console/libgnt/test.c 2006-06-22 11:12:40 UTC (rev 16309) +++ trunk/console/libgnt/test.c 2006-06-22 22:38:03 UTC (rev 16310) @@ -2,12 +2,22 @@ #include "gnt.h" #include "gntkeys.h" #include "gnttree.h" +#include "gntbox.h" static gboolean key_pressed(GntWidget *widget, const char *text, gpointer null) { GntWidget *w = null; + GntWidget *box = gnt_box_new(FALSE, FALSE); + GntWidget *label = gnt_label_new("so wassup!!"); + gnt_box_add_widget(GNT_BOX(box), label); + GNT_WIDGET_UNSET_FLAGS(box, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); + gnt_box_set_title(GNT_BOX(box), "This is a test"); + + gnt_widget_show(box); +#if 0 + gnt_widget_set_focus(w, TRUE); /* XXX: This is to just test stuff */ @@ -24,6 +34,7 @@ } gnt_widget_draw(w); +#endif return FALSE; } @@ -75,14 +86,14 @@ gnt_widget_set_name(widget, "widget"); gnt_widget_set_name(widget2, "widget2"); - gnt_box_add_widget(vbox, widget); - gnt_box_add_widget(vbox, widget2); + gnt_box_add_widget(GNT_BOX(vbox), widget); + gnt_box_add_widget(GNT_BOX(vbox), widget2); - gnt_box_add_widget(hbox, label); - gnt_box_add_widget(hbox, vbox); + gnt_box_add_widget(GNT_BOX(hbox), label); + gnt_box_add_widget(GNT_BOX(hbox), vbox); tree = gnt_tree_new(); - gnt_box_add_widget(hbox, tree); + gnt_box_add_widget(GNT_BOX(hbox), tree); gnt_tree_add_row_after(GNT_TREE(tree), "a", "a", NULL, NULL); gnt_tree_add_row_after(GNT_TREE(tree), "c", "c", NULL, NULL); @@ -91,7 +102,7 @@ gnt_tree_add_row_after(GNT_TREE(tree), "b", "b", "d", NULL); GNT_WIDGET_UNSET_FLAGS(hbox, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); - gnt_box_set_title(hbox, "111111111111111111111111111111111111111111111111111111111111111This is the title …"); + gnt_box_set_title(GNT_BOX(hbox), "111111111111111111111111111111111111111111111111111111111111111This is the title …"); /*gnt_widget_set_take_focus(vbox, TRUE);*/ /*gnt_widget_set_take_focus(hbox, TRUE);*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <may...@us...> - 2006-06-22 11:12:56
|
Revision: 16309 Author: mayuan2006 Date: 2006-06-22 04:12:40 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16309&view=rev Log Message: ----------- created by MaYuan<may...@gm...>to do the Gaim Google SoC 2006 MSNP13 Implementation Added Paths: ----------- branches/soc-2006-msnp13/ Copied: branches/soc-2006-msnp13 (from rev 16308, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-06-22 08:34:17
|
Revision: 16308 Author: sadrul Date: 2006-06-22 01:33:54 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16308&view=rev Log Message: ----------- This is my first commit here. So don't yell at me if things get borked. Also, I haven't looked at the auto-thingies yet. So don't puke at the Makefiles. Files in console/libgnt/ are for the 'Gaim/GObjectified Ncurses Toolkit' library. Files in console/ uses libgaim and libgnt. Currently, only the buddylist-ui is 'functional', ie. the buddy-list updates when someone logs on or logs off. It still needs a lot of work. Added Paths: ----------- trunk/console/ trunk/console/Makefile trunk/console/gntblist.c trunk/console/gntblist.h trunk/console/gntgaim.c trunk/console/gntgaim.h trunk/console/gntui.c trunk/console/gntui.h trunk/console/libgnt/ trunk/console/libgnt/Makefile trunk/console/libgnt/gnt-skel.c trunk/console/libgnt/gnt-skel.h trunk/console/libgnt/gnt.h trunk/console/libgnt/gntbox.c trunk/console/libgnt/gntbox.h trunk/console/libgnt/gntbutton.c trunk/console/libgnt/gntbutton.h trunk/console/libgnt/gntcolors.c trunk/console/libgnt/gntcolors.h trunk/console/libgnt/gntkeys.h trunk/console/libgnt/gntlabel.c trunk/console/libgnt/gntlabel.h trunk/console/libgnt/gntmain.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/gnttree.h trunk/console/libgnt/gntutils.c trunk/console/libgnt/gntutils.h trunk/console/libgnt/gntwidget.c trunk/console/libgnt/gntwidget.h trunk/console/libgnt/test.c Added: trunk/console/Makefile =================================================================== --- trunk/console/Makefile (rev 0) +++ trunk/console/Makefile 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,27 @@ +CFLAGS=`pkg-config --cflags gaim gobject-2.0` -g -I./libgnt/ +LDFLAGS=`pkg-config --libs gaim gobject-2.0 gthread-2.0 libxml-2.0` -lncursesw -L./libgnt/ -lgnt + +GG_SOURCES = \ + gntblist.c \ + gntui.c + +GG_HEADERS = \ + gntblist.h \ + gntui.h + +GG_OBJECTS = \ + gntblist.o \ + gntui.o + +all: gntgaim + +gntgaim: gntgaim.o $(GG_OBJECTS) + $(CC) -o gntgaim gntgaim.o $(GG_OBJECTS) $(LDFLAGS) +gntblist.o: gntblist.c $(GG_HEADERS) +gntgaim.o: gntgaim.c gntgaim.h $(GG_HEADERS) +gntui.o: gntui.c $(GG_HEADERS) + +clean: + rm *.o + rm gntgaim + Property changes on: trunk/console/Makefile ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c (rev 0) +++ trunk/console/gntblist.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,121 @@ +#include <gaim/account.h> +#include <gaim/blist.h> +#include <signal.h> +#include <gaim/util.h> +#include <gaim/server.h> + +#include "gntgaim.h" +#include "gntbox.h" +#include "gnttree.h" + +#define TAB_SIZE 3 + +/** + * NOTES: + * + * 1. signal-callbacks should check for module_in_focus() before redrawing anything. + * 2. call module_lost_focus() before opening a new window, and module_gained_focus() when + * the new window is closed. This is to make sure the signal callbacks don't screw up + * the display. + */ + +static GaimBlistUiOps blist_ui_ops = +{ + NULL, + NULL, + NULL, + NULL, /* This doesn't do crap */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +typedef struct +{ + GntWidget *window; + GntWidget *tree; +} GGBlist; + +GGBlist *ggblist; + +static gpointer +gg_blist_get_handle() +{ + static int handle; + + return &handle; +} + +static void +add_group(GaimGroup *group, GGBlist *ggblist) +{ + GaimBlistNode *node = (GaimBlistNode *)group; + if (node->ui_data) + return; + gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, + group->name, NULL, NULL); + node->ui_data = GINT_TO_POINTER(TRUE); +} + +static void +buddy_signed_on(GaimBuddy *buddy, GGBlist *ggblist) +{ + GaimGroup *group = gaim_buddy_get_group(buddy); + char *text; + + add_group(group, ggblist); + + text = g_strdup_printf("%*s%s", TAB_SIZE, "", gaim_buddy_get_alias(buddy)); + gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, text, group, NULL); + g_free(text); +} + +static void +buddy_signed_off(GaimBuddy *buddy, GGBlist *ggblist) +{ + gnt_tree_remove(GNT_TREE(ggblist->tree), buddy); +} + +GaimBlistUiOps *gg_get_blist_ui_ops() +{ + return &blist_ui_ops; +} + +static void +selection_activate(GntWidget *widget, GGBlist *ggblist) +{ + gnt_widget_set_focus(widget, FALSE); +} + +void gg_blist_init() +{ + ggblist = g_new0(GGBlist, 1); + + ggblist->window = gnt_box_new(FALSE, FALSE); + gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List")); + + ggblist->tree = gnt_tree_new(); + gnt_widget_set_size(ggblist->tree, 25, getmaxy(stdscr)); + + gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); + gnt_widget_show(ggblist->window); + + gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", gg_blist_get_handle(), + GAIM_CALLBACK(buddy_signed_on), ggblist); + gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off", gg_blist_get_handle(), + GAIM_CALLBACK(buddy_signed_off), ggblist); + + g_signal_connect(G_OBJECT(ggblist->tree), "activate", G_CALLBACK(selection_activate), ggblist); + + /*gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg", gg_blist_get_handle(),*/ + /*GAIM_CALLBACK(received_im_msg), list);*/ + /*gaim_signal_connect(gaim_conversations_get_handle(), "sent-im-msg", gg_blist_get_handle(),*/ + /*GAIM_CALLBACK(sent_im_msg), NULL);*/ + + /*gaim_signal_connect(gaim_conversations_get_handle(), "received-chat-msg", gg_blist_get_handle(),*/ + /*GAIM_CALLBACK(received_chat_msg), list);*/ +} + Property changes on: trunk/console/gntblist.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntblist.h =================================================================== --- trunk/console/gntblist.h (rev 0) +++ trunk/console/gntblist.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,5 @@ +#include "blist.h" + +GaimBlistUiOps * gg_get_blist_ui_ops(); + +void gg_blist_init(); Property changes on: trunk/console/gntblist.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c (rev 0) +++ trunk/console/gntgaim.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,193 @@ +#include "account.h" +#include "conversation.h" +#include "core.h" +#include "debug.h" +#include "eventloop.h" +#include "ft.h" +#include "log.h" +#include "notify.h" +#include "prefs.h" +#include "prpl.h" +#include "pounce.h" +#include "savedstatuses.h" +#include "sound.h" +#include "status.h" +#include "util.h" +#include "whiteboard.h" + +#include "gntgaim.h" + +/* Anything IO-related is directly copied from gtkgaim's source tree */ + +static GaimCoreUiOps core_ops = +{ + NULL, /*gaim_gtk_prefs_init,*/ + NULL, /*debug_init,*/ + NULL, /*gaim_gtk_ui_init,*/ + NULL, /*gaim_gtk_quit*/ +}; + +static GaimCoreUiOps * +gnt_core_get_ui_ops() +{ + return &core_ops; +} + +#define GAIM_GTK_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) +#define GAIM_GTK_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) + +typedef struct _GaimGtkIOClosure { + GaimInputFunction function; + guint result; + gpointer data; + +} GaimGtkIOClosure; + +static void gaim_gtk_io_destroy(gpointer data) +{ + g_free(data); +} + +static gboolean gaim_gtk_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) +{ + GaimGtkIOClosure *closure = data; + GaimInputCondition gaim_cond = 0; + + if (condition & GAIM_GTK_READ_COND) + gaim_cond |= GAIM_INPUT_READ; + if (condition & GAIM_GTK_WRITE_COND) + gaim_cond |= GAIM_INPUT_WRITE; + +#if 0 + gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", + "CLOSURE: callback for %d, fd is %d\n", + closure->result, g_io_channel_unix_get_fd(source)); +#endif + +#ifdef _WIN32 + if(! gaim_cond) { +#if DEBUG + gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", + "CLOSURE received GIOCondition of 0x%x, which does not" + " match 0x%x (READ) or 0x%x (WRITE)\n", + condition, GAIM_GTK_READ_COND, GAIM_GTK_WRITE_COND); +#endif /* DEBUG */ + + return TRUE; + } +#endif /* _WIN32 */ + + closure->function(closure->data, g_io_channel_unix_get_fd(source), + gaim_cond); + + return TRUE; +} + +static guint gnt_input_add(gint fd, GaimInputCondition condition, GaimInputFunction function, + gpointer data) +{ + GaimGtkIOClosure *closure = g_new0(GaimGtkIOClosure, 1); + GIOChannel *channel; + GIOCondition cond = 0; + + closure->function = function; + closure->data = data; + + if (condition & GAIM_INPUT_READ) + cond |= GAIM_GTK_READ_COND; + if (condition & GAIM_INPUT_WRITE) + cond |= GAIM_GTK_WRITE_COND; + + channel = g_io_channel_unix_new(fd); + closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, + gaim_gtk_io_invoke, closure, gaim_gtk_io_destroy); + +#if 0 + gaim_debug(GAIM_DEBUG_MISC, "gtk_eventloop", + "CLOSURE: adding input watcher %d for fd %d\n", + closure->result, fd); +#endif + + g_io_channel_unref(channel); + return closure->result; +} + +static GaimEventLoopUiOps eventloop_ops = +{ + g_timeout_add, + (guint (*)(guint))g_source_remove, + gnt_input_add, + (guint (*)(guint))g_source_remove +}; + +GaimEventLoopUiOps * +gnt_eventloop_get_ui_ops(void) +{ + return &eventloop_ops; +} + +/* This is mostly copied from gtkgaim's source tree */ +static void +init_libgaim() +{ + char *path; + + gaim_debug_set_enabled(FALSE); + + gaim_core_set_ui_ops(gnt_core_get_ui_ops()); + gaim_eventloop_set_ui_ops(gnt_eventloop_get_ui_ops()); + + gaim_util_set_user_dir("/tmp/tmp/"); /* XXX: */ + + path = g_build_filename(gaim_user_dir(), "plugins", NULL); + gaim_plugins_add_search_path(path); + g_free(path); + gaim_plugins_add_search_path("/usr/local/lib/gaim"); /* XXX: */ + + if (!gaim_core_init(GAIM_GNT_UI)) + { + fprintf(stderr, "OOPSSS!!\n"); + abort(); + } + + /* TODO: Move blist loading into gaim_blist_init() */ + gaim_set_blist(gaim_blist_new()); + gaim_blist_load(); + + /* TODO: Move prefs loading into gaim_prefs_init() */ + gaim_prefs_load(); + gaim_prefs_update_old(); + + /* load plugins we had when we quit */ + gaim_plugins_load_saved("/gaim/gtk/plugins/loaded"); + + /* TODO: Move pounces loading into gaim_pounces_init() */ + gaim_pounces_load(); + +} + +int main(int argc, char **argv) +{ + GMainLoop *loop; + + /* Initialize the libgaim stuff */ + init_libgaim(); + + /* Connect to the signals */ + + /* Enable the accounts and restore the status */ + gaim_accounts_restore_current_statuses(); + + /* Main loop */ + g_thread_init(NULL); + loop = g_main_loop_new(NULL, TRUE); + g_thread_create((GThreadFunc)g_main_loop_run, loop, FALSE, NULL); + + /* Initialize the UI */ + init_gnt_ui(); + + gaim_core_quit(); + + return 0; +} + Property changes on: trunk/console/gntgaim.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntgaim.h =================================================================== --- trunk/console/gntgaim.h (rev 0) +++ trunk/console/gntgaim.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,5 @@ +#include <glib.h> + +#define GAIM_GNT_UI "gnt-gaim" + +#define _(x) x Property changes on: trunk/console/gntgaim.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntui.c =================================================================== --- trunk/console/gntui.c (rev 0) +++ trunk/console/gntui.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,18 @@ +#include "gntui.h" + +void init_gnt_ui() +{ + gnt_init(); + + wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + werase(stdscr); + /*box(stdscr, ACS_VLINE, ACS_HLINE);*/ + wrefresh(stdscr); + + /* Initialize the buddy list */ + gg_blist_init(); + gaim_blist_set_ui_ops(gg_get_blist_ui_ops()); + + gnt_main(); +} + Property changes on: trunk/console/gntui.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/gntui.h =================================================================== --- trunk/console/gntui.h (rev 0) +++ trunk/console/gntui.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,3 @@ +#include "gnt.h" + +void init_gnt_ui(); Property changes on: trunk/console/gntui.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/Makefile =================================================================== --- trunk/console/libgnt/Makefile (rev 0) +++ trunk/console/libgnt/Makefile 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,53 @@ +CFLAGS=`pkg-config --cflags gobject-2.0` -g +LDFLAGS=`pkg-config --libs gobject-2.0` -lncursesw + +HEADERS = \ + gntwidget.h \ + gntbox.h \ + gntbutton.h \ + gntcolors.h \ + gntlabel.h \ + gnttree.h \ + gntutils.h \ + gnt.h + +SOURCES = \ + gntwidget.c \ + gntbox.c \ + gntbutton.c \ + gntcolors.c \ + gntlabel.c \ + gnttree.c \ + gntutils.c \ + gntmain.c + +OBJECTS = \ + gntwidget.o \ + gntbox.o \ + gntbutton.o \ + gntcolors.o \ + gntlabel.o \ + gnttree.o \ + gntutils.o \ + gntmain.o + +all: libgnt + +test: $(OBJECTS) + +gntwidget.o: gntwidget.c $(HEADERS) +gntbox.o: gntbox.c $(HEADERS) +gntbutton.o: gntbutton.c $(HEADERS) +gntcolors.o: gntcolors.c $(HEADERS) +gntlabel.o: gntlabel.c $(HEADERS) +gnttree.o: gnttree.c $(HEADERS) +gntutils.o: gntutils.c $(HEADERS) +gntmain.o: gntmain.c $(HEADERS) + +libgnt: $(OBJECTS) + $(CC) --shared -o libgnt.so $(OBJECTS) + +clean: + rm *.o + rm libgnt.so + Property changes on: trunk/console/libgnt/Makefile ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gnt-skel.c =================================================================== --- trunk/console/libgnt/gnt-skel.c (rev 0) +++ trunk/console/libgnt/gnt-skel.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,93 @@ +#include "gn-skel.h" + +enum +{ + SIGS = 1, +}; + +static GntWidgetClass *parent_class = NULL; +static guint signals[SIGS] = { 0 }; + +static void +gnt_skel_draw(GntWidget *widget) +{ + DEBUG; +} + +static void +gnt_skel_size_request(GntWidget *widget) +{ +} + +static void +gnt_skel_map(GntWidget *widget) +{ + if (widget->priv.width == 0 || widget->priv.height == 0) + gnt_widget_size_request(widget); + DEBUG; +} + +static gboolean +gnt_skel_key_pressed(GntWidget *widget, const char *text) +{ + return FALSE; +} + +static void +gnt_skel_class_init(GntWidgetClass *klass) +{ + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + + parent_class = GNT_WIDGET_CLASS(klass); + parent_class->draw = gnt_skel_draw; + parent_class->map = gnt_skel_map; + parent_class->size_request = gnt_skel_size_request; + parent_class->key_pressed = gnt_skel_key_pressed; + + DEBUG; +} + +static void +gnt_skel_init(GTypeInstance *instance, gpointer class) +{ + DEBUG; +} + +/****************************************************************************** + * GntSkel API + *****************************************************************************/ +GType +gnt_skel_get_gtype(void) +{ + static GType type = 0; + + if(type == 0) + { + static const GTypeInfo info = { + sizeof(GntSkelClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)gnt_skel_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GntSkel), + 0, /* n_preallocs */ + gnt_skel_init, /* instance_init */ + }; + + type = g_type_register_static(GNT_TYPE_WIDGET, + "GntSkel", + &info, 0); + } + + return type; +} + +GntWidget *gnt_skel_new() +{ + GntWidget *widget = g_object_new(GNT_TYPE_SKEL, NULL); + GntSkel *skel = GNT_SKEL(widget); + + return widget; +} + Property changes on: trunk/console/libgnt/gnt-skel.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gnt-skel.h =================================================================== --- trunk/console/libgnt/gnt-skel.h (rev 0) +++ trunk/console/libgnt/gnt-skel.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,47 @@ +#ifndef GNT_SKEL_H +#define GNT_SKEL_H + +#include "gnwidget.h" +#include "gn.h" +#include "gncolors.h" +#include "gnkeys.h" + +#define GNT_TYPE_SKEL (gnt_skel_get_gtype()) +#define GNT_SKEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_SKEL, GntSkel)) +#define GNT_SKEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_SKEL, GntSkelClass)) +#define GNT_IS_SKEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_SKEL)) +#define GNT_IS_SKEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_SKEL)) +#define GNT_SKEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_SKEL, GntSkelClass)) + +#define GNT_SKEL_FLAGS(obj) (GNT_SKEL(obj)->priv.flags) +#define GNT_SKEL_SET_FLAGS(obj, flags) (GNT_SKEL_FLAGS(obj) |= flags) +#define GNT_SKEL_UNSET_FLAGS(obj, flags) (GNT_SKEL_FLAGS(obj) &= ~(flags)) + +typedef struct _GnSkel GntSkel; +typedef struct _GnSkelPriv GntSkelPriv; +typedef struct _GnSkelClass GntSkelClass; + +struct _GnSkel +{ + GntWidget parent; +}; + +struct _GnSkelClass +{ + GntWidgetClass parent; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +G_BEGIN_DECLS + +GType gnt_skel_get_gtype(void); + +GntWidget *gnt_skel_new(); + +G_END_DECLS + +#endif /* GNT_SKEL_H */ Property changes on: trunk/console/libgnt/gnt-skel.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gnt.h =================================================================== --- trunk/console/libgnt/gnt.h (rev 0) +++ trunk/console/libgnt/gnt.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,17 @@ +#include <glib.h> +#include "gntwidget.h" +#include "gntcolors.h" +#include "gntkeys.h" + +/* XXX: Find a better place for this */ +#define SCROLL_HEIGHT 4096 +#define SCROLL_WIDTH 512 + +void gnt_init(); + +void gnt_main(); + +void gnt_screen_take_focus(GntWidget *widget); + +void gnt_screen_remove_widget(GntWidget *widget); + Property changes on: trunk/console/libgnt/gnt.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntbox.c =================================================================== --- trunk/console/libgnt/gntbox.c (rev 0) +++ trunk/console/libgnt/gntbox.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,323 @@ +#include "gntbox.h" + +enum +{ + SIGS = 1, +}; + +static GntWidgetClass *parent_class = NULL; +static guint signals[SIGS] = { 0 }; + +static void +gnt_box_draw(GntWidget *widget) +{ + GntBox *box = GNT_BOX(widget); + GList *iter; + + for (iter = box->list; iter; iter = iter->next) + { + gnt_widget_draw(GNT_WIDGET(iter->data)); + } + + if (box->title) + { + gchar *title = g_strdup(box->title); + int pos = g_utf8_strlen(title, -1); + + if (pos >= widget->priv.width - 2) + { + g_utf8_strncpy(title, box->title, widget->priv.width - 2); + pos = 1; + } + else + { + pos = (widget->priv.width - pos - 2) / 2; + /*pos = 2;*/ + } + wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TITLE)); + mvwprintw(widget->window, 0, pos, title); + g_free(title); + } + wrefresh(widget->window); + + DEBUG; +} + +static void +reposition_children(GntWidget *widget) +{ + GList *iter; + GntBox *box = GNT_BOX(widget); + int w, h, curx, cury, max; + gboolean has_border = FALSE; + int x, y; + + x = widget->priv.x; + y = widget->priv.y; + w = h = 0; + max = -1; + curx = widget->priv.x; + cury = widget->priv.y; + if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER)) + { + has_border = TRUE; + curx += 1; + cury += 1; + if (!box->vertical) + curx++; + } + + for (iter = box->list; iter; iter = iter->next) + { + gnt_widget_set_position(GNT_WIDGET(iter->data), curx, cury); + gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h); + if (box->vertical) + { + cury += h + 1; + if (max < w) + max = w; + } + else + { + curx += w + 2; + if (max < h) + max = h; + } + } + + if (has_border) + { + curx += 2; + cury += 1; + max += 2; + } + + if (box->vertical) + { + widget->priv.width = max; + widget->priv.height = cury - widget->priv.y; + } + else + { + widget->priv.width = curx - widget->priv.x; + widget->priv.height = max; + } +} + +static void +gnt_box_set_position(GntWidget *widget, int x, int y) +{ + gnt_widget_size_request(widget); + reposition_children(widget); +} + +static void +gnt_box_size_request(GntWidget *widget) +{ + GntBox *box = GNT_BOX(widget); + GList *iter; + + g_list_foreach(box->list, (GFunc)gnt_widget_size_request, NULL); + + if (box->homogeneous) + { + int max = -1, w, h; + + /* XXX: should probably be changed based on vertical-ness */ + for (iter = box->list; iter; iter = iter->next) + { + gnt_widget_get_size(GNT_WIDGET(iter->data), &w, NULL); + if (max < w) + max = w; + } + + for (iter = box->list; iter; iter = iter->next) + { + gnt_widget_get_size(GNT_WIDGET(iter->data), NULL, &h); + gnt_widget_set_size(GNT_WIDGET(iter->data), max, h); + } + } + + reposition_children(widget); +} + +static void +gnt_box_map(GntWidget *widget) +{ + if (widget->priv.width == 0 || widget->priv.height == 0) + gnt_widget_size_request(widget); + DEBUG; +} + +static gboolean +gnt_box_key_pressed(GntWidget *widget, const char *text) +{ + GntBox *box = GNT_BOX(widget); + + /*if (box->list == NULL)*/ + /*return FALSE;*/ + + if (box->active == NULL) + box->active = box->list; + + if (gnt_widget_key_pressed(box->active->data, text)) + return TRUE; + + if (text[0] == 27) + { + GList *now = NULL; + if (strcmp(text+1, GNT_KEY_LEFT) == 0) + { + now = box->active->prev; + if (now == NULL) + now = g_list_last(box->list); + } + else if (strcmp(text+1, GNT_KEY_RIGHT) == 0) + { + now = box->active->next; + if (now == NULL) + now = box->list; + } + + if (now) + { + gnt_widget_set_focus(box->active->data, FALSE); + box->active = now; + gnt_widget_set_focus(box->active->data, TRUE); + + return TRUE; + } + } + + return FALSE; +} + +static GntWidget *find_focused_widget(GntBox *box) +{ + GList *iter; + + for (iter = box->list; iter; iter = iter->next) + { + GntWidget *w = iter->data; + + if (GNT_IS_BOX(w)) + { + if ((w = find_focused_widget(GNT_BOX(w))) != NULL) + return w; + } + else + { + if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_CAN_TAKE_FOCUS) && + GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_HAS_FOCUS)) + return w; + } + } + return NULL; +} + +static void +gnt_box_lost_focus(GntWidget *widget) +{ + GntBox *box = GNT_BOX(widget); + GntWidget *p = widget; + + while (p->parent) + p = p->parent; + + p = find_focused_widget(GNT_BOX(p)); + if (p) + gnt_widget_set_focus(p, FALSE); +} + +static void +gnt_box_destroy(GntWidget *w) +{ + GntBox *box = GNT_BOX(w); + GList *iter; + + for (iter = box->list; iter; iter = iter->next) + { + gnt_widget_destroy(iter->data); + } + + g_list_free(box->list); +} + +static void +gnt_box_class_init(GntWidgetClass *klass) +{ + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + + parent_class = GNT_WIDGET_CLASS(klass); + parent_class->destroy = gnt_box_destroy; + parent_class->draw = gnt_box_draw; + parent_class->map = gnt_box_map; + parent_class->size_request = gnt_box_size_request; + parent_class->set_position = gnt_box_set_position; + parent_class->key_pressed = gnt_box_key_pressed; + parent_class->lost_focus = gnt_box_lost_focus; + + DEBUG; +} + +static void +gnt_box_init(GTypeInstance *instance, gpointer class) +{ + DEBUG; +} + +/****************************************************************************** + * GntBox API + *****************************************************************************/ +GType +gnt_box_get_gtype(void) +{ + static GType type = 0; + + if(type == 0) + { + static const GTypeInfo info = { + sizeof(GntBoxClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)gnt_box_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GntBox), + 0, /* n_preallocs */ + gnt_box_init, /* instance_init */ + }; + + type = g_type_register_static(GNT_TYPE_WIDGET, + "GntBox", + &info, 0); + } + + return type; +} + +GntWidget *gnt_box_new(gboolean homo, gboolean vert) +{ + GntWidget *widget = g_object_new(GNT_TYPE_BOX, NULL); + GntBox *box = GNT_BOX(widget); + + box->homogeneous = homo; + box->vertical = vert; + gnt_widget_set_take_focus(widget, TRUE); + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); + + return widget; +} + +void gnt_box_add_widget(GntBox *b, GntWidget *widget) +{ + b->list = g_list_append(b->list, widget); + widget->parent = GNT_WIDGET(b); +} + +void gnt_box_set_title(GntBox *b, const char *title) +{ + g_free(b->title); + b->title = g_strdup(title); +} + Property changes on: trunk/console/libgnt/gntbox.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntbox.h =================================================================== --- trunk/console/libgnt/gntbox.h (rev 0) +++ trunk/console/libgnt/gntbox.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,58 @@ +#ifndef GNT_BOX_H +#define GNT_BOX_H + +#include "gnt.h" +#include "gntwidget.h" + +#define GNT_TYPE_BOX (gnt_box_get_gtype()) +#define GNT_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BOX, GntBox)) +#define GNT_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_BOX, GntBoxClass)) +#define GNT_IS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_BOX)) +#define GNT_IS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_BOX)) +#define GNT_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_BOX, GntBoxClass)) + +typedef struct _GnBox GntBox; +typedef struct _GnBoxClass GntBoxClass; + +struct _GnBox +{ + GntWidget parent; + + gboolean vertical; + gboolean homogeneous; + GList *list; /* List of widgets */ + + GList *active; + + char *title; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +struct _GnBoxClass +{ + GntWidgetClass parent; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +G_BEGIN_DECLS + +GType gnt_box_get_gtype(void); + +GntWidget *gnt_box_new(gboolean homo, gboolean vert); + +void gnt_box_add_widget(GntBox *box, GntWidget *widget); + +void gnt_box_set_title(GntBox *box, const char *title); + +G_END_DECLS + +#endif /* GNT_BOX_H */ + Property changes on: trunk/console/libgnt/gntbox.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntbutton.c =================================================================== --- trunk/console/libgnt/gntbutton.c (rev 0) +++ trunk/console/libgnt/gntbutton.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,116 @@ +#include "gntbutton.h" + +enum +{ + SIGS = 1, +}; + +static GntWidgetClass *parent_class = NULL; +static guint signals[SIGS] = { 0 }; + +static void +gnt_button_draw(GntWidget *widget) +{ + GntButton *button = GNT_BUTTON(widget); + GntColorType type; + + if (GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_HAS_FOCUS) + type = GNT_COLOR_HIGHLIGHT; + else + type = GNT_COLOR_NORMAL; + wbkgdset(widget->window, '\0' | COLOR_PAIR(type)); + mvwprintw(widget->window, 1, 1, button->priv->text); + + wrefresh(widget->window); + + DEBUG; +} + +static void +gnt_button_size_request(GntWidget *widget) +{ + GntButton *button = GNT_BUTTON(widget); + widget->priv.width = g_utf8_strlen(button->priv->text, -1) + 2; + widget->priv.height = 3; +} + +static void +gnt_button_map(GntWidget *widget) +{ + if (widget->priv.width == 0 || widget->priv.height == 0) + gnt_widget_size_request(widget); + DEBUG; +} + +static gboolean +gnt_button_key_pressed(GntWidget *widget, const char *key) +{ + if (strcmp(key, GNT_KEY_ENTER) == 0) + { + gnt_widget_activate(widget); + return TRUE; + } + return FALSE; +} + +static void +gnt_button_class_init(GntWidgetClass *klass) +{ + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + + parent_class = GNT_WIDGET_CLASS(klass); + parent_class->draw = gnt_button_draw; + parent_class->map = gnt_button_map; + parent_class->size_request = gnt_button_size_request; + parent_class->key_pressed = gnt_button_key_pressed; + + DEBUG; +} + +static void +gnt_button_init(GTypeInstance *instance, gpointer class) +{ + GntButton *button = GNT_BUTTON(instance); + button->priv = g_new0(GntButtonPriv, 1); + DEBUG; +} + +/****************************************************************************** + * GntButton API + *****************************************************************************/ +GType +gnt_button_get_gtype(void) { + static GType type = 0; + + if(type == 0) { + static const GTypeInfo info = { + sizeof(GntButtonClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)gnt_button_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GntButton), + 0, /* n_preallocs */ + gnt_button_init, /* instance_init */ + }; + + type = g_type_register_static(GNT_TYPE_WIDGET, + "GntButton", + &info, 0); + } + + return type; +} + +GntWidget *gnt_button_new(const char *text) +{ + GntWidget *widget = g_object_new(GNT_TYPE_BUTTON, NULL); + GntButton *button = GNT_BUTTON(widget); + + button->priv->text = g_strdup(text); + gnt_widget_set_take_focus(widget, TRUE); + + return widget; +} + Property changes on: trunk/console/libgnt/gntbutton.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntbutton.h =================================================================== --- trunk/console/libgnt/gntbutton.h (rev 0) +++ trunk/console/libgnt/gntbutton.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,55 @@ +#ifndef GNT_BUTTON_H +#define GNT_BUTTON_H + +#include <glib.h> +#include <glib-object.h> +#include "gnt.h" +#include "gntwidget.h" + +#define GNT_TYPE_BUTTON (gnt_button_get_gtype()) +#define GNT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BUTTON, GntButton)) +#define GNT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_BUTTON, GntButtonClass)) +#define GNT_IS_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_BUTTON)) +#define GNT_IS_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_BUTTON)) +#define GNT_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_BUTTON, GntButtonClass)) + +typedef struct _GnButton GntButton; +typedef struct _GnButtonPriv GntButtonPriv; +typedef struct _GnButtonClass GntButtonClass; + +struct _GnButtonPriv +{ + char *text; +}; + +struct _GnButton +{ + GntWidget parent; + + GntButtonPriv *priv; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +struct _GnButtonClass +{ + GntWidgetClass parent; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +G_BEGIN_DECLS + +GType gnt_button_get_gtype(void); + +GntWidget *gnt_button_new(const char *text); + +G_END_DECLS + +#endif /* GNT_BUTTON_H */ Property changes on: trunk/console/libgnt/gntbutton.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntcolors.c =================================================================== --- trunk/console/libgnt/gntcolors.c (rev 0) +++ trunk/console/libgnt/gntcolors.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,21 @@ +#include <ncursesw/ncurses.h> +#include "gntcolors.h" + +void gnt_init_colors() +{ + /* XXX: Do some init_color()s */ + init_color(GNT_COLOR_BLACK, 0, 0, 0); + init_color(GNT_COLOR_RED, 1000, 0, 0); + init_color(GNT_COLOR_GREEN, 0, 1000, 0); + init_color(GNT_COLOR_BLUE, 0, 0, 1000); + init_color(GNT_COLOR_WHITE, 1000, 1000, 1000); + init_color(GNT_COLOR_GRAY, 799, 799, 799); + init_color(GNT_COLOR_DARK_GRAY, 256, 256, 256); + + /* Now some init_pair()s */ + init_pair(GNT_COLOR_NORMAL, GNT_COLOR_BLACK, GNT_COLOR_WHITE); + init_pair(GNT_COLOR_HIGHLIGHT, GNT_COLOR_BLUE, GNT_COLOR_GRAY); + init_pair(GNT_COLOR_SHADOW, GNT_COLOR_BLACK, GNT_COLOR_DARK_GRAY); + init_pair(GNT_COLOR_TITLE, GNT_COLOR_WHITE, GNT_COLOR_DARK_GRAY); +} + Property changes on: trunk/console/libgnt/gntcolors.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntcolors.h =================================================================== --- trunk/console/libgnt/gntcolors.h (rev 0) +++ trunk/console/libgnt/gntcolors.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,34 @@ +#ifndef GNT_COLORS_H +#define GNT_COLORS_H + +typedef enum +{ + GNT_COLOR_NORMAL = 1, + GNT_COLOR_HIGHLIGHT, /* eg. when a button is selected */ + GNT_COLOR_DISABLED, /* eg. when a button is disabled */ + GNT_COLOR_HIGHLIGHT_D, /* eg. when a button is selected, but some other window is in focus */ + GNT_COLOR_TEXT_NORMAL, + GNT_COLOR_TEXT_INACTIVE, /* when the entry is out of focus */ + GNT_COLOR_MNEMONIC, + GNT_COLOR_MNEMONIC_D, + GNT_COLOR_SHADOW, + GNT_COLOR_TITLE, + GNT_COLORS +} GntColorType; + +enum +{ + GNT_COLOR_BLACK = 1, + GNT_COLOR_RED, + GNT_COLOR_GREEN, + GNT_COLOR_BLUE, + GNT_COLOR_WHITE, + GNT_COLOR_GRAY, + GNT_COLOR_DARK_GRAY, + GNT_TOTAL_COLORS +}; + +/* populate some default colors */ +void gnt_init_colors(); + +#endif Property changes on: trunk/console/libgnt/gntcolors.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntkeys.h =================================================================== --- trunk/console/libgnt/gntkeys.h (rev 0) +++ trunk/console/libgnt/gntkeys.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,14 @@ +#ifndef GNT_KEYS_H +#define GNT_KEYS_H + +#define GNT_KEY_POPUP "[29~" + +/* Arrow keys */ +#define GNT_KEY_LEFT "[D" +#define GNT_KEY_RIGHT "[C" +#define GNT_KEY_UP "[A" +#define GNT_KEY_DOWN "[B" + +#define GNT_KEY_ENTER "\r" + +#endif Property changes on: trunk/console/libgnt/gntkeys.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntlabel.c =================================================================== --- trunk/console/libgnt/gntlabel.c (rev 0) +++ trunk/console/libgnt/gntlabel.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,120 @@ +#include "gntlabel.h" + +#include <string.h> + +enum +{ + SIGS = 1, +}; + +static GntWidgetClass *parent_class = NULL; +static guint signals[SIGS] = { 0 }; + +static void +gnt_label_destroy(GntWidget *widget) +{ + GntLabel *label = GNT_LABEL(widget); + g_free(label->text); +} + +static void +gnt_label_draw(GntWidget *widget) +{ + GntLabel *label = GNT_LABEL(widget); + + wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + mvwprintw(widget->window, 0, 0, label->text); + wrefresh(widget->window); + + DEBUG; +} + +static void +gnt_label_size_request(GntWidget *widget) +{ + GntLabel *label = GNT_LABEL(widget); + char *s = label->text, *last = s; + int count = 1; + int max = 0; + + /* XXX: ew ... everyone look away */ + while (*s) + { + if (*s == '\n' || *s == '\r') + { + count++; + if (max < s - last + 1) + max = s - last + 1; + last = s + 1; + } + s++; + } + if (max < s - last + 1) + max = s - last + 1; + widget->priv.height = count; + + widget->priv.width = max; +} + +static void +gnt_label_class_init(GntWidgetClass *klass) +{ + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + + parent_class = GNT_WIDGET_CLASS(klass); + parent_class->destroy = gnt_label_destroy; + parent_class->draw = gnt_label_draw; + parent_class->map = NULL; + parent_class->size_request = gnt_label_size_request; + + DEBUG; +} + +static void +gnt_label_init(GTypeInstance *instance, gpointer class) +{ + DEBUG; +} + +/****************************************************************************** + * GntLabel API + *****************************************************************************/ +GType +gnt_label_get_gtype(void) +{ + static GType type = 0; + + if(type == 0) + { + static const GTypeInfo info = { + sizeof(GntLabelClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)gnt_label_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GntLabel), + 0, /* n_preallocs */ + gnt_label_init, /* instance_init */ + }; + + type = g_type_register_static(GNT_TYPE_WIDGET, + "GntLabel", + &info, 0); + } + + return type; +} + +GntWidget *gnt_label_new(const char *text) +{ + GntWidget *widget = g_object_new(GNT_TYPE_LABEL, NULL); + GntLabel *label = GNT_LABEL(widget); + + label->text = g_strdup(text); + gnt_widget_set_take_focus(widget, FALSE); + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); + + return widget; +} + Property changes on: trunk/console/libgnt/gntlabel.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntlabel.h =================================================================== --- trunk/console/libgnt/gntlabel.h (rev 0) +++ trunk/console/libgnt/gntlabel.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,48 @@ +#ifndef GNT_LABEL_H +#define GNT_LABEL_H + +#include "gnt.h" +#include "gntwidget.h" + +#define GNT_TYPE_LABEL (gnt_label_get_gtype()) +#define GNT_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_LABEL, GntLabel)) +#define GNT_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_LABEL, GntLabelClass)) +#define GNT_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_LABEL)) +#define GNT_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_LABEL)) +#define GNT_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_LABEL, GntLabelClass)) + +typedef struct _GnLabel GntLabel; +typedef struct _GnLabelClass GntLabelClass; + +struct _GnLabel +{ + GntWidget parent; + + char *text; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +struct _GnLabelClass +{ + GntWidgetClass parent; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +G_BEGIN_DECLS + +GType gnt_label_get_gtype(void); + +GntWidget *gnt_label_new(const char *text); + +G_END_DECLS + +#endif /* GNT_LABEL_H */ + Property changes on: trunk/console/libgnt/gntlabel.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c (rev 0) +++ trunk/console/libgnt/gntmain.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,111 @@ +#include "gnt.h" +#include "gntkeys.h" +#include "gntcolors.h" +#include <stdio.h> +#include <stdlib.h> +#include <locale.h> + +static GList *focus_list; +static int max_x; +static int max_y; + +void gnt_screen_take_focus(GntWidget *widget) +{ + focus_list = g_list_prepend(focus_list, widget); +} + +void gnt_screen_remove_widget(GntWidget *widget) +{ + focus_list = g_list_remove(focus_list, widget); + if (focus_list) + gnt_widget_draw(focus_list->data); +} + +static gboolean +io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) +{ + char buffer[256]; + + int rd = read(0, buffer, sizeof(buffer) - 1); + if (rd < 0) + { + endwin(); + printf("ERROR!\n"); + exit(1); + } + else if (rd == 0) + { + endwin(); + printf("EOF\n"); + exit(1); + } + + buffer[rd] = 0; + + if (focus_list) + { + gboolean ret = FALSE; + /*g_signal_emit_by_name(focus_list->data, "key_pressed", buffer, &ret);*/ + ret = gnt_widget_key_pressed(focus_list->data, buffer); + } + + if (buffer[0] == 27) + { + /* Some special key has been pressed */ + if (strcmp(buffer+1, GNT_KEY_POPUP) == 0) + { + /*printf("popup\n");*/ + } + else + { + /*printf("Unknown: %s\n", buffer+1);*/ + } + } + else + { + if (buffer[0] == 'q') + { + endwin(); + exit(1); + } + /*printf("%s\n", buffer);*/ + } + refresh(); + + return TRUE; +} + +void gnt_init() +{ + GIOChannel *channel = g_io_channel_unix_new(0); + + g_io_channel_set_encoding(channel, NULL, NULL); + g_io_channel_set_buffered(channel, FALSE); + g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL ); + + int result = g_io_add_watch(channel, + (G_IO_IN | G_IO_HUP | G_IO_ERR), + io_invoke, NULL); + + setlocale(LC_ALL, ""); + initscr(); + start_color(); + /*use_default_colors();*/ + gnt_init_colors(); + + max_x = getmaxx(stdscr); + max_y = getmaxy(stdscr); + + wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + noecho(); + refresh(); + mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); + g_type_init(); +} + +void gnt_main() +{ + GMainLoop *loop = g_main_new(FALSE); + g_main_run(loop); +} + Property changes on: trunk/console/libgnt/gntmain.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c (rev 0) +++ trunk/console/libgnt/gnttree.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,346 @@ +#include "gnttree.h" + +enum +{ + SIGS = 1, +}; + +/* XXX: Make this one into a GObject? + * ... Probably not */ +struct _GnTreeRow +{ + void *key; + char *text; + void *data; /* XXX: unused */ + + GntTreeRow *parent; + GntTreeRow *child; + GntTreeRow *next; +}; + +static GntWidgetClass *parent_class = NULL; +static guint signals[SIGS] = { 0 }; + +/* XXX: This is ugly, but what can you do ... */ +static void +gnt_tree_refresh(GntTree *tree) +{ + GntWidget *widget = GNT_WIDGET(tree); + int pos; + + if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) + pos = 0; + else + pos = 1; + + copywin(tree->scroll, widget->window, tree->top, 0, + pos, pos, widget->priv.height - pos - 1, widget->priv.width - pos - 1, FALSE); + wrefresh(widget->window); +} + +static void +redraw_tree(GntTree *tree) +{ + int start; + GntWidget *widget = GNT_WIDGET(tree); + GList *iter; + + wbkgd(tree->scroll, COLOR_PAIR(GNT_COLOR_NORMAL)); + + /* XXX: Add the rows */ + for (start = tree->top, iter = g_list_nth(tree->list, tree->top); + iter && start < tree->bottom; start++, iter = iter->next) + { + char str[2096]; /* XXX: This should be safe for any terminal */ + GntTreeRow *row = g_hash_table_lookup(tree->hash, iter->data); + + snprintf(str, widget->priv.width - 2, "%s\n", row->text); + + if (start == tree->current) + { + wbkgdset(tree->scroll, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); + mvwprintw(tree->scroll, start, 0, str); + wbkgdset(tree->scroll, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + } + else + mvwprintw(tree->scroll, start, 0, str); + } + + while (start < tree->bottom) + { + wmove(tree->scroll, start, 0); + wclrtoeol(tree->scroll); + start++; + } + + gnt_tree_refresh(tree); +} + +static void +gnt_tree_draw(GntWidget *widget) +{ + GntTree *tree = GNT_TREE(widget); + + /* For the Tree (or anything that scrolls), we will create a 'hidden' window + * of 'large enough' size. We never wrefresh that hidden-window, instead we + * just 'scroll' it, and wrefresh the subwindow */ + + if (tree->scroll == NULL) + { + tree->scroll = newwin(SCROLL_HEIGHT, widget->priv.width, widget->priv.y, widget->priv.x); + scrollok(tree->scroll, TRUE); + wsetscrreg(tree->scroll, 0, SCROLL_HEIGHT - 1); + + tree->top = 0; + tree->bottom = widget->priv.height - + (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER) ? 0 : 2); + } + + redraw_tree(tree); + + DEBUG; +} + +static void +gnt_tree_size_request(GntWidget *widget) +{ + if (widget->priv.height == 0) + widget->priv.height = 10; /* XXX: Why?! */ + if (widget->priv.width == 0) + widget->priv.width = 20; /* YYY: 'cuz ... */ +} + +static void +gnt_tree_map(GntWidget *widget) +{ + if (widget->priv.width == 0 || widget->priv.height == 0) + gnt_widget_size_request(widget); + DEBUG; +} + +static gboolean +gnt_tree_key_pressed(GntWidget *widget, const char *text) +{ + GntTree *tree = GNT_TREE(widget); + if (text[0] == 27) + { + if (strcmp(text+1, GNT_KEY_DOWN) == 0 && tree->current < g_list_length(tree->list) - 1) + { + tree->current++; + if (tree->current >= tree->bottom) + gnt_tree_scroll(tree, 1 + tree->current - tree->bottom); + redraw_tree(tree); + } + else if (strcmp(text+1, GNT_KEY_UP) == 0 && tree->current > 0) + { + tree->current--; + if (tree->current < tree->top) + gnt_tree_scroll(tree, tree->current - tree->top); + redraw_tree(tree); + } + } + else if (text[0] == '\r') + { + gnt_widget_activate(widget); + } + + return FALSE; +} + +static void +gnt_tree_destroy(GntWidget *widget) +{ + GntTree *tree = GNT_TREE(widget); + + g_hash_table_destroy(tree->hash); + g_list_free(tree->list); +} + +static void +gnt_tree_class_init(GntWidgetClass *klass) +{ + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + + parent_class = GNT_WIDGET_CLASS(klass); + parent_class->destroy = gnt_tree_destroy; + parent_class->draw = gnt_tree_draw; + parent_class->map = gnt_tree_map; + parent_class->size_request = gnt_tree_size_request; + parent_class->key_pressed = gnt_tree_key_pressed; + + DEBUG; +} + +static void +gnt_tree_init(GTypeInstance *instance, gpointer class) +{ + DEBUG; +} + +/****************************************************************************** + * GntTree API + *****************************************************************************/ +GType +gnt_tree_get_gtype(void) +{ + static GType type = 0; + + if(type == 0) + { + static const GTypeInfo info = { + sizeof(GntTreeClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)gnt_tree_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(GntTree), + 0, /* n_preallocs */ + gnt_tree_init, /* instance_init */ + }; + + type = g_type_register_static(GNT_TYPE_WIDGET, + "GntTree", + &info, 0); + } + + return type; +} + +GntWidget *gnt_tree_new() +{ + GntWidget *widget = g_object_new(GNT_TYPE_TREE, NULL); + GntTree *tree = GNT_TREE(widget); + + tree->hash = g_hash_table_new(g_direct_hash, g_direct_equal); + + return widget; +} + +void gnt_tree_set_visible_rows(GntTree *tree, int rows) +{ + GntWidget *widget = GNT_WIDGET(tree); + widget->priv.height = rows; + if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) + widget->priv.height += 2; +} + +int gnt_tree_get_visible_rows(GntTree *tree) +{ + GntWidget *widget = GNT_WIDGET(tree); + int ret = widget->priv.height; + if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) + widget->priv.height -= 2; +} + +void gnt_tree_scroll(GntTree *tree, int count) +{ + if (tree->top == 0 && count < 0) + return; + + if (count > 0 && tree->bottom + count >= g_list_length(tree->list)) + count = g_list_length(tree->list) - tree->bottom; + else if (count < 0 && tree->top + count < 0) + count = -tree->top; + + tree->top += count; + tree->bottom += count; + + /*wscrl(tree->scroll, count);*/ + gnt_tree_refresh(tree); +} + +void gnt_tree_add_row_after(GntTree *tree, void *key, const char *text, void *parent, void *bigbro) +{ + GntTreeRow *row = g_new0(GntTreeRow, 1), *pr = NULL; + + row->key = key; + row->text = g_strdup(text); + row->data = NULL; + + g_hash_table_insert(tree->hash, key, row); + + if (tree->root == NULL) + { + tree->root = row; + tree->list = g_list_prepend(tree->list, key); + } + else + { + int position; + + if (bigbro) + { + pr = g_hash_table_lookup(tree->hash, bigbro); + if (pr) + { + row->next = pr->next; + pr->next = row; + row->parent = pr->parent; + + position = g_list_index(tree->list, bigbro); + } + } + + if (pr == NULL && parent) + { + pr = g_hash_table_lookup(tree->hash, parent); + if (pr) + { + row->next = pr->child; + pr->child = row; + row->parent = pr; + + position = g_list_index(tree->list, parent); + } + } + + if (pr == NULL) + { + row->next = tree->root; + tree->root = row; + + tree->list = g_list_prepend(tree->list, key); + } + else + { + tree->list = g_list_insert(tree->list, key, position + 1); + } + } + + if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_MAPPED)) + redraw_tree(tree); +} + +gpointer gnt_tree_get_selection_data(GntTree *tree) +{ + return g_list_nth(tree->list, tree->current); +} + +int gnt_tree_get_selection_index(GntTree *tree) +{ + return tree->current; +} + +void gnt_tree_remove(GntTree *tree, gpointer key) +{ + GntTreeRow *row = g_hash_table_lookup(tree->hash, key); + if (row) + { + int len, pos; + + g_free(row->text); + g_free(row); + + pos = g_list_index(tree->list, key); + + g_hash_table_remove(tree->hash, key); + tree->list = g_list_remove(tree->list, key); + + if (pos >= tree->top && pos < tree->bottom) + { + redraw_tree(tree); + } + } +} + Property changes on: trunk/console/libgnt/gnttree.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gnttree.h =================================================================== --- trunk/console/libgnt/gnttree.h (rev 0) +++ trunk/console/libgnt/gnttree.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,75 @@ +#ifndef GNT_TREE_H +#define GNT_TREE_H + +#include "gntwidget.h" +#include "gnt.h" +#include "gntcolors.h" +#include "gntkeys.h" + +#define GNT_TYPE_TREE (gnt_tree_get_gtype()) +#define GNT_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_TREE, GntTree)) +#define GNT_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_TREE, GntTreeClass)) +#define GNT_IS_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_TREE)) +#define GNT_IS_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_TREE)) +#define GNT_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_TREE, GntTreeClass)) + +#define GNT_TREE_FLAGS(obj) (GNT_TREE(obj)->priv.flags) +#define GNT_TREE_SET_FLAGS(obj, flags) (GNT_TREE_FLAGS(obj) |= flags) +#define GNT_TREE_UNSET_FLAGS(obj, flags) (GNT_TREE_FLAGS(obj) &= ~(flags)) + +typedef struct _GnTree GntTree; +typedef struct _GnTreePriv GntTreePriv; +typedef struct _GnTreeClass GntTreeClass; + +typedef struct _GnTreeRow GntTreeRow; + +struct _GnTree +{ + GntWidget parent; + + WINDOW *scroll; + + int current; /* current selection */ + + int top; /* The index in 'list' of the topmost visible item */ + int bottom; /* The index in 'list' of the bottommost visible item */ + + GntTreeRow *root; /* The root of all evil */ + + GList *list; /* List of GntTreeRow s */ + GHashTable *hash; /* XXX: We may need this for quickly referencing the rows */ +}; + +struct _GnTreeClass +{ + GntWidgetClass parent; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +}; + +G_BEGIN_DECLS + +GType gnt_tree_get_gtype(void); + +GntWidget *gnt_tree_new(); + +void gnt_tree_set_visible_rows(GntTree *tree, int rows); + +int gnt_tree_get_visible_rows(GntTree *tree); + +void gnt_tree_scroll(GntTree *tree, int count); + +void gnt_tree_add_row_after(GntTree *tree, void *key, const char *text, void *parent, void *bigbro); + +gpointer gnt_tree_get_selection_data(GntTree *tree); + +int gnt_tree_get_selection_index(GntTree *tree); + +void gnt_tree_remove(GntTree *tree, gpointer key); + +G_END_DECLS + +#endif /* GNT_TREE_H */ Property changes on: trunk/console/libgnt/gnttree.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntutils.c =================================================================== --- trunk/console/libgnt/gntutils.c (rev 0) +++ trunk/console/libgnt/gntutils.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,100 @@ +#include "gntutils.h" + +void gnt_closure_marshal_BOOLEAN__STRING(GClosure *closure, + GValue *ret_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + typedef gboolean (*func) (gpointer data1, const char *arg1, gpointer data2); + register func callback; + register GCClosure *cc = (GCClosure*)closure; + register gpointer data1, data2; + gboolean ret; + + g_return_if_fail(ret_value != NULL); + g_return_if_fail(n_param_values == 2); + + if (G_CCLOSURE_SWAP_DATA(closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer(param_values + 0); + } + else + { + data1 = g_value_peek_pointer(param_values + 0); + data2 = closure->data; + } + + callback = (func) (marshal_data ? marshal_data : cc->callback); + ret = callback(data1, g_value_get_string(param_values + 1) , data2); + g_value_set_boolean(ret_value, ret); +} + +void gnt_closure_marshal_VOID__INT_INT_INT_INT(GClosure *closure, + GValue *ret_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + typedef void (*func) (gpointer data1, int, int, int, int, gpointer data2); + register func callback; + register GCClosure *cc = (GCClosure*)closure; + register gpointer data1, data2; + + g_return_if_fail(n_param_values == 5); + + if (G_CCLOSURE_SWAP_DATA(closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer(param_values + 0); + } + else + { + data1 = g_value_peek_pointer(param_values + 0); + data2 = closure->data; + } + + callback = (func) (marshal_data ? marshal_data : cc->callback); + callback(data1, + g_value_get_int(param_values + 1) , + g_value_get_int(param_values + 2) , + g_value_get_int(param_values + 3) , + g_value_get_int(param_values + 4) , + data2); +} + +void gnt_closure_marshal_VOID__INT_INT(GClosure *closure, + GValue *ret_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + typedef void (*func) (gpointer data1, int, int, gpointer data2); + register func callback; + register GCClosure *cc = (GCClosure*)closure; + register gpointer data1, data2; + + g_return_if_fail(n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA(closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer(param_values + 0); + } + else + { + data1 = g_value_peek_pointer(param_values + 0); + data2 = closure->data; + } + + callback = (func) (marshal_data ? marshal_data : cc->callback); + callback(data1, + g_value_get_int(param_values + 1) , + g_value_get_int(param_values + 2) , + data2); +} + Property changes on: trunk/console/libgnt/gntutils.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntutils.h =================================================================== --- trunk/console/libgnt/gntutils.h (rev 0) +++ trunk/console/libgnt/gntutils.h 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,23 @@ +#include "gntwidget.h" + +void gnt_closure_marshal_BOOLEAN__STRING(GClosure *closure, + GValue *ret_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + +void gnt_closure_marshal_VOID__INT_INT_INT_INT(GClosure *closure, + GValue *ret_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + +void gnt_closure_marshal_VOID__INT_INT(GClosure *closure, + GValue *ret_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + Property changes on: trunk/console/libgnt/gntutils.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/console/libgnt/gntwidget.c =================================================================== --- trunk/console/libgnt/gntwidget.c (rev 0) +++ trunk/console/libgnt/gntwidget.c 2006-06-22 08:33:54 UTC (rev 16308) @@ -0,0 +1,386 @@ +/* Stuff brutally ripped from Gflib */ + +#include "gntwidget.h" +#include "gntutils.h" +#include "gnt.h" + +enum +{ + SIG_DESTROY, + SIG_DRAW, + SIG_GIVE_FOCUS, + SIG_LOST_FOCUS, + SIG_KEY_PRESSED, + SIG_MAP, + SIG_ACTIVATE, + SIG_EXPOSE, + SIG_SIZE_REQUEST, + SIG_POSITION, + SIGS +}; + +static GObjectClass *parent_class = NULL; +static guint signals[SIGS] = { 0 }; + +static void +gnt_widget_init(GTypeInstance *instance, gpointer class) +{ + GntWidget *widget = GNT_WIDGET(instance); + widget->priv.name = NULL; + DEBUG; +} + +static void +gnt_widget_map(GntWidget *widget) +{ + /* Get some default size for the widget */ + DEBUG; + g_signal_emit(widget, signals[SIG_MAP], 0); + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_MAPPED); +} + +static void +gnt_widget_dispose(GObject *obj) +{ + GntWidget *self = GNT_WIDGET(obj); + + if(!(GNT_WIDGET_FLAGS(self) & GNT_WIDGET_DESTROYING)) { + GNT_WIDGET_SET_FLAGS(self, GNT_WIDGET_DESTROYING); + + g_signal_emit(self, signals[SIG_DESTROY], 0); + + GNT_WIDGET_UNSET_FLAGS(self, GNT_WIDGET_DESTROYING); + } + + parent_class->dispose(obj); + DEBUG; +} + +static void +gnt_widget_focus_change(GntWidget *widget) +{ + if (GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_MAPPED) + gnt_widget_draw(widget); +} + +static void +gnt_widget_class_init(GntWidgetClass *klass) +{ + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + + parent_class = g_type_class_peek_parent(klass); + + obj_class->dispose = gnt_widget_dispose; + + klass->destroy = gnt_widget_destroy; + klass->show = gnt_widget_show; + klass->draw = gnt_widget_draw; + klass->expose = gnt_widget_expose; + klass->map = gnt_widget_map; + klass->lost_focus = gnt_widget_focus_change; + klass->gained_focus = gnt_widget_focus_change; + + klass->key_pressed = NULL; + klass->activate = NULL; + + signals[SIG_DESTROY] = + g_signal_new("destroy", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GntWidgetClass, destroy), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + signals[SIG_GIVE_FOCUS] = + g_signal_new("gained-focus", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GntWidgetClass, gained_focus), + NULL, NULL, + g_cclo... [truncated message content] |
From: <the...@us...> - 2006-06-22 06:27:43
|
Revision: 16307 Author: thekingant Date: 2006-06-21 23:27:35 -0700 (Wed, 21 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16307&view=rev Log Message: ----------- Backport revision r16306 to the v2_0_0 branch. Original commit message: Keep track of the Yahoo! IMVironment specified by the people we're IMing with. When we reply to their IMs, we now send the same IMVironment instead of always sending an empty IMVironment because sending an empty IMVironment would reset their IMVironment back to nothing. This shouldn't negatively affect the Doodle stuff... but it didn't work for me when I tested it, so it's hard to tell. This is a change I made while at Meebo Modified Paths: -------------- branches/v2_0_0/src/protocols/yahoo/yahoo.c branches/v2_0_0/src/protocols/yahoo/yahoo.h branches/v2_0_0/src/protocols/yahoo/yahoo_filexfer.c Modified: branches/v2_0_0/src/protocols/yahoo/yahoo.c =================================================================== --- branches/v2_0_0/src/protocols/yahoo/yahoo.c 2006-06-22 06:26:38 UTC (rev 16306) +++ branches/v2_0_0/src/protocols/yahoo/yahoo.c 2006-06-22 06:27:35 UTC (rev 16307) @@ -670,6 +670,7 @@ static void yahoo_process_message(GaimConnection *gc, struct yahoo_packet *pkt) { + struct yahoo_data *yd = gc->proto_data; GSList *l = pkt->hash; GSList *list = NULL; struct _yahoo_im *im = NULL; @@ -712,24 +713,29 @@ /** TODO: It seems that this check should be per IM, not global */ /* Check for the Doodle IMV */ - if(im != NULL && imv != NULL && !strcmp(imv, "doodle;11")) + if (im != NULL && imv!= NULL && im->from != NULL) { - GaimWhiteboard *wb; + g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(imv)); - if (!yahoo_privacy_check(gc, im->from)) { - gaim_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); - return; - } + if (strcmp(imv, "doodle;11") == 0) + { + GaimWhiteboard *wb; - wb = gaim_whiteboard_get_session(gc->account, im->from); + if (!yahoo_privacy_check(gc, im->from)) { + gaim_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); + return; + } - /* If a Doodle session doesn't exist between this user */ - if(wb == NULL) - { - wb = gaim_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED); + wb = gaim_whiteboard_get_session(gc->account, im->from); - yahoo_doodle_command_send_request(gc, im->from); - yahoo_doodle_command_send_ready(gc, im->from); + /* If a Doodle session doesn't exist between this user */ + if(wb == NULL) + { + wb = gaim_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED); + + yahoo_doodle_command_send_request(gc, im->from); + yahoo_doodle_command_send_ready(gc, im->from); + } } } @@ -2576,6 +2582,7 @@ /* TODO: Is there a good grow size for the buffer? */ yd->txbuf = gaim_circ_buffer_new(0); yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); + yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); yd->confs = NULL; yd->conf_id = 2; @@ -2628,6 +2635,7 @@ yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ g_hash_table_destroy(yd->friends); + g_hash_table_destroy(yd->imvironments); g_free(yd->chat_name); g_free(yd->cookie_y); @@ -3101,14 +3109,30 @@ yahoo_packet_hash_str(pkt, 97, "1"); yahoo_packet_hash_str(pkt, 14, msg2); - /* If this message is to a user who is also Doodling with the local user, + /* + * IMVironment. + * + * If this message is to a user who is also Doodling with the local user, * format the chat packet with the correct IMV information (thanks Yahoo!) - */ - wb = gaim_whiteboard_get_session(gc->account, (char*)who); + * + * Otherwise attempt to use the same IMVironment as the remote user, + * just so that we don't inadvertantly reset their IMVironment back + * to nothing. + * + * If they have no set an IMVironment, then use the default. + */ + wb = gaim_whiteboard_get_session(gc->account, who); if (wb) - yahoo_packet_hash_str(pkt, 63, "doodle;11"); + yahoo_packet_hash_str(pkt, 63, "doodle;11"); else - yahoo_packet_hash_str(pkt, 63, ";0"); /* IMvironment */ + { + const char *imv; + imv = g_hash_table_lookup(yd->imvironments, who); + if (imv != NULL) + yahoo_packet_hash_str(pkt, 63, imv); + else + yahoo_packet_hash_str(pkt, 63, ";0"); + } yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */ yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */ Modified: branches/v2_0_0/src/protocols/yahoo/yahoo.h =================================================================== --- branches/v2_0_0/src/protocols/yahoo/yahoo.h 2006-06-22 06:26:38 UTC (rev 16306) +++ branches/v2_0_0/src/protocols/yahoo/yahoo.h 2006-06-22 06:27:35 UTC (rev 16307) @@ -105,6 +105,16 @@ GaimCircBuffer *txbuf; guint txhandler; GHashTable *friends; + + /** + * This is used to keep track of the IMVironment chosen + * by people you talk to. We don't do very much with + * this right now... but at least now if the remote user + * selects an IMVironment we won't reset it back to the + * default of nothing. + */ + GHashTable *imvironments; + int current_status; gboolean logged_in; GString *tmp_serv_blist, *tmp_serv_ilist, *tmp_serv_plist; Modified: branches/v2_0_0/src/protocols/yahoo/yahoo_filexfer.c =================================================================== --- branches/v2_0_0/src/protocols/yahoo/yahoo_filexfer.c 2006-06-22 06:26:38 UTC (rev 16306) +++ branches/v2_0_0/src/protocols/yahoo/yahoo_filexfer.c 2006-06-22 06:27:35 UTC (rev 16307) @@ -481,14 +481,18 @@ char *to = NULL; char *msg = NULL; char *url = NULL; + char *imv = NULL; long expires = 0; GaimXfer *xfer; + struct yahoo_data *yd; struct yahoo_xfer_data *xfer_data; char *service = NULL; char *filename = NULL; unsigned long filesize = 0L; GSList *l; + yd = gc->proto_data; + for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -508,8 +512,19 @@ filesize = atol(pair->value); if (pair->key == 49) service = pair->value; + if (pair->key == 63) + imv = pair->value; } + /* + * The remote user has changed their IMVironment. We + * record it for later use. + */ + if (from && imv && service && (strcmp("IMVIRONMENT", service) == 0)) { + g_hash_table_replace(yd->imvironments, g_strdup(from), g_strdup(imv)); + return; + } + if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { if (service && (strcmp("FILEXFER", service) != 0)) { gaim_debug_misc("yahoo", "unhandled service 0x%02x\n", pkt->service); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-06-22 06:26:42
|
Revision: 16306 Author: thekingant Date: 2006-06-21 23:26:38 -0700 (Wed, 21 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16306&view=rev Log Message: ----------- Keep track of the Yahoo! IMVironment specified by the people we're IMing with. When we reply to their IMs, we now send the same IMVironment instead of always sending an empty IMVironment because sending an empty IMVironment would reset their IMVironment back to nothing. This shouldn't negatively affect the Doodle stuff... but it didn't work for me when I tested it, so it's hard to tell. This is a change I made while at Meebo Modified Paths: -------------- trunk/src/protocols/yahoo/yahoo.c trunk/src/protocols/yahoo/yahoo.h trunk/src/protocols/yahoo/yahoo_filexfer.c Modified: trunk/src/protocols/yahoo/yahoo.c =================================================================== --- trunk/src/protocols/yahoo/yahoo.c 2006-06-22 06:00:25 UTC (rev 16305) +++ trunk/src/protocols/yahoo/yahoo.c 2006-06-22 06:26:38 UTC (rev 16306) @@ -670,6 +670,7 @@ static void yahoo_process_message(GaimConnection *gc, struct yahoo_packet *pkt) { + struct yahoo_data *yd = gc->proto_data; GSList *l = pkt->hash; GSList *list = NULL; struct _yahoo_im *im = NULL; @@ -712,24 +713,29 @@ /** TODO: It seems that this check should be per IM, not global */ /* Check for the Doodle IMV */ - if(im != NULL && imv != NULL && !strcmp(imv, "doodle;11")) + if (im != NULL && imv!= NULL && im->from != NULL) { - GaimWhiteboard *wb; + g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(imv)); - if (!yahoo_privacy_check(gc, im->from)) { - gaim_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); - return; - } + if (strcmp(imv, "doodle;11") == 0) + { + GaimWhiteboard *wb; - wb = gaim_whiteboard_get_session(gc->account, im->from); + if (!yahoo_privacy_check(gc, im->from)) { + gaim_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); + return; + } - /* If a Doodle session doesn't exist between this user */ - if(wb == NULL) - { - wb = gaim_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED); + wb = gaim_whiteboard_get_session(gc->account, im->from); - yahoo_doodle_command_send_request(gc, im->from); - yahoo_doodle_command_send_ready(gc, im->from); + /* If a Doodle session doesn't exist between this user */ + if(wb == NULL) + { + wb = gaim_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED); + + yahoo_doodle_command_send_request(gc, im->from); + yahoo_doodle_command_send_ready(gc, im->from); + } } } @@ -2576,6 +2582,7 @@ /* TODO: Is there a good grow size for the buffer? */ yd->txbuf = gaim_circ_buffer_new(0); yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); + yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); yd->confs = NULL; yd->conf_id = 2; @@ -2628,6 +2635,7 @@ yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ g_hash_table_destroy(yd->friends); + g_hash_table_destroy(yd->imvironments); g_free(yd->chat_name); g_free(yd->cookie_y); @@ -3101,14 +3109,30 @@ yahoo_packet_hash_str(pkt, 97, "1"); yahoo_packet_hash_str(pkt, 14, msg2); - /* If this message is to a user who is also Doodling with the local user, + /* + * IMVironment. + * + * If this message is to a user who is also Doodling with the local user, * format the chat packet with the correct IMV information (thanks Yahoo!) - */ - wb = gaim_whiteboard_get_session(gc->account, (char*)who); + * + * Otherwise attempt to use the same IMVironment as the remote user, + * just so that we don't inadvertantly reset their IMVironment back + * to nothing. + * + * If they have no set an IMVironment, then use the default. + */ + wb = gaim_whiteboard_get_session(gc->account, who); if (wb) - yahoo_packet_hash_str(pkt, 63, "doodle;11"); + yahoo_packet_hash_str(pkt, 63, "doodle;11"); else - yahoo_packet_hash_str(pkt, 63, ";0"); /* IMvironment */ + { + const char *imv; + imv = g_hash_table_lookup(yd->imvironments, who); + if (imv != NULL) + yahoo_packet_hash_str(pkt, 63, imv); + else + yahoo_packet_hash_str(pkt, 63, ";0"); + } yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */ yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */ Modified: trunk/src/protocols/yahoo/yahoo.h =================================================================== --- trunk/src/protocols/yahoo/yahoo.h 2006-06-22 06:00:25 UTC (rev 16305) +++ trunk/src/protocols/yahoo/yahoo.h 2006-06-22 06:26:38 UTC (rev 16306) @@ -105,6 +105,16 @@ GaimCircBuffer *txbuf; guint txhandler; GHashTable *friends; + + /** + * This is used to keep track of the IMVironment chosen + * by people you talk to. We don't do very much with + * this right now... but at least now if the remote user + * selects an IMVironment we won't reset it back to the + * default of nothing. + */ + GHashTable *imvironments; + int current_status; gboolean logged_in; GString *tmp_serv_blist, *tmp_serv_ilist, *tmp_serv_plist; Modified: trunk/src/protocols/yahoo/yahoo_filexfer.c =================================================================== --- trunk/src/protocols/yahoo/yahoo_filexfer.c 2006-06-22 06:00:25 UTC (rev 16305) +++ trunk/src/protocols/yahoo/yahoo_filexfer.c 2006-06-22 06:26:38 UTC (rev 16306) @@ -481,14 +481,18 @@ char *to = NULL; char *msg = NULL; char *url = NULL; + char *imv = NULL; long expires = 0; GaimXfer *xfer; + struct yahoo_data *yd; struct yahoo_xfer_data *xfer_data; char *service = NULL; char *filename = NULL; unsigned long filesize = 0L; GSList *l; + yd = gc->proto_data; + for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -508,8 +512,19 @@ filesize = atol(pair->value); if (pair->key == 49) service = pair->value; + if (pair->key == 63) + imv = pair->value; } + /* + * The remote user has changed their IMVironment. We + * record it for later use. + */ + if (from && imv && service && (strcmp("IMVIRONMENT", service) == 0)) { + g_hash_table_replace(yd->imvironments, g_strdup(from), g_strdup(imv)); + return; + } + if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { if (service && (strcmp("FILEXFER", service) != 0)) { gaim_debug_misc("yahoo", "unhandled service 0x%02x\n", pkt->service); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aar...@us...> - 2006-06-22 06:00:29
|
Revision: 16305 Author: aaronsheldon Date: 2006-06-21 23:00:25 -0700 (Wed, 21 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16305&view=rev Log Message: ----------- No longer refreshes the GTK Buddy List when it isn't visible, be it iconified, shrunk into the system tray or just stuck behind other windows. When it is brought back to a visible state, an update is quickly done. One small revert and one style/ordering fix. Modified Paths: -------------- branches/soc-2006-blist-efficiency/src/gtkblist.c Modified: branches/soc-2006-blist-efficiency/src/gtkblist.c =================================================================== --- branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-06-21 15:19:28 UTC (rev 16304) +++ branches/soc-2006-blist-efficiency/src/gtkblist.c 2006-06-22 06:00:25 UTC (rev 16305) @@ -118,6 +118,7 @@ #endif static GaimGtkBuddyList *gtkblist = NULL; +static gboolean gaim_gtk_blist_refresh_timer(GaimBuddyList *list); static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node); static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data); static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node); @@ -160,8 +161,10 @@ { if (event->state == GDK_VISIBILITY_FULLY_OBSCURED) gtk_blist_obscured = TRUE; - else - gtk_blist_obscured = FALSE; + else if (gtk_blist_obscured) { + gtk_blist_obscured = FALSE; + gaim_gtk_blist_refresh_timer(gaim_get_blist()); + } /* continue to handle event normally */ return FALSE; @@ -172,8 +175,10 @@ if(event->changed_mask & GDK_WINDOW_STATE_WITHDRAWN) { if(event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN) gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", FALSE); - else + else { gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", TRUE); + gaim_gtk_blist_refresh_timer(gaim_get_blist()); + } } if(event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) { @@ -182,7 +187,13 @@ else gaim_prefs_set_bool("/gaim/gtk/blist/list_maximized", FALSE); } - + + /* Refresh gtkblist if un-iconifying */ + if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED){ + if (!(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED)) + gaim_gtk_blist_refresh_timer(gaim_get_blist()); + } + return FALSE; } @@ -3052,6 +3063,9 @@ { GaimBlistNode *gnode, *cnode; + if (gtk_blist_obscured || !GTK_WIDGET_VISIBLE(gtkblist->window)) + return TRUE; + for(gnode = list->root; gnode; gnode = gnode->next) { if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) continue; @@ -3995,7 +4009,7 @@ gtkblist->selected_node = new_selection; if(new_selection) gaim_gtk_blist_update(NULL, new_selection); - else if(old_selection) + if(old_selection) gaim_gtk_blist_update(NULL, old_selection); } @@ -4088,10 +4102,10 @@ if (GAIM_BLIST_NODE_IS_GROUP(node)) gnode = node; + else if (GAIM_BLIST_NODE_IS_BUDDY(node)) /* maybe OR'ed with IS_CHAT? */ + gnode = node->parent->parent; else if (GAIM_BLIST_NODE_IS_CONTACT(node)) gnode = node->parent; - else if (GAIM_BLIST_NODE_IS_BUDDY(node)) //maybe OR'ed with IS_CHAT? - gnode = node->parent->parent; g_return_if_fail(GAIM_BLIST_NODE_IS_GROUP(gnode)); group = (GaimGroup*)gnode; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2006-06-21 16:05:29
|
Revision: 16304 Author: deryni9 Date: 2006-06-21 08:19:28 -0700 (Wed, 21 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16304&view=rev Log Message: ----------- See, and this is why I had Ethan look this over. Having signal and command callbacks conflict with each other would be bad. Modified Paths: -------------- trunk/plugins/tcl/tcl_cmd.c Modified: trunk/plugins/tcl/tcl_cmd.c =================================================================== --- trunk/plugins/tcl/tcl_cmd.c 2006-06-21 15:14:26 UTC (rev 16303) +++ trunk/plugins/tcl/tcl_cmd.c 2006-06-21 15:19:28 UTC (rev 16304) @@ -184,6 +184,7 @@ char name[32]; static int cbnum; - g_snprintf(name, sizeof(name), "::gaim::_callback::cb_%d", cbnum++); + g_snprintf(name, sizeof(name), "::gaim::_cmd_callback::cb_%d", + cbnum++); return Tcl_NewStringObj(name, -1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2006-06-21 16:05:19
|
Revision: 16303 Author: deryni9 Date: 2006-06-21 08:14:26 -0700 (Wed, 21 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16303&view=rev Log Message: ----------- 08:50:00 <+Paco-Paco> deryni: instead of Tcl_NewIntObj((int)conv), you should use gaim_tcl_ref_new(GaimTclRefConversation, conv) Done and done. Next up, error messages (later). Modified Paths: -------------- trunk/plugins/tcl/tcl_cmd.c Modified: trunk/plugins/tcl/tcl_cmd.c =================================================================== --- trunk/plugins/tcl/tcl_cmd.c 2006-06-21 13:51:19 UTC (rev 16302) +++ trunk/plugins/tcl/tcl_cmd.c 2006-06-21 15:14:26 UTC (rev 16303) @@ -137,7 +137,7 @@ Tcl_ListObjAppendElement(handler->interp, command, arg); /* The conversation */ - arg = Tcl_NewIntObj((int)conv); + arg = gaim_tcl_ref_new(GaimTclRefConversation, conv); Tcl_ListObjAppendElement(handler->interp, command, arg); /* The command */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dat...@us...> - 2006-06-21 13:51:24
|
Revision: 16302 Author: datallah Date: 2006-06-21 06:51:19 -0700 (Wed, 21 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16302&view=rev Log Message: ----------- Added new tcl_cmd.c to the win32 Makefile Modified Paths: -------------- trunk/plugins/tcl/Makefile.mingw Modified: trunk/plugins/tcl/Makefile.mingw =================================================================== --- trunk/plugins/tcl/Makefile.mingw 2006-06-21 04:57:27 UTC (rev 16301) +++ trunk/plugins/tcl/Makefile.mingw 2006-06-21 13:51:19 UTC (rev 16302) @@ -61,6 +61,7 @@ ## C_SRC = tcl.c \ + tcl_cmd.c \ tcl_cmds.c \ tcl_glib.c \ tcl_ref.c \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2006-06-21 04:58:19
|
Revision: 16301 Author: deryni9 Date: 2006-06-20 21:57:27 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16301&view=rev Log Message: ----------- This is tcl /cmd support. It doesn't currently let tcl plugins return error message (I couldn't ever get that to work). But other than that it works. Ethan please look over this when you get a chance. Modified Paths: -------------- trunk/plugins/tcl/Makefile.am trunk/plugins/tcl/tcl.c trunk/plugins/tcl/tcl_cmds.c trunk/plugins/tcl/tcl_gaim.h trunk/plugins/tcl/tcl_signals.c Added Paths: ----------- trunk/plugins/tcl/tcl_cmd.c Modified: trunk/plugins/tcl/Makefile.am =================================================================== --- trunk/plugins/tcl/Makefile.am 2006-06-21 04:10:47 UTC (rev 16300) +++ trunk/plugins/tcl/Makefile.am 2006-06-21 04:57:27 UTC (rev 16301) @@ -5,7 +5,7 @@ plugin_LTLIBRARIES = tcl.la tcl_la_SOURCES = tcl.c tcl_glib.c tcl_glib.h tcl_cmds.c tcl_signals.c tcl_gaim.h \ - tcl_ref.c + tcl_ref.c tcl_cmd.c EXTRA_DIST = signal-test.tcl Makefile.mingw Modified: trunk/plugins/tcl/tcl.c =================================================================== --- trunk/plugins/tcl/tcl.c 2006-06-21 04:10:47 UTC (rev 16300) +++ trunk/plugins/tcl/tcl.c 2006-06-21 04:57:27 UTC (rev 16301) @@ -126,6 +126,7 @@ Tcl_CreateObjCommand(interp, "::gaim::account", tcl_cmd_account, (ClientData)NULL, NULL); Tcl_CreateObjCommand(interp, "::gaim::buddy", tcl_cmd_buddy, (ClientData)NULL, NULL); + Tcl_CreateObjCommand(interp, "::gaim::cmd", tcl_cmd_cmd, (ClientData)NULL, NULL); Tcl_CreateObjCommand(interp, "::gaim::connection", tcl_cmd_connection, (ClientData)NULL, NULL); Tcl_CreateObjCommand(interp, "::gaim::conversation", tcl_cmd_conversation, (ClientData)NULL, NULL); Tcl_CreateObjCommand(interp, "::gaim::core", tcl_cmd_core, (ClientData)NULL, NULL); @@ -284,7 +285,9 @@ if (Tcl_EvalFile(interp, plugin->path) != TCL_OK) { result = Tcl_GetObjResult(interp); - gaim_debug(GAIM_DEBUG_ERROR, "tcl", "Error evaluating %s: %s\n", plugin->path, Tcl_GetString(result)); + gaim_debug(GAIM_DEBUG_ERROR, "tcl", + "Error evaluating %s: %s\n", plugin->path, + Tcl_GetString(result)); Tcl_DeleteInterp(interp); return FALSE; } @@ -313,6 +316,7 @@ if (data != NULL) { g_hash_table_remove(tcl_plugins, (gpointer)(data->interp)); gaim_signals_disconnect_by_handle(data->interp); + tcl_cmd_cleanup(data->interp); tcl_signal_cleanup(data->interp); Tcl_Release((ClientData)data->interp); Tcl_DeleteInterp(data->interp); @@ -341,6 +345,7 @@ if(!tcl_loaded) return FALSE; tcl_glib_init(); + tcl_cmd_init(); tcl_signal_init(); gaim_tcl_ref_init(); Added: trunk/plugins/tcl/tcl_cmd.c =================================================================== --- trunk/plugins/tcl/tcl_cmd.c (rev 0) +++ trunk/plugins/tcl/tcl_cmd.c 2006-06-21 04:57:27 UTC (rev 16301) @@ -0,0 +1,189 @@ +/** + * @file tcl_cmd.c Gaim Tcl cmd API + * + * gaim + * + * Copyright (C) 2006 Etan Reisner <de...@gm...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <tcl.h> + +#include "tcl_gaim.h" + +#include "internal.h" +#include "cmds.h" +#include "debug.h" + +static GList *tcl_cmd_callbacks; + +static GaimCmdRet tcl_cmd_callback(GaimConversation *conv, const gchar *cmd, + gchar **args, gchar **errors, + struct tcl_cmd_handler *handler); +static Tcl_Obj *new_cmd_cb_namespace(void); + +void tcl_cmd_init() +{ + tcl_cmd_callbacks = NULL; +} + +void tcl_cmd_handler_free(struct tcl_cmd_handler *handler) +{ + if (handler == NULL) + return; + + Tcl_DecrRefCount(handler->namespace); + g_free(handler); +} + +void tcl_cmd_cleanup(Tcl_Interp *interp) +{ + GList *cur; + struct tcl_cmd_handler *handler; + + for (cur = tcl_cmd_callbacks; cur != NULL; cur = g_list_next(cur)) { + handler = cur->data; + if (handler->interp == interp) { + gaim_cmd_unregister(handler->id); + tcl_cmd_handler_free(handler); + cur->data = NULL; + } + } + tcl_cmd_callbacks = g_list_remove_all(tcl_cmd_callbacks, NULL); +} + +GaimCmdId tcl_cmd_register(struct tcl_cmd_handler *handler) +{ + int id; + GString *proc; + + if ((id = gaim_cmd_register(Tcl_GetString(handler->cmd), + handler->args, handler->priority, + handler->flags, handler->prpl_id, + GAIM_CMD_FUNC(tcl_cmd_callback), + handler->helpstr, (void *)handler)) == 0) + return 0; + + handler->namespace = new_cmd_cb_namespace (); + Tcl_IncrRefCount(handler->namespace); + proc = g_string_new(""); + g_string_append_printf(proc, "namespace eval %s { proc cb { conv cmd arglist } { %s } }", + Tcl_GetString(handler->namespace), + Tcl_GetString(handler->proc)); + if (Tcl_Eval(handler->interp, proc->str) != TCL_OK) { + Tcl_DecrRefCount(handler->namespace); + g_string_free(proc, TRUE); + return 0; + } + g_string_free(proc, TRUE); + + tcl_cmd_callbacks = g_list_append(tcl_cmd_callbacks, (gpointer)handler); + + return id; +} + +void tcl_cmd_unregister(GaimCmdId id, Tcl_Interp *interp) +{ + GList *cur; + GString *cmd; + gboolean found = FALSE; + struct tcl_cmd_handler *handler; + + for (cur = tcl_cmd_callbacks; cur != NULL; cur = g_list_next(cur)) { + handler = cur->data; + if (handler->interp == interp && handler->id == id) { + gaim_cmd_unregister(id); + cmd = g_string_sized_new(64); + g_string_printf(cmd, "namespace delete %s", + Tcl_GetString(handler->namespace)); + Tcl_EvalEx(interp, cmd->str, -1, TCL_EVAL_GLOBAL); + tcl_cmd_handler_free(handler); + g_string_free(cmd, TRUE); + cur->data = NULL; + found = TRUE; + break; + } + } + + if (found) + tcl_cmd_callbacks = g_list_remove_all(tcl_cmd_callbacks, NULL); +} + +static GaimCmdRet tcl_cmd_callback(GaimConversation *conv, const gchar *cmd, + gchar **args, gchar **errors, + struct tcl_cmd_handler *handler) +{ + int retval, error, i; + Tcl_Obj *command, *arg, *tclargs, *result; + + command = Tcl_NewListObj(0, NULL); + Tcl_IncrRefCount(command); + + /* The callback */ + arg = Tcl_DuplicateObj(handler->namespace); + Tcl_AppendStringsToObj(arg, "::cb", NULL); + Tcl_ListObjAppendElement(handler->interp, command, arg); + + /* The conversation */ + arg = Tcl_NewIntObj((int)conv); + Tcl_ListObjAppendElement(handler->interp, command, arg); + + /* The command */ + arg = Tcl_NewStringObj(cmd, -1); + Tcl_ListObjAppendElement(handler->interp, command, arg); + + /* The args list */ + tclargs = Tcl_NewListObj(0, NULL); + for (i = 0; i < handler->nargs; i++) { + arg = Tcl_NewStringObj(args[i], -1); + + Tcl_ListObjAppendElement(handler->interp, tclargs, arg); + } + Tcl_ListObjAppendElement(handler->interp, command, tclargs); + + if ((error = Tcl_EvalObjEx(handler->interp, command, + TCL_EVAL_GLOBAL)) != TCL_OK) { + gchar *errorstr; + + errorstr = g_strdup_printf("error evaluating callback: %s\n", + Tcl_GetString(Tcl_GetObjResult(handler->interp))); + gaim_debug(GAIM_DEBUG_ERROR, "tcl", errorstr); + *errors = errorstr; + retval = GAIM_CMD_RET_FAILED; + } else { + result = Tcl_GetObjResult(handler->interp); + if ((error = Tcl_GetIntFromObj(handler->interp, result, + &retval)) != TCL_OK) { + gchar *errorstr; + + errorstr = g_strdup_printf("Error retreiving procedure result: %s\n", + Tcl_GetString(Tcl_GetObjResult(handler->interp))); + gaim_debug(GAIM_DEBUG_ERROR, "tcl", errorstr); + *errors = errorstr; + retval = GAIM_CMD_RET_FAILED; + } + } + + return retval; +} + +static Tcl_Obj *new_cmd_cb_namespace() +{ + char name[32]; + static int cbnum; + + g_snprintf(name, sizeof(name), "::gaim::_callback::cb_%d", cbnum++); + return Tcl_NewStringObj(name, -1); +} Property changes on: trunk/plugins/tcl/tcl_cmd.c ___________________________________________________________________ Name: svn:mime-type + text/x-csrc Name: svn:eol-style + native Modified: trunk/plugins/tcl/tcl_cmds.c =================================================================== --- trunk/plugins/tcl/tcl_cmds.c 2006-06-21 04:10:47 UTC (rev 16300) +++ trunk/plugins/tcl/tcl_cmds.c 2006-06-21 04:57:27 UTC (rev 16301) @@ -541,6 +541,70 @@ return TCL_OK; } +int tcl_cmd_cmd(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) +{ + const char *cmds[] = { "register", "unregister", NULL }; + enum { CMD_CMD_REGISTER, CMD_CMD_UNREGISTER } cmd; + struct tcl_cmd_handler *handler; + Tcl_Obj *result = Tcl_GetObjResult(interp); + GaimCmdId id; + int error; + + if (objc < 2) { + Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); + return TCL_ERROR; + } + + if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) + return error; + + switch (cmd) { + case CMD_CMD_REGISTER: + if (objc != 9) { + Tcl_WrongNumArgs(interp, 2, objv, "cmd arglist priority flags prpl_id proc helpstr"); + return TCL_ERROR; + } + handler = g_new0(struct tcl_cmd_handler, 1); + handler->cmd = objv[2]; + handler->args = Tcl_GetString(objv[3]); + handler->nargs = strlen(handler->args); + if ((error = Tcl_GetIntFromObj(interp, objv[4], + &handler->priority)) != TCL_OK) { + g_free(handler); + return error; + } + if ((error = Tcl_GetIntFromObj(interp, objv[5], + &handler->flags)) != TCL_OK) { + g_free(handler); + return error; + } + handler->prpl_id = Tcl_GetString(objv[6]); + handler->proc = objv[7]; + handler->helpstr = Tcl_GetString(objv[8]); + handler->interp = interp; + if ((id = tcl_cmd_register(handler)) == 0) { + tcl_cmd_handler_free(handler); + Tcl_SetIntObj(result, 0); + } else { + handler->id = id; + Tcl_SetIntObj(result, id); + } + break; + case CMD_CMD_UNREGISTER: + if (objc != 3) { + Tcl_WrongNumArgs(interp, 2, objv, "id"); + return TCL_ERROR; + } + if ((error = Tcl_GetIntFromObj(interp, objv[2], + (int *)&id)) != TCL_OK) + return error; + tcl_cmd_unregister(id, interp); + break; + } + + return TCL_OK; +} + int tcl_cmd_connection(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj *result = Tcl_GetObjResult(interp), *list, *elem; Modified: trunk/plugins/tcl/tcl_gaim.h =================================================================== --- trunk/plugins/tcl/tcl_gaim.h 2006-06-21 04:10:47 UTC (rev 16300) +++ trunk/plugins/tcl/tcl_gaim.h 2006-06-21 04:57:27 UTC (rev 16301) @@ -26,6 +26,7 @@ #include <tcl.h> #include "internal.h" +#include "cmds.h" #include "plugin.h" #include "value.h" #include "stringref.h" @@ -45,6 +46,23 @@ GaimValue **argtypes; }; +struct tcl_cmd_handler { + int id; + Tcl_Obj *cmd; + Tcl_Interp *interp; + + Tcl_Obj *namespace; + /* These are temporary during setup */ + const char *args; + int priority; + int flags; + const char *prpl_id; + Tcl_Obj *proc; + const char *helpstr; + + int nargs; +}; + extern GaimPlugin *_tcl_plugin; /* Capitalized this way because these are "types" */ @@ -65,6 +83,12 @@ gboolean tcl_signal_connect(struct tcl_signal_handler *handler); void tcl_signal_disconnect(void *instance, const char *signal, Tcl_Interp *interp); +void tcl_cmd_init(void); +void tcl_cmd_handler_free(struct tcl_cmd_handler *handler); +void tcl_cmd_cleanup(Tcl_Interp *interp); +GaimCmdId tcl_cmd_register(struct tcl_cmd_handler *handler); +void tcl_cmd_unregister(GaimCmdId id, Tcl_Interp *interp); + void gaim_tcl_ref_init(void); void *gaim_tcl_ref_get(Tcl_Interp *interp, Tcl_Obj *obj, GaimStringref *type); Tcl_Obj *gaim_tcl_ref_new(GaimStringref *type, void *value); @@ -72,6 +96,7 @@ Tcl_ObjCmdProc tcl_cmd_account; Tcl_ObjCmdProc tcl_cmd_signal_connect; Tcl_ObjCmdProc tcl_cmd_buddy; +Tcl_ObjCmdProc tcl_cmd_cmd; Tcl_ObjCmdProc tcl_cmd_connection; Tcl_ObjCmdProc tcl_cmd_conversation; Tcl_ObjCmdProc tcl_cmd_core; Modified: trunk/plugins/tcl/tcl_signals.c =================================================================== --- trunk/plugins/tcl/tcl_signals.c 2006-06-21 04:10:47 UTC (rev 16300) +++ trunk/plugins/tcl/tcl_signals.c 2006-06-21 04:57:27 UTC (rev 16301) @@ -387,7 +387,6 @@ g_string_free(val, TRUE); g_free(vals); g_free(strs); - return retval; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ebl...@us...> - 2006-06-21 04:10:55
|
Revision: 16300 Author: eblanton Date: 2006-06-20 21:10:47 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16300&view=rev Log Message: ----------- Etan points out that this is a bad copy-and-paste (see r16299) Modified Paths: -------------- trunk/plugins/tcl/tcl_cmds.c Modified: trunk/plugins/tcl/tcl_cmds.c =================================================================== --- trunk/plugins/tcl/tcl_cmds.c 2006-06-21 04:00:45 UTC (rev 16299) +++ trunk/plugins/tcl/tcl_cmds.c 2006-06-21 04:10:47 UTC (rev 16300) @@ -73,7 +73,7 @@ return convo; } if (interp != NULL) - Tcl_SetStringObj(Tcl_GetObjResult(interp), "invalid account", -1); + Tcl_SetStringObj(Tcl_GetObjResult(interp), "invalid conversation", -1); return NULL; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2006-06-21 04:00:51
|
Revision: 16299 Author: deryni9 Date: 2006-06-20 21:00:45 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16299&view=rev Log Message: ----------- I'm assuming this was a bad copy and paste. Since I'm pretty sure this is what should be here. Modified Paths: -------------- branches/v2_0_0/plugins/tcl/tcl_cmds.c Modified: branches/v2_0_0/plugins/tcl/tcl_cmds.c =================================================================== --- branches/v2_0_0/plugins/tcl/tcl_cmds.c 2006-06-20 21:39:33 UTC (rev 16298) +++ branches/v2_0_0/plugins/tcl/tcl_cmds.c 2006-06-21 04:00:45 UTC (rev 16299) @@ -60,7 +60,7 @@ return TRUE; } if (interp != NULL) - Tcl_SetStringObj(Tcl_GetObjResult(interp), "invalid account", -1); + Tcl_SetStringObj(Tcl_GetObjResult(interp), "invalid conversation", -1); return FALSE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2006-06-20 21:39:44
|
Revision: 16298 Author: deryni9 Date: 2006-06-20 14:39:33 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16298&view=rev Log Message: ----------- Merging revision 16297 from HEAD. Original commit message: Report 'no' when not building with these libraries, instead of reporting nothing and having the next message on the same line. ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16297&view=rev Modified Paths: -------------- branches/v2_0_0/configure.ac Modified: branches/v2_0_0/configure.ac =================================================================== --- branches/v2_0_0/configure.ac 2006-06-20 16:04:00 UTC (rev 16297) +++ branches/v2_0_0/configure.ac 2006-06-20 21:39:33 UTC (rev 16298) @@ -163,7 +163,11 @@ dnl # GStreamer dnl ####################################################################### enable_gst=yes -PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.10, ,enable_gst=no) +PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], , + [ + AC_MSG_RESULT(no) + enable_gst=no + ]) AC_SUBST(GSTREAMER_CFLAGS) AC_SUBST(GSTREAMER_LIBS) AC_ARG_ENABLE(gstreamer,[ --disable-gstreamer compile without GStreamer audio support],enable_gst=no) @@ -175,7 +179,11 @@ dnl # LibXML2 dnl ################# enable_libxml2=yes -PKG_CHECK_MODULES(LIBXML, libxml-2.0, ,enable_libxml2=no) +PKG_CHECK_MODULES(LIBXML, [libxml-2.0], , + [ + AC_MSG_RESULT(no) + enable_libxml2=no + ]) AC_SUBST(LIBXML_CFLAGS) AC_SUBST(LIBXML_LIBS) AC_ARG_ENABLE(libxml,[ --disable-libxml compile without libxml2 support],enable_libxml2=no) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2006-06-20 16:04:11
|
Revision: 16297 Author: deryni9 Date: 2006-06-20 09:04:00 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16297&view=rev Log Message: ----------- Report 'no' when not building with these libraries, instead of reporting nothing and having the next message on the same line. Modified Paths: -------------- trunk/configure.ac Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2006-06-20 08:18:55 UTC (rev 16296) +++ trunk/configure.ac 2006-06-20 16:04:00 UTC (rev 16297) @@ -163,7 +163,11 @@ dnl # GStreamer dnl ####################################################################### enable_gst=yes -PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.10, ,enable_gst=no) +PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], , + [ + AC_MSG_RESULT(no) + enable_gst=no + ]) AC_SUBST(GSTREAMER_CFLAGS) AC_SUBST(GSTREAMER_LIBS) AC_ARG_ENABLE(gstreamer,[ --disable-gstreamer compile without GStreamer audio support],enable_gst=no) @@ -175,7 +179,11 @@ dnl # LibXML2 dnl ################# enable_libxml2=yes -PKG_CHECK_MODULES(LIBXML, libxml-2.0, ,enable_libxml2=no) +PKG_CHECK_MODULES(LIBXML, [libxml-2.0], , + [ + AC_MSG_RESULT(no) + enable_libxml2=no + ]) AC_SUBST(LIBXML_CFLAGS) AC_SUBST(LIBXML_LIBS) AC_ARG_ENABLE(libxml,[ --disable-libxml compile without libxml2 support],enable_libxml2=no) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-06-20 08:19:02
|
Revision: 16296 Author: thekingant Date: 2006-06-20 01:18:55 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16296&view=rev Log Message: ----------- Backport revision 16295 from HEAD to the v2_0_0 branch of Subversion. Original commit message: Hopefully improve the typing notification code so it's a lot easier to understand. This also creates a distinction between the signals emitted when receiving GAIM_TYPED and GAIM_NOT_TYPING messages (by adding a gaim-typed signal). And the gaim-not-typing signal should work in all cases. Most of this is stuff I changed last week during work, thanks to Meebo ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16295&view=rev Modified Paths: -------------- branches/v2_0_0/plugins/perl/common/Conversation.xs branches/v2_0_0/plugins/perl/common/Server.xs branches/v2_0_0/src/conversation.c branches/v2_0_0/src/conversation.h branches/v2_0_0/src/gtkconv.c branches/v2_0_0/src/gtkpounce.c branches/v2_0_0/src/pounce.c branches/v2_0_0/src/pounce.h branches/v2_0_0/src/protocols/jabber/message.c branches/v2_0_0/src/protocols/jabber/message.h branches/v2_0_0/src/protocols/msn/msn.c branches/v2_0_0/src/protocols/novell/novell.c branches/v2_0_0/src/protocols/oscar/oscar.c branches/v2_0_0/src/protocols/sametime/sametime.c branches/v2_0_0/src/protocols/simple/simple.c branches/v2_0_0/src/protocols/yahoo/yahoo.c branches/v2_0_0/src/protocols/zephyr/zephyr.c branches/v2_0_0/src/prpl.h branches/v2_0_0/src/server.c branches/v2_0_0/src/server.h Modified: branches/v2_0_0/plugins/perl/common/Conversation.xs =================================================================== --- branches/v2_0_0/plugins/perl/common/Conversation.xs 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/plugins/perl/common/Conversation.xs 2006-06-20 08:18:55 UTC (rev 16296) @@ -179,15 +179,15 @@ Gaim::Conversation::IM im void -gaim_conv_im_start_type_again_timeout(im) +gaim_conv_im_start_send_typed_timeout(im) Gaim::Conversation::IM im void -gaim_conv_im_stop_type_again_timeout(im) +gaim_conv_im_stop_send_typed_timeout(im) Gaim::Conversation::IM im guint -gaim_conv_im_get_type_again_timeout(im) +gaim_conv_im_get_send_typed_timeout(im) Gaim::Conversation::IM im void Modified: branches/v2_0_0/plugins/perl/common/Server.xs =================================================================== --- branches/v2_0_0/plugins/perl/common/Server.xs 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/plugins/perl/common/Server.xs 2006-06-20 08:18:55 UTC (rev 16296) @@ -200,10 +200,10 @@ Gaim::MessageFlags flags int -serv_send_typing(con, a, b) +serv_send_typing(con, a, state) Gaim::Connection con const char * a - int b + Gaim::TypingState state void serv_set_buddyicon(gc, filename) Modified: branches/v2_0_0/src/conversation.c =================================================================== --- branches/v2_0_0/src/conversation.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/conversation.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -46,39 +46,44 @@ } static gboolean -reset_typing(gpointer data) +reset_typing_cb(gpointer data) { GaimConversation *c = (GaimConversation *)data; GaimConvIm *im; - if (!g_list_find(conversations, c)) - return FALSE; - im = GAIM_CONV_IM(c); gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING); gaim_conv_im_update_typing(im); gaim_conv_im_stop_typing_timeout(im); + gaim_signal_emit(gaim_conversations_get_handle(), + "buddy-typing-stopped", c); + return FALSE; } static gboolean -send_typed(gpointer data) +send_typed_cb(gpointer data) { GaimConversation *conv = (GaimConversation *)data; GaimConnection *gc; const char *name; g_return_val_if_fail(conv != NULL, FALSE); - + gc = gaim_conversation_get_gc(conv); name = gaim_conversation_get_name(conv); if (gc != NULL && name != NULL) { - gaim_conv_im_set_type_again(GAIM_CONV_IM(conv), TRUE); + /* We set this to 1 so that GAIM_TYPING will be sent + * if the Gaim user types anything else. + */ + gaim_conv_im_set_type_again(GAIM_CONV_IM(conv), 1); serv_send_typing(gc, name, GAIM_TYPED); + gaim_signal_emit(gaim_conversations_get_handle(), + "buddy-typed", conv); gaim_debug(GAIM_DEBUG_MISC, "conversation", "typed...\n"); } @@ -420,7 +425,7 @@ if (conv->type == GAIM_CONV_TYPE_IM) { gaim_conv_im_stop_typing_timeout(conv->u.im); - gaim_conv_im_stop_type_again_timeout(conv->u.im); + gaim_conv_im_stop_send_typed_timeout(conv->u.im); if (conv->u.im->icon != NULL) gaim_buddy_icon_unref(conv->u.im->icon); @@ -986,9 +991,14 @@ gaim_signal_emit(gaim_conversations_get_handle(), "buddy-typing", im->conv->account, im->conv->name); } - else + else if (state == GAIM_TYPED) { gaim_signal_emit(gaim_conversations_get_handle(), + "buddy-typed", im->conv->account, im->conv->name); + } + else if (state == GAIM_NOT_TYPING) + { + gaim_signal_emit(gaim_conversations_get_handle(), "buddy-typing-stopped", im->conv->account, im->conv->name); } } @@ -1016,7 +1026,7 @@ conv = gaim_conv_im_get_conversation(im); name = gaim_conversation_get_name(conv); - im->typing_timeout = gaim_timeout_add(timeout * 1000, reset_typing, conv); + im->typing_timeout = gaim_timeout_add(timeout * 1000, reset_typing_cb, conv); } void @@ -1040,11 +1050,14 @@ } void -gaim_conv_im_set_type_again(GaimConvIm *im, time_t val) +gaim_conv_im_set_type_again(GaimConvIm *im, unsigned int val) { g_return_if_fail(im != NULL); - im->type_again = val; + if (val == 0) + im->type_again = 0; + else + im->type_again = time(NULL) + val; } time_t @@ -1056,32 +1069,32 @@ } void -gaim_conv_im_start_type_again_timeout(GaimConvIm *im) +gaim_conv_im_start_send_typed_timeout(GaimConvIm *im) { g_return_if_fail(im != NULL); - im->type_again_timeout = gaim_timeout_add(SEND_TYPED_TIMEOUT, send_typed, + im->send_typed_timeout = gaim_timeout_add(SEND_TYPED_TIMEOUT, send_typed_cb, gaim_conv_im_get_conversation(im)); } void -gaim_conv_im_stop_type_again_timeout(GaimConvIm *im) +gaim_conv_im_stop_send_typed_timeout(GaimConvIm *im) { g_return_if_fail(im != NULL); - if (im->type_again_timeout == 0) + if (im->send_typed_timeout == 0) return; - gaim_timeout_remove(im->type_again_timeout); - im->type_again_timeout = 0; + gaim_timeout_remove(im->send_typed_timeout); + im->send_typed_timeout = 0; } guint -gaim_conv_im_get_type_again_timeout(const GaimConvIm *im) +gaim_conv_im_get_send_typed_timeout(const GaimConvIm *im) { g_return_val_if_fail(im != NULL, 0); - return im->type_again_timeout; + return im->send_typed_timeout; } void @@ -2090,6 +2103,12 @@ GAIM_SUBTYPE_ACCOUNT), gaim_value_new(GAIM_TYPE_STRING)); + gaim_signal_register(handle, "buddy-typed", + gaim_marshal_VOID__POINTER_POINTER, NULL, 2, + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_ACCOUNT), + gaim_value_new(GAIM_TYPE_STRING)); + gaim_signal_register(handle, "buddy-typing-stopped", gaim_marshal_VOID__POINTER_POINTER, NULL, 2, gaim_value_new(GAIM_TYPE_SUBTYPE, Modified: branches/v2_0_0/src/conversation.h =================================================================== --- branches/v2_0_0/src/conversation.h 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/conversation.h 2006-06-20 08:18:55 UTC (rev 16296) @@ -186,7 +186,7 @@ GaimTypingState typing_state; /**< The current typing state. */ guint typing_timeout; /**< The typing timer handle. */ time_t type_again; /**< The type again time. */ - guint type_again_timeout; /**< The type again timer handle. */ + guint send_typed_timeout; /**< The type again timer handle. */ GaimBuddyIcon *icon; /**< The buddy icon. */ }; @@ -666,19 +666,25 @@ guint gaim_conv_im_get_typing_timeout(const GaimConvIm *im); /** - * Sets the IM's time until it should send another typing notification. + * Sets the quiet-time when no GAIM_TYPING messages will be sent. + * Few protocols need this (maybe only MSN). If the user is still + * typing after this quiet-period, then another GAIM_TYPING message + * will be sent. * * @param im The IM. - * @param val The time. + * @param val The number of seconds to wait before allowing another + * GAIM_TYPING message to be sent to the user. Or 0 to + * not send another GAIM_TYPING message. */ -void gaim_conv_im_set_type_again(GaimConvIm *im, time_t val); +void gaim_conv_im_set_type_again(GaimConvIm *im, unsigned int val); /** - * Returns the IM's time until it should send another typing notification. + * Returns the time after which another GAIM_TYPING message should be sent. * * @param im The IM. * - * @return The time. + * @return The time in seconds since the epoch. Or 0 if no additional + * GAIM_TYPING message should be sent. */ time_t gaim_conv_im_get_type_again(const GaimConvIm *im); @@ -687,14 +693,14 @@ * * @param im The IM. */ -void gaim_conv_im_start_type_again_timeout(GaimConvIm *im); +void gaim_conv_im_start_send_typed_timeout(GaimConvIm *im); /** * Stops the IM's type again timeout. * * @param im The IM. */ -void gaim_conv_im_stop_type_again_timeout(GaimConvIm *im); +void gaim_conv_im_stop_send_typed_timeout(GaimConvIm *im); /** * Returns the IM's type again timeout interval. @@ -703,7 +709,7 @@ * * @return The type again timeout interval. */ -guint gaim_conv_im_get_type_again_timeout(const GaimConvIm *im); +guint gaim_conv_im_get_send_typed_timeout(const GaimConvIm *im); /** * Updates the visual typing notification for an IM conversation. Modified: branches/v2_0_0/src/gtkconv.c =================================================================== --- branches/v2_0_0/src/gtkconv.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/gtkconv.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -2168,8 +2168,7 @@ if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { /* We deleted all the text, so turn off typing. */ - if (gaim_conv_im_get_type_again_timeout(im)) - gaim_conv_im_stop_type_again_timeout(im); + gaim_conv_im_stop_send_typed_timeout(im); serv_send_typing(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), @@ -2913,22 +2912,18 @@ im = GAIM_CONV_IM(conv); - if (gaim_conv_im_get_type_again_timeout(im)) - gaim_conv_im_stop_type_again_timeout(im); + gaim_conv_im_stop_send_typed_timeout(im); + gaim_conv_im_start_send_typed_timeout(im); - gaim_conv_im_start_type_again_timeout(im); - + /* Check if we need to send another GAIM_TYPING message */ if (first || (gaim_conv_im_get_type_again(im) != 0 && - time(NULL) > gaim_conv_im_get_type_again(im))) { - - int timeout = serv_send_typing(gaim_conversation_get_gc(conv), - (char *)gaim_conversation_get_name(conv), - GAIM_TYPING); - - if (timeout) - gaim_conv_im_set_type_again(im, time(NULL) + timeout); - else - gaim_conv_im_set_type_again(im, 0); + time(NULL) > gaim_conv_im_get_type_again(im))) + { + unsigned int timeout; + timeout = serv_send_typing(gaim_conversation_get_gc(conv), + gaim_conversation_get_name(conv), + GAIM_TYPING); + gaim_conv_im_set_type_again(im, timeout); } } Modified: branches/v2_0_0/src/gtkpounce.c =================================================================== --- branches/v2_0_0/src/gtkpounce.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/gtkpounce.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -81,6 +81,7 @@ GtkWidget *idle; GtkWidget *idle_return; GtkWidget *typing; + GtkWidget *typed; GtkWidget *stop_typing; GtkWidget *message_recv; @@ -278,6 +279,9 @@ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typing))) events |= GAIM_POUNCE_TYPING; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typed))) + events |= GAIM_POUNCE_TYPED; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->stop_typing))) events |= GAIM_POUNCE_TYPING_STOPPED; @@ -564,7 +568,7 @@ /* Create the "Pounce When Buddy..." frame. */ frame = gaim_gtk_make_frame(vbox2, _("Pounce When Buddy...")); - table = gtk_table_new(2, 4, FALSE); + table = gtk_table_new(5, 2, FALSE); gtk_container_add(GTK_CONTAINER(frame), table); gtk_table_set_col_spacings(GTK_TABLE(table), GAIM_HIG_BORDER); gtk_widget_show(table); @@ -583,29 +587,33 @@ gtk_check_button_new_with_mnemonic(_("Is no longer i_dle")); dialog->typing = gtk_check_button_new_with_mnemonic(_("Starts _typing")); + dialog->typed = + gtk_check_button_new_with_mnemonic(_("P_auses while typing")); dialog->stop_typing = gtk_check_button_new_with_mnemonic(_("Stops t_yping")); dialog->message_recv = gtk_check_button_new_with_mnemonic(_("Sends a _message")); - gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 0, 1, + gtk_table_attach(GTK_TABLE(table), dialog->message_recv, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->signoff, 1, 2, 0, 1, + gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 1, 2, + gtk_table_attach(GTK_TABLE(table), dialog->signoff, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->away_return, 1, 2, 1, 2, + gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->idle, 0, 1, 2, 3, + gtk_table_attach(GTK_TABLE(table), dialog->away_return, 0, 1, 4, 5, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 2, 3, + gtk_table_attach(GTK_TABLE(table), dialog->idle, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->typing, 0, 1, 3, 4, + gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 3, 4, + gtk_table_attach(GTK_TABLE(table), dialog->typing, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->message_recv, 0, 1, 4, 5, + gtk_table_attach(GTK_TABLE(table), dialog->typed, 1, 2, 3, 4, GTK_FILL, 0, 0, 0); + gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 4, 5, + GTK_FILL, 0, 0, 0); gtk_widget_show(dialog->signon); gtk_widget_show(dialog->signoff); @@ -614,6 +622,7 @@ gtk_widget_show(dialog->idle); gtk_widget_show(dialog->idle_return); gtk_widget_show(dialog->typing); + gtk_widget_show(dialog->typed); gtk_widget_show(dialog->stop_typing); gtk_widget_show(dialog->message_recv); @@ -845,6 +854,8 @@ (events & GAIM_POUNCE_IDLE_RETURN)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typing), (events & GAIM_POUNCE_TYPING)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typed), + (events & GAIM_POUNCE_TYPED)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->stop_typing), (events & GAIM_POUNCE_TYPING_STOPPED)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->message_recv), @@ -1429,6 +1440,8 @@ tmp = g_strdup_printf( (events & GAIM_POUNCE_TYPING) ? _("%s has started typing to you (%s)") : + (events & GAIM_POUNCE_TYPED) ? + _("%s has paused while typing to you (%s)") : (events & GAIM_POUNCE_SIGNON) ? _("%s has signed on (%s)") : (events & GAIM_POUNCE_IDLE_RETURN) ? Modified: branches/v2_0_0/src/pounce.c =================================================================== --- branches/v2_0_0/src/pounce.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/pounce.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -206,6 +206,8 @@ add_event_to_xmlnode(child, "return-from-idle"); if (events & GAIM_POUNCE_TYPING) add_event_to_xmlnode(child, "start-typing"); + if (events & GAIM_POUNCE_TYPED) + add_event_to_xmlnode(child, "typed"); if (events & GAIM_POUNCE_TYPING_STOPPED) add_event_to_xmlnode(child, "stop-typing"); if (events & GAIM_POUNCE_MESSAGE_RECEIVED) @@ -411,7 +413,7 @@ else if (!strcmp(element_name, "option")) { if (!strcmp(data->option_type, "on-away")) data->options |= GAIM_POUNCE_OPTION_AWAY; - + g_free(data->option_type); data->option_type = NULL; } @@ -430,6 +432,8 @@ data->events |= GAIM_POUNCE_IDLE_RETURN; else if (!strcmp(data->event_type, "start-typing")) data->events |= GAIM_POUNCE_TYPING; + else if (!strcmp(data->event_type, "typed")) + data->events |= GAIM_POUNCE_TYPED; else if (!strcmp(data->event_type, "stop-typing")) data->events |= GAIM_POUNCE_TYPING_STOPPED; else if (!strcmp(data->event_type, "message-received")) @@ -1059,10 +1063,16 @@ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account); if (conv != NULL) { + GaimTypingState state; GaimPounceEvent event; - event = (gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv)) == GAIM_TYPING - ? GAIM_POUNCE_TYPING : GAIM_POUNCE_TYPING_STOPPED); + state = gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv)); + if (state == GAIM_TYPED) + event = GAIM_POUNCE_TYPED; + else if (state == GAIM_NOT_TYPING) + event = GAIM_POUNCE_TYPING_STOPPED; + else + event = GAIM_POUNCE_TYPING; gaim_pounce_execute(account, name, event); } @@ -1105,6 +1115,8 @@ gaim_signal_connect(conv_handle, "buddy-typing", handle, GAIM_CALLBACK(buddy_typing_cb), NULL); + gaim_signal_connect(conv_handle, "buddy-typed", + handle, GAIM_CALLBACK(buddy_typing_cb), NULL); gaim_signal_connect(conv_handle, "buddy-typing-stopped", handle, GAIM_CALLBACK(buddy_typing_cb), NULL); Modified: branches/v2_0_0/src/pounce.h =================================================================== --- branches/v2_0_0/src/pounce.h 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/pounce.h 2006-06-20 08:18:55 UTC (rev 16296) @@ -35,16 +35,17 @@ */ typedef enum { - GAIM_POUNCE_NONE = 0x00, /**< No events. */ - GAIM_POUNCE_SIGNON = 0x01, /**< The buddy signed on. */ - GAIM_POUNCE_SIGNOFF = 0x02, /**< The buddy signed off. */ - GAIM_POUNCE_AWAY = 0x04, /**< The buddy went away. */ - GAIM_POUNCE_AWAY_RETURN = 0x08, /**< The buddy returned from away. */ - GAIM_POUNCE_IDLE = 0x10, /**< The buddy became idle. */ - GAIM_POUNCE_IDLE_RETURN = 0x20, /**< The buddy is no longer idle. */ - GAIM_POUNCE_TYPING = 0x40, /**< The buddy started typing. */ - GAIM_POUNCE_TYPING_STOPPED = 0x80, /**< The buddy stopped typing. */ - GAIM_POUNCE_MESSAGE_RECEIVED = 0x100 /**< The buddy sent a message */ + GAIM_POUNCE_NONE = 0x000, /**< No events. */ + GAIM_POUNCE_SIGNON = 0x001, /**< The buddy signed on. */ + GAIM_POUNCE_SIGNOFF = 0x002, /**< The buddy signed off. */ + GAIM_POUNCE_AWAY = 0x004, /**< The buddy went away. */ + GAIM_POUNCE_AWAY_RETURN = 0x008, /**< The buddy returned from away. */ + GAIM_POUNCE_IDLE = 0x010, /**< The buddy became idle. */ + GAIM_POUNCE_IDLE_RETURN = 0x020, /**< The buddy is no longer idle. */ + GAIM_POUNCE_TYPING = 0x040, /**< The buddy started typing. */ + GAIM_POUNCE_TYPED = 0x080, /**< The buddy has entered text. */ + GAIM_POUNCE_TYPING_STOPPED = 0x100, /**< The buddy stopped typing. */ + GAIM_POUNCE_MESSAGE_RECEIVED = 0x200 /**< The buddy sent a message */ } GaimPounceEvent; Modified: branches/v2_0_0/src/protocols/jabber/message.c =================================================================== --- branches/v2_0_0/src/protocols/jabber/message.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/protocols/jabber/message.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -589,7 +589,7 @@ return 1; } -int jabber_send_typing(GaimConnection *gc, const char *who, int typing) +unsigned int jabber_send_typing(GaimConnection *gc, const char *who, GaimTypingState state) { JabberMessage *jm; JabberBuddy *jb; @@ -611,9 +611,9 @@ jm->to = g_strdup(who); jm->id = jabber_get_next_id(jm->js); - if(GAIM_TYPING == typing) + if(GAIM_TYPING == state) jm->chat_state = JM_STATE_COMPOSING; - else if(GAIM_TYPED == typing) + else if(GAIM_TYPED == state) jm->chat_state = JM_STATE_PAUSED; else jm->chat_state = JM_STATE_ACTIVE; Modified: branches/v2_0_0/src/protocols/jabber/message.h =================================================================== --- branches/v2_0_0/src/protocols/jabber/message.h 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/protocols/jabber/message.h 2006-06-20 08:18:55 UTC (rev 16296) @@ -71,7 +71,7 @@ GaimMessageFlags flags); int jabber_message_send_chat(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags); -int jabber_send_typing(GaimConnection *gc, const char *who, int typing); +unsigned int jabber_send_typing(GaimConnection *gc, const char *who, GaimTypingState state); #endif /* _GAIM_JABBER_MESSAGE_H_ */ Modified: branches/v2_0_0/src/protocols/msn/msn.c =================================================================== --- branches/v2_0_0/src/protocols/msn/msn.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/protocols/msn/msn.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -836,8 +836,8 @@ return 1; } -static int -msn_send_typing(GaimConnection *gc, const char *who, int typing) +static unsigned int +msn_send_typing(GaimConnection *gc, const char *who, GaimTypingState state) { GaimAccount *account; MsnSession *session; @@ -847,7 +847,12 @@ account = gaim_connection_get_account(gc); session = gc->proto_data; - if (!typing) + /* + * TODO: I feel like this should be "if (state != GAIM_TYPING)" + * but this is how it was before, and I don't want to break + * anything. --KingAnt + */ + if (state == GAIM_NOT_TYPING) return 0; if (!g_ascii_strcasecmp(who, gaim_account_get_username(account))) Modified: branches/v2_0_0/src/protocols/novell/novell.c =================================================================== --- branches/v2_0_0/src/protocols/novell/novell.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/protocols/novell/novell.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -2303,8 +2303,8 @@ return 1; } -static int -novell_send_typing(GaimConnection * gc, const char *name, int typing) +static unsigned int +novell_send_typing(GaimConnection * gc, const char *name, GaimTypingState state) { NMConference *conf = NULL; NMUser *user; @@ -2312,11 +2312,11 @@ NMERR_T rc = NM_OK; if (gc == NULL || name == NULL) - return -1; + return 0; user = gc->proto_data; if (user == NULL) - return -1; + return 0; /* Need to get the DN for the buddy so we can look up the convo */ dn = nm_lookup_dn(user, name); @@ -2327,7 +2327,7 @@ if (conf) { rc = nm_send_typing(user, conf, - ((typing == GAIM_TYPING) ? TRUE : FALSE), NULL); + ((state == GAIM_TYPING) ? TRUE : FALSE), NULL); _check_for_disconnect(user, rc); } Modified: branches/v2_0_0/src/protocols/oscar/oscar.c =================================================================== --- branches/v2_0_0/src/protocols/oscar/oscar.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/protocols/oscar/oscar.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -3944,8 +3944,8 @@ flap_connection_send_keepalive(od, conn); } -static int -oscar_send_typing(GaimConnection *gc, const char *name, int typing) +static unsigned int +oscar_send_typing(GaimConnection *gc, const char *name, GaimTypingState state) { OscarData *od; PeerConnection *conn; @@ -3955,7 +3955,7 @@ if ((conn != NULL) && (conn->ready)) { - peer_odc_send_typing(conn, typing); + peer_odc_send_typing(conn, state); } else { /* Don't send if this turkey is in our deny list */ @@ -3964,9 +3964,9 @@ if (!list) { struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); if (bi && bi->typingnot) { - if (typing == GAIM_TYPING) + if (state == GAIM_TYPING) aim_im_sendmtn(od, 0x0001, name, 0x0002); - else if (typing == GAIM_TYPED) + else if (state == GAIM_TYPED) aim_im_sendmtn(od, 0x0001, name, 0x0001); else aim_im_sendmtn(od, 0x0001, name, 0x0000); Modified: branches/v2_0_0/src/protocols/sametime/sametime.c =================================================================== --- branches/v2_0_0/src/protocols/sametime/sametime.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/protocols/sametime/sametime.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -3965,14 +3965,14 @@ } -static int mw_prpl_send_typing(GaimConnection *gc, const char *name, - int typing) { +static unsigned int mw_prpl_send_typing(GaimConnection *gc, const char *name, + GaimTypingState state) { struct mwGaimPluginData *pd; struct mwIdBlock who = { (char *) name, NULL }; struct mwConversation *conv; - gpointer t = GINT_TO_POINTER(!! typing); + gpointer t = GINT_TO_POINTER(!! state); g_return_val_if_fail(gc != NULL, 0); pd = gc->proto_data; @@ -3984,7 +3984,7 @@ if(mwConversation_isOpen(conv)) return ! mwConversation_send(conv, mwImSend_TYPING, t); - if(typing) { + if ((state == GAIM_TYPING) || (state == GAIM_TYPED)) { /* let's only open a channel for typing, not for not-typing. Otherwise two users in psychic mode will continually open conversations to each other, never able to get rid of them, as @@ -3996,6 +3996,11 @@ mwConversation_open(conv); } + /* + * TODO: This should probably be "0." When it's set to 1, the Gaim + * core will call serv_send_typing(gc, who, GAIM_TYPING) once + * every second until the Gaim user stops typing. --KingAnt + */ return 1; } Modified: branches/v2_0_0/src/protocols/simple/simple.c =================================================================== --- branches/v2_0_0/src/protocols/simple/simple.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/protocols/simple/simple.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -1053,7 +1053,7 @@ send_sip_response(sip->gc, msg, 200, "OK", NULL); } -static int simple_typing(GaimConnection *gc, const char *name, int typing) { +static unsigned int simple_typing(GaimConnection *gc, const char *name, GaimTypingState state) { struct simple_account_data *sip = gc->proto_data; gchar *xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" @@ -1065,16 +1065,22 @@ "<refresh>60</refresh>\n" "</isComposing>"; gchar *recv = g_strdup(name); - if(typing == GAIM_TYPING) { + if(state == GAIM_TYPING) { gchar *msg = g_strdup_printf(xml, "active"); simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); g_free(msg); - } else { + } else /* TODO: Only if (state == GAIM_TYPED) ? */ { gchar *msg = g_strdup_printf(xml, "idle"); simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); g_free(msg); } g_free(recv); + /* + * TODO: Is this right? It will cause the core to call + * serv_send_typing(gc, who, GAIM_TYPING) once every second + * until the user stops typing. If that's not desired, + * then return 0 instead. + */ return 1; } Modified: branches/v2_0_0/src/protocols/yahoo/yahoo.c =================================================================== --- branches/v2_0_0/src/protocols/yahoo/yahoo.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/protocols/yahoo/yahoo.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -3131,12 +3131,12 @@ return ret; } -static int yahoo_send_typing(GaimConnection *gc, const char *who, int typ) +static unsigned int yahoo_send_typing(GaimConnection *gc, const char *who, GaimTypingState state) { struct yahoo_data *yd = gc->proto_data; struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, gaim_connection_get_display_name(gc), - 14, " ", 13, typ == GAIM_TYPING ? "1" : "0", + 14, " ", 13, state == GAIM_TYPING ? "1" : "0", 5, who, 1002, "1"); yahoo_packet_send_and_free(pkt, yd); Modified: branches/v2_0_0/src/protocols/zephyr/zephyr.c =================================================================== --- branches/v2_0_0/src/protocols/zephyr/zephyr.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/protocols/zephyr/zephyr.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -2450,14 +2450,15 @@ return "zephyr"; } -static int zephyr_send_typing(GaimConnection *gc, const char *who, int typing) { +static unsigned int zephyr_send_typing(GaimConnection *gc, const char *who, GaimTypingState state) { gchar *recipient; zephyr_account *zephyr = gc->proto_data; if (use_tzc(zephyr)) return 0; - if (!typing) + if (state == GAIM_NOT_TYPING) return 0; + /* XXX We probably should care if this fails. Or maybe we don't want to */ if (!who) { gaim_debug_info("zephyr", "who is null\n"); @@ -2476,6 +2477,12 @@ gaim_debug_info("zephyr","about to send typing notification to %s\n",recipient); zephyr_send_message(zephyr,"MESSAGE","PERSONAL",recipient,"","","PING"); gaim_debug_info("zephyr","sent typing notification\n"); + + /* + * TODO: Is this correct? It means we will call + * serv_send_typing(gc, who, GAIM_TYPING) once every 15 seconds + * until the Gaim user stops typing. + */ return ZEPHYR_TYPING_SEND_TIMEOUT; } Modified: branches/v2_0_0/src/prpl.h =================================================================== --- branches/v2_0_0/src/prpl.h 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/prpl.h 2006-06-20 08:18:55 UTC (rev 16296) @@ -224,7 +224,7 @@ GaimMessageFlags flags); void (*set_info)(GaimConnection *, const char *info); - int (*send_typing)(GaimConnection *, const char *name, int typing); + unsigned int (*send_typing)(GaimConnection *, const char *name, GaimTypingState state); void (*get_info)(GaimConnection *, const char *who); void (*set_status)(GaimAccount *account, GaimStatus *status); Modified: branches/v2_0_0/src/server.c =================================================================== --- branches/v2_0_0/src/server.c 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/server.c 2006-06-20 08:18:55 UTC (rev 16296) @@ -38,18 +38,16 @@ #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" -/* This should return the elapsed time in seconds in which Gaim will not send - * typing notifications. - * if it returns zero, it will not send any more typing notifications - * typing is a flag - TRUE for typing, FALSE for stopped typing */ -int serv_send_typing(GaimConnection *g, const char *name, int typing) { +unsigned int +serv_send_typing(GaimConnection *gc, const char *name, GaimTypingState state) +{ GaimPluginProtocolInfo *prpl_info = NULL; - if (g != NULL && g->prpl != NULL) - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); + if (gc != NULL && gc->prpl != NULL) + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); - if (g && prpl_info && prpl_info->send_typing) - return prpl_info->send_typing(g, name, typing); + if (prpl_info && prpl_info->send_typing) + return prpl_info->send_typing(gc, name, state); return 0; } @@ -150,8 +148,8 @@ lar->sent = time(NULL); } - if (conv && gaim_conv_im_get_type_again_timeout(GAIM_CONV_IM(conv))) - gaim_conv_im_stop_type_again_timeout(GAIM_CONV_IM(conv)); + if (conv && gaim_conv_im_get_send_typed_timeout(GAIM_CONV_IM(conv))) + gaim_conv_im_stop_send_typed_timeout(GAIM_CONV_IM(conv)); return val; } @@ -593,7 +591,7 @@ else { gaim_signal_emit(gaim_conversations_get_handle(), - "buddy-typing-stopped", gc->account, name); + "buddy-typed", gc->account, name); } } @@ -618,6 +616,11 @@ gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING); gaim_conv_im_update_typing(im); } + else + { + gaim_signal_emit(gaim_conversations_get_handle(), + "buddy-typing-stopped", gc->account, name); + } gaim_signal_emit(gaim_conversations_get_handle(), "buddy-typing-stopped", gc->account, name); Modified: branches/v2_0_0/src/server.h =================================================================== --- branches/v2_0_0/src/server.h 2006-06-20 08:17:49 UTC (rev 16295) +++ branches/v2_0_0/src/server.h 2006-06-20 08:18:55 UTC (rev 16296) @@ -33,11 +33,27 @@ extern "C" { #endif +/** + * Send a typing message to a given user over a given connection. + * + * TODO: Could probably move this into the conversation API. + * + * @param typing One of GAIM_TYPING, GAIM_TYPED, or GAIM_NOT_TYPING. + * @return A quiet-period, specified in seconds, where Gaim will not + * send any additional typing notification messages. Most + * protocols should return 0, which means that no additional + * GAIM_TYPING messages need to be sent. If this is 5, for + * example, then Gaim will wait five seconds, and if the Gaim + * user is still typing then Gaim will send another GAIM_TYPING + * message. + */ +unsigned int serv_send_typing(GaimConnection *gc, const char *name, GaimTypingState state); + +void serv_move_buddy(GaimBuddy *, GaimGroup *, GaimGroup *); int serv_send_im(GaimConnection *, const char *, const char *, GaimMessageFlags flags); void serv_get_info(GaimConnection *, const char *); void serv_set_info(GaimConnection *, const char *); -int serv_send_typing(GaimConnection *, const char *, int); -void serv_move_buddy(GaimBuddy *, GaimGroup *, GaimGroup *); + void serv_add_permit(GaimConnection *, const char *); void serv_add_deny(GaimConnection *, const char *); void serv_rem_permit(GaimConnection *, const char *); @@ -51,12 +67,31 @@ int serv_chat_send(GaimConnection *, int, const char *, GaimMessageFlags flags); void serv_alias_buddy(GaimBuddy *); void serv_got_alias(GaimConnection *gc, const char *who, const char *alias); + +/** + * Receive a typing message from a remote user. Either GAIM_TYPING + * or GAIM_TYPED. If the user has stopped typing then use + * serv_got_typing_stopped instead. + * + * TODO: Could probably move this into the conversation API. + * + * @param timeout If this is a number greater than 0, then + * Gaim will wait this number of seconds and then + * set this buddy to the GAIM_NOT_TYPING state. This + * is used by protocols that send repeated typing messages + * while the user is composing the message. + */ void serv_got_typing(GaimConnection *gc, const char *name, int timeout, GaimTypingState state); -void serv_set_buddyicon(GaimConnection *gc, const char *filename); + +/** + * TODO: Could probably move this into the conversation API. + */ void serv_got_typing_stopped(GaimConnection *gc, const char *name); + void serv_got_im(GaimConnection *gc, const char *who, const char *msg, GaimMessageFlags flags, time_t mtime); +void serv_set_buddyicon(GaimConnection *gc, const char *filename); void serv_got_chat_invite(GaimConnection *gc, const char *name, const char *who, const char *message, GHashTable *data); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-06-20 08:18:01
|
Revision: 16295 Author: thekingant Date: 2006-06-20 01:17:49 -0700 (Tue, 20 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16295&view=rev Log Message: ----------- Hopefully improve the typing notification code so it's a lot easier to understand. This also creates a distinction between the signals emitted when receiving GAIM_TYPED and GAIM_NOT_TYPING messages (by adding a gaim-typed signal). And the gaim-not-typing signal should work in all cases. Most of this is stuff I changed last week during work, thanks to Meebo Modified Paths: -------------- trunk/plugins/perl/common/Conversation.xs trunk/plugins/perl/common/Server.xs trunk/src/conversation.c trunk/src/conversation.h trunk/src/gtkconv.c trunk/src/gtkpounce.c trunk/src/pounce.c trunk/src/pounce.h trunk/src/protocols/jabber/message.c trunk/src/protocols/jabber/message.h trunk/src/protocols/msn/msn.c trunk/src/protocols/novell/novell.c trunk/src/protocols/oscar/oscar.c trunk/src/protocols/sametime/sametime.c trunk/src/protocols/simple/simple.c trunk/src/protocols/yahoo/yahoo.c trunk/src/protocols/zephyr/zephyr.c trunk/src/prpl.h trunk/src/server.c trunk/src/server.h Modified: trunk/plugins/perl/common/Conversation.xs =================================================================== --- trunk/plugins/perl/common/Conversation.xs 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/plugins/perl/common/Conversation.xs 2006-06-20 08:17:49 UTC (rev 16295) @@ -179,15 +179,15 @@ Gaim::Conversation::IM im void -gaim_conv_im_start_type_again_timeout(im) +gaim_conv_im_start_send_typed_timeout(im) Gaim::Conversation::IM im void -gaim_conv_im_stop_type_again_timeout(im) +gaim_conv_im_stop_send_typed_timeout(im) Gaim::Conversation::IM im guint -gaim_conv_im_get_type_again_timeout(im) +gaim_conv_im_get_send_typed_timeout(im) Gaim::Conversation::IM im void Modified: trunk/plugins/perl/common/Server.xs =================================================================== --- trunk/plugins/perl/common/Server.xs 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/plugins/perl/common/Server.xs 2006-06-20 08:17:49 UTC (rev 16295) @@ -200,10 +200,10 @@ Gaim::MessageFlags flags int -serv_send_typing(con, a, b) +serv_send_typing(con, a, state) Gaim::Connection con const char * a - int b + Gaim::TypingState state void serv_set_buddyicon(gc, filename) Modified: trunk/src/conversation.c =================================================================== --- trunk/src/conversation.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/conversation.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -46,39 +46,44 @@ } static gboolean -reset_typing(gpointer data) +reset_typing_cb(gpointer data) { GaimConversation *c = (GaimConversation *)data; GaimConvIm *im; - if (!g_list_find(conversations, c)) - return FALSE; - im = GAIM_CONV_IM(c); gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING); gaim_conv_im_update_typing(im); gaim_conv_im_stop_typing_timeout(im); + gaim_signal_emit(gaim_conversations_get_handle(), + "buddy-typing-stopped", c); + return FALSE; } static gboolean -send_typed(gpointer data) +send_typed_cb(gpointer data) { GaimConversation *conv = (GaimConversation *)data; GaimConnection *gc; const char *name; g_return_val_if_fail(conv != NULL, FALSE); - + gc = gaim_conversation_get_gc(conv); name = gaim_conversation_get_name(conv); if (gc != NULL && name != NULL) { - gaim_conv_im_set_type_again(GAIM_CONV_IM(conv), TRUE); + /* We set this to 1 so that GAIM_TYPING will be sent + * if the Gaim user types anything else. + */ + gaim_conv_im_set_type_again(GAIM_CONV_IM(conv), 1); serv_send_typing(gc, name, GAIM_TYPED); + gaim_signal_emit(gaim_conversations_get_handle(), + "buddy-typed", conv); gaim_debug(GAIM_DEBUG_MISC, "conversation", "typed...\n"); } @@ -420,7 +425,7 @@ if (conv->type == GAIM_CONV_TYPE_IM) { gaim_conv_im_stop_typing_timeout(conv->u.im); - gaim_conv_im_stop_type_again_timeout(conv->u.im); + gaim_conv_im_stop_send_typed_timeout(conv->u.im); if (conv->u.im->icon != NULL) gaim_buddy_icon_unref(conv->u.im->icon); @@ -986,9 +991,14 @@ gaim_signal_emit(gaim_conversations_get_handle(), "buddy-typing", im->conv->account, im->conv->name); } - else + else if (state == GAIM_TYPED) { gaim_signal_emit(gaim_conversations_get_handle(), + "buddy-typed", im->conv->account, im->conv->name); + } + else if (state == GAIM_NOT_TYPING) + { + gaim_signal_emit(gaim_conversations_get_handle(), "buddy-typing-stopped", im->conv->account, im->conv->name); } } @@ -1016,7 +1026,7 @@ conv = gaim_conv_im_get_conversation(im); name = gaim_conversation_get_name(conv); - im->typing_timeout = gaim_timeout_add(timeout * 1000, reset_typing, conv); + im->typing_timeout = gaim_timeout_add(timeout * 1000, reset_typing_cb, conv); } void @@ -1040,11 +1050,14 @@ } void -gaim_conv_im_set_type_again(GaimConvIm *im, time_t val) +gaim_conv_im_set_type_again(GaimConvIm *im, unsigned int val) { g_return_if_fail(im != NULL); - im->type_again = val; + if (val == 0) + im->type_again = 0; + else + im->type_again = time(NULL) + val; } time_t @@ -1056,32 +1069,32 @@ } void -gaim_conv_im_start_type_again_timeout(GaimConvIm *im) +gaim_conv_im_start_send_typed_timeout(GaimConvIm *im) { g_return_if_fail(im != NULL); - im->type_again_timeout = gaim_timeout_add(SEND_TYPED_TIMEOUT, send_typed, + im->send_typed_timeout = gaim_timeout_add(SEND_TYPED_TIMEOUT, send_typed_cb, gaim_conv_im_get_conversation(im)); } void -gaim_conv_im_stop_type_again_timeout(GaimConvIm *im) +gaim_conv_im_stop_send_typed_timeout(GaimConvIm *im) { g_return_if_fail(im != NULL); - if (im->type_again_timeout == 0) + if (im->send_typed_timeout == 0) return; - gaim_timeout_remove(im->type_again_timeout); - im->type_again_timeout = 0; + gaim_timeout_remove(im->send_typed_timeout); + im->send_typed_timeout = 0; } guint -gaim_conv_im_get_type_again_timeout(const GaimConvIm *im) +gaim_conv_im_get_send_typed_timeout(const GaimConvIm *im) { g_return_val_if_fail(im != NULL, 0); - return im->type_again_timeout; + return im->send_typed_timeout; } void @@ -2090,6 +2103,12 @@ GAIM_SUBTYPE_ACCOUNT), gaim_value_new(GAIM_TYPE_STRING)); + gaim_signal_register(handle, "buddy-typed", + gaim_marshal_VOID__POINTER_POINTER, NULL, 2, + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_ACCOUNT), + gaim_value_new(GAIM_TYPE_STRING)); + gaim_signal_register(handle, "buddy-typing-stopped", gaim_marshal_VOID__POINTER_POINTER, NULL, 2, gaim_value_new(GAIM_TYPE_SUBTYPE, Modified: trunk/src/conversation.h =================================================================== --- trunk/src/conversation.h 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/conversation.h 2006-06-20 08:17:49 UTC (rev 16295) @@ -186,7 +186,7 @@ GaimTypingState typing_state; /**< The current typing state. */ guint typing_timeout; /**< The typing timer handle. */ time_t type_again; /**< The type again time. */ - guint type_again_timeout; /**< The type again timer handle. */ + guint send_typed_timeout; /**< The type again timer handle. */ GaimBuddyIcon *icon; /**< The buddy icon. */ }; @@ -666,19 +666,25 @@ guint gaim_conv_im_get_typing_timeout(const GaimConvIm *im); /** - * Sets the IM's time until it should send another typing notification. + * Sets the quiet-time when no GAIM_TYPING messages will be sent. + * Few protocols need this (maybe only MSN). If the user is still + * typing after this quiet-period, then another GAIM_TYPING message + * will be sent. * * @param im The IM. - * @param val The time. + * @param val The number of seconds to wait before allowing another + * GAIM_TYPING message to be sent to the user. Or 0 to + * not send another GAIM_TYPING message. */ -void gaim_conv_im_set_type_again(GaimConvIm *im, time_t val); +void gaim_conv_im_set_type_again(GaimConvIm *im, unsigned int val); /** - * Returns the IM's time until it should send another typing notification. + * Returns the time after which another GAIM_TYPING message should be sent. * * @param im The IM. * - * @return The time. + * @return The time in seconds since the epoch. Or 0 if no additional + * GAIM_TYPING message should be sent. */ time_t gaim_conv_im_get_type_again(const GaimConvIm *im); @@ -687,14 +693,14 @@ * * @param im The IM. */ -void gaim_conv_im_start_type_again_timeout(GaimConvIm *im); +void gaim_conv_im_start_send_typed_timeout(GaimConvIm *im); /** * Stops the IM's type again timeout. * * @param im The IM. */ -void gaim_conv_im_stop_type_again_timeout(GaimConvIm *im); +void gaim_conv_im_stop_send_typed_timeout(GaimConvIm *im); /** * Returns the IM's type again timeout interval. @@ -703,7 +709,7 @@ * * @return The type again timeout interval. */ -guint gaim_conv_im_get_type_again_timeout(const GaimConvIm *im); +guint gaim_conv_im_get_send_typed_timeout(const GaimConvIm *im); /** * Updates the visual typing notification for an IM conversation. Modified: trunk/src/gtkconv.c =================================================================== --- trunk/src/gtkconv.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/gtkconv.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -2168,8 +2168,7 @@ if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { /* We deleted all the text, so turn off typing. */ - if (gaim_conv_im_get_type_again_timeout(im)) - gaim_conv_im_stop_type_again_timeout(im); + gaim_conv_im_stop_send_typed_timeout(im); serv_send_typing(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), @@ -2913,22 +2912,18 @@ im = GAIM_CONV_IM(conv); - if (gaim_conv_im_get_type_again_timeout(im)) - gaim_conv_im_stop_type_again_timeout(im); + gaim_conv_im_stop_send_typed_timeout(im); + gaim_conv_im_start_send_typed_timeout(im); - gaim_conv_im_start_type_again_timeout(im); - + /* Check if we need to send another GAIM_TYPING message */ if (first || (gaim_conv_im_get_type_again(im) != 0 && - time(NULL) > gaim_conv_im_get_type_again(im))) { - - int timeout = serv_send_typing(gaim_conversation_get_gc(conv), - (char *)gaim_conversation_get_name(conv), - GAIM_TYPING); - - if (timeout) - gaim_conv_im_set_type_again(im, time(NULL) + timeout); - else - gaim_conv_im_set_type_again(im, 0); + time(NULL) > gaim_conv_im_get_type_again(im))) + { + unsigned int timeout; + timeout = serv_send_typing(gaim_conversation_get_gc(conv), + gaim_conversation_get_name(conv), + GAIM_TYPING); + gaim_conv_im_set_type_again(im, timeout); } } Modified: trunk/src/gtkpounce.c =================================================================== --- trunk/src/gtkpounce.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/gtkpounce.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -81,6 +81,7 @@ GtkWidget *idle; GtkWidget *idle_return; GtkWidget *typing; + GtkWidget *typed; GtkWidget *stop_typing; GtkWidget *message_recv; @@ -278,6 +279,9 @@ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typing))) events |= GAIM_POUNCE_TYPING; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typed))) + events |= GAIM_POUNCE_TYPED; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->stop_typing))) events |= GAIM_POUNCE_TYPING_STOPPED; @@ -564,7 +568,7 @@ /* Create the "Pounce When Buddy..." frame. */ frame = gaim_gtk_make_frame(vbox2, _("Pounce When Buddy...")); - table = gtk_table_new(2, 4, FALSE); + table = gtk_table_new(5, 2, FALSE); gtk_container_add(GTK_CONTAINER(frame), table); gtk_table_set_col_spacings(GTK_TABLE(table), GAIM_HIG_BORDER); gtk_widget_show(table); @@ -583,29 +587,33 @@ gtk_check_button_new_with_mnemonic(_("Is no longer i_dle")); dialog->typing = gtk_check_button_new_with_mnemonic(_("Starts _typing")); + dialog->typed = + gtk_check_button_new_with_mnemonic(_("P_auses while typing")); dialog->stop_typing = gtk_check_button_new_with_mnemonic(_("Stops t_yping")); dialog->message_recv = gtk_check_button_new_with_mnemonic(_("Sends a _message")); - gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 0, 1, + gtk_table_attach(GTK_TABLE(table), dialog->message_recv, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->signoff, 1, 2, 0, 1, + gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 1, 2, + gtk_table_attach(GTK_TABLE(table), dialog->signoff, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->away_return, 1, 2, 1, 2, + gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->idle, 0, 1, 2, 3, + gtk_table_attach(GTK_TABLE(table), dialog->away_return, 0, 1, 4, 5, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 2, 3, + gtk_table_attach(GTK_TABLE(table), dialog->idle, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->typing, 0, 1, 3, 4, + gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 3, 4, + gtk_table_attach(GTK_TABLE(table), dialog->typing, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); - gtk_table_attach(GTK_TABLE(table), dialog->message_recv, 0, 1, 4, 5, + gtk_table_attach(GTK_TABLE(table), dialog->typed, 1, 2, 3, 4, GTK_FILL, 0, 0, 0); + gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 4, 5, + GTK_FILL, 0, 0, 0); gtk_widget_show(dialog->signon); gtk_widget_show(dialog->signoff); @@ -614,6 +622,7 @@ gtk_widget_show(dialog->idle); gtk_widget_show(dialog->idle_return); gtk_widget_show(dialog->typing); + gtk_widget_show(dialog->typed); gtk_widget_show(dialog->stop_typing); gtk_widget_show(dialog->message_recv); @@ -845,6 +854,8 @@ (events & GAIM_POUNCE_IDLE_RETURN)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typing), (events & GAIM_POUNCE_TYPING)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typed), + (events & GAIM_POUNCE_TYPED)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->stop_typing), (events & GAIM_POUNCE_TYPING_STOPPED)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->message_recv), @@ -1429,6 +1440,8 @@ tmp = g_strdup_printf( (events & GAIM_POUNCE_TYPING) ? _("%s has started typing to you (%s)") : + (events & GAIM_POUNCE_TYPED) ? + _("%s has paused while typing to you (%s)") : (events & GAIM_POUNCE_SIGNON) ? _("%s has signed on (%s)") : (events & GAIM_POUNCE_IDLE_RETURN) ? Modified: trunk/src/pounce.c =================================================================== --- trunk/src/pounce.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/pounce.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -206,6 +206,8 @@ add_event_to_xmlnode(child, "return-from-idle"); if (events & GAIM_POUNCE_TYPING) add_event_to_xmlnode(child, "start-typing"); + if (events & GAIM_POUNCE_TYPED) + add_event_to_xmlnode(child, "typed"); if (events & GAIM_POUNCE_TYPING_STOPPED) add_event_to_xmlnode(child, "stop-typing"); if (events & GAIM_POUNCE_MESSAGE_RECEIVED) @@ -411,7 +413,7 @@ else if (!strcmp(element_name, "option")) { if (!strcmp(data->option_type, "on-away")) data->options |= GAIM_POUNCE_OPTION_AWAY; - + g_free(data->option_type); data->option_type = NULL; } @@ -430,6 +432,8 @@ data->events |= GAIM_POUNCE_IDLE_RETURN; else if (!strcmp(data->event_type, "start-typing")) data->events |= GAIM_POUNCE_TYPING; + else if (!strcmp(data->event_type, "typed")) + data->events |= GAIM_POUNCE_TYPED; else if (!strcmp(data->event_type, "stop-typing")) data->events |= GAIM_POUNCE_TYPING_STOPPED; else if (!strcmp(data->event_type, "message-received")) @@ -1059,10 +1063,16 @@ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account); if (conv != NULL) { + GaimTypingState state; GaimPounceEvent event; - event = (gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv)) == GAIM_TYPING - ? GAIM_POUNCE_TYPING : GAIM_POUNCE_TYPING_STOPPED); + state = gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv)); + if (state == GAIM_TYPED) + event = GAIM_POUNCE_TYPED; + else if (state == GAIM_NOT_TYPING) + event = GAIM_POUNCE_TYPING_STOPPED; + else + event = GAIM_POUNCE_TYPING; gaim_pounce_execute(account, name, event); } @@ -1105,6 +1115,8 @@ gaim_signal_connect(conv_handle, "buddy-typing", handle, GAIM_CALLBACK(buddy_typing_cb), NULL); + gaim_signal_connect(conv_handle, "buddy-typed", + handle, GAIM_CALLBACK(buddy_typing_cb), NULL); gaim_signal_connect(conv_handle, "buddy-typing-stopped", handle, GAIM_CALLBACK(buddy_typing_cb), NULL); Modified: trunk/src/pounce.h =================================================================== --- trunk/src/pounce.h 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/pounce.h 2006-06-20 08:17:49 UTC (rev 16295) @@ -35,16 +35,17 @@ */ typedef enum { - GAIM_POUNCE_NONE = 0x00, /**< No events. */ - GAIM_POUNCE_SIGNON = 0x01, /**< The buddy signed on. */ - GAIM_POUNCE_SIGNOFF = 0x02, /**< The buddy signed off. */ - GAIM_POUNCE_AWAY = 0x04, /**< The buddy went away. */ - GAIM_POUNCE_AWAY_RETURN = 0x08, /**< The buddy returned from away. */ - GAIM_POUNCE_IDLE = 0x10, /**< The buddy became idle. */ - GAIM_POUNCE_IDLE_RETURN = 0x20, /**< The buddy is no longer idle. */ - GAIM_POUNCE_TYPING = 0x40, /**< The buddy started typing. */ - GAIM_POUNCE_TYPING_STOPPED = 0x80, /**< The buddy stopped typing. */ - GAIM_POUNCE_MESSAGE_RECEIVED = 0x100 /**< The buddy sent a message */ + GAIM_POUNCE_NONE = 0x000, /**< No events. */ + GAIM_POUNCE_SIGNON = 0x001, /**< The buddy signed on. */ + GAIM_POUNCE_SIGNOFF = 0x002, /**< The buddy signed off. */ + GAIM_POUNCE_AWAY = 0x004, /**< The buddy went away. */ + GAIM_POUNCE_AWAY_RETURN = 0x008, /**< The buddy returned from away. */ + GAIM_POUNCE_IDLE = 0x010, /**< The buddy became idle. */ + GAIM_POUNCE_IDLE_RETURN = 0x020, /**< The buddy is no longer idle. */ + GAIM_POUNCE_TYPING = 0x040, /**< The buddy started typing. */ + GAIM_POUNCE_TYPED = 0x080, /**< The buddy has entered text. */ + GAIM_POUNCE_TYPING_STOPPED = 0x100, /**< The buddy stopped typing. */ + GAIM_POUNCE_MESSAGE_RECEIVED = 0x200 /**< The buddy sent a message */ } GaimPounceEvent; Modified: trunk/src/protocols/jabber/message.c =================================================================== --- trunk/src/protocols/jabber/message.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/protocols/jabber/message.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -589,7 +589,7 @@ return 1; } -int jabber_send_typing(GaimConnection *gc, const char *who, int typing) +unsigned int jabber_send_typing(GaimConnection *gc, const char *who, GaimTypingState state) { JabberMessage *jm; JabberBuddy *jb; @@ -611,9 +611,9 @@ jm->to = g_strdup(who); jm->id = jabber_get_next_id(jm->js); - if(GAIM_TYPING == typing) + if(GAIM_TYPING == state) jm->chat_state = JM_STATE_COMPOSING; - else if(GAIM_TYPED == typing) + else if(GAIM_TYPED == state) jm->chat_state = JM_STATE_PAUSED; else jm->chat_state = JM_STATE_ACTIVE; Modified: trunk/src/protocols/jabber/message.h =================================================================== --- trunk/src/protocols/jabber/message.h 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/protocols/jabber/message.h 2006-06-20 08:17:49 UTC (rev 16295) @@ -71,7 +71,7 @@ GaimMessageFlags flags); int jabber_message_send_chat(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags); -int jabber_send_typing(GaimConnection *gc, const char *who, int typing); +unsigned int jabber_send_typing(GaimConnection *gc, const char *who, GaimTypingState state); #endif /* _GAIM_JABBER_MESSAGE_H_ */ Modified: trunk/src/protocols/msn/msn.c =================================================================== --- trunk/src/protocols/msn/msn.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/protocols/msn/msn.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -836,8 +836,8 @@ return 1; } -static int -msn_send_typing(GaimConnection *gc, const char *who, int typing) +static unsigned int +msn_send_typing(GaimConnection *gc, const char *who, GaimTypingState state) { GaimAccount *account; MsnSession *session; @@ -847,7 +847,12 @@ account = gaim_connection_get_account(gc); session = gc->proto_data; - if (!typing) + /* + * TODO: I feel like this should be "if (state != GAIM_TYPING)" + * but this is how it was before, and I don't want to break + * anything. --KingAnt + */ + if (state == GAIM_NOT_TYPING) return 0; if (!g_ascii_strcasecmp(who, gaim_account_get_username(account))) Modified: trunk/src/protocols/novell/novell.c =================================================================== --- trunk/src/protocols/novell/novell.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/protocols/novell/novell.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -2303,8 +2303,8 @@ return 1; } -static int -novell_send_typing(GaimConnection * gc, const char *name, int typing) +static unsigned int +novell_send_typing(GaimConnection * gc, const char *name, GaimTypingState state) { NMConference *conf = NULL; NMUser *user; @@ -2312,11 +2312,11 @@ NMERR_T rc = NM_OK; if (gc == NULL || name == NULL) - return -1; + return 0; user = gc->proto_data; if (user == NULL) - return -1; + return 0; /* Need to get the DN for the buddy so we can look up the convo */ dn = nm_lookup_dn(user, name); @@ -2327,7 +2327,7 @@ if (conf) { rc = nm_send_typing(user, conf, - ((typing == GAIM_TYPING) ? TRUE : FALSE), NULL); + ((state == GAIM_TYPING) ? TRUE : FALSE), NULL); _check_for_disconnect(user, rc); } Modified: trunk/src/protocols/oscar/oscar.c =================================================================== --- trunk/src/protocols/oscar/oscar.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/protocols/oscar/oscar.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -3945,8 +3945,8 @@ flap_connection_send_keepalive(od, conn); } -static int -oscar_send_typing(GaimConnection *gc, const char *name, int typing) +static unsigned int +oscar_send_typing(GaimConnection *gc, const char *name, GaimTypingState state) { OscarData *od; PeerConnection *conn; @@ -3956,7 +3956,7 @@ if ((conn != NULL) && (conn->ready)) { - peer_odc_send_typing(conn, typing); + peer_odc_send_typing(conn, state); } else { /* Don't send if this turkey is in our deny list */ @@ -3965,9 +3965,9 @@ if (!list) { struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); if (bi && bi->typingnot) { - if (typing == GAIM_TYPING) + if (state == GAIM_TYPING) aim_im_sendmtn(od, 0x0001, name, 0x0002); - else if (typing == GAIM_TYPED) + else if (state == GAIM_TYPED) aim_im_sendmtn(od, 0x0001, name, 0x0001); else aim_im_sendmtn(od, 0x0001, name, 0x0000); Modified: trunk/src/protocols/sametime/sametime.c =================================================================== --- trunk/src/protocols/sametime/sametime.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/protocols/sametime/sametime.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -3965,14 +3965,14 @@ } -static int mw_prpl_send_typing(GaimConnection *gc, const char *name, - int typing) { +static unsigned int mw_prpl_send_typing(GaimConnection *gc, const char *name, + GaimTypingState state) { struct mwGaimPluginData *pd; struct mwIdBlock who = { (char *) name, NULL }; struct mwConversation *conv; - gpointer t = GINT_TO_POINTER(!! typing); + gpointer t = GINT_TO_POINTER(!! state); g_return_val_if_fail(gc != NULL, 0); pd = gc->proto_data; @@ -3984,7 +3984,7 @@ if(mwConversation_isOpen(conv)) return ! mwConversation_send(conv, mwImSend_TYPING, t); - if(typing) { + if ((state == GAIM_TYPING) || (state == GAIM_TYPED)) { /* let's only open a channel for typing, not for not-typing. Otherwise two users in psychic mode will continually open conversations to each other, never able to get rid of them, as @@ -3996,6 +3996,11 @@ mwConversation_open(conv); } + /* + * TODO: This should probably be "0." When it's set to 1, the Gaim + * core will call serv_send_typing(gc, who, GAIM_TYPING) once + * every second until the Gaim user stops typing. --KingAnt + */ return 1; } Modified: trunk/src/protocols/simple/simple.c =================================================================== --- trunk/src/protocols/simple/simple.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/protocols/simple/simple.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -1053,7 +1053,7 @@ send_sip_response(sip->gc, msg, 200, "OK", NULL); } -static int simple_typing(GaimConnection *gc, const char *name, int typing) { +static unsigned int simple_typing(GaimConnection *gc, const char *name, GaimTypingState state) { struct simple_account_data *sip = gc->proto_data; gchar *xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" @@ -1065,16 +1065,22 @@ "<refresh>60</refresh>\n" "</isComposing>"; gchar *recv = g_strdup(name); - if(typing == GAIM_TYPING) { + if(state == GAIM_TYPING) { gchar *msg = g_strdup_printf(xml, "active"); simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); g_free(msg); - } else { + } else /* TODO: Only if (state == GAIM_TYPED) ? */ { gchar *msg = g_strdup_printf(xml, "idle"); simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); g_free(msg); } g_free(recv); + /* + * TODO: Is this right? It will cause the core to call + * serv_send_typing(gc, who, GAIM_TYPING) once every second + * until the user stops typing. If that's not desired, + * then return 0 instead. + */ return 1; } Modified: trunk/src/protocols/yahoo/yahoo.c =================================================================== --- trunk/src/protocols/yahoo/yahoo.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/protocols/yahoo/yahoo.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -3131,12 +3131,12 @@ return ret; } -static int yahoo_send_typing(GaimConnection *gc, const char *who, int typ) +static unsigned int yahoo_send_typing(GaimConnection *gc, const char *who, GaimTypingState state) { struct yahoo_data *yd = gc->proto_data; struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, gaim_connection_get_display_name(gc), - 14, " ", 13, typ == GAIM_TYPING ? "1" : "0", + 14, " ", 13, state == GAIM_TYPING ? "1" : "0", 5, who, 1002, "1"); yahoo_packet_send_and_free(pkt, yd); Modified: trunk/src/protocols/zephyr/zephyr.c =================================================================== --- trunk/src/protocols/zephyr/zephyr.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/protocols/zephyr/zephyr.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -2450,14 +2450,15 @@ return "zephyr"; } -static int zephyr_send_typing(GaimConnection *gc, const char *who, int typing) { +static unsigned int zephyr_send_typing(GaimConnection *gc, const char *who, GaimTypingState state) { gchar *recipient; zephyr_account *zephyr = gc->proto_data; if (use_tzc(zephyr)) return 0; - if (!typing) + if (state == GAIM_NOT_TYPING) return 0; + /* XXX We probably should care if this fails. Or maybe we don't want to */ if (!who) { gaim_debug_info("zephyr", "who is null\n"); @@ -2476,6 +2477,12 @@ gaim_debug_info("zephyr","about to send typing notification to %s\n",recipient); zephyr_send_message(zephyr,"MESSAGE","PERSONAL",recipient,"","","PING"); gaim_debug_info("zephyr","sent typing notification\n"); + + /* + * TODO: Is this correct? It means we will call + * serv_send_typing(gc, who, GAIM_TYPING) once every 15 seconds + * until the Gaim user stops typing. + */ return ZEPHYR_TYPING_SEND_TIMEOUT; } Modified: trunk/src/prpl.h =================================================================== --- trunk/src/prpl.h 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/prpl.h 2006-06-20 08:17:49 UTC (rev 16295) @@ -224,7 +224,7 @@ GaimMessageFlags flags); void (*set_info)(GaimConnection *, const char *info); - int (*send_typing)(GaimConnection *, const char *name, int typing); + unsigned int (*send_typing)(GaimConnection *, const char *name, GaimTypingState state); void (*get_info)(GaimConnection *, const char *who); void (*set_status)(GaimAccount *account, GaimStatus *status); Modified: trunk/src/server.c =================================================================== --- trunk/src/server.c 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/server.c 2006-06-20 08:17:49 UTC (rev 16295) @@ -38,18 +38,16 @@ #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" -/* This should return the elapsed time in seconds in which Gaim will not send - * typing notifications. - * if it returns zero, it will not send any more typing notifications - * typing is a flag - TRUE for typing, FALSE for stopped typing */ -int serv_send_typing(GaimConnection *g, const char *name, int typing) { +unsigned int +serv_send_typing(GaimConnection *gc, const char *name, GaimTypingState state) +{ GaimPluginProtocolInfo *prpl_info = NULL; - if (g != NULL && g->prpl != NULL) - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); + if (gc != NULL && gc->prpl != NULL) + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); - if (g && prpl_info && prpl_info->send_typing) - return prpl_info->send_typing(g, name, typing); + if (prpl_info && prpl_info->send_typing) + return prpl_info->send_typing(gc, name, state); return 0; } @@ -150,8 +148,8 @@ lar->sent = time(NULL); } - if (conv && gaim_conv_im_get_type_again_timeout(GAIM_CONV_IM(conv))) - gaim_conv_im_stop_type_again_timeout(GAIM_CONV_IM(conv)); + if (conv && gaim_conv_im_get_send_typed_timeout(GAIM_CONV_IM(conv))) + gaim_conv_im_stop_send_typed_timeout(GAIM_CONV_IM(conv)); return val; } @@ -593,7 +591,7 @@ else { gaim_signal_emit(gaim_conversations_get_handle(), - "buddy-typing-stopped", gc->account, name); + "buddy-typed", gc->account, name); } } @@ -618,6 +616,11 @@ gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING); gaim_conv_im_update_typing(im); } + else + { + gaim_signal_emit(gaim_conversations_get_handle(), + "buddy-typing-stopped", gc->account, name); + } gaim_signal_emit(gaim_conversations_get_handle(), "buddy-typing-stopped", gc->account, name); Modified: trunk/src/server.h =================================================================== --- trunk/src/server.h 2006-06-20 04:05:56 UTC (rev 16294) +++ trunk/src/server.h 2006-06-20 08:17:49 UTC (rev 16295) @@ -33,11 +33,27 @@ extern "C" { #endif +/** + * Send a typing message to a given user over a given connection. + * + * TODO: Could probably move this into the conversation API. + * + * @param typing One of GAIM_TYPING, GAIM_TYPED, or GAIM_NOT_TYPING. + * @return A quiet-period, specified in seconds, where Gaim will not + * send any additional typing notification messages. Most + * protocols should return 0, which means that no additional + * GAIM_TYPING messages need to be sent. If this is 5, for + * example, then Gaim will wait five seconds, and if the Gaim + * user is still typing then Gaim will send another GAIM_TYPING + * message. + */ +unsigned int serv_send_typing(GaimConnection *gc, const char *name, GaimTypingState state); + +void serv_move_buddy(GaimBuddy *, GaimGroup *, GaimGroup *); int serv_send_im(GaimConnection *, const char *, const char *, GaimMessageFlags flags); void serv_get_info(GaimConnection *, const char *); void serv_set_info(GaimConnection *, const char *); -int serv_send_typing(GaimConnection *, const char *, int); -void serv_move_buddy(GaimBuddy *, GaimGroup *, GaimGroup *); + void serv_add_permit(GaimConnection *, const char *); void serv_add_deny(GaimConnection *, const char *); void serv_rem_permit(GaimConnection *, const char *); @@ -51,12 +67,31 @@ int serv_chat_send(GaimConnection *, int, const char *, GaimMessageFlags flags); void serv_alias_buddy(GaimBuddy *); void serv_got_alias(GaimConnection *gc, const char *who, const char *alias); + +/** + * Receive a typing message from a remote user. Either GAIM_TYPING + * or GAIM_TYPED. If the user has stopped typing then use + * serv_got_typing_stopped instead. + * + * TODO: Could probably move this into the conversation API. + * + * @param timeout If this is a number greater than 0, then + * Gaim will wait this number of seconds and then + * set this buddy to the GAIM_NOT_TYPING state. This + * is used by protocols that send repeated typing messages + * while the user is composing the message. + */ void serv_got_typing(GaimConnection *gc, const char *name, int timeout, GaimTypingState state); -void serv_set_buddyicon(GaimConnection *gc, const char *filename); + +/** + * TODO: Could probably move this into the conversation API. + */ void serv_got_typing_stopped(GaimConnection *gc, const char *name); + void serv_got_im(GaimConnection *gc, const char *who, const char *msg, GaimMessageFlags flags, time_t mtime); +void serv_set_buddyicon(GaimConnection *gc, const char *filename); void serv_got_chat_invite(GaimConnection *gc, const char *name, const char *who, const char *message, GHashTable *data); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ebl...@us...> - 2006-06-20 04:07:03
|
Revision: 16294 Author: eblanton Date: 2006-06-19 21:05:56 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16294&view=rev Log Message: ----------- This should fix --enable-python to do something reasonable Modified Paths: -------------- trunk/configure.ac Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2006-06-19 17:52:52 UTC (rev 16293) +++ trunk/configure.ac 2006-06-20 04:05:56 UTC (rev 16294) @@ -690,7 +690,7 @@ PYTHON=$withval) if test "x$enable_dbus" = "xyes" ; then - if test -z "$PYTHON" ; then + if test -z "$PYTHON" -o "x$PYTHON" = "xyes"; then AC_PATH_PROG([PYTHON], [python], [no]) fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |