mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
irc: use True instead of 1 (#11076)
* irc: use True instead of 1 * add changelog frag
This commit is contained in:
2
changelogs/fragments/11076-irc-true.yml
Normal file
2
changelogs/fragments/11076-irc-true.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- irc - use proper boolean value in loops (https://github.com/ansible-collections/community.general/pull/11076).
|
||||||
@@ -71,12 +71,12 @@ options:
|
|||||||
channel:
|
channel:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Channel name. One of nick_to or channel needs to be set. When both are set, the message is sent to both of them.
|
- Channel name. One of O(nick_to) or O(channel) needs to be set. When both are set, the message is sent to both of them.
|
||||||
nick_to:
|
nick_to:
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
description:
|
description:
|
||||||
- A list of nicknames to send the message to. One of nick_to or channel needs to be set. When both are defined, the
|
- A list of nicknames to send the message to. One of O(nick_to) or O(channel) needs to be set. When both are defined, the
|
||||||
message is sent to both of them.
|
message is sent to both of them.
|
||||||
key:
|
key:
|
||||||
type: str
|
type: str
|
||||||
@@ -94,7 +94,7 @@ options:
|
|||||||
use_tls:
|
use_tls:
|
||||||
description:
|
description:
|
||||||
- Designates whether TLS/SSL should be used when connecting to the IRC server.
|
- Designates whether TLS/SSL should be used when connecting to the IRC server.
|
||||||
- O(use_tls) is available since community.general 8.1.0, before the option was exlusively called O(use_ssl). The latter
|
- O(use_tls) is available since community.general 8.1.0, before the option was exclusively called O(use_ssl). The latter
|
||||||
is now an alias of O(use_tls).
|
is now an alias of O(use_tls).
|
||||||
- B(Note:) for security reasons, you should always set O(use_tls=true) and O(validate_certs=true) whenever possible.
|
- B(Note:) for security reasons, you should always set O(use_tls=true) and O(validate_certs=true) whenever possible.
|
||||||
- The default of this option changed to V(true) in community.general 10.0.0.
|
- The default of this option changed to V(true) in community.general 10.0.0.
|
||||||
@@ -260,7 +260,7 @@ def send_msg(
|
|||||||
irc.send(to_bytes(f"USER {nick} {nick} {nick} :ansible IRC\r\n"))
|
irc.send(to_bytes(f"USER {nick} {nick} {nick} :ansible IRC\r\n"))
|
||||||
motd = ""
|
motd = ""
|
||||||
start = time.time()
|
start = time.time()
|
||||||
while 1:
|
while True:
|
||||||
motd += to_native(irc.recv(1024))
|
motd += to_native(irc.recv(1024))
|
||||||
# The server might send back a shorter nick than we specified (due to NICKLEN),
|
# The server might send back a shorter nick than we specified (due to NICKLEN),
|
||||||
# so grab that and use it from now on (assuming we find the 00[1-4] response).
|
# so grab that and use it from now on (assuming we find the 00[1-4] response).
|
||||||
@@ -280,7 +280,7 @@ def send_msg(
|
|||||||
|
|
||||||
join = ""
|
join = ""
|
||||||
start = time.time()
|
start = time.time()
|
||||||
while 1:
|
while True:
|
||||||
join += to_native(irc.recv(1024))
|
join += to_native(irc.recv(1024))
|
||||||
if re.search(rf"^:\S+ 366 {nick} {channel} :", join, flags=re.M | re.I):
|
if re.search(rf"^:\S+ 366 {nick} {channel} :", join, flags=re.M | re.I):
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user