-
Notifications
You must be signed in to change notification settings - Fork 1
/
SHIRCSocket.h
executable file
·70 lines (64 loc) · 2.22 KB
/
SHIRCSocket.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// SHIRCSocket.h
// ShadowChat
//
// Created by qwerty or on 06/09/11.
// Copyright 2011 uiop. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Foundation/NSStream.h"
@class SHIRCChannel;
@class SHIRCSocket;
typedef enum SHSocketStaus {
SHSocketStausNotOpen,
SHSocketStausConnecting,
SHSocketStausOpen,
SHSocketStausError,
SHSocketStausClosed
} SHSocketStaus;
@interface SHIRCSocket : NSObject <NSStreamDelegate> {
NSInputStream *input;
NSOutputStream *output;
NSString *server;
int port;
BOOL usesSSL;
SHSocketStaus status;
NSMutableString *data;
BOOL didRegister;
NSMutableArray *commandsWaiting;
NSMutableString *queuedCommands;
NSMutableArray *_channels;
NSString *nick_;
BOOL canWrite;
id delegate;
int bgTask;
id jCallback;
}
@property(retain, readwrite) NSInputStream *input;
@property(retain, readwrite) NSOutputStream *output;
@property(retain, readwrite) NSString *server;
@property(retain, readwrite) NSString *nick_;
@property(assign, readwrite) NSMutableArray *_channels;
@property(assign, readwrite) int port;
@property(assign, readwrite) BOOL usesSSL;
@property(assign, readwrite) BOOL didRegister;
@property(assign, readwrite) SHSocketStaus status;
@property(assign, readwrite) id delegate;
+ (SHIRCSocket *)socketWithServer:(NSString *)srv andPort:(int)prt usesSSL:(BOOL)ssl;
- (BOOL)connectWithNick:(NSString *)nick andUser:(NSString *)user;
- (BOOL)connectWithNick:(NSString *)nick andUser:(NSString *)user andPassword:(NSString *)pass;
- (BOOL)sendCommand:(NSString *)command withArguments:(NSString *)args;
- (BOOL)sendCommand:(NSString *)command withArguments:(NSString *)args waitUntilRegistered:(BOOL)wur;
- (void)stream:(NSStream *)theStream handleEvent:(NSStreamEvent)streamEvent;
- (void)disconnect;
- (id)channels;
- (void)findAvailableRoomsWithCallback:(id)cBack;
- (void)addRoom:(NSString *)room withRoomInfo:(NSDictionary *)infos;
- (void)joinChannel:(SHIRCChannel *)chan;
- (void)partChannel:(SHIRCChannel *)chan;
- (void)addChannel:(SHIRCChannel *)chan;
- (void)removeChannel:(SHIRCChannel *)chan;
- (void)setDidRegister:(BOOL)didReg;
- (void)dealloc;
- (SHIRCChannel *)retainedChannelWithFormattedName:(NSString *)fName;
@end