diff options
Diffstat (limited to 'linden/indra/llmessage/llmail.h')
-rw-r--r-- | linden/indra/llmessage/llmail.h | 119 |
1 files changed, 74 insertions, 45 deletions
diff --git a/linden/indra/llmessage/llmail.h b/linden/indra/llmessage/llmail.h index 82c272f..b1dc3b5 100644 --- a/linden/indra/llmessage/llmail.h +++ b/linden/indra/llmessage/llmail.h | |||
@@ -30,55 +30,84 @@ | |||
30 | 30 | ||
31 | typedef struct apr_pool_t apr_pool_t; | 31 | typedef struct apr_pool_t apr_pool_t; |
32 | 32 | ||
33 | // if hostname is NULL, then the host is resolved as 'mail' | 33 | class LLUUID; |
34 | void init_mail(const std::string& hostname, apr_pool_t* pool); | ||
35 | 34 | ||
36 | // Allow all email transmission to be disabled/enabled. | 35 | class LLMail |
37 | void enable_mail(bool mail_enabled); | 36 | { |
37 | public: | ||
38 | // if hostname is NULL, then the host is resolved as 'mail' | ||
39 | static void init(const std::string& hostname, apr_pool_t* pool); | ||
38 | 40 | ||
39 | // returns TRUE if the call succeeds, FALSE otherwise. | 41 | // Allow all email transmission to be disabled/enabled. |
40 | // | 42 | static void enable(bool mail_enabled); |
41 | // Results in: | ||
42 | // From: "from_name" <from_address> | ||
43 | // To: "to_name" <to_address> | ||
44 | // Subject: subject | ||
45 | // message | ||
46 | BOOL send_mail(const char* from_name, const char* from_address, | ||
47 | const char* to_name, const char* to_address, | ||
48 | const char* subject, const char* message); | ||
49 | 43 | ||
50 | /** | 44 | // returns TRUE if the call succeeds, FALSE otherwise. |
51 | * @brief build the complete smtp transaction & header for use in an | 45 | // |
52 | * mail. | 46 | // Results in: |
53 | * | 47 | // From: "from_name" <from_address> |
54 | * @param from_name The name of the email sender | 48 | // To: "to_name" <to_address> |
55 | * @param from_address The email address for the sender | 49 | // Subject: subject |
56 | * @param to_name The name of the email recipient | 50 | // message |
57 | * @param to_name The email recipient address | 51 | static BOOL send(const char* from_name, const char* from_address, |
58 | * @param subject The subject of the email | 52 | const char* to_name, const char* to_address, |
59 | * @return Returns the complete SMTP transaction mail header. | 53 | const char* subject, const char* message); |
60 | */ | ||
61 | std::string build_smtp_transaction( | ||
62 | const char* from_name, | ||
63 | const char* from_address, | ||
64 | const char* to_name, | ||
65 | const char* to_address, | ||
66 | const char* subject); | ||
67 | 54 | ||
68 | /** | 55 | /** |
69 | * @brief send an email with header and body. | 56 | * @brief build the complete smtp transaction & header for use in an |
70 | * | 57 | * mail. |
71 | * @param header The email header. Use build_mail_header(). | 58 | * |
72 | * @param message The unescaped email message. | 59 | * @param from_name The name of the email sender |
73 | * @param from_address Used for debugging | 60 | * @param from_address The email address for the sender |
74 | * @param to_address Used for debugging | 61 | * @param to_name The name of the email recipient |
75 | * @return Returns true if the message could be sent. | 62 | * @param to_name The email recipient address |
76 | */ | 63 | * @param subject The subject of the email |
77 | bool send_mail( | 64 | * @return Returns the complete SMTP transaction mail header. |
78 | const std::string& header, | 65 | */ |
79 | const std::string& message, | 66 | static std::string buildSMTPTransaction( |
80 | const char* from_address, | 67 | const char* from_name, |
81 | const char* to_address); | 68 | const char* from_address, |
69 | const char* to_name, | ||
70 | const char* to_address, | ||
71 | const char* subject); | ||
72 | |||
73 | /** | ||
74 | * @brief send an email with header and body. | ||
75 | * | ||
76 | * @param header The email header. Use build_mail_header(). | ||
77 | * @param message The unescaped email message. | ||
78 | * @param from_address Used for debugging | ||
79 | * @param to_address Used for debugging | ||
80 | * @return Returns true if the message could be sent. | ||
81 | */ | ||
82 | static bool send( | ||
83 | const std::string& header, | ||
84 | const std::string& message, | ||
85 | const char* from_address, | ||
86 | const char* to_address); | ||
87 | |||
88 | // IM-to-email sessions use a "session id" based on an encrypted | ||
89 | // combination of from agent_id, to agent_id, and timestamp. When | ||
90 | // a user replies to an email we use the from_id to determine the | ||
91 | // sender's name and the to_id to route the message. The address | ||
92 | // is encrypted to prevent users from building addresses to spoof | ||
93 | // IMs from other users. The timestamps allow the "sessions" to | ||
94 | // expire, in case one of the sessions is stolen/hijacked. | ||
95 | // | ||
96 | // indra/tools/mailglue is responsible for parsing the inbound mail. | ||
97 | // | ||
98 | // secret: binary blob passed to blowfish, max length 56 bytes | ||
99 | // secret_size: length of blob, in bytes | ||
100 | // | ||
101 | // Returns: "base64" encoded email local-part, with _ and - as the | ||
102 | // non-alphanumeric characters. This allows better compatibility | ||
103 | // with email systems than the default / and + extra chars. JC | ||
104 | static std::string encryptIMEmailAddress( | ||
105 | const LLUUID& from_agent_id, | ||
106 | const LLUUID& to_agent_id, | ||
107 | U32 time, | ||
108 | const U8* secret, | ||
109 | size_t secret_size); | ||
110 | }; | ||
82 | 111 | ||
83 | extern const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE; | 112 | extern const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE; |
84 | 113 | ||