[pkg-boinc-commits] r542 - in /trunk/boinc: clientgui/ clientgui/ValidateEmailAddress.cpp debian/changelog

fst-guest at users.alioth.debian.org fst-guest at users.alioth.debian.org
Fri Oct 20 10:47:16 UTC 2006


Author: fst-guest
Date: Fri Oct 20 10:47:14 2006
New Revision: 542

URL: http://svn.debian.org/wsvn/pkg-boinc/?sc=1&rev=542
Log:
Fixed #393948: boinc-manager: Does not accept plus sign in email address

Added:
    trunk/boinc/clientgui/
    trunk/boinc/clientgui/ValidateEmailAddress.cpp
Modified:
    trunk/boinc/debian/changelog

Added: trunk/boinc/clientgui/ValidateEmailAddress.cpp
URL: http://svn.debian.org/wsvn/pkg-boinc/trunk/boinc/clientgui/ValidateEmailAddress.cpp?rev=542&op=file
==============================================================================
--- trunk/boinc/clientgui/ValidateEmailAddress.cpp (added)
+++ trunk/boinc/clientgui/ValidateEmailAddress.cpp Fri Oct 20 10:47:14 2006
@@ -1,0 +1,150 @@
+// Berkeley Open Infrastructure for Network Computing
+// http://boinc.berkeley.edu
+// Copyright (C) 2005 University of California
+//
+// This is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation;
+// either version 2.1 of the License, or (at your option) any later version.
+//
+// This software is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// To view the GNU Lesser General Public License visit
+// http://www.gnu.org/copyleft/lesser.html
+// or write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma implementation "ValidateEmailAddress.h"
+#endif
+
+#include "stdwx.h"
+#include "ValidateEmailAddress.h"
+
+
+IMPLEMENT_DYNAMIC_CLASS(CValidateEmailAddress, wxValidator)
+
+
+CValidateEmailAddress::CValidateEmailAddress(wxString *val) {
+    m_stringValue = val ;
+}
+
+
+CValidateEmailAddress::CValidateEmailAddress(const CValidateEmailAddress& val)
+    : wxValidator()
+{
+    Copy(val);
+}
+
+
+CValidateEmailAddress::~CValidateEmailAddress() {}
+
+
+bool CValidateEmailAddress::Copy(const CValidateEmailAddress& val) {
+    wxValidator::Copy(val);
+
+    m_stringValue = val.m_stringValue ;
+
+    return TRUE;
+}
+
+
+bool CValidateEmailAddress::Validate(wxWindow *parent) {
+    if(!CheckValidator())
+        return FALSE;
+
+    wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
+
+    if (!control->IsEnabled())
+        return TRUE;
+
+    bool ok = TRUE;
+    wxString val(control->GetValue().Trim().Trim(false));  // trim spaces before and after
+
+    // Regular Expression found here:
+    //   http://www.regexlib.com/REDetails.aspx?regexp_id=284
+    // Changes from original:
+    //   Allow additional valid characters in the username area.
+    wxRegEx reEmail(
+        wxT("^([a-zA-Z0-9._%+\\-])+(\\.([a-zA-Z0-9_\\-])+)*@((\\[(((([0-1])?([0-9])?[0-9"
+            "])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|"
+            "(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\"
+            ".(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\\]))|((([a-zA-Z0-9]"
+            ")+(([\\-])+([a-zA-Z0-9])+)*\\.)+([a-zA-Z])+(([\\-])+([a-zA-Z0-9])+)*))$"));
+
+    if (val.Length() == 0) {
+        ok = FALSE;
+        m_errormsg = _("Please specify an email address");
+    } else if (!reEmail.Matches(val)) {
+        ok = FALSE;
+        m_errormsg = _("Invalid email address; please enter a valid email address");
+    }
+
+    if (!ok) {
+        wxASSERT_MSG(!m_errormsg.empty(), _T("you forgot to set errormsg"));
+
+        m_validatorWindow->SetFocus();
+
+        wxString buf;
+        buf.Printf(m_errormsg, control->GetValue().c_str());
+
+        wxMessageBox(buf, _("Validation conflict"),
+            wxOK | wxICON_EXCLAMATION, parent
+        );
+    }
+
+    return ok;
+}
+
+
+bool CValidateEmailAddress::TransferToWindow(void) {
+    if(!CheckValidator())
+        return FALSE;
+    
+    if (!m_stringValue)
+        return TRUE;
+
+    wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
+    control->SetValue(* m_stringValue) ;
+
+    return TRUE;
+}
+
+
+bool CValidateEmailAddress::TransferFromWindow(void) {
+    if(!CheckValidator())
+        return FALSE;
+
+    if (!m_stringValue)
+        return TRUE;
+
+    wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
+    * m_stringValue = control->GetValue() ;
+
+    return TRUE;
+}
+
+
+bool CValidateEmailAddress::wxIsAlphaNumeric(const wxString& val) {
+    int i;
+    for (i = 0; i < (int)val.Length(); i++) {
+        if (!wxIsalnum(val[i]))
+            return FALSE;
+    }
+    return TRUE;
+}
+
+
+bool CValidateEmailAddress::CheckValidator() const {
+    wxCHECK_MSG(m_validatorWindow, FALSE,
+                    _T("No window associated with validator"));
+    wxCHECK_MSG(m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)), FALSE,
+                    _T("wxTextValidator is only for wxTextCtrl's"));
+    wxCHECK_MSG(m_stringValue, FALSE,
+                    _T("No variable storage for validator"));
+
+    return TRUE;
+}

Modified: trunk/boinc/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-boinc/trunk/boinc/debian/changelog?rev=542&op=diff
==============================================================================
--- trunk/boinc/debian/changelog (original)
+++ trunk/boinc/debian/changelog Fri Oct 20 10:47:14 2006
@@ -1,10 +1,15 @@
 boinc (5.4.11-3) unstable; urgency=low
+
+  [ Frank S. Thomas ]
+  * clientgui/ValidateEmailAddress.cpp: Bugfix to validate e-mail addresses
+    that contain '+' in the local-part. Patch has been taken from upstream
+    CVS. (closes: #393948)
 
   [ Debconf translations ]
   * Added French (fr.po) by Cyril Brulebois
     <cyril.brulebois at enst-bretagne.fr>. (closes: #393499)
 
- -- Frank S. Thomas <frank at thomas-alfeld.de>  Mon, 16 Oct 2006 20:07:37 +0200
+ -- Frank S. Thomas <frank at thomas-alfeld.de>  Fri, 20 Oct 2006 12:39:15 +0200
 
 boinc (5.4.11-2) unstable; urgency=low
 




More information about the pkg-boinc-commits mailing list