Skip to content

Commit

Permalink
Still having problems with the cookie logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Young committed Apr 5, 2010
1 parent e9550b9 commit b8a044a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/jschat/http/jschat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def twitter_user?

def save_twitter_user(options = {})
options = load_twitter_user.merge(options).merge({
'name' => nickname,
'twitter_name' => session[:twitter_name],
'access_token' => session[:access_token],
'secret_token' => session[:secret_token]
Expand Down Expand Up @@ -293,8 +292,8 @@ def nickname
load_bridge
result = @bridge.change('user', { 'name' => params['name'] })
if result['notice']
save_twitter_user({ 'name' => params['name'] }) if twitter_user?
save_nickname params['name']
save_twitter_user({ :name => params['name'] }) if twitter_user?
end
[result].to_json
end
Expand Down Expand Up @@ -423,17 +422,20 @@ def nickname
# TODO: Make this cope if someone has the same name
room = '#jschat'
user = load_twitter_user
name = @twitter.info['screen_name']

if user['name'] and nickname != user['name']
@bridge.change('user', { 'name' => user['name'] })
if user['name'] and user['name'].length > 0
name = user['name']
end

save_nickname user['name']
session[:jschat_id] = user['jschat_id'] if user['jschat_id'] and !user['jschat_id'].empty?
save_twitter_user('twitter_name' => @twitter.info['screen_name'], 'jschat_id' => session[:jschat_id])
save_nickname name
save_twitter_user('twitter_name' => @twitter.info['screen_name'],
'jschat_id' => session[:jschat_id],
'name' => name)
user = load_twitter_user

load_bridge

if @bridge.active?
if user['rooms'] and user['rooms'].any?
room = user['rooms'].first
Expand Down

0 comments on commit b8a044a

Please sign in to comment.