1 /* 2 * Copyright 2006, Ryan Leavengood, leavengood@gmail.com. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <Entry.h> 8 #include <Message.h> 9 #include <Node.h> 10 #include <String.h> 11 #include <TrackerAddOn.h> 12 13 14 extern "C" void 15 process_refs(entry_ref dir, BMessage* msg, void* /*reserved*/) 16 { 17 int32 refs; 18 entry_ref ref; 19 BString status(STATUS_HERE); 20 // The above will be substituted with a real value (such as "New" or 21 // "Read") by a #define and #include in another file. This is done 22 // to avoid duplicate code. 23 BString type; 24 25 for (refs = 0; msg->FindRef("refs", refs, &ref) == B_NO_ERROR; refs++) { 26 BNode node(&ref); 27 if ((node.InitCheck() == B_NO_ERROR) 28 && (node.ReadAttrString("BEOS:TYPE", &type) == B_NO_ERROR) 29 && (type == "text/x-email")) 30 node.WriteAttrString("MAIL:status", &status); 31 } 32 } 33 34