[ekiga] Added a simple chat implementation -- it compiles but isn't hooked
- From: Julien Puydt <jpuydt src gnome org>
- To: svn-commits-list gnome org
- Subject: [ekiga] Added a simple chat implementation -- it compiles but isn't hooked
- Date: Thu, 11 Jun 2009 11:42:36 -0400 (EDT)
commit cad196ba6d964fe4053ab328a4f428869c09e3b9
Author: Julien Puydt <jpuydt noether localdomain>
Date: Wed Dec 3 18:19:47 2008 +0100
Added a simple chat implementation -- it compiles but isn't hooked
lib/engine/components/loudmouth/Makefile.am | 7 +-
.../components/loudmouth/loudmouth-chat-simple.cpp | 107 ++++++++++++++++++++
.../components/loudmouth/loudmouth-chat-simple.h | 75 ++++++++++++++
3 files changed, 187 insertions(+), 2 deletions(-)
---
diff --git a/lib/engine/components/loudmouth/Makefile.am b/lib/engine/components/loudmouth/Makefile.am
index 235967d..24635fa 100644
--- a/lib/engine/components/loudmouth/Makefile.am
+++ b/lib/engine/components/loudmouth/Makefile.am
@@ -7,7 +7,8 @@ AM_CXXFLAGS = $(SIGC_CFLAGS) $(LOUDMOUTH_CFLAGS)
INCLUDES = \
-I$(top_srcdir)/lib/engine/framework \
-I$(top_srcdir)/lib/engine/account/skel \
- -I$(top_srcdir)/lib/engine/presence/skel
+ -I$(top_srcdir)/lib/engine/presence/skel \
+ -I$(top_srcdir)/lib/engine/chat/skel
libgmloudmouth_la_SOURCES = \
$(loudmouth_dir)/loudmouth-main.h \
@@ -21,6 +22,8 @@ libgmloudmouth_la_SOURCES = \
$(loudmouth_dir)/loudmouth-heap.h \
$(loudmouth_dir)/loudmouth-heap.cpp \
$(loudmouth_dir)/loudmouth-presentity.h \
- $(loudmouth_dir)/loudmouth-presentity.cpp
+ $(loudmouth_dir)/loudmouth-presentity.cpp \
+ $(loudmouth_dir)/loudmouth-chat-simple.h \
+ $(loudmouth_dir)/loudmouth-chat-simple.cpp
libgmloudmouth_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS) $(LOUDMOUTH_LIBS)
\ No newline at end of file
diff --git a/lib/engine/components/loudmouth/loudmouth-chat-simple.cpp b/lib/engine/components/loudmouth/loudmouth-chat-simple.cpp
new file mode 100644
index 0000000..ea558b0
--- /dev/null
+++ b/lib/engine/components/loudmouth/loudmouth-chat-simple.cpp
@@ -0,0 +1,107 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * 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-chat-simple.cpp - description
+ * ------------------------------------------
+ * begin : written in 2008 by Julien Puydt
+ * copyright : (c) 2008 by Julien Puydt
+ * description : implementation of a loudmouth simple chat
+ *
+ */
+
+#include "loudmouth-chat-simple.h"
+
+LM::SimpleChat::SimpleChat (LmConnection* connection_,
+ gmref_ptr<Presentity> presentity_):
+ connection(connection_), presentity(presentity_)
+{
+ lm_connection_ref (connection);
+ presentity->has_chat = true;
+}
+
+LM::SimpleChat::~SimpleChat ()
+{
+ lm_connection_unref (connection);
+ presentity->has_chat = false;
+}
+
+const std::string
+LM::SimpleChat::get_title () const
+{
+ return presentity->get_name ();
+}
+
+void
+LM::SimpleChat::connect (gmref_ptr<Ekiga::ChatObserver> observer)
+{
+ observers.push_back (observer);
+}
+
+void
+LM::SimpleChat::disconnect (gmref_ptr<Ekiga::ChatObserver> observer)
+{
+ observers.remove (observer);
+}
+
+bool
+LM::SimpleChat::send_message (const std::string msg)
+{
+ bool result = false;
+
+ if (lm_connection_is_authenticated (connection)) {
+
+ result = true;
+ LmMessage* message = lm_message_new (NULL, LM_MESSAGE_TYPE_MESSAGE);
+ lm_message_node_set_attributes (lm_message_get_node (message),
+ "to", presentity->get_jid ().c_str (),
+ "type", "chat",
+ NULL);
+ lm_message_node_add_child (lm_message_get_node (message), "body", msg.c_str ());
+ lm_connection_send (connection, message, NULL);
+ lm_message_unref (message);
+ for (std::list<gmref_ptr<Ekiga::ChatObserver> >::iterator iter = observers.begin ();
+ iter != observers.end ();
+ ++iter) {
+
+ (*iter)->message (presentity->get_name (), msg);
+ }
+ }
+
+ return result;
+}
+
+bool
+LM::SimpleChat::populate_menu (Ekiga::MenuBuilder& /*builder*/)
+{
+ return false; // FIXME;
+}
+
+gmref_ptr<Ekiga::Presentity>
+LM::SimpleChat::get_presentity () const
+{
+ return presentity;
+}
diff --git a/lib/engine/components/loudmouth/loudmouth-chat-simple.h b/lib/engine/components/loudmouth/loudmouth-chat-simple.h
new file mode 100644
index 0000000..5efe69f
--- /dev/null
+++ b/lib/engine/components/loudmouth/loudmouth-chat-simple.h
@@ -0,0 +1,75 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * 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-chat-simple.h - description
+ * ------------------------------------------
+ * begin : written in 2008 by Julien Puydt
+ * copyright : (c) 2008 by Julien Puydt
+ * description : declaration of a loudmouth simple chat
+ *
+ */
+
+#ifndef __LOUDMOUTH_CHAT_SIMPLE_H__
+#define __LOUDMOUTH_CHAT_SIMPLE_H__
+
+#include "chat-simple.h"
+
+#include "loudmouth-presentity.h"
+
+namespace LM
+{
+ class SimpleChat:
+ public Ekiga::SimpleChat
+ {
+ public:
+
+ SimpleChat (LmConnection* connection_,
+ gmref_ptr<Presentity> presentity_);
+
+ ~SimpleChat ();
+
+ const std::string get_title () const;
+
+ void connect (gmref_ptr<Ekiga::ChatObserver> observer);
+
+ void disconnect (gmref_ptr<Ekiga::ChatObserver> observer);
+
+ bool send_message (const std::string msg);
+
+ bool populate_menu (Ekiga::MenuBuilder& builder);
+
+ gmref_ptr<Ekiga::Presentity> get_presentity () const;
+
+ private:
+
+ LmConnection* connection;
+ gmref_ptr<Presentity> presentity;
+ std::list<gmref_ptr<Ekiga::ChatObserver> > observers;
+ };
+};
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]