diff plugins/tcl/tcl.c @ 13810:a84523152a24

[gaim-migrate @ 16240] This is not a completed update, but it has useful bits and bug fixes and the completed update will take some more time. This adds support for some of the status API to Tcl, as well as improving the handling of several of the pointer types (by introducing a gaim reference object type and appropriate string roundtrip functions) and introducing some "type safety". committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Sat, 10 Jun 2006 18:01:11 +0000
parents 70197e8ac15c
children 724e4c08391a
line wrap: on
line diff
--- a/plugins/tcl/tcl.c	Sat Jun 10 17:39:15 2006 +0000
+++ b/plugins/tcl/tcl.c	Sat Jun 10 18:01:11 2006 +0000
@@ -50,6 +50,12 @@
 	Tcl_Interp *interp;
 };
 
+GaimStringref *GaimTclRefAccount;
+GaimStringref *GaimTclRefConversation;
+GaimStringref *GaimTclRefStatus;
+GaimStringref *GaimTclRefStatusAttr;
+GaimStringref *GaimTclRefStatusType;
+
 static GHashTable *tcl_plugins = NULL;
 
 GaimPlugin *_tcl_plugin;
@@ -125,6 +131,9 @@
 	Tcl_CreateObjCommand(interp, "::gaim::prefs", tcl_cmd_prefs, (ClientData)NULL, NULL);
 	Tcl_CreateObjCommand(interp, "::gaim::send_im", tcl_cmd_send_im, (ClientData)NULL, NULL);
 	Tcl_CreateObjCommand(interp, "::gaim::signal", tcl_cmd_signal, (ClientData)NULL, NULL);
+	Tcl_CreateObjCommand(interp, "::gaim::status", tcl_cmd_status_type, (ClientData)NULL, NULL);
+	Tcl_CreateObjCommand(interp, "::gaim::status_attr", tcl_cmd_status_type, (ClientData)NULL, NULL);
+	Tcl_CreateObjCommand(interp, "::gaim::status_type", tcl_cmd_status_type, (ClientData)NULL, NULL);
 	Tcl_CreateObjCommand(interp, "::gaim::unload", tcl_cmd_unload, (ClientData)NULL, NULL);
 
 	return 0;
@@ -329,6 +338,14 @@
 		return FALSE;
 	tcl_glib_init();
 	tcl_signal_init();
+	gaim_tcl_ref_init();
+
+	GaimTclRefAccount = gaim_stringref_new("Account");
+	GaimTclRefConversation = gaim_stringref_new("Conversation");
+	GaimTclRefStatus = gaim_stringref_new("Status");
+	GaimTclRefStatusAttr = gaim_stringref_new("StatusAttr");
+	GaimTclRefStatusType = gaim_stringref_new("StatusType");
+
 	tcl_plugins = g_hash_table_new(g_direct_hash, g_direct_equal);
 
 #ifdef HAVE_TK
@@ -343,6 +360,12 @@
 	g_hash_table_destroy(tcl_plugins);
 	tcl_plugins = NULL;
 
+	gaim_stringref_unref(GaimTclRefAccount);
+	gaim_stringref_unref(GaimTclRefConversation);
+	gaim_stringref_unref(GaimTclRefStatus);
+	gaim_stringref_unref(GaimTclRefStatusAttr);
+	gaim_stringref_unref(GaimTclRefStatusType);
+
 	return TRUE;
 }