当前位置: 首页>>代码示例>>C++>>正文


C++ config_node_section函数代码示例

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


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

示例1: hilight_add_config

static void hilight_add_config(HILIGHT_REC *rec)
{
    CONFIG_NODE *node;

    g_return_if_fail(rec != NULL);

    node = iconfig_node_traverse("(hilights", TRUE);
    node = config_node_section(node, NULL, NODE_TYPE_BLOCK);

    iconfig_node_set_str(node, "text", rec->text);
    if (rec->level > 0) iconfig_node_set_int(node, "level", rec->level);
    if (rec->color) iconfig_node_set_str(node, "color", rec->color);
    if (rec->act_color) iconfig_node_set_str(node, "act_color", rec->act_color);
    if (rec->priority > 0) iconfig_node_set_int(node, "priority", rec->priority);
    iconfig_node_set_bool(node, "nick", rec->nick);
    iconfig_node_set_bool(node, "word", rec->word);
    if (rec->nickmask) iconfig_node_set_bool(node, "mask", TRUE);
    if (rec->fullword) iconfig_node_set_bool(node, "fullword", TRUE);
    if (rec->regexp) iconfig_node_set_bool(node, "regexp", TRUE);
    if (rec->servertag) iconfig_node_set_str(node, "servertag", rec->servertag);

    if (rec->channels != NULL && *rec->channels != NULL) {
        node = config_node_section(node, "channels", NODE_TYPE_LIST);
        iconfig_node_add_list(node, rec->channels);
    }
}
开发者ID:RecyclingBin,项目名称:irssi,代码行数:26,代码来源:hilight-text.c

示例2: ignore_set_config

