You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(46) |
Nov
(13) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(26) |
Feb
(4) |
Mar
(1) |
Apr
(1) |
May
(26) |
Jun
(3) |
Jul
(11) |
Aug
(32) |
Sep
(15) |
Oct
(25) |
Nov
(13) |
Dec
(19) |
2004 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
(31) |
May
|
Jun
(5) |
Jul
(9) |
Aug
(18) |
Sep
(10) |
Oct
(4) |
Nov
(2) |
Dec
|
2005 |
Jan
(9) |
Feb
(13) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
(5) |
Apr
(1) |
May
|
Jun
(2) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(7) |
Dec
|
From: Klaus S. <sin...@us...> - 2006-11-27 19:39:59
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25100 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: changed numbering of token to speed up parsing: frequently tokens first Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.75 retrieving revision 1.90.2.76 diff -u -d -r1.90.2.75 -r1.90.2.76 --- helpers.cpp 24 Nov 2006 12:00:04 -0000 1.90.2.75 +++ helpers.cpp 27 Nov 2006 19:39:49 -0000 1.90.2.76 @@ -55,27 +55,26 @@ const char * const CheckPrice="0123456789.$,"; // Characters allowed in a price -const char * const SearchOps[2][21]={{ // new <- old - "Starting bid", // 1 <- 3 - "Quantity", // 2 <- 4 - "Item location", // 3 <- 7 - "High bid", // 4 <- 11 - "This is a ", // 5 <- 13 - "Current bid", // 6 <- 16 - "Starting bid", // 7 <- 17 - "History", // 8 <- 22 - "Winning bid:", // 9 <- 23 - "Winning bidder:", // 10 <- 24 - "Sold for", // 11 <- 25 - "Buyer:", // 13 <- 26 - "Bidding has ended", // 13 <- 27 - "(Approximately", // 14 <- 30 - "Ended:", // 15 <- 31 - "Shipping, payment details and return policy", // 16 <- 32 - "price:", // 17 <- 35 - "Score:", // 18 <- 37 - "Seller:", // 19 <- 38 - "End time:", // 20 <- 39 +const char * const SearchOps[2][20]={{ // new <- new <- old + "(Approximately", // 1 <- 14 <- 30 + "Starting bid", // 2 <- 1 <- 3 + "Shipping, payment details and return policy", // 3 <- 16 <- 32 + "Current bid", // 4 <- 6 <- 16 + "Item location", // 5 <- 3 <- 7 + "Seller:", // 6 <- 19 <- 38 + "Score:", // 7 <- 18 <- 37 + "History", // 8 <- 8 <- 22 + "End time:", // 9 <- 20 <- 39 + "High bid", // 10 <- 4 <- 11 + "price:", // 11 <- 17 <- 35 + "Ended:", // 12 <- 15 <- 31 + "Bidding has ended", // 13 <- 13 <- 27 + "Quantity", // 14 <- 2 <- 4 + "Winning bid:", // 15 <- 9 <- 23 + "Winning bidder:", // 16 <- 10 <- 24 + "This is a ", // 17 <- 5 <- 13 + "Buyer:", // 18 <- 12 <- 26 + "Sold for", // 19 <- 11 <- 25 "*"}, /* eBay Motors */ { "Currently", // 1 @@ -1293,14 +1292,13 @@ case TYPE_EBAYMOTORS: //non-car auctions are the same case TYPE_EBAY: switch (matchedPhrase) { - case 16: // shipping + handling + case 3: // shipping + handling getShipHandling32(streamBuff, LineBuffer.buf(), LineBuffer.size(), Shipping, ShippingCur, sizeof(Shipping) / sizeof(Shipping[0])); break; - case 6: - case 7: - case 9: - case 11: // "Sold for" + case 4: + case 15: + case 19: // "Sold for" if (!bid_flag) { DPRINTF(DLOW, ("LDCB: %s\n", LineBuffer.buf())); if (!parseprice(LineBuffer.buf(), this, FALSE)) @@ -1324,14 +1322,14 @@ } break; - case 1: // Starting bid: EUR 1.99 + case 2: // Starting bid: EUR 1.99 if (!FirstBid && !first_flag) { parseprice(LineBuffer.buf(), this, TRUE); if (!CurrentBid) CurrentBid = FirstBid; } break; - case 14: + case 1: if (!strstr(LineBuffer.buf(), "(Approximately")) break; if (!FirstBid && !first_flag && strnzcmp(LineBuffer.buf(), "(Approximately")) { @@ -1348,7 +1346,7 @@ } break; - case 17: // "price:" + case 11: // "price:" DPRINTF(DLOW, ("This is a BuyItNow\n")); if (!buynow_flag) { buynow_flag = 1; @@ -1381,7 +1379,7 @@ } break; - case 2: // quantity + case 14: // quantity if (!Quantity && !quant_flag) { quant_flag=1; if (strchr(LineBuffer.buf(), ':')) @@ -1428,7 +1426,7 @@ ended_early =1; // if the item has ended it is obviously not endless. break; - case 3: // location + case 5: // location if (!Location[0]) { char *p; if (!strchr(LineBuffer.buf(), ',')) { @@ -1448,7 +1446,7 @@ } } break; - case 20: // "End time:" + case 9: // "End time:" // has 3 possibilities of string: // 1. "End time:10 hours 7 mins" // " (Mar-08-06 12:52:47 PST)" @@ -1467,7 +1465,7 @@ EndsValue = CalcEndsValue(Ends); } break; - case 15: // "Ended:" looks like this: + case 12: // "Ended:" looks like this: // Ended: Nov-16-06 13:43:36 PST if (!Ends[0]) { char *p; @@ -1481,7 +1479,7 @@ isEndless = 0; } break; - case 19: // Seller: + case 6: // Seller: //Line looks currently like this 2006-09-21: "Seller: somename( 55) " if (!Seller[0]) { char *p; @@ -1541,7 +1539,7 @@ STRNZCPY(Feedbackn,"NONE"); } break; - case 18: // Score: + case 7: // Score: // Example: Score: 1762 | 99.9% Positive // Example: Score: Private | 97.0% Positive if (!Feedbackn[0]) { @@ -1598,9 +1596,9 @@ DPRINTF(DLOW, ("Score: Feedbackn= >%s<\n", Feedbackn)); } break; - case 4: // high bidder id - case 10: - case 12: // "Buyer:" + case 10: // high bidder id + case 16: + case 18: // "Buyer:" if (!HighBidder[0]) { char *p; p = strchr(LineBuffer.buf(), ':'); @@ -1654,12 +1652,12 @@ } break; - //case 12: idx=GetLineOfData(idx, 1024, LineBuffer.buf(), Buff); + //case ??: idx=GetLineOfData(idx, 1024, LineBuffer.buf(), Buff); // CheckBadChars(LineBuffer.buf(), CheckPrice); // STRNZCPY(BidInc, LineBuffer.buf()); // break; - case 5: // dutch auction + case 17: // dutch auction if (strncmp(LineBuffer.buf(), "This is a private listing.", 26) == 0) break; streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); |
From: Klaus S. <sin...@us...> - 2006-11-24 12:00:13
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17286 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: beautified location name fixed issue with highbidder rating Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.74 retrieving revision 1.90.2.75 diff -u -d -r1.90.2.74 -r1.90.2.75 --- helpers.cpp 23 Nov 2006 15:03:44 -0000 1.90.2.74 +++ helpers.cpp 24 Nov 2006 12:00:04 -0000 1.90.2.75 @@ -1437,6 +1437,8 @@ } else { p = strchr(LineBuffer.buf(), ':') + 1; } + if (*p == ' ') + p++; STRNZCPY(Location, p); // Dutch Auctions if (Quantity > 1 ) { @@ -1606,8 +1608,11 @@ if (*(p+1) == '\0') { streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); p = LineBuffer.buf(); - } else + } else { p++; + if (*p == ' ') + p++; + } } else { streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); p = LineBuffer.buf(); @@ -1615,29 +1620,34 @@ STRNZCPY(HighBidder, p); /* Don't cut on '('! "(www.grahamcrackers.com)" is a valid ebay account */ - /* strip only "(private)" away */ - p = strstr(HighBidder, "(private)"); - if (p) + /* the rating is now in same line again */ + /* Looks like: High bidder: aldiguru( 0 ) */ + /* Looks like: Buyer: alltrust555( 1704) */ + p = strrchr(HighBidder, '('); + if (p && p < HighBidder+strlen(HighBidder) && p[1]==' ') *p='\0'; - /* remove trailing '(' in name, because its start of the ranking */ - p = HighBidder+strlen(HighBidder)-1; - if (*p == '(') { - *p = '\0'; - } + /* get the R A T I N G */ // Bidder Rate is typicaly in next line, but without leading '(' - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - if (!strchr(LineBuffer.buf(), ')')) streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + if (!strchr(LineBuffer.buf(), ')')) + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); if (!strchr(LineBuffer.buf(), ')')) break; // validity check + p = strrchr(LineBuffer.buf(), '('); + if (!p) { + STRNZCPY(BidderRate, "(parse error)"); + break; + } + p++; // skip leading '(' + if (*p == ' ') + p++; BidderRate[0] = '('; unsigned int count; for (count=1; count < sizeof(BidderRate)-1; count++) { - if (LineBuffer.buf()[count-1] == '\0' || LineBuffer.buf()[count-1] == ')' - || LineBuffer.buf()[count-1] == ' ') + if (p[count-1] == '\0' || p[count-1] == ')' || p[count-1] == ' ') break; - BidderRate[count] = LineBuffer.buf()[count-1]; + BidderRate[count] = p[count-1]; } BidderRate[count] = ')'; BidderRate[count+1] = '\0'; |
From: Klaus S. <sin...@us...> - 2006-11-23 15:03:52
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23001 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: squeezed parser token array: removed unused tokens and functions, renumbered we might go back, if I removed unintended a function to much Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.73 retrieving revision 1.90.2.74 diff -u -d -r1.90.2.73 -r1.90.2.74 --- helpers.cpp 23 Nov 2006 11:27:38 -0000 1.90.2.73 +++ helpers.cpp 23 Nov 2006 15:03:44 -0000 1.90.2.74 @@ -55,49 +55,27 @@ const char * const CheckPrice="0123456789.$,"; // Characters allowed in a price -const char * const SearchOps[2][42]={{ "Starts at", // 1 - "Currently", // 2 - "Starting bid", // 3 - "Quantity", // 4 - "# of bids", // 5 - "Time left", // 6 - "Item location", // 7 - "Started", // 8 - "Ends", // 9 - "Seller (Rating)", // 10 - "High bid", // 11 - "Bid increment", // 12 - "This is a ", // 13 - "Lowest", // 14 - "(Reserve ", // 15 - "Current bid", // 16 - "Starting bid", // 17 - "Seller (rating)", // 18 - "High bidder", // 19 - "Price:", // 20 - "Seller information", // 21 - "History", // 22 - "Winning bid:", // 23 - "Winning bidder:", // 24 - "Sold for", // 25 - "Buyer:", // 26 - "Bidding has ended", // 27 - // for some reason theBuyItNow/Purchase only - // auction have a space in front of "Price". - " Price", // 28 - "Feedback Score:", // 29 - "(Approximately", // 30 - "Ended:", // 31 - "Shipping, payment details and return policy", // 32 - "Shipping Cost Services Available", // 33, newer version of above - " price:", // 34 - "price:", // 35 - "Seller information", // 36 - "Score:", // 37 - "Seller:", // 38 - "End time:", // 39 - "RefreshStarting bid", // 40 - "RefreshCurrent bid", // 41 +const char * const SearchOps[2][21]={{ // new <- old + "Starting bid", // 1 <- 3 + "Quantity", // 2 <- 4 + "Item location", // 3 <- 7 + "High bid", // 4 <- 11 + "This is a ", // 5 <- 13 + "Current bid", // 6 <- 16 + "Starting bid", // 7 <- 17 + "History", // 8 <- 22 + "Winning bid:", // 9 <- 23 + "Winning bidder:", // 10 <- 24 + "Sold for", // 11 <- 25 + "Buyer:", // 13 <- 26 + "Bidding has ended", // 13 <- 27 + "(Approximately", // 14 <- 30 + "Ended:", // 15 <- 31 + "Shipping, payment details and return policy", // 16 <- 32 + "price:", // 17 <- 35 + "Score:", // 18 <- 37 + "Seller:", // 19 <- 38 + "End time:", // 20 <- 39 "*"}, /* eBay Motors */ { "Currently", // 1 @@ -1032,18 +1010,6 @@ return parseprice(auc->currency, auc->BuyitNowPrice, buf); } -static void getShipHandling33(StringBuffer &streamBuff, char *LineData, const int LineDataSize, float ship[], char currency[][10], int num_ship) -{ - for(int i = 0; i < num_ship; i++) { - streamBuff.getline(LineData, LineDataSize, '\n'); - if(strnzcmp(LineData, "Will ship") == 0) break; - if(!parseprice(currency[i], ship[i], LineData)) { - ship[i] = 0; - break; - } - } -} - /* a "Shipping and Handling" line looks currently like this: * Ships to * @@ -1327,23 +1293,14 @@ case TYPE_EBAYMOTORS: //non-car auctions are the same case TYPE_EBAY: switch (matchedPhrase) { - case 33: // shipping + handling - getShipHandling33(streamBuff, LineBuffer.buf(), LineBuffer.size(), Shipping, ShippingCur, sizeof(Shipping) / sizeof(Shipping[0])); - break; - - case 32: // shipping + handling + case 16: // shipping + handling getShipHandling32(streamBuff, LineBuffer.buf(), LineBuffer.size(), Shipping, ShippingCur, sizeof(Shipping) / sizeof(Shipping[0])); break; - case 1: - case 2: // current price - case 14: // "Lowest" -shows up on motorsnotcars - case 16: - case 17: - case 23: - case 25: // "Sold for" - case 40: // "RefreshStarting bid" - case 41: // "RefreshCurrent bid" + case 6: + case 7: + case 9: + case 11: // "Sold for" if (!bid_flag) { DPRINTF(DLOW, ("LDCB: %s\n", LineBuffer.buf())); if (!parseprice(LineBuffer.buf(), this, FALSE)) @@ -1367,14 +1324,14 @@ } break; - case 3: // Starting bid: EUR 1.99 + case 1: // Starting bid: EUR 1.99 if (!FirstBid && !first_flag) { parseprice(LineBuffer.buf(), this, TRUE); if (!CurrentBid) CurrentBid = FirstBid; } break; - case 30: + case 14: if (!strstr(LineBuffer.buf(), "(Approximately")) break; if (!FirstBid && !first_flag && strnzcmp(LineBuffer.buf(), "(Approximately")) { @@ -1391,10 +1348,7 @@ } break; - case 20: // "Price:" - BuyItNow Only. - case 28: // " Price" - case 34: // " price:" - case 35: // "price:" + case 17: // "price:" DPRINTF(DLOW, ("This is a BuyItNow\n")); if (!buynow_flag) { buynow_flag = 1; @@ -1427,7 +1381,7 @@ } break; - case 4: // quantity + case 2: // quantity if (!Quantity && !quant_flag) { quant_flag=1; if (strchr(LineBuffer.buf(), ':')) @@ -1437,8 +1391,7 @@ DPRINTF(DLOW, ("LDBC: %s\n", LineBuffer.buf())); } break; - case 5: // bid count - case 22: + case 8: if (!BidCount) { DPRINTF(DLOW, ("LDBC: %s\n", LineBuffer.buf())); // if instead of the number of bids an item has "Purchases" and @@ -1471,21 +1424,11 @@ DPRINTF(DLOW, ("BidCount: %i\n", BidCount)); } break; - case 6: // time left - if (!TimeLeft[0]) { - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - STRNZCPY(TimeLeft, LineBuffer.buf()); - if (strstr(LineBuffer.buf(), "Auction has ended")) { //DBS - ended_early = 1; //DBS - } - // since there is time left the auction cannot be endless. - } - break; - case 27: // Item has ended + case 13: // Item has ended ended_early =1; // if the item has ended it is obviously not endless. break; - case 7: // location + case 3: // location if (!Location[0]) { char *p; if (!strchr(LineBuffer.buf(), ',')) { @@ -1503,22 +1446,7 @@ } } break; - case 8: // time started - if (!Started[0]) { - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - STRNZCPY(Started, LineBuffer.buf()); - translate_date(Started); - } - break; - case 9: // time ending - if (!Ends[0]) { - //streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - //DPRINTF(DLOW, ("LDE: %s\n", LineBuffer.buf())); - STRNZCPY(Ends, LineBuffer.buf() + strlen("Ends ")); - translate_date(Ends); - EndsValue = CalcEndsValue(Ends); - } - case 39: // "End time:" + case 20: // "End time:" // has 3 possibilities of string: // 1. "End time:10 hours 7 mins" // " (Mar-08-06 12:52:47 PST)" @@ -1537,7 +1465,7 @@ EndsValue = CalcEndsValue(Ends); } break; - case 31: // "Ended:" looks like this: + case 15: // "Ended:" looks like this: // Ended: Nov-16-06 13:43:36 PST if (!Ends[0]) { char *p; @@ -1551,40 +1479,7 @@ isEndless = 0; } break; - case 10: // seller id - case 18: - case 21: - case 36: - if (!Seller[0]) { - unsigned int count; - char *p; - - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - if (*LineBuffer.buf() == '\0') streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - STRNZCPY(Seller, LineBuffer.buf()); - - /* Don't cut on '('! "(www.grahamcrackers.com)" is a valid ebay account */ - /* strip only "(private)" away */ - p = strstr(Seller, "(private)"); - if (p) *p='\0'; - - // Seller Rate is typicaly in next line, but without leading '(' - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - if (!strchr(LineBuffer.buf(), ')')) streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - if (!strchr(LineBuffer.buf(), ')')) - break; // validity check - SellerRate[0] = '('; - for (count=1; count < sizeof(SellerRate)-1; count++) { - if (LineBuffer.buf()[count-1] == '\0' || LineBuffer.buf()[count-1] == ')' - || LineBuffer.buf()[count-1] == ' ') - break; - SellerRate[count] = LineBuffer.buf()[count-1]; - } - SellerRate[count] = ')'; - SellerRate[count+1] = '\0'; - } - break; - case 38: // Seller: + case 19: // Seller: //Line looks currently like this 2006-09-21: "Seller: somename( 55) " if (!Seller[0]) { char *p; @@ -1644,7 +1539,7 @@ STRNZCPY(Feedbackn,"NONE"); } break; - case 37: // Score: + case 18: // Score: // Example: Score: 1762 | 99.9% Positive // Example: Score: Private | 97.0% Positive if (!Feedbackn[0]) { @@ -1701,10 +1596,9 @@ DPRINTF(DLOW, ("Score: Feedbackn= >%s<\n", Feedbackn)); } break; - case 11: // high bidder id - case 19: - case 24: - case 26: // "Buyer:" + case 4: // high bidder id + case 10: + case 12: // "Buyer:" if (!HighBidder[0]) { char *p; p = strchr(LineBuffer.buf(), ':'); @@ -1755,7 +1649,7 @@ // STRNZCPY(BidInc, LineBuffer.buf()); // break; - case 13: // dutch auction + case 5: // dutch auction if (strncmp(LineBuffer.buf(), "This is a private listing.", 26) == 0) break; streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); @@ -1763,59 +1657,13 @@ strcpy(HighBidder, "Dutch Auction"); break; - case 29: // Feedback Score: - if (!Feedbackn[0]) { - char TmpLine[6]; - unsigned int count; - int limit = 0; - int iiii=0; - char *p; - - p = LineBuffer.buf(); - while(!isdigit(*p) && *p) - p++; - if (*p == '\0') { - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - STRNZCPY(Feedbackn, LineBuffer.buf()); - } else { - STRNZCPY(Feedbackn, p); - } - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - - limit = strlen(LineBuffer.buf()); - - for (count=0; count < limit; count++) - { - if (LineBuffer.buf()[count] == ':') { - LineBuffer.buf()[count] = count; // truncate string at first ':' - for (int fb=count+1; fb < limit; fb++) - { - TmpLine[iiii] = LineBuffer.buf()[fb + 1]; - iiii++; - } - } - } - CheckBadChars(Feedbackn,"0123456789"); - if ( strstr(LineBuffer.buf(),"Feedback") != NULL) { - int a1=6, c1=strlen(Feedbackn); - while (c1 < a1) { /* adds spaces */ - strcat(Feedbackn, " "); - c1++; - } - strcat(Feedbackn,TmpLine); - } else { - CheckBadChars(Feedbackn,"123456789"); - STRNZCPY(Feedbackn,"NONE"); - } - } - break; - - - case 15: // reserve auctions +#if 0 + case ??: // reserve auctions if (strstr(LineBuffer.buf(),"Reserve not")) reserveMet = 'n'; else if (strstr(LineBuffer.buf(),"Reserve met")) reserveMet = 'y'; +#endif default:; } @@ -1856,7 +1704,6 @@ STRNZCPY(Seller, LineBuffer.buf()); } break; - case 14: case 4: //High bid if (!HighBidder[0]) { streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); @@ -1887,7 +1734,6 @@ translate_date(Started); } break; - case 12: case 8: //Ends if (!Ends[0]) { streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); |
From: Klaus S. <sin...@us...> - 2006-11-23 11:27:41
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29834 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: changed wrong indenting to become more Unix/GNU style again faster skip, when shipment price is missing in auction fixed wrong dutch auction detection fixed private auction detection (didnt work anymore) Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.72 retrieving revision 1.90.2.73 diff -u -d -r1.90.2.72 -r1.90.2.73 --- helpers.cpp 22 Nov 2006 20:39:19 -0000 1.90.2.72 +++ helpers.cpp 23 Nov 2006 11:27:38 -0000 1.90.2.73 @@ -1093,6 +1093,8 @@ } for(i = 0; i < num_ship; i++) { DPRINTF(DLOW, ("parsing: >%s<\n", LineData)); + if (*LineData == '\0') + break; if(!parseprice(currency[i], ship[i], LineData)) { DPRINTF(DLOW, ("shipment price=%0.2f\n", ship[i])); ship[i] = 0; @@ -1211,21 +1213,20 @@ streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); if ( strstr(LineBuffer.buf(),"Another buyer used Buy It Now to purchase the item immediately") == NULL ){ - scratch = strstr(Buff, "Another buyer used Buy It Now to purchase the item immediately"); - if (scratch != NULL) { - if (strlen(Comments) > 0) { - if ( strstr(Comments, "Sold! BuyitNow") == NULL) { - strcpy(scratch,"Sold! BuyitNow "); - strcat(scratch,Comments); - strcpy(Comments,scratch); - } - } - else - { - if ( strstr(Comments, "Sold! BuyitNow") == NULL) strcpy(Comments, "Sold! BuyitNow"); - } + scratch = strstr(Buff, "Another buyer used Buy It Now to purchase the item immediately"); + if (scratch != NULL) { + if (strlen(Comments) > 0) { + if ( strstr(Comments, "Sold! BuyitNow") == NULL) { + strcpy(scratch,"Sold! BuyitNow "); + strcat(scratch,Comments); + strcpy(Comments,scratch); } - } + } else { + if ( strstr(Comments, "Sold! BuyitNow") == NULL) + strcpy(Comments, "Sold! BuyitNow"); + } + } + } if ( strstr(LineBuffer.buf(),"Auction ended early with Buy It Now") == NULL ){ scratch = strstr(Buff, "Auction ended early with Buy It Now"); @@ -1236,10 +1237,9 @@ strcat(scratch,Comments); strcpy(Comments,scratch); } - } - else - { - if ( strstr(Comments, "Sold! BuyitNow") == NULL) strcpy(Comments, "Sold! BuyitNow"); + } else { + if ( strstr(Comments, "Sold! BuyitNow") == NULL) + strcpy(Comments, "Sold! BuyitNow"); } } } @@ -1274,27 +1274,30 @@ scratch = strstr(Buff, "price:"); if (scratch != NULL) { scratch = strstr(Buff, "is the winner"); - if (scratch != NULL) isBuyitNow = 0; - else isBuyitNow = 1; + if (scratch != NULL) + isBuyitNow = 0; + else + isBuyitNow = 1; } } if (auc_type == TYPE_EBAYMOTORSCAR) { - scratch = strstr(Buff, "Current bid"); - if (scratch != NULL) { - scratch = strstr(Buff, "Starting bid"); + scratch = strstr(Buff, "Current bid"); if (scratch != NULL) { - // This is totally crazy and will break as soon as they muck with - // the html but it works for now to distinguish a Car auction from - // a part or accessory. Anyone want to offer a better suggestion? + scratch = strstr(Buff, "Starting bid"); + if (scratch != NULL) { + // This is totally crazy and will break as soon as they muck with + // the html but it works for now to distinguish a Car auction from + // a part or accessory. Anyone want to offer a better suggestion? - //Should move us ahead to a $. This check is here to make sure - //we aren't looking at something the seller said in his desc etc. - scratch +=16; + //Should move us ahead to a $. This check is here to make sure + //we aren't looking at something the seller said in his desc etc. + scratch +=16; - if (scratch[0] == '$') auc_type = TYPE_EBAYMOTORS; + if (scratch[0] == '$') + auc_type = TYPE_EBAYMOTORS; + } } } - } DPRINTF(DHIGH, ("Auction Type=%i\n", auc_type)); AuctionType = auc_type; @@ -1393,45 +1396,47 @@ case 34: // " price:" case 35: // "price:" DPRINTF(DLOW, ("This is a BuyItNow\n")); - if (!buynow_flag) { - buynow_flag = 1; + if (!buynow_flag) { + buynow_flag = 1; - int limit = strlen(LineBuffer.buf()); + int limit = strlen (LineBuffer.buf ()); - if ( limit < 7 ) { - strcpy(LineBuffertmp,LineBuffer.buf()); - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - strcat(LineBuffertmp,LineBuffer.buf()); - strcpy(LineBuffer.buf(),LineBuffertmp); - } + if (limit < 7) { + strcpy (LineBuffertmp, LineBuffer.buf ()); + streamBuff.getline (LineBuffer.buf (), LineBuffer.size (), '\n'); + strcat (LineBuffertmp, LineBuffer.buf ()); + strcpy (LineBuffer.buf (), LineBuffertmp); + } - scratch = strstr(LineBuffer.buf(), ":"); - if (*(scratch+1) == '\n') - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - //strcpy(LineBuffer.buf(),scratch); - parseprice2(scratch, this, FALSE); - if (!CurrentBid ) { - parseprice(scratch, this, TRUE); - } - if (!BidCount) { - if (!CurrentBid) CurrentBid = BuyitNowPrice; - strcpy(BidderRate, "(0)"); - FirstBid = CurrentBid; - if (has_ended_flag == 0 && !bid_flag) isEndless = 1; - } - } + scratch = strstr (LineBuffer.buf (), ":"); + if (*(scratch + 1) == '\n') + streamBuff.getline (LineBuffer.buf (), LineBuffer.size (), '\n'); + //strcpy(LineBuffer.buf(),scratch); + parseprice2 (scratch, this, FALSE); + if (!CurrentBid) { + parseprice (scratch, this, TRUE); + } + if (!BidCount) { + if (!CurrentBid) + CurrentBid = BuyitNowPrice; + strcpy (BidderRate, "(0)"); + FirstBid = CurrentBid; + if (has_ended_flag == 0 && !bid_flag) + isEndless = 1; + } + } break; case 4: // quantity if (!Quantity && !quant_flag) { - quant_flag=1; - if (strchr(LineBuffer.buf(), ':')) streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + quant_flag=1; + if (strchr(LineBuffer.buf(), ':')) + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); CheckBadChars(LineBuffer.buf(), "0123456789"); Quantity = atoi(LineBuffer.buf()); - DPRINTF(DLOW, ("LDBC: %s\n", LineBuffer.buf())); + DPRINTF(DLOW, ("LDBC: %s\n", LineBuffer.buf())); } break; - case 5: // bid count case 22: if (!BidCount) { @@ -1439,33 +1444,32 @@ // if instead of the number of bids an item has "Purchases" and // there was no time left in the auction the auction is not endless - int limit = strlen(LineBuffer.buf()); + int limit = strlen(LineBuffer.buf()); - if ( limit < 9 ) { - strcpy(LineBuffertmp,LineBuffer.buf()); - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - strcat(LineBuffertmp,LineBuffer.buf()); - strcpy(LineBuffer.buf(),LineBuffertmp); - } - scratch = strchr(LineBuffer.buf(), ':'); - if(scratch) { - int limit = strlen(scratch); - for ( int i=0; i < limit; i++ ) - { - // strip the ':' off the currentBid; - scratch[i] = scratch[i + 1]; - } - BidCount = atoi(scratch); - if (!BidCount) { - FirstBid = CurrentBid; - strcpy(HighBidder, "--"); - strcpy(BidderRate, "(0)"); - } - } else { - fprintf(stderr, "cannot determine BidCount: propably parser broken\n"); - } - DPRINTF(DLOW, ("BidCount: %i\n", BidCount)); + if ( limit < 9 ) { + strcpy(LineBuffertmp,LineBuffer.buf()); + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + strcat(LineBuffertmp,LineBuffer.buf()); + strcpy(LineBuffer.buf(),LineBuffertmp); } + scratch = strchr(LineBuffer.buf(), ':'); + if(scratch) { + int limit = strlen(scratch); + for ( int i=0; i < limit; i++ ) { + // strip the ':' off the currentBid; + scratch[i] = scratch[i + 1]; + } + BidCount = atoi(scratch); + if (!BidCount) { + FirstBid = CurrentBid; + strcpy(HighBidder, "--"); + strcpy(BidderRate, "(0)"); + } + } else { + fprintf(stderr, "cannot determine BidCount: propably parser broken\n"); + } + DPRINTF(DLOW, ("BidCount: %i\n", BidCount)); + } break; case 6: // time left if (!TimeLeft[0]) { @@ -1719,7 +1723,8 @@ /* Don't cut on '('! "(www.grahamcrackers.com)" is a valid ebay account */ /* strip only "(private)" away */ p = strstr(HighBidder, "(private)"); - if (p) *p='\0'; + if (p) + *p='\0'; /* remove trailing '(' in name, because its start of the ranking */ p = HighBidder+strlen(HighBidder)-1; if (*p == '(') { @@ -1751,6 +1756,8 @@ // break; case 13: // dutch auction + if (strncmp(LineBuffer.buf(), "This is a private listing.", 26) == 0) + break; streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); if (!strcmp(LineBuffer.buf(), "Dutch Auction")) strcpy(HighBidder, "Dutch Auction"); @@ -1936,14 +1943,16 @@ if(!buynow_flag) { isBuyitNow = 0; BuyitNowPrice = 0; + } +DPRINTF(DLOW, ("HighBidder: >%s< >%s<\n", HighBidder, BidderRate)); if (buynow_flag || (!strcmp(HighBidder, "Dutch Auction")) || (!strcmp(HighBidder, "see Dutch high bidders")) || (!strcmp(HighBidder, "--"))) { return TRUE; - } else if (!strcmp(HighBidder, "User ID kept private")) { + } else if (!strcmp(HighBidder, " User ID kept private ")) { strcpy(HighBidder, "private"); // it's nicer to have this text in log return TRUE; } else { |
From: Klaus S. <sin...@us...> - 2006-11-23 11:24:32
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29264 Modified Files: Tag: STABLE_1_3 bidwatcher.cpp Log Message: compiler issue: price of 0.0 is sometimes not correct detected Index: bidwatcher.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/bidwatcher.cpp,v retrieving revision 1.171.2.69 retrieving revision 1.171.2.70 diff -u -d -r1.171.2.69 -r1.171.2.70 --- bidwatcher.cpp 11 Mar 2006 23:48:34 -0000 1.171.2.69 +++ bidwatcher.cpp 23 Nov 2006 11:24:22 -0000 1.171.2.70 @@ -3992,16 +3992,16 @@ } char buynow[40]; - if(auction->BuyitNowPrice > 0) { + if(auction->BuyitNowPrice > 0.00001) { sprintf(buynow, "%s%.2f", auction->currency, auction->BuyitNowPrice); } - if(auction->BuyitNowPrice > 0 && auction->CurrentBid > 0 && auction->BuyitNowPrice > auction->CurrentBid) { + if(auction->BuyitNowPrice > 0.00001 && auction->CurrentBid > 0 && auction->BuyitNowPrice > auction->CurrentBid) { sprintf(price, "%s / %s", curbid, buynow); return; } - if(auction->BuyitNowPrice > 0) { + if(auction->BuyitNowPrice > 0.00001) { if (is_dutch) { sprintf(price, "%s(D,B)", buynow); }else{ |
From: Klaus S. <sin...@us...> - 2006-11-22 20:39:23
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23946 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: fixed tokens (and parsing): "First bid", "Ended", and Shipment Price(s) fixed parsing problems Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.71 retrieving revision 1.90.2.72 diff -u -d -r1.90.2.71 -r1.90.2.72 --- helpers.cpp 20 Nov 2006 18:34:11 -0000 1.90.2.71 +++ helpers.cpp 22 Nov 2006 20:39:19 -0000 1.90.2.72 @@ -57,7 +57,7 @@ const char * const SearchOps[2][42]={{ "Starts at", // 1 "Currently", // 2 - "First bid", // 3 + "Starting bid", // 3 "Quantity", // 4 "# of bids", // 5 "Time left", // 6 @@ -86,9 +86,9 @@ // auction have a space in front of "Price". " Price", // 28 "Feedback Score:", // 29 - "(", // 30 + "(Approximately", // 30 "Ended:", // 31 - "Shipping and handling:", // 32 + "Shipping, payment details and return policy", // 32 "Shipping Cost Services Available", // 33, newer version of above " price:", // 34 "price:", // 35 @@ -388,25 +388,36 @@ c = stringToStrip[u]; if (c == '<') { IncludeFlag=5; - if(u+3<buffLength) { - if (stringToStrip[u+1] == 't' && \ - stringToStrip[u+2] == 'r' && \ - stringToStrip[u+3] == '>') { + if(u+4<buffLength) { + if (stringToStrip[u+1] == '/' && + stringToStrip[u+2] == 't' && + stringToStrip[u+3] == 'r' && + stringToStrip[u+4] == '>') { Buff[BuffIdx++] = '\n'; - u+=2; - } else if (stringToStrip[u+1] == 't' && \ - stringToStrip[u+2] == 'd' && \ - stringToStrip[u+3] == '>' && - BuffIdx > 0 && !isspace(Buff[BuffIdx - 1])) { + IncludeFlag=10; + u+=4; + } else if (stringToStrip[u+1] == 't' && + stringToStrip[u+2] == 'r' && + stringToStrip[u+3] == '>') { + Buff[BuffIdx++] = '\n'; + IncludeFlag=10; + u+=3; + } else if (stringToStrip[u+1] == '/' && + stringToStrip[u+2] == 't' && + stringToStrip[u+3] == 'd' && + stringToStrip[u+4] == '>' + && BuffIdx > 0 && !isspace(Buff[BuffIdx - 1])) { Buff[BuffIdx++] = ' '; - u+=2; - } else if (stringToStrip[u+1] == 'b' && \ - stringToStrip[u+2] == 'r' && \ + IncludeFlag=10; + u+=4; + } else if (stringToStrip[u+1] == 'b' && + stringToStrip[u+2] == 'r' && stringToStrip[u+3] == '>') { Buff[BuffIdx++] = '\n'; - u+=2; - } else if (stringToStrip[u+1] == '!' && \ - stringToStrip[u+2] == '-' && \ + IncludeFlag=10; + u+=3; + } else if (stringToStrip[u+1] == '!' && + stringToStrip[u+2] == '-' && stringToStrip[u+3] == '-') { IncludeFlag=2; u+=3; @@ -1033,23 +1044,63 @@ } } +/* a "Shipping and Handling" line looks currently like this: + * Ships to + * + * European Union + * + * Country: + * Show all available + * + * Shipping and HandlingToService + * + * EUR 6.50 + * Germany Versicherter Versand + * + * EUR 13.90 + * Germany Nachnahme (Versand inkl. Nachnahmegebühr) + * + * EUR 20.00 + * Austria Versicherter Versand + * + * Country: + * Show all available + * ... + */ + static void getShipHandling32(StringBuffer &streamBuff, char *LineData, const int LineDataSize, float ship[], char currency[][10], int num_ship) { - for(int i = 0; i < num_ship; i++) { - streamBuff.getline(LineData, LineDataSize, '\n'); - for(int j = 0; j < 10 && LineData[0] == 0; j++) { - streamBuff.getline(LineData, 1024, '\n'); - } - if(strnzcmp(LineData, "Will ship") == 0) break; - if(!strchr(LineData, ':')) break; - - streamBuff.getline(LineData, 1024, '\n'); - if(strnzcmp(LineData, "Will ship") == 0) break; - + int i; + // Skip line: Shipping, payment details and return policy + // Skip line: <<empty line>> + // Skip line: <<empty line>> + // Skip line: <<empty line>> + // Skip line: Ships to + // Skip line: <<empty line>> + // Skip line: <<the Country>> + // Skip line: <<empty line>> + // Skip line: <<empty line>> + // Skip line: <<empty line>> + // Skip line: Country: + // Skip line: Show all available + // Skip line: <<empty line>> + // Skip line: <<empty line>> + // Skip line: <<empty line>> + // Skip line: Shipping and HandlingToService + // Skip line: <<empty line>> + for (i = 0; i<17; i++) { + streamBuff.getline(LineData, LineDataSize, '\n'); + } + for(i = 0; i < num_ship; i++) { + DPRINTF(DLOW, ("parsing: >%s<\n", LineData)); if(!parseprice(currency[i], ship[i], LineData)) { + DPRINTF(DLOW, ("shipment price=%0.2f\n", ship[i])); ship[i] = 0; break; } + streamBuff.getline(LineData, LineDataSize, '\n'); + streamBuff.getline(LineData, LineDataSize, '\n'); + streamBuff.getline(LineData, LineDataSize, '\n'); } } @@ -1313,7 +1364,13 @@ } break; - case 3: // first bid + case 3: // Starting bid: EUR 1.99 + if (!FirstBid && !first_flag) { + parseprice(LineBuffer.buf(), this, TRUE); + if (!CurrentBid) + CurrentBid = FirstBid; + } + break; case 30: if (!strstr(LineBuffer.buf(), "(Approximately")) break; @@ -1476,12 +1533,13 @@ EndsValue = CalcEndsValue(Ends); } break; - case 31: // ended + case 31: // "Ended:" looks like this: + // Ended: Nov-16-06 13:43:36 PST if (!Ends[0]) { char *p; //streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); //DPRINTF(DLOW, ("LDE: %s\n", LineBuffer.buf())); - p=strchr(LineBuffer.buf(), ':')+1; + p=strchr(LineBuffer.buf(), ':')+2; STRNZCPY(Ends, p); translate_date(Ends); EndsValue = CalcEndsValue(Ends); |
From: Klaus S. <sin...@us...> - 2006-11-20 18:34:33
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv359 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: new functionality at ebay introduces new token names: Refresh<<something>> Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.70 retrieving revision 1.90.2.71 diff -u -d -r1.90.2.70 -r1.90.2.71 --- helpers.cpp 21 Sep 2006 13:54:58 -0000 1.90.2.70 +++ helpers.cpp 20 Nov 2006 18:34:11 -0000 1.90.2.71 @@ -55,7 +55,7 @@ const char * const CheckPrice="0123456789.$,"; // Characters allowed in a price -const char * const SearchOps[2][40]={{ "Starts at", // 1 +const char * const SearchOps[2][42]={{ "Starts at", // 1 "Currently", // 2 "First bid", // 3 "Quantity", // 4 @@ -96,6 +96,8 @@ "Score:", // 37 "Seller:", // 38 "End time:", // 39 + "RefreshStarting bid", // 40 + "RefreshCurrent bid", // 41 "*"}, /* eBay Motors */ { "Currently", // 1 @@ -1286,6 +1288,8 @@ case 17: case 23: case 25: // "Sold for" + case 40: // "RefreshStarting bid" + case 41: // "RefreshCurrent bid" if (!bid_flag) { DPRINTF(DLOW, ("LDCB: %s\n", LineBuffer.buf())); if (!parseprice(LineBuffer.buf(), this, FALSE)) |
From: Klaus S. <sin...@us...> - 2006-09-21 13:55:10
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15506 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: fixed the SellerRate, necessary through new page layout at ebay Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.69 retrieving revision 1.90.2.70 diff -u -d -r1.90.2.69 -r1.90.2.70 --- helpers.cpp 26 Jul 2006 08:46:38 -0000 1.90.2.69 +++ helpers.cpp 21 Sep 2006 13:54:58 -0000 1.90.2.70 @@ -1519,6 +1519,7 @@ } break; case 38: // Seller: + //Line looks currently like this 2006-09-21: "Seller: somename( 55) " if (!Seller[0]) { char *p; p = strchr(LineBuffer.buf(), ':'); @@ -1530,31 +1531,49 @@ STRNZCPY(Seller, p); /* strip only "(private)" away */ p = strstr(Seller, "(private)"); - if (p) *p='\0'; + if (p) + *p='\0'; - /* remove trailing '(' in name, because its start of the ranking */ - p = Seller+strlen(Seller)-1; - if (*p == '(') { + // remove trailing '(' in name, because its start of the ranking + // assumption that after '(' a space or a digit means is coming, + // means end of seller name is found. + // this fails, if Sellers name is like "abc(123)" and (123) is + // not the ranking, but part of his name + p = strrchr(Seller, '('); + if (p != NULL && (*(p+1) == ' ' || isdigit(*(p+1)))) { *p = '\0'; } + } - // Bidder Rate is typicaly in next line, but without leading '(' - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - if (LineBuffer.buf()[0] == '(' && !strchr(LineBuffer.buf(), ')')) - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - if (!strchr(LineBuffer.buf(), ')')) - break; // validity check - SellerRate[0] = '('; - unsigned int count; - for (count=1; count < sizeof(SellerRate)-1; count++) + if (!SellerRate[0]) { + char *p; + unsigned int src, dst; + + // New changes: 2006-SEP-21 + // Line looks like this: "Seller: somename( 55) " + if (strlen(LineBuffer.buf()) < strlen(Seller) + 10) + break; // validity check + + // don't work on line, work on buffer + // copy related part to SellerRate + p = strrchr(LineBuffer.buf(), '('); + if (p == NULL) { + strcpy(SellerRate, "unknown"); + break; + } + STRNZCPY(SellerRate, p); + + // eliminate spaces in Rating... + // copy bufffer to itself, but skip spaces + for(src=dst=0; src < sizeof(SellerRate) && SellerRate[src]; src++) + { + if (SellerRate[src] != ' ') { - if (LineBuffer.buf()[count-1] == '\0' || LineBuffer.buf()[count-1] == ')' - || LineBuffer.buf()[count-1] == ' ') - break; - SellerRate[count] = LineBuffer.buf()[count-1]; + SellerRate[dst] = SellerRate[src]; + dst++; } - SellerRate[count] = ')'; - SellerRate[count+1] = '\0'; + } + SellerRate[dst] = '\0'; if (!strncmp(SellerRate, "(0)", 4)) STRNZCPY(Feedbackn,"NONE"); } |
From: Klaus S. <sin...@us...> - 2006-07-26 14:42:37
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6553 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: Adapted changes in new eBay layout: HighBidder, Seller and Ends. Added some char codes. Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.68 retrieving revision 1.90.2.69 diff -u -d -r1.90.2.68 -r1.90.2.69 --- helpers.cpp 27 Jun 2006 09:04:01 -0000 1.90.2.68 +++ helpers.cpp 26 Jul 2006 08:46:38 -0000 1.90.2.69 @@ -254,6 +254,8 @@ if (!strcmp(temp, "#174")) return 0xAE; // '®'; if (!strcmp(temp, "#8211") || !strcmp(temp, "#8212") || + !strcmp(temp, "#150") || !strcmp(temp, "#151") || + !strcmp(temp, "#173") || !strcmp(temp, "shy") || !strcmp(temp, "#45")) return '-'; // Unicode "en dash" character if (!strcmp(temp, "szlig")) @@ -1472,9 +1474,11 @@ break; case 31: // ended if (!Ends[0]) { - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + char *p; + //streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); //DPRINTF(DLOW, ("LDE: %s\n", LineBuffer.buf())); - STRNZCPY(Ends, LineBuffer.buf()); + p=strchr(LineBuffer.buf(), ':')+1; + STRNZCPY(Ends, p); translate_date(Ends); EndsValue = CalcEndsValue(Ends); has_ended_flag = 1; @@ -1528,6 +1532,12 @@ p = strstr(Seller, "(private)"); if (p) *p='\0'; + /* remove trailing '(' in name, because its start of the ranking */ + p = Seller+strlen(Seller)-1; + if (*p == '(') { + *p = '\0'; + } + // Bidder Rate is typicaly in next line, but without leading '(' streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); if (LineBuffer.buf()[0] == '(' && !strchr(LineBuffer.buf(), ')')) @@ -1629,6 +1639,11 @@ /* strip only "(private)" away */ p = strstr(HighBidder, "(private)"); if (p) *p='\0'; + /* remove trailing '(' in name, because its start of the ranking */ + p = HighBidder+strlen(HighBidder)-1; + if (*p == '(') { + *p = '\0'; + } // Bidder Rate is typicaly in next line, but without leading '(' streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); |
From: Klaus S. <sin...@us...> - 2006-06-27 09:04:06
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13789 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: fixed hex encoded entities: need to be octal encoded Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.67 retrieving revision 1.90.2.68 diff -u -d -r1.90.2.67 -r1.90.2.68 --- helpers.cpp 27 Jun 2006 08:53:30 -0000 1.90.2.67 +++ helpers.cpp 27 Jun 2006 09:04:01 -0000 1.90.2.68 @@ -273,9 +273,9 @@ if (!strcmp(temp, "gt") || !strcmp(temp, "#62")) return '>'; if (!strcmp(temp, "#8217") || !strcmp(temp, "#146") || - !strcmp(temp, "#B4") || !strcmp(temp, "acute")) + !strcmp(temp, "#180") || !strcmp(temp, "acute")) return '\''; - if (!strcmp(temp, "#A7") || !strcmp(temp, "sect")) + if (!strcmp(temp, "#167") || !strcmp(temp, "sect")) return 0xA7; // '§'; if (!strcmp(temp, "pound")) return 0xA3; // '£'; |
From: Klaus S. <sin...@us...> - 2006-06-27 08:53:37
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8910 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: fixes for: "End time:", "Score:", and added some unknown HTML entities Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.66 retrieving revision 1.90.2.67 diff -u -d -r1.90.2.66 -r1.90.2.67 --- helpers.cpp 5 Apr 2006 11:43:14 -0000 1.90.2.66 +++ helpers.cpp 27 Jun 2006 08:53:30 -0000 1.90.2.67 @@ -253,7 +253,8 @@ return 0xA9; // '©'; if (!strcmp(temp, "#174")) return 0xAE; // '®'; - if (!strcmp(temp, "#8211") || !strcmp(temp, "#8212")) + if (!strcmp(temp, "#8211") || !strcmp(temp, "#8212") || + !strcmp(temp, "#45")) return '-'; // Unicode "en dash" character if (!strcmp(temp, "szlig")) return 223; // sz-ligature @@ -271,12 +272,15 @@ return '<'; if (!strcmp(temp, "gt") || !strcmp(temp, "#62")) return '>'; - if (!strcmp(temp, "#8217") || !strcmp(temp, "#146")) + if (!strcmp(temp, "#8217") || !strcmp(temp, "#146") || + !strcmp(temp, "#B4") || !strcmp(temp, "acute")) return '\''; - if (!strcmp(temp, "deg")) - return 0xB0; // '°'; + if (!strcmp(temp, "#A7") || !strcmp(temp, "sect")) + return 0xA7; // '§'; if (!strcmp(temp, "pound")) return 0xA3; // '£'; + if (!strcmp(temp, "deg")) + return 0xB0; // '°'; if (!strcmp(temp, "plusmn")) return 0xB1; // '±'; if (!strcmp(temp, "micro")) @@ -434,7 +438,7 @@ (Buff[BuffIdx-1] != '\n')) Buff[BuffIdx++] = ' '; else if ((BuffIdx > 0) && (c == ' ') && (Buff[BuffIdx-1] != ' ')) - continue; /* ignore -- crunch multiple spaces */ + continue; /* ignore -- crunch multiple spaces */ else if ((BuffIdx > 0) && (c == '\n') && (Buff[BuffIdx-1] != '\n')) @@ -1280,10 +1284,15 @@ case 17: case 23: case 25: // "Sold for" - if (!bid_flag) { - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + if (!bid_flag) { DPRINTF(DLOW, ("LDCB: %s\n", LineBuffer.buf())); - parseprice(LineBuffer.buf(), this, FALSE); + if (!parseprice(LineBuffer.buf(), this, FALSE)) + { + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + } else { + DPRINTF(DLOW, ("LDCB: %s\n", LineBuffer.buf())); + parseprice(LineBuffer.buf(), this, FALSE); + } bid_flag = 1; isEndless = 0; streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); @@ -1295,7 +1304,7 @@ // Not a reserve auction, put the chars back. for (unsigned int i=0; i<=strlen(LineBuffer.buf()); i++) streamBuff.unget(); - } + } break; case 3: // first bid @@ -1317,9 +1326,9 @@ break; case 20: // "Price:" - BuyItNow Only. - case 28: - case 34: - case 35: + case 28: // " Price" + case 34: // " price:" + case 35: // "price:" DPRINTF(DLOW, ("This is a BuyItNow\n")); if (!buynow_flag) { buynow_flag = 1; @@ -1443,21 +1452,20 @@ EndsValue = CalcEndsValue(Ends); } case 39: // "End time:" - // has 2 possibilities of string: + // has 3 possibilities of string: // 1. "End time:10 hours 7 mins" // " (Mar-08-06 12:52:47 PST)" // 2. "End time:Mar-08-06 12:52:47 PST" // "2 days 10 hours 7 mins" + // 3. "End time:8 hours 23 mins (Jun-27-06 09:26:17 PDT)" if (!Ends[0]) { char *ptr = strchr(LineBuffer.buf(), '-'); - long len = ptr - LineBuffer.buf(); - DPRINTF(DLOW, ("Ends: ptr=%ld, >%s<\n", ptr, LineBuffer.buf())); - if (ptr!=NULL && len<18) { // case: "End time:Apr-02-06 12:24:20 PDT (3 days 9 hours)" - STRNZCPY(Ends, LineBuffer.buf() + strlen("End time:")); - } else { + DPRINTF(DLOW, ("Ends: ptr=%p, >%s<\n", ptr, LineBuffer.buf())); + if (!ptr) { // date in next line streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - STRNZCPY(Ends, LineBuffer.buf()+2); // skip starting 2 chars " (" - } + ptr = strchr(LineBuffer.buf(), '-'); + } + STRNZCPY(Ends, ptr-3); translate_date(Ends); EndsValue = CalcEndsValue(Ends); } @@ -1547,8 +1555,8 @@ if (!Feedbackn[0]) { char TmpLine[6]; unsigned int count=0, f_len=0; - unsigned int limit=0; - unsigned int i=0, j=0; + int limit=0; + int i=0, j=0; char *p; p = strchr(LineBuffer.buf(), ':'); @@ -1582,7 +1590,7 @@ DPRINTF(DLOW, ("Score: p[count+1] is not '|': >%c<, count=%d\n", p[count+1], count)); TmpLine[i] = '\0'; if (i) { - unsigned int a1= 6; //a1 = sizeof(Feedbackn)-strlen(TmpLine)-1; + int a1= 6; //a1 = sizeof(Feedbackn)-strlen(TmpLine)-1; if (f_len < a1) { while (f_len < a1) { /* fills spaces */ Feedbackn[f_len++] = ' '; @@ -1652,46 +1660,52 @@ strcpy(HighBidder, "Dutch Auction"); break; - case 29: if (!Feedbackn[0]) { - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - STRNZCPY(Feedbackn, LineBuffer.buf()); - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - - char TmpLine[6]; - unsigned int count; - int limit = strlen(LineBuffer.buf()); - int iiii=0; - - for (count=0; count < strlen(LineBuffer.buf()); count++) - { - if (LineBuffer.buf()[count] == ':') - { - LineBuffer.buf()[count] = count; // truncate string at first ':' - for (int fb=count+1; fb < limit; fb++) { - TmpLine[iiii] = LineBuffer.buf()[fb + 1]; - iiii++; - } - } - } - CheckBadChars(Feedbackn,"0123456789"); - if ( strstr(LineBuffer.buf(),"Feedback") != NULL) { + case 29: // Feedback Score: + if (!Feedbackn[0]) { + char TmpLine[6]; + unsigned int count; + int limit = 0; + int iiii=0; + char *p; + p = LineBuffer.buf(); + while(!isdigit(*p) && *p) + p++; + if (*p == '\0') { + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + STRNZCPY(Feedbackn, LineBuffer.buf()); + } else { + STRNZCPY(Feedbackn, p); + } + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - int a1=6, c1=strlen(Feedbackn); - while (c1 < a1) { /* adds spaces */ - strcat(Feedbackn, " "); - c1++; - } - strcat(Feedbackn,TmpLine); - } - else - { - CheckBadChars(Feedbackn,"123456789"); - STRNZCPY(Feedbackn,"NONE"); - } - } - break; + limit = strlen(LineBuffer.buf()); + for (count=0; count < limit; count++) + { + if (LineBuffer.buf()[count] == ':') { + LineBuffer.buf()[count] = count; // truncate string at first ':' + for (int fb=count+1; fb < limit; fb++) + { + TmpLine[iiii] = LineBuffer.buf()[fb + 1]; + iiii++; + } + } + } + CheckBadChars(Feedbackn,"0123456789"); + if ( strstr(LineBuffer.buf(),"Feedback") != NULL) { + int a1=6, c1=strlen(Feedbackn); + while (c1 < a1) { /* adds spaces */ + strcat(Feedbackn, " "); + c1++; + } + strcat(Feedbackn,TmpLine); + } else { + CheckBadChars(Feedbackn,"123456789"); + STRNZCPY(Feedbackn,"NONE"); + } + } + break; case 15: // reserve auctions @@ -1784,6 +1798,7 @@ reserveMet = 'n'; else if (strstr(LineBuffer.buf(), "reserve met")) reserveMet = 'y'; + DPRINTF(DHIGH, ("Reserve: %c\n", reserveMet)); default:; break; |
From: Klaus S. <sin...@us...> - 2006-04-05 11:43:30
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7070 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: fixed timezone bug in end time Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.65 retrieving revision 1.90.2.66 diff -u -d -r1.90.2.65 -r1.90.2.66 --- helpers.cpp 25 Mar 2006 11:34:15 -0000 1.90.2.65 +++ helpers.cpp 5 Apr 2006 11:43:14 -0000 1.90.2.66 @@ -433,6 +433,8 @@ (Buff[BuffIdx-1] != ' ') && (Buff[BuffIdx-1] != '\n')) Buff[BuffIdx++] = ' '; + else if ((BuffIdx > 0) && (c == ' ') && (Buff[BuffIdx-1] != ' ')) + continue; /* ignore -- crunch multiple spaces */ else if ((BuffIdx > 0) && (c == '\n') && (Buff[BuffIdx-1] != '\n')) @@ -981,6 +983,8 @@ char *p = strchr(buf, ':'); if(p) buf = p + 1; int len; + while (*buf == ' ') // ignore leading spaces + buf++; if ((buf[0]=='$') || (buf[0]=='U' && buf[1]=='S')) { strcpy(currency, "$"); } else { @@ -1442,10 +1446,13 @@ // has 2 possibilities of string: // 1. "End time:10 hours 7 mins" // " (Mar-08-06 12:52:47 PST)" - // 2. "End time: Mar-08-06 12:52:47 PST" + // 2. "End time:Mar-08-06 12:52:47 PST" // "2 days 10 hours 7 mins" if (!Ends[0]) { - if (strstr(LineBuffer.buf(), " PST ")) { + char *ptr = strchr(LineBuffer.buf(), '-'); + long len = ptr - LineBuffer.buf(); + DPRINTF(DLOW, ("Ends: ptr=%ld, >%s<\n", ptr, LineBuffer.buf())); + if (ptr!=NULL && len<18) { // case: "End time:Apr-02-06 12:24:20 PDT (3 days 9 hours)" STRNZCPY(Ends, LineBuffer.buf() + strlen("End time:")); } else { streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); |
From: Klaus S. <sin...@us...> - 2006-03-25 11:34:28
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13557 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: fixed: changes in eBays layout Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.64 retrieving revision 1.90.2.65 diff -u -d -r1.90.2.64 -r1.90.2.65 --- helpers.cpp 11 Mar 2006 23:57:48 -0000 1.90.2.64 +++ helpers.cpp 25 Mar 2006 11:34:15 -0000 1.90.2.65 @@ -1407,14 +1407,20 @@ break; case 7: // location if (!Location[0]) { - streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - STRNZCPY(Location, LineBuffer.buf()); - // Dutch Auctions - if (Quantity > 1 ) { - strcpy(HighBidder, "Dutch Auction"); - strcpy(BidderRate, ""); - dutch_flag=1; - } + char *p; + if (!strchr(LineBuffer.buf(), ',')) { + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + p = LineBuffer.buf(); + } else { + p = strchr(LineBuffer.buf(), ':') + 1; + } + STRNZCPY(Location, p); + // Dutch Auctions + if (Quantity > 1 ) { + strcpy(HighBidder, "Dutch Auction"); + strcpy(BidderRate, ""); + dutch_flag=1; + } } break; case 8: // time started @@ -1422,7 +1428,6 @@ streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); STRNZCPY(Started, LineBuffer.buf()); translate_date(Started); - } break; case 9: // time ending |
From: Kevin D. <kev...@us...> - 2006-03-11 23:57:52
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25941 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: Fix unsigned int/int comparison errors. Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.63 retrieving revision 1.90.2.64 diff -u -d -r1.90.2.63 -r1.90.2.64 --- helpers.cpp 11 Mar 2006 23:51:18 -0000 1.90.2.63 +++ helpers.cpp 11 Mar 2006 23:57:48 -0000 1.90.2.64 @@ -1535,8 +1535,8 @@ if (!Feedbackn[0]) { char TmpLine[6]; unsigned int count=0, f_len=0; - int limit=0; - int i=0, j=0; + unsigned int limit=0; + unsigned int i=0, j=0; char *p; p = strchr(LineBuffer.buf(), ':'); @@ -1570,7 +1570,7 @@ DPRINTF(DLOW, ("Score: p[count+1] is not '|': >%c<, count=%d\n", p[count+1], count)); TmpLine[i] = '\0'; if (i) { - int a1= 6; //a1 = sizeof(Feedbackn)-strlen(TmpLine)-1; + unsigned int a1= 6; //a1 = sizeof(Feedbackn)-strlen(TmpLine)-1; if (f_len < a1) { while (f_len < a1) { /* fills spaces */ Feedbackn[f_len++] = ' '; |
From: Kevin D. <kev...@us...> - 2006-03-11 23:51:30
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22254 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: Apply Klaus' description patch. Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.62 retrieving revision 1.90.2.63 diff -u -d -r1.90.2.62 -r1.90.2.63 --- helpers.cpp 11 Mar 2006 23:48:34 -0000 1.90.2.62 +++ helpers.cpp 11 Mar 2006 23:51:18 -0000 1.90.2.63 @@ -1112,6 +1112,7 @@ DPRINTF(DLOW, ("found 'eBay:' in auction, new type, scanning...\n")); scratch = parseDescription(scratch, false); + DPRINTF(DLOW, ("Auction name = '%s'\n", Description)); } else { scratch = strstr(Buff, "eBay Motors: "); @@ -1845,7 +1846,8 @@ } // end GetAucInfo() char *auctioninfo::parseDescription(char *scratch, bool motors) { - unsigned int idx; + unsigned int idx, len; + char *end; // move past the title scratch += strlen(motors ? "eBay Motors: " : "eBay: "); @@ -1854,7 +1856,14 @@ while (isspace(*scratch)) scratch++; // copy over the description to a newline idx = 0; - while (*scratch != '\n' && idx < sizeof(Description) - 1) { + if ((end = strstr(scratch, "(item")) != NULL) { + len = end - scratch; + len = (len < sizeof(Description)-1) ? len : sizeof(Description-1); + } else { + len = sizeof(Description) - 1; + } + + while (*scratch != '\n' && idx < len) { Description[idx++] = *scratch++; } // NULL terminate the description I just parsed off |
From: Kevin D. <kev...@us...> - 2006-03-11 23:48:37
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20275 Modified Files: Tag: STABLE_1_3 bidwatcher.cpp helpers.cpp Log Message: Apply Klaus' 20060307-changes patch. Index: bidwatcher.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/bidwatcher.cpp,v retrieving revision 1.171.2.68 retrieving revision 1.171.2.69 diff -u -d -r1.171.2.68 -r1.171.2.69 --- bidwatcher.cpp 10 Aug 2005 23:47:48 -0000 1.171.2.68 +++ bidwatcher.cpp 11 Mar 2006 23:48:34 -0000 1.171.2.69 @@ -4044,6 +4044,8 @@ theColor = &color_near; else if ( strstr(auction[i]->Feedbackn,"NONE") != NULL) theColor = &color_none; + else if ( strstr(auction[i]->Feedbackn,"Priv.") != NULL) + theColor = &color_none; else theColor = &color_far; if (auction[i]->isEndless) theColor = &color_near; @@ -4369,6 +4371,8 @@ theColor = &color_near; else if ( strstr(auction[i]->Feedbackn,"NONE") != NULL) theColor = &color_none; + else if ( strstr(auction[i]->Feedbackn,"Priv.") != NULL) + theColor = &color_none; else theColor = &color_far; if (auction[i]->isEndless) theColor = &color_near; Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.61 retrieving revision 1.90.2.62 diff -u -d -r1.90.2.61 -r1.90.2.62 --- helpers.cpp 11 Mar 2006 23:45:04 -0000 1.90.2.61 +++ helpers.cpp 11 Mar 2006 23:48:34 -0000 1.90.2.62 @@ -55,7 +55,7 @@ const char * const CheckPrice="0123456789.$,"; // Characters allowed in a price -const char * const SearchOps[2][37]={{ "Starts at", // 1 +const char * const SearchOps[2][40]={{ "Starts at", // 1 "Currently", // 2 "First bid", // 3 "Quantity", // 4 @@ -85,14 +85,17 @@ // for some reason theBuyItNow/Purchase only // auction have a space in front of "Price". " Price", // 28 - "Feedback Score:", // 29 - "(", // 30 + "Feedback Score:", // 29 + "(", // 30 "Ended:", // 31 "Shipping and handling:", // 32 "Shipping Cost Services Available", // 33, newer version of above - " price:", // 34 - "price:", // 35 - "Seller information", // 36 + " price:", // 34 + "price:", // 35 + "Seller information", // 36 + "Score:", // 37 + "Seller:", // 38 + "End time:", // 39 "*"}, /* eBay Motors */ { "Currently", // 1 @@ -1292,7 +1295,8 @@ case 3: // first bid case 30: - if (strstr(LineBuffer.buf(), "(PayPal account required)")) break; + if (!strstr(LineBuffer.buf(), "(Approximately")) + break; if (!FirstBid && !first_flag && strnzcmp(LineBuffer.buf(), "(Approximately")) { if (!dutch_flag) { DPRINTF(DLOW, ("LDFB: %s\n", LineBuffer.buf())); @@ -1423,11 +1427,27 @@ case 9: // time ending if (!Ends[0]) { //streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - //DPRINTF(DLOW, ("LDE: %s\n", LineBuffer.buf())); + //DPRINTF(DLOW, ("LDE: %s\n", LineBuffer.buf())); STRNZCPY(Ends, LineBuffer.buf() + strlen("Ends ")); - translate_date(Ends); - EndsValue = CalcEndsValue(Ends); - } + translate_date(Ends); + EndsValue = CalcEndsValue(Ends); + } + case 39: // "End time:" + // has 2 possibilities of string: + // 1. "End time:10 hours 7 mins" + // " (Mar-08-06 12:52:47 PST)" + // 2. "End time: Mar-08-06 12:52:47 PST" + // "2 days 10 hours 7 mins" + if (!Ends[0]) { + if (strstr(LineBuffer.buf(), " PST ")) { + STRNZCPY(Ends, LineBuffer.buf() + strlen("End time:")); + } else { + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + STRNZCPY(Ends, LineBuffer.buf()+2); // skip starting 2 chars " (" + } + translate_date(Ends); + EndsValue = CalcEndsValue(Ends); + } break; case 31: // ended if (!Ends[0]) { @@ -1473,6 +1493,98 @@ SellerRate[count+1] = '\0'; } break; + case 38: // Seller: + if (!Seller[0]) { + char *p; + p = strchr(LineBuffer.buf(), ':'); + if (!p) + break; + if (*p != ':') + break; + p += 2; // skip ': ' + STRNZCPY(Seller, p); + /* strip only "(private)" away */ + p = strstr(Seller, "(private)"); + if (p) *p='\0'; + + // Bidder Rate is typicaly in next line, but without leading '(' + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + if (LineBuffer.buf()[0] == '(' && !strchr(LineBuffer.buf(), ')')) + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); + if (!strchr(LineBuffer.buf(), ')')) + break; // validity check + SellerRate[0] = '('; + unsigned int count; + for (count=1; count < sizeof(SellerRate)-1; count++) + { + if (LineBuffer.buf()[count-1] == '\0' || LineBuffer.buf()[count-1] == ')' + || LineBuffer.buf()[count-1] == ' ') + break; + SellerRate[count] = LineBuffer.buf()[count-1]; + } + SellerRate[count] = ')'; + SellerRate[count+1] = '\0'; + if (!strncmp(SellerRate, "(0)", 4)) + STRNZCPY(Feedbackn,"NONE"); + } + break; + case 37: // Score: + // Example: Score: 1762 | 99.9% Positive + // Example: Score: Private | 97.0% Positive + if (!Feedbackn[0]) { + char TmpLine[6]; + unsigned int count=0, f_len=0; + int limit=0; + int i=0, j=0; + char *p; + + p = strchr(LineBuffer.buf(), ':'); + limit = strlen(p); + if (strstr(p, "Private")) { + strcpy(Feedbackn, "Priv. "); + count=strlen("Private ")+1; + f_len=strlen("Priv. ")+1; + } else { + while(!isdigit(*p) && *p) + p++; + if (*p == '\0') { + break; + } + + for (f_len=0; count<limit && f_len<sizeof(Feedbackn)-1; count++, f_len++) { + if (p[count] == ' ') + break; + Feedbackn[f_len] = p[count]; + } + Feedbackn[f_len] = '\0'; + } + if (p[count+1] == '|') { + for (i=0, j=count+3; j<limit && i<sizeof(TmpLine)-1; i++, j++) { + if (!isdigit(p[j]) && p[j] != '.' && p[j]!='%') { + break; + } + TmpLine[i] = p[j]; + } + } else + DPRINTF(DLOW, ("Score: p[count+1] is not '|': >%c<, count=%d\n", p[count+1], count)); + TmpLine[i] = '\0'; + if (i) { + int a1= 6; //a1 = sizeof(Feedbackn)-strlen(TmpLine)-1; + if (f_len < a1) { + while (f_len < a1) { /* fills spaces */ + Feedbackn[f_len++] = ' '; + } + } else { + a1 = sizeof(Feedbackn)-strlen(TmpLine)-1; + if (f_len < a1) { // room for 1 space ? + Feedbackn[f_len++] = ' '; + } + } + strcat(Feedbackn,TmpLine); + } + DPRINTF(DLOW, ("Score: Feedbackn= >%s<\n", Feedbackn)); + } + break; case 11: // high bidder id case 19: case 24: @@ -1494,7 +1606,7 @@ STRNZCPY(HighBidder, p); /* Don't cut on '('! "(www.grahamcrackers.com)" is a valid ebay account */ /* strip only "(private)" away */ - p = strstr(Seller, "(private)"); + p = strstr(HighBidder, "(private)"); if (p) *p='\0'; // Bidder Rate is typicaly in next line, but without leading '(' |
From: Kevin D. <kev...@us...> - 2006-03-11 23:45:09
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18440 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: Apply Klaus' account name patch. Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.60 retrieving revision 1.90.2.61 diff -u -d -r1.90.2.60 -r1.90.2.61 --- helpers.cpp 11 Aug 2005 00:29:45 -0000 1.90.2.60 +++ helpers.cpp 11 Mar 2006 23:45:04 -0000 1.90.2.61 @@ -1446,19 +1446,17 @@ case 36: if (!Seller[0]) { unsigned int count; + char *p; streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); if (*LineBuffer.buf() == '\0') streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); STRNZCPY(Seller, LineBuffer.buf()); - for (count=0; count < sizeof(Seller); count++) - { - if (Seller[count] == '(') - { - Seller[count] = 0; // truncate string at first '(' - break; // ignore the rest - } - } + /* Don't cut on '('! "(www.grahamcrackers.com)" is a valid ebay account */ + /* strip only "(private)" away */ + p = strstr(Seller, "(private)"); + if (p) *p='\0'; + // Seller Rate is typicaly in next line, but without leading '(' streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); if (!strchr(LineBuffer.buf(), ')')) streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); @@ -1494,8 +1492,10 @@ } STRNZCPY(HighBidder, p); - p = strchr(HighBidder, '('); - if(p) *p = 0; + /* Don't cut on '('! "(www.grahamcrackers.com)" is a valid ebay account */ + /* strip only "(private)" away */ + p = strstr(Seller, "(private)"); + if (p) *p='\0'; // Bidder Rate is typicaly in next line, but without leading '(' streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); |
From: Kevin D. <kev...@us...> - 2005-08-11 00:30:27
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30949 Modified Files: Tag: STABLE_1_3 bidwatcher.h helpers.cpp Log Message: Make description parsing less redundant. Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.59 retrieving revision 1.90.2.60 diff -u -d -r1.90.2.59 -r1.90.2.60 --- helpers.cpp 11 Aug 2005 00:00:57 -0000 1.90.2.59 +++ helpers.cpp 11 Aug 2005 00:29:45 -0000 1.90.2.60 @@ -28,6 +28,7 @@ // #include "config.h" +#include <iostream> #include <stdio.h> #include <stdlib.h> #ifdef HAVE_SSTREAM @@ -1069,7 +1070,6 @@ } } - unsigned int idx=0; int cnt; int ended_early=0; int auc_type=TYPE_EBAY; @@ -1107,33 +1107,14 @@ scratch = strstr(Buff, "eBay: "); if (scratch != NULL) { DPRINTF(DLOW, ("found 'eBay:' in auction, new type, scanning...\n")); - // move past the "eBay: " - scratch += strlen("eBay: "); - // move past any whitespace - while (isspace(*scratch)) scratch++; - // copy over the description to a newline - idx = 0; - while (*scratch != '\n' && idx < sizeof(Description) - 1) { - Description[idx++] = *scratch++; - } - // NULL terminate the description I just parsed off - Description[idx-1] = '\0'; + scratch = parseDescription(scratch, false); + } else { scratch = strstr(Buff, "eBay Motors: "); if (scratch != NULL) { DPRINTF(DLOW, ("found 'eBay Motors:' in auction. New type. Scanning...\n")); - // move past the "eBay Motors:" - scratch += 12; - // move past any whitespace - while (isspace(*scratch)) scratch++; - // copy over the description to a newline - idx = 0; - while (*scratch != '(' && idx < sizeof(Description) - 1) { - Description[idx++] = *scratch++; - } - // NULL terminate the description I just parsed off - Description[idx-1] = '\0'; + scratch = parseDescription(scratch, true); DPRINTF(DLOW, ("Auction name = '%s'\n", Description)); } else { DPRINTF(DLOW, ("no mandatory matching 'eBay:' nor 'eBay Motors:' in buffer\n")); @@ -1751,6 +1732,25 @@ return TRUE; } // end GetAucInfo() +char *auctioninfo::parseDescription(char *scratch, bool motors) { + unsigned int idx; + + // move past the title + scratch += strlen(motors ? "eBay Motors: " : "eBay: "); + + // move past any whitespace + while (isspace(*scratch)) scratch++; + // copy over the description to a newline + idx = 0; + while (*scratch != '\n' && idx < sizeof(Description) - 1) { + Description[idx++] = *scratch++; + } + // NULL terminate the description I just parsed off + Description[idx-1] = '\0'; + + return scratch; +} + void MakeFileName(char * prefix2, char * fileName, bool thisMonth) { char * homedir=getenv("HOME"); Index: bidwatcher.h =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/bidwatcher.h,v retrieving revision 1.74.2.33 retrieving revision 1.74.2.34 diff -u -d -r1.74.2.33 -r1.74.2.34 --- bidwatcher.h 18 Feb 2005 04:45:57 -0000 1.74.2.33 +++ bidwatcher.h 11 Aug 2005 00:29:45 -0000 1.74.2.34 @@ -189,6 +189,7 @@ ~auctioninfo(); int getinfo(); bool parseaucinfo(const char *); + char *parseDescription(char *, bool); void getkey(float bid, int quantity); int bid(bool); |
From: Kevin D. <kev...@us...> - 2005-08-11 00:01:09
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25113 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: Apply my fix for the bounds checking on description parsing. Apply Klaus Singvogel's big patch to fix auction parsing. Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.58 retrieving revision 1.90.2.59 diff -u -d -r1.90.2.58 -r1.90.2.59 --- helpers.cpp 15 May 2005 21:53:00 -0000 1.90.2.58 +++ helpers.cpp 11 Aug 2005 00:00:57 -0000 1.90.2.59 @@ -54,7 +54,7 @@ const char * const CheckPrice="0123456789.$,"; // Characters allowed in a price -const char * const SearchOps[2][36]={{ "Starts at", // 1 +const char * const SearchOps[2][37]={{ "Starts at", // 1 "Currently", // 2 "First bid", // 3 "Quantity", // 4 @@ -89,8 +89,9 @@ "Ended:", // 31 "Shipping and handling:", // 32 "Shipping Cost Services Available", // 33, newer version of above - " price:", // 34 - "price:", // 35 + " price:", // 34 + "price:", // 35 + "Seller information", // 36 "*"}, /* eBay Motors */ { "Currently", // 1 @@ -350,12 +351,26 @@ char *StripHtmlTags(const char *stringToStrip) { int buffLength = strlen(stringToStrip); +#if DEBUGGING > 0 +#warning "Buffer is double its normal size" + char *Buff = (char *) malloc(buffLength*2 + 1); + memset(Buff, 0, buffLength*2 + 1); +#else char *Buff = (char *) malloc(buffLength + 1); memset(Buff, 0, buffLength + 1); +#endif int BuffIdx = 0; int u,c; - int IncludeFlag = 5; // strip up everything before the first tag, too + int SaveIncludeFlag=5, IncludeFlag; + // states of IncludeFlag: + // 1 - HTML double quote text + // 2 - a comment + // 3 - java script + // 5 - within a HTML statement + // 10 - content (and no HTML stuff) + + IncludeFlag = 5; // strip up everything before the first tag, too // strip the html tags for (u = 0; u < buffLength; u++) { c = stringToStrip[u]; @@ -385,10 +400,20 @@ u+=3; } } + } else if (c == '"' && IncludeFlag < 10) { + if (IncludeFlag != 1) { + SaveIncludeFlag = IncludeFlag; + IncludeFlag = 1; + } else { + IncludeFlag = SaveIncludeFlag; + } + continue; + } else if (IncludeFlag == 1 && c != '"') { + continue; } else if (c == '\\' && stringToStrip[u+1] == '>') { u += 1; continue; - } else if (c == '>' && IncludeFlag!=2) { + } else if (c == '>' && IncludeFlag < 10 && IncludeFlag >= 5) { IncludeFlag=10; } else if (c == '-' && u+1<buffLength && IncludeFlag==2) { if (stringToStrip[u+1] == '-' && \ @@ -748,11 +773,12 @@ else ops_type = auc_type; // Watch the change, it's strNcmp now. - for(idx=0; SearchOps[ops_type][idx][0]!='*';++idx) + for(idx=0; SearchOps[ops_type][idx][0]!='*';++idx) { if (strncmp(LineData, SearchOps[ops_type][idx], strlen(SearchOps[ops_type][idx]))==0) { return (idx+1); } + } return 0; @@ -1043,7 +1069,7 @@ } } - int idx=0; + unsigned int idx=0; int cnt; int ended_early=0; int auc_type=TYPE_EBAY; @@ -1078,21 +1104,42 @@ * but that's not what I'm going to do right now. * Thanks to Bob Beaty! */ - scratch = strstr(Buff, ") -"); + scratch = strstr(Buff, "eBay: "); if (scratch != NULL) { - // move past the ") -" - scratch += 3; + DPRINTF(DLOW, ("found 'eBay:' in auction, new type, scanning...\n")); + // move past the "eBay: " + scratch += strlen("eBay: "); + // move past any whitespace while (isspace(*scratch)) scratch++; // copy over the description to a newline idx = 0; - while (*scratch != '\n') { + while (*scratch != '\n' && idx < sizeof(Description) - 1) { Description[idx++] = *scratch++; } // NULL terminate the description I just parsed off - Description[idx] = '\0'; + Description[idx-1] = '\0'; } else { - return FALSE; + scratch = strstr(Buff, "eBay Motors: "); + if (scratch != NULL) { + DPRINTF(DLOW, ("found 'eBay Motors:' in auction. New type. Scanning...\n")); + // move past the "eBay Motors:" + scratch += 12; + // move past any whitespace + while (isspace(*scratch)) scratch++; + // copy over the description to a newline + idx = 0; + while (*scratch != '(' && idx < sizeof(Description) - 1) { + Description[idx++] = *scratch++; + } + // NULL terminate the description I just parsed off + Description[idx-1] = '\0'; + DPRINTF(DLOW, ("Auction name = '%s'\n", Description)); + } else { + DPRINTF(DLOW, ("no mandatory matching 'eBay:' nor 'eBay Motors:' in buffer\n")); + return FALSE; + } + } StringBuffer streamBuff(Buff); @@ -1103,14 +1150,16 @@ while(strstr(LineBuffer.buf(),"eBay")==NULL && streamBuff) streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); - if (strstr(LineBuffer.buf(),"eBay item") == NULL) - if (strstr(LineBuffer.buf(),"eBay Motors item") == NULL) + if (strstr(LineBuffer.buf(),"eBay: ") == NULL) + if (strstr(LineBuffer.buf(),"eBay Motors: ") == NULL) { + DPRINTF(DLOW, ("no matching 'eBay:' nor 'eBay Motors:' in buffer. Failed.\n")); return FALSE; + } - if (strstr(LineBuffer.buf(),"eBay Motors item") != NULL) + if (strstr(LineBuffer.buf(),"eBay Motors:") != NULL) auc_type = TYPE_EBAYMOTORSCAR; - while(strstr(LineBuffer.buf(),") -")==NULL && streamBuff) + while(strstr(LineBuffer.buf()," (item")==NULL && streamBuff) streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); if ( strstr(LineBuffer.buf(),"Another buyer used Buy It Now to purchase the item immediately") == NULL ){ @@ -1279,8 +1328,8 @@ case 20: // "Price:" - BuyItNow Only. case 28: - case 34: - case 35: + case 34: + case 35: DPRINTF(DLOW, ("This is a BuyItNow\n")); if (!buynow_flag) { buynow_flag = 1; @@ -1295,6 +1344,8 @@ } scratch = strstr(LineBuffer.buf(), ":"); + if (*(scratch+1) == '\n') + streamBuff.getline(LineBuffer.buf(), LineBuffer.size(), '\n'); //strcpy(LineBuffer.buf(),scratch); parseprice2(scratch, this, FALSE); if (!CurrentBid ) { @@ -1411,6 +1462,7 @@ case 10: // seller id case 18: case 21: + case 36: if (!Seller[0]) { unsigned int count; |
From: Kevin D. <kev...@us...> - 2005-08-10 23:47:57
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23767 Modified Files: Tag: STABLE_1_3 bidwatcher.cpp Log Message: Update timesyncurl. Thanks to Klaus Singvogel. Index: bidwatcher.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/bidwatcher.cpp,v retrieving revision 1.171.2.67 retrieving revision 1.171.2.68 diff -u -d -r1.171.2.67 -r1.171.2.68 --- bidwatcher.cpp 24 Feb 2005 16:46:15 -0000 1.171.2.67 +++ bidwatcher.cpp 10 Aug 2005 23:47:48 -0000 1.171.2.68 @@ -4769,7 +4769,7 @@ timesyncurl = NULL; } - timesyncurl = new URL("http://cgi3.ebay.com/aw-cgi/eBayISAPI.dll?TimeShow", + timesyncurl = new URL("http://cgi1.ebay.com/aw-cgi/eBayISAPI.dll?TimeShow", "", proxyurl); } |
From: Kevin D. <kev...@us...> - 2005-05-15 21:53:34
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10789 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: Patch from Klaus Singvogel: Hi, I noticed that bidwatcher requires a better handling to strip the html comments away. Therefore I worked on it and attached a patch. Works fine for me. Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.57 retrieving revision 1.90.2.58 diff -u -d -r1.90.2.57 -r1.90.2.58 --- helpers.cpp 25 Feb 2005 13:47:37 -0000 1.90.2.57 +++ helpers.cpp 15 May 2005 21:53:00 -0000 1.90.2.58 @@ -378,14 +378,27 @@ stringToStrip[u+3] == '>') { Buff[BuffIdx++] = '\n'; u+=2; + } else if (stringToStrip[u+1] == '!' && \ + stringToStrip[u+2] == '-' && \ + stringToStrip[u+3] == '-') { + IncludeFlag=2; + u+=3; } } } else if (c == '\\' && stringToStrip[u+1] == '>') { u += 1; continue; - - } else if (c == '>') { + } else if (c == '>' && IncludeFlag!=2) { IncludeFlag=10; + } else if (c == '-' && u+1<buffLength && IncludeFlag==2) { + if (stringToStrip[u+1] == '-' && \ + stringToStrip[u+2] == '>') { + Buff[BuffIdx++] = '\n'; + IncludeFlag=10; + u+=2; + } else { + u+=1; + } } else if (IncludeFlag==10) { if ((BuffIdx > 0) && (c == ' ') && (Buff[BuffIdx-1] != ' ') && |
From: Jan S. <st...@us...> - 2005-02-25 14:26:47
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23430 Modified Files: Tag: STABLE_1_3 netstuff.cpp Log Message: Moritz' printf(string.c_str()) patch Index: netstuff.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/netstuff.cpp,v retrieving revision 1.46.2.22 retrieving revision 1.46.2.23 diff -u -d -r1.46.2.22 -r1.46.2.23 --- netstuff.cpp 24 Feb 2005 11:03:09 -0000 1.46.2.22 +++ netstuff.cpp 25 Feb 2005 14:26:33 -0000 1.46.2.23 @@ -162,7 +162,7 @@ } else { #ifdef DEBUG_NETWORK printf("Configured for proxy - host: %s, port: %d\n", - proxy->hostname, + proxy->hostname.c_str(), proxy->port); #endif useproxy = TRUE; @@ -304,7 +304,7 @@ int maxfd = 0; /* get file descriptors from the transfers */ - int err = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); /* set a suitable timeout to play around with */ struct timeval timeout; timeout.tv_sec = 0; |
From: Jan S. <st...@us...> - 2005-02-25 13:47:48
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11832 Modified Files: Tag: STABLE_1_3 helpers.cpp Log Message: the next of Moritz' patches Index: helpers.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/helpers.cpp,v retrieving revision 1.90.2.56 retrieving revision 1.90.2.57 diff -u -d -r1.90.2.56 -r1.90.2.57 --- helpers.cpp 18 Feb 2005 04:47:05 -0000 1.90.2.56 +++ helpers.cpp 25 Feb 2005 13:47:37 -0000 1.90.2.57 @@ -238,7 +238,7 @@ !strcmp(temp, "#8220") || // lower double-quote !strcmp(temp, "#8222") || // upper double-quote !strcmp(temp, "quot") || // double-quote - !strcmp(temp, "#8221") || !strcmp(temp, "rsquo") || + !strcmp(temp, "#8221") || !strcmp(temp, "rsquo") || !strcmp(temp, "ndash") || !strcmp(temp, "trade") || !strcmp(temp, "bull")) return '\"'; @@ -253,7 +253,7 @@ if (!strcmp(temp, "szlig")) return 223; // sz-ligature if (!strcmp(temp, "nbsp") || !strcmp(temp, "copy") || - !strcmp(temp, "#8260") || !strcmp(temp, "#12288") || + !strcmp(temp, "#8260") || !strcmp(temp, "#12288") || !strcmp(temp, "#9674") || !strcmp(temp, "#8730")) return ' '; if (!strcmp(temp, "middot")) // This should be trademark @@ -563,13 +563,12 @@ // ProcessBid() // takes the html response from making a bid // return values: -// 1 - bid submission was a success - we are the high bidder -// 2 - bid successful, but we were outbid. -// 3 - bid under the current asking price -// 4 - problem with the bid quantity -// 5 - Auction is over. -// 6 - invalid username / password. -// 7 - unknown error +// 1 == PBS_SUCCESS - bid submission was a success - we are the high bidder +// 2 == PBS_BIDTOOLOW - bid too low +// 3 == PBS_BADQUANTITY - quantity problem +// 4 == PBS_AUCTIONOVER - auction had ended before the bid +// 5 == PBS_PREAPPROVAL - pre-approval would have been required +// -1 == ERROR - other problem (unknown, probably bad connection) // ////////////////////////////////////////////////////////////////////////////// int ProcessBid(char *Buff) |
From: Jan S. <st...@us...> - 2005-02-24 16:46:25
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10345 Modified Files: Tag: STABLE_1_3 bidwatcher.cpp Log Message: applied Moritz' NET_SUCCESS patch Index: bidwatcher.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/bidwatcher.cpp,v retrieving revision 1.171.2.66 retrieving revision 1.171.2.67 diff -u -d -r1.171.2.66 -r1.171.2.67 --- bidwatcher.cpp 24 Feb 2005 11:03:06 -0000 1.171.2.66 +++ bidwatcher.cpp 24 Feb 2005 16:46:15 -0000 1.171.2.67 @@ -4606,7 +4606,7 @@ blackLED(); - if (returnVal != 1) { + if (returnVal != NET_SUCCESS) { #ifdef DEBUG_NETWORK fprintf(stderr, "Error (%d) fetching ebay's time web page, retrying... (%d)\n", |
From: Jan S. <st...@us...> - 2005-02-24 11:03:23
|
Update of /cvsroot/bidwatcher/bidwatcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14514 Modified Files: Tag: STABLE_1_3 bidwatcher.cpp netstuff.cpp Log Message: some cleanup of memory handling Index: netstuff.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/netstuff.cpp,v retrieving revision 1.46.2.21 retrieving revision 1.46.2.22 diff -u -d -r1.46.2.21 -r1.46.2.22 --- netstuff.cpp 21 Feb 2005 11:43:11 -0000 1.46.2.21 +++ netstuff.cpp 24 Feb 2005 11:03:09 -0000 1.46.2.22 @@ -44,9 +44,15 @@ // start with an empty buffer, so memsize should be larger than size. struct MemoryBufferStruct { - char *memory; // This is the character array size_t size; // This is the length of the string size_t memsize; // This is the actual length of the array + char *memory; // This is the character array + + MemoryBufferStruct(): + size(0), + memsize(32 * 1024), + memory((char*)malloc(memsize)) + {} }; size_t WriteMemoryBuffer(void *ptr, size_t size, size_t nmemb, void *data) @@ -55,9 +61,9 @@ // ptr, size, nmemb, data)); register int realsize = size * nmemb; MemoryBufferStruct *mem = (MemoryBufferStruct *)data; - if ((size_t) (realsize) >= (mem->memsize - mem->size)) { - mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1); - mem->memsize = mem->size + realsize + 1; + if (mem->memory == NULL || mem->size + realsize >= mem->memsize) { + mem->memsize = 2 * (mem->size + realsize + 1); // twice the required space + mem->memory = (char *)realloc(mem->memory, mem->memsize); } if (mem->memory) { memcpy(&(mem->memory[mem->size]), ptr, realsize); @@ -217,15 +223,11 @@ int fetchURL(URL *url, int Post, char **Buff, char *cookiejar, int redir) { - size_t avebuffsize = 1 << 15; // 2 to the 15th power + *Buff = NULL; + CURL *curl_handle; CURLM *multi_handle; - MemoryBufferStruct curl_memory_chunk; - curl_memory_chunk.memory = (char *) malloc(avebuffsize*sizeof(char)); - curl_memory_chunk.size = 0; - curl_memory_chunk.memsize = avebuffsize; - // Initialize the curl session curl_handle = curl_easy_init(); multi_handle = curl_multi_init(); @@ -277,8 +279,9 @@ // All the data will be sent to this function by curl curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryBuffer); - // We will need our memory buffer to be pass to the write function - curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&curl_memory_chunk); + // We will need our memory buffer to be passed to the write function + MemoryBufferStruct curl_memory_chunk; + curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, &curl_memory_chunk); curl_multi_add_handle(multi_handle, curl_handle); @@ -289,26 +292,24 @@ // Now get that URL while(still_running) { - struct timeval timeout; - int rc; /* select() return code */ - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - int maxfd; - FD_ZERO(&fdread); + + fd_set fdwrite; FD_ZERO(&fdwrite); + + fd_set fdexcep; FD_ZERO(&fdexcep); - /* set a suitable timeout to play around with */ - timeout.tv_sec = 0; - timeout.tv_usec = 1; + int maxfd = 0; /* get file descriptors from the transfers */ - curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); - - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + int err = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + /* set a suitable timeout to play around with */ + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 10000; + int rc = select(maxfd, &fdread, &fdwrite, &fdexcep, &timeout); switch(rc) { case -1: @@ -338,6 +339,7 @@ curl_multi_cleanup(multi_handle); + *Buff = curl_memory_chunk.memory; if (error == 0) { // If we haven't hit redirect limit, follow any redirects //if (redir && checkredir(url,curl_memory_chunk.memory)) { @@ -347,16 +349,12 @@ //} // Set the buffer pointer to the curl memory buffer - *Buff = curl_memory_chunk.memory; /* cleanup curl stuff */ curl_easy_cleanup(curl_handle); - return NET_SUCCESS; } else { return NET_NETERROR; } } - - Index: bidwatcher.cpp =================================================================== RCS file: /cvsroot/bidwatcher/bidwatcher/Attic/bidwatcher.cpp,v retrieving revision 1.171.2.65 retrieving revision 1.171.2.66 diff -u -d -r1.171.2.65 -r1.171.2.66 --- bidwatcher.cpp 18 Feb 2005 04:47:04 -0000 1.171.2.65 +++ bidwatcher.cpp 24 Feb 2005 11:03:06 -0000 1.171.2.66 @@ -28,7 +28,7 @@ #include <unistd.h> #include <time.h> #include <sys/time.h> -#include <sys/types.h> +#include <sys/types.h> #include <sys/stat.h> // Handle strict Ansi compliance with gcc 3.1 while retaining @@ -600,7 +600,7 @@ char *ustring, *vstring; char cookiejar[200]; memset(cookiejar, 0, sizeof cookiejar); - snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", + snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", getenv("HOME"), bw_subdir); /* Sign in First */ @@ -618,7 +618,7 @@ "&siteid=0&co_partnerId=2&UsingSSL=1" "&ru=&pp=&pa1=&pa2=&pa3=&i1=-1&pageType=-1" "&userid=%s&pass=%s&keepMeSignInOption=1", - authID, authPASS); + authID, authPASS); bidurl = new URL(ustring, vstring, proxyurl); g_free(ustring); @@ -646,7 +646,7 @@ char *ustring, *vstring; char cookiejar[200]; - snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", + snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", getenv("HOME"), bw_subdir); dosignin(); @@ -683,9 +683,10 @@ if (returnVal != NET_SUCCESS) { if (returnVal == NET_NETERROR) showError("Could not obtain bid key: a network error occurred."); - else if (returnVal == NET_TIMEOUT) showError("Network timeout error"); + + free(Buff); return; } char lineBuff[8000]; @@ -753,7 +754,7 @@ char lineBuff[1024]; int returnVal, retval; char cookiejar[200]; - snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", + snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", getenv("HOME"), bw_subdir); sprintf(bidurl->fullurlpost, "MfcISAPICommand=MakeBid&item="LLU_FMT"&key=%s" @@ -1002,7 +1003,7 @@ void DoEmail(char * name, char * auctionid) { char cookiejar[200]; - snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", + snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", getenv("HOME"), bw_subdir); if (strlen(name) < 2) { @@ -1035,6 +1036,7 @@ if ((err == NET_NETERROR) || (err == NET_TIMEOUT) || (strlen(Buff) < 1000)) { showError("Could not get email address: Network error"); + free(Buff); return; } @@ -4182,7 +4184,7 @@ int returnVal; unsigned long long *ids; char cookiejar[200]; - snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", + snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", getenv("HOME"), bw_subdir); if (!trackBids) return GUA_SUCCESS; @@ -4201,15 +4203,13 @@ showStatus(""); if ((returnVal != NET_SUCCESS)) { - if (Buff) - free(Buff); - return ERROR; + free(Buff); + return ERROR; } if (strstr(Buff, "invalid") != NULL) { - if (Buff) - free(Buff); - return GUA_BADUSER; + free(Buff); + return GUA_BADUSER; } CHECK; @@ -4264,7 +4264,7 @@ char WebPage[256]; int returnVal; char cookiejar[200]; - snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", + snprintf(cookiejar, (sizeof cookiejar) - 1, "%s/%s/cookies.txt", getenv("HOME"), bw_subdir); if (!trackListings) @@ -4291,13 +4291,13 @@ DPRINTF(DLOW, ("GetUserListings.returnval=%i\n", returnVal)); if (returnVal != NET_SUCCESS) { - free(Buff); - return ERROR; + free(Buff); + return ERROR; } if (strstr(Buff, "invalid") != NULL ) { - free(Buff); - return GUA_BADUSER; + free(Buff); + return GUA_BADUSER; } // decision time. there are a lot of ways to do this. instead of taking the time @@ -4499,9 +4499,9 @@ if (returnVal == NET_NETERROR || returnVal == NET_TIMEOUT) { // Ok, so it probably is borked. - g_free(urlstring); - free(HtmlBuff); - return returnVal | INFO_ERROR_RANGE; + g_free(urlstring); + free(HtmlBuff); + return returnVal | INFO_ERROR_RANGE; } } @@ -4511,17 +4511,17 @@ // This looks majorly hacky to me, but lets at least free the memory // Thanks to kochc for pointing it out. if (returnVal != NET_SUCCESS) { - if (HtmlBuff) free(HtmlBuff); - return returnVal | INFO_ERROR_RANGE; + free(HtmlBuff); + return returnVal | INFO_ERROR_RANGE; } else if (strlen(HtmlBuff) < 1000) { - free(HtmlBuff); - return INFO_CGIDOWN; + free(HtmlBuff); + return INFO_CGIDOWN; } // ok, html grab was a success - now process the html char *Buff; Buff = StripHtmlTags(HtmlBuff); - if (HtmlBuff) free(HtmlBuff); + free(HtmlBuff); #if defined(DEBUGGING) && DEBUGGING>DMED { @@ -4612,13 +4612,15 @@ "Error (%d) fetching ebay's time web page, retrying... (%d)\n", returnVal, i); #endif - continue; + free(HtmlBuff); + continue; } if (t1 > 6) { #ifdef DEBUG_NETWORK fprintf(stderr, "Took too long (%.2f sec) to fetch ebay's time web page, retrying... (%d)\n", t1, i); #endif + free(HtmlBuff); continue; } @@ -4626,6 +4628,7 @@ #ifdef DEBUG_NETWORK fprintf(stderr, "Short web page (%ld bytes) from ebay's time web page, retrying... (%d)\n", strlen(HtmlBuff), i); #endif + free(HtmlBuff); continue; } |