1 /* GNU Mailutils -- a suite of utilities for electronic mail 2 Copyright (C) 2009-2021 Free Software Foundation, Inc. 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 3 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General 15 Public License along with this library. If not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 #include <cstdlib> 19 #include <mailutils/cpp/util.h> 20 21 using namespace mailutils; 22 23 // 24 // MUtil 25 // 26 27 int set_user_email(const std::string & str)28mailutils :: set_user_email (const std::string& str) 29 { 30 return mu_set_user_email (str.c_str ()); 31 } 32 33 int set_user_email_domain(const std::string & str)34mailutils :: set_user_email_domain (const std::string& str) 35 { 36 return mu_set_user_email_domain (str.c_str ()); 37 } 38 39 std::string tempname()40mailutils :: tempname () 41 { 42 std::string name; 43 char *c_str = mu_tempname (NULL); 44 if (c_str) { 45 name = c_str; 46 free (c_str); 47 } 48 return name; 49 } 50 51 std::string tempname(const std::string & tmpdir)52mailutils :: tempname (const std::string& tmpdir) 53 { 54 std::string name; 55 char *c_str = mu_tempname (tmpdir.c_str ()); 56 if (c_str) { 57 name = c_str; 58 free (c_str); 59 } 60 return name; 61 } 62 63