summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index bb46dd7..ca9851c 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -413,34 +413,36 @@ void WellenreiterMainWindow::uploadSession()
413 } 413 }
414 414
415 qDebug( "Starting upload..." ); 415 qDebug( "Starting upload..." );
416 416
417 struct sockaddr_in raddr; 417 struct sockaddr_in raddr;
418 struct hostent *rhost_info; 418 struct hostent *rhost_info;
419 int sock = -1; 419 int sock = -1;
420 bool ok = false; 420 bool ok = false;
421 421
422 rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); 422 rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname );
423 if ( rhost_info ) 423 if ( rhost_info )
424 { 424 {
425 if ( !QFile::exists( "/var/log/dump.wellenreiter" ) ) 425
426
427 if ( !QFile::exists( mw->captureFileName() ) )
426 { 428 {
427 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile doesn't exist</p>") ); 429 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile '%1' doesn't exist</p>").arg( mw->captureFileName() ) );
428 return; 430 return;
429 } 431 }
430 432
431 QFile f( "/var/log/dump.wellenreiter" ); 433 QFile f( mw->captureFileName() );
432 if ( !f.open( IO_ReadOnly ) ) 434 if ( !f.open( IO_ReadOnly ) )
433 { 435 {
434 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile</p>") ); 436 QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile '%1'</p>").arg( mw->captureFileName() ) );
435 return; 437 return;
436 } 438 }
437 439
438 int content_length = f.size(); 440 int content_length = f.size();
439 441
440 ::memset( &raddr, 0, sizeof (struct sockaddr_in) ); 442 ::memset( &raddr, 0, sizeof (struct sockaddr_in) );
441 ::memcpy( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); 443 ::memcpy( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length );
442 raddr.sin_family = rhost_info-> h_addrtype; 444 raddr.sin_family = rhost_info-> h_addrtype;
443 raddr.sin_port = htons ( 80 ); 445 raddr.sin_port = htons ( 80 );
444 446
445 sock = ::socket( AF_INET, SOCK_STREAM, 0 ); 447 sock = ::socket( AF_INET, SOCK_STREAM, 0 );
446 448
@@ -472,34 +474,35 @@ void WellenreiterMainWindow::uploadSession()
472 "Content-Disposition: form-data; name=\"Name\"\r\n" 474 "Content-Disposition: form-data; name=\"Name\"\r\n"
473 "\r\n" 475 "\r\n"
474 "%1\r\n" 476 "%1\r\n"
475 "-----------------------------97267758015830030481215568065\r\n" 477 "-----------------------------97267758015830030481215568065\r\n"
476 "Content-Disposition: form-data; name=\"Location\"\r\n" 478 "Content-Disposition: form-data; name=\"Location\"\r\n"
477 "\r\n" 479 "\r\n"
478 "%2\r\n" 480 "%2\r\n"
479 "-----------------------------97267758015830030481215568065\r\n" 481 "-----------------------------97267758015830030481215568065\r\n"
480 "Content-Disposition: form-data; name=\"Comments\"\r\n" 482 "Content-Disposition: form-data; name=\"Comments\"\r\n"
481 "\r\n" 483 "\r\n"
482 "%3\r\n" 484 "%3\r\n"
483 "-----------------------------97267758015830030481215568065\r\n" 485 "-----------------------------97267758015830030481215568065\r\n"
484 "Content-Disposition: form-data; name=\"upfile\"; filename=\"/var/log/dump.wellenreiter\"\r\n" 486 "Content-Disposition: form-data; name=\"upfile\"; filename=\"%4\"\r\n"
485 "Content-Type: application/octet-stream\r\n" 487 "Content-Type: application/octet-stream\r\n"
486 "\r\n"; 488 "\r\n";
487 489
488 preambel = "" 490 preambel = ""
489 "\r\n-----------------------------97267758015830030481215568065--\r\n"; 491 "\r\n-----------------------------97267758015830030481215568065--\r\n";
490 492
491 content = content.arg( from->text().isEmpty() ? QString( "Anonymous Wellenreiter II User" ) : from->text() ); 493 content = content.arg( from->text().isEmpty() ? QString( "Anonymous Wellenreiter II User" ) : from->text() );
492 content = content.arg( location->text().isEmpty() ? QString( "Anonymous Wellenreiter II Location" ) : location->text() ); 494 content = content.arg( location->text().isEmpty() ? QString( "Anonymous Wellenreiter II Location" ) : location->text() );
493 content = content.arg( comments->text().isEmpty() ? QString( "Anonymous Wellenreiter II Comments" ) : comments->text() ); 495 content = content.arg( comments->text().isEmpty() ? QString( "Anonymous Wellenreiter II Comments" ) : comments->text() );
496 content = content.arg( mw->captureFileName() );
494 497
495 header = header.arg( QString::number( content.length() + f.size() + preambel.length() ) ); 498 header = header.arg( QString::number( content.length() + f.size() + preambel.length() ) );
496 499
497 // write header 500 // write header
498 501
499 const char* ascii = header.latin1(); 502 const char* ascii = header.latin1();
500 uint ascii_len = ::strlen( ascii ); 503 uint ascii_len = ::strlen( ascii );
501 ::write ( sock, ascii, ascii_len ); 504 ::write ( sock, ascii, ascii_len );
502 505
503 // write fixed content 506 // write fixed content
504 507
505 ascii = content.latin1(); 508 ascii = content.latin1();