hi

with latest beta version which is finally running, no default chat room is created.
I set rooms a,b in phpfreechat default settings, rooms c,d in node type (I created a CCK nodetype named "chat") and rooms e, f in edit node in which I have a chat.
No room from a, b, c, d, e, f was create.
I have default settings, in settings for my node type I have set always for showing chat.

So - after chat is started - there is one (probablky default) room with name "Room"
(anyway, owahab - many thanks for that you doing on implementation of 1.0 version)

Thanks
Igor
somvprahe.sk

Comments

owahab’s picture

Bug fixed in -dev, please test with -dev and let me know.

igorik’s picture

hi, no progress, I created a new chat - http://www.somvprahe.sk/chat-3-pokus but there is one default room only although I have more default rooms with various names in settings.

Igor

permutations’s picture

This bug still exists - no default rooms are created (running 5.x-1.0-rc4). Also the default title is ignored.

Could you describe the general area in the code where the problem is so I can look, too?

permutations’s picture

I wasn't able to fix the global defaults, but I did fix the problem of node-specific data being ignored. Fix is described here:

http://drupal.org/node/250069

You can set the default rooms in each node now and they will be used.

permutations’s picture

I tracked this down. The settings are saved, but you have to clear both the phpfreechat cache and your browser's cache to see them. Here's info on clearing the phpfreechat cache:

http://www.phpfreechat.net/faq#how-to-rehash-the-chat

The parameters in the module don't match 100% the current version of phpFreeChat (v1.1). I thought about updating it, but I don't use any of the parameters so it's more trouble than it's worth. I did get as far as pulling them out of the code, and reformatting them so generate-form.php would work on them. But then I didn't code it.

Here are links to other fixes I posted for phpfreechat:

Database bug (fix this first - blocks bug needs it):
http://drupal.org/node/250069

Blocks bug:
http://drupal.org/node/200962

Scrolling bug in IE 7:
http://drupal.org/node/225162

permutations’s picture

Turns out there were a lot more problems with room settings than an uncleared cache. There were logical errors in the code, plus there was the same typo in a room variable name as I found in another function.

Here's a replacement for phpfreechat_prepare_params() in phpfreechat.module that corrects all these problems and actually works. Note that some of the parameters in the module are no longer current for phpfreechat v1.1. But for everything that is current, setting changes will work - and specifically, room settings will work.

function phpfreechat_prepare_params(&$params, &$node, &$target) {
  global $user, $base_url;
  
  // Setup nick
  if (variable_get('phpfreechat_auto_nick', '') != 'false') {
    if ($target->uid == 0) { // Assign autonumber for guests (not logged in)
      $params['nick'] = t('Anonymous') . rand(1, 1000); 
    }
    else { // Use Drupal name as nickname
      $params['nick'] = $target->name; 
    }
  }
  else { // Ask for nickname
    $params['nick'] = ''; 
  }

  // Set the serverid to the node ID
  $params['serverid'] = md5('node'. $node->nid);
  
  // This global setting will be overridden by any content-type or node settings below
  $global_title = variable_get('phpfreechat_title', '');
  $params['title'] = empty($global_title) ? $node->title : $global_title;
  
  // This global setting will be overridden by any content-type or node settings below
  $global_channels = variable_get('phpfreechat_channels', '');
  if (!empty($global_channels)) {
    $params['channels'] = explode(',', $global_channels);
  }
  else {
    $params['channels'] = $node->title;
  }

  // Overrides from content type
  $content_title = variable_get('phpfreechat_nodeapi_title_'.$node->type, '');
  if (!empty($content_title)) {
    $params['title'] = $content_title;
  }
  $content_channels = variable_get('phpfreechat_nodeapi_channels_'.$node->type, '');
  if (!empty($content_channels)) {
    $params['channels'] = explode(',', $content_channels);
  }

  // Overrides from node (global and node parameters have the same name!!)
  if (!empty($node->phpfreechat_title)) {
    $params['title'] = $node->phpfreechat_title;
  }
  if (!empty($node->phpfreechat_channels)) {
    $params['channels'] = explode(',', $node->phpfreechat_channels);
  }
  
  // Setup admins
  if (user_access('moderate chat channels')  || $node->uid == $target->uid) {
    $params['isadmin'] = true;
  }

  // Add useful info to appear in user's menu only if the selected theme is the shipped one
  if ($params['theme_path'] == file_check_location(drupal_get_path('module', 'phpfreechat') . '/extras/themes') && $params['theme'] == 'drupal') {
    $params['nickmeta'] = array(
      'drupal_base_url' => $base_url,
      'drupal_user_uid' => $target->uid,
    );
  }
  
  return $params;
}
permutations’s picture

