summaryrefslogtreecommitdiffstats
path: root/kmail/mailinglist-magic.h
blob: 8eed4f8f60f6b088e42d304ca8b01f390e3b02a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef MAILINGLIST_MAGIC_H
#define MAILINGLIST_MAGIC_H

#include <kurl.h>
#include <tqstring.h>

class KMMessage;
class TDEConfig;

namespace KMail
{

/**
 * Class is used for all Mailing List handling inside
 * KMail. The static detect method is used to detect
 * a full set of ml informations from a message. The
 * features() method defines which addresses the mailing
 * has defined.
 *
 * @author Zack Rusin <[email protected]>
 */
class MailingList
{
public:
  enum Handler {
    KMail,
    Browser
  };

  enum Supports {
    None         = 0 << 0,
    Post         = 1 << 0,
    Subscribe    = 1 << 1,
    Unsubscribe  = 1 << 2,
    Help         = 1 << 3,
    Archive      = 1 << 4,
    Id           = 1 << 5
  };
public:
  static MailingList detect( const KMMessage* msg );
  static TQString name( const KMMessage  *message, TQCString &header_name,
		       TQString &header_value );
public:
  MailingList();

  int features() const;

  void setHandler( Handler han );
  Handler handler() const;

  void setPostURLS ( const KURL::List& );
  KURL::List postURLS() const;

  void setSubscribeURLS( const KURL::List& );
  KURL::List subscribeURLS() const;

  void setUnsubscribeURLS ( const KURL::List& );
  KURL::List unsubscribeURLS() const;

  void setHelpURLS( const KURL::List& );
  KURL::List helpURLS() const;

  void setArchiveURLS( const KURL::List& );
  KURL::List archiveURLS() const;

  void setId( const TQString& );
  TQString id() const;

  void writeConfig( TDEConfig* config ) const;
  void readConfig( TDEConfig* config );
private:
  int        mFeatures;
  Handler    mHandler;
  KURL::List mPostURLS;
  KURL::List mSubscribeURLS;
  KURL::List mUnsubscribeURLS;
  KURL::List mHelpURLS;
  KURL::List mArchiveURLS;
  TQString    mId;
};

}

#endif