• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MODULE_DATA函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MODULE_DATA函数的典型用法代码示例。如果您正苦于以下问题:C++ MODULE_DATA函数的具体用法?C++ MODULE_DATA怎么用?C++ MODULE_DATA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MODULE_DATA函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sig_channel_destroyed

static void sig_channel_destroyed(CHANNEL_REC *channel)
{
	void *data = MODULE_DATA(channel);

	g_free(data);
	MODULE_DATA_UNSET(channel);
}
开发者ID:rrebello,项目名称:irssi,代码行数:7,代码来源:fe-common-core.c


示例2: complete_from_nicklist

static void complete_from_nicklist(GList **outlist, CHANNEL_REC *channel,
				   const char *nick, const char *suffix)
{
        MODULE_CHANNEL_REC *mchannel;
	GSList *tmp;
        GList *ownlist;
	char *str;
	int len;

	/* go through the last x nicks who have said something in the channel.
	   nicks of all the "own messages" are placed before others */
        ownlist = NULL;
	len = strlen(nick);
        mchannel = MODULE_DATA(channel);
	for (tmp = mchannel->lastmsgs; tmp != NULL; tmp = tmp->next) {
		LAST_MSG_REC *rec = tmp->data;

		if (g_strncasecmp(rec->nick, nick, len) == 0 &&
		    glist_find_icase_string(*outlist, rec->nick) == NULL) {
			str = g_strconcat(rec->nick, suffix, NULL);
			if (completion_lowercase) g_strdown(str);
			if (rec->own)
				ownlist = g_list_append(ownlist, str);
                        else
				*outlist = g_list_append(*outlist, str);
		}
	}

        *outlist = g_list_concat(ownlist, *outlist);
}
开发者ID:svn2github,项目名称:irssi,代码行数:30,代码来源:chat-completion.c


示例3: completion_msg_server

/* Complete /MSG from specified server, or from
   global_lastmsgs if server is NULL */
