Explorar el Código

added function has_to_tag into common libs

Vaclav Kubart hace 19 años
padre
commit
58a9baa358
Se han modificado 3 ficheros con 22 adiciones y 0 borrados
  1. 3 0
      lib/cds/ChangeLog
  2. 13 0
      lib/cds/sip_utils.c
  3. 6 0
      lib/cds/sip_utils.h

+ 3 - 0
lib/cds/ChangeLog

@@ -1,3 +1,6 @@
+2006-06-29
+	* added function has_to_tag common for more presence modules
+
 2006-06-28
 	* optimalization of dstring operations (internal buffers allocated in PKG
 	memory, some functions changed to macros, added function dstr_get_str_pkg)

+ 13 - 0
lib/cds/sip_utils.c

@@ -132,4 +132,17 @@ int requires_extension(struct sip_msg *m, str *extension)
 	return 0;
 }
 
+/**
+ * Verifies presence of the To-tag in message. Returns 1 if
+ * the tag is present, 0 if not, -1 on error.
+ */
+int has_to_tag(struct sip_msg *_m)
+{
+	struct to_body *to = (struct to_body*)_m->to->parsed;
+	if (!to) return -1;
+	if (to->tag_value.len > 0) return 1;
+	return 0;
+}
+
+
 #endif

+ 6 - 0
lib/cds/sip_utils.h

@@ -20,6 +20,12 @@ int supports_extension(struct sip_msg *m, str *extension);
  * 0 if not or an error occured while parsing */
 int requires_extension(struct sip_msg *m, str *extension);
 
+/**
+ * Verifies presence of the To-tag in message. Returns 1 if
+ * the tag is present, 0 if not, -1 on error.
+ */
+int has_to_tag(struct sip_msg *_m);
+
 #endif
 
 #endif