• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

max_msg = 0 and multiple rooms

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
13 posts • Page 1 of 1

Postby white_devil » Wed Jun 13, 2007 5:45 am

Hello, first at all congratulations for this excellent software, is really good, and i'm planning myselft to make some code contributions, i just dont understand very well the source structure, so i'm reading it, to see if i can understand it the best.

Sorry about my english, i dont speak it very well.

I have this:

$params["channels"] = array("room 1");
$params["frozen_channels"] = array("room 1", "room 2", "room 3", "room 4", "room 5", "room 6", "room 7", "room 8");
$params["max_channels"] = 5;
$params["max_msg"] = 0;

and i have a list of rooms (from 1 to 8) in my website, but the problem is that when i enter in other room than the default opened room 1, whatever i type isnt displayed, it write it to the file but just doesnt display it, i mean, only the room 1 works fine, the others room i enter just doesnt work.

I tryid changing the max_msg to anything higher than 0 and then it works fine and i can see the history of all the test typing that i made, but if i use max_msg = 0 rooms doesnt work.

any help please? thank you, please let me know if i didnt explain very well

Thanks again
white_devil
Member
 
Posts: 12
Joined: Wed Jun 13, 2007 5:06 am
Location: Dominican Republic
  • Website
Top

Postby phpfreechat » Wed Jun 13, 2007 8:20 am

It looks like a bug in pfc. I will look at this problem when I have some time and I will give you feedback here.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby white_devil » Wed Jun 13, 2007 4:38 pm

Thank you a lot.

If you want, you can try to explain me which file and/or function should i look for and i can try to fix it and post it, because i really want to understand the script so i can make the code contribution.

Is just my opinion :)
white_devil
Member
 
Posts: 12
Joined: Wed Jun 13, 2007 5:06 am
Location: Dominican Republic
  • Website
Top

Postby phpfreechat » Wed Jun 13, 2007 8:56 pm

You are welcomed.
If I remember well max_msg is used in the containers (src/container.class.php or src/containers/file.class.php) so maybe search for it and try to understand the code at this point...

But it should no be easy to understand at beginning. Don't hesitate to ask me about precise piece of code.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby white_devil » Wed Jun 13, 2007 10:25 pm

excellent, i'll try it, thank you a lot :D
white_devil
Member
 
Posts: 12
Joined: Wed Jun 13, 2007 5:06 am
Location: Dominican Republic
  • Website
Top

Postby white_devil » Sat Jun 16, 2007 6:16 pm

