From bf6b68be58405be1a439f4638423d12637c680ce Mon Sep 17 00:00:00 2001
From: yanmorin <yanmorin>
Date: Wed, 5 Oct 2005 18:07:05 +0000
Subject: [PATCH] Lists tone move rings to ringtones

---
 Makefile.am                      |  2 +-
 configure.ac                     |  2 +-
 sflphone.spec.in                 |  8 +++-----
 src/global.h                     | 22 +++++++++++-----------
 src/gui/server/guiserverimpl.cpp |  4 ++--
 src/gui/server/guiserverimpl.h   |  2 +-
 src/gui/server/requestconfig.cpp |  2 +-
 src/managerimpl.cpp              | 21 +++++++++++++++++++--
 8 files changed, 39 insertions(+), 24 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 92fb4adb8c..67cee9c214 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1 +1 @@
-SUBDIRS = utilspp stund src rings
+SUBDIRS = utilspp stund src ringtones
diff --git a/configure.ac b/configure.ac
index 1bdabe8470..c2f8bcafb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -201,5 +201,5 @@ utilspp/Makefile \
 utilspp/functor/Makefile \
 utilspp/singleton/Makefile \
 stund/Makefile \
-rings/Makefile \
+ringtones/Makefile \
 )
diff --git a/sflphone.spec.in b/sflphone.spec.in
index ef1d008136..8a85f06bbb 100644
--- a/sflphone.spec.in
+++ b/sflphone.spec.in
@@ -8,7 +8,7 @@ Name:		%name
 Summary:	An other VoIP client
 Version:	%version
 Release:	%release
-Copyright:	GPL
+License:	GPL
 Group:		Networking/Utilities
 URL:		http://www.sflphone.org
 Packager:	Cyrille Béraud <cyrille.beraud@savoirfairelinux.com>
@@ -33,8 +33,6 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-, root, root)
 %{prefix}/bin/sflphone
-%dir %{prefix}/share/sflphone/skins
-%{prefix}/share/sflphone/skins/*
-%dir %{prefix}/share/sflphone/pixmaps
-%{prefix}/share/sflphone/pixmaps/*
+%dir %{prefix}/share/sflphone/ringtones
+%{prefix}/share/sflphone/ringtones/*
 
diff --git a/src/global.h b/src/global.h
index 26a754377f..6eb5bf1005 100644
--- a/src/global.h
+++ b/src/global.h
@@ -41,19 +41,19 @@ typedef short int16;
 
 
 #define PROGNAME				"sflphone"
-#define SKINDIR					"skins"
-#define PIXDIR					"icons"
-#define RINGDIR					"rings"
+//#define SKINDIR					"skins"
+//#define PIXDIR					"icons"
+#define RINGDIR					"ringtones"
 #define CODECDIR				"codecs"
 
-#define SFLPHONE_LOGO			"logo_ico.png"
-#define TRAY_ICON				"tray-icon.png"
-#define PIXMAP_SIGNALISATIONS	"signalisations.png" 
-#define PIXMAP_AUDIO			"audio.png" 
-#define PIXMAP_VIDEO			"video.png" 
-#define PIXMAP_NETWORK			"network.png" 
-#define PIXMAP_PREFERENCES		"preferences.png" 
-#define PIXMAP_ABOUT			"about.png" 
+//#define SFLPHONE_LOGO			"logo_ico.png"
+//#define TRAY_ICON				"tray-icon.png"
+//#define PIXMAP_SIGNALISATIONS	"signalisations.png" 
+//#define PIXMAP_AUDIO			"audio.png" 
+//#define PIXMAP_VIDEO			"video.png" 
+//#define PIXMAP_NETWORK			"network.png" 
+//#define PIXMAP_PREFERENCES		"preferences.png" 
+//#define PIXMAP_ABOUT			"about.png" 
 
 #define MONO					1
 #define CHANNELS				2
diff --git a/src/gui/server/guiserverimpl.cpp b/src/gui/server/guiserverimpl.cpp
index e96bbe0bed..d84d011ab3 100644
--- a/src/gui/server/guiserverimpl.cpp
+++ b/src/gui/server/guiserverimpl.cpp
@@ -115,9 +115,9 @@ GUIServerImpl::getEvents(const std::string& sequenceId)
   return true;
 }
 bool
-GUIServerImpl::sendGetEventsEnd()
+GUIServerImpl::sendGetEventsEnd(const std::string& sequenceId)
 {
-  _requestManager.sendResponse(ResponseMessage("202", _getEventsSequenceId,
+  _requestManager.sendResponse(ResponseMessage("202", sequenceId,
 "getcallstatus request stopped me"));
   return true;
 }
diff --git a/src/gui/server/guiserverimpl.h b/src/gui/server/guiserverimpl.h
index ba242286a4..51104d3eae 100644
--- a/src/gui/server/guiserverimpl.h
+++ b/src/gui/server/guiserverimpl.h
@@ -64,7 +64,7 @@ arg);
   TokenList arg);
 
   bool getEvents(const std::string& sequenceId);
-  bool sendGetEventsEnd();
+  bool sendGetEventsEnd(const std::string& sequenceId);
 
   bool outgoingCall (const std::string& seq, 
     const std::string& callid, 
diff --git a/src/gui/server/requestconfig.cpp b/src/gui/server/requestconfig.cpp
index 0df8b23de9..1fde8987e9 100644
--- a/src/gui/server/requestconfig.cpp
+++ b/src/gui/server/requestconfig.cpp
@@ -51,7 +51,7 @@ RequestZeroconfEvent::execute()
 ResponseMessage
 RequestCallStatus::execute()
 {
-  GUIServer::instance().sendGetEventsEnd();
+  GUIServer::instance().sendGetEventsEnd(_sequenceId);
   TokenList tk;
   tk.push_back("OK");
   std::string code = "205";
diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
index e999aadfe0..f58af4d59b 100644
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -29,6 +29,7 @@
 //#include <arpa/inet.h>
 
 #include <cc++/thread.h>
+#include <cc++/file.h>
 
 #include <cstdlib> 
 #include <iostream>
@@ -1489,8 +1490,24 @@ ManagerImpl::getConfigList(const std::string& sequenceId, const std::string& nam
       iter++;
     }
     returnValue = true;
-  } else if (name=="") {
-    returnValue = true;
+  } else if (name=="ringtones") {
+    std::string path = std::string(PROGSHAREDIR) + "/" + RINGDIR;
+    try {
+      ost::Dir dir(path.c_str());
+      const char *cFileName = NULL;
+      std::string fileName;
+      std::string filePathName;
+      while ( (cFileName=dir++) != NULL ) {
+        fileName = cFileName;
+        filePathName = path + "/" + cFileName;
+        if (fileName.length() && fileName[0]!='.' && !ost::isDir(fileName.c_str())) {
+          _debug("Filename: %s\n", fileName.c_str());
+        }
+      }
+      returnValue = true;
+    } catch (...) {
+      // error to open file dir
+    }
   } else if (name=="") {
     returnValue = true;
   } else if (name=="") {
-- 
GitLab