changeset 21779:7697b246fbcc

merge of '024dfe71422830dbaef95d94fd32517d86c82eb3' and '53558acaab3e3ec1ac0d96de3aca88b017340724'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 05 Dec 2007 00:16:40 +0000
parents e8e9a53b7694 (diff) 21371ea85970 (current diff)
children 350c93aa44d3
files
diffstat 16 files changed, 123 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/doc/account-signals.dox	Wed Dec 05 00:14:13 2007 +0000
+++ b/doc/account-signals.dox	Wed Dec 05 00:16:40 2007 +0000
@@ -9,6 +9,7 @@
   @signal account-setting-info
   @signal account-set-info
   @signal account-status-changed
+  @signal account-alias-changed
   @signal account-authorization-requested
   @signal account-authorization-denied
   @signal account-authorization-granted
--- a/doc/blist-signals.dox	Wed Dec 05 00:14:13 2007 +0000
+++ b/doc/blist-signals.dox	Wed Dec 05 00:16:40 2007 +0000
@@ -82,6 +82,14 @@
    Emitted when a new buddy is added to the buddy list.
   @endsignaldef
 
+ @signaldef buddy-removed
+  @signalproto
+void (*buddy_removed)(PurpleBuddy *buddy)
+  @endsignalproto
+  @signaldesc
+   Emitted when a buddy is removed from the buddy list.
+  @endsignaldef
+
  @signaldef buddy-icon-changed
   @signalproto
 void (*buddy_icon_changed)(PurpleBuddy *buddy)
@@ -90,14 +98,6 @@
    Emitted when a buddy's icon is set.
   @endsignaldef
 
- @signaldef buddy-removed
-  @signalproto
-void (*buddy_removed)(PurpleBuddy *buddy)
-  @endsignalproto
-  @signaldesc
-   Emitted when a buddy is removed from the buddy list.
-  @endsignaldef
-
  @signaldef blist-node-aliased
   @signalproto
 void (*blist_node_aliased)(PurpleBlistNode *node, const char *old_alias)
--- a/doc/gtkconv-signals.dox	Wed Dec 05 00:14:13 2007 +0000
+++ b/doc/gtkconv-signals.dox	Wed Dec 05 00:16:40 2007 +0000
@@ -28,12 +28,14 @@
 
  @signaldef conversation-timestamp
   @signalproto
-char *(*conversation_timestamp)(PurpleConversation *conv, time_t when);
+char *(*conversation_timestamp)(PurpleConversation *conv, time_t when,
+                                gboolean show_date);
   @endsignalproto
   @signaldesc
    Emitted to allow plugins to customize the timestamp on a message.
-  @param conv The conversation the message belongs to.
-  @param when The time to be converted to a string.
+  @param conv      The conversation the message belongs to.
+  @param when      The time to be converted to a string.
+  @param show_date Whether the date should be displayed.
   @return A textual representation of the time, or @c NULL to use a
           default format.
  @endsignaldef
--- a/doc/log-signals.dox	Wed Dec 05 00:14:13 2007 +0000
+++ b/doc/log-signals.dox	Wed Dec 05 00:16:40 2007 +0000
@@ -10,13 +10,14 @@
 
  @signaldef log-timestamp
   @signalproto
-char *(*log_timestamp)(PurpleLog *log, time_t when);
+char *(*log_timestamp)(PurpleLog *log, time_t when, gboolean show_date);
   @endsignalproto
   @signaldesc
    Emitted to allow plugins to customize the timestamp on a message
    being logged.
-  @param log The log the message belongs to.
-  @param when The time to be converted to a string.
+  @param log       The log the message belongs to.
+  @param when      The time to be converted to a string.
+  @param show_date Whether the date should be displayed.
   @return A textual representation of the time, or @c NULL to use a
           default format.
   @note Plugins must be careful of logs with a type of PURPLE_LOG_SYSTEM.
--- a/libpurple/ft.c	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/ft.c	Wed Dec 05 00:16:40 2007 +0000
@@ -1306,8 +1306,12 @@
 }
 
 void
-purple_xfers_uninit(void) {
-	purple_signals_disconnect_by_handle(purple_xfers_get_handle());
+purple_xfers_uninit(void)
+{
+	void *handle = purple_xfers_get_handle();
+
+	purple_signals_disconnect_by_handle(handle);
+	purple_signals_unregister_by_instance(handle);
 }
 
 void
--- a/libpurple/network.c	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/network.c	Wed Dec 05 00:16:40 2007 +0000
@@ -710,4 +710,7 @@
 	if(nm_context)
 		libnm_glib_shutdown(nm_context);
 #endif
+
+	purple_signal_unregister(purple_network_get_handle(),
+	                         "network-configuration-changed");
 }
