Changes in protocols/msn/msn.h [5ebff60:951aefd]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.h
r5ebff60 r951aefd 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"35 34 36 35 #ifdef DEBUG_MSN … … 60 59 #define MSNP11_PROD_KEY "C1BX{V4W}Q3*10SM" 61 60 #define MSNP11_PROD_ID "PROD0120PW!CCV9@" 62 #define MSNP_VER "MSNP 18"61 #define MSNP_VER "MSNP21" 63 62 #define MSNP_BUILD "14.0.8117.416" 64 63 … … 68 67 #define MSN_CAP2 0x0000 69 68 70 #define MSN_MESSAGE_HEADERS "MIME-Version: 1.0\r\n" \ 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" \ 75 "\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" \ 71 81 "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" \ 74 "\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>" 75 104 76 105 #define MSN_TYPING_HEADERS "MIME-Version: 1.0\r\n" \ … … 84 113 "ID: 1\r\n" \ 85 114 "\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"90 115 91 116 #define PROFILE_URL "http://members.msn.com/" … … 99 124 } msn_flags_t; 100 125 101 struct msn_handler_data { 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 { 102 149 int fd, inpa; 103 150 int rxlen; … … 107 154 char *cmd_text; 108 155 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 {117 156 struct im_connection *ic; 118 157 119 struct msn_handler_data ns[1];120 158 msn_flags_t flags; 121 159 … … 126 164 127 165 GSList *msgq, *grpq, *soapq; 128 GSList *switchboards;129 int sb_failures;130 time_t first_sb_failure;131 166 132 167 const struct msn_away_state *away_state; … … 139 174 GTree *domaintree; 140 175 int adl_todo; 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; 176 177 gboolean is_http; 178 struct msn_gw *gw; 161 179 }; 162 180 … … 205 223 #define STATUS_FATAL 1 206 224 #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). */209 225 210 226 extern int msn_chat_id; … … 218 234 before doing *anything* else. */ 219 235 extern GSList *msn_connections; 220 extern GSList *msn_switchboards;221 236 222 237 /* ns.c */ 223 238 int msn_ns_write(struct im_connection *ic, int fd, const char *fmt, ...) G_GNUC_PRINTF(3, 4); 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);239 gboolean msn_ns_connect(struct im_connection *ic, const char *host, int port); 240 void msn_ns_close(struct msn_data *handler); 226 241 void msn_auth_got_passport_token(struct im_connection *ic, const char *token, const char *error); 227 242 void msn_auth_got_contact_list(struct im_connection *ic); 228 243 int msn_ns_finish_login(struct im_connection *ic); 229 244 int msn_ns_sendmessage(struct im_connection *ic, struct bee_user *bu, const char *text); 230 void msn_ns_oim_send_queue(struct im_connection *ic, GSList **msgq); 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); 231 247 232 248 /* msn_util.c */ … … 235 251 int msn_buddy_list_remove(struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *group); 236 252 void msn_buddy_ask(bee_user_t *bu); 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); 253 void msn_queue_feed(struct msn_data *h, char *bytes, int st); 254 int msn_handler(struct msn_data *h); 240 255 char *msn_p11_challenge(char *challenge); 241 256 gint msn_domaintree_cmp(gconstpointer a_, gconstpointer b_); … … 251 266 const struct msn_status_code *msn_status_by_number(int number); 252 267 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); 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); 266 274 267 275 #endif //_MSN_H
Note: See TracChangeset
for help on using the changeset viewer.