1mail::account::findFoldmeari(l3:x:)account Native API refmearieln:c:eaccount::findFolder(3x)
2
3
4
6 mail::account::findFolder - A direct short-cut to a folder
7
9 #include <libmail/mail.H>
10
11
12 class myCallback : public mail::callback {
13 public:
14 void success(std::string msg);
15 void fail(std::string msg);
16 };
17
18 class myFolderCallback : public mail::callback::folderlist {
19 public:
20 void success(const std::vector<const mail::folder *> &folders);
21 };
22
23 mail::account *account;
24
25 mail::folder *folder;
26
27 std::string folderPath=folder->getPath();
28
29
30
31 mail::folder *folder=account->findFolder (std::string folderPath,
32 myFolderCallback &folderCallback, myCallback &callback);
33
35 This function is very similar to mail::account::folderFromString(3x).
36 mail::account::findFolder recreates a mail::folder object, given its
37 server path (which is returned by mail::folder::getPath(3x). The dif‐
38 ferences between mail::account::findFolder and mail::account::folder‐
39 FromString are:
40
41 · mail::account::folderFromString uses a string created by
42 mail::account::folder::toString, which includes all of the folder's
43 properties (such as whether the folder contains messages, subfolders,
44 or both, and its canonical name). mail::account::findFolder uses
45 only the folder's "path", or "address" on the server.
46
47 Note: The application must not destroy folderCallback until this
48 request fails or succeeds. folderCallback's success method is
49 invoked just before the callback's success method.
50
51 The folderCallback.success method receives a vector with a single
52 pointer mail::folder object, that's initialized to represent the folder
53 referenced by folderPath.
54
56 The application must wait until callback's success or fail method is
57 invoked. The success method is invoked when this request is succes‐
58 fully processed. The fail method is invoked if this request cannot be
59 processed. The application must not destroy callback until either the
60 success or fail method is invoked.
61
62 Note: callback's fail method may be invoked even after other
63 callback methods were invoked. This indicates that the request
64 was partially completed before the error was encountered.
65
66 Note: The folderCallback.success method receives a (possibly
67 empty) vector of pointers to mail::folder objects. These
68 objects will be destroyed when folderCallback.success termi‐
69 nates. The application must use mail::folder::clone(3x) to cre‐
70 ate copies of mail::folder objects it wants to use later.
71
72 Note: Both folderCallback.success and myCallback.success method
73 will be invoked if this request succeeds. folderCallback.suc‐
74 cess will be invoked before myCallback.success (since by defini‐
75 tion this indicates that the request has been completed).
76
77 Note: mail::folders are linked to their corresponding
78 mail::accounts. A mail::folder created by one mail::account may
79 not be used with a different mail::folder. All mail::folders
80 created by a mail::account are invalidated when this
81 mail::account object is destroyed. Note that the mail::folder
82 objects are not automatically destroyed; the application is
83 still responsible for destroying any remaining mail::folders,
84 after their a mail::account is destroyed.
85
87 mail::account::folderFromString(3x).
88
89
90
91 10 April 2006 mail::account::findFolder(3x)