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


C++ rb_current_time函数代码示例

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


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

示例1: scache_split

void
scache_split(struct scache_entry *ptr)
{
	if (ptr == NULL)
		return;
	ptr->flags &= ~SC_ONLINE;
	ptr->last_split = rb_current_time();
}
开发者ID:Cloudxtreme,项目名称:ircd-seven,代码行数:8,代码来源:scache.c

示例2: m_cycle

static int
m_cycle(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    char *p, *name;
    char *s = LOCAL_COPY(parv[1]);
    struct Channel *chptr;
    struct membership *msptr;

    name = rb_strtok_r(s, ",", &p);

    /* Finish the flood grace period... */
    if(MyClient(source_p) && !IsFloodDone(source_p))
        flood_endgrace(source_p);

    while(name) {
        if((chptr = find_channel(name)) == NULL) {
            sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
            return 0;
        }

        msptr = find_channel_membership(chptr, source_p);
        if(msptr == NULL) {
            sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
            return 0;
        }

        if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
            check_spambot_warning(source_p, NULL);

        if((is_any_op(msptr) || !MyConnect(source_p) ||
            ((can_send(chptr, source_p, msptr) > 0 &&
              (source_p->localClient->firsttime +
               ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time())))) {
            sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                          ":%s PART %s :Cycling", use_id(source_p), chptr->chname);
            sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s :Cycling",
                                 source_p->name, source_p->username,
                                 source_p->host, chptr->chname);
        } else {
            sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                          ":%s PART %s", use_id(source_p), chptr->chname);
            sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s",
                                 source_p->name, source_p->username,
                                 source_p->host, chptr->chname);
        }

        remove_user_from_channel(msptr);

        chptr = NULL;
        msptr = NULL;

        name = rb_strtok_r(NULL, ",", &p);
    }

    user_join(client_p, source_p, parv[1], parc > 2 ? parv[2] : NULL);

    return 0;
}
开发者ID:Cloudxtreme,项目名称:elemental-ircd,代码行数:58,代码来源:m_cycle.c

示例3: mr_admin

/*
 * mr_admin - ADMIN command handler
 *      parv[1] = servername
 */
static int
mr_admin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    static time_t last_used = 0L;

    if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
        sendto_one(source_p, form_str(RPL_LOAD2HI),
                   me.name,
                   EmptyString(source_p->name) ? "*" : source_p->name,
                   "ADMIN");
        return 0;
    } else
        last_used = rb_current_time();

    do_admin(source_p);

    return 0;
}
开发者ID:CustomIRCd,项目名称:elemental-ircd,代码行数:22,代码来源:m_admin.c

示例4: m_mkpasswd

/* m_mkpasswd - mkpasswd message handler
 *	parv[1] = password
 *	parv[2] = type
 */
static int
m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    static time_t last_used = 0;
    char *salt;
    const char *hashtype;
    const char hashdefault[] = "SHA512";

    if(EmptyString(parv[1]))
    {
        sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
        return 0;
    }

    if(parc < 3)
        hashtype = hashdefault;
    else
        hashtype = parv[2];

    if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
    {
        /* safe enough to give this on a local connect only */
        sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MKPASSWD");
        return 0;
    }
    else
        last_used = rb_current_time();

    if(!irccmp(hashtype, "SHA256"))
        salt = make_sha256_salt(16);
    else if(!irccmp(hashtype, "SHA512"))
        salt = make_sha512_salt(16);
    else if(!irccmp(hashtype, "MD5"))
        salt = make_md5_salt(8);
    else
    {
        sendto_one_notice(source_p,
                          ":MKPASSWD syntax error:  MKPASSWD pass [SHA256|SHA512|MD5]");
        return 0;
    }

    sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
    return 0;
}
开发者ID:eduardobmoreira,项目名称:ircd-seven,代码行数:48,代码来源:m_mkpasswd.c

示例5: m_motd

