bool JT_SapoRemoteOptions::take (const QDomElement &stanza)
{
	if (stanza.tagName() == "iq" && stanza.attribute("id") == id()) {
		if (stanza.attribute("type") == "result") {
			if (_type == "get") {
				QDomElement query = stanza.firstChildElement("query");
				
				if (!query.isNull() && query.attribute("xmlns") == "jabber:iq:private") {
					QDomElement x = query.firstChildElement("x");
					
					if (!x.isNull() && x.attribute("xmlns") == "sapo:remote:options") {
						
						_savedXML = x;
						
						setSuccess();
						return true;
					}
				}
				setError();
			}
			else {
				setSuccess();
			}
		}
		else {
			setError();
		}
		return true;
	}
	return false;
}
Ejemplo n.º 2
0
	bool take(const QDomElement& x) {
		if(!iqVerify(x, myjid_, id()))  // , "urn:xmpp:ping"
			return false;

		if(x.attribute("type") == "result") {
			// something bad, we never reply to this stanza so someone
			// else got it.
			// FIXME seems to be no longer true
			//emit result(NotUs, id());
			emit result(LoggedIn, id());
			setSuccess();
		} else if(x.attribute("type") == "get") {
			// All went well!
			emit result(LoggedIn, id());
			setSuccess();
		} else {
			QDomElement tag = x.firstChildElement("error");
			if(tag.isNull()) {
				emit result(OtherErr, id());
			} else {
				XMPP::Stanza::Error err;
				err.fromXml(tag, client()->stream().baseNS());
				if (err.condition == XMPP::Stanza::Error::ItemNotFound) {
					emit result(NoSuch, id());
				} else if (err.condition == XMPP::Stanza::Error::NotAcceptable ) {
					emit result(NotOccupant, id());
				} else {
					emit result(OtherErr, id());
				}
				setSuccess();
			}
		}
		return true;
	}
