- Timestamp:
- 2015-03-15T14:41:47Z (10 years ago)
- Children:
- c5a1502
- Parents:
- ffa5b70
- git-author:
- dequis <dx@…> (09-03-15 10:14:58)
- git-committer:
- dequis <dx@…> (15-03-15 14:41:47)
- Location:
- protocols/msn
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
rffa5b70 r6e74911 178 178 static void msn_set_away(struct im_connection *ic, char *state, char *message) 179 179 { 180 //char *uux;181 180 struct msn_data *md = ic->proto_data; 181 char *nick, *psm, *idle, *statecode, *body, *buf; 182 182 183 183 if (state == NULL) { … … 187 187 } 188 188 189 if (!msn_ns_write(ic, -1, "CHG %d %s %d:%02d\r\n", ++md->trId, md->away_state->code, MSN_CAP1, MSN_CAP2)) { 190 return; 191 } 192 193 uux = g_markup_printf_escaped("<EndpointData><Capabilities>%d:%02d" 194 "</Capabilities></EndpointData>", 195 MSN_CAP1, MSN_CAP2); 196 msn_ns_write(ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen(uux), uux); 197 g_free(uux); 198 199 uux = g_markup_printf_escaped("<PrivateEndpointData><EpName>%s</EpName>" 200 "<Idle>%s</Idle><ClientType>%d</ClientType>" 201 "<State>%s</State></PrivateEndpointData>", 202 md->uuid, 203 strcmp(md->away_state->code, "IDL") ? "false" : "true", 204 1, /* ? */ 205 md->away_state->code); 206 msn_ns_write(ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen(uux), uux); 207 g_free(uux); 208 209 uux = g_markup_printf_escaped("<Data><DDP></DDP><PSM>%s</PSM>" 210 "<CurrentMedia></CurrentMedia>" 211 "<MachineGuid>%s</MachineGuid></Data>", 212 message ? message : "", md->uuid); 213 msn_ns_write(ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen(uux), uux); 214 g_free(uux); 189 statecode = (char *) md->away_state->code; 190 nick = set_getstr(&ic->acc->set, "display_name"); 191 psm = message ? message : ""; 192 idle = strcmp(statecode, "IDL") ? "false" : "true"; 193 194 body = g_markup_printf_escaped(MSN_PUT_USER_BODY, 195 nick, psm, psm, md->uuid, statecode, md->uuid, idle, statecode, 196 MSN_CAP1, MSN_CAP2, MSN_CAP1, MSN_CAP2 197 ); 198 199 buf = g_strdup_printf(MSN_PUT_HEADERS, ic->acc->user, ic->acc->user, md->uuid, 200 "/user", "application/user+xml", 201 strlen(body), body); 202 msn_ns_write(ic, -1, "PUT %d %zd\r\n%s", ++md->trId, strlen(buf), buf); 203 204 g_free(buf); 205 g_free(body); 215 206 } 216 207 -
protocols/msn/msn.h
rffa5b70 r6e74911 67 67 #define MSN_CAP2 0x0000 68 68 69 #define MSN_ MESSAGE_HEADERS \69 #define MSN_BASE_HEADERS \ 70 70 "Routing: 1.0\r\n" \ 71 71 "To: 1:%s\r\n" \ … … 73 73 "\r\n" \ 74 74 "Reliability: 1.0\r\n" \ 75 "\r\n" \ 75 "\r\n" 76 77 #define MSN_MESSAGE_HEADERS MSN_BASE_HEADERS \ 76 78 "Messaging: 2.0\r\n" \ 77 79 "Message-Type: Text\r\n" \ … … 81 83 "\r\n" \ 82 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>" 83 104 84 105 #define MSN_TYPING_HEADERS "MIME-Version: 1.0\r\n" \ -
protocols/msn/msn_util.c
rffa5b70 r6e74911 532 532 int msn_ns_set_display_name(struct im_connection *ic, const char *value) 533 533 { 534 struct msn_data *md = ic->proto_data; 535 char fn[strlen(value) * 3 + 1]; 536 537 strcpy(fn, value); 538 http_encode(fn); 539 540 /* Note: We don't actually know if the server accepted the new name, 541 and won't give proper feedback yet if it doesn't. */ 542 return msn_ns_write(ic, -1, "PRP %d MFN %s\r\n", ++md->trId, fn); 534 // TODO, implement this through msn_set_away's method 535 return 1; 543 536 } 544 537
Note: See TracChangeset
for help on using the changeset viewer.