Sat, 27 Apr 2013 14:39:33 +0200
Change char* to const char* in PurplePluginInfo
| 6694 | 1 | /** |
| 15884 | 2 | * @file tcl.c Purple Tcl plugin bindings |
| 6694 | 3 | * |
| 15884 | 4 | * purple |
| 6694 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17629
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 6694 | 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" | |
| 15884 | 38 | #include "tcl_purple.h" |
| 6694 | 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 { | |
| 15884 | 49 | PurplePlugin *plugin; |
| 6694 | 50 | Tcl_Interp *interp; |
| 51 | }; | |
| 52 | ||
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
53 | typedef struct { |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
54 | char *id; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
55 | char *name; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
56 | char *version; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
57 | char *summary; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
58 | char *description; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
59 | char *author; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
60 | char *homepage; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
61 | } tcl_plugin_info_strings; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
62 | |
| 15884 | 63 | PurpleStringref *PurpleTclRefAccount; |
| 64 | PurpleStringref *PurpleTclRefConnection; | |
| 65 | PurpleStringref *PurpleTclRefConversation; | |
| 66 | PurpleStringref *PurpleTclRefPointer; | |
| 67 | PurpleStringref *PurpleTclRefPlugin; | |
| 68 | PurpleStringref *PurpleTclRefPresence; | |
| 69 | PurpleStringref *PurpleTclRefStatus; | |
| 70 | PurpleStringref *PurpleTclRefStatusAttr; | |
| 71 | PurpleStringref *PurpleTclRefStatusType; | |
| 72 | PurpleStringref *PurpleTclRefXfer; | |
|
20393
6280efb8c658
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19859
diff
changeset
|
73 | PurpleStringref *PurpleTclRefHandle; |
| 13812 | 74 | |
| 6694 | 75 | static GHashTable *tcl_plugins = NULL; |
| 76 | ||
| 15884 | 77 | PurplePlugin *_tcl_plugin; |
| 6694 | 78 | |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
79 | static gboolean tcl_loaded = FALSE; |
|
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
80 | |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
81 | static void tcl_plugin_info_strings_free(tcl_plugin_info_strings *strings) |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
82 | { |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
83 | if (strings == NULL) |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
84 | return; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
85 | |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
86 | g_free(strings->id); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
87 | g_free(strings->name); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
88 | g_free(strings->version); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
89 | g_free(strings->summary); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
90 | g_free(strings->description); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
91 | g_free(strings->author); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
92 | g_free(strings->homepage); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
93 | g_free(strings); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
94 | } |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
95 | |
| 15884 | 96 | PurplePlugin *tcl_interp_get_plugin(Tcl_Interp *interp) |
| 6694 | 97 | { |
| 98 | struct tcl_plugin_data *data; | |
| 99 | ||
| 100 | if (tcl_plugins == NULL) | |
| 101 | return NULL; | |
| 102 | ||
| 103 | data = g_hash_table_lookup(tcl_plugins, (gpointer)interp); | |
| 104 | return data != NULL ? data->plugin : NULL; | |
| 105 | } | |
| 106 | ||
| 107 | static int tcl_init_interp(Tcl_Interp *interp) | |
| 108 | { | |
| 109 | char *rcfile; | |
| 9943 | 110 | char init[] = |
| 15884 | 111 | "namespace eval ::purple {\n" |
| 6694 | 112 | " namespace export account buddy connection conversation\n" |
| 113 | " namespace export core debug notify prefs send_im\n" | |
| 114 | " namespace export signal unload\n" | |
| 115 | " namespace eval _callback { }\n" | |
| 116 | "\n" | |
| 117 | " proc conv_send { account who text } {\n" | |
| 15884 | 118 | " set gc [purple::account connection $account]\n" |
| 119 | " set convo [purple::conversation new $account $who]\n" | |
| 120 | " set myalias [purple::account alias $account]\n" | |
| 6694 | 121 | "\n" |
| 122 | " if {![string length $myalias]} {\n" | |
| 15884 | 123 | " set myalias [purple::account username $account]\n" |
| 6694 | 124 | " }\n" |
| 125 | "\n" | |
| 15884 | 126 | " purple::send_im $gc $who $text\n" |
| 127 | " purple::conversation write $convo send $myalias $text\n" | |
| 6694 | 128 | " }\n" |
| 129 | "}\n" | |
| 130 | "\n" | |
| 131 | "proc bgerror { message } {\n" | |
| 132 | " global errorInfo\n" | |
| 15884 | 133 | " purple::notify -error \"Tcl Error\" \"Tcl Error: $message\" \"$errorInfo\"\n" |
| 6694 | 134 | "}\n"; |
| 135 | ||
| 136 | if (Tcl_EvalEx(interp, init, -1, TCL_EVAL_GLOBAL) != TCL_OK) { | |
| 137 | return 1; | |
| 138 | } | |
| 139 | ||
| 140 | Tcl_SetVar(interp, "argc", "0", TCL_GLOBAL_ONLY); | |
| 15884 | 141 | Tcl_SetVar(interp, "argv0", "purple", TCL_GLOBAL_ONLY); |
| 6694 | 142 | Tcl_SetVar(interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY); |
| 15884 | 143 | rcfile = g_strdup_printf("%s" G_DIR_SEPARATOR_S "tclrc", purple_user_dir()); |
| 6694 | 144 | Tcl_SetVar(interp, "tcl_rcFileName", rcfile, TCL_GLOBAL_ONLY); |
| 145 | g_free(rcfile); | |
| 146 | ||
| 15884 | 147 | Tcl_SetVar(interp, "::purple::version", VERSION, TCL_GLOBAL_ONLY); |
| 148 | Tcl_SetVar(interp, "::purple::user_dir", purple_user_dir(), TCL_GLOBAL_ONLY); | |
| 6694 | 149 | #ifdef HAVE_TK |
| 15884 | 150 | Tcl_SetVar(interp, "::purple::tk_available", "1", TCL_GLOBAL_ONLY); |
| 6694 | 151 | #else |
| 15884 | 152 | Tcl_SetVar(interp, "::purple::tk_available", "0", TCL_GLOBAL_ONLY); |
| 6694 | 153 | #endif /* HAVE_TK */ |
| 154 | ||
| 15884 | 155 | Tcl_CreateObjCommand(interp, "::purple::account", tcl_cmd_account, (ClientData)NULL, NULL); |
| 156 | Tcl_CreateObjCommand(interp, "::purple::buddy", tcl_cmd_buddy, (ClientData)NULL, NULL); | |
| 157 | Tcl_CreateObjCommand(interp, "::purple::cmd", tcl_cmd_cmd, (ClientData)NULL, NULL); | |
| 158 | Tcl_CreateObjCommand(interp, "::purple::connection", tcl_cmd_connection, (ClientData)NULL, NULL); | |
| 159 | Tcl_CreateObjCommand(interp, "::purple::conversation", tcl_cmd_conversation, (ClientData)NULL, NULL); | |
| 160 | Tcl_CreateObjCommand(interp, "::purple::core", tcl_cmd_core, (ClientData)NULL, NULL); | |
| 161 | Tcl_CreateObjCommand(interp, "::purple::debug", tcl_cmd_debug, (ClientData)NULL, NULL); | |
| 162 | Tcl_CreateObjCommand(interp, "::purple::notify", tcl_cmd_notify, (ClientData)NULL, NULL); | |
| 163 | Tcl_CreateObjCommand(interp, "::purple::plugins", tcl_cmd_plugins, (ClientData)NULL, NULL); | |
| 164 | Tcl_CreateObjCommand(interp, "::purple::prefs", tcl_cmd_prefs, (ClientData)NULL, NULL); | |
| 165 | Tcl_CreateObjCommand(interp, "::purple::presence", tcl_cmd_presence, (ClientData)NULL, NULL); | |
| 166 | Tcl_CreateObjCommand(interp, "::purple::send_im", tcl_cmd_send_im, (ClientData)NULL, NULL); | |
| 167 | Tcl_CreateObjCommand(interp, "::purple::savedstatus", tcl_cmd_savedstatus, (ClientData)NULL, NULL); | |
| 168 | Tcl_CreateObjCommand(interp, "::purple::signal", tcl_cmd_signal, (ClientData)NULL, NULL); | |
| 169 | Tcl_CreateObjCommand(interp, "::purple::status", tcl_cmd_status, (ClientData)NULL, NULL); | |
| 170 | Tcl_CreateObjCommand(interp, "::purple::status_attr", tcl_cmd_status_attr, (ClientData)NULL, NULL); | |
| 171 | Tcl_CreateObjCommand(interp, "::purple::status_type", tcl_cmd_status_type, (ClientData)NULL, NULL); | |
| 172 | Tcl_CreateObjCommand(interp, "::purple::unload", tcl_cmd_unload, (ClientData)NULL, NULL); | |
| 6694 | 173 | |
| 174 | return 0; | |
| 175 | } | |
| 176 | ||
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
21389
diff
changeset
|
177 | static Tcl_Interp *tcl_create_interp(void) |
| 6694 | 178 | { |
| 179 | Tcl_Interp *interp; | |
| 180 | ||
| 181 | interp = Tcl_CreateInterp(); | |
| 182 | if (Tcl_Init(interp) == TCL_ERROR) { | |
| 183 | Tcl_DeleteInterp(interp); | |
| 184 | return NULL; | |
| 185 | } | |
| 186 | ||
| 187 | if (tcl_init_interp(interp)) { | |
| 188 | Tcl_DeleteInterp(interp); | |
| 189 | return NULL; | |
| 190 | } | |
| 15884 | 191 | Tcl_StaticPackage(interp, "purple", tcl_init_interp, NULL); |
| 6694 | 192 | |
| 193 | return interp; | |
| 194 | } | |
| 195 | ||
| 15884 | 196 | static gboolean tcl_probe_plugin(PurplePlugin *plugin) |
| 6694 | 197 | { |
| 15884 | 198 | PurplePluginInfo *info; |
| 6694 | 199 | Tcl_Interp *interp; |
| 200 | Tcl_Parse parse; | |
| 201 | Tcl_Obj *result, **listitems; | |
|
33575
a53317024f50
Change Tcl plugin parsing to use g_file_get_contents().
Ethan Blanton <elb@pidgin.im>
parents:
22104
diff
changeset
|
202 | char *buf; |
|
10344
09d0502090b3
[gaim-migrate @ 11554]
Mark Doliner <markdoliner@pidgin.im>
parents:
10281
diff
changeset
|
203 | const char *next; |
|
33575
a53317024f50
Change Tcl plugin parsing to use g_file_get_contents().
Ethan Blanton <elb@pidgin.im>
parents:
22104
diff
changeset
|
204 | int found = 0, err = 0, nelems; |
|
a53317024f50
Change Tcl plugin parsing to use g_file_get_contents().
Ethan Blanton <elb@pidgin.im>
parents:
22104
diff
changeset
|
205 | gsize len; |
| 6694 | 206 | gboolean status = FALSE; |
|
33575
a53317024f50
Change Tcl plugin parsing to use g_file_get_contents().
Ethan Blanton <elb@pidgin.im>
parents:
22104
diff
changeset
|
207 | |
|
a53317024f50
Change Tcl plugin parsing to use g_file_get_contents().
Ethan Blanton <elb@pidgin.im>
parents:
22104
diff
changeset
|
208 | if (!g_file_get_contents(plugin->path, &buf, &len, NULL)) { |
|
a53317024f50
Change Tcl plugin parsing to use g_file_get_contents().
Ethan Blanton <elb@pidgin.im>
parents:
22104
diff
changeset
|
209 | purple_debug(PURPLE_DEBUG_INFO, "tcl", "Error opening plugin %s\n", |
|
a53317024f50
Change Tcl plugin parsing to use g_file_get_contents().
Ethan Blanton <elb@pidgin.im>
parents:
22104
diff
changeset
|
210 | plugin->path); |
| 6694 | 211 | return FALSE; |
| 212 | } | |
| 213 | ||
| 214 | if ((interp = tcl_create_interp()) == NULL) { | |
| 215 | return FALSE; | |
| 216 | } | |
| 217 | ||
|
10344
09d0502090b3
[gaim-migrate @ 11554]
Mark Doliner <markdoliner@pidgin.im>
parents:
10281
diff
changeset
|
218 | next = buf; |
| 6694 | 219 | do { |
|
10344
09d0502090b3
[gaim-migrate @ 11554]
Mark Doliner <markdoliner@pidgin.im>
parents:
10281
diff
changeset
|
220 | if (Tcl_ParseCommand(interp, next, len, 0, &parse) == TCL_ERROR) { |
| 15884 | 221 | purple_debug(PURPLE_DEBUG_ERROR, "tcl", "parse error in %s: %s\n", plugin->path, |
| 6694 | 222 | Tcl_GetString(Tcl_GetObjResult(interp))); |
| 223 | err = 1; | |
| 224 | break; | |
| 225 | } | |
| 226 | if (parse.tokenPtr[0].type == TCL_TOKEN_SIMPLE_WORD | |
| 227 | && !strncmp(parse.tokenPtr[0].start, "proc", parse.tokenPtr[0].size)) { | |
| 228 | if (!strncmp(parse.tokenPtr[2].start, "plugin_init", parse.tokenPtr[2].size)) { | |
| 229 | if (Tcl_EvalEx(interp, parse.commandStart, parse.commandSize, TCL_EVAL_GLOBAL) != TCL_OK) { | |
| 230 | Tcl_FreeParse(&parse); | |
| 231 | break; | |
| 232 | } | |
| 233 | found = 1; | |
| 234 | /* We'll continue parsing the file, just in case */ | |
| 235 | } | |
| 236 | } | |
|
10344
09d0502090b3
[gaim-migrate @ 11554]
Mark Doliner <markdoliner@pidgin.im>
parents:
10281
diff
changeset
|
237 | len -= (parse.commandStart + parse.commandSize) - next; |
|
09d0502090b3
[gaim-migrate @ 11554]
Mark Doliner <markdoliner@pidgin.im>
parents:
10281
diff
changeset
|
238 | next = parse.commandStart + parse.commandSize; |
| 6694 | 239 | Tcl_FreeParse(&parse); |
| 240 | } while (len); | |
| 241 | ||
| 242 | if (found && !err) { | |
| 243 | if (Tcl_EvalEx(interp, "plugin_init", -1, TCL_EVAL_GLOBAL) == TCL_OK) { | |
| 244 | result = Tcl_GetObjResult(interp); | |
| 245 | if (Tcl_ListObjGetElements(interp, result, &nelems, &listitems) == TCL_OK) { | |
| 12987 | 246 | if ((nelems == 6) || (nelems == 7)) { |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
247 | tcl_plugin_info_strings *strings = g_new0(tcl_plugin_info_strings, 1); |
| 15884 | 248 | info = g_new0(PurplePluginInfo, 1); |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
249 | info->extra_info = strings; |
|
8761
2d596fd60ba8
[gaim-migrate @ 9516]
Mark Doliner <markdoliner@pidgin.im>
parents:
8759
diff
changeset
|
250 | |
| 15884 | 251 | info->magic = PURPLE_PLUGIN_MAGIC; |
| 252 | info->major_version = PURPLE_MAJOR_VERSION; | |
| 253 | info->minor_version = PURPLE_MINOR_VERSION; | |
| 254 | info->type = PURPLE_PLUGIN_STANDARD; | |
| 6694 | 255 | info->dependencies = g_list_append(info->dependencies, "core-tcl"); |
|
8761
2d596fd60ba8
[gaim-migrate @ 9516]
Mark Doliner <markdoliner@pidgin.im>
parents:
8759
diff
changeset
|
256 | |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
257 | info->name = strings->name = g_strdup(Tcl_GetString(listitems[0])); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
258 | info->version = strings->version = g_strdup(Tcl_GetString(listitems[1])); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
259 | info->summary = strings->summary = g_strdup(Tcl_GetString(listitems[2])); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
260 | info->description = strings->description = g_strdup(Tcl_GetString(listitems[3])); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
261 | info->author = strings->author = g_strdup(Tcl_GetString(listitems[4])); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
262 | info->homepage = strings->homepage = g_strdup(Tcl_GetString(listitems[5])); |
|
8761
2d596fd60ba8
[gaim-migrate @ 9516]
Mark Doliner <markdoliner@pidgin.im>
parents:
8759
diff
changeset
|
263 | |
| 12987 | 264 | if (nelems == 6) |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
265 | info->id = strings->id = g_strdup_printf("tcl-%s", Tcl_GetString(listitems[0])); |
| 12987 | 266 | else if (nelems == 7) |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
267 | info->id = strings->id = g_strdup_printf("tcl-%s", Tcl_GetString(listitems[6])); |
| 12987 | 268 | |
| 6694 | 269 | plugin->info = info; |
|
8761
2d596fd60ba8
[gaim-migrate @ 9516]
Mark Doliner <markdoliner@pidgin.im>
parents:
8759
diff
changeset
|
270 | |
| 15884 | 271 | if (purple_plugin_register(plugin)) |
| 6694 | 272 | status = TRUE; |
| 273 | } | |
| 274 | } | |
| 275 | } | |
| 276 | } | |
| 277 | ||
| 278 | Tcl_DeleteInterp(interp); | |
| 279 | g_free(buf); | |
| 280 | return status; | |
| 281 | } | |
| 282 | ||
| 15884 | 283 | static gboolean tcl_load_plugin(PurplePlugin *plugin) |
| 6694 | 284 | { |
| 285 | struct tcl_plugin_data *data; | |
| 286 | Tcl_Interp *interp; | |
| 287 | Tcl_Obj *result; | |
| 288 | ||
| 289 | plugin->extra = NULL; | |
| 290 | ||
| 291 | if ((interp = tcl_create_interp()) == NULL) { | |
| 15884 | 292 | purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Could not initialize Tcl interpreter\n"); |
| 6694 | 293 | return FALSE; |
| 294 | } | |
| 295 | ||
| 296 | Tcl_SourceRCFile(interp); | |
| 297 | ||
| 298 | if (Tcl_EvalFile(interp, plugin->path) != TCL_OK) { | |
| 299 | result = Tcl_GetObjResult(interp); | |
| 15884 | 300 | purple_debug(PURPLE_DEBUG_ERROR, "tcl", |
| 13847 | 301 | "Error evaluating %s: %s\n", plugin->path, |
| 302 | Tcl_GetString(result)); | |
| 6694 | 303 | Tcl_DeleteInterp(interp); |
| 304 | return FALSE; | |
| 305 | } | |
| 306 | ||
| 307 | Tcl_Preserve((ClientData)interp); | |
| 308 | ||
| 309 | data = g_new0(struct tcl_plugin_data, 1); | |
| 310 | data->plugin = plugin; | |
| 311 | data->interp = interp; | |
| 312 | plugin->extra = data; | |
| 313 | ||
| 314 | g_hash_table_insert(tcl_plugins, (gpointer)interp, (gpointer)data); | |
| 315 | ||
| 316 | return TRUE; | |
| 317 | } | |
| 318 | ||
| 15884 | 319 | static gboolean tcl_unload_plugin(PurplePlugin *plugin) |
| 6694 | 320 | { |
| 321 | struct tcl_plugin_data *data; | |
| 322 | ||
| 323 | if (plugin == NULL) | |
| 324 | return TRUE; | |
| 325 | ||
| 326 | data = plugin->extra; | |
| 327 | ||
| 328 | if (data != NULL) { | |
|
13439
1ef0c638a216
[gaim-migrate @ 15813]
Richard Laager <rlaager@pidgin.im>
parents:
13199
diff
changeset
|
329 | g_hash_table_remove(tcl_plugins, (gpointer)(data->interp)); |
| 15884 | 330 | purple_signals_disconnect_by_handle(data->interp); |
| 13847 | 331 | tcl_cmd_cleanup(data->interp); |
| 6694 | 332 | tcl_signal_cleanup(data->interp); |
| 333 | Tcl_Release((ClientData)data->interp); | |
| 334 | Tcl_DeleteInterp(data->interp); | |
| 335 | g_free(data); | |
| 336 | } | |
| 337 | ||
| 338 | return TRUE; | |
| 339 | } | |
| 340 | ||
| 15884 | 341 | static void tcl_destroy_plugin(PurplePlugin *plugin) |
| 6694 | 342 | { |
| 343 | if (plugin->info != NULL) { | |
|
33906
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
344 | tcl_plugin_info_strings *info_strings = plugin->info->extra_info; |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
345 | tcl_plugin_info_strings_free(info_strings); |
|
dc870eacc2d0
Change char* to const char* in PurplePluginInfo
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33861
diff
changeset
|
346 | plugin->info->extra_info = NULL; |
| 6694 | 347 | } |
| 348 | ||
| 349 | return; | |
| 350 | } | |
| 351 | ||
| 15884 | 352 | static gboolean tcl_load(PurplePlugin *plugin) |
| 6694 | 353 | { |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
354 | if(!tcl_loaded) |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
355 | return FALSE; |
| 6694 | 356 | tcl_glib_init(); |
| 13847 | 357 | tcl_cmd_init(); |
| 6694 | 358 | tcl_signal_init(); |
| 15884 | 359 | purple_tcl_ref_init(); |
| 13812 | 360 | |
| 15884 | 361 | PurpleTclRefAccount = purple_stringref_new("Account"); |
| 362 | PurpleTclRefConnection = purple_stringref_new("Connection"); | |
| 363 | PurpleTclRefConversation = purple_stringref_new("Conversation"); | |
| 364 | PurpleTclRefPointer = purple_stringref_new("Pointer"); | |
| 365 | PurpleTclRefPlugin = purple_stringref_new("Plugin"); | |
| 366 | PurpleTclRefPresence = purple_stringref_new("Presence"); | |
| 367 | PurpleTclRefStatus = purple_stringref_new("Status"); | |
| 368 | PurpleTclRefStatusAttr = purple_stringref_new("StatusAttr"); | |
| 369 | PurpleTclRefStatusType = purple_stringref_new("StatusType"); | |
| 370 | PurpleTclRefXfer = purple_stringref_new("Xfer"); | |
|
20393
6280efb8c658
Another fabulous patch to our Tcl loader from venks on irc.freenode.net.
Ethan Blanton <elb@pidgin.im>
parents:
19859
diff
changeset
|
371 | PurpleTclRefHandle = purple_stringref_new("Handle"); |
| 13812 | 372 | |
| 6694 | 373 | tcl_plugins = g_hash_table_new(g_direct_hash, g_direct_equal); |
| 374 | ||
| 7828 | 375 | #ifdef HAVE_TK |
| 376 | Tcl_StaticPackage(NULL, "Tk", Tk_Init, Tk_SafeInit); | |
| 377 | #endif /* HAVE_TK */ | |
| 378 | ||
| 6694 | 379 | return TRUE; |
| 380 | } | |
| 381 | ||
| 15884 | 382 | static gboolean tcl_unload(PurplePlugin *plugin) |
| 6694 | 383 | { |
| 384 | g_hash_table_destroy(tcl_plugins); | |
| 385 | tcl_plugins = NULL; | |
| 386 | ||
| 15884 | 387 | purple_stringref_unref(PurpleTclRefAccount); |
| 388 | purple_stringref_unref(PurpleTclRefConnection); | |
| 389 | purple_stringref_unref(PurpleTclRefConversation); | |
| 390 | purple_stringref_unref(PurpleTclRefPointer); | |
| 391 | purple_stringref_unref(PurpleTclRefPlugin); | |
| 392 | purple_stringref_unref(PurpleTclRefPresence); | |
| 393 | purple_stringref_unref(PurpleTclRefStatus); | |
| 394 | purple_stringref_unref(PurpleTclRefStatusAttr); | |
| 395 | purple_stringref_unref(PurpleTclRefStatusType); | |
| 396 | purple_stringref_unref(PurpleTclRefXfer); | |
| 13812 | 397 | |
| 6694 | 398 | return TRUE; |
| 399 | } | |
| 400 | ||
| 15884 | 401 | static PurplePluginLoaderInfo tcl_loader_info = |
| 6694 | 402 | { |
| 403 | NULL, | |
| 404 | tcl_probe_plugin, | |
| 405 | tcl_load_plugin, | |
| 406 | tcl_unload_plugin, | |
| 407 | tcl_destroy_plugin, | |
|
16750
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
408 | |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
409 | /* pidgin */ |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
410 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
411 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
412 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
413 | NULL |
| 6694 | 414 | }; |
| 415 | ||
| 15884 | 416 | static PurplePluginInfo tcl_info = |
| 6694 | 417 | { |
| 15884 | 418 | PURPLE_PLUGIN_MAGIC, |
| 419 | PURPLE_MAJOR_VERSION, | |
| 420 | PURPLE_MINOR_VERSION, | |
| 421 | PURPLE_PLUGIN_LOADER, | |
| 6694 | 422 | NULL, |
| 423 | 0, | |
| 424 | NULL, | |
| 15884 | 425 | PURPLE_PRIORITY_DEFAULT, |
| 6694 | 426 | "core-tcl", |
| 427 | N_("Tcl Plugin Loader"), | |
|
21106
b85fbef13eed
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20393
diff
changeset
|
428 | DISPLAY_VERSION, |
| 6694 | 429 | N_("Provides support for loading Tcl plugins"), |
| 430 | N_("Provides support for loading Tcl plugins"), | |
| 431 | "Ethan Blanton <eblanton@cs.purdue.edu>", | |
| 15884 | 432 | PURPLE_WEBSITE, |
| 6694 | 433 | tcl_load, |
| 434 | tcl_unload, | |
| 435 | NULL, | |
| 436 | NULL, | |
| 8993 | 437 | &tcl_loader_info, |
| 438 | NULL, | |
|
16750
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
439 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
440 | |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
441 | /* padding */ |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
442 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
443 | NULL, |
|
a568944eee52
Updating the loaders since I missed them since I'm not building any of them right now
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
444 | NULL, |
| 8993 | 445 | NULL |
| 6694 | 446 | }; |
| 447 | ||
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
448 | #ifdef _WIN32 |
|
33756
81c1f235dce6
tcl: Fix dynamically loaded Tcl/Tk functions to be called using cdecl calling conventions.
Daniel Atallah <datallah@pidgin.im>
parents:
33575
diff
changeset
|
449 | typedef Tcl_Interp* (__cdecl* LPFNTCLCREATEINTERP)(void); |
|
81c1f235dce6
tcl: Fix dynamically loaded Tcl/Tk functions to be called using cdecl calling conventions.
Daniel Atallah <datallah@pidgin.im>
parents:
33575
diff
changeset
|
450 | typedef void (__cdecl* LPFNTKINIT)(Tcl_Interp*); |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
451 | |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
452 | LPFNTCLCREATEINTERP wtcl_CreateInterp = NULL; |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
453 | LPFNTKINIT wtk_Init = NULL; |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
454 | #undef Tcl_CreateInterp |
|
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
455 | #define Tcl_CreateInterp wtcl_CreateInterp |
|
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
456 | #undef Tk_Init |
|
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
457 | #define Tk_Init wtk_Init |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
458 | |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
459 | static gboolean tcl_win32_init() { |
| 14913 | 460 | gboolean retval = FALSE; |
| 461 | ||
|
33861
71533f0d5dc0
win32: switch to OBS, update and push to runtime-deps package - libenchant, gtkspell, meanwhile, tcl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33756
diff
changeset
|
462 | if(!(wtcl_CreateInterp = (LPFNTCLCREATEINTERP) wpurple_find_and_loadproc("tcl85.dll", "Tcl_CreateInterp"))) { |
|
71533f0d5dc0
win32: switch to OBS, update and push to runtime-deps package - libenchant, gtkspell, meanwhile, tcl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33756
diff
changeset
|
463 | purple_debug(PURPLE_DEBUG_INFO, "tcl", "tcl_win32_init error loading Tcl_CreateInterp\n"); |
|
71533f0d5dc0
win32: switch to OBS, update and push to runtime-deps package - libenchant, gtkspell, meanwhile, tcl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33756
diff
changeset
|
464 | } else { |
|
71533f0d5dc0
win32: switch to OBS, update and push to runtime-deps package - libenchant, gtkspell, meanwhile, tcl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33756
diff
changeset
|
465 | if(!(wtk_Init = (LPFNTKINIT) wpurple_find_and_loadproc("tk85.dll", "Tk_Init"))) { |
|
71533f0d5dc0
win32: switch to OBS, update and push to runtime-deps package - libenchant, gtkspell, meanwhile, tcl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33756
diff
changeset
|
466 | HMODULE mod; |
|
71533f0d5dc0
win32: switch to OBS, update and push to runtime-deps package - libenchant, gtkspell, meanwhile, tcl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33756
diff
changeset
|
467 | purple_debug(PURPLE_DEBUG_INFO, "tcl", "tcl_win32_init error loading Tk_Init\n"); |
|
71533f0d5dc0
win32: switch to OBS, update and push to runtime-deps package - libenchant, gtkspell, meanwhile, tcl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33756
diff
changeset
|
468 | if((mod = GetModuleHandle("tcl85.dll"))) |
|
71533f0d5dc0
win32: switch to OBS, update and push to runtime-deps package - libenchant, gtkspell, meanwhile, tcl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33756
diff
changeset
|
469 | FreeLibrary(mod); |
|
71533f0d5dc0
win32: switch to OBS, update and push to runtime-deps package - libenchant, gtkspell, meanwhile, tcl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33756
diff
changeset
|
470 | } else { |
|
71533f0d5dc0
win32: switch to OBS, update and push to runtime-deps package - libenchant, gtkspell, meanwhile, tcl
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33756
diff
changeset
|
471 | retval = TRUE; |
|
17629
877897645980
Don't load the tcl loader plugin on Windows unless ActiveTcl 8.4.5 or newer is present. Fixes #538.
Daniel Atallah <datallah@pidgin.im>
parents:
16750
diff
changeset
|
472 | } |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
473 | } |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
474 | |
| 14913 | 475 | return retval; |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
476 | } |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
477 | |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
478 | #endif /* _WIN32 */ |
|
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
479 | |
| 15884 | 480 | static void tcl_init_plugin(PurplePlugin *plugin) |
| 6694 | 481 | { |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
482 | #ifdef USE_TCL_STUBS |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
483 | Tcl_Interp *interp = NULL; |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
484 | #endif |
| 6694 | 485 | _tcl_plugin = plugin; |
| 486 | ||
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
487 | #ifdef USE_TCL_STUBS |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
488 | #ifdef _WIN32 |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
489 | if(!tcl_win32_init()) |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
490 | return; |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
491 | #endif |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
492 | if(!(interp = Tcl_CreateInterp())) |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
493 | return; |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
494 | |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
495 | if(!Tcl_InitStubs(interp, TCL_VERSION, 0)) { |
| 15884 | 496 | purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Tcl_InitStubs: %s\n", interp->result); |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
497 | return; |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
498 | } |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
499 | #endif |
|
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
500 | |
| 15884 | 501 | Tcl_FindExecutable("purple"); |
| 6694 | 502 | |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
503 | #if defined(USE_TK_STUBS) && defined(HAVE_TK) |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
504 | Tk_Init(interp); |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
505 | |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
506 | if(!Tk_InitStubs(interp, TK_VERSION, 0)) { |
| 15884 | 507 | purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Error Tk_InitStubs: %s\n", interp->result); |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
508 | Tcl_DeleteInterp(interp); |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
509 | return; |
|
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
510 | } |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
511 | #endif |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
512 | tcl_loaded = TRUE; |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
513 | #ifdef USE_TCL_STUBS |
|
13456
4949b0656a2b
[gaim-migrate @ 15830]
Daniel Atallah <datallah@pidgin.im>
parents:
13439
diff
changeset
|
514 | Tcl_DeleteInterp(interp); |
|
7831
54076c9af6ad
[gaim-migrate @ 8483]
Herman Bloggs <herman@bluedigits.com>
parents:
7828
diff
changeset
|
515 | #endif |
| 6694 | 516 | tcl_loader_info.exts = g_list_append(tcl_loader_info.exts, "tcl"); |
| 517 | } | |
| 518 | ||
| 15884 | 519 | PURPLE_INIT_PLUGIN(tcl, tcl_init_plugin, tcl_info) |