diff options
Diffstat (limited to 'src/gnunet/social/message.cpp')
-rw-r--r-- | src/gnunet/social/message.cpp | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/gnunet/social/message.cpp b/src/gnunet/social/message.cpp index abc3f9c..19d9109 100644 --- a/src/gnunet/social/message.cpp +++ b/src/gnunet/social/message.cpp | |||
@@ -2,7 +2,8 @@ | |||
2 | #include "modifier.h" | 2 | #include "modifier.h" |
3 | 3 | ||
4 | 4 | ||
5 | Message::Message (QString method, | 5 | Message::Message (Place *place, |
6 | QString method, | ||
6 | QList<Modifier *> env, | 7 | QList<Modifier *> env, |
7 | QByteArray data, | 8 | QByteArray data, |
8 | uint64_t id, | 9 | uint64_t id, |
@@ -10,6 +11,7 @@ Message::Message (QString method, | |||
10 | Message *parent) | 11 | Message *parent) |
11 | : QObject (parent) | 12 | : QObject (parent) |
12 | { | 13 | { |
14 | m_place = place; | ||
13 | m_id = id; | 15 | m_id = id; |
14 | m_nym = nym; | 16 | m_nym = nym; |
15 | m_method = method; | 17 | m_method = method; |
@@ -19,7 +21,8 @@ Message::Message (QString method, | |||
19 | } | 21 | } |
20 | 22 | ||
21 | 23 | ||
22 | Message::Message (QString method, | 24 | Message::Message (Place *place, |
25 | QString method, | ||
23 | QList<Modifier *> env, | 26 | QList<Modifier *> env, |
24 | QString text, | 27 | QString text, |
25 | uint64_t id, | 28 | uint64_t id, |
@@ -27,6 +30,7 @@ Message::Message (QString method, | |||
27 | Message *parent) | 30 | Message *parent) |
28 | : QObject (parent) | 31 | : QObject (parent) |
29 | { | 32 | { |
33 | m_place = place; | ||
30 | m_id = id; | 34 | m_id = id; |
31 | m_nym = nym; | 35 | m_nym = nym; |
32 | m_method = method; | 36 | m_method = method; |
@@ -36,7 +40,8 @@ Message::Message (QString method, | |||
36 | } | 40 | } |
37 | 41 | ||
38 | 42 | ||
39 | Message::Message (const char *method, | 43 | Message::Message (Place *place, |
44 | const char *method, | ||
40 | GNUNET_PSYC_Environment *env, | 45 | GNUNET_PSYC_Environment *env, |
41 | const void *data, | 46 | const void *data, |
42 | size_t data_size, | 47 | size_t data_size, |
@@ -45,6 +50,7 @@ Message::Message (const char *method, | |||
45 | Message *parent) | 50 | Message *parent) |
46 | : QObject (parent) | 51 | : QObject (parent) |
47 | { | 52 | { |
53 | m_place = place; | ||
48 | m_id = id; | 54 | m_id = id; |
49 | m_nym = nym; | 55 | m_nym = nym; |
50 | m_method = QString::fromLatin1 (method); | 56 | m_method = QString::fromLatin1 (method); |
@@ -87,7 +93,7 @@ Message::appendData (char *data, size_t data_size) | |||
87 | 93 | ||
88 | 94 | ||
89 | Modifier * | 95 | Modifier * |
90 | Message::findModifier (const QString name) | 96 | Message::findModifier (const QString name) const |
91 | { | 97 | { |
92 | QListIterator<Modifier *> it (m_env); | 98 | QListIterator<Modifier *> it (m_env); |
93 | while (it.hasNext ()) | 99 | while (it.hasNext ()) |
@@ -221,6 +227,27 @@ Message::index () const | |||
221 | : -1; | 227 | : -1; |
222 | } | 228 | } |
223 | 229 | ||
230 | /*** Signals ***/ | ||
231 | |||
232 | void | ||
233 | Message::reply (QString body, QString title) | ||
234 | { | ||
235 | QList<Modifier *> env; | ||
236 | Modifier *id_thread = findModifier ("_id_thread"); | ||
237 | if (id_thread) | ||
238 | env += new Modifier (GNUNET_PSYC_OP_SET, "_id_thread", id_thread->text ()); | ||
239 | |||
240 | Modifier *id_reply = findModifier ("_id_reply"); | ||
241 | if (id_reply) | ||
242 | env += new Modifier (GNUNET_PSYC_OP_SET, "_id_reply", id_reply->text ()); | ||
243 | |||
244 | if (!title.isEmpty ()) | ||
245 | env += new Modifier (GNUNET_PSYC_OP_SET, "_title", title); | ||
246 | |||
247 | Message *msg = new Message (m_place, "_converse"); | ||
248 | m_place->talk (msg); | ||
249 | } | ||
250 | |||
224 | 251 | ||
225 | /*** Operators ***/ | 252 | /*** Operators ***/ |
226 | 253 | ||