Browse code

presence_reginfo: use parameter default_expires instead of 3600 constant

- GH #2996

Adrian Tabacioiu authored on 14/01/2022 13:32:53
Showing 4 changed files
... ...
@@ -39,7 +39,7 @@ int reginfo_add_events(void)
39 39
 
40 40
 	event.content_type.s = "application/reginfo+xml";
41 41
 	event.content_type.len = 23;
42
-	event.default_expires= 3600;
42
+	event.default_expires= pres_reginfo_default_expires;
43 43
 	event.type = PUBL_TYPE;
44 44
 	event.req_auth = 0;
45 45
 	event.evs_publ_handl = 0;
... ...
@@ -64,6 +64,31 @@
64 64
 	  </section>
65 65
 	</section>
66 66
 
67
+    <section>
68
+		<title>Parameters</title>
69
+        <section id="presence_reginfo.p.default_expires">
70
+               <title><varname>default_expires</varname> (int)</title>
71
+               <para>
72
+               The default expires value used when missing from SUBSCRIBE
73
+               message (in seconds).
74
+               </para>
75
+               <para>
76
+               <emphasis>Default value is <quote>3600</quote>.
77
+               </emphasis>
78
+               </para>
79
+               <example>
80
+               <title>Set <varname>default_expires</varname> parameter</title>
81
+               <programlisting format="linespecific">
82
+        ...
83
+        modparam("presence_reginfo", "default_expires", 3600)
84
+        ...
85
+        </programlisting>
86
+            </example>
87
+        </section>
88
+
89
+	</section>
90
+
91
+
67 92
 	<section>
68 93
 		<title>Functions</title>
69 94
 		<para>
... ...
@@ -46,14 +46,23 @@ static int mod_init(void);
46 46
 /* module variables */
47 47
 add_event_t pres_add_event;
48 48
 
49
+/* module parameters */
50
+unsigned int pres_reginfo_default_expires = 3600;
51
+
52
+/* module exported paramaters */
53
+static param_export_t params[] = {
54
+	{ "default_expires", INT_PARAM, &pres_reginfo_default_expires },
55
+	{0, 0, 0}
56
+};
57
+
49 58
 /* module exports */
50 59
 /* clang-format off */
51 60
 struct module_exports exports= {
52 61
     "presence_reginfo",	/* module name */
53 62
 	DEFAULT_DLFLAGS,	/* dlopen flags */
54 63
 	0,					/* exported functions */
55
-	0,					/* exported parameters */
56
-	0,					/* RPC method exports */
64
+	params,				/* exported parameters */
65
+	0,				    /* RPC method exports */
57 66
 	0,					/* exported pseudo-variables */
58 67
 	0,					/* response handling function */
59 68
 	mod_init,			/* module initialization function */
... ...
@@ -25,5 +25,5 @@
25 25
 #define _PRES_REGINFO_H_
26 26
 
27 27
 extern add_event_t pres_add_event;
28
-
28
+extern unsigned int pres_reginfo_default_expires;
29 29
 #endif