Mercurial > pidgin
annotate plugins/ssl/ssl.c @ 7863:6ee2fe9bb74e
[gaim-migrate @ 8517]
"Patch 2: ssl-plugins.patch
Other plugins might need to use the NSS/GNUTLS libraries,
which shouldn't be initialized multiple times in the same
thread (at least NSS says this is a bad thing to do).
This patch
enables other plugins to load either the NSS or
GNUTLS plugin,
and
a) have them init on load, rather when sslconn inits them
b) have them not stomp on each other if the other one has
already loaded." --Bill Tompkins (obobo)
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Sun, 14 Dec 2003 16:46:28 +0000 |
| parents | a671a28bc50b |
| children | d7b8eb1f0a18 |
| rev | line source |
|---|---|
| 7016 | 1 /** |
| 2 * @file ssl.c Main SSL plugin | |
| 3 * | |
| 4 * gaim | |
| 5 * | |
| 6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
| 7 * | |
| 8 * This program is free software; you can redistribute it and/or modify | |
| 9 * it under the terms of the GNU General Public License as published by | |
| 10 * the Free Software Foundation; either version 2 of the License, or | |
| 11 * (at your option) any later version. | |
| 12 * | |
| 13 * This program is distributed in the hope that it will be useful, | |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 * GNU General Public License for more details. | |
| 17 * | |
| 18 * You should have received a copy of the GNU General Public License | |
| 19 * along with this program; if not, write to the Free Software | |
| 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 */ | |
| 22 #include "internal.h" | |
| 23 #include "debug.h" | |
| 24 #include "plugin.h" | |
| 25 #include "sslconn.h" | |
| 26 | |
| 27 #define SSL_PLUGIN_ID "core-ssl" | |
| 28 | |
| 29 static GaimPlugin *ssl_plugin = NULL; | |
| 30 | |
| 31 static gboolean | |
| 32 probe_ssl_plugins(GaimPlugin *my_plugin) | |
| 33 { | |
| 34 GaimPlugin *plugin; | |
| 35 GList *l; | |
| 36 | |
| 37 ssl_plugin = NULL; | |
| 38 | |
| 39 for (l = gaim_plugins_get_all(); l != NULL; l = l->next) | |
| 40 { | |
| 41 plugin = (GaimPlugin *)l->data; | |
| 42 | |
| 43 if (plugin == my_plugin) | |
| 44 continue; | |
| 45 | |
| 46 if (plugin->info != NULL && plugin->info->id != NULL && | |
| 47 strncmp(plugin->info->id, "ssl-", 4) == 0) | |
| 48 { | |
| 49 if (gaim_plugin_is_loaded(plugin) || gaim_plugin_load(plugin)) | |
| 50 { | |
| 51 ssl_plugin = plugin; | |
| 52 | |
| 53 break; | |
| 54 } | |
| 55 } | |
| 56 } | |
| 57 | |
| 58 return (ssl_plugin != NULL); | |
| 59 } | |
| 60 | |
| 61 static gboolean | |
| 62 plugin_load(GaimPlugin *plugin) | |
| 63 { | |
| 64 return probe_ssl_plugins(plugin); | |
| 65 } | |
| 66 | |
| 67 static gboolean | |
| 68 plugin_unload(GaimPlugin *plugin) | |
| 69 { | |
|
7040
ccadd1da839b
[gaim-migrate @ 7603]
Christian Hammond <chipx86@chipx86.com>
parents:
7016
diff
changeset
|
70 if (ssl_plugin != NULL && |
|
7041
a671a28bc50b
[gaim-migrate @ 7604]
Christian Hammond <chipx86@chipx86.com>
parents:
7040
diff
changeset
|
71 g_list_find(gaim_plugins_get_loaded(), ssl_plugin) != NULL) |
| 7016 | 72 { |
| 73 gaim_plugin_unload(ssl_plugin); | |
|
7040
ccadd1da839b
[gaim-migrate @ 7603]
Christian Hammond <chipx86@chipx86.com>
parents:
7016
diff
changeset
|
74 } |
| 7016 | 75 |
|
7040
ccadd1da839b
[gaim-migrate @ 7603]
Christian Hammond <chipx86@chipx86.com>
parents:
7016
diff
changeset
|
76 ssl_plugin = NULL; |
| 7016 | 77 |
| 78 return TRUE; | |
| 79 } | |
| 80 | |
| 81 static GaimPluginInfo info = | |
| 82 { | |
| 83 2, /**< api_version */ | |
| 84 GAIM_PLUGIN_STANDARD, /**< type */ | |
| 85 NULL, /**< ui_requirement */ | |
| 86 GAIM_PLUGIN_FLAG_INVISIBLE, /**< flags */ | |
| 87 NULL, /**< dependencies */ | |
| 88 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 89 | |
| 90 SSL_PLUGIN_ID, /**< id */ | |
| 91 N_("SSL"), /**< name */ | |
| 92 VERSION, /**< version */ | |
| 93 /** summary */ | |
| 94 N_("Provides a wrapper around SSL support libraries."), | |
| 95 /** description */ | |
| 96 N_("Provides a wrapper around SSL support libraries."), | |
| 97 "Christian Hammond <chipx86@gnupdate.org>", | |
| 98 GAIM_WEBSITE, /**< homepage */ | |
| 99 | |
| 100 plugin_load, /**< load */ | |
| 101 plugin_unload, /**< unload */ | |
| 102 NULL, /**< destroy */ | |
| 103 | |
| 104 NULL, /**< ui_info */ | |
| 105 NULL /**< extra_info */ | |
| 106 }; | |
| 107 | |
| 108 static void | |
| 109 init_plugin(GaimPlugin *plugin) | |
| 110 { | |
| 111 } | |
| 112 | |
| 113 GAIM_INIT_PLUGIN(ssl, init_plugin, info) |
