Protocol_Record * PMS_All::insert_protocol_info (Protocol_Record &protocol_record) { Protocol_Record *prp = PM_Server::insert_protocol_info (protocol_record); passwd *pwent = ACE_OS::getpwnam (prp->get_login ()); char *cp = (char *) ACE_OS::strchr (prp->set_real (pwent == 0 ? prp->get_login () : ACE::strnew (pwent->pw_gecos)), ','); if (cp != 0) *cp = '\0'; return prp; }
int PMC_Flo::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUG) != 0) ACE_DEBUG ((LM_DEBUG, "in PMC_Flo::encode")); ACE_NEW_RETURN (this->ss, BS_Client, -1); SET_PACKET_TYPE (packet, Options::PROTO_FLO); char *buf_ptr = SKIP_PACKET_TYPE (packet); sprintf (buf_ptr, "%d", this->friend_count ()); buf_ptr += MAXUSERIDNAMELEN; // Iterate through all the friends, copying them into the packet // buffer. for (Protocol_Record *prp; (prp = this->get_next_friend ()) != 0; ) buf_ptr = ACE_OS::strecpy (buf_ptr, prp->get_login ()); packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUG) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; }
int PMS_All::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMS_All::encode")); Protocol_Record *prp; char *buf_ptr = packet; ACE_OS::sprintf (buf_ptr, "Users %d", this->get_total_users ()); buf_ptr += ACE_OS::strlen (buf_ptr) + 1; // We only send back info on friends that we actually see logged in. for (; (prp = this->get_next_friend ()) != 0; *buf_ptr++ = '\t') buf_ptr = this->handle_protocol_entries (ACE_OS::strecpy (ACE_OS::strecpy (buf_ptr, prp->get_login ()), prp->get_real ()), prp->get_drwho_list ()); *buf_ptr++ = '\n'; packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; }
int PMS_Usr::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMS_Usr::encode")); char *buf_ptr = packet; // We only send back info on friend that is actually logged in. Protocol_Record *prp = this->get_next_friend (); if (prp) { buf_ptr = this->handle_protocol_entries (ACE_OS::strecpy (buf_ptr, prp->get_login ()), prp->get_drwho_list ()); *buf_ptr++ = '\t'; } *buf_ptr++ = '\n'; packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; }