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


C++ IS_SERVER函数代码示例

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


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

示例1: server_unref

int server_unref(SERVER_REC *server)
{
    g_return_val_if_fail(IS_SERVER(server), FALSE);

    if (--server->refcount > 0)
        return TRUE;

    if (g_slist_find(servers, server) != NULL) {
        g_warning("Non-referenced server wasn't disconnected");
        server_disconnect(server);
        return TRUE;
    }

    MODULE_DATA_DEINIT(server);
    server_connect_unref(server->connrec);
    if (server->rawlog != NULL) rawlog_destroy(server->rawlog);
    g_free(server->version);
    g_free(server->away_reason);
    g_free(server->nick);
    g_free(server->tag);

    server->type = 0;
    g_free(server);
    return FALSE;
}
开发者ID:vague666,项目名称:irssi,代码行数:25,代码来源:servers.c

示例2: server_connect_callback_init_ssl

static void server_connect_callback_init_ssl(SERVER_REC *server, GIOChannel *handle)
{
    int error;

    g_return_if_fail(IS_SERVER(server));

    error = irssi_ssl_handshake(handle);
    if (error == -1) {
        server->connection_lost = TRUE;
        server_connect_failed(server, NULL);
        return;
    }
    if (error & 1) {
        if (server->connect_tag != -1)
            g_source_remove(server->connect_tag);
        server->connect_tag = g_input_add(handle, error == 1 ? G_INPUT_READ : G_INPUT_WRITE,
                                          (GInputFunction)
                                          server_connect_callback_init_ssl,
                                          server);
        return;
    }

    lookup_servers = g_slist_remove(lookup_servers, server);
    if (server->connect_tag != -1) {
        g_source_remove(server->connect_tag);
        server->connect_tag = -1;
    }

    server_connect_finished(server);
}
开发者ID:vague666,项目名称:irssi,代码行数:30,代码来源:servers.c

示例3: server_connect_failed

/* connection to server failed */
void server_connect_failed(SERVER_REC *server, const char *msg)
{
    g_return_if_fail(IS_SERVER(server));

    lookup_servers = g_slist_remove(lookup_servers, server);

    signal_emit("server connect failed", 2, server, msg);

    if (server->connect_tag != -1) {
        g_source_remove(server->connect_tag);
        server->connect_tag = -1;
    }
    if (server->handle != NULL) {
        net_sendbuffer_destroy(server->handle, TRUE);
        server->handle = NULL;
    }

    if (server->connect_pipe[0] != NULL) {
        g_io_channel_shutdown(server->connect_pipe[0], TRUE, NULL);
        g_io_channel_unref(server->connect_pipe[0]);
        g_io_channel_shutdown(server->connect_pipe[1], TRUE, NULL);
        g_io_channel_unref(server->connect_pipe[1]);
        server->connect_pipe[0] = NULL;
        server->connect_pipe[1] = NULL;
    }

    server_unref(server);
}
开发者ID:vague666,项目名称:irssi,代码行数:29,代码来源:servers.c

示例4: cmd_wait

/* SYNTAX: WAIT [-<server tag>] <milliseconds> */
static void cmd_wait(const char *data, IRC_SERVER_REC *server)
{
	GHashTable *optlist;
	char *msecs;
	void *free_arg;
	int n;

	g_return_if_fail(data != NULL);
	if (!IS_SERVER(server) || !server->connected)
		cmd_return_error(CMDERR_NOT_CONNECTED);

	if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
			    PARAM_FLAG_UNKNOWN_OPTIONS | PARAM_FLAG_GETREST,
			    NULL, &optlist, &msecs))
		return;

	if (*msecs == '\0')
		cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

	/* -<server tag> */
	server = IRC_SERVER(cmd_options_get_server(NULL, optlist,
						   SERVER(server)));

	n = atoi(msecs);
	if (server != NULL && n > 0) {
		g_get_current_time(&server->wait_cmd);
		server->wait_cmd.tv_sec += n/1000;
		server->wait_cmd.tv_usec += n%1000;
		if (server->wait_cmd.tv_usec >= 1000) {
			server->wait_cmd.tv_sec++;
			server->wait_cmd.tv_usec -= 1000;
		}
	}
	cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:36,代码来源:irc-commands.c

示例5: cmd_cycle