/*
** m_motd
**      parv[1] = servername
*/
static int
m_motd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	static time_t last_used = 0;
	if ((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
		/* safe enough to give this on a local connect only */
		sendto_one(source_p, form_str(RPL_LOAD2HI),
		           me.name, source_p->name, "MOTD");
		sendto_one(source_p, form_str(RPL_ENDOFMOTD),
		           me.name, source_p->name);
		return 0;
	} else
		last_used = rb_current_time();
	if (hunt_server(client_p, source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME)
		return 0;
	motd_spy(source_p);
	send_user_motd(source_p);
	return 0;
}
开发者ID:Codyle,项目名称:elemental-ircd,代码行数:23,代码来源:m_motd.c

示例6: part_one_client

/*
 * part_one_client
 *
 * inputs	- pointer to server
 * 		- pointer to source client to remove
 *		- char pointer of name of channel to remove from
 * output	- none
 * side effects	- remove ONE client given the channel name
 */
static void
part_one_client(struct Client *client_p, struct Client *source_p, char *name, char *reason)
{
    struct Channel *chptr;
    struct membership *msptr;
    char reason2[BUFSIZE];

    if((chptr = find_channel(name)) == NULL)
    {
        sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
        return;
    }

    msptr = find_channel_membership(chptr, source_p);
    if(msptr == NULL)
    {
        sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
        return;
    }

    if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
        check_spambot_warning(source_p, NULL);

    /*
     *  Remove user from the old channel (if any)
     *  only allow /part reasons in -m chans
     */
    if(reason[0] && (is_chanop(msptr) || !MyConnect(source_p) ||
                     ((can_send(chptr, source_p, msptr) > 0 &&
                       (source_p->localClient->firsttime +
                        ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time()))))
    {
        if(chptr->mode.mode & MODE_NOCOLOR)
        {
            rb_strlcpy(reason2, reason, BUFSIZE);
            strip_colour(reason2);
            reason = reason2;
        }
        sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                      ":%s PART %s :%s", use_id(source_p), chptr->chname, reason);
        sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s :%s",
                             source_p->name, source_p->username,
                             source_p->host, chptr->chname, reason);
    }
    else
    {
        sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                      ":%s PART %s", use_id(source_p), chptr->chname);
        sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s",
                             source_p->name, source_p->username,
                             source_p->host, chptr->chname);
    }
    remove_user_from_channel(msptr);
}
开发者ID:carriercomm,项目名称:blitzed-charybdis,代码行数:63,代码来源:m_part.c

示例7: rb_ssl_info_callback

static void
rb_ssl_info_callback(SSL * ssl, int where, int ret)
{
	if(where & SSL_CB_HANDSHAKE_START)
	{
		rb_fde_t *F = SSL_get_ex_data(ssl, libratbox_index);
		if(F == NULL)
			return;
		F->handshake_count++;
		F->last_handshake = rb_current_time();
	}
}
开发者ID:thors,项目名称:ircd-ratbox,代码行数:12,代码来源:openssl.c

示例8: m_admin

/*
 * m_admin - ADMIN command handler
 *      parv[1] = servername
 */
static int
m_admin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    static time_t last_used = 0L;

    if(parc > 1) {
        if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
            sendto_one(source_p, form_str(RPL_LOAD2HI),
                       me.name, source_p->name, "ADMIN");
            return 0;
        } else
            last_used = rb_current_time();

        if(hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME)
            return 0;
    }

    do_admin(source_p);

    return 0;
}
开发者ID:CustomIRCd,项目名称:elemental-ircd,代码行数:25,代码来源:m_admin.c

示例9: m_version

/*
 * m_version - VERSION command handler
 *      parv[1] = remote server
 */
