Browse code

- added insert_hf(txt) - insert txt as header before the first header - added insert_hf(txt, hdr) - insert txt as header before hdr - added append_hf(txt, hdr) - add txt as header after hdr - txt parameter of new functions as well as for old append_hf(txt) has support for pseudo-variables - credits for suggestions and contributions to Klaus Darilion and Boris Bliznioukov

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@398 689a6050-402a-0410-94f2-e92a70836424

Daniel-Constantin Mierla authored on 23/11/2005 20:35:15
Showing 4 changed files
... ...
@@ -9,6 +9,8 @@ Edited by
9 9
 
10 10
 Andrei Pelinescu-Onciul
11 11
 
12
+Daniel-Constantin Mierla
13
+
12 14
    Copyright � 2003 FhG FOKUS
13 15
      _________________________________________________________
14 16
 
... ...
@@ -34,12 +36,15 @@ Andrei Pelinescu-Onciul
34 36
               1.3.6. subst_uri('/re/repl/flags')
35 37
               1.3.7. subst_user('/re/repl/flags')
36 38
               1.3.8. append_to_reply(txt)
37
-              1.3.9. append_hf(hf)
38
-              1.3.10. append_urihf(prefix, suffix)
39
-              1.3.11. is_present_hf(hf_name)
40
-              1.3.12. append_time()
41
-              1.3.13. is_method(name)
42
-              1.3.14. remove_hf(hname)
39
+              1.3.9. append_hf(txt)
40
+              1.3.10. append_hf(txt, hdr)
41
+              1.3.11. insert_hf(txt)
42
+              1.3.12. insert_hf(txt, hdr)
43
+              1.3.13. append_urihf(prefix, suffix)
44
+              1.3.14. is_present_hf(hf_name)
45
+              1.3.15. append_time()
46
+              1.3.16. is_method(name)
47
+              1.3.17. remove_hf(hname)
43 48
 
44 49
         1.4. Known Limitations
45 50
 
... ...
@@ -56,11 +61,14 @@ Andrei Pelinescu-Onciul
56 61
    1-7. subst usage
57 62
    1-8. append_to_reply usage
58 63
    1-9. append_hf usage
59
-   1-10. append_urihf usage
60
-   1-11. is_present_hf usage
61
-   1-12. append_time usage
62
-   1-13. is_method usage
63
-   1-14. remove_hf usage
64
+   1-10. append_hf usage
65
+   1-11. insert_hf usage
66
+   1-12. insert_hf usage
67
+   1-13. append_urihf usage
68
+   1-14. is_present_hf usage
69
+   1-15. append_time usage
70
+   1-16. is_method usage
71
+   1-17. remove_hf usage
64 72
      _________________________________________________________
65 73
 
66 74
 Chapter 1. User's Guide
... ...
@@ -281,13 +289,14 @@ append_to_reply("Foo: bar\r\n");
281 289
 ...
282 290
      _________________________________________________________
283 291
 
284
-1.3.9. append_hf(hf)
292
+1.3.9. append_hf(txt)
285 293
 
286
-   Appends txt after the last header field.
294
+   Appends 'txt' as header after the last header field.
287 295
 
288 296
    Meaning of the parameters is as follows:
289 297
 
290
-     * hf - Header field to be appended.
298
+     * txt - Header field to be appended. The value can contain
299
+       pseudo-variables which will be replaced at run time.
291 300
 
292 301
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
293 302
    FAILURE_ROUTE, BRANCH_ROUTE.
... ...
@@ -295,10 +304,70 @@ append_to_reply("Foo: bar\r\n");
295 304
    Example 1-9. append_hf usage
296 305
 ...
297 306
 append_hf("P-hint: VOICEMAIL\r\n");
