[ekiga] Moved the loudmouth plugin to the new organisation
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Moved the loudmouth plugin to the new organisation
- Date: Wed, 26 Feb 2014 09:32:39 +0000 (UTC)
commit b5917fd0de1a061a94af2c7797634e55b691a4e2
Author: Julien Puydt <jpuydt free fr>
Date: Sun Feb 16 09:22:07 2014 +0100
Moved the loudmouth plugin to the new organisation
plugins/loudmouth/Makefile.am | 7 +-
plugins/loudmouth/loudmouth-conversation.cpp | 73 ++++++++++++++++++++++
plugins/loudmouth/loudmouth-conversation.h | 86 ++++++++++++++++++++++++++
plugins/loudmouth/loudmouth-dialect.cpp | 73 ++++++++++------------
plugins/loudmouth/loudmouth-dialect.h | 9 ++-
plugins/loudmouth/loudmouth-heap-roster.cpp | 4 +-
plugins/loudmouth/loudmouth-heap.h | 58 +++++++++++++++++
7 files changed, 263 insertions(+), 47 deletions(-)
---
diff --git a/plugins/loudmouth/Makefile.am b/plugins/loudmouth/Makefile.am
index f9e3e72..4c3e93e 100644
--- a/plugins/loudmouth/Makefile.am
+++ b/plugins/loudmouth/Makefile.am
@@ -24,10 +24,9 @@ libgmloudmouth_la_SOURCES = \
loudmouth-heap-roster.cpp \
loudmouth-presentity.h \
loudmouth-presentity.cpp \
- loudmouth-chat-simple.h \
- loudmouth-chat-simple.cpp \
- loudmouth-chat-multiple.h \
- loudmouth-chat-multiple.cpp \
+ loudmouth-heap.h \
+ loudmouth-conversation.h \
+ loudmouth-conversation.cpp \
loudmouth-dialect.h \
loudmouth-dialect.cpp
diff --git a/plugins/loudmouth/loudmouth-conversation.cpp b/plugins/loudmouth/loudmouth-conversation.cpp
new file mode 100644
index 0000000..e07c9fd
--- /dev/null
+++ b/plugins/loudmouth/loudmouth-conversation.cpp
@@ -0,0 +1,73 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2014 Damien Sandras <dsandras seconix com>
+
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ * loudmouth-conversation.cpp - description
+ * ------------------------------------------
+ * begin : written in 2014 by Julien Puydt
+ * copyright : (c) 2014 by Julien Puydt
+ * description : implementation of a loudmouth conversation
+ *
+ */
+
+#include "loudmouth-conversation.h"
+
+void
+LM::Conversation::visit_messages (boost::function1<bool, const Ekiga::Message&> visitor) const
+{
+ for (std::list<Ekiga::Message>::const_iterator iter = messages.begin ();
+ iter != messages.end ();
+ ++iter) {
+
+ if (!visitor (*iter))
+ break;
+ }
+}
+
+bool
+LM::Conversation::send_message (const Ekiga::Message::payload_type& /*payload*/)
+{
+ return true; // FIXME: to implement
+}
+
+void
+LM::Conversation::got_message (const Ekiga::Message::payload_type& /*payload*/)
+{
+ // FIXME: to implement
+}
+
+void
+LM::Conversation::reset_unread_messages_count ()
+{
+ unreads = 0;
+ updated ();
+}
+
+bool
+LM::Conversation::populate_menu (Ekiga::MenuBuilder& /*builder*/)
+{
+ return false; // FIXME: to implement
+}
diff --git a/plugins/loudmouth/loudmouth-conversation.h b/plugins/loudmouth/loudmouth-conversation.h
new file mode 100644
index 0000000..776f3a9
--- /dev/null
+++ b/plugins/loudmouth/loudmouth-conversation.h
@@ -0,0 +1,86 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2014 Damien Sandras <dsandras seconix com>
+
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ * loudmouth-conversation.h - description
+ * ------------------------------------------
+ * begin : written in 2014 by Julien Puydt
+ * copyright : (c) 2014 by Julien Puydt
+ * description : declaration of a loudmouth conversation
+ *
+ */
+
+#ifndef __LOUDMOUTH_CONVERSATION_H__
+#define __LOUDMOUTH_CONVERSATION_H__
+
+#include "conversation.h"
+#include "loudmouth-heap.h"
+
+namespace LM {
+
+ class Conversation: public Ekiga::Conversation
+ {
+ public:
+
+ Ekiga::HeapPtr get_heap () const
+ { return heap; }
+
+ /*FIXME: perhaps a std::map<const std::string, const std::string>
+ * would be better?
+ */
+ const std::string get_title () const
+ { return title; }
+
+ const std::string get_topic () const
+ { return topic; }
+
+ void visit_messages (boost::function1<bool, const Ekiga::Message&>) const;
+
+ bool send_message (const Ekiga::Message::payload_type& payload);
+
+ void got_message (const Ekiga::Message::payload_type& payload);
+
+ int get_unread_messages_count () const
+ { return unreads; }
+
+ void reset_unread_messages_count ();
+
+ bool populate_menu (Ekiga::MenuBuilder& builder);
+
+ // FIXME: public for bad reasons
+ HeapPtr heap;
+
+ private:
+ int unreads;
+ std::string title;
+ std::string topic;
+ std::list<Ekiga::Message> messages;
+ };
+
+ typedef boost::shared_ptr<Conversation> ConversationPtr;
+};
+
+#endif
diff --git a/plugins/loudmouth/loudmouth-dialect.cpp b/plugins/loudmouth/loudmouth-dialect.cpp
index 29ff9bd..4fb3ffc 100644
--- a/plugins/loudmouth/loudmouth-dialect.cpp
+++ b/plugins/loudmouth/loudmouth-dialect.cpp
@@ -50,67 +50,62 @@ LM::Dialect::~Dialect ()
void
LM::Dialect::push_message (PresentityPtr presentity,
- const std::string msg)
+ const Ekiga::Message::payload_type payload)
{
bool found = false;
- for (simple_iterator iter = simple_begin ();
- iter != simple_end ();
+ for (iterator iter = begin ();
+ iter != end () and not found;
++iter) {
- if (presentity == (*iter)->get_presentity ()) {
+ HeapPtr heap = (*iter)->heap;
+ for (Heap::iterator iter2 = heap->begin ();
+ iter2 != heap->end () and not found;
+ ++iter2)
- (*iter)->got_message (msg);
- found = true;
- break;
+ if (presentity == (*iter2)) {
+
+ (*iter)->got_message (payload);
+ found = true;
}
}
if ( !found) {
- SimpleChatPtr chat(new SimpleChat (core, presentity));
+ ConversationPtr conversation(new Conversation);
- add_simple_chat (chat);
- chat->got_message (msg);
+ add_conversation (conversation);
+ conversation->got_message (payload);
}
}
-struct open_chat_helper
-{
-
- open_chat_helper (Ekiga::PresentityPtr presentity_):
- presentity(presentity_)
- { }
-
- bool operator() (Ekiga::SimpleChatPtr chat_) const
- {
- LM::SimpleChatPtr chat = boost::dynamic_pointer_cast<LM::SimpleChat> (chat_);
- bool go_on = true;
-
- if (chat->get_presentity () == presentity) {
-
- chat->user_requested ();
- go_on = false;
- }
-
- return go_on;
- }
-
- Ekiga::PresentityPtr presentity;
-};
-
void
LM::Dialect::open_chat (PresentityPtr presentity)
{
if ( !presentity->has_chat) {
- LM::SimpleChatPtr chat(new SimpleChat (core, presentity));
- add_simple_chat (chat);
- chat->user_requested ();
+ ConversationPtr conversation(new Conversation);
+ add_conversation (conversation);
+ conversation->user_requested();
} else {
- open_chat_helper helper(presentity);
- visit_simple_chats (boost::ref (helper));
+ bool found = false;
+ for (iterator iter = begin ();
+ iter != end () and not found;
+ ++iter) {
+
+ HeapPtr heap = (*iter)->heap;
+ for (Heap::iterator iter2 = heap->begin ();
+ iter2 != heap->end () and not found;
+ ++iter2) {
+
+ if (presentity == (*iter2)) {
+
+ (*iter)->user_requested ();
+ found = true;
+ }
+ }
+ }
}
}
diff --git a/plugins/loudmouth/loudmouth-dialect.h b/plugins/loudmouth/loudmouth-dialect.h
index 0dba5e6..e0ddc4d 100644
--- a/plugins/loudmouth/loudmouth-dialect.h
+++ b/plugins/loudmouth/loudmouth-dialect.h
@@ -39,12 +39,15 @@
#include "dialect-impl.h"
#include "loudmouth-handler.h"
-#include "loudmouth-chat-simple.h"
+#include "loudmouth-conversation.h"
+#include "loudmouth-presentity.h"
+
+#include "services.h"
namespace LM
{
class Dialect:
- public Ekiga::DialectImpl<SimpleChat>,
+ public Ekiga::DialectImpl<Conversation>,
public LM::Handler
{
public:
@@ -58,7 +61,7 @@ namespace LM
/* specific */
void push_message (PresentityPtr,
- const std::string msg);
+ const Ekiga::Message::payload_type payload);
void open_chat (PresentityPtr presentity);
diff --git a/plugins/loudmouth/loudmouth-heap-roster.cpp b/plugins/loudmouth/loudmouth-heap-roster.cpp
index 7cce94a..b05eb1c 100644
--- a/plugins/loudmouth/loudmouth-heap-roster.cpp
+++ b/plugins/loudmouth/loudmouth-heap-roster.cpp
@@ -232,7 +232,9 @@ LM::HeapRoster::handle_message (LmConnection* /*connection*/,
if (body && lm_message_node_get_value (body) != NULL) {
result = LM_HANDLER_RESULT_REMOVE_MESSAGE;
- dialect->push_message (item, lm_message_node_get_value (body));
+ Ekiga::Message::payload_type payload;
+ payload["bare"] = lm_message_node_get_value (body);
+ dialect->push_message (item, payload);
}
// it could also be an avatar or a pubsub event or...
}
diff --git a/plugins/loudmouth/loudmouth-heap.h b/plugins/loudmouth/loudmouth-heap.h
new file mode 100644
index 0000000..fd7f69a
--- /dev/null
+++ b/plugins/loudmouth/loudmouth-heap.h
@@ -0,0 +1,58 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2014 Damien Sandras <dsandras seconix com>
+
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ * loudmouth-heap.h - description
+ * ------------------------------------------
+ * begin : written in 2014 by Julien Puydt
+ * copyright : (c) 2014 by Julien Puydt
+ * description : declaration of a Heap-as-a-structure
+ * to be used in Conversation instances
+ *
+ */
+
+#ifndef __LOUDMOUTH_HEAP_H__
+#define __LOUDMOUTH_HEAP_H__
+
+#include "heap-impl.h"
+#include "loudmouth-presentity.h"
+
+namespace LM
+{
+
+ class Heap: public Ekiga::HeapImpl<Presentity>
+ {
+ public:
+
+ using Ekiga::HeapImpl<Presentity>::add_connection;
+ using Ekiga::HeapImpl<Presentity>::add_presentity;
+ using Ekiga::HeapImpl<Presentity>::remove_presentity;
+ };
+
+ typedef typename boost::shared_ptr<Heap> HeapPtr;
+};
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]