plugins/perl/perl.c

changeset 5227
6b44f7901f94
parent 5205
242b8aa81328
child 5408
65200df172a8
equal deleted inserted replaced
5226:13c1a4e0ac89 5227:6b44f7901f94
268 /* 268 /*
269 * Check for "die," make sure we have 1 argument, and set our 269 * Check for "die," make sure we have 1 argument, and set our
270 * return value. 270 * return value.
271 */ 271 */
272 if (SvTRUE(ERRSV)) { 272 if (SvTRUE(ERRSV)) {
273 debug_printf("Perl function %s exited abnormally: %s\n", 273 gaim_debug(GAIM_DEBUG_ERROR, "perl",
274 function, SvPV(ERRSV, na)); 274 "Perl function %s exited abnormally: %s\n",
275 function, SvPV(ERRSV, na));
275 POPs; 276 POPs;
276 } 277 }
277 else if (count != 1) { 278 else if (count != 1) {
278 /* 279 /*
279 * This should NEVER happen. G_SCALAR ensures that we WILL 280 * This should NEVER happen. G_SCALAR ensures that we WILL
280 * have 1 parameter. 281 * have 1 parameter.
281 */ 282 */
282 debug_printf("Perl error from %s: expected 1 return value, " 283 gaim_debug(GAIM_DEBUG_ERROR, "perl",
283 "but got %d\n", function, count); 284 "Perl error from %s: expected 1 return value, "
285 "but got %d\n", function, count);
284 } 286 }
285 else 287 else
286 ret_value = POPi; 288 ret_value = POPi;
287 289
288 /* Check for changed arguments */ 290 /* Check for changed arguments */
509 name = SvPV(ST(0), junk); 511 name = SvPV(ST(0), junk);
510 ver = SvPV(ST(1), junk); 512 ver = SvPV(ST(1), junk);
511 callback = SvPV(ST(2), junk); 513 callback = SvPV(ST(2), junk);
512 unused = SvPV(ST(3), junk); 514 unused = SvPV(ST(3), junk);
513 515
514 debug_printf("GAIM::register(%s, %s)\n", name, ver); 516 gaim_debug(GAIM_DEBUG_INFO, "perl",
517 "GAIM::register(%s, %s)\n", name, ver);
515 518
516 for (pl = gaim_plugins_get_all(); pl != NULL; pl = pl->next) { 519 for (pl = gaim_plugins_get_all(); pl != NULL; pl = pl->next) {
517 plug = pl->data; 520 plug = pl->data;
518
519 debug_printf("** Comparing '%s' to '%s' and '%s' to '%s'\n",
520 name, plug->info->name, ver,
521 plug->info->version);
522 521
523 if (!strcmp(name, plug->info->name) && 522 if (!strcmp(name, plug->info->name) &&
524 !strcmp(ver, plug->info->version)) { 523 !strcmp(ver, plug->info->version)) {
525 524
526 break; 525 break;
1048 break; 1047 break;
1049 case event_draw_menu: 1048 case event_draw_menu:
1050 /* we can't handle this usefully without gtk/perl bindings */ 1049 /* we can't handle this usefully without gtk/perl bindings */
1051 return 0; 1050 return 0;
1052 default: 1051 default:
1053 debug_printf("someone forgot to handle %s in the perl binding\n", 1052 gaim_debug(GAIM_DEBUG_WARNING, "perl",
1054 gaim_event_get_name(event)); 1053 "Someone forgot to handle %s in the perl binding\n",
1054 gaim_event_get_name(event));
1055 return 0; 1055 return 0;
1056 } 1056 }
1057 1057
1058 /* Call any applicable functions */ 1058 /* Call any applicable functions */
1059 for (handler = perl_event_handlers; 1059 for (handler = perl_event_handlers;
1147 handler = g_new0(struct _perl_event_handlers, 1); 1147 handler = g_new0(struct _perl_event_handlers, 1);
1148 handler->event_type = g_strdup(SvPV(ST(1), junk)); 1148 handler->event_type = g_strdup(SvPV(ST(1), junk));
1149 handler->handler_name = g_strdup(SvPV(ST(2), junk)); 1149 handler->handler_name = g_strdup(SvPV(ST(2), junk));
1150 handler->plug = plug; 1150 handler->plug = plug;
1151 perl_event_handlers = g_list_append(perl_event_handlers, handler); 1151 perl_event_handlers = g_list_append(perl_event_handlers, handler);
1152 debug_printf("registered perl event handler for %s\n", handler->event_type); 1152 gaim_debug(GAIM_DEBUG_INFO, "perl",
1153 "Registered perl event handler for %s\n",
1154 handler->event_type);
1153 } else { 1155 } else {
1154 debug_printf("Invalid handle (%s) registering perl event handler\n", handle); 1156 gaim_debug(GAIM_DEBUG_ERROR, "perl",
1157 "Invalid handle (%s) registering perl event handler\n",
1158 handle);
1155 } 1159 }
1156 1160
1157 XSRETURN_EMPTY; 1161 XSRETURN_EMPTY;
1158 } 1162 }
1159 1163
1221 } 1225 }
1222 1226
1223 if (p) { 1227 if (p) {
1224 handler = g_new0(struct _perl_timeout_handlers, 1); 1228 handler = g_new0(struct _perl_timeout_handlers, 1);
1225 timeout = 1000 * SvIV(ST(1)); 1229 timeout = 1000 * SvIV(ST(1));
1226 debug_printf("Adding timeout for %ld seconds.\n", timeout/1000); 1230 gaim_debug(GAIM_DEBUG_INFO, "perl",
1231 "Adding timeout for %ld seconds.\n", timeout/1000);
1227 handler->plug = plug; 1232 handler->plug = plug;
1228 handler->handler_name = g_strdup(SvPV(ST(2), junk)); 1233 handler->handler_name = g_strdup(SvPV(ST(2), junk));
1229 handler->handler_args = g_strdup(SvPV(ST(3), junk)); 1234 handler->handler_args = g_strdup(SvPV(ST(3), junk));
1230 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler); 1235 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler);
1231 handler->iotag = g_timeout_add(timeout, perl_timeout, handler); 1236 handler->iotag = g_timeout_add(timeout, perl_timeout, handler);
1232 } else { 1237 } else {
1233 debug_printf("Invalid handle (%s) in adding perl timeout handler.", handle); 1238 gaim_debug(GAIM_DEBUG_ERROR, "perl",
1239 "Invalid handle (%s) in adding perl timeout handler.",
1240 handle);
1234 } 1241 }
1235 XSRETURN_EMPTY; 1242 XSRETURN_EMPTY;
1236 } 1243 }
1237 1244
1238 XS (XS_GAIM_play_sound) 1245 XS (XS_GAIM_play_sound)

mercurial