[Freeswitch-trunk] [commit] r6418 - in freeswitch/trunk/src: . include mod/applications/mod_voicemail mod/xml_int/mod_xml_rpc

Freeswitch SVN anthm at freeswitch.org
Wed Nov 28 15:44:19 EST 2007


Author: anthm
Date: Wed Nov 28 15:44:18 2007
New Revision: 6418

Modified:
   freeswitch/trunk/src/include/switch_core.h
   freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
   freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
   freeswitch/trunk/src/switch_core.c

Log:
add mime types to webserver

Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h	(original)
+++ freeswitch/trunk/src/include/switch_core.h	Wed Nov 28 15:44:18 2007
@@ -1493,7 +1493,7 @@
 */
 SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, switch_core_session_t *b);
 
-
+SWITCH_DECLARE(switch_hash_index_t *) switch_core_mime_index(void);
 SWITCH_DECLARE(const char *) switch_core_mime_ext2type(const char *ext);
 SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, const char *ext);
 

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	Wed Nov 28 15:44:18 2007
@@ -2250,7 +2250,7 @@
 {
     struct holder *holder = (struct holder *) pArg;
     switch_xml_t x_tmp, x_link;
-    char *tmp, *del;
+    char *tmp, *del, *get;
     switch_time_exp_t tm;
 	char create_date[80] = "";
 	char read_date[80] = "";
@@ -2319,19 +2319,24 @@
         fname = argv[8];
     }
 
+    get = switch_mprintf("http://%s:%s%s/get/%s", holder->host, holder->port, holder->uri, fname);
     del = switch_mprintf("http://%s:%s%s/del/%s", holder->host, holder->port, holder->uri, fname);
     x_link = switch_xml_add_child_d(holder->x_item, "fsvm:rmlink", 0);
     switch_xml_set_txt_d(x_link, del);
 
 
-    tmp = switch_mprintf("<![CDATA[Priority: %s<br>Last Heard: %s<br>Duration: %s<br><a href=%s>Delete This Message</a>]]>", 
-                         strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", heard, duration_str, del);
 
+    tmp = switch_mprintf("<![CDATA[Priority: %s<br>"
+                         "Last Heard: %s<br>Duration: %s<br>"
+                         "<a href=%s>Delete This Message</a><br>"
+                         "]]>", 
+                         strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", heard, duration_str, del);
 
     switch_xml_set_txt_d(x_tmp, tmp);
     free(tmp);
     free(del);
 
+
     x_tmp = switch_xml_add_child_d(holder->x_item, "pubDate", 0);
     switch_xml_set_txt_d(x_tmp, rss_date);
 
@@ -2339,17 +2344,17 @@
     switch_xml_set_txt_d(x_tmp, duration_str);
 
 
-    tmp = switch_mprintf("http://%s:%s%s/get/%s", holder->host, holder->port, holder->uri, fname);
+    
 
     x_tmp = switch_xml_add_child_d(holder->x_item, "guid", 0);
-    switch_xml_set_txt_d(x_tmp, tmp);
+    switch_xml_set_txt_d(x_tmp, get);
 
     x_link = switch_xml_add_child_d(holder->x_item, "link", 0);
-    switch_xml_set_txt_d(x_link, tmp);
+    switch_xml_set_txt_d(x_link, get);
 
     x_tmp = switch_xml_add_child_d(holder->x_item, "enclosure", 0);
-    switch_xml_set_attr_d(x_tmp, "url", tmp);
-    free(tmp);
+    switch_xml_set_attr_d(x_tmp, "url", get);
+    free(get);
 
     
 

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	Wed Nov 28 15:44:18 2007
@@ -665,6 +665,9 @@
 	xmlrpc_registry *registryP;
 	xmlrpc_env env;
 	char logfile[512];
+	switch_hash_index_t *hi;
+	const void *var;
+	void *val;
 
 	globals.running = 1;
 
@@ -679,6 +682,12 @@
 
 	MIMETypeInit();
 	MIMETypeAdd("text/html", "html");
+	for(hi = switch_core_mime_index(); hi; hi = switch_hash_next(hi)) {
+		switch_hash_this(hi, &var, NULL, &val);
+		if (var && val) {
+			MIMETypeAdd((char *) val, (char *) var);
+		}
+	}
 
 	snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch_http.log");
 	ServerCreate(&abyssServer, "XmlRpcServer", globals.port, SWITCH_GLOBAL_dirs.htdocs_dir, logfile);

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Wed Nov 28 15:44:18 2007
@@ -557,6 +557,12 @@
 	return (const char *) switch_core_hash_find(runtime.mime_types, ext);
 }
 
+                         
+SWITCH_DECLARE(switch_hash_index_t *) switch_core_mime_index(void)
+{
+	return switch_hash_first(NULL, runtime.mime_types);
+}
+
 SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, const char *ext)
 {
 	const char *check = (const char *) switch_core_hash_find(runtime.mime_types, ext);



More information about the Freeswitch-trunk mailing list