grim/purple-spasm

Move the parsing to regex and make real_send add the trailing \r\n
/*
* Spasm - 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 "spasm-protocol.h"
#include "spasm-account.h"
/******************************************************************************
* PurpleProtocol implementation
*****************************************************************************/
static const gchar *
spasm_protocol_list_icon(PurpleAccount *account, PurpleBuddy *buddy) {
return "spasm";
}
static void
spasm_protocol_close(PurpleConnection *connection) {
}
static GList *
spasm_protocol_get_status_types(PurpleAccount *account) {
GList *types = NULL;
PurpleStatusType *status;
status = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, "online", "Online", TRUE, TRUE, FALSE);
types = g_list_append(types, status);
status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, NULL, "Offline", TRUE, TRUE, FALSE);
types = g_list_append(types, status);
return types;
}
/******************************************************************************
* GObject Implementation
*****************************************************************************/
G_DEFINE_DYNAMIC_TYPE(
SpasmProtocol,
spasm_protocol,
PURPLE_TYPE_PROTOCOL
)
static void
spasm_protocol_init(SpasmProtocol *protocol) {
PurpleProtocol *prpl = PURPLE_PROTOCOL(protocol);
prpl->id = "prpl-grim-spasm";
prpl->name = "Twitch";
prpl->options = OPT_PROTO_NO_PASSWORD;
}
static void
spasm_protocol_class_init(SpasmProtocolClass *klass) {
PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass);
protocol_class->login = spasm_account_login;
protocol_class->list_icon = spasm_protocol_list_icon;
protocol_class->close = spasm_protocol_close;
protocol_class->status_types = spasm_protocol_get_status_types;
}
static void
spasm_protocol_class_finalize(SpasmProtocolClass *klass) {
}
/******************************************************************************
* API
*****************************************************************************/
void
spasm_protocol_register(GTypeModule *module) {
spasm_protocol_register_type(module);
}