serverspy/src/serverspy.cxx
//------------------------------------------------------------------------------
// This function is called by administrator to disconnect all clients invoked
// by the specified user
//------------------------------------------------------------------------------
This function is called by administrator to disconnect all clients invoked
by the specified user
This function is called by administrator to disconnect all clients invoked by the specified user
void AdminRemoveUserClients(int admin, char* user) {
    char reply[10000];
    char buf[100];
    ClientDescriptor *cli = ClientDescriptor::sd_list;
    reply[0]=0;
    while(cli != NULL){
        if(strcmp(cli->m_UserName,user)==0) {
            sprintf(buf,"Client %d disconnected.\n",cli->m_ID);
            strcat(reply,buf);
            ClientDescriptor::RemoveClient(cli->m_ID);
            cli = ClientDescriptor::sd_list;
            continue;
        }
        cli = cli->m_Next;
    }
    sendSafe(admin,reply,strlen(reply));
}
void AdminRemoveUserClients ( int admin , char * user ) { char reply [ 10000 ] ; char buf [ 100 ] ; ClientDescriptor * cli = ClientDescriptor :: sd_list ; reply [ 0 ] = 0 ; while ( cli != NULL ) { if ( strcmp ( cli -> m_UserName , user ) == 0 ) { sprintf ( buf , " \n " , cli -> m_ID ) ; strcat ( reply , buf ) ; ClientDescriptor :: RemoveClient ( cli -> m_ID ) ; cli = ClientDescriptor :: sd_list ; continue ; } cli = cli -> m_Next ; } sendSafe ( admin , reply , strlen ( reply ) ) ; }
This function is called by administrator to disconnect all clients invoked
by the specified user
This function is called by administrator to disconnect all clients invoked by the specified user