The feature that I would like to have a lot is "Talk to everybody" meaning that when I type something, everybody who is logged in and have this "channel" selected can see my messages. Maybe font color of the user text should be calculated based on the login name somehow in order to stay simple to use and don't give too much choices.

Comments

pahariwalla’s picture

I think this is a great idea. I've started working on it, but got called away ... I might try to do it today, but it not, then definitely this week. I was thinking about making this extensible, so that as well as "everybody", the admin could set up "rooms". I think that this would be the right way to go, but if it looks like it's going to take too long to make that, them i'll just make it for "everybody".

Once I've made the framework for "rooms", we couls have all sorts of integration, eg. Organic Groups and taxonomies.. i.e. "talk to other people online who are looking at stuff tagged like the thing you're looking at"

Keep dreaming but don't stop there...

wgbiker’s picture

For me the power of this module is definitely the ease of use. I think you should always keep in mind that most of the users get confused very easily, so please when there will be many of functionalyties let them be hidden and appear in a smart way to the user only when needed. Don't give too much choice for the normal user, give many choices for admin.
Lets keep it as simple as interaction with Google:)

NaPa’s picture

Interested a lot on a more powerful extension of IM.

I can't find a good chat for my site. IM is perfect for 1 to 1 discussions with friends (private chat).
If it's possible to extend it and let admin create and edit public rooms or private/custom rooms it will be great.

And it will be more useful if we will have also a list of active users in the case of rooms, and the list of available channels... don't know, it will have to be simple but complete.

Anyway, thank you!

pahariwalla’s picture

OK, we got Chat Rooms !! It's actually a pretty ugly hack (in terms of program code) - but I wanted to get something out quicker than what it will take to really put in chat rooms in the way I'm planning on doing ... more on that later..

Anyway, the code was just committed to CVS, and the tarball download should be availabe soon. Look for a date greater than June 19.

I'll have to write some docs, but for now the instructions are on the IM settings page admin/settings/im as well as below.

Instructions for setting up chat rooms

OK, this is a TOTAL HACK, to be replaced with a proper architecture, but in the interest of immediacy, here's how to create chat rooms on IM.

  1. Create a user that will represent a chat room.
  2. Go to the admin/settings/im , expand the "Chat Rooms" fieldset, and enter that username in the box labeled "Chat Rooms". You can have multiple chat rooms by creating multiple users and then entering each on a separate line in the box.

note: You can also enter an friendy alias for the user name. For example, if you want chat rooms for bird lovers and cow lovers. You might make two users named 'birdlovers' and 'cowlovers'. Since you might want nicer names to show in IM, you might enter the following in the box.

birdlovers=Bird Lovers Room
cowlovers=Cow Lovers Room
BetaTheta’s picture

I'm curious to know, is chatrooms a high priority right now? Or will it take some time to put in chatrooms?

Mr P’s picture

So how does this work?

People click on the chatroom users name and then? Would the created chatroom user have to be logged in for this to work?

I had a try with it but the name didn't show in the talk to box.

pahariwalla’s picture

The current quick and dirty chat rooms can be created by following the instructions in Comment #4 above. After following these, the users should see the name of each chatroom that you've defined in the FriendPicker.

The user should then click on one to "enter" that room. They will see everyone's messages. If they send a message, everyone who has "entered" that room will see it.

Admin controls the lengtg of time and number of messages that stay in the chatroom "history'. Do this on admin/settings/im.

This is a stop-gap solution that hopefully will work for many sites ... a better chatroom architecture is in the making ...

Mr P’s picture

Done as instructed but chatroom user doesn't show in the 'talk to' list. Do they need to be logged in (like a normal user) for that name to be visible in the 'talk to' list?

pahariwalla’s picture

hmmm ... not sure what's wrong. The "chatroom user", i.e. the user you created to represent a chat room, does not have to be logged in. But, like normal Im-ing, you, the user who wants to chat, needs to be logged in. Anomymous Users can not IM.

Does normal IM-ing work, i.e. between 2 authenticated users?

Can you tell me what you typed into the "Chat Rooms" settings text area in admin/settings/im

Mr P’s picture

