gloox  0.9.9.12
search.h
1 /*
2  Copyright (c) 2006-2008 by Jakob Schroeter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 
15 #ifndef SEARCH_H__
16 #define SEARCH_H__
17 
18 #include "gloox.h"
19 #include "searchhandler.h"
20 #include "discohandler.h"
21 #include "iqhandler.h"
22 
23 #include <string>
24 
25 namespace gloox
26 {
27 
28  class ClientBase;
29  class Stanza;
30  class Disco;
31 
47  class GLOOX_API Search : public IqHandler
48  {
49 
50  public:
55  Search( ClientBase *parent );
56 
60  ~Search();
61 
67  void fetchSearchFields( const JID& directory, SearchHandler *sh );
68 
76  void search( const JID& directory, const DataForm& form, SearchHandler *sh );
77 
87  void search( const JID& directory, int fields, const SearchFieldStruct& values, SearchHandler *sh );
88 
89  // reimplemented from IqHandler
90  virtual bool handleIq( Stanza *stanza ) { (void) stanza; return false; }
91 
92  // reimplemented from IqHandler
93  virtual bool handleIqID( Stanza *stanza, int context );
94 
95  protected:
96  enum IdType
97  {
98  FetchSearchFields,
99  DoSearch
100  };
101 
102  typedef std::map<std::string, SearchHandler*> TrackMap;
103  TrackMap m_track;
104 
105  ClientBase *m_parent;
106  Disco *m_disco;
107 
108  };
109 
110 }
111 
112 #endif // SEARCH_H__