Mercurial > pidgin
comparison src/prpl.c @ 4040:89b56ab2b692
[gaim-migrate @ 4248]
faceprint got jabber registration working again :-)
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Tue, 03 Dec 2002 17:50:43 +0000 |
| parents | 9178da61c19f |
| children | 133cf6424c53 |
comparison
equal
deleted
inserted
replaced
| 4039:630826d97d54 | 4040:89b56ab2b692 |
|---|---|
| 754 | 754 |
| 755 GSList *add_smiley(GSList *list, char *key, char **xpm, int show) | 755 GSList *add_smiley(GSList *list, char *key, char **xpm, int show) |
| 756 { | 756 { |
| 757 struct _prpl_smiley *smiley; | 757 struct _prpl_smiley *smiley; |
| 758 | 758 |
| 759 smiley = (struct _prpl_smiley *)g_new0(struct _prpl_smiley, 1); | 759 smiley = (struct _prpl_smiley *)g_new0(struct _prpl_smiley, 1); |
| 760 smiley->key = g_strdup(key); | 760 smiley->key = g_strdup(key); |
| 761 smiley->xpm = xpm; | 761 smiley->xpm = xpm; |
| 762 smiley->show = show; | 762 smiley->show = show; |
| 763 list = g_slist_append(list, smiley); | 763 list = g_slist_append(list, smiley); |
| 764 | 764 |
| 765 return list; | 765 return list; |
| 766 } | 766 } |
| 767 | |
| 768 static gboolean delayed_unload(void *handle) { | |
| 769 g_module_close(handle); | |
| 770 return FALSE; | |
| 771 } | |
| 772 | |
| 773 gboolean ref_protocol(struct prpl *p) { | |
| 774 #ifdef GAIM_PLUGINS | |
| 775 if(p->plug) { /* This protocol is a plugin */ | |
| 776 prpl_accounts[p->protocol]++; | |
| 777 debug_printf("Protocol %s now in use by %d connections.\n", p->name, prpl_accounts[p->protocol]); | |
| 778 if(!p->plug->handle) { /*But the protocol isn't yet loaded */ | |
| 779 unload_protocol(p); | |
| 780 if (load_prpl(p)) | |
| 781 return FALSE; | |
| 782 } | |
| 783 } | |
| 784 #endif /* GAIM_PLUGINS */ | |
| 785 return TRUE; | |
| 786 } | |
| 787 | |
| 788 void unref_protocol(struct prpl *p) { | |
| 789 #ifdef GAIM_PLUGINS | |
| 790 if(p->plug) { /* This protocol is a plugin */ | |
| 791 prpl_accounts[p->protocol]--; | |
| 792 debug_printf("Protocol %s now in use by %d connections.\n", p->name, prpl_accounts[p->protocol]); | |
| 793 if(prpl_accounts[p->protocol] == 0) { /* No longer needed */ | |
| 794 debug_printf("Throwing out %s protocol plugin\n", p->name); | |
| 795 g_timeout_add(0, delayed_unload, p->plug->handle); | |
| 796 p->plug->handle = NULL; | |
| 797 } | |
| 798 } | |
| 799 #endif /* GAIM_PLUGINS */ | |
| 800 } | |
| 801 |
