|
|
@ -82,49 +82,60 @@ def ircmessage(objectstr, who, body, link):
|
|
|
|
# Aaaaand, send it off!
|
|
|
|
# Aaaaand, send it off!
|
|
|
|
sendnotice(message)
|
|
|
|
sendnotice(message)
|
|
|
|
|
|
|
|
|
|
|
|
def ircbot(message):
|
|
|
|
def gettaskinfo(task):
|
|
|
|
message = message.split(" :" + username + ": info")[1]
|
|
|
|
|
|
|
|
sendmessage = ""
|
|
|
|
sendmessage = ""
|
|
|
|
|
|
|
|
try:
|
|
|
|
for item in message.split():
|
|
|
|
# We only need the task number.
|
|
|
|
if item.startswith("T"):
|
|
|
|
taskinfo = phab.maniphest.info(task_id=int(task.split("T")[1]))
|
|
|
|
try:
|
|
|
|
|
|
|
|
# We only need the task number.
|
|
|
|
sendmessage = sendmessage + "\x033[\x03"
|
|
|
|
taskinfo = phab.maniphest.info(task_id=int(item.split("T")[1]))
|
|
|
|
|
|
|
|
|
|
|
|
# The color of the priority text should correspond to its value.
|
|
|
|
sendmessage = sendmessage + "\x033[\x03"
|
|
|
|
color = taskinfo["priorityColor"]
|
|
|
|
|
|
|
|
if color == "violet":
|
|
|
|
# The color of the priority text should correspond to its value.
|
|
|
|
sendmessage = sendmessage + "\x036Needs Triage"
|
|
|
|
color = taskinfo["priorityColor"]
|
|
|
|
elif color == "pink":
|
|
|
|
if color == "violet":
|
|
|
|
sendmessage = sendmessage + "\x035Unbreak Now!"
|
|
|
|
sendmessage = sendmessage + "\x036Needs Triage"
|
|
|
|
elif color == "red":
|
|
|
|
elif color == "pink":
|
|
|
|
sendmessage = sendmessage + "\x034High"
|
|
|
|
sendmessage = sendmessage + "\x035Unbreak Now!"
|
|
|
|
elif color == "orange":
|
|
|
|
elif color == "red":
|
|
|
|
sendmessage = sendmessage + "\x037Medium"
|
|
|
|
sendmessage = sendmessage + "\x034High"
|
|
|
|
elif color == "yellow":
|
|
|
|
elif color == "orange":
|
|
|
|
sendmessage = sendmessage + "\x038Low"
|
|
|
|
sendmessage = sendmessage + "\x037Medium"
|
|
|
|
elif color == "sky":
|
|
|
|
elif color == "yellow":
|
|
|
|
sendmessage = sendmessage + "\x037Wishlist"
|
|
|
|
sendmessage = sendmessage + "\x038Low"
|
|
|
|
|
|
|
|
elif color == "sky":
|
|
|
|
# Put the task status in the message.
|
|
|
|
sendmessage = sendmessage + "\x037Wishlist"
|
|
|
|
sendmessage = sendmessage + ", " + taskinfo["statusName"] + "\x03"
|
|
|
|
|
|
|
|
|
|
|
|
# Put the task status in the message.
|
|
|
|
sendmessage = sendmessage + "\x033]\x03 "
|
|
|
|
sendmessage = sendmessage + ", " + taskinfo["statusName"] + "\x03"
|
|
|
|
|
|
|
|
|
|
|
|
# Put the title in there as well.
|
|
|
|
sendmessage = sendmessage + "\x033]\x03 "
|
|
|
|
sendmessage = sendmessage + taskinfo["title"].strip() + ": "
|
|
|
|
|
|
|
|
|
|
|
|
# Put the title in there as well.
|
|
|
|
# And the link.
|
|
|
|
sendmessage = sendmessage + taskinfo["title"].strip() + ": "
|
|
|
|
sendmessage = sendmessage + "\x032" + taskinfo["uri"] + "\x03"
|
|
|
|
|
|
|
|
|
|
|
|
# And the link.
|
|
|
|
# Send it off!
|
|
|
|
sendmessage = sendmessage + "\x032" + taskinfo["uri"] + "\x03"
|
|
|
|
sendnotice(sendmessage)
|
|
|
|
|
|
|
|
# If someone wrote something like "Tblah", obviously that's not right.
|
|
|
|
# Send it off!
|
|
|
|
except ValueError:
|
|
|
|
sendnotice(sendmessage)
|
|
|
|
sendnotice("\x034Error: " + task.strip() + "is an invalid task reference.\x03")
|
|
|
|
# If someone wrote something like "Tblah", obviously that's not right.
|
|
|
|
return None
|
|
|
|
except ValueError:
|
|
|
|
|
|
|
|
sendnotice("\x034Error: " + item.strip() + "is an invalid task reference.\x03")
|
|
|
|
def ircbot(message, msgtype):
|
|
|
|
|
|
|
|
if msgtype == "info":
|
|
|
|
|
|
|
|
message = message.split(" :" + username + ": info")[1]
|
|
|
|
|
|
|
|
for item in message.split():
|
|
|
|
|
|
|
|
if item.startswith("T"):
|
|
|
|
|
|
|
|
gettaskinfo(item.strip())
|
|
|
|
|
|
|
|
elif msgtype == "link":
|
|
|
|
|
|
|
|
for item in message.split("https://phab.lubuntu.me/"):
|
|
|
|
|
|
|
|
if item.split()[0].strip().startswith("T"):
|
|
|
|
|
|
|
|
gettaskinfo(item.split()[0].strip())
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
sendnotice("\x034Error: unknown command.\x03")
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
def listenirc():
|
|
|
|
def listenirc():
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
@ -137,10 +148,10 @@ def listenirc():
|
|
|
|
print(ircmsg)
|
|
|
|
print(ircmsg)
|
|
|
|
if ircmsg.find("PING :") != -1:
|
|
|
|
if ircmsg.find("PING :") != -1:
|
|
|
|
conn.send(bytes("PONG :pingis\n", "UTF-8"))
|
|
|
|
conn.send(bytes("PONG :pingis\n", "UTF-8"))
|
|
|
|
elif ircmsg.find(" :" + username + ": ") != -1:
|
|
|
|
elif ircmsg.find(" :" + username + ": info") != -1:
|
|
|
|
ircbot(ircmsg)
|
|
|
|
ircbot(ircmsg, "info")
|
|
|
|
elif ircmsg.find("https://phab.lubuntu.me/T") != -1:
|
|
|
|
elif ircmsg.find("https://phab.lubuntu.me/T") != -1:
|
|
|
|
ircbot(ircmsg.split("https://phab.lubuntu.me/")[1])
|
|
|
|
ircbot(ircmsg, "link")
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/", methods=["POST"])
|
|
|
|
@app.route("/", methods=["POST"])
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|