I am using drupal chat with my own Nodejs server. When a user goes idle by pressing the respective link of the chatbox one would expect that he would disappear from the list of online users in the chatbox of other users. However, this doesn't happen. A look at the nodejs server's log shows that no messages are logged (probably nothing happens?) when the link is pressed.

Files: 
CommentFileSizeAuthor
#3 drupalchat_idle.zip17.19 KBttournie

Comments

kamalbvg’s picture

Issue summary:View changes

Same issue for me... Is there any solution to fix it?

Thanks,
Kamal.

alexandrezia’s picture

Same here. +1

ttournie’s picture

StatusFileSize
new17.19 KB

I had the same issues, the functionality have not been developped.

Have have developped my own solution and I share it with you (It is not a patch).

First you need to modify the drupalchat.js file (line 414) :

jQuery(".chat_options .status-1").live('click', function() {
            // Emit a new nodejs event.
            Drupal.Nodejs.socket.emit('SetOnline');
            jQuery(".chat_options .status-1").removeClass('status-1').addClass('chat_loading');
            jQuery.post(Drupal.settings.drupalchat.statusUrl, {status: "1"}, function(data){
                jQuery(".chat_options .chat_loading").removeClass('chat_loading').addClass('status-2').html(Drupal.settings.drupalchat.goIdle);
                jQuery("#chatpanel .icon").attr("src", Drupal.settings.drupalchat.images + "chat-1.png");
            });
});
jQuery(".chat_options .status-2").live('click', function() {
             // Emit a new nodejs event.
            Drupal.Nodejs.socket.emit('SetOffline');
            jQuery(".chat_options .status-2").removeClass('status-2').addClass('chat_loading');
            jQuery.post(Drupal.settings.drupalchat.statusUrl, {status: "2"}, function(data){
                jQuery(".chat_options .chat_loading").removeClass('chat_loading').addClass('status-1').html(Drupal.settings.drupalchat.goOnline);
                jQuery("#chatpanel .icon").attr("src", Drupal.settings.drupalchat.images + "chat-2.png");
            });
});

This code is used to emit the SetOnline & SetOffline nodejs event when you go idle/online

After this you have to modify the server.js of the nodejs drupal module to catch these events (after the line 1185) :

  socket.on('SetOffline', function () {
    process.emit('status-offline', socket.id);

  });

  socket.on('SetOnline', function () {
    process.emit('status-online', socket.id);

  });

This code is used to passe the event to the drupalchat nodejs extention.
Finaly you have to modify the file drupalchat_nodejs.server.extension.js (see attached file).

You can get the code in the file attached

When a user go idle his name disapear of the chat list for other user, but he is not disconected.