~ubuntu-branches/ubuntu/vivid/gloox/vivid-proposed

« back to all changes in this revision

Viewing changes to src/adhoc.h

  • Committer: Package Import Robot
  • Author(s): Vincent Cheng
  • Date: 2014-03-16 17:34:43 UTC
  • mfrom: (12.1.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20140316173443-4s177dovzaz5dm8o
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
  Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
 
2
  Copyright (c) 2004-2013 by Jakob Schroeter <js@camaya.net>
3
3
  This file is part of the gloox library. http://camaya.net/gloox
4
4
 
5
5
  This software is distributed under a license. The full license
21
21
#include "discohandler.h"
22
22
#include "iqhandler.h"
23
23
#include "stanzaextension.h"
 
24
#include "mutex.h"
24
25
 
25
26
#include <string>
26
27
#include <list>
35
36
  class AdhocCommandProvider;
36
37
 
37
38
  /**
38
 
   * @brief This class implements a provider for XEP-0050 (Ad-hoc Commands).
 
39
   * @brief This class implements a provider for @xep{0050} (Ad-hoc Commands).
39
40
   *
40
41
   * The current, not complete, implementation is probably best suited for fire-and-forget
41
42
   * type of commands. Any additional feature, like multiple stages, etc., would have to be
81
82
  {
82
83
    public:
83
84
      /**
84
 
       * @brief An abstraction of an Adhoc Command element (from Adhoc Commands, XEP-0050)
 
85
       * @brief An abstraction of an Adhoc Command element (from Adhoc Commands, @xep{0050})
85
86
       * as a StanzaExtension.
86
87
       *
87
88
       * @author Jakob Schroeter <js@camaya.net>
372
373
       * This function queries the given remote entity for Adhoc Commands support.
373
374
       * @param remote The remote entity's JID.
374
375
       * @param ah The object handling the result of this request.
 
376
       * @param context A user defined context.
375
377
       */
376
 
      void checkSupport( const JID& remote, AdhocHandler* ah );
 
378
      void checkSupport( const JID& remote, AdhocHandler* ah, int context = 0 );
377
379
 
378
380
      /**
379
381
       * Retrieves a list of commands from the remote entity. You should check whether the remote
380
382
       * entity actually supports Adhoc Commands by means of checkSupport().
381
383
       * @param remote The remote entity's JID.
382
384
       * @param ah The object handling the result of this request.
 
385
       * @param context A user defined context.
383
386
       */
384
 
      void getCommands( const JID& remote, AdhocHandler* ah );
 
387
      void getCommands( const JID& remote, AdhocHandler* ah, int context = 0 );
385
388
 
386
389
      /**
387
390
       * Executes or continues the given command on the given remote entity.
392
395
       * @param remote The remote entity's JID.
393
396
       * @param command The command to execute.
394
397
       * @param ah The object handling the result of this request.
 
398
       * @param context A user defined context.
395
399
       */
396
 
      void execute( const JID& remote, const Adhoc::Command* command, AdhocHandler* ah );
 
400
      void execute( const JID& remote, const Adhoc::Command* command, AdhocHandler* ah, int context = 0 );
397
401
 
398
402
      /**
399
403
       * Use this function to respond to an execution request submitted by means
411
415
 
412
416
      /**
413
417
       * Using this function, you can register a AdhocCommandProvider -derived object as
414
 
       * handler for a specific Ad-hoc Command as defined in XEP-0050.
415
 
       * @param acp The obejct to register as handler for the specified command.
 
418
       * handler for a specific Ad-hoc Command as defined in @xep{0050}.
 
419
       * @param acp The object to register as handler for the specified command.
416
420
       * @param command The node name of the command. Will be announced in disco#items.
417
421
       * @param name The natural-language name of the command. Will be announced in disco#items.
418
422
       */
471
475
        AdhocContext context;
472
476
        std::string session;
473
477
        AdhocHandler* ah;
 
478
        int handlerContext;
474
479
      };
475
480
      typedef std::map<std::string, TrackStruct> AdhocTrackMap;
476
481
      AdhocTrackMap m_adhocTrackMap;
 
482
      util::Mutex m_adhocTrackMapMutex;
477
483
 
478
484
      ClientBase* m_parent;
479
485