<commit_before>//
//  Dispatcher.h
//  Jabber
//
//  Created by <NAME> on Sun May 23 2004.
//  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TRXMLNode.h"
#import "Message.h"
#import "Iq.h"
#import "Presence.h"

/**
 * Formal protocol for handling messages.
 */
@protocol MessageHandler <NSObject>
/**
 * Handle the given message object.
 */
- (void) handleMessage:(Message*)aMessage;
@end
/**
 * Formal protocol for handling presence stanzas.
 */
@protocol PresenceHandler <NSObject>
/**
 * Handle the given presence object.
 */
- (void) handlePresence:(Presence*)aPresence;
@end
/**
 * Formal protocol for handling info-query packets.
 */
@protocol IqHandler <NSObject>
/**
 * Handle the given info-query object.
 */
- (void) handleIq:(Iq*)anIq;
@end

/**
 * The Dispatcher class is used for routing of received stanzas.  Once each 
 * stanza has been passed, it will be encapsulated in an object.  There are 
 * three kinds of stanza specified by XMPP:
 *
 * - Messages are one-to-one and have best-effort delivery semantics.  They
 * will typically be enqueued if they can not be delivered immediately</li>
 *
 * - Presences are one-to-many and are unreliable.</li>
 *
 * - Info-query (iq) stanzas are one-to-one, will not be enqueued, but should
 * be acknowledged with either an error or a result reply.</li>
 */
@interface Dispatcher : NSObject {
	NSMutableDictionary * iqHandlers;
	NSMutableDictionary * messageHandlers;
	NSMutableDictionary * presenceHandlers;
	id <IqHandler> defaultIqHandler;
	id <MessageHandler> defaultMessageHandler;
	id <PresenceHandler> defaultPresenceHandler;
}
/**
 * Create a new dispatcher with default handlers.  In the current implementation
 * all of these will be set to DefaultHander objects.
 */
+ (id) dispatcherWithDefaultIqHandler:(id <IqHandler>)iq 
					   messageHandler:(id <MessageHandler>)message 
					  presenceHandler:(id <PresenceHandler>)presence;
/** 
 * Initialise a new dispatcher with default handlers 
 */<commit_msg>Fixed documentation build finally.<commit_after>//
//  Dispatcher.h
//  Jabber
//
//  Created by <NAME> on Sun May 23 2004.
//  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TRXMLNode.h"
#import "Message.h"
#import "Iq.h"
#import "Presence.h"

/**
 * Formal protocol for handling messages.
 */
@protocol MessageHandler <NSObject>
/**
 * Handle the given message object.
 */
- (void) handleMessage:(Message*)aMessage;
@end
/**
 * Formal protocol for handling presence stanzas.
 */
@protocol PresenceHandler <NSObject>
/**
 * Handle the given presence object.
 */
- (void) handlePresence:(Presence*)aPresence;
@end
/**
 * Formal protocol for handling info-query packets.
 */
@protocol IqHandler <NSObject>
/**
 * Handle the given info-query object.
 */
- (void) handleIq:(Iq*)anIq;
@end

/**
 * The Dispatcher class is used for routing of received stanzas.  Once each 
 * stanza has been passed, it will be encapsulated in an object.  There are 
 * three kinds of stanza specified by XMPP:
 *
 * - Messages are one-to-one and have best-effort delivery semantics.  They
 * will typically be enqueued if they can not be delivered immediately
 *
 * - Presences are one-to-many and are unreliable.
 *
 * - Info-query (iq) stanzas are one-to-one, will not be enqueued, but should
 * be acknowledged with either an error or a result reply.
 */
@interface Dispatcher : NSObject {
	NSMutableDictionary * iqHandlers;
	NSMutableDictionary * messageHandlers;
	NSMutableDictionary * presenceHandlers;
	id <IqHandler> defaultIqHandler;
	id <MessageHandler> defaultMessageHandler;
	id <PresenceHandler> defaultPresenceHandler;
}
/**
 * Create a new dispatcher with default handlers.  In the current implementation
 * all of these will be set to DefaultHander objects.
 */
+ (id) dispatcherWithDefaultIqHandler:(id <IqHandler>)iq 
					   messageHandler:(id <MessageHandler>)message 
					  presenceHandler:(id <PresenceHandler>)presence;
/** 
 * Initialise a new dispatcher with default handlers 
 */
{'fraction_non_alphanumeric': 0.1087702106810387, 'fraction_numerical': 0.004899559039686428, 'mean_word_length': 4.015970515970516, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6155301', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1212, 'n_words': 421}