void PMC_Ruser::process (void) { const char *(Drwho_Node::*get_name)(void); if (Options::get_opt (Options::PRINT_LOGIN_NAME)) get_name = &Drwho_Node::get_login_name; else get_name = &Drwho_Node::get_real_name; for (Protocol_Record *prp; (prp = this->Protocol_Manager::get_each_friend ()) != 0; ) { ACE_DEBUG ((LM_DEBUG, "%-*s ", this->max_key_length, prp->get_host ())); for (Drwho_Node *np = prp->get_drwho_list (); ;) { ACE_DEBUG ((LM_DEBUG, "%s", (np->*get_name) ())); if (np->get_inactive_count () != 0) { if (np->get_active_count () != 0) ACE_DEBUG ((LM_DEBUG, "*(%d)", np->get_active_count ())); } else if (np->get_active_count () > 1) ACE_DEBUG ((LM_DEBUG, "*(%d)", np->get_active_count ())); else if (np->get_active_count () == 1) ACE_DEBUG ((LM_DEBUG, "*")); np = np->next_; if (np == 0) break; else if (Options::get_opt (Options::PRINT_LOGIN_NAME)) ACE_DEBUG ((LM_DEBUG, " ")); else ACE_DEBUG ((LM_DEBUG, ", ")); } ACE_DEBUG ((LM_DEBUG, "\n")); } }
Protocol_Record * PM_Client::insert_protocol_info (Protocol_Record &protocol_record) { Protocol_Record *prp = this->ss->insert (protocol_record.get_login ()); Drwho_Node *current_node = protocol_record.get_drwho_list (); Drwho_Node *np = this->get_drwho_node (ACE::strnew (current_node->get_host_name ()), prp->drwho_list_); // Update the active and inactive counts. if (np->get_active_count () < current_node->get_active_count ()) { np->set_active_count (current_node->get_active_count ()); prp->is_active_ = 1; } if (np->get_inactive_count () < current_node->get_inactive_count()) np->set_inactive_count (current_node->get_inactive_count ()); return prp; }
Protocol_Record * PMC_Ruser::insert_protocol_info (Protocol_Record &protocol_record) { Protocol_Record *prp = this->ss->insert (protocol_record.get_host (), MAXHOSTNAMELEN); Drwho_Node *current_node = protocol_record.get_drwho_list (); Drwho_Node *np = this->get_drwho_node (ACE::strnnew (current_node->get_login_name (), MAXUSERIDNAMELEN), prp->drwho_list_); int length = ACE_OS::strlen (prp->get_host ()); np->set_real_name (ACE::strnew (current_node->get_real_name ())); if (np->get_active_count () < current_node->get_active_count ()) np->set_active_count (current_node->get_active_count ()); if (np->get_inactive_count () < current_node->get_inactive_count()) np->set_inactive_count (current_node->get_inactive_count ()); if (length > this->max_key_length) this->max_key_length = length; return prp; }
void PM_Client::process (void) { const char *(Protocol_Record::*get_name)(void); if (Options::get_opt (Options::PRINT_LOGIN_NAME)) get_name = &Protocol_Record::get_login; else get_name = &Protocol_Record::get_real; int active_friends = 0; int users = this->Protocol_Manager::get_total_users (); ACE_DEBUG ((LM_DEBUG, "------------------------\n")); if (Options::get_opt (Options::PRINT_LOGIN_NAME)) this->max_key_length = MAXUSERIDNAMELEN; // Goes through the queue of all the logged in friends and prints // out the associated information. for (Protocol_Record *prp = this->Protocol_Manager::get_each_friend (); prp != 0; prp = this->Protocol_Manager::get_each_friend ()) { ACE_DEBUG ((LM_DEBUG, "%c%-*s [", (prp->is_active_ != 0 ? '*' : ' '), this->max_key_length, (prp->*get_name) ())); for (Drwho_Node *np = prp->get_drwho_list (); ;) { ACE_DEBUG ((LM_DEBUG, np->get_host_name (), stdout)); active_friends += np->get_active_count (); if (np->get_inactive_count () != 0) { if (np->get_active_count () != 0) ACE_DEBUG ((LM_DEBUG, "*(%d)", np->get_active_count ())); } else if (np->get_active_count () > 1) ACE_DEBUG ((LM_DEBUG, "*(%d)", np->get_active_count ())); else if (np->get_active_count () == 1) ACE_DEBUG ((LM_DEBUG, "*")); np = np->next_; if (np == 0) break; else ACE_DEBUG ((LM_DEBUG, " ")); } ACE_DEBUG ((LM_DEBUG, "]\n")); } ACE_DEBUG ((LM_DEBUG, "------------------------\n")); ACE_DEBUG ((LM_DEBUG, "friends: %d\tusers: %d\n", active_friends, users)); }