5 #include "ace/Log_Msg.h"
6 #include "ace/OS_NS_string.h"
7 #include "ace/OS_NS_unistd.h"
8 #include "ace/OS_Memory.h"
11 PMC_Usr::encode (char *packet
, int &packet_length
)
13 if (Options::get_opt (Options::DEBUGGING
) != 0)
15 "in PMC_Usr::encode"));
17 ACE_NEW_RETURN (this->ss
,
18 SL_Client (this->usr_name
),
21 SET_PACKET_TYPE (packet
, Options::PROTO_USR
);
23 char *buf_ptr
= SKIP_PACKET_TYPE (packet
);
25 buf_ptr
= ACE_OS::strecpy (buf_ptr
,
26 this->get_next_friend ()->get_login ());
28 packet_length
= buf_ptr
- packet
;
30 if (Options::get_opt (Options::DEBUGGING
) != 0)
33 "packet_length = %d\n",
35 ACE_OS::write (ACE_STDERR
, packet
, packet_length
);
42 // This method is responsible for transforming the msg from the server
43 // back into a form usable by the client.
46 PMC_Usr::decode (char *packet
, int &packet_length
)
48 if (Options::get_opt (Options::DEBUGGING
) != 0)
51 "in PMC_Usr::decode, packet_length = %d\n",
53 ACE_OS::write (ACE_STDERR
, packet
, packet_length
);
62 char *login_name
= cp
;
64 for (cp
= (char *) ACE::strend (cp
);
65 *(cp
= this->handle_protocol_entries (cp
, login_name
)) != '\t';
76 Protocol_Record
*prp
= this->get_each_friend ();
77 Drwho_Node
*np
= prp
->get_drwho_list ();
84 // First try to get a login session that is active...
86 for (; np
!= 0; np
= np
->next_
)
87 if (np
->active_count_
> 0)
91 np
->get_host_name ()));
93 if (Options::get_opt (Options::USE_VERBOSE_FORMAT
) == 0)
97 for (np
= prp
->get_drwho_list ();
100 if (np
->active_count_
== 0)
102 ACE_DEBUG ((LM_DEBUG
,
104 np
->get_host_name ()));
106 if (Options::get_opt (Options::USE_VERBOSE_FORMAT
) == 0)
112 PMC_Usr::PMC_Usr (char *u_name
)