Mercurial > pidgin
comparison 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 |
comparison
equal
deleted
inserted
replaced
13809:cd93e6e90044 | 13810:a84523152a24 |
---|---|
47 | 47 |
48 struct tcl_plugin_data { | 48 struct tcl_plugin_data { |
49 GaimPlugin *plugin; | 49 GaimPlugin *plugin; |
50 Tcl_Interp *interp; | 50 Tcl_Interp *interp; |
51 }; | 51 }; |
52 | |
53 GaimStringref *GaimTclRefAccount; | |
54 GaimStringref *GaimTclRefConversation; | |
55 GaimStringref *GaimTclRefStatus; | |
56 GaimStringref *GaimTclRefStatusAttr; | |
57 GaimStringref *GaimTclRefStatusType; | |
52 | 58 |
53 static GHashTable *tcl_plugins = NULL; | 59 static GHashTable *tcl_plugins = NULL; |
54 | 60 |
55 GaimPlugin *_tcl_plugin; | 61 GaimPlugin *_tcl_plugin; |
56 | 62 |
123 Tcl_CreateObjCommand(interp, "::gaim::debug", tcl_cmd_debug, (ClientData)NULL, NULL); | 129 Tcl_CreateObjCommand(interp, "::gaim::debug", tcl_cmd_debug, (ClientData)NULL, NULL); |
124 Tcl_CreateObjCommand(interp, "::gaim::notify", tcl_cmd_notify, (ClientData)NULL, NULL); | 130 Tcl_CreateObjCommand(interp, "::gaim::notify", tcl_cmd_notify, (ClientData)NULL, NULL); |
125 Tcl_CreateObjCommand(interp, "::gaim::prefs", tcl_cmd_prefs, (ClientData)NULL, NULL); | 131 Tcl_CreateObjCommand(interp, "::gaim::prefs", tcl_cmd_prefs, (ClientData)NULL, NULL); |
126 Tcl_CreateObjCommand(interp, "::gaim::send_im", tcl_cmd_send_im, (ClientData)NULL, NULL); | 132 Tcl_CreateObjCommand(interp, "::gaim::send_im", tcl_cmd_send_im, (ClientData)NULL, NULL); |
127 Tcl_CreateObjCommand(interp, "::gaim::signal", tcl_cmd_signal, (ClientData)NULL, NULL); | 133 Tcl_CreateObjCommand(interp, "::gaim::signal", tcl_cmd_signal, (ClientData)NULL, NULL); |
134 Tcl_CreateObjCommand(interp, "::gaim::status", tcl_cmd_status_type, (ClientData)NULL, NULL); | |
135 Tcl_CreateObjCommand(interp, "::gaim::status_attr", tcl_cmd_status_type, (ClientData)NULL, NULL); | |
136 Tcl_CreateObjCommand(interp, "::gaim::status_type", tcl_cmd_status_type, (ClientData)NULL, NULL); | |
128 Tcl_CreateObjCommand(interp, "::gaim::unload", tcl_cmd_unload, (ClientData)NULL, NULL); | 137 Tcl_CreateObjCommand(interp, "::gaim::unload", tcl_cmd_unload, (ClientData)NULL, NULL); |
129 | 138 |
130 return 0; | 139 return 0; |
131 } | 140 } |
132 | 141 |
327 { | 336 { |
328 if(!tcl_loaded) | 337 if(!tcl_loaded) |
329 return FALSE; | 338 return FALSE; |
330 tcl_glib_init(); | 339 tcl_glib_init(); |
331 tcl_signal_init(); | 340 tcl_signal_init(); |
341 gaim_tcl_ref_init(); | |
342 | |
343 GaimTclRefAccount = gaim_stringref_new("Account"); | |
344 GaimTclRefConversation = gaim_stringref_new("Conversation"); | |
345 GaimTclRefStatus = gaim_stringref_new("Status"); | |
346 GaimTclRefStatusAttr = gaim_stringref_new("StatusAttr"); | |
347 GaimTclRefStatusType = gaim_stringref_new("StatusType"); | |
348 | |
332 tcl_plugins = g_hash_table_new(g_direct_hash, g_direct_equal); | 349 tcl_plugins = g_hash_table_new(g_direct_hash, g_direct_equal); |
333 | 350 |
334 #ifdef HAVE_TK | 351 #ifdef HAVE_TK |
335 Tcl_StaticPackage(NULL, "Tk", Tk_Init, Tk_SafeInit); | 352 Tcl_StaticPackage(NULL, "Tk", Tk_Init, Tk_SafeInit); |
336 #endif /* HAVE_TK */ | 353 #endif /* HAVE_TK */ |
340 | 357 |
341 static gboolean tcl_unload(GaimPlugin *plugin) | 358 static gboolean tcl_unload(GaimPlugin *plugin) |
342 { | 359 { |
343 g_hash_table_destroy(tcl_plugins); | 360 g_hash_table_destroy(tcl_plugins); |
344 tcl_plugins = NULL; | 361 tcl_plugins = NULL; |
362 | |
363 gaim_stringref_unref(GaimTclRefAccount); | |
364 gaim_stringref_unref(GaimTclRefConversation); | |
365 gaim_stringref_unref(GaimTclRefStatus); | |
366 gaim_stringref_unref(GaimTclRefStatusAttr); | |
367 gaim_stringref_unref(GaimTclRefStatusType); | |
345 | 368 |
346 return TRUE; | 369 return TRUE; |
347 } | 370 } |
348 | 371 |
349 static GaimPluginLoaderInfo tcl_loader_info = | 372 static GaimPluginLoaderInfo tcl_loader_info = |