static void completion_msg_server(GSList **list, SERVER_REC *server,
				  const char *nick, const char *prefix)
{
	LAST_MSG_REC *msg;
	GSList *tmp;
	int len;

	g_return_if_fail(nick != NULL);

	len = strlen(nick);
	tmp = server == NULL ? global_lastmsgs :
		((MODULE_SERVER_REC *) MODULE_DATA(server))->lastmsgs;
	for (; tmp != NULL; tmp = tmp->next) {
		LAST_MSG_REC *rec = tmp->data;

		if (len != 0 && g_strncasecmp(rec->nick, nick, len) != 0)
			continue;

		msg = g_new(LAST_MSG_REC, 1);
		msg->time = rec->time;
		msg->nick = prefix == NULL || *prefix == '\0' ?
			g_strdup(rec->nick) :
			g_strconcat(prefix, " ", rec->nick, NULL);
		*list = g_slist_insert_sorted(*list, msg,
					      (GCompareFunc) last_msg_cmp);
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:29,代码来源:chat-completion.c


示例4: sig_erase_complete_msg

static void sig_erase_complete_msg(WINDOW_REC *window, const char *word,
				   const char *line)
{
	SERVER_REC *server;
	MODULE_SERVER_REC *mserver;
        GSList *tmp;

	server = line_get_server(line);
	if (server == NULL){
		server = window->active_server;
		if (server == NULL)
                        return;
	}

	if (*word == '\0')
		return;

        /* check from global list */
	completion_last_message_remove(word);

	/* check from server specific list */
	if (server != NULL) {
		mserver = MODULE_DATA(server);
		for (tmp = mserver->lastmsgs; tmp != NULL; tmp = tmp->next) {
			LAST_MSG_REC *rec = tmp->data;

			if (g_strcasecmp(rec->nick, word) == 0) {
				last_msg_destroy(&mserver->lastmsgs, rec);
                                break;
			}
		}

	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:34,代码来源:chat-completion.c


示例5: event_ison

static void event_ison(IRC_SERVER_REC *server, const char *data)
{
	MODULE_SERVER_REC *mserver;
	char *params, *online;

	g_return_if_fail(data != NULL);
	g_return_if_fail(server != NULL);

	params = event_get_params(data, 2, NULL, &online);

	mserver = MODULE_DATA(server);
	ison_save_users(mserver, online);

	if (--mserver->ison_count > 0) {
		/* wait for the rest of the /ISON replies */
		g_free(params);
                return;
	}

        ison_check_joins(server);
        ison_check_parts(server);

	/* free memory used by temp list */
	g_slist_foreach(mserver->ison_tempusers, (GFunc) g_free, NULL);
	g_slist_free(mserver->ison_tempusers);
	mserver->ison_tempusers = NULL;

	g_free(params);
}
开发者ID:svn2github,项目名称:irssi,代码行数:29,代码来源:notify-ison.c


示例6: g_return_val_if_fail

WINDOW_REC *window_find_item(WINDOW_REC *window, const char *name)
{
	WINDOW_REC *rec;
	WI_ITEM_REC *item;

	g_return_val_if_fail(name != NULL, NULL);

	rec = window_find_name(name);
	if (rec != NULL) return rec;

	item = window == NULL ? NULL :
		window_item_find(window->active_server, name);
	if (item == NULL && window->active_server != NULL) {
		/* not found from the active server - any server? */
		item = window_item_find(NULL, name);
	}

	if (item == NULL) {
		char *chan;

		/* still nothing? maybe user just left the # in front of
		   channel, try again with it.. */
		chan = g_strdup_printf("#%s", name);
		item = window == NULL ? NULL :
			window_item_find(window->active_server, chan);
		if (item == NULL) item = window_item_find(NULL, chan);
		g_free(chan);
	}

	if (item == NULL)
		return 0;

	return MODULE_DATA(item);
}
开发者ID:svn2github,项目名称:irssi,代码行数:34,代码来源:windows.c


示例7: sig_nick_removed

static void sig_nick_removed(CHANNEL_REC *channel, NICK_REC *nick)
{
        MODULE_CHANNEL_REC *mchannel;
	LAST_MSG_REC *rec;

        mchannel = MODULE_DATA(channel);
	rec = last_msg_find(mchannel->lastmsgs, nick->nick);
	if (rec != NULL) last_msg_destroy(&mchannel->lastmsgs, rec);
}
开发者ID:svn2github,项目名称:irssi,代码行数:9,代码来源:chat-completion.c


示例8: g_return_val_if_fail

GSList *server_autoignores(IRC_SERVER_REC *server)
{
	MODULE_SERVER_REC *rec;

	g_return_val_if_fail(server != NULL, NULL);

	rec = MODULE_DATA(server);
	return rec->ignorelist;
}
开发者ID:svn2github,项目名称:irssi,代码行数:9,代码来源:autoignore.c


示例9: sig_server_disconnected

static void sig_server_disconnected(SERVER_REC *server)
{
	MODULE_SERVER_REC *mserver;

	g_return_if_fail(server != NULL);

        mserver = MODULE_DATA(server);
	while (mserver->lastmsgs)
                last_msg_destroy(&mserver->lastmsgs, mserver->lastmsgs->data);
}
开发者ID:svn2github,项目名称:irssi,代码行数:10,代码来源:chat-completion.c


示例10: autoignore_init_server

static void autoignore_init_server(IRC_SERVER_REC *server)
{
	MODULE_SERVER_REC *mserver;

	g_return_if_fail(server != NULL);

	mserver = MODULE_DATA(server);
	mserver->ignorelist = NULL;
	mserver->ignore_lastcheck = time(NULL)-AUTOIGNORE_TIMECHECK;
}
开发者ID:svn2github,项目名称:irssi,代码行数:10,代码来源:autoignore.c


示例11: autoignore_deinit_server

static void autoignore_deinit_server(IRC_SERVER_REC *server)
{
	MODULE_SERVER_REC *mserver;

	g_return_if_fail(server != NULL);

	mserver = MODULE_DATA(server);
	while (mserver->ignorelist != NULL)
		autoignore_remove_rec(server, (AUTOIGNORE_REC *) mserver->ignorelist->data);
}
开发者ID:svn2github,项目名称:irssi,代码行数:10,代码来源:autoignore.c


示例12: flood_newmsg

/* All messages should go through here.. */
static void flood_newmsg(IRC_SERVER_REC *server, int level, const char *nick,
			 const char *host, const char *target)
{
	MODULE_SERVER_REC *mserver;
	FLOOD_REC *flood;
	FLOOD_ITEM_REC *rec;
	time_t now, *ttime;
	GSList *times, *tnext;

	g_return_if_fail(server != NULL);
	g_return_if_fail(nick != NULL);

	mserver = MODULE_DATA(server);
	flood = g_hash_table_lookup(mserver->floodlist, nick);

	rec = flood == NULL ? NULL : flood_find(flood, level, target);
	if (rec != NULL) {
		now = time(NULL);
		for (times = rec->msgtimes; times != NULL; times = tnext) {
			time_t *data = times->data;
			tnext = times->next;

			if (now - *data >= flood_timecheck) {
				rec->msgtimes = g_slist_remove(rec->msgtimes, data);
				g_free(data);
			} else
				break;
		}
		ttime = g_new(time_t, 1);
		*ttime = now;
		rec->msgtimes = g_slist_append(rec->msgtimes, ttime);
		if (g_slist_length(rec->msgtimes) > flood_max_msgs) {
			/* flooding! */
			signal_emit("flood", 5, server, nick, host,
				    GINT_TO_POINTER(rec->level), target);
		}
		return;
	}

	if (flood == NULL) {
		flood = g_new0(FLOOD_REC, 1);
		flood->nick = g_strdup(nick);
		g_hash_table_insert(mserver->floodlist, flood->nick, flood);
	}

	rec = g_new0(FLOOD_ITEM_REC, 1);
	rec->level = level;
	rec->msgtimes = NULL;
	ttime = g_new(time_t, 1);
	*ttime = time(NULL);
	rec->msgtimes = g_slist_append(rec->msgtimes, ttime);
	rec->target = g_strdup(target);

	flood->items = g_slist_append(flood->items, rec);
}
开发者ID:Brijen,项目名称:MacIrssi,代码行数:56,代码来源:flood.c


示例13: window_item_change_server

void window_item_change_server(WI_ITEM_REC *item, void *server)
{
	WINDOW_REC *window;

	g_return_if_fail(item != NULL);

	window = MODULE_DATA(item);
	item->server = server;

        signal_emit("window item server changed", 2, window, item);
	if (window->active == item) window_change_server(window, item->server);
}
开发者ID:svn2github,项目名称:irssi,代码行数:12,代码来源:window-items.c


示例14: sig_channel_destroyed

static void sig_channel_destroyed(CHANNEL_REC *channel)
{
	MODULE_CHANNEL_REC *mchannel;

	g_return_if_fail(channel != NULL);

        mchannel = MODULE_DATA(channel);
	while (mchannel->lastmsgs != NULL) {
		last_msg_destroy(&mchannel->lastmsgs,
				 mchannel->lastmsgs->data);
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:12,代码来源:chat-completion.c


示例15: sig_nick_changed

static void sig_nick_changed(CHANNEL_REC *channel, NICK_REC *nick,
			     const char *oldnick)
{
        MODULE_CHANNEL_REC *mchannel;
	LAST_MSG_REC *rec;

        mchannel = MODULE_DATA(channel);
	rec = last_msg_find(mchannel->lastmsgs, oldnick);
	if (rec != NULL) {
		g_free(rec->nick);
		rec->nick = g_strdup(nick->nick);
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:13,代码来源:chat-completion.c


示例16: MODULE_DATA

NOTIFY_NICK_REC *notify_nick_create(IRC_SERVER_REC *server, const char *nick)
{
	MODULE_SERVER_REC *mserver;
	NOTIFY_NICK_REC *rec;

	mserver = MODULE_DATA(server);

	rec = g_new0(NOTIFY_NICK_REC, 1);
	rec->nick = g_strdup(nick);

	mserver->notify_users = g_slist_append(mserver->notify_users, rec);
	return rec;
}
开发者ID:svn2github,项目名称:irssi,代码行数:13,代码来源:notify-ison.c


示例17: notifylist_left

void notifylist_left(IRC_SERVER_REC *server, NOTIFY_NICK_REC *rec)
{
	MODULE_SERVER_REC *mserver;

	mserver = MODULE_DATA(server);
	mserver->notify_users = g_slist_remove(mserver->notify_users, rec);

	if (rec->host_ok && rec->away_ok) {
		signal_emit("notifylist left", 6,
			    server, rec->nick,
			    rec->user, rec->host,
			    rec->realname, rec->awaymsg);
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:14,代码来源:notifylist.c


示例18: flood_deinit_server

/* Deinitialize flood protection */
static void flood_deinit_server(IRC_SERVER_REC *server)
{
	MODULE_SERVER_REC *mserver;

	g_return_if_fail(server != NULL);

	mserver = MODULE_DATA(server);
	if (mserver != NULL && mserver->floodlist != NULL) {
		flood_timecheck = 0;

		g_hash_table_foreach(mserver->floodlist, (GHFunc) flood_hash_destroy, NULL);
		g_hash_table_destroy(mserver->floodlist);
	}
	g_free(mserver);
}
开发者ID:svn2github,项目名称:irssi,代码行数:16,代码来源:flood.c


示例19: autoignore_remove_rec

static void autoignore_remove_rec(IRC_SERVER_REC *server, AUTOIGNORE_REC *rec)
{
	MODULE_SERVER_REC *mserver;

	g_return_if_fail(server != NULL);
	g_return_if_fail(rec != NULL);

	signal_emit("autoignore remove", 2, server, rec);

	g_free(rec->nick);
	g_free(rec);

	mserver = MODULE_DATA(server);
	mserver->ignorelist = g_slist_remove(mserver->ignorelist, rec);
}
开发者ID:svn2github,项目名称:irssi,代码行数:15,代码来源:autoignore.c


示例20: notifylist_deinit_server

static void notifylist_deinit_server(IRC_SERVER_REC *server)
{
	MODULE_SERVER_REC *mserver;
	NOTIFY_NICK_REC *rec;

	g_return_if_fail(server != NULL);

	mserver = MODULE_DATA(server);
	while (mserver->notify_users != NULL) {
		rec = mserver->notify_users->data;

		mserver->notify_users = g_slist_remove(mserver->notify_users, rec);
		notify_nick_destroy(rec);
	}
	g_free(mserver);
}
开发者ID:svn2github,项目名称:irssi,代码行数:16,代码来源:notifylist.c



注:本文中的MODULE_DATA函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MODULE_DESCRIPTION函数代码示例发布时间:2022-05-30
下一篇:
C++ MODIFY_REG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap