summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-07-28 12:25:00 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-07-28 12:25:00 (GMT)
commitdd7de6cfb93f8812189f8365a6c8659d0686678d (patch)
tree65678eca06525bdf0acec463fd36070e2d45cd8b /Swiftob/Commands.cpp
parentea816801a9d73529bbf9eb3800fef8e85a18d6ca (diff)
downloadswift-contrib-dd7de6cfb93f8812189f8365a6c8659d0686678d.zip
swift-contrib-dd7de6cfb93f8812189f8365a6c8659d0686678d.tar.bz2
Allow Swiftob message listeners to ignore the bot's messages
Diffstat (limited to 'Swiftob/Commands.cpp')
-rw-r--r--Swiftob/Commands.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/Swiftob/Commands.cpp b/Swiftob/Commands.cpp
index 38e5f57..fd1b983 100644
--- a/Swiftob/Commands.cpp
+++ b/Swiftob/Commands.cpp
@@ -75,8 +75,16 @@ bool Commands::runCommand(const std::string& name, const std::string& params, Sw
}
void Commands::runListeners(Swift::Message::ref message) {
+ bool ownMessage = false;
+ JID room = message->getFrom().toBare();
+ if (mucs_->contains(room)) {
+ MUC::ref muc = mucs_->getMUC(room);
+ ownMessage = muc->getOwnNick() == message->getFrom().getResource();
+ }
foreach (ListenerCallback listener, listeners_) {
- listener(message);
+ if (!ownMessage || listener.second) {
+ listener.first(message);
+ }
}
}