kopete/protocols/messenger/libpapillon
notifystatusmessagetask.cpp
Go to the documentation of this file.00001 /* 00002 notifystatusmessagetask.cpp - Notify contact status message changes. 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/NotifyStatusMessageTask" 00016 00017 // Qt includes 00018 #include <QtCore/QStringList> 00019 #include <QtCore/QLatin1String> 00020 00021 // Papillon includes 00022 #include "Papillon/NetworkMessage" 00023 #include "Papillon/StatusMessage" 00024 00025 namespace Papillon 00026 { 00027 00028 class NotifyStatusMessageTask::Private 00029 { 00030 public: 00031 Private() 00032 {} 00033 }; 00034 00035 NotifyStatusMessageTask::NotifyStatusMessageTask(Papillon::Task *parent) 00036 : Papillon::Task(parent), d(new Private) 00037 {} 00038 00039 NotifyStatusMessageTask::~NotifyStatusMessageTask() 00040 { 00041 delete d; 00042 } 00043 00044 bool NotifyStatusMessageTask::take(NetworkMessage *networkMessage) 00045 { 00046 if( networkMessage->command() == QLatin1String("UBX") ) 00047 { 00048 QString rawStatusMessage( networkMessage->payloadData() ); 00049 QString contactId = networkMessage->arguments()[0]; 00050 00051 Papillon::StatusMessage newStatusMessage = Papillon::StatusMessage::fromXml(rawStatusMessage); 00052 00053 emit contactStatusMessageChanged(contactId, newStatusMessage); 00054 00055 return true; 00056 } 00057 00058 return false; 00059 } 00060 00061 } 00062 #include "notifystatusmessagetask.moc"
KDE 4.2 API Reference