c.sexchat/plugins/fishlim/plugin_hexchat.c

578 lines
18 KiB
C
Raw Normal View History

2011-11-24 23:17:31 +01:00
/*
2012-05-04 19:29:02 +02:00
Copyright (c) 2010-2011 Samuel Lidén Borell <samuel@kodafritt.se>
Copyright (c) 2015 <the.cypher@gmail.com>
2011-11-24 23:17:31 +01:00
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
2014-12-16 04:57:27 +01:00
#include "config.h"
2011-11-24 23:37:43 +01:00
#include <glib.h>
2011-11-24 23:17:31 +01:00
#include <stdlib.h>
#include <string.h>
2012-10-24 21:33:02 +02:00
#include "hexchat-plugin.h"
2012-10-30 11:47:12 +01:00
#define HEXCHAT_MAX_WORDS 32
2011-11-24 23:17:31 +01:00
#include "fish.h"
#include "dh1080.h"
2011-11-24 23:17:31 +01:00
#include "keystore.h"
#include "irc.h"
static const char plugin_name[] = "FiSHLiM";
static const char plugin_desc[] = "Encryption plugin for the FiSH protocol. Less is More!";
2016-09-05 10:02:56 +02:00
static const char plugin_version[] = "0.1.0";
2011-11-24 23:17:31 +01:00
static const char usage_setkey[] = "Usage: SETKEY [<nick or #channel>] <password>, sets the key for a channel or nick";
static const char usage_delkey[] = "Usage: DELKEY <nick or #channel>, deletes the key for a channel or nick";
static const char usage_keyx[] = "Usage: KEYX [<nick>], performs DH1080 key-exchange with <nick>";
static const char usage_topic[] = "Usage: TOPIC+ <topic>, sets a new encrypted topic for the current channel";
static const char usage_notice[] = "Usage: NOTICE+ <nick or #channel> <notice>";
static const char usage_msg[] = "Usage: MSG+ <nick or #channel> <message>";
2011-11-24 23:17:31 +01:00
2012-10-30 08:42:48 +01:00
static hexchat_plugin *ph;
static GHashTable *pending_exchanges;
2011-11-24 23:17:31 +01:00
2011-11-24 23:37:43 +01:00
/**
* Returns the path to the key store file.
*/
2016-02-18 14:57:22 +01:00
gchar *get_config_filename(void) {
char *filename_fs, *filename_utf8;
filename_utf8 = g_build_filename(hexchat_get_info(ph, "configdir"), "addon_fishlim.conf", NULL);
filename_fs = g_filename_from_utf8 (filename_utf8, -1, NULL, NULL, NULL);
g_free (filename_utf8);
return filename_fs;
2011-11-24 23:37:43 +01:00
}
static inline gboolean irc_is_query (const char *name) {
const char *chantypes = hexchat_list_str (ph, NULL, "chantypes");
return strchr (chantypes, name[0]) == NULL;
}
static hexchat_context *find_context_on_network (const char *name) {
hexchat_list *channels;
hexchat_context *ret = NULL;
int id;
if (hexchat_get_prefs(ph, "id", NULL, &id) != 2)
return NULL;
channels = hexchat_list_get(ph, "channels");
if (!channels)
return NULL;
while (hexchat_list_next(ph, channels)) {
int chan_id = hexchat_list_int(ph, channels, "id");
const char *chan_name = hexchat_list_str(ph, channels, "channel");
if (chan_id == id && chan_name && hexchat_nickcmp (ph, chan_name, name) == 0) {
ret = (hexchat_context*)hexchat_list_str(ph, channels, "context");
break;
}
};
hexchat_list_free(ph, channels);
return ret;
}
2014-12-12 11:15:49 +01:00
int irc_nick_cmp(const char *a, const char *b) {
return hexchat_nickcmp (ph, a, b);
}
2011-11-24 23:17:31 +01:00
/*static int handle_debug(char *word[], char *word_eol[], void *userdata) {
2012-10-30 08:42:48 +01:00
hexchat_printf(ph, "debug incoming: ");
2011-11-24 23:17:31 +01:00
for (size_t i = 1; word[i] != NULL && word[i][0] != '\0'; i++) {
2012-10-30 08:42:48 +01:00
hexchat_printf(ph, ">%s< ", word[i]);
2011-11-24 23:17:31 +01:00
}
2012-10-30 08:42:48 +01:00
hexchat_printf(ph, "\n");
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_NONE;
2011-11-24 23:17:31 +01:00
}*/
/**
* Called when a message is to be sent.
*/
static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
const char *own_nick;
2014-12-18 00:49:59 +01:00
/* Encrypt the message if possible */
2012-10-30 08:42:48 +01:00
const char *channel = hexchat_get_info(ph, "channel");
2011-11-24 23:17:31 +01:00
char *encrypted = fish_encrypt_for_nick(channel, word_eol[1]);
2012-10-30 07:40:37 +01:00
if (!encrypted) return HEXCHAT_EAT_NONE;
2011-11-24 23:17:31 +01:00
2014-12-18 00:49:59 +01:00
/* Display message */
2012-10-30 08:42:48 +01:00
own_nick = hexchat_get_info(ph, "nick");
hexchat_emit_print(ph, "Your Message", own_nick, word_eol[1], NULL);
2011-11-24 23:17:31 +01:00
2014-12-18 00:49:59 +01:00
/* Send message */
2012-10-30 08:42:48 +01:00
hexchat_commandf(ph, "PRIVMSG %s :+OK %s", channel, encrypted);
2011-11-24 23:17:31 +01:00
g_free(encrypted);
2012-10-30 10:42:37 +01:00
return HEXCHAT_EAT_HEXCHAT;
2011-11-24 23:17:31 +01:00
}
/**
* Called when a channel message or private message is received.
*/
2014-12-12 11:43:57 +01:00
static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs *attrs, void *userdata) {
2011-11-24 23:17:31 +01:00
const char *prefix;
const char *command;
const char *recipient;
const char *encrypted;
const char *peice;
2011-11-25 10:24:33 +01:00
char *sender_nick;
2011-11-24 23:17:31 +01:00
char *decrypted;
size_t w;
size_t ew;
size_t uw;
char prefix_char = 0;
2014-12-12 10:04:39 +01:00
GString *message;
2011-11-24 23:17:31 +01:00
if (!irc_parse_message((const char **)word, &prefix, &command, &w))
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_NONE;
2011-11-24 23:17:31 +01:00
2014-12-18 00:49:59 +01:00
/* Topic (command 332) has an extra parameter */
2011-11-24 23:17:31 +01:00
if (!strcmp(command, "332")) w++;
2014-12-18 00:49:59 +01:00
/* Look for encrypted data */
2012-10-30 11:47:12 +01:00
for (ew = w+1; ew < HEXCHAT_MAX_WORDS-1; ew++) {
2011-11-24 23:17:31 +01:00
const char *s = (ew == w+1 ? word[ew]+1 : word[ew]);
if (*s && (s[1] == '+' || s[1] == 'm')) { prefix_char = *(s++); }
else { prefix_char = 0; }
2012-03-16 00:17:03 +01:00
if (strcmp(s, "+OK") == 0 || strcmp(s, "mcps") == 0) goto has_encrypted_data;
2011-11-24 23:17:31 +01:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_NONE;
2011-11-24 23:17:31 +01:00
has_encrypted_data: ;
2014-12-18 00:49:59 +01:00
/* Extract sender nick and recipient nick/channel */
2011-11-24 23:17:31 +01:00
sender_nick = irc_prefix_get_nick(prefix);
recipient = word[w];
2014-12-18 00:49:59 +01:00
/* Try to decrypt with these (the keys are searched for in the key store) */
2011-11-24 23:17:31 +01:00
encrypted = word[ew+1];
decrypted = fish_decrypt_from_nick(recipient, encrypted);
if (!decrypted) decrypted = fish_decrypt_from_nick(sender_nick, encrypted);
2014-12-18 00:49:59 +01:00
/* Check for error */
2011-11-24 23:17:31 +01:00
if (!decrypted) goto decrypt_error;
2014-12-18 00:49:59 +01:00
/* Build unecrypted message */
2014-12-12 10:04:39 +01:00
message = g_string_sized_new (100); /* TODO: more accurate estimation of size */
g_string_append (message, "RECV");
2014-12-12 11:43:57 +01:00
if (attrs->server_time_utc)
{
GTimeVal tv = { (glong)attrs->server_time_utc, 0 };
char *timestamp = g_time_val_to_iso8601 (&tv);
g_string_append (message, " @time=");
g_string_append (message, timestamp);
g_free (timestamp);
}
2012-10-30 11:47:12 +01:00
for (uw = 1; uw < HEXCHAT_MAX_WORDS; uw++) {
2014-12-12 10:04:39 +01:00
if (word[uw][0] != '\0')
g_string_append_c (message, ' ');
2011-11-24 23:17:31 +01:00
if (uw == ew) {
2014-12-18 00:49:59 +01:00
/* Add the encrypted data */
2011-11-24 23:17:31 +01:00
peice = decrypted;
2014-12-18 00:49:59 +01:00
uw++; /* Skip "OK+" */
2012-05-13 14:45:32 +02:00
if (ew == w+1) {
2014-12-18 00:49:59 +01:00
/* Prefix with colon, which gets stripped out otherwise */
2014-12-12 10:04:39 +01:00
g_string_append_c (message, ':');
2012-05-13 14:45:32 +02:00
}
if (prefix_char) {
2014-12-12 10:04:39 +01:00
g_string_append_c (message, prefix_char);
}
2011-11-24 23:17:31 +01:00
} else {
2014-12-18 00:49:59 +01:00
/* Add unencrypted data (for example, a prefix from a bouncer or bot) */
2012-05-13 14:45:32 +02:00
peice = word[uw];
2011-11-24 23:17:31 +01:00
}
2014-12-12 10:04:39 +01:00
g_string_append (message, peice);
2011-11-24 23:17:31 +01:00
}
g_free(decrypted);
2014-12-18 00:49:59 +01:00
/* Simulate unencrypted message */
/* hexchat_printf(ph, "simulating: %s\n", message->str); */
2014-12-12 10:04:39 +01:00
hexchat_command(ph, message->str);
g_string_free (message, TRUE);
g_free(sender_nick);
2012-10-30 10:42:37 +01:00
return HEXCHAT_EAT_HEXCHAT;
2011-11-24 23:17:31 +01:00
decrypt_error:
g_free(decrypted);
g_free(sender_nick);
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_NONE;
2011-11-24 23:17:31 +01:00
}
static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
const char *dh_message = word[4];
const char *dh_pubkey = word[5];
hexchat_context *query_ctx;
const char *prefix;
gboolean cbc;
char *sender, *secret_key, *priv_key = NULL;
if (!*dh_message || !*dh_pubkey || strlen(dh_pubkey) != 181)
return HEXCHAT_EAT_NONE;
if (!irc_parse_message((const char**)word, &prefix, NULL, NULL) || !prefix)
return HEXCHAT_EAT_NONE;
sender = irc_prefix_get_nick(prefix);
query_ctx = find_context_on_network(sender);
if (query_ctx)
hexchat_set_context(ph, query_ctx);
dh_message++; /* : prefix */
if (*dh_message == '+' || *dh_message == '-')
dh_message++; /* identify-msg */
cbc = g_strcmp0 (word[6], "CBC") == 0;
if (!strcmp(dh_message, "DH1080_INIT")) {
char *pub_key;
if (cbc) {
hexchat_print(ph, "Recieved key exchange for CBC mode which is not supported.");
goto cleanup;
}
hexchat_printf(ph, "Received public key from %s, sending mine...", sender);
if (dh1080_generate_key(&priv_key, &pub_key)) {
hexchat_commandf(ph, "quote NOTICE %s :DH1080_FINISH %s", sender, pub_key);
g_free(pub_key);
} else {
hexchat_print(ph, "Failed to generate keys");
goto cleanup;
}
} else if (!strcmp (dh_message, "DH1080_FINISH")) {
char *sender_lower = g_ascii_strdown(sender, -1);
/* FIXME: Properly respect irc casing */
priv_key = g_hash_table_lookup(pending_exchanges, sender_lower);
g_hash_table_steal(pending_exchanges, sender_lower);
g_free(sender_lower);
if (cbc) {
hexchat_print(ph, "Recieved key exchange for CBC mode which is not supported.");
goto cleanup;
}
if (!priv_key) {
hexchat_printf(ph, "Recieved a key exchange response for unknown user: %s", sender);
goto cleanup;
}
} else {
/* Regular notice */
g_free(sender);
return HEXCHAT_EAT_NONE;
}
if (dh1080_compute_key(priv_key, dh_pubkey, &secret_key)) {
keystore_store_key(sender, secret_key);
hexchat_printf(ph, "Stored new key for %s", sender);
g_free(secret_key);
} else {
hexchat_print(ph, "Failed to create secret key!");
}
cleanup:
g_free(sender);
g_free(priv_key);
return HEXCHAT_EAT_ALL;
}
2011-11-24 23:17:31 +01:00
/**
* Command handler for /setkey
*/
static int handle_setkey(char *word[], char *word_eol[], void *userdata) {
const char *nick;
const char *key;
2014-12-18 00:49:59 +01:00
/* Check syntax */
2011-11-24 23:17:31 +01:00
if (*word[2] == '\0') {
2012-10-30 08:42:48 +01:00
hexchat_printf(ph, "%s\n", usage_setkey);
2012-10-30 10:42:37 +01:00
return HEXCHAT_EAT_HEXCHAT;
2011-11-24 23:17:31 +01:00
}
2011-11-24 23:17:31 +01:00
if (*word[3] == '\0') {
2014-12-18 00:49:59 +01:00
/* /setkey password */
2012-10-30 08:42:48 +01:00
nick = hexchat_get_info(ph, "channel");
2011-11-24 23:17:31 +01:00
key = word_eol[2];
} else {
2014-12-18 00:49:59 +01:00
/* /setkey #channel password */
2011-11-24 23:17:31 +01:00
nick = word[2];
key = word_eol[3];
}
2014-12-18 00:49:59 +01:00
/* Set password */
2011-11-24 23:17:31 +01:00
if (keystore_store_key(nick, key)) {
2012-10-30 08:42:48 +01:00
hexchat_printf(ph, "Stored key for %s\n", nick);
2011-11-24 23:17:31 +01:00
} else {
2014-07-18 13:16:43 +02:00
hexchat_printf(ph, "\00305Failed to store key in addon_fishlim.conf\n");
2011-11-24 23:17:31 +01:00
}
2012-10-30 10:42:37 +01:00
return HEXCHAT_EAT_HEXCHAT;
2011-11-24 23:17:31 +01:00
}
/**
* Command handler for /delkey
*/
static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
const char *nick;
2014-12-18 00:49:59 +01:00
/* Check syntax */
2011-11-24 23:17:31 +01:00
if (*word[2] == '\0' || *word[3] != '\0') {
2012-10-30 08:42:48 +01:00
hexchat_printf(ph, "%s\n", usage_delkey);
2012-10-30 10:42:37 +01:00
return HEXCHAT_EAT_HEXCHAT;
2011-11-24 23:17:31 +01:00
}
nick = g_strstrip (word_eol[2]);
2014-12-18 00:49:59 +01:00
/* Delete the given nick from the key store */
2011-11-24 23:17:31 +01:00
if (keystore_delete_nick(nick)) {
2012-10-30 08:42:48 +01:00
hexchat_printf(ph, "Deleted key for %s\n", nick);
2011-11-24 23:17:31 +01:00
} else {
2014-07-18 13:16:43 +02:00
hexchat_printf(ph, "\00305Failed to delete key in addon_fishlim.conf!\n");
2011-11-24 23:17:31 +01:00
}
2012-10-30 10:42:37 +01:00
return HEXCHAT_EAT_HEXCHAT;
2011-11-24 23:17:31 +01:00
}
static int handle_keyx(char *word[], char *word_eol[], void *userdata) {
const char *target = word[2];
hexchat_context *query_ctx = NULL;
char *pub_key, *priv_key;
int ctx_type;
if (*target)
query_ctx = find_context_on_network(target);
else {
target = hexchat_get_info(ph, "channel");
query_ctx = hexchat_get_context (ph);
}
if (query_ctx) {
hexchat_set_context(ph, query_ctx);
ctx_type = hexchat_list_int(ph, NULL, "type");
}
if ((query_ctx && ctx_type != 3) || (!query_ctx && !irc_is_query(target))) {
hexchat_print(ph, "You can only exchange keys with individuals");
return HEXCHAT_EAT_ALL;
}
if (dh1080_generate_key(&priv_key, &pub_key)) {
g_hash_table_replace (pending_exchanges, g_ascii_strdown(target, -1), priv_key);
hexchat_commandf(ph, "quote NOTICE %s :DH1080_INIT %s", target, pub_key);
hexchat_printf(ph, "Sent public key to %s, waiting for reply...", target);
g_free(pub_key);
} else {
hexchat_print(ph, "Failed to generate keys");
}
return HEXCHAT_EAT_ALL;
}
/**
* Command handler for /topic+
*/
static int handle_crypt_topic(char *word[], char *word_eol[], void *userdata) {
const char *target;
const char *topic = word_eol[2];
char *buf;
if (!*topic) {
hexchat_print(ph, usage_topic);
return HEXCHAT_EAT_ALL;
}
if (hexchat_list_int(ph, NULL, "type") != 2) {
hexchat_printf(ph, "Please change to the channel window where you want to set the topic!");
return HEXCHAT_EAT_ALL;
}
target = hexchat_get_info(ph, "channel");
buf = fish_encrypt_for_nick(target, topic);
if (buf == NULL) {
hexchat_printf(ph, "/topic+ error, no key found for %s", target);
return HEXCHAT_EAT_ALL;
}
hexchat_commandf(ph, "TOPIC %s +OK %s", target, buf);
g_free(buf);
return HEXCHAT_EAT_ALL;
}
/**
* Command handler for /notice+
*/
static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata)
{
const char *target = word[2];
const char *notice = word_eol[3];
char *buf;
if (!*target || !*notice) {
hexchat_print(ph, usage_notice);
return HEXCHAT_EAT_ALL;
}
buf = fish_encrypt_for_nick(target, notice);
if (buf == NULL) {
hexchat_printf(ph, "/notice+ error, no key found for %s.", target);
return HEXCHAT_EAT_ALL;
}
hexchat_commandf(ph, "quote NOTICE %s :+OK %s", target, buf);
hexchat_emit_print(ph, "Notice Sent", target, notice);
g_free(buf);
return HEXCHAT_EAT_ALL;
}
/**
* Command handler for /msg+
*/
static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata)
{
const char *target = word[2];
const char *message = word_eol[3];
hexchat_context *query_ctx;
char *buf;
if (!*target || !*message) {
hexchat_print(ph, usage_msg);
return HEXCHAT_EAT_ALL;
}
buf = fish_encrypt_for_nick(target, message);
if (buf == NULL) {
hexchat_printf(ph, "/msg+ error, no key found for %s", target);
return HEXCHAT_EAT_ALL;
}
hexchat_commandf(ph, "PRIVMSG %s :+OK %s", target, buf);
query_ctx = find_context_on_network(target);
if (query_ctx) {
hexchat_set_context(ph, query_ctx);
/* FIXME: Mode char */
hexchat_emit_print(ph, "Your Message", hexchat_get_info(ph, "nick"),
message, "", "");
}
else {
hexchat_emit_print(ph, "Message Send", target, message);
}
g_free(buf);
return HEXCHAT_EAT_ALL;
}
static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
const char *channel = hexchat_get_info(ph, "channel");
char *buf;
buf = fish_encrypt_for_nick(channel, word_eol[2]);
if (!buf)
return HEXCHAT_EAT_NONE;
hexchat_commandf(ph, "PRIVMSG %s :\001ACTION +OK %s \001", channel, buf);
hexchat_emit_print(ph, "Your Action", hexchat_get_info(ph, "nick"),
word_eol[2], NULL);
g_free(buf);
return HEXCHAT_EAT_ALL;
}
2011-11-24 23:17:31 +01:00
/**
* Returns the plugin name version information.
*/
2012-10-30 08:42:48 +01:00
void hexchat_plugin_get_info(const char **name, const char **desc,
2011-11-25 10:24:33 +01:00
const char **version, void **reserved) {
2011-11-24 23:17:31 +01:00
*name = plugin_name;
*desc = plugin_desc;
*version = plugin_version;
}
/**
* Plugin entry point.
*/
2012-10-30 08:42:48 +01:00
int hexchat_plugin_init(hexchat_plugin *plugin_handle,
2011-11-25 10:24:33 +01:00
const char **name,
const char **desc,
const char **version,
char *arg) {
2011-11-24 23:17:31 +01:00
ph = plugin_handle;
2012-10-30 11:47:12 +01:00
/* Send our info to HexChat */
2011-11-24 23:17:31 +01:00
*name = plugin_name;
*desc = plugin_desc;
*version = plugin_version;
2011-11-24 23:17:31 +01:00
/* Register commands */
2012-10-30 08:42:48 +01:00
hexchat_hook_command(ph, "SETKEY", HEXCHAT_PRI_NORM, handle_setkey, usage_setkey, NULL);
hexchat_hook_command(ph, "DELKEY", HEXCHAT_PRI_NORM, handle_delkey, usage_delkey, NULL);
hexchat_hook_command(ph, "KEYX", HEXCHAT_PRI_NORM, handle_keyx, usage_keyx, NULL);
hexchat_hook_command(ph, "TOPIC+", HEXCHAT_PRI_NORM, handle_crypt_topic, usage_topic, NULL);
hexchat_hook_command(ph, "NOTICE+", HEXCHAT_PRI_NORM, handle_crypt_notice, usage_notice, NULL);
hexchat_hook_command(ph, "MSG+", HEXCHAT_PRI_NORM, handle_crypt_msg, usage_msg, NULL);
hexchat_hook_command(ph, "ME", HEXCHAT_PRI_NORM, handle_crypt_me, NULL, NULL);
2011-11-24 23:17:31 +01:00
/* Add handlers */
2012-10-30 08:42:48 +01:00
hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, handle_outgoing, NULL, NULL);
hexchat_hook_server(ph, "NOTICE", HEXCHAT_PRI_HIGHEST, handle_keyx_notice, NULL);
2014-12-12 11:43:57 +01:00
hexchat_hook_server_attrs(ph, "NOTICE", HEXCHAT_PRI_NORM, handle_incoming, NULL);
hexchat_hook_server_attrs(ph, "PRIVMSG", HEXCHAT_PRI_NORM, handle_incoming, NULL);
2014-12-18 00:49:59 +01:00
/* hexchat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, handle_debug, NULL); */
2014-12-12 11:43:57 +01:00
hexchat_hook_server_attrs(ph, "TOPIC", HEXCHAT_PRI_NORM, handle_incoming, NULL);
hexchat_hook_server_attrs(ph, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL);
if (!dh1080_init())
return 0;
pending_exchanges = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
2012-10-30 08:42:48 +01:00
hexchat_printf(ph, "%s plugin loaded\n", plugin_name);
2011-11-24 23:17:31 +01:00
/* Return success */
return 1;
}
2012-10-30 08:42:48 +01:00
int hexchat_plugin_deinit(void) {
g_clear_pointer(&pending_exchanges, g_hash_table_destroy);
dh1080_deinit();
2012-10-30 08:42:48 +01:00
hexchat_printf(ph, "%s plugin unloaded\n", plugin_name);
2011-11-24 23:17:31 +01:00
return 1;
}
2011-11-25 10:24:33 +01:00