From eef103ae0285671ea9d5a9705b028be29bcee1fd Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Mon, 9 Jul 2007 16:43:42 +0000 Subject: [PATCH] misc. changes --- mbuni/doc/userguide.shtml | 9 +++++++++ mbuni/mmlib/mms_util.c | 4 +++- mbuni/mmsbox/mmsbox.c | 23 +++++++++++++++-------- mbuni/mmsbox/mmsbox_cfg.c | 2 ++ mbuni/mmsbox/mmsbox_cfg.h | 2 +- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/mbuni/doc/userguide.shtml b/mbuni/doc/userguide.shtml index 3d68d4a..2837477 100644 --- a/mbuni/doc/userguide.shtml +++ b/mbuni/doc/userguide.shtml @@ -3099,6 +3099,15 @@ A detailed list of configuration parameters for MMS Services is given below. + + + %k + + + Keyword + + + %i diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index cbd0a30..f41ff8b 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -1214,7 +1214,6 @@ static struct { {"image/x-up-wpng", "png"}, {"audio/mpeg", "mp3"}, {"audio/wav", "wav"}, - {"audio/x-wav", "wav"}, {"audio/basic", "au"}, {"audio/amr", "amr"}, {"audio/x-amr", "amr"}, @@ -1223,6 +1222,9 @@ static struct { {"audio/sp-midi", "mid"}, {"application/smil", "smil"}, {"application/vnd.wap.mms-message", "mms"}, + {"application/java-archive", "jar"}, + {"video/3gpp", "3gp"}, + {"video/3gpp", "3gp2"}, {NULL, NULL} }; diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 1398724..31927d4 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -156,7 +156,9 @@ static MmsService *get_service(Octstr *keyword, Octstr *mmc_id) } static void add_all_matching_parts(MIMEEntity *plist, MmsServiceUrlParam *pm, - MIMEEntity *me, MmsMsg *msg, int lev, int count) + Octstr *keyword, + MIMEEntity *me, + MmsMsg *msg, int lev, int count) { int i, n; List *headers = NULL; @@ -170,12 +172,16 @@ static void add_all_matching_parts(MIMEEntity *plist, MmsServiceUrlParam *pm, } else if (pm->type == NO_PART && lev == 0) { data = octstr_create(""); /* We'll add value below. */ goto done; + } else if (pm->type == KEYWORD_PART && lev == 0) { + data = keyword ? octstr_duplicate(keyword) : octstr_create(""); + ctype = octstr_create("text/plain"); + goto done; } if ((n = mime_entity_num_parts(me)) > 0) { /* Recurse over multi-parts. */ for (i = 0; i < n; i++) { MIMEEntity *x = mime_entity_get_part(me,i); - add_all_matching_parts(plist, pm, x, msg, lev+1,i); + add_all_matching_parts(plist, pm, NULL, x, msg, lev+1,i); mime_entity_destroy(x); } goto done; @@ -209,7 +215,7 @@ done: Octstr *cd = octstr_format("form-data; name=\"%S\"", pm->name); List *xh; - if (ctype) { + if (ctype && pm->type != KEYWORD_PART) { /* If Content-Location header or name (content-type) parameter given, pass it as filename. */ Octstr *c = NULL, *q = NULL; Octstr *cloc = http_header_value(headers, @@ -295,9 +301,10 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, List *passthro_headers, Octstr **err); static int fetch_serviceurl(MmsEnvelope *e, - MmsService *ms, MmsMsg *m, - MIMEEntity *msg, - Octstr **err) + MmsService *ms, MmsMsg *m, + MIMEEntity *msg, + Octstr *keyword, + Octstr **err) { List *rh, *rph = NULL; Octstr *body = NULL, *rb = NULL; @@ -337,7 +344,7 @@ static int fetch_serviceurl(MmsEnvelope *e, for (i = 0, n = gwlist_len(ms->params); i < n; i++) { MmsServiceUrlParam *p = gwlist_get(ms->params, i); - add_all_matching_parts(x, p, msg, m, 0, i); + add_all_matching_parts(x, p, keyword, msg, m, 0, i); } body = mime_entity_body(x); @@ -481,7 +488,7 @@ static int mmsbox_service_dispatch(MmsEnvelope *e) e->_x = ms; /* Remember it for later. */ - res = fetch_serviceurl(e, ms, msg, me, &err); + res = fetch_serviceurl(e, ms, msg, me, keyword, &err); done: if (err) { diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index 7788ffd..e3ff00c 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -337,6 +337,8 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func) p->type = OTHER_PART; break; case 'z': p->type = ANY_PART; break; + case 'k': + p->type = KEYWORD_PART; break; case '%': p->type = NO_PART; break; default: diff --git a/mbuni/mmsbox/mmsbox_cfg.h b/mbuni/mmsbox/mmsbox_cfg.h index d32a52b..909c4c0 100644 --- a/mbuni/mmsbox/mmsbox_cfg.h +++ b/mbuni/mmsbox/mmsbox_cfg.h @@ -38,7 +38,7 @@ typedef struct MmsServiceUrlParam { Octstr *name; enum {NO_PART, AUDIO_PART, IMAGE_PART, VIDEO_PART, TEXT_PART, SMIL_PART , OTHER_PART, - ANY_PART, WHOLE_BINARY} type; + ANY_PART, WHOLE_BINARY, KEYWORD_PART} type; Octstr *value; /* for generic value (type == NO_PART), * or for value that follows spec (e.g. %Tisatest is allowed) */