Skip to content

Commit

Permalink
Fix sending/receiving nudges. Only display that the nudge was sent if…
Browse files Browse the repository at this point in the history
… papyon says it's sent.
  • Loading branch information
Alexander Godlewski committed Jul 30, 2011
1 parent 37c1bc4 commit 2a5c756
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion amsn2/core/conversation.py
Expand Up @@ -120,7 +120,8 @@ def on_nudge_received(self, sender_uid):
""" """
@type sender_uid: str @type sender_uid: str
""" """
self._conv_widget.nudge() contact = self._core._contactlist_manager.get_contact(sender_uid)
self._conv_widget.on_nudge_received(contact)


""" Actions from ourselves """ """ Actions from ourselves """
def send_message(self, msg, formatting=None): def send_message(self, msg, formatting=None):
Expand All @@ -135,6 +136,9 @@ def send_message(self, msg, formatting=None):


def send_nudge(self): def send_nudge(self):
self._conv.send_nudge() self._conv.send_nudge()

def on_nudge_sent(self):
self._conv_widget.on_nudge_sent()


def send_typing_notification(self): def send_typing_notification(self):
self._conv.send_typing_notification() self._conv.send_typing_notification()
Expand Down
2 changes: 2 additions & 0 deletions amsn2/protocol/events/conversation.py
Expand Up @@ -105,3 +105,5 @@ def on_conversation_nudge_received(self, sender):
""" """
self._amsn_conversation.on_nudge_received(sender.id) self._amsn_conversation.on_nudge_received(sender.id)


def on_conversation_nudge_sent(self):
self._amsn_conversation.on_nudge_sent()
7 changes: 6 additions & 1 deletion amsn2/ui/base/chat_window.py
Expand Up @@ -37,7 +37,10 @@ def on_message_received(self, messageview):
""" """
raise NotImplementedError raise NotImplementedError


def nudge(self): def on_nudge_received(self, contact):
"""
@type contact: L{amsn2.core.contactlist_manager.aMSNContact}
"""
raise NotImplementedError raise NotImplementedError


def on_user_typing(self, contact): def on_user_typing(self, contact):
Expand All @@ -46,3 +49,5 @@ def on_user_typing(self, contact):
""" """
raise NotImplementedError raise NotImplementedError


def on_nudge_sent(self):
raise NotImplementedError
4 changes: 3 additions & 1 deletion amsn2/ui/front_ends/qt4/chat_window.py
Expand Up @@ -227,6 +227,8 @@ def __sendMessage(self):


def __sendNudge(self): def __sendNudge(self):
self._amsn_conversation.send_nudge() self._amsn_conversation.send_nudge()

def on_nudge_sent(self):
self.ui.textEdit.append("<b>/me sent a nudge</b>") self.ui.textEdit.append("<b>/me sent a nudge</b>")


def __typingNotification(self): def __typingNotification(self):
Expand Down Expand Up @@ -293,5 +295,5 @@ def on_message_received(self, messageview, formatting=None):
self._statusBar.clearMessage() self._statusBar.clearMessage()


def on_nudge_received(self, sender): def on_nudge_received(self, sender):
self.ui.textEdit.append(unicode("<b>"+QtCore.QString.fromUtf8(sender.to_HTML_string())+" "+self.tr("sent you a nudge!")+("</b>"))) self.ui.textEdit.append(unicode("<b>"+QtCore.QString.fromUtf8(sender.nickname.to_HTML_string())+" "+self.tr("sent you a nudge!")+("</b>")))
pass pass

0 comments on commit 2a5c756

Please sign in to comment.