Ejemplo n.º 3
0
QString getString(const QVariant &in, const QString &parentName, const QString &childName, bool required, bool *ok, QString *errorMessage)
{
	bool ok_;
	QVariant v = getChild(in, parentName, childName, required, &ok_, errorMessage);
	if(!ok_)
	{
		if(ok)
			*ok = false;
		return QString();
	}

	if(!v.isValid() && !required)
	{
		setSuccess(ok, errorMessage);
		return QString();
	}

	QString pn = !parentName.isEmpty() ? parentName : QString("object");

	QString str = getString(v, &ok_);
	if(!ok_)
	{
		setError(ok, errorMessage, QString("%1 contains '%2' with wrong type").arg(pn, childName));
		return QString();
	}

	setSuccess(ok, errorMessage);
	return str;
}
Ejemplo n.º 4
0
void SSIModifyTask::updateContactManager()
{
	if ( m_oldItem.isValid() && m_newItem.isValid() )
	{
		if ( m_opSubject == Contact )
		{
			kDebug(OSCAR_RAW_DEBUG) << "Removing " << m_oldItem.name();
			m_ssiManager->removeContact( m_oldItem.name() );
			kDebug(OSCAR_RAW_DEBUG) << "and adding " << m_newItem.name() << " to contact manager";
			m_ssiManager->newContact( m_newItem );
		}
		else if ( m_opSubject == Group )
		{
			if ( m_opType == Rename )
				m_ssiManager->updateGroup( m_newItem );
			else if ( m_opType == Change )
				m_ssiManager->updateContact( m_newItem );
		}
		else if ( m_opSubject == NoSubject )
		{
			kDebug(OSCAR_RAW_DEBUG) << "Removing " << m_oldItem.name();
			m_ssiManager->removeItem( m_oldItem );
			kDebug(OSCAR_RAW_DEBUG) << "and adding " << m_newItem.name() << " to contact manager";
			m_ssiManager->newItem( m_newItem );
		}
		setSuccess( 0, QString() );
		return;
	}

	if ( m_oldItem.isValid() && !m_newItem )
	{
		kDebug(OSCAR_RAW_DEBUG) << "Removing " << m_oldItem.name() << " from contact manager";
		if ( m_opSubject == Group )
			m_ssiManager->removeGroup( m_oldItem.name() );
		else if ( m_opSubject == Contact )
			m_ssiManager->removeContact( m_oldItem.name() );
		else if ( m_opSubject == NoSubject )
			m_ssiManager->removeItem( m_oldItem );
		setSuccess( 0, QString() );
		return;
	}

	if ( m_newItem.isValid() && !m_oldItem )
	{
		kDebug(OSCAR_RAW_DEBUG) << "Adding " << m_newItem.name() << " to contact manager";
		if ( m_opSubject == Group )
			m_ssiManager->newGroup( m_newItem );
		else if ( m_opSubject == Contact )
			m_ssiManager->newContact( m_newItem );
		else if ( m_opSubject == NoSubject )
			m_ssiManager->newItem( m_newItem );
		setSuccess( 0, QString() );
		return;
	}

	setSuccess( 0, QString() );
}
Ejemplo n.º 5
0
void ImportFilesTask::run() {
    ScopedTimer timer("ImportFilesTask::run");
    foreach (const QFileInfo& file, m_filesToImport) {
        // If a flag was raised telling us to cancel the library scan then stop.
        if (m_scannerGlobal->shouldCancel()) {
            setSuccess(false);
            return;
        }

        QString filePath = file.filePath();
        //qDebug() << "ImportFilesTask::run" << filePath;

        // If the file does not exist in the database then add it. If it
        // does then it is either in the user's library OR the user has
        // "removed" the track via "Right-Click -> Remove". These tracks
        // stay in the library, but their mixxx_deleted column is 1.
        if (m_scannerGlobal->trackExistsInDatabase(filePath)) {
            // If the track is in the database, mark it as existing. This code gets
            // executed when other files in the same directory have changed (the
            // directory hash has changed).
            emit(trackExists(filePath));
        } else {
            // Parse the track including cover art from metadata. This is a new
            // (never before seen) track so it is safe to parse cover art
            // without checking if we have cover art that is USER_SELECTED. If
            // this changes in the future you MUST check that the cover art is
            // not USER_SELECTED first.
            TrackPointer pTrack(
                new TrackInfoObject(filePath, m_pToken));
            SoundSourceProxy(pTrack).loadTrackMetadataAndCoverArt();

            // If cover art is not found in the track metadata, populate from
            // possibleCovers.
            // This is a new (never before seen) track so it is safe
            // to parse cover art without checking if we have cover art
            // that is USER_SELECTED. If this changes in the future you
            // MUST check that the cover art is not USER_SELECTED first.
            if (pTrack->getCoverArt().image.isNull()) {
                CoverArt art = CoverArtUtils::selectCoverArtForTrack(
                    pTrack.data(), m_possibleCovers);
                if (!art.image.isNull()) {
                    pTrack->setCoverArt(art);
                }
            }

            emit(addNewTrack(pTrack));
        }
    }
    // Insert or update the hash in the database.
    emit(directoryHashedAndScanned(m_dirPath, !m_prevHashExists, m_newHash));
    setSuccess(true);
}
Ejemplo n.º 6
0
QVariant getChild(const QVariant &in, const QString &parentName, const QString &childName, bool required, bool *ok, QString *errorMessage)
{
	if(!isKeyedObject(in))
	{
		QString pn = !parentName.isEmpty() ? parentName : QString("value");
		setError(ok, errorMessage, QString("%1 is not an object").arg(pn));
		return QVariant();
	}

	QString pn = !parentName.isEmpty() ? parentName : QString("object");

	QVariant v;
	if(in.type() == QVariant::Hash)
	{
		QVariantHash h = in.toHash();

		if(!h.contains(childName))
		{
			if(required)
				setError(ok, errorMessage, QString("%1 does not contain '%2'").arg(pn, childName));
			else
				setSuccess(ok, errorMessage);

			return QVariant();
		}

		v = h[childName];
	}
	else // Map
	{
		QVariantMap m = in.toMap();

		if(!m.contains(childName))
		{
			if(required)
				setError(ok, errorMessage, QString("%1 does not contain '%2'").arg(pn, childName));
			else
				setSuccess(ok, errorMessage);

			return QVariant();
		}

		v = m[childName];
	}

	setSuccess(ok, errorMessage);
	return v;
}
Ejemplo n.º 7
0
bool JT_ServerVars::take(const QDomElement &elem)
{
	if(!iqVerify(elem, _jid, id()))
		return false;
	
	if(elem.attribute("type") == "result") {
		QDomElement q = queryTag(elem);
		
		// Save all the variables
		for(QDomElement var = q.firstChildElement("variable");
			!var.isNull();
			var = var.nextSiblingElement("variable"))
		{
			QString variableName = var.attribute("name");
			QString variableValue = var.text();
			
			// Save it
			_varsValues[variableName] = QVariant(variableValue);
		}
		
		setSuccess(true);
	}
	else {
		setError(elem);
	}
	
	return true;
}
Ejemplo n.º 8
0
bool JT_SapoDebug::take (const QDomElement &stanza)
{
	if (stanza.tagName() == "iq" && stanza.attribute("id") == id()
		&& _toJID.compare(Jid(stanza.attribute("from")), false))
	{
		QDomElement query = stanza.firstChildElement("query");
		
		if (!query.isNull() && query.attribute("xmlns") == "sapo:debug") {
			if (stanza.attribute("type") == "result") {
				_isDebugger = true;
			}
			else if (stanza.attribute("type") == "error") {
				_isDebugger = false;
			}
			setSuccess();
		}
		else {
			setError();
		}
		return true;
	}
	else {
		return false;
	}
}
bool ICQTlvInfoRequestTask::take( Transfer* transfer )
{
	if ( forMe( transfer ) )
	{
		const SnacTransfer* st = dynamic_cast<const SnacTransfer*>( transfer );
		if ( !st )
			return false;
		
		setTransfer( transfer );
		TLV tlv1 = transfer->buffer()->getTLV();
		Buffer buffer( tlv1.data, tlv1.length );

		//FIXME this is silly. parseInitialData should take care of this for me.
		buffer.skipBytes( 12 );

		if ( buffer.getByte() == 0x0A )
		{
			kDebug(OSCAR_RAW_DEBUG) << "Received user info";
			parse( st->snacRequest(), buffer.getLEBlock() );
			setSuccess( 0, QString() );
		}
		else
		{
			kDebug(OSCAR_RAW_DEBUG) << "Couldn't receive user info!!!";
			setError( 0, QString() );
		}

		setTransfer( 0 );
		return true;
	}
	return false;
}
Ejemplo n.º 10
0
void SendNotifyTask::onGo()
{
	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceNotify);
	t->setId( client()->sessionID() );
	t->setStatus( Yahoo::StatusNotify );

	switch( m_type )
	{
	case NotifyTyping:
		t->setParam( 4, client()->userId().local8Bit() );
		t->setParam( 5, m_target.local8Bit() );
		t->setParam( 13, m_state );
		t->setParam( 14, " " );
		t->setParam( 49, "TYPING" );
	break;
	case NotifyWebcamInvite:

		kdDebug(YAHOO_RAW_DEBUG) << "send invitation set Param" << endl;
		t->setParam( 1, client()->userId().local8Bit() );
		t->setParam( 5, m_target.local8Bit() );
		t->setParam( 13, 0 );
		t->setParam( 14, " " );
		t->setParam( 49, "WEBCAMINVITE" );
	break;
	case NotifyGame:
	default:
		setError();
		delete t;
		return;
	break;
	}
	send( t );

	setSuccess();
}
Ejemplo n.º 11
0
bool GetStatusTask::take( Transfer * transfer )
{
	if ( !forMe( transfer ) )
		return false;
	Response * response = dynamic_cast<Response *>( transfer );
	if ( !response )
		return false;
	
	Field::FieldList responseFields = response->fields();
	responseFields.dump( true );
	// parse received details and signal like billio
	Field::SingleField * sf = 0;
	Q_UINT16 status;
	sf = responseFields.findSingleField( NM_A_SZ_STATUS );
	if ( sf )
	{
		// As of Sept 2004 the server always responds with 2 (Available) here, even if the sender is not
		// This must be because the sender is not on our contact list but has sent us a message.
		// TODO: Check that the change to sending DNs above has fixed this problem.
		status = sf->value().toInt();
		// unfortunately getstatus doesn't give us an away message so we pass QString::null here
		emit gotStatus( m_userDN, status, QString::null );
		setSuccess();
	}	
	else
		setError();	
	return true;
}
Ejemplo n.º 12
0
	bool take(const QDomElement& x) {
		if(!iqVerify(x, "", id()))
			return false;

		if(x.attribute("type") == "result") {
			QDomElement q = queryTag(x);
			for (QDomNode n = q.firstChild(); !n.isNull(); n = n.nextSibling()) {
				QDomElement e = n.toElement();
				if (!e.isNull() && e.tagName() == "storage" && e.attribute("xmlns") == "storage:bookmarks") {
					for (QDomNode m = e.firstChild(); !m.isNull(); m = m.nextSibling()) {
						QDomElement f = m.toElement();
						if (f.isNull())
							continue;

						if (f.tagName() == "url") {
							URLBookmark u(f);
							if (!u.isNull())
								urls_ += u;
						}
						else if (f.tagName() == "conference") {
							ConferenceBookmark c(f);
							if (!c.isNull())
								conferences_ += c;
						}
					}
				}
			}
			setSuccess();
		}
		else {
			setError(x);
		}
		return true;
	}
