Created
April 14, 2010 12:54
-
-
Save mashiro/365781 to your computer and use it in GitHub Desktop.
LimeChat for Macでアイコンを表示したりしなかったり
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clr | |
from Misuzilla.Applications.TwitterIrcGateway.AddIns.DLRIntegration import DLRIntegrationAddIn, DLRBasicConfiguration, DLRContextHelper | |
class DisplayIcon(object): | |
def __init__(self): | |
CurrentSession.MessageReceived += self.on_message_received | |
CurrentSession.PreSendMessageTimelineStatus += self.on_pre_send_message_timeline_status | |
CurrentSession.AddInManager.GetAddIn(DLRIntegrationAddIn).BeforeUnload += self.on_before_unload | |
self.display = False | |
def on_message_received(self, sender, e): | |
command = e.Message.Command.upper() | |
notice = False | |
if command == "ENABLEICON": | |
self.display = True | |
notice = True | |
elif command == "DISABLEICON": | |
self.display = False | |
notice = True | |
elif command == "TOGGLEICON": | |
self.display = not self.display | |
notice = True | |
if notice: | |
message = "アイコンの表示を%s化しました。" % ("有効" if self.display else "無効") | |
CurrentSession.SendTwitterGatewayServerMessage(message) | |
def on_pre_send_message_timeline_status(self, sender, e): | |
if self.display: | |
e.Text = e.Text + " " + e.Status.User.ProfileImageUrl | |
def on_before_unload(self, sender, e): | |
CurrentSession.MessageReceived -= self.on_message_received | |
CurrentSession.PreSendMessageTimelineStatus -= self.on_pre_send_message_timeline_status | |
display_icon = DisplayIcon() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment