winix/notify/notifypool.h

95 lines
1.5 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_notify_notifypool
#define headerfile_winix_notify_notifypool
#include <list>
#include <string>
#include "templates/locale.h"
#define WINIX_NOTIFY_CODE_ADD 1
#define WINIX_NOTIFY_CODE_EDIT 2
#define WINIX_NOTIFY_CODE_DELETE 4
#define WINIX_NOTIFY_CODE_REPLY 8
#define WINIX_NOTIFY_CODE_CONFIRM_ACCOUNT 16
#define WINIX_NOTIFY_CODE_RESET_PASSWORD 32
// !! IMPROVE ME
// may now we can use PT::Space instead of NotifyMsg?
struct NotifyMsg
{
int code;
std::wstring item_link; // link to a file or a dir (can be the same as dir_link if the item is a directory)
std::wstring dir_link; // link to a dir
size_t template_index;
// used in account activations
// we send one email directly to one user
std::wstring email;
std::wstring name;
size_t lang;
long activate_code;
NotifyMsg()
{
Clear();
}
void Clear()
{
code = -1;
item_link.clear();
dir_link.clear();
template_index = 0;
email.clear();
name.clear();
lang = 0;
activate_code = 0;
}
};
// used by the second thread (and its templates)
struct NotifyUserMsg
{
std::wstring name;
std::wstring email;
size_t lang;
};
class NotifyPool
{
public:
bool Empty() const;
size_t Size() const;
NotifyMsg & GetFirst();
void DeleteFirst();
void Add(const NotifyMsg & msg);
private:
std::list<NotifyMsg> notify_pool;
};
#endif