You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(106) |
Oct
(334) |
Nov
(246) |
Dec
(145) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(42) |
Feb
(53) |
Mar
(232) |
Apr
(109) |
May
(137) |
Jun
(63) |
Jul
(26) |
Aug
(263) |
Sep
(193) |
Oct
(507) |
Nov
(440) |
Dec
(241) |
2003 |
Jan
(567) |
Feb
(195) |
Mar
(504) |
Apr
(481) |
May
(524) |
Jun
(522) |
Jul
(594) |
Aug
(502) |
Sep
(643) |
Oct
(508) |
Nov
(430) |
Dec
(377) |
2004 |
Jan
(361) |
Feb
(251) |
Mar
(219) |
Apr
(499) |
May
(461) |
Jun
(419) |
Jul
(314) |
Aug
(519) |
Sep
(416) |
Oct
(247) |
Nov
(305) |
Dec
(382) |
2005 |
Jan
(267) |
Feb
(282) |
Mar
(327) |
Apr
(338) |
May
(189) |
Jun
(400) |
Jul
(462) |
Aug
(530) |
Sep
(316) |
Oct
(523) |
Nov
(481) |
Dec
(650) |
2006 |
Jan
(536) |
Feb
(361) |
Mar
(287) |
Apr
(146) |
May
(101) |
Jun
(169) |
Jul
(221) |
Aug
(498) |
Sep
(300) |
Oct
(236) |
Nov
(209) |
Dec
(205) |
2007 |
Jan
(30) |
Feb
(23) |
Mar
(26) |
Apr
(15) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <the...@us...> - 2006-08-05 09:54:49
|
Revision: 16645 Author: thekingant Date: 2006-08-05 02:54:33 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16645&view=rev Log Message: ----------- Backport SVN revisions 16638 through 16643 from HEAD to v2_0_0 Original commit messages: thekingant * r16638 /trunk/ (61 files in 4 dirs): A bunch of small changes. Mostly remove "if not null" checks before calling g_free, g_list_free, g_slist_free and g_strdup. Also use g_list_foreach() to call g_free to free strings in an array. And some whitespace changes here and there. thekingant * r16639 /trunk/doc/: Add doc/gntgaim.1 to the svn:ignore property thekingant * r16640 /trunk/ (8 files in 5 dirs): Remove the Napster PRPL thekingant * r16641 /trunk/src/ (gaim-socket.h socket.c): Remove the old src/gaim-socket.h and src/socket.c from Subversion thekingant * r16642 /trunk/src/ (mime.c mime.h): Formatting/whitespace thekingant * r16643 /trunk/src/ (gtkimhtml.c util.c): Return g_string_free(str, FALSE) directly instead of assigning str->str to a temporary directory and returning that. Modified Paths: -------------- branches/v2_0_0/ChangeLog branches/v2_0_0/Makefile.mingw branches/v2_0_0/configure.ac branches/v2_0_0/pixmaps/status/default/Makefile.am branches/v2_0_0/plugins/codeinline.c branches/v2_0_0/plugins/contact_priority.c branches/v2_0_0/plugins/dbus-example.c branches/v2_0_0/plugins/history.c branches/v2_0_0/plugins/log_reader.c branches/v2_0_0/plugins/timestamp.c branches/v2_0_0/po/POTFILES.in branches/v2_0_0/src/account.c branches/v2_0_0/src/accountopt.c branches/v2_0_0/src/blist.c branches/v2_0_0/src/buddyicon.c branches/v2_0_0/src/cipher.c branches/v2_0_0/src/cmds.c branches/v2_0_0/src/connection.c branches/v2_0_0/src/conversation.c branches/v2_0_0/src/core.c branches/v2_0_0/src/dbus-define-api.h branches/v2_0_0/src/dbus-server.h branches/v2_0_0/src/dbus-useful.c branches/v2_0_0/src/dbus-useful.h branches/v2_0_0/src/ft.c branches/v2_0_0/src/gaim-client-example.c branches/v2_0_0/src/gaim-client.c branches/v2_0_0/src/gtkaccount.c branches/v2_0_0/src/gtkblist.c branches/v2_0_0/src/gtkconv.c branches/v2_0_0/src/gtkdebug.c branches/v2_0_0/src/gtkft.c branches/v2_0_0/src/gtkimhtml.c branches/v2_0_0/src/gtkimhtmltoolbar.c branches/v2_0_0/src/gtklog.c branches/v2_0_0/src/gtkpluginpref.c branches/v2_0_0/src/gtkpounce.c branches/v2_0_0/src/gtkprefs.c branches/v2_0_0/src/gtkprivacy.c branches/v2_0_0/src/gtkrequest.c branches/v2_0_0/src/gtkroomlist.c branches/v2_0_0/src/gtksound.c branches/v2_0_0/src/gtkstatusbox.c branches/v2_0_0/src/gtkthemes.c branches/v2_0_0/src/gtkutils.c branches/v2_0_0/src/imgstore.c branches/v2_0_0/src/log.c branches/v2_0_0/src/mime.c branches/v2_0_0/src/mime.h branches/v2_0_0/src/notify.c branches/v2_0_0/src/plugin.c branches/v2_0_0/src/pluginpref.c branches/v2_0_0/src/pounce.c branches/v2_0_0/src/prefs.c branches/v2_0_0/src/protocols/Makefile.am branches/v2_0_0/src/protocols/oscar/oscar.c branches/v2_0_0/src/proxy.c branches/v2_0_0/src/prpl.c branches/v2_0_0/src/request.c branches/v2_0_0/src/roomlist.c branches/v2_0_0/src/server.c branches/v2_0_0/src/signals.c branches/v2_0_0/src/status.c branches/v2_0_0/src/util.c branches/v2_0_0/src/value.c branches/v2_0_0/src/whiteboard.c branches/v2_0_0/src/xmlnode.c Removed Paths: ------------- branches/v2_0_0/pixmaps/status/default/napster.png branches/v2_0_0/src/gaim-socket.h branches/v2_0_0/src/protocols/napster/ branches/v2_0_0/src/socket.c Property Changed: ---------------- branches/v2_0_0/doc/ branches/v2_0_0/plugins/codeinline.c Modified: branches/v2_0_0/ChangeLog =================================================================== --- branches/v2_0_0/ChangeLog 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/ChangeLog 2006-08-05 09:54:33 UTC (rev 16645) @@ -152,6 +152,7 @@ * SIP/SIMPLE support (Thomas Butter, Google Summer of Code) * Sametime protocol support Requires the meanwhile library: http://meanwhile.sourceforge.net + * Removed support for the napster and toc protocols Other Noteworthy Changes: * UPnP and NAT traversal support (Adam J. Warrington, Google Summer of Modified: branches/v2_0_0/Makefile.mingw =================================================================== --- branches/v2_0_0/Makefile.mingw 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/Makefile.mingw 2006-08-05 09:54:33 UTC (rev 16645) @@ -21,7 +21,6 @@ TOC = $(GAIM_PROTOS)/toc IRC = $(GAIM_PROTOS)/irc JABBER = $(GAIM_PROTOS)/jabber -NAPSTER = $(GAIM_PROTOS)/napster GG = $(GAIM_PROTOS)/gg NOVELL = $(GAIM_PROTOS)/novell SILC = $(GAIM_PROTOS)/silc Modified: branches/v2_0_0/configure.ac =================================================================== --- branches/v2_0_0/configure.ac 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/configure.ac 2006-08-05 09:54:33 UTC (rev 16645) @@ -1772,7 +1772,6 @@ src/protocols/irc/Makefile src/protocols/jabber/Makefile src/protocols/msn/Makefile - src/protocols/napster/Makefile src/protocols/novell/Makefile src/protocols/oscar/Makefile src/protocols/sametime/Makefile Property changes on: branches/v2_0_0/doc ___________________________________________________________________ Name: svn:ignore - Makefile.in Makefile html gaim.1 gaim-remote.1 + Makefile.in Makefile html gaim.1 gaim-remote.1 gntgaim.1 Modified: branches/v2_0_0/pixmaps/status/default/Makefile.am =================================================================== --- branches/v2_0_0/pixmaps/status/default/Makefile.am 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/pixmaps/status/default/Makefile.am 2006-08-05 09:54:33 UTC (rev 16645) @@ -26,7 +26,6 @@ male.png \ meanwhile.png \ msn.png \ - napster.png \ notauthorized.png \ novell.png \ occupied.png \ Deleted: branches/v2_0_0/pixmaps/status/default/napster.png =================================================================== (Binary files differ) Modified: branches/v2_0_0/plugins/codeinline.c =================================================================== --- branches/v2_0_0/plugins/codeinline.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/codeinline.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -48,12 +48,12 @@ static gboolean plugin_load(GaimPlugin *plugin) -{ +{ void *handle = gaim_conversations_get_handle(); plugin_handle = plugin; - gaim_signal_connect(handle, "writing-im-msg", plugin, + gaim_signal_connect(handle, "writing-im-msg", plugin, GAIM_CALLBACK(outgoing_msg_cb), NULL); - + return TRUE; } Property changes on: branches/v2_0_0/plugins/codeinline.c ___________________________________________________________________ Name: svn:executable - * Modified: branches/v2_0_0/plugins/contact_priority.c =================================================================== --- branches/v2_0_0/plugins/contact_priority.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/contact_priority.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -99,12 +99,12 @@ hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - + label = gtk_label_new_with_mnemonic(_(statuses[i].description)); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_size_group_add_widget(sg, label); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - + adj = gtk_adjustment_new(gaim_prefs_get_int(pref), -500, 500, 1, 1, 1); spin = gtk_spin_button_new((GtkAdjustment *)adj, 1, 0); g_signal_connect(G_OBJECT(spin), "value-changed", G_CALLBACK(pref_update), pref); Modified: branches/v2_0_0/plugins/dbus-example.c =================================================================== --- branches/v2_0_0/plugins/dbus-example.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/dbus-example.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -51,7 +51,7 @@ #include "dbus-bindings.h" typedef struct { - char *text; + char *text; } GaimText; /* This makes the structure GaimText visible to the gaim-dbus type @@ -59,7 +59,7 @@ on, we will be able to register pointers to structures of this type. You to dbus-define types you want to be directly accessible by external applications. */ -GAIM_DBUS_DEFINE_TYPE(GaimText) +GAIM_DBUS_DEFINE_TYPE(GaimText) /* Here we make four functions accessible to other applications by DBus. These functions can access types defined in gaim proper @@ -78,30 +78,30 @@ static GaimText hello; /* Here come the definitions of the four exported functions. */ -GaimText* dbus_example_get_hello_object(void) +GaimText* dbus_example_get_hello_object(void) { - return &hello; + return &hello; } -void dbus_example_set_text(GaimText *obj, const char *text) +void dbus_example_set_text(GaimText *obj, const char *text) { - if (obj != NULL) { - g_free(obj->text); - obj->text = g_strdup(text); - } + if (obj != NULL) { + g_free(obj->text); + obj->text = g_strdup(text); + } } -const char *dbus_example_get_text(GaimText *obj) +const char *dbus_example_get_text(GaimText *obj) { - if (obj != NULL) - return obj->text; - else - return NULL; + if (obj != NULL) + return obj->text; + else + return NULL; } -const char *dbus_example_get_buddy_name(GaimBuddy *buddy) +const char *dbus_example_get_buddy_name(GaimBuddy *buddy) { - return gaim_buddy_get_name(buddy); + return gaim_buddy_get_name(buddy); } /* And now standard plugin stuff */ @@ -111,33 +111,33 @@ { GAIM_DBUS_RETURN_FALSE_IF_DISABLED(plugin); - /* First, we have to register our four exported functions with the - main gaim dbus loop. Without this statement, the gaim dbus - code wouldn't know about our functions. */ - GAIM_DBUS_REGISTER_BINDINGS(plugin); + /* First, we have to register our four exported functions with the + main gaim dbus loop. Without this statement, the gaim dbus + code wouldn't know about our functions. */ + GAIM_DBUS_REGISTER_BINDINGS(plugin); - /* Then, we register the hello object of type GaimText. Note that - pointer registrations / unregistrations are completely dynamic; - they don't have to be made when the plugin is loaded / - unloaded. Without this statement the dbus gaim code wouldn't - know about the hello object. */ - GAIM_DBUS_REGISTER_POINTER(&hello, GaimText); + /* Then, we register the hello object of type GaimText. Note that + pointer registrations / unregistrations are completely dynamic; + they don't have to be made when the plugin is loaded / + unloaded. Without this statement the dbus gaim code wouldn't + know about the hello object. */ + GAIM_DBUS_REGISTER_POINTER(&hello, GaimText); - hello.text = g_strdup("Hello."); - - return TRUE; + hello.text = g_strdup("Hello."); + + return TRUE; } static gboolean plugin_unload(GaimPlugin *plugin) { - g_free(hello.text); + g_free(hello.text); - /* It is necessary to unregister all pointers registered by the module. */ - GAIM_DBUS_UNREGISTER_POINTER(&hello); + /* It is necessary to unregister all pointers registered by the module. */ + GAIM_DBUS_UNREGISTER_POINTER(&hello); - return TRUE; + return TRUE; } static GaimPluginInfo info = Modified: branches/v2_0_0/plugins/history.c =================================================================== --- branches/v2_0_0/plugins/history.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/history.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -90,7 +90,7 @@ if (logs == NULL) logs = gaim_log_get_logs(GAIM_LOG_IM, name, account); else - logs = g_list_sort(logs, gaim_log_compare); + logs = g_list_sort(logs, gaim_log_compare); } else if (convtype == GAIM_CONV_TYPE_CHAT) { Modified: branches/v2_0_0/plugins/log_reader.c =================================================================== --- branches/v2_0_0/plugins/log_reader.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/log_reader.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -300,7 +300,7 @@ if (!data->path || stat(data->path, &st)) st.st_size = 0; - + return st.st_size; } @@ -399,7 +399,7 @@ g_return_val_if_fail(log != NULL, g_strdup("")); data = log->logger_data; - + /* TODO: Do something here. */ return g_strdup(""); } Modified: branches/v2_0_0/plugins/timestamp.c =================================================================== --- branches/v2_0_0/plugins/timestamp.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/plugins/timestamp.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -120,7 +120,7 @@ gaim_conversation_set_data(conv, "timestamp-initialized", GINT_TO_POINTER(TRUE)); gaim_conversation_set_data(conv, "timestamp-enabled", GINT_TO_POINTER(TRUE)); gaim_conversation_set_data(conv, "timestamp-conv-active", GINT_TO_POINTER(TRUE)); - gtk_text_buffer_create_tag (buffer, "TIMESTAMP", "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, + gtk_text_buffer_create_tag (buffer, "TIMESTAMP", "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, "weight", PANGO_WEIGHT_BOLD, NULL); do_timestamp(conv); } Modified: branches/v2_0_0/po/POTFILES.in =================================================================== --- branches/v2_0_0/po/POTFILES.in 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/po/POTFILES.in 2006-08-05 09:54:33 UTC (rev 16645) @@ -108,7 +108,6 @@ src/protocols/msn/state.c src/protocols/msn/switchboard.c src/protocols/msn/userlist.c -src/protocols/napster/napster.c src/protocols/novell/nmuser.c src/protocols/novell/novell.c src/protocols/oscar/flap_connection.c Modified: branches/v2_0_0/src/account.c =================================================================== --- branches/v2_0_0/src/account.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/account.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -792,8 +792,7 @@ { GaimAccountSetting *setting = (GaimAccountSetting *)data; - if (setting->ui != NULL) - g_free(setting->ui); + g_free(setting->ui); if (setting->type == GAIM_PREF_STRING) g_free(setting->value.string); @@ -1178,7 +1177,7 @@ g_return_if_fail(account != NULL); g_free(account->username); - account->username = (username == NULL ? NULL : g_strdup(username)); + account->username = g_strdup(username); schedule_accounts_save(); } @@ -1189,8 +1188,7 @@ g_return_if_fail(account != NULL); g_free(account->password); - account->password = NULL; - account->password = (password == NULL ? NULL : g_strdup(password)); + account->password = g_strdup(password); schedule_accounts_save(); } @@ -1212,7 +1210,7 @@ { char *old = account->alias; - account->alias = (alias == NULL ? NULL : g_strdup(alias)); + account->alias = g_strdup(alias); gaim_signal_emit(gaim_accounts_get_handle(), "account-alias-changed", account, old); g_free(old); @@ -1227,7 +1225,7 @@ g_return_if_fail(account != NULL); g_free(account->user_info); - account->user_info = (user_info == NULL ? NULL : g_strdup(user_info)); + account->user_info = g_strdup(user_info); schedule_accounts_save(); } @@ -1263,7 +1261,7 @@ } g_free(account->buddy_icon); - account->buddy_icon = (icon == NULL ? NULL : g_strdup(icon)); + account->buddy_icon = g_strdup(icon); if (gaim_account_is_connected(account)) { char *filename = gaim_buddy_icons_get_full_path(icon); @@ -1362,11 +1360,7 @@ /* Old with the old... */ if (account->status_types != NULL) { - GList *l; - - for (l = account->status_types; l != NULL; l = l->next) - gaim_status_type_destroy((GaimStatusType *)l->data); - + g_list_foreach(account->status_types, (GFunc)gaim_status_type_destroy, NULL); g_list_free(account->status_types); } Modified: branches/v2_0_0/src/accountopt.c =================================================================== --- branches/v2_0_0/src/accountopt.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/accountopt.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -87,8 +87,7 @@ if (option == NULL) return NULL; - if (default_value != NULL) - option->default_value.string = g_strdup(default_value); + option->default_value.string = g_strdup(default_value); return option; } @@ -159,10 +158,8 @@ g_return_if_fail(option != NULL); g_return_if_fail(option->type == GAIM_PREF_STRING); - if (option->default_value.string != NULL) - g_free(option->default_value.string); - - option->default_value.string = (value == NULL ? NULL : g_strdup(value)); + g_free(option->default_value.string); + option->default_value.string = g_strdup(value); } void @@ -310,8 +307,7 @@ split->text = g_strdup(text); split->field_sep = sep; - split->default_value = (default_value == NULL - ? NULL : g_strdup(default_value)); + split->default_value = g_strdup(default_value); return split; } @@ -321,12 +317,8 @@ { g_return_if_fail(split != NULL); - if (split->text != NULL) - g_free(split->text); - - if (split->default_value != NULL) - g_free(split->default_value); - + g_free(split->text); + g_free(split->default_value); g_free(split); } Modified: branches/v2_0_0/src/blist.c =================================================================== --- branches/v2_0_0/src/blist.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/blist.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -627,21 +627,21 @@ if (!gaim_account_is_connected(buddy->account)) continue; - if (new_priority == NULL) - new_priority = buddy; - else - { - int cmp; + if (new_priority == NULL) + new_priority = buddy; + else + { + int cmp; cmp = gaim_presence_compare(gaim_buddy_get_presence(new_priority), gaim_buddy_get_presence(buddy)); - if (cmp > 0 || (cmp == 0 && + if (cmp > 0 || (cmp == 0 && gaim_prefs_get_bool("/core/contact/last_match"))) - { - new_priority = buddy; - } - } + { + new_priority = buddy; + } + } } contact->priority = new_priority; @@ -1052,7 +1052,7 @@ /* Make a list of what the groups each buddy is in */ for(cur = buddies; cur; cur = cur->next) { GaimBlistNode *node = (GaimBlistNode *)cur->data; - groups = g_list_append(groups, node->parent->parent); + groups = g_list_prepend(groups, node->parent->parent); } gaim_account_remove_buddies(account, buddies, groups); @@ -2034,7 +2034,7 @@ const char *gaim_chat_get_name(GaimChat *chat) { struct proto_chat_entry *pce; - GList *parts, *tmp; + GList *parts; char *ret; g_return_val_if_fail(chat != NULL, NULL); @@ -2045,8 +2045,7 @@ parts = GAIM_PLUGIN_PROTOCOL_INFO(chat->account->gc->prpl)->chat_info(chat->account->gc); pce = parts->data; ret = g_hash_table_lookup(chat->components, pce->identifier); - for (tmp = parts; tmp; tmp = tmp->next) - g_free(tmp->data); + g_list_foreach(parts, (GFunc)g_free, NULL); g_list_free(parts); return ret; Modified: branches/v2_0_0/src/buddyicon.c =================================================================== --- branches/v2_0_0/src/buddyicon.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/buddyicon.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -312,7 +312,6 @@ g_return_if_fail(username != NULL); g_free(icon->username); - icon->username = g_strdup(username); } @@ -480,7 +479,6 @@ g_return_if_fail(dir != NULL); g_free(cache_dir); - cache_dir = g_strdup(dir); } Modified: branches/v2_0_0/src/cipher.c =================================================================== --- branches/v2_0_0/src/cipher.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/cipher.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -10,7 +10,7 @@ * * Original md4 taken from linux kernel * MD4 Message Digest Algorithm (RFC1320). - * + * * Implementation derived from Andrew Tridgell and Steve French's * CIFS MD4 implementation, and the cryptoapi implementation * originally based on the public domain implementation written @@ -26,16 +26,16 @@ * * des.c - DES and Triple-DES encryption/decryption Algorithm * Copyright (C) 1998 Free Software Foundation, Inc. - * + * * Please see below for more legal information! - * + * * According to the definition of DES in FIPS PUB 46-2 from December 1993. * For a description of triple encryption, see: * Bruce Schneier: Applied Cryptography. Second Edition. * John Wiley & Sons, 1996. ISBN 0-471-12845-7. Pages 358 ff. - * + * * This file is part of GnuPG. - * + * * 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 Modified: branches/v2_0_0/src/cmds.c =================================================================== --- branches/v2_0_0/src/cmds.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/cmds.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -71,9 +71,9 @@ c->args = g_strdup(args); c->priority = p; c->flags = f; - c->prpl_id = prpl_id ? g_strdup(prpl_id) : NULL; + c->prpl_id = g_strdup(prpl_id); c->func = func; - c->help = helpstr ? g_strdup(helpstr) : NULL; + c->help = g_strdup(helpstr); c->data = data; cmds = g_list_insert_sorted(cmds, c, (GCompareFunc)cmds_compare_func); @@ -85,11 +85,8 @@ { g_free(c->cmd); g_free(c->args); - if (c->prpl_id) - g_free(c->prpl_id); - if (c->help) - g_free(c->help); - + g_free(c->prpl_id); + g_free(c->help); g_free(c); } @@ -109,6 +106,10 @@ } } +/** + * This sets args to a NULL-terminated array of strings. It should + * be freed using g_strfreev(). + */ static gboolean gaim_cmd_parse_args(GaimCmd *cmd, const gchar *s, const gchar *m, gchar ***args) { int i; @@ -142,7 +143,7 @@ (*args)[i] = gaim_markup_slice(m, g_utf8_pointer_to_offset(s, cur), g_utf8_pointer_to_offset(s, end)); cur = end +1; } - break; + break; case 's': (*args)[i] = g_strdup(cur); cur = cur + strlen(cur); @@ -160,15 +161,6 @@ return TRUE; } -static void gaim_cmd_free_args(gchar **args) -{ - int i; - - for (i = 0; args[i]; i++) - g_free(args[i]); - g_free(args); -} - static void gaim_cmd_strip_current_char(gunichar c, char *s, guint len) { int bytes; @@ -260,7 +252,7 @@ /* this checks the allow bad args flag for us */ if (!gaim_cmd_parse_args(c, rest, mrest, &args)) { - gaim_cmd_free_args(args); + g_strfreev(args); args = NULL; continue; } @@ -268,10 +260,9 @@ tried_cmd = TRUE; ret = c->func(conv, cmd, args, &err, c->data); if (ret == GAIM_CMD_RET_CONTINUE) { - if (err) - g_free(err); + g_free(err); err = NULL; - gaim_cmd_free_args(args); + g_strfreev(args); args = NULL; continue; } else { @@ -280,8 +271,7 @@ } - if (args) - gaim_cmd_free_args(args); + g_strfreev(args); g_free(cmd); g_free(mrest); Modified: branches/v2_0_0/src/connection.c =================================================================== --- branches/v2_0_0/src/connection.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/connection.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -337,10 +337,8 @@ { g_return_if_fail(gc != NULL); - if (gc->display_name != NULL) - g_free(gc->display_name); - - gc->display_name = (name == NULL ? NULL : g_strdup(name)); + g_free(gc->display_name); + gc->display_name = g_strdup(name); } GaimConnectionState Modified: branches/v2_0_0/src/conversation.c =================================================================== --- branches/v2_0_0/src/conversation.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/conversation.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -335,7 +335,6 @@ GaimConversationUiOps *ops; GaimConnection *gc; const char *name; - GList *node; g_return_if_fail(conv != NULL); @@ -433,34 +432,22 @@ } else if (conv->type == GAIM_CONV_TYPE_CHAT) { - for (node = conv->u.chat->in_room; node != NULL; node = node->next) { - if (node->data != NULL) - gaim_conv_chat_cb_destroy((GaimConvChatBuddy *)node->data); - node->data = NULL; - } - - for (node = conv->u.chat->ignored; node != NULL; node = node->next) { - if (node->data != NULL) - g_free(node->data); - node->data = NULL; - } - + g_list_foreach(conv->u.chat->in_room, (GFunc)gaim_conv_chat_cb_destroy, NULL); g_list_free(conv->u.chat->in_room); + + g_list_foreach(conv->u.chat->ignored, (GFunc)g_free, NULL); g_list_free(conv->u.chat->ignored); conv->u.chat->in_room = NULL; conv->u.chat->ignored = NULL; - if (conv->u.chat->who != NULL) - g_free(conv->u.chat->who); + g_free(conv->u.chat->who); conv->u.chat->who = NULL; - if (conv->u.chat->topic != NULL) - g_free(conv->u.chat->topic); + g_free(conv->u.chat->topic); conv->u.chat->topic = NULL; - if(conv->u.chat->nick) - g_free(conv->u.chat->nick); + g_free(conv->u.chat->nick); GAIM_DBUS_UNREGISTER_POINTER(conv->u.chat); g_free(conv->u.chat); @@ -587,9 +574,7 @@ g_return_if_fail(conv != NULL); g_return_if_fail(title != NULL); - if (conv->title != NULL) - g_free(conv->title); - + g_free(conv->title); conv->title = g_strdup(title); gaim_conversation_update(conv, GAIM_CONV_UPDATE_TITLE); @@ -651,11 +636,9 @@ { g_return_if_fail(conv != NULL); - if (conv->name != NULL) - g_free(conv->name); + g_free(conv->name); + conv->name = g_strdup(name); - conv->name = (name == NULL ? NULL : g_strdup(name)); - gaim_conversation_autoset_title(conv); } @@ -1326,11 +1309,11 @@ { g_return_if_fail(chat != NULL); - if (chat->who != NULL) g_free(chat->who); - if (chat->topic != NULL) g_free(chat->topic); + g_free(chat->who); + g_free(chat->topic); - chat->who = (who == NULL ? NULL : g_strdup(who)); - chat->topic = (topic == NULL ? NULL : g_strdup(topic)); + chat->who = g_strdup(who); + chat->topic = g_strdup(topic); gaim_conversation_update(gaim_conv_chat_get_conversation(chat), GAIM_CONV_UPDATE_TOPIC); @@ -1440,14 +1423,13 @@ g_list_free(flags2); } -int +static int gaim_conv_chat_cb_compare(GaimConvChatBuddy *a, GaimConvChatBuddy *b) { GaimConvChatBuddyFlags f1 = 0, f2 = 0; char *user1 = NULL, *user2 = NULL; gint ret = 0; - if (a) { f1 = a->flags; if (a->alias_key) @@ -1455,7 +1437,7 @@ else if (a->name) user1 = a->name; } - + if (b) { f2 = b->flags; if (b->alias_key) @@ -1470,7 +1452,7 @@ } else if (f1 != f2) { /* sort more important users first */ ret = (f1 > f2) ? -1 : 1; - } else if (a->buddy != b->buddy) { + } else if (a->buddy != b->buddy) { ret = a->buddy ? -1 : 1; } else { ret = strcasecmp(user1, user2); @@ -1565,7 +1547,7 @@ } cbuddies = g_list_sort(cbuddies, (GCompareFunc)gaim_conv_chat_cb_compare); - + if (ops != NULL && ops->chat_add_users != NULL) ops->chat_add_users(conv, cbuddies, new_arrivals); @@ -1728,7 +1710,7 @@ } /* NOTE: Don't remove them from ignored in case they re-enter. */ - + if (!quiet) { const char *alias = user; char *escaped; @@ -1866,8 +1848,7 @@ void gaim_conv_chat_set_nick(GaimConvChat *chat, const char *nick) { g_return_if_fail(chat != NULL); - if(chat->nick) - g_free(chat->nick); + g_free(chat->nick); chat->nick = g_strdup(gaim_normalize(chat->conv->account, nick)); } @@ -1920,10 +1901,7 @@ cb = g_new0(GaimConvChatBuddy, 1); cb->name = g_strdup(name); cb->flags = flags; - if (alias) - cb->alias = g_strdup(alias); - else - cb->alias = NULL; + cb->alias = g_strdup(alias); GAIM_DBUS_REGISTER_POINTER(cb, GaimConvChatBuddy); return cb; @@ -1950,11 +1928,12 @@ void gaim_conv_chat_cb_destroy(GaimConvChatBuddy *cb) { - g_return_if_fail(cb != NULL); + if (cb == NULL) + return; + g_free(cb->alias); + g_free(cb->alias_key); g_free(cb->name); - cb->name = NULL; - cb->flags = 0; GAIM_DBUS_UNREGISTER_POINTER(cb); g_free(cb); Modified: branches/v2_0_0/src/core.c =================================================================== --- branches/v2_0_0/src/core.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/core.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -196,11 +196,7 @@ gaim_dbus_uninit(); #endif - if (core->ui != NULL) { - g_free(core->ui); - core->ui = NULL; - } - + g_free(core->ui); g_free(core); _core = NULL; Modified: branches/v2_0_0/src/dbus-define-api.h =================================================================== --- branches/v2_0_0/src/dbus-define-api.h 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/dbus-define-api.h 2006-08-05 09:54:33 UTC (rev 16645) @@ -7,10 +7,10 @@ /* blist.h */ gboolean GAIM_BLIST_NODE_IS_CHAT(GaimBlistNode *node); -gboolean GAIM_BLIST_NODE_IS_BUDDY(GaimBlistNode *node); +gboolean GAIM_BLIST_NODE_IS_BUDDY(GaimBlistNode *node); gboolean GAIM_BLIST_NODE_IS_CONTACT(GaimBlistNode *node); gboolean GAIM_BLIST_NODE_IS_GROUP(GaimBlistNode *node); -gboolean GAIM_BUDDY_IS_ONLINE(GaimBuddy *buddy); +gboolean GAIM_BUDDY_IS_ONLINE(GaimBuddy *buddy); gboolean GAIM_BLIST_NODE_HAS_FLAG(GaimBlistNode *node, int flags); gboolean GAIM_BLIST_NODE_SHOULD_SAVE(GaimBlistNode *node); Modified: branches/v2_0_0/src/dbus-server.h =================================================================== --- branches/v2_0_0/src/dbus-server.h 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/dbus-server.h 2006-08-05 09:54:33 UTC (rev 16645) @@ -32,7 +32,7 @@ G_BEGIN_DECLS -/** +/** Types of pointers are identified by the ADDRESS of a GaimDbusType object. This way, plugins can easily access types defined in gaim proper as well as introduce their own types that will not conflict @@ -41,7 +41,7 @@ The structure GaimDbusType has only one element (GaimDBusType::parent), a contains a pointer to the parent type, or @c NULL if the type has no parent. Parent means the same as the base class in object oriented - programming. + programming. */ typedef struct _GaimDBusType GaimDBusType; @@ -98,7 +98,7 @@ In order for an object to participate in the scheme, it must register itself and its type with the engine. This registration allocates an integer id which can be resolved to the pointer and - back. + back. Handles are not persistent. They are reissued every time gaim is started. This is not good; external applications that use gaim @@ -108,14 +108,14 @@ Pointer registration is only a temporary solution. When GaimBuddy and similar structures have been converted into gobjects, this registration will be done automatically by objects themselves. - + By the way, this kind of object-handle translation should be so common that there must be a library (maybe even glib) that implements it. I feel a bit like reinventing the wheel here. */ void gaim_dbus_init_ids(void); -/** +/** Registers a typed pointer. @param node The pointer to register. @@ -123,7 +123,7 @@ */ void gaim_dbus_register_pointer(gpointer node, GaimDBusType *type); -/** +/** Unregisters a pointer previously registered with gaim_dbus_register_pointer. @@ -142,7 +142,7 @@ the types of the parameters. @param vargs A va_list containing the actual parameters. */ -void gaim_dbus_signal_emit_gaim(const char *name, int num_values, +void gaim_dbus_signal_emit_gaim(const char *name, int num_values, GaimValue **values, va_list vargs); /** @@ -191,7 +191,7 @@ #define DBUS_EXPORT -/* +/* Here we include the list of #GAIM_DBUS_DECLARE_TYPE statements for all structs defined in gaim. This file has been generated by the #dbus-analize-types.py script. Modified: branches/v2_0_0/src/dbus-useful.c =================================================================== --- branches/v2_0_0/src/dbus-useful.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/dbus-useful.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -7,47 +7,47 @@ GaimAccount * -gaim_accounts_find_ext(const char *name, const char *protocol_id, +gaim_accounts_find_ext(const char *name, const char *protocol_id, gboolean (*account_test)(const GaimAccount *account)) { - GaimAccount *result = NULL; - GList *l; - char *who; - - if (name) - who = g_strdup(gaim_normalize(NULL, name)); - else - who = NULL; - - for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { - GaimAccount *account = (GaimAccount *)l->data; - - if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who)) - continue; + GaimAccount *result = NULL; + GList *l; + char *who; - if (protocol_id && strcmp(account->protocol_id, protocol_id)) - continue; + if (name) + who = g_strdup(gaim_normalize(NULL, name)); + else + who = NULL; - if (account_test && !account_test(account)) - continue; + for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { + GaimAccount *account = (GaimAccount *)l->data; - result = account; - break; - } + if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who)) + continue; - g_free(who); + if (protocol_id && strcmp(account->protocol_id, protocol_id)) + continue; - return result; + if (account_test && !account_test(account)) + continue; + + result = account; + break; + } + + g_free(who); + + return result; } -GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol) +GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol) { - return gaim_accounts_find_ext(name, protocol, NULL); + return gaim_accounts_find_ext(name, protocol, NULL); } -GaimAccount *gaim_accounts_find_connected(const char *name, const char *protocol) +GaimAccount *gaim_accounts_find_connected(const char *name, const char *protocol) { - return gaim_accounts_find_ext(name, protocol, gaim_account_is_connected); + return gaim_accounts_find_ext(name, protocol, gaim_account_is_connected); } Modified: branches/v2_0_0/src/dbus-useful.h =================================================================== --- branches/v2_0_0/src/dbus-useful.h 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/dbus-useful.h 2006-08-05 09:54:33 UTC (rev 16645) @@ -1,6 +1,6 @@ #include "conversation.h" -GaimAccount *gaim_accounts_find_ext(const char *name, const char *protocol_id, +GaimAccount *gaim_accounts_find_ext(const char *name, const char *protocol_id, gboolean (*account_test)(const GaimAccount *account)); GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol); Modified: branches/v2_0_0/src/ft.c =================================================================== --- branches/v2_0_0/src/ft.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/ft.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -648,11 +648,7 @@ g_return_if_fail(xfer != NULL); g_free(xfer->message); - - if (message != NULL) - xfer->message = g_strdup(message); - else - xfer->message = NULL; + xfer->message = g_strdup(message); } void @@ -660,10 +656,8 @@ { g_return_if_fail(xfer != NULL); - if (xfer->filename != NULL) - g_free(xfer->filename); - - xfer->filename = (filename == NULL ? NULL : g_strdup(filename)); + g_free(xfer->filename); + xfer->filename = g_strdup(filename); } void @@ -671,10 +665,8 @@ { g_return_if_fail(xfer != NULL); - if (xfer->local_filename != NULL) - g_free(xfer->local_filename); - - xfer->local_filename = (filename == NULL ? NULL : g_strdup(filename)); + g_free(xfer->local_filename); + xfer->local_filename = g_strdup(filename); } void Modified: branches/v2_0_0/src/gaim-client-example.c =================================================================== --- branches/v2_0_0/src/gaim-client-example.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gaim-client-example.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -5,7 +5,7 @@ #include "gaim-client.h" -/* +/* This example demonstrates how to use libgaim-client to communicate with gaim. The names and signatures of functions provided by libgaim-client are the same as those in gaim. However, all @@ -21,19 +21,19 @@ int main (int argc, char **argv) { - GList *alist, *node; + GList *alist, *node; - gaim_init(); - - alist = gaim_accounts_get_all(); - for (node = alist; node; node = node->next) { - GaimAccount *account = (GaimAccount*) node->data; - char *name = gaim_account_get_username(account); - g_print("Name: %s\n", name); - g_free(name); - } + gaim_init(); - g_list_free(alist); + alist = gaim_accounts_get_all(); + for (node = alist; node != NULL; node = node->next) + { + GaimAccount *account = (GaimAccount*) node->data; + char *name = gaim_account_get_username(account); + g_print("Name: %s\n", name); + g_free(name); + } + g_list_free(alist); - return 0; + return 0; } Modified: branches/v2_0_0/src/gaim-client.c =================================================================== --- branches/v2_0_0/src/gaim-client.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gaim-client.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -10,69 +10,72 @@ static DBusGConnection *bus; static DBusGProxy *gaim_proxy; -static GList *garray_int_to_glist(GArray *array) { - GList *list = NULL; - int i; +static GList *garray_int_to_glist(GArray *array) +{ + GList *list = NULL; + int i; - for(i = 0; i < array->len; i++) - list = g_list_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); + for (i = 0; i < array->len; i++) + list = g_list_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); - g_array_free(array, TRUE); - return list; + g_array_free(array, TRUE); + return list; } -static GSList *garray_int_to_gslist(GArray *array) { - GSList *list = NULL; - int i; +static GSList *garray_int_to_gslist(GArray *array) +{ + GSList *list = NULL; + int i; - for(i = 0; i < array->len; i++) - list = g_slist_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); + for (i = 0; i < array->len; i++) + list = g_slist_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); - g_array_free(array, TRUE); - return list; + g_array_free(array, TRUE); + return list; } #include "gaim-client-bindings.c" -static void lose (const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2); -static void lose_gerror (const char *prefix, GError *error) G_GNUC_NORETURN; +static void lose(const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2); +static void lose_gerror(const char *prefix, GError *error) G_GNUC_NORETURN; static void -lose (const char *str, ...) +lose(const char *str, ...) { - va_list args; + va_list args; - va_start (args, str); + va_start(args, str); - vfprintf (stderr, str, args); - fputc ('\n', stderr); + vfprintf(stderr, str, args); + fputc('\n', stderr); - va_end (args); + va_end(args); - exit (1); + exit(1); } static void -lose_gerror (const char *prefix, GError *error) +lose_gerror(const char *prefix, GError *error) { - lose ("%s: %s", prefix, error->message); + lose("%s: %s", prefix, error->message); } -void gaim_init(void) { - GError *error = NULL; +void gaim_init(void) +{ + GError *error = NULL; - g_type_init (); + g_type_init (); - bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); - if (!bus) - lose_gerror ("Couldn't connect to session bus", error); + bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); + if (!bus) + lose_gerror ("Couldn't connect to session bus", error); - gaim_proxy = dbus_g_proxy_new_for_name (bus, - DBUS_SERVICE_GAIM, - DBUS_PATH_GAIM, - DBUS_INTERFACE_GAIM); + gaim_proxy = dbus_g_proxy_new_for_name (bus, + DBUS_SERVICE_GAIM, + DBUS_PATH_GAIM, + DBUS_INTERFACE_GAIM); - if (!gaim_proxy) - lose_gerror ("Couldn't connect to the Gaim Service", error); + if (!gaim_proxy) + lose_gerror ("Couldn't connect to the Gaim Service", error); } Deleted: branches/v2_0_0/src/gaim-socket.h =================================================================== --- branches/v2_0_0/src/gaim-socket.h 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gaim-socket.h 2006-08-05 09:54:33 UTC (rev 16645) @@ -1,45 +0,0 @@ -/* - * gaim-remote - * - * 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_GAIM_SOCKET_H_ -#define _GAIM_GAIM_SOCKET_H_ - -struct gaim_cui_packet { - guchar type; - guchar subtype; - guint32 length; - char *data; -}; - - -void cui_send_packet (int fd, struct gaim_cui_packet *p); -gint gaim_connect_to_session(gint session); -gboolean gaim_session_exists(int sess); - -struct gaim_cui_packet *cui_packet_new(guchar type, guchar subtype); -void cui_packet_free(struct gaim_cui_packet *p); -void cui_packet_append_string(struct gaim_cui_packet *p, char *str); -void cui_packet_append_char(struct gaim_cui_packet *p, char c); -void cui_packet_append_raw(struct gaim_cui_packet *p, char *str, int len); - - -#endif /* _GAIM_GAIM_SOCKET_H_ */ Modified: branches/v2_0_0/src/gtkaccount.c =================================================================== --- branches/v2_0_0/src/gtkaccount.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkaccount.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -204,7 +204,7 @@ gaim_gtk_buddy_icon_get_scale_size(pixbuf, &dialog->prpl_info->icon_spec, &width, &height); scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR); - + g_object_unref(G_OBJECT(pixbuf)); pixbuf = scale; } @@ -231,9 +231,7 @@ { dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin); - if (dialog->protocol_id != NULL) - g_free(dialog->protocol_id); - + g_free(dialog->protocol_id); dialog->protocol_id = g_strdup(dialog->plugin->info->id); } @@ -317,8 +315,7 @@ #endif /* FILECHOOSER */ - if (dialog->icon_path) - g_free(dialog->icon_path); + g_free(dialog->icon_path); dialog->icon_path = convert_buddy_icon(dialog->plugin, filename); set_dialog_icon(dialog); gtk_widget_show(dialog->icon_entry); @@ -482,8 +479,7 @@ static void icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog) { - if (dialog->icon_path) - g_free(dialog->icon_path); + g_free(dialog->icon_path); dialog->icon_path = NULL; gtk_widget_hide(dialog->icon_entry); @@ -512,8 +508,7 @@ } if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n'))) *rtmp = '\0'; - if (dialog->icon_path) - g_free(dialog->icon_path); + g_free(dialog->icon_path); dialog->icon_path = convert_buddy_icon(dialog->plugin, tmp); set_dialog_icon(dialog); gtk_widget_show(dialog->icon_entry); @@ -1423,15 +1418,10 @@ gtk_widget_destroy(dialog->window); - if (dialog->user_split_entries != NULL) - g_list_free(dialog->user_split_entries); + g_list_free(dialog->user_split_entries); + g_list_free(dialog->protocol_opt_entries); + g_free(dialog->protocol_id); - if (dialog->protocol_opt_entries != NULL) - g_list_free(dialog->protocol_opt_entries); - - if (dialog->protocol_id != NULL) - g_free(dialog->protocol_id); - if (dialog->icon_path != NULL) { const char *icon = gaim_account_get_buddy_icon(dialog->account); @@ -2572,10 +2562,7 @@ free_add_user_data(GaimGtkAccountAddUserData *data) { g_free(data->username); - - if (data->alias != NULL) - g_free(data->alias); - + g_free(data->alias); g_free(data); } @@ -2645,7 +2632,7 @@ data = g_new0(GaimGtkAccountAddUserData, 1); data->account = account; data->username = g_strdup(remote_user); - data->alias = (alias != NULL ? g_strdup(alias) : NULL); + data->alias = g_strdup(alias); buffer = make_info(account, gc, remote_user, id, alias, msg); Modified: branches/v2_0_0/src/gtkblist.c =================================================================== --- branches/v2_0_0/src/gtkblist.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkblist.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -541,9 +541,7 @@ ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget); } - if (data->entries != NULL) - g_list_free(data->entries); - + g_list_free(data->entries); data->entries = NULL; if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) @@ -1508,8 +1506,7 @@ if (aims == NULL && icqs == NULL && yahoos == NULL && msns == NULL && jabbers == NULL) { - if (alias != NULL) - g_free(alias); + g_free(alias); return FALSE; } @@ -1520,8 +1517,7 @@ add_buddies_from_vcard("prpl-msn", group, msns, alias); add_buddies_from_vcard("prpl-jabber", group, jabbers, alias); - if (alias != NULL) - g_free(alias); + g_free(alias); return TRUE; } @@ -1583,7 +1579,6 @@ GValue val; GString *str; const char *protocol; - char *mime_str; ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row"); sourcerow = gtk_tree_row_reference_get_path(ref); @@ -1643,15 +1638,13 @@ str = g_string_append(str, "\r\n"); - mime_str = g_string_free(str, FALSE); - gtk_selection_data_set(data, gdk_atom_intern("application/x-im-contact", FALSE), 8, /* bits */ - (const guchar *)mime_str, - strlen(mime_str) + 1); + (const guchar *)str->str, + strlen(str->str) + 1); - g_free(mime_str); + g_string_free(str, TRUE); gtk_tree_path_free(sourcerow); } } @@ -1867,9 +1860,9 @@ } } - if (username != NULL) g_free(username); - if (protocol != NULL) g_free(protocol); - if (alias != NULL) g_free(alias); + g_free(username); + g_free(protocol); + g_free(alias); if (path != NULL) gtk_tree_path_free(path); @@ -4772,8 +4765,7 @@ ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget); } - if (data->entries != NULL) - g_list_free(data->entries); + g_list_free(data->entries); data->entries = NULL; @@ -5805,7 +5797,7 @@ submenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); gtk_widget_show(submenu); - + gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); path = g_strdup_printf("%s/Tools/%s", gtkblist->ift->path, plugin->info->name); gtk_menu_set_accel_path(GTK_MENU(submenu), path); Modified: branches/v2_0_0/src/gtkconv.c =================================================================== --- branches/v2_0_0/src/gtkconv.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkconv.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -193,15 +193,9 @@ static gint close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv) { - GList *list = g_list_copy(gtkconv->convs), *l; + GList *list = g_list_copy(gtkconv->convs); - l = list; - while (l) { - GaimConversation *conv = l->data; - gaim_conversation_destroy(conv); - l = l->next; - } - + g_list_foreach(list, (GFunc)gaim_conversation_destroy, NULL); g_list_free(list); return TRUE; @@ -488,8 +482,7 @@ case GAIM_CMD_STATUS_FAILED: gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), GAIM_MESSAGE_NO_LOG, time(NULL)); - if(error) - g_free(error); + g_free(error); return TRUE; case GAIM_CMD_STATUS_WRONG_TYPE: if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) @@ -770,8 +763,8 @@ } } - if (username != NULL) g_free(username); - if (protocol != NULL) g_free(protocol); + g_free(username); + g_free(protocol); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } @@ -1425,7 +1418,7 @@ gaim_conv_chat_ignore(chat, name); cbuddy = gaim_conv_chat_cb_new(name, alias, flags); - + add_chat_buddy_common(conv, cbuddy, NULL); g_free(name); g_free(alias); @@ -1524,7 +1517,7 @@ who = g_object_get_data(G_OBJECT(w), "user_data"); mark = get_mark_for_user(gtkconv, who); - + if (mark != NULL) gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); else @@ -3213,8 +3206,7 @@ GaimBlistNode *gnode,*cnode,*bnode; static GList *tmp = NULL; - if (tmp) - g_list_free(tmp); + g_list_free(tmp); tmp = g_list_append(NULL, ""); @@ -4260,8 +4252,8 @@ } } - if (username != NULL) g_free(username); - if (protocol != NULL) g_free(protocol); + g_free(username); + g_free(protocol); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } @@ -4867,8 +4859,7 @@ } } - if(alias_escaped) - g_free(alias_escaped); + g_free(alias_escaped); /* Are we in a chat where we can tell which users are buddies? */ if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && @@ -5069,7 +5060,7 @@ g_return_if_fail(new_alias != NULL); cbuddy = gaim_conv_chat_cb_new(new_name, new_alias, flags); - + add_chat_buddy_common(conv, cbuddy, old_name); } @@ -5176,7 +5167,7 @@ flags = gaim_conv_chat_user_get_flags(chat, user); cbuddy = gaim_conv_chat_cb_new(user, alias, flags); - + add_chat_buddy_common(conv, cbuddy, NULL); g_free(alias); } Modified: branches/v2_0_0/src/gtkdebug.c =================================================================== --- branches/v2_0_0/src/gtkdebug.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkdebug.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -58,9 +58,9 @@ gboolean invert; gboolean highlight; - + guint timer; - + regex_t regex; #else GtkWidget *find; @@ -351,8 +351,8 @@ for(m = 0; m < n_matches; m++) { GtkTextIter ms, me; - - if(matches[m].rm_eo == -1) + + if(matches[m].rm_eo == -1) break; i += offset; @@ -524,7 +524,7 @@ */ if(win->paused) return; - + gtk_tree_model_get(model, iter, 0, &text, -1); if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) { @@ -840,8 +840,7 @@ g_free(new_msg); } - if (new_domain != NULL) - g_free(new_domain); + g_free(new_domain); } #ifdef _WIN32 Modified: branches/v2_0_0/src/gtkft.c =================================================================== --- branches/v2_0_0/src/gtkft.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkft.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -1097,8 +1097,7 @@ data = GAIM_GTKXFER(xfer); if (data) { - if (data->name) - g_free(data->name); + g_free(data->name); g_free(data); xfer->ui_data = NULL; } Modified: branches/v2_0_0/src/gtkimhtml.c =================================================================== --- branches/v2_0_0/src/gtkimhtml.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkimhtml.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -220,7 +220,6 @@ int length; GString *clipboard; gchar *tmp; - gchar *ret; if (html == NULL) return NULL; @@ -238,14 +237,8 @@ g_string_append(clipboard, "<!--StartFragment-->\r\n"); g_string_append(clipboard, html); g_string_append(clipboard, "\r\n<!--EndFragment-->"); - ret = clipboard->str; - g_string_free(clipboard, FALSE); -#if 0 /* Debugging for Windows clipboard */ - gaim_debug_info("imhtml clipboard", "from gaim: %s\n", ret); -#endif - - return ret; + return g_string_free(clipboard, FALSE); } static void clipboard_copy_html_win32(GtkIMHtml *imhtml) { @@ -1248,10 +1241,8 @@ g_list_free(imhtml->scalables); g_slist_free(imhtml->im_images); - if (imhtml->protocol_name) - g_free(imhtml->protocol_name); - if (imhtml->search_string) - g_free(imhtml->search_string); + g_free(imhtml->protocol_name); + g_free(imhtml->search_string); G_OBJECT_CLASS(parent_class)->finalize (object); } @@ -2231,11 +2222,9 @@ e++; } } - g_free(val); - val = ret->str; - g_string_free(ret, FALSE); - return val; + + return g_string_free(ret, FALSE); } static const char *accepted_protocols[] = { @@ -2737,8 +2726,7 @@ gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); ws[0] = '\0'; wpos = 0; /* NEW_BIT(NEW_TEXT_BIT); */ - if (bg) - g_free(bg); + g_free(bg); bg = bgcolor; gtk_imhtml_toggle_background(imhtml, bg); } @@ -2752,8 +2740,7 @@ ws[0] = '\0'; wpos = 0; gtk_imhtml_toggle_link(imhtml, href); } - if (href) - g_free(href); + g_free(href); } break; case 46: /* IMG (opt) */ @@ -3037,14 +3024,10 @@ while (fonts) { GtkIMHtmlFontDetail *font = fonts->data; fonts = g_slist_remove (fonts, font); - if (font->face) - g_free (font->face); - if (font->fore) - g_free (font->fore); - if (font->back) - g_free (font->back); - if (font->sml) - g_free (font->sml); + g_free (font->face); + g_free (font->fore); + g_free (font->back); + g_free (font->sml); g_free (font); } @@ -3082,9 +3065,8 @@ void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name) { - if (imhtml->protocol_name) - g_free(imhtml->protocol_name); - imhtml->protocol_name = protocol_name ? g_strdup(protocol_name) : NULL; + g_free(imhtml->protocol_name); + imhtml->protocol_name = g_strdup(protocol_name); } void @@ -3174,7 +3156,7 @@ im_image->width = gdk_pixbuf_get_width(img); im_image->height = gdk_pixbuf_get_height(img); im_image->mark = NULL; - im_image->filename = filename ? g_strdup(filename) : NULL; + im_image->filename = g_strdup(filename); im_image->id = id; im_image->filesel = NULL; @@ -3441,8 +3423,7 @@ GtkIMHtmlImage *image = (GtkIMHtmlImage *)scale; g_object_unref(image->pixbuf); - if (image->filename) - g_free(image->filename); + g_free(image->filename); if (image->filesel) gtk_widget_destroy(image->filesel); g_free(scale); @@ -3559,8 +3540,7 @@ gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end); gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "search", &start, &end); - if (imhtml->search_string) - g_free(imhtml->search_string); + g_free(imhtml->search_string); imhtml->search_string = NULL; } @@ -3825,7 +3805,7 @@ strncmp(tag->name, "LINK ", 5) == 0 && imhtml->edit.link) { gtk_imhtml_toggle_link(imhtml, NULL); } - } + } } g_slist_free(tags); } @@ -3944,37 +3924,25 @@ char * gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml) { - if (imhtml->edit.fontface) - return g_strdup(imhtml->edit.fontface); - else - return NULL; + return g_strdup(imhtml->edit.fontface); } char * gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml) { - if (imhtml->edit.forecolor) - return g_strdup(imhtml->edit.forecolor); - else - return NULL; + return g_strdup(imhtml->edit.forecolor); } char * gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml) { - if (imhtml->edit.backcolor) - return g_strdup(imhtml->edit.backcolor); - else - return NULL; + return g_strdup(imhtml->edit.backcolor); } char * gtk_imhtml_get_current_background(GtkIMHtml *imhtml) { - if (imhtml->edit.background) - return g_strdup(imhtml->edit.background); - else - return NULL; + return g_strdup(imhtml->edit.background); } gint @@ -4029,15 +3997,15 @@ return; imhtml->edit.bold = imhtml->edit.italic = imhtml->edit.underline = imhtml->edit.strike = FALSE; - if (imhtml->edit.forecolor) - g_free(imhtml->edit.forecolor); + g_free(imhtml->edit.forecolor); imhtml->edit.forecolor = NULL; - if (imhtml->edit.backcolor) - g_free(imhtml->edit.backcolor); + + g_free(imhtml->edit.backcolor); imhtml->edit.backcolor = NULL; - if (imhtml->edit.fontface) - g_free(imhtml->edit.fontface); + + g_free(imhtml->edit.fontface); imhtml->edit.fontface = NULL; + imhtml->edit.fontsize = 0; imhtml->edit.link = NULL; Modified: branches/v2_0_0/src/gtkimhtmltoolbar.c =================================================================== --- branches/v2_0_0/src/gtkimhtmltoolbar.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkimhtmltoolbar.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -878,8 +878,7 @@ toolbar); } - if (toolbar->sml) - free(toolbar->sml); + free(toolbar->sml); gtk_object_sink(GTK_OBJECT(toolbar->tooltips)); G_OBJECT_CLASS(parent_class)->finalize (object); @@ -1132,8 +1131,6 @@ void gtk_imhtmltoolbar_associate_smileys(GtkIMHtmlToolbar *toolbar, const char *proto_id) { - if (toolbar->sml) - g_free(toolbar->sml); - + g_free(toolbar->sml); toolbar->sml = g_strdup(proto_id); } Modified: branches/v2_0_0/src/gtklog.c =================================================================== --- branches/v2_0_0/src/gtklog.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtklog.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -111,8 +111,7 @@ const char *search_term = gtk_entry_get_text(GTK_ENTRY(lv->entry)); GList *logs; - if (lv->search != NULL) - g_free(lv->search); + g_free(lv->search); gtk_tree_store_clear(lv->treestore); if (!(*search_term)) { @@ -154,9 +153,7 @@ lv = g_hash_table_lookup(log_viewers, ht); g_hash_table_remove(log_viewers, ht); - if (ht->screenname != NULL) - g_free(ht->screenname); - + g_free(ht->screenname); g_free(ht); } else syslog_viewer = NULL; @@ -164,10 +161,9 @@ g_list_foreach(lv->logs, (GFunc)gaim_log_free, NULL); g_list_free(lv->logs); - if (lv->search != NULL) - g_free(lv->search); - + g_free(lv->search); g_free(lv); + gtk_widget_destroy(w); return TRUE; Modified: branches/v2_0_0/src/gtkpluginpref.c =================================================================== --- branches/v2_0_0/src/gtkpluginpref.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkpluginpref.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -57,9 +57,6 @@ g_return_if_fail(pref); text = gtk_imhtml_get_markup(imhtml); - - if (!text) - text = ""; gaim_prefs_set_string(pref, text); g_free(text); } Modified: branches/v2_0_0/src/gtkpounce.c =================================================================== --- branches/v2_0_0/src/gtkpounce.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkpounce.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -432,8 +432,8 @@ } } - if (username != NULL) g_free(username); - if (protocol != NULL) g_free(protocol); + g_free(username); + g_free(protocol); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } @@ -1195,7 +1195,7 @@ /* Create the scrolled window */ sw = gtk_scrolled_window_new(0, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); Modified: branches/v2_0_0/src/gtkprefs.c =================================================================== --- branches/v2_0_0/src/gtkprefs.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkprefs.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -1474,7 +1474,7 @@ static gchar* prefs_sound_volume_format(GtkScale *scale, gdouble val) { if(val < 15) { - return g_strdup_printf(_("Quietest")); + return g_strdup_printf(_("Quietest")); } else if(val < 30) { return g_strdup_printf(_("Quieter")); } else if(val < 45) { Modified: branches/v2_0_0/src/gtkprivacy.c =================================================================== --- branches/v2_0_0/src/gtkprivacy.c 2006-08-05 09:19:14 UTC (rev 16644) +++ branches/v2_0_0/src/gtkprivacy.c 2006-08-05 09:54:33 UTC (rev 16645) @@ -7,7 +7,7 @@ * 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 ve... [truncated message content] |
From: <the...@us...> - 2006-08-05 09:19:17
|
Revision: 16644 Author: thekingant Date: 2006-08-05 02:19:14 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16644&view=rev Log Message: ----------- I didn't mean to commit this change. I highly suspect these lines should be removed... but I haven't looked into it. Modified Paths: -------------- trunk/src/protocols/qq/qq.c Modified: trunk/src/protocols/qq/qq.c =================================================================== --- trunk/src/protocols/qq/qq.c 2006-08-05 09:17:09 UTC (rev 16643) +++ trunk/src/protocols/qq/qq.c 2006-08-05 09:19:14 UTC (rev 16644) @@ -946,8 +946,8 @@ { GaimAccountOption *option; - //bindtextdomain(PACKAGE, LOCALEDIR); - //bind_textdomain_codeset(PACKAGE, "UTF-8"); + bindtextdomain(PACKAGE, LOCALEDIR); + bind_textdomain_codeset(PACKAGE, "UTF-8"); option = gaim_account_option_bool_new(_("Login in TCP"), "use_tcp", FALSE); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-05 09:17:13
|
Revision: 16643 Author: thekingant Date: 2006-08-05 02:17:09 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16643&view=rev Log Message: ----------- Return g_string_free(str, FALSE) directly instead of assigning str->str to a temporary directory and returning that. Modified Paths: -------------- trunk/src/gtkimhtml.c trunk/src/util.c Modified: trunk/src/gtkimhtml.c =================================================================== --- trunk/src/gtkimhtml.c 2006-08-05 09:11:46 UTC (rev 16642) +++ trunk/src/gtkimhtml.c 2006-08-05 09:17:09 UTC (rev 16643) @@ -220,7 +220,6 @@ int length; GString *clipboard; gchar *tmp; - gchar *ret; if (html == NULL) return NULL; @@ -238,14 +237,8 @@ g_string_append(clipboard, "<!--StartFragment-->\r\n"); g_string_append(clipboard, html); g_string_append(clipboard, "\r\n<!--EndFragment-->"); - ret = clipboard->str; - g_string_free(clipboard, FALSE); -#if 0 /* Debugging for Windows clipboard */ - gaim_debug_info("imhtml clipboard", "from gaim: %s\n", ret); -#endif - - return ret; + return g_string_free(clipboard, FALSE); } static void clipboard_copy_html_win32(GtkIMHtml *imhtml) { @@ -2229,11 +2222,9 @@ e++; } } - g_free(val); - val = ret->str; - g_string_free(ret, FALSE); - return val; + + return g_string_free(ret, FALSE); } static const char *accepted_protocols[] = { Modified: trunk/src/util.c =================================================================== --- trunk/src/util.c 2006-08-05 09:11:46 UTC (rev 16642) +++ trunk/src/util.c 2006-08-05 09:17:09 UTC (rev 16643) @@ -2026,41 +2026,41 @@ char * gaim_unescape_html(const char *html) { - char *unescaped = NULL; + const char *c; + GString *ret; - if (html != NULL) { - const char *c = html; - GString *ret = g_string_new(""); - while (*c) { - if (!strncmp(c, "&", 5)) { - ret = g_string_append_c(ret, '&'); - c += 5; - } else if (!strncmp(c, "<", 4)) { - ret = g_string_append_c(ret, '<'); - c += 4; - } else if (!strncmp(c, ">", 4)) { - ret = g_string_append_c(ret, '>'); - c += 4; - } else if (!strncmp(c, """, 6)) { - ret = g_string_append_c(ret, '"'); - c += 6; - } else if (!strncmp(c, "'", 6)) { - ret = g_string_append_c(ret, '\''); - c += 6; - } else if (!strncmp(c, "<br>", 4)) { - ret = g_string_append_c(ret, '\n'); - c += 4; - } else { - ret = g_string_append_c(ret, *c); - c++; - } + if (html == NULL) + return NULL; + + c = html; + ret = g_string_new(""); + while (*c) { + if (!strncmp(c, "&", 5)) { + ret = g_string_append_c(ret, '&'); + c += 5; + } else if (!strncmp(c, "<", 4)) { + ret = g_string_append_c(ret, '<'); + c += 4; + } else if (!strncmp(c, ">", 4)) { + ret = g_string_append_c(ret, '>'); + c += 4; + } else if (!strncmp(c, """, 6)) { + ret = g_string_append_c(ret, '"'); + c += 6; + } else if (!strncmp(c, "'", 6)) { + ret = g_string_append_c(ret, '\''); + c += 6; + } else if (!strncmp(c, "<br>", 4)) { + ret = g_string_append_c(ret, '\n'); + c += 4; + } else { + ret = g_string_append_c(ret, *c); + c++; } - - unescaped = ret->str; - g_string_free(ret, FALSE); } - return unescaped; + return g_string_free(ret, FALSE); + } char * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-05 09:11:54
|
Revision: 16642 Author: thekingant Date: 2006-08-05 02:11:46 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16642&view=rev Log Message: ----------- Formatting/whitespace Modified Paths: -------------- trunk/src/mime.c trunk/src/mime.h Modified: trunk/src/mime.c =================================================================== --- trunk/src/mime.c 2006-08-05 08:50:09 UTC (rev 16641) +++ trunk/src/mime.c 2006-08-05 09:11:46 UTC (rev 16642) @@ -1,27 +1,26 @@ - /* - Gaim + * Gaim + * + * 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. + */ - 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 <stdio.h> #include <string.h> @@ -31,493 +30,533 @@ #include <glib/gstring.h> /* this should become "util.h" if we ever get this into gaim proper */ -#include <debug.h> -#include <util.h> - +#include "debug.h" #include "mime.h" +#include "util.h" - -/** @struct mime_fields - - Utility structure used in both MIME document and parts, which maps - field names to their values, and keeps an easily accessible list of - keys -*/ +/** + * @struct mime_fields + * + * Utility structure used in both MIME document and parts, which maps + * field names to their values, and keeps an easily accessible list of + * keys. + */ struct mime_fields { - GHashTable *map; - GList *keys; + GHashTable *map; + GList *keys; }; - struct _GaimMimeDocument { - struct mime_fields fields; - GList *parts; + struct mime_fields fields; + GList *parts; }; - struct _GaimMimePart { - struct mime_fields fields; - struct _GaimMimeDocument *doc; - GString *data; + struct mime_fields fields; + struct _GaimMimeDocument *doc; + GString *data; }; +static void +fields_set(struct mime_fields *mf, const char *key, const char *val) +{ + char *k, *v; -static void fields_set(struct mime_fields *mf, - const char *key, const char *val) { - char *k, *v; + g_return_if_fail(mf != NULL); + g_return_if_fail(mf->map != NULL); - g_return_if_fail(mf != NULL); - g_return_if_fail(mf->map != NULL); + k = g_ascii_strdown(key, -1); + v = g_strdup(val); - k = g_ascii_strdown(key, -1); - v = g_strdup(val); + /* append to the keys list only if it's not already there */ + if(! g_hash_table_lookup(mf->map, k)) { + mf->keys = g_list_append(mf->keys, k); + } - /* append to the keys list only if it's not already there */ - if(! g_hash_table_lookup(mf->map, k)) { - mf->keys = g_list_append(mf->keys, k); - } - - /* important to use insert. If the key is already in the table, then - it's already in the keys list. Insert will free the new instance - of the key rather than the old instance. */ - g_hash_table_insert(mf->map, k, v); + /* important to use insert. If the key is already in the table, then + it's already in the keys list. Insert will free the new instance + of the key rather than the old instance. */ + g_hash_table_insert(mf->map, k, v); } -static const char *fields_get(struct mime_fields *mf, - const char *key) { - char *kdown; - const char *ret; +static const char * +fields_get(struct mime_fields *mf, const char *key) +{ + char *kdown; + const char *ret; - g_return_val_if_fail(mf != NULL, NULL); - g_return_val_if_fail(mf->map != NULL, NULL); + g_return_val_if_fail(mf != NULL, NULL); + g_return_val_if_fail(mf->map != NULL, NULL); - kdown = g_ascii_strdown(key, -1); - ret = g_hash_table_lookup(mf->map, kdown); - g_free(kdown); + kdown = g_ascii_strdown(key, -1); + ret = g_hash_table_lookup(mf->map, kdown); + g_free(kdown); - return ret; + return ret; } -static void fields_init(struct mime_fields *mf) { - g_return_if_fail(mf != NULL); +static void +fields_init(struct mime_fields *mf) +{ + g_return_if_fail(mf != NULL); - mf->map = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); + mf->map = g_hash_table_new_full(g_str_hash, g_str_equal, + g_free, g_free); } -static void fields_loadline(struct mime_fields *mf, - const char *line, gsize len) { +static void +fields_loadline(struct mime_fields *mf, const char *line, gsize len) +{ + /* split the line into key: value */ + char *key, *val; + char **tokens; - /* split the line into key: value */ - char *key, *val; - char **tokens; + /* feh, need it to be NUL terminated */ + key = g_strndup(line, len); - /* feh, need it to be NUL terminated */ - key = g_strndup(line, len); + /* split */ + val = strchr(key, ':'); + if(! val) { + g_free(key); + return; + } + *val++ = '\0'; - /* split */ - val = strchr(key, ':'); - if(! val) { - g_free(key); - return; - } - *val++ = '\0'; + /* normalize whitespace (sorta) and trim on key and value */ + tokens = g_strsplit(key, "\t\r\n", 0); + key = g_strjoinv("", tokens); + key = g_strstrip(key); + g_strfreev(tokens); - /* normalize whitespace (sorta) and trim on key and value */ - tokens = g_strsplit(key, "\t\r\n", 0); - key = g_strjoinv("", tokens); - key = g_strstrip(key); - g_strfreev(tokens); + tokens = g_strsplit(val, "\t\r\n", 0); + val = g_strjoinv("", tokens); + val = g_strstrip(val); + g_strfreev(tokens); - tokens = g_strsplit(val, "\t\r\n", 0); - val = g_strjoinv("", tokens); - val = g_strstrip(val); - g_strfreev(tokens); - - fields_set(mf, key, val); + fields_set(mf, key, val); - g_free(key); - g_free(val); + g_free(key); + g_free(val); } -static void fields_load(struct mime_fields *mf, - char **buf, gsize *len) { - char *tail; +static void +fields_load(struct mime_fields *mf, char **buf, gsize *len) +{ + char *tail; - while( (tail = g_strstr_len(*buf, *len, "\r\n")) ) { - char *line; - gsize ln; + while ((tail = g_strstr_len(*buf, *len, "\r\n"))) + { + char *line; + gsize ln; - /* determine the current line */ - line = *buf; - ln = tail - line; + /* determine the current line */ + line = *buf; + ln = tail - line; - /* advance our search space past the CRLF */ - *buf = tail + 2; - *len -= (ln + 2); + /* advance our search space past the CRLF */ + *buf = tail + 2; + *len -= (ln + 2); - /* empty line, end of headers */ - if(! ln) return; + /* empty line, end of headers */ + if(! ln) return; - /* look out for line continuations */ - if(line[ln-1] == ';') { - tail = g_strstr_len(*buf, *len, "\r\n"); - if(tail) { - gsize cln; + /* look out for line continuations */ + if(line[ln-1] == ';') { + tail = g_strstr_len(*buf, *len, "\r\n"); + if(tail) { + gsize cln; - cln = tail - *buf; - ln = tail - line; + cln = tail - *buf; + ln = tail - line; - /* advance our search space past the CRLF (again) */ - *buf = tail + 2; - *len -= (cln + 2); - } - } + /* advance our search space past the CRLF (again) */ + *buf = tail + 2; + *len -= (cln + 2); + } + } - /* process our super-cool line */ - fields_loadline(mf, line, ln); - } + /* process our super-cool line */ + fields_loadline(mf, line, ln); + } } -static void field_write(const char *key, const char *val, GString *str) { - g_string_append_printf(str, "%s: %s\r\n", key, val); +static void +field_write(const char *key, const char *val, GString *str) +{ + g_string_append_printf(str, "%s: %s\r\n", key, val); } -static void fields_write(struct mime_fields *mf, GString *str) { - g_return_if_fail(mf != NULL); +static void +fields_write(struct mime_fields *mf, GString *str) +{ + g_return_if_fail(mf != NULL); - g_hash_table_foreach(mf->map, (GHFunc) field_write, str); - g_string_append(str, "\r\n"); + g_hash_table_foreach(mf->map, (GHFunc) field_write, str); + g_string_append(str, "\r\n"); } -static void fields_destroy(struct mime_fields *mf) { - g_return_if_fail(mf != NULL); +static void +fields_destroy(struct mime_fields *mf) +{ + g_return_if_fail(mf != NULL); - g_hash_table_destroy(mf->map); - g_list_free(mf->keys); + g_hash_table_destroy(mf->map); + g_list_free(mf->keys); - mf->map = NULL; - mf->keys = NULL; + mf->map = NULL; + mf->keys = NULL; } -static GaimMimePart *part_new(GaimMimeDocument *doc) { - GaimMimePart *part; - - part = g_new0(GaimMimePart, 1); - fields_init(&part->fields); - part->doc = doc; - part->data = g_string_new(NULL); +static GaimMimePart * +part_new(GaimMimeDocument *doc) +{ + GaimMimePart *part; - doc->parts = g_list_prepend(doc->parts, part); + part = g_new0(GaimMimePart, 1); + fields_init(&part->fields); + part->doc = doc; + part->data = g_string_new(NULL); - return part; + doc->parts = g_list_prepend(doc->parts, part); + + return part; } -static void part_load(GaimMimePart *part, - const char *buf, gsize len) { +static void +part_load(GaimMimePart *part, const char *buf, gsize len) +{ - char *b = (char *) buf; - gsize n = len; + char *b = (char *) buf; + gsize n = len; - fields_load(&part->fields, &b, &n); + fields_load(&part->fields, &b, &n); - /* the remainder will have a blank line, if there's anything at all, - so check if there's anything then trim off the trailing four - bytes, \r\n\r\n */ - if(n > 4) n -= 4; - g_string_append_len(part->data, b, n); + /* the remainder will have a blank line, if there's anything at all, + so check if there's anything then trim off the trailing four + bytes, \r\n\r\n */ + if(n > 4) n -= 4; + g_string_append_len(part->data, b, n); } -static void part_write(GaimMimePart *part, GString *str) { - fields_write(&part->fields, str); - g_string_append_printf(str, "%s\r\n\r\n", part->data->str); +static void +part_write(GaimMimePart *part, GString *str) +{ + fields_write(&part->fields, str); + g_string_append_printf(str, "%s\r\n\r\n", part->data->str); } -static void part_free(GaimMimePart *part) { +static void +part_free(GaimMimePart *part) +{ - fields_destroy(&part->fields); + fields_destroy(&part->fields); - g_string_free(part->data, TRUE); - part->data = NULL; + g_string_free(part->data, TRUE); + part->data = NULL; - g_free(part); + g_free(part); } -GaimMimePart *gaim_mime_part_new(GaimMimeDocument *doc) { - g_return_val_if_fail(doc != NULL, NULL); - return part_new(doc); +GaimMimePart * +gaim_mime_part_new(GaimMimeDocument *doc) +{ + g_return_val_if_fail(doc != NULL, NULL); + return part_new(doc); } -const GList *gaim_mime_part_get_fields(GaimMimePart *part) { - g_return_val_if_fail(part != NULL, NULL); - return part->fields.keys; +const GList * +gaim_mime_part_get_fields(GaimMimePart *part) +{ + g_return_val_if_fail(part != NULL, NULL); + return part->fields.keys; } -const char *gaim_mime_part_get_field(GaimMimePart *part, - const char *field) { - - g_return_val_if_fail(part != NULL, NULL); - return fields_get(&part->fields, field); +const char * +gaim_mime_part_get_field(GaimMimePart *part, const char *field) +{ + g_return_val_if_fail(part != NULL, NULL); + return fields_get(&part->fields, field); } -char *gaim_mime_part_get_field_decoded(GaimMimePart *part, - const char *field) { +char * +gaim_mime_part_get_field_decoded(GaimMimePart *part, const char *field) +{ + const char *f; - const char *f; + g_return_val_if_fail(part != NULL, NULL); - g_return_val_if_fail(part != NULL, NULL); - - f = fields_get(&part->fields, field); - return gaim_mime_decode_field(f); + f = fields_get(&part->fields, field); + return gaim_mime_decode_field(f); } -void gaim_mime_part_set_field(GaimMimePart *part, - const char *field, - const char *value) { - g_return_if_fail(part != NULL); - fields_set(&part->fields, field, value); +void +gaim_mime_part_set_field(GaimMimePart *part, const char *field, const char *value) +{ + g_return_if_fail(part != NULL); + fields_set(&part->fields, field, value); } -const char *gaim_mime_part_get_data(GaimMimePart *part) { - g_return_val_if_fail(part != NULL, NULL); - g_return_val_if_fail(part->data != NULL, NULL); +const char * +gaim_mime_part_get_data(GaimMimePart *part) +{ + g_return_val_if_fail(part != NULL, NULL); + g_return_val_if_fail(part->data != NULL, NULL); - return part->data->str; + return part->data->str; } -void gaim_mime_part_get_data_decoded(GaimMimePart *part, - guchar **data, gsize *len) { - const char *enc; +void +gaim_mime_part_get_data_decoded(GaimMimePart *part, guchar **data, gsize *len) +{ + const char *enc; - g_return_if_fail(part != NULL); - g_return_if_fail(data != NULL); - g_return_if_fail(len != NULL); + g_return_if_fail(part != NULL); + g_return_if_fail(data != NULL); + g_return_if_fail(len != NULL); - g_return_if_fail(part->data != NULL); + g_return_if_fail(part->data != NULL); - enc = gaim_mime_part_get_field(part, "content-transfer-encoding"); + enc = gaim_mime_part_get_field(part, "content-transfer-encoding"); - if(! enc) { - *data = (guchar *)g_strdup(part->data->str); - *len = part->data->len; + if(! enc) { + *data = (guchar *)g_strdup(part->data->str); + *len = part->data->len; - } else if(! g_ascii_strcasecmp(enc, "7bit")) { - *data = (guchar *)g_strdup(part->data->str); - *len = part->data->len; + } else if(! g_ascii_strcasecmp(enc, "7bit")) { + *data = (guchar *)g_strdup(part->data->str); + *len = part->data->len; - } else if(! g_ascii_strcasecmp(enc, "8bit")) { - *data = (guchar *)g_strdup(part->data->str); - *len = part->data->len; + } else if(! g_ascii_strcasecmp(enc, "8bit")) { + *data = (guchar *)g_strdup(part->data->str); + *len = part->data->len; - } else if(! g_ascii_strcasecmp(enc, "base16")) { - *data = gaim_base16_decode(part->data->str, len); + } else if(! g_ascii_strcasecmp(enc, "base16")) { + *data = gaim_base16_decode(part->data->str, len); - } else if(! g_ascii_strcasecmp(enc, "base64")) { + } else if(! g_ascii_strcasecmp(enc, "base64")) { *data = gaim_base64_decode(part->data->str, len); - } else if(! g_ascii_strcasecmp(enc, "quoted-printable")) { - *data = gaim_quotedp_decode(part->data->str, len); + } else if(! g_ascii_strcasecmp(enc, "quoted-printable")) { + *data = gaim_quotedp_decode(part->data->str, len); - } else { - gaim_debug_warning("mime", "gaim_mime_part_get_data_decoded:" - " unknown encoding '%s'\n", enc); - *data = NULL; - *len = 0; - } + } else { + gaim_debug_warning("mime", "gaim_mime_part_get_data_decoded:" + " unknown encoding '%s'\n", enc); + *data = NULL; + *len = 0; + } } -gsize gaim_mime_part_get_length(GaimMimePart *part) { - g_return_val_if_fail(part != NULL, 0); - g_return_val_if_fail(part->data != NULL, 0); +gsize +gaim_mime_part_get_length(GaimMimePart *part) +{ + g_return_val_if_fail(part != NULL, 0); + g_return_val_if_fail(part->data != NULL, 0); - return part->data->len; + return part->data->len; } -void gaim_mime_part_set_data(GaimMimePart *part, const char *data) { - g_return_if_fail(part != NULL); - g_string_free(part->data, TRUE); - part->data = g_string_new(data); +void +gaim_mime_part_set_data(GaimMimePart *part, const char *data) +{ + g_return_if_fail(part != NULL); + g_string_free(part->data, TRUE); + part->data = g_string_new(data); } -GaimMimeDocument *gaim_mime_document_new() { - GaimMimeDocument *doc; +GaimMimeDocument * +gaim_mime_document_new() +{ + GaimMimeDocument *doc; - doc = g_new0(GaimMimeDocument, 1); - fields_init(&doc->fields); + doc = g_new0(GaimMimeDocument, 1); + fields_init(&doc->fields); - return doc; + return doc; } -static void doc_parts_load(GaimMimeDocument *doc, - const char *boundary, - const char *buf, gsize len) { +static void +doc_parts_load(GaimMimeDocument *doc, const char *boundary, const char *buf, gsize len) +{ + char *b = (char *) buf; + gsize n = len; - char *b = (char *) buf; - gsize n = len; + const char *bnd; + gsize bl; - const char *bnd; - gsize bl; + bnd = g_strdup_printf("--%s", boundary); + bl = strlen(bnd); - bnd = g_strdup_printf("--%s", boundary); - bl = strlen(bnd); + for(b = g_strstr_len(b, n, bnd); b; ) { + char *tail; - for(b = g_strstr_len(b, n, bnd); b; ) { - char *tail; + /* skip the boundary */ + b += bl; + n -= bl; - /* skip the boundary */ - b += bl; - n -= bl; + /* skip the trailing \r\n or -- as well */ + if(n >= 2) { + b += 2; + n -= 2; + } - /* skip the trailing \r\n or -- as well */ - if(n >= 2) { - b += 2; - n -= 2; - } + /* find the next boundary */ + tail = g_strstr_len(b, n, bnd); - /* find the next boundary */ - tail = g_strstr_len(b, n, bnd); + if(tail) { + gsize sl; - if(tail) { - gsize sl; + sl = tail - b; + if(sl) { + GaimMimePart *part = part_new(doc); + part_load(part, b, sl); + } + } - sl = tail - b; - if(sl) { - GaimMimePart *part = part_new(doc); - part_load(part, b, sl); - } - } - - b = tail; - } + b = tail; + } } -GaimMimeDocument *gaim_mime_document_parsen(const char *buf, gsize len) { +GaimMimeDocument * +gaim_mime_document_parsen(const char *buf, gsize len) +{ + GaimMimeDocument *doc; - GaimMimeDocument *doc; + char *b = (char *) buf; + gsize n = len; - char *b = (char *) buf; - gsize n = len; + g_return_val_if_fail(buf != NULL, NULL); - g_return_val_if_fail(buf != NULL, NULL); + doc = gaim_mime_document_new(); - doc = gaim_mime_document_new(); + if (!len) + return doc; - if(! len) return doc; + fields_load(&doc->fields, &b, &n); - fields_load(&doc->fields, &b, &n); + { + const char *ct = fields_get(&doc->fields, "content-type"); + if(ct && gaim_str_has_prefix(ct, "multipart")) { + char *bd = strrchr(ct, '='); + if(bd++) { + doc_parts_load(doc, bd, b, n); + } + } + } - { - const char *ct = fields_get(&doc->fields, "content-type"); - if(ct && gaim_str_has_prefix(ct, "multipart")) { - char *bd = strrchr(ct, '='); - if(bd++) { - doc_parts_load(doc, bd, b, n); - } - } - } - - return doc; + return doc; } -GaimMimeDocument *gaim_mime_document_parse(const char *buf) { - g_return_val_if_fail(buf != NULL, NULL); - return gaim_mime_document_parsen(buf, strlen(buf)); +GaimMimeDocument * +gaim_mime_document_parse(const char *buf) +{ + g_return_val_if_fail(buf != NULL, NULL); + return gaim_mime_document_parsen(buf, strlen(buf)); } -void gaim_mime_document_write(GaimMimeDocument *doc, GString *str) { - const char *bd = NULL; +void +gaim_mime_document_write(GaimMimeDocument *doc, GString *str) +{ + const char *bd = NULL; - g_return_if_fail(doc != NULL); - g_return_if_fail(str != NULL); + g_return_if_fail(doc != NULL); + g_return_if_fail(str != NULL); - { - const char *ct = fields_get(&doc->fields, "content-type"); - if(ct && gaim_str_has_prefix(ct, "multipart")) { - char *b = strrchr(ct, '='); - if(b++) bd = b; - } - } + { + const char *ct = fields_get(&doc->fields, "content-type"); + if(ct && gaim_str_has_prefix(ct, "multipart")) { + char *b = strrchr(ct, '='); + if(b++) bd = b; + } + } - fields_write(&doc->fields, str); + fields_write(&doc->fields, str); - if(bd) { - GList *l; + if(bd) { + GList *l; - for(l = doc->parts; l; l = l->next) { - g_string_append_printf(str, "--%s\r\n", bd); + for(l = doc->parts; l; l = l->next) { + g_string_append_printf(str, "--%s\r\n", bd); - part_write(l->data, str); + part_write(l->data, str); - if(! l->next) { - g_string_append_printf(str, "--%s--\r\n", bd); - } - } - } + if(! l->next) { + g_string_append_printf(str, "--%s--\r\n", bd); + } + } + } } -const GList *gaim_mime_document_get_fields(GaimMimeDocument *doc) { - g_return_val_if_fail(doc != NULL, NULL); - return doc->fields.keys; +const GList * +gaim_mime_document_get_fields(GaimMimeDocument *doc) +{ + g_return_val_if_fail(doc != NULL, NULL); + return doc->fields.keys; } -const char *gaim_mime_document_get_field(GaimMimeDocument *doc, - const char *field) { - g_return_val_if_fail(doc != NULL, NULL); - return fields_get(&doc->fields, field); +const char * +gaim_mime_document_get_field(GaimMimeDocument *doc, const char *field) +{ + g_return_val_if_fail(doc != NULL, NULL); + return fields_get(&doc->fields, field); } -void gaim_mime_document_set_field(GaimMimeDocument *doc, - const char *field, - const char *value) { - g_return_if_fail(doc != NULL); - fields_set(&doc->fields, field, value); +void +gaim_mime_document_set_field(GaimMimeDocument *doc, const char *field, const char *value) +{ + g_return_if_fail(doc != NULL); + fields_set(&doc->fields, field, value); } -const GList *gaim_mime_document_get_parts(GaimMimeDocument *doc) { - g_return_val_if_fail(doc != NULL, NULL); - return doc->parts; +const GList * +gaim_mime_document_get_parts(GaimMimeDocument *doc) +{ + g_return_val_if_fail(doc != NULL, NULL); + return doc->parts; } -void gaim_mime_document_free(GaimMimeDocument *doc) { - if(! doc) return; +void +gaim_mime_document_free(GaimMimeDocument *doc) +{ + if (!doc) + return; - fields_destroy(&doc->fields); + fields_destroy(&doc->fields); - while(doc->parts) { - part_free(doc->parts->data); - doc->parts = g_list_delete_link(doc->parts, doc->parts); - } + while(doc->parts) { + part_free(doc->parts->data); + doc->parts = g_list_delete_link(doc->parts, doc->parts); + } - g_free(doc); + g_free(doc); } - Modified: trunk/src/mime.h =================================================================== --- trunk/src/mime.h 2006-08-05 08:50:09 UTC (rev 16641) +++ trunk/src/mime.h 2006-08-05 09:11:46 UTC (rev 16642) @@ -1,200 +1,211 @@ - /* - Gaim + * Gaim + * + * 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. + */ - 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_MIME_H #define _GAIM_MIME_H - #include <glib.h> #include <glib/glist.h> +/** + * @file mime.h + * @ingroup core + * + * Rudimentary parsing of multi-part MIME messages into more + * accessible structures. + */ /** - @file mime.h - @ingroup core - - Rudimentary parsing of multi-part MIME messages into more - accessible structures. -*/ - - -/** @typedef GaimMimeDocument - A MIME document + * @typedef GaimMimeDocument A MIME document. */ typedef struct _GaimMimeDocument GaimMimeDocument; - -/** @typedef GaimMimePart - A part of a multipart MIME document +/** + * @typedef GaimMimePart A part of a multipart MIME document. */ typedef struct _GaimMimePart GaimMimePart; - -/** Allocate an empty MIME document */ +/** + * Allocate an empty MIME document. + */ GaimMimeDocument *gaim_mime_document_new(void); - -/** Frees memory used in a MIME document and all of its parts and fields - @param doc the MIME document to free +/** + * Frees memory used in a MIME document and all of its parts and fields + * + * @param doc The MIME document to free. */ void gaim_mime_document_free(GaimMimeDocument *doc); - -/** Parse a MIME document from a NUL-terminated string - @param buf the NULL-terminated string containing the MIME-encoded data - @returns MIME document +/** + * Parse a MIME document from a NUL-terminated string. + * + * @param buf The NULL-terminated string containing the MIME-encoded data. + * + * @returns A MIME document. */ GaimMimeDocument *gaim_mime_document_parse(const char *buf); - -/** Parse a MIME document from a string - @param buf the string containing the MIME-encoded data - @param len length of buf - @returns MIME document +/** + * Parse a MIME document from a string + * + * @param buf The string containing the MIME-encoded data. + * @param len Length of buf. + * + * @returns A MIME document. */ GaimMimeDocument *gaim_mime_document_parsen(const char *buf, gsize len); - -/** Write (append) a MIME document onto a GString */ +/** + * Write (append) a MIME document onto a GString. + */ void gaim_mime_document_write(GaimMimeDocument *doc, GString *str); - -/** The list of fields in the header of a document - - @param doc the MIME document - @returns list of strings indicating the fields (but not the values of - the fields) in the header of doc -*/ +/** + * The list of fields in the header of a document + * + * @param doc The MIME document. + * + * @returns A list of strings indicating the fields (but not the values of + * the fields) in the header of doc. + */ const GList *gaim_mime_document_get_fields(GaimMimeDocument *doc); - -/** Get the value of a specific field in the header of a document - - @param doc the MIME document - @param field case-insensitive field name - @returns value associated with the indicated header field, or - NULL if the field doesn't exist -*/ +/** + * Get the value of a specific field in the header of a document. + * + * @param doc The MIME document. + * @param field Case-insensitive field name. + * + * @returns Value associated with the indicated header field, or + * NULL if the field doesn't exist. + */ const char *gaim_mime_document_get_field(GaimMimeDocument *doc, const char *field); - -/** Set or replace the value of a specific field in the header of a - document - - @param doc the MIME document - @param field case-insensitive field name - @param value value to associate with the indicated header field, - of NULL to remove the field -*/ +/** + * Set or replace the value of a specific field in the header of a + * document. + * + * @param doc The MIME document. + * @param field Case-insensitive field name. + * @param value Value to associate with the indicated header field, + * of NULL to remove the field. + */ void gaim_mime_document_set_field(GaimMimeDocument *doc, const char *field, const char *value); - -/** The list of parts in a multipart document - - @param doc the MIME document - @returns list of GaimMimePart contained within doc -*/ +/** + * The list of parts in a multipart document. + * + * @param doc The MIME document. + * + * @returns List of GaimMimePart contained within doc. + */ const GList *gaim_mime_document_get_parts(GaimMimeDocument *doc); - -/** Create and insert a new part into a MIME document - - @param doc the new part's parent MIME document +/** + * Create and insert a new part into a MIME document. + * + * @param doc The new part's parent MIME document. */ GaimMimePart *gaim_mime_part_new(GaimMimeDocument *doc); -/** The list of fields in the header of a document part - - @param part the MIME document part - @returns list of strings indicating the fields (but not the values - of the fields) in the header of part -*/ +/** + * The list of fields in the header of a document part. + * + * @param part The MIME document part. + * + * @returns List of strings indicating the fields (but not the values + * of the fields) in the header of part. + */ const GList *gaim_mime_part_get_fields(GaimMimePart *part); -/** Get the value of a specific field in the header of a document part - - @param part the MIME document part - @param field case-insensitive name of the header field - @returns value of the specified header field, or NULL if the - field doesn't exist -*/ +/** + * Get the value of a specific field in the header of a document part. + * + * @param part The MIME document part. + * @param field Case-insensitive name of the header field. + * + * @returns Value of the specified header field, or NULL if the + * field doesn't exist. + */ const char *gaim_mime_part_get_field(GaimMimePart *part, const char *field); - -/** Get the decoded value of a specific field in the header of a - document part */ +/** + * Get the decoded value of a specific field in the header of a + * document part. + */ char *gaim_mime_part_get_field_decoded(GaimMimePart *part, const char *field); - -/** Set or replace the value of a specific field in the header of a - document - @param part the part of the MIME document - @param field case-insensitive field name - @param value value to associate with the indicated header field, - of NULL to remove the field -*/ +/** + * Set or replace the value of a specific field in the header of a + * document. + * + * @param part The part of the MIME document. + * @param field Case-insensitive field name + * @param value Value to associate with the indicated header field, + * of NULL to remove the field. + */ void gaim_mime_part_set_field(GaimMimePart *part, const char *field, const char *value); - -/** Get the (possibly encoded) data portion of a MIME document part - @param part the MIME document part - @returns NULL-terminated data found in the document part +/** + * Get the (possibly encoded) data portion of a MIME document part. + * + * @param part The MIME document part. + * + * @returns NULL-terminated data found in the document part */ const char *gaim_mime_part_get_data(GaimMimePart *part); - -/** Get the data portion of a MIME document part, after attempting to - decode it according to the content-transfer-encoding field. If the - specified encoding method is not supported, this function will - return NULL. - - @param part the MIME documemt part - @param data Buffer for the data - @param len The length of the buffer -*/ +/** + * Get the data portion of a MIME document part, after attempting to + * decode it according to the content-transfer-encoding field. If the + * specified encoding method is not supported, this function will + * return NULL. + * + * @param part The MIME documemt part. + * @param data Buffer for the data. + * @param len The length of the buffer. + */ void gaim_mime_part_get_data_decoded(GaimMimePart *part, guchar **data, gsize *len); - -/** Get the length of the data portion of a MIME document part - - @param part the MIME document part - @returns length of the data in the document part -*/ +/** + * Get the length of the data portion of a MIME document part. + * + * @param part The MIME document part. + * @returns Length of the data in the document part. + */ gsize gaim_mime_part_get_length(GaimMimePart *part); - void gaim_mime_part_set_data(GaimMimePart *part, const char *data); - #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-05 08:50:12
|
Revision: 16641 Author: thekingant Date: 2006-08-05 01:50:09 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16641&view=rev Log Message: ----------- Remove the old src/gaim-socket.h and src/socket.c from Subversion Removed Paths: ------------- trunk/src/gaim-socket.h trunk/src/socket.c Deleted: trunk/src/gaim-socket.h =================================================================== --- trunk/src/gaim-socket.h 2006-08-05 08:45:20 UTC (rev 16640) +++ trunk/src/gaim-socket.h 2006-08-05 08:50:09 UTC (rev 16641) @@ -1,45 +0,0 @@ -/* - * gaim-remote - * - * 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_GAIM_SOCKET_H_ -#define _GAIM_GAIM_SOCKET_H_ - -struct gaim_cui_packet { - guchar type; - guchar subtype; - guint32 length; - char *data; -}; - - -void cui_send_packet (int fd, struct gaim_cui_packet *p); -gint gaim_connect_to_session(gint session); -gboolean gaim_session_exists(int sess); - -struct gaim_cui_packet *cui_packet_new(guchar type, guchar subtype); -void cui_packet_free(struct gaim_cui_packet *p); -void cui_packet_append_string(struct gaim_cui_packet *p, char *str); -void cui_packet_append_char(struct gaim_cui_packet *p, char c); -void cui_packet_append_raw(struct gaim_cui_packet *p, char *str, int len); - - -#endif /* _GAIM_GAIM_SOCKET_H_ */ Deleted: trunk/src/socket.c =================================================================== --- trunk/src/socket.c 2006-08-05 08:45:20 UTC (rev 16640) +++ trunk/src/socket.c 2006-08-05 08:50:09 UTC (rev 16641) @@ -1,168 +0,0 @@ -/* - * gaim-remote - * - * 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 - * - */ - -/* Somewhat inspired by XMMS*/ - -/* This provides code for connecting to a Gaim socket and communicating with - * it. It will eventually be made a library once the core and ui are split. */ - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/un.h> -#include <unistd.h> -#include "gaim-socket.h" - -void cui_send_packet (int fd, struct gaim_cui_packet *p) { - int len = sizeof(p->type) + sizeof(p->subtype) + sizeof(p->length) + p->length; - char *pack = g_malloc(len); - char *a = pack; - memcpy (a, &(p->type), sizeof(p->type)); - a = a + sizeof(p->type); - memcpy (a, &(p->subtype), sizeof(p->subtype)); - a = a + sizeof(p->subtype); - memcpy (a, &(p->length), sizeof(p->length)); - a = a + sizeof(p->length); - memcpy (a, p->data, p->length); - write(fd, pack, len); - g_free(pack); -} - - -void cui_packet_append_string(struct gaim_cui_packet *p, char *str) { - int len = p->length + strlen(str); - char *k = g_malloc(len); - memcpy(k, p->data, p->length); - memcpy(k + p->length, str, strlen(str)); - if (p->data) - g_free(p->data); - p->data = k; - p->length = len; -} - -void cui_packet_append_char(struct gaim_cui_packet *p, char c) { - int len = p->length + sizeof(char); - char *k = g_malloc(len); - memcpy(k, p->data, p->length); - k[p->length] = c; - if (p->data) - g_free(p->data); - p->data = k; - p->length = len; -} - -void cui_packet_append_raw(struct gaim_cui_packet *p, char *str, int len) { - int lent = p->length + len; - char *k = g_malloc(lent); - memcpy(k, p->data, p->length); - memcpy(k + p->length, str, len); - if (p->data) - g_free(p->data); - p->data = k; - p->length = lent; -} - -struct gaim_cui_packet *cui_packet_new(guchar type, guchar subtype) { - struct gaim_cui_packet *p = g_new0(struct gaim_cui_packet, 1); - p->type = type; - p->subtype = subtype; - p->length = 0; - p->data = NULL; - return p; -} - -void cui_packet_free(struct gaim_cui_packet *p) { - if (p->data) - g_free(p->data); - g_free(p); -} - -struct gaim_cui_packet *cui_read_packet(int fd) { - struct gaim_cui_packet *p = g_new0(struct gaim_cui_packet, 1); - char *data = NULL; - - if (!(read(fd, &p->type, sizeof(p->type)))) { - g_free(p); - return NULL; - } - - - if (!(read(fd, &p->subtype, sizeof(p->subtype)))) { - g_free(p); - return NULL; - } - - - if (!(read(fd, &p->length, sizeof(p->length)))) { - g_free(p); - return NULL; - } - - if (p->length) { - data = g_malloc(p->length); - if (!(read(fd, data, p->length))) { - g_free(p); - return NULL; - } - } - p->data = data; - return p; -} - -/* copied directly from xmms_connect_to_session */ -gint gaim_connect_to_session(gint session) -{ - gint fd; - uid_t stored_uid, euid; - struct sockaddr_un saddr; - - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) - { - saddr.sun_family = AF_UNIX; - stored_uid = getuid(); - euid = geteuid(); - setuid(euid); - sprintf(saddr.sun_path, "%s/gaim_%s.%d", g_get_tmp_dir(), g_get_user_name(), session); - setreuid(stored_uid, euid); - if (connect(fd, (struct sockaddr *) &saddr, sizeof (saddr)) != -1) - return fd; - } - close(fd); - return -1; -} - -gboolean gaim_session_exists(int sess) -{ - struct gaim_cui_packet *pack = NULL; - - int fd = gaim_connect_to_session(sess); - if (fd > 0) { - pack = cui_packet_new(CUI_TYPE_META, CUI_META_PING); - cui_send_packet(fd, pack); - cui_packet_free(pack); - close(fd); - } else { - return FALSE; - } - return TRUE; -} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-05 08:45:25
|
Revision: 16640 Author: thekingant Date: 2006-08-05 01:45:20 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16640&view=rev Log Message: ----------- Remove the Napster PRPL Modified Paths: -------------- trunk/ChangeLog trunk/Makefile.mingw trunk/configure.ac trunk/pixmaps/status/default/Makefile.am trunk/po/POTFILES.in trunk/src/protocols/Makefile.am Removed Paths: ------------- trunk/pixmaps/status/default/napster.png trunk/src/protocols/napster/ Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-08-05 08:29:11 UTC (rev 16639) +++ trunk/ChangeLog 2006-08-05 08:45:20 UTC (rev 16640) @@ -152,6 +152,7 @@ * SIP/SIMPLE support (Thomas Butter, Google Summer of Code) * Sametime protocol support Requires the meanwhile library: http://meanwhile.sourceforge.net + * Removed support for the napster and toc protocols Other Noteworthy Changes: * UPnP and NAT traversal support (Adam J. Warrington, Google Summer of Modified: trunk/Makefile.mingw =================================================================== --- trunk/Makefile.mingw 2006-08-05 08:29:11 UTC (rev 16639) +++ trunk/Makefile.mingw 2006-08-05 08:45:20 UTC (rev 16640) @@ -21,7 +21,6 @@ TOC = $(GAIM_PROTOS)/toc IRC = $(GAIM_PROTOS)/irc JABBER = $(GAIM_PROTOS)/jabber -NAPSTER = $(GAIM_PROTOS)/napster GG = $(GAIM_PROTOS)/gg NOVELL = $(GAIM_PROTOS)/novell SILC = $(GAIM_PROTOS)/silc Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2006-08-05 08:29:11 UTC (rev 16639) +++ trunk/configure.ac 2006-08-05 08:45:20 UTC (rev 16640) @@ -1777,7 +1777,6 @@ src/protocols/irc/Makefile src/protocols/jabber/Makefile src/protocols/msn/Makefile - src/protocols/napster/Makefile src/protocols/novell/Makefile src/protocols/oscar/Makefile src/protocols/qq/Makefile Modified: trunk/pixmaps/status/default/Makefile.am =================================================================== --- trunk/pixmaps/status/default/Makefile.am 2006-08-05 08:29:11 UTC (rev 16639) +++ trunk/pixmaps/status/default/Makefile.am 2006-08-05 08:45:20 UTC (rev 16640) @@ -26,7 +26,6 @@ male.png \ meanwhile.png \ msn.png \ - napster.png \ notauthorized.png \ novell.png \ occupied.png \ Deleted: trunk/pixmaps/status/default/napster.png =================================================================== (Binary files differ) Modified: trunk/po/POTFILES.in =================================================================== --- trunk/po/POTFILES.in 2006-08-05 08:29:11 UTC (rev 16639) +++ trunk/po/POTFILES.in 2006-08-05 08:45:20 UTC (rev 16640) @@ -108,7 +108,6 @@ src/protocols/msn/state.c src/protocols/msn/switchboard.c src/protocols/msn/userlist.c -src/protocols/napster/napster.c src/protocols/novell/nmuser.c src/protocols/novell/novell.c src/protocols/oscar/flap_connection.c Modified: trunk/src/protocols/Makefile.am =================================================================== --- trunk/src/protocols/Makefile.am 2006-08-05 08:29:11 UTC (rev 16639) +++ trunk/src/protocols/Makefile.am 2006-08-05 08:45:20 UTC (rev 16640) @@ -1,3 +1,3 @@ -DIST_SUBDIRS = bonjour gg irc jabber msn napster novell oscar qq sametime silc toc simple yahoo zephyr +DIST_SUBDIRS = bonjour gg irc jabber msn novell oscar qq sametime silc toc simple yahoo zephyr SUBDIRS = $(DYNAMIC_PRPLS) $(STATIC_PRPLS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-05 08:29:13
|
Revision: 16639 Author: thekingant Date: 2006-08-05 01:29:11 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16639&view=rev Log Message: ----------- Add doc/gntgaim.1 to the svn:ignore property Property Changed: ---------------- trunk/doc/ Property changes on: trunk/doc ___________________________________________________________________ Name: svn:ignore - Makefile.in Makefile html gaim.1 gaim-remote.1 + Makefile.in Makefile html gaim.1 gaim-remote.1 gntgaim.1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-05 08:27:51
|
Revision: 16638 Author: thekingant Date: 2006-08-05 01:27:39 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16638&view=rev Log Message: ----------- A bunch of small changes. Mostly remove "if not null" checks before calling g_free, g_list_free, g_slist_free and g_strdup. Also use g_list_foreach() to call g_free to free strings in an array. And some whitespace changes here and there. Modified Paths: -------------- trunk/plugins/codeinline.c trunk/plugins/contact_priority.c trunk/plugins/dbus-example.c trunk/plugins/history.c trunk/plugins/log_reader.c trunk/plugins/timestamp.c trunk/src/account.c trunk/src/accountopt.c trunk/src/blist.c trunk/src/buddyicon.c trunk/src/cipher.c trunk/src/cmds.c trunk/src/connection.c trunk/src/conversation.c trunk/src/core.c trunk/src/dbus-define-api.h trunk/src/dbus-server.h trunk/src/dbus-useful.c trunk/src/dbus-useful.h trunk/src/ft.c trunk/src/gaim-client-example.c trunk/src/gaim-client.c trunk/src/gtkaccount.c trunk/src/gtkblist.c trunk/src/gtkconv.c trunk/src/gtkdebug.c trunk/src/gtkft.c trunk/src/gtkimhtml.c trunk/src/gtkimhtmltoolbar.c trunk/src/gtklog.c trunk/src/gtkpluginpref.c trunk/src/gtkpounce.c trunk/src/gtkprefs.c trunk/src/gtkprivacy.c trunk/src/gtkrequest.c trunk/src/gtkroomlist.c trunk/src/gtksound.c trunk/src/gtkstatusbox.c trunk/src/gtkthemes.c trunk/src/gtkutils.c trunk/src/imgstore.c trunk/src/log.c trunk/src/notify.c trunk/src/plugin.c trunk/src/pluginpref.c trunk/src/pounce.c trunk/src/prefs.c trunk/src/protocols/oscar/oscar.c trunk/src/protocols/qq/qq.c trunk/src/proxy.c trunk/src/prpl.c trunk/src/request.c trunk/src/roomlist.c trunk/src/server.c trunk/src/signals.c trunk/src/socket.c trunk/src/status.c trunk/src/util.c trunk/src/value.c trunk/src/whiteboard.c trunk/src/xmlnode.c Property Changed: ---------------- trunk/plugins/codeinline.c Modified: trunk/plugins/codeinline.c =================================================================== --- trunk/plugins/codeinline.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/plugins/codeinline.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -48,12 +48,12 @@ static gboolean plugin_load(GaimPlugin *plugin) -{ +{ void *handle = gaim_conversations_get_handle(); plugin_handle = plugin; - gaim_signal_connect(handle, "writing-im-msg", plugin, + gaim_signal_connect(handle, "writing-im-msg", plugin, GAIM_CALLBACK(outgoing_msg_cb), NULL); - + return TRUE; } Property changes on: trunk/plugins/codeinline.c ___________________________________________________________________ Name: svn:executable - * Modified: trunk/plugins/contact_priority.c =================================================================== --- trunk/plugins/contact_priority.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/plugins/contact_priority.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -99,12 +99,12 @@ hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - + label = gtk_label_new_with_mnemonic(_(statuses[i].description)); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_size_group_add_widget(sg, label); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - + adj = gtk_adjustment_new(gaim_prefs_get_int(pref), -500, 500, 1, 1, 1); spin = gtk_spin_button_new((GtkAdjustment *)adj, 1, 0); g_signal_connect(G_OBJECT(spin), "value-changed", G_CALLBACK(pref_update), pref); Modified: trunk/plugins/dbus-example.c =================================================================== --- trunk/plugins/dbus-example.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/plugins/dbus-example.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -51,7 +51,7 @@ #include "dbus-bindings.h" typedef struct { - char *text; + char *text; } GaimText; /* This makes the structure GaimText visible to the gaim-dbus type @@ -59,7 +59,7 @@ on, we will be able to register pointers to structures of this type. You to dbus-define types you want to be directly accessible by external applications. */ -GAIM_DBUS_DEFINE_TYPE(GaimText) +GAIM_DBUS_DEFINE_TYPE(GaimText) /* Here we make four functions accessible to other applications by DBus. These functions can access types defined in gaim proper @@ -78,30 +78,30 @@ static GaimText hello; /* Here come the definitions of the four exported functions. */ -GaimText* dbus_example_get_hello_object(void) +GaimText* dbus_example_get_hello_object(void) { - return &hello; + return &hello; } -void dbus_example_set_text(GaimText *obj, const char *text) +void dbus_example_set_text(GaimText *obj, const char *text) { - if (obj != NULL) { - g_free(obj->text); - obj->text = g_strdup(text); - } + if (obj != NULL) { + g_free(obj->text); + obj->text = g_strdup(text); + } } -const char *dbus_example_get_text(GaimText *obj) +const char *dbus_example_get_text(GaimText *obj) { - if (obj != NULL) - return obj->text; - else - return NULL; + if (obj != NULL) + return obj->text; + else + return NULL; } -const char *dbus_example_get_buddy_name(GaimBuddy *buddy) +const char *dbus_example_get_buddy_name(GaimBuddy *buddy) { - return gaim_buddy_get_name(buddy); + return gaim_buddy_get_name(buddy); } /* And now standard plugin stuff */ @@ -111,33 +111,33 @@ { GAIM_DBUS_RETURN_FALSE_IF_DISABLED(plugin); - /* First, we have to register our four exported functions with the - main gaim dbus loop. Without this statement, the gaim dbus - code wouldn't know about our functions. */ - GAIM_DBUS_REGISTER_BINDINGS(plugin); + /* First, we have to register our four exported functions with the + main gaim dbus loop. Without this statement, the gaim dbus + code wouldn't know about our functions. */ + GAIM_DBUS_REGISTER_BINDINGS(plugin); - /* Then, we register the hello object of type GaimText. Note that - pointer registrations / unregistrations are completely dynamic; - they don't have to be made when the plugin is loaded / - unloaded. Without this statement the dbus gaim code wouldn't - know about the hello object. */ - GAIM_DBUS_REGISTER_POINTER(&hello, GaimText); + /* Then, we register the hello object of type GaimText. Note that + pointer registrations / unregistrations are completely dynamic; + they don't have to be made when the plugin is loaded / + unloaded. Without this statement the dbus gaim code wouldn't + know about the hello object. */ + GAIM_DBUS_REGISTER_POINTER(&hello, GaimText); - hello.text = g_strdup("Hello."); - - return TRUE; + hello.text = g_strdup("Hello."); + + return TRUE; } static gboolean plugin_unload(GaimPlugin *plugin) { - g_free(hello.text); + g_free(hello.text); - /* It is necessary to unregister all pointers registered by the module. */ - GAIM_DBUS_UNREGISTER_POINTER(&hello); + /* It is necessary to unregister all pointers registered by the module. */ + GAIM_DBUS_UNREGISTER_POINTER(&hello); - return TRUE; + return TRUE; } static GaimPluginInfo info = Modified: trunk/plugins/history.c =================================================================== --- trunk/plugins/history.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/plugins/history.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -90,7 +90,7 @@ if (logs == NULL) logs = gaim_log_get_logs(GAIM_LOG_IM, name, account); else - logs = g_list_sort(logs, gaim_log_compare); + logs = g_list_sort(logs, gaim_log_compare); } else if (convtype == GAIM_CONV_TYPE_CHAT) { Modified: trunk/plugins/log_reader.c =================================================================== --- trunk/plugins/log_reader.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/plugins/log_reader.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -300,7 +300,7 @@ if (!data->path || stat(data->path, &st)) st.st_size = 0; - + return st.st_size; } @@ -399,7 +399,7 @@ g_return_val_if_fail(log != NULL, g_strdup("")); data = log->logger_data; - + /* TODO: Do something here. */ return g_strdup(""); } Modified: trunk/plugins/timestamp.c =================================================================== --- trunk/plugins/timestamp.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/plugins/timestamp.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -120,7 +120,7 @@ gaim_conversation_set_data(conv, "timestamp-initialized", GINT_TO_POINTER(TRUE)); gaim_conversation_set_data(conv, "timestamp-enabled", GINT_TO_POINTER(TRUE)); gaim_conversation_set_data(conv, "timestamp-conv-active", GINT_TO_POINTER(TRUE)); - gtk_text_buffer_create_tag (buffer, "TIMESTAMP", "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, + gtk_text_buffer_create_tag (buffer, "TIMESTAMP", "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, "weight", PANGO_WEIGHT_BOLD, NULL); do_timestamp(conv); } Modified: trunk/src/account.c =================================================================== --- trunk/src/account.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/account.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -792,8 +792,7 @@ { GaimAccountSetting *setting = (GaimAccountSetting *)data; - if (setting->ui != NULL) - g_free(setting->ui); + g_free(setting->ui); if (setting->type == GAIM_PREF_STRING) g_free(setting->value.string); @@ -1178,7 +1177,7 @@ g_return_if_fail(account != NULL); g_free(account->username); - account->username = (username == NULL ? NULL : g_strdup(username)); + account->username = g_strdup(username); schedule_accounts_save(); } @@ -1189,8 +1188,7 @@ g_return_if_fail(account != NULL); g_free(account->password); - account->password = NULL; - account->password = (password == NULL ? NULL : g_strdup(password)); + account->password = g_strdup(password); schedule_accounts_save(); } @@ -1212,7 +1210,7 @@ { char *old = account->alias; - account->alias = (alias == NULL ? NULL : g_strdup(alias)); + account->alias = g_strdup(alias); gaim_signal_emit(gaim_accounts_get_handle(), "account-alias-changed", account, old); g_free(old); @@ -1227,7 +1225,7 @@ g_return_if_fail(account != NULL); g_free(account->user_info); - account->user_info = (user_info == NULL ? NULL : g_strdup(user_info)); + account->user_info = g_strdup(user_info); schedule_accounts_save(); } @@ -1263,7 +1261,7 @@ } g_free(account->buddy_icon); - account->buddy_icon = (icon == NULL ? NULL : g_strdup(icon)); + account->buddy_icon = g_strdup(icon); if (gaim_account_is_connected(account)) { char *filename = gaim_buddy_icons_get_full_path(icon); @@ -1362,11 +1360,7 @@ /* Old with the old... */ if (account->status_types != NULL) { - GList *l; - - for (l = account->status_types; l != NULL; l = l->next) - gaim_status_type_destroy((GaimStatusType *)l->data); - + g_list_foreach(account->status_types, (GFunc)gaim_status_type_destroy, NULL); g_list_free(account->status_types); } Modified: trunk/src/accountopt.c =================================================================== --- trunk/src/accountopt.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/accountopt.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -87,8 +87,7 @@ if (option == NULL) return NULL; - if (default_value != NULL) - option->default_value.string = g_strdup(default_value); + option->default_value.string = g_strdup(default_value); return option; } @@ -159,10 +158,8 @@ g_return_if_fail(option != NULL); g_return_if_fail(option->type == GAIM_PREF_STRING); - if (option->default_value.string != NULL) - g_free(option->default_value.string); - - option->default_value.string = (value == NULL ? NULL : g_strdup(value)); + g_free(option->default_value.string); + option->default_value.string = g_strdup(value); } void @@ -310,8 +307,7 @@ split->text = g_strdup(text); split->field_sep = sep; - split->default_value = (default_value == NULL - ? NULL : g_strdup(default_value)); + split->default_value = g_strdup(default_value); return split; } @@ -321,12 +317,8 @@ { g_return_if_fail(split != NULL); - if (split->text != NULL) - g_free(split->text); - - if (split->default_value != NULL) - g_free(split->default_value); - + g_free(split->text); + g_free(split->default_value); g_free(split); } Modified: trunk/src/blist.c =================================================================== --- trunk/src/blist.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/blist.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -627,21 +627,21 @@ if (!gaim_account_is_connected(buddy->account)) continue; - if (new_priority == NULL) - new_priority = buddy; - else - { - int cmp; + if (new_priority == NULL) + new_priority = buddy; + else + { + int cmp; cmp = gaim_presence_compare(gaim_buddy_get_presence(new_priority), gaim_buddy_get_presence(buddy)); - if (cmp > 0 || (cmp == 0 && + if (cmp > 0 || (cmp == 0 && gaim_prefs_get_bool("/core/contact/last_match"))) - { - new_priority = buddy; - } - } + { + new_priority = buddy; + } + } } contact->priority = new_priority; @@ -1055,7 +1055,7 @@ /* Make a list of what the groups each buddy is in */ for(cur = buddies; cur; cur = cur->next) { GaimBlistNode *node = (GaimBlistNode *)cur->data; - groups = g_list_append(groups, node->parent->parent); + groups = g_list_prepend(groups, node->parent->parent); } gaim_account_remove_buddies(account, buddies, groups); @@ -2037,7 +2037,7 @@ const char *gaim_chat_get_name(GaimChat *chat) { struct proto_chat_entry *pce; - GList *parts, *tmp; + GList *parts; char *ret; g_return_val_if_fail(chat != NULL, NULL); @@ -2048,8 +2048,7 @@ parts = GAIM_PLUGIN_PROTOCOL_INFO(chat->account->gc->prpl)->chat_info(chat->account->gc); pce = parts->data; ret = g_hash_table_lookup(chat->components, pce->identifier); - for (tmp = parts; tmp; tmp = tmp->next) - g_free(tmp->data); + g_list_foreach(parts, (GFunc)g_free, NULL); g_list_free(parts); return ret; Modified: trunk/src/buddyicon.c =================================================================== --- trunk/src/buddyicon.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/buddyicon.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -312,7 +312,6 @@ g_return_if_fail(username != NULL); g_free(icon->username); - icon->username = g_strdup(username); } @@ -480,7 +479,6 @@ g_return_if_fail(dir != NULL); g_free(cache_dir); - cache_dir = g_strdup(dir); } Modified: trunk/src/cipher.c =================================================================== --- trunk/src/cipher.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/cipher.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -10,7 +10,7 @@ * * Original md4 taken from linux kernel * MD4 Message Digest Algorithm (RFC1320). - * + * * Implementation derived from Andrew Tridgell and Steve French's * CIFS MD4 implementation, and the cryptoapi implementation * originally based on the public domain implementation written @@ -26,16 +26,16 @@ * * des.c - DES and Triple-DES encryption/decryption Algorithm * Copyright (C) 1998 Free Software Foundation, Inc. - * + * * Please see below for more legal information! - * + * * According to the definition of DES in FIPS PUB 46-2 from December 1993. * For a description of triple encryption, see: * Bruce Schneier: Applied Cryptography. Second Edition. * John Wiley & Sons, 1996. ISBN 0-471-12845-7. Pages 358 ff. - * + * * This file is part of GnuPG. - * + * * 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 Modified: trunk/src/cmds.c =================================================================== --- trunk/src/cmds.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/cmds.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -71,9 +71,9 @@ c->args = g_strdup(args); c->priority = p; c->flags = f; - c->prpl_id = prpl_id ? g_strdup(prpl_id) : NULL; + c->prpl_id = g_strdup(prpl_id); c->func = func; - c->help = helpstr ? g_strdup(helpstr) : NULL; + c->help = g_strdup(helpstr); c->data = data; cmds = g_list_insert_sorted(cmds, c, (GCompareFunc)cmds_compare_func); @@ -85,11 +85,8 @@ { g_free(c->cmd); g_free(c->args); - if (c->prpl_id) - g_free(c->prpl_id); - if (c->help) - g_free(c->help); - + g_free(c->prpl_id); + g_free(c->help); g_free(c); } @@ -109,6 +106,10 @@ } } +/** + * This sets args to a NULL-terminated array of strings. It should + * be freed using g_strfreev(). + */ static gboolean gaim_cmd_parse_args(GaimCmd *cmd, const gchar *s, const gchar *m, gchar ***args) { int i; @@ -142,7 +143,7 @@ (*args)[i] = gaim_markup_slice(m, g_utf8_pointer_to_offset(s, cur), g_utf8_pointer_to_offset(s, end)); cur = end +1; } - break; + break; case 's': (*args)[i] = g_strdup(cur); cur = cur + strlen(cur); @@ -160,15 +161,6 @@ return TRUE; } -static void gaim_cmd_free_args(gchar **args) -{ - int i; - - for (i = 0; args[i]; i++) - g_free(args[i]); - g_free(args); -} - static void gaim_cmd_strip_current_char(gunichar c, char *s, guint len) { int bytes; @@ -260,7 +252,7 @@ /* this checks the allow bad args flag for us */ if (!gaim_cmd_parse_args(c, rest, mrest, &args)) { - gaim_cmd_free_args(args); + g_strfreev(args); args = NULL; continue; } @@ -268,10 +260,9 @@ tried_cmd = TRUE; ret = c->func(conv, cmd, args, &err, c->data); if (ret == GAIM_CMD_RET_CONTINUE) { - if (err) - g_free(err); + g_free(err); err = NULL; - gaim_cmd_free_args(args); + g_strfreev(args); args = NULL; continue; } else { @@ -280,8 +271,7 @@ } - if (args) - gaim_cmd_free_args(args); + g_strfreev(args); g_free(cmd); g_free(mrest); Modified: trunk/src/connection.c =================================================================== --- trunk/src/connection.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/connection.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -337,10 +337,8 @@ { g_return_if_fail(gc != NULL); - if (gc->display_name != NULL) - g_free(gc->display_name); - - gc->display_name = (name == NULL ? NULL : g_strdup(name)); + g_free(gc->display_name); + gc->display_name = g_strdup(name); } GaimConnectionState Modified: trunk/src/conversation.c =================================================================== --- trunk/src/conversation.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/conversation.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -335,7 +335,6 @@ GaimConversationUiOps *ops; GaimConnection *gc; const char *name; - GList *node; g_return_if_fail(conv != NULL); @@ -433,34 +432,22 @@ } else if (conv->type == GAIM_CONV_TYPE_CHAT) { - for (node = conv->u.chat->in_room; node != NULL; node = node->next) { - if (node->data != NULL) - gaim_conv_chat_cb_destroy((GaimConvChatBuddy *)node->data); - node->data = NULL; - } - - for (node = conv->u.chat->ignored; node != NULL; node = node->next) { - if (node->data != NULL) - g_free(node->data); - node->data = NULL; - } - + g_list_foreach(conv->u.chat->in_room, (GFunc)gaim_conv_chat_cb_destroy, NULL); g_list_free(conv->u.chat->in_room); + + g_list_foreach(conv->u.chat->ignored, (GFunc)g_free, NULL); g_list_free(conv->u.chat->ignored); conv->u.chat->in_room = NULL; conv->u.chat->ignored = NULL; - if (conv->u.chat->who != NULL) - g_free(conv->u.chat->who); + g_free(conv->u.chat->who); conv->u.chat->who = NULL; - if (conv->u.chat->topic != NULL) - g_free(conv->u.chat->topic); + g_free(conv->u.chat->topic); conv->u.chat->topic = NULL; - if(conv->u.chat->nick) - g_free(conv->u.chat->nick); + g_free(conv->u.chat->nick); GAIM_DBUS_UNREGISTER_POINTER(conv->u.chat); g_free(conv->u.chat); @@ -587,9 +574,7 @@ g_return_if_fail(conv != NULL); g_return_if_fail(title != NULL); - if (conv->title != NULL) - g_free(conv->title); - + g_free(conv->title); conv->title = g_strdup(title); gaim_conversation_update(conv, GAIM_CONV_UPDATE_TITLE); @@ -651,11 +636,9 @@ { g_return_if_fail(conv != NULL); - if (conv->name != NULL) - g_free(conv->name); + g_free(conv->name); + conv->name = g_strdup(name); - conv->name = (name == NULL ? NULL : g_strdup(name)); - gaim_conversation_autoset_title(conv); } @@ -1326,11 +1309,11 @@ { g_return_if_fail(chat != NULL); - if (chat->who != NULL) g_free(chat->who); - if (chat->topic != NULL) g_free(chat->topic); + g_free(chat->who); + g_free(chat->topic); - chat->who = (who == NULL ? NULL : g_strdup(who)); - chat->topic = (topic == NULL ? NULL : g_strdup(topic)); + chat->who = g_strdup(who); + chat->topic = g_strdup(topic); gaim_conversation_update(gaim_conv_chat_get_conversation(chat), GAIM_CONV_UPDATE_TOPIC); @@ -1447,7 +1430,6 @@ char *user1 = NULL, *user2 = NULL; gint ret = 0; - if (a) { f1 = a->flags; if (a->alias_key) @@ -1455,7 +1437,7 @@ else if (a->name) user1 = a->name; } - + if (b) { f2 = b->flags; if (b->alias_key) @@ -1470,7 +1452,7 @@ } else if (f1 != f2) { /* sort more important users first */ ret = (f1 > f2) ? -1 : 1; - } else if (a->buddy != b->buddy) { + } else if (a->buddy != b->buddy) { ret = a->buddy ? -1 : 1; } else { ret = strcasecmp(user1, user2); @@ -1565,7 +1547,7 @@ } cbuddies = g_list_sort(cbuddies, (GCompareFunc)gaim_conv_chat_cb_compare); - + if (ops != NULL && ops->chat_add_users != NULL) ops->chat_add_users(conv, cbuddies, new_arrivals); @@ -1728,7 +1710,7 @@ } /* NOTE: Don't remove them from ignored in case they re-enter. */ - + if (!quiet) { const char *alias = user; char *escaped; @@ -1866,8 +1848,7 @@ void gaim_conv_chat_set_nick(GaimConvChat *chat, const char *nick) { g_return_if_fail(chat != NULL); - if(chat->nick) - g_free(chat->nick); + g_free(chat->nick); chat->nick = g_strdup(gaim_normalize(chat->conv->account, nick)); } @@ -1920,10 +1901,7 @@ cb = g_new0(GaimConvChatBuddy, 1); cb->name = g_strdup(name); cb->flags = flags; - if (alias) - cb->alias = g_strdup(alias); - else - cb->alias = NULL; + cb->alias = g_strdup(alias); GAIM_DBUS_REGISTER_POINTER(cb, GaimConvChatBuddy); return cb; @@ -1950,15 +1928,12 @@ void gaim_conv_chat_cb_destroy(GaimConvChatBuddy *cb) { - g_return_if_fail(cb != NULL); + if (cb == NULL) + return; g_free(cb->alias); g_free(cb->alias_key); g_free(cb->name); - cb->name = NULL; - cb->alias = NULL; - cb->alias_key = NULL; - cb->flags = 0; GAIM_DBUS_UNREGISTER_POINTER(cb); g_free(cb); Modified: trunk/src/core.c =================================================================== --- trunk/src/core.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/core.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -196,11 +196,7 @@ gaim_dbus_uninit(); #endif - if (core->ui != NULL) { - g_free(core->ui); - core->ui = NULL; - } - + g_free(core->ui); g_free(core); _core = NULL; Modified: trunk/src/dbus-define-api.h =================================================================== --- trunk/src/dbus-define-api.h 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/dbus-define-api.h 2006-08-05 08:27:39 UTC (rev 16638) @@ -7,10 +7,10 @@ /* blist.h */ gboolean GAIM_BLIST_NODE_IS_CHAT(GaimBlistNode *node); -gboolean GAIM_BLIST_NODE_IS_BUDDY(GaimBlistNode *node); +gboolean GAIM_BLIST_NODE_IS_BUDDY(GaimBlistNode *node); gboolean GAIM_BLIST_NODE_IS_CONTACT(GaimBlistNode *node); gboolean GAIM_BLIST_NODE_IS_GROUP(GaimBlistNode *node); -gboolean GAIM_BUDDY_IS_ONLINE(GaimBuddy *buddy); +gboolean GAIM_BUDDY_IS_ONLINE(GaimBuddy *buddy); gboolean GAIM_BLIST_NODE_HAS_FLAG(GaimBlistNode *node, int flags); gboolean GAIM_BLIST_NODE_SHOULD_SAVE(GaimBlistNode *node); Modified: trunk/src/dbus-server.h =================================================================== --- trunk/src/dbus-server.h 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/dbus-server.h 2006-08-05 08:27:39 UTC (rev 16638) @@ -32,7 +32,7 @@ G_BEGIN_DECLS -/** +/** Types of pointers are identified by the ADDRESS of a GaimDbusType object. This way, plugins can easily access types defined in gaim proper as well as introduce their own types that will not conflict @@ -41,7 +41,7 @@ The structure GaimDbusType has only one element (GaimDBusType::parent), a contains a pointer to the parent type, or @c NULL if the type has no parent. Parent means the same as the base class in object oriented - programming. + programming. */ typedef struct _GaimDBusType GaimDBusType; @@ -98,7 +98,7 @@ In order for an object to participate in the scheme, it must register itself and its type with the engine. This registration allocates an integer id which can be resolved to the pointer and - back. + back. Handles are not persistent. They are reissued every time gaim is started. This is not good; external applications that use gaim @@ -108,14 +108,14 @@ Pointer registration is only a temporary solution. When GaimBuddy and similar structures have been converted into gobjects, this registration will be done automatically by objects themselves. - + By the way, this kind of object-handle translation should be so common that there must be a library (maybe even glib) that implements it. I feel a bit like reinventing the wheel here. */ void gaim_dbus_init_ids(void); -/** +/** Registers a typed pointer. @param node The pointer to register. @@ -123,7 +123,7 @@ */ void gaim_dbus_register_pointer(gpointer node, GaimDBusType *type); -/** +/** Unregisters a pointer previously registered with gaim_dbus_register_pointer. @@ -142,7 +142,7 @@ the types of the parameters. @param vargs A va_list containing the actual parameters. */ -void gaim_dbus_signal_emit_gaim(const char *name, int num_values, +void gaim_dbus_signal_emit_gaim(const char *name, int num_values, GaimValue **values, va_list vargs); /** @@ -191,7 +191,7 @@ #define DBUS_EXPORT -/* +/* Here we include the list of #GAIM_DBUS_DECLARE_TYPE statements for all structs defined in gaim. This file has been generated by the #dbus-analize-types.py script. Modified: trunk/src/dbus-useful.c =================================================================== --- trunk/src/dbus-useful.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/dbus-useful.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -7,47 +7,47 @@ GaimAccount * -gaim_accounts_find_ext(const char *name, const char *protocol_id, +gaim_accounts_find_ext(const char *name, const char *protocol_id, gboolean (*account_test)(const GaimAccount *account)) { - GaimAccount *result = NULL; - GList *l; - char *who; - - if (name) - who = g_strdup(gaim_normalize(NULL, name)); - else - who = NULL; - - for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { - GaimAccount *account = (GaimAccount *)l->data; - - if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who)) - continue; + GaimAccount *result = NULL; + GList *l; + char *who; - if (protocol_id && strcmp(account->protocol_id, protocol_id)) - continue; + if (name) + who = g_strdup(gaim_normalize(NULL, name)); + else + who = NULL; - if (account_test && !account_test(account)) - continue; + for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { + GaimAccount *account = (GaimAccount *)l->data; - result = account; - break; - } + if (who && strcmp(gaim_normalize(NULL, gaim_account_get_username(account)), who)) + continue; - g_free(who); + if (protocol_id && strcmp(account->protocol_id, protocol_id)) + continue; - return result; + if (account_test && !account_test(account)) + continue; + + result = account; + break; + } + + g_free(who); + + return result; } -GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol) +GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol) { - return gaim_accounts_find_ext(name, protocol, NULL); + return gaim_accounts_find_ext(name, protocol, NULL); } -GaimAccount *gaim_accounts_find_connected(const char *name, const char *protocol) +GaimAccount *gaim_accounts_find_connected(const char *name, const char *protocol) { - return gaim_accounts_find_ext(name, protocol, gaim_account_is_connected); + return gaim_accounts_find_ext(name, protocol, gaim_account_is_connected); } Modified: trunk/src/dbus-useful.h =================================================================== --- trunk/src/dbus-useful.h 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/dbus-useful.h 2006-08-05 08:27:39 UTC (rev 16638) @@ -1,6 +1,6 @@ #include "conversation.h" -GaimAccount *gaim_accounts_find_ext(const char *name, const char *protocol_id, +GaimAccount *gaim_accounts_find_ext(const char *name, const char *protocol_id, gboolean (*account_test)(const GaimAccount *account)); GaimAccount *gaim_accounts_find_any(const char *name, const char *protocol); Modified: trunk/src/ft.c =================================================================== --- trunk/src/ft.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/ft.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -648,11 +648,7 @@ g_return_if_fail(xfer != NULL); g_free(xfer->message); - - if (message != NULL) - xfer->message = g_strdup(message); - else - xfer->message = NULL; + xfer->message = g_strdup(message); } void @@ -660,10 +656,8 @@ { g_return_if_fail(xfer != NULL); - if (xfer->filename != NULL) - g_free(xfer->filename); - - xfer->filename = (filename == NULL ? NULL : g_strdup(filename)); + g_free(xfer->filename); + xfer->filename = g_strdup(filename); } void @@ -671,10 +665,8 @@ { g_return_if_fail(xfer != NULL); - if (xfer->local_filename != NULL) - g_free(xfer->local_filename); - - xfer->local_filename = (filename == NULL ? NULL : g_strdup(filename)); + g_free(xfer->local_filename); + xfer->local_filename = g_strdup(filename); } void Modified: trunk/src/gaim-client-example.c =================================================================== --- trunk/src/gaim-client-example.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gaim-client-example.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -5,7 +5,7 @@ #include "gaim-client.h" -/* +/* This example demonstrates how to use libgaim-client to communicate with gaim. The names and signatures of functions provided by libgaim-client are the same as those in gaim. However, all @@ -21,19 +21,19 @@ int main (int argc, char **argv) { - GList *alist, *node; + GList *alist, *node; - gaim_init(); - - alist = gaim_accounts_get_all(); - for (node = alist; node; node = node->next) { - GaimAccount *account = (GaimAccount*) node->data; - char *name = gaim_account_get_username(account); - g_print("Name: %s\n", name); - g_free(name); - } + gaim_init(); - g_list_free(alist); + alist = gaim_accounts_get_all(); + for (node = alist; node != NULL; node = node->next) + { + GaimAccount *account = (GaimAccount*) node->data; + char *name = gaim_account_get_username(account); + g_print("Name: %s\n", name); + g_free(name); + } + g_list_free(alist); - return 0; + return 0; } Modified: trunk/src/gaim-client.c =================================================================== --- trunk/src/gaim-client.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gaim-client.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -10,69 +10,72 @@ static DBusGConnection *bus; static DBusGProxy *gaim_proxy; -static GList *garray_int_to_glist(GArray *array) { - GList *list = NULL; - int i; +static GList *garray_int_to_glist(GArray *array) +{ + GList *list = NULL; + int i; - for(i = 0; i < array->len; i++) - list = g_list_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); + for (i = 0; i < array->len; i++) + list = g_list_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); - g_array_free(array, TRUE); - return list; + g_array_free(array, TRUE); + return list; } -static GSList *garray_int_to_gslist(GArray *array) { - GSList *list = NULL; - int i; +static GSList *garray_int_to_gslist(GArray *array) +{ + GSList *list = NULL; + int i; - for(i = 0; i < array->len; i++) - list = g_slist_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); + for (i = 0; i < array->len; i++) + list = g_slist_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); - g_array_free(array, TRUE); - return list; + g_array_free(array, TRUE); + return list; } #include "gaim-client-bindings.c" -static void lose (const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2); -static void lose_gerror (const char *prefix, GError *error) G_GNUC_NORETURN; +static void lose(const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2); +static void lose_gerror(const char *prefix, GError *error) G_GNUC_NORETURN; static void -lose (const char *str, ...) +lose(const char *str, ...) { - va_list args; + va_list args; - va_start (args, str); + va_start(args, str); - vfprintf (stderr, str, args); - fputc ('\n', stderr); + vfprintf(stderr, str, args); + fputc('\n', stderr); - va_end (args); + va_end(args); - exit (1); + exit(1); } static void -lose_gerror (const char *prefix, GError *error) +lose_gerror(const char *prefix, GError *error) { - lose ("%s: %s", prefix, error->message); + lose("%s: %s", prefix, error->message); } -void gaim_init(void) { - GError *error = NULL; +void gaim_init(void) +{ + GError *error = NULL; - g_type_init (); + g_type_init (); - bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); - if (!bus) - lose_gerror ("Couldn't connect to session bus", error); + bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); + if (!bus) + lose_gerror ("Couldn't connect to session bus", error); - gaim_proxy = dbus_g_proxy_new_for_name (bus, - DBUS_SERVICE_GAIM, - DBUS_PATH_GAIM, - DBUS_INTERFACE_GAIM); + gaim_proxy = dbus_g_proxy_new_for_name (bus, + DBUS_SERVICE_GAIM, + DBUS_PATH_GAIM, + DBUS_INTERFACE_GAIM); - if (!gaim_proxy) - lose_gerror ("Couldn't connect to the Gaim Service", error); + if (!gaim_proxy) + lose_gerror ("Couldn't connect to the Gaim Service", error); } Modified: trunk/src/gtkaccount.c =================================================================== --- trunk/src/gtkaccount.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkaccount.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -204,7 +204,7 @@ gaim_gtk_buddy_icon_get_scale_size(pixbuf, &dialog->prpl_info->icon_spec, &width, &height); scale = gdk_pixbuf_scale_simple(pixbuf, width, height, GDK_INTERP_BILINEAR); - + g_object_unref(G_OBJECT(pixbuf)); pixbuf = scale; } @@ -231,9 +231,7 @@ { dialog->prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(dialog->plugin); - if (dialog->protocol_id != NULL) - g_free(dialog->protocol_id); - + g_free(dialog->protocol_id); dialog->protocol_id = g_strdup(dialog->plugin->info->id); } @@ -317,8 +315,7 @@ #endif /* FILECHOOSER */ - if (dialog->icon_path) - g_free(dialog->icon_path); + g_free(dialog->icon_path); dialog->icon_path = convert_buddy_icon(dialog->plugin, filename); set_dialog_icon(dialog); gtk_widget_show(dialog->icon_entry); @@ -482,8 +479,7 @@ static void icon_reset_cb(GtkWidget *button, AccountPrefsDialog *dialog) { - if (dialog->icon_path) - g_free(dialog->icon_path); + g_free(dialog->icon_path); dialog->icon_path = NULL; gtk_widget_hide(dialog->icon_entry); @@ -512,8 +508,7 @@ } if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n'))) *rtmp = '\0'; - if (dialog->icon_path) - g_free(dialog->icon_path); + g_free(dialog->icon_path); dialog->icon_path = convert_buddy_icon(dialog->plugin, tmp); set_dialog_icon(dialog); gtk_widget_show(dialog->icon_entry); @@ -1423,15 +1418,10 @@ gtk_widget_destroy(dialog->window); - if (dialog->user_split_entries != NULL) - g_list_free(dialog->user_split_entries); + g_list_free(dialog->user_split_entries); + g_list_free(dialog->protocol_opt_entries); + g_free(dialog->protocol_id); - if (dialog->protocol_opt_entries != NULL) - g_list_free(dialog->protocol_opt_entries); - - if (dialog->protocol_id != NULL) - g_free(dialog->protocol_id); - if (dialog->icon_path != NULL) { const char *icon = gaim_account_get_buddy_icon(dialog->account); @@ -2572,10 +2562,7 @@ free_add_user_data(GaimGtkAccountAddUserData *data) { g_free(data->username); - - if (data->alias != NULL) - g_free(data->alias); - + g_free(data->alias); g_free(data); } @@ -2645,7 +2632,7 @@ data = g_new0(GaimGtkAccountAddUserData, 1); data->account = account; data->username = g_strdup(remote_user); - data->alias = (alias != NULL ? g_strdup(alias) : NULL); + data->alias = g_strdup(alias); buffer = make_info(account, gc, remote_user, id, alias, msg); Modified: trunk/src/gtkblist.c =================================================================== --- trunk/src/gtkblist.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkblist.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -553,9 +553,7 @@ ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget); } - if (data->entries != NULL) - g_list_free(data->entries); - + g_list_free(data->entries); data->entries = NULL; if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) @@ -1519,8 +1517,7 @@ if (aims == NULL && icqs == NULL && yahoos == NULL && msns == NULL && jabbers == NULL) { - if (alias != NULL) - g_free(alias); + g_free(alias); return FALSE; } @@ -1531,8 +1528,7 @@ add_buddies_from_vcard("prpl-msn", group, msns, alias); add_buddies_from_vcard("prpl-jabber", group, jabbers, alias); - if (alias != NULL) - g_free(alias); + g_free(alias); return TRUE; } @@ -1594,7 +1590,6 @@ GValue val; GString *str; const char *protocol; - char *mime_str; ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row"); sourcerow = gtk_tree_row_reference_get_path(ref); @@ -1654,15 +1649,13 @@ str = g_string_append(str, "\r\n"); - mime_str = g_string_free(str, FALSE); - gtk_selection_data_set(data, gdk_atom_intern("application/x-im-contact", FALSE), 8, /* bits */ - (const guchar *)mime_str, - strlen(mime_str) + 1); + (const guchar *)str->str, + strlen(str->str) + 1); - g_free(mime_str); + g_string_free(str, TRUE); gtk_tree_path_free(sourcerow); } } @@ -1878,9 +1871,9 @@ } } - if (username != NULL) g_free(username); - if (protocol != NULL) g_free(protocol); - if (alias != NULL) g_free(alias); + g_free(username); + g_free(protocol); + g_free(alias); if (path != NULL) gtk_tree_path_free(path); @@ -2966,7 +2959,7 @@ statustext = g_strdup(_("Offline")); else if (!statustext) text = g_strdup(esc); - + if (gaim_presence_is_idle(presence)) { if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time")) { time_t idle_secs = gaim_presence_get_idle_time(presence); @@ -3017,7 +3010,7 @@ } /* It is selected. */ - if ((selected && !text) || (selected && idletime)) + if ((selected && !text) || (selected && idletime)) text = g_strdup_printf("%s\n" "<span size='smaller'>%s%s%s</span>", esc, @@ -3072,7 +3065,7 @@ if (gtk_blist_obscured || !GTK_WIDGET_VISIBLE(gtkblist->window)) return TRUE; - + for(gnode = list->root; gnode; gnode = gnode->next) { if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) continue; @@ -3084,7 +3077,7 @@ if (buddy && gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) - gaim_gtk_blist_update_contact(list, (GaimBlistNode*)buddy); + gaim_gtk_blist_update_contact(list, (GaimBlistNode*)buddy); } } } @@ -4246,7 +4239,7 @@ contact = (GaimContact*)cnode; buddy = gaim_contact_get_priority_buddy(contact); - + if (buddy_is_displayable(buddy)) { GtkTreeIter iter; @@ -4294,10 +4287,10 @@ g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); if (node->parent == NULL) - return; + return; buddy = (GaimBuddy*)node; - + /* First things first, update the contact */ gaim_gtk_blist_update_contact(list, node); @@ -4800,8 +4793,7 @@ ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget); } - if (data->entries != NULL) - g_list_free(data->entries); + g_list_free(data->entries); data->entries = NULL; @@ -5833,7 +5825,7 @@ submenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); gtk_widget_show(submenu); - + gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); path = g_strdup_printf("%s/Tools/%s", gtkblist->ift->path, plugin->info->name); gtk_menu_set_accel_path(GTK_MENU(submenu), path); Modified: trunk/src/gtkconv.c =================================================================== --- trunk/src/gtkconv.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkconv.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -193,15 +193,9 @@ static gint close_conv_cb(GtkWidget *w, GaimGtkConversation *gtkconv) { - GList *list = g_list_copy(gtkconv->convs), *l; + GList *list = g_list_copy(gtkconv->convs); - l = list; - while (l) { - GaimConversation *conv = l->data; - gaim_conversation_destroy(conv); - l = l->next; - } - + g_list_foreach(list, (GFunc)gaim_conversation_destroy, NULL); g_list_free(list); return TRUE; @@ -489,8 +483,7 @@ case GAIM_CMD_STATUS_FAILED: gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), GAIM_MESSAGE_NO_LOG, time(NULL)); - if(error) - g_free(error); + g_free(error); return TRUE; case GAIM_CMD_STATUS_WRONG_TYPE: if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) @@ -771,8 +764,8 @@ } } - if (username != NULL) g_free(username); - if (protocol != NULL) g_free(protocol); + g_free(username); + g_free(protocol); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } @@ -1426,7 +1419,7 @@ gaim_conv_chat_ignore(chat, name); cbuddy = gaim_conv_chat_cb_new(name, alias, flags); - + add_chat_buddy_common(conv, cbuddy, NULL); g_free(name); g_free(alias); @@ -1525,7 +1518,7 @@ who = g_object_get_data(G_OBJECT(w), "user_data"); mark = get_mark_for_user(gtkconv, who); - + if (mark != NULL) gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(gtkconv->imhtml), mark, 0.1, FALSE, 0, 0); else @@ -3214,8 +3207,7 @@ GaimBlistNode *gnode,*cnode,*bnode; static GList *tmp = NULL; - if (tmp) - g_list_free(tmp); + g_list_free(tmp); tmp = g_list_append(NULL, ""); @@ -4261,8 +4253,8 @@ } } - if (username != NULL) g_free(username); - if (protocol != NULL) g_free(protocol); + g_free(username); + g_free(protocol); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } @@ -4868,8 +4860,7 @@ } } - if(alias_escaped) - g_free(alias_escaped); + g_free(alias_escaped); /* Are we in a chat where we can tell which users are buddies? */ if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && @@ -5070,7 +5061,7 @@ g_return_if_fail(new_alias != NULL); cbuddy = gaim_conv_chat_cb_new(new_name, new_alias, flags); - + add_chat_buddy_common(conv, cbuddy, old_name); } @@ -5177,7 +5168,7 @@ flags = gaim_conv_chat_user_get_flags(chat, user); cbuddy = gaim_conv_chat_cb_new(user, alias, flags); - + add_chat_buddy_common(conv, cbuddy, NULL); g_free(alias); } Modified: trunk/src/gtkdebug.c =================================================================== --- trunk/src/gtkdebug.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkdebug.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -58,9 +58,9 @@ gboolean invert; gboolean highlight; - + guint timer; - + regex_t regex; #else GtkWidget *find; @@ -351,8 +351,8 @@ for(m = 0; m < n_matches; m++) { GtkTextIter ms, me; - - if(matches[m].rm_eo == -1) + + if(matches[m].rm_eo == -1) break; i += offset; @@ -524,7 +524,7 @@ */ if(win->paused) return; - + gtk_tree_model_get(model, iter, 0, &text, -1); if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) { @@ -840,8 +840,7 @@ g_free(new_msg); } - if (new_domain != NULL) - g_free(new_domain); + g_free(new_domain); } #ifdef _WIN32 Modified: trunk/src/gtkft.c =================================================================== --- trunk/src/gtkft.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkft.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -1097,8 +1097,7 @@ data = GAIM_GTKXFER(xfer); if (data) { - if (data->name) - g_free(data->name); + g_free(data->name); g_free(data); xfer->ui_data = NULL; } Modified: trunk/src/gtkimhtml.c =================================================================== --- trunk/src/gtkimhtml.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkimhtml.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -1248,10 +1248,8 @@ g_list_free(imhtml->scalables); g_slist_free(imhtml->im_images); - if (imhtml->protocol_name) - g_free(imhtml->protocol_name); - if (imhtml->search_string) - g_free(imhtml->search_string); + g_free(imhtml->protocol_name); + g_free(imhtml->search_string); G_OBJECT_CLASS(parent_class)->finalize (object); } @@ -2737,8 +2735,7 @@ gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); ws[0] = '\0'; wpos = 0; /* NEW_BIT(NEW_TEXT_BIT); */ - if (bg) - g_free(bg); + g_free(bg); bg = bgcolor; gtk_imhtml_toggle_background(imhtml, bg); } @@ -2752,8 +2749,7 @@ ws[0] = '\0'; wpos = 0; gtk_imhtml_toggle_link(imhtml, href); } - if (href) - g_free(href); + g_free(href); } break; case 46: /* IMG (opt) */ @@ -3037,14 +3033,10 @@ while (fonts) { GtkIMHtmlFontDetail *font = fonts->data; fonts = g_slist_remove (fonts, font); - if (font->face) - g_free (font->face); - if (font->fore) - g_free (font->fore); - if (font->back) - g_free (font->back); - if (font->sml) - g_free (font->sml); + g_free (font->face); + g_free (font->fore); + g_free (font->back); + g_free (font->sml); g_free (font); } @@ -3082,9 +3074,8 @@ void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name) { - if (imhtml->protocol_name) - g_free(imhtml->protocol_name); - imhtml->protocol_name = protocol_name ? g_strdup(protocol_name) : NULL; + g_free(imhtml->protocol_name); + imhtml->protocol_name = g_strdup(protocol_name); } void @@ -3174,7 +3165,7 @@ im_image->width = gdk_pixbuf_get_width(img); im_image->height = gdk_pixbuf_get_height(img); im_image->mark = NULL; - im_image->filename = filename ? g_strdup(filename) : NULL; + im_image->filename = g_strdup(filename); im_image->id = id; im_image->filesel = NULL; @@ -3441,8 +3432,7 @@ GtkIMHtmlImage *image = (GtkIMHtmlImage *)scale; g_object_unref(image->pixbuf); - if (image->filename) - g_free(image->filename); + g_free(image->filename); if (image->filesel) gtk_widget_destroy(image->filesel); g_free(scale); @@ -3559,8 +3549,7 @@ gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end); gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "search", &start, &end); - if (imhtml->search_string) - g_free(imhtml->search_string); + g_free(imhtml->search_string); imhtml->search_string = NULL; } @@ -3825,7 +3814,7 @@ strncmp(tag->name, "LINK ", 5) == 0 && imhtml->edit.link) { gtk_imhtml_toggle_link(imhtml, NULL); } - } + } } g_slist_free(tags); } @@ -3944,37 +3933,25 @@ char * gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml) { - if (imhtml->edit.fontface) - return g_strdup(imhtml->edit.fontface); - else - return NULL; + return g_strdup(imhtml->edit.fontface); } char * gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml) { - if (imhtml->edit.forecolor) - return g_strdup(imhtml->edit.forecolor); - else - return NULL; + return g_strdup(imhtml->edit.forecolor); } char * gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml) { - if (imhtml->edit.backcolor) - return g_strdup(imhtml->edit.backcolor); - else - return NULL; + return g_strdup(imhtml->edit.backcolor); } char * gtk_imhtml_get_current_background(GtkIMHtml *imhtml) { - if (imhtml->edit.background) - return g_strdup(imhtml->edit.background); - else - return NULL; + return g_strdup(imhtml->edit.background); } gint @@ -4029,15 +4006,15 @@ return; imhtml->edit.bold = imhtml->edit.italic = imhtml->edit.underline = imhtml->edit.strike = FALSE; - if (imhtml->edit.forecolor) - g_free(imhtml->edit.forecolor); + g_free(imhtml->edit.forecolor); imhtml->edit.forecolor = NULL; - if (imhtml->edit.backcolor) - g_free(imhtml->edit.backcolor); + + g_free(imhtml->edit.backcolor); imhtml->edit.backcolor = NULL; - if (imhtml->edit.fontface) - g_free(imhtml->edit.fontface); + + g_free(imhtml->edit.fontface); imhtml->edit.fontface = NULL; + imhtml->edit.fontsize = 0; imhtml->edit.link = NULL; Modified: trunk/src/gtkimhtmltoolbar.c =================================================================== --- trunk/src/gtkimhtmltoolbar.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkimhtmltoolbar.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -878,8 +878,7 @@ toolbar); } - if (toolbar->sml) - free(toolbar->sml); + free(toolbar->sml); gtk_object_sink(GTK_OBJECT(toolbar->tooltips)); G_OBJECT_CLASS(parent_class)->finalize (object); @@ -1132,8 +1131,6 @@ void gtk_imhtmltoolbar_associate_smileys(GtkIMHtmlToolbar *toolbar, const char *proto_id) { - if (toolbar->sml) - g_free(toolbar->sml); - + g_free(toolbar->sml); toolbar->sml = g_strdup(proto_id); } Modified: trunk/src/gtklog.c =================================================================== --- trunk/src/gtklog.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtklog.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -111,8 +111,7 @@ const char *search_term = gtk_entry_get_text(GTK_ENTRY(lv->entry)); GList *logs; - if (lv->search != NULL) - g_free(lv->search); + g_free(lv->search); gtk_tree_store_clear(lv->treestore); if (!(*search_term)) { @@ -154,9 +153,7 @@ lv = g_hash_table_lookup(log_viewers, ht); g_hash_table_remove(log_viewers, ht); - if (ht->screenname != NULL) - g_free(ht->screenname); - + g_free(ht->screenname); g_free(ht); } else syslog_viewer = NULL; @@ -164,10 +161,9 @@ g_list_foreach(lv->logs, (GFunc)gaim_log_free, NULL); g_list_free(lv->logs); - if (lv->search != NULL) - g_free(lv->search); - + g_free(lv->search); g_free(lv); + gtk_widget_destroy(w); return TRUE; Modified: trunk/src/gtkpluginpref.c =================================================================== --- trunk/src/gtkpluginpref.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkpluginpref.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -57,9 +57,6 @@ g_return_if_fail(pref); text = gtk_imhtml_get_markup(imhtml); - - if (!text) - text = ""; gaim_prefs_set_string(pref, text); g_free(text); } Modified: trunk/src/gtkpounce.c =================================================================== --- trunk/src/gtkpounce.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkpounce.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -432,8 +432,8 @@ } } - if (username != NULL) g_free(username); - if (protocol != NULL) g_free(protocol); + g_free(username); + g_free(protocol); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } @@ -1195,7 +1195,7 @@ /* Create the scrolled window */ sw = gtk_scrolled_window_new(0, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); Modified: trunk/src/gtkprefs.c =================================================================== --- trunk/src/gtkprefs.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkprefs.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -1474,7 +1474,7 @@ static gchar* prefs_sound_volume_format(GtkScale *scale, gdouble val) { if(val < 15) { - return g_strdup_printf(_("Quietest")); + return g_strdup_printf(_("Quietest")); } else if(val < 30) { return g_strdup_printf(_("Quieter")); } else if(val < 45) { Modified: trunk/src/gtkprivacy.c =================================================================== --- trunk/src/gtkprivacy.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkprivacy.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -7,7 +7,7 @@ * 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 @@ -521,9 +521,7 @@ static void destroy_request_data(GaimGtkPrivacyRequestData *data) { - if (data->name != NULL) - g_free(data->name); - + g_free(data->name); g_free(data); } Modified: trunk/src/gtkrequest.c =================================================================== --- trunk/src/gtkrequest.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkrequest.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -364,7 +364,7 @@ /* Entry field. */ data->u.input.multiline = multiline; - data->u.input.hint = (hint == NULL ? NULL : g_strdup(hint)); + data->u.input.hint = g_strdup(hint); if ((data->u.input.hint != NULL) && (!strcmp(data->u.input.hint, "html"))) { GtkWidget *frame; @@ -1586,7 +1586,7 @@ { GaimGtkRequestData *data; GtkWidget *dirsel; - + data = g_new0(GaimGtkRequestData, 1); data->type = GAIM_REQUEST_FOLDER; data->user_data = user_data; @@ -1633,8 +1633,7 @@ { GaimGtkRequestData *data = (GaimGtkRequestData *)ui_handle; - if (data->cbs != NULL) - g_free(data->cbs); + g_free(data->cbs); gtk_widget_destroy(data->dialog); Modified: trunk/src/gtkroomlist.c =================================================================== --- trunk/src/gtkroomlist.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkroomlist.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -593,7 +593,7 @@ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(selection_changed_cb), grl); - + g_object_unref(model); grl->model = model; Modified: trunk/src/gtksound.c =================================================================== --- trunk/src/gtksound.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtksound.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -342,7 +342,7 @@ static gboolean bus_call (GstBus *bus, GstMessage *msg, - gpointer data) + gpointer data) { GstElement *play = data; GError *err; @@ -443,17 +443,17 @@ uri = g_strdup_printf("file://%s", filename); play = gst_element_factory_make("playbin", "play"); - + g_object_set(G_OBJECT(play), "uri", uri, - "volume", volume, + "volume", volume, "audio-sink", sink, NULL); gst_bus_add_watch(gst_pipeline_get_bus(GST_PIPELINE(play)), bus_call, play); gst_element_set_state(play, GST_STATE_PLAYING); - + g_free(uri); - + #else /* USE_GSTREAMER */ gdk_beep(); return; @@ -499,7 +499,7 @@ if (gaim_prefs_get_bool(enable_pref)) { char *filename = g_strdup(gaim_prefs_get_string(file_pref)); if(!filename || !strlen(filename)) { - if(filename) g_free(filename); + g_free(filename); filename = g_build_filename(DATADIR, "sounds", "gaim", sounds[event].def, NULL); } Modified: trunk/src/gtkstatusbox.c =================================================================== --- trunk/src/gtkstatusbox.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkstatusbox.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -751,7 +751,7 @@ status_menu_refresh_iter(status_box); return TRUE; } - + gtk_gaim_status_box_pulse_typing(status_box); g_source_remove(status_box->typing); status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); Modified: trunk/src/gtkthemes.c =================================================================== --- trunk/src/gtkthemes.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkthemes.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -119,23 +119,19 @@ theme->list = child; list = child; } else if (!g_ascii_strncasecmp(i, "Name=", strlen("Name="))) { - if(theme->name) - g_free(theme->name); + g_free(theme->name); theme->name = g_strdup(i+ strlen("Name=")); theme->name[strlen(theme->name)-1] = 0; } else if (!g_ascii_strncasecmp(i, "Description=", strlen("Description="))) { - if(theme->desc) - g_free(theme->desc); + g_free(theme->desc); theme->desc = g_strdup(i + strlen("Description=")); theme->desc[strlen(theme->desc)-1] = 0; } else if (!g_ascii_strncasecmp(i, "Icon=", strlen("Icon="))) { - if(theme->icon) - g_free(theme->icon); + g_free(theme->icon); theme->icon = g_build_filename(dirname, i + strlen("Icon="), NULL); theme->icon[strlen(theme->icon)-1] = 0; } else if (!g_ascii_strncasecmp(i, "Author=", strlen("Author="))) { - if(theme->author) - g_free(theme->author); + g_free(theme->author); theme->author = g_strdup(i + strlen("Author=")); theme->author[strlen(theme->author)-1] = 0; } else if (load && list) { Modified: trunk/src/gtkutils.c =================================================================== --- trunk/src/gtkutils.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/gtkutils.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -1053,9 +1053,9 @@ { valid = FALSE; - if (username != NULL) g_free(username); - if (protocol != NULL) g_free(protocol); - if (alias != NULL) g_free(alias); + g_free(username); + g_free(protocol); + g_free(alias); } g_free(str); Modified: trunk/src/imgstore.c =================================================================== --- trunk/src/imgstore.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/imgstore.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -82,10 +82,8 @@ img = priv->img; if (img) { - if (img->data) - g_free(img->data); - if (img->filename) - g_free(img->filename); + g_free(img->data); + g_free(img->filename); g_free(img); } Modified: trunk/src/log.c =================================================================== --- trunk/src/log.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/log.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -110,7 +110,7 @@ log->tm->tm_zone = tmp; else /* Just shove the UTF-8 bytes in and hope... */ - log->tm->tm_zone = (char *)g_strdup(log->tm->tm_zone); + log->tm->tm_zone = g_strdup(log->tm->tm_zone); } #endif } @@ -853,7 +853,7 @@ for (account_iter = gaim_accounts_get_all() ; account_iter != NULL ; account_iter = account_iter->next) { GaimPlugin *prpl; GaimPluginProtocolInfo *prpl_info; - + prpl = gaim_find_prpl(gaim_account_get_protocol_id((GaimAccount *)account_iter->data)); if (!prpl) continue; @@ -1281,8 +1281,7 @@ if (data) { if(data->file) fclose(data->file); - if(data->path) - g_free(data->path); + g_free(data->path); g_slice_free(GaimLogCommonLoggerData, data); } Modified: trunk/src/notify.c =================================================================== --- trunk/src/notify.c 2006-08-05 05:44:34 UTC (rev 16637) +++ trunk/src/notify.c 2006-08-05 08:27:39 UTC (rev 16638) @@ -60,9 +60,9 @@ if (info->ui_handle != NULL) { handles = g_list_append(handles, info); - + return info->ui_handle; - + } else { if (info->cb != NULL) info->cb(info->cb_user_data); @@ -111,7 +111,7 @@ g_free(info); return NULL; - } + } } else { if (cb != NULL) cb(user_data); @@ -197,1... [truncated message content] |
From: <the...@us...> - 2006-08-05 05:44:41
|
Revision: 16637 Author: thekingant Date: 2006-08-04 22:44:34 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16637&view=rev Log Message: ----------- Backport SVN revisions 16635 and 16636 from HEAD to v2_0_0 Original commit message: Make Yahoo! packet parsing not allocate stuff twice. Who wrote this?? Modified Paths: -------------- branches/v2_0_0/src/protocols/yahoo/yahoo_packet.c branches/v2_0_0/src/protocols/yahoo/yahoo_packet.h Modified: branches/v2_0_0/src/protocols/yahoo/yahoo_packet.c =================================================================== --- branches/v2_0_0/src/protocols/yahoo/yahoo_packet.c 2006-08-05 05:42:28 UTC (rev 16636) +++ branches/v2_0_0/src/protocols/yahoo/yahoo_packet.c 2006-08-05 05:44:34 UTC (rev 16637) @@ -43,7 +43,7 @@ struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); pair->key = key; pair->value = g_strdup(value); - pkt->hash = g_slist_append(pkt->hash, pair); + pkt->hash = g_slist_prepend(pkt->hash, pair); } void yahoo_packet_hash_int(struct yahoo_packet *pkt, int key, int value) @@ -52,7 +52,7 @@ pair->key = key; pair->value = g_strdup_printf("%d", value); - pkt->hash = g_slist_append(pkt->hash, pair); + pkt->hash = g_slist_prepend(pkt->hash, pair); } void yahoo_packet_hash(struct yahoo_packet *pkt, const char *fmt, ...) @@ -105,17 +105,16 @@ return len; } -void yahoo_packet_read(struct yahoo_packet *pkt, guchar *data, int len) +void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len) { int pos = 0; + char key[64], *delimiter, *esc; + gboolean accept; + int x; + struct yahoo_pair *pair; - while (pos + 1 < len) { - char key[64], *value = NULL, *esc; - int accept; - int x; - - struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); - + while (pos + 1 < len) + { /* this is weird, and in one of the chat packets, and causes us * think all the values are keys and all the keys are values after * this point if we don't handle it */ @@ -126,10 +125,11 @@ pos++; } pos += 2; - g_free(pair); continue; } + pair = g_new0(struct yahoo_pair, 1); + x = 0; while (pos + 1 < len) { if (data[pos] == 0xc0 && data[pos + 1] == 0x80) @@ -151,25 +151,29 @@ if (len - pos + 1 <= 0) { /* Truncated. Garbage or something. */ - accept = 0; + accept = FALSE; } if (accept) { - value = g_malloc(len - pos + 1); - x = 0; - while (pos + 1 < len) { - if (data[pos] == 0xc0 && data[pos + 1] == 0x80) - break; - value[x++] = data[pos++]; + delimiter = strstr((char *)&data[pos], "\xc0\x80"); + if (delimiter == NULL) + { + /* Malformed packet! (it doesn't end in 0xc0 0x80) */ + g_free(pair); + pos = len; + continue; } - value[x] = 0; - pair->value = g_strdup(value); - g_free(value); - pkt->hash = g_slist_append(pkt->hash, pair); + x = (guint64)delimiter - (guint64)data; + pair->value = g_strndup((const gchar *)&data[pos], x - pos); + pos = x; + pkt->hash = g_slist_prepend(pkt->hash, pair); + +#ifdef DEBUG esc = g_strescape(pair->value, NULL); gaim_debug(GAIM_DEBUG_MISC, "yahoo", "Key: %d \tValue: %s\n", pair->key, esc); g_free(esc); +#endif } else { g_free(pair); } @@ -179,6 +183,16 @@ if (data[0] == '9' && data[pos] == 0x01) pos++; } + + /* + * Originally this function used g_slist_append(). I changed + * it to use g_slist_prepend() for improved performance. + * Ideally the Yahoo! PRPL code would be indifferent to the + * order of the key/value pairs, but I don't know if this is + * the case for all incoming messages. To be on the safe side + * we reverse the list. + */ + pkt->hash = g_slist_reverse(pkt->hash); } void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data) Modified: branches/v2_0_0/src/protocols/yahoo/yahoo_packet.h =================================================================== --- branches/v2_0_0/src/protocols/yahoo/yahoo_packet.h 2006-08-05 05:42:28 UTC (rev 16636) +++ branches/v2_0_0/src/protocols/yahoo/yahoo_packet.h 2006-08-05 05:44:34 UTC (rev 16637) @@ -127,7 +127,7 @@ int yahoo_packet_send_and_free(struct yahoo_packet *pkt, struct yahoo_data *yd); size_t yahoo_packet_build(struct yahoo_packet *pkt, int pad, gboolean wm, guchar **buf); -void yahoo_packet_read(struct yahoo_packet *pkt, guchar *data, int len); +void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len); void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data); void yahoo_packet_dump(guchar *data, int len); size_t yahoo_packet_length(struct yahoo_packet *pkt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-05 05:42:36
|
Revision: 16636 Author: thekingant Date: 2006-08-04 22:42:28 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16636&view=rev Log Message: ----------- Make Yahoo! packet parsing not allocate stuff twice. Who wrote this?? Modified Paths: -------------- trunk/src/protocols/yahoo/yahoo_packet.h Modified: trunk/src/protocols/yahoo/yahoo_packet.h =================================================================== --- trunk/src/protocols/yahoo/yahoo_packet.h 2006-08-05 05:40:27 UTC (rev 16635) +++ trunk/src/protocols/yahoo/yahoo_packet.h 2006-08-05 05:42:28 UTC (rev 16636) @@ -127,7 +127,7 @@ int yahoo_packet_send_and_free(struct yahoo_packet *pkt, struct yahoo_data *yd); size_t yahoo_packet_build(struct yahoo_packet *pkt, int pad, gboolean wm, guchar **buf); -void yahoo_packet_read(struct yahoo_packet *pkt, guchar *data, int len); +void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len); void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data); void yahoo_packet_dump(guchar *data, int len); size_t yahoo_packet_length(struct yahoo_packet *pkt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-05 05:40:38
|
Revision: 16635 Author: thekingant Date: 2006-08-04 22:40:27 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16635&view=rev Log Message: ----------- Make Yahoo! packet parsing not allocate stuff twice. Who wrote this?? Modified Paths: -------------- trunk/src/protocols/yahoo/yahoo_packet.c Modified: trunk/src/protocols/yahoo/yahoo_packet.c =================================================================== --- trunk/src/protocols/yahoo/yahoo_packet.c 2006-08-05 04:07:52 UTC (rev 16634) +++ trunk/src/protocols/yahoo/yahoo_packet.c 2006-08-05 05:40:27 UTC (rev 16635) @@ -43,7 +43,7 @@ struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); pair->key = key; pair->value = g_strdup(value); - pkt->hash = g_slist_append(pkt->hash, pair); + pkt->hash = g_slist_prepend(pkt->hash, pair); } void yahoo_packet_hash_int(struct yahoo_packet *pkt, int key, int value) @@ -52,7 +52,7 @@ pair->key = key; pair->value = g_strdup_printf("%d", value); - pkt->hash = g_slist_append(pkt->hash, pair); + pkt->hash = g_slist_prepend(pkt->hash, pair); } void yahoo_packet_hash(struct yahoo_packet *pkt, const char *fmt, ...) @@ -105,17 +105,16 @@ return len; } -void yahoo_packet_read(struct yahoo_packet *pkt, guchar *data, int len) +void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len) { int pos = 0; + char key[64], *delimiter, *esc; + gboolean accept; + int x; + struct yahoo_pair *pair; - while (pos + 1 < len) { - char key[64], *value = NULL, *esc; - int accept; - int x; - - struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); - + while (pos + 1 < len) + { /* this is weird, and in one of the chat packets, and causes us to * think all the values are keys and all the keys are values after * this point if we don't handle it */ @@ -126,10 +125,11 @@ pos++; } pos += 2; - g_free(pair); continue; } + pair = g_new0(struct yahoo_pair, 1); + x = 0; while (pos + 1 < len) { if (data[pos] == 0xc0 && data[pos + 1] == 0x80) @@ -151,25 +151,29 @@ if (len - pos + 1 <= 0) { /* Truncated. Garbage or something. */ - accept = 0; + accept = FALSE; } if (accept) { - value = g_malloc(len - pos + 1); - x = 0; - while (pos + 1 < len) { - if (data[pos] == 0xc0 && data[pos + 1] == 0x80) - break; - value[x++] = data[pos++]; + delimiter = strstr((char *)&data[pos], "\xc0\x80"); + if (delimiter == NULL) + { + /* Malformed packet! (it doesn't end in 0xc0 0x80) */ + g_free(pair); + pos = len; + continue; } - value[x] = 0; - pair->value = g_strdup(value); - g_free(value); - pkt->hash = g_slist_append(pkt->hash, pair); + x = (guint64)delimiter - (guint64)data; + pair->value = g_strndup((const gchar *)&data[pos], x - pos); + pos = x; + pkt->hash = g_slist_prepend(pkt->hash, pair); + +#ifdef DEBUG esc = g_strescape(pair->value, NULL); gaim_debug(GAIM_DEBUG_MISC, "yahoo", "Key: %d \tValue: %s\n", pair->key, esc); g_free(esc); +#endif } else { g_free(pair); } @@ -179,6 +183,16 @@ if (data[0] == '9' && data[pos] == 0x01) pos++; } + + /* + * Originally this function used g_slist_append(). I changed + * it to use g_slist_prepend() for improved performance. + * Ideally the Yahoo! PRPL code would be indifferent to the + * order of the key/value pairs, but I don't know if this is + * the case for all incoming messages. To be on the safe side + * we reverse the list. + */ + pkt->hash = g_slist_reverse(pkt->hash); } void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-05 04:07:55
|
Revision: 16634 Author: sadrul Date: 2006-08-04 21:07:52 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16634&view=rev Log Message: ----------- Do not waste too much unnecessary memory. Modified Paths: -------------- trunk/console/libgnt/gnttextview.c Modified: trunk/console/libgnt/gnttextview.c =================================================================== --- trunk/console/libgnt/gnttextview.c 2006-08-05 03:20:14 UTC (rev 16633) +++ trunk/console/libgnt/gnttextview.c 2006-08-05 04:07:52 UTC (rev 16634) @@ -187,7 +187,6 @@ for (i = 0; split[i]; i++) { GntTextLine *line; - int len = g_utf8_strlen(split[i], -1); char *iter = split[i]; int prev = 0; @@ -202,8 +201,9 @@ while (iter && *iter) { GntTextSegment *seg = g_new0(GntTextSegment, 1); + int len = g_utf8_offset_to_pointer(iter, widget->priv.width - line->length - 1) - iter; seg->flags = fl; - seg->text = g_new0(char, len + 1); /* XXX: MUST be improved */ + seg->text = g_new0(char, len + 1); g_utf8_strncpy(seg->text, iter, widget->priv.width - line->length - 1); line->segments = g_list_append(line->segments, seg); @@ -215,7 +215,6 @@ line = g_new0(GntTextLine, 1); view->list = g_list_prepend(g_list_first(view->list), line); } - /*len -= prev;*/ } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-05 03:20:21
|
Revision: 16633 Author: sadrul Date: 2006-08-04 20:20:14 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16633&view=rev Log Message: ----------- Do not crash. Modified Paths: -------------- trunk/console/libgnt/gntentry.c Modified: trunk/console/libgnt/gntentry.c =================================================================== --- trunk/console/libgnt/gntentry.c 2006-08-05 02:56:18 UTC (rev 16632) +++ trunk/console/libgnt/gntentry.c 2006-08-05 03:20:14 UTC (rev 16633) @@ -126,7 +126,7 @@ if (entry->max && g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->max) continue; - if (g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->buffer) + if (entry->end - entry->start >= entry->buffer) { char *tmp = g_strdup_printf(entry->start); gnt_entry_set_text(entry, tmp); @@ -255,15 +255,15 @@ if (text && text[0]) { - len = g_utf8_strlen(text, -1); - entry->buffer = len * 2; + len = strlen(text); } else { - entry->buffer = 128; len = 0; } + entry->buffer = len + 128; + scroll = entry->scroll - entry->start; cursor = entry->end - entry->cursor; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-05 02:56:23
|
Revision: 16632 Author: sadrul Date: 2006-08-04 19:56:18 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16632&view=rev Log Message: ----------- Do not auto-scroll when I am reading the backlog. 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-08-05 02:19:19 UTC (rev 16631) +++ trunk/console/gntconv.c 2006-08-05 02:56:18 UTC (rev 16632) @@ -221,6 +221,7 @@ GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); /* XXX: ggconv = conv->ui_data; should do */ char *strip, *newline; GntTextFormatFlags fl = 0; + int pos; g_return_if_fail(ggconv != NULL); @@ -239,13 +240,16 @@ if (flags & GAIM_MESSAGE_NICK) fl |= GNT_TEXT_FLAG_UNDERLINE; + pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); + /* XXX: Remove this workaround when textview can parse messages. */ newline = gaim_strdup_withhtml(message); strip = gaim_markup_strip_html(newline); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), strip, fl); gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); - gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); + if (pos <= 1) + gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); g_free(newline); g_free(strip); Modified: trunk/console/libgnt/gnttextview.c =================================================================== --- trunk/console/libgnt/gnttextview.c 2006-08-05 02:19:19 UTC (rev 16631) +++ trunk/console/libgnt/gnttextview.c 2006-08-05 02:56:18 UTC (rev 16632) @@ -93,6 +93,7 @@ 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); } @@ -294,3 +295,24 @@ gnt_widget_draw(GNT_WIDGET(view)); } +int gnt_text_view_get_lines_below(GntTextView *view) +{ + int below = 0; + GList *list = view->list; + while ((list = list->prev)) + ++below; + return below; +} + +int gnt_text_view_get_lines_above(GntTextView *view) +{ + int above = 0; + GList *list = view->list; + list = g_list_nth(view->list, GNT_WIDGET(view)->priv.height); + if (!list) + return 0; + while ((list = list->next)) + ++above; + return above; +} + Modified: trunk/console/libgnt/gnttextview.h =================================================================== --- trunk/console/libgnt/gnttextview.h 2006-08-05 02:19:19 UTC (rev 16631) +++ trunk/console/libgnt/gnttextview.h 2006-08-05 02:56:18 UTC (rev 16632) @@ -69,6 +69,10 @@ void gnt_text_view_clear(GntTextView *view); +int gnt_text_view_get_lines_below(GntTextView *view); + +int gnt_text_view_get_lines_above(GntTextView *view); + 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: <sa...@us...> - 2006-08-05 02:19:24
|
Revision: 16631 Author: sadrul Date: 2006-08-04 19:19:19 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16631&view=rev Log Message: ----------- Press Alt+d to get an HTML-dump of the contents of the screen. The dump goes in "dump.html" in pwd. Modified Paths: -------------- trunk/console/libgnt/gntmain.c Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-05 02:10:30 UTC (rev 16630) +++ trunk/console/libgnt/gntmain.c 2006-08-05 02:19:19 UTC (rev 16631) @@ -308,6 +308,99 @@ draw_taskbar(); } +static void +dump_screen() +{ + int x, y; + chtype old = 0, now = 0; + FILE *file = fopen("dump.html", "w"); + + fprintf(file, "<pre>"); + for (y = 0; y < getmaxy(stdscr); y++) + { + for (x = 0; x < getmaxx(stdscr); x++) + { + char ch; + now = mvwinch(newscr, y, x); + ch = now & A_CHARTEXT; + now ^= ch; + +#define CHECK(attr, start, end) \ + do \ + { \ + if (now & attr) \ + { \ + if (!(old & attr)) \ + fprintf(file, start); \ + } \ + else if (old & attr) \ + { \ + fprintf(file, end); \ + } \ + } while (0) + + CHECK(A_BOLD, "<b>", "</b>"); + CHECK(A_UNDERLINE, "<u>", "</u>"); + CHECK(A_BLINK, "<blink>", "</blink>"); + + if ((now & A_COLOR) != (old & A_COLOR)) + { + int ret; + short fgp, bgp, r, g, b; + struct + { + int r, g, b; + } fg, bg; + + ret = pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp); + ret = color_content(fgp, &r, &g, &b); + fg.r = r; fg.b = b; fg.g = g; + ret = color_content(bgp, &r, &g, &b); + bg.r = r; bg.b = b; bg.g = g; +#define ADJUST(x) (x = x * 255 / 1000) + ADJUST(fg.r); + ADJUST(fg.g); + ADJUST(fg.b); + ADJUST(bg.r); + ADJUST(bg.b); + ADJUST(bg.g); + + if (x) fprintf(file, "</span>"); + fprintf(file, "<span style=\"background:#%02x%02x%02x;color:#%02x%02x%02x\">", + bg.r, bg.g, bg.b, fg.r, fg.g, fg.b); + } + if (now & A_ALTCHARSET) + { + switch (ch) + { + case 'q': + ch = '-'; break; + case 't': + case 'u': + case 'x': + ch = '|'; break; + case 'v': + case 'w': + case 'l': + case 'm': + case 'k': + case 'j': + case 'n': + ch = '+'; break; + default: + ch = ' '; break; + } + } + fprintf(file, "%c", ch); + old = now; + } + fprintf(file, "</span>\n"); + old = 0; + } + fprintf(file, "</pre>"); + fclose(file); +} + static gboolean io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) { @@ -331,6 +424,12 @@ buffer[rd] = 0; + if (buffer[0] == 27 && buffer[1] == 'd' && buffer[2] == 0) + { + /* This dumps the screen contents in an html file */ + dump_screen(); + } + if (mode == GNT_KP_MODE_NORMAL) { if (focus_list) @@ -567,8 +666,8 @@ wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); noecho(); refresh(); -#if MAYBE_SOMEDAY - mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); +#if 0 + mousemask(NCURSES_BUTTON_PRESSED | NCURSES_BUTTON_RELEASED | REPORT_MOUSE_POSITION, NULL); #endif wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); werase(stdscr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-05 02:10:36
|
Revision: 16630 Author: sadrul Date: 2006-08-04 19:10:30 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16630&view=rev Log Message: ----------- Allow non-ascii characters to be entered in GntEntry. And indicate the position of the cursor in the box. Modified Paths: -------------- trunk/console/libgnt/gntentry.c Modified: trunk/console/libgnt/gntentry.c =================================================================== --- trunk/console/libgnt/gntentry.c 2006-08-03 09:31:32 UTC (rev 16629) +++ trunk/console/libgnt/gntentry.c 2006-08-05 02:10:30 UTC (rev 16630) @@ -25,15 +25,18 @@ if (entry->masked) { mvwhline(widget->window, 0, 0, gnt_ascii_only() ? '*' : ACS_BULLET, - entry->end - entry->scroll); + g_utf8_pointer_to_offset(entry->scroll, entry->end)); } else mvwprintw(widget->window, 0, 0, entry->scroll); - stop = entry->end - entry->scroll; + stop = g_utf8_pointer_to_offset(entry->scroll, entry->end); if (stop < widget->priv.width) mvwhline(widget->window, 0, stop, ENTRY_CHAR, widget->priv.width - stop); + mvwchgat(widget->window, 0, g_utf8_pointer_to_offset(entry->scroll, entry->cursor), 1, + A_REVERSE, COLOR_PAIR(GNT_COLOR_TEXT_NORMAL), NULL); + DEBUG; } @@ -71,22 +74,23 @@ { if (strcmp(text + 1, GNT_KEY_DEL) == 0 && entry->cursor < entry->end) { - memmove(entry->cursor, entry->cursor + 1, entry->end - entry->cursor + 1); - entry->end--; + int len = g_utf8_find_next_char(entry->cursor, NULL) - entry->cursor; + memmove(entry->cursor, entry->cursor + len, entry->end - entry->cursor - len + 1); + entry->end -= len; entry_redraw(widget); } else if (strcmp(text + 1, GNT_KEY_LEFT) == 0 && entry->cursor > entry->start) { - entry->cursor--; + entry->cursor = g_utf8_find_prev_char(entry->start, entry->cursor); if (entry->cursor < entry->scroll) - entry->scroll--; + entry->scroll = entry->cursor; entry_redraw(widget); } else if (strcmp(text + 1, GNT_KEY_RIGHT) == 0 && entry->cursor < entry->end) { - entry->cursor++; - if (entry->cursor - entry->scroll > widget->priv.width) - entry->scroll++; + entry->cursor = g_utf8_find_next_char(entry->cursor, NULL); + if (g_utf8_pointer_to_offset(entry->scroll, entry->cursor) >= widget->priv.width) + entry->scroll = g_utf8_find_next_char(entry->scroll, NULL); entry_redraw(widget); } /* XXX: handle other keys, like home/end, and ctrl+ goodness */ @@ -99,37 +103,44 @@ { if (!iscntrl(text[0])) { - int i; + const char *str, *next; - for (i = 0; text[i]; i++) + for (str = text; *str;) { + int len; + next = g_utf8_find_next_char(str, NULL); + len = next - str; + /* Valid input? */ - if (ispunct(text[i]) && (entry->flag & GNT_ENTRY_FLAG_NO_PUNCT)) + /* XXX: Is it necessary to use _unichar_ variants here? */ + if (ispunct(*str) && (entry->flag & GNT_ENTRY_FLAG_NO_PUNCT)) continue; - if (isspace(text[i]) && (entry->flag & GNT_ENTRY_FLAG_NO_SPACE)) + if (isspace(*str) && (entry->flag & GNT_ENTRY_FLAG_NO_SPACE)) continue; - if (isalpha(text[i]) && !(entry->flag & GNT_ENTRY_FLAG_ALPHA)) + if (isalpha(*str) && !(entry->flag & GNT_ENTRY_FLAG_ALPHA)) continue; - if (isdigit(text[i]) && !(entry->flag & GNT_ENTRY_FLAG_INT)) + if (isdigit(*str) && !(entry->flag & GNT_ENTRY_FLAG_INT)) continue; /* Reached the max? */ - if (entry->max && entry->end - entry->start >= entry->max) + if (entry->max && g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->max) continue; - if (entry->end - entry->start >= entry->buffer) + if (g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->buffer) { char *tmp = g_strdup_printf(entry->start); gnt_entry_set_text(entry, tmp); g_free(tmp); } - *(entry->cursor) = text[i]; - entry->cursor++; + memmove(entry->cursor + len, entry->cursor, entry->end - entry->cursor + 1); + entry->end += len; - entry->end++; - if (entry->cursor - entry->scroll > widget->priv.width) - entry->scroll++; + while (str < next) + *(entry->cursor++) = *str++; + + while (g_utf8_pointer_to_offset(entry->scroll, entry->cursor) >= widget->priv.width) + entry->scroll = g_utf8_find_next_char(entry->scroll, NULL); } entry_redraw(widget); return TRUE; @@ -139,12 +150,13 @@ /* Backspace is here */ if (strcmp(text, GNT_KEY_BACKSPACE) == 0 && entry->cursor > entry->start) { - entry->cursor--; - memmove(entry->cursor, entry->cursor + 1, entry->end - entry->cursor); - entry->end--; + int len = entry->cursor - g_utf8_find_prev_char(entry->start, entry->cursor); + entry->cursor -= len; + memmove(entry->cursor, entry->cursor + len, entry->end - entry->cursor); + entry->end -= len; if (entry->scroll > entry->start) - entry->scroll--; + entry->scroll = g_utf8_find_prev_char(entry->start, entry->scroll); entry_redraw(widget); return TRUE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-03 09:31:37
|
Revision: 16629 Author: thekingant Date: 2006-08-03 02:31:32 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16629&view=rev Log Message: ----------- Backport SVN revision #16628 from HEAD to v2_0_0 Original commit message: This line doesn't seem to be needed, and having it there causes duplicate "Transfer of file whatever.crp complete" messages ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16628&view=rev Modified Paths: -------------- branches/v2_0_0/src/protocols/oscar/oft.c Modified: branches/v2_0_0/src/protocols/oscar/oft.c =================================================================== --- branches/v2_0_0/src/protocols/oscar/oft.c 2006-08-03 09:31:14 UTC (rev 16628) +++ branches/v2_0_0/src/protocols/oscar/oft.c 2006-08-03 09:31:32 UTC (rev 16629) @@ -325,9 +325,6 @@ static void peer_oft_recv_frame_done(PeerConnection *conn, OftFrame *frame) { - if (frame->nrecvd == frame->size) - gaim_xfer_set_completed(conn->xfer, TRUE); - gaim_input_remove(conn->watcher_incoming); conn->watcher_incoming = 0; conn->xfer->fd = conn->fd; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-03 09:31:17
|
Revision: 16628 Author: thekingant Date: 2006-08-03 02:31:14 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16628&view=rev Log Message: ----------- This line doesn't seem to be needed, and having it there causes duplicate "Transfer of file whatever.crp complete" messages Modified Paths: -------------- trunk/src/protocols/oscar/oft.c Modified: trunk/src/protocols/oscar/oft.c =================================================================== --- trunk/src/protocols/oscar/oft.c 2006-08-03 09:19:10 UTC (rev 16627) +++ trunk/src/protocols/oscar/oft.c 2006-08-03 09:31:14 UTC (rev 16628) @@ -325,9 +325,6 @@ static void peer_oft_recv_frame_done(PeerConnection *conn, OftFrame *frame) { - if (frame->nrecvd == frame->size) - gaim_xfer_set_completed(conn->xfer, TRUE); - gaim_input_remove(conn->watcher_incoming); conn->watcher_incoming = 0; conn->xfer->fd = conn->fd; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-03 09:19:12
|
Revision: 16627 Author: thekingant Date: 2006-08-03 02:19:10 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16627&view=rev Log Message: ----------- Backport SVN revision #16626 from HEAD to v2_0_0 Original commit message Hopefully load non-ASCII aliases from our SSI information correctly more often with AIM/ICQ. Mattias Eriksson helped with this patch ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16626&view=rev Modified Paths: -------------- branches/v2_0_0/COPYRIGHT branches/v2_0_0/src/protocols/oscar/oscar.c Modified: branches/v2_0_0/COPYRIGHT =================================================================== --- branches/v2_0_0/COPYRIGHT 2006-08-03 09:17:05 UTC (rev 16626) +++ branches/v2_0_0/COPYRIGHT 2006-08-03 09:19:10 UTC (rev 16627) @@ -86,6 +86,7 @@ Nelson Elhage Ignacio J. Elia Brian Enigma +Mattias Eriksson Stefan Esser Steffen Eschenbacher Marc Etcheverry Modified: branches/v2_0_0/src/protocols/oscar/oscar.c =================================================================== --- branches/v2_0_0/src/protocols/oscar/oscar.c 2006-08-03 09:17:05 UTC (rev 16626) +++ branches/v2_0_0/src/protocols/oscar/oscar.c 2006-08-03 09:19:10 UTC (rev 16627) @@ -4785,7 +4785,18 @@ char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, curitem->name); char *gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL; char *alias = aim_ssi_getalias(od->ssi.local, gname, curitem->name); - char *alias_utf8 = alias ? oscar_utf8_try_convert(gc->account, alias) : NULL; + char *alias_utf8; + + if (alias != NULL) + { + if (g_utf8_validate(alias, -1, NULL)) + alias_utf8 = g_strdup(alias); + else + alias_utf8 = oscar_utf8_try_convert(account, alias); + } + else + alias_utf8 = NULL; + b = gaim_find_buddy(gc->account, curitem->name); /* Should gname be freed here? -- elb */ /* Not with the current code, but that might be cleaner -- med */ @@ -4945,8 +4956,18 @@ gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL; + alias = aim_ssi_getalias(od->ssi.local, gname, name); - alias_utf8 = alias ? oscar_utf8_try_convert(gc->account, alias) : NULL; + if (alias != NULL) + { + if (g_utf8_validate(alias, -1, NULL)) + alias_utf8 = g_strdup(alias); + else + alias_utf8 = oscar_utf8_try_convert(gaim_connection_get_account(gc), alias); + } + else + alias_utf8 = NULL; + b = gaim_find_buddy(gc->account, name); g_free(alias); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-03 09:17:08
|
Revision: 16626 Author: thekingant Date: 2006-08-03 02:17:05 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16626&view=rev Log Message: ----------- Hopefully load non-ASCII aliases from our SSI information correctly more often with AIM/ICQ. Mattias Eriksson helped with this patch Modified Paths: -------------- trunk/COPYRIGHT trunk/src/protocols/oscar/oscar.c Modified: trunk/COPYRIGHT =================================================================== --- trunk/COPYRIGHT 2006-08-03 07:58:11 UTC (rev 16625) +++ trunk/COPYRIGHT 2006-08-03 09:17:05 UTC (rev 16626) @@ -86,6 +86,7 @@ Nelson Elhage Ignacio J. Elia Brian Enigma +Mattias Eriksson Stefan Esser Steffen Eschenbacher Marc Etcheverry Modified: trunk/src/protocols/oscar/oscar.c =================================================================== --- trunk/src/protocols/oscar/oscar.c 2006-08-03 07:58:11 UTC (rev 16625) +++ trunk/src/protocols/oscar/oscar.c 2006-08-03 09:17:05 UTC (rev 16626) @@ -4786,7 +4786,18 @@ char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, curitem->name); char *gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL; char *alias = aim_ssi_getalias(od->ssi.local, gname, curitem->name); - char *alias_utf8 = alias ? oscar_utf8_try_convert(gc->account, alias) : NULL; + char *alias_utf8; + + if (alias != NULL) + { + if (g_utf8_validate(alias, -1, NULL)) + alias_utf8 = g_strdup(alias); + else + alias_utf8 = oscar_utf8_try_convert(account, alias); + } + else + alias_utf8 = NULL; + b = gaim_find_buddy(gc->account, curitem->name); /* Should gname be freed here? -- elb */ /* Not with the current code, but that might be cleaner -- med */ @@ -4946,8 +4957,18 @@ gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL; + alias = aim_ssi_getalias(od->ssi.local, gname, name); - alias_utf8 = alias ? oscar_utf8_try_convert(gc->account, alias) : NULL; + if (alias != NULL) + { + if (g_utf8_validate(alias, -1, NULL)) + alias_utf8 = g_strdup(alias); + else + alias_utf8 = oscar_utf8_try_convert(gaim_connection_get_account(gc), alias); + } + else + alias_utf8 = NULL; + b = gaim_find_buddy(gc->account, name); g_free(alias); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-03 07:58:14
|
Revision: 16625 Author: thekingant Date: 2006-08-03 00:58:11 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16625&view=rev Log Message: ----------- Backport SVN revision #16624 from HEAD to v2_0_0 Original commit message: Change "Alias:" to "Local alias:" in the account editor to hopefully avoid minor confusion ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16624&view=rev Modified Paths: -------------- branches/v2_0_0/src/gtkaccount.c Modified: branches/v2_0_0/src/gtkaccount.c =================================================================== --- branches/v2_0_0/src/gtkaccount.c 2006-08-03 07:57:52 UTC (rev 16624) +++ branches/v2_0_0/src/gtkaccount.c 2006-08-03 07:58:11 UTC (rev 16625) @@ -860,7 +860,7 @@ /* Alias */ dialog->alias_entry = gtk_entry_new(); - add_pref_box(dialog, vbox, _("Alias:"), dialog->alias_entry); + add_pref_box(dialog, vbox, _("Local alias:"), dialog->alias_entry); /* Remember Password */ dialog->remember_pass_check = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-03 07:57:54
|
Revision: 16624 Author: thekingant Date: 2006-08-03 00:57:52 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16624&view=rev Log Message: ----------- Change "Alias:" to "Local alias:" in the account editor to hopefully avoid minor confusion Modified Paths: -------------- trunk/src/gtkaccount.c Modified: trunk/src/gtkaccount.c =================================================================== --- trunk/src/gtkaccount.c 2006-08-03 07:26:47 UTC (rev 16623) +++ trunk/src/gtkaccount.c 2006-08-03 07:57:52 UTC (rev 16624) @@ -860,7 +860,7 @@ /* Alias */ dialog->alias_entry = gtk_entry_new(); - add_pref_box(dialog, vbox, _("Alias:"), dialog->alias_entry); + add_pref_box(dialog, vbox, _("Local alias:"), dialog->alias_entry); /* Remember Password */ dialog->remember_pass_check = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-03 07:26:51
|
Revision: 16623 Author: thekingant Date: 2006-08-03 00:26:47 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16623&view=rev Log Message: ----------- Backport SVN revisions 16521, 16527 and 16554 from HEAD to v2_0_0 These are aaronsheldon's chat speed improvements Original commit messages: Merges soc-2006-chat-speed into trunk. (r16371:r16435) Joining large chat rooms, like IRC rooms, is much quicker. Additional improvment should be seen when using >=GTK+-2.6. Sadrul sent me this patch to look over and then commit. It fixes a PRPL leak in Yahoo's chat and fixes a few other memory leaks that were mostly my fault. Updating the API changelog to reflect the chat-speed merge changes. Modified Paths: -------------- branches/v2_0_0/plugins/ChangeLog.API branches/v2_0_0/src/conversation.c branches/v2_0_0/src/conversation.h branches/v2_0_0/src/gtkconv.c branches/v2_0_0/src/gtkconv.h branches/v2_0_0/src/protocols/yahoo/yahoochat.c Modified: branches/v2_0_0/plugins/ChangeLog.API =================================================================== --- branches/v2_0_0/plugins/ChangeLog.API 2006-08-03 07:16:35 UTC (rev 16622) +++ branches/v2_0_0/plugins/ChangeLog.API 2006-08-03 07:26:47 UTC (rev 16623) @@ -43,9 +43,11 @@ const char *name, const char *alias * gaim_conv_chat_add_users(), added extra_msgs and new_arrivals (pass NULL and FALSE respectively, to get the same behavior as before) - * chat_add_users in GaimConversationUiOps, added flags, aliases, - and new_arrivals + * chat_add_users in GaimConversationUiOps, added cbuddies and + new_arrivals and removed buddies. * chat_rename_user in GaimConversationUiOps, added new_alias + * gaim_conv_chat_cb_new(), added alias. (pass NULL to get the same + behavior as before). * GaimConversation.log became GList * GaimConversation.logs, so that a conversation can have multiple logs at once * gaim_conv_chat_add_user, added extra_msgs Modified: branches/v2_0_0/src/conversation.c =================================================================== --- branches/v2_0_0/src/conversation.c 2006-08-03 07:16:35 UTC (rev 16622) +++ branches/v2_0_0/src/conversation.c 2006-08-03 07:26:47 UTC (rev 16623) @@ -38,7 +38,6 @@ static GList *chats = NULL; static GaimConversationUiOps *default_ops = NULL; - void gaim_conversations_set_ui_ops(GaimConversationUiOps *ops) { @@ -1441,17 +1440,56 @@ g_list_free(flags2); } +int +gaim_conv_chat_cb_compare(GaimConvChatBuddy *a, GaimConvChatBuddy *b) +{ + GaimConvChatBuddyFlags f1 = 0, f2 = 0; + char *user1 = NULL, *user2 = NULL; + gint ret = 0; + + + if (a) { + f1 = a->flags; + if (a->alias_key) + user1 = a->alias_key; + else if (a->name) + user1 = a->name; + } + + if (b) { + f2 = b->flags; + if (b->alias_key) + user2 = b->alias_key; + else if (b->name) + user2 = b->name; + } + + if (user1 == NULL || user2 == NULL) { + if (!(user1 == NULL && user2 == NULL)) + ret = (user1 == NULL) ? -1: 1; + } else if (f1 != f2) { + /* sort more important users first */ + ret = (f1 > f2) ? -1 : 1; + } else if (a->buddy != b->buddy) { + ret = a->buddy ? -1 : 1; + } else { + ret = strcasecmp(user1, user2); + } + + return ret; +} + void gaim_conv_chat_add_users(GaimConvChat *chat, GList *users, GList *extra_msgs, GList *flags, gboolean new_arrivals) { GaimConversation *conv; GaimConversationUiOps *ops; - GaimConvChatBuddy *cb; + GaimConvChatBuddy *cbuddy; GaimConnection *gc; GaimPluginProtocolInfo *prpl_info; GList *ul, *fl; - GList *aliases = NULL; + GList *cbuddies = NULL; g_return_if_fail(chat != NULL); g_return_if_fail(users != NULL); @@ -1470,7 +1508,7 @@ const char *user = (const char *)ul->data; const char *alias = user; gboolean quiet; - GaimConvChatBuddyFlags flags = GPOINTER_TO_INT(fl->data); + GaimConvChatBuddyFlags flag = GPOINTER_TO_INT(fl->data); const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL); if (!strcmp(chat->nick, gaim_normalize(conv->account, user))) { @@ -1490,15 +1528,16 @@ } quiet = GPOINTER_TO_INT(gaim_signal_emit_return_1(gaim_conversations_get_handle(), - "chat-buddy-joining", conv, user, flags)) | + "chat-buddy-joining", conv, user, flag)) | gaim_conv_chat_is_user_ignored(chat, user); - cb = gaim_conv_chat_cb_new(user, flags); + cbuddy = gaim_conv_chat_cb_new(user, alias, flag); + /* This seems dumb. Why should we set users thousands of times? */ gaim_conv_chat_set_users(chat, - g_list_prepend(gaim_conv_chat_get_users(chat), cb)); - /* We reverse this later to keep it in the same order as users. */ - aliases = g_list_prepend(aliases, (char *)alias); + g_list_prepend(gaim_conv_chat_get_users(chat), cbuddy)); + cbuddies = g_list_prepend(cbuddies, cbuddy); + if (!quiet && new_arrivals) { char *escaped = g_markup_escape_text(alias, -1); char *tmp; @@ -1518,21 +1557,19 @@ } gaim_signal_emit(gaim_conversations_get_handle(), - "chat-buddy-joined", conv, user, flags, new_arrivals); + "chat-buddy-joined", conv, user, flag, new_arrivals); ul = ul->next; fl = fl->next; if (extra_msgs != NULL) extra_msgs = extra_msgs->next; } - /* This needs to be in the same order as users, but it's faster - * to prepend, so we do that above. */ - aliases = g_list_reverse(aliases); - + cbuddies = g_list_sort(cbuddies, (GCompareFunc)gaim_conv_chat_cb_compare); + if (ops != NULL && ops->chat_add_users != NULL) - ops->chat_add_users(conv, users, flags, aliases, new_arrivals); + ops->chat_add_users(conv, cbuddies, new_arrivals); - g_list_free(aliases); + g_list_free(cbuddies); } void @@ -1562,7 +1599,7 @@ g_return_if_fail(prpl_info != NULL); flags = gaim_conv_chat_user_get_flags(chat, old_user); - cb = gaim_conv_chat_cb_new(new_user, flags); + cb = gaim_conv_chat_cb_new(new_user, NULL, flags); gaim_conv_chat_set_users(chat, g_list_prepend(gaim_conv_chat_get_users(chat), cb)); @@ -1873,9 +1910,8 @@ return chat->left; } - GaimConvChatBuddy * -gaim_conv_chat_cb_new(const char *name, GaimConvChatBuddyFlags flags) +gaim_conv_chat_cb_new(const char *name, const char *alias, GaimConvChatBuddyFlags flags) { GaimConvChatBuddy *cb; @@ -1884,6 +1920,10 @@ cb = g_new0(GaimConvChatBuddy, 1); cb->name = g_strdup(name); cb->flags = flags; + if (alias) + cb->alias = g_strdup(alias); + else + cb->alias = NULL; GAIM_DBUS_REGISTER_POINTER(cb, GaimConvChatBuddy); return cb; Modified: branches/v2_0_0/src/conversation.h =================================================================== --- branches/v2_0_0/src/conversation.h 2006-08-03 07:16:35 UTC (rev 16622) +++ branches/v2_0_0/src/conversation.h 2006-08-03 07:26:47 UTC (rev 16623) @@ -158,8 +158,8 @@ const char *message, GaimMessageFlags flags, time_t mtime); - void (*chat_add_users)(GaimConversation *conv, GList *users, - GList *flags, GList *aliases, gboolean new_arrivals); + void (*chat_add_users)(GaimConversation *conv, GList *cbuddies, gboolean new_arrivals); + void (*chat_rename_user)(GaimConversation *conv, const char *old_name, const char *new_name, const char *new_alias); void (*chat_remove_users)(GaimConversation *conv, GList *users); @@ -214,6 +214,9 @@ struct _GaimConvChatBuddy { char *name; /**< The name */ + char *alias; /**< The alias */ + char *alias_key; /**< The alias key */ + gboolean buddy; /**< ChatBuddy is on the blist */ GaimConvChatBuddyFlags flags; /**< Flags (ops, voice etc.) */ }; @@ -1133,11 +1136,12 @@ * Creates a new chat buddy * * @param name The name. + * @param alias The alias. * @param flags The flags. * * @return The new chat buddy */ -GaimConvChatBuddy *gaim_conv_chat_cb_new(const char *name, +GaimConvChatBuddy *gaim_conv_chat_cb_new(const char *name, const char *alias, GaimConvChatBuddyFlags flags); /** Modified: branches/v2_0_0/src/gtkconv.c =================================================================== --- branches/v2_0_0/src/gtkconv.c 2006-08-03 07:16:35 UTC (rev 16622) +++ branches/v2_0_0/src/gtkconv.c 2006-08-03 07:26:47 UTC (rev 16623) @@ -154,8 +154,7 @@ static void got_typing_keypress(GaimGtkConversation *gtkconv, gboolean first); static void gray_stuff_out(GaimGtkConversation *gtkconv); static GList *generate_invite_user_names(GaimConnection *gc); -static void add_chat_buddy_common(GaimConversation *conv, const char *name, - GaimConvChatBuddyFlags flags, const char *alias, const char *old_name); +static void add_chat_buddy_common(GaimConversation *conv, GaimConvChatBuddy *cb, const char *old_name); static gboolean tab_complete(GaimConversation *conv); static void gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type); static void gtkconv_set_unseen(GaimGtkConversation *gtkconv, GaimUnseenState state); @@ -1394,6 +1393,7 @@ { GaimConversation *conv = gtkconv->active_conv; GaimGtkChatPane *gtkchat; + GaimConvChatBuddy *cbuddy; GaimConvChat *chat; GaimConvChatBuddyFlags flags; GtkTreeIter iter; @@ -1424,7 +1424,9 @@ else gaim_conv_chat_ignore(chat, name); - add_chat_buddy_common(conv, name, flags, alias, NULL); + cbuddy = gaim_conv_chat_cb_new(name, alias, flags); + + add_chat_buddy_common(conv, cbuddy, NULL); g_free(name); g_free(alias); } @@ -3288,7 +3290,7 @@ } static void -add_chat_buddy_common(GaimConversation *conv, const char *name, GaimConvChatBuddyFlags flags, const char *alias, const char *old_name) +add_chat_buddy_common(GaimConversation *conv, GaimConvChatBuddy *cb, const char *old_name) { GaimGtkConversation *gtkconv; GaimGtkChatPane *gtkchat; @@ -3300,6 +3302,12 @@ GtkTreeIter iter; gboolean is_me = FALSE; gboolean is_buddy; + gchar *alias_key, *name, *alias; + int flags; + + alias = cb->alias; + name = cb->name; + flags = GPOINTER_TO_INT(cb->flags); chat = GAIM_CONV_CHAT(conv); gtkconv = GAIM_GTK_CONVERSATION(conv); @@ -3318,36 +3326,79 @@ is_buddy = (gaim_find_buddy(conv->account, name) != NULL); - gtk_list_store_append(ls, &iter); + alias_key = g_utf8_collate_key(alias, strlen(alias)); if (is_me) { GdkColor send_color; gdk_color_parse(SEND_COLOR, &send_color); - + +#if GTK_CHECK_VERSION(2,6,0) + gtk_list_store_insert_with_values + (ls, + &iter, +/* + * The GTK docs are mute about the effects of the "row" value for performance. + * X-Chat hardcodes their value to 0 (prepend) and -1 (append), so we will too. + * It *might* be faster to search the gtk_list_store and set row accurately, + * but no one in #gtk+ seems to know anything about it either. + * Inserting in the "wrong" location has no visible ill effects. - F.P. + */ + -1, /* "row" */ + CHAT_USERS_ICON_COLUMN, pixbuf, + CHAT_USERS_ALIAS_COLUMN, alias, + CHAT_USERS_ALIAS_KEY_COLUMN, alias_key, + CHAT_USERS_NAME_COLUMN, name, + CHAT_USERS_FLAGS_COLUMN, flags, + CHAT_USERS_COLOR_COLUMN, &send_color, + CHAT_USERS_BUDDY_COLUMN, is_buddy, + -1); + } + else { + gtk_list_store_insert_with_values + (ls, + &iter, + -1, /* "row" */ + CHAT_USERS_ICON_COLUMN, pixbuf, + CHAT_USERS_ALIAS_COLUMN, alias, + CHAT_USERS_ALIAS_KEY_COLUMN, alias_key, + CHAT_USERS_NAME_COLUMN, name, + CHAT_USERS_FLAGS_COLUMN, flags, + CHAT_USERS_COLOR_COLUMN, get_nick_color(gtkconv, name), + CHAT_USERS_BUDDY_COLUMN, is_buddy, + -1); + +#else + gtk_list_store_append(ls, &iter); gtk_list_store_set(ls, &iter, CHAT_USERS_ICON_COLUMN, pixbuf, CHAT_USERS_ALIAS_COLUMN, alias, + CHAT_USERS_ALIAS_KEY_COLUMN, alias_key, CHAT_USERS_NAME_COLUMN, name, CHAT_USERS_FLAGS_COLUMN, flags, CHAT_USERS_COLOR_COLUMN, &send_color, CHAT_USERS_BUDDY_COLUMN, is_buddy, -1); } - else - { + + else { + + gtk_list_store_append(ls, &iter); gtk_list_store_set(ls, &iter, CHAT_USERS_ICON_COLUMN, pixbuf, CHAT_USERS_ALIAS_COLUMN, alias, + CHAT_USERS_ALIAS_KEY_COLUMN, alias_key, CHAT_USERS_NAME_COLUMN, name, CHAT_USERS_FLAGS_COLUMN, flags, CHAT_USERS_COLOR_COLUMN, get_nick_color(gtkconv, name), CHAT_USERS_BUDDY_COLUMN, is_buddy, -1); +#endif } if (pixbuf) g_object_unref(pixbuf); + g_free(alias_key); } static void @@ -3601,12 +3652,12 @@ gint ret = 0; gtk_tree_model_get(model, a, - CHAT_USERS_ALIAS_COLUMN, &user1, + CHAT_USERS_ALIAS_KEY_COLUMN, &user1, CHAT_USERS_FLAGS_COLUMN, &f1, CHAT_USERS_BUDDY_COLUMN, &buddy1, -1); gtk_tree_model_get(model, b, - CHAT_USERS_ALIAS_COLUMN, &user2, + CHAT_USERS_ALIAS_KEY_COLUMN, &user2, CHAT_USERS_FLAGS_COLUMN, &f2, CHAT_USERS_BUDDY_COLUMN, &buddy2, -1); @@ -3620,7 +3671,7 @@ } else if (buddy1 != buddy2) { ret = buddy1 ? -1 : 1; } else { - ret = gaim_utf8_strcasecmp(user1, user2); + ret = strcasecmp(user1, user2); } g_free(user1); @@ -3657,17 +3708,23 @@ if (!strcmp(normalized_name, gaim_normalize(conv->account, name))) { const char *alias = name; + char *alias_key = NULL; GaimBuddy *buddy2; if (strcmp(chat->nick, gaim_normalize(conv->account, name))) { /* This user is not me, so look into updating the alias. */ - if ((buddy2 = gaim_find_buddy(conv->account, name)) != NULL) + if ((buddy2 = gaim_find_buddy(conv->account, name)) != NULL) { alias = gaim_buddy_get_contact_alias(buddy2); + } + alias_key = g_utf8_collate_key(alias, strlen(alias)); + gtk_list_store_set(GTK_LIST_STORE(model), &iter, - CHAT_USERS_ALIAS_COLUMN, alias, - -1); + CHAT_USERS_ALIAS_COLUMN, alias, + CHAT_USERS_ALIAS_KEY_COLUMN, alias_key, + -1); + g_free(alias_key); } g_free(name); break; @@ -3907,11 +3964,10 @@ gtk_widget_show(sw); ls = gtk_list_store_new(CHAT_USERS_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, - G_TYPE_STRING, G_TYPE_INT, GDK_TYPE_COLOR, G_TYPE_BOOLEAN); - gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_COLUMN, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, + GDK_TYPE_COLOR, G_TYPE_BOOLEAN); + gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN, sort_chat_users, NULL, NULL); - gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_COLUMN, - GTK_SORT_ASCENDING); list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); @@ -4926,16 +4982,15 @@ account, name, message, conv, flags); g_free(displaying); } - static void -gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *users, GList *flags, GList *aliases, gboolean new_arrivals) +gaim_gtkconv_chat_add_users(GaimConversation *conv, GList *cbuddies, gboolean new_arrivals) { GaimConvChat *chat; GaimGtkConversation *gtkconv; GaimGtkChatPane *gtkchat; + GtkListStore *ls; GList *l; - GList *ll; - GList *lll; + char tmp[BUF_LONG]; int num_users; @@ -4952,15 +5007,22 @@ gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); - l = users; - ll = flags; - lll = aliases; - while (l != NULL && ll != NULL && lll != NULL) { - add_chat_buddy_common(conv, (const char *)l->data, GPOINTER_TO_INT(ll->data), (const char *)lll->data, NULL); + ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); + + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, + GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID); + + l = cbuddies; + while (l != NULL) { + add_chat_buddy_common(conv, (GaimConvChatBuddy *)l->data, NULL); l = l->next; - ll = ll->next; - lll = lll->next; } + + /* Currently GTK+ maintains our sorted list after it's in the tree. + * This may change if it turns out we can manage it faster ourselves. + */ + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN, + GTK_SORT_ASCENDING); } static void @@ -4971,6 +5033,7 @@ GaimGtkConversation *gtkconv; GaimGtkChatPane *gtkchat; GaimConvChatBuddyFlags flags; + GaimConvChatBuddy *cbuddy; GtkTreeIter iter; GtkTreeModel *model; int f = 1; @@ -5005,7 +5068,9 @@ g_return_if_fail(new_alias != NULL); - add_chat_buddy_common(conv, new_name, flags, new_alias, old_name); + cbuddy = gaim_conv_chat_cb_new(new_name, new_alias, flags); + + add_chat_buddy_common(conv, cbuddy, old_name); } static void @@ -5066,6 +5131,7 @@ { GaimConvChat *chat; GaimConvChatBuddyFlags flags; + GaimConvChatBuddy *cbuddy; GaimGtkConversation *gtkconv; GaimGtkChatPane *gtkchat; GtkTreeIter iter; @@ -5109,7 +5175,9 @@ flags = gaim_conv_chat_user_get_flags(chat, user); - add_chat_buddy_common(conv, user, flags, alias, NULL); + cbuddy = gaim_conv_chat_cb_new(user, alias, flags); + + add_chat_buddy_common(conv, cbuddy, NULL); g_free(alias); } Modified: branches/v2_0_0/src/gtkconv.h =================================================================== --- branches/v2_0_0/src/gtkconv.h 2006-08-03 07:16:35 UTC (rev 16622) +++ branches/v2_0_0/src/gtkconv.h 2006-08-03 07:26:47 UTC (rev 16623) @@ -44,6 +44,7 @@ enum { CHAT_USERS_ICON_COLUMN, CHAT_USERS_ALIAS_COLUMN, + CHAT_USERS_ALIAS_KEY_COLUMN, CHAT_USERS_NAME_COLUMN, CHAT_USERS_FLAGS_COLUMN, CHAT_USERS_COLOR_COLUMN, Modified: branches/v2_0_0/src/protocols/yahoo/yahoochat.c =================================================================== --- branches/v2_0_0/src/protocols/yahoo/yahoochat.c 2006-08-03 07:16:35 UTC (rev 16622) +++ branches/v2_0_0/src/protocols/yahoo/yahoochat.c 2006-08-03 07:26:47 UTC (rev 16623) @@ -460,6 +460,7 @@ yd->chat_name = g_strdup(room); gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members, NULL, flags, FALSE); } + g_list_free(flags); } else if (c) { yahoo_chat_add_users(GAIM_CONV_CHAT(c), members); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-03 07:16:54
|
Revision: 16622 Author: sadrul Date: 2006-08-03 00:16:35 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16622&view=rev Log Message: ----------- Add commands /accounts, /buddylist, /debugwin and /plugins. It allows the user to close those windows, and pop them back up when necessary -- provided a conversation window is open -- which I am assuming would be the case most of the time. Until there's some better way of accessing these dialogs (eg. menus), this is the only way. Modified Paths: -------------- trunk/console/gntaccount.c trunk/console/gntblist.c trunk/console/gntblist.h trunk/console/gntconv.c trunk/console/gntdebug.h trunk/console/gntplugin.c Modified: trunk/console/gntaccount.c =================================================================== --- trunk/console/gntaccount.c 2006-08-02 23:52:45 UTC (rev 16621) +++ trunk/console/gntaccount.c 2006-08-03 07:16:35 UTC (rev 16622) @@ -548,6 +548,13 @@ gaim_account_set_enabled(account, GAIM_GNT_UI, gnt_tree_get_choice(GNT_TREE(widget), key)); } +static void +reset_accounts_win(GntWidget *widget, gpointer null) +{ + accounts.window = NULL; + accounts.tree = NULL; +} + void gg_accounts_show_all() { GList *iter; @@ -597,6 +604,8 @@ g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(delete_account_cb), accounts.tree); gnt_box_add_widget(GNT_BOX(accounts.window), box); + + g_signal_connect(G_OBJECT(accounts.window), "destroy", G_CALLBACK(reset_accounts_win), NULL); gnt_widget_show(accounts.window); } @@ -641,7 +650,8 @@ void gg_accounts_uninit() { - gnt_widget_destroy(accounts.window); + if (accounts.window) + gnt_widget_destroy(accounts.window); } /* The following uiops stuff are copied from gtkaccount.c */ Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-02 23:52:45 UTC (rev 16621) +++ trunk/console/gntblist.c 2006-08-03 07:16:35 UTC (rev 16622) @@ -66,7 +66,7 @@ { GGBlist *ggblist = list->ui_data; - if (node->ui_data == NULL) + if (ggblist == NULL || node->ui_data == NULL) return; gnt_tree_remove(GNT_TREE(ggblist->tree), node); @@ -85,6 +85,9 @@ static void node_update(GaimBuddyList *list, GaimBlistNode *node) { + if (list->ui_data == NULL) + return; + if (node->ui_data != NULL) { gnt_tree_change_text(GNT_TREE(ggblist->tree), node, @@ -744,6 +747,40 @@ gaim_prefs_set_int(PREF_ROOT "/position/y", y); } +static void +reset_blist_window(GntWidget *window, gpointer null) +{ + GaimBlistNode *node; + gaim_signals_disconnect_by_handle(gg_blist_get_handle()); + gaim_get_blist()->ui_data = NULL; + + node = gaim_blist_get_root(); + while (node) + { + node->ui_data = NULL; + node = gaim_blist_node_next(node, TRUE); + } + + remove_peripherals(ggblist); + g_free(ggblist); + ggblist = NULL; +} + +static void +populate_buddylist() +{ + GaimBlistNode *node; + GaimBuddyList *list; + + list = gaim_get_blist(); + node = gaim_blist_get_root(); + while (node) + { + node_update(list, node); + node = gaim_blist_node_next(node, TRUE); + } +} + void gg_blist_init() { gaim_prefs_add_none(PREF_ROOT); @@ -754,6 +791,16 @@ gaim_prefs_add_int(PREF_ROOT "/position/x", 0); gaim_prefs_add_int(PREF_ROOT "/position/y", 0); + gg_blist_show(); + + return; +} + +void gg_blist_show() +{ + if (ggblist) + return; + ggblist = g_new0(GGBlist, 1); gaim_get_blist()->ui_data = ggblist; @@ -805,11 +852,16 @@ ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); g_signal_connect(G_OBJECT(ggblist->tree), "size_changed", G_CALLBACK(size_changed_cb), NULL); g_signal_connect(G_OBJECT(ggblist->window), "position_set", G_CALLBACK(save_position_cb), NULL); + g_signal_connect(G_OBJECT(ggblist->window), "destroy", G_CALLBACK(reset_blist_window), NULL); + populate_buddylist(); } void gg_blist_uninit() { + if (ggblist == NULL) + return; + gnt_widget_destroy(ggblist->window); g_free(ggblist); ggblist = NULL; Modified: trunk/console/gntblist.h =================================================================== --- trunk/console/gntblist.h 2006-08-02 23:52:45 UTC (rev 16621) +++ trunk/console/gntblist.h 2006-08-03 07:16:35 UTC (rev 16622) @@ -6,6 +6,8 @@ void gg_blist_uninit(); +void gg_blist_show(); + void gg_blist_get_position(int *x, int *y); void gg_blist_set_position(int x, int y); Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-02 23:52:45 UTC (rev 16621) +++ trunk/console/gntconv.c 2006-08-03 07:16:35 UTC (rev 16622) @@ -5,8 +5,11 @@ #include <util.h> #include "gntgaim.h" +#include "gntaccount.h" #include "gntblist.h" #include "gntconv.h" +#include "gntdebug.h" +#include "gntplugin.h" #include "gnt.h" #include "gntbox.h" @@ -478,6 +481,13 @@ return GAIM_CMD_STATUS_OK; } +static GaimCmdRet +cmd_show_window(GaimConversation *conv, const char *cmd, char **args, char **error, gpointer data) +{ + void (*callback)() = data; + callback(); + return GAIM_CMD_STATUS_OK; +} void gg_conversation_init() { @@ -507,6 +517,20 @@ gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, help_command_cb, _("help <command>: Help on a specific command."), NULL); + + /* Now some commands to bring up some other windows */ + gaim_cmd_register("plugins", "", GAIM_CMD_P_DEFAULT, + GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, + cmd_show_window, _("plugins: Show the plugins window."), gg_plugins_show_all); + gaim_cmd_register("buddylist", "", GAIM_CMD_P_DEFAULT, + GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, + cmd_show_window, _("buddylist: Show the buddylist."), gg_blist_show); + gaim_cmd_register("accounts", "", GAIM_CMD_P_DEFAULT, + GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, + cmd_show_window, _("accounts: Show the accounts window."), gg_accounts_show_all); + gaim_cmd_register("debugwin", "", GAIM_CMD_P_DEFAULT, + GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, + cmd_show_window, _("debugwin: Show the debug window."), gg_debug_window_show); } void gg_conversation_uninit() Modified: trunk/console/gntdebug.h =================================================================== --- trunk/console/gntdebug.h 2006-08-02 23:52:45 UTC (rev 16621) +++ trunk/console/gntdebug.h 2006-08-03 07:16:35 UTC (rev 16622) @@ -6,3 +6,4 @@ void gg_debug_uninit(); +void gg_debug_window_show(); Modified: trunk/console/gntplugin.c =================================================================== --- trunk/console/gntplugin.c 2006-08-02 23:52:45 UTC (rev 16621) +++ trunk/console/gntplugin.c 2006-08-03 07:16:35 UTC (rev 16622) @@ -70,6 +70,14 @@ gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0); } +static void +reset_plugin_window(GntWidget *window, gpointer null) +{ + plugins.window = NULL; + plugins.tree = NULL; + plugins.aboot = NULL; +} + void gg_plugins_show_all() { GntWidget *window, *tree, *box, *aboot; @@ -118,6 +126,7 @@ gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL); g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL); + g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(reset_plugin_window), NULL); gnt_widget_show(window); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ebl...@us...> - 2006-08-02 23:52:50
|
Revision: 16621 Author: eblanton Date: 2006-08-02 16:52:45 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16621&view=rev Log Message: ----------- classic Modified Paths: -------------- trunk/doc/gaims_funniest_home_convos.txt Modified: trunk/doc/gaims_funniest_home_convos.txt =================================================================== --- trunk/doc/gaims_funniest_home_convos.txt 2006-08-02 16:47:58 UTC (rev 16620) +++ trunk/doc/gaims_funniest_home_convos.txt 2006-08-02 23:52:45 UTC (rev 16621) @@ -360,3 +360,16 @@ gaim becomes a text terminal [time passes ...] 21:38 <An_Idiot> I'm terribly conservative when it comes to security + +19:47 <someusr> hey +19:48 <someusr> how do i set aim to block all users except those on my + buddy list? +19:48 <someusr> don't tell me i have to log in with the regular AIM :( +19:48 <Paco-Paco> I wouldn't tell you that, because it's wrong +19:48 <Paco-Paco> how about you look in privacy +19:49 <someusr> where? +19:49 <someusr> i can't find it +19:49 <SimGuy> in Privacy +19:49 <someusr> OH! +19:49 <someusr> haha +19:49 <someusr> thanks! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |