limnoria-phabricator/plugin.py

993 lines
34 KiB
Python
Raw Permalink Normal View History

###
# Copyright (c) 2017, elexis
# All rights reserved.
###
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
import ssl
import supybot.conf as conf
import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
import http.client
import urllib.parse
import socket
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
import html
2024-08-21 20:50:51 +02:00
# Provides some abstraction and parsing of the RESTful Phabricator API
import json
import time
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
import datetime
import threading
import re
import os.path
from collections import OrderedDict
try:
from supybot.i18n import PluginInternationalization
2024-08-21 20:50:51 +02:00
_ = PluginInternationalization("Phabricator")
except ImportError:
# Placeholder that allows to run the plugin on a bot
# without the i18n module
_ = lambda x: x
2024-08-21 20:50:51 +02:00
# This class instructs the IRC bot to post chat messages about
# recently updated Phabricator URLs and
# responds with a title and URL if a differential or revision ID was posted
class Phabricator(callbacks.Plugin):
def __init__(self, irc):
self.__parent = super(Phabricator, self)
self.__parent.__init__(irc)
callbacks.Plugin.__init__(self, irc)
self.syncedChannels = []
self.thread = None
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
self.conduitAPI = ConduitAPI(
self.registryValue("phabricatorURL"),
self.registryValue("phabricatorToken"),
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
self.registryValue("acceptInvalidSSLCert"),
self.registryValue("httpTimeout"),
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
)
2024-08-21 20:50:51 +02:00
self.formatting = PhabricatorStringFormatting(
True, self.registryValue("obscureUsernames"), False
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
self.storyPrinter = PhabricatorStoryPrinter(
conduitAPI=self.conduitAPI,
formatting=self.formatting,
channels=self.registryValue("channels"),
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
storyLimit=self.registryValue("storyLimit"),
historyForwards=self.registryValue("historyForwards"),
timestampAfter=self.registryValue("timestampAfter"),
timestampBefore=self.registryValue("timestampBefore"),
sleepTime=self.registryValue("sleepTime"),
newsPrefix=self.registryValue("newsPrefix"),
printDate=self.registryValue("printDate"),
ignoredUsers=self.registryValue("ignoredUsers"),
filteredUsers=self.registryValue("filteredUsers"),
notifyCommit=self.registryValue("notifyCommit"),
notifyRetitle=self.registryValue("notifyRetitle"),
chronokeyFile=self.registryValue("chronokeyFile"),
chronokey=None,
2024-08-21 20:50:51 +02:00
verbose=self.registryValue("verbose"),
2017-02-02 12:40:23 +01:00
)
# Respond to channel and private messages
def doPrivmsg(self, irc, msg):
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# TODO: check whether it works with actual PMs
channel = msg.args[0]
strings = PhabricatorReplyPrinter(
2024-08-21 20:50:51 +02:00
txt=msg.args[1], conduitAPI=self.conduitAPI, formatting=self.formatting
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
).getReplies()
2024-08-21 20:37:17 +02:00
for reply in strings:
irc.queueMsg(ircmsgs.privmsg(channel, reply))
def do315(self, irc, msg):
2017-08-06 13:15:36 +02:00
print("do315 in ", msg.args[1])
print("current channels:", irc.state.channels.items())
self.syncedChannels.append(msg.args[1])
# Don't send messages before all channels were synced
2024-08-21 20:50:51 +02:00
for channel, _ in irc.state.channels.items():
if channel not in self.syncedChannels:
return
2017-08-06 13:15:36 +02:00
print("all channels synced", msg.args[1])
# Notify about recent phabricator stories
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if self.thread:
2017-08-06 13:15:36 +02:00
print("thread still already running")
return
2024-08-21 20:50:51 +02:00
self.thread = threading.Thread(
target=self.storyPrinter.printStoriesForever, args=(irc,), daemon=True
)
self.thread.start()
def doPart(self, irc, msg):
if msg.nick != conf.supybot.nick:
return
2024-08-21 20:50:51 +02:00
for channel in msg.args[0].split(","):
if channel in self.syncedChannels:
2017-08-06 13:15:36 +02:00
print("parting from ", channel)
self.syncedChannels.remove(channel)
2024-08-21 20:50:51 +02:00
class PhabricatorReplyPrinter:
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def __init__(self, txt, conduitAPI, formatting):
self.txt = txt
self.conduitAPI = conduitAPI
self.formatting = formatting
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def getReplies(self):
2024-08-21 20:50:51 +02:00
return self.__differentialReplies() + self.__pasteReplies()
# Display the title and URL of all differential IDs appearing in the text (D123)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def __differentialReplies(self):
matches = re.findall(r"\b(D\d+)\b", self.txt)
revisions = list(map(lambda d: d[1:], matches))
revisions = OrderedDict.fromkeys(revisions, True)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if revisions is None or len(revisions) == 0 or list(revisions)[0] == "":
2024-08-21 20:50:51 +02:00
# print("Fix differnetial revision regex for", self.txt)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return []
results = self.conduitAPI.queryDifferentials(revisions)
2017-01-22 12:35:40 +01:00
if results is None:
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return []
2017-01-22 12:35:40 +01:00
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
strings = []
for result in results:
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
replyStringConstructor = PhabricatorReplyStringConstructor(
objID="D" + result["id"],
objLink=result["uri"],
objTitle=result["title"],
2024-08-21 20:50:51 +02:00
formatting=self.formatting,
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
)
2024-08-21 20:50:51 +02:00
strings.append(
replyStringConstructor.constructDifferentialReplyString(
statusName=result["statusName"]
)
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return strings
# Display the title and URL of all differential IDs appearing in the text (D123)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def __pasteReplies(self):
pasteIDs = re.findall(r"\b(P\d+)\b", self.txt)
pasteIDs = list(map(lambda d: d[1:], pasteIDs))
pasteIDs = OrderedDict.fromkeys(pasteIDs, True)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if pasteIDs is None or len(pasteIDs) == 0 or list(pasteIDs)[0] == "":
2024-08-21 20:50:51 +02:00
# print("Fix paste regex for", self.txt)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return []
results = self.conduitAPI.queryPastesByID(pasteIDs)
if results is None:
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return []
authorPHIDs = []
for pastePHID in results:
authorPHID = results[pastePHID]["authorPHID"]
if authorPHID not in authorPHIDs:
authorPHIDs.append(authorPHID)
authorNames = self.conduitAPI.queryAuthorNames(authorPHIDs)
if authorNames is None:
return []
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
strings = []
for pasteID in pasteIDs:
for pastePHID in results:
result = results[pastePHID]
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if result["id"] == pasteID:
replyStringConstructor = PhabricatorReplyStringConstructor(
objID="P" + result["id"],
objTitle=result["title"],
objLink=result["uri"],
2024-08-21 20:50:51 +02:00
formatting=self.formatting,
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
)
2024-08-21 20:50:51 +02:00
strings.append(
replyStringConstructor.constructPasteReplyString(
authorName=authorNames[result["authorPHID"]]
)
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return strings
2024-08-21 20:50:51 +02:00
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# Constructs human-readable strings and optionally posts them to IRC.
# Allows testing of the querying and printing without actually connecting to IRC.
class PhabricatorStoryPrinter:
2024-08-21 20:50:51 +02:00
def __init__(
self,
conduitAPI,
formatting,
channels,
storyLimit,
historyForwards,
timestampBefore,
timestampAfter,
sleepTime,
newsPrefix,
printDate,
ignoredUsers,
filteredUsers,
notifyCommit,
notifyRetitle,
chronokeyFile,
chronokey,
verbose,
):
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
self.conduitAPI = conduitAPI
self.channels = channels
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
self.formatting = formatting
self.storyLimit = storyLimit
self.historyForwards = historyForwards
self.timestampBefore = timestampBefore
self.timestampAfter = timestampAfter
self.sleepTime = sleepTime
self.newsPrefix = newsPrefix
self.printDate = printDate
self.ignoredUsers = ignoredUsers
self.filteredUsers = filteredUsers
self.notifyCommit = notifyCommit
self.notifyRetitle = notifyRetitle
self.chronokeyFile = chronokeyFile
self.chronokey = chronokey
self.verbose = verbose
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
self.chronokeyEpoch = None
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# Repeatedly query and print new stories on phabricator
def printStoriesForever(self, irc):
self.chronokey = self.__loadChronokey()
while True:
try:
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if self.printSomeStories(irc):
return
except KeyboardInterrupt:
return
except:
raise
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def printSomeStories(self, irc):
stories = self.pullSomeStories()
if stories is True:
return True
for story in stories:
string, _, _, _, _ = story
print(string)
if irc:
2024-08-21 20:50:51 +02:00
for channel, _ in irc.state.channels.items():
if not self.channels or channel in self.channels:
irc.queueMsg(ircmsgs.privmsg(channel, string))
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
time.sleep(self.sleepTime)
return False
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# Pulls some stories on phabricator that are more recent or older than the current chronokey.
2024-08-21 20:37:17 +02:00
# Fetches the referred authors and differentials.
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# Returns a list of human-readable strings to be posted in irc and the updated chronokey or
# Returns True if all stories in that timeframe have been processed already.
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def pullSomeStories(self):
if self.chronokeyEpoch:
2024-08-21 20:50:51 +02:00
if (
self.historyForwards
and self.timestampBefore != 0
and self.chronokeyEpoch > self.timestampBefore
or not self.historyForwards
and self.timestampAfter != 0
and self.chronokeyEpoch < self.timestampAfter
):
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if self.verbose:
print("Finished, chronokey is ", self.chronokey)
return True
2024-08-21 20:50:51 +02:00
stories, objectPHIDs, authorPHIDs = self.conduitAPI.queryFeed(
self.chronokey, self.storyLimit, self.historyForwards
)
authorNames = self.conduitAPI.queryAuthorNames(authorPHIDs)
if authorNames is None:
return []
objects = self.conduitAPI.queryObjects(objectPHIDs)
if objects is None:
return []
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if not self.historyForwards and len(stories) == 0:
if self.verbose:
print("No more stories found")
return True
# We can't do anything with the transaction PHIDs! Not even getting the sub-URL of the modified object
# https://secure.phabricator.com/T5873
# transactions = queryObjects(allTransactionPHIDs)
# Sort by timestamp
2024-08-21 20:50:51 +02:00
storiesSorted = sorted(
stories, key=lambda story: story[1], reverse=not self.historyForwards
)
2017-02-02 14:23:23 +01:00
strings = []
for story in storiesSorted:
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# Extract the objects referenced by this particular story
_, newChronokey, epoch, authorPHID, objectPHID, text = story
objType, objID, objTitle, objLink = objects[objectPHID]
authorName = authorNames[authorPHID]
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# TODO: move this to queryAuthorNames
if authorPHID == "PHID-APPS-PhabricatorDiffusionApplication":
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if self.verbose:
2024-08-21 20:50:51 +02:00
print(
"Fallback: Commit without phabricator account: [" + text + "]"
)
authorName = self.conduitAPI.queryCommitsByPHIDs(objectPHID)
if authorName is None:
return []
authorName = authorName.get("data")[objectPHID]["author"]
# Remember most recently actually printed story (in the specified chronological order)
self.__updateChronokey(newChronokey, epoch)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if self.__filterDate(epoch, True) or self.__filterUser(authorName):
continue
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# Create a string from the parsed story data and referenced objects
storyString = PhabricatorStoryStringConstructor(
objType,
objectPHID,
objID,
objTitle,
objLink,
authorName,
text,
self.notifyCommit,
self.notifyRetitle,
self.formatting,
2024-08-21 20:50:51 +02:00
self.verbose,
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
).constructStoryString()
try:
string, action = storyString
except TypeError:
2024-08-21 20:50:51 +02:00
print(
"constructStoryString returned non-iterable",
storyString,
"from",
text,
)
continue
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if string is None:
continue
2024-08-21 20:50:51 +02:00
datePrefix = (
datetime.datetime.fromtimestamp(epoch).strftime("[%Y-%m-%d %H:%M:%S] ")
if self.printDate
else ""
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
string = datePrefix + self.newsPrefix + string
strings.append((string, authorName, objID, objType, action))
return strings
def __filterUser(self, authorName):
if self.ignoredUsers is not None and authorName in self.ignoredUsers:
if self.verbose:
print("Skipping blocked user", authorName)
return True
2024-08-21 20:50:51 +02:00
if (
self.filteredUsers
and len(self.filteredUsers)
and authorName not in self.filteredUsers
):
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if self.verbose:
print("Skipping non-filtered user", authorName)
return True
return False
def __filterDate(self, timestamp, debugPrint):
if self.timestampAfter != 0 and timestamp < self.timestampAfter:
if self.verbose:
print("Skipping story that is too old")
return True
if self.timestampBefore != 0 and timestamp > self.timestampBefore:
if self.verbose:
print("Skipping story that is too recent")
return True
return False
# Remember the chronological entry of the most recently
# processed or printed update on phabricator
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# Returns None or number
def __loadChronokey(self):
if self.chronokeyFile is None:
return self.chronokey
if not os.path.isfile(self.chronokeyFile):
print(self.chronokeyFile, "not found, starting at 0")
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return self.chronokey
2024-08-21 20:50:51 +02:00
return int(open(self.chronokeyFile, "r").read())
# Save the state immediately after processing a message,
# so that we don't lose the state after a crash
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def __saveChronokey(self, chronokey):
if self.verbose:
print("Saving chronokey", chronokey)
text_file = open(self.chronokeyFile, "w")
text_file.write(str(chronokey) + "\n")
text_file.close()
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def __updateChronokey(self, newChronokey, newEpoch):
if self.chronokeyEpoch is None:
self.chronokeyEpoch = newEpoch
if self.chronokey is None:
if self.verbose:
print("Initializing chronokey with", newChronokey)
self.chronokey = newChronokey
return
previous = self.chronokey
if self.historyForwards:
self.chronokey = max(self.chronokey, newChronokey)
self.chronokeyEpoch = max(self.chronokeyEpoch, newEpoch)
else:
self.chronokey = min(self.chronokey, newChronokey)
2024-08-21 20:50:51 +02:00
self.chronokeyEpoch = min(self.chronokeyEpoch, newEpoch)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if previous == self.chronokey:
return
if self.verbose:
print("New chronokey:", self.chronokey)
if self.chronokeyFile:
self.__saveChronokey(self.chronokey)
2024-08-21 20:50:51 +02:00
class ConduitAPI:
def __init__(
self, phabricatorURL, phabricatorToken, acceptInvalidSSLCert, httpTimeout
):
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
self.phabricatorToken = phabricatorToken
self.phabricatorURL = phabricatorURL
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
self.acceptInvalidSSLCert = acceptInvalidSSLCert
self.httpTimeout = httpTimeout
# Send an HTTPS GET request to the phabricator location and
# return the interpreted JSON object
def queryAPI(self, path, params):
if self.phabricatorURL is None or self.phabricatorURL == "":
print("Error: You must configure the Phabricator location!")
return None
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if self.phabricatorToken is None or self.phabricatorToken == "":
print("Error: You must configure a Phabricator API token!")
return None
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
params["api.token"] = self.phabricatorToken
headers = {
"Content-Type": "application/x-www-form-urlencoded",
2024-08-21 20:50:51 +02:00
"Charset": "utf-8",
}
conn = http.client.HTTPSConnection(
self.phabricatorURL,
2024-08-21 20:50:51 +02:00
context=ssl._create_unverified_context()
if self.acceptInvalidSSLCert
else None,
timeout=self.httpTimeout,
)
try:
conn.request("GET", path, urllib.parse.urlencode(params, True), headers)
response = conn.getresponse()
# This is supposedly TimeoutError, but not when testing
except socket.timeout:
print("Timeout at", path)
return None
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if response.status != 200:
print(response.status, response.reason)
conn.close()
return None
data = response.read()
conn.close()
data = json.loads(data.decode("utf-8"))
if data["error_code"] is not None:
2017-02-02 11:46:53 +01:00
print("Error:", data["error_info"])
print("Query:", path, params)
return None
return data.get("result")
# Return some information about arbitrary objects, like
2024-08-21 20:37:17 +02:00
# differentials, users, commits, transactions, ...
def queryPHIDs(self, phids):
if len(phids) == 0:
return []
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return self.queryAPI("/api/phid.query", {"phids[]": phids})
# Retrieve account names of the given author URLs
def queryAuthorNames(self, authorPHIDs):
results = self.queryPHIDs(authorPHIDs)
if results is None:
return None
authorNames = {}
for authorPHID in results:
authorNames[authorPHID] = results[authorPHID]["name"]
return authorNames
# Fetches information about arbitrary objects,
# preserves only common properties
def queryObjects(self, objectPHIDs):
results = self.queryPHIDs(objectPHIDs)
if results is None:
return []
objects = {}
for objectPHID in results:
obj = results[objectPHID]
fullName = obj["fullName"]
# Clumsy object name parsing
if obj["typeName"] != "Project":
2024-08-21 20:50:51 +02:00
fullName = fullName[len(obj["name"] + " ") :]
2024-08-21 20:50:51 +02:00
if (
obj["typeName"] == "Differential Revision"
or obj["typeName"] == "Diffusion Commit"
):
fullName = fullName[len(":") :]
2024-08-21 20:50:51 +02:00
objects[objectPHID] = obj["typeName"], obj["name"], fullName, obj["uri"]
return objects
# Returns title, uri, status name, creation and modified date,
# author, reviewers, commits and trac tickets of the given numerical differential IDs
def queryDifferentials(self, IDs):
2024-08-21 20:50:51 +02:00
return self.queryAPI("/api/differential.query", {"ids[]": IDs})
# Returns object PHID, authorName, uri, summary, epoch
def queryCommitsByPHIDs(self, PHIDs):
2024-08-21 20:50:51 +02:00
return self.queryAPI("/api/diffusion.querycommits", {"phids[]": PHIDs})
# Returns object PHID, authorName, uri, summary, epoch
def queryPastesByID(self, IDs):
2024-08-21 20:50:51 +02:00
return self.queryAPI("/api/paste.query", {"ids[]": IDs})
# Fetches some phabricator stories after the given chronological key,
# Only yields story PHID, author PHIDs and the PHIDs of the associated object
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def queryFeed(self, chronokey, storyLimit, historyForwards):
2024-08-21 20:50:51 +02:00
arguments = {"limit": storyLimit, "view": "text"}
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# Query stories before or after the given chronokey,
# otherwise query for the most recent ones (as of now)
if chronokey is not None:
if historyForwards:
arguments["before"] = chronokey
else:
arguments["after"] = chronokey
print("Pulling", storyLimit, "stories")
results = self.queryAPI("/api/feed.query", arguments)
if results is None:
return [], [], []
stories = []
authorPHIDs = []
objectPHIDs = []
2024-08-21 20:50:51 +02:00
# allTransactionPHIDs = []
for storyPHID in results:
epoch = int(results[storyPHID]["epoch"])
2017-02-02 13:43:59 +01:00
newChronokey = int(results[storyPHID]["chronologicalKey"])
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if chronokey is None:
chronokey = newChronokey
authorPHID = results[storyPHID]["authorPHID"]
if authorPHID not in authorPHIDs:
authorPHIDs.append(authorPHID)
objectPHID = results[storyPHID]["objectPHID"]
if objectPHID not in objectPHIDs:
objectPHIDs.append(objectPHID)
text = results[storyPHID]["text"]
# Transactions are not queryable currently!
# transactionPHIDs = list(results[storyPHID]["data"]["transactionPHIDs"].keys())
# allTransactionPHIDs += transactionPHIDs
2024-08-21 20:50:51 +02:00
stories.append(
(storyPHID, newChronokey, epoch, authorPHID, objectPHID, text)
)
2024-08-21 20:50:51 +02:00
return stories, objectPHIDs, authorPHIDs # , allTransactionPHIDs
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
2024-08-21 20:50:51 +02:00
class PhabricatorStringFormatting:
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def __init__(self, bolding, obscureUsernames, htmlLinks):
self.bolding = bolding
self.obscureUsernames = obscureUsernames
self.htmlLinks = htmlLinks
def bold(self, txt):
if not self.bolding:
return txt
return ircutils.bold(txt)
# Adds invisible whitespace between characters to
# avoid people pinging themselves with updates
def obscureAuthorName(self, authorName):
if not self.obscureUsernames:
return authorName
2024-08-21 20:50:51 +02:00
return "\u200b".join(list(authorName))
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def formatLink(self, url):
if not self.htmlLinks:
return url
2024-08-21 20:50:51 +02:00
return '<a href="' + url + '">' + html.escape(url) + "</a>"
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
2024-08-21 20:50:51 +02:00
class PhabricatorReplyStringConstructor:
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def __init__(self, objID, objTitle, objLink, formatting):
self.objID = objID
self.objTitle = objTitle
self.objLink = objLink
self.formatting = formatting
def constructDifferentialReplyString(self, statusName):
2024-08-21 20:50:51 +02:00
return (
self.formatting.bold(self.objID)
+ ": "
+ self.objTitle
+ " ["
+ statusName
+ "] – "
+ self.formatting.formatLink(self.objLink)
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def constructPasteReplyString(self, authorName):
2024-08-21 20:50:51 +02:00
return (
self.formatting.bold("Paste " + self.objID)
+ " "
+ self.formatting.bold("Author:")
+ " "
+ self.formatting.obscureAuthorName(authorName)
+ ". "
+ self.formatting.bold("Title:")
+ " "
+ self.objTitle
+ " "
+ self.formatting.formatLink(self.objLink)
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
2024-08-21 20:50:51 +02:00
class PhabricatorStoryStringConstructor:
def __init__(
self,
objType,
objectPHID,
objID,
objTitle,
objLink,
authorName,
text,
notifyCommit,
notifyRetitle,
formatting,
verbose,
):
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
self.objType = objType
self.objectPHID = objectPHID
self.objID = objID
self.objTitle = objTitle
self.objLink = objLink
self.authorName = authorName
self.text = text
self.formatting = formatting
self.notifyCommit = notifyCommit
self.notifyRetitle = notifyRetitle
self.verbose = verbose
# Clumsy parsing of the "text" property of the feed.query api results, since transactionPHIDs can't be queried yet
2024-08-21 20:50:51 +02:00
self.action = self.text[len(self.authorName + " ") :]
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# Returns the string and the action identifier
def constructStoryString(self):
if self.objType == "Differential Revision":
return self.__constructDifferentialRevisionStoryString()
if self.objType == "Diffusion Commit":
return self.__constructCommitStoryString()
if self.objType == "Paste":
return self.__constructPasteStoryString()
if self.objType == "Project":
return self.__constructProjectStoryString()
if self.objType == "Image Macro":
return self.__constructImageMacroStoryString()
print("Unexpected object type '" + self.objType + "'", self.objectPHID)
return None, None
def __constructDifferentialRevisionStoryString(self):
# TODO: lookup the file that contains the strings, link it, add remaining strings
supportedActions = (
"created",
"retitled",
"closed",
"accepted",
"awarded",
"resigned from",
"abandoned",
"reclaimed",
"commandeered",
"added a dependency for",
"added a dependent revision for",
"removed a project from",
"planned changes to",
"requested review of",
"added a reviewer for",
"removed a reviewer for",
"edited reviewers for",
"removed 1 commit(s)",
"added 1 commit(s)",
# TODO: removed reviewers for?
"failed to build",
2024-08-21 20:50:51 +02:00
"added reviewers for", # TODO: that query is messed up e​l​e​x​i​s added reviewers for D188: Whales shou D188 (Whales should not block ships) <https://code.wildfiregames.com/D188>.
"added a comment to", # TODO: extra space
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
"added inline comments to",
"updated",
"updated the summary of",
"updated the diff for",
"updated subscribers of",
"updated the Trac tickets for",
"updated the test plan for",
"requested changes to",
"changed the visibility for",
"set the repository for",
)
if not self.action.startswith(supportedActions):
print("WARNING! unsupported differential revision action:", self.action)
# contrary to other actions, this one extends the string by the added reviewer
if self.action.startswith("added a reviewer for"):
2024-08-21 20:50:51 +02:00
return (
self.__constructDifferentialRevisionReviewerAddedStoryString(),
"added a reviewer for",
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if self.action.startswith("closed"):
return self.__constructDifferentialRevisionCloseStoryString(), "closed"
if self.action.startswith("set the repository for"):
2024-08-21 20:50:51 +02:00
return (
self.__constructDifferentialRevisionSetRepositoryStoryString(),
"set the repository for",
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
if self.action.startswith("awarded"):
return self.__constructDifferentialRevisionAwardedStoryString(), "awarded"
if self.action.startswith("retitled"):
return self.__constructDifferentialRevisionRetitleStoryString(), "retitled"
# All other cases are assumed to have this format
2024-08-21 20:50:51 +02:00
action = self.action[: -len(" " + self.objID + ": " + self.objTitle + ".")]
string = (
self.formatting.obscureAuthorName(self.authorName)
+ " "
+ action
+ " "
+ self.formatting.bold(self.objID)
+ " ("
+ self.objTitle
+ ") "
+ self.formatting.formatLink(self.objLink)
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return string, action
def __constructGenericStoryString(self, action):
2024-08-21 20:50:51 +02:00
string = (
self.formatting.obscureAuthorName(self.authorName)
+ " "
+ action
+ " "
+ self.formatting.bold(self.objID)
+ " ("
+ self.objTitle
+ ") "
+ self.formatting.formatLink(self.objLink)
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return string
def __constructDifferentialRevisionRetitleStoryString(self):
# We don't print the previous title which is sent by the conduitAPI
if not self.notifyRetitle:
if self.verbose:
print("Skipping retitle of", self.objID)
return None
return self.__constructGenericStoryString("retitled")
def __constructDifferentialRevisionReviewerAddedStoryString(self):
# TODO: broken string: e​l​e​x​i​s added e​O​b​j​e​c​t​s​:​ ​e​l​e​x​i​s as a reviewer for D189 (Extending rmgen lib's SimpleGroup's place method to avoid collision of included SimpleObjects) <https://code.wildfiregames.com/D189>.
2024-08-21 20:50:51 +02:00
addedReviewer = self.action[
len(
"added a reviewer for" + " " + self.objID + ": " + self.objTitle + ": "
) : -len(".")
]
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return self.__constructGenericStoryString(
2024-08-21 20:50:51 +02:00
"added "
+ self.formatting.obscureAuthorName(addedReviewer)
+ " as a reviewer for"
)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def __constructDifferentialRevisionAwardedStoryString(self):
2024-08-21 20:50:51 +02:00
token = self.action[
len("awarded " + self.objID + ": " + self.objTitle + " a ") : -len(
" token."
)
]
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return self.__constructGenericStoryString("gave a " + token + " award to ")
def __constructDifferentialRevisionCloseStoryString(self):
2024-08-21 20:50:51 +02:00
# by = self.action[len("closed " + self.objID + ": " + self.objTitle):-len(".")]
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
2024-08-21 20:50:51 +02:00
# if not by:
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return self.__constructGenericStoryString("closed")
2024-08-21 20:50:51 +02:00
# commitID = by[len(" by committing"):].split(":", 1)[0]
# return self.__constructGenericStoryString("closed by committing " + commitID)
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
def __constructDifferentialRevisionSetRepositoryStoryString(self):
# This cuts off the repetition of the object title in the action string
return self.__constructGenericStoryString("set the repository for")
def __constructCommitStoryString(self):
supportedActions = (
"committed",
"added a comment to",
"added inline comments to",
"raised a concern with",
"accepted",
2024-08-21 20:50:51 +02:00
"added auditors to", # TODO: contains auditor name
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
"edited edges for",
"added an edge to",
"requested verification of",
"updated subscribers of",
# TODO awarded
)
if self.action.startswith("committed"):
if not self.notifyCommit:
if self.verbose:
print("Skipping commit", self.objID, self.objTitle)
return None, None
return self.__constructGenericStoryString("committed"), "committed"
for action in supportedActions:
if self.action.startswith(action):
return self.__constructGenericStoryString(action), action
print("Unknown commit story type:", self.action)
return None, None
def __constructPasteStoryString(self):
supportedActions = (
"created",
"edited",
"archived",
"added a comment to",
"updated the title for",
"updated the language for",
2024-08-21 20:50:51 +02:00
"changed the visibility for",
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
)
if not self.action.startswith(supportedActions):
print("Unknown paste story type:", self.action)
return None, None
# Notice the missing colon between ID and Title
2024-08-21 20:50:51 +02:00
action = self.action[: -len(" " + self.objID + " " + self.objTitle)]
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return self.__constructGenericStoryString(action), action
# Almost never new projects are created, so meh
def __constructProjectStoryString(self):
# TODO: created
addedMemberAction = "added a member for"
if self.action.startswith(addedMemberAction):
2024-08-21 20:50:51 +02:00
addedMember = self.action[
len(addedMemberAction + " " + self.objTitle + ": ") : -len(".")
]
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
return self.__constructGenericStoryString(
2024-08-21 20:50:51 +02:00
"added "
+ self.formatting.obscureAuthorName(addedMember)
+ " "
+ "as a member to"
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
), addedMemberAction
# TODO: should the one above really contain the objectID?
2024-08-21 20:50:51 +02:00
# return self.formatting.obscureAuthorName(self.authorName) + " " + \
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
# "added " + \
# self.formatting.obscureAuthorName(addedMember) + " " + \
# "as a member to " + \
# self.formatting.bold(self.objTitle) + " " \
# self.formatting.formatLink(self.objLink)
addedMembersAction = "added members for"
if self.action.startswith(addedMembersAction):
2024-08-21 20:50:51 +02:00
addedMembers = self.action[
len(addedMembersAction + " " + self.objTitle + ": ") : -len(".")
].split(", ")
return self.formatting.obscureAuthorName(
self.authorName
) + " " + "added " + ", ".join(
map(
lambda member: self.formatting.obscureAuthorName(member),
addedMembers,
)
) + " " + "as members to " + self.formatting.bold(
self.objTitle
) + " " + self.formatting.formatLink(self.objLink), addedMembersAction
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
editPolicyAction = "changed the edit policy for"
if self.action.startswith(editPolicyAction):
2024-08-21 20:50:51 +02:00
return self.formatting.obscureAuthorName(
self.authorName
) + " " + editPolicyAction + " " + self.formatting.bold(
self.objTitle
) + " " + self.formatting.formatLink(self.objLink), editPolicyAction
Split classes, add filter options and add progress report support. Split the PhabricatorPrinter class into 5 smaller classes: * a PhabricatorStringFormatting class that does the bolding, insertion of invisible whitespace and optional html link formatting. * a PhabricatorStoryStringConstructor class that construct a human readable string from a Phabricator object, author and transaction string, used when some update on Phabricator occurs to notify irc users * a PhabricatorStoryPrinter class that does the consecutive pulling of Phabricator updates via the ConduitAPI class, filters the wanted updates and uses above class to construct strings and sends them to irc. Can be used without irc for testing purposes or generic progress reports. * a PhabricatorReplyStringConstructor class creates human readable strings when getting passed a Phabricator object and author, used when someone mentions a Phabricator object in irc * a PhabricatorReplyPrinter class that extracts Phabricator object references from a string (posted in irc), uses above class to create a human readable string and lets Phabricator post it to irc So the purpose of the splitting is having irc parsing, filter logic and string construction in independent classes and being able to query Phabricator without being connected to irc. Add support for HTML links, fix some minor bugs, strings and remove unused variables with an underscore. Add new options historyForwards, timestampAfter, timestampBefore, printDate, filteredUsers, verbose, acceptInvalidSSLCert and rename obscureUsername to obscureUsernames.
2017-03-13 02:25:04 +01:00
print("Unsupported project story action:", self.action)
return None, None
def __constructImageMacroStoryString(self):
return None, None
2024-08-21 20:50:51 +02:00
Class = Phabricator