jegolize 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/views/jegol/_jegol.html.erb +2 -2
- data/jegolize.gemspec +1 -1
- data/public/javascripts/jegol.js +111 -107
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.12
|
data/jegolize.gemspec
CHANGED
data/public/javascripts/jegol.js
CHANGED
@@ -454,121 +454,125 @@ var JeGol = {
|
|
454
454
|
}
|
455
455
|
}
|
456
456
|
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
/**
|
467
|
-
* On Connect event - initialize a strope connection and login from authenticated session service URL
|
468
|
-
*/
|
469
|
-
$(document).bind('connect', function(e, d){
|
470
|
-
Strophe.debug('Getting SID from SID service...');
|
471
|
-
|
472
|
-
var jsonURL = $('#jegol_service_url').val();
|
473
|
-
$.ajax({
|
474
|
-
url: jsonURL,
|
475
|
-
success: function(data) {
|
476
|
-
Strophe.debug('SID service returned...');
|
477
|
-
try {
|
478
|
-
JeGol.room = data.room;
|
479
|
-
JeGol.nickname = data.nickname;
|
480
|
-
JeGol.bosh_service = data.bosh_service;
|
481
|
-
|
482
|
-
JeGol.connection = new Strophe.Connection(JeGol.bosh_service);
|
483
|
-
JeGol.loginSIDFromServer(data);
|
484
|
-
}
|
485
|
-
catch(e){
|
486
|
-
Strophe.error('Login failed: ' + e.message);
|
487
|
-
}
|
488
|
-
}
|
457
|
+
function bindEvents()
|
458
|
+
{
|
459
|
+
/**
|
460
|
+
* Bind event: jegol_init
|
461
|
+
*/
|
462
|
+
$(document).bind('jegol_init', function(){
|
463
|
+
JeGol.init();
|
464
|
+
$(document).trigger('connect');
|
489
465
|
});
|
490
|
-
});
|
491
|
-
|
492
|
-
/**
|
493
|
-
* After connection is made, initialize properties
|
494
|
-
*/
|
495
|
-
$(document).bind('connected', function(){
|
496
|
-
// Chat room is not yet joined
|
497
|
-
JeGol.joined = false;
|
498
|
-
// Empty participants list. Haven't gotten them yet.
|
499
|
-
JeGol.participants = {};
|
500
|
-
// Make my presence known to XMPP server
|
501
|
-
JeGol.connection.send($pres().c('priority').t('-1'));
|
502
466
|
|
503
|
-
// Register listeners
|
504
|
-
JeGol.connection.addHandler(JeGol.onPresence, null, 'presence', null, null, null);
|
505
|
-
// TODO: Private IM is not supported yet
|
506
|
-
//JeGol.connection.addHandler(JeGol.onPublicMessage, null, 'message', 'chat', null, null);
|
507
|
-
JeGol.connection.addHandler(JeGol.onPublicMessage, null, 'message', 'groupchat', null, null);
|
508
|
-
|
509
|
-
// If nickname is known from cookie, pick that up.
|
510
|
-
if(JeGol.getCookie("nickname") != ''){
|
511
|
-
JeGol.nickname = JeGol.getCookie("nickname");
|
512
|
-
}
|
513
467
|
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
});
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
$('
|
564
|
-
|
565
|
-
|
566
|
-
|
468
|
+
/**
|
469
|
+
* On Connect event - initialize a strope connection and login from authenticated session service URL
|
470
|
+
*/
|
471
|
+
$(document).bind('connect', function(e, d){
|
472
|
+
Strophe.debug('Getting SID from SID service...');
|
473
|
+
|
474
|
+
var jsonURL = $('#jegol_service_url').val();
|
475
|
+
$.ajax({
|
476
|
+
url: jsonURL,
|
477
|
+
success: function(data) {
|
478
|
+
Strophe.debug('SID service returned...');
|
479
|
+
try {
|
480
|
+
JeGol.room = data.room;
|
481
|
+
JeGol.nickname = data.nickname;
|
482
|
+
JeGol.bosh_service = data.bosh_service;
|
483
|
+
|
484
|
+
JeGol.connection = new Strophe.Connection(JeGol.bosh_service);
|
485
|
+
JeGol.loginSIDFromServer(data);
|
486
|
+
}
|
487
|
+
catch(e){
|
488
|
+
Strophe.error('Login failed: ' + e.message);
|
489
|
+
}
|
490
|
+
}
|
491
|
+
});
|
492
|
+
});
|
493
|
+
|
494
|
+
/**
|
495
|
+
* After connection is made, initialize properties
|
496
|
+
*/
|
497
|
+
$(document).bind('connected', function(){
|
498
|
+
// Chat room is not yet joined
|
499
|
+
JeGol.joined = false;
|
500
|
+
// Empty participants list. Haven't gotten them yet.
|
501
|
+
JeGol.participants = {};
|
502
|
+
// Make my presence known to XMPP server
|
503
|
+
JeGol.connection.send($pres().c('priority').t('-1'));
|
504
|
+
|
505
|
+
// Register listeners
|
506
|
+
JeGol.connection.addHandler(JeGol.onPresence, null, 'presence', null, null, null);
|
507
|
+
// TODO: Private IM is not supported yet
|
508
|
+
//JeGol.connection.addHandler(JeGol.onPublicMessage, null, 'message', 'chat', null, null);
|
509
|
+
JeGol.connection.addHandler(JeGol.onPublicMessage, null, 'message', 'groupchat', null, null);
|
510
|
+
|
511
|
+
// If nickname is known from cookie, pick that up.
|
512
|
+
if(JeGol.getCookie("nickname") != ''){
|
513
|
+
JeGol.nickname = JeGol.getCookie("nickname");
|
514
|
+
}
|
515
|
+
|
516
|
+
// Make my presence known to chat room
|
517
|
+
JeGol.connection.send($pres({to: JeGol.room + '/' + JeGol.nickname}).c('x', {xmlns: Strophe.NS.MUC}));
|
518
|
+
});
|
519
|
+
|
520
|
+
/**
|
521
|
+
* On disconnect, clear out UI elements, kill connection and trigger reconnection if specified
|
522
|
+
*/
|
523
|
+
$(document).bind('disconnected', function(){
|
524
|
+
JeGol.connection = null;
|
525
|
+
$('#jegol_topic').empty();
|
526
|
+
$('#jegol_roster').empty();
|
527
|
+
$('#jegol_chatlog').empty();
|
528
|
+
|
529
|
+
if(JeGol.autoReconnect == true)
|
530
|
+
{
|
531
|
+
JeGol.reconnectionAttempt += 1;
|
532
|
+
//incrementally delay connection attempt
|
533
|
+
if (JeGol.reconnectionAttempt < JeGol.reconnectionAttemptLimit) {
|
534
|
+
setTimeout(function(){
|
535
|
+
$(document).trigger('connect');
|
536
|
+
}, JeGol.reconnectionAttempt * JeGol.reconnectionDelay);
|
537
|
+
}
|
538
|
+
}
|
539
|
+
});
|
540
|
+
|
541
|
+
$(document).bind('room_joined', function(){
|
542
|
+
JeGol.joined = true;
|
543
|
+
JeGol.addMessage("<div class='jegol_log_i_joined'>*** Room joined.</div>")
|
544
|
+
});
|
545
|
+
|
546
|
+
$(document).bind('user_joined', function(e, nickname){
|
547
|
+
JeGol.addMessage("<div class='jegol_log_user_joined'>" + JeGol._stripTimeStampFromNickname(nickname) + " joined.</div>")
|
548
|
+
});
|
549
|
+
|
550
|
+
$(document).bind('user_left', function(e, nickname){
|
551
|
+
JeGol.addMessage("<div class='jegol_log_user_left'>" + JeGol._stripTimeStampFromNickname(nickname) + " left.</div>")
|
552
|
+
});
|
553
|
+
|
554
|
+
/**
|
555
|
+
* UI action listener - on enter, do post
|
556
|
+
*/
|
557
|
+
$('#jegol_msgArea').live('keypress', function(e) {
|
558
|
+
if(e.keyCode == 13) {
|
559
|
+
e.preventDefault();
|
560
|
+
JeGol.execCommand($(this).val());
|
561
|
+
$(this).val('');
|
562
|
+
}
|
563
|
+
});
|
564
|
+
|
565
|
+
$('#jegol_postButton').live('click', function(e){
|
566
|
+
JeGol.execCommand($('#jegol_msgArea').val());
|
567
|
+
$('#jegol_msgArea').val('');
|
568
|
+
});
|
569
|
+
}
|
567
570
|
|
568
571
|
/**
|
569
572
|
* Start connection on HTML page load
|
570
573
|
*/
|
571
574
|
window.onload = function() {
|
575
|
+
bindEvents();
|
572
576
|
$(document).trigger('jegol_init');
|
573
577
|
};
|
574
578
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jegolize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.12
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Alemeshet Alemu
|
@@ -157,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
157
|
requirements:
|
158
158
|
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
hash: -
|
160
|
+
hash: -739886285
|
161
161
|
segments:
|
162
162
|
- 0
|
163
163
|
version: "0"
|