static int
m_version(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	static time_t last_used = 0L;
	if (parc > 1) {
		if ((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
			/* safe enough to give this on a local connect only */
			sendto_one(source_p, form_str(RPL_LOAD2HI),
			           me.name, source_p->name, "VERSION");
			return 0;
		} else
			last_used = rb_current_time();
		if (hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
			return 0;
	}
	sendto_one_numeric(source_p, RPL_VERSION, form_str(RPL_VERSION),
	                   ircd_version, serno,
	                   me.name, confopts(source_p), TS_CURRENT,
	                   ServerInfo.sid);
	show_isupport(source_p);
	return 0;
}
开发者ID:Codyle,项目名称:elemental-ircd,代码行数:26,代码来源:m_version.c

示例10: scache_connect

struct scache_entry *
scache_connect(const char *name, const char *info, int hidden)
{
	struct scache_entry *ptr;

	ptr = find_or_add(name);
	rb_strlcpy(ptr->info, info, sizeof(ptr->info));
	ptr->flags |= SC_ONLINE;
	if (hidden)
		ptr->flags |= SC_HIDDEN;
	else
		ptr->flags &= ~SC_HIDDEN;
	ptr->last_connect = rb_current_time();
	return ptr;
}
开发者ID:Cloudxtreme,项目名称:ircd-seven,代码行数:15,代码来源:scache.c

示例11: m_time

/*
 * m_time
 *      parv[0] = sender prefix
 *      parv[1] = servername
 */
static int
m_time(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    /* this is not rate limited, so end the grace period */
    char buf[80];
    if (MyClient(source_p) && !IsFloodDone(source_p))
        flood_endgrace(source_p);


    if (hunt_server(client_p, source_p, ":%s TIME :%s", 1, parc, parv) == HUNTED_ISME)
    {
        sendto_one_numeric(source_p, RPL_TIME, form_str(RPL_TIME),
                           me.name, rb_date(rb_current_time(), buf, sizeof(buf)));
    }
    return 0;
}
开发者ID:azzurra,项目名称:bluebox,代码行数:21,代码来源:m_time.c

示例12: rb_current_time

struct Client *get_history(const char *nick, time_t timelimit)
{
	struct Whowas *temp;
	int blah;
	timelimit = rb_current_time() - timelimit;
	blah = hash_whowas_name(nick);
	temp = WHOWASHASH[blah];
	for (; temp; temp = temp->next) {
		if (irccmp(nick, temp->name))
			continue;
		if (temp->logoff < timelimit)
			continue;
		return temp->online;
	}
	return NULL;
}
开发者ID:Codyle,项目名称:elemental-ircd,代码行数:16,代码来源:whowas.c

示例13: ms_eob

/*
** ms_eob
**      parv[0] = sender prefix
**      parv[1] = opt. comma separated list of SIDs for which this EOB is
**                also valid
*/
static int
ms_eob(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	char *copy, *state, *id;
	struct Client *target_p;
	int act = 0;

	if(!HasSentEob(source_p))
	{
		if(MyConnect(source_p))
		{
			sendto_realops_flags(UMODE_ALL, L_ALL,
					     "End of burst from %s (%d seconds)",
					     source_p->name,
					     (signed int)(rb_current_time() -
							  source_p->localClient->firsttime));
			sendto_one(source_p, ":%s EOBACK", me.id);
		}
		act = 1;
		SetEob(source_p);
		eob_count++;
	}
	if(parc > 1 && *parv[1] != '\0')
	{
		copy = LOCAL_COPY(parv[1]);
		for(id = rb_strtok_r(copy, ",", &state); id != NULL;
				id = rb_strtok_r(NULL, ",", &state))
		{
			target_p = find_id(id);
			if(target_p != NULL && IsServer(target_p) &&
					target_p->from == client_p &&
					!HasSentEob(target_p))
			{
				SetEob(target_p);
				eob_count++;
				act = 1;
			}
		}
	}
	if(!act)
		return 0;
	sendto_server(client_p, NULL, CAP_IRCNET, NOCAPS, ":%s EOB%s%s",
			source_p->id,
			parc > 1 ? " :" : "", parc > 1 ? parv[1] : "");

	return 0;
}
开发者ID:katlogic,项目名称:ircd-ratbox-ircnet,代码行数:53,代码来源:m_eob.c

示例14: add_history

void
add_history(struct Client *client_p, int online)
{
	struct Whowas *who = &WHOWAS[whowas_next];

	s_assert(NULL != client_p);

	if(client_p == NULL)
		return;

	if(who->hashv != -1)
	{
		if(who->online)
			del_whowas_from_clist(&(who->online->whowas), who);
		del_whowas_from_list(&WHOWASHASH[who->hashv], who);
	}
	who->hashv = hash_whowas_name(client_p->name);
	who->logoff = rb_current_time();
	/*
	 * NOTE: strcpy ok here, the sizes in the client struct MUST
	 * match the sizes in the whowas struct
	 */
	rb_strlcpy(who->name, client_p->name, sizeof(who->name));
	strcpy(who->username, client_p->username);
	strcpy(who->hostname, client_p->host);
	strcpy(who->realname, client_p->info);
	strcpy(who->suser, client_p->user->suser);
	if(!EmptyString(client_p->sockhost) && strcmp(client_p->sockhost, "0")
	   && show_ip(NULL, client_p))
		strcpy(who->sockhost, client_p->sockhost);
	else
		who->sockhost[0] = '\0';

	who->servername = scache_get_name(client_p->servptr->serv->nameinfo);

	if(online)
	{
		who->online = client_p;
		add_whowas_to_clist(&(client_p->whowas), who);
	}
	else
		who->online = NULL;
	add_whowas_to_list(&WHOWASHASH[who->hashv], who);
	whowas_next++;
	if(whowas_next == NICKNAMEHISTORYLENGTH)
		whowas_next = 0;
}
开发者ID:alyx,项目名称:sporksircd,代码行数:47,代码来源:whowas.c

示例15: ms_pong

static int
ms_pong(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	struct Client *target_p;
	const char *destination;

	destination = parv[2];
	source_p->flags &= ~FLAGS_PINGSENT;

	/* Now attempt to route the PONG, comstud pointed out routable PING
	 * is used for SPING.  routable PING should also probably be left in
	 *        -Dianora
	 * That being the case, we will route, but only for registered clients (a
	 * case can be made to allow them only from servers). -Shadowfax
	 */
	if(!EmptyString(destination) && !match(destination, me.name) &&
	   irccmp(destination, me.id))
	{
		if((target_p = find_client(destination)))
			sendto_one(target_p, ":%s PONG %s %s", 
				   get_id(source_p, target_p), parv[1], 
				   get_id(target_p, target_p));
		else
		{
			if(!IsDigit(*destination))
				sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
						   form_str(ERR_NOSUCHSERVER), destination);
			return 0;
		}
	}

	/* destination is us, emulate EOB */
	if(IsServer(source_p) && !HasSentEob(source_p))
	{
		if(MyConnect(source_p))
			sendto_realops_snomask(SNO_GENERAL, L_ALL,
					     "End of burst (emulated) from %s (%d seconds)",
					     source_p->name,
					     (signed int) (rb_current_time() - source_p->localClient->firsttime));
		SetEob(source_p);
		eob_count++;
		call_hook(h_server_eob, source_p);
	}

	return 0;
}
开发者ID:ChatLounge,项目名称:ChatIRCd,代码行数:46,代码来源:m_pong.c


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