Well, i tryied :( but i cant found the point, i tried with the read function, and the getMeta but i dont even know very well what i'm looking and i really cant find anything about where it ask for the max_msg to know how many lines should display :S, sorry i just dont understand the structure very well yet, but i keep reading, meanwhile i have another code contribution for something that i saw :D i'll post it in the right forum.

I'll wait for you to have some time and give me a hand with the bug, because i'm not very sure that i can fix it..

As i said, the messages are being written into the file but not displayed thats why i looked to the read related functions, but well, i better wait :D

Thank you a lot
white_devil
Member
 
Posts: 12
Joined: Wed Jun 13, 2007 5:06 am
Location: Dominican Republic
  • Website
Top

Postby onslo » Thu Jun 21, 2007 1:02 pm

Have you tried refreshing the page ?
I have seen similar issues and it seems to relate to the Userchan and DefaultChan arrays that are constructed when the chat page is first opened. A refresh of the page seems to correct the arrays.

see : http://www.phpfreechat.net/forum/viewtopic.php?id=1485

Regards

Onslo
onslo
Member
 
Posts: 14
Joined: Wed May 02, 2007 1:41 pm
Top

Postby white_devil » Thu Jun 21, 2007 3:22 pm

Hey, thank you for your answer but that didnt work very well (well, it kinda did)

But i saw something, i have 8 channels, (room 1 to 8) if i enter (for example) room 1, room 2 and room 3, i cant write, then if i refresh the work just fine, but only rooms 1, 2 and 3, but when i enter room 4, it doesnt work, and i have to refresh again with the room 4 opened so it will get open automaticly when i refresh and then it works fine...

Any suggestion? because i dont think that asking users to refresh the site before they can chat is a good thing, hehe :D
white_devil
Member
 
Posts: 12
Joined: Wed Jun 13, 2007 5:06 am
Location: Dominican Republic
  • Website
Top

Postby onslo » Fri Jun 22, 2007 9:17 am

Thats right, if you look at the pfc_userchan and pfc_defaultchan arrays in the source of the chat window you will see that they are not fully populated. However, when you refresh the page they do get populated, or in your case just slightly more populated until your refresh again.

I am convinced that this is the issue becuase i am seeing pretty much the same thing and have added some javascript to my chat window to detect whether or not these arrays are correctly populated and if not then alert the user to refresh the page. It's not ideal but it's the only solution that i can come up with at the moment.

Here the code i use ...

place under :
Code: Select all
<?php $chat->printChat(); ?>

Code: Select all
<?php
        #code to check that the defaultchans variable is present in the userchans list
        echo "<script type='text/javascript'>
        for(i = 0; i < pfc_userchan.length; i++){
                if(pfc_defaultchan==pfc_userchan[i]) {
                        var ChansOK=1;
                }
        }
        if(pfc_userchan=='') {
                var ChansOK=1;
        }
        if(ChansOK==1) {
        } else {
                alert("Alert : Multiple Channels - Please Refresh This Page After Loading");
        }
        </script>";
?>

Multiple chat rooms seems to work when the alert is not triggered which suggests to me that the multiple chat facility is dependant upon the population of these arrays.

rgs

Onslo
Last edited by onslo on Fri Jun 22, 2007 9:21 am, edited 1 time in total.
onslo
Member
 
Posts: 14
Joined: Wed May 02, 2007 1:41 pm
Top

Postby white_devil » Sat Jun 23, 2007 5:45 am

nice, that gives me an idea, maybe i could instead of making an alert i could send a function to redefine the array in ajax, so the user doesnt have to make a refresh, i'll give a try, thank you :D i'll post you a result
white_devil
Member
 
Posts: 12
Joined: Wed Jun 13, 2007 5:06 am
Location: Dominican Republic
  • Website
Top

Postby onslo » Wed Jun 27, 2007 8:45 am

I'd be very interested in your results and the code you use to achieve it.

Regards

Onslo
onslo
Member
 
Posts: 14
Joined: Wed May 02, 2007 1:41 pm
Top

Postby phpfreechat » Sat Jun 30, 2007 8:25 pm

I got it!

Thank youf for the bug report, it's now fixed in SVN.
Here is the patch :
Code: Select all
kerphi@ketchup:~/pfc$ svn diff src/commands/getnewmsg.class.php
Index: src/commands/getnewmsg.class.php
===================================================================
--- src/commands/getnewmsg.class.php    (révision 1039)
+++ src/commands/getnewmsg.class.php    (copie de travail)
@@ -48,16 +48,16 @@
     // create a new lock
     $_SESSION["pfc_lock_readnewmsg_".$c->getId()."_".$clientid] = time();

-
     // read the last from_id value
     $container =& pfcContainer::Instance();
     $from_id_sid = "pfc_from_id_".$c->getId()."_".$clientid."_".$recipientid;
+
     $from_id = 0;
     if (isset($_SESSION[$from_id_sid]))
       $from_id = $_SESSION[$from_id_sid];
     else
     {
-      $from_id = $container->getLastId($recipient)-$c->max_msg;
+      $from_id = $container->getLastId($recipient) - $c->max_msg - 1;
       if ($from_id < 0) $from_id = 0;
     }
     // check if this is the first time you get messages
kerphi@ketchup:~/pfc$ svn commit src/commands/getnewmsg.class.php
Envoi          src/commands/getnewmsg.class.php
Transmission des données .
Révision 1042 propagée.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby white_devil » Mon Jul 02, 2007 10:10 pm

Yes!! is working, thank you a lot Stephane (i think that is your name) wow is so cool :D thank you again!!
white_devil
Member
 
Posts: 12
Joined: Wed Jun 13, 2007 5:06 am
Location: Dominican Republic
  • Website
Top


Post a reply
13 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 7 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
cron
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub