static void irc_cmd_mode( irc_t *irc, char **cmd ) { if( irc_channel_name_ok( cmd[1] ) ) { irc_channel_t *ic; if( ( ic = irc_channel_by_name( irc, cmd[1] ) ) == NULL ) irc_send_num( irc, 403, "%s :No such channel", cmd[1] ); else if( cmd[2] ) { if( *cmd[2] == '+' || *cmd[2] == '-' ) irc_send_num( irc, 477, "%s :Can't change channel modes", cmd[1] ); else if( *cmd[2] == 'b' ) irc_send_num( irc, 368, "%s :No bans possible", cmd[1] ); } else irc_send_num( irc, 324, "%s +%s", cmd[1], ic->mode ); } else { if( nick_cmp( cmd[1], irc->user->nick ) == 0 ) { if( cmd[2] ) irc_umode_set( irc, cmd[2], 0 ); else irc_send_num( irc, 221, "+%s", irc->umode ); } else irc_send_num( irc, 502, ":Don't touch their modes" ); } }
static void ipc_child_cmd_kill( irc_t *irc, char **cmd ) { if( !( irc->status & USTATUS_LOGGED_IN ) ) return; if( nick_cmp( NULL, cmd[1], irc->user->nick ) != 0 ) return; /* It's not for us. */ irc_write( irc, ":%s!%s@%s KILL %s :%s", irc->root->nick, irc->root->nick, irc->root->host, irc->user->nick, cmd[2] ); irc_abort( irc, 0, "Killed by operator: %s", cmd[2] ); }
static void irc_cmd_notice( irc_t *irc, char **cmd ) { if( !cmd[2] ) { irc_send_num( irc, 412, ":No text to send" ); return; } /* At least for now just echo. IIRC some IRC clients use self-notices for lag checks, so try to support that. */ if( nick_cmp( cmd[1], irc->user->nick ) == 0 ) irc_send_msg( irc->user, "NOTICE", irc->user->nick, cmd[2], NULL ); }
void sort() { std::sort( this->users_.begin(), this->users_.end(), [this](const std::unique_ptr<User> &a, const std::unique_ptr<User> &b) { return nick_cmp(*a, *b, this->locale_) < 0; }); std::sort( this->users_alpha_.begin(), this->users_alpha_.end(), [this](const User* a, const User* b){ return locale_(a->nick, b->nick); } ); }
void ipc_master_cmd_identify( irc_t *data, char **cmd ) { struct bitlbee_child *child = (void*) data, *old = NULL; char *resp; GSList *l; if( !child || !child->nick || strcmp( child->nick, cmd[1] ) != 0 ) return; g_free( child->password ); child->password = g_strdup( cmd[2] ); for( l = child_list; l; l = l->next ) { old = l->data; if( child != old && old->nick && nick_cmp( NULL, old->nick, child->nick ) == 0 && old->password && strcmp( old->password, child->password ) == 0 ) break; } if( l && !child->to_child && !old->to_child ) { resp = "TAKEOVER INIT\r\n"; child->to_child = old; old->to_child = child; } else { /* Won't need the fd since we can't send it anywhere. */ closesocket( child->to_fd ); child->to_fd = -1; resp = "TAKEOVER NO\r\n"; } if( write( child->ipc_fd, resp, strlen( resp ) ) != strlen( resp ) ) ipc_master_free_one( child ); }