/* SYNTAX: CYCLE [<channel>] [<message>] */
static void cmd_cycle(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
{
	CHANNEL_REC *chanrec;
	char *channame, *msg, *joindata;
	void *free_arg;

	g_return_if_fail(data != NULL);
	if (!IS_SERVER(server) || !server->connected)
		cmd_return_error(CMDERR_NOT_CONNECTED);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN,
			    item, &channame, &msg))
		return;
	if (*channame == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);

	chanrec = channel_find(server, channame);
	if (chanrec == NULL) cmd_param_error(CMDERR_CHAN_NOT_FOUND);

	joindata = chanrec->get_join_data(chanrec);
	window_bind_add(window_item_window(chanrec),
			chanrec->server->tag, chanrec->name);

	/* FIXME: kludgy kludgy... */
	signal_emit("command part", 3, data, server, item);

	if (g_slist_find(channels, chanrec) != NULL) {
		chanrec->left = TRUE;
		channel_destroy(chanrec);
	}

	server->channels_join(server, joindata, FALSE);
	g_free(joindata);

	cmd_params_free(free_arg);
}
开发者ID:Mistuke,项目名称:irssi,代码行数:36,代码来源:fe-channels.c

示例6: Handle

	CmdResult Handle (const std::vector<std::string>& parameters, User *user)
	{
		User* dest = ServerInstance->FindNick(parameters[0]);
		if ((dest) && (!IS_SERVER(dest)))
		{
			if (ServerInstance->ULine(dest->server))
			{
				user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
				return CMD_FAILURE;
			}

			// Pass the command on, so the client's server can quit it properly.
			if (!IS_LOCAL(dest))
				return CMD_SUCCESS;

			ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SAQUIT to make "+dest->nick+" quit with a reason of "+parameters[1]);

			ServerInstance->Users->QuitUser(dest, parameters[1]);
			return CMD_SUCCESS;
		}
		else
		{
			user->WriteNotice("*** Invalid nickname '" + parameters[0] + "'");
			return CMD_FAILURE;
		}
	}
开发者ID:Paciik,项目名称:inspircd,代码行数:26,代码来源:m_saquit.cpp

示例7: unserialize

	void unserialize(SerializeFormat format, Extensible* container, const std::string& value)
	{
		if (format == FORMAT_NETWORK)
			return;

		callerid_data* dat = new callerid_data;
		irc::commasepstream s(value);
		std::string tok;
		if (s.GetToken(tok))
			dat->lastnotify = ConvToInt(tok);

		while (s.GetToken(tok))
		{
			User *u = ServerInstance->FindNick(tok);
			if ((u) && (u->registered == REG_ALL) && (!u->quitting) && (!IS_SERVER(u)))
			{
				if (dat->accepting.insert(u).second)
				{
					callerid_data* other = this->get(u, true);
					other->wholistsme.push_back(dat);
				}
			}
		}

		void* old = set_raw(container, dat);
		if (old)
			this->free(old);
	}
开发者ID:Paciik,项目名称:inspircd,代码行数:28,代码来源:m_callerid.cpp

示例8: Away

bool TreeSocket::Away(const std::string &prefix, parameterlist &params)
{
	User* u = ServerInstance->FindNick(prefix);
	if ((!u) || (IS_SERVER(u)))
		return true;
	if (params.size())
	{
		FOREACH_MOD(I_OnSetAway, OnSetAway(u, params[params.size() - 1]));

		if (params.size() > 1)
			u->awaytime = atoi(params[0].c_str());
		else
			u->awaytime = ServerInstance->Time();

		u->awaymsg = params[params.size() - 1];

		params[params.size() - 1] = ":" + params[params.size() - 1];
	}
	else
	{
		FOREACH_MOD(I_OnSetAway, OnSetAway(u, ""));
		u->awaymsg.clear();
	}
	Utils->DoOneToAllButSender(prefix,"AWAY",params,u->server);
	return true;
}
开发者ID:Shawn-Smith,项目名称:InspIRCd,代码行数:26,代码来源:away.cpp

示例9: sig_not_in_roster

static void
sig_not_in_roster(XMPP_SERVER_REC *server, const char *jid)
{
	g_return_if_fail(IS_SERVER(server));
	g_return_if_fail(jid != NULL);
	printformat_module(MODULE_NAME, server, NULL,
	    MSGLEVEL_CLIENTERROR, XMPPTXT_NOT_IN_ROSTER, jid);
}
开发者ID:ailin-nemui,项目名称:irssi-xmpp,代码行数:8,代码来源:fe-rosters.c

示例10: sig_connected

static void sig_connected(SERVER_REC *server)
{
	g_return_if_fail(IS_SERVER(server));
	if (!server->connrec->reconnection)
		return;

	if (server->connrec->channels != NULL)
		server->channels_join(server, server->connrec->channels, TRUE);
}
开发者ID:svn2github,项目名称:irssi,代码行数:9,代码来源:servers-reconnect.c

