Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2fbbded3
authored
Dec 16, 2014
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IRC server password
1 parent
2b1d625b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
code/moya-utils/src/main/java/fi/codecrew/moya/utilities/SystemProperty.java
code/moya-web/src/main/java/fi/codecrew/moya/servlet/IrcServlet.java
code/moya-utils/src/main/java/fi/codecrew/moya/utilities/SystemProperty.java
View file @
2fbbded
...
...
@@ -13,8 +13,9 @@ import org.slf4j.LoggerFactory;
public
enum
SystemProperty
{
MOYA_IRC_SERVER
,
MOYA_IRC_CHANNEL
(
"#moya-debug"
)
MOYA_IRC_CHANNEL
(
"#moya-debug"
),
MOYA_IRC_SERVERPASS
(),
;
private
final
String
defaultValue
;
...
...
@@ -62,4 +63,10 @@ public enum SystemProperty {
}
return
intval
;
}
public
String
getValueOrNull
()
{
String
val
=
System
.
getProperty
(
this
.
name
());
return
val
;
}
}
code/moya-web/src/main/java/fi/codecrew/moya/servlet/IrcServlet.java
View file @
2fbbded
...
...
@@ -100,7 +100,7 @@ public class IrcServlet extends HttpServlet {
{
logger
.
info
(
"Starting IRC client with server {}"
,
ircserver
);
IrcBot
bot
=
new
IrcBot
(
ircserver
,
SystemProperty
.
MOYA_IRC_CHANNEL
.
getValueOrDefault
(),
"moya-bot"
);
IrcBot
bot
=
new
IrcBot
(
ircserver
,
6667
,
SystemProperty
.
MOYA_IRC_SERVERPASS
.
getValueOrNull
()
,
SystemProperty
.
MOYA_IRC_CHANNEL
.
getValueOrDefault
(),
"moya-bot"
);
botbean
.
add
(
bot
);
bots
.
add
(
bot
);
bot
.
start
();
...
...
@@ -123,6 +123,11 @@ public class IrcServlet extends HttpServlet {
*/
protected
void
doGet
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
for
(
IrcBot
b
:
bots
)
{
try
{
b
.
stop
();
}
catch
(
Throwable
t
)
{
logger
.
info
(
"Error stopping bot"
,
t
);
}
b
.
start
();
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment