~ubuntu-branches/ubuntu/vivid/akonadi/vivid

« back to all changes in this revision

Viewing changes to server/src/handler/searchhelper.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2013-11-11 17:38:58 UTC
  • mfrom: (1.1.46)
  • Revision ID: package-import@ubuntu.com-20131111173858-kltz6s4ebjishfej
Tags: 1.10.80-0ubuntu1
* New upstream release
 - Update install files
 - Update disable_dbus_requiring_tests.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include "searchhelper.h"
21
21
 
 
22
#include <libs/protocol_p.h>
 
23
 
22
24
using namespace Akonadi;
23
25
 
24
26
QList<QByteArray> SearchHelper::splitLine( const QByteArray &line )
28
30
  int i, start = 0;
29
31
  bool escaped = false;
30
32
  for ( i = 0; i < line.count(); ++i ) {
31
 
    if ( line[ i ] == ' ' ) {
 
33
    if ( line[i] == ' ' ) {
32
34
      if ( !escaped ) {
33
35
        retval.append( line.mid( start, i - start ) );
34
36
        start = i + 1;
35
37
      }
36
 
    } else if ( line[ i ] == '"' ) {
 
38
    } else if ( line[i] == '"' ) {
37
39
      if ( escaped ) {
38
40
        escaped = false;
39
41
      } else {
51
53
{
52
54
  QString mimeType;
53
55
 
54
 
  if ( junks.count() <= start )
 
56
  if ( junks.count() <= start ) {
55
57
    return QString();
 
58
  }
56
59
 
57
 
  if ( junks[ start ].toUpper() == "CHARSET" ) {
58
 
    if ( junks.count() <= ( start + 2 ) )
 
60
  if ( junks[start].toUpper() == AKONADI_PARAM_CHARSET ) {
 
61
    if ( junks.count() <= ( start + 2 ) ) {
59
62
      return QString();
60
 
    if ( junks[ start + 2 ].toUpper() == "MIMETYPE" ) {
61
 
      if ( junks.count() <= ( start + 3 ) )
 
63
    }
 
64
    if ( junks[start + 2].toUpper() == AKONADI_PARAM_MIMETYPE ) {
 
65
      if ( junks.count() <= ( start + 3 ) ) {
62
66
        return QString();
63
 
      else
64
 
        mimeType = QString::fromLatin1(junks[ start + 3 ].toLower());
 
67
      } else {
 
68
        mimeType = QString::fromLatin1( junks[start + 3].toLower() );
 
69
      }
65
70
    }
66
71
  } else {
67
 
    if ( junks[ start ].toUpper() == "MIMETYPE" ) {
68
 
      if ( junks.count() <= ( start + 1 ) )
 
72
    if ( junks[start].toUpper() == AKONADI_PARAM_MIMETYPE ) {
 
73
      if ( junks.count() <= ( start + 1 ) ) {
69
74
        return QString();
70
 
      else
71
 
        mimeType = QString::fromLatin1(junks[ start + 1 ].toLower());
 
75
      } else {
 
76
        mimeType = QString::fromLatin1( junks[start + 1].toLower() );
 
77
      }
72
78
    }
73
79
  }
74
80
 
75
 
  if ( mimeType.isEmpty() )
 
81
  if ( mimeType.isEmpty() ) {
76
82
    mimeType = QString::fromLatin1( "message/rfc822" );
 
83
  }
77
84
 
78
85
  return mimeType;
79
86
}