[ekiga] Fixed problem where our own messages were shown as being from remote!
- From: Julien Puydt <jpuydt src gnome org>
- To: svn-commits-list gnome org
- Subject: [ekiga] Fixed problem where our own messages were shown as being from remote!
- Date: Fri, 10 Jul 2009 19:35:50 +0000 (UTC)
commit c1520e4afee4a772bcc82d91575ed49bfaeff972
Author: Julien Puydt <jpuydt gnome org>
Date: Fri Jul 10 21:27:06 2009 +0200
Fixed problem where our own messages were shown as being from remote!
That affected the loudmouth code only : the framework seems ok.
.../components/loudmouth/loudmouth-chat-simple.cpp | 12 ++++++++----
.../components/loudmouth/loudmouth-chat-simple.h | 5 ++++-
.../components/loudmouth/loudmouth-dialect.cpp | 7 ++++---
.../components/loudmouth/loudmouth-dialect.h | 6 +++++-
lib/engine/components/loudmouth/loudmouth-main.cpp | 2 +-
5 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/lib/engine/components/loudmouth/loudmouth-chat-simple.cpp b/lib/engine/components/loudmouth/loudmouth-chat-simple.cpp
index 97fe61f..7198acf 100644
--- a/lib/engine/components/loudmouth/loudmouth-chat-simple.cpp
+++ b/lib/engine/components/loudmouth/loudmouth-chat-simple.cpp
@@ -35,17 +35,19 @@
#include <iostream>
+#include "personal-details.h"
+
#include "loudmouth-chat-simple.h"
-LM::SimpleChat::SimpleChat (PresentityPtr presentity_):
- presentity(presentity_)
+LM::SimpleChat::SimpleChat (Ekiga::ServiceCore& core_,
+ PresentityPtr presentity_):
+ core(core_), presentity(presentity_)
{
presentity->has_chat = true;
}
LM::SimpleChat::~SimpleChat ()
{
- std::cout << __PRETTY_FUNCTION__ << std::endl;
presentity->has_chat = false;
}
@@ -75,6 +77,8 @@ LM::SimpleChat::send_message (const std::string msg)
if (lm_connection_is_authenticated (presentity->get_connection ())) {
result = true;
+ gmref_ptr<Ekiga::PersonalDetails> details = core.get ("personal-details");
+ const std::string my_name = details->get_display_name ();
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 (),
@@ -87,7 +91,7 @@ LM::SimpleChat::send_message (const std::string msg)
iter != observers.end ();
++iter) {
- (*iter)->message (presentity->get_name (), msg);
+ (*iter)->message (my_name, msg);
}
}
diff --git a/lib/engine/components/loudmouth/loudmouth-chat-simple.h b/lib/engine/components/loudmouth/loudmouth-chat-simple.h
index 2a01881..d52953b 100644
--- a/lib/engine/components/loudmouth/loudmouth-chat-simple.h
+++ b/lib/engine/components/loudmouth/loudmouth-chat-simple.h
@@ -36,6 +36,7 @@
#ifndef __LOUDMOUTH_CHAT_SIMPLE_H__
#define __LOUDMOUTH_CHAT_SIMPLE_H__
+#include "services.h"
#include "chat-simple.h"
#include "loudmouth-presentity.h"
@@ -47,7 +48,8 @@ namespace LM
{
public:
- SimpleChat (PresentityPtr presentity_);
+ SimpleChat (Ekiga::ServiceCore& core_,
+ PresentityPtr presentity_);
~SimpleChat ();
@@ -69,6 +71,7 @@ namespace LM
private:
+ Ekiga::ServiceCore& core;
PresentityPtr presentity;
std::list<gmref_ptr<Ekiga::ChatObserver> > observers;
};
diff --git a/lib/engine/components/loudmouth/loudmouth-dialect.cpp b/lib/engine/components/loudmouth/loudmouth-dialect.cpp
index fe7352b..694ff0f 100644
--- a/lib/engine/components/loudmouth/loudmouth-dialect.cpp
+++ b/lib/engine/components/loudmouth/loudmouth-dialect.cpp
@@ -35,7 +35,8 @@
#include "loudmouth-dialect.h"
-LM::Dialect::Dialect ()
+LM::Dialect::Dialect (Ekiga::ServiceCore& core_):
+ core(core_)
{
}
@@ -63,7 +64,7 @@ LM::Dialect::push_message (PresentityPtr presentity,
if ( !found) {
- SimpleChatPtr chat(new SimpleChat (presentity));
+ SimpleChatPtr chat(new SimpleChat (core, presentity));
add_simple_chat (chat);
chat->got_message (msg);
@@ -73,7 +74,7 @@ LM::Dialect::push_message (PresentityPtr presentity,
void
LM::Dialect::open_chat (PresentityPtr presentity)
{
- SimpleChatPtr chat(new SimpleChat (presentity));
+ SimpleChatPtr chat(new SimpleChat (core, presentity));
add_simple_chat (chat);
chat->user_requested.emit ();
}
diff --git a/lib/engine/components/loudmouth/loudmouth-dialect.h b/lib/engine/components/loudmouth/loudmouth-dialect.h
index 5ae6543..18dcaf3 100644
--- a/lib/engine/components/loudmouth/loudmouth-dialect.h
+++ b/lib/engine/components/loudmouth/loudmouth-dialect.h
@@ -46,7 +46,7 @@ namespace LM
{
public:
- Dialect ();
+ Dialect (Ekiga::ServiceCore& core_);
~Dialect ();
@@ -58,6 +58,10 @@ namespace LM
const std::string msg);
void open_chat (PresentityPtr presentity);
+
+ private:
+
+ Ekiga::ServiceCore& core;
};
typedef gmref_ptr<Dialect> DialectPtr;
diff --git a/lib/engine/components/loudmouth/loudmouth-main.cpp b/lib/engine/components/loudmouth/loudmouth-main.cpp
index dd52882..ce08c9a 100644
--- a/lib/engine/components/loudmouth/loudmouth-main.cpp
+++ b/lib/engine/components/loudmouth/loudmouth-main.cpp
@@ -62,7 +62,7 @@ struct LOUDMOUTHSpark: public Ekiga::Spark
if ( !service && presence && account && chat && details) {
- LM::DialectPtr dialect(new LM::Dialect);
+ LM::DialectPtr dialect(new LM::Dialect (core));
LM::ClusterPtr cluster(new LM::Cluster);
LM::BankPtr bank (new LM::Bank (details, dialect, cluster));
core.add (bank);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]