Yep, works between other users 1:1. Created 'groupe' as authenticated user. Put 'groupe' into the Chatroom field. In permissions, all registered users can IM talk with just the Administrator ticked for admin. groupe only shows when it's logged in.

pahariwalla’s picture

HA !!! Think i have the answer ... I will fix it, but in the mean time, here's how you can work around it ... In admin/settings/im - in the Chat Rooms textarea, type this:

groupe=groupe

what's going on here is that the "=" and the text on the right is an optional label you can use to be displayed in the FriendPicker instead of the actual user name. Evidently, it's crapping out if you don't have this "optional" info ....

thanks for your patience ...

Mr P’s picture

I guessed that as a possible and kept meaning to try it! Thanks.

pahariwalla’s picture

p.s. i put out a new verion yesterday (July 13) with audio support #483154: Sound alert for incoming messages. what a pain it is to do audio on Drupal without requiring another module to make it work. Actually it wasn't that bad ultimately, but it took a while to figure it out and you also have to download a (2k) flash swf to make it work (non GPL)

anyways, i'm guessing that groupe is working and so i'm happy .. better put in the fix right away so i don't forget ;-)

pahariwalla’s picture

commited fix for bug described in comment #11. Look for tarball dated July 14.

adam_b’s picture

Definitely Organic Groups - that's exactly what I need. But so far I'm dead impressed - it does more than most other chat modules, and didn't require a whole evening to understand it.

pahariwalla’s picture

Yeah I really want to open up the chatroom concept to be contextually sensitive .. One of the big questions becomes the "Friend Picker" UI - because now it could be an "anything picker". A user might want to just chat to friends and therefore see a list of other users. Or they might want to chat in a room, so they want to see a list of rooms (currently they see both in the same list).

When we bring in other stuff, like Taxonomy, there will be a room for each taxonmy, or even a specific node ... instead of just people commenting on a node, they can have a live conversation that stays with the node! ( i think this grew out of your idea @adam_b #520418: Any chance of being able to save the conversation text?)

Anyways, I need to sort of collect all these thoughts, draw up a new architecture, and present it to the community and take it from there. I really appreciate all of the ideas you've all come up with... a little overwhelming, but fun.

NaPa’s picture

Any news for this feature? I'm really looking forward to have and test it as soon as possible since this is the last feature I need for my site.

pahariwalla’s picture

Actually, if i understand your request, this has been available for a few weeks now. please see comment #4 (or the project page) for instructions, or read these below.

1) create a "fake" user at admin/user/user/create - give it the name "Tutti" (anything else you like, but for this example we'll user "Tutti")
2) then go to admin/settings/im and open the fieldset called "Chatrooms"
3) Type "Tutti" in the box

If your "Source of Friends List" is not "All Users" then make whatever adjustments you need to the View or User relationships so that "Everybody" shows up in all users FriendPicker.

Now, when a user clicks on "Tutti" in the Friend Picker, they will be entering a chatroom called "Tutti" and will see all of the messages any user has sent to "Tutti".

I hope this is what you were looking for ;-)

p.s. I did not do anything with colors ... they behave the same as before, i.e. you're msgs are in one color and all other msgs are in another color. (according the css file)

NaPa’s picture

Ok, I didn't understand that it was already usable. I'm trying and I think it works correctly, also with the sounds.

But I did some changes since I wanted a separate chat like in a page.
I thought to have different blocks for the two chatting types, 1-1 in a block and public in a page.

Anyway, for the moment I can use this version as you told, when the user can choose to go in "public" or "friend" chat:
http://safasegna.com/chat

Thank you for all the work you did.

angelmax’s picture

Hello,
thanks for this useful module. Easy, clean and straightforward.

I would like to differentiate the look of Chat Room from the normal users. It would be nice, for instance, to have the name "Chat Room" to appear in BOLD.

How do you suggest to achieve that.

Thank you.

AM

pahariwalla’s picture

You can use the theme layer. The Friend Picker is themed by function theme_im_friendlist($online_friends) in im.module.

1) Override the function (see below).
2) Add the following to your css file

.im-chatroom-link {
  font-weight: bold
}

