Пример #1
0
/*!
    Called from server implementations to update the monitoring \a status
    of \a uri.  This function will update the global state as seen by
    monitoredUriStatus() and then emits monitoredPresence().

    \sa monitoredPresence(), startMonitoring(), stopMonitoring()
*/
void QPresence::updateMonitoredPresence
        ( const QString& uri, QPresence::Status status )
{
    if ( mode() != Server )
        return;
    if ( status == Unavailable )
        removeValue( makeSafe( uri ) );
    else
        setValue( makeSafe( uri ), (int)status );
    emit monitoredPresence( uri, status );
}
Пример #2
0
QString CSVWriter::prepForWriting(const QVariant& columnValue)
{
    QVariant x(columnValue);
    if (!x.convert(QMetaType::QString))
    {
        // TODO: Error

    }
    else
    {
        if (columnValue == QVariant::String)
        {
            return makeSafe(reduceSpaces(x.toString()));
        }
        else
        {
            return makeSafe(x.toString());
        }
    }
    return QString();
}
Пример #3
0
void Stats::run (JulieSu::Irc::Message message)
{
	std::string target = message.privmsg_target;

	// Safe the target
	std::string safe_target = makeSafe (target);
	//std::string str = "[stats] http://www.hackerguild.com/juliesu/logs/" + safe_target + ".html";
	std::string str = "[stats] http://stats.devhat.net/";

	if (message.privmsg_target == bot->getName())
		bot->getConnection()->sendPrivMsg (message.nick, str);
	else
		bot->getConnection()->sendPrivMsg (message.privmsg_target, str);
}
Пример #4
0
void CSVWriter::write(const CSVColumn& column)
{
    QString s = reduceSpaces(column.getValue());
    if (s.length() > 0)
    {
        if (column.isQualified())
        {
            write(getTextDelimiter());
            write(makeSafe(s));
            write(getTextDelimiter());
        }
        else
        {
            write(s);
        }
    }
}
Пример #5
0
/*!
    Stop monitoring \a uri for presence changes.  Returns false if \a uri
    was not currently being monitored by this object, or there are still
    remaining references to \a uri in the system.  Monitoring will be
    implicitly stopped when this object is destroyed.

    Server implementations that inherit from QPresence should call this
    base implementation before performing any other action.

    \sa monitoredPresence(), startMonitoring()
*/
bool QPresence::stopMonitoring( const QString& uri )
{
    if ( d->monitored.contains( uri ) ) {
        if ( --( d->monitored[uri] ) == 0 ) {
            d->monitored.remove( uri );
            if ( mode() == Client ) {
                invoke( SLOT(stopMonitoring(QString)), uri );
            } else {
                setValue( "allMonitoredUris",
                          QStringList( d->monitored.keys() ), Delayed );
                removeValue( makeSafe( uri ) );
            }
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
Пример #6
0
/*!
    Returns the current monitoring status associated with \a uri.

    \sa monitoredUris(), allMonitoredUris()
*/
QPresence::Status QPresence::monitoredUriStatus( const QString& uri ) const
{
    return (QPresence::Status)
        ( value( makeSafe( uri ), (int)Unavailable ).toInt() );
}