From 083fa7857fcb72100c551121f3ec4fc8e9ec5edd Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 16 May 2013 21:02:17 +0000 Subject: [PATCH] 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 --- locale/pl | 2 +- notify/notify.cpp | 4 ++-- notify/notifypool.h | 2 +- notify/notifythread.cpp | 7 ++++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/locale/pl b/locale/pl index 4e3eca1..11b19b2 100755 --- a/locale/pl +++ b/locale/pl @@ -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 diff --git a/notify/notify.cpp b/notify/notify.cpp index 0b0ce31..70e6be6 100755 --- a/notify/notify.cpp +++ b/notify/notify.cpp @@ -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); diff --git a/notify/notifypool.h b/notify/notifypool.h index c5ae222..1c115f1 100755 --- a/notify/notifypool.h +++ b/notify/notifypool.h @@ -65,7 +65,7 @@ struct NotifyUserMsg { std::wstring name; std::wstring email; - size_t lang; + size_t lang; // locale id (not an index) }; diff --git a/notify/notifythread.cpp b/notify/notifythread.cpp index 3718cb5..edc3c12 100755 --- a/notify/notifythread.cpp +++ b/notify/notifythread.cpp @@ -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();