ekiga r7263 - in trunk/lib/engine/components: resource-list xcap



Author: jpuydt
Date: Sun Oct 19 06:43:30 2008
New Revision: 7263
URL: http://svn.gnome.org/viewvc/ekiga?rev=7263&view=rev

Log:
Fixed bug #555868: got rid of XCAP::Core::ResultType for a bool

Modified:
   trunk/lib/engine/components/resource-list/rl-entry.cpp
   trunk/lib/engine/components/resource-list/rl-entry.h
   trunk/lib/engine/components/resource-list/rl-heap.cpp
   trunk/lib/engine/components/resource-list/rl-heap.h
   trunk/lib/engine/components/resource-list/rl-list.cpp
   trunk/lib/engine/components/xcap/xcap-core.cpp
   trunk/lib/engine/components/xcap/xcap-core.h

Modified: trunk/lib/engine/components/resource-list/rl-entry.cpp
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-entry.cpp	(original)
+++ trunk/lib/engine/components/resource-list/rl-entry.cpp	Sun Oct 19 06:43:30 2008
@@ -168,10 +168,10 @@
 }
 
 void
-RL::Entry::on_xcap_answer (XCAP::Core::ResultType result,
+RL::Entry::on_xcap_answer (bool error,
 			   std::string value)
 {
-  if (result != XCAP::Core::SUCCESS) {
+  if (error) {
 
     set_status (value);
 

Modified: trunk/lib/engine/components/resource-list/rl-entry.h
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-entry.h	(original)
+++ trunk/lib/engine/components/resource-list/rl-entry.h	Sun Oct 19 06:43:30 2008
@@ -101,7 +101,7 @@
     std::string status;
 
     void refresh ();
-    void on_xcap_answer (XCAP::Core::ResultType,
+    void on_xcap_answer (bool error,
 			 std::string value);
     void parse ();
   };

Modified: trunk/lib/engine/components/resource-list/rl-heap.cpp
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-heap.cpp	(original)
+++ trunk/lib/engine/components/resource-list/rl-heap.cpp	Sun Oct 19 06:43:30 2008
@@ -246,23 +246,16 @@
 }
 
 void
-RL::Heap::on_document_received (XCAP::Core::ResultType result,
+RL::Heap::on_document_received (bool error,
 				std::string value)
 {
-  switch (result) {
+  if (error) {
 
-  case XCAP::Core::SUCCESS:
+    // FIXME: do something
+    std::cout << "XCAP error: " << value << std::endl;
+  } else {
 
     parse_doc (value);
-    break;
-  case XCAP::Core::ERROR:
-
-    std::cout << "XCAP error: " << value << std::endl;
-    // FIXME: do something
-    break;
-  default:
-    // shouldn't happen
-    break;
   }
 }
 

Modified: trunk/lib/engine/components/resource-list/rl-heap.h
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-heap.h	(original)
+++ trunk/lib/engine/components/resource-list/rl-heap.h	Sun Oct 19 06:43:30 2008
@@ -105,7 +105,7 @@
 
     void refresh ();
 
-    void on_document_received (XCAP::Core::ResultType result,
+    void on_document_received (bool error,
 			       std::string doc);
 
     void parse_doc (std::string doc);

Modified: trunk/lib/engine/components/resource-list/rl-list.cpp
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-list.cpp	(original)
+++ trunk/lib/engine/components/resource-list/rl-list.cpp	Sun Oct 19 06:43:30 2008
@@ -67,7 +67,7 @@
 
   void refresh ();
 
-  void on_xcap_answer (XCAP::Core::ResultType result,
+  void on_xcap_answer (bool error,
 		       std::string value);
 
   void parse ();
@@ -264,10 +264,10 @@
 }
 
 void
-RL::ListImpl::on_xcap_answer (XCAP::Core::ResultType result,
+RL::ListImpl::on_xcap_answer (bool error,
 			      std::string value)
 {
-  if (result != XCAP::Core::SUCCESS) {
+  if (error) {
 
     // FIXME: how to properly tell the user?
 

Modified: trunk/lib/engine/components/xcap/xcap-core.cpp
==============================================================================
--- trunk/lib/engine/components/xcap/xcap-core.cpp	(original)
+++ trunk/lib/engine/components/xcap/xcap-core.cpp	Sun Oct 19 06:43:30 2008
@@ -53,7 +53,7 @@
   ~CoreImpl ();
 
   void read (gmref_ptr<XCAP::Path> path,
-	     sigc::slot<void,XCAP::Core::ResultType,std::string> callback);
+	     sigc::slot<void,bool,std::string> callback);
 };
 
 /* soup callbacks */
@@ -62,7 +62,7 @@
 {
   gmref_ptr<XCAP::Path> path;
   SoupSession* session;
-  sigc::slot<void,XCAP::Core::ResultType, std::string> callback;
+  sigc::slot<void,bool, std::string> callback;
 };
 
 static void
@@ -93,12 +93,12 @@
 
   case SOUP_STATUS_OK:
 
-    cb->callback (XCAP::Core::SUCCESS, message->response_body->data);
+    cb->callback (false, message->response_body->data);
     break;
 
   default:
 
-    cb->callback (XCAP::Core::ERROR, message->reason_phrase);
+    cb->callback (true, message->reason_phrase);
     break;
   }
 
@@ -118,7 +118,7 @@
 
 void
 XCAP::CoreImpl::read (gmref_ptr<Path> path,
-		      sigc::slot<void, XCAP::Core::ResultType, std::string> callback)
+		      sigc::slot<void, bool, std::string> callback)
 {
   SoupMessage* message = NULL;
   cb_data* data = NULL;
@@ -151,7 +151,7 @@
 
 void
 XCAP::Core::read (gmref_ptr<XCAP::Path> path,
-		  sigc::slot<void, XCAP::Core::ResultType,std::string> callback)
+		  sigc::slot<void, bool,std::string> callback)
 {
   std::cout << "XCAP trying to read " << path->to_uri () << std::endl;
   impl->read (path, callback);

Modified: trunk/lib/engine/components/xcap/xcap-core.h
==============================================================================
--- trunk/lib/engine/components/xcap/xcap-core.h	(original)
+++ trunk/lib/engine/components/xcap/xcap-core.h	Sun Oct 19 06:43:30 2008
@@ -55,10 +55,14 @@
 
     ~Core ();
 
-    typedef enum { SUCCESS, ERROR } ResultType;
-
+    /* The callbacks gets a boolean and a string :
+     * - if the boolean is false, there was no error and the string is the
+     * document you wanted ;
+     * - if the boolean is true, there was an error and the string is the
+     * error message.
+     */
     void read (gmref_ptr<Path>,
-	       sigc::slot<void,ResultType,std::string> callback);
+	       sigc::slot<void,bool,std::string> callback);
 
     /* implementation of the Ekiga::Service api */
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]