Exemplo n.º 1
0
/* Add new nick to list*/
NICK_REC *icb_nicklist_insert(ICB_CHANNEL_REC *channel, const char *nick,
	       		      int mod)
{
	NICK_REC *rec;

	g_return_val_if_fail(IS_ICB_CHANNEL(channel), NULL);
	g_return_val_if_fail(nick != NULL, NULL);

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

	/* Just use existing 'op' for moderator */
	if (mod) rec->op = TRUE;

	nicklist_insert(CHANNEL(channel), rec);
	return rec;
}
Exemplo n.º 2
0
XMPP_NICK_REC *
xmpp_nicklist_insert(MUC_REC *channel, const char *nickname,
    const char *full_jid)
{
	XMPP_NICK_REC *rec;

	g_return_val_if_fail(IS_MUC(channel), NULL);
	g_return_val_if_fail(nickname != NULL, NULL);
	rec = g_new0(XMPP_NICK_REC, 1);
	rec->nick = g_strdup(nickname);
	rec->host = (full_jid != NULL) ?
	    g_strdup(full_jid) : g_strconcat(channel->name, "/", rec->nick, (void *)NULL);
	rec->show = XMPP_PRESENCE_AVAILABLE;
	rec->status = NULL;
	rec->affiliation = XMPP_NICKLIST_AFFILIATION_NONE;
	rec->role = XMPP_NICKLIST_ROLE_NONE;
	nicklist_insert(CHANNEL(channel), (NICK_REC *)rec);
	return rec;
}
Exemplo n.º 3
0
static void event_names_list(const char *data, SERVER_REC *server)
{
	CHANNEL_REC *chanrec;
	char *params, *type, *channel, *names, *ptr;

	g_return_if_fail(data != NULL);

	params = event_get_params(data, 4, NULL, &type, &channel, &names);

	chanrec = channel_find(server, channel);
	if (chanrec == NULL || chanrec->names_got) {
		/* unknown channel / names list already read */
		g_free(params);
		return;
	}

	/* type = '=' = public, '*' = private, '@' = secret.

	   This is actually pretty useless to check here, but at least we
	   get to know if the channel is +p or +s a few seconds before
	   we receive the MODE reply... */
	if (*type == '*')
		parse_channel_modes(IRC_CHANNEL(chanrec), NULL, "+p");
	else if (*type == '@')
		parse_channel_modes(IRC_CHANNEL(chanrec), NULL, "+s");

	while (*names != '\0') {
		while (*names == ' ') names++;
		ptr = names;
		while (*names != '\0' && *names != ' ') names++;
		if (*names != '\0') *names++ = '\0';

		if (*ptr == '@' && g_strcasecmp(server->nick, ptr+1) == 0)
			chanrec->chanop = TRUE;

		nicklist_insert(chanrec, ptr+isnickflag(*ptr),
				*ptr == '@', *ptr == '+', FALSE);
	}

	g_free(params);
}
Exemplo n.º 4
0
/* Add new nick to list */
NICK_REC *irc_nicklist_insert(IRC_CHANNEL_REC *channel, const char *nick,
			      int op, int halfop, int voice, int send_massjoin,
			      const char *prefixes)
{
	NICK_REC *rec;

	g_return_val_if_fail(IS_IRC_CHANNEL(channel), NULL);
	g_return_val_if_fail(nick != NULL, NULL);

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

	if (op) rec->op = TRUE;
	if (halfop) rec->halfop = TRUE;
	if (voice) rec->voice = TRUE;
	rec->send_massjoin = send_massjoin;

	if (prefixes != NULL) {
		g_strlcpy(rec->prefixes, prefixes, sizeof(rec->prefixes));
	}

	nicklist_insert(CHANNEL(channel), rec);
	return rec;
}