~ubuntu-branches/ubuntu/trusty/newsbeuter/trusty-proposed

« back to all changes in this revision

Viewing changes to src/poddlthread.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Nico Golde
  • Date: 2008-05-01 14:51:20 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080501145120-i65avsclnrpl2cfq
Tags: 0.9-1
* New upstream release.
  - Fix problem displaying titles when using zh_CN.UTF-8
    locale (Closes: #471434).
* Add default configuration to set sensible-browser as browser and
  add dirs file to create /etc/newsbeuter (Closes: #470833).
* remove libnxml-depends and libmrss-depends calls in rules and
  related dependency lines in control since they are not needed
  anymore (Closes: #467201).

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#include <iostream>
4
4
#include <logger.h>
5
5
#include <config.h>
 
6
#include <utils.h>
6
7
 
7
8
#include <sys/types.h>
8
9
#include <sys/stat.h>
28
29
 
29
30
        CURL * easyhandle = curl_easy_init();
30
31
 
31
 
        char user_agent[1024];
32
 
        std::string ua_pref = cfg->get_configvalue("user-agent");
33
 
        if (ua_pref.length() == 0) {
34
 
                struct utsname buf;
35
 
                uname(&buf);
36
 
                snprintf(user_agent, sizeof(user_agent), "podbeuter/%s (%s %s; %s; %s) %s", PROGRAM_VERSION, buf.sysname, buf.release, buf.machine, PROGRAM_URL, curl_version());
37
 
        } else {
38
 
                snprintf(user_agent, sizeof(user_agent), "%s", ua_pref.c_str());
39
 
        }
 
32
        std::string user_agent = utils::get_useragent(cfg);
40
33
 
41
 
        curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, user_agent);
 
34
        curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, user_agent.c_str());
42
35
 
43
36
        curl_easy_setopt(easyhandle, CURLOPT_URL, dl->url());
44
37
        // set up write functions:
89
82
 
90
83
static size_t my_write_data(void *buffer, size_t size, size_t nmemb, void *userp) {
91
84
        poddlthread * thread = (poddlthread *)userp;
92
 
        // std::cerr << "my_write_data(...," << size << "," << nmemb << ",...) called" << std::endl;
93
85
        return thread->write_data(buffer, size, nmemb);
94
86
}
95
87
 
96
88
static int progress_callback(void *clientp, double dltotal, double dlnow, double /* ultotal */, double /*ulnow*/) {
97
89
        poddlthread * thread = (poddlthread *)clientp;
98
 
        // std::cerr << "progress_callback(...," << dltotal << "," << dlnow << ",...) called" << std::endl;
99
90
        return thread->progress(dlnow, dltotal);
100
91
}
101
92