43
43
#endif
44
44
45
45
#include " purple_defs.h"
46
- #include " loopback.h"
47
46
48
47
DEFINE_LOGGER (logger_libpurple, " libpurple" );
49
48
DEFINE_LOGGER (logger, " backend" );
50
49
51
- MessageLoopbackTracker *loopbackTracker; // Tracks outgoing messages to ignore loopbacks
50
+ /* Additional PURPLE_MESSAGE_* flags as a hack to track the origin of the message. */
51
+ typedef enum {
52
+ PURPLE_MESSAGE_SPECTRUM2_ORIGINATED = 0x80000000 ,
53
+ } PurpleMessageSpectrum2Flags;
52
54
53
55
int main_socket;
54
56
static int writeInput;
@@ -612,7 +614,6 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
612
614
}
613
615
if (xhtml.empty ()) {
614
616
gchar *_markup = purple_markup_escape_text_wrapped (message.c_str (), -1 );
615
- loopbackTracker->add (conv, _markup);
616
617
if (purple_conversation_get_type_wrapped (conv) == PURPLE_CONV_TYPE_IM) {
617
618
purple_conv_im_send_with_flags_wrapped (PURPLE_CONV_IM_WRAPPED (conv), _markup, static_cast <PurpleMessageFlags>(PURPLE_MESSAGE_SPECTRUM2_ORIGINATED));
618
619
}
@@ -622,7 +623,6 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
622
623
g_free (_markup);
623
624
}
624
625
else {
625
- loopbackTracker->add (conv, xhtml);
626
626
if (purple_conversation_get_type_wrapped (conv) == PURPLE_CONV_TYPE_IM) {
627
627
purple_conv_im_send_with_flags_wrapped (PURPLE_CONV_IM_WRAPPED (conv), xhtml.c_str (), static_cast <PurpleMessageFlags>(PURPLE_MESSAGE_SPECTRUM2_ORIGINATED));
628
628
}
@@ -1483,17 +1483,8 @@ static void conv_write_im(PurpleConversation *conv, const char *who, const char
1483
1483
if (purple_conversation_get_type_wrapped (conv) == PURPLE_CONV_TYPE_IM) {
1484
1484
// Don't forwards our own messages, but do forward messages "from=us" which originated elsewhere
1485
1485
// (such as carbons of our messages from other legacy network clients)
1486
-
1487
- // First check by list so that if a message is there it's removed
1488
- // and does not inhibit another one later
1489
- if (loopbackTracker->matchAndRemove (conv, msg, mtime)) {
1490
- LOG4CXX_DEBUG (logger, " conv_write_im(): ignoring a message matching one we sent (flags=" << flags << " )" );
1491
- return ;
1492
- }
1493
-
1494
- // Many libpurple protocols preserve flags so try to match by that too
1495
1486
if (flags & PURPLE_MESSAGE_SPECTRUM2_ORIGINATED) {
1496
- LOG4CXX_DEBUG (logger, " conv_write_im(): ignoring a message generated by us (flags= " << flags << " ) " );
1487
+ LOG4CXX_INFO (logger, " conv_write_im(): ignoring a message generated by us" );
1497
1488
return ;
1498
1489
}
1499
1490
@@ -1503,7 +1494,7 @@ static void conv_write_im(PurpleConversation *conv, const char *who, const char
1503
1494
1504
1495
// Ignore system messages as those are normally not true messages in the XMPP sense
1505
1496
if (flags & PURPLE_MESSAGE_SYSTEM) {
1506
- LOG4CXX_DEBUG (logger, " conv_write_im(): ignoring a system message" );
1497
+ LOG4CXX_INFO (logger, " conv_write_im(): ignoring a system message" );
1507
1498
return ;
1508
1499
}
1509
1500
}
@@ -2554,9 +2545,6 @@ int main(int argc, char **argv) {
2554
2545
purple_input_add_wrapped (main_socket, PURPLE_INPUT_READ, &transportDataReceived, NULL );
2555
2546
purple_timeout_add_seconds_wrapped (30 , pingTimeout, NULL );
2556
2547
2557
- loopbackTracker = new MessageLoopbackTracker ();
2558
- loopbackTracker->setAutotrim (true );
2559
-
2560
2548
np = new SpectrumNetworkPlugin ();
2561
2549
2562
2550
GMainLoop *m_loop;
0 commit comments