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