307
+append_hf("From-username: $fU\r\n");
308
+...
309
+     _________________________________________________________
310
+
311
+1.3.10. append_hf(txt, hdr)
312
+
313
+   Appends 'txt' as header after first 'hdr' header field.
314
+
315
+   Meaning of the parameters is as follows:
316
+
317
+     * txt - Header field to be appended. The value can contain
318
+       pseudo-variables which will be replaced at run time.
319
+     * hdr - Header name after which the 'txt' is appended.
320
+
321
+   This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
322
+   FAILURE_ROUTE, BRANCH_ROUTE.
323
+
324
+   Example 1-10. append_hf usage
325
+...
326
+append_hf("P-hint: VOICEMAIL\r\n", "Call-ID");
327
+append_hf("From-username: $fU\r\n", "Call-ID");
328
+...
329
+     _________________________________________________________
330
+
331
+1.3.11. insert_hf(txt)
332
+
333
+   Inserts 'txt' as header before the first header field.
334
+
335
+   Meaning of the parameters is as follows:
336
+
337
+     * txt - Header field to be inserted. The value can contain
338
+       pseudo-variables which will be replaced at run time.
339
+
340
+   This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
341
+   FAILURE_ROUTE, BRANCH_ROUTE.
342
+
343
+   Example 1-11. insert_hf usage
344
+...
345
+insert_hf("P-hint: VOICEMAIL\r\n");
346
+insert_hf("To-username: $tU\r\n");
347
+...
348
+     _________________________________________________________
349
+
350
+1.3.12. insert_hf(txt, hdr)
351
+
352
+   Inserts 'txt' as header before first 'hdr' header field.
353
+
354
+   Meaning of the parameters is as follows:
355
+
356
+     * txt - Header field to be inserted. The value can contain
357
+       pseudo-variables which will be replaced at run time.
358
+     * hdr - Header name before which the 'txt' is inserted.
359
+
360
+   This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
361
+   FAILURE_ROUTE, BRANCH_ROUTE.
362
+
363
+   Example 1-12. insert_hf usage
364
+...
365
+insert_hf("P-hint: VOICEMAIL\r\n", "Call-ID");
366
+insert_hf("To-username: $tU\r\n", "Call-ID");
298 367
 ...
299 368
      _________________________________________________________
300 369
 
301
-1.3.10. append_urihf(prefix, suffix)
370
+1.3.13. append_urihf(prefix, suffix)
302 371
 
303 372
    Append header field name with original Request-URI in middle.
304 373
 
... ...
@@ -310,13 +379,13 @@ append_hf("P-hint: VOICEMAIL\r\n");
310 379
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
311 380
    BRANCH_ROUTE.
312 381
 
313
-   Example 1-10. append_urihf usage
382
+   Example 1-13. append_urihf usage
314 383
 ...
315 384
 append_urihf("CC-Diversion: ", "\r\n");
316 385
 ...
317 386
      _________________________________________________________
318 387
 
319
-1.3.11. is_present_hf(hf_name)
388
+1.3.14. is_present_hf(hf_name)
320 389
 
321 390
    Return true if a header field is present in message.
322 391
 
... ...
@@ -332,13 +401,13 @@ append_urihf("CC-Diversion: ", "\r\n");
332 401
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
333 402
    FAILURE_ROUTE, BRANCH_ROUTE.
334 403
 
335
-   Example 1-11. is_present_hf usage
404
+   Example 1-14. is_present_hf usage
336 405
 ...
337 406
 if (is_present_hf("From")) log(1, "From HF Present");
338 407
 ...
339 408
      _________________________________________________________
340 409
 
341
-1.3.12. append_time()
410
+1.3.15. append_time()
342 411
 
343 412
    Adds a time header to the message. Header format is: "Date:
344 413
    %a, %d %b %Y %H:%M:%S GMT", with the legend:
... ...
@@ -356,13 +425,13 @@ if (is_present_hf("From")) log(1, "From HF Present");
356 425
    This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
357 426
    BRANCH_ROUTE.
358 427
 
359
-   Example 1-12. append_time usage
428
+   Example 1-15. append_time usage
360 429
 ...
361 430
 append_time();
362 431
 ...
363 432
      _________________________________________________________
364 433
 
365
-1.3.13. is_method(name)
434
+1.3.16. is_method(name)
366 435
 
367 436
    Check if the method of the message matches the name. If name
