Mercurial > pidgin
annotate plugins/tcl/tcl.c @ 10462:f7b32dd67bdf
[gaim-migrate @ 11735]
Fix for bug 1027454: Blank "Unable to open socket" window if locale is not UTF-8
committer: Tailor Script <tailor@pidgin.im>
| author | Stu Tomlinson <stu@nosnilmot.com> |
|---|---|
| date | Fri, 31 Dec 2004 15:34:18 +0000 |
| parents | 4f1a59fb4159 |
| children | 0f7452b1f777 |
| rev | line source |
|---|---|
| 6694 | 1 /** |
| 2 * @file tcl.c Gaim Tcl plugin bindings | |
| 3 * | |
| 4 * gaim | |
| 5 * | |
| 6 * Copyright (C) 2003 Ethan Blanton <eblanton@cs.purdue.edu> | |
| 9943 | 7 * |
| 6694 | 8 * This program is free software; you can redistribute it and/or modify |
| 9 * it under the terms of the GNU General Public License as published by | |
| 10 * the Free Software Foundation; either version 2 of the License, or | |
| 11 * (at your option) any later version. | |
| 12 * | |
| 13 * This program is distributed in the hope that it will be useful, | |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 * GNU General Public License for more details. | |
| 17 * | |
| 18 * You should have received a copy of the GNU General Public License | |
| 19 * along with this program; if not, write to the Free Software | |
| 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 */ | |
| 22 | |
| 23 #include "config.h" | |
| 24 | |
| 25 #include <tcl.h> | |
| 26 | |
| 27 #ifdef HAVE_TK | |
| 28 #include <tk.h> | |
| 29 #endif | |
| 30 | |
| 31 #include <stdio.h> | |
| 32 #include <sys/types.h> | |
| 33 #include <sys/stat.h> | |
| 34 #include <unistd.h> | |
| 35 #include <string.h> | |
| 36 | |
| 37 #include "tcl_glib.h" | |
| 38 #include "tcl_gaim.h" | |
| 39 | |
| 40 #include "internal.h" | |
| 41 #include "connection.h" | |
| 42 #include "plugin.h" | |
| 43 #include "signals.h" | |
| 44 #include "debug.h" | |
| 45 #include "util.h" | |
| 9943 | 46 #include "version.h" |
| 6694 | 47 |
| 48 struct tcl_plugin_data { | |
| 49 GaimPlugin *plugin; | |
| 50 Tcl_Interp *interp; | |
| 51 }; | |
| 52 | |
| 53 static GHashTable *tcl_plugins = NULL; | |
| 54 | |
| 55 GaimPlugin *_tcl_plugin; | |
| 56 | |
|
7831
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
57 static gboolean tcl_loaded = FALSE; |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
58 |
| 6694 | 59 GaimPlugin *tcl_interp_get_plugin(Tcl_Interp *interp) |
| 60 { | |
| 61 struct tcl_plugin_data *data; | |
| 62 | |
| 63 if (tcl_plugins == NULL) | |
| 64 return NULL; | |
| 65 | |
| 66 data = g_hash_table_lookup(tcl_plugins, (gpointer)interp); | |
| 67 return data != NULL ? data->plugin : NULL; | |
| 68 } | |
| 69 | |
| 70 static int tcl_init_interp(Tcl_Interp *interp) | |
| 71 { | |
| 72 char *rcfile; | |
| 9943 | 73 char init[] = |
| 6694 | 74 "namespace eval ::gaim {\n" |
| 75 " namespace export account buddy connection conversation\n" | |
| 76 " namespace export core debug notify prefs send_im\n" | |
| 77 " namespace export signal unload\n" | |
| 78 " namespace eval _callback { }\n" | |
| 79 "\n" | |
| 80 " proc conv_send { account who text } {\n" | |
| 81 " set gc [gaim::account connection $account]\n" | |
| 82 " set convo [gaim::conversation new $account $who]\n" | |
| 83 " set myalias [gaim::account alias $account]\n" | |
| 84 "\n" | |
| 85 " if {![string length $myalias]} {\n" | |
| 86 " set myalias [gaim::account username $account]\n" | |
| 87 " }\n" | |
| 88 "\n" | |
| 89 " gaim::send_im $gc $who $text\n" | |
| 90 " gaim::conversation write $convo send $myalias $text\n" | |
| 91 " }\n" | |
| 92 "}\n" | |
| 93 "\n" | |
| 94 "proc bgerror { message } {\n" | |
| 95 " global errorInfo\n" | |
| 96 " gaim::notify -error \"Tcl Error\" \"Tcl Error: $message\" \"$errorInfo\"\n" | |
| 97 "}\n"; | |
| 98 | |
| 99 if (Tcl_EvalEx(interp, init, -1, TCL_EVAL_GLOBAL) != TCL_OK) { | |
| 100 return 1; | |
| 101 } | |
| 102 | |
| 103 Tcl_SetVar(interp, "argc", "0", TCL_GLOBAL_ONLY); | |
| 104 Tcl_SetVar(interp, "argv0", "gaim", TCL_GLOBAL_ONLY); | |
| 105 Tcl_SetVar(interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY); | |
| 106 rcfile = g_strdup_printf("%s" G_DIR_SEPARATOR_S "tclrc", gaim_user_dir()); | |
| 107 Tcl_SetVar(interp, "tcl_rcFileName", rcfile, TCL_GLOBAL_ONLY); | |
| 108 g_free(rcfile); | |
| 109 | |
| 110 Tcl_SetVar(interp, "::gaim::version", VERSION, TCL_GLOBAL_ONLY); | |
| 111 Tcl_SetVar(interp, "::gaim::user_dir", gaim_user_dir(), TCL_GLOBAL_ONLY); | |
| 112 #ifdef HAVE_TK | |
| 113 Tcl_SetVar(interp, "::gaim::tk_available", "1", TCL_GLOBAL_ONLY); | |
| 114 #else | |
| 115 Tcl_SetVar(interp, "::gaim::tk_available", "0", TCL_GLOBAL_ONLY); | |
| 116 #endif /* HAVE_TK */ | |
| 117 | |
| 118 Tcl_CreateObjCommand(interp, "::gaim::account", tcl_cmd_account, (ClientData)NULL, NULL); | |
| 119 Tcl_CreateObjCommand(interp, "::gaim::buddy", tcl_cmd_buddy, (ClientData)NULL, NULL); | |
| 120 Tcl_CreateObjCommand(interp, "::gaim::connection", tcl_cmd_connection, (ClientData)NULL, NULL); | |
| 121 Tcl_CreateObjCommand(interp, "::gaim::conversation", tcl_cmd_conversation, (ClientData)NULL, NULL); | |
| 122 Tcl_CreateObjCommand(interp, "::gaim::core", tcl_cmd_core, (ClientData)NULL, NULL); | |
| 123 Tcl_CreateObjCommand(interp, "::gaim::debug", tcl_cmd_debug, (ClientData)NULL, NULL); | |
| 124 Tcl_CreateObjCommand(interp, "::gaim::notify", tcl_cmd_notify, (ClientData)NULL, NULL); | |
| 125 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); | |
| 127 Tcl_CreateObjCommand(interp, "::gaim::signal", tcl_cmd_signal, (ClientData)NULL, NULL); | |
| 128 Tcl_CreateObjCommand(interp, "::gaim::unload", tcl_cmd_unload, (ClientData)NULL, NULL); | |
| 129 | |
| 130 return 0; | |
| 131 } | |
| 132 | |
| 133 static Tcl_Interp *tcl_create_interp() | |
| 134 { | |
| 135 Tcl_Interp *interp; | |
| 136 | |
| 137 interp = Tcl_CreateInterp(); | |
| 138 if (Tcl_Init(interp) == TCL_ERROR) { | |
| 139 Tcl_DeleteInterp(interp); | |
| 140 return NULL; | |
| 141 } | |
| 142 | |
| 143 if (tcl_init_interp(interp)) { | |
| 144 Tcl_DeleteInterp(interp); | |
| 145 return NULL; | |
| 146 } | |
| 147 Tcl_StaticPackage(interp, "gaim", tcl_init_interp, NULL); | |
| 148 | |
| 149 return interp; | |
| 150 } | |
| 151 | |
| 152 static gboolean tcl_probe_plugin(GaimPlugin *plugin) | |
| 153 { | |
| 154 GaimPluginInfo *info; | |
| 155 Tcl_Interp *interp; | |
| 156 Tcl_Parse parse; | |
| 157 Tcl_Obj *result, **listitems; | |
| 158 struct stat st; | |
| 159 FILE *fp; | |
| 160 char *buf, *cur; | |
| 10344 | 161 const char *next; |
| 6694 | 162 int len, found = 0, err = 0, nelems; |
| 163 gboolean status = FALSE; | |
| 164 | |
| 165 if ((fp = fopen(plugin->path, "r")) == NULL) | |
| 166 return FALSE; | |
| 167 if (fstat(fileno(fp), &st)) { | |
| 168 fclose(fp); | |
| 169 return FALSE; | |
| 170 } | |
| 171 len = st.st_size; | |
| 172 | |
| 173 buf = g_malloc(len + 1); | |
| 10344 | 174 |
| 175 cur = buf; | |
| 8989 | 176 while (fgets(cur, (int) buf - (buf - cur), fp)) { |
| 177 cur += strlen(cur); | |
| 10344 | 178 if (feof(fp)) |
| 8989 | 179 break; |
| 180 } | |
| 181 | |
| 182 if (ferror(fp)) { | |
| 183 gaim_debug(GAIM_DEBUG_ERROR, "tcl", "error reading %s (%s)\n", plugin->path, strerror(errno)); | |
| 6694 | 184 g_free(buf); |
| 185 fclose(fp); | |
| 186 return FALSE; | |
| 187 } | |
| 8989 | 188 |
| 6694 | 189 fclose(fp); |
| 190 | |
| 191 if ((interp = tcl_create_interp()) == NULL) { | |
| 192 return FALSE; | |
| 193 } | |
| 194 | |
| 10344 | 195 next = buf; |
| 6694 | 196 do { |
| 10344 | 197 if (Tcl_ParseCommand(interp, next, len, 0, &parse) == TCL_ERROR) { |
| 6694 | 198 gaim_debug(GAIM_DEBUG_ERROR, "tcl", "parse error in %s: %s\n", plugin->path, |
| 199 Tcl_GetString(Tcl_GetObjResult(interp))); | |
| 200 err = 1; | |
| 201 break; | |
| 202 } | |
| 203 if (parse.tokenPtr[0].type == TCL_TOKEN_SIMPLE_WORD | |
| 204 && !strncmp(parse.tokenPtr[0].start, "proc", parse.tokenPtr[0].size)) { | |
| 205 if (!strncmp(parse.tokenPtr[2].start, "plugin_init", parse.tokenPtr[2].size)) { | |
| 206 if (Tcl_EvalEx(interp, parse.commandStart, parse.commandSize, TCL_EVAL_GLOBAL) != TCL_OK) { | |
| 207 Tcl_FreeParse(&parse); | |
| 208 break; | |
| 209 } | |
| 210 found = 1; | |
| 211 /* We'll continue parsing the file, just in case */ | |
| 212 } | |
| 213 } | |
| 10344 | 214 len -= (parse.commandStart + parse.commandSize) - next; |
| 215 next = parse.commandStart + parse.commandSize; | |
| 6694 | 216 Tcl_FreeParse(&parse); |
| 217 } while (len); | |
| 218 | |
| 219 if (found && !err) { | |
| 220 if (Tcl_EvalEx(interp, "plugin_init", -1, TCL_EVAL_GLOBAL) == TCL_OK) { | |
| 221 result = Tcl_GetObjResult(interp); | |
| 222 if (Tcl_ListObjGetElements(interp, result, &nelems, &listitems) == TCL_OK) { | |
| 8117 | 223 if (nelems == 6) { |
| 6694 | 224 info = g_new0(GaimPluginInfo, 1); |
| 8761 | 225 |
| 9943 | 226 info->magic = GAIM_PLUGIN_MAGIC; |
| 227 info->major_version = GAIM_MAJOR_VERSION; | |
| 228 info->minor_version = GAIM_MINOR_VERSION; | |
| 6694 | 229 info->type = GAIM_PLUGIN_STANDARD; |
| 230 info->dependencies = g_list_append(info->dependencies, "core-tcl"); | |
| 8761 | 231 |
| 6694 | 232 info->name = g_strdup(Tcl_GetString(listitems[0])); |
| 233 info->version = g_strdup(Tcl_GetString(listitems[1])); | |
| 8117 | 234 info->summary = g_strdup(Tcl_GetString(listitems[2])); |
| 9775 | 235 info->description = g_strdup(Tcl_GetString(listitems[3])); |
| 10454 | 236 info->author = g_strdup(Tcl_GetString(listitems[4])); |
| 8117 | 237 info->homepage = g_strdup(Tcl_GetString(listitems[5])); |
| 8761 | 238 |
| 6694 | 239 plugin->info = info; |
| 8761 | 240 |
| 6694 | 241 if (gaim_plugin_register(plugin)) |
| 242 status = TRUE; | |
| 243 } | |
| 244 } | |
| 245 } | |
| 246 } | |
| 247 | |
| 248 Tcl_DeleteInterp(interp); | |
| 249 g_free(buf); | |
| 250 return status; | |
| 251 } | |
| 252 | |
| 253 static gboolean tcl_load_plugin(GaimPlugin *plugin) | |
| 254 { | |
| 255 struct tcl_plugin_data *data; | |
| 256 Tcl_Interp *interp; | |
| 257 Tcl_Obj *result; | |
| 258 | |
| 259 plugin->extra = NULL; | |
| 260 | |
| 261 if ((interp = tcl_create_interp()) == NULL) { | |
| 262 gaim_debug(GAIM_DEBUG_ERROR, "tcl", "Could not initialize Tcl interpreter\n"); | |
| 263 return FALSE; | |
| 264 } | |
| 265 | |
| 266 Tcl_SourceRCFile(interp); | |
| 267 | |
| 268 if (Tcl_EvalFile(interp, plugin->path) != TCL_OK) { | |
| 269 result = Tcl_GetObjResult(interp); | |
| 270 gaim_debug(GAIM_DEBUG_ERROR, "tcl", "Error evaluating %s: %s\n", plugin->path, Tcl_GetString(result)); | |
| 271 Tcl_DeleteInterp(interp); | |
| 272 return FALSE; | |
| 273 } | |
| 274 | |
| 275 Tcl_Preserve((ClientData)interp); | |
| 276 | |
| 277 data = g_new0(struct tcl_plugin_data, 1); | |
| 278 data->plugin = plugin; | |
| 279 data->interp = interp; | |
| 280 plugin->extra = data; | |
| 281 | |
| 282 g_hash_table_insert(tcl_plugins, (gpointer)interp, (gpointer)data); | |
| 283 | |
| 284 return TRUE; | |
| 285 } | |
| 286 | |
| 287 static gboolean tcl_unload_plugin(GaimPlugin *plugin) | |
| 288 { | |
| 289 struct tcl_plugin_data *data; | |
| 290 | |
| 291 if (plugin == NULL) | |
| 292 return TRUE; | |
| 293 | |
| 294 data = plugin->extra; | |
| 295 | |
| 10281 | 296 g_hash_table_remove(tcl_plugins, (gpointer)(data->interp)); |
| 6694 | 297 if (data != NULL) { |
| 298 gaim_signals_disconnect_by_handle(data->interp); | |
| 299 tcl_signal_cleanup(data->interp); | |
| 300 Tcl_Release((ClientData)data->interp); | |
| 301 Tcl_DeleteInterp(data->interp); | |
| 302 g_free(data); | |
| 303 } | |
| 304 | |
| 305 return TRUE; | |
| 306 } | |
| 307 | |
| 308 static void tcl_destroy_plugin(GaimPlugin *plugin) | |
| 309 { | |
| 310 if (plugin->info != NULL) { | |
| 311 g_free(plugin->info->name); | |
| 312 g_free(plugin->info->version); | |
| 313 g_free(plugin->info->description); | |
| 314 g_free(plugin->info->author); | |
| 315 g_free(plugin->info->homepage); | |
| 316 } | |
| 317 | |
| 318 return; | |
| 319 } | |
| 320 | |
| 321 static gboolean tcl_load(GaimPlugin *plugin) | |
| 322 { | |
|
7831
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
323 if(!tcl_loaded) |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
324 return FALSE; |
| 6694 | 325 tcl_glib_init(); |
| 326 tcl_signal_init(); | |
| 327 tcl_plugins = g_hash_table_new(g_direct_hash, g_direct_equal); | |
| 328 | |
| 7828 | 329 #ifdef HAVE_TK |
| 330 Tcl_StaticPackage(NULL, "Tk", Tk_Init, Tk_SafeInit); | |
| 331 #endif /* HAVE_TK */ | |
| 332 | |
| 6694 | 333 return TRUE; |
| 334 } | |
| 335 | |
| 336 static gboolean tcl_unload(GaimPlugin *plugin) | |
| 337 { | |
| 338 g_hash_table_destroy(tcl_plugins); | |
| 339 tcl_plugins = NULL; | |
| 340 | |
| 341 return TRUE; | |
| 342 } | |
| 343 | |
| 344 static GaimPluginLoaderInfo tcl_loader_info = | |
| 345 { | |
| 346 NULL, | |
| 347 tcl_probe_plugin, | |
| 348 tcl_load_plugin, | |
| 349 tcl_unload_plugin, | |
| 350 tcl_destroy_plugin, | |
| 351 }; | |
| 352 | |
| 353 static GaimPluginInfo tcl_info = | |
| 354 { | |
| 9943 | 355 GAIM_PLUGIN_MAGIC, |
| 356 GAIM_MAJOR_VERSION, | |
| 357 GAIM_MINOR_VERSION, | |
| 6694 | 358 GAIM_PLUGIN_LOADER, |
| 359 NULL, | |
| 360 0, | |
| 361 NULL, | |
| 362 GAIM_PRIORITY_DEFAULT, | |
| 363 "core-tcl", | |
| 364 N_("Tcl Plugin Loader"), | |
| 365 VERSION, | |
| 366 N_("Provides support for loading Tcl plugins"), | |
| 367 N_("Provides support for loading Tcl plugins"), | |
| 368 "Ethan Blanton <eblanton@cs.purdue.edu>", | |
| 369 GAIM_WEBSITE, | |
| 370 tcl_load, | |
| 371 tcl_unload, | |
| 372 NULL, | |
| 373 NULL, | |
| 8993 | 374 &tcl_loader_info, |
| 375 NULL, | |
| 376 NULL | |
| 6694 | 377 }; |
| 378 | |
|
7831
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
379 #ifdef _WIN32 |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
380 extern Tcl_Interp* (CALLBACK* wtcl_CreateInterp)(); |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
381 extern void (CALLBACK* wtk_Init)(Tcl_Interp*); |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
382 #undef Tcl_CreateInterp |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
383 #define Tcl_CreateInterp wtcl_CreateInterp |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
384 #undef Tk_Init |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
385 #define Tk_Init wtk_Init |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
386 #endif /* _WIN32 */ |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
387 |
| 6694 | 388 static void tcl_init_plugin(GaimPlugin *plugin) |
| 389 { | |
|
7831
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
390 #ifdef USE_TCL_STUBS |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
391 Tcl_Interp *interp=NULL; |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
392 #endif |
| 6694 | 393 _tcl_plugin = plugin; |
| 394 | |
|
7831
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
395 #ifdef USE_TCL_STUBS |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
396 if(!(interp=Tcl_CreateInterp())) |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
397 return; |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
398 |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
399 if(!Tcl_InitStubs(interp, TCL_VERSION, 0)) { |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
400 gaim_debug(GAIM_DEBUG_ERROR, "tcl", "Tcl_InitStubs: %s\n", interp->result); |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
401 return; |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
402 } |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
403 #endif |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
404 |
| 6694 | 405 Tcl_FindExecutable("gaim"); |
| 406 | |
|
7831
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
407 #if defined(USE_TK_STUBS) && defined(HAVE_TK) |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
408 Tk_Init(interp); |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
409 |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
410 if(!Tk_InitStubs(interp, TK_VERSION, 0)) { |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
411 gaim_debug(GAIM_DEBUG_ERROR, "tcl", "Error Tk_InitStubs: %s\n", interp->result); |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
412 Tcl_DeleteInterp(interp); |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
413 return; |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
414 } |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
415 #endif |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
416 tcl_loaded = TRUE; |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
417 #ifdef USE_TCL_STUBS |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
418 Tcl_DeleteInterp(interp); |
|
409f7f167c98
[gaim-migrate @ 8483]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7828
diff
changeset
|
419 #endif |
| 6694 | 420 tcl_loader_info.exts = g_list_append(tcl_loader_info.exts, "tcl"); |
| 421 } | |
| 422 | |
| 6735 | 423 GAIM_INIT_PLUGIN(tcl, tcl_init_plugin, tcl_info) |
