summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Arnold2025-02-21 14:48:39 -0500
committerMatt Arnold2025-02-21 14:48:39 -0500
commitf2f74a152109f5b6c90cb8dd832c79b21c306b85 (patch)
tree2a485289f4681c60220605a306ce3f31a0208b7b
parent5667670e4a28613bdc8689481d08eaf54e945f3e (diff)
Finish fleshing out the methods
-rw-r--r--IRC.py26
1 files changed, 6 insertions, 20 deletions
diff --git a/IRC.py b/IRC.py
index 5f8d09e..9be5d26 100644
--- a/IRC.py
+++ b/IRC.py
@@ -16,25 +16,8 @@ def create_sasl_plain_auth(username, password):
return base64_auth
-def decode_sasl_plain_auth(base64_auth):
- """
- Decode a SASL PLAIN authentication string for verification.
-
- Args:
- base64_auth (str): Base64 encoded SASL PLAIN authentication string
-
- Returns:
- tuple: (authorization_identity, username, password)
- """
- # Decode base64
- auth_bytes = base64.b64decode(base64_auth)
- auth_string = auth_bytes.decode("utf-8")
-
- # Split on null bytes
- parts = auth_string.split("\x00")
-
- # Return the three components
- return tuple(parts)
+def encode_action_message(m):
+ return f"\x01ACTION {m}\x01"
class IRCBadMessage(Exception):
@@ -97,6 +80,7 @@ class IRCBot:
self.send_cmd(authmsg)
joinmsg = irctokens.build("JOIN", [self.config["channel"]])
self.send_cmd(joinmsg)
+ self.send_action("Hops in", self.config["channel"])
def send_privmsg(self, dst, msg):
msg = irctokens.build("PRIVMSG", [dst, msg])
@@ -108,7 +92,9 @@ class IRCBot:
self.send_cmd(msg)
def send_action(self, action_msg, dst):
- pass
+ em = encode_action_message(action_msg)
+ ctcpmsg = irctokens.build("PRIVMSG", [dst, em])
+ self.send_cmd(ctcpmsg)
def connect(self, server, port, channel, botnick, botnickpass):
if self.config is None: