Mercurial > pidgin
comparison src/module.c @ 2511:a83b4a5ffcd6
[gaim-migrate @ 2524]
malsyned's patch for args in perl.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Mon, 15 Oct 2001 19:52:44 +0000 |
| parents | 2c1950c5544a |
| children | b0c5770156e1 |
comparison
equal
deleted
inserted
replaced
| 2510:1950afffd107 | 2511:a83b4a5ffcd6 |
|---|---|
| 173 } | 173 } |
| 174 | 174 |
| 175 void gaim_plugin_unload(GModule *handle) | 175 void gaim_plugin_unload(GModule *handle) |
| 176 { | 176 { |
| 177 GList *pl = plugins; | 177 GList *pl = plugins; |
| 178 struct gaim_plugin *p; | 178 struct gaim_plugin *p = NULL; |
| 179 void (*gaim_plugin_remove)(); | 179 void (*gaim_plugin_remove)(); |
| 180 | 180 |
| 181 while (pl) { | 181 while (pl) { |
| 182 p = pl->data; | 182 p = pl->data; |
| 183 if (p->handle == handle) | 183 if (p->handle == handle) |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 #endif /* GAIM_PLUGINS */ | 270 #endif /* GAIM_PLUGINS */ |
| 271 | 271 |
| 272 static char *event_name(enum gaim_event event) | 272 char *event_name(enum gaim_event event) |
| 273 { | 273 { |
| 274 static char buf[128]; | 274 static char buf[128]; |
| 275 switch (event) { | 275 switch (event) { |
| 276 case event_signon: | 276 case event_signon: |
| 277 sprintf(buf, "event_signon"); | 277 sprintf(buf, "event_signon"); |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 | 468 |
| 469 int plugin_event(enum gaim_event event, void *arg1, void *arg2, void *arg3, void *arg4) | 469 int plugin_event(enum gaim_event event, void *arg1, void *arg2, void *arg3, void *arg4) |
| 470 { | 470 { |
| 471 #ifdef USE_PERL | |
| 472 char buf[BUF_LONG]; | |
| 473 #endif | |
| 474 #ifdef GAIM_PLUGINS | 471 #ifdef GAIM_PLUGINS |
| 475 GList *c = callbacks; | 472 GList *c = callbacks; |
| 476 struct gaim_callback *g; | 473 struct gaim_callback *g; |
| 477 #endif | 474 #endif |
| 478 | 475 |
| 485 void (*two)(void *, void *, void *); | 482 void (*two)(void *, void *, void *); |
| 486 void (*three)(void *, void *, void *, void *); | 483 void (*three)(void *, void *, void *, void *); |
| 487 void (*four)(void *, void *, void *, void *, void *); | 484 void (*four)(void *, void *, void *, void *, void *); |
| 488 | 485 |
| 489 g = (struct gaim_callback *)c->data; | 486 g = (struct gaim_callback *)c->data; |
| 490 if (g->event == event && g->function !=NULL) { | 487 if (g->event == event && g->function != NULL) { |
| 491 switch (event) { | 488 switch (event) { |
| 492 | 489 |
| 493 /* no args */ | 490 /* no args */ |
| 494 case event_blist_update: | 491 case event_blist_update: |
| 495 case event_quit: | 492 case event_quit: |
| 551 } | 548 } |
| 552 c = c->next; | 549 c = c->next; |
| 553 } | 550 } |
| 554 #endif /* GAIM_PLUGINS */ | 551 #endif /* GAIM_PLUGINS */ |
| 555 #ifdef USE_PERL | 552 #ifdef USE_PERL |
| 556 switch (event) { | 553 return perl_event(event, arg1, arg2, arg3, arg4); |
| 557 case event_signon: | |
| 558 case event_signoff: | |
| 559 g_snprintf(buf, sizeof buf, "%lu", (unsigned long)arg1); | |
| 560 break; | |
| 561 case event_away: | |
| 562 g_snprintf(buf, sizeof buf, "%lu %s", (unsigned long)arg1, | |
| 563 ((struct gaim_connection *)arg1)->away ? | |
| 564 ((struct gaim_connection *)arg1)->away : ""); | |
| 565 break; | |
| 566 case event_im_recv: | |
| 567 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1, | |
| 568 *(char **)arg2 ? *(char **)arg2 : "(null)", | |
| 569 *(char **)arg3 ? *(char **)arg3 : "(null)"); | |
| 570 break; | |
| 571 case event_im_send: | |
| 572 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1, | |
| 573 (char *)arg2, *(char **)arg3 ? *(char **)arg3 : "(null)"); | |
| 574 break; | |
| 575 case event_buddy_signon: | |
| 576 case event_buddy_signoff: | |
| 577 case event_set_info: | |
| 578 case event_buddy_away: | |
| 579 case event_buddy_back: | |
| 580 case event_buddy_idle: | |
| 581 case event_buddy_unidle: | |
| 582 g_snprintf(buf, sizeof buf, "%lu \"%s\"", (unsigned long)arg1, (char *)arg2); | |
| 583 break; | |
| 584 case event_chat_invited: | |
| 585 g_snprintf(buf, sizeof buf, "%lu \"%s\" \"%s\" %s", (unsigned long)arg1, | |
| 586 (char *)arg2, (char *)arg3, arg4 ? (char *)arg4 : ""); | |
| 587 break; | |
| 588 case event_chat_join: | |
| 589 case event_chat_buddy_join: | |
| 590 case event_chat_buddy_leave: | |
| 591 g_snprintf(buf, sizeof buf, "%lu %d \"%s\"", (unsigned long)arg1, | |
| 592 (int)arg2, (char *)arg3); | |
| 593 break; | |
| 594 case event_chat_leave: | |
| 595 g_snprintf(buf, sizeof buf, "%lu %d", (unsigned long)arg1, (int)arg2); | |
| 596 break; | |
| 597 case event_chat_recv: | |
| 598 g_snprintf(buf, sizeof buf, "%lu %d \"%s\" %s", (unsigned long)arg1, | |
| 599 (int)arg2, (char *)arg3, (char *)arg4 ? (char *)arg4 : "(null)"); | |
| 600 break; | |
| 601 case event_chat_send_invite: | |
| 602 g_snprintf(buf, sizeof buf, "%lu %d \"%s\" %s", (unsigned long)arg1, | |
| 603 (int)arg2, (char *)arg3, *(char **)arg4 ? *(char **)arg4 : "(null)"); | |
| 604 break; | |
| 605 case event_chat_send: | |
| 606 g_snprintf(buf, sizeof buf, "%lu %d %s", (unsigned long)arg1, (int)arg2, | |
| 607 *(char **)arg3 ? *(char **)arg3 : "(null)"); | |
| 608 break; | |
| 609 case event_warned: | |
| 610 g_snprintf(buf, sizeof buf, "%lu \"%s\" %d", (unsigned long)arg1, | |
| 611 arg2 ? (char *)arg2 : "", (int)arg3); | |
| 612 break; | |
| 613 case event_quit: | |
| 614 buf[0] = 0; | |
| 615 break; | |
| 616 case event_new_conversation: | |
| 617 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg1); | |
| 618 break; | |
| 619 case event_im_displayed_sent: | |
| 620 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1, | |
| 621 (char *)arg2, *(char **)arg3 ? *(char **)arg3 : "(null)"); | |
| 622 break; | |
| 623 case event_im_displayed_rcvd: | |
| 624 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1, | |
| 625 (char *)arg2, (char *)arg3 ? (char *)arg3 : "(null)"); | |
| 626 break; | |
| 627 default: | |
| 628 return 0; | |
| 629 } | |
| 630 return perl_event(event_name(event), buf); | |
| 631 #else | 554 #else |
| 632 return 0; | 555 return 0; |
| 633 #endif | 556 #endif |
| 634 } | 557 } |
| 635 | 558 |
