Don't try to get services mood via GETMOOD
This commit is contained in:
parent
2ff1a87901
commit
16625ba936
1 changed files with 24 additions and 14 deletions
30
irc.py
30
irc.py
|
@ -22,6 +22,15 @@ from oyoyo.cmdhandler import DefaultCommandHandler
|
||||||
from oyoyo import helpers, services
|
from oyoyo import helpers, services
|
||||||
|
|
||||||
PchumLog = logging.getLogger("pchumLogger")
|
PchumLog = logging.getLogger("pchumLogger")
|
||||||
|
SERVICES = [
|
||||||
|
"nickserv",
|
||||||
|
"chanserv",
|
||||||
|
"memoserv",
|
||||||
|
"operserv",
|
||||||
|
"helpserv",
|
||||||
|
"hostserv",
|
||||||
|
"botserv",
|
||||||
|
]
|
||||||
|
|
||||||
# Python 3
|
# Python 3
|
||||||
QString = str
|
QString = str
|
||||||
|
@ -692,9 +701,10 @@ class PesterHandler(DefaultCommandHandler):
|
||||||
def nomatchingkey(self, target, our_handle, failed_handle, key, *error):
|
def nomatchingkey(self, target, our_handle, failed_handle, key, *error):
|
||||||
# Try to get moods the old way if metadata fails.
|
# Try to get moods the old way if metadata fails.
|
||||||
PchumLog.info("nomatchingkey: " + failed_handle)
|
PchumLog.info("nomatchingkey: " + failed_handle)
|
||||||
chumglub = "GETMOOD "
|
# No point in GETMOOD-ing services
|
||||||
|
if failed_handle.casefold() not in SERVICES:
|
||||||
try:
|
try:
|
||||||
helpers.msg(self.client, "#pesterchum", chumglub + failed_handle)
|
helpers.msg(self.client, "#pesterchum", f"GETMOOD {failed_handle}")
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
PchumLog.warning(e)
|
PchumLog.warning(e)
|
||||||
self.parent.setConnectionBroken()
|
self.parent.setConnectionBroken()
|
||||||
|
@ -1028,12 +1038,11 @@ class PesterHandler(DefaultCommandHandler):
|
||||||
"""Get mood via metadata if supported"""
|
"""Get mood via metadata if supported"""
|
||||||
|
|
||||||
# Get via metadata or via legacy method
|
# Get via metadata or via legacy method
|
||||||
if self.parent.metadata_supported == True:
|
if self.parent.metadata_supported:
|
||||||
# Metadata
|
# Metadata
|
||||||
for c in chums:
|
for chum in chums:
|
||||||
chandle = c.handle
|
|
||||||
try:
|
try:
|
||||||
helpers.metadata(self.client, chandle, "get", "mood")
|
helpers.metadata(self.client, chum.handle, "get", "mood")
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
PchumLog.warning(e)
|
PchumLog.warning(e)
|
||||||
self.parent.setConnectionBroken()
|
self.parent.setConnectionBroken()
|
||||||
|
@ -1043,16 +1052,17 @@ class PesterHandler(DefaultCommandHandler):
|
||||||
"Server doesn't seem to support metadata, using legacy GETMOOD."
|
"Server doesn't seem to support metadata, using legacy GETMOOD."
|
||||||
)
|
)
|
||||||
chumglub = "GETMOOD "
|
chumglub = "GETMOOD "
|
||||||
for c in chums:
|
for chum in chums:
|
||||||
chandle = c.handle
|
if len(chumglub + chum.handle) >= 350:
|
||||||
if len(chumglub + chandle) >= 350:
|
|
||||||
try:
|
try:
|
||||||
helpers.msg(self.client, "#pesterchum", chumglub)
|
helpers.msg(self.client, "#pesterchum", chumglub)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
PchumLog.warning(e)
|
PchumLog.warning(e)
|
||||||
self.parent.setConnectionBroken()
|
self.parent.setConnectionBroken()
|
||||||
chumglub = "GETMOOD "
|
chumglub = "GETMOOD "
|
||||||
chumglub += chandle
|
# No point in GETMOOD-ing services
|
||||||
|
if chum.handle.casefold() not in SERVICES:
|
||||||
|
chumglub += chum.handle
|
||||||
if chumglub != "GETMOOD ":
|
if chumglub != "GETMOOD ":
|
||||||
try:
|
try:
|
||||||
helpers.msg(self.client, "#pesterchum", chumglub)
|
helpers.msg(self.client, "#pesterchum", chumglub)
|
||||||
|
|
Loading…
Reference in a new issue