Ejemplo n.º 13
0
bool
KGpgVerify::nextLine(const QString &line)
{
	if (line.startsWith(QLatin1String("[GNUPG:] NO_PUBKEY "))) {
		setSuccess(TS_MISSING_KEY);
		m_missingId = line.mid(19).simplified();
		return false;
	}

	if (line.startsWith(QLatin1String("[GNUPG:] ")) &&
			line.contains(QLatin1String("SIG"))) {
		if (line.startsWith(QLatin1String("[GNUPG:] BADSIG")))
			setSuccess(KGpgVerify::TS_BAD_SIGNATURE);
		else
			setSuccess(KGpgTransaction::TS_OK);
	}

	return KGpgTextOrFileTransaction::nextLine(line);
}
Ejemplo n.º 14
0
void PingTask::onGo()
{
	kDebug(YAHOO_RAW_DEBUG) ;

	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServicePing);
	t->setId( client()->sessionID() );
	send( t );
	
	setSuccess();
}
Ejemplo n.º 15
0
  void runTest() {
    try {
      parser_.parse(0, input_);
    } catch (falcon::Exception& e) {
      setErrorMessage("parsing error: " + e.getErrorMessage());
      setSuccess(e.getCode() == errorCodeExpected_);
      return;
    }

    falcon::JsonVal* dom = parser_.getDom();
    if (!dom) {
      if (key_ == "") {
        if (errorCodeExpected_ != 0) {
          setErrorMessage("wrong error code");
        }
        setSuccess(errorCodeExpected_ == 0);
      } else {
        setErrorMessage("parsing error: not a valide JSon");
        setSuccess(errorCodeExpected_ == EINVAL);
      }
      return;
    }

    falcon::JsonVal* obj = (falcon::JsonVal*)dom->getObject(key_);
    if (!obj) {
      if (key_ == "") {
        if (errorCodeExpected_ != 0) {
          setErrorMessage("wrong error code");
        }
        setSuccess(errorCodeExpected_ == 0);
      } else {
        setErrorMessage("object not found: " + key_);
        setSuccess(false);
      }
      return;
    }

    if (obj->_type != type_) {
      setErrorMessage("object type error: expected(" + typeString(type_)
                      + ") found(" + typeString(obj->_type) + ")");
      setSuccess(false);
      return;
    }

    if (obj->_data == data_) {
      setSuccess(errorCodeExpected_ == 0);
    } else {
      setErrorMessage("object do not have the same value: expected("
                      + data_ + ") found(" + obj->_data + ")");
      setSuccess(false);
    }
  }
