mirror of
https://github.com/moparisthebest/Yaaic
synced 2025-02-17 23:40:20 -05:00
New Setting: Show notices in server window. Closes #47.
This commit is contained in:
parent
b855b7ea92
commit
4262cbcd15
@ -35,4 +35,7 @@
|
|||||||
|
|
||||||
<string name="key_sound_highlight">sound_highlight</string>
|
<string name="key_sound_highlight">sound_highlight</string>
|
||||||
<string name="default_sound_highlight">false</string>
|
<string name="default_sound_highlight">false</string>
|
||||||
|
|
||||||
|
<string name="key_notice_server_window">notice_server_window</string>
|
||||||
|
<string name="default_notice_server_window">false</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -194,4 +194,6 @@
|
|||||||
<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_joinpartquit_title">Show join, part and quit</string>
|
<string name="settings_joinpartquit_title">Show join, part and quit</string>
|
||||||
<string name="settings_joinpartquit_desc">Show join, part and quit messages in channels</string>
|
<string name="settings_joinpartquit_desc">Show join, part and quit messages in channels</string>
|
||||||
|
<string name="settings_noticeserverwindow_title">Notices server window</string>
|
||||||
|
<string name="settings_noticeserverwindow_desc">Show notices in server window</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -70,6 +70,11 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
android:summary="@string/settings_joinpartquit_desc"
|
android:summary="@string/settings_joinpartquit_desc"
|
||||||
android:key="@string/key_show_joinpartquit"
|
android:key="@string/key_show_joinpartquit"
|
||||||
android:defaultValue="@string/default_show_joinpartquit" />
|
android:defaultValue="@string/default_show_joinpartquit" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:title="@string/settings_noticeserverwindow_title"
|
||||||
|
android:summary="@string/settings_noticeserverwindow_desc"
|
||||||
|
android:key="@string/key_notice_server_window"
|
||||||
|
android:defaultValue="@string/default_notice_server_window" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/settings_highlight">
|
android:title="@string/settings_highlight">
|
||||||
|
@ -486,11 +486,17 @@ public class IRCConnection extends PircBot
|
|||||||
notice = Colors.removeFormattingAndColors(notice);
|
notice = Colors.removeFormattingAndColors(notice);
|
||||||
|
|
||||||
// Post notice to currently selected conversation
|
// Post notice to currently selected conversation
|
||||||
Conversation conversation = server.getConversation(server.getSelectedConversation());
|
Conversation conversation;
|
||||||
|
|
||||||
if (conversation == null) {
|
if (service.getSettings().showNoticeInServerWindow()) {
|
||||||
// Fallback: Use ServerInfo view
|
|
||||||
conversation = server.getConversation(ServerInfo.DEFAULT_NAME);
|
conversation = server.getConversation(ServerInfo.DEFAULT_NAME);
|
||||||
|
} else {
|
||||||
|
conversation = server.getConversation(server.getSelectedConversation());
|
||||||
|
|
||||||
|
if (conversation == null) {
|
||||||
|
// Fallback: Use ServerInfo view
|
||||||
|
conversation = server.getConversation(ServerInfo.DEFAULT_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Message message = new Message("-" + sourceNick + "- " + notice);
|
Message message = new Message("-" + sourceNick + "- " + notice);
|
||||||
|
@ -208,4 +208,17 @@ public class Settings
|
|||||||
Boolean.parseBoolean(resources.getString(R.string.default_show_joinpartquit))
|
Boolean.parseBoolean(resources.getString(R.string.default_show_joinpartquit))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should notices be shown in the server window instead in the focused window?
|
||||||
|
*
|
||||||
|
* @return True if notices should be shown in the server window
|
||||||
|
*/
|
||||||
|
public boolean showNoticeInServerWindow()
|
||||||
|
{
|
||||||
|
return preferences.getBoolean(
|
||||||
|
resources.getString(R.string.key_notice_server_window),
|
||||||
|
Boolean.parseBoolean(resources.getString(R.string.default_notice_server_window))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user