From 2cec29dba0611d361d24d7f058e5231bf93cc798 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Wed, 9 Feb 2011 01:55:00 +0000 Subject: [PATCH] Remove unused system_filters directory. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40400 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../mail_daemon/system_filters/Jamfile | 7 - .../mail_daemon/system_filters/inbox/Jamfile | 22 - .../system_filters/inbox/filter.cpp | 414 ------------------ .../system_filters/notifier/ConfigView.cpp | 160 ------- .../system_filters/notifier/ConfigView.h | 34 -- .../system_filters/notifier/Jamfile | 22 - .../system_filters/notifier/filter.cpp | 141 ------ .../mail_daemon/system_filters/outbox/Jamfile | 22 - .../system_filters/outbox/filter.cpp | 108 ----- .../mail_daemon/system_filters/parser/Jamfile | 22 - .../system_filters/parser/filter.cpp | 91 ---- .../system_filters/parser/retest.cpp | 22 - .../system_filters/parser/subjects | 24 - .../system_filters/parser/thread.cpp | 1 - 14 files changed, 1090 deletions(-) delete mode 100644 src/add-ons/mail_daemon/system_filters/Jamfile delete mode 100644 src/add-ons/mail_daemon/system_filters/inbox/Jamfile delete mode 100644 src/add-ons/mail_daemon/system_filters/inbox/filter.cpp delete mode 100644 src/add-ons/mail_daemon/system_filters/notifier/ConfigView.cpp delete mode 100644 src/add-ons/mail_daemon/system_filters/notifier/ConfigView.h delete mode 100644 src/add-ons/mail_daemon/system_filters/notifier/Jamfile delete mode 100644 src/add-ons/mail_daemon/system_filters/notifier/filter.cpp delete mode 100644 src/add-ons/mail_daemon/system_filters/outbox/Jamfile delete mode 100644 src/add-ons/mail_daemon/system_filters/outbox/filter.cpp delete mode 100644 src/add-ons/mail_daemon/system_filters/parser/Jamfile delete mode 100644 src/add-ons/mail_daemon/system_filters/parser/filter.cpp delete mode 100644 src/add-ons/mail_daemon/system_filters/parser/retest.cpp delete mode 100644 src/add-ons/mail_daemon/system_filters/parser/subjects delete mode 100644 src/add-ons/mail_daemon/system_filters/parser/thread.cpp diff --git a/src/add-ons/mail_daemon/system_filters/Jamfile b/src/add-ons/mail_daemon/system_filters/Jamfile deleted file mode 100644 index ca8ee79075..0000000000 --- a/src/add-ons/mail_daemon/system_filters/Jamfile +++ /dev/null @@ -1,7 +0,0 @@ -SubDir HAIKU_TOP src add-ons mail_daemon system_filters ; - -SubInclude HAIKU_TOP src add-ons mail_daemon system_filters inbox ; -SubInclude HAIKU_TOP src add-ons mail_daemon system_filters notifier ; -SubInclude HAIKU_TOP src add-ons mail_daemon system_filters outbox ; -SubInclude HAIKU_TOP src add-ons mail_daemon system_filters parser ; - diff --git a/src/add-ons/mail_daemon/system_filters/inbox/Jamfile b/src/add-ons/mail_daemon/system_filters/inbox/Jamfile deleted file mode 100644 index e2a48048ee..0000000000 --- a/src/add-ons/mail_daemon/system_filters/inbox/Jamfile +++ /dev/null @@ -1,22 +0,0 @@ -SubDir HAIKU_TOP src add-ons mail_daemon system_filters inbox ; - -SetSubDirSupportedPlatformsBeOSCompatible ; - -if $(TARGET_PLATFORM) != haiku { - UsePublicHeaders mail ; -} - -UsePrivateHeaders mail ; -UsePublicHeaders [ FDirName add-ons mail_daemon ] ; - -SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; - -Addon Inbox : - filter.cpp ; - -LinkAgainst Inbox : - be libmail.so $(TARGET_LIBSUPC++) ; - -Package haiku-maildaemon-cvs : - Inbox : - boot home config add-ons mail_daemon system_filters ; diff --git a/src/add-ons/mail_daemon/system_filters/inbox/filter.cpp b/src/add-ons/mail_daemon/system_filters/inbox/filter.cpp deleted file mode 100644 index 9a9c96e47b..0000000000 --- a/src/add-ons/mail_daemon/system_filters/inbox/filter.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/* Inbox - places the incoming mail to their destination folder -** -** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. -*/ - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -struct mail_header_field -{ - const char *rfc_name; - - const char *attr_name; - type_code attr_type; - // currently either B_STRING_TYPE and B_TIME_TYPE -}; - -static const mail_header_field gDefaultFields[] = -{ - { "To", B_MAIL_ATTR_TO, B_STRING_TYPE }, - { "From", B_MAIL_ATTR_FROM, B_STRING_TYPE }, - { "Cc", B_MAIL_ATTR_CC, B_STRING_TYPE }, - { "Date", B_MAIL_ATTR_WHEN, B_TIME_TYPE }, - { "Delivery-Date", B_MAIL_ATTR_WHEN, B_TIME_TYPE }, - { "Reply-To", B_MAIL_ATTR_REPLY, B_STRING_TYPE }, - { "Subject", B_MAIL_ATTR_SUBJECT, B_STRING_TYPE }, - { "X-Priority", B_MAIL_ATTR_PRIORITY, B_STRING_TYPE }, // Priorities with prefered - { "Priority", B_MAIL_ATTR_PRIORITY, B_STRING_TYPE }, // one first - the numeric - { "X-Msmail-Priority", B_MAIL_ATTR_PRIORITY, B_STRING_TYPE }, // one (has more levels). - { "Mime-Version", B_MAIL_ATTR_MIME, B_STRING_TYPE }, - { "STATUS", B_MAIL_ATTR_STATUS, B_STRING_TYPE }, - { "THREAD", "MAIL:thread", B_STRING_TYPE }, //---Not supposed to be used for this (we add it in Parser), but why not? - { "NAME", B_MAIL_ATTR_NAME, B_STRING_TYPE }, - { NULL, NULL, 0 } -}; - - -class FolderFilter : public BMailFilter -{ - BString dest_string; - BDirectory destination; - int32 chain_id; - BMailChainRunner *runner; - int fNumberOfFilesSaved; - int size_limit; // Messages larger than this many bytes get partially downloaded. -1 for always do full download. - - public: - FolderFilter(BMessage*,BMailChainRunner *); - virtual ~FolderFilter(); - virtual status_t InitCheck(BString *err); - virtual status_t ProcessMailMessage - ( - BPositionIO** io_message, BEntry* io_entry, - BMessage* io_headers, BPath* io_folder, const char* io_uid - ); -}; - - -FolderFilter::FolderFilter(BMessage* msg,BMailChainRunner *therunner) - : BMailFilter(msg), - chain_id(msg->FindInt32("chain")), runner(therunner), size_limit(-1) -{ - fNumberOfFilesSaved = 0; - dest_string = runner->Chain()->MetaData()->FindString("path"); - create_directory(dest_string.String(),0777); - destination = dest_string.String(); - - if (msg->FindInt32("size_limit",(long *)&size_limit) != B_OK) - size_limit = -1; -} - - -FolderFilter::~FolderFilter () -{ - // Save the disk cache to the actual disk so mail data won't get lost if a - // crash happens soon after mail has been received or sent. Mostly put - // here because of unexpected mail daemon activity during debugging of - // kernel crashing software. - - if (fNumberOfFilesSaved > 0) - sync (); -} - - -status_t FolderFilter::InitCheck(BString* err) -{ - - status_t ret = destination.InitCheck(); - - if (ret==B_OK) return B_OK; - else - { - if (err) *err - << "FolderFilter failed: destination '" << dest_string - << "' not found (" << strerror(ret) << ")."; - return ret; - } -} - -status_t FolderFilter::ProcessMailMessage(BPositionIO**io, BEntry* e, BMessage* out_headers, BPath*loc, const char* io_uid) -{ - time_t dateAsTime; - const time_t *datePntr; - ssize_t dateSize; - char numericDateString [40]; - bool tempBool; - struct tm timeFields; - BString worker; - - BDirectory dir; - - BPath path = dest_string.String(); - if (out_headers->HasString("DESTINATION")) { - const char *string; - out_headers->FindString("DESTINATION",&string); - if (string[0] == '/') - path = string; - else - path.Append(string); - } else if (loc != NULL && loc->Path() != NULL && strcmp(loc->Path(),"") != 0) // --- Don't append folder names to overridden paths - path.Append(loc->Leaf()); - - create_directory(path.Path(),0777); - dir.SetTo(path.Path()); - - BNode node(e); - status_t err = 0; - bool haveReadWholeMessage = false; - // "ENTIRE_MESSAGE" really means the user has double clicked on a partial - // message and now it should be fully read, and then displayed to the user. - if ((out_headers->FindBool("ENTIRE_MESSAGE", &tempBool) == B_OK && tempBool) - || !out_headers->HasInt32("SIZE") - || (size_limit < 0 || size_limit >= out_headers->FindInt32("SIZE"))) { - err = (*io)->Seek(0,SEEK_END); // Force protocol to read the whole message. - if (err < 0) - { - BString error; - MDR_DIALECT_CHOICE ( - error << "Unable to read whole message from server, ignoring it. " - << "Subject \"" << out_headers->FindString("Subject") - << "\", save to dir \"" << path.Path() << - "\", error code: " << err << " " << strerror(err); - , - error << out_headers->FindString("Subject") << " のメッセージを " << - path.Path() << "に保存中にエラーが発生しました" << strerror(err); - ) - runner->ShowError(error.String()); - return B_MAIL_END_FETCH; // Stop reading further mail messages. - } - haveReadWholeMessage = true; - } - - BNodeInfo info(&node); - node.Sync(); - off_t size; - node.GetSize(&size); - // Note - sometimes the actual message size is a few bytes more than the - // registered size, so use >= when testing. And sometimes the message is - // actually slightly smaller, due to POP server errors (some count double - // dots correctly, some don't, if it causes problems, you'll get a partial - // message and waste time downloading it twice). - if (haveReadWholeMessage || - (out_headers->HasInt32("SIZE") && size >= out_headers->FindInt32("SIZE"))) { - info.SetType(B_MAIL_TYPE); - // A little fixup for incorrect registered sizes, so that the full - // length attribute gets written correctly later. - if (out_headers->HasInt32("SIZE")) - out_headers->ReplaceInt32("SIZE", size); - haveReadWholeMessage = true; - } else // Don't have the whole message. - info.SetType("text/x-partial-email"); - - BMessage attributes; - - attributes.AddString("MAIL:unique_id",io_uid); - attributes.AddString("MAIL:account",BMailChain(chain_id).Name()); - attributes.AddInt32("MAIL:chain",chain_id); - - size_t length = (*io)->Position(); - length -= out_headers->FindInt32(B_MAIL_ATTR_HEADER); - if (attributes.ReplaceInt32(B_MAIL_ATTR_CONTENT,length) != B_OK) - attributes.AddInt32(B_MAIL_ATTR_CONTENT,length); - - const char *buf; - time_t when; - for (int i = 0; gDefaultFields[i].rfc_name; ++i) - { - out_headers->FindString(gDefaultFields[i].rfc_name,&buf); - if (buf == NULL) - continue; - - switch (gDefaultFields[i].attr_type){ - case B_STRING_TYPE: - attributes.AddString(gDefaultFields[i].attr_name, buf); - break; - - case B_TIME_TYPE: - when = ParseDateWithTimeZone (buf); - if (when == -1) - when = time (NULL); // Use current time if it's undecodable. - attributes.AddData(B_MAIL_ATTR_WHEN, B_TIME_TYPE, &when, sizeof(when)); - break; - } - } - - if (out_headers->HasInt32("SIZE")) { - size_t size = out_headers->FindInt32("SIZE"); - attributes.AddData("MAIL:fullsize",B_SIZE_T_TYPE,&size,sizeof(size_t)); - } - - // add "New" status, if the status hasn't been set already - if (attributes.FindString(B_MAIL_ATTR_STATUS,&buf) < B_OK) - attributes.AddString(B_MAIL_ATTR_STATUS,"New"); - - node << attributes; - - // Move the message file out of the temporary directory, else it gets - // deleted. Partial messages have already been moved, so don't move them. - if (out_headers->FindBool("ENTIRE_MESSAGE", &tempBool) != B_OK - || tempBool == false) { - err = B_OK; - if (!dir.Contains(e)) - err = e->MoveTo(&dir); - if (err != B_OK) - { - BString error; - MDR_DIALECT_CHOICE ( - error << "An error occurred while moving the message " << - out_headers->FindString("Subject") << " to " << path.Path() << - ": " << strerror(err); - , - error << out_headers->FindString("Subject") << " のメッセージを " << - path.Path() << "に保存中にエラーが発生しました" << strerror(err); - ) - runner->ShowError(error.String()); - return err; - } - } - - // Generate a file name for the incoming message. See also - // Message::RenderTo which does a similar thing for outgoing messages. - - BString name = attributes.FindString("MAIL:subject"); - SubjectToThread (name); // Extract the core subject words. - if (name.Length() <= 0) - name = "No Subject"; - if (name[0] == '.') - name.Prepend ("_"); // Avoid hidden files, starting with a dot. - - // Convert the date into a year-month-day fixed digit width format, so that - // sorting by file name will give all the messages with the same subject in - // order of date. - dateAsTime = 0; - if (attributes.FindData(B_MAIL_ATTR_WHEN, B_TIME_TYPE, - (const void **) &datePntr, &dateSize) == B_OK) - dateAsTime = *datePntr; - localtime_r(&dateAsTime, &timeFields); - sprintf(numericDateString, "%04d%02d%02d%02d%02d%02d", - timeFields.tm_year + 1900, - timeFields.tm_mon + 1, - timeFields.tm_mday, - timeFields.tm_hour, - timeFields.tm_min, - timeFields.tm_sec); - name << " " << numericDateString; - - worker = attributes.FindString("MAIL:from"); - extract_address_name(worker); - name << " " << worker; - - name.Truncate(222); // reserve space for the uniquer - - // Get rid of annoying characters which are hard to use in the shell. - name.ReplaceAll('/','_'); - name.ReplaceAll('\'','_'); - name.ReplaceAll('"','_'); - name.ReplaceAll('!','_'); - name.ReplaceAll('<','_'); - name.ReplaceAll('>','_'); - while (name.FindFirst(" ") >= 0) // Remove multiple spaces. - name.Replace(" " /* Old */, " " /* New */, 1024 /* Count */); - - int32 uniquer = time(NULL); - worker = name; - int32 tries = 20; - while ((err = e->Rename(worker.String())) == B_FILE_EXISTS && --tries > 0) { - srand(rand()); - uniquer += (rand() >> 16) - 16384; - - worker = name; - worker << ' ' << uniquer; - } - if (err < B_OK) - printf("FolderFilter::ProcessMailMessage: could not rename mail (%s)! " - "(should be: %s)\n",strerror(err),worker.String()); - - fNumberOfFilesSaved++; - if (out_headers->FindBool("ENTIRE_MESSAGE")) { - entry_ref ref; - e->GetRef(&ref); - be_roster->Launch(&ref); - } - - return B_OK; -} - - -BMailFilter* instantiate_mailfilter(BMessage* settings, BMailChainRunner *run) -{ - return new FolderFilter(settings,run); -} - -class FolderConfig : public BView { - public: - FolderConfig(BMessage *settings, BMessage *meta_data) : BView(BRect(0,0,50,50),"folder_config",B_FOLLOW_ALL_SIDES,0) { - - const char *partial_text = MDR_DIALECT_CHOICE ( - "Partially download messages larger than", - "部分ダウンロードする"); - - fPathView = new BMailFileConfigView(MDR_DIALECT_CHOICE ("Location:","受信箱:"), - "path",true,"/boot/home/mail/in"); - fPathView->SetTo(settings,meta_data); - fPathView->ResizeToPreferred(); - - BRect r(fPathView->Frame()); - r.OffsetBy(0,r.Height() + 5); - fPartialBox = new BCheckBox(r, "size_if", partial_text, new BMessage('SIZF')); - fPartialBox->ResizeToPreferred(); - - r = fPartialBox->Frame(); - r.OffsetBy(17,r.Height() + 1); - r.right = r.left + be_plain_font->StringWidth("0000") + 10; - fSizeBox = new BTextControl(r, "size", "", "", NULL); - - r.OffsetBy(r.Width() + 5,0); - fBytesLabel = new BStringView(r,"kb", "KB"); - AddChild(fBytesLabel); - fSizeBox->SetDivider(0); - if (settings->HasInt32("size_limit")) { - BString kb; - kb << int32(settings->FindInt32("size_limit")/1024); - fSizeBox->SetText(kb.String()); - fPartialBox->SetValue(B_CONTROL_ON); - } else - fSizeBox->SetEnabled(false); - AddChild(fPathView); - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - AddChild(fPartialBox); - AddChild(fSizeBox); - ResizeToPreferred(); - } - void MessageReceived(BMessage *msg) { - if (msg->what != 'SIZF') - return BView::MessageReceived(msg); - fSizeBox->SetEnabled(fPartialBox->Value()); - } - void AttachedToWindow() { - fPartialBox->SetTarget(this); - fPartialBox->ResizeToPreferred(); - } - void GetPreferredSize(float *width, float *height) { - fPathView->GetPreferredSize(width,height); -// *height = fPartialBox->Frame().bottom + 5; - *height = fBytesLabel->Frame().bottom + 5; - *width = MAX(fBytesLabel->Frame().right + 5, *width); - } - status_t Archive(BMessage *into, bool) const { - into->MakeEmpty(); - fPathView->Archive(into); - if (fPartialBox->Value()) - into->AddInt32("size_limit",atoi(fSizeBox->Text()) * 1024); - return B_OK; - } - - - private: - BMailFileConfigView *fPathView; - BTextControl *fSizeBox; - BCheckBox *fPartialBox; - BStringView *fBytesLabel; -}; - -BView* instantiate_config_panel(BMessage *settings, BMessage *meta_data) -{ - - return new FolderConfig(settings,meta_data); -} - diff --git a/src/add-ons/mail_daemon/system_filters/notifier/ConfigView.cpp b/src/add-ons/mail_daemon/system_filters/notifier/ConfigView.cpp deleted file mode 100644 index 2117bb941f..0000000000 --- a/src/add-ons/mail_daemon/system_filters/notifier/ConfigView.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* ConfigView - the configuration view for the Notifier filter -** -** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. -*/ - - -#include "ConfigView.h" - -#include -#include -#include -#include -#include -#include - -#include - -#include - -const uint32 kMsgNotifyMethod = 'nomt'; - - -ConfigView::ConfigView() - : BView(BRect(0,0,10,10),"notifier_config",B_FOLLOW_LEFT | B_FOLLOW_TOP,0) -{ - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - - // determine font height - font_height fontHeight; - GetFontHeight(&fontHeight); - float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 6; - - BRect frame(5,2,250,itemHeight + 2); - BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING,false,false); - - const char *notifyMethods[] = { - MDR_DIALECT_CHOICE ("Beep","音"), - MDR_DIALECT_CHOICE ("Alert","窓(メール毎)"), - MDR_DIALECT_CHOICE ("Keyboard LEDs","キーボードLED"), - MDR_DIALECT_CHOICE ("Central alert","窓(一括)"), - "Central beep","Log window"}; - for (int32 i = 0,j = 1;i < 6;i++,j *= 2) - menu->AddItem(new BMenuItem(notifyMethods[i],new BMessage(kMsgNotifyMethod))); - - BMenuField *field = new BMenuField(frame,"notify", - MDR_DIALECT_CHOICE ("Method:","方法:"),menu); - field->ResizeToPreferred(); - field->SetDivider(field->StringWidth( - MDR_DIALECT_CHOICE ("Method:","方法:")) + 6); - AddChild(field); - - ResizeToPreferred(); -} - - -void ConfigView::AttachedToWindow() -{ - if (BMenuField *field = dynamic_cast(FindView("notify"))) - field->Menu()->SetTargetForItems(this); -} - - -void ConfigView::SetTo(BMessage *archive) -{ - int32 method = archive->FindInt32("notification_method"); - if (method < 0) - method = 1; - - BMenuField *field; - if ((field = dynamic_cast(FindView("notify"))) == NULL) - return; - - for (int32 i = field->Menu()->CountItems();i-- > 0;) - { - BMenuItem *item = field->Menu()->ItemAt(i); - item->SetMarked((method & (1L << i)) != 0); - } - UpdateNotifyText(); -} - - -void ConfigView::UpdateNotifyText() -{ - BMenuField *field; - if ((field = dynamic_cast(FindView("notify"))) == NULL) - return; - - BString label; - for (int32 i = field->Menu()->CountItems();i-- > 0;) - { - BMenuItem *item = field->Menu()->ItemAt(i); - if (!item->IsMarked()) - continue; - - if (label != "") - label.Prepend(" + "); - label.Prepend(item->Label()); - } - if (label == "") - label = "none"; - field->MenuItem()->SetLabel(label.String()); -} - - -void ConfigView::MessageReceived(BMessage *msg) -{ - switch (msg->what) - { - case kMsgNotifyMethod: - { - msg->PrintToStream(); - BMenuItem *item; - if (msg->FindPointer("source",(void **)&item) < B_OK) - break; - - item->SetMarked(!item->IsMarked()); - UpdateNotifyText(); - break; - } - default: - BView::MessageReceived(msg); - } -} - - -status_t ConfigView::Archive(BMessage *into,bool) const -{ - int32 method = 0; - - BMenuField *field; - if ((field = dynamic_cast(FindView("notify"))) != NULL) - { - for (int32 i = field->Menu()->CountItems();i-- > 0;) - { - BMenuItem *item = field->Menu()->ItemAt(i); - if (item->IsMarked()) - method |= 1L << i; - } - } - - if (into->ReplaceInt32("notification_method",method) != B_OK) - into->AddInt32("notification_method",method); - - return B_OK; -} - - -void ConfigView::GetPreferredSize(float *width, float *height) -{ - *width = 258; - *height = ChildAt(0)->Bounds().Height() + 8; -} - -BView* instantiate_config_panel(BMessage *settings,BMessage *) -{ - ConfigView *view = new ConfigView(); - view->SetTo(settings); - - return view; -} diff --git a/src/add-ons/mail_daemon/system_filters/notifier/ConfigView.h b/src/add-ons/mail_daemon/system_filters/notifier/ConfigView.h deleted file mode 100644 index 229ed8fa0e..0000000000 --- a/src/add-ons/mail_daemon/system_filters/notifier/ConfigView.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef CONFIG_VIEW -#define CONFIG_VIEW -/* ConfigView - the configuration view for the Notifier filter -** -** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. -*/ - - -#include - -enum { - do_beep = 1, - alert = 2, - blink_leds = 4, - big_doozy_alert = 8, - one_central_beep = 16, - log_window = 32 -}; - -class ConfigView : public BView -{ - public: - ConfigView(); - void SetTo(BMessage *archive); - virtual status_t Archive(BMessage *into, bool deep = true) const; - - virtual void AttachedToWindow(); - virtual void MessageReceived(BMessage *msg); - virtual void GetPreferredSize(float *width, float *height); - - void UpdateNotifyText(); -}; - -#endif /* CONFIG_VIEW */ diff --git a/src/add-ons/mail_daemon/system_filters/notifier/Jamfile b/src/add-ons/mail_daemon/system_filters/notifier/Jamfile deleted file mode 100644 index 7c55b8d291..0000000000 --- a/src/add-ons/mail_daemon/system_filters/notifier/Jamfile +++ /dev/null @@ -1,22 +0,0 @@ -SubDir HAIKU_TOP src add-ons mail_daemon system_filters notifier ; - -SetSubDirSupportedPlatformsBeOSCompatible ; - -if $(TARGET_PLATFORM) != haiku { - UsePublicHeaders mail ; -} - -UsePrivateHeaders mail ; -UsePublicHeaders [ FDirName add-ons mail_daemon ] ; - -SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; - -Addon New\ mail\ notification : - filter.cpp ConfigView.cpp ; - -LinkAgainst New\ mail\ notification : - be libmail.so $(TARGET_LIBSUPC++) ; - -Package haiku-maildaemon-cvs : - New\ mail\ notification : - boot home config add-ons mail_daemon system_filters ; diff --git a/src/add-ons/mail_daemon/system_filters/notifier/filter.cpp b/src/add-ons/mail_daemon/system_filters/notifier/filter.cpp deleted file mode 100644 index a9831ec14a..0000000000 --- a/src/add-ons/mail_daemon/system_filters/notifier/filter.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* New Mail Notification - notifies incoming e-mail -** -** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. -*/ - - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "ConfigView.h" - -class NotifyFilter; - -class NotifyCallback : public BMailChainCallback { - public: - NotifyCallback (int32 notification_method, BMailChainRunner *us,NotifyFilter *ref2); - virtual void Callback(status_t result); - - uint32 num_messages; - private: - BMailChainRunner *chainrunner; - int32 strategy; - NotifyFilter *parent; -}; - -class NotifyFilter : public BMailFilter -{ - public: - NotifyFilter(BMessage*,BMailChainRunner*); - virtual status_t InitCheck(BString *err); - virtual status_t ProcessMailMessage - ( - BPositionIO** io_message, BEntry* io_entry, - BMessage* io_headers, BPath* io_folder, const char* io_uid - ); - - private: - friend class NotifyCallback; - - NotifyCallback *callback; - BMailChainRunner *_runner; - int32 strategy; -}; - - -NotifyFilter::NotifyFilter(BMessage* msg,BMailChainRunner *runner) - : BMailFilter(msg), callback(NULL), _runner(runner) -{ - strategy = msg->FindInt32("notification_method"); -} - -status_t NotifyFilter::InitCheck(BString* err) -{ - return B_OK; -} - -status_t NotifyFilter::ProcessMailMessage(BPositionIO**, BEntry*, BMessage*headers, BPath*path, const char*) -{ - if (callback == NULL) { - callback = new NotifyCallback(strategy,_runner,this); - _runner->RegisterProcessCallback(callback); - } - - if (!headers->FindBool("ENTIRE_MESSAGE")) { - BString status; - headers->FindString("STATUS", &status); - // do not notify about auto-read messages - if (status.Compare("Read") != 0) - callback->num_messages ++; - } - - return B_OK; -} - -NotifyCallback::NotifyCallback (int32 notification_method, BMailChainRunner *us,NotifyFilter *ref2) : - num_messages(0), - chainrunner(us), - strategy(notification_method), - parent(ref2) -{ -} - -void NotifyCallback::Callback(status_t result) { - parent->callback = NULL; - - if (num_messages == 0) - return; - - if (strategy & do_beep) - system_beep("New E-mail"); - - if (strategy & alert) { - BString text; - MDR_DIALECT_CHOICE ( - text << "You have " << num_messages << " new message" << ((num_messages != 1) ? "s" : "") - << " for " << chainrunner->Chain()->Name() << ".", - - text << chainrunner->Chain()->Name() << "より\n" << num_messages << " 通のメッセージが届きました"); - - BAlert *alert = new BAlert(MDR_DIALECT_CHOICE ("New messages","新着メッセージ"), text.String(), "OK", NULL, NULL, B_WIDTH_AS_USUAL); - alert->SetFeel(B_NORMAL_WINDOW_FEEL); - alert->Go(NULL); - } - - if (strategy & blink_leds) - be_app->PostMessage('mblk'); - - if (strategy & one_central_beep) - be_app->PostMessage('mcbp'); - - if (strategy & big_doozy_alert) { - BMessage msg('numg'); - msg.AddInt32("num_messages",num_messages); - msg.AddString("chain_name",chainrunner->Chain()->Name()); - msg.AddInt32("chain_id",chainrunner->Chain()->ID()); - - be_app->PostMessage(&msg); - } - - if (strategy & log_window) { - BString message; - message << num_messages << " new message" << ((num_messages != 1) ? "s" : ""); - chainrunner->ShowMessage(message.String()); - } -} - -BMailFilter* instantiate_mailfilter(BMessage* settings, BMailChainRunner *runner) -{ - return new NotifyFilter(settings,runner); -} - diff --git a/src/add-ons/mail_daemon/system_filters/outbox/Jamfile b/src/add-ons/mail_daemon/system_filters/outbox/Jamfile deleted file mode 100644 index 18c15e6b07..0000000000 --- a/src/add-ons/mail_daemon/system_filters/outbox/Jamfile +++ /dev/null @@ -1,22 +0,0 @@ -SubDir HAIKU_TOP src add-ons mail_daemon system_filters outbox ; - -SetSubDirSupportedPlatformsBeOSCompatible ; - -if $(TARGET_PLATFORM) != haiku { - UsePublicHeaders mail ; -} - -UsePrivateHeaders mail ; -UsePublicHeaders [ FDirName add-ons mail_daemon ] ; - -SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; - -Addon Outbox : - filter.cpp ; - -LinkAgainst Outbox : - be libmail.so $(TARGET_LIBSUPC++) ; - -Package haiku-maildaemon-cvs : - Outbox : - boot home config add-ons mail_daemon system_filters ; diff --git a/src/add-ons/mail_daemon/system_filters/outbox/filter.cpp b/src/add-ons/mail_daemon/system_filters/outbox/filter.cpp deleted file mode 100644 index db0f4bb14d..0000000000 --- a/src/add-ons/mail_daemon/system_filters/outbox/filter.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* Outbox - scans outgoing mail in a specific folder -** -** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. -*/ - - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include - -class StatusChanger : public BMailChainCallback { - public: - StatusChanger(const char * entry); - void Callback(status_t result); - - private: - const char * to_change; -}; - -class DiskProducer : public BMailFilter -{ - BMailChainRunner *runner; - status_t init; - - public: - DiskProducer(BMessage*,BMailChainRunner*); - virtual status_t InitCheck(BString *err); - virtual status_t ProcessMailMessage - ( - BPositionIO** io_message, BEntry* io_entry, - BMessage* io_headers, BPath* io_folder, const char* io_uid - ); -}; - -DiskProducer::DiskProducer(BMessage* msg,BMailChainRunner*status) - : BMailFilter(msg), runner(status), init(B_OK) -{} - -status_t DiskProducer::InitCheck(BString* err) -{ - if (init != B_OK) - return init; - - return B_OK; -} - -status_t DiskProducer::ProcessMailMessage(BPositionIO**io, BEntry* e, BMessage* out_headers, BPath*, const char* io_uid) -{ - e->Remove(); - - BFile *file = new BFile(io_uid,B_READ_WRITE); - - e->SetTo(io_uid); - *file >> *out_headers; - *io = file; - - runner->RegisterMessageCallback(new StatusChanger(io_uid)); - - return B_OK; -} - -StatusChanger::StatusChanger(const char * entry) - : to_change(entry) -{ -} - -void StatusChanger::Callback(status_t result) { - BNode node(to_change); - - if (result == B_OK) { - mail_flags flags = B_MAIL_SENT; - - node.WriteAttr(B_MAIL_ATTR_FLAGS,B_INT32_TYPE,0,&flags,4); - node.WriteAttr(B_MAIL_ATTR_STATUS,B_STRING_TYPE,0,"Sent",5); - } else { - node.WriteAttr(B_MAIL_ATTR_STATUS,B_STRING_TYPE,0,"Error",6); - } -} - - -BMailFilter* instantiate_mailfilter(BMessage* settings, BMailChainRunner *runner) -{ - return new DiskProducer(settings,runner); -} - - -BView* instantiate_config_panel(BMessage *settings,BMessage *metadata) -{ - BMailFileConfigView *view = new BMailFileConfigView(MDR_DIALECT_CHOICE ("Location:","送信箱:"),"path",true,"/boot/home/mail/out"); - view->SetTo(settings,metadata); - - return view; -} - diff --git a/src/add-ons/mail_daemon/system_filters/parser/Jamfile b/src/add-ons/mail_daemon/system_filters/parser/Jamfile deleted file mode 100644 index 5b40cf8568..0000000000 --- a/src/add-ons/mail_daemon/system_filters/parser/Jamfile +++ /dev/null @@ -1,22 +0,0 @@ -SubDir HAIKU_TOP src add-ons mail_daemon system_filters parser ; - -SetSubDirSupportedPlatformsBeOSCompatible ; - -if $(TARGET_PLATFORM) != haiku { - UsePublicHeaders mail ; -} - -UsePrivateHeaders mail ; -UsePublicHeaders [ FDirName add-ons mail_daemon ] ; - -SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; - -Addon Message\ Parser : - filter.cpp ; - -LinkAgainst Message\ Parser : - be libmail.so $(TARGET_LIBSUPC++) ; - -Package haiku-maildaemon-cvs : - Message\ Parser : - boot home config add-ons mail_daemon system_filters ; diff --git a/src/add-ons/mail_daemon/system_filters/parser/filter.cpp b/src/add-ons/mail_daemon/system_filters/parser/filter.cpp deleted file mode 100644 index 5d69dbf336..0000000000 --- a/src/add-ons/mail_daemon/system_filters/parser/filter.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* Message Parser - parses the header of incoming e-mail -** -** Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. -*/ - - -#include -#include -#include -#include -#include - -#include -#include - -class ParseFilter : public BMailFilter { - public: - ParseFilter(BMessage *msg); - - virtual status_t InitCheck(BString *err); - virtual status_t ProcessMailMessage(BPositionIO **ioMessage, BEntry *ioEntry, - BMessage *ioHeaders, BPath *ioFolder, const char *io_uid); - - private: - BString fNameField; -}; - - -ParseFilter::ParseFilter(BMessage *msg) - : BMailFilter(msg), - fNameField("From") -{ - const char *name = msg->FindString("name_field"); - if (name) - fNameField = name; -} - - -status_t -ParseFilter::InitCheck(BString* err) -{ - return B_OK; -} - - -status_t -ParseFilter::ProcessMailMessage(BPositionIO **data, BEntry */*entry*/, BMessage *headers, - BPath */*folder*/, const char */*uid*/) -{ - char byte; - (*data)->ReadAt(0,&byte, 1); - (*data)->Seek(SEEK_SET, 0); - - status_t status = parse_header(*headers, **data); - if (status < B_OK) - return status; - - // - // add pseudo-header THREAD, that contains the subject - // minus stuff in []s (added by mailing lists) and - // Re: prefixes, added by mailers when you reply. - // This will generally be the "thread subject". - // - BString string; - string.SetTo(headers->FindString("Subject")); - SubjectToThread(string); - headers->AddString("THREAD", string.String()); - - // name - if (headers->FindString(fNameField.String(), 0, &string) == B_OK) { - extract_address_name(string); - headers->AddString("NAME", string); - } - - // header length - headers->AddInt32(B_MAIL_ATTR_HEADER, (int32)((*data)->Position())); - // What about content length? If we do that, we have to D/L the - // whole message... - //--NathanW says let the disk consumer do that - - (*data)->Seek(0, SEEK_SET); - return B_OK; -} - - -BMailFilter * -instantiate_mailfilter(BMessage *settings, BMailChainRunner *) -{ - return new ParseFilter(settings); -} - diff --git a/src/add-ons/mail_daemon/system_filters/parser/retest.cpp b/src/add-ons/mail_daemon/system_filters/parser/retest.cpp deleted file mode 100644 index 1622b64e65..0000000000 --- a/src/add-ons/mail_daemon/system_filters/parser/retest.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* To compile this test program, use this command line: -g++ -I../../include/numail -I../../include/public/ -I../../include/support/ -lbe -lmail -o Test -Wall retest.cpp -Then run Test with the subjects data file as input, or manually type in entries. -*/ -#include -#include -#include - -#include - -int main(int argc, char** argv) -{ - BString string; - char buf[1024]; - while (gets(buf)) - { - string = buf; - Zoidberg::Mail::SubjectToThread(string); - printf ("Input: \"%s\"\nOutput: \"%s\"\n\n", buf, string.String()); - } - return 0; -} diff --git a/src/add-ons/mail_daemon/system_filters/parser/subjects b/src/add-ons/mail_daemon/system_filters/parser/subjects deleted file mode 100644 index 7642e8ad0a..0000000000 --- a/src/add-ons/mail_daemon/system_filters/parser/subjects +++ /dev/null @@ -1,24 +0,0 @@ -Re: [list]subject -Re: [list] subject -[list] Re: subject -[list]Re: subject -[list]Re[2]: subject -[list] Re [2] : subject -Re[2]:[list] subject -Re[2]:[list]subject -Re:[list]subject -Re [2] : [list] subject -Réf [2] : [list] subject -AW: Re [2]: [list] Réf: Re [5]: Fwd: Fwd [2]: subject -Re: [list]subject (fwd) -Re: [list] subject (fwd) -[list] Re: subject (fwd) -[list]Re: subject (fwd) -[list]Re[2]: subject (fwd) -[list] Re [2] : subject (fwd) -Re[2]:[list] subject (fwd) -Re[2]:[list]subject (fwd) -Re:[list]subject (fwd) -Re [2] : [list] subject (fwd) -Réf [2] : [list] subject (fwd) -AW: Re [2]: [list] Réf: Re [5]: Fwd: Fwd [2]: subject (fwd) diff --git a/src/add-ons/mail_daemon/system_filters/parser/thread.cpp b/src/add-ons/mail_daemon/system_filters/parser/thread.cpp deleted file mode 100644 index 40de79fb64..0000000000 --- a/src/add-ons/mail_daemon/system_filters/parser/thread.cpp +++ /dev/null @@ -1 +0,0 @@ -Moved to SubjectToThread in the mail library, AGMS 20030126.