• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kopete/protocols/messenger/libpapillon

notifymessagetask.cpp

Go to the documentation of this file.
00001 /*
00002    notifymessagetask.h - Notify about new messages on Notification server.
00003 
00004    Copyright (c) 2006 by Michaƫl Larouche <larouche@kde.org>
00005 
00006    *************************************************************************
00007    *                                                                       *
00008    * This library is free software; you can redistribute it and/or         *
00009    * modify it under the terms of the GNU Lesser General Public            *
00010    * License as published by the Free Software Foundation; either          *
00011    * version 2 of the License, or (at your option) any later version.      *
00012    *                                                                       *
00013    *************************************************************************
00014 */
00015 #include "Papillon/Tasks/NotifyMessageTask"
00016 
00017 // Qt includes
00018 #include <QtCore/QLatin1String>
00019 #include <QtCore/QRegExp>
00020 #include <QtCore/QStringList>
00021 
00022 // Papillon includes
00023 #include "Papillon/NetworkMessage"
00024 #include "Papillon/MimeHeader"
00025 
00026 namespace Papillon
00027 {
00028 
00029 class NotifyMessageTask::Private
00030 {
00031 public:
00032     Private()
00033     {}
00034 };
00035 
00036 NotifyMessageTask::NotifyMessageTask(Task *parent)
00037  : Papillon::Task(parent), d(new Private)
00038 {
00039 }
00040 
00041 
00042 NotifyMessageTask::~NotifyMessageTask()
00043 {
00044     delete d;
00045 }
00046 
00047 
00048 bool NotifyMessageTask::take(NetworkMessage *networkMessage)
00049 {
00050     if( forMe(networkMessage) )
00051     {
00052         MimeHeader notifyMessage = MimeHeader::parseMimeHeader( QString(networkMessage->payloadData()) );
00053 
00054         emit profileMessage(notifyMessage);
00055 
00056         return true;
00057     }
00058 
00059     return false;
00060 }
00061 
00062 
00063 bool NotifyMessageTask::forMe(NetworkMessage *networkMessage) const
00064 {
00065     if( networkMessage->command() == QLatin1String("MSG") )
00066     {
00067         // TODO: Temp, shouldn't assume that it's Hotmail there.
00068         if( networkMessage->arguments()[0] == QLatin1String("Hotmail") )
00069         {
00070             return true;
00071         }
00072     }
00073 
00074     return false;   
00075 }
00076 
00077 }
00078 
00079 #include "notifymessagetask.moc"

kopete/protocols/messenger/libpapillon

Skip menu "kopete/protocols/messenger/libpapillon"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal