sounds.py: don't play sounds on messages from self

This commit is contained in:
James Booth
2016-11-06 23:12:48 +00:00
parent e2ab722f93
commit ff4b5198d8
3 changed files with 20 additions and 0 deletions

View File

@@ -175,6 +175,13 @@ def prof_post_chat_message_display(barejid, resource, message):
def prof_post_room_message_display(barejid, nick, message):
my_nick = prof.get_room_nick(barejid)
if not my_nick:
return
if my_nick == nick:
return;
enabled = prof.settings_boolean_get("sounds", "enabled", False)
if not enabled:
return

View File

@@ -128,6 +128,10 @@ def _get(subject):
if room:
prof.win_focus(plugin_win)
prof.win_show(plugin_win, "called -> prof_get_current_muc: " + room)
nick = prof.get_room_nick(room)
if nick:
prof.win_focus(plugin_win)
prof.win_show(plugin_win, "called -> prof_get_room_nick('" + room + "'): " + nick)
else:
prof.win_focus(plugin_win)
prof.win_show(plugin_win, "called -> prof_get_current_muc: <none>")

View File

@@ -185,6 +185,15 @@ getsubject(char *subject)
char buf[strlen(str) + strlen(room)];
sprintf(buf, "%s%s", str, room);
prof_win_show(plugin_win, buf);
char *nick = prof_get_room_nick(room);
if (nick) {
prof_win_focus(plugin_win);
char *str1 = "called -> prof_get_room_nick('";
char *str2 = "'): ";
char buf1[strlen(str1) + strlen(room) + strlen(str2) + strlen(nick)];
sprintf(buf1, "%s%s%s%s", str1, room, str2, nick);
prof_win_show(plugin_win, buf1);
}
} else {
prof_win_focus(plugin_win);
prof_win_show(plugin_win, "called -> prof_get_current_muc: <none>");