-
Notifications
You must be signed in to change notification settings - Fork 52
/
API_CHANGE
70 lines (53 loc) · 2.75 KB
/
API_CHANGE
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
API Change (0.2.0 -> 0.3.0) Documentation
-----------------------------------------
This file is only relevent for you if you wrote an IRC application that is
SmartIrc4net 0.2.0 based! If you didn't use SmartIrc4net yet, you can safely
ignore this file and just continue on hacking a great IRC application ;)
The API naming between SmartIrc4net 0.2.0 and 0.3.0 changed a lot, mostly
because of .NET library standards.
Here are the changes:
- All RFC commands in IrcCommands are now prefixed with "Rfc"
If you used the Join() method, then you need to change your calls to
RfcJoin(). The reason is for this change is that the most commands are plain
RFC wrapper methods. This way you can easily distinguish between API
commands/feature and plain RFC commands. Another reason was conflicts or
confusing names like Admin(), Version() or Ison().
Message() got renamed to SendMessage() which makes more clear what that
method actually does.
- All delegates now uses .NET standards conform signatures
If you used JoinEventHandler which was:
JoinEventHandler(string channel, string who, Data ircdata)
it's now:
JoinEventHandler(object sender, JoinEventArgs e);
This way the .NET library standards suggest, because those JoinEventArgs
which extends IrcEventArgs which extends EventArgs can be easily changed at
any time later for additional data.
The "sender" argument is type IrcClient, the irc client object that triggered
the event (very useful for multiple irc connections).
IrcEventArgs always contain the property "Data"
(type IrcMessageData, formerly known as type Data)
This means you have to change all your event method signatures, e.g.:
If you had an event method for OnJoin it was like this:
MyOnJoinMethod(string channel, string who, Data ircdata) {
System.Console.WriteLine(who+" joined on "+channel+"!");
}
you need to change that to:
MyOnJoinMethod(object sender, JoinEventArgs e) {
System.Console.WriteLine(e.Who+" joined on "+e.Channel+"!");
}
you still have the whole parsed IRC message in e.Data!
- Connect() Disconnect() Reconnect() don't return bool anymore
They use now proper exception handling, so catch them!
There is ConnectionException which work for all 3 methods, and also more
specific exception types like:
CouldNotConnectException
AlreadyConnectedException
NotConnectionException
There is also a very general exception type which will catch ANY exception
that SmartIrc4net will throw! It's called:
SmartIrc4netException
- ChannelSync property is renamed to ActiveChannelSync
(read more about in the CHANGELOG)
- Any method that will send a message can throw an exception!
If the IRC library is not connected and you try to send any message, then
a NotConnectedException will be thrown!