im.pidgin.pidgin.2.2.2: 34e9ce04ae92189b671fca4e29302f691c01c65d
lschiere at pidgin.im
lschiere at pidgin.im
Fri Oct 19 17:11:18 EDT 2007
-----------------------------------------------------------------
Revision: 34e9ce04ae92189b671fca4e29302f691c01c65d
Ancestor: 40781e4e65ee5247f80f100714b121bfdc8906c1
Author: lschiere at pidgin.im
Date: 2007-10-19T17:06:53
Branch: im.pidgin.pidgin.2.2.2
Modified files:
finch/libgnt/gntbindable.h finch/libgnt/gntbutton.h
finch/libgnt/gntcheckbox.h finch/libgnt/gntclipboard.c
finch/libgnt/gntclipboard.h finch/libgnt/gntcolors.h
finch/libgnt/gntcombobox.h finch/libgnt/gntentry.h
finch/libgnt/gnttree.c libpurple/protocols/myspace/markup.c
libpurple/protocols/myspace/myspace.c
libpurple/protocols/myspace/user.c
ChangeLog:
applied changes from 88f296b3653b5a7578a7581c1582d37390c9d212
through 4bbc209c8076ef89135700af844ec6bb04602c0a
-------------- next part --------------
============================================================
--- finch/libgnt/gntbindable.h c7f0d7631b1812dbc272cd2f7889852d7cf1687e
+++ finch/libgnt/gntbindable.h 9e7af7ad9534107c652956dcfc02af39efb20f84
@@ -105,73 +105,75 @@ struct _GntBindableActionParam
/*GntBindableAction *gnt_bindable_action_parse(const char *name);*/
/**
- *
- * @param action
+ * Free a bindable action.
+ *
+ * @param action The bindable action.
*/
void gnt_bindable_action_free(GntBindableAction *action);
/**
- *
- * @param param
+ * Free a GntBindableActionParam.
+ *
+ * @param param The GntBindableActionParam to free.
*/
void gnt_bindable_action_param_free(GntBindableActionParam *param);
/**
- *
- * @param klass
- * @param name
- * @param callback
- * @param trigger
+ * Register a bindable action for a class.
+ *
+ * @param klass The class the binding is for.
+ * @param name The name of the binding.
+ * @param callback The callback for the binding.
+ * @param trigger The default trigger for the binding, or @c NULL, followed by a NULL-terminated
+ * list of default parameters.
*/
void gnt_bindable_class_register_action(GntBindableClass *klass, const char *name, GntBindableActionCallback callback, const char *trigger, ...);
/**
- *
- * @param klass
- * @param name
- * @param trigger
+ * Register a key-binding to an existing action.
+ *
+ * @param klass The class the binding is for.
+ * @param name The name of the binding.
+ * @param trigger A new trigger for the binding, followed by a @c NULL-terminated list of parameters for the callback.
*/
void gnt_bindable_register_binding(GntBindableClass *klass, const char *name, const char *trigger, ...);
/**
- *
- * @param bindable
- * @param keys
+ * Perform an action from a keybinding.
*
- * @return
+ * @param bindable The bindable object.
+ * @param keys The key to trigger the action.
+ *
+ * @return @c TRUE if the action was performed successfully, @c FALSE otherwise.
*/
gboolean gnt_bindable_perform_action_key(GntBindable *bindable, const char *keys);
/**
- *
- * @param bindable
- * @param name
+ * Perform an action on a bindable object.
*
- * @return
+ * @param bindable The bindable object.
+ * @param name The action to perform, followed by a @c NULL-terminated list of parameters.
+ *
+ * @return @c TRUE if the action was performed successfully, @c FALSE otherwise.
*/
gboolean gnt_bindable_perform_action_named(GntBindable *bindable, const char *name, ...);
/**
-* Returns a GntTree populated with "key" -> "binding" for the widget.
-*/
-/**
-*
-* @param widget
-*
-* @return
-*/
-GntBindable * gnt_bindable_bindings_view(GntBindable *bind);
-
-/**
+ * Returns a GntTree populated with "key" -> "binding" for the widget.
+ *
+ * @param widget The object to list the bindings for.
*
- * Builds a window that list the key bindings for a GntBindable object. From this window a user can select a listing to rebind a new key for the given action.
- *
+ * @return The GntTree.
*/
+GntBindable * gnt_bindable_bindings_view(GntBindable *bind);
+
/**
+ * Builds a window that list the key bindings for a GntBindable object.
+ * From this window a user can select a listing to rebind a new key for the given action.
*
- * @param bindable
+ * @param bindable The object to list the bindings for.
*
- * @return
+ * @return @c TRUE
*/
gboolean gnt_bindable_build_help_window(GntBindable *bindable);
============================================================
--- finch/libgnt/gntbutton.h 8d03f675f0d77ed44f37f4a648fdde6b5118658e
+++ finch/libgnt/gntbutton.h 8789e04c4d75a065a24ca72e720b31fd097dd585
@@ -73,17 +73,16 @@ G_BEGIN_DECLS
G_BEGIN_DECLS
/**
- *
- *
- * @return
+ * @return GType for Gntbutton
*/
GType gnt_button_get_gtype(void);
/**
- *
- * @param text
+ * Create a new button.
*
- * @return
+ * @param text The text for the button.
+ *
+ * @return The newly created button.
*/
GntWidget * gnt_button_new(const char *text);
============================================================
--- finch/libgnt/gntcheckbox.h d8e412ff6e8ada6ecaa9ce0f01109da81611980e
+++ finch/libgnt/gntcheckbox.h fff8464fe79209f1790f992800870550149bee56
@@ -68,32 +68,33 @@ G_BEGIN_DECLS
G_BEGIN_DECLS
/**
- *
- *
- * @return
+ * @return GType for GntCheckBox
*/
GType gnt_check_box_get_gtype(void);
/**
- *
- * @param text
+ * Create a new checkbox.
*
- * @return
+ * @param text The text for the checkbox.
+ *
+ * @return The newly created checkbox.
*/
GntWidget * gnt_check_box_new(const char *text);
/**
- *
- * @param box
- * @param set
+ * Set whether the checkbox should be checked or not.
+ *
+ * @param box The checkbox.
+ * @param set @c TRUE if the checkbox should be selected, @c FALSE otherwise.
*/
void gnt_check_box_set_checked(GntCheckBox *box, gboolean set);
/**
- *
- * @param box
+ * Return the checked state of the checkbox.
*
- * @return
+ * @param box The checkbox.
+ *
+ * @return @c TRUE if the checkbox is selected, @c FALSE otherwise.
*/
gboolean gnt_check_box_get_checked(GntCheckBox *box);
============================================================
--- finch/libgnt/gntclipboard.c c0aeee7c1c44622b6de257752bd5664230ef6091
+++ finch/libgnt/gntclipboard.c 169146375a165989f6508edaf72b7b2d7c658841
@@ -48,7 +48,7 @@ void
*****************************************************************************/
void
-gnt_clipboard_set_string(GntClipboard *clipboard, gchar *string)
+gnt_clipboard_set_string(GntClipboard *clipboard, const gchar *string)
{
g_free(clipboard->string);
clipboard->string = g_strdup(string);
============================================================
--- finch/libgnt/gntclipboard.h ff8c8e7fb0dde8d5ecc95952974335e77bcba480
+++ finch/libgnt/gntclipboard.h cbc2b477936324240e0839e9ac3a4a1337bccefe
@@ -60,26 +60,27 @@ G_BEGIN_DECLS
G_BEGIN_DECLS
/**
- *
- *
- * @return
+ * @return GType for GntClipboard.
*/
GType gnt_clipboard_get_gtype(void);
/**
- *
- * @param clip
+ * Get the current text from the clipboard.
*
- * @return
+ * @param clip The clipboard.
+ *
+ * @return A copy of the string in the clipboard. The caller should free the
+ * returned value.
*/
gchar * gnt_clipboard_get_string(GntClipboard *clip);
/**
- *
- * @param clip
- * @param string
+ * Set the text in the clipboard.
+ *
+ * @param clip The clipboard.
+ * @param string New string for the clipboard.
*/
-void gnt_clipboard_set_string(GntClipboard *clip, gchar *string);
+void gnt_clipboard_set_string(GntClipboard *clip, const gchar *string);
G_END_DECLS
============================================================
--- finch/libgnt/gntcolors.h 038facbccf708c3afeb120ddb17586e6fc6b4f9b
+++ finch/libgnt/gntcolors.h 04bc7db0d7de7d04ad866ce58e3dafdf87631b9c
@@ -29,6 +29,9 @@
#include <glib.h>
+/**
+ * Different classes of colors.
+ */
typedef enum
{
GNT_COLOR_NORMAL = 1,
@@ -58,27 +61,28 @@ enum
GNT_TOTAL_COLORS
};
-/* populate some default colors */
/**
- *
+ * Initialize the colors.
*/
void gnt_init_colors(void);
/**
- *
+ * Uninitialize the colors.
*/
void gnt_uninit_colors(void);
#if GLIB_CHECK_VERSION(2,6,0)
/**
- *
- * @param kfile
+ * Parse color information from a file.
+ *
+ * @param kfile The file containing color information.
*/
void gnt_colors_parse(GKeyFile *kfile);
/**
- *
- * @param kfile
+ * Parse color-pair information from a file.
+ *
+ * @param kfile The file containing the color-pair information.
*/
void gnt_color_pairs_parse(GKeyFile *kfile);
============================================================
--- finch/libgnt/gntcombobox.h 895096dc4eeb8ebd346941ebaac9396d61a4f7dd
+++ finch/libgnt/gntcombobox.h 27995b038d1188529b6fd288f83797b78242d115
@@ -69,15 +69,11 @@ G_BEGIN_DECLS
G_BEGIN_DECLS
/**
- *
- * Get the GType for GntComboBox
- *
- * @return
+ * @return Get the GType for GntComboBox
*/
GType gnt_combo_box_get_gtype(void);
/**
- *
* Create a new GntComboBox
*
* @return A new GntComboBox
@@ -85,7 +81,6 @@ GntWidget * gnt_combo_box_new(void);
GntWidget * gnt_combo_box_new(void);
/**
- *
* Add an entry
*
* @param box The GntComboBox
@@ -95,7 +90,6 @@ void gnt_combo_box_add_data(GntComboBox
void gnt_combo_box_add_data(GntComboBox *box, gpointer key, const char *text);
/**
- *
* Remove an entry
*
* @param box The GntComboBox
@@ -104,7 +98,6 @@ void gnt_combo_box_remove(GntComboBox *b
void gnt_combo_box_remove(GntComboBox *box, gpointer key);
/**
- *
* Remove all entries
*
* @param box The GntComboBox
@@ -112,7 +105,6 @@ void gnt_combo_box_remove_all(GntComboBo
void gnt_combo_box_remove_all(GntComboBox *box);
/**
- *
* Get the data that is currently selected
*
* @param box The GntComboBox
@@ -122,7 +114,6 @@ gpointer gnt_combo_box_get_selected_data
gpointer gnt_combo_box_get_selected_data(GntComboBox *box);
/**
- *
* Set the current selection to a specific entry
*
* @param box The GntComboBox
============================================================
--- finch/libgnt/gntentry.h f4c7cfef2c64b878104956a8a4e48d7b887fbb53
+++ finch/libgnt/gntentry.h 15a838de46a2fe83c482899079bbbad5cf86e956
@@ -100,95 +100,115 @@ G_BEGIN_DECLS
G_BEGIN_DECLS
/**
- *
- *
- * @return
+ * @return GType for GntEntry.
*/
GType gnt_entry_get_gtype(void);
/**
- *
- * @param text
+ * Create a new GntEntry.
*
- * @return
+ * @param text The text in the new entry box.
+ *
+ * @return The newly created entry box.
*/
GntWidget * gnt_entry_new(const char *text);
/**
- *
- * @param entry
- * @param max
+ * Set the maximum length of the text in the entry box.
+ *
+ * @param entry The entry box.
+ * @param max The maximum length for text. A value of 0 means infinite length.
*/
void gnt_entry_set_max(GntEntry *entry, int max);
/**
- *
- * @param entry
- * @param text
+ * Set the text in an entry box.
+ *
+ * @param entry The entry box.
+ * @param text The text to set in the box.
*/
void gnt_entry_set_text(GntEntry *entry, const char *text);
/**
- *
- * @param entry
- * @param flag
+ * Set flags an entry box.
+ *
+ * @param entry The entry box.
+ * @param flag The flags to set for the entry box.
*/
void gnt_entry_set_flag(GntEntry *entry, GntEntryFlag flag);
+/**
+ * Get the text in an entry box.
+ *
+ * @param entry The entry box.
+ *
+ * @return The current text in the entry box.
+ */
const char *gnt_entry_get_text(GntEntry *entry);
/**
- *
- * @param entry
+ * Clear the text in the entry box.
+ *
+ * @param entry The entry box.
*/
void gnt_entry_clear(GntEntry *entry);
/**
- *
- * @param entry
- * @param set
+ * Set whether the text in the entry box should be masked for display.
+ *
+ * @param entry The entry box.
+ * @param set @c TRUE if the text should be masked, @c FALSE otherwise.
*/
void gnt_entry_set_masked(GntEntry *entry, gboolean set);
/**
- *
- * @param entry
- * @param text
+ * Add a text to the history list for the text. The history length for the
+ * entry box needs to be set first by gnt_entry_set_history_length.
+ *
+ * @param entry The entry box.
+ * @param text A new entry for the history list.
*/
void gnt_entry_add_to_history(GntEntry *entry, const char *text);
/**
- *
- * @param entry
- * @param num
+ * Set the length of history for the entry box.
+ *
+ * @param entry The entry box.
+ * @param num The maximum length of the history.
*/
void gnt_entry_set_history_length(GntEntry *entry, int num);
/**
- *
- * @param entry
- * @param word
+ * Set whether the suggestions are for the entire entry box, or for each
+ * individual word in the entry box.
+ *
+ * @param entry The entry box.
+ * @param word @c TRUE if the suggestions are for individual words, @c FALSE otherwise.
*/
void gnt_entry_set_word_suggest(GntEntry *entry, gboolean word);
/**
- *
- * @param entry
- * @param always
+ * Set whether to always display the suggestions list, or only when the
+ * tab-completion key is pressed (the TAB key, by default).
+ *
+ * @param entry The entry box.
+ * @param always @c TRUE if the suggestion list should always be displayed.
*/
void gnt_entry_set_always_suggest(GntEntry *entry, gboolean always);
/**
- *
- * @param entry
- * @param text
+ * Add an item to the suggestion list.
+ *
+ * @param entry The entry box.
+ * @param text An item to add to the suggestion list.
*/
void gnt_entry_add_suggest(GntEntry *entry, const char *text);
/**
- *
- * @param entry
- * @param text
+ * Remove an entry from the suggestion list.
+ *
+ * @param entry The entry box.
+ * @param text The item to remove from the suggestion list.
*/
void gnt_entry_remove_suggest(GntEntry *entry, const char *text);
============================================================
--- finch/libgnt/gnttree.c b6c0451cf023872b06f6a3317ff057dfaa88942f
+++ finch/libgnt/gnttree.c be8a77ee722c4615fac5656740ba2a20ecf8d3cf
@@ -1265,8 +1265,10 @@ GntTreeRow *gnt_tree_add_row_after(GntTr
{
GntTreeRow *pr = NULL;
+ row->tree = tree;
+ row->key = key;
+ row->data = NULL;
g_hash_table_replace(tree->hash, key, row);
- row->tree = tree;
if (bigbro == NULL && tree->priv->compare)
{
@@ -1327,9 +1329,6 @@ GntTreeRow *gnt_tree_add_row_after(GntTr
}
}
- row->key = key;
- row->data = NULL;
-
redraw_tree(tree);
return row;
============================================================
--- libpurple/protocols/myspace/markup.c 721b8f00c6e73e17fa2d6efac29713de7c32931a
+++ libpurple/protocols/myspace/markup.c 601eba537d9430d1b73ac8effa465391d866f2b3
@@ -444,7 +444,8 @@ html_tag_to_msim_markup(MsimSession *ses
*begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_UNDERLINE);
*end = g_strdup("</f>");
} else if (!purple_utf8_strcasecmp(root->name, "a")) {
- const gchar *href, *link_text;
+ const gchar *href;
+ gchar *link_text;
href = xmlnode_get_attrib(root, "href");
@@ -476,6 +477,7 @@ html_tag_to_msim_markup(MsimSession *ses
/* Sorry, kid. MySpace doesn't support you within <a> tags. */
xmlnode_free(root->child);
+ g_free(link_text);
root->child = NULL;
*end = g_strdup("");
@@ -567,10 +569,7 @@ msim_convert_xmlnode(MsimSession *sessio
case XMLNODE_TYPE_DATA:
/* Literal text. */
- inner = g_new0(char, node->data_sz + 1);
- strncpy(inner, node->data, node->data_sz);
- inner[node->data_sz] = 0;
-
+ inner = g_strndup(node->data, node->data_sz);
purple_debug_info("msim", " ** node data=%s\n",
inner ? inner : "(NULL)");
break;
@@ -583,6 +582,8 @@ msim_convert_xmlnode(MsimSession *sessio
if (inner) {
g_string_append(final, inner);
+ g_free(inner);
+ inner = NULL;
}
}
@@ -592,6 +593,9 @@ msim_convert_xmlnode(MsimSession *sessio
* Comment out this line below to see. */
g_string_append(final, end);
+ g_free(begin);
+ g_free(end);
+
purple_debug_info("msim", "msim_markup_xmlnode_to_gtkhtml: RETURNING %s\n",
(final && final->str) ? final->str : "(NULL)");
============================================================
--- libpurple/protocols/myspace/myspace.c 0088e5f5c84d8324efb29815a06d2c9b405fddea
+++ libpurple/protocols/myspace/myspace.c e02fdcb67b22a8e7a9b07852c54a3e1125b565fb
@@ -289,7 +289,7 @@ msim_login(PurpleAccount *acct)
(int)strlen(acct->password));
/* Notify an error message also, because this is important! */
- purple_notify_error(acct, g_strdup(_("MySpaceIM Error")), str, NULL);
+ purple_notify_error(acct, _("MySpaceIM Error"), str, NULL);
purple_connection_error(gc, str);
@@ -634,6 +634,7 @@ msim_incoming_bm_record_cv(MsimSession *
g_return_val_if_fail(username != NULL, FALSE);
if (!cv) {
/* No client version to record, don't worry about it. */
+ g_free(username);
return FALSE;
}
@@ -823,6 +824,7 @@ msim_incoming_media(MsimSession *session
serv_got_typing_stopped(session->gc, username);
g_free(username);
+ g_free(text);
return TRUE;
}
@@ -971,7 +973,6 @@ msim_get_info_cb(MsimSession *session, M
purple_debug_info("msim", "msim_get_info_cb: username=%s\n", username);
purple_notify_user_info_destroy(user_info);
- /* TODO: do not free username, since it will be used by user_info? */
if (temporary_user) {
g_free(user->client_info);
@@ -985,7 +986,7 @@ msim_get_info_cb(MsimSession *session, M
g_free(user->image_url);
g_free(user);
}
-
+ g_free(username);
}
/** Retrieve a user's profile.
@@ -1164,7 +1165,7 @@ msim_incoming_resolved(MsimSession *sess
/* TODO: more elegant solution than below. attach whole message? */
/* Special elements name beginning with '_', we'll use internally within the
* program (did not come directly from the wire). */
- msg = msim_msg_append(msg, "_username", MSIM_TYPE_STRING, username);
+ msg = msim_msg_append(msg, "_username", MSIM_TYPE_STRING, username); /* This makes 'msg' the owner of 'username' */
/* TODO: attach more useful information, like ImageURL */
@@ -1798,8 +1799,7 @@ msim_error(MsimSession *session, MsimMes
}
purple_connection_error(session->gc, full_errmsg);
} else {
- purple_notify_error(session->account, g_strdup(_("MySpaceIM Error")),
- full_errmsg, NULL);
+ purple_notify_error(session->account, _("MySpaceIM Error"), full_errmsg, NULL);
}
g_free(full_errmsg);
@@ -2669,6 +2669,7 @@ msim_add_contact_from_server_cb(MsimSess
/* TODO: other fields, store in 'user' */
msim_msg_free(contact_info);
+ g_free(username);
}
/** Add first ContactID in contact_info to buddy's list. Used to add
============================================================
--- libpurple/protocols/myspace/user.c 99fea72d02ba979ff58a3f30142d3424917df2e4
+++ libpurple/protocols/myspace/user.c ce78a8f5623f636f246097434107b8e039a58f39
@@ -30,10 +30,10 @@ msim_format_now_playing(gchar *band, gch
static gchar *
msim_format_now_playing(gchar *band, gchar *song)
{
- if ((band && strlen(band)) || (song && strlen(song))) {
+ if ((band && *band) || (song && *song)) {
return g_strdup_printf("%s - %s",
- (band && strlen(band)) ? band : "Unknown Artist",
- (song && strlen(song)) ? song : "Unknown Song");
+ (band && *band) ? band : "Unknown Artist",
+ (song && *song) ? song : "Unknown Song");
} else {
return NULL;
}
@@ -99,58 +99,63 @@ msim_append_user_info(MsimSession *sessi
if (full) {
/* TODO: link to username, if available */
- purple_notify_user_info_add_pair(user_info, _("Profile"),
- g_strdup_printf("<a href=\"http://myspace.com/%d\">http://myspace.com/%d</a>",
- uid, uid));
+ char *profile = g_strdup_printf("<a href=\"http://myspace.com/%d\">http://myspace.com/%d</a>",
+ uid, uid);
+ purple_notify_user_info_add_pair(user_info, _("Profile"), profile);
+ g_free(profile);
}
/* a/s/l...the vitals */
if (user->age) {
- purple_notify_user_info_add_pair(user_info, _("Age"),
- g_strdup_printf("%d", user->age));
+ char age[16];
+ g_snprintf(age, sizeof(age), "%d", user->age);
+ purple_notify_user_info_add_pair(user_info, _("Age"), age);
}
- if (user->gender && strlen(user->gender)) {
+ if (user->gender && *user->gender) {
purple_notify_user_info_add_pair(user_info, _("Gender"), user->gender);
}
- if (user->location && strlen(user->location)) {
+ if (user->location && *user->location) {
purple_notify_user_info_add_pair(user_info, _("Location"), user->location);
}
/* Other information */
- if (user->headline && strlen(user->headline)) {
+ if (user->headline && *user->headline) {
purple_notify_user_info_add_pair(user_info, _("Headline"), user->headline);
}
str = msim_format_now_playing(user->band_name, user->song_name);
- if (str && strlen(str)) {
+ if (str && *str) {
purple_notify_user_info_add_pair(user_info, _("Song"), str);
}
+ g_free(str);
/* Note: total friends only available if looked up by uid, not username. */
if (user->total_friends) {
- purple_notify_user_info_add_pair(user_info, _("Total Friends"),
- g_strdup_printf("%d", user->total_friends));
+ char friends[16];
+ g_snprintf(friends, sizeof(friends), "%d", user->total_friends);
+ purple_notify_user_info_add_pair(user_info, _("Total Friends"), friends);
}
if (full) {
/* Client information */
+ char *client = NULL;
str = user->client_info;
cv = user->client_cv;
if (str && cv != 0) {
- purple_notify_user_info_add_pair(user_info, _("Client Version"),
- g_strdup_printf("%s (build %d)", str, cv));
+ client = g_strdup_printf("%s (build %d)", str, cv);
} else if (str) {
- purple_notify_user_info_add_pair(user_info, _("Client Version"),
- g_strdup(str));
+ client = g_strdup(str);
} else if (cv) {
- purple_notify_user_info_add_pair(user_info, _("Client Version"),
- g_strdup_printf("Build %d", cv));
+ client = g_strdup_printf("Build %d", cv);
}
+ if (client && *client)
+ purple_notify_user_info_add_pair(user_info, _("Client Version"), client);
+ g_free(client);
}
}
More information about the Commits
mailing list