QString KopeteIface::onlineStatus( const QString &metaContactId ) { Kopete::MetaContact *m = Kopete::ContactList::self()->metaContact( metaContactId ); if( m ) { Kopete::OnlineStatus status = m->status(); return status.description(); } return "Unknown Contact"; }
void MeanwhileSession::setStatus(Kopete::OnlineStatus status, const Kopete::StatusMessage &msg) { HERE; mwDebug() << "setStatus: " << status.description() << '(' << status.internalStatus() << ')' << endl; if (status.internalStatus() == 0) return; struct mwUserStatus stat; mwUserStatus_clone(&stat, mwSession_getUserStatus(session)); free(stat.desc); stat.status = (mwStatusType)status.internalStatus(); if (msg.isEmpty()) stat.desc = ::strdup(status.description().toUtf8().constData()); else stat.desc = ::strdup(msg.message().toUtf8().constData()); mwSession_setUserStatus(session, &stat); /* will free stat.desc */ mwUserStatus_clear(&stat); }
void GroupWiseContact::setOnlineStatus( const Kopete::OnlineStatus& status ) { setMessageReceivedOffline( false ); if ( status == protocol()->groupwiseAwayIdle && status != onlineStatus() ) setIdleTime( 1 ); else if ( onlineStatus() == protocol()->groupwiseAwayIdle && status != onlineStatus() ) setIdleTime( 0 ); if ( account()->isContactBlocked( m_dn ) && status.internalStatus() < 15 ) { Kopete::Contact::setOnlineStatus(Kopete::OnlineStatus(status.status(), (status.weight()==0) ? 0 : (status.weight() -1), protocol() , status.internalStatus()+15 , QStringList("msn_blocked"), i18n("%1|Blocked", status.description() ) ) ); } else { if(status.internalStatus() >= 15) { //the user is not blocked, but the status is blocked switch(status.internalStatus()-15) { case 0: Kopete::Contact::setOnlineStatus( GroupWiseProtocol::protocol()->groupwiseUnknown ); break; case 1: Kopete::Contact::setOnlineStatus( GroupWiseProtocol::protocol()->groupwiseOffline ); break; case 2: Kopete::Contact::setOnlineStatus( GroupWiseProtocol::protocol()->groupwiseAvailable ); break; case 3: Kopete::Contact::setOnlineStatus( GroupWiseProtocol::protocol()->groupwiseBusy ); break; case 4: Kopete::Contact::setOnlineStatus( GroupWiseProtocol::protocol()->groupwiseAway ); break; case 5: Kopete::Contact::setOnlineStatus( GroupWiseProtocol::protocol()->groupwiseAwayIdle ); break; default: Kopete::Contact::setOnlineStatus( GroupWiseProtocol::protocol()->groupwiseUnknown ); break; } } else Kopete::Contact::setOnlineStatus(status); } }