-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdiumCodePlugin.m
More file actions
77 lines (59 loc) · 1.79 KB
/
AdiumCodePlugin.m
File metadata and controls
77 lines (59 loc) · 1.79 KB
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
//
// Created by Mike Thomson on 09/11/08.
// Copyright 2012 Mike Thomson. All rights reserved.
//
#import "AdiumCodePlugin.h"
#import "WindowController.h"
@implementation AdiumCodePlugin
NSMutableArray * windowArray;
- (void)installPlugin
{
NSLog(@"CodePlugin installed");
windowArray = [NSMutableArray alloc];
// Changes actual message and non-message content
[[adium contentController] registerContentFilter:self ofType:AIFilterContent direction:AIFilterOutgoing];
[[adium contentController] registerContentFilter:self ofType:AIFilterContent direction:AIFilterIncoming];
}
- (void)uninstallPlugin
{
NSLog(@"CodePlugin uninstalled");
[[adium contentController] unregisterContentFilter:self];
}
- (NSAttributedString *)filterAttributedString:(NSAttributedString *)inAttributedString context:(id)context
{
NSMutableAttributedString *newMessage = [[NSMutableAttributedString alloc] initWithAttributedString:inAttributedString];
// Detect the %CODE marker
NSString *temp = [newMessage string] ;
if ([temp hasPrefix:@"%CODE "]) {
WindowController * pop;
pop = [[WindowController alloc] initWithWindowNibName:@"WindowController"];
temp = [temp substringFromIndex:6];
[pop showWindow:self];
[pop setMyCodeText:temp];
[windowArray addObject:pop];
[temp release];
return [[NSAttributedString alloc] initWithString:@"Replaced by CodePlugin"] ;
}
return inAttributedString;
}
- (float)filterPriority
{
return DEFAULT_FILTER_PRIORITY;
}
- (NSString *)pluginAuthor
{
return @"Mike Thomson";
}
- (NSString *)pluginVersion
{
return @"0.1";
}
- (NSString *)pluginDescription
{
return @"This plugin makes it easier to read pasted code blocks";
}
- (NSString *)pluginURL
{
return @"http://www.bluetempest.net";
}
@end