jschat 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/jschat/http/jschat.rb +9 -7
  2. metadata +3 -3
@@ -231,7 +231,6 @@ helpers do
231
231
 
232
232
  def save_twitter_user(options = {})
233
233
  options = load_twitter_user.merge(options).merge({
234
- 'name' => nickname,
235
234
  'twitter_name' => session[:twitter_name],
236
235
  'access_token' => session[:access_token],
237
236
  'secret_token' => session[:secret_token]
@@ -293,8 +292,8 @@ post '/change-name' do
293
292
  load_bridge
294
293
  result = @bridge.change('user', { 'name' => params['name'] })
295
294
  if result['notice']
296
- save_twitter_user({ 'name' => params['name'] }) if twitter_user?
297
295
  save_nickname params['name']
296
+ save_twitter_user({ :name => params['name'] }) if twitter_user?
298
297
  end
299
298
  [result].to_json
300
299
  end
@@ -423,17 +422,20 @@ get '/twitter_auth' do
423
422
  # TODO: Make this cope if someone has the same name
424
423
  room = '#jschat'
425
424
  user = load_twitter_user
425
+ name = @twitter.info['screen_name']
426
426
 
427
- if user['name'] and nickname != user['name']
428
- @bridge.change('user', { 'name' => user['name'] })
427
+ if user['name'] and user['name'].length > 0
428
+ name = user['name']
429
429
  end
430
430
 
431
- save_nickname user['name']
432
431
  session[:jschat_id] = user['jschat_id'] if user['jschat_id'] and !user['jschat_id'].empty?
433
- save_twitter_user('twitter_name' => @twitter.info['screen_name'], 'jschat_id' => session[:jschat_id])
432
+ save_nickname name
433
+ save_twitter_user('twitter_name' => @twitter.info['screen_name'],
434
+ 'jschat_id' => session[:jschat_id],
435
+ 'name' => name)
434
436
  user = load_twitter_user
435
-
436
437
  load_bridge
438
+
437
439
  if @bridge.active?
438
440
  if user['rooms'] and user['rooms'].any?
439
441
  room = user['rooms'].first
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alex R. Young
@@ -198,7 +198,7 @@ files:
198
198
  - test/test_helper.rb
199
199
  - README.textile
200
200
  - MIT-LICENSE
201
- has_rdoc: false
201
+ has_rdoc: true
202
202
  homepage: http://github.com/alexyoung/jschat
203
203
  licenses: []
204
204