--- a/libpurple/plugin.c	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/plugin.c	Wed Dec 05 00:16:40 2007 +0000
@@ -1175,7 +1175,7 @@
 purple_plugins_init(void) {
 	void *handle = purple_plugins_get_handle();
 
-        purple_plugins_add_search_path(LIBDIR);
+	purple_plugins_add_search_path(LIBDIR);
 
 	purple_signal_register(handle, "plugin-load",
 						 purple_marshal_VOID__POINTER,
@@ -1190,8 +1190,12 @@
 }
 
 void
-purple_plugins_uninit(void) {
-	purple_signals_disconnect_by_handle(purple_plugins_get_handle());
+purple_plugins_uninit(void)
+{
+	void *handle = purple_plugins_get_handle();
+
+	purple_signals_disconnect_by_handle(handle);
+	purple_signals_unregister_by_instance(handle);
 }
 
 /**************************************************************************
--- a/libpurple/plugins/perl/common/BuddyList.xs	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/plugins/perl/common/BuddyList.xs	Wed Dec 05 00:16:40 2007 +0000
@@ -44,11 +44,13 @@
 	Purple::Account account
 	const char * name
 PREINIT:
-	GSList *l;
+	GSList *l, *ll;
 PPCODE:
-	for (l = purple_find_buddies(account, name); l != NULL; l = l->next) {
+	ll = purple_find_buddies(account, name);
+	for (l = ll; l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::BuddyList::Buddy")));
 	}
+	g_slist_free(ll);
 
 Purple::BuddyList::Group
 purple_find_group(name)
@@ -101,11 +103,13 @@
 purple_group_get_accounts(group)
 	Purple::BuddyList::Group  group
 PREINIT:
-	GSList *l;
+	GSList *l, *ll;
 PPCODE:
-	for (l = purple_group_get_accounts(group); l != NULL; l = l->next) {
+	ll = purple_group_get_accounts(group);
+	for (l = ll; l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Account")));
 	}
+	g_slist_free(ll);
 
 gboolean
 purple_group_on_account(group, account)
@@ -268,11 +272,15 @@
 purple_blist_node_get_extended_menu(node)
 	Purple::BuddyList::Node node
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_blist_node_get_extended_menu(node); l != NULL; l = g_list_delete_link(l, l)) {
+	ll = purple_blist_node_get_extended_menu(node);
+	for (l = ll; l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Menu::Action")));
 	}
+	/* We can free the list here but the script needs to free the
+	 * Purple::Menu::Action 'objects' itself. */
+	g_list_free(ll);
 
 void
 purple_blist_node_set_bool(node, key, value)
--- a/libpurple/plugins/perl/common/Cmds.xs	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/plugins/perl/common/Cmds.xs	Wed Dec 05 00:16:40 2007 +0000
@@ -66,21 +66,23 @@
 	Purple::Conversation conv
 	const gchar *command
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_cmd_help(conv, command); l != NULL; l = l->next) {
+	for (l = ll = purple_cmd_help(conv, command); l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
 	}
+	g_list_free(ll);
 
 void
 purple_cmd_list(conv)
 	Purple::Conversation conv
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_cmd_list(conv); l != NULL; l = l->next) {
+	for (l = ll = purple_cmd_list(conv); l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
 	}
+	g_list_free(ll);
 
 Purple::Cmd::Id
 purple_cmd_register(plugin, command, args, priority, flag, prpl_id, func, helpstr, data = 0)
--- a/libpurple/plugins/perl/common/Conversation.xs	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/plugins/perl/common/Conversation.xs	Wed Dec 05 00:16:40 2007 +0000
@@ -464,6 +464,10 @@
 
 	purple_conv_chat_add_users(chat, t_GL_users, t_GL_extra_msgs, t_GL_flags, new_arrivals);
 
+	g_list_free(t_GL_users);
+	g_list_free(t_GL_extra_msgs);
+	g_list_free(t_GL_flags);
+
 gboolean
 purple_conv_chat_find_user(chat, user)
 	Purple::Conversation::Chat chat
--- a/libpurple/plugins/perl/common/Log.xs	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/plugins/perl/common/Log.xs	Wed Dec 05 00:16:40 2007 +0000
@@ -65,11 +65,15 @@
 	const char *name
 	Purple::Account account
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_log_get_logs(type, name, account); l != NULL; l = l->next) {
-		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
+	ll = purple_log_get_logs(type, name, account);
+	for (l = ll; l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log")));
 	}
+	/* We can free the list here but the script needs to free the
+	 * Purple::Log 'objects' itself. */
+	g_list_free(ll);
 
 int
 purple_log_get_size(log)
@@ -79,11 +83,15 @@
 purple_log_get_system_logs(account)
 	Purple::Account account
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_log_get_system_logs(account); l != NULL; l = l->next) {
-		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
+	ll = purple_log_get_system_logs(account);
+	for (l = ll; l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log")));
 	}
+	/* We can free the list here but the script needs to free the
+	 * Purple::Log 'objects' itself. */
+	g_list_free(ll);
 
 int
 purple_log_get_total_size(type, name, account)
@@ -101,11 +109,14 @@
 void
 purple_log_logger_get_options()
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_log_logger_get_options(); l != NULL; l = l->next) {
-		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
+	/* This might want to be massaged to a hash, since that's essentially
+	 * what the key/value list is emulating. */
+	for (l = ll = purple_log_logger_get_options(); l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
 	}
+	g_list_free(ll);
 
 gchar_own *
 purple_log_read(log, flags)
--- a/libpurple/plugins/perl/common/Pounce.xs	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/plugins/perl/common/Pounce.xs	Wed Dec 05 00:16:40 2007 +0000
@@ -106,6 +106,18 @@
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Pounce")));
 	}
 
+void
+purple_pounces_get_all_for_ui(ui)
+	const char *ui
+PREINIT:
+	GList *l, *ll;
+PPCODE:
+	ll = purple_pounces_get_all_for_ui(ui);
+	for (l = ll; l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Pounce")));
+	}
+	g_list_free(ll);
+
 Purple::Handle
 purple_pounces_get_handle()
 
--- a/libpurple/plugins/perl/common/Prefs.xs	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/plugins/perl/common/Prefs.xs	Wed Dec 05 00:16:40 2007 +0000
@@ -57,6 +57,7 @@
 		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl));
 	}
 	purple_prefs_add_string_list(name, t_GL);
