diff options
author | David E. O'Brien <obrien@FreeBSD.org> | 2002-03-15 22:31:36 +0000 |
---|---|---|
committer | David E. O'Brien <obrien@FreeBSD.org> | 2002-03-15 22:31:36 +0000 |
commit | b59b427de9aae4248d4553f0fa7392459da4d569 (patch) | |
tree | 693ffa9f8550a39979813b8156df50d5a6035be5 /misc/bidwatcher | |
parent | cff7fbc2982c702cf9675f74d487cc9a6c342eac (diff) | |
download | ports-b59b427de9aae4248d4553f0fa7392459da4d569.tar.gz ports-b59b427de9aae4248d4553f0fa7392459da4d569.zip |
Notes
Diffstat (limited to 'misc/bidwatcher')
-rw-r--r-- | misc/bidwatcher/files/patch-bidwatcher.cpp | 221 | ||||
-rw-r--r-- | misc/bidwatcher/files/patch-fix-hardcoding.h | 22 | ||||
-rw-r--r-- | misc/bidwatcher/files/patch-netstuff.cpp | 150 |
3 files changed, 393 insertions, 0 deletions
diff --git a/misc/bidwatcher/files/patch-bidwatcher.cpp b/misc/bidwatcher/files/patch-bidwatcher.cpp new file mode 100644 index 000000000000..111ad0304f66 --- /dev/null +++ b/misc/bidwatcher/files/patch-bidwatcher.cpp @@ -0,0 +1,221 @@ +--- bidwatcher.cpp.orig Fri Mar 15 14:15:27 2002 ++++ bidwatcher.cpp Fri Mar 15 14:17:27 2002 +@@ -267,7 +267,7 @@ + char WebPage[200]; + strcpy(bidAmount, maxBid->text() ); + strcpy(bidQuant, maxQuant->text() ); +- strcpy(WebPage, "/aw-cgi/eBayISAPI.dll?MakeBid&item="); ++ strcpy(WebPage, PATH_CGI_MakeBid); + strcat(WebPage, theAuction.ItemNumber); + strcat(WebPage, "&maxbid="); + strcat(WebPage, bidAmount); +@@ -327,7 +327,7 @@ + { + priceLabel->setText("Submitting bid..."); + // now, finalize bid with the key obtained. +- strcpy(WebPage, "/aw-cgi/eBayISAPI.dll?AcceptBid&item="); ++ strcpy(WebPage, PATH_CGI_AcceptBid); + strcat(WebPage, theAuction.ItemNumber); + strcat(WebPage, "&key="); + strcat(WebPage, key); +@@ -838,7 +838,7 @@ + char Buff[5000]; + char Buff2[5000]; + char WebPage[250]; +- strcpy(WebPage, "/aw-cgi/eBayISAPI.dll?ReturnUserEmail" ++ strcpy(WebPage, PATH_CGI_ReturnUserEmail + "&requested="); + strcat(WebPage, name); + strcat(WebPage, "&userid="); +@@ -946,7 +946,7 @@ + else thisMonth = TRUE; + char * homedir = getenv("HOME"); + char fileName[200]; +- MakeFileName(homedir, "/.bidwatcher/snipe", fileName, thisMonth); ++ MakeFileName(homedir, DOT_BIDWATCHER "/snipe", fileName, thisMonth); + fillBlanks(fileName, thisMonth); + } + ///////////////////////////////////////////////////////////////////// +@@ -1033,7 +1033,7 @@ + else thisMonth = TRUE; + char * homedir = getenv("HOME"); + char fileName[200]; +- MakeFileName(homedir, "/.bidwatcher/log", fileName, thisMonth); ++ MakeFileName(homedir, DOT_BIDWATCHER "/log", fileName, thisMonth); + fillBlanks(fileName, thisMonth); + } + /////////////////////////////////////////////////////////////////////////////// +@@ -1227,7 +1227,7 @@ + char fileName[200]; + char * homeDir = getenv("HOME"); + strcpy(fileName, homeDir); +- strcat(fileName, "/.bidwatcher"); ++ strcat(fileName, DOT_BIDWATCHER); + mkdir(fileName, 0700); + ReadaucFile(); + if ( strlen(authID) > 1 ) +@@ -1271,7 +1271,7 @@ + char fileName[200]; + char * homeDir = getenv("HOME"); + strcpy(fileName, homeDir); +- strcat(fileName, "/.bidwatcher/bw.cfg"); ++ strcat(fileName, DOT_BIDWATCHER "/bw.cfg"); + outFile.open(fileName); + if ( outFile ) + { +@@ -1416,7 +1416,7 @@ + { + char * homedir = getenv("HOME"); + char fileName[200]; +- MakeFileName(homedir, "/.bidwatcher/snipe", fileName, TRUE); ++ MakeFileName(homedir, DOT_BIDWATCHER "/snipe", fileName, TRUE); + viewFileWindow->fillBlanks(fileName, TRUE); + viewFileWindow->show(); + } +@@ -1424,7 +1424,7 @@ + { + char * homedir = getenv("HOME"); + char fileName[200]; +- MakeFileName(homedir, "/.bidwatcher/log", fileName, TRUE); ++ MakeFileName(homedir, DOT_BIDWATCHER "/log", fileName, TRUE); + viewEndedWindow->fillBlanks(fileName, TRUE); + viewEndedWindow->show(); + } +@@ -1460,7 +1460,7 @@ + { + strcpy(commandLine, "exec "); + strcat(commandLine, browserPATH); +- strcat(commandLine, " -remote \"openURL(http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item="); ++ strcat(commandLine, " -remote \"openURL(http://cgi.ebay.com" PATH_CGI_ViewItem ); + strcat(commandLine, BidMakeup[choice].ItemNumber); + strcat(commandLine, ",new-window)\""); + system(commandLine); +@@ -1595,7 +1595,7 @@ + } + else if (returnVal == 2) + { +- QMessageBox::about(this,"Error","Can't connect to server."); ++ QMessageBox::about(this,"Error","Can't connect to server to update."); + } + else if ( returnVal != 10 ) + { +@@ -2001,14 +2001,22 @@ + WriteAucFile(); + return; + } ++ else if (returnVal == 2) ++ QMessageBox::about(this,"Error","Connection problem while trying to add item."); + else if ( returnVal == 3 || returnVal == 6 ) + QMessageBox::about(this,"Error","Invalid auction number."); + + else if ( returnVal == 4 ) +- QMessageBox::about(this,"Error","Connection time-out"); ++ QMessageBox::about(this,"Error","Connection time-out while trying to add item."); ++ ++ else if (returnVal == 5) ++ QMessageBox::about(this,"Error","CGI server down while trying to add item."); ++ ++ else if (returnVal == 6) ++ QMessageBox::about(this,"Error","itemNumber is out of bounds while trying to add item."); + + else if ( returnVal != 10 ) +- QMessageBox::about(this,"Error","Can't connect to server."); ++ QMessageBox::about(this,"Error","Can't connect to server to add item."); + + updateInProgress = FALSE; + statLabel->setText(""); +@@ -2261,7 +2269,7 @@ + ifstream inFile; + char * homedir = getenv("HOME"); + strcpy(fileName, homedir); +- strcat(fileName, "/.bidwatcher/bw.cfg"); ++ strcat(fileName, DOT_BIDWATCHER "/bw.cfg"); + inFile.open(fileName, ios::in); + if ( inFile ) + { +@@ -2458,7 +2466,7 @@ + char Buff2[HUGEBUFF]; + char WebPage[200]; + int returnVal; +- strcpy(WebPage, "/aw-cgi/eBayISAPI.dll?MfcISAPICommand=ViewBidItems&userid="); ++ strcpy(WebPage, PATH_CGI_ViewBidItems); + strcat(WebPage, authID); + strcat(WebPage, "&completed=0&all=1&rows=200"); + +@@ -2532,7 +2540,7 @@ + char Buff2[HUGEBUFF]; + char WebPage[200]; + int returnVal; +- strcpy(WebPage, "/aw-cgi/eBayISAPI.dll?ViewListedItems&userid="); ++ strcpy(WebPage, PATH_CGI_ViewListedItems); + strcat(WebPage, authID); + strcat(WebPage, "&completed=0&sort=3&since=-1"); + if ( strlen(authID) < 2 ) return -1; +@@ -2687,7 +2695,7 @@ + //char Buff[MAXBUFF]; + char HtmlBuff[HUGEBUFF]; + char WebPage[80]; +- strcpy(WebPage,"/aw-cgi/eBayISAPI.dll?ViewItem&item="); ++ strcpy(WebPage,PATH_CGI_ViewItem); + strcat(WebPage, NewAuction.ItemNumber); + brightLabel->setPixmap(brightLed); + returnVal = FetchHtml(WebPage,HtmlBuff,theAddress, HUGEBUFF, TIMEOUT); +@@ -2695,7 +2703,12 @@ + if ( returnVal == 10 ) return 10; + else if ( returnVal == 2 ) return 2; + else if ( returnVal == 4 ) return 4; +- else if ( strlen(HtmlBuff) < 1000 ) return 5; ++ else if ( strlen(HtmlBuff) < 1000 ) { ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "BidWatcher::UpdateAuction: [%s]\n", HtmlBuff ); ++#endif ++ return 5; ++ } + else if ( strlen(HtmlBuff) < 5000 ) return 3; + // ok, html grab was a success - now process the html + char Buff[HUGEBUFF]; +@@ -2743,7 +2756,7 @@ + double t1; + + +- strcpy(WebPage, "/aw-cgi/eBayISAPI.dll?TimeShow"); ++ strcpy(WebPage, PATH_CGI_TimeShow); + + // try getting the time several times and pick the minimum time + // difference. This should reduce the variable network delay. +@@ -2916,7 +2929,7 @@ + ofstream reportOut; + char * homedir = getenv("HOME"); + char fileName[200]; +- MakeFileName(homedir, "/.bidwatcher/log", fileName, TRUE); ++ MakeFileName(homedir, DOT_BIDWATCHER "/log", fileName, TRUE); + reportOut.open(fileName, ios::app); + char truncDesc[300]; + strcpy( truncDesc, BidMakeup[index].ItemNumber); +@@ -2946,7 +2959,7 @@ + // now, submit the bid, then check the resulting buffer + // for a message indicating it was successful: + MakeClockTime(timeDiff, startTime); +- strcpy(WebPage, "/aw-cgi/eBayISAPI.dll?AcceptBid&item="); ++ strcpy(WebPage, PATH_CGI_AcceptBid); + strcat(WebPage, BidMakeup[index].ItemNumber); + strcat(WebPage, "&key="); + strcat(WebPage, BidMakeup[index].snipeKey); +@@ -2961,7 +2974,7 @@ + ofstream reportOut; + char * homedir = getenv("HOME"); + char fileName[200]; +- MakeFileName(homedir, "/.bidwatcher/snipe", fileName, TRUE); ++ MakeFileName(homedir, DOT_BIDWATCHER "/snipe", fileName, TRUE); + reportOut.open(fileName, ios::app); + char truncDesc[1024]; + sprintf( truncDesc, "%s $%s %s", +@@ -3037,7 +3050,7 @@ + #if DEBUG_NETWORK + ofstream outFile; + char fileName[200]; +- sprintf( fileName, "%s/.bidwatcher/snipe_fail_%s", ++ sprintf( fileName, "%s" DOT_BIDWATCHER "/snipe_fail_%s", + getenv("HOME"), BidMakeup[index].ItemNumber ); + + outFile.open(fileName); diff --git a/misc/bidwatcher/files/patch-fix-hardcoding.h b/misc/bidwatcher/files/patch-fix-hardcoding.h new file mode 100644 index 000000000000..f6707d47b986 --- /dev/null +++ b/misc/bidwatcher/files/patch-fix-hardcoding.h @@ -0,0 +1,22 @@ +--- /dev/null Fri Mar 15 14:13:05 2002 ++++ fix-hardcoding.h Fri Mar 15 14:14:08 2002 +@@ -0,0 +1,19 @@ ++#ifndef _FIX_HARDCODING_H_ ++#define _FIX_HARDCODING_H_ ++ ++#ifdef NEW_CGI_PATH ++#define PATH_CGI_eBayISAPI "/ws/eBayISAPI.dll?" ++#else ++#define PATH_CGI_eBayISAPI "/aw-cgi/eBayISAPI.dll?" ++#endif ++#define PATH_CGI_TimeShow PATH_CGI_eBayISAPI "TimeShow" ++#define PATH_CGI_ViewItem PATH_CGI_eBayISAPI "ViewItem&item=" ++#define PATH_CGI_MakeBid PATH_CGI_eBayISAPI "MakeBid&item=" ++#define PATH_CGI_AcceptBid PATH_CGI_eBayISAPI "AcceptBid&item=" ++#define PATH_CGI_ViewBidItems PATH_CGI_eBayISAPI "MfcISAPICommand=ViewBidItems&userid=" ++#define PATH_CGI_ViewListedItems PATH_CGI_eBayISAPI "ViewListedItems&userid=" ++#define PATH_CGI_ReturnUserEmail PATH_CGI_eBayISAPI "ReturnUserEmail" ++ ++#define DOT_BIDWATCHER "/.bidwatcher" ++ ++#endif /* _FIX_HARDCODING_H_ */ diff --git a/misc/bidwatcher/files/patch-netstuff.cpp b/misc/bidwatcher/files/patch-netstuff.cpp new file mode 100644 index 000000000000..e6ef7dccd933 --- /dev/null +++ b/misc/bidwatcher/files/patch-netstuff.cpp @@ -0,0 +1,150 @@ +--- netstuff.cpp.orig Fri Jun 15 09:46:35 2001 ++++ netstuff.cpp Fri Mar 15 14:14:36 2002 +@@ -22,6 +22,7 @@ + // + + #include <signal.h> ++#include "fix-hardcoding.h" + + bool cancelPressed; + double avg_load_time = INITIAL_LOAD_TIME; +@@ -69,7 +70,12 @@ + soc_in.sin_port = htons(port); + // socketID = socket(2, SOCK_STREAM, 0); + socketID = socket(AF_INET, SOCK_STREAM, 0); +- if (socketID < 0) return 2; ++ if (socketID < 0) { ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "rawFetchHtml: returning 2\n" ); ++#endif ++ return 2; ++ } + + set_nonblock(socketID); + err = ::connect(socketID, (struct sockaddr *)&soc_in, sizeof (soc_in)); +@@ -90,6 +96,9 @@ + fprintf( stderr, "connection timed out\n" ); + #endif + CloseSocket(socketID); ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "rawFetchHtml: returning 4\n" ); ++#endif + return 4; + } + } +@@ -101,6 +110,9 @@ + err, errno, strerror( errno ) ); + #endif + CloseSocket(socketID); ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "rawFetchHtml: returning 2\n" ); ++#endif + return 2; + } + } +@@ -127,6 +139,9 @@ + err, errno, strerror( errno ) ); + #endif + CloseSocket(socketID); ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "rawFetchHtml: returning 2\n" ); ++#endif + return 2; + } + +@@ -140,6 +155,9 @@ + errno, strerror( errno ) ); + #endif + CloseSocket(socketID); ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "rawFetchHtml: returning 2\n" ); ++#endif + return 2; + } + +@@ -151,7 +169,14 @@ + time_since_pkt.start(); + while ( goodcall ) + { +- if ( cancelPressed ) return 10; ++ if ( cancelPressed ) ++ { ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "user cancelPressed, aborting FetchHtml\n." ); ++ fprintf( stderr, "rawFetchHtml: returning 10\n" ); ++#endif ++ return 10; ++ } + if ( counter == 5 ) + { + counter = 0; +@@ -159,12 +184,18 @@ + if ( time_since_start.elapsed() > timeOut ) + { + CloseSocket(socketID); ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "rawFetchHtml: returning 4\n" ); ++#endif + return 4; + } + + if ( time_since_pkt.elapsed() > timeOut/2 ) + { + CloseSocket(socketID); ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "rawFetchHtml: returning 4\n" ); ++#endif + return 4; + } + } +@@ -201,7 +232,16 @@ + // there is a slight chance that the web page was _exactly the + // same size as the buffer, so we will fix that: + Buff[sizeOfBuff - 1] = '\0'; +- if ( !goodcall ) return 2; ++ if ( !goodcall ) { ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "rawFetchHtml: returning 2\n" ); ++#endif ++ return 2; ++ } ++ ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "rawFetchHtml: returning 1\n" ); ++#endif + return 1; + } + +@@ -264,9 +304,9 @@ + + if( err != 1 || i != 0 ) + { +- if( strncmp( WebPage, "/aw-cgi/eBayISAPI.dll?", +- sizeof( "/aw-cgi/eBayISAPI.dll?" ) - 1 ) == 0 ) +- page_start = WebPage + sizeof( "/aw-cgi/eBayISAPI.dll?" ) - 1; ++ if( strncmp( WebPage, PATH_CGI_eBayISAPI, ++ sizeof( PATH_CGI_eBayISAPI ) - 1 ) == 0 ) ++ page_start = WebPage + sizeof( PATH_CGI_eBayISAPI ) - 1; + else + page_start = WebPage; + +@@ -296,6 +336,9 @@ + default: + case 1: + case 10: ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "FetchHtml: returning 1 or 10 - (%d)\n", err ); ++#endif + return err; + break; + +@@ -315,6 +358,9 @@ + fprintf( stderr, "!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!--\n\n" ); + #endif + ++#ifdef DEBUG_NETWORK ++ fprintf( stderr, "FetchHtml: returning (%d)\n",err); ++#endif + return err; + } + |