368 437
    is a known method (invite, cancel, ack, bye, options, info,
... ...
@@ -387,7 +456,7 @@ append_time();
387 456
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
388 457
    FAILURE_ROUTE.
389 458
 
390
-   Example 1-13. is_method usage
459
+   Example 1-16. is_method usage
391 460
 ...
392 461
 if(is_method("INVITE"))
393 462
 {
... ...
@@ -400,7 +469,7 @@ if(is_method("OPTION|UPDATE"))
400 469
 ...
401 470
      _________________________________________________________
402 471
 
403
-1.3.14. remove_hf(hname)
472
+1.3.17. remove_hf(hname)
404 473
 
405 474
    Remove from message all headers with name "hname"
406 475
 
... ...
@@ -413,7 +482,7 @@ if(is_method("OPTION|UPDATE"))
413 482
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
414 483
    FAILURE_ROUTE and BRANCH_ROUTE.
415 484
 
416
-   Example 1-14. remove_hf usage
485
+   Example 1-17. remove_hf usage
417 486
 ...
418 487
 if(remove_hf("User-Agent"))
419 488
 {
... ...
@@ -31,6 +31,13 @@
31 31
 			<email>pelinescu-onciul@fokus.fraunhofer.de</email>
32 32
 		</address>
33 33
 		</editor>
34
+		<editor>
35
+		<firstname>Daniel-Constantin</firstname>
36
+		<surname>Mierla</surname>
37
+		<address>
38
+			<email>daniel@voice-system.ro</email>
39
+		</address>
40
+		</editor>
34 41
 	</authorgroup>
35 42
 	<copyright>
36 43
 		<year>2003</year>
... ...
@@ -355,15 +355,17 @@ append_to_reply("Foo: bar\r\n");
355 355
 
356 356
 	<section>
357 357
 		<title>
358
-		<function moreinfo="none">append_hf(hf)</function>
358
+		<function moreinfo="none">append_hf(txt)</function>
359 359
 		</title>
360 360
 		<para>
361
-		Appends txt after the last header field.
361
+			Appends 'txt' as header after the last header field. 
362 362
 		</para>
363 363
 		<para>Meaning of the parameters is as follows:</para>
364 364
 		<itemizedlist>
365 365
 		<listitem>
366
-			<para><emphasis>hf</emphasis> - Header field to be appended.
366
+			<para><emphasis>txt</emphasis> - Header field to be appended. The
367
+			value can contain pseudo-variables which will be replaced at run
368
+			time.
367 369
 			</para>
368 370
 		</listitem>
369 371
 		</itemizedlist>
... ...
@@ -376,6 +378,111 @@ append_to_reply("Foo: bar\r\n");
376 378
 		<programlisting format="linespecific">
377 379
 ...
378 380
 append_hf("P-hint: VOICEMAIL\r\n");
381
+append_hf("From-username: $fU\r\n");
382
+...
383
+</programlisting>
384
+		</example>
385
+	</section>
386
+
387
+	<section>
388
+		<title>
389
+		<function moreinfo="none">append_hf(txt, hdr)</function>
390
+		</title>
391
+		<para>
392
+		Appends 'txt' as header after first 'hdr' header field.
393
+		</para>
394
+		<para>Meaning of the parameters is as follows:</para>
395
+		<itemizedlist>
396
+		<listitem>
397
+			<para><emphasis>txt</emphasis> - Header field to be appended. The
398
+			value can contain pseudo-variables which will be replaced at run
399
+			time.
400
+			</para>
401
+		</listitem>
402
+		<listitem>
403
+			<para><emphasis>hdr</emphasis> - Header name after which the 'txt'
404
+			is appended.
405
+			</para>
406
+		</listitem>
407
+		</itemizedlist>
408
+		<para>
409
+		This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, 
410
+		FAILURE_ROUTE, BRANCH_ROUTE.
411
+		</para>
412
+		<example>
413
+		<title><function>append_hf</function> usage</title>
414
+		<programlisting format="linespecific">
415
+...
416
+append_hf("P-hint: VOICEMAIL\r\n", "Call-ID");
417
+append_hf("From-username: $fU\r\n", "Call-ID");
418
+...
419
+</programlisting>
420
+		</example>
421
+	</section>
422
+
423
+	<section>
424
+		<title>
425
+		<function moreinfo="none">insert_hf(txt)</function>
426
+		</title>
427
+		<para>
428
+		Inserts 'txt' as header before the first header field.
429
+		</para>
430
+		<para>Meaning of the parameters is as follows:</para>
431
+		<itemizedlist>
432
+		<listitem>
433
+			<para><emphasis>txt</emphasis> - Header field to be inserted. The
434
+			value can contain pseudo-variables which will be replaced at run
435
+			time.
436
+			</para>
437
+		</listitem>
438
+		</itemizedlist>
439
+		<para>
440
+		This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, 
441
+		FAILURE_ROUTE, BRANCH_ROUTE.
442
+		</para>
443
+		<example>
444
+		<title><function>insert_hf</function> usage</title>
445
+		<programlisting format="linespecific">
446
+...
447
+insert_hf("P-hint: VOICEMAIL\r\n");
448
+insert_hf("To-username: $tU\r\n");
449
+...
450
+</programlisting>
451
+		</example>
452
+	</section>
453
+
454
+
455
+	<section>
456
+		<title>
457
+		<function moreinfo="none">insert_hf(txt, hdr)</function>
458
+		</title>
459
+		<para>
460
+		Inserts 'txt' as header before first 'hdr' header field.
461
+		</para>
462
+		<para>Meaning of the parameters is as follows:</para>
463
+		<itemizedlist>
464
+		<listitem>
465
+			<para><emphasis>txt</emphasis> - Header field to be inserted. The
466
+			value can contain pseudo-variables which will be replaced at run
467
+			time.
468
+			</para>
469
+		</listitem>
470
+		<listitem>
471
+			<para><emphasis>hdr</emphasis> - Header name before which the 'txt'
472
+			is inserted.
473
+			</para>
474
+		</listitem>
475
+		</itemizedlist>
476
+		<para>
477
+		This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, 
478
+		FAILURE_ROUTE, BRANCH_ROUTE.
479
+		</para>
480
+		<example>
481
+		<title><function>insert_hf</function> usage</title>
482
+		<programlisting format="linespecific">
483
+...
484
+insert_hf("P-hint: VOICEMAIL\r\n", "Call-ID");
485
+insert_hf("To-username: $tU\r\n", "Call-ID");
379 486
 ...
380 487
 </programlisting>
381 488
 		</example>
... ...
@@ -94,7 +94,10 @@ static int is_present_hf_f(struct sip_msg* msg, char* str_hf, char* foo);
94 94
 static int replace_all_f(struct sip_msg* msg, char* key, char* str);
95 95
 static int search_append_f(struct sip_msg*, char*, char*);
96 96
 static int append_to_reply_f(struct sip_msg* msg, char* key, char* str);
97
-static int append_hf(struct sip_msg* msg, char* str1, char* str2);
97
+static int append_hf_1(struct sip_msg* msg, char* str1, char* str2);
98
+static int append_hf_2(struct sip_msg* msg, char* str1, char* str2);
99
+static int insert_hf_1(struct sip_msg* msg, char* str1, char* str2);
100
+static int insert_hf_2(struct sip_msg* msg, char* str1, char* str2);
98 101
 static int append_urihf(struct sip_msg* msg, char* str1, char* str2);
99 102
 static int append_time_f(struct sip_msg* msg, char* , char *);
100 103
 static int is_method_f(struct sip_msg* msg, char* , char *);
... ...
@@ -104,6 +107,7 @@ static int fixup_substre(void**, int);
104 107
 static int str_fixup(void** param, int param_no);
105 108
 static int hname_fixup(void** param, int param_no);
106 109
 static int fixup_method(void** param, int param_no);
110
+static int add_header_fixup(void** param, int param_no);
107 111
 
108 112
 static int mod_init(void);
109 113
 
... ...
@@ -119,8 +123,14 @@ static cmd_export_t cmds[]={
119 123
 			REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE}, 
120 124
 	{"append_to_reply",  append_to_reply_f, 1, 0,
121 125
 			REQUEST_ROUTE|BRANCH_ROUTE},
122
-	{"append_hf",        append_hf,         1, str_fixup,
123
-			REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE}, 
126
+	{"append_hf",        append_hf_1,       1, add_header_fixup,
127
+			REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
128
+	{"append_hf",        append_hf_2,       2, add_header_fixup,
129
+			REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
130
+	{"insert_hf",        insert_hf_1,       1, add_header_fixup,
131
+			REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
132
+	{"insert_hf",        insert_hf_2,       2, add_header_fixup,
133
+			REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
124 134
 	{"append_urihf",     append_urihf,      2, str_fixup,   
125 135
 			REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
126 136
 	{"remove_hf",        remove_hf_f,       1, hname_fixup,
... ...
@@ -583,54 +593,130 @@ static int append_to_reply_f(struct sip_msg* msg, char* key, char* str)
583 593
 
584 594
 /* add str1 to end of header or str1.r-uri.str2 */
585 595
 
586
-static int append_hf_helper(struct sip_msg* msg, str *str1, str *str2)
596
+static int add_hf_helper(struct sip_msg* msg, str *str1, str *str2,
597
+		xl_elem_t *model, int mode, str *hfs)
587 598
 {
588 599
 	struct lump* anchor;
600
+	struct hdr_field *hf;
589 601
 	char *s;
590 602
 	int len;
603
+#define ADD_HF_PRINTBUF_SIZE   1024
604
+	static char printbuf[ADD_HF_PRINTBUF_SIZE];
605
+	int printbuf_len;
606
+	str s0;
591 607
 
592 608
 	if (parse_headers(msg, HDR_EOH_F, 0) == -1) {
593
-		LOG(L_ERR, "append_hf(): Error while parsing message\n");
609
+		LOG(L_ERR, "textops:add_hf_helper: Error while parsing message\n");
594 610
 		return -1;
595 611
 	}
612
+	
613
+	hf = 0;
614
+	if(hfs!=NULL) {
615
+		for (hf=msg->headers; hf; hf=hf->next) {
616
+			if((str*)hfs->s==NULL)
617
+			{
618
+				if (((str*)hfs)->len!=hf->type)
619
+				continue;
620
+			} else {
621
+				if (hf->name.len!=((str*)hfs)->len)
622
+					continue;
623
+				if (strncasecmp(hf->name.s,((str*)hfs)->s,hf->name.len)!=0)
624
+					continue;
625
+			}
626
+			break;
627
+		}
628
+	}
596 629
 
597
-	anchor = anchor_lump(msg, msg->unparsed - msg->buf, 0, 0);
598
-	if (anchor == 0) {
599
-		LOG(L_ERR, "append_hf(): Can't get anchor\n");
630
+	if(mode == 0) { /* append */
631
+		if(hf==0) { /* after last header */
632
+			anchor = anchor_lump(msg, msg->unparsed - msg->buf, 0, 0);
633
+		} else { /* after hf */
634
+			anchor = anchor_lump(msg, hf->name.s + hf->len - msg->buf, 0, 0);
635
+		}
636
+	} else { /* insert */
637
+		if(hf==0) { /* before first header */
638
+			anchor = anchor_lump(msg, msg->headers->name.s - msg->buf, 0, 0);
639
+		} else { /* before hf */
640
+			anchor = anchor_lump(msg, hf->name.s - msg->buf, 0, 0);
641
+		}
642
+	}
643
+
644
+	if(anchor == 0) {
645
+		LOG(L_ERR, "textops:add_hf_helper: Can't get anchor\n");
600 646
 		return -1;
601 647
 	}
602 648
 
603
-	len=str1->len;
649
+	if(str1) {
650
+		s0 = *str1;
651
+	} else {
652
+		if(model) {
653
+			if(model->next==0 && model->spec.itf==0) {
654
+				s0 = model->text;
655
+			} else {
656
+				printbuf_len = ADD_HF_PRINTBUF_SIZE-1;
657
+				if(xl_printf(msg, model, printbuf, &printbuf_len)<0)
658
+				{
659
+					LOG(L_ERR,
660
+					"textops:add_hf_helper: error - cannot print the format\n");
661
+					return -1;
662
+				}
663
+				s0.s   = printbuf;
664
+				s0.len = printbuf_len;
665
+			}
666
+		} else {
667
+			s0.len = 0;
668
+			s0.s   = 0;
669
+		}
670
+	}
671
+		
672
+	len=s0.len;
604 673
 	if (str2) len+= str2->len + REQ_LINE(msg).uri.len;
605 674
 
606 675
 	s = (char*)pkg_malloc(len);
607 676
 	if (!s) {
608
-		LOG(L_ERR, "append_hf(): No memory left\n");
677
+		LOG(L_ERR, "textops:add_hf_helper: No memory left\n");
609 678
 		return -1;
610 679
 	}
611 680
 
612
-	memcpy(s, str1->s, str1->len);
681
+	memcpy(s, s0.s, s0.len);
613 682
 	if (str2) {
614 683
 		memcpy(s+str1->len, REQ_LINE(msg).uri.s, REQ_LINE(msg).uri.len);
615 684
 		memcpy(s+str1->len+REQ_LINE(msg).uri.len, str2->s, str2->len );
616 685
 	}
617 686
 
618 687
 	if (insert_new_lump_before(anchor, s, len, 0) == 0) {
619
-		LOG(L_ERR, "append_hf(): Can't insert lump\n");
688
+		LOG(L_ERR, "textops:add_hf_helper: Can't insert lump\n");
620 689
 		pkg_free(s);
621 690
 		return -1;
622 691
 	}
623 692
 	return 1;
624 693
 }
625 694
 
626
-static int append_hf(struct sip_msg *msg, char *str1, char *str2 )
695
+static int append_hf_1(struct sip_msg *msg, char *str1, char *str2 )
696
+{
697
+	return add_hf_helper(msg, 0, 0, (xl_elem_t*)str1, 0, 0);
698
+}
699
+
700
+static int append_hf_2(struct sip_msg *msg, char *str1, char *str2 )
701
+{
702
+	return add_hf_helper(msg, 0, 0, (xl_elem_t*)str1, 0,
703
+			(str*)str2);
704
+}
705
+
706
+static int insert_hf_1(struct sip_msg *msg, char *str1, char *str2 )
707
+{
708
+	return add_hf_helper(msg, 0, 0, (xl_elem_t*)str1, 1, 0);
709
+}
710
+
711
+static int insert_hf_2(struct sip_msg *msg, char *str1, char *str2 )
627 712
 {
628
-	return append_hf_helper(msg, (str *) str1, (str *) 0);
713
+	return add_hf_helper(msg, 0, 0, (xl_elem_t*)str1, 1, 
714
+			(str*)str2);
629 715
 }
630 716
 
631
-static int append_urihf(struct sip_msg *msg, char *str1, char *str2 )
717
+static int append_urihf(struct sip_msg *msg, char *str1, char *str2)
632 718
 {
633
-	return append_hf_helper(msg, (str *) str1, (str *) str2);
719
+	return add_hf_helper(msg, (str*)str1, (str*)str2, 0, 0, 0);
634 720
 }
635 721
 
636 722
 static int is_method_f(struct sip_msg *msg, char *meth, char *str2 )
... ...
@@ -809,3 +895,36 @@ static int fixup_method(void** param, int param_no)
809 895
 	return 0;
810 896
 }
811 897
 
898
+
899
+/*
900
+ * Convert char* parameter to xl_elem parameter
901
+ */
902
+static int it_list_fixup(void** param, int param_no)
903
+{
904
+	xl_elem_t *model;
905
+	if(*param)
906
+	{
907
+		if(xl_parse_format((char*)(*param), &model, XL_DISABLE_COLORS)<0)
908
+		{
909
+			LOG(L_ERR, "ERROR:textops:item_list_fixup: wrong format[%s]\n",
910
+				(char*)(*param));
911
+			return E_UNSPEC;
912
+		}
913
+		*param = (void*)model;
914
+	}
915
+	return 0;
916
+}
917
+
918
+static int add_header_fixup(void** param, int param_no)
919
+{
920
+	if(param_no==1)
921
+	{
922
+		return it_list_fixup(param, param_no);
923
+	} else if(param_no==2) {
924
+		return hname_fixup(param, param_no);
925
+	} else {
926
+		LOG(L_ERR,
927
+			"ERROR:textops:add_header_fixup: wrong number of parameters\n");
928
+		return E_UNSPEC;
929
+	}
930
+}