+	g_list_free(t_GL);
 
 void
 purple_prefs_destroy()
@@ -159,6 +160,7 @@
 		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl));
 	}
 	purple_prefs_set_string_list(name, t_GL);
+	g_list_free(t_GL);
 
 void
 purple_prefs_trigger_callback(name)
--- a/libpurple/plugins/perl/common/Prpl.xs	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/plugins/perl/common/Prpl.xs	Wed Dec 05 00:16:40 2007 +0000
@@ -21,13 +21,15 @@
 	Purple::Account account
 	Purple::Presence presence
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_prpl_get_statuses(account,presence); l != NULL; l = l->next) {
-		/* XXX Someone please test and make sure this is the right
-		 * type for these things. */
+	ll = purple_prpl_get_statuses(account,presence);
+	for (l = ll; l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Status")));
 	}
+	/* We can free the list here but the script needs to free the
+	 * Purple::Status 'objects' itself. */
+	g_list_free(ll);
 
 void
 purple_prpl_got_account_idle(account, idle, idle_time)
--- a/libpurple/plugins/perl/common/SavedStatuses.xs	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/plugins/perl/common/SavedStatuses.xs	Wed Dec 05 00:16:40 2007 +0000
@@ -140,11 +140,13 @@
 purple_savedstatuses_get_popular(how_many)
 	unsigned int how_many
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_savedstatuses_get_popular(how_many); l != NULL; l = l->next) {
+	ll = purple_savedstatuses_get_popular(how_many);
+	for (l = ll; l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::SavedStatus")));
 	}
+	g_list_free(ll);
 
 Purple::Handle
 purple_savedstatuses_get_handle()
--- a/libpurple/plugins/perl/common/Status.xs	Wed Dec 05 00:14:13 2007 +0000
+++ b/libpurple/plugins/perl/common/Status.xs	Wed Dec 05 00:16:40 2007 +0000
@@ -90,6 +90,7 @@
 		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(source_list), i, 0), t_sl));
 	}
 	purple_presence_add_list(presence, t_GL);
+	g_list_free(t_GL);
 
 void
 purple_presence_add_status(presence, status)
@@ -361,28 +362,6 @@
 purple_status_type_destroy(status_type)
 	Purple::StatusType status_type
 
-Purple::StatusType
-purple_status_type_find_with_id(status_types, id)
-	SV *status_types
-	const char *id
-PREINIT:
-/* XXX Check that this function actually works, I think it might need a */
-/* status_type as it's first argument to work as $status_type->find_with_id */
-/* properly. */
-	GList *t_GL;
-	int i, t_len;
-CODE:
-	t_GL = NULL;
-	t_len = av_len((AV *)SvRV(status_types));
-
-	for (i = 0; i < t_len; i++) {
-		STRLEN t_sl;
-		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(status_types), i, 0), t_sl));
-	}
-	RETVAL = (PurpleStatusType *)purple_status_type_find_with_id(t_GL, id);
-OUTPUT:
-	RETVAL
-
 Purple::StatusAttr
 purple_status_type_get_attr(status_type, id)
 	Purple::StatusType status_type
@@ -398,6 +377,26 @@
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::StatusAttr")));
 	}
 
+Purple::StatusType
+purple_status_type_find_with_id(status_types, id)
+	SV *status_types
+	const char *id
+PREINIT:
+	GList *t_GL;
+	int i, t_len;
+CODE:
+	t_GL = NULL;
+	t_len = av_len((AV *)SvRV(status_types));
+
+	for (i = 0; i < t_len; i++) {
+		STRLEN t_sl;
+		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(status_types), i, 0), t_sl));
+	}
+	RETVAL = (PurpleStatusType *)purple_status_type_find_with_id(t_GL, id);
+	g_list_free(t_GL);
+OUTPUT:
+	RETVAL
+
 const char *
 purple_status_type_get_id(status_type)
 	Purple::StatusType status_type