fd
This commit is contained in:
commit
b38965126d
4 changed files with 29 additions and 2 deletions
|
@ -17,6 +17,7 @@ CHANGELOG
|
||||||
* Logviewer - Kiooeht [evacipatedBox]
|
* Logviewer - Kiooeht [evacipatedBox]
|
||||||
* Quirk ordering - alGore
|
* Quirk ordering - alGore
|
||||||
* # of users in a memo - alGore
|
* # of users in a memo - alGore
|
||||||
|
* @links to users - illuminatedwax [ghostDunk]
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
* mixer bug fixed
|
* mixer bug fixed
|
||||||
|
|
10
convo.py
10
convo.py
|
@ -304,6 +304,16 @@ class PesterText(QtGui.QTextEdit):
|
||||||
if url != "":
|
if url != "":
|
||||||
if url[0] == "#" and url != "#pesterchum":
|
if url[0] == "#" and url != "#pesterchum":
|
||||||
self.parent().mainwindow.showMemos(url[1:])
|
self.parent().mainwindow.showMemos(url[1:])
|
||||||
|
elif url[0] == "@":
|
||||||
|
handle = unicode(url[1:])
|
||||||
|
mw = self.parent().mainwindow
|
||||||
|
matchingChums = [c for c in mw.chumList.chums if c.handle == handle]
|
||||||
|
if len(matchingChums) > 0:
|
||||||
|
mood = matchingChums[0].mood
|
||||||
|
else:
|
||||||
|
mood = Mood(0)
|
||||||
|
chum = PesterProfile(handle, mood=mood, chumdb=mw.chumdb)
|
||||||
|
mw.newConversation(chum)
|
||||||
else:
|
else:
|
||||||
QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.TolerantMode))
|
QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.TolerantMode))
|
||||||
QtGui.QTextEdit.mousePressEvent(self, event)
|
QtGui.QTextEdit.mousePressEvent(self, event)
|
||||||
|
|
|
@ -11,6 +11,7 @@ _ctag_end = re.compile(r'(?i)</c>')
|
||||||
_ctag_rgb = re.compile(r'\d+,\d+,\d+')
|
_ctag_rgb = re.compile(r'\d+,\d+,\d+')
|
||||||
_urlre = re.compile(r"(?i)https?://[^\s]+")
|
_urlre = re.compile(r"(?i)https?://[^\s]+")
|
||||||
_memore = re.compile(r"(\s|^)(#[A-Za-z0-9_]+)")
|
_memore = re.compile(r"(\s|^)(#[A-Za-z0-9_]+)")
|
||||||
|
_handlere = re.compile(r"(\s|^)(@[A-Za-z0-9_]+)")
|
||||||
_imgre = re.compile(r"""(?i)<img src=['"](\S+)['"]\s*/>""")
|
_imgre = re.compile(r"""(?i)<img src=['"](\S+)['"]\s*/>""")
|
||||||
_mecmdre = re.compile(r"^(/me|PESTERCHUM:ME)(\S*)")
|
_mecmdre = re.compile(r"^(/me|PESTERCHUM:ME)(\S*)")
|
||||||
|
|
||||||
|
@ -109,6 +110,16 @@ class memolex(object):
|
||||||
return "%s<a href='%s'>%s</a>" % (self.space, self.channel, self.channel)
|
return "%s<a href='%s'>%s</a>" % (self.space, self.channel, self.channel)
|
||||||
else:
|
else:
|
||||||
return self.string
|
return self.string
|
||||||
|
class chumhandlelex(object):
|
||||||
|
def __init__(self, string, space, handle):
|
||||||
|
self.string = string
|
||||||
|
self.space = space
|
||||||
|
self.handle = handle
|
||||||
|
def convert(self, format):
|
||||||
|
if format == "html":
|
||||||
|
return "%s<a href='%s'>%s</a>" % (self.space, self.handle, self.handle)
|
||||||
|
else:
|
||||||
|
return self.string
|
||||||
class smiley(object):
|
class smiley(object):
|
||||||
def __init__(self, string):
|
def __init__(self, string):
|
||||||
self.string = string
|
self.string = string
|
||||||
|
@ -129,6 +140,7 @@ def lexMessage(string):
|
||||||
(colorBegin, _ctag_begin), (colorBegin, _gtag_begin),
|
(colorBegin, _ctag_begin), (colorBegin, _gtag_begin),
|
||||||
(colorEnd, _ctag_end), (imagelink, _imgre),
|
(colorEnd, _ctag_end), (imagelink, _imgre),
|
||||||
(hyperlink, _urlre), (memolex, _memore),
|
(hyperlink, _urlre), (memolex, _memore),
|
||||||
|
(chumhandlelex, _handlere),
|
||||||
(smiley, _smilere)]
|
(smiley, _smilere)]
|
||||||
|
|
||||||
string = unicode(string)
|
string = unicode(string)
|
||||||
|
@ -188,7 +200,11 @@ def splitMessage(msg, format="ctag"):
|
||||||
if type(o) is colorBegin:
|
if type(o) is colorBegin:
|
||||||
cbegintags.append(o)
|
cbegintags.append(o)
|
||||||
elif type(o) is colorEnd:
|
elif type(o) is colorEnd:
|
||||||
cbegintags.pop()
|
print len(cbegintags)
|
||||||
|
try:
|
||||||
|
cbegintags.pop()
|
||||||
|
except IndexError:
|
||||||
|
print len(cbegintags)
|
||||||
# yeah normally i'd do binary search but im lazy
|
# yeah normally i'd do binary search but im lazy
|
||||||
msglen = len(convertTags(okmsg, format)) + 4*(len(cbegintags))
|
msglen = len(convertTags(okmsg, format)) + 4*(len(cbegintags))
|
||||||
if msglen > 400:
|
if msglen > 400:
|
||||||
|
|
Loading…
Reference in a new issue