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"
16 #include <boost/assert.hpp>
28 #ifdef HAVE_SYS_TYPES_H
29 # include <sys/types.h>
37 docstring const user_name()
39 //FIXME: quick fix wrt bug #3764; only Anonymous is detected now.
40 //The code after should be used only after user approval.
41 return from_ascii("Anonymous");
47 DWORD size = UNLEN + 1;
48 if (!GetUserName(name, &size))
49 return _("Unknown user");
50 return from_local8bit(name);
52 struct passwd * pw(getpwuid(geteuid()));
55 string name = pw->pw_gecos;
58 return from_local8bit(name);
63 docstring const user_email()
65 //FIXME: quick fix wrt bug #3764; only Anonymous is detected now.
66 //The code after should be used only after user approval.
70 string email = getEnv("EMAIL_ADDRESS");
72 email = getEnv("EMAIL");
73 return from_local8bit(email);
76 } // namespace support