Logo Search packages:      
Sourcecode: pan version File versions

void TaskGroups::on_nntp_line ( NNTP nntp,
const StringView line 
) [private, virtual]

Invoked for each line of an NNTP server's list responses, such as a list of headers for an XOVER command or a list of lines for an ARTICLE command.

Reimplemented from pan::NNTP::Listener.

Definition at line 79 of file task-groups.cc.

References pan::StringView::begin(), pan::Data::NewGroup::description, pan::StringView::empty(), pan::StringView::end(), pan::Data::NewGroup::group, pan::StringView::len, pan::Data::NewGroup::permission, pan::StringView::str, and pan::StringView::trim().

  char permission ('?');
  std::string name_str;
  std::string desc_str;

  if (_step == LIST)
    StringView myline(line), tmp, post;
    myline.pop_token (tmp);
    name_str = content_to_utf8 (tmp);
    myline.pop_token (tmp); // skip low number
    myline.pop_token (tmp); // skip high number
    myline.pop_token (post); // ok to post?
    if (!post.empty())
      permission = tolower (*post.str);
    const char * pch = line.begin();
    while (pch!=line.end() && !isspace((int)*pch)) ++pch;
    name_str = content_to_utf8 (StringView (line.str, pch-line.str));
    desc_str = content_to_utf8 (StringView (pch, line.str+line.len-pch));

  StringView name (name_str);
  StringView desc (desc_str);
  name.trim ();
  desc.trim ();

  if (!name.empty()) {
    const Quark name_quark (name);
    Data::NewGroup& ng (_new_groups[name_quark]);
    ng.group = name_quark;
    ng.description.assign (desc.str, desc.len);
    if (permission != '?')
      ng.permission = permission;

  if (!(++_group_count % 100ul)) {
    char buf[1024];
    snprintf (buf, sizeof(buf), _("Fetched %lu Groups"), _group_count);
    set_status (buf);

  increment_step ();

Generated by  Doxygen 1.6.0   Back to index