void LeaveConferenceTask::leave( const GroupWise::ConferenceGuid & guid )
{
	Field::FieldList lst, tmp;
	tmp.append( new Field::SingleField( Field::NM_A_SZ_OBJECT_ID, 0, NMFIELD_TYPE_UTF8, guid ) );
	lst.append( new Field::MultiField( Field::NM_A_FA_CONVERSATION, NMFIELD_METHOD_VALID, 0, NMFIELD_TYPE_ARRAY, tmp ) );
	createTransfer( "leaveconf", lst );
}
Esempio n. 2
0
void TransfersDialog::OnbtnAddTransferClick(wxCommandEvent& event)
{
    wxString wxstrId = TextCtrl1->GetValue();       // c
    wxString wxstrDescr = TextCtrl2->GetValue();    // consumption
    //string strId = string(TextCtrl2->GetValue().mb_str(wxConvISO8859_1));
    //string strDescr = string(TextCtrl1->GetValue().mb_str(wxConvISO8859_1));
    wxString wxstrFrom = ddFrom->GetString(ddFrom->GetCurrentSelection());
    wxStringTokenizer tok1(wxstrFrom, _("\t"));
    wxString wxstrFromShort = tok1.GetNextToken();
    wxString wxstrFromLong = tok1.GetNextToken();

    wxString wxstrTo = ddTo->GetString(ddTo->GetCurrentSelection());
    wxStringTokenizer tok2(wxstrTo, _("\t"));
    wxString wxstrToShort = tok2.GetNextToken();
    wxString wxstrToLong= tok2.GetNextToken();
    //wxString wxstrTo = ddTo->GetData(ddTo->GetCurrentSelection());

    string strVar = ws2s(wxstrId);
    string strDescr = ws2s(wxstrDescr);
    string strFrom = ws2s(wxstrFromShort);
    string strTo = ws2s(wxstrToShort);

    // USE CREATETRANSFER FUNCTION AND REMOVE CALL ON GETTRANSFERS

    createTransfer(wxstrToShort, wxstrFromShort, wxstrId, wxstrDescr);

    // Expression::makeToken(strVar); // moved to Transfer::create(...)

    populateList();
    TextCtrl1->Clear();
    TextCtrl2->Clear();
    TextCtrl1->SetFocus();
}
Esempio n. 3
0
void Transfers::addDownloadTransfer(const QString &service, const QString &trackId, const QString &streamId,
                                    const QUrl &streamUrl, const QString &title, const QString &category,
                                    const QString &customCommand, bool customCommandOverrideEnabled) {
    Logger::log(QString("Transfers::addDownloadTransfer(). Service: %1, Track ID: %2, Stream ID: %3, Stream URL: %4, Title: %5, Category: %6, Command: %7").arg(service).arg(trackId).arg(streamId).arg(streamUrl.toString())
                .arg(title).arg(category).arg(customCommand));
    Transfer *transfer = createTransfer(service, this);
    transfer->setNetworkAccessManager(m_nam);
    transfer->setId(Utils::createId());
    transfer->setDownloadPath(Settings::downloadPath() + ".incomplete/" + transfer->id());
    transfer->setFileName(title);
    transfer->setCategory(category);
    transfer->setTrackId(trackId);
    transfer->setStreamId(streamId);
    transfer->setStreamUrl(streamUrl);
    transfer->setTitle(title);
    transfer->setCustomCommand(customCommand);
    transfer->setCustomCommandOverrideEnabled(customCommandOverrideEnabled);
    
    connect(transfer, SIGNAL(statusChanged()), this, SLOT(onTransferStatusChanged()));
    
    m_transfers << transfer;
    emit countChanged(count());
    emit transferAdded(transfer);
    
    if (Settings::startTransfersAutomatically()) {
        transfer->queue();
    }
}
void SSIModifyTask::sendEditEnd()
{
	SNAC editEndSnac = { 0x0013, 0x0012, 0x0000, client()->snacSequence() };
	FLAP editEnd = { 0x02, 0, 10 } ;
	Buffer* emptyBuffer = new Buffer;
	Transfer *t5 = createTransfer( editEnd, editEndSnac, emptyBuffer );
	send( t5 );
}
void SSIModifyTask::sendEditStart()
{
	SNAC editStartSnac = { 0x0013, 0x0011, 0x0000, client()->snacSequence() };
	FLAP editStart = { 0x02, 0, 10 };
	Buffer* emptyBuffer = new Buffer;
	Transfer* t1 = createTransfer( editStart, editStartSnac, emptyBuffer );
	send( t1 );
}
Esempio n. 6
0
void GetStatusTask::userDN( const QString & dn )
{
	m_userDN = dn;
	// set up Transfer
	Field::FieldList lst;
	// changed from USERID to DN as per Gaim/GWIM
	lst.append( new Field::SingleField( NM_A_SZ_DN, 0, NMFIELD_TYPE_UTF8, m_userDN ) );
	createTransfer( "getstatus", lst );
}
void ICBMParamsTask::onGo()
{
	kDebug(OSCAR_RAW_DEBUG) << "Sending ICBM Parameters request";
	FLAP f = { 0x02, 0, 0 };
	SNAC s = { 0x0004, 0x0004, 0x0000, client()->snacSequence() };
	Buffer* buffer = new Buffer();
	Transfer* st = createTransfer( f, s, buffer );
	send( st );
}
void OfflineMessagesTask::deleteOfflineMessages()
{
	FLAP f = { 0x02, 0, 0 };
	SNAC s = { 0x0015, 0x0002, 0x0000, client()->snacSequence() };
	
	
	setRequestType( 0x003E ); //delete offline messages
	setSequence( m_sequence );
	Buffer* buf = addInitialData();
	Transfer* t = createTransfer( f, s, buf );
	send( t );
}
void SendInviteTask::invite( const GroupWise::ConferenceGuid & guid, const QStringList & invitees, const GroupWise::OutgoingMessage & msg)
{
	Field::FieldList lst, tmp;
	tmp.append( new Field::SingleField( Field::NM_A_SZ_OBJECT_ID, 0, NMFIELD_TYPE_UTF8, guid ) );
	lst.append( new Field::MultiField( Field::NM_A_FA_CONVERSATION, NMFIELD_METHOD_VALID, 0, NMFIELD_TYPE_ARRAY, tmp ) );
	QStringList::const_iterator end = invitees.end();
	for ( QStringList::const_iterator it = invitees.begin(); it != end; ++it )
		lst.append( new Field::SingleField( Field::NM_A_SZ_DN, 0, NMFIELD_TYPE_DN, *it ) );
	if ( !msg.message.isEmpty() )
		lst.append( new Field::SingleField( Field::NM_A_SZ_MESSAGE_BODY, 0, NMFIELD_TYPE_UTF8, msg.message ) );
	createTransfer( "sendinvite", lst );
}
void CreateContactInstanceTask::contact( Field::SingleField * id, const QString & displayName, const int parentFolder )
{
	Field::FieldList lst;
	lst.append( new Field::SingleField( Field::NM_A_SZ_PARENT_ID, 0, NMFIELD_TYPE_UTF8, QString::number( parentFolder ) ) );
	// this is either a user Id or a DN
	lst.append( id );
	if ( displayName.isEmpty() ) // fallback so that the contact is created
		lst.append( new Field::SingleField( Field::NM_A_SZ_DISPLAY_NAME, 0, NMFIELD_TYPE_UTF8, m_dn ) );
	else
		lst.append( new Field::SingleField( Field::NM_A_SZ_DISPLAY_NAME, 0, NMFIELD_TYPE_UTF8, displayName ) );
	createTransfer( "createcontact", lst );
}
Esempio n. 11
0
File: segment.cpp Progetto: KDE/kget
bool Segment::startTransfer ()
{
    kDebug(5001) << m_url;
    if (!m_getJob) {
        createTransfer();
    }
    if (m_getJob && (m_status != Running)) {
        setStatus(Running, false);
        m_getJob->resume();
        return true;
    }
    return false;
}
void OfflineMessagesTask::onGo()
{
	kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Requesting offline messages" << endl;
	
	FLAP f = { 0x02, 0, 0 };
	SNAC s = { 0x0015, 0x0002, 0x0000, client()->snacSequence() };
	
	setRequestType( 0x003c ); //offline message request
	setSequence( f.sequence );
	Buffer* buf = addInitialData();
	Transfer* t = createTransfer( f, s, buf );
	send( t );
}
Esempio n. 13
0
void SSIAuthTask::sendAuthReply( const QString& uin, const QString& reason, bool auth )
{
	FLAP f = { 0x02, 0, 0 };
	SNAC s = { 0x0013, 0x001A, 0x0000, client()->snacSequence() };
	
	Buffer* buf = new Buffer();
	buf->addBUIN( uin.latin1() );
	buf->addByte( auth ? 0x01 : 0x00 ); // accepted / declined
	buf->addBSTR( reason.utf8() );
	
	Transfer* t = createTransfer( f, s, buf );
	send( t );
}
Esempio n. 14
0
void SSIAuthTask::grantFutureAuth( const QString& uin, const QString& reason )
{
	FLAP f = { 0x02, 0, 0 };
	SNAC s = { 0x0013, 0x0014, 0x0000, client()->snacSequence() };
	
	Buffer* buf = new Buffer();
	buf->addBUIN( uin.latin1() );
	buf->addBSTR( reason.utf8() );
	buf->addWord( 0x0000 ); // Unknown
	
	Transfer* t = createTransfer( f, s, buf );
	send( t );
}
Esempio n. 15
0
void UserInfoTask::onGo()
{
	if ( m_contactSequenceMap[m_seq].isEmpty() )
	{
		kDebug( OSCAR_RAW_DEBUG ) << "Info requested for empty contact!";
		return;
	}

	FLAP f = { 0x02, 0, 0 };
	SNAC s = { 0x0002, 0x0005, 0, m_seq };
	Buffer* buffer = new Buffer();

	buffer->addWord( m_typesSequenceMap[m_seq] );
	buffer->addBUIN( m_contactSequenceMap[m_seq].toLocal8Bit() );

	Transfer* t = createTransfer( f, s, buffer );
	send( t );
}
Esempio n. 16
0
void SendMessageTask::message( const QStringList & recipientDNList, const OutgoingMessage & msg )
{
	// Assumes the conference is instantiated, unlike Gaim's nm_send_message
	Field::FieldList lst, tmp, msgBodies;
	// list containing GUID
	tmp.append( new Field::SingleField( NM_A_SZ_OBJECT_ID, 0, NMFIELD_TYPE_UTF8, msg.guid ) );
	lst.append( new Field::MultiField( NM_A_FA_CONVERSATION, NMFIELD_METHOD_VALID, 0, NMFIELD_TYPE_ARRAY, tmp ) );
	msgBodies.append( new Field::SingleField( NM_A_SZ_MESSAGE_BODY, 0, NMFIELD_TYPE_UTF8, msg.rtfMessage ) );
	// message body type indicator / separator?
 	msgBodies.append( new Field::SingleField( NM_A_UD_MESSAGE_TYPE, 0, NMFIELD_TYPE_UDWORD, 0 ) );
	// message body plaintext
	msgBodies.append( new Field::SingleField( NM_A_SZ_MESSAGE_TEXT, 0, NMFIELD_TYPE_UTF8, msg.message ) );
	// list containing message bodies
	lst.append( new Field::MultiField( NM_A_FA_MESSAGE, NMFIELD_METHOD_VALID, 0, NMFIELD_TYPE_ARRAY, msgBodies ) );
	// series of participants (may be empty )
	QValueListConstIterator<QString> end = recipientDNList.end();
	for ( QValueListConstIterator<QString> it = recipientDNList.begin(); it != end; ++it )
		lst.append( new Field::SingleField( NM_A_SZ_DN, 0, NMFIELD_TYPE_DN, *it ) );
	createTransfer( "sendmessage", lst );
}
Esempio n. 17
0
void ICBMParamsTask::sendMessageParams( int channel )
{
	kDebug(OSCAR_RAW_DEBUG) << "Sending ICBM parameters for channel " << channel;
	
	FLAP f = { 0x02, 0, 0 };
	SNAC s = { 0x0004, 0x0002, 0x0000, client()->snacSequence() };
	Buffer* buffer = new Buffer();
		
	// the channel for which to set up the parameters
	buffer->addWord( channel );
	
	const Oscar::DWORD OFFLINE_MESSAGES = 0x00000100;
	const Oscar::DWORD RTF_MESSAGES = 0x00000600; // Maybe something more

	//these are all read-write
	// channel-flags
	// bit 1 : messages allowed (always 1 or you cannot send IMs)
	// bit 2 : missed call notifications enabled
	// bit 4 : typing notifications enabled
	if ( channel == 1 )
		buffer->addDWord(0x0000000B | OFFLINE_MESSAGES | RTF_MESSAGES);
	else
		buffer->addDWord(0x00000003);
	
	//max message length (8000 bytes)
	buffer->addWord(0x1f40);
	//max sender warning level (999)
	buffer->addWord(0x03e7);
	//max receiver warning level  (999)
	buffer->addWord(0x03e7);
	//min message interval limit  (0 msec)
	buffer->addWord(0x0000);
	// unknown parameter
	buffer->addWord(0x0000);
	
	Transfer* st = createTransfer( f, s, buffer );
	send( st );
	setSuccess( 0, QString() );
}
void ICQTlvInfoRequestTask::onGo()
{
	kDebug(OSCAR_RAW_DEBUG) << "Requsting full TLV user info for: " << m_userToRequestFor;

	setSequence( client()->snacSequence() );
	setRequestType( 0x07D0 );
	setRequestSubType( 0x0FA0 );

	Buffer b;

	b.startBlock( Buffer::BWord, Buffer::LittleEndian );
	// Magic numbers
	b.addDWord( 0x05b90002 );
	b.addDWord( 0x80000000 );
	b.addDWord( 0x00000006 );
	b.addDWord( 0x00010002 );
	b.addDWord( 0x00020000 );
	b.addDWord( 0x04e20000 );
	b.addWord( 0x0002 );
	b.addWord( m_type );
	b.addDWord( 0x00000001 );

	b.startBlock( Buffer::BWord );
	b.addTLV( 0x003C, m_metaInfoId );
	b.addTLV( 0x0032, m_userToRequestFor.toLatin1() );
	b.endBlock();

	b.endBlock();

	Buffer *sendBuf = addInitialData( &b );

	Oscar::DWORD seq = client()->snacSequence();
	m_contactSequenceMap[seq] = m_userToRequestFor;

	FLAP f = { 0x02, 0, 0 };
	SNAC s = { 0x0015, 0x0002, 0, seq };
	Transfer* t = createTransfer( f, s, sendBuf );
	send( t );
}
Esempio n. 19
0
void SSIModifyTask::sendContactUpdate()
{
	//what type of update are we sending?
	if ( m_opSubject == Group && m_opType == Change )
		changeGroupOnServer();

	//add an item to the ssi list
	if ( m_opType == Add )
	{
		kDebug( OSCAR_RAW_DEBUG ) << "Adding an item to the SSI list";
		sendEditStart();

		//add the item
		FLAP f1 = { 0x02, 0, 0 };
		m_id = client()->snacSequence();
		SNAC s1 = { 0x0013, 0x0008, 0x0000, m_id };
		Buffer* ssiBuffer = new Buffer;
		ssiBuffer->addString( m_newItem );
		Transfer* t2 = createTransfer( f1, s1, ssiBuffer );
		send( t2 );

		sendEditEnd();
	}

	//remove an item
	if ( m_opType == Remove )
	{
		kDebug(OSCAR_RAW_DEBUG) << "Removing " << m_oldItem.name() << " from SSI";
		sendEditStart();

		//remove the item
		FLAP f1 = { 0x02, 0, 0 };
		m_id = client()->snacSequence();
		SNAC s1 = { 0x0013, 0x000A, 0x0000, m_id };
		Buffer* ssiBuffer = new Buffer;
		ssiBuffer->addString( m_oldItem );
		Transfer* t2 = createTransfer( f1, s1, ssiBuffer );
		send( t2 );

		sendEditEnd();
	}

	//modify an item
	//we use rename for group and change for other items
	if ( m_opType == Rename || ( m_opType == Change && m_opSubject != Group ) )
	{
		kDebug(OSCAR_RAW_DEBUG) << "Modifying the item: " << m_oldItem.toString();
		kDebug(OSCAR_RAW_DEBUG) << "changing it to: " << m_newItem.toString();
		sendEditStart();

		//change the group name
		FLAP f1 = { 0x02, 0, 0 };
		m_id = client()->snacSequence();
		SNAC s1 = { 0x0013, 0x0009, 0x0000, m_id };
		Buffer* ssiBuffer = new Buffer;
		ssiBuffer->addString( m_newItem );
		Transfer* t2 = createTransfer( f1, s1, ssiBuffer );
		send( t2 );

		sendEditEnd();
	}

}
Esempio n. 20
0
void SSIModifyTask::changeGroupOnServer()
{
	kDebug( OSCAR_RAW_DEBUG ) << "Moving a contact from one group to another";

	sendEditStart();

	//remove the old buddy from the list
	FLAP f1 = { 0x02, 0, 0 };
	SNAC s1 = { 0x0013,  0x000A, 0x0000, client()->snacSequence() };
	Buffer* b1 = new Buffer;
	b1->addBSTR( m_oldItem.name().toUtf8() );
	b1->addWord( m_oldItem.gid() );
	b1->addWord( m_oldItem.bid() );
	b1->addWord( m_oldItem.type() );
	b1->addWord( 0 );
	Transfer* t2 = createTransfer( f1, s1, b1 );
	send( t2 );

	//add the buddy to the list with a different group
	FLAP f2 = { 0x02, 0, 0 };
	m_id = client()->snacSequence(); //we don't care about the first ack
	SNAC s2 = { 0x0013, 0x0008, 0x0000, m_id };
	Buffer* b2 = new Buffer;
	addItemToBuffer( m_newItem, b2 );

	Transfer* t3 = createTransfer( f2, s2, b2 );
	send( t3 );

	//find the old group so we can change it's list of buddy ids
	//what a kludge
	OContact oldGroupItem = m_ssiManager->findGroup( m_oldItem.gid() );
	/* not checking the existence of oldGroupItem because if we got here
	   it has to exist */

	//Change the 0x00C8 TLV in the old group item to remove the bid we're
	//moving to a different group
	QList<TLV> list = oldGroupItem.tlvList();
	TLV oldIds = Oscar::findTLV( list, 0x00C8 );
	if ( oldIds.type == 0x00C8 )
	{
		Buffer newTLVData;
		Buffer tlvBuffer( oldIds.data, oldIds.length );
		while ( tlvBuffer.bytesAvailable() != 0 )
		{
			Oscar::WORD id = tlvBuffer.getWord();
			if ( id != m_oldItem.bid() )
				newTLVData.addWord( id );
		}

		TLV newGroupTLV( 0x00C8, newTLVData.length(), newTLVData.buffer() );

		list.removeAll( oldIds );
		list.append( newGroupTLV );
		oldGroupItem.setTLVList( list );
	}


	//Change the 0x00C8 TLV in the new group item to add the bid we're
	//adding to this group
	QList<TLV> list2 = m_groupItem.tlvList();
	TLV oldIds2 = Oscar::findTLV( list2, 0x00C8 );
	TLV newGroupTLV;
	if ( oldIds2.type == 0x00C8 )
	{
		Buffer tlvBuffer( oldIds2.data, oldIds2.length );
		tlvBuffer.addWord( m_newItem.bid() );

		TLV newGroupTLV( 0x00C8, tlvBuffer.length(), tlvBuffer.buffer() );
		list2.removeAll( oldIds );
		list2.append( newGroupTLV );
		m_groupItem.setTLVList( list2 );
	}

	//change the group properties
	FLAP f3 = { 0x02, 0, 0 };
	SNAC s3 = { 0x0013, 0x0009, 0x0000, client()->snacSequence() };
	Buffer* b3 = new Buffer;
	addItemToBuffer( oldGroupItem, b3 );
	addItemToBuffer( m_groupItem, b3 );

	Transfer* t4 = createTransfer( f3, s3, b3 ); //we get no ack from this packet
	send( t4 );

	sendEditEnd();
}