203 self.__markerLine = "" |
203 self.__markerLine = "" |
204 self.__hidden = True |
204 self.__hidden = True |
205 |
205 |
206 self.__patterns = [ |
206 self.__patterns = [ |
207 # :foo_!n=foo@foohost.bar.net PRIVMSG #eric-ide :some long message |
207 # :foo_!n=foo@foohost.bar.net PRIVMSG #eric-ide :some long message |
208 (re.compile(r":([^!]+).*\sPRIVMSG\s([^ ]+)\s:(.*)"), self.__message), |
208 # :foo_!n=foo@foohost.bar.net PRIVMSG bar_ :some long message |
|
209 (re.compile(r":([^!]+)!([^ ]+)\sPRIVMSG\s([^ ]+)\s:(.*)"), self.__message), |
209 # :foo_!n=foo@foohost.bar.net JOIN :#eric-ide |
210 # :foo_!n=foo@foohost.bar.net JOIN :#eric-ide |
210 (re.compile(r":([^!]+)!([^ ]+)\sJOIN\s:?([^ ]+)"), self.__userJoin), |
211 (re.compile(r":([^!]+)!([^ ]+)\sJOIN\s:?([^ ]+)"), self.__userJoin), |
211 # :foo_!n=foo@foohost.bar.net PART #eric-ide :part message |
212 # :foo_!n=foo@foohost.bar.net PART #eric-ide :part message |
212 (re.compile(r":([^!]+).*\sPART\s([^ ]+)\s:(.*)"), self.__userPart), |
213 (re.compile(r":([^!]+).*\sPART\s([^ ]+)\s:(.*)"), self.__userPart), |
213 # :foo_!n=foo@foohost.bar.net PART #eric-ide |
214 # :foo_!n=foo@foohost.bar.net PART #eric-ide |
297 ok = E5MessageBox.yesNo(self, |
298 ok = E5MessageBox.yesNo(self, |
298 self.trUtf8("Leave IRC channel"), |
299 self.trUtf8("Leave IRC channel"), |
299 self.trUtf8("""Do you really want to leave the IRC channel <b>{0}</b>?""")\ |
300 self.trUtf8("""Do you really want to leave the IRC channel <b>{0}</b>?""")\ |
300 .format(self.__name)) |
301 .format(self.__name)) |
301 if ok: |
302 if ok: |
302 self.sendData.emit("PART " + self.__name + " :" + self.__partMessage) |
303 if not self.__private: |
|
304 self.sendData.emit("PART " + self.__name + " :" + self.__partMessage) |
303 self.channelClosed.emit(self.__name) |
305 self.channelClosed.emit(self.__name) |
304 |
306 |
305 def name(self): |
307 def name(self): |
306 """ |
308 """ |
307 Public method to get the name of the channel. |
309 Public method to get the name of the channel. |
365 @param private flag indicating private chat mode (boolean) |
367 @param private flag indicating private chat mode (boolean) |
366 @param partner name of the partner user (string) |
368 @param partner name of the partner user (string) |
367 """ |
369 """ |
368 self.__private = private |
370 self.__private = private |
369 self.__privatePartner = partner |
371 self.__privatePartner = partner |
|
372 |
|
373 def setPrivateInfo(self, infoText): |
|
374 """ |
|
375 Public method to set some info text for private chat mode. |
|
376 |
|
377 @param infoText info text to be shown (string) |
|
378 """ |
|
379 if self.__private: |
|
380 self.topicLabel.setText(infoText) |
370 |
381 |
371 def handleMessage(self, line): |
382 def handleMessage(self, line): |
372 """ |
383 """ |
373 Public method to handle the message sent by the server. |
384 Public method to handle the message sent by the server. |
374 |
385 |
388 Private method to handle messages to the channel. |
399 Private method to handle messages to the channel. |
389 |
400 |
390 @param match match object that matched the pattern |
401 @param match match object that matched the pattern |
391 @return flag indicating whether the message was handled (boolean) |
402 @return flag indicating whether the message was handled (boolean) |
392 """ |
403 """ |
393 if match.group(2).lower() == self.__name: |
404 # group(1) sender user name |
394 msg = ircFilter(match.group(3)) |
405 # group(2) sender user@host |
395 self.__appendMessage( |
406 # group(3) target nick |
396 '<font color="{0}">{2} <b><</b><font color="{1}">{3}</font>' |
407 # group(4) message |
397 '<b>></b> {4}</font>'.format( |
408 if match.group(3).lower() == self.__name: |
398 Preferences.getIrc("ChannelMessageColour"), |
409 self.addMessage(match.group(1), match.group(4)) |
399 Preferences.getIrc("NickColour"), |
410 if self.__private and not self.topicLabel.text(): |
400 ircTimestamp(), match.group(1), |
411 self.setPrivateInfo("{0} - {1}".format(match.group(1), match.group(2))) |
401 msg)) |
412 return True |
402 if Preferences.getIrc("ShowNotifications"): |
413 |
403 if Preferences.getIrc("NotifyMessage"): |
414 return False |
404 self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), |
415 |
405 self.trUtf8("Channel Message"), msg) |
416 def addMessage(self, sender, msg): |
406 elif Preferences.getIrc("NotifyNick") and \ |
417 """ |
407 self.__userName.lower() in msg.lower(): |
418 Public method to add a message from external. |
408 self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), |
419 |
409 self.trUtf8("Nick mentioned"), msg) |
420 @param sender nick name of the sender (string) |
410 return True |
421 @param msg message received from sender (string) |
411 |
422 """ |
412 return False |
423 self.__appendMessage( |
|
424 '<font color="{0}">{2} <b><</b><font color="{1}">{3}</font>' |
|
425 '<b>></b> {4}</font>'.format( |
|
426 Preferences.getIrc("ChannelMessageColour"), |
|
427 Preferences.getIrc("NickColour"), |
|
428 ircTimestamp(), sender, ircFilter(msg))) |
|
429 if Preferences.getIrc("ShowNotifications"): |
|
430 if Preferences.getIrc("NotifyMessage"): |
|
431 self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), |
|
432 self.trUtf8("Channel Message"), msg) |
|
433 elif Preferences.getIrc("NotifyNick") and \ |
|
434 self.__userName.lower() in msg.lower(): |
|
435 self.__ui.showNotification(UI.PixmapCache.getPixmap("irc48.png"), |
|
436 self.trUtf8("Nick mentioned"), msg) |
413 |
437 |
414 def addUsers(self, users): |
438 def addUsers(self, users): |
415 """ |
439 """ |
416 Public method to add users to the channel. |
440 Public method to add users to the channel. |
417 |
441 |