1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 """Client event interfaces
22
23 The interfaces defined in this module allow receiving core notification events
24 from the client.
25
26 @sort: ClientEventInterface
27 @group Enums: ClientState, ClientErrorType
28 @group Error Enums: NetworkError, AuthenticationError, ProtocolError,
29 AddressBookError, OfflineMessagesBoxError"""
30
31 from papyon.event import BaseEventInterface
32
33 import papyon.gnet
34 import papyon.service.AddressBook.constants
35 import papyon.service.OfflineIM.constants
36 import papyon.msnp
37
38 __all__ = [ "ClientState", "ClientErrorType",
39 "NetworkError", "AuthenticationError", "ProtocolError",
40 "AddressBookError", "OfflineMessagesBoxError",
41 "ClientEventInterface" ]
42
53
55 """L{Client<papyon.Client>} error types
56 @see: L{ClientEventInterface.on_client_error}"""
57
58 NETWORK = 0
59 "Network related errors"
60 AUTHENTICATION = 1
61 "Authentication related errors"
62 PROTOCOL = 2
63 "Protocol related errors"
64 ADDRESSBOOK = 3
65 "Address book related errors"
66 OFFLINE_MESSAGES = 4
67 "Offline IM related errors"
68
69 NetworkError = papyon.gnet.IoError
70 "Network related errors"
71
78
84
85 AddressBookError = papyon.service.AddressBook.constants.AddressBookError
86 OfflineMessagesBoxError = papyon.service.OfflineIM.constants.OfflineMessagesBoxError
87
88
90 """Interface allowing the user to get notified about the
91 L{Client<papyon.Client>} events"""
92
94 """Initializer
95 @param client: the client we want to be notified for its events
96 @type client: L{Client<papyon.Client>}"""
97 BaseEventInterface.__init__(self, client)
98
100 """Called when the state of the L{Client<papyon.Client>} changes.
101 @param state: the new state of the client
102 @type state: L{ClientState}"""
103 pass
104
106 """Called when an error occurs in the L{Client<papyon.Client>}.
107
108 @param type: the error type
109 @type type: L{ClientErrorType}
110
111 @param error: the error code
112 @type error: L{NetworkError} or L{AuthenticationError} or
113 L{ProtocolError} or L{AddressBookError} or
114 L{OfflineMessagesBoxError}"""
115 pass
116