Changes in protocols/msn/msn.h [951aefd:5ebff60]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.h
r951aefd r5ebff60 32 32 #define NUDGE_MESSAGE "\r\r\rSHAKE THAT THING\r\r\r" 33 33 #define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r" 34 #define SB_KEEPALIVE_MESSAGE "\r\r\rDONT HANG UP ON ME!\r\r\r" 34 35 35 36 #ifdef DEBUG_MSN … … 59 60 #define MSNP11_PROD_KEY "C1BX{V4W}Q3*10SM" 60 61 #define MSNP11_PROD_ID "PROD0120PW!CCV9@" 61 #define MSNP_VER "MSNP 21"62 #define MSNP_VER "MSNP18" 62 63 #define MSNP_BUILD "14.0.8117.416" 63 64 … … 67 68 #define MSN_CAP2 0x0000 68 69 69 #define MSN_BASE_HEADERS \ 70 "Routing: 1.0\r\n" \ 71 "To: 1:%s\r\n" \ 72 "From: 1:%s;epid={%s}\r\n" \ 73 "\r\n" \ 74 "Reliability: 1.0\r\n" \ 70 #define MSN_MESSAGE_HEADERS "MIME-Version: 1.0\r\n" \ 71 "Content-Type: text/plain; charset=UTF-8\r\n" \ 72 "User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \ 73 "X-MMS-IM-Format: FN=MS%20Shell%20Dlg; EF=; CO=0; CS=0; PF=0\r\n" \ 75 74 "\r\n" 76 77 #define MSN_MESSAGE_HEADERS MSN_BASE_HEADERS \78 "Messaging: 2.0\r\n" \79 "Message-Type: Text\r\n" \80 "Content-Length: %zd\r\n" \81 "Content-Type: text/plain; charset=UTF-8\r\n" \82 "X-MMS-IM-Format: FN=Segoe%%20UI; EF=; CO=0; CS=0; PF=0\r\n" \83 "\r\n" \84 "%s"85 86 #define MSN_PUT_HEADERS MSN_BASE_HEADERS \87 "Publication: 1.0\r\n" \88 "Uri: %s\r\n" \89 "Content-Type: %s\r\n" \90 "Content-Length: %zd\r\n" \91 "\r\n" \92 "%s"93 94 #define MSN_PUT_USER_BODY \95 "<user>" \96 "<s n=\"PE\"><UserTileLocation></UserTileLocation><FriendlyName>%s</FriendlyName><PSM>%s</PSM><DDP></DDP>" \97 "<Scene></Scene><ASN></ASN><ColorScheme>-3</ColorScheme><BDG></BDG><RUM>%s</RUM><RUL></RUL><RLT>0</RLT>" \98 "<RID></RID><SUL></SUL><MachineGuid>%s</MachineGuid></s>" \99 "<s n=\"IM\"><Status>%s</Status><CurrentMedia></CurrentMedia></s>" \100 "<sep n=\"PD\"><ClientType>1</ClientType><EpName>%s</EpName><Idle>%s</Idle><State>%s</State></sep>" \101 "<sep n=\"PE\"><VER>BitlBee:" BITLBEE_VERSION "</VER><TYP>1</TYP><Capabilities>%d:%d</Capabilities></sep>" \102 "<sep n=\"IM\"><Capabilities>%d:%d</Capabilities></sep>" \103 "</user>"104 75 105 76 #define MSN_TYPING_HEADERS "MIME-Version: 1.0\r\n" \ … … 113 84 "ID: 1\r\n" \ 114 85 "\r\n" 86 87 #define MSN_SB_KEEPALIVE_HEADERS "MIME-Version: 1.0\r\n" \ 88 "Content-Type: text/x-ping\r\n" \ 89 "\r\n\r\n" 115 90 116 91 #define PROFILE_URL "http://members.msn.com/" … … 124 99 } msn_flags_t; 125 100 126 struct msn_gw { 127 char *last_host; 128 int port; 129 gboolean ssl; 130 131 char *session_id; 132 133 GByteArray *in; 134 GByteArray *out; 135 136 int poll_timeout; 137 138 b_event_handler callback; 139 140 struct im_connection *ic; 141 struct msn_data *md; 142 143 gboolean open; 144 gboolean waiting; 145 gboolean polling; 146 }; 147 148 struct msn_data { 101 struct msn_handler_data { 149 102 int fd, inpa; 150 103 int rxlen; … … 154 107 char *cmd_text; 155 108 109 /* Either ic or sb */ 110 gpointer data; 111 112 int (*exec_command) (struct msn_handler_data *handler, char **cmd, int count); 113 int (*exec_message) (struct msn_handler_data *handler, char *msg, int msglen, char **cmd, int count); 114 }; 115 116 struct msn_data { 156 117 struct im_connection *ic; 157 118 119 struct msn_handler_data ns[1]; 158 120 msn_flags_t flags; 159 121 … … 164 126 165 127 GSList *msgq, *grpq, *soapq; 128 GSList *switchboards; 129 int sb_failures; 130 time_t first_sb_failure; 166 131 167 132 const struct msn_away_state *away_state; … … 174 139 GTree *domaintree; 175 140 int adl_todo; 176 177 gboolean is_http; 178 struct msn_gw *gw; 141 }; 142 143 struct msn_switchboard { 144 struct im_connection *ic; 145 146 /* The following two are also in the handler. TODO: Clean up. */ 147 int fd; 148 gint inp; 149 struct msn_handler_data *handler; 150 gint keepalive; 151 152 int trId; 153 int ready; 154 155 int session; 156 char *key; 157 158 GSList *msgq; 159 char *who; 160 struct groupchat *chat; 179 161 }; 180 162 … … 223 205 #define STATUS_FATAL 1 224 206 #define STATUS_SB_FATAL 2 207 #define STATUS_SB_IM_SPARE 4 /* Make one-to-one conversation switchboard available again, invite failed. */ 208 #define STATUS_SB_CHAT_SPARE 8 /* Same, but also for groupchats (not used yet). */ 225 209 226 210 extern int msn_chat_id; … … 234 218 before doing *anything* else. */ 235 219 extern GSList *msn_connections; 220 extern GSList *msn_switchboards; 236 221 237 222 /* ns.c */ 238 223 int msn_ns_write(struct im_connection *ic, int fd, const char *fmt, ...) G_GNUC_PRINTF(3, 4); 239 gboolean msn_ns_connect(struct im_connection *ic, const char *host, int port);240 void msn_ns_close(struct msn_ data *handler);224 gboolean msn_ns_connect(struct im_connection *ic, struct msn_handler_data *handler, const char *host, int port); 225 void msn_ns_close(struct msn_handler_data *handler); 241 226 void msn_auth_got_passport_token(struct im_connection *ic, const char *token, const char *error); 242 227 void msn_auth_got_contact_list(struct im_connection *ic); 243 228 int msn_ns_finish_login(struct im_connection *ic); 244 229 int msn_ns_sendmessage(struct im_connection *ic, struct bee_user *bu, const char *text); 245 int msn_ns_command(struct msn_data *md, char **cmd, int num_parts); 246 int msn_ns_message(struct msn_data *md, char *msg, int msglen, char **cmd, int num_parts); 230 void msn_ns_oim_send_queue(struct im_connection *ic, GSList **msgq); 247 231 248 232 /* msn_util.c */ … … 251 235 int msn_buddy_list_remove(struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *group); 252 236 void msn_buddy_ask(bee_user_t *bu); 253 void msn_queue_feed(struct msn_data *h, char *bytes, int st); 254 int msn_handler(struct msn_data *h); 237 char **msn_linesplit(char *line); 238 int msn_handler(struct msn_handler_data *h); 239 void msn_msgq_purge(struct im_connection *ic, GSList **list); 255 240 char *msn_p11_challenge(char *challenge); 256 241 gint msn_domaintree_cmp(gconstpointer a_, gconstpointer b_); … … 266 251 const struct msn_status_code *msn_status_by_number(int number); 267 252 268 /* gw.c */ 269 struct msn_gw *msn_gw_new(struct im_connection *ic); 270 void msn_gw_free(struct msn_gw *gw); 271 void msn_gw_open(struct msn_gw *gw); 272 ssize_t msn_gw_read(struct msn_gw *gw, char **buf); 273 void msn_gw_write(struct msn_gw *gw, char *buf, size_t len); 253 /* sb.c */ 254 int msn_sb_write(struct msn_switchboard *sb, const char *fmt, ...) G_GNUC_PRINTF(2, 3);; 255 struct msn_switchboard *msn_sb_create(struct im_connection *ic, char *host, int port, char *key, int session); 256 struct msn_switchboard *msn_sb_by_handle(struct im_connection *ic, const char *handle); 257 struct msn_switchboard *msn_sb_by_chat(struct groupchat *c); 258 struct msn_switchboard *msn_sb_spare(struct im_connection *ic); 259 int msn_sb_sendmessage(struct msn_switchboard *sb, char *text); 260 struct groupchat *msn_sb_to_chat(struct msn_switchboard *sb); 261 void msn_sb_destroy(struct msn_switchboard *sb); 262 gboolean msn_sb_connected(gpointer data, gint source, b_input_condition cond); 263 int msn_sb_write_msg(struct im_connection *ic, struct msn_message *m); 264 void msn_sb_start_keepalives(struct msn_switchboard *sb, gboolean initial); 265 void msn_sb_stop_keepalives(struct msn_switchboard *sb); 274 266 275 267 #endif //_MSN_H
Note: See TracChangeset
for help on using the changeset viewer.