grim/purple-spasm

rename all purple_spasm_* function to just spasm_* functions (some other cleanups too)
/*
* PurpleSpasm - A Twitch Protocol Plugin
* Copyright (C) 2017-2019 Gary Kramlich <grim@reaperworld.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <glib.h>
#include <purple.h>
#include "spasm-account.h"
#include "spasm-const.h"
#include "spasm-protocol.h"
/******************************************************************************
* Globals
*****************************************************************************/
static PurpleProtocol *spasm = NULL;
/******************************************************************************
* Implementations
*****************************************************************************/
/******************************************************************************
* Plugin Stuff
*****************************************************************************/
#if 0
static PurplePluginProtocolInfo prpl_info = {
.struct_size = sizeof(PurplePluginProtocolInfo),
.options = OPT_PROTO_NO_PASSWORD,
.login = purple_spasm_account_login,
.close = _purple_spasm_close,
.list_icon = _purple_spasm_list_icon,
.status_types = _purple_spasm_get_status_types,
.set_status = _purple_spasm_set_status,
// chat stuff
.chat_info = purple_spasm_chat_service_info,
.chat_info_defaults = purple_spasm_chat_service_info_default,
.join_chat = purple_spasm_chat_service_join,
.get_chat_name = purple_spasm_chat_service_name,
.chat_leave = purple_spasm_chat_service_leave,
.chat_send = purple_spasm_chat_service_send,
.set_chat_topic = purple_spasm_chat_service_set_topic,
};
#endif
/******************************************************************************
* GPlugin Interface
*****************************************************************************/
G_MODULE_EXPORT GPluginPluginInfo *
gplugin_query(GError **error) {
const gchar * const authors [] = { "Gary Kramlich <grim@reaperworld.com>", NULL };
return GPLUGIN_PLUGIN_INFO(purple_plugin_info_new(
"id", SPASM_PLUGIN_ID,
"name", "Twitch",
"version", PLUGIN_VERSION,
"abi-version", PURPLE_ABI_VERSION,
"flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL | PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD,
"summary", "Twitch.tv Protocol Plugin",
"description", "Implements the Twitch.tv chat protocol",
"authors", authors,
"website", "https://bitbucket.org/rw_grim/purple-spasm",
NULL
));
}
G_MODULE_EXPORT gboolean
gplugin_load(GPluginPlugin *plugin, GError **error) {
spasm_protocol_register(G_TYPE_MODULE(plugin));
spasm = purple_protocols_add(SPASM_TYPE_PROTOCOL, error);
if(spasm == NULL) {
g_warning("instance was null");
return FALSE;
}
return TRUE;
}
G_MODULE_EXPORT gboolean
gplugin_unload(GPluginPlugin *plugin, GError **error) {
spasm = NULL;
return TRUE;
}