Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:kssingvo
bidwatcher
bidwatcher-1.3.17-changes_20050714.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bidwatcher-1.3.17-changes_20050714.patch of Package bidwatcher
--- bidwatcher-1.3.17/helpers.cpp.orig 2005-07-14 14:04:07.000000000 +0200 +++ bidwatcher-1.3.17/helpers.cpp 2005-07-14 14:02:10.000000000 +0200 @@ -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,25 @@ char *StripHtmlTags(const char *stringToStrip) { int buffLength = strlen(stringToStrip); +#if DEBUGGING > 0 + 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 +399,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] == '-' && \ @@ -749,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; @@ -1082,21 +1107,47 @@ * 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 += 6; // move past any whitespace while (isspace(*scratch)) scratch++; // copy over the description to a newline idx = 0; - while (*scratch != '\n' && idx<DESCRIPTION_LENGTH-1) { + while (*scratch != '(' && idx<DESCRIPTION_LENGTH-1) { Description[idx++] = *scratch++; } // NULL terminate the description I just parsed off - Description[idx] = '\0'; + if (Description[idx-1] == ' ') // cut off last space character + Description[idx-1] = '\0'; + else + Description[idx] = '\0'; + DPRINTF(DLOW, ("Auction name = '%s'\n", Description)); } 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<DESCRIPTION_LENGTH-1) { + Description[idx++] = *scratch++; + } + // NULL terminate the description I just parsed off + if (Description[idx-1] == ' ') // cut off last space character + Description[idx-1] = '\0'; + else + Description[idx] = '\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); @@ -1107,14 +1158,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 ){ @@ -1283,8 +1336,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; @@ -1299,6 +1352,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 ) { @@ -1415,6 +1470,7 @@ case 10: // seller id case 18: case 21: + case 36: if (!Seller[0]) { unsigned int count;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor