Wed, 05 Nov 2003 06:39:05 +0000
[gaim-migrate @ 8038]
Because all the log reading and writing is abstracted, it makes it real easy
to tell Gaim, "give me entire contents of the last conversation," which is
useful for, say, a history.c plugin. This code is now much simpler, and it
took no time at all to port it.
Sort-by-log will be a bit harder.
And because two people asked me within a minute of me committing it, there
exists an "old log" GaimLogLogger that doesn't write logs, but can list and
read them. So, you'll be able to seamlessly see your old logs along with
your new logs together in the log viewer.
| 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
a7560306d591
[gaim-migrate @ 7603]
Christian Hammond <chipx86@chipx86.com>
parents:
7016
diff
changeset
|
70 | if (ssl_plugin != NULL && |
|
7041
ee872464be64
[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
a7560306d591
[gaim-migrate @ 7603]
Christian Hammond <chipx86@chipx86.com>
parents:
7016
diff
changeset
|
74 | } |
| 7016 | 75 | |
|
7040
a7560306d591
[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) |