vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Chat Modifications - Dion Dev Shoutbox v2.0 (uses AJAX) (https://vborg.vbsupport.ru/showthread.php?t=210126)

DionDev 04-24-2009 07:09 AM

Expect version 2.1 within the next couple of weeks.

adiboy.net 04-24-2009 07:14 AM

Some noob questions and feedback. :D

Question 1
Is this shoutbox server intensive?

Question 2
Will there be pruning after, say, 24 hours or 48 hours?

Question 3
Can admin have the choice to position the the date/time be on the extremely left or right?

Question 4
Will this work with forums with vBSEO installed?

DionDev 04-24-2009 08:44 PM

Quote:

Originally Posted by adiboy.net (Post 1797969)
Some noob questions and feedback. :D

Question 1
Is this shoutbox server intensive?

Question 2
Will there be pruning after, say, 24 hours or 48 hours?

Question 3
Can admin have the choice to position the the date/time be on the extremely left or right?

Question 4
Will this work with forums with vBSEO installed?

1. no.

2. you set the pruning timer to however many days you want.

3. that can be done by editing one of the php files

4. yes

bc641990 04-26-2009 10:56 PM

Question 1
Can this be styles to something like Inferno Shoutbox?

i only have one question :-D

download, i hate iframes, but this is the fast shoutbox around

mikey1991 04-27-2009 10:49 PM

thanks for this

Tagged, Nominated and Installed

mysql101 04-28-2009 02:19 AM

nice simple shoutbox.

my only problem with it is that the ajax redraws the entire content of the text shown to the users every 2 seconds. You can increase the timer, but it's worthless as it makes the shoutbox feel laggy.

The proper way to do it is to append only new content to the output div OR have a hash of the last output to the user, and redraw only if the hash changes (new content to display).

mysql101 04-28-2009 03:23 AM

i made a quick hack to allow this shoutbox to work without redrawing constantly and add a userlist.

new table:

Code:

CREATE TABLE `shoutbox_hash` (
  `userid` int(11) NOT NULL default '0',
  `hash` varchar(128) NOT NULL default '0',
  `ts` int(10) NOT NULL default '0',
  UNIQUE KEY `userid` (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;




at the top of showshout.php, above the <table> tag, I have added:
Code:

ob_start ();

at the bottom, just after the </table>, I added:

Code:

$o = ob_get_contents ();
ob_clean ();

$hash = md5 ($o);

$user_id = $vbulletin->userinfo['userid'];

$q = "select hash from shoutbox_hash where userid = ".$user_id;
$res = $db->query ($q);
$row = mysql_fetch_assoc ($res);

if ($_REQUEST['hash'] != '1' || $row['hash'] != $hash) {
        $t = time () - 60;
        $q = "select u.username, u.userid from user u, shoutbox_hash h where h.userid = u.userid and h.ts > $t order by u.username";
        $res = $db->query ($q);
        $i = 0;
        $users = array ();
        while ($row = mysql_fetch_assoc ($res)) {
                $i++;
                $users[] = "<a target='_user' href='/member.php?u=".$row['userid']."'>".$row['username']."</a>";
        }
        if ($i) {
                echo "<b>Users in chat</b>: ".implode (", ", $users)."<br>";
        }

        echo $o;
}
$q = "replace into shoutbox_hash (userid, hash, ts) values (".$user_id.", '".$hash."', ".time ().")";
$db->query ($q);

Then in shoutshow.js, I replaced the setInterval with:

Code:

setInterval ("showshout('1');", 4000);

Finally, I replaced the showshout() function with:


Code:

function showshout(e)
{
  htmlrequest = ajaxfunction();

  if (htmlrequest == null)
  {
    alert ('Browser does not support HTTP requests');
    return;
  }

  htmlrequest.open('GET', 'shoutshow.php?hash=' + e, true);
  htmlrequest.setRequestHeader('If-Modified-Since', 'Thu, 01 Jan 1970 00:00:00 GMT');
  htmlrequest.onreadystatechange = statechanged;
  htmlrequest.send(null);
}



This change is a temp fix for me - it won't reduce server load, but it will reduce bandwidth consumption by a large margin.

DionDev 04-28-2009 11:52 AM

mysql101, that is an excellent hack, and I will be testing it out myself and implementing it into the next version!

keharris53 04-28-2009 07:05 PM

Any way to add a shoutbox to a specific sub forum, i.e. "forumdisplay.php?f=57"? Thanks.

mysql101 04-29-2009 12:53 AM

I was thinking that once you generate the output for the display, it should be stored somewhere, and that is the only output used. Then whenever someone makes a post (to shoutinsert.php), you wipe it out. So anytime shoutshow.php is called and there is no stored content, you regenerate it.

That will reduce the server load portion.


All times are GMT. The time now is 04:04 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01202 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete