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: <dat...@us...> - 2006-12-11 13:30:34
|
Revision: 17958 http://svn.sourceforge.net/gaim/?rev=17958&view=rev Author: datallah Date: 2006-12-11 05:30:30 -0800 (Mon, 11 Dec 2006) Log Message: ----------- Update silc for tooltip API changes. Modified Paths: -------------- trunk/libgaim/protocols/silc/buddy.c trunk/libgaim/protocols/silc/silcgaim.h Modified: trunk/libgaim/protocols/silc/buddy.c =================================================================== --- trunk/libgaim/protocols/silc/buddy.c 2006-12-11 06:02:15 UTC (rev 17957) +++ trunk/libgaim/protocols/silc/buddy.c 2006-12-11 13:30:30 UTC (rev 17958) @@ -1509,7 +1509,7 @@ return NULL; } -void silcgaim_tooltip_text(GaimBuddy *b, GString *str, gboolean full) +void silcgaim_tooltip_text(GaimBuddy *b, GaimNotifyUserInfo *user_info, gboolean full) { SilcGaim sg = b->account->gc->proto_data; SilcClient client = sg->client; @@ -1522,57 +1522,57 @@ /* Get the client entry. */ client_entry = silc_client_get_client_by_id(client, conn, client_id); if (!client_entry) - return; + return; if (client_entry->nickname) - g_string_append_printf(str, "\n<b>%s:</b> %s", _("Nickname"), - client_entry->nickname); - if (client_entry->username && client_entry->hostname) - g_string_append_printf(str, "\n<b>%s:</b> %s@%s", _("Username"), - client_entry->username, client_entry->hostname); + gaim_notify_user_info_add_pair(user_info, _("Nickname"), + client_entry->nickname); + if (client_entry->username && client_entry->hostname) { + g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname); + gaim_notify_user_info_add_pair(user_info, _("Username"), tmp); + } if (client_entry->mode) { - g_string_append_printf(str, "\n<b>%s:</b> ", _("User Modes")); - memset(tmp, 0, sizeof(tmp)); - silcgaim_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - g_string_append_printf(str, "%s", tmp); + memset(tmp, 0, sizeof(tmp)); + silcgaim_get_umode_string(client_entry->mode, + tmp, sizeof(tmp) - strlen(tmp)); + gaim_notify_user_info_add_pair(user_info, _("User Modes"), tmp); } silcgaim_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); if (statusstr) { - g_string_append_printf(str, "\n<b>%s:</b> %s", _("Message"), statusstr); + gaim_notify_user_info_add_pair(user_info, _("Message"), statusstr); g_free(statusstr); } if (full) { if (moodstr) { - g_string_append_printf(str, "\n<b>%s:</b> %s", _("Mood"), moodstr); + gaim_notify_user_info_add_pair(user_info, _("Mood"), moodstr); g_free(moodstr); } if (contactstr) { - g_string_append_printf(str, "\n<b>%s:</b> %s", _("Preferred Contact"), contactstr); + gaim_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); g_free(contactstr); } if (langstr) { - g_string_append_printf(str, "\n<b>%s:</b> %s", _("Preferred Language"), langstr); + gaim_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); g_free(langstr); } if (devicestr) { - g_string_append_printf(str, "\n<b>%s:</b> %s", _("Device"), devicestr); + gaim_notify_user_info_add_pair(user_info, _("Device"), devicestr); g_free(devicestr); } if (tzstr) { - g_string_append_printf(str, "\n<b>%s:</b> %s", _("Timezone"), tzstr); + gaim_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); g_free(tzstr); } if (geostr) { - g_string_append_printf(str, "\n<b>%s:</b> %s", _("Geolocation"), geostr); + gaim_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); g_free(geostr); } } Modified: trunk/libgaim/protocols/silc/silcgaim.h =================================================================== --- trunk/libgaim/protocols/silc/silcgaim.h 2006-12-11 06:02:15 UTC (rev 17957) +++ trunk/libgaim/protocols/silc/silcgaim.h 2006-12-11 13:30:30 UTC (rev 17958) @@ -107,7 +107,7 @@ SilcClientEntry client_entry, const char *hostname, SilcUInt16 port); void silcgaim_idle_set(GaimConnection *gc, int idle); -void silcgaim_tooltip_text(GaimBuddy *b, GString *str, gboolean full); +void silcgaim_tooltip_text(GaimBuddy *b, GaimNotifyUserInfo *user_info, gboolean full); char *silcgaim_status_text(GaimBuddy *b); gboolean silcgaim_ip_is_private(const char *ip); void silcgaim_ftp_send_file(GaimConnection *gc, const char *name, const char *file); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-12-11 06:02:16
|
Revision: 17957 http://svn.sourceforge.net/gaim/?rev=17957&view=rev Author: sadrul Date: 2006-12-10 22:02:15 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Show 'ABC is typing...' in the conversation window for typing notification. seanegan suggested this, and it sounded like an interesting thing to do. The change in gnttextview.c will need some more work if it is to be used for some other task, but its current use should be OK. Modified Paths: -------------- trunk/console/gntconv.c trunk/console/libgnt/gnttextview.c trunk/console/libgnt/gnttextview.h Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-12-11 05:35:19 UTC (rev 17956) +++ trunk/console/gntconv.c 2006-12-11 06:02:15 UTC (rev 17957) @@ -205,7 +205,7 @@ GaimConversation *conv; GGConv *ggc; GaimConvIm *im = NULL; - char *title, *old_title; + char *title, *str; conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, who, account); @@ -213,15 +213,26 @@ return; im = GAIM_CONV_IM(conv); + ggc = conv->ui_data; if (gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { - old_title = get_conversation_title(conv, account); - title = g_strdup_printf(_("%s [%s]"), old_title, + int scroll; + str = get_conversation_title(conv, account); + title = g_strdup_printf(_("%s [%s]"), str, gnt_ascii_only() ? "T" : "\342\243\277"); - g_free(old_title); - } else + g_free(str); + + scroll = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggc->tv)); + str = g_strdup_printf(_("\n%s is typing..."), gaim_conversation_get_name(conv)); + gnt_text_view_append_text_with_tag(GNT_TEXT_VIEW(ggc->tv), + str, GNT_TEXT_FLAG_DIM, "typing"); + g_free(str); + if (scroll <= 1) + gnt_text_view_scroll(GNT_TEXT_VIEW(ggc->tv), 0); + } else { title = get_conversation_title(conv, account); - ggc = conv->ui_data; + gnt_text_view_tag_change(GNT_TEXT_VIEW(ggc->tv), "typing", NULL, TRUE); + } gnt_screen_rename_widget(ggc->window, title); g_free(title); } @@ -324,6 +335,7 @@ char *strip, *newline; GntTextFormatFlags fl = 0; int pos; + gboolean notify; g_return_if_fail(ggconv != NULL); @@ -336,6 +348,7 @@ pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); + notify = !!gnt_text_view_tag_change(GNT_TEXT_VIEW(ggconv->tv), "typing", NULL, TRUE); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), "\n", GNT_TEXT_FLAG_NORMAL); /* Unnecessary to print the timestamp for delayed message */ @@ -374,12 +387,20 @@ strip = gaim_markup_strip_html(newline); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), strip, fl); - if (pos <= 1) - gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); g_free(newline); g_free(strip); + if (notify) { + strip = g_strdup_printf(_("\n%s is typing..."), gaim_conversation_get_name(conv)); + gnt_text_view_append_text_with_tag(GNT_TEXT_VIEW(ggconv->tv), + strip, GNT_TEXT_FLAG_DIM, "typing"); + g_free(strip); + } + + if (pos <= 1) + gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); + if (flags & (GAIM_MESSAGE_RECV | GAIM_MESSAGE_NICK | GAIM_MESSAGE_ERROR)) gnt_widget_set_urgent(ggconv->tv); } Modified: trunk/console/libgnt/gnttextview.c =================================================================== --- trunk/console/libgnt/gnttextview.c 2006-12-11 05:35:19 UTC (rev 17956) +++ trunk/console/libgnt/gnttextview.c 2006-12-11 06:02:15 UTC (rev 17957) @@ -23,6 +23,13 @@ gboolean soft; /* TRUE if it's an overflow from prev. line */ } GntTextLine; +typedef struct +{ + char *name; + int start; + int end; +} GntTextTag; + static GntWidgetClass *parent_class = NULL; static void @@ -134,12 +141,22 @@ } static void +free_tag(gpointer data, gpointer null) +{ + GntTextTag *tag = data; + g_free(tag->name); + g_free(tag); +} + +static void gnt_text_view_destroy(GntWidget *widget) { GntTextView *view = GNT_TEXT_VIEW(widget); view->list = g_list_first(view->list); g_list_foreach(view->list, free_text_line, NULL); g_list_free(view->list); + g_list_foreach(view->tags, free_tag, NULL); + g_list_free(view->tags); g_string_free(view->string, TRUE); } @@ -297,6 +314,12 @@ void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextFormatFlags flags) { + gnt_text_view_append_text_with_tag(view, text, flags, NULL); +} + +void gnt_text_view_append_text_with_tag(GntTextView *view, const char *text, + GntTextFormatFlags flags, const char *tagname) +{ GntWidget *widget = GNT_WIDGET(view); int fl = 0; const char *start, *end; @@ -312,6 +335,14 @@ len = view->string->len; view->string = g_string_append(view->string, text); + if (tagname) { + GntTextTag *tag = g_new0(GntTextTag, 1); + tag->name = g_strdup(tagname); + tag->start = len; + tag->end = view->string->len; + view->tags = g_list_append(view->tags, tag); + } + view->list = g_list_first(view->list); start = end = view->string->str + len; @@ -471,3 +502,73 @@ return above; } +/** + * XXX: There are quite possibly more than a few bugs here. + */ +int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all) +{ + GList *list, *next, *iter, *inext; + int count = 0; + for (list = view->tags; list; list = next) { + GntTextTag *tag = list->data; + next = list->next; + if (strcmp(tag->name, name) == 0) { + int change; + char *before, *after; + + count++; + + before = g_strndup(view->string->str, tag->start); + after = g_strdup(view->string->str + tag->end); + change = (tag->end - tag->start) - (text ? strlen(text) : 0); + + g_string_printf(view->string, "%s%s%s", before, text ? text : "", after); + g_free(before); + g_free(after); + + /* Update the offsets of the next tags */ + for (iter = next; iter; iter = iter->next) { + GntTextTag *t = iter->data; + t->start -= change; + t->end -= change; + } + + /* Update the offsets of the segments */ + for (iter = view->list; iter; iter = inext) { + GList *segs, *snext; + GntTextLine *line = iter->data; + inext = iter->next; + for (segs = line->segments; segs; segs = snext) { + GntTextSegment *seg = segs->data; + snext = segs->next; + if (seg->start >= tag->end) { + seg->start -= change; + seg->end -= change; + continue; + } + if (seg->end < tag->start) + continue; + + if (seg->start >= tag->start && seg->end <= tag->end) { + free_text_segment(seg, NULL); + line->segments = g_list_delete_link(line->segments, segs); + if (line->segments == NULL) { + free_text_line(line, NULL); + view->list = g_list_delete_link(view->list, iter); + } + } + /* XXX: handle the rest of the conditions */ + } + } + if (text == NULL) { + /* Remove the tag */ + view->tags = g_list_delete_link(view->tags, list); + free_tag(tag, NULL); + } + if (!all) + break; + } + } + return count; +} + Modified: trunk/console/libgnt/gnttextview.h =================================================================== --- trunk/console/libgnt/gnttextview.h 2006-12-11 05:35:19 UTC (rev 17956) +++ trunk/console/libgnt/gnttextview.h 2006-12-11 06:02:15 UTC (rev 17957) @@ -27,6 +27,8 @@ GString *string; GList *list; /* List of GntTextLine */ + + GList *tags; /* A list of tags */ }; typedef enum @@ -62,6 +64,8 @@ void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextFormatFlags flags); +void gnt_text_view_append_text_with_tag(GntTextView *view, const char *text, GntTextFormatFlags flags, const char *tag); + /* Move the cursor to the beginning of the next line and resets text-attributes. * It first completes the current line with the current text-attributes. */ void gnt_text_view_next_line(GntTextView *view); @@ -74,6 +78,9 @@ int gnt_text_view_get_lines_above(GntTextView *view); +/* If text is NULL, then the tag is removed. */ +int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all); + G_END_DECLS #endif /* GNT_TEXT_VIEW_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-12-11 05:35:19
|
Revision: 17956 http://svn.sourceforge.net/gaim/?rev=17956&view=rev Author: thekingant Date: 2006-12-10 21:35:19 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Apparently when Win AIM 6.0 sees "us-ascii" it parses the incoming message as Windows CP-1252. We might as well do the same thing, since there isn't any particular reason for us to parse us-ascii as UTF-8. Modified Paths: -------------- trunk/libgaim/protocols/oscar/oscar.c Modified: trunk/libgaim/protocols/oscar/oscar.c =================================================================== --- trunk/libgaim/protocols/oscar/oscar.c 2006-12-11 05:29:50 UTC (rev 17955) +++ trunk/libgaim/protocols/oscar/oscar.c 2006-12-11 05:35:19 UTC (rev 17956) @@ -303,18 +303,20 @@ gaim_debug_info("oscar", "Empty encoding, assuming UTF-8\n"); } else if (!strcasecmp(encoding, "iso-8859-1")) { utf8 = g_convert(text, textlen, "UTF-8", "iso-8859-1", NULL, NULL, NULL); - } else if (!strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1")) { + } else if (!strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1") || + !strcasecmp(encoding, "us-ascii")) + { utf8 = g_convert(text, textlen, "UTF-8", "Windows-1252", NULL, NULL, NULL); } else if (!strcasecmp(encoding, "unicode-2-0")) { utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); - } else if (strcasecmp(encoding, "us-ascii") && strcmp(encoding, "utf-8")) { + } else if (strcasecmp(encoding, "utf-8")) { gaim_debug_warning("oscar", "Unrecognized character encoding \"%s\", " "attempting to convert to UTF-8 anyway\n", encoding); utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL); } /* - * If utf8 is still NULL then either the encoding is us-ascii/utf-8 or + * If utf8 is still NULL then either the encoding is utf-8 or * we have been unable to convert the text to utf-8 from the encoding * that was specified. So we check if the text is valid utf-8 then * just copy it. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <amc...@us...> - 2006-12-11 05:29:51
|
Revision: 17955 http://svn.sourceforge.net/gaim/?rev=17955&view=rev Author: amc_grim Date: 2006-12-10 21:29:50 -0800 (Sun, 10 Dec 2006) Log Message: ----------- And the gtk plugins from the plugin pack. I've waited on listhandler until rekkanoryo (John Bailey) quits being indecisive... Modified Paths: -------------- trunk/gtk/plugins/Makefile.am trunk/gtk/plugins/Makefile.mingw Added Paths: ----------- trunk/gtk/plugins/convcolors.c trunk/gtk/plugins/markerline.c Modified: trunk/gtk/plugins/Makefile.am =================================================================== --- trunk/gtk/plugins/Makefile.am 2006-12-11 05:03:52 UTC (rev 17954) +++ trunk/gtk/plugins/Makefile.am 2006-12-11 05:29:50 UTC (rev 17955) @@ -26,10 +26,12 @@ plugindir = $(libdir)/gaim +convcolors_la_LDFLAGS = -module -avoid-version extplacement_la_LDFLAGS = -module -avoid-version gaimrc_la_LDFLAGS = -module -avoid-version history_la_LDFLAGS = -module -avoid-version iconaway_la_LDFLAGS = -module -avoid-version +markerline_la_LDFLAGS = -module -avoid-version notify_la_LDFLAGS = -module -avoid-version relnot_la_LDFLAGS = -module -avoid-version spellchk_la_LDFLAGS = -module -avoid-version @@ -39,31 +41,36 @@ if PLUGINS plugin_LTLIBRARIES = \ + convcolors.la \ extplacement.la \ gaimrc.la \ history.la \ iconaway.la \ + markerline.la \ notify.la \ relnot.la \ spellchk.la \ timestamp.la \ timestamp_format.la - +convcolors_la_SOURCES = convcolors.c extplacement_la_SOURCES = extplacement.c gaimrc_la_SOURCES = gaimrc.c history_la_SOURCES = history.c iconaway_la_SOURCES = iconaway.c +markerline_la_SOURCES = markerline.c notify_la_SOURCES = notify.c relnot_la_SOURCES = relnot.c spellchk_la_SOURCES = spellchk.c timestamp_la_SOURCES = timestamp.c timestamp_format_la_SOURCES = timestamp_format.c +convcolors_la_LIBADD = $(GTK_LIBS) extplacement_la_LIBADD = $(GTK_LIBS) gaimrc_la_LIBADD = $(GTK_LIBS) history_la_LIBADD = $(GTK_LIBS) iconaway_la_LIBADD = $(GTK_LIBS) +markerline_la_LIBADD = $(GTK_LIBS) notify_la_LIBADD = $(GTK_LIBS) relnot_la_LIBADD = $(GLIB_LIBS) spellchk_la_LIBADD = $(GTK_LIBS) Modified: trunk/gtk/plugins/Makefile.mingw =================================================================== --- trunk/gtk/plugins/Makefile.mingw 2006-12-11 05:03:52 UTC (rev 17954) +++ trunk/gtk/plugins/Makefile.mingw 2006-12-11 05:29:50 UTC (rev 17955) @@ -74,10 +74,12 @@ $(CC) -shared $@.o $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $@ plugins: \ + convcolors.dll \ extplacement.dll \ gaimrc.dll \ history.dll \ iconaway.dll \ + markerline.dll \ notify.dll \ relnot.dll \ spellchk.dll \ Added: trunk/gtk/plugins/convcolors.c =================================================================== --- trunk/gtk/plugins/convcolors.c (rev 0) +++ trunk/gtk/plugins/convcolors.c 2006-12-11 05:29:50 UTC (rev 17955) @@ -0,0 +1,372 @@ +/* + * Conversation Colors + * Copyright (C) 2006 + * + * 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 "internal.h" + +#define PLUGIN_ID "gtk-plugin_pack-convcolors" +#define PLUGIN_NAME "Conversation Colors" +#define PLUGIN_STATIC_NAME "Conversation Colors" +#define PLUGIN_SUMMARY "Customize colors in the conversation window" +#define PLUGIN_DESCRIPTION "Customize colors in the conversation window" +#define PLUGIN_AUTHOR "Sadrul H Chowdhury <sa...@us...>" + +/* System headers */ +#include <gdk/gdk.h> +#include <glib.h> +#include <gtk/gtk.h> + +/* Gaim headers */ +#include <gtkplugin.h> +#include <version.h> + +#include <conversation.h> +#include <gtkconv.h> +#include <gtkprefs.h> +#include <gtkutils.h> + +#define PREF_PREFIX "/plugins/gtk/" PLUGIN_ID +#define PREF_IGNORE PREF_PREFIX "/ignore_incoming" +#define PREF_CHATS PREF_PREFIX "/chats" +#define PREF_IMS PREF_PREFIX "/ims" + +#define PREF_SEND PREF_PREFIX "/send" +#define PREF_SEND_C PREF_SEND "/color" +#define PREF_SEND_F PREF_SEND "/format" + +#define PREF_RECV PREF_PREFIX "/recv" +#define PREF_RECV_C PREF_RECV "/color" +#define PREF_RECV_F PREF_RECV "/format" + +#define PREF_SYSTEM PREF_PREFIX "/system" +#define PREF_SYSTEM_C PREF_SYSTEM "/color" +#define PREF_SYSTEM_F PREF_SYSTEM "/format" + +#define PREF_ERROR PREF_PREFIX "/error" +#define PREF_ERROR_C PREF_ERROR "/color" +#define PREF_ERROR_F PREF_ERROR "/format" + +#define PREF_NICK PREF_PREFIX "/nick" +#define PREF_NICK_C PREF_NICK "/color" +#define PREF_NICK_F PREF_NICK "/format" + +enum +{ + FONT_BOLD = 1 << 0, + FONT_ITALIC = 1 << 1, + FONT_UNDERLINE = 1 << 2 +}; + +struct +{ + GaimMessageFlags flag; + char *prefix; + const char *text; +} formats[] = +{ + {GAIM_MESSAGE_ERROR, PREF_ERROR, N_("Error Messages")}, + {GAIM_MESSAGE_NICK, PREF_NICK, N_("Highlighted Messages")}, + {GAIM_MESSAGE_SYSTEM, PREF_SYSTEM, N_("System Messages")}, + {GAIM_MESSAGE_SEND, PREF_SEND, N_("Sent Messages")}, + {GAIM_MESSAGE_RECV, PREF_RECV, N_("Received Messages")}, + {0, NULL, NULL} +}; + +static gboolean +displaying_msg(GaimAccount *account, const char *who, char **displaying, + GaimConversation *conv, GaimMessageFlags flags) +{ + int i; + char tmp[128], *t; + gboolean bold, italic, underline; + int f; + const char *color; + + for (i = 0; formats[i].prefix; i++) + if (flags & formats[i].flag) + break; + + if (!formats[i].prefix) + return FALSE; + + if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM && + !gaim_prefs_get_bool(PREF_IMS)) || + (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT && + !gaim_prefs_get_bool(PREF_CHATS))) + return FALSE; + + g_snprintf(tmp, sizeof(tmp), "%s/color", formats[i].prefix); + color = gaim_prefs_get_string(tmp); + + g_snprintf(tmp, sizeof(tmp), "%s/format", formats[i].prefix); + f = gaim_prefs_get_int(tmp); + bold = (f & FONT_BOLD); + italic = (f & FONT_ITALIC); + underline = (f & FONT_UNDERLINE); + + if (gaim_prefs_get_bool(PREF_IGNORE)) + { + t = *displaying; + *displaying = gaim_markup_strip_html(t); + g_free(t); + } + + if (color && *color) + { + t = *displaying; + *displaying = g_strdup_printf("<FONT COLOR=\"%s\">%s</FONT>", color, t); + g_free(t); + } + + t = *displaying; + *displaying = g_strdup_printf("%s%s%s%s%s%s%s", + bold ? "<B>" : "</B>", + italic ? "<I>" : "</I>", + underline ? "<U>" : "</U>", + t, + bold ? "</B>" : "<B>", + italic ? "</I>" : "<I>", + underline ? "</U>" : "<U>" + ); + g_free(t); + + return FALSE; +} + +static gboolean +plugin_load(GaimPlugin *plugin) +{ + gaim_signal_connect(gaim_gtk_conversations_get_handle(), + "displaying-im-msg", plugin, + GAIM_CALLBACK(displaying_msg), NULL); + gaim_signal_connect(gaim_gtk_conversations_get_handle(), + "displaying-chat-msg", plugin, + GAIM_CALLBACK(displaying_msg), NULL); + return TRUE; +} + +static gboolean +plugin_unload(GaimPlugin *plugin) +{ + return TRUE; +} + +/* Ripped from GaimRC */ +static void +color_response(GtkDialog *color_dialog, gint response, const char *data) +{ + if (response == GTK_RESPONSE_OK) + { + GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel; + GdkColor color; + char colorstr[8]; + char tmp[128]; + + gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color); + + g_snprintf(colorstr, sizeof(colorstr), "#%02X%02X%02X", + color.red/256, color.green/256, color.blue/256); + + g_snprintf(tmp, sizeof(tmp), "%s/color", data); + + gaim_prefs_set_string(tmp, colorstr); + } + + gtk_widget_destroy(GTK_WIDGET(color_dialog)); +} + +static void +set_color(GtkWidget *widget, const char *data) +{ + GtkWidget *color_dialog = NULL; + GdkColor color; + char title[128]; + char tmp[128]; + + g_snprintf(title, sizeof(title), _("Select Color for %s"), _(data)); + color_dialog = gtk_color_selection_dialog_new(title); + g_signal_connect(G_OBJECT(color_dialog), "response", + G_CALLBACK(color_response), (gpointer)data); + + g_snprintf(tmp, sizeof(tmp), "%s/color", data); + if (gdk_color_parse(gaim_prefs_get_string(tmp), &color)) + { + gtk_color_selection_set_current_color( + GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color); + } + + gtk_window_present(GTK_WINDOW(color_dialog)); +} + +static void +toggle_something(const char *prefix, int format) +{ + int f; + char tmp[128]; + + g_snprintf(tmp, sizeof(tmp), "%s/format", prefix); + f = gaim_prefs_get_int(tmp); + f ^= format; + gaim_prefs_set_int(tmp, f); +} + +static void +toggle_bold(GtkWidget *widget, gpointer data) +{ + toggle_something(data, FONT_BOLD); +} + +static void +toggle_italic(GtkWidget *widget, gpointer data) +{ + toggle_something(data, FONT_ITALIC); +} + +static void +toggle_underline(GtkWidget *widget, gpointer data) +{ + toggle_something(data, FONT_UNDERLINE); +} + +static GtkWidget * +get_config_frame(GaimPlugin *plugin) +{ + GtkWidget *ret; + GtkWidget *frame; + int i; + + ret = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE); + gtk_container_set_border_width(GTK_CONTAINER(ret), GAIM_HIG_BORDER); + + for (i = 0; formats[i].prefix; i++) + { + char tmp[128]; + int f; + GtkWidget *vbox, *hbox, *button; + + g_snprintf(tmp, sizeof(tmp), "%s/format", formats[i].prefix); + f = gaim_prefs_get_int(tmp); + + frame = gaim_gtk_make_frame(ret, _(formats[i].text)); + vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); + gtk_box_pack_start(GTK_BOX(frame), vbox, FALSE, FALSE, 0); + + hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + button = gaim_pixbuf_button_from_stock(" Color", GTK_STOCK_SELECT_COLOR, + GAIM_BUTTON_HORIZONTAL); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_color), + formats[i].prefix); + + button = gtk_check_button_new_with_label(_("Bold")); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + if (f & FONT_BOLD) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(toggle_bold), + formats[i].prefix); + + button = gtk_check_button_new_with_label(_("Italic")); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + if (f & FONT_ITALIC) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(toggle_italic), + formats[i].prefix); + + button = gtk_check_button_new_with_label(_("Underline")); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + if (f & FONT_UNDERLINE) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(toggle_underline), formats[i].prefix); + } + + frame = gaim_gtk_make_frame(ret, _("General")); + gaim_gtk_prefs_checkbox(_("Ignore incoming format"), PREF_IGNORE, frame); + gaim_gtk_prefs_checkbox(_("Apply in Chats"), PREF_CHATS, frame); + gaim_gtk_prefs_checkbox(_("Apply in IMs"), PREF_IMS, frame); + + gtk_widget_show_all(ret); + return ret; +} + +static GaimGtkPluginUiInfo ui_info = +{ + get_config_frame, + 0, +}; + +static GaimPluginInfo info = +{ + GAIM_PLUGIN_MAGIC, /* Magic */ + GAIM_MAJOR_VERSION, /* Gaim Major Version */ + GAIM_MINOR_VERSION, /* Gaim Minor Version */ + GAIM_PLUGIN_STANDARD, /* plugin type */ + GAIM_GTK_PLUGIN_TYPE, /* ui requirement */ + 0, /* flags */ + NULL, /* dependencies */ + GAIM_PRIORITY_DEFAULT, /* priority */ + + PLUGIN_ID, /* plugin id */ + N_(PLUGIN_NAME), /* name */ + VERSION, /* version */ + N_(PLUGIN_SUMMARY), /* summary */ + N_(PLUGIN_DESCRIPTION), /* description */ + PLUGIN_AUTHOR, /* author */ + GAIM_WEBSITE, /* website */ + + plugin_load, /* load */ + plugin_unload, /* unload */ + NULL, /* destroy */ + + &ui_info, /* ui_info */ + NULL, /* extra_info */ + NULL, /* prefs_info */ + NULL /* actions */ +}; + +static void +init_plugin(GaimPlugin *plugin) +{ + gaim_prefs_add_none(PREF_PREFIX); + + gaim_prefs_add_bool(PREF_IGNORE, TRUE); + gaim_prefs_add_bool(PREF_CHATS, TRUE); + gaim_prefs_add_bool(PREF_IMS, TRUE); + + gaim_prefs_add_none(PREF_SEND); + gaim_prefs_add_none(PREF_RECV); + gaim_prefs_add_none(PREF_SYSTEM); + gaim_prefs_add_none(PREF_ERROR); + gaim_prefs_add_none(PREF_NICK); + + gaim_prefs_add_string(PREF_SEND_C, "#909090"); + gaim_prefs_add_string(PREF_RECV_C, "#000000"); + gaim_prefs_add_string(PREF_SYSTEM_C, "#50a050"); + gaim_prefs_add_string(PREF_ERROR_C, "#ff0000"); + gaim_prefs_add_string(PREF_NICK_C, "#0000dd"); + + gaim_prefs_add_int(PREF_SEND_F, 0); + gaim_prefs_add_int(PREF_RECV_F, 0); + gaim_prefs_add_int(PREF_SYSTEM_F, FONT_ITALIC); + gaim_prefs_add_int(PREF_ERROR_F, FONT_BOLD | FONT_UNDERLINE); + gaim_prefs_add_int(PREF_NICK_F, FONT_BOLD); +} + +GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) Property changes on: trunk/gtk/plugins/convcolors.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Revision Name: svn:eol-style + native Added: trunk/gtk/plugins/markerline.c =================================================================== --- trunk/gtk/plugins/markerline.c (rev 0) +++ trunk/gtk/plugins/markerline.c 2006-12-11 05:29:50 UTC (rev 17955) @@ -0,0 +1,302 @@ +/* + * Markerline - Draw a line to indicate new messages in a conversation. + * Copyright (C) 2006 + * + * 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 "internal.h" + +#define PLUGIN_ID "gtk-plugin_pack-markerline" +#define PLUGIN_NAME "Markerline" +#define PLUGIN_STATIC_NAME "Markerline" +#define PLUGIN_SUMMARY "Draw a line to indicate new messages in a conversation." +#define PLUGIN_DESCRIPTION "Draw a line to indicate new messages in a conversation." +#define PLUGIN_AUTHOR "Sadrul H Chowdhury <sa...@us...>" + +/* System headers */ +#include <gdk/gdk.h> +#include <glib.h> +#include <gtk/gtk.h> + +/* Gaim headers */ +#include <gtkconv.h> +#include <gtkimhtml.h> +#include <gtkplugin.h> +#include <version.h> + +#define PREF_PREFIX "/plugins/gtk/" PLUGIN_ID +#define PREF_IMS PREF_PREFIX "/ims" +#define PREF_CHATS PREF_PREFIX "/chats" + +static int +imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, GaimGtkConversation *gtkconv) +{ + int y, last_y, offset; + GdkRectangle visible_rect; + GtkTextIter iter; + GdkRectangle buf; + int pad; + GaimConversation *conv = gtkconv->active_conv; + GaimConversationType type = gaim_conversation_get_type(conv); + + if ((type == GAIM_CONV_TYPE_CHAT && !gaim_prefs_get_bool(PREF_CHATS)) || + (type == GAIM_CONV_TYPE_IM && !gaim_prefs_get_bool(PREF_IMS))) + return FALSE; + + gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &visible_rect); + + offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "markerline")); + if (offset) + { + gtk_text_buffer_get_iter_at_offset(gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)), + &iter, offset); + + gtk_text_view_get_iter_location(GTK_TEXT_VIEW(widget), &iter, &buf); + last_y = buf.y + buf.height; + pad = (gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(widget)) + + gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(widget))) / 2; + last_y += pad; + } + else + last_y = 0; + + gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, + 0, last_y, 0, &y); + + if (y >= event->area.y) + { + GdkColor red = {0, 0xffff, 0, 0}; + GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(event->window)); + + gdk_gc_set_rgb_fg_color(gc, &red); + gdk_draw_line(event->window, gc, + 0, y, visible_rect.width, y); + gdk_gc_unref(gc); + } + return FALSE; +} + +static void +update_marker_for_gtkconv(GaimGtkConversation *gtkconv) +{ + GtkTextIter iter; + GtkTextBuffer *buffer; + g_return_if_fail(gtkconv != NULL); + + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); + + if (!gtk_text_buffer_get_char_count(buffer)) + return; + + gtk_text_buffer_get_end_iter(buffer, &iter); + + g_object_set_data(G_OBJECT(gtkconv->imhtml), "markerline", + GINT_TO_POINTER(gtk_text_iter_get_offset(&iter))); + gtk_widget_queue_draw(gtkconv->imhtml); +} + +static gboolean +focus_removed(GtkWidget *widget, GdkEventVisibility *event, GaimGtkWindow *win) +{ + GaimConversation *conv; + GaimGtkConversation *gtkconv; + + conv = gaim_gtk_conv_window_get_active_conversation(win); + g_return_val_if_fail(conv != NULL, FALSE); + + gtkconv = GAIM_GTK_CONVERSATION(conv); + update_marker_for_gtkconv(gtkconv); + + return FALSE; +} + +#if 0 +static gboolean +window_resized(GtkWidget *w, GdkEventConfigure *event, GaimGtkWindow *win) +{ + GList *list; + + list = gaim_gtk_conv_window_get_gtkconvs(win); + + for (; list; list = list->next) + update_marker_for_gtkconv(list->data); + + return FALSE; +} + +static gboolean +imhtml_resize_cb(GtkWidget *w, GtkAllocation *allocation, GaimGtkConversation *gtkconv) +{ + gtk_widget_queue_draw(w); + return FALSE; +} +#endif + +static void +page_switched(GtkWidget *widget, GtkWidget *page, gint num, GaimGtkWindow *win) +{ + focus_removed(NULL, NULL, win); +} + +static void +detach_from_gtkconv(GaimGtkConversation *gtkconv, gpointer null) +{ + g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->imhtml), imhtml_expose_cb, gtkconv); +} + +static void +detach_from_gaim_gtk_window(GaimGtkWindow *win, gpointer null) +{ + g_list_foreach(gaim_gtk_conv_window_get_gtkconvs(win), (GFunc)detach_from_gtkconv, NULL); + g_signal_handlers_disconnect_by_func(G_OBJECT(win->notebook), page_switched, win); + g_signal_handlers_disconnect_by_func(G_OBJECT(win->window), focus_removed, win); + + gtk_widget_queue_draw(win->window); +} + +static void +attach_to_gtkconv(GaimGtkConversation *gtkconv, gpointer null) +{ + detach_from_gtkconv(gtkconv, NULL); + g_signal_connect(G_OBJECT(gtkconv->imhtml), "expose_event", + G_CALLBACK(imhtml_expose_cb), gtkconv); +} + +static void +attach_to_gaim_gtk_window(GaimGtkWindow *win, gpointer null) +{ + g_list_foreach(gaim_gtk_conv_window_get_gtkconvs(win), (GFunc)attach_to_gtkconv, NULL); + + g_signal_connect(G_OBJECT(win->window), "focus_out_event", + G_CALLBACK(focus_removed), win); + + g_signal_connect(G_OBJECT(win->notebook), "switch_page", + G_CALLBACK(page_switched), win); + + gtk_widget_queue_draw(win->window); +} + +static void +detach_from_all_windows() +{ + g_list_foreach(gaim_gtk_conv_windows_get_list(), (GFunc)detach_from_gaim_gtk_window, NULL); +} + +static void +attach_to_all_windows() +{ + g_list_foreach(gaim_gtk_conv_windows_get_list(), (GFunc)attach_to_gaim_gtk_window, NULL); +} + +static void +conv_created(GaimConversation *conv, gpointer null) +{ + GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); + GaimGtkWindow *win; + + if (!gtkconv) + return; + + win = gaim_gtkconv_get_window(gtkconv); + + detach_from_gaim_gtk_window(win, NULL); + attach_to_gaim_gtk_window(win, NULL); +} + +static gboolean +plugin_load(GaimPlugin *plugin) +{ + attach_to_all_windows(); + + gaim_signal_connect(gaim_conversations_get_handle(), "conversation-created", + plugin, GAIM_CALLBACK(conv_created), NULL); + + return TRUE; +} + +static gboolean +plugin_unload(GaimPlugin *plugin) +{ + detach_from_all_windows(); + + return TRUE; +} + +static GaimPluginPrefFrame * +get_plugin_pref_frame(GaimPlugin *plugin) +{ + GaimPluginPrefFrame *frame; + GaimPluginPref *pref; + + frame = gaim_plugin_pref_frame_new(); + + pref = gaim_plugin_pref_new_with_label(_("Draw Markerline in ")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREF_IMS, + _("_IM windows")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREF_CHATS, + _("C_hat windows")); + gaim_plugin_pref_frame_add(frame, pref); + + return frame; +} + +static GaimPluginUiInfo prefs_info = { + get_plugin_pref_frame, + 0, + NULL, +}; + +static GaimPluginInfo info = { + GAIM_PLUGIN_MAGIC, /* Magic */ + GAIM_MAJOR_VERSION, /* Gaim Major Version */ + GAIM_MINOR_VERSION, /* Gaim Minor Version */ + GAIM_PLUGIN_STANDARD, /* plugin type */ + GAIM_GTK_PLUGIN_TYPE, /* ui requirement */ + 0, /* flags */ + NULL, /* dependencies */ + GAIM_PRIORITY_DEFAULT, /* priority */ + + PLUGIN_ID, /* plugin id */ + N_(PLUGIN_NAME), /* name */ + VERSION, /* version */ + N_(PLUGIN_SUMMARY), /* summary */ + N_(PLUGIN_DESCRIPTION), /* description */ + PLUGIN_AUTHOR, /* author */ + GAIM_WEBSITE, /* website */ + + plugin_load, /* load */ + plugin_unload, /* unload */ + NULL, /* destroy */ + + NULL, /* ui_info */ + NULL, /* extra_info */ + &prefs_info, /* prefs_info */ + NULL /* actions */ +}; + +static void +init_plugin(GaimPlugin *plugin) +{ + gaim_prefs_add_none(PREF_PREFIX); + gaim_prefs_add_bool(PREF_IMS, FALSE); + gaim_prefs_add_bool(PREF_CHATS, TRUE); +} + +GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) Property changes on: trunk/gtk/plugins/markerline.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Revision Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <amc...@us...> - 2006-12-11 05:03:53
|
Revision: 17954 http://svn.sourceforge.net/gaim/?rev=17954&view=rev Author: amc_grim Date: 2006-12-10 21:03:52 -0800 (Sun, 10 Dec 2006) Log Message: ----------- The first batch of plugins from the plugin pack to get moved into gaim proper. This batch includes ONLY the core plugins. I will be adding the gtk plugins shortly. Modified Paths: -------------- trunk/libgaim/plugins/Makefile.am trunk/libgaim/plugins/Makefile.mingw Added Paths: ----------- trunk/libgaim/plugins/autoaccept.c trunk/libgaim/plugins/autoreply.c trunk/libgaim/plugins/buddynote.c trunk/libgaim/plugins/newline.c trunk/libgaim/plugins/offlinemsg.c Modified: trunk/libgaim/plugins/Makefile.am =================================================================== --- trunk/libgaim/plugins/Makefile.am 2006-12-11 03:40:11 UTC (rev 17953) +++ trunk/libgaim/plugins/Makefile.am 2006-12-11 05:03:52 UTC (rev 17954) @@ -24,8 +24,13 @@ plugindir = $(libdir)/gaim +autoaccept_la_LDFLAGS = -module -avoid-version +autoreply_la_LDFLAGS = -module -avoid-version +buddynote_la_LDFLAGS = -module -avoid-version idle_la_LDFLAGS = -module -avoid-version log_reader_la_LDFLAGS = -module -avoid-version +newline_la_LDFLAGS = -module -avoid-version +offlinemsg_la_LDFLAGS = -module -avoid-version psychic_la_LDFLAGS = -module -avoid-version statenotify_la_LDFLAGS = -module -avoid-version @@ -35,20 +40,34 @@ if PLUGINS plugin_LTLIBRARIES = \ + autoaccept.la \ + autoreply.la \ + buddynote.la \ idle.la \ log_reader.la \ + newline.la \ + offlinemsg.la \ psychic.la \ statenotify.la \ $(DBUS_LTLIB) - +autoaccept_la_SOURCES = autoaccept.c +autoreply_la_SOURCES = autoreply.c +buddynote_la_SOURCES = buddynote.c idle_la_SOURCES = idle.c log_reader_la_SOURCES = log_reader.c +newline_la_SOURCES = newline.c +offlinemsg_la_SOURCES = offlinemsg.c psychic_la_SOURCES = psychic.c statenotify_la_SOURCES = statenotify.c +autoaccept_la_LIBADD = $(GLIB_LIBS) +autoreply_la_LIBADD = $(GLIB_LIBS) +buddynote_la_LIBADD = $(GLIB_LIBS) idle_la_LIBADD = $(GLIB_LIBS) log_reader_la_LIBADD = $(GLIB_LIBS) +newline_la_LIBADD = $(GLIB_LIBS) +offlinemsg_la_LIBADD = $(GLIB_LIBS) psychic_la_LIBADD = $(GLIB_LIBS) statenotify_la_LIBADD = $(GLIB_LIBS) Modified: trunk/libgaim/plugins/Makefile.mingw =================================================================== --- trunk/libgaim/plugins/Makefile.mingw 2006-12-11 03:40:11 UTC (rev 17953) +++ trunk/libgaim/plugins/Makefile.mingw 2006-12-11 05:03:52 UTC (rev 17954) @@ -60,8 +60,13 @@ $(CC) -shared $@.o $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $@ plugins: \ + autoaccept.dll \ + autoreply.dll \ + buddynote.dll \ idle.dll \ log_reader.dll \ + newline.dll \ + offlinemsg.dll \ psychic.dll \ statenotify.dll Added: trunk/libgaim/plugins/autoaccept.c =================================================================== --- trunk/libgaim/plugins/autoaccept.c (rev 0) +++ trunk/libgaim/plugins/autoaccept.c 2006-12-11 05:03:52 UTC (rev 17954) @@ -0,0 +1,273 @@ +/* + * Autoaccept - Auto-accept file transfers from selected users + * Copyright (C) 2006 + * + * 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 "internal.h" + +#define PLUGIN_ID "core-plugin_pack-autoaccept" +#define PLUGIN_NAME "Autoaccept" +#define PLUGIN_STATIC_NAME "Autoaccept" +#define PLUGIN_SUMMARY "Auto-accept file transfer requests from selected users." +#define PLUGIN_DESCRIPTION "Auto-accept file transfer requests from selected users." +#define PLUGIN_AUTHOR "Sadrul H Chowdhury <sa...@us...>" + +/* System headers */ +#include <glib.h> +#if GLIB_CHECK_VERSION(2,6,0) +# include <glib/gstdio.h> +#else +# include <sys/types.h> +# include <sys/stat.h> +# define g_mkdir mkdir +#endif + +/* Gaim headers */ +#include <plugin.h> +#include <version.h> + +#include <blist.h> +#include <conversation.h> +#include <ft.h> +#include <request.h> +#include <notify.h> +#include <util.h> + +#define PREF_PREFIX "/plugins/core/" PLUGIN_ID +#define PREF_PATH PREF_PREFIX "/path" +#define PREF_STRANGER PREF_PREFIX "/reject_stranger" +#define PREF_NOTIFY PREF_PREFIX "/notify" + +typedef enum +{ + FT_ASK, + FT_ACCEPT, + FT_REJECT +} AutoAcceptSetting; + +static gboolean +ensure_path_exists(const char *dir) +{ + if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) + { + if (gaim_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR)) + return FALSE; + } + + return TRUE; +} + +static void +auto_accept_complete_cb(GaimXfer *xfer, GaimXfer *my) +{ + if (xfer == my && gaim_prefs_get_bool(PREF_NOTIFY) && + !gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, xfer->who, xfer->account)) + { + char *message = g_strdup_printf(_("Autoaccepted file transfer of \"%s\" from \"%s\" completed."), + xfer->filename, xfer->who); + gaim_notify_info(NULL, _("Autoaccept complete"), message, NULL); + g_free(message); + } +} + +static void +file_recv_request_cb(GaimXfer *xfer, gpointer handle) +{ + GaimAccount *account; + GaimBlistNode *node; + const char *pref; + char *filename; + char *dirname; + + account = xfer->account; + node = (GaimBlistNode *)gaim_find_buddy(account, xfer->who); + + if (!node) + { + if (gaim_prefs_get_bool(PREF_STRANGER)) + xfer->status = GAIM_XFER_STATUS_CANCEL_LOCAL; + return; + } + + node = node->parent; + g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node)); + + pref = gaim_prefs_get_string(PREF_PATH); + switch (gaim_blist_node_get_int(node, "autoaccept")) + { + case FT_ASK: + break; + case FT_ACCEPT: + if (ensure_path_exists(pref)) + { + dirname = g_build_filename(pref, xfer->who, NULL); + + if (!ensure_path_exists(dirname)) + { + g_free(dirname); + break; + } + + filename = g_build_filename(dirname, xfer->filename, NULL); + + gaim_xfer_request_accepted(xfer, filename); + + g_free(dirname); + g_free(filename); + } + + gaim_signal_connect(gaim_xfers_get_handle(), "file-recv-complete", handle, + GAIM_CALLBACK(auto_accept_complete_cb), xfer); + break; + case FT_REJECT: + xfer->status = GAIM_XFER_STATUS_CANCEL_LOCAL; + break; + } +} + +static void +save_cb(GaimBlistNode *node, int choice) +{ + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + node = node->parent; + g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node)); + gaim_blist_node_set_int(node, "autoaccept", choice); +} + +static void +set_auto_accept_settings(GaimBlistNode *node, gpointer plugin) +{ + char *message; + + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + node = node->parent; + g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node)); + + message = g_strdup_printf(_("When a file-transfer request arrives from %s"), + gaim_contact_get_alias((GaimContact *)node)); + gaim_request_choice(plugin, _("Set Autoaccept Setting"), message, + NULL, gaim_blist_node_get_int(node, "autoaccept"), + _("_Save"), G_CALLBACK(save_cb), + _("_Cancel"), NULL, node, + _("Ask"), FT_ASK, + _("Auto Accept"), FT_ACCEPT, + _("Auto Reject"), FT_REJECT, + NULL); + g_free(message); +} + +static void +context_menu(GaimBlistNode *node, GList **menu, gpointer plugin) +{ + GaimMenuAction *action; + + if (!GAIM_BLIST_NODE_IS_BUDDY(node) && !GAIM_BLIST_NODE_IS_CONTACT(node)) + return; + + action = gaim_menu_action_new(_("Autoaccept File Transfers..."), + GAIM_CALLBACK(set_auto_accept_settings), plugin, NULL); + (*menu) = g_list_prepend(*menu, action); +} + +static gboolean +plugin_load(GaimPlugin *plugin) +{ + gaim_signal_connect(gaim_xfers_get_handle(), "file-recv-request", plugin, + GAIM_CALLBACK(file_recv_request_cb), plugin); + gaim_signal_connect(gaim_blist_get_handle(), "blist-node-extended-menu", plugin, + GAIM_CALLBACK(context_menu), plugin); + return TRUE; +} + +static gboolean +plugin_unload(GaimPlugin *plugin) +{ + return TRUE; +} + +static GaimPluginPrefFrame * +get_plugin_pref_frame(GaimPlugin *plugin) +{ + GaimPluginPrefFrame *frame; + GaimPluginPref *pref; + + frame = gaim_plugin_pref_frame_new(); + + /* XXX: Is there a better way than this? There really should be. */ + pref = gaim_plugin_pref_new_with_name_and_label(PREF_PATH, _("Path to save the files in\n" + "(Please provide the full path)")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREF_STRANGER, + _("Automatically reject from users not in buddy list")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREF_NOTIFY, + _("Notify with a popup when an autoaccepted file transfer is complete\n" + "(only when there's no conversation with the sender)")); + gaim_plugin_pref_frame_add(frame, pref); + + return frame; +} + +static GaimPluginUiInfo prefs_info = { + get_plugin_pref_frame, + 0, + NULL, +}; + +static GaimPluginInfo info = { + GAIM_PLUGIN_MAGIC, /* Magic */ + GAIM_MAJOR_VERSION, /* Gaim Major Version */ + GAIM_MINOR_VERSION, /* Gaim Minor Version */ + GAIM_PLUGIN_STANDARD, /* plugin type */ + NULL, /* ui requirement */ + 0, /* flags */ + NULL, /* dependencies */ + GAIM_PRIORITY_DEFAULT, /* priority */ + + PLUGIN_ID, /* plugin id */ + N_(PLUGIN_NAME), /* name */ + VERSION, /* version */ + N_(PLUGIN_SUMMARY), /* summary */ + N_(PLUGIN_DESCRIPTION), /* description */ + PLUGIN_AUTHOR, /* author */ + GAIM_WEBSITE, /* website */ + + plugin_load, /* load */ + plugin_unload, /* unload */ + NULL, /* destroy */ + + NULL, /* ui_info */ + NULL, /* extra_info */ + &prefs_info, /* prefs_info */ + NULL /* actions */ +}; + +static void +init_plugin(GaimPlugin *plugin) { + char *dirname; + + dirname = g_build_filename(gaim_user_dir(), "autoaccept", NULL); + gaim_prefs_add_none(PREF_PREFIX); + gaim_prefs_add_string(PREF_PATH, dirname); + gaim_prefs_add_bool(PREF_STRANGER, TRUE); + gaim_prefs_add_bool(PREF_NOTIFY, TRUE); + g_free(dirname); +} + +GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) Property changes on: trunk/libgaim/plugins/autoaccept.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Revision Name: svn:eol-style + native Added: trunk/libgaim/plugins/autoreply.c =================================================================== --- trunk/libgaim/plugins/autoreply.c (rev 0) +++ trunk/libgaim/plugins/autoreply.c 2006-12-11 05:03:52 UTC (rev 17954) @@ -0,0 +1,435 @@ +/* + * Autoreply - Autoreply feature for all the protocols + * Copyright (C) 2005 + * + * 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 "internal.h" + +#define PLUGIN_ID "core-plugin_pack-autoreply" +#define PLUGIN_NAME "Autoreply" +#define PLUGIN_STATIC_NAME "Autoreply" +#define PLUGIN_SUMMARY "Autoreply for all the protocols" +#define PLUGIN_DESCRIPTION "This plugin lets you set autoreply message for any protocol. "\ + "You can set the global autoreply message from the Plugin-options dialog. " \ + "To set some specific autoreply message for a particular buddy, right click " \ + "on the buddy in the buddy-list window. To set autoreply messages for some " \ + "account, go to the `Advanced' tab of the Account-edit dialog." +#define PLUGIN_AUTHOR "Sadrul Habib Chowdhury <sa...@us...>" + +/* System headers */ +#include <glib.h> + +/* Gaim headers */ +#include <account.h> +#include <accountopt.h> +#include <blist.h> +#include <conversation.h> +#include <plugin.h> +#include <pluginpref.h> +#include <request.h> +#include <savedstatuses.h> +#include <status.h> +#include <util.h> +#include <version.h> + +#define PREFS_PREFIX "/core/" PLUGIN_ID +#define PREFS_IDLE PREFS_PREFIX "/idle" +#define PREFS_AWAY PREFS_PREFIX "/away" +#define PREFS_GLOBAL PREFS_PREFIX "/global" +#define PREFS_MINTIME PREFS_PREFIX "/mintime" +#define PREFS_MAXSEND PREFS_PREFIX "/maxsend" +#define PREFS_USESTATUS PREFS_PREFIX "/usestatus" + +typedef struct _GaimAutoReply GaimAutoReply; + +struct _GaimAutoReply +{ + GaimBuddy *buddy; + char *reply; +}; + +typedef enum +{ + STATUS_NEVER, + STATUS_ALWAYS, + STATUS_FALLBACK +} UseStatusMessage; + +static GHashTable *options = NULL; + +/** + * Returns the auto-reply message for buddy + */ +static const char * +get_autoreply_message(GaimBuddy *buddy, GaimAccount *account) +{ + const char *reply = NULL; + UseStatusMessage use_status; + + use_status = gaim_prefs_get_int(PREFS_USESTATUS); + if (use_status == STATUS_ALWAYS) + { + GaimStatus *status = gaim_account_get_active_status(account); + GaimStatusType *type = gaim_status_get_type(status); + if (gaim_status_type_get_attr(type, "message") != NULL) + reply = gaim_status_get_attr_string(status, "message"); + else + reply = gaim_savedstatus_get_message(gaim_savedstatus_get_current()); + } + + if (!reply && buddy) + { + /* Is there any special auto-reply for this buddy? */ + reply = gaim_blist_node_get_string((GaimBlistNode*)buddy, "autoreply"); + + if (!reply && GAIM_BLIST_NODE_IS_BUDDY((GaimBlistNode*)buddy)) + { + /* Anything for the contact, then? */ + reply = gaim_blist_node_get_string(((GaimBlistNode*)buddy)->parent, "autoreply"); + } + } + + if (!reply) + { + /* Is there any specific auto-reply for this account? */ + reply = gaim_account_get_string(account, "autoreply", NULL); + } + + if (!reply) + { + /* Get the global auto-reply message */ + reply = gaim_prefs_get_string(PREFS_GLOBAL); + } + + if (*reply == ' ') + reply = NULL; + + if (!reply && use_status == STATUS_FALLBACK) + reply = gaim_status_get_attr_string(gaim_account_get_active_status(account), "message"); + + return reply; +} + +static void +written_msg(GaimAccount *account, const char *who, const char *message, + GaimConversation *conv, GaimMessageFlags flags, gpointer null) +{ + GaimBuddy *buddy; + GaimPresence *presence; + const char *reply = NULL; + gboolean trigger = FALSE; + + if (!(flags & GAIM_MESSAGE_RECV)) + return; + + if (!message || !*message) + return; + + /* Do not send an autoreply for an autoreply */ + if (flags & GAIM_MESSAGE_AUTO_RESP) + return; + + g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM); + + presence = gaim_account_get_presence(account); + + if (gaim_prefs_get_bool(PREFS_AWAY) && !gaim_presence_is_available(presence)) + trigger = TRUE; + if (gaim_prefs_get_bool(PREFS_IDLE) && gaim_presence_is_idle(presence)) + trigger = TRUE; + + if (!trigger) + return; + + buddy = gaim_find_buddy(account, who); + reply = get_autoreply_message(buddy, account); + + if (reply) + { + GaimConnection *gc; + GaimMessageFlags flag = GAIM_MESSAGE_SEND; + time_t last_sent, now; + int count_sent, maxsend; + + last_sent = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "autoreply_lastsent")); + now = time(NULL); + + /* Have we spent enough time after our last autoreply? */ + if (now - last_sent >= (gaim_prefs_get_int(PREFS_MINTIME)*60)) + { + count_sent = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "autoreply_count")); + maxsend = gaim_prefs_get_int(PREFS_MAXSEND); + + /* Have we sent the autoreply enough times? */ + if (count_sent < maxsend || maxsend == -1) + { + gaim_conversation_set_data(conv, "autoreply_count", GINT_TO_POINTER(++count_sent)); + gaim_conversation_set_data(conv, "autoreply_lastsent", GINT_TO_POINTER(now)); + gc = gaim_account_get_connection(account); + if (gc->flags & GAIM_CONNECTION_AUTO_RESP) + flag |= GAIM_MESSAGE_AUTO_RESP; + serv_send_im(gc, who, reply, flag); + gaim_conv_im_write(GAIM_CONV_IM(conv), NULL, reply, flag, time(NULL)); + } + } + } +} + +static void +set_auto_reply_cb(GaimBlistNode *node, char *message) +{ + if (!message || !*message) + message = " "; + gaim_blist_node_set_string(node, "autoreply", message); +} + +static void +set_auto_reply(GaimBlistNode *node, gpointer plugin) +{ + char *message; + GaimBuddy *buddy; + GaimAccount *account; + GaimConnection *gc; + + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + buddy = (GaimBuddy *)node; + else + buddy = gaim_contact_get_priority_buddy((GaimContact*)node); + + account = gaim_buddy_get_account(buddy); + gc = gaim_account_get_connection(account); + + /* XXX: There should be a way to reset to the default/account-default autoreply */ + + message = g_strdup_printf(_("Set autoreply message for %s"), + gaim_buddy_get_contact_alias(buddy)); + gaim_request_input(plugin, _("Set Autoreply Message"), message, + _("The following message will be sent to the buddy when " + "the buddy sends you a message and autoreply is enabled."), + get_autoreply_message(buddy, account), TRUE, FALSE, + (gc->flags & GAIM_CONNECTION_HTML) ? "html" : NULL, + _("_Save"), G_CALLBACK(set_auto_reply_cb), + _("_Cancel"), NULL, node); + g_free(message); +} + +static void +context_menu(GaimBlistNode *node, GList **menu, gpointer plugin) +{ + GaimMenuAction *action; + + if (!GAIM_BLIST_NODE_IS_BUDDY(node) && !GAIM_BLIST_NODE_IS_CONTACT(node)) + return; + + action = gaim_menu_action_new(_("Set _Autoreply Message"), + GAIM_CALLBACK(set_auto_reply), plugin, NULL); + (*menu) = g_list_prepend(*menu, action); +} + +static void +add_option_for_protocol(GaimPlugin *plg) +{ + GaimPluginProtocolInfo *info = GAIM_PLUGIN_PROTOCOL_INFO(plg); + GaimAccountOption *option; + + option = gaim_account_option_string_new(_("Autoreply message"), "autoreply", NULL); + info->protocol_options = g_list_append(info->protocol_options, option); + + if (!g_hash_table_lookup(options, plg)) + g_hash_table_insert(options, plg, option); +} + +static void +remove_option_for_protocol(GaimPlugin *plg) +{ + GaimPluginProtocolInfo *info = GAIM_PLUGIN_PROTOCOL_INFO(plg); + GaimAccountOption *option = g_hash_table_lookup(options, plg); + + if (g_list_find(info->protocol_options, option)) + { + info->protocol_options = g_list_remove(info->protocol_options, option); + gaim_account_option_destroy(option); + g_hash_table_remove(options, plg); + } +} + +static void +plugin_load_cb(GaimPlugin *plugin, gboolean load) +{ + if (plugin->info && plugin->info->type == GAIM_PLUGIN_PROTOCOL) + { + if (load) + add_option_for_protocol(plugin); + else + remove_option_for_protocol(plugin); + } +} + +static gboolean +plugin_load(GaimPlugin *plugin) +{ + GList *list; + + gaim_signal_connect(gaim_conversations_get_handle(), "wrote-im-msg", plugin, + GAIM_CALLBACK(written_msg), NULL); + gaim_signal_connect(gaim_blist_get_handle(), "blist-node-extended-menu", plugin, + GAIM_CALLBACK(context_menu), plugin); + gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load", plugin, + GAIM_CALLBACK(plugin_load_cb), GINT_TO_POINTER(TRUE)); + gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload", plugin, + GAIM_CALLBACK(plugin_load_cb), GINT_TO_POINTER(FALSE)); + + /* Perhaps it's necessary to do this after making sure the prpl-s have been loaded? */ + options = g_hash_table_new(g_direct_hash, g_direct_equal); + list = gaim_plugins_get_protocols(); + while (list) + { + add_option_for_protocol(list->data); + list = list->next; + } + + return TRUE; +} + +static gboolean +plugin_unload(GaimPlugin *plugin) +{ + GList *list; + + if (options == NULL) + return TRUE; + + list = gaim_plugins_get_protocols(); + while (list) + { + remove_option_for_protocol(list->data); + list = list->next; + } + g_hash_table_destroy(options); + options = NULL; + + return TRUE; +} + +static GaimPluginPrefFrame * +get_plugin_pref_frame(GaimPlugin *plugin) +{ + GaimPluginPrefFrame *frame; + GaimPluginPref *pref; + + frame = gaim_plugin_pref_frame_new(); + + pref = gaim_plugin_pref_new_with_label(_("Send autoreply messages when")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREFS_AWAY, + _("When my account is _away")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREFS_IDLE, + _("When my account is _idle")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREFS_GLOBAL, + _("_Default reply")); + gaim_plugin_pref_set_type(pref, GAIM_PLUGIN_PREF_STRING_FORMAT); + gaim_plugin_pref_set_format_type(pref, + GAIM_STRING_FORMAT_TYPE_MULTILINE | GAIM_STRING_FORMAT_TYPE_HTML); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_label(_("Status message")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREFS_USESTATUS, + _("Autoreply with status message")); + gaim_plugin_pref_set_type(pref, GAIM_PLUGIN_PREF_CHOICE); + gaim_plugin_pref_add_choice(pref, _("Never"), + GINT_TO_POINTER(STATUS_NEVER)); + gaim_plugin_pref_add_choice(pref, _("Always when there is a status message"), + GINT_TO_POINTER(STATUS_ALWAYS)); + gaim_plugin_pref_add_choice(pref, _("Only when there's no autoreply message"), + GINT_TO_POINTER(STATUS_FALLBACK)); + + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_label(_("Delay between autoreplies")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREFS_MINTIME, + _("_Minimum delay (mins)")); + gaim_plugin_pref_set_bounds(pref, 0, 9999); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_label(_("Times to send autoreplies")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREFS_MAXSEND, + _("Ma_ximum count")); + gaim_plugin_pref_set_bounds(pref, 0, 9999); + gaim_plugin_pref_frame_add(frame, pref); + + return frame; +} + +static GaimPluginUiInfo prefs_info = { + get_plugin_pref_frame, + 0, + NULL +}; + +static GaimPluginInfo info = { + GAIM_PLUGIN_MAGIC, /* Magic */ + GAIM_MAJOR_VERSION, /* Gaim Major Version */ + GAIM_MINOR_VERSION, /* Gaim Minor Version */ + GAIM_PLUGIN_STANDARD, /* plugin type */ + NULL, /* ui requirement */ + 0, /* flags */ + NULL, /* dependencies */ + GAIM_PRIORITY_DEFAULT, /* priority */ + + PLUGIN_ID, /* plugin id */ + N_(PLUGIN_NAME), /* name */ + VERSION, /* version */ + N_(PLUGIN_SUMMARY), /* summary */ + N_(PLUGIN_DESCRIPTION), /* description */ + PLUGIN_AUTHOR, /* author */ + GAIM_WEBSITE, /* website */ + + plugin_load, /* load */ + plugin_unload, /* unload */ + NULL, /* destroy */ + + NULL, /* ui_info */ + NULL, /* extra_info */ + &prefs_info, /* prefs_info */ + NULL /* actions */ +}; + +static void +init_plugin(GaimPlugin *plugin) +{ + gaim_prefs_add_none(PREFS_PREFIX); + gaim_prefs_add_bool(PREFS_IDLE, TRUE); + gaim_prefs_add_bool(PREFS_AWAY, TRUE); + gaim_prefs_add_string(PREFS_GLOBAL, _("I am currently not available. Please leave your message, " + "and I will get back to you as soon as possible.")); + gaim_prefs_add_int(PREFS_MINTIME, 10); + gaim_prefs_add_int(PREFS_MAXSEND, 10); + gaim_prefs_add_int(PREFS_USESTATUS, STATUS_NEVER); +} + +GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) Property changes on: trunk/libgaim/plugins/autoreply.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Revision Name: svn:eol-style + native Added: trunk/libgaim/plugins/buddynote.c =================================================================== --- trunk/libgaim/plugins/buddynote.c (rev 0) +++ trunk/libgaim/plugins/buddynote.c 2006-12-11 05:03:52 UTC (rev 17954) @@ -0,0 +1,110 @@ +/* + * BuddyNote - Store notes on particular buddies + * Copyright (C) 2004 Stu Tomlinson <st...@no...> + * + * 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 "internal.h" + +#include <debug.h> +#include <notify.h> +#include <request.h> +#include <signals.h> +#include <util.h> +#include <version.h> + +static void +dont_do_it_cb(GaimBlistNode *node, const char *note) +{ +} + +static void +do_it_cb(GaimBlistNode *node, const char *note) +{ + gaim_blist_node_set_string(node, "notes", note); +} + +static void +buddynote_edit_cb(GaimBlistNode *node, gpointer data) +{ + const char *note; + + note = gaim_blist_node_get_string(node, "notes"); + + gaim_request_input(node, _("Notes"), + _("Enter your notes below..."), + NULL, + note, TRUE, FALSE, "html", + _("Save"), G_CALLBACK(do_it_cb), + _("Cancel"), G_CALLBACK(dont_do_it_cb), + node); +} + +static void +buddynote_extended_menu_cb(GaimBlistNode *node, GList **m) +{ + GaimMenuAction *bna = NULL; + + *m = g_list_append(*m, bna); + bna = gaim_menu_action_new(_("Edit Notes..."), GAIM_CALLBACK(buddynote_edit_cb), NULL, NULL); + *m = g_list_append(*m, bna); +} + +static gboolean +plugin_load(GaimPlugin *plugin) +{ + + gaim_signal_connect(gaim_blist_get_handle(), "blist-node-extended-menu", + plugin, GAIM_CALLBACK(buddynote_extended_menu_cb), NULL); + + return TRUE; +} + +static GaimPluginInfo info = +{ + GAIM_PLUGIN_MAGIC, + GAIM_MAJOR_VERSION, /**< major version */ + GAIM_MINOR_VERSION, + GAIM_PLUGIN_STANDARD, /**< type */ + NULL, /**< ui_requirement */ + 0, /**< flags */ + NULL, /**< dependencies */ + GAIM_PRIORITY_DEFAULT, /**< priority */ + + "core-plugin_pack-buddynote", /**< id */ + N_("Buddy Notes"), /**< name */ + VERSION, /**< version */ + N_("Store notes on particular buddies."), /** summary */ + N_("Adds the option to store notes for buddies " + "on your buddy list."), /** description */ + "Stu Tomlinson <st...@no...>", /**< author */ + GAIM_WEBSITE, /**< homepage */ + + plugin_load, /**< load */ + NULL, /**< unload */ + NULL, /**< destroy */ + + NULL, /**< ui_info */ + NULL, /**< extra_info */ + NULL, /**< prefs_info */ + NULL /**< actions */ +}; + + +static void +init_plugin(GaimPlugin *plugin) { +} + +GAIM_INIT_PLUGIN(buddynote, init_plugin, info) Property changes on: trunk/libgaim/plugins/buddynote.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Revision Name: svn:eol-style + native Added: trunk/libgaim/plugins/newline.c =================================================================== --- trunk/libgaim/plugins/newline.c (rev 0) +++ trunk/libgaim/plugins/newline.c 2006-12-11 05:03:52 UTC (rev 17954) @@ -0,0 +1,95 @@ +/* + * Displays messages on a new line, below the nick + * Copyright (C) 2004 Stu Tomlinson <st...@no...> + * + * 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 "internal.h" + +#include <string.h> + +#include <conversation.h> +#include <debug.h> +#include <plugin.h> +#include <signals.h> +#include <util.h> +#include <version.h> + +static gboolean +addnewline_msg_cb(GaimAccount *account, char *sender, char **message, + GaimConversation *conv, int *flags, void *data) +{ + if (g_ascii_strncasecmp(*message, "/me ", strlen("/me "))) { + char *tmp = g_strdup_printf("\n%s", *message); + g_free(*message); + *message = tmp; + } + + return FALSE; +} + +static gboolean +plugin_load(GaimPlugin *plugin) +{ + void *conversation = gaim_conversations_get_handle(); + + gaim_signal_connect(conversation, "displaying-im-msg", + plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL); + gaim_signal_connect(conversation, "displaying-chat-msg", + plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL); + gaim_signal_connect(conversation, "receiving-im-msg", + plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL); + gaim_signal_connect(conversation, "receiving-chat-msg", + plugin, GAIM_CALLBACK(addnewline_msg_cb), NULL); + + return TRUE; +} + +static GaimPluginInfo info = +{ + GAIM_PLUGIN_MAGIC, /**< magic */ + GAIM_MAJOR_VERSION, /**< major version */ + GAIM_MINOR_VERSION, /**< minor version */ + GAIM_PLUGIN_STANDARD, /**< type */ + NULL, /**< ui_requirement */ + 0, /**< flags */ + NULL, /**< dependencies */ + GAIM_PRIORITY_DEFAULT, /**< priority */ + + "core-plugin_pack-newline", /**< id */ + N_("New Line"), /**< name */ + VERSION, /**< version */ + N_("Prepends a newline to displayed message."), /** summary */ + N_("Prepends a newline to messages so that the " + "test of the message appears below the " + "screen name in the conversation window."), /** description */ + "Stu Tomlinson <st...@no...>", /**< author */ + GAIM_WEBSITE, /**< homepage */ + + plugin_load, /**< load */ + NULL, /**< unload */ + NULL, /**< destroy */ + + NULL, /**< ui_info */ + NULL, /**< extra_info */ + NULL, /**< prefs_info */ + NULL /**< actions */ +}; + +static void +init_plugin(GaimPlugin *plugin) { +} + +GAIM_INIT_PLUGIN(lastseen, init_plugin, info) Property changes on: trunk/libgaim/plugins/newline.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Revision Name: svn:eol-style + native Added: trunk/libgaim/plugins/offlinemsg.c =================================================================== --- trunk/libgaim/plugins/offlinemsg.c (rev 0) +++ trunk/libgaim/plugins/offlinemsg.c 2006-12-11 05:03:52 UTC (rev 17954) @@ -0,0 +1,239 @@ +/* + * Offline Message Emulation - Save messages sent to an offline user as pounce + * Copyright (C) 2004 + * + * 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 "internal.h" + +#define PLUGIN_ID "core-plugin_pack-offlinemsg" +#define PLUGIN_NAME "Offline Message Emulation" +#define PLUGIN_STATIC_NAME "offlinemsg" +#define PLUGIN_SUMMARY "Save messages sent to an offline user as pounce." +#define PLUGIN_DESCRIPTION "Save messages sent to an offline user as pounce." +#define PLUGIN_AUTHOR "Sadrul H Chowdhury <sa...@us...>" + +/* Gaim headers */ +#include <version.h> + +#include <blist.h> +#include <conversation.h> +#include <core.h> +#include <debug.h> +#include <pounce.h> +#include <request.h> + +#define PREF_PREFIX "/plugins/core/" PLUGIN_ID +#define PREF_ALWAYS PREF_PREFIX "/always" + +typedef struct _OfflineMsg OfflineMsg; + +typedef enum +{ + OFFLINE_MSG_NONE, + OFFLINE_MSG_YES, + OFFLINE_MSG_NO +} OfflineMessageSetting; + +struct _OfflineMsg +{ + GaimAccount *account; + GaimConversation *conv; + char *who; + char *message; +}; + +static void +discard_data(OfflineMsg *offline) +{ + g_free(offline->who); + g_free(offline->message); + g_free(offline); +} + +static void +cancel_poune(OfflineMsg *offline) +{ + gaim_conversation_set_data(offline->conv, "plugin_pack:offlinemsg", + GINT_TO_POINTER(OFFLINE_MSG_NO)); + gaim_conv_im_send_with_flags(GAIM_CONV_IM(offline->conv), offline->message, 0); + discard_data(offline); +} + +static void +record_pounce(OfflineMsg *offline) +{ + GaimPounce *pounce; + GaimPounceEvent event; + GaimPounceOption option; + GaimConversation *conv; + + event = GAIM_POUNCE_SIGNON; + option = GAIM_POUNCE_OPTION_NONE; + + pounce = gaim_pounce_new(gaim_core_get_ui(), offline->account, offline->who, + event, option); + + gaim_pounce_action_set_enabled(pounce, "send-message", TRUE); + gaim_pounce_action_set_attribute(pounce, "send-message", "message", offline->message); + + conv = offline->conv; + if (!gaim_conversation_get_data(conv, "plugin_pack:offlinemsg")) + gaim_conversation_write(conv, NULL, _("The rest of the messages will be saved " + "as pounce. You can edit/delete the pounce from the `Buddy " + "Pounce' dialog."), + GAIM_MESSAGE_SYSTEM, time(NULL)); + gaim_conversation_set_data(conv, "plugin_pack:offlinemsg", + GINT_TO_POINTER(OFFLINE_MSG_YES)); + + gaim_conv_im_write(GAIM_CONV_IM(conv), offline->who, offline->message, + GAIM_MESSAGE_SEND, time(NULL)); + + discard_data(offline); +} + +static void +sending_msg_cb(GaimAccount *account, const char *who, char **message, gpointer handle) +{ + GaimBuddy *buddy; + OfflineMsg *offline; + GaimConversation *conv; + OfflineMessageSetting setting; + + buddy = gaim_find_buddy(account, who); + if (!buddy) + return; + + if (gaim_presence_is_online(gaim_buddy_get_presence(buddy))) + return; + + if (gaim_account_supports_offline_message(account, buddy)) + { + gaim_debug_info("offlinemsg", "Account \"%s\" supports offline message.", + gaim_account_get_username(account)); + return; + } + + conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, + who, account); + + if (!conv) + return; + + setting = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "plugin_pack:offlinemsg")); + if (setting == OFFLINE_MSG_NO) + return; + + offline = g_new0(OfflineMsg, 1); + offline->conv = conv; + offline->account = account; + offline->who = g_strdup(who); + offline->message = *message; + *message = NULL; + + if (gaim_prefs_get_bool(PREF_ALWAYS) || setting == OFFLINE_MSG_YES) + record_pounce(offline); + else if (setting == OFFLINE_MSG_NONE) + { + char *ask; + ask = g_strdup_printf(_("\"%s\" is currently offline. Do you want to save the " + "rest of the messages in a pounce and automatically send them " + "when \"%s\" logs back in?"), who, who); + + gaim_request_action(handle, _("Offline Message"), ask, + _("You can edit/delete the pounce from the `Buddy Pounces' dialog"), + 1, offline, 2, + _("Yes"), record_pounce, + _("No"), cancel_poune); + g_free(ask); + } +} + +static gboolean +plugin_load(GaimPlugin *plugin) +{ + gaim_signal_connect(gaim_conversations_get_handle(), "sending-im-msg", + plugin, GAIM_CALLBACK(sending_msg_cb), plugin); + return TRUE; +} + +static gboolean +plugin_unload(GaimPlugin *plugin) +{ + return TRUE; +} + +static GaimPluginPrefFrame * +get_plugin_pref_frame(GaimPlugin *plugin) +{ + GaimPluginPrefFrame *frame; + GaimPluginPref *pref; + + frame = gaim_plugin_pref_frame_new(); + + pref = gaim_plugin_pref_new_with_label(_("Save offline messages in pounce")); + gaim_plugin_pref_frame_add(frame, pref); + + pref = gaim_plugin_pref_new_with_name_and_label(PREF_ALWAYS, + _("Do not ask. Always save in pounce.")); + gaim_plugin_pref_frame_add(frame, pref); + + return frame; +} + +static GaimPluginUiInfo prefs_info = { + get_plugin_pref_frame, + 0, + NULL +}; + +static GaimPluginInfo info = +{ + GAIM_PLUGIN_MAGIC, /* Magic */ + GAIM_MAJOR_VERSION, /* Gaim Major Version */ + GAIM_MINOR_VERSION, /* Gaim Minor Version */ + GAIM_PLUGIN_STANDARD, /* plugin type */ + NULL, /* ui requirement */ + 0, /* flags */ + NULL, /* dependencies */ + GAIM_PRIORITY_DEFAULT, /* priority */ + + PLUGIN_ID, /* plugin id */ + N_(PLUGIN_NAME), /* name */ + VERSION, /* version */ + N_(PLUGIN_SUMMARY), /* summary */ + N_(PLUGIN_DESCRIPTION), /* description */ + PLUGIN_AUTHOR, /* author */ + GAIM_WEBSITE, /* website */ + + plugin_load, /* load */ + plugin_unload, /* unload */ + NULL, /* destroy */ + + NULL, /* ui_info */ + NULL, /* extra_info */ + &prefs_info, /* prefs_info */ + NULL /* actions */ +}; + +static void +init_plugin(GaimPlugin *plugin) +{ + gaim_prefs_add_none(PREF_PREFIX); + gaim_prefs_add_bool(PREF_ALWAYS, FALSE); +} + +GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) Property changes on: trunk/libgaim/plugins/offlinemsg.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Revision Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-12-11 03:40:17
|
Revision: 17953 http://svn.sourceforge.net/gaim/?rev=17953&view=rev Author: sadrul Date: 2006-12-10 19:40:11 -0800 (Sun, 10 Dec 2006) Log Message: ----------- This seems to fix the compilation bug from a fresh checkout (reported in #gaim). Modified Paths: -------------- trunk/console/libgnt/Makefile.am Modified: trunk/console/libgnt/Makefile.am =================================================================== --- trunk/console/libgnt/Makefile.am 2006-12-11 00:33:57 UTC (rev 17952) +++ trunk/console/libgnt/Makefile.am 2006-12-11 03:40:11 UTC (rev 17953) @@ -5,6 +5,7 @@ lib_LTLIBRARIES = libgnt.la libgnt_la_SOURCES = \ + gntmarshal.c \ gntwidget.c \ gntbindable.c \ gntbox.c \ @@ -16,7 +17,6 @@ gntkeys.c \ gntlabel.c \ gntline.c \ - gntmarshal.c \ gntmenu.c \ gntmenuitem.c \ gntmenuitemcheck.c \ @@ -56,7 +56,7 @@ gntmarshal.h \ gntmarshal.c -gntmarshal.c: genmarshal +gntmarshal.c: genmarshal gntmarshal.h cat genmarshal | glib-genmarshal --prefix=gnt_closure_marshal --body > $@ gntmarshal.h: genmarshal This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-12-11 00:34:00
|
Revision: 17952 http://svn.sourceforge.net/gaim/?rev=17952&view=rev Author: sadrul Date: 2006-12-10 16:33:57 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Fix the buddylist. Modified Paths: -------------- trunk/console/gntblist.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-12-10 23:33:03 UTC (rev 17951) +++ trunk/console/gntblist.c 2006-12-11 00:33:57 UTC (rev 17952) @@ -1368,7 +1368,8 @@ gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "move-down"); } else if (strcmp(text, "a") == 0) { gg_blist_place_tagged(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); - } + } else + return FALSE; } else return FALSE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2006-12-10 23:33:05
|
Revision: 17951 http://svn.sourceforge.net/gaim/?rev=17951&view=rev Author: boler Date: 2006-12-10 15:33:03 -0800 (Sun, 10 Dec 2006) Log Message: ----------- gg: Don't duplicate "Status: Offline" message. This got broken by recent changes to Notify User Info. Modified Paths: -------------- trunk/libgaim/protocols/gg/gg.c Modified: trunk/libgaim/protocols/gg/gg.c =================================================================== --- trunk/libgaim/protocols/gg/gg.c 2006-12-10 23:32:28 UTC (rev 17950) +++ trunk/libgaim/protocols/gg/gg.c 2006-12-10 23:33:03 UTC (rev 17951) @@ -1572,7 +1572,8 @@ gaim_notify_user_info_add_pair(user_info, _("Message"), text); } g_free(text); - } else { + /* We don't want to duplicate 'Status: Offline'. */ + } else if (GAIM_BUDDY_IS_ONLINE(b)) { gaim_notify_user_info_add_pair(user_info, _("Status"), name); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sea...@us...> - 2006-12-10 23:32:31
|
Revision: 17950 http://svn.sourceforge.net/gaim/?rev=17950&view=rev Author: seanegan Date: 2006-12-10 15:32:28 -0800 (Sun, 10 Dec 2006) Log Message: ----------- credit Modified Paths: -------------- trunk/COPYRIGHT Modified: trunk/COPYRIGHT =================================================================== --- trunk/COPYRIGHT 2006-12-10 23:08:45 UTC (rev 17949) +++ trunk/COPYRIGHT 2006-12-10 23:32:28 UTC (rev 17950) @@ -297,6 +297,7 @@ Sony Computer Entertainment America, Inc. Mark Spencer Lex Spoon +Chris Stafford Kevin Stange Richard Stellingwerff Charlie Stockman This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sea...@us...> - 2006-12-10 23:08:52
|
Revision: 17949 http://svn.sourceforge.net/gaim/?rev=17949&view=rev Author: seanegan Date: 2006-12-10 15:08:45 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Gmail notifications patch from Chris Stafford - The plugin will only do anything if it sees "google:mail:notify" in disco. - I decided to give Jabber a mail notification option for this, since the feature has traditionally meant "notify me of new mail if I happen to have a mail account that this server will notify me of" - I decided to show the first unread mail in a thread, rather than all unread messages[A - I made a google.c/google.h file to keep code for Google Talk extensions Modified Paths: -------------- trunk/gtk/gtknotify.c trunk/libgaim/protocols/jabber/Makefile.am trunk/libgaim/protocols/jabber/disco.c trunk/libgaim/protocols/jabber/iq.c trunk/libgaim/protocols/jabber/jabber.c trunk/libgaim/protocols/jabber/jabber.h Added Paths: ----------- trunk/libgaim/protocols/jabber/google.c trunk/libgaim/protocols/jabber/google.h Modified: trunk/gtk/gtknotify.c =================================================================== --- trunk/gtk/gtknotify.c 2006-12-10 22:01:22 UTC (rev 17948) +++ trunk/gtk/gtknotify.c 2006-12-10 23:08:45 UTC (rev 17949) @@ -313,9 +313,7 @@ GaimNotifyMailData *data = NULL; GtkWidget *dialog = NULL; GtkWidget *vbox = NULL; - GtkWidget *hbox; GtkWidget *label; - GtkWidget *img; char *detail_text; char *label_text; GtkTreeIter iter; @@ -357,27 +355,15 @@ gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BORDER); - /* Setup the main horizontal box */ - hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); - - /* Dialog icon */ - img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_INFO, - GTK_ICON_SIZE_DIALOG); - gtk_misc_set_alignment(GTK_MISC(img), 0, 0); - gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); - /* Vertical box */ - vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); + vbox = GTK_DIALOG(dialog)->vbox; - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); - if (mail_dialog == NULL && detailed) { GtkWidget *sw; /* Golden ratio it up! */ - gtk_widget_set_size_request(dialog, 475, 200); + gtk_widget_set_size_request(dialog, 550, 400); sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); Modified: trunk/libgaim/protocols/jabber/Makefile.am =================================================================== --- trunk/libgaim/protocols/jabber/Makefile.am 2006-12-10 22:01:22 UTC (rev 17948) +++ trunk/libgaim/protocols/jabber/Makefile.am 2006-12-10 23:08:45 UTC (rev 17949) @@ -13,6 +13,8 @@ chat.h \ disco.c \ disco.h \ + google.c \ + google.h \ iq.c \ iq.h \ jabber.c \ Modified: trunk/libgaim/protocols/jabber/disco.c =================================================================== --- trunk/libgaim/protocols/jabber/disco.c 2006-12-10 22:01:22 UTC (rev 17948) +++ trunk/libgaim/protocols/jabber/disco.c 2006-12-10 23:08:45 UTC (rev 17949) @@ -23,6 +23,7 @@ #include "prefs.h" #include "buddy.h" +#include "google.h" #include "iq.h" #include "disco.h" #include "jabber.h" @@ -250,6 +251,19 @@ if (!strcmp(name, "Google Talk")) js->googletalk = TRUE; } + + for (child = xmlnode_get_child(query, "feature"); child; + child = xmlnode_get_next_twin(child)) { + const char *var; + var = xmlnode_get_attrib(child, "var"); + if (!var) + continue; + + if (!strcmp("google:mail:notify", var)) { + js->server_caps |= JABBER_CAP_GMAIL_NOTIFY; + jabber_gmail_init(js); + } + } } static void Added: trunk/libgaim/protocols/jabber/google.c =================================================================== --- trunk/libgaim/protocols/jabber/google.c (rev 0) +++ trunk/libgaim/protocols/jabber/google.c 2006-12-10 23:08:45 UTC (rev 17949) @@ -0,0 +1,168 @@ + +/** + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * 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 "internal.h" +#include "debug.h" +#include "google.h" +#include "jabber.h" +#include "iq.h" + +static void +jabber_gmail_parse(JabberStream *js, xmlnode *packet, gpointer nul) +{ + const char *type = xmlnode_get_attrib(packet, "type"); + xmlnode *child; + xmlnode *message, *sender_node, *subject_node; + const char *from, *to, *subject, *url, *tid; + const char *in_str; + char *to_name; + int i, count = 1, returned_count; + + const char **tos, **froms, **subjects, **urls; + + if (strcmp(type, "result")) + return; + + child = xmlnode_get_child(packet, "mailbox"); + if (!child) + return; + + in_str = xmlnode_get_attrib(child, "total-matched"); + if (in_str && *in_str) + count = atoi(in_str); + + if (count == 0) + return; + + message = xmlnode_get_child(child, "mail-thread-info"); + + /* Loop once to see how many messages were returned so we can allocate arrays + * accordingly */ + if (!message) + return; + for (returned_count = 0; message; returned_count++, message=xmlnode_get_next_twin(message)); + + froms = g_new0(const char* , returned_count); + tos = g_new0(const char* , returned_count); + subjects = g_new0(const char* , returned_count); + urls = g_new0(const char* , returned_count); + + to = xmlnode_get_attrib(packet, "to"); + to_name = jabber_get_bare_jid(to); + url = xmlnode_get_attrib(child, "url"); + if (!url || !*url) + url = "http://www.gmail.com"; + + message= xmlnode_get_child(child, "mail-thread-info"); + for (i=0; message; message = xmlnode_get_next_twin(message), i++) { + subject_node = xmlnode_get_child(message, "subject"); + sender_node = xmlnode_get_child(message, "senders"); + sender_node = xmlnode_get_child(sender_node, "sender"); + + while (sender_node && (!xmlnode_get_attrib(sender_node, "unread") || + !strcmp(xmlnode_get_attrib(sender_node, "unread"),"0"))) + sender_node = xmlnode_get_next_twin(sender_node); + + if (!sender_node) { + i--; + continue; + } + + from = xmlnode_get_attrib(sender_node, "name"); + if (!from || !*from) + from = xmlnode_get_attrib(sender_node, "address"); + subject = xmlnode_get_data(subject_node); + /* + * url = xmlnode_get_attrib(message, "url"); + */ + tos[i] = (to_name != NULL ? to_name : ""); + froms[i] = (from != NULL ? from : ""); + subjects[i] = (subject != NULL ? subject : ""); + urls[i] = (url != NULL ? url : ""); + + tid = xmlnode_get_attrib(message, "tid"); + if (tid && + (js->gmail_last_tid == NULL || strcmp(tid, js->gmail_last_tid) > 0)) { + g_free(js->gmail_last_tid); + js->gmail_last_tid = g_strdup(tid); + } + } + + if (i>0) + gaim_notify_emails(js->gc, returned_count, TRUE, subjects, froms, tos, + urls, NULL, js->gc->account); + g_free(to_name); + g_free(tos); + g_free(froms); + g_free(subjects); + g_free(urls); + + in_str = xmlnode_get_attrib(child, "result-time"); + if (in_str && *in_str) { + g_free(js->gmail_last_time); + js->gmail_last_time = g_strdup(in_str); + } +} + +void +jabber_gmail_poke(JabberStream *js, xmlnode *packet) +{ + const char *type; + xmlnode *query; + JabberIq *iq; + + /* bail if the user isn't interested */ + if (!gaim_account_get_check_mail(js->gc->account)) + return; + + type = xmlnode_get_attrib(packet, "type"); + + + /* Is this an initial incoming mail notification? If so, send a request for more info */ + if (strcmp(type, "set") || !xmlnode_get_child(packet, "new-mail")) + return; + + gaim_debug(GAIM_DEBUG_MISC, "jabber", + "Got new mail notification. Sending request for more info\n"); + + iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify"); + jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); + query = xmlnode_get_child(iq->node, "query"); + + if (js->gmail_last_time) + xmlnode_set_attrib(query, "newer-than-time", js->gmail_last_time); + if (js->gmail_last_tid) + xmlnode_set_attrib(query, "newer-than-tid", js->gmail_last_tid); + + jabber_iq_send(iq); + return; +} + +void jabber_gmail_init(JabberStream *js) { + JabberIq *iq; + + if (!gaim_account_get_check_mail(js->gc->account)) + return; + + iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify"); + jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); + jabber_iq_send(iq); +} Property changes on: trunk/libgaim/protocols/jabber/google.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/libgaim/protocols/jabber/google.h =================================================================== --- trunk/libgaim/protocols/jabber/google.h (rev 0) +++ trunk/libgaim/protocols/jabber/google.h 2006-12-10 23:08:45 UTC (rev 17949) @@ -0,0 +1,32 @@ +/** + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * 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 + */ + +#ifndef _GAIM_GOOGLE_H_ +#define _GAIM_GOOGLE_H_ + +/* This is a place for Google Talk-specific XMPP extensions to live + * such that they don't intermingle with code for the XMPP RFCs and XEPs :) */ + +#include "jabber.h" + +void jabber_gmail_init(JabberStream *js); +void jabber_gmail_poke(JabberStream *js, xmlnode *node); + +#endif /* _GAIM_GOOGLE_H_ */ Property changes on: trunk/libgaim/protocols/jabber/google.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/libgaim/protocols/jabber/iq.c =================================================================== --- trunk/libgaim/protocols/jabber/iq.c 2006-12-10 22:01:22 UTC (rev 17948) +++ trunk/libgaim/protocols/jabber/iq.c 2006-12-10 23:08:45 UTC (rev 17949) @@ -25,6 +25,7 @@ #include "buddy.h" #include "disco.h" +#include "google.h" #include "iq.h" #include "oob.h" #include "roster.h" @@ -279,12 +280,16 @@ } } - if(xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si")) { jabber_si_parse(js, packet); return; } + if(xmlnode_get_child_with_namespace(packet, "new-mail", "google:mail:notify")) { + jabber_gmail_poke(js, packet); + return; + } + /* If we get here, send the default error reply mandated by XMPP-CORE */ if(type && (!strcmp(type, "set") || !strcmp(type, "get"))) { JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); Modified: trunk/libgaim/protocols/jabber/jabber.c =================================================================== --- trunk/libgaim/protocols/jabber/jabber.c 2006-12-10 22:01:22 UTC (rev 17948) +++ trunk/libgaim/protocols/jabber/jabber.c 2006-12-10 23:08:45 UTC (rev 17949) @@ -998,6 +998,8 @@ g_free(js->sasl_cb); #endif g_free(js->server_name); + g_free(js->gmail_last_time); + g_free(js->gmail_last_tid); g_free(js); gc->proto_data = NULL; @@ -1847,7 +1849,7 @@ static GaimPluginProtocolInfo prpl_info = { - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME, + OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_MAIL_CHECK, NULL, /* user_splits */ NULL, /* protocol_options */ {"png,gif,jpeg", 0, 0, 96, 96, GAIM_ICON_SCALE_SEND | GAIM_ICON_SCALE_DISPLAY}, /* icon_spec */ Modified: trunk/libgaim/protocols/jabber/jabber.h =================================================================== --- trunk/libgaim/protocols/jabber/jabber.h 2006-12-10 22:01:22 UTC (rev 17948) +++ trunk/libgaim/protocols/jabber/jabber.h 2006-12-10 23:08:45 UTC (rev 17949) @@ -50,6 +50,12 @@ JABBER_CAP_CHAT_STATES = 1 << 6, JABBER_CAP_IQ_SEARCH = 1 << 7, JABBER_CAP_IQ_REGISTER = 1 << 8, + + /* Google Talk extensions: + * http://code.google.com/apis/talk/jep_extensions/extensions.html + */ + JABBER_CAP_GMAIL_NOTIFY = 1 << 9, + JABBER_CAP_RETRIEVED = 1 << 31 } JabberCapabilities; @@ -120,8 +126,12 @@ gboolean reinit; + JabberCapabilities server_caps; gboolean googletalk; char *server_name; + + char *gmail_last_time; + char *gmail_last_tid; /* OK, this stays at the end of the struct, so plugins can depend * on the rest of the stuff being in the right place This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-12-10 22:01:28
|
Revision: 17948 http://svn.sourceforge.net/gaim/?rev=17948&view=rev Author: sadrul Date: 2006-12-10 14:01:22 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Unleak Modified Paths: -------------- trunk/gtk/gtkstatusbox.c Modified: trunk/gtk/gtkstatusbox.c =================================================================== --- trunk/gtk/gtkstatusbox.c 2006-12-10 14:45:27 UTC (rev 17947) +++ trunk/gtk/gtkstatusbox.c 2006-12-10 22:01:22 UTC (rev 17948) @@ -1301,8 +1301,8 @@ if (box->active_row) { GtkTreePath *path = gtk_tree_row_reference_get_path(box->active_row); GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (box->tree_view)); - gtk_tree_selection_unselect_all(sel); gtk_tree_selection_select_path(sel, path); + gtk_tree_path_free(path); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2006-12-10 14:47:26
|
Revision: 17947 http://svn.sourceforge.net/gaim/?rev=17947&view=rev Author: evands Date: 2006-12-10 06:45:27 -0800 (Sun, 10 Dec 2006) Log Message: ----------- If a message is being received in a group chat at a moment just after it has been left, gaim_conv_chat_incoming_msg() is still triggerred but find_oscar_chat_by_conn() returns NULL. We no longer crash in this situation. Modified Paths: -------------- trunk/libgaim/protocols/oscar/oscar.c Modified: trunk/libgaim/protocols/oscar/oscar.c =================================================================== --- trunk/libgaim/protocols/oscar/oscar.c 2006-12-10 11:26:17 UTC (rev 17946) +++ trunk/libgaim/protocols/oscar/oscar.c 2006-12-10 14:45:27 UTC (rev 17947) @@ -3078,6 +3078,9 @@ GaimConnection *gc = od->gc; struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn); + if (!ccon) + return 1; + va_start(ap, fr); roominfo = va_arg(ap, struct aim_chat_roominfo *); roomname = va_arg(ap, char *); @@ -3112,6 +3115,9 @@ char *msg; char *charset; + if (!ccon) + return 1; + va_start(ap, fr); info = va_arg(ap, aim_userinfo_t *); len = va_arg(ap, int); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-12-10 11:26:23
|
Revision: 17946 http://svn.sourceforge.net/gaim/?rev=17946&view=rev Author: sadrul Date: 2006-12-10 03:26:17 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Experimental search-as-you-type in GntTree. Press "/" to enter the search-mode, and when you're done, press escape to cancel. The search-mode remains active for 4 seconds before returning to normal. Someone should update the manual, and possibly enhance the behaviour. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/gnttree.h Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-12-10 09:38:02 UTC (rev 17945) +++ trunk/console/gntblist.c 2006-12-10 11:26:17 UTC (rev 17946) @@ -1362,11 +1362,13 @@ } else if (strcmp(text, GNT_KEY_CTRL_O) == 0) { gaim_prefs_set_bool(PREF_ROOT "/showoffline", !gaim_prefs_get_bool(PREF_ROOT "/showoffline")); - } else if (strcmp(text, "t") == 0) { - gg_blist_toggle_tag_buddy(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); - gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "move-down"); - } else if (strcmp(text, "a") == 0) { - gg_blist_place_tagged(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); + } else if (GNT_TREE(ggblist->tree)->search == NULL) { + if (strcmp(text, "t") == 0) { + gg_blist_toggle_tag_buddy(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); + gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "move-down"); + } else if (strcmp(text, "a") == 0) { + gg_blist_place_tagged(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); + } } else return FALSE; Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-12-10 09:38:02 UTC (rev 17945) +++ trunk/console/libgnt/gnttree.c 2006-12-10 11:26:17 UTC (rev 17946) @@ -6,6 +6,8 @@ #include <string.h> #include <ctype.h> +#define SEARCH_TIMEOUT 4000 /* 4 secs */ + enum { SIG_SELECTION_CHANGED, @@ -35,6 +37,7 @@ GntTreeRow *prev; GList *columns; + GntTree *tree; }; struct _GnTreeCol @@ -70,12 +73,32 @@ return _get_next(row->parent, FALSE); } +static gboolean +row_matches_search(GntTreeRow *row) +{ + GntTree *t = row->tree; + if (t->search && t->search->len > 0) { + char *one = g_utf8_casefold(((GntTreeCol*)row->columns->data)->text, -1); + char *two = g_utf8_casefold(t->search->str, -1); + char *z = strstr(one, two); + g_free(one); + g_free(two); + if (z == NULL) + return FALSE; + } + return TRUE; +} + static GntTreeRow * get_next(GntTreeRow *row) { if (row == NULL) return NULL; - return _get_next(row, !row->collapsed); + while ((row = _get_next(row, !row->collapsed)) != NULL) { + if (row_matches_search(row)) + break; + } + return row; } /* Returns the n-th next row. If it doesn't exist, returns NULL */ @@ -135,9 +158,15 @@ { if (row == NULL) return NULL; - if (row->prev) - return get_last_child(row->prev); - return row->parent; + while (row) { + if (row->prev) + row = get_last_child(row->prev); + else + row = row->parent; + if (!row || row_matches_search(row)) + break; + } + return row; } static GntTreeRow * @@ -332,6 +361,8 @@ else if (up >= widget->priv.height - pos) tree->top = get_prev_n(tree->current, rows); + if (tree->top && !row_matches_search(tree->top)) + tree->top = get_next(tree->top); row = tree->top; scrcol = widget->priv.width - 1 - 2 * pos; /* exclude the borders and the scrollbar */ for (i = start + pos; row && i < widget->priv.height - pos; @@ -343,6 +374,8 @@ GntTextFormatFlags flags = row->flags; int attr = 0; + if (!row_matches_search(row)) + continue; str = update_row_text(tree, row); if ((wr = gnt_util_onscreen_width(str, NULL)) > scrcol) @@ -574,18 +607,46 @@ return TRUE; } +static void +end_search(GntTree *tree) +{ + if (tree->search) { + g_source_remove(tree->search_timeout); + g_string_free(tree->search, TRUE); + tree->search = NULL; + tree->search_timeout = 0; + } +} + static gboolean +search_timeout(gpointer data) +{ + GntTree *tree = data; + + end_search(tree); + redraw_tree(tree); + + return FALSE; +} + +static gboolean gnt_tree_key_pressed(GntWidget *widget, const char *text) { GntTree *tree = GNT_TREE(widget); GntTreeRow *old = tree->current; - if (text[0] == '\r') - { + if (text[0] == '\r') { + end_search(tree); gnt_widget_activate(widget); - } - else if (text[0] == ' ' && text[1] == 0) - { + } else if (tree->search) { + if (isalnum(*text)) { + tree->search = g_string_append_c(tree->search, *text); + redraw_tree(tree); + g_source_remove(tree->search_timeout); + tree->search_timeout = g_timeout_add(SEARCH_TIMEOUT, search_timeout, tree); + } + return TRUE; + } else if (text[0] == ' ' && text[1] == 0) { /* Space pressed */ GntTreeRow *row = tree->current; if (row && row->child) @@ -616,6 +677,7 @@ GntTree *tree = GNT_TREE(widget); int i; + end_search(tree); g_hash_table_destroy(tree->hash); g_list_free(tree->list); @@ -684,6 +746,28 @@ tree->columns[tree->ncol - 1].width += widget->priv.width - n - 2 - 1 * tree->ncol; } +static gboolean +start_search(GntBindable *bindable, GList *list) +{ + GntTree *tree = GNT_TREE(bindable); + if (tree->search) + return FALSE; + tree->search = g_string_new(NULL); + tree->search_timeout = g_timeout_add(SEARCH_TIMEOUT, search_timeout, tree); + return TRUE; +} + +static gboolean +end_search_action(GntBindable *bindable, GList *list) +{ + GntTree *tree = GNT_TREE(bindable); + if (tree->search == NULL) + return FALSE; + end_search(tree); + redraw_tree(tree); + return TRUE; +} + static void gnt_tree_class_init(GntTreeClass *klass) { @@ -732,6 +816,10 @@ GNT_KEY_PGUP, NULL); gnt_bindable_class_register_action(bindable, "page-down", action_page_down, GNT_KEY_PGDOWN, NULL); + gnt_bindable_class_register_action(bindable, "start-search", start_search, + "/", NULL); + gnt_bindable_class_register_action(bindable, "end-search", end_search_action, + "\033", NULL); gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable); GNTDEBUG; @@ -956,6 +1044,7 @@ GntTreeRow *pr = NULL; g_hash_table_replace(tree->hash, key, row); + row->tree = tree; if (bigbro == NULL && tree->compare) { Modified: trunk/console/libgnt/gnttree.h =================================================================== --- trunk/console/libgnt/gnttree.h 2006-12-10 09:38:02 UTC (rev 17945) +++ trunk/console/libgnt/gnttree.h 2006-12-10 11:26:17 UTC (rev 17946) @@ -52,6 +52,9 @@ gboolean show_title; gboolean show_separator; /* Whether to show column separators */ + GString *search; + int search_timeout; + GCompareFunc compare; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-12-10 09:38:06
|
Revision: 17945 http://svn.sourceforge.net/gaim/?rev=17945&view=rev Author: sadrul Date: 2006-12-10 01:38:02 -0800 (Sun, 10 Dec 2006) Log Message: ----------- compile Modified Paths: -------------- trunk/console/libgnt/gntwidget.c Modified: trunk/console/libgnt/gntwidget.c =================================================================== --- trunk/console/libgnt/gntwidget.c 2006-12-10 09:26:44 UTC (rev 17944) +++ trunk/console/libgnt/gntwidget.c 2006-12-10 09:38:02 UTC (rev 17945) @@ -3,6 +3,7 @@ #include "gntwidget.h" #include "gntstyle.h" #include "gntmarshal.h" +#include "gntutils.h" #include "gnt.h" enum This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-12-10 09:26:59
|
Revision: 17944 http://svn.sourceforge.net/gaim/?rev=17944&view=rev Author: sadrul Date: 2006-12-10 01:26:44 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Generate the marshal-things during make when necessary. Allow specifying the hash-functions for a GntTree. Modified Paths: -------------- trunk/console/libgnt/Makefile.am trunk/console/libgnt/gnttree.c trunk/console/libgnt/gnttree.h trunk/console/libgnt/gntutils.c trunk/console/libgnt/gntutils.h Added Paths: ----------- trunk/console/libgnt/genmarshal Removed Paths: ------------- trunk/console/libgnt/gntmarshal.c trunk/console/libgnt/gntmarshal.h Modified: trunk/console/libgnt/Makefile.am =================================================================== --- trunk/console/libgnt/Makefile.am 2006-12-10 09:09:39 UTC (rev 17943) +++ trunk/console/libgnt/Makefile.am 2006-12-10 09:26:44 UTC (rev 17944) @@ -52,6 +52,16 @@ gntwm.h \ gnt.h +CLEANFILES = \ + gntmarshal.h \ + gntmarshal.c + +gntmarshal.c: genmarshal + cat genmarshal | glib-genmarshal --prefix=gnt_closure_marshal --body > $@ + +gntmarshal.h: genmarshal + cat genmarshal | glib-genmarshal --prefix=gnt_closure_marshal --header > $@ + libgnt_laincludedir=$(includedir)/gnt libgnt_lainclude_HEADERS = \ $(libgnt_la_headers) Added: trunk/console/libgnt/genmarshal =================================================================== --- trunk/console/libgnt/genmarshal (rev 0) +++ trunk/console/libgnt/genmarshal 2006-12-10 09:26:44 UTC (rev 17944) @@ -0,0 +1,10 @@ +BOOLEAN:VOID +BOOLEAN:STRING +VOID:INT,INT,INT,INT +VOID:INT,INT +VOID:POINTER,POINTER +BOOLEAN:INT,INT +BOOLEAN:INT,INT,INT +BOOLEAN:POINTER,POINTER,POINTER +BOOLEAN:INT,INT,INT,POINTER +VOID:STRING,STRING Property changes on: trunk/console/libgnt/genmarshal ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Deleted: trunk/console/libgnt/gntmarshal.c =================================================================== --- trunk/console/libgnt/gntmarshal.c 2006-12-10 09:09:39 UTC (rev 17943) +++ trunk/console/libgnt/gntmarshal.c 2006-12-10 09:26:44 UTC (rev 17944) @@ -1,427 +0,0 @@ - -#include <glib-object.h> - - -#ifdef G_ENABLE_DEBUG -#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) -#define g_marshal_value_peek_char(v) g_value_get_char (v) -#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) -#define g_marshal_value_peek_int(v) g_value_get_int (v) -#define g_marshal_value_peek_uint(v) g_value_get_uint (v) -#define g_marshal_value_peek_long(v) g_value_get_long (v) -#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) -#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) -#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) -#define g_marshal_value_peek_enum(v) g_value_get_enum (v) -#define g_marshal_value_peek_flags(v) g_value_get_flags (v) -#define g_marshal_value_peek_float(v) g_value_get_float (v) -#define g_marshal_value_peek_double(v) g_value_get_double (v) -#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) -#define g_marshal_value_peek_param(v) g_value_get_param (v) -#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) -#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) -#define g_marshal_value_peek_object(v) g_value_get_object (v) -#else /* !G_ENABLE_DEBUG */ -/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. - * Do not access GValues directly in your code. Instead, use the - * g_value_get_*() functions - */ -#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int -#define g_marshal_value_peek_char(v) (v)->data[0].v_int -#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint -#define g_marshal_value_peek_int(v) (v)->data[0].v_int -#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint -#define g_marshal_value_peek_long(v) (v)->data[0].v_long -#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 -#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 -#define g_marshal_value_peek_enum(v) (v)->data[0].v_long -#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_float(v) (v)->data[0].v_float -#define g_marshal_value_peek_double(v) (v)->data[0].v_double -#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer -#endif /* !G_ENABLE_DEBUG */ - - -/* BOOLEAN:VOID (/dev/stdin:1) */ -void -gnt_closure_marshal_BOOLEAN__VOID (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__VOID) (gpointer data1, - gpointer data2); - register GMarshalFunc_BOOLEAN__VOID callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 1); - - 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 = (GMarshalFunc_BOOLEAN__VOID) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - data2); - - g_value_set_boolean (return_value, v_return); -} - -/* BOOLEAN:STRING (/dev/stdin:2) */ -void -gnt_closure_marshal_BOOLEAN__STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__STRING) (gpointer data1, - gpointer arg_1, - gpointer data2); - register GMarshalFunc_BOOLEAN__STRING callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_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 = (GMarshalFunc_BOOLEAN__STRING) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_string (param_values + 1), - data2); - - g_value_set_boolean (return_value, v_return); -} - -/* VOID:INT,INT,INT,INT (/dev/stdin:3) */ -void -gnt_closure_marshal_VOID__INT_INT_INT_INT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__INT_INT_INT_INT) (gpointer data1, - gint arg_1, - gint arg_2, - gint arg_3, - gint arg_4, - gpointer data2); - register GMarshalFunc_VOID__INT_INT_INT_INT 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 = (GMarshalFunc_VOID__INT_INT_INT_INT) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_int (param_values + 1), - g_marshal_value_peek_int (param_values + 2), - g_marshal_value_peek_int (param_values + 3), - g_marshal_value_peek_int (param_values + 4), - data2); -} - -/* VOID:INT,INT (/dev/stdin:4) */ -void -gnt_closure_marshal_VOID__INT_INT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__INT_INT) (gpointer data1, - gint arg_1, - gint arg_2, - gpointer data2); - register GMarshalFunc_VOID__INT_INT 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 = (GMarshalFunc_VOID__INT_INT) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_int (param_values + 1), - g_marshal_value_peek_int (param_values + 2), - data2); -} - -/* VOID:POINTER,POINTER (/dev/stdin:5) */ -void -gnt_closure_marshal_VOID__POINTER_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__POINTER_POINTER) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer data2); - register GMarshalFunc_VOID__POINTER_POINTER 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 = (GMarshalFunc_VOID__POINTER_POINTER) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_pointer (param_values + 1), - g_marshal_value_peek_pointer (param_values + 2), - data2); -} - -/* BOOLEAN:INT,INT (/dev/stdin:6) */ -void -gnt_closure_marshal_BOOLEAN__INT_INT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__INT_INT) (gpointer data1, - gint arg_1, - gint arg_2, - gpointer data2); - register GMarshalFunc_BOOLEAN__INT_INT callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - 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 = (GMarshalFunc_BOOLEAN__INT_INT) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_int (param_values + 1), - g_marshal_value_peek_int (param_values + 2), - data2); - - g_value_set_boolean (return_value, v_return); -} - -/* BOOLEAN:INT,INT,INT (/dev/stdin:7) */ -void -gnt_closure_marshal_BOOLEAN__INT_INT_INT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__INT_INT_INT) (gpointer data1, - gint arg_1, - gint arg_2, - gint arg_3, - gpointer data2); - register GMarshalFunc_BOOLEAN__INT_INT_INT callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 4); - - 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 = (GMarshalFunc_BOOLEAN__INT_INT_INT) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_int (param_values + 1), - g_marshal_value_peek_int (param_values + 2), - g_marshal_value_peek_int (param_values + 3), - data2); - - g_value_set_boolean (return_value, v_return); -} - -/* BOOLEAN:POINTER,POINTER,POINTER (/dev/stdin:8) */ -void -gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER_POINTER_POINTER) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer arg_3, - gpointer data2); - register GMarshalFunc_BOOLEAN__POINTER_POINTER_POINTER callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 4); - - 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 = (GMarshalFunc_BOOLEAN__POINTER_POINTER_POINTER) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_pointer (param_values + 1), - g_marshal_value_peek_pointer (param_values + 2), - g_marshal_value_peek_pointer (param_values + 3), - data2); - - g_value_set_boolean (return_value, v_return); -} - -/* BOOLEAN:INT,INT,INT,POINTER (/dev/stdin:9) */ -void -gnt_closure_marshal_BOOLEAN__INT_INT_INT_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__INT_INT_INT_POINTER) (gpointer data1, - gint arg_1, - gint arg_2, - gint arg_3, - gpointer arg_4, - gpointer data2); - register GMarshalFunc_BOOLEAN__INT_INT_INT_POINTER callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - 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 = (GMarshalFunc_BOOLEAN__INT_INT_INT_POINTER) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_int (param_values + 1), - g_marshal_value_peek_int (param_values + 2), - g_marshal_value_peek_int (param_values + 3), - g_marshal_value_peek_pointer (param_values + 4), - data2); - - g_value_set_boolean (return_value, v_return); -} - -gboolean gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, - GValue *return_accu, - const GValue *handler_return, - gpointer dummy) -{ - gboolean continue_emission; - gboolean signal_handled; - - signal_handled = g_value_get_boolean (handler_return); - g_value_set_boolean (return_accu, signal_handled); - continue_emission = !signal_handled; - - return continue_emission; -} - Deleted: trunk/console/libgnt/gntmarshal.h =================================================================== --- trunk/console/libgnt/gntmarshal.h 2006-12-10 09:09:39 UTC (rev 17943) +++ trunk/console/libgnt/gntmarshal.h 2006-12-10 09:26:44 UTC (rev 17944) @@ -1,91 +0,0 @@ - -#ifndef __gnt_closure_marshal_MARSHAL_H__ -#define __gnt_closure_marshal_MARSHAL_H__ - -#include <glib-object.h> - -G_BEGIN_DECLS - -/* BOOLEAN:VOID (/dev/stdin:1) */ -extern void gnt_closure_marshal_BOOLEAN__VOID (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* BOOLEAN:STRING (/dev/stdin:2) */ -extern void gnt_closure_marshal_BOOLEAN__STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:INT,INT,INT,INT (/dev/stdin:3) */ -extern void gnt_closure_marshal_VOID__INT_INT_INT_INT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:INT,INT (/dev/stdin:4) */ -extern void gnt_closure_marshal_VOID__INT_INT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:POINTER,POINTER (/dev/stdin:5) */ -extern void gnt_closure_marshal_VOID__POINTER_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* BOOLEAN:INT,INT (/dev/stdin:6) */ -extern void gnt_closure_marshal_BOOLEAN__INT_INT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* BOOLEAN:INT,INT,INT (/dev/stdin:7) */ -extern void gnt_closure_marshal_BOOLEAN__INT_INT_INT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* BOOLEAN:POINTER,POINTER,POINTER (/dev/stdin:8) */ -extern void gnt_closure_marshal_BOOLEAN__POINTER_POINTER_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* BOOLEAN:INT,INT,INT,POINTER (/dev/stdin:9) */ -extern void gnt_closure_marshal_BOOLEAN__INT_INT_INT_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -G_END_DECLS - -#endif /* __gnt_closure_marshal_MARSHAL_H__ */ - -gboolean gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, - GValue *return_accu, - const GValue *handler_return, - gpointer dummy); - - - Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-12-10 09:09:39 UTC (rev 17943) +++ trunk/console/libgnt/gnttree.c 2006-12-10 09:26:44 UTC (rev 17944) @@ -1005,6 +1005,8 @@ GntTreeRow *r = tree->root; row->next = r; if (r) r->prev = row; + if (tree->current == tree->root) + tree->current = row; tree->root = row; tree->list = g_list_prepend(tree->list, key); } @@ -1146,7 +1148,7 @@ void gnt_tree_remove_all(GntTree *tree) { tree->root = NULL; - g_hash_table_foreach_remove(tree->hash, (GHRFunc)return_true, NULL); + g_hash_table_foreach_remove(tree->hash, (GHRFunc)return_true, tree); g_list_free(tree->list); tree->list = NULL; tree->current = tree->top = tree->bottom = NULL; @@ -1394,3 +1396,10 @@ gnt_widget_set_size(GNT_WIDGET(tree), twidth, height); } +void gnt_tree_set_hash_fns(GntTree *tree, gpointer hash, gpointer eq, gpointer kd) +{ + g_hash_table_foreach_remove(tree->hash, return_true, NULL); + g_hash_table_destroy(tree->hash); + tree->hash = g_hash_table_new_full(hash, eq, kd, free_tree_row); +} + Modified: trunk/console/libgnt/gnttree.h =================================================================== --- trunk/console/libgnt/gnttree.h 2006-12-10 09:09:39 UTC (rev 17943) +++ trunk/console/libgnt/gnttree.h 2006-12-10 09:26:44 UTC (rev 17944) @@ -38,6 +38,10 @@ GList *list; /* List of GntTreeRow s */ GHashTable *hash; /* We need this for quickly referencing the rows */ + guint (*hash_func)(gconstpointer); + gboolean (*hash_eq_func)(gconstpointer, gconstpointer); + GDestroyNotify key_destroy; + GDestroyNotify value_destroy; int ncol; /* No. of columns */ struct _GntTreeColInfo @@ -131,6 +135,8 @@ /* This will try to automatically adjust the width of the columns in the tree */ void gnt_tree_adjust_columns(GntTree *tree); +void gnt_tree_set_hash_fns(GntTree *tree, gpointer hash, gpointer eq, gpointer kd); + G_END_DECLS /* The following functions should NOT be used by applications. */ Modified: trunk/console/libgnt/gntutils.c =================================================================== --- trunk/console/libgnt/gntutils.c 2006-12-10 09:09:39 UTC (rev 17943) +++ trunk/console/libgnt/gntutils.c 2006-12-10 09:26:44 UTC (rev 17944) @@ -119,3 +119,18 @@ return dest; } +gboolean gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, + GValue *return_accu, + const GValue *handler_return, + gpointer dummy) +{ + gboolean continue_emission; + gboolean signal_handled; + + signal_handled = g_value_get_boolean (handler_return); + g_value_set_boolean (return_accu, signal_handled); + continue_emission = !signal_handled; + + return continue_emission; +} + Modified: trunk/console/libgnt/gntutils.h =================================================================== --- trunk/console/libgnt/gntutils.h 2006-12-10 09:09:39 UTC (rev 17943) +++ trunk/console/libgnt/gntutils.h 2006-12-10 09:26:44 UTC (rev 17944) @@ -20,3 +20,14 @@ GHashTable *g_hash_table_duplicate(GHashTable *src, GHashFunc hash, GEqualFunc equal, GDestroyNotify key_d, GDestroyNotify value_d); + + +/** + * To be used with g_signal_new. Look in the key_pressed signal-definition in + * gntwidget.c for usage. + */ +gboolean gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, + GValue *return_accu, + const GValue *handler_return, + gpointer dummy); + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-12-10 09:10:03
|
Revision: 17943 http://svn.sourceforge.net/gaim/?rev=17943&view=rev Author: thekingant Date: 2006-12-10 01:09:39 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Get rid of two minor compile warnings Modified Paths: -------------- trunk/console/libgnt/gntwm.c Modified: trunk/console/libgnt/gntwm.c =================================================================== --- trunk/console/libgnt/gntwm.c 2006-12-10 09:05:40 UTC (rev 17942) +++ trunk/console/libgnt/gntwm.c 2006-12-10 09:09:39 UTC (rev 17943) @@ -191,7 +191,7 @@ char *filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL); GError *error = NULL; char **keys; - int nk; + gsize nk; if (!g_key_file_load_from_file(gfile, filename, G_KEY_FILE_NONE, &error)) { g_printerr("GntWM: %s\n", error->message); @@ -208,7 +208,7 @@ } else { while (nk--) { char *title = keys[nk]; - int l; + gsize l; char **coords = g_key_file_get_string_list(gfile, "positions", title, &l, NULL); if (l == 2) { int x = atoi(coords[0]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-12-10 09:05:41
|
Revision: 17942 http://svn.sourceforge.net/gaim/?rev=17942&view=rev Author: thekingant Date: 2006-12-10 01:05:40 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Update SILC to use Evan's snazzy new notify_user_info stuff This isn't as well tested as it should be. Modified Paths: -------------- trunk/libgaim/protocols/silc/ops.c trunk/libgaim/protocols/silc/silc.c Modified: trunk/libgaim/protocols/silc/ops.c =================================================================== --- trunk/libgaim/protocols/silc/ops.c 2006-12-10 09:02:48 UTC (rev 17941) +++ trunk/libgaim/protocols/silc/ops.c 2006-12-10 09:05:40 UTC (rev 17942) @@ -1151,9 +1151,9 @@ SilcUInt32 idle, mode; SilcBuffer channels, user_modes; SilcClientEntry client_entry; - char *buf, tmp[1024], *tmp2; + char tmp[1024], *tmp2; char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - GString *s; + GaimNotifyUserInfo *user_info; if (!success) { gaim_notify_error(gc, _("User Information"), @@ -1174,72 +1174,74 @@ (void)va_arg(vp, unsigned char *); user_modes = va_arg(vp, SilcBuffer); - s = g_string_new(""); + user_info = gaim_notify_user_info_new(); tmp2 = g_markup_escape_text(client_entry->nickname, -1); - g_string_append_printf(s, "<b>%s:</b> %s", _("Nickname"), tmp2); + gaim_notify_user_info_add_pair(user_info, _("Nickname"), tmp2); g_free(tmp2); if (client_entry->realname) { tmp2 = g_markup_escape_text(client_entry->realname, -1); - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Real Name"), tmp2); + gaim_notify_user_info_add_pair(user_info, _("Real Name"), tmp2); g_free(tmp2); } if (client_entry->username) { tmp2 = g_markup_escape_text(client_entry->username, -1); - if (client_entry->hostname) - g_string_append_printf(s, "<br><b>%s:</b> %s@%s", _("Username"), tmp2, client_entry->hostname); - else - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Username"), tmp2); + if (client_entry->hostname) { + gchar *tmp3; + tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname); + gaim_notify_user_info_add_pair(user_info, _("Username"), tmp3); + g_free(tmp3); + } else + gaim_notify_user_info_add_pair(user_info, _("Username"), tmp2); g_free(tmp2); } if (client_entry->mode) { - g_string_append_printf(s, "<br><b>%s:</b> ", _("User Modes")); memset(tmp, 0, sizeof(tmp)); silcgaim_get_umode_string(client_entry->mode, tmp, sizeof(tmp) - strlen(tmp)); - g_string_append_printf(s, "%s", tmp); + gaim_notify_user_info_add_pair(user_info, _("User Modes"), tmp); } silcgaim_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); if (moodstr) { - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Mood"), moodstr); + gaim_notify_user_info_add_pair(user_info, _("Mood"), moodstr); g_free(moodstr); } if (statusstr) { tmp2 = g_markup_escape_text(statusstr, -1); - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Status Text"), tmp2); + gaim_notify_user_info_add_pair(user_info, _("Status Text"), tmp2); g_free(statusstr); g_free(tmp2); } if (contactstr) { - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Preferred Contact"), contactstr); + gaim_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); g_free(contactstr); } if (langstr) { - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Preferred Language"), langstr); + gaim_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); g_free(langstr); } if (devicestr) { - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Device"), devicestr); + gaim_notify_user_info_add_pair(user_info, _("Device"), devicestr); g_free(devicestr); } if (tzstr) { - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Timezone"), tzstr); + gaim_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); g_free(tzstr); } if (geostr) { - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Geolocation"), geostr); + gaim_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); g_free(geostr); } if (client_entry->server) - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Server"), client_entry->server); + gaim_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); if (channels && user_modes) { SilcUInt32 *umodes; @@ -1252,7 +1254,6 @@ SilcChannelPayload entry; int i = 0; - g_string_append_printf(s, "<br><b>%s:</b> ", _("Currently on")); memset(tmp, 0, sizeof(tmp)); silc_dlist_start(list); while ((entry = silc_dlist_get(list)) @@ -1268,7 +1269,7 @@ } tmp2 = g_markup_escape_text(tmp, -1); - g_string_append_printf(s, "%s", tmp2); + gaim_notify_user_info_add_pair(user_info, _("Currently on"), tmp2); g_free(tmp2); silc_free(umodes); } @@ -1281,14 +1282,13 @@ pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - g_string_append_printf(s, "<br><b>%s:</b><br>%s", _("Public Key Fingerprint"), fingerprint); - g_string_append_printf(s, "<br><b>%s:</b><br>%s", _("Public Key Babbleprint"), babbleprint); + gaim_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); + gaim_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); silc_free(fingerprint); silc_free(babbleprint); silc_free(pk); } - buf = g_string_free(s, FALSE); #if 0 /* XXX for now, let's not show attrs here */ if (client_entry->attrs) gaim_request_action(gc, _("User Information"), @@ -1298,16 +1298,16 @@ _("_More..."), G_CALLBACK(silcgaim_whois_more)); else #endif - gaim_notify_userinfo(gc, client_entry->nickname, buf, NULL, NULL); - g_free(buf); + gaim_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL); + gaim_notify_user_info_destroy(user_info); } break; case SILC_COMMAND_WHOWAS: { SilcClientEntry client_entry; - char *buf, *nickname, *realname, *username, *tmp; - GString *s; + char *nickname, *realname, *username, *tmp; + GaimNotifyUserInfo *user_info; if (!success) { gaim_notify_error(gc, _("User Information"), @@ -1323,25 +1323,28 @@ if (!nickname) break; - s = g_string_new(""); + user_info = gaim_notify_user_info_new(); tmp = g_markup_escape_text(nickname, -1); - g_string_append_printf(s, "<b>%s:</b> %s", _("Nickname"), tmp); + gaim_notify_user_info_add_pair(user_info, _("Nickname"), tmp); g_free(tmp); if (realname) { tmp = g_markup_escape_text(realname, -1); - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Real Name"), tmp); + gaim_notify_user_info_add_pair(user_info, _("Real Name"), tmp); g_free(tmp); } if (username) { tmp = g_markup_escape_text(username, -1); - if (client_entry && client_entry->hostname) - g_string_append_printf(s, "<br><b>%s:</b> %s@%s", _("Username"), tmp, client_entry->hostname); - else - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Username"), tmp); + if (client_entry && client_entry->hostname) { + gchar *tmp3; + tmp3 = g_strdup_printf("%s@%s", tmp, client_entry->hostname); + gaim_notify_user_info_add_pair(user_info, _("Username"), tmp3); + g_free(tmp3); + } else + gaim_notify_user_info_add_pair(user_info, _("Username"), tmp); g_free(tmp); } if (client_entry && client_entry->server) - g_string_append_printf(s, "<br><b>%s:</b> %s", _("Server"), client_entry->server); + gaim_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); if (client_entry && client_entry->public_key) { @@ -1351,16 +1354,15 @@ pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - g_string_append_printf(s, "<br><b>%s:</b><br>%s", _("Public Key Fingerprint"), fingerprint); - g_string_append_printf(s, "<br><b>%s:</b><br>%s", _("Public Key Babbleprint"), babbleprint); + gaim_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); + gaim_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); silc_free(fingerprint); silc_free(babbleprint); silc_free(pk); } - buf = g_string_free(s, FALSE); - gaim_notify_userinfo(gc, nickname, buf, NULL, NULL); - g_free(buf); + gaim_notify_userinfo(gc, nickname, user_info, NULL, NULL); + gaim_notify_user_info_destroy(user_info); } break; Modified: trunk/libgaim/protocols/silc/silc.c =================================================================== --- trunk/libgaim/protocols/silc/silc.c 2006-12-10 09:02:48 UTC (rev 17941) +++ trunk/libgaim/protocols/silc/silc.c 2006-12-10 09:05:40 UTC (rev 17942) @@ -1798,7 +1798,8 @@ silcgaim_ftp_new_xfer, /* new_xfer */ NULL, /* offline_message */ &silcgaim_wb_ops, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ + NULL, /* send_raw */ + NULL, /* roomlist_room_serialize */ }; static GaimPluginInfo info = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-12-10 09:02:49
|
Revision: 17940 http://svn.sourceforge.net/gaim/?rev=17940&view=rev Author: sadrul Date: 2006-12-10 01:02:47 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Make the per-account statusboxes work. Modified Paths: -------------- trunk/gtk/gtkstatusbox.c Modified: trunk/gtk/gtkstatusbox.c =================================================================== --- trunk/gtk/gtkstatusbox.c 2006-12-10 08:29:03 UTC (rev 17939) +++ trunk/gtk/gtkstatusbox.c 2006-12-10 09:02:47 UTC (rev 17940) @@ -764,8 +764,7 @@ path = gtk_tree_model_get_path(GTK_TREE_MODEL(status_box->dropdown_store), &iter); break; } - } - while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter)); + } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter)); } } @@ -2154,7 +2153,7 @@ status = gaim_account_get_active_status(status_box->account); - g_object_get(G_OBJECT(status_box), "active", &active, NULL); + active = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(status_box), "active")); status_type = find_status_type_by_index(status_box->account, active); id = gaim_status_type_get_id(status_type); @@ -2250,11 +2249,14 @@ GtkGaimStatusBoxItemType type; gpointer data; GList *accounts = NULL, *node; + int active; if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path)) return; + active = gtk_tree_path_get_indices(path)[0]; gtk_tree_path_free(path); + g_object_set_data(G_OBJECT(status_box), "active", GINT_TO_POINTER(active)); gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, TYPE_COLUMN, &type, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-12-10 09:02:49
|
Revision: 17941 http://svn.sourceforge.net/gaim/?rev=17941&view=rev Author: thekingant Date: 2006-12-10 01:02:48 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Update Bonjour to use Evan's snazzy new notify_user_info stuff Modified Paths: -------------- trunk/libgaim/protocols/bonjour/bonjour.c Modified: trunk/libgaim/protocols/bonjour/bonjour.c =================================================================== --- trunk/libgaim/protocols/bonjour/bonjour.c 2006-12-10 09:02:47 UTC (rev 17940) +++ trunk/libgaim/protocols/bonjour/bonjour.c 2006-12-10 09:02:48 UTC (rev 17941) @@ -316,7 +316,7 @@ } static void -bonjour_tooltip_text(GaimBuddy *buddy, GString *str, gboolean full) +bonjour_tooltip_text(GaimBuddy *buddy, GaimNotifyUserInfo *user_info, gboolean full) { GaimPresence *presence; GaimStatus *status; @@ -334,9 +334,9 @@ else status_description = gaim_status_get_name(status); - g_string_append_printf(str, _("\n<b>Status:</b> %s"), status_description); + gaim_notify_user_info_add_pair(user_info, _("Status"), status_description); if (message != NULL) - g_string_append_printf(str, _("\n<b>Message:</b> %s"), message); + gaim_notify_user_info_add_pair(user_info, _("Message"), message); } static gboolean @@ -414,7 +414,8 @@ NULL, /* new_xfer */ NULL, /* offline_message */ NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ + NULL, /* send_raw */ + NULL, /* roomlist_room_serialize */ }; static GaimPluginInfo info = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-12-10 08:29:09
|
Revision: 17939 http://svn.sourceforge.net/gaim/?rev=17939&view=rev Author: thekingant Date: 2006-12-10 00:29:03 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Compile warning fixes Modified Paths: -------------- trunk/libgaim/notify.h trunk/libgaim/protocols/irc/msgs.c trunk/libgaim/protocols/jabber/chat.c trunk/libgaim/protocols/yahoo/yahoo_profile.c Modified: trunk/libgaim/notify.h =================================================================== --- trunk/libgaim/notify.h 2006-12-10 08:18:49 UTC (rev 17938) +++ trunk/libgaim/notify.h 2006-12-10 08:29:03 UTC (rev 17939) @@ -432,7 +432,7 @@ * * @return A new GaimNotifyUserInfo, which the caller must destroy when done */ -GaimNotifyUserInfo *gaim_notify_user_info_new(); +GaimNotifyUserInfo *gaim_notify_user_info_new(void); /** * Destroy a GaimNotifyUserInfo Modified: trunk/libgaim/protocols/irc/msgs.c =================================================================== --- trunk/libgaim/protocols/irc/msgs.c 2006-12-10 08:18:49 UTC (rev 17938) +++ trunk/libgaim/protocols/irc/msgs.c 2006-12-10 08:29:03 UTC (rev 17939) @@ -198,8 +198,7 @@ void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args) { GaimConnection *gc; - GString *info; - char *str, *tmp, *tmp2; + char *tmp, *tmp2; GaimNotifyUserInfo *user_info; if (!irc->whois.nick) { Modified: trunk/libgaim/protocols/jabber/chat.c =================================================================== --- trunk/libgaim/protocols/jabber/chat.c 2006-12-10 08:18:49 UTC (rev 17938) +++ trunk/libgaim/protocols/jabber/chat.c 2006-12-10 08:29:03 UTC (rev 17939) @@ -954,7 +954,7 @@ static void jabber_chat_disco_traffic_cb(JabberStream *js, xmlnode *packet, gpointer data) { JabberChat *chat; - xmlnode *query, *x; + xmlnode *query; int id = GPOINTER_TO_INT(data); if(!(chat = jabber_chat_find_by_id(js, id))) Modified: trunk/libgaim/protocols/yahoo/yahoo_profile.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_profile.c 2006-12-10 08:18:49 UTC (rev 17938) +++ trunk/libgaim/protocols/yahoo/yahoo_profile.c 2006-12-10 08:29:03 UTC (rev 17939) @@ -743,7 +743,6 @@ YahooGetInfoData *info_data = (YahooGetInfoData *)user_data; GaimNotifyUserInfo *user_info; char *p; - char buf[1024]; #if PHOTO_SUPPORT YahooGetInfoStepTwoData *info2_data; char *photo_url_text = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-12-10 08:18:52
|
Revision: 17938 http://svn.sourceforge.net/gaim/?rev=17938&view=rev Author: sadrul Date: 2006-12-10 00:18:49 -0800 (Sun, 10 Dec 2006) Log Message: ----------- gaim, gaim-text and libgnt fails to compile if you configure with --with-static-prpl=something. This makes them compile in such cases. Modified Paths: -------------- trunk/console/Makefile.am trunk/console/libgnt/Makefile.am trunk/gtk/Makefile.am Modified: trunk/console/Makefile.am =================================================================== --- trunk/console/Makefile.am 2006-12-10 05:55:02 UTC (rev 17937) +++ trunk/console/Makefile.am 2006-12-10 08:18:49 UTC (rev 17938) @@ -36,12 +36,11 @@ gaim_textinclude_HEADERS = \ $(gaim_text_headers) -gaim_text_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) +gaim_text_DEPENDENCIES = @LIBOBJS@ gaim_text_LDFLAGS = -export-dynamic gaim_text_LDADD = \ @LIBOBJS@ \ $(DBUS_LIBS) \ - $(STATIC_LINK_LIBS) \ $(INTLLIBS) \ $(GLIB_LIBS) \ $(LIBXML_LIBS) \ Modified: trunk/console/libgnt/Makefile.am =================================================================== --- trunk/console/libgnt/Makefile.am 2006-12-10 05:55:02 UTC (rev 17937) +++ trunk/console/libgnt/Makefile.am 2006-12-10 08:18:49 UTC (rev 17938) @@ -56,11 +56,10 @@ libgnt_lainclude_HEADERS = \ $(libgnt_la_headers) -libgnt_la_DEPENDENCIES = $(STATIC_LINK_LIBS) +libgnt_la_DEPENDENCIES = libgnt_la_LDFLAGS = -export-dynamic libgnt_la_LIBADD = \ $(GLIB_LIBS) \ - $(STATIC_LINK_LIBS) \ $(GNT_LIBS) AM_CPPFLAGS = \ Modified: trunk/gtk/Makefile.am =================================================================== --- trunk/gtk/Makefile.am 2006-12-10 05:55:02 UTC (rev 17937) +++ trunk/gtk/Makefile.am 2006-12-10 08:18:49 UTC (rev 17938) @@ -159,13 +159,12 @@ $(gaim_headers) -gaim_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) +gaim_DEPENDENCIES = @LIBOBJS@ gaim_LDFLAGS = -export-dynamic gaim_LDADD = \ @LIBOBJS@ \ $(DBUS_LIBS) \ $(GSTREAMER_LIBS) \ - $(STATIC_LINK_LIBS) \ $(XSS_LIBS) \ $(SM_LIBS) \ $(INTLLIBS) \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2006-12-10 05:55:09
|
Revision: 17937 http://svn.sourceforge.net/gaim/?rev=17937&view=rev Author: evands Date: 2006-12-09 21:55:02 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Pass the password for the account, if one has been specified, to gaim_connection_new() when doing an account registration request. This allows autofilling of the password field if a subsequent dialogue is displayed (as with Jabber). Modified Paths: -------------- trunk/libgaim/account.c Modified: trunk/libgaim/account.c =================================================================== --- trunk/libgaim/account.c 2006-12-10 05:33:44 UTC (rev 17936) +++ trunk/libgaim/account.c 2006-12-10 05:55:02 UTC (rev 17937) @@ -898,7 +898,7 @@ gaim_debug_info("account", "Registering account %s\n", gaim_account_get_username(account)); - gaim_connection_new(account, TRUE, NULL); + gaim_connection_new(account, TRUE, gaim_account_get_password(account)); } static void This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2006-12-10 05:33:44
|
Revision: 17936 http://svn.sourceforge.net/gaim/?rev=17936&view=rev Author: evands Date: 2006-12-09 21:33:44 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Added buddy-got-login-time signal which is emitted when the login time for a buddy is known Modified Paths: -------------- trunk/ChangeLog.API trunk/libgaim/blist.c trunk/libgaim/prpl.c Modified: trunk/ChangeLog.API =================================================================== --- trunk/ChangeLog.API 2006-12-10 05:06:01 UTC (rev 17935) +++ trunk/ChangeLog.API 2006-12-10 05:33:44 UTC (rev 17936) @@ -397,6 +397,7 @@ * "buddy-status-changed" * "buddy-idle-changed": A buddy's idle status changed. * "buddy-icon-changed" + * "buddy-got-login-time": The login time for a buddy is now known * "displaying-userinfo" * "gtkblist-hiding" * "gtkblist-unhiding" Modified: trunk/libgaim/blist.c =================================================================== --- trunk/libgaim/blist.c 2006-12-10 05:06:01 UTC (rev 17935) +++ trunk/libgaim/blist.c 2006-12-10 05:33:44 UTC (rev 17936) @@ -2706,6 +2706,11 @@ gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_BLIST_BUDDY)); + gaim_signal_register(handle, "buddy-got-login-time", + gaim_marshal_VOID__POINTER, NULL, 1, + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_BLIST_BUDDY)); + gaim_signal_register(handle, "buddy-added", gaim_marshal_VOID__POINTER, NULL, 1, gaim_value_new(GAIM_TYPE_SUBTYPE, Modified: trunk/libgaim/prpl.c =================================================================== --- trunk/libgaim/prpl.c 2006-12-10 05:06:01 UTC (rev 17935) +++ trunk/libgaim/prpl.c 2006-12-10 05:33:44 UTC (rev 17936) @@ -117,6 +117,8 @@ presence = gaim_buddy_get_presence(buddy); gaim_presence_set_login_time(presence, login_time); + + gaim_signal_emit(gaim_blist_get_handle(), "buddy-got-login-time", buddy); } void This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2006-12-10 05:06:11
|
Revision: 17935 http://svn.sourceforge.net/gaim/?rev=17935&view=rev Author: evands Date: 2006-12-09 21:06:01 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Improved handling of GaimNotifyUserInfoEntry types; an enum now specifies them. Fixed gaim_notify_user_info_get_text() not to have newlines before and after the horizontal line for section breaks. Modified Paths: -------------- trunk/libgaim/notify.c trunk/libgaim/notify.h Modified: trunk/libgaim/notify.c =================================================================== --- trunk/libgaim/notify.c 2006-12-10 03:44:35 UTC (rev 17934) +++ trunk/libgaim/notify.c 2006-12-10 05:06:01 UTC (rev 17935) @@ -43,7 +43,7 @@ { char *label; char *value; - gboolean is_header; + GaimNotifyUserInfoEntryType type; }; struct _GaimNotifyUserInfo @@ -483,7 +483,7 @@ user_info_entry = g_new0(GaimNotifyUserInfoEntry, 1); user_info_entry->label = g_strdup(label); user_info_entry->value = g_strdup(value); - user_info_entry->is_header = FALSE; + user_info_entry->type = GAIM_NOTIFY_USER_INFO_ENTRY_PAIR; return user_info_entry; } @@ -541,9 +541,12 @@ for (l = user_info->user_info_entries; l != NULL; l = l->next) { GaimNotifyUserInfoEntry *user_info_entry = l->data; - if (user_info_entry->is_header) + /* Add a newline before a section header */ + if (user_info_entry->type == GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER) g_string_append(text, newline); + /* Handle the label/value pair itself */ + /* XXX Todo: Use a larger size for a section header? */ if (user_info_entry->label) g_string_append_printf(text, "<b>%s</b>", user_info_entry->label); if (user_info_entry->label && user_info_entry->value) @@ -551,11 +554,18 @@ if (user_info_entry->value) g_string_append(text, user_info_entry->value); - if (user_info_entry->is_header) - g_string_append(text, newline); + /* Display a section break as a horizontal line */ + if (user_info_entry->type == GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK) + g_string_append(text, "<HR>"); - if (l->next) + /* Don't insert a new line before or after a section break; <HR> does that for us */ + if ((user_info_entry->type != GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK) && + (l->next && ((((GaimNotifyUserInfoEntry *)(l->next->data))->type != GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK)))) g_string_append(text, newline); + + /* Add an extra newline after a section header */ + if (user_info_entry->type == GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER) + g_string_append(text, newline); } return g_string_free(text, FALSE); @@ -602,29 +612,27 @@ GaimNotifyUserInfoEntry *entry; entry = gaim_notify_user_info_entry_new(label, NULL); - entry->is_header = TRUE; + entry->type = GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); } -/** - * Remove the last item which was added to user_info - * This is helpful for removing a section header if the section was empty. - */ void -gaim_notify_user_info_remove_last_item(GaimNotifyUserInfo *user_info) +gaim_notify_user_info_add_section_break(GaimNotifyUserInfo *user_info) { - user_info->user_info_entries = g_list_remove(user_info->user_info_entries, - g_list_last(user_info->user_info_entries)->data); + GaimNotifyUserInfoEntry *entry; + + entry = gaim_notify_user_info_entry_new(NULL, NULL); + entry->type = GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; + + user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); } void -gaim_notify_user_info_add_section_break(GaimNotifyUserInfo *user_info) +gaim_notify_user_info_remove_last_item(GaimNotifyUserInfo *user_info) { - /* This is for future expansion; section breaks should be marked as such so the UI - * can format them differently if desired. - */ - gaim_notify_user_info_add_pair(user_info, NULL, "<HR>"); + user_info->user_info_entries = g_list_remove(user_info->user_info_entries, + g_list_last(user_info->user_info_entries)->data); } void * Modified: trunk/libgaim/notify.h =================================================================== --- trunk/libgaim/notify.h 2006-12-10 03:44:35 UTC (rev 17934) +++ trunk/libgaim/notify.h 2006-12-10 05:06:01 UTC (rev 17935) @@ -94,6 +94,15 @@ } GaimNotifySearchResults; +/** + * Types of GaimNotifyUserInfoEntry objects + */ +typedef enum +{ + GAIM_NOTIFY_USER_INFO_ENTRY_PAIR = 0, + GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK, + GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER +} GaimNotifyUserInfoEntryType; /** * Single column of a search result. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2006-12-10 03:44:42
|
Revision: 17934 http://svn.sourceforge.net/gaim/?rev=17934&view=rev Author: evands Date: 2006-12-09 19:44:35 -0800 (Sat, 09 Dec 2006) Log Message: ----------- I forgot to add section breaks in the appropriate places in oscar in [17929] Modified Paths: -------------- trunk/libgaim/protocols/oscar/oscar.c Modified: trunk/libgaim/protocols/oscar/oscar.c =================================================================== --- trunk/libgaim/protocols/oscar/oscar.c 2006-12-10 03:01:42 UTC (rev 17933) +++ trunk/libgaim/protocols/oscar/oscar.c 2006-12-10 03:44:35 UTC (rev 17934) @@ -2613,6 +2613,7 @@ gaim_notify_user_info_add_pair(user_info, _("UIN"), who); gaim_notify_user_info_add_pair(user_info, _("Status"), statusmsg); + gaim_notify_user_info_add_section_break(user_info); gaim_notify_user_info_add_pair(user_info, NULL, g_strjoinv("<BR>", splitmsg)); g_free(statusmsg); @@ -2848,6 +2849,7 @@ g_free(tmp); if (away_utf8 != NULL) { tmp = gaim_str_sub_away_formatters(away_utf8, gaim_account_get_username(account)); + gaim_notify_user_info_add_section_break(user_info); oscar_user_info_add_pair(user_info, NULL, tmp); g_free(tmp); g_free(away_utf8); @@ -2861,6 +2863,7 @@ g_free(tmp); if (info_utf8 != NULL) { tmp = gaim_str_sub_away_formatters(info_utf8, gaim_account_get_username(account)); + gaim_notify_user_info_add_section_break(user_info); oscar_user_info_add_pair(user_info, _("Profile"), tmp); g_free(tmp); g_free(info_utf8); @@ -3703,9 +3706,8 @@ } oscar_user_info_convert_and_add(account, user_info, _("Additional Information"), info->info); + gaim_notify_user_info_add_section_break(user_info); -/* g_string_append_printf(str, "<hr>"); */ - if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { tmp = g_string_sized_new(100); oscar_string_convert_and_append(account, tmp, "\n<br>", _("Address"), info->homeaddr); @@ -3714,7 +3716,8 @@ oscar_string_convert_and_append(account, tmp, "\n<br>", _("Zip Code"), info->homezip); gaim_notify_user_info_add_pair(user_info, _("Home Address"), tmp->str); - + gaim_notify_user_info_add_section_break(user_info); + g_string_free(tmp, TRUE); } if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { @@ -3726,7 +3729,8 @@ oscar_string_convert_and_append(account, tmp, "\n<br>", _("Zip Code"), info->workzip); gaim_notify_user_info_add_pair(user_info, _("Work Address"), tmp->str); - + gaim_notify_user_info_add_section_break(user_info); + g_string_free(tmp, TRUE); } if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |