Source

MYUtilities / iChatBridge.h

Full commit
  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
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
/*
 * iChat.h
 */

#import <AppKit/AppKit.h>
#import <ScriptingBridge/ScriptingBridge.h>


@class iChatItem, iChatApplication, iChatColor, iChatDocument, iChatWindow, iChatRichText, iChatCharacter, iChatParagraph, iChatWord, iChatAttributeRun, iChatAttachment, iChatApplication, iChatBuddy, iChatService, iChatChat, iChatTextChat, iChatAudioChat, iChatVideoChat, iChatFileTransfer;

typedef enum {
	iChatSaveOptionsYes = 'yes ' /* Save the file. */,
	iChatSaveOptionsNo = 'no  ' /* Do not save the file. */,
	iChatSaveOptionsAsk = 'ask ' /* Ask the user whether or not to save the file. */
} iChatSaveOptions;

typedef enum {
	iChatInviteTypeAudioInvitation = 'acon',
	iChatInviteTypeTextChatInvitation = 'tcon',
	iChatInviteTypeVideoInvitation = 'vcon'
} iChatInviteType;

typedef enum {
	iChatAccountStatusAvailable = 'aval',
	iChatAccountStatusAway = 'away',
	iChatAccountStatusOffline = 'offl',
	iChatAccountStatusInvisible = 'invs',
	iChatAccountStatusIdle = 'idle',
	iChatAccountStatusUnknown = 'unkn'
} iChatAccountStatus;

typedef enum {
	iChatMyStatusAway = 'away',
	iChatMyStatusAvailable = 'aval',
	iChatMyStatusOffline = 'offl',
	iChatMyStatusInvisible = 'invs'
} iChatMyStatus;

typedef enum {
	iChatConnectionStatusDisconnecting = 'dcng',
	iChatConnectionStatusConnected = 'conn',
	iChatConnectionStatusConnecting = 'cong',
	iChatConnectionStatusDisconnected = 'dcon'
} iChatConnectionStatus;

typedef enum {
	iChatCapabilitiesVideoChat = 'vcon',
	iChatCapabilitiesAudioChat = 'acon',
	iChatCapabilitiesMultipersonVideo = 'mwvc',
	iChatCapabilitiesMultipersonAudio = 'mwac'
} iChatCapabilities;

typedef enum {
	iChatScreenSharingNone = 'ssns',
	iChatScreenSharingLocalScreen = 'ssls',
	iChatScreenSharingRemoteScreen = 'ssrs'
} iChatScreenSharing;

typedef enum {
	iChatServiceTypeAIM = 'saim',
	iChatServiceTypeBonjour = 'ssub',
	iChatServiceTypeJabber = 'sjab'
} iChatServiceType;

typedef enum {
	iChatDirectionIncoming = 'FTic',
	iChatDirectionOutgoing = 'FTog'
} iChatDirection;

typedef enum {
	iChatTransferStatusPreparing = 'FTsp',
	iChatTransferStatusWaiting = 'FTsw',
	iChatTransferStatusTransferring = 'FTsg',
	iChatTransferStatusFinalizing = 'FTsz',
	iChatTransferStatusFinished = 'FTsf',
	iChatTransferStatusFailed = 'FTse'
} iChatTransferStatus;

typedef enum {
	iChatAvTypeAudio = 'ICAa',
	iChatAvTypeVideo = 'ICAv'
} iChatAvType;

typedef enum {
	iChatChatTypeInstantMessage = 'ICim',
	iChatChatTypeDirectInstantMessage = 'ICdi',
	iChatChatTypeChatRoom = 'ICcr'
} iChatChatType;

typedef enum {
	iChatJoinStateNotJoined = 'ICJc',
	iChatJoinStateJoining = 'ICJg',
	iChatJoinStateJoined = 'ICJj'
} iChatJoinState;

typedef enum {
	iChatAvConnectionStatusInvited = 'ICAi',
	iChatAvConnectionStatusWaiting = 'ICAw',
	iChatAvConnectionStatusConnecting = 'ICAx',
	iChatAvConnectionStatusConnected = 'ICAc',
	iChatAvConnectionStatusEnded = 'ICAn'
} iChatAvConnectionStatus;



