Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 58fb249b
authored
Dec 17, 2014
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
irc bot restarting
1 parent
a83af5a4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
code/moya-parent/pom.xml
code/moya-web/src/main/java/fi/codecrew/moya/servlet/IrcServlet.java
code/moya-parent/pom.xml
View file @
58fb249
...
...
@@ -76,7 +76,7 @@
<dependency>
<groupId>
fi.iudex
</groupId>
<artifactId>
utils-standalone
</artifactId>
<version>
1.0.1
0
</version>
<version>
1.0.1
1
</version>
</dependency>
<dependency>
<groupId>
net.sf.barcode4j
</groupId>
...
...
code/moya-web/src/main/java/fi/codecrew/moya/servlet/IrcServlet.java
View file @
58fb249
...
...
@@ -49,6 +49,8 @@ import javax.servlet.http.HttpServlet;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
net.sf.jerklib.Profile
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -94,13 +96,17 @@ public class IrcServlet extends HttpServlet {
*/
public
void
init
(
ServletConfig
config
)
throws
ServletException
{
startBot
();
}
private
void
startBot
()
{
String
ircserver
=
SystemProperty
.
MOYA_IRC_SERVER
.
getValueOrDefault
();
logger
.
info
(
"Got irc server system property {}"
,
ircserver
);
if
(
ircserver
!=
null
)
{
logger
.
info
(
"Starting IRC client with server {}"
,
ircserver
);
IrcBot
bot
=
new
IrcBot
(
ircserver
,
6667
,
SystemProperty
.
MOYA_IRC_SERVERPASS
.
getValueOrNull
()
,
SystemProperty
.
MOYA_IRC_CHANNEL
.
getValueOrDefault
(),
"moya-bot"
);
IrcBot
bot
=
new
IrcBot
(
ircserver
,
6667
,
SystemProperty
.
MOYA_IRC_SERVERPASS
.
getValueOrNull
()
,
SystemProperty
.
MOYA_IRC_CHANNEL
.
getValueOrDefault
(),
new
Profile
(
"moyabot"
,
"Moya bot"
,
"moya-bot"
)
);
botbean
.
add
(
bot
);
bots
.
add
(
bot
);
bot
.
start
();
...
...
@@ -125,17 +131,15 @@ public class IrcServlet extends HttpServlet {
for
(
IrcBot
b
:
bots
)
{
try
{
b
.
stop
();
}
catch
(
Throwable
t
)
{
logger
.
info
(
"Error stopping bot"
,
t
);
}
b
.
start
();
}
bots
.
clear
();
startBot
();
// String msg = request.getParameter("msg");
// if (msg != null && !msg.isEmpty())
// for (IrcBot b : bots) {
// b.say(msg);
// }
}
/**
...
...
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