I fixed all the bugs in the phpfreechat module (a few more than are listed above), updated the module version to 5.x-1.1, and posted the full package on my Web site here:

[Maintainer edit: Link removed. Advertising forks in the issue queue of forked module is rude.]

I emailed the original author of the module about creating a new download, but he never answered me. There were too many changes to track of as individual patches.

owahab’s picture

Version: 5.x-1.0-beta » 5.x-1.0-rc4
Status: Active » Fixed

Thanks permutations for your effort.
The fix you posted didn't allow phpfreechat 1.1 to work so I had it modified a little bit.

Thanks again for your effort.

permutations’s picture

phpFreeChat 1.1 is running just fine on my site. What problem did you find? What change did you make?

igorik’s picture

module from permutations (from May 1st, download from his page) works fine for me, on phpfreechat 1.1 and drupal 5.7,
everything works, default rooms are created right I imagine it.
many thanks for it

Igorik
http://www.somvprahe.sk

igorik’s picture

I have a question, can be user "permutations" (if he/she will be interested) added as maintainer/coomaintainer for this module?
I see no changes for this module from end of the last year, this is for the first time for whole year what everything on drupal phpmodule works correctly for me, so it can be great if now is here somebody who will be works on it (the best you both).

thanks
Igorik
http://www.somvprahe.sk

permutations’s picture

Whether I should be a maintainer is being discussed over here: http://drupal.org/node/242000

I've made two more fixes - I fixed an error in how the cache was being cleared that caused periodic hangs, and I fixed an error that causes phpFreeChat to report negative values when a numeric parameter was changed. I haven't packaged these up yet, but I will.

permutations’s picture

I'll post when there's a new version on my Web site - or you can just check the site:

http://permutations.com/drupal/phpfreechat.php

If owahab makes me the maintainer of this module, I will integrate my fixes here instead of posting separately - that is best for all.

In the meantime, owahab should stop removing the link to the fixed version. That's not a service to the community and he should not do that.

If he does again remove the link to the fixed version, just check over in the Drupal section of the phpFreeChat forum. You'll find it there, too. Or you can click on my username there (permutations) and see all my posts.

permutations’s picture

There's a new version with two additional fixes on my Web site:

http://permutations.com/drupal/phpfreechat.php

permutations’s picture

I just uploaded a new version (http://permutations.com/drupal/phpfreechat.php).

I backed out setting the default timeout to 35000 in the module. It's not working because the "negative number" error is still happening after clearing the cache (/rehash). The timeout needs to be changed to avoid disconnects, and the easiest way to do this is to change it directly in pfcglobalconfig.class.php. phpFreeChat has an integer check in there, and Drupal's form API doesn't have an integer type. I tried to identify the integer strings and change them and it worked in a test file, but not in the module.

pfcglobalconfig.class.php is in the phpFreeChat src directory (it's not a module file).

  1. To change the default timeout, find this variable assignment and change the 20000 to 35000:

    var $timeout = 35000;
    
  2. To get rid of the negative number error, comment out this code in pfcglobalconfig.class.php:

    /*	
        $numerical_positive_params = $this->_params_type["positivenumeric"];
        foreach( $numerical_positive_params as $npp )
        {
          if (!is_int($this->$npp) || $this->$npp < 0)
            $this->errors[] = _pfc("'%s' parameter must be a positive number", $npp);
        }
    */	
    
sdsheridan’s picture

Permutations: When did you upload the new version? I just took a look and the timestamps on the files are yesterday's and before, which is the one then I think i picked up yesterday morning. It also still says in the .info file it's version 1.1a, just in case you wanted to change that ;-)

permutations’s picture

I uploaded it about 2am yesterday morning. It's very strange this file isn't updated because I specifically remember getting the new date stamp. I'll fix it.

The file that changed from 1.1a was phpfreechat.module. The time stamp on the 1.1b version of the file is May 8, 2008, 1:27am. You said things are working on your installation so you must have the right version. Trying to set the timeout in the module broke the chat because of the negative parameter error.

permutations’s picture

I don't know what happened to the original phpfreechat.info file, but I updated it for 1.1b and uploaded a new version of the package. The only thing I changed besides the .info file is readme.txt. The explanation for the changes in 1.1b wasn't clear so I tweaked it a little.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.