src/protocols/napster/napster.c

changeset 3572
d07e14aa6f26
parent 3466
db8d35ad8480
child 3584
157e8f037020
equal deleted inserted replaced
3571:406912b64d12 3572:d07e14aa6f26
61 61
62 gchar *email; 62 gchar *email;
63 GSList *channels; 63 GSList *channels;
64 }; 64 };
65 65
66 static char *nap_name()
67 {
68 return "Napster";
69 }
70
71
72 /* FIXME: Make this use va_arg stuff */ 66 /* FIXME: Make this use va_arg stuff */
73 static void nap_write_packet(struct gaim_connection *gc, unsigned short command, const char *message) 67 static void nap_write_packet(struct gaim_connection *gc, unsigned short command, const char *message)
74 { 68 {
75 struct nap_data *ndata = (struct nap_data *)gc->proto_data; 69 struct nap_data *ndata = (struct nap_data *)gc->proto_data;
76 unsigned short size; 70 unsigned short size;
548 nap_write_packet(gc, 0xd0, (char *)buddies->data); 542 nap_write_packet(gc, 0xd0, (char *)buddies->data);
549 buddies = buddies -> next; 543 buddies = buddies -> next;
550 } 544 }
551 } 545 }
552 546
553 547 static char** nap_list_icon(int uc)
554 static GList *nap_user_opts() 548 {
555 { 549 return napster_xpm;
556 GList *m = NULL; 550 }
551
552 static struct prpl *my_protocol = NULL;
553
554 void napster_init(struct prpl *ret)
555 {
557 struct proto_user_opt *puo; 556 struct proto_user_opt *puo;
558 557 ret->add_buddies = nap_add_buddies;
559 puo = g_new0(struct proto_user_opt, 1); 558 ret->remove_buddy = nap_remove_buddy;
560 puo->label = "Server:"; 559 ret->add_permit = NULL;
561 puo->def = NAP_SERVER; 560 ret->rem_permit = NULL;
562 puo->pos = USEROPT_NAPSERVER; 561 ret->add_deny = NULL;
563 m = g_list_append(m, puo); 562 ret->rem_deny = NULL;
564 563 ret->warn = NULL;
565 puo = g_new0(struct proto_user_opt, 1); 564 ret->chat_info = nap_chat_info;
566 puo->label = "Port:"; 565 ret->join_chat = nap_join_chat;
567 puo->def = "8888"; 566 ret->chat_invite = NULL;
568 puo->pos = USEROPT_NAPPORT; 567 ret->chat_leave = nap_chat_leave;
569 m = g_list_append(m, puo); 568 ret->chat_whisper = NULL;
570 569 ret->chat_send = nap_chat_send;
571 return m; 570 ret->keepalive = NULL;
572 }
573
574 static char** nap_list_icon(int uc)
575 {
576 return napster_xpm;
577 }
578
579 static struct prpl *my_protocol = NULL;
580
581 void napster_init(struct prpl *ret)
582 {
583 ret->protocol = PROTO_NAPSTER; 571 ret->protocol = PROTO_NAPSTER;
584 ret->name = nap_name; 572 ret->name = g_strdup("Napster");
585 ret->list_icon = nap_list_icon; 573 ret->list_icon = nap_list_icon;
586 ret->user_opts = nap_user_opts;
587 ret->login = nap_login; 574 ret->login = nap_login;
588 ret->close = nap_close; 575 ret->close = nap_close;
589 ret->send_im = nap_send_im; 576 ret->send_im = nap_send_im;
590 ret->set_info = NULL; 577 ret->set_info = NULL;
591 ret->get_info = NULL; 578 ret->get_info = NULL;
609 ret->chat_leave = nap_chat_leave; 596 ret->chat_leave = nap_chat_leave;
610 ret->chat_whisper = NULL; 597 ret->chat_whisper = NULL;
611 ret->chat_send = nap_chat_send; 598 ret->chat_send = nap_chat_send;
612 ret->keepalive = NULL; 599 ret->keepalive = NULL;
613 600
601 puo = g_new0(struct proto_user_opt, 1);
602 puo->label = g_strdup("Server:");
603 puo->def = g_strdup(NAP_SERVER);
604 puo->pos = USEROPT_NAPSERVER;
605 ret->user_opts = g_list_append(ret->user_opts, puo);
606
607 puo = g_new0(struct proto_user_opt, 1);
608 puo->label = g_strdup("Port:");
609 puo->def = g_strdup("8888");
610 puo->pos = USEROPT_NAPPORT;
611 ret->user_opts = g_list_append(ret->user_opts, puo);
612
614 my_protocol = ret; 613 my_protocol = ret;
615 } 614 }
616 615
617 #ifndef STATIC 616 #ifndef STATIC
618 617
619 char *gaim_plugin_init(GModule * handle) 618 void *gaim_prpl_init(struct prpl *prpl)
620 { 619 {
621 load_protocol(napster_init, sizeof(struct prpl)); 620 napster_init(prpl);
622 return NULL; 621 prpl->plug->desc.api_version = PLUGIN_API_VERSION;
623 } 622 }
624
625 void gaim_plugin_remove()
626 {
627 struct prpl *p = find_prpl(PROTO_NAPSTER);
628 if (p == my_protocol)
629 unload_protocol(p);
630 }
631
632 char *name()
633 {
634 return "Napster";
635 }
636
637 char *description()
638 {
639 return PRPL_DESC("Napster");
640 }
641
642 #endif 623 #endif

mercurial