Browse code

presence_profile: use parameter default_expires instead of 3600 constant

- GH #2996

Adrian Tabacioiu authored on 14/01/2022 13:32:02
Showing 4 changed files
... ...
@@ -45,11 +45,10 @@ int profile_add_events(void)
45 45
 	event.name.s = "ua-profile";
46 46
 	event.name.len = 10;
47 47
 
48
-
49 48
 	event.content_type.s = "text/xml";
50 49
 	event.content_type.len = 8;
51 50
 
52
-	event.default_expires= 3600;
51
+	event.default_expires= pres_profile_default_expires;
53 52
 	event.type = PUBL_TYPE;
54 53
 	event.req_auth = 0;
55 54
 	event.evs_publ_handl = 0;
... ...
@@ -64,9 +64,25 @@
64 64
 	
65 65
 	<section>
66 66
 	  <title>Exported Parameters</title>
67
-		<para>
68
-		  None.
69
-		</para>
67
+            <section id="presence_profile.p.default_expires">
68
+                        <title><varname>default_expires</varname> (int)</title>
69
+                        <para>
70
+                        The default expires value used when missing from SUBSCRIBE
71
+                        message (in seconds).
72
+                        </para>
73
+                        <para>
74
+                        <emphasis>Default value is <quote>3600</quote>.
75
+                        </emphasis>
76
+                        </para>
77
+                        <example>
78
+                        <title>Set <varname>default_expires</varname> parameter</title>
79
+                        <programlisting format="linespecific">
80
+            ...
81
+            modparam("presence_profile", "default_expires", 3600)
82
+            ...
83
+            </programlisting>
84
+                </example>
85
+            </section>
70 86
         </section>
71 87
 
72 88
         <section>
... ...
@@ -56,13 +56,22 @@ static int mod_init(void);
56 56
 /* module variables */
57 57
 add_event_t pres_add_event;
58 58
 
59
+/* module parameters */
60
+unsigned int pres_profile_default_expires = 3600;
61
+
62
+/* module exported paramaters */
63
+static param_export_t params[] = {
64
+	{ "default_expires", INT_PARAM, &pres_profile_default_expires },
65
+	{0, 0, 0}
66
+};
67
+
59 68
 /* module exports */
60 69
 /* clang-format off */
61 70
 struct module_exports exports= {
62 71
 	"presence_profile",	/* module name */
63 72
 	DEFAULT_DLFLAGS,	/* dlopen flags */
64 73
 	0,					/* exported functions */
65
-	0,					/* exported parameters */
74
+	params,				/* exported parameters */
66 75
 	0,					/* RPC method exports */
67 76
 	0,					/* exported pseudo-variables */
68 77
 	0,					/* response handling function */
... ...
@@ -31,5 +31,6 @@
31 31
 #define _PRES_PROFILE_H_
32 32
 
33 33
 extern add_event_t pres_add_event;
34
+extern unsigned int pres_profile_default_expires;
34 35
 
35 36
 #endif