~ubuntu-branches/debian/stretch/geary/stretch

« back to all changes in this revision

Viewing changes to src/engine/imap/command/imap-search-criterion.vala

  • Committer: Package Import Robot
  • Author(s): Vincent Cheng
  • Date: 2015-04-29 02:55:37 UTC
  • mfrom: (3.1.13)
  • Revision ID: package-import@ubuntu.com-20150429025537-6o00z6549l6c70qz
Tags: 0.10.0-1
New upstream release. (Closes: #782594)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2013-2014 Yorba Foundation
 
1
/* Copyright 2013-2015 Yorba Foundation
2
2
 *
3
3
 * This software is licensed under the GNU Lesser General Public License
4
4
 * (version 2.1 or later).  See the COPYING file in this distribution.
44
44
     * Create a single criterion with a simple name and custom value.
45
45
     */
46
46
    public SearchCriterion.string_value(string name, string value) {
47
 
        Parameter? valuep = StringParameter.get_best_for(value);
48
 
        if (valuep == null)
49
 
            valuep = new LiteralParameter(new Memory.StringBuffer(value));
50
 
        
51
47
        parameters.add(prep_name(name));
52
 
        parameters.add(valuep);
 
48
        parameters.add(Parameter.get_for_string(value));
53
49
    }
54
50
    
55
51
    private static Parameter prep_name(string name) {
56
 
        Parameter? namep = StringParameter.get_best_for(name);
 
52
        Parameter? namep = StringParameter.try_get_best_for(name);
57
53
        if (namep == null) {
58
54
            warning("Using a search name that requires a literal parameter: %s", name);
59
55
            namep = new LiteralParameter(new Memory.StringBuffer(name));
106
102
    /**
107
103
     * The IMAP SEARCH KEYWORD criterion, or if the {@link MessageFlag} has a macro, that value.
108
104
     */
109
 
    public static SearchCriterion has_flag(MessageFlag flag) {
 
105
    public static SearchCriterion has_flag(MessageFlag flag) throws ImapError {
110
106
        string? keyword = flag.get_search_keyword(true);
111
107
        if (keyword != null)
112
108
            return new SearchCriterion.simple(keyword);
117
113
    /**
118
114
     * The IMAP SEARCH UNKEYWORD criterion, or if the {@link MessageFlag} has a macro, that value.
119
115
     */
120
 
    public static SearchCriterion has_not_flag(MessageFlag flag) {
 
116
    public static SearchCriterion has_not_flag(MessageFlag flag) throws ImapError {
121
117
        string? keyword = flag.get_search_keyword(false);
122
118
        if (keyword != null)
123
119
            return new SearchCriterion.simple(keyword);