示例11: show_group

static void
show_group(XMPP_SERVER_REC *server, XMPP_ROSTER_GROUP_REC *group)
{
	g_return_if_fail(IS_SERVER(server));
	g_return_if_fail(group != NULL);
	printformat_module(MODULE_NAME, server, NULL, MSGLEVEL_CRAP,
	    XMPPTXT_ROSTER_GROUP, (group->name != NULL) ?
	    group->name : settings_get_str("xmpp_roster_default_group"));
}
开发者ID:ailin-nemui,项目名称:irssi-xmpp,代码行数:9,代码来源:fe-rosters.c

示例12: server_get_variant

GVariant *
server_get_variant (Server * server)
{
	/* Okay, this doesn't do anything useful, but it will generate an error
	   which could be a good thing */
	g_return_val_if_fail(IS_SERVER(server), NULL);

	ServerClass * klass = SERVER_GET_CLASS(server);
	if (klass->get_properties != NULL) {
		GVariantBuilder tuple;
		g_variant_builder_init(&tuple, G_VARIANT_TYPE_TUPLE);

		if (IS_CITRIX_SERVER(server)) {
			g_variant_builder_add_value(&tuple, g_variant_new_string("ica"));
		} else if (IS_RDP_SERVER(server)) {
			g_variant_builder_add_value(&tuple, g_variant_new_string("freerdp"));
		} else if (IS_UCCS_SERVER(server)) {
			g_variant_builder_add_value(&tuple, g_variant_new_string("uccs"));
		} else if (IS_X2GO_SERVER(server)) {
			g_variant_builder_add_value(&tuple, g_variant_new_string("x2go"));
		} else {
			g_assert_not_reached();
		}

		if (server->name != NULL) {
			g_variant_builder_add_value(&tuple, g_variant_new_string(server->name));
		} else {
			g_warning("Server has no name");
			g_variant_builder_add_value(&tuple, g_variant_new_string(""));
		}

		if (server->uri != NULL) {
			g_variant_builder_add_value(&tuple, g_variant_new_string(server->uri));
		} else {
			g_warning("Server has no URI");
			g_variant_builder_add_value(&tuple, g_variant_new_string(""));
		}

		g_variant_builder_add_value(&tuple, g_variant_new_boolean(server->last_used));

		GVariant * props = klass->get_properties(server);
		g_variant_builder_add_value(&tuple, props);

		if (klass->get_applications != NULL) {
			GVariant * array = klass->get_applications(server);
			g_variant_builder_add_value(&tuple, array);
		} else {
			/* NULL array of applications */
			g_variant_builder_add_value(&tuple, g_variant_new_array(G_VARIANT_TYPE("(si)"), NULL, 0));
		}

		return g_variant_builder_end(&tuple);
	}

	return NULL;
}
开发者ID:ArcticaProject,项目名称:remote-logon-service,代码行数:56,代码来源:server.c

示例13: OnModeChange

		ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
		{
			if (IS_SERVER(source) || ServerInstance->ULine(source->server))
				return MODEACTION_ALLOW;
			else
			{
				if (source && channel)
					source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only servers are permitted to change channel mode '%c'", source->nick.c_str(), channel->name.c_str(), 'y');
				return MODEACTION_DENY;
			}
		}
开发者ID:H7-25,项目名称:inspircd,代码行数:11,代码来源:m_operprefix.cpp

示例14: server_cached_domains

/**
 * server_cached_domains:
 * @server: Where should we find those domains?
 *
 * Gets a list of cached domains for a particular server, if this function
 * isn't overriden, then a null array is returned.
 */
GVariant *
server_cached_domains (Server * server)
{
	g_return_val_if_fail(IS_SERVER(server), NULL);

	ServerClass * klass = SERVER_GET_CLASS(server);
	if (klass->get_domains != NULL) {
		return klass->get_domains(server);
	}

	return g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0);
}
开发者ID:ArcticaProject,项目名称:remote-logon-service,代码行数:19,代码来源:server.c

示例15: GetTargetAndAction

	ACCEPTAction GetTargetAndAction(std::string& tok)
	{
		bool remove = (tok[0] == '-');
		if ((remove) || (tok[0] == '+'))
			tok.erase(tok.begin());

		User* target = ServerInstance->FindNick(tok);
		if ((!target) || (target->registered != REG_ALL) || (target->quitting) || (IS_SERVER(target)))
			target = NULL;

		return std::make_pair(target, !remove);
	}
开发者ID:Paciik,项目名称:inspircd,代码行数:12,代码来源:m_callerid.cpp


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