1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-26 02:42:16 -05:00

Hide join/part setting now hides quit messages too

This commit is contained in:
Sebastian Kaspari 2011-03-15 20:42:35 +01:00
parent 49f067cd67
commit b855b7ea92
6 changed files with 22 additions and 21 deletions

View File

@ -191,6 +191,6 @@
<string name="settings_fontsize_dialog_title">Misura del font</string> <string name="settings_fontsize_dialog_title">Misura del font</string>
<string name="settings_voice_recognition_title">Riconoscimento vocale</string> <string name="settings_voice_recognition_title">Riconoscimento vocale</string>
<string name="settings_voice_recognition_desc">Mostra il bottone per il riconoscimento vocale</string> <string name="settings_voice_recognition_desc">Mostra il bottone per il riconoscimento vocale</string>
<string name="settings_joinpart_title">Mostra entrate ed uscite</string> <string name="settings_joinpartquit_title">Mostra entrate ed uscite</string>
<string name="settings_joinpart_desc">Mostra i messaggi di entrata e di uscita nei canali</string> <string name="settings_joinpartquit_desc">Mostra i messaggi di entrata e di uscita nei canali</string>
</resources> </resources>

View File

@ -27,8 +27,8 @@
<string name="key_voice_recognition">voice_recognition</string> <string name="key_voice_recognition">voice_recognition</string>
<string name="default_voice_recognition">false</string> <string name="default_voice_recognition">false</string>
<string name="key_show_joinpart">show_joinpart</string> <string name="key_show_joinpartquit">show_joinpartquit</string>
<string name="default_show_joinpart">true</string> <string name="default_show_joinpartquit">true</string>
<string name="key_vibrate_highlight">vibrate_highlight</string> <string name="key_vibrate_highlight">vibrate_highlight</string>
<string name="default_vibrate_highlight">true</string> <string name="default_vibrate_highlight">true</string>

View File

@ -192,6 +192,6 @@
<string name="settings_fontsize_dialog_title">Font size</string> <string name="settings_fontsize_dialog_title">Font size</string>
<string name="settings_voice_recognition_title">Voice recognition</string> <string name="settings_voice_recognition_title">Voice recognition</string>
<string name="settings_voice_recognition_desc">Show button for voice recognition</string> <string name="settings_voice_recognition_desc">Show button for voice recognition</string>
<string name="settings_joinpart_title">Show join and part</string> <string name="settings_joinpartquit_title">Show join, part and quit</string>
<string name="settings_joinpart_desc">Show join and part messages in channels</string> <string name="settings_joinpartquit_desc">Show join, part and quit messages in channels</string>
</resources> </resources>

View File

@ -66,10 +66,10 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:defaultValue="@string/default_24h_format" android:defaultValue="@string/default_24h_format"
android:dependency="@string/key_show_timestamp" /> android:dependency="@string/key_show_timestamp" />
<CheckBoxPreference <CheckBoxPreference
android:title="@string/settings_joinpart_title" android:title="@string/settings_joinpartquit_title"
android:summary="@string/settings_joinpart_desc" android:summary="@string/settings_joinpartquit_desc"
android:key="@string/key_show_joinpart" android:key="@string/key_show_joinpartquit"
android:defaultValue="@string/default_show_joinpart" /> android:defaultValue="@string/default_show_joinpartquit" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:title="@string/settings_highlight"> android:title="@string/settings_highlight">

View File

@ -349,7 +349,7 @@ public class IRCConnection extends PircBot
target target
); );
service.sendBroadcast(intent); service.sendBroadcast(intent);
} else if (service.getSettings().showJoinAndPart()) { } else if (service.getSettings().showJoinPartAndQuit()) {
Message message = new Message( Message message = new Message(
service.getString(R.string.message_join, sender), service.getString(R.string.message_join, sender),
Message.TYPE_MISC Message.TYPE_MISC
@ -540,7 +540,7 @@ public class IRCConnection extends PircBot
target target
); );
service.sendBroadcast(intent); service.sendBroadcast(intent);
} else if (service.getSettings().showJoinAndPart()) { } else if (service.getSettings().showJoinPartAndQuit()) {
Message message = new Message( Message message = new Message(
service.getString(R.string.message_part, sender), service.getString(R.string.message_part, sender),
Message.TYPE_MISC Message.TYPE_MISC
@ -613,7 +613,11 @@ public class IRCConnection extends PircBot
@Override @Override
protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) 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<String> channels = getChannelsByNickname(sourceNick); Vector<String> channels = getChannelsByNickname(sourceNick);
for (String target : channels) { for (String target : channels) {
@ -654,9 +658,6 @@ public class IRCConnection extends PircBot
); );
service.sendBroadcast(intent); service.sendBroadcast(intent);
} }
} else {
// XXX: We quitted
} }
} }

View File

@ -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( return preferences.getBoolean(
resources.getString(R.string.key_show_joinpart), resources.getString(R.string.key_show_joinpartquit),
Boolean.parseBoolean(resources.getString(R.string.default_show_joinpart)) Boolean.parseBoolean(resources.getString(R.string.default_show_joinpartquit))
); );
} }
} }