Logo Search packages:      
Sourcecode: kcheckgmail version File versions

void GMailParser::parseDefaultSummary ( const QString &  _data  )  [protected]

Default summary parser.

This parser extracts the number of unread messages in the inbox, drafts and spam.

Parameters:
_data The data block

Definition at line 462 of file gmailparser.cpp.

Referenced by parse().

{
      static QRegExp rx("\"([a-z]+)\",([0-9]+)");

      if(!rx.isValid()) {
            kdWarning() << k_funcinfo << "Invalid RX!\n"
                  << rx.errorString() << endl;
      }
      QString data = _data;
      int pos = 0;

      while((pos = rx.search(data, pos)) != -1) {
            QString str_name = rx.cap(1), str_val = rx.cap(2);
            int val = str_val.toUInt();

            if( QString::compare(str_name,"inbox") == 0)
                  mSummary.inbox = val;
            else if( QString::compare(str_name,"drafts") == 0)
                  mSummary.drafts = val;
            else if( QString::compare(str_name,"spam") == 0)
                  mSummary.spam = val;
            else kdWarning() << k_funcinfo << "unkown identifier " << str_name << endl;

            pos += rx.matchedLength();
      }
      kdDebug() << k_funcinfo << endl  
            << "inbox=" << mSummary.inbox << "\n"
            << "drafts=" << mSummary.drafts << "\n"
            << "spam=" << mSummary.spam << "\n" << endl;
}


Generated by  Doxygen 1.6.0   Back to index