src/perl.c

changeset 2355
3bf7d403faa6
parent 2345
2d59281e13fd
child 2370
722a3374b5cf
equal deleted inserted replaced
2354:6014b42ca202 2355:3bf7d403faa6
58 #undef _ 58 #undef _
59 #ifdef DEBUG 59 #ifdef DEBUG
60 #undef DEBUG 60 #undef DEBUG
61 #endif 61 #endif
62 #include "gaim.h" 62 #include "gaim.h"
63 #include "prpl.h"
63 64
64 struct perlscript { 65 struct perlscript {
65 char *name; 66 char *name;
66 char *version; 67 char *version;
67 char *shutdowncallback; /* bleh */ 68 char *shutdowncallback; /* bleh */
300 } 301 }
301 302
302 XS (XS_GAIM_get_info) 303 XS (XS_GAIM_get_info)
303 { 304 {
304 int i = 0; 305 int i = 0;
305 unsigned int junk;
306 dXSARGS; 306 dXSARGS;
307 items = 0; 307 items = 0;
308 308
309 switch(SvIV(ST(0))) { 309 switch(SvIV(ST(0))) {
310 case 0: 310 case 0:
323 } 323 }
324 } 324 }
325 break; 325 break;
326 case 2: 326 case 2:
327 { 327 {
328 struct gaim_connection *gc = (struct gaim_connection *)SvPV(ST(1), junk); 328 struct gaim_connection *gc = (struct gaim_connection *)SvIV(ST(1));
329 debug_printf("%lu %lu\n", connections->data, gc);
329 if (g_slist_find(connections, gc)) 330 if (g_slist_find(connections, gc))
330 XST_mIV(i++, gc->protocol); 331 XST_mIV(i++, gc->protocol);
331 else 332 else
332 XST_mIV(i++, -1); 333 XST_mIV(i++, -1);
333 } 334 }
334 break; 335 break;
335 case 3: 336 case 3:
336 { 337 {
337 struct gaim_connection *gc = (struct gaim_connection *)SvPV(ST(1), junk); 338 struct gaim_connection *gc = (struct gaim_connection *)SvIV(ST(1));
339 debug_printf("%lu %lu\n", connections->data, gc);
338 if (g_slist_find(connections, gc)) 340 if (g_slist_find(connections, gc))
339 XST_mPV(i++, gc->username); 341 XST_mPV(i++, gc->username);
340 else 342 else
341 XST_mPV(i++, ""); 343 XST_mPV(i++, "");
342 } 344 }
345 break;
343 case 4: 346 case 4:
344 { 347 {
345 struct gaim_connection *gc = (struct gaim_connection *)SvPV(ST(1), junk); 348 struct gaim_connection *gc = (struct gaim_connection *)SvIV(ST(1));
349 debug_printf("%lu %lu\n", connections->data, gc);
346 if (g_slist_find(connections, gc)) 350 if (g_slist_find(connections, gc))
347 XST_mIV(i++, g_list_index(aim_users, gc->user)); 351 XST_mIV(i++, g_list_index(aim_users, gc->user));
348 else 352 else
349 XST_mIV(i++, -1); 353 XST_mIV(i++, -1);
350 } 354 }
365 while (a) { 369 while (a) {
366 struct aim_user *u = a->data; 370 struct aim_user *u = a->data;
367 XST_mIV(i++, u->protocol); 371 XST_mIV(i++, u->protocol);
368 a = a->next; 372 a = a->next;
369 } 373 }
374 }
375 break;
376 case 7:
377 {
378 struct gaim_connection *gc = (struct gaim_connection *)SvIV(ST(1));
379 debug_printf("%lu %lu\n", connections->data, gc);
380 if (g_slist_find(connections, gc))
381 XST_mPV(i++, (*gc->prpl->name)());
382 else
383 XST_mPV(i++, "Unknown");
370 } 384 }
371 break; 385 break;
372 default: 386 default:
373 XST_mPV(0, "Error2"); 387 XST_mPV(0, "Error2");
374 i = 1; 388 i = 1;
480 struct gaim_connection *gc; 494 struct gaim_connection *gc;
481 495
482 while (c) { 496 while (c) {
483 gc = (struct gaim_connection *)c->data; 497 gc = (struct gaim_connection *)c->data;
484 serv_set_idle(gc, SvIV(ST(1))); 498 serv_set_idle(gc, SvIV(ST(1)));
485 gc->is_idle = 1;
486 c = c->next; 499 c = c->next;
487 } 500 }
488 } else if (!strncasecmp(command, "warn", 4)) { 501 } else if (!strncasecmp(command, "warn", 4)) {
489 GSList *c = connections; 502 GSList *c = connections;
490 struct gaim_connection *gc; 503 struct gaim_connection *gc;
685 struct _perl_timeout_handlers *handler; 698 struct _perl_timeout_handlers *handler;
686 dXSARGS; 699 dXSARGS;
687 items = 0; 700 items = 0;
688 701
689 handler = g_new0(struct _perl_timeout_handlers, 1); 702 handler = g_new0(struct _perl_timeout_handlers, 1);
690 timeout = 1000 * atol(SvPV(ST(0), junk)); 703 timeout = 1000 * SvIV(ST(0));
704 debug_printf("Adding timeout for %d seconds.\n", timeout/1000);
691 handler->handler_name = g_strdup(SvPV(ST(1), junk)); 705 handler->handler_name = g_strdup(SvPV(ST(1), junk));
692 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler); 706 perl_timeout_handlers = g_list_append(perl_timeout_handlers, handler);
693 handler->iotag = gtk_timeout_add(timeout, (GtkFunction)perl_timeout, handler); 707 handler->iotag = gtk_timeout_add(timeout, (GtkFunction)perl_timeout, handler);
694 XSRETURN_EMPTY; 708 XSRETURN_EMPTY;
695 } 709 }

mercurial