File:  [Coherent Logic Development] / ChivanetAimPidgin / oscarprpl / src / c / init.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Mon Jan 27 19:48:25 2025 UTC (6 months ago) by snw
Branches: MAIN, CoherentLogicDevelopment
CVS tags: test-tag, start, HEAD
Pidgin AIM Plugin for ChivaNet

    1: /*
    2:  *   cmake template for a libpurple plugin
    3:  *   Copyright (C) 2023 Hermann Höhne
    4:  *
    5:  *   This program is free software: you can redistribute it and/or modify
    6:  *   it under the terms of the GNU General Public License as published by
    7:  *   the Free Software Foundation, either version 3 of the License, or
    8:  *   (at your option) any later version.
    9:  *
   10:  *   This program is distributed in the hope that it will be useful,
   11:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
   12:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13:  *   GNU General Public License for more details.
   14:  *
   15:  *   You should have received a copy of the GNU General Public License
   16:  *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
   17:  */
   18: 
   19: #include <purple.h>
   20: 
   21: // for displaying an externally managed version number
   22: #ifndef PLUGIN_VERSION
   23: #error Must set PLUGIN_VERSION in build system
   24: #endif
   25: // https://github.com/LLNL/lbann/issues/117#issuecomment-334333286
   26: #define MAKE_STR(x) _MAKE_STR(x)
   27: #define _MAKE_STR(x) #x
   28: 
   29: static void close(PurpleConnection *pc) {
   30:     // this is an example
   31: }
   32: 
   33: static void login(PurpleAccount *account) {
   34:     // this is an example
   35: }
   36: 
   37: static const char * list_icon(PurpleAccount *account, PurpleBuddy *buddy) {
   38:     return "cmake";
   39: }
   40: 
   41: static GList * status_types(PurpleAccount *account) {
   42:     GList *types = NULL;
   43:     {
   44:         PurpleStatusType * status = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE);
   45:         types = g_list_append(types, status);
   46:     }
   47:     {
   48:         PurpleStatusType * status = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE);
   49:         types = g_list_append(types, status);
   50:     }
   51:     return types;
   52: }
   53: 
   54: static gboolean libpurple2_plugin_load(PurplePlugin *plugin) {
   55:     return TRUE;
   56: }
   57: 
   58: static gboolean libpurple2_plugin_unload(PurplePlugin *plugin) {
   59:     purple_signals_disconnect_by_handle(plugin);
   60:     return TRUE;
   61: }
   62: 
   63: static PurplePluginProtocolInfo prpl_info = {
   64:     .struct_size = sizeof(PurplePluginProtocolInfo), // must be set for PURPLE_PROTOCOL_PLUGIN_HAS_FUNC to work across versions
   65:     .list_icon = list_icon,
   66:     .status_types = status_types, // this actually needs to exist, else the protocol cannot be set to "online"
   67:     .login = login,
   68:     .close = close,
   69: };
   70: 
   71: static void plugin_init(PurplePlugin *plugin) {
   72:     // this is an example
   73: }
   74: 
   75: static PurplePluginInfo info = {
   76:     .magic = PURPLE_PLUGIN_MAGIC,
   77:     .major_version = PURPLE_MAJOR_VERSION,
   78:     .minor_version = PURPLE_MINOR_VERSION,
   79:     .type = PURPLE_PLUGIN_PROTOCOL,
   80:     .priority = PURPLE_PRIORITY_DEFAULT,
   81:     .id = "hehoe-cmake-template",
   82:     .name = "cmake template",
   83:     .version = MAKE_STR(PLUGIN_VERSION),
   84:     .summary = "",
   85:     .description = "",
   86:     .author = "Hermann Hoehne <hoehermann@gmx.de>",
   87:     .homepage = "https://github.com/hoehermann/purple-cmake-template",
   88:     .load = libpurple2_plugin_load,
   89:     .unload = libpurple2_plugin_unload,
   90:     .extra_info = &prpl_info,
   91: };
   92: 
   93: PURPLE_INIT_PLUGIN(cmake, plugin_init, info);

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>