1
0
Fork 0

- Improved handling of retrieve-conf message received on send interfaces

This commit is contained in:
bagyenda 2006-07-17 06:52:10 +00:00
parent bbeb0c91e3
commit c42ddb8aa5
5 changed files with 35 additions and 6 deletions

View File

@ -1645,6 +1645,22 @@ MmsMsg *mms_sendconf(char *errstr, char *msgid, char *transid, int isforward, in
return m;
}
int mms_make_sendreq(MmsMsg *retrieveconf)
{
gw_assert(retrieveconf);
if (retrieveconf->message_type == MMS_MSGTYPE_SEND_REQ)
return 0;
gw_assert(retrieveconf->message_type == MMS_MSGTYPE_RETRIEVE_CONF);
retrieveconf->message_type = MMS_MSGTYPE_SEND_REQ;
mms_replace_header_value(retrieveconf, "X-Mms-Message-Type",
(char *)mms_message_type_to_cstr(MMS_MSGTYPE_SEND_REQ));
return 0;
}
int mms_replace_header_value(MmsMsg *msg, char *hname, char *value)
{

View File

@ -118,4 +118,10 @@ int mms_clearbody(MmsMsg *msg);
* Use function with extreme caution! It should be for testing only really!!!!
*/
int mms_putbody(MmsMsg *msg, void *body, int ismultipart);
/* Convert a retrieve_conf message to a send_req messagre
* checked runtime error to pass anything but a send_req/retrieve_conf.
* returns 0 on success.
*/
int mms_make_sendreq(MmsMsg *retrieveconf);
#endif

View File

@ -338,7 +338,8 @@ static void mm7eaif_receive(MmsHTTPClientInfo *h)
switch(mtype) {
case MMS_MSGTYPE_SEND_REQ:
case MMS_MSGTYPE_RETRIEVE_CONF:
/* Get Message ID */
if ((msgid = http_header_value(h->headers, octstr_imm("X-NOKIA-MMSC-Message-Id"))) == NULL)
msgid = http_header_value(mh, octstr_imm("Message-ID"));
@ -652,9 +653,11 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, Octstr *to,
http_header_add(rh, "X-NOKIA-MMSC-From", octstr_get_cstr(from));
http_header_add(rh, "X-NOKIA-MMSC-Version", EAIF_VERSION);
if (mtype == MMS_MSGTYPE_SEND_REQ)
if (mtype == MMS_MSGTYPE_SEND_REQ ||
mtype == MMS_MSGTYPE_RETRIEVE_CONF) {
msgtype = "MultiMediaMessage";
else if (mtype == MMS_MSGTYPE_DELIVERY_IND)
mms_make_sendreq(m); /* ensure it is a sendreq. */
} else if (mtype == MMS_MSGTYPE_DELIVERY_IND)
msgtype = "DeliveryReport";
else
msgtype = "ReadReply";

View File

@ -416,7 +416,7 @@ static int mmsbox_service_dispatch(MmsEnvelope *e)
Octstr *err = NULL, *keyword = NULL;
MmsService *ms;
gw_assert(e->msgtype == MMS_MSGTYPE_SEND_REQ);
gw_assert(e->msgtype == MMS_MSGTYPE_SEND_REQ || e->msgtype == MMS_MSGTYPE_RETRIEVE_CONF);
if ((msg = mms_queue_getdata(e)) == NULL) {
err = octstr_format("Failed to read message for queue entry %s!",

View File

@ -639,9 +639,13 @@ static int mm7eaif_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgid,
http_header_add(rh, "X-NOKIA-MMSC-Message-Id", octstr_get_cstr(msgid));
http_header_add(rh, "X-NOKIA-MMSC-Version", EAIF_VERSION);
if (mtype == MMS_MSGTYPE_SEND_REQ)
if (mtype == MMS_MSGTYPE_SEND_REQ ||
mtype == MMS_MSGTYPE_RETRIEVE_CONF) {
msgtype = "MultiMediaMessage";
else if (mtype == MMS_MSGTYPE_DELIVERY_IND)
mms_make_sendreq(m); /* ensure it is a sendreq. */
} else if (mtype == MMS_MSGTYPE_DELIVERY_IND)
msgtype = "DeliveryReport";
else
msgtype = "ReadReply";