1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-07 10:13:12 +02:00

core: add "hdata" (direct access to WeeChat/plugin data)

This commit is contained in:
Sebastien Helleu
2011-06-13 12:32:27 +02:00
parent 756252b95c
commit c8b2a6a084
77 changed files with 12088 additions and 275 deletions
+34
View File
@@ -22,6 +22,7 @@
*/
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
@@ -42,6 +43,8 @@ struct t_hook *irc_notify_timer_whois = NULL; /* timer for "whois" */
/* hsignal for redirected commands */
struct t_hook *irc_notify_hsignal = NULL;
struct t_hdata *irc_notify_hdata_notify = NULL;
/*
* irc_notify_valid: check if a notify pointer exists for a server
@@ -808,6 +811,37 @@ irc_notify_timer_whois_cb (void *data, int remaining_calls)
return WEECHAT_RC_OK;
}
/*
* irc_notify_hdata_notify_cb: return hdata for notify
*/
struct t_hdata *
irc_notify_hdata_notify_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (irc_notify_hdata_notify)
return irc_notify_hdata_notify;
hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify");
if (hdata)
{
irc_notify_hdata_notify = hdata;
WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING);
WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING);
WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER);
}
return irc_notify_hdata_notify;
}
/*
* irc_notify_add_to_infolist: add a notify in an infolist
* return 1 if ok, 0 if error