1 /*
2 ** Copyright 2002, Double Precision Inc.
3 **
4 ** See COPYING for distribution information.
5 */
6 #ifndef libmail_addressbookadd_H
7 #define libmail_addressbookadd_H
8 
9 #include "addressbook.H"
10 #include "structure.H"
11 #include "addmessage.H"
12 
13 //
14 // Add new address book entry.
15 
16 class mail::addressbook::Add : public mail::callback::message {
17 
18 	mail::ptr<mail::addressbook> addressBook;
19 
20 	size_t totCnt;
21 	size_t currentNum;
22 
23 	std::list<mail::addressbook::Entry> newEntries;
24 	std::string oldUid;
25 	mail::callback &callback;
26 
27 	mail::addMessage *addMessage;
28 	size_t dummyRet;
29 
30 	std::string nickname;
31 	std::vector<size_t> multipart_params;
32 
33 	void success(std::string successMsg);
34 	void (mail::addressbook::Add::*successFunc)(std::string);
35 	void addedIntro(std::string successMsg);
36 	void addedBeef(std::string successMsg);
37 	void addedAll(std::string successMsg);
38 	void added(std::string successMsg);
39 	void checked(std::string successMsg);
40 	void reindexed(std::string successMsg);
41 
42 	void fail(std::string failMsg);
43 
44 	void messageEnvelopeCallback(size_t messageNumber,
45 				     const class mail::envelope &envelope);
46 	void reportProgress(size_t bytesCompleted,
47 			    size_t bytesEstimatedTotal,
48 
49 			    size_t messagesCompleted,
50 			    size_t messagesEstimatedTotal);
51 public:
52 	Add(mail::addressbook *addressBookArg,
53 	    mail::addressbook::Entry entryArg,
54 	    std::string oldUidArg,
55 	    mail::callback &callbackArg);
56 
57 	Add(mail::addressbook *addressBookArg,
58 	    std::list<mail::addressbook::Entry> &entries,
59 	    mail::callback &callbackArg);
60 	~Add();
61 
62 	void go();
63 };
64 
65 #endif
66