From b855b7ea9200819c5450a79a1e9298048639956b Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Tue, 15 Mar 2011 20:42:35 +0100 Subject: [PATCH] Hide join/part setting now hides quit messages too --- application/res/values-it/strings.xml | 4 ++-- application/res/values/settings.xml | 4 ++-- application/res/values/strings.xml | 4 ++-- application/res/xml/preferences.xml | 8 ++++---- application/src/org/yaaic/irc/IRCConnection.java | 13 +++++++------ application/src/org/yaaic/model/Settings.java | 10 +++++----- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/application/res/values-it/strings.xml b/application/res/values-it/strings.xml index 4a4c9f1..184e11d 100644 --- a/application/res/values-it/strings.xml +++ b/application/res/values-it/strings.xml @@ -191,6 +191,6 @@ Misura del font Riconoscimento vocale Mostra il bottone per il riconoscimento vocale - Mostra entrate ed uscite - Mostra i messaggi di entrata e di uscita nei canali + Mostra entrate ed uscite + Mostra i messaggi di entrata e di uscita nei canali diff --git a/application/res/values/settings.xml b/application/res/values/settings.xml index 82ce766..5666c8d 100644 --- a/application/res/values/settings.xml +++ b/application/res/values/settings.xml @@ -27,8 +27,8 @@ voice_recognition false - show_joinpart - true + show_joinpartquit + true vibrate_highlight true diff --git a/application/res/values/strings.xml b/application/res/values/strings.xml index 98502b2..850dd68 100644 --- a/application/res/values/strings.xml +++ b/application/res/values/strings.xml @@ -192,6 +192,6 @@ Font size Voice recognition Show button for voice recognition - Show join and part - Show join and part messages in channels + Show join, part and quit + Show join, part and quit messages in channels diff --git a/application/res/xml/preferences.xml b/application/res/xml/preferences.xml index ecb1321..1bed452 100644 --- a/application/res/xml/preferences.xml +++ b/application/res/xml/preferences.xml @@ -66,10 +66,10 @@ along with Yaaic. If not, see . android:defaultValue="@string/default_24h_format" android:dependency="@string/key_show_timestamp" /> + android:title="@string/settings_joinpartquit_title" + android:summary="@string/settings_joinpartquit_desc" + android:key="@string/key_show_joinpartquit" + android:defaultValue="@string/default_show_joinpartquit" /> diff --git a/application/src/org/yaaic/irc/IRCConnection.java b/application/src/org/yaaic/irc/IRCConnection.java index 7dcead7..4a61fe3 100644 --- a/application/src/org/yaaic/irc/IRCConnection.java +++ b/application/src/org/yaaic/irc/IRCConnection.java @@ -349,7 +349,7 @@ public class IRCConnection extends PircBot target ); service.sendBroadcast(intent); - } else if (service.getSettings().showJoinAndPart()) { + } else if (service.getSettings().showJoinPartAndQuit()) { Message message = new Message( service.getString(R.string.message_join, sender), Message.TYPE_MISC @@ -540,7 +540,7 @@ public class IRCConnection extends PircBot target ); service.sendBroadcast(intent); - } else if (service.getSettings().showJoinAndPart()) { + } else if (service.getSettings().showJoinPartAndQuit()) { Message message = new Message( service.getString(R.string.message_part, sender), Message.TYPE_MISC @@ -613,7 +613,11 @@ public class IRCConnection extends PircBot @Override protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) { - if (!sourceNick.equals(this.getNick())) { + if (sourceNick.equals(this.getNick())) { + return; + } + + if (service.getSettings().showJoinPartAndQuit()) { Vector channels = getChannelsByNickname(sourceNick); for (String target : channels) { @@ -654,9 +658,6 @@ public class IRCConnection extends PircBot ); service.sendBroadcast(intent); } - - } else { - // XXX: We quitted } } diff --git a/application/src/org/yaaic/model/Settings.java b/application/src/org/yaaic/model/Settings.java index 9b57932..c20e052 100644 --- a/application/src/org/yaaic/model/Settings.java +++ b/application/src/org/yaaic/model/Settings.java @@ -197,15 +197,15 @@ public class Settings } /** - * Should join and part messages be displayed? + * Should join, part and quit messages be displayed? * - * @return True if joins and parts should be displayed, false otherwise + * @return True if joins, parts and quits should be displayed, false otherwise */ - public boolean showJoinAndPart() + public boolean showJoinPartAndQuit() { return preferences.getBoolean( - resources.getString(R.string.key_show_joinpart), - Boolean.parseBoolean(resources.getString(R.string.default_show_joinpart)) + resources.getString(R.string.key_show_joinpartquit), + Boolean.parseBoolean(resources.getString(R.string.default_show_joinpartquit)) ); } }