1
0
Fork 0

Minor fix: remove quotes from incoming MM4 numbers

This commit is contained in:
bagyenda 2007-05-09 11:14:21 +00:00
parent 64722b0299
commit 81adc79a47
3 changed files with 24 additions and 4 deletions

View File

@ -191,7 +191,6 @@ static void add_all_matching_parts(MIMEEntity *plist, MmsServiceUrlParam *pm,
#define BEGINSWITH(s, prefix) (octstr_case_search(s, octstr_imm(prefix),0) == 0)
#define TYPE_MATCH(typ, prefix) ((pm->type) == (typ) && \
BEGINSWITH(xctype, prefix))
if (xctype)
if (TYPE_MATCH(IMAGE_PART,"image/") ||
TYPE_MATCH(AUDIO_PART,"audio/") ||

View File

@ -40,7 +40,8 @@ typedef struct MmsServiceUrlParam {
TEXT_PART, SMIL_PART , OTHER_PART,
ANY_PART, WHOLE_BINARY} type;
Octstr *value; /* for generic value (type == NO_PART),
* or for value that follows spec (e.g. %Tisatest is allowed) */
* or for value that follows spec (e.g. %Tisatest is allowed)
*/
} MmsServiceUrlParam;
typedef struct MmsService {

View File

@ -47,6 +47,8 @@ static void fixup_addresses(List *headers);
static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid, char *status, Octstr *msgid);
static void strip_quotes(Octstr *s);
static mCfg *cfg;
static List *proxyrelays;
@ -379,6 +381,10 @@ int main(int argc, char *argv[])
o_to = NULL;
qf = mms_getqf_fromtransid(transid);
if (qf) {
octstr_strip_blanks(qf);
strip_quotes(qf);
octstr_strip_blanks(o_to);
strip_quotes(o_to);
MmsEnvelope *e = mms_queue_readenvelope(octstr_get_cstr(qf),
octstr_get_cstr(settings->global_queuedir),
1);
@ -387,7 +393,6 @@ int main(int argc, char *argv[])
mm4_types[mtype].mm4str,
octstr_get_cstr(xproxy),
octstr_get_cstr(transid),
octstr_get_cstr(qf));
else {
MmsEnvelopeTo *t;
@ -416,7 +421,7 @@ int main(int argc, char *argv[])
settings->mms_billfuncs->mms_logcdr(cdr);
}
info(0, "MM4 received %s from proxy %s to %s from %s => %s, status: [%s, %s]",
info(0, "MM4 received %s from proxy %s to %s from %s => %s, status: [%s, %s]",
mm4_types[mtype].mm4str,
octstr_get_cstr(xproxy), o_to ? octstr_get_cstr(o_to) : octstr_get_cstr(xto),
octstr_get_cstr(xfrom),
@ -621,3 +626,18 @@ static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid,
}
mime_entity_destroy(m);
}
static void strip_quotes(Octstr *s)
{
int l = s ? octstr_len(s) : 0;
if (l == 0)
return;
if (octstr_get_char(s, 0) == '"') {
octstr_delete(s, 0, 1);
l--;
}
if (octstr_get_char(s, l-1) == '"')
octstr_delete(s, l-1, 1);
}