本文整理汇总了C++中kopete::Message::direction方法的典型用法代码示例。如果您正苦于以下问题:C++ Message::direction方法的具体用法?C++ Message::direction怎么用?C++ Message::direction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kopete::Message
的用法示例。
在下文中一共展示了Message::direction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: messageReceived
void Kopete::ChatSession::appendMessage( Kopete::Message &msg )
{
msg.setManager( this );
if ( msg.direction() == Kopete::Message::Inbound )
{
const QString nick = myself()->nickName();
if ( Kopete::BehaviorSettings::self()->highlightEnabled() && !nick.isEmpty() )
{
const QString nickNameRegExp = QString::fromLatin1( "(^|[\\W])(%1)([\\W]|$)" ).arg( QRegExp::escape( nick ) );
if ( msg.plainBody().contains( QRegExp( nickNameRegExp, Qt::CaseInsensitive ) ) )
{
msg.setImportance( Kopete::Message::Highlight );
}
}
emit messageReceived( msg, this );
}
// outbound messages here are ones the user has sent that are now
// getting reflected back to the chatwindow. they should go down
// the incoming chain.
Kopete::Message::MessageDirection chainDirection = msg.direction();
if( chainDirection == Kopete::Message::Outbound )
chainDirection = Kopete::Message::Inbound;
chainForDirection( chainDirection )->processMessage( msg );
//looking for urls in the message
urlSearch( msg );
// emit messageAppended( msg, this );
}
示例2: messageReceived
void Kopete::ChatSession::appendMessage( Kopete::Message &msg )
{
msg.setManager( this );
if ( msg.direction() == Kopete::Message::Inbound )
{
QString nick=myself()->property(Kopete::Global::Properties::self()->nickName()).value().toString();
if ( KopetePrefs::prefs()->highlightEnabled() && !nick.isEmpty() &&
msg.plainBody().contains( QRegExp( QString::fromLatin1( "\\b(%1)\\b" ).arg( nick ), false ) ) )
{
msg.setImportance( Kopete::Message::Highlight );
}
emit messageReceived( msg, this );
}
// outbound messages here are ones the user has sent that are now
// getting reflected back to the chatwindow. they should go down
// the incoming chain.
Kopete::Message::MessageDirection chainDirection = msg.direction();
if( chainDirection == Kopete::Message::Outbound )
chainDirection = Kopete::Message::Inbound;
chainForDirection( chainDirection )->processMessage( msg );
// emit messageAppended( msg, this );
}
示例3: slotOutgoingMessage
void TextEffectPlugin::slotOutgoingMessage( Kopete::Message& msg )
{
if(msg.direction() != Kopete::Message::Outbound)
return;
QStringList colors=m_config->colors();
if(m_config->colorChar() || m_config->colorWords() || m_config->lamer() || m_config->waves() )
{
QString original=msg.plainBody();
QString resultat;
unsigned int c=0;
bool wavein=false;
for(unsigned int f=0;f<original.length();f++)
{
QChar x=original[f];
if(f==0 || m_config->colorChar() || (m_config->colorWords() && x==' ' ))
{
if(f!=0)
resultat+="</font>";
resultat+="<font color=\"";
resultat+=colors[c];
if(m_config->colorRandom())
c=rand()%colors.count();
else
{
c++;
if(c >= colors.count())
c=0;
}
resultat+="\">";
}
switch (x.latin1())
{
case '>':
resultat+=">";
break;
case '<':
resultat+="<";
break;
case '&':
resultat+="&";
break;
case '\n':
resultat+="<br>";
case 'a':
case 'A':
if(m_config->lamer())
{
resultat+="4";
break;
} //else, go to the default, all other case have this check
case 'e':
case 'E':
if(m_config->lamer())
{
resultat+="3";
break;
}//else, go to the default, all other case have this check
case 'i':
case 'I':
if(m_config->lamer())
{
resultat+="1";
break;
}//else, go to the default, all other case have this check
case 'l':
case 'L':
if(m_config->lamer())
{
resultat+="|";
break;
}//else, go to the default, all other case have this check
case 't':
case 'T':
if(m_config->lamer())
{
resultat+="7";
break;
}//else, go to the default, all other case have this check
case 's':
case 'S':
if(m_config->lamer())
{
resultat+="5";
break;
}//else, go to the default, all other case have this check
case 'o':
case 'O':
if(m_config->lamer())
{
resultat+="0";
break;
}//else, go to the default, all other case have this check
default:
if(m_config->waves())
{
resultat+= wavein ? x.lower() : x.upper();
//.........这里部分代码省略.........
示例4: testPrimitives
void KopeteMessage_Test::testPrimitives()
{
/**********************************************
* from(), to()
*********************************************/
{
Kopete::Message msg( m_contactFrom, m_contactTo);
Q_ASSERT(msg.from());
Q_ASSERT(!msg.to().isEmpty());
}
/**********************************************
* Direction
*********************************************/
{
Kopete::Message msg;
msg.setDirection( Kopete::Message::Inbound );
QCOMPARE(msg.direction(), Kopete::Message::Inbound);
}
{
Kopete::Message msg;
msg.setDirection( Kopete::Message::Outbound );
QCOMPARE(msg.direction(), Kopete::Message::Outbound);
}
{
Kopete::Message msg;
msg.setDirection( Kopete::Message::Internal );
QCOMPARE(msg.direction(), Kopete::Message::Internal);
}
/**********************************************
* Message Format
*********************************************/
{
Kopete::Message msg;
msg.setPlainBody( QLatin1String("foobar") );
QCOMPARE(msg.format(), Qt::PlainText);
}
{
Kopete::Message msg;
msg.setHtmlBody( QLatin1String("foobar") );
QCOMPARE(msg.format(), Qt::RichText);
}
{
QString m = "foobar";
Kopete::Message msg;
msg.setPlainBody(m);
QCOMPARE(msg.format(), Qt::PlainText);
msg.setHtmlBody(m);
QCOMPARE(msg.format(), Qt::RichText);
}
/**********************************************
* setBody()
*********************************************/
{
QString m = "foobar";
Kopete::Message msg;
msg.setHtmlBody( m );
msg.setPlainBody("NEW");
QCOMPARE(QString("NEW"), msg.plainBody());
msg.setPlainBody("NEW_NEW");
QCOMPARE(msg.plainBody(), QString("NEW_NEW"));
}
{
QString m = "foobar";
Kopete::Message msg;
msg.setPlainBody( m );
msg.setPlainBody("NEW");
QCOMPARE(msg.plainBody(), QString("NEW"));
msg.setHtmlBody("NEW_NEW");
QCOMPARE(msg.plainBody(), QString("NEW_NEW"));
}
{
QString m = "<html><head></head><body foo=\"bar\"> <b>HELLO WORLD</b> </body></html>";
Kopete::Message msg;
msg.setPlainBody( m );
QCOMPARE(msg.plainBody(), m);
msg.setPlainBody("<simple> SIMPLE");
QCOMPARE(msg.plainBody(), QString("<simple> SIMPLE"));
msg.setHtmlBody("<simple>SIMPLE</simple>");
QCOMPARE(msg.plainBody(), QString("SIMPLE") );
QCOMPARE(Kopete::Message::unescape( QString( "<simple>SIMPLE</simple>" ) ), QString("SIMPLE") );
QCOMPARE(Kopete::Message::unescape( QString( "Foo <img src=\"foo.png\" />" ) ), QString("Foo ") );
QCOMPARE(Kopete::Message::unescape( QString( "Foo <img src=\"foo.png\" title=\"Bar\" />" ) ), QString("Foo Bar") );
//.........这里部分代码省略.........