3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "support/userinfo.h"
14 #include "support/environment.h"
15 #include "support/docstring.h"
17 #include <boost/assert.hpp>
20 # include "support/gettext.h"
29 #ifdef HAVE_SYS_TYPES_H
30 # include <sys/types.h>
38 docstring const user_name()
43 DWORD size = UNLEN + 1;
44 if (!GetUserName(name, &size))
45 return _("Unknown user");
46 return from_local8bit(name);
48 struct passwd * pw = getpwuid(geteuid());
51 string name = pw->pw_gecos;
54 return from_local8bit(name);
59 docstring const user_email()
61 //FIXME: quick fix wrt bug #3764; only Anonymous is detected now.
62 //The code after should be used only after user approval.
66 string email = getEnv("EMAIL_ADDRESS");
68 email = getEnv("EMAIL");
69 return from_local8bit(email);
72 } // namespace support