Esempio n. 1
0
void WPAccount::setOnlineStatus(const Kopete::OnlineStatus &status, const QString &reason)
{
	if (myself()->onlineStatus().status() == Kopete::OnlineStatus::Offline && status.status() == Kopete::OnlineStatus::Online)
		connect( status );
	else if (myself()->onlineStatus().status() != Kopete::OnlineStatus::Offline && status.status() == Kopete::OnlineStatus::Offline)
		disconnect();
	else if (myself()->onlineStatus().status() != Kopete::OnlineStatus::Offline && status.status() == Kopete::OnlineStatus::Away)
		setAway( true, reason );
}
Esempio n. 2
0
void FacebookAccount::setOnlineStatus(const Kopete::OnlineStatus& status, const Kopete::StatusMessage &reason, const OnlineStatusOptions& options)
{
    Q_UNUSED(options);

    if ( status.status() == Kopete::OnlineStatus::Online &&
         myself()->onlineStatus().status() == Kopete::OnlineStatus::Offline )
        slotGoOnline();
    else if (status.status() == Kopete::OnlineStatus::Online &&
             myself()->onlineStatus().status() == Kopete::OnlineStatus::Away )
        setAway( false, reason.message() );
    else if ( status.status() == Kopete::OnlineStatus::Offline )
        slotGoOffline();
    else if ( status.status() == Kopete::OnlineStatus::Away )
        slotGoAway( /* reason */ );    
}
Esempio n. 3
0
void IRCAccount::setOnlineStatus(const Kopete::OnlineStatus& status, const Kopete::StatusMessage &reason, const OnlineStatusOptions& /*options*/)
{
	if ( status.status() == Kopete::OnlineStatus::Online &&
			myself()->onlineStatus().status() == Kopete::OnlineStatus::Offline )
		slotGoOnline();
	else if (status.status() == Kopete::OnlineStatus::Online &&
			(myself()->onlineStatus().status() == Kopete::OnlineStatus::Away || 
				myself()->onlineStatus().status() == Kopete::OnlineStatus::Busy) )
		setAway( false, reason.message() );
	else if ( status.status() == Kopete::OnlineStatus::Offline )
		slotGoOffline();
	else if ( status.status() == Kopete::OnlineStatus::Away )
		slotGoAway( /* reason */ );
	else if ( status.status() == Kopete::OnlineStatus::Busy )
		slotGoBusy( /* reason */ );
}
void JabberTransport::setOnlineStatus( const Kopete::OnlineStatus& status  , const QString &reason)
{
#if 0
	if( status.status() == Kopete::OnlineStatus::Offline )
	{
		disconnect( Kopete::Account::Manual );
		return;
	}

	if( isConnecting () )
	{
		errorConnectionInProgress ();
		return;
	}

	XMPP::Status xmppStatus ( "", reason );

	switch ( status.internalStatus () )
	{
		case JabberProtocol::JabberFreeForChat:
			xmppStatus.setShow ( "chat" );
			break;

		case JabberProtocol::JabberOnline:
			xmppStatus.setShow ( "" );
			break;

		case JabberProtocol::JabberAway:
			xmppStatus.setShow ( "away" );
			break;

		case JabberProtocol::JabberXA:
			xmppStatus.setShow ( "xa" );
			break;

		case JabberProtocol::JabberDND:
			xmppStatus.setShow ( "dnd" );
			break;

		case JabberProtocol::JabberInvisible:
			xmppStatus.setIsInvisible ( true );
			break;
	}

	if ( !isConnected () )
	{
		// we are not connected yet, so connect now
		m_initialPresence = xmppStatus;
		connect ();
	}
	else
	{
		setPresence ( xmppStatus );
	}
#endif
}
Esempio n. 5
0
void KopeteSystemTray::slotReevaluateAccountStates()
{
	// If there is a pending message, we don't need to refresh the system tray now.
	// This function will even be called when the animation will stop.
	if ( mBlinkTimer->isActive() )
		return;

	Kopete::OnlineStatus highestStatus;
	foreach ( Kopete::Account *account, Kopete::AccountManager::self()->accounts())
	{
		if ( account->myself() && account->myself()->onlineStatus() > highestStatus )
		{
			highestStatus = account->myself()->onlineStatus();
		}
	}

	switch ( highestStatus.status() )
	{
		case Kopete::OnlineStatus::Unknown:
		case Kopete::OnlineStatus::Offline:
		case Kopete::OnlineStatus::Connecting:
		{
			setIconByName("kopete-offline");
			setOverlayIconByName("user-offline");
			break;
		}
		case Kopete::OnlineStatus::Invisible:
		{
			setIconByName(mKopeteIcon);
			setOverlayIconByName("user-invisible");
			break;
		}
		case Kopete::OnlineStatus::Away:
		{
			setIconByName(mKopeteIcon);
			setOverlayIconByName("user-away");
			break;
		}
		case Kopete::OnlineStatus::Busy:
		{
			setIconByName(mKopeteIcon);
			setOverlayIconByName("user-busy");
			break;
		}
		case Kopete::OnlineStatus::Online:
		{
			setIconByName(mKopeteIcon);
			setOverlayIconByName(QString());
			break;
		}
	}
}
Esempio n. 6
0
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);
	}
}
Esempio n. 7
0
XMPP::Status JabberProtocol::kosToStatus( const Kopete::OnlineStatus & status , const QString & message )
{
	XMPP::Status xmppStatus ( "", message );

	if( status.status() == Kopete::OnlineStatus::Offline )
	{
		xmppStatus.setIsAvailable( false );
	}

	switch ( status.internalStatus () )
	{
		case JabberProtocol::JabberFreeForChat:
			xmppStatus.setShow ( "chat" );
			break;

		case JabberProtocol::JabberOnline:
			xmppStatus.setShow ( "" );
			break;

		case JabberProtocol::JabberAway:
			xmppStatus.setShow ( "away" );
			break;

		case JabberProtocol::JabberXA:
			xmppStatus.setShow ( "xa" );
			break;

		case JabberProtocol::JabberDND:
			xmppStatus.setShow ( "dnd" );
			break;

		case JabberProtocol::JabberInvisible:
			xmppStatus.setIsInvisible ( true );
			break;
	}
	return xmppStatus;
}
Esempio n. 8
0
void
WlmContact::setOnlineStatus(const Kopete::OnlineStatus& status)
{
#if 0
	bool isBlocked = qobject_cast <WlmAccount *>(account())->isOnBlockList(contactId());
	bool isOnForwardList = qobject_cast <WlmAccount *>(account())->isOnServerSideList(contactId());
	bool isOnReverseList = qobject_cast <WlmAccount *>(account())->isOnReverseList(contactId());
	
	// if this contact is blocked, and currently has a regular status,
	// create a custom status and add wlm_blocked to ovelayIcons
	if(isBlocked || (isOnForwardList && !isOnReverseList))
	{
		QStringList overelayIconsList;
		QString reason;
		if(isOnForwardList && !isOnReverseList)
		{
			overelayIconsList << "wlm_fakefriend";
			reason = i18n("This contact does not have you in his/her list");
		}

		if(isBlocked)
		{
			overelayIconsList << "wlm_blocked";
			if(reason.isEmpty())
				reason = i18n("This contact is blocked");
			else
				reason = i18n("This contact does not have you in his/her list and is blocked");
		}
		// set the new status
		Kopete::Contact::setOnlineStatus(
				Kopete::OnlineStatus(status.status() ,
				(status.weight()==0) ? 0 : (status.weight() -1),
				protocol(),
				status.internalStatus()+15,
				status.overlayIcons() + overelayIconsList,
				reason ) );
		return;
	}

	if (status.internalStatus() >= 15)
	{
		// if this contact was previously blocked, set a regular status again
		switch(status.internalStatus()-15)
		{
			case 1:
				Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmOnline);
				break;
			case 2:
				Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmAway);
				break;
			case 3:
				Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmBusy);
				break;
			case 4:
				Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmBeRightBack);
				break;
			case 5:
				Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmOnThePhone);
				break;
			case 6:
				Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmOutToLunch);
				break;
			case 7:
				Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmInvisible);
				break;
			case 8:
				Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmOffline);
				break;
			case 9:
				Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmIdle);
				break;
			default:
				Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmUnknown);
				break;
		}

	}
	else
#endif
		Kopete::Contact::setOnlineStatus(status);
}