Changeset 99fe030 for protocols/msn
- Timestamp:
- 2015-05-13T08:05:01Z (10 years ago)
- Branches:
- master
- Children:
- a6bed1a
- Parents:
- a733669
- Location:
- protocols/msn
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
ra733669 r99fe030 144 144 { 145 145 struct bee_user *bu = bee_user_by_handle(ic->bee, ic, who); 146 147 #ifdef DEBUG 148 if (strcmp(who, "raw") == 0) { 149 msn_ns_write(ic, -1, "%s\r\n", message); 150 return 0; 151 } 152 #endif 153 154 msn_ns_sendmessage(ic, bu, message); 155 return(0); 146 msn_ns_send_message(ic, bu, message); 147 return 0; 156 148 } 157 149 … … 277 269 return 0; 278 270 } else if (typing & OPT_TYPING) { 279 return (msn_buddy_msg(ic, who, TYPING_NOTIFICATION_MESSAGE, 0));271 return msn_ns_send_typing(ic, bu); 280 272 } else { 281 273 return 1; -
protocols/msn/msn.h
ra733669 r99fe030 26 26 #ifndef _MSN_H 27 27 #define _MSN_H 28 29 /* Some hackish magicstrings to make special-purpose messages/switchboards.30 */31 #define TYPING_NOTIFICATION_MESSAGE "\r\r\rBEWARE, ME R TYPINK MESSAGE!!!!\r\r\r"32 #define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r"33 34 #ifdef DEBUG_MSN35 #define debug(text ...) imcb_log(ic, text);36 #else37 #define debug(text ...)38 #endif39 28 40 29 /* This should be MSN Messenger 7.0.0813 … … 76 65 #define MSN_MESSAGE_HEADERS MSN_BASE_HEADERS \ 77 66 "Messaging: 2.0\r\n" \ 78 "Message-Type: Text\r\n" \67 "Message-Type: %s\r\n" \ 79 68 "Content-Length: %zd\r\n" \ 80 69 "Content-Type: text/plain; charset=UTF-8\r\n" \ … … 102 91 "</user>" 103 92 104 #define MSN_TYPING_HEADERS "MIME-Version: 1.0\r\n" \105 "Content-Type: text/x-msmsgscontrol\r\n" \106 "TypingUser: %s\r\n" \107 "\r\n\r\n"108 109 93 #define PROFILE_URL "http://members.msn.com/" 110 94 … … 235 219 void msn_auth_got_contact_list(struct im_connection *ic); 236 220 int msn_ns_finish_login(struct im_connection *ic); 237 int msn_ns_sendmessage(struct im_connection *ic, struct bee_user *bu, const char *text); 221 int msn_ns_send_typing(struct im_connection *ic, struct bee_user *bu); 222 int msn_ns_send_message(struct im_connection *ic, struct bee_user *bu, const char *text); 238 223 int msn_ns_command(struct msn_data *md, char **cmd, int num_parts); 239 224 int msn_ns_message(struct msn_data *md, char *msg, int msglen, char **cmd, int num_parts); -
protocols/msn/ns.c
ra733669 r99fe030 724 724 } 725 725 726 // TODO: typing notifications, nudges lol, etc 727 int msn_ns_sendmessage(struct im_connection *ic, bee_user_t *bu, const char *text) 726 static int msn_ns_send_sdg(struct im_connection *ic, bee_user_t *bu, const char *message_type, const char *text) 728 727 { 729 728 struct msn_data *md = ic->proto_data; … … 731 730 char *buf; 732 731 733 if (strncmp(text, "\r\r\r", 3) == 0) { 734 /* Err. Shouldn't happen but I guess it can. Don't send others 735 any of the "SHAKE THAT THING" messages. :-D */ 736 return 1; 737 } 738 739 buf = g_strdup_printf(MSN_MESSAGE_HEADERS, bu->handle, ic->acc->user, md->uuid, strlen(text), text); 732 buf = g_strdup_printf(MSN_MESSAGE_HEADERS, bu->handle, ic->acc->user, md->uuid, message_type, strlen(text), text); 740 733 retval = msn_ns_write(ic, -1, "SDG %d %zd\r\n%s", ++md->trId, strlen(buf), buf); 741 734 g_free(buf); 742 735 return retval; 743 736 } 737 738 int msn_ns_send_typing(struct im_connection *ic, bee_user_t *bu) 739 { 740 return msn_ns_send_sdg(ic, bu, "Control/Typing", ""); 741 } 742 743 int msn_ns_send_message(struct im_connection *ic, bee_user_t *bu, const char *text) 744 { 745 return msn_ns_send_sdg(ic, bu, "Text", text); 746 } 747
Note: See TracChangeset
for help on using the changeset viewer.