diff --git a/config.py.example b/config.py.example
index fc0dd75..385eec6 100644
--- a/config.py.example
+++ b/config.py.example
@@ -5,7 +5,7 @@ N_LINES = 32
SIRC_PORT = 2354
# IRC
-SERVER = '115.92.130.250'
+SERVER = 'irc.uriirc.org'
PORT = 16667
BOT_NAME = 's'
diff --git a/render/channel.html b/render/channel.html
index 7d75485..bcecca6 100644
--- a/render/channel.html
+++ b/render/channel.html
@@ -35,6 +35,7 @@
How to use SIRC
Append the channel name to URL (as hash fragment) where you want to join.
(Ex) sirc.domain.com/#snucse12
That's all.
+ Welcome, {{ account }}!
Enjoy your ircing!
https://github.com/sim0629/sirc/wiki
diff --git a/render/result.xml b/render/result.xml
index 45011a7..dfbbafc 100644
--- a/render/result.xml
+++ b/render/result.xml
@@ -1,5 +1,5 @@
-
+
{% for log in logs %}
diff --git a/static/js/sirc.js b/static/js/sirc.js
index d2cae7b..1acadeb 100644
--- a/static/js/sirc.js
+++ b/static/js/sirc.js
@@ -9,6 +9,7 @@ var last_downdate = '';
// Utility
var add_process = function(xml, flag) {
+ if($('result', xml).attr('channel') != channel) return;
$('log', xml).each(function(i) {
var datetime = $(this).find('datetime').text();
var source = $(this).find('source').text();
@@ -87,7 +88,8 @@ var sirc_downdate = function(callback) {
dataType: 'xml',
success: function(xml) {
add_process(xml, 'downdate');
- $('more').click(function() { $(this).remove(); return sirc_downdate(); }).prependTo($('ul#log'));
+ if($('log', xml).length > 0)
+ $('more').click(function() { $(this).remove(); return sirc_downdate(); }).prependTo($('ul#log'));
$('ul#log').listview('refresh');
if(callback) callback();
$.mobile.hidePageLoadingMsg();
@@ -123,7 +125,7 @@ var sirc_send = function() {
return false;
};
-var sirc_join = function() {
+var sirc_join = function(init) {
if(!window.location.hash) return;
channel = window.location.hash;
$('a#dummy').attr('name', channel.substr(1))
@@ -132,7 +134,7 @@ var sirc_join = function() {
$('ul#log').empty();
last_update = last_downdate = datetime_now();
sirc_downdate(function() { scroll(SCROLL_END, 1000); });
- setTimeout("sirc_update();", 500);
+ if(init) setTimeout("sirc_update();", 500);
return false;
};
@@ -142,6 +144,6 @@ $(document).ready(function() {
$('a#setting').click(function() { $('div#menu').toggle(); return false; });
$('form#send').submit(function() { return sirc_send(); });
$('input#message').keydown(function (e) { if(e.keyCode == 13) return sirc_send(); });
- $(window).hashchange(function() { return sirc_join(); });
- sirc_join();
+ $(window).hashchange(function() { return sirc_join(false); });
+ sirc_join(true);
});
diff --git a/wsgi.py b/wsgi.py
index 38b8a9a..c4d6cee 100644
--- a/wsgi.py
+++ b/wsgi.py
@@ -108,6 +108,7 @@ def update(environ, start_response, session, parameters):
if 'last_update' in parameters:
last_update = parse_datetime(parameters['last_update'][0].decode('utf-8'))
channel = parameters['channel'][0].decode('utf-8').lower()
+ context['channel'] = channel
logs = []
for i in xrange(30):
logs = list(db[channel].find({
@@ -134,6 +135,7 @@ def downdate(environ, start_response, session, parameters):
if 'last_downdate' in parameters:
last_downdate = parse_datetime(parameters['last_downdate'][0].decode('utf-8'))
channel = parameters['channel'][0].decode('utf-8').lower()
+ context['channel'] = channel
logs = db[channel].find({
'datetime': {"$lt": last_downdate},
}, limit = config.N_LINES, sort = [
@@ -172,7 +174,7 @@ def send(environ, start_response, session, parameters):
return [render('result.xml', context)]
def default(environ, start_response, session, parameters):
- context = {}
+ context = {'account': session['account']}
db.session.remove({'datetime': {'$lt': datetime.datetime.now() - datetime.timedelta(1)}})
start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')])
return [render('channel.html', context)]