コード例 #1
0
ファイル: whowas.c プロジェクト: alyx/sporksircd
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;
}
コード例 #2
0
ファイル: whowas.c プロジェクト: grawity/ircd-hybrid-6
void add_history(aClient* cptr, int online)
{
  aWhowas* who = &WHOWAS[whowas_next];

  assert(0 != cptr);

  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(cptr->name);
  who->logoff = CurrentTime;
  /*
   * NOTE: strcpy ok here, the sizes in the client struct MUST
   * match the sizes in the whowas struct
   */
  strncpy_irc(who->name, cptr->name, NICKLEN);
  who->name[NICKLEN] = '\0';
  strcpy(who->username, cptr->username);
  strcpy(who->hostname, cptr->host);
  strcpy(who->realname, cptr->info);

  /* Its not string copied, a pointer to the scache hash is copied
     -Dianora
   */
  /*  strncpy_irc(who->servername, cptr->user->server, HOSTLEN); */
  who->servername = cptr->user->server;

  if (online)
    {
      who->online = cptr;
      add_whowas_to_clist(&(cptr->whowas), who);
    }
  else
    who->online = NULL;
  add_whowas_to_list(&WHOWASHASH[who->hashv], who);
  whowas_next++;
  if (whowas_next == NICKNAMEHISTORYLENGTH)
    whowas_next = 0;
}
コード例 #3
0
ファイル: whowas.c プロジェクト: azzurra/bluebox
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();

    strcpy(who->name, client_p->name);
    strcpy(who->username, client_p->username);
    strcpy(who->hostname, client_p->host);
    strcpy(who->virthost, client_p->virthost);
    strcpy(who->realname, client_p->info);

    who->cloak = IsCloaked(client_p);

    who->servername = client_p->servptr->name;

    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;
}
コード例 #4
0
ファイル: whowas.c プロジェクト: Adam-/oftc-hybrid
void
add_history(struct Client *client_p, int online)
{
  struct Whowas *who = &WHOWAS[whowas_next];

  assert(client_p && client_p->servptr);

  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 = strhash(client_p->name);
  who->logoff = CurrentTime;

  /* NOTE: strcpy ok here, the sizes in the client struct MUST
   * match the sizes in the whowas struct
   */
  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);

  strlcpy(who->servername, client_p->servptr->name, sizeof(who->servername));

  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;
}