本文整理汇总了C++中kopete::Message::setTimestamp方法的典型用法代码示例。如果您正苦于以下问题:C++ Message::setTimestamp方法的具体用法?C++ Message::setTimestamp怎么用?C++ Message::setTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kopete::Message
的用法示例。
在下文中一共展示了Message::setTimestamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleIncomingMessage
//.........这里部分代码省略.........
{
//mManager->receivedEventNotification ( i18n("Message has been displayed") );
}
else if (message.containsEvent ( XMPP::DeliveredEvent ) )
{
//mManager->receivedEventNotification ( i18n("Message has been delivered") );
mManager->receivedMessageState( message.eventId().toUInt(), Kopete::Message::StateSent );
mSendsDeliveredEvent = true;
}
else if (message.containsEvent ( XMPP::OfflineEvent ) )
{
//mManager->receivedEventNotification( i18n("Message stored on the server, contact offline") );
mManager->receivedMessageState( message.eventId().toUInt(), Kopete::Message::StateSent );
}
else if (message.chatState() == XMPP::StateGone )
{
/*if(mManager->view( Kopete::Contact::CannotCreate ))
{ //show an internal message if the user has not already closed his window
Kopete::Message m=Kopete::Message ( this, mManager->members() );
m.setPlainBody( i18n("%1 has ended his/her participation in the chat session.", metaContact()->displayName()) );
m.setDirection( Kopete::Message::Internal );
m.setImportance(Kopete::Message::Low);
mManager->appendMessage ( m, message.from().resource () );
}*/
}
// XEP-0184: Message Delivery Receipts
if ( message.messageReceipt() == ReceiptReceived )
{
//mManager->receivedEventNotification ( i18n("Message has been delivered") );
mManager->receivedMessageState( message.messageReceiptId().toUInt(), Kopete::Message::StateSent );
mSendsDeliveredEvent = true;
}
}
else
// Then here could be event notification requests
{
mRequestComposingEvent = message.containsEvent ( XMPP::ComposingEvent );
mRequestOfflineEvent = message.containsEvent ( XMPP::OfflineEvent );
mRequestDeliveredEvent = message.containsEvent ( XMPP::DeliveredEvent );
mRequestDisplayedEvent = message.containsEvent ( XMPP::DisplayedEvent);
// XEP-0184: Message Delivery Receipts
mRequestReceiptDelivery = ( message.messageReceipt() == ReceiptRequest );
}
}
/**
* Don't display empty messages, these were most likely just carrying
* event notifications or other payload.
*/
if ( message.body().isEmpty () )
return;
Kopete::ContactPtrList contactList = kmm->members();
// check for errors
if ( message.type () == "error" )
{
newMessage = new Kopete::Message( this, contactList );
newMessage->setTimestamp( message.timeStamp() );
newMessage->setPlainBody( i18n("Your message could not be delivered: \"%1\", Reason: \"%2\"",
message.body (), message.error().text ) );
newMessage->setSubject( message.subject() );
newMessage->setDirection( Kopete::Message::Inbound );
newMessage->setRequestedPlugin( viewType );
}
else
{
// store message id for outgoing notifications
mLastReceivedMessageId = message.id ();
// retrieve and reformat body
QString body = message.body ();
if( !message.xencrypted().isEmpty () )
{
body = QString ("-----BEGIN PGP MESSAGE-----\n\n") + message.xencrypted () + QString ("\n-----END PGP MESSAGE-----\n");
}
else if( !message.xsigned().isEmpty () )
{
body = QString ("-----BEGIN PGP MESSAGE-----\n\n") + message.xsigned () + QString ("\n-----END PGP MESSAGE-----\n");
}
// convert XMPP::Message into Kopete::Message
newMessage = new Kopete::Message ( this, contactList );
newMessage->setTimestamp( message.timeStamp() );
newMessage->setPlainBody( body );
newMessage->setDirection( Kopete::Message::Inbound );
newMessage->setRequestedPlugin( viewType );
newMessage->setImportance( Kopete::Message::Low );
}
// append message to manager
kmm->appendMessage ( *newMessage );
delete newMessage;
}