Ejemplo n.º 1
0
Archivo: hash.c Proyecto: NX-Andro/x3
void
DelChannelUser(struct userNode* user, struct chanNode* channel, const char *reason, int deleting)
{
    struct modeNode* mNode;
    unsigned int n;

    if (IsLocal(user) && reason)
        irc_part(user, channel, reason);

    mNode = GetUserMode(channel, user);

    /* Sometimes we get a PART when the user has been KICKed.
     * In this case, we get no usermode, and should not try to free it.
     */
    if (!mNode)
        return;

    /* remove modeNode from channel and user */
    modeList_remove(&channel->members, mNode);
    modeList_remove(&user->channels, mNode);

    /* make callbacks */
    for (n=0; n<pf_used; n++)
	pf_list[n](mNode, reason, pf_list_extra[n]);

    /* free memory */
    free(mNode);

    /* A single check for APASS only should be enough here */
    if (!deleting && !channel->members.used && !channel->locks
        && !(channel->modes & MODE_REGISTERED) && !(channel->modes & MODE_APASS))
        DelChannel(channel);
}
Ejemplo n.º 2
0
void test_irc_part() {
    char msg[READ_BUF];

    irc_part("#circus");
    read_mock(msg);

    mu_assert(s_eq(msg, "PART #circus\r\n"), "test_irc_part: msg should be 'PART #circus\\r\\n'");
}
Ejemplo n.º 3
0
Archivo: hash.c Proyecto: NX-Andro/x3
void
ChannelUserKicked(struct userNode* kicker, struct userNode* victim, struct chanNode* channel)
{
    unsigned int n;
    struct modeNode *mn;

    if (!victim || !channel || !GetUserMode(channel, victim))
        return;

    /* Update the kicker's idle time (kicker may be null if it was a server) */
    if (kicker && (mn = GetUserMode(channel, kicker)))
        mn->idle_since = now;

    for (n=0; n<kf_used; n++)
	kf_list[n](kicker, victim, channel, kf_list_extra[n]);

    DelChannelUser(victim, channel, 0, 0);

    if (IsLocal(victim))
	irc_part(victim, channel, NULL);
}
Ejemplo n.º 4
0
Archivo: irc.c Proyecto: Skeen/OSAA_IRC
int irc_leave_channel(irc_t *irc)
{
   return irc_part(irc->s, irc->channel);
}
Ejemplo n.º 5
0
static int irc_leave_channel(irc_t *irc, const char* channel) {
   return irc_part(irc->s, channel);
}