[prev in list] [next in list] [prev in thread] [next in thread]
List: kopete-devel
Subject: Re: [kopete-devel] jabber group chats and notifications
From: David Faure <faure () kde ! org>
Date: 2008-10-01 23:10:16
Message-ID: 200810020110.17183.faure () kde ! org
[Download RAW message or body]
On Wednesday 01 October 2008, David Faure wrote:
> But as expected there is still a notification for replayed highlighted messages.
> I need to flag them as "delay delivery". Should I make that a new Importance level
> (VeryLow? Delayed?), or just a separate bool in Kopete::Message?
The latter seems simpler/safer. The attached patch works for me (it was nice to find
that libiris/iris/include/xmpp_message.h defines spooled(), set to true when jabber:x:delay was seen,
although with a strange comment about the method: "for compat, delete me later").
OK for committing?
--
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
["kopete_delayedmsg.diff" (text/x-diff)]
Index: protocols/jabber/jabbergroupcontact.cpp
===================================================================
--- protocols/jabber/jabbergroupcontact.cpp (revision 866673)
+++ protocols/jabber/jabbergroupcontact.cpp (working copy)
@@ -207,6 +207,7 @@ void JabberGroupContact::handleIncomingM
newMessage->setPlainBody( body );
newMessage->setRequestedPlugin( viewType );
newMessage->setImportance( Kopete::Message::Low );
+ newMessage->setDelayed( message.spooled() );
}
// append message to manager
Index: libkopete/kopetechatsession.cpp
===================================================================
--- libkopete/kopetechatsession.cpp (revision 865949)
+++ libkopete/kopetechatsession.cpp (working copy)
@@ -277,7 +277,7 @@ void Kopete::ChatSession::appendMessage(
if ( msg.direction() == Kopete::Message::Inbound )
{
QString nick=myself()->property(Kopete::Global::Properties::self()->nickName()).value().toString();
- if ( Kopete::BehaviorSettings::self()->highlightEnabled() && !nick.isEmpty() &&
+ if ( Kopete::BehaviorSettings::self()->highlightEnabled() && !nick.isEmpty() && \
!msg.delayed() && msg.plainBody().contains( QRegExp( QString::fromLatin1( \
"\\b(%1)\\b" ).arg( nick ), Qt::CaseInsensitive ) ) ) {
msg.setImportance( Kopete::Message::Highlight );
Index: libkopete/kopetemessage.cpp
===================================================================
--- libkopete/kopetemessage.cpp (revision 865949)
+++ libkopete/kopetemessage.cpp (working copy)
@@ -49,7 +49,7 @@ class Message::Private
public:
Private() //assign next message id, it can't be changed later
: id(nextId++), direction(Internal), format(Qt::PlainText), type(TypeNormal), \
importance(Normal), state(StateUnknown),
- backgroundOverride(false), foregroundOverride(false), richTextOverride(false), \
isRightToLeft(false), + delayed(false), backgroundOverride(false), \
foregroundOverride(false), richTextOverride(false), \
isRightToLeft(false),
timeStamp( QDateTime::currentDateTime() ), body(new QTextDocument), \
escapedBodyDirty(true), fileTransfer(0) {}
Private (const Private &other);
@@ -66,6 +66,7 @@ public:
QString requestedPlugin;
MessageImportance importance;
MessageState state;
+ bool delayed;
bool backgroundOverride;
bool foregroundOverride;
bool richTextOverride;
@@ -763,3 +764,13 @@ void Message::setClasses(const QStringLi
}
}
+
+bool Kopete::Message::delayed() const
+{
+ return d->delayed;
+}
+
+void Kopete::Message::setDelayed(bool delay)
+{
+ d->delayed = delay;
+}
Index: libkopete/kopetemessage.h
===================================================================
--- libkopete/kopetemessage.h (revision 865949)
+++ libkopete/kopetemessage.h (working copy)
@@ -183,6 +183,20 @@ public:
void setTimestamp(const QDateTime ×tamp);
/**
+ * @brief Accessor method for the "delayed" attribute of the message
+ * @return true if the message was delayed (for example because it has
+ * been stored on a server while the intended recipient was offline or
+ * because the message is contained in the history of a group chat room).
+ */
+ bool delayed() const;
+
+ /**
+ * @brief Set the "delayed" attribute of the message
+ * @param delay whether the message was delayed, see delayed()
+ */
+ void setDelayed(bool delay);
+
+ /**
* @brief Accessor method for the Contact that sent this message
* @return The Contact who sent this message
*/
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic