1 2 #ifndef _CHAT_SESSION_H 3 #define _CHAT_SESSION_H 4 5 #include "icq.h" 6 #include "icqtypes.h" 7 8 /* chat session statuses- request receiver */ 9 #define CHAT_STATUS_LISTENING 1 10 #define CHAT_STATUS_CONNECTED 3 11 #define CHAT_STATUS_WAIT_NAME 4 12 #define CHAT_STATUS_WAIT_FONT 6 13 14 /* chat session statuses- request sender */ 15 #define CHAT_STATUS_CONNECTING 2 16 #define CHAT_STATUS_WAIT_ALLINFO 5 17 18 /* once negotiation is complete, both sides enter ready state */ 19 #define CHAT_STATUS_READY 7 20 21 /* chat session states: 22 23 accepting chat request 24 25 1. remote user initiates chat by sending chat request to message listen 26 port 27 2. local user accepts chat, ack packet sent back to remote user and 28 chat listen port opened 29 * chat session created on local side with ID of ack packet 30 LISTENING 31 * remote chat session created with ID of ack packet 32 CONNECTING 33 3. remote client connects to local chat listen port, sends hello and 34 sends info packet with name and colors 35 * local chat session associated with new icq_TCPLink according to uin 36 4. local client sends back big info packet with name, colors, and font 37 38 5. remote client sends font packet, connection is considered established 39 40 sending chat request 41 42 1. local user initiates chat by sending chat request to remote message 43 listen port 44 2. remote user accepts chat, ack packet received from remote client and 45 remote client opens chat listen port 46 3. local client connects to remote chat listen port, sends hello and 47 sends info packet with name and colors 48 4. remote client sends back big info packet with name, colors, and font 49 5. local client sends font packet, connection is considered established 50 51 1. icq_RecvChatRequest - provides session ID (same as packet sequence) 52 2. icq_SendChatAck - pass session ID 53 ICQ_NOTIFY_CONNECTED 54 ICQ_NOTIFY_SENT 55 ICQ_NOTIFY_CHAT, CHAT_STATUS_LISTENING 56 3. ICQ_NOTIFY_CHAT, CHAT_STATUS_WAIT_NAME 57 4. ICQ_NOTIFY_CHAT, CHAT_STATUS_WAIT_FONT 58 5. ICQ_NOTIFY_CHAT, CHAT_STATUS_CONNECTED 59 ICQ_NOTIFY_CHATDATA, .... 60 ICQ_NOTIFY_SUCCESS 61 */ 62 63 typedef struct icq_ChatSession_s { 64 65 DWORD id; 66 int status; 67 ICQLINK *icqlink; 68 69 DWORD remote_uin; 70 char *remote_handle; 71 72 } icq_ChatSession; 73 74 icq_ChatSession *icq_ChatSessionNew(ICQLINK *); 75 void icq_ChatSessionDelete(void *); 76 void icq_ChatSessionClose(icq_ChatSession *); 77 void icq_ChatSessionSetStatus(icq_ChatSession *, int); 78 icq_ChatSession *icq_FindChatSession(ICQLINK *, DWORD); 79 80 #endif 81