/*
 * Standard Suite
 */

// A scriptable object.
@interface iChatItem : SBObject

@property (copy) NSDictionary *properties;  // All of the object's properties.

- (void) closeSaving:(iChatSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save a document.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (BOOL) exists;  // Verify if an object exists.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.

@end

// The application's top-level scripting object.
@interface iChatApplication : SBApplication

- (SBElementArray *) documents;
- (SBElementArray *) windows;

@property (copy, readonly) NSString *name;  // The name of the application.
@property (readonly) BOOL frontmost;  // Is this the frontmost (active) application?
@property (copy, readonly) NSString *version;  // The version of the application.

- (void) open:(NSArray *)x;  // Open a document.
- (void) print:(NSURL *)x;  // Print an object.
- (void) quitSaving:(iChatSaveOptions)saving;  // Quit the application.
- (void) invite:(NSArray *)x to:(id)to withMessage:(NSString *)withMessage;  // Invites a buddy to join an existing chat.
- (void) logIn;  // Log in to the specified service, or all services if none is specified. If the account password is not in the keychain the user will be prompted to enter one.
- (void) logOut;  // Logs out of a service, or all services if none is specified.
- (void) send:(id)x to:(id)to;  // Sends a message or file to a buddy or to a chat.
- (void) storeRecentPicture;  // Stores the currently set buddy picture into your recent pictures.
- (void) showChatChooserFor:(iChatBuddy *)for_;  // displays a dialog in iChat to start a new chat with the specified buddy

@end

// A color.
@interface iChatColor : SBObject

- (void) closeSaving:(iChatSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save a document.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (BOOL) exists;  // Verify if an object exists.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.

@end

// An iChat document.
@interface iChatDocument : SBObject

@property (copy, readonly) NSString *name;  // The document's name.
@property (readonly) BOOL modified;  // Has the document been modified since the last save?
@property (copy, readonly) NSURL *file;  // The document's location on disk.

- (void) closeSaving:(iChatSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save a document.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (BOOL) exists;  // Verify if an object exists.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.

@end

// A window.
@interface iChatWindow : SBObject

@property (copy, readonly) NSString *name;  // The full title of the window.
- (NSInteger) id;  // The unique identifier of the window.
@property NSInteger index;  // The index of the window, ordered front to back.
@property NSRect bounds;  // The bounding rectangle of the window.
@property (readonly) BOOL closeable;  // Whether the window has a close box.
@property (readonly) BOOL minimizable;  // Whether the window can be minimized.
@property BOOL minimized;  // Whether the window is currently minimized.
@property (readonly) BOOL resizable;  // Whether the window can be resized.
@property BOOL visible;  // Whether the window is currently visible.
@property (readonly) BOOL zoomable;  // Whether the window can be zoomed.
@property BOOL zoomed;  // Whether the window is currently zoomed.
@property (copy, readonly) iChatDocument *document;  // The document whose contents are being displayed in the window.

- (void) closeSaving:(iChatSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save a document.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (BOOL) exists;  // Verify if an object exists.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.

@end



/*
 * Text Suite
 */

// Rich (styled) text
@interface iChatRichText : SBObject

- (SBElementArray *) characters;
- (SBElementArray *) paragraphs;
- (SBElementArray *) words;
- (SBElementArray *) attributeRuns;
- (SBElementArray *) attachments;

@property (copy) NSColor *color;  // The color of the first character.
@property (copy) NSString *font;  // The name of the font of the first character.
@property double size;  // The size in points of the first character.

- (void) closeSaving:(iChatSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save a document.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (BOOL) exists;  // Verify if an object exists.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.

@end

// This subdivides the text into characters.
@interface iChatCharacter : SBObject

- (SBElementArray *) characters;
- (SBElementArray *) paragraphs;
- (SBElementArray *) words;
- (SBElementArray *) attributeRuns;
- (SBElementArray *) attachments;

@property (copy) NSColor *color;  // The color of the first character.
@property (copy) NSString *font;  // The name of the font of the first character.
@property NSInteger size;  // The size in points of the first character.

- (void) closeSaving:(iChatSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save a document.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (BOOL) exists;  // Verify if an object exists.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.

@end

// This subdivides the text into paragraphs.
@interface iChatParagraph : SBObject

- (SBElementArray *) characters;
- (SBElementArray *) paragraphs;
- (SBElementArray *) words;
- (SBElementArray *) attributeRuns;
- (SBElementArray *) attachments;

@property (copy) NSColor *color;  // The color of the first character.
@property (copy) NSString *font;  // The name of the font of the first character.
@property NSInteger size;  // The size in points of the first character.

- (void) closeSaving:(iChatSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save a document.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (BOOL) exists;  // Verify if an object exists.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.

@end

// This subdivides the text into words.
@interface iChatWord : SBObject

- (SBElementArray *) characters;
- (SBElementArray *) paragraphs;
- (SBElementArray *) words;
- (SBElementArray *) attributeRuns;
- (SBElementArray *) attachments;

@property (copy) NSColor *color;  // The color of the first character.
@property (copy) NSString *font;  // The name of the font of the first character.
@property NSInteger size;  // The size in points of the first character.

- (void) closeSaving:(iChatSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save a document.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (BOOL) exists;  // Verify if an object exists.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.

@end

// This subdivides the text into chunks that all have the same attributes.
@interface iChatAttributeRun : SBObject

- (SBElementArray *) characters;
- (SBElementArray *) paragraphs;
- (SBElementArray *) words;
- (SBElementArray *) attributeRuns;
- (SBElementArray *) attachments;

@property (copy) NSColor *color;  // The color of the first character.
@property (copy) NSString *font;  // The name of the font of the first character.
@property NSInteger size;  // The size in points of the first character.

- (void) closeSaving:(iChatSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save a document.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (BOOL) exists;  // Verify if an object exists.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.

@end

// Represents an inline text attachment. This class is used mainly for make commands.
@interface iChatAttachment : iChatRichText

@property (copy, readonly) NSURL *file;  // The path to the file for the attachment


@end



/*
 * iChat Suite
 */

// iChat application.
@interface iChatApplication (IChatSuite)

- (SBElementArray *) buddies;
- (SBElementArray *) services;
- (SBElementArray *) fileTransfers;
- (SBElementArray *) chats;
- (SBElementArray *) textChats;
- (SBElementArray *) audioChats;
- (SBElementArray *) videoChats;

@property (readonly) NSInteger idleTime;  // Time in seconds that I have been idle.
@property (copy) NSImage *image;  // My image as it appears in all services.
@property (copy) NSString *statusMessage;  // My status message, visible to other people while I am online.
@property iChatMyStatus status;  // My status on all services.
@property (copy) iChatAudioChat *activeAvChat;  // The currently active audio or video chat.

@end

// A buddy on a service.
@interface iChatBuddy : iChatItem

- (NSString *) id;  // The buddy's service and handle. For example: AIM:JohnDoe007
@property (copy, readonly) iChatService *service;  // The service on which this buddy exists.
@property (copy, readonly) NSString *name;  // The buddy's name as it appears in the buddy list.
@property (copy, readonly) NSString *handle;  // The buddy's online account name.
@property (readonly) iChatAccountStatus status;  // The buddy's current status.
@property (copy, readonly) NSString *statusMessage;  // The buddy's current status message.
@property (readonly) NSInteger idleTime;  // The time in seconds the buddy has been idle.
@property (copy, readonly) NSArray *capabilities;  // The buddy's messaging capabilities.
@property (copy, readonly) NSImage *image;  // The buddy's custom image.
@property (copy, readonly) NSString *firstName;  // The first name from this buddy's Address Book card, if available
@property (copy, readonly) NSString *lastName;  // The last name from this buddy's Address Book card, if available
@property (copy, readonly) NSString *fullName;  // The full name from this buddy's Address Book card, if available


@end

// A service that can be logged in from this system
@interface iChatService : iChatItem

- (SBElementArray *) buddies;
- (SBElementArray *) chats;

- (NSString *) id;  // A guid identifier for this service.
@property (copy) NSString *name;  // The name of this service as defined in Account preferences description field
@property BOOL enabled;  // Is the service enabled?
@property (readonly) iChatConnectionStatus status;  // The connection status for this account.
@property (readonly) iChatServiceType serviceType;  // The type of protocol for this service

- (void) logIn;  // Log in to the specified service, or all services if none is specified. If the account password is not in the keychain the user will be prompted to enter one.
- (void) logOut;  // Logs out of a service, or all services if none is specified.

@end

// An audio, video, or text chat.
@interface iChatChat : SBObject

- (NSString *) id;  // A guid identifier for this chat.
@property (copy, readonly) iChatService *service;  // The service which is participating in this chat.
@property (copy, readonly) NSArray *participants;  // Other participants of this chat. This property may be specified at time of creation.
@property (readonly) BOOL secure;  // Is this chat secure?
@property (readonly) BOOL invitation;  // Is this an invitation to a chat?
@property (readonly) BOOL active;  // Is this chat currently active?
@property (copy, readonly) NSDate *started;  // The date on which this chat started.
@property (copy, readonly) NSDate *updated;  // The date when this chat was last updated.

- (void) closeSaving:(iChatSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
- (void) saveIn:(NSURL *)in_ as:(NSString *)as;  // Save a document.
- (void) delete;  // Delete an object.
- (SBObject *) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
- (BOOL) exists;  // Verify if an object exists.
- (SBObject *) moveTo:(SBObject *)to;  // Move object(s) to a new location.
- (void) accept;  // Accepts an incoming text, audio, or video chat invitation, or file transfer
- (void) decline;  // Declines an incoming text, audio, or video chat invitation, or file transfer

@end

// A text chat.
@interface iChatTextChat : iChatChat

@property (copy, readonly) NSString *subject;  // The subject of this chat, if available.
@property (copy, readonly) NSString *invitationMessage;  // An invitation message. This may only be specified at the time of creation. This message will be sent to chat participants when the chat is created.
@property (readonly) iChatJoinState joinState;  // How you are joined to this chat
@property (copy, readonly) NSString *name;  // The address or room name of this chat. This property may be specified at time of creation.
@property (readonly) iChatChatType chatType;  // The type of this chat.


@end

// An audio or video chat.
@interface iChatAudioChat : iChatChat

@property (readonly) iChatScreenSharing screenSharing;  // Type of screen sharing session taking place within this chat.
@property BOOL muted;  // Is the chat muted?
@property (readonly) iChatAvConnectionStatus avConnectionStatus;  // The connection state for this av chat.

- (void) requestRecording;  // Sends a recording request to all participants of an audio or video chat. Recording will not start until all participants have agreed to allow recording.
- (void) stopRecording;  // Ends recording of an audio or video chat.

@end

@interface iChatVideoChat : iChatAudioChat

@property BOOL paused;  // Is the chat paused?
@property BOOL showingFullScreen;  // Is the chat being displayed in full screen mode?
@property BOOL showingLocalVideo;  // Is the local video preview being displayed?

- (void) takeSnapshot;  // Takes a snapshot of a video chat and saves it to a desktop.

@end

// A file being sent or received
@interface iChatFileTransfer : iChatItem

- (NSString *) id;  // The guid for this file transfer
@property (copy, readonly) NSString *name;  // The name of this file
@property (copy, readonly) NSURL *file;  // The local path to this file transfer
@property (readonly) iChatDirection direction;  // The direction in which this file is being sent
@property (copy, readonly) iChatService *service;  // The service on which this file transfer is taking place
@property (copy, readonly) iChatBuddy *buddy;  // The account participating in this file transfer
@property (readonly) BOOL secure;  // Is this file transfer secure?
@property (readonly) NSInteger fileSize;  // The total size in bytes of the completed file transfer
@property (readonly) NSInteger fileProgress;  // The number of bytes that have been transferred
@property (readonly) iChatTransferStatus transferStatus;  // The current status of this file transfer
@property (copy, readonly) NSDate *started;  // The date that this file transfer started

- (void) accept;  // Accepts an incoming text, audio, or video chat invitation, or file transfer
- (void) decline;  // Declines an incoming text, audio, or video chat invitation, or file transfer

@end