C++ (Cpp) usermessage Example

Introduction

The c++ (cpp) usermessage example is extracted from the most popular open source projects, you can refer to the following example for usage.

Programming language: C++ (Cpp)

Class/type: usermessage

Example#1
File: ctcphandler.cppProject: svn2github/twsoldunsupported

bool ctcphandler::getctcp(const usermessage u){
    if (u.msg().startsWith("away")) {
        if (!awayusers.contains(u.user(), Qt::CaseInsensitive)){
            awayusers << u.user();
            foreach(chatwindow *w, ::window::chatwindows){
                if(w->chatpartner == u.user()){
                    w->setaway(1,u.msg());
                    break;
                }
            }
        }
    } else if (u.msg()=="back") {

Example#2
File: chathandlerprv.cppProject: Zexorz/tws

QTextCharFormat chathandlerprv::getRightFormat(const usermessage u) {
    QTextCharFormat format;
    if (!containsCI(S_S.buddylist, u.user()))
        format = hash[e_hash_chat];
    else
        format = hash[e_hash_buddy];
    if(u.user()==netc->nick)
        format=hash[e_hash_myself];
    if(u.has_type(e_PRIVMSG) && u.has_type(e_ACTION))
        format=hash[e_hash_action];
    else if(u.has_type(e_CTCP))
        format=hash[e_hash_ctcp];
    else if(u.has_type(e_NOTICE)) {
        if(u.has_type(e_ACTION))
            format=hash[e_hash_noticeaction];
        else
            format=hash[e_hash_notice];
    } else if(u.has_type(e_RAWCOMMAND) || u.has_type(e_SCRIPTCOMMAND))
        format=hash[e_hash_raw];
    return format;
}