mirror of
https://github.com/weechat/weechat.git
synced 2026-07-08 18:53:12 +02:00
core: add "hdata" (direct access to WeeChat/plugin data)
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
@@ -36,6 +37,9 @@
|
||||
#include "irc-channel.h"
|
||||
|
||||
|
||||
struct t_hdata *irc_nick_hdata_nick = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* irc_nick_valid: check if a nick pointer exists for a channel
|
||||
* return 1 if nick exists
|
||||
@@ -927,6 +931,37 @@ irc_nick_color_for_pv (struct t_irc_channel *channel, const char *nickname)
|
||||
return IRC_COLOR_CHAT_NICK_OTHER;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_nick_hdata_nick_cb: return hdata for nick
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (irc_nick_hdata_nick)
|
||||
return irc_nick_hdata_nick;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
|
||||
if (hdata)
|
||||
{
|
||||
irc_nick_hdata_nick = hdata;
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER);
|
||||
}
|
||||
return irc_nick_hdata_nick;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_nick_add_to_infolist: add a nick in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
|
||||
Reference in New Issue
Block a user