Wed, 13 May 2009 20:29:03 +0000
Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.
| 6694 | 1 | /** |
| 15884 | 2 | * @file tcl_signals.c Purple Tcl signal API |
| 6694 | 3 | * |
| 15884 | 4 | * purple |
| 6694 | 5 | * |
| 6 | * Copyright (C) 2003 Ethan Blanton <eblanton@cs.purdue.edu> | |
| 7 | * | |
| 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:
17463
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 6694 | 21 | */ |
| 22 | #include <tcl.h> | |
| 23 | #include <stdarg.h> | |
| 24 | ||
| 15884 | 25 | #include "tcl_purple.h" |
| 6694 | 26 | |
| 27 | #include "internal.h" | |
| 28 | #include "connection.h" | |
| 29 | #include "conversation.h" | |
| 30 | #include "signals.h" | |
| 31 | #include "debug.h" | |
| 32 | #include "value.h" | |
| 33 | #include "core.h" | |
| 34 | ||
| 35 | static GList *tcl_callbacks; | |
| 36 | ||
| 37 | static void *tcl_signal_callback(va_list args, struct tcl_signal_handler *handler); | |
|
12397
aa64ec827fdf
[gaim-migrate @ 14704]
Richard Laager <rlaager@pidgin.im>
parents:
10625
diff
changeset
|
38 | static Tcl_Obj *new_cb_namespace (void); |
| 6694 | 39 | |
| 40 | void tcl_signal_init() | |
| 41 | { | |
| 42 | tcl_callbacks = NULL; | |
| 43 | } | |
| 44 | ||
| 45 | void tcl_signal_handler_free(struct tcl_signal_handler *handler) | |
| 46 | { | |
| 47 | if (handler == NULL) | |
| 48 | return; | |
| 49 | ||
| 10597 | 50 | Tcl_DecrRefCount(handler->signal); |
| 13812 | 51 | if (handler->namespace) |
|
17463
5be75bf3b58b
Another change from o_sukhodolsky
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
52 | { |
| 13812 | 53 | Tcl_DecrRefCount(handler->namespace); |
|
17463
5be75bf3b58b
Another change from o_sukhodolsky
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
54 | } |
| 6694 | 55 | g_free(handler); |
| 56 | } | |
| 57 | ||
| 58 | void tcl_signal_cleanup(Tcl_Interp *interp) | |
| 59 | { | |
| 60 | GList *cur; | |
| 61 | struct tcl_signal_handler *handler; | |
| 62 | ||
| 63 | for (cur = tcl_callbacks; cur != NULL; cur = g_list_next(cur)) { | |
| 64 | handler = cur->data; | |
| 65 | if (handler->interp == interp) { | |
| 66 | tcl_signal_handler_free(handler); | |
| 67 | cur->data = NULL; | |
| 68 | } | |
| 69 | } | |
| 70 | tcl_callbacks = g_list_remove_all(tcl_callbacks, NULL); | |
| 71 | } | |
| 72 | ||
| 73 | gboolean tcl_signal_connect(struct tcl_signal_handler *handler) | |
| 74 | { | |
| 10597 | 75 | GString *proc; |
| 76 | ||
| 15884 | 77 | purple_signal_get_values(handler->instance, |
| 10597 | 78 | Tcl_GetString(handler->signal), |
| 79 | &handler->returntype, &handler->nargs, | |
| 80 | &handler->argtypes); | |
| 6694 | 81 | |
| 10597 | 82 | tcl_signal_disconnect(handler->interp, Tcl_GetString(handler->signal), |
| 83 | handler->interp); | |
| 84 | ||
| 15884 | 85 | if (!purple_signal_connect_vargs(handler->instance, |
| 10597 | 86 | Tcl_GetString(handler->signal), |
| 87 | (void *)handler->interp, | |
| 15884 | 88 | PURPLE_CALLBACK(tcl_signal_callback), |
| 10597 | 89 | (void *)handler)) |
| 6694 | 90 | return FALSE; |
| 91 | ||
| 10597 | 92 | handler->namespace = new_cb_namespace (); |
| 93 | Tcl_IncrRefCount(handler->namespace); | |
| 94 | proc = g_string_new(""); | |
| 95 | g_string_append_printf(proc, "namespace eval %s { proc cb { %s } { %s } }", | |
| 96 | Tcl_GetString(handler->namespace), | |
| 97 | Tcl_GetString(handler->args), | |
| 98 | Tcl_GetString(handler->proc)); | |
| 99 | if (Tcl_Eval(handler->interp, proc->str) != TCL_OK) { | |
| 100 | Tcl_DecrRefCount(handler->namespace); | |
| 101 | g_string_free(proc, TRUE); | |
| 6694 | 102 | return FALSE; |
| 10597 | 103 | } |
| 104 | g_string_free(proc, TRUE); | |
| 6694 | 105 | |
| 106 | tcl_callbacks = g_list_append(tcl_callbacks, (gpointer)handler); | |
| 107 | ||
| 108 | return TRUE; | |
| 109 | } | |
| 110 | ||
| 111 | void tcl_signal_disconnect(void *instance, const char *signal, Tcl_Interp *interp) | |
| 112 | { | |
| 113 | GList *cur; | |
| 114 | struct tcl_signal_handler *handler; | |
| 115 | gboolean found = FALSE; | |
| 10597 | 116 | GString *cmd; |
| 6694 | 117 | |
| 118 | for (cur = tcl_callbacks; cur != NULL; cur = g_list_next(cur)) { | |
| 119 | handler = cur->data; | |
| 120 | if (handler->interp == interp && handler->instance == instance | |
| 10597 | 121 | && !strcmp(signal, Tcl_GetString(handler->signal))) { |
| 15884 | 122 | purple_signal_disconnect(instance, signal, handler->interp, |
| 123 | PURPLE_CALLBACK(tcl_signal_callback)); | |
| 10597 | 124 | cmd = g_string_sized_new(64); |
| 125 | g_string_printf(cmd, "namespace delete %s", | |
| 126 | Tcl_GetString(handler->namespace)); | |
| 127 | Tcl_EvalEx(interp, cmd->str, -1, TCL_EVAL_GLOBAL); | |
| 6694 | 128 | tcl_signal_handler_free(handler); |
| 10597 | 129 | g_string_free(cmd, TRUE); |
| 6694 | 130 | cur->data = NULL; |
| 131 | found = TRUE; | |
| 132 | break; | |
| 133 | } | |
| 134 | } | |
| 135 | if (found) | |
| 136 | tcl_callbacks = g_list_remove_all(tcl_callbacks, NULL); | |
| 137 | } | |
| 138 | ||
| 15884 | 139 | static PurpleStringref *ref_type(PurpleSubType type) |
| 13817 | 140 | { |
| 141 | switch (type) { | |
| 15884 | 142 | case PURPLE_SUBTYPE_ACCOUNT: |
| 143 | return PurpleTclRefAccount; | |
| 144 | case PURPLE_SUBTYPE_CONNECTION: | |
| 145 | return PurpleTclRefConnection; | |
| 146 | case PURPLE_SUBTYPE_CONVERSATION: | |
| 147 | return PurpleTclRefConversation; | |
| 148 | case PURPLE_SUBTYPE_PLUGIN: | |
| 149 | return PurpleTclRefPlugin; | |
| 150 | case PURPLE_SUBTYPE_STATUS: | |
| 151 | return PurpleTclRefStatus; | |
| 152 | case PURPLE_SUBTYPE_XFER: | |
| 153 | return PurpleTclRefXfer; | |
| 13817 | 154 | default: |
| 155 | return NULL; | |
| 156 | } | |
| 157 | } | |
| 158 | ||
| 6694 | 159 | static void *tcl_signal_callback(va_list args, struct tcl_signal_handler *handler) |
| 160 | { | |
| 10597 | 161 | GString *name, *val; |
| 15884 | 162 | PurpleBlistNode *node; |
| 6694 | 163 | int error, i; |
| 164 | void *retval = NULL; | |
| 10597 | 165 | Tcl_Obj *cmd, *arg, *result; |
| 166 | void **vals; /* Used for inout parameters */ | |
| 167 | char ***strs; | |
| 6694 | 168 | |
| 10597 | 169 | vals = g_new0(void *, handler->nargs); |
| 170 | strs = g_new0(char **, handler->nargs); | |
| 171 | name = g_string_sized_new(32); | |
| 6694 | 172 | val = g_string_sized_new(32); |
| 10597 | 173 | |
| 174 | cmd = Tcl_NewListObj(0, NULL); | |
| 175 | Tcl_IncrRefCount(cmd); | |
| 176 | ||
| 177 | arg = Tcl_DuplicateObj(handler->namespace); | |
| 178 | Tcl_AppendStringsToObj(arg, "::cb", NULL); | |
| 179 | Tcl_ListObjAppendElement(handler->interp, cmd, arg); | |
| 6694 | 180 | |
| 181 | for (i = 0; i < handler->nargs; i++) { | |
| 15884 | 182 | if (purple_value_is_outgoing(handler->argtypes[i])) |
| 10597 | 183 | g_string_printf(name, "%s::arg%d", |
| 184 | Tcl_GetString(handler->namespace), i); | |
| 6694 | 185 | |
| 15884 | 186 | switch(purple_value_get_type(handler->argtypes[i])) { |
| 187 | case PURPLE_TYPE_UNKNOWN: /* What? I guess just pass the word ... */ | |
| 6694 | 188 | /* treat this as a pointer, but complain first */ |
| 15884 | 189 | purple_debug(PURPLE_DEBUG_ERROR, "tcl", "unknown PurpleValue type %d\n", |
| 190 | purple_value_get_type(handler->argtypes[i])); | |
| 191 | case PURPLE_TYPE_POINTER: | |
| 192 | case PURPLE_TYPE_OBJECT: | |
| 193 | case PURPLE_TYPE_BOXED: | |
| 6694 | 194 | /* These are all "pointer" types to us */ |
| 15884 | 195 | if (purple_value_is_outgoing(handler->argtypes[i])) |
| 196 | purple_debug_error("tcl", "pointer types do not currently support outgoing arguments\n"); | |
| 197 | arg = purple_tcl_ref_new(PurpleTclRefPointer, va_arg(args, void *)); | |
| 6694 | 198 | break; |
| 15884 | 199 | case PURPLE_TYPE_BOOLEAN: |
| 200 | if (purple_value_is_outgoing(handler->argtypes[i])) { | |
| 10597 | 201 | vals[i] = va_arg(args, gboolean *); |
| 202 | Tcl_LinkVar(handler->interp, name->str, | |
| 203 | (char *)&vals[i], TCL_LINK_BOOLEAN); | |
| 204 | arg = Tcl_NewStringObj(name->str, -1); | |
| 6694 | 205 | } else { |
| 10597 | 206 | arg = Tcl_NewBooleanObj(va_arg(args, gboolean)); |
| 6694 | 207 | } |
| 208 | break; | |
| 15884 | 209 | case PURPLE_TYPE_CHAR: |
| 210 | case PURPLE_TYPE_UCHAR: | |
| 211 | case PURPLE_TYPE_SHORT: | |
| 212 | case PURPLE_TYPE_USHORT: | |
| 213 | case PURPLE_TYPE_INT: | |
| 214 | case PURPLE_TYPE_UINT: | |
| 215 | case PURPLE_TYPE_LONG: | |
| 216 | case PURPLE_TYPE_ULONG: | |
| 217 | case PURPLE_TYPE_ENUM: | |
| 6694 | 218 | /* I should really cast these individually to |
| 219 | * preserve as much information as possible ... | |
| 220 | * but heh */ | |
| 15884 | 221 | if (purple_value_is_outgoing(handler->argtypes[i])) { |
| 10597 | 222 | vals[i] = va_arg(args, int *); |
| 223 | Tcl_LinkVar(handler->interp, name->str, | |
| 224 | vals[i], TCL_LINK_INT); | |
| 225 | arg = Tcl_NewStringObj(name->str, -1); | |
| 6694 | 226 | } else { |
| 10597 | 227 | arg = Tcl_NewIntObj(va_arg(args, int)); |
| 228 | } | |
| 14515 | 229 | break; |
| 15884 | 230 | case PURPLE_TYPE_INT64: |
| 231 | case PURPLE_TYPE_UINT64: | |
| 10625 | 232 | /* Tcl < 8.4 doesn't have wide ints, so we have ugly |
| 233 | * ifdefs in here */ | |
| 15884 | 234 | if (purple_value_is_outgoing(handler->argtypes[i])) { |
| 10625 | 235 | vals[i] = (void *)va_arg(args, gint64 *); |
| 236 | #if (TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 4) | |
| 10597 | 237 | Tcl_LinkVar(handler->interp, name->str, |
| 238 | vals[i], TCL_LINK_WIDE_INT); | |
| 10625 | 239 | #else |
| 240 | /* This is going to cause weirdness at best, | |
| 241 | * but what do you want ... we're losing | |
| 242 | * precision */ | |
| 243 | Tcl_LinkVar(handler->interp, name->str, | |
| 244 | vals[i], TCL_LINK_INT); | |
| 245 | #endif /* Tcl >= 8.4 */ | |
| 10597 | 246 | arg = Tcl_NewStringObj(name->str, -1); |
| 247 | } else { | |
| 10625 | 248 | #if (TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 4) |
| 249 | arg = Tcl_NewWideIntObj(va_arg(args, gint64)); | |
| 250 | #else | |
| 251 | arg = Tcl_NewIntObj((int)va_arg(args, int)); | |
| 252 | #endif /* Tcl >= 8.4 */ | |
| 6694 | 253 | } |
| 254 | break; | |
| 15884 | 255 | case PURPLE_TYPE_STRING: |
| 256 | if (purple_value_is_outgoing(handler->argtypes[i])) { | |
| 10597 | 257 | strs[i] = va_arg(args, char **); |
| 258 | if (strs[i] == NULL || *strs[i] == NULL) { | |
| 259 | vals[i] = ckalloc(1); | |
| 260 | *(char *)vals[i] = '\0'; | |
| 6694 | 261 | } else { |
| 10597 | 262 | vals[i] = ckalloc(strlen(*strs[i]) + 1); |
| 263 | strcpy(vals[i], *strs[i]); | |
| 6694 | 264 | } |
| 10597 | 265 | Tcl_LinkVar(handler->interp, name->str, |
| 266 | (char *)&vals[i], TCL_LINK_STRING); | |
| 267 | arg = Tcl_NewStringObj(name->str, -1); | |
| 6694 | 268 | } else { |
| 10597 | 269 | arg = Tcl_NewStringObj(va_arg(args, char *), -1); |
| 6694 | 270 | } |
| 271 | break; | |
| 15884 | 272 | case PURPLE_TYPE_SUBTYPE: |
| 273 | switch (purple_value_get_subtype(handler->argtypes[i])) { | |
| 274 | case PURPLE_SUBTYPE_UNKNOWN: | |
| 275 | purple_debug(PURPLE_DEBUG_ERROR, "tcl", "subtype unknown\n"); | |
| 276 | case PURPLE_SUBTYPE_ACCOUNT: | |
| 277 | case PURPLE_SUBTYPE_CONNECTION: | |
| 278 | case PURPLE_SUBTYPE_CONVERSATION: | |
| 279 | case PURPLE_SUBTYPE_STATUS: | |
| 280 | case PURPLE_SUBTYPE_PLUGIN: | |
| 281 | case PURPLE_SUBTYPE_XFER: | |
| 282 | if (purple_value_is_outgoing(handler->argtypes[i])) | |
| 283 | purple_debug_error("tcl", "pointer subtypes do not currently support outgoing arguments\n"); | |
| 284 | arg = purple_tcl_ref_new(ref_type(purple_value_get_subtype(handler->argtypes[i])), va_arg(args, void *)); | |
| 13812 | 285 | break; |
| 15884 | 286 | case PURPLE_SUBTYPE_BLIST: |
| 287 | case PURPLE_SUBTYPE_BLIST_BUDDY: | |
| 288 | case PURPLE_SUBTYPE_BLIST_GROUP: | |
| 289 | case PURPLE_SUBTYPE_BLIST_CHAT: | |
| 6694 | 290 | /* We're going to switch again for code-deduping */ |
| 15884 | 291 | if (purple_value_is_outgoing(handler->argtypes[i])) |
| 292 | node = *va_arg(args, PurpleBlistNode **); | |
| 6694 | 293 | else |
| 15884 | 294 | node = va_arg(args, PurpleBlistNode *); |
|
24556
8c9cf439084a
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
295 | switch (purple_blist_node_get_type(node)) { |
| 15884 | 296 | case PURPLE_BLIST_GROUP_NODE: |
| 13812 | 297 | arg = Tcl_NewListObj(0, NULL); |
| 298 | Tcl_ListObjAppendElement(handler->interp, arg, | |
| 299 | Tcl_NewStringObj("group", -1)); | |
| 300 | Tcl_ListObjAppendElement(handler->interp, arg, | |
|
24556
8c9cf439084a
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
301 | Tcl_NewStringObj(purple_group_get_name((PurpleGroup *)node), -1)); |
| 6694 | 302 | break; |
| 15884 | 303 | case PURPLE_BLIST_CONTACT_NODE: |
|
6735
a8c70aeddbe7
[gaim-migrate @ 7267]
Mark Doliner <markdoliner@pidgin.im>
parents:
6700
diff
changeset
|
304 | /* g_string_printf(val, "contact {%s}", Contact Name? ); */ |
| 13812 | 305 | arg = Tcl_NewStringObj("contact", -1); |
|
6735
a8c70aeddbe7
[gaim-migrate @ 7267]
Mark Doliner <markdoliner@pidgin.im>
parents:
6700
diff
changeset
|
306 | break; |
| 15884 | 307 | case PURPLE_BLIST_BUDDY_NODE: |
| 13812 | 308 | arg = Tcl_NewListObj(0, NULL); |
| 309 | Tcl_ListObjAppendElement(handler->interp, arg, | |
| 310 | Tcl_NewStringObj("buddy", -1)); | |
| 311 | Tcl_ListObjAppendElement(handler->interp, arg, | |
|
24556
8c9cf439084a
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
312 | Tcl_NewStringObj(purple_buddy_get_name((PurpleBuddy *)node), -1)); |
| 13812 | 313 | Tcl_ListObjAppendElement(handler->interp, arg, |
| 15884 | 314 | purple_tcl_ref_new(PurpleTclRefAccount, |
|
24556
8c9cf439084a
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
315 | purple_buddy_get_account((PurpleBuddy *)node))); |
| 6694 | 316 | break; |
| 15884 | 317 | case PURPLE_BLIST_CHAT_NODE: |
| 13812 | 318 | arg = Tcl_NewListObj(0, NULL); |
| 319 | Tcl_ListObjAppendElement(handler->interp, arg, | |
| 320 | Tcl_NewStringObj("chat", -1)); | |
| 321 | Tcl_ListObjAppendElement(handler->interp, arg, | |
|
24556
8c9cf439084a
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
322 | Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1)); |
| 13812 | 323 | Tcl_ListObjAppendElement(handler->interp, arg, |
| 15884 | 324 | purple_tcl_ref_new(PurpleTclRefAccount, |
|
24556
8c9cf439084a
Fix Tcl to compile with the hidden structs.
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
325 | purple_chat_get_account((PurpleChat *)node))); |
| 6694 | 326 | break; |
| 15884 | 327 | case PURPLE_BLIST_OTHER_NODE: |
| 13812 | 328 | arg = Tcl_NewStringObj("other", -1); |
| 6694 | 329 | break; |
| 330 | } | |
| 331 | break; | |
| 332 | } | |
| 333 | } | |
| 10597 | 334 | Tcl_ListObjAppendElement(handler->interp, cmd, arg); |
| 6694 | 335 | } |
| 336 | ||
| 337 | /* Call the friggin' procedure already */ | |
| 10597 | 338 | if ((error = Tcl_EvalObjEx(handler->interp, cmd, TCL_EVAL_GLOBAL)) != TCL_OK) { |
| 15884 | 339 | purple_debug(PURPLE_DEBUG_ERROR, "tcl", "error evaluating callback: %s\n", |
| 6694 | 340 | Tcl_GetString(Tcl_GetObjResult(handler->interp))); |
| 341 | } else { | |
| 342 | result = Tcl_GetObjResult(handler->interp); | |
| 343 | /* handle return values -- strings and words only */ | |
| 344 | if (handler->returntype) { | |
| 15884 | 345 | if (purple_value_get_type(handler->returntype) == PURPLE_TYPE_STRING) { |
| 6694 | 346 | retval = (void *)g_strdup(Tcl_GetString(result)); |
| 347 | } else { | |
| 348 | if ((error = Tcl_GetIntFromObj(handler->interp, result, (int *)&retval)) != TCL_OK) { | |
| 15884 | 349 | purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Error retrieving procedure result: %s\n", |
| 6694 | 350 | Tcl_GetString(Tcl_GetObjResult(handler->interp))); |
| 351 | retval = NULL; | |
| 352 | } | |
| 353 | } | |
| 354 | } | |
| 355 | } | |
| 356 | ||
| 357 | /* And finally clean up */ | |
| 358 | for (i = 0; i < handler->nargs; i++) { | |
| 10597 | 359 | g_string_printf(name, "%s::arg%d", |
| 360 | Tcl_GetString(handler->namespace), i); | |
| 15884 | 361 | if (purple_value_is_outgoing(handler->argtypes[i]) |
| 362 | && purple_value_get_type(handler->argtypes[i]) != PURPLE_TYPE_SUBTYPE) | |
| 10597 | 363 | Tcl_UnlinkVar(handler->interp, name->str); |
| 13812 | 364 | |
| 10597 | 365 | /* We basically only have to deal with strings on the |
| 366 | * way out */ | |
| 15884 | 367 | switch (purple_value_get_type(handler->argtypes[i])) { |
| 368 | case PURPLE_TYPE_STRING: | |
| 369 | if (purple_value_is_outgoing(handler->argtypes[i])) { | |
| 10597 | 370 | if (vals[i] != NULL && *(char **)vals[i] != NULL) { |
| 371 | g_free(*strs[i]); | |
| 372 | *strs[i] = g_strdup(vals[i]); | |
| 6694 | 373 | } |
| 10597 | 374 | ckfree(vals[i]); |
| 6694 | 375 | } |
| 376 | break; | |
| 377 | default: | |
| 378 | /* nothing */ | |
| 379 | ; | |
| 380 | } | |
| 381 | } | |
| 382 | ||
| 383 | g_string_free(name, TRUE); | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
7118
diff
changeset
|
384 | g_string_free(val, TRUE); |
| 10597 | 385 | g_free(vals); |
| 386 | g_free(strs); | |
| 6694 | 387 | |
| 388 | return retval; | |
| 389 | } | |
| 10597 | 390 | |
| 391 | static Tcl_Obj *new_cb_namespace () | |
| 392 | { | |
| 393 | static int cbnum; | |
| 394 | char name[32]; | |
| 395 | ||
| 15884 | 396 | g_snprintf (name, sizeof(name), "::purple::_callback::cb_%d", cbnum++); |
| 10597 | 397 | return Tcl_NewStringObj (name, -1); |
| 398 | } |