1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-16 14:01:58 +02:00

sipjreen: Add I'm-not-a-person-auto-response

This commit is contained in:
Dominik Schmidt 2011-04-18 22:18:12 +02:00
parent 01980ab6d1
commit 04b4c69ab3

View File

@ -303,6 +303,22 @@ Jabber_p::onNewMessage( const Jreen::Message& m )
if ( msg.isEmpty() )
return;
QJson::Parser parser;
bool ok;
QVariant v = parser.parse( msg.toAscii(), &ok );
if ( !ok || v.type() != QVariant::Map )
{
QString to = from;
QString response = QString( tr("I'm sorry -- I'm just an automatic presence used by Tomahawk Player"
" (http://gettomahawk.com). If you are getting this message, the person you"
" are trying to reach is probably not signed on, so please try again later!") );
// this is not a sip message, so we send it directly through the client
m_client->send( Jreen::Message ( Jreen::Message::Chat, Jreen::JID(to), response) );
return;
}
qDebug() << Q_FUNC_INFO << "From:" << m.from().full() << ":" << m.body();
emit msgReceived( from, msg );
}