The current theme_im_friendlist function looks like this:

function theme_im_friendlist($online_friends) {
  global $user;
  $uid = $user->uid;
  drupal_add_js(drupal_get_path('module', 'im') .'/im.js');
  drupal_add_css(drupal_get_path('module', 'im') .'/im.css');
  
  $output .= '<div id="im-friendlist" class="im-friendlist">';
  $output .= '<div id="im-friendlist-friends" class="im-friends">';
  if ($uid == 0) {
    $output .= t('Please ') . l(t('Log in'), 'user/login') . ' ' . t('to use Instant Messenger');
  }
  else {
    if (sizeof($online_friends) > 0) {
      $output .= t('Talk to: ');
      foreach ($online_friends as $key => $friend) {
        if ($friend['waiters'] > 0) { 
          $text = '('. $friend['waiters'] .') ';
        }
        else {
          $text = '';
        }
        $text .= $friend['name'];
        $onClick = 'click_on_friend(' . $friend['uid'] . ',\'' . $friend['name'] . '\'); return (false);';
        $output .= l(
          $text, '', array(
            'attributes' => array('class' => 'im-link', 'id' => 'im-uid-'.  $friend['uid'], 'onClick' =>  $onClick)
          )
        );        
        $output .= ' | ';
      }
      $onClick = 'click_on_friend(' . '0' . ',\'' . t('No One') . '\'); return (false);';
      $output .= l(t('No One'), '', array(
          'attributes' => array('class' => 'im-link', 'id' => 'im-uid-0', 'onClick' =>  $onClick)
        )
      );        
    }
    else {
      $output .= variable_get('im_no_one_online', 'Hey, where is everbody?') .' <a id="im-refresh-friendlist" href="#" onClick="getFriendList(); return (false);">refresh</a>';
    }
  }
  $output .= '</div>'; // close div.friends
  $output .= '</div>'; // close div.im-friendlist
  return $output;  
}

To override, place the following function in your theme's template.php file


function phptemplate_im_friendlist($online_friends) {
  global $user;
  $uid = $user->uid;

  $chatrooms = im_get_chatrooms();

  drupal_add_js(drupal_get_path('module', 'im') .'/im.js');
  drupal_add_css(drupal_get_path('module', 'im') .'/im.css');
  
  $output .= '<div id="im-friendlist" class="im-friendlist">';
  $output .= '<div id="im-friendlist-friends" class="im-friends">';
  if ($uid == 0) {
    $output .= t('Please ') . l(t('Log in'), 'user/login') . ' ' . t('to use Instant Messenger');
  }
  else {
    if (sizeof($online_friends) > 0) {
      $output .= t('Talk to: ');
      foreach ($online_friends as $key => $friend) {
        if ($friend['waiters'] > 0) { 
          $text = '('. $friend['waiters'] .') ';
        }
        else {
          $text = '';
        }
		$text .= $friend['name'];
        $onClick = 'click_on_friend(' . $friend['uid'] . ',\'' . $friend['name'] . '\'); return (false);';
        $classes = 'im-link';
        if (array_key_exists($friend['uid'], $chatrooms)) {
          $classes .= ' im-chatroom-link';
        }
        $output .= l(
          $text, '', array(
            'attributes' => array('class' => $classes, 'id' => 'im-uid-'.  $friend['uid'], 'onClick' =>  $onClick)
          )
        );        
        $output .= ' | ';
      }
      $onClick = 'click_on_friend(' . '0' . ',\'' . t('No One') . '\'); return (false);';
      $output .= l(t('No One'), '', array(
          'attributes' => array('class' => 'im-link', 'id' => 'im-uid-0', 'onClick' =>  $onClick)
        )
      );        
    }
    else {
      $output .= variable_get('im_no_one_online', 'Hey, where is everbody?') .' <a id="im-refresh-friendlist" href="#" onClick="getFriendList(); return (false);">refresh</a>';
    }
  }
  $output .= '</div>'; // close div.friends
  $output .= '</div>'; // close div.im-friendlist
  return $output;  
}
pahariwalla’s picture

Issue tags: +chatroom

tagging