diff --git a/mbuni/Makefile.in b/mbuni/Makefile.in index a43bcf6..14dc115 100644 --- a/mbuni/Makefile.in +++ b/mbuni/Makefile.in @@ -11,7 +11,7 @@ # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. - +# @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ diff --git a/mbuni/mmlib/Makefile.in b/mbuni/mmlib/Makefile.in index 6edc8a9..7e14f0e 100644 --- a/mbuni/mmlib/Makefile.in +++ b/mbuni/mmlib/Makefile.in @@ -11,7 +11,7 @@ # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. - +# @SET_MAKE@ diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index e878384..62ac89c 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -162,7 +162,7 @@ MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg) m->prov_getstatus = cfg_getx(grp,octstr_imm("prov-server-sub-status-script")); m->mms_notify_txt = cfg_getx(grp, octstr_imm("mms-notify-text")); m->mms_notify_unprov_txt = cfg_getx(grp, octstr_imm("mms-notify-unprovisioned-text")); - m->mmbox_host = cfg_getx(grp, octstr_imm("mm-box-host")); + m->mms_email_txt = cfg_getx(grp, octstr_imm("mms-to-email-txt")); m->mms_email_html = cfg_getx(grp, octstr_imm("mms-to-email-html")); diff --git a/mbuni/mmlib/mms_util.h b/mbuni/mmlib/mms_util.h index fb692a9..4fb31a9 100644 --- a/mbuni/mmlib/mms_util.h +++ b/mbuni/mmlib/mms_util.h @@ -93,7 +93,6 @@ typedef struct MmsBoxSettings { Octstr *mms_notify_txt; Octstr *mms_notify_unprov_txt; Octstr *mms_toolarge; - Octstr *mmbox_host; /* XXX need to remove this. */ Octstr *mms_email_txt; Octstr *mms_email_html; diff --git a/mbuni/mmsc/Makefile.in b/mbuni/mmsc/Makefile.in index 8b51965..3166c93 100644 --- a/mbuni/mmsc/Makefile.in +++ b/mbuni/mmsc/Makefile.in @@ -11,7 +11,7 @@ # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. - +# @SET_MAKE@ SOURCES = mmsfromemail.c mmsglobalsender.c mmsmobilesender.c mmsproxy.c mmssend.c diff --git a/mbuni/mmsc/mmsmobilesender.c b/mbuni/mmsc/mmsmobilesender.c index ea2caa3..d2a0998 100644 --- a/mbuni/mmsc/mmsmobilesender.c +++ b/mbuni/mmsc/mmsmobilesender.c @@ -292,7 +292,6 @@ static int sendNotify(MmsEnvelope *e) /* For phone, getting here means the message can be delivered. So: * - Check whether the recipient is provisioned, if not, wait (script called will queue creation req) - * - Send to MMBox if not yet done. * - If the recipient can't take MMS, then send SMS. */ @@ -322,70 +321,29 @@ static int sendNotify(MmsEnvelope *e) mms_queue_free_env(e); goto done; - } else if (e->mdata == NULL) { /* Not yet sent to MMBox etc, but provisioned. */ + } else if (send_ind == 0) { /* provisioned but does not support */ + Octstr *s = octstr_format(octstr_get_cstr(settings->mms_notify_txt), + from); + List *pheaders; + Octstr *sto = octstr_duplicate(phonenum); - int x; - if (settings->mmbox_host && - octstr_len(settings->mmbox_host) > 0) { /* Only if mmbox is configured. */ - Octstr *mto = octstr_format("%S@%S", phonenum, settings->mmbox_host); - x = mms_sendtoemail(from, mto, e->subject, e->msgId, msg, 0, &err, - octstr_get_cstr(settings->sendmail), settings->hostname, 1, - 1, octstr_get_cstr(settings->mms_email_txt), - octstr_get_cstr(settings->mms_email_html), 1); - octstr_destroy(mto); - } else - x = 0; + octstr_url_encode(s); + octstr_url_encode(sto); - if (x != 0) { /* Failed to send to MMBox...*/ - res = MMS_SEND_ERROR_TRANSIENT; - err = octstr_format("Failed to send to MMBox %d", x); - e->attempts++; - e->lasttry = tnow; - e->sendt = e->lasttry + settings->send_back_off * e->attempts; - - if (mms_queue_update(e) == 1) - e = NULL; /* Queue entry gone. */ - else - mms_queue_free_env(e); - goto done; - } + url = octstr_format("%S&text=%S&to=%S",settings->sendsms_url,s, sto); + pheaders = http_create_empty_headers(); + http_header_add(pheaders, "Connection", "close"); + http_header_add(pheaders, "User-Agent", MM_NAME "/" GW_VERSION); + + http_start_request(httpcaller, HTTP_METHOD_GET, url, + pheaders, NULL, 0, &edummy, NULL); + + + http_destroy_headers(pheaders); + octstr_destroy(url); + octstr_destroy(s); + octstr_destroy(sto); - /* else Send to MMBox succeeded or non-provisioned. - * But if phone cannot handle MMS-Ind, then send it sms. - */ - if (send_ind == 0) { - Octstr *s = octstr_format(octstr_get_cstr(settings->mms_notify_txt), - from); - List *pheaders; - - Octstr *xto = octstr_duplicate(phonenum); - - octstr_url_encode(s); - octstr_url_encode(xto); - - url = octstr_format("%S&text=%S&to=%S",settings->sendsms_url,s, xto); - pheaders = http_create_empty_headers(); - http_header_add(pheaders, "Connection", "close"); - http_header_add(pheaders, "User-Agent", MM_NAME "/" GW_VERSION); - - http_start_request(httpcaller, HTTP_METHOD_GET, url, - pheaders, NULL, 0, &edummy, NULL); - - - http_destroy_headers(pheaders); - octstr_destroy(url); - octstr_destroy(s); - octstr_destroy(xto); - - } - e->mdata = octstr_imm("MMSent"); /* Mark as sent to MMBox. */ - if (mms_queue_update(e) == 1) { - e = NULL; - goto done; - } - } - - if (send_ind == 0) { /* No MMS Ind, go away but first update queue entry. */ res = MMS_SEND_OK; err = octstr_imm("No MMS Ind support, sent SMS instead"); @@ -395,7 +353,8 @@ static int sendNotify(MmsEnvelope *e) else mms_queue_free_env(e); goto done; - } + + } } /* To get here means we can send Ind. */