llmail.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLMAIL_H
00033 #define LL_LLMAIL_H
00034 
00035 typedef struct apr_pool_t apr_pool_t;
00036 
00037 class LLUUID;
00038 
00039 class LLMail
00040 {
00041 public:
00042         // if hostname is NULL, then the host is resolved as 'mail'
00043         static void init(const std::string& hostname, apr_pool_t* pool);
00044 
00045         // Allow all email transmission to be disabled/enabled.
00046         static void enable(bool mail_enabled);
00047 
00048         // returns TRUE if the call succeeds, FALSE otherwise.
00049         //
00050         // Results in:
00051         // From: "from_name" <from_address>
00052         // To:   "to_name" <to_address>
00053         // Subject: subject
00054         // message
00055         static BOOL send(const char* from_name, const char* from_address,
00056                                 const char* to_name, const char* to_address,
00057                                 const char* subject, const char* message);
00058 
00070         static std::string buildSMTPTransaction(
00071                 const char* from_name,
00072                 const char* from_address,
00073                 const char* to_name,
00074                 const char* to_address,
00075                 const char* subject);
00076 
00086         static bool send(
00087                 const std::string& header,
00088                 const std::string& message,
00089                 const char* from_address,
00090                 const char* to_address);
00091 
00092         // IM-to-email sessions use a "session id" based on an encrypted
00093         // combination of from agent_id, to agent_id, and timestamp.  When
00094         // a user replies to an email we use the from_id to determine the
00095         // sender's name and the to_id to route the message.  The address
00096         // is encrypted to prevent users from building addresses to spoof
00097         // IMs from other users.  The timestamps allow the "sessions" to 
00098         // expire, in case one of the sessions is stolen/hijacked.
00099         //
00100         // indra/tools/mailglue is responsible for parsing the inbound mail.
00101         //
00102         // secret: binary blob passed to blowfish, max length 56 bytes
00103         // secret_size: length of blob, in bytes
00104         //
00105         // Returns: "base64" encoded email local-part, with _ and - as the
00106         // non-alphanumeric characters.  This allows better compatibility
00107         // with email systems than the default / and + extra chars.  JC
00108         static std::string encryptIMEmailAddress(
00109                 const LLUUID& from_agent_id,
00110                 const LLUUID& to_agent_id,
00111                 U32 time,
00112                 const U8* secret,
00113                 size_t secret_size);
00114 };
00115 
00116 extern const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE;
00117 
00118 #endif

Generated on Thu Jul 1 06:08:49 2010 for Second Life Viewer by  doxygen 1.4.7