Remove code that handled dutch items, old page formats, high bidder email, all bidder names (not available anymore), saving deleted listing ids in the XML file, large swaths of dead and/or obsolete code, and all the DB Time Queue code.

Abstracted the XMLElement code out to an interface, which XMLSerialize now uses, avoiding a circular dependency/tangle.

Made all my email addresses point to the same address, NOT at SourceForge anymore.

by mrs, 06 Aug, 2009 09:21 AM
884 1000  
9999     THIS ALSO CAN BE VERY, VERY EXPENSIVE!
100100 
101101 ----------------------------------------------------------------------
102 * After payment, dutch auctions subtract out from the 'available' list, and the user seems to no longer have won the listing.
103 
104102 * Add to watch list:
105103   http://cgi1.ebay.com/ws/eBayISAPI.dll?ViewItemMakeTrack&item=6047388445
106104   http://cgi1.ebay.com/ws/eBayISAPI.dll?ViewItemMakeTrack&item=5104953681
994 1000  
6868 view.original.listing=View the original listing
6969 
7070 ebayServer.bidHost=offer.ebay.co.uk
71 ebayServer.dutchRequestHost=offer.ebay.co.uk
7271 ebayServer.signInPage=https://signin.ebay.co.uk/ws2/eBayISAPI.dll?SignIn
7372 ebayServer.bidderNamesHost=cgi6.ebay.co.uk
7473 ebayServer.buyRequest=http://offer.ebay.co.uk/ws/eBayISAPI.dll?MfcISAPICommand=BinConfirm&fb=1&co_partnerid=
994 1000  
5757 ebayServer.warningPage=(?i)(Buying.Reminder|Safe.Trading.Tips)
5858 ebayServer.feedback=Feedback:
5959 ebayServer.viewHost=cgi.ebay.com
60 ebayServer.detectionHost=^(cgi\\.ebay\\.|cgi\\.tw\\.ebay\\.|cgi\\.es\\.ebay\\.).*$
6160 your.information.has.been.verified=(?ms).*Your information has been verified.*
6261 mature.audiences.accepted=(?ms).*You may now view these pages.*
6362 mature.audiences.disallowed.outside.the.us=(?ms).*not to allow access to the Mature Audiences category outside the US.*
------
7069 view.original.listing=View the original listing
7170 
7271 ebayServer.bidHost=offer.ebay.com
73 ebayServer.dutchRequestHost=offer.ebay.com
7472 ebayServer.signInPage=https://signin.ebay.com/ws2/eBayISAPI.dll?SignIn
7573 ebayServer.bidderNamesHost=cgi6.ebay.com
7674 ebayServer.buyRequest=http://offer.ebay.com/ws/eBayISAPI.dll?MfcISAPICommand=BinConfirm&fb=1&co_partnerid=
969 1000  
22 ebayServer.protocol=http://
33 ebayServer.file=/ws/eBayISAPI.dll
44 ebayServer.V3file=/ws/eBayISAPI.dll
5 ebayServer.V3WS3File=/ws3/eBayISAPI.dll
65 ebayServer.viewCmd=ViewItem&
76 ebayServer.viewCGI=item=
8 ebayServer.viewDutch=?ViewBidsDutchHighBidder&item=
97 ebayServer.searchURL2=&srchdesc=y&category0=&ebaytag1=ebayctry&ebaytag1code=0&SortProperty=MetaEndSort&SortOrder=%5Ba%5D&st=0&maxRecordsPerPage=100
108 ebayServer.searchURLNoDesc=&srchdesc=n&category0=&ebaytag1=ebayctry&ebaytag1code=0&SortProperty=MetaEndSort&SortOrder=%5Ba%5D&st=0&maxRecordsPerPage=100
119 ebayServer.bidCmd=MfcISAPICommand=MakeBid
959 1000  
99 import com.jbidwatcher.util.xml.XMLParseException;
1010 import com.jbidwatcher.util.xml.XMLElement;
1111 import com.jbidwatcher.util.xml.XMLSerializeSimple;
12 import com.jbidwatcher.util.xml.XMLInterface;
1213 import com.jbidwatcher.ui.util.OptionUI;
1314 import com.jbidwatcher.util.http.Http;
1415 import com.jbidwatcher.util.Constants;
------
2425   protected String _description = ""; //  Optional
2526   protected String _url = "";
2627   protected boolean _valid;
27   protected boolean _hasConfigChanges;
28   protected ArrayList<XMLElement> configChanges;
28   protected ArrayList<XMLInterface> mConfigChanges;
2929 
30   //  For creating, then filling in later, especially when loading from a
31   //  file, instead of remotely.
32   public UpdaterEntry() { }
33 
3430   public UpdaterEntry(String packageName, String updateFrom) {
3531     StringBuffer loadedUpdate;
3632 
------
9894         if(valid) {
9995           String strStamp = curElement.getProperty("STAMP");
10096           if(strStamp == null) {
101             if(configChanges == null) configChanges = new ArrayList<XMLElement>(5);
102             configChanges.add(curElement);
97             if(mConfigChanges == null) mConfigChanges = new ArrayList<XMLInterface>(5);
98             mConfigChanges.add(curElement);
10399           } else {
104100             long stamp = Long.parseLong(strStamp);
105101             long last = Long.parseLong(JConfig.queryConfiguration("updates.lastConfig", "0"));
106102             if(stamp > last) {
107               if(configChanges == null) configChanges = new ArrayList<XMLElement>(5);
108               configChanges.add(curElement);
103               if(mConfigChanges == null) mConfigChanges = new ArrayList<XMLInterface>(5);
104               mConfigChanges.add(curElement);
109105             }
110106           }
111107         }
------
136132   }
137133 
138134   public boolean hasConfigurationUpdates() {
139     return configChanges != null;
135     return mConfigChanges != null;
140136   }
141137 
142138   public void applyConfigurationUpdates() {
------
144140     boolean cfgChanged = false;
145141     long lastStamp = Long.parseLong(JConfig.queryConfiguration("updates.lastConfig", "0"));
146142 
147     for (XMLElement cfg : configChanges) {
143     for (XMLInterface cfg : mConfigChanges) {
148144       String type = cfg.getProperty("TYPE", "config");
149145       if (type.equals("message")) {
150146         if (alert == null) {
844 1000  
5757     return schemaInfo.getDB();
5858   }
5959 
60   private static boolean tableExists(Database db, Statement s, String tableName) throws SQLException {
60   private static boolean tableExists(Statement s, String tableName) throws SQLException {
6161     ResultSet rs = s.getConnection().getMetaData().getTables(null, null, tableName, null);
6262     boolean result = rs.next();
6363     rs.close();
------
7272        */
7373       Statement mS = db.getStatement();
7474 
75       boolean schema_info_exists = tableExists(db, mS, "schema_info");
76       if(!schema_info_exists) schema_info_exists = tableExists(db, mS, "SCHEMA_INFO");
75       boolean schema_info_exists = tableExists(mS, "schema_info");
76       if(!schema_info_exists) schema_info_exists = tableExists(mS, "SCHEMA_INFO");
7777 
7878       if(!schema_info_exists) {
7979         runFile(db, mS, "/jbidwatcher.sql");
908 1000  
4242 
4343 /**
4444  * @file   JBidWatch.java
45  * @author Morgan Schweers <cyberfox@users.sourceforge.net>
45  * @author Morgan Schweers <cyberfox@jbidwatcher.com>
4646  * @date   Fri Oct 11 17:54:21 2002
4747  *
4848  * @brief The startup class, that prepares the UI, and starts all the
952 1000  
3737   /**
3838    * @brief Constructs a new window frame, with all the sorted tables,
3939    * scroll bars, drag and drop targets, menu & header bar, and status
40    * line.
40    * line.  Returns a completed frame, suitable for displaying as the primary UI of the program.
4141    *
4242    * @param title - The frame title.
4343    * @param myFrameAdapter - The adapter to listen to mouse events.
4444    * @param iconURL - The URL of the icon to associate with the frame.
4545    * @param tabManager - The Tab Manager to display within the frame.
46    * 
47    * @return A completed frame, suitable for displaying as the primary UI of the program.
4846    */
4947   public MacFriendlyFrame(String title, JMouseAdapter myFrameAdapter, URL iconURL, JTabManager tabManager) {
5048     super(title);
984 1000  
6565   public int getResult() { return mResult; }
6666   public boolean isSuccessful() {
6767     return (mResult == AuctionServerInterface.BID_WINNING ||
68             mResult == AuctionServerInterface.BID_DUTCH_CONFIRMED ||
6968             mResult == AuctionServerInterface.BID_SELFWIN);
7069   }
7170 
------
8281         bidResultString = "Bidding apparently failed, as the auction cannot be bid on anymore (probably ended)!";
8382         JConfig.increment("stats.bid.too_late");
8483         break;
85       case com.jbidwatcher.auction.AuctionServerInterface.BID_DUTCH_CONFIRMED:
86         bidResultString = "Your dutch bid was confirmed, and you are in the list of high bidders!";
87         JConfig.increment("stats.bid.success");
88         break;
8984       case AuctionServerInterface.BID_ERROR_BANNED:
9085         bidResultString = "Your bid failed, as you are disallowed from bidding on this seller's items.";
9186         JConfig.increment("stats.bid.banned");
997 1000  
1515 import com.jbidwatcher.util.db.ActiveRecord;
1616 import com.jbidwatcher.util.db.Table;
1717 import com.jbidwatcher.util.xml.XMLElement;
18 import com.jbidwatcher.util.xml.XMLInterface;
1819 
19 import java.io.FileNotFoundException;
2020 import java.io.File;
2121 import java.text.MessageFormat;
2222 import java.util.*;
------
8484     return mSnipe;
8585   }
8686 
87   public static class AuctionComparator implements Comparator<AuctionEntry>
88   {
89     /**
90      * @param o1 - The first auction entry.
91      * @param o2 - The second auction entry.
92      * @return -1 if o1 < o2, 0 if o1 == o2, 1 if o1 > o2.
93      * @brief Compare two auction objects for ordering by end-date.
94      */
95     public int compare(AuctionEntry o1, AuctionEntry o2) {
96       if (o1 == null && o2 == null) return 0;
97       if (o1 == null) return -1;
98       if (o2 == null) return 1;
99 
100       int result = o1.getEndDate().compareTo(o2.getEndDate());
101       if (result == 0) {
102         result = o1.compareTo(o2);
103       }
104       return result;
105     }
106   }
107 
10887   /** All the auction-independant information like high bidder's name,
10988    * seller's name, etc...  This is directly queried when this object
11089    * is queried about any of those fields.
------
161140   private Currency mCancelSnipeBid = null;
162141 
163142   /**
164    * How many items are to be sniped on, but were cancelled?
165    */
166   private int mCancelSnipeQuant =1;
167 
168   /**
169143    * What AuctionServer is responsible for handling this
170144    * AuctionEntry's actions?
171145    */
------
607581   }
608582 
609583   /**
610    * @brief Determine how long before the auction-end is the default
611    * snipe set to fire?
612    *
613    * @return The number of milliseconds prior to auction end that a
614    * snipe should fire.
615    */
616   public static long getDefaultSnipeTime() {
617     sDefaultSnipeAt = getGlobalSnipeTime();
618     return sDefaultSnipeAt;
619   }
620 
621   /**
622584    * @brief Set how long before auctions are complete to fire snipes
623585    * for any auction using the default snipe timer.
624586    *
------
662624   public void updateHighBid() {
663625     int numBidders = getNumBidders();
664626 
665     if (numBidders > 0 /* && isOutbid() */) {
627     if (numBidders > 0 || isFixed()) {
666628       getServer().updateHighBid(this);
667629     }
668630   }
------
701663   }
702664 
703665   /**
704    * @brief Determine if we're a high bidder on a multi-item ('dutch')
705    * auction.
706    */
707   public void checkDutchHighBidder() {
708     setWinning(getServer().isHighDutch(this));
709   }
710 
711   /**
712666    * @brief Set the flags if the current user is the seller in this auction.
713667    */
714668   private void checkSeller() {
------
1017971    *
1018972    * @param inXML - The XMLElement that contains the items to load.
1019973    */
1020   public void fromXML(XMLElement inXML) {
974   public void fromXML(XMLInterface inXML) {
1021975     String inID = inXML.getProperty("ID", null);
1022976     if(inID != null) {
1023977       mAuction = new AuctionInfo();
------
10821036   public Currency getCancelledSnipe() { return mCancelSnipeBid; }
10831037 
10841038   /**
1085    * @brief Return the quantity that the snipe bid was for, before it
1086    * was cancelled.
1087    *
1088    * @return - A number of items (for dutch only) that were to be bid on.
1089    */
1090   public int getCancelledSnipeQuantity() { return mCancelSnipeQuant; }
1091 
1092   /**
10931039    * Cancel the snipe and clear the multisnipe setting.  This is used for
10941040    * user-driven snipe cancellations, and errors like the listing going away.
10951041    *
------
11071053       setLastStatus("Cancelling snipe.");
11081054       if(after_end) {
11091055         mCancelSnipeBid = getSnipe().getAmount();
1110         mCancelSnipeQuant = getSnipe().getQuantity();
11111056       }
11121057     }
11131058   }
------
11541099     try {
11551100       updateHighBid();
11561101       checkHighBidder();
1157       if(isDutch()) checkDutchHighBidder();
11581102     } catch(Exception e) {
11591103       JConfig.log().handleException("Unexpected exception during high bidder check.", e);
11601104     }
------
12321176     getServer().setSnipe(this);
12331177   }
12341178 
1235   /** @brief Actually bid on a single item for a given price.
1236    *
1237    * Also called by the snipe() function, to actually bid.
1238    *
1239    * @param bid - The amount of money to bid on 1 of this item.
1240    *
1241    * @return The result of the bid attempt.
1242    */
1243   public int bid(Currency bid) {
1244     return( bid(bid, 1) );
1245   }
1246 
12471179   /**
12481180    * @brief Bid a given price on an arbitrary number of a particular item.
12491181    *
------
16331565 
16341566   public String getSeller() { return getAuction().getSellerName(); }
16351567   public String getHighBidder() { return getAuction().getHighBidder(); }
1636   public String getHighBidderEmail() { return getAuction().getHighBidderEmail(); }
16371568   public String getTitle() { return getAuction().getTitle(); }
16381569 
16391570   public Date getStartDate() {
------
16601591   public boolean isReserveMet() { return getAuction().isReserveMet(); }
16611592   public boolean isPrivate() { return getAuction().isPrivate(); }
16621593   public boolean isFixed() { return getAuction().isFixedPrice(); }
1663   public boolean isOutbid() { return getAuction().isOutbid(); }
16641594 
16651595   public StringBuffer getContent() { return getAuction().getContent(); }
16661596   public File getContentFile() { return getAuction().getContentFile(); }
------
16971627     return ship != null && !ship.isNull();
16981628   }
16991629 
1700   public String getURL() {
1701     return getServer().getStringURLFromItem(getAuction().getIdentifier());
1702   }
1703 
1704   public StringBuffer getBody() throws FileNotFoundException {
1705     return getServer().getAuction(StringTools.getURLFromString(getURL()));
1706   }
1707 
17081630   /**
17091631    * Is the auction deleted on the server?
17101632    *
------
19341856   public static final String newCol = "</td><td>";
19351857   public static final String endRow = "</td></tr>";
19361858 
1859   // TODO -- Extract this crap out to a EntryHTMLBuilder class, which gets instantiated with an AuctionEntry object.
19371860   public String buildInfoHTML() {
1938     return buildInfoHTML(false, false);
1861     return buildInfoHTML(false);
19391862   }
19401863 
1941   public String buildInfoHTML(boolean finalize, boolean forRSS) {
1864   public String buildInfoHTML(boolean forRSS) {
19421865     String prompt = "";
1943     if(finalize) prompt = "<html><body>";
19441866 
19451867     if(forRSS) {
19461868       prompt += "<b>" + StringTools.stripHigh(getTitle()) + "</b> (" + getIdentifier() + ")<br>";
------
19531875       if (forRSS) {
19541876         try {
19551877           InetAddress thisIp = InetAddress.getLocalHost();
1956           prompt += newRow + "<img src=\"http://" + thisIp.getHostAddress() + ":" + JConfig.queryConfiguration("server.port", "9099") + "/" + getIdentifier() + ".jpg\">" + newCol + "<table>";
1878           prompt += newRow + "<img src=\"http://" + thisIp.getHostAddress() + ":" + JConfig.queryConfiguration("server.port", Constants.DEFAULT_SERVER_PORT_STRING) + "/" + getIdentifier() + ".jpg\">" + newCol + "<table>";
19571879           addedThumbnail = true;
19581880         } catch (UnknownHostException e) {
19591881           //  Couldn't find THIS host?!?  Perhaps that means we're not online?
------
19661888     }
19671889     prompt = buildInfoBody(prompt, addedThumbnail);
19681890 
1969     if(finalize) {
1970       prompt += "</html>";
1971     }
19721891    return(prompt);
19731892   }
19741893 
------
20711990   public static XMLElement retrieveAuctionXML(String identifier) {
20721991     AuctionEntry ae = AuctionEntry.construct(identifier);
20731992     if (ae != null) {
2074       if (ae.isDutch()) ae.checkDutchHighBidder();
2075       return ae.toXML();
1993       return ae.toXML(); //  TODO -- Check high bidder (a separate request).
20761994     }
20771995 
20781996     return null;
997 1000  
7373   }
7474 
7575   protected Seller mSeller;
76 
77   protected static final sun.misc.BASE64Decoder b64dec = new sun.misc.BASE64Decoder();
78   protected static final sun.misc.BASE64Encoder b64enc = new sun.misc.BASE64Encoder();
7976   protected GZip mLoadedPage = null;
8077 
8178   /**
------
8683     setTranslationTable(mKeys);
8784   }
8885 
89   /** 
90    * @brief Construct a somewhat complete AuctionInfo object with all
91    * the important values set.
92    * 
93    * @param auctionTitle - The title of the auction.
94    * @param auctionSeller - The seller's username for the auction.
95    * @param auctionHighBidder - The current high bidder, if any.
96    * @param auctionCurBid - The current/lowest/starting bid.
97    * @param auctionStart - The start time for the auction (if available).
98    * @param auctionEnd - The end time for the auction.
99    * @param auctionBidCount - The number of bids that have been placed so far.
100    */
101   protected AuctionInfo(String auctionTitle, String auctionSeller, String auctionHighBidder,
102                      Currency auctionCurBid, Date auctionStart, Date auctionEnd, int auctionBidCount) {
103     setTranslationTable(mKeys);
104     setTitle(auctionTitle.trim());
105     setHighBidder(auctionHighBidder.trim());
106     setSellerName(auctionSeller.trim());
107 
108     setStart(auctionStart);
109     setEnd(auctionEnd);
110 
111     setCurBid(auctionCurBid);
112     setNumBids(auctionBidCount);
113   }
114 
115   public Record getMap() {
116     return getBacking();
117   }
118 
11986   protected String[] infoTags = { "title", "seller", "highbidder", "bidcount", "start", "end",
12087                                 "currently", "dutch", "reserve", "private", "content",
12188                                 "shipping", "insurance", "buynow", "usprice", "fixed", "minimum",
------
407374   public String getIdentifier() { return getString("identifier"); }
408375   public String getTitle() { return getString("title"); }
409376   public String getHighBidder() { return getString("highBidder"); }
410   public String getHighBidderEmail() { return getString("highBidderEmail"); }
377 //  public String getHighBidderEmail() { return getString("highBidderEmail"); }
411378   public String getItemLocation() { return getString("itemLocation", ""); }
412379 
413380   public Currency getCurBid() { return getMonetary("curBid"); }
------
435402   protected boolean isPrivate() { return getBoolean("isPrivate"); }
436403   protected boolean isFixedPrice() { return getBoolean("fixed_price"); }
437404   boolean isReserveMet() { return getBoolean("reserveMet"); }
438   boolean isOutbid() { return getBoolean("outbid"); }
439405   protected boolean hasPaypal() { return getBoolean("paypal"); }
440406   boolean hasThumb() { return getBoolean("has_thumbnail"); }
441407   boolean isInsuranceOptional() { return getBoolean("insurance_optional", true); }
------
457423     refreshSeller();
458424     return mSeller;
459425   }
426 
460427   public String getPositiveFeedbackPercentage() {
461428     refreshSeller();
462429     if (mSeller != null) return mSeller.getPositivePercentage();
------
493460   public void setIdentifier(String id) { setString("identifier", id); }
494461   public void setHighBidder(String highBidder) { setString("highBidder", highBidder); }
495462   protected void setTitle(String title) { setString("title", title); }
496   protected void setHighBidderEmail(String highBidderEmail) { setString("highBidderEmail", highBidderEmail); }
463 //  protected void setHighBidderEmail(String highBidderEmail) { setString("highBidderEmail", highBidderEmail); }
497464   protected void setItemLocation(String itemLocation) { setString("itemLocation", itemLocation); }
498465 
499466   protected void setInsuranceOptional(boolean insuranceOptional) { setBoolean("insuranceOptional", insuranceOptional); }
------
514481   protected void setQuantity(int quantity) { setInteger("quantity", quantity); }
515482   protected void setNumBids(int numBids) { setInteger("numBids", numBids); }
516483 
517   protected void setDutch(boolean dutch) { setBoolean("isDutch", dutch); }
518484   protected void setReserve(boolean isReserve) { setBoolean("isReserve", isReserve); }
519485   protected void setPrivate(boolean isPrivate) { setBoolean("private", isPrivate); }
520486   protected void setReserveMet(boolean reserveMet) { setBoolean("reserveMet", reserveMet); }
962 1000  
1919   int BID_ERROR_OUTBID=3;
2020   int BID_WINNING=4;
2121   int BID_SELFWIN=5;
22   int BID_DUTCH_CONFIRMED=6;
22 //  int BID_DUTCH_CONFIRMED=6;  --  This is obsolete.
2323   int BID_ERROR_MULTI=7;
2424   int BID_ERROR_TOO_LOW=8;
2525   int BID_ERROR_ENDED=9;
------
113113 
114114   boolean isCurrentUser(String checkUser);
115115 
116   boolean isHighDutch(EntryInterface entry);
117 
118116   void updateHighBid(AuctionEntry eEntry);
119117 
120118   String stripId(String source);
849 1000  
6060     return snipe;
6161   }
6262 
63   public String saveDB() {
64     return super.saveDB();
65   }
66 
6763   private static Table sDB = null;
6864   protected static String getTableName() { return "snipes"; }
6965 
985 1000  
1111 import com.jbidwatcher.util.Comparison;
1212 import com.jbidwatcher.util.UpdateBlocker;
1313 import com.jbidwatcher.util.Task;
14 import com.jbidwatcher.util.xml.XMLElement;
14 import com.jbidwatcher.util.xml.XMLInterface;
1515 
1616 /**
1717  *  This class shouldn't have a 'TableSorter', it should defer to some
------
2525  *  class could build it's own atm and tablesorter.  --  BUGBUG
2626  */
2727 public class Auctions implements TimerHandler.WakeupProcess {
28   boolean _selling = false;
2928   boolean _complete = false;
3029 //  private volatile TableSorter _tSort;
3130   private AuctionList mList;
------
4342     return _name;
4443   }
4544 
46   public void setSelling() { _selling = true; }
47   public boolean isSelling() { return _selling; }
4845   public void setComplete() { _complete = true; }
4946   public boolean isCompleted() { return _complete; }
5047 
5148   /**
52    * Search for an AuctionEntry in our tables, given it's identifier.
53    * 
54    * @param whatIdentifier - The identifier to search for.
55    * 
56    * @return - The AuctionEntry, if it's found, or null if none was found.
57    */
58   public EntryInterface getEntry(final String whatIdentifier) {
59     return mList.find(new Comparison() {
60       public boolean match(Object o) {
61         if (o instanceof EntryInterface) {
62           EntryInterface ae = (EntryInterface) o;
63           if (whatIdentifier.equals(ae.getIdentifier())) {
64             return true;
65           }
66         }
67         return false;
68       }
69     });
70   }
71 
72   /**
7349    * Add an AuctionEntry that has already been created, denying
7450    * previously deleted items.
7551    * 
------
8157     return aeNew != null && !DeletedEntry.exists(aeNew.getIdentifier());
8258   }
8359 
84   /**
85    * Verify that the auction provided exists.
86    * 
87    * @param auctionId - The auction ID to search for.
88    * 
89    * @return - true if the auction is in the list, false otherwise.
90    */
91   public boolean verifyEntry(String auctionId) {
92     EntryInterface ae = getEntry(auctionId);
93 
94     return (ae != null);
95   }
96 
9760   /** 
98    * Verify that the auction provided exists.
99    * 
100    * @param ae - The auction entry to search for.
101    * 
102    * @return - true if the auction is in the list, false otherwise.
103    */
104   public boolean verifyEntry(final EntryInterface ae) {
105     Object result = mList.find(new Comparison() {
106       public boolean match(Object o) { //noinspection ObjectEquality
107         return o == ae; }
108     });
109     return result != null;
110   }
111 
112   /** 
11361    * For display during updates, we want the title and potentially the
11462    * comment, to display all that in the status bar while we're
11563    * updating.
------
13583    * completed), and then let the user know we finished.
13684    * 
13785    * @param ae - The auction to update.
138    * @return - true if the auction was moved to another category, false otherwise.
13986    */
140   private boolean doUpdate(AuctionEntry ae) {
87   private void doUpdate(AuctionEntry ae) {
14188     String titleWithComment = getTitleAndComment(ae);
14289 
14390     if(!ae.isComplete() || ae.isUpdateForced()) {
------
14592       ae.setUpdating();
14693       MQFactory.getConcrete("redraw").enqueue(ae.getIdentifier());
14794       Thread.yield();
148       XMLElement before = ae.toXML();
95       XMLInterface before = ae.toXML();
14996       ae.update();
150       XMLElement after = ae.toXML();
97       XMLInterface after = ae.toXML();
15198       ae.clearUpdating();
15299       if (!(after.toString().equals(before.toString()))) {
153100         MQFactory.getConcrete("upload").enqueue(ae.getIdentifier());
------
157104       MQFactory.getConcrete("redraw").enqueue(ae.getIdentifier());
158105       MQFactory.getConcrete("Swing").enqueue("Done updating " + Auctions.getTitleAndComment(ae));
159106     }
160     return false;
161107   }
162108 
163109   /** 
------
171117    */
172118   private boolean doNextUpdate() {
173119     AuctionEntry result = mList.find(new Comparison() {
174       public boolean match(Object o) { if(o == null) return false; return ((AuctionEntry) o).checkUpdate(); }
120       public boolean match(Object o) { return o != null && ((AuctionEntry) o).checkUpdate();  }
175121     });
176122     if (result != null) {
177123       boolean forcedUpdate = result.isUpdateForced();
178124 
179       if(doUpdate(result) || forcedUpdate) {
125       doUpdate(result);
126       if(forcedUpdate) {
180127         MQFactory.getConcrete("redraw").enqueue(getName());
181128       }
182129     }
526 1000  
33 import com.jbidwatcher.util.html.JHTML;
44 import com.jbidwatcher.util.http.CookieJar;
55 import com.jbidwatcher.util.Currency;
6 import com.jbidwatcher.auction.AuctionEntry;
76 
87 /**
98  * Created by IntelliJ IDEA.
------
1413  * Abstraction of the bidding interface, so it can be replaced with other bidding code, if desired.
1514  */
1615 public interface Bidder {
17   JHTML.Form getBidForm(CookieJar cj, AuctionEntry inEntry, Currency inCurr, int inQuant) throws com.jbidwatcher.auction.BadBidException;
16   JHTML.Form getBidForm(CookieJar cj, AuctionEntry inEntry, Currency inCurr) throws com.jbidwatcher.auction.BadBidException;
1817 
1918   int buy(AuctionEntry ae, int quantity);
2019 
729 1000  
55  * User: Morgan
66  * Date: Jan 14, 2009
77  * Time: 4:10:53 AM
8  * To change this template use File | Settings | File Templates.
8  * All 'entry' objects have 'getIdentifier' as a method.
99  */
1010 public interface EntryInterface extends Snipeable {
1111   /**
688 1000  
11 package com.jbidwatcher.auction;
22 
3 import com.jbidwatcher.auction.server.AuctionServer;
4 
53 /**
64  * Created by IntelliJ IDEA.
75  * User: Morgan
86  * Date: Jun 29, 2008
97  * Time: 11:59:12 PM
10  * To change this template use File | Settings | File Templates.
8  *
9  * The resolver really exists to abstract the AuctionServerManager's key function: getting the default server.
1110  */
1211 public interface Resolver {
1312   AuctionServerInterface getServer();
800 1000  
9898     //  Get Bid Key/Form
9999     try {
100100       JConfig.increment("stats.presniped");
101       mBidForm = mBidder.getBidForm(mCJ, mEntry, mEntry.getSnipeAmount(), mEntry.getSnipeQuantity());
101       mBidForm = mBidder.getBidForm(mCJ, mEntry, mEntry.getSnipeAmount());
102102     } catch (BadBidException bbe) {
103103       String result = getSnipeResult(bbe.getResult(), mEntry.getTitle(), mEntry);
104104       mEntry.setLastStatus(result);
------
116116     if(snipeResult == AuctionServerInterface.BID_WINNING || snipeResult == AuctionServerInterface.BID_SELFWIN) {
117117       snipeOutput = "Successfully sniped a high bid on " + aucTitle + '!';
118118       JConfig.increment("stats.sniped.success");
119     } else if(snipeResult == AuctionServerInterface.BID_DUTCH_CONFIRMED) {
120       snipeOutput = "Successfully sniped a high dutch bid on " + aucTitle + '!';
121       JConfig.increment("stats.sniped.success");
122119     } else {
123120       switch(snipeResult) {
124121         case AuctionServerInterface.BID_ERROR_UNKNOWN:
681 1000  
2121     NOT_ADULT,
2222     BAD_TITLE,
2323     SELLER_AWAY,
24     ERROR,
2524     CAPTCHA,
2625     DELETED,
2726     WRONG_SITE
995 1000  
99 import com.jbidwatcher.util.xml.XMLElement;
1010 import com.jbidwatcher.util.xml.XMLParseException;
1111 import com.jbidwatcher.util.xml.XMLSerialize;
12 import com.jbidwatcher.util.xml.XMLInterface;
1213 
1314 import java.util.ArrayList;
1415 import java.util.Date;
------
5152    * 
5253    * @param curElement - The current element to load the events from.
5354    */
54   public void fromXML(XMLElement curElement) {
55     Iterator<XMLElement> logStep = curElement.getChildren();
55   public void fromXML(XMLInterface curElement) {
56     Iterator<XMLInterface> logStep = curElement.getChildren();
5657 
5758     while(logStep.hasNext()) {
58       XMLElement curEntry = logStep.next();
59       XMLElement curEntry = (XMLElement)logStep.next();
5960 
6061       if(curEntry.getTagName().equals("entry")) {
6162         long msgtime = System.currentTimeMillis();
6263         String msg = "Nothing has happened.";
6364         int curCount = Integer.parseInt(curEntry.getProperty("COUNT"));
6465 
65         Iterator<XMLElement> entryStep = curEntry.getChildren();
66         Iterator<XMLInterface> entryStep = curEntry.getChildren();
6667         while(entryStep.hasNext()) {
67           XMLElement entryField = entryStep.next();
68           XMLElement entryField = (XMLElement)entryStep.next();
6869           if(entryField.getTagName().equals("message")) msg = entryField.getContents();
6970           if(entryField.getTagName().equals("date")) msgtime = Long.parseLong(entryField.getContents());
7071         }
962 1000  
77 
88 /*
99  * @file   AuctionServer.java
10  * @author Morgan Schweers <cyberfox@users.sourceforge.net>
10  * @author Morgan Schweers <cyberfox@jbidwatcher.com>
1111  * @date   Wed Oct  9 13:49:02 2002
1212  * @note   Library GPL'ed.
1313  * @brief  This is an interface description for the general auction Servers
------
5656   public abstract void addSearches(SearchManagerInterface searchManager);
5757 
5858   //  Exposed to AuctionEntry for checking high bidder status.
59   public abstract boolean isHighDutch(EntryInterface inAE);
6059   public abstract void updateHighBid(AuctionEntry ae);
6160 
6261   public abstract void setSnipe(AuctionEntry snipeOn);
------
358357     }
359358   }
360359 
361   public int getCount() {
362     return AuctionEntry.count();
363   }
364 
365360   protected abstract String getUserId();
366361 
367362   /**
893 1000  
1111 import com.jbidwatcher.util.xml.XMLElement;
1212 import com.jbidwatcher.util.xml.XMLParseException;
1313 import com.jbidwatcher.util.xml.XMLSerialize;
14 import com.jbidwatcher.util.xml.XMLInterface;
1415 import com.jbidwatcher.util.config.JConfig;
1516 import com.jbidwatcher.util.StringTools;
1617 import com.jbidwatcher.auction.*;
------
4849    * @param inXML - The XML source to load from.
4950    * @noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException,StringContatenationInLoop
5051    */
51   public void fromXML(XMLElement inXML) {
52     Iterator<XMLElement> serversStep = inXML.getChildren();
52   public void fromXML(XMLInterface inXML) {
53     Iterator<XMLInterface> serversStep = inXML.getChildren();
5354 
5455     while(serversStep.hasNext()) {
55       XMLElement perServer = serversStep.next();
56       XMLInterface perServer = serversStep.next();
5657       //  Only process the 'server' entries.
5758       if(perServer.getTagName().equals("server")) {
5859         AuctionServer newServer = null;
------
251252     }
252253   }
253254 
254   private void getServerAuctionEntries(AuctionServer newServer, XMLElement perServer) {
255   private void getServerAuctionEntries(AuctionServer newServer, XMLInterface perServer) {
255256     try {
256       Iterator<XMLElement> entryStep = perServer.getChildren();
257       Iterator<XMLInterface> entryStep = perServer.getChildren();
257258       int count = 0;
258259       while (entryStep.hasNext()) {
259         XMLElement perEntry = entryStep.next();
260         XMLInterface perEntry = entryStep.next();
260261         AuctionEntry ae = new AuctionEntry();
261262 
262263         ae.setServer(newServer);
990 1000  
798798 
799799   private void checkHighBidder() {
800800     String bidder = null;
801     String email = null;
802801 
803802     if(mDocument.grep("This is a private listing.*") != null) {
804803       bidder = "(private)";
------
809808         if (bidder != null) {
810809           setNumBids(1);
811810           bidder = bidder.trim();
812           email = findHighBidderEmail(bidder);
813811         }
814812       } else {
815813         if (getQuantity() > 1) {
------
819817             bidder = mDocument.getNextContentAfterRegex(T.s("ebayServer.highBidder"));
820818             if (bidder != null) {
821819               bidder = bidder.trim();
822               email = findHighBidderEmail(bidder);
823820             } else {
824821               bidder = "(unknown)"; //  ...but present.
825822             }
------
829826     }
830827 
831828     setHighBidder(bidder == null ? "" : bidder);
832     setHighBidderEmail(email == null ? "(unknown)" : email);
833829   }
834830 
835   private String findHighBidderEmail(String bidder) {
836     String email = null;
837 
838     if(bidder != null) {
839       email = mDocument.getNextContentAfterContent(bidder, true, false);
840       if (email != null) {
841         email = email.trim();
842         if (email.charAt(0) == '(' && email.charAt(email.length() - 1) == ')' && email.indexOf('@') != -1) {
843           email = (email.substring(1, email.length() - 1));
844         }
845         if (email.equals("(")) email = null;
846       }
847     }
848 
849     return email;
850   }
851 
852831   private int getBidCount(JHTML doc, int quantity) {
853832     String rawBidCount = doc.getNextContentAfterRegex(T.s("ebayServer.bidCount"));
854833     if (rawBidCount == null) {
968 1000  
1111 import com.jbidwatcher.util.*;
1212 import com.jbidwatcher.util.config.JConfig;
1313 import com.jbidwatcher.util.queue.MQFactory;
14 import com.jbidwatcher.my.MyJBidwatcher;
14 //import com.jbidwatcher.my.MyJBidwatcher;
1515 
1616 import java.net.URLConnection;
1717 import java.io.IOException;
------
5353       mResultHash.put("your bid must be at least ", AuctionServer.BID_ERROR_TOO_LOW); /*?*/
5454       mResultHash.put("you('ve| have) been outbid by another bidder", AuctionServer.BID_ERROR_OUTBID);
5555       mResultHash.put("you('ve| have) just been outbid", ebayServer.BID_ERROR_OUTBID);
56       mResultHash.put("your bid is confirmed!", AuctionServer.BID_DUTCH_CONFIRMED);
57       mResultHash.put("you('re| are) bidding on this multiple item auction", AuctionServer.BID_DUTCH_CONFIRMED);
58       mResultHash.put("you('re| are) the high bidder on all items you bid on", AuctionServer.BID_DUTCH_CONFIRMED);
5956       mResultHash.put("you('re| are) the current high bidder", AuctionServer.BID_WINNING);
6057       mResultHash.put("you('re| are) the first bidder", AuctionServer.BID_WINNING);
6158       mResultHash.put("you('re| are) the high bidder and currently in the lead", AuctionServer.BID_WINNING);
------
9895    * @param cj - The cookies for the current session.
9996    * @param inEntry - The auction being bid on.
10097    * @param inCurr - The amount to bid.
101    * @param inQuant - The quantity to bid on (if it's a dutch auction, 1 otherwise).
102    *
10398    * @return - A Form object containing all the input fields from the bid-confirmation page's form.
10499    *
105100    * @throws BadBidException - If there's some kind of an error on the bid confirmation page.
106101    */
107   public JHTML.Form getBidForm(CookieJar cj, AuctionEntry inEntry, Currency inCurr, int inQuant) throws BadBidException {
102   public JHTML.Form getBidForm(CookieJar cj, AuctionEntry inEntry, Currency inCurr) throws BadBidException {
108103     String bidRequest = Externalized.getString("ebayServer.protocol") + T.s("ebayServer.bidHost") + Externalized.getString("ebayServer.V3file");
109     String bidInfo = getBidInfoURL(inEntry, inCurr, inQuant);
104     String bidInfo = getBidInfoURL(inEntry, inCurr);
110105     BidFormReturn rval = null;
111106 
112107     try {
------
135130       checkSignOn(rval.getDocument());
136131       checkBidErrors(rval);
137132     }
133 //    TODO -- Move this to a registered 'alternative parsing' class, which iterates over objects calling recognizeBidPage until getting a positive result, or running out.
134 //    if(JConfig.queryConfiguration("my.jbidwatcher.enabled", "false").equals("true") &&
135 //       JConfig.queryConfiguration("my.jbidwatcher.id") != null) {
136 //      String recognize = MyJBidwatcher.getInstance().recognizeBidpage(inEntry.getIdentifier(), rval.getBuffer());
137 //      Integer remote_result = null;
138 //      try {
139 //        remote_result = Integer.parseInt(recognize);
140 //      } catch(NumberFormatException nfe) {
141 //        //  Ignore it for now...
142 //        JConfig.log().logDebug(recognize);
143 //      }
144 //
145 //      if(remote_result != null && remote_result != AuctionServer.BID_ERROR_UNKNOWN) {
146 //        throw new BadBidException("Remote-checked result", remote_result);
147 //      }
148 //    }
138149 
139     if(JConfig.queryConfiguration("my.jbidwatcher.enabled", "false").equals("true") &&
140        JConfig.queryConfiguration("my.jbidwatcher.id") != null) {
141       String recognize = MyJBidwatcher.getInstance().recognizeBidpage(inEntry.getIdentifier(), rval.getBuffer());
142       Integer remote_result = null;
143       try {
144         remote_result = Integer.parseInt(recognize);
145       } catch(NumberFormatException nfe) {
146         //  Ignore it for now...
147         JConfig.log().logDebug(recognize);
148       }
149 
150       if(remote_result != null && remote_result != AuctionServer.BID_ERROR_UNKNOWN) {
151         throw new BadBidException("Remote-checked result", remote_result);
152       }
153     }
154 
155150     if(JConfig.debugging) inEntry.setLastStatus("Failed to bid. 'Show Last Error' from context menu to see the failure page from the bid attempt.");
156151     JConfig.log().dump2File("unknown-" + inEntry.getIdentifier() + ".html", rval.getBuffer());
157152     inEntry.setErrorPage(rval.getBuffer());
------
174169     return pageName;
175170   }
176171 
177   private String getBidInfoURL(AuctionEntry inEntry, Currency inCurr, int inQuant) {
172   private String getBidInfoURL(AuctionEntry inEntry, Currency inCurr) {
178173     String bidInfo = Externalized.getString("ebayServer.bidCmd") + "&co_partnerid=" + Externalized.getString("ebayServer.itemCGI") + inEntry.getIdentifier() + "&fb=2";
179     if(inEntry.isDutch()) {
180       bidInfo += Externalized.getString("ebayServer.quantCGI") + inQuant;
181     }
182174     bidInfo += Externalized.getString("ebayServer.bidCGI") + inCurr.getValue();
183175     return bidInfo;
184176   }
------
311303     JHTML.Form bidForm;
312304 
313305     try {
314       bidForm = getBidForm(cj, inEntry, inBid, inQuantity);
306       bidForm = getBidForm(cj, inEntry, inBid);
315307     } catch(BadBidException bbe) {
316308       UpdateBlocker.endBlocking();
317309       return bbe.getResult();
969 1000  
303303     }
304304   }
305305 
306   private boolean checkSecurityConfirmation(JHTML doc) throws IOException, CaptchaException {
306   private boolean checkSecurityConfirmation(JHTML doc) throws CaptchaException {
307307     if(doc.grep(T.s("security.measure")) != null ||
308308        doc.grep(T.s("enter.verification.code")) != null ||
309309        doc.grep(T.s("enter.a.verification.code.to.continue")) != null ||
997 1000  
9393    *
9494    */
9595   public ServerMenu establishMenu() {
96     ebayServerMenu esm = new ebayServerMenu(this, Constants.EBAY_DISPLAY_NAME, 'b');
96     ServerMenu esm = new ebayServerMenu(this, Constants.EBAY_DISPLAY_NAME, 'b');
9797     esm.initialize();
9898 
9999     return esm;
100100   }
101101 
102   /**
103    * @brief Very simplistic check to see if the current user is the
104    * high bidder on a Dutch item.
105    *
106    * This only works, really, on closed items, I believe.  It shows
107    * you as a 'winner' always, otherwise.
108    *
109    * @param inAE - The auction entry to check.
110    *
111    * @return - true if the user is one of the high bidders on a dutch item, false otherwise.
112    */
113   public boolean isHighDutch(EntryInterface inAE) {
114     String dutchWinners = Externalized.getString("ebayServer.protocol") + T.s("ebayServer.dutchRequestHost") + Externalized.getString("ebayServer.V3WS3File") + Externalized.getString("ebayServer.viewDutch") + inAE.getIdentifier();
115     CookieJar cj = mLogin.getNecessaryCookie(false);
116     String userCookie = null;
117     if (cj != null) userCookie = cj.toString();
118 
119     JHTML htmlDocument = new JHTML(dutchWinners, userCookie, mCleaner);
120     String matchedName = null;
121     if(htmlDocument.isLoaded()) {
122       matchedName = htmlDocument.getNextContentAfterContent(mLogin.getUserId());
123     }
124 
125     return matchedName != null;
126   }
127 
128102   public void updateHighBid(AuctionEntry ae) {
129103     String bidHistory = Externalized.getString("ebayServer.protocol") + T.s("ebayServer.bidHost") + Externalized.getString("ebayServer.V3file") + Externalized.getString("ebayServer.viewBidsCGI") + ae.getIdentifier();
130104     CookieJar cj = mLogin.getNecessaryCookie(false);
------
359333         }
360334 
361335         //  These two are called by sniping.
362         public JHTML.Form getBidForm(CookieJar cj, AuctionEntry inEntry, Currency inCurr, int inQuant) throws BadBidException {
336         public JHTML.Form getBidForm(CookieJar cj, AuctionEntry inEntry, Currency inCurr) throws BadBidException {
363337           return new JHTML.Form("<form action=\"http://example.com\">");
364338         }
365339 
------
461435     return new ebayAuction(T);
462436   }
463437 
464   /**
465    * @brief Returns the amount of time it takes to retrieve a page
466    * from the auction server.
467    *
468    * @return The amount of milliseconds it takes to get a simple page
469    * from the auction server.
470    */
471   private long getSnipePadding() {
472     return 1;
473   }
474 
475438   public StringBuffer getAuction(String id) throws FileNotFoundException {
476439     long pre = System.currentTimeMillis();
477440     StringBuffer sb = getAuction(getURLFromItem(id));
------
534497     if(s == null) searchManager.addSearch("My Items", "My eBay", "", Constants.EBAY_SERVER_NAME, -1, 1);
535498   }
536499 
537   /**
538    * @brief Get the list of bidders on an item.
539    *
540    * This is primarily useful for networks-of-interest searching.
541    *
542    * @param ae - The item you are interested in.
543    *
544    * @return - A list containing strings with the names of each
545    * user who was interested in the item enough to bid.
546    */
547   public List<String> getBidderNames(EntryInterface ae) {
548     CookieJar cj = mLogin.getNecessaryCookie(false);
549     String userCookie = null;
550     if (cj != null) userCookie = cj.toString();
551     JHTML htmlDocument = new JHTML(Externalized.getString("ebayServer.protocol") + T.s("ebayServer.bidderNamesHost") + Externalized.getString("ebayServer.file") + Externalized.getString("ebayServer.viewBidsCGI") + ae.getIdentifier(), userCookie, mCleaner);
552 
553     String curName = htmlDocument.getNextContentAfterContent(T.s("ebayServer.bidListPrequel"));
554 
555     if(curName == null) {
556       JConfig.log().logMessage("Problem with loaded page when getting bidder names for auction " + ae.getIdentifier());
557       return null;
558     }
559 
560     List<String> outNames = new ArrayList<String>();
561 
562     do {
563       if(!outNames.contains(curName)) {
564         outNames.add(curName);
565       }
566       curName = htmlDocument.getNextContent();
567       while(curName != null && ! (curName.endsWith("PDT") || curName.endsWith("PST"))) {
568         curName = htmlDocument.getNextContent();
569       }
570       if(curName != null) curName = htmlDocument.getNextContent();
571       if(curName != null) {
572         if(curName.indexOf(T.s("ebayServer.earlierCheck")) != -1) curName = null;
573       }
574     } while(curName != null);
575 
576     return outNames;
577   }
578 
579500   private void doMyEbaySynchronize(String label) {
580501     MQFactory.getConcrete("Swing").enqueue("Synchronizing with My eBay...");
581502     mSearcher.getMyEbayItems(mLogin.getUserId(), label);
------
689610   }
690611 
691612   public long getAdjustedTime() {
692     return System.currentTimeMillis() + getServerTimeDelta() + getPageRequestTime() + getSnipePadding();
613     return System.currentTimeMillis() + getServerTimeDelta() + getPageRequestTime();
693614   }
694615 
695616   public long getServerTimeDelta() {
981 1000  
1212 import com.jbidwatcher.util.queue.SuperQueue;
1313 import com.jbidwatcher.util.xml.XMLSerialize;
1414 import com.jbidwatcher.util.xml.XMLElement;
15 import com.jbidwatcher.util.xml.XMLInterface;
1516 import com.jbidwatcher.util.http.Http;
1617 import com.jbidwatcher.util.http.ClientHttpRequest;
1718 import com.jbidwatcher.auction.AuctionEntry;
------
250251     if(sb == null) return false;
251252     XMLElement xml = new XMLElement();
252253     xml.parseString(sb.toString());
253     XMLElement sync = xml.getChild("syncq");
254     XMLElement expires = xml.getChild("expiry");
255     XMLElement listingsRemaining = xml.getChild("listings");
256     XMLElement categoriesRemaining = xml.getChild("categories");
257     XMLElement reporting = xml.getChild("reportq");
258     XMLElement snipesListen = xml.getChild("snipes");
259     XMLElement ssl = xml.getChild("ssl");
260     XMLElement uploadHTML = xml.getChild("uploadhtml");
261     XMLElement serverParser = xml.getChild("parser");
262     XMLElement gixen = xml.getChild("gixen");
254     XMLInterface sync = xml.getChild("syncq");
255     XMLInterface expires = xml.getChild("expiry");
256     XMLInterface listingsRemaining = xml.getChild("listings");
257     XMLInterface categoriesRemaining = xml.getChild("categories");
258     XMLInterface reporting = xml.getChild("reportq");
259     XMLInterface snipesListen = xml.getChild("snipes");
260     XMLInterface ssl = xml.getChild("ssl");
261     XMLInterface uploadHTML = xml.getChild("uploadhtml");
262     XMLInterface serverParser = xml.getChild("parser");
263     XMLInterface gixen = xml.getChild("gixen");
263264 
264265     if(expires != null) {
265266       String date = expires.getContents();
------
291292     return mSyncQueueURL != null && mReportQueueURL != null;
292293   }
293294 
294   private boolean getBoolean(XMLElement x) {
295   private boolean getBoolean(XMLInterface x) {
295296     boolean rval = false;
296297     if(x != null) {
297298       String contents = x.getContents();
530 1000  
22 
33 import com.jbidwatcher.auction.Auctions;
44 
5 import javax.swing.*;
65 import java.awt.Color;
76 import java.awt.event.ActionListener;
87 
------
2625     return mDeletable;
2726   }
2827 
29   public void setDeletable(boolean deletable) {
30     mDeletable = deletable;
31   }
32 
3328   AuctionListHolder(String name) {
34     this(name, false, false, true);
29     this(name, false, true);
3530   }
3631 
3732   AuctionListHolder(String name, Color presetBackground) {
38     this(name, false, false, true);
33     this(name, false, true);
3934     mAuctionUI.setBackground(presetBackground);
4035   }
4136 
42   AuctionListHolder(String name, boolean _completed, boolean _selling, boolean deletable) {
37   AuctionListHolder(String name, boolean _completed, boolean deletable) {
4338     mAuctionList = new Auctions(name);
4439     if(_completed) mAuctionList.setComplete();
45     if(_selling) mAuctionList.setSelling();
4640     mAuctionUI = new AuctionsUIModel(mAuctionList, sTableContext, sFrameContext, sCornerButtonListener);
4741     mDeletable = deletable;
4842     JTabManager.getInstance().add(name, mAuctionUI.getPanel(), mAuctionUI.getTableSorter());
974 1000  
156156     return FilterManager.getInstance().getAuctionIterator();
157157   }
158158 
159   public void loadAuctionsFromDB() {
160     int auctionTotal = AuctionServerManager.getInstance().getServer().getCount();
161     MQFactory.getConcrete("splash").enqueue("SET 0");
162     MQFactory.getConcrete("splash").enqueue("WIDTH " + auctionTotal);
163 
164     MQFactory.getConcrete("splash").enqueue("SET 100");
165   }
166 
167159   /**
168160    * @brief Load auctions from a save file, with a pretty splash
169161    * screen and everything, if necessary.
------
304296       if(newSaveFile.exists()) newSaveFile.delete();
305297     }
306298 
307     StringBuffer buf = buildSaveBuffer(auctionsData, null);
299     StringBuffer buf = buildSaveBuffer(auctionsData);
308300     boolean saveDone = true;
309301 
310302     //  Dump the save file out!
------
344336     if(!saveParent.exists()) saveParent.mkdirs(); //  This can fail, but we don't mind.
345337   }
346338 
347   public static StringBuffer buildSaveBuffer(XMLElement auctionsData, XMLElement deletedData) {
339   public static StringBuffer buildSaveBuffer(XMLElement auctionsData) {
348340     synchronized(_saveBuf) {
349341       _saveBuf.setLength(0);
350342       _saveBuf.append("<?xml version=\"1.0\"?>\n\n");
------
352344       _saveBuf.append('\n');
353345       _saveBuf.append("<jbidwatcher format=\"0101\">\n");
354346       auctionsData.toStringBuffer(_saveBuf, 1);
355       if(deletedData != null) {
356         deletedData.toStringBuffer(_saveBuf, 1);
357       }
358347       _saveBuf.append("</jbidwatcher>");
359348     }
360349     return _saveBuf;