Skip to content

Commit 29575ae

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 606757d + b0569ca commit 29575ae

7 files changed

Lines changed: 191 additions & 65 deletions

File tree

doc/source/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,5 @@
252252

253253
# Example configuration for intersphinx: refer to the Python standard library.
254254
intersphinx_mapping = {'http://docs.python.org/': None}
255+
256+
autodoc_member_order = 'bysource'

doc/source/history.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Changelog
22
=========
33

4+
v0.2.2 (2015-04-11)
5+
-------------------
6+
7+
* bug fix: client tried to process partially received messages
8+
* bug fix: processing of operator- and voice-mode changes resulted in inconsistent data structures
9+
10+
v0.2.1 (2015-04-10)
11+
-------------------
12+
13+
* bug fix: the bot no longer received messages from a channel after another user got kicked from it
14+
415
v0.2.0 (2015-03-05)
516
-------------------
617

doc/source/index.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ least version 3.3. It only depends on
1212
`asyncio <https://pypi.python.org/pypi/asyncio>`_ which is part of the
1313
standard library since Python 3.4 anyway.
1414

15+
.. warning:: While fully usable, FredIRC is still pre-1.0 software and has no backwards
16+
compatibility guarantees until the 1.0 release occurs. Please make sure to
17+
read the :doc:`history` carefully anytime you upgrade!
18+
1519
Features
1620
--------
1721

@@ -21,12 +25,6 @@ The main features are:
2125
* Internal event-loop that dispatches high-level IRC events
2226
* Different kinds of tasks which can be scheduled by the user
2327

24-
.. note:: FredIRC is **already usable** but the project is still in an early
25-
stage of development. So far only the very basics needed to write
26-
simple IRC bots are implemented. As long as FredIRC has a 0.x.x
27-
version number, backward-incompatible API changes might be
28-
introduced (but mentioned in the change log).
29-
3028
For a more detailed list of features see the :doc:`history`.
3129

3230
Links

doc/source/install.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ can be installed by:
3737
3838
$ pip install dist/FredIRC-X.X.X.tar.gz
3939
40+
**Alternative:**
41+
42+
If you really want to avoid using
43+
pip and miss `all its benefits <https://pip.pypa.io/en/stable/user_guide.html>`_
44+
you can just use the `setup.py`-script of course:
45+
46+
.. code-block:: bash
47+
48+
$ python setup.py install
49+
4050
Build the Documentation
4151
-----------------------
4252

fredirc/client.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,17 @@ def register(self, nick=None, user_name=None, real_name=None, password=None):
207207
self._send_message(messages.user(
208208
self._configured_user_name, self._configured_real_name))
209209

210+
def change_nick(self, nick):
211+
""" Change the nick name of the client.
212+
213+
Note that the clients :py:attr:`.nick`-property will not change
214+
directly, but only after the server acknowledged the new nick name.
215+
216+
Args:
217+
nick (str): The new nick name.
218+
"""
219+
self._send_message(messages.nick(nick))
220+
210221
def join(self, channel, *channels):
211222
""" Join the specified channel(s).
212223
@@ -278,10 +289,6 @@ def kick(self, user, channel, reason=None):
278289
"""
279290
self._send_message(messages.kick((channel,), (user,), reason))
280291

281-
def pong(self):
282-
""" Send a pong message to the server. """
283-
self._send_message(messages.pong(self._state.server))
284-
285292
def give_op(self, user, channel):
286293
""" Grant operator rights to a user on a channel.
287294
@@ -356,6 +363,10 @@ def has_voice_in(self, channel):
356363
"""
357364
return channel.lower() in self._state.has_voice_in
358365

366+
def pong(self):
367+
""" Send a pong message to the server. """
368+
self._send_message(messages.pong(self._state.server))
369+
359370
# --- Private methods ---
360371

361372
def _send_message(self, message):

fredirc/handler.py

Lines changed: 111 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -45,41 +45,6 @@ def handle_register(self):
4545
""" The client successfully registered to the server. """
4646
pass
4747

48-
def handle_ping(self, server):
49-
""" Received a ping message from the server.
50-
51-
Args:
52-
server (str): name or ip of the server.
53-
"""
54-
pass
55-
56-
def handle_response(self, response, message):
57-
""" A numeric response was received from the server.
58-
59-
See the IRC client protocol specification for valid numeric response
60-
codes and their meaning. There are extra handler methods for many
61-
common responses, but this general handler is always called first.
62-
63-
Args:
64-
response (int): 3-digit response code (between 0 and 399)
65-
message (str): the whole, raw message
66-
"""
67-
pass
68-
69-
def handle_error(self, error, **params):
70-
""" An irc error message was received from the server.
71-
72-
The error codes are defined in :py:class:`Err<fredirc.Err>`.
73-
The contents of the params dictionary depend on the specific error.
74-
See the documentation of :py:class:`Err<fredirc.Err>` for details.
75-
76-
Args:
77-
error (int): 3-digit error code (between 400 and 599)
78-
params (dict): Parameters of the error message, each consisting of \
79-
a parameter name and a value.
80-
"""
81-
pass
82-
8348
def handle_channel_message(self, channel, message, sender=None):
8449
""" Received a message to a channel.
8550
@@ -107,7 +72,7 @@ def handle_private_message(self, message, sender=None):
10772
pass
10873

10974
def handle_join(self, channel, nick):
110-
""" Called when a user joined the channel.
75+
""" Called when another user joined the channel.
11176
11277
To handle joins of the IRCClient itself, use
11378
:py:meth:`.handle_own_join`.
@@ -129,7 +94,7 @@ def handle_own_join(self, channel):
12994
pass
13095

13196
def handle_part(self, channel, nick, message=None):
132-
""" Called when a user left the channel.
97+
""" Called when another user left the channel.
13398
13499
To handle partings of the IRCClient itself, use
135100
:py:meth:`.handle_own_part`.
@@ -152,9 +117,7 @@ def handle_own_part(self, channel):
152117
pass
153118

154119
def handle_kick(self, channel, nick, initiator, reason):
155-
""" A user got kicked from a channel.
156-
157-
Might be the IRCClient itself.
120+
""" Another user got kicked from a channel.
158121
159122
Args:
160123
channel (str): the channel
@@ -163,8 +126,17 @@ def handle_kick(self, channel, nick, initiator, reason):
163126
"""
164127
pass
165128

