Changeset 1272 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_im.c
- Timestamp:
- May 14, 2007 4:45:20 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_im.c
r1266 r1272 73 73 74 74 /* Check if content type is acceptable */ 75 #if 0 75 76 static pj_bool_t acceptable_message(const pjsip_media_type *mime) 76 77 { … … 81 82 pj_stricmp(&mime->subtype, &STR_MIME_ISCOMPOSING)==0); 82 83 } 83 84 #endif 84 85 85 86 /** … … 105 106 pjsip_accept_hdr **p_accept_hdr) 106 107 { 108 /* Some UA sends text/html, so this check will break */ 109 #if 0 107 110 pjsip_ctype_hdr *ctype; 108 111 pjsip_msg *msg; … … 124 127 return PJ_FALSE; 125 128 } 129 #else 130 PJ_UNUSED_ARG(rdata); 131 PJ_UNUSED_ARG(p_accept_hdr); 132 #endif 126 133 127 134 return PJ_TRUE; … … 157 164 } 158 165 159 160 if (pj_stricmp(&body->content_type.type, &STR_MIME_TEXT)==0 && 161 pj_stricmp(&body->content_type.subtype, &STR_MIME_PLAIN)==0) 166 if (pj_stricmp(&body->content_type.type, &STR_MIME_APP)==0 && 167 pj_stricmp(&body->content_type.subtype, &STR_MIME_ISCOMPOSING)==0) 162 168 { 163 const pj_str_t mime_text_plain = pj_str("text/plain");164 pj_str_t text_body;165 166 /* Save text body */167 text_body.ptr = (char*) rdata->msg_info.msg->body->data;168 text_body.slen = rdata->msg_info.msg->body->len;169 170 if (pjsua_var.ua_cfg.cb.on_pager) {171 (*pjsua_var.ua_cfg.cb.on_pager)(call_id, from, to, &contact,172 &mime_text_plain, &text_body);173 }174 175 } else {176 169 /* Expecting typing indication */ 177 170 pj_status_t status; … … 190 183 is_typing); 191 184 } 185 186 } else { 187 pj_str_t mime_type; 188 char buf[256]; 189 pjsip_media_type *m; 190 pj_str_t text_body; 191 192 /* Save text body */ 193 text_body.ptr = rdata->msg_info.msg->body->data; 194 text_body.slen = rdata->msg_info.msg->body->len; 195 196 /* Get mime type */ 197 m = &rdata->msg_info.msg->body->content_type; 198 mime_type.ptr = buf; 199 mime_type.slen = pj_ansi_snprintf(buf, sizeof(buf), 200 "%.*s/%.*s", 201 (int)m->type.slen, 202 m->type.ptr, 203 (int)m->subtype.slen, 204 m->subtype.ptr); 205 if (mime_type.slen < 1) 206 mime_type.slen = 0; 207 208 if (pjsua_var.ua_cfg.cb.on_pager) { 209 (*pjsua_var.ua_cfg.cb.on_pager)(call_id, from, to, &contact, 210 &mime_type, &text_body); 211 } 192 212 } 193 213 … … 202 222 pj_str_t from, to; 203 223 pjsip_accept_hdr *accept_hdr; 204 pjsip_contact_hdr *contact_hdr;205 224 pjsip_msg *msg; 206 225 pj_status_t status; … … 243 262 * not available, then use From header. 244 263 */ 245 from.ptr = (char*) pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_URL_SIZE); 246 contact_hdr = (pjsip_contact_hdr*) 247 pjsip_msg_find_hdr(rdata->msg_info.msg, 248 PJSIP_H_CONTACT, NULL); 249 if (contact_hdr) { 250 from.slen = pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR, 251 contact_hdr->uri, 252 from.ptr, PJSIP_MAX_URL_SIZE); 253 } else { 254 from.slen = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, 255 rdata->msg_info.from->uri, 256 from.ptr, PJSIP_MAX_URL_SIZE); 257 } 264 from.ptr = pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_URL_SIZE); 265 from.slen = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, 266 rdata->msg_info.from->uri, 267 from.ptr, PJSIP_MAX_URL_SIZE); 258 268 259 269 if (from.slen < 1)
Note: See TracChangeset
for help on using the changeset viewer.