void RequestPictureTask::onGo()
{
	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServicePicture);
	t->setId( client()->sessionID() );
	t->setParam( 1, client()->userId().toLocal8Bit());
	t->setParam( 5, m_target.toLocal8Bit() );
	t->setParam( 13, "1" );
	send( t );
	
	setSuccess();
}
Ejemplo n.º 17
0
bool
KGpgDelKey::nextLine(const QString &line)
{
	if (line.startsWith(QLatin1String("[GNUPG:] KEY_CONSIDERED "))) {
		const QStringList &parts = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
		if (parts.count() < 3) {
			setSuccess(KGpgTransaction::TS_MSG_SEQUENCE);
		} else {
			const QString &fpr = parts[2];
			bool mine = false;

			foreach (const KGpgKeyNode *key, m_keys) {
				mine = (key->getFingerprint() == fpr);
				if (mine)
					break;
			}

			if (!mine)
				setSuccess(KGpgTransaction::TS_MSG_SEQUENCE);
		}
	} else if (!line.startsWith(QLatin1String("[GNUPG:] GOT_IT")))
Ejemplo n.º 18
0
bool PEPPublishTask::take(const QDomElement &x)
{
    if (!iqVerify(x, QString(), id()))
        return false;

    if (x.attribute("type") == "result")
        setSuccess();
    else
        setError(x);

    return true;
}
Ejemplo n.º 19
0
bool
KGpgExport::nextLine(const QString &line)
{
	// key exporting does not send any messages

	m_data.append(line.toLatin1() + '\n');

	if (m_outputmode != 2)
		setSuccess(TS_MSG_SEQUENCE);

	return false;
}
Ejemplo n.º 20
0
void OfflineMessagesTask::endOfMessages()
{
	kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "End of Offline Messages" << endl;
	
	TLV tlv1 = transfer()->buffer()->getTLV();
	Buffer* buffer = new Buffer( tlv1.data, tlv1.length );
	
	buffer->skipBytes( 8 );
	m_sequence = buffer->getLEWord();
	
	deleteOfflineMessages();
	
	setSuccess( true );
}
Ejemplo n.º 21
0
bool RequestTask::take( Transfer * transfer )
{
	if ( forMe( transfer ) )
	{
		client()->debug( "RequestTask::take() - Default take() Accepting transaction ack, taking no further action" );
		Response * response = dynamic_cast<Response *>( transfer );
		if ( response->resultCode() == GroupWise::None )
			setSuccess();
		else
			setError( response->resultCode() );
		return true;
	}
	else
		return false;
}
Ejemplo n.º 22
0
void SSIModifyTask::handleContactAck()
{
	Buffer* b = transfer()->buffer();
	int numItems = b->bytesAvailable() / 2;
	for( int i = 0; i < numItems; ++i )
	{
		Oscar::WORD ackCode = b->getWord();
		kDebug(OSCAR_RAW_DEBUG) << "Acknowledgement code is " << ackCode;
		
		if ( ackCode != 0x0000 )
			freeIdOnError();
		
		switch( ackCode )
		{
		case 0x0000:
			kDebug( OSCAR_RAW_DEBUG ) << "SSI Update successful";
			updateContactManager();
			break;
		case 0x0002:
			kWarning( OSCAR_RAW_DEBUG ) << "Item to modify not found in list";
			setSuccess( 0, QString() );
			break;
		case 0x0003:
			kWarning( OSCAR_RAW_DEBUG ) << "Item already exists in SSI";
			setSuccess( 0, QString() );
			break;
		case 0x000A:
			kWarning( OSCAR_RAW_DEBUG ) << "Error adding item ( invalid id, already in list, invalid data )";
			setSuccess( 0, QString() );
			break;
		case 0x000C:
			kWarning( OSCAR_RAW_DEBUG ) << "Can't add item. Limit exceeded.";
			setSuccess( 0, QString() );
			break;
		case 0x000D:
			kWarning( OSCAR_RAW_DEBUG ) << "Can't add ICQ item to AIM list ( and vice versa )";
			setSuccess( 0, QString() );
			break;
		case 0x000E:
			{
			kWarning( OSCAR_RAW_DEBUG ) << "Can't add item because contact requires authorization";
			OContact groupItem = m_ssiManager->findGroup( m_newItem.gid() );
			QString groupName = groupItem.name();
			addContact( m_newItem.name(), groupName, true );
			go();
			break;
			}
		default:
			kWarning( OSCAR_RAW_DEBUG ) << "Unknown acknowledgement code " << ackCode;
			setSuccess( 0, QString() );
			break;
		}
	};


}
Ejemplo n.º 23
0
// Sets a value of the object to string
int UIOperationEvent::setString(const char* pString)
{
	if (stringValue)
		releaseAllResources();
	stringValue = (char*) allocateResource (sizeof (char), (int)strlen(pString) + 1);
	if (!stringValue)
	{
		valueType = UI_STRING;
		return setError(ERR_MEMORY_ALLOC, SETTING_OPERATION_EVENT);
	}
	strcpy (stringValue, pString);
	length = (int)strlen(stringValue);
	set_value();
	return setSuccess();
}
Ejemplo n.º 24
0
bool RosterItemExchangeTask::take(const QDomElement& e) 
{
	for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) {
		QDomElement i = n.toElement();
		if(i.isNull())
			continue;
		if(i.tagName() == "x" && i.attribute("xmlns") == "http://jabber.org/protocol/rosterx") {
			qDebug("Roster Exchange request with correct attribute");
			Jid from(e.attribute("from"));
			if (client()->roster().find(from,false) == client()->roster().end() && ignoreNonRoster_) {
				qDebug("Invalid roster Exchange request");
				// Send a not-authorized error
				QDomElement iq = createIQ(doc(), "error", e.attribute("from"), e.attribute("id"));
				QDomElement error = doc()->createElement("error");
				error.setAttribute("type","cancel");
				QDomElement notauthorized = doc()->createElement("not-authorized");
				notauthorized.setAttribute("xmlns","urn:ietf:params:xml:ns:xmpp-stanzas");
				error.appendChild(notauthorized);
				iq.appendChild(error);
				send(iq);
				setError(e);
				return true;
			}

			qDebug("Parsing items");
			// Parse all items
			RosterExchangeItems items;
			for(QDomNode m = i.firstChild(); !m.isNull(); m = m.nextSibling()) {
				QDomElement j = m.toElement();
				if(j.isNull())
					continue;
				RosterExchangeItem it(j);
				if (!it.isNull())
					items += it;
			}

			// Return success
			QDomElement iq = createIQ(doc(), "result", e.attribute("from"), e.attribute("id"));
			send(iq);

			emit rosterItemExchange(from,items);
			setSuccess(true);
			qDebug("Succesfully updated roster");
			return true;
		}
	}
	return false;
}
bool ModifyContactListTask::take( Transfer * transfer )
{
	if ( !forMe( transfer ) )
		return false;
	Response * response = dynamic_cast<Response *>( transfer );
	if ( !response )
		return false;
	client()->debug( "ModifyContactListTask::take()" );

	// scan the contact list received
	// emit each add and delete as a signal
	Field::FieldList fl = response->fields();
	fl.dump( true );
	Field::FieldListIterator it = fl.begin();
	Field::FieldListIterator end = fl.end();
	Field::MultiField * current = fl.findMultiField( NM_A_FA_RESULTS );
	if ( current )
		fl = current->fields();
	current = fl.findMultiField( NM_A_FA_CONTACT_LIST );
	if ( current )
	{
		Field::FieldList contactList = current->fields();
		Field::FieldListIterator cursor = contactList.begin();
		const Field::FieldListIterator end = contactList.end();
		while ( cursor != end )
		{
			Field::MultiField * mf = dynamic_cast< Field::MultiField * >( *cursor );
			if ( mf->tag() == NM_A_FA_CONTACT )
			{
				// contact change
				processContactChange( mf );
			}
			else if ( mf->tag() == NM_A_FA_FOLDER )
			{
				// folder change
				processFolderChange( mf );
			}
			++cursor;
		}
	}
	// TODO: call virtual here to read any fields after the contact list...
	if ( response->resultCode() == GroupWise::None )
		setSuccess();
	else 
		setError( response->resultCode() );
	return true;
}
Ejemplo n.º 26
0
bool
KGpgEncrypt::nextLine(const QString &line)
{
    //qDebug() << "KGpgEncrypt::nextLine called";
    const QList<QUrl> &inputFiles = getInputFiles();

	if (line.startsWith(QLatin1String("[GNUPG:] MISSING_PASSPHRASE"))) {
		setSuccess(KGpgTransaction::TS_BAD_PASSPHRASE);
		return true;
	}

	if (!inputFiles.isEmpty()) {
		static const QString encStart = QLatin1String("[GNUPG:] FILE_START 2 ");
		static const QString encDone = QLatin1String("[GNUPG:] FILE_DONE");
		static const QString askName = QLatin1String("[GNUPG:] GET_LINE openfile.askoutname");

		if (line.startsWith(encStart)) {
			m_currentFile = line.mid(encStart.length());
            emit statusMessage(tr("Status message 'Encrypting <filename>' (operation starts)", "Encrypting %1").arg(m_currentFile));
			emit infoProgress(2 * m_fileIndex + 1, inputFiles.count() * 2);
		} else if (line == encDone) {
            emit statusMessage(tr("Status message 'Encrypted <filename>' (operation was completed)", "Encrypted %1").arg(m_currentFile));
			m_fileIndex++;
			emit infoProgress(2 * m_fileIndex, inputFiles.count() * 2);
        } else if (line == askName) {
            qDebug() << "KGpgEncrypt::nextLine - name asked for file...";
        }
// TODO
/*		} else if (line == askName) {
			QPointer<KIO::RenameDialog> over = new KIO::RenameDialog(qobject_cast<QWidget *>(parent()),
					i18n("File Already Exists"), KUrl(),
					KUrl::fromPath(m_currentFile + encryptExtension(m_options.testFlag(AsciiArmored))),
					KIO::M_OVERWRITE);

			if (over->exec() != QDialog::Accepted) {
				delete over;
				setSuccess(KGpgTransaction::TS_USER_ABORTED);
				return true;
            }
			write(over->newDestUrl().path().toUtf8());
            delete over;*/
        //}
	}

	return KGpgTextOrFileTransaction::nextLine(line);
}
Ejemplo n.º 27
0
bool
KGpgExport::preStart()
{
	setSuccess(TS_OK);

	switch (m_outputmode) {
	case ModeFile:
		{
		Q_ASSERT(!m_outf.isEmpty());
		Q_ASSERT(m_outp == Q_NULLPTR);

		addArgument(QLatin1String( "--output" ));
		addArgument(m_outf);

		QFile ofile(m_outf);
		if (ofile.exists())
			ofile.remove();

		break;
		}
	case ModeProcess:
		Q_ASSERT(m_outf.isEmpty());
		Q_ASSERT(m_outp != Q_NULLPTR);

		getProcess()->setStandardOutputProcess(m_outp);

		break;
	case ModeStdout:
		Q_ASSERT(m_outf.isEmpty());
		Q_ASSERT(m_outp == Q_NULLPTR);
		break;
	case ModeTransaction:
		Q_ASSERT(m_outf.isEmpty());
		Q_ASSERT(m_outp == Q_NULLPTR);
		break;
	default:
		Q_ASSERT(0);
	}

	addArguments(m_keyids);

	m_data.clear();

	return true;
}
bool JT_CheckTransportRegistration::take(const QDomElement &elem)
{
	if(!iqVerify(elem, _transport_jid, id()))
		return false;
	
	if(elem.attribute("type") == "result") {
		QDomElement q = queryTag(elem);
		QDomElement registered = q.firstChildElement("registered");
		QDomElement username = q.firstChildElement("username");
		
		_isRegistered = (!registered.isNull());
		_registeredUsername = (_isRegistered ? username.text() : "");
		
		setSuccess(true);
	}
	else {
		setError(elem);
	}
	
	return true;
}
Ejemplo n.º 29
0
bool
KGpgChangeExpire::nextLine(const QString &line)
{
	if (!line.startsWith(QLatin1String("[GNUPG:]")))
		return false;

	if (line.contains(QLatin1String( "GOOD_PASSPHRASE" ))) {
		setSuccess(TS_OK);

		return false;
	} else if (line.contains(QLatin1String( "keygen.valid" ))) {
		if (m_date.isNull())
			write("0");
		else
			write(QByteArray::number(QDate::currentDate().daysTo(m_date.date())));

		return false;
	} else {
		return KGpgEditKeyTransaction::nextLine(line);
	}
}
Ejemplo n.º 30
0
void SendAuthRespTask::onGo()
{
    YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceAuthorization);
    t->setId( client()->sessionID() );
    t->setParam( 1, client()->userId().local8Bit() );
    t->setParam( 5, m_target.local8Bit() );
    if( m_granted )
    {
        t->setParam( 13, 1 );
    }
    else
    {
        t->setParam( 13, 2 );
        t->setParam( 97, 1 );	// UTF
        t->setParam( 14, m_msg.utf8() );

    }
    send( t );

    setSuccess( true );
}