Skip to content

Commit 157626e

Browse files
author
Ivan Stoev
committed
Adding client name
1 parent 2f6078e commit 157626e

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

pCloudCC/pclsync_lib.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,32 @@
3030

3131
#include <iostream>
3232

33+
3334
namespace cc = console_client;
3435
namespace clib = cc::clibrary;
3536

3637
static clib::pclsync_lib g_lib;
3738

3839
clib::pclsync_lib& clib::get_lib(){return g_lib;}
3940

41+
#include <string>
42+
#include <iostream>
43+
#include <cstdio>
44+
#include <memory>
45+
46+
static std::string exec(const char* cmd) {
47+
boost::shared_ptr<FILE> pipe(popen(cmd, "r"), pclose);
48+
if (!pipe) return "ERROR";
49+
char buffer[128];
50+
std::string result = "";
51+
while (!feof(pipe.get())) {
52+
if (fgets(buffer, 128, pipe.get()) != NULL)
53+
result += buffer;
54+
}
55+
return result;
56+
}
57+
58+
4059
void event_handler(psync_eventtype_t event, psync_eventdata_t eventdata){
4160
if (event<PEVENT_FIRST_USER_EVENT){
4261
if (event&PEVENT_TYPE_FOLDER)
@@ -114,9 +133,11 @@ static int finalize (const char* path) {
114133
psync_destroy();
115134
exit(0);
116135
}
117-
136+
static const std::string client_name = " Console Client v.2.0.1";
118137
int clib::init()//std::string& username, std::string& password, std::string* crypto_pass, int setup_crypto, int usesrypto_userpass)
119138
{
139+
std::string software_string = exec("lsb_release -ds");
140+
psync_set_software_string(software_string.append(client_name).c_str());
120141
if (g_lib.setup_crypto_ && g_lib.crypto_pass_.empty() )
121142
return 3;
122143
g_lib.was_init_ = true;

0 commit comments

Comments
 (0)