129+
def handle_own_kick(self, channel, initiator, reason):
130+
""" The IRCClient got kicked from a channel.
131+
132+
Args:
133+
channel (str): the channel
134+
reason (str): reason for the kick (might be None)
135+
"""
136+
pass
137+
166138
def handle_got_op(self, channel, nick, initiator):
167-
""" A user received operator status.
139+
""" Another user received operator status.
168140
169141
Args:
170142
channel (str): name of the channel
@@ -173,8 +145,17 @@ def handle_got_op(self, channel, nick, initiator):
173145
"""
174146
pass
175147

148+
def handle_own_got_op(self, channel, initiator):
149+
""" The IRCClient received operator status.
150+
151+
Args:
152+
channel (str): name of the channel
153+
initiator (str): the user who granted the operator rights
154+
"""
155+
pass
156+
176157
def handle_lost_op(self, channel, nick, initiator):
177-
""" A user lost operator status.
158+
""" Another user lost operator status.
178159
179160
Args:
180161
channel (str): name of the channel
@@ -183,8 +164,17 @@ def handle_lost_op(self, channel, nick, initiator):
183164
"""
184165
pass
185166

167+
def handle_own_lost_op(self, channel, initiator):
168+
""" The IRCClient lost operator status.
169+
170+
Args:
171+
channel (str): name of the channel
172+
initiator (str): the user who initiated the mode change
173+
"""
174+
pass
175+
186176
def handle_got_voice(self, channel, nick, initiator):
187-
""" A user received voice rights.
177+
""" Another user received voice rights.
188178
189179
Args:
190180
channel (str): name of the channel
@@ -193,8 +183,17 @@ def handle_got_voice(self, channel, nick, initiator):
193183
"""
194184
pass
195185

186+
def handle_own_got_voice(self, channel, initiator):
187+
""" The IRCClient received voice rights.
188+
189+
Args:
190+
channel (str): name of the channel
191+
initiator (str): the user who granted the voice rights
192+
"""
193+
pass
194+
196195
def handle_lost_voice(self, channel, nick, initiator):
197-
""" A user lost voide rights.
196+
""" Another user lost voice rights.
198197
199198
Args:
200199
channel (str): name of the channel
@@ -203,6 +202,74 @@ def handle_lost_voice(self, channel, nick, initiator):
203202
"""
204203
pass
205204

205+
def handle_own_lost_voice(self, channel, initiator):
206+
""" The IRCClient lost voice rights.
207+
208+
Args:
209+
channel (str): name of the channel
210+
initiator (str): the user who initiated the mode change
211+
"""
212+
pass
213+
214+
def handle_nick_change(self, old_nick, new_nick):
215+
""" A user's nick name changed.
216+
217+
To handle nick changes of the IRCClient itself, use
218+
:py:meth:`.handle_own_nick_change`.
219+
220+
Args:
221+
old_nick (str): The nick name of the user until now.
222+
new_nick (str): The new nick name of the user.
223+
"""
224+
pass
225+
226+
def handle_own_nick_change(self, old_nick, new_nick):
227+
""" The IRCCLient's nick name changed.
228+
229+
The :py:attr:`nick<.IRCClient.nick>`-property will already hold
230+
the new nick when this handler is called.
231+
232+
Args:
233+
old_nick (str): The old nick name.
234+
new_nick (str): The new nick name.
235+
"""
236+
pass
237+
238+
def handle_response(self, response, message):
239+
""" A numeric response was received from the server.
240+
241+
See the IRC client protocol specification for valid numeric response
242+
codes and their meaning. There are extra handler methods for many
243+
common responses, but this general handler is always called first.
244+
245+
Args:
246+
response (int): 3-digit response code (between 0 and 399)
247+
message (str): the whole, raw message
248+
"""
249+
pass
250+
251+
def handle_error(self, error, **params):
252+
""" An irc error message was received from the server.
253+
254+
The error codes are defined in :py:class:`Err<fredirc.Err>`.
255+
The contents of the params dictionary depend on the specific error.
256+
See the documentation of :py:class:`Err<fredirc.Err>` for details.
257+
258+
Args:
259+
error (int): 3-digit error code (between 400 and 599)
260+
params (dict): Parameters of the error message, each consisting of \
261+
a parameter name and a value.
262+
"""
263+
pass
264+
265+
def handle_ping(self, server):
266+
""" Received a ping message from the server.
267+
268+
Args:
269+
server (str): name or ip of the server.
270+
"""
271+
pass
272+
206273
def handle_unhandled_message(self, message):
207274
""" This handler is called whenever a message is not handled by any
208275
other handler.

0 commit comments

Comments
 (0)