diff src/cmds.c @ 9597:d6f398e80b32

[gaim-migrate @ 10440] denyri added a void *data argument to most of the command related functions. This makes it easier for language binding and such. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Mon, 26 Jul 2004 03:27:03 +0000
parents 796f510a6e19
children 1a97d5e88d12
line wrap: on
line diff
--- a/src/cmds.c	Sun Jul 25 22:47:11 2004 +0000
+++ b/src/cmds.c	Mon Jul 26 03:27:03 2004 +0000
@@ -38,6 +38,7 @@
 	gchar *prpl_id;
 	GaimCmdFunc func;
 	gchar *help;
+	void *data;
 } GaimCmd;
 
 
@@ -50,8 +51,10 @@
 	else return 0;
 }
 
-GaimCmdId gaim_cmd_register(const gchar *cmd, const gchar *args, GaimCmdPriority p, GaimCmdFlag f,
-                             const gchar *prpl_id, GaimCmdFunc func, const gchar *helpstr)
+GaimCmdId gaim_cmd_register(const gchar *cmd, const gchar *args,
+                            GaimCmdPriority p, GaimCmdFlag f,
+                            const gchar *prpl_id, GaimCmdFunc func,
+                            const gchar *helpstr, void *data)
 {
 	GaimCmdId id;
 	GaimCmd *c;
@@ -71,6 +74,7 @@
 	c->prpl_id = prpl_id ? g_strdup(prpl_id) : NULL;
 	c->func = func;
 	c->help = helpstr ? g_strdup(helpstr) : NULL;
+	c->data = data;
 
 	cmds = g_list_insert_sorted(cmds, c, (GCompareFunc)cmds_compare_func);
 
@@ -195,6 +199,7 @@
 		s = g_utf8_next_char(s);
 	}
 }
+
 GaimCmdStatus gaim_cmd_do_command(GaimConversation *conv, const gchar *cmdline,
                                   const gchar *markup, gchar **error)
 {
@@ -261,7 +266,7 @@
 		}
 
 		tried_cmd = TRUE;
-		ret = c->func(conv, cmd, args, &err);
+		ret = c->func(conv, cmd, args, &err, c->data);
 		if (ret == GAIM_CMD_RET_CONTINUE) {
 			if (err)
 				g_free(err);