Merge branch 'master' into ubuntu

This commit is contained in:
Petr Bena 2014-05-25 17:29:45 +02:00
commit adc19767b8
2 changed files with 8 additions and 11 deletions

View File

@ -24,7 +24,7 @@ string Configuration::URL = "";
string Configuration::Expiry = "60"; string Configuration::Expiry = "60";
bool Configuration::Private = false; bool Configuration::Private = false;
string Configuration::Author = ""; string Configuration::Author = "";
string Configuration::Version = "1.0.2"; string Configuration::Version = "1.0.3";
string Configuration::Title = ""; string Configuration::Title = "";
string Configuration::Home = ""; string Configuration::Home = "";
string Configuration::DefaultURL = ""; string Configuration::DefaultURL = "";
@ -60,6 +60,11 @@ void Configuration::Init()
} }
f.close(); f.close();
} }
if (Configuration::Author.length() < 1)
{
// we don't have any author here! let's get it from passwd
Configuration::Author = pw->pw_name;
}
} }
void Configuration::Store() void Configuration::Store()

View File

@ -10,7 +10,6 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <unistd.h>
#include <curl/curl.h> #include <curl/curl.h>
#include "configuration.hpp" #include "configuration.hpp"
#include "terminalparser.hpp" #include "terminalparser.hpp"
@ -37,15 +36,8 @@ int main(int argc, char *argv[])
delete t; delete t;
if (!Stikkit::Configuration::Author.length()) if (!Stikkit::Configuration::Author.length())
{ {
char buffer[200]; // we need to provide some author name otherwise stikked will not display anything or some random characters there
if (getlogin_r(buffer, 200)) Stikkit::Configuration::Author = "Unknown";
{
Stikkit::Configuration::Author = buffer;
} else
{
// we need to provide some author name otherwise stikked will not display anything or some random characters there
Stikkit::Configuration::Author = "Unknown";
}
} }
if (!Stikkit::Configuration::URL.length()) if (!Stikkit::Configuration::URL.length())
{ {