fixed: in notify/notify.cpp: a correct locale id should be taken

(we were not able to send: a mail with an activation link and 
        a mail with the reset password link when we didn't have a locale with id 0 loaded)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@929 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2013-05-16 21:02:17 +00:00
parent 9ffda3e070
commit 083fa7857f
4 changed files with 8 additions and 7 deletions

View File

@ -434,7 +434,7 @@ cp_follow_symlinks = Podążaj za linkami symbolicznymi
slog_warning = Ostrzeżenie
slog_error = Błąd
slog_error = Informacja
slog_info = Informacja
unknown_filesystem = Nieznany system plików
no_such_dir = Nie ma takiego katalogu
unknown_mount_type = Nieprawidłowy rodzaj punktu montowania

View File

@ -110,7 +110,7 @@ void Notify::ActivateAccount(const std::wstring & name, const std::wstring & ema
msg.code = WINIX_NOTIFY_CODE_CONFIRM_ACCOUNT;
msg.name = name;
msg.email = email;
msg.lang = 0; // !! IMPROVE ME a better language can be chose
msg.lang = config->locale_default_id;
msg.activate_code = code;
msg.template_index = notify_template_activate_account;
CreateActivateLink(name, code, msg.item_link);
@ -126,7 +126,7 @@ void Notify::ResetPassword(const std::wstring & name, const std::wstring & email
msg.code = WINIX_NOTIFY_CODE_RESET_PASSWORD;
msg.name = name;
msg.email = email;
msg.lang = 0; // !! IMPROVE ME a better language can be chose
msg.lang = config->locale_default_id; // !! IMPROVE ME a better language can be chose (the same as the user has)
msg.activate_code = code;
msg.template_index = notify_template_reset_password;
CreateResetPasswordLink(name, code, msg.item_link);

View File

@ -65,7 +65,7 @@ struct NotifyUserMsg
{
std::wstring name;
std::wstring email;
size_t lang;
size_t lang; // locale id (not an index)
};

View File

@ -173,16 +173,17 @@ void NotifyThread::SendMail()
{
notify_stream.Clear();
size_t lang_index = TemplatesNotifyFunctions::notify_user_msg.lang;
size_t lang_id = TemplatesNotifyFunctions::notify_user_msg.lang;
size_t template_index = TemplatesNotifyFunctions::notify_msg.template_index;
Lock();
// 'patterns' object can use logger or other stuff so we use Lock() before
Ezc::Pattern * pat = patterns.Get(template_index, lang_index);
Ezc::Pattern * pat = patterns.Get(template_index, lang_id);
if( !pat )
log << log1 << "NotifyThread: I don't have a template with index: " << template_index
<< " and locale index: " << lang_index << logend;
<< " and locale id: " << lang_id << logend;
Unlock();