| 34 #include "proxy.h" |
34 #include "proxy.h" |
| 35 #include "roomlist.h" |
35 #include "roomlist.h" |
| 36 |
36 |
| 37 #define QQ_KEY_LENGTH 16 |
37 #define QQ_KEY_LENGTH 16 |
| 38 |
38 |
| |
39 #ifdef _WIN32 |
| |
40 const char *qq_win32_buddy_icon_dir(void); |
| |
41 #define QQ_BUDDY_ICON_DIR qq_win32_buddy_icon_dir() |
| |
42 #endif |
| |
43 |
| 39 typedef struct _qq_data qq_data; |
44 typedef struct _qq_data qq_data; |
| 40 typedef struct _qq_buddy qq_buddy; |
45 typedef struct _qq_buddy qq_buddy; |
| 41 typedef struct _qq_interval qq_interval; |
46 typedef struct _qq_interval qq_interval; |
| 42 |
47 |
| 43 struct _qq_interval { |
48 struct _qq_interval { |
| 61 guint8 onlineTime; |
66 guint8 onlineTime; |
| 62 guint16 level; |
67 guint16 level; |
| 63 guint16 timeRemainder; |
68 guint16 timeRemainder; |
| 64 time_t signon; |
69 time_t signon; |
| 65 time_t idle; |
70 time_t idle; |
| 66 time_t last_refresh; |
71 time_t last_update; |
| 67 |
72 |
| 68 gint8 role; /* role in group, used only in group->members list */ |
73 gint8 role; /* role in group, used only in group->members list */ |
| |
74 }; |
| |
75 |
| |
76 typedef struct _qq_connection qq_connection; |
| |
77 struct _qq_connection { |
| |
78 int fd; /* socket file handler */ |
| |
79 int input_handler; |
| |
80 |
| |
81 /* tcp related */ |
| |
82 int can_write_handler; /* use in tcp_send_out */ |
| |
83 PurpleCircBuffer *tcp_txbuf; |
| |
84 guint8 *tcp_rxqueue; |
| |
85 int tcp_rxlen; |
| 69 }; |
86 }; |
| 70 |
87 |
| 71 struct _qq_data { |
88 struct _qq_data { |
| 72 PurpleConnection *gc; |
89 PurpleConnection *gc; |
| 73 |
90 |
| 74 /* common network resource */ |
91 GSList *openconns; |
| |
92 gboolean use_tcp; /* network in tcp or udp */ |
| |
93 PurpleProxyConnectData *conn_data; |
| |
94 gint fd; /* socket file handler */ |
| |
95 |
| 75 GList *servers; |
96 GList *servers; |
| 76 gchar *user_server; |
97 gchar *curr_server; /* point to servers->data, do not free*/ |
| 77 gint user_port; |
|
| 78 gboolean use_tcp; /* network in tcp or udp */ |
|
| 79 |
98 |
| 80 gchar *server_name; |
99 struct in_addr redirect_ip; |
| 81 gboolean is_redirect; |
100 guint16 redirect_port; |
| 82 gchar *real_hostname; /* from real connction */ |
101 guint check_watcher; |
| 83 guint16 real_port; |
102 guint connect_watcher; |
| 84 guint reconnect_timeout; |
103 gint connect_retry; |
| 85 gint reconnect_times; |
|
| 86 |
|
| 87 PurpleProxyConnectData *connect_data; |
|
| 88 gint fd; /* socket file handler */ |
|
| 89 gint tx_handler; /* socket can_write handle, use in udp connecting and tcp send out */ |
|
| 90 |
104 |
| 91 qq_interval itv_config; |
105 qq_interval itv_config; |
| 92 qq_interval itv_count; |
106 qq_interval itv_count; |
| 93 guint network_timeout; |
107 guint network_watcher; |
| 94 |
108 |
| 95 GList *transactions; /* check ack packet and resend */ |
109 GList *transactions; /* check ack packet and resend */ |
| 96 |
|
| 97 /* tcp related */ |
|
| 98 PurpleCircBuffer *tcp_txbuf; |
|
| 99 guint8 *tcp_rxqueue; |
|
| 100 int tcp_rxlen; |
|
| 101 |
|
| 102 /* udp related */ |
|
| 103 PurpleDnsQueryData *udp_query_data; |
|
| 104 |
110 |
| 105 guint32 uid; /* QQ number */ |
111 guint32 uid; /* QQ number */ |
| 106 guint8 *token; /* get from server*/ |
112 guint8 *token; /* get from server*/ |
| 107 int token_len; |
113 int token_len; |
| 108 guint8 inikey[QQ_KEY_LENGTH]; /* initial key to encrypt login packet */ |
114 guint8 inikey[QQ_KEY_LENGTH]; /* initial key to encrypt login packet */ |
| 110 guint8 session_key[QQ_KEY_LENGTH]; /* later use this as key in this session */ |
116 guint8 session_key[QQ_KEY_LENGTH]; /* later use this as key in this session */ |
| 111 guint8 session_md5[QQ_KEY_LENGTH]; /* concatenate my uid with session_key and md5 it */ |
117 guint8 session_md5[QQ_KEY_LENGTH]; /* concatenate my uid with session_key and md5 it */ |
| 112 |
118 |
| 113 guint16 send_seq; /* send sequence number */ |
119 guint16 send_seq; /* send sequence number */ |
| 114 guint8 login_mode; /* online of invisible */ |
120 guint8 login_mode; /* online of invisible */ |
| 115 gboolean logged_in; /* used by qq-add_buddy */ |
121 gboolean is_login; /* used by qq-add_buddy */ |
| |
122 gboolean is_finish_update; |
| 116 |
123 |
| 117 PurpleXfer *xfer; /* file transfer handler */ |
124 PurpleXfer *xfer; /* file transfer handler */ |
| 118 |
125 |
| 119 /* get from login reply packet */ |
126 /* get from login reply packet */ |
| 120 time_t login_time; |
127 time_t login_time; |
| 141 GList *add_buddy_request; |
148 GList *add_buddy_request; |
| 142 |
149 |
| 143 /* TODO pass qq_send_packet_get_info() a callback and use signals to get rid of these */ |
150 /* TODO pass qq_send_packet_get_info() a callback and use signals to get rid of these */ |
| 144 gboolean modifying_info; |
151 gboolean modifying_info; |
| 145 gboolean modifying_face; |
152 gboolean modifying_face; |
| |
153 |
| |
154 gboolean is_show_notice; |
| |
155 gboolean is_show_news; |
| 146 }; |
156 }; |
| 147 |
157 |
| 148 #endif |
158 #endif |