static void ignore_set_config(IGNORE_REC *rec)
{
	CONFIG_NODE *node;
	char *levelstr;

	if (rec->level == 0 && rec->except_level == 0)
		return;

	if (rec->time > 0)
		return;

	node = iconfig_node_traverse("(ignores", TRUE);
	node = config_node_section(node, NULL, NODE_TYPE_BLOCK);

	if (rec->mask != NULL) iconfig_node_set_str(node, "mask", rec->mask);
	if (rec->level) {
		levelstr = bits2level(rec->level);
		iconfig_node_set_str(node, "level", levelstr);
		g_free(levelstr);
	}
	if (rec->except_level) {
		levelstr = bits2level(rec->except_level);
		iconfig_node_set_str(node, "except_level", levelstr);
		g_free(levelstr);
	}
	iconfig_node_set_str(node, "pattern", rec->pattern);
	if (rec->regexp) config_node_set_bool(node, "regexp", TRUE);
	if (rec->fullword) config_node_set_bool(node, "fullword", TRUE);
	if (rec->replies) config_node_set_bool(node, "replies", TRUE);

	if (rec->channels != NULL && *rec->channels != NULL) {
		node = config_node_section(node, "channels", NODE_TYPE_LIST);
		config_node_add_list(node, rec->channels);
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:35,代码来源:ignore.c

示例3: config_node_section

static CONFIG_NODE *statusbar_items_section(CONFIG_NODE *parent)
{
	STATUSBAR_CONFIG_REC *bar;
        CONFIG_NODE *node;
        GSList *tmp;

	node = config_node_section(parent, "items", -1);
	if (node != NULL)
		return node;

        /* find the statusbar configuration from memory */
	bar = statusbar_config_find(active_statusbar_group, parent->key);
	if (bar == NULL) {
		printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
			    TXT_STATUSBAR_NOT_FOUND, parent->key);
                return NULL;
	}

	/* since items list in config file overrides defaults,
	   we'll need to copy the whole list. */
	parent = config_node_section(parent, "items", NODE_TYPE_BLOCK);
	for (tmp = bar->items; tmp != NULL; tmp = tmp->next) {
		SBAR_ITEM_CONFIG_REC *rec = tmp->data;

		node = config_node_section(parent, rec->name,
					   NODE_TYPE_BLOCK);
		if (rec->priority != 0)
                        iconfig_node_set_int(node, "priority", rec->priority);
		if (rec->right_alignment)
                        iconfig_node_set_str(node, "alignment", "right");
	}

        return parent;
}
开发者ID:svn2github,项目名称:irssi,代码行数:34,代码来源:statusbar-config.c

示例4: window_save_items

static void window_save_items(WINDOW_REC *window, CONFIG_NODE *node)
{
	CONFIG_NODE *subnode;
	GSList *tmp;
	const char *type;

	node = config_node_section(node, "items", NODE_TYPE_LIST);
	for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
		WI_ITEM_REC *rec = tmp->data;
		SERVER_REC *server = rec->server;

		type = module_find_id_str("WINDOW ITEM TYPE", rec->type);
		if (type == NULL) continue;

		subnode = config_node_section(node, NULL, NODE_TYPE_BLOCK);

		iconfig_node_set_str(subnode, "type", type);
		type = chat_protocol_find_id(rec->chat_type)->name;
		iconfig_node_set_str(subnode, "chat_type", type);
		iconfig_node_set_str(subnode, "name", rec->name);

		if (server != NULL)
			iconfig_node_set_str(subnode, "tag", server->tag);
		else if (IS_QUERY(rec)) {
			iconfig_node_set_str(subnode, "tag",
					     QUERY(rec)->server_tag);
		}
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:29,代码来源:windows-layout.c

示例5: botuser_config_read_user

static void botuser_config_read_user(CONFIG_NODE *node)
{
	USER_REC *user;
	USER_CHAN_REC *userchan;
	USER_MASK_REC *usermask;
	CONFIG_NODE *subnode;
	GSList *tmp;
	char *value;

	g_return_if_fail(node != NULL);

	/* nick = { ... } */
	if (node->key == NULL || node->value == NULL)
		return;

	/* Add new user */
	user = g_new0(USER_REC, 1);
	user->nick = g_strdup(node->key);
	g_hash_table_insert(users, user->nick, user);

	/* password, flags, modify time */
	user->password = g_strdup(config_node_get_str(node, "password", NULL));
	user->flags = botuser_flags2value(config_node_get_str(node, "flags", ""));
	user->last_modify = (time_t) config_node_get_int(node, "last_modify", 0);

	/* get masks */
        user->masks = NULL;
	subnode = config_node_section(node, "masks", -1);
	tmp = subnode == NULL ? NULL : subnode->value;
	for (; tmp != NULL; tmp = tmp->next) {
		subnode = tmp->data;

		value = config_node_get_str(subnode, "mask", NULL);
		if (value == NULL) continue; /* mask is required */

		usermask = botuser_create_mask(user, value);
		value = config_node_get_str(subnode, "not_flags", "");
		usermask->not_flags = botuser_flags2value(value);
	}

	/* get channels - must be last, messes up pvalue */
	user->channels = g_hash_table_new((GHashFunc) g_istr_hash, (GCompareFunc) g_istr_equal);
	subnode = config_node_section(node, "channels", -1);
	tmp = subnode == NULL ? NULL : subnode->value;
	for (; tmp != NULL; tmp = tmp->next) {
		subnode = tmp->data;

		value = config_node_get_str(subnode, "channel", NULL);
		if (value == NULL) continue; /* channel is required */

		/* create user channel specific record */
		userchan = g_new0(USER_CHAN_REC, 1);
		userchan->channel = g_strdup(value);
		g_hash_table_insert(user->channels, userchan->channel, userchan);

		value = config_node_get_str(subnode, "flags", "");
		userchan->flags = botuser_flags2value(value);
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:59,代码来源:bot-users.c

示例6: log_items_update_config

static void log_items_update_config(LOG_REC *log, CONFIG_NODE *parent)
{
	GSList *tmp;
	CONFIG_NODE *node;

	parent = config_node_section(parent, "items", NODE_TYPE_LIST);
	for (tmp = log->items; tmp != NULL; tmp = tmp->next) {
		LOG_ITEM_REC *rec = tmp->data;

                node = config_node_section(parent, NULL, NODE_TYPE_BLOCK);
		iconfig_node_set_str(node, "type", log_item_types[rec->type]);
		iconfig_node_set_str(node, "name", rec->name);
		iconfig_node_set_str(node, "server", rec->servertag);
	}
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:15,代码来源:log.c

示例7: windows_layout_restore

void windows_layout_restore(void)
{
	WINDOW_REC *window;
	CONFIG_NODE *node;
	GSList *tmp;

	node = iconfig_node_traverse("windows", FALSE);
	if (node == NULL) return;

	for (tmp = node->value; tmp != NULL; tmp = tmp->next) {
		CONFIG_NODE *node = tmp->data;

		window = window_create(NULL, TRUE);
		window_set_refnum(window, atoi(node->key));
                window->sticky_refnum = config_node_get_bool(node, "sticky_refnum", FALSE);
		window_set_name(window, config_node_get_str(node, "name", NULL));
		window_set_level(window, level2bits(config_node_get_str(node, "level", "")));

		window->servertag = g_strdup(config_node_get_str(node, "servertag", NULL));
		window->theme_name = g_strdup(config_node_get_str(node, "theme", NULL));
		if (window->theme_name != NULL)
			window->theme = theme_load(window->theme_name);

		window_add_items(window, config_node_section(node, "items", -1));
		signal_emit("window restore", 2, window, node);
	}

	signal_emit("windows restored", 0);
}
开发者ID:svn2github,项目名称:irssi,代码行数:29,代码来源:windows-layout.c

示例8: session_save_server

static void session_save_server(SERVER_REC *server, CONFIG_REC *config,
				CONFIG_NODE *node)
{
	int handle;

	node = config_node_section(node, NULL, NODE_TYPE_BLOCK);

	config_node_set_str(config, node, "chat_type",
			    chat_protocol_find_id(server->chat_type)->name);
	config_node_set_str(config, node, "address", server->connrec->address);
	config_node_set_int(config, node, "port", server->connrec->port);
	config_node_set_str(config, node, "chatnet", server->connrec->chatnet);
	config_node_set_str(config, node, "password", server->connrec->password);
	config_node_set_str(config, node, "nick", server->nick);

	config_node_set_bool(config, node, "use_ssl", server->connrec->use_ssl);

	handle = g_io_channel_unix_get_fd(net_sendbuffer_handle(server->handle));
	config_node_set_int(config, node, "handle", handle);

	signal_emit("session save server", 3, server, config, node);

	/* fake the server disconnection */
	g_io_channel_unref(net_sendbuffer_handle(server->handle));
	net_sendbuffer_destroy(server->handle, FALSE);
	server->handle = NULL;

	server->connection_lost = TRUE;
        server->no_reconnect = TRUE;
        server_disconnect(server);
}
开发者ID:svn2github,项目名称:irssi,代码行数:31,代码来源:session.c

示例9: config_node_traverse

static CONFIG_NODE *config_sbar_node(CONFIG_REC *config, const char *name, gboolean create)
{
	CONFIG_NODE *node;

	node = config_node_traverse(config, "statusbar", create);
	if (node != NULL) {
		node = config_node_section(config, node, active_statusbar_group->name,
		                           create ? NODE_TYPE_BLOCK : -1);
	}

	if (node != NULL) {
		node = config_node_section(config, node, name, create ? NODE_TYPE_BLOCK : -1);
	}

	return node;
}
开发者ID:ailin-nemui,项目名称:irssi,代码行数:16,代码来源:statusbar-config.c

示例10: g_return_val_if_fail

/* find the section with the whole path.
   create the path if necessary `create' is TRUE. */
CONFIG_NODE *config_node_traverse(CONFIG_REC *rec, const char *section, int create)
{
	CONFIG_NODE *node;
	char **list, **tmp, *str;
	int is_list, new_type;

	g_return_val_if_fail(rec != NULL, NULL);

	if (section == NULL || *section == '\0')
		return rec->mainnode;

	/* check if it already exists in cache */
	node = g_hash_table_lookup(rec->cache, section);
	if (node != NULL) return node;

        new_type = -1;

	node = rec->mainnode;
	list = g_strsplit(section, "/", -1);
	for (tmp = list; *tmp != NULL; tmp++) {
		is_list = **tmp == '(';
		if (create) new_type = is_list ? NODE_TYPE_LIST : NODE_TYPE_BLOCK;

		node = config_node_section(node, *tmp + is_list, new_type);
		if (node == NULL) return NULL;
	}
	g_strfreev(list);

	/* save to cache */
        str = g_strdup(section);
	g_hash_table_insert(rec->cache, str, node);
	g_hash_table_insert(rec->cache_nodes, node, str);
	return node;
}
开发者ID:svn2github,项目名称:irssi,代码行数:36,代码来源:get.c

示例11: module_save

static void module_save(const char *module, MODULE_THEME_REC *rec,
                        THEME_SAVE_REC *data)
{
	CONFIG_NODE *fnode, *node;
	FORMAT_REC *formats;
	int n;

        formats = g_hash_table_lookup(default_formats, rec->name);
	if (formats == NULL) return;

	fnode = config_node_traverse(data->config, "formats", TRUE);

	node = config_node_section(fnode, rec->name, NODE_TYPE_BLOCK);
	for (n = 1; formats[n].def != NULL; n++) {
                if (rec->formats[n] != NULL) {
                        config_node_set_str(data->config, node, formats[n].tag,
                                            rec->formats[n]);
		} else if (data->save_all && formats[n].tag != NULL) {
                        config_node_set_str(data->config, node, formats[n].tag,
                                            formats[n].def);
		}
        }

        if (node->value == NULL) {
                /* not modified, don't keep the empty section */
                config_node_remove(data->config, fnode, node);
		if (fnode->value == NULL) {
			config_node_remove(data->config,
					   data->config->mainnode, fnode);
		}
        }
}
开发者ID:x3ro,项目名称:macirssi-irrsi,代码行数:32,代码来源:themes.c

示例12: sig_layout_restore

static void sig_layout_restore(void)
{
	WINDOW_REC *window;
	CONFIG_NODE *node;
	GSList *tmp;

	node = iconfig_node_traverse("windows", FALSE);
	if (node == NULL) return;

	tmp = config_node_first(node->value);
	for (; tmp != NULL; tmp = config_node_next(tmp)) {
		CONFIG_NODE *node = tmp->data;

		window = window_find_refnum(atoi(node->key));
		if (window == NULL)
			window = window_create(NULL, TRUE);

		window_set_refnum(window, atoi(node->key));
                window->sticky_refnum = config_node_get_bool(node, "sticky_refnum", FALSE);
                window->immortal = config_node_get_bool(node, "immortal", FALSE);
		window_set_name(window, config_node_get_str(node, "name", NULL));
		window_set_history(window, config_node_get_str(node, "history_name", NULL));
		window_set_level(window, level2bits(config_node_get_str(node, "level", "")));

		window->servertag = g_strdup(config_node_get_str(node, "servertag", NULL));
		window->theme_name = g_strdup(config_node_get_str(node, "theme", NULL));
		if (window->theme_name != NULL)
			window->theme = theme_load(window->theme_name);

		window_add_items(window, config_node_section(node, "items", -1));
		signal_emit("layout restore window", 2, window, node);
	}
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:33,代码来源:windows-layout.c

示例13: window_save

static void window_save(WINDOW_REC *window, CONFIG_NODE *node)
{
	char refnum[MAX_INT_STRLEN];

        ltoa(refnum, window->refnum);
	node = config_node_section(node, refnum, NODE_TYPE_BLOCK);

	if (window->sticky_refnum)
		iconfig_node_set_bool(node, "sticky_refnum", TRUE);

	if (window->immortal)
		iconfig_node_set_bool(node, "immortal", TRUE);

	if (window->name != NULL)
		iconfig_node_set_str(node, "name", window->name);

	if (window->history_name != NULL)
		iconfig_node_set_str(node, "history_name", window->history_name);

	if (window->servertag != NULL)
		iconfig_node_set_str(node, "servertag", window->servertag);
	if (window->level != 0) {
                char *level = bits2level(window->level);
		iconfig_node_set_str(node, "level", level);
		g_free(level);
	}
	if (window->theme_name != NULL)
		iconfig_node_set_str(node, "theme", window->theme_name);

	if (window->items != NULL)
		window_save_items(window, node);

	signal_emit("layout save window", 2, window, node);
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:34,代码来源:windows-layout.c

示例14: sig_layout_save_item

static void sig_layout_save_item(WINDOW_REC *window, WI_ITEM_REC *item,
				 CONFIG_NODE *node)
{
	CONFIG_NODE *subnode;
        CHAT_PROTOCOL_REC *proto;
	const char *type;

	type = module_find_id_str("WINDOW ITEM TYPE", item->type);
	if (type == NULL)
		return;

	subnode = config_node_section(node, NULL, NODE_TYPE_BLOCK);

	iconfig_node_set_str(subnode, "type", type);
	proto = item->chat_type == 0 ? NULL :
		chat_protocol_find_id(item->chat_type);
	if (proto != NULL)
		iconfig_node_set_str(subnode, "chat_type", proto->name);
	iconfig_node_set_str(subnode, "name", item->visible_name);

	if (item->server != NULL)
		iconfig_node_set_str(subnode, "tag", item->server->tag);
	else if (IS_QUERY(item)) {
		iconfig_node_set_str(subnode, "tag", QUERY(item)->server_tag);
	}
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:26,代码来源:windows-layout.c

示例15: read_ignores

static void read_ignores(void)
{
	IGNORE_REC *rec;
	CONFIG_NODE *node;
	GSList *tmp;

	while (ignores != NULL)
                ignore_destroy(ignores->data);

	node = iconfig_node_traverse("ignores", FALSE);
	if (node == NULL) return;

	for (tmp = node->value; tmp != NULL; tmp = tmp->next) {
		node = tmp->data;

		if (node->type != NODE_TYPE_BLOCK)
			continue;

		rec = g_new0(IGNORE_REC, 1);
		ignores = g_slist_append(ignores, rec);

		rec->mask = g_strdup(config_node_get_str(node, "mask", NULL));
		rec->pattern = g_strdup(config_node_get_str(node, "pattern", NULL));
		rec->level = level2bits(config_node_get_str(node, "level", ""));
		rec->except_level = level2bits(config_node_get_str(node, "except_level", ""));
		rec->regexp = config_node_get_bool(node, "regexp", FALSE);
		rec->fullword = config_node_get_bool(node, "fullword", FALSE);
		rec->replies = config_node_get_bool(node, "replies", FALSE);

		node = config_node_section(node, "channels", -1);
		if (node != NULL) rec->channels = config_node_get_list(node);
	}
}
开发者ID:svn2github,项目名称:irssi,代